diff --git a/crates/behavior/src/editor.rs b/crates/behavior/src/editor.rs index 135055200..c05714195 100644 --- a/crates/behavior/src/editor.rs +++ b/crates/behavior/src/editor.rs @@ -6,6 +6,7 @@ use std::sync::Arc; /// What an input method counts the text around the caret in. #[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[non_exhaustive] pub enum SurroundingUnit { /// Characters. Chars, diff --git a/crates/design-lint/src/workspace.rs b/crates/design-lint/src/workspace.rs index 8ef4a727b..eded9fe6a 100644 --- a/crates/design-lint/src/workspace.rs +++ b/crates/design-lint/src/workspace.rs @@ -64,6 +64,7 @@ const CLOSED: &[&str] = &[ "SurfaceStyle", // built or matched in craft-ui-widgets "Target", // built or matched in craft-ui-canvas "TextOptions", // built or matched in craft-ui-widgets + "TransformReach", // `MoveOnly { points }` is built in PhotoCraft's type tool "ToastEnd", // built or matched in craft-ui-widgets "TrackLook", // built or matched in craft-ui-widgets "VariantParts", // built or matched in craft-ui-widgets diff --git a/crates/ui-contract/src/runtime/focus/nav.rs b/crates/ui-contract/src/runtime/focus/nav.rs index 86149b496..424e8de66 100644 --- a/crates/ui-contract/src/runtime/focus/nav.rs +++ b/crates/ui-contract/src/runtime/focus/nav.rs @@ -165,7 +165,7 @@ impl State { /// is recorded under that root. pub(super) fn focus_stop(&mut self, rec: StopRec) -> Vec { let key = rec.stop.key(); - let acts = self.move_focus(rec, FocusOrigin::Request); + let acts = self.enter_stop(rec, FocusOrigin::Request); self.revealed = Some(key); acts } @@ -173,10 +173,10 @@ impl State { /// Moves focus to `rec` without a reveal: a press focuses a stop under the pointer, which is on screen already, /// and scrolling it in would move the content under the held press. pub(super) fn focus_stop_in_place(&mut self, rec: StopRec) -> Vec { - self.move_focus(rec, FocusOrigin::Press) + self.enter_stop(rec, FocusOrigin::Press) } - fn move_focus(&mut self, rec: StopRec, origin: FocusOrigin) -> Vec { + fn enter_stop(&mut self, rec: StopRec, origin: FocusOrigin) -> Vec { self.note_entry(&rec); let stop = &rec.stop; let roving = stop.group.is_some(); diff --git a/crates/ui-patterns/src/patterns/form_dialogs/guides/trials.rs b/crates/ui-patterns/src/patterns/form_dialogs/guides/trials.rs index c8bc7726f..dff317f48 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/guides/trials.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/guides/trials.rs @@ -161,11 +161,12 @@ fn position_text_that_does_not_parse_keeps_ok_from_making_a_guide() { let position = fixture.by_label("Position").expect("the Position field"); fixture.click(&position).settle(); fixture.key(egui::Key::A, egui::Modifiers::COMMAND); - fixture.type_text("40").settle(); + let typed = 40.0; + fixture.type_text(&typed.to_string()).settle(); assert!(enabled.get(), "a number enables OK again"); let ok = fixture.by_label("OK").expect("the footer has OK"); fixture.click(&ok).settle(); assert!(!open.get(), "OK closes the dialog"); let confirmed: Vec<_> = made.borrow().iter().map(|guide| guide.position).collect(); - assert_eq!(confirmed, [40.0]); + assert_eq!(confirmed, [typed], "OK makes the guide at the typed position"); } diff --git a/crates/ui-patterns/src/patterns/form_dialogs/sizing/canvas.rs b/crates/ui-patterns/src/patterns/form_dialogs/sizing/canvas.rs index b7406edb6..34046628d 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/sizing/canvas.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/sizing/canvas.rs @@ -164,7 +164,8 @@ pub struct CanvasSize<'a> { /// The bytes one pixel takes, for the file size readouts. #[prop(quantity = "bytes per pixel")] bytes_per_pixel: f64, - /// The held OK of a hosted dialog. + /// The held OK of a hosted dialog ([`Hold`]). + #[prop(name = "hold_ok", vis = "pub(crate)")] hold: Hold, } @@ -174,12 +175,6 @@ impl<'a> CanvasSize<'a> { CanvasSize { values, open: None, bytes_per_pixel: 4.0, hold: Hold::default() } } - /// Holds the OK of a hosted dialog ([`Hold`]). - fn hold_ok(mut self, hold: Hold) -> Self { - self.hold = hold; - self - } - /// Shows the dialog. pub fn show(self, ui: &mut Ui) -> CanvasSizeOutput { let CanvasSize { values, open, bytes_per_pixel, hold } = self; diff --git a/crates/ui-patterns/src/patterns/form_dialogs/sizing/image.rs b/crates/ui-patterns/src/patterns/form_dialogs/sizing/image.rs index fc6d5b0bf..7c0f0c334 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/sizing/image.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/sizing/image.rs @@ -163,7 +163,8 @@ pub struct ImageSize<'a> { /// document's depth, no alpha (1/8 for Bitmap, 1 for Indexed). #[prop(quantity = "bytes per pixel")] bytes_per_pixel: f64, - /// The held OK of a hosted dialog. + /// The held OK of a hosted dialog ([`Hold`]). + #[prop(name = "hold_ok", vis = "pub(crate)")] hold: Hold, } @@ -173,12 +174,6 @@ impl<'a> ImageSize<'a> { ImageSize { values, open: None, methods: Vec::new(), bytes_per_pixel: 4.0, hold: Hold::default() } } - /// Holds the OK of a hosted dialog ([`Hold`]). - fn hold_ok(mut self, hold: Hold) -> Self { - self.hold = hold; - self - } - /// Shows the dialog. pub fn show(self, ui: &mut Ui) -> ImageSizeOutput { let ImageSize { values, open, methods, bytes_per_pixel, hold } = self;