From e6dbf86f8f5a0385397e44a6e33cc3172082c8e6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 27 Nov 2026 03:23:16 +0000 Subject: [PATCH] dialogs-w3: net change of 5 commits - dialogs-w3: written by an agent - dialogs-w3: finished by an agent - dialogs-w3: finished by an agent - dialogs-w3: finished by an agent - dialogs-w3: review fixes (review-1) --- crates/text/README.md | 2 +- crates/text/src/ui/spelling.rs | 131 ++++++++++------- crates/text/src/ui/spelling/stories.rs | 30 +++- .../src/patterns/form_dialogs/list_manager.rs | 111 +++++++++++---- .../form_dialogs/list_manager/stories.rs | 16 ++- .../src/patterns/preferences/window.rs | 24 ++-- .../patterns/preferences/window/stories.rs | 102 +++++++++++++- .../tests/it/form_dialogs/about.rs | 48 ++++++- .../tests/it/form_dialogs/list_manager.rs | 2 + .../ui-patterns/tests/it/preferences/live.rs | 133 +++++++++++++++++- 10 files changed, 497 insertions(+), 102 deletions(-) diff --git a/crates/text/README.md b/crates/text/README.md index ed3c6cdaee..c7cd220599 100644 --- a/crates/text/README.md +++ b/crates/text/README.md @@ -17,7 +17,7 @@ plain text and a language and return what layout needs before it shapes and plac | `ui::editor` | `ui` | `TextEditor` and `TextEditorTool`: the text editor on a canvas over a `TextEditorHost`; input methods through craft-ui's `Composer`. Caret and underline sizes are the `text_editor.*` tokens | | `ui::character` | `ui` | `CharacterControls` and `ParagraphControls`: Photoshop's Character and Paragraph panels | | `ui::style_panel` | `ui` | `TextStylesPanel`: the Character Styles and Paragraph Styles panels | -| `ui::spelling` | `ui` | `CheckSpellingDialog` and the user's words as a settings section | +| `ui::spelling` | `ui` | `CheckSpellingDialog`: repeated-word deletion, layer or document scope, a caption note and modal or modeless display; the user's words as a settings section | | `ui::ruler`, `ui::tabs_dialog`, `ui::notes`, `ui::columns`, `ui::hyperlink` | `ui` | The paged-text controls: the text ruler, Tabs dialog, notes editor, Columns and Hyperlink dialogs | | `ui::find` | `ui` and `find` | The find bar and Find and Replace | | | `font-picker` | The Character controls' family field is craft-font-manager's font picker | diff --git a/crates/text/src/ui/spelling.rs b/crates/text/src/ui/spelling.rs index 693ba6f9c0..66abd6862e 100644 --- a/crates/text/src/ui/spelling.rs +++ b/crates/text/src/ui/spelling.rs @@ -27,15 +27,15 @@ use craft_ui::choice::Checkbox; use craft_ui::contract::{ Bind, CollectionEvent, NoValue, Outcome, Pad, Props as _, SelectMode, Show as _, ShowCollection as _, ShowContainer as _, Sizing, }; -use craft_ui::dialog::{ButtonPlace, Dialog, DialogId, DialogOutput, DialogResult, DialogStack, StackDialog, dialog_id}; -use craft_ui::display::Text; +use craft_ui::dialog::{ButtonPlace, Dialog, DialogId, DialogOutput, DialogResult, DialogStack, FieldRefusal, StackDialog, dialog_id}; +use craft_ui::display::{Shade, Text}; use craft_ui::form::Field; use craft_ui::list::{List, ListRow}; use craft_ui::notices::{Notice, NoticeLayout}; use craft_ui::runtime::env::{Env, Label}; use craft_ui::runtime::overlay::CloseReason; use craft_ui::sections::{DialogRole, FooterButton}; -use craft_ui::style::SurfaceKind; +use craft_ui::style::{SurfaceKind, TypeRole}; use craft_ui::text::TextField; use egui::{Context, Response, Ui}; use serde::{Deserialize, Serialize}; @@ -154,15 +154,14 @@ pub enum SpellingAction { impl SpellingItem { /// Marks a repeated word with the range Delete removes, in the app's units. #[must_use] - pub fn repeated(self, delete: Range) -> Self { - let _ = delete; - todo!("dl.F15") + pub fn repeated(mut self, delete: Range) -> Self { + self.delete = Some(delete); + self } /// The misspelling `word` at `range` of the text object `object`, with the `suggestions` best first. pub fn new(object: u64, range: Range, word: impl Into, suggestions: Vec) -> Self { - // P3(dialogs-w3): dl.F15 - SpellingItem { object, range, delete: Default::default(), word: word.into(), suggestions, before: String::new(), after: String::new() } + SpellingItem { object, range, delete: None, word: word.into(), suggestions, before: String::new(), after: String::new() } } /// Sets the sentence's text before and after the word. @@ -214,7 +213,7 @@ pub enum SpellingScope { /// box and the buttons. /// - Result: `()`; every close from inside (Done, Escape, the close action, automation's confirm) is /// [`DialogResult::Ok`], and a close from outside is `Cancel`. -/// - Automation fields: `word` and `count` (read only), `changeTo` and `allLayers`. +/// - Automation fields: `word` and `count` (read only), `changeTo`, and `allLayers` under [`SpellingScope::Layers`]. #[derive(Clone, Debug, PartialEq, craft_ui::contract::Pattern)] pub struct CheckSpellingDialog { items: Vec, @@ -223,6 +222,9 @@ pub struct CheckSpellingDialog { ignored: Vec, change_to: String, all_layers: bool, + scope: SpellingScope, + note: Option