Update GPUI and apply opacity feature. (#215)
This commit is contained in:
parent
9e67525650
commit
2c469da55a
18 changed files with 30 additions and 86 deletions
23
Cargo.lock
generated
23
Cargo.lock
generated
|
|
@ -474,7 +474,7 @@ dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"cexpr",
|
"cexpr",
|
||||||
"clang-sys",
|
"clang-sys",
|
||||||
"itertools 0.12.1",
|
"itertools 0.11.0",
|
||||||
"log",
|
"log",
|
||||||
"prettyplease",
|
"prettyplease",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
|
@ -944,7 +944,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "collections"
|
name = "collections"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#1dce79297865a43e65cb36ce6368c74088b9d62a"
|
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#4f7507eb244527afcab0c186b39eba047d11a158"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
]
|
]
|
||||||
|
|
@ -1275,7 +1275,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derive_refineable"
|
name = "derive_refineable"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#1dce79297865a43e65cb36ce6368c74088b9d62a"
|
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#4f7507eb244527afcab0c186b39eba047d11a158"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
@ -2203,7 +2203,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpui"
|
name = "gpui"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#1dce79297865a43e65cb36ce6368c74088b9d62a"
|
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#4f7507eb244527afcab0c186b39eba047d11a158"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"as-raw-xcb-connection",
|
"as-raw-xcb-connection",
|
||||||
|
|
@ -2302,7 +2302,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpui_macros"
|
name = "gpui_macros"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#1dce79297865a43e65cb36ce6368c74088b9d62a"
|
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#4f7507eb244527afcab0c186b39eba047d11a158"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
@ -2497,7 +2497,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http_client"
|
name = "http_client"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#1dce79297865a43e65cb36ce6368c74088b9d62a"
|
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#4f7507eb244527afcab0c186b39eba047d11a158"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"derive_more",
|
"derive_more",
|
||||||
|
|
@ -3048,7 +3048,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "media"
|
name = "media"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#1dce79297865a43e65cb36ce6368c74088b9d62a"
|
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#4f7507eb244527afcab0c186b39eba047d11a158"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bindgen",
|
"bindgen",
|
||||||
|
|
@ -4149,7 +4149,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "refineable"
|
name = "refineable"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#1dce79297865a43e65cb36ce6368c74088b9d62a"
|
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#4f7507eb244527afcab0c186b39eba047d11a158"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"derive_refineable",
|
"derive_refineable",
|
||||||
]
|
]
|
||||||
|
|
@ -4484,7 +4484,7 @@ checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "semantic_version"
|
name = "semantic_version"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#1dce79297865a43e65cb36ce6368c74088b9d62a"
|
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#4f7507eb244527afcab0c186b39eba047d11a158"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
@ -4848,7 +4848,6 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||||
name = "story"
|
name = "story"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
|
||||||
"charts-rs",
|
"charts-rs",
|
||||||
"chrono",
|
"chrono",
|
||||||
"fake",
|
"fake",
|
||||||
|
|
@ -4933,7 +4932,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sum_tree"
|
name = "sum_tree"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#1dce79297865a43e65cb36ce6368c74088b9d62a"
|
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#4f7507eb244527afcab0c186b39eba047d11a158"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"log",
|
"log",
|
||||||
|
|
@ -5552,7 +5551,7 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "util"
|
name = "util"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#1dce79297865a43e65cb36ce6368c74088b9d62a"
|
source = "git+https://github.com/huacnlee/zed.git?branch=export-platform-window#4f7507eb244527afcab0c186b39eba047d11a158"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-fs 1.6.0",
|
"async-fs 1.6.0",
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ edition = "2021"
|
||||||
ui.workspace = true
|
ui.workspace = true
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
fake = "2.9.2"
|
fake = "2.9.2"
|
||||||
anyhow = "1"
|
|
||||||
charts-rs = "0.3"
|
charts-rs = "0.3"
|
||||||
regex = "1"
|
regex = "1"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use ui::{
|
||||||
label::Label,
|
label::Label,
|
||||||
list::ListItem,
|
list::ListItem,
|
||||||
list::{List, ListDelegate},
|
list::{List, ListDelegate},
|
||||||
theme::{hsl, ActiveTheme, Colorize as _},
|
theme::{hsl, ActiveTheme},
|
||||||
v_flex,
|
v_flex,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use crate::{
|
||||||
tab::{Tab, TabBar},
|
tab::{Tab, TabBar},
|
||||||
theme::ActiveTheme,
|
theme::ActiveTheme,
|
||||||
tooltip::Tooltip,
|
tooltip::Tooltip,
|
||||||
v_flex, AxisExt, IconName, Placement, Selectable, Sizable, StyledExt,
|
v_flex, AxisExt, IconName, Placement, Selectable, Sizable,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{ClosePanel, DockArea, Panel, PanelView, StackPanel, ToggleZoom};
|
use super::{ClosePanel, DockArea, Panel, PanelView, StackPanel, ToggleZoom};
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use crate::{
|
||||||
h_flex,
|
h_flex,
|
||||||
input::ClearButton,
|
input::ClearButton,
|
||||||
list::{self, List, ListDelegate, ListItem},
|
list::{self, List, ListDelegate, ListItem},
|
||||||
theme::{ActiveTheme, Colorize},
|
theme::ActiveTheme,
|
||||||
v_flex, Disableable, Icon, IconName, Sizable, Size, StyleSized, StyledExt,
|
v_flex, Disableable, Icon, IconName, Sizable, Size, StyleSized, StyledExt,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use gpui::{
|
||||||
RenderOnce, SharedString, Stateful, StatefulInteractiveElement, Styled,
|
RenderOnce, SharedString, Stateful, StatefulInteractiveElement, Styled,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::theme::{ActiveTheme as _, Colorize};
|
use crate::theme::ActiveTheme as _;
|
||||||
|
|
||||||
#[derive(IntoElement)]
|
#[derive(IntoElement)]
|
||||||
pub struct Link {
|
pub struct Link {
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ impl RenderOnce for Modal {
|
||||||
.with_easing(cubic_bezier(0.32, 0.72, 0., 1.)),
|
.with_easing(cubic_bezier(0.32, 0.72, 0., 1.)),
|
||||||
move |this, delta| {
|
move |this, delta| {
|
||||||
let y_offset = px(0.) + delta * px(30.);
|
let y_offset = px(0.) + delta * px(30.);
|
||||||
this.top(y + y_offset)
|
this.top(y + y_offset).opacity(delta)
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,7 @@ impl Render for Notification {
|
||||||
this.left(px(0.) + x_offset).opacity(1. - delta)
|
this.left(px(0.) + x_offset).opacity(1. - delta)
|
||||||
} else {
|
} else {
|
||||||
let y_offset = px(-45.) + delta * px(45.);
|
let y_offset = px(-45.) + delta * px(45.);
|
||||||
this.top(px(0.) + y_offset)
|
this.top(px(0.) + y_offset).opacity(delta)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use gpui::{
|
||||||
WindowContext,
|
WindowContext,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::theme::{ActiveTheme, Colorize};
|
use crate::theme::ActiveTheme;
|
||||||
|
|
||||||
#[derive(IntoElement)]
|
#[derive(IntoElement)]
|
||||||
pub struct Progress {
|
pub struct Progress {
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,7 @@ use gpui::{
|
||||||
WindowContext,
|
WindowContext,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{h_flex, theme::ActiveTheme, IconName};
|
||||||
h_flex,
|
|
||||||
theme::{ActiveTheme, Colorize},
|
|
||||||
IconName,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(IntoElement)]
|
#[derive(IntoElement)]
|
||||||
pub struct Radio {
|
pub struct Radio {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{cell::Cell, rc::Rc};
|
use std::{cell::Cell, rc::Rc};
|
||||||
|
|
||||||
use crate::theme::{ActiveTheme, Colorize};
|
use crate::theme::ActiveTheme;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
fill, point, px, relative, size, Bounds, ContentMask, Edges, Element, EntityId, Hitbox,
|
fill, point, px, relative, size, Bounds, ContentMask, Edges, Element, EntityId, Hitbox,
|
||||||
IntoElement, MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad, Pixels, Point, Position,
|
IntoElement, MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad, Pixels, Point, Position,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use gpui::{
|
||||||
RenderOnce, Styled,
|
RenderOnce, Styled,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{theme::ActiveTheme, StyledExt};
|
use crate::theme::ActiveTheme;
|
||||||
|
|
||||||
#[derive(IntoElement)]
|
#[derive(IntoElement)]
|
||||||
pub struct Skeleton {
|
pub struct Skeleton {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
use crate::{
|
use crate::{theme::ActiveTheme, tooltip::Tooltip};
|
||||||
theme::{ActiveTheme, Colorize},
|
|
||||||
tooltip::Tooltip,
|
|
||||||
};
|
|
||||||
use gpui::{
|
use gpui::{
|
||||||
canvas, div, px, relative, Axis, Bounds, DragMoveEvent, EntityId, EventEmitter,
|
canvas, div, px, relative, Axis, Bounds, DragMoveEvent, EntityId, EventEmitter,
|
||||||
InteractiveElement, IntoElement, MouseButton, MouseDownEvent, ParentElement as _, Pixels,
|
InteractiveElement, IntoElement, MouseButton, MouseDownEvent, ParentElement as _, Pixels,
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,9 @@ use std::fmt::{self, Display, Formatter};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
scroll::{Scrollable, ScrollbarAxis},
|
scroll::{Scrollable, ScrollbarAxis},
|
||||||
theme::{ActiveTheme, Colorize},
|
theme::ActiveTheme,
|
||||||
};
|
|
||||||
use gpui::{
|
|
||||||
div, px, Axis, Div, Element, EntityId, Fill, FocusHandle, Pixels, Styled, WindowContext,
|
|
||||||
};
|
};
|
||||||
|
use gpui::{div, px, Axis, Div, Element, EntityId, FocusHandle, Pixels, Styled, WindowContext};
|
||||||
|
|
||||||
/// Returns a `Div` as horizontal flex layout.
|
/// Returns a `Div` as horizontal flex layout.
|
||||||
pub fn h_flex() -> Div {
|
pub fn h_flex() -> Div {
|
||||||
|
|
@ -122,45 +120,6 @@ pub trait StyledExt: Styled + Sized {
|
||||||
font_weight!(font_extrabold, EXTRA_BOLD);
|
font_weight!(font_extrabold, EXTRA_BOLD);
|
||||||
font_weight!(font_black, BLACK);
|
font_weight!(font_black, BLACK);
|
||||||
|
|
||||||
/// Set the opacity of the element.
|
|
||||||
fn opacity(mut self, opacity: f32) -> Self {
|
|
||||||
let text_color = self.style().text.clone().and_then(|t| t.color);
|
|
||||||
let bg_color = self.style().background.clone();
|
|
||||||
let border_color = self.style().border_color;
|
|
||||||
let box_shadow = self.style().box_shadow.clone();
|
|
||||||
|
|
||||||
let this = if let Some(bg) = bg_color {
|
|
||||||
match bg {
|
|
||||||
Fill::Color(color) => self.bg(color.opacity(opacity)),
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
self
|
|
||||||
};
|
|
||||||
|
|
||||||
let this = if let Some(color) = border_color {
|
|
||||||
this.border_color(color.opacity(opacity))
|
|
||||||
} else {
|
|
||||||
this
|
|
||||||
};
|
|
||||||
|
|
||||||
let this = if let Some(mut shadow) = box_shadow {
|
|
||||||
for shadow in shadow.iter_mut() {
|
|
||||||
shadow.color = shadow.color.opacity(opacity);
|
|
||||||
}
|
|
||||||
this.shadow(shadow)
|
|
||||||
} else {
|
|
||||||
this
|
|
||||||
};
|
|
||||||
|
|
||||||
let this = if let Some(text_color) = text_color {
|
|
||||||
this.text_color(text_color.opacity(opacity))
|
|
||||||
} else {
|
|
||||||
this
|
|
||||||
};
|
|
||||||
|
|
||||||
this
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set as Popover style
|
/// Set as Popover style
|
||||||
fn popover_style(self, cx: &mut WindowContext) -> Self {
|
fn popover_style(self, cx: &mut WindowContext) -> Self {
|
||||||
self.bg(cx.theme().popover)
|
self.bg(cx.theme().popover)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use crate::{
|
use crate::{h_flex, theme::ActiveTheme, Disableable, Sizable, Size};
|
||||||
h_flex,
|
|
||||||
theme::{ActiveTheme, Colorize},
|
|
||||||
Disableable, Sizable, Size,
|
|
||||||
};
|
|
||||||
use gpui::{
|
use gpui::{
|
||||||
div, prelude::FluentBuilder as _, px, Animation, AnimationExt as _, Div, ElementId,
|
div, prelude::FluentBuilder as _, px, Animation, AnimationExt as _, Div, ElementId,
|
||||||
InteractiveElement, IntoElement, ParentElement as _, RenderOnce, SharedString, Stateful,
|
InteractiveElement, IntoElement, ParentElement as _, RenderOnce, SharedString, Stateful,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::theme::{ActiveTheme, Colorize};
|
use crate::theme::ActiveTheme;
|
||||||
use crate::Selectable;
|
use crate::Selectable;
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use std::{cell::Cell, ops::Range, rc::Rc};
|
||||||
use crate::{
|
use crate::{
|
||||||
h_flex,
|
h_flex,
|
||||||
scroll::{ScrollableAxis, ScrollableMask, Scrollbar, ScrollbarState},
|
scroll::{ScrollableAxis, ScrollableMask, Scrollbar, ScrollbarState},
|
||||||
theme::{ActiveTheme, Colorize},
|
theme::ActiveTheme,
|
||||||
v_flex, Icon, IconName,
|
v_flex, Icon, IconName,
|
||||||
};
|
};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
|
|
@ -691,7 +691,8 @@ where
|
||||||
view.delegate.load_more(cx);
|
view.delegate.load_more(cx);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}).detach()
|
})
|
||||||
|
.detach()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,7 @@ use gpui::{
|
||||||
use rust_i18n::t;
|
use rust_i18n::t;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
button::Button,
|
button::Button, h_flex, theme::ActiveTheme, v_flex, Disableable as _, IconName, Selectable,
|
||||||
h_flex,
|
|
||||||
theme::{ActiveTheme, Colorize},
|
|
||||||
v_flex, Disableable as _, IconName, Selectable,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::utils::days_in_month;
|
use super::utils::days_in_month;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue