extract workspace crates and switch to gpui-native-kit
Rust / build (macos-latest, stable) (push) Waiting to run
Rust / build (ubuntu-latest, stable) (push) Waiting to run
Rust / build (windows-latest, stable) (push) Waiting to run
Rust / build (macos-latest, stable) (pull_request) Waiting to run
Rust / build (ubuntu-latest, stable) (pull_request) Waiting to run
Rust / build (windows-latest, stable) (pull_request) Waiting to run

This commit is contained in:
2026-11-11 19:04:36 +07:00
parent 2124b00590
commit c32030cf21
18 changed files with 1343 additions and 4007 deletions
+47
View File
@@ -0,0 +1,47 @@
use gpui::prelude::FluentBuilder as _;
use gpui::{
AnyView, App, Context, Entity, Global, IntoElement, ParentElement as _, Render, Styled as _,
Window, div,
};
struct GlobalDialogHost(Entity<DialogHost>);
impl Global for GlobalDialogHost {}
/// Owns the modal currently mounted at the window root.
pub struct DialogHost {
open: Option<AnyView>,
}
impl DialogHost {
pub fn new(_cx: &mut Context<Self>) -> Self {
Self { open: None }
}
pub fn set_global(entity: Entity<Self>, cx: &mut App) {
cx.set_global(GlobalDialogHost(entity));
}
pub fn global(cx: &App) -> Entity<Self> {
cx.global::<GlobalDialogHost>().0.clone()
}
pub fn open(&mut self, view: AnyView, cx: &mut Context<Self>) {
self.open = Some(view);
cx.notify();
}
pub fn close(&mut self, cx: &mut Context<Self>) {
self.open = None;
cx.notify();
}
}
impl Render for DialogHost {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div()
.absolute()
.inset_0()
.when_some(self.open.clone(), |host, view| host.child(view))
}
}