chore: update gpui-component

This commit is contained in:
2025-07-23 20:47:15 +07:00
parent a631dd90d2
commit 12168c6084
7 changed files with 80 additions and 65 deletions

47
Cargo.lock generated
View File

@@ -1073,7 +1073,7 @@ dependencies = [
[[package]] [[package]]
name = "collections" name = "collections"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#500ceaabcde9d78b3a1a0d14674523e497dbc6e4" source = "git+https://github.com/zed-industries/zed#2bc6e18ac913f363e7f75fd12efccc02dc3c05d9"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
@@ -1474,7 +1474,7 @@ dependencies = [
[[package]] [[package]]
name = "derive_refineable" name = "derive_refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#500ceaabcde9d78b3a1a0d14674523e497dbc6e4" source = "git+https://github.com/zed-industries/zed#2bc6e18ac913f363e7f75fd12efccc02dc3c05d9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2326,7 +2326,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui" name = "gpui"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#500ceaabcde9d78b3a1a0d14674523e497dbc6e4" source = "git+https://github.com/zed-industries/zed#2bc6e18ac913f363e7f75fd12efccc02dc3c05d9"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"as-raw-xcb-connection", "as-raw-xcb-connection",
@@ -2419,7 +2419,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_macros" name = "gpui_macros"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#500ceaabcde9d78b3a1a0d14674523e497dbc6e4" source = "git+https://github.com/zed-industries/zed#2bc6e18ac913f363e7f75fd12efccc02dc3c05d9"
dependencies = [ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
@@ -2431,7 +2431,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_tokio" name = "gpui_tokio"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#500ceaabcde9d78b3a1a0d14674523e497dbc6e4" source = "git+https://github.com/zed-industries/zed#2bc6e18ac913f363e7f75fd12efccc02dc3c05d9"
dependencies = [ dependencies = [
"gpui", "gpui",
"tokio", "tokio",
@@ -2441,9 +2441,9 @@ dependencies = [
[[package]] [[package]]
name = "grid" name = "grid"
version = "0.17.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71b01d27060ad58be4663b9e4ac9e2d4806918e8876af8912afbddd1a91d5eaa" checksum = "be136d9dacc2a13cc70bb6c8f902b414fb2641f8db1314637c6b7933411a8f82"
[[package]] [[package]]
name = "h2" name = "h2"
@@ -2653,7 +2653,7 @@ dependencies = [
[[package]] [[package]]
name = "http_client" name = "http_client"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#500ceaabcde9d78b3a1a0d14674523e497dbc6e4" source = "git+https://github.com/zed-industries/zed#2bc6e18ac913f363e7f75fd12efccc02dc3c05d9"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -2671,7 +2671,7 @@ dependencies = [
[[package]] [[package]]
name = "http_client_tls" name = "http_client_tls"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#500ceaabcde9d78b3a1a0d14674523e497dbc6e4" source = "git+https://github.com/zed-industries/zed#2bc6e18ac913f363e7f75fd12efccc02dc3c05d9"
dependencies = [ dependencies = [
"rustls", "rustls",
"rustls-platform-verifier", "rustls-platform-verifier",
@@ -3449,7 +3449,7 @@ dependencies = [
[[package]] [[package]]
name = "media" name = "media"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#500ceaabcde9d78b3a1a0d14674523e497dbc6e4" source = "git+https://github.com/zed-industries/zed#2bc6e18ac913f363e7f75fd12efccc02dc3c05d9"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bindgen 0.71.1", "bindgen 0.71.1",
@@ -3672,7 +3672,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr" name = "nostr"
version = "0.42.1" version = "0.42.1"
source = "git+https://github.com/rust-nostr/nostr#b2d26225a156765d2de9456dd38cc7a40f7426f0" source = "git+https://github.com/rust-nostr/nostr#baeba7bbffe99d2d48a2f79390db089f491b2a86"
dependencies = [ dependencies = [
"aes", "aes",
"base64", "base64",
@@ -3695,7 +3695,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-connect" name = "nostr-connect"
version = "0.42.0" version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#b2d26225a156765d2de9456dd38cc7a40f7426f0" source = "git+https://github.com/rust-nostr/nostr#baeba7bbffe99d2d48a2f79390db089f491b2a86"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"nostr", "nostr",
@@ -3707,7 +3707,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-database" name = "nostr-database"
version = "0.42.0" version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#b2d26225a156765d2de9456dd38cc7a40f7426f0" source = "git+https://github.com/rust-nostr/nostr#baeba7bbffe99d2d48a2f79390db089f491b2a86"
dependencies = [ dependencies = [
"flatbuffers", "flatbuffers",
"lru", "lru",
@@ -3718,7 +3718,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-lmdb" name = "nostr-lmdb"
version = "0.42.0" version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#b2d26225a156765d2de9456dd38cc7a40f7426f0" source = "git+https://github.com/rust-nostr/nostr#baeba7bbffe99d2d48a2f79390db089f491b2a86"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"heed", "heed",
@@ -3731,7 +3731,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-relay-pool" name = "nostr-relay-pool"
version = "0.42.0" version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#b2d26225a156765d2de9456dd38cc7a40f7426f0" source = "git+https://github.com/rust-nostr/nostr#baeba7bbffe99d2d48a2f79390db089f491b2a86"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"async-wsocket", "async-wsocket",
@@ -3747,7 +3747,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-sdk" name = "nostr-sdk"
version = "0.42.0" version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#b2d26225a156765d2de9456dd38cc7a40f7426f0" source = "git+https://github.com/rust-nostr/nostr#baeba7bbffe99d2d48a2f79390db089f491b2a86"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"nostr", "nostr",
@@ -4801,7 +4801,7 @@ dependencies = [
[[package]] [[package]]
name = "refineable" name = "refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#500ceaabcde9d78b3a1a0d14674523e497dbc6e4" source = "git+https://github.com/zed-industries/zed#2bc6e18ac913f363e7f75fd12efccc02dc3c05d9"
dependencies = [ dependencies = [
"derive_refineable", "derive_refineable",
"workspace-hack", "workspace-hack",
@@ -4952,7 +4952,7 @@ dependencies = [
[[package]] [[package]]
name = "reqwest_client" name = "reqwest_client"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#500ceaabcde9d78b3a1a0d14674523e497dbc6e4" source = "git+https://github.com/zed-industries/zed#2bc6e18ac913f363e7f75fd12efccc02dc3c05d9"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -5478,7 +5478,7 @@ checksum = "0f7d95a54511e0c7be3f51e8867aa8cf35148d7b9445d44de2f943e2b206e749"
[[package]] [[package]]
name = "semantic_version" name = "semantic_version"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#500ceaabcde9d78b3a1a0d14674523e497dbc6e4" source = "git+https://github.com/zed-industries/zed#2bc6e18ac913f363e7f75fd12efccc02dc3c05d9"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"serde", "serde",
@@ -5872,7 +5872,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "sum_tree" name = "sum_tree"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#500ceaabcde9d78b3a1a0d14674523e497dbc6e4" source = "git+https://github.com/zed-industries/zed#2bc6e18ac913f363e7f75fd12efccc02dc3c05d9"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"log", "log",
@@ -6095,12 +6095,13 @@ dependencies = [
[[package]] [[package]]
name = "taffy" name = "taffy"
version = "0.8.3" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7aaef0ac998e6527d6d0d5582f7e43953bb17221ac75bb8eb2fcc2db3396db1c" checksum = "e8b61630cba2afd2c851821add2e1bb1b7851a2436e839ab73b56558b009035e"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"grid", "grid",
"num-traits",
"serde", "serde",
"slotmap", "slotmap",
] ]
@@ -6845,7 +6846,7 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]] [[package]]
name = "util" name = "util"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#500ceaabcde9d78b3a1a0d14674523e497dbc6e4" source = "git+https://github.com/zed-industries/zed#2bc6e18ac913f363e7f75fd12efccc02dc3c05d9"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-fs", "async-fs",

View File

@@ -423,7 +423,7 @@ impl Render for ChatSpace {
.child(self.dock.clone()), .child(self.dock.clone()),
) )
// Notifications // Notifications
.child(div().absolute().top_8().children(notification_layer)) .children(notification_layer)
// Modals // Modals
.children(modal_layer) .children(modal_layer)
} }

View File

@@ -177,6 +177,7 @@ impl Login {
fn ask_for_password(&mut self, content: String, window: &mut Window, cx: &mut Context<Self>) { fn ask_for_password(&mut self, content: String, window: &mut Window, cx: &mut Context<Self>) {
let current_view = cx.entity().downgrade(); let current_view = cx.entity().downgrade();
let is_ncryptsec = content.starts_with("ncryptsec1");
let pwd_input = cx.new(|cx| InputState::new(window, cx).masked(true)); let pwd_input = cx.new(|cx| InputState::new(window, cx).masked(true));
let weak_pwd_input = pwd_input.downgrade(); let weak_pwd_input = pwd_input.downgrade();
@@ -191,13 +192,13 @@ impl Login {
let view_cancel = current_view.clone(); let view_cancel = current_view.clone();
let view_ok = current_view.clone(); let view_ok = current_view.clone();
let label: SharedString = if content.starts_with("nsec1") { let label: SharedString = if !is_ncryptsec {
t!("login.set_password").into() t!("login.set_password").into()
} else { } else {
t!("login.password_to_decrypt").into() t!("login.password_to_decrypt").into()
}; };
let description: SharedString = if content.starts_with("ncryptsec1") { let description: SharedString = if is_ncryptsec {
t!("login.password_description").into() t!("login.password_description").into()
} else { } else {
t!("login.password_description_full").into() t!("login.password_description_full").into()
@@ -226,7 +227,7 @@ impl Login {
view_ok view_ok
.update(cx, |this, cx| { .update(cx, |this, cx| {
this.verify_password(value, confirm, window, cx); this.verify_password(value, confirm, is_ncryptsec, window, cx);
}) })
.ok(); .ok();
true true
@@ -273,6 +274,7 @@ impl Login {
&mut self, &mut self,
password: Option<SharedString>, password: Option<SharedString>,
confirm: Option<SharedString>, confirm: Option<SharedString>,
is_ncryptsec: bool,
window: &mut Window, window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) { ) {
@@ -286,8 +288,8 @@ impl Login {
return; return;
} }
// Skip verification if password starts with "ncryptsec1" // Skip verification if key is ncryptsec
if password.starts_with("ncryptsec1") { if is_ncryptsec {
self.login_with_keys(password.to_string(), window, cx); self.login_with_keys(password.to_string(), window, cx);
return; return;
} }

View File

@@ -568,13 +568,15 @@ impl Sidebar {
let desc = SharedString::new(t!("sidebar.loading_modal_description")); let desc = SharedString::new(t!("sidebar.loading_modal_description"));
window.open_modal(cx, move |this, _window, cx| { window.open_modal(cx, move |this, _window, cx| {
this.title(title.clone()).child( this.child(
div() div()
.pt_8()
.px_4() .px_4()
.pb_4() .pb_4()
.flex() .flex()
.flex_col() .flex_col()
.gap_2() .gap_2()
.child(div().font_semibold().child(title.clone()))
.child( .child(
div() div()
.flex() .flex()

View File

@@ -3,9 +3,9 @@ use std::time::Duration;
use gpui::prelude::FluentBuilder; use gpui::prelude::FluentBuilder;
use gpui::{ use gpui::{
anchored, div, point, px, relative, Animation, AnimationExt as _, AnyElement, App, Bounds, anchored, div, hsla, point, px, relative, Animation, AnimationExt as _, AnyElement, App,
ClickEvent, Div, FocusHandle, InteractiveElement, IntoElement, KeyBinding, MouseButton, Bounds, BoxShadow, ClickEvent, Div, FocusHandle, InteractiveElement, IntoElement, KeyBinding,
ParentElement, Pixels, Point, RenderOnce, SharedString, Styled, Window, MouseButton, ParentElement, Pixels, Point, RenderOnce, SharedString, Styled, Window,
}; };
use theme::ActiveTheme; use theme::ActiveTheme;
@@ -366,6 +366,9 @@ impl RenderOnce for Modal {
let y = self.margin_top.unwrap_or(view_size.height / 10.) + offset_top; let y = self.margin_top.unwrap_or(view_size.height / 10.) + offset_top;
let x = bounds.center().x - self.width / 2.; let x = bounds.center().x - self.width / 2.;
let animation = Animation::new(Duration::from_secs_f64(0.25))
.with_easing(cubic_bezier(0.32, 0.72, 0., 1.));
anchored() anchored()
.position(point(window_paddings.left, window_paddings.top)) .position(point(window_paddings.left, window_paddings.top))
.snap_to_window() .snap_to_window()
@@ -487,16 +490,27 @@ impl RenderOnce for Modal {
)), )),
) )
}) })
.with_animation( .with_animation("slide-down", animation.clone(), move |this, delta| {
"slide-down",
Animation::new(Duration::from_secs_f64(0.25))
.with_easing(cubic_bezier(0.32, 0.72, 0., 1.)),
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 is equivalent to `shadow_xl` with an extra opacity.
let shadow = vec![
BoxShadow {
color: hsla(0., 0., 0., 0.1 * delta),
offset: point(px(0.), px(20.)),
blur_radius: px(25.),
spread_radius: px(-5.),
}, },
), BoxShadow {
), color: hsla(0., 0., 0., 0.1 * delta),
offset: point(px(0.), px(8.)),
blur_radius: px(10.),
spread_radius: px(-6.),
},
];
this.top(y + y_offset).shadow(shadow)
}),
)
.with_animation("fade-in", animation, move |this, delta| this.opacity(delta)),
) )
} }
} }

View File

@@ -364,26 +364,16 @@ impl Render for NotificationList {
let size = window.viewport_size(); let size = window.viewport_size();
let items = self.notifications.iter().rev().take(10).rev().cloned(); let items = self.notifications.iter().rev().take(10).rev().cloned();
div() div().absolute().top_4().right_4().child(
.absolute()
.flex()
.top_4()
.bottom_4()
.right_4()
.justify_end()
.child(
v_flex() v_flex()
.id("notification-list") .id("notification-list")
.gap_3()
.absolute()
.relative()
.right_0()
.h(size.height - px(8.)) .h(size.height - px(8.))
.children(items) .on_hover(cx.listener(|view, hovered, _, cx| {
.on_hover(cx.listener(|view, hovered, _window, cx| {
view.expanded = *hovered; view.expanded = *hovered;
cx.notify(); cx.notify()
})), }))
.gap_3()
.children(items),
) )
} }
} }

View File

@@ -188,7 +188,13 @@ impl Root {
) -> Option<impl IntoElement> { ) -> Option<impl IntoElement> {
let root = window.root::<Root>()??; let root = window.root::<Root>()??;
Some(div().child(root.read(cx).notification.clone())) Some(
div()
.absolute()
.top_0()
.right_0()
.child(root.read(cx).notification.clone()),
)
} }
/// Render the Modal layer. /// Render the Modal layer.