update gpui-native-kit and adopt text roles
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:
2026-11-13 03:53:42 +07:00
parent a27eca45c8
commit bc6e251b6d
35 changed files with 277 additions and 251 deletions
+12 -10
View File
@@ -16,7 +16,7 @@ use gpui_native_kit::layout::dock::Panel;
use gpui_native_kit::layout::resizable::{Resizable, ResizableState};
use gpui_native_kit::scrollbar::Scrollbar;
use gpui_native_kit::spinner::Spinner;
use gpui_native_kit::theme::ActiveTheme as _;
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
use metadata::ProfileDirectory;
use signed_git::{CommitDiff, DiffStatus, FileCommit, FileDiff, Repo};
use signed_state::RepoStore;
@@ -285,8 +285,7 @@ impl DiffPane {
.gap_2()
.child(
div()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.typeset(TextRole::Caption2, cx)
.text_color(status_color)
.child(status_label),
)
@@ -294,8 +293,7 @@ impl DiffPane {
div()
.flex_1()
.min_w_0()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.typeset(TextRole::Caption2, cx)
.text_ellipsis()
.whitespace_nowrap()
.child(title),
@@ -304,7 +302,7 @@ impl DiffPane {
this.child(
h_flex()
.gap_2()
.text_xs()
.typeset(TextRole::Caption, cx)
.child(
div()
.text_color(cx.theme().ramps.success.base)
@@ -467,7 +465,7 @@ impl CommitDiffView {
v_flex()
.child(
div()
.font_weight(gpui::FontWeight::SEMIBOLD)
.typeset(TextRole::Headline, cx)
.text_ellipsis()
.whitespace_nowrap()
.child(commit.summary.clone()),
@@ -475,7 +473,7 @@ impl CommitDiffView {
.child(
h_flex()
.gap_2()
.text_sm()
.typeset(TextRole::Body, cx)
.child(SharedString::from(format!("{} committed", commit.author)))
.child(
h_flex()
@@ -492,12 +490,16 @@ impl CommitDiffView {
),
)
.when_some(commit.description.as_ref(), |this, description| {
this.child(div().text_sm().child(SharedString::from(description)))
this.child(
div()
.typeset(TextRole::Body, cx)
.child(SharedString::from(description)),
)
})
.child(
h_flex()
.gap_2()
.text_xs()
.typeset(TextRole::Caption, cx)
.child(Badge::new("commit-files", format!("{files} files changed")))
.when(insertions > 0, |this| {
this.child(
+11 -10
View File
@@ -6,7 +6,7 @@ use gpui_native_kit::avatar::Avatar;
use gpui_native_kit::clipboard::ClipboardButton;
use gpui_native_kit::common::{Sizable as _, h_flex, v_flex};
use gpui_native_kit::dialog::Dialog;
use gpui_native_kit::theme::ActiveTheme as _;
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
use metadata::ProfileDirectory;
use nostr::prelude::PublicKey;
use signed_core::Announcement;
@@ -66,6 +66,7 @@ fn announcement_rows(
.as_deref()
.map(SharedString::from)
.unwrap_or_else(|| SharedString::from("-")),
cx,
),
cx,
));
@@ -77,6 +78,7 @@ fn announcement_rows(
.as_deref()
.map(SharedString::from)
.unwrap_or_else(|| SharedString::from("-")),
cx,
),
cx,
));
@@ -102,13 +104,13 @@ fn announcement_rows(
}
if let Some(upstream) = &announcement.upstream {
rows.push(row("Upstream", text(upstream.display()), cx));
rows.push(row("Upstream", text(upstream.display(), cx), cx));
}
if !announcement.hashtags.is_empty() {
rows.push(row(
"Hashtags",
text(SharedString::from(announcement.hashtags.join(", "))),
text(SharedString::from(announcement.hashtags.join(", ")), cx),
cx,
));
}
@@ -154,8 +156,7 @@ fn row(label: &'static str, value: AnyElement, cx: &App) -> AnyElement {
.min_w_0()
.child(
div()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.typeset(TextRole::Caption2, cx)
.text_color(cx.theme().colors.muted_foreground)
.child(label),
)
@@ -163,12 +164,12 @@ fn row(label: &'static str, value: AnyElement, cx: &App) -> AnyElement {
.into_any_element()
}
fn text<T>(value: T) -> AnyElement
fn text<T>(value: T, cx: &App) -> AnyElement
where
T: Into<SharedString>,
{
div()
.text_sm()
.typeset(TextRole::Body, cx)
.w_full()
.min_w_0()
.child(value.into())
@@ -183,7 +184,7 @@ fn copy_value(id: &'static str, value: String, cx: &App) -> AnyElement {
.child(
div()
.font_family(cx.theme().mono_font)
.text_xs()
.typeset(TextRole::Caption, cx)
.min_w_0()
.child(SharedString::from(value.clone())),
)
@@ -220,7 +221,7 @@ fn maintainers(
.overflow_hidden()
.whitespace_nowrap()
.text_ellipsis()
.text_sm()
.typeset(TextRole::Body, cx)
.child(name),
)
.into_any_element()
@@ -247,7 +248,7 @@ fn list(id: &'static str, items: impl IntoIterator<Item = String>, cx: &App) ->
.min_w_0()
.whitespace_nowrap()
.text_ellipsis()
.text_sm()
.typeset(TextRole::Body, cx)
.child(SharedString::from(middle_truncate(&item, 28, 16))),
)
.child(ClipboardButton::new(
+2 -2
View File
@@ -12,7 +12,7 @@ use gpui_native_kit::field::Field;
use gpui_native_kit::icons::{Icon, IconRole};
use gpui_native_kit::input::{Input, InputState};
use gpui_native_kit::layout::dock::DockState;
use gpui_native_kit::theme::ActiveTheme as _;
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
use gpui_native_kit::tooltip::Tooltip;
use settings::SettingsStore;
use signed_state::{Backend, CheckoutsStore};
@@ -166,7 +166,7 @@ impl Render for CreateRepoDialog {
.gap_3()
.child(
div()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().colors.muted_foreground)
.child("Publish a new repository to your grasp servers."),
)
@@ -8,7 +8,7 @@ use gpui_native_kit::common::{h_flex, v_flex};
use gpui_native_kit::icons::{Icon, IconRole};
use gpui_native_kit::input::{Input, InputState};
use gpui_native_kit::switch::Switch;
use gpui_native_kit::theme::ActiveTheme as _;
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
use gpui_native_kit::tooltip::Tooltip;
use nostr::prelude::RelayUrl;
use settings::{DEFAULT_GRASP_SERVERS, GraspServersSettings};
@@ -72,7 +72,7 @@ pub fn grasp_servers_field(
h_flex()
.justify_between()
.items_center()
.child(div().text_sm().child("Grasp servers"))
.child(div().typeset(TextRole::Body, cx).child("Grasp servers"))
.child(
Switch::new("grasp-servers-toggle")
.checked(servers_enabled)
@@ -88,7 +88,7 @@ pub fn grasp_servers_field(
section
.child(
div()
.text_xs()
.typeset(TextRole::Caption, cx)
.text_color(cx.theme().colors.muted_foreground)
.child("Where the repository is hosted"),
)
@@ -122,7 +122,7 @@ pub fn grasp_servers_field(
.when(loading_servers, |section| {
section.child(
div()
.text_xs()
.typeset(TextRole::Caption, cx)
.text_color(cx.theme().colors.muted_foreground)
.child("Loading your grasp servers..."),
)
@@ -130,7 +130,7 @@ pub fn grasp_servers_field(
.when_some(error, |section, error| {
section.child(
div()
.text_xs()
.typeset(TextRole::Caption, cx)
.text_color(cx.theme().ramps.destructive.base)
.child(error),
)
@@ -156,7 +156,7 @@ fn render_server_row(
.px_2()
.bg(cx.theme().colors.muted)
.text_color(cx.theme().colors.muted_foreground)
.text_sm()
.typeset(TextRole::Body, cx)
.rounded(cx.theme().radius.control)
.child(server_host(relay)),
)
+3 -3
View File
@@ -12,7 +12,7 @@ use gpui_native_kit::field::Field;
use gpui_native_kit::icons::{Icon, IconRole};
use gpui_native_kit::input::{Input, InputState};
use gpui_native_kit::select::{Select, SelectOption};
use gpui_native_kit::theme::ActiveTheme as _;
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
use settings::SettingsStore;
use signed_core::RepoAddr;
use signed_git::Repo;
@@ -181,7 +181,7 @@ impl Render for InitRepoDialog {
.gap_3()
.child(
div()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().colors.muted_foreground)
.child("Publish this local repository to Nostr."),
)
@@ -204,7 +204,7 @@ impl Render for InitRepoDialog {
.w_full()
.px_2()
.bg(cx.theme().colors.muted)
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().colors.muted_foreground)
.rounded(cx.theme().radius.control)
.child(folder.clone()),
+4 -4
View File
@@ -5,7 +5,7 @@ use gpui::{
use gpui_native_kit::button::{Button, ButtonVariant};
use gpui_native_kit::common::v_flex;
use gpui_native_kit::dialog::Dialog;
use gpui_native_kit::theme::ActiveTheme as _;
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
use signed_state::RepoStore;
use crate::shared::dialogs::{close_global, open_global};
@@ -40,7 +40,7 @@ impl Render for ResetRemoteDialog {
.gap_2()
.child(
div()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().colors.muted_foreground)
.child(
"Grasp servers are overwritten to match the local mirror. Refs that do not exist locally are deleted from the servers. This cannot be undone.",
@@ -48,7 +48,7 @@ impl Render for ResetRemoteDialog {
)
.child(if deleted.is_empty() {
div()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().colors.muted_foreground)
.child("No server refs will be deleted.")
.into_any_element()
@@ -57,7 +57,7 @@ impl Render for ResetRemoteDialog {
.gap_1()
.children(deleted.iter().map(|name| {
div()
.text_sm()
.typeset(TextRole::Body, cx)
.font_family(cx.theme().mono_font)
.child(name.clone())
}))
+4 -5
View File
@@ -12,7 +12,7 @@ use gpui_native_kit::data::tree::{Tree, TreeItem};
use gpui_native_kit::editor::code::CodeViewState;
use gpui_native_kit::editor::markdown::MarkdownViewState;
use gpui_native_kit::icons::{Icon, IconRole};
use gpui_native_kit::theme::ActiveTheme as _;
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
use signed_git::{FileCommit, Repo, WorktreeSnapshot};
use super::helpers::{code_language, is_markdown_path, preview_spinner, source_hash};
@@ -355,8 +355,7 @@ impl RepoFilesView {
.text_color(cx.theme().colors.muted_foreground)
.child(
div()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.typeset(TextRole::Caption2, cx)
.text_ellipsis()
.whitespace_nowrap()
.child(pane_title),
@@ -368,14 +367,14 @@ impl RepoFilesView {
.gap_1()
.child(
div()
.text_xs()
.typeset(TextRole::Caption, cx)
.font_family(cx.theme().mono_font)
.child(commit.id.clone()),
)
.child(
div()
.max_w(px(250.))
.text_xs()
.typeset(TextRole::Caption, cx)
.text_ellipsis()
.whitespace_nowrap()
.child(commit.summary.clone()),
+17 -11
View File
@@ -15,7 +15,7 @@ use gpui_native_kit::dropdown_menu::DropdownMenu;
use gpui_native_kit::icons::{Icon, IconRole};
use gpui_native_kit::menu::MenuItem;
use gpui_native_kit::popover::Popover;
use gpui_native_kit::theme::ActiveTheme as _;
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
use gpui_native_kit::tooltip::Tooltip;
use signed_state::{Backend, Nip34Kind};
@@ -211,14 +211,14 @@ impl RepoDetailView {
.child(
h_flex()
.gap_2()
.font_weight(gpui::FontWeight::SEMIBOLD)
.typeset(TextRole::Headline, cx)
.child(avatar)
.child(name),
)
.child(
div()
.min_w_0()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().colors.muted_foreground)
.line_clamp(2)
.child(description),
@@ -231,9 +231,8 @@ impl RepoDetailView {
.gap_1()
.child(
div()
.text_xs()
.typeset(TextRole::Caption2, cx)
.text_color(cx.theme().colors.muted_foreground)
.font_weight(gpui::FontWeight::SEMIBOLD)
.child("Maintainers:"),
)
.child(self.render_maintainers(cx)),
@@ -458,18 +457,20 @@ impl RepoDetailView {
"Clone with ngit",
"copy-ngit",
&ngit_for_popover,
cx,
))
.child(clone_group(
"Clone with nak",
"copy-nak",
&nak_for_popover,
cx,
))
.child(
v_flex()
.gap_1()
.child(
div()
.text_xs()
.typeset(TextRole::Caption, cx)
.text_color(
cx.theme().colors.muted_foreground,
)
@@ -478,7 +479,7 @@ impl RepoDetailView {
.when(git_for_popover.is_empty(), |this| {
this.child(
div()
.text_xs()
.typeset(TextRole::Caption, cx)
.child("No git clone urls."),
)
})
@@ -572,14 +573,14 @@ impl RepoDetailView {
.child(
h_flex()
.gap_2()
.font_weight(gpui::FontWeight::SEMIBOLD)
.typeset(TextRole::Headline, cx)
.child(avatar)
.child(name),
)
.child(
div()
.min_w_0()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().colors.muted_foreground)
.child(path),
),
@@ -651,12 +652,17 @@ impl RepoDetailView {
.picture(owner.picture())
.small(),
)
.child(div().text_xs().whitespace_nowrap().child(owner_name)),
.child(
div()
.typeset(TextRole::Caption, cx)
.whitespace_nowrap()
.child(owner_name),
),
)
.when(!rest.is_empty(), |this| {
this.child(
div()
.text_xs()
.typeset(TextRole::Caption, cx)
.text_color(cx.theme().colors.muted_foreground)
.child(SharedString::from(format!("+{}", rest.len()))),
)
+21 -13
View File
@@ -14,7 +14,7 @@ use gpui_native_kit::combobox::ComboboxState;
use gpui_native_kit::common::{Sizable as _, h_flex, v_flex};
use gpui_native_kit::icons::Icon;
use gpui_native_kit::menu::MenuItem;
use gpui_native_kit::theme::ActiveTheme as _;
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
use metadata::ProfileDirectory;
use nostr::nips::nip19::Nip19Coordinate;
use nostr::prelude::{RelayUrl, ToBech32};
@@ -117,10 +117,19 @@ impl ShareTargets {
}
}
pub(super) fn clone_group(label: &str, id: &'static str, command: &SharedString) -> AnyElement {
pub(super) fn clone_group(
label: &str,
id: &'static str,
command: &SharedString,
cx: &App,
) -> AnyElement {
v_flex()
.gap_1()
.child(div().text_xs().child(SharedString::from(label)))
.child(
div()
.typeset(TextRole::Caption, cx)
.child(SharedString::from(label)),
)
.child(ClipboardButton::new(id, command.clone()))
.into_any_element()
}
@@ -170,9 +179,9 @@ pub(super) fn fork_row(
let row = h_flex()
.gap_1()
.min_w_0()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().colors.muted_foreground)
.child(Icon::named(CustomIconName::GitBranch).size(px(14.)))
.child(Icon::named(CustomIconName::GitBranch).small())
.child(div().whitespace_nowrap().text_ellipsis().child(label));
Some(if clickable {
@@ -253,7 +262,7 @@ pub(super) fn bound_repo_label(
h_flex()
.flex_shrink_0()
.gap_2()
.text_sm()
.typeset(TextRole::Body, cx)
.child("Initialized by")
.text_color(cx.theme().colors.muted_foreground)
.when_some(profile, |this, profile| {
@@ -274,8 +283,7 @@ pub(super) fn bound_repo_label(
.when_some(binding.identifier.as_deref(), |this, ident| {
this.child(
div()
.text_xs()
.font_weight(gpui::FontWeight::SEMIBOLD)
.typeset(TextRole::Caption2, cx)
.child(SharedString::from(format!("/{ident}"))),
)
})
@@ -361,7 +369,7 @@ pub(super) fn render_diff_row(hunks: &[DiffHunk], row: DiffRow, cx: &App) -> Any
.w_full()
.h(px(DIFF_ROW_HEIGHT))
.font_family(cx.theme().mono_font)
.text_xs()
.typeset(TextRole::Caption, cx)
.bg(cx.theme().colors.muted)
.border_y_1()
.border_color(cx.theme().colors.border)
@@ -387,7 +395,7 @@ fn render_diff_line(line: &DiffLine, cx: &App) -> AnyElement {
.w_full()
.h(px(DIFF_ROW_HEIGHT))
.font_family(cx.theme().mono_font)
.text_xs()
.typeset(TextRole::Caption, cx)
.when_some(bg, |this, bg| this.bg(bg))
.child(
div()
@@ -447,7 +455,7 @@ pub(crate) fn commit_row(
.child(
div()
.font_family(cx.theme().mono_font)
.text_xs()
.typeset(TextRole::Caption, cx)
.text_color(cx.theme().colors.muted_foreground)
.child(commit.id.clone()),
)
@@ -455,7 +463,7 @@ pub(crate) fn commit_row(
div()
.flex_1()
.min_w_0()
.text_sm()
.typeset(TextRole::Body, cx)
.text_ellipsis()
.whitespace_nowrap()
.child(commit.summary.clone()),
@@ -464,7 +472,7 @@ pub(crate) fn commit_row(
.child(
h_flex()
.gap_2()
.text_xs()
.typeset(TextRole::Caption, cx)
.text_color(cx.theme().colors.muted_foreground)
.child(commit.author.clone())
.child(relative_time_secs(commit.time)),
+2 -2
View File
@@ -10,7 +10,7 @@ use gpui_native_kit::common::v_flex;
use gpui_native_kit::layout::dock::DockState;
use gpui_native_kit::scrollbar::Scrollbar;
use gpui_native_kit::spinner::Spinner;
use gpui_native_kit::theme::ActiveTheme as _;
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
use signed_git::{CommitList, Repo};
use signed_state::RepoStore;
@@ -190,7 +190,7 @@ impl Render for RepoHistoryView {
div()
.py_2()
.w_full()
.text_xs()
.typeset(TextRole::Caption, cx)
.text_color(cx.theme().colors.muted_foreground)
.child(format!("Showing {shown} of {total} commits")),
)
+14 -14
View File
@@ -7,7 +7,7 @@ use gpui::prelude::FluentBuilder as _;
use gpui::{
AnyElement, App, AppContext as _, Context, Entity, InteractiveElement as _, IntoElement,
ParentElement as _, PathPromptOptions, Render, SharedString, Styled as _, Subscription, Task,
WeakEntity, Window, div, px,
WeakEntity, Window, div,
};
use gpui_native_kit::alert::{Alert, AlertSeverity};
use gpui_native_kit::badge::Badge;
@@ -16,7 +16,7 @@ use gpui_native_kit::common::{Sizable as _, h_flex, v_flex};
use gpui_native_kit::icons::{Icon, IconRole};
use gpui_native_kit::layout::dock::{DockState, Panel};
use gpui_native_kit::spinner::Spinner;
use gpui_native_kit::theme::ActiveTheme as _;
use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _};
use metadata::ProfileDirectory;
use nostr::prelude::{PublicKey, Url};
use signed_core::{Announcement, RepoAddr};
@@ -854,7 +854,7 @@ impl RepoDetailView {
.child(
h_flex()
.gap_2()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().colors.muted_foreground)
.child(Badge::new("ready-branch", status.branch.clone()))
.child(commits)
@@ -939,7 +939,7 @@ impl RepoDetailView {
.child(
h_flex()
.gap_2()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().colors.muted_foreground)
.child(Badge::new("push-branch", status.branch.clone()))
.child(commits)
@@ -1008,7 +1008,7 @@ impl RepoDetailView {
.child(
h_flex()
.gap_2()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().colors.muted_foreground)
.child(Badge::new("sync-branch", branch))
.child(commits)
@@ -1059,22 +1059,22 @@ impl RepoDetailView {
match status {
PushStepStatus::Running(_) => h_flex()
.gap_2()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().colors.muted_foreground)
.child(Spinner::new("push-step"))
.child(label)
.into_any_element(),
PushStepStatus::Done(_) => h_flex()
.gap_2()
.text_sm()
.child(Icon::named(IconRole::Check).size(px(14.)))
.typeset(TextRole::Body, cx)
.child(Icon::named(IconRole::Check).small())
.child(label)
.into_any_element(),
PushStepStatus::Failed(_, reason) => h_flex()
.gap_2()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().ramps.destructive.base)
.child(Icon::named(IconRole::Close).size(px(14.)))
.child(Icon::named(IconRole::Close).small())
.child(SharedString::from(format!(
"{}: {reason}",
status.step().label()
@@ -1090,7 +1090,7 @@ impl RepoDetailView {
.gap_1()
.w_full()
.bg(cx.theme().colors.muted)
.child(div().text_sm().child("Pushing"))
.child(div().typeset(TextRole::Body, cx).child("Pushing"))
.children(steps)
.into_any_element(),
)
@@ -1115,12 +1115,12 @@ impl RepoDetailView {
.min_w_0()
.flex_1()
.items_start()
.child(Icon::named(IconRole::Warning).size(px(14.)))
.child(Icon::named(IconRole::Warning).small())
.child(
div()
.flex_1()
.min_w_0()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().ramps.warning.base)
.child(SharedString::from(warning)),
),
@@ -1174,7 +1174,7 @@ impl RepoDetailView {
.child(Spinner::new("repo-loading"))
.child(
div()
.text_sm()
.typeset(TextRole::Body, cx)
.text_color(cx.theme().colors.muted_foreground)
.child(label),
)