From 4bb9412a03777a4313df0a2a6b5766319a1e97e8 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 25 Nov 2026 15:19:29 +0700 Subject: [PATCH] Home: production's rhythm through the framework's page sizes: 9 from title to subtitle, 27 to New and Open, which stand 28 high with 16 points beside their labels and 14 apart, 33 between sections, 15 under a heading, the community links in 24-point rows 5 apart and in the link colour alone (LinkLook::Plain on Home only); Learn's skills a heading gap apart, each title muted over its tutorials, which stand as tall as New and Open, as production's secondary buttons did --- crates/ui-egui/src/canvas/home.rs | 58 ++++++++++++++++++++----------- crates/ui-egui/src/theme.rs | 15 ++++++-- 2 files changed, 50 insertions(+), 23 deletions(-) diff --git a/crates/ui-egui/src/canvas/home.rs b/crates/ui-egui/src/canvas/home.rs index e2dfa19c73..556574d1ba 100644 --- a/crates/ui-egui/src/canvas/home.rs +++ b/crates/ui-egui/src/canvas/home.rs @@ -1,9 +1,11 @@ use craft::behavior::IconId; -use craft::ui::buttons::Button; -use craft::ui::contract::{Bind, Props as _, Show as _, ShowContainer as _}; -use craft::ui::display::Text; -use craft::ui::layout_components::Row; +use craft::ui::buttons::{Button, ControlPlace, LinkLook}; +use craft::ui::contract::{Bind, Gap, Props as _, Show as _, ShowContainer as _}; +use craft::ui::display::{Shade, Text}; +use craft::ui::layout_components::{Row, Stack}; +use craft::ui::runtime::env::{Overrides, with_env}; use craft::ui::shell::{RecentFile, StartAction, StartLayout, StartLink, StartScreen, Template}; +use craft::ui::style::TypeRole; use super::{Ui, VectorcraftApp, json}; @@ -40,7 +42,11 @@ pub(super) fn home(app: &mut VectorcraftApp, ui: &mut Ui, rect: egui::Rect) { let mut pressed = None; let mut learn = |ui: &mut Ui| learn(app, ui, &mut pressed); let mut child = ui.new_child(egui::UiBuilder::new().max_rect(rect).layout(egui::Layout::top_down(egui::Align::Min))); - let out = StartScreen::new(Bind::bound(&mut view), Bind::bound(&mut sort), &recent) + // Production's community links read in the accent alone, with no underline. + let plain_links = |overrides: &mut Overrides| { + overrides.values.set(LinkLook::Plain); + }; + let start = StartScreen::new(Bind::bound(&mut view), Bind::bound(&mut sort), &recent) .layout(StartLayout::Column) .title(tl!("Welcome to VectorCraft")) .subtitle(tl!("Vector illustration — fast, open, scriptable.")) @@ -51,8 +57,8 @@ pub(super) fn home(app: &mut VectorcraftApp, ui: &mut Ui, rect: egui::Rect) { .templates_title(tl!("Quickly start a new file")) .links(&links) .links_title(tl!("Community")) - .app_section(tl!("Learn"), &mut learn) - .show(&mut child); + .app_section(tl!("Learn"), &mut learn); + let out = with_env(&mut child, plain_links, |ui| start.show(ui)); app.ui.home_view = view; app.ui.home_sort = sort; for action in out.actions { @@ -87,20 +93,30 @@ fn run_action(app: &mut VectorcraftApp, action: StartAction) { } /// The Home screen's Learn section: the Quick skill guide card, which shows the Learn panel's list -/// of skills, and the Learn panel's tutorials under their skills, each a button that shows the -/// panel at its steps (`learn.show`). The start screen may run this twice in a pass, so it only -/// draws and records the tutorial pressed in `pressed`. +/// of skills, and the Learn panel's tutorials under their skills (each title dim over its tutorials), each a button +/// that shows the panel at its steps (`learn.show`), as tall as New and Open and a page heading's gap apart, as +/// production spaced them. The start screen may run this twice in a pass, so it only draws and records the tutorial +/// pressed in `pressed`. fn learn(app: &mut VectorcraftApp, ui: &mut Ui, pressed: &mut Option<&'static str>) { use crate::panels::learn::{catalog, guide_card}; - guide_card(app, ui); // PLAN: assumed `guide_card(app, ui)` as document-panels-w18 leaves it, on `Button::detail`. - for skill in catalog::SKILLS { - let _ = Text::new(skill.title).show(ui); - let _ = Row::new().show(ui, |ui, _| { - for tutorial in skill.tutorials { - if Button::new(tutorial.title).id_salt(tutorial.id).show(ui).clicked() { - *pressed = Some(tutorial.id); - } - } - }); - } + let _ = Stack::new().gap(Gap::PageHeading).fill_width().show(ui, |ui, _| { + guide_card(app, ui); // PLAN: assumed `guide_card(app, ui)` as document-panels-w18 leaves it, on `Button::detail`. + for skill in catalog::SKILLS { + let _ = Stack::new().gap(Gap::Stack).fill_width().show(ui, |ui, _| { + let _ = Text::new(skill.title).role(TypeRole::Label).shade(Shade::Muted).show(ui); + let place = |overrides: &mut Overrides| { + overrides.values.set(ControlPlace::PageAction); + }; + let _ = with_env(ui, place, |ui| { + Row::new().show(ui, |ui, _| { + for tutorial in skill.tutorials { + if Button::new(tutorial.title).id_salt(tutorial.id).show(ui).clicked() { + *pressed = Some(tutorial.id); + } + } + }) + }); + }); + } + }); } diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs index d82dae6429..016e665e88 100644 --- a/crates/ui-egui/src/theme.rs +++ b/crates/ui-egui/src/theme.rs @@ -147,7 +147,9 @@ pub fn root_theme(prefs: &Prefs) -> (ThemeId, ModeChoice, Option) { /// The app's sizes over the framework's size sets (`sizes.json`): push buttons have the app's 4-point corners /// where the sets give pills, the Home title is 26-point under 60 points of page margin with a 36-point call to -/// action, and the compact set takes the reference app's metrics: +/// action, Home keeps production's rhythm (its item spacing of 5 plus the room it added: 9 from title to subtitle, 27 +/// to New and Open, 28-point New and Open with 16 points beside their labels and 14 between them, 33 between sections, +/// 15 under a heading, 24-point link rows 5 apart), and the compact set takes the reference app's metrics: /// 26-point fields and spinners, 24-point push buttons, 10 points inside panels, 5 between rows, 16-point glyphs in /// icon buttons, 5-point control corners, 8-point menus and 10-point windows, 33-point panel tabs, 310-point dock /// columns with 14-point column bars and 38-point icon columns, 29-point menu rows, and dialogs 22 points inside their @@ -160,7 +162,16 @@ const SIZES: &[u8] = br#"{ "typography.display.size": 26, "typography.display.line_height": 32, "size.page.margin": 60, - "size.page.action": 36 + "size.page.action": 36, + "size.page.button": 28, + "size.page.button_side": 16, + "size.page.gap.title": 9, + "size.page.gap.lead": 27, + "size.page.gap.actions": 14, + "size.page.gap.section": 33, + "size.page.gap.heading": 15, + "size.page.gap.link": 5, + "size.page.link": 24 }, "compact": { "size.control.md": 26,