From 724ccd64a7c1606f7a09e64f8b759e75db10d0ce Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Fri, 14 Nov 2025 14:16:03 +0800 Subject: [PATCH] chore: Add `ui` folder to Cargo default-members. (#1600) This to help `cargo test` default will test `ui` and `story`. --- Cargo.lock | 56 ++++++++++++++--------------- Cargo.toml | 5 ++- crates/story/Cargo.toml | 2 +- crates/story/examples/brush.rs | 6 ++-- crates/story/examples/dock.rs | 8 ++--- crates/story/examples/editor.rs | 6 ++-- crates/story/examples/html.rs | 6 ++-- crates/story/examples/large-text.rs | 6 ++-- crates/story/examples/markdown.rs | 6 ++-- crates/story/examples/tiles.rs | 6 ++-- crates/story/examples/webview.rs | 6 ++-- crates/story/src/main.rs | 6 ++-- 12 files changed, 61 insertions(+), 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index daed88dd..9e3168d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2902,6 +2902,34 @@ dependencies = [ "syn 2.0.105", ] +[[package]] +name = "gpui-component-story" +version = "0.4.0-preview2" +dependencies = [ + "anyhow", + "autocorrect", + "chrono", + "color-lsp", + "fake", + "gpui", + "gpui-component", + "gtk", + "itertools 0.14.0", + "lsp-types 0.97.0", + "rand 0.8.5", + "raw-window-handle", + "regex", + "reqwest_client", + "rust-embed", + "serde", + "serde_json", + "smol", + "tracing", + "tracing-subscriber", + "tree-sitter-navi", + "unindent", +] + [[package]] name = "gpui-macros" version = "0.2.2" @@ -6891,34 +6919,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "story" -version = "0.4.0-preview2" -dependencies = [ - "anyhow", - "autocorrect", - "chrono", - "color-lsp", - "fake", - "gpui", - "gpui-component", - "gtk", - "itertools 0.14.0", - "lsp-types 0.97.0", - "rand 0.8.5", - "raw-window-handle", - "regex", - "reqwest_client", - "rust-embed", - "serde", - "serde_json", - "smol", - "tracing", - "tracing-subscriber", - "tree-sitter-navi", - "unindent", -] - [[package]] name = "str_indices" version = "0.4.4" diff --git a/Cargo.toml b/Cargo.toml index 73602cb7..22855294 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,8 @@ [workspace] -default-members = ["crates/story"] +default-members = [ + "crates/ui", + "crates/story" +] members = [ "crates/macros", "crates/story", diff --git a/crates/story/Cargo.toml b/crates/story/Cargo.toml index 76b853f8..92b3c4c7 100644 --- a/crates/story/Cargo.toml +++ b/crates/story/Cargo.toml @@ -1,6 +1,6 @@ [package] edition = "2024" -name = "story" +name = "gpui-component-story" publish = false version = "0.4.0-preview2" diff --git a/crates/story/examples/brush.rs b/crates/story/examples/brush.rs index 415f105e..79cc661a 100644 --- a/crates/story/examples/brush.rs +++ b/crates/story/examples/brush.rs @@ -10,7 +10,7 @@ use gpui_component::{ slider::{Slider, SliderState}, v_flex, }; -use story::Assets; +use gpui_component_story::Assets; pub struct BrushStory { focus_handle: gpui::FocusHandle, @@ -458,9 +458,9 @@ fn main() { let app = Application::new().with_assets(Assets); app.run(move |cx| { - story::init(cx); + gpui_component_story::init(cx); cx.activate(true); - story::create_new_window("Brush Example", Example::view, cx); + gpui_component_story::create_new_window("Brush Example", Example::view, cx); }); } diff --git a/crates/story/examples/dock.rs b/crates/story/examples/dock.rs index 56a17eef..336755a6 100644 --- a/crates/story/examples/dock.rs +++ b/crates/story/examples/dock.rs @@ -7,14 +7,14 @@ use gpui_component::{ menu::DropdownMenu, }; -use serde::Deserialize; -use std::{sync::Arc, time::Duration}; -use story::{ +use gpui_component_story::{ AccordionStory, AppState, AppTitleBar, Assets, ButtonStory, CalendarStory, DialogStory, FormStory, IconStory, ImageStory, InputStory, LabelStory, ListStory, NotificationStory, Open, PopoverStory, ProgressStory, ResizableStory, ScrollableStory, SelectStory, SidebarStory, StoryContainer, SwitchStory, TableStory, TooltipStory, WebViewStory, }; +use serde::Deserialize; +use std::{sync::Arc, time::Duration}; #[derive(Action, Clone, PartialEq, Eq, Deserialize)] #[action(namespace = story, no_json)] @@ -38,7 +38,7 @@ const STATE_FILE: &str = "docks.json"; pub fn init(cx: &mut App) { cx.on_action(|_action: &Open, _cx: &mut App| {}); - story::init(cx); + gpui_component_story::init(cx); cx.bind_keys(vec![ KeyBinding::new("shift-escape", ToggleZoom, None), diff --git a/crates/story/examples/editor.rs b/crates/story/examples/editor.rs index 843ba47e..26c2f2d4 100644 --- a/crates/story/examples/editor.rs +++ b/crates/story/examples/editor.rs @@ -23,11 +23,11 @@ use gpui_component::{ tree::{TreeItem, TreeState, tree}, v_flex, }; +use gpui_component_story::{Assets, Open}; use lsp_types::{ CodeAction, CodeActionKind, CompletionContext, CompletionItem, CompletionResponse, CompletionTextEdit, InsertReplaceEdit, TextEdit, WorkspaceEdit, }; -use story::{Assets, Open}; fn init() { LanguageRegistry::singleton().register( @@ -1035,11 +1035,11 @@ fn main() { let app = Application::new().with_assets(Assets); app.run(move |cx| { - story::init(cx); + gpui_component_story::init(cx); init(); cx.activate(true); - story::create_new_window_with_size( + gpui_component_story::create_new_window_with_size( "Editor", Some(size(px(1200.), px(750.))), |window, cx| cx.new(|cx| Example::new(window, cx)), diff --git a/crates/story/examples/html.rs b/crates/story/examples/html.rs index 6469b4f5..4337ab0b 100644 --- a/crates/story/examples/html.rs +++ b/crates/story/examples/html.rs @@ -5,7 +5,7 @@ use gpui_component::{ resizable::h_resizable, text::TextView, }; -use story::Assets; +use gpui_component_story::Assets; pub struct Example { input_state: Entity, @@ -81,9 +81,9 @@ fn main() { let app = Application::new().with_assets(Assets); app.run(move |cx| { - story::init(cx); + gpui_component_story::init(cx); cx.activate(true); - story::create_new_window("HTML Render (native)", Example::view, cx); + gpui_component_story::create_new_window("HTML Render (native)", Example::view, cx); }); } diff --git a/crates/story/examples/large-text.rs b/crates/story/examples/large-text.rs index 102925d6..93abf6a2 100644 --- a/crates/story/examples/large-text.rs +++ b/crates/story/examples/large-text.rs @@ -6,7 +6,7 @@ use gpui_component::{ input::{self, Input, InputEvent, InputState, TabSize}, v_flex, }; -use story::Assets; +use gpui_component_story::Assets; pub struct Example { editor: Entity, @@ -157,9 +157,9 @@ fn main() { let app = Application::new().with_assets(Assets); app.run(move |cx| { - story::init(cx); + gpui_component_story::init(cx); cx.activate(true); - story::create_new_window("Large Text Editor", Example::view, cx); + gpui_component_story::create_new_window("Large Text Editor", Example::view, cx); }); } diff --git a/crates/story/examples/markdown.rs b/crates/story/examples/markdown.rs index bd77c584..216ee1d4 100644 --- a/crates/story/examples/markdown.rs +++ b/crates/story/examples/markdown.rs @@ -5,7 +5,7 @@ use gpui_component::{ resizable::{h_resizable, resizable_panel}, text::TextView, }; -use story::{Assets, Open}; +use gpui_component_story::{Assets, Open}; pub struct Example { input_state: Entity, @@ -115,9 +115,9 @@ fn main() { let app = Application::new().with_assets(Assets); app.run(move |cx| { - story::init(cx); + gpui_component_story::init(cx); cx.activate(true); - story::create_new_window("Markdown Editor", Example::view, cx); + gpui_component_story::create_new_window("Markdown Editor", Example::view, cx); }); } diff --git a/crates/story/examples/tiles.rs b/crates/story/examples/tiles.rs index b6b6a32b..a570d5d3 100644 --- a/crates/story/examples/tiles.rs +++ b/crates/story/examples/tiles.rs @@ -9,9 +9,9 @@ use gpui_component::{ input::{Input, InputState}, scroll::ScrollbarShow, }; +use gpui_component_story::{Assets, ButtonStory, IconStory, StoryContainer}; use serde::{Deserialize, Serialize}; use std::{sync::Arc, time::Duration}; -use story::{Assets, ButtonStory, IconStory, StoryContainer}; actions!(tiles_story, [Quit]); @@ -139,7 +139,7 @@ pub fn init(cx: &mut App) { cx.on_action(|_action: &Open, _cx: &mut App| {}); gpui_component::init(cx); - story::init(cx); + gpui_component_story::init(cx); } pub struct StoryTiles { @@ -435,7 +435,7 @@ fn main() { app.run(move |cx| { gpui_component::init(cx); - story::init(cx); + gpui_component_story::init(cx); ContainerPanel::init(cx); cx.on_action(quit); diff --git a/crates/story/examples/webview.rs b/crates/story/examples/webview.rs index d1f5cc44..0383b296 100644 --- a/crates/story/examples/webview.rs +++ b/crates/story/examples/webview.rs @@ -1,5 +1,5 @@ use gpui::*; -use story::{Assets, WebViewStory}; +use gpui_component_story::{Assets, WebViewStory}; pub struct Example { root: Entity, @@ -31,9 +31,9 @@ fn main() { let app = Application::new().with_assets(Assets); app.run(move |cx| { - story::init(cx); + gpui_component_story::init(cx); cx.activate(true); - story::create_new_window("WebView Example", Example::view, cx); + gpui_component_story::create_new_window("WebView Example", Example::view, cx); }); } diff --git a/crates/story/src/main.rs b/crates/story/src/main.rs index 411651a7..2eb826f7 100644 --- a/crates/story/src/main.rs +++ b/crates/story/src/main.rs @@ -6,7 +6,7 @@ use gpui_component::{ sidebar::{Sidebar, SidebarGroup, SidebarHeader, SidebarMenu, SidebarMenuItem}, v_flex, }; -use story::*; +use gpui_component_story::*; pub struct Gallery { stories: Vec<(&'static str, Vec>)>, @@ -297,10 +297,10 @@ fn main() { let name = std::env::args().nth(1); app.run(move |cx| { - story::init(cx); + gpui_component_story::init(cx); cx.activate(true); - story::create_new_window( + gpui_component_story::create_new_window( "GPUI Component", move |window, cx| Gallery::view(name.as_deref(), window, cx), cx,