Remove IntoAnyElement bound from Element trait
This commit is contained in:
parent
db15db45ce
commit
927278e20d
48 changed files with 106 additions and 224 deletions
|
@ -106,7 +106,7 @@
|
||||||
// data: &PromptUserDeviceFlow,
|
// data: &PromptUserDeviceFlow,
|
||||||
// style: &theme::Copilot,
|
// style: &theme::Copilot,
|
||||||
// cx: &mut ViewContext<Self>,
|
// cx: &mut ViewContext<Self>,
|
||||||
// ) -> impl Element<Self> {
|
// ) -> impl IntoAnyElement<Self> {
|
||||||
// let copied = cx
|
// let copied = cx
|
||||||
// .read_from_clipboard()
|
// .read_from_clipboard()
|
||||||
// .map(|item| item.text() == &data.user_code)
|
// .map(|item| item.text() == &data.user_code)
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl KitchenSinkStory {
|
||||||
view(cx.entity(|cx| Self::new()), Self::render)
|
view(cx.entity(|cx| Self::new()), Self::render)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<Self> {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoAnyElement<Self> {
|
||||||
let element_stories = ElementStory::iter()
|
let element_stories = ElementStory::iter()
|
||||||
.map(|selector| selector.story(cx))
|
.map(|selector| selector.story(cx))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::themes::rose_pine;
|
use crate::themes::rose_pine;
|
||||||
use gpui2::{
|
use gpui2::{
|
||||||
div, px, view, Context, Element, ParentElement, SharedString, Styled, View, WindowContext,
|
div, px, view, Context, IntoAnyElement, ParentElement, SharedString, Styled, View,
|
||||||
|
WindowContext,
|
||||||
};
|
};
|
||||||
use ui::ElementExt;
|
use ui::ElementExt;
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ impl ScrollStory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn checkerboard<S>(depth: usize) -> impl Element<S>
|
fn checkerboard<S>(depth: usize) -> impl IntoAnyElement<S>
|
||||||
where
|
where
|
||||||
S: 'static + Send + Sync,
|
S: 'static + Send + Sync,
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ impl<S: 'static + Send + Sync> ZIndexStory<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title(cx, "z-index"))
|
.child(Story::title(cx, "z-index"))
|
||||||
.child(
|
.child(
|
||||||
|
@ -102,7 +102,7 @@ impl<V: 'static + Send + Sync> ZIndexExample<V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Element<V> {
|
fn render(&mut self, _view: &mut V, cx: &mut ViewContext<V>) -> impl IntoAnyElement<V> {
|
||||||
div()
|
div()
|
||||||
.relative()
|
.relative()
|
||||||
.size_full()
|
.size_full()
|
||||||
|
|
|
@ -10,7 +10,7 @@ use std::sync::Arc;
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use gpui2::{
|
use gpui2::{
|
||||||
div, px, size, view, AnyView, AppContext, Bounds, Context, Element, ViewContext, WindowBounds,
|
div, px, size, view, AnyView, AppContext, Bounds, Context, ViewContext, WindowBounds,
|
||||||
WindowOptions,
|
WindowOptions,
|
||||||
};
|
};
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
|
@ -107,7 +107,7 @@ impl StoryWrapper {
|
||||||
Self { story, theme }
|
Self { story, theme }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<Self> {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoAnyElement<Self> {
|
||||||
themed(self.theme.clone(), cx, |cx| {
|
themed(self.theme.clone(), cx, |cx| {
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
|
|
|
@ -26,7 +26,7 @@ impl<S: 'static + Send + Sync> AssistantPanel<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
Panel::new(self.id.clone(), cx)
|
Panel::new(self.id.clone(), cx)
|
||||||
.children(vec![div()
|
.children(vec![div()
|
||||||
.flex()
|
.flex()
|
||||||
|
@ -96,11 +96,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, AssistantPanel<S>>(cx))
|
.child(Story::title_for::<_, AssistantPanel<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -31,11 +31,7 @@ impl<S: 'static + Send + Sync> Breadcrumb<S> {
|
||||||
div().child(" › ").text_color(theme.text_muted)
|
div().child(" › ").text_color(theme.text_muted)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, view_state: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
view_state: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
let symbols_len = self.symbols.len();
|
let symbols_len = self.symbols.len();
|
||||||
|
@ -106,7 +102,7 @@ mod stories {
|
||||||
&mut self,
|
&mut self,
|
||||||
view_state: &mut S,
|
view_state: &mut S,
|
||||||
cx: &mut ViewContext<S>,
|
cx: &mut ViewContext<S>,
|
||||||
) -> impl Element<S> {
|
) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
|
|
|
@ -158,7 +158,7 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_row(row: BufferRow, cx: &WindowContext) -> impl Element<S> {
|
fn render_row(row: BufferRow, cx: &WindowContext) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
let line_background = if row.current {
|
let line_background = if row.current {
|
||||||
|
@ -208,7 +208,7 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_rows(&self, cx: &WindowContext) -> Vec<impl Element<S>> {
|
fn render_rows(&self, cx: &WindowContext) -> Vec<impl IntoAnyElement<S>> {
|
||||||
match &self.rows {
|
match &self.rows {
|
||||||
Some(rows) => rows
|
Some(rows) => rows
|
||||||
.rows
|
.rows
|
||||||
|
@ -219,7 +219,7 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
let rows = self.render_rows(cx);
|
let rows = self.render_rows(cx);
|
||||||
|
|
||||||
|
@ -258,11 +258,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl BufferSearch {
|
||||||
view(cx.entity(|cx| Self::new()), Self::render)
|
view(cx.entity(|cx| Self::new()), Self::render)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<Self> {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoAnyElement<Self> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
h_stack().bg(theme.toolbar).p_2().child(
|
h_stack().bg(theme.toolbar).p_2().child(
|
||||||
|
|
|
@ -24,7 +24,7 @@ impl<S: 'static + Send + Sync> ChatPanel<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
div()
|
div()
|
||||||
.id(self.element_id.clone())
|
.id(self.element_id.clone())
|
||||||
.flex()
|
.flex()
|
||||||
|
@ -88,7 +88,7 @@ impl<S: 'static + Send + Sync> ChatMessage<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
.flex_col()
|
.flex_col()
|
||||||
|
@ -129,11 +129,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, ChatPanel<S>>(cx))
|
.child(Story::title_for::<_, ChatPanel<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -19,7 +19,7 @@ impl<S: 'static + Send + Sync> CollabPanel<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
v_stack()
|
v_stack()
|
||||||
|
@ -110,11 +110,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, CollabPanel<S>>(cx))
|
.child(Story::title_for::<_, CollabPanel<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync> CommandPalette<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
div().id(self.id.clone()).child(
|
div().id(self.id.clone()).child(
|
||||||
Palette::new("palette")
|
Palette::new("palette")
|
||||||
.items(example_editor_actions())
|
.items(example_editor_actions())
|
||||||
|
@ -49,11 +49,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, CommandPalette<S>>(cx))
|
.child(Story::title_for::<_, CommandPalette<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -42,7 +42,7 @@ impl<S: 'static + Send + Sync> ContextMenu<S> {
|
||||||
items: items.into_iter().collect(),
|
items: items.into_iter().collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
v_stack()
|
v_stack()
|
||||||
|
@ -85,11 +85,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, ContextMenu<S>>(cx))
|
.child(Story::title_for::<_, ContextMenu<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl<S: 'static + Send + Sync + Clone> CopilotModal<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
div().id(self.id.clone()).child(
|
div().id(self.id.clone()).child(
|
||||||
Modal::new("some-id")
|
Modal::new("some-id")
|
||||||
.title("Connect Copilot to Zed")
|
.title("Connect Copilot to Zed")
|
||||||
|
@ -47,11 +47,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, CopilotModal<S>>(cx))
|
.child(Story::title_for::<_, CopilotModal<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -49,7 +49,7 @@ impl EditorPane {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<Self> {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoAnyElement<Self> {
|
||||||
v_stack()
|
v_stack()
|
||||||
.w_full()
|
.w_full()
|
||||||
.h_full()
|
.h_full()
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync> Facepile<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let player_count = self.players.len();
|
let player_count = self.players.len();
|
||||||
let player_list = self.players.iter().enumerate().map(|(ix, player)| {
|
let player_list = self.players.iter().enumerate().map(|(ix, player)| {
|
||||||
let isnt_last = ix < player_count - 1;
|
let isnt_last = ix < player_count - 1;
|
||||||
|
@ -51,11 +51,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
let players = static_players();
|
let players = static_players();
|
||||||
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
|
|
|
@ -68,7 +68,7 @@ impl<S: 'static + Send + Sync> IconButton<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
let icon_color = match (self.state, self.color) {
|
let icon_color = match (self.state, self.color) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl<S: 'static + Send + Sync> Keybinding<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
.gap_2()
|
.gap_2()
|
||||||
|
@ -68,7 +68,7 @@ impl<S: 'static + Send + Sync> Key<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
|
@ -185,11 +185,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
let all_modifier_permutations = ModifierKey::iter().permutations(2);
|
let all_modifier_permutations = ModifierKey::iter().permutations(2);
|
||||||
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> LanguageSelector<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
div().id(self.id.clone()).child(
|
div().id(self.id.clone()).child(
|
||||||
Palette::new("palette")
|
Palette::new("palette")
|
||||||
.items(vec![
|
.items(vec![
|
||||||
|
@ -60,11 +60,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, LanguageSelector<S>>(cx))
|
.child(Story::title_for::<_, LanguageSelector<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -92,7 +92,7 @@ impl<S: 'static + Send + Sync> ListHeader<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
let is_toggleable = self.toggleable != Toggleable::NotToggleable;
|
let is_toggleable = self.toggleable != Toggleable::NotToggleable;
|
||||||
|
@ -157,7 +157,7 @@ impl<S: 'static + Send + Sync> ListSubHeader<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
h_stack().flex_1().w_full().relative().py_1().child(
|
h_stack().flex_1().w_full().relative().py_1().child(
|
||||||
div()
|
div()
|
||||||
.h_6()
|
.h_6()
|
||||||
|
@ -230,7 +230,7 @@ impl<S: 'static + Send + Sync> From<ListSubHeader<S>> for ListItem<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: 'static + Send + Sync> ListItem<S> {
|
impl<S: 'static + Send + Sync> ListItem<S> {
|
||||||
fn render(&mut self, view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
match self {
|
match self {
|
||||||
ListItem::Entry(entry) => div().child(entry.render(view, cx)),
|
ListItem::Entry(entry) => div().child(entry.render(view, cx)),
|
||||||
ListItem::Separator(separator) => div().child(separator.render(view, cx)),
|
ListItem::Separator(separator) => div().child(separator.render(view, cx)),
|
||||||
|
@ -344,10 +344,7 @@ impl<S: 'static + Send + Sync> ListEntry<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn disclosure_control(
|
fn disclosure_control(&mut self, cx: &mut ViewContext<S>) -> Option<impl IntoAnyElement<S>> {
|
||||||
&mut self,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> Option<impl Element<S>> {
|
|
||||||
let disclosure_control_icon = if let Some(ToggleState::Toggled) = self.toggle {
|
let disclosure_control_icon = if let Some(ToggleState::Toggled) = self.toggle {
|
||||||
IconElement::new(Icon::ChevronDown)
|
IconElement::new(Icon::ChevronDown)
|
||||||
} else {
|
} else {
|
||||||
|
@ -367,7 +364,7 @@ impl<S: 'static + Send + Sync> ListEntry<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let settings = user_settings(cx);
|
let settings = user_settings(cx);
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
|
@ -477,7 +474,7 @@ impl<S: 'static + Send + Sync> ListDetailsEntry<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
let settings = user_settings(cx);
|
let settings = user_settings(cx);
|
||||||
|
|
||||||
|
@ -534,7 +531,7 @@ impl<S: 'static + Send + Sync> ListSeparator<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
div().h_px().w_full().bg(theme.border)
|
div().h_px().w_full().bg(theme.border)
|
||||||
|
@ -574,7 +571,7 @@ impl<S: 'static + Send + Sync> List<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let is_toggleable = self.toggleable != Toggleable::NotToggleable;
|
let is_toggleable = self.toggleable != Toggleable::NotToggleable;
|
||||||
let is_toggled = Toggleable::is_toggled(&self.toggleable);
|
let is_toggled = Toggleable::is_toggled(&self.toggleable);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ impl<S: 'static + Send + Sync> Modal<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
v_stack()
|
v_stack()
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> MultiBuffer<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
v_stack()
|
v_stack()
|
||||||
|
@ -62,11 +62,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl<S: 'static + Send + Sync + Clone> NotificationToast<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
h_stack()
|
h_stack()
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync> NotificationsPanel<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
|
@ -70,11 +70,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, NotificationsPanel<S>>(cx))
|
.child(Story::title_for::<_, NotificationsPanel<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -46,7 +46,7 @@ impl<S: 'static + Send + Sync> Palette<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
v_stack()
|
v_stack()
|
||||||
|
@ -135,7 +135,7 @@ impl<S: 'static + Send + Sync> PaletteItem<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
.flex_row()
|
.flex_row()
|
||||||
|
@ -172,11 +172,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, Palette<S>>(cx))
|
.child(Story::title_for::<_, Palette<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -96,7 +96,7 @@ impl<S: 'static + Send + Sync> Panel<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
let current_size = self.width.unwrap_or(self.initial_width);
|
let current_size = self.width.unwrap_or(self.initial_width);
|
||||||
|
@ -148,11 +148,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, Panel<S>>(cx))
|
.child(Story::title_for::<_, Panel<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -101,7 +101,7 @@ impl<V: 'static + Send + Sync> PaneGroup<V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, view: &mut V, cx: &mut ViewContext<V>) -> impl Element<V> {
|
fn render(&mut self, view: &mut V, cx: &mut ViewContext<V>) -> impl IntoAnyElement<V> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
if !self.panes.is_empty() {
|
if !self.panes.is_empty() {
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync> PlayerStack<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
let player = self.player_with_call_status.get_player();
|
let player = self.player_with_call_status.get_player();
|
||||||
self.player_with_call_status.get_call_status();
|
self.player_with_call_status.get_call_status();
|
||||||
|
|
|
@ -19,7 +19,7 @@ impl<S: 'static + Send + Sync> ProjectPanel<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
|
@ -79,11 +79,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, ProjectPanel<S>>(cx))
|
.child(Story::title_for::<_, ProjectPanel<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> RecentProjects<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
div().id(self.id.clone()).child(
|
div().id(self.id.clone()).child(
|
||||||
Palette::new("palette")
|
Palette::new("palette")
|
||||||
.items(vec![
|
.items(vec![
|
||||||
|
@ -56,11 +56,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, RecentProjects<S>>(cx))
|
.child(Story::title_for::<_, RecentProjects<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -86,7 +86,7 @@ impl StatusBar {
|
||||||
&mut self,
|
&mut self,
|
||||||
view: &mut Workspace,
|
view: &mut Workspace,
|
||||||
cx: &mut ViewContext<Workspace>,
|
cx: &mut ViewContext<Workspace>,
|
||||||
) -> impl Element<Workspace> {
|
) -> impl IntoAnyElement<Workspace> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
|
@ -101,7 +101,11 @@ impl StatusBar {
|
||||||
.child(self.right_tools(view, cx))
|
.child(self.right_tools(view, cx))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn left_tools(&self, workspace: &mut Workspace, cx: &WindowContext) -> impl Element<Workspace> {
|
fn left_tools(
|
||||||
|
&self,
|
||||||
|
workspace: &mut Workspace,
|
||||||
|
cx: &WindowContext,
|
||||||
|
) -> impl IntoAnyElement<Workspace> {
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
.items_center()
|
.items_center()
|
||||||
|
@ -132,7 +136,7 @@ impl StatusBar {
|
||||||
&self,
|
&self,
|
||||||
workspace: &mut Workspace,
|
workspace: &mut Workspace,
|
||||||
cx: &WindowContext,
|
cx: &WindowContext,
|
||||||
) -> impl Element<Workspace> {
|
) -> impl IntoAnyElement<Workspace> {
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
.items_center()
|
.items_center()
|
||||||
|
|
|
@ -81,7 +81,7 @@ impl<S: 'static + Send + Sync + Clone> Tab<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
let has_fs_conflict = self.fs_status == FileSystemStatus::Conflict;
|
let has_fs_conflict = self.fs_status == FileSystemStatus::Conflict;
|
||||||
let is_deleted = self.fs_status == FileSystemStatus::Deleted;
|
let is_deleted = self.fs_status == FileSystemStatus::Deleted;
|
||||||
|
@ -188,11 +188,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
let git_statuses = GitStatus::iter();
|
let git_statuses = GitStatus::iter();
|
||||||
let fs_statuses = FileSystemStatus::iter();
|
let fs_statuses = FileSystemStatus::iter();
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ impl<S: 'static + Send + Sync + Clone> TabBar<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
let (can_navigate_back, can_navigate_forward) = self.can_navigate;
|
let (can_navigate_back, can_navigate_forward) = self.can_navigate;
|
||||||
|
@ -112,11 +112,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, TabBar<S>>(cx))
|
.child(Story::title_for::<_, TabBar<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> Terminal<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
let can_navigate_back = true;
|
let can_navigate_back = true;
|
||||||
|
@ -105,11 +105,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, Terminal<S>>(cx))
|
.child(Story::title_for::<_, Terminal<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync> ThemeSelector<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
div().child(
|
div().child(
|
||||||
Palette::new(self.id.clone())
|
Palette::new(self.id.clone())
|
||||||
.items(vec![
|
.items(vec![
|
||||||
|
@ -61,11 +61,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, ThemeSelector<S>>(cx))
|
.child(Story::title_for::<_, ThemeSelector<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -87,7 +87,7 @@ impl TitleBar {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<Self> {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoAnyElement<Self> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
let settings = user_settings(cx);
|
let settings = user_settings(cx);
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ mod stories {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<Self> {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoAnyElement<Self> {
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, TitleBar>(cx))
|
.child(Story::title_for::<_, TitleBar>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -36,7 +36,7 @@ impl<S: 'static + Send + Sync> Toast<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
let mut div = div();
|
let mut div = div();
|
||||||
|
@ -90,7 +90,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, Toast<S>>(cx))
|
.child(Story::title_for::<_, Toast<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -54,7 +54,7 @@ impl<S: 'static + Send + Sync> Toolbar<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
|
@ -92,11 +92,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl<S: 'static + Send + Sync> TrafficLight<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
let fill = match (self.window_has_focus, self.color) {
|
let fill = match (self.window_has_focus, self.color) {
|
||||||
|
@ -58,7 +58,7 @@ impl<S: 'static + Send + Sync> TrafficLights<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
.items_center()
|
.items_center()
|
||||||
|
@ -99,11 +99,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, TrafficLights<S>>(cx))
|
.child(Story::title_for::<_, TrafficLights<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -174,7 +174,7 @@ impl Workspace {
|
||||||
view(cx.entity(|cx| Self::new(cx)), Self::render)
|
view(cx.entity(|cx| Self::new(cx)), Self::render)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<Self> {
|
pub fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoAnyElement<Self> {
|
||||||
let theme = old_theme(cx).clone();
|
let theme = old_theme(cx).clone();
|
||||||
|
|
||||||
// HACK: This should happen inside of `debug_toggle_user_settings`, but
|
// HACK: This should happen inside of `debug_toggle_user_settings`, but
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl<S: 'static + Send + Sync> Avatar<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
let mut img = img();
|
let mut img = img();
|
||||||
|
@ -63,11 +63,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, Avatar<S>>(cx))
|
.child(Story::title_for::<_, Avatar<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -150,11 +150,7 @@ impl<S: 'static + Send + Sync> Button<S> {
|
||||||
self.icon.map(|i| IconElement::new(i).color(icon_color))
|
self.icon.map(|i| IconElement::new(i).color(icon_color))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render(
|
pub fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
let icon_color = self.icon_color();
|
let icon_color = self.icon_color();
|
||||||
|
|
||||||
let mut button = h_stack()
|
let mut button = h_stack()
|
||||||
|
@ -211,7 +207,7 @@ impl<S: 'static + Send + Sync> ButtonGroup<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let mut el = h_stack().text_size(ui_size(cx, 1.));
|
let mut el = h_stack().text_size(ui_size(cx, 1.));
|
||||||
|
|
||||||
for button in &mut self.buttons {
|
for button in &mut self.buttons {
|
||||||
|
@ -246,11 +242,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
let states = InteractionState::iter();
|
let states = InteractionState::iter();
|
||||||
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
|
|
|
@ -30,7 +30,7 @@ impl<S: 'static + Send + Sync> Details<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
v_stack()
|
v_stack()
|
||||||
|
@ -66,11 +66,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, Details<S>>(cx))
|
.child(Story::title_for::<_, Details<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -176,7 +176,7 @@ impl<S: 'static + Send + Sync> IconElement<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let fill = self.color.color(cx);
|
let fill = self.color.color(cx);
|
||||||
let svg_size = match self.size {
|
let svg_size = match self.size {
|
||||||
IconSize::Small => ui_size(cx, 12. / 14.),
|
IconSize::Small => ui_size(cx, 12. / 14.),
|
||||||
|
@ -214,11 +214,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
let icons = Icon::iter();
|
let icons = Icon::iter();
|
||||||
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
|
|
|
@ -60,7 +60,7 @@ impl<S: 'static + Send + Sync> Input<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
let (input_bg, input_hover_bg, input_active_bg) = match self.variant {
|
let (input_bg, input_hover_bg, input_active_bg) = match self.variant {
|
||||||
|
@ -132,11 +132,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, Input<S>>(cx))
|
.child(Story::title_for::<_, Input<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -83,7 +83,7 @@ impl<S: 'static + Send + Sync> Label<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
div()
|
div()
|
||||||
.when(self.strikethrough, |this| {
|
.when(self.strikethrough, |this| {
|
||||||
this.relative().child(
|
this.relative().child(
|
||||||
|
@ -135,7 +135,7 @@ impl<S: 'static + Send + Sync> HighlightedLabel<S> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
let highlight_color = theme.text_accent;
|
let highlight_color = theme.text_accent;
|
||||||
|
@ -223,11 +223,7 @@ mod stories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
&mut self,
|
|
||||||
_view: &mut S,
|
|
||||||
cx: &mut ViewContext<S>,
|
|
||||||
) -> impl Element<S> {
|
|
||||||
Story::container(cx)
|
Story::container(cx)
|
||||||
.child(Story::title_for::<_, Label<S>>(cx))
|
.child(Story::title_for::<_, Label<S>>(cx))
|
||||||
.child(Story::label(cx, "Default"))
|
.child(Story::label(cx, "Default"))
|
||||||
|
|
|
@ -14,7 +14,7 @@ impl<S: 'static + Send + Sync> ToolDivider<S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<S> {
|
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
div().w_px().h_3().bg(theme.border)
|
div().w_px().h_3().bg(theme.border)
|
||||||
|
|
|
@ -21,7 +21,7 @@ impl Story {
|
||||||
pub fn title<S: 'static + Send + Sync>(
|
pub fn title<S: 'static + Send + Sync>(
|
||||||
cx: &mut ViewContext<S>,
|
cx: &mut ViewContext<S>,
|
||||||
title: &str,
|
title: &str,
|
||||||
) -> impl Element<S> {
|
) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
|
@ -32,14 +32,14 @@ impl Story {
|
||||||
|
|
||||||
pub fn title_for<S: 'static + Send + Sync, T>(
|
pub fn title_for<S: 'static + Send + Sync, T>(
|
||||||
cx: &mut ViewContext<S>,
|
cx: &mut ViewContext<S>,
|
||||||
) -> impl Element<S> {
|
) -> impl IntoAnyElement<S> {
|
||||||
Self::title(cx, std::any::type_name::<T>())
|
Self::title(cx, std::any::type_name::<T>())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn label<S: 'static + Send + Sync>(
|
pub fn label<S: 'static + Send + Sync>(
|
||||||
cx: &mut ViewContext<S>,
|
cx: &mut ViewContext<S>,
|
||||||
label: &str,
|
label: &str,
|
||||||
) -> impl Element<S> {
|
) -> impl IntoAnyElement<S> {
|
||||||
let theme = theme(cx);
|
let theme = theme(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue