Checkpoint

Antonio Scandurra created

Change summary

crates/gpui3/src/element.rs            |  44 ++++++------
crates/gpui3/src/elements/div.rs       | 102 ++++++++++++++--------------
crates/gpui3/src/elements/img.rs       |  46 ++++++------
crates/gpui3/src/elements/svg.rs       |  46 ++++++------
crates/gpui3/src/focusable.rs          |   2 
crates/gpui3/src/gpui3.rs              |   4 
crates/gpui3/src/interactive.rs        |   6 
crates/storybook2/src/stories/focus.rs |   2 
8 files changed, 126 insertions(+), 126 deletions(-)

Detailed changes

crates/gpui3/src/element.rs 🔗

@@ -44,9 +44,9 @@ pub trait Element: 'static + Send + Sync + IntoAnyElement<Self::ViewState> {
 #[derive(Deref, DerefMut, Default, Clone, Debug, Eq, PartialEq, Hash)]
 pub struct GlobalElementId(SmallVec<[ElementId; 32]>);
 
-pub trait ElementInteractivity<V: 'static + Send + Sync>: 'static + Send + Sync {
-    fn as_stateless(&self) -> &StatelessInteractivity<V>;
-    fn as_stateless_mut(&mut self) -> &mut StatelessInteractivity<V>;
+pub trait ElementInteraction<V: 'static + Send + Sync>: 'static + Send + Sync {
+    fn as_stateless(&self) -> &StatelessInteraction<V>;
+    fn as_stateless_mut(&mut self) -> &mut StatelessInteraction<V>;
     fn as_stateful(&self) -> Option<&StatefulInteractivity<V>>;
     fn as_stateful_mut(&mut self) -> Option<&mut StatefulInteractivity<V>>;
 
@@ -233,13 +233,13 @@ pub struct StatefulInteractivity<V: 'static + Send + Sync> {
     pub id: ElementId,
     #[deref]
     #[deref_mut]
-    stateless: StatelessInteractivity<V>,
+    stateless: StatelessInteraction<V>,
     pub mouse_click_listeners: SmallVec<[MouseClickListener<V>; 2]>,
     pub active_style: StyleRefinement,
     pub group_active_style: Option<GroupStyle>,
 }
 
-impl<V> ElementInteractivity<V> for StatefulInteractivity<V>
+impl<V> ElementInteraction<V> for StatefulInteractivity<V>
 where
     V: 'static + Send + Sync,
 {
@@ -251,11 +251,11 @@ where
         Some(self)
     }
 
-    fn as_stateless(&self) -> &StatelessInteractivity<V> {
+    fn as_stateless(&self) -> &StatelessInteraction<V> {
         &self.stateless
     }
 
-    fn as_stateless_mut(&mut self) -> &mut StatelessInteractivity<V> {
+    fn as_stateless_mut(&mut self) -> &mut StatelessInteraction<V> {
         &mut self.stateless
     }
 }
@@ -267,7 +267,7 @@ where
     fn from(id: ElementId) -> Self {
         Self {
             id,
-            stateless: StatelessInteractivity::default(),
+            stateless: StatelessInteraction::default(),
             mouse_click_listeners: SmallVec::new(),
             active_style: StyleRefinement::default(),
             group_active_style: None,
@@ -275,7 +275,7 @@ where
     }
 }
 
-pub struct StatelessInteractivity<V> {
+pub struct StatelessInteraction<V> {
     pub mouse_down_listeners: SmallVec<[MouseDownListener<V>; 2]>,
     pub mouse_up_listeners: SmallVec<[MouseUpListener<V>; 2]>,
     pub mouse_move_listeners: SmallVec<[MouseMoveListener<V>; 2]>,
@@ -337,7 +337,7 @@ pub struct InteractiveElementState {
     pending_click: Arc<Mutex<Option<MouseDownEvent>>>,
 }
 
-impl<V> Default for StatelessInteractivity<V> {
+impl<V> Default for StatelessInteraction<V> {
     fn default() -> Self {
         Self {
             mouse_down_listeners: SmallVec::new(),
@@ -351,7 +351,7 @@ impl<V> Default for StatelessInteractivity<V> {
     }
 }
 
-impl<V> ElementInteractivity<V> for StatelessInteractivity<V>
+impl<V> ElementInteraction<V> for StatelessInteraction<V>
 where
     V: 'static + Send + Sync,
 {
@@ -363,17 +363,17 @@ where
         None
     }
 
-    fn as_stateless(&self) -> &StatelessInteractivity<V> {
+    fn as_stateless(&self) -> &StatelessInteraction<V> {
         self
     }
 
-    fn as_stateless_mut(&mut self) -> &mut StatelessInteractivity<V> {
+    fn as_stateless_mut(&mut self) -> &mut StatelessInteraction<V> {
         self
     }
 }
 
-pub trait ElementFocusability<V: 'static + Send + Sync>: 'static + Send + Sync {
-    fn as_focusable(&self) -> Option<&Focusable<V>>;
+pub trait ElementFocus<V: 'static + Send + Sync>: 'static + Send + Sync {
+    fn as_focusable(&self) -> Option<&FocusEnabled<V>>;
 
     fn initialize<R>(
         &self,
@@ -421,7 +421,7 @@ pub trait ElementFocusability<V: 'static + Send + Sync>: 'static + Send + Sync {
     }
 }
 
-pub struct Focusable<V: 'static + Send + Sync> {
+pub struct FocusEnabled<V: 'static + Send + Sync> {
     pub focus_handle: FocusHandle,
     pub focus_listeners: FocusListeners<V>,
     pub focus_style: StyleRefinement,
@@ -429,16 +429,16 @@ pub struct Focusable<V: 'static + Send + Sync> {
     pub in_focus_style: StyleRefinement,
 }
 
-impl<V> ElementFocusability<V> for Focusable<V>
+impl<V> ElementFocus<V> for FocusEnabled<V>
 where
     V: 'static + Send + Sync,
 {
-    fn as_focusable(&self) -> Option<&Focusable<V>> {
+    fn as_focusable(&self) -> Option<&FocusEnabled<V>> {
         Some(self)
     }
 }
 
-impl<V> From<FocusHandle> for Focusable<V>
+impl<V> From<FocusHandle> for FocusEnabled<V>
 where
     V: 'static + Send + Sync,
 {
@@ -453,13 +453,13 @@ where
     }
 }
 
-pub struct NonFocusable;
+pub struct FocusDisabled;
 
-impl<V> ElementFocusability<V> for NonFocusable
+impl<V> ElementFocus<V> for FocusDisabled
 where
     V: 'static + Send + Sync,
 {
-    fn as_focusable(&self) -> Option<&Focusable<V>> {
+    fn as_focusable(&self) -> Option<&FocusEnabled<V>> {
         None
     }
 }

crates/gpui3/src/elements/div.rs 🔗

@@ -1,9 +1,9 @@
 use crate::{
-    AnyElement, BorrowWindow, Bounds, Element, ElementFocusability, ElementId,
-    ElementInteractivity, Focus, FocusHandle, FocusListeners, Focusable, GlobalElementId,
-    GroupBounds, InteractiveElementState, IntoAnyElement, LayoutId, NonFocusable, Overflow,
-    ParentElement, Pixels, Point, SharedString, StatefulInteractivity, StatefullyInteractive,
-    StatelessInteractivity, StatelesslyInteractive, Style, StyleRefinement, Styled, ViewContext,
+    AnyElement, BorrowWindow, Bounds, Element, ElementFocus, ElementId, ElementInteraction,
+    FocusDisabled, FocusEnabled, FocusHandle, FocusListeners, Focusable, GlobalElementId,
+    GroupBounds, InteractiveElementState, IntoAnyElement, LayoutId, Overflow, ParentElement,
+    Pixels, Point, SharedString, StatefulInteractivity, StatefullyInteractive,
+    StatelessInteraction, StatelesslyInteractive, Style, StyleRefinement, Styled, ViewContext,
 };
 use parking_lot::Mutex;
 use refineable::Refineable;
@@ -33,38 +33,38 @@ impl ScrollState {
 
 pub struct Div<
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V> = StatelessInteractivity<V>,
-    F: ElementFocusability<V> = NonFocusable,
+    I: ElementInteraction<V> = StatelessInteraction<V>,
+    F: ElementFocus<V> = FocusDisabled,
 > {
-    interactivity: I,
-    focusability: F,
+    interaction: I,
+    focus: F,
     children: SmallVec<[AnyElement<V>; 2]>,
     group: Option<SharedString>,
     base_style: StyleRefinement,
 }
 
-pub fn div<V>() -> Div<V, StatelessInteractivity<V>, NonFocusable>
+pub fn div<V>() -> Div<V, StatelessInteraction<V>, FocusDisabled>
 where
     V: 'static + Send + Sync,
 {
     Div {
-        interactivity: StatelessInteractivity::default(),
-        focusability: NonFocusable,
+        interaction: StatelessInteraction::default(),
+        focus: FocusDisabled,
         children: SmallVec::new(),
         group: None,
         base_style: StyleRefinement::default(),
     }
 }
 
-impl<V, F> Div<V, StatelessInteractivity<V>, F>
+impl<V, F> Div<V, StatelessInteraction<V>, F>
 where
-    F: ElementFocusability<V>,
+    F: ElementFocus<V>,
     V: 'static + Send + Sync,
 {
     pub fn id(self, id: impl Into<ElementId>) -> Div<V, StatefulInteractivity<V>, F> {
         Div {
-            interactivity: id.into().into(),
-            focusability: self.focusability,
+            interaction: id.into().into(),
+            focus: self.focus,
             children: self.children,
             group: self.group,
             base_style: self.base_style,
@@ -74,8 +74,8 @@ where
 
 impl<V, I, F> Div<V, I, F>
 where
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
     V: 'static + Send + Sync,
 {
     pub fn group(mut self, group: impl Into<SharedString>) -> Self {
@@ -146,22 +146,22 @@ where
     ) -> Style {
         let mut computed_style = Style::default();
         computed_style.refine(&self.base_style);
-        self.focusability.refine_style(&mut computed_style, cx);
-        self.interactivity
+        self.focus.refine_style(&mut computed_style, cx);
+        self.interaction
             .refine_style(&mut computed_style, bounds, state, cx);
         computed_style
     }
 }
 
-impl<V, I> Div<V, I, NonFocusable>
+impl<V, I> Div<V, I, FocusDisabled>
 where
-    I: ElementInteractivity<V>,
+    I: ElementInteraction<V>,
     V: 'static + Send + Sync,
 {
-    pub fn focusable(self, handle: &FocusHandle) -> Div<V, I, Focusable<V>> {
+    pub fn focusable(self, handle: &FocusHandle) -> Div<V, I, FocusEnabled<V>> {
         Div {
-            interactivity: self.interactivity,
-            focusability: handle.clone().into(),
+            interaction: self.interaction,
+            focus: handle.clone().into(),
             children: self.children,
             group: self.group,
             base_style: self.base_style,
@@ -169,43 +169,43 @@ where
     }
 }
 
-impl<V, I> Focus for Div<V, I, Focusable<V>>
+impl<V, I> Focusable for Div<V, I, FocusEnabled<V>>
 where
-    I: ElementInteractivity<V>,
+    I: ElementInteraction<V>,
     V: 'static + Send + Sync,
 {
     fn focus_listeners(&mut self) -> &mut FocusListeners<V> {
-        &mut self.focusability.focus_listeners
+        &mut self.focus.focus_listeners
     }
 
     fn handle(&self) -> &FocusHandle {
-        &self.focusability.focus_handle
+        &self.focus.focus_handle
     }
 
     fn set_focus_style(&mut self, style: StyleRefinement) {
-        self.focusability.focus_style = style;
+        self.focus.focus_style = style;
     }
 
     fn set_focus_in_style(&mut self, style: StyleRefinement) {
-        self.focusability.focus_in_style = style;
+        self.focus.focus_in_style = style;
     }
 
     fn set_in_focus_style(&mut self, style: StyleRefinement) {
-        self.focusability.in_focus_style = style;
+        self.focus.in_focus_style = style;
     }
 }
 
 impl<V, I, F> Element for Div<V, I, F>
 where
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
     V: 'static + Send + Sync,
 {
     type ViewState = V;
     type ElementState = InteractiveElementState;
 
     fn id(&self) -> Option<ElementId> {
-        self.interactivity
+        self.interaction
             .as_stateful()
             .map(|identified| identified.id.clone())
     }
@@ -216,8 +216,8 @@ where
         element_state: Option<Self::ElementState>,
         cx: &mut ViewContext<Self::ViewState>,
     ) -> Self::ElementState {
-        self.interactivity.initialize(cx, |cx| {
-            self.focusability.initialize(cx, |cx| {
+        self.interaction.initialize(cx, |cx| {
+            self.focus.initialize(cx, |cx| {
                 for child in &mut self.children {
                     child.initialize(view_state, cx);
                 }
@@ -265,8 +265,8 @@ where
                 cx.stack(0, |cx| {
                     style.paint(bounds, cx);
 
-                    this.focusability.paint(bounds, cx);
-                    this.interactivity.paint(bounds, element_state, cx);
+                    this.focus.paint(bounds, cx);
+                    this.interaction.paint(bounds, element_state, cx);
                 });
 
                 cx.stack(1, |cx| {
@@ -289,8 +289,8 @@ where
 
 impl<V, I, F> IntoAnyElement<V> for Div<V, I, F>
 where
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
     V: 'static + Send + Sync,
 {
     fn into_any(self) -> AnyElement<V> {
@@ -300,8 +300,8 @@ where
 
 impl<V, I, F> ParentElement for Div<V, I, F>
 where
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
     V: 'static + Send + Sync,
 {
     fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<Self::ViewState>; 2]> {
@@ -311,8 +311,8 @@ where
 
 impl<V, I, F> Styled for Div<V, I, F>
 where
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
     V: 'static + Send + Sync,
 {
     fn style(&mut self) -> &mut StyleRefinement {
@@ -322,21 +322,21 @@ where
 
 impl<V, I, F> StatelesslyInteractive for Div<V, I, F>
 where
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
     V: 'static + Send + Sync,
 {
-    fn stateless_interactivity(&mut self) -> &mut StatelessInteractivity<V> {
-        self.interactivity.as_stateless_mut()
+    fn stateless_interactivity(&mut self) -> &mut StatelessInteraction<V> {
+        self.interaction.as_stateless_mut()
     }
 }
 
 impl<V, F> StatefullyInteractive for Div<V, StatefulInteractivity<V>, F>
 where
-    F: ElementFocusability<V>,
+    F: ElementFocus<V>,
     V: 'static + Send + Sync,
 {
     fn stateful_interactivity(&mut self) -> &mut StatefulInteractivity<Self::ViewState> {
-        &mut self.interactivity
+        &mut self.interaction
     }
 }

crates/gpui3/src/elements/img.rs 🔗

@@ -1,8 +1,8 @@
 use crate::{
-    div, AnyElement, BorrowWindow, Bounds, Div, Element, ElementFocusability, ElementId,
-    ElementInteractivity, Focus, FocusListeners, Focusable, InteractiveElementState,
-    IntoAnyElement, LayoutId, NonFocusable, Pixels, SharedString, StatefulInteractivity,
-    StatefullyInteractive, StatelessInteractivity, StatelesslyInteractive, StyleRefinement, Styled,
+    div, AnyElement, BorrowWindow, Bounds, Div, Element, ElementFocus, ElementId,
+    ElementInteraction, FocusDisabled, FocusEnabled, FocusListeners, Focusable,
+    InteractiveElementState, IntoAnyElement, LayoutId, Pixels, SharedString, StatefulInteractivity,
+    StatefullyInteractive, StatelessInteraction, StatelesslyInteractive, StyleRefinement, Styled,
     ViewContext,
 };
 use futures::FutureExt;
@@ -10,15 +10,15 @@ use util::ResultExt;
 
 pub struct Img<
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V> = StatelessInteractivity<V>,
-    F: ElementFocusability<V> = NonFocusable,
+    I: ElementInteraction<V> = StatelessInteraction<V>,
+    F: ElementFocus<V> = FocusDisabled,
 > {
     base: Div<V, I, F>,
     uri: Option<SharedString>,
     grayscale: bool,
 }
 
-pub fn img<V>() -> Img<V, StatelessInteractivity<V>, NonFocusable>
+pub fn img<V>() -> Img<V, StatelessInteraction<V>, FocusDisabled>
 where
     V: 'static + Send + Sync,
 {
@@ -32,8 +32,8 @@ where
 impl<V, I, F> Img<V, I, F>
 where
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
 {
     pub fn uri(mut self, uri: impl Into<SharedString>) -> Self {
         self.uri = Some(uri.into());
@@ -46,10 +46,10 @@ where
     }
 }
 
-impl<V, F> Img<V, StatelessInteractivity<V>, F>
+impl<V, F> Img<V, StatelessInteraction<V>, F>
 where
     V: 'static + Send + Sync,
-    F: ElementFocusability<V>,
+    F: ElementFocus<V>,
 {
     pub fn id(self, id: impl Into<ElementId>) -> Img<V, StatefulInteractivity<V>, F> {
         Img {
@@ -63,8 +63,8 @@ where
 impl<V, I, F> IntoAnyElement<V> for Img<V, I, F>
 where
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
 {
     fn into_any(self) -> AnyElement<V> {
         AnyElement::new(self)
@@ -74,8 +74,8 @@ where
 impl<V, I, F> Element for Img<V, I, F>
 where
     V: Send + Sync + 'static,
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
 {
     type ViewState = V;
     type ElementState = InteractiveElementState;
@@ -143,8 +143,8 @@ where
 impl<V, I, F> Styled for Img<V, I, F>
 where
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
 {
     fn style(&mut self) -> &mut StyleRefinement {
         self.base.style()
@@ -154,10 +154,10 @@ where
 impl<V, I, F> StatelesslyInteractive for Img<V, I, F>
 where
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
 {
-    fn stateless_interactivity(&mut self) -> &mut StatelessInteractivity<V> {
+    fn stateless_interactivity(&mut self) -> &mut StatelessInteraction<V> {
         self.base.stateless_interactivity()
     }
 }
@@ -165,17 +165,17 @@ where
 impl<V, F> StatefullyInteractive for Img<V, StatefulInteractivity<V>, F>
 where
     V: 'static + Send + Sync,
-    F: ElementFocusability<V>,
+    F: ElementFocus<V>,
 {
     fn stateful_interactivity(&mut self) -> &mut StatefulInteractivity<Self::ViewState> {
         self.base.stateful_interactivity()
     }
 }
 
-impl<V, I> Focus for Img<V, I, Focusable<V>>
+impl<V, I> Focusable for Img<V, I, FocusEnabled<V>>
 where
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V>,
+    I: ElementInteraction<V>,
 {
     fn focus_listeners(&mut self) -> &mut FocusListeners<Self::ViewState> {
         self.base.focus_listeners()

crates/gpui3/src/elements/svg.rs 🔗

@@ -1,21 +1,21 @@
 use crate::{
-    div, AnyElement, Bounds, Div, Element, ElementFocusability, ElementId, ElementInteractivity,
-    Focus, FocusListeners, Focusable, InteractiveElementState, IntoAnyElement, LayoutId,
-    NonFocusable, Pixels, SharedString, StatefulInteractivity, StatefullyInteractive,
-    StatelessInteractivity, StatelesslyInteractive, StyleRefinement, Styled, ViewContext,
+    div, AnyElement, Bounds, Div, Element, ElementFocus, ElementId, ElementInteraction,
+    FocusDisabled, FocusEnabled, FocusListeners, Focusable, InteractiveElementState,
+    IntoAnyElement, LayoutId, Pixels, SharedString, StatefulInteractivity, StatefullyInteractive,
+    StatelessInteraction, StatelesslyInteractive, StyleRefinement, Styled, ViewContext,
 };
 use util::ResultExt;
 
 pub struct Svg<
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V> = StatelessInteractivity<V>,
-    F: ElementFocusability<V> = NonFocusable,
+    I: ElementInteraction<V> = StatelessInteraction<V>,
+    F: ElementFocus<V> = FocusDisabled,
 > {
     base: Div<V, I, F>,
     path: Option<SharedString>,
 }
 
-pub fn svg<V>() -> Svg<V, StatelessInteractivity<V>, NonFocusable>
+pub fn svg<V>() -> Svg<V, StatelessInteraction<V>, FocusDisabled>
 where
     V: 'static + Send + Sync,
 {
@@ -28,8 +28,8 @@ where
 impl<V, I, F> Svg<V, I, F>
 where
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
 {
     pub fn path(mut self, path: impl Into<SharedString>) -> Self {
         self.path = Some(path.into());
@@ -37,10 +37,10 @@ where
     }
 }
 
-impl<V, F> Svg<V, StatelessInteractivity<V>, F>
+impl<V, F> Svg<V, StatelessInteraction<V>, F>
 where
     V: 'static + Send + Sync,
-    F: ElementFocusability<V>,
+    F: ElementFocus<V>,
 {
     pub fn id(self, id: impl Into<ElementId>) -> Svg<V, StatefulInteractivity<V>, F> {
         Svg {
@@ -53,8 +53,8 @@ where
 impl<V, I, F> IntoAnyElement<V> for Svg<V, I, F>
 where
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
 {
     fn into_any(self) -> AnyElement<V> {
         AnyElement::new(self)
@@ -64,8 +64,8 @@ where
 impl<V, I, F> Element for Svg<V, I, F>
 where
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
 {
     type ViewState = V;
     type ElementState = InteractiveElementState;
@@ -116,8 +116,8 @@ where
 impl<V, I, F> Styled for Svg<V, I, F>
 where
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
 {
     fn style(&mut self) -> &mut StyleRefinement {
         self.base.style()
@@ -127,10 +127,10 @@ where
 impl<V, I, F> StatelesslyInteractive for Svg<V, I, F>
 where
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V>,
-    F: ElementFocusability<V>,
+    I: ElementInteraction<V>,
+    F: ElementFocus<V>,
 {
-    fn stateless_interactivity(&mut self) -> &mut StatelessInteractivity<V> {
+    fn stateless_interactivity(&mut self) -> &mut StatelessInteraction<V> {
         self.base.stateless_interactivity()
     }
 }
@@ -138,17 +138,17 @@ where
 impl<V, F> StatefullyInteractive for Svg<V, StatefulInteractivity<V>, F>
 where
     V: 'static + Send + Sync,
-    F: ElementFocusability<V>,
+    F: ElementFocus<V>,
 {
     fn stateful_interactivity(&mut self) -> &mut StatefulInteractivity<Self::ViewState> {
         self.base.stateful_interactivity()
     }
 }
 
-impl<V, I> Focus for Svg<V, I, Focusable<V>>
+impl<V, I> Focusable for Svg<V, I, FocusEnabled<V>>
 where
     V: 'static + Send + Sync,
-    I: ElementInteractivity<V>,
+    I: ElementInteraction<V>,
 {
     fn focus_listeners(&mut self) -> &mut FocusListeners<Self::ViewState> {
         self.base.focus_listeners()

crates/gpui3/src/focus.rs → crates/gpui3/src/focusable.rs 🔗

@@ -7,7 +7,7 @@ pub type FocusListeners<V> = SmallVec<[FocusListener<V>; 2]>;
 pub type FocusListener<V> =
     Arc<dyn Fn(&mut V, &FocusEvent, &mut ViewContext<V>) + Send + Sync + 'static>;
 
-pub trait Focus: Element {
+pub trait Focusable: Element {
     fn focus_listeners(&mut self) -> &mut FocusListeners<Self::ViewState>;
     fn set_focus_style(&mut self, style: StyleRefinement);
     fn set_focus_in_style(&mut self, style: StyleRefinement);

crates/gpui3/src/gpui3.rs 🔗

@@ -5,7 +5,7 @@ mod color;
 mod element;
 mod elements;
 mod executor;
-mod focus;
+mod focusable;
 mod geometry;
 mod image_cache;
 mod interactive;
@@ -30,7 +30,7 @@ pub use color::*;
 pub use element::*;
 pub use elements::*;
 pub use executor::*;
-pub use focus::*;
+pub use focusable::*;
 pub use geometry::*;
 pub use gpui3_macros::*;
 pub use image_cache::*;

crates/gpui3/src/interactive.rs 🔗

@@ -1,7 +1,7 @@
 use crate::{
     point, Action, Bounds, DispatchContext, DispatchPhase, Element, FocusHandle, GroupStyle,
-    Keystroke, Modifiers, Pixels, Point, SharedString, StatefulInteractivity,
-    StatelessInteractivity, StyleRefinement, ViewContext,
+    Keystroke, Modifiers, Pixels, Point, SharedString, StatefulInteractivity, StatelessInteraction,
+    StyleRefinement, ViewContext,
 };
 use std::{
     any::{Any, TypeId},
@@ -10,7 +10,7 @@ use std::{
 };
 
 pub trait StatelesslyInteractive: Element {
-    fn stateless_interactivity(&mut self) -> &mut StatelessInteractivity<Self::ViewState>;
+    fn stateless_interactivity(&mut self) -> &mut StatelessInteraction<Self::ViewState>;
 
     fn on_mouse_down(
         mut self,

crates/storybook2/src/stories/focus.rs 🔗

@@ -1,4 +1,4 @@
-use std::any::Any;
+use std::any::Any;Focusable
 
 use gpui3::{
     div, view, Action, Context, Focus, KeyBinding, ParentElement, StatelesslyInteractive, Styled,