Mainline GPUI2 UI work (#3099)
This PR mainlines the current state of new GPUI2-based UI from the `gpui2-ui` branch. Included in this is a performance improvement to make use of the `TextLayoutCache` when calling `layout` for `Text` elements. Release Notes: - N/A --------- Co-authored-by: Nate Butler <iamnbutler@gmail.com> Co-authored-by: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
c46137e40d
commit
456baaa112
18 changed files with 371 additions and 19 deletions
|
@ -6,13 +6,17 @@ pub mod collab_panel;
|
|||
pub mod context_menu;
|
||||
pub mod facepile;
|
||||
pub mod keybinding;
|
||||
pub mod language_selector;
|
||||
pub mod multi_buffer;
|
||||
pub mod palette;
|
||||
pub mod panel;
|
||||
pub mod project_panel;
|
||||
pub mod recent_projects;
|
||||
pub mod status_bar;
|
||||
pub mod tab;
|
||||
pub mod tab_bar;
|
||||
pub mod terminal;
|
||||
pub mod theme_selector;
|
||||
pub mod title_bar;
|
||||
pub mod toolbar;
|
||||
pub mod traffic_lights;
|
||||
|
|
16
crates/storybook/src/stories/components/language_selector.rs
Normal file
16
crates/storybook/src/stories/components/language_selector.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
use ui::prelude::*;
|
||||
use ui::LanguageSelector;
|
||||
|
||||
use crate::story::Story;
|
||||
|
||||
#[derive(Element, Default)]
|
||||
pub struct LanguageSelectorStory {}
|
||||
|
||||
impl LanguageSelectorStory {
|
||||
fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
|
||||
Story::container(cx)
|
||||
.child(Story::title_for::<_, LanguageSelector>(cx))
|
||||
.child(Story::label(cx, "Default"))
|
||||
.child(LanguageSelector::new())
|
||||
}
|
||||
}
|
24
crates/storybook/src/stories/components/multi_buffer.rs
Normal file
24
crates/storybook/src/stories/components/multi_buffer.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
use ui::prelude::*;
|
||||
use ui::{hello_world_rust_buffer_example, MultiBuffer};
|
||||
|
||||
use crate::story::Story;
|
||||
|
||||
#[derive(Element, Default)]
|
||||
pub struct MultiBufferStory {}
|
||||
|
||||
impl MultiBufferStory {
|
||||
fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
|
||||
let theme = theme(cx);
|
||||
|
||||
Story::container(cx)
|
||||
.child(Story::title_for::<_, MultiBuffer<V>>(cx))
|
||||
.child(Story::label(cx, "Default"))
|
||||
.child(MultiBuffer::new(vec![
|
||||
hello_world_rust_buffer_example(&theme),
|
||||
hello_world_rust_buffer_example(&theme),
|
||||
hello_world_rust_buffer_example(&theme),
|
||||
hello_world_rust_buffer_example(&theme),
|
||||
hello_world_rust_buffer_example(&theme),
|
||||
]))
|
||||
}
|
||||
}
|
16
crates/storybook/src/stories/components/recent_projects.rs
Normal file
16
crates/storybook/src/stories/components/recent_projects.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
use ui::prelude::*;
|
||||
use ui::RecentProjects;
|
||||
|
||||
use crate::story::Story;
|
||||
|
||||
#[derive(Element, Default)]
|
||||
pub struct RecentProjectsStory {}
|
||||
|
||||
impl RecentProjectsStory {
|
||||
fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
|
||||
Story::container(cx)
|
||||
.child(Story::title_for::<_, RecentProjects>(cx))
|
||||
.child(Story::label(cx, "Default"))
|
||||
.child(RecentProjects::new())
|
||||
}
|
||||
}
|
16
crates/storybook/src/stories/components/theme_selector.rs
Normal file
16
crates/storybook/src/stories/components/theme_selector.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
use ui::prelude::*;
|
||||
use ui::ThemeSelector;
|
||||
|
||||
use crate::story::Story;
|
||||
|
||||
#[derive(Element, Default)]
|
||||
pub struct ThemeSelectorStory {}
|
||||
|
||||
impl ThemeSelectorStory {
|
||||
fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
|
||||
Story::container(cx)
|
||||
.child(Story::title_for::<_, ThemeSelector>(cx))
|
||||
.child(Story::label(cx, "Default"))
|
||||
.child(ThemeSelector::new())
|
||||
}
|
||||
}
|
|
@ -42,13 +42,17 @@ pub enum ComponentStory {
|
|||
CollabPanel,
|
||||
Facepile,
|
||||
Keybinding,
|
||||
LanguageSelector,
|
||||
MultiBuffer,
|
||||
Palette,
|
||||
Panel,
|
||||
ProjectPanel,
|
||||
RecentProjects,
|
||||
StatusBar,
|
||||
Tab,
|
||||
TabBar,
|
||||
Terminal,
|
||||
ThemeSelector,
|
||||
TitleBar,
|
||||
Toolbar,
|
||||
TrafficLights,
|
||||
|
@ -69,15 +73,25 @@ impl ComponentStory {
|
|||
Self::CollabPanel => components::collab_panel::CollabPanelStory::default().into_any(),
|
||||
Self::Facepile => components::facepile::FacepileStory::default().into_any(),
|
||||
Self::Keybinding => components::keybinding::KeybindingStory::default().into_any(),
|
||||
Self::LanguageSelector => {
|
||||
components::language_selector::LanguageSelectorStory::default().into_any()
|
||||
}
|
||||
Self::MultiBuffer => components::multi_buffer::MultiBufferStory::default().into_any(),
|
||||
Self::Palette => components::palette::PaletteStory::default().into_any(),
|
||||
Self::Panel => components::panel::PanelStory::default().into_any(),
|
||||
Self::ProjectPanel => {
|
||||
components::project_panel::ProjectPanelStory::default().into_any()
|
||||
}
|
||||
Self::RecentProjects => {
|
||||
components::recent_projects::RecentProjectsStory::default().into_any()
|
||||
}
|
||||
Self::StatusBar => components::status_bar::StatusBarStory::default().into_any(),
|
||||
Self::Tab => components::tab::TabStory::default().into_any(),
|
||||
Self::TabBar => components::tab_bar::TabBarStory::default().into_any(),
|
||||
Self::Terminal => components::terminal::TerminalStory::default().into_any(),
|
||||
Self::ThemeSelector => {
|
||||
components::theme_selector::ThemeSelectorStory::default().into_any()
|
||||
}
|
||||
Self::TitleBar => components::title_bar::TitleBarStory::default().into_any(),
|
||||
Self::Toolbar => components::toolbar::ToolbarStory::default().into_any(),
|
||||
Self::TrafficLights => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue