Detailed changes
@@ -21,30 +21,35 @@ pub fn derive_element(input: TokenStream) -> TokenStream {
impl #impl_generics gpui3::Element for #type_name #ty_generics
#where_clause
{
- type State = #state_type;
- type FrameState = gpui3::AnyElement<#state_type>;
+ type ViewState = #state_type;
+ type ElementState = gpui3::AnyElement<#state_type>;
+
+ fn element_id(&self) -> Option<gpui3::ElementId> {
+ None
+ }
fn layout(
&mut self,
state: &mut #state_type,
- cx: &mut gpui3::ViewContext<Self::State>,
- ) -> anyhow::Result<(gpui3::LayoutId, Self::FrameState)> {
+ element_state: Option<Self::ElementState>,
+ cx: &mut gpui3::ViewContext<Self::ViewState>,
+ ) -> (gpui3::LayoutId, Self::ElementState) {
use gpui3::IntoAnyElement;
let mut rendered_element = self.render(cx).into_any();
- let layout_id = rendered_element.layout(state, cx)?;
- Ok((layout_id, rendered_element))
+ let layout_id = rendered_element.layout(state, cx);
+ (layout_id, rendered_element)
}
fn paint(
&mut self,
bounds: gpui3::Bounds<gpui3::Pixels>,
- state: &mut Self::State,
- rendered_element: &mut Self::FrameState,
- cx: &mut gpui3::ViewContext<Self::State>,
- ) -> anyhow::Result<()> {
+ state: &mut Self::ViewState,
+ element_state: &mut Self::ElementState,
+ cx: &mut gpui3::ViewContext<Self::ViewState>,
+ ) {
// TODO: Where do we get the `offset` from?
- rendered_element.paint(state, None, cx)
+ element_state.paint(state, None, cx)
}
}
};
@@ -18,7 +18,7 @@ impl<S: 'static + Send + Sync + Clone> KitchenSinkStory<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let element_stories = ElementStory::iter().map(|selector| selector.story());
let component_stories = ComponentStory::iter().map(|selector| selector.story());
@@ -19,7 +19,7 @@ impl<S: 'static + Send + Sync> ZIndexStory<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title(cx, "z-index"))
.child(
@@ -103,7 +103,7 @@ impl<S: 'static + Send + Sync> ZIndexExample<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div()
.relative()
.size_full()
@@ -4,4 +4,4 @@ use gpui3::{AnyElement, ViewContext};
pub type HackyChildren<S> = fn(&mut ViewContext<S>, &dyn Any) -> Vec<AnyElement<S>>;
-pub type HackyChildrenPayload = Box<dyn Any>;
+pub type HackyChildrenPayload = Box<dyn Any + Send + Sync>;
@@ -26,7 +26,7 @@ impl<S: 'static + Send + Sync + Clone> AssistantPanel<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
struct PanelPayload {
@@ -110,7 +110,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, AssistantPanel<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -31,7 +31,7 @@ impl<S: 'static + Send + Sync + Clone> Breadcrumb<S> {
.text_color(HighlightColor::Default.hsla(theme))
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let symbols_len = self.symbols.len();
@@ -99,7 +99,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
Story::container(cx)
@@ -162,7 +162,7 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
self
}
- fn render_row(row: BufferRow, cx: &WindowContext) -> impl Element<State = S> {
+ fn render_row(row: BufferRow, cx: &WindowContext) -> impl Element<ViewState = S> {
let theme = theme(cx);
let system_color = SystemColor::new();
@@ -213,7 +213,7 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
}))
}
- fn render_rows(&self, cx: &WindowContext) -> Vec<impl Element<State = S>> {
+ fn render_rows(&self, cx: &WindowContext) -> Vec<impl Element<ViewState = S>> {
match &self.rows {
Some(rows) => rows
.rows
@@ -224,7 +224,7 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let rows = self.render_rows(cx);
@@ -263,7 +263,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
Story::container(cx)
@@ -25,7 +25,7 @@ impl<S: 'static + Send + Sync + Clone> ChatPanel<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -89,7 +89,7 @@ impl<S: 'static + Send + Sync + Clone> ChatMessage<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div()
.flex()
.flex_col()
@@ -130,7 +130,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, ChatPanel<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -23,7 +23,7 @@ impl<S: 'static + Send + Sync + Clone> CollabPanel<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let color = ThemeColor::new(cx);
@@ -103,7 +103,7 @@ impl<S: 'static + Send + Sync + Clone> CollabPanel<S> {
label: impl Into<ArcCow<'static, str>>,
expanded: bool,
theme: &Theme,
- ) -> impl Element<State = S> {
+ ) -> impl Element<ViewState = S> {
div()
.h_7()
.px_2()
@@ -131,7 +131,7 @@ impl<S: 'static + Send + Sync + Clone> CollabPanel<S> {
avatar_uri: impl Into<ArcCow<'static, str>>,
label: impl Into<ArcCow<'static, str>>,
theme: &Theme,
- ) -> impl Element<State = S> {
+ ) -> impl Element<ViewState = S> {
div()
.h_7()
.px_2()
@@ -180,7 +180,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, CollabPanel<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> CommandPalette<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div().child(
Palette::new(self.scroll_state.clone())
.items(example_editor_actions())
@@ -49,7 +49,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, CommandPalette<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -43,7 +43,7 @@ impl<S: 'static + Send + Sync + Clone> ContextMenu<S> {
items: items.into_iter().collect(),
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
v_stack()
@@ -87,7 +87,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, ContextMenu<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -20,7 +20,7 @@ impl<S: 'static + Send + Sync + Clone> EditorPane<S> {
Self { editor }
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
struct LeftItemsPayload {
path: PathBuf,
symbols: Vec<Symbol>,
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync> Facepile<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let player_count = self.players.len();
let player_list = self.players.iter().enumerate().map(|(ix, player)| {
@@ -52,7 +52,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let players = static_players();
Story::container(cx)
@@ -66,7 +66,7 @@ impl<S: 'static + Send + Sync> IconButton<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let icon_color = match (self.state, self.color) {
@@ -35,7 +35,7 @@ impl<S: 'static + Send + Sync + Clone> Keybinding<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div()
.flex()
.gap_2()
@@ -72,7 +72,7 @@ impl<S: 'static + Send + Sync> Key<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -189,7 +189,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let all_modifier_permutations = ModifierKey::iter().permutations(2);
Story::container(cx)
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> LanguageSelector<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div().child(
Palette::new(self.scroll_state.clone())
.items(vec![
@@ -60,7 +60,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, LanguageSelector<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -92,7 +92,7 @@ impl<S: 'static + Send + Sync + Clone> ListHeader<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let token = token();
let system_color = SystemColor::new();
@@ -164,7 +164,7 @@ impl<S: 'static + Send + Sync + Clone> ListSubHeader<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let token = token();
@@ -237,7 +237,7 @@ impl<S: 'static + Send + Sync + Clone> From<ListSubHeader<S>> for ListItem<S> {
}
impl<S: 'static + Send + Sync + Clone> ListItem<S> {
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
match self {
ListItem::Entry(entry) => div().child(entry.render(cx)),
ListItem::Separator(separator) => div().child(separator.render(cx)),
@@ -346,7 +346,7 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
}
}
- fn disclosure_control(&mut self, cx: &mut ViewContext<S>) -> Option<impl Element<State = S>> {
+ fn disclosure_control(&mut self, cx: &mut ViewContext<S>) -> Option<impl Element<ViewState = S>> {
let theme = theme(cx);
let token = token();
@@ -369,7 +369,7 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let token = token();
let system_color = SystemColor::new();
@@ -437,7 +437,7 @@ impl<S: 'static + Send + Sync> ListSeparator<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let color = ThemeColor::new(cx);
div().h_px().w_full().fill(color.border)
@@ -477,7 +477,7 @@ impl<S: 'static + Send + Sync + Clone> List<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let token = token();
let is_toggleable = self.toggleable != Toggleable::NotToggleable;
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> MultiBuffer<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
v_stack()
@@ -62,7 +62,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
Story::container(cx)
@@ -47,7 +47,7 @@ impl<S: 'static + Send + Sync + Clone> Palette<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
v_stack()
@@ -134,7 +134,7 @@ impl<S: 'static + Send + Sync + Clone> PaletteItem<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -172,7 +172,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Palette<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -100,7 +100,7 @@ impl<S: 'static + Send + Sync> Panel<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let token = token();
let theme = theme(cx);
@@ -165,7 +165,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Panel<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -48,7 +48,7 @@ impl<S: 'static + Send + Sync> Pane<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -89,7 +89,7 @@ impl<S: 'static + Send + Sync> PaneGroup<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
if !self.panes.is_empty() {
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync> PlayerStack<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let system_color = SystemColor::new();
let player = self.player_with_call_status.get_player();
self.player_with_call_status.get_call_status();
@@ -20,7 +20,7 @@ impl<S: 'static + Send + Sync + Clone> ProjectPanel<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let color = ThemeColor::new(cx);
@@ -78,7 +78,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, ProjectPanel<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> RecentProjects<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div().child(
Palette::new(self.scroll_state.clone())
.items(vec![
@@ -56,7 +56,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, RecentProjects<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -83,7 +83,7 @@ impl<S: 'static + Send + Sync + Clone> StatusBar<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -98,7 +98,7 @@ impl<S: 'static + Send + Sync + Clone> StatusBar<S> {
.child(self.right_tools(&theme))
}
- fn left_tools(&self, theme: &Theme) -> impl Element<State = S> {
+ fn left_tools(&self, theme: &Theme) -> impl Element<ViewState = S> {
let workspace_state = get_workspace_state();
div()
@@ -129,7 +129,7 @@ impl<S: 'static + Send + Sync + Clone> StatusBar<S> {
.child(IconButton::new(Icon::XCircle))
}
- fn right_tools(&self, theme: &Theme) -> impl Element<State = S> {
+ fn right_tools(&self, theme: &Theme) -> impl Element<ViewState = S> {
let workspace_state = get_workspace_state();
div()
@@ -74,7 +74,7 @@ impl<S: 'static + Send + Sync + Clone> Tab<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let has_fs_conflict = self.fs_status == FileSystemStatus::Conflict;
let is_deleted = self.fs_status == FileSystemStatus::Deleted;
@@ -157,7 +157,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let git_statuses = GitStatus::iter();
let fs_statuses = FileSystemStatus::iter();
@@ -23,7 +23,7 @@ impl<S: 'static + Send + Sync + Clone> TabBar<S> {
self.scroll_state = scroll_state;
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let can_navigate_back = true;
let can_navigate_forward = false;
@@ -105,7 +105,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, TabBar<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -18,7 +18,7 @@ impl<S: 'static + Send + Sync + Clone> Terminal<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let can_navigate_back = true;
@@ -109,7 +109,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Terminal<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> ThemeSelector<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div().child(
Palette::new(self.scroll_state.clone())
.items(vec![
@@ -61,7 +61,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, ThemeSelector<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -46,7 +46,7 @@ impl<S: 'static + Send + Sync + Clone> TitleBar<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
// let has_focus = cx.window_is_active();
let has_focus = true;
@@ -139,7 +139,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, TitleBar<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -41,7 +41,7 @@ impl<S: 'static + Send + Sync> Toast<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let color = ThemeColor::new(cx);
let mut div = div();
@@ -89,7 +89,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Toast<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -27,7 +27,7 @@ impl<S: 'static + Send + Sync> Toolbar<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -74,7 +74,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
struct LeftItemsPayload {
@@ -26,7 +26,7 @@ impl<S: 'static + Send + Sync> TrafficLight<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let system_color = SystemColor::new();
@@ -60,7 +60,7 @@ impl<S: 'static + Send + Sync> TrafficLights<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let token = token();
@@ -104,7 +104,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, TrafficLights<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -125,7 +125,7 @@ impl<S: 'static + Send + Sync + Clone> WorkspaceElement<S> {
}
}
- pub fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ pub fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx).clone();
let workspace_state = get_workspace_state();
@@ -353,7 +353,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
// Just render the workspace without any story boilerplate.
WorkspaceElement::new()
}
@@ -1,6 +1,6 @@
use gpui3::Element;
-pub trait ElementExt<S: 'static + Send + Sync>: Element<State = S> {
+pub trait ElementExt<S: 'static + Send + Sync>: Element<ViewState = S> {
/// Applies a given function `then` to the current element if `condition` is true.
/// This function is used to conditionally modify the element based on a given condition.
/// If `condition` is false, it just returns the current element as it is.
@@ -15,4 +15,4 @@ pub trait ElementExt<S: 'static + Send + Sync>: Element<State = S> {
}
}
-impl<S: 'static + Send + Sync, E: Element<State = S>> ElementExt<S> for E {}
+impl<S: 'static + Send + Sync, E: Element<ViewState = S>> ElementExt<S> for E {}
@@ -26,7 +26,7 @@ impl<S: 'static + Send + Sync> Avatar<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let mut img = img();
@@ -64,7 +64,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Avatar<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -160,7 +160,7 @@ impl<S: 'static + Send + Sync + Clone> Button<S> {
self.icon.map(|i| IconElement::new(i).color(icon_color))
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let icon_color = self.icon_color();
let system_color = SystemColor::new();
@@ -229,7 +229,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let states = InteractionState::iter();
Story::container(cx)
@@ -24,7 +24,7 @@ impl<S: 'static + Send + Sync + Clone> Details<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -60,7 +60,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Details<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -170,7 +170,7 @@ impl<S: 'static + Send + Sync> IconElement<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let fill = self.color.color(theme);
@@ -206,7 +206,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let icons = Icon::iter();
Story::container(cx)
@@ -45,7 +45,7 @@ impl<S: 'static + Send + Sync> Input<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let text_el;
@@ -128,7 +128,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Input<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -90,7 +90,7 @@ impl<S: 'static + Send + Sync + Clone> Label<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let highlight_color = theme.lowest.accent.default.foreground;
@@ -185,7 +185,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Label<S>>(cx))
.child(Story::label(cx, "Default"))
@@ -14,18 +14,18 @@ pub trait Stack: StyleHelpers {
}
}
-impl<S> Stack for Div<S> {}
+impl<S: 'static + Send + Sync> Stack for Div<S> {}
/// Horizontally stacks elements.
///
/// Sets `flex()`, `flex_row()`, `items_center()`
-pub fn h_stack<S: 'static>() -> Div<S> {
+pub fn h_stack<S: 'static + Send + Sync>() -> Div<S> {
div().h_stack()
}
/// Vertically stacks elements.
///
/// Sets `flex()`, `flex_col()`
-pub fn v_stack<S: 'static>() -> Div<S> {
+pub fn v_stack<S: 'static + Send + Sync>() -> Div<S> {
div().v_stack()
}
@@ -15,7 +15,7 @@ impl<S: 'static + Send + Sync> ToolDivider<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div().w_px().h_3().fill(theme.lowest.base.default.border)
@@ -22,7 +22,7 @@ impl Story {
pub fn title<S: 'static + Send + Sync>(
cx: &mut ViewContext<S>,
title: &str,
- ) -> impl Element<State = S> {
+ ) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -33,14 +33,14 @@ impl Story {
pub fn title_for<S: 'static + Send + Sync, T>(
cx: &mut ViewContext<S>,
- ) -> impl Element<State = S> {
+ ) -> impl Element<ViewState = S> {
Self::title(cx, std::any::type_name::<T>())
}
pub fn label<S: 'static + Send + Sync>(
cx: &mut ViewContext<S>,
label: &str,
- ) -> impl Element<State = S> {
+ ) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()