Merge branch 'pre-merge' into clean-up-doc-elements

This commit is contained in:
Nathan Sobo
2024-01-01 12:21:33 -07:00
88 changed files with 237 additions and 478 deletions
+5 -11
View File
@@ -1,7 +1,7 @@
use crate::DraggedDock;
use crate::{status_bar::StatusItemView, Workspace};
use gpui::{
div, px, Action, AnchorCorner, AnyView, AppContext, Axis, ClickEvent, Div, Entity, EntityId,
div, px, Action, AnchorCorner, AnyView, AppContext, Axis, ClickEvent, Entity, EntityId,
EventEmitter, FocusHandle, FocusableView, IntoElement, MouseButton, ParentElement, Render,
SharedString, Styled, Subscription, View, ViewContext, VisualContext, WeakView, WindowContext,
};
@@ -505,9 +505,7 @@ impl Dock {
}
impl Render for Dock {
type Output = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
if let Some(entry) = self.visible_entry() {
let size = entry.panel.size(cx);
@@ -594,9 +592,7 @@ impl PanelButtons {
}
impl Render for PanelButtons {
type Output = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
// todo!()
let dock = self.dock.read(cx);
let active_index = dock.active_panel_index;
@@ -691,7 +687,7 @@ impl StatusItemView for PanelButtons {
#[cfg(any(test, feature = "test-support"))]
pub mod test {
use super::*;
use gpui::{actions, div, Div, ViewContext, WindowContext};
use gpui::{actions, div, ViewContext, WindowContext};
pub struct TestPanel {
pub position: DockPosition,
@@ -717,9 +713,7 @@ pub mod test {
}
impl Render for TestPanel {
type Output = Div;
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl Element {
div()
}
}
+4 -6
View File
@@ -760,9 +760,9 @@ pub mod test {
use super::{Item, ItemEvent};
use crate::{ItemId, ItemNavHistory, Pane, Workspace, WorkspaceId};
use gpui::{
AnyElement, AppContext, Context as _, Div, EntityId, EventEmitter, Focusable,
FocusableView, InteractiveElement, IntoElement, Model, Render, SharedString, Task, View,
ViewContext, VisualContext, WeakView,
AnyElement, AppContext, Context as _, Element, EntityId, EventEmitter, FocusableView,
InteractiveElement, IntoElement, Model, Render, SharedString, Task, View, ViewContext,
VisualContext, WeakView,
};
use project::{Project, ProjectEntryId, ProjectPath, WorktreeId};
use std::{any::Any, cell::Cell, path::Path};
@@ -910,9 +910,7 @@ pub mod test {
}
impl Render for TestItem {
type Output = Focusable<Div>;
fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Output {
fn render(&mut self, _: &mut ViewContext<Self>) -> impl Element {
gpui::div().track_focus(&self.focus_handle)
}
}
+3 -5
View File
@@ -1,6 +1,6 @@
use gpui::{
div, prelude::*, px, AnyView, DismissEvent, Div, FocusHandle, ManagedView, Render,
Subscription, View, ViewContext, WindowContext,
div, prelude::*, px, AnyView, DismissEvent, FocusHandle, ManagedView, Render, Subscription,
View, ViewContext, WindowContext,
};
use ui::{h_stack, v_stack};
@@ -104,9 +104,7 @@ impl ModalLayer {
}
impl Render for ModalLayer {
type Output = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
let Some(active_modal) = &self.active_modal else {
return div();
};
+3 -5
View File
@@ -170,8 +170,8 @@ impl Workspace {
pub mod simple_message_notification {
use gpui::{
div, DismissEvent, Div, EventEmitter, InteractiveElement, ParentElement, Render,
SharedString, StatefulInteractiveElement, Styled, ViewContext,
div, DismissEvent, EventEmitter, InteractiveElement, ParentElement, Render, SharedString,
StatefulInteractiveElement, Styled, ViewContext,
};
use std::sync::Arc;
use ui::prelude::*;
@@ -219,9 +219,7 @@ pub mod simple_message_notification {
}
impl Render for MessageNotification {
type Output = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
v_stack()
.elevation_3(cx)
.p_4()
+4 -9
View File
@@ -9,9 +9,8 @@ use collections::{HashMap, HashSet, VecDeque};
use gpui::{
actions, impl_actions, overlay, prelude::*, Action, AnchorCorner, AnyElement, AppContext,
AsyncWindowContext, DismissEvent, Div, DragMoveEvent, EntityId, EventEmitter, FocusHandle,
Focusable, FocusableView, Model, MouseButton, NavigationDirection, Pixels, Point, PromptLevel,
Render, ScrollHandle, Subscription, Task, View, ViewContext, VisualContext, WeakView,
WindowContext,
FocusableView, Model, MouseButton, NavigationDirection, Pixels, Point, PromptLevel, Render,
ScrollHandle, Subscription, Task, View, ViewContext, VisualContext, WeakView, WindowContext,
};
use parking_lot::Mutex;
use project::{Project, ProjectEntryId, ProjectPath};
@@ -1868,9 +1867,7 @@ impl FocusableView for Pane {
}
impl Render for Pane {
type Output = Focusable<Div>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
v_stack()
.key_context("Pane")
.track_focus(&self.focus_handle)
@@ -2750,9 +2747,7 @@ mod tests {
}
impl Render for DraggedTab {
type Output = <Tab as RenderOnce>::Output;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone();
let item = &self.pane.read(cx).items[self.ix];
let label = item.tab_content(Some(self.detail), false, cx);
+4 -6
View File
@@ -7,9 +7,9 @@ use call::participant::{Frame, RemoteVideoTrack};
use client::{proto::PeerId, User};
use futures::StreamExt;
use gpui::{
div, img, AppContext, Div, Element, EventEmitter, FocusHandle, Focusable, FocusableView,
InteractiveElement, ParentElement, Render, SharedString, Styled, Task, View, ViewContext,
VisualContext, WindowContext,
div, img, AppContext, Element, EventEmitter, FocusHandle, FocusableView, InteractiveElement,
ParentElement, Render, SharedString, Styled, Task, View, ViewContext, VisualContext,
WindowContext,
};
use std::sync::{Arc, Weak};
use ui::{h_stack, prelude::*, Icon, IconElement, Label};
@@ -66,9 +66,7 @@ impl FocusableView for SharedScreen {
}
}
impl Render for SharedScreen {
type Output = Focusable<Div>;
fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Output {
fn render(&mut self, _: &mut ViewContext<Self>) -> impl Element {
div().track_focus(&self.focus).size_full().children(
self.frame
.as_ref()
+2 -4
View File
@@ -1,6 +1,6 @@
use crate::{ItemHandle, Pane};
use gpui::{
div, AnyView, Div, IntoElement, ParentElement, Render, Styled, Subscription, View, ViewContext,
div, AnyView, IntoElement, ParentElement, Render, Styled, Subscription, View, ViewContext,
WindowContext,
};
use std::any::TypeId;
@@ -33,9 +33,7 @@ pub struct StatusBar {
}
impl Render for StatusBar {
type Output = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
div()
.py_0p5()
.px_1()
+3 -5
View File
@@ -1,7 +1,7 @@
use crate::ItemHandle;
use gpui::{
AnyView, Div, Entity, EntityId, EventEmitter, ParentElement as _, Render, Styled, View,
ViewContext, WindowContext,
AnyView, Entity, EntityId, EventEmitter, ParentElement as _, Render, Styled, View, ViewContext,
WindowContext,
};
use ui::prelude::*;
use ui::{h_stack, v_stack};
@@ -93,9 +93,7 @@ impl Toolbar {
}
impl Render for Toolbar {
type Output = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
if !self.has_any_visible_items() {
return div();
}
+1 -3
View File
@@ -3489,9 +3489,7 @@ impl FocusableView for Workspace {
struct DraggedDock(DockPosition);
impl Render for Workspace {
type Output = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
let mut context = KeyContext::default();
context.add("Workspace");