Rename back to div

This commit is contained in:
Nathan Sobo 2023-11-14 01:41:55 -07:00
parent be18c47912
commit c6e8a097a3
62 changed files with 154 additions and 156 deletions

View file

@ -1,8 +1,8 @@
use collections::{CommandPaletteFilter, HashMap};
use fuzzy::{StringMatch, StringMatchCandidate};
use gpui::{
actions, div, prelude::*, Action, AppContext, Component, EventEmitter, FocusHandle, Keystroke,
Node, ParentComponent, Render, Styled, View, ViewContext, VisualContext, WeakView,
actions, div, prelude::*, Action, AppContext, Component, Div, EventEmitter, FocusHandle,
Keystroke, ParentComponent, Render, Styled, View, ViewContext, VisualContext, WeakView,
WindowContext,
};
use picker::{Picker, PickerDelegate};
@ -77,7 +77,7 @@ impl Modal for CommandPalette {
}
impl Render for CommandPalette {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
v_stack().w_96().child(self.picker.clone())
@ -148,7 +148,7 @@ impl CommandPaletteDelegate {
}
impl PickerDelegate for CommandPaletteDelegate {
type ListItem = Node<Picker<Self>>;
type ListItem = Div<Picker<Self>>;
fn placeholder_text(&self) -> Arc<str> {
"Execute a command...".into()

View file

@ -1,7 +1,7 @@
use editor::{display_map::ToDisplayPoint, scroll::autoscroll::Autoscroll, Editor};
use gpui::{
actions, div, prelude::*, AppContext, EventEmitter, Node, ParentComponent, Render,
SharedString, Styled, Subscription, View, ViewContext, VisualContext, WindowContext,
actions, div, prelude::*, AppContext, Div, EventEmitter, ParentComponent, Render, SharedString,
Styled, Subscription, View, ViewContext, VisualContext, WindowContext,
};
use text::{Bias, Point};
use theme::ActiveTheme;
@ -145,7 +145,7 @@ impl GoToLine {
}
impl Render for GoToLine {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
modal(cx)

View file

@ -538,37 +538,37 @@ pub type KeyUpListener<V> =
pub type ActionListener<V> =
Box<dyn Fn(&mut V, &dyn Any, DispatchPhase, &mut ViewContext<V>) + 'static>;
pub fn div<V: 'static>() -> Node<V> {
Node {
pub fn div<V: 'static>() -> Div<V> {
Div {
interactivity: Interactivity::default(),
children: SmallVec::default(),
}
}
pub struct Node<V> {
pub struct Div<V> {
interactivity: Interactivity<V>,
children: SmallVec<[AnyElement<V>; 2]>,
}
impl<V> Styled for Node<V> {
impl<V> Styled for Div<V> {
fn style(&mut self) -> &mut StyleRefinement {
&mut self.interactivity.base_style
}
}
impl<V: 'static> InteractiveComponent<V> for Node<V> {
impl<V: 'static> InteractiveComponent<V> for Div<V> {
fn interactivity(&mut self) -> &mut Interactivity<V> {
&mut self.interactivity
}
}
impl<V: 'static> ParentComponent<V> for Node<V> {
impl<V: 'static> ParentComponent<V> for Div<V> {
fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<V>; 2]> {
&mut self.children
}
}
impl<V: 'static> Element<V> for Node<V> {
impl<V: 'static> Element<V> for Div<V> {
type ElementState = NodeState;
fn element_id(&self) -> Option<ElementId> {
@ -671,7 +671,7 @@ impl<V: 'static> Element<V> for Node<V> {
}
}
impl<V: 'static> Component<V> for Node<V> {
impl<V: 'static> Component<V> for Div<V> {
fn render(self) -> AnyElement<V> {
AnyElement::new(self)
}

View file

@ -1,13 +1,11 @@
// mod div;
mod div;
mod img;
mod node;
mod svg;
mod text;
mod uniform_list;
// pub use div::*;
pub use div::*;
pub use img::*;
pub use node::*;
pub use svg::*;
pub use text::*;
pub use uniform_list::*;

View file

@ -1,5 +1,5 @@
use crate::{
div, point, Component, FocusHandle, Keystroke, Modifiers, Node, Pixels, Point, Render,
div, point, Component, FocusHandle, Keystroke, Modifiers, Div, Pixels, Point, Render,
ViewContext,
};
use smallvec::SmallVec;
@ -194,7 +194,7 @@ impl Deref for MouseExitEvent {
pub struct ExternalPaths(pub(crate) SmallVec<[PathBuf; 2]>);
impl Render for ExternalPaths {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Element {
div() // Intentionally left empty because the platform will render icons for the dragged files
@ -286,7 +286,7 @@ pub struct FocusEvent {
#[cfg(test)]
mod test {
use crate::{
self as gpui, div, FocusHandle, InteractiveComponent, KeyBinding, Keystroke, Node,
self as gpui, div, FocusHandle, InteractiveComponent, KeyBinding, Keystroke, Div,
ParentComponent, Render, Stateful, TestAppContext, VisualContext,
};
@ -299,7 +299,7 @@ mod test {
actions!(TestAction);
impl Render for TestView {
type Element = Stateful<Self, Node<Self>>;
type Element = Stateful<Self, Div<Self>>;
fn render(&mut self, _: &mut gpui::ViewContext<Self>) -> Self::Element {
div().id("testview").child(

View file

@ -1,6 +1,6 @@
use editor::Editor;
use gpui::{
div, uniform_list, Component, Node, ParentComponent, Render, Styled, Task,
div, uniform_list, Component, Div, ParentComponent, Render, Styled, Task,
UniformListScrollHandle, View, ViewContext, VisualContext, WindowContext,
};
use std::{cmp, sync::Arc};
@ -139,7 +139,7 @@ impl<D: PickerDelegate> Picker<D> {
}
impl<D: PickerDelegate> Render for Picker<D> {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
div()

View file

@ -1,12 +1,12 @@
use crate::story::Story;
use gpui::{prelude::*, px, Node, Render};
use gpui::{prelude::*, px, Div, Render};
use theme2::{default_color_scales, ColorScaleStep};
use ui::prelude::*;
pub struct ColorsStory;
impl Render for ColorsStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let color_scales = default_color_scales();

View file

@ -1,5 +1,5 @@
use gpui::{
actions, div, prelude::*, FocusHandle, Focusable, KeyBinding, Node, Render, Stateful, View,
actions, div, prelude::*, FocusHandle, Focusable, KeyBinding, Div, Render, Stateful, View,
WindowContext,
};
use theme2::ActiveTheme;
@ -27,7 +27,7 @@ impl FocusStory {
}
impl Render for FocusStory {
type Element = Focusable<Self, Stateful<Self, Node<Self>>>;
type Element = Focusable<Self, Stateful<Self, Div<Self>>>;
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
let theme = cx.theme();

View file

@ -1,5 +1,5 @@
use crate::{story::Story, story_selector::ComponentStory};
use gpui::{prelude::*, Node, Render, Stateful, View};
use gpui::{prelude::*, Div, Render, Stateful, View};
use strum::IntoEnumIterator;
use ui::prelude::*;
@ -12,7 +12,7 @@ impl KitchenSinkStory {
}
impl Render for KitchenSinkStory {
type Element = Stateful<Self, Node<Self>>;
type Element = Stateful<Self, Div<Self>>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let component_stories = ComponentStory::iter()

View file

@ -1,5 +1,5 @@
use fuzzy::StringMatchCandidate;
use gpui::{div, prelude::*, KeyBinding, Node, Render, Styled, Task, View, WindowContext};
use gpui::{div, prelude::*, KeyBinding, Div, Render, Styled, Task, View, WindowContext};
use picker::{Picker, PickerDelegate};
use std::sync::Arc;
use theme2::ActiveTheme;
@ -34,7 +34,7 @@ impl Delegate {
}
impl PickerDelegate for Delegate {
type ListItem = Node<Picker<Self>>;
type ListItem = Div<Picker<Self>>;
fn match_count(&self) -> usize {
self.candidates.len()
@ -203,7 +203,7 @@ impl PickerStory {
}
impl Render for PickerStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
div()

View file

@ -1,5 +1,5 @@
use gpui::{
div, prelude::*, px, Node, Render, SharedString, Stateful, Styled, View, WindowContext,
div, prelude::*, px, Div, Render, SharedString, Stateful, Styled, View, WindowContext,
};
use theme2::ActiveTheme;
@ -12,7 +12,7 @@ impl ScrollStory {
}
impl Render for ScrollStory {
type Element = Stateful<Self, Node<Self>>;
type Element = Stateful<Self, Div<Self>>;
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
let theme = cx.theme();

View file

@ -1,4 +1,4 @@
use gpui::{div, white, Node, ParentComponent, Render, Styled, View, VisualContext, WindowContext};
use gpui::{div, white, Div, ParentComponent, Render, Styled, View, VisualContext, WindowContext};
pub struct TextStory;
@ -9,7 +9,7 @@ impl TextStory {
}
impl Render for TextStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
div().size_full().bg(white()).child(concat!(

View file

@ -1,4 +1,4 @@
use gpui::{px, rgb, Hsla, Node, Render};
use gpui::{px, rgb, Div, Hsla, Render};
use ui::prelude::*;
use crate::story::Story;
@ -8,7 +8,7 @@ use crate::story::Story;
pub struct ZIndexStory;
impl Render for ZIndexStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)
@ -77,7 +77,7 @@ trait Styles: Styled + Sized {
}
}
impl<V: 'static> Styles for Node<V> {}
impl<V: 'static> Styles for Div<V> {}
#[derive(Component)]
struct ZIndexExample {

View file

@ -9,7 +9,7 @@ use std::sync::Arc;
use clap::Parser;
use gpui::{
div, px, size, AnyView, AppContext, Bounds, Node, Render, ViewContext, VisualContext,
div, px, size, AnyView, AppContext, Bounds, Div, Render, ViewContext, VisualContext,
WindowBounds, WindowOptions,
};
use log::LevelFilter;
@ -107,7 +107,7 @@ impl StoryWrapper {
}
impl Render for StoryWrapper {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
div()

View file

@ -40,12 +40,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::{ActiveTheme, Story};
use gpui::{div, img, px, Node, ParentComponent, Render, Styled, ViewContext};
use gpui::{div, img, px, Div, ParentComponent, Render, Styled, ViewContext};
pub struct PlayerStory;
impl Render for PlayerStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx).child(

View file

@ -1,11 +1,11 @@
use gpui::{div, Component, Node, ParentComponent, Styled, ViewContext};
use gpui::{div, Component, Div, ParentComponent, Styled, ViewContext};
use crate::ActiveTheme;
pub struct Story {}
impl Story {
pub fn container<V: 'static>(cx: &mut ViewContext<V>) -> Node<V> {
pub fn container<V: 'static>(cx: &mut ViewContext<V>) -> Div<V> {
div()
.size_full()
.flex()

View file

@ -44,12 +44,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::Story;
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct AvatarStory;
impl Render for AvatarStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -236,13 +236,13 @@ pub use stories::*;
mod stories {
use super::*;
use crate::{h_stack, v_stack, LabelColor, Story};
use gpui::{rems, Node, Render};
use gpui::{rems, Div, Render};
use strum::IntoEnumIterator;
pub struct ButtonStory;
impl Render for ButtonStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let states = InteractionState::iter();

View file

@ -171,12 +171,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::{h_stack, Story};
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct CheckboxStory;
impl Render for CheckboxStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -65,12 +65,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::story::Story;
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct ContextMenuStory;
impl Render for ContextMenuStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -47,12 +47,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::{Button, Story};
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct DetailsStory;
impl Render for DetailsStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -1,11 +1,11 @@
use gpui::Node;
use gpui::Div;
use crate::{prelude::*, v_stack};
/// Create an elevated surface.
///
/// Must be used inside of a relative parent element
pub fn elevated_surface<V: 'static>(level: ElevationIndex, cx: &mut ViewContext<V>) -> Node<V> {
pub fn elevated_surface<V: 'static>(level: ElevationIndex, cx: &mut ViewContext<V>) -> Div<V> {
let colors = cx.theme().colors();
// let shadow = BoxShadow {
@ -23,6 +23,6 @@ pub fn elevated_surface<V: 'static>(level: ElevationIndex, cx: &mut ViewContext<
.shadow(level.shadow())
}
pub fn modal<V: 'static>(cx: &mut ViewContext<V>) -> Node<V> {
pub fn modal<V: 'static>(cx: &mut ViewContext<V>) -> Div<V> {
elevated_surface(ElevationIndex::ModalSurface, cx)
}

View file

@ -33,12 +33,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::{static_players, Story};
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct FacepileStory;
impl Render for FacepileStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let players = static_players();

View file

@ -204,7 +204,7 @@ pub use stories::*;
#[cfg(feature = "stories")]
mod stories {
use gpui::{Node, Render};
use gpui::{Div, Render};
use strum::IntoEnumIterator;
use crate::Story;
@ -214,7 +214,7 @@ mod stories {
pub struct IconStory;
impl Render for IconStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let icons = Icon::iter();

View file

@ -110,12 +110,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::Story;
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct InputStory;
impl Render for InputStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -158,13 +158,13 @@ pub use stories::*;
mod stories {
use super::*;
use crate::Story;
use gpui::{Node, Render};
use gpui::{Div, Render};
use itertools::Itertools;
pub struct KeybindingStory;
impl Render for KeybindingStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let all_modifier_permutations = ModifierKey::iter().permutations(2);

View file

@ -196,12 +196,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::Story;
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct LabelStory;
impl Render for LabelStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -159,7 +159,7 @@ pub use stories::*;
#[cfg(feature = "stories")]
mod stories {
use gpui::{Node, Render};
use gpui::{Div, Render};
use crate::{ModifierKeys, Story};
@ -168,7 +168,7 @@ mod stories {
pub struct PaletteStory;
impl Render for PaletteStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
{

View file

@ -126,12 +126,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::{Label, Story};
use gpui::{InteractiveComponent, Node, Render};
use gpui::{InteractiveComponent, Div, Render};
pub struct PanelStory;
impl Render for PanelStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -1,17 +1,17 @@
use gpui::{div, Node};
use gpui::{div, Div};
use crate::StyledExt;
/// Horizontally stacks elements.
///
/// Sets `flex()`, `flex_row()`, `items_center()`
pub fn h_stack<V: 'static>() -> Node<V> {
pub fn h_stack<V: 'static>() -> Div<V> {
div().h_flex()
}
/// Vertically stacks elements.
///
/// Sets `flex()`, `flex_col()`
pub fn v_stack<V: 'static>() -> Node<V> {
pub fn v_stack<V: 'static>() -> Div<V> {
div().v_flex()
}

View file

@ -1,6 +1,6 @@
use crate::prelude::*;
use crate::{Icon, IconColor, IconElement, Label, LabelColor};
use gpui::{prelude::*, red, ElementId, Node, Render, View};
use gpui::{prelude::*, red, Div, ElementId, Render, View};
#[derive(Component, Clone)]
pub struct Tab {
@ -21,7 +21,7 @@ struct TabDragState {
}
impl Render for TabDragState {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
div().w_8().h_4().bg(red())
@ -178,7 +178,7 @@ mod stories {
pub struct TabStory;
impl Render for TabStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let git_statuses = GitStatus::iter();

View file

@ -69,7 +69,7 @@ pub use stories::*;
#[cfg(feature = "stories")]
mod stories {
use gpui::{Node, Render};
use gpui::{Div, Render};
use crate::{Label, Story};
@ -78,7 +78,7 @@ mod stories {
pub struct ToastStory;
impl Render for ToastStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -1,4 +1,4 @@
use gpui::{div, Node, ParentComponent, Render, SharedString, Styled, ViewContext};
use gpui::{div, Div, ParentComponent, Render, SharedString, Styled, ViewContext};
use theme2::ActiveTheme;
#[derive(Clone, Debug)]
@ -13,7 +13,7 @@ impl TextTooltip {
}
impl Render for TextTooltip {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let theme = cx.theme();

View file

@ -1,11 +1,11 @@
use gpui::Node;
use gpui::Div;
use crate::prelude::*;
pub struct Story {}
impl Story {
pub fn container<V: 'static>(cx: &mut ViewContext<V>) -> Node<V> {
pub fn container<V: 'static>(cx: &mut ViewContext<V>) -> Div<V> {
div()
.size_full()
.flex()

View file

@ -77,11 +77,11 @@ pub use stories::*;
mod stories {
use super::*;
use crate::Story;
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct AssistantPanelStory;
impl Render for AssistantPanelStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -1,5 +1,5 @@
use crate::{h_stack, prelude::*, HighlightedText};
use gpui::{prelude::*, Node};
use gpui::{prelude::*, Div};
use std::path::PathBuf;
#[derive(Clone)]
@ -16,7 +16,7 @@ impl Breadcrumb {
Self { path, symbols }
}
fn render_separator<V: 'static>(&self, cx: &WindowContext) -> Node<V> {
fn render_separator<V: 'static>(&self, cx: &WindowContext) -> Div<V> {
div()
.child(" ")
.text_color(cx.theme().colors().text_muted)
@ -77,7 +77,7 @@ mod stories {
pub struct BreadcrumbStory;
impl Render for BreadcrumbStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -235,12 +235,12 @@ mod stories {
empty_buffer_example, hello_world_rust_buffer_example,
hello_world_rust_buffer_with_status_example, Story,
};
use gpui::{rems, Node, Render};
use gpui::{rems, Div, Render};
pub struct BufferStory;
impl Render for BufferStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -1,4 +1,4 @@
use gpui::{Node, Render, View, VisualContext};
use gpui::{Div, Render, View, VisualContext};
use crate::prelude::*;
use crate::{h_stack, Icon, IconButton, IconColor, Input};
@ -27,9 +27,9 @@ impl BufferSearch {
}
impl Render for BufferSearch {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Node<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Div<Self> {
h_stack()
.bg(cx.theme().colors().toolbar_background)
.p_2()

View file

@ -107,7 +107,7 @@ pub use stories::*;
#[cfg(feature = "stories")]
mod stories {
use chrono::DateTime;
use gpui::{Node, Render};
use gpui::{Div, Render};
use crate::{Panel, Story};
@ -116,7 +116,7 @@ mod stories {
pub struct ChatPanelStory;
impl Render for ChatPanelStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -93,12 +93,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::Story;
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct CollabPanelStory;
impl Render for CollabPanelStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -27,7 +27,7 @@ pub use stories::*;
#[cfg(feature = "stories")]
mod stories {
use gpui::{Node, Render};
use gpui::{Div, Render};
use crate::Story;
@ -36,7 +36,7 @@ mod stories {
pub struct CommandPaletteStory;
impl Render for CommandPaletteStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -25,7 +25,7 @@ pub use stories::*;
#[cfg(feature = "stories")]
mod stories {
use gpui::{Node, Render};
use gpui::{Div, Render};
use crate::Story;
@ -34,7 +34,7 @@ mod stories {
pub struct CopilotModalStory;
impl Render for CopilotModalStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -1,6 +1,6 @@
use std::path::PathBuf;
use gpui::{Node, Render, View, VisualContext};
use gpui::{Div, Render, View, VisualContext};
use crate::prelude::*;
use crate::{
@ -48,9 +48,9 @@ impl EditorPane {
}
impl Render for EditorPane {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Node<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Div<Self> {
v_stack()
.w_full()
.h_full()

View file

@ -40,12 +40,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::Story;
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct LanguageSelectorStory;
impl Render for LanguageSelectorStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -40,12 +40,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::{hello_world_rust_buffer_example, Story};
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct MultiBufferStory;
impl Render for MultiBufferStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -352,12 +352,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::{Panel, Story};
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct NotificationsPanelStory;
impl Render for NotificationsPanelStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -55,12 +55,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::{Panel, Story};
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct ProjectPanelStory;
impl Render for ProjectPanelStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -36,12 +36,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::Story;
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct RecentProjectsStory;
impl Render for RecentProjectsStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -100,12 +100,12 @@ pub use stories::*;
mod stories {
use super::*;
use crate::Story;
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct TabBarStory;
impl Render for TabBarStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -83,11 +83,11 @@ pub use stories::*;
mod stories {
use super::*;
use crate::Story;
use gpui::{Node, Render};
use gpui::{Div, Render};
pub struct TerminalStory;
impl Render for TerminalStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -39,7 +39,7 @@ pub use stories::*;
#[cfg(feature = "stories")]
mod stories {
use gpui::{Node, Render};
use gpui::{Div, Render};
use crate::Story;
@ -48,7 +48,7 @@ mod stories {
pub struct ThemeSelectorStory;
impl Render for ThemeSelectorStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -1,7 +1,7 @@
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
use gpui::{Node, Render, View, VisualContext};
use gpui::{Div, Render, View, VisualContext};
use crate::prelude::*;
use crate::settings::user_settings;
@ -86,9 +86,9 @@ impl TitleBar {
}
impl Render for TitleBar {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Node<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Div<Self> {
let settings = user_settings(cx);
// let has_focus = cx.window_is_active();
@ -202,9 +202,9 @@ mod stories {
}
impl Render for TitleBarStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Node<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Div<Self> {
Story::container(cx)
.child(Story::title_for::<_, TitleBar>(cx))
.child(Story::label(cx, "Default"))

View file

@ -73,7 +73,7 @@ mod stories {
use std::path::PathBuf;
use std::str::FromStr;
use gpui::{Node, Render};
use gpui::{Div, Render};
use crate::{Breadcrumb, HighlightedText, Icon, IconButton, Story, Symbol};
@ -82,7 +82,7 @@ mod stories {
pub struct ToolbarStory;
impl Render for ToolbarStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -77,7 +77,7 @@ pub use stories::*;
#[cfg(feature = "stories")]
mod stories {
use gpui::{Node, Render};
use gpui::{Div, Render};
use crate::Story;
@ -86,7 +86,7 @@ mod stories {
pub struct TrafficLightsStory;
impl Render for TrafficLightsStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
Story::container(cx)

View file

@ -1,7 +1,7 @@
use std::sync::Arc;
use chrono::DateTime;
use gpui::{px, relative, Node, Render, Size, View, VisualContext};
use gpui::{px, relative, Div, Render, Size, View, VisualContext};
use settings2::Settings;
use theme2::ThemeSettings;
@ -192,9 +192,9 @@ impl Workspace {
}
impl Render for Workspace {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Node<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Div<Self> {
let root_group = PaneGroup::new_panes(
vec![Pane::new(
"pane-0",
@ -388,7 +388,7 @@ mod stories {
}
impl Render for WorkspaceStory {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
div().child(self.workspace.clone())

View file

@ -1,6 +1,6 @@
use crate::{status_bar::StatusItemView, Axis, Workspace};
use gpui::{
div, Action, AnyView, AppContext, Entity, EntityId, EventEmitter, Node, ParentComponent,
div, Action, AnyView, AppContext, Entity, EntityId, EventEmitter, Div, ParentComponent,
Render, Subscription, View, ViewContext, WeakView, WindowContext,
};
use schemars::JsonSchema;
@ -419,7 +419,7 @@ impl Dock {
}
impl Render for Dock {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
todo!()
@ -621,7 +621,7 @@ impl PanelButtons {
// }
impl Render for PanelButtons {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
// todo!()
@ -647,7 +647,7 @@ impl StatusItemView for PanelButtons {
#[cfg(any(test, feature = "test-support"))]
pub mod test {
use super::*;
use gpui::{div, Node, ViewContext, WindowContext};
use gpui::{div, Div, ViewContext, WindowContext};
pub struct TestPanel {
pub position: DockPosition,
@ -672,7 +672,7 @@ pub mod test {
}
impl Render for TestPanel {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
div()

View file

@ -1,5 +1,5 @@
use gpui::{
div, prelude::*, px, AnyView, EventEmitter, FocusHandle, Node, Render, Subscription, View,
div, prelude::*, px, AnyView, EventEmitter, FocusHandle, Div, Render, Subscription, View,
ViewContext, WindowContext,
};
use ui::v_stack;
@ -76,7 +76,7 @@ impl ModalLayer {
}
impl Render for ModalLayer {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let Some(active_modal) = &self.active_modal else {

View file

@ -165,7 +165,7 @@ impl Workspace {
pub mod simple_message_notification {
use super::{Notification, NotificationEvent};
use gpui::{AnyElement, AppContext, EventEmitter, Node, Render, TextStyle, ViewContext};
use gpui::{AnyElement, AppContext, EventEmitter, Div, Render, TextStyle, ViewContext};
use serde::Deserialize;
use std::{borrow::Cow, sync::Arc};
@ -252,7 +252,7 @@ pub mod simple_message_notification {
}
impl Render for MessageNotification {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
todo!()

View file

@ -8,7 +8,7 @@ use anyhow::Result;
use collections::{HashMap, HashSet, VecDeque};
use gpui::{
actions, prelude::*, register_action, AppContext, AsyncWindowContext, Component, EntityId,
EventEmitter, FocusHandle, Model, Node, PromptLevel, Render, Task, View, ViewContext,
EventEmitter, FocusHandle, Model, Div, PromptLevel, Render, Task, View, ViewContext,
VisualContext, WeakView, WindowContext,
};
use parking_lot::Mutex;
@ -1901,7 +1901,7 @@ impl Pane {
// }
impl Render for Pane {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
v_stack()
@ -2926,7 +2926,7 @@ struct DraggedTab {
}
impl Render for DraggedTab {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
div().w_8().h_4().bg(gpui::red())

View file

@ -2,7 +2,7 @@ use std::any::TypeId;
use crate::{ItemHandle, Pane};
use gpui::{
div, AnyView, Component, Node, ParentComponent, Render, Styled, Subscription, View,
div, AnyView, Component, Div, ParentComponent, Render, Styled, Subscription, View,
ViewContext, WindowContext,
};
use theme2::ActiveTheme;
@ -34,7 +34,7 @@ pub struct StatusBar {
}
impl Render for StatusBar {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
div()

View file

@ -1,6 +1,6 @@
use crate::ItemHandle;
use gpui::{
AnyView, Entity, EntityId, EventEmitter, Node, Render, View, ViewContext, WindowContext,
AnyView, Div, Entity, EntityId, EventEmitter, Render, View, ViewContext, WindowContext,
};
pub enum ToolbarItemEvent {
@ -52,7 +52,7 @@ pub struct Toolbar {
}
impl Render for Toolbar {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
todo!()

View file

@ -38,7 +38,7 @@ use futures::{
use gpui::{
actions, div, point, prelude::*, rems, size, Action, AnyModel, AnyView, AnyWeakView,
AppContext, AsyncAppContext, AsyncWindowContext, Bounds, Component, Entity, EntityId,
EventEmitter, FocusHandle, GlobalPixels, KeyContext, Model, ModelContext, Node,
EventEmitter, FocusHandle, GlobalPixels, KeyContext, Model, ModelContext, Div,
ParentComponent, Point, Render, Size, Styled, Subscription, Task, View, ViewContext, WeakView,
WindowBounds, WindowContext, WindowHandle, WindowOptions,
};
@ -529,7 +529,7 @@ pub enum Event {
pub struct Workspace {
weak_self: WeakView<Self>,
focus_handle: FocusHandle,
workspace_actions: Vec<Box<dyn Fn(Node<Workspace>) -> Node<Workspace>>>,
workspace_actions: Vec<Box<dyn Fn(Div<Workspace>) -> Div<Workspace>>>,
zoomed: Option<AnyWeakView>,
zoomed_position: Option<DockPosition>,
center: PaneGroup,
@ -3503,7 +3503,7 @@ impl Workspace {
}));
}
fn add_workspace_actions_listeners(&self, mut div: Node<Workspace>) -> Node<Workspace> {
fn add_workspace_actions_listeners(&self, mut div: Div<Workspace>) -> Div<Workspace> {
for action in self.workspace_actions.iter() {
div = (action)(div)
}
@ -3728,7 +3728,7 @@ fn notify_if_database_failed(workspace: WindowHandle<Workspace>, cx: &mut AsyncA
impl EventEmitter<Event> for Workspace {}
impl Render for Workspace {
type Element = Node<Self>;
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let mut context = KeyContext::default();