From 1b7222027268956fc09f045b245399a343f7f450 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 24 Nov 2026 08:07:49 +0700 Subject: [PATCH 01/65] 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/65] 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/65] 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 ae722739ab984d9daa1f0f4c6cea1a6ea82f5cc2 Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 24 Nov 2026 03:28:05 +0000 Subject: [PATCH 04/65] ui-contract: presses the focused component holds leave egui's input again, and Tab stays navigation with nothing focused The merge of next (b138b533fe) passed whether a stop was focused where withdraw_taken takes whether the app's own widget reads its keys from egui, so no held press left egui's input while anything had focus. With nothing focused the document canvas's held claims leave out Tab and Shift+Tab: a tool that claims the plain keys no longer keeps keyboard navigation from moving into the window. The unfocused-canvas trial releases its keys, since a press of a key already down is a repeat. --- crates/ui-contract/src/runtime/keys/input.rs | 11 ++++++++--- crates/ui-contract/src/runtime/keys/route.rs | 4 +++- crates/ui-contract/src/testing/key_trials.rs | 3 ++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/crates/ui-contract/src/runtime/keys/input.rs b/crates/ui-contract/src/runtime/keys/input.rs index de0b670c21..b0ca7a5fc8 100644 --- a/crates/ui-contract/src/runtime/keys/input.rs +++ b/crates/ui-contract/src/runtime/keys/input.rs @@ -541,12 +541,17 @@ enum PressUse { /// The chords the focused component of `record` claims: its stop's, the state-dependent ones (`keys::claim`) of the /// component, its arena root and its menu level, and a bare End where it declares `EndKey::EndMode`. With nothing -/// focused and no modal layer open, the window's document canvas's state-dependent claims hold instead. +/// focused and no modal layer open, the window's document canvas's state-dependent claims hold instead, except Tab and +/// Shift+Tab. pub(super) fn focused_claims(record: &focus::FocusedRecord, stage: &Stage) -> Vec { let mut claims = record.claims.clone(); let canvas = record.canvas.filter(|_| !record.foreign); - let holds = |owner: Id| [record.focused, record.root, record.menu, record.menu_bar, canvas].contains(&Some(owner)); - claims.extend(stage.claims.iter().filter(|(owner, _)| holds(*owner)).map(|(_, chord)| *chord)); + let holds = |owner: Id| [record.focused, record.root, record.menu, record.menu_bar].contains(&Some(owner)); + // The unfocused canvas's tool never takes Tab or Shift+Tab: with nothing focused they move focus into the window, + // so a tool that claims the plain keys cannot trap keyboard navigation. + let canvas_holds = + |owner: Id, chord: &Chord| Some(owner) == canvas && !(chord.key == Key::Tab && (chord.mods == Mods::NONE || chord.mods == Mods::SHIFT)); + claims.extend(stage.claims.iter().filter(|(owner, chord)| holds(*owner) || canvas_holds(*owner, chord)).map(|(_, chord)| *chord)); // A bare End belongs to a stop that declares `EndKey::EndMode`: it reads the key as a claimed chord and toggles its // mode, so no collection navigation or scroll owner takes it as a move to the end. if record.keys.is_some_and(|keys| keys.end == EndKey::EndMode) { diff --git a/crates/ui-contract/src/runtime/keys/route.rs b/crates/ui-contract/src/runtime/keys/route.rs index f88b186d99..a889e9d4dc 100644 --- a/crates/ui-contract/src/runtime/keys/route.rs +++ b/crates/ui-contract/src/runtime/keys/route.rs @@ -185,7 +185,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. diff --git a/crates/ui-contract/src/testing/key_trials.rs b/crates/ui-contract/src/testing/key_trials.rs index acc91136a9..1efd74fce8 100644 --- a/crates/ui-contract/src/testing/key_trials.rs +++ b/crates/ui-contract/src/testing/key_trials.rs @@ -258,7 +258,8 @@ fn an_unfocused_press_the_window_canvas_takes_reaches_no_app_shortcut() { 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); - frames.frame(Vec::new(), &mut *show); + // Released, so the next round's presses are fresh presses, not repeats of held keys. + frames.frame(vec![key_release(Key::PageDown, Modifiers::NONE), key_release(Key::ArrowRight, Modifiers::NONE)], &mut *show); take_output(&frames.ctx).fired.len() }; assert_eq!(fired(&mut frames, &mut show), 0, "neither press reaches the app's commands"); From 22205fffd1db1ba95a65564a2607593f77a45b5c Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 24 Nov 2026 03:28:05 +0000 Subject: [PATCH 05/65] ui-contract: an OS file drop lands where it was dropped, and files hovering in the pass that takes it start their own drag A drop the next frame takes reads the drop's own position, not a pointer the next files have moved, and the files the OS holds over the window in that pass start a session once the drop ends the old one. The files' pointer is the system pointer where the platform tells one, else the pass's own: the drag's noted source pointer is from the pass before. --- crates/ui-contract/src/runtime/drag.rs | 88 ++++++++++++++++++-------- 1 file changed, 61 insertions(+), 27 deletions(-) diff --git a/crates/ui-contract/src/runtime/drag.rs b/crates/ui-contract/src/runtime/drag.rs index bfe0156945..30dfc6f6af 100644 --- a/crates/ui-contract/src/runtime/drag.rs +++ b/crates/ui-contract/src/runtime/drag.rs @@ -260,6 +260,12 @@ struct Session { dropped: Option, /// A file drop has arrived but no pointer position is available yet. waiting_for_pointer: bool, + /// Where the OS dropped the files: the pass that takes a drop after the frame of its arrival places it there, not + /// at a pointer that has moved on (files hovering again for a drag of their own). + dropped_at: Option, + /// Files the OS holds over the window in the pass that takes this session's drop: a drag of their own, which + /// starts when the drop ends this session (`end_pass`). + hovering_next: Vec, /// The root frame the session started in, the only one in which [`amend`] changes its payload. began: u64, } @@ -364,6 +370,8 @@ pub fn start( os: false, dropped: None, waiting_for_pointer: false, + dropped_at: None, + hovering_next: Vec::new(), began, }); board.ended = None; @@ -489,8 +497,7 @@ fn os_files(ctx: &Context) { let hovering = !seen.hovered.is_empty(); // A session whose window closed has no pass left to end it. let closed = source_viewport(ctx).is_some_and(|window| !pass::live_viewports(ctx).contains(&window)); - let host = WindowHost::of(ctx); - let position = if host.desktop_pointer().is_some() { host.pointer_in(viewport) } else { pointer::frame_raw(ctx).pos }; + let position = os_files_pointer(ctx, viewport, pointer::frame_raw(ctx).pos); let positioned = position.is_some(); // A window target can take the drop immediately only if the pointer has not moved since resolution. let window_winner = PerViewport::::with(ctx, viewport, |targets| targets.winner_window && targets.pointer == position); @@ -501,23 +508,11 @@ fn os_files(ctx: &Context) { if has_drop { repaint = true; } - board.session = Some(Session { - source: Id::NULL.with("craft_ui::os_files"), - moving: Moving::default(), - viewport, - button: PointerButton::Primary, - payload: Arc::new(OsFiles { files: if has_drop { seen.dropped } else { seen.hovered } }), - also: Vec::new(), - preview: DragPreview::None, - env: None, - mark: None, - released: None, - taken: false, - os: true, - dropped: (has_drop && positioned).then_some(frame.saturating_add(1)), - waiting_for_pointer: has_drop && !positioned, - began: frame, - }); + let mut session = os_session(if has_drop { seen.dropped } else { seen.hovered }, viewport, frame); + session.dropped = (has_drop && positioned).then_some(frame.saturating_add(1)); + session.dropped_at = position.filter(|_| has_drop); + session.waiting_for_pointer = has_drop && !positioned; + board.session = Some(session); board.ended = None; board.started += 1; } @@ -527,6 +522,7 @@ fn os_files(ctx: &Context) { let files = seen.dropped.into_iter().map(|file| with_hovered_type(file, hovered)).collect(); session.payload = Arc::new(OsFiles { files }); session.viewport = viewport; + session.dropped_at = position; if window_winner { session.dropped = Some(frame); } else if positioned { @@ -540,9 +536,13 @@ fn os_files(ctx: &Context) { // Targets register this pass and take the drop in the next, after their winner is resolved. session.waiting_for_pointer = false; session.dropped = Some(frame.saturating_add(1)); + session.dropped_at = position; repaint = true; } else if hovering { session.viewport = viewport; + if session.dropped == Some(frame) { + session.hovering_next = seen.hovered; + } } else if (session.viewport == viewport || closed) && !seen.reading && !session.waiting_for_pointer @@ -560,6 +560,29 @@ fn os_files(ctx: &Context) { } } +/// A session of `files` the OS holds over `viewport`, started in root frame `frame`. +fn os_session(files: Vec, viewport: ViewportId, frame: u64) -> Session { + Session { + source: Id::NULL.with("craft_ui::os_files"), + moving: Moving::default(), + viewport, + button: PointerButton::Primary, + payload: Arc::new(OsFiles { files }), + also: Vec::new(), + preview: DragPreview::None, + env: None, + mark: None, + released: None, + taken: false, + os: true, + dropped: None, + waiting_for_pointer: false, + dropped_at: None, + hovering_next: Vec::new(), + began: frame, + } +} + /// `file` with the media type the OS gave the hovered file at the same path, which egui does not repeat on a drop. fn with_hovered_type(mut file: OsFile, hovered: Option<&OsFiles>) -> OsFile { let held = hovered.and_then(|hovered| hovered.files.iter().find(|held| held.path.is_some() && held.path == file.path)); @@ -588,12 +611,22 @@ pub fn cross_window_pointer(ctx: &Context, viewport: ViewportId) -> Option } /// The pointer of the running session in screen space, whatever its payload: the pointer `dragging_of` pairs with a -/// payload, where the button went up in the pass of its release (`PointerFrame::pick_pos`). `None` without a session or -/// a pointer. +/// payload, where the button went up in the pass of its release (`PointerFrame::pick_pos`); for an OS drop, where the +/// files were dropped in the pass that takes it. `None` without a session or a pointer. pub(crate) fn session_pointer(ctx: &Context) -> Option { - let os = board(ctx, |board| board.session.as_ref().map(|session| session.os))?; - let host = WindowHost::of(ctx); - if os && host.desktop_pointer().is_some() { host.pointer_in(pass::current_viewport(ctx)) } else { pointer::frame_raw(ctx).pick_pos } + let frame = pass::root_frame_nr(ctx); + let (os, dropped_at) = + board(ctx, |board| board.session.as_ref().map(|session| (session.os, session.dropped_at.filter(|_| session.dropped == Some(frame)))))?; + let own = pointer::frame_raw(ctx).pick_pos; + if os { dropped_at.or_else(|| os_files_pointer(ctx, pass::current_viewport(ctx), own)) } else { own } +} + +/// The pointer of OS files over `viewport`: the system pointer where the platform tells one, since the OS sends the +/// window no pointer events while it drags files over it; else `own`, the pass's own pointer. A drag's noted source +/// pointer (`windows::note_source_pointer`) is from the pass before, for the other windows, so it never stands in for +/// the pass's own. +fn os_files_pointer(ctx: &Context, viewport: ViewportId, own: Option) -> Option { + if windows::system_pointer(ctx).is_some() { WindowHost::of(ctx).pointer_in(viewport) } else { own } } /// The running session's payload whose type is `payload` and the pointer in screen space. For files the OS drags, the @@ -799,8 +832,7 @@ pub(crate) fn ended(ctx: &Context, source: Id) -> Option released + 1); let ended_here = is_source && !held && session.released.is_none(); if expired || (ended_here && !foreign_target) { - board.session = None; + let next = std::mem::take(&mut session.hovering_next); + board.session = (!next.is_empty()).then(|| os_session(next, viewport, frame)); + board.started += u64::from(board.session.is_some()); } else if ended_here { session.released = Some(frame); } From 3b200f43d66b3273f5d42ef55235747ac5e1f789 Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 24 Nov 2026 03:28:05 +0000 Subject: [PATCH 06/65] text: a one-line field pastes each line ending as a space again; the editor's step loop is its own function The merge of next (b138b533fe) dropped one_line from the paste when it took the step loop. Moving the loop out of TextEditor::update keeps the update under clippy's cognitive complexity limit. --- crates/text/src/ui/editor.rs | 139 ++++++++++++++++++++--------------- 1 file changed, 80 insertions(+), 59 deletions(-) diff --git a/crates/text/src/ui/editor.rs b/crates/text/src/ui/editor.rs index 29a7d6b94e..93a9a5ee64 100644 --- a/crates/text/src/ui/editor.rs +++ b/crates/text/src/ui/editor.rs @@ -376,6 +376,11 @@ impl EditorMode { } } +/// `text` on one line: each line ending (`\r\n`, `\r` or `\n`) becomes one space. +fn one_line(text: &str) -> String { + text.replace("\r\n", " ").replace(['\r', '\n'], " ") +} + /// What the editor did this pass. #[derive(Debug)] #[non_exhaustive] @@ -572,6 +577,80 @@ fn show_i_beam(cx: &mut Cx<'_, TextEditor<'_>>, phase: &PressPhase, vertical: bo } } +/// Applies one pass's editor steps to `edits` in order: typing, the marked text, moves, deletes, selections, the edit +/// commands and the commands keys fired. Returns the text a Copy or Cut put on the clipboard, and whether a command +/// asked for the character panel. +fn apply_steps( + edits: &mut Edits<'_>, + steps: Vec>, + mode: EditorMode, + masked: bool, + pasted: Option<&str>, + fallback: Rect, +) -> (Option, bool) { + let mut copied: Option = None; + let mut ending: Option> = None; + let mut character_panel = false; + for step in steps { + // A commit or cancel ends the session; an input method's committed text still lands. + if (edits.done.commit || edits.done.cancel) && ending.is_none() { + break; + } + let input = match step { + EditorStep::Input(input) => input, + EditorStep::Command(command, _) => { + edits.command(command, &mut character_panel); + continue; + } + _ => continue, + }; + if let Some(range) = ending.take() { + if let EditorInput::Text(text) = &input { + edits.commit_marked(range, text); + continue; + } + edits.drop_marked(range); + } + match input { + EditorInput::Preedit { text, cursor, .. } => { + let active = cursor.map(|bytes| byte_range_to_chars(&text, bytes)); + ending = edits.preedit(&text, active); + } + EditorInput::ImeCommit => ending = edits.session.preedit.take(), + EditorInput::Text(text) => edits.done.changed |= edits.insert_typed(&text), + EditorInput::Newline { .. } if edits.session.preedit.is_none() && mode.multiline() => { + edits.done.changed |= edits.insert_text("\n", EditKind::Typed); + } + EditorInput::Tab if mode.takes_tab() => edits.done.changed |= edits.insert_text("\t", EditKind::Typed), + EditorInput::Move(step, mods) => edits.motion(step, mods), + EditorInput::Delete { forward, by, .. } => edits.done.changed |= edits.delete(forward, by), + EditorInput::DeleteSurrounding { before, after, unit, .. } => edits.done.changed |= edits.delete_around(before, after, unit), + EditorInput::Select { anchor, focus, .. } => { + let lines = lines_of(&mut *edits.host, fallback); + edits.end_composition(); + edits.selection = TextSelection { anchor: char_at(&lines, anchor), caret: char_at(&lines, focus) }; + } + EditorInput::Edit(EditCommand::SelectAll) => edits.select_all(), + EditorInput::Edit(EditCommand::Copy) if !masked => copied = edits.selected_text(), + EditorInput::Edit(EditCommand::Cut) if !masked => { + copied = edits.selected_text(); + edits.done.changed |= edits.delete_selection(); + } + EditorInput::Edit(EditCommand::Paste) => { + if let Some(text) = pasted { + let text = if mode.multiline() { text.to_string() } else { one_line(text) }; + edits.done.changed |= edits.insert_text(&text, EditKind::Pasted); + } + } + _ => {} + } + } + if let Some(range) = ending { + edits.drop_marked(range); + } + (copied, character_panel) +} + /// The clipboard's text when the pass's input asks to paste and the clipboard has it ready. fn pasted_text(cx: &mut Cx<'_, TextEditor<'_>>, steps: &[EditorStep]) -> Option> { if !steps.iter().any(|step| matches!(step, EditorStep::Input(EditorInput::Edit(EditCommand::Paste)))) { @@ -636,7 +715,6 @@ impl Component for TextEditor<'_> { let now = cx.now(); let pasted = pasted_text(cx, &steps); let (mode, masked) = (self.mode, self.masked); - let mut copied: Option = None; let mut session = std::mem::take(cx.memory::()); let mut edits = Edits { host: &mut *self.host, @@ -652,64 +730,7 @@ impl Component for TextEditor<'_> { edits.reconcile(); let fallback = space.doc_rect(cx.rect); - let mut ending: Option> = None; - let mut character_panel = false; - for step in steps { - // A commit or cancel ends the session; an input method's committed text still lands. - if (edits.done.commit || edits.done.cancel) && ending.is_none() { - break; - } - let input = match step { - EditorStep::Input(input) => input, - EditorStep::Command(command, _) => { - edits.command(command, &mut character_panel); - continue; - } - _ => continue, - }; - if let Some(range) = ending.take() { - if let EditorInput::Text(text) = &input { - edits.commit_marked(range, text); - continue; - } - edits.drop_marked(range); - } - match input { - EditorInput::Preedit { text, cursor, .. } => { - let active = cursor.map(|bytes| byte_range_to_chars(&text, bytes)); - ending = edits.preedit(&text, active); - } - EditorInput::ImeCommit => ending = edits.session.preedit.take(), - EditorInput::Text(text) => edits.done.changed |= edits.insert_typed(&text), - EditorInput::Newline { .. } if edits.session.preedit.is_none() && mode.multiline() => { - edits.done.changed |= edits.insert_text("\n", EditKind::Typed); - } - EditorInput::Tab if mode.takes_tab() => edits.done.changed |= edits.insert_text("\t", EditKind::Typed), - EditorInput::Move(step, mods) => edits.motion(step, mods), - EditorInput::Delete { forward, by, .. } => edits.done.changed |= edits.delete(forward, by), - EditorInput::DeleteSurrounding { before, after, unit, .. } => edits.done.changed |= edits.delete_around(before, after, unit), - EditorInput::Select { anchor, focus, .. } => { - let lines = lines_of(&mut *edits.host, fallback); - edits.end_composition(); - edits.selection = TextSelection { anchor: char_at(&lines, anchor), caret: char_at(&lines, focus) }; - } - EditorInput::Edit(EditCommand::SelectAll) => edits.select_all(), - EditorInput::Edit(EditCommand::Copy) if !masked => copied = edits.selected_text(), - EditorInput::Edit(EditCommand::Cut) if !masked => { - copied = edits.selected_text(); - edits.done.changed |= edits.delete_selection(); - } - EditorInput::Edit(EditCommand::Paste) => { - if let Some(text) = &pasted { - edits.done.changed |= edits.insert_text(text, EditKind::Pasted); - } - } - _ => {} - } - } - if let Some(range) = ending { - edits.drop_marked(range); - } + let (copied, character_panel) = apply_steps(&mut edits, steps, mode, masked, pasted.as_deref(), fallback); // A press is the pass's last pointer event (H0), so the pass's editor input came before it. match press.phase { PressPhase::Down { start, .. } if start.button == craft_behavior::PointerButton::Primary => { From 8ef406cd5d04a983e6c47a805101ef25e991bfe4 Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 24 Nov 2026 03:28:05 +0000 Subject: [PATCH 07/65] ui-widgets: a tile grid that takes its width from its content asks for at least one card again The merge of next (b138b533fe) brought back the early zero width that ebf9254522 removed, so a measured stack lost the grid's rows and what follows them. The selectable-text trial names its canvas with Id::unique. --- crates/ui-widgets/src/tile_grid/grid.rs | 3 --- crates/ui-widgets/tests/it/text/selectable.rs | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/ui-widgets/src/tile_grid/grid.rs b/crates/ui-widgets/src/tile_grid/grid.rs index 36961bf62e..07d0c57aab 100644 --- a/crates/ui-widgets/src/tile_grid/grid.rs +++ b/crates/ui-widgets/src/tile_grid/grid.rs @@ -1042,9 +1042,6 @@ impl Collection for TileGrid<'_, K /// The last layout again while the width, the rows stamp and everything the arrangement reads are the same. fn ideal_width(&self, item: Option, _rows: usize, cx: &StyleCx<'_>) -> f32 { - if self.card_columns == 0 { - return 0.0; - } let style = GridSizes::of(cx, self.card, self.card_text, self.items.row_height, self.regular_card_padding, self.action_place); let aspect = if self.aspect.is_finite() && self.aspect > 0.0 { self.aspect } else { 1.0 }; let around = style.around.get(self.caption, self.detail_line); diff --git a/crates/ui-widgets/tests/it/text/selectable.rs b/crates/ui-widgets/tests/it/text/selectable.rs index c471d839b0..ecc76542bc 100644 --- a/crates/ui-widgets/tests/it/text/selectable.rs +++ b/crates/ui-widgets/tests/it/text/selectable.rs @@ -153,7 +153,7 @@ fn metadata_value_copies_without_selecting_the_row() { fn tab_toggles_the_panels_from_read_only_text_a_press_or_drag_focused() { let text = Rc::new(Cell::new(Id::NULL)); let seen = text.clone(); - let canvas = Id::new("document canvas"); + let canvas = Id::unique("document canvas"); let mut fixture = Fixture::new(move |ui| { Button::new("Save").show(ui); seen.set(SelectableText::new("Path", "/projects/poster.indd").show(ui).id); From c13c6eeed5d059b870a1498e325be7409bfabe02 Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 24 Nov 2026 03:28:05 +0000 Subject: [PATCH 08/65] docs: regenerate the components index --- docs/components-index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/components-index.md b/docs/components-index.md index 2a3c0638ff..a0bbf32a2a 100644 --- a/docs/components-index.md +++ b/docs/components-index.md @@ -236,7 +236,7 @@ Grouped by gallery level, then shape, then name. | `Watermark` | Pattern | `craft_ui_patterns::patterns::form_dialogs::watermark` | The watermark rows of an export dialog: Style (Text, Graphic), the text field or the image path with Choose…, Orientation, Position as the 3 by 3 reference point, Rotation, Size, Opacity, Inset X and Y, and Shadow | | `WindowMenuRows` | Pattern | `craft_ui_panels::docking::window_menu` | One check row per panel in the order the app gives, for a Window menu | | `WorkspaceSwitcher` | Pattern | `craft_ui_patterns::patterns::dock::switcher` | The switcher at the end of an options bar: a small select showing the current workspace's name | -| `ZoomField` | Pattern | `craft_ui_widgets::text::zoom_field` | A zoom field: a `NumberField` over the view's zoom in percent on its [`ZoomScale`] (device pixels unless set), with the zoom codec and the zoom ladder's range | +| `ZoomField` | Pattern | `craft_ui_widgets::text::zoom_field` | A zoom field: a `NumberField` over the view's zoom in percent on its [`ZoomScale`] (device pixels unless set), with the zoom codec and the zoom scheme's range | | `RecoveryDialog` | Dialog | `craft_ui_panels::dialog::recovery` | Recover Unsaved Work, one document at a time: a prompt saying when the document was autosaved, with Discard and Recover (the accepting answer) | ### Shells @@ -273,7 +273,7 @@ Grouped by gallery level, then shape, then name. | `craft_behavior::eviction` | When a component's remembered state is due for eviction | | `craft_behavior::fit` | The fit rules: which tabs, bar items or titles stay in a strip and which go to an overflow menu | | `craft_behavior::flow` | `Insets`, `Flow` and `Axis`: start and end geometry resolved once for the layout direction | -| `craft_behavior::focus` | Pure focus rules (spec 9.3, 9.4, 8.3): key ownership, focus after removal, the Escape order and the focus-on-press kinds | +| `craft_behavior::focus` | Pure focus rules (spec 9.3, 9.4, 8.3): key ownership, the Escape order and the focus-on-press kinds | | `craft_behavior::frame_step` | The step of one pass of motion: a Hand glide, a held Zoom press and an autoscroll integrate over it | | `craft_behavior::grid` | The `Grid` cursor: columns resolved from last pass's measurements, and the cell each child takes | | `craft_behavior::hit` | Hit shapes, their priority and the arena's resolve rule (8.3) | From 9750fe6d77d16a8b014a37a4755767cdfddc50e2 Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 24 Nov 2026 03:41:37 +0000 Subject: [PATCH 09/65] i18n: the region test module builds only where its one test runs --- crates/i18n/src/region.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/i18n/src/region.rs b/crates/i18n/src/region.rs index f34cac5066..9f15599130 100644 --- a/crates/i18n/src/region.rs +++ b/crates/i18n/src/region.rs @@ -389,11 +389,10 @@ fn read_system() -> Region { Region::from_tag(&sys_locale::get_locale().unwrap_or_default()) } -#[cfg(test)] +#[cfg(all(test, unix, not(any(target_vendor = "apple", target_os = "android"))))] mod tests { use super::*; - #[cfg(all(unix, not(any(target_vendor = "apple", target_os = "android"))))] #[test] fn each_locale_category_decides_its_own_part_and_lc_all_all_of_them() { let env = From eaeb0fa0283a24b0fcdad77ea3705b150db37b8e Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 24 Nov 2026 04:02:17 +0000 Subject: [PATCH 10/65] platform: owner_only's docs name its Windows-only functions as code, not links From storytold/craft-libs#3236, so this PR's Workspace docs check can pass. Co-authored-by: skylartaylor --- crates/platform/src/owner_only.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/platform/src/owner_only.rs b/crates/platform/src/owner_only.rs index 506907e031..e664dcffe4 100644 --- a/crates/platform/src/owner_only.rs +++ b/crates/platform/src/owner_only.rs @@ -2,23 +2,23 @@ //! //! On Windows a file created in a folder inherits the folder's access list, and folders such as //! a new folder at a drive root, `C:\Users\Public` or `C:\ProgramData` let every signed-in user -//! read what is created in them. [`restrict_to_owner`] replaces the whole list with the current -//! user and SYSTEM only, makes that user the owner, and checks the result. [`create_private_dir`] +//! read what is created in them. `restrict_to_owner` replaces the whole list with the current +//! user and SYSTEM only, makes that user the owner, and checks the result. `create_private_dir` //! does the same for a new folder whose list the files created in it inherit, so a file can be -//! private from the moment it exists. [`read_with_sddl`] reads a file and its security descriptor +//! private from the moment it exists. `read_with_sddl` reads a file and its security descriptor //! through one handle. [`foreign_access`] reads the descriptor in SDDL form, which names accounts //! by SID and so reads the same in every Windows language, and says why another user could have //! written or could read the file. They run the tools Windows ships rather than calling the //! security API directly, which would need `unsafe`. /// Why the file whose security descriptor is `sddl` (`O:` owner and `D:` access list, in SDDL or -/// as [`read_with_sddl`] writes it) can't be trusted as user `me`'s own: it is owned by someone else, it has no +/// as `read_with_sddl` writes it) can't be trusted as user `me`'s own: it is owned by someone else, it has no /// access list (everyone may use it), or it lets an account other than `me` or SYSTEM use it. /// Accounts are compared by SID; `None` means it is `me`'s alone. /// /// Stricter than OpenSSH's rule for private keys, which also lets Administrators in: an entry for /// the Administrators group would let another administrator read the token without taking the -/// file over. [`restrict_to_owner`] never grants it, so the app's own file always passes; a file +/// file over. `restrict_to_owner` never grants it, so the app's own file always passes; a file /// that inherited it from a user's folder is refused. pub fn foreign_access(sddl: &str, me: &str) -> Option { let me = me.trim(); From 52503acd71e159867795275d7214df6b64e24239 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Tue, 24 Nov 2026 00:23:15 +0100 Subject: [PATCH 11/65] Fix the macOS test failures next picked up from the PdfCraft framework sync (#3232) - atomic: a file the user may write but not read (mode 0200) saves again on macOS; its extended attributes can't be read, so there are none to keep. - menu, ui-shell, pages, ui-contract, ui-canvas tests: follow the macOS conventions the code already has. The in-window bar test pins its target as the other bar tests do; macOS has no Menu key and no Cmd+Home/End move; its platform copy key is Option; a press with Control there is a secondary click, so Control comes after the press. --- crates/atomic/src/lib.rs | 7 ++++--- crates/menu/tests/it/bar.rs | 3 +++ crates/pages/tests/it/views.rs | 11 +++++------ crates/ui-canvas/tests/it/canvas/crop.rs | 9 ++++++++- crates/ui-contract/tests/it/collection/drops.rs | 6 ++++-- crates/ui-shell/tests/it/shell/start.rs | 8 +++++--- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/crates/atomic/src/lib.rs b/crates/atomic/src/lib.rs index 2fa589d099..c417eec672 100644 --- a/crates/atomic/src/lib.rs +++ b/crates/atomic/src/lib.rs @@ -548,8 +548,9 @@ const MAX_XATTR_TOTAL_BYTES: usize = 64 * 1024 * 1024; /// binding, quarantine, resource forks) to the stage. The attributes are as untrusted as the /// bytes, so the reads are bounded; one that cannot be read or written whole, or passes a bound, /// refuses the save rather than dropping the user's metadata unnoticed. Only a volume without -/// extended attributes (`ENOTSUP`) is skipped. `com.apple.provenance` belongs to macOS, which -/// gives the new file its own. Compression bookkeeping stays hidden (no `XATTR_SHOWCOMPRESSION`). +/// extended attributes (`ENOTSUP`) and a file the user may write but not read (mode 0200, whose +/// attributes the user can't read either) are skipped; those save as they did before attributes +/// were kept. `com.apple.provenance` belongs to macOS, which gives the new file its own. Compression bookkeeping stays hidden (no `XATTR_SHOWCOMPRESSION`). #[cfg(target_os = "macos")] fn copy_xattrs(target: &Path, stage: &File) -> io::Result<()> { use rustix::fs::{Mode, OFlags, XattrFlags, fgetxattr, fgetxattr_query, flistxattr, fsetxattr, open}; @@ -559,7 +560,7 @@ fn copy_xattrs(target: &Path, stage: &File) -> io::Result<()> { // names another file. NONBLOCK keeps a FIFO put at the name from hanging the open. let source = match open(target, OFlags::RDONLY | OFlags::CLOEXEC | OFlags::NOFOLLOW | OFlags::NONBLOCK, Mode::empty()) { Ok(fd) => File::from(fd), - Err(Errno::NOENT | Errno::LOOP) => return Ok(()), + Err(Errno::NOENT | Errno::LOOP | Errno::ACCESS) => return Ok(()), Err(e) => return Err(e.into()), }; if !source.metadata()?.is_file() { diff --git a/crates/menu/tests/it/bar.rs b/crates/menu/tests/it/bar.rs index 071ae4684a..efe960a134 100644 --- a/crates/menu/tests/it/bar.rs +++ b/crates/menu/tests/it/bar.rs @@ -1,5 +1,6 @@ //! The in-window bar's own rules over the model. +use craft_host::target::Os; use craft_menu::{Item, Menu, MenuBar, MenuBarUi, Node}; use craft_ui::contract::Tracked; use craft_ui::testing::{Fixture, trial}; @@ -18,6 +19,8 @@ fn a_disabled_submenu_is_greyed_and_does_not_open() { let mut fixture = Fixture::new(move |ui| { MenuBarUi::new(&bar).show(ui); }); + // The in-window bar's rules; a Mac's menus are in the system bar. + fixture.os(Os::Linux); fixture.settle(); let Some(file) = fixture.by_label("File") else { panic!("the bar shows File") }; fixture.click(&file).settle(); diff --git a/crates/pages/tests/it/views.rs b/crates/pages/tests/it/views.rs index e4e60c79ac..e0aa1babf9 100644 --- a/crates/pages/tests/it/views.rs +++ b/crates/pages/tests/it/views.rs @@ -1007,12 +1007,11 @@ fn shift_and_command_with_the_page_keys_and_arrows_go_to_the_ends() { ); focus_canvas(&mut fixture); let keys = [(Key::PageDown, both, 4), (Key::PageUp, both, 0), (Key::ArrowDown, both, 4), (Key::ArrowUp, both, 0)]; - let ends = [ - (Key::End, Modifiers::SHIFT, 4), - (Key::Home, Modifiers::SHIFT, 0), - (Key::End, Modifiers::COMMAND, 4), - (Key::Home, Modifiers::COMMAND, 0), - ]; + // Off macOS Ctrl+End and Ctrl+Home go to the ends too; macOS gives Cmd with Home and End no move. + let mut ends = vec![(Key::End, Modifiers::SHIFT, 4), (Key::Home, Modifiers::SHIFT, 0)]; + if !cfg!(target_os = "macos") { + ends.extend([(Key::End, Modifiers::COMMAND, 4), (Key::Home, Modifiers::COMMAND, 0)]); + } for (key, mods, want) in keys.into_iter().chain(ends) { fixture.key(key, mods); fixture.idle(2); diff --git a/crates/ui-canvas/tests/it/canvas/crop.rs b/crates/ui-canvas/tests/it/canvas/crop.rs index d2b6a8b731..69b91085d6 100644 --- a/crates/ui-canvas/tests/it/canvas/crop.rs +++ b/crates/ui-canvas/tests/it/canvas/crop.rs @@ -451,6 +451,7 @@ fn a_quick_drag_in_one_frame_starts_at_the_press() { assert_eq!((events.first(), events.last()), (Some(&"begin"), Some(&"commit")), "{events:?}"); } +/// Control is pressed once the resize has started: on macOS a press with Control held is a secondary click. #[trial] fn the_control_key_held_during_a_resize_turns_snapping_off() { for (held, right) in [(Modifiers::NONE, 310.0), (Modifiers::CTRL, 307.0)] { @@ -459,7 +460,13 @@ fn the_control_key_held_during_a_resize_turns_snapping_off() { s.snap_x = Some(310.0); s }); - rig.drag(rig.at(300.0, 220.0), rig.at(307.0, 220.0), held); + let (from, to) = (rig.at(300.0, 220.0), rig.at(307.0, 220.0)); + rig.press(from); + rig.frames.hold(held); + rig.move_to(from.lerp(to, 0.5)); + rig.move_to(to); + rig.release(to); + rig.frames.hold(Modifiers::NONE); assert!((rig.rect().x1 - right).abs() < 1e-6, "{held:?}: {:?}", rig.rect()); } } diff --git a/crates/ui-contract/tests/it/collection/drops.rs b/crates/ui-contract/tests/it/collection/drops.rs index 331ba96bf4..ec8c2179b6 100644 --- a/crates/ui-contract/tests/it/collection/drops.rs +++ b/crates/ui-contract/tests/it/collection/drops.rs @@ -137,13 +137,15 @@ fn rows_from_another_list_drop_into_a_gap_only_where_a_kind_takes_them() { } /// A list's copy keys decide which held key makes its own row drag a copy, and the pointer over it shows the copy -/// while they are held: off macOS Ctrl for the platform's keys, Alt for Alt; the other key moves. +/// while they are held: the platform's keys copy with Ctrl off macOS and Option on it, Alt copies with Alt; the other +/// key moves. #[trial] fn a_lists_copy_keys_pick_the_key_that_copies_its_rows() { use craft_behavior::{CopyKeys, Cursor, CursorIcon}; use egui::Modifiers; let ctrl = Modifiers::CTRL | Modifiers::COMMAND; - for (keys, copies, moves) in [(CopyKeys::Platform, ctrl, Modifiers::ALT), (CopyKeys::Alt, Modifiers::ALT, ctrl)] { + let platform = if cfg!(target_os = "macos") { (Modifiers::ALT, ctrl) } else { (ctrl, Modifiers::ALT) }; + for (keys, copies, moves) in [(CopyKeys::Platform, platform.0, platform.1), (CopyKeys::Alt, Modifiers::ALT, ctrl)] { for (held, copy) in [(copies, true), (moves, false)] { let words = Words::flat(&["a", "b", "c", "d"]); let run = Run::default(); diff --git a/crates/ui-shell/tests/it/shell/start.rs b/crates/ui-shell/tests/it/shell/start.rs index c53a8cb9a7..32b596852c 100644 --- a/crates/ui-shell/tests/it/shell/start.rs +++ b/crates/ui-shell/tests/it/shell/start.rs @@ -196,8 +196,8 @@ fn a_recent_row_names_its_full_path_and_reveals_remove_on_hover_or_focus() { assert!(log.borrow().contains(&StartAction::ClearRecent), "Clear reports ClearRecent: {:?}", log.borrow()); } -/// A recent file's menu offers Show in Folder exactly where the platform can reveal a file, and the menu key and -/// Shift+F10 open it from the focused card. The menu is told by "Clear Recent Files", which only the menu has: the +/// A recent file's menu offers Show in Folder exactly where the platform can reveal a file, and the menu key (off +/// macOS, which has none) and Shift+F10 open it from the focused card. The menu is told by "Clear Recent Files", which only the menu has: the /// card's hover action carries "Remove from Recent" too. #[trial] fn the_recent_menu_offers_show_in_folder_where_the_platform_can_reveal() { @@ -213,7 +213,9 @@ fn the_recent_menu_offers_show_in_folder_where_the_platform_can_reveal() { assert!(fixture.by_label(MENU_ONLY).is_some(), "a right click on a recent file opens its menu"); assert_eq!(fixture.by_label("Show in Folder").is_some(), craft_platform::open::CAN_REVEAL); - for (key, modifiers) in [(Key::Menu, Modifiers::NONE), (Key::F10, Modifiers::SHIFT)] { + let keys: &[(Key, Modifiers)] = + if cfg!(target_os = "macos") { &[(Key::F10, Modifiers::SHIFT)] } else { &[(Key::Menu, Modifiers::NONE), (Key::F10, Modifiers::SHIFT)] }; + for &(key, modifiers) in keys { fixture.key(Key::Escape, Modifiers::NONE).idle(3); assert!(fixture.by_label(MENU_ONLY).is_none(), "Escape closes the menu before {key:?}"); let card = fixture.by_label("Poster.psd").expect("the card shows"); From f29372d28066eb09c0184616a8e39941d6780b69 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Tue, 24 Nov 2026 00:58:10 +0100 Subject: [PATCH 12/65] atomic: an unreadable file saves only when it has no attributes to lose (review) When the old file can't be opened for reading, its attribute names are listed by path: none (or only com.apple.provenance) lets the save go on; any other refuses it, since they can't be copied without the file. --- crates/atomic/src/lib.rs | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/crates/atomic/src/lib.rs b/crates/atomic/src/lib.rs index c417eec672..da11bf153f 100644 --- a/crates/atomic/src/lib.rs +++ b/crates/atomic/src/lib.rs @@ -548,9 +548,11 @@ const MAX_XATTR_TOTAL_BYTES: usize = 64 * 1024 * 1024; /// binding, quarantine, resource forks) to the stage. The attributes are as untrusted as the /// bytes, so the reads are bounded; one that cannot be read or written whole, or passes a bound, /// refuses the save rather than dropping the user's metadata unnoticed. Only a volume without -/// extended attributes (`ENOTSUP`) and a file the user may write but not read (mode 0200, whose -/// attributes the user can't read either) are skipped; those save as they did before attributes -/// were kept. `com.apple.provenance` belongs to macOS, which gives the new file its own. Compression bookkeeping stays hidden (no `XATTR_SHOWCOMPRESSION`). +/// extended attributes (`ENOTSUP`) is skipped, and so is a file whose data the user may not read +/// (mode 0200) when it has no attribute names the user can list either; one whose names can be +/// listed refuses the save, as its attributes can't be copied without its data. +/// `com.apple.provenance` belongs to macOS, which gives the new file its own. Compression +/// bookkeeping stays hidden (no `XATTR_SHOWCOMPRESSION`). #[cfg(target_os = "macos")] fn copy_xattrs(target: &Path, stage: &File) -> io::Result<()> { use rustix::fs::{Mode, OFlags, XattrFlags, fgetxattr, fgetxattr_query, flistxattr, fsetxattr, open}; @@ -560,7 +562,8 @@ fn copy_xattrs(target: &Path, stage: &File) -> io::Result<()> { // names another file. NONBLOCK keeps a FIFO put at the name from hanging the open. let source = match open(target, OFlags::RDONLY | OFlags::CLOEXEC | OFlags::NOFOLLOW | OFlags::NONBLOCK, Mode::empty()) { Ok(fd) => File::from(fd), - Err(Errno::NOENT | Errno::LOOP | Errno::ACCESS) => return Ok(()), + Err(Errno::NOENT | Errno::LOOP) => return Ok(()), + Err(Errno::ACCESS) => return unreadable_has_no_attributes(target), Err(e) => return Err(e.into()), }; if !source.metadata()?.is_file() { @@ -596,6 +599,27 @@ fn copy_xattrs(target: &Path, stage: &File) -> io::Result<()> { Ok(()) } +/// For a target whose data can't be opened for reading: `Ok` when it has no extended attribute the +/// user can list (or the volume has none), so the save loses nothing; otherwise refuse the save, as +/// the attributes can't be copied without opening the file. The names are read without following a +/// link, by path. +#[cfg(target_os = "macos")] +fn unreadable_has_no_attributes(target: &Path) -> io::Result<()> { + use rustix::fs::llistxattr; + use rustix::io::Errno; + let mut names = vec![0u8; MAX_XATTR_NAMES_BYTES]; + match llistxattr(target, names.as_mut_slice()) { + Ok(0) | Err(Errno::NOTSUP | Errno::ACCESS | Errno::NOENT) => Ok(()), + Ok(len) if names.get(..len).is_some_and(|names| names.split(|b| *b == 0).all(|name| name.is_empty() || name == b"com.apple.provenance")) => { + Ok(()) + } + Ok(_) | Err(Errno::RANGE) => { + Err(io::Error::new(io::ErrorKind::PermissionDenied, "the file can't be read, so its extended attributes can't be copied")) + } + Err(e) => Err(e.into()), + } +} + /// Read one attribute value of `size` bytes (already within the bounds) with `read`, then ask /// its size again with `query_size`. A read that does not fill `size`, or a size that changed, /// is refused: a growing resource fork returns the prefix that fits instead of an error. From 1d281f38c1e1e9c6b58cd6e401689db0760ef6a2 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Tue, 24 Nov 2026 01:48:07 +0100 Subject: [PATCH 13/65] atomic: a write-only file's unreadable attributes are dropped, as documented and tested (review) On macOS a mode-0200 file's owner can list none of its attribute names either, so they are dropped, as before attributes were kept. An ACL that denies the data but lets the names be listed still refuses the save. Both are now tested on macOS. Also: the pages key doc gives the macOS exception for Cmd+Home/End. --- crates/atomic/src/lib.rs | 15 +++++----- crates/atomic/tests/atomic_tests.rs | 46 +++++++++++++++++++++++++++++ crates/pages/src/ui/view.rs | 3 +- 3 files changed, 56 insertions(+), 8 deletions(-) diff --git a/crates/atomic/src/lib.rs b/crates/atomic/src/lib.rs index da11bf153f..5aa3c75cd4 100644 --- a/crates/atomic/src/lib.rs +++ b/crates/atomic/src/lib.rs @@ -548,9 +548,10 @@ const MAX_XATTR_TOTAL_BYTES: usize = 64 * 1024 * 1024; /// binding, quarantine, resource forks) to the stage. The attributes are as untrusted as the /// bytes, so the reads are bounded; one that cannot be read or written whole, or passes a bound, /// refuses the save rather than dropping the user's metadata unnoticed. Only a volume without -/// extended attributes (`ENOTSUP`) is skipped, and so is a file whose data the user may not read -/// (mode 0200) when it has no attribute names the user can list either; one whose names can be -/// listed refuses the save, as its attributes can't be copied without its data. +/// extended attributes (`ENOTSUP`) is skipped. So is a file whose data the user may not read when +/// its attribute names can't be listed either, as with mode 0200: its attributes are dropped, as +/// before attributes were kept, since the user can't read them (or its bytes) at all. One whose +/// data is denied but whose names can be listed (an ACL that denies reading) refuses the save. /// `com.apple.provenance` belongs to macOS, which gives the new file its own. Compression /// bookkeeping stays hidden (no `XATTR_SHOWCOMPRESSION`). #[cfg(target_os = "macos")] @@ -599,10 +600,10 @@ fn copy_xattrs(target: &Path, stage: &File) -> io::Result<()> { Ok(()) } -/// For a target whose data can't be opened for reading: `Ok` when it has no extended attribute the -/// user can list (or the volume has none), so the save loses nothing; otherwise refuse the save, as -/// the attributes can't be copied without opening the file. The names are read without following a -/// link, by path. +/// For a target whose data can't be opened for reading: `Ok` when the user can list no extended +/// attribute names on it (none, only `com.apple.provenance`, none supported, or listing is denied too, +/// as for mode 0200, whose attributes are then dropped); otherwise refuse the save, as the attributes +/// can't be copied without opening the file. The names are read without following a link, by path. #[cfg(target_os = "macos")] fn unreadable_has_no_attributes(target: &Path) -> io::Result<()> { use rustix::fs::llistxattr; diff --git a/crates/atomic/tests/atomic_tests.rs b/crates/atomic/tests/atomic_tests.rs index b1da9be0a2..fcafd2ca78 100644 --- a/crates/atomic/tests/atomic_tests.rs +++ b/crates/atomic/tests/atomic_tests.rs @@ -99,3 +99,49 @@ fn private_staging_preserves_existing_modes_after_callback() -> io::Result<()> { assert_no_temp(&d.0); Ok(()) } + +/// Extended attribute names on `path`, read by path. +#[cfg(target_os = "macos")] +fn xattr_names(path: &Path) -> Vec> { + let mut names = vec![0u8; 64 * 1024]; + let len = rustix::fs::listxattr(path, names.as_mut_slice()).unwrap_or(0); + names.truncate(len); + names.split(|b| *b == 0).filter(|n| !n.is_empty()).map(<[u8]>::to_vec).collect() +} + +/// A write-only file (mode 0200) saves: macOS lets its owner neither read its data nor list its +/// attributes, so its attributes are dropped, as before attributes were kept. +#[cfg(target_os = "macos")] +#[test] +fn a_write_only_file_saves_and_drops_the_attributes_it_cannot_read() -> io::Result<()> { + use std::os::unix::fs::PermissionsExt; + let d = TempDir::new("write_only_xattrs"); + let p = d.0.join("doc.craft"); + std::fs::write(&p, ORIGINAL)?; + rustix::fs::setxattr(&p, "com.craft.t", b"tag", rustix::fs::XattrFlags::empty())?; + std::fs::set_permissions(&p, std::fs::Permissions::from_mode(0o200))?; + atomic_write(&p, b"new")?; + std::fs::set_permissions(&p, std::fs::Permissions::from_mode(0o600))?; + assert_eq!(std::fs::read(&p)?, b"new"); + assert!(!xattr_names(&p).iter().any(|n| n == b"com.craft.t"), "the unreadable attribute is dropped"); + Ok(()) +} + +/// A file whose data an ACL denies but whose attribute names can be listed is not replaced: its +/// attributes can't be copied without its data, and the save refuses rather than drop them. +#[cfg(target_os = "macos")] +#[test] +fn an_unreadable_file_with_listable_attributes_is_not_replaced() -> io::Result<()> { + let d = TempDir::new("acl_denied_xattrs"); + let p = d.0.join("doc.craft"); + std::fs::write(&p, ORIGINAL)?; + rustix::fs::setxattr(&p, "com.craft.t", b"tag", rustix::fs::XattrFlags::empty())?; + let denied = std::process::Command::new("/bin/chmod").arg("+a").arg("everyone deny read").arg(&p).status()?; + assert!(denied.success(), "the ACL is set"); + let result = atomic_write(&p, b"new"); + let _ = std::process::Command::new("/bin/chmod").arg("-N").arg(&p).status(); + assert!(result.is_err(), "the save is refused"); + assert_eq!(std::fs::read(&p)?, ORIGINAL, "the original is unchanged"); + assert!(xattr_names(&p).iter().any(|n| n == b"com.craft.t"), "and keeps its attribute"); + Ok(()) +} diff --git a/crates/pages/src/ui/view.rs b/crates/pages/src/ui/view.rs index 2fc10109bd..0b08850bbd 100644 --- a/crates/pages/src/ui/view.rs +++ b/crates/pages/src/ui/view.rs @@ -1544,7 +1544,8 @@ impl KeyMoves { /// Page Up and Down a screen less a key line (a row when not continuous, and with Cmd), Home and End the first /// and last page, Up and Down a key line (not continuous, a turn once the row is at its edge that way), Left and /// Right a key line sideways while the current page or spread has more to show that way, else a turn of a page or - /// spread; Cmd with Left or Right turns at once. Home and End with Shift or Cmd, and Page Up, Page Down, Up and + /// spread; Cmd with Left or Right turns at once. Home and End with Shift, or with Cmd off macOS (which gives Cmd + /// with them no move), and Page Up, Page Down, Up and /// Down with Shift and Cmd together, go to the first or last page; Alt, and Shift alone with the other keys, /// leave them to nothing. fn of( From 48d19d281053524a4c794f69db88688d770ddbf4 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 24 Nov 2026 12:08:24 +0700 Subject: [PATCH 14/65] 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 c71c3025ce1147ef6446204a73368be756011bf4 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 24 Nov 2026 12:18:40 +0700 Subject: [PATCH 15/65] sections: HeaderStrength::Subheading, label text in the normal ink with no rule --- crates/ui-panels/src/sections/section.rs | 7 ++++--- crates/ui-panels/src/sections/section/stories.rs | 6 ++++++ crates/ui-panels/src/sections/title_row.rs | 4 ++++ crates/ui-panels/src/sections/title_row/stories.rs | 5 +++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/crates/ui-panels/src/sections/section.rs b/crates/ui-panels/src/sections/section.rs index c7b089b290..0ac5448954 100644 --- a/crates/ui-panels/src/sections/section.rs +++ b/crates/ui-panels/src/sections/section.rs @@ -158,12 +158,13 @@ impl<'a> Section<'a> { self.props.header = Some(header); } - /// The header's weight: `Section` by default, under a rule; `Caption` for a quiet heading over a group of - /// controls, with no rule. + /// The header's weight: `Section` by default, under a rule; `Caption`, `Subheading` or `Overline` for a heading over + /// a group of controls, with no rule. #[must_use] pub fn strength(mut self, strength: HeaderStrength) -> Self { self.strength = strength; - self.update_header(|header| header.rule_above(!matches!(strength, HeaderStrength::Caption | HeaderStrength::Overline))); + let quiet = matches!(strength, HeaderStrength::Caption | HeaderStrength::Subheading | HeaderStrength::Overline); + self.update_header(|header| header.rule_above(!quiet)); self } diff --git a/crates/ui-panels/src/sections/section/stories.rs b/crates/ui-panels/src/sections/section/stories.rs index 4af0a20918..1425532bc0 100644 --- a/crates/ui-panels/src/sections/section/stories.rs +++ b/crates/ui-panels/src/sections/section/stories.rs @@ -39,6 +39,12 @@ fn section_caption(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { shown.output.into() } +#[story(Section<'static>, covers = [], drive = Drive::Never)] +fn section_subheading(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { + let shown = Section::fixed("Shape modes").strength(HeaderStrength::Subheading).show(ui, |ui, _| body(ui)); + shown.output.into() +} + #[story(Section<'static>, covers = [], drive = Drive::Never)] fn section_with_menu_and_reorder(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let shown = Section::new("Layers").open(data.bind("open", true)).actions([HeaderAction::Menu]).reorder(true).show(ui, |ui, _| body(ui)); diff --git a/crates/ui-panels/src/sections/title_row.rs b/crates/ui-panels/src/sections/title_row.rs index 953b466ab6..a562ae85d0 100644 --- a/crates/ui-panels/src/sections/title_row.rs +++ b/crates/ui-panels/src/sections/title_row.rs @@ -37,6 +37,9 @@ pub enum HeaderStrength { Heading, /// A quiet heading over a group of controls: label text, faint, as written, with no rule. Caption, + /// A sub-heading inside a section, over a group of its controls: label text in the normal ink, as written, with no + /// rule. + Subheading, /// A window's drag bar: one text row high (`size.row.text`), with label text; its action parts shrink to the row. Bar, /// A small overline over a group of controls: the caption role, faint, in capitals, with no rule. A document @@ -349,6 +352,7 @@ impl Component for TitleRow<'_> { HeaderStrength::Section => (cx.tokens.size.panel_header, TypeRole::BodyStrong, text.normal), HeaderStrength::Heading => (cx.tokens.size.panel_header, TypeRole::Heading, text.normal), HeaderStrength::Caption => (cx.control().height, TypeRole::Label, text.faint), + HeaderStrength::Subheading => (cx.control().height, TypeRole::Label, text.normal), HeaderStrength::Bar => (cx.tokens.size.row.text, TypeRole::Label, text.normal), HeaderStrength::Overline => (cx.control().height, TypeRole::Caption, text.faint), }; diff --git a/crates/ui-panels/src/sections/title_row/stories.rs b/crates/ui-panels/src/sections/title_row/stories.rs index 75ec6c8485..43763072f3 100644 --- a/crates/ui-panels/src/sections/title_row/stories.rs +++ b/crates/ui-panels/src/sections/title_row/stories.rs @@ -62,6 +62,11 @@ fn title_row_caption(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { TitleRow::new("Preset details").strength(HeaderStrength::Caption).show(ui).edit.into() } +#[story(TitleRow<'static>, covers = [], drive = Drive::Never)] +fn title_row_subheading(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { + TitleRow::new("Ellipse Properties:").strength(HeaderStrength::Subheading).show(ui).edit.into() +} + #[story(TitleRow<'static>, covers = [], drive = Drive::Never)] fn title_row_bar(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { // A floating window's drag bar: no title, the Close action at the end. From 47691f10c2e4343dac13bf65e66192018d8d0581 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 24 Nov 2026 12:18:43 +0700 Subject: [PATCH 16/65] Inspector: title_strength gives the title another weight than a section heading's --- .../src/patterns/panels/inspector.rs | 28 ++++++++++++++++--- .../src/patterns/panels/inspector/stories.rs | 15 +++++++++- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/crates/ui-patterns/src/patterns/panels/inspector.rs b/crates/ui-patterns/src/patterns/panels/inspector.rs index d4ede93269..3e80f5951f 100644 --- a/crates/ui-patterns/src/patterns/panels/inspector.rs +++ b/crates/ui-patterns/src/patterns/panels/inspector.rs @@ -22,6 +22,9 @@ pub(crate) mod stories; /// - No target: the body is replaced by a centred notice, `empty` or "No properties", and the header shows the label. /// - The body can hold a `SectionStack` for sections the user reorders. /// - Padding: none of its own. An inspector is a dock body, docked or floating, and the dock group insets it. +/// - Title weight: a section heading's by default, as the headings of the sections under it; +/// [`title_strength`](Inspector::title_strength) gives another, such as `Caption` for a quiet kind line over the +/// sections. #[derive(crate::contract::Pattern)] pub struct Inspector<'a> { label: Label, @@ -30,6 +33,7 @@ pub struct Inspector<'a> { name: Option