Add hidden-on-hover sidebar mode

Domain ships HIDDEN_SIDEBAR_WIDTH_PX = 8 alongside the existing
collapsed/default tiers. ElyShell tracks sidebar_hover_expanded with
expand_hidden_sidebar / collapse_hidden_sidebar helpers; switching
back to a non-hidden width via the layout cards or core API resets
the flag automatically so the sidebar can never be both hidden and
expanded after a mode change.

Renderer:
- render_sidebar takes a sidebar_hidden flag and routes to a thin
  8 px clickable rail (hover bg + click expands) when the active
  space's width is at HIDDEN.
- While the rail is expanded, render_browser overlays a transparent
  backdrop + the full default-width sidebar absolutely positioned in
  the shell inset, so the main pane content never reflows.
- collapsed_sidebar_active still drives the COLLAPSED-tier compact
  sidebar; the hidden tier is opted out of that path.

Appearance form:
- Layout cards section gains the design's third "Hidden on hover"
  card with a 6 px sliver preview that mutates the active space to
  HIDDEN_SIDEBAR_WIDTH_PX. LayoutMode now derives id/width/preview
  from a small enum so adding a fourth mode would be one match arm.

The hover-expanded state never persists into the domain; once the
user switches modes or clicks the backdrop, it collapses cleanly.
This commit is contained in:
2026-05-09 20:01:31 -04:00
parent c98ca18613
commit 9a2f9f2d74
6 changed files with 145 additions and 28 deletions
+19 -1
View File
@@ -1,7 +1,8 @@
use ely_browser_core::BrowserSnapshot;
use ely_design_system::{colors, spacing};
use ely_domain::{
ArchivedTab, BrowserTab, COLLAPSED_SIDEBAR_WIDTH_PX, DEFAULT_SIDEBAR_WIDTH_PX, Space,
ArchivedTab, BrowserTab, COLLAPSED_SIDEBAR_WIDTH_PX, DEFAULT_SIDEBAR_WIDTH_PX,
HIDDEN_SIDEBAR_WIDTH_PX, Space,
};
use gpui::{
AnyElement, BoxShadow, Context, IntoElement, ParentElement, Styled, Window, div, hsla, point,
@@ -124,6 +125,23 @@ impl ElyShell {
};
if core.set_space_sidebar_width(&active_space_id, width_px).is_ok() {
if width_px > HIDDEN_SIDEBAR_WIDTH_PX {
self.sidebar_hover_expanded = false;
}
cx.notify();
}
}
pub(crate) fn expand_hidden_sidebar(&mut self, cx: &mut Context<Self>) {
if !self.sidebar_hover_expanded {
self.sidebar_hover_expanded = true;
cx.notify();
}
}
pub(crate) fn collapse_hidden_sidebar(&mut self, cx: &mut Context<Self>) {
if self.sidebar_hover_expanded {
self.sidebar_hover_expanded = false;
cx.notify();
}
}