chore: Upgrade GPUI and fix action API changes. (#1008)

Ref https://github.com/zed-industries/zed/pull/33263
This commit is contained in:
Jason Lee 2025-06-25 11:06:12 +08:00 committed by GitHub
parent ed0887420f
commit 67f0ffbc9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 85 additions and 90 deletions

28
Cargo.lock generated
View file

@ -724,7 +724,7 @@ dependencies = [
"bitflags 2.9.1", "bitflags 2.9.1",
"cexpr", "cexpr",
"clang-sys", "clang-sys",
"itertools 0.11.0", "itertools 0.10.5",
"lazy_static", "lazy_static",
"lazycell", "lazycell",
"log", "log",
@ -747,7 +747,7 @@ dependencies = [
"bitflags 2.9.1", "bitflags 2.9.1",
"cexpr", "cexpr",
"clang-sys", "clang-sys",
"itertools 0.11.0", "itertools 0.10.5",
"log", "log",
"prettyplease", "prettyplease",
"proc-macro2", "proc-macro2",
@ -1417,7 +1417,7 @@ dependencies = [
[[package]] [[package]]
name = "collections" name = "collections"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed.git#a067c16c823354da63966273ac15d1aa93c0e922" source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5"
dependencies = [ dependencies = [
"indexmap 2.9.0", "indexmap 2.9.0",
"rustc-hash 2.1.0", "rustc-hash 2.1.0",
@ -1975,7 +1975,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.git#a067c16c823354da63966273ac15d1aa93c0e922" source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -3121,7 +3121,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui" name = "gpui"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed.git#a067c16c823354da63966273ac15d1aa93c0e922" source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"as-raw-xcb-connection", "as-raw-xcb-connection",
@ -3304,7 +3304,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.git#a067c16c823354da63966273ac15d1aa93c0e922" source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5"
dependencies = [ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
@ -3574,7 +3574,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.git#a067c16c823354da63966273ac15d1aa93c0e922" source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -3591,7 +3591,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.git#a067c16c823354da63966273ac15d1aa93c0e922" source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5"
dependencies = [ dependencies = [
"rustls", "rustls",
"rustls-platform-verifier", "rustls-platform-verifier",
@ -4417,7 +4417,7 @@ dependencies = [
[[package]] [[package]]
name = "media" name = "media"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed.git#a067c16c823354da63966273ac15d1aa93c0e922" source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bindgen 0.71.1", "bindgen 0.71.1",
@ -6322,7 +6322,7 @@ dependencies = [
[[package]] [[package]]
name = "refineable" name = "refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed.git#a067c16c823354da63966273ac15d1aa93c0e922" source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5"
dependencies = [ dependencies = [
"derive_refineable", "derive_refineable",
"workspace-hack", "workspace-hack",
@ -6477,7 +6477,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.git#a067c16c823354da63966273ac15d1aa93c0e922" source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -7052,7 +7052,7 @@ checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a"
[[package]] [[package]]
name = "semantic_version" name = "semantic_version"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed.git#a067c16c823354da63966273ac15d1aa93c0e922" source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"serde", "serde",
@ -7634,7 +7634,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.git#a067c16c823354da63966273ac15d1aa93c0e922" source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"log", "log",
@ -8862,7 +8862,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]] [[package]]
name = "util" name = "util"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed.git#a067c16c823354da63966273ac15d1aa93c0e922" source = "git+https://github.com/zed-industries/zed.git#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-fs 2.1.2", "async-fs 2.1.2",

View file

@ -11,11 +11,10 @@ use gpui_component::{
use serde::Deserialize; use serde::Deserialize;
use story::Assets; use story::Assets;
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = example, no_json)]
struct ChangeSize(Size); struct ChangeSize(Size);
impl_internal_actions!(example, [ChangeSize]);
pub struct Example { pub struct Example {
layout: Axis, layout: Axis,
bordered: bool, bordered: bool,

View file

@ -16,13 +16,14 @@ use story::{
SwitchStory, TableStory, TooltipStory, WebViewStory, SwitchStory, TableStory, TooltipStory, WebViewStory,
}; };
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)]
pub struct AddPanel(DockPlacement); pub struct AddPanel(DockPlacement);
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)]
pub struct TogglePanelVisible(SharedString); pub struct TogglePanelVisible(SharedString);
impl_internal_actions!(story, [AddPanel, TogglePanelVisible]);
actions!(story, [ToggleDockToggleButton]); actions!(story, [ToggleDockToggleButton]);
const MAIN_DOCK_AREA: DockAreaTab = DockAreaTab { const MAIN_DOCK_AREA: DockAreaTab = DockAreaTab {

View file

@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
use story::{Assets, ButtonStory, IconStory, StoryContainer}; use story::{Assets, ButtonStory, IconStory, StoryContainer};
actions!(main_menu, [Quit]); actions!(story, [Quit]);
const TILES_DOCK_AREA: DockAreaTab = DockAreaTab { const TILES_DOCK_AREA: DockAreaTab = DockAreaTab {
id: "story-tiles", id: "story-tiles",

View file

@ -12,7 +12,7 @@ use gpui_component::{
use crate::section; use crate::section;
actions!(button_story, [Disabled, Loading, Selected, Compact]); actions!(story, [Disabled, Loading, Selected, Compact]);
pub struct ButtonStory { pub struct ButtonStory {
focus_handle: gpui::FocusHandle, focus_handle: gpui::FocusHandle,

View file

@ -22,7 +22,7 @@ use gpui_component::{
use crate::section; use crate::section;
actions!(modal_story, [TestAction]); actions!(story, [TestAction]);
pub struct ListItemDeletegate { pub struct ListItemDeletegate {
story: WeakEntity<DrawerStory>, story: WeakEntity<DrawerStory>,

View file

@ -11,7 +11,7 @@ use gpui_component::{
use crate::section; use crate::section;
actions!(dropdown_story, [Tab, TabPrev]); actions!(story, [Tab, TabPrev]);
const CONTEXT: &str = "DropdownStory"; const CONTEXT: &str = "DropdownStory";
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {

View file

@ -15,7 +15,7 @@ use gpui_component::{
v_flex, AxisExt, FocusableCycle, Selectable, Sizable, Size, v_flex, AxisExt, FocusableCycle, Selectable, Sizable, Size,
}; };
actions!(input_story, [Tab, TabPrev]); actions!(story, [Tab, TabPrev]);
pub struct FormStory { pub struct FormStory {
name_input: Entity<InputState>, name_input: Entity<InputState>,

View file

@ -11,7 +11,7 @@ use gpui_component::{
v_flex, ContextModal, FocusableCycle, Icon, IconName, Sizable, v_flex, ContextModal, FocusableCycle, Icon, IconName, Sizable,
}; };
actions!(input_story, [Tab, TabPrev]); actions!(story, [Tab, TabPrev]);
const CONTEXT: &str = "InputStory"; const CONTEXT: &str = "InputStory";

View file

@ -43,8 +43,8 @@ mod welcome_story;
pub use assets::Assets; pub use assets::Assets;
use gpui::{ use gpui::{
actions, div, impl_internal_actions, prelude::FluentBuilder as _, px, rems, size, AnyElement, actions, div, prelude::FluentBuilder as _, px, rems, size, Action, AnyElement, AnyView, App,
AnyView, App, AppContext, Bounds, Context, Div, Entity, EventEmitter, Focusable, Global, Hsla, AppContext, Bounds, Context, Div, Entity, EventEmitter, Focusable, Global, Hsla,
InteractiveElement, IntoElement, KeyBinding, Menu, MenuItem, ParentElement, Render, RenderOnce, InteractiveElement, IntoElement, KeyBinding, Menu, MenuItem, ParentElement, Render, RenderOnce,
SharedString, StatefulInteractiveElement, Styled, Window, WindowBounds, WindowKind, SharedString, StatefulInteractiveElement, Styled, Window, WindowBounds, WindowKind,
WindowOptions, WindowOptions,
@ -105,23 +105,22 @@ use gpui_component::{
v_flex, ActiveTheme, ContextModal, IconName, Root, TitleBar, v_flex, ActiveTheme, ContextModal, IconName, Root, TitleBar,
}; };
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)]
pub struct SelectScrollbarShow(ScrollbarShow); pub struct SelectScrollbarShow(ScrollbarShow);
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)]
pub struct SelectLocale(SharedString); pub struct SelectLocale(SharedString);
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)]
pub struct SelectFont(usize); pub struct SelectFont(usize);
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)]
pub struct SelectRadius(usize); pub struct SelectRadius(usize);
impl_internal_actions!(
story,
[SelectLocale, SelectFont, SelectRadius, SelectScrollbarShow]
);
actions!(story, [Quit, Open, CloseWindow, ToggleSearch]); actions!(story, [Quit, Open, CloseWindow, ToggleSearch]);
const PANEL_NAME: &str = "StoryContainer"; const PANEL_NAME: &str = "StoryContainer";

View file

@ -16,7 +16,7 @@ use gpui_component::{
v_flex, ActiveTheme, Sizable, v_flex, ActiveTheme, Sizable,
}; };
actions!(list_story, [SelectedCompany]); actions!(story, [SelectedCompany]);
#[derive(Clone, Default)] #[derive(Clone, Default)]
struct Company { struct Company {

View file

@ -1,7 +1,7 @@
use gpui::{ use gpui::{
actions, div, impl_internal_actions, px, App, AppContext, Context, Corner, Entity, FocusHandle, actions, div, px, Action, App, AppContext, Context, Corner, Entity, FocusHandle, Focusable,
Focusable, InteractiveElement, IntoElement, KeyBinding, ParentElement as _, Render, InteractiveElement, IntoElement, KeyBinding, ParentElement as _, Render, SharedString,
SharedString, Styled as _, Window, Styled as _, Window,
}; };
use gpui_component::{ use gpui_component::{
button::Button, context_menu::ContextMenuExt, h_flex, popup_menu::PopupMenuExt as _, v_flex, button::Button, context_menu::ContextMenuExt, h_flex, popup_menu::PopupMenuExt as _, v_flex,
@ -11,11 +11,11 @@ use serde::Deserialize;
use crate::section; use crate::section;
#[derive(Clone, PartialEq, Deserialize)] #[derive(Action, Clone, PartialEq, Deserialize)]
#[action(namespace = story, no_json)]
struct Info(usize); struct Info(usize);
actions!(popover_story, [Copy, Paste, Cut, SearchAll, ToggleCheck]); actions!(story, [Copy, Paste, Cut, SearchAll, ToggleCheck]);
impl_internal_actions!(popover_story, [Info]);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.bind_keys([ cx.bind_keys([

View file

@ -17,7 +17,7 @@ use gpui_component::{
}; };
use crate::section; use crate::section;
actions!(modal_story, [TestAction]); actions!(story, [TestAction]);
pub struct ModalStory { pub struct ModalStory {
focus_handle: FocusHandle, focus_handle: FocusHandle,

View file

@ -11,7 +11,7 @@ use gpui_component::{
v_flex, FocusableCycle, IconName, Sizable, v_flex, FocusableCycle, IconName, Sizable,
}; };
actions!(input_story, [Tab, TabPrev]); actions!(story, [Tab, TabPrev]);
const CONTEXT: &str = "NumberInputStory"; const CONTEXT: &str = "NumberInputStory";

View file

@ -11,7 +11,7 @@ use gpui_component::{
}; };
use crate::section; use crate::section;
actions!(input_story, [Tab, TabPrev]); actions!(story, [Tab, TabPrev]);
const CONTEXT: &str = "OtpInputStory"; const CONTEXT: &str = "OtpInputStory";

View file

@ -1,7 +1,7 @@
use gpui::{ use gpui::{
actions, div, impl_internal_actions, px, App, AppContext, Context, Corner, DismissEvent, actions, div, px, Action, App, AppContext, Context, Corner, DismissEvent, Element, Entity,
Element, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, KeyBinding, MouseButton,
KeyBinding, MouseButton, ParentElement as _, Render, Styled as _, Window, ParentElement as _, Render, Styled as _, Window,
}; };
use gpui_component::{ use gpui_component::{
button::{Button, ButtonVariants as _}, button::{Button, ButtonVariants as _},
@ -13,11 +13,11 @@ use gpui_component::{
}; };
use serde::Deserialize; use serde::Deserialize;
#[derive(Clone, PartialEq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)]
struct Info(usize); struct Info(usize);
actions!(popover_story, [Copy, Paste, Cut, SearchAll, ToggleCheck]); actions!(story, [Copy, Paste, Cut, SearchAll, ToggleCheck]);
impl_internal_actions!(popover_story, [Info]);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.bind_keys([ cx.bind_keys([

View file

@ -1,8 +1,8 @@
use std::collections::HashMap; use std::collections::HashMap;
use gpui::{ use gpui::{
div, impl_internal_actions, prelude::FluentBuilder, relative, App, AppContext, ClickEvent, div, prelude::FluentBuilder, relative, Action, App, AppContext, ClickEvent, Context, Entity,
Context, Entity, Focusable, IntoElement, ParentElement, Render, SharedString, Styled, Window, Focusable, IntoElement, ParentElement, Render, SharedString, Styled, Window,
}; };
use gpui_component::{ use gpui_component::{
@ -21,11 +21,10 @@ use gpui_component::{
}; };
use serde::Deserialize; use serde::Deserialize;
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)]
pub struct SelectCompany(SharedString); pub struct SelectCompany(SharedString);
impl_internal_actions!(sidebar_story, [SelectCompany]);
pub struct SidebarStory { pub struct SidebarStory {
active_items: HashMap<Item, bool>, active_items: HashMap<Item, bool>,
last_active_item: Item, last_active_item: Item,

View file

@ -5,9 +5,9 @@ use std::{
use fake::{Fake, Faker}; use fake::{Fake, Faker};
use gpui::{ use gpui::{
div, impl_internal_actions, prelude::FluentBuilder as _, px, AnyElement, App, AppContext, div, prelude::FluentBuilder as _, px, Action, AnyElement, App, AppContext, ClickEvent, Context,
ClickEvent, Context, Edges, Entity, Focusable, InteractiveElement, IntoElement, ParentElement, Edges, Entity, Focusable, InteractiveElement, IntoElement, ParentElement, Pixels, Render,
Pixels, Render, SharedString, StatefulInteractiveElement, Styled, Timer, Window, SharedString, StatefulInteractiveElement, Styled, Timer, Window,
}; };
use gpui_component::{ use gpui_component::{
button::Button, button::Button,
@ -23,14 +23,14 @@ use gpui_component::{
}; };
use serde::Deserialize; use serde::Deserialize;
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)]
struct ChangeSize(Size); struct ChangeSize(Size);
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)]
struct OpenDetail(usize); struct OpenDetail(usize);
impl_internal_actions!(table_story, [ChangeSize, OpenDetail]);
#[derive(Clone, Debug, Default)] #[derive(Clone, Debug, Default)]
struct Stock { struct Stock {
id: usize, id: usize,

View file

@ -11,7 +11,7 @@ use gpui_component::{
v_flex, FocusableCycle, Sizable, v_flex, FocusableCycle, Sizable,
}; };
actions!(input_story, [Tab, TabPrev]); actions!(story, [Tab, TabPrev]);
const CONTEXT: &str = "TextareaStory"; const CONTEXT: &str = "TextareaStory";

View file

@ -8,7 +8,7 @@ use gpui_component::{
h_flex, v_flex, IconName, Sizable, h_flex, v_flex, IconName, Sizable,
}; };
actions!(button_story, [Disabled, Loading, Selected, Compact]); actions!(story, [Disabled, Loading, Selected, Compact]);
pub struct ToggleStory { pub struct ToggleStory {
focus_handle: gpui::FocusHandle, focus_handle: gpui::FocusHandle,

View file

@ -16,7 +16,7 @@ use gpui_component::{
use crate::{section, Story}; use crate::{section, Story};
actions!(tooltip, [Info]); actions!(story, [Info]);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.bind_keys([KeyBinding::new("ctrl-shift-delete", Info, Some("Tooltip"))]); cx.bind_keys([KeyBinding::new("ctrl-shift-delete", Info, Some("Tooltip"))]);

View file

@ -1,11 +1,11 @@
use gpui::{actions, impl_internal_actions}; use gpui::{actions, Action};
use serde::Deserialize; use serde::Deserialize;
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Clone, Action, PartialEq, Eq, Deserialize)]
#[action(namespace = list, no_json)]
pub struct Confirm { pub struct Confirm {
/// Is confirm with secondary. /// Is confirm with secondary.
pub secondary: bool, pub secondary: bool,
} }
actions!(list, [Cancel, SelectPrev, SelectNext]); actions!(list, [Cancel, SelectPrev, SelectNext]);
impl_internal_actions!(list, [Confirm]);

View file

@ -2,6 +2,7 @@
//! //!
//! Based on the `Input` example from the `gpui` crate. //! Based on the `Input` example from the `gpui` crate.
//! https://github.com/zed-industries/zed/blob/main/crates/gpui/examples/input.rs //! https://github.com/zed-industries/zed/blob/main/crates/gpui/examples/input.rs
use gpui::Action;
use serde::Deserialize; use serde::Deserialize;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::cell::RefCell; use std::cell::RefCell;
@ -10,12 +11,11 @@ use std::rc::Rc;
use unicode_segmentation::*; use unicode_segmentation::*;
use gpui::{ use gpui::{
actions, div, impl_internal_actions, point, prelude::FluentBuilder as _, px, relative, App, actions, div, point, prelude::FluentBuilder as _, px, relative, App, AppContext, Bounds,
AppContext, Bounds, ClipboardItem, Context, Entity, EntityInputHandler, EventEmitter, ClipboardItem, Context, Entity, EntityInputHandler, EventEmitter, FocusHandle, Focusable,
FocusHandle, Focusable, InteractiveElement as _, IntoElement, KeyBinding, KeyDownEvent, InteractiveElement as _, IntoElement, KeyBinding, KeyDownEvent, MouseButton, MouseDownEvent,
MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement as _, Pixels, Point, MouseMoveEvent, MouseUpEvent, ParentElement as _, Pixels, Point, Render, ScrollHandle,
Render, ScrollHandle, ScrollWheelEvent, SharedString, Styled as _, Subscription, ScrollWheelEvent, SharedString, Styled as _, Subscription, UTF16Selection, Window, WrappedLine,
UTF16Selection, Window, WrappedLine,
}; };
// TODO: // TODO:
@ -34,14 +34,13 @@ use crate::input::hover_popover::DiagnosticPopover;
use crate::input::marker::Marker; use crate::input::marker::Marker;
use crate::{history::History, scroll::ScrollbarState, Root}; use crate::{history::History, scroll::ScrollbarState, Root};
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = input, no_json)]
pub struct Enter { pub struct Enter {
/// Is confirm with secondary. /// Is confirm with secondary.
pub secondary: bool, pub secondary: bool,
} }
impl_internal_actions!(input, [Enter]);
actions!( actions!(
input, input,
[ [

View file

@ -5,20 +5,19 @@ use crate::popup_menu::PopupMenuExt as _;
use crate::{h_flex, ActiveTheme, IconName, Selectable, Sizable, Size, StyledExt}; use crate::{h_flex, ActiveTheme, IconName, Selectable, Sizable, Size, StyledExt};
use gpui::prelude::FluentBuilder as _; use gpui::prelude::FluentBuilder as _;
use gpui::{ use gpui::{
div, impl_internal_actions, AnyElement, App, Corner, Div, Edges, ElementId, IntoElement, div, Action, AnyElement, App, Corner, Div, Edges, ElementId, IntoElement, ParentElement,
ParentElement, RenderOnce, ScrollHandle, Stateful, StatefulInteractiveElement as _, RenderOnce, ScrollHandle, Stateful, StatefulInteractiveElement as _, StyleRefinement, Styled,
StyleRefinement, Styled, Window, Window,
}; };
use gpui::{px, InteractiveElement}; use gpui::{px, InteractiveElement};
use smallvec::SmallVec; use smallvec::SmallVec;
use super::{Tab, TabVariant}; use super::{Tab, TabVariant};
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Action, Debug, Clone, Copy, PartialEq, Eq)]
#[action(namespace = tab_bar, no_json)]
pub struct SelectTab(usize); pub struct SelectTab(usize);
impl_internal_actions!(tab_bar, [SelectTab]);
#[derive(IntoElement)] #[derive(IntoElement)]
pub struct TabBar { pub struct TabBar {
base: Stateful<Div>, base: Stateful<Div>,

View file

@ -1,4 +1,4 @@
use gpui::{App, Entity, Window, impl_actions}; use gpui::{Action, App, Entity, Window};
use gpui_component::popup_menu::PopupMenu; use gpui_component::popup_menu::PopupMenu;
use rust_i18n::t; use rust_i18n::t;
use schemars::JsonSchema; use schemars::JsonSchema;
@ -7,7 +7,8 @@ use wef::{ContextMenuParams, Frame, LogicalUnit, Point};
use crate::WebView; use crate::WebView;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, JsonSchema)] #[derive(Action, Debug, Clone, Copy, PartialEq, Eq, Deserialize, JsonSchema)]
#[action(namespace = webview)]
pub(crate) enum ContextMenuAction { pub(crate) enum ContextMenuAction {
CopyLinkAddress, CopyLinkAddress,
Undo, Undo,
@ -22,8 +23,6 @@ pub(crate) enum ContextMenuAction {
Reload, Reload,
} }
impl_actions!(webview, [ContextMenuAction]);
pub(crate) struct ContextMenuInfo { pub(crate) struct ContextMenuInfo {
pub(crate) crood: Point<LogicalUnit<i32>>, pub(crate) crood: Point<LogicalUnit<i32>>,
pub(crate) frame: Frame, pub(crate) frame: Frame,