Element refinement passing on ui2

This commit is contained in:
Nathan Sobo 2023-11-18 20:05:47 -07:00
parent be33f000e2
commit adc355a1e6
87 changed files with 2066 additions and 1372 deletions

View file

@ -1,5 +1,5 @@
use crate::{
div, point, Component, Div, FocusHandle, Keystroke, Modifiers, Pixels, Point, Render,
div, point, Div, Element, FocusHandle, Keystroke, Modifiers, Pixels, Point, Render,
ViewContext,
};
use smallvec::SmallVec;
@ -64,7 +64,7 @@ pub struct Drag<S, R, V, E>
where
R: Fn(&mut V, &mut ViewContext<V>) -> E,
V: 'static,
E: Component<()>,
E: Element<()>,
{
pub state: S,
pub render_drag_handle: R,
@ -75,7 +75,7 @@ impl<S, R, V, E> Drag<S, R, V, E>
where
R: Fn(&mut V, &mut ViewContext<V>) -> E,
V: 'static,
E: Component<()>,
E: Element<()>,
{
pub fn new(state: S, render_drag_handle: R) -> Self {
Drag {
@ -193,7 +193,7 @@ impl Deref for MouseExitEvent {
#[derive(Debug, Clone, Default)]
pub struct ExternalPaths(pub(crate) SmallVec<[PathBuf; 2]>);
impl Render for ExternalPaths {
impl Render<Self> for ExternalPaths {
type Element = Div<Self>;
fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Element {
@ -286,8 +286,8 @@ pub struct FocusEvent {
#[cfg(test)]
mod test {
use crate::{
self as gpui, div, Component, Div, FocusHandle, InteractiveComponent, KeyBinding,
Keystroke, ParentComponent, Render, Stateful, TestAppContext, ViewContext, VisualContext,
self as gpui, div, Div, FocusHandle, InteractiveElement, KeyBinding, Keystroke,
ParentElement, Stateful, TestAppContext, Render, VisualContext,
};
struct TestView {
@ -298,7 +298,7 @@ mod test {
actions!(TestAction);
impl Render for TestView {
impl Render<Self> for TestView {
type Element = Stateful<Self, Div<Self>>;
fn render(&mut self, _: &mut gpui::ViewContext<Self>) -> Self::Element {