diff --git a/.config/cargo-ci.toml b/.config/cargo-ci.toml index 956491323b..93a48332ff 100644 --- a/.config/cargo-ci.toml +++ b/.config/cargo-ci.toml @@ -29,3 +29,9 @@ opt-level = 1 [profile.dev.package.craft-cms] opt-level = 1 + +# The runtime under every screen test: each frame of a fixture runs its pass, layout, focus and access tree. At +# opt-level 2 a suite trial runs about 40 percent fewer instructions than at 0 (Table activation 19.8 G to 11.9 G); +# opt-level 1 gives about 30 percent. Every UI crate waits for its compile, which grows by about a minute. +[profile.dev.package.craft-ui-contract] +opt-level = 2 diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml index 63170f1214..33106085a5 100644 --- a/.github/workflows/workspace.yml +++ b/.github/workflows/workspace.yml @@ -167,8 +167,8 @@ jobs: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings # A selection that reaches a replay-audit crate builds once in a `build` job, which writes # three nextest archives and then runs the doctests; three shard legs run them in parallel: - # every selected test outside the replay audit's crates, those crates (run plainly, then with the - # audit), and craft-image-codecs with default features. Any other selection + # every selected test outside the replay audit's crates and craft-draw, those crates (run plainly, + # then the audit crates with the audit), and craft-image-codecs with default features. Any other selection # (and every macOS and Windows leg) builds and runs in one leg. scripts/ci-workspace-tests.sh # holds every step. test-shards: ${{ needs.platforms.outputs.audit == 'true' && 3 || 0 }} diff --git a/Cargo.lock b/Cargo.lock index 5b6fb0dfeb..62dfc38e65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5571,7 +5571,7 @@ dependencies = [ [[package]] name = "ecolor" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "bytemuck", "emath", @@ -5627,7 +5627,7 @@ dependencies = [ [[package]] name = "eframe" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "ahash", "bytemuck", @@ -5662,7 +5662,7 @@ dependencies = [ [[package]] name = "egui" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "accesskit", "ahash", @@ -5681,7 +5681,7 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "ahash", "bytemuck", @@ -5700,7 +5700,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "block2 0.6.2", "bytemuck", @@ -5720,7 +5720,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "bytemuck", "egui", @@ -5733,7 +5733,7 @@ dependencies = [ [[package]] name = "egui_kittest" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "eframe", "egui", @@ -5810,7 +5810,7 @@ dependencies = [ [[package]] name = "emath" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "bytemuck", ] @@ -5883,7 +5883,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "ahash", "bytemuck", @@ -5909,7 +5909,7 @@ dependencies = [ [[package]] name = "epaint_default_fonts" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" [[package]] name = "equator" @@ -15241,19 +15241,19 @@ dependencies = [ [[patch.unused]] name = "egui_demo_lib" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" [[patch.unused]] name = "egui_extras" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" [[patch.unused]] name = "egui_inspection" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" [[patch.unused]] name = "egui_system_font_provider" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=a87d00caaec947ea781657c6ff410c9838016d18#a87d00caaec947ea781657c6ff410c9838016d18" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" diff --git a/Cargo.toml b/Cargo.toml index 3ab56cbec0..cc40daf56d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -316,20 +316,20 @@ hayro-postscript = { path = "vendor/hayro-postscript" } linesweeper = { path = "vendor/linesweeper" } vello_common = { path = "vendor/vello_common" } vello_cpu = { path = "vendor/vello_cpu" } -ecolor = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } -emath = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } -epaint = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } -epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } -egui = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } -egui-winit = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } -egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } -egui_glow = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } -egui_extras = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } -egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } -egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } -eframe = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } -egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } -egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "a87d00caaec947ea781657c6ff410c9838016d18" } +ecolor = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +emath = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +epaint = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui-winit = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui_glow = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui_extras = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +eframe = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" } # symphonia's FLAC decoder restores LPC samples as `residual + (prediction as i32)`. In a valid diff --git a/crates/craft/src/egui_fork.rs b/crates/craft/src/egui_fork.rs index 182581c420..b8535c5c1e 100644 --- a/crates/craft/src/egui_fork.rs +++ b/crates/craft/src/egui_fork.rs @@ -3,7 +3,7 @@ /// The egui fork the library is built and tested with. Apps patch egui to exactly this. pub const GIT: &str = "https://github.com/storytold/egui.git"; /// The commit of [`GIT`]. -pub const REV: &str = "a87d00caaec947ea781657c6ff410c9838016d18"; +pub const REV: &str = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec"; /// The packages the workspace patches to the fork (the `[patch.crates-io]` entries that name [`GIT`]). pub const PACKAGES: &[&str] = &[ diff --git a/crates/font-manager/src/picker.rs b/crates/font-manager/src/picker.rs index 4831d8f129..6e3856bb59 100644 --- a/crates/font-manager/src/picker.rs +++ b/crates/font-manager/src/picker.rs @@ -529,7 +529,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 a8f595e2b4..01f5653004 100644 --- a/crates/font-manager/tests/it/picker.rs +++ b/crates/font-manager/tests/it/picker.rs @@ -806,6 +806,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/menu/src/shortcuts/keyboard.rs b/crates/menu/src/shortcuts/keyboard.rs index b3bb275406..c153a4fce0 100644 --- a/crates/menu/src/shortcuts/keyboard.rs +++ b/crates/menu/src/shortcuts/keyboard.rs @@ -688,7 +688,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 3cb2dd223a..8b31ed5482 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 @@ -308,6 +312,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. @@ -336,6 +344,7 @@ impl Default for Options { fn default() -> Options { Options { title: None, + size: None, editable: true, custom_set_name: None, conflicts: ConflictMode::Ask, @@ -346,6 +355,7 @@ impl Default for Options { sort_by_label: false, area_tabs: false, areas: Vec::new(), + own_areas: false, visible: None, keyboard: false, keyboard_height: None, @@ -622,10 +632,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/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/mod.rs b/crates/menu/tests/it/shortcuts/mod.rs index c3ac8a9724..60a229495e 100644 --- a/crates/menu/tests/it/shortcuts/mod.rs +++ b/crates/menu/tests/it/shortcuts/mod.rs @@ -23,3 +23,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"); +} 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"); +} diff --git a/crates/pages/src/ui/view.rs b/crates/pages/src/ui/view.rs index 0b08850bbd..bf510c36fc 100644 --- a/crates/pages/src/ui/view.rs +++ b/crates/pages/src/ui/view.rs @@ -1199,6 +1199,10 @@ fn run_pass( Label::from(words.page_of.fill(&[("page", label.as_str()), ("count", total.as_str())])) }; let bars = if count > 0 { bars.tip(&tip) } else { bars }; + // Pages that fit the view's width can't scroll sideways, so there is no horizontal bar. The layout drawn + // decides, as the bars measure it. + let (x_lo, x_hi) = offset_range(drawn.doc.x0, drawn.doc.x1, vw); + let bars = if x_lo >= x_hi { bars.vertical_only() } else { bars }; // Full screen's edge-to-edge view (`PageView::fill_screen`) has no scroll bars: nothing is drawn and nothing takes a press // along the window's edges. let bar_moved = if build.fill_screen { diff --git a/crates/pages/tests/it/views.rs b/crates/pages/tests/it/views.rs index 3ddb1e268c..bc77a2420a 100644 --- a/crates/pages/tests/it/views.rs +++ b/crates/pages/tests/it/views.rs @@ -107,6 +107,82 @@ impl PageSource for SmallPages { } } +/// 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; + }), + ); + horizontal_bar(&fixture).is_some() +} + +#[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"); +} + +/// 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( diff --git a/crates/theme/sizes/comfortable.json b/crates/theme/sizes/comfortable.json index 36545501dc..15e096456c 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, @@ -30,6 +31,7 @@ }, "dialog": { "button": 84.0, + "button_height": 30.0, "least": 380.0, "side_button": 96.0, "wrap": 440.0 @@ -71,6 +73,22 @@ "short": 120.0, "track": 144.0 }, + "page": { + "action": 30.0, + "button": 30.0, + "button_side": 0.0, + "column": 820.0, + "gap": { + "actions": 8.0, + "heading": 8.0, + "lead": 16.0, + "link": 8.0, + "section": 16.0, + "title": 3.0 + }, + "link": 0.0, + "margin": 50.0 + }, "pane": { "least": 50.0 }, @@ -93,6 +111,7 @@ "groove": 5.0 }, "row": { + "menu": 30.0, "text": 21.0 }, "thumb": { @@ -130,6 +149,7 @@ "pad": { "chip": 6.0, "control": 8.0, + "dialog": 12.0, "regular": 12.0, "roomy": 20.0, "segment": 14.0 diff --git a/crates/theme/sizes/compact.json b/crates/theme/sizes/compact.json index a57c5b4435..afe565f4d0 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, @@ -30,6 +31,7 @@ }, "dialog": { "button": 84.0, + "button_height": 24.0, "least": 380.0, "side_button": 96.0, "wrap": 440.0 @@ -71,6 +73,22 @@ "short": 96.0, "track": 128.0 }, + "page": { + "action": 24.0, + "button": 24.0, + "button_side": 0.0, + "column": 820.0, + "gap": { + "actions": 6.0, + "heading": 6.0, + "lead": 12.0, + "link": 6.0, + "section": 12.0, + "title": 2.0 + }, + "link": 0.0, + "margin": 40.0 + }, "pane": { "least": 40.0 }, @@ -93,6 +111,7 @@ "groove": 5.0 }, "row": { + "menu": 24.0, "text": 18.0 }, "thumb": { @@ -130,6 +149,7 @@ "pad": { "chip": 4.0, "control": 6.0, + "dialog": 8.0, "regular": 8.0, "roomy": 16.0, "segment": 10.0 diff --git a/crates/theme/src/app_sizes.rs b/crates/theme/src/app_sizes.rs index da08249df0..e3a46fe215 100644 --- a/crates/theme/src/app_sizes.rs +++ b/crates/theme/src/app_sizes.rs @@ -34,8 +34,22 @@ pub struct AppSizes { } /// Base values that follow another's override when an app sets none of their own: a push button stands a control high -/// in an app that changes the control's height alone. -const FOLLOWS: [(&str, &str); 1] = [("size.button", "size.control.md")]; +/// in an app that changes the control's height alone, a menu row too, a dialog's footer button a push button high, a +/// dialog is padded as a panel is, and a page keeps the rhythm of the gaps its own stand in for. Each size set gives +/// the follower the value it follows. +pub(crate) const FOLLOWS: [(&str, &str); 11] = [ + ("size.button", "size.control.md"), + ("size.row.menu", "size.control.md"), + ("size.dialog.button_height", "size.button"), + ("space.pad.dialog", "space.pad.regular"), + ("size.page.button", "size.button"), + ("size.page.gap.title", "space.gap.tight"), + ("size.page.gap.lead", "space.gap.section"), + ("size.page.gap.actions", "space.gap.stack"), + ("size.page.gap.section", "space.gap.section"), + ("size.page.gap.heading", "space.gap.stack"), + ("size.page.gap.link", "space.gap.stack"), +]; /// The base paths an app may override: sizes, spacing, corner radii, strokes and type sizes, not the /// edge or fonts. @@ -85,9 +99,9 @@ impl AppSizes { } /// The override of base value `path` (with no `base.` prefix) in `merged`: its own, else the one of the value it - /// follows when it has none. + /// follows when it has none, through every step of `FOLLOWS`. pub(crate) fn override_of<'m>(merged: &'m SizeMap, path: &str) -> Option<&'m SizeValue> { - merged.get(path).or_else(|| FOLLOWS.iter().find(|(own, _)| *own == path).and_then(|(_, of)| merged.get(*of))) + merged.get(path).or_else(|| FOLLOWS.iter().find(|(own, _)| *own == path).and_then(|(_, of)| Self::override_of(merged, of))) } /// The overrides for `size`: `all`, with the set's own map over it. diff --git a/crates/theme/src/app_sizes_tests.rs b/crates/theme/src/app_sizes_tests.rs index c8d9466581..9976d3dfea 100644 --- a/crates/theme/src/app_sizes_tests.rs +++ b/crates/theme/src/app_sizes_tests.rs @@ -3,6 +3,8 @@ use serde_json::{Value, json}; use super::*; +use crate::app_sizes::FOLLOWS; +use crate::sizes::{Preset, Slot, leaves}; fn sizes(v: &Value) -> AppSizes { AppSizes::parse(v.to_string().as_bytes()).unwrap() @@ -37,3 +39,47 @@ fn a_push_button_follows_the_control_height_unless_the_app_sets_its_own() { let own = applied(&json!({ "all": { "size.control.md": 40, "size.button": 30 } })); assert!(own.button < own.control.md, "the app's own button height wins"); } + +/// A page gap follows the gap it stands in for when the app sets only that one, and the page's New and Open follow a +/// push button down the chain to the control height; the app's own page values win. +#[test] +fn a_page_follows_the_values_it_stands_in_for_unless_the_app_sets_its_own() { + let base = crate::sizes::builtin(Size::Compact).base; + let applied = |v: &Value| { + let mut preset = base; + sizes(v).apply_base(Size::Compact, &mut preset); + preset + }; + let follows = applied(&json!({ "all": { "space.gap.section": 30, "size.control.md": 40 } })); + assert!(follows.space.gap.section > base.space.gap.section, "the override widens the section gap"); + assert_eq!(follows.size.page.gap.section, follows.space.gap.section, "the page's section gap follows it"); + assert_eq!(follows.size.page.button, follows.size.control.md, "New and Open follow the push button to the control height"); + let own = applied(&json!({ "all": { "space.gap.section": 30, "size.page.gap.section": 40 } })); + assert!(own.size.page.gap.section > own.space.gap.section, "the app's own page gap wins"); +} + +/// Each built-in size set gives a following value (`FOLLOWS`) the value it follows, so a new follower changes no app +/// that leaves it unset; an app's override reaches a follower through every step (a dialog's footer button follows the +/// push button, which follows the control height). +#[test] +fn a_follower_starts_at_the_value_it_follows_and_takes_its_override() { + let value = |preset: &mut Preset, path: &str| { + let want = format!("base.{path}"); + leaves(preset).into_iter().find_map(|l| match l.slot { + Slot::Num(x) | Slot::Length(x) if l.path == want => Some(*x), + _ => None, + }) + }; + for size in [Size::Compact, Size::Comfortable] { + let base = crate::sizes::builtin(size).base; + for (own, of) in FOLLOWS { + let mut preset = base; + assert_eq!(value(&mut preset, own), value(&mut preset, of), "{size:?}: {own} starts at {of}"); + } + let mut preset = base; + sizes(&json!({ "all": { "size.control.md": 40, "space.pad.regular": 20 } })).apply_base(size, &mut preset); + assert_eq!(value(&mut preset, "size.dialog.button_height"), Some(40.0), "{size:?}: through size.button"); + assert_eq!(value(&mut preset, "size.row.menu"), Some(40.0), "{size:?}"); + assert_eq!(value(&mut preset, "space.pad.dialog"), Some(20.0), "{size:?}"); + } +} diff --git a/crates/theme/src/dump.rs b/crates/theme/src/dump.rs index eee2c42eee..84ece5f937 100644 --- a/crates/theme/src/dump.rs +++ b/crates/theme/src/dump.rs @@ -7,9 +7,9 @@ use std::fmt::Write as _; use crate::{ BarSizes, ColorToken, ControlSizes, DialogSizes, DockColumnSizes, Easing, Edge, Elevation, ElevationTokens, FloatSizes, FontSlot, Gaps, - GripShape, HandleSizes, HitSizes, IconSizes, Insets, KnobShape, LengthSizes, Motion, MotionTokens, Pads, PaneSizes, PlotSizes, RadiusSet, - RailSizes, RampSizes, Rgba, RowSizes, ShapeTokens, SizeTokens, SpaceTokens, StrokeTokens, ThumbSamples, ThumbSizes, Tokens, TypeStyle, - TypeTokens, WellShape, WindowSizes, + GripShape, HandleSizes, HitSizes, IconSizes, Insets, KnobShape, LengthSizes, Motion, MotionTokens, Pads, PageGaps, PageSizes, PaneSizes, + PlotSizes, RadiusSet, RailSizes, RampSizes, Rgba, RowSizes, ShapeTokens, SizeTokens, SpaceTokens, StrokeTokens, ThumbSamples, ThumbSizes, Tokens, + TypeStyle, TypeTokens, WellShape, WindowSizes, }; /// The text of every token, one `key = value` line each, in a fixed order. @@ -108,8 +108,8 @@ fn space_lines(out: &mut Lines, space: &SpaceTokens) { ] { out.line(&format!("space.gap.{k}"), len(*v)); } - let Pads { control, regular, roomy, chip, segment } = pad; - for (k, v) in [("control", control), ("regular", regular), ("roomy", roomy), ("chip", chip), ("segment", segment)] { + let Pads { control, regular, dialog, roomy, chip, segment } = pad; + for (k, v) in [("control", control), ("regular", regular), ("dialog", dialog), ("roomy", roomy), ("chip", chip), ("segment", segment)] { out.line(&format!("space.pad.{k}"), len(*v)); } let Insets { screen, page_side, page_margin, page_gap } = inset; @@ -143,6 +143,7 @@ fn size_lines(out: &mut Lines, size: &SizeTokens) { pane, dock, dialog, + page, } = size; let ControlSizes { sm, md } = control; out.line("size.control.sm", len(*sm)); @@ -157,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)); @@ -193,8 +200,9 @@ fn size_lines(out: &mut Lines, size: &SizeTokens) { out.line("size.length.short", len(*short)); out.line("size.length.number.sm", len(number.sm)); out.line("size.length.number.md", len(number.md)); - let RowSizes { text } = row; + let RowSizes { text, menu } = row; out.line("size.row.text", len(*text)); + out.line("size.row.menu", len(*menu)); out.line("size.groove", len(*groove)); let RampSizes { bar, groove: ramp_groove } = ramp; out.line("size.ramp.bar", len(*bar)); @@ -210,11 +218,26 @@ fn size_lines(out: &mut Lines, size: &SizeTokens) { out.line("size.pane.least", len(*least)); let DockColumnSizes { column } = dock; out.line("size.dock.column", len(*column)); - let DialogSizes { least, wrap, button, side_button } = dialog; + let DialogSizes { least, wrap, button, side_button, button_height } = dialog; out.line("size.dialog.least", len(*least)); out.line("size.dialog.wrap", len(*wrap)); out.line("size.dialog.button", len(*button)); out.line("size.dialog.side_button", len(*side_button)); + out.line("size.dialog.button_height", len(*button_height)); + let PageSizes { column, margin, action, button, button_side, gap, link } = page; + out.line("size.page.column", len(*column)); + out.line("size.page.margin", len(*margin)); + out.line("size.page.action", len(*action)); + out.line("size.page.button", len(*button)); + out.line("size.page.button_side", len(*button_side)); + let PageGaps { title, lead, actions, section, heading, link: link_gap } = gap; + out.line("size.page.gap.title", len(*title)); + out.line("size.page.gap.lead", len(*lead)); + out.line("size.page.gap.actions", len(*actions)); + out.line("size.page.gap.section", len(*section)); + out.line("size.page.gap.heading", len(*heading)); + out.line("size.page.gap.link", len(*link_gap)); + out.line("size.page.link", len(*link)); } fn slot(s: FontSlot) -> &'static str { diff --git a/crates/theme/src/lib.rs b/crates/theme/src/lib.rs index ad90903550..be1ca97ab0 100644 --- a/crates/theme/src/lib.rs +++ b/crates/theme/src/lib.rs @@ -98,9 +98,9 @@ pub use token_group::{GroupValues, TokenGroup}; pub use tokens::{ AccentColors, BarSizes, CaptionColors, ColorToken, ColorTokens, ControlSizes, DataColors, DialogSizes, DockColumnSizes, Edge, EdgeColors, ElevationTokens, FloatSizes, FontSlot, Gaps, GripMark, GripShape, HandleSizes, HitSizes, IconSizes, Insets, KnobShape, LengthSizes, LetterCase, - LineColors, LocatorShape, Motion, MotionTokens, OverlayColors, Pads, PaneSizes, PlotSizes, RadiusSet, RailSizes, RampSizes, RowSizes, - ShapeTokens, SizeTokens, SpaceTokens, StateColors, Status, StatusColors, StatusKind, StrokeTokens, SurfaceColors, TextColors, ThumbSamples, - ThumbSizes, Tokens, TypeRole, TypeStyle, TypeTokens, WellShape, WindowSizes, + LineColors, LocatorShape, Motion, MotionTokens, OverlayColors, Pads, PageGaps, PageSizes, PaneSizes, PlotSizes, RadiusSet, RailSizes, RampSizes, + RowSizes, ShapeTokens, SizeTokens, SpaceTokens, StateColors, Status, StatusColors, StatusKind, StrokeTokens, SurfaceColors, TextColors, + ThumbSamples, ThumbSizes, Tokens, TypeRole, TypeStyle, TypeTokens, WellShape, WindowSizes, }; pub use values::ColorSource; pub use variant::{CustomVariant, Emphasis, RadiusStep, Variant, VariantLook}; diff --git a/crates/theme/src/sizes.rs b/crates/theme/src/sizes.rs index c3f8025ad2..958483b8e2 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; @@ -132,6 +133,7 @@ pub(crate) fn leaves(b: &mut Preset) -> Vec> { "base.size.length.number.sm" Num 32.0..=512.0 => s.length.number.sm; "base.size.length.number.md" Num 32.0..=512.0 => s.length.number.md; "base.size.row.text" Num 12.0..=48.0 => s.row.text; + "base.size.row.menu" Num 16.0..=64.0 => s.row.menu; "base.size.groove" Num 0.25..=16.0 => s.groove; "base.size.ramp.bar" Num 1.0..=64.0 => s.ramp.bar; "base.size.ramp.groove" Num 0.25..=32.0 => s.ramp.groove; @@ -146,6 +148,19 @@ pub(crate) fn leaves(b: &mut Preset) -> Vec> { "base.size.dialog.wrap" Num 120.0..=1024.0 => s.dialog.wrap; "base.size.dialog.button" Num 24.0..=240.0 => s.dialog.button; "base.size.dialog.side_button" Num 24.0..=240.0 => s.dialog.side_button; + "base.size.dialog.button_height" Num 16.0..=64.0 => s.dialog.button_height; + "base.size.page.column" Num 240.0..=2048.0 => s.page.column; + "base.size.page.margin" Num 0.0..=240.0 => s.page.margin; + "base.size.page.action" Num 16.0..=96.0 => s.page.action; + "base.size.page.button" Num 16.0..=96.0 => s.page.button; + "base.size.page.button_side" Num 0.0..=64.0 => s.page.button_side; + "base.size.page.gap.title" Num 0.0..=64.0 => s.page.gap.title; + "base.size.page.gap.lead" Num 0.0..=64.0 => s.page.gap.lead; + "base.size.page.gap.actions" Num 0.0..=64.0 => s.page.gap.actions; + "base.size.page.gap.section" Num 0.0..=64.0 => s.page.gap.section; + "base.size.page.gap.heading" Num 0.0..=64.0 => s.page.gap.heading; + "base.size.page.gap.link" Num 0.0..=64.0 => s.page.gap.link; + "base.size.page.link" Num 0.0..=96.0 => s.page.link; } let sp = &mut b.space; leaves! { out; @@ -159,6 +174,7 @@ pub(crate) fn leaves(b: &mut Preset) -> Vec> { "base.space.gap.card_row" Num 0.0..=32.0 => sp.gap.card_row; "base.space.pad.control" Num 0.0..=32.0 => sp.pad.control; "base.space.pad.regular" Num 0.0..=32.0 => sp.pad.regular; + "base.space.pad.dialog" Num 0.0..=48.0 => sp.pad.dialog; "base.space.pad.roomy" Num 0.0..=32.0 => sp.pad.roomy; "base.space.pad.chip" Num 0.0..=32.0 => sp.pad.chip; "base.space.pad.segment" Num 0.0..=32.0 => sp.pad.segment; diff --git a/crates/theme/src/tokens/color.rs b/crates/theme/src/tokens/color.rs index 35e7a7916d..601d964651 100644 --- a/crates/theme/src/tokens/color.rs +++ b/crates/theme/src/tokens/color.rs @@ -55,6 +55,8 @@ pub struct SurfaceColors { /// The dots or grid an app may draw on the canvas outside the document. Equal to `canvas` (no /// pattern) unless the theme sets it. pub canvas_pattern: Rgba, + /// A full-window page with no document open (a start page); follows `canvas` unless pinned. + pub page: Rgba, /// Panels, bars and rails. pub panel: Rgba, /// Window chrome: title bars, toolbars, option bars, rulers and scrollbar tracks; follows @@ -322,6 +324,7 @@ impl ColorTokens { background: c, canvas: c, canvas_pattern: c, + page: c, panel: c, chrome: c, raised: c, @@ -436,6 +439,8 @@ color_tokens! { SurfaceCanvas = "surface.canvas" => surface.canvas; /// `surface.canvas_pattern` SurfaceCanvasPattern = "surface.canvas_pattern" => surface.canvas_pattern; + /// `surface.page` + SurfacePage = "surface.page" => surface.page; /// `surface.panel` SurfacePanel = "surface.panel" => surface.panel; /// `surface.chrome` @@ -657,14 +662,15 @@ impl ColorToken { /// (`surface.*` except `scrim` and `shadow`); those must be opaque. pub const fn is_opaque_surface(self) -> bool { use ColorToken::{ - SurfaceBackground, SurfaceCanvas, SurfaceCanvasPattern, SurfaceChrome, SurfaceInverse, SurfaceKnob, SurfacePanel, SurfaceRaised, - SurfaceSunken, + SurfaceBackground, SurfaceCanvas, SurfaceCanvasPattern, SurfaceChrome, SurfaceInverse, SurfaceKnob, SurfacePage, SurfacePanel, + SurfaceRaised, SurfaceSunken, }; matches!( self, SurfaceBackground | SurfaceCanvas | SurfaceCanvasPattern + | SurfacePage | SurfaceChrome | SurfacePanel | SurfaceRaised diff --git a/crates/theme/src/tokens/size.rs b/crates/theme/src/tokens/size.rs index bd4f69b9c6..bf7dd9f88f 100644 --- a/crates/theme/src/tokens/size.rs +++ b/crates/theme/src/tokens/size.rs @@ -176,8 +176,11 @@ pub struct Gaps { pub struct Pads { /// Inside controls. pub control: f32, - /// Inside panels and default dialog frames. + /// Inside panels. pub regular: f32, + /// Inside default dialog frames. An app that sets `space.pad.regular` and not this keeps its dialogs padded as its + /// panels are. + pub dialog: f32, /// Inside roomy dialogs. pub roomy: f32, /// Inside badges, key caps and chips: tighter than a control. @@ -259,6 +262,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. @@ -310,6 +315,46 @@ pub struct SizeTokens { pub dock: DockColumnSizes, /// Dialogs: their content width and their buttons. pub dialog: DialogSizes, + /// Full-window pages. + pub page: PageSizes, +} + +/// The sizes of a full-window page (a start page), in logical pixels. +#[derive(Clone, Copy, Debug, Default, PartialEq)] +pub struct PageSizes { + /// The widest a page's centred column of content grows; a narrower room keeps the page's margin at each side. + pub column: f32, + /// The room above and below a page's centred column. + pub margin: f32, + /// The height of a page's call to action (`ControlPlace::CallToAction`). + pub action: f32, + /// The height of a page's New and Open (`ControlPlace::PageAction`). An app that sets `size.button` and not this + /// keeps them a push button high. + pub button: f32, + /// The least room at each side of a page action's label; 0 keeps a push button's. + pub button_side: f32, + /// A page's rhythm, each following the gap it stands in for unless an app sets it (`Gap::Page*`). + pub gap: PageGaps, + /// The least height of a page's link row; 0 keeps a link its text's height. + pub link: f32, +} + +/// The gaps of a full-window page's column, in logical pixels (`Gap::PageTitle` and its siblings). The size sets give +/// each the value of the gap it follows, so a page keeps that rhythm unless an app sets its own. +#[derive(Clone, Copy, Debug, Default, PartialEq)] +pub struct PageGaps { + /// Between the title and the subtitle (follows `space.gap.tight`). + pub title: f32, + /// Between the title and subtitle and New and Open under them (follows `space.gap.section`). + pub lead: f32, + /// Between New and Open (follows `space.gap.stack`). + pub actions: f32, + /// Between the column's sections (follows `space.gap.section`). + pub section: f32, + /// Between a section's heading and its body (follows `space.gap.stack`). + pub heading: f32, + /// Between the links (follows `space.gap.stack`). + pub link: f32, } /// The sizes of the panes of a dock's split, in logical pixels. @@ -337,6 +382,9 @@ pub struct DialogSizes { pub wrap: f32, /// The least width of a footer button. pub button: f32, + /// The height of a footer button. An app that sets `size.button` and not this keeps its footer buttons a push + /// button high. + pub button_height: f32, /// The least width of a button in a column beside the body. pub side_button: f32, } @@ -396,6 +444,8 @@ pub struct RowSizes { /// The height of a row that shows text only: one body line and `space.gap.tight`. Read-only display tables (a /// metadata table) take it; rows the user picks from stay a control high. pub text: f32, + /// The height of a menu's row. An app that sets `size.control.md` and not this keeps its menu rows a control high. + pub menu: f32, } /// Thicknesses of gradient ramps, in logical pixels. diff --git a/crates/theme/src/values.rs b/crates/theme/src/values.rs index f99b78b45f..dc77ea1382 100644 --- a/crates/theme/src/values.rs +++ b/crates/theme/src/values.rs @@ -197,6 +197,7 @@ pub(super) fn source(token: ColorToken, mode: Mode) -> ColorSource { T::SurfaceBackground => Anchored(pick(2, 3)), T::SurfaceCanvas => Same(T::SurfaceBackground), T::SurfaceCanvasPattern => Same(T::SurfaceCanvas), + T::SurfacePage => Same(T::SurfaceCanvas), T::SurfacePanel => Neutral(panel_step(mode)), T::SurfaceChrome => Same(T::SurfacePanel), T::SurfaceRaised => Anchored(pick(4, 1)), 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 b5eaff10fa..8e5eec51b5 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #222226ff surface.canvas = #1d1d20ff surface.canvas_pattern = #1d1d20ff +surface.page = #1d1d20ff surface.panel = #36363aff surface.chrome = #2e2e32ff surface.raised = #404044ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 8a000a8b1d..9616b41a3e 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #222226ff surface.canvas = #1d1d20ff surface.canvas_pattern = #1d1d20ff +surface.page = #1d1d20ff surface.panel = #36363aff surface.chrome = #2e2e32ff surface.raised = #404044ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 b60c4660eb..99d598503e 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #222226ff surface.canvas = #1d1d20ff surface.canvas_pattern = #1d1d20ff +surface.page = #1d1d20ff surface.panel = #36363aff surface.chrome = #2e2e32ff surface.raised = #39393eff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 d9ba4d191c..bb3adeb54f 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-dark-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #222226ff surface.canvas = #1d1d20ff surface.canvas_pattern = #1d1d20ff +surface.page = #1d1d20ff surface.panel = #36363aff surface.chrome = #2e2e32ff surface.raised = #39393eff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 67ca889771..bfd4c2a4b7 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #ebebedff surface.canvas = #dededfff surface.canvas_pattern = #dededfff +surface.page = #dededfff surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 b257a262ae..428f4679ef 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #ebebedff surface.canvas = #dededfff surface.canvas_pattern = #dededfff +surface.page = #dededfff surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 e719821b56..bd0d5c8362 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #ebebedff surface.canvas = #dededfff surface.canvas_pattern = #dededfff +surface.page = #dededfff surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 e5b785c851..63cc0e1092 100644 --- a/crates/theme/tests/dumps/tokens/adwaita-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/adwaita-light-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #ebebedff surface.canvas = #dededfff surface.canvas_pattern = #dededfff +surface.page = #dededfff surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 b163cd46e5..8e05869def 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #424242ff surface.canvas = #282828ff surface.canvas_pattern = #282828ff +surface.page = #282828ff surface.panel = #535353ff surface.chrome = #535353ff surface.raised = #595959ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 78438edcea..c5164ff6f3 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #424242ff surface.canvas = #282828ff surface.canvas_pattern = #282828ff +surface.page = #282828ff surface.panel = #535353ff surface.chrome = #535353ff surface.raised = #595959ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 5c79aa8c02..83cde1b4d3 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #424242ff surface.canvas = #282828ff surface.canvas_pattern = #282828ff +surface.page = #282828ff surface.panel = #535353ff surface.chrome = #535353ff surface.raised = #5c5c5cff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 0eeec55f30..bf6f479d76 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-dark-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #424242ff surface.canvas = #282828ff surface.canvas_pattern = #282828ff +surface.page = #282828ff surface.panel = #535353ff surface.chrome = #535353ff surface.raised = #5c5c5cff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 1f42323960..7ae732239c 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #e2e2e2ff surface.canvas = #d6d6d6ff surface.canvas_pattern = #d6d6d6ff +surface.page = #d6d6d6ff surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 08b18dcb03..f4055162b0 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #e2e2e2ff surface.canvas = #d6d6d6ff surface.canvas_pattern = #d6d6d6ff +surface.page = #d6d6d6ff surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 3314537cb2..5de1b1d40b 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #e2e2e2ff surface.canvas = #d6d6d6ff surface.canvas_pattern = #d6d6d6ff +surface.page = #d6d6d6ff surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 eb4d771525..22c786c1bc 100644 --- a/crates/theme/tests/dumps/tokens/artcraft-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/artcraft-light-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #e2e2e2ff surface.canvas = #d6d6d6ff surface.canvas_pattern = #d6d6d6ff +surface.page = #d6d6d6ff surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 019465e5b7..da8de6122e 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #1a1d22ff surface.canvas = #111418ff surface.canvas_pattern = #111418ff +surface.page = #111418ff surface.panel = #1d2126ff surface.chrome = #262a30ff surface.raised = #272b30ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 e3c630e045..4dbde9f9df 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #1a1d22ff surface.canvas = #111418ff surface.canvas_pattern = #111418ff +surface.page = #111418ff surface.panel = #1d2126ff surface.chrome = #262a30ff surface.raised = #272b30ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 187f4c5ce0..d48eaefff7 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #1a1d22ff surface.canvas = #111418ff surface.canvas_pattern = #111418ff +surface.page = #111418ff surface.panel = #1d2126ff surface.chrome = #262a30ff surface.raised = #272b30ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 f8fd665768..6250cbd212 100644 --- a/crates/theme/tests/dumps/tokens/breeze-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-dark-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #1a1d22ff surface.canvas = #111418ff surface.canvas_pattern = #111418ff +surface.page = #111418ff surface.panel = #1d2126ff surface.chrome = #262a30ff surface.raised = #272b30ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 affaf06b7d..89a38d3fe0 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #e0e3e7ff surface.canvas = #dbdee2ff surface.canvas_pattern = #dbdee2ff +surface.page = #dbdee2ff surface.panel = #eceef1ff surface.chrome = #dbdee2ff surface.raised = #f2f4f7ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 f97279220e..1d3a65eee2 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #e0e3e7ff surface.canvas = #dbdee2ff surface.canvas_pattern = #dbdee2ff +surface.page = #dbdee2ff surface.panel = #eceef1ff surface.chrome = #dbdee2ff surface.raised = #f2f4f7ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 8f8452ffd6..d6ca71d5f9 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #e0e3e7ff surface.canvas = #dbdee2ff surface.canvas_pattern = #dbdee2ff +surface.page = #dbdee2ff surface.panel = #eceef1ff surface.chrome = #dbdee2ff surface.raised = #f2f4f7ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 9aab1e6438..ebc7d71b49 100644 --- a/crates/theme/tests/dumps/tokens/breeze-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/breeze-light-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #e0e3e7ff surface.canvas = #dbdee2ff surface.canvas_pattern = #dbdee2ff +surface.page = #dbdee2ff surface.panel = #eceef1ff surface.chrome = #dbdee2ff surface.raised = #f2f4f7ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 0313c28fa2..61cb69af23 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #d4d0c8ff surface.canvas = #808080ff surface.canvas_pattern = #808080ff +surface.page = #808080ff surface.panel = #d4d0c8ff surface.chrome = #d4d0c8ff surface.raised = #d4d0c8ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 6ed815f020..0ca15ed942 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #d4d0c8ff surface.canvas = #808080ff surface.canvas_pattern = #808080ff +surface.page = #808080ff surface.panel = #d4d0c8ff surface.chrome = #d4d0c8ff surface.raised = #d4d0c8ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 2db3097b89..5af6b006e3 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #d4d0c8ff surface.canvas = #808080ff surface.canvas_pattern = #808080ff +surface.page = #808080ff surface.panel = #d4d0c8ff surface.chrome = #d4d0c8ff surface.raised = #d4d0c8ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 c92767dd02..245919d79c 100644 --- a/crates/theme/tests/dumps/tokens/classic-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/classic-light-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #d4d0c8ff surface.canvas = #808080ff surface.canvas_pattern = #808080ff +surface.page = #808080ff surface.panel = #d4d0c8ff surface.chrome = #d4d0c8ff surface.raised = #d4d0c8ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 28d5675410..460784c315 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #19191cff surface.canvas = #19191cff surface.canvas_pattern = #19191cff +surface.page = #19191cff surface.panel = #26262aff surface.chrome = #26262aff surface.raised = #2e2e33ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 2d37c60ae4..a623008439 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #19191cff surface.canvas = #19191cff surface.canvas_pattern = #19191cff +surface.page = #19191cff surface.panel = #26262aff surface.chrome = #26262aff surface.raised = #2e2e33ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 fdf074abbf..d7843dc149 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #19191cff surface.canvas = #19191cff surface.canvas_pattern = #19191cff +surface.page = #19191cff surface.panel = #26262aff surface.chrome = #26262aff surface.raised = #2e2e33ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 468c79fe5a..cd4a1b9db4 100644 --- a/crates/theme/tests/dumps/tokens/graphite-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-dark-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #19191cff surface.canvas = #19191cff surface.canvas_pattern = #19191cff +surface.page = #19191cff surface.panel = #26262aff surface.chrome = #26262aff surface.raised = #2e2e33ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 99e16fa51f..6cabc69b57 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #f1f1f3ff surface.canvas = #f1f1f3ff surface.canvas_pattern = #f1f1f3ff +surface.page = #f1f1f3ff surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 33ef213208..dec4dfff76 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #f1f1f3ff surface.canvas = #f1f1f3ff surface.canvas_pattern = #f1f1f3ff +surface.page = #f1f1f3ff surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 95f7b8108a..fbddb2096e 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #f1f1f3ff surface.canvas = #f1f1f3ff surface.canvas_pattern = #f1f1f3ff +surface.page = #f1f1f3ff surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 801ed81a71..7fcbd0bef1 100644 --- a/crates/theme/tests/dumps/tokens/graphite-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/graphite-light-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #f1f1f3ff surface.canvas = #f1f1f3ff surface.canvas_pattern = #f1f1f3ff +surface.page = #f1f1f3ff surface.panel = #ffffffff surface.chrome = #ffffffff surface.raised = #ffffffff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 3b2c32d0be..ad3eab959b 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #1e1e1eff surface.canvas = #282828ff surface.canvas_pattern = #282828ff +surface.page = #282828ff surface.panel = #323232ff surface.chrome = #323232ff surface.raised = #3c3c3cff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 34b9d99bc0..ff40e11024 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #1e1e1eff surface.canvas = #282828ff surface.canvas_pattern = #282828ff +surface.page = #282828ff surface.panel = #323232ff surface.chrome = #323232ff surface.raised = #3c3c3cff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 2964d6953d..1b8d7c24de 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 @@ -2,6 +2,7 @@ surface.background = #1e1e1eff surface.canvas = #282828ff surface.canvas_pattern = #282828ff +surface.page = #282828ff surface.panel = #323232ff surface.chrome = #323232ff surface.raised = #3c3c3cff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 14 +space.pad.dialog = 14 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 28 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 28 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 28 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 721a51aee8..b3ddcedb95 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #1e1e1eff surface.canvas = #282828ff surface.canvas_pattern = #282828ff +surface.page = #282828ff surface.panel = #323232ff surface.chrome = #323232ff surface.raised = #3c3c3cff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 a87e51dfc5..ee02262150 100644 --- a/crates/theme/tests/dumps/tokens/pro-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-dark-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #1e1e1eff surface.canvas = #282828ff surface.canvas_pattern = #282828ff +surface.page = #282828ff surface.panel = #323232ff surface.chrome = #323232ff surface.raised = #3c3c3cff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 8e58298270..300b3802f1 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 @@ -2,6 +2,7 @@ surface.background = #a8a8a8ff surface.canvas = #a0a0a0ff surface.canvas_pattern = #a0a0a0ff +surface.page = #a0a0a0ff surface.panel = #b8b8b8ff surface.chrome = #b8b8b8ff surface.raised = #bdbdbdff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 9b37c7232e..27db441dd3 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 @@ -2,6 +2,7 @@ surface.background = #a8a8a8ff surface.canvas = #a0a0a0ff surface.canvas_pattern = #a0a0a0ff +surface.page = #a0a0a0ff surface.panel = #b8b8b8ff surface.chrome = #b8b8b8ff surface.raised = #bdbdbdff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 42a059da1b..4e2d60d87b 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 @@ -2,6 +2,7 @@ surface.background = #a8a8a8ff surface.canvas = #a0a0a0ff surface.canvas_pattern = #a0a0a0ff +surface.page = #a0a0a0ff surface.panel = #b8b8b8ff surface.chrome = #b8b8b8ff surface.raised = #bdbdbdff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 9b0726cbb1..da83865dea 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 @@ -2,6 +2,7 @@ surface.background = #a8a8a8ff surface.canvas = #a0a0a0ff surface.canvas_pattern = #a0a0a0ff +surface.page = #a0a0a0ff surface.panel = #b8b8b8ff surface.chrome = #b8b8b8ff surface.raised = #bdbdbdff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 c0f710bf68..6ffb292cbd 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #e2e2e2ff surface.canvas = #d6d6d6ff surface.canvas_pattern = #d6d6d6ff +surface.page = #d6d6d6ff surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 522f29b1a2..ca70e2b4c7 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #e2e2e2ff surface.canvas = #d6d6d6ff surface.canvas_pattern = #d6d6d6ff +surface.page = #d6d6d6ff surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 4fe12a7b49..4255d49a8f 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #e2e2e2ff surface.canvas = #d6d6d6ff surface.canvas_pattern = #d6d6d6ff +surface.page = #d6d6d6ff surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 8e31eb40bf..35e3129d2d 100644 --- a/crates/theme/tests/dumps/tokens/pro-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/pro-light-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #e2e2e2ff surface.canvas = #d6d6d6ff surface.canvas_pattern = #d6d6d6ff +surface.page = #d6d6d6ff surface.panel = #f0f0f0ff surface.chrome = #f0f0f0ff surface.raised = #f6f6f6ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 8efbfd674d..a20c41bb74 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #2f2f38ff surface.canvas = #282830ff surface.canvas_pattern = #282830ff +surface.page = #282830ff surface.panel = #363640ff surface.chrome = #3a3a44ff surface.raised = #40404bff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 c8af3713c6..2f8c94d2d8 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #2f2f38ff surface.canvas = #282830ff surface.canvas_pattern = #282830ff +surface.page = #282830ff surface.panel = #363640ff surface.chrome = #3a3a44ff surface.raised = #40404bff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 6097578157..190a24b654 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #2f2f38ff surface.canvas = #282830ff surface.canvas_pattern = #282830ff +surface.page = #282830ff surface.panel = #363640ff surface.chrome = #3a3a44ff surface.raised = #40404bff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 1061081192..f0f435aef1 100644 --- a/crates/theme/tests/dumps/tokens/soft-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-dark-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #2f2f38ff surface.canvas = #282830ff surface.canvas_pattern = #282830ff +surface.page = #282830ff surface.panel = #363640ff surface.chrome = #3a3a44ff surface.raised = #40404bff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 6b0daad252..586c299641 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #e2e0e7ff surface.canvas = #dad8e0ff surface.canvas_pattern = #dad8e0ff +surface.page = #dad8e0ff surface.panel = #f0eef3ff surface.chrome = #e8e6ecff surface.raised = #f6f4f9ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 537bc28778..1dd2cd15fc 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #e2e0e7ff surface.canvas = #dad8e0ff surface.canvas_pattern = #dad8e0ff +surface.page = #dad8e0ff surface.panel = #f0eef3ff surface.chrome = #e8e6ecff surface.raised = #f6f4f9ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 8444a1ac84..55eb9f36d9 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #e2e0e7ff surface.canvas = #dad8e0ff surface.canvas_pattern = #dad8e0ff +surface.page = #dad8e0ff surface.panel = #f0eef3ff surface.chrome = #e8e6ecff surface.raised = #f6f4f9ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 a04cf2103c..eb99cd7c7f 100644 --- a/crates/theme/tests/dumps/tokens/soft-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/soft-light-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #e2e0e7ff surface.canvas = #dad8e0ff surface.canvas_pattern = #dad8e0ff +surface.page = #dad8e0ff surface.panel = #f0eef3ff surface.chrome = #e8e6ecff surface.raised = #f6f4f9ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 bdf0aa48b0..f50ae9a4dd 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 @@ -2,6 +2,7 @@ surface.background = #00252fff surface.canvas = #002b36ff surface.canvas_pattern = #0a3d4aff +surface.page = #002b36ff surface.panel = #073642ff surface.chrome = #073642ff surface.raised = #15414dff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 2503ac48d3..53eca4a616 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 @@ -2,6 +2,7 @@ surface.background = #00252fff surface.canvas = #002b36ff surface.canvas_pattern = #0a3d4aff +surface.page = #002b36ff surface.panel = #073642ff surface.chrome = #073642ff surface.raised = #15414dff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 3bb3d5d0ae..4bf8a58b61 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 @@ -2,6 +2,7 @@ surface.background = #00252fff surface.canvas = #002b36ff surface.canvas_pattern = #0a3d4aff +surface.page = #002b36ff surface.panel = #073642ff surface.chrome = #073642ff surface.raised = #15414dff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 15bd64f3a3..c150d533e0 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 @@ -2,6 +2,7 @@ surface.background = #00252fff surface.canvas = #002b36ff surface.canvas_pattern = #0a3d4aff +surface.page = #002b36ff surface.panel = #073642ff surface.chrome = #073642ff surface.raised = #15414dff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 86fa0e5143..bddceef55a 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #111112ff surface.canvas = #0e0e0fff surface.canvas_pattern = #2e2e32ff +surface.page = #0e0e0fff surface.panel = #1a1a1cff surface.chrome = #141415ff surface.raised = #232325ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 cc37776b2c..3e147fa7eb 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #111112ff surface.canvas = #0e0e0fff surface.canvas_pattern = #2e2e32ff +surface.page = #0e0e0fff surface.panel = #1a1a1cff surface.chrome = #141415ff surface.raised = #232325ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 9e4fd3748a..a692592aaf 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #111112ff surface.canvas = #0e0e0fff surface.canvas_pattern = #2e2e32ff +surface.page = #0e0e0fff surface.panel = #1a1a1cff surface.chrome = #141415ff surface.raised = #232325ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 cf28125ba8..6a3459b130 100644 --- a/crates/theme/tests/dumps/tokens/studio-dark-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-dark-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #111112ff surface.canvas = #0e0e0fff surface.canvas_pattern = #2e2e32ff +surface.page = #0e0e0fff surface.panel = #1a1a1cff surface.chrome = #141415ff surface.raised = #232325ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 bee113924d..f786d932ac 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-high-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-high-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #f0f0f3ff surface.canvas = #e2e2e6ff surface.canvas_pattern = #c8c8ceff +surface.page = #e2e2e6ff surface.panel = #fcfcfdff surface.chrome = #f6f6f8ff surface.raised = #ffffffff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 b30c62c8b1..097cc1014a 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-high-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-high-compact.txt @@ -2,6 +2,7 @@ surface.background = #f0f0f3ff surface.canvas = #e2e2e6ff surface.canvas_pattern = #c8c8ceff +surface.page = #e2e2e6ff surface.panel = #fcfcfdff surface.chrome = #f6f6f8ff surface.raised = #ffffffff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 93b0f384bb..495a587635 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-standard-comfortable.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-standard-comfortable.txt @@ -2,6 +2,7 @@ surface.background = #f0f0f3ff surface.canvas = #e2e2e6ff surface.canvas_pattern = #c8c8ceff +surface.page = #e2e2e6ff surface.panel = #fcfcfdff surface.chrome = #f6f6f8ff surface.raised = #ffffffff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 bad4578f5b..37cefe8908 100644 --- a/crates/theme/tests/dumps/tokens/studio-light-standard-compact.txt +++ b/crates/theme/tests/dumps/tokens/studio-light-standard-compact.txt @@ -2,6 +2,7 @@ surface.background = #f0f0f3ff surface.canvas = #e2e2e6ff surface.canvas_pattern = #c8c8ceff +surface.page = #e2e2e6ff surface.panel = #fcfcfdff surface.chrome = #f6f6f8ff surface.raised = #ffffffff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 ee47af893f..f6cc4664aa 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 @@ -2,6 +2,7 @@ surface.background = #0b0d12ff surface.canvas = #101217ff surface.canvas_pattern = #101217ff +surface.page = #13161cff surface.panel = #181b22ff surface.chrome = #181b22ff surface.raised = #21242cff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 bcfcb2970c..0d4bc1a574 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 @@ -2,6 +2,7 @@ surface.background = #0b0d12ff surface.canvas = #101217ff surface.canvas_pattern = #101217ff +surface.page = #13161cff surface.panel = #181b22ff surface.chrome = #181b22ff surface.raised = #21242cff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 0b1c8870ce..4f34ee8570 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 @@ -2,6 +2,7 @@ surface.background = #0b0d12ff surface.canvas = #101217ff surface.canvas_pattern = #101217ff +surface.page = #13161cff surface.panel = #181b22ff surface.chrome = #181b22ff surface.raised = #21242cff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 d13e94d03f..0016d3b8f5 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 @@ -2,6 +2,7 @@ surface.background = #0b0d12ff surface.canvas = #101217ff surface.canvas_pattern = #101217ff +surface.page = #13161cff surface.panel = #181b22ff surface.chrome = #181b22ff surface.raised = #21242cff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 f3a2666a29..2909929b10 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 @@ -2,6 +2,7 @@ surface.background = #e6e9eeff surface.canvas = #dfe3e9ff surface.canvas_pattern = #dfe3e9ff +surface.page = #e9ecf1ff surface.panel = #f3f5f8ff surface.chrome = #f3f5f8ff surface.raised = #f9fbfeff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 9233c07eca..deff824ff2 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 @@ -2,6 +2,7 @@ surface.background = #e6e9eeff surface.canvas = #dfe3e9ff surface.canvas_pattern = #dfe3e9ff +surface.page = #e9ecf1ff surface.panel = #f3f5f8ff surface.chrome = #f3f5f8ff surface.raised = #f9fbfeff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 f4bc397bb1..66e454fbe6 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 @@ -2,6 +2,7 @@ surface.background = #e6e9eeff surface.canvas = #dfe3e9ff surface.canvas_pattern = #dfe3e9ff +surface.page = #e9ecf1ff surface.panel = #f3f5f8ff surface.chrome = #f3f5f8ff surface.raised = #f9fbfeff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 281b3a0aa7..3eaea40da3 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 @@ -2,6 +2,7 @@ surface.background = #e6e9eeff surface.canvas = #dfe3e9ff surface.canvas_pattern = #dfe3e9ff +surface.page = #e9ecf1ff surface.panel = #f3f5f8ff surface.chrome = #f3f5f8ff surface.raised = #f9fbfeff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 59a517959d..1535dfa222 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 @@ -2,6 +2,7 @@ surface.background = #1b1f27ff surface.canvas = #1e222aff surface.canvas_pattern = #1e222aff +surface.page = #21262fff surface.panel = #272c36ff surface.chrome = #272c36ff surface.raised = #313640ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 2d2d840faf..f58bb3abc0 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 @@ -2,6 +2,7 @@ surface.background = #1b1f27ff surface.canvas = #1e222aff surface.canvas_pattern = #1e222aff +surface.page = #21262fff surface.panel = #272c36ff surface.chrome = #272c36ff surface.raised = #313640ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 d6c8136658..66dad0b281 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 @@ -2,6 +2,7 @@ surface.background = #1b1f27ff surface.canvas = #1e222aff surface.canvas_pattern = #1e222aff +surface.page = #21262fff surface.panel = #272c36ff surface.chrome = #272c36ff surface.raised = #313640ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 aeda88b611..55361654ae 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 @@ -2,6 +2,7 @@ surface.background = #1b1f27ff surface.canvas = #1e222aff surface.canvas_pattern = #1e222aff +surface.page = #21262fff surface.panel = #272c36ff surface.chrome = #272c36ff surface.raised = #313640ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 bd8464d80c..13c9020bf3 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 @@ -2,6 +2,7 @@ surface.background = #c4cad4ff surface.canvas = #b9c0cbff surface.canvas_pattern = #b9c0cbff +surface.page = #c9cfd8ff surface.panel = #d3d8e0ff surface.chrome = #d3d8e0ff surface.raised = #d9dee6ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 8eb261539b..e6da117635 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 @@ -2,6 +2,7 @@ surface.background = #c4cad4ff surface.canvas = #b9c0cbff surface.canvas_pattern = #b9c0cbff +surface.page = #c9cfd8ff surface.panel = #d3d8e0ff surface.chrome = #d3d8e0ff surface.raised = #d9dee6ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 bc821f3e69..eb6164ff38 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 @@ -2,6 +2,7 @@ surface.background = #c4cad4ff surface.canvas = #b9c0cbff surface.canvas_pattern = #b9c0cbff +surface.page = #c9cfd8ff surface.panel = #d3d8e0ff surface.chrome = #d3d8e0ff surface.raised = #d9dee6ff @@ -136,6 +137,7 @@ space.gap.card_column = 16 space.gap.card_row = 24 space.pad.control = 8 space.pad.regular = 12 +space.pad.dialog = 12 space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 120 size.length.number.sm = 72 size.length.number.md = 90 size.row.text = 21 +size.row.menu = 30 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 30 +size.page.column = 820 +size.page.margin = 50 +size.page.action = 30 +size.page.button = 30 +size.page.button_side = 0 +size.page.gap.title = 3 +size.page.gap.lead = 16 +size.page.gap.actions = 8 +size.page.gap.section = 16 +size.page.gap.heading = 8 +size.page.gap.link = 8 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 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 6f1c1139ac..9c39c4f922 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 @@ -2,6 +2,7 @@ surface.background = #c4cad4ff surface.canvas = #b9c0cbff surface.canvas_pattern = #b9c0cbff +surface.page = #c9cfd8ff surface.panel = #d3d8e0ff surface.chrome = #d3d8e0ff surface.raised = #d9dee6ff @@ -136,6 +137,7 @@ space.gap.card_column = 12 space.gap.card_row = 18 space.pad.control = 6 space.pad.regular = 8 +space.pad.dialog = 8 space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 @@ -159,6 +161,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 @@ -184,6 +187,7 @@ size.length.short = 96 size.length.number.sm = 60 size.length.number.md = 72 size.row.text = 18 +size.row.menu = 24 size.groove = 3 size.ramp.bar = 10 size.ramp.groove = 5 @@ -198,6 +202,19 @@ size.dialog.least = 380 size.dialog.wrap = 440 size.dialog.button = 84 size.dialog.side_button = 96 +size.dialog.button_height = 24 +size.page.column = 820 +size.page.margin = 40 +size.page.action = 24 +size.page.button = 24 +size.page.button_side = 0 +size.page.gap.title = 2 +size.page.gap.lead = 12 +size.page.gap.actions = 6 +size.page.gap.section = 12 +size.page.gap.heading = 6 +size.page.gap.link = 6 +size.page.link = 0 stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 diff --git a/crates/theme/themes/vectorcraft-modern-medium.json b/crates/theme/themes/vectorcraft-modern-medium.json index 68af21f498..45029c879f 100644 --- a/crates/theme/themes/vectorcraft-modern-medium.json +++ b/crates/theme/themes/vectorcraft-modern-medium.json @@ -47,6 +47,7 @@ "surface.background": "#c4cad4", "surface.canvas": "#b9c0cb", "surface.control": "#c9d0da", + "surface.page": "#c9cfd8", "surface.panel": "#d3d8e0", "surface.sunken": "#e9ecf1", "text.disabled": "#7d8594", @@ -70,6 +71,7 @@ "surface.background": "#1b1f27", "surface.canvas": "#1e222a", "surface.control": "#39404d", + "surface.page": "#21262f", "surface.panel": "#272c36", "surface.sunken": "#1a1e26", "text.disabled": "#626b7a", diff --git a/crates/theme/themes/vectorcraft-modern.json b/crates/theme/themes/vectorcraft-modern.json index f7c93b4ef9..c33372ae3e 100644 --- a/crates/theme/themes/vectorcraft-modern.json +++ b/crates/theme/themes/vectorcraft-modern.json @@ -47,6 +47,7 @@ "surface.background": "#e6e9ee", "surface.canvas": "#dfe3e9", "surface.control": "#e3e7ed", + "surface.page": "#e9ecf1", "surface.panel": "#f3f5f8", "surface.sunken": "#ffffff", "text.disabled": "#9aa1ad", @@ -70,6 +71,7 @@ "surface.background": "#0b0d12", "surface.canvas": "#101217", "surface.control": "#282d37", + "surface.page": "#13161c", "surface.panel": "#181b22", "surface.sunken": "#0f1116", "text.disabled": "#5a6271", diff --git a/crates/ui-canvas/src/canvas/scrollbars/mod.rs b/crates/ui-canvas/src/canvas/scrollbars/mod.rs index f0d190d33b..f4e30e5e3f 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) } } @@ -547,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(); diff --git a/crates/ui-canvas/tests/it/full_window_parts.rs b/crates/ui-canvas/tests/it/full_window_parts.rs index 6dd2626e62..fa25222cc7 100644 --- a/crates/ui-canvas/tests/it/full_window_parts.rs +++ b/crates/ui-canvas/tests/it/full_window_parts.rs @@ -362,6 +362,58 @@ pub(crate) mod own_window { assert!(!open.get(), "closing the dialog's window closes the dialog"); assert_eq!(closed.get(), Some((CloseReason::Requested, true)), "the close is a cancel"); } + + /// photocraft#16905: in a window the app frames, a full-window dialog's own window moves by its title row. Its + /// fallback covers the main window and does not move, and the window took that rule, so RAW Develop's window could + /// not be moved. + #[trial] + fn a_full_window_dialogs_own_window_moves_by_its_title_row() { + use craft_host::target::{Backend, Os, ShellInfo, WindowKind}; + use craft_ui::runtime::InstallSpec; + use craft_ui::testing::pointer::{moved, press, release}; + use craft_ui::testing::windows::FakeSystem; + use craft_window::policy::{Desktop, DesktopKind, Runtime, TitleBarPref}; + use egui::{Pos2, Rect, Vec2, ViewportCommand, pos2, vec2}; + use std::sync::Arc; + + let desktop = Desktop { kind: DesktopKind::Other, ssd: None, gtk_theme: None, icon_theme: None }; + let integrated = + craft_window::policy::decide(Os::Linux, Runtime::Native, Backend::X11, &desktop, WindowKind::Main, TitleBarPref::Integrated, None); + let windows = Windows::with(InstallSpec::new(ShellInfo::default(), Arc::new(FakeSystem::new())).frame(integrated)); + let open = Cell::new(true); + let frame = |events: Vec| { + windows.frame(vec![], events, |ui| { + let mut is_open = open.get(); + FullWindowDialog::new("Workspace").own_window(WindowSpec::dialog()).opened(Bind::bound(&mut is_open)).show(ui, |_, _| {}); + open.set(is_open); + }) + }; + let rect = Rect::from_min_size(Pos2::new(100.0, 100.0), Vec2::new(900.0, 640.0)); + windows.child_info(ViewportInfo { + inner_rect: Some(rect), + outer_rect: Some(rect), + native_pixels_per_point: Some(1.0), + ..ViewportInfo::default() + }); + for _ in 0..4 { + frame(vec![]); + } + // Clear of the top edge's grip and of the title row's own parts (the title at the start, the close action at + // the end). + let at = pos2(450.0, 14.0); + let mut sent = Vec::new(); + for events in [ + vec![moved(at)], + vec![press(at)], + vec![moved(at + vec2(20.0, 10.0))], + vec![moved(at + vec2(40.0, 20.0))], + vec![release(at + vec2(40.0, 20.0))], + ] { + sent.extend(frame(events).commands.into_iter().map(|(_, command)| command)); + } + assert!(open.get(), "the dialog stays open"); + assert!(sent.contains(&ViewportCommand::StartDrag), "a drag of the title row moves the window: {sent:?}"); + } } /// An overlay drawn through a frame. 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 diff --git a/crates/ui-contract/src/contract/body/regions.rs b/crates/ui-contract/src/contract/body/regions.rs index a02bea21bb..5b4025a61e 100644 --- a/crates/ui-contract/src/contract/body/regions.rs +++ b/crates/ui-contract/src/contract/body/regions.rs @@ -52,6 +52,7 @@ pub fn pad_of(tokens: &UiTokens, pad: Pad) -> f32 { Pad::Tight => tokens.tokens().space.gap.tight, Pad::Control => pads.control, Pad::Regular => pads.regular, + Pad::Dialog => pads.dialog, Pad::Roomy => pads.roomy, Pad::Page => pads.roomy * 2.5, _ => 0.0, @@ -136,7 +137,7 @@ impl Gap { } pub(super) fn gap_of(tokens: &UiTokens, gap: Gap) -> f32 { - let gaps = &tokens.tokens().space.gap; + let (gaps, page) = (&tokens.tokens().space.gap, &tokens.tokens().size.page.gap); match gap { Gap::None => 0.0, Gap::Tight => gaps.tight, @@ -146,6 +147,12 @@ pub(super) fn gap_of(tokens: &UiTokens, gap: Gap) -> f32 { Gap::CardColumn => gaps.card_column, Gap::CardRow => gaps.card_row, Gap::Inline => gaps.inline, + Gap::PageTitle => page.title, + Gap::PageLead => page.lead, + Gap::PageActions => page.actions, + Gap::PageSection => page.section, + Gap::PageHeading => page.heading, + Gap::PageLink => page.link, _ => gaps.row, } } diff --git a/crates/ui-contract/src/contract/body/window.rs b/crates/ui-contract/src/contract/body/window.rs index 79eb032b4d..087510715e 100644 --- a/crates/ui-contract/src/contract/body/window.rs +++ b/crates/ui-contract/src/contract/body/window.rs @@ -795,11 +795,16 @@ impl BodyHooks<'_> { }; let exclusive = |hit: WindowHit| os.is_some().then_some(hit); let moves_window = matches!(&props.mount, Mount::Layer(overlay) | Mount::Viewport { fallback: overlay, .. } if overlay.moves_window); + // A full-window container in an OS window of its own: its fallback layer covers the main window, so neither + // moves nor resizes, but the window is one the user moves by its title row and sizes by its edges, as any + // window. Without them a window the app frames had no band and no grips (photocraft#16905). + let own_full_window = os.is_some() && matches!(&props.mount, Mount::Viewport { fallback, .. } if fallback.is_full_window()); // A layer moves when its overlay says so; other mounts follow the header's band. let movable = match &props.mount { // A band that moves the window below follows the rule of the window's own band (a title bar's); where the // platform answers the hit test, the sink reads it from the exclusive list. _ if moves_window => WindowParts::of(&ctx, pass::current_viewport(&ctx)).band, + _ if own_full_window => stands.band, Mount::Layer(overlay) | Mount::Viewport { fallback: overlay, .. } => overlay.movable && stands.band, _ => props.header.is_some_and(|header| header.band == crate::contract::DragBand::Move) && stands.band, }; @@ -810,8 +815,9 @@ impl BodyHooks<'_> { // areas cover its ends and top edge, and a cursor set over them fights the OS's. let moved = os.or(moves_window.then(|| pass::current_viewport(&ctx))); let os_bar = moved.is_some_and(|viewport| windows::shell_of(&ctx, viewport).window.chrome == WindowChrome::Inset); + let hand = pcx.env.get::() == crate::contract::MoveBandCursor::Hand; let mut part = pcx.part(MOVE_BAND, band).sense(craft_behavior::Sense::DRAG).pointer_only(reason); - if !os_bar { + if !os_bar && hand { part = part.cursor(CursorIcon::Grab).drag_cursor(CursorIcon::Grabbing); } if let Some(hit) = exclusive(WindowHit::Move).or(moves_window.then_some(WindowHit::Move)) { @@ -825,6 +831,7 @@ impl BodyHooks<'_> { } } let edges = match &props.mount { + _ if own_full_window => ResizeEdges::ALL, Mount::Layer(overlay) | Mount::Viewport { fallback: overlay, .. } => overlay.resize.edges, Mount::Window { resize } => resize.edges, _ => ResizeEdges::NONE, diff --git a/crates/ui-contract/src/contract/container.rs b/crates/ui-contract/src/contract/container.rs index cb3bef55fd..877b18a967 100644 --- a/crates/ui-contract/src/contract/container.rs +++ b/crates/ui-contract/src/contract/container.rs @@ -138,6 +138,8 @@ pub enum Pad { Control, /// `space.pad.regular`. Regular, + /// `space.pad.dialog`: a dialog frame. + Dialog, /// `space.pad.roomy`. Roomy, /// A full-window page's margin around its content: two and a half roomy pads (40 pt in the compact set), as a @@ -335,6 +337,20 @@ pub enum QuietHeader { Heads, } +/// The cursor over a header's move band ([`DragBand::Move`]). An app sets it once at its root (`RootEnv::values`); the +/// default is `Hand`. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, crate::runtime::env::EnvValue, crate::contract::MemoProps)] +#[env(style)] +#[non_exhaustive] +pub enum MoveBandCursor { + /// The open hand, and the closed hand while the band is dragged. + #[default] + Hand, + /// The arrow, as an OS title bar shows, also over the click-only controls on the band (menu titles, buttons): + /// production VectorCraft's title bar and panel headers. + Arrow, +} + /// A header region, filled by `Container::header`. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[non_exhaustive] @@ -779,6 +795,18 @@ pub enum Gap { CardRow, /// `space.gap.inline`: between groups of tools in a rail. Inline, + /// `size.page.gap.title`: between a page's title and its subtitle. + PageTitle, + /// `size.page.gap.lead`: between a page's title and subtitle and the actions under them. + PageLead, + /// `size.page.gap.actions`: between a page's New and Open. + PageActions, + /// `size.page.gap.section`: between the sections of a page's column. + PageSection, + /// `size.page.gap.heading`: between a page section's heading and its body. + PageHeading, + /// `size.page.gap.link`: between a page's links. + PageLink, } /// Set by a menu for its body: a horizontal divider takes `space.gap.inline` above and below its line, since the rows diff --git a/crates/ui-contract/src/contract/editor.rs b/crates/ui-contract/src/contract/editor.rs index 78e8e9e13a..d20a202b6e 100644 --- a/crates/ui-contract/src/contract/editor.rs +++ b/crates/ui-contract/src/contract/editor.rs @@ -72,7 +72,10 @@ pub(crate) fn run(cx: &mut Cx<'_, C>, ui: &mut Ui, step: &mut supe } let (ctx, id) = (cx.core.ctx.clone(), cx.core.id); let widget = ImeSurface::of(id, decl.key).widget(); - let focused = egui_editor::show(ui, widget, decl.rect, egui_focus::event_filter(keys.keep, false)); + let focusable = super::steps::takes_focus(cx.core.resolved); + let focused = egui_editor::show(ui, widget, decl.rect, egui_focus::event_filter(keys.keep, false), focusable); + // The focus widget is the component's, enabled or not: it is never one of the app's own widgets (`take_app_widgets`). + crate::runtime::pointer::record_text_widget(&ctx, widget, id); let read_only = cx.core.resolved.read_only || !cx.core.resolved.enabled; let mut inputs: Vec<(Order, EditorInput)> = Vec::new(); if focused { diff --git a/crates/ui-contract/src/contract/mod.rs b/crates/ui-contract/src/contract/mod.rs index 60c7bfd0c1..9e6f708120 100644 --- a/crates/ui-contract/src/contract/mod.rs +++ b/crates/ui-contract/src/contract/mod.rs @@ -69,8 +69,8 @@ pub use container::InBar; pub use container::InMenu; pub use container::{ BandFill, Bracket, Collapse, ContainerProps, DragBand, EndRegion, FooterPlace, FooterRegion, Gap, HeaderEdge, HeaderParts, HeaderRegion, - LeastWidth, Mount, Notch, POPUP_PAD, Pad, PadEdges, PaneEdge, QuietHeader, Scroll, ScrollAnchor, ScrollAxes, ScrollIndicator, SectionRhythm, - ShellPane, Sizing, ThemeScope, WrapWidth, + LeastWidth, Mount, MoveBandCursor, Notch, POPUP_PAD, Pad, PadEdges, PaneEdge, QuietHeader, Scroll, ScrollAnchor, ScrollAxes, ScrollIndicator, + SectionRhythm, ShellPane, Sizing, ThemeScope, WrapWidth, }; pub use craft_tracked::{PlainData, Revision, Tracked}; pub use craft_ui_macros::{CommandSet, Component, Pattern, PlainData, Props, register_contract}; diff --git a/crates/ui-contract/src/runtime/egui/areas.rs b/crates/ui-contract/src/runtime/egui/areas.rs index 090a019ecd..1a30412836 100644 --- a/crates/ui-contract/src/runtime/egui/areas.rs +++ b/crates/ui-contract/src/runtime/egui/areas.rs @@ -380,7 +380,9 @@ pub(crate) fn show_cover_layer(ctx: &Context, cover: CoverLayer) { sizing = ui.is_sizing_pass(); for rect in covered { ui.painter().rect_filled(rect, 0.0, scrim); - let absorber = ui.allocate_rect(rect, Sense::click_and_drag()); + // It absorbs presses and never takes key focus: a focusable egui widget no component made is a Tab stop + // of the app's own (`focus::take_app_widgets`). + let absorber = ui.allocate_rect(rect, Sense::CLICK | Sense::DRAG); crate::runtime::egui::widgets::note_widget(ui.ctx(), absorber.id); crate::runtime::egui::access::hide(ui.ctx(), absorber.id); } @@ -430,6 +432,11 @@ pub(crate) fn move_to_top(ctx: &Context, layer: LayerId) { ctx.move_to_top(layer); } +/// Whether egui showed `layer` in the last pass. +pub(crate) fn visible_last_frame(ctx: &Context, layer: LayerId) -> bool { + ctx.memory(|memory| memory.areas().visible_last_frame(&layer)) +} + /// Makes `layer` the modal layer of the running pass: layers below it take no input. pub(crate) fn set_modal_layer(ctx: &Context, layer: LayerId) { ctx.memory_mut(|memory| memory.set_modal_layer(layer)); @@ -544,6 +551,30 @@ pub(crate) fn host_popup(ui: &Ui, id: egui::Id, at: Pos2) { egui::Popup::new(id, ui.ctx().clone(), at, ui.layer_id()).open_memory(None).show(|ui| ui.allocate_space(ui.spacing().interact_size)); } +/// The size of one entry of [`host_popup_list`], as an app's popup list entry. +#[cfg(feature = "suite")] +const HOST_LIST_ENTRY: Vec2 = Vec2::new(104.0, 22.0); + +/// A host's own popup list `id` at `at`, as an app draws one: an egui foreground area with one clickable entry per id +/// in `entries`, stacked from the top. It leaves arrow keys to egui's directional focus. Returns the entries' rects. +#[cfg(feature = "suite")] +pub(crate) fn host_popup_list(ctx: &Context, id: Id, at: Pos2, entries: &[Id]) -> Vec { + egui::Area::new(id) + .order(Order::Foreground) + .fixed_pos(at) + .show(ctx, |ui| { + let mut rects = Vec::new(); + for (row, &entry) in entries.iter().enumerate() { + let rect = Rect::from_min_size(at + Vec2::Y * (HOST_LIST_ENTRY.y * row as f32), HOST_LIST_ENTRY); + ui.allocate_rect(rect, Sense::hover()); + let _ = ui.interact(rect, entry, Sense::click()); + rects.push(rect); + } + rects + }) + .inner +} + /// Opens the host's egui popup `id`. #[cfg(feature = "suite")] pub(crate) fn open_host_popup(ctx: &Context, id: egui::Id) { diff --git a/crates/ui-contract/src/runtime/egui/editor.rs b/crates/ui-contract/src/runtime/egui/editor.rs index e1824adda2..63e618eede 100644 --- a/crates/ui-contract/src/runtime/egui/editor.rs +++ b/crates/ui-contract/src/runtime/egui/editor.rs @@ -4,9 +4,11 @@ use egui::{EventFilter, Id, Rect, Ui}; /// Registers the editor's focus widget over `rect` and applies `filter` while it holds focus; returns whether it holds -/// focus. -pub(crate) fn show(ui: &mut Ui, id: Id, rect: Rect, filter: EventFilter) -> bool { - let response = ui.interact(rect, id, egui::Sense::focusable_noninteractive()); +/// focus. The widget is one of egui's focus candidates only while `focusable` (its component takes focus), so neither +/// Tab nor egui's arrows reach the editor of a disabled component. +pub(crate) fn show(ui: &mut Ui, id: Id, rect: Rect, filter: EventFilter, focusable: bool) -> bool { + let sense = if focusable { egui::Sense::focusable_noninteractive() } else { egui::Sense::hover() }; + let response = ui.interact(rect, id, sense); let focused = response.has_focus(); if focused { ui.memory_mut(|memory| memory.set_focus_lock_filter(id, filter)); diff --git a/crates/ui-contract/src/runtime/egui/fixture.rs b/crates/ui-contract/src/runtime/egui/fixture.rs index 197e5cccc2..c7a8eca3e6 100644 --- a/crates/ui-contract/src/runtime/egui/fixture.rs +++ b/crates/ui-contract/src/runtime/egui/fixture.rs @@ -517,6 +517,13 @@ pub(crate) fn host_field(ui: &mut Ui, id: egui::Id, text: &mut String) -> Rect { ui.add(egui::TextEdit::singleline(text).id(id)).rect } +/// A host's own multi-line egui text field of `id` over `text` that locks focus, as a code editor of the app's own: +/// its egui key filter keeps Tab, which it types. +#[cfg(feature = "suite")] +pub(crate) fn host_code_field(ui: &mut Ui, id: egui::Id, text: &mut String) -> Rect { + ui.add(egui::TextEdit::multiline(text).id(id).lock_focus(true)).rect +} + /// A host's own text editor of `id` at `rect`, as a canvas text tool draws it: it reads the IME events from egui's /// input into `text` (a commit appends, a deletion before the caret removes characters from its end) and writes the /// pass's IME output, context generation 1. @@ -543,17 +550,23 @@ pub(crate) fn host_ime_editor(ui: &Ui, id: egui::Id, rect: Rect, text: &mut Stri pub(crate) struct ResettingEditor { pub(crate) text: String, pub(crate) composing: bool, - /// The reset the editor asked for at a press during its composition, until its completion arrives; the editor - /// takes no IME event meanwhile. + /// The reset the editor asked for last, until its completion arrives; the editor takes no IME event meanwhile. pub(crate) reset: Option, + /// The editor also writes its request into its IME output's `reset_request`. Otherwise it leaves that field to egui, + /// which publishes the request asked through `Context::request_ime_reset`, as EffectCraft's editor does. + pub(crate) in_output: bool, + /// Ask for a reset at the next pass, as EffectCraft's editor does when its caret moves after an outside press. + pub(crate) ask: bool, } /// A host's own text editor of `id` at `rect` that fences its own interrupted composition, as EffectCraft's viewer text -/// editor does: a primary press while it composes ends the composition and asks the platform for a reset in its own IME -/// output, and the editor ignores IME events until that reset's completion. Otherwise as [`host_ime_editor`]. +/// editor does: a primary press on it while it composes ends the composition and asks the platform for a reset, and the +/// editor ignores IME events until that reset's completion. A press elsewhere asks for nothing. Otherwise as +/// [`host_ime_editor`]. #[cfg(feature = "suite")] pub(crate) fn host_resetting_ime_editor(ui: &Ui, id: egui::Id, rect: Rect, editor: &mut ResettingEditor) { let _ = ui.interact(rect, id, egui::Sense::click()); + let pressed = ui.input(|input| input.pointer.primary_pressed() && input.pointer.press_origin().is_some_and(|at| rect.contains(at))); for event in ui.input(|input| input.events.clone()) { match event { Event::ImeResetCompleted { request_id } if editor.reset == Some(request_id) => editor.reset = None, @@ -572,11 +585,14 @@ pub(crate) fn host_resetting_ime_editor(ui: &Ui, id: egui::Id, rect: Rect, edito } } let mut ime = egui::output::IMEOutput::new(id, 1, egui::IMEPurpose::Normal, rect, rect); - if editor.composing && ui.input(|input| input.pointer.primary_pressed()) { + let interrupted = editor.composing && pressed; + if interrupted || std::mem::take(&mut editor.ask) { editor.composing = false; editor.reset = ui.ctx().request_ime_reset(ui.ctx().viewport_id()); - ime.should_interrupt_composition = true; - ime.reset_request = editor.reset; + ime.should_interrupt_composition = interrupted; + if editor.in_output { + ime.reset_request = editor.reset; + } } ui.ctx().output_mut(|output| output.ime = Some(ime)); } diff --git a/crates/ui-contract/src/runtime/egui/focus.rs b/crates/ui-contract/src/runtime/egui/focus.rs index f0f6b7fe54..0941e5d433 100644 --- a/crates/ui-contract/src/runtime/egui/focus.rs +++ b/crates/ui-contract/src/runtime/egui/focus.rs @@ -27,6 +27,17 @@ pub(crate) fn focused(ctx: &Context) -> Option { ctx.memory(|memory| memory.focused()) } +/// egui's focus candidates of the running pass from the `seen`th on (`Memory::focus_candidates`): the widgets +/// interested in key focus, in the order they registered. +pub(crate) fn candidates_since(ctx: &Context, seen: usize) -> Vec { + ctx.memory(|memory| memory.focus_candidates().get(seen..).map(<[_]>::to_vec).unwrap_or_default()) +} + +/// Whether the widget egui holds key focus on keeps Tab by its event filter (`Memory::focus_lock_filter`). +pub(crate) fn focused_keeps_tab(ctx: &Context) -> bool { + ctx.memory(|memory| memory.focus_lock_filter()).is_some_and(|filter| filter.tab) +} + /// Whether egui holds a label text selection, which egui copies on a copy or cut event. pub(crate) fn label_selection(ctx: &Context) -> bool { ctx.with_plugin::(|state| state.has_selection()).unwrap_or(false) @@ -57,9 +68,9 @@ pub(crate) fn surrender(ctx: &Context, id: Id) { } /// H7: egui's begin pass set a focus direction from an unmodified arrow or the Tab it kept. The focus service clears -/// it before any component runs unless egui focus is on an app's own widget (`FocusedRecord::host_focus`), or the -/// key stage left a Tab to egui in a window with no focus stop, and the service moves no focus in the pass: egui would -/// otherwise move focus off a framework stop that the same arrow reaches as an intent. +/// it before any component runs unless egui focus is on an app's own widget (`FocusedRecord::host_focus`) and the +/// service moves no focus in the pass: egui would otherwise move focus off a framework stop that the same arrow +/// reaches as an intent. pub(crate) fn clear_directional_focus(ctx: &Context) { ctx.memory_mut(|memory| memory.move_focus(FocusDirection::None)); } diff --git a/crates/ui-contract/src/runtime/egui/ime.rs b/crates/ui-contract/src/runtime/egui/ime.rs index 71fd378600..b06c469fae 100644 --- a/crates/ui-contract/src/runtime/egui/ime.rs +++ b/crates/ui-contract/src/runtime/egui/ime.rs @@ -78,6 +78,9 @@ pub(crate) struct Output { pub caret: Rect, /// Interrupt the OS composition and ask for a reset. pub interrupt: bool, + /// The reset request the app's own editor asked for this pass (`app_reset`), which an interrupt publishes instead + /// of asking a new one: egui keeps one unpublished request per viewport, so a new one would replace the app's. + pub app_reset: Option, /// The context generation the tracker gave the owner: it changes when the owner, its epoch, its focus or its /// purpose changes, and stays for ordinary edits. pub generation: u64, @@ -89,9 +92,10 @@ pub(crate) struct Output { } /// Writes the pass's IME output; egui reads it only when it is `Some` at the end of the pass. Returns the reset -/// request an interrupt published: its completion is the one that matches (`None` when the ids ran out). +/// request an interrupt published, the app's own when it asked for one: its completion is the one that matches +/// (`None` when the ids ran out). pub(crate) fn write(ctx: &Context, viewport: ViewportId, out: Output) -> Option { - let reset = out.interrupt.then(|| ctx.request_ime_reset(viewport)).flatten(); + let reset = out.interrupt.then(|| out.app_reset.or_else(|| ctx.request_ime_reset(viewport))).flatten(); ctx.output_mut(|output| { let mut ime = egui::output::IMEOutput::new( out.owner, @@ -109,12 +113,18 @@ pub(crate) fn write(ctx: &Context, viewport: ViewportId, out: Output) -> Option< reset } +/// The reset request the app asked for this pass, as egui publishes it at the end of the pass: one asked through +/// `Context::request_ime_reset`, which replaces the IME output's own `reset_request`, or else the one the app wrote +/// there. +pub(crate) fn app_reset(ctx: &Context, viewport: ViewportId) -> Option { + ctx.pending_ime_reset(viewport).or_else(|| ctx.output(|output| output.ime.as_ref().and_then(|ime| ime.reset_request))) +} + /// Interrupts the composition of the IME output the app's own editor wrote this pass, in its context, and asks for a -/// reset. An editor that asked for its own reset in that output keeps its request, so the platform answers the app's -/// id and the app gets its completion. Returns the reset request the output carries, as `write` does. -pub(crate) fn interrupt_written(ctx: &Context, viewport: ViewportId) -> Option { - let written = ctx.output(|output| output.ime.as_ref().and_then(|ime| ime.reset_request)); - let reset = written.or_else(|| ctx.request_ime_reset(viewport)); +/// reset. An editor that asked for its own reset this pass (`app`, from `app_reset`) keeps its request, so the platform +/// answers the app's id and the app gets its completion. Returns the reset request the output carries, as `write` does. +pub(crate) fn interrupt_written(ctx: &Context, viewport: ViewportId, app: Option) -> Option { + let reset = app.or_else(|| ctx.request_ime_reset(viewport)); ctx.output_mut(|output| { if let Some(ime) = &mut output.ime { ime.should_interrupt_composition = true; diff --git a/crates/ui-contract/src/runtime/focus.rs b/crates/ui-contract/src/runtime/focus.rs index 727aacf990..7cdd0fe54d 100644 --- a/crates/ui-contract/src/runtime/focus.rs +++ b/crates/ui-contract/src/runtime/focus.rs @@ -76,7 +76,8 @@ pub(crate) struct FocusedRecord { pub(crate) claims: Vec, /// The component of the focused stop: only its state-dependent claims hold. pub(crate) focused: Option, - /// The focused stop is the app's own egui widget (`Stop::host`): it reads the presses it claims from egui. + /// The focused stop is the app's own egui widget (`Stop::host`: one of the app's focusable egui widgets, or its + /// canvas): it reads the presses it claims from egui. pub(crate) host: bool, /// The arena root of the focused stop when the stop is a non-text member of an arena (a part of a canvas's frame /// overlay): the root's state-dependent claims hold too, so a canvas tool's keys work with a part focused. @@ -96,11 +97,18 @@ pub(crate) struct FocusedRecord { /// focused. pub(crate) canvas: Option, /// egui focus is on a widget no framework component made, or an egui popup is open, and no framework press or - /// drag is captured: an app's own focused widget or popup keeps the keys a focused component keeps (Tab, Escape, - /// the clipboard events). Written by the end hook after its focus moves. + /// drag is captured: an app's own focused widget or popup keeps the keys a focused component keeps (Escape, the + /// plain Enter, the clipboard events), and no window intent comes of them. Written by the end hook after its focus + /// moves. pub(crate) foreign: bool, - /// egui focus is on a widget no framework component made, and no framework press or drag is captured: egui - /// moves focus among the app's own widgets with the arrows and the Tab it keeps. Written by the end hook. + /// A bare Tab is egui's: an egui popup is open (`foreign`), or egui focus is on the app's own widget and its egui + /// key filter keeps Tab (a multi-line text edit that locks focus, a code editor). Any other bare Tab is the + /// framework's move over its one order, which holds the app's widgets (`take_app_widgets`). Written by the end + /// hook. + pub(crate) tab_in_egui: bool, + /// egui focus is on a widget no framework component made (`State::app_widget`: its stop of the app's own does not + /// count, the app's canvas does), and no framework press or drag is captured: egui moves focus among the app's own + /// widgets with the arrows. Written by the end hook. pub(crate) host_focus: bool, /// `host_focus`, on a text edit the app drew itself. Written by the end hook. pub(crate) host_text: bool, @@ -141,6 +149,8 @@ pub(crate) struct RowGroups { pub(crate) struct State { pub(crate) stops: Vec, stop_ids: IdSet, + /// The egui roots of `stops`. + stop_roots: IdSet, pub(crate) last_stops: Vec, pub(crate) scopes: FastMap, pub(crate) last_scopes: FastMap, @@ -181,8 +191,9 @@ pub(crate) struct State { /// The stop focus last moved onto, the frame whose passes see the move, and what moved it there. It stays until focus /// moves again: while the stop keeps the focus, it is how the stop got it (`origin`). pub(super) arrived: Option<(u64, StopKey, FocusOrigin)>, - /// The running pass's begin hook left a Tab to egui (`NavKeys::tab_to_egui`); its end hook takes it. - pub(super) tab_to_egui: bool, + /// How many of egui's focus candidates of the running pass (`Memory::focus_candidates`) `take_app_widgets` has + /// read. + pub(super) candidates_seen: usize, /// A text widget that gave its Escape on to the enclosing scopes and lets focus go at the end of the pass. surrender_after_scopes: Option, /// A text widget in a scope that gives focus back to its opener, held one more pass: the scope the Escape closes is @@ -223,36 +234,92 @@ pub(crate) fn apply(ctx: &Context, acts: Vec) { } } -/// Registers a stop of the running pass in the innermost open scope, in registration order. +/// Registers a stop of the running pass in the innermost open scope, in registration order: after the app's own +/// widgets drawn before it (`take_app_widgets`). The app's own widget `stop` names (`host_canvas`) takes the place of +/// its stop as one of those widgets, if the pass took it already. pub(crate) fn register_stop(ctx: &Context, stop: Stop) { + take_app_widgets(ctx, Some(stop.root)); let acts = with(ctx, |state| { - let scope = state.open.last().map(|(id, _)| *id); - state.stop_ids.insert(stop.id); + if stop.host + && let Some(rec) = state.stops.iter_mut().find(|rec| rec.stop.host && rec.stop.id == stop.id) + { + state.stop_roots.insert(stop.root); + rec.stop = stop; + return Vec::new(); + } + state.push_stop(stop) + }); + apply(ctx, acts); +} + +impl State { + /// Appends `stop` to the running pass's stops in the innermost open scope; it takes the focus a request of the pass + /// awaits for it. + fn push_stop(&mut self, stop: Stop) -> Vec { + let scope = self.open.last().map(|(id, _)| *id); + self.stop_ids.insert(stop.id); + self.stop_roots.insert(stop.root); let rec = StopRec { stop, scope, group_position: false }; - let acts = if state.awaited == Some(rec.stop.key()) { - state.awaited = None; - state.focus_stop(rec.clone()) + let acts = if self.awaited == Some(rec.stop.key()) { + self.awaited = None; + self.focus_stop(rec.clone()) } else { Vec::new() }; - state.stops.push(rec); + self.stops.push(rec); + acts + } +} + +/// Registers the app's own egui widgets that egui listed as focus candidates since the last take of the running pass +/// (`Memory::focus_candidates`, in the order they registered with egui), each as a stop of the app's own +/// (`Stop::host`) with the keys of a pointer control, a text stop for a text edit: every focusable egui widget the app +/// draws is a Tab and F6 stop among the framework's, where it was drawn. A widget a component made is none: its +/// component registers its stops (`pointer::made_by_component`, or the root of a stop of the pass), and so is +/// `except`, the root of the stop being registered. Every registration that depends on order takes them first, and +/// the end hook takes the last ones, so a stop range (`mark`, `stop_count`) holds the app's widgets drawn in it. +fn take_app_widgets(ctx: &Context, except: Option) { + let seen = with(ctx, |state| state.candidates_seen); + let fresh = egui_focus::candidates_since(ctx, seen); + if fresh.is_empty() { + return; + } + let viewport = viewport(ctx); + let app: Vec = fresh + .iter() + .filter(|candidate| Some(candidate.id) != except && !crate::runtime::pointer::made_by_component(ctx, viewport, candidate.id)) + .copied() + .collect(); + let acts = with(ctx, |state| { + state.candidates_seen = seen + fresh.len(); + let mut acts = Vec::new(); + for candidate in app { + if state.stop_roots.contains(&candidate.id) { + continue; + } + let stop = Stop::new(candidate.id, KeyUse::of(craft_behavior::Input::Pointer)).host(); + acts.extend(state.push_stop(if candidate.text { stop.text() } else { stop })); + } acts }); apply(ctx, acts); } -/// Registers the app's own egui widget `id`, drawn in the running pass, as its window's document canvas: a focus stop -/// with `keys`, marked as the canvas (`KeyUse::chrome_key`). The window then shows a document, so with +/// Registers the app's own egui widget `id`, drawn in the running pass, as its window's document canvas: its focus stop +/// takes `keys` and is marked as the canvas (`KeyUse::chrome_key`), in place of the stop it has as one of the app's +/// focusable egui widgets, at the same place in Tab order. The window then shows a document, so with /// `RootEnv::tab_toggles_chrome` a bare Tab with nothing focused toggles its panels, as with a framework canvas. Focus /// reaches the canvas by Tab, F6, `request` or the app's own egui focus request; while it has focus, Tab and the arrows /// route as `keys` says (the arrows as nudges, Tab moving focus on or toggling the panels unless it keeps Tab). `keys` /// is `KeyUse::CANVAS`, or a variant such as `KeyUse::CANVAS.with_keep(KeepKeys::Tab).with_edits(..)` while Tab and the /// clipboard are the canvas's own. The canvas reads its keys from egui: with nothing focused it is the key target, and -/// a bare Tab it keeps, the chords it claims (`KeyUse::with_claims`; Alt+numpad code entry leaves a claimed Alt+digit -/// alone), and the clipboard events and edit chords of its edit set stay in egui's input for the app, and nothing -/// toggles or fires with them; Page Up and Down, Home and End arrive as its `Intent::Move`, as while it has the focus. -/// With the canvas focused, the same keys stay in egui, and Escape too, as for any focused widget of the app's own; -/// Escape with nothing focused is the window's cancel. Call it each pass the canvas shows. +/// the chords it claims (`KeyUse::with_claims`; Alt+numpad code entry leaves a claimed Alt+digit alone) and the +/// clipboard events and edit chords of its edit set stay in egui's input for the app, and nothing toggles or fires with +/// them; Page Up and Down, Home and End arrive as its `Intent::Move`, as while it has the focus. A bare Tab with nothing +/// focused is never the canvas's, even when it keeps Tab: it moves focus into the window or toggles the panels, so the +/// canvas cannot trap keyboard navigation. With the canvas focused, the same keys stay in egui, a Tab it keeps and +/// Escape too, as for any focused widget of the app's own; Escape with nothing focused is the window's cancel. Call it +/// each pass the canvas shows. pub fn host_canvas(ctx: &Context, id: Id, keys: KeyUse) { register_stop(ctx, Stop::new(id, keys.with_chrome_key(true)).host()); } @@ -282,18 +349,17 @@ pub(crate) fn is_canvas_member(ctx: &Context, rec: &StopRec) -> bool { }) } -/// Whether a bare Tab in `viewport` is egui's own focus move: the window registered no framework stop in its last pass, -/// only stops of the app's own egui widgets (`Stop::host`) if any, which egui's Tab order holds with the app's other -/// widgets; and egui held no focus at the end of that pass, or held it on one of those stops. A framework move would -/// reach the host stops alone. Read by the input hook, before the begin hook rotates the registrations. -pub(crate) fn tab_is_egui_s(ctx: &Context, viewport: ViewportId) -> bool { - with_viewport(ctx, viewport, |state| { - state.stops.iter().all(|rec| rec.stop.host) && state.focus_now.is_none_or(|id| state.stops.iter().any(|rec| rec.stop.root == id)) - }) +/// Whether a bare Tab in `viewport` has no stop to move the focus to: the window's last pass registered no stop (the +/// app's focusable egui widgets are stops too, `take_app_widgets`) and nothing held the focus at its end. Such a Tab +/// stays in egui's input for the app's own binding. Read by the input hook, before the begin hook rotates the +/// registrations. +pub(crate) fn tab_has_no_stop(ctx: &Context, viewport: ViewportId) -> bool { + with_viewport(ctx, viewport, |state| state.stops.is_empty() && state.focus_now.is_none()) } /// How many stops the running pass has registered so far. pub(crate) fn stop_count(ctx: &Context) -> usize { + take_app_widgets(ctx, None); with(ctx, |state| state.stops.len()) } @@ -379,6 +445,7 @@ impl Eq for Transcript {} /// Where the running pass's registrations stand. pub(crate) fn mark(ctx: &Context) -> Mark { + take_app_widgets(ctx, None); with(ctx, |state| Mark { stops: state.stops.len(), scopes: state.scope_order.len(), @@ -389,6 +456,7 @@ pub(crate) fn mark(ctx: &Context) -> Mark { /// What the running pass registered since `mark`, which a run that closed every scope it opened left. pub(crate) fn transcript(ctx: &Context, mark: Mark) -> Transcript { + take_app_widgets(ctx, None); with(ctx, |state| { let stops = state.stops.get(mark.stops..).unwrap_or_default().to_vec(); let scopes = state.scope_order.get(mark.scopes..).unwrap_or_default(); @@ -407,6 +475,7 @@ pub(crate) fn transcript(ctx: &Context, mark: Mark) -> Transcript { /// Registers `transcript` again in the running pass, in place of the run that left it: in the innermost open scope, /// as the run would have. A replayed scope is no new scope: it moves no focus when it shows again. pub(crate) fn replay(ctx: &Context, transcript: &Transcript) { + take_app_widgets(ctx, None); let frame = crate::runtime::egui::pass::frame_nr(ctx, viewport(ctx)); let focused = egui_focus::focused(ctx); with(ctx, |state| { @@ -423,6 +492,7 @@ pub(crate) fn replay(ctx: &Context, transcript: &Transcript) { } for rec in placed.stops { state.stop_ids.insert(rec.stop.id); + state.stop_roots.insert(rec.stop.root); state.stops.push(rec); } for group in placed.groups { @@ -447,6 +517,7 @@ pub(crate) fn has_reachable_stop(ctx: &Context, id: Id) -> bool { /// Where a request for the component `id` goes when it has no stop of its own: the first stop registered since /// `from` (a `stop_count`), which a component inside it holds. pub(crate) fn first_stop_inside(ctx: &Context, id: Id, from: usize) -> Option { + take_app_widgets(ctx, None); with(ctx, |state| { if state.stop_ids.contains(&id) { return None; @@ -480,6 +551,7 @@ pub(crate) fn focus_in(ctx: &Context, range: std::ops::Range) -> bool { /// order, then the footer's, then the header's, and initial focus goes to the first of them, not to the title /// row's close action. The first mark of a pass stands. pub(crate) fn begin_body(ctx: &Context) { + take_app_widgets(ctx, None); with(ctx, |state| { if let Some((scope, _)) = state.open.last().copied() { let at = state.stops.len(); @@ -543,6 +615,7 @@ pub(crate) fn push_scope_from( closing: bool, entering: Option, ) { + take_app_widgets(ctx, None); let focused = egui_focus::focused(ctx); with(ctx, |state| { let parent = state.open.last().map(|(parent, _)| *parent); @@ -574,6 +647,7 @@ pub fn open_scope(ctx: &Context) -> Option { /// Closes the innermost open scope. A scope pushed for the first time (or again after a gap of a frame) /// moves focus to its initial stop, in this pass. pub(crate) fn pop_scope(ctx: &Context) { + take_app_widgets(ctx, None); let frame = crate::runtime::egui::pass::frame_nr(ctx, viewport(ctx)); let acts = with(ctx, |state| { nav::order_regions(state); @@ -1005,17 +1079,15 @@ pub(crate) fn begin(ctx: &Context, tab_all_controls: bool, dialog_tab: TabReach) dialog_tab, frame: crate::runtime::egui::pass::frame_nr(ctx, viewport(ctx)), }; - let tab_to_egui = input.nav.tab_to_egui; let (acts, announcements, host_focus) = with(ctx, |state| { state.awaited = None; let host_focus = state.record.host_focus; - state.tab_to_egui = tab_to_egui; let (acts, announcements) = nav::begin(state, input); (acts, announcements, host_focus) }); - // egui's direction moves focus from the widget it holds, an app's own, or with a Tab the key stage left to egui - // (from nothing or a host stop); never in a pass whose focus the framework moves. - if !(host_focus || tab_to_egui) || !acts.is_empty() { + // egui's direction (its arrows, a Tab the key stage left to egui) moves focus from the widget it holds when that is + // an app's own; never in a pass whose focus the framework moves. + if !host_focus || !acts.is_empty() { egui_focus::clear_directional_focus(ctx); } apply(ctx, acts); @@ -1034,13 +1106,7 @@ pub(crate) fn surrender_after_scopes(ctx: &Context, widget: Id) { /// moves it off a stop that was not registered, and records what the next input hook reads. pub(crate) fn end(ctx: &Context) { let viewport = viewport(ctx); - // A Tab left to egui moves egui focus into the app's own widgets only: a component's egui widget takes focus - // through its stop, and a component that registered none (a disabled one) takes none. - if with(ctx, |state| std::mem::take(&mut state.tab_to_egui)) - && let Some(id) = egui_focus::focused(ctx).filter(|id| crate::runtime::pointer::made_by_component(ctx, viewport, *id)) - { - egui_focus::surrender(ctx, id); - } + take_app_widgets(ctx, None); // A field held a pass for the scope it sits in lets go now, unless that scope is going away with focus in the field: // nav::end below then gives the focus back to the scope's opener from where the field holds it. if let Some(widget) = with(ctx, |state| state.surrender_deferred.take()) @@ -1081,7 +1147,9 @@ pub(crate) fn end(ctx: &Context) { // Escape over a captured framework press or drag cancels it (`frame::begin_pass`), whatever egui has focused. let captured = crate::runtime::pointer::press_captured(ctx) || crate::runtime::drag::running(ctx); let host_focus = !captured && with(ctx, |state| state.focus_now).is_some_and(app_widget); - let foreign = host_focus || (!captured && crate::runtime::egui::areas::popup_open(ctx)); + let popup = !captured && crate::runtime::egui::areas::popup_open(ctx); + let foreign = host_focus || popup; + let tab_in_egui = popup || (host_focus && egui_focus::focused_keeps_tab(ctx)); let label_selection = egui_focus::label_selection(ctx); let host_text = host_focus && ctx.text_edit_focused(); // A modal layer keeps the canvas's claims from it, as it keeps the arrows (`overlay::end_pass` ran before). @@ -1089,6 +1157,7 @@ pub(crate) fn end(ctx: &Context) { with(ctx, |state| { state.record.canvas = state.record.canvas.filter(|_| !modal); state.record.foreign = foreign; + state.record.tab_in_egui = tab_in_egui; state.record.host_focus = host_focus; state.record.host_text = host_text; state.record.label_selection = label_selection; diff --git a/crates/ui-contract/src/runtime/focus/nav.rs b/crates/ui-contract/src/runtime/focus/nav.rs index 50b6ab11f6..0fa84e5e23 100644 --- a/crates/ui-contract/src/runtime/focus/nav.rs +++ b/crates/ui-contract/src/runtime/focus/nav.rs @@ -184,6 +184,7 @@ impl State { pub(super) fn rotate(&mut self) { self.last_stops = std::mem::take(&mut self.stops); self.stop_ids.clear(); + self.stop_roots.clear(); self.last_scopes = std::mem::take(&mut self.scopes); self.last_scope_order = std::mem::take(&mut self.scope_order); self.last_groups = std::mem::take(&mut self.groups); @@ -193,6 +194,7 @@ impl State { self.body_from.clear(); self.entered = false; self.asked = false; + self.candidates_seen = 0; } /// The registrations of last pass, which Tab and the arrows move over. @@ -228,10 +230,12 @@ impl State { .or_else(|| self.stops.iter().chain(&self.last_stops).find(|rec| rec.stop.root == root).cloned()) } - /// Whether `id`, holding egui focus, is an app's own widget: no stop's root and, as `made` says, no widget a - /// component made (`pointer::made_by_component`). + /// Whether `id`, holding egui focus, is an app's own widget: as `made` says, no widget a component made + /// (`pointer::made_by_component`), and the root of no stop but the one every focusable egui widget of the app has + /// (`Stop::automatic`). The app's canvas (`host_canvas`, `KeyUse::chrome_key`) is none: its declared + /// keys route as a framework stop's do, so egui's arrows and Tab never move focus off it. pub(super) fn app_widget(&self, id: Id, made: bool) -> bool { - !made && self.find_stop((id, None)).is_none() && !self.stops.iter().chain(&self.last_stops).any(|rec| rec.stop.root == id) + !made && !self.stops.iter().chain(&self.last_stops).any(|rec| !rec.stop.automatic() && (rec.stop.root == id || rec.stop.key() == (id, None))) } /// Moves focus to `rec` and asks the enclosing scroll owner to reveal it: the egui widget is its root, and the stop @@ -873,6 +877,7 @@ pub(super) fn end(state: &mut State, focused: Option, on_app_widget: bool, f menu_bar_by_claim: std::mem::take(&mut state.menu_bar_by_claim), canvas: if stop.is_none() { state.stops.iter().find(|rec| rec.stop.keys.chrome_key).map(|rec| rec.stop.id) } else { None }, foreign: false, + tab_in_egui: false, host_focus: false, host_text: false, label_selection: false, diff --git a/crates/ui-contract/src/runtime/focus/registration.rs b/crates/ui-contract/src/runtime/focus/registration.rs index 56eaddb64f..a83dc80a26 100644 --- a/crates/ui-contract/src/runtime/focus/registration.rs +++ b/crates/ui-contract/src/runtime/focus/registration.rs @@ -37,8 +37,8 @@ pub struct Stop { /// The arena root the stop is shown in (a canvas whose body holds it), whether or not it joined the arena: a text /// stop keeps its own egui widget. A removed stop hands focus back to it. pub arena: Option, - /// The app's own egui widget (`focus::host_canvas`), which reads its keys from egui's input: the key stage leaves - /// the presses it routes to the stop there. + /// The app's own egui widget (`focus::host_canvas`, or any focusable egui widget the app draws), which reads its + /// keys from egui's input: the key stage leaves the presses it routes to the stop there. pub host: bool, } @@ -128,6 +128,12 @@ impl Stop { self } + /// Whether this is the stop every focusable egui widget the app draws gets by itself (`focus::take_app_widgets`): + /// the app's own widget, not declared as its canvas (`KeyUse::chrome_key`). No component or app call registered it. + pub fn automatic(&self) -> bool { + self.host && !self.keys.chrome_key + } + pub(crate) fn key(&self) -> StopKey { (self.id, self.part) } diff --git a/crates/ui-contract/src/runtime/ime.rs b/crates/ui-contract/src/runtime/ime.rs index 20c6509eed..6c97d87ac6 100644 --- a/crates/ui-contract/src/runtime/ime.rs +++ b/crates/ui-contract/src/runtime/ime.rs @@ -53,9 +53,9 @@ struct Engine { editor: Option, /// The app's own editor that wrote the IME output of the last pass while no framework editor owned the IME. host: Option, - /// The reset requests the app's own editor wrote in its IME output, unanswered yet: their completions and - /// retirements are the app's and stay in egui's input for it, fence or not. One of them is the fence's `reset` - /// when the app asked for its reset in the pass the engine interrupted its composition. + /// The reset requests of the app's own editor that a published IME output carried, its own or a framework editor's + /// it interrupted, oldest first, unanswered yet: their completions and retirements are the app's and stay in + /// egui's input for it, fence or not. The latest one published while the fence is up is the fence's `reset`. host_resets: Vec, } @@ -201,13 +201,27 @@ impl Engine { self.discard = true; } - /// Notes an answer to one of the app's own reset requests: the request is answered, and a completion of the one the - /// fence waits for ends the fence; a retirement leaves the end hook to ask again. + /// Interrupts the owner's input method context: a running composition is ended and fenced (`interrupt`); with none + /// running there are no late events to drop, and only the interrupt goes out. + fn interrupt_owner(&mut self, owner: Id) { + if self.composing { + self.interrupt(owner); + } else { + self.interrupt = Some(owner); + } + } + + /// Notes an answer to one of the app's own reset requests. A completion answers that request and every older one, + /// as completions arrive in request order, and ends the fence when it waits for one of them; a retirement answers + /// only its own request and, when the fence waits for it, leaves the end hook to ask again. fn host_answered(&mut self, event: &Event) { let (Event::ImeResetCompleted { request_id: id } | Event::ImeResetRetired { request_id: id }) = event else { return }; let Some(at) = self.host_resets.iter().position(|own| own == id) else { return }; - self.host_resets.remove(at); - if self.reset == Some(*id) { + let answered: Vec<_> = match event { + Event::ImeResetCompleted { .. } => self.host_resets.drain(..=at).collect(), + _ => vec![self.host_resets.remove(at)], + }; + if self.reset.is_some_and(|reset| answered.contains(&reset)) { self.reset = None; if matches!(event, Event::ImeResetCompleted { .. }) { self.stale = false; @@ -419,11 +433,7 @@ pub(crate) fn request_interrupt(ctx: &Context, owner: Id) { if engine.owner != Some(owner) { return; } - if engine.composing { - engine.interrupt(owner); - } else { - engine.interrupt = Some(owner); - } + engine.interrupt_owner(owner); }); } @@ -490,8 +500,9 @@ pub(crate) fn note_caret(ctx: &Context, owner: Id, field: Rect, caret: Rect, pas pub(crate) fn end_pass(ctx: &Context) { let viewport = pass::current_viewport(ctx); let (frame_nr, pass_nr) = (ctx.cumulative_frame_nr_for(viewport), ctx.cumulative_pass_nr_for(viewport)); - let app_ime = ctx.output(|output| output.ime.as_ref().map(|ime| (ime.owner, ime.context_generation, ime.reset_request))); - let app_wrote = app_ime.map(|(owner, generation, _)| (owner, generation)); + let app_wrote = ctx.output(|output| output.ime.as_ref().map(|ime| (ime.owner, ime.context_generation))); + // egui publishes the app's request only in a pass that has an IME output. + let app_reset = app_wrote.and(os::app_reset(ctx, viewport)); let (owner, interrupt, caret, update, published, host) = with(ctx, viewport, |engine| { let ran = std::mem::take(&mut engine.ran); if !ran { @@ -510,15 +521,20 @@ pub(crate) fn end_pass(ctx: &Context) { let last_host = engine.host; let kept = engine.host.filter(|host| app_wrote.is_some_and(|(owner, _)| owner == host.owner)).is_some_and(|host| host.composing); engine.host = app_wrote.filter(|_| engine.owner.is_none()).map(|(owner, generation)| HostIme { owner, generation, composing: kept }); - if let Some(id) = app_ime.filter(|_| engine.owner.is_none()).and_then(|(.., reset)| reset) - && !engine.host_resets.contains(&id) + // The app's request: every output this pass publishes carries it, the app's own or the engine's, and a new one + // becomes the fence's request after the write. While a framework editor owns the IME, egui publishes it on that + // editor's output as an interrupt, so the engine takes it as its own interrupt of the owner. + let fresh = app_reset.filter(|id| !engine.host_resets.contains(id)); + if fresh.is_some() + && let Some(owner) = engine.owner { - engine.host_resets.push(id); + engine.interrupt_owner(owner); } // The fence has no request the integration can answer: the owner's output asks again, a framework editor's // or the app's own. if engine.stale && engine.reset.is_none() + && fresh.is_none() && let Some(owner) = engine.owner.or(engine.host.map(|host| host.owner)) { engine.interrupt.get_or_insert(owner); @@ -532,7 +548,7 @@ pub(crate) fn end_pass(ctx: &Context) { let written = if owner.is_none() && interrupt.is_none() { None } else if host_interrupt.is_some() { - Some((os::interrupt_written(ctx, viewport), None)) + Some((os::interrupt_written(ctx, viewport, app_reset), None)) } else { os::clear(ctx); match (caret, interrupt, update) { @@ -543,6 +559,7 @@ pub(crate) fn end_pass(ctx: &Context) { field, caret, interrupt: interrupt.is_some(), + app_reset, generation, password, surrounding: update.surrounding_text, @@ -559,6 +576,7 @@ pub(crate) fn end_pass(ctx: &Context) { field: Rect::NOTHING, caret: Rect::NOTHING, interrupt: true, + app_reset, generation, password: false, surrounding: IMESurroundingText::Unavailable, @@ -569,14 +587,27 @@ pub(crate) fn end_pass(ctx: &Context) { _ => None, } }; - if let Some((reset, generation)) = written { - with(ctx, viewport, |engine| { + // The app's request counts as its own only when the published output carries it: egui's own output when the + // engine wrote none, else the engine's. + let carried = app_reset.filter(|id| written.as_ref().is_none_or(|(reset, _)| *reset == Some(*id))); + with(ctx, viewport, |engine| { + if let Some((reset, generation)) = written { if generation.is_some() { engine.published = generation; } if interrupt.is_some() { engine.reset = reset; } - }); - } + } + if let Some(id) = carried + && !engine.host_resets.contains(&id) + { + engine.host_resets.push(id); + // Completions arrive in request order: the latest request's completion ends the interrupted composition, + // whichever request the fence waited for. + if engine.stale { + engine.reset = Some(id); + } + } + }); } diff --git a/crates/ui-contract/src/runtime/keys.rs b/crates/ui-contract/src/runtime/keys.rs index bc84720273..c2762c7415 100644 --- a/crates/ui-contract/src/runtime/keys.rs +++ b/crates/ui-contract/src/runtime/keys.rs @@ -66,9 +66,6 @@ pub enum MenuKey { pub(crate) struct NavKeys { pub(crate) tabs: Vec, pub(crate) panes: Vec, - /// The input hook left a bare Tab in egui's input: nothing has the focus and the window registered no focus stop, - /// so the framework has nothing to move to and egui moves its own focus. - pub(crate) tab_to_egui: bool, } struct Press { diff --git a/crates/ui-contract/src/runtime/keys/input.rs b/crates/ui-contract/src/runtime/keys/input.rs index db3f8a9496..10fc04150f 100644 --- a/crates/ui-contract/src/runtime/keys/input.rs +++ b/crates/ui-contract/src/runtime/keys/input.rs @@ -42,26 +42,20 @@ struct Strip<'a> { holds_drafts: bool, /// A dialog keeps a canvas open and Space belongs to it: the press is the canvas's momentary command chord. canvas_space: bool, - /// An app's own egui widget or popup has the focus (`FocusedRecord::foreign`): Tab, Escape and the clipboard - /// events are its own. + /// An app's own egui widget or popup has the focus (`FocusedRecord::foreign`): Escape, the plain Enter and the + /// clipboard events are its own, and no window intent comes of them. foreign: bool, + /// A bare Tab is egui's: an app's own popup is open, or the app's own focused widget keeps Tab by its egui key + /// filter (`FocusedRecord::tab_in_egui`), or the window has no stop to move the focus to and nothing focused + /// (`focus::tab_has_no_stop`), so the Tab is the app's own binding's. + tab_in_egui: bool, /// The focused stop is the app's own egui widget (`Stop::host`, `FocusedRecord::host`), which reads its keys from /// egui: its Escape stays there, as an app's own focused widget's does. Tab and the arrows follow its `KeyUse`, as /// the framework's navigation reads it. host: bool, - /// The keys of the window's canvas while nothing has the focus, neither a framework stop nor an app's own widget - /// or popup: the canvas is then the key target, as the chrome gate takes it, and reads from egui the keys its - /// `KeyUse` keeps (Tab with `KeepKeys::Tab`). - canvas: Option, /// The edit set whose clipboard events and edit chords stay in egui's input: the focused stop's when it is the - /// app's own widget (`host`), else the canvas's with nothing focused (`canvas`). + /// app's own widget (`host`), else the window canvas's with nothing focused (`target_canvas`). egui_edits: EditSet, - /// A bare Tab that the focus does not keep is egui's own move (`focus::tab_is_egui_s`): the window registered no - /// framework stop in its last pass, only the app's own widgets' (`Stop::host`) if any, and nothing has the focus or - /// one of those stops has it. egui's Tab order holds those stops and the app's other widgets; a framework move - /// would reach the stops alone. Focus on a component's widget without a stop is focus: egui would take a Tab from - /// it as a move to the next widget it shows, in a later pass. A Tab that toggles the chrome stays the framework's. - egui_tab: bool, /// egui holds a label text selection, which a copy or cut event copies. label_selection: bool, /// A tool host claimed the lone Alt tap: it goes to the claimer on every OS, not to the menu bar. @@ -348,6 +342,7 @@ impl Strip<'_> { let ctrl_tab = key == Key::Tab && (if self.os == Os::Mac { mods.ctrl && !mods.cmd } else { mods.cmd }); let ctrl_tab = ctrl_tab && self.pages && !self.keeps_tab; let bare_tab = key == Key::Tab && !mods.cmd && !mods.ctrl && !mods.alt; + let plain_enter = key == Key::Enter && mods.is_none(); // Alt and Shift ride along, as with Enter: a canvas tool reads them; Cmd and Ctrl chords are the app's. While // the focused stop records, Escape with any modifier held is a chord for the recorder; only plain Escape is a // scope escape. Over an open press any Escape is the press's cancel: a borrowed tool's drag holds Cmd. Shift or @@ -366,7 +361,6 @@ impl Strip<'_> { let edit = self.edit_chords.iter().find(|(command, chord)| (self.edits)(*command) && self.layout.matches(chord, input, self.os)); let egui_edit = self.edit_chords.iter().any(|(command, chord)| self.egui_edits.contains(*command) && self.layout.matches(chord, input, self.os)); - let canvas_tab = bare_tab && self.canvas.is_some_and(|canvas| canvas.keep == focus::KeepKeys::Tab); // The chrome keys are Tab's, which the bare-Tab arm and `take_nav` read. let window_shortcut = self .window_shortcuts @@ -379,10 +373,12 @@ impl Strip<'_> { PressUse::Edit(*command) } else if key == Key::Space && self.canvas_space { PressUse::CanvasSpace - } else if (self.foreign && (bare_tab || escape)) || (self.host && escape && !self.press_captured) || canvas_tab || egui_edit { + } else if (self.foreign && (escape || plain_enter)) + || (bare_tab && self.tab_in_egui) + || (self.host && escape && !self.press_captured) + || egui_edit + { PressUse::Egui - } else if bare_tab && self.egui_tab && !self.keeps_tab { - PressUse::TabToEgui } else if bare_tab && !self.keeps_tab { PressUse::Tab } else if ctrl_tab { @@ -443,12 +439,6 @@ impl Strip<'_> { // the key from egui; the runtime routes nothing for it, so no shortcut toggles the chrome or fires an edit // command with it either. PressUse::Egui => true, - PressUse::TabToEgui => { - // egui moves its own focus with it, from nothing focused or a host stop through the app's own widgets - // (`focus::begin`). - batch.nav.tab_to_egui = true; - true - } PressUse::Tab => { batch.tabs.push(TabPress { input: *input, repeat, at, place: batch.place }); false @@ -538,8 +528,6 @@ enum PressUse { CanvasSpace, /// The app's own widget or popup, or the canvas with nothing focused, reads the key from egui. Egui, - /// A bare Tab egui moves its own focus with, through the app's own widgets. - TabToEgui, /// A bare Tab: a focus move or a chrome toggle, which `take_nav` decides. Tab, /// The page switch of the focused stop. @@ -670,10 +658,6 @@ pub(crate) fn input_hook(ctx: &Context, input: &RawInput, events: &mut Vec; @@ -682,6 +666,7 @@ pub(crate) fn input_hook(ctx: &Context, input: &RawInput, events: &mut Vec, + /// The roots whose asked raise ran in a pass where a floating window (re)appeared: egui raises every layer that + /// shows again, and its area order keeps the old order among the layers raised in one pass, so the raise is asked + /// again in the next pass. + raise_again: Vec, } /// The closes queued and not yet taken, each with the root frame that queued it and whether it is carried: a carried @@ -874,7 +878,8 @@ pub(crate) fn end_pass(ctx: &Context) { with_pass(ctx, |pass| (pass.current.clone(), pass.last.iter().map(|entry| entry.id).collect::>(), pass.raise.clone())); let pressed = pointer::frame_raw(ctx).press.map(|press| press.origin); let now = pass::root_frame_nr(ctx); - let (order, to_top) = with_persist(ctx, viewport, |persist| { + let (order, to_top, floats, asked) = with_persist(ctx, viewport, |persist| { + let raise: Vec = std::mem::take(&mut persist.raise_again).into_iter().chain(raise).collect(); let stamp = |id: Id, persist: &mut Persist| { persist.counter += 1; persist.raised.insert(id, persist.counter); @@ -917,6 +922,7 @@ pub(crate) fn end_pass(ctx: &Context) { let mut order: Vec = Vec::new(); let mut listed: Vec = Vec::new(); let mut to_top: Vec = Vec::new(); + let mut floats: Vec = Vec::new(); persist.stack.clear(); for members in &families { for member in members { @@ -930,9 +936,12 @@ pub(crate) fn end_pass(ctx: &Context) { order.extend(member.cover); order.push(member.layer); listed.push(member.id); - } else if !member.window && members.first().is_some_and(|root| asked.contains(&root.id)) { - // An asked raise of a layer left to egui's area order raises it there, as a press on it does. - to_top.push(member.layer); + } else if !member.window { + floats.push(member.layer); + if members.first().is_some_and(|root| asked.contains(&root.id)) { + // An asked raise of a layer left to egui's area order raises it there, as a press on it does. + to_top.push(member.layer); + } } persist.stack.push(member.id); } @@ -959,11 +968,14 @@ pub(crate) fn end_pass(ctx: &Context) { .map(|(_, members)| { members.iter().flat_map(|member| std::iter::once(member.rect).chain(member.anchor).chain(member.peers.iter().copied())).collect() }); - (order, to_top) + (order, to_top, floats, asked) }); areas::set_layer_order(ctx, &order); - for layer in to_top { - areas::move_to_top(ctx, layer); + for layer in &to_top { + areas::move_to_top(ctx, *layer); + } + if !to_top.is_empty() && floats.iter().any(|layer| !areas::visible_last_frame(ctx, *layer)) { + with_persist(ctx, viewport, |persist| persist.raise_again = asked); } // An owner takes a close in the frame after the request at the latest; one nobody took is for a layer that is not shown. pass_state::with::(ctx, |closes| closes.0.retain(|(.., queued, carried)| *carried || queued + 1 >= now)); diff --git a/crates/ui-contract/src/runtime/pointer.rs b/crates/ui-contract/src/runtime/pointer.rs index 36e734e570..58539fbe32 100644 --- a/crates/ui-contract/src/runtime/pointer.rs +++ b/crates/ui-contract/src/runtime/pointer.rs @@ -229,6 +229,9 @@ pub(crate) struct Shapes { /// the last, each with its component: such a widget takes its press itself. this_texts: IdMap, last_texts: IdMap, + /// Every id components registered or made in the running pass: the roots, their egui widgets and the widgets made + /// for their text and editor parts (`made_by_component`). + this_made: IdSet, /// The layers' own egui widgets (an overlay `Area`'s, which senses a click where nothing on the layer does) in the /// running pass and the last: such a widget lies under every widget and shape on its layer and stands for none. this_grounds: IdSet, @@ -250,6 +253,9 @@ pub(crate) struct Shapes { /// The resolutions the running pass made (`find_under`), for the count trials. #[cfg(feature = "testing")] resolutions: u32, + /// The `made_by_component` lookups the running pass made, for the count trials. + #[cfg(feature = "testing")] + made_lookups: u32, } /// The begin hook (H5): converts the pass's pointer input. @@ -373,6 +379,7 @@ pub(crate) fn begin(ctx: &Context, hit: HitSizes, latched: craft_keymap::Mods) { shapes.last = std::mem::take(&mut shapes.this); shapes.last_bodies = std::mem::take(&mut shapes.this_bodies); shapes.last_texts = std::mem::take(&mut shapes.this_texts); + shapes.this_made.clear(); shapes.last_grounds = std::mem::take(&mut shapes.this_grounds); shapes.next = 0; shapes.hover = None; @@ -381,6 +388,7 @@ pub(crate) fn begin(ctx: &Context, hit: HitSizes, latched: craft_keymap::Mods) { #[cfg(feature = "testing")] { shapes.resolutions = 0; + shapes.made_lookups = 0; } }); // The pointer's hover is resolved once for the pass, over last pass's complete record, with the targets egui's hit @@ -621,6 +629,7 @@ pub(crate) fn add_shapes_in(ctx: &Context, viewport: ViewportId, layer: Layer, r PerViewport::::with(ctx, viewport, |record| { let order = record.next; record.next += 1; + record.this_made.insert(root); let entry = record.this.entry(layer).or_default().entry(root).or_default(); entry.shapes.extend(shapes); entry.placed.resize(entry.shapes.len(), Placed { order, clip }); @@ -628,11 +637,13 @@ pub(crate) fn add_shapes_in(ctx: &Context, viewport: ViewportId, layer: Layer, r } /// Records the egui widget `widget` that the component `owner` made for its own text (a field's text, a selection -/// part): a press egui gives it is the widget's own and goes to no root, and the hover goes to `owner`. +/// part, an editor part's focus widget): a press egui gives it is the widget's own and goes to no root, and the hover +/// goes to `owner`. pub(crate) fn record_text_widget(ctx: &Context, widget: Id, owner: Id) { crate::runtime::replay::journal(ctx, || (widget, owner), |ctx, &(widget, owner)| record_text_widget(ctx, widget, owner)); PerViewport::::with(ctx, pass::current_viewport(ctx), |record| { record.this_texts.insert(widget, owner); + record.this_made.insert(widget); }); } @@ -669,6 +680,8 @@ pub(crate) fn record_widgets_in(ctx: &Context, viewport: ViewportId, layer: Laye |ctx, (layer, root, widgets, click)| record_widgets(ctx, *layer, *root, widgets, *click), ); PerViewport::::with(ctx, viewport, |record| { + record.this_made.insert(root); + record.this_made.extend(widgets.iter().copied()); let entry = record.this.entry(layer).or_default().entry(root).or_default(); entry.widgets.extend_from_slice(widgets); entry.click |= click; @@ -841,13 +854,24 @@ pub(crate) fn registered_widgets(ctx: &Context) -> std::collections::HashSet }) } -/// Whether `id` is a root or an egui widget that a component registered in the running pass of `viewport`. +/// Whether `id` is a root, an egui widget that a component registered, or a widget a component made for its text or +/// editor part, in the running pass of `viewport`. pub(crate) fn made_by_component(ctx: &Context, viewport: ViewportId, id: Id) -> bool { PerViewport::::with(ctx, viewport, |record| { - record.this.values().any(|roots| roots.contains_key(&id) || roots.values().any(|root| root.widgets.contains(&id))) + #[cfg(feature = "testing")] + { + record.made_lookups += 1; + } + record.this_made.contains(&id) }) } +/// How many `made_by_component` lookups the running pass of `viewport` made so far, for the count trials. +#[cfg(feature = "testing")] +pub(crate) fn made_lookups(ctx: &Context, viewport: ViewportId) -> u32 { + PerViewport::::with(ctx, viewport, |record| record.made_lookups) +} + /// The roots a press at a point goes to, each with the shape of it that wins it: its click's and its drag's (8.3, H7). /// Among the roots under the point ([`Under`]), each resolves its own shapes by the arena rule, and the roots rank by /// their winning shapes' place in the pass's paint order, top first. The top one takes every kind of press its shape diff --git a/crates/ui-contract/src/style/cx.rs b/crates/ui-contract/src/style/cx.rs index 30d36336f3..d5ab7c55ea 100644 --- a/crates/ui-contract/src/style/cx.rs +++ b/crates/ui-contract/src/style/cx.rs @@ -405,6 +405,24 @@ impl<'a> StyleCx<'a> { } } + /// The height of a dialog's footer button at the ambient size: `size.dialog.button_height` at the medium size, grown + /// as a control's height is; a small button stands a small control high. + pub fn dialog_button_height(&self) -> f32 { + match self.size { + ControlSize::Sm => self.control().height, + ControlSize::Md => grown(self.tokens, self.tokens.size.dialog.button_height, self.line_ratio), + } + } + + /// The height of a menu row at the ambient size: `size.row.menu` at the medium size, grown as a control's height + /// is; a small row stands a small control high. + pub fn menu_row_height(&self) -> f32 { + match self.size { + ControlSize::Sm => self.control().height, + ControlSize::Md => grown(self.tokens, self.tokens.size.row.menu, self.line_ratio), + } + } + /// How the icon-only buttons of the scope show their glyph. pub fn glyph_role(&self) -> GlyphRole { self.glyphs diff --git a/crates/ui-contract/src/testing/bypass.rs b/crates/ui-contract/src/testing/bypass.rs index ec44a2076b..815bf36289 100644 --- a/crates/ui-contract/src/testing/bypass.rs +++ b/crates/ui-contract/src/testing/bypass.rs @@ -1,7 +1,8 @@ //! Bypass detection (24.2): the pass-end walk that finds what a component made without the runtime. //! //! Every interactive egui widget of the latest pass must be one a component registered (a root or one of its -//! widgets, a focus stop's root) or one the runtime noted. Every AccessKit node that declares an action must +//! widgets, the root of a focus stop that something registered: not the stop every focusable egui widget gets by +//! itself, `Stop::automatic`) or one the runtime noted. Every AccessKit node that declares an action must //! come from the runtime's node writer. A raw `ui.interact`, `ui.button` or `ui.add(Slider)` in a component //! fails here, with the id of the offender. @@ -24,7 +25,7 @@ pub fn findings(fixture: &Fixture) -> Vec { let mut registered: HashSet = pointer::registered_widgets(ctx); registered.extend(noted_widgets); focus::with_viewport(ctx, egui::ViewportId::ROOT, |state| { - registered.extend(state.stops.iter().chain(&state.last_stops).map(|rec| rec.stop.root)); + registered.extend(state.stops.iter().chain(&state.last_stops).filter(|rec| !rec.stop.automatic()).map(|rec| rec.stop.root)); }); let mut found: Vec = widgets::interactive(ctx) .into_iter() diff --git a/crates/ui-contract/src/testing/host_key_trials.rs b/crates/ui-contract/src/testing/host_key_trials.rs index 804d9b08a4..393718b49f 100644 --- a/crates/ui-contract/src/testing/host_key_trials.rs +++ b/crates/ui-contract/src/testing/host_key_trials.rs @@ -9,6 +9,7 @@ use crate::runtime::egui::{areas, fixture}; use crate::runtime::env::{Env, RootEnv}; use crate::runtime::focus::{EditSet, FocusPolicy, FocusTarget, KeepKeys, KeyUse, host_canvas, request}; use crate::runtime::frame::{ChromeToggle, take_output}; +use crate::runtime::ime; use crate::runtime::keys::with_window_intents; use crate::style::{ComponentStyle, StyleCx}; use crate::testing::focus::{Stop, egui_focused, key_release, named_id, pop_scope, push_scope, register_stop, widget}; @@ -215,12 +216,11 @@ fn a_press_during_an_app_editor_s_composition_fences_its_late_ime_events() { assert_eq!(*editor.borrow(), "abX", "the commit after the completion reaches the editor"); } -/// An app editor that asks for its own reset at the press that interrupts its composition keeps that request: the -/// platform is asked to answer the app's id, the late events stay fenced, and the completion reaches the editor, which -/// takes the events after it and composes again. -#[trial] -fn an_app_editor_s_own_reset_at_the_press_reaches_it_and_it_composes_again() { - let editor = Rc::new(RefCell::new(fixture::ResettingEditor::default())); +/// The app's own resetting editor at its rect, the show closure that draws it, and the frames after two idle ones, +/// a commit of "ab" and a preedit of "z": the editor composes. `in_output`: the editor writes its reset request into +/// its IME output too, instead of leaving it to egui as EffectCraft's editor does. +fn composing_resetting_editor(in_output: bool) -> (Rc>, impl FnMut(&mut Ui), Frames) { + let editor = Rc::new(RefCell::new(fixture::ResettingEditor { in_output, ..Default::default() })); let held = Rc::clone(&editor); let rect = Rect::from_min_size(Pos2::new(100.0, 100.0), egui::vec2(200.0, 30.0)); let mut show = move |ui: &mut Ui| fixture::host_resetting_ime_editor(ui, host_editor_id(), rect, &mut held.borrow_mut()); @@ -228,31 +228,161 @@ fn an_app_editor_s_own_reset_at_the_press_reaches_it_and_it_composes_again() { frames.idle(2, &mut show); frames.frame(vec![Event::Ime(ImeEvent::Commit("ab".to_owned()))], &mut show); frames.frame(vec![Event::Ime(ImeEvent::Preedit { text: "z".to_owned(), active_range_chars: None })], &mut show); - let at = Pos2::new(150.0, 115.0); - let late = vec![ + (editor, show, frames) +} + +/// The press at `at` with the composition's late deletion and commit after it, in one frame. +fn press_with_late_ime(at: Pos2) -> Vec { + vec![ moved(at), press(at), Event::Ime(ImeEvent::DeleteSurrounding { before_chars: 1, after_chars: 0 }), Event::Ime(ImeEvent::Commit("Q".to_owned())), - ]; - frames.frame(late, &mut show); - let own = editor.borrow().reset; - assert!(own.is_some(), "the editor asked for its own reset at the press"); - let reset = frames.ime().and_then(|ime| ime.interrupt.then_some(ime.reset).flatten()); - assert_eq!(reset, own, "the interrupt asks the platform to answer the editor's own request"); - let Some(reset) = reset else { return }; - frames.frame(vec![release(at)], &mut show); + ] +} + +/// An app editor that asks for its own reset at the press that interrupts its composition keeps that request: the +/// platform is asked to answer the app's id, the late events stay fenced, and the completion reaches the editor, which +/// takes the events after it and composes again. The editor asks through egui alone, or writes the request into its +/// output too. +#[trial] +fn an_app_editor_s_own_reset_at_the_press_reaches_it_and_it_composes_again() { + for in_output in [false, true] { + let (editor, mut show, mut frames) = composing_resetting_editor(in_output); + let at = Pos2::new(150.0, 115.0); + frames.frame(press_with_late_ime(at), &mut show); + let own = editor.borrow().reset; + assert!(own.is_some(), "the editor asked for its own reset at the press"); + let reset = frames.ime().and_then(|ime| ime.interrupt.then_some(ime.reset).flatten()); + assert_eq!(reset, own, "the interrupt asks the platform to answer the editor's own request (in_output {in_output})"); + let Some(reset) = reset else { return }; + frames.frame(vec![release(at)], &mut show); + frames.frame(Vec::new(), &mut show); + assert_eq!(editor.borrow().text, "ab", "the composition's late deletion and commit never reach the editor"); + frames.frame(vec![Event::ImeResetCompleted { request_id: reset }, Event::Ime(ImeEvent::Commit("X".to_owned()))], &mut show); + assert_eq!(editor.borrow().reset, None, "the completion of its own request reaches the editor"); + assert_eq!(editor.borrow().text, "abX", "the commit after it reaches the editor"); + frames.frame(vec![Event::Ime(ImeEvent::Preedit { text: "y".to_owned(), active_range_chars: None })], &mut show); + assert!(editor.borrow().composing, "the editor composes again"); + } +} + +/// A press outside the app's editor fences its composition with the framework's own reset request; a reset the app +/// asks for in a later pass becomes the one the fence waits for. Its completion ends the fence, the commit after it +/// reaches the editor, and the framework's request is never answered. +#[trial] +fn an_app_editor_s_later_reset_ends_the_fence() { + let (editor, mut show, mut frames) = composing_resetting_editor(false); + let outside = Pos2::new(500.0, 400.0); + frames.frame(press_with_late_ime(outside), &mut show); + let fence = frames.ime().and_then(|ime| ime.interrupt.then_some(ime.reset).flatten()); + assert!(fence.is_some() && editor.borrow().reset.is_none(), "the framework fences with its own request; the editor asks nothing"); + frames.frame(vec![release(outside)], &mut show); + editor.borrow_mut().ask = true; frames.frame(Vec::new(), &mut show); - assert_eq!(editor.borrow().text, "ab", "the composition's late deletion and commit never reach the editor"); - frames.frame(vec![Event::ImeResetCompleted { request_id: reset }, Event::Ime(ImeEvent::Commit("X".to_owned()))], &mut show); - assert_eq!(editor.borrow().reset, None, "the completion of its own request reaches the editor"); - assert_eq!(editor.borrow().text, "abX", "the commit after it reaches the editor"); + let later = editor.borrow().reset; + assert!(later.is_some() && later != fence, "the editor asks for its own reset later"); + assert_eq!(frames.ime().and_then(|ime| ime.reset), later, "the pass publishes the editor's request"); + let Some(later) = later else { return }; + frames.frame( + vec![ + Event::Ime(ImeEvent::Commit("Q".to_owned())), + Event::ImeResetCompleted { request_id: later }, + Event::Ime(ImeEvent::Commit("X".to_owned())), + ], + &mut show, + ); + assert_eq!(editor.borrow().reset, None, "the completion of its later request reaches the editor"); + assert_eq!(editor.borrow().text, "abX", "the late commit is fenced and the commit after the completion reaches the editor"); frames.frame(vec![Event::Ime(ImeEvent::Preedit { text: "y".to_owned(), active_range_chars: None })], &mut show); assert!(editor.borrow().composing, "the editor composes again"); } +/// A framework text field of `id`, as a text component's part draws it: a text stop that takes the IME edits meant for +/// it and notes its caret. +fn framework_field(ui: &mut Ui, id: Id) { + let rect = widget(ui, id); + register_stop(ui.ctx(), Stop::new(id, KeyUse::of(Input::Text)).text()); + let _ = ime::take(ui.ctx(), id, false); + ime::note_caret(ui.ctx(), id, rect, rect, false); +} + +/// The framework field of `framework_field` and the app's resetting editor beside it at its rect, the show closure that +/// draws both, and the frames after the field took the focus and composed "k". +fn framework_field_composing_beside_an_app_editor() -> (Id, Rect, Rc>, impl FnMut(&mut Ui), Frames) { + let editor = Rc::new(RefCell::new(fixture::ResettingEditor::default())); + let held = Rc::clone(&editor); + let rect = Rect::from_min_size(Pos2::new(100.0, 100.0), egui::vec2(200.0, 30.0)); + let framework = named_id("framework field"); + let mut show = move |ui: &mut Ui| { + framework_field(ui, framework); + fixture::host_resetting_ime_editor(ui, host_editor_id(), rect, &mut held.borrow_mut()); + }; + let mut frames = Frames::new(); + frames.idle(2, &mut show); + request(&frames.ctx, FocusTarget::Id(framework)); + frames.frame(Vec::new(), &mut show); + frames.frame(vec![Event::Ime(ImeEvent::Preedit { text: "k".to_owned(), active_range_chars: None })], &mut show); + assert_eq!(frames.ime().map(|ime| ime.owner), Some(framework), "the framework field composes"); + (framework, rect, editor, show, frames) +} + +/// A press on the app's editor takes the focus from a composing framework field, and the editor asks for its own reset +/// in the pass the field loses the IME, as EffectCraft's editor does when its caret moves after the press. The interrupt +/// of the field's composition publishes the editor's request, so the platform's answer in the next frame reaches the +/// editor, the field's late commit stays fenced until then, and the commit after it reaches the editor. #[trial] -fn a_focused_egui_field_keeps_tab_escape_and_the_clipboard() { +fn an_app_editor_s_reset_asked_as_it_takes_the_focus_from_a_composing_framework_field_completes() { + let (framework, rect, editor, mut show, mut frames) = framework_field_composing_beside_an_app_editor(); + let at = rect.center(); + frames.frame(vec![moved(at), press(at)], &mut show); + assert!(!frames.ime().is_some_and(|ime| ime.interrupt), "the field keeps the IME through the press pass"); + editor.borrow_mut().ask = true; + frames.frame(vec![release(at)], &mut show); + let own = editor.borrow().reset; + assert!(own.is_some(), "the editor asked for its own reset"); + let ime = frames.ime().cloned(); + assert!(ime.as_ref().is_some_and(|ime| ime.owner == framework && ime.interrupt), "the pass interrupts the field's composition"); + assert_eq!(ime.and_then(|ime| ime.reset), own, "the interrupt publishes the editor's request, not a new one"); + let Some(own) = own else { return }; + frames.frame( + vec![ + Event::Ime(ImeEvent::Commit("Q".to_owned())), + Event::ImeResetCompleted { request_id: own }, + Event::Ime(ImeEvent::Commit("X".to_owned())), + ], + &mut show, + ); + assert_eq!(editor.borrow().reset, None, "the completion of its request reaches the editor"); + assert_eq!(editor.borrow().text, "X", "the field's late commit is fenced and the commit after the completion reaches the editor"); +} + +/// The app's editor asks for its own reset at the press that takes the focus from a composing framework field, while +/// the field still owns the IME. egui publishes that request on the field's output as an interrupt; the engine takes it +/// as its interrupt of the field and fences on it. The field loses the IME in the next pass with no second interrupt, +/// the platform's answer in that frame reaches the editor, the field's late commit stays fenced, and the editor takes +/// the commits after it. +#[trial] +fn an_app_editor_s_reset_asked_at_the_press_on_it_while_a_framework_field_composes_completes() { + let (framework, rect, editor, mut show, mut frames) = framework_field_composing_beside_an_app_editor(); + let at = rect.center(); + editor.borrow_mut().ask = true; + frames.frame(vec![moved(at), press(at)], &mut show); + let own = editor.borrow().reset; + assert!(own.is_some(), "the editor asked for its own reset at the press"); + let ime = frames.ime().cloned(); + assert!(ime.as_ref().is_some_and(|ime| ime.owner == framework && ime.interrupt), "the request interrupts the field's composition"); + assert_eq!(ime.and_then(|ime| ime.reset), own, "the field's output carries the editor's request"); + let Some(own) = own else { return }; + frames.frame(vec![release(at), Event::Ime(ImeEvent::Commit("Q".to_owned())), Event::ImeResetCompleted { request_id: own }], &mut show); + assert!(!frames.ime().is_some_and(|ime| ime.interrupt), "the field loses the IME without a second interrupt"); + assert_eq!(editor.borrow().reset, None, "the completion of its request reaches the editor"); + frames.frame(vec![Event::Ime(ImeEvent::Commit("X".to_owned()))], &mut show); + assert_eq!(editor.borrow().text, "X", "the field's late commit is fenced and the editor takes the commit after the completion"); +} + +#[trial] +fn a_focused_egui_field_keeps_escape_and_the_clipboard_and_tabs_on_through_the_one_order() { let (host, mut show) = host_window(); let mut frames = Frames::new(); frames.frame(Vec::new(), &mut show); @@ -263,15 +393,50 @@ fn a_focused_egui_field_keeps_tab_escape_and_the_clipboard() { frames.frame(vec![Event::Paste("x".to_owned())], &mut show); assert_eq!(host.borrow().text, "x", "the paste reaches the focused field"); press_key(&mut frames, &mut show, Key::Tab); - assert_eq!(seen(&host), (vec![Key::Tab], 0), "the field's Tab is egui's"); + assert_eq!(seen(&host), (Vec::new(), 0), "a single-line field's Tab is the framework's move, never egui's"); frames.frame(Vec::new(), &mut show); - assert_eq!(egui_focused(&frames.ctx), Some(named_id("button")), "egui's Tab moves focus on to the next widget"); + assert_eq!(egui_focused(&frames.ctx), Some(named_id("button")), "the field is the last stop: Tab wraps to the framework's button"); fixture::host_focus(&frames.ctx, field()); frames.frame(Vec::new(), &mut show); press_key(&mut frames, &mut show, Key::Escape); assert_eq!(seen(&host), (vec![Key::Escape], 0), "the field's Escape is egui's, and no window Cancel"); } +/// The Enter presses in egui's input and the window Submits taken after one Enter, with the host's field focused or +/// nothing focused. +fn enter_with(field_focused: bool) -> (usize, usize) { + let counts = Rc::new(Cell::new((0usize, 0usize))); + let counted = Rc::clone(&counts); + let (_host, mut base) = host_window(); + let mut show = move |ui: &mut Ui| { + let enters = ui.input(|input| input.events.iter().filter(|event| matches!(event, Event::Key { key: Key::Enter, pressed: true, .. })).count()); + let submit = with_window_intents(ui.ctx(), false, |intents| intents.take(Intent::Submit)); + let (seen, taken) = counted.get(); + counted.set((seen + enters, taken + usize::from(submit))); + base(ui); + }; + let mut frames = Frames::new(); + frames.frame(Vec::new(), &mut show); + if field_focused { + fixture::host_focus(&frames.ctx, field()); + frames.frame(Vec::new(), &mut show); + assert_eq!(egui_focused(&frames.ctx), Some(field()), "the host's field holds egui focus"); + } + counts.set((0, 0)); + press_key(&mut frames, &mut show, Key::Enter); + frames.idle(2, &mut show); + counts.get() +} + +/// An app's own focused widget keeps the plain Enter as it keeps Escape: it reads it from egui once, and no window +/// Submit comes of it, so an app that turns the window's Submit back into an Enter does not get two. With nothing +/// focused the plain Enter is the window's Submit and stays in egui's input too. +#[trial] +fn a_focused_egui_field_keeps_enter_and_the_window_gets_no_submit() { + assert_eq!(enter_with(true), (1, 0), "the field reads one Enter and the window takes no Submit"); + assert_eq!(enter_with(false), (1, 1), "with nothing focused, Enter is the window's Submit and stays in egui"); +} + #[trial] fn an_open_egui_popup_keeps_escape() { let popup = named_id("host popup"); @@ -312,8 +477,10 @@ fn escape_cancels_a_framework_drag_while_an_egui_field_has_focus() { frames.frame(vec![release(inside)], &mut show); } +/// The app's own buttons drawn after the window's framework button and host field: egui's arrows move focus among +/// them, and Tab and Shift+Tab move it through the window's one order, which holds them. #[trial] -fn arrows_and_tab_move_egui_focus_among_host_buttons() { +fn arrows_move_egui_focus_among_host_buttons_and_tab_moves_through_the_one_order() { let (left, right) = (named_id("host left"), named_id("host right")); let (_host, mut base) = host_window(); let mut show = move |ui: &mut Ui| { @@ -330,7 +497,7 @@ fn arrows_and_tab_move_egui_focus_among_host_buttons() { press_key(&mut frames, &mut show, Key::ArrowLeft); assert_eq!(egui_focused(&frames.ctx), Some(left), "ArrowLeft moves it back"); press_key(&mut frames, &mut show, Key::Tab); - assert_eq!(egui_focused(&frames.ctx), Some(right), "Tab moves egui focus on"); + assert_eq!(egui_focused(&frames.ctx), Some(right), "Tab moves focus on to the next stop"); frames.frame(vec![key_press(Key::Tab, Modifiers::SHIFT)], &mut show); frames.frame(Vec::new(), &mut show); assert_eq!(egui_focused(&frames.ctx), Some(left), "Shift+Tab moves it back"); @@ -343,6 +510,27 @@ fn arrows_and_tab_move_egui_focus_among_host_buttons() { assert_eq!(egui_focused(&frames.ctx), Some(named_id("button")), "egui's arrows leave a framework stop's focus alone"); } +/// Arrows from an entry of the app's own popup list stay in the list: the app's button under the list, a Tab stop as +/// every focusable widget of the app is, is no arrow target while the list covers it, though it lies nearer below the +/// first entry than the second entry does. +#[trial] +fn arrows_in_an_app_popup_list_skip_the_widget_it_covers() { + let (button, popup, first, second) = (named_id("host tool"), named_id("host popup"), named_id("host entry 1"), named_id("host entry 2")); + let mut show = move |ui: &mut Ui| { + fixture::host_button(ui, button, Rect::from_min_max(Pos2::new(228.0, 31.0), Pos2::new(254.0, 57.0))); + areas::host_popup_list(ui.ctx(), popup, Pos2::new(201.0, 18.0), &[first, second]); + }; + let mut frames = Frames::new(); + frames.idle(2, &mut show); + fixture::host_focus(&frames.ctx, first); + frames.idle(2, &mut show); + assert_eq!(egui_focused(&frames.ctx), Some(first)); + press_key(&mut frames, &mut show, Key::ArrowDown); + assert_eq!(egui_focused(&frames.ctx), Some(second), "ArrowDown goes to the list's next entry, not to the button under it"); + press_key(&mut frames, &mut show, Key::ArrowUp); + assert_eq!(egui_focused(&frames.ctx), Some(first), "ArrowUp comes back to the first entry"); +} + /// What the window shows before the app's own egui buttons. #[derive(Clone, Copy)] enum Before { @@ -395,21 +583,56 @@ fn tab_from_nothing(before: Before, shift: bool) -> (Option, bool) { (egui_focused(&frames.ctx), reached) } +/// Tab is the framework's move whatever the window holds: from nothing focused it reaches the app's own widgets as its +/// stops, and never egui's input. A component's widget that registered no stop is no stop of the app's own. #[trial] -fn tab_from_nothing_focused_in_a_window_without_stops_moves_egui_focus() { +fn tab_from_nothing_reaches_the_app_s_widgets_as_the_framework_s_move() { let (first, last) = (Some(named_id("host first")), Some(named_id("host last"))); - assert_eq!(tab_from_nothing(Before::Nothing, false), (first, true), "Tab gives egui focus to the first host button"); - assert_eq!(tab_from_nothing(Before::Nothing, true), (last, true), "Shift+Tab to the last"); - assert_eq!(tab_from_nothing(Before::Stop, false), (Some(named_id("button")), false), "with a framework stop, Tab is the framework's move"); - assert_eq!(tab_from_nothing(Before::Unstopped, false), (None, true), "egui's Tab gives no focus to a component's widget without a stop"); - let (focused, reached) = tab_from_nothing(Before::FocusedUnstopped, false); - assert!(focused.is_some() && focused != first && !reached, "egui focus on that widget is focus: the Tab is not egui's and moves nothing"); + assert_eq!(tab_from_nothing(Before::Nothing, false), (first, false), "Tab focuses the first host button"); + assert_eq!(tab_from_nothing(Before::Nothing, true), (last, false), "Shift+Tab the last"); + assert_eq!(tab_from_nothing(Before::Stop, false), (Some(named_id("button")), false), "the framework stop drawn first comes first"); + assert_eq!(tab_from_nothing(Before::Unstopped, false), (first, false), "a component's widget without a stop gets no focus"); + assert_eq!(tab_from_nothing(Before::FocusedUnstopped, false), (first, false), "from that widget holding focus, Tab goes to the first stop"); } -/// A window whose only stop is the app's own canvas, between two of the app's own buttons: a bare Tab moves egui -/// focus through egui's order, from nothing focused and from the canvas alike, and a canvas that keeps Tab keeps it. +/// A window with a framework stop, two of the app's own buttons and the app's canvas, which keeps Tab, unfocused: Tab +/// from nothing is the framework's move over its one order, which holds the app's buttons beside the framework's +/// stop. The unfocused canvas does not keep the Tab; it is the last entry, and once Tab focuses it, it keeps Tab. #[trial] -fn tab_moves_egui_focus_through_the_app_s_widgets_while_every_stop_is_a_host_stop() { +fn tab_from_nothing_goes_through_the_framework_order_with_the_app_s_widgets() { + let (stop, first, second, canvas) = (named_id("button"), named_id("host first"), named_id("host second"), named_id("host canvas")); + let reached = Rc::new(Cell::new(false)); + let seen_tab = Rc::clone(&reached); + let mut show = move |ui: &mut Ui| { + seen_tab.set(seen_tab.get() || key_reached(ui.ctx(), Key::Tab)); + widget(ui, stop); + register_stop(ui.ctx(), Stop::new(stop, KeyUse::of(Input::Pointer))); + for (id, x) in [(first, 300.0), (second, 420.0)] { + fixture::host_button(ui, id, Rect::from_min_size(Pos2::new(x, 300.0), egui::vec2(80.0, 30.0))); + } + widget(ui, canvas); + host_canvas(ui.ctx(), canvas, KeyUse::CANVAS.with_keep(KeepKeys::Tab)); + }; + let mut frames = Frames::new(); + frames.idle(2, &mut show); + let mut tab = |frames: &mut Frames| { + reached.set(false); + press_key(frames, &mut show, Key::Tab); + frames.frame(Vec::new(), &mut show); + (egui_focused(&frames.ctx), reached.get()) + }; + assert_eq!(tab(&mut frames), (Some(stop), false), "Tab from nothing goes to the first stop, not to the unfocused canvas"); + assert_eq!(tab(&mut frames), (Some(first), false), "then to the app's first button"); + assert_eq!(tab(&mut frames), (Some(second), false), "and its second, in the order the pass registered them"); + assert_eq!(tab(&mut frames), (Some(canvas), false), "then to the canvas"); + assert_eq!(tab(&mut frames), (Some(canvas), true), "the focused canvas keeps Tab and reads it from egui"); +} + +/// A window of the app's own canvas between two of the app's own buttons, with no framework stop: a bare Tab moves +/// focus through them in the order the pass drew them, from nothing focused and from the canvas alike, and never +/// reaches egui; a canvas that keeps Tab keeps it. +#[trial] +fn tab_moves_through_the_app_s_widgets_and_canvas_in_a_window_without_framework_stops() { let (first, canvas, last) = (named_id("host first"), named_id("host canvas"), named_id("host last")); let keeps = Rc::new(Cell::new(false)); let reached = Rc::new(Cell::new(false)); @@ -429,9 +652,9 @@ fn tab_moves_egui_focus_through_the_app_s_widgets_while_every_stop_is_a_host_sto frames.frame(Vec::new(), &mut *show); (egui_focused(&frames.ctx), reached.get()) }; - assert_eq!(tab(&mut frames, &mut show), (Some(first), true), "Tab from nothing gives egui focus to the first widget in egui's order"); - assert_eq!(tab(&mut frames, &mut show), (Some(canvas), true), "the next Tab reaches the canvas"); - assert_eq!(tab(&mut frames, &mut show), (Some(last), true), "Tab from the canvas moves on through egui's order"); + assert_eq!(tab(&mut frames, &mut show), (Some(first), false), "Tab from nothing focuses the first widget drawn"); + assert_eq!(tab(&mut frames, &mut show), (Some(canvas), false), "the next Tab reaches the canvas"); + assert_eq!(tab(&mut frames, &mut show), (Some(last), false), "Tab from the canvas moves on"); keeps.set(true); request(&frames.ctx, FocusTarget::Id(canvas)); frames.idle(2, &mut show); @@ -439,6 +662,194 @@ fn tab_moves_egui_focus_through_the_app_s_widgets_while_every_stop_is_a_host_sto assert_eq!(tab(&mut frames, &mut show), (Some(canvas), true), "a canvas that keeps Tab gets it from egui and keeps the focus"); } +/// The window the one-order trials show: the app's own button, a framework stop, the app's own single-line text field +/// inside a framework scope, a framework stop and the app's own button, in that order. +const MIXED: [&str; 5] = ["app first", "framework one", "app field", "framework two", "app last"]; + +fn mixed_window() -> impl FnMut(&mut Ui) { + let mut text = String::new(); + move |ui: &mut Ui| { + let [first, one, field, two, last] = MIXED.map(named_id); + fixture::host_button(ui, first, Rect::from_min_size(Pos2::new(20.0, 300.0), egui::vec2(80.0, 30.0))); + widget(ui, one); + register_stop(ui.ctx(), Stop::new(one, KeyUse::of(Input::Pointer))); + push_scope(ui.ctx(), named_id("group"), FocusPolicy::NONE, None); + fixture::host_field(ui, field, &mut text); + pop_scope(ui.ctx()); + widget(ui, two); + register_stop(ui.ctx(), Stop::new(two, KeyUse::of(Input::Pointer))); + fixture::host_button(ui, last, Rect::from_min_size(Pos2::new(420.0, 300.0), egui::vec2(80.0, 30.0))); + } +} + +/// A Tab press with `mods`, released in the same frame, and the frame after it: where egui focus is then. +fn tab_with(frames: &mut Frames, show: &mut impl FnMut(&mut Ui), mods: Modifiers) -> Option { + frames.frame(vec![key_press(Key::Tab, mods), key_release(Key::Tab, mods)], &mut *show); + frames.frame(Vec::new(), &mut *show); + egui_focused(&frames.ctx) +} + +/// Every focusable egui widget the app draws is a Tab stop of the window's one order, where the pass drew it among the +/// framework's stops, with no registration of its own: Tab from nothing visits the five in order and wraps, and +/// Shift+Tab walks back. +#[trial] +fn tab_reaches_the_app_s_egui_widgets_beside_the_framework_stops_in_registration_order() { + let mut show = mixed_window(); + let mut frames = Frames::new(); + frames.idle(2, &mut show); + let order = MIXED.map(|name| Some(named_id(name))); + let forward: Vec> = (0..6).map(|_| tab_with(&mut frames, &mut show, Modifiers::NONE)).collect(); + assert_eq!(forward, [&order[..], &order[..1]].concat(), "Tab visits the five in the order the pass drew them, then wraps"); + let back: Vec> = (0..5).map(|_| tab_with(&mut frames, &mut show, Modifiers::SHIFT)).collect(); + let reversed: Vec> = order.iter().rev().copied().collect(); + assert_eq!(back, reversed, "Shift+Tab walks back from the first, wrapping to the last"); +} + +/// F6 lands on the app's own widget in a pane whose only content it is. +#[trial] +fn f6_lands_on_an_app_widget_in_a_pane() { + let button = named_id("app pane button"); + let mut show = move |ui: &mut Ui| { + show_panes(ui); + push_scope(ui.ctx(), named_id("app pane"), FocusPolicy::PANE, Some(Arc::from("App"))); + fixture::host_button(ui, button, Rect::from_min_size(Pos2::new(420.0, 300.0), egui::vec2(80.0, 30.0))); + pop_scope(ui.ctx()); + }; + let mut frames = Frames::new(); + frames.idle(2, &mut show); + focus_stop(&mut frames, &mut show, named_id("right")); + let (focused, said) = pane_key(&mut frames, &mut show, Modifiers::NONE); + assert_eq!(focused, Some(button), "F6 from the right pane goes to the app's pane and its button"); + assert!(said.contains(&"App".to_owned()), "and announces the pane: {said:?}"); +} + +/// A focused multi-line text field of the app's own whose egui key filter keeps Tab (it locks focus) gets the Tab in +/// egui and types it; a single-line field of the app's own moves on to the next stop. +#[trial] +fn an_app_field_that_keeps_tab_types_it_and_a_single_line_field_tabs_on() { + let (code, line, after) = (named_id("app code"), named_id("app line"), named_id("framework after")); + let texts = Rc::new(RefCell::new((String::new(), String::new()))); + let shared = Rc::clone(&texts); + let mut show = move |ui: &mut Ui| { + let mut texts = shared.borrow_mut(); + let (code_text, line_text) = &mut *texts; + fixture::host_code_field(ui, code, code_text); + fixture::host_field(ui, line, line_text); + widget(ui, after); + register_stop(ui.ctx(), Stop::new(after, KeyUse::of(Input::Pointer))); + }; + let mut frames = Frames::new(); + frames.idle(2, &mut show); + fixture::host_focus(&frames.ctx, code); + frames.idle(2, &mut show); + assert_eq!(tab_with(&mut frames, &mut show, Modifiers::NONE), Some(code), "the field that keeps Tab keeps the focus"); + assert!(texts.borrow().0.contains('\t'), "and types the Tab: {:?}", texts.borrow().0); + fixture::host_focus(&frames.ctx, line); + frames.idle(2, &mut show); + assert_eq!(tab_with(&mut frames, &mut show, Modifiers::NONE), Some(after), "the single-line field's Tab moves on"); + assert_eq!(texts.borrow().1, "", "and types nothing"); +} + +/// Where Tab reaches only text fields (the Mac's default), it reaches the app's own text field and skips the app's +/// own buttons, as it skips the framework's. +#[trial] +fn tab_that_reaches_only_text_fields_reaches_the_app_s_field_and_skips_its_buttons() { + let mut show = mixed_window(); + let mut frames = Frames::new(); + crate::runtime::windows::set_os(&frames.ctx, craft_host::target::Os::Mac); + frames.root({ + let mut root = RootEnv::default(); + root.tab_all_controls = false; + root + }); + frames.idle(2, &mut show); + let field = Some(named_id("app field")); + assert_eq!(tab_with(&mut frames, &mut show, Modifiers::NONE), field, "Tab from nothing goes to the app's field"); + assert_eq!(tab_with(&mut frames, &mut show, Modifiers::NONE), field, "the field is the one entry: the next Tab stays on it"); +} + +/// While an app's own egui popup is open, Tab is egui's, as Escape is: the framework moves no focus with it. +#[trial] +fn an_open_app_popup_keeps_tab() { + let popup = named_id("host popup"); + let (host, mut base) = host_window(); + let mut show = move |ui: &mut Ui| { + base(ui); + areas::host_popup(ui, popup, Pos2::ZERO); + }; + let mut frames = Frames::new(); + frames.frame(Vec::new(), &mut show); + request(&frames.ctx, FocusTarget::Id(named_id("button"))); + frames.idle(2, &mut show); + areas::open_host_popup(&frames.ctx, popup); + frames.frame(Vec::new(), &mut show); + assert!(areas::host_popup_open(&frames.ctx, popup)); + seen(&host); + press_key(&mut frames, &mut show, Key::Tab); + assert_eq!(seen(&host).0, vec![Key::Tab], "the popup's Tab is egui's"); + frames.frame(Vec::new(), &mut show); + assert_eq!(egui_focused(&frames.ctx), Some(named_id("button")), "the framework moved no focus"); +} + +/// The scan that makes the app's egui widgets Tab stops classifies each focus candidate of a pass once, however many +/// registrations take candidates in between: the pass's lookups grow with its widgets, one per app widget. +#[trial] +fn each_focus_candidate_of_a_pass_is_classified_once() { + let lookups = |n: usize| { + let mut show = move |ui: &mut Ui| { + for at in 0..n { + fixture::host_button( + ui, + crate::runtime::egui::memory::unique(("app", at)), + Rect::from_min_size(Pos2::new(10.0, 30.0 * at as f32), egui::vec2(60.0, 20.0)), + ); + widget(ui, crate::runtime::egui::memory::unique(("framework", at))); + register_stop(ui.ctx(), Stop::new(crate::runtime::egui::memory::unique(("framework", at)), KeyUse::of(Input::Pointer))); + } + }; + let mut frames = Frames::new(); + frames.idle(2, &mut show); + crate::runtime::pointer::made_lookups(&frames.ctx, ViewportId::ROOT) as usize + }; + // The framework widget is the root of the stop registered after it, so only the app's widgets need a lookup. + let (small, large) = (lookups(8), lookups(16)); + assert!(small >= 8, "every app widget is looked up: {small}"); + assert_eq!(large - small, 8, "eight more app widgets cost one lookup each: {small} then {large}"); +} + +/// A Tab in a window with no stop and nothing focused moves no focus, so it stays in egui's input for the app's own +/// binding (EffectCraft's Tab for the timeline's mini flowchart), from the window's first pass on. Once the app draws a +/// focusable widget, that widget is a stop and the Tab is the framework's move to it. +#[trial] +fn an_unowned_tab_with_no_stops_reaches_the_app() { + let button = named_id("app button"); + let (reached, draw) = (Rc::new(Cell::new(0)), Rc::new(Cell::new(false))); + let mut show = { + let (reached, draw) = (Rc::clone(&reached), Rc::clone(&draw)); + move |ui: &mut Ui| { + if key_reached(ui.ctx(), Key::Tab) { + reached.set(reached.get() + 1); + } + if draw.get() { + fixture::host_button(ui, button, Rect::from_min_size(Pos2::new(40.0, 40.0), egui::vec2(80.0, 30.0))); + } + } + }; + let mut frames = Frames::new(); + press_key(&mut frames, &mut show, Key::Tab); + assert_eq!(reached.take(), 1, "the window's first pass has no stop: its Tab is the app's"); + frames.idle(2, &mut show); + frames.frame(vec![key_press(Key::Tab, Modifiers::SHIFT), key_release(Key::Tab, Modifiers::SHIFT)], &mut show); + assert_eq!(reached.take(), 1, "with nothing drawn, Shift+Tab is the app's too"); + assert_eq!(egui_focused(&frames.ctx), None); + draw.set(true); + frames.idle(2, &mut show); + press_key(&mut frames, &mut show, Key::Tab); + frames.frame(Vec::new(), &mut show); + assert_eq!(reached.take(), 0, "the app's button is a stop: the Tab is the framework's move"); + assert_eq!(egui_focused(&frames.ctx), Some(button), "and the Tab moved focus to the button"); +} + #[trial] fn escape_ends_an_egui_drag_on_a_host_widget() { let area = named_id("host drag area"); @@ -582,8 +993,8 @@ fn a_host_canvas_marks_the_window_and_tab_toggles_its_panels() { ); assert_eq!( tab_with_canvas(Some(KeyUse::CANVAS.with_keep(KeepKeys::Tab)), false), - (Vec::new(), true), - "with nothing focused, a canvas that keeps Tab gets it from egui and nothing toggles" + (vec![(ViewportId::ROOT, ChromeToggle::Panels)], false), + "a canvas keeps Tab only while focused: with nothing focused, Tab toggles the panels" ); } diff --git a/crates/ui-contract/src/testing/replay_trials.rs b/crates/ui-contract/src/testing/replay_trials.rs index 30981b5812..2f3e2741c9 100644 --- a/crates/ui-contract/src/testing/replay_trials.rs +++ b/crates/ui-contract/src/testing/replay_trials.rs @@ -125,6 +125,34 @@ fn replayed_focus_stops_keep_their_own_target() { }); } +// The app's own egui widgets drawn inside a recorded view are stops of its transcript, and none drawn before it; the +// replay registers each once, where the view shows, after the widgets drawn before it. +#[trial] +fn a_recorded_view_holds_the_app_s_widgets_drawn_in_it_and_its_replay_registers_them_once() { + let mut frames = Frames::new(); + let [before, inside] = [fixture::named_id("app before"), fixture::named_id("app inside")]; + let rect = |x: f32| Rect::from_min_size(Pos2::new(x, 100.0), Vec2::new(80.0, 30.0)); + let mut recorded = None; + frames.frame(Vec::new(), |ui| { + let ctx = ui.ctx().clone(); + fixture::host_button(ui, before, rect(20.0)); + replay::open(&ctx); + fixture::host_button(ui, inside, rect(120.0)); + recorded = Some(replay::close(&ctx, fixture::layer_of(ui))); + }); + let recorded = recorded.expect("the frame ran"); + assert_eq!(recorded.focus.stop_ids().collect::>(), [inside], "the transcript holds the widget drawn in the view alone"); + let mut order = Vec::new(); + frames.frame(Vec::new(), |ui| { + let ctx = ui.ctx(); + fixture::host_button(ui, before, rect(20.0)); + focus::replay(ctx, &recorded.focus); + focus::stop_count(ctx); + order = focus::tab_order(ctx, |_| true).into_iter().map(|(id, _)| id).collect(); + }); + assert_eq!(order, [before, inside], "the replay registers the view's widget once, after the one drawn before it"); +} + /// Records `stops` run inside a record, with `entering` the first-pass flag of the layer scope it pushes, inside the /// scope `outer` when one is given. fn layer_scope_record(frames: &mut Frames, outer: Option, entering: bool) -> replay::Record { diff --git a/crates/ui-contract/tests/it/runtime/window_move.rs b/crates/ui-contract/tests/it/runtime/window_move.rs index d022b9b126..74172d65a7 100644 --- a/crates/ui-contract/tests/it/runtime/window_move.rs +++ b/crates/ui-contract/tests/it/runtime/window_move.rs @@ -4,12 +4,15 @@ //! move band is reported once. use craft_behavior::{Cursor, CursorIcon}; -use craft_host::target::{ShellInfo, WindowChrome, WindowInfo, WindowKind}; +use craft_host::target::{Backend, Os, ShellInfo, WindowChrome, WindowInfo, WindowKind}; use craft_ui::contract::overlay::Resize; use craft_ui::contract::{ - BodyCx, Common, Component, Container, ContainerProps, Cx, DragBand, HeaderRegion, Mount, Props as _, Role, Show as _, ShowContainer as _, Sizing, + BodyCx, Common, Component, Container, ContainerProps, Cx, DragBand, HeaderRegion, Mount, Overlay, Props as _, Role, Show as _, + ShowContainer as _, Sizing, }; use craft_ui::runtime::InstallSpec; +use craft_ui::runtime::focus::FocusPolicy; +use craft_ui::runtime::windows::WindowSpec; use craft_ui::style::StyleCx; use craft_ui::testing::layout::allocate; use craft_ui::testing::pointer::{moved, press, release}; @@ -17,8 +20,9 @@ use craft_ui::testing::trial; use craft_ui::testing::windows::FakeSystem; use craft_ui_test_kit::contract::{PlainStyle, Probe, Seen}; use craft_ui_test_kit::windows::Windows; +use craft_window::policy::{Desktop, DesktopKind, Runtime, TitleBarPref}; use egui::viewport::ResizeDirection; -use egui::{Event, Pos2, Rect, Response, Ui, Vec2, ViewportCommand, pos2, vec2}; +use egui::{Event, Pos2, Rect, Response, Ui, Vec2, ViewportCommand, ViewportInfo, pos2, vec2}; use std::cell::{Cell, RefCell}; use std::sync::Arc; @@ -185,3 +189,32 @@ fn where_appkit_resizes_a_window_the_app_registers_no_grips_and_leaves_the_curso let cursor = craft_ui::runtime::cursor::current(&windows.ctx); assert!(matches!(cursor, None | Some(Cursor::System(CursorIcon::Default))), "over AppKit's edge the cursor is left to the OS: {cursor:?}"); } + +/// photocraft#16905: a full-window container (RAW Develop, Vanishing Point) in an OS window of its own, in a window the +/// app frames, moves by its title row and resizes by its edges. Its fallback overlay covers the main window and neither +/// moves nor resizes, and the window took that rule: no move band and no grips, so the window could not be moved. +#[trial] +fn a_full_window_container_in_its_own_window_moves_and_resizes_it() { + const WINDOW: Vec2 = Vec2::new(900.0, 640.0); + let desktop = Desktop { kind: DesktopKind::Other, ssd: None, gtk_theme: None, icon_theme: None }; + let integrated = + craft_window::policy::decide(Os::Linux, Runtime::Native, Backend::X11, &desktop, WindowKind::Main, TitleBarPref::Integrated, None); + let windows = Windows::with(InstallSpec::new(ShellInfo::default(), Arc::new(FakeSystem::new())).frame(integrated)); + let rig = Rig::new(Mount::viewport_with(Overlay::full_window(FocusPolicy::DIALOG), WindowSpec::dialog())); + let rect = Rect::from_min_size(Pos2::new(100.0, 100.0), WINDOW); + windows.child_info(ViewportInfo { + inner_rect: Some(rect), + outer_rect: Some(rect), + native_pixels_per_point: Some(1.0), + ..ViewportInfo::default() + }); + for _ in 0..4 { + rig.frame(&windows, vec![], vec![]); + } + let title = rig.header.get(); + assert!(title.is_positive(), "the title row showed"); + let sent = drag(pos2(title.center().x + 30.0, title.center().y), vec2(40.0, 20.0), |events| rig.frame(&windows, vec![], events)); + assert!(sent.contains(&ViewportCommand::StartDrag), "a drag of the title row moves the window: {sent:?}"); + let sent = drag(pos2(WINDOW.x - 1.0, WINDOW.y / 2.0), vec2(-20.0, 0.0), |events| rig.frame(&windows, vec![], events)); + assert_eq!(resizes(&sent), [ResizeDirection::East], "a drag of the right edge resizes the window: {sent:?}"); +} diff --git a/crates/ui-contract/tests/it/text/editor.rs b/crates/ui-contract/tests/it/text/editor.rs index c3246338f9..fed1efee1c 100644 --- a/crates/ui-contract/tests/it/text/editor.rs +++ b/crates/ui-contract/tests/it/text/editor.rs @@ -1029,3 +1029,46 @@ fn an_alt_chord_bound_only_out_of_scope_leaves_its_text_typed() { let fired: Vec = take_output(&frames.ctx).fired.into_iter().map(|fired| fired.command.id).collect(); assert!(fired.is_empty(), "nothing ran: {fired:?}"); } + +/// A disabled editor registers no stop, and its focus widget is still the component's own and no egui focus candidate: +/// it never becomes a Tab stop of the app's own widgets, and egui's arrows from the app's own focused widget never +/// reach it. With every control in Tab order, Tab and Shift+Tab land on the button beside it each time. +#[trial] +fn tab_never_focuses_a_disabled_editor_s_widget() { + let log = RefCell::new(Vec::new()); + let seen = RefCell::new(Seen::default()); + let (editor, button) = (Cell::new(Id::NULL), Cell::new(Id::NULL)); + // The app's own egui button, level with the editor on its right: the editor lies straight to its left. + let app = craft_ui::testing::focus::named_id("app button"); + let app_at = Rect::from_min_size(Pos2::new(AT.right() + 40.0, AT.center().y - 10.0), egui::vec2(60.0, 20.0)); + let mut show = |ui: &mut egui::Ui| { + editor.set(Probe::new(&log, true).label("Source").enabled(false).id_salt("code").show_at(ui, AT).id); + button.set(Button::new(&seen).id_salt("next").show_at(ui, NEXT).id); + ui.interact(app_at, app, egui::Sense::click()); + }; + let mut frames = Frames::new(); + frames.root({ + let mut root = craft_ui::runtime::env::RootEnv::default(); + root.tab_all_controls = true; + root + }); + frames.idle(3, &mut show); + for shift in [false, false, true, true] { + let mods = if shift { Modifiers::SHIFT } else { Modifiers::NONE }; + frames.frame(vec![key_press(Key::Tab, mods), key_release(Key::Tab, mods)], &mut show); + frames.frame(Vec::new(), &mut show); + let focused = craft_ui::testing::focus::egui_focused(&frames.ctx); + assert!( + focused == Some(button.get()) || focused == Some(app), + "Tab (shift {shift}) lands on a control, never on the disabled editor {:?}: {focused:?}", + editor.get() + ); + } + craft_ui::runtime::focus::request(&frames.ctx, craft_ui::runtime::focus::FocusTarget::Id(app)); + frames.idle(2, &mut show); + assert_eq!(craft_ui::testing::focus::egui_focused(&frames.ctx), Some(app), "the app's button has the focus"); + frames.frame(vec![key_press(Key::ArrowLeft, Modifiers::NONE), key_release(Key::ArrowLeft, Modifiers::NONE)], &mut show); + frames.frame(Vec::new(), &mut show); + let focused = craft_ui::testing::focus::egui_focused(&frames.ctx); + assert!(focused == Some(app) || focused == Some(button.get()), "the arrow never reaches the disabled editor {:?}: {focused:?}", editor.get()); +} diff --git a/crates/ui-panels/src/dialog/frame.rs b/crates/ui-panels/src/dialog/frame.rs index be83544ae5..77a49830bf 100644 --- a/crates/ui-panels/src/dialog/frame.rs +++ b/crates/ui-panels/src/dialog/frame.rs @@ -278,7 +278,7 @@ pub const SIDE_BUTTONS: EndRegion = EndRegion::new().gap(REGION_GAP); /// `size.dialog.least` with paragraphs wrapping at `size.dialog.wrap`. A layer scrolls its body vertically unless the /// body is a collection; a frame in a parent's flow asks for the scroll itself. pub(crate) fn chrome_props() -> ContainerProps { - ContainerProps::new().surface(SurfaceKind::Dialog).pad(Pad::Regular).header(HEADER).least_width(LeastWidth::Dialog).wrap_width(WrapWidth::Dialog) + ContainerProps::new().surface(SurfaceKind::Dialog).pad(Pad::Dialog).header(HEADER).least_width(LeastWidth::Dialog).wrap_width(WrapWidth::Dialog) } /// The style of a dialog frame: the surface and padding come from the container. @@ -313,7 +313,7 @@ impl<'a> DialogFrame<'a> { /// The larger frame margin. #[must_use] pub fn roomy(mut self, on: bool) -> Self { - self.props = self.props.pad(if on { Pad::Roomy } else { Pad::Regular }); + self.props = self.props.pad(if on { Pad::Roomy } else { Pad::Dialog }); self } diff --git a/crates/ui-panels/src/dialog/modal.rs b/crates/ui-panels/src/dialog/modal.rs index 93ed9e84d8..3380d8c743 100644 --- a/crates/ui-panels/src/dialog/modal.rs +++ b/crates/ui-panels/src/dialog/modal.rs @@ -279,7 +279,7 @@ impl<'a> Dialog<'a> { /// The larger frame margin. #[must_use] pub fn roomy(mut self, on: bool) -> Self { - self.props = self.props.pad(if on { crate::contract::Pad::Roomy } else { crate::contract::Pad::Regular }); + self.props = self.props.pad(if on { crate::contract::Pad::Roomy } else { crate::contract::Pad::Dialog }); self } diff --git a/crates/ui-panels/src/docking/config.rs b/crates/ui-panels/src/docking/config.rs index be2d0180e6..22309ca23f 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,19 @@ 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, + /// 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. @@ -99,8 +105,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 @@ -132,7 +139,8 @@ impl Default for DockConfig { close_button: true, floating_grip: false, floating_rounded_body: false, - column_cards: false, + column_cards: ColumnCards::None, + flush_docks: false, tab_close_buttons: false, titled_headers: false, wheel_selects_tabs: false, @@ -252,10 +260,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 } @@ -266,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/dock_column.rs b/crates/ui-panels/src/docking/dock_column.rs index 63c43fc3be..5747b69c5f 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, @@ -332,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), } } @@ -515,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, SurfaceKind::Background, 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 6fcd46121e..2da0a00d62 100644 --- a/crates/ui-panels/src/docking/dock_column/stories.rs +++ b/crates/ui-panels/src/docking/dock_column/stories.rs @@ -1,11 +1,12 @@ //! 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; 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,29 +50,30 @@ 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(); 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); // 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() } @@ -83,12 +85,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/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/group.rs b/crates/ui-panels/src/docking/group.rs index c0aa267800..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, @@ -302,6 +302,8 @@ pub struct DockGroupOutput { pub tabs: Vec<(PanelKey, Rect, Id)>, /// The band the group is dragged by this pass, with the id of its accessibility node. pub grip: Option<(Rect, Id)>, + /// The strip's overflow button, when some tabs do not fit, with the id of its accessibility node. + pub overflow: Option<(Rect, Id)>, } impl Outcome for DockGroupOutput { @@ -337,6 +339,7 @@ struct Reported { /// A drag started on the strip's empty room, which `finish` starts as a drag of the group. empty_drag: bool, tabs: Vec<(PanelKey, Rect, Id)>, + overflow: Option<(Rect, Id)>, } /// A group of panels: a header of tab strip and panel menu button, dragged by its empty part, over the active panel's @@ -369,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. @@ -419,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(), @@ -469,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() @@ -502,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::(); @@ -515,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) @@ -627,7 +640,19 @@ impl Component for } let grip = cx.part_if_declared(GRIP).map(|grip| (grip.rect, crate::runtime::access::sub_node_id(cx.core.id, GRIP.into()))); let Reported { - picked, closed, picked_document, closed_documents, menu, item, commands, toggle_minimized, torn_off, drag_started, tabs, .. + picked, + closed, + picked_document, + closed_documents, + menu, + item, + commands, + toggle_minimized, + torn_off, + drag_started, + tabs, + overflow, + .. } = self.reported; DockGroupOutput { response: cx.response.clone(), @@ -643,6 +668,7 @@ impl Component for drag_started, tabs, grip, + overflow, } } } @@ -749,12 +775,13 @@ impl Container for // A press on the group's empty body focuses its panel, as in Photoshop; an app's own egui body keeps its presses. if surface_pressed && !self.host_body - && let Some((strip, _)) = &strip + && let Some((strip, _, _)) = &strip { focus::request(ui.ctx(), FocusTarget::Id(*strip)); } - if let Some((strip, tabs)) = &strip { + if let Some((strip, tabs, overflow)) = &strip { self.reported.tabs = tabs.iter().map(|(key, rect)| (*key, *rect, crate::contract::item_node(*strip, key))).collect(); + self.reported.overflow = *overflow; } let size = self.size; let (titles, reported) = (&self.panels, &mut self.reported); @@ -808,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)] @@ -888,10 +920,13 @@ fn shown_tab(panels: &[PanelTitle], active: PanelKey) -> PanelKey { .unwrap_or(active) } -/// A group's tab strip with its tab insertion spots. Returns the strip's id and the rect of each tab it shows, which a -/// replay returns again, moved with the row. The panels' documents are tabs of the same strip after the panel tabs: one +/// What a group's tab row shows: the strip's id, each shown tab's rect and the overflow button with its node id. +type TabRowShown = (Id, Vec<(PanelKey, Rect)>, Option<(Rect, Id)>); + +/// A group's tab strip with its tab insertion spots. Returns the strip's id, the rect of each tab it shows and the +/// overflow button with its node id, which a replay returns again, moved with the row. The panels' documents are tabs of the same strip after the panel tabs: one /// fit, one overflow menu and one keyboard order for both. Only panel tabs drag and take tab insertions. -fn tab_row(row: &mut TabRow<'_, P>, ui: &mut Ui) -> (Id, Vec<(PanelKey, Rect)>) { +fn tab_row(row: &mut TabRow<'_, P>, ui: &mut Ui) -> TabRowShown { let env = crate::runtime::env::Env::of(ui); let name = Label::from(env.words::().panels.as_str().to_owned()); let rtl = env.direction.is_rtl(); @@ -978,7 +1013,7 @@ fn tab_row(row: &mu if strip.empty_double { row.sent.send(TabEvent::EmptyDouble); } - (strip.response.response.id, strip.tab_rects) + (strip.response.response.id, strip.tab_rects, strip.overflow) } /// Registers the tab insertion spots of a group: the half of each shown tab nearer the start edge inserts before diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs index e3d2fe758c..f33dc4557b 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; 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,9 +16,10 @@ 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; use craft_behavior::dock::{Column, DockEdge, Group}; use craft_behavior::overlay::Side; use craft_behavior::{Axis, CursorIcon, DockSide, Metrics, PartKey, PressPhase, Sense, Value}; @@ -45,9 +46,14 @@ 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. + /// 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, /// The column width from which each cell shows its panel's name beside its icon. pub labels: f32, @@ -60,13 +66,12 @@ 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 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, band, separator, labels: size.rail.width * LABELS_IN_RAIL_WIDTHS } } /// The sizes in the root scope's style, for code outside a style pass: @@ -97,17 +102,20 @@ 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, - /// `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, } @@ -248,6 +256,14 @@ 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, + /// 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. @@ -285,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)>, @@ -310,6 +326,8 @@ impl<'a, P: Value + Hash + Debug + 'static> IconicColumn<'a, P> { mode: IconicMode::Flyouts, within: Rect::NOTHING, card: None, + tab_look: PanelTabLook::Plain, + framed: false, open, view: None, bar_rect: Rect::NOTHING, @@ -328,25 +346,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. @@ -413,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 { @@ -430,7 +480,7 @@ impl<'a, P: Value + Hash + Debug + 'static> IconicColumn<'a, P> { } y += sizes.cell; } - 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 } @@ -550,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"); @@ -649,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, SurfaceKind::Background, Corners::None); - } paint_chevron(ui, self.edge, ColumnArrow::Collapse, self.expanded(), cx.flow.is_rtl(), &cx.words::()); } let flat = self.flat(); @@ -686,13 +735,16 @@ 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)); } } } } + 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 { @@ -747,7 +799,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/stories.rs b/crates/ui-panels/src/docking/iconic/stories.rs index 29171652a8..6b085de17c 100644 --- a/crates/ui-panels/src/docking/iconic/stories.rs +++ b/crates/ui-panels/src/docking/iconic/stories.rs @@ -4,10 +4,11 @@ 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; +use crate::tabs::PanelTabLook; use crate::testing::memory::global; use crate::testing::{Drive, Fixture, StoryData, StoryOutput, stage, story}; use craft_behavior::Mixed; @@ -97,11 +98,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, }; @@ -114,7 +116,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 { @@ -232,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 b3d65d6652..3e1ce73cdc 100644 --- a/crates/ui-panels/src/docking/iconic/trials.rs +++ b/crates/ui-panels/src/docking/iconic/trials.rs @@ -18,13 +18,14 @@ 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}; 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,30 +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:?}"); } -/// 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 `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(IconGroupSeparator::Rule); - }, - |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, 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. 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, 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, 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 @@ -695,21 +713,134 @@ fn icon_groups_apart_by_a_rule_show_one_level_rule_between_them() { _ => None, }) .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"); + 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(), "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"); } - 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"), + 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:?}") }; + let middle = (last.bottom() + next.top()) / 2.0; + assert!(near(a.y, middle), "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 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"); + } +} + +/// 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:?}"); + } +} + +/// 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-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/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/sources.rs b/crates/ui-panels/src/docking/sources.rs index 5b07725d92..1399c147bf 100644 --- a/crates/ui-panels/src/docking/sources.rs +++ b/crates/ui-panels/src/docking/sources.rs @@ -1,6 +1,6 @@ -//! The places a dock area drew in a pass where a press starts a dock gesture: tabs, group bars, a floating window's -//! grip and resize grips, and the dividers. A host names them for its own automation (an element id per source) and -//! reads which one holds key focus by the source's node id. +//! The places a dock area drew in a pass where a press starts a dock gesture: tabs, group bars, a tab strip's overflow +//! button, a floating window's grip and resize grips, and the dividers. A host names them for its own automation (an +//! element id per source) and reads which one holds key focus by the source's node id. use crate::runtime::windows::ResizeEdge; use egui::{Id, Rect, ViewportId}; @@ -38,6 +38,9 @@ pub enum SourceKind

{ Document(P, u64), /// The bar a group is dragged by, named by the group's first panel. GroupBar(P), + /// The overflow button of a group's tab strip, named by the group's first panel: a click opens the menu of the tabs + /// that do not fit. Only while some tabs do not fit. + Overflow(P), /// The band a floating window is moved by, named by the window's first panel. WindowGrip(P), /// A grip a floating window is resized by, named by the window's first panel, with the edge or corner it moves. 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/src/docking/targets.rs b/crates/ui-panels/src/docking/targets.rs index 84e3b6d88e..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, @@ -51,7 +54,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, @@ -92,16 +95,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] @@ -143,10 +160,11 @@ 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, - 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(), @@ -163,7 +181,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 +229,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 +312,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 +324,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 +340,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-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-panels/tests/it/dialogs.rs b/crates/ui-panels/tests/it/dialogs.rs index 2d4b3c919d..453dc081e4 100644 --- a/crates/ui-panels/tests/it/dialogs.rs +++ b/crates/ui-panels/tests/it/dialogs.rs @@ -1157,3 +1157,36 @@ fn a_new_question_in_place_of_another_waits_again_for_its_armed_answer() { click_ok(&mut fixture); assert!(host.borrow().is_empty(), "after its delay the OK answers it"); } + +/// A dialog is padded `space.pad.dialog` and its footer buttons stand `size.dialog.button_height` high (VectorCraft's +/// 22-point margin and 28-point buttons); an app that sets neither keeps a panel's padding and a push button's height. +#[trial] +fn a_dialog_takes_its_padding_and_footer_button_height_from_the_dialog_sizes() { + let shown = |overrides: &[(&str, f32)]| { + let mut sizes = craft_theme::AppSizes::default(); + for (path, value) in overrides { + sizes.all.insert((*path).to_owned(), craft_theme::SizeValue::Number(*value)); + } + let mut root = craft_ui::runtime::env::RootEnv::default(); + root.sizes = Arc::new(sizes); + let mut fixture = Fixture::new(|ui| { + let mut open = true; + Dialog::new("Options").opened(Bind::bound(&mut open)).buttons([FooterButton::new("OK", DialogRole::Accept)]).show(ui, |ui, _| { + Text::new("Body text").show(ui); + }); + }); + fixture.root(root).room(vec2(1200.0, 800.0)).settle(); + let dialog = fixture.by_role(Role::DIALOG).first().expect("the dialog shows").rect; + let text = fixture.texts().iter().find(|run| run.text == "Body text").expect("the body is painted").rect; + (text.left() - dialog.left(), fixture.by_label("OK").expect("the footer's OK").rect.height()) + }; + let standard = shown(&[]); + let dialog = shown(&[("space.pad.dialog", 30.0), ("size.dialog.button_height", 40.0)]); + assert!(dialog.0 > standard.0 + 10.0, "a larger dialog padding moves the body in from the edge: {standard:?} then {dialog:?}"); + assert!(dialog.1 > standard.1 + 10.0, "a taller dialog button raises OK: {standard:?} then {dialog:?}"); + let follows = shown(&[("space.pad.regular", 30.0), ("size.button", 40.0)]); + assert!( + (follows.0 - dialog.0).abs() < 0.5 && (follows.1 - dialog.1).abs() < 0.5, + "both follow the panel padding and the push button: {follows:?} and {dialog:?}" + ); +} 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-patterns/src/patterns/dock/area.rs b/crates/ui-patterns/src/patterns/dock/area.rs index 1f19d184f5..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| { @@ -1332,6 +1335,9 @@ impl Pass<'_, P> { }; let tabs = output.tabs.iter().filter_map(|(key, rect, node)| Some(DockSource::new(kind_of(*key)?, *rect, *node))); self.report.sources.extend(tabs); + if let Some((rect, node)) = output.overflow { + self.report.sources.push(DockSource::new(SourceKind::Overflow(anchor.clone()), rect, node)); + } if let Some((rect, node)) = output.grip { self.report.sources.push(DockSource::new(SourceKind::GroupBar(anchor.clone()), rect, node)); } @@ -1430,7 +1436,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); } @@ -1544,7 +1550,9 @@ impl Pass<'_, P> { .bar(bar) .within(within) .auto_collapse(scene.auto_collapse) - .mode(mode); + .mode(mode) + .tab_look(scene.config.tab_look) + .framed(scene.config.flush_docks && !in_window); let shown = match card { Some(place) => shown.card(place), None => shown, @@ -1603,7 +1611,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/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/src/patterns/form_dialogs/mod.rs b/crates/ui-patterns/src/patterns/form_dialogs/mod.rs index f7370238d9..3719e476ea 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/mod.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/mod.rs @@ -63,7 +63,7 @@ pub(crate) mod new_document; pub use new_document::{ BACKGROUND_COLOR_KEY, BackgroundContents, BitDepth, CardCx, CardSource, ColorMode, ColorProfiles, DetailsCx, DocumentCard, DocumentOptions, DocumentPreset, DocumentSettings, HostedNewDocument, NewDocumentDialog, NewDocumentOutput, NewDocumentPresetWords, NewDocumentResult, - NewDocumentWords, Orientation, PIXEL_ASPECTS, PresetCategory, RasterMemory, RasterSetup, SQUARE_PIXELS, + NewDocumentWords, Orientation, PIXEL_ASPECTS, PresetCardLook, PresetCategory, RasterMemory, RasterSetup, SQUARE_PIXELS, }; pub(crate) mod about; diff --git a/crates/ui-patterns/src/patterns/form_dialogs/new_document.rs b/crates/ui-patterns/src/patterns/form_dialogs/new_document.rs index ad1fd59986..e6820c921c 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/new_document.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/new_document.rs @@ -31,6 +31,7 @@ use craft_theme::Srgba; use egui::{Context, Response, Ui}; use std::cell::RefCell; +pub use cards::PresetCardLook; use cards::{Left, TabId}; use details::Right; diff --git a/crates/ui-patterns/src/patterns/form_dialogs/new_document/cards.rs b/crates/ui-patterns/src/patterns/form_dialogs/new_document/cards.rs index 85d75fd697..dff576276b 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/new_document/cards.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/new_document/cards.rs @@ -4,12 +4,12 @@ use super::presets::{DEFAULT_ID, DocumentOptions, DocumentPreset, NewDocumentPre use super::settings::{CardCx, CardSource, DocumentCard, DocumentSettings, RasterSetup}; use super::{NewDocumentWords, Read, Session, background_label, depth_label, mode_label}; use crate::buttons::{Button, ButtonOutput}; -use crate::contract::{Bind, CollectionEvent, Props as _, SelectMode, Show as _, ShowCollection as _, clicked}; +use crate::contract::{Bind, CollectionEvent, MemoProps, Props as _, SelectMode, Show as _, ShowCollection as _, clicked}; use crate::display::{Shade, Text}; use crate::list::{List, ListRow, ThumbAspect}; use crate::patterns::presets::{PresetId, PresetLibrary}; use crate::primitives::{ContentPainterCx, StrokeWidth}; -use crate::runtime::env::{Label, UnitKind}; +use crate::runtime::env::{Env, EnvValue, Label, UnitKind}; use crate::style::TypeRole; use crate::tabs::{Tab, TabKind, TabStrip}; use crate::tile_grid::{CardText, Tile, TileGrid}; @@ -172,17 +172,21 @@ pub(super) fn show(ui: &mut Ui, session: &Session, value let count = read.units.number(cards.len() as f64, 0..=0); let heading = Label::from(words.presets_heading.fill(&[("n", &count)])); Text::new(heading).role(TypeRole::SectionCaption).shade(Shade::Muted).show(ui); + let look = Env::of(ui).get::(); let shown = TileGrid::::new(words.cards.clone()) .card_columns(CARD_COLUMNS) .card() - .card_text(CardText::Preset) + .card_text(match look { + PresetCardLook::Outline => CardText::Preset, + PresetCardLook::Page => CardText::Page, + }) .fill_row() .aspect(2.0) .select(SelectMode::Single) .detail_line() .rows_stamp(stamp) .selection(Bind::given(selection)) - .show_items(ui, &list, &mut |index, _| tile_of(&cards[*index])); + .show_items(ui, &list, &mut |index, _| tile_of(&cards[*index], look)); route(shown.response.events, &cards, left); } } @@ -350,13 +354,29 @@ fn recent_title(recent: &DocumentOptions, cx: &CardCx<'_, DocumentOptions>) -> L found.map_or_else(|| cx.words.custom.clone(), |preset| preset_title(preset, cx.setup, cx.words, cx.preset_words)) } -/// The tile of a card: the page outline at the card's aspect, the title and the size line. -fn tile_of(card: &DocumentCard) -> Tile<'static> { +/// How New Document's preset cards show their page. An app sets it once at its root (`RootEnv::values`). +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, EnvValue, MemoProps)] +#[env(style)] +#[non_exhaustive] +pub enum PresetCardLook { + /// A small page outline in content ink on a raised card, the name and size line centred under it. + #[default] + Outline, + /// Blank paper on its shadow (`Tile::page`) on a flat card (`CardText::Page`): the name strong on up to two lines, + /// the size line under it. VectorCraft's preset cards, as production drew them. + Page, +} + +/// The tile of a card: the page at the card's aspect in `look`, the title and the size line. +fn tile_of(card: &DocumentCard, look: PresetCardLook) -> Tile<'static> { let page = card.settings.page(); - let tile = Tile::new(card.title.clone()) - .detail(card.line.clone()) - .flat_thumbnail() - .thumb(ThumbAspect::new(2, 1), move |painter: &ContentPainterCx<'_>, rect: Rect| paint_page(painter, rect, page)); + let tile = Tile::new(card.title.clone()).detail(card.line.clone()); + let tile = match look { + PresetCardLook::Outline => { + tile.flat_thumbnail().thumb(ThumbAspect::new(2, 1), move |painter: &ContentPainterCx<'_>, rect: Rect| paint_page(painter, rect, page)) + } + PresetCardLook::Page => tile.page(page.0, page.1), + }; match &card.tooltip { Some(tooltip) => tile.tooltip(tooltip.clone()), None => tile, diff --git a/crates/ui-patterns/src/patterns/form_dialogs/new_document/stories.rs b/crates/ui-patterns/src/patterns/form_dialogs/new_document/stories.rs index d1db0e5c02..fb9f2a7df5 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/new_document/stories.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/new_document/stories.rs @@ -1,6 +1,6 @@ //! Stories of `NewDocumentDialog`. -use super::{CardCx, CardSource, DetailsCx, DocumentCard, DocumentOptions, DocumentSettings, NewDocumentDialog}; +use super::{CardCx, CardSource, DetailsCx, DocumentCard, DocumentOptions, DocumentSettings, NewDocumentDialog, PresetCardLook}; use crate::buttons::Button; use crate::choice::Checkbox; use crate::contract::{Bind, Entry, Outcome as _, Props as _, Show as _, ShowContainer as _, clicked}; @@ -8,6 +8,7 @@ use crate::form::Field; use crate::patterns::presets::{GroupPath, PresetLibrary}; use crate::pickers::Select; use crate::popover::Popover; +use crate::runtime::env::with_env; use crate::testing::{Drive, StoryData, StoryOutput, story}; use craft_behavior::PixelSize; use egui::Ui; @@ -23,6 +24,20 @@ fn new_document_dialog(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { dialog.opened(data.bind("open", true)).show(ui).into() } +/// The preset cards in `PresetCardLook::Page`, which an app sets at its root (VectorCraft's): blank paper on flat +/// cards, the selected one with the hover fill and an accent edge. +#[story(NewDocumentDialog<'static>, covers = [], drive = Drive::Never, title = "Page cards")] +fn new_document_dialog_page_cards(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let opened = data.bind("open", true); + with_env( + ui, + |overrides| { + overrides.values.set(PresetCardLook::Page); + }, + |ui| NewDocumentDialog::new(Bind::kept()).clipboard(PixelSize::new(1920, 1080)).opened(opened).show(ui).into(), + ) +} + #[story(NewDocumentDialog<'static>, covers = [], drive = Drive::Never)] fn new_document_dialog_with_app_presets(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let presets = ( diff --git a/crates/ui-patterns/tests/it/docking/columns.rs b/crates/ui-patterns/tests/it/docking/columns.rs index 217f91ad0c..f955893300 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, + 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; +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}; @@ -510,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()))))); @@ -537,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()); @@ -593,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]; @@ -629,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)); @@ -654,3 +655,114 @@ 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}"); +} + +/// `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:?}"); + } +} + +/// 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"); + } +} diff --git a/crates/ui-patterns/tests/it/docking/native.rs b/crates/ui-patterns/tests/it/docking/native.rs index 740f54eced..206c0b1e0d 100644 --- a/crates/ui-patterns/tests/it/docking/native.rs +++ b/crates/ui-patterns/tests/it/docking/native.rs @@ -105,6 +105,34 @@ fn a_native_dock_window_is_moved_by_the_app_from_its_first_pass() { assert!(probe.0.iter().all(|known| *known), "every pass of the window knows the app moves it: {:?}", probe.0); } +/// A dock restored with a native float in the second pass of the first frame, as an app that lays out its window in +/// the first pass and shows its dock in the next: the float's window paints during the frame's run, before the run's +/// output reaches the renderer the windows share, so its texture changes must come after the first pass's +/// allocations (the font atlas). The kit's renderer panics on a change to a texture it has not allocated. +#[trial] +fn a_dock_restored_with_a_native_float_in_a_later_pass_of_the_first_frame_paints() { + let windows = Windows::new(); + windows.root_info(info(true, ROOT_AT)); + windows.child_info(info(true, PALETTE_AT)); + let mut window = float(); + window.native = Some(Placement::new(PALETTE_AT.size().into(), 1.0)); + let mut workspace = Arc::new(Workspace::new(Layout::new(None, vec![window]))); + let mut probe = MoveProbe(Vec::new()); + let mut passes = 0; + windows.frame(vec![], vec![], |ui| { + passes += 1; + if passes == 1 { + ui.label("Starting"); + ui.ctx().request_discard("the dock shows in the next pass"); + return; + } + let config = DockConfig::default().native_windows(true); + let _ = DockArea::new("Native dock", Bind::bound(&mut workspace), &Specs::with(Permissions::ALL), &mut probe, config).show(ui); + }); + assert_eq!(passes, 2, "the first frame runs two passes"); + assert!(!probe.0.is_empty(), "the float's window runs its pass in the second one"); +} + /// The dock records a move the OS made to its native window, and nothing while the OS reports what the model holds. #[trial] fn the_dock_records_where_the_os_put_its_native_window() { diff --git a/crates/ui-patterns/tests/it/docking/sources.rs b/crates/ui-patterns/tests/it/docking/sources.rs index 623e906f19..d68e5cd2bd 100644 --- a/crates/ui-patterns/tests/it/docking/sources.rs +++ b/crates/ui-patterns/tests/it/docking/sources.rs @@ -4,10 +4,11 @@ use super::Numbered; use craft_behavior::Axis; use craft_behavior::dock::{Column, DockEdge, Floating, Group, Layout, Node, SplitSize, StackEntry, Workspace}; -use craft_ui::contract::{Bind, BodyCx, Tracked}; +use craft_ui::contract::{Bind, BodyCx, Role, Tracked}; use craft_ui::docking::{DividerKind, DockConfig, DockPanels, DockSource, HidePanels, PanelKey, SourceKind}; use craft_ui::patterns::dock::DockArea; use craft_ui::runtime::env::{BodyMode, ShellCx, ShellEntry, WindowKey}; +use craft_ui::testing::access::NodeKey; use craft_ui::testing::{Fixture, trial}; use egui::{Pos2, Rect, Ui, Vec2}; use std::cell::RefCell; @@ -166,3 +167,31 @@ fn each_stack_section_reports_its_panels_tab() { let tabs = panels(&reported.borrow(), |kind| if let SourceKind::Tab(panel) = kind { Some(*panel) } else { None }); assert_eq!(tabs, [UPPER, LOWER], "{:?}", reported.borrow()); } + +/// A group whose tabs do not fit reports its strip's overflow button, named by the group's first panel, under the id of +/// the button's node and where a click opens the menu of the hidden tabs; groups whose tabs fit report none. +#[trial] +fn a_group_whose_tabs_do_not_fit_reports_its_overflow_button() { + const PANELS: [usize; 6] = [11, 12, 13, 14, 15, 16]; + let reported: Rc>>> = Rc::default(); + let seen = Rc::clone(&reported); + let mut narrow = Fixture::new(move |ui| { + let mut workspace = Arc::new(Workspace::new(Layout::new(Some(Node::tabs(PANELS.to_vec(), 0)), Vec::new()))); + let specs = Tracked::new(Numbered); + let mut bodies = Bodies; + *seen.borrow_mut() = DockArea::new("Overflow", Bind::bound(&mut workspace), &specs, &mut bodies, DockConfig::default()).show(ui).sources; + }); + narrow.room(Vec2::new(160.0, 300.0)).settle(); + let overflow: Vec> = + reported.borrow().iter().filter(|source| matches!(source.kind, SourceKind::Overflow(_))).cloned().collect(); + let kinds: Vec> = overflow.iter().map(|source| source.kind.clone()).collect(); + assert_eq!(kinds, vec![SourceKind::Overflow(PANELS[0])], "one overflow button, named by the group's first panel"); + let more = narrow.by_label("More tabs").expect("the strip's overflow button shows"); + assert_eq!(more.node, NodeKey::of(overflow[0].id), "the source's id is the button's node"); + assert!(narrow.by_role(Role::MENU_ITEM).is_empty(), "no menu is open yet"); + narrow.click_at(overflow[0].rect.center()).settle(); + assert!(!narrow.by_role(Role::MENU_ITEM).is_empty(), "a click on the source's rect opens the menu of the hidden tabs"); + + let (_wide, wide) = fixture(None, None); + assert!(wide.borrow().iter().all(|source| !matches!(source.kind, SourceKind::Overflow(_))), "groups whose tabs fit report no overflow button"); +} diff --git a/crates/ui-patterns/tests/it/form_dialogs/new_document.rs b/crates/ui-patterns/tests/it/form_dialogs/new_document.rs index f56c6eddc2..9faffb33ba 100644 --- a/crates/ui-patterns/tests/it/form_dialogs/new_document.rs +++ b/crates/ui-patterns/tests/it/form_dialogs/new_document.rs @@ -386,6 +386,50 @@ fn recent_preset_cards_paint_one_small_page_at_its_aspect() { } } +/// An app that sets `PresetCardLook::Page` (VectorCraft) gets each preset card's page as blank paper at the preset's +/// aspect above its title, and no page outline. +#[trial] +fn preset_cards_in_the_page_look_paint_paper_and_no_outline() { + use craft_behavior::PixelSize; + use craft_ui::patterns::form_dialogs::PresetCardLook; + use craft_ui::runtime::access::Role; + use craft_ui::runtime::env::with_env; + use craft_ui::testing::Frames; + + let wide = PixelSize::new(1200, 900); + let mut frames = Frames::new(); + frames.screen(Vec2::new(1440.0, 900.0)); + let mut options = DocumentOptions::default(); + let mut show = |ui: &mut egui::Ui| { + with_env( + ui, + |overrides| { + overrides.values.set(PresetCardLook::Page); + }, + |ui| drop(NewDocumentDialog::new(Bind::bound(&mut options)).clipboard(wide).show(ui)), + ); + }; + for _ in 0..30 { + frames.frame(Vec::new(), &mut show); + } + let tree = frames.tree(); + let card = tree + .with_role(Role::LIST_ITEM) + .into_iter() + .find(|key| tree.name_of(*key).is_some_and(|label| label.starts_with("Clipboard"))) + .and_then(|key| tree.bounds_of(key)) + .expect("the visible Clipboard card"); + let shapes = frames.frame_shapes(&mut show); + let caption = frames.texts().iter().find(|line| line.text == "Clipboard").expect("the preset title is painted").rect; + let above_title = + |rect: &egui::Rect| card.contains_rect(*rect) && rect.bottom() <= caption.top() && (rect.center().x - card.center().x).abs() <= 1.0; + let rects: Vec<_> = shapes.iter().filter_map(|shape| if let egui::Shape::Rect(rect) = shape { Some(rect) } else { None }).collect(); + let pages: Vec<_> = rects.iter().filter(|rect| rect.fill == egui::Color32::WHITE && above_title(&rect.rect)).map(|rect| rect.rect).collect(); + assert_eq!(pages.len(), 1, "one sheet of paper in the card: {pages:?}"); + assert!((pages[0].width() / pages[0].height() - wide.width as f32 / wide.height as f32).abs() < 0.05, "the paper has the preset's aspect"); + assert!(!rects.iter().any(|rect| rect.stroke.width > 0.0 && above_title(&rect.rect)), "no page outline"); +} + /// A Web card turns Artboards on and a Photo card turns it off again; Artboards the user ticked stays on. #[trial] fn web_cards_turn_artboards_on_and_only_take_back_their_own() { diff --git a/crates/ui-shell/src/shell/recent.rs b/crates/ui-shell/src/shell/recent.rs index 556f61dbe6..f5be8d1519 100644 --- a/crates/ui-shell/src/shell/recent.rs +++ b/crates/ui-shell/src/shell/recent.rs @@ -69,12 +69,22 @@ pub struct Template { pub name: String, /// The line under the name: "1920 × 1080 px". pub detail: String, + /// The width and height of the page the template makes, in any one unit: its card shows the page + /// (`Tile::page`), as New Document's presets do, in place of the template's thumbnail. + pub page: Option<(f64, f64)>, } impl Template { /// A template `id` named `name`, with `detail` under the name. pub fn new(id: impl Into, name: impl Into, detail: impl Into) -> Self { - Template { id: id.into(), name: name.into(), detail: detail.into() } + Template { id: id.into(), name: name.into(), detail: detail.into(), page: None } + } + + /// This template makes a `width` by `height` page, which its card shows. + #[must_use] + pub fn page(mut self, width: f64, height: f64) -> Self { + self.page = Some((width, height)); + self } } diff --git a/crates/ui-shell/src/shell/recent_list.rs b/crates/ui-shell/src/shell/recent_list.rs index 56d5dac416..7a13321409 100644 --- a/crates/ui-shell/src/shell/recent_list.rs +++ b/crates/ui-shell/src/shell/recent_list.rs @@ -98,6 +98,9 @@ impl<'a> RecentList<'a> { offers_new: true, offers_open: true, pinned_title: None, + templates_title: None, + new_label: None, + open_label: None, heading_sections: false, }; let files: Vec = recent.iter().take(max_recent).cloned().collect(); diff --git a/crates/ui-shell/src/shell/start.rs b/crates/ui-shell/src/shell/start.rs index 59d7a31a76..4f0e53ff27 100644 --- a/crates/ui-shell/src/shell/start.rs +++ b/crates/ui-shell/src/shell/start.rs @@ -8,13 +8,13 @@ use super::recent::{RecentFile, RecentSort, RecentView, Template, ThumbKey, sort use super::recent_list::{RecentList, recent_body}; use super::words::ShellWords; use crate::buttons::button::ButtonStyleKey; -use crate::buttons::{Button, Link}; +use crate::buttons::{Button, ControlPlace, Link}; use crate::choice::Segmented; use crate::contract::{ - ActivateOn, Bind, BodyCx, CollectionEvent, Entry, Gap, NoValue, Outcome, Pad, Pattern, Props, Remember as _, Scroll, SelectMode, Show as _, - ShowCollection as _, ShowContainer as _, Sizing, clicked, + ActivateOn, Bind, BodyCx, CollectionEvent, Entry, Gap, NoValue, Outcome, Pad, PadEdges, Pattern, Props, Remember as _, RowAlign, Scroll, + SelectMode, Show as _, ShowCollection as _, ShowContainer as _, Sizing, clicked, }; -use crate::display::{Divider, Icon, Text}; +use crate::display::{Divider, Icon, Shade, Text}; use crate::layout_components::{Row, Stack}; use crate::list::{List, ListRow, RowEvent, ThumbAspect, TrailingFace, TrailingPart}; use crate::menu::{Menu, MenuItem}; @@ -26,14 +26,14 @@ use crate::primitives::{ }; use crate::runtime::commands::{self, CommandRef, FireSource}; use crate::runtime::commands::{CommandSet as _, Commands as _}; -use crate::runtime::env::{AgeStyle, Env, Label}; +use crate::runtime::env::{AgeStyle, Env, Label, Overrides, with_env}; use crate::sections::{HeaderStrength, Section}; -use crate::style::{Corners, DataColor, StyleCx, SurfaceKind, SurroundLook, TypeRole}; -use crate::tile_grid::{CaptionPlace, GridZoom, Tile, TileGrid}; +use crate::style::{Corners, DataColor, StyleCx, SurfaceKind, SurroundLook, TypeRole, rgba_color}; +use crate::tile_grid::{CaptionPlace, CardText, GridZoom, Tile, TileGrid}; use craft_behavior::{DisplayOrder, IconId, ItemSource, Proposal, SelectionChange, keyed}; use craft_theme::variant::{CustomVariant, Emphasis, RadiusStep, Tone, VariantLook}; -use craft_theme::{Rgba, Tokens, Variant}; -use egui::{CornerRadius, Rect, Response, Ui, Vec2, pos2, vec2}; +use craft_theme::{PageSizes, Rgba, Tokens, Variant}; +use egui::{CornerRadius, Rect, Response, Ui, UiBuilder, Vec2, pos2, vec2}; use std::borrow::Cow; use std::cell::RefCell; use std::path::{Path, PathBuf}; @@ -150,6 +150,21 @@ pub enum StartLayout { Gallery, /// A greeting page: a title, the templates, then the recent files as rows. It shows neither Pinned nor the drop card. Greeting, + /// One centred column, at most `size.page.column` wide and a page margin from every edge: the title and subtitle, + /// New and Open, the recent files as rows when there are any, the app's section, the templates as cards that keep + /// their size and wrap, then the links, the call to action as a pill. It shows neither Pinned, the drop card nor + /// the recent files' view switch and sort. + Column, +} + +/// The column's template cards keep the card thumbnail's size, so as many as fit stand in a row and the rest wrap. +const COLUMN_CARD_ZOOM: f32 = 1.0; + +/// The call to action among a Column page's links: the primary variant at pill corners, with its icon. +const CALL_TO_ACTION_LOOK: CustomVariant = CustomVariant::new::("craft_ui.start-call-to-action", call_to_action_look); + +fn call_to_action_look(tokens: &Tokens) -> VariantLook { + Variant::PRIMARY.resolve(tokens).radius(RadiusStep::Pill) } /// Where a host section sits on the start screen. @@ -345,6 +360,15 @@ pub struct StartScreen<'a> { /// The page's heading. #[prop(into)] title: Option