From 1b7222027268956fc09f045b245399a343f7f450 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 24 Nov 2026 08:07:49 +0700 Subject: [PATCH 01/16] behavior: a grid's least probe keeps its Fill columns Fill, unbounded, so a field that fills its width there measures its own width instead of none; the fill column's least is then the field's, so a grid beside a menu no longer squeezes the field under it, stacks its label in rows measured unstacked, and overlaps the next row --- crates/behavior/src/grid.rs | 9 ++- .../ui-widgets/tests/it/layout/grid_labels.rs | 74 ++++++++++++++----- 2 files changed, 60 insertions(+), 23 deletions(-) diff --git a/crates/behavior/src/grid.rs b/crates/behavior/src/grid.rs index b9c1e5bfd2..bd782a0e9c 100644 --- a/crates/behavior/src/grid.rs +++ b/crates/behavior/src/grid.rs @@ -119,10 +119,11 @@ impl GridCursor { cursor } - /// A cursor for the sweep that asks each column for its least: every column but a `Fixed` one is placed as a - /// `Content` column whose cells measure in no bound along x, so each column measures its widest cell. + /// A cursor for the sweep that asks each column for its least: the cells of every `Content` and `Fill` column + /// measure in no bound along x, so each column measures its widest cell. A `Fill` column stays one, so a child + /// that fills its width measures its own width there, where a `Content` column would hold it and take none. pub fn unbounded(flow: Flow, columns: &[ColumnWidth], gap: Vec2) -> Self { - let mut cursor = Self::new(flow, &as_content(columns), gap, &GridMeasure::default()); + let mut cursor = Self::new(flow, columns, gap, &GridMeasure::default()); cursor.unbounded = true; cursor } @@ -185,7 +186,7 @@ impl GridCursor { let count = self.columns.len().max(1); let (column, _, _, top) = self.next_place(); let width = match self.columns.get(column) { - Some(ColumnWidth::Content) if self.unbounded => f32::INFINITY, + Some(ColumnWidth::Content | ColumnWidth::Fill { .. }) if self.unbounded => f32::INFINITY, Some(ColumnWidth::Content) => { // Every other column keeps at least its least: a column that fills keeps only that, and so does a // content column when each column measures alone. diff --git a/crates/ui-widgets/tests/it/layout/grid_labels.rs b/crates/ui-widgets/tests/it/layout/grid_labels.rs index 1e1c1712d4..a854e1a873 100644 --- a/crates/ui-widgets/tests/it/layout/grid_labels.rs +++ b/crates/ui-widgets/tests/it/layout/grid_labels.rs @@ -1,12 +1,14 @@ //! The glyph labels beside the fields of one grid column share a width. use craft_behavior::ColumnWidth; -use craft_ui::contract::{Bind, GlyphLabel, LabelKind, Show as _, ShowContainer as _, SideLabel}; +use craft_ui::contract::{Bind, Entry, GlyphLabel, LabelKind, Show as _, ShowContainer as _, SideLabel}; +use craft_ui::display::Text; use craft_ui::form::Field; -use craft_ui::layout_components::Grid; +use craft_ui::layout_components::{Grid, Stack}; +use craft_ui::pickers::Select; use craft_ui::testing::{Fixture, trial}; use craft_ui::text::NumberField; -use egui::Rect; +use egui::{Rect, Ui}; use std::cell::RefCell; use std::rc::Rc; @@ -44,30 +46,64 @@ fn the_fields_of_a_grid_column_share_a_left_edge() { /// A filling column, then one sized by its cells. static FILL_FIRST: [ColumnWidth; 2] = [ColumnWidth::fill(1.0), ColumnWidth::Content]; -/// A grid row is as tall as a field in it whose label stacks above its control for want of room: the next row's label -/// starts below the control. Guards against a grid that spaced its rows as if the label sat beside the control, so the -/// next row's label overlapped it. -#[trial] -fn a_grid_row_holds_a_field_whose_label_stacks() { +/// The rects of the two fields of a grid whose rows each hold a labelled field and, in the column sized by its cells, +/// text or a menu, in a room `width` wide; and the second field's label. `in_container`: the grid shows under a header +/// in a container that fills its width, beside menus, as a fixed section shows it. +fn grid_rows(in_container: bool, width: f32) -> ([Rect; 2], Rect) { let rects: Rc>> = Rc::default(); let seen = rects.clone(); let mut fixture = Fixture::new(move |ui| { let mut seen = seen.borrow_mut(); seen.clear(); - Grid::new(&FILL_FIRST).show(ui, |ui, _| { - for i in 0..2 { - Field::new(format!("Top Left Corner {i}")).show(ui, |ui, _| { - seen.push(NumberField::new(format!("Radius {i}"), Bind::given(Some(10.0))).show(ui).response.rect); - }); - craft_ui::display::Text::new("Round").show(ui); - } - }); + let entries = [Entry::new(0u8, "Round"), Entry::new(1, "Inverted Round"), Entry::new(2, "Chamfer")]; + let mut grid = |ui: &mut Ui| { + Grid::new(&FILL_FIRST).show(ui, |ui, _| { + for i in 0..2 { + Field::new(format!("Top Left Corner {i}")).show(ui, |ui, _| { + seen.push(NumberField::new(format!("Radius {i}"), Bind::given(Some(10.0))).show(ui).response.rect); + }); + if in_container { + Select::new(format!("Corner {i}"), Bind::given(0u8), &entries).show(ui); + } else { + Text::new("Round").show(ui); + } + } + }); + }; + if in_container { + Stack::new() + .fill_width() + .header(|ui, _| { + Text::new("Rectangle").show(ui); + }) + .show(ui, |ui, _| grid(ui)); + } else { + grid(ui); + } }); - fixture.room(egui::vec2(150.0, 400.0)).record_paint(); + fixture.room(egui::vec2(width, 400.0)).record_paint(); fixture.settle(); let rects = rects.borrow(); - let [first, _] = rects[..] else { panic!("two fields show: {rects:?}") }; + let [first, second] = rects[..] else { panic!("two fields show: {rects:?}") }; let label = fixture.texts().iter().find(|text| text.text == "Top Left Corner 1").map(|text| text.rect).expect("the second label shows"); - assert!(label.bottom() <= rects[1].top() + 0.5, "the label stacks above its control: {label:?}, {:?}", rects[1]); + ([first, second], label) +} + +/// A grid row is as tall as a field in it whose label sits beside its control or stacks above it for want of room: +/// the next row's label starts below the control, and the label shows whole. The grid stands alone beside text, and +/// fills a container's width beside menus at several widths. Guards against a grid that spaced its rows as if the +/// label sat beside the control and then placed it stacked, so the next row's label overlapped it; and against one +/// that took the least of a column of filling fields as none, so the field was left a sliver beside the menu. +#[trial] +fn a_grid_row_holds_a_field_whose_label_stacks() { + let (_, whole) = grid_rows(false, 600.0); + let ([first, second], label) = grid_rows(false, 150.0); + assert!(label.bottom() <= second.top() + 0.5, "the label stacks above its control: {label:?}, {second:?}"); assert!(label.top() >= first.bottom() - 0.5, "the second row starts below the first row's control: {label:?}, {first:?}"); + for width in [200.0, 240.0, 320.0] { + let ([first, second], label) = grid_rows(true, width); + assert!(label.top() >= first.bottom() - 0.5, "at {width}, the second row starts below the first row's control: {label:?}, {first:?}"); + assert!(second.top() >= first.bottom() - 0.5, "at {width}, the second field starts below the first: {second:?}, {first:?}"); + assert!(label.width() >= whole.width() - 0.5, "at {width}, the label shows whole: {label:?}, {whole:?}"); + } } From a6c6eda35a502076923b7800095bbbadac4071bf Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 24 Nov 2026 09:58:45 +0700 Subject: [PATCH 02/16] theme: VectorCraft Modern's selected, pressed and disabled colours take production's values Production tints selected rows and pressed fills toward the accent in every Modern palette, the default Coral included, and draws disabled text in its disabled grey. The VectorCraft themes pinned the untinted values and left text.disabled derived. Their dumps also lacked tokens added since they were last written. --- ...ctorcraft-modern-dark-high-comfortable.txt | 26 ++++++++++------- .../vectorcraft-modern-dark-high-compact.txt | 26 ++++++++++------- ...craft-modern-dark-standard-comfortable.txt | 19 +++++++++---- ...ctorcraft-modern-dark-standard-compact.txt | 19 +++++++++---- ...torcraft-modern-light-high-comfortable.txt | 28 +++++++++++-------- .../vectorcraft-modern-light-high-compact.txt | 28 +++++++++++-------- ...raft-modern-light-standard-comfortable.txt | 19 +++++++++---- ...torcraft-modern-light-standard-compact.txt | 19 +++++++++---- ...ft-modern-medium-dark-high-comfortable.txt | 28 +++++++++++-------- ...rcraft-modern-medium-dark-high-compact.txt | 28 +++++++++++-------- ...odern-medium-dark-standard-comfortable.txt | 20 ++++++++----- ...ft-modern-medium-dark-standard-compact.txt | 20 ++++++++----- ...t-modern-medium-light-high-comfortable.txt | 28 +++++++++++-------- ...craft-modern-medium-light-high-compact.txt | 28 +++++++++++-------- ...dern-medium-light-standard-comfortable.txt | 20 ++++++++----- ...t-modern-medium-light-standard-compact.txt | 20 ++++++++----- .../themes/vectorcraft-modern-medium.json | 10 ++++--- crates/theme/themes/vectorcraft-modern.json | 10 ++++--- 18 files changed, 250 insertions(+), 146 deletions(-) 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 4efc3b2289..9fb87ac4aa 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 @@ -8,21 +8,23 @@ surface.raised = #21242cff surface.sunken = #0f1116ff surface.knob = #e9ebf0ff surface.scrim = #00000080 +surface.inverse = #e9ebf0ff surface.shadow = #00000096 text.normal = #dfe4ecff -text.muted = #bbc4d5ff -text.faint = #bbc4d5ff -text.disabled = #82868fff +text.muted = #c7d1e1ff +text.faint = #c7d1e2ff +text.disabled = #5a6271ff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #e9ebf0ff +text.on_inverse = #0d0d0eff line.divider = #232832ff line.border = #06070aff line.control_edge = #2c323eff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #989da5ff +line.mark = #a3a8b0ff line.grip = #2b2e36ff line.focus = #f06a52ff accent.solid = #f26b53ff @@ -60,9 +62,9 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #262b35ff -state.pressed = #2f3541ff -state.selected = #3a2a2cff -state.selected_hover = #4d3c3eff +state.pressed = #593330ff +state.selected = #4c2e2eff +state.selected_hover = #604040ff state.disabled_fill = #181b22ff state.text_selection = #f26b5346 state.match = #f0dc005a @@ -95,14 +97,14 @@ data.cyan = #00c8ebff data.magenta = #e909a2ff data.yellow = #f0dc00ff data.scope = #282828ff -data.backdrop = #bbc4d580 +data.backdrop = #c7d1e180 data.selection = #f26b5359 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #dfe4ec1a -caption.inactive = #bbc4d5ff -caption.pressed = #bbc4d5ff +caption.inactive = #c7d1e2ff +caption.pressed = #c7d1e1ff edge.light = #3d4048ff edge.dark = #000000ff shape.radius.sm = 3 @@ -134,6 +136,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 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 783dfa13a5..3474039290 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 @@ -8,21 +8,23 @@ surface.raised = #21242cff surface.sunken = #0f1116ff surface.knob = #e9ebf0ff surface.scrim = #00000080 +surface.inverse = #e9ebf0ff surface.shadow = #00000096 text.normal = #dfe4ecff -text.muted = #bbc4d5ff -text.faint = #bbc4d5ff -text.disabled = #82868fff +text.muted = #c7d1e1ff +text.faint = #c7d1e2ff +text.disabled = #5a6271ff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #e9ebf0ff +text.on_inverse = #0d0d0eff line.divider = #232832ff line.border = #06070aff line.control_edge = #2c323eff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #989da5ff +line.mark = #a3a8b0ff line.grip = #2b2e36ff line.focus = #f06a52ff accent.solid = #f26b53ff @@ -60,9 +62,9 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #262b35ff -state.pressed = #2f3541ff -state.selected = #3a2a2cff -state.selected_hover = #4d3c3eff +state.pressed = #593330ff +state.selected = #4c2e2eff +state.selected_hover = #604040ff state.disabled_fill = #181b22ff state.text_selection = #f26b5346 state.match = #f0dc005a @@ -95,14 +97,14 @@ data.cyan = #00c8ebff data.magenta = #e909a2ff data.yellow = #f0dc00ff data.scope = #282828ff -data.backdrop = #bbc4d580 +data.backdrop = #c7d1e180 data.selection = #f26b5359 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #dfe4ec1a -caption.inactive = #bbc4d5ff -caption.pressed = #bbc4d5ff +caption.inactive = #c7d1e2ff +caption.pressed = #c7d1e1ff edge.light = #3d4048ff edge.dark = #000000ff shape.radius.sm = 2 @@ -134,6 +136,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 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 d89eec9a4d..86e14c8575 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 @@ -8,21 +8,23 @@ surface.raised = #21242cff surface.sunken = #0f1116ff surface.knob = #e9ebf0ff surface.scrim = #00000080 +surface.inverse = #e9ebf0ff surface.shadow = #00000096 text.normal = #dfe4ecff text.muted = #969fafff text.faint = #5a6271ff -text.disabled = #82868fff +text.disabled = #5a6271ff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #e9ebf0ff +text.on_inverse = #0d0d0eff line.divider = #232832ff line.border = #06070aff line.control_edge = #2c323eff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #797e86ff +line.mark = #83878fff line.grip = #2b2e36ff line.focus = #f06a52ff accent.solid = #f06a52ff @@ -60,9 +62,9 @@ status.info.solid = #6f788aff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #262b35ff -state.pressed = #2f3541ff -state.selected = #3a2a2cff -state.selected_hover = #4d3c3eff +state.pressed = #593330ff +state.selected = #4c2e2eff +state.selected_hover = #604040ff state.disabled_fill = #181b22ff state.text_selection = #f06a5246 state.match = #f0dc005a @@ -134,6 +136,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -244,10 +250,11 @@ motion.caret.easing = enter motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false +warning = text.muted on state.pressed: 4.06 < 4.50 warning = text.faint on surface.background: 3.17 < 4.50 warning = text.faint on surface.panel: 2.81 < 4.50 warning = text.faint on surface.chrome: 2.81 < 4.50 warning = text.faint on surface.raised: 2.53 < 4.50 warning = text.faint on surface.sunken: 3.08 < 4.50 warning = text.faint on state.hover: 2.31 < 4.50 -warning = text.faint on state.pressed: 2.00 < 4.50 +warning = text.faint on state.pressed: 1.76 < 4.50 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 bd51c94294..1f8f65595b 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 @@ -8,21 +8,23 @@ surface.raised = #21242cff surface.sunken = #0f1116ff surface.knob = #e9ebf0ff surface.scrim = #00000080 +surface.inverse = #e9ebf0ff surface.shadow = #00000096 text.normal = #dfe4ecff text.muted = #969fafff text.faint = #5a6271ff -text.disabled = #82868fff +text.disabled = #5a6271ff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #e9ebf0ff +text.on_inverse = #0d0d0eff line.divider = #232832ff line.border = #06070aff line.control_edge = #2c323eff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #797e86ff +line.mark = #83878fff line.grip = #2b2e36ff line.focus = #f06a52ff accent.solid = #f06a52ff @@ -60,9 +62,9 @@ status.info.solid = #6f788aff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #262b35ff -state.pressed = #2f3541ff -state.selected = #3a2a2cff -state.selected_hover = #4d3c3eff +state.pressed = #593330ff +state.selected = #4c2e2eff +state.selected_hover = #604040ff state.disabled_fill = #181b22ff state.text_selection = #f06a5246 state.match = #f0dc005a @@ -134,6 +136,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -244,10 +250,11 @@ motion.caret.easing = enter motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false +warning = text.muted on state.pressed: 4.06 < 4.50 warning = text.faint on surface.background: 3.17 < 4.50 warning = text.faint on surface.panel: 2.81 < 4.50 warning = text.faint on surface.chrome: 2.81 < 4.50 warning = text.faint on surface.raised: 2.53 < 4.50 warning = text.faint on surface.sunken: 3.08 < 4.50 warning = text.faint on state.hover: 2.31 < 4.50 -warning = text.faint on state.pressed: 2.00 < 4.50 +warning = text.faint on state.pressed: 1.76 < 4.50 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 40242a0b51..0737f29498 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 @@ -8,21 +8,23 @@ surface.raised = #f9fbfeff surface.sunken = #ffffffff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #262627ff surface.shadow = #00000032 text.normal = #1b1f27ff -text.muted = #3d4452ff -text.faint = #3f444fff -text.disabled = #848689ff +text.muted = #383f4dff +text.faint = #3a3f4aff +text.disabled = #9aa1adff text.on_accent = #ffffffff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #262627ff +text.on_inverse = #fcfcfdff line.divider = #dde1e8ff line.border = #d0d5ddff line.control_edge = #c3c9d3ff -line.knob_edge = #3d4452ff +line.knob_edge = #383f4dff line.frame = #c3c9d3ff -line.mark = #5f6062ff +line.mark = #5a5b5dff line.grip = #e2e4e7ff line.focus = #c4321aff accent.solid = #af1c00ff @@ -60,9 +62,9 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8c96a8ff status.info.solid_pressed = #8d96a7ff state.hover = #e3e7edff -state.pressed = #d5dbe3ff -state.selected = #f8d9d2ff -state.selected_hover = #eccec7ff +state.pressed = #edcbc8ff +state.selected = #eed2d0ff +state.selected_hover = #e2c7c5ff state.disabled_fill = #f3f5f8ff state.text_selection = #af1c0046 state.match = #8378005a @@ -95,14 +97,14 @@ data.cyan = #00829aff data.magenta = #e0009cff data.yellow = #837800ff data.scope = #282828ff -data.backdrop = #3d445280 +data.backdrop = #383f4d80 data.selection = #af1c0059 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #1b1f271a -caption.inactive = #3f444fff -caption.pressed = #3d4452ff +caption.inactive = #3a3f4aff +caption.pressed = #383f4dff edge.light = #ffffffff edge.dark = #a0a1a4ff shape.radius.sm = 3 @@ -134,6 +136,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 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 5542f8faa0..2ab2ec91b0 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 @@ -8,21 +8,23 @@ surface.raised = #f9fbfeff surface.sunken = #ffffffff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #262627ff surface.shadow = #00000032 text.normal = #1b1f27ff -text.muted = #3d4452ff -text.faint = #3f444fff -text.disabled = #848689ff +text.muted = #383f4dff +text.faint = #3a3f4aff +text.disabled = #9aa1adff text.on_accent = #ffffffff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #262627ff +text.on_inverse = #fcfcfdff line.divider = #dde1e8ff line.border = #d0d5ddff line.control_edge = #c3c9d3ff -line.knob_edge = #3d4452ff +line.knob_edge = #383f4dff line.frame = #c3c9d3ff -line.mark = #5f6062ff +line.mark = #5a5b5dff line.grip = #e2e4e7ff line.focus = #c4321aff accent.solid = #af1c00ff @@ -60,9 +62,9 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8c96a8ff status.info.solid_pressed = #8d96a7ff state.hover = #e3e7edff -state.pressed = #d5dbe3ff -state.selected = #f8d9d2ff -state.selected_hover = #eccec7ff +state.pressed = #edcbc8ff +state.selected = #eed2d0ff +state.selected_hover = #e2c7c5ff state.disabled_fill = #f3f5f8ff state.text_selection = #af1c0046 state.match = #8378005a @@ -95,14 +97,14 @@ data.cyan = #00829aff data.magenta = #e0009cff data.yellow = #837800ff data.scope = #282828ff -data.backdrop = #3d445280 +data.backdrop = #383f4d80 data.selection = #af1c0059 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #1b1f271a -caption.inactive = #3f444fff -caption.pressed = #3d4452ff +caption.inactive = #3a3f4aff +caption.pressed = #383f4dff edge.light = #ffffffff edge.dark = #a0a1a4ff shape.radius.sm = 2 @@ -134,6 +136,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 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 69eedb01ea..d3fa345307 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 @@ -8,21 +8,23 @@ surface.raised = #f9fbfeff surface.sunken = #ffffffff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #262627ff surface.shadow = #00000032 text.normal = #1b1f27ff text.muted = #58606eff text.faint = #9aa1adff -text.disabled = #848689ff +text.disabled = #9aa1adff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #262627ff +text.on_inverse = #fcfcfdff line.divider = #dde1e8ff line.border = #d0d5ddff line.control_edge = #c3c9d3ff line.knob_edge = #58606eff line.frame = #c3c9d3ff -line.mark = #7a7c7eff +line.mark = #757678ff line.grip = #e2e4e7ff line.focus = #d9472fff accent.solid = #d9472fff @@ -60,9 +62,9 @@ status.info.solid = #6f788aff status.info.solid_hover = #6c7587ff status.info.solid_pressed = #6c7585ff state.hover = #e3e7edff -state.pressed = #d5dbe3ff -state.selected = #f8d9d2ff -state.selected_hover = #eccec7ff +state.pressed = #edcbc8ff +state.selected = #eed2d0ff +state.selected_hover = #e2c7c5ff state.disabled_fill = #f3f5f8ff state.text_selection = #d9472f46 state.match = #f0dc005a @@ -134,6 +136,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -244,10 +250,11 @@ motion.caret.easing = enter motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false +warning = text.muted on state.pressed: 4.22 < 4.50 warning = text.faint on surface.background: 2.14 < 4.50 warning = text.faint on surface.panel: 2.38 < 4.50 warning = text.faint on surface.chrome: 2.38 < 4.50 warning = text.faint on surface.raised: 2.51 < 4.50 warning = text.faint on surface.sunken: 2.60 < 4.50 warning = text.faint on state.hover: 2.10 < 4.50 -warning = text.faint on state.pressed: 1.87 < 4.50 +warning = text.faint on state.pressed: 1.73 < 4.50 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 aff055622a..0802ea5506 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 @@ -8,21 +8,23 @@ surface.raised = #f9fbfeff surface.sunken = #ffffffff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #262627ff surface.shadow = #00000032 text.normal = #1b1f27ff text.muted = #58606eff text.faint = #9aa1adff -text.disabled = #848689ff +text.disabled = #9aa1adff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #262627ff +text.on_inverse = #fcfcfdff line.divider = #dde1e8ff line.border = #d0d5ddff line.control_edge = #c3c9d3ff line.knob_edge = #58606eff line.frame = #c3c9d3ff -line.mark = #7a7c7eff +line.mark = #757678ff line.grip = #e2e4e7ff line.focus = #d9472fff accent.solid = #d9472fff @@ -60,9 +62,9 @@ status.info.solid = #6f788aff status.info.solid_hover = #6c7587ff status.info.solid_pressed = #6c7585ff state.hover = #e3e7edff -state.pressed = #d5dbe3ff -state.selected = #f8d9d2ff -state.selected_hover = #eccec7ff +state.pressed = #edcbc8ff +state.selected = #eed2d0ff +state.selected_hover = #e2c7c5ff state.disabled_fill = #f3f5f8ff state.text_selection = #d9472f46 state.match = #f0dc005a @@ -134,6 +136,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -244,10 +250,11 @@ motion.caret.easing = enter motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false +warning = text.muted on state.pressed: 4.22 < 4.50 warning = text.faint on surface.background: 2.14 < 4.50 warning = text.faint on surface.panel: 2.38 < 4.50 warning = text.faint on surface.chrome: 2.38 < 4.50 warning = text.faint on surface.raised: 2.51 < 4.50 warning = text.faint on surface.sunken: 2.60 < 4.50 warning = text.faint on state.hover: 2.10 < 4.50 -warning = text.faint on state.pressed: 1.87 < 4.50 +warning = text.faint on state.pressed: 1.73 < 4.50 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 8e0d025e3b..3338fe6e68 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 @@ -8,21 +8,23 @@ surface.raised = #313640ff surface.sunken = #1a1e26ff surface.knob = #e8ebf1ff surface.scrim = #00000080 +surface.inverse = #e8ebf1ff surface.shadow = #00000096 text.normal = #e4e9f1ff -text.muted = #d3dcedff -text.faint = #d2ddeeff -text.disabled = #808692ff +text.muted = #d9e3f4ff +text.faint = #d8e3f4ff +text.disabled = #626b7aff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff -text.on_selected = #e8ebf1ff +text.on_selected = #f5f9ffff +text.on_inverse = #0d0d0eff line.divider = #323946ff line.border = #11141aff line.control_edge = #3a414eff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #abb2beff +line.mark = #b0b7c3ff line.grip = #3b404bff line.focus = #fc755cff accent.solid = #fc755cff @@ -60,9 +62,9 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #353c49ff -state.pressed = #3d4553ff -state.selected = #4a3236ff -state.selected_hover = #5e4448ff +state.pressed = #633f3eff +state.selected = #573b3dff +state.selected_hover = #6b4e50ff state.disabled_fill = #272c36ff state.text_selection = #fc755c46 state.match = #f0dc005a @@ -95,14 +97,14 @@ data.cyan = #00c8ebff data.magenta = #f423abff data.yellow = #f0dc00ff data.scope = #282828ff -data.backdrop = #d3dced80 +data.backdrop = #d9e3f480 data.selection = #fc755c59 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #e4e9f11a -caption.inactive = #d2ddeeff -caption.pressed = #d3dcedff +caption.inactive = #d8e3f4ff +caption.pressed = #d9e3f4ff edge.light = #4e535eff edge.dark = #000001ff shape.radius.sm = 3 @@ -134,6 +136,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 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 6f0078e78f..c02aa3eda6 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 @@ -8,21 +8,23 @@ surface.raised = #313640ff surface.sunken = #1a1e26ff surface.knob = #e8ebf1ff surface.scrim = #00000080 +surface.inverse = #e8ebf1ff surface.shadow = #00000096 text.normal = #e4e9f1ff -text.muted = #d3dcedff -text.faint = #d2ddeeff -text.disabled = #808692ff +text.muted = #d9e3f4ff +text.faint = #d8e3f4ff +text.disabled = #626b7aff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff -text.on_selected = #e8ebf1ff +text.on_selected = #f5f9ffff +text.on_inverse = #0d0d0eff line.divider = #323946ff line.border = #11141aff line.control_edge = #3a414eff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #abb2beff +line.mark = #b0b7c3ff line.grip = #3b404bff line.focus = #fc755cff accent.solid = #fc755cff @@ -60,9 +62,9 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #353c49ff -state.pressed = #3d4553ff -state.selected = #4a3236ff -state.selected_hover = #5e4448ff +state.pressed = #633f3eff +state.selected = #573b3dff +state.selected_hover = #6b4e50ff state.disabled_fill = #272c36ff state.text_selection = #fc755c46 state.match = #f0dc005a @@ -95,14 +97,14 @@ data.cyan = #00c8ebff data.magenta = #f423abff data.yellow = #f0dc00ff data.scope = #282828ff -data.backdrop = #d3dced80 +data.backdrop = #d9e3f480 data.selection = #fc755c59 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #e4e9f11a -caption.inactive = #d2ddeeff -caption.pressed = #d3dcedff +caption.inactive = #d8e3f4ff +caption.pressed = #d9e3f4ff edge.light = #4e535eff edge.dark = #000001ff shape.radius.sm = 2 @@ -134,6 +136,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 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 f2ce55a499..6fd9898dd6 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 @@ -8,21 +8,23 @@ surface.raised = #313640ff surface.sunken = #1a1e26ff surface.knob = #e8ebf1ff surface.scrim = #00000080 +surface.inverse = #e8ebf1ff surface.shadow = #00000096 text.normal = #e4e9f1ff text.muted = #99a2b2ff text.faint = #626b7aff -text.disabled = #808692ff +text.disabled = #626b7aff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #e8ebf1ff +text.on_inverse = #0d0d0eff line.divider = #323946ff line.border = #11141aff line.control_edge = #3a414eff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #89909bff +line.mark = #8e95a0ff line.grip = #3b404bff line.focus = #f06a52ff accent.solid = #f06a52ff @@ -60,9 +62,9 @@ status.info.solid = #6f788aff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #353c49ff -state.pressed = #3d4553ff -state.selected = #4a3236ff -state.selected_hover = #5e4448ff +state.pressed = #633f3eff +state.selected = #573b3dff +state.selected_hover = #6b4e50ff state.disabled_fill = #272c36ff state.text_selection = #f06a5246 state.match = #f0dc005a @@ -134,6 +136,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -245,11 +251,11 @@ motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false warning = text.muted on state.hover: 4.31 < 4.50 -warning = text.muted on state.pressed: 3.75 < 4.50 +warning = text.muted on state.pressed: 3.53 < 4.50 warning = text.faint on surface.background: 3.07 < 4.50 warning = text.faint on surface.panel: 2.60 < 4.50 warning = text.faint on surface.chrome: 2.60 < 4.50 warning = text.faint on surface.raised: 2.25 < 4.50 warning = text.faint on surface.sunken: 3.10 < 4.50 warning = text.faint on state.hover: 2.06 < 4.50 -warning = text.faint on state.pressed: 1.80 < 4.50 +warning = text.faint on state.pressed: 1.69 < 4.50 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 d7e3d29eb0..7343d11641 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 @@ -8,21 +8,23 @@ surface.raised = #313640ff surface.sunken = #1a1e26ff surface.knob = #e8ebf1ff surface.scrim = #00000080 +surface.inverse = #e8ebf1ff surface.shadow = #00000096 text.normal = #e4e9f1ff text.muted = #99a2b2ff text.faint = #626b7aff -text.disabled = #808692ff +text.disabled = #626b7aff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #e8ebf1ff +text.on_inverse = #0d0d0eff line.divider = #323946ff line.border = #11141aff line.control_edge = #3a414eff line.knob_edge = #00000000 line.frame = #0d0d0eff -line.mark = #89909bff +line.mark = #8e95a0ff line.grip = #3b404bff line.focus = #f06a52ff accent.solid = #f06a52ff @@ -60,9 +62,9 @@ status.info.solid = #6f788aff status.info.solid_hover = #8f99abff status.info.solid_pressed = #a2abbdff state.hover = #353c49ff -state.pressed = #3d4553ff -state.selected = #4a3236ff -state.selected_hover = #5e4448ff +state.pressed = #633f3eff +state.selected = #573b3dff +state.selected_hover = #6b4e50ff state.disabled_fill = #272c36ff state.text_selection = #f06a5246 state.match = #f0dc005a @@ -134,6 +136,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -245,11 +251,11 @@ motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false warning = text.muted on state.hover: 4.31 < 4.50 -warning = text.muted on state.pressed: 3.75 < 4.50 +warning = text.muted on state.pressed: 3.53 < 4.50 warning = text.faint on surface.background: 3.07 < 4.50 warning = text.faint on surface.panel: 2.60 < 4.50 warning = text.faint on surface.chrome: 2.60 < 4.50 warning = text.faint on surface.raised: 2.25 < 4.50 warning = text.faint on surface.sunken: 3.10 < 4.50 warning = text.faint on state.hover: 2.06 < 4.50 -warning = text.faint on state.pressed: 1.80 < 4.50 +warning = text.faint on state.pressed: 1.69 < 4.50 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 ca6e14c288..99b494063f 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 @@ -8,21 +8,23 @@ surface.raised = #d9dee6ff surface.sunken = #e9ecf1ff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #252629ff surface.shadow = #00000032 text.normal = #1b1f27ff -text.muted = #2a303eff -text.faint = #2a303dff -text.disabled = #82868eff +text.muted = #292f3dff +text.faint = #29303cff +text.disabled = #7d8594ff text.on_accent = #ffffffff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #252629ff +text.on_inverse = #fcfcfdff line.divider = #bcc3ceff line.border = #a9b0bcff line.control_edge = #9aa2b0ff -line.knob_edge = #2a303eff +line.knob_edge = #292f3dff line.frame = #9aa2b0ff -line.mark = #4a4d54ff +line.mark = #494c53ff line.grip = #c3c8d0ff line.focus = #a81a00ff accent.solid = #af1b00ff @@ -60,9 +62,9 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8c96a8ff status.info.solid_pressed = #8d96a7ff state.hover = #c5ccd6ff -state.pressed = #b6bec9ff -state.selected = #e7c4bdff -state.selected_hover = #dbb9b2ff +state.pressed = #d4b5b6ff +state.selected = #d4bbbdff +state.selected_hover = #c9b0b2ff state.disabled_fill = #d3d8e0ff state.text_selection = #af1b0046 state.match = #776c005a @@ -95,14 +97,14 @@ data.cyan = #00758bff data.magenta = #cb008dff data.yellow = #776c00ff data.scope = #282828ff -data.backdrop = #2a303e80 +data.backdrop = #292f3d80 data.selection = #af1b0059 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #1b1f271a -caption.inactive = #2a303dff -caption.pressed = #2a303eff +caption.inactive = #29303cff +caption.pressed = #292f3dff edge.light = #ffffffff edge.dark = #82878eff shape.radius.sm = 3 @@ -134,6 +136,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 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 315233d458..76037d6321 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 @@ -8,21 +8,23 @@ surface.raised = #d9dee6ff surface.sunken = #e9ecf1ff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #252629ff surface.shadow = #00000032 text.normal = #1b1f27ff -text.muted = #2a303eff -text.faint = #2a303dff -text.disabled = #82868eff +text.muted = #292f3dff +text.faint = #29303cff +text.disabled = #7d8594ff text.on_accent = #ffffffff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #252629ff +text.on_inverse = #fcfcfdff line.divider = #bcc3ceff line.border = #a9b0bcff line.control_edge = #9aa2b0ff -line.knob_edge = #2a303eff +line.knob_edge = #292f3dff line.frame = #9aa2b0ff -line.mark = #4a4d54ff +line.mark = #494c53ff line.grip = #c3c8d0ff line.focus = #a81a00ff accent.solid = #af1b00ff @@ -60,9 +62,9 @@ status.info.solid = #8c96a8ff status.info.solid_hover = #8c96a8ff status.info.solid_pressed = #8d96a7ff state.hover = #c5ccd6ff -state.pressed = #b6bec9ff -state.selected = #e7c4bdff -state.selected_hover = #dbb9b2ff +state.pressed = #d4b5b6ff +state.selected = #d4bbbdff +state.selected_hover = #c9b0b2ff state.disabled_fill = #d3d8e0ff state.text_selection = #af1b0046 state.match = #776c005a @@ -95,14 +97,14 @@ data.cyan = #00758bff data.magenta = #cb008dff data.yellow = #776c00ff data.scope = #282828ff -data.backdrop = #2a303e80 +data.backdrop = #292f3d80 data.selection = #af1b0059 caption.close_hover = #c42b1cff caption.close_pressed = #c42b1ce6 caption.close_text = #ffffffff caption.disc = #1b1f271a -caption.inactive = #2a303dff -caption.pressed = #2a303eff +caption.inactive = #29303cff +caption.pressed = #292f3dff edge.light = #ffffffff edge.dark = #82878eff shape.radius.sm = 2 @@ -134,6 +136,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 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 e15440c537..99d34c4588 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 @@ -8,21 +8,23 @@ surface.raised = #d9dee6ff surface.sunken = #e9ecf1ff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #252629ff surface.shadow = #00000032 text.normal = #1b1f27ff text.muted = #4a5160ff text.faint = #7d8594ff -text.disabled = #82868eff +text.disabled = #7d8594ff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #252629ff +text.on_inverse = #fcfcfdff line.divider = #bcc3ceff line.border = #a9b0bcff line.control_edge = #9aa2b0ff line.knob_edge = #4a5160ff line.frame = #9aa2b0ff -line.mark = #64676eff +line.mark = #63676dff line.grip = #c3c8d0ff line.focus = #cd3b24ff accent.solid = #d9472fff @@ -60,9 +62,9 @@ status.info.solid = #6f788aff status.info.solid_hover = #6c7587ff status.info.solid_pressed = #6c7585ff state.hover = #c5ccd6ff -state.pressed = #b6bec9ff -state.selected = #e7c4bdff -state.selected_hover = #dbb9b2ff +state.pressed = #d4b5b6ff +state.selected = #d4bbbdff +state.selected_hover = #c9b0b2ff state.disabled_fill = #d3d8e0ff state.text_selection = #d9472f46 state.match = #f0dc005a @@ -134,6 +136,9 @@ space.pad.roomy = 20 space.pad.chip = 6 space.pad.segment = 14 space.inset.screen = 20 +space.inset.page_side = 70 +space.inset.page_margin = 28 +space.inset.page_gap = 14 size.control.sm = 24 size.control.md = 30 size.icon.sm = 14 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -245,11 +251,11 @@ motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false warning = accent.solid on surface.panel: 3.00 < 3.00 -warning = text.muted on state.pressed: 4.25 < 4.50 +warning = text.muted on state.pressed: 4.20 < 4.50 warning = text.faint on surface.background: 2.25 < 4.50 warning = text.faint on surface.panel: 2.59 < 4.50 warning = text.faint on surface.chrome: 2.59 < 4.50 warning = text.faint on surface.raised: 2.75 < 4.50 warning = text.faint on surface.sunken: 3.14 < 4.50 warning = text.faint on state.hover: 2.30 < 4.50 -warning = text.faint on state.pressed: 1.98 < 4.50 +warning = text.faint on state.pressed: 1.96 < 4.50 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 7051e2d8e8..df681c998b 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 @@ -8,21 +8,23 @@ surface.raised = #d9dee6ff surface.sunken = #e9ecf1ff surface.knob = #fcfcfdff surface.scrim = #00000059 +surface.inverse = #252629ff surface.shadow = #00000032 text.normal = #1b1f27ff text.muted = #4a5160ff text.faint = #7d8594ff -text.disabled = #82868eff +text.disabled = #7d8594ff text.on_accent = #000000ff text.on_strong = #ffffffff text.on_status = #000000ff text.on_selected = #252629ff +text.on_inverse = #fcfcfdff line.divider = #bcc3ceff line.border = #a9b0bcff line.control_edge = #9aa2b0ff line.knob_edge = #4a5160ff line.frame = #9aa2b0ff -line.mark = #64676eff +line.mark = #63676dff line.grip = #c3c8d0ff line.focus = #cd3b24ff accent.solid = #d9472fff @@ -60,9 +62,9 @@ status.info.solid = #6f788aff status.info.solid_hover = #6c7587ff status.info.solid_pressed = #6c7585ff state.hover = #c5ccd6ff -state.pressed = #b6bec9ff -state.selected = #e7c4bdff -state.selected_hover = #dbb9b2ff +state.pressed = #d4b5b6ff +state.selected = #d4bbbdff +state.selected_hover = #c9b0b2ff state.disabled_fill = #d3d8e0ff state.text_selection = #d9472f46 state.match = #f0dc005a @@ -134,6 +136,9 @@ space.pad.roomy = 16 space.pad.chip = 4 space.pad.segment = 10 space.inset.screen = 16 +space.inset.page_side = 56 +space.inset.page_margin = 24 +space.inset.page_gap = 12 size.control.sm = 20 size.control.md = 24 size.icon.sm = 12 @@ -191,6 +196,7 @@ stroke.thin = 1 stroke.medium = 1.5 stroke.thick = 2 stroke.heavy = 3 +stroke.focus = 2 stroke.dash = 4 stroke.dash_gap = 3 stroke.icon = 0.0729 @@ -245,11 +251,11 @@ motion.outline.millis = 120 motion.outline.easing = standard motion.reduced = false warning = accent.solid on surface.panel: 3.00 < 3.00 -warning = text.muted on state.pressed: 4.25 < 4.50 +warning = text.muted on state.pressed: 4.20 < 4.50 warning = text.faint on surface.background: 2.25 < 4.50 warning = text.faint on surface.panel: 2.59 < 4.50 warning = text.faint on surface.chrome: 2.59 < 4.50 warning = text.faint on surface.raised: 2.75 < 4.50 warning = text.faint on surface.sunken: 3.14 < 4.50 warning = text.faint on state.hover: 2.30 < 4.50 -warning = text.faint on state.pressed: 1.98 < 4.50 +warning = text.faint on state.pressed: 1.96 < 4.50 diff --git a/crates/theme/themes/vectorcraft-modern-medium.json b/crates/theme/themes/vectorcraft-modern-medium.json index 7c416f16e2..77f15a2f5d 100644 --- a/crates/theme/themes/vectorcraft-modern-medium.json +++ b/crates/theme/themes/vectorcraft-modern-medium.json @@ -29,12 +29,13 @@ "neutral": "#d3d8e0" }, "state.hover": "#c5ccd6", - "state.pressed": "#b6bec9", - "state.selected": "#e7c4bd", + "state.pressed": "#d4b5b6", + "state.selected": "#d4bbbd", "surface.background": "#c4cad4", "surface.canvas": "#b9c0cb", "surface.panel": "#d3d8e0", "surface.sunken": "#e9ecf1", + "text.disabled": "#7d8594", "text.faint": "#7d8594", "text.muted": "#4a5160", "text.normal": "#1b1f27" @@ -47,12 +48,13 @@ "line.control_edge": "#3a414e", "line.divider": "#323946", "state.hover": "#353c49", - "state.pressed": "#3d4553", - "state.selected": "#4a3236", + "state.pressed": "#633f3e", + "state.selected": "#573b3d", "surface.background": "#1b1f27", "surface.canvas": "#1e222a", "surface.panel": "#272c36", "surface.sunken": "#1a1e26", + "text.disabled": "#626b7a", "text.faint": "#626b7a", "text.muted": "#99a2b2", "text.normal": "#e4e9f1" diff --git a/crates/theme/themes/vectorcraft-modern.json b/crates/theme/themes/vectorcraft-modern.json index be251b3e4e..98e9193bc2 100644 --- a/crates/theme/themes/vectorcraft-modern.json +++ b/crates/theme/themes/vectorcraft-modern.json @@ -29,12 +29,13 @@ "neutral": "#f3f5f8" }, "state.hover": "#e3e7ed", - "state.pressed": "#d5dbe3", - "state.selected": "#f8d9d2", + "state.pressed": "#edcbc8", + "state.selected": "#eed2d0", "surface.background": "#e6e9ee", "surface.canvas": "#dfe3e9", "surface.panel": "#f3f5f8", "surface.sunken": "#ffffff", + "text.disabled": "#9aa1ad", "text.faint": "#9aa1ad", "text.muted": "#58606e", "text.normal": "#1b1f27" @@ -47,12 +48,13 @@ "line.control_edge": "#2c323e", "line.divider": "#232832", "state.hover": "#262b35", - "state.pressed": "#2f3541", - "state.selected": "#3a2a2c", + "state.pressed": "#593330", + "state.selected": "#4c2e2e", "surface.background": "#0b0d12", "surface.canvas": "#101217", "surface.panel": "#181b22", "surface.sunken": "#0f1116", + "text.disabled": "#5a6271", "text.faint": "#5a6271", "text.muted": "#969faf", "text.normal": "#dfe4ec" From 9c9e7ae80681509dad7d16eb83974d9899ef14cd Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 24 Nov 2026 10:12:15 +0700 Subject: [PATCH 03/16] ui-contract: a focused stop in a layer that plays its exit loses the focus in the first pass of the exit --- crates/ui-contract/src/runtime/focus.rs | 2 +- crates/ui-contract/src/runtime/focus/nav.rs | 33 +++++++++++++----- crates/ui-contract/tests/it/runtime/focus.rs | 35 ++++++++++++++++++++ 3 files changed, 60 insertions(+), 10 deletions(-) diff --git a/crates/ui-contract/src/runtime/focus.rs b/crates/ui-contract/src/runtime/focus.rs index 46d12f0f59..7a46482fb8 100644 --- a/crates/ui-contract/src/runtime/focus.rs +++ b/crates/ui-contract/src/runtime/focus.rs @@ -62,7 +62,7 @@ pub(crate) struct ScopeRec { /// The stop that held focus when the scope was first pushed, or for a scope that does not trap the stop focus last /// entered it from, which `restore` returns to. pub(crate) opener: Option, - /// The scope's layer is playing its exit: focus inside it already returns to the opener. + /// The scope's layer is playing its exit: focus inside it leaves at once, to the opener or nowhere. pub(crate) closing: bool, /// For a layer's scope: whether this is its first pass since the layer appeared, as the layer's memory says; /// none for other scopes, which are new after a gap of a frame. diff --git a/crates/ui-contract/src/runtime/focus/nav.rs b/crates/ui-contract/src/runtime/focus/nav.rs index 208816b998..8dce33400b 100644 --- a/crates/ui-contract/src/runtime/focus/nav.rs +++ b/crates/ui-contract/src/runtime/focus/nav.rs @@ -571,29 +571,44 @@ impl State { Some(self.focus_stop(member)) } - /// The focus move when the focused stop was not registered this pass: a removed child of a collection row hands - /// focus back to the row, as Escape does; any other removed stop leaves focus nowhere, whatever stops are left - /// around it. + /// The focus move when the focused stop was not registered this pass, or only inside a layer that plays its exit + /// (`fading`): a removed child of a collection row hands focus back to the row, as Escape does; any other removed + /// stop leaves focus nowhere, whatever stops are left around it. fn removed_focus(&mut self, focused: Option) -> Option> { let root = focused?; let key = *self.focused.get(&root)?; - if self.stops.iter().any(|rec| rec.stop.key() == key) { + let live = |rec: &&StopRec| !self.fading(rec.scope); + if self.stops.iter().filter(live).any(|rec| rec.stop.key() == key) { return None; } - let gone = self.last_stops.iter().find(|rec| rec.stop.key() == key)?; + let gone = self.find_stop(key)?; let row = gone.stop.group.and_then(|group| self.group(group)).filter(|group| group.row); - let owner = row.and_then(|group| self.row_owner(&group)).filter(|owner| self.stops.iter().any(|rec| rec.stop.key() == owner.stop.key())); + let owner = + row.and_then(|group| self.row_owner(&group)).filter(|owner| self.stops.iter().filter(live).any(|rec| rec.stop.key() == owner.stop.key())); // A removed stop in an arena (an editor or control in a canvas body) hands focus back to the arena root's own // stop (the canvas). - let target = owner - .or_else(|| gone.stop.arena.and_then(|arena| self.stops.iter().find(|rec| rec.stop.id == arena && rec.stop.part.is_none()).cloned())); + let target = owner.or_else(|| { + gone.stop.arena.and_then(|arena| self.stops.iter().filter(live).find(|rec| rec.stop.id == arena && rec.stop.part.is_none()).cloned()) + }); Some(match target { Some(target) => self.focus_stop_from(target, FocusOrigin::Removal), None => vec![Act::Surrender(root)], }) } - /// The opener of a scope that went away while focus was inside it. + /// Whether the scope `scope` of this pass, or one around it, is a layer playing its exit: its stops take no focus. + fn fading(&self, scope: Option) -> bool { + let mut at = scope; + while let Some(rec) = at.and_then(|id| self.scopes.get(&id)) { + if rec.closing { + return true; + } + at = rec.parent; + } + false + } + + /// The opener of a scope that went away, or plays its exit, while focus was inside it. fn restored_focus(&self, focused: Option) -> Option { let root = focused?; let key = *self.focused.get(&root).unwrap_or(&(root, None)); diff --git a/crates/ui-contract/tests/it/runtime/focus.rs b/crates/ui-contract/tests/it/runtime/focus.rs index f6e80e4d0e..f515edf153 100644 --- a/crates/ui-contract/tests/it/runtime/focus.rs +++ b/crates/ui-contract/tests/it/runtime/focus.rs @@ -74,3 +74,38 @@ fn a_request_in_a_press_pass_keeps_the_focus_from_the_press() { craft_ui::testing::pointer::click(&mut frames, at.get().center(), &mut show); assert_eq!(egui_focused(&frames.ctx), Some(editor), "the request of the press's pass holds"); } + +/// A popover opened with nothing focused closes while a stop in it holds the focus: from the first pass of its exit +/// fade, while its body still draws, the focus is nowhere, so a key pressed during the fade is not the stop's +/// (VectorCraft: Cmd+A after the Artboards flyout closed still selected the list's rows). +#[trial] +fn a_stop_in_a_layer_that_fades_out_loses_the_focus_at_once() { + use craft_behavior::overlay::{Align, Side}; + use craft_ui::contract::overlay::{Anchor, Place}; + use craft_ui::contract::{Mount, Overlay, Sizing}; + let seen = RefCell::new(Seen::default()); + let (close, drawn) = (Cell::new(false), Cell::new(0u32)); + let mut show = |ui: &mut Ui| { + let overlay = Overlay::popover().place(Place::anchored(Anchor::Rect(Rect::from_min_size(ORIGIN, VIEW)), Side::Below, Align::Start)); + Slab::new(ContainerProps::new().mount(Mount::Layer(overlay)).sizing(Sizing::Content)).id_salt("flyout").show(ui, |ui, cx| { + drawn.set(drawn.get() + 1); + if close.get() { + cx.request_close(); + } + Probe::new(&seen).label("List").id_salt("list").show(ui); + }); + }; + let mut frames = Frames::new(); + frames.idle(3, &mut show); + let list = seen.borrow().id.expect("the list ran"); + request(&frames.ctx, FocusTarget::Id(list)); + frames.idle(2, &mut show); + assert_eq!(craft_ui::testing::focus::egui_focused(&frames.ctx), Some(list), "the list took the focus"); + close.set(true); + frames.idle(1, &mut show); + close.set(false); + drawn.set(0); + frames.idle(1, &mut show); + assert!(drawn.get() > 0, "the layer still draws its fade"); + assert_eq!(craft_ui::testing::focus::egui_focused(&frames.ctx), None, "the fading layer's stop has no focus"); +} From 48d19d281053524a4c794f69db88688d770ddbf4 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 24 Nov 2026 12:08:24 +0700 Subject: [PATCH 04/16] ui-contract: a command fired from a button runs as a command; only a menu's or the palette's fire stands for the key a component claims --- crates/ui-canvas/tests/it/canvas/tool_keys.rs | 17 ++++++++++++++++- .../ui-contract/src/runtime/commands/board.rs | 9 +++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/crates/ui-canvas/tests/it/canvas/tool_keys.rs b/crates/ui-canvas/tests/it/canvas/tool_keys.rs index aab42724d1..41eedb0ef4 100644 --- a/crates/ui-canvas/tests/it/canvas/tool_keys.rs +++ b/crates/ui-canvas/tests/it/canvas/tool_keys.rs @@ -20,7 +20,7 @@ use craft_ui::dialog::Dialog; use craft_ui::display::Text; use craft_ui::popover::Popover; use craft_ui::primitives::Draw; -use craft_ui::runtime::commands::{self, EditCommands, FireSource}; +use craft_ui::runtime::commands::{self, CommandSet as _, EditCommands, FireSource}; use craft_ui::runtime::frame::take_output; use craft_ui::testing::access::Declared; use craft_ui::testing::focus::{AccessActionKind, key_release}; @@ -169,6 +169,21 @@ fn a_fired_command_whose_key_the_tool_claims_reaches_it_with_nothing_focused() { assert!(take_output(canvas.fixture().ctx()).fired.is_empty(), "no app command ran"); } +/// A command a button fires runs as the button's command, though the tool claims its key: only a menu's or the +/// palette's stands for the key (a toolbar's tool button finishes a gesture the tool holds the keyboard for). +#[trial] +fn a_pointer_fired_command_whose_key_the_tool_claims_runs_as_a_command() { + let mut canvas = ToolFixture::new("Document", Outline::new(true)); + canvas.fixture().settle(); + assert_eq!(canvas.fixture().focused(), None, "nothing is focused"); + take_output(canvas.fixture().ctx()); + assert!(commands::fire(canvas.fixture().ctx(), EditCommands::Delete, FireSource::Pointer), "Delete runs"); + canvas.fixture().settle(); + assert_eq!(canvas.tool().seen, [], "the tool got no Delete"); + let fired = take_output(canvas.fixture().ctx()).fired; + assert!(fired.iter().any(|fired| fired.command.id == EditCommands::Delete.id()), "the app's Delete ran: {fired:?}"); +} + /// A tool that takes every key the host offers it, and the lone Alt tap while `taps`. #[derive(Default)] struct Taker { diff --git a/crates/ui-contract/src/runtime/commands/board.rs b/crates/ui-contract/src/runtime/commands/board.rs index 7af58b6f80..c06b9a8686 100644 --- a/crates/ui-contract/src/runtime/commands/board.rs +++ b/crates/ui-contract/src/runtime/commands/board.rs @@ -1731,10 +1731,11 @@ fn queue(ctx: &Context, fired: Fired) { observed.push(fired.command.clone()); } }); - // A command whose key the focused component claims reaches it as that key, as the key's press does; an edit command - // goes to the focused component that lists it; otherwise it goes to the instance that declared it or, with none, - // stays an app command. - if fired.phase != FirePhase::Release { + // A command run from a menu or the palette whose key the focused component claims reaches it as that key, as the + // key's press does (a button's is the button's command, even while a canvas gesture claims every key); an edit + // command goes to the focused component that lists it; otherwise it goes to the instance that declared it or, with + // none, stays an app command. + if fired.phase != FirePhase::Release && matches!(fired.source, FireSource::Menu | FireSource::Palette) { let chords: Vec = bindings(ctx, &fired.command).into_iter().filter(|binding| !binding.trigger.is_double()).map(|binding| binding.trigger.chord).collect(); if keys::fire_claimed(ctx, &chords) { From 51eaf9fd256bd55a966c6369721b5225dbde9fbd Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 24 Nov 2026 12:19:01 +0700 Subject: [PATCH 05/16] ui-contract: a page key the keymap binds to a command that runs now runs it ahead of the document canvas's page scroll, focused or not; an unbound one still pages --- crates/ui-canvas/tests/it/canvas/navigate.rs | 36 ++++++++++++++++++++ crates/ui-contract/src/runtime/keys/route.rs | 20 +++++++++-- crates/ui-contract/src/testing/key_trials.rs | 25 +++++++++----- 3 files changed, 69 insertions(+), 12 deletions(-) diff --git a/crates/ui-canvas/tests/it/canvas/navigate.rs b/crates/ui-canvas/tests/it/canvas/navigate.rs index 87694e16fb..bcb8801f46 100644 --- a/crates/ui-canvas/tests/it/canvas/navigate.rs +++ b/crates/ui-canvas/tests/it/canvas/navigate.rs @@ -152,6 +152,42 @@ fn cmd_or_ctrl_with_page_down_scrolls_a_focused_canvas_sideways_on_every_os() { } } +const NEXT_ARTBOARD: &str = "canvasTrial.nextArtboard"; + +/// A page key the app binds to a command runs it ahead of the canvas's page scroll, with nothing focused and with the +/// canvas focused (Page Down goes to the next artboard); an unbound page key still scrolls the view. +#[trial] +fn a_bound_page_key_runs_its_command_and_an_unbound_one_pages_the_canvas() { + let view = Rc::new(Cell::new(CanvasView::new(egui::Rect::ZERO, Point::new(2000.0, 2000.0), 1.0))); + let shown = Rc::clone(&view); + let mut fixture = Fixture::new(move |ui| { + let mut given = shown.get(); + given.rect = ui.available_rect_before_wrap(); + let canvas = Canvas::new("Document").document(Size::new(4000.0, 4000.0)).view(given).show(ui, |_, _| {}); + shown.set(canvas.output.view.unwrap_or(given)); + }); + let binding = Binding::parse("PageDown").expect("the trial's chord parses"); + let catalog = + AppCatalog::new(vec![CommandDef::new(NEXT_ARTBOARD, "Next Artboard", Scope::app()).with_default(binding)], 1).expect("the catalog is valid"); + fixture.commands(CommandInput::new().catalog(catalog)); + fixture.settle(); + let page = |fixture: &mut Fixture, key: Key| { + frame::take_output(fixture.ctx()); + let before = view.get().center; + fixture.key(key, Modifiers::NONE).settle(); + let fired: Vec = frame::take_output(fixture.ctx()).fired.into_iter().map(|fired| fired.command.id).collect(); + (fired, view.get().center != before) + }; + assert_eq!(fixture.focused(), None, "nothing is focused"); + assert_eq!(page(&mut fixture, Key::PageDown), (vec![NEXT_ARTBOARD.to_owned()], false), "unfocused: the bound Page Down runs its command"); + assert_eq!(page(&mut fixture, Key::PageUp), (Vec::new(), true), "unfocused: the unbound Page Up scrolls"); + let canvas = fixture.by_role(Role::CANVAS)[0]; + fixture.click(&canvas); + assert!(fixture.focused().is_some(), "the click focuses the canvas"); + assert_eq!(page(&mut fixture, Key::PageDown), (vec![NEXT_ARTBOARD.to_owned()], false), "focused: the bound Page Down runs its command"); + assert_eq!(page(&mut fixture, Key::PageUp), (Vec::new(), true), "focused: the unbound Page Up scrolls"); +} + #[trial] fn cmd_or_ctrl_with_page_down_on_a_focused_canvas_control_scrolls_the_canvas_sideways() { let view = Rc::new(Cell::new(CanvasView::new(egui::Rect::ZERO, Point::new(2000.0, 2000.0), 1.0))); diff --git a/crates/ui-contract/src/runtime/keys/route.rs b/crates/ui-contract/src/runtime/keys/route.rs index f88b186d99..752a8cca3a 100644 --- a/crates/ui-contract/src/runtime/keys/route.rs +++ b/crates/ui-contract/src/runtime/keys/route.rs @@ -140,7 +140,8 @@ pub(crate) fn begin(ctx: &Context, press_captured: bool) -> EscapeRouting { // session control on a canvas), unless a modal layer is open. The window's document canvas is its key target // (`focus::host_canvas`): Page Up and Down, Home and End page it as they do while it has the focus. What the // canvas takes is its alone, as while it has the focus: the app's shortcuts do not run with it too. It takes the - // arrows with the modifiers it acts on (`KeyUse::nudge_mods`); the others are the app's. + // arrows with the modifiers it acts on (`KeyUse::nudge_mods`); the others are the app's, as is a page key bound to + // a command that runs now (`page_key_runs`). let declared = |mods: Mods| canvas.as_ref().is_none_or(|canvas| canvas.stop.keys.nudge_mods.contains(mods)); for (press, taken) in batch.presses.iter().zip(&mut consumed).filter(|(press, _)| !press.canvas) { if let Some(id) = hover_delete @@ -161,6 +162,7 @@ pub(crate) fn begin(ctx: &Context, press_captured: bool) -> EscapeRouting { } else if let Some(canvas) = &canvas && let Some(Intent::Move(mv @ (NavMove::PageUp | NavMove::PageDown | NavMove::Start | NavMove::End), mods)) = keys::intent(os, press.key, press.mods, canvas.stop.role) + && !page_key_runs(ctx, canvas, press) { push(&mut routed, Some(canvas.stop.id), Intent::Move(mv, mods), false); *taken = Taken::Canvas; @@ -277,6 +279,18 @@ fn remap_mods(mods: &[(usize, Mods)], kept: &[bool]) -> Vec<(usize, Mods)> { mods.iter().map(|(at, held)| (kept.get(..*at).unwrap_or(kept).iter().filter(|stays| **stays).count(), *held)).collect() } +/// Whether `press`, a page key (Page Up or Down, Home, End) of the window's document canvas `canvas`, focused or the +/// unfocused window's key target, runs the command the window's keymap binds it to (`commands::runs_now`): that app +/// shortcut goes ahead of the canvas's page scroll (Q370), as the keymap ran it before the canvas paged. A canvas's +/// editor part keeps its page keys as its input. +fn page_key_runs(ctx: &Context, canvas: &StopRec, press: &Press) -> bool { + let keys = &canvas.stop.keys; + keys.chrome_key + && !keys.is_document_editor() + && matches!(press.key, Key::PageUp | Key::PageDown | Key::Home | Key::End) + && commands::runs_now(ctx, crate::runtime::egui::pass::current_viewport(ctx), &Chord { mods: press.mods, key: press.key }) +} + pub(super) fn push(routed: &mut HashMap, Routed>, target: Option, intent: Intent, horizontal: bool) { routed.entry(target).or_default().items.push(Item { intent, horizontal, source: None }); } @@ -687,8 +701,8 @@ fn press_route(ctx: &Context, os: Os, rec: &StopRec, press: &Press, driven: Opti let leaves_row = !caret && is_vertical(mv) && focus::is_row_child(ctx, stop); let kept = caret || (stop.part.is_none() && stop.keys.keep.keeps_arrow(mv)); // A stop that does not act on its moves leaves a move key a scoped command around it binds to that - // command, ahead of its roving group and the scroll owner. - if !leaves_row && !kept && !stop.role.moves && commands::binds_scoped(ctx, &chord) { + // command, ahead of its roving group and the scroll owner; the document canvas leaves a bound page key. + if (!leaves_row && !kept && !stop.role.moves && commands::binds_scoped(ctx, &chord)) || page_key_runs(ctx, rec, press) { PressRoute::Free } else { PressRoute::Move(mv, mods) diff --git a/crates/ui-contract/src/testing/key_trials.rs b/crates/ui-contract/src/testing/key_trials.rs index acc91136a9..ff1e4e6cfa 100644 --- a/crates/ui-contract/src/testing/key_trials.rs +++ b/crates/ui-contract/src/testing/key_trials.rs @@ -231,9 +231,10 @@ fn a_recorder_reads_a_press_as_one_chord_and_no_command_runs() { assert_eq!(press_k("button").0, Vec::new(), "no other role reads chords"); } -/// With nothing focused, the window's document canvas takes Page Down and the arrows' nudge, as while it has the focus; -/// the press is its alone, so no app shortcut runs with it as well (a page view would turn twice). Without a canvas the -/// press is the app's. +/// With nothing focused, the window's document canvas takes the arrows' nudge and an unbound Page Up, as while it has +/// the focus; the press is its alone, so no app shortcut runs with it as well (a page view would turn twice). A page key +/// the app binds to a command that runs is the app's (Page Down to the next artboard). Without a canvas every press is +/// the app's. #[trial] fn an_unfocused_press_the_window_canvas_takes_reaches_no_app_shortcut() { let paged = Rc::new(Cell::new(0)); @@ -245,8 +246,10 @@ fn an_unfocused_press_the_window_canvas_takes_reaches_no_app_shortcut() { stop(ui, "canvas", KeyUse::CANVAS); } let mut intents = intents_of(ui.ctx(), Some(id("canvas")), false); - if intents.take(Intent::Move(craft_behavior::NavMove::PageDown, craft_behavior::MoveMods::PLAIN)) { - sink.set(sink.get() + 1); + for page in [craft_behavior::NavMove::PageDown, craft_behavior::NavMove::PageUp] { + if intents.take(Intent::Move(page, craft_behavior::MoveMods::PLAIN)) { + sink.set(sink.get() + 1); + } } }; let mut bound = Overrides::default(); @@ -256,17 +259,21 @@ fn an_unfocused_press_the_window_canvas_takes_reaches_no_app_shortcut() { frames.commands(CommandInput::new().overrides(Arc::new(bound))); frames.frame(Vec::new(), &mut show); take_output(&frames.ctx); - let fired = |frames: &mut Frames, show: &mut dyn FnMut(&mut Ui)| { - frames.frame(vec![key_press(Key::PageDown, Modifiers::NONE), key_press(Key::ArrowRight, Modifiers::NONE)], &mut *show); + let fired = |frames: &mut Frames, show: &mut dyn FnMut(&mut Ui), key: Key| { + frames.frame(vec![key_press(key, Modifiers::NONE), key_release(key, Modifiers::NONE)], &mut *show); frames.frame(Vec::new(), &mut *show); take_output(&frames.ctx).fired.len() }; - assert_eq!(fired(&mut frames, &mut show), 0, "neither press reaches the app's commands"); + assert_eq!(fired(&mut frames, &mut show, Key::ArrowRight), 0, "the arrow is the canvas's nudge"); + assert_eq!(fired(&mut frames, &mut show, Key::PageUp), 0, "the unbound Page Up is the canvas's"); assert_eq!(paged.get(), 1, "the canvas pages"); + assert_eq!(fired(&mut frames, &mut show, Key::PageDown), 1, "the bound Page Down is the app's"); + assert_eq!(paged.get(), 1, "the canvas does not page with it"); canvas.set(false); frames.idle(2, &mut show); take_output(&frames.ctx); - assert_eq!(fired(&mut frames, &mut show), 2, "without a canvas both presses are the app's"); + let presses = [Key::PageDown, Key::ArrowRight].map(|key| fired(&mut frames, &mut show, key)); + assert_eq!(presses, [1, 1], "without a canvas both presses are the app's"); } /// A recorder holds every press: the app reads none from egui's input, and `focus_holds` answers so before the press. From aa973d98fa85c578a933eb8e3c54a64a71649283 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 24 Nov 2026 12:23:14 +0700 Subject: [PATCH 06/16] ui-contract: a press the focused component holds leaves egui's input again unless the app's own widget reads it; the merge b138b533f passed whether anything had focus for whether the focus was the app's widget --- crates/ui-contract/src/runtime/keys/route.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ui-contract/src/runtime/keys/route.rs b/crates/ui-contract/src/runtime/keys/route.rs index 752a8cca3a..07f405ab1c 100644 --- a/crates/ui-contract/src/runtime/keys/route.rs +++ b/crates/ui-contract/src/runtime/keys/route.rs @@ -187,7 +187,9 @@ pub(crate) fn begin(ctx: &Context, press_captured: bool) -> EscapeRouting { } let over: Vec = batch.presses.iter().map(held_press).collect(); let (shortcuts, held) = owned_shortcuts(ctx, target.as_ref(), &batch, &consumed, &taken_texts, &over); - withdraw_taken(ctx, target.is_some(), &batch, &held, &withdrawn_texts); + // The app's own widget, focused or the window's canvas, reads its keys from egui. + let host = target.as_ref().or(canvas.as_ref()).is_some_and(|rec| rec.stop.host); + withdraw_taken(ctx, host, &batch, &held, &withdrawn_texts); let pasted = batch.paste.clone().zip(focused).map(|(content, id)| (id, content)); // PLAN: a repeat Tab of a held-over key is not gated; `take_nav` reads `batch.tabs` before this hook runs (owner: focus). // One Escape press cancels once: its repeats cancel nothing more, in the layer it closed or in what that uncovered. From 8da5ec92a5ab7680f6b706d54db430ee74a6aa54 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 24 Nov 2026 12:33:34 +0700 Subject: [PATCH 07/16] =?UTF-8?q?ui-widgets:=20NumberLook::Inline=20sets?= =?UTF-8?q?=20a=20number=20field's=20value=20and=20unit=20as=20one=20run?= =?UTF-8?q?=20at=20its=20start=20(720=20pt,=200=C2=B0,=20100%)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/ui-contract/src/runtime/env/units.rs | 6 + crates/ui-widgets/src/text/mod.rs | 3 +- crates/ui-widgets/src/text/number.rs | 104 ++++++++++++++---- crates/ui-widgets/src/text/number/rule.rs | 35 +++--- crates/ui-widgets/src/text/number/stories.rs | 53 ++++++++- crates/ui-widgets/tests/it/text/mod.rs | 1 + .../ui-widgets/tests/it/text/number_look.rs | 72 ++++++++++++ 7 files changed, 234 insertions(+), 40 deletions(-) create mode 100644 crates/ui-widgets/tests/it/text/number_look.rs diff --git a/crates/ui-contract/src/runtime/env/units.rs b/crates/ui-contract/src/runtime/env/units.rs index 30cefec0ad..52647c4b64 100644 --- a/crates/ui-contract/src/runtime/env/units.rs +++ b/crates/ui-contract/src/runtime/env/units.rs @@ -467,6 +467,12 @@ impl Units { self.template(kind).replace("{n}", "").trim().to_owned() } + /// The text before and after the number in the user's language, spacing included: `("", " mm")`, `("", "%")`. + pub fn affixes(&self, kind: UnitKind) -> (String, String) { + let template = self.template(kind); + template.split_once("{n}").map_or_else(|| (String::new(), template.to_owned()), |(before, after)| (before.to_owned(), after.to_owned())) + } + /// The digits after the decimal mark `n` needs within `decimals`: the fewest that show it as it rounds at the most. fn digits(n: f64, decimals: &RangeInclusive) -> usize { let (least, most) = (*decimals.start(), *decimals.end()); diff --git a/crates/ui-widgets/src/text/mod.rs b/crates/ui-widgets/src/text/mod.rs index c924d21fe3..615cb624e7 100644 --- a/crates/ui-widgets/src/text/mod.rs +++ b/crates/ui-widgets/src/text/mod.rs @@ -19,7 +19,8 @@ pub use chips::{ChipCodec, ChipField, ChipFieldOutput, ChipFieldStyle, ChipWords pub use hex::{HexCodec, HexField}; pub use linked::{LinkMode, LinkedFields, LinkedFieldsStyle, LinkedLayout, LinkedOutput, LinkedWords, follow_equal, follow_ratio, link_toggle}; pub use number::{ - NamedOr, NumberField, NumberName, NumberOutput, NumberPick, NumberStepper, NumberStyle, NumberValue, RangeAlert, StepArrows, UnitPlacement, + NamedOr, NumberField, NumberLook, NumberName, NumberOutput, NumberPick, NumberStepper, NumberStyle, NumberValue, RangeAlert, StepArrows, + UnitPlacement, }; pub use selectable_text::{SelectableStyle, SelectableText}; pub use text_field::TextField; diff --git a/crates/ui-widgets/src/text/number.rs b/crates/ui-widgets/src/text/number.rs index f8671b9777..61cf25d9af 100644 --- a/crates/ui-widgets/src/text/number.rs +++ b/crates/ui-widgets/src/text/number.rs @@ -16,7 +16,7 @@ use crate::contract::{ PartsCx, Pointer as _, Props as _, Role, Scrub, Sizing, Styled as _, WordSetCx as _, }; use crate::primitives::{TextOptions, TextRun}; -use crate::runtime::env::{Label, LengthUnits, UnitKind, Units}; +use crate::runtime::env::{EnvView, Label, LengthUnits, UnitKind, Units}; use crate::runtime::frame; use crate::style::{ComponentStyle, StyleColor, StyleCx, SurfaceLook, TextLook, TypeRole}; use craft_behavior::nav::{LARGE_STEPS, StepResult, ValueAxes, ValueSteps}; @@ -70,6 +70,21 @@ pub enum StepArrows { Leading, } +/// How a number field sets its value and unit. An app sets it once at its root (`RootEnv::values`); the default is +/// the centred number. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, crate::runtime::env::EnvValue, crate::contract::MemoProps)] +#[env(style)] +#[non_exhaustive] +pub enum NumberLook { + /// The number centred in the mono face, the unit apart at the end of the value area in caption text, so a column + /// of fields lines its units up; a percentage stands against its sign at the end. + #[default] + Centred, + /// The number and its unit as one run ("720 pt", "0°", "100%") at the field's start, in the interface face and + /// the value's colour: editing shows the same text, and the caret and the selection go through the whole run. + Inline, +} + /// The placeholder of a mixed field. const BLANK: &str = "\u{2014}"; @@ -190,6 +205,8 @@ pub struct NumberField<'a, V: NumberValue + 'static = Option> { lengths: Option, /// How many shown units make one stored unit, read from the env in measure and parts; 1 for a plain field. scale: f64, + /// The scope's look, read from the env in measure and parts. + look: NumberLook, options: TextOptions, positive_only: bool, scrub: bool, @@ -268,6 +285,7 @@ impl<'a, V: NumberValue + 'static> NumberField<'a, V> { max_decimals: None, lengths: None, scale: 1.0, + look: NumberLook::Centred, options: TextOptions::default(), positive_only: false, scrub: false, @@ -326,22 +344,59 @@ impl<'a, V: NumberValue + 'static> NumberField<'a, V> { Rule::new(range.as_ref(), self.step) } - /// Reads a length field's scale from stored to shown from the env. - fn settle_lengths(&mut self, units: &Units) { + /// Reads the scope's look and a length field's scale from stored to shown from the env. The status bar's zoom + /// well keeps its own look. + fn settle(&mut self, env: &EnvView<'_>) { + self.look = if self.status_zoom { NumberLook::Centred } else { env.get() }; if let Some(lengths) = self.lengths { - self.scale = units.length_scale(lengths).unwrap_or(1.0); + self.scale = env.units().length_scale(lengths).unwrap_or(1.0); } } - /// The unit drawn inside the field after the number: the field's own, else the symbol of its unit kind; none when - /// the host draws it after the field. + /// Whether the field draws its unit inside the box, not the host after the field. + fn unit_inside(&self) -> bool { + !self.status_zoom && self.unit_placement == UnitPlacement::Inside + } + + /// The unit drawn apart inside the field after the number: the field's own, else the symbol of its unit kind; + /// none when the host draws it after the field or the number's run holds it. fn shown_unit(&self, units: &Units) -> Option