buttons: a stacked face takes tile corners; RecentList::remove and BackstageView::back_look options

A stacked push, toggle or split button shares the icon face's corners (control corners unless the variant is
explicitly full), so a capsule radius no longer rounds a two-line stack into a circle that cuts its label.
RecentList gains RecentRemove (Revealed by default, Always shows every row's remove part) and BackstageView
gains BackLook (Labelled by default, Glyph draws Back as the glyph alone); each has a story and a trial.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dylan M. TaylorandClaude Opus 5.5 committed 2026-11-28 17:24:14 +00:00
1 parent c6898679b7
commit fc5cb2bab5
14 files changed
+200 -40

No files matched your search

+1 -1
View File
@@ -40,7 +40,7 @@ pub(crate) mod start;
pub(crate) mod viewport_window;
pub use recent::{RecentFile, RecentSort, RecentView, Template, ThumbKey, sort_recent};
pub use recent_list::RecentList;
pub use recent_list::{RecentList, RecentRemove};
pub use start::{
FolderListing, PINNED_FILES_SHOWN, PinnedFile, PinnedFolder, StartAction, StartLayout, StartLink, StartLinkTarget, StartOutput,
StartPinnedCommands, StartPlace, StartRecentCommands, StartScreen,
+27 -6
View File
@@ -30,6 +30,17 @@ use std::path::PathBuf;
type HeaderControls<'a> = Box<dyn FnMut(&mut Ui, &mut BodyCx<'_>) + 'a>;
/// When a recent row of a list shows its remove button.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum RecentRemove {
/// On a hovered or selected row, or while the button has focus: a quiet list.
#[default]
Revealed,
/// On every row, so the list says at a glance that each file can be taken off it: DeckCraft's File page.
Always,
}
/// The recent files as rows, with the commands of a recent file and its context menu. The files arrive in the order
/// the app wants them shown; the list does not sort.
#[must_use = "show the list with `show`"]
@@ -43,6 +54,7 @@ pub struct RecentList<'a> {
now: Option<i64>,
thumbnails: Option<ThumbHost<'a>>,
picture: (u16, u16),
remove: RecentRemove,
}
impl<'a> RecentList<'a> {
@@ -57,9 +69,16 @@ impl<'a> RecentList<'a> {
now: None,
thumbnails: None,
picture: (PICTURE_WIDE, PICTURE_HIGH),
remove: RecentRemove::default(),
}
}
/// When a row shows its remove button (default `RecentRemove::Revealed`).
pub fn remove(mut self, remove: RecentRemove) -> Self {
self.remove = remove;
self
}
/// The title of the existing section, in place of its localized Recent title.
pub fn heading(mut self, heading: impl Into<Label>) -> Self {
self.heading = Some(heading.into());
@@ -107,7 +126,7 @@ impl<'a> RecentList<'a> {
/// Shows the rows in their own section and reports what the user did.
pub fn show(self, ui: &mut Ui) -> StartOutput {
let RecentList { recent, heading, controls, max_recent, empty, now, thumbnails, picture } = self;
let RecentList { recent, heading, controls, max_recent, empty, now, thumbnails, picture, remove } = self;
let env = Env::of(ui);
let words = env.words::<ShellWords>();
let actions = RefCell::new(Vec::new());
@@ -128,6 +147,7 @@ impl<'a> RecentList<'a> {
new_label: None,
open_label: None,
heading_sections: false,
remove,
};
let files: Vec<RecentFile> = recent.iter().take(max_recent).cloned().collect();
let empty = empty.unwrap_or_else(|| words.no_recent.clone());
@@ -236,11 +256,12 @@ pub(super) fn recent_body(
Some(age) => row.trailing(age),
None => row,
};
let row = row.trailing_part_revealed(
REMOVE,
TrailingFace::Icon(IconSpec::svg(IconId::new("close"))),
words.remove_recent.fill(&[("name", file.name.as_str())]),
);
let (face, name) =
(TrailingFace::Icon(IconSpec::svg(IconId::new("close"))), words.remove_recent.fill(&[("name", file.name.as_str())]));
let row = match page.remove {
RecentRemove::Revealed => row.trailing_part_revealed(REMOVE, face, name),
RecentRemove::Always => row.trailing_part(REMOVE, face, name),
};
match page.thumbnails {
Some((thumbnails, source)) => {
let key = ThumbKey::Recent(file.path.clone());
+4 -1
View File
@@ -5,7 +5,7 @@
pub(crate) mod stories;
use super::recent::{RecentFile, RecentSort, RecentView, Template, ThumbKey, sort_recent};
use super::recent_list::{RecentList, recent_body};
use super::recent_list::{RecentList, RecentRemove, recent_body};
use super::words::ShellWords;
use crate::buttons::button::ButtonStyleKey;
use crate::buttons::{Button, ControlPlace, Link};
@@ -582,6 +582,8 @@ pub(super) struct Page<'p> {
pub(super) open_label: Option<&'p Label>,
/// PdfCraft's section look (`StartScreen::heading_sections`).
pub(super) heading_sections: bool,
/// When a recent row shows its remove button.
pub(super) remove: RecentRemove,
}
impl<'p> Page<'p> {
@@ -760,6 +762,7 @@ impl StartScreen<'_> {
new_label: new_label.as_ref(),
open_label: open_label.as_ref(),
heading_sections,
remove: RecentRemove::Revealed,
actions: &actions,
};
let view = RefCell::new(view);
+8 -1
View File
@@ -6,7 +6,7 @@ use crate::contract::{Bind, Props as _, Show as _};
use crate::notices::Notice;
use crate::primitives::{FakeThumbSource, ThumbnailOptions, Thumbnails};
use crate::runtime::env::Label;
use crate::shell::{RecentFile, RecentList, RecentSort, RecentView, ScreenModeCommands, Template, ThumbKey};
use crate::shell::{RecentFile, RecentList, RecentRemove, RecentSort, RecentView, ScreenModeCommands, Template, ThumbKey};
use crate::testing::{Drive, StoryData, StoryOutput, story};
use crate::text::TextField;
use craft_behavior::IconId;
@@ -270,6 +270,13 @@ fn recent_list_with_header_controls(ui: &mut Ui, data: &mut StoryData) -> StoryO
.into()
}
/// `RecentRemove::Always`: every row shows its remove button, not only the hovered or selected one.
#[story(RecentList<'static>, covers = [], drive = Drive::Never)]
fn recent_list_remove_always(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
let files = plain_files();
RecentList::new(&files).now(Some(NOW)).remove(RecentRemove::Always).show(ui).into()
}
/// No recent files: the muted line under the heading, at the reading start.
#[story(RecentList<'static>, covers = [], drive = Drive::Never)]
fn recent_list_empty(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {