story: Fix #1017 duplicate action name error. (#1020)

This commit is contained in:
Jason Lee 2025-06-30 11:18:57 +08:00 committed by GitHub
parent 21dbaffcf4
commit deb1187c40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 164 additions and 100 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.10.5", "itertools 0.11.0",
"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.10.5", "itertools 0.11.0",
"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#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35"
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#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35"
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#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35"
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#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35"
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#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35"
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#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35"
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#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35"
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#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35"
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#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35"
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#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35"
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#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35"
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#aa330fcf2c4c1153d5c4f0408a4f6bfc145d94d5" source = "git+https://github.com/zed-industries/zed.git#c3d0230f89ff21257d965d4c410a274e52c4fe35"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-fs 2.1.2", "async-fs 2.1.2",

View file

@ -1,5 +1,5 @@
use gpui::{ use gpui::{
actions, prelude::FluentBuilder, px, App, AppContext as _, ClickEvent, Context, Entity, prelude::FluentBuilder, px, Action, App, AppContext as _, ClickEvent, Context, Entity,
Focusable, InteractiveElement, IntoElement, ParentElement as _, Render, Styled as _, Window, Focusable, InteractiveElement, IntoElement, ParentElement as _, Render, Styled as _, Window,
}; };
@ -9,10 +9,18 @@ use gpui_component::{
h_flex, indigo, v_flex, white, ActiveTheme, Disableable as _, Icon, IconName, Selectable as _, h_flex, indigo, v_flex, white, ActiveTheme, Disableable as _, Icon, IconName, Selectable as _,
Sizable as _, Theme, Sizable as _, Theme,
}; };
use serde::Deserialize;
use crate::section; use crate::section;
actions!(story, [Disabled, Loading, Selected, Compact]); #[derive(Clone, Action, PartialEq, Eq, Deserialize)]
#[action(namespace = button_story, no_json)]
enum ButtonAction {
Disabled,
Loading,
Selected,
Compact,
}
pub struct ButtonStory { pub struct ButtonStory {
focus_handle: gpui::FocusHandle, focus_handle: gpui::FocusHandle,
@ -100,10 +108,14 @@ impl Render for ButtonStory {
}); });
v_flex() v_flex()
.on_action(cx.listener(|this, _: &Disabled, _, _| this.disabled = !this.disabled)) .on_action(
.on_action(cx.listener(|this, _: &Loading, _, _| this.loading = !this.loading)) cx.listener(|this, action: &ButtonAction, _, _| match action {
.on_action(cx.listener(|this, _: &Selected, _, _| this.selected = !this.selected)) ButtonAction::Disabled => this.disabled = !this.disabled,
.on_action(cx.listener(|this, _: &Compact, _, _| this.compact = !this.compact)) ButtonAction::Loading => this.loading = !this.loading,
ButtonAction::Selected => this.selected = !this.selected,
ButtonAction::Compact => this.compact = !this.compact,
}),
)
.gap_6() .gap_6()
.child( .child(
h_flex() h_flex()
@ -697,10 +709,26 @@ impl Render for ButtonStory {
.button(Button::new("btn").label("Click Me")) .button(Button::new("btn").label("Click Me"))
.selected(selected) .selected(selected)
.popup_menu(move |this, _, _| { .popup_menu(move |this, _, _| {
this.menu("Disabled", Box::new(Disabled)) this.menu_with_check(
.menu("Loading", Box::new(Loading)) "Disabled",
.menu("Selected", Box::new(Selected)) disabled,
.menu("Compact", Box::new(Compact)) Box::new(ButtonAction::Disabled),
)
.menu_with_check(
"Loading",
loading,
Box::new(ButtonAction::Loading),
)
.menu_with_check(
"Selected",
selected,
Box::new(ButtonAction::Selected),
)
.menu_with_check(
"Compact",
compact,
Box::new(ButtonAction::Compact),
)
}), }),
) )
.child( .child(
@ -708,10 +736,26 @@ impl Render for ButtonStory {
.button(Button::new("btn").label("Click Me")) .button(Button::new("btn").label("Click Me"))
.selected(selected) .selected(selected)
.popup_menu(move |this, _, _| { .popup_menu(move |this, _, _| {
this.menu("Disabled", Box::new(Disabled)) this.menu_with_check(
.menu("Loading", Box::new(Loading)) "Disabled",
.menu("Selected", Box::new(Selected)) disabled,
.menu("Compact", Box::new(Compact)) Box::new(ButtonAction::Disabled),
)
.menu_with_check(
"Loading",
loading,
Box::new(ButtonAction::Loading),
)
.menu_with_check(
"Selected",
selected,
Box::new(ButtonAction::Selected),
)
.menu_with_check(
"Compact",
compact,
Box::new(ButtonAction::Compact),
)
}), }),
) )
.child( .child(
@ -720,10 +764,26 @@ impl Render for ButtonStory {
.button(Button::new("btn").label("Outline Dropdown")) .button(Button::new("btn").label("Outline Dropdown"))
.selected(selected) .selected(selected)
.popup_menu(move |this, _, _| { .popup_menu(move |this, _, _| {
this.menu("Disabled", Box::new(Disabled)) this.menu_with_check(
.menu("Loading", Box::new(Loading)) "Disabled",
.menu("Selected", Box::new(Selected)) disabled,
.menu("Compact", Box::new(Compact)) Box::new(ButtonAction::Disabled),
)
.menu_with_check(
"Loading",
loading,
Box::new(ButtonAction::Loading),
)
.menu_with_check(
"Selected",
selected,
Box::new(ButtonAction::Selected),
)
.menu_with_check(
"Compact",
compact,
Box::new(ButtonAction::Compact),
)
}), }),
) )
.child( .child(
@ -732,10 +792,26 @@ impl Render for ButtonStory {
.button(Button::new("btn").label("Ghost Dropdown")) .button(Button::new("btn").label("Ghost Dropdown"))
.selected(selected) .selected(selected)
.popup_menu(move |this, _, _| { .popup_menu(move |this, _, _| {
this.menu("Disabled", Box::new(Disabled)) this.menu_with_check(
.menu("Loading", Box::new(Loading)) "Disabled",
.menu("Selected", Box::new(Selected)) disabled,
.menu("Compact", Box::new(Compact)) Box::new(ButtonAction::Disabled),
)
.menu_with_check(
"Loading",
loading,
Box::new(ButtonAction::Loading),
)
.menu_with_check(
"Selected",
selected,
Box::new(ButtonAction::Selected),
)
.menu_with_check(
"Compact",
compact,
Box::new(ButtonAction::Compact),
)
}), }),
), ),
) )

View file

@ -13,7 +13,6 @@ use crate::section;
pub struct ColorPickerStory { pub struct ColorPickerStory {
color: Entity<ColorPickerState>, color: Entity<ColorPickerState>,
selected_color: Option<Hsla>, selected_color: Option<Hsla>,
_subscriptions: Vec<Subscription>, _subscriptions: Vec<Subscription>,
} }

View file

@ -2,9 +2,9 @@ use std::{sync::Arc, time::Duration};
use fake::Fake; use fake::Fake;
use gpui::{ use gpui::{
actions, div, prelude::FluentBuilder as _, px, App, AppContext, Context, Entity, FocusHandle, div, prelude::FluentBuilder as _, px, App, AppContext, Context, Entity, FocusHandle, Focusable,
Focusable, InteractiveElement as _, IntoElement, ParentElement, Render, SharedString, Styled, InteractiveElement as _, IntoElement, ParentElement, Render, SharedString, Styled, Task, Timer,
Task, Timer, WeakEntity, Window, WeakEntity, Window,
}; };
use raw_window_handle::HasWindowHandle; use raw_window_handle::HasWindowHandle;
@ -21,8 +21,7 @@ use gpui_component::{
}; };
use crate::section; use crate::section;
use crate::TestAction;
actions!(story, [TestAction]);
pub struct ListItemDeletegate { pub struct ListItemDeletegate {
story: WeakEntity<DrawerStory>, story: WeakEntity<DrawerStory>,

View file

@ -1,6 +1,6 @@
use gpui::{ use gpui::{
actions, px, App, AppContext, Context, Entity, Focusable, InteractiveElement, IntoElement, px, App, AppContext, Context, Entity, Focusable, InteractiveElement, IntoElement, KeyBinding,
KeyBinding, ParentElement, Render, SharedString, Styled, Window, ParentElement, Render, SharedString, Styled, Window,
}; };
use gpui_component::{ use gpui_component::{
@ -10,8 +10,7 @@ use gpui_component::{
}; };
use crate::section; use crate::section;
use crate::{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

@ -1,5 +1,5 @@
use gpui::{ use gpui::{
actions, div, prelude::FluentBuilder as _, App, AppContext, Axis, Context, Entity, Focusable, div, prelude::FluentBuilder as _, App, AppContext, Axis, Context, Entity, Focusable,
InteractiveElement, IntoElement, ParentElement as _, Render, Styled, Window, InteractiveElement, IntoElement, ParentElement as _, Render, Styled, Window,
}; };
use gpui_component::{ use gpui_component::{
@ -15,8 +15,6 @@ use gpui_component::{
v_flex, AxisExt, FocusableCycle, Selectable, Sizable, Size, v_flex, AxisExt, FocusableCycle, Selectable, Sizable, Size,
}; };
actions!(story, [Tab, TabPrev]);
pub struct FormStory { pub struct FormStory {
name_input: Entity<InputState>, name_input: Entity<InputState>,
email_input: Entity<InputState>, email_input: Entity<InputState>,

View file

@ -1,18 +1,15 @@
use gpui::{ use gpui::{
actions, div, App, AppContext as _, Context, Entity, FocusHandle, Focusable, div, App, AppContext as _, Context, Entity, FocusHandle, Focusable, InteractiveElement,
InteractiveElement, IntoElement, KeyBinding, ParentElement as _, Render, Styled, Subscription, IntoElement, KeyBinding, ParentElement as _, Render, Styled, Subscription, Window,
Window,
}; };
use crate::section; use crate::{section, Tab, TabPrev};
use gpui_component::{ use gpui_component::{
button::{Button, ButtonVariants as _}, button::{Button, ButtonVariants as _},
input::{InputEvent, InputState, MaskPattern, TextInput}, input::{InputEvent, InputState, MaskPattern, TextInput},
v_flex, ContextModal, FocusableCycle, Icon, IconName, Sizable, v_flex, ContextModal, FocusableCycle, Icon, IconName, Sizable,
}; };
actions!(story, [Tab, TabPrev]);
const CONTEXT: &str = "InputStory"; const CONTEXT: &str = "InputStory";
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {

View file

@ -125,6 +125,8 @@ actions!(story, [Quit, Open, CloseWindow, ToggleSearch]);
const PANEL_NAME: &str = "StoryContainer"; const PANEL_NAME: &str = "StoryContainer";
actions!(story, [TestAction, Tab, TabPrev]);
pub struct AppState { pub struct AppState {
pub invisible_panels: Entity<Vec<SharedString>>, pub invisible_panels: Entity<Vec<SharedString>>,
} }

View file

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

View file

@ -12,10 +12,10 @@ use serde::Deserialize;
use crate::section; use crate::section;
#[derive(Action, Clone, PartialEq, Deserialize)] #[derive(Action, Clone, PartialEq, Deserialize)]
#[action(namespace = story, no_json)] #[action(namespace = menu_story, no_json)]
struct Info(usize); struct Info(usize);
actions!(story, [Copy, Paste, Cut, SearchAll, ToggleCheck]); actions!(menu_story, [Copy, Paste, Cut, SearchAll, ToggleCheck]);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.bind_keys([ cx.bind_keys([

View file

@ -1,7 +1,6 @@
use gpui::{ use gpui::{
actions, div, prelude::FluentBuilder as _, px, App, AppContext, Context, Entity, FocusHandle, div, prelude::FluentBuilder as _, px, App, AppContext, Context, Entity, FocusHandle, Focusable,
Focusable, InteractiveElement as _, IntoElement, ParentElement, Render, SharedString, Styled, InteractiveElement as _, IntoElement, ParentElement, Render, SharedString, Styled, Window,
Window,
}; };
use gpui_component::{ use gpui_component::{
@ -16,8 +15,7 @@ use gpui_component::{
v_flex, ActiveTheme, ContextModal as _, v_flex, ActiveTheme, ContextModal as _,
}; };
use crate::section; use crate::{section, TestAction};
actions!(story, [TestAction]);
pub struct ModalStory { pub struct ModalStory {
focus_handle: FocusHandle, focus_handle: FocusHandle,

View file

@ -1,18 +1,16 @@
use gpui::{ use gpui::{
actions, App, AppContext as _, Context, Entity, FocusHandle, Focusable, InteractiveElement, App, AppContext as _, Context, Entity, FocusHandle, Focusable, InteractiveElement, IntoElement,
IntoElement, KeyBinding, ParentElement as _, Render, Styled, Subscription, Window, KeyBinding, ParentElement as _, Render, Styled, Subscription, Window,
}; };
use regex::Regex; use regex::Regex;
use crate::section; use crate::{section, Tab, TabPrev};
use gpui_component::{ use gpui_component::{
button::{Button, ButtonVariants}, button::{Button, ButtonVariants},
input::{InputEvent, InputState, MaskPattern, NumberInput, NumberInputEvent, StepAction}, input::{InputEvent, InputState, MaskPattern, NumberInput, NumberInputEvent, StepAction},
v_flex, FocusableCycle, IconName, Sizable, v_flex, FocusableCycle, IconName, Sizable,
}; };
actions!(story, [Tab, TabPrev]);
const CONTEXT: &str = "NumberInputStory"; const CONTEXT: &str = "NumberInputStory";
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {

View file

@ -1,7 +1,7 @@
use gpui::{ use gpui::{
actions, prelude::FluentBuilder as _, px, App, AppContext as _, Context, Entity, FocusHandle, prelude::FluentBuilder as _, px, App, AppContext as _, Context, Entity, FocusHandle, Focusable,
Focusable, InteractiveElement, IntoElement, KeyBinding, ParentElement as _, Render, InteractiveElement, IntoElement, KeyBinding, ParentElement as _, Render, SharedString, Styled,
SharedString, Styled, Subscription, Window, Subscription, Window,
}; };
use gpui_component::{ use gpui_component::{
checkbox::Checkbox, checkbox::Checkbox,
@ -10,8 +10,7 @@ use gpui_component::{
v_flex, FocusableCycle, Sizable, StyledExt, v_flex, FocusableCycle, Sizable, StyledExt,
}; };
use crate::section; use crate::{section, Tab, TabPrev};
actions!(story, [Tab, TabPrev]);
const CONTEXT: &str = "OtpInputStory"; const CONTEXT: &str = "OtpInputStory";

View file

@ -14,10 +14,10 @@ use gpui_component::{
use serde::Deserialize; use serde::Deserialize;
#[derive(Action, Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)] #[action(namespace = popover_story, no_json)]
struct Info(usize); struct Info(usize);
actions!(story, [Copy, Paste, Cut, SearchAll, ToggleCheck]); actions!(popover_story, [Copy, Paste, Cut, SearchAll, ToggleCheck]);
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.bind_keys([ cx.bind_keys([

View file

@ -1,5 +1,5 @@
use gpui::{ use gpui::{
div, px, AnyElement, App, AppContext, Context, Entity, Focusable, IntoElement, div, px, AnyElement, App, AppContext, Context, Entity, FocusHandle, Focusable, IntoElement,
ParentElement as _, Pixels, Render, SharedString, Styled, Window, ParentElement as _, Pixels, Render, SharedString, Styled, Window,
}; };
use gpui_component::{ use gpui_component::{
@ -8,7 +8,7 @@ use gpui_component::{
}; };
pub struct ResizableStory { pub struct ResizableStory {
focus_handle: gpui::FocusHandle, focus_handle: FocusHandle,
state1: Entity<ResizableState>, state1: Entity<ResizableState>,
state2: Entity<ResizableState>, state2: Entity<ResizableState>,
state3: Entity<ResizableState>, state3: Entity<ResizableState>,

View file

@ -22,7 +22,7 @@ use gpui_component::{
use serde::Deserialize; use serde::Deserialize;
#[derive(Action, Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)] #[action(namespace = sidebar_story, no_json)]
pub struct SelectCompany(SharedString); pub struct SelectCompany(SharedString);
pub struct SidebarStory { pub struct SidebarStory {

View file

@ -1,6 +1,6 @@
use gpui::{ use gpui::{
px, App, AppContext, Context, Div, Entity, Focusable, IntoElement, ParentElement, Render, px, App, AppContext, Context, Div, Entity, FocusHandle, Focusable, IntoElement, ParentElement,
SharedString, Styled, Window, Render, SharedString, Styled, Window,
}; };
use gpui_component::{ use gpui_component::{
@ -10,7 +10,7 @@ use gpui_component::{
use crate::section; use crate::section;
pub struct SwitchStory { pub struct SwitchStory {
focus_handle: gpui::FocusHandle, focus_handle: FocusHandle,
switch1: bool, switch1: bool,
switch2: bool, switch2: bool,
switch3: bool, switch3: bool,

View file

@ -24,11 +24,11 @@ use gpui_component::{
use serde::Deserialize; use serde::Deserialize;
#[derive(Action, Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)] #[action(namespace = table_story, no_json)]
struct ChangeSize(Size); struct ChangeSize(Size);
#[derive(Action, Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)] #[action(namespace = table_story, no_json)]
struct OpenDetail(usize); struct OpenDetail(usize);
#[derive(Clone, Debug, Default)] #[derive(Clone, Debug, Default)]

View file

@ -1,5 +1,6 @@
use gpui::{ use gpui::{
App, AppContext, Context, Entity, Focusable, IntoElement, ParentElement, Render, Styled, Window, App, AppContext, Context, Entity, FocusHandle, Focusable, IntoElement, ParentElement, Render,
Styled, Window,
}; };
use gpui_component::{ use gpui_component::{
@ -13,7 +14,7 @@ use gpui_component::{
use crate::section; use crate::section;
pub struct TabsStory { pub struct TabsStory {
focus_handle: gpui::FocusHandle, focus_handle: FocusHandle,
active_tab_ix: usize, active_tab_ix: usize,
size: Size, size: Size,
menu: bool, menu: bool,

View file

@ -1,6 +1,6 @@
use gpui::{ use gpui::{
px, App, AppContext, Context, Entity, Focusable, IntoElement, ParentElement, Render, Styled, px, App, AppContext, Context, Entity, FocusHandle, Focusable, IntoElement, ParentElement,
Window, Render, Styled, Window,
}; };
use gpui_component::{h_flex, indigo_50, indigo_500, tag::Tag, v_flex, ColorName, Sizable}; use gpui_component::{h_flex, indigo_50, indigo_500, tag::Tag, v_flex, ColorName, Sizable};
@ -8,7 +8,7 @@ use gpui_component::{h_flex, indigo_50, indigo_500, tag::Tag, v_flex, ColorName,
use crate::section; use crate::section;
pub struct TagStory { pub struct TagStory {
focus_handle: gpui::FocusHandle, focus_handle: FocusHandle,
} }
impl super::Story for TagStory { impl super::Story for TagStory {
@ -37,7 +37,7 @@ impl TagStory {
} }
} }
impl Focusable for TagStory { impl Focusable for TagStory {
fn focus_handle(&self, _: &gpui::App) -> gpui::FocusHandle { fn focus_handle(&self, _: &App) -> FocusHandle {
self.focus_handle.clone() self.focus_handle.clone()
} }
} }

View file

@ -1,9 +1,9 @@
use gpui::{ use gpui::{
actions, px, App, AppContext as _, ClickEvent, Context, Entity, FocusHandle, Focusable, px, App, AppContext as _, ClickEvent, Context, Entity, FocusHandle, Focusable,
InteractiveElement, IntoElement, KeyBinding, ParentElement as _, Render, Styled, Window, InteractiveElement, IntoElement, KeyBinding, ParentElement as _, Render, Styled, Window,
}; };
use crate::section; use crate::{section, Tab, TabPrev};
use gpui_component::{ use gpui_component::{
button::Button, button::Button,
h_flex, h_flex,
@ -11,8 +11,6 @@ use gpui_component::{
v_flex, FocusableCycle, Sizable, v_flex, FocusableCycle, Sizable,
}; };
actions!(story, [Tab, TabPrev]);
const CONTEXT: &str = "TextareaStory"; const CONTEXT: &str = "TextareaStory";
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {

View file

@ -1,5 +1,5 @@
use gpui::{ use gpui::{
actions, App, AppContext as _, Context, Entity, Focusable, IntoElement, ParentElement as _, App, AppContext as _, Context, Entity, FocusHandle, Focusable, IntoElement, ParentElement as _,
Render, Styled as _, Window, Render, Styled as _, Window,
}; };
@ -8,10 +8,8 @@ use gpui_component::{
h_flex, v_flex, IconName, Sizable, h_flex, v_flex, IconName, Sizable,
}; };
actions!(story, [Disabled, Loading, Selected, Compact]);
pub struct ToggleStory { pub struct ToggleStory {
focus_handle: gpui::FocusHandle, focus_handle: FocusHandle,
single_toggle: usize, single_toggle: usize,
checked: Vec<bool>, checked: Vec<bool>,
} }

View file

@ -16,7 +16,7 @@ use gpui_component::{
use crate::{section, Story}; use crate::{section, Story};
actions!(story, [Info]); actions!(tooltip_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,13 @@
use gpui::{App, AppContext, Context, Entity, Focusable, ParentElement, Render, Styled, Window}; use gpui::{
App, AppContext, Context, Entity, FocusHandle, Focusable, ParentElement, Render, Styled, Window,
};
use gpui_component::{dock::PanelControl, text::TextView, v_flex}; use gpui_component::{dock::PanelControl, text::TextView, v_flex};
use crate::Story; use crate::Story;
pub struct WelcomeStory { pub struct WelcomeStory {
focus_handle: gpui::FocusHandle, focus_handle: FocusHandle,
} }
impl WelcomeStory { impl WelcomeStory {