chore: Add ui folder to Cargo default-members. (#1600)

This to help `cargo test` default will test `ui` and `story`.
This commit is contained in:
Jason Lee 2025-11-14 14:16:03 +08:00 committed by GitHub
parent 29fbdd371b
commit 724ccd64a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 61 additions and 58 deletions

56
Cargo.lock generated
View file

@ -2902,6 +2902,34 @@ dependencies = [
"syn 2.0.105", "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]] [[package]]
name = "gpui-macros" name = "gpui-macros"
version = "0.2.2" version = "0.2.2"
@ -6891,34 +6919,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 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]] [[package]]
name = "str_indices" name = "str_indices"
version = "0.4.4" version = "0.4.4"

View file

@ -1,5 +1,8 @@
[workspace] [workspace]
default-members = ["crates/story"] default-members = [
"crates/ui",
"crates/story"
]
members = [ members = [
"crates/macros", "crates/macros",
"crates/story", "crates/story",

View file

@ -1,6 +1,6 @@
[package] [package]
edition = "2024" edition = "2024"
name = "story" name = "gpui-component-story"
publish = false publish = false
version = "0.4.0-preview2" version = "0.4.0-preview2"

View file

@ -10,7 +10,7 @@ use gpui_component::{
slider::{Slider, SliderState}, slider::{Slider, SliderState},
v_flex, v_flex,
}; };
use story::Assets; use gpui_component_story::Assets;
pub struct BrushStory { pub struct BrushStory {
focus_handle: gpui::FocusHandle, focus_handle: gpui::FocusHandle,
@ -458,9 +458,9 @@ fn main() {
let app = Application::new().with_assets(Assets); let app = Application::new().with_assets(Assets);
app.run(move |cx| { app.run(move |cx| {
story::init(cx); gpui_component_story::init(cx);
cx.activate(true); cx.activate(true);
story::create_new_window("Brush Example", Example::view, cx); gpui_component_story::create_new_window("Brush Example", Example::view, cx);
}); });
} }

View file

@ -7,14 +7,14 @@ use gpui_component::{
menu::DropdownMenu, menu::DropdownMenu,
}; };
use serde::Deserialize; use gpui_component_story::{
use std::{sync::Arc, time::Duration};
use story::{
AccordionStory, AppState, AppTitleBar, Assets, ButtonStory, CalendarStory, DialogStory, AccordionStory, AppState, AppTitleBar, Assets, ButtonStory, CalendarStory, DialogStory,
FormStory, IconStory, ImageStory, InputStory, LabelStory, ListStory, NotificationStory, Open, FormStory, IconStory, ImageStory, InputStory, LabelStory, ListStory, NotificationStory, Open,
PopoverStory, ProgressStory, ResizableStory, ScrollableStory, SelectStory, SidebarStory, PopoverStory, ProgressStory, ResizableStory, ScrollableStory, SelectStory, SidebarStory,
StoryContainer, SwitchStory, TableStory, TooltipStory, WebViewStory, StoryContainer, SwitchStory, TableStory, TooltipStory, WebViewStory,
}; };
use serde::Deserialize;
use std::{sync::Arc, time::Duration};
#[derive(Action, Clone, PartialEq, Eq, Deserialize)] #[derive(Action, Clone, PartialEq, Eq, Deserialize)]
#[action(namespace = story, no_json)] #[action(namespace = story, no_json)]
@ -38,7 +38,7 @@ const STATE_FILE: &str = "docks.json";
pub fn init(cx: &mut App) { pub fn init(cx: &mut App) {
cx.on_action(|_action: &Open, _cx: &mut App| {}); cx.on_action(|_action: &Open, _cx: &mut App| {});
story::init(cx); gpui_component_story::init(cx);
cx.bind_keys(vec![ cx.bind_keys(vec![
KeyBinding::new("shift-escape", ToggleZoom, None), KeyBinding::new("shift-escape", ToggleZoom, None),

View file

@ -23,11 +23,11 @@ use gpui_component::{
tree::{TreeItem, TreeState, tree}, tree::{TreeItem, TreeState, tree},
v_flex, v_flex,
}; };
use gpui_component_story::{Assets, Open};
use lsp_types::{ use lsp_types::{
CodeAction, CodeActionKind, CompletionContext, CompletionItem, CompletionResponse, CodeAction, CodeActionKind, CompletionContext, CompletionItem, CompletionResponse,
CompletionTextEdit, InsertReplaceEdit, TextEdit, WorkspaceEdit, CompletionTextEdit, InsertReplaceEdit, TextEdit, WorkspaceEdit,
}; };
use story::{Assets, Open};
fn init() { fn init() {
LanguageRegistry::singleton().register( LanguageRegistry::singleton().register(
@ -1035,11 +1035,11 @@ fn main() {
let app = Application::new().with_assets(Assets); let app = Application::new().with_assets(Assets);
app.run(move |cx| { app.run(move |cx| {
story::init(cx); gpui_component_story::init(cx);
init(); init();
cx.activate(true); cx.activate(true);
story::create_new_window_with_size( gpui_component_story::create_new_window_with_size(
"Editor", "Editor",
Some(size(px(1200.), px(750.))), Some(size(px(1200.), px(750.))),
|window, cx| cx.new(|cx| Example::new(window, cx)), |window, cx| cx.new(|cx| Example::new(window, cx)),

View file

@ -5,7 +5,7 @@ use gpui_component::{
resizable::h_resizable, resizable::h_resizable,
text::TextView, text::TextView,
}; };
use story::Assets; use gpui_component_story::Assets;
pub struct Example { pub struct Example {
input_state: Entity<InputState>, input_state: Entity<InputState>,
@ -81,9 +81,9 @@ fn main() {
let app = Application::new().with_assets(Assets); let app = Application::new().with_assets(Assets);
app.run(move |cx| { app.run(move |cx| {
story::init(cx); gpui_component_story::init(cx);
cx.activate(true); 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);
}); });
} }

View file

@ -6,7 +6,7 @@ use gpui_component::{
input::{self, Input, InputEvent, InputState, TabSize}, input::{self, Input, InputEvent, InputState, TabSize},
v_flex, v_flex,
}; };
use story::Assets; use gpui_component_story::Assets;
pub struct Example { pub struct Example {
editor: Entity<InputState>, editor: Entity<InputState>,
@ -157,9 +157,9 @@ fn main() {
let app = Application::new().with_assets(Assets); let app = Application::new().with_assets(Assets);
app.run(move |cx| { app.run(move |cx| {
story::init(cx); gpui_component_story::init(cx);
cx.activate(true); 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);
}); });
} }

View file

@ -5,7 +5,7 @@ use gpui_component::{
resizable::{h_resizable, resizable_panel}, resizable::{h_resizable, resizable_panel},
text::TextView, text::TextView,
}; };
use story::{Assets, Open}; use gpui_component_story::{Assets, Open};
pub struct Example { pub struct Example {
input_state: Entity<InputState>, input_state: Entity<InputState>,
@ -115,9 +115,9 @@ fn main() {
let app = Application::new().with_assets(Assets); let app = Application::new().with_assets(Assets);
app.run(move |cx| { app.run(move |cx| {
story::init(cx); gpui_component_story::init(cx);
cx.activate(true); cx.activate(true);
story::create_new_window("Markdown Editor", Example::view, cx); gpui_component_story::create_new_window("Markdown Editor", Example::view, cx);
}); });
} }

View file

@ -9,9 +9,9 @@ use gpui_component::{
input::{Input, InputState}, input::{Input, InputState},
scroll::ScrollbarShow, scroll::ScrollbarShow,
}; };
use gpui_component_story::{Assets, ButtonStory, IconStory, StoryContainer};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
use story::{Assets, ButtonStory, IconStory, StoryContainer};
actions!(tiles_story, [Quit]); actions!(tiles_story, [Quit]);
@ -139,7 +139,7 @@ pub fn init(cx: &mut App) {
cx.on_action(|_action: &Open, _cx: &mut App| {}); cx.on_action(|_action: &Open, _cx: &mut App| {});
gpui_component::init(cx); gpui_component::init(cx);
story::init(cx); gpui_component_story::init(cx);
} }
pub struct StoryTiles { pub struct StoryTiles {
@ -435,7 +435,7 @@ fn main() {
app.run(move |cx| { app.run(move |cx| {
gpui_component::init(cx); gpui_component::init(cx);
story::init(cx); gpui_component_story::init(cx);
ContainerPanel::init(cx); ContainerPanel::init(cx);
cx.on_action(quit); cx.on_action(quit);

View file

@ -1,5 +1,5 @@
use gpui::*; use gpui::*;
use story::{Assets, WebViewStory}; use gpui_component_story::{Assets, WebViewStory};
pub struct Example { pub struct Example {
root: Entity<WebViewStory>, root: Entity<WebViewStory>,
@ -31,9 +31,9 @@ fn main() {
let app = Application::new().with_assets(Assets); let app = Application::new().with_assets(Assets);
app.run(move |cx| { app.run(move |cx| {
story::init(cx); gpui_component_story::init(cx);
cx.activate(true); cx.activate(true);
story::create_new_window("WebView Example", Example::view, cx); gpui_component_story::create_new_window("WebView Example", Example::view, cx);
}); });
} }

View file

@ -6,7 +6,7 @@ use gpui_component::{
sidebar::{Sidebar, SidebarGroup, SidebarHeader, SidebarMenu, SidebarMenuItem}, sidebar::{Sidebar, SidebarGroup, SidebarHeader, SidebarMenu, SidebarMenuItem},
v_flex, v_flex,
}; };
use story::*; use gpui_component_story::*;
pub struct Gallery { pub struct Gallery {
stories: Vec<(&'static str, Vec<Entity<StoryContainer>>)>, stories: Vec<(&'static str, Vec<Entity<StoryContainer>>)>,
@ -297,10 +297,10 @@ fn main() {
let name = std::env::args().nth(1); let name = std::env::args().nth(1);
app.run(move |cx| { app.run(move |cx| {
story::init(cx); gpui_component_story::init(cx);
cx.activate(true); cx.activate(true);
story::create_new_window( gpui_component_story::create_new_window(
"GPUI Component", "GPUI Component",
move |window, cx| Gallery::view(name.as_deref(), window, cx), move |window, cx| Gallery::view(name.as_deref(), window, cx),
cx, cx,