From 799861166356e2039952daee09b4c6245d9e1ced Mon Sep 17 00:00:00 2001 From: mocenigo Date: Mon, 23 Nov 2026 19:44:49 +0100 Subject: [PATCH 01/33] pages: no horizontal scroll bar while the pages fit the view's width The view can't scroll sideways then (the offset is clamped to one value), so the bar only showed a thumb filling its track. It comes back when a zoom makes the pages wider. --- crates/pages/src/ui/view.rs | 2 ++ crates/pages/tests/it/views.rs | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/crates/pages/src/ui/view.rs b/crates/pages/src/ui/view.rs index 59bb088272..e8aee62986 100644 --- a/crates/pages/src/ui/view.rs +++ b/crates/pages/src/ui/view.rs @@ -912,6 +912,8 @@ fn run_pass(ui: &mut Ui, cx: &mut BodyCx<'_>, held: &mut Held<'_, PageViewState> let document = drawn_frame.document(&drawn); let (xs, ys) = (offset_range(geo.doc.x0, geo.doc.x1, vw), offset_range(geo.doc.y0, geo.doc.y1, vh)); let bars = CanvasScrollbars::new(words.scroll_bars.clone(), Bind::given(shown), DocRect::from_origin_size(Point::ZERO, document)); + // Pages that fit the view's width can't scroll sideways, so there is no horizontal bar. + let bars = if xs.0 >= xs.1 { bars.vertical_only() } else { bars }; // The tip names the page at the top of the view the thumb moved to: the bars ask for it once they know the move. let format = env.format(); let tip = |moved: &CanvasView| { diff --git a/crates/pages/tests/it/views.rs b/crates/pages/tests/it/views.rs index 8a8f04cd68..ccc69519ef 100644 --- a/crates/pages/tests/it/views.rs +++ b/crates/pages/tests/it/views.rs @@ -49,6 +49,24 @@ fn layout_rig(count: usize, start: PageViewState) -> LayoutRig { (fixture, state, rects) } +/// Whether the view shows a horizontal scroll bar at `zoom` in a window 900 wide. +fn has_horizontal_bar(zoom: f64) -> bool { + let (fixture, _, _) = layout_rig( + 3, + state_with(|s| { + s.fit = Fit::None; + s.zoom = zoom; + }), + ); + fixture.by_role(Role::SCROLL_BAR).iter().any(|bar| bar.rect.width() > bar.rect.height()) +} + +#[trial] +fn the_horizontal_bar_shows_only_when_the_pages_are_wider_than_the_view() { + assert!(!has_horizontal_bar(0.5), "pages that fit the width need no horizontal bar"); + assert!(has_horizontal_bar(3.0), "pages wider than the view scroll sideways"); +} + #[trial] fn a_changed_zoom_keeps_the_page_at_the_top_in_place() { let (mut fixture, state, rects) = layout_rig( From e3385de040ea7cc7418d9eb9e47bee13c13c21a4 Mon Sep 17 00:00:00 2001 From: batistalucasv Date: Mon, 23 Nov 2026 23:37:10 -0300 Subject: [PATCH 02/33] font-manager: use filled warning triangle icon in FontPicker (storytold/wordcraft#7684) --- crates/font-manager/src/picker.rs | 2 +- crates/font-manager/tests/it/picker.rs | 58 +++++++++++++++++++ crates/ui-contract/icons/ATTRIBUTION.md | 2 +- crates/ui-contract/icons/icons.toml | 5 ++ .../icons/phosphor/warning-filled.svg | 1 + 5 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 crates/ui-contract/icons/phosphor/warning-filled.svg diff --git a/crates/font-manager/src/picker.rs b/crates/font-manager/src/picker.rs index 887faf69c5..ee4dc64442 100644 --- a/crates/font-manager/src/picker.rs +++ b/crates/font-manager/src/picker.rs @@ -531,7 +531,7 @@ const TEXT: PartKey = PartKey::new("text"); const CHEVRON: PartKey = PartKey::new("chevron"); /// The mark before the chevron of a shown font that is not installed; its tooltip is the note. const WARNING: PartKey = PartKey::new("missing"); -const WARNING_ICON: &str = "warning"; +const WARNING_ICON: &str = "warning_filled"; /// The popup the chevron and Alt+Down toggle. const POPUP: &str = "list"; /// The Show Similar part at the end of a family row, in the `Chips` layout. diff --git a/crates/font-manager/tests/it/picker.rs b/crates/font-manager/tests/it/picker.rs index 5b1f60c26b..583d16830c 100644 --- a/crates/font-manager/tests/it/picker.rs +++ b/crates/font-manager/tests/it/picker.rs @@ -798,6 +798,64 @@ fn the_missing_font_warning_icon_paints_in_status_warn_fg_and_dims_when_disabled ); } +/// Texture ids of textured meshes whose centre falls inside `rect`. +fn mesh_textures(shapes: &[egui::Shape], rect: egui::Rect, out: &mut Vec) { + for shape in shapes { + match shape { + egui::Shape::Vec(inner) => mesh_textures(inner, rect, out), + egui::Shape::Mesh(mesh) if rect.contains(mesh.calc_bounds().center()) => { + out.push(mesh.texture_id); + } + _ => {} + } + } +} + +#[trial] +fn the_missing_font_warning_icon_is_a_filled_triangle() { + use std::cell::Cell; + + let catalog = catalog_of(&[INTER_REGULAR]); + let seen = Rc::new(Cell::new(None)); + let held = Rc::clone(&seen); + let mut family = "Gotham".to_owned(); + let mut fx = Fixture::new(move |ui| { + let out = FontPicker::new("Font family", Bind::bound(&mut family), &catalog).kind(FontPickerKind::Plain).shown_as("Inter").show(ui); + held.set(Some(out.edit.response.id)); + }); + fx.pixels_per_point(2.0); + fx.record_paint(); + fx.in_room(Room::Window); + fx.settle(); + let picker = seen.get().expect("the picker"); + let mark = fx.part_rect(picker, PartKey::new("missing")).expect("the field carries a mark while the family is not installed"); + let mut paint = fx.take_paint().expect("recorded paint output"); + let mut textures = Vec::new(); + for clipped in &paint.shapes { + mesh_textures(std::slice::from_ref(&clipped.shape), mark, &mut textures); + } + let texture = *textures.first().expect("the missing-font warning icon paints a texture"); + let image = paint + .textures_delta + .set + .get(&texture) + .and_then(|deltas| deltas.last()) + .map(|delta| match &delta.image { + egui::ImageData::Color(color) => color, + }) + .expect("the warning icon texture was uploaded"); + let [w, h] = image.size; + let alpha = |fx: f32, fy: f32| { + let x = ((w as f32 * fx) as usize).min(w - 1); + let y = ((h as f32 * fy) as usize).min(h - 1); + image.pixels[y * w + x].a() + }; + let (left, right, center) = (alpha(0.34, 0.69), alpha(0.66, 0.69), alpha(0.50, 0.48)); + paint.textures_delta.clear(); + assert!(left > 128 && right > 128, "the triangle interior is filled, not an outline (left={left}, right={right}, size={w}x{h})"); + assert!(center < 128, "the exclamation stem stays knocked out inside the filled triangle (center={center})"); +} + /// The library picker's family and settings, as the last pass left them. struct Library { family: String, diff --git a/crates/ui-contract/icons/ATTRIBUTION.md b/crates/ui-contract/icons/ATTRIBUTION.md index 4579d05c91..7baac2bd35 100644 --- a/crates/ui-contract/icons/ATTRIBUTION.md +++ b/crates/ui-contract/icons/ATTRIBUTION.md @@ -11,7 +11,7 @@ Each folder holds only the files `icons.toml` lists, unchanged from the pinned s Carbon's licence file is the repository's root `LICENSE` (the icons package has none of its own). -Every set folder's files come from the npm package of the version in the table (`@phosphor-icons/core` 2.0.8, `lucide-static` 1.63.0, `@carbon/icons` 11.91.0, `@tabler/icons` 3.50.0), the same releases as the tags above. Phosphor files are `regular` weight, except `star-filled.svg` and `circle-filled.svg`, which are Phosphor's `fill` weight (`star-fill.svg`, `circle-fill.svg`). `panel-left.svg` is Phosphor's `sidebar-simple` unchanged, and `panel-right.svg` is the same glyph mirrored. +Every set folder's files come from the npm package of the version in the table (`@phosphor-icons/core` 2.0.8, `lucide-static` 1.63.0, `@carbon/icons` 11.91.0, `@tabler/icons` 3.50.0), the same releases as the tags above. Phosphor files are `regular` weight, except `star-filled.svg`, `circle-filled.svg` and `warning-filled.svg`, which are Phosphor's `fill` weight (`star-fill.svg`, `circle-fill.svg`, `warning-fill.svg`). `panel-left.svg` is Phosphor's `sidebar-simple` unchanged, and `panel-right.svg` is the same glyph mirrored. `phosphor/` also holds drawings made for the suite, for glyphs the pinned Phosphor release lacks. They follow Phosphor's regular style (256 view box, 16-unit round-capped strokes, some converted to filled outlines), take their shapes from PhotoCraft's glyphs, and carry the suite's own licence: diff --git a/crates/ui-contract/icons/icons.toml b/crates/ui-contract/icons/icons.toml index 2a324cd10a..7fdd9233c7 100644 --- a/crates/ui-contract/icons/icons.toml +++ b/crates/ui-contract/icons/icons.toml @@ -454,6 +454,11 @@ phosphor = "warning" carbon = "warning--alt" tabler = "alert-triangle" +[[icon]] +name = "warning_filled" +directional = false +phosphor = "warning-filled" + [[icon]] name = "web_colors" directional = false diff --git a/crates/ui-contract/icons/phosphor/warning-filled.svg b/crates/ui-contract/icons/phosphor/warning-filled.svg new file mode 100644 index 0000000000..f8ada0ad27 --- /dev/null +++ b/crates/ui-contract/icons/phosphor/warning-filled.svg @@ -0,0 +1 @@ + \ No newline at end of file From e7e8785fff8ba5aebd8e349bff6806639fde64a2 Mon Sep 17 00:00:00 2001 From: mocenigo Date: Tue, 24 Nov 2026 12:33:11 +0100 Subject: [PATCH 03/33] ui-canvas: a held horizontal thumb keeps its bar until the press ends With vertical_only set while the thumb drags (the page view's pages came to fit the width mid-drag), the bar went and its release never reached it: the drag's edit stayed open and the held extent stayed in the press slot. --- crates/pages/tests/it/views.rs | 25 +++++++++++++++++++ crates/ui-canvas/src/canvas/scrollbars/mod.rs | 4 ++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/crates/pages/tests/it/views.rs b/crates/pages/tests/it/views.rs index 3028d4fd7c..0042c27937 100644 --- a/crates/pages/tests/it/views.rs +++ b/crates/pages/tests/it/views.rs @@ -433,6 +433,31 @@ fn assert_centre_kept(out: &Out, before: (usize, kurbo::Point), what: &str) { /// A written zoom keeps the point at the centre; a new room (a panel opened beside the view) refits and keeps the /// current page's top where it was, as production did. +/// The horizontal scroll bar the fixture shows, if any. +fn horizontal_bar(fixture: &Fixture) -> Option { + fixture.by_role(Role::SCROLL_BAR).iter().map(|bar| bar.rect).find(|rect| rect.width() > rect.height()) +} + +#[trial] +fn a_horizontal_thumb_held_while_the_pages_come_to_fit_keeps_its_bar_until_the_release() { + let (mut fixture, state, _) = layout_rig( + 3, + state_with(|s| { + s.fit = Fit::None; + s.zoom = 3.0; + }), + ); + let bar = horizontal_bar(&fixture).expect("pages wider than the view have a horizontal bar"); + // The view starts at the left edge, so the thumb is at the start of the track. + let from = pos2(bar.left() + 4.0, bar.center().y); + fixture.drag_hold_at(from, vec2(20.0, 0.0)); + state.borrow_mut().zoom = 0.5; + fixture.idle(3); + assert!(horizontal_bar(&fixture).is_some(), "the held thumb keeps its bar, so its release reaches it"); + fixture.release_at(from + vec2(20.0, 0.0)).idle(2); + assert!(horizontal_bar(&fixture).is_none(), "after the release, pages that fit have no horizontal bar"); +} + #[trial] fn a_changed_zoom_keeps_the_point_at_the_centre_and_a_new_room_the_current_pages_top() { // The app's zoom. diff --git a/crates/ui-canvas/src/canvas/scrollbars/mod.rs b/crates/ui-canvas/src/canvas/scrollbars/mod.rs index f0d190d33b..d8a0f97d21 100644 --- a/crates/ui-canvas/src/canvas/scrollbars/mod.rs +++ b/crates/ui-canvas/src/canvas/scrollbars/mod.rs @@ -477,7 +477,9 @@ impl<'a> CanvasScrollbars<'a> { } fn bars(&self, view: &CanvasView, rect: Rect, style: &ScrollbarsStyle, held: Option<&HeldThumb>) -> Bars { - Bars::of(view, self.document, self.overscroll, !self.vertical_only, rect, style, held) + // A horizontal thumb held keeps its bar until the press ends, so its release closes the drag. + let horizontal = !self.vertical_only || held.is_some_and(|held| held.on(Axis::X)); + Bars::of(view, self.document, self.overscroll, horizontal, rect, style, held) } } From 1d8dc6c2b3f0689b168a294b70a413e52601f2cf Mon Sep 17 00:00:00 2001 From: batistalucasv Date: Tue, 24 Nov 2026 11:42:10 -0300 Subject: [PATCH 04/33] ci: retest flaky automation test From ed1da0da5e7aa77ef299c98ef4d5a97c6bec17ef Mon Sep 17 00:00:00 2001 From: mocenigo Date: Tue, 24 Nov 2026 23:44:09 +0100 Subject: [PATCH 05/33] pages, ui-canvas: drop a held thumb's extent once its press ended unseen A full-screen view drops the bars, so a thumb released there never reached them and the extent stayed in the press slot; with the held-thumb guard, it would keep the horizontal bar up over pages that fit. The bars drop it as soon as they see the thumb idle again. Also moves the new test helper off the doc comment of the zoom test it had split, and has_horizontal_bar uses it. --- crates/pages/tests/it/views.rs | 85 +++++++++++++------ crates/ui-canvas/src/canvas/scrollbars/mod.rs | 10 +++ 2 files changed, 69 insertions(+), 26 deletions(-) diff --git a/crates/pages/tests/it/views.rs b/crates/pages/tests/it/views.rs index 0042c27937..f0ec0c2e8e 100644 --- a/crates/pages/tests/it/views.rs +++ b/crates/pages/tests/it/views.rs @@ -116,7 +116,7 @@ fn has_horizontal_bar(zoom: f64) -> bool { s.zoom = zoom; }), ); - fixture.by_role(Role::SCROLL_BAR).iter().any(|bar| bar.rect.width() > bar.rect.height()) + horizontal_bar(&fixture).is_some() } #[trial] @@ -125,6 +125,64 @@ fn the_horizontal_bar_shows_only_when_the_pages_are_wider_than_the_view() { assert!(has_horizontal_bar(3.0), "pages wider than the view scroll sideways"); } +/// The horizontal scroll bar the fixture shows, if any. +fn horizontal_bar(fixture: &Fixture) -> Option { + fixture.by_role(Role::SCROLL_BAR).iter().map(|bar| bar.rect).find(|rect| rect.width() > rect.height()) +} + +#[trial] +fn a_horizontal_thumb_held_while_the_pages_come_to_fit_keeps_its_bar_until_the_release() { + let (mut fixture, state, _) = layout_rig( + 3, + state_with(|s| { + s.fit = Fit::None; + s.zoom = 3.0; + }), + ); + let bar = horizontal_bar(&fixture).expect("pages wider than the view have a horizontal bar"); + // The view starts at the left edge, so the thumb is at the start of the track. + let from = pos2(bar.left() + 4.0, bar.center().y); + fixture.drag_hold_at(from, vec2(20.0, 0.0)); + state.borrow_mut().zoom = 0.5; + fixture.idle(3); + assert!(horizontal_bar(&fixture).is_some(), "the held thumb keeps its bar, so its release reaches it"); + fixture.release_at(from + vec2(20.0, 0.0)).idle(2); + assert!(horizontal_bar(&fixture).is_none(), "after the release, pages that fit have no horizontal bar"); +} + +#[trial] +fn a_horizontal_thumb_released_while_the_bars_are_not_shown_leaves_no_bar_behind() { + let state = Rc::new(RefCell::new(state_with(|s| { + s.fit = Fit::None; + s.zoom = 3.0; + }))); + let full_screen = Rc::new(Cell::new(false)); + let (kept, edge_to_edge) = (Rc::clone(&state), Rc::clone(&full_screen)); + let pages = DemoPages::new(3); + let mut fixture = Fixture::new(move |ui| { + let mut now = kept.borrow().clone(); + PageView::new("Pages", &pages, &mut now, PAPER).options(LayoutOptions::ACROBAT).fill_screen(edge_to_edge.get()).show(ui, |_, _| ()); + *kept.borrow_mut() = now; + }); + fixture.room(vec2(900.0, 600.0)); + fixture.settle(); + let bar = horizontal_bar(&fixture).expect("pages wider than the view have a horizontal bar"); + let from = pos2(bar.left() + 4.0, bar.center().y); + fixture.drag_hold_at(from, vec2(20.0, 0.0)); + // Full screen mid-drag: the bars go, and the release can't reach them. + full_screen.set(true); + fixture.idle(2); + fixture.release_at(from + vec2(20.0, 0.0)).idle(2); + full_screen.set(false); + { + let mut state = state.borrow_mut(); + state.fit = Fit::None; + state.zoom = 0.5; + } + fixture.idle(3); + assert!(horizontal_bar(&fixture).is_none(), "a press that ended unseen leaves no horizontal bar over pages that fit"); +} + #[trial] fn go_to_a_narrow_page_brings_it_back_into_horizontal_view() { let Rig { mut fixture, state, out, .. } = rig_over( @@ -433,31 +491,6 @@ fn assert_centre_kept(out: &Out, before: (usize, kurbo::Point), what: &str) { /// A written zoom keeps the point at the centre; a new room (a panel opened beside the view) refits and keeps the /// current page's top where it was, as production did. -/// The horizontal scroll bar the fixture shows, if any. -fn horizontal_bar(fixture: &Fixture) -> Option { - fixture.by_role(Role::SCROLL_BAR).iter().map(|bar| bar.rect).find(|rect| rect.width() > rect.height()) -} - -#[trial] -fn a_horizontal_thumb_held_while_the_pages_come_to_fit_keeps_its_bar_until_the_release() { - let (mut fixture, state, _) = layout_rig( - 3, - state_with(|s| { - s.fit = Fit::None; - s.zoom = 3.0; - }), - ); - let bar = horizontal_bar(&fixture).expect("pages wider than the view have a horizontal bar"); - // The view starts at the left edge, so the thumb is at the start of the track. - let from = pos2(bar.left() + 4.0, bar.center().y); - fixture.drag_hold_at(from, vec2(20.0, 0.0)); - state.borrow_mut().zoom = 0.5; - fixture.idle(3); - assert!(horizontal_bar(&fixture).is_some(), "the held thumb keeps its bar, so its release reaches it"); - fixture.release_at(from + vec2(20.0, 0.0)).idle(2); - assert!(horizontal_bar(&fixture).is_none(), "after the release, pages that fit have no horizontal bar"); -} - #[trial] fn a_changed_zoom_keeps_the_point_at_the_centre_and_a_new_room_the_current_pages_top() { // The app's zoom. diff --git a/crates/ui-canvas/src/canvas/scrollbars/mod.rs b/crates/ui-canvas/src/canvas/scrollbars/mod.rs index d8a0f97d21..f4e30e5e3f 100644 --- a/crates/ui-canvas/src/canvas/scrollbars/mod.rs +++ b/crates/ui-canvas/src/canvas/scrollbars/mod.rs @@ -549,6 +549,16 @@ impl Component for CanvasScrollbars<'_> { } let Some(view) = cx.value().copied() else { return }; let mut held = cx.press_slot::().clone(); + // A press that ended while the bars weren't shown (a full-screen view drops them) never reached them: its thumb + // is idle again, and the extent kept for it is stale. + let stale = held.as_ref().is_some_and(|held| { + let thumb = thumb_of(if held.horizontal { HORIZONTAL } else { VERTICAL }); + matches!(cx.part(thumb).press.phase, PressPhase::Idle | PressPhase::Hover) + }); + if stale { + *cx.press_slot::() = None; + held = None; + } let bars = self.bars(&view, cx.rect, cx.style, held.as_ref()); let mut ended = false; let rtl = cx.flow.is_rtl(); From b2910054ca47c6f2ba928cd745a9011865dbf8d5 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 24 Nov 2026 19:11:34 -0800 Subject: [PATCH 06/33] menu: Keyboard Shortcuts can list only the app's own Show entries Show always listed All Commands, each menu, Tools, each panel and Other before the app's own `Options::areas`. An app that gives Tools and Menu Commands as its only entries got them at the end of a long strip, with a second Tools entry, and the dialog opened on All Commands. - `Options::own_areas`: Show lists only the app's own entries (and Fixed Keys), and the dialog opens on the first of them, or on the one that lists the command selected before it opened. - Go to Conflict and Accept and Go to Conflict show the holder under the first entry that lists it when Show has no All Commands. - The option is off by default, and a dialog without it is unchanged. --- crates/menu/src/shortcuts/keyboard.rs | 2 +- crates/menu/src/shortcuts/mod.rs | 5 ++ crates/menu/src/shortcuts/rows.rs | 30 ++++++++--- crates/menu/src/shortcuts/state.rs | 18 +++++-- crates/menu/src/shortcuts/view/bars.rs | 2 +- crates/menu/src/shortcuts/view/detail.rs | 2 +- crates/menu/tests/it/shortcuts/rows.rs | 69 +++++++++++++++++++++++- 7 files changed, 113 insertions(+), 15 deletions(-) diff --git a/crates/menu/src/shortcuts/keyboard.rs b/crates/menu/src/shortcuts/keyboard.rs index 9c2f74804d..9166e2533d 100644 --- a/crates/menu/src/shortcuts/keyboard.rs +++ b/crates/menu/src/shortcuts/keyboard.rs @@ -661,7 +661,7 @@ pub(crate) fn show(ui: &mut Ui, _cx: &mut BodyCx<'_>, env: &mut Env<'_>, state: state.keyboard.key = Some(key); } if let Some(c) = go { - state.go_to(&c); + state.go_to(env, &c); } if assign && let (Some(command), Some(key)) = (state.selected.clone(), state.keyboard.key) { let trigger = Trigger::single(Chord { mods, key }); diff --git a/crates/menu/src/shortcuts/mod.rs b/crates/menu/src/shortcuts/mod.rs index eed667ba9a..ec38488298 100644 --- a/crates/menu/src/shortcuts/mod.rs +++ b/crates/menu/src/shortcuts/mod.rs @@ -308,6 +308,10 @@ pub struct Options { pub area_tabs: bool, /// The app's own Show entries. pub areas: Vec, + /// false: Show lists All Commands, each menu, Tools, each panel and Other before the app's own + /// [`areas`](Self::areas); true: it lists only the app's own entries (and Fixed Keys), and the + /// dialog opens on the first of them. + pub own_areas: bool, /// `None`: every catalog entry is listed. Otherwise the table, its Show entries and search /// list only the entries it returns true for; the others keep their bindings and still count /// in conflicts. @@ -343,6 +347,7 @@ impl Default for Options { sort_by_label: false, area_tabs: false, areas: Vec::new(), + own_areas: false, visible: None, keyboard: false, fixed: Vec::new(), diff --git a/crates/menu/src/shortcuts/rows.rs b/crates/menu/src/shortcuts/rows.rs index 309ccf16a5..485d8fc7fc 100644 --- a/crates/menu/src/shortcuts/rows.rs +++ b/crates/menu/src/shortcuts/rows.rs @@ -210,8 +210,30 @@ fn listed<'k>(keymap: &'k Keymap, options: &Options) -> impl Iterator Vec { + let mut out = if options.own_areas { Vec::new() } else { built_in_areas(keymap, options, text) }; + let catalog = listed(keymap, options); + for a in options.areas.iter().filter(|a| catalog.clone().any(a.rows)) { + out.push(AreaEntry { id: AreaId::App(a.id), label: text.segment(a.label).into_owned() }); + } + if !options.fixed.is_empty() { + out.push(AreaEntry { id: AreaId::Fixed, label: text.words().fixed_keys.as_str().to_owned() }); + } + out +} + +/// The area that shows `b`'s row: All Commands when Show lists it, else the first listed area that holds the row. +pub(crate) fn area_of(areas: &[AreaEntry], b: &CommandDef, options: &Options) -> AreaId { + if areas.iter().any(|area| area.id == AreaId::All) { + return AreaId::All; + } + areas.iter().find(|area| in_area(&area.id, b, options)).map_or(AreaId::All, |area| area.id.clone()) +} + +/// All Commands, each menu, Tools, each panel and Other, leaving out areas with no rows. +fn built_in_areas(keymap: &Keymap, options: &Options, text: &Say) -> Vec { let catalog = listed(keymap, options); let mut out = vec![AreaEntry { id: AreaId::All, label: text.words().all_commands.as_str().to_owned() }]; let mut menus: Vec<&str> = Vec::new(); @@ -239,12 +261,6 @@ pub(crate) fn areas(keymap: &Keymap, options: &Options, text: &Say) -> Vec, state: &mut DialogState) { } let out = notice.show(ui); match (out.action, &goto) { - (Some(0), Some(command)) => state.go_to(command), + (Some(0), Some(command)) => state.go_to(env, command), (Some(at), Some(_)) if undo && at == 1 => state.undo(env), (Some(0), None) if undo => state.undo(env), _ => {} diff --git a/crates/menu/src/shortcuts/view/detail.rs b/crates/menu/src/shortcuts/view/detail.rs index d38514868d..d1394ee815 100644 --- a/crates/menu/src/shortcuts/view/detail.rs +++ b/crates/menu/src/shortcuts/view/detail.rs @@ -257,6 +257,6 @@ fn holders(ui: &mut Ui, env: &Env<'_>, state: &mut DialogState) { } } if let Some(command) = go { - state.go_to(&command); + state.go_to(env, &command); } } diff --git a/crates/menu/tests/it/shortcuts/rows.rs b/crates/menu/tests/it/shortcuts/rows.rs index df232b1c33..5ff4299e35 100644 --- a/crates/menu/tests/it/shortcuts/rows.rs +++ b/crates/menu/tests/it/shortcuts/rows.rs @@ -4,9 +4,10 @@ use std::sync::Arc; use craft_host::{AppInfo, Host}; use craft_keymap::{Binding, CommandDef, CommandRef, Keymap, Platform, Policy, Scope, Scopes}; -use craft_menu::shortcuts::{HoldSetting, Outcome}; +use craft_menu::shortcuts::{Area, HoldSetting, Outcome}; use craft_ui::contract::Role; use craft_ui::testing::trial; +use egui::{Key, Modifiers}; use super::fixture::{self, Rig}; @@ -110,3 +111,69 @@ fn the_summary_without_a_ui_is_the_one_summarize_writes() { let (title, _) = text.split_once('\n').expect("a title line"); assert_eq!(craft_menu::shortcuts::summary::text_for(&km, &host, title), text); } + +fn is_tool(def: &CommandDef) -> bool { + matches!(def.kind, craft_keymap::CommandKind::Tool { .. }) +} + +fn area(rig: &Rig) -> String { + let shared = rig.shared.borrow(); + shared.state.snapshot(&shared.km).expect("the dialog has shown").area +} + +/// With `own_areas`, Show lists only the app's own entries, the dialog opens on the first of them, and its table +/// lists that entry's rows. Without it, the built-in entries come first and the dialog opens on All Commands. +#[trial] +fn own_areas_show_only_the_apps_entries_and_open_on_the_first() { + let tune = |own: bool| { + move |options: &mut craft_menu::shortcuts::Options| { + options.area_tabs = true; + options.areas = vec![Area::new("tools", "Tools", is_tool), Area::new("menu", "Menu Commands", |def| !is_tool(def))]; + options.own_areas = own; + } + }; + let rig = Rig::tuned(Platform::Mac, tune(true)); + assert_eq!(rig.names_with(Role::TAB, ""), ["Tools", "Menu Commands"], "only the app's entries are tabs"); + assert_eq!(area(&rig), "tools", "the dialog opens on the first of them"); + let rows = rig.names_with(Role::ROW, ""); + assert!(rows.iter().all(|row| row.contains("Marquee")) && !rows.is_empty(), "the table lists the Tools rows only: {rows:?}"); + + let rig = Rig::tuned(Platform::Mac, tune(false)); + let tabs = rig.names_with(Role::TAB, ""); + assert_eq!(tabs.first().map(String::as_str), Some("All Commands"), "the built-in entries come first: {tabs:?}"); + assert!(tabs.iter().any(|t| t == "Menu Commands"), "the app's entries follow them: {tabs:?}"); + assert_eq!(area(&rig), "all"); +} + +/// A dialog opened with a command selected, with Show listing only the app's entries, opens on the entry that lists it. +#[trial] +fn own_areas_open_on_the_selected_commands_entry() { + let mut rig = Rig::tuned(Platform::Mac, |options| { + options.areas = vec![Area::new("tools", "Tools", is_tool), Area::new("menu", "Menu Commands", |def| !is_tool(def))]; + options.own_areas = true; + }); + { + let mut shared = rig.shared.borrow_mut(); + let mut state = craft_menu::shortcuts::DialogState::new(); + state.select(&CommandRef::from("file.export")); + shared.state = state; + } + rig.pass(); + assert_eq!(area(&rig), "menu", "Export… is listed under Menu Commands"); + assert!(rig.names_with(Role::ROW, "").iter().any(|row| row.starts_with("Export…")), "its row shows"); +} + +/// Accept and Go to Conflict, with Show listing only the app's entries, shows the holder under the entry that lists +/// it. +#[trial] +fn going_to_a_conflict_picks_an_area_that_lists_the_holder() { + let mut rig = Rig::tuned(Platform::Mac, |options| { + options.areas = vec![Area::new("tools", "Tools", is_tool), Area::new("menu", "Menu Commands", |def| !is_tool(def))]; + options.own_areas = true; + }); + rig.click("Marquee Tool: M"); + rig.press(Modifiers::COMMAND, Key::E); + rig.click("Accept and Go to Conflict"); + assert_eq!(area(&rig), "menu", "Export… is listed under Menu Commands"); + assert!(rig.has("Export…"), "the holder's row shows"); +} From dee3e7af57806d147d68844c65213a7837effc54 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 24 Nov 2026 19:20:04 -0800 Subject: [PATCH 07/33] menu: Keyboard Shortcuts can open at a size the app gives An editable Keyboard Shortcuts dialog sizes from its content, so with a large catalog the table takes the whole window and the dialog covers it. The app had no way to choose another size. - `Options::size`: the dialog opens at this size, in points, until the user resizes it. A size that is not finite is ignored. - Without it, an editable dialog opens as before and a read-only one keeps its moderate fixed size. --- crates/menu/src/shortcuts/mod.rs | 12 +++++++++++- crates/menu/tests/it/shortcuts/mod.rs | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/crates/menu/src/shortcuts/mod.rs b/crates/menu/src/shortcuts/mod.rs index eed667ba9a..b7fc0b93e2 100644 --- a/crates/menu/src/shortcuts/mod.rs +++ b/crates/menu/src/shortcuts/mod.rs @@ -287,6 +287,10 @@ pub struct Options { /// The window title [`ShortcutsDialog::show`] draws and the summary's heading, already translated. /// `None`: the dialog's own "Keyboard Shortcuts". pub title: Option, + /// `None`: an editable dialog opens at the room the window gives it, and a read-only one at a moderate fixed size. + /// Otherwise the dialog opens at this size, in points, until the user resizes it; a size that is not finite is + /// ignored. + pub size: Option, /// true; false shows the table read-only with Close and Summarize. pub editable: bool, /// The name, already translated, that edits of a built-in set are saved under. `None`: the dialog's own @@ -333,6 +337,7 @@ impl Default for Options { fn default() -> Options { Options { title: None, + size: None, editable: true, custom_set_name: None, conflicts: ConflictMode::Ask, @@ -618,10 +623,15 @@ fn frame(ui: &mut Ui, env: &mut Env<'_>, state: &mut DialogState) -> ShortcutsOu // A read-only reference opens at a fixed, moderate height (production's key list scrolls inside it), not at the // window's; the user's own resize is still remembered. let reference = !env.options.editable; + let asked = env.options.size.filter(|size| size.is_finite()); + let size = asked.or(reference.then_some(egui::vec2(READ_ONLY_WIDTH, READ_ONLY_HEIGHT))); let session = RefCell::new(Session { env, state }); let shown = Dialog::new(title) .resizable(true) - .overlay(|overlay| if reference { overlay.size(egui::vec2(READ_ONLY_WIDTH, READ_ONLY_HEIGHT)) } else { overlay }) + .overlay(|overlay| match size { + Some(size) => overlay.size(size), + None => overlay, + }) .remember(SaveKey::new("craft_menu.shortcuts")) .outer_gesture(true) .collection_body() diff --git a/crates/menu/tests/it/shortcuts/mod.rs b/crates/menu/tests/it/shortcuts/mod.rs index 2fc7cba0e3..fc1ff547c8 100644 --- a/crates/menu/tests/it/shortcuts/mod.rs +++ b/crates/menu/tests/it/shortcuts/mod.rs @@ -22,3 +22,22 @@ fn a_read_only_dialog_opens_at_a_moderate_height() { let close = rig.fixture.by_label("Close").expect("the close button"); assert!(close.rect.bottom() < 560.0, "the dialog's footer sits within a moderate height, not the 700-point window: {:?}", close.rect); } + +/// The editable dialog's bounds, opened with `size` in the rig's 1000 by 700 point window. +fn dialog_bounds(size: Option) -> egui::Rect { + let rig = Rig::tuned(Platform::Windows, |options| options.size = size); + rig.fixture.by_role(craft_ui::contract::Role::DIALOG).first().expect("the dialog").rect +} + +/// An editable dialog opens at the size the app gives, larger or smaller than its own, and ignores a size that is not +/// finite. +#[trial] +fn an_editable_dialog_opens_at_the_size_the_app_gives() { + let own = dialog_bounds(None).size(); + for asked in [own + egui::vec2(200.0, 120.0), egui::vec2(own.x + 80.0, own.y - 60.0)] { + let opened = dialog_bounds(Some(asked)).size(); + assert!((opened - asked).abs().max_elem() < 1.0, "asked {asked:?}, opened {opened:?}, own {own:?}"); + } + let endless = dialog_bounds(Some(egui::vec2(f32::INFINITY, f32::NAN))).size(); + assert_eq!(endless, own, "a size that is not finite opens the dialog as without one"); +} From e49a32947a15e8b5cecbc2d2cfa238b9259b4a83 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 25 Nov 2026 10:00:18 +0700 Subject: [PATCH 08/33] tabs, dock: PanelTabLook::Block shows a panel strip's shown tab as a square surface.control block as tall as the strip, a hovered tab in state.hover; a dock group's strip lies on surface.canvas under it and its panel menu button stands in the strip's middle, as beside pill tabs; Plain stays the default --- crates/ui-panels/src/docking/config.rs | 5 ++-- crates/ui-panels/src/docking/group.rs | 27 ++++++++++++++++----- crates/ui-panels/src/docking/stories.rs | 16 ++++++++++++ crates/ui-panels/tests/it/dock_group.rs | 14 ++++++----- crates/ui-widgets/src/tabs/rules.rs | 4 +++ crates/ui-widgets/src/tabs/strip/stories.rs | 7 ++++++ crates/ui-widgets/src/tabs/tab.rs | 3 +++ 7 files changed, 62 insertions(+), 14 deletions(-) diff --git a/crates/ui-panels/src/docking/config.rs b/crates/ui-panels/src/docking/config.rs index be2d0180e6..4f0e2232e9 100644 --- a/crates/ui-panels/src/docking/config.rs +++ b/crates/ui-panels/src/docking/config.rs @@ -99,8 +99,9 @@ pub struct DockConfig { pub titled_headers: bool, /// The wheel over a tab strip shows the next or previous panel, one per wheel notch. pub wheel_selects_tabs: bool, - /// The look of the groups' panel tabs: the shown tab on the panel surface ([`PanelTabLook::Plain`]), or on a - /// filled rounded pill ([`PanelTabLook::Pill`]). + /// The look of the groups' panel tabs: the shown tab on the panel surface ([`PanelTabLook::Plain`]), on a + /// filled rounded pill ([`PanelTabLook::Pill`]), or a square filled block on a canvas strip + /// ([`PanelTabLook::Block`]). pub tab_look: PanelTabLook, /// A floating window opens in an OS window of its own where the window host opens OS windows and reports where /// they are on the desktop (not on Wayland) and its panels allow it (`PanelSpec::allow_native`). Elsewhere, and diff --git a/crates/ui-panels/src/docking/group.rs b/crates/ui-panels/src/docking/group.rs index 395ab4a49f..bc4a31f9a7 100644 --- a/crates/ui-panels/src/docking/group.rs +++ b/crates/ui-panels/src/docking/group.rs @@ -372,8 +372,7 @@ pub struct DockGroup<'a, P: Clone + Hash + Send + Sync + 'static> { /// The wheel over the tabs shows the next or previous panel, one per wheel notch. #[prop(flag)] wheel_selects_tabs: bool, - /// The look of the tabs ([`DockConfig::tab_look`](super::DockConfig::tab_look)). - #[prop] + /// The look of the tabs: [`tab_look`](DockGroup::tab_look). tab_look: PanelTabLook, /// The header shows the shown panel's title (with its count) and a close button in place of the tab strip, as a /// single titled panel does: the panels are shown from a rail, not by tabs. @@ -422,8 +421,10 @@ impl<'a, P: Clone + Hash + Send + Sync + PartialEq + Debug + 'static> DockGroup< /// The group named by `anchor` (one of its panels) with its `panels`, `active` showing. The group is named by the /// active panel's title. pub fn new(anchor: P, panels: Titles, active: PanelKey) -> Self { - let props = - ContainerProps::new().sizing(Sizing::Fill).header(HeaderRegion::new().fill(SurfaceKind::Background)).command_scope(DockCommands::SCOPE); + let props = ContainerProps::new() + .sizing(Sizing::Fill) + .header(HeaderRegion::new().fill(strip_surface(PanelTabLook::Plain))) + .command_scope(DockCommands::SCOPE); let title = panels.as_slice().iter().find(|panel| panel.key == active).map(|panel| panel.title.clone()).unwrap_or_default(); DockGroup { common: Common::new(), @@ -472,6 +473,15 @@ impl<'a, P: Clone + Hash + Send + Sync + PartialEq + Debug + 'static> DockGroup< DockGroup { take_focus: true, ..self } } + /// The look of the tabs ([`DockConfig::tab_look`](super::DockConfig::tab_look)). [`PanelTabLook::Block`] tabs + /// lie on a strip of `surface.canvas`, the others on the window's background. + #[must_use] + pub fn tab_look(mut self, look: PanelTabLook) -> Self { + self.props = self.props.header(HeaderRegion::new().fill(strip_surface(look))); + self.tab_look = look; + self + } + /// Whether the panel menu button shows: it is asked for and the group has a menu. fn shows_menu_button(&self) -> bool { self.panel_menu_shown && self.menu.is_some() @@ -505,7 +515,7 @@ impl Component for /// The band the group is dragged by and the panel menu button, at the end of the header: the band first. The /// button sits at the strip's top, level with the tab labels' caps, as the "…" of the old tab strips did; beside - /// [`PanelTabLook::Pill`] tabs, in the strip's middle with their pills. + /// [`PanelTabLook::Pill`] and [`PanelTabLook::Block`] tabs, in the strip's middle. fn parts(&mut self, _: Rect, cx: &mut PartsCx<'_, Self>) { let Some(slot) = cx.header_slot(HeaderEdge::End) else { return }; let words = cx.words::(); @@ -518,7 +528,7 @@ impl Component for let side = (slot.width() - grip_width(cx.tokens) - cx.tokens.space.gap.item).max(0.0); let end = rest.take_end(side).0; let height = side.min(slot.height()); - let top = if self.tab_look == PanelTabLook::Pill { slot.center().y - height / 2.0 } else { slot.top() }; + let top = if self.tab_look == PanelTabLook::Plain { slot.top() } else { slot.center().y - height / 2.0 }; let button = Rect::from_min_size(egui::Pos2::new(end.left(), top), Vec2::new(end.width(), height)); let _ = cx .header_part(HeaderEdge::End, MENU, button) @@ -825,6 +835,11 @@ enum TabEvent { DragStarted, } +/// The surface a dock's strips lie on with tabs in `look`: its groups' tab strips and its columns' bars. +pub(crate) fn strip_surface(look: PanelTabLook) -> SurfaceKind { + if look == PanelTabLook::Block { SurfaceKind::Canvas } else { SurfaceKind::Background } +} + /// The props of a group's tab row: the tabs and how they show, the group's size where a tab's drag starts, and the /// outbox for what the user did. #[derive(MemoProps)] diff --git a/crates/ui-panels/src/docking/stories.rs b/crates/ui-panels/src/docking/stories.rs index e07ee8e397..1515988b56 100644 --- a/crates/ui-panels/src/docking/stories.rs +++ b/crates/ui-panels/src/docking/stories.rs @@ -170,6 +170,22 @@ fn pill_tabs_and_the_panel_menu(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { .into() } +/// VectorCraft 0.24's group header (`DockConfig::tab_look(PanelTabLook::Block)`): the shown tab a square +/// `surface.control` block as tall as the strip, the strip on `surface.canvas`, and the panel menu button in the +/// strip's middle at its end. +#[story(DockGroup<'static, usize>, covers = [Default])] +fn block_tabs_and_the_panel_menu(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { + let panels = titles(&[LAYERS, CHANNELS]); + let rows = [DockCommands::FloatPanel, DockCommands::FloatGroup].map(|command| PanelRow::Command(CommandRef::from(command))).to_vec(); + DockGroup::new(LAYERS, Titles::from_content(panels.clone()), panels[0].key) + .menu(move || rows.clone()) + .panel_menu_icon(IconId::new("menu")) + .tab_look(PanelTabLook::Block) + .show(ui, |_, _| ()) + .output + .into() +} + #[story(GroupGrip, covers = [Default])] fn a_group_grip(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { GroupGrip::new(DragUnit::Group(LAYERS), PanelKey::of(&LAYERS)).label("Move tab group").show(ui).into() diff --git a/crates/ui-panels/tests/it/dock_group.rs b/crates/ui-panels/tests/it/dock_group.rs index 44240a12a4..b76f4b2753 100644 --- a/crates/ui-panels/tests/it/dock_group.rs +++ b/crates/ui-panels/tests/it/dock_group.rs @@ -65,10 +65,10 @@ fn the_shown_panels_caption_sits_under_the_tabs_and_its_count_names_its_tab() { assert!(fixture.by_label("2 replies").is_none(), "Comments' caption goes with it"); } -// Beside pill tabs (VectorCraft's) the panel menu button stands in the strip's middle, level with the shown tab's pill; -// beside plain tabs it keeps to the strip's top. +// Beside pill and block tabs (VectorCraft's) the panel menu button stands in the strip's middle, level with the shown +// tab's middle; beside plain tabs it keeps to the strip's top. #[trial] -fn the_panel_menu_button_stands_level_with_pill_tabs() { +fn the_panel_menu_button_stands_level_with_pill_and_block_tabs() { use craft_ui::menu::PanelRow; use craft_ui::tabs::PanelTabLook; let middles = |look: PanelTabLook| { @@ -82,10 +82,12 @@ fn the_panel_menu_button_stands_level_with_pill_tabs() { let Some(menu) = fixture.by_label("Panel Menu") else { panic!("the panel menu button shows") }; (tab.rect.center().y, menu.rect) }; - let (tab, menu) = middles(PanelTabLook::Pill); - assert!((menu.center().y - tab).abs() <= 0.5, "the menu button {menu:?} is level with the pill tab's middle {tab}"); let (_, plain) = middles(PanelTabLook::Plain); - assert!(menu.top() > plain.top() + 0.5, "beside plain tabs the button {plain:?} keeps to the strip's top, above {menu:?}"); + for look in [PanelTabLook::Pill, PanelTabLook::Block] { + let (tab, menu) = middles(look); + assert!((menu.center().y - tab).abs() <= 0.5, "beside {look:?} tabs the menu button {menu:?} is level with the tab's middle {tab}"); + assert!(menu.top() > plain.top() + 0.5, "beside plain tabs the button {plain:?} keeps to the strip's top, above {menu:?}"); + } } // A titled group shows the shown panel's name as a heading with its count and a close button, not a tab strip: the diff --git a/crates/ui-widgets/src/tabs/rules.rs b/crates/ui-widgets/src/tabs/rules.rs index 4761a6b60a..5f7b55dd2a 100644 --- a/crates/ui-widgets/src/tabs/rules.rs +++ b/crates/ui-widgets/src/tabs/rules.rs @@ -31,6 +31,10 @@ pub enum PanelTabLook { /// small control high in the middle of the strip; a tab under the pointer shows the pill too. A dock group's panel /// menu button stands in the strip's middle with them. Pill, + /// VectorCraft 0.24's tabs: the shown tab a square `surface.control` block as tall as the strip, a tab under the + /// pointer `state.hover`. A dock group's strip lies on `surface.canvas`, and its panel menu button stands in the + /// strip's middle. + Block, } /// The kind of a strip. It sets the defaults below; the host picks one per strip. diff --git a/crates/ui-widgets/src/tabs/strip/stories.rs b/crates/ui-widgets/src/tabs/strip/stories.rs index ca8a83e381..a906955ebd 100644 --- a/crates/ui-widgets/src/tabs/strip/stories.rs +++ b/crates/ui-widgets/src/tabs/strip/stories.rs @@ -101,6 +101,13 @@ fn tab_strip_panel_pill(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { strip(ui, data, TabStrip::new("Panels").shown(1).panel_look(PanelTabLook::Pill), &TITLES, 4, TabKind::Panel) } +/// Panel tabs in the block look (`PanelTabLook::Block`, a dock's `DockConfig::tab_look`): the shown tab a square +/// `surface.control` block as tall as the strip, the others bare until the pointer rests on one. +#[story(TabStrip<'static, usize>, covers = [], drive = Drive::Never)] +fn tab_strip_panel_block(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + strip(ui, data, TabStrip::new("Panels").shown(1).panel_look(PanelTabLook::Block), &TITLES, 4, TabKind::Panel) +} + /// The width the narrow panel story's room is held to: the shown tab whole, the others at their first letters. const NARROW_ROOM: f32 = 260.0; diff --git a/crates/ui-widgets/src/tabs/tab.rs b/crates/ui-widgets/src/tabs/tab.rs index 9fd51638b3..c030b56e80 100644 --- a/crates/ui-widgets/src/tabs/tab.rs +++ b/crates/ui-widgets/src/tabs/tab.rs @@ -421,6 +421,9 @@ impl Component for Tab<'_> { Stateful::new(c(clear)).off(States::new(c(clear), hover, c(clear), c(clear))).on(States::new(c(clear), c(clear), c(clear), c(clear))) } else if text_only { Stateful::new(c(clear)) + } else if key.kind == TabKind::Panel && key.panel_look == PanelTabLook::Block { + let control = c(colors.surface.control); + Stateful::new(c(clear)).off(States::new(c(clear), hover, hover, c(clear))).on(States::new(control, control, control, control)) } else { Stateful::new(c(clear)).off(States::new(c(clear), c(panel), c(panel), c(clear))).on(States::new(c(panel), c(panel), c(panel), c(panel))) }; From a7b48fb036f62d15d985e84e1ddad79e94eef251 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 25 Nov 2026 10:08:51 +0700 Subject: [PATCH 09/33] theme, dock: size.bar.column, the height of a dock column's bar (size.control.sm in both built-in sets, so the bar keeps its height unless an app sets it); a column's bar, expanded or collapsed to icons, lies on the surface its dock's tab strips do: surface.canvas beside PanelTabLook::Block tabs, the window's background otherwise --- crates/theme/sizes/comfortable.json | 1 + crates/theme/sizes/compact.json | 1 + crates/theme/src/dump.rs | 14 +++++-- crates/theme/src/sizes.rs | 1 + crates/theme/src/tokens/size.rs | 2 + .../tokens/adwaita-dark-high-comfortable.txt | 1 + .../tokens/adwaita-dark-high-compact.txt | 1 + .../adwaita-dark-standard-comfortable.txt | 1 + .../tokens/adwaita-dark-standard-compact.txt | 1 + .../tokens/adwaita-light-high-comfortable.txt | 1 + .../tokens/adwaita-light-high-compact.txt | 1 + .../adwaita-light-standard-comfortable.txt | 1 + .../tokens/adwaita-light-standard-compact.txt | 1 + .../tokens/artcraft-dark-high-comfortable.txt | 1 + .../tokens/artcraft-dark-high-compact.txt | 1 + .../artcraft-dark-standard-comfortable.txt | 1 + .../tokens/artcraft-dark-standard-compact.txt | 1 + .../artcraft-light-high-comfortable.txt | 1 + .../tokens/artcraft-light-high-compact.txt | 1 + .../artcraft-light-standard-comfortable.txt | 1 + .../artcraft-light-standard-compact.txt | 1 + .../tokens/breeze-dark-high-comfortable.txt | 1 + .../dumps/tokens/breeze-dark-high-compact.txt | 1 + .../breeze-dark-standard-comfortable.txt | 1 + .../tokens/breeze-dark-standard-compact.txt | 1 + .../tokens/breeze-light-high-comfortable.txt | 1 + .../tokens/breeze-light-high-compact.txt | 1 + .../breeze-light-standard-comfortable.txt | 1 + .../tokens/breeze-light-standard-compact.txt | 1 + .../tokens/classic-light-high-comfortable.txt | 1 + .../tokens/classic-light-high-compact.txt | 1 + .../classic-light-standard-comfortable.txt | 1 + .../tokens/classic-light-standard-compact.txt | 1 + .../tokens/graphite-dark-high-comfortable.txt | 1 + .../tokens/graphite-dark-high-compact.txt | 1 + .../graphite-dark-standard-comfortable.txt | 1 + .../tokens/graphite-dark-standard-compact.txt | 1 + .../graphite-light-high-comfortable.txt | 1 + .../tokens/graphite-light-high-compact.txt | 1 + .../graphite-light-standard-comfortable.txt | 1 + .../graphite-light-standard-compact.txt | 1 + .../tokens/pro-dark-high-comfortable.txt | 1 + .../dumps/tokens/pro-dark-high-compact.txt | 1 + ...ro-dark-standard-comfortable-app-sizes.txt | 1 + .../tokens/pro-dark-standard-comfortable.txt | 1 + .../tokens/pro-dark-standard-compact.txt | 1 + .../pro-light-gray-light-high-comfortable.txt | 1 + .../pro-light-gray-light-high-compact.txt | 1 + ...-light-gray-light-standard-comfortable.txt | 1 + .../pro-light-gray-light-standard-compact.txt | 1 + .../tokens/pro-light-high-comfortable.txt | 1 + .../dumps/tokens/pro-light-high-compact.txt | 1 + .../tokens/pro-light-standard-comfortable.txt | 1 + .../tokens/pro-light-standard-compact.txt | 1 + .../tokens/soft-dark-high-comfortable.txt | 1 + .../dumps/tokens/soft-dark-high-compact.txt | 1 + .../tokens/soft-dark-standard-comfortable.txt | 1 + .../tokens/soft-dark-standard-compact.txt | 1 + .../tokens/soft-light-high-comfortable.txt | 1 + .../dumps/tokens/soft-light-high-compact.txt | 1 + .../soft-light-standard-comfortable.txt | 1 + .../tokens/soft-light-standard-compact.txt | 1 + .../solarized-dark-dark-high-comfortable.txt | 1 + .../solarized-dark-dark-high-compact.txt | 1 + ...larized-dark-dark-standard-comfortable.txt | 1 + .../solarized-dark-dark-standard-compact.txt | 1 + .../tokens/studio-dark-high-comfortable.txt | 1 + .../dumps/tokens/studio-dark-high-compact.txt | 1 + .../studio-dark-standard-comfortable.txt | 1 + .../tokens/studio-dark-standard-compact.txt | 1 + .../tokens/studio-light-high-comfortable.txt | 1 + .../tokens/studio-light-high-compact.txt | 1 + .../studio-light-standard-comfortable.txt | 1 + .../tokens/studio-light-standard-compact.txt | 1 + ...ctorcraft-modern-dark-high-comfortable.txt | 1 + .../vectorcraft-modern-dark-high-compact.txt | 1 + ...craft-modern-dark-standard-comfortable.txt | 1 + ...ctorcraft-modern-dark-standard-compact.txt | 1 + ...torcraft-modern-light-high-comfortable.txt | 1 + .../vectorcraft-modern-light-high-compact.txt | 1 + ...raft-modern-light-standard-comfortable.txt | 1 + ...torcraft-modern-light-standard-compact.txt | 1 + ...ft-modern-medium-dark-high-comfortable.txt | 1 + ...rcraft-modern-medium-dark-high-compact.txt | 1 + ...odern-medium-dark-standard-comfortable.txt | 1 + ...ft-modern-medium-dark-standard-compact.txt | 1 + ...t-modern-medium-light-high-comfortable.txt | 1 + ...craft-modern-medium-light-high-compact.txt | 1 + ...dern-medium-light-standard-comfortable.txt | 1 + ...t-modern-medium-light-standard-compact.txt | 1 + crates/ui-panels/src/docking/dock_column.rs | 9 ++++- crates/ui-panels/src/docking/iconic.rs | 10 ++++- crates/ui-panels/src/docking/targets.rs | 4 +- crates/ui-patterns/src/patterns/dock/area.rs | 6 ++- .../ui-patterns/tests/it/docking/columns.rs | 37 ++++++++++++++++++- docs/craft-framework.md | 2 +- 96 files changed, 159 insertions(+), 13 deletions(-) diff --git a/crates/theme/sizes/comfortable.json b/crates/theme/sizes/comfortable.json index 3f3144323e..8cb7841cab 100644 --- a/crates/theme/sizes/comfortable.json +++ b/crates/theme/sizes/comfortable.json @@ -15,6 +15,7 @@ }, "size": { "bar": { + "column": 24.0, "options": 42.0, "options_narrow": 36.0, "status": 30.0, diff --git a/crates/theme/sizes/compact.json b/crates/theme/sizes/compact.json index 691f064615..67b84807b6 100644 --- a/crates/theme/sizes/compact.json +++ b/crates/theme/sizes/compact.json @@ -15,6 +15,7 @@ }, "size": { "bar": { + "column": 20.0, "options": 36.0, "options_narrow": 28.0, "status": 24.0, diff --git a/crates/theme/src/dump.rs b/crates/theme/src/dump.rs index c818c44553..cb89baccfd 100644 --- a/crates/theme/src/dump.rs +++ b/crates/theme/src/dump.rs @@ -158,10 +158,16 @@ fn size_lines(out: &mut Lines, size: &SizeTokens) { let RailSizes { width, button } = rail; out.line("size.rail.width", len(*width)); out.line("size.rail.button", len(*button)); - let BarSizes { title, tab, tab_large, status, options, options_narrow } = bar; - for (k, v) in - [("title", title), ("tab", tab), ("tab_large", tab_large), ("status", status), ("options", options), ("options_narrow", options_narrow)] - { + let BarSizes { title, tab, tab_large, status, options, options_narrow, column } = bar; + for (k, v) in [ + ("title", title), + ("tab", tab), + ("tab_large", tab_large), + ("status", status), + ("options", options), + ("options_narrow", options_narrow), + ("column", column), + ] { out.line(&format!("size.bar.{k}"), len(*v)); } out.line("size.panel_header", len(*panel_header)); diff --git a/crates/theme/src/sizes.rs b/crates/theme/src/sizes.rs index 1c4e81cbd2..ae1197caab 100644 --- a/crates/theme/src/sizes.rs +++ b/crates/theme/src/sizes.rs @@ -107,6 +107,7 @@ pub(crate) fn leaves(b: &mut Preset) -> Vec> { "base.size.bar.status" Num 16.0..=64.0 => s.bar.status; "base.size.bar.options" Num 16.0..=80.0 => s.bar.options; "base.size.bar.options_narrow" Num 16.0..=80.0 => s.bar.options_narrow; + "base.size.bar.column" Num 8.0..=48.0 => s.bar.column; "base.size.panel_header" Num 16.0..=64.0 => s.panel_header; "base.size.popup_min" Num 64.0..=640.0 => s.popup_min; "base.size.thumb.sm" Num 12.0..=96.0 => s.thumb.sm; diff --git a/crates/theme/src/tokens/size.rs b/crates/theme/src/tokens/size.rs index e4e27432c1..b6c0a9f078 100644 --- a/crates/theme/src/tokens/size.rs +++ b/crates/theme/src/tokens/size.rs @@ -259,6 +259,8 @@ pub struct BarSizes { pub options: f32, /// Tool options bar in its narrow form, for a window too small for the full bar. pub options_narrow: f32, + /// A dock column's bar, with its collapse chevron: a small control's height in the built-in sets. + pub column: f32, } /// Fixed sizes of controls and chrome. diff --git a/crates/theme/tests/dumps/tokens/adwaita-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/adwaita-dark-high-comfortable.txt index 97214109f0..2359d668a5 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/adwaita-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/adwaita-dark-high-compact.txt index 3d8e2e80e0..e7121520b1 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/adwaita-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/adwaita-dark-standard-comfortable.txt index 527db8c474..c2a16e0c41 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/adwaita-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/adwaita-dark-standard-compact.txt index 166ac8320c..a543b620d1 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/adwaita-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/adwaita-light-high-comfortable.txt index 0e9374c074..3d0ac1edb2 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/adwaita-light-high-compact.txt b/crates/theme/tests/dumps/tokens/adwaita-light-high-compact.txt index 7ffd6bff25..21cae94c1d 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/adwaita-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/adwaita-light-standard-comfortable.txt index a128232f33..64a5662b02 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/adwaita-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/adwaita-light-standard-compact.txt index b1c506ef28..bdc614711a 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/artcraft-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/artcraft-dark-high-comfortable.txt index 8905789e4d..2818b4b6bc 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/artcraft-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/artcraft-dark-high-compact.txt index 48674bae19..ff98b50aac 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/artcraft-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/artcraft-dark-standard-comfortable.txt index 65b00fd8f5..e13e7456ef 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/artcraft-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/artcraft-dark-standard-compact.txt index d0c756bbec..8b742f549c 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/artcraft-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/artcraft-light-high-comfortable.txt index bbf7652198..ce6faffddd 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/artcraft-light-high-compact.txt b/crates/theme/tests/dumps/tokens/artcraft-light-high-compact.txt index e9b5c2a339..13c3885257 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/artcraft-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/artcraft-light-standard-comfortable.txt index fae2a7f079..ed7e19d317 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/artcraft-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/artcraft-light-standard-compact.txt index 311f1caca8..e28f274ab5 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/breeze-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/breeze-dark-high-comfortable.txt index f78a73a717..01f8161f99 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/breeze-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/breeze-dark-high-compact.txt index 4a3a71bfbb..981169c840 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/breeze-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/breeze-dark-standard-comfortable.txt index 2778cbf09d..db698f1ce1 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/breeze-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/breeze-dark-standard-compact.txt index d1055c5693..6a6a0324ff 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/breeze-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/breeze-light-high-comfortable.txt index 0a34ade73b..fee99a4559 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/breeze-light-high-compact.txt b/crates/theme/tests/dumps/tokens/breeze-light-high-compact.txt index 63932a93e8..f7e3c0b9e7 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/breeze-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/breeze-light-standard-comfortable.txt index 5df6f0ec52..6e084fd106 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/breeze-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/breeze-light-standard-compact.txt index b586bf86cf..45d7b8b47b 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/classic-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/classic-light-high-comfortable.txt index 4d9b5acf95..85b9115b9a 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/classic-light-high-compact.txt b/crates/theme/tests/dumps/tokens/classic-light-high-compact.txt index d7fa038740..24612b5884 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/classic-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/classic-light-standard-comfortable.txt index cac48b4d49..b3faac0410 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/classic-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/classic-light-standard-compact.txt index 85abdaa3dc..ceb30ef304 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/graphite-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/graphite-dark-high-comfortable.txt index 30e9dd81c3..f5d4158837 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/graphite-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/graphite-dark-high-compact.txt index c7837bdaa7..ad5857458a 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/graphite-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/graphite-dark-standard-comfortable.txt index 3a0c7efcdd..befe67b76d 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/graphite-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/graphite-dark-standard-compact.txt index f2002683b4..09b4686ca2 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/graphite-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/graphite-light-high-comfortable.txt index 257b6467b1..305b150415 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/graphite-light-high-compact.txt b/crates/theme/tests/dumps/tokens/graphite-light-high-compact.txt index 148b62371e..e0d1285b29 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/graphite-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/graphite-light-standard-comfortable.txt index c7399d4424..2e4da57ebf 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/graphite-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/graphite-light-standard-compact.txt index bd569c4d0d..13733c2f0f 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/pro-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-dark-high-comfortable.txt index bb87961d24..19adf1d896 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/pro-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/pro-dark-high-compact.txt index e3f0477dfc..2a7ac96f21 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable-app-sizes.txt b/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable-app-sizes.txt index e2baacfe8a..2de29733d9 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable-app-sizes.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable-app-sizes.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable.txt index bdbe993eac..a4c8895cb9 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/pro-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/pro-dark-standard-compact.txt index 29caba27ef..6d819b0892 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-comfortable.txt index 1c177daaaf..606d91aeba 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-compact.txt b/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-compact.txt index b11a4ee8ef..a378a19e34 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-gray-light-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-comfortable.txt index f2396ce7b5..b973e90f86 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-compact.txt index fe12225a17..7a15132cba 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-gray-light-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/pro-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-light-high-comfortable.txt index 87ce0338e6..02fb86f5f4 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/pro-light-high-compact.txt b/crates/theme/tests/dumps/tokens/pro-light-high-compact.txt index 04bd4a7a3d..a01623144c 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/pro-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/pro-light-standard-comfortable.txt index 0010638c8a..e3a4748548 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/pro-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/pro-light-standard-compact.txt index 229ad03d4f..7ee8dbbe38 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/soft-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/soft-dark-high-comfortable.txt index 1bece30c56..f40df0089d 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/soft-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/soft-dark-high-compact.txt index 553d048da8..bcd6b8143a 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/soft-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/soft-dark-standard-comfortable.txt index b185adc363..f352f874a3 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/soft-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/soft-dark-standard-compact.txt index c0df85540a..8dc009b5fc 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/soft-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/soft-light-high-comfortable.txt index 9da6fb3422..c98f06a2c0 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/soft-light-high-compact.txt b/crates/theme/tests/dumps/tokens/soft-light-high-compact.txt index bad97b7a99..ba3dd69d30 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/soft-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/soft-light-standard-comfortable.txt index 0e6ec0d87d..d171e1b752 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/soft-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/soft-light-standard-compact.txt index 6ea6ef3e5d..9dc2021686 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-comfortable.txt index c1e98773bc..bca18d16bf 100644 --- a/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-compact.txt index 03d4694907..0ad63374f0 100644 --- a/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/solarized-dark-dark-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-comfortable.txt index cf0f273e88..5ae3bf864c 100644 --- a/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-compact.txt index 58c8ea3cb7..341bfef1cf 100644 --- a/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/solarized-dark-dark-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/studio-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/studio-dark-high-comfortable.txt index 343160396e..0bfaeaf7ed 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/studio-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/studio-dark-high-compact.txt index f67f595938..064bdbe759 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/studio-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/studio-dark-standard-comfortable.txt index 1dc872c253..acb3377f8f 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/studio-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/studio-dark-standard-compact.txt index 1929ef4f1f..864c4d6a85 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/studio-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/studio-light-high-comfortable.txt index 816f246495..e4799639a9 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/studio-light-high-compact.txt b/crates/theme/tests/dumps/tokens/studio-light-high-compact.txt index 414c17e58e..aebbb1cefc 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/studio-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/studio-light-standard-comfortable.txt index 8efa894323..417a851373 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/studio-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/studio-light-standard-compact.txt index 0920634b06..1ce0995420 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-comfortable.txt index 706fd0c2cd..0d00f55674 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-compact.txt index edf0d2d7b9..3f222f53d6 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-comfortable.txt index 5babd1d779..91e5debfcd 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-compact.txt index c9e1fd086e..64bdd9ad81 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-dark-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-comfortable.txt index f3a5ad5c7a..67bc5e1128 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-compact.txt index c7a1bc99c8..b6f3ee503e 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-comfortable.txt index 5fd31f242e..34a4e3b670 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-compact.txt index f8828fa20f..299c173fd1 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-light-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-comfortable.txt index d8b6ce06c7..d17dc20579 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-compact.txt index fa43b9602b..795a06ad0d 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-comfortable.txt index 7b0559933d..8315be116c 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-compact.txt index 006eaa302d..c2f231be31 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-dark-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-comfortable.txt index fcce02ab84..4019b725ba 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-compact.txt index b30c030ff4..c608b4ac12 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-high-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-comfortable.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-comfortable.txt index a0b1f1dc08..a3e118d0d7 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-comfortable.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 38 size.bar.status = 30 size.bar.options = 42 size.bar.options_narrow = 36 +size.bar.column = 24 size.panel_header = 34 size.popup_min = 240 size.thumb.sm = 18 diff --git a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-compact.txt b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-compact.txt index 3b4e7a95f2..6dfba311e9 100644 --- a/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/vectorcraft-modern-medium-light-standard-compact.txt @@ -160,6 +160,7 @@ size.bar.tab_large = 32 size.bar.status = 24 size.bar.options = 36 size.bar.options_narrow = 28 +size.bar.column = 20 size.panel_header = 28 size.popup_min = 192 size.thumb.sm = 18 diff --git a/crates/ui-panels/src/docking/dock_column.rs b/crates/ui-panels/src/docking/dock_column.rs index 63c43fc3be..d3bc6c3645 100644 --- a/crates/ui-panels/src/docking/dock_column.rs +++ b/crates/ui-panels/src/docking/dock_column.rs @@ -6,6 +6,7 @@ //! user did; the dock decides what a drop changes. use super::divider::{self, Divider, Drag}; +use super::group::strip_surface; use super::{CardInset, DividerKind, DockSizes, DockSpot, DockTargets, DockWords, DragUnit, PanelKey, PanelSpec, Splitter}; use crate::contract::{ Access, BodyCx, Common, Component, Container, ContainerProps, Cx, NoValue, Outcome, Pad, PaintUi, PartsCx, Pointer as _, Props as _, Role, @@ -15,6 +16,7 @@ use crate::menu::GroupItem; use crate::runtime::env::Label; use crate::runtime::focus::KeyUse; use crate::style::{ComponentStyle, Corners, StyleCx, SurfaceEdge, SurfaceKind, SurfaceStyle, UiTokens}; +use crate::tabs::PanelTabLook; use craft_behavior::divider::{self as push, Segment}; use craft_behavior::dock::{Column, DockEdge, Group}; use craft_behavior::{Axis, DockSide, Flow, Metrics, PartKey, Sense, Value}; @@ -205,6 +207,10 @@ pub struct DockColumn<'a, P: Value + Hash + 'static> { /// sit inside the card, inset by that on its outer side and by [`DockSizes::card`] on its top and bottom. #[prop] card: Option, + /// The look of the dock's panel tabs ([`DockConfig::tab_look`](super::DockConfig::tab_look)): the column's bar + /// lies on the surface the groups' tab strips do. + #[prop] + tab_look: PanelTabLook, /// The plan `parts` laid out this pass, which update, paint and access read. laid: Option, resized: Vec<(P, f32)>, @@ -229,6 +235,7 @@ impl<'a, P: Value + Hash + Debug + 'static> DockColumn<'a, P> { arrow: ColumnArrow::Collapse, within: Rect::NOTHING, card: None, + tab_look: PanelTabLook::Plain, laid: None, resized: Vec::new(), width: None, @@ -519,7 +526,7 @@ impl Component for DockColumn<'_, P> { if self.bar == ColumnBar::Own { // A card's bar is part of the card. if card == cx.rect { - ui.draw().surface(plan.bar, SurfaceKind::Background, Corners::None); + ui.draw().surface(plan.bar, strip_surface(self.tab_look), Corners::None); } if self.arrow.shown() { paint_chevron(ui, self.edge, self.arrow, true, cx.flow.is_rtl(), &cx.words::()); diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index e3d2fe758c..2e843d283e 100644 --- a/crates/ui-panels/src/docking/iconic.rs +++ b/crates/ui-panels/src/docking/iconic.rs @@ -5,7 +5,7 @@ use super::dock_column::{ BarRecord, CHEVRON, ColumnArrow, ColumnBar, bar_band, bar_slots, card_rect, card_style, column_grip, describe_chevron, paint_card, paint_chevron, register_edges, show_bar, }; -use super::group::GripMarks; +use super::group::{GripMarks, strip_surface}; use super::{CardInset, DockSizes, DockSpot, DockTargets, DockWords, DragUnit, Flyout, GroupAt, PanelKey, PanelSpec, Splitter, start_icon_drag}; use crate::buttons::IconButton; use crate::contract::overlay::Anchor; @@ -19,6 +19,7 @@ use crate::primitives::{IconSpec, TextRun}; use crate::runtime::env::{EnvValue, Label}; use crate::runtime::focus::KeyUse; use crate::style::{ComponentStyle, Corners, GlyphRole, RuleKind, StyleColor, StyleCx, SurfaceKind, SurfaceStyle}; +use crate::tabs::PanelTabLook; use craft_behavior::dock::{Column, DockEdge, Group}; use craft_behavior::overlay::Side; use craft_behavior::{Axis, CursorIcon, DockSide, Metrics, PartKey, PressPhase, Sense, Value}; @@ -248,6 +249,10 @@ pub struct IconicColumn<'a, P: Value + Hash + 'static> { /// sit inside the card, inset by that on its outer side and by [`DockSizes::card`] on its top and bottom. #[prop] card: Option, + /// The look of the dock's panel tabs ([`DockConfig::tab_look`](super::DockConfig::tab_look)): the column's bar + /// lies on the surface the groups' tab strips do. + #[prop] + tab_look: PanelTabLook, open: Bind<'a, Option

>, view: Option>, /// The bar's rect this pass. @@ -310,6 +315,7 @@ impl<'a, P: Value + Hash + Debug + 'static> IconicColumn<'a, P> { mode: IconicMode::Flyouts, within: Rect::NOTHING, card: None, + tab_look: PanelTabLook::Plain, open, view: None, bar_rect: Rect::NOTHING, @@ -653,7 +659,7 @@ impl Component for IconicColumn<'_, P> { if self.bar == ColumnBar::Own { // A card's bar is part of the card. if self.card.is_none() { - ui.draw().surface(self.bar_rect, SurfaceKind::Background, Corners::None); + ui.draw().surface(self.bar_rect, strip_surface(self.tab_look), Corners::None); } paint_chevron(ui, self.edge, ColumnArrow::Collapse, self.expanded(), cx.flow.is_rtl(), &cx.words::()); } diff --git a/crates/ui-panels/src/docking/targets.rs b/crates/ui-panels/src/docking/targets.rs index 84e3b6d88e..ab1453b0fa 100644 --- a/crates/ui-panels/src/docking/targets.rs +++ b/crates/ui-panels/src/docking/targets.rs @@ -51,7 +51,7 @@ pub struct DockSizes { pub least_pane: f32, /// The height of a group's tab strip or section title row (the panel header height), which every group height includes. pub strip: f32, - /// The height of a column bar (a small control). + /// The height of a column bar (`size.bar.column`). pub bar: f32, /// The height of a floating window's title row, which is the bar of the column the window holds. pub title_row: f32, @@ -146,7 +146,7 @@ impl DockSizes { strip_reach: size.hit.target, least_pane: size.pane.least, strip: size.panel_header, - bar: size.control.sm, + bar: size.bar.column, title_row: super::floating::title_row(cx.tokens), title_rule: cx.rule(RuleKind::Divider).width, pixels_per_point: cx.frame_ctx().pixels_per_point(), diff --git a/crates/ui-patterns/src/patterns/dock/area.rs b/crates/ui-patterns/src/patterns/dock/area.rs index ad4a690104..9d1ba96eba 100644 --- a/crates/ui-patterns/src/patterns/dock/area.rs +++ b/crates/ui-patterns/src/patterns/dock/area.rs @@ -1547,7 +1547,8 @@ impl Pass<'_, P> { .bar(bar) .within(within) .auto_collapse(scene.auto_collapse) - .mode(mode); + .mode(mode) + .tab_look(scene.config.tab_look); let shown = match card { Some(place) => shown.card(place), None => shown, @@ -1606,7 +1607,8 @@ impl Pass<'_, P> { .bar(bar) .arrow(self.arrow_of(column)) .within(within) - .auto_collapse(scene.auto_collapse); + .auto_collapse(scene.auto_collapse) + .tab_look(scene.config.tab_look); let shown = match card { Some(place) => shown.card(place), None => shown, diff --git a/crates/ui-patterns/tests/it/docking/columns.rs b/crates/ui-patterns/tests/it/docking/columns.rs index 217f91ad0c..84605940a3 100644 --- a/crates/ui-patterns/tests/it/docking/columns.rs +++ b/crates/ui-patterns/tests/it/docking/columns.rs @@ -2,13 +2,14 @@ use craft_behavior::Axis; use craft_behavior::dock::{Action, Column, DockEdge, Floating, Group, Layout, Node, Permissions, SplitSize, Workspace, node_at}; +use craft_theme::{AppSizes, SizeValue}; use craft_ui::contract::{Bind, BodyCx, PlainData, Role, Show as _, SizeLimits, Tracked}; use craft_ui::display::Text; use craft_ui::docking::{ DockConfig, DockGrid, DockHeights, DockPanels, DockSizes, GroupAt, GroupSize, IconicMode, PanelSpec, PanelSpecs, group_heights, }; use craft_ui::patterns::dock::DockArea; -use craft_ui::runtime::env::Direction; +use craft_ui::runtime::env::{Direction, RootEnv}; use craft_ui::testing::{Fixture, pointer, trial}; use egui::{Pos2, Rect, Ui, Vec2}; use std::cell::{Cell, RefCell}; @@ -654,3 +655,37 @@ fn every_docked_column_is_a_card_with_gutters_between_them() { assert!((cards.icons.width() - plain.icons.width() - gutter).abs() <= 0.5, "{direction:?}: the icons' column grows by its gutter"); } } + +/// The top of the expanded column's panel body in the card dock, with the column bar `size.bar.column` set to `bar` +/// points when given. +fn body_top(bar: Option) -> f32 { + let mut iconic = Column::new(vec![Group::new(vec![ICONS], 0)]); + iconic.iconic = true; + let columns = vec![Column::new(vec![Group::new(vec![SIDE], 0)]).with_width(220.0), iconic]; + let root = Node::split(Axis::X, SplitSize::Ratio(0.6), Node::tabs(vec![1], 0), Node::dock(DockEdge::End, columns)); + let workspace = Rc::new(RefCell::new(Arc::new(Workspace::new(Layout::new(Some(root), Vec::new()))))); + let body: Rc>> = Rc::default(); + let (held, shown, specs) = (Rc::clone(&workspace), Rc::clone(&body), Tracked::new(CardPanels)); + let mut fixture = Fixture::new(move |ui| { + let mut workspace = held.borrow().clone(); + let _ = DockArea::new("Bar dock", Bind::bound(&mut workspace), &specs, &mut CardStage(Rc::clone(&shown)), DockConfig::default()).show(ui); + *held.borrow_mut() = workspace; + }); + let mut root = RootEnv::default(); + if let Some(bar) = bar { + let mut sizes = AppSizes::default(); + sizes.all.insert("size.bar.column".to_owned(), SizeValue::Number(bar)); + root.sizes = Arc::new(sizes); + } + fixture.root(root).room(Vec2::new(900.0, 500.0)).settle(); + body.get().expect("the side panel shows").top() +} + +/// A dock column's bar is `size.bar.column` high: an app that sets it lower (VectorCraft's 14 points) raises the +/// column's groups by the difference from the built-in small control height. +#[trial] +fn a_columns_bar_is_as_high_as_its_token() { + let built_in = body_top(None); + let low = body_top(Some(14.0)); + assert!(low < built_in - 0.5, "a lower column bar raises the column's groups: {low} against {built_in}"); +} diff --git a/docs/craft-framework.md b/docs/craft-framework.md index 139c981c55..ca71e4532e 100644 --- a/docs/craft-framework.md +++ b/docs/craft-framework.md @@ -995,7 +995,7 @@ A theme with its own shape replaces the radii or adds an offset to control, surf | `size.button` | A standard push button's height (`Button`, `SplitButton`, `ToggleButton` faces); follows an app's `size.control.md` unless the app sets it | | `size.icon.sm`, `size.icon.md`, `size.icon.lg` | Icons; `md` is the glyph of a tool strip and of a panel footer's actions (`GlyphRole::Tool`), `lg` of a tool rail (`GlyphRole::ToolRail`). A stroke-set icon draws its line `stroke.icon` of its side | | `size.icon.glyph_sm`, `size.icon.glyph_md` | The glyph in an icon-only button (`GlyphRole::Control`, the default; a container sets another with `ContainerProps::child_glyphs`) | -| `size.bar.title`, `size.bar.tab`, `size.bar.tab_large`, `size.bar.status`, `size.bar.options`, `size.bar.options_narrow` | Title bar, document tab bar, document tab bar with large tabs, status bar, options bar | +| `size.bar.title`, `size.bar.tab`, `size.bar.tab_large`, `size.bar.status`, `size.bar.options`, `size.bar.options_narrow`, `size.bar.column` | Title bar, document tab bar, document tab bar with large tabs, status bar, options bar, a dock column's bar (`size.control.sm` in the built-in sets) | | `size.panel_header` | Panel headers | | `size.popup_min` | Least width of a popup surface (menus only; popup lists such as Select and ComboBox take their anchor's width) | | `size.groove` | Groove of a value track | From 9012e52081825ee22714322f8bdf281bb3cbcd52 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 25 Nov 2026 10:09:21 +0700 Subject: [PATCH 10/33] dock, iconic column: under IconGroupSeparator::Rule a collapsed column's icon groups have no grip strips: the first icon stands right under the column's bar, a group's first icon drags the group, and the room between two groups is space.gap.stack and the rule, the rule in its middle; Grip, the default, keeps its strips --- crates/ui-panels/src/docking/group.rs | 2 +- crates/ui-panels/src/docking/iconic.rs | 67 +++++++++++-------- .../ui-panels/src/docking/iconic/stories.rs | 2 +- crates/ui-panels/src/docking/iconic/trials.rs | 46 ++++++++----- 4 files changed, 71 insertions(+), 46 deletions(-) diff --git a/crates/ui-panels/src/docking/group.rs b/crates/ui-panels/src/docking/group.rs index bc4a31f9a7..29c277e8ac 100644 --- a/crates/ui-panels/src/docking/group.rs +++ b/crates/ui-panels/src/docking/group.rs @@ -46,7 +46,7 @@ pub struct GroupGripStyle { /// (photocraft#16426): ticks, dots or one level bar, how many, how large and how far apart; by default eleven upright ticks, a thin /// stroke wide, five points tall and a thin stroke apart. The marks keep their ink under the pointer. A toolbar's grip /// under its column bar and the grip above each icon group of a collapsed column paint the same marks, unless the app -/// separates icon groups by a rule (`IconGroupSeparator::Rule`). +/// separates icon groups by a rule (`IconGroupSeparator::Rule`), where the groups have no grip strips. #[derive(Clone, Copy, Debug, PartialEq)] pub(super) struct GripMarks { ink: StyleColor, diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index 2e843d283e..070779f3db 100644 --- a/crates/ui-panels/src/docking/iconic.rs +++ b/crates/ui-panels/src/docking/iconic.rs @@ -46,9 +46,11 @@ pub struct IconicSizes { pub column: DockSizes, /// The height of an icon cell (the rail button). pub cell: f32, - /// The height of the grip strip at the top of each icon group, above its first icon. + /// The height of the grip strip at the top of each icon group, above its first icon: none with + /// [`IconGroupSeparator::Rule`]. pub grip: f32, - /// The room between two icon groups. + /// The room between two icon groups: the tight gap, or with [`IconGroupSeparator::Rule`] the stack gap and the + /// rule. pub separator: f32, /// The column width from which each cell shows its panel's name beside its icon. pub labels: f32, @@ -61,13 +63,11 @@ impl IconicSizes { /// The sizes of the style context `cx`. pub fn style(cx: &StyleCx<'_>) -> Self { let size = &cx.tokens.size; - IconicSizes { - column: DockSizes::style(cx), - cell: size.rail.button, - grip: super::group::grip_strip(cx.tokens), - separator: cx.tokens.space.gap.tight, - labels: size.rail.width * LABELS_IN_RAIL_WIDTHS, - } + let (grip, separator) = match cx.env::() { + IconGroupSeparator::Grip => (super::group::grip_strip(cx.tokens), cx.tokens.space.gap.tight), + IconGroupSeparator::Rule => (0.0, cx.tokens.space.gap.stack + cx.rule(RuleKind::Edge).width.points(cx.frame_ctx().pixels_per_point())), + }; + IconicSizes { column: DockSizes::style(cx), cell: size.rail.button, grip, separator, labels: size.rail.width * LABELS_IN_RAIL_WIDTHS } } /// The sizes in the root scope's style, for code outside a style pass: @@ -98,16 +98,17 @@ pub enum IconicMode { Rail, } -/// What marks the icon groups of a collapsed column apart. An app sets it once at its root (`RootEnv::values`). Either -/// way each group keeps its grip strip above its first icon, which drags the group. +/// What marks the icon groups of a collapsed column apart. An app sets it once at its root (`RootEnv::values`). #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, EnvValue, crate::contract::MemoProps)] #[env(style)] #[non_exhaustive] pub enum IconGroupSeparator { - /// Each group's grip strip shows the dock's grip marks (`shape.grip`, in `line.grip`). + /// Each group has a grip strip above its first icon, which shows the dock's grip marks (`shape.grip`, in + /// `line.grip`) and drags the group. #[default] Grip, - /// The grip strips are bare, and an edge rule (`line.border`) lies level across the room between two groups, + /// No grip strips: a group's first icon drags the group, its first icon stands right under the column's bar, and an + /// edge rule (`line.border`) lies level in the middle of the `space.gap.stack` between two groups, /// `space.gap.inline` short of the column's sides: VectorCraft's icon groups, as production drew them. Rule, } @@ -436,7 +437,9 @@ impl<'a, P: Value + Hash + Debug + 'static> IconicColumn<'a, P> { } y += sizes.cell; } - grips.push((at, grip)); + if grip.height() > 0.0 { + grips.push((at, grip)); + } groups.push((at, Rect::from_min_max(Pos2::new(body.left(), top), Pos2::new(body.right(), y)))); } Plan { bar, cells, names, grips, groups, body } @@ -576,22 +579,30 @@ impl Component for IconicColumn<'_, P> { let dragging = |phase: PressPhase| matches!(phase, PressPhase::DragStart { start, .. } if start.button == craft_behavior::PointerButton::Primary); let mut began = false; - for (group, extent) in &plan.groups { - if dragging(cx.part(GRIP.at(*group as u64)).press.phase) - && let Some(lead) = self.column.groups.get(*group) - && let Some(anchor) = lead.panels.first() - { - let shown = lead.active_panel().unwrap_or(anchor); - let label = Label::from((self.spec)(shown).label.as_str().to_owned()); - start_icon_drag(cx, DragUnit::Group(anchor.clone()), PanelKey::of(shown), extent.size(), label); - began = true; + // A group drags by its grip strip, or without one by its first icon. + let group_drag = |cx: &mut Cx<'_, Self>, group: usize| { + let lead = self.column.groups.get(group)?; + let anchor = lead.panels.first()?; + let extent = plan.groups.iter().find(|(at, _)| *at == group)?.1; + let shown = lead.active_panel().unwrap_or(anchor); + let label = Label::from((self.spec)(shown).label.as_str().to_owned()); + start_icon_drag(cx, DragUnit::Group(anchor.clone()), PanelKey::of(shown), extent.size(), label); + Some(()) + }; + for (group, _) in &plan.grips { + if cx.part_if_declared(GRIP.at(*group as u64)).is_some_and(|grip| dragging(grip.press.phase)) { + began |= group_drag(cx, *group).is_some(); } } + let gripless = plan.grips.is_empty(); for (at, (group, panel, cell)) in plan.cells.iter().enumerate() { let named = cx.part_if_declared(NAME.at(at as u64)).is_some_and(|name| dragging(name.press.phase)); - if (dragging(cx.part(CELL.at(at as u64)).press.phase) || named) - && let Some(panel) = self.panel(*group, *panel) - { + if !(dragging(cx.part(CELL.at(at as u64)).press.phase) || named) { + continue; + } + if gripless && *panel == 0 { + began |= group_drag(cx, *group).is_some(); + } else if let Some(panel) = self.panel(*group, *panel) { let label = Label::from((self.spec)(panel).label.as_str().to_owned()); start_icon_drag(cx, DragUnit::Panel(panel.clone()), PanelKey::of(panel), cell.size(), label); began = true; @@ -692,8 +703,8 @@ impl Component for IconicColumn<'_, P> { IconGroupSeparator::Rule => { let xs = plan.body.x_range().shrink(style.rule_inset); // In the middle of the room from a group's last icon to the next group's first. - for ((_, above), (_, strip)) in plan.groups.iter().zip(plan.grips.iter().skip(1)) { - let y = (above.bottom() + strip.bottom()) / 2.0; + for pair in plan.groups.windows(2) { + let y = (pair[0].1.bottom() + pair[1].1.top()) / 2.0; ui.draw().rule(RuleKind::Edge, Pos2::new(xs.min, y), Pos2::new(xs.max, y)); } } diff --git a/crates/ui-panels/src/docking/iconic/stories.rs b/crates/ui-panels/src/docking/iconic/stories.rs index 29171652a8..5b8330b325 100644 --- a/crates/ui-panels/src/docking/iconic/stories.rs +++ b/crates/ui-panels/src/docking/iconic/stories.rs @@ -114,7 +114,7 @@ fn icons_as_a_card(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { .into() } -/// The icon groups of an app that sets `IconGroupSeparator::Rule` at its root (VectorCraft's): bare grip strips, and an +/// The icon groups of an app that sets `IconGroupSeparator::Rule` at its root (VectorCraft's): no grip strips, and an /// edge rule across the room between two groups. #[story(IconicColumn<'static, u8>, covers = [], drive = Drive::Never, title = "Icon groups apart by a rule")] fn icon_groups_apart_by_a_rule(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { diff --git a/crates/ui-panels/src/docking/iconic/trials.rs b/crates/ui-panels/src/docking/iconic/trials.rs index b3d65d6652..ce509305da 100644 --- a/crates/ui-panels/src/docking/iconic/trials.rs +++ b/crates/ui-panels/src/docking/iconic/trials.rs @@ -24,7 +24,7 @@ use crate::testing::{Fixture, trial}; use craft_behavior::DockSide; use craft_behavior::dock::{Action, Column, DockEdge, Group, Layout, Node}; use craft_behavior::overlay::Side; -use egui::{Key, Modifiers, Pos2, Rect, UiBuilder, Vec2}; +use egui::{Id, Key, Modifiers, Pos2, Rect, UiBuilder, Vec2}; use std::cell::{Cell, RefCell}; use std::rc::Rc; @@ -662,19 +662,17 @@ fn a_themes_bar_grip_is_one_level_bar() { assert!((bar.center().x - strip.center().x).abs() <= 0.5, "centred across the strip: {bar:?} in {strip:?}"); } -/// An app's `IconGroupSeparator::Rule` (VectorCraft's): the grip strips show no marks, and one level edge rule lies in -/// the room between the two groups, under the first group's last icon and over the second group's first, short of the -/// column's sides; none lies over the first group. -#[trial] -fn icon_groups_apart_by_a_rule_show_one_level_rule_between_them() { - let mut fixture = Fixture::hosted(|ui| { +/// The icons of the two groups of a collapsed column whose groups stand apart by `separator`: the column's id and the +/// fixture. +fn separated(separator: IconGroupSeparator) -> (Fixture, Id) { + let mut fixture = Fixture::hosted(move |ui| { let mut column = Column::new(vec![Group::new(vec![1, 2], 0), Group::new(vec![3], 0)]); column.iconic = true; let place = Rect::from_min_size(Pos2::ZERO, Vec2::new(RAIL, SCREEN.y)); with_env( ui, |overrides| { - overrides.values.set(IconGroupSeparator::Rule); + overrides.values.set(separator); }, |ui| { let output = IconicColumn::new("Panels", global("iconic column", "rule"), &column, Bind::kept(), &named) @@ -686,6 +684,17 @@ fn icon_groups_apart_by_a_rule_show_one_level_rule_between_them() { }); fixture.room(SCREEN).settle(); let id = fixture.root_id().expect("the column shows"); + (fixture, id) +} + +/// An app's `IconGroupSeparator::Rule` (VectorCraft's): no grip strips, so the first icon stands higher than under grip +/// strips; one level edge rule lies in the middle of the room between the two groups, short of the column's sides, and +/// none over the first group; a drag on a group's first icon moves the group, on its next icon only that panel. +#[trial] +fn icon_groups_apart_by_a_rule_show_one_level_rule_between_them() { + let (gripped, gripped_id) = separated(IconGroupSeparator::Grip); + let gripped_first = gripped.part_rect(gripped_id, CELL.at(0)).expect("the first icon under grips"); + let (mut fixture, id) = separated(IconGroupSeparator::Rule); let border = StyleCx::with_root(fixture.ctx(), |cx| cx.tokens.color.line.border); let shapes = fixture.frame_shapes(); let level: Vec<(Pos2, Pos2, egui::Color32)> = shapes @@ -696,20 +705,25 @@ fn icon_groups_apart_by_a_rule_show_one_level_rule_between_them() { }) .collect(); for group in [0, 1] { - let strip = fixture.part_rect(id, GRIP.at(group)).expect("each group keeps its grip"); - assert!(grip_ticks(&shapes, strip).is_none(), "group {group}: the strip shows no marks"); + assert!(fixture.part_rect(id, GRIP.at(group)).is_none(), "group {group} has no grip strip"); } - let first = fixture.part_rect(id, GRIP.at(0)).expect("the first group's grip"); - assert!(!level.iter().any(|(a, _, _)| first.y_range().contains(a.y)), "no rule over the first group: {level:?}"); - let (last, next) = ( - fixture.part_rect(id, CELL.at(1)).expect("the first group's last icon"), - fixture.part_rect(id, CELL.at(2)).expect("the second group's icon"), - ); + let cell = |at: u64| fixture.part_rect(id, CELL.at(at)).expect("the icon shows"); + let (first, last, next) = (cell(0), cell(1), cell(2)); + assert!(first.top() < gripped_first.top() - 0.5, "the first icon {first:?} stands higher than under a grip strip {gripped_first:?}"); + assert!(!level.iter().any(|(a, _, _)| a.y < first.bottom()), "no rule over the first group: {level:?}"); let between: Vec<_> = level.iter().filter(|(a, _, _)| a.y > last.bottom() && a.y < next.top()).collect(); let [(a, b, ink)] = between.as_slice() else { panic!("one rule between the groups: {level:?}") }; + let middle = (last.bottom() + next.top()) / 2.0; + assert!((a.y - middle).abs() <= 0.5, "the rule {a:?} lies in the middle of the room from {last:?} to {next:?}"); let (left, right) = (a.x.min(b.x), a.x.max(b.x)); let span = right - left; assert!(left > 0.0 && right < RAIL && span > RAIL - span, "the rule reaches across the column, short of its sides: {a:?} to {b:?}"); let [r, g, bl, al] = border.0; assert_eq!(*ink, egui::Color32::from_rgba_unmultiplied(r, g, bl, al), "the rule is in line.border"); + for (icon, unit) in [(first, DragUnit::Group(1)), (last, DragUnit::Panel(2)), (next, DragUnit::Group(3))] { + fixture.drag_hold_at(icon.center(), Vec2::new(RAIL * 2.0, 0.0)); + let dragged = drag::active::>(fixture.ctx()).map(|drag| drag.unit.clone()); + assert_eq!(dragged, Some(unit.clone()), "a drag on the icon {icon:?} moves {unit:?}"); + fixture.release_at(icon.center() + Vec2::new(RAIL * 2.0, 0.0)).settle(); + } } From 9916d165856cf0e1038f0b830191c7b092a9b49b Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 25 Nov 2026 10:09:44 +0700 Subject: [PATCH 11/33] dock: DockConfig::column_cards takes ColumnCards: None (the default), All (every docked column a card, as the switch on was) or Stepped, which shows only the stepped columns such as a docked tool rail as cards and keeps the panel columns flush; DockSizes::card_place and card_inset read the column --- crates/ui-panels/src/docking/config.rs | 14 ++--- .../src/docking/dock_column/stories.rs | 10 ++-- .../ui-panels/src/docking/iconic/stories.rs | 9 +-- crates/ui-panels/src/docking/mod.rs | 2 +- crates/ui-panels/src/docking/targets.rs | 59 ++++++++++++------- crates/ui-patterns/src/patterns/dock/area.rs | 2 +- .../ui-patterns/tests/it/docking/columns.rs | 36 ++++++++--- 7 files changed, 85 insertions(+), 47 deletions(-) diff --git a/crates/ui-panels/src/docking/config.rs b/crates/ui-panels/src/docking/config.rs index 4f0e2232e9..18ce4d8b42 100644 --- a/crates/ui-panels/src/docking/config.rs +++ b/crates/ui-panels/src/docking/config.rs @@ -1,8 +1,8 @@ //! `DockConfig`: how a dock behaves, apart from how it looks (the dock's `ComponentStyle`) and what it says //! (`DockWords`). -use super::IconicMode; use super::targets::ZoneRule; +use super::{ColumnCards, IconicMode}; use crate::tabs::PanelTabLook; use craft_behavior::{DockSide, IconId}; @@ -82,13 +82,13 @@ pub struct DockConfig { /// sides ([`FloatingGroup::rounded_body`](super::FloatingGroup)): a floating tool rail reads as one rounded piece. /// Off: the panels and rails inside paint their own square surfaces to the window's edge. pub floating_rounded_body: bool, - /// Every docked column, expanded or collapsed to icons, shows as a card on the dock's `surface.background`: + /// Which docked columns show as cards on the dock's `surface.background` ([`ColumnCards`]), each /// painted `surface.panel` with `shape.radius.surface` corners and no frame, inset by `space.gap.stack` on its top /// and bottom and, for the column at the window edge, on its outer side; each further column stands /// `space.gap.tight` from its outer neighbour's card. A column is wider by its inset, so it keeps its content's /// width (a tool rail its steps); its dividers, drop bands and edge handle stay on its outer rect. Off: a column /// fills its cell. - pub column_cards: bool, + pub column_cards: ColumnCards, /// Shows a close button on the tabs of closable panels in docked and floating groups, where a middle click also /// closes them, for tabs that act as documents. Off: panels close from their menu. Accordion headers and iconic /// columns never show it. @@ -133,7 +133,7 @@ impl Default for DockConfig { close_button: true, floating_grip: false, floating_rounded_body: false, - column_cards: false, + column_cards: ColumnCards::None, tab_close_buttons: false, titled_headers: false, wheel_selects_tabs: false, @@ -253,10 +253,10 @@ impl DockConfig { self } - /// Docked columns as cards on or off ([`column_cards`](Self::column_cards)). + /// Which docked columns show as cards ([`column_cards`](Self::column_cards)). #[must_use] - pub fn column_cards(mut self, on: bool) -> Self { - self.column_cards = on; + pub fn column_cards(mut self, cards: ColumnCards) -> Self { + self.column_cards = cards; self } diff --git a/crates/ui-panels/src/docking/dock_column/stories.rs b/crates/ui-panels/src/docking/dock_column/stories.rs index 6fcd46121e..5154d249e3 100644 --- a/crates/ui-panels/src/docking/dock_column/stories.rs +++ b/crates/ui-panels/src/docking/dock_column/stories.rs @@ -1,7 +1,7 @@ //! Stories of `DockColumn`. use crate::contract::{ShowContainer as _, Tracked}; -use crate::docking::{CardInset, ColumnBar, DockColumn, DockGrid, DockSizes, PanelSpec}; +use crate::docking::{CardInset, ColumnBar, ColumnCards, DockColumn, DockGrid, DockSizes, PanelSpec}; use crate::rails::tool::stories::{BRUSH, tools}; use crate::rails::{LastUsed, RailDensity, ToolRail, ToolSlot}; use crate::runtime::env::Env; @@ -59,7 +59,7 @@ fn a_tool_rail_card(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let cells = slots.len(); let spec = move |_: &u8| PanelSpec::new("Tools").grid(DockGrid::rail(cells).density(density)); let column = Column::new(vec![Group::new(vec![0], 0)]).with_steps(steps); - let sizes = DockSizes { column_cards: true, ..DockSizes::of_scope(ui) }; + let sizes = DockSizes { column_cards: ColumnCards::All, ..DockSizes::of_scope(ui) }; let width = sizes.natural(std::slice::from_ref(&column), &spec).first().map_or(0.0, |(width, _)| *width); let room = Flow::new(ui.available_rect_before_wrap(), Env::of(ui).direction.is_rtl()).span(0.0, width); let rect = room.with_max_y(room.top() + CARD_HEIGHT); @@ -83,12 +83,12 @@ fn a_tool_rail_card(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { fn a_panel_column_card(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let at = *data.choice("place", 0_usize, &[("At the window edge", 0), ("Inward of another column", 1)]); let column = Column::new(vec![Group::new(vec![0, 1], 0), Group::new(vec![2], 0)]); - let sizes = DockSizes { column_cards: true, ..DockSizes::of_scope(ui) }; - let inset = sizes.card_inset(at); + let sizes = DockSizes { column_cards: ColumnCards::All, ..DockSizes::of_scope(ui) }; + let inset = sizes.card_inset(at, &column, &spec); let room = Flow::new(ui.available_rect_before_wrap(), Env::of(ui).direction.is_rtl()).span(0.0, CARD_WIDTH + inset); let rect = room.with_max_y(room.top() + 2.0 * CARD_HEIGHT); let shown = DockColumn::new("Panels", global("dock column", "panel card story"), &column, &spec); - let shown = match sizes.card_place(at) { + let shown = match sizes.card_place(at, &column, &spec) { Some(place) => shown.card(place), None => shown, }; diff --git a/crates/ui-panels/src/docking/iconic/stories.rs b/crates/ui-panels/src/docking/iconic/stories.rs index 5b8330b325..505953509a 100644 --- a/crates/ui-panels/src/docking/iconic/stories.rs +++ b/crates/ui-panels/src/docking/iconic/stories.rs @@ -4,7 +4,7 @@ use super::CELL; use crate::buttons::Button; use crate::contract::ShowContainer as _; use crate::contract::{Bind, BodyCx, Show as _, Validity}; -use crate::docking::{ColumnBar, DockSizes, GroupAt, IconGroupSeparator, IconicColumn, IconicColumnOutput, IconicMode, PanelSpec}; +use crate::docking::{ColumnBar, ColumnCards, DockSizes, GroupAt, IconGroupSeparator, IconicColumn, IconicColumnOutput, IconicMode, PanelSpec}; use crate::runtime::commands::{CommandState, CommandStates}; use crate::runtime::env::{Env, Message, with_env}; use crate::sections::Panel; @@ -97,11 +97,12 @@ fn icon_groups(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { #[story(IconicColumn<'static, u8>, covers = [], drive = Drive::Never)] fn icons_as_a_card(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let at = *data.choice("place", 1_usize, &[("At the window edge", 0), ("Inward of another column", 1)]); - let sizes = DockSizes { column_cards: true, ..DockSizes::of_scope(ui) }; - let inset = sizes.card_inset(at); + let sizes = DockSizes { column_cards: ColumnCards::All, ..DockSizes::of_scope(ui) }; let column = Column::new(vec![Group::new(vec![0, 1], 0), Group::new(vec![2], 0)]); + let inset = sizes.card_inset(at, &column, &spec); + let card = sizes.card_place(at, &column, &spec); let column = IconicColumn::new("Panels", global("iconic column", "card story"), &column, Bind::kept(), &spec); - let column = match sizes.card_place(at) { + let column = match card { Some(place) => column.card(place), None => column, }; diff --git a/crates/ui-panels/src/docking/mod.rs b/crates/ui-panels/src/docking/mod.rs index 76af4b07fb..cf6341c92c 100644 --- a/crates/ui-panels/src/docking/mod.rs +++ b/crates/ui-panels/src/docking/mod.rs @@ -47,7 +47,7 @@ pub use root::{DockRoot, DockRootOutput, DockRootStyle}; pub use sources::{DividerKind, DockSource, SourceKind}; pub use spec::{DockGrid, DockHeights, PanelDocument, PanelSpec}; pub use splitter::{Splitter, SplitterStyle}; -pub use targets::{CardInset, DockSizes, DockSpot, DockTargets, GroupDrag, ZoneRule}; +pub use targets::{CardInset, ColumnCards, DockSizes, DockSpot, DockTargets, GroupDrag, ZoneRule}; pub use words::DockWords; pub use commands::{ diff --git a/crates/ui-panels/src/docking/targets.rs b/crates/ui-panels/src/docking/targets.rs index ab1453b0fa..c45fd00995 100644 --- a/crates/ui-panels/src/docking/targets.rs +++ b/crates/ui-panels/src/docking/targets.rs @@ -92,16 +92,30 @@ pub struct DockSizes { /// The gutter between two neighbouring cards of a dock, on the outer side of each card past the window edge's: /// `space.gap.tight`. pub card_gutter: f32, - /// Whether the dock shows its docked columns as cards - /// ([`DockConfig::column_cards`](super::DockConfig::column_cards)): off in the style, set by the dock that shows + /// Which docked columns the dock shows as cards + /// ([`DockConfig::column_cards`](super::DockConfig::column_cards)): none in the style, set by the dock that shows /// them. - pub column_cards: bool, + pub column_cards: ColumnCards, /// The height of a grip strip, the band with the dock's grip marks: above each icon group of a collapsed column, /// and under the column bar of a tool rail (a group whose panel has a [`DockGrid`](super::DockGrid)) that the host /// shows itself: the least hit size, or the theme's grip marks with `space.gap.tight` above and below them. pub grip: f32, } +/// Which docked columns a dock shows as cards ([`DockConfig::column_cards`](super::DockConfig::column_cards)). +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] +#[non_exhaustive] +pub enum ColumnCards { + /// None: every column fills its cell. + #[default] + None, + /// Every docked column, expanded or collapsed to icons. + All, + /// Only the stepped columns, such as a docked tool rail ([`DockSizes::stepped`]); the panel columns stand flush: + /// VectorCraft 0.24's dock. + Stepped, +} + /// Which inset a docked column's card takes on its outer side ([`DockSizes::card_place`]). #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[non_exhaustive] @@ -163,7 +177,7 @@ impl DockSizes { dense_rail_step, card: cx.tokens.space.gap.stack, card_gutter: cx.tokens.space.gap.tight, - column_cards: false, + column_cards: ColumnCards::None, grip: super::group::grip_strip(cx.tokens), } } @@ -211,23 +225,24 @@ impl DockSizes { column.width.unwrap_or(self.column).clamp(lo, hi) } - /// The inset on the outer side of the card of a dock's docked column `at` from the window edge inwards: none - /// without [`column_cards`](Self::column_cards); [`card`](Self::card) for the first column, at the window edge; - /// [`card_gutter`](Self::card_gutter) for the others, which stand that far from their outer neighbour's card. A - /// docked column is that much wider than its content. - pub fn card_inset(&self, at: usize) -> f32 { - self.card_place(at).map_or(0.0, |place| self.inset(place)) + /// The inset on the outer side of the card of `column`, a dock's docked column `at` from the window edge inwards: + /// none for a column [`column_cards`](Self::column_cards) shows as no card; [`card`](Self::card) for the first + /// column, at the window edge; [`card_gutter`](Self::card_gutter) for the others, which stand that far from their + /// outer neighbour. A docked column is that much wider than its content. + pub fn card_inset

(&self, at: usize, column: &Column

, spec: &dyn Fn(&P) -> PanelSpec) -> f32 { + self.card_place(at, column, spec).map_or(0.0, |place| self.inset(place)) } - /// Which inset the card of a dock's docked column `at` from the window edge inwards takes on its outer side: none - /// without [`column_cards`](Self::column_cards); [`CardInset::Edge`] for the first column, [`CardInset::Gutter`] - /// for the others. - pub fn card_place(&self, at: usize) -> Option { - match (self.column_cards, at) { - (false, _) => None, - (true, 0) => Some(CardInset::Edge), - (true, _) => Some(CardInset::Gutter), - } + /// Which inset the card of `column`, a dock's docked column `at` from the window edge inwards, takes on its outer + /// side: none for a column [`column_cards`](Self::column_cards) shows as no card; [`CardInset::Edge`] for the + /// first column, [`CardInset::Gutter`] for the others. + pub fn card_place

(&self, at: usize, column: &Column

, spec: &dyn Fn(&P) -> PanelSpec) -> Option { + let card = match self.column_cards { + ColumnCards::None => false, + ColumnCards::All => true, + ColumnCards::Stepped => !column.iconic && self.stepped(column, spec).is_some(), + }; + card.then_some(if at == 0 { CardInset::Edge } else { CardInset::Gutter }) } /// The inset on the outer side of a card at `place`: [`card`](Self::card) or [`card_gutter`](Self::card_gutter). @@ -293,7 +308,7 @@ impl DockSizes { .iter() .enumerate() .map(|(at, column)| { - let (width, inset) = (self.width(column, spec), self.card_inset(at)); + let (width, inset) = (self.width(column, spec), self.card_inset(at, column, spec)); let (lo, hi) = if fixed(column) { (width, width) } else { self.shown_bounds(column, spec) }; (width + inset, (lo + inset, hi + inset)) }) @@ -305,7 +320,7 @@ impl DockSizes { .zip(current.iter().zip(widths)) .filter(|((_, column), ((width, _), scaled))| !fixed(column) && (scaled - width).abs() >= 0.01) .filter_map(|((at, column), (_, width))| { - let width = width - self.card_inset(at); + let width = width - self.card_inset(at, column, spec); let panel = column.groups.iter().find_map(|group| group.panels.first())?.clone(); Some(if column.iconic { Action::resize_iconic(panel, Some(width)) } else { Action::resize_column(panel, width) }) }) @@ -321,7 +336,7 @@ impl DockSizes { .enumerate() .map(|(at, column)| { let keeps = column.iconic || self.stepped(column, spec).is_some(); - let inset = self.card_inset(at); + let inset = self.card_inset(at, column, spec); (self.width(column, spec) + inset, (!keeps).then(|| self.width_bounds(column, spec).0.max(1.0) + inset)) }) .collect() diff --git a/crates/ui-patterns/src/patterns/dock/area.rs b/crates/ui-patterns/src/patterns/dock/area.rs index 9d1ba96eba..1802f8b138 100644 --- a/crates/ui-patterns/src/patterns/dock/area.rs +++ b/crates/ui-patterns/src/patterns/dock/area.rs @@ -1433,7 +1433,7 @@ impl Pass<'_, P> { // (photocraft#16461). Content taller than the dock scrolls inside. Only a floating stepped window is as // tall as its content. self.report.placed.push((first.clone(), cell)); - let card = scene.sizes.card_place(at); + let card = scene.sizes.card_place(at, column, &|panel: &P| scene.spec(panel)); let at = ColumnAt { cell, edge: plan.edge, bar: ColumnBar::Own, within: body.rect, open: plan.open.clone(), card }; self.column(ui, body, column, at); } diff --git a/crates/ui-patterns/tests/it/docking/columns.rs b/crates/ui-patterns/tests/it/docking/columns.rs index 84605940a3..81e69f6271 100644 --- a/crates/ui-patterns/tests/it/docking/columns.rs +++ b/crates/ui-patterns/tests/it/docking/columns.rs @@ -6,7 +6,7 @@ use craft_theme::{AppSizes, SizeValue}; use craft_ui::contract::{Bind, BodyCx, PlainData, Role, Show as _, SizeLimits, Tracked}; use craft_ui::display::Text; use craft_ui::docking::{ - DockConfig, DockGrid, DockHeights, DockPanels, DockSizes, GroupAt, GroupSize, IconicMode, PanelSpec, PanelSpecs, group_heights, + ColumnCards, DockConfig, DockGrid, DockHeights, DockPanels, DockSizes, GroupAt, GroupSize, IconicMode, PanelSpec, PanelSpecs, group_heights, }; use craft_ui::patterns::dock::DockArea; use craft_ui::runtime::env::{Direction, RootEnv}; @@ -511,7 +511,7 @@ impl DockPanels for RailStage { /// A start dock in `direction` of a toolbar column of two rail steps, at the window edge, and a side column beside it, /// with `DockConfig::column_cards` set to `cards`: the toolbar's cell, the side column's cell and the rail's stage. -fn rail_dock(cards: bool, direction: Direction) -> (Rect, Rect, Rect) { +fn rail_dock(cards: ColumnCards, direction: Direction) -> (Rect, Rect, Rect) { let columns = vec![Column::new(vec![Group::new(vec![TOOLS], 0)]).with_steps(2), Column::new(vec![Group::new(vec![2], 0)]).with_width(150.0)]; let root = Node::split(Axis::X, SplitSize::FixedFirst(300.0), Node::dock(DockEdge::Start, columns), Node::tabs(vec![1], 0)); let workspace = Rc::new(RefCell::new(Arc::new(Workspace::new(Layout::new(Some(root), Vec::new()))))); @@ -538,8 +538,8 @@ fn rail_dock(cards: bool, direction: Direction) -> (Rect, Rect, Rect) { fn a_rail_card_is_inset_alike_on_three_sides_and_keeps_its_steps() { for direction in [Direction::Ltr, Direction::Rtl] { let rtl = direction == Direction::Rtl; - let (plain_cell, _, plain) = rail_dock(false, direction); - let (cell, side, card) = rail_dock(true, direction); + let (plain_cell, _, plain) = rail_dock(ColumnCards::None, direction); + let (cell, side, card) = rail_dock(ColumnCards::All, direction); let (outer, inner) = if rtl { (cell.right() - card.right(), card.left() - cell.left()) } else { (card.left() - cell.left(), cell.right() - card.right()) }; let top = (card.top() - cell.top()) - (plain.top() - plain_cell.top()); @@ -594,7 +594,7 @@ struct CardDock { /// An end dock in `direction` beside the canvas: an expanded column at the window edge and, inward of it, a column /// collapsed to icons, with `DockConfig::column_cards` set to `cards`. -fn card_dock(cards: bool, direction: Direction) -> CardDock { +fn card_dock(cards: ColumnCards, direction: Direction) -> CardDock { let mut iconic = Column::new(vec![Group::new(vec![ICONS], 0)]); iconic.iconic = true; let columns = vec![Column::new(vec![Group::new(vec![SIDE], 0)]).with_width(220.0), iconic]; @@ -630,8 +630,8 @@ fn sides(cell: Rect, inner: Rect, rtl: bool) -> (f32, f32) { fn every_docked_column_is_a_card_with_gutters_between_them() { for direction in [Direction::Ltr, Direction::Rtl] { let rtl = direction == Direction::Rtl; - let plain = card_dock(false, direction); - let cards = card_dock(true, direction); + let plain = card_dock(ColumnCards::None, direction); + let cards = card_dock(ColumnCards::All, direction); // Each inset is measured against the same column without cards, so a panel's own padding cancels out. let inset = |cell: Rect, inner: Rect, plain_cell: Rect, plain_inner: Rect| { let ((outer, inward), (plain_outer, plain_inward)) = (sides(cell, inner, rtl), sides(plain_cell, plain_inner, rtl)); @@ -689,3 +689,25 @@ fn a_columns_bar_is_as_high_as_its_token() { let low = body_top(Some(14.0)); assert!(low < built_in - 0.5, "a lower column bar raises the column's groups: {low} against {built_in}"); } + +/// `ColumnCards::Stepped` (VectorCraft's dock) shows the tool rail as the card `ColumnCards::All` shows, and the panel +/// column beside it flush, as wide as with no cards; neither overlaps the other. Right to left mirrors it. +#[trial] +fn only_the_tool_rail_is_a_card_with_stepped_cards() { + for direction in [Direction::Ltr, Direction::Rtl] { + let (_, plain_side, _) = rail_dock(ColumnCards::None, direction); + let (all_cell, _, all_stage) = rail_dock(ColumnCards::All, direction); + let (cell, side, stage) = rail_dock(ColumnCards::Stepped, direction); + assert!( + (stage.min - all_stage.min).length() <= 0.5 && (stage.size() - all_stage.size()).length() <= 0.5, + "{direction:?}: the rail's card {stage:?} is the one all cards give, {all_stage:?}" + ); + assert!((cell.width() - all_cell.width()).abs() <= 0.5, "{direction:?}: the toolbar {cell:?} is as wide as with all cards, {all_cell:?}"); + assert!( + (side.width() - plain_side.width()).abs() <= 0.5, + "{direction:?}: the panel column {side:?} is no card: as wide as {plain_side:?} without cards" + ); + let clear = if direction == Direction::Rtl { side.right() <= cell.left() + 0.5 } else { side.left() >= cell.right() - 0.5 }; + assert!(clear, "{direction:?}: the panel column {side:?} overlaps the toolbar {cell:?}"); + } +} From 5d74792c0af14f22151402647c1b38f6e4893447 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 25 Nov 2026 10:10:14 +0700 Subject: [PATCH 12/33] dock: DockConfig::flush_docks stands docks flush against the node beside them, with no gap (DockSizes::dock_gap, FrameRules::dock_gap), and frames their columns collapsed to icons in line.border as expanded columns are, so one rule parts a dock from the canvas; off by default, where the space.gap.tight gap stays --- crates/ui-panels/src/docking/config.rs | 14 +++++ crates/ui-panels/src/docking/iconic.rs | 8 +++ crates/ui-panels/src/docking/placed.rs | 5 +- crates/ui-panels/src/docking/targets.rs | 4 ++ crates/ui-panels/src/docking/tree.rs | 14 ++++- crates/ui-patterns/src/patterns/dock/area.rs | 10 +++- .../src/patterns/dock/area/stories.rs | 21 ++++++- .../ui-patterns/tests/it/docking/columns.rs | 55 +++++++++++++++++++ 8 files changed, 122 insertions(+), 9 deletions(-) diff --git a/crates/ui-panels/src/docking/config.rs b/crates/ui-panels/src/docking/config.rs index 18ce4d8b42..22309ca23f 100644 --- a/crates/ui-panels/src/docking/config.rs +++ b/crates/ui-panels/src/docking/config.rs @@ -89,6 +89,12 @@ pub struct DockConfig { /// width (a tool rail its steps); its dividers, drop bands and edge handle stay on its outer rect. Off: a column /// fills its cell. pub column_cards: ColumnCards, + /// Docks stand flush against the node beside them, with no gap, and their columns collapsed to icons show the + /// `line.border` frame expanded columns show, so one rule parts a dock from the canvas; the flyouts of those columns + /// stand square on the panel surface with that frame and no shadow ([`Flyout::docked`](super::Flyout::docked)): + /// VectorCraft 0.24's dock. + /// Off: a `space.gap.tight` gap of the window's background parts them. + pub flush_docks: bool, /// Shows a close button on the tabs of closable panels in docked and floating groups, where a middle click also /// closes them, for tabs that act as documents. Off: panels close from their menu. Accordion headers and iconic /// columns never show it. @@ -134,6 +140,7 @@ impl Default for DockConfig { floating_grip: false, floating_rounded_body: false, column_cards: ColumnCards::None, + flush_docks: false, tab_close_buttons: false, titled_headers: false, wheel_selects_tabs: false, @@ -267,6 +274,13 @@ impl DockConfig { self } + /// Flush docks on or off ([`flush_docks`](Self::flush_docks)). + #[must_use] + pub fn flush_docks(mut self, on: bool) -> Self { + self.flush_docks = on; + self + } + /// Close buttons on tabs on or off. #[must_use] pub fn tab_close_buttons(mut self, on: bool) -> Self { diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index 070779f3db..802aefd8f5 100644 --- a/crates/ui-panels/src/docking/iconic.rs +++ b/crates/ui-panels/src/docking/iconic.rs @@ -254,6 +254,10 @@ pub struct IconicColumn<'a, P: Value + Hash + 'static> { /// lies on the surface the groups' tab strips do. #[prop] tab_look: PanelTabLook, + /// The docked column shows the `line.border` frame an expanded docked column shows, and its flyouts stand as docked + /// columns do ([`Flyout::docked`], [`DockConfig::flush_docks`](super::DockConfig::flush_docks)). + #[prop] + framed: bool, open: Bind<'a, Option

>, view: Option>, /// The bar's rect this pass. @@ -317,6 +321,7 @@ impl<'a, P: Value + Hash + Debug + 'static> IconicColumn<'a, P> { within: Rect::NOTHING, card: None, tab_look: PanelTabLook::Plain, + framed: false, open, view: None, bar_rect: Rect::NOTHING, @@ -710,6 +715,9 @@ impl Component for IconicColumn<'_, P> { } } } + if self.framed { + ui.draw().surface(cx.rect, SurfaceKind::Frame, Corners::None); + } // The edge's line lies on the column's inner edge; its handle stays inside the column. A floating window's // edges are the window's. if self.bar == ColumnBar::Own { diff --git a/crates/ui-panels/src/docking/placed.rs b/crates/ui-panels/src/docking/placed.rs index c6f4968725..5347e3ba95 100644 --- a/crates/ui-panels/src/docking/placed.rs +++ b/crates/ui-panels/src/docking/placed.rs @@ -50,12 +50,13 @@ impl<'a, P> Placing<'a, P> { } /// Runs `f` with the rules a dock area lays its docked tree out by: each panel's limits from `spec`, a dock as wide as -/// its columns' natural widths ([`DockSizes::natural`]), and no strip on a canvas alone in its group. +/// its columns' natural widths ([`DockSizes::natural`]) and [`DockSizes::dock_gap`] from the node beside it, and no +/// strip on a canvas alone in its group. pub fn with_area_rules(sizes: &DockSizes, spec: &dyn Fn(&P) -> PanelSpec, f: impl FnOnce(FrameRules<'_, P>) -> R) -> R { let limits = |panel: &P| spec(panel).limits; let dock_width = |columns: &[Column

]| sizes.natural(columns, spec).iter().map(|(width, _)| *width).sum::(); let stripless = |panel: &P| spec(panel).canvas; - f(FrameRules::new(&limits).dock_width(&dock_width).stripless(&stripless)) + f(FrameRules::new(&limits).dock_width(&dock_width).stripless(&stripless).dock_gap(sizes.dock_gap)) } /// The rect the panels `moved` take in `layout`, the layout after a drop, laid out in `room` (the room the dock diff --git a/crates/ui-panels/src/docking/targets.rs b/crates/ui-panels/src/docking/targets.rs index c45fd00995..a652d86ddd 100644 --- a/crates/ui-panels/src/docking/targets.rs +++ b/crates/ui-panels/src/docking/targets.rs @@ -44,6 +44,9 @@ pub struct DockSizes { /// The divider between two docked groups or between a dock and its neighbour (the tight gap: the references' /// dock dividers are 3 px at 100%). pub gap: f32, + /// The room between a dock and the node beside it: [`gap`](Self::gap), or none in a flush dock + /// ([`DockConfig::flush_docks`](super::DockConfig::flush_docks)). + pub dock_gap: f32, /// How far a band (edge, seam, column edge, new dock) reaches into a tab strip from its drop line (the least hit /// size): the rest of the strip joins the group. pub strip_reach: f32, @@ -157,6 +160,7 @@ impl DockSizes { cascade_inset: size.window.cascade, float_size: Vec2::new(size.float.width, size.float.height), gap: cx.tokens.space.gap.tight, + dock_gap: cx.tokens.space.gap.tight, strip_reach: size.hit.target, least_pane: size.pane.least, strip: size.panel_header, diff --git a/crates/ui-panels/src/docking/tree.rs b/crates/ui-panels/src/docking/tree.rs index 3fe0f8ca80..6221a75f84 100644 --- a/crates/ui-panels/src/docking/tree.rs +++ b/crates/ui-panels/src/docking/tree.rs @@ -28,6 +28,7 @@ pub struct FrameRules<'a, P> { limits: &'a dyn Fn(&P) -> SizeLimits, dock_width: Option<&'a DockWidthFn<'a, P>>, stripless: Option<&'a dyn Fn(&P) -> bool>, + dock_gap: Option, } impl

Clone for FrameRules<'_, P> { @@ -42,7 +43,14 @@ impl<'a, P> FrameRules<'a, P> { /// Rules with the panels' `limits`. A dock is as wide as its columns' stored widths (the dock column width for /// a column without one) until a `dock_width` says otherwise, and every panel has a strip. pub fn new(limits: &'a dyn Fn(&P) -> SizeLimits) -> Self { - FrameRules { limits, dock_width: None, stripless: None } + FrameRules { limits, dock_width: None, stripless: None, dock_gap: None } + } + + /// The room between a dock and the node beside it, in place of the dividers' gap (`DockSizes::dock_gap`). + #[must_use] + pub fn dock_gap(mut self, gap: f32) -> Self { + self.dock_gap = Some(gap); + self } /// The width of a dock's columns, as dock columns are drawn. @@ -336,7 +344,7 @@ impl

Sizer<'_, '_, P> { } Node::Split { axis, first, second, .. } => { let (a, b) = (self.bounds(first), self.bounds(second)); - let gap = sizes.gap; + let gap = if *axis == Axis::X && (is_dock(first) || is_dock(second)) { self.rules.dock_gap.unwrap_or(sizes.gap) } else { sizes.gap }; let (min, max) = match axis { Axis::X => (vec2(a.min.x + b.min.x + gap, a.min.y.max(b.min.y)), vec2(a.max.x + b.max.x + gap, a.max.y.min(b.max.y))), _ => (vec2(a.min.x.max(b.min.x), a.min.y + b.min.y + gap), vec2(a.max.x.min(b.max.x), a.max.y + b.max.y + gap)), @@ -357,7 +365,7 @@ impl

Sizer<'_, '_, P> { /// The rects of a dock and of the node beside it in `rect`. fn dock_cells(&self, edge: DockEdge, columns: &[Column

], other: &Node

, rect: Rect) -> (Rect, Rect) { - let gap = self.sizes.gap; + let gap = self.rules.dock_gap.unwrap_or(self.sizes.gap); let room = (rect.width() - gap - self.bounds(other).min.x).clamp(0.0, rect.width()); let width = self.rules.dock_width_of(columns, self.sizes.column).clamp(0.0, room); match edge { diff --git a/crates/ui-patterns/src/patterns/dock/area.rs b/crates/ui-patterns/src/patterns/dock/area.rs index 1802f8b138..3734ecc754 100644 --- a/crates/ui-patterns/src/patterns/dock/area.rs +++ b/crates/ui-patterns/src/patterns/dock/area.rs @@ -315,9 +315,12 @@ impl Drops<'_, P> { } /// The sizes a dock area lays out with: the dock's style, with its docked columns as cards when `config` shows them -/// ([`DockConfig::column_cards`]). +/// ([`DockConfig::column_cards`]) and no gap beside a flush dock ([`DockConfig::flush_docks`]). fn area_sizes(mut sizes: DockSizes, config: &DockConfig) -> DockSizes { sizes.column_cards = config.column_cards; + if config.flush_docks { + sizes.dock_gap = 0.0; + } sizes } @@ -863,7 +866,7 @@ fn show_area( let limits = |panel: &P| scene.spec(panel).limits; let dock_width = |columns: &[Column

]| scene.natural(columns).iter().map(|(width, _)| *width).sum::(); let stripless = |panel: &P| scene.spec(panel).canvas; - let rules = FrameRules::new(&limits).dock_width(&dock_width).stripless(&stripless); + let rules = FrameRules::new(&limits).dock_width(&dock_width).stripless(&stripless).dock_gap(scene.sizes.dock_gap); let label = Label::from(body.words::().panels.as_str().to_owned()); let mut leaves: Vec<(Vec, Rect)> = Vec::new(); let area = SplitArea::new(label, Bind::given(layout.clone()), rules).show(ui, |ui, split| { @@ -1548,7 +1551,8 @@ impl Pass<'_, P> { .within(within) .auto_collapse(scene.auto_collapse) .mode(mode) - .tab_look(scene.config.tab_look); + .tab_look(scene.config.tab_look) + .framed(scene.config.flush_docks && !in_window); let shown = match card { Some(place) => shown.card(place), None => shown, diff --git a/crates/ui-patterns/src/patterns/dock/area/stories.rs b/crates/ui-patterns/src/patterns/dock/area/stories.rs index 9513ad85ac..1a7d79c430 100644 --- a/crates/ui-patterns/src/patterns/dock/area/stories.rs +++ b/crates/ui-patterns/src/patterns/dock/area/stories.rs @@ -5,9 +5,10 @@ use crate::buttons::IconButton; use crate::contract::SizeLimits; use crate::contract::{BodyCx, Props as _, Show as _, Tracked}; use crate::display::Text; -use crate::docking::{DockConfig, DockGrid, DockPanels, GroupAt, IconicMode, PanelSpec, PanelSpecs}; +use crate::docking::{ColumnCards, DockConfig, DockGrid, DockPanels, GroupAt, IconicMode, PanelSpec, PanelSpecs}; use crate::menu::PanelRow; use crate::patterns::presets::{PresetPanelMenu, PresetView}; +use crate::tabs::PanelTabLook; use crate::testing::{Drive, StoryData, StoryOutput, story}; use craft_behavior::dock::{Column, DockEdge, Floating, Group, Layout, Node, Permissions, SplitSize, Workspace}; use craft_behavior::{Axis, IconId, Proposal}; @@ -169,3 +170,21 @@ fn rail_with_fixed_controls(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let config = DockConfig::default().iconic_mode(IconicMode::Rail); DockArea::new("Rail dock", workspace_at.bind(&mut *workspace), &*SPECS, &mut demo, config).rail_footer(LAYERS).show(ui).into() } + +/// VectorCraft 0.24's dock frame: only the stepped tool column is a card (`ColumnCards::Stepped`); the docks stand flush +/// against the canvas, the column of icons framed as the panel column is (`DockConfig::flush_docks`); the panel tabs and +/// the column bars in the block look (`PanelTabLook::Block`). +#[story(DockArea<'static, usize>, covers = [Default], drive = Drive::Never)] +fn a_tool_card_beside_flush_panels(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let (workspace, workspace_at) = data.value_at("stepped cards workspace", { + let tools = Column::new(vec![Group::new(vec![TOOLS], 0)]).with_steps(1); + let side = Column::new(vec![Group::new(vec![PROPERTIES, LAYERS], 0), Group::new(vec![HISTORY], 0)]); + let icons = Column::new(vec![Group::new(vec![SWATCHES], 0), Group::new(vec![NAVIGATOR], 0)]).with_iconic(true); + let docked = Node::split(Axis::X, SplitSize::Ratio(0.6), Node::tabs(vec![CANVAS], 0), Node::dock(DockEdge::End, vec![side, icons])); + let root = Node::split(Axis::X, SplitSize::FixedFirst(60.0), Node::dock(DockEdge::Start, vec![tools]), docked); + Arc::new(Workspace::new(Layout::new(Some(root), Vec::new()))) + }); + let mut demo = Demo { canvas_view: false, host_rows: false }; + let config = DockConfig::default().column_cards(ColumnCards::Stepped).flush_docks(true).tab_look(PanelTabLook::Block); + DockArea::new("Stepped cards dock", workspace_at.bind(&mut *workspace), &*SPECS, &mut demo, config).show(ui).into() +} diff --git a/crates/ui-patterns/tests/it/docking/columns.rs b/crates/ui-patterns/tests/it/docking/columns.rs index 81e69f6271..f955893300 100644 --- a/crates/ui-patterns/tests/it/docking/columns.rs +++ b/crates/ui-patterns/tests/it/docking/columns.rs @@ -711,3 +711,58 @@ fn only_the_tool_rail_is_a_card_with_stepped_cards() { assert!(clear, "{direction:?}: the panel column {side:?} overlaps the toolbar {cell:?}"); } } + +/// Panels that record the rect of the canvas's group (panel 1), which they draw themselves. +struct CanvasStage(Rc>>); + +impl DockPanels for CanvasStage { + fn body(&mut self, _: &u32, _: &mut Ui, _: &mut BodyCx<'_>) {} + + fn group_view(&mut self, panels: &[u32], _: usize, _: &mut Ui, at: GroupAt, _: &mut BodyCx<'_>) -> Option { + if !panels.contains(&1) { + return None; + } + Some(match at { + GroupAt::Measure(_) => 0.0, + GroupAt::Show(rect) => { + self.0.set(Some(rect)); + rect.height() + } + }) + } +} + +/// The room between the canvas and the end dock of the card dock's columns, with `DockConfig::flush_docks` set to +/// `flush`. +fn canvas_to_dock(flush: bool, direction: Direction) -> f32 { + let mut iconic = Column::new(vec![Group::new(vec![ICONS], 0)]); + iconic.iconic = true; + let columns = vec![Column::new(vec![Group::new(vec![SIDE], 0)]).with_width(220.0), iconic]; + let root = Node::split(Axis::X, SplitSize::Ratio(0.6), Node::tabs(vec![1], 0), Node::dock(DockEdge::End, columns)); + let workspace = Rc::new(RefCell::new(Arc::new(Workspace::new(Layout::new(Some(root), Vec::new()))))); + let placed: Rc>> = Rc::default(); + let canvas: Rc>> = Rc::default(); + let (held, seen, shown, specs) = (Rc::clone(&workspace), Rc::clone(&placed), Rc::clone(&canvas), Tracked::new(CardPanels)); + let mut fixture = Fixture::new(move |ui| { + let mut workspace = held.borrow().clone(); + let config = DockConfig::default().flush_docks(flush); + let out = DockArea::new("Flush dock", Bind::bound(&mut workspace), &specs, &mut CanvasStage(Rc::clone(&shown)), config).show(ui); + *held.borrow_mut() = workspace; + *seen.borrow_mut() = out.columns; + }); + fixture.direction(direction).room(Vec2::new(900.0, 500.0)).settle(); + let icons = placed.borrow().iter().find(|(at, _)| *at == ICONS).map(|(_, rect)| *rect).expect("the icons' column shows"); + let canvas = canvas.get().expect("the canvas shows"); + if direction == Direction::Rtl { canvas.left() - icons.right() } else { icons.left() - canvas.right() } +} + +/// A flush dock (`DockConfig::flush_docks`, VectorCraft's) meets the canvas with no gap and without overlapping it; by +/// default a gap parts them. Right to left mirrors it. +#[trial] +fn a_flush_dock_meets_the_canvas() { + for direction in [Direction::Ltr, Direction::Rtl] { + let (gap, flush) = (canvas_to_dock(false, direction), canvas_to_dock(true, direction)); + assert!(gap > 0.5, "{direction:?}: a gap {gap} parts the canvas from the dock by default"); + assert!(flush.abs() <= 0.5, "{direction:?}: the flush dock stands {flush} from the canvas"); + } +} From 9f1b8d6d20a7226c92ecd69ab8ec0f4facb2bb00 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 25 Nov 2026 10:10:33 +0700 Subject: [PATCH 13/33] dock: Flyout::docked stands a flyout as a docked column does, square on surface.panel with the column's line.border frame and no shadow; the flyouts of a flush dock's columns (DockConfig::flush_docks) take it, the others stay raised popups --- crates/ui-panels/src/docking/flyout.rs | 27 ++++++++++-- crates/ui-panels/src/docking/iconic.rs | 2 +- crates/ui-panels/src/docking/iconic/trials.rs | 44 +++++++++++++++++++ 3 files changed, 69 insertions(+), 4 deletions(-) diff --git a/crates/ui-panels/src/docking/flyout.rs b/crates/ui-panels/src/docking/flyout.rs index 645360fbc5..af380bbe65 100644 --- a/crates/ui-panels/src/docking/flyout.rs +++ b/crates/ui-panels/src/docking/flyout.rs @@ -2,9 +2,10 @@ use crate::contract::overlay::{Anchor, Dismiss, FloatPlace, Outside, Place, PlacementChange, ResizeEdges}; use crate::contract::{ - BodyCx, Common, Component, Container, ContainerProps, Cx, Mount, NoValue, Outcome, Overlay, OverlayUi, Pad, PopupHandle, Role, SizeLimits, Sizing, + BodyCx, Common, Component, Container, ContainerProps, Cx, Mount, NoValue, Outcome, Overlay, OverlayUi, Pad, PaintUi, PopupHandle, Role, + SizeLimits, Sizing, }; -use crate::style::{ComponentStyle, StyleCx, SurfaceKind}; +use crate::style::{ComponentStyle, Corners, StyleCx, SurfaceKind}; use craft_behavior::overlay::Side; use craft_behavior::{Metrics, Sense}; use egui::{Pos2, Rect, Response, Ui, Vec2}; @@ -72,6 +73,8 @@ pub struct Flyout { /// The least size a resize leaves the flyout. #[prop(quantity = "least room a resize leaves, from the dock's measured sizes, in points")] least: Vec2, + /// The flyout stands as a docked column does: [`docked`](Flyout::docked). + docked: bool, placed: Option, } @@ -80,7 +83,19 @@ impl Flyout { /// `Side::End`), closing on a press outside it and when the focus leaves it if `auto_collapse`. pub fn new(opens: Side, size: Vec2, auto_collapse: bool) -> Self { let props = ContainerProps::new().surface(SurfaceKind::Popup).pad(Pad::None).sizing(Sizing::Content); - Flyout { common: Common::new(), props, opens, size, auto_collapse, within: Rect::EVERYTHING, least: Vec2::ZERO, placed: None } + Flyout { common: Common::new(), props, opens, size, auto_collapse, within: Rect::EVERYTHING, least: Vec2::ZERO, docked: false, placed: None } + } + + /// The flyout stands as a docked column does, in place of a popup's raised surface: square on `surface.panel`, with + /// the column's `line.border` frame and no shadow (the flyouts of a flush dock's columns, + /// [`DockConfig::flush_docks`](super::DockConfig::flush_docks)). + #[must_use] + pub fn docked(mut self, on: bool) -> Self { + if on { + self.props = self.props.surface(SurfaceKind::Panel); + } + self.docked = on; + self } /// The layer the flyout shows in, its top left at `top_left`: placed by the caller, resizable on every edge but @@ -155,6 +170,12 @@ impl Component for Flyout { Sense::empty() } + fn paint_over(&mut self, ui: &mut PaintUi<'_>, cx: &Cx<'_, Self>) { + if self.docked { + ui.draw().surface(cx.rect, SurfaceKind::Frame, Corners::None); + } + } + fn finish(self, cx: Cx<'_, Self>) -> FlyoutOutput { FlyoutOutput { response: cx.response.clone(), placed: self.placed } } diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index 802aefd8f5..86845fa6ea 100644 --- a/crates/ui-panels/src/docking/iconic.rs +++ b/crates/ui-panels/src/docking/iconic.rs @@ -772,7 +772,7 @@ impl Component for IconicColumn<'_, P> { let mut resized = None; for (at, plan) in plans.into_iter().enumerate() { let Some(FlyoutPlan { group, top_left, size, fixed, icons_top }) = plan else { continue }; - let shown = Flyout::new(opens, size, auto_collapse).within(bounds).least(least).show_popup( + let shown = Flyout::new(opens, size, auto_collapse).within(bounds).least(least).docked(self.framed).show_popup( ui, popup.at(at), Anchor::Point(top_left), diff --git a/crates/ui-panels/src/docking/iconic/trials.rs b/crates/ui-panels/src/docking/iconic/trials.rs index ce509305da..35cec1d12d 100644 --- a/crates/ui-panels/src/docking/iconic/trials.rs +++ b/crates/ui-panels/src/docking/iconic/trials.rs @@ -727,3 +727,47 @@ fn icon_groups_apart_by_a_rule_show_one_level_rule_between_them() { fixture.release_at(icon.center() + Vec2::new(RAIL * 2.0, 0.0)).settle(); } } + +/// The surface shapes painted around the open flyout of a column that is `framed` (a flush dock's): the rects whose +/// rect holds the flyout's body. +fn flyout_surfaces(framed: bool) -> Vec { + let shown: Rc>> = Rc::default(); + let seen = Rc::clone(&shown); + let mut fixture = Fixture::new(move |ui| { + let column = Column::new(vec![Group::new(vec![0, 1], 0)]); + let mut open = Some(0_u8); + IconicColumn::new("Panels", global("iconic column", "docked flyout"), &column, Bind::bound(&mut open), &spec).framed(framed).show_flyouts( + ui, + |_, at, ui, _| { + let GroupAt::Show(rect) = at else { return None }; + seen.set(Some(rect)); + Panel::new("Flyout").show_at(ui, rect, |_, _| ()); + None + }, + ); + }); + fixture.room(Vec2::new(RAIL, 300.0)).settle(); + let body = shown.get().expect("the flyout shows"); + fixture + .frame_shapes() + .into_iter() + .filter_map(|shape| match shape { + egui::Shape::Rect(rect) if rect.rect.expand(EPS).contains_rect(body) && rect.rect.width() < body.width() + RAIL => Some(rect), + _ => None, + }) + .collect() +} + +/// The flyout of a flush dock's column (`DockConfig::flush_docks`, VectorCraft's) stands as a docked column does: +/// square, with no shadow; a column of another dock opens a raised popup with rounded corners. +#[trial] +fn a_flush_docks_flyout_stands_square_with_no_shadow() { + let raised = flyout_surfaces(false); + assert!(raised.iter().any(|rect| rect.corner_radius != egui::CornerRadius::ZERO), "the popup flyout is rounded: {raised:?}"); + let docked = flyout_surfaces(true); + assert!(!docked.is_empty(), "the docked flyout paints its surface"); + for rect in &docked { + assert_eq!(rect.corner_radius, egui::CornerRadius::ZERO, "the docked flyout's surface is square: {rect:?}"); + assert!(rect.blur_width <= 0.0, "the docked flyout casts no shadow: {rect:?}"); + } +} From cadd08b988bf10dbba307a39226216d26efbde43 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 25 Nov 2026 10:10:39 +0700 Subject: [PATCH 14/33] buttons, dock: ActiveLook::Control shows an icon button or segment that is on in surface.control with no edge and the normal text; beside PanelTabLook::Block tabs a collapsed column's open panel icon takes it, as the shown tab does, and its flyouts' groups keep the active look around the column --- crates/ui-panels/src/docking/iconic.rs | 46 +++++++++++++++---- .../ui-panels/src/docking/iconic/stories.rs | 20 ++++++++ crates/ui-panels/src/docking/iconic/trials.rs | 36 +++++++++++++++ crates/ui-widgets/src/buttons/face.rs | 10 ++-- crates/ui-widgets/src/buttons/mod.rs | 3 ++ crates/ui-widgets/src/choice/segmented.rs | 3 +- 6 files changed, 104 insertions(+), 14 deletions(-) diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index 86845fa6ea..5a4d789298 100644 --- a/crates/ui-panels/src/docking/iconic.rs +++ b/crates/ui-panels/src/docking/iconic.rs @@ -7,7 +7,7 @@ use super::dock_column::{ }; use super::group::{GripMarks, strip_surface}; use super::{CardInset, DockSizes, DockSpot, DockTargets, DockWords, DragUnit, Flyout, GroupAt, PanelKey, PanelSpec, Splitter, start_icon_drag}; -use crate::buttons::IconButton; +use crate::buttons::{ActiveLook, IconButton}; use crate::contract::overlay::Anchor; use crate::contract::{ Access, Bind, BindMut, BodyCx, Common, Component, Container, ContainerProps, Cx, Edit as _, EditResponse, HeaderEdge, HeaderParts, HeaderRegion, @@ -16,7 +16,7 @@ use crate::contract::{ }; use crate::menu::GroupItem; use crate::primitives::{IconSpec, TextRun}; -use crate::runtime::env::{EnvValue, Label}; +use crate::runtime::env::{Env, EnvValue, Label, with_env}; use crate::runtime::focus::KeyUse; use crate::style::{ComponentStyle, Corners, GlyphRole, RuleKind, StyleColor, StyleCx, SurfaceKind, SurfaceStyle}; use crate::tabs::PanelTabLook; @@ -340,25 +340,55 @@ impl<'a, P: Value + Hash + Debug + 'static> IconicColumn<'a, P> { /// Shows the column; `view` measures the group of an open flyout at the width it gets and returns its height /// (`None` takes the flyout's least height), then shows it in the rect it gets. pub fn show_flyouts( - mut self, + self, ui: &mut Ui, view: impl FnMut(&Group

, GroupAt, &mut Ui, &mut BodyCx<'_>) -> Option + 'a, ) -> IconicColumnOutput

{ - self.view = Some(Box::new(view)); - self.show(ui, |_, _| ()).output + self.in_look(ui, view, |column, ui| column.show(ui, |_, _| ()).output) } /// Shows the column at `rect` with no allocation, so its paint is clipped by the dock and not by a region of its /// own: the accent line of its edge reaches into the gutter beside it. #[doc(hidden)] pub fn show_flyouts_at( - mut self, + self, ui: &mut Ui, rect: Rect, view: impl FnMut(&Group

, GroupAt, &mut Ui, &mut BodyCx<'_>) -> Option + 'a, ) -> IconicColumnOutput

{ - self.view = Some(Box::new(view)); - self.show_at(ui, rect, |_, _| ()).output + self.in_look(ui, view, |column, ui| column.show_at(ui, rect, |_, _| ()).output) + } + + /// Shows the column through `show` with its flyouts' `view`. Beside [`PanelTabLook::Block`] tabs the open panel's + /// icon shows on `surface.control`, as the shown tab does ([`ActiveLook::Control`]); the flyouts' groups keep the + /// active look around the column. + fn in_look( + mut self, + ui: &mut Ui, + mut view: impl FnMut(&Group

, GroupAt, &mut Ui, &mut BodyCx<'_>) -> Option + 'a, + show: impl FnOnce(Self, &mut Ui) -> IconicColumnOutput

, + ) -> IconicColumnOutput

{ + if self.tab_look != PanelTabLook::Block { + self.view = Some(Box::new(view)); + return show(self, ui); + } + let outer = Env::of(ui).get::(); + self.view = Some(Box::new(move |group, at, ui, body| { + with_env( + ui, + |overrides| { + overrides.values.set(outer); + }, + |ui| view(group, at, ui, body), + ) + })); + with_env( + ui, + |overrides| { + overrides.values.set(ActiveLook::Control); + }, + |ui| show(self, ui), + ) } /// Whether the column is a rail beside its expanded column: its chevron collapses the column. diff --git a/crates/ui-panels/src/docking/iconic/stories.rs b/crates/ui-panels/src/docking/iconic/stories.rs index 505953509a..6b085de17c 100644 --- a/crates/ui-panels/src/docking/iconic/stories.rs +++ b/crates/ui-panels/src/docking/iconic/stories.rs @@ -8,6 +8,7 @@ use crate::docking::{ColumnBar, ColumnCards, DockSizes, GroupAt, IconGroupSepara use crate::runtime::commands::{CommandState, CommandStates}; use crate::runtime::env::{Env, Message, with_env}; use crate::sections::Panel; +use crate::tabs::PanelTabLook; use crate::testing::memory::global; use crate::testing::{Drive, Fixture, StoryData, StoryOutput, stage, story}; use craft_behavior::Mixed; @@ -233,3 +234,22 @@ fn a_flyout_of_a_panel_not_in_the_column(ui: &mut Ui, data: &mut StoryData) -> S }; flyout_of(ui, open_at.bind(open).check(in_column)) } + +/// A column of VectorCraft 0.24's dock (`DockConfig::flush_docks`, `PanelTabLook::Block`): framed in `line.border`, its +/// bar on `surface.canvas`, the open panel's icon on `surface.control`, and its flyout square on the panel surface with +/// the same frame and no shadow. The flyout opens from its icon. +#[story(IconicColumn<'static, u8>, covers = [], drive = Drive::Custom(open_first_flyout), title = "A flush dock's column and its flyout")] +fn a_flush_docks_column_and_its_flyout(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let (open, open_at) = data.value_at("open", None::); + let column = Column::new(vec![Group::new(vec![0, 1], 0), Group::new(vec![2], 0)]); + let column = IconicColumn::new("Panels", global("iconic column", "flush story"), &column, open_at.bind(open), &spec) + .framed(true) + .tab_look(PanelTabLook::Block); + at_stage(ui, column, |group, at, ui, _| { + let GroupAt::Show(rect) = at else { return None }; + let title = group.active_panel().map_or_else(String::new, |panel| spec(panel).label.as_str().to_owned()); + Panel::new(title).titled().show_at(ui, rect, |_, _| ()); + None + }) + .into() +} diff --git a/crates/ui-panels/src/docking/iconic/trials.rs b/crates/ui-panels/src/docking/iconic/trials.rs index 35cec1d12d..095fed7939 100644 --- a/crates/ui-panels/src/docking/iconic/trials.rs +++ b/crates/ui-panels/src/docking/iconic/trials.rs @@ -18,6 +18,7 @@ use crate::runtime::focus::{FocusTarget, request}; use crate::runtime::frame::take_output; use crate::sections::Panel; use crate::style::StyleCx; +use crate::tabs::PanelTabLook; use crate::testing::memory::global; use crate::testing::relations::{equals_token, grows_with}; use crate::testing::{Fixture, trial}; @@ -771,3 +772,38 @@ fn a_flush_docks_flyout_stands_square_with_no_shadow() { assert!(rect.blur_width <= 0.0, "the docked flyout casts no shadow: {rect:?}"); } } + +/// The fills painted on the open panel's icon of a column beside tabs in `look`, with the colour of `surface.control`. +fn open_icon_fills(look: PanelTabLook) -> (Vec, egui::Color32) { + let mut fixture = Fixture::hosted(move |ui| { + let column = Column::new(vec![Group::new(vec![0, 1], 0)]); + let mut open = Some(0_u8); + let output = IconicColumn::new("Panels", global("iconic column", "open icon"), &column, Bind::bound(&mut open), &spec) + .tab_look(look) + .show_flyouts_at(ui, Rect::from_min_size(Pos2::ZERO, Vec2::new(RAIL, 300.0)), |_, _, _, _| None); + Some(output.into()) + }); + fixture.room(SCREEN).settle(); + let id = fixture.root_id().expect("the column shows"); + let cell = fixture.part_rect(id, CELL.at(0)).expect("the open panel's icon"); + let control = StyleCx::with_root(fixture.ctx(), |cx| cx.tokens.color.surface.control).0; + let fills = fixture + .frame_shapes() + .into_iter() + .filter_map(|shape| match shape { + egui::Shape::Rect(rect) if cell.expand(EPS).contains_rect(rect.rect) && rect.fill != egui::Color32::TRANSPARENT => Some(rect.fill), + _ => None, + }) + .collect(); + (fills, egui::Color32::from_rgba_unmultiplied(control[0], control[1], control[2], control[3])) +} + +/// Beside block tabs (`PanelTabLook::Block`, VectorCraft's) the open panel's icon shows on `surface.control`, as the +/// shown tab does; beside the other looks it keeps the accent's on look. +#[trial] +fn beside_block_tabs_the_open_icon_shows_on_the_control_surface() { + let (block, control) = open_icon_fills(PanelTabLook::Block); + assert!(block.contains(&control), "the open icon shows surface.control {control:?}: {block:?}"); + let (plain, _) = open_icon_fills(PanelTabLook::Plain); + assert!(!plain.is_empty() && !plain.contains(&control), "beside plain tabs the open icon keeps its own fill: {plain:?}"); +} diff --git a/crates/ui-widgets/src/buttons/face.rs b/crates/ui-widgets/src/buttons/face.rs index dd44510519..d1070aa957 100644 --- a/crates/ui-widgets/src/buttons/face.rs +++ b/crates/ui-widgets/src/buttons/face.rs @@ -398,7 +398,8 @@ pub(crate) struct IconFace { pub(crate) fn icon_face(cx: &StyleCx<'_>) -> IconFace { let on = match cx.env::() { ActiveLook::Accent => on_parts(cx), - ActiveLook::Pressed => pressed_parts(cx), + ActiveLook::Pressed => filled_parts(cx, cx.tokens.color.state.pressed), + ActiveLook::Control => filled_parts(cx, cx.tokens.color.surface.control), }; let off = cx.variant_look(); let (icon, text) = (&cx.tokens.size.icon, &cx.tokens.color.text); @@ -430,11 +431,10 @@ pub(super) fn on_parts(cx: &StyleCx<'_>) -> VariantParts { VariantParts { fill: Stateful::new(fill), text: Stateful::new(ink).off(States::new(ink, ink, ink, soft.text.off.disabled)), ..soft } } -/// The on look under `ActiveLook::Pressed`: the pressed state's fill with no edge, the normal text colour. -fn pressed_parts(cx: &StyleCx<'_>) -> VariantParts { +/// The on look under `ActiveLook::Pressed` and `ActiveLook::Control`: `fill` with no edge, the normal text colour. +fn filled_parts(cx: &StyleCx<'_>, fill: craft_theme::Rgba) -> VariantParts { let soft = on_parts(cx); - let colors = &cx.tokens.color; - let (fill, ink) = (cx.color(colors.state.pressed), cx.color(colors.text.normal)); + let (fill, ink) = (cx.color(fill), cx.color(cx.tokens.color.text.normal)); VariantParts { fill: Stateful::new(fill), text: Stateful::new(ink).off(States::new(ink, ink, ink, soft.text.off.disabled)), edge: None, ..soft } } diff --git a/crates/ui-widgets/src/buttons/mod.rs b/crates/ui-widgets/src/buttons/mod.rs index 9761333b13..165a37d7d2 100644 --- a/crates/ui-widgets/src/buttons/mod.rs +++ b/crates/ui-widgets/src/buttons/mod.rs @@ -80,6 +80,9 @@ pub enum ActiveLook { Accent, /// The pressed state's fill with no edge, and the glyph in the normal text colour. Pressed, + /// The `surface.control` fill with no edge, and the glyph in the normal text colour: the open panel's icon of a + /// dock in VectorCraft 0.24's block look (`PanelTabLook::Block`). + Control, } /// The look of a push or split button that asks for no variant. An app sets it once at its root (`RootEnv::values`); diff --git a/crates/ui-widgets/src/choice/segmented.rs b/crates/ui-widgets/src/choice/segmented.rs index 108db79d14..7cd4670485 100644 --- a/crates/ui-widgets/src/choice/segmented.rs +++ b/crates/ui-widgets/src/choice/segmented.rs @@ -215,10 +215,11 @@ impl Component for Segment { fn style(cx: &StyleCx<'_>, _: SegmentStyleKey) -> SegmentStyle { let colors = &cx.tokens.color; let c = |rgba| cx.color(rgba); - // The picked segment wears the look of an icon button that is on (`face::pressed_parts` under `Pressed`). + // The picked segment wears the look of an icon button that is on (`face::filled_parts` under `Pressed` and `Control`). let (selected, selected_hover, on_ink) = match cx.env::() { ActiveLook::Accent => (c(colors.state.selected), c(colors.state.selected_hover), c(colors.text.on_selected)), ActiveLook::Pressed => (c(colors.state.pressed), c(colors.state.pressed), c(colors.text.normal)), + ActiveLook::Control => (c(colors.surface.control), c(colors.surface.control), c(colors.text.normal)), }; let (clear, disabled) = (c(Rgba::TRANSPARENT), c(colors.state.disabled_fill)); let fill = cx.state_layer().on(States::new(selected, selected_hover, selected_hover, disabled)); From f562e58af26124d2f1ad528ddcfd515801210501 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 25 Nov 2026 10:10:46 +0700 Subject: [PATCH 15/33] select: SelectLook::Filled shows the closed box filled with surface.control, with no edge until it has focus, at a field's width; Field stays the default --- crates/ui-widgets/src/pickers/select.rs | 16 ++++++----- .../ui-widgets/src/pickers/select/stories.rs | 9 ++++++- .../tests/it/pickers/select_width.rs | 27 +++++++++++++++++++ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/crates/ui-widgets/src/pickers/select.rs b/crates/ui-widgets/src/pickers/select.rs index 934fee1c8e..f78470f3db 100644 --- a/crates/ui-widgets/src/pickers/select.rs +++ b/crates/ui-widgets/src/pickers/select.rs @@ -71,6 +71,9 @@ pub enum SelectLook { /// and padding): at least `size.length.short`, at most a field length, where a longer text elides. It changes /// width with the pick (a workspace switcher at the end of an app bar). Quiet, + /// A field filled with `surface.control`, with no edge until it has focus, as wide as its widest entry: + /// VectorCraft 0.24's status bar selects. + Filled, } /// The icon of the button in the popup header that opens the header menu. @@ -260,12 +263,12 @@ fn fits(sizing: Option, in_bar: bool) -> bool { } } -/// The closed box of a quiet select: the panel surface at the control radius, the hover fill under the pointer, and -/// an edge only in the focus colour while it has focus. -fn quiet(cx: &StyleCx<'_>) -> SurfaceLook { +/// The closed box of a quiet or filled select: `fill` at the well radius, the hover fill under the pointer, and an edge +/// only in the focus colour while it has focus. +fn borderless(cx: &StyleCx<'_>, fill: craft_theme::Rgba) -> SurfaceLook { let colors = &cx.tokens.color; - let (panel, hover) = (cx.color(colors.surface.panel), cx.color(colors.state.hover)); - let fill = Stateful::new(panel).off(States::new(panel, hover, hover, panel)); + let (rest, hover) = (cx.color(fill), cx.color(colors.state.hover)); + let fill = Stateful::new(rest).off(States::new(rest, hover, hover, rest)); // The edge takes the fill's colour in every state, so it shows only with focus. let edge = fill.clone().when(Flags::FOCUSED, cx.color(colors.line.focus)); SurfaceLook::new(fill).radius(cx.surface(SurfaceKind::Well).radius).border(edge, cx.tokens.stroke.thin).border_replaces_edge() @@ -294,7 +297,8 @@ impl Component for Select<'_, T> { let (ink, muted) = (cx.ink(Ink::OnPanel), cx.color(cx.tokens.color.text.faint)); let (surface, least_width) = match key.look { SelectLook::Field => (cx.dropdown(), 0.0), - SelectLook::Quiet => (quiet(cx), cx.tokens.size.length.short), + SelectLook::Quiet => (borderless(cx, cx.tokens.color.surface.panel), cx.tokens.size.length.short), + SelectLook::Filled => (borderless(cx, cx.tokens.color.surface.control), 0.0), }; SelectStyle { surface, diff --git a/crates/ui-widgets/src/pickers/select/stories.rs b/crates/ui-widgets/src/pickers/select/stories.rs index f4a00109fe..6c8df32ed1 100644 --- a/crates/ui-widgets/src/pickers/select/stories.rs +++ b/crates/ui-widgets/src/pickers/select/stories.rs @@ -1,6 +1,6 @@ //! Stories of `Select`. -use super::Select; +use super::{Select, SelectLook}; use crate::contract::LabelScheme; use crate::contract::{Bind, Entry, Props, Role, Show as _, ShowContainer as _, Sizing, Validity}; use crate::form::{Field, FieldGroup}; @@ -88,6 +88,13 @@ fn select_first(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { Select::new("Blend mode", data.bind("first", 0u8), &entries).show(ui).into() } +/// A filled select (`SelectLook::Filled`, VectorCraft's status bar): `surface.control` with no edge until it has focus. +#[story(Select<'static, u8>, covers = [], drive = Drive::Never)] +fn select_filled(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let entries = modes(); + Select::new("Blend mode", data.bind("filled", 0u8), &entries).look(SelectLook::Filled).show(ui).into() +} + #[story(Select<'static, u8>, covers = [Mixed], drive = Drive::Never)] fn select_mixed(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let entries = modes(); diff --git a/crates/ui-widgets/tests/it/pickers/select_width.rs b/crates/ui-widgets/tests/it/pickers/select_width.rs index a42d8d9fbe..d41d8d8c7e 100644 --- a/crates/ui-widgets/tests/it/pickers/select_width.rs +++ b/crates/ui-widgets/tests/it/pickers/select_width.rs @@ -43,3 +43,30 @@ fn a_quiet_select_fits_the_entry_it_shows() { let (short, long) = (quiet_width(0), quiet_width(1)); assert!(short > 0.0 && short < long, "the quiet select is narrower showing the short entry: {short} against {long}"); } + +/// A filled select (`SelectLook::Filled`, VectorCraft's status bar) paints its closed box in `surface.control`, which +/// a field does not, and keeps a field's width whichever entry it shows. +#[trial] +fn a_filled_select_lies_on_the_control_surface_at_a_fields_width() { + let shown = |look: SelectLook, held: u8| { + let rect = Rc::new(Cell::new(egui::Rect::NOTHING)); + let seen = rect.clone(); + let mut fixture = Fixture::new(move |ui| { + let entries = [Entry::new(0u8, "Essentials"), Entry::new(1u8, "Print production and prepress")]; + seen.set(Select::new("Workspace", Bind::given(held), &entries).look(look).show(ui).response.rect); + }); + fixture.settle(); + let control = craft_ui::style::StyleCx::with_root(fixture.ctx(), |cx| cx.tokens.color.surface.control).0; + let control = egui::Color32::from_rgba_unmultiplied(control[0], control[1], control[2], control[3]); + let box_rect = rect.get(); + let filled = fixture.frame_shapes().iter().any(|shape| { + matches!(shape, egui::Shape::Rect(fill) if fill.fill == control && fill.rect.expand(0.5).contains_rect(box_rect) && box_rect.expand(0.5).contains_rect(fill.rect)) + }); + (box_rect.width(), filled) + }; + let ((short, filled), (long, _)) = (shown(SelectLook::Filled, 0), shown(SelectLook::Filled, 1)); + assert!(filled, "the filled select's box is surface.control"); + assert!((short - long).abs() <= 0.5, "the filled select keeps its width: {short} against {long}"); + let (_, field) = shown(SelectLook::Field, 0); + assert!(!field, "a field's box is not surface.control"); +} From 2ac9705290862bdf9175a6eafa15439dc9829deb Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 25 Nov 2026 10:37:49 +0700 Subject: [PATCH 16/33] dock: beside PanelTabLook::Block tabs a docked column card's bar is a square strip of surface.canvas across the card's top and only the card's foot is rounded, as VectorCraft 0.24's tool card; beside the other looks the bar stays part of the card --- crates/ui-panels/src/docking/dock_column.rs | 39 ++++++++++++------- .../src/docking/dock_column/stories.rs | 16 ++++---- crates/ui-panels/src/docking/iconic.rs | 9 ++--- 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/crates/ui-panels/src/docking/dock_column.rs b/crates/ui-panels/src/docking/dock_column.rs index d3bc6c3645..5747b69c5f 100644 --- a/crates/ui-panels/src/docking/dock_column.rs +++ b/crates/ui-panels/src/docking/dock_column.rs @@ -339,14 +339,28 @@ pub(crate) fn card_style(cx: &StyleCx<'_>) -> SurfaceStyle { SurfaceStyle { radius: UiTokens::corner(cx.tokens.shape.radius.surface), edge: SurfaceEdge::None, shadow: None, ..cx.surface(SurfaceKind::Panel) } } -/// Paints a column in `rect` whose content sits in `card`: the card over the dock's background where the column is -/// one, else the column's panel surface. -pub(crate) fn paint_card(ui: &mut PaintUi<'_>, rect: Rect, card: Rect, style: &SurfaceStyle) { +/// Paints a column in `rect` whose content sits in `card`, with its own `bar` if it has one, beside tabs in `look`: the +/// card over the dock's background where the column is one, else the column's panel surface; the bar on the surface +/// of the dock's strips. A card's bar is part of the card, unless the strips have a surface of their own +/// ([`PanelTabLook::Block`]): then it is a square strip across the card's top, and only the card's foot is rounded. +pub(crate) fn paint_card(ui: &mut PaintUi<'_>, rect: Rect, card: Rect, style: &SurfaceStyle, bar: Option, look: PanelTabLook) { + let strip = strip_surface(look); if card == rect { ui.draw().surface(rect, SurfaceKind::Panel, Corners::All); - } else { - ui.draw().surface(rect, SurfaceKind::Background, Corners::None); - ui.draw().surface_styled(card, style); + if let Some(bar) = bar { + ui.draw().surface(bar, strip, Corners::None); + } + return; + } + ui.draw().surface(rect, SurfaceKind::Background, Corners::None); + match bar.filter(|_| look == PanelTabLook::Block) { + Some(bar) => { + let mut foot = *style; + (foot.radius.nw, foot.radius.ne) = (0, 0); + ui.draw().surface_styled(card, &foot); + ui.draw().surface(bar, strip, Corners::None); + } + None => ui.draw().surface_styled(card, style), } } @@ -522,15 +536,10 @@ impl Component for DockColumn<'_, P> { let Some(plan) = self.laid.as_ref() else { return }; // Painted here, not as the container's surface, which lies over what `paint` draws. let card = self.inner(cx.rect, cx.flow.is_rtl(), &cx.style.sizes); - paint_card(ui, cx.rect, card, &cx.style.card); - if self.bar == ColumnBar::Own { - // A card's bar is part of the card. - if card == cx.rect { - ui.draw().surface(plan.bar, strip_surface(self.tab_look), Corners::None); - } - if self.arrow.shown() { - paint_chevron(ui, self.edge, self.arrow, true, cx.flow.is_rtl(), &cx.words::()); - } + let bar = (self.bar == ColumnBar::Own).then_some(plan.bar); + paint_card(ui, cx.rect, card, &cx.style.card, bar, self.tab_look); + if self.bar == ColumnBar::Own && self.arrow.shown() { + paint_chevron(ui, self.edge, self.arrow, true, cx.flow.is_rtl(), &cx.words::()); } } diff --git a/crates/ui-panels/src/docking/dock_column/stories.rs b/crates/ui-panels/src/docking/dock_column/stories.rs index 5154d249e3..2da0a00d62 100644 --- a/crates/ui-panels/src/docking/dock_column/stories.rs +++ b/crates/ui-panels/src/docking/dock_column/stories.rs @@ -6,6 +6,7 @@ use crate::rails::tool::stories::{BRUSH, tools}; use crate::rails::{LastUsed, RailDensity, ToolRail, ToolSlot}; use crate::runtime::env::Env; use crate::sections::Panel; +use crate::tabs::PanelTabLook; use crate::testing::memory::global; use crate::testing::{Drive, StoryData, StoryOutput, story}; use craft_behavior::Flow; @@ -49,11 +50,13 @@ fn in_a_floating_window(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { /// A docked column of a tool rail at the window edge shown as a card (`DockConfig::column_cards`), at each rail density /// and one or two steps: inset on its outer, top and bottom sides, where the dock's background shows, with its bar and -/// its rail on the rounded panel card. The column is wider than its steps by the inset. +/// its rail on the rounded panel card. The column is wider than its steps by the inset. Beside block tabs +/// (`PanelTabLook::Block`, VectorCraft's) its bar is a square `surface.canvas` strip across the card's top. #[story(DockColumn<'static, u8>, covers = [], drive = Drive::Never)] fn a_tool_rail_card(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let density = *data.choice("density", RailDensity::Dense, &[("Regular", RailDensity::Regular), ("Dense", RailDensity::Dense)]); let steps = *data.ranged("steps", 1_u16, 1.0..=2.0); + let look = *data.choice("tabs", PanelTabLook::Plain, &[("Plain", PanelTabLook::Plain), ("Block", PanelTabLook::Block)]); let slots = Tracked::new((0..4_u8).map(|slot| ToolSlot::new(u32::from(slot), tools(&[slot]))).collect::>()); let last = Tracked::new(LastUsed::default()); let cells = slots.len(); @@ -64,14 +67,13 @@ fn a_tool_rail_card(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let room = Flow::new(ui.available_rect_before_wrap(), Env::of(ui).direction.is_rtl()).span(0.0, width); let rect = room.with_max_y(room.top() + CARD_HEIGHT); // The column takes the cell a dock gives it, as high as the dock, whatever its rail's height. - let shown = DockColumn::new("Panels", global("dock column", "rail card story"), &column, &spec).card(CardInset::Edge).show_groups_at( - ui, - rect, - |_, rect, ui, _| { + let shown = DockColumn::new("Panels", global("dock column", "rail card story"), &column, &spec) + .card(CardInset::Edge) + .tab_look(look) + .show_groups_at(ui, rect, |_, rect, ui, _| { let rail = ToolRail::new("Tools", &slots, &BRUSH, &last).density(density); ui.scope_builder(UiBuilder::new().max_rect(rect), |ui| rail.show_rail(ui, |_, _| {})); - }, - ); + }); ui.advance_cursor_after_rect(rect); shown.into() } diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index 5a4d789298..8166b6dd55 100644 --- a/crates/ui-panels/src/docking/iconic.rs +++ b/crates/ui-panels/src/docking/iconic.rs @@ -5,7 +5,7 @@ use super::dock_column::{ BarRecord, CHEVRON, ColumnArrow, ColumnBar, bar_band, bar_slots, card_rect, card_style, column_grip, describe_chevron, paint_card, paint_chevron, register_edges, show_bar, }; -use super::group::{GripMarks, strip_surface}; +use super::group::GripMarks; use super::{CardInset, DockSizes, DockSpot, DockTargets, DockWords, DragUnit, Flyout, GroupAt, PanelKey, PanelSpec, Splitter, start_icon_drag}; use crate::buttons::{ActiveLook, IconButton}; use crate::contract::overlay::Anchor; @@ -701,12 +701,9 @@ impl Component for IconicColumn<'_, P> { fn paint(&mut self, ui: &mut PaintUi<'_>, cx: &Cx<'_, Self>) { // Painted here, not as the container's surface, which lies over what `paint` draws. let card = card_rect(cx.rect, self.card, &cx.style.sizes.column, self.edge, cx.flow.is_rtl()); - paint_card(ui, cx.rect, card, &cx.style.card); + let bar = (self.bar == ColumnBar::Own).then_some(self.bar_rect); + paint_card(ui, cx.rect, card, &cx.style.card, bar, self.tab_look); if self.bar == ColumnBar::Own { - // A card's bar is part of the card. - if self.card.is_none() { - ui.draw().surface(self.bar_rect, strip_surface(self.tab_look), Corners::None); - } paint_chevron(ui, self.edge, ColumnArrow::Collapse, self.expanded(), cx.flow.is_rtl(), &cx.words::()); } let flat = self.flat(); From 4bed21baaa41d2b47bef90879c04df521f6f6043 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 25 Nov 2026 11:54:32 +0700 Subject: [PATCH 17/33] dock, iconic column: under IconGroupSeparator::Rule each icon group keeps a bare grip band that drags the group, as production's: the first group's over the top space.gap.inline of its first icon, a later group's over the room above it and that much of its first icon; the band takes a press there (a click in it opens no flyout), and below it every icon, the first included, drags its own panel; Grip keeps its strips --- crates/ui-panels/src/docking/iconic.rs | 66 ++++++------- crates/ui-panels/src/docking/iconic/trials.rs | 93 +++++++++++++------ 2 files changed, 98 insertions(+), 61 deletions(-) diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index 8166b6dd55..f33dc4557b 100644 --- a/crates/ui-panels/src/docking/iconic.rs +++ b/crates/ui-panels/src/docking/iconic.rs @@ -49,6 +49,9 @@ pub struct IconicSizes { /// The height of the grip strip at the top of each icon group, above its first icon: none with /// [`IconGroupSeparator::Rule`]. pub grip: f32, + /// How far a group's grip band reaches into its first icon: none with [`IconGroupSeparator::Grip`], whose strip is + /// the band, `space.gap.inline` with [`IconGroupSeparator::Rule`]. + pub band: f32, /// The room between two icon groups: the tight gap, or with [`IconGroupSeparator::Rule`] the stack gap and the /// rule. pub separator: f32, @@ -63,11 +66,12 @@ impl IconicSizes { /// The sizes of the style context `cx`. pub fn style(cx: &StyleCx<'_>) -> Self { let size = &cx.tokens.size; - let (grip, separator) = match cx.env::() { - IconGroupSeparator::Grip => (super::group::grip_strip(cx.tokens), cx.tokens.space.gap.tight), - IconGroupSeparator::Rule => (0.0, cx.tokens.space.gap.stack + cx.rule(RuleKind::Edge).width.points(cx.frame_ctx().pixels_per_point())), + let gap = &cx.tokens.space.gap; + let (grip, band, separator) = match cx.env::() { + IconGroupSeparator::Grip => (super::group::grip_strip(cx.tokens), 0.0, gap.tight), + IconGroupSeparator::Rule => (0.0, gap.inline, gap.stack + cx.rule(RuleKind::Edge).width.points(cx.frame_ctx().pixels_per_point())), }; - IconicSizes { column: DockSizes::style(cx), cell: size.rail.button, grip, separator, labels: size.rail.width * LABELS_IN_RAIL_WIDTHS } + IconicSizes { column: DockSizes::style(cx), cell: size.rail.button, grip, band, separator, labels: size.rail.width * LABELS_IN_RAIL_WIDTHS } } /// The sizes in the root scope's style, for code outside a style pass: @@ -107,9 +111,11 @@ pub enum IconGroupSeparator { /// `line.grip`) and drags the group. #[default] Grip, - /// No grip strips: a group's first icon drags the group, its first icon stands right under the column's bar, and an - /// edge rule (`line.border`) lies level in the middle of the `space.gap.stack` between two groups, - /// `space.gap.inline` short of the column's sides: VectorCraft's icon groups, as production drew them. + /// No grip strips: a group's first icon stands right under the column's bar, and an edge rule (`line.border`) lies + /// level in the middle of the `space.gap.stack` between two groups, `space.gap.inline` short of the column's sides. + /// A bare band drags the group: the first group's top `space.gap.inline` of its first icon, a later group's room + /// above it and that much of its first icon. The band takes a press there, so a click in it opens no flyout; + /// below it the icon drags its own panel. VectorCraft's icon groups, as production drew them. Rule, } @@ -295,7 +301,7 @@ struct Plan { cells: Vec<(usize, usize, Rect)>, /// The rest of each row in a wide column, where the panel's name shows; empty in a narrow column. names: Vec, - /// `(group, rect)` of each group's grip strip, above its first icon. + /// `(group, rect)` of each group's grip: its strip above its first icon, or its band (`IconicSizes::band`). grips: Vec<(usize, Rect)>, /// `(group, rect)` of the whole of each group: its grip strip and its cells. groups: Vec<(usize, Rect)>, @@ -455,12 +461,14 @@ impl<'a, P: Value + Hash + Debug + 'static> IconicColumn<'a, P> { let wide = body.width() >= sizes.labels; let (mut y, mut cells, mut names, mut grips, mut groups) = (body.top(), Vec::new(), Vec::new(), Vec::new(), Vec::new()); for (at, group) in self.column.groups.iter().enumerate() { + let above = y; if at > 0 { y += sizes.separator; } let top = y; - let grip = Rect::from_min_max(Pos2::new(body.left(), top), Pos2::new(body.right(), top + sizes.grip)); - y = grip.bottom(); + y = top + sizes.grip; + // The grip strip, or a band that reaches into the first icon and covers the room above the group. + let band = if sizes.band > 0.0 { above..=y + sizes.band } else { top..=y }; for panel in 0..group.panels.len() { let row = Rect::from_min_size(Pos2::new(body.left(), y), Vec2::new(body.width(), sizes.cell)); if wide { @@ -472,9 +480,7 @@ impl<'a, P: Value + Hash + Debug + 'static> IconicColumn<'a, P> { } y += sizes.cell; } - if grip.height() > 0.0 { - grips.push((at, grip)); - } + grips.push((at, Rect::from_x_y_ranges(body.x_range(), *band.start()..=band.end().min(y)))); groups.push((at, Rect::from_min_max(Pos2::new(body.left(), top), Pos2::new(body.right(), y)))); } Plan { bar, cells, names, grips, groups, body } @@ -594,6 +600,8 @@ impl Component for IconicColumn<'_, P> { cx.part(GRIP.at(*group as u64), *grip) .sense(Sense::DRAG) .exact_hit() + // A band over the first icon's top takes the press there, as production's, drawn after the icons, did. + .stacking(u32::from(sizes.band > 0.0)) .cursor(CursorIcon::Grab) .drag_cursor(CursorIcon::Grabbing) .pointer_only("Move Panel To in the panel menu moves the group's panels"); @@ -614,30 +622,22 @@ impl Component for IconicColumn<'_, P> { let dragging = |phase: PressPhase| matches!(phase, PressPhase::DragStart { start, .. } if start.button == craft_behavior::PointerButton::Primary); let mut began = false; - // A group drags by its grip strip, or without one by its first icon. - let group_drag = |cx: &mut Cx<'_, Self>, group: usize| { - let lead = self.column.groups.get(group)?; - let anchor = lead.panels.first()?; - let extent = plan.groups.iter().find(|(at, _)| *at == group)?.1; - let shown = lead.active_panel().unwrap_or(anchor); - let label = Label::from((self.spec)(shown).label.as_str().to_owned()); - start_icon_drag(cx, DragUnit::Group(anchor.clone()), PanelKey::of(shown), extent.size(), label); - Some(()) - }; - for (group, _) in &plan.grips { - if cx.part_if_declared(GRIP.at(*group as u64)).is_some_and(|grip| dragging(grip.press.phase)) { - began |= group_drag(cx, *group).is_some(); + for (group, extent) in &plan.groups { + if dragging(cx.part(GRIP.at(*group as u64)).press.phase) + && let Some(lead) = self.column.groups.get(*group) + && let Some(anchor) = lead.panels.first() + { + let shown = lead.active_panel().unwrap_or(anchor); + let label = Label::from((self.spec)(shown).label.as_str().to_owned()); + start_icon_drag(cx, DragUnit::Group(anchor.clone()), PanelKey::of(shown), extent.size(), label); + began = true; } } - let gripless = plan.grips.is_empty(); for (at, (group, panel, cell)) in plan.cells.iter().enumerate() { let named = cx.part_if_declared(NAME.at(at as u64)).is_some_and(|name| dragging(name.press.phase)); - if !(dragging(cx.part(CELL.at(at as u64)).press.phase) || named) { - continue; - } - if gripless && *panel == 0 { - began |= group_drag(cx, *group).is_some(); - } else if let Some(panel) = self.panel(*group, *panel) { + if (dragging(cx.part(CELL.at(at as u64)).press.phase) || named) + && let Some(panel) = self.panel(*group, *panel) + { let label = Label::from((self.spec)(panel).label.as_str().to_owned()); start_icon_drag(cx, DragUnit::Panel(panel.clone()), PanelKey::of(panel), cell.size(), label); began = true; diff --git a/crates/ui-panels/src/docking/iconic/trials.rs b/crates/ui-panels/src/docking/iconic/trials.rs index 095fed7939..aaa36e197e 100644 --- a/crates/ui-panels/src/docking/iconic/trials.rs +++ b/crates/ui-panels/src/docking/iconic/trials.rs @@ -663,39 +663,47 @@ fn a_themes_bar_grip_is_one_level_bar() { assert!((bar.center().x - strip.center().x).abs() <= 0.5, "centred across the strip: {bar:?} in {strip:?}"); } -/// The icons of the two groups of a collapsed column whose groups stand apart by `separator`: the column's id and the -/// fixture. -fn separated(separator: IconGroupSeparator) -> (Fixture, Id) { +/// The icons of the two groups of a collapsed column `width` wide whose groups stand apart by `separator`: the fixture, +/// the column's id and the panel whose flyout is open. +fn separated(separator: IconGroupSeparator, width: f32) -> (Fixture, Id, Rc>>) { + let open = Rc::new(Cell::new(None)); + let seen = Rc::clone(&open); let mut fixture = Fixture::hosted(move |ui| { let mut column = Column::new(vec![Group::new(vec![1, 2], 0), Group::new(vec![3], 0)]); column.iconic = true; - let place = Rect::from_min_size(Pos2::ZERO, Vec2::new(RAIL, SCREEN.y)); - with_env( - ui, - |overrides| { - overrides.values.set(separator); - }, - |ui| { - let output = IconicColumn::new("Panels", global("iconic column", "rule"), &column, Bind::kept(), &named) - .within(screen()) - .show_flyouts_at(ui, place, |_, _, _, _| None); - Some(output.into()) - }, - ) + let place = Rect::from_min_size(Pos2::ZERO, Vec2::new(width, SCREEN.y)); + let mut now = seen.get(); + let output = + with_env( + ui, + |overrides| { + overrides.values.set(separator); + }, + |ui| { + IconicColumn::new("Panels", global("iconic column", "rule"), &column, Bind::bound(&mut now), &named) + .within(screen()) + .show_flyouts_at(ui, place, |_, _, _, _| None) + }, + ); + seen.set(now); + Some(output.into()) }); fixture.room(SCREEN).settle(); let id = fixture.root_id().expect("the column shows"); - (fixture, id) + (fixture, id, open) } /// An app's `IconGroupSeparator::Rule` (VectorCraft's): no grip strips, so the first icon stands higher than under grip /// strips; one level edge rule lies in the middle of the room between the two groups, short of the column's sides, and -/// none over the first group; a drag on a group's first icon moves the group, on its next icon only that panel. +/// none over the first group. Each group keeps a bare grip band, as production's: the first group's over its first +/// icon's top edge, a later group's over the room above it and its first icon's top edge. A drag from a band moves the +/// group, from an icon below the band, the first included, only that icon's panel; a click in the band opens no flyout +/// (the band takes the press there, as production's did), a click below it does, in a narrow and in a wide column. #[trial] fn icon_groups_apart_by_a_rule_show_one_level_rule_between_them() { - let (gripped, gripped_id) = separated(IconGroupSeparator::Grip); + let (gripped, gripped_id, _) = separated(IconGroupSeparator::Grip, RAIL); let gripped_first = gripped.part_rect(gripped_id, CELL.at(0)).expect("the first icon under grips"); - let (mut fixture, id) = separated(IconGroupSeparator::Rule); + let (mut fixture, id, _) = separated(IconGroupSeparator::Rule, RAIL); let border = StyleCx::with_root(fixture.ctx(), |cx| cx.tokens.color.line.border); let shapes = fixture.frame_shapes(); let level: Vec<(Pos2, Pos2, egui::Color32)> = shapes @@ -705,12 +713,22 @@ fn icon_groups_apart_by_a_rule_show_one_level_rule_between_them() { _ => None, }) .collect(); - for group in [0, 1] { - assert!(fixture.part_rect(id, GRIP.at(group)).is_none(), "group {group} has no grip strip"); - } let cell = |at: u64| fixture.part_rect(id, CELL.at(at)).expect("the icon shows"); + let band = |group: u64| fixture.part_rect(id, GRIP.at(group)).expect("each group keeps a grip band"); let (first, last, next) = (cell(0), cell(1), cell(2)); + let (top, lower) = (band(0), band(1)); assert!(first.top() < gripped_first.top() - 0.5, "the first icon {first:?} stands higher than under a grip strip {gripped_first:?}"); + for (group, band) in [top, lower].into_iter().enumerate() { + assert!(grip_ticks(&shapes, band).is_none(), "group {group}: the band shows no marks"); + } + assert!( + near(top.top(), first.top()) && top.bottom() > first.top() && top.bottom() < first.center().y, + "the first band {top:?} is the top edge of {first:?}" + ); + assert!( + near(lower.top(), last.bottom()) && lower.bottom() > next.top() && lower.bottom() < next.center().y, + "the later band {lower:?} covers the room from {last:?} and the top edge of {next:?}" + ); assert!(!level.iter().any(|(a, _, _)| a.y < first.bottom()), "no rule over the first group: {level:?}"); let between: Vec<_> = level.iter().filter(|(a, _, _)| a.y > last.bottom() && a.y < next.top()).collect(); let [(a, b, ink)] = between.as_slice() else { panic!("one rule between the groups: {level:?}") }; @@ -721,11 +739,30 @@ fn icon_groups_apart_by_a_rule_show_one_level_rule_between_them() { assert!(left > 0.0 && right < RAIL && span > RAIL - span, "the rule reaches across the column, short of its sides: {a:?} to {b:?}"); let [r, g, bl, al] = border.0; assert_eq!(*ink, egui::Color32::from_rgba_unmultiplied(r, g, bl, al), "the rule is in line.border"); - for (icon, unit) in [(first, DragUnit::Group(1)), (last, DragUnit::Panel(2)), (next, DragUnit::Group(3))] { - fixture.drag_hold_at(icon.center(), Vec2::new(RAIL * 2.0, 0.0)); - let dragged = drag::active::>(fixture.ctx()).map(|drag| drag.unit.clone()); - assert_eq!(dragged, Some(unit.clone()), "a drag on the icon {icon:?} moves {unit:?}"); - fixture.release_at(icon.center() + Vec2::new(RAIL * 2.0, 0.0)).settle(); + for width in [RAIL, WIDE_COLUMN] { + let (mut fixture, id, open) = separated(IconGroupSeparator::Rule, width); + let cell = |at: u64| fixture.part_rect(id, CELL.at(at)).expect("the icon shows"); + let band = |group: u64| fixture.part_rect(id, GRIP.at(group)).expect("each group keeps a grip band"); + let (first, last, next, top, lower) = (cell(0), cell(1), cell(2), band(0), band(1)); + let in_top = Pos2::new(first.center().x, top.center().y); + let drags = [ + (in_top, DragUnit::Group(1)), + (Pos2::new(next.center().x, (last.bottom() + next.top()) / 2.0), DragUnit::Group(3)), + (Pos2::new(next.center().x, (next.top() + lower.bottom()) / 2.0), DragUnit::Group(3)), + (first.center(), DragUnit::Panel(1)), + (last.center(), DragUnit::Panel(2)), + (next.center(), DragUnit::Panel(3)), + ]; + for (from, unit) in drags { + fixture.drag_hold_at(from, Vec2::new(SCREEN.x / 2.0, 0.0)); + let dragged = drag::active::>(fixture.ctx()).map(|drag| drag.unit.clone()); + assert_eq!(dragged, Some(unit.clone()), "{width} wide: a drag from {from:?} moves {unit:?}"); + fixture.release_at(from + Vec2::new(SCREEN.x / 2.0, 0.0)).settle(); + } + fixture.click_at(in_top).idle(3); + assert_eq!(open.get(), None, "{width} wide: a click in the band opens no flyout"); + fixture.click_at(first.center()).idle(3); + assert_eq!(open.get(), Some(1), "{width} wide: a click on the first icon below the band opens its flyout"); } } From 189716c2e81271f25f75f3a9b1c564d1d566c059 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Wed, 25 Nov 2026 07:01:05 +0100 Subject: [PATCH 18/33] ui-shell: the Column start stories use catalog icons for their links message-circle and git-branch are not catalog names, so the icon_ids test failed on next. The community link takes "note" (a chat bubble) and the source link "open". --- crates/ui-shell/src/shell/start/stories.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ui-shell/src/shell/start/stories.rs b/crates/ui-shell/src/shell/start/stories.rs index 7c7eea8b3a..7d50362017 100644 --- a/crates/ui-shell/src/shell/start/stories.rs +++ b/crates/ui-shell/src/shell/start/stories.rs @@ -211,9 +211,9 @@ fn page_templates() -> Vec