Visual Studio Code, rebuilt in Rust
Rust
feat(workbench): animate toasts, sashes, drop overlays and quick diff (#38)
Artur Rok9401dd5d616f
diff --git a/native/crates/app/src/workbench.rs b/native/crates/app/src/workbench.rsindex 779253f020a..4787c35134a 100644--- a/native/crates/app/src/workbench.rs+++ b/native/crates/app/src/workbench.rs@@ -200,6 +200,7 @@ mod search_view;mod scroll_locking;mod settings_editor_view;mod status_entries;+mod transition;mod parameter_hints;mod action_widget;mod commenting_ranges;@@ -549,6 +550,8 @@ pub struct Workbench {pub(crate) status_entries: Vec<crate::main_thread_status_bar::StatusEntry>,/// The status bar's entries as last drawn, hidden ones included, for its context menu (statusbarModel.ts `entries`).drawn_status_entries: std::cell::RefCell<Vec<status_entries::DrawnStatusEntry>>,+ /// statusbarpart.css `transition: background-color 0.15s ease-out`, as debugging starts and stops.+ status_bar_background: std::cell::Cell<Option<transition::Transition<4>>>,/// Each window's drawn entries, ids and bounds in the bar's order, for statusbarModel.ts `focusNextEntry`.status_entry_bounds: Rc<std::cell::RefCell<Vec<(gpui::WindowId, String, gpui::Bounds<gpui::Pixels>)>>>,/// statusbarModel.ts `getFocusedEntry`: per window, as each window has its own status bar part.@@ -929,6 +932,7 @@ impl Workbench {notifications: notifications_view::NotificationsUi::new(cx),status_entries: Vec::new(),drawn_status_entries: Default::default(),+ status_bar_background: Default::default(),status_entry_bounds: Default::default(),status_entry_focus: HashMap::new(),action_bars: Default::default(),@@ -2148,6 +2152,9 @@ impl Workbench {Some(_) => (self.color("statusBar.foreground"), self.color("statusBar.background")),None => (self.color("statusBar.noFolderForeground"), self.color("statusBar.noFolderBackground")),};+ let duration = std::time::Duration::from_millis(150);+ let (background, moving) = transition::follow(&self.status_bar_background, transition::rgba_values(background), duration, transition::ease_out, !self.is_motion_reduced());+ let background = transition::values_rgba(background);self.drawn_status_entries.borrow_mut().clear();let window_id = window.window_handle().window_id();self.status_entry_bounds.borrow_mut().retain(|(drawn_in, ..)| *drawn_in != window_id);@@ -2192,6 +2199,7 @@ impl Workbench {}).child(self.status_bar_side(left).h(px(height - 4.))).child(self.status_bar_side(right).h(px(height - 4.)))+ .when(moving, |bar| bar.child(transition::next_frame()))}/// The `status.message` entry: multi-chord mode, else the latest status message (notificationsStatus.ts).diff --git a/native/crates/app/src/workbench/centered_layout.rs b/native/crates/app/src/workbench/centered_layout.rsindex bc23ec9e20b..3be03df2fac 100644--- a/native/crates/app/src/workbench/centered_layout.rs+++ b/native/crates/app/src/workbench/centered_layout.rs@@ -8,7 +8,7 @@ use std::rc::Rc;use gpui::{AnyElement, ClickEvent, Context, CursorStyle, InteractiveElement, IntoElement, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, StatefulInteractiveElement, Styled, Task, canvas, div,- prelude::FluentBuilder, px,+ px,};use serde_json::{Value, json};@@ -158,17 +158,17 @@ impl Workbench {fn centered_sash(&self, left_margin: bool, x: f32, cx: &mut Context<Self>) -> AnyElement {let size = self.sash_size();let active = self.centered_layout.hovered == Some(left_margin) || self.centered_layout.drag.is_some_and(|(dragged, ..)| dragged == left_margin);- let hover_border = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));let hover = self.sash_hover_size();+ let id = if left_margin { "centered-sash-left" } else { "centered-sash-right" };div()- .id(if left_margin { "centered-sash-left" } else { "centered-sash-right" })+ .id(id).absolute().top_0().bottom_0().left(px(x - size / 2.)).w(px(size)).cursor(CursorStyle::ResizeColumn)- .when(active, |sash| sash.child(div().absolute().top_0().bottom_0().left(px((size - hover) / 2.)).w(px(hover)).rounded(px(hover / 2.)).bg(hover_border)))+ .children(self.sash_highlight(id, active, div().absolute().top_0().bottom_0().left(px((size - hover) / 2.)).w(px(hover)).rounded(px(hover / 2.)))).on_hover(cx.listener(move |workbench, over: &bool, window, cx| {let layout = &mut workbench.centered_layout;if !*over {diff --git a/native/crates/app/src/workbench/content_hover_view.rs b/native/crates/app/src/workbench/content_hover_view.rsindex a754d4d1d45..7196dccd89e 100644--- a/native/crates/app/src/workbench/content_hover_view.rs+++ b/native/crates/app/src/workbench/content_hover_view.rs@@ -266,7 +266,6 @@ impl Workbench {([vertical.0, true, !vertical.0], [right - half, vertical.1, SASH_SIZE, SASH_SIZE], corner),];let dragging = self.content_hover.resize.as_ref().map(|resize| [resize.north, resize.east, resize.south]);- let highlight = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));let workbench = cx.entity();let mut elements = Vec::new();for (index, (edges, [left, top, width, height], cursor)) in sashes.into_iter().enumerate() {@@ -281,7 +280,7 @@ impl Workbench {.h(px(height)).cursor(cursor).occlude()- .when((dragging == Some(edges) || self.content_hover.hovered_sash == Some(index)) && index < 2, |sash| sash.bg(highlight))+ .children(self.sash_highlight(("content-hover-sash", index), (dragging == Some(edges) || self.content_hover.hovered_sash == Some(index)) && index < 2, div().absolute().inset_0())).on_hover(self.content_hover_sash_hover_listener(index, cx)).on_mouse_down(MouseButton::Left, cx.listener(move |workbench, event: &MouseDownEvent, _, cx| {cx.stop_propagation();diff --git a/native/crates/app/src/workbench/editor_groups.rs b/native/crates/app/src/workbench/editor_groups.rsindex 3e958f12313..521485f0715 100644--- a/native/crates/app/src/workbench/editor_groups.rs+++ b/native/crates/app/src/workbench/editor_groups.rs@@ -22,6 +22,7 @@ use crate::commands::Outcome;use crate::editor::{MODAL_GROUP, is_panel_group};use crate::editor_grid::{Direction, EditorGrid, GridSash, GroupLayout, Orientation, SashId, SplitSizing};use crate::split_view::SashState;+use super::transition::{Transition, ease_out, next_frame};/// What the code editor of a group that is not the active one keeps between frames; swapped with the/// workbench's fields when the group becomes active.@@ -99,6 +100,8 @@ pub(super) struct EditorGroups {really_active: Option<u32>,/// editorDropTarget.ts: the group a dragged tab is over and the side it would split, `None` to move into it.drop_target: Option<(u32, Option<Direction>)>,+ /// The drop overlay shown, editor group's or view pane's, and its rect's move.+ drop_overlay: std::cell::RefCell<Option<(gpui::ElementId, Transition<4>)>>,/// The tab being dragged, from the drag's start to its release (auxiliary_windows.rs `cross_window_drag`).pub(super) dragged_tab: Option<DraggedTab>,/// Each group's tab bars' scrolling, by group and `upper` bar; read while drawing.@@ -1044,20 +1047,20 @@ impl Workbench {let title_height = if self.editors.group_tabs(group).0.is_empty() { 0. } else { 32. };let target = self.editor_groups.drop_target.filter(|(over, _)| *over == group && cx.has_active_drag());let prefer_vertical = self.side_by_side_direction() == Direction::Right;- let overlay = target.map(|(_, direction)| {- let fill = div().absolute().bg(self.color("editorGroup.dropBackground"));- let fill = match self.theme.color("activeContrastBorder") {- Some(border) => fill.border_2().border_dashed().border_color(border),- None => fill,- };- let area = div().absolute().left_0().right_0().bottom_0().top(px(title_height));- area.child(match direction {- None => fill.inset_0(),- Some(Direction::Up) => fill.top_0().left_0().right_0().h_1_2(),- Some(Direction::Down) => fill.bottom_0().left_0().right_0().h_1_2(),- Some(Direction::Left) => fill.top_0().bottom_0().left_0().w_1_2(),- Some(Direction::Right) => fill.top_0().bottom_0().right_0().w_1_2(),- })+ let rect = target.map(|(_, direction)| match direction {+ None => [0., 0., 1., 1.],+ Some(Direction::Up) => [0., 0., 1., 0.5],+ Some(Direction::Down) => [0., 0.5, 1., 0.5],+ Some(Direction::Left) => [0., 0., 0.5, 1.],+ Some(Direction::Right) => [0.5, 0., 0.5, 1.],+ });+ let fill = div().bg(self.color("editorGroup.dropBackground"));+ let fill = match self.theme.color("activeContrastBorder") {+ Some(border) => fill.border_2().border_dashed().border_color(border),+ None => fill,+ };+ let overlay = self.drop_overlay(("group-drop-overlay", group as usize).into(), rect, fill).map(|overlay| {+ div().absolute().left_0().right_0().bottom_0().top(px(title_height)).child(overlay)});body.id(("group-drop", group as usize)).on_drag_move::<DraggedTab>(cx.listener(move |workbench, event: &DragMoveEvent<DraggedTab>, _, cx| {@@ -1078,6 +1081,35 @@ impl Workbench {.children(overlay)}+ /// editordroptarget.css, paneview.css: drop overlay `key` with `fill` at `rect` (left, top, width and height as+ /// fractions of its area) fades in over 150ms, and moves to a new rect over 70ms, both ease-out; `None` hides it.+ pub(super) fn drop_overlay(&self, key: gpui::ElementId, rect: Option<[f32; 4]>, fill: Div) -> Option<gpui::AnyElement> {+ let mut shown = self.editor_groups.drop_overlay.borrow_mut();+ let Some(rect) = rect else {+ // The render that takes an overlay away forgets it, so the next one starts where it shows.+ if shown.as_ref().is_some_and(|(shown_key, _)| *shown_key == key) {+ *shown = None;+ }+ return None;+ };+ let now = std::time::Instant::now();+ let animate = !self.is_motion_reduced();+ let mut transition = match shown.take() {+ Some((shown_key, transition)) if shown_key == key => transition,+ _ => Transition::new(rect, std::time::Duration::from_millis(70), ease_out, now),+ };+ transition.set(rect, now, animate);+ *shown = Some((key.clone(), transition));+ let [left, top, width, height] = transition.value(now);+ let relative = gpui::relative;+ let overlay = fill.absolute().left(relative(left)).top(relative(top)).w(relative(width)).h(relative(height)).when(transition.moving(now), |overlay| overlay.child(next_frame()));+ if !animate {+ return Some(overlay.into_any_element());+ }+ let fade = gpui::Animation::new(std::time::Duration::from_millis(150)).with_easing(ease_out);+ Some(gpui::AnimationExt::with_animation(overlay, key, fade, |overlay, delta| overlay.opacity(delta)).into_any_element())+ }+/// `getSplitDirection` for the pointer over a group's drop area (below its tabs).fn drag_over_group(&mut self, group: u32, bounds: Bounds<Pixels>, position: gpui::Point<Pixels>, title_height: f32, prefer_vertical: bool, cx: &mut Context<Self>) {let (x, y) = (f32::from(position.x - bounds.origin.x), f32::from(position.y - bounds.origin.y) - title_height);@@ -1171,7 +1203,6 @@ impl Workbench {let vertical = sash.orientation == Orientation::Horizontal;let grid = self.editor_groups.grid.as_ref().expect("sashes are drawn with the grid");let active = self.editor_groups.hovered_sash.as_ref() == Some(&sash.id) || grid.dragged_sash().is_some_and(|(dragged, _)| dragged == sash.id);- let hover_border = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));let cursor = match (vertical, sash.state) {(true, SashState::AtMinimum) => CursorStyle::ResizeRight,(true, SashState::AtMaximum) => CursorStyle::ResizeLeft,@@ -1181,24 +1212,24 @@ impl Workbench {(false, _) => CursorStyle::ResizeRow,};let (hovered, pressed) = (sash.id.clone(), sash.id.clone());+ let id = gpui::ElementId::Name(format!("group-sash-{:?}", sash.id).into());+ // `--vscode-sash-hover-size`, centered in the sash.+ let (size, hover) = (self.sash_size(), self.sash_hover_size());+ // modernUI roundedCorners.css: the highlight's ends are rounded by half its size.+ let highlight = div().absolute().rounded(px(hover / 2.));+ let highlight = match vertical {+ true => highlight.top_0().bottom_0().left(px((size - hover) / 2.)).w(px(hover)),+ false => highlight.left_0().right_0().top(px((size - hover) / 2.)).h(px(hover)),+ };div()- .id(gpui::ElementId::Name(format!("group-sash-{:?}", sash.id).into()))+ .id(id.clone()).absolute().left(px(sash.rect.x)).top(px(sash.rect.y)).w(px(sash.rect.width)).h(px(sash.rect.height)).cursor(cursor)- .when(active, |element| {- // `--vscode-sash-hover-size`, centered in the sash.- let (size, hover) = (self.sash_size(), self.sash_hover_size());- // modernUI roundedCorners.css: the highlight's ends are rounded by half its size.- let highlight = div().absolute().rounded(px(hover / 2.)).bg(hover_border);- element.child(match vertical {- true => highlight.top_0().bottom_0().left(px((size - hover) / 2.)).w(px(hover)),- false => highlight.left_0().right_0().top(px((size - hover) / 2.)).h(px(hover)),- })- })+ .children(self.sash_highlight(id, active, highlight)).on_hover(cx.listener(move |workbench, over: &bool, window, cx| {let sashes = &mut workbench.editor_groups;if !*over {diff --git a/native/crates/app/src/workbench/editor_view.rs b/native/crates/app/src/workbench/editor_view.rsindex 55acc193b2c..88deabf9db1 100644--- a/native/crates/app/src/workbench/editor_view.rs+++ b/native/crates/app/src/workbench/editor_view.rs@@ -3525,15 +3525,9 @@ impl FoldControls {}}-/// CSS `ease`, cubic-bezier(0.25, 0.1, 0.25, 1): the curve's x solved by bisection, then its y.+/// CSS `ease`, cubic-bezier(0.25, 0.1, 0.25, 1).pub(super) fn ease(x: f32) -> f32 {- let bezier = |p1: f32, p2: f32, t: f32| 3. * p1 * t * (1. - t).powi(2) + 3. * p2 * t * t * (1. - t) + t.powi(3);- let (mut low, mut high) = (0., 1.);- for _ in 0..24 {- let mid = (low + high) / 2.;- if bezier(0.25, 0.25, mid) < x { low = mid } else { high = mid }- }- bezier(0.1, 1., (low + high) / 2.)+ super::transition::cubic_bezier(0.25, 0.1, 0.25, 1., x)}#[derive(Clone, Copy)]diff --git a/native/crates/app/src/workbench/editor_view/multi_diff_editor_view.rs b/native/crates/app/src/workbench/editor_view/multi_diff_editor_view.rsindex a25524ad7de..ae58f9e0bbb 100644--- a/native/crates/app/src/workbench/editor_view/multi_diff_editor_view.rs+++ b/native/crates/app/src/workbench/editor_view/multi_diff_editor_view.rs@@ -925,7 +925,6 @@ impl Workbench {fn multi_diff_file_list_sash(&self, boundary: f32, width: f32, cx: &mut Context<Self>) -> AnyElement {let size = self.sash_size();let active = self.multi_diff_sash.hovered || self.multi_diff_sash.drag.is_some();- let hover_border = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));let hover = self.sash_hover_size();div().id("multi-diff-file-list-sash")@@ -936,7 +935,7 @@ impl Workbench {.left(px(boundary - size / 2.)).w(px(size)).cursor(gpui::CursorStyle::ResizeColumn)- .when(active, |sash| sash.child(div().absolute().top_0().bottom_0().left(px((size - hover) / 2.)).w(px(hover)).rounded(px(hover / 2.)).bg(hover_border)))+ .children(self.sash_highlight("multi-diff-file-list-sash", active, div().absolute().top_0().bottom_0().left(px((size - hover) / 2.)).w(px(hover)).rounded(px(hover / 2.)))).on_hover(cx.listener(|workbench, over: &bool, window, cx| {workbench.multi_diff_sash.hovered = false;workbench.multi_diff_sash.hover = None;diff --git a/native/crates/app/src/workbench/editor_view/quick_diff.rs b/native/crates/app/src/workbench/editor_view/quick_diff.rsindex 2051f4c3511..44e09cffe37 100644--- a/native/crates/app/src/workbench/editor_view/quick_diff.rs+++ b/native/crates/app/src/workbench/editor_view/quick_diff.rs@@ -15,6 +15,7 @@ use crate::diff_editor::Side;use crate::editor::OpenEditor;use crate::workbench::Workbench;use crate::workbench::host_requests::uri_parts;+use crate::workbench::transition::{Transition, next_frame, toggle};/// quickDiffModel.ts `options.maxComputationTimeMs`.const MAX_COMPUTATION_TIME_MS: u64 = 1000;@@ -111,6 +112,9 @@ pub struct QuickDiffs {editor_diff_information: HashMap<String, Value>,/// `hiddenQuickDiffProviders`, read from profile storage once.hidden: Option<HashSet<String>>,+ /// The glyph under the pointer, by model id and line index, and the widths growing or shrinking back.+ hovered_glyph: Option<(u32, usize)>,+ glyph_widths: std::cell::RefCell<HashMap<(u32, usize), Transition<1>>>,}/// `toLineChanges` of the diff's mappings, for the quick diff `provider`.@@ -589,7 +593,12 @@ impl Workbench {return None;}let left = metrics.glyph_margin_width() + metrics.line_numbers_width + 5.;- let opacity = if self.setting("scm.diffDecorationsGutterVisibility") == json!("hover") { 0. } else { 1. };+ // dirtydiffDecorator.css: `.margin:hover` shows the glyphs with the fold controls' 0.5s opacity fade.+ let opacity = if self.setting("scm.diffDecorationsGutterVisibility") == json!("hover") { self.fold_controls.opacity(std::time::Instant::now()) } else { 1. };+ let action = self.setting("scm.diffDecorationsGutterAction") != json!("none");+ let key = (editor.model_id, index);+ // quickDiffWidget.ts: the hovered glyph's `:before` grows from 0 to 6px wide, `left` from -2px to -6px, 80ms linear.+ let hover = toggle(&self.quick_diffs.glyph_widths, key, action && self.quick_diffs.hovered_glyph == Some(key), std::time::Duration::from_millis(80), |x| x, !self.is_motion_reduced());let width = self.setting("scm.diffDecorationsGutterWidth").as_f64().filter(|width| *width > 0. && *width <= 5.).unwrap_or(3.) as f32;let pattern = self.setting("scm.diffDecorationsGutterPattern");let gutter_background = self.color("editorGutter.background");@@ -619,17 +628,25 @@ impl Workbench {};// `.pattern:before` sits 3px right of where a solid glyph's does.let hover_left = if striped { -3. } else { -6. };- let hover_bar = bar(div().absolute().top_0().h_full().left(px(hover_left)).w(px(6.)).overflow_hidden()).opacity(0.).group_hover("quick-diff-glyph", |bar| bar.opacity(1.));- bar(div().absolute().inset_0().overflow_hidden()).child(hover_bar)+ let hover_bar = hover.map(|(grown, _)| bar(div().absolute().top_0().h_full().left(px(hover_left + 4. * (1. - grown))).w(px(6. * grown)).overflow_hidden()));+ bar(div().absolute().inset_0().overflow_hidden()).children(hover_bar)}};lane = lane.child(glyph);}- let lane = lane.id(("quick-diff-glyph", index)).child(self.hover_target(gpui::SharedString::from(format!("quick-diff-glyph-hover-{index}")), crate::workbench::hover::HoverContent::Text(tooltip.into()), crate::workbench::hover::HoverOptions::mouse()));- if self.setting("scm.diffDecorationsGutterAction") == json!("none") {+ let lane = lane.id(("quick-diff-glyph", index)).when(hover.is_some_and(|(_, moving)| moving), |lane| lane.child(next_frame())).child(self.hover_target(gpui::SharedString::from(format!("quick-diff-glyph-hover-{index}")), crate::workbench::hover::HoverContent::Text(tooltip.into()), crate::workbench::hover::HoverOptions::mouse()));+ if !action {return Some(lane);}- Some(lane.group("quick-diff-glyph").cursor_pointer().on_click(cx.listener(move |workbench, _: &gpui::ClickEvent, window, cx| {+ let hover_listener = cx.listener(move |workbench, hovered: &bool, _, cx| {+ match *hovered {+ true => workbench.quick_diffs.hovered_glyph = Some(key),+ false if workbench.quick_diffs.hovered_glyph == Some(key) => workbench.quick_diffs.hovered_glyph = None,+ false => return,+ }+ cx.notify();+ });+ Some(lane.cursor_pointer().on_hover(hover_listener).on_click(cx.listener(move |workbench, _: &gpui::ClickEvent, window, cx| {cx.stop_propagation();workbench.quick_diff_glyph_clicked(line, window, cx);})))diff --git a/native/crates/app/src/workbench/find_widget.rs b/native/crates/app/src/workbench/find_widget.rsindex 5c2ea55dcdd..214cc7215b8 100644--- a/native/crates/app/src/workbench/find_widget.rs+++ b/native/crates/app/src/workbench/find_widget.rs@@ -1187,8 +1187,7 @@ impl Workbench {let dragging = self.find.sash_drag.is_some();// sash.css `::before`: 4px of `sash.hoverBorder` centered on the 2px sash, its left pixel and the ends in// the 8px corners clipped by the widget (GPUI clips to the rectangle).- let hover_border = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));- let highlight = div().absolute().left_0().top(px(3.)).w(px(3.)).h(px(height - 8.)).bg(hover_border);+ let highlight = div().absolute().left_0().top(px(3.)).w(px(3.)).h(px(height - 8.));div().id("find-sash").absolute()@@ -1198,7 +1197,7 @@ impl Workbench {.h(px(height - 2.)).bg(color).cursor_col_resize()- .when(dragging || self.find.sash_hovered, |sash| sash.child(highlight))+ .children(self.sash_highlight("find-sash", dragging || self.find.sash_hovered, highlight)).on_hover(cx.listener(|workbench, hovered: &bool, window, cx| {workbench.find.sash_hovered = false;let delay = workbench.sash_hover_delay();diff --git a/native/crates/app/src/workbench/keybindings_editor_view.rs b/native/crates/app/src/workbench/keybindings_editor_view.rsindex 19d3e17a595..78055b00ca7 100644--- a/native/crates/app/src/workbench/keybindings_editor_view.rs+++ b/native/crates/app/src/workbench/keybindings_editor_view.rs@@ -1279,8 +1279,7 @@ impl Workbench {fn column_sash(&self, index: usize, x: f32, state: SashState, border: Rgba, cx: &mut Context<Self>) -> AnyElement {let editor = &self.keybindings_editor;let active = editor.sash_hovered == Some(index) || editor.columns.dragged_sash() == Some(index);- let hover_border = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));- let line = |color: Rgba| div().absolute().left(px(SASH_SIZE / 2.)).top(px(TABLE_HEADER_HEIGHT + 1.)).bottom_0().w(px(1.)).bg(color);+ let line = || div().absolute().left(px(SASH_SIZE / 2.)).top(px(TABLE_HEADER_HEIGHT + 1.)).bottom_0().w(px(1.));let sash = div().id(("column-sash", index)).absolute()@@ -1288,8 +1287,8 @@ impl Workbench {.bottom_0().left(px(x - SASH_SIZE / 2.)).w(px(SASH_SIZE))- .when(active, |sash| sash.child(line(hover_border)))- .child(line(border));+ .children(self.sash_highlight(("column-sash", index), active, line()))+ .child(line().bg(border));if state == SashState::Disabled {return sash.into_any_element();}diff --git a/native/crates/app/src/workbench/notifications_view.rs b/native/crates/app/src/workbench/notifications_view.rsindex 7715a5794f3..a097adad6fd 100644--- a/native/crates/app/src/workbench/notifications_view.rs+++ b/native/crates/app/src/workbench/notifications_view.rs@@ -7,7 +7,7 @@ use std::time::{Duration, Instant};use futures::channel::oneshot;use gpui::{- AnyElement, Bounds, BoxShadow, ClickEvent, Context, Div, FocusHandle, FontWeight, InteractiveText, MouseButton, MouseDownEvent, Pixels, Point, Rgba, SharedString,+ Animation, AnimationExt, AnyElement, Bounds, BoxShadow, ClickEvent, Context, Div, FocusHandle, FontWeight, InteractiveText, MouseButton, MouseDownEvent, Pixels, Point, Rgba, SharedString,Size, Stateful, StyledText, Task, TextRun, Window, div, point, prelude::*, px, rgba,};use serde_json::{Value, json};@@ -15,6 +15,7 @@ use serde_json::{Value, json};use super::Workbench;use super::hover::{HoverContent, HoverOptions};use super::opener::{OpenOptions, Target};+use super::transition::ease_out;use crate::commands::Outcome;use crate::main_thread_progress::ProgressTask;use crate::menus::MenuAction;@@ -494,12 +495,13 @@ impl Workbench {}let keys: Vec<u64> = self.notifications.toasts.iter().take(MAX_TOASTS).map(|toast| toast.key).collect();let last = keys.len() - 1;+ let animate = !self.is_motion_reduced();let toasts = keys.into_iter().enumerate().filter_map(|(index, key)| {let item = self.notifications.model.item(key)?.clone();+ let height = self.notification_height(&item, window) + 2.;let toast = self.notification_row(&item, false, false, window, cx);let hovered_key = key;- Some(- div()+ let element = div().id(("notification-toast", key)).mx(px(4.)).mt(px(4.))@@ -521,8 +523,21 @@ impl Workbench {}cx.notify();}))- .child(toast),- )+ .child(toast);+ if !animate {+ return Some(element.into_any_element());+ }+ // notificationsToasts.css `.notification-fade-in`: 300ms ease-out from transparent and one toast height+ // lower, or one toast width to the right at the top right.+ let slide_right = position == Position::TopRight;+ let animation = Animation::new(Duration::from_millis(300)).with_easing(ease_out);+ Some(element.with_animation(("notification-toast-in", key), animation, move |toast, delta| {+ let toast = toast.opacity(delta);+ match slide_right {+ true => toast.left(px((WIDTH + 2.) * (1. - delta))),+ false => toast.top(px(height * (1. - delta))),+ }+ }).into_any_element())}).collect::<Vec<_>>();let container = div().id("notification-toasts").debug_selector(|| "notification-toasts".into()).role(gpui::Role::List).aria_label("Notification Toast").flex().flex_col().occlude().track_focus(&self.notifications.focus).children(toasts);Some(place(container, position, TOASTS_OFFSET, self.is_status_bar_visible()).into_any_element())diff --git a/native/crates/app/src/workbench/part_grid.rs b/native/crates/app/src/workbench/part_grid.rsindex 77e6678a1d0..2cdda68277d 100644--- a/native/crates/app/src/workbench/part_grid.rs+++ b/native/crates/app/src/workbench/part_grid.rs@@ -1,11 +1,12 @@//! The workbench's part grid (browser/layout.ts): part sizes and visibility in `LayoutStateModel`'s storage keys,//! the sashes between the parts, and the layout commands of layoutActions.ts.+use std::cell::RefCell;use std::collections::HashMap;use std::time::Duration;use gpui::{- AnyElement, Context, CursorStyle, Div, InteractiveElement, IntoElement, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, Pixels, Size, StatefulInteractiveElement, Styled, Task, Window, canvas, div,+ AnyElement, Context, CursorStyle, Div, ElementId, InteractiveElement, IntoElement, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, Pixels, Size, StatefulInteractiveElement, Styled, Task, Window, canvas, div,prelude::FluentBuilder, px,};use serde_json::{Value, json};@@ -13,6 +14,7 @@ use serde_json::{Value, json};use super::Workbench;use super::layout::{Alignment, Arrangement, Grid, Part, PartSizes, Position, Sash, card_margins};use super::part_view::CachedPart;+use super::transition::{Transition, ease_out, next_frame, toggle};use crate::commands::Outcome;use crate::split_view::SashState;@@ -21,6 +23,8 @@ const TITLE_BAR_HEIGHT: f32 = 35.;/// `workbench.sash.hoverDelay` and `workbench.sash.size` defaults.const SASH_HOVER_DELAY: f64 = 300.;const SASH_SIZE: f32 = 4.;+/// sash.css `.monaco-sash:before`: `transition: background-color 0.1s ease-out`.+const SASH_HIGHLIGHT_TRANSITION: Duration = Duration::from_millis(100);/// `LayoutStateModel.STORAGE_PREFIX`.const STORAGE_PREFIX: &str = "workbench.";/// `LayoutStateKeys` of the panel's place: position in workspace storage, alignment in profile storage.@@ -49,6 +53,8 @@ pub(super) struct PartGrid {/// The main part's visible editors (each grid group's active editor) at the last editor change; `None` until the/// first one, as layout.ts listens only after `whenRestored`.visible_editors: Option<Vec<u32>>,+ /// The highlight opacity of every sash in the window that is active or fading out, by element id.+ sash_highlights: RefCell<HashMap<ElementId, Transition<1>>>,}/// `LayoutStateKeys`' visibility key of a part and its default; the side bar defaults to hidden in an empty window.@@ -391,6 +397,15 @@ impl Workbench {self.setting("workbench.sash.size").as_f64().map_or(SASH_SIZE, |size| (size as f32).clamp(1., 8.))}+ /// The `:before` of a sash as `highlight` with `sash.hoverBorder` fading in as sash `id` turns active (hovered+ /// after the delay, or dragged) and out after it; `None` once it faded out.+ pub(super) fn sash_highlight(&self, id: impl Into<ElementId>, active: bool, highlight: Div) -> Option<Div> {+ let (opacity, moving) = toggle(&self.part_grid.sash_highlights, id.into(), active, SASH_HIGHLIGHT_TRANSITION, ease_out, !self.is_motion_reduced())?;+ let mut color = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));+ color.a *= opacity;+ Some(highlight.bg(color).when(moving, |highlight| highlight.child(next_frame())))+ }+/// `workbench.sash.hoverDelay` (0..2000 in its schema) before a hovered sash shows its border (`setGlobalHoverDelay`).pub(super) fn sash_hover_delay(&self) -> Duration {Duration::from_millis(self.setting("workbench.sash.hoverDelay").as_f64().map_or(SASH_HOVER_DELAY, |delay| delay.clamp(0., 2000.)) as u64)@@ -602,7 +617,6 @@ impl Workbench {let id = ("part-sash", sash.branch * 16 + sash.index);let grid = self.part_grid.grid.as_ref().expect("sashes are drawn with the grid");let active = self.part_grid.hovered == Some(sash) || grid.dragged_sash() == Some(sash);- let hover_border = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));// floatingPanels.css: a vertical sash's highlight stops `--modern-ui-floating-card-statusbar-margin` above the status bar.let compact = grid.is_compact();let highlight_inset = if vertical && !compact { super::layout::CARD_MARGIN } else { 0. };@@ -615,7 +629,7 @@ impl Workbench {.h(px(height))// sashHandles.css: compact cards meet edge to edge, without grips..when(!active && !compact && !self.part_grid.grippers_hidden, |element| element.child(self.sash_gripper(vertical, width, height)))- .when(active, |sash| sash.child(div().absolute().top_0().left_0().right_0().bottom(px(highlight_inset)).rounded(px(self.sash_hover_size() / 2.)).bg(hover_border)));+ .children(self.sash_highlight(id, active, div().absolute().top_0().left_0().right_0().bottom(px(highlight_inset)).rounded(px(self.sash_hover_size() / 2.))));let cursor = match (vertical, state) {(true, SashState::AtMinimum) => CursorStyle::ResizeRight,(true, SashState::AtMaximum) => CursorStyle::ResizeLeft,diff --git a/native/crates/app/src/workbench/peek_view.rs b/native/crates/app/src/workbench/peek_view.rsindex 39c2e518c38..e86d080dc8d 100644--- a/native/crates/app/src/workbench/peek_view.rs+++ b/native/crates/app/src/workbench/peek_view.rs@@ -230,23 +230,23 @@ impl Workbench {/// A `.monaco-sash` (sash.css): 4px, the mac resize cursor, `sash.hoverBorder` after the hover delay and while dragged.fn peek_sash(&self, kind: PeekKind, layout: &PeekLayout, sash: PeekSash, [x, y, w, h]: [f32; 4], (size, width): (f32, f32), cx: &mut Context<Self>) -> AnyElement {let active = layout.hovered_sash == Some(sash) || layout.sash_drag.is_some_and(|(dragged, ..)| dragged == sash);- let hover_border = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));let cursor = match sash {PeekSash::Zone => gpui::CursorStyle::ResizeRow,PeekSash::Split => gpui::CursorStyle::ResizeColumn,};+ let id = match sash {+ PeekSash::Zone => "peek-zone-sash",+ PeekSash::Split => "peek-split-sash",+ };div()- .id(match sash {- PeekSash::Zone => "peek-zone-sash",- PeekSash::Split => "peek-split-sash",- })+ .id(id).absolute().left(px(x)).top(px(y)).w(px(w)).h(px(h)).cursor(cursor)- .when(active, |element| element.bg(hover_border))+ .children(self.sash_highlight(id, active, div().absolute().inset_0())).on_hover(cx.listener(move |workbench, hovered: &bool, window, cx| {let Some(layout) = workbench.peek_layout_mut(kind) else { return };layout.hovered_sash = None;diff --git a/native/crates/app/src/workbench/problems_table.rs b/native/crates/app/src/workbench/problems_table.rsindex dcd08ddbd6b..589e15a42a1 100644--- a/native/crates/app/src/workbench/problems_table.rs+++ b/native/crates/app/src/workbench/problems_table.rs@@ -180,9 +180,8 @@ impl Workbench {fn problems_column_sash(&self, index: usize, x: f32, state: SashState, border: Rgba, cx: &mut Context<Self>) -> AnyElement {let table = &self.problems.table_view;let active = table.sash_hovered == Some(index) || table.columns.dragged_sash() == Some(index);- let hover_border = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));- let line = |color: Rgba| div().absolute().left(px(SASH_SIZE / 2.)).top(px(HEADER_HEIGHT)).bottom_0().w(px(1.)).bg(color);- let sash = div().id(("problems-column-sash", index)).absolute().top_0().bottom_0().left(px(x - SASH_SIZE / 2.)).w(px(SASH_SIZE)).child(line(border)).when(active, |sash| sash.child(line(hover_border)));+ let line = || div().absolute().left(px(SASH_SIZE / 2.)).top(px(HEADER_HEIGHT)).bottom_0().w(px(1.));+ let sash = div().id(("problems-column-sash", index)).absolute().top_0().bottom_0().left(px(x - SASH_SIZE / 2.)).w(px(SASH_SIZE)).child(line().bg(border)).children(self.sash_highlight(("problems-column-sash", index), active, line()));if state == SashState::Disabled {return sash.into_any_element();}diff --git a/native/crates/app/src/workbench/settings_editor_view.rs b/native/crates/app/src/workbench/settings_editor_view.rsindex d37168e989c..a0ac1a58895 100644--- a/native/crates/app/src/workbench/settings_editor_view.rs+++ b/native/crates/app/src/workbench/settings_editor_view.rs@@ -1082,7 +1082,6 @@ impl Workbench {let editor = &self.settings_editor;let dragging = editor.split.as_ref().is_some_and(|split| split.dragged_sash().is_some());let separator = self.theme.color("settings.sashBorder").unwrap_or(transparent());- let hover = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));div().id("settings-sash").debug_selector(|| "settings-sash".into())@@ -1093,7 +1092,7 @@ impl Workbench {.w(px(SASH_SIZE)).cursor(gpui::CursorStyle::ResizeColumn).child(div().absolute().top_0().bottom_0().left(px(SASH_SIZE / 2.)).w(px(1.)).bg(separator))- .when(editor.sash_hovered || dragging, |sash| sash.bg(hover))+ .children(self.sash_highlight("settings-sash", editor.sash_hovered || dragging, div().absolute().inset_0())).on_hover(cx.listener(|workbench, hovered: &bool, window, cx| {let delay = workbench.sash_hover_delay();let editor = &mut workbench.settings_editor;diff --git a/native/crates/app/src/workbench/side_by_side_editor.rs b/native/crates/app/src/workbench/side_by_side_editor.rsindex 7ed4355ea80..92eb9d86e43 100644--- a/native/crates/app/src/workbench/side_by_side_editor.rs+++ b/native/crates/app/src/workbench/side_by_side_editor.rs@@ -173,7 +173,6 @@ impl Workbench {let hover = self.sash_hover_size();let splits = &self.side_by_side_splits;let active = splits.hovered == Some(entry) || splits.drag.is_some_and(|drag| drag.entry == entry);- let hover_border = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));let minimum = if vertical { MINIMUM_HEIGHT } else { MINIMUM_WIDTH };let laid_out = splits.sizes.borrow().get(&entry).copied().unwrap_or_default();let secondary_size = laid_out * ratio;@@ -192,12 +191,12 @@ impl Workbench {true => sash.left_0().right_0().top(gpui::relative(ratio)).mt(px(-size / 2.)).h(px(size)),false => sash.top_0().bottom_0().left(gpui::relative(ratio)).ml(px(-size / 2.)).w(px(size)),};- let highlight = div().absolute().rounded(px(hover / 2.)).bg(hover_border);+ let highlight = div().absolute().rounded(px(hover / 2.));let highlight = match vertical {true => highlight.left_0().right_0().top(px((size - hover) / 2.)).h(px(hover)),false => highlight.top_0().bottom_0().left(px((size - hover) / 2.)).w(px(hover)),};- sash.when(active, |sash| sash.child(highlight))+ sash.children(self.sash_highlight(("side-by-side-sash", entry as usize), active, highlight)).on_hover(cx.listener(move |workbench, over: &bool, window, cx| {let splits = &mut workbench.side_by_side_splits;if !*over {diff --git a/native/crates/app/src/workbench/suggest_widget.rs b/native/crates/app/src/workbench/suggest_widget.rsindex bbbdb27a8e1..b2e8ccfc5bb 100644--- a/native/crates/app/src/workbench/suggest_widget.rs+++ b/native/crates/app/src/workbench/suggest_widget.rs@@ -455,7 +455,6 @@ impl Workbench {let corner = if above { gpui::CursorStyle::ResizeUpRightDownLeft } else { gpui::CursorStyle::ResizeUpLeftDownRight };sashes.push(([vertical.0, true, !vertical.0], [origin.x + size.width - half, vertical.1, SASH_SIZE, SASH_SIZE], corner));let dragging = self.suggest.widget.resize.is_some();- let highlight = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));let workbench = cx.entity();let mut elements = Vec::new();for (index, ([north, east, south], [left, top, width, height], cursor)) in sashes.into_iter().enumerate() {@@ -470,7 +469,7 @@ impl Workbench {.h(px(height)).cursor(cursor).occlude()- .when((resize.is_some() || self.suggest.widget.hovered_sash == Some(("list", index))) && index < 2, |sash| sash.bg(highlight))+ .children(self.sash_highlight(("suggest-sash", index), (resize.is_some() || self.suggest.widget.hovered_sash == Some(("list", index))) && index < 2, div().absolute().inset_0())).on_hover(self.sash_hover_listener(("list", index), cx)).on_mouse_down(MouseButton::Left, cx.listener(move |workbench, event: &MouseDownEvent, _, cx| {cx.stop_propagation();@@ -645,7 +644,6 @@ impl Workbench {("w", [origin.x - half, origin.y, SASH_SIZE, size.height], gpui::CursorStyle::ResizeLeftRight),];let dragging = self.suggest.widget.details_resize.as_ref().map(|resize| resize.edge);- let highlight = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));let workbench = cx.entity();let mut elements = Vec::new();for (edge, (name, [left, top, width, height], cursor)) in edges.into_iter().enumerate() {@@ -662,7 +660,7 @@ impl Workbench {.h(px(height)).cursor(cursor).occlude()- .when(dragging == Some(edge) || self.suggest.widget.hovered_sash == Some(("details", edge)), |sash| sash.bg(highlight))+ .children(self.sash_highlight(("suggest-details-sash", edge), dragging == Some(edge) || self.suggest.widget.hovered_sash == Some(("details", edge)), div().absolute().inset_0())).on_hover(self.sash_hover_listener(("details", edge), cx)).on_mouse_down(MouseButton::Left, cx.listener(move |workbench, event: &MouseDownEvent, _, cx| {cx.stop_propagation();diff --git a/native/crates/app/src/workbench/transition.rs b/native/crates/app/src/workbench/transition.rsnew file mode 100644index 00000000000..8d0f4537c6d--- /dev/null+++ b/native/crates/app/src/workbench/transition.rs@@ -0,0 +1,156 @@+//! CSS `transition`s for the port's elements: a value that moves to each new target over a duration and timing+//! curve, starting from the value shown when the target changed, and the element that keeps a view drawing while it+//! moves.++use std::cell::{Cell, RefCell};+use std::collections::HashMap;+use std::collections::hash_map::Entry;+use std::hash::Hash;+use std::time::{Duration, Instant};++use gpui::{IntoElement, Rgba, Styled, canvas};++#[derive(Clone, Copy)]+pub(super) struct Transition<const N: usize> {+ from: [f32; N],+ to: [f32; N],+ at: Instant,+ duration: Duration,+ curve: fn(f32) -> f32,+}++impl<const N: usize> Transition<N> {+ pub fn new(value: [f32; N], duration: Duration, curve: fn(f32) -> f32, now: Instant) -> Self {+ Self { from: value, to: value, at: now, duration, curve }+ }++ /// Moves to `target` from the value at `now`, or jumps there without `animate` (reduced motion, also when it+ /// turns on mid-move).+ pub fn set(&mut self, target: [f32; N], now: Instant, animate: bool) {+ if !animate {+ (self.from, self.to) = (target, target);+ return;+ }+ if target == self.to {+ return;+ }+ self.from = self.value(now);+ self.to = target;+ self.at = now;+ }++ pub fn value(&self, now: Instant) -> [f32; N] {+ let progress = (now.saturating_duration_since(self.at).as_secs_f32() / self.duration.as_secs_f32()).min(1.);+ let eased = (self.curve)(progress);+ std::array::from_fn(|index| self.from[index] + (self.to[index] - self.from[index]) * eased)+ }++ pub fn target(&self) -> [f32; N] {+ self.to+ }++ pub fn moving(&self, now: Instant) -> bool {+ self.from != self.to && now < self.at + self.duration+ }+}++/// The value of the transition in `cell` after it moves to `target`, and whether it still moves. The first target+/// shows at once.+pub(super) fn follow<const N: usize>(cell: &Cell<Option<Transition<N>>>, target: [f32; N], duration: Duration, curve: fn(f32) -> f32, animate: bool) -> ([f32; N], bool) {+ let now = Instant::now();+ let mut transition = cell.get().unwrap_or_else(|| Transition::new(target, duration, curve, now));+ transition.set(target, now, animate);+ cell.set(Some(transition));+ (transition.value(now), transition.moving(now))+}++/// The 0 to 1 transition of `key` toward 1 while `on` and back to 0 after, with whether it still moves; `None`+/// once it is back at 0, when `transitions` drops it.+pub(super) fn toggle<K: Hash + Eq>(transitions: &RefCell<HashMap<K, Transition<1>>>, key: K, on: bool, duration: Duration, curve: fn(f32) -> f32, animate: bool) -> Option<(f32, bool)> {+ let now = Instant::now();+ let mut transitions = transitions.borrow_mut();+ let transition = match transitions.entry(key) {+ Entry::Vacant(_) if !on => return None,+ Entry::Vacant(entry) => entry.insert(Transition::new([0.], duration, curve, now)),+ Entry::Occupied(entry) => entry.into_mut(),+ };+ transition.set([if on { 1. } else { 0. }], now, animate);+ let ([value], moving) = (transition.value(now), transition.moving(now));+ if !on && !moving {+ transitions.retain(|_, transition| transition.target() == [1.] || transition.moving(now));+ return None;+ }+ Some((value, moving))+}++pub(super) fn rgba_values(color: Rgba) -> [f32; 4] {+ [color.r, color.g, color.b, color.a]+}++pub(super) fn values_rgba([r, g, b, a]: [f32; 4]) -> Rgba {+ Rgba { r, g, b, a }+}++/// Draws the view again on the next frame, for a render that has no `Window` to ask with.+pub(super) fn next_frame() -> impl IntoElement {+ canvas(|_, window, _| window.request_animation_frame(), |_, _, _, _| {}).absolute()+}++/// A CSS `cubic-bezier(x1, y1, x2, y2)` at `x`: the curve's parameter for `x` found by bisection, then its y.+pub(super) fn cubic_bezier(x1: f32, y1: f32, x2: f32, y2: f32, x: f32) -> f32 {+ if x <= 0. || x >= 1. {+ return x.clamp(0., 1.);+ }+ let bezier = |p1: f32, p2: f32, t: f32| 3. * p1 * t * (1. - t).powi(2) + 3. * p2 * t * t * (1. - t) + t.powi(3);+ let (mut low, mut high) = (0., 1.);+ for _ in 0..24 {+ let mid = (low + high) / 2.;+ if bezier(x1, x2, mid) < x { low = mid } else { high = mid }+ }+ bezier(y1, y2, (low + high) / 2.)+}++pub(super) fn ease_out(x: f32) -> f32 {+ cubic_bezier(0., 0., 0.58, 1., x)+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn a_new_target_moves_from_the_value_shown_then() {+ let start = Instant::now();+ let ms = |millis| start + Duration::from_millis(millis);+ let mut transition = Transition::new([0.], Duration::from_millis(100), |progress| progress, start);+ transition.set([1.], start, true);+ assert!((transition.value(ms(40))[0] - 0.4).abs() < 1e-5);+ transition.set([0.], ms(40), true);+ assert!((transition.value(ms(90))[0] - 0.2).abs() < 1e-5, "back from 0.4, half way");+ assert_eq!(transition.value(ms(140)), [0.]);+ assert!(!transition.moving(ms(140)));+ transition.set([1.], ms(150), false);+ assert_eq!(transition.value(ms(150)), [1.]);+ assert!(!transition.moving(ms(150)));+ }++ #[test]+ fn a_toggle_fades_out_after_off_then_forgets_its_key() {+ let transitions = RefCell::new(HashMap::new());+ let toggle = |on, animate| toggle(&transitions, "sash", on, Duration::from_millis(50), |progress| progress, animate);+ assert_eq!(toggle(false, true), None, "never on: nothing to fade");+ assert_eq!(toggle(true, false), Some((1., false)));+ let (value, moving) = toggle(false, true).expect("fading out");+ assert!(value > 0.9 && moving);+ assert_eq!(toggle(false, false), None, "reduced motion: gone at once");+ assert!(transitions.borrow().is_empty());+ }++ #[test]+ fn ease_out_is_css_ease_out() {+ assert_eq!(ease_out(0.), 0.);+ assert!((ease_out(1.) - 1.).abs() < 1e-5);+ // cubic-bezier(0, 0, 0.58, 1) at x 0.5: t 0.6258, y 0.6847 (by hand from the curve's polynomials).+ assert!((ease_out(0.5) - 0.6847).abs() < 2e-3, "{}", ease_out(0.5));+ }+}diff --git a/native/crates/app/src/workbench/view_panes.rs b/native/crates/app/src/workbench/view_panes.rsindex 8d9b9290bd3..f367c21d3fe 100644--- a/native/crates/app/src/workbench/view_panes.rs+++ b/native/crates/app/src/workbench/view_panes.rs@@ -742,12 +742,15 @@ impl Workbench {workbench.merge_container_into(dragged.id, container, Some((id, below)), cx);}}))- .when_some(drop, |pane, below| {- let half = match horizontal {- true => div().absolute().top_0().bottom_0().w(gpui::relative(0.5)).bg(overlay).when(below, |half| half.right_0()).when(!below, |half| half.left_0()),- false => div().absolute().left_0().right_0().h(gpui::relative(0.5)).bg(overlay).when(below, |half| half.bottom_0()).when(!below, |half| half.top_0()),- };- pane.child(half.when_some(outline, |half, color| half.border_2().border_dashed().border_color(color)))+ .children({+ let rect = drop.map(|below| match (horizontal, below) {+ (true, true) => [0.5, 0., 0.5, 1.],+ (true, false) => [0., 0., 0.5, 1.],+ (false, true) => [0., 0.5, 1., 0.5],+ (false, false) => [0., 0., 1., 0.5],+ });+ let fill = div().bg(overlay).when_some(outline, |half, color| half.border_2().border_dashed().border_color(color));+ self.drop_overlay(gpui::ElementId::Name(format!("pane-drop-overlay-{id}").into()), rect, fill)})}@@ -917,7 +920,6 @@ impl Workbench {let panes = self.panes(container);let dragged = panes.view.as_ref().and_then(PaneView::dragged_sash);let active = panes.hovered_sash == Some(index) || dragged == Some(index);- let hover_border = self.theme.color("sash.hoverBorder").unwrap_or(self.color("focusBorder"));let cursor = match (state, horizontal) {(SashState::AtMinimum, false) => gpui::CursorStyle::ResizeDown,(SashState::AtMaximum, false) => gpui::CursorStyle::ResizeUp,@@ -932,7 +934,7 @@ impl Workbench {.when(horizontal, |sash| sash.top_0().bottom_0().left(px(boundary - 2.)).w(px(4.))).when(!horizontal, |sash| sash.left_0().right_0().top(px(boundary - 2.)).h(px(4.))).cursor(cursor)- .when(active, |sash| sash.bg(hover_border))+ .children(self.sash_highlight(("pane-sash", index), active, div().absolute().inset_0())).on_hover(cx.listener(move |workbench, hovered: &bool, window, cx| {let delay = workbench.sash_hover_delay();let panes = workbench.panes_mut(container);diff --git a/port/ledger.md b/port/ledger.mdindex 2cfc97f92c5..4a37e1a2033 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -278,7 +278,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| base/node | src/vs/base | | removed | | Artur: internal infrastructure or developer tool with no 1:1 counterpart in the native port || base/parts | src/vs/base | | n/a | | Electron process, IPC or DOM layer; replaced by the single-process Rust/GPUI architecture (port/notes.md) || base/test | src/vs/base | M6 | n/a | | upstream test infrastructure; the port tests with cargo test and port/tools |-| platform/accessibility | src/vs/platform | M19 | verified | | workbench/accessibility.rs: IAccessibilityService on the AccessKit tree (is_a11y_active, editor.accessibilitySupport, accessibilityModeEnabled), the editor text area with the paged content as runs and AXValue, the Explorer tree, aria live region; port/tools/a11y-check (AXValue line 2 at AXInsertionPointLineNumber, Explorer AXOutline and AXRows, Accessibility Help text area); cargo test -p app accessib (12); `isMotionReduced` (`workbench.reduceMotion` on/off/auto with the macOS Reduce Motion setting) gating the port's `.monaco-enable-motion` effects (table column borders always shown, find widget slide, folding icon fade, indent guide fade, quick input open/close) and the webviews' `reduceMotion`: cargo test -p app reduced_motion_shows_the_column_borders_without_hover, ui-pair problems table (port/results/problems.md) |+| platform/accessibility | src/vs/platform | M19 | verified | | workbench/accessibility.rs: IAccessibilityService on the AccessKit tree (is_a11y_active, editor.accessibilitySupport, accessibilityModeEnabled), the editor text area with the paged content as runs and AXValue, the Explorer tree, aria live region; port/tools/a11y-check (AXValue line 2 at AXInsertionPointLineNumber, Explorer AXOutline and AXRows, Accessibility Help text area); cargo test -p app accessib (12); `isMotionReduced` (`workbench.reduceMotion` on/off/auto with the macOS Reduce Motion setting) gating the port's `.monaco-enable-motion` effects (table column borders always shown, find widget slide, folding icon fade, indent guide fade, quick input open/close, toast fade and slide, drop overlay fade and move, sash and status bar color transitions, quick diff glyph hover) and the webviews' `reduceMotion`: cargo test -p app reduced_motion_shows_the_column_borders_without_hover, ui-pair problems table (port/results/problems.md) || platform/accessibilitySignal | src/vs/platform | M19 | verified | | accessibility_signals.rs: the 38 signals with their sounds, checkEnabledState, volume, getDelayMs; cargo test -p app accessib (enabled states, volume, sound files, errors announced on a new line and at each position) || platform/action | src/vs/platform | M9 | verified | | types only upstream (ICommandAction, ILocalizedString, toggle info, Categories): command_palette.rs `MenuItem` (id, title, category, precondition, source; `{ value }` titles read as `isLocalizedString`) and menus.rs `Entry::Command` (precondition, `Toggled` with its condition and title, `Alt` with its precondition): cargo test -p app menus enablement_toggled_title_and_alt_precondition; the Categories come resolved in the 1.147.0 dump (reference-commands.json); cargo test -p app command_palette menus || platform/actionWidget | src/vs/platform | M9 | verified | | list model (action_list.rs: filter, sections, focus, height, width): cargo test -p app action_list (19, the 19 upstream cases); the view and ActionWidgetService (workbench/action_widget.rs: the menu over the window, keyboard and mouse focus, the action bar, the click-elsewhere block) for the code action menu and the terminal quick fix menu: cargo test -p app code_actions (10), terminal_quick_fix (2); ui-pair of the code action menu with the TypeScript refactorings (port/results/language-features.md, Code actions: same); scrollbars: cargo test -p app the_action_widget_takes_the_keys_and_hides_on_blur |diff --git a/port/notes.md b/port/notes.mdindex fa98605bdf1..6ea2a8967fb 100644--- a/port/notes.md+++ b/port/notes.md@@ -917,7 +917,7 @@ Scope as in the M19 Work row of port/ledger.md.- Tab drags between windows (`cross_window_drag`): AppKit sends `mouseDragged` and `mouseUp` only to the window of the `mouseDown`, so GPUI's drop targets in other windows never see a drag. While a tab drags past its window's edge, a capture listener in every workbench and editor window hit-tests the app's windows front to back against the pointer's screen point (window origin plus the event position) and dispatches the move or the release to that window as its own `PlatformInput`; GPUI's `active_drag` is app-wide, so the targets there take it (drop overlay, move, the emptied editor window closes). A release over no app window moves the tab into a new editor window at the pointer (editorTabsControl.ts `onGroupDragEnd`, `workbench.editor.dragToOpenWindow`, Option inverts); a tab dropped in another workbench window opens its file there. The port draws its drag image in the window under the pointer; Chromium's is a native drag window. The empty editor part now takes drops too (it drew the letterpress without a drop area).- Banner (`workbench/banner.rs`): one part for every banner item, the restricted mode one moved out of workspace_trust_view.rs. Upstream re-shows a closed item when its owner calls `show` again; here a closed item stays hidden for the session.- Verification pass (port-m11e-verify), fixed against the reference's ui-pair shots and DOM: the banner takes its 26px from the part grid's height (the status bar was pushed out of the window); the editor part state keeps untitled editors with hot exit on (untitledTextEditorHandler.ts), so a restored untitled editor comes back in its tab with its backup's text, and the restored active editor takes the focus (editorGroupView.ts `restoreEditors`); the Explorer's dirty count badge (dirtyFilesIndicator.ts); Switch Window rows with the window's file icon, the close, close-dirty and active-window buttons (closing that window) and the next window active; the custom dialog at the modern UI's 440px content minimum with its Close Dialog button and description-colored detail, buttons in dialog.ts `rearrangeButtons` order; notification rows draw their focus as an overlay and their separator inside the row height (both took layout room, moving the text 1 to 2px); the panel lays its tabs out with the filter box at its 200px resting width, so the focused box grows into the room the tabs leave without dropping tabs, and lays them out again only when the title width, the tabs or the active view change (View as Table keeps Terminal in the overflow, as the reference); the tab badge as paneCompositePart.css draws it (2px margin, 10px text); `--profile`/`--profile-temp` apply to the command line's window only; the window title of an extension development host starts with `[Extension Development Host]`.-- Reduce motion (`workbench/accessibility.rs` `is_motion_reduced`, accessibilityService.ts): `workbench.reduceMotion` on, off, or auto with macOS's Reduce Motion (`NSWorkspace.accessibilityDisplayShouldReduceMotion`, read on each call as Chromium's `prefers-reduced-motion` follows it). It gates the port's counterparts of the `.monaco-enable-motion`/`.monaco-reduce-motion` rules: table column borders always shown (Keyboard Shortcuts and the Problems table), the find widget without its slide, the editor folding icons and the tree indent guides without their fade, the quick input without its open and close animation; webviews get `reduceMotion` in their styles, sent again when the setting changes (not when the macOS setting does). The other rules style parts the port does not animate or has not (toasts' slide, drop overlays' transitions, sash and status bar color transitions, chat). ui-pair now runs the port with `workbench.reduceMotion: on` as the reference.+- Reduce motion (`workbench/accessibility.rs` `is_motion_reduced`, accessibilityService.ts): `workbench.reduceMotion` on, off, or auto with macOS's Reduce Motion (`NSWorkspace.accessibilityDisplayShouldReduceMotion`, read on each call as Chromium's `prefers-reduced-motion` follows it). It gates the port's counterparts of the `.monaco-enable-motion`/`.monaco-reduce-motion` rules: table column borders always shown (Keyboard Shortcuts and the Problems table), the find widget without its slide, the editor folding icons and the tree indent guides without their fade, the quick input without its open and close animation, the notification toasts without their fade and slide (notificationsToasts.css, 300ms), the editor group and view drop overlays without their fade (150ms) and move (70ms, editordroptarget.css), the sashes' `sash.hoverBorder` and the status bar background without their color transitions (sash.css 100ms, statusbarpart.css 150ms), the quick diff glyphs without their hover growth (80ms linear) and `scm.diffDecorationsGutterVisibility: hover` fade (0.5s, dirtydiffDecorator.css); webviews get `reduceMotion` in their styles, sent again when the setting changes (not when the macOS setting does). The transitions share `workbench/transition.rs` `Transition` (a CSS transition: retargeting starts from the current value) and its `cubic_bezier` timing functions. The other rules style parts the port does not have (chat) or the deleted quick diff glyph's hover flattening, which the port does not draw. ui-pair now runs the port with `workbench.reduceMotion: on` as the reference.- Reference differences left: GPUI's ellipsis (`text_overflow`) cuts a clipped label one or two characters earlier than Chromium's `text-overflow: ellipsis` (References rows and titles, port/results/references-view.md): a platform difference of the text layout, not of the views. The panel's Problems tab was 2px wider than the reference's: GPUI rounds a text element's width up (the label 56.91 to 57px, the badge digit 6.15 to 7px), so the tabs now take the fractional widths Chromium lays out (fixed). The managed hovers of the panel and secondary side bar title actions ask for below (updatableHoverWidget.ts); the other action items' hovers still ask for above.## VS Code 1.148.0: what changed and what the uplift needs