clean up
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s
Rust / build (macos-latest, stable) (pull_request) Canceled after 0s
Rust / build (ubuntu-latest, stable) (pull_request) Canceled after 0s
Rust / build (windows-latest, stable) (pull_request) Canceled after 0s
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s
Rust / build (macos-latest, stable) (pull_request) Canceled after 0s
Rust / build (ubuntu-latest, stable) (pull_request) Canceled after 0s
Rust / build (windows-latest, stable) (pull_request) Canceled after 0s
This commit is contained in:
@@ -14,7 +14,6 @@ mod workspace;
|
|||||||
|
|
||||||
pub use app::AppRoot;
|
pub use app::AppRoot;
|
||||||
pub use app::helpers::{apply_appearance, apply_appearance_mode};
|
pub use app::helpers::{apply_appearance, apply_appearance_mode};
|
||||||
|
|
||||||
use gpui::{App, AppContext as _, Entity, Window};
|
use gpui::{App, AppContext as _, Entity, Window};
|
||||||
|
|
||||||
pub fn root(window: &mut Window, cx: &mut App) -> Entity<AppRoot> {
|
pub fn root(window: &mut Window, cx: &mut App) -> Entity<AppRoot> {
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::icons::{Icon, IconRole};
|
|
||||||
use crate::theme::{
|
|
||||||
ALERT_EDGE_WIDTH, ALERT_STACK_WIDTH, ActiveTheme as _, ENTER_SLIDE_DISTANCE, Size, TextRole,
|
|
||||||
Typeset as _,
|
|
||||||
};
|
|
||||||
use crate::utils::ResultLogErr as _;
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
Animation, AnimationExt as _, App, Context, ElementId, Entity, InteractiveElement as _,
|
Animation, AnimationExt as _, App, Context, ElementId, Entity, InteractiveElement as _,
|
||||||
@@ -15,11 +9,15 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::button::{Button, ButtonVariant};
|
use crate::components::button::{Button, ButtonVariant};
|
||||||
use crate::components::common::DismissHandler;
|
use crate::components::common::{
|
||||||
use crate::components::common::Sizable as _;
|
DismissHandler, Sizable as _, StyledExt as _, TOAST_LAYER, v_flex,
|
||||||
use crate::components::common::StyledExt as _;
|
};
|
||||||
use crate::components::common::TOAST_LAYER;
|
use crate::icons::{Icon, IconRole};
|
||||||
use crate::components::common::v_flex;
|
use crate::theme::{
|
||||||
|
ALERT_EDGE_WIDTH, ALERT_STACK_WIDTH, ActiveTheme as _, ENTER_SLIDE_DISTANCE, Size, TextRole,
|
||||||
|
Typeset as _,
|
||||||
|
};
|
||||||
|
use crate::utils::ResultLogErr as _;
|
||||||
|
|
||||||
/// How alarming an [`Alert`] is; picks the accent color.
|
/// How alarming an [`Alert`] is; picks the accent color.
|
||||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
use std::fmt::Display;
|
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::{
|
use gpui::{
|
||||||
App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _, RenderOnce, Role,
|
App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _, RenderOnce, Role,
|
||||||
SharedString, StatefulInteractiveElement as _, StyleRefinement, Styled as _, Window, div,
|
SharedString, StatefulInteractiveElement as _, StyleRefinement, Styled as _, Window, div,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{Sizable, StyledExt, h_flex};
|
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.
|
/// Number of rows and columns in the pixel grid.
|
||||||
const GRID_SIZE: usize = 8;
|
const GRID_SIZE: usize = 8;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::icons::Icon;
|
|
||||||
use crate::theme::{ActiveTheme as _, Size, Theme};
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyView, App, ElementId, Hsla, InteractiveElement as _, IntoElement, ParentElement as _,
|
AnyView, App, ElementId, Hsla, InteractiveElement as _, IntoElement, ParentElement as _,
|
||||||
@@ -10,6 +8,8 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{StyledExt, h_flex};
|
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.
|
/// The tooltip view builder gpui's `.tooltip(...)` expects.
|
||||||
type TooltipBuilder = Rc<dyn Fn(&mut Window, &mut App) -> AnyView>;
|
type TooltipBuilder = Rc<dyn Fn(&mut Window, &mut App) -> AnyView>;
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
//! The push button: the API template for every control that follows.
|
//! The push button: the API template for every control that follows.
|
||||||
|
|
||||||
use crate::icons::Icon;
|
use std::rc::Rc;
|
||||||
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
|
||||||
use crate::utils::{focus_ring, record_anchor_bounds};
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyElement, AnyView, App, ClickEvent, ElementId, InteractiveElement as _, IntoElement,
|
AnyElement, AnyView, App, ClickEvent, ElementId, InteractiveElement as _, IntoElement,
|
||||||
ParentElement, RenderOnce, Role, SharedString, StatefulInteractiveElement as _,
|
ParentElement, RenderOnce, Role, SharedString, StatefulInteractiveElement as _,
|
||||||
StyleRefinement, Styled as _, Window, canvas, relative, transparent_black,
|
StyleRefinement, Styled as _, Window, canvas, relative, transparent_black,
|
||||||
};
|
};
|
||||||
use std::rc::Rc;
|
|
||||||
|
|
||||||
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
||||||
use crate::components::spinner::Spinner;
|
use crate::components::spinner::Spinner;
|
||||||
|
use crate::icons::Icon;
|
||||||
|
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
||||||
|
use crate::utils::{focus_ring, record_anchor_bounds};
|
||||||
|
|
||||||
/// The single activation handler, shared by pointer, Enter, and Space.
|
/// The single activation handler, shared by pointer, Enter, and Space.
|
||||||
type ClickHandler = Box<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
|
type ClickHandler = Box<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::icons::{IconRole, icon};
|
|
||||||
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
|
||||||
use crate::utils::focus_ring;
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _, RenderOnce, Role,
|
App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _, RenderOnce, Role,
|
||||||
@@ -12,6 +9,9 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
||||||
|
use crate::icons::{IconRole, icon};
|
||||||
|
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
||||||
|
use crate::utils::focus_ring;
|
||||||
|
|
||||||
/// The change reporter, fired with the next value by pointer, Enter, and Space.
|
/// The change reporter, fired with the next value by pointer, Enter, and Space.
|
||||||
type ChangeHandler = Box<dyn Fn(bool, &mut Window, &mut App)>;
|
type ChangeHandler = Box<dyn Fn(bool, &mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -3,9 +3,6 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use crate::icons::IconRole;
|
|
||||||
use crate::theme::Size;
|
|
||||||
use crate::utils::ResultLogErr as _;
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyView, App, ClipboardItem, ElementId, Entity, IntoElement, RenderOnce, SharedString,
|
AnyView, App, ClipboardItem, ElementId, Entity, IntoElement, RenderOnce, SharedString,
|
||||||
@@ -14,6 +11,9 @@ use gpui::{
|
|||||||
|
|
||||||
use crate::components::button::{Button, ButtonVariant};
|
use crate::components::button::{Button, ButtonVariant};
|
||||||
use crate::components::common::{Sizable, StyledExt as _};
|
use crate::components::common::{Sizable, StyledExt as _};
|
||||||
|
use crate::icons::IconRole;
|
||||||
|
use crate::theme::Size;
|
||||||
|
use crate::utils::ResultLogErr as _;
|
||||||
|
|
||||||
/// How long the check mark shows before reverting to the copy icon.
|
/// How long the check mark shows before reverting to the copy icon.
|
||||||
pub const COPIED_DURATION: Duration = Duration::from_secs(1);
|
pub const COPIED_DURATION: Duration = Duration::from_secs(1);
|
||||||
|
|||||||
@@ -8,10 +8,6 @@
|
|||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::icons::{IconRole, icon};
|
|
||||||
use crate::theme::ActiveTheme as _;
|
|
||||||
use crate::theme::{COMBOBOX_MIN_WIDTH, COMBOBOX_WIDTH, POPUP_MAX_HEIGHT, Size};
|
|
||||||
use crate::utils::ResultLogErr as _;
|
|
||||||
use gpui::prelude::FluentBuilder;
|
use gpui::prelude::FluentBuilder;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, Bounds, Context, ElementId, Entity, InteractiveElement as _, IntoElement, KeyBinding,
|
App, Bounds, Context, ElementId, Entity, InteractiveElement as _, IntoElement, KeyBinding,
|
||||||
@@ -23,6 +19,9 @@ use gpui::{
|
|||||||
use crate::components::common::{OVERLAY_LAYER, Sizable, StyledExt as _, h_flex, v_flex};
|
use crate::components::common::{OVERLAY_LAYER, Sizable, StyledExt as _, h_flex, v_flex};
|
||||||
use crate::components::input::{Input, InputState, InputStateEvent};
|
use crate::components::input::{Input, InputState, InputStateEvent};
|
||||||
use crate::components::scroll_area::ScrollArea;
|
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};
|
||||||
|
use crate::utils::ResultLogErr as _;
|
||||||
|
|
||||||
actions!(
|
actions!(
|
||||||
combobox,
|
combobox,
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::icons::Icon;
|
|
||||||
use crate::theme::{ActiveTheme as _, POPUP_MAX_HEIGHT, Size};
|
|
||||||
use gpui::prelude::FluentBuilder;
|
use gpui::prelude::FluentBuilder;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyElement, App, Context, ElementId, Entity, InteractiveElement as _, IntoElement, KeyBinding,
|
AnyElement, App, Context, ElementId, Entity, InteractiveElement as _, IntoElement, KeyBinding,
|
||||||
@@ -15,6 +13,8 @@ use gpui::{
|
|||||||
use crate::components::common::{DIALOG_LAYER, StyledExt as _, h_flex, v_flex};
|
use crate::components::common::{DIALOG_LAYER, StyledExt as _, h_flex, v_flex};
|
||||||
use crate::components::input::{Input, InputState, InputStateEvent};
|
use crate::components::input::{Input, InputState, InputStateEvent};
|
||||||
use crate::components::scroll_area::{ScrollArea, ScrollAxes};
|
use crate::components::scroll_area::{ScrollArea, ScrollAxes};
|
||||||
|
use crate::icons::Icon;
|
||||||
|
use crate::theme::{ActiveTheme as _, POPUP_MAX_HEIGHT, Size};
|
||||||
|
|
||||||
actions!(
|
actions!(
|
||||||
command_palette,
|
command_palette,
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
use gpui::prelude::FluentBuilder as _;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::icons::IconRole;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use crate::theme::{ActiveTheme as _, DIALOG_MIN_WIDTH, TextRole, Typeset as _};
|
|
||||||
use gpui::{
|
use gpui::{
|
||||||
Animation, AnimationExt as _, AnyElement, App, DefiniteLength, ElementId,
|
Animation, AnimationExt as _, AnyElement, App, DefiniteLength, ElementId,
|
||||||
InteractiveElement as _, IntoElement, KeyDownEvent, MouseButton, ParentElement as _,
|
InteractiveElement as _, IntoElement, KeyDownEvent, MouseButton, ParentElement as _,
|
||||||
@@ -14,6 +12,8 @@ use crate::components::button::{Button, ButtonVariant};
|
|||||||
use crate::components::common::{DIALOG_LAYER, Sizable, StyledExt as _, v_flex};
|
use crate::components::common::{DIALOG_LAYER, Sizable, StyledExt as _, v_flex};
|
||||||
use crate::components::grain::grain;
|
use crate::components::grain::grain;
|
||||||
use crate::components::scroll_area::ScrollArea;
|
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.
|
/// Requests the dialog's close: `false` closes.
|
||||||
pub type ChangeHandler = Rc<dyn Fn(bool, &mut Window, &mut App)>;
|
pub type ChangeHandler = Rc<dyn Fn(bool, &mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -3,9 +3,6 @@
|
|||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::icons::{Icon, IconRole, icon};
|
|
||||||
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
|
||||||
use crate::utils::{focus_handle, focus_ring};
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, ClickEvent, DefiniteLength, DispatchPhase, ElementId, InteractiveElement as _,
|
App, ClickEvent, DefiniteLength, DispatchPhase, ElementId, InteractiveElement as _,
|
||||||
@@ -20,6 +17,9 @@ use crate::components::menu::{
|
|||||||
ChangeHandler, MenuChrome, MenuItem, MenuPanelSpec, TriggerBoundsCell, anchored_menu_panel,
|
ChangeHandler, MenuChrome, MenuItem, MenuPanelSpec, TriggerBoundsCell, anchored_menu_panel,
|
||||||
};
|
};
|
||||||
use crate::components::spinner::Spinner;
|
use crate::components::spinner::Spinner;
|
||||||
|
use crate::icons::{Icon, IconRole, icon};
|
||||||
|
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
||||||
|
use crate::utils::{focus_handle, focus_ring};
|
||||||
|
|
||||||
/// The main zone's activation handler, shared by pointer, Enter, and Space.
|
/// The main zone's activation handler, shared by pointer, Enter, and Space.
|
||||||
type ClickHandler = Box<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
|
type ClickHandler = Box<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
use crate::icons::Icon;
|
|
||||||
use crate::theme::{ActiveTheme as _, Size, TextRole, Typeset as _};
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, IntoElement, ParentElement as _, RenderOnce, SharedString, StyleRefinement, Styled as _,
|
App, IntoElement, ParentElement as _, RenderOnce, SharedString, StyleRefinement, Styled as _,
|
||||||
@@ -7,6 +5,8 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{StyledExt, v_flex};
|
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.
|
/// The centered "nothing here yet" panel for lists, tables, and searches.
|
||||||
#[derive(IntoElement)]
|
#[derive(IntoElement)]
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
//! The field: a label, description, and error wrapped around a control.
|
//! The field: a label, description, and error wrapped around a control.
|
||||||
|
|
||||||
use crate::theme::{ActiveTheme as _, TextRole, Typeset as _};
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyElement, App, ElementId, InteractiveElement as _, IntoElement, ParentElement, RenderOnce,
|
AnyElement, App, ElementId, InteractiveElement as _, IntoElement, ParentElement, RenderOnce,
|
||||||
@@ -8,6 +7,7 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{StyledExt, h_flex, v_flex};
|
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.
|
/// The arrangement of a [`Field`]'s label and control.
|
||||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||||
|
|||||||
@@ -2,14 +2,15 @@
|
|||||||
|
|
||||||
use std::sync::{Arc, OnceLock};
|
use std::sync::{Arc, OnceLock};
|
||||||
|
|
||||||
use crate::theme::GRAIN_ALPHA;
|
|
||||||
use crate::utils::ResultLogErr as _;
|
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, Bounds, Corners, IntoElement, RenderImage, RenderOnce, Styled as _, Window, canvas, point,
|
App, Bounds, Corners, IntoElement, RenderImage, RenderOnce, Styled as _, Window, canvas, point,
|
||||||
px, size,
|
px, size,
|
||||||
};
|
};
|
||||||
use image::{Frame, ImageBuffer, Rgba};
|
use image::{Frame, ImageBuffer, Rgba};
|
||||||
|
|
||||||
|
use crate::theme::GRAIN_ALPHA;
|
||||||
|
use crate::utils::ResultLogErr as _;
|
||||||
|
|
||||||
/// The side of one noise tile, in device pixels.
|
/// The side of one noise tile, in device pixels.
|
||||||
const TILE_PX: u32 = 256;
|
const TILE_PX: u32 = 256;
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,6 @@ use std::ops::Range;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::time::{Duration, Instant};
|
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::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
Animation, AnimationExt as _, AnyElement, App, AppContext as _, Bounds, ClipboardItem,
|
Animation, AnimationExt as _, AnyElement, App, AppContext as _, Bounds, ClipboardItem,
|
||||||
@@ -19,9 +12,15 @@ use gpui::{
|
|||||||
StatefulInteractiveElement as _, StyleRefinement, Styled as _, TextAlign, TextRun,
|
StatefulInteractiveElement as _, StyleRefinement, Styled as _, TextAlign, TextRun,
|
||||||
UTF16Selection, Window, WrappedLine, actions, canvas, div, fill, point, px,
|
UTF16Selection, Window, WrappedLine, actions, canvas, div, fill, point, px,
|
||||||
};
|
};
|
||||||
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
|
|
||||||
use crate::components::button::{Button, ButtonVariant};
|
use crate::components::button::{Button, ButtonVariant};
|
||||||
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
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 input bindings match against.
|
/// The key context input bindings match against.
|
||||||
pub const INPUT_CONTEXT: &str = "Input";
|
pub const INPUT_CONTEXT: &str = "Input";
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
|
||||||
use crate::utils::focus_ring;
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, ClickEvent, ElementId, InteractiveElement as _, IntoElement, ParentElement as _,
|
App, ClickEvent, ElementId, InteractiveElement as _, IntoElement, ParentElement as _,
|
||||||
@@ -8,6 +6,8 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
||||||
|
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
||||||
|
use crate::utils::focus_ring;
|
||||||
|
|
||||||
/// The click handler. When set it replaces the default `href` opening.
|
/// The click handler. When set it replaces the default `href` opening.
|
||||||
type ClickHandler = Box<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
|
type ClickHandler = Box<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -3,9 +3,6 @@
|
|||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::icons::{Icon, IconRole, icon as icon_glyph};
|
|
||||||
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, MENU_MIN_WIDTH, POPUP_MAX_HEIGHT};
|
|
||||||
use crate::utils::focus_handle;
|
|
||||||
use gpui::prelude::FluentBuilder;
|
use gpui::prelude::FluentBuilder;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
Animation, AnimationExt as _, AnyElement, App, Bounds, BoxShadow, DefiniteLength,
|
Animation, AnimationExt as _, AnyElement, App, Bounds, BoxShadow, DefiniteLength,
|
||||||
@@ -17,6 +14,9 @@ use gpui::{
|
|||||||
|
|
||||||
use crate::components::common::{OVERLAY_LAYER, StyledExt as _, v_flex};
|
use crate::components::common::{OVERLAY_LAYER, StyledExt as _, v_flex};
|
||||||
use crate::components::scroll_area::{ScrollArea, ScrollAxes};
|
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 crate::utils::focus_handle;
|
||||||
|
|
||||||
/// Runs the item's action. The menu closes itself before the handler runs.
|
/// Runs the item's action. The menu closes itself before the handler runs.
|
||||||
pub type ItemHandler = Rc<dyn Fn(&mut Window, &mut App)>;
|
pub type ItemHandler = Rc<dyn Fn(&mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::theme::{ActiveTheme as _, POPOVER_MIN_WIDTH};
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
Animation, AnimationExt as _, AnyElement, App, Bounds, DispatchPhase, ElementId,
|
Animation, AnimationExt as _, AnyElement, App, Bounds, DispatchPhase, ElementId,
|
||||||
@@ -11,6 +10,7 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{OVERLAY_LAYER, StyledExt as _, v_flex};
|
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.
|
/// Reports the next open state of a [`Popover`]: `true` to open, `false` to close.
|
||||||
type ChangeHandler = Rc<dyn Fn(bool, &mut Window, &mut App)>;
|
type ChangeHandler = Rc<dyn Fn(bool, &mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
//! The progress bar: determinate fill or an indeterminate sweep.
|
//! The progress bar: determinate fill or an indeterminate sweep.
|
||||||
|
|
||||||
use crate::theme::{ActiveTheme as _, PROGRESS_ANIMATION_PERIOD, Size};
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
Animation, AnimationExt as _, App, ElementId, InteractiveElement as _, IntoElement,
|
Animation, AnimationExt as _, App, ElementId, InteractiveElement as _, IntoElement,
|
||||||
@@ -9,6 +8,7 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{Sizable, StyledExt as _};
|
use crate::components::common::{Sizable, StyledExt as _};
|
||||||
|
use crate::theme::{ActiveTheme as _, PROGRESS_ANIMATION_PERIOD, Size};
|
||||||
|
|
||||||
/// A progress bar. With a `value` in `0..=1` it paints a determinate fill.
|
/// A progress bar. With a `value` in `0..=1` it paints a determinate fill.
|
||||||
#[derive(IntoElement)]
|
#[derive(IntoElement)]
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
|
||||||
use crate::utils::focus_ring;
|
|
||||||
use gpui::prelude::FluentBuilder;
|
use gpui::prelude::FluentBuilder;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _, RenderOnce, Role,
|
App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _, RenderOnce, Role,
|
||||||
@@ -8,6 +6,8 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{Sizable, StyledExt as _, h_flex, v_flex};
|
use crate::components::common::{Sizable, StyledExt as _, h_flex, v_flex};
|
||||||
|
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
||||||
|
use crate::utils::focus_ring;
|
||||||
|
|
||||||
/// The group's change reporter, fired with the clicked radio's value.
|
/// 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)>;
|
type ChangeHandler<V> = std::rc::Rc<dyn Fn(V, &mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ use std::rc::Rc;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use crate::theme::{ActiveTheme as _, SCROLLBAR_AUTOHIDE_DELAY, SCROLLBAR_FADE_DURATION};
|
|
||||||
use crate::utils::ResultLogErr as _;
|
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, Bounds, DispatchPhase, ElementId, Entity, EntityId, IntoElement, ListState, MouseButton,
|
App, Bounds, DispatchPhase, ElementId, Entity, EntityId, IntoElement, ListState, MouseButton,
|
||||||
MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, RenderOnce, ScrollEvent,
|
MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, RenderOnce, ScrollEvent,
|
||||||
@@ -13,6 +11,9 @@ use gpui::{
|
|||||||
point,
|
point,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::theme::{ActiveTheme as _, SCROLLBAR_AUTOHIDE_DELAY, SCROLLBAR_FADE_DURATION};
|
||||||
|
use crate::utils::ResultLogErr as _;
|
||||||
|
|
||||||
/// When an overlay scrollbar shows.
|
/// When an overlay scrollbar shows.
|
||||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||||
pub enum ScrollbarVisibility {
|
pub enum ScrollbarVisibility {
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::icons::Icon;
|
|
||||||
use crate::theme::{ActiveTheme as _, CONTROL_SPRING, Size};
|
|
||||||
use crate::utils::{focus_handle, focus_ring};
|
|
||||||
use gpui::prelude::FluentBuilder;
|
use gpui::prelude::FluentBuilder;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnimationExt as _, App, Bounds, ElementId, Entity, InteractiveElement as _, IntoElement,
|
AnimationExt as _, App, Bounds, ElementId, Entity, InteractiveElement as _, IntoElement,
|
||||||
@@ -11,6 +8,9 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{Sizable, StyledExt, h_flex};
|
use crate::components::common::{Sizable, StyledExt, h_flex};
|
||||||
|
use crate::icons::Icon;
|
||||||
|
use crate::theme::{ActiveTheme as _, CONTROL_SPRING, Size};
|
||||||
|
use crate::utils::{focus_handle, focus_ring};
|
||||||
|
|
||||||
/// Reports the segment the user chose.
|
/// Reports the segment the user chose.
|
||||||
type ChangeHandler<T> = Rc<dyn Fn(T, &mut Window, &mut App)>;
|
type ChangeHandler<T> = Rc<dyn Fn(T, &mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::icons::{Icon, IconRole, icon};
|
|
||||||
use crate::theme::{ActiveTheme as _, Size};
|
|
||||||
use crate::utils::focus_handle;
|
|
||||||
use gpui::prelude::FluentBuilder;
|
use gpui::prelude::FluentBuilder;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, ElementId, InteractiveElement as _, IntoElement, KeyDownEvent, ParentElement as _,
|
App, ElementId, InteractiveElement as _, IntoElement, KeyDownEvent, ParentElement as _,
|
||||||
@@ -12,6 +9,9 @@ use gpui::{
|
|||||||
|
|
||||||
use crate::components::common::{Sizable, StyledExt, h_flex};
|
use crate::components::common::{Sizable, StyledExt, h_flex};
|
||||||
use crate::components::menu::{Menu, MenuItem};
|
use crate::components::menu::{Menu, MenuItem};
|
||||||
|
use crate::icons::{Icon, IconRole, icon};
|
||||||
|
use crate::theme::{ActiveTheme as _, Size};
|
||||||
|
use crate::utils::focus_handle;
|
||||||
|
|
||||||
/// Reports the value the user chose. `None` means the select holds no value.
|
/// 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)>;
|
pub type SelectHandler<T> = Rc<dyn Fn(Option<T>, &mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -2,14 +2,15 @@
|
|||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::theme::{ActiveTheme as _, BORDER_WIDTH};
|
|
||||||
use crate::utils::StyledExt as _;
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, InteractiveElement as _, IntoElement, RenderOnce, StyleRefinement, Styled as _, Window,
|
App, InteractiveElement as _, IntoElement, RenderOnce, StyleRefinement, Styled as _, Window,
|
||||||
div,
|
div,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::theme::{ActiveTheme as _, BORDER_WIDTH};
|
||||||
|
use crate::utils::StyledExt as _;
|
||||||
|
|
||||||
/// Which axis the rule runs along.
|
/// Which axis the rule runs along.
|
||||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||||
pub enum SeparatorOrientation {
|
pub enum SeparatorOrientation {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
|
||||||
use crate::utils::focus_ring;
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, Bounds, DispatchPhase, ElementId, InteractiveElement as _, IntoElement, KeyDownEvent,
|
App, Bounds, DispatchPhase, ElementId, InteractiveElement as _, IntoElement, KeyDownEvent,
|
||||||
@@ -12,6 +10,8 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
||||||
|
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
||||||
|
use crate::utils::focus_ring;
|
||||||
|
|
||||||
/// The change reporter, fired with the next value by click, drag, and arrows.
|
/// The change reporter, fired with the next value by click, drag, and arrows.
|
||||||
type ChangeHandler = Rc<dyn Fn(f32, &mut Window, &mut App)>;
|
type ChangeHandler = Rc<dyn Fn(f32, &mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -7,14 +7,10 @@
|
|||||||
//! and has no recognizer, so [`SpeechButton`] renders nothing until the
|
//! and has no recognizer, so [`SpeechButton`] renders nothing until the
|
||||||
//! application provides one.
|
//! application provides one.
|
||||||
|
|
||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
use crate::icons::{IconRole, icon};
|
|
||||||
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, SPEECH_WAVEFORM_WIDTH, Size};
|
|
||||||
use crate::utils::focus_ring;
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, Context, ElementId, Entity, EventEmitter, InteractiveElement as _, IntoElement,
|
App, Context, ElementId, Entity, EventEmitter, InteractiveElement as _, IntoElement,
|
||||||
@@ -25,6 +21,9 @@ use gpui::{
|
|||||||
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
||||||
use crate::components::spinner::{Spinner, SpinnerVariant};
|
use crate::components::spinner::{Spinner, SpinnerVariant};
|
||||||
use crate::components::tooltip::Tooltip;
|
use crate::components::tooltip::Tooltip;
|
||||||
|
use crate::icons::{IconRole, icon};
|
||||||
|
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, SPEECH_WAVEFORM_WIDTH, Size};
|
||||||
|
use crate::utils::focus_ring;
|
||||||
|
|
||||||
/// One input-level entry per this much of captured audio.
|
/// One input-level entry per this much of captured audio.
|
||||||
const LEVEL_BUCKET: Duration = Duration::from_millis(80);
|
const LEVEL_BUCKET: Duration = Duration::from_millis(80);
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ use std::cell::Cell;
|
|||||||
use std::f32::consts::{PI, TAU};
|
use std::f32::consts::{PI, TAU};
|
||||||
use std::rc::Rc;
|
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::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
Animation, AnimationElement, AnimationExt as _, App, Canvas, ElementId, Hsla,
|
Animation, AnimationElement, AnimationExt as _, App, Canvas, ElementId, Hsla,
|
||||||
@@ -15,6 +13,8 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{Sizable, StyledExt as _};
|
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.
|
/// The share of the circle the spinning arc paints.
|
||||||
const SPIN_SWEEP: f32 = 0.75;
|
const SPIN_SWEEP: f32 = 0.75;
|
||||||
@@ -263,9 +263,10 @@ fn circle_path(center: Point<Pixels>, radius: Pixels, stroke: Pixels) -> Option<
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
|
||||||
use std::f32::consts::FRAC_PI_2;
|
use std::f32::consts::FRAC_PI_2;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ring_points_run_clockwise_from_twelve() {
|
fn ring_points_run_clockwise_from_twelve() {
|
||||||
let center = point(px(10.0), px(20.0));
|
let center = point(px(10.0), px(20.0));
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
//! The status dot: a small colored bead for row state.
|
//! The status dot: a small colored bead for row state.
|
||||||
|
|
||||||
use crate::theme::{ActiveTheme as _, Size, Theme};
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, ElementId, Hsla, InteractiveElement as _, IntoElement, RenderOnce, Role, SharedString,
|
App, ElementId, Hsla, InteractiveElement as _, IntoElement, RenderOnce, Role, SharedString,
|
||||||
@@ -8,6 +7,7 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{Sizable, StyledExt};
|
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`].
|
/// How loud a dot is, the same vocabulary as [`crate::components::badge::BadgeVariant`].
|
||||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
//! The switch: a controlled on/off pill with a thumb.
|
//! The switch: a controlled on/off pill with a thumb.
|
||||||
|
|
||||||
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, CONTROL_SPRING, DISABLED_OPACITY, Size};
|
|
||||||
use crate::utils::focus_ring;
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnimationExt as _, App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _,
|
AnimationExt as _, App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _,
|
||||||
@@ -10,6 +8,8 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
||||||
|
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, CONTROL_SPRING, DISABLED_OPACITY, Size};
|
||||||
|
use crate::utils::focus_ring;
|
||||||
|
|
||||||
/// The change reporter, fired with the next value by pointer, Enter, and Space.
|
/// The change reporter, fired with the next value by pointer, Enter, and Space.
|
||||||
type ChangeHandler = Box<dyn Fn(bool, &mut Window, &mut App)>;
|
type ChangeHandler = Box<dyn Fn(bool, &mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -3,9 +3,6 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use crate::icons::{Icon, IconRole};
|
|
||||||
use crate::theme::{ActiveTheme as _, TOAST_MAX_WIDTH};
|
|
||||||
use crate::utils::ResultLogErr as _;
|
|
||||||
use gpui::prelude::FluentBuilder;
|
use gpui::prelude::FluentBuilder;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
Animation, AnimationExt as _, App, Context, ElementId, Entity, InteractiveElement as _,
|
Animation, AnimationExt as _, App, Context, ElementId, Entity, InteractiveElement as _,
|
||||||
@@ -16,6 +13,9 @@ use gpui::{
|
|||||||
|
|
||||||
use crate::components::button::{Button, ButtonVariant};
|
use crate::components::button::{Button, ButtonVariant};
|
||||||
use crate::components::common::{DismissHandler, Sizable as _, StyledExt as _, TOAST_LAYER};
|
use crate::components::common::{DismissHandler, Sizable as _, StyledExt as _, TOAST_LAYER};
|
||||||
|
use crate::icons::{Icon, IconRole};
|
||||||
|
use crate::theme::{ActiveTheme as _, TOAST_MAX_WIDTH};
|
||||||
|
use crate::utils::ResultLogErr as _;
|
||||||
|
|
||||||
/// The action handler of a [`Toast`].
|
/// The action handler of a [`Toast`].
|
||||||
pub type ActionHandler = Rc<dyn Fn(&mut App)>;
|
pub type ActionHandler = Rc<dyn Fn(&mut App)>;
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
use crate::icons::Icon;
|
|
||||||
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
|
||||||
use crate::utils::focus_ring;
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _, RenderOnce, Role,
|
App, ElementId, InteractiveElement as _, IntoElement, ParentElement as _, RenderOnce, Role,
|
||||||
@@ -8,6 +5,9 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
use crate::components::common::{Sizable, StyledExt as _, h_flex};
|
||||||
|
use crate::icons::Icon;
|
||||||
|
use crate::theme::{ActiveTheme as _, DISABLED_OPACITY, Size};
|
||||||
|
use crate::utils::focus_ring;
|
||||||
|
|
||||||
/// The change handler, fired with the next pressed state.
|
/// The change handler, fired with the next pressed state.
|
||||||
type ChangeHandler = Box<dyn Fn(bool, &mut Window, &mut App)>;
|
type ChangeHandler = Box<dyn Fn(bool, &mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
|
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::theme::{ActiveTheme as _, BORDER_WIDTH, TOOLTIP_MAX_WIDTH, TOOLTIP_OFFSET};
|
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, TOOLTIP_MAX_WIDTH, TOOLTIP_OFFSET};
|
||||||
use crate::utils::{anchor_bounds, record_anchor_bounds};
|
use crate::utils::{anchor_bounds, record_anchor_bounds};
|
||||||
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";
|
const PANEL_BOUNDS_ID: &str = "tooltip-panel-bounds";
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::icons::Icon;
|
|
||||||
use crate::theme::{ActiveTheme as _, TextRole, Typeset as _};
|
|
||||||
use crate::utils::{StyledExt as _, nav_key, paint_selectable_row, selectable_label_color};
|
|
||||||
use gpui::prelude::FluentBuilder;
|
use gpui::prelude::FluentBuilder;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyElement, App, ElementId, FocusHandle, InteractiveElement as _, IntoElement, KeyDownEvent,
|
AnyElement, App, ElementId, FocusHandle, InteractiveElement as _, IntoElement, KeyDownEvent,
|
||||||
@@ -10,6 +7,10 @@ use gpui::{
|
|||||||
StyleRefinement, Styled as _, Window, div,
|
StyleRefinement, Styled as _, Window, div,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::icons::Icon;
|
||||||
|
use crate::theme::{ActiveTheme as _, TextRole, Typeset as _};
|
||||||
|
use crate::utils::{StyledExt as _, nav_key, paint_selectable_row, selectable_label_color};
|
||||||
|
|
||||||
/// The change reporter, fired with the next selection by pointer and keys.
|
/// The change reporter, fired with the next selection by pointer and keys.
|
||||||
type ChangeHandler = Rc<dyn Fn(Option<usize>, &mut Window, &mut App)>;
|
type ChangeHandler = Rc<dyn Fn(Option<usize>, &mut Window, &mut App)>;
|
||||||
type ItemsFn = Box<dyn Fn(&mut Window, &mut App) -> Vec<ListItem>>;
|
type ItemsFn = Box<dyn Fn(&mut Window, &mut App) -> Vec<ListItem>>;
|
||||||
|
|||||||
@@ -4,10 +4,6 @@
|
|||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
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 crate::utils::{StyledExt as _, nav_key, paint_selectable_row, selectable_label_color};
|
|
||||||
use gpui::prelude::FluentBuilder;
|
use gpui::prelude::FluentBuilder;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyElement, App, ElementId, FocusHandle, InteractiveElement as _, IntoElement, KeyDownEvent,
|
AnyElement, App, ElementId, FocusHandle, InteractiveElement as _, IntoElement, KeyDownEvent,
|
||||||
@@ -15,6 +11,11 @@ use gpui::{
|
|||||||
StyleRefinement, Styled as _, Window, div,
|
StyleRefinement, Styled as _, Window, div,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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 crate::utils::{StyledExt as _, nav_key, paint_selectable_row, selectable_label_color};
|
||||||
|
|
||||||
/// The change reporter, fired with the next selected row by pointer and keys.
|
/// The change reporter, fired with the next selected row by pointer and keys.
|
||||||
type ChangeHandler = Rc<dyn Fn(Option<usize>, &mut Window, &mut App)>;
|
type ChangeHandler = Rc<dyn Fn(Option<usize>, &mut Window, &mut App)>;
|
||||||
type EntriesFn = Box<dyn Fn(&mut Window, &mut App) -> Vec<SidebarEntry>>;
|
type EntriesFn = Box<dyn Fn(&mut Window, &mut App) -> Vec<SidebarEntry>>;
|
||||||
|
|||||||
@@ -2,6 +2,14 @@ use std::cell::RefCell;
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::rc::Rc;
|
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 _, Window, canvas, div, px, relative,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::components::button::{Button, ButtonVariant};
|
use crate::components::button::{Button, ButtonVariant};
|
||||||
use crate::components::common::{Sizable as _, v_flex};
|
use crate::components::common::{Sizable as _, v_flex};
|
||||||
use crate::components::popover::Popover;
|
use crate::components::popover::Popover;
|
||||||
@@ -11,13 +19,6 @@ use crate::components::tooltip::Tooltip;
|
|||||||
use crate::icons::IconRole;
|
use crate::icons::IconRole;
|
||||||
use crate::theme::{ActiveTheme as _, POPUP_MAX_HEIGHT, Size, TAB_INDICATOR_WIDTH};
|
use crate::theme::{ActiveTheme as _, POPUP_MAX_HEIGHT, Size, TAB_INDICATOR_WIDTH};
|
||||||
use crate::utils::{StyledExt as _, adjacent_selectable};
|
use crate::utils::{StyledExt as _, adjacent_selectable};
|
||||||
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 _, Window, canvas, div, px, relative,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Reports the next selected tab by pointer and keys.
|
/// Reports the next selected tab by pointer and keys.
|
||||||
type ChangeHandler = Rc<dyn Fn(usize, &mut Window, &mut App)>;
|
type ChangeHandler = Rc<dyn Fn(usize, &mut Window, &mut App)>;
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::icons::{Icon, IconRole, icon};
|
|
||||||
use crate::theme::ActiveTheme as _;
|
|
||||||
use crate::utils::{StyledExt as _, nav_key, paint_selectable_row, selectable_label_color};
|
|
||||||
use gpui::prelude::FluentBuilder;
|
use gpui::prelude::FluentBuilder;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyElement, App, ElementId, FocusHandle, InteractiveElement as _, IntoElement, KeyDownEvent,
|
AnyElement, App, ElementId, FocusHandle, InteractiveElement as _, IntoElement, KeyDownEvent,
|
||||||
@@ -10,6 +7,10 @@ use gpui::{
|
|||||||
StyleRefinement, Styled as _, Window, div,
|
StyleRefinement, Styled as _, Window, div,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::icons::{Icon, IconRole, icon};
|
||||||
|
use crate::theme::ActiveTheme as _;
|
||||||
|
use crate::utils::{StyledExt as _, nav_key, paint_selectable_row, selectable_label_color};
|
||||||
|
|
||||||
/// The change reporter, fired with the next selection by pointer and keys.
|
/// The change reporter, fired with the next selection by pointer and keys.
|
||||||
type ChangeHandler = Rc<dyn Fn(Option<usize>, &mut Window, &mut App)>;
|
type ChangeHandler = Rc<dyn Fn(Option<usize>, &mut Window, &mut App)>;
|
||||||
/// The disclosure reporter, fired with the toggled row's index.
|
/// The disclosure reporter, fired with the toggled row's index.
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
//! Rows render only when visible, the line-number gutter is part of each
|
//! Rows render only when visible, the line-number gutter is part of each
|
||||||
//! row, and the overlay scrollbar is the core one.
|
//! row, and the overlay scrollbar is the core one.
|
||||||
|
|
||||||
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::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, Bounds, ClipboardItem, Context, ElementId, HighlightStyle, Hsla, InteractiveElement as _,
|
App, Bounds, ClipboardItem, Context, ElementId, HighlightStyle, Hsla, InteractiveElement as _,
|
||||||
@@ -16,8 +11,13 @@ use gpui::{
|
|||||||
actions, canvas, div, uniform_list,
|
actions, canvas, div, uniform_list,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::components::scrollbar::{Scrollbar, ScrollbarHandle, ScrollbarVisibility};
|
||||||
use crate::editor::highlight::{HighlightedCode, Language, Role, highlight};
|
use crate::editor::highlight::{HighlightedCode, Language, Role, highlight};
|
||||||
use crate::editor::utils::gutter_cell;
|
use crate::editor::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]);
|
actions!(code_view, [Copy]);
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
//! consumers that already hold a git diff can build [`DiffRow`]s themselves
|
//! consumers that already hold a git diff can build [`DiffRow`]s themselves
|
||||||
//! instead of calling [`DiffViewState::diff_rows`].
|
//! instead of calling [`DiffViewState::diff_rows`].
|
||||||
|
|
||||||
use crate::components::scrollbar::{Scrollbar, ScrollbarHandle, ScrollbarVisibility};
|
use std::ops::Range;
|
||||||
use crate::theme::{ActiveTheme as _, BORDER_WIDTH, CODE_GUTTER_WIDTH, MONO_ADVANCE_RATIO};
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, Context, ElementId, HighlightStyle, InteractiveElement as _, IntoElement,
|
App, Context, ElementId, HighlightStyle, InteractiveElement as _, IntoElement,
|
||||||
@@ -16,10 +16,10 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
use similar::{Change, ChangeTag, TextDiff};
|
use similar::{Change, ChangeTag, TextDiff};
|
||||||
|
|
||||||
use std::ops::Range;
|
use crate::components::scrollbar::{Scrollbar, ScrollbarHandle, ScrollbarVisibility};
|
||||||
|
|
||||||
use crate::editor::highlight::{HighlightedCode, Language, Line, Role, highlight};
|
use crate::editor::highlight::{HighlightedCode, Language, Line, Role, highlight};
|
||||||
use crate::editor::utils::{gutter_cell, wash, wash_gutter, wash_strong};
|
use crate::editor::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.
|
/// What a diff row did to the file.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
|
|||||||
@@ -2,13 +2,15 @@
|
|||||||
//! are resolved to theme colors at render time, so a theme change re-colors
|
//! are resolved to theme colors at render time, so a theme change re-colors
|
||||||
//! code without re-parsing it.
|
//! code without re-parsing it.
|
||||||
|
|
||||||
use crate::utils::ResultLogErr;
|
|
||||||
use gpui::SharedString;
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use gpui::SharedString;
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
use tree_sitter::StreamingIterator as _;
|
use tree_sitter::StreamingIterator as _;
|
||||||
|
|
||||||
|
use crate::utils::ResultLogErr;
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static HIGHLIGHTERS: RefCell<HashMap<Language, Option<Highlighter>>> =
|
static HIGHLIGHTERS: RefCell<HashMap<Language, Option<Highlighter>>> =
|
||||||
|
|||||||
@@ -6,14 +6,12 @@
|
|||||||
//! toggles and code blocks offer a copy action. Footnotes, math, and HTML
|
//! toggles and code blocks offer a copy action. Footnotes, math, and HTML
|
||||||
//! render nothing; long code lines clip rather than scroll.
|
//! render nothing; long code lines clip rather than scroll.
|
||||||
|
|
||||||
use crate::components::button::{Button, ButtonVariant};
|
use std::borrow::Borrow as _;
|
||||||
use crate::components::checkbox::Checkbox;
|
use std::collections::HashMap;
|
||||||
use crate::components::common::Sizable as _;
|
use std::hash::{DefaultHasher, Hash, Hasher};
|
||||||
use crate::components::scrollbar::{Scrollbar, ScrollbarVisibility};
|
use std::ops::Range;
|
||||||
use crate::theme::{
|
use std::sync::Arc;
|
||||||
ActiveTheme as _, BORDER_WIDTH, CODE_LINE_HEIGHT, CODE_OVERSCROLL_MAX, Size, TextRole,
|
|
||||||
Typeset as _,
|
|
||||||
};
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyElement, App, Bounds, ClipboardItem, Context, Div, Element, ElementId, Entity, FontStyle,
|
AnyElement, App, Bounds, ClipboardItem, Context, Div, Element, ElementId, Entity, FontStyle,
|
||||||
@@ -26,14 +24,16 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
use pulldown_cmark::{CodeBlockKind, Event, HeadingLevel, Options, Parser, Tag, TagEnd};
|
use pulldown_cmark::{CodeBlockKind, Event, HeadingLevel, Options, Parser, Tag, TagEnd};
|
||||||
|
|
||||||
use std::borrow::Borrow as _;
|
use crate::components::button::{Button, ButtonVariant};
|
||||||
use std::collections::HashMap;
|
use crate::components::checkbox::Checkbox;
|
||||||
use std::hash::{DefaultHasher, Hash, Hasher};
|
use crate::components::common::Sizable as _;
|
||||||
use std::ops::Range;
|
use crate::components::scrollbar::{Scrollbar, ScrollbarVisibility};
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use crate::editor::highlight::{HighlightedCode, Language, highlight, plain};
|
use crate::editor::highlight::{HighlightedCode, Language, highlight, plain};
|
||||||
use crate::editor::utils::code_line;
|
use crate::editor::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.
|
/// The bottom padding between sibling blocks, in root font sizes.
|
||||||
const BLOCK_GAP: f32 = 0.75;
|
const BLOCK_GAP: f32 = 0.75;
|
||||||
@@ -648,8 +648,8 @@ impl Styled for TextView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Element for TextView {
|
impl Element for TextView {
|
||||||
type RequestLayoutState = AnyElement;
|
|
||||||
type PrepaintState = ();
|
type PrepaintState = ();
|
||||||
|
type RequestLayoutState = AnyElement;
|
||||||
|
|
||||||
fn id(&self) -> Option<ElementId> {
|
fn id(&self) -> Option<ElementId> {
|
||||||
Some(self.id.clone())
|
Some(self.id.clone())
|
||||||
|
|||||||
@@ -3,13 +3,15 @@
|
|||||||
|
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
|
||||||
use crate::editor::highlight::{Language, Line};
|
use gpui::{
|
||||||
use crate::theme::{ActiveTheme as _, CODE_GUTTER_WIDTH, ColorTokens, Ramps};
|
App, HighlightStyle, Hsla, IntoElement, ParentElement as _, Styled as _, StyledText, div,
|
||||||
use crate::theme::{WASH_ALPHA, WASH_ALPHA_GUTTER, WASH_ALPHA_STRONG};
|
};
|
||||||
use gpui::StyledText;
|
|
||||||
use gpui::{App, HighlightStyle, Hsla, IntoElement, ParentElement as _, Styled as _, div};
|
|
||||||
|
|
||||||
use crate::editor::highlight::Role;
|
use crate::editor::highlight::{Language, Line, Role};
|
||||||
|
use crate::theme::{
|
||||||
|
ActiveTheme as _, CODE_GUTTER_WIDTH, ColorTokens, Ramps, WASH_ALPHA, WASH_ALPHA_GUTTER,
|
||||||
|
WASH_ALPHA_STRONG,
|
||||||
|
};
|
||||||
|
|
||||||
impl Role {
|
impl Role {
|
||||||
/// Maps the role to the theme's semantic palette.
|
/// Maps the role to the theme's semantic palette.
|
||||||
|
|||||||
@@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::theme::ActiveTheme as _;
|
|
||||||
use crate::utils::StyledExt as _;
|
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyElement, AnyView, App, Axis, Div, ElementId, Entity, IntoElement, ParentElement as _,
|
AnyElement, AnyView, App, Axis, Div, ElementId, Entity, IntoElement, ParentElement as _,
|
||||||
Render, RenderOnce, SharedString, StyleRefinement, Styled as _, Window, div,
|
Render, RenderOnce, SharedString, StyleRefinement, Styled as _, Window, div,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::layout::resizable::{Resizable, ResizableState};
|
use crate::layout::resizable::{Resizable, ResizableState};
|
||||||
|
use crate::theme::ActiveTheme as _;
|
||||||
|
use crate::utils::StyledExt as _;
|
||||||
|
|
||||||
/// A user-defined panel the row can show.
|
/// A user-defined panel the row can show.
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
//! The resizable group: stacked panes with drag dividers, outside the dock.
|
//! The resizable group: stacked panes with drag dividers, outside the dock.
|
||||||
|
|
||||||
use crate::theme::{PANE_DEFAULT_SIZE, PANE_MIN_SIZE};
|
|
||||||
use crate::utils::StyledExt as _;
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyElement, App, AppContext as _, Axis, Bounds, Context, ElementId, Entity,
|
AnyElement, App, AppContext as _, Axis, Bounds, Context, ElementId, Entity,
|
||||||
@@ -10,6 +8,8 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::layout::resize_handle::ResizeHandle;
|
use crate::layout::resize_handle::ResizeHandle;
|
||||||
|
use crate::theme::{PANE_DEFAULT_SIZE, PANE_MIN_SIZE};
|
||||||
|
use crate::utils::StyledExt as _;
|
||||||
|
|
||||||
type DebugSelector = std::rc::Rc<dyn Fn() -> String>;
|
type DebugSelector = std::rc::Rc<dyn Fn() -> String>;
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,6 @@
|
|||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::theme::{
|
|
||||||
ActiveTheme as _, BORDER_WIDTH, DISABLED_OPACITY, HAIRLINE_WIDTH, RESIZE_KEYBOARD_STEP,
|
|
||||||
};
|
|
||||||
use crate::utils::{StyledExt as _, focus_handle, focus_ring};
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, Axis, Bounds, CursorStyle, DispatchPhase, ElementId, HitboxBehavior,
|
App, Axis, Bounds, CursorStyle, DispatchPhase, ElementId, HitboxBehavior,
|
||||||
@@ -16,6 +12,11 @@ use gpui::{
|
|||||||
deferred, div, fill, point, px,
|
deferred, div, fill, point, px,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::theme::{
|
||||||
|
ActiveTheme as _, BORDER_WIDTH, DISABLED_OPACITY, HAIRLINE_WIDTH, RESIZE_KEYBOARD_STEP,
|
||||||
|
};
|
||||||
|
use crate::utils::{StyledExt as _, focus_handle, focus_ring};
|
||||||
|
|
||||||
/// How far one keyboard arrow step moves the seam.
|
/// How far one keyboard arrow step moves the seam.
|
||||||
const KEYBOARD_STEP: Pixels = RESIZE_KEYBOARD_STEP;
|
const KEYBOARD_STEP: Pixels = RESIZE_KEYBOARD_STEP;
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
//! edge. The bar itself moves the window, tab bar included; the prefix and
|
//! 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.
|
//! suffix opt out, so a press on a control never starts a drag.
|
||||||
|
|
||||||
use crate::theme::{ActiveTheme as _, Size, TRAFFIC_LIGHT_PAD};
|
|
||||||
use crate::utils::{StyledExt as _, h_flex};
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyElement, App, ElementId, InteractiveElement as _, IntoElement, ParentElement, RenderOnce,
|
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::window_controls::{WindowControls, titlebar_strip};
|
||||||
|
use crate::theme::{ActiveTheme as _, Size, TRAFFIC_LIGHT_PAD};
|
||||||
|
use crate::utils::{StyledExt as _, h_flex};
|
||||||
|
|
||||||
/// The window's titlebar.
|
/// The window's titlebar.
|
||||||
#[derive(IntoElement)]
|
#[derive(IntoElement)]
|
||||||
|
|||||||
@@ -4,21 +4,25 @@
|
|||||||
//! never moves it; macOS draws its traffic lights in the shell's reserved pad
|
//! never moves it; macOS draws its traffic lights in the shell's reserved pad
|
||||||
//! and needs no controls of ours.
|
//! and needs no controls of ours.
|
||||||
|
|
||||||
use gpui::WindowControlArea;
|
#[cfg(target_os = "linux")]
|
||||||
use gpui::{App, ClickEvent, Div, ElementId, IntoElement, RenderOnce, Stateful, Window, div};
|
use gpui::Decorations;
|
||||||
use gpui::{InteractiveElement as _, MouseButton, StatefulInteractiveElement as _};
|
|
||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
||||||
use crate::icons::{IconRole, icon};
|
use gpui::SharedString;
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
|
||||||
use crate::theme::ActiveTheme as _;
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
||||||
use gpui::Styled as _;
|
use gpui::Styled as _;
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
||||||
use gpui::{AnyElement, ParentElement as _};
|
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.
|
/// macOS traffic-lights zone: the pad a leading titlebar strip reserves.
|
||||||
pub use crate::theme::TRAFFIC_LIGHT_PAD;
|
pub use crate::theme::TRAFFIC_LIGHT_PAD;
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
@@ -26,10 +30,6 @@ use crate::theme::{
|
|||||||
WINDOWS_CAPTION_WIDTH as CAPTION_WIDTH, WINDOWS_CLOSE_FOREGROUND, WINDOWS_CLOSE_HOVER,
|
WINDOWS_CAPTION_WIDTH as CAPTION_WIDTH, WINDOWS_CLOSE_FOREGROUND, WINDOWS_CLOSE_HOVER,
|
||||||
WINDOWS_CLOSE_PRESSED,
|
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.
|
/// The window controls for the trailing end of a titlebar strip.
|
||||||
#[derive(IntoElement)]
|
#[derive(IntoElement)]
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
//! The client-side window frame: the border, corners, shadow, and resize
|
//! The client-side window frame: the border, corners, shadow, and resize
|
||||||
//! edges of a window the system does not decorate.
|
//! 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::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, Bounds, BoxShadow, CursorStyle, Decorations, Div, HitboxBehavior, InteractiveElement as _,
|
App, Bounds, BoxShadow, CursorStyle, Decorations, Div, HitboxBehavior, InteractiveElement as _,
|
||||||
@@ -9,6 +8,8 @@ use gpui::{
|
|||||||
Tiling, Window, canvas, div, point, px, size,
|
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.
|
/// Wraps a window's root in the frame it owes.
|
||||||
pub fn frame<E>(child: E, window: &mut Window, cx: &App) -> Div
|
pub fn frame<E>(child: E, window: &mut Window, cx: &App) -> Div
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -9,9 +9,8 @@ pub mod theme;
|
|||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
pub use components::*;
|
pub use components::*;
|
||||||
pub use icons::{Assets, Icon, IconRole};
|
|
||||||
|
|
||||||
use gpui::App;
|
use gpui::App;
|
||||||
|
pub use icons::{Assets, Icon, IconRole};
|
||||||
|
|
||||||
/// Initializes the theme and every key binding the UI layer owns.
|
/// Initializes the theme and every key binding the UI layer owns.
|
||||||
pub fn init(cx: &mut App) {
|
pub fn init(cx: &mut App) {
|
||||||
|
|||||||
@@ -15,18 +15,18 @@ mod source;
|
|||||||
mod system;
|
mod system;
|
||||||
mod typography;
|
mod typography;
|
||||||
|
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
pub use colors::{ColorTokens, MaterialTokens};
|
pub use colors::{ColorTokens, MaterialTokens};
|
||||||
pub use definition::ThemeDefinition;
|
pub use definition::ThemeDefinition;
|
||||||
|
use gpui::{
|
||||||
|
App, Global, Hsla, Pixels, SpringConfig, WindowAppearance, WindowBackgroundAppearance, hsla, px,
|
||||||
|
};
|
||||||
pub use ramps::{AccentShades, Oklch};
|
pub use ramps::{AccentShades, Oklch};
|
||||||
pub use resolve::{Ramps, ResolvedTheme};
|
pub use resolve::{Ramps, ResolvedTheme};
|
||||||
pub use system::{AccessibilityPreferences, SourceKind, SystemTheme};
|
pub use system::{AccessibilityPreferences, SourceKind, SystemTheme};
|
||||||
pub use typography::{TextRole, TypeMetrics, Typeset, Typography};
|
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.
|
/// The hairline width of the control border every button and field paints.
|
||||||
pub const BORDER_WIDTH: Pixels = px(1.0);
|
pub const BORDER_WIDTH: Pixels = px(1.0);
|
||||||
/// The underline and drop indicators a tab strip paints.
|
/// The underline and drop indicators a tab strip paints.
|
||||||
@@ -767,9 +767,10 @@ pub fn detected_source(cx: &App) -> &'static str {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
|
||||||
use gpui::Rgba;
|
use gpui::Rgba;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn the_windows_close_colors_match_the_legacy_hex() {
|
fn the_windows_close_colors_match_the_legacy_hex() {
|
||||||
let hover = Hsla::from(gpui::rgba(0xE81123FF));
|
let hover = Hsla::from(gpui::rgba(0xE81123FF));
|
||||||
|
|||||||
@@ -181,9 +181,10 @@ pub fn derive_shades(accent: Hsla, background: Hsla, is_dark: bool) -> AccentSha
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
|
||||||
use gpui::rgb;
|
use gpui::rgb;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
fn hsla(hex: u32) -> Hsla {
|
fn hsla(hex: u32) -> Hsla {
|
||||||
Hsla::from(rgb(hex))
|
Hsla::from(rgb(hex))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
use gpui::{WindowBackgroundAppearance, px};
|
||||||
|
|
||||||
use crate::theme::definition::ThemeDefinition;
|
use crate::theme::definition::ThemeDefinition;
|
||||||
use crate::theme::ramps::{AccentShades, Oklch, contrast_foreground, derive_shades, mix};
|
use crate::theme::ramps::{AccentShades, Oklch, contrast_foreground, derive_shades, mix};
|
||||||
use crate::theme::system::{SourceKind, SystemTheme};
|
use crate::theme::system::{SourceKind, SystemTheme};
|
||||||
@@ -5,7 +7,6 @@ use crate::theme::{
|
|||||||
ColorTokens, CustomTheme, Elevations, MaterialTokens, Motion, Radius, Scrollbar, SizeTable,
|
ColorTokens, CustomTheme, Elevations, MaterialTokens, Motion, Radius, Scrollbar, SizeTable,
|
||||||
Spacing, ThemeVariant, Typography,
|
Spacing, ThemeVariant, Typography,
|
||||||
};
|
};
|
||||||
use gpui::{WindowBackgroundAppearance, px};
|
|
||||||
|
|
||||||
/// Derived state shades for the colors that get pressed and hovered.
|
/// Derived state shades for the colors that get pressed and hovered.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
@@ -245,10 +246,11 @@ fn mono_font() -> &'static str {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use gpui::{Rgba, WindowBackgroundAppearance, rgb};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::theme::system::{AccessibilityPreferences, SourceKind};
|
use crate::theme::system::{AccessibilityPreferences, SourceKind};
|
||||||
use crate::theme::{Elevation, Shadow};
|
use crate::theme::{Elevation, Shadow};
|
||||||
use gpui::{Rgba, WindowBackgroundAppearance, rgb};
|
|
||||||
|
|
||||||
fn hsla(hex: u32) -> gpui::Hsla {
|
fn hsla(hex: u32) -> gpui::Hsla {
|
||||||
gpui::Hsla::from(rgb(hex))
|
gpui::Hsla::from(rgb(hex))
|
||||||
|
|||||||
@@ -8,14 +8,9 @@ use std::path::{Path, PathBuf};
|
|||||||
use gpui::Hsla;
|
use gpui::Hsla;
|
||||||
use notify::{RecursiveMode, Watcher};
|
use notify::{RecursiveMode, Watcher};
|
||||||
|
|
||||||
use super::ThemeSource;
|
|
||||||
use super::kde;
|
|
||||||
use super::omarchy;
|
|
||||||
use super::portal;
|
|
||||||
use super::signal::ReapplySignal;
|
use super::signal::ReapplySignal;
|
||||||
|
use super::{ThemeSource, kde, omarchy, portal};
|
||||||
use crate::theme::ThemeVariant;
|
use crate::theme::ThemeVariant;
|
||||||
|
|
||||||
use crate::theme::system::{SourceKind, SystemTheme};
|
use crate::theme::system::{SourceKind, SystemTheme};
|
||||||
|
|
||||||
pub(crate) struct LinuxSource {
|
pub(crate) struct LinuxSource {
|
||||||
|
|||||||
@@ -13,10 +13,8 @@ use objc2_foundation::{
|
|||||||
NSNotificationName, NSObjectNSKeyValueObserverRegistration, NSString, NSUserDefaults,
|
NSNotificationName, NSObjectNSKeyValueObserverRegistration, NSString, NSUserDefaults,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::narrow_component;
|
|
||||||
|
|
||||||
use super::ThemeSource;
|
|
||||||
use super::signal::ReapplySignal;
|
use super::signal::ReapplySignal;
|
||||||
|
use super::{ThemeSource, narrow_component};
|
||||||
use crate::theme::ThemeVariant;
|
use crate::theme::ThemeVariant;
|
||||||
use crate::theme::system::{AccessibilityPreferences, SourceKind, SystemTheme};
|
use crate::theme::system::{AccessibilityPreferences, SourceKind, SystemTheme};
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
use gpui::Hsla;
|
use gpui::Hsla;
|
||||||
|
|
||||||
use super::narrow_component;
|
use super::narrow_component;
|
||||||
|
use crate::theme::ThemeVariant;
|
||||||
use crate::theme::{ThemeVariant, system::AccessibilityPreferences};
|
use crate::theme::system::AccessibilityPreferences;
|
||||||
|
|
||||||
/// The raw portal values, already converted off the DBus wire types.
|
/// The raw portal values, already converted off the DBus wire types.
|
||||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
use crate::theme::{ActiveTheme as _, FOCUS_RING_ALPHA, FOCUS_RING_SPREAD};
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, Bounds, BoxShadow, Div, ElementId, FocusHandle, Global, Hsla, IntoElement, Pixels,
|
App, Bounds, BoxShadow, Div, ElementId, FocusHandle, Global, Hsla, IntoElement, Pixels,
|
||||||
Refineable as _, StatefulInteractiveElement, StyleRefinement, Styled, Window, WindowId, div,
|
Refineable as _, StatefulInteractiveElement, StyleRefinement, Styled, Window, WindowId, div,
|
||||||
px,
|
px,
|
||||||
};
|
};
|
||||||
use std::collections::HashMap;
|
|
||||||
|
use crate::theme::{ActiveTheme as _, FOCUS_RING_ALPHA, FOCUS_RING_SPREAD};
|
||||||
|
|
||||||
/// A row whose children center on the cross axis.
|
/// A row whose children center on the cross axis.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|||||||
Reference in New Issue
Block a user