clean up
Rust / build (macos-latest, stable) (push) Waiting to run
Rust / build (macos-latest, stable) (pull_request) Waiting to run
Rust / build (ubuntu-latest, stable) (push) Waiting to run
Rust / build (ubuntu-latest, stable) (pull_request) Waiting to run
Rust / build (windows-latest, stable) (pull_request) Waiting to run
Rust / build (windows-latest, stable) (push) Waiting to run

This commit is contained in:
2026-11-17 09:49:57 +07:00
parent 8f96a2cc16
commit d1a4cfe9fb
55 changed files with 225 additions and 207 deletions
+8 -7
View File
@@ -18,6 +18,14 @@
use std::rc::Rc;
use gpui::prelude::FluentBuilder as _;
use gpui::{
Animation, AnimationExt as _, App, Context, ElementId, Entity, InteractiveElement as _,
IntoElement, ParentElement as _, RenderOnce, Role, SharedString,
StatefulInteractiveElement as _, StyleRefinement, Styled as _, Window, deferred, div,
ease_out_quint,
};
use crate::components::button::{Button, ButtonVariant};
use crate::components::common::{
DismissHandler, ResultLogErr as _, Sizable as _, StyledExt as _, TOAST_LAYER, v_flex,
@@ -27,13 +35,6 @@ use crate::theme::{
ALERT_EDGE_WIDTH, ALERT_STACK_WIDTH, ActiveTheme as _, ENTER_SLIDE_DISTANCE, Size, TextRole,
Typeset as _,
};
use gpui::prelude::FluentBuilder as _;
use gpui::{
Animation, AnimationExt as _, App, Context, ElementId, Entity, InteractiveElement as _,
IntoElement, ParentElement as _, RenderOnce, Role, SharedString,
StatefulInteractiveElement as _, StyleRefinement, Styled as _, Window, deferred, div,
ease_out_quint,
};
/// How alarming an [`Alert`] is; picks the accent color.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
+4 -4
View File
@@ -13,16 +13,16 @@
use std::fmt::Display;
use crate::theme::{
ActiveTheme as _, Oklch, PIXEL_AVATAR_DARK_FACTOR, PIXEL_AVATAR_DARK_FLOOR,
PIXEL_AVATAR_LIGHT_CAP, PIXEL_AVATAR_LIGHT_LIFT, PIXEL_AVATAR_TINT_ALPHA, Size, ThemeVariant,
};
use gpui::{
App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _, RenderOnce, Role,
SharedString, StatefulInteractiveElement as _, StyleRefinement, Styled as _, Window, div,
};
use crate::components::common::{Sizable, StyledExt, h_flex};
use crate::theme::{
ActiveTheme as _, Oklch, PIXEL_AVATAR_DARK_FACTOR, PIXEL_AVATAR_DARK_FLOOR,
PIXEL_AVATAR_LIGHT_CAP, PIXEL_AVATAR_LIGHT_LIFT, PIXEL_AVATAR_TINT_ALPHA, Size, ThemeVariant,
};
/// Number of rows and columns in the pixel grid.
const GRID_SIZE: usize = 8;
+2 -2
View File
@@ -10,8 +10,6 @@
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 _,
@@ -20,6 +18,8 @@ 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>;
+4 -3
View File
@@ -11,20 +11,21 @@
//! .on_click(|_event, _window, _cx| println!("saved"));
//! ```
use crate::icons::Icon;
use crate::theme::{ActiveTheme as _, ControlMetrics, DISABLED_OPACITY, Size};
use std::rc::Rc;
use gpui::prelude::FluentBuilder as _;
use gpui::{
AnyElement, AnyView, App, ClickEvent, ElementId, InteractiveElement as _, IntoElement,
ParentElement, RenderOnce, Role, SharedString, StatefulInteractiveElement as _,
StyleRefinement, Styled as _, Window, canvas, relative, transparent_black,
};
use std::rc::Rc;
use crate::components::common::{
Sizable, StyledExt as _, focus_ring, h_flex, record_anchor_bounds,
};
use crate::components::spinner::Spinner;
use crate::icons::Icon;
use crate::theme::{ActiveTheme as _, ControlMetrics, DISABLED_OPACITY, Size};
/// The single activation handler, shared by pointer, Enter, and Space.
type ClickHandler = Box<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
+4 -3
View File
@@ -13,15 +13,16 @@
use std::rc::Rc;
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex};
use crate::icons::{IconRole, icon};
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _, RenderOnce, Role,
SharedString, StatefulInteractiveElement as _, StyleRefinement, Styled as _, Toggled, Window,
};
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex};
use crate::icons::{IconRole, icon};
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
/// The change reporter, fired with the next value by pointer, Enter, and Space.
type ChangeHandler = Box<dyn Fn(bool, &mut Window, &mut App)>;
+5 -4
View File
@@ -13,16 +13,17 @@
use std::rc::Rc;
use std::time::Duration;
use crate::components::button::{Button, ButtonVariant};
use crate::components::common::{ResultLogErr as _, Sizable, StyledExt as _};
use crate::icons::IconRole;
use crate::theme::Size;
use gpui::prelude::FluentBuilder as _;
use gpui::{
AnyView, App, ClipboardItem, ElementId, Entity, IntoElement, RenderOnce, SharedString,
StyleRefinement, Task, Window,
};
use crate::components::button::{Button, ButtonVariant};
use crate::components::common::{ResultLogErr as _, Sizable, StyledExt as _};
use crate::icons::IconRole;
use crate::theme::Size;
/// How long the check mark shows before reverting to the copy icon.
pub const COPIED_DURATION: Duration = Duration::from_secs(1);
+5 -5
View File
@@ -23,11 +23,6 @@
//! }
//! ```
use crate::components::scrollbar::{Scrollbar, ScrollbarHandle, ScrollbarVisibility};
use crate::theme::{
ActiveTheme as _, CODE_GUTTER_WIDTH, CODE_LINE_HEIGHT, ColorTokens, MONO_ADVANCE_RATIO, Ramps,
WASH_ALPHA_SOFT,
};
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, Bounds, ClipboardItem, Context, ElementId, HighlightStyle, Hsla, InteractiveElement as _,
@@ -38,7 +33,12 @@ use gpui::{
};
use crate::components::highlight::{HighlightedCode, Language, Role, highlight};
use crate::components::scrollbar::{Scrollbar, ScrollbarHandle, ScrollbarVisibility};
use crate::components::utils::gutter_cell;
use crate::theme::{
ActiveTheme as _, CODE_GUTTER_WIDTH, CODE_LINE_HEIGHT, ColorTokens, MONO_ADVANCE_RATIO, Ramps,
WASH_ALPHA_SOFT,
};
actions!(code_view, [Copy]);
+8 -8
View File
@@ -28,14 +28,6 @@
use std::cell::RefCell;
use std::rc::Rc;
use crate::components::common::{
OVERLAY_LAYER, ResultLogErr as _, Sizable, StyledExt as _, h_flex, v_flex,
};
use crate::components::input::{Input, InputState, InputStateEvent};
use crate::components::scroll_area::ScrollArea;
use crate::icons::{IconRole, icon};
use crate::theme::ActiveTheme as _;
use crate::theme::{COMBOBOX_MIN_WIDTH, COMBOBOX_WIDTH, POPUP_MAX_HEIGHT, Size};
use gpui::prelude::FluentBuilder;
use gpui::{
App, Bounds, Context, ElementId, Entity, InteractiveElement as _, IntoElement, KeyBinding,
@@ -44,6 +36,14 @@ use gpui::{
Window, actions, anchored, canvas, deferred, div, point, px,
};
use crate::components::common::{
OVERLAY_LAYER, ResultLogErr as _, Sizable, StyledExt as _, h_flex, v_flex,
};
use crate::components::input::{Input, InputState, InputStateEvent};
use crate::components::scroll_area::ScrollArea;
use crate::icons::{IconRole, icon};
use crate::theme::{ActiveTheme as _, COMBOBOX_MIN_WIDTH, COMBOBOX_WIDTH, POPUP_MAX_HEIGHT, Size};
actions!(
combobox,
[HighlightNext, HighlightPrevious, Choose, Dismiss]
+2 -2
View File
@@ -26,8 +26,6 @@
use std::rc::Rc;
use crate::icons::Icon;
use crate::theme::{ActiveTheme as _, POPUP_MAX_HEIGHT, Size};
use gpui::prelude::FluentBuilder;
use gpui::{
AnyElement, App, Context, ElementId, Entity, InteractiveElement as _, IntoElement, KeyBinding,
@@ -39,6 +37,8 @@ use gpui::{
use crate::components::common::{DIALOG_LAYER, StyledExt as _, h_flex, v_flex};
use crate::components::input::{Input, InputState, InputStateEvent};
use crate::components::scroll_area::{ScrollArea, ScrollAxes};
use crate::icons::Icon;
use crate::theme::{ActiveTheme as _, POPUP_MAX_HEIGHT, Size};
actions!(
command_palette,
+3 -2
View File
@@ -10,16 +10,17 @@
//! let column = v_flex().gap_2().child(row);
//! ```
use crate::theme::{ActiveTheme as _, FOCUS_RING_ALPHA, FOCUS_RING_SPREAD};
use std::collections::HashMap;
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, Bounds, BoxShadow, Div, ElementId, FocusHandle, Global, Hsla, IntoElement, Pixels,
Refineable as _, StatefulInteractiveElement, StyleRefinement, Styled, Window, WindowId, div,
px,
};
use std::collections::HashMap;
pub use crate::theme::Size;
use crate::theme::{ActiveTheme as _, FOCUS_RING_ALPHA, FOCUS_RING_SPREAD};
/// A row whose children center on the cross axis.
#[must_use]
+3 -3
View File
@@ -17,11 +17,9 @@
//! .on_change(|open, _window, _cx| println!("dialog open: {open}"));
//! ```
use gpui::prelude::FluentBuilder as _;
use std::rc::Rc;
use crate::icons::IconRole;
use crate::theme::{ActiveTheme as _, DIALOG_MIN_WIDTH, TextRole, Typeset as _};
use gpui::prelude::FluentBuilder as _;
use gpui::{
Animation, AnimationExt as _, AnyElement, App, DefiniteLength, ElementId,
InteractiveElement as _, IntoElement, KeyDownEvent, MouseButton, ParentElement as _,
@@ -33,6 +31,8 @@ use crate::components::button::{Button, ButtonVariant};
use crate::components::common::{DIALOG_LAYER, Sizable, StyledExt as _, v_flex};
use crate::components::grain::grain;
use crate::components::scroll_area::ScrollArea;
use crate::icons::IconRole;
use crate::theme::{ActiveTheme as _, DIALOG_MIN_WIDTH, TextRole, Typeset as _};
/// Requests the dialog's close: `false` closes.
pub type ChangeHandler = Rc<dyn Fn(bool, &mut Window, &mut App)>;
+4 -4
View File
@@ -26,8 +26,8 @@
//! }
//! ```
use crate::components::scrollbar::{Scrollbar, ScrollbarHandle, ScrollbarVisibility};
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, CODE_GUTTER_WIDTH, MONO_ADVANCE_RATIO};
use std::ops::Range;
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, Context, ElementId, HighlightStyle, InteractiveElement as _, IntoElement,
@@ -37,10 +37,10 @@ use gpui::{
};
use similar::{Change, ChangeTag, TextDiff};
use std::ops::Range;
use crate::components::highlight::{HighlightedCode, Language, Line, Role, highlight};
use crate::components::scrollbar::{Scrollbar, ScrollbarHandle, ScrollbarVisibility};
use crate::components::utils::{gutter_cell, wash, wash_gutter, wash_strong};
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, CODE_GUTTER_WIDTH, MONO_ADVANCE_RATIO};
/// What a diff row did to the file.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+2 -2
View File
@@ -15,8 +15,6 @@
use std::cell::RefCell;
use std::rc::Rc;
use crate::icons::{Icon, IconRole, icon};
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, ClickEvent, DefiniteLength, DispatchPhase, ElementId, InteractiveElement as _,
@@ -31,6 +29,8 @@ use crate::components::menu::{
ChangeHandler, MenuChrome, MenuItem, MenuPanelSpec, TriggerBoundsCell, anchored_menu_panel,
};
use crate::components::spinner::Spinner;
use crate::icons::{Icon, IconRole, icon};
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
/// The main zone's activation handler, shared by pointer, Enter, and Space.
type ClickHandler = Box<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
+2 -2
View File
@@ -9,8 +9,6 @@
//! .hint("Create a project to get started");
//! ```
use crate::icons::Icon;
use crate::theme::{ActiveTheme as _, Size, TextRole, Typeset as _};
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, IntoElement, ParentElement as _, RenderOnce, SharedString, StyleRefinement, Styled as _,
@@ -18,6 +16,8 @@ use gpui::{
};
use crate::components::common::{StyledExt, v_flex};
use crate::icons::Icon;
use crate::theme::{ActiveTheme as _, Size, TextRole, Typeset as _};
/// The centered "nothing here yet" panel for lists, tables, and searches.
#[derive(IntoElement)]
+1 -1
View File
@@ -12,7 +12,6 @@
//! .child(div());
//! ```
use crate::theme::{ActiveTheme as _, TextRole, Typeset as _};
use gpui::prelude::FluentBuilder as _;
use gpui::{
AnyElement, App, ElementId, InteractiveElement as _, IntoElement, ParentElement, RenderOnce,
@@ -20,6 +19,7 @@ use gpui::{
};
use crate::components::common::{StyledExt, h_flex, v_flex};
use crate::theme::{ActiveTheme as _, TextRole, Typeset as _};
/// The arrangement of a [`Field`]'s label and control.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
+3 -2
View File
@@ -12,14 +12,15 @@
use std::sync::{Arc, OnceLock};
use crate::components::common::ResultLogErr as _;
use crate::theme::GRAIN_ALPHA;
use gpui::{
App, Bounds, Corners, IntoElement, RenderImage, RenderOnce, Styled as _, Window, canvas, point,
px, size,
};
use image::{Frame, ImageBuffer, Rgba};
use crate::components::common::ResultLogErr as _;
use crate::theme::GRAIN_ALPHA;
/// The side of one noise tile, in device pixels.
const TILE_PX: u32 = 256;
+4 -2
View File
@@ -13,13 +13,15 @@
//! }
//! ```
use crate::components::common::ResultLogErr;
use gpui::SharedString;
use std::cell::RefCell;
use std::collections::HashMap;
use gpui::SharedString;
#[cfg(not(target_arch = "wasm32"))]
use tree_sitter::StreamingIterator as _;
use crate::components::common::ResultLogErr;
#[cfg(not(target_arch = "wasm32"))]
thread_local! {
static HIGHLIGHTERS: RefCell<HashMap<Language, Option<Highlighter>>> =
+6 -7
View File
@@ -25,13 +25,6 @@ use std::ops::Range;
use std::rc::Rc;
use std::time::{Duration, Instant};
use unicode_segmentation::UnicodeSegmentation;
use crate::icons::IconRole;
use crate::theme::{
ActiveTheme as _, CARET_WIDTH, ColorTokens, DISABLED_OPACITY, Size, UNDERLINE_WIDTH,
WHEEL_LINE_HEIGHT,
};
use gpui::prelude::FluentBuilder as _;
use gpui::{
Animation, AnimationExt as _, AnyElement, App, AppContext as _, Bounds, ClipboardItem,
@@ -42,9 +35,15 @@ use gpui::{
StatefulInteractiveElement as _, StyleRefinement, Styled as _, TextAlign, TextRun,
UTF16Selection, Window, WrappedLine, actions, canvas, div, fill, point, px,
};
use unicode_segmentation::UnicodeSegmentation;
use crate::components::button::{Button, ButtonVariant};
use crate::components::common::{Sizable, StyledExt as _, h_flex};
use crate::icons::IconRole;
use crate::theme::{
ActiveTheme as _, CARET_WIDTH, ColorTokens, DISABLED_OPACITY, Size, UNDERLINE_WIDTH,
WHEEL_LINE_HEIGHT,
};
/// The key context [`InputBindings`] match against.
pub const INPUT_CONTEXT: &str = "Input";
+3 -2
View File
@@ -14,8 +14,6 @@
//! .on_click(|_event, _window, _cx| println!("open settings"));
//! ```
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex};
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, ClickEvent, ElementId, InteractiveElement as _, IntoElement, ParentElement as _,
@@ -23,6 +21,9 @@ use gpui::{
Window,
};
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex};
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
/// The handler called with the [`gpui::ClickEvent`], replacing the default `href` opening.
type ClickHandler = Box<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
+6 -5
View File
@@ -18,11 +18,6 @@
use std::rc::Rc;
use crate::components::common::{
StyledExt as _, nav_key, paint_selectable_row, selectable_label_color,
};
use crate::icons::Icon;
use crate::theme::{ActiveTheme as _, TextRole, Typeset as _};
use gpui::prelude::FluentBuilder;
use gpui::{
AnyElement, App, ElementId, FocusHandle, InteractiveElement as _, IntoElement, KeyDownEvent,
@@ -30,6 +25,12 @@ use gpui::{
StyleRefinement, Styled as _, Window, div,
};
use crate::components::common::{
StyledExt as _, nav_key, paint_selectable_row, selectable_label_color,
};
use crate::icons::Icon;
use crate::theme::{ActiveTheme as _, TextRole, Typeset as _};
/// The change reporter, fired with the next selection by pointer and keys.
type ChangeHandler = Rc<dyn Fn(Option<usize>, &mut Window, &mut App)>;
/// The row builder, run during render.
+15 -15
View File
@@ -24,14 +24,12 @@
//! }
//! ```
use crate::components::button::{Button, ButtonVariant};
use crate::components::checkbox::Checkbox;
use crate::components::common::Sizable as _;
use crate::components::scrollbar::{Scrollbar, ScrollbarVisibility};
use crate::theme::{
ActiveTheme as _, BORDER_WIDTH, CODE_LINE_HEIGHT, CODE_OVERSCROLL_MAX, Size, TextRole,
Typeset as _,
};
use std::borrow::Borrow as _;
use std::collections::HashMap;
use std::hash::{DefaultHasher, Hash, Hasher};
use std::ops::Range;
use std::sync::Arc;
use gpui::prelude::FluentBuilder as _;
use gpui::{
AnyElement, App, Bounds, ClipboardItem, Context, Div, Element, ElementId, Entity, FontStyle,
@@ -44,14 +42,16 @@ use gpui::{
};
use pulldown_cmark::{CodeBlockKind, Event, HeadingLevel, Options, Parser, Tag, TagEnd};
use std::borrow::Borrow as _;
use std::collections::HashMap;
use std::hash::{DefaultHasher, Hash, Hasher};
use std::ops::Range;
use std::sync::Arc;
use crate::components::button::{Button, ButtonVariant};
use crate::components::checkbox::Checkbox;
use crate::components::common::Sizable as _;
use crate::components::highlight::{HighlightedCode, Language, highlight, plain};
use crate::components::scrollbar::{Scrollbar, ScrollbarVisibility};
use crate::components::utils::code_line;
use crate::theme::{
ActiveTheme as _, BORDER_WIDTH, CODE_LINE_HEIGHT, CODE_OVERSCROLL_MAX, Size, TextRole,
Typeset as _,
};
/// The bottom padding between sibling blocks, in root font sizes.
const BLOCK_GAP: f32 = 0.75;
@@ -678,8 +678,8 @@ impl Styled for TextView {
}
impl Element for TextView {
type RequestLayoutState = AnyElement;
type PrepaintState = ();
type RequestLayoutState = AnyElement;
fn id(&self) -> Option<ElementId> {
Some(self.id.clone())
+5 -4
View File
@@ -23,10 +23,6 @@
use std::cell::RefCell;
use std::rc::Rc;
use crate::components::common::{OVERLAY_LAYER, StyledExt as _, focus_handle, v_flex};
use crate::components::scroll_area::{ScrollArea, ScrollAxes};
use crate::icons::{Icon, IconRole, icon as icon_glyph};
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, MENU_MIN_WIDTH, POPUP_MAX_HEIGHT};
use gpui::prelude::FluentBuilder;
use gpui::{
Animation, AnimationExt as _, AnyElement, App, Bounds, BoxShadow, DefiniteLength,
@@ -36,6 +32,11 @@ use gpui::{
Window, anchored, canvas, deferred, div, ease_out_quint, point, px, relative,
};
use crate::components::common::{OVERLAY_LAYER, StyledExt as _, focus_handle, v_flex};
use crate::components::scroll_area::{ScrollArea, ScrollAxes};
use crate::icons::{Icon, IconRole, icon as icon_glyph};
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, MENU_MIN_WIDTH, POPUP_MAX_HEIGHT};
/// Runs the item's action. The menu closes itself before the handler runs.
pub type ItemHandler = Rc<dyn Fn(&mut Window, &mut App)>;
+1 -1
View File
@@ -22,7 +22,6 @@
use std::cell::RefCell;
use std::rc::Rc;
use crate::theme::{ActiveTheme as _, POPOVER_MIN_WIDTH};
use gpui::prelude::FluentBuilder as _;
use gpui::{
Animation, AnimationExt as _, AnyElement, App, Bounds, DispatchPhase, ElementId,
@@ -32,6 +31,7 @@ use gpui::{
};
use crate::components::common::{OVERLAY_LAYER, StyledExt as _, v_flex};
use crate::theme::{ActiveTheme as _, POPOVER_MIN_WIDTH};
/// Reports the next open state of a [`Popover`]: `true` to open, `false` to close.
type ChangeHandler = Rc<dyn Fn(bool, &mut Window, &mut App)>;
+1 -1
View File
@@ -9,7 +9,6 @@
//! let loading = Progress::new("loading", 0.0).indeterminate(true);
//! ```
use crate::theme::{ActiveTheme as _, PROGRESS_ANIMATION_PERIOD, Size};
use gpui::prelude::FluentBuilder as _;
use gpui::{
Animation, AnimationExt as _, App, ElementId, InteractiveElement as _, IntoElement,
@@ -18,6 +17,7 @@ use gpui::{
};
use crate::components::common::{Sizable, StyledExt as _};
use crate::theme::{ActiveTheme as _, PROGRESS_ANIMATION_PERIOD, Size};
/// A bar that paints a determinate fill from its `value`, or an indeterminate sweep.
#[derive(IntoElement)]
+3 -2
View File
@@ -12,8 +12,6 @@
//! .on_change(|value, _window, _cx| println!("selected: {value}"));
//! ```
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex, v_flex};
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
use gpui::prelude::FluentBuilder;
use gpui::{
App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _, RenderOnce, Role,
@@ -21,6 +19,9 @@ use gpui::{
div,
};
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex, v_flex};
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
/// The group's change reporter, fired with the clicked radio's value.
type ChangeHandler<V> = std::rc::Rc<dyn Fn(V, &mut Window, &mut App)>;
+3 -2
View File
@@ -17,8 +17,6 @@ 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,
@@ -26,6 +24,9 @@ use gpui::{
point,
};
use crate::components::common::ResultLogErr as _;
use crate::theme::{ActiveTheme as _, SCROLLBAR_AUTOHIDE_DELAY, SCROLLBAR_FADE_DURATION};
/// When an overlay scrollbar shows.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum ScrollbarVisibility {
+4 -3
View File
@@ -15,9 +15,6 @@
use std::rc::Rc;
use crate::components::common::{Sizable, StyledExt, focus_handle, focus_ring, h_flex};
use crate::icons::Icon;
use crate::theme::{ActiveTheme as _, CONTROL_SPRING, Size};
use gpui::prelude::FluentBuilder;
use gpui::{
AnimationExt as _, App, Bounds, ElementId, Entity, InteractiveElement as _, IntoElement,
@@ -25,6 +22,10 @@ use gpui::{
StatefulInteractiveElement as _, StyleRefinement, Styled as _, Toggled, Window, canvas, div,
};
use crate::components::common::{Sizable, StyledExt, focus_handle, focus_ring, h_flex};
use crate::icons::Icon;
use crate::theme::{ActiveTheme as _, CONTROL_SPRING, Size};
/// Reports the segment the user chose.
type ChangeHandler<T> = Rc<dyn Fn(T, &mut Window, &mut App)>;
+5 -4
View File
@@ -16,10 +16,6 @@
use std::rc::Rc;
use crate::components::common::{Sizable, StyledExt, focus_handle, h_flex};
use crate::components::menu::{Menu, MenuItem};
use crate::icons::{Icon, IconRole, icon};
use crate::theme::{ActiveTheme as _, Size};
use gpui::prelude::FluentBuilder;
use gpui::{
App, ElementId, InteractiveElement as _, IntoElement, KeyDownEvent, ParentElement as _,
@@ -27,6 +23,11 @@ use gpui::{
Window, canvas,
};
use crate::components::common::{Sizable, StyledExt, focus_handle, h_flex};
use crate::components::menu::{Menu, MenuItem};
use crate::icons::{Icon, IconRole, icon};
use crate::theme::{ActiveTheme as _, Size};
/// Reports the value the user chose. `None` means the select holds no value.
pub type SelectHandler<T> = Rc<dyn Fn(Option<T>, &mut Window, &mut App)>;
+3 -2
View File
@@ -11,14 +11,15 @@
use std::rc::Rc;
use crate::components::common::StyledExt as _;
use crate::theme::{ActiveTheme as _, BORDER_WIDTH};
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, InteractiveElement as _, IntoElement, RenderOnce, StyleRefinement, Styled as _, Window,
div,
};
use crate::components::common::StyledExt as _;
use crate::theme::{ActiveTheme as _, BORDER_WIDTH};
/// The axis a [`Separator`] rule runs along.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum SeparatorOrientation {
+7 -6
View File
@@ -17,12 +17,6 @@
use std::rc::Rc;
use crate::components::common::{
StyledExt as _, nav_key, paint_selectable_row, selectable_label_color,
};
use crate::components::grain::grain as grain_overlay;
use crate::components::scroll_area::ScrollArea;
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, SIDEBAR_DEFAULT_WIDTH, TextRole, Typeset as _};
use gpui::prelude::FluentBuilder;
use gpui::{
AnyElement, App, ElementId, FocusHandle, InteractiveElement as _, IntoElement, KeyDownEvent,
@@ -30,6 +24,13 @@ use gpui::{
StyleRefinement, Styled as _, Window, div,
};
use crate::components::common::{
StyledExt as _, nav_key, paint_selectable_row, selectable_label_color,
};
use crate::components::grain::grain as grain_overlay;
use crate::components::scroll_area::ScrollArea;
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, SIDEBAR_DEFAULT_WIDTH, TextRole, Typeset as _};
/// The change reporter, fired with the next selected row by pointer and keys.
type ChangeHandler = Rc<dyn Fn(Option<usize>, &mut Window, &mut App)>;
/// The entries builder, run during render.
+3 -2
View File
@@ -13,8 +13,6 @@
use std::cell::Cell;
use std::rc::Rc;
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex};
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, Bounds, DispatchPhase, ElementId, InteractiveElement as _, IntoElement, KeyDownEvent,
@@ -23,6 +21,9 @@ use gpui::{
div, relative,
};
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex};
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
/// The change reporter, fired with the next value by click, drag, and arrows.
type ChangeHandler = Rc<dyn Fn(f32, &mut Window, &mut App)>;
+7 -7
View File
@@ -24,16 +24,10 @@
//! # }
//! ```
use std::time::Duration;
#[cfg(not(target_arch = "wasm32"))]
use std::sync::{Arc, Mutex};
use std::time::Duration;
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex};
use crate::components::spinner::{Spinner, SpinnerVariant};
use crate::components::tooltip::Tooltip;
use crate::icons::{IconRole, icon};
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, SPEECH_WAVEFORM_WIDTH, Size};
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, Context, ElementId, Entity, EventEmitter, InteractiveElement as _, IntoElement,
@@ -41,6 +35,12 @@ use gpui::{
StyleRefinement, Styled, Subscription, Task, WeakEntity, Window, div, relative,
};
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex};
use crate::components::spinner::{Spinner, SpinnerVariant};
use crate::components::tooltip::Tooltip;
use crate::icons::{IconRole, icon};
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, SPEECH_WAVEFORM_WIDTH, Size};
/// One input-level entry per this much of captured audio.
const LEVEL_BUCKET: Duration = Duration::from_millis(80);
/// The level history a waveform draws, one entry per [`LEVEL_BUCKET`].
+2 -2
View File
@@ -15,8 +15,6 @@ use std::cell::Cell;
use std::f32::consts::{PI, TAU};
use std::rc::Rc;
use crate::icons::{Icon, IconRole, icon};
use crate::theme::{ActiveTheme as _, SPINNER_PERIOD, Size};
use gpui::prelude::FluentBuilder as _;
use gpui::{
Animation, AnimationElement, AnimationExt as _, App, Canvas, ElementId, Hsla,
@@ -26,6 +24,8 @@ use gpui::{
};
use crate::components::common::{Sizable, StyledExt as _};
use crate::icons::{Icon, IconRole, icon};
use crate::theme::{ActiveTheme as _, SPINNER_PERIOD, Size};
/// The share of the circle the spinning arc paints.
const SPIN_SWEEP: f32 = 0.75;
+1 -1
View File
@@ -10,7 +10,6 @@
//! .label("Deployed");
//! ```
use crate::theme::{ActiveTheme as _, Size, Theme};
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, ElementId, Hsla, InteractiveElement as _, IntoElement, RenderOnce, Role, SharedString,
@@ -18,6 +17,7 @@ use gpui::{
};
use crate::components::common::{Sizable, StyledExt};
use crate::theme::{ActiveTheme as _, Size, Theme};
/// How loud a dot is, the same vocabulary as [`crate::components::badge::BadgeVariant`].
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
+3 -2
View File
@@ -11,8 +11,6 @@
//! .on_change(|checked, _window, _cx| println!("checked: {checked}"));
//! ```
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex};
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, CONTROL_SPRING, DISABLED_OPACITY, Size};
use gpui::prelude::FluentBuilder as _;
use gpui::{
AnimationExt as _, App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _,
@@ -20,6 +18,9 @@ use gpui::{
StyleRefinement, Styled as _, Toggled, Window, div, px,
};
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex};
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, CONTROL_SPRING, DISABLED_OPACITY, Size};
/// The change reporter, fired with the next value by pointer, Enter, and Space.
type ChangeHandler = Box<dyn Fn(bool, &mut Window, &mut App)>;
+9 -8
View File
@@ -19,6 +19,15 @@ use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use gpui::prelude::FluentBuilder;
use gpui::{
AnyElement, App, AppContext as _, Bounds, ClickEvent, Context, Div, ElementId, Global,
InteractiveElement as _, IntoElement, KeyDownEvent, MouseButton, ParentElement as _, Pixels,
Point, Render, RenderOnce, Role, SharedString, Stateful, StatefulInteractiveElement as _,
StyleRefinement, Styled as _, TextOverflow, Window, canvas, div, linear_color_stop,
linear_gradient, px, relative,
};
use crate::components::button::{Button, ButtonVariant};
use crate::components::common::{Sizable as _, StyledExt as _, adjacent_selectable, v_flex};
use crate::components::popover::Popover;
@@ -30,14 +39,6 @@ use crate::theme::{
ActiveTheme as _, ControlMetrics, POPUP_MAX_HEIGHT, Size, TAB_INDICATOR_WIDTH, TAB_MAX_WIDTH,
TAB_MIN_WIDTH,
};
use gpui::prelude::FluentBuilder;
use gpui::{
AnyElement, App, AppContext as _, Bounds, ClickEvent, Context, Div, ElementId, Global,
InteractiveElement as _, IntoElement, KeyDownEvent, MouseButton, ParentElement as _, Pixels,
Point, Render, RenderOnce, Role, SharedString, Stateful, StatefulInteractiveElement as _,
StyleRefinement, Styled as _, TextOverflow, Window, canvas, div, linear_color_stop,
linear_gradient, px, relative,
};
/// Reports the next selected tab by pointer and keys.
type ChangeHandler = Rc<dyn Fn(usize, &mut Window, &mut App)>;
+7 -6
View File
@@ -15,12 +15,6 @@
use std::rc::Rc;
use std::time::Duration;
use crate::components::button::{Button, ButtonVariant};
use crate::components::common::{
DismissHandler, ResultLogErr as _, Sizable as _, StyledExt as _, TOAST_LAYER,
};
use crate::icons::{Icon, IconRole};
use crate::theme::{ActiveTheme as _, TOAST_MAX_WIDTH};
use gpui::prelude::FluentBuilder;
use gpui::{
Animation, AnimationExt as _, App, Context, ElementId, Entity, InteractiveElement as _,
@@ -29,6 +23,13 @@ use gpui::{
ease_out_quint, px,
};
use crate::components::button::{Button, ButtonVariant};
use crate::components::common::{
DismissHandler, ResultLogErr as _, Sizable as _, StyledExt as _, TOAST_LAYER,
};
use crate::icons::{Icon, IconRole};
use crate::theme::{ActiveTheme as _, TOAST_MAX_WIDTH};
/// The action handler of a [`Toast`].
pub type ActionHandler = Rc<dyn Fn(&mut App)>;
+4 -3
View File
@@ -11,15 +11,16 @@
//! .on_change(|pressed, _window, _cx| println!("bold: {pressed}"));
//! ```
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex};
use crate::icons::Icon;
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _, RenderOnce, Role,
SharedString, StatefulInteractiveElement as _, StyleRefinement, Styled as _, Toggled, Window,
};
use crate::components::common::{Sizable, StyledExt as _, focus_ring, h_flex};
use crate::icons::Icon;
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
/// The change handler, fired with the next pressed state.
type ChangeHandler = Box<dyn Fn(bool, &mut Window, &mut App)>;
+6 -6
View File
@@ -13,14 +13,14 @@
//! let tip = Tooltip::new("Delete the selected project", &mut cx);
//! ```
use gpui::{
AnyView, App, AppContext as _, Bounds, Context, ElementId, Entity, InteractiveElement as _,
IntoElement, ParentElement as _, Pixels, Render, Role, SharedString,
StatefulInteractiveElement as _, Styled as _, Window, canvas, div, point,
};
use crate::components::common::{anchor_bounds, record_anchor_bounds};
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, TOOLTIP_MAX_WIDTH, TOOLTIP_OFFSET};
use gpui::AppContext as _;
use gpui::{
AnyView, App, Bounds, Context, ElementId, Entity, InteractiveElement as _, IntoElement,
ParentElement as _, Pixels, Render, Role, SharedString, StatefulInteractiveElement as _,
Styled as _, Window, canvas, div, point,
};
const PANEL_BOUNDS_ID: &str = "tooltip-panel-bounds";
+6 -5
View File
@@ -17,11 +17,6 @@
use std::rc::Rc;
use crate::components::common::{
StyledExt as _, nav_key, paint_selectable_row, selectable_label_color,
};
use crate::icons::{Icon, IconRole, icon};
use crate::theme::ActiveTheme as _;
use gpui::prelude::FluentBuilder;
use gpui::{
AnyElement, App, ElementId, FocusHandle, InteractiveElement as _, IntoElement, KeyDownEvent,
@@ -29,6 +24,12 @@ use gpui::{
StyleRefinement, Styled as _, Window, div,
};
use crate::components::common::{
StyledExt as _, nav_key, paint_selectable_row, selectable_label_color,
};
use crate::icons::{Icon, IconRole, icon};
use crate::theme::ActiveTheme as _;
/// The change reporter, fired with the next selection by pointer and keys.
type ChangeHandler = Rc<dyn Fn(Option<usize>, &mut Window, &mut App)>;
/// The disclosure reporter, fired with the toggled row's index.
+8 -8
View File
@@ -3,15 +3,15 @@
use std::ops::Range;
use crate::components::highlight::{Language, Line};
use crate::theme::{ActiveTheme as _, CODE_GUTTER_WIDTH};
use crate::theme::{ColorTokens, Ramps};
use crate::theme::{WASH_ALPHA, WASH_ALPHA_GUTTER, WASH_ALPHA_STRONG};
use gpui::StyledText;
use gpui::{App, IntoElement, ParentElement as _, Styled as _, div};
use gpui::{HighlightStyle, Hsla};
use gpui::{
App, HighlightStyle, Hsla, IntoElement, ParentElement as _, Styled as _, StyledText, div,
};
use crate::components::highlight::Role;
use crate::components::highlight::{Language, Line, Role};
use crate::theme::{
ActiveTheme as _, CODE_GUTTER_WIDTH, ColorTokens, Ramps, WASH_ALPHA, WASH_ALPHA_GUTTER,
WASH_ALPHA_STRONG,
};
impl Role {
/// Maps the role to the theme's semantic palette.
+2 -1
View File
@@ -1,11 +1,12 @@
//! Application window layout: a titlebar over a panel row.
use crate::theme::{FOCUS_RING_ALPHA, FOCUS_RING_SPREAD};
use gpui::{
App, BoxShadow, Div, ElementId, FocusHandle, Hsla, Refineable as _, StyleRefinement, Styled,
Window, div, px,
};
use crate::theme::{FOCUS_RING_ALPHA, FOCUS_RING_SPREAD};
pub mod panel;
pub mod resizable;
pub mod resize_handle;
+2 -2
View File
@@ -5,14 +5,14 @@
use std::sync::Arc;
use crate::layout::StyledExt as _;
use crate::theme::ActiveTheme as _;
use gpui::{
AnyElement, AnyView, App, Axis, Div, ElementId, Entity, IntoElement, ParentElement as _,
Render, RenderOnce, SharedString, StyleRefinement, Styled as _, Window, div,
};
use crate::layout::StyledExt as _;
use crate::layout::resizable::{Resizable, ResizableState};
use crate::theme::ActiveTheme as _;
/// A user-defined panel the row can show.
#[allow(unused_variables)]
+2 -2
View File
@@ -1,7 +1,5 @@
//! The resizable group: stacked panes with drag dividers, outside the dock.
use crate::layout::StyledExt as _;
use crate::theme::{PANE_DEFAULT_SIZE, PANE_MIN_SIZE};
use gpui::prelude::FluentBuilder as _;
use gpui::{
AnyElement, App, AppContext as _, Axis, Bounds, Context, ElementId, Entity,
@@ -9,7 +7,9 @@ use gpui::{
StyleRefinement, Styled, Window, canvas, div, px,
};
use crate::layout::StyledExt as _;
use crate::layout::resize_handle::ResizeHandle;
use crate::theme::{PANE_DEFAULT_SIZE, PANE_MIN_SIZE};
type DebugSelector = std::rc::Rc<dyn Fn() -> String>;
+5 -4
View File
@@ -3,10 +3,6 @@
use std::rc::Rc;
use crate::layout::{StyledExt as _, focus_handle, focus_ring};
use crate::theme::{
ActiveTheme as _, BORDER_WIDTH, DISABLED_OPACITY, HAIRLINE_WIDTH, RESIZE_KEYBOARD_STEP,
};
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, Axis, Bounds, CursorStyle, DispatchPhase, ElementId, HitboxBehavior,
@@ -16,6 +12,11 @@ use gpui::{
deferred, div, fill, point, px,
};
use crate::layout::{StyledExt as _, focus_handle, focus_ring};
use crate::theme::{
ActiveTheme as _, BORDER_WIDTH, DISABLED_OPACITY, HAIRLINE_WIDTH, RESIZE_KEYBOARD_STEP,
};
/// How far one keyboard arrow step moves the seam.
const KEYBOARD_STEP: Pixels = RESIZE_KEYBOARD_STEP;
+5 -5
View File
@@ -2,19 +2,19 @@
//! client-side window frame, with the toast and alert overlays mounted at
//! the window root.
use crate::components::alert::{Alerts, AlertsView};
use crate::components::grain::grain as grain_overlay;
use crate::components::toast::{Toasts, ToastsView};
use crate::layout::{StyledExt as _, v_flex};
use crate::theme::ActiveTheme as _;
use gpui::prelude::FluentBuilder as _;
use gpui::{
AnyElement, App, ElementId, Entity, IntoElement, ParentElement as _, RenderOnce,
StyleRefinement, Styled as _, Window, div,
};
use crate::components::alert::{Alerts, AlertsView};
use crate::components::grain::grain as grain_overlay;
use crate::components::toast::{Toasts, ToastsView};
use crate::layout::titlebar::Titlebar;
use crate::layout::window_frame::frame;
use crate::layout::{StyledExt as _, v_flex};
use crate::theme::ActiveTheme as _;
/// The application shell.
#[derive(IntoElement)]
+2 -2
View File
@@ -4,8 +4,6 @@
//! edge. The bar itself moves the window, tab bar included; the prefix and
//! suffix opt out, so a press on a control never starts a drag.
use crate::layout::{StyledExt as _, h_flex};
use crate::theme::{ActiveTheme as _, Size, TRAFFIC_LIGHT_PAD};
use gpui::prelude::FluentBuilder as _;
use gpui::{
AnyElement, App, ElementId, InteractiveElement as _, IntoElement, ParentElement, RenderOnce,
@@ -13,6 +11,8 @@ use gpui::{
};
use crate::layout::window_controls::{WindowControls, titlebar_strip};
use crate::layout::{StyledExt as _, h_flex};
use crate::theme::{ActiveTheme as _, Size, TRAFFIC_LIGHT_PAD};
/// The window's titlebar.
#[derive(IntoElement)]
+11 -11
View File
@@ -4,21 +4,25 @@
//! never moves it; macOS draws its traffic lights in the shell's reserved pad
//! and needs no controls of ours.
use gpui::WindowControlArea;
use gpui::{App, ClickEvent, Div, ElementId, IntoElement, RenderOnce, Stateful, Window, div};
use gpui::{InteractiveElement as _, MouseButton, StatefulInteractiveElement as _};
#[cfg(target_os = "linux")]
use gpui::Decorations;
#[cfg(any(target_os = "windows", target_os = "linux"))]
use crate::icons::{IconRole, icon};
#[cfg(any(target_os = "windows", target_os = "linux"))]
use crate::theme::ActiveTheme as _;
use gpui::SharedString;
#[cfg(any(target_os = "windows", target_os = "linux"))]
use gpui::Styled as _;
#[cfg(any(target_os = "windows", target_os = "linux"))]
use gpui::prelude::FluentBuilder as _;
#[cfg(any(target_os = "windows", target_os = "linux"))]
use gpui::{AnyElement, ParentElement as _};
use gpui::{
App, ClickEvent, Div, ElementId, InteractiveElement as _, IntoElement, MouseButton, RenderOnce,
Stateful, StatefulInteractiveElement as _, Window, WindowControlArea, div,
};
#[cfg(any(target_os = "windows", target_os = "linux"))]
use crate::icons::{IconRole, icon};
#[cfg(any(target_os = "windows", target_os = "linux"))]
use crate::theme::ActiveTheme as _;
/// macOS traffic-lights zone: the pad a leading titlebar strip reserves.
pub use crate::theme::TRAFFIC_LIGHT_PAD;
#[cfg(target_os = "windows")]
@@ -26,10 +30,6 @@ use crate::theme::{
WINDOWS_CAPTION_WIDTH as CAPTION_WIDTH, WINDOWS_CLOSE_FOREGROUND, WINDOWS_CLOSE_HOVER,
WINDOWS_CLOSE_PRESSED,
};
#[cfg(target_os = "linux")]
use gpui::Decorations;
#[cfg(any(target_os = "windows", target_os = "linux"))]
use gpui::SharedString;
/// The window controls for the trailing end of a titlebar strip.
#[derive(IntoElement)]
+2 -1
View File
@@ -1,7 +1,6 @@
//! The client-side window frame: the border, corners, shadow, and resize
//! edges of a window the system does not decorate.
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, INACTIVE_SHADOW_OPACITY, WINDOW_RESIZE_INSET};
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, Bounds, BoxShadow, CursorStyle, Decorations, Div, HitboxBehavior, InteractiveElement as _,
@@ -9,6 +8,8 @@ use gpui::{
Tiling, Window, canvas, div, point, px, size,
};
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, INACTIVE_SHADOW_OPACITY, WINDOW_RESIZE_INSET};
/// Wraps a window's root in the frame it owes.
pub fn frame<E>(child: E, window: &mut Window, cx: &App) -> Div
where
+1 -2
View File
@@ -6,9 +6,8 @@ pub mod layout;
pub mod theme;
pub use components::*;
pub use icons::{Assets, Icon, IconRole};
use gpui::App;
pub use icons::{Assets, Icon, IconRole};
/// Initializes the theme and every key binding the UI layer owns.
pub fn init(cx: &mut App) {
+5 -5
View File
@@ -15,18 +15,18 @@ 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.
+2 -1
View File
@@ -1,3 +1,5 @@
use gpui::{WindowBackgroundAppearance, px};
use crate::theme::definition::ThemeDefinition;
use crate::theme::ramps::{AccentShades, Oklch, contrast_foreground, derive_shades, mix};
use crate::theme::system::{SourceKind, SystemTheme};
@@ -5,7 +7,6 @@ use crate::theme::{
ColorTokens, CustomTheme, Elevations, MaterialTokens, Motion, Radius, Scrollbar, SizeTable,
Spacing, ThemeVariant, Typography,
};
use gpui::{WindowBackgroundAppearance, px};
/// Derived state shades for the colors that get pressed and hovered.
#[derive(Clone, Copy, Debug, PartialEq)]
+1 -6
View File
@@ -8,14 +8,9 @@ use std::path::{Path, PathBuf};
use gpui::Hsla;
use notify::{RecursiveMode, Watcher};
use super::ThemeSource;
use super::kde;
use super::omarchy;
use super::portal;
use super::signal::ReapplySignal;
use super::{ThemeSource, kde, omarchy, portal};
use crate::theme::ThemeVariant;
use crate::theme::system::{SourceKind, SystemTheme};
pub(crate) struct LinuxSource {
+1 -3
View File
@@ -13,10 +13,8 @@ use objc2_foundation::{
NSNotificationName, NSObjectNSKeyValueObserverRegistration, NSString, NSUserDefaults,
};
use super::narrow_component;
use super::ThemeSource;
use super::signal::ReapplySignal;
use super::{ThemeSource, narrow_component};
use crate::theme::ThemeVariant;
use crate::theme::system::{AccessibilityPreferences, SourceKind, SystemTheme};
+2 -2
View File
@@ -6,8 +6,8 @@
use gpui::Hsla;
use super::narrow_component;
use crate::theme::{ThemeVariant, system::AccessibilityPreferences};
use crate::theme::ThemeVariant;
use crate::theme::system::AccessibilityPreferences;
/// The raw portal values, already converted off the DBus wire types.
#[derive(Clone, Copy, Debug, Default, PartialEq)]