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

View File

@@ -423,7 +423,7 @@ impl Render for ChatSpace {
.child(self.dock.clone()),
)
// Notifications
.child(div().absolute().top_8().children(notification_layer))
.children(notification_layer)
// Modals
.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>) {
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 weak_pwd_input = pwd_input.downgrade();
@@ -191,13 +192,13 @@ impl Login {
let view_cancel = 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()
} else {
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()
} else {
t!("login.password_description_full").into()
@@ -226,7 +227,7 @@ impl Login {
view_ok
.update(cx, |this, cx| {
this.verify_password(value, confirm, window, cx);
this.verify_password(value, confirm, is_ncryptsec, window, cx);
})
.ok();
true
@@ -273,6 +274,7 @@ impl Login {
&mut self,
password: Option<SharedString>,
confirm: Option<SharedString>,
is_ncryptsec: bool,
window: &mut Window,
cx: &mut Context<Self>,
) {
@@ -286,8 +288,8 @@ impl Login {
return;
}
// Skip verification if password starts with "ncryptsec1"
if password.starts_with("ncryptsec1") {
// Skip verification if key is ncryptsec
if is_ncryptsec {
self.login_with_keys(password.to_string(), window, cx);
return;
}

View File

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

View File

@@ -3,9 +3,9 @@ use std::time::Duration;
use gpui::prelude::FluentBuilder;
use gpui::{
anchored, div, point, px, relative, Animation, AnimationExt as _, AnyElement, App, Bounds,
ClickEvent, Div, FocusHandle, InteractiveElement, IntoElement, KeyBinding, MouseButton,
ParentElement, Pixels, Point, RenderOnce, SharedString, Styled, Window,
anchored, div, hsla, point, px, relative, Animation, AnimationExt as _, AnyElement, App,
Bounds, BoxShadow, ClickEvent, Div, FocusHandle, InteractiveElement, IntoElement, KeyBinding,
MouseButton, ParentElement, Pixels, Point, RenderOnce, SharedString, Styled, Window,
};
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 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()
.position(point(window_paddings.left, window_paddings.top))
.snap_to_window()
@@ -487,16 +490,27 @@ impl RenderOnce for Modal {
)),
)
})
.with_animation(
"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.);
this.top(y + y_offset)
},
),
),
.with_animation("slide-down", animation.clone(), move |this, delta| {
let y_offset = px(0.) + delta * px(30.);
// 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 items = self.notifications.iter().rev().take(10).rev().cloned();
div()
.absolute()
.flex()
.top_4()
.bottom_4()
.right_4()
.justify_end()
.child(
v_flex()
.id("notification-list")
.gap_3()
.absolute()
.relative()
.right_0()
.h(size.height - px(8.))
.children(items)
.on_hover(cx.listener(|view, hovered, _window, cx| {
view.expanded = *hovered;
cx.notify();
})),
)
div().absolute().top_4().right_4().child(
v_flex()
.id("notification-list")
.h(size.height - px(8.))
.on_hover(cx.listener(|view, hovered, _, cx| {
view.expanded = *hovered;
cx.notify()
}))
.gap_3()
.children(items),
)
}
}

View File

@@ -188,7 +188,13 @@ impl Root {
) -> Option<impl IntoElement> {
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.