SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Implement compact workspace layout (#2029) (#4533)
Nathan Dane4b23bb3a0367
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex e3c58d1e17..c4427cf86d 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -280,6 +280,10 @@ jobs:run: cargo xtask licences --check- name: Dependency layersrun: cargo xtask layers+ - name: Universal UI containers+ run: |+ cargo xtask ui-containers+ cargo test -p xtask ui_containers --locked- name: Sorted listsrun: cargo xtask lists- name: Design format pending changesdiff --git a/AGENTS.md b/AGENTS.mdindex c4063d8cd2..5551a0e9e7 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -88,6 +88,14 @@ People trust SolidCraft with their designs; a crash loses their work. **This outegui/eframe/winit/wgpu/rfd. **The UI crate is swappable.** Only `crates/kernel` may use `truck`.- **The UI is thin**: panels read engine state and act through `app.run(id, params)` /`app.start(id)`. Colours come from `theme::Tokens`.+- **One outer UI container**: all panels, floating sheets, menus, overlays and platform UI+ windows use `ui_kit::Container` (directly or through `Panel`, `Window`, `Confirm`, `Menu`).+ Declare the semantic `Surface`; workspace panels use its shared layout policy and chrome.+ System/report windows use `ui_kit::Window`; its low-level host builder is kit-private.+ Do not construct raw egui hosts, outer popup/window frames or shadows in feature modules.+ `cargo xtask ui-containers` recursively checks source/examples in all current and future crates+ and apps. It runs in the fast repository CI job and `cargo xtask ci`, with no caller allowances.+ See `docs/ui-container-audit.md` for the inventory and legitimate content/native exceptions.- **One set of camera controls**: every page or canvas with a camera (viewport, Renderpreview, future flat pattern or drawing pages) calls `navigation::handle` with its `NavCaps`(orbit off for flat 2D pages). New canvases must use `navigation::handle`; never hand-rolldiff --git a/ATTRIBUTION.md b/ATTRIBUTION.mdindex f012c139f0..e069b42801 100644--- a/ATTRIBUTION.md+++ b/ATTRIBUTION.md@@ -319,6 +319,9 @@ Editable drawing code, native projects and shipped exports are collected under `| assets/icons/ui/design/svg/model/offset_symmetric.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 || assets/icons/ui/design/svg/flat/import_tray.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 || assets/icons/ui/design/svg/flat/export_tray.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |+| assets/icons/ui/design/svg/flat/send.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |+| assets/icons/ui/design/svg/flat/stop.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |+| assets/icons/ui/design/svg/flat/shield.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 || assets/icons/ui/design/svg/model/placeholder.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 || assets/icons/ui/design/svg/model/plane.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 || assets/icons/ui/design/svg/model/plane_angle.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |diff --git a/Cargo.lock b/Cargo.lockindex fb70a05cc7..d6246f988a 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -5923,8 +5923,10 @@ checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7"name = "xtask"version = "0.18.4"dependencies = [+ "proc-macro2","serde_json","sha2 0.10.9",+ "syn 2.0.119",][[package]]diff --git a/ROADMAP.md b/ROADMAP.mdindex 12016e8627..dfa81b55c1 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -329,6 +329,18 @@ completed drawings publish atomically. The browser still exports synchronously.- Saved projections from a removed strip retain their geometry and report the lostreference. Explicitly reselect the wall to repair that projection.+## Workspace layouts (#2029)++- General preferences save Floating or Compact using the universal UI containers.+ Compact joins the workspace selector and ribbon, docks the content-hugging Browser+ flush beneath them with a square join, and opens tool sheets below the compass.+ Sheets remain draggable, rounding all corners away from their right dock; footer+ backgrounds follow the same corners. A separate preference hides ribbon icon labels+ for a shorter ribbon in either layout.+ Assistant keeps the outermost edge and History keeps its chosen dock. Switching+ retains the active tool, camera, selection and design; system windows and menus+ keep their existing behavior.+## View navigation- Navigation has an opt-in Free orbit preference for mouse and 3D-mouse rotation throughdiff --git a/apps/solidcraft-web/src/main.rs b/apps/solidcraft-web/src/main.rsindex 49414f2d22..7722a20bc7 100644--- a/apps/solidcraft-web/src/main.rs+++ b/apps/solidcraft-web/src/main.rs@@ -23,7 +23,7 @@ mod web {use solidcraft_engine::Session;use solidcraft_engine::io::vfs;- use solidcraft_ui_egui::{Services, SolveApp};+ use solidcraft_ui_egui::{Services, SolveApp, ui_kit};use wasm_bindgen::JsCast as _;use crate::api::Api;@@ -229,24 +229,21 @@ mod web {if !self.files.panel.get() {return;}- let mut open = true;let mut act: Option<(&'static str, String)> = None;- egui::Window::new("Files in this browser")- .open(&mut open)- .collapsible(false)- .resizable(true)- .default_width(520.0)- .pivot(egui::Align2::CENTER_CENTER)- .default_pos(ctx.content_rect().center())- .show(ctx, |ui| {+ let closed = solidcraft_ui_egui::ui_kit::Window::new(egui::Id::new("sc_browser_files"), "folder", "Files in this browser")+ .cards(3.0)+ .show_body(ctx, |ui| {ui.horizontal(|ui| {- if ui.button("Open from computer…").clicked() {+ if ui_kit::button(ui, "Open from computer…", ui_kit::Button::Normal).clicked() {files::pick_from_disk(&self.files, Intent::Open);}- if ui.button("Insert from computer…").on_hover_text("STEP, 3MF or STL into the open design").clicked() {+ if ui_kit::button(ui, "Insert from computer…", ui_kit::Button::Normal)+ .on_hover_text("STEP, 3MF or STL into the open design")+ .clicked()+ {files::pick_from_disk(&self.files, Intent::Insert);}- if ui.button("Download open design").clicked() {+ if ui_kit::button(ui, "Download open design", ui_kit::Button::Normal).clicked() {act = Some(("download_open", String::new()));}});@@ -270,7 +267,7 @@ mod web {for e in &entries {match &mut self.renaming {Some((from, to)) if *from == e.name => {- let r = ui.add(egui::TextEdit::singleline(to).desired_width(200.0));+ let r = ui_kit::cell_editor(ui, ui.make_persistent_id(("stored_file_name", from.as_str())), to, "", false);if std::mem::take(&mut self.rename_focus) {r.request_focus();}@@ -288,28 +285,31 @@ mod web {}ui.label(format!("{:.1} KB", e.size as f64 / 1024.0));ui.horizontal(|ui| {- if ui.small_button("Open").clicked() {+ if ui_kit::button(ui, "Open", ui_kit::Button::Small).clicked() {act = Some(("open", e.name.clone()));}let design = solidcraft_engine::io::is_design_path(&e.name);- if !design && ui.small_button("Insert").on_hover_text("Into the open design (STEP, 3MF, STL)").clicked() {+ if !design+ && ui_kit::button(ui, "Insert", ui_kit::Button::Small)+ .on_hover_text("Into the open design (STEP, 3MF, STL)")+ .clicked()+ {act = Some(("insert", e.name.clone()));}- if ui.small_button("Rename").clicked() {+ if ui_kit::button(ui, "Rename", ui_kit::Button::Small).clicked() {self.renaming = Some((e.name.clone(), e.name.clone()));self.rename_focus = true;}- if ui- .small_button("Save to computer…")+ if ui_kit::button(ui, "Save to computer…", ui_kit::Button::Small).on_hover_text("A copy in a file you choose; the stored design stays here").clicked(){act = Some(("save_copy", e.name.clone()));}- if ui.small_button("Download").clicked() {+ if ui_kit::button(ui, "Download", ui_kit::Button::Small).clicked() {act = Some(("download", e.name.clone()));}- if ui.small_button("Delete").clicked() {+ if ui_kit::button(ui, "Delete", ui_kit::Button::Small).clicked() {act = Some(("delete", e.name.clone()));}});@@ -318,7 +318,7 @@ mod web {});});});- if !open {+ if closed {self.files.panel.set(false);self.renaming = None;}@@ -386,20 +386,19 @@ mod web {fn recovery_prompt(&mut self, ctx: &egui::Context) {let Some((name, path)) = self.files.recovery.borrow().clone() else { return };let mut answer = None;- egui::Window::new("Recover unsaved work?").collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, 0.0]).show(- ctx,- |ui| {+ let _ = solidcraft_ui_egui::ui_kit::Window::new(egui::Id::new("sc_browser_recovery"), "restore", "Recover unsaved work?")+ .required()+ .show_body(ctx, |ui| {ui.label(format!("“{name}” had unsaved changes when this page last closed."));ui.horizontal(|ui| {- if ui.button("Recover").clicked() {+ if ui_kit::button(ui, "Recover", ui_kit::Button::Normal).clicked() {answer = Some(true);}- if ui.button("Discard").clicked() {+ if ui_kit::button(ui, "Discard", ui_kit::Button::Normal).clicked() {answer = Some(false);}});- },- );+ });let Some(recover) = answer else { return };*self.files.recovery.borrow_mut() = None;if recover {diff --git a/assets/README.md b/assets/README.mdindex 99be8dc592..372f3500d5 100644--- a/assets/README.md+++ b/assets/README.md@@ -84,7 +84,7 @@ The CLI still supports arbitrary PNG/ICO exports with `solidcraft-cli icon`.## Code and provenanceResources remain compiled by their owning layer through existing APIs:-`ui-egui::icons::paint` and `Tokens` at L5, model presets in L2 `doc`, and sketch+`ui-egui::icons::paint_icon` and `Tokens` at L5, model presets in L2 `doc`, and sketchfonts at L1. State, projection, interaction, commands and GPU bindings stay intheir current modules. Embedded data uses `CARGO_MANIFEST_DIR`; application codeneeds no runtime resource registry or repository lookup.diff --git a/assets/icons/ui/README.md b/assets/icons/ui/README.mdindex 8e4aede022..4a9d954c4d 100644--- a/assets/icons/ui/README.md+++ b/assets/icons/ui/README.md@@ -91,7 +91,7 @@ Palette changes preserve accepted artwork and never update review hashes.| `source/` | Rust viewport glyphs, markers, navigation and pointer; not command icons |`crates/ui-egui/build.rs` embeds SVGs, palette and aliases. `icon_svg.rs` parses and-rasterises them for `icons::paint`; adding an icon still requires its registry or+rasterises them for `icons::paint_icon`; adding an icon still requires its registry orUI assignment and an application rebuild. Review status never controls rendering.## Checks and reportsdiff --git a/assets/icons/ui/design/requested_icons.txt b/assets/icons/ui/design/requested_icons.txtindex de72755248..2751731a2e 100644--- a/assets/icons/ui/design/requested_icons.txt+++ b/assets/icons/ui/design/requested_icons.txt@@ -203,9 +203,11 @@ scale falsescrew falsesection falseselect false+send falsesettings falsesheet_rules falseshell false+shield falsesilhouette falsesketch falsesketch_break falsediff --git a/assets/icons/ui/design/svg/flat/send.svg b/assets/icons/ui/design/svg/flat/send.svgnew file mode 100644index 0000000000..93a9a39739--- /dev/null+++ b/assets/icons/ui/design/svg/flat/send.svg@@ -0,0 +1,4 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">+ <title>Send message</title>+ <path d="M32 51L32 13M17 28L32 13L47 28" fill="none" stroke="currentColor" stroke-width="5.6" stroke-linejoin="round" stroke-linecap="round"/>+</svg>diff --git a/assets/icons/ui/design/svg/flat/shield.svg b/assets/icons/ui/design/svg/flat/shield.svgnew file mode 100644index 0000000000..beaacf03a0--- /dev/null+++ b/assets/icons/ui/design/svg/flat/shield.svg@@ -0,0 +1,4 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">+ <title>Approval required</title>+ <path d="M32 9L51 16L51 31C51 43 43 51 32 56C21 51 13 43 13 31L13 16Z" fill="none" stroke="currentColor" stroke-width="5.6" stroke-linejoin="round" stroke-linecap="round"/>+</svg>diff --git a/assets/icons/ui/design/svg/flat/stop.svg b/assets/icons/ui/design/svg/flat/stop.svgnew file mode 100644index 0000000000..20cdd5375f--- /dev/null+++ b/assets/icons/ui/design/svg/flat/stop.svg@@ -0,0 +1,4 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">+ <title>Stop response</title>+ <path d="M20 17L44 17A3 3 0 0 1 47 20L47 44A3 3 0 0 1 44 47L20 47A3 3 0 0 1 17 44L17 20A3 3 0 0 1 20 17Z" fill="currentColor"/>+</svg>diff --git a/assets/locales/cs.json b/assets/locales/cs.jsonindex 8933c00fc9..ba1e2a85bf 100644--- a/assets/locales/cs.json+++ b/assets/locales/cs.json@@ -1093,6 +1093,7 @@"ui.agent_chat_add": "Připojit soubory","ui.agent_chat_add_file": "Vybrat soubor…","ui.agent_chat_allow": "Povolit",+ "ui.agent_chat_allow_once": "Povolit jednou","ui.agent_chat_allowed": "Povoleno","ui.agent_chat_answered": "Odpověď: {option}","ui.agent_chat_approval": "Povolit agentovi tuto akci?",@@ -1150,6 +1151,9 @@"ui.agent_chat_left": "Vlevo","ui.agent_chat_limit": "Agent dosáhl limitu {limit} změn na jednu zprávu. Pošlete další zprávu, aby mohl pokračovat.","ui.agent_chat_minimize": "Minimalizovat do pruhu",+ "ui.agent_chat_mode_all": "Vše",+ "ui.agent_chat_mode_ask": "Ptát se",+ "ui.agent_chat_mode_edits": "Úpravy","ui.agent_chat_model_tip": "Model, který agent používá. Vaše volba se pro tohoto agenta zapamatuje.","ui.agent_chat_new": "Nový chat","ui.agent_chat_new_confirm": "Začít nový chat? Aktuální bude vymazán.",@@ -1162,6 +1166,7 @@"ui.agent_chat_none_found_short": "Agent nenalezen","ui.agent_chat_not_installed": "Není nainstalován","ui.agent_chat_not_signed_in": "nepřihlášen",+ "ui.agent_chat_open_settings": "Otevřít předvolby","ui.agent_chat_own_window": "Vlastní okno","ui.agent_chat_paste_picture": "Vložit obrázek","ui.agent_chat_permission": "Agent žádá o spuštění: {title}",@@ -1186,6 +1191,8 @@"ui.agent_chat_send": "Odeslat","ui.agent_chat_send_now": "Odeslat hned","ui.agent_chat_send_now_tip": "Zastavit aktuální krok agenta a poslat tuto zprávu jako další (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft komunikuje s programovacím agentem nainstalovaným v tomto počítači. Vyberte ho v části Předvolby › AI.",+ "ui.agent_chat_setup_title": "Nastavit asistenta","ui.agent_chat_side": "Strana chatu s agentem","ui.agent_chat_signed_in": "přihlášen","ui.agent_chat_state_auth": "Vyžadováno přihlášení",@@ -1202,6 +1209,7 @@"ui.agent_chat_undo_label": "Chat s agentem: {message}","ui.agent_chat_undone": "(vráceno)","ui.agent_chat_view_attached": "Pohled přiložen",+ "ui.agent_chat_waiting": "Čeká na vás","ui.agent_cursor": "Kurzor agenta","ui.agent_cursor_speed": "Rychlost kurzoru agenta","ui.ai_add": "Přidat",@@ -1551,6 +1559,8 @@"ui.joints": "Klouby","ui.keyboard_shortcuts": "Klávesové zkratky","ui.language": "Jazyk",+ "ui.layout_compact": "Kompaktní",+ "ui.layout_floating": "Plovoucí","ui.length_decimals": "Desetinná místa délky","ui.light": "Světlý","ui.line": "Úsečka",@@ -1688,6 +1698,7 @@"ui.reverse_zoom_direction": "Obrátit směr přiblížení","ui.revolve": "Rotace","ui.ribbon_exit": "Ukončit",+ "ui.ribbon_labels": "Zobrazovat text pod ikonami pásu karet","ui.ribbon_pin_footer": "Připnuté příkazy se zobrazují na pásu karet. Najetím na řádek jej připnete nebo odepnete.","ui.ribbon_workspace": "Pracovní prostředí","ui.right": "Zprava",@@ -1867,6 +1878,7 @@"ui.workspace_design_tabs": "Model · Plocha · Sestava · Vložit · Kontrola · Správa · Zobrazení","ui.workspace_drawing_description": "2D výkresy s pohledy, kótami a popisovými poli","ui.workspace_footer": "Všechna pracovní prostředí pracují se stejným návrhem, historií a výběrem; mění se pouze karty pásu karet. Přepínač je zamknutý, dokud se upravuje náčrt nebo prvek.",+ "ui.workspace_layout": "Rozložení pracovní plochy","ui.workspace_manufacture_description": "Slicing, dráhy nástroje a nastavení","ui.workspace_planned": "Plánováno","ui.workspace_render_description": "Náhled produktu, nastavení scény a renderované obrázky",diff --git a/assets/locales/da.json b/assets/locales/da.jsonindex 3117b6b445..f2cc366bf7 100644--- a/assets/locales/da.json+++ b/assets/locales/da.json@@ -1093,6 +1093,7 @@"ui.agent_chat_add": "Vedhæft filer","ui.agent_chat_add_file": "Vælg en fil…","ui.agent_chat_allow": "Tillad",+ "ui.agent_chat_allow_once": "Tillad én gang","ui.agent_chat_allowed": "Tilladt","ui.agent_chat_answered": "Svar: {option}","ui.agent_chat_approval": "Tillad agenten at gøre dette?",@@ -1150,6 +1151,9 @@"ui.agent_chat_left": "Venstre","ui.agent_chat_limit": "Agenten nåede grænsen på {limit} ændringer for én besked. Send en ny besked for at lade den fortsætte.","ui.agent_chat_minimize": "Minimér til en stribe",+ "ui.agent_chat_mode_all": "Alt",+ "ui.agent_chat_mode_ask": "Spørg",+ "ui.agent_chat_mode_edits": "Ændringer","ui.agent_chat_model_tip": "Modellen, som agenten bruger. Dit valg huskes for denne agent.","ui.agent_chat_new": "Ny chat","ui.agent_chat_new_confirm": "Start en ny chat? Den aktuelle chat ryddes.",@@ -1162,6 +1166,7 @@"ui.agent_chat_none_found_short": "Ingen agent fundet","ui.agent_chat_not_installed": "Ikke installeret","ui.agent_chat_not_signed_in": "ikke logget ind",+ "ui.agent_chat_open_settings": "Åbn indstillinger","ui.agent_chat_own_window": "Eget vindue","ui.agent_chat_paste_picture": "Indsæt et billede","ui.agent_chat_permission": "Agenten beder om at køre: {title}",@@ -1186,6 +1191,8 @@"ui.agent_chat_send": "Send","ui.agent_chat_send_now": "Send nu","ui.agent_chat_send_now_tip": "Stop agentens aktuelle trin, og send denne som den næste (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft kommunikerer med en kodeagent, der er installeret på denne computer. Vælg en under Indstillinger › AI.",+ "ui.agent_chat_setup_title": "Opsæt en assistent","ui.agent_chat_side": "Agentchattens side","ui.agent_chat_signed_in": "logget ind","ui.agent_chat_state_auth": "Login kræves",@@ -1202,6 +1209,7 @@"ui.agent_chat_undo_label": "Agentchat: {message}","ui.agent_chat_undone": "(fortrudt)","ui.agent_chat_view_attached": "Visning vedhæftet",+ "ui.agent_chat_waiting": "Venter på dig","ui.agent_cursor": "Agentmarkør","ui.agent_cursor_speed": "Agentmarkørens hastighed","ui.ai_add": "Tilføj",@@ -1551,6 +1559,8 @@"ui.joints": "Led","ui.keyboard_shortcuts": "Tastaturgenveje","ui.language": "Sprog",+ "ui.layout_compact": "Kompakt",+ "ui.layout_floating": "Flydende","ui.length_decimals": "Længdedecimaler","ui.light": "Lys","ui.line": "Linje",@@ -1688,6 +1698,7 @@"ui.reverse_zoom_direction": "Vend zoomretning","ui.revolve": "Omdrejning","ui.ribbon_exit": "Afslut",+ "ui.ribbon_labels": "Vis tekst under ikonerne på båndet","ui.ribbon_pin_footer": "Fastgjorte kommandoer vises på båndet. Hold musen over en række for at fastgøre eller frigøre den.","ui.ribbon_workspace": "Arbejdsområde","ui.right": "Fra højre",@@ -1842,6 +1853,7 @@"ui.workspace_design_tabs": "Model · Overflade · Saml · Indsæt · Undersøg · Administrér · Visning","ui.workspace_drawing_description": "2D-tegninger med visninger, mål og tegningshoveder","ui.workspace_footer": "Alle arbejdsområder arbejder på det samme design, den samme historik og den samme markering; kun båndets faner ændres. Skifteren er låst, mens en skitse eller feature redigeres.",+ "ui.workspace_layout": "Arbejdsområdets layout","ui.workspace_manufacture_description": "Slicing, værktøjsbaner og opsætning","ui.workspace_planned": "Planlagt","ui.workspace_render_description": "Produktforhåndsvisning, scene-indstillinger og renderede billeder",diff --git a/assets/locales/de.json b/assets/locales/de.jsonindex 258e427bda..ab618e41e4 100644--- a/assets/locales/de.json+++ b/assets/locales/de.json@@ -1097,6 +1097,7 @@"ui.agent_chat_add": "Dateien anhängen","ui.agent_chat_add_file": "Datei auswählen…","ui.agent_chat_allow": "Erlauben",+ "ui.agent_chat_allow_once": "Einmal erlauben","ui.agent_chat_allowed": "Erlaubt","ui.agent_chat_answered": "Antwort: {option}","ui.agent_chat_approval": "Darf der Agent das tun?",@@ -1154,6 +1155,9 @@"ui.agent_chat_left": "Links","ui.agent_chat_limit": "Der Agent hat die Grenze von {limit} Änderungen für eine Nachricht erreicht. Senden Sie eine weitere Nachricht, damit er weitermacht.","ui.agent_chat_minimize": "Zu einer Leiste minimieren",+ "ui.agent_chat_mode_all": "Alles",+ "ui.agent_chat_mode_ask": "Fragen",+ "ui.agent_chat_mode_edits": "Ändern","ui.agent_chat_model_tip": "Das vom Agenten verwendete Modell. Ihre Auswahl wird für diesen Agenten gespeichert.","ui.agent_chat_new": "Neuer Chat","ui.agent_chat_new_confirm": "Neuen Chat starten? Der aktuelle wird geleert.",@@ -1166,6 +1170,7 @@"ui.agent_chat_none_found_short": "Kein Agent gefunden","ui.agent_chat_not_installed": "Nicht installiert","ui.agent_chat_not_signed_in": "nicht angemeldet",+ "ui.agent_chat_open_settings": "Einstellungen öffnen","ui.agent_chat_own_window": "Eigenes Fenster","ui.agent_chat_paste_picture": "Bild einfügen","ui.agent_chat_permission": "Der Agent möchte ausführen: {title}",@@ -1190,6 +1195,8 @@"ui.agent_chat_send": "Senden","ui.agent_chat_send_now": "Jetzt senden","ui.agent_chat_send_now_tip": "Den aktuellen Schritt des Agenten stoppen und dies als Nächstes senden (Strg+Eingabe)",+ "ui.agent_chat_setup_body": "SolidCraft kommuniziert mit einem auf diesem Computer installierten Programmieragenten. Wählen Sie einen unter Einstellungen › KI aus.",+ "ui.agent_chat_setup_title": "Assistenten einrichten","ui.agent_chat_side": "Seite des Agenten-Chats","ui.agent_chat_signed_in": "angemeldet","ui.agent_chat_state_auth": "Anmeldung nötig",@@ -1206,6 +1213,7 @@"ui.agent_chat_undo_label": "Agenten-Chat: {message}","ui.agent_chat_undone": "(rückgängig gemacht)","ui.agent_chat_view_attached": "Ansicht angehängt",+ "ui.agent_chat_waiting": "Wartet auf Sie","ui.agent_cursor": "Agent-Cursor","ui.agent_cursor_speed": "Agent-Cursor-Geschwindigkeit","ui.ai_add": "Hinzufügen",@@ -1555,6 +1563,8 @@"ui.joints": "Gelenke","ui.keyboard_shortcuts": "Tastenkürzel","ui.language": "Sprache",+ "ui.layout_compact": "Kompakt",+ "ui.layout_floating": "Schwebend","ui.length_decimals": "Längen-Dezimalstellen","ui.light": "Hell","ui.line": "Linie",@@ -1692,6 +1702,7 @@"ui.reverse_zoom_direction": "Zoomrichtung umkehren","ui.revolve": "Drehen","ui.ribbon_exit": "Beenden",+ "ui.ribbon_labels": "Text unter den Symbolen im Menüband anzeigen","ui.ribbon_pin_footer": "Angeheftete Befehle erscheinen im Menüband. Fahren Sie über eine Zeile, um sie anzuheften oder zu lösen.","ui.ribbon_workspace": "Arbeitsbereich","ui.right": "Rechts",@@ -1871,6 +1882,7 @@"ui.workspace_design_tabs": "Modell · Fläche · Zusammenbau · Einfügen · Prüfen · Verwalten · Ansicht","ui.workspace_drawing_description": "2D-Zeichnungen mit Ansichten, Bemaßungen und Schriftfeldern","ui.workspace_footer": "Jeder Arbeitsbereich arbeitet am selben Design, Verlauf und derselben Auswahl; nur die Menüband-Register ändern sich. Der Umschalter ist gesperrt, solange eine Skizze oder ein Merkmal bearbeitet wird.",+ "ui.workspace_layout": "Arbeitsbereich-Layout","ui.workspace_manufacture_description": "Slicing, Werkzeugbahnen und Einrichtung","ui.workspace_planned": "Geplant","ui.workspace_render_description": "Produktvorschau, Szeneneinstellungen und gerenderte Bilder",diff --git a/assets/locales/en-GB.json b/assets/locales/en-GB.jsonindex 8dfbaab368..d22d4aab72 100644--- a/assets/locales/en-GB.json+++ b/assets/locales/en-GB.json@@ -21,7 +21,11 @@"ui.customizeToolbar": "Customise Toolbar…","ui.design_properties.license": "Licence","ui.design_properties.organization": "Organisation",+ "ui.layout_compact": "Compact",+ "ui.layout_floating": "Floating",+ "ui.ribbon_labels": "Show text under ribbon icons","ui.space_mouse_step_pull": "Pull the cap towards you, hold it, then let go.",+ "ui.workspace_layout": "Workspace layout","ui.zoom_to_cursor_tip": "The wheel zooms towards the point under the cursor (off: towards the view's centre)","update.prefs_flatpak": "Flatpak updates this copy ({version}): run {command} or use your software centre. SolidCraft doesn't check."}diff --git a/assets/locales/en.json b/assets/locales/en.jsonindex 61b14e8907..db6a1d2fe4 100644--- a/assets/locales/en.json+++ b/assets/locales/en.json@@ -1127,6 +1127,7 @@"ui.agent_chat_add": "Attach files","ui.agent_chat_add_file": "Choose a file…","ui.agent_chat_allow": "Allow",+ "ui.agent_chat_allow_once": "Allow once","ui.agent_chat_allowed": "Allowed","ui.agent_chat_answered": "Answer: {option}","ui.agent_chat_approval": "Allow the agent to do this?",@@ -1184,6 +1185,9 @@"ui.agent_chat_left": "Left","ui.agent_chat_limit": "The agent reached the limit of {limit} changes for one message. Send another message to let it go on.","ui.agent_chat_minimize": "Minimise to a strip",+ "ui.agent_chat_mode_all": "All",+ "ui.agent_chat_mode_ask": "Ask",+ "ui.agent_chat_mode_edits": "Edits","ui.agent_chat_model_tip": "The model the agent uses. Your choice is remembered for this agent.","ui.agent_chat_new": "New chat","ui.agent_chat_new_confirm": "Start a new chat? The current one is cleared.",@@ -1196,6 +1200,7 @@"ui.agent_chat_none_found_short": "No agent found","ui.agent_chat_not_installed": "Not installed","ui.agent_chat_not_signed_in": "not signed in",+ "ui.agent_chat_open_settings": "Open Preferences","ui.agent_chat_own_window": "Own window","ui.agent_chat_paste_picture": "Paste a picture","ui.agent_chat_permission": "The agent asks to run: {title}",@@ -1220,6 +1225,8 @@"ui.agent_chat_send": "Send","ui.agent_chat_send_now": "Send now","ui.agent_chat_send_now_tip": "Stop the agent's current step and send this next (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft talks to a coding agent installed on this computer. Pick one in Preferences › AI.",+ "ui.agent_chat_setup_title": "Set up an assistant","ui.agent_chat_side": "Agent chat side","ui.agent_chat_signed_in": "signed in","ui.agent_chat_state_auth": "Sign-in needed",@@ -1236,6 +1243,7 @@"ui.agent_chat_undo_label": "Agent chat: {message}","ui.agent_chat_undone": "(undone)","ui.agent_chat_view_attached": "View attached",+ "ui.agent_chat_waiting": "Waiting for you","ui.agent_cursor": "Agent cursor","ui.agent_cursor_speed": "Agent cursor speed","ui.agent_off_thread": "Keep the window responsive while agents run commands",@@ -1594,6 +1602,8 @@"ui.joints": "Joints","ui.keyboard_shortcuts": "Keyboard Shortcuts","ui.language": "Language",+ "ui.layout_compact": "Compact",+ "ui.layout_floating": "Floating","ui.length_decimals": "Length decimals","ui.light": "Light","ui.line": "Line",@@ -1731,6 +1741,7 @@"ui.reverse_zoom_direction": "Reverse zoom direction","ui.revolve": "Revolve","ui.ribbon_exit": "Exit",+ "ui.ribbon_labels": "Show text under ribbon icons","ui.ribbon_pin_footer": "Pinned commands show on the ribbon. Hover a row to pin or unpin it.","ui.ribbon_workspace": "Workspace","ui.right": "Right",@@ -1910,6 +1921,7 @@"ui.workspace_design_tabs": "Model · Surface · Assemble · Insert · Inspect · Manage · View","ui.workspace_drawing_description": "2D drawings with views, dimensions and title blocks","ui.workspace_footer": "Every workspace works on the same design, history and selection; only the ribbon tabs change. The switcher is locked while a sketch or feature is being edited.",+ "ui.workspace_layout": "Workspace layout","ui.workspace_manufacture_description": "Slicing, toolpaths and setup","ui.workspace_planned": "Planned","ui.workspace_render_description": "Product preview, scene settings and rendered images",diff --git a/assets/locales/es.json b/assets/locales/es.jsonindex 366165d7f3..71fabc566f 100644--- a/assets/locales/es.json+++ b/assets/locales/es.json@@ -1093,6 +1093,7 @@"ui.agent_chat_add": "Adjuntar archivos","ui.agent_chat_add_file": "Elegir un archivo…","ui.agent_chat_allow": "Permitir",+ "ui.agent_chat_allow_once": "Permitir una vez","ui.agent_chat_allowed": "Permitido","ui.agent_chat_answered": "Respuesta: {option}","ui.agent_chat_approval": "¿Permitir que el agente haga esto?",@@ -1150,6 +1151,9 @@"ui.agent_chat_left": "Izquierda","ui.agent_chat_limit": "El agente ha alcanzado el límite de {limit} cambios por mensaje. Envía otro mensaje para que continúe.","ui.agent_chat_minimize": "Minimizar a una franja",+ "ui.agent_chat_mode_all": "Todo",+ "ui.agent_chat_mode_ask": "Preguntar",+ "ui.agent_chat_mode_edits": "Ediciones","ui.agent_chat_model_tip": "Modelo que utiliza el agente. Se recuerda tu elección para este agente.","ui.agent_chat_new": "Nuevo chat","ui.agent_chat_new_confirm": "¿Iniciar un nuevo chat? Se borrará la conversación actual.",@@ -1162,6 +1166,7 @@"ui.agent_chat_none_found_short": "No se ha encontrado ningún agente","ui.agent_chat_not_installed": "No instalado","ui.agent_chat_not_signed_in": "sesión no iniciada",+ "ui.agent_chat_open_settings": "Abrir preferencias","ui.agent_chat_own_window": "Ventana propia","ui.agent_chat_paste_picture": "Pegar una imagen","ui.agent_chat_permission": "El agente solicita ejecutar: {title}",@@ -1186,6 +1191,8 @@"ui.agent_chat_send": "Enviar","ui.agent_chat_send_now": "Enviar ahora","ui.agent_chat_send_now_tip": "Detener el paso actual del agente y enviar esto a continuación (Ctrl+Intro)",+ "ui.agent_chat_setup_body": "SolidCraft se comunica con un agente de programación instalado en este equipo. Elige uno en Preferencias › AI.",+ "ui.agent_chat_setup_title": "Configurar un asistente","ui.agent_chat_side": "Lado del chat del agente","ui.agent_chat_signed_in": "sesión iniciada","ui.agent_chat_state_auth": "Se requiere iniciar sesión",@@ -1202,6 +1209,7 @@"ui.agent_chat_undo_label": "Chat del agente: {message}","ui.agent_chat_undone": "(deshecho)","ui.agent_chat_view_attached": "Vista adjunta",+ "ui.agent_chat_waiting": "Esperando tu respuesta","ui.agent_cursor": "Cursor del agente","ui.agent_cursor_speed": "Velocidad del cursor del agente","ui.ai_add": "Añadir",@@ -1551,6 +1559,8 @@"ui.joints": "Uniones","ui.keyboard_shortcuts": "Atajos de teclado","ui.language": "Idioma",+ "ui.layout_compact": "Compacta",+ "ui.layout_floating": "Flotante","ui.length_decimals": "Decimales de longitud","ui.light": "Claro","ui.line": "Línea",@@ -1688,6 +1698,7 @@"ui.reverse_zoom_direction": "Invertir dirección del zoom","ui.revolve": "Revolución","ui.ribbon_exit": "Salir",+ "ui.ribbon_labels": "Mostrar texto bajo los iconos de la cinta","ui.ribbon_pin_footer": "Los comandos anclados se muestran en la cinta. Pasa el ratón sobre una fila para anclarla o desanclarla.","ui.ribbon_workspace": "Espacio de trabajo","ui.right": "Derecha",@@ -1867,6 +1878,7 @@"ui.workspace_design_tabs": "Modelo · Superficie · Ensamblaje · Insertar · Inspeccionar · Gestionar · Vista","ui.workspace_drawing_description": "Dibujos 2D con vistas, cotas y cajetines","ui.workspace_footer": "Todos los espacios de trabajo usan el mismo diseño, historial y selección; solo cambian las pestañas de la cinta. El selector está bloqueado mientras se edita un boceto o una operación.",+ "ui.workspace_layout": "Disposición del espacio de trabajo","ui.workspace_manufacture_description": "Laminado, trayectorias de herramienta y configuración","ui.workspace_planned": "Previsto","ui.workspace_render_description": "Vista previa del producto, ajustes de escena e imágenes renderizadas",diff --git a/assets/locales/fr.json b/assets/locales/fr.jsonindex 79008268e7..07731cea4d 100644--- a/assets/locales/fr.json+++ b/assets/locales/fr.json@@ -1099,6 +1099,7 @@"ui.agent_chat_add": "Joindre des fichiers","ui.agent_chat_add_file": "Choisir un fichier…","ui.agent_chat_allow": "Autoriser",+ "ui.agent_chat_allow_once": "Autoriser une fois","ui.agent_chat_allowed": "Autorisé","ui.agent_chat_answered": "Réponse : {option}","ui.agent_chat_approval": "Autoriser l'agent à effectuer cette action ?",@@ -1156,6 +1157,9 @@"ui.agent_chat_left": "Gauche","ui.agent_chat_limit": "L'agent a atteint la limite de {limit} modifications pour un message. Envoyez un autre message pour qu'il poursuive.","ui.agent_chat_minimize": "Réduire en bandeau",+ "ui.agent_chat_mode_all": "Tout",+ "ui.agent_chat_mode_ask": "Demander",+ "ui.agent_chat_mode_edits": "Édition","ui.agent_chat_model_tip": "Le modèle utilisé par l'agent. Votre choix est mémorisé pour cet agent.","ui.agent_chat_new": "Nouveau chat","ui.agent_chat_new_confirm": "Démarrer un nouveau chat ? Le chat actuel sera effacé.",@@ -1168,6 +1172,7 @@"ui.agent_chat_none_found_short": "Aucun agent trouvé","ui.agent_chat_not_installed": "Non installé","ui.agent_chat_not_signed_in": "non authentifié",+ "ui.agent_chat_open_settings": "Ouvrir les préférences","ui.agent_chat_own_window": "Fenêtre séparée","ui.agent_chat_paste_picture": "Coller une image","ui.agent_chat_permission": "L'agent demande à exécuter : {title}",@@ -1192,6 +1197,8 @@"ui.agent_chat_send": "Envoyer","ui.agent_chat_send_now": "Envoyer maintenant","ui.agent_chat_send_now_tip": "Arrêter l'étape en cours de l'agent et envoyer celui-ci ensuite (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft communique avec un agent de programmation installé sur cet ordinateur. Choisissez-en un dans Préférences › IA.",+ "ui.agent_chat_setup_title": "Configurer un assistant","ui.agent_chat_side": "Côté du chat de l'agent","ui.agent_chat_signed_in": "authentifié","ui.agent_chat_state_auth": "Authentification requise",@@ -1208,6 +1215,7 @@"ui.agent_chat_undo_label": "Chat de l'agent : {message}","ui.agent_chat_undone": "(annulé)","ui.agent_chat_view_attached": "Vue jointe",+ "ui.agent_chat_waiting": "En attente de votre réponse","ui.agent_cursor": "Curseur de l'agent","ui.agent_cursor_speed": "Vitesse du curseur de l'agent","ui.ai_add": "Ajouter",@@ -1557,6 +1565,8 @@"ui.joints": "Liaisons","ui.keyboard_shortcuts": "Raccourcis clavier","ui.language": "Langue",+ "ui.layout_compact": "Compacte",+ "ui.layout_floating": "Flottante","ui.length_decimals": "Décimales des longueurs","ui.light": "Clair","ui.line": "Ligne",@@ -1694,6 +1704,7 @@"ui.reverse_zoom_direction": "Inverser le sens du zoom","ui.revolve": "Révolution","ui.ribbon_exit": "Quitter",+ "ui.ribbon_labels": "Afficher le texte sous les icônes du ruban","ui.ribbon_pin_footer": "Les commandes épinglées s’affichent dans le ruban. Survolez une ligne pour l’épingler ou la détacher.","ui.ribbon_workspace": "Espace de travail","ui.right": "Droite",@@ -1873,6 +1884,7 @@"ui.workspace_design_tabs": "Modèle · Surface · Assemblage · Insérer · Inspecter · Gérer · Vue","ui.workspace_drawing_description": "Mises en plan 2D avec vues, cotes et cartouches","ui.workspace_footer": "Chaque espace de travail s’applique à la même conception, au même historique et à la même sélection ; seuls les onglets du ruban changent. Le sélecteur est verrouillé pendant la modification d’une esquisse ou d’une entité.",+ "ui.workspace_layout": "Disposition de l’espace de travail","ui.workspace_manufacture_description": "Tranchage, parcours d’outil et configuration","ui.workspace_planned": "Prévu","ui.workspace_render_description": "Aperçu du produit, paramètres de scène et images rendues",diff --git a/assets/locales/gl.json b/assets/locales/gl.jsonindex 39fc3c8c4e..e5b818c147 100644--- a/assets/locales/gl.json+++ b/assets/locales/gl.json@@ -1093,6 +1093,7 @@"ui.agent_chat_add": "Anexar ficheiros","ui.agent_chat_add_file": "Escoller un ficheiro…","ui.agent_chat_allow": "Permitir",+ "ui.agent_chat_allow_once": "Permitir unha vez","ui.agent_chat_allowed": "Permitido","ui.agent_chat_answered": "Resposta: {option}","ui.agent_chat_approval": "Permitir que o axente faga isto?",@@ -1150,6 +1151,9 @@"ui.agent_chat_left": "Esquerda","ui.agent_chat_limit": "O axente chegou ao límite de {limit} cambios por mensaxe. Envía outra mensaxe para que continúe.","ui.agent_chat_minimize": "Minimizar nunha franxa",+ "ui.agent_chat_mode_all": "Todo",+ "ui.agent_chat_mode_ask": "Preguntar",+ "ui.agent_chat_mode_edits": "Edicións","ui.agent_chat_model_tip": "O modelo que usa o axente. A túa escolla lémbrase para este axente.","ui.agent_chat_new": "Chat novo","ui.agent_chat_new_confirm": "Comezar un chat novo? Borrarase o actual.",@@ -1162,6 +1166,7 @@"ui.agent_chat_none_found_short": "Non se atopou ningún axente","ui.agent_chat_not_installed": "Non instalado","ui.agent_chat_not_signed_in": "sen sesión iniciada",+ "ui.agent_chat_open_settings": "Abrir preferencias","ui.agent_chat_own_window": "Xanela propia","ui.agent_chat_paste_picture": "Pegar unha imaxe","ui.agent_chat_permission": "O axente pide executar: {title}",@@ -1186,6 +1191,8 @@"ui.agent_chat_send": "Enviar","ui.agent_chat_send_now": "Enviar agora","ui.agent_chat_send_now_tip": "Detén o paso actual do axente e envía isto a continuación (Ctrl+Intro)",+ "ui.agent_chat_setup_body": "SolidCraft comunícase cun axente de programación instalado neste equipo. Escolle un en Preferencias › IA.",+ "ui.agent_chat_setup_title": "Configurar un asistente","ui.agent_chat_side": "Lado do chat co axente","ui.agent_chat_signed_in": "sesión iniciada","ui.agent_chat_state_auth": "Hai que iniciar sesión",@@ -1202,6 +1209,7 @@"ui.agent_chat_undo_label": "Chat co axente: {message}","ui.agent_chat_undone": "(desfeito)","ui.agent_chat_view_attached": "Vista achegada",+ "ui.agent_chat_waiting": "Agardando a túa resposta","ui.agent_cursor": "Cursor do axente","ui.agent_cursor_speed": "Velocidade do cursor do axente","ui.ai_add": "Engadir",@@ -1551,6 +1559,8 @@"ui.joints": "Unións","ui.keyboard_shortcuts": "Atallos de teclado","ui.language": "Idioma",+ "ui.layout_compact": "Compacta",+ "ui.layout_floating": "Flotante","ui.length_decimals": "Decimais das lonxitudes","ui.light": "Claro","ui.line": "Liña",@@ -1688,6 +1698,7 @@"ui.reverse_zoom_direction": "Inverter a dirección do zoom","ui.revolve": "Revolución","ui.ribbon_exit": "Saír",+ "ui.ribbon_labels": "Mostrar texto baixo as iconas da cinta","ui.ribbon_pin_footer": "As ordes fixadas móstranse na cinta. Pasa o cursor sobre unha fila para fixala ou soltala.","ui.ribbon_workspace": "Espazo de traballo","ui.right": "Dereita",@@ -1867,6 +1878,7 @@"ui.workspace_design_tabs": "Modelo · Superficie · Montaxe · Inserir · Inspeccionar · Xestionar · Vista","ui.workspace_drawing_description": "Planos 2D con vistas, cotas e cartelas","ui.workspace_footer": "Todos os espazos de traballo usan o mesmo deseño, historial e selección; só cambian as pestanas da cinta. O selector bloquéase mentres se edita un bosquexo ou unha operación.",+ "ui.workspace_layout": "Disposición do espazo de traballo","ui.workspace_manufacture_description": "Laminado, traxectorias de ferramenta e configuración","ui.workspace_planned": "Previsto","ui.workspace_render_description": "Vista previa do produto, axustes de escena e imaxes renderizadas",diff --git a/assets/locales/hu.json b/assets/locales/hu.jsonindex 9c56b32422..f96d615b56 100644--- a/assets/locales/hu.json+++ b/assets/locales/hu.json@@ -1092,6 +1092,7 @@"ui.agent_chat_add": "Fájlok csatolása","ui.agent_chat_add_file": "Válasszon fájlt…","ui.agent_chat_allow": "Engedélyezés",+ "ui.agent_chat_allow_once": "Egyszer engedélyezi","ui.agent_chat_allowed": "Engedélyezve","ui.agent_chat_answered": "Válasz: {option}","ui.agent_chat_approval": "Engedélyezi az ügynöknek ezt?",@@ -1149,6 +1150,9 @@"ui.agent_chat_left": "Bal","ui.agent_chat_limit": "Az ügynök elérte az egy üzenetre eső {limit} módosítás korlátját. Küldjön újabb üzenetet a folytatáshoz.","ui.agent_chat_minimize": "Összecsukás sávvá",+ "ui.agent_chat_mode_all": "Minden",+ "ui.agent_chat_mode_ask": "Kérdez",+ "ui.agent_chat_mode_edits": "Szerkesztés","ui.agent_chat_model_tip": "Az ügynök által használt modell. A választás megmarad ennél az ügynöknél.","ui.agent_chat_new": "Új csevegés","ui.agent_chat_new_confirm": "Új csevegést indít? A jelenlegi törlődik.",@@ -1161,6 +1165,7 @@"ui.agent_chat_none_found_short": "Nincs ügynök","ui.agent_chat_not_installed": "Nincs telepítve","ui.agent_chat_not_signed_in": "nincs bejelentkezve",+ "ui.agent_chat_open_settings": "Beállítások megnyitása","ui.agent_chat_own_window": "Saját ablak","ui.agent_chat_paste_picture": "Kép beillesztése","ui.agent_chat_permission": "Az ügynök futtatást kér: {title}",@@ -1185,6 +1190,8 @@"ui.agent_chat_send": "Küldés","ui.agent_chat_send_now": "Küldés most","ui.agent_chat_send_now_tip": "Az ügynök jelenlegi lépésének leállítása és ennek küldése következőként (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "A SolidCraft a számítógépre telepített programozóügynökkel kommunikál. Válasszon egyet itt: Beállítások › AI.",+ "ui.agent_chat_setup_title": "Asszisztens beállítása","ui.agent_chat_side": "Ügynök-csevegés oldala","ui.agent_chat_signed_in": "bejelentkezve","ui.agent_chat_state_auth": "Bejelentkezés szükséges",@@ -1201,6 +1208,7 @@"ui.agent_chat_undo_label": "Ügynök-csevegés: {message}","ui.agent_chat_undone": "(visszavonva)","ui.agent_chat_view_attached": "Nézet csatolva",+ "ui.agent_chat_waiting": "Önre vár","ui.agent_cursor": "Ügynök kurzora","ui.agent_cursor_speed": "Ügynök kurzorának sebessége","ui.ai_add": "Hozzáadás",@@ -1550,6 +1558,8 @@"ui.joints": "Csuklók","ui.keyboard_shortcuts": "Billentyűparancsok","ui.language": "Nyelv",+ "ui.layout_compact": "Kompakt",+ "ui.layout_floating": "Lebegő","ui.length_decimals": "Hossz tizedesjegyei","ui.light": "Világos","ui.line": "Vonal",@@ -1687,6 +1697,7 @@"ui.reverse_zoom_direction": "Nagyítási irány megfordítása","ui.revolve": "Forgatás","ui.ribbon_exit": "Kilépés",+ "ui.ribbon_labels": "Szöveg megjelenítése a menüszalag ikonjai alatt","ui.ribbon_pin_footer": "A rögzített parancsok megjelennek a menüszalagon. Egy sor fölé víve rögzíthető vagy feloldható.","ui.ribbon_workspace": "Munkaterület","ui.right": "Jobb",@@ -1841,6 +1852,7 @@"ui.workspace_design_tabs": "Modell · Felület · Összeszerelés · Beszúrás · Vizsgálat · Kezelés · Nézet","ui.workspace_drawing_description": "2D rajzok nézetekkel, méretekkel és címblokkokkal","ui.workspace_footer": "Minden munkaterület ugyanazon a terven, előzményeken és kijelölésen dolgozik; csak a menüszalag lapjai változnak. A váltó zárolva van, amíg vázlatot vagy elemet szerkeszt.",+ "ui.workspace_layout": "Munkaterület elrendezése","ui.workspace_manufacture_description": "Szeletelés, szerszámutak és beállítás","ui.workspace_planned": "Tervezett","ui.workspace_render_description": "Terméknézet, jelenetbeállítások és renderelt képek",diff --git a/assets/locales/id.json b/assets/locales/id.jsonindex 0e9039f4c9..3847d7a1a7 100644--- a/assets/locales/id.json+++ b/assets/locales/id.json@@ -1092,6 +1092,7 @@"ui.agent_chat_add": "Lampirkan file","ui.agent_chat_add_file": "Pilih file…","ui.agent_chat_allow": "Izinkan",+ "ui.agent_chat_allow_once": "Izinkan sekali","ui.agent_chat_allowed": "Diizinkan","ui.agent_chat_answered": "Jawaban: {option}","ui.agent_chat_approval": "Izinkan agen melakukan ini?",@@ -1149,6 +1150,9 @@"ui.agent_chat_left": "Kiri","ui.agent_chat_limit": "Agen mencapai batas {limit} perubahan untuk satu pesan. Kirim pesan lain agar agen melanjutkan.","ui.agent_chat_minimize": "Kecilkan menjadi strip",+ "ui.agent_chat_mode_all": "Semua",+ "ui.agent_chat_mode_ask": "Tanya",+ "ui.agent_chat_mode_edits": "Edit","ui.agent_chat_model_tip": "Model yang dipakai agen. Pilihan Anda diingat untuk agen ini.","ui.agent_chat_new": "Chat baru","ui.agent_chat_new_confirm": "Mulai chat baru? Chat saat ini akan dibersihkan.",@@ -1161,6 +1165,7 @@"ui.agent_chat_none_found_short": "Agen tidak ditemukan","ui.agent_chat_not_installed": "Belum terpasang","ui.agent_chat_not_signed_in": "belum masuk",+ "ui.agent_chat_open_settings": "Buka preferensi","ui.agent_chat_own_window": "Jendela sendiri","ui.agent_chat_paste_picture": "Tempel gambar","ui.agent_chat_permission": "Agen meminta menjalankan: {title}",@@ -1185,6 +1190,8 @@"ui.agent_chat_send": "Kirim","ui.agent_chat_send_now": "Kirim sekarang","ui.agent_chat_send_now_tip": "Hentikan langkah agen saat ini dan kirim ini berikutnya (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft berkomunikasi dengan agen pemrograman yang terpasang di komputer ini. Pilih agen di Preferensi › AI.",+ "ui.agent_chat_setup_title": "Siapkan asisten","ui.agent_chat_side": "Sisi chat agen","ui.agent_chat_signed_in": "sudah masuk","ui.agent_chat_state_auth": "Perlu masuk",@@ -1201,6 +1208,7 @@"ui.agent_chat_undo_label": "Chat agen: {message}","ui.agent_chat_undone": "(diurungkan)","ui.agent_chat_view_attached": "Tampilan dilampirkan",+ "ui.agent_chat_waiting": "Menunggu Anda","ui.agent_cursor": "Kursor agen","ui.agent_cursor_speed": "Kecepatan kursor agen","ui.ai_add": "Tambah",@@ -1550,6 +1558,8 @@"ui.joints": "Sambungan","ui.keyboard_shortcuts": "Pintasan Keyboard","ui.language": "Bahasa",+ "ui.layout_compact": "Ringkas",+ "ui.layout_floating": "Mengambang","ui.length_decimals": "Desimal panjang","ui.light": "Terang","ui.line": "Garis",@@ -1687,6 +1697,7 @@"ui.reverse_zoom_direction": "Balik arah zoom","ui.revolve": "Revolve","ui.ribbon_exit": "Keluar",+ "ui.ribbon_labels": "Tampilkan teks di bawah ikon pita","ui.ribbon_pin_footer": "Perintah yang disematkan tampil di ribbon. Arahkan kursor ke baris untuk menyematkan atau melepas sematan.","ui.ribbon_workspace": "Workspace","ui.right": "Kanan",@@ -1841,6 +1852,7 @@"ui.workspace_design_tabs": "Model · Permukaan · Rakit · Sisipkan · Inspeksi · Kelola · Tampilan","ui.workspace_drawing_description": "Gambar kerja 2D dengan tampilan, dimensi, dan title block","ui.workspace_footer": "Setiap workspace bekerja pada desain, riwayat, dan pilihan yang sama; hanya tab ribbon yang berubah. Pengalih terkunci saat sketsa atau fitur sedang diedit.",+ "ui.workspace_layout": "Tata letak ruang kerja","ui.workspace_manufacture_description": "Slicing, toolpath, dan setup","ui.workspace_planned": "Direncanakan","ui.workspace_render_description": "Pratinjau produk, pengaturan scene, dan gambar render",diff --git a/assets/locales/it.json b/assets/locales/it.jsonindex 5d18bc1772..6a772ff66f 100644--- a/assets/locales/it.json+++ b/assets/locales/it.json@@ -1096,6 +1096,7 @@"ui.agent_chat_add": "Allega file","ui.agent_chat_add_file": "Scegli un file…","ui.agent_chat_allow": "Consenti",+ "ui.agent_chat_allow_once": "Consenti una volta","ui.agent_chat_allowed": "Consentito","ui.agent_chat_answered": "Risposta: {option}","ui.agent_chat_approval": "Consentire questa azione all'agente?",@@ -1153,6 +1154,9 @@"ui.agent_chat_left": "Sinistra","ui.agent_chat_limit": "L'agente ha raggiunto il limite di {limit} modifiche per messaggio. Invia un altro messaggio per farlo proseguire.","ui.agent_chat_minimize": "Riduci a una striscia",+ "ui.agent_chat_mode_all": "Tutto",+ "ui.agent_chat_mode_ask": "Chiedi",+ "ui.agent_chat_mode_edits": "Modifiche","ui.agent_chat_model_tip": "Il modello usato dall'agente. La scelta viene memorizzata per questo agente.","ui.agent_chat_new": "Nuova chat","ui.agent_chat_new_confirm": "Avviare una nuova chat? Quella corrente verrà cancellata.",@@ -1165,6 +1169,7 @@"ui.agent_chat_none_found_short": "Nessun agente trovato","ui.agent_chat_not_installed": "Non installato","ui.agent_chat_not_signed_in": "accesso non effettuato",+ "ui.agent_chat_open_settings": "Apri preferenze","ui.agent_chat_own_window": "Finestra separata","ui.agent_chat_paste_picture": "Incolla un'immagine","ui.agent_chat_permission": "L'agente chiede di eseguire: {title}",@@ -1189,6 +1194,8 @@"ui.agent_chat_send": "Invia","ui.agent_chat_send_now": "Invia subito","ui.agent_chat_send_now_tip": "Interrompi il passo corrente dell'agente e invia questo messaggio come successivo (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft comunica con un agente di programmazione installato su questo computer. Scegline uno in Preferenze › IA.",+ "ui.agent_chat_setup_title": "Configura un assistente","ui.agent_chat_side": "Lato della chat con l'agente","ui.agent_chat_signed_in": "accesso effettuato","ui.agent_chat_state_auth": "Accesso richiesto",@@ -1205,6 +1212,7 @@"ui.agent_chat_undo_label": "Chat con l'agente: {message}","ui.agent_chat_undone": "(annullato)","ui.agent_chat_view_attached": "Vista allegata",+ "ui.agent_chat_waiting": "In attesa della tua risposta","ui.agent_cursor": "Cursore dell'agente","ui.agent_cursor_speed": "Velocità del cursore dell'agente","ui.ai_add": "Aggiungi",@@ -1554,6 +1562,8 @@"ui.joints": "Giunti","ui.keyboard_shortcuts": "Scorciatoie da tastiera","ui.language": "Lingua",+ "ui.layout_compact": "Compatta",+ "ui.layout_floating": "Flottante","ui.length_decimals": "Decimali delle lunghezze","ui.light": "Chiaro","ui.line": "Linea",@@ -1691,6 +1701,7 @@"ui.reverse_zoom_direction": "Inverti direzione dello zoom","ui.revolve": "Rivoluzione","ui.ribbon_exit": "Esci",+ "ui.ribbon_labels": "Mostra il testo sotto le icone della barra multifunzione","ui.ribbon_pin_footer": "I comandi fissati compaiono sulla barra multifunzione. Passa sopra una riga per fissarla o rimuoverla.","ui.ribbon_workspace": "Area di lavoro","ui.right": "Destra",@@ -1870,6 +1881,7 @@"ui.workspace_design_tabs": "Modello · Superficie · Assembla · Inserisci · Ispeziona · Gestisci · Vista","ui.workspace_drawing_description": "Disegni 2D con viste, quote e cartigli","ui.workspace_footer": "Ogni area di lavoro opera sullo stesso progetto, cronologia e selezione; cambiano solo le schede della barra multifunzione. Il selettore è bloccato durante la modifica di uno schizzo o di una feature.",+ "ui.workspace_layout": "Disposizione dello spazio di lavoro","ui.workspace_manufacture_description": "Slicing, percorsi utensile e impostazione","ui.workspace_planned": "Pianificata","ui.workspace_render_description": "Anteprima del prodotto, impostazioni della scena e immagini renderizzate",diff --git a/assets/locales/ja.json b/assets/locales/ja.jsonindex a089aa8ebb..697c151017 100644--- a/assets/locales/ja.json+++ b/assets/locales/ja.json@@ -1127,6 +1127,7 @@"ui.agent_chat_add": "ファイルを添付","ui.agent_chat_add_file": "ファイルを選択…","ui.agent_chat_allow": "許可",+ "ui.agent_chat_allow_once": "今回のみ許可","ui.agent_chat_allowed": "許可しました","ui.agent_chat_answered": "回答: {option}","ui.agent_chat_approval": "エージェントにこの操作を許可しますか?",@@ -1184,6 +1185,9 @@"ui.agent_chat_left": "左","ui.agent_chat_limit": "エージェントが1メッセージあたりの変更上限 {limit} に達しました。続けさせるには、もう一度メッセージを送ってください。","ui.agent_chat_minimize": "細いバーに最小化",+ "ui.agent_chat_mode_all": "すべて",+ "ui.agent_chat_mode_ask": "確認",+ "ui.agent_chat_mode_edits": "編集","ui.agent_chat_model_tip": "エージェントが使うモデル。選択はこのエージェントに対して記憶されます。","ui.agent_chat_new": "新しいチャット","ui.agent_chat_new_confirm": "新しいチャットを始めますか? 現在のチャットは消去されます。",@@ -1196,6 +1200,7 @@"ui.agent_chat_none_found_short": "エージェントが見つかりません","ui.agent_chat_not_installed": "未インストール","ui.agent_chat_not_signed_in": "未サインイン",+ "ui.agent_chat_open_settings": "環境設定を開く","ui.agent_chat_own_window": "独立したウィンドウ","ui.agent_chat_paste_picture": "画像を貼り付け","ui.agent_chat_permission": "エージェントが実行の許可を求めています: {title}",@@ -1220,6 +1225,8 @@"ui.agent_chat_send": "送信","ui.agent_chat_send_now": "今すぐ送信","ui.agent_chat_send_now_tip": "エージェントの現在のステップを止めて、これを次に送信します(Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft は、このコンピューターにインストールされたコーディングエージェントと連携します。「環境設定 › AI」で選択してください。",+ "ui.agent_chat_setup_title": "アシスタントを設定","ui.agent_chat_side": "エージェントチャットの位置","ui.agent_chat_signed_in": "サインイン済み","ui.agent_chat_state_auth": "サインインが必要",@@ -1236,6 +1243,7 @@"ui.agent_chat_undo_label": "エージェントチャット: {message}","ui.agent_chat_undone": "(元に戻しました)","ui.agent_chat_view_attached": "ビューを添付済み",+ "ui.agent_chat_waiting": "確認待ち","ui.agent_cursor": "エージェントカーソル","ui.agent_cursor_speed": "エージェントカーソル速度","ui.agent_off_thread": "エージェントのコマンド実行中もウィンドウを操作可能にする",@@ -1594,6 +1602,8 @@"ui.joints": "ジョイント","ui.keyboard_shortcuts": "キーボードショートカット","ui.language": "言語",+ "ui.layout_compact": "コンパクト",+ "ui.layout_floating": "フローティング","ui.length_decimals": "長さの小数点以下の桁数","ui.light": "ライト","ui.line": "線分",@@ -1731,6 +1741,7 @@"ui.reverse_zoom_direction": "ズーム方向を反転","ui.revolve": "回転","ui.ribbon_exit": "終了",+ "ui.ribbon_labels": "リボンのアイコンの下にテキストを表示","ui.ribbon_pin_footer": "ピン留めしたコマンドはリボンに表示されます。行にポインターを合わせて、ピン留めや解除ができます。","ui.ribbon_workspace": "ワークスペース","ui.right": "右側面",@@ -1910,6 +1921,7 @@"ui.workspace_design_tabs": "モデル · サーフェス · アセンブリ · 挿入 · 検査 · 管理 · 表示","ui.workspace_drawing_description": "ビュー、寸法、表題欄を含む2D図面","ui.workspace_footer": "すべてのワークスペースで同じデザイン、履歴、選択を使用し、リボンのタブだけが変わります。スケッチやフィーチャーの編集中は切り替えできません。",+ "ui.workspace_layout": "ワークスペースのレイアウト","ui.workspace_manufacture_description": "スライス、ツールパス、セットアップ","ui.workspace_planned": "予定","ui.workspace_render_description": "製品プレビュー、シーン設定、レンダリング画像",diff --git a/assets/locales/ko.json b/assets/locales/ko.jsonindex b08c59f345..dcd9382603 100644--- a/assets/locales/ko.json+++ b/assets/locales/ko.json@@ -1097,6 +1097,7 @@"ui.agent_chat_add": "파일 첨부","ui.agent_chat_add_file": "파일 선택…","ui.agent_chat_allow": "허용",+ "ui.agent_chat_allow_once": "한 번 허용","ui.agent_chat_allowed": "허용함","ui.agent_chat_answered": "응답: {option}","ui.agent_chat_approval": "에이전트가 이 작업을 하도록 허용할까요?",@@ -1154,6 +1155,9 @@"ui.agent_chat_left": "왼쪽","ui.agent_chat_limit": "에이전트가 메시지당 변경 한도 {limit}에 도달했습니다. 계속하게 하려면 메시지를 하나 더 보내세요.","ui.agent_chat_minimize": "얇은 막대로 최소화",+ "ui.agent_chat_mode_all": "모두",+ "ui.agent_chat_mode_ask": "확인",+ "ui.agent_chat_mode_edits": "편집","ui.agent_chat_model_tip": "에이전트가 사용하는 모델입니다. 선택은 이 에이전트에 기억됩니다.","ui.agent_chat_new": "새 채팅","ui.agent_chat_new_confirm": "새 채팅을 시작할까요? 현재 채팅은 지워집니다.",@@ -1166,6 +1170,7 @@"ui.agent_chat_none_found_short": "에이전트를 찾지 못함","ui.agent_chat_not_installed": "설치되지 않음","ui.agent_chat_not_signed_in": "로그인 안 됨",+ "ui.agent_chat_open_settings": "환경 설정 열기","ui.agent_chat_own_window": "별도 창","ui.agent_chat_paste_picture": "이미지 붙여넣기","ui.agent_chat_permission": "에이전트가 실행 허락을 요청합니다: {title}",@@ -1190,6 +1195,8 @@"ui.agent_chat_send": "보내기","ui.agent_chat_send_now": "지금 보내기","ui.agent_chat_send_now_tip": "에이전트의 현재 단계를 중지하고 이것을 다음으로 보냅니다 (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft는 이 컴퓨터에 설치된 코딩 에이전트와 통신합니다. 환경 설정 › AI에서 에이전트를 선택하세요.",+ "ui.agent_chat_setup_title": "어시스턴트 설정","ui.agent_chat_side": "에이전트 채팅 위치","ui.agent_chat_signed_in": "로그인됨","ui.agent_chat_state_auth": "로그인 필요",@@ -1206,6 +1213,7 @@"ui.agent_chat_undo_label": "에이전트 채팅: {message}","ui.agent_chat_undone": "(취소됨)","ui.agent_chat_view_attached": "뷰 첨부됨",+ "ui.agent_chat_waiting": "확인 대기 중","ui.agent_cursor": "에이전트 커서","ui.agent_cursor_speed": "에이전트 커서 속도","ui.ai_add": "추가",@@ -1555,6 +1563,8 @@"ui.joints": "조인트","ui.keyboard_shortcuts": "키보드 단축키","ui.language": "언어",+ "ui.layout_compact": "컴팩트",+ "ui.layout_floating": "플로팅","ui.length_decimals": "길이 소수점 자릿수","ui.light": "밝게","ui.line": "선",@@ -1692,6 +1702,7 @@"ui.reverse_zoom_direction": "확대/축소 방향 반전","ui.revolve": "회전","ui.ribbon_exit": "종료",+ "ui.ribbon_labels": "리본 아이콘 아래에 텍스트 표시","ui.ribbon_pin_footer": "고정된 명령은 리본에 표시됩니다. 행 위에 마우스를 올려 고정하거나 해제하세요.","ui.ribbon_workspace": "작업 공간","ui.right": "우측면",@@ -1871,6 +1882,7 @@"ui.workspace_design_tabs": "모델 · 곡면 · 조립 · 삽입 · 검사 · 관리 · 보기","ui.workspace_drawing_description": "뷰, 치수, 표제란이 있는 2D 도면","ui.workspace_footer": "모든 작업 공간은 같은 디자인, 히스토리, 선택 항목에서 작동하며 리본 탭만 바뀝니다. 스케치나 피처를 편집하는 동안에는 전환기가 잠깁니다.",+ "ui.workspace_layout": "작업 공간 레이아웃","ui.workspace_manufacture_description": "슬라이싱, 툴패스 및 설정","ui.workspace_planned": "예정","ui.workspace_render_description": "제품 미리보기, 장면 설정 및 렌더링 이미지",diff --git a/assets/locales/ms.json b/assets/locales/ms.jsonindex ea47d78cdf..e1d38cf7ae 100644--- a/assets/locales/ms.json+++ b/assets/locales/ms.json@@ -1093,6 +1093,7 @@"ui.agent_chat_add": "Lampirkan fail","ui.agent_chat_add_file": "Pilih fail…","ui.agent_chat_allow": "Benarkan",+ "ui.agent_chat_allow_once": "Benarkan sekali","ui.agent_chat_allowed": "Dibenarkan","ui.agent_chat_answered": "Jawapan: {option}","ui.agent_chat_approval": "Benarkan ejen melakukan ini?",@@ -1150,6 +1151,9 @@"ui.agent_chat_left": "Kiri","ui.agent_chat_limit": "Ejen telah mencapai had {limit} perubahan untuk satu mesej. Hantar mesej lain untuk meneruskan.","ui.agent_chat_minimize": "Kecilkan kepada bar",+ "ui.agent_chat_mode_all": "Semua",+ "ui.agent_chat_mode_ask": "Tanya",+ "ui.agent_chat_mode_edits": "Suntingan","ui.agent_chat_model_tip": "Model yang digunakan oleh ejen. Pilihan anda disimpan untuk ejen ini.","ui.agent_chat_new": "Sembang baharu","ui.agent_chat_new_confirm": "Mulakan sembang baharu? Sembang semasa akan dikosongkan.",@@ -1162,6 +1166,7 @@"ui.agent_chat_none_found_short": "Tiada ejen ditemui","ui.agent_chat_not_installed": "Tidak dipasang","ui.agent_chat_not_signed_in": "belum log masuk",+ "ui.agent_chat_open_settings": "Buka tetapan","ui.agent_chat_own_window": "Tetingkap sendiri","ui.agent_chat_paste_picture": "Tampal gambar","ui.agent_chat_permission": "Benarkan ejen jalankan: {title}",@@ -1186,6 +1191,8 @@"ui.agent_chat_send": "Hantar","ui.agent_chat_send_now": "Hantar terus","ui.agent_chat_send_now_tip": "Hentikan langkah semasa ejen dan hantar mesej ini selepas itu (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft berkomunikasi dengan ejen pengekodan yang dipasang pada komputer ini. Pilih ejen dalam Tetapan › AI.",+ "ui.agent_chat_setup_title": "Sediakan pembantu","ui.agent_chat_side": "Sisi sembang ejen","ui.agent_chat_signed_in": "sudah log masuk","ui.agent_chat_state_auth": "Perlu log masuk",@@ -1202,6 +1209,7 @@"ui.agent_chat_undo_label": "Sembang ejen: {message}","ui.agent_chat_undone": "(dibatalkan)","ui.agent_chat_view_attached": "Paparan dilampirkan",+ "ui.agent_chat_waiting": "Menunggu anda","ui.agent_cursor": "Kursor ejen","ui.agent_cursor_speed": "Kelajuan kursor ejen","ui.ai_add": "Tambah",@@ -1551,6 +1559,8 @@"ui.joints": "Sendi","ui.keyboard_shortcuts": "Pintasan Kekunci","ui.language": "Bahasa",+ "ui.layout_compact": "Padat",+ "ui.layout_floating": "Terapung","ui.length_decimals": "Perpuluhan panjang","ui.light": "Cerah","ui.line": "Garis",@@ -1688,6 +1698,7 @@"ui.reverse_zoom_direction": "Songsangkan arah zum","ui.revolve": "Putar","ui.ribbon_exit": "Keluar",+ "ui.ribbon_labels": "Tunjukkan teks di bawah ikon reben","ui.ribbon_pin_footer": "Arahan tersemat dipaparkan pada reben. Lalukan tetikus pada baris untuk menyemat atau menyahsemat.","ui.ribbon_workspace": "Ruang kerja","ui.right": "Kanan",@@ -1842,6 +1853,7 @@"ui.workspace_design_tabs": "Model · Permukaan · Pasang · Sisip · Periksa · Urus · Pandangan","ui.workspace_drawing_description": "Lukisan 2D dengan pandangan, dimensi dan blok tajuk","ui.workspace_footer": "Setiap ruang kerja berfungsi pada reka bentuk, sejarah dan pilihan yang sama; hanya tab reben berubah. Penukar dikunci semasa lakaran atau ciri sedang disunting.",+ "ui.workspace_layout": "Susun atur ruang kerja","ui.workspace_manufacture_description": "Pemotongan lapisan, laluan alat dan persediaan","ui.workspace_planned": "Dirancang","ui.workspace_render_description": "Pratonton produk, tetapan adegan dan imej render",diff --git a/assets/locales/nl.json b/assets/locales/nl.jsonindex a61476c96f..ab69c00dbd 100644--- a/assets/locales/nl.json+++ b/assets/locales/nl.json@@ -1092,6 +1092,7 @@"ui.agent_chat_add": "Bestanden bijvoegen","ui.agent_chat_add_file": "Een bestand kiezen…","ui.agent_chat_allow": "Toestaan",+ "ui.agent_chat_allow_once": "Eenmalig toestaan","ui.agent_chat_allowed": "Toegestaan","ui.agent_chat_answered": "Antwoord: {option}","ui.agent_chat_approval": "De agent dit laten doen?",@@ -1149,6 +1150,9 @@"ui.agent_chat_left": "Links","ui.agent_chat_limit": "De agent heeft de limiet van {limit} wijzigingen voor één bericht bereikt. Stuur nog een bericht om hem verder te laten gaan.","ui.agent_chat_minimize": "Minimaliseren tot een strook",+ "ui.agent_chat_mode_all": "Alles",+ "ui.agent_chat_mode_ask": "Vragen",+ "ui.agent_chat_mode_edits": "Bewerken","ui.agent_chat_model_tip": "Het model dat de agent gebruikt. Uw keuze wordt voor deze agent onthouden.","ui.agent_chat_new": "Nieuwe chat","ui.agent_chat_new_confirm": "Een nieuwe chat starten? De huidige wordt gewist.",@@ -1161,6 +1165,7 @@"ui.agent_chat_none_found_short": "Geen agent gevonden","ui.agent_chat_not_installed": "Niet geïnstalleerd","ui.agent_chat_not_signed_in": "niet aangemeld",+ "ui.agent_chat_open_settings": "Voorkeuren openen","ui.agent_chat_own_window": "Eigen venster","ui.agent_chat_paste_picture": "Een afbeelding plakken","ui.agent_chat_permission": "De agent vraagt om uit te voeren: {title}",@@ -1185,6 +1190,8 @@"ui.agent_chat_send": "Verzenden","ui.agent_chat_send_now": "Nu verzenden","ui.agent_chat_send_now_tip": "De huidige stap van de agent stoppen en dit nu verzenden (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft communiceert met een programmeeragent die op deze computer is geïnstalleerd. Kies er een via Voorkeuren › AI.",+ "ui.agent_chat_setup_title": "Een assistent instellen","ui.agent_chat_side": "Zijde van agentchat","ui.agent_chat_signed_in": "aangemeld","ui.agent_chat_state_auth": "Aanmelden vereist",@@ -1201,6 +1208,7 @@"ui.agent_chat_undo_label": "Agentchat: {message}","ui.agent_chat_undone": "(ongedaan gemaakt)","ui.agent_chat_view_attached": "Weergave bijgevoegd",+ "ui.agent_chat_waiting": "Wacht op jou","ui.agent_cursor": "Agentcursor","ui.agent_cursor_speed": "Snelheid agentcursor","ui.ai_add": "Toevoegen",@@ -1550,6 +1558,8 @@"ui.joints": "Verbindingen","ui.keyboard_shortcuts": "Sneltoetsen","ui.language": "Taal",+ "ui.layout_compact": "Compact",+ "ui.layout_floating": "Zwevend","ui.length_decimals": "Lengtedecimalen","ui.light": "Licht","ui.line": "Lijn",@@ -1687,6 +1697,7 @@"ui.reverse_zoom_direction": "Zoomrichting omkeren","ui.revolve": "Revolve","ui.ribbon_exit": "Afsluiten",+ "ui.ribbon_labels": "Tekst onder lintpictogrammen tonen","ui.ribbon_pin_footer": "Vastgepinde opdrachten verschijnen in het lint. Beweeg over een rij om vast te pinnen of los te maken.","ui.ribbon_workspace": "Werkruimte","ui.right": "Rechts",@@ -1841,6 +1852,7 @@"ui.workspace_design_tabs": "Model · Oppervlak · Assembleren · Invoegen · Inspecteren · Beheren · Beeld","ui.workspace_drawing_description": "2D-tekeningen met weergaven, maatvoering en titelblokken","ui.workspace_footer": "Elke werkruimte werkt op hetzelfde ontwerp, dezelfde geschiedenis en selectie; alleen de lintabbladen veranderen. De schakelaar is vergrendeld terwijl een schets of kenmerk wordt bewerkt.",+ "ui.workspace_layout": "Werkruimte-indeling","ui.workspace_manufacture_description": "Slicen, gereedschapspaden en opstelling","ui.workspace_planned": "Gepland","ui.workspace_render_description": "Productvoorbeeld, sceneinstellingen en gerenderde afbeeldingen",diff --git a/assets/locales/pl.json b/assets/locales/pl.jsonindex 4ca63d1205..d0577f54a6 100644--- a/assets/locales/pl.json+++ b/assets/locales/pl.json@@ -1093,6 +1093,7 @@"ui.agent_chat_add": "Załącz pliki","ui.agent_chat_add_file": "Wybierz plik…","ui.agent_chat_allow": "Zezwól",+ "ui.agent_chat_allow_once": "Zezwól raz","ui.agent_chat_allowed": "Zezwolono","ui.agent_chat_answered": "Odpowiedź: {option}","ui.agent_chat_approval": "Zezwolić agentowi na to działanie?",@@ -1150,6 +1151,9 @@"ui.agent_chat_left": "Lewa","ui.agent_chat_limit": "Agent osiągnął limit {limit} zmian na jedną wiadomość. Wyślij kolejną wiadomość, aby mógł kontynuować.","ui.agent_chat_minimize": "Zminimalizuj do paska",+ "ui.agent_chat_mode_all": "Wszystko",+ "ui.agent_chat_mode_ask": "Pytaj",+ "ui.agent_chat_mode_edits": "Edycje","ui.agent_chat_model_tip": "Model używany przez agenta. Twój wybór jest zapamiętywany dla tego agenta.","ui.agent_chat_new": "Nowy czat","ui.agent_chat_new_confirm": "Rozpocząć nowy czat? Bieżący zostanie wyczyszczony.",@@ -1162,6 +1166,7 @@"ui.agent_chat_none_found_short": "Nie znaleziono agenta","ui.agent_chat_not_installed": "Nie zainstalowano","ui.agent_chat_not_signed_in": "nie zalogowano",+ "ui.agent_chat_open_settings": "Otwórz preferencje","ui.agent_chat_own_window": "Osobne okno","ui.agent_chat_paste_picture": "Wklej obraz","ui.agent_chat_permission": "Agent prosi o uruchomienie: {title}",@@ -1186,6 +1191,8 @@"ui.agent_chat_send": "Wyślij","ui.agent_chat_send_now": "Wyślij teraz","ui.agent_chat_send_now_tip": "Zatrzymaj bieżący krok agenta i wyślij tę wiadomość jako następną (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft komunikuje się z agentem programistycznym zainstalowanym na tym komputerze. Wybierz go w Preferencje › AI.",+ "ui.agent_chat_setup_title": "Skonfiguruj asystenta","ui.agent_chat_side": "Strona czatu z agentem","ui.agent_chat_signed_in": "zalogowano","ui.agent_chat_state_auth": "Wymagane logowanie",@@ -1202,6 +1209,7 @@"ui.agent_chat_undo_label": "Czat z agentem: {message}","ui.agent_chat_undone": "(cofnięto)","ui.agent_chat_view_attached": "Dołączono widok",+ "ui.agent_chat_waiting": "Czeka na Ciebie","ui.agent_cursor": "Kursor agenta","ui.agent_cursor_speed": "Szybkość kursora agenta","ui.ai_add": "Dodaj",@@ -1551,6 +1559,8 @@"ui.joints": "Złącza","ui.keyboard_shortcuts": "Skróty klawiszowe","ui.language": "Język",+ "ui.layout_compact": "Kompaktowy",+ "ui.layout_floating": "Pływający","ui.length_decimals": "Miejsca dziesiętne długości","ui.light": "Jasny","ui.line": "Linia",@@ -1688,6 +1698,7 @@"ui.reverse_zoom_direction": "Odwróć kierunek powiększania","ui.revolve": "Obrót","ui.ribbon_exit": "Wyjdź",+ "ui.ribbon_labels": "Pokazuj tekst pod ikonami wstążki","ui.ribbon_pin_footer": "Przypięte polecenia są widoczne na wstążce. Najedź na wiersz, aby go przypiąć lub odpiąć.","ui.ribbon_workspace": "Przestrzeń robocza","ui.right": "Prawy",@@ -1842,6 +1853,7 @@"ui.workspace_design_tabs": "Model · Powierzchnia · Złożenie · Wstaw · Sprawdź · Zarządzaj · Widok","ui.workspace_drawing_description": "Rysunki 2D z widokami, wymiarami i tabliczkami rysunkowymi","ui.workspace_footer": "Każda przestrzeń robocza działa na tym samym projekcie, historii i zaznaczeniu; zmieniają się tylko karty wstążki. Przełącznik jest zablokowany podczas edycji szkicu lub elementu.",+ "ui.workspace_layout": "Układ obszaru roboczego","ui.workspace_manufacture_description": "Cięcie na warstwy, ścieżki narzędzia i przygotowanie","ui.workspace_planned": "Planowane","ui.workspace_render_description": "Podgląd produktu, ustawienia sceny i renderowane obrazy",diff --git a/assets/locales/pt-BR.json b/assets/locales/pt-BR.jsonindex 7953322334..9416e1ecac 100644--- a/assets/locales/pt-BR.json+++ b/assets/locales/pt-BR.json@@ -1093,6 +1093,7 @@"ui.agent_chat_add": "Anexar arquivos","ui.agent_chat_add_file": "Escolher um arquivo…","ui.agent_chat_allow": "Permitir",+ "ui.agent_chat_allow_once": "Permitir uma vez","ui.agent_chat_allowed": "Permitido","ui.agent_chat_answered": "Resposta: {option}","ui.agent_chat_approval": "Permitir que o agente faça isto?",@@ -1150,6 +1151,9 @@"ui.agent_chat_left": "Esquerda","ui.agent_chat_limit": "O agente atingiu o limite de {limit} alterações por mensagem. Envie outra mensagem para que ele continue.","ui.agent_chat_minimize": "Minimizar para uma faixa",+ "ui.agent_chat_mode_all": "Tudo",+ "ui.agent_chat_mode_ask": "Perguntar",+ "ui.agent_chat_mode_edits": "Edições","ui.agent_chat_model_tip": "O modelo que o agente usa. Sua escolha é lembrada para este agente.","ui.agent_chat_new": "Novo chat","ui.agent_chat_new_confirm": "Começar um novo chat? O atual será apagado.",@@ -1162,6 +1166,7 @@"ui.agent_chat_none_found_short": "Nenhum agente encontrado","ui.agent_chat_not_installed": "Não instalado","ui.agent_chat_not_signed_in": "não conectado",+ "ui.agent_chat_open_settings": "Abrir preferências","ui.agent_chat_own_window": "Janela própria","ui.agent_chat_paste_picture": "Colar uma imagem","ui.agent_chat_permission": "O agente pede para executar: {title}",@@ -1186,6 +1191,8 @@"ui.agent_chat_send": "Enviar","ui.agent_chat_send_now": "Enviar agora","ui.agent_chat_send_now_tip": "Parar o passo atual do agente e enviar esta em seguida (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "O SolidCraft se comunica com um agente de programação instalado neste computador. Escolha um em Preferências › IA.",+ "ui.agent_chat_setup_title": "Configurar um assistente","ui.agent_chat_side": "Lado do chat com agente","ui.agent_chat_signed_in": "conectado","ui.agent_chat_state_auth": "É preciso entrar",@@ -1202,6 +1209,7 @@"ui.agent_chat_undo_label": "Chat com agente: {message}","ui.agent_chat_undone": "(desfeito)","ui.agent_chat_view_attached": "Vista anexada",+ "ui.agent_chat_waiting": "Aguardando sua resposta","ui.agent_cursor": "Cursor do agente","ui.agent_cursor_speed": "Velocidade do cursor do agente","ui.ai_add": "Adicionar",@@ -1551,6 +1559,8 @@"ui.joints": "Juntas","ui.keyboard_shortcuts": "Atalhos de teclado","ui.language": "Idioma",+ "ui.layout_compact": "Compacto",+ "ui.layout_floating": "Flutuante","ui.length_decimals": "Casas decimais de comprimento","ui.light": "Claro","ui.line": "Linha",@@ -1688,6 +1698,7 @@"ui.reverse_zoom_direction": "Inverter direção do zoom","ui.revolve": "Revolução","ui.ribbon_exit": "Sair",+ "ui.ribbon_labels": "Mostrar texto abaixo dos ícones da faixa de opções","ui.ribbon_pin_footer": "Os comandos fixados aparecem na faixa de opções. Passe o mouse sobre uma linha para fixar ou desafixar.","ui.ribbon_workspace": "Espaço de trabalho","ui.right": "Direita",@@ -1867,6 +1878,7 @@"ui.workspace_design_tabs": "Modelo · Superfície · Montagem · Inserir · Inspecionar · Gerenciar · Vista","ui.workspace_drawing_description": "Desenhos 2D com vistas, cotas e legendas","ui.workspace_footer": "Todo espaço de trabalho usa o mesmo projeto, histórico e seleção; só as guias da faixa de opções mudam. O seletor fica bloqueado enquanto um esboço ou recurso está sendo editado.",+ "ui.workspace_layout": "Layout do espaço de trabalho","ui.workspace_manufacture_description": "Fatiamento, trajetórias de ferramenta e configuração","ui.workspace_planned": "Planejado","ui.workspace_render_description": "Pré-visualização do produto, configurações de cena e imagens renderizadas",diff --git a/assets/locales/ro.json b/assets/locales/ro.jsonindex e62ec4590c..05fb3a9ccd 100644--- a/assets/locales/ro.json+++ b/assets/locales/ro.json@@ -1092,6 +1092,7 @@"ui.agent_chat_add": "Atașează fișiere","ui.agent_chat_add_file": "Alegeți un fișier…","ui.agent_chat_allow": "Permite",+ "ui.agent_chat_allow_once": "Permite o dată","ui.agent_chat_allowed": "Permis","ui.agent_chat_answered": "Răspuns: {option}","ui.agent_chat_approval": "Permiteți agentului să facă asta?",@@ -1149,6 +1150,9 @@"ui.agent_chat_left": "Stânga","ui.agent_chat_limit": "Agentul a atins limita de {limit} modificări pentru un mesaj. Trimiteți alt mesaj pentru a-l lăsa să continue.","ui.agent_chat_minimize": "Minimizează într-o bandă",+ "ui.agent_chat_mode_all": "Tot",+ "ui.agent_chat_mode_ask": "Întreabă",+ "ui.agent_chat_mode_edits": "Modificări","ui.agent_chat_model_tip": "Modelul folosit de agent. Alegerea dumneavoastră este reținută pentru acest agent.","ui.agent_chat_new": "Chat nou","ui.agent_chat_new_confirm": "Începeți un chat nou? Cel curent este șters.",@@ -1161,6 +1165,7 @@"ui.agent_chat_none_found_short": "Niciun agent găsit","ui.agent_chat_not_installed": "Neinstalat","ui.agent_chat_not_signed_in": "neautentificat",+ "ui.agent_chat_open_settings": "Deschide preferințele","ui.agent_chat_own_window": "Fereastră proprie","ui.agent_chat_paste_picture": "Lipește o imagine","ui.agent_chat_permission": "Agentul cere să ruleze: {title}",@@ -1185,6 +1190,8 @@"ui.agent_chat_send": "Trimite","ui.agent_chat_send_now": "Trimite acum","ui.agent_chat_send_now_tip": "Oprește pasul curent al agentului și trimite acest mesaj următorul (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft comunică cu un agent de programare instalat pe acest computer. Alege unul în Preferințe › AI.",+ "ui.agent_chat_setup_title": "Configurează un asistent","ui.agent_chat_side": "Partea chatului cu agentul","ui.agent_chat_signed_in": "autentificat","ui.agent_chat_state_auth": "Autentificare necesară",@@ -1201,6 +1208,7 @@"ui.agent_chat_undo_label": "Chat cu agentul: {message}","ui.agent_chat_undone": "(anulat)","ui.agent_chat_view_attached": "Vizualizare atașată",+ "ui.agent_chat_waiting": "Așteaptă răspunsul tău","ui.agent_cursor": "Cursorul agentului","ui.agent_cursor_speed": "Viteza cursorului agentului","ui.ai_add": "Adaugă",@@ -1550,6 +1558,8 @@"ui.joints": "Îmbinări","ui.keyboard_shortcuts": "Scurtături de tastatură","ui.language": "Limbă",+ "ui.layout_compact": "Compact",+ "ui.layout_floating": "Plutitor","ui.length_decimals": "Zecimale lungime","ui.light": "Luminos","ui.line": "Linie",@@ -1687,6 +1697,7 @@"ui.reverse_zoom_direction": "Inversează direcția zoomului","ui.revolve": "Revoluție","ui.ribbon_exit": "Ieșire",+ "ui.ribbon_labels": "Afișează text sub pictogramele panglicii","ui.ribbon_pin_footer": "Comenzile fixate apar pe bandă. Treceți cursorul peste un rând pentru a-l fixa sau defixa.","ui.ribbon_workspace": "Spațiu de lucru","ui.right": "Dreapta",@@ -1841,6 +1852,7 @@"ui.workspace_design_tabs": "Model · Suprafață · Asamblare · Inserare · Inspectare · Gestionare · Vizualizare","ui.workspace_drawing_description": "Desene 2D cu vederi, cote și indicatoare","ui.workspace_footer": "Fiecare spațiu de lucru lucrează pe același proiect, istoric și selecție; se schimbă doar filele benzii. Comutatorul este blocat cât timp se editează o schiță sau o operație.",+ "ui.workspace_layout": "Aspectul spațiului de lucru","ui.workspace_manufacture_description": "Feliere, trasee de sculă și configurare","ui.workspace_planned": "Planificat","ui.workspace_render_description": "Previzualizare produs, setări de scenă și imagini randate",diff --git a/assets/locales/ru.json b/assets/locales/ru.jsonindex bc45bb01d0..6ce9b280fc 100644--- a/assets/locales/ru.json+++ b/assets/locales/ru.json@@ -1092,6 +1092,7 @@"ui.agent_chat_add": "Прикрепить файлы","ui.agent_chat_add_file": "Выбрать файл…","ui.agent_chat_allow": "Разрешить",+ "ui.agent_chat_allow_once": "Разрешить один раз","ui.agent_chat_allowed": "Разрешено","ui.agent_chat_answered": "Ответ: {option}","ui.agent_chat_approval": "Разрешить агенту сделать это?",@@ -1149,6 +1150,9 @@"ui.agent_chat_left": "Слева","ui.agent_chat_limit": "Агент достиг предела в {limit} изменений на одно сообщение. Отправьте ещё одно сообщение, чтобы он продолжил.","ui.agent_chat_minimize": "Свернуть в полосу",+ "ui.agent_chat_mode_all": "Всё",+ "ui.agent_chat_mode_ask": "Спросить",+ "ui.agent_chat_mode_edits": "Правки","ui.agent_chat_model_tip": "Модель, которую использует агент. Ваш выбор запоминается для этого агента.","ui.agent_chat_new": "Новый чат","ui.agent_chat_new_confirm": "Начать новый чат? Текущий будет очищен.",@@ -1161,6 +1165,7 @@"ui.agent_chat_none_found_short": "Агент не найден","ui.agent_chat_not_installed": "Не установлен","ui.agent_chat_not_signed_in": "вход не выполнен",+ "ui.agent_chat_open_settings": "Открыть настройки","ui.agent_chat_own_window": "Отдельное окно","ui.agent_chat_paste_picture": "Вставить изображение","ui.agent_chat_permission": "Агент просит выполнить: {title}",@@ -1185,6 +1190,8 @@"ui.agent_chat_send": "Отправить","ui.agent_chat_send_now": "Отправить сейчас","ui.agent_chat_send_now_tip": "Остановить текущий шаг агента и отправить это следующим (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft взаимодействует с агентом программирования, установленным на этом компьютере. Выберите его в разделе «Настройки › ИИ».",+ "ui.agent_chat_setup_title": "Настроить ассистента","ui.agent_chat_side": "Сторона чата с агентом","ui.agent_chat_signed_in": "вход выполнен","ui.agent_chat_state_auth": "Требуется вход",@@ -1201,6 +1208,7 @@"ui.agent_chat_undo_label": "Чат с агентом: {message}","ui.agent_chat_undone": "(отменено)","ui.agent_chat_view_attached": "Вид прикреплён",+ "ui.agent_chat_waiting": "Ожидает вашего ответа","ui.agent_cursor": "Курсор агента","ui.agent_cursor_speed": "Скорость курсора агента","ui.ai_add": "Добавить",@@ -1550,6 +1558,8 @@"ui.joints": "Сопряжения","ui.keyboard_shortcuts": "Сочетания клавиш","ui.language": "Язык",+ "ui.layout_compact": "Компактная",+ "ui.layout_floating": "Плавающая","ui.length_decimals": "Знаков после запятой (длины)","ui.light": "Светлая","ui.line": "Линия",@@ -1687,6 +1697,7 @@"ui.reverse_zoom_direction": "Обратить направление масштабирования","ui.revolve": "Вращение","ui.ribbon_exit": "Выход",+ "ui.ribbon_labels": "Показывать текст под значками ленты","ui.ribbon_pin_footer": "Закреплённые команды отображаются на ленте. Наведите курсор на строку, чтобы закрепить или открепить её.","ui.ribbon_workspace": "Рабочая область","ui.right": "Справа",@@ -1866,6 +1877,7 @@"ui.workspace_design_tabs": "Модель · Поверхность · Сборка · Вставка · Проверка · Управление · Вид","ui.workspace_drawing_description": "2D-чертежи с видами, размерами и основными надписями","ui.workspace_footer": "Все рабочие среды работают с одним дизайном, историей и выбором; меняются только вкладки ленты. Переключатель заблокирован, пока редактируется эскиз или операция.",+ "ui.workspace_layout": "Компоновка рабочей области","ui.workspace_manufacture_description": "Слайсинг, траектории инструмента и наладка","ui.workspace_planned": "Запланировано","ui.workspace_render_description": "Предпросмотр изделия, настройки сцены и отрендеренные изображения",diff --git a/assets/locales/sv.json b/assets/locales/sv.jsonindex 1190c74632..2cc4f221ca 100644--- a/assets/locales/sv.json+++ b/assets/locales/sv.json@@ -1092,6 +1092,7 @@"ui.agent_chat_add": "Bifoga filer","ui.agent_chat_add_file": "Välj en fil…","ui.agent_chat_allow": "Tillåt",+ "ui.agent_chat_allow_once": "Tillåt en gång","ui.agent_chat_allowed": "Tillåten","ui.agent_chat_answered": "Svar: {option}","ui.agent_chat_approval": "Tillåta agenten att göra detta?",@@ -1149,6 +1150,9 @@"ui.agent_chat_left": "Vänster","ui.agent_chat_limit": "Agenten nådde gränsen på {limit} ändringar för ett meddelande. Skicka ett nytt meddelande så att den kan fortsätta.","ui.agent_chat_minimize": "Minimera till ett fält",+ "ui.agent_chat_mode_all": "Allt",+ "ui.agent_chat_mode_ask": "Fråga",+ "ui.agent_chat_mode_edits": "Ändringar","ui.agent_chat_model_tip": "Modellen som agenten använder. Ditt val kommer ihåg för den här agenten.","ui.agent_chat_new": "Ny chatt","ui.agent_chat_new_confirm": "Starta en ny chatt? Den nuvarande rensas.",@@ -1161,6 +1165,7 @@"ui.agent_chat_none_found_short": "Ingen agent hittades","ui.agent_chat_not_installed": "Inte installerad","ui.agent_chat_not_signed_in": "inte inloggad",+ "ui.agent_chat_open_settings": "Öppna inställningar","ui.agent_chat_own_window": "Eget fönster","ui.agent_chat_paste_picture": "Klistra in en bild","ui.agent_chat_permission": "Agenten ber om att få köra: {title}",@@ -1185,6 +1190,8 @@"ui.agent_chat_send": "Skicka","ui.agent_chat_send_now": "Skicka nu","ui.agent_chat_send_now_tip": "Stoppa agentens nuvarande steg och skicka detta härnäst (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft kommunicerar med en kodningsagent som är installerad på den här datorn. Välj en under Inställningar › AI.",+ "ui.agent_chat_setup_title": "Konfigurera en assistent","ui.agent_chat_side": "Agentchattens sida","ui.agent_chat_signed_in": "inloggad","ui.agent_chat_state_auth": "Inloggning krävs",@@ -1201,6 +1208,7 @@"ui.agent_chat_undo_label": "Agentchatt: {message}","ui.agent_chat_undone": "(ångrad)","ui.agent_chat_view_attached": "Vy bifogad",+ "ui.agent_chat_waiting": "Väntar på dig","ui.agent_cursor": "Agentmarkör","ui.agent_cursor_speed": "Agentmarkörens hastighet","ui.ai_add": "Lägg till",@@ -1550,6 +1558,8 @@"ui.joints": "Leder","ui.keyboard_shortcuts": "Kortkommandon","ui.language": "Språk",+ "ui.layout_compact": "Kompakt",+ "ui.layout_floating": "Flytande","ui.length_decimals": "Längddecimaler","ui.light": "Ljust","ui.line": "Linje",@@ -1687,6 +1697,7 @@"ui.reverse_zoom_direction": "Vänd zoomriktning","ui.revolve": "Rotation","ui.ribbon_exit": "Avsluta",+ "ui.ribbon_labels": "Visa text under menyfliksikoner","ui.ribbon_pin_footer": "Fästa kommandon visas i menyfliken. Håll muspekaren över en rad för att fästa eller lossa den.","ui.ribbon_workspace": "Arbetsyta","ui.right": "Höger",@@ -1841,6 +1852,7 @@"ui.workspace_design_tabs": "Modell · Yta · Montera · Infoga · Granska · Hantera · Vy","ui.workspace_drawing_description": "2D-ritningar med vyer, mått och titelrutor","ui.workspace_footer": "Varje arbetsyta arbetar med samma konstruktion, historik och markering; endast menyflikarna ändras. Växlaren är låst medan en skiss eller funktion redigeras.",+ "ui.workspace_layout": "Arbetsytans layout","ui.workspace_manufacture_description": "Slicing, verktygsbanor och uppsättning","ui.workspace_planned": "Planerad","ui.workspace_render_description": "Produktförhandsvisning, sceninställningar och renderade bilder",diff --git a/assets/locales/tr.json b/assets/locales/tr.jsonindex f4b549b4c8..da0faf0e39 100644--- a/assets/locales/tr.json+++ b/assets/locales/tr.json@@ -1092,6 +1092,7 @@"ui.agent_chat_add": "Dosya ekle","ui.agent_chat_add_file": "Dosya seç…","ui.agent_chat_allow": "İzin ver",+ "ui.agent_chat_allow_once": "Bir kez izin ver","ui.agent_chat_allowed": "İzin verildi","ui.agent_chat_answered": "Yanıt: {option}","ui.agent_chat_approval": "Ajanın bunu yapmasına izin verilsin mi?",@@ -1149,6 +1150,9 @@"ui.agent_chat_left": "Sol","ui.agent_chat_limit": "Ajan, bir mesaj için {limit} değişiklik sınırına ulaştı. Devam etmesi için başka bir mesaj gönderin.","ui.agent_chat_minimize": "Bir çubuğa küçült",+ "ui.agent_chat_mode_all": "Tümü",+ "ui.agent_chat_mode_ask": "Sor",+ "ui.agent_chat_mode_edits": "Düzenle","ui.agent_chat_model_tip": "Ajanın kullandığı model. Seçiminiz bu ajan için hatırlanır.","ui.agent_chat_new": "Yeni sohbet","ui.agent_chat_new_confirm": "Yeni bir sohbet başlatılsın mı? Geçerli sohbet temizlenir.",@@ -1161,6 +1165,7 @@"ui.agent_chat_none_found_short": "Ajan bulunamadı","ui.agent_chat_not_installed": "Yüklü değil","ui.agent_chat_not_signed_in": "oturum açık değil",+ "ui.agent_chat_open_settings": "Ayarları aç","ui.agent_chat_own_window": "Ayrı pencere","ui.agent_chat_paste_picture": "Görsel yapıştır","ui.agent_chat_permission": "Ajan şunu çalıştırmak istiyor: {title}",@@ -1185,6 +1190,8 @@"ui.agent_chat_send": "Gönder","ui.agent_chat_send_now": "Şimdi gönder","ui.agent_chat_send_now_tip": "Ajanın geçerli adımını durdurur ve bunu sonraki olarak gönderir (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft, bu bilgisayarda yüklü bir kodlama aracısıyla iletişim kurar. Ayarlar › AI bölümünden birini seçin.",+ "ui.agent_chat_setup_title": "Asistan ayarla","ui.agent_chat_side": "Ajan sohbeti konumu","ui.agent_chat_signed_in": "oturum açık","ui.agent_chat_state_auth": "Oturum açılması gerekiyor",@@ -1201,6 +1208,7 @@"ui.agent_chat_undo_label": "Ajan sohbeti: {message}","ui.agent_chat_undone": "(geri alındı)","ui.agent_chat_view_attached": "Görünüm eklendi",+ "ui.agent_chat_waiting": "Yanıtınız bekleniyor","ui.agent_cursor": "Ajan imleci","ui.agent_cursor_speed": "Ajan imleci hızı","ui.ai_add": "Ekle",@@ -1550,6 +1558,8 @@"ui.joints": "Bağlantılar","ui.keyboard_shortcuts": "Klavye kısayolları","ui.language": "Dil",+ "ui.layout_compact": "Kompakt",+ "ui.layout_floating": "Kayan","ui.length_decimals": "Uzunluk ondalık basamakları","ui.light": "Açık","ui.line": "Çizgi",@@ -1687,6 +1697,7 @@"ui.reverse_zoom_direction": "Yakınlaştırma yönünü tersine çevir","ui.revolve": "Döndür","ui.ribbon_exit": "Çıkış",+ "ui.ribbon_labels": "Şerit simgelerinin altında metin göster","ui.ribbon_pin_footer": "Sabitlenen komutlar şeritte görünür. Sabitlemek veya kaldırmak için bir satırın üzerine gelin.","ui.ribbon_workspace": "Çalışma alanı","ui.right": "Sağ",@@ -1866,6 +1877,7 @@"ui.workspace_design_tabs": "Modelle · Yüzey · Montajla · Ekle · İncele · Yönet · Görünüm","ui.workspace_drawing_description": "Görünümler, ölçüler ve başlık bloklarıyla 2B teknik resimler","ui.workspace_footer": "Her çalışma alanı aynı tasarım, geçmiş ve seçim üzerinde çalışır; yalnızca şerit sekmeleri değişir. Bir eskiz veya özellik düzenlenirken geçiş kilitlidir.",+ "ui.workspace_layout": "Çalışma alanı düzeni","ui.workspace_manufacture_description": "Dilimleme, takım yolları ve kurulum","ui.workspace_planned": "Planlanan","ui.workspace_render_description": "Ürün önizlemesi, sahne ayarları ve render görüntüleri",diff --git a/assets/locales/uk.json b/assets/locales/uk.jsonindex c22a70c772..c65514fe2c 100644--- a/assets/locales/uk.json+++ b/assets/locales/uk.json@@ -1093,6 +1093,7 @@"ui.agent_chat_add": "Прикріпити файли","ui.agent_chat_add_file": "Вибрати файл…","ui.agent_chat_allow": "Дозволити",+ "ui.agent_chat_allow_once": "Дозволити один раз","ui.agent_chat_allowed": "Дозволено","ui.agent_chat_answered": "Відповідь: {option}","ui.agent_chat_approval": "Дозволити агенту це зробити?",@@ -1150,6 +1151,9 @@"ui.agent_chat_left": "Ліворуч","ui.agent_chat_limit": "Агент досяг межі {limit} змін на одне повідомлення. Надішліть інше повідомлення, щоб дозволити йому продовжити.","ui.agent_chat_minimize": "Згорнути до смужки",+ "ui.agent_chat_mode_all": "Усе",+ "ui.agent_chat_mode_ask": "Запит",+ "ui.agent_chat_mode_edits": "Зміни","ui.agent_chat_model_tip": "Модель, яку використовує агент. Ваш вибір запам'ятовується для цього агента.","ui.agent_chat_new": "Новий чат","ui.agent_chat_new_confirm": "Почати новий чат? Поточний буде очищено.",@@ -1162,6 +1166,7 @@"ui.agent_chat_none_found_short": "Агента не знайдено","ui.agent_chat_not_installed": "Не встановлено","ui.agent_chat_not_signed_in": "не виконано вхід",+ "ui.agent_chat_open_settings": "Відкрити налаштування","ui.agent_chat_own_window": "Власне вікно","ui.agent_chat_paste_picture": "Вставити зображення","ui.agent_chat_permission": "Агент просить виконати: {title}",@@ -1186,6 +1191,8 @@"ui.agent_chat_send": "Надіслати","ui.agent_chat_send_now": "Надіслати зараз","ui.agent_chat_send_now_tip": "Зупинити поточний крок агента й надіслати це наступним (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft взаємодіє з агентом програмування, установленим на цьому комп’ютері. Виберіть його в розділі «Налаштування › ШІ».",+ "ui.agent_chat_setup_title": "Налаштувати асистента","ui.agent_chat_side": "Сторона чату з агентом","ui.agent_chat_signed_in": "виконано вхід","ui.agent_chat_state_auth": "Потрібен вхід",@@ -1202,6 +1209,7 @@"ui.agent_chat_undo_label": "Чат з агентом: {message}","ui.agent_chat_undone": "(скасовано)","ui.agent_chat_view_attached": "Вид прикріплено",+ "ui.agent_chat_waiting": "Очікує на вашу відповідь","ui.agent_cursor": "Курсор агента","ui.agent_cursor_speed": "Швидкість курсора агента","ui.ai_add": "Додати",@@ -1551,6 +1559,8 @@"ui.joints": "З'єднання","ui.keyboard_shortcuts": "Комбінації клавіш","ui.language": "Мова",+ "ui.layout_compact": "Компактне",+ "ui.layout_floating": "Плаваюче","ui.length_decimals": "Знаки після коми для довжин","ui.light": "Світла","ui.line": "Пряма",@@ -1688,6 +1698,7 @@"ui.reverse_zoom_direction": "Змінити напрямок масштабування","ui.revolve": "Обертання","ui.ribbon_exit": "Вихід",+ "ui.ribbon_labels": "Показувати текст під піктограмами стрічки","ui.ribbon_pin_footer": "Закріплені команди відображаються на стрічці. Наведіть курсор на рядок, щоб закріпити або відкріпити його.","ui.ribbon_workspace": "Робоча область","ui.right": "Справа",@@ -1867,6 +1878,7 @@"ui.workspace_design_tabs": "Модель · Поверхня · Збірка · Вставка · Перевірка · Керування · Вигляд","ui.workspace_drawing_description": "2D-креслення з видами, розмірами та штампами","ui.workspace_footer": "Кожне робоче середовище працює з тим самим проєктом, історією та вибором; змінюються лише вкладки стрічки. Перемикач заблоковано, поки редагується ескіз або елемент.",+ "ui.workspace_layout": "Компонування робочої області","ui.workspace_manufacture_description": "Нарізання, траєкторії та налаштування","ui.workspace_planned": "Заплановано","ui.workspace_render_description": "Перегляд виробу, налаштування сцени та відтворені зображення",diff --git a/assets/locales/vi.json b/assets/locales/vi.jsonindex 389258bfed..892776813c 100644--- a/assets/locales/vi.json+++ b/assets/locales/vi.json@@ -1093,6 +1093,7 @@"ui.agent_chat_add": "Đính kèm tệp","ui.agent_chat_add_file": "Chọn một tệp…","ui.agent_chat_allow": "Cho phép",+ "ui.agent_chat_allow_once": "Cho phép một lần","ui.agent_chat_allowed": "Đã cho phép","ui.agent_chat_answered": "Câu trả lời: {option}","ui.agent_chat_approval": "Cho phép AI thực hiện thao tác này?",@@ -1150,6 +1151,9 @@"ui.agent_chat_left": "Trái","ui.agent_chat_limit": "AI Agent đã đạt giới hạn {limit} thay đổi cho một tin nhắn. Hãy gửi tin nhắn tiếp theo để tiếp tục.","ui.agent_chat_minimize": "Thu nhỏ thành thanh công cụ",+ "ui.agent_chat_mode_all": "Tất cả",+ "ui.agent_chat_mode_ask": "Hỏi",+ "ui.agent_chat_mode_edits": "Chỉnh sửa","ui.agent_chat_model_tip": "Mô hình AI đang sử dụng. Lựa chọn của bạn sẽ được ghi nhớ cho Agent này.","ui.agent_chat_new": "Cuộc trò chuyện mới","ui.agent_chat_new_confirm": "Bắt đầu cuộc trò chuyện mới? Cuộc trò chuyện hiện tại sẽ bị xóa.",@@ -1162,6 +1166,7 @@"ui.agent_chat_none_found_short": "Không tìm thấy tác tử nào","ui.agent_chat_not_installed": "Chưa cài đặt","ui.agent_chat_not_signed_in": "chưa đăng nhập",+ "ui.agent_chat_open_settings": "Mở tùy chọn cài đặt","ui.agent_chat_own_window": "Cửa sổ riêng","ui.agent_chat_paste_picture": "Dán hình ảnh","ui.agent_chat_permission": "AI Agent yêu cầu thực thi: {title}",@@ -1186,6 +1191,8 @@"ui.agent_chat_send": "Gửi","ui.agent_chat_send_now": "Gửi ngay","ui.agent_chat_send_now_tip": "Dừng bước hiện tại của tác tử và gửi tin nhắn này ngay (Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft giao tiếp với một tác nhân lập trình được cài đặt trên máy tính này. Chọn một tác nhân trong Tùy chọn cài đặt › AI.",+ "ui.agent_chat_setup_title": "Thiết lập trợ lý","ui.agent_chat_side": "Vị trí bảng trò chuyện AI","ui.agent_chat_signed_in": "đã đăng nhập","ui.agent_chat_state_auth": "Cần đăng nhập",@@ -1202,6 +1209,7 @@"ui.agent_chat_undo_label": "Trò chuyện AI: {message}","ui.agent_chat_undone": "(hoàn tácne)","ui.agent_chat_view_attached": "Đã đính kèm góc nhìn",+ "ui.agent_chat_waiting": "Đang chờ bạn","ui.agent_cursor": "Con trỏ AI","ui.agent_cursor_speed": "Tốc độ con trỏ AI","ui.ai_add": "Thêm",@@ -1551,6 +1559,8 @@"ui.joints": "Các khớp nối","ui.keyboard_shortcuts": "Phím tắt bàn phím","ui.language": "Ngôn ngữ (Language)",+ "ui.layout_compact": "Gọn",+ "ui.layout_floating": "Nổi","ui.length_decimals": "Số chữ số thập phân cho chiều dài","ui.light": "Sáng","ui.line": "Đoạn thẳng",@@ -1688,6 +1698,7 @@"ui.reverse_zoom_direction": "Đảo chiều thu phóng","ui.revolve": "Xoay tròn tạo khối","ui.ribbon_exit": "Thoát",+ "ui.ribbon_labels": "Hiển thị văn bản bên dưới biểu tượng dải băng","ui.ribbon_pin_footer": "Các lệnh đã ghim hiển thị trên ruy-băng. Rê chuột lên một hàng để ghim hoặc bỏ ghim.","ui.ribbon_workspace": "Không gian làm việc","ui.right": "Phải (Hình chiếu cạnh)",@@ -1842,6 +1853,7 @@"ui.workspace_design_tabs": "Mô hình · Bề mặt · Lắp ráp · Chèn · Kiểm tra · Quản lý · Xem","ui.workspace_drawing_description": "Bản vẽ 2D với các hình chiếu, kích thước và khung tên","ui.workspace_footer": "Mọi không gian làm việc đều dùng chung một thiết kế, lịch sử và vùng chọn; chỉ các thẻ ruy-băng thay đổi. Bộ chuyển đổi bị khóa khi đang chỉnh sửa phác thảo hoặc tính năng.",+ "ui.workspace_layout": "Bố cục không gian làm việc","ui.workspace_manufacture_description": "Cắt lớp, đường chạy dao và thiết lập","ui.workspace_planned": "Dự kiến","ui.workspace_render_description": "Xem trước sản phẩm, cài đặt cảnh và hình ảnh kết xuất",diff --git a/assets/locales/zh-TW.json b/assets/locales/zh-TW.jsonindex 938140f00a..8f253abcb7 100644--- a/assets/locales/zh-TW.json+++ b/assets/locales/zh-TW.json@@ -1092,6 +1092,7 @@"ui.agent_chat_add": "附加檔案","ui.agent_chat_add_file": "選擇檔案…","ui.agent_chat_allow": "允許",+ "ui.agent_chat_allow_once": "僅允許一次","ui.agent_chat_allowed": "已允許","ui.agent_chat_answered": "回答:{option}","ui.agent_chat_approval": "允許代理執行此操作嗎?",@@ -1149,6 +1150,9 @@"ui.agent_chat_left": "左側","ui.agent_chat_limit": "代理已達到每條訊息 {limit} 項變更的上限。再傳送一條訊息可讓它繼續。","ui.agent_chat_minimize": "最小化為細條",+ "ui.agent_chat_mode_all": "全部",+ "ui.agent_chat_mode_ask": "詢問",+ "ui.agent_chat_mode_edits": "編輯","ui.agent_chat_model_tip": "代理使用的模型。您的選擇會為此代理記住。","ui.agent_chat_new": "新對話","ui.agent_chat_new_confirm": "開始新對話?目前對話將被清除。",@@ -1161,6 +1165,7 @@"ui.agent_chat_none_found_short": "未找到代理","ui.agent_chat_not_installed": "未安裝","ui.agent_chat_not_signed_in": "未登入",+ "ui.agent_chat_open_settings": "開啟偏好設定","ui.agent_chat_own_window": "獨立視窗","ui.agent_chat_paste_picture": "貼上圖片","ui.agent_chat_permission": "代理請求執行:{title}",@@ -1185,6 +1190,8 @@"ui.agent_chat_send": "傳送","ui.agent_chat_send_now": "立即傳送","ui.agent_chat_send_now_tip": "停止代理目前的步驟,並接著傳送這條訊息(Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft 會與安裝在這部電腦上的程式設計代理程式通訊。請在「偏好設定 › AI」中選擇一個。",+ "ui.agent_chat_setup_title": "設定助理","ui.agent_chat_side": "代理聊天位置","ui.agent_chat_signed_in": "已登入","ui.agent_chat_state_auth": "需要登入",@@ -1201,6 +1208,7 @@"ui.agent_chat_undo_label": "代理聊天:{message}","ui.agent_chat_undone": "(已復原)","ui.agent_chat_view_attached": "已附加檢視",+ "ui.agent_chat_waiting": "等待您的回應","ui.agent_cursor": "代理游標","ui.agent_cursor_speed": "代理游標速度","ui.ai_add": "新增",@@ -1550,6 +1558,8 @@"ui.joints": "接頭","ui.keyboard_shortcuts": "鍵盤快捷鍵","ui.language": "語言",+ "ui.layout_compact": "精簡",+ "ui.layout_floating": "浮動","ui.length_decimals": "長度小數位數","ui.light": "淺色","ui.line": "直線",@@ -1687,6 +1697,7 @@"ui.reverse_zoom_direction": "反轉縮放方向","ui.revolve": "旋轉","ui.ribbon_exit": "結束",+ "ui.ribbon_labels": "顯示功能區圖示下的文字","ui.ribbon_pin_footer": "固定的命令會顯示在功能區中。將指標停留在某列上即可固定或取消固定。","ui.ribbon_workspace": "工作區","ui.right": "右視",@@ -1841,6 +1852,7 @@"ui.workspace_design_tabs": "模型 · 曲面 · 組裝 · 插入 · 檢查 · 管理 · 檢視","ui.workspace_drawing_description": "含檢視、尺寸和標題欄的 2D 工程圖","ui.workspace_footer": "所有工作區使用同一設計、歷程記錄和選擇,僅功能區索引標籤會變化。編輯草圖或特徵時,切換器將被鎖定。",+ "ui.workspace_layout": "工作區配置","ui.workspace_manufacture_description": "切片、刀具路徑和設定","ui.workspace_planned": "規劃中","ui.workspace_render_description": "產品預覽、場景設定和彩現影像",diff --git a/assets/locales/zh.json b/assets/locales/zh.jsonindex 8e25bf27d2..08c5b5c72e 100644--- a/assets/locales/zh.json+++ b/assets/locales/zh.json@@ -1127,6 +1127,7 @@"ui.agent_chat_add": "附加文件","ui.agent_chat_add_file": "选择文件…","ui.agent_chat_allow": "允许",+ "ui.agent_chat_allow_once": "仅允许一次","ui.agent_chat_allowed": "已允许","ui.agent_chat_answered": "回答:{option}","ui.agent_chat_approval": "允许智能体执行此操作吗?",@@ -1184,6 +1185,9 @@"ui.agent_chat_left": "左侧","ui.agent_chat_limit": "智能体已达到每条消息 {limit} 项更改的上限。再发送一条消息可让它继续。","ui.agent_chat_minimize": "最小化为细条",+ "ui.agent_chat_mode_all": "全部",+ "ui.agent_chat_mode_ask": "询问",+ "ui.agent_chat_mode_edits": "编辑","ui.agent_chat_model_tip": "智能体使用的模型。你的选择会为此智能体记住。","ui.agent_chat_new": "新对话","ui.agent_chat_new_confirm": "开始新对话?当前对话将被清除。",@@ -1196,6 +1200,7 @@"ui.agent_chat_none_found_short": "未找到智能体","ui.agent_chat_not_installed": "未安装","ui.agent_chat_not_signed_in": "未登录",+ "ui.agent_chat_open_settings": "打开首选项","ui.agent_chat_own_window": "独立窗口","ui.agent_chat_paste_picture": "粘贴图片","ui.agent_chat_permission": "智能体请求运行:{title}",@@ -1220,6 +1225,8 @@"ui.agent_chat_send": "发送","ui.agent_chat_send_now": "立即发送","ui.agent_chat_send_now_tip": "停止智能体当前的步骤,并接着发送这条消息(Ctrl+Enter)",+ "ui.agent_chat_setup_body": "SolidCraft 会与安装在此计算机上的编程代理通信。请在“首选项 › AI”中选择一个。",+ "ui.agent_chat_setup_title": "设置助手","ui.agent_chat_side": "智能体聊天位置","ui.agent_chat_signed_in": "已登录","ui.agent_chat_state_auth": "需要登录",@@ -1236,6 +1243,7 @@"ui.agent_chat_undo_label": "智能体聊天:{message}","ui.agent_chat_undone": "(已撤销)","ui.agent_chat_view_attached": "已附加视图",+ "ui.agent_chat_waiting": "等待您的回复","ui.agent_cursor": "代理光标","ui.agent_cursor_speed": "代理光标速度","ui.agent_off_thread": "代理运行命令时保持窗口响应",@@ -1594,6 +1602,8 @@"ui.joints": "关节","ui.keyboard_shortcuts": "键盘快捷键","ui.language": "语言",+ "ui.layout_compact": "紧凑",+ "ui.layout_floating": "浮动","ui.length_decimals": "长度小数位","ui.light": "浅色","ui.line": "直线",@@ -1731,6 +1741,7 @@"ui.reverse_zoom_direction": "反转缩放方向","ui.revolve": "旋转","ui.ribbon_exit": "退出",+ "ui.ribbon_labels": "显示功能区图标下的文字","ui.ribbon_pin_footer": "固定的命令显示在功能区中。将指针悬停在行上可固定或取消固定。","ui.ribbon_workspace": "工作区","ui.right": "右视",@@ -1910,6 +1921,7 @@"ui.workspace_design_tabs": "模型 · 曲面 · 装配 · 插入 · 检查 · 管理 · 视图","ui.workspace_drawing_description": "包含视图、尺寸和标题栏的二维图纸","ui.workspace_footer": "所有工作区使用同一设计、历史记录和选择,仅功能区选项卡发生变化。编辑草图或特征时,切换器将被锁定。",+ "ui.workspace_layout": "工作区布局","ui.workspace_manufacture_description": "切片、刀具路径和设置","ui.workspace_planned": "计划中","ui.workspace_render_description": "产品预览、场景设置和渲染图像",diff --git a/assets/styles/ui/palettes.rs b/assets/styles/ui/palettes.rsindex 6cd46af07a..939e7cd7b4 100644--- a/assets/styles/ui/palettes.rs+++ b/assets/styles/ui/palettes.rs@@ -107,7 +107,6 @@ impl Tokens {error: Color32::from_rgb(214, 54, 54),warning: Color32::from_rgb(222, 150, 30),icon: Color32::from_rgb(70, 78, 92),- icon_fill: Color32::from_rgb(178, 196, 222),timeline: Color32::from_rgb(232, 235, 240),hover: Color32::from_rgb(226, 234, 246),sel_face: Color32::from_rgb(76, 127, 203),@@ -157,8 +156,6 @@ impl Tokens {dialog_bg: Color32::from_rgb(250, 251, 252),dialog_border: Color32::from_rgb(213, 219, 227),chip: Color32::from_rgb(38, 120, 218),- heading_bg: Color32::from_rgb(218, 223, 231),- subheading_bg: Color32::from_rgb(234, 237, 242),profile_fill: Color32::from_rgba_unmultiplied_const(255, 196, 120, 70),glyph_bg: Color32::WHITE,glyph_edge: Color32::from_rgb(190, 110, 100),@@ -203,30 +200,7 @@ impl Tokens {Color32::from_rgb(204, 0, 140),],analysis: AnalysisColors::DEFAULT,- icons: IconColors {- sheet: Color32::from_rgb(170, 200, 240),- sheet_2: Color32::from_rgb(150, 185, 235),- sheet_light: Color32::from_rgb(214, 229, 248),- sheet_line: Color32::from_rgb(127, 166, 218),- highlight: Color32::WHITE,- glint: Color32::from_rgba_premultiplied(160, 160, 160, 160),- folder: Color32::from_rgb(236, 200, 110),- plane: Color32::from_rgb(244, 214, 150),- fold: Color32::from_rgb(130, 140, 160),- stripe: Color32::from_gray(30),- sky: Color32::from_rgb(190, 205, 230),- floor: Color32::from_rgb(60, 62, 70),- paint: [Color32::from_rgb(220, 70, 60), Color32::from_rgb(70, 150, 230), Color32::from_rgb(240, 200, 60)],- axes: [Color32::from_rgb(210, 60, 60), Color32::from_rgb(60, 160, 60), Color32::from_rgb(60, 100, 220)],- access: [Color32::from_rgb(70, 180, 90), Color32::from_rgb(220, 70, 60)],- draft: [Color32::from_rgb(70, 180, 90), Color32::from_rgb(235, 200, 50)],- curvature: [Color32::from_rgb(60, 110, 230), Color32::from_rgb(70, 190, 90), Color32::from_rgb(225, 60, 45)],- interference: Color32::from_rgb(225, 70, 60),- warning: Color32::from_rgb(250, 200, 60),- agent: Color32::from_rgb(168, 85, 247),- marker_halo: Color32::from_black_alpha(150),- },- app_bar_icon: [Color32::from_rgb(225, 230, 238), Color32::from_rgb(120, 140, 170), Color32::from_rgb(120, 190, 255)],+ icons: IconColors { highlight: Color32::WHITE, agent: Color32::from_rgb(168, 85, 247), marker_halo: Color32::from_black_alpha(150) },logo: [Color32::from_rgb(96, 158, 236), Color32::from_rgb(58, 136, 238), Color32::from_rgb(55, 108, 197), Color32::WHITE],}}@@ -306,7 +280,6 @@ impl Tokens {t.error = Color32::from_rgb(240, 100, 96);t.warning = Color32::from_rgb(236, 170, 70);t.icon = Color32::from_rgb(208, 214, 226);- t.icon_fill = Color32::from_rgb(86, 112, 150);t.timeline = Color32::from_rgb(33, 37, 45);t.hover = Color32::from_rgb(54, 61, 74);t.hover_edge_halo = Color32::from_rgb(203, 203, 203);@@ -328,8 +301,6 @@ impl Tokens {t.dialog_bg = Color32::from_rgb(59, 68, 83);t.dialog_border = Color32::from_rgb(72, 83, 99);t.chip = Color32::from_rgb(59, 101, 168);- t.heading_bg = Color32::from_rgb(38, 44, 55);- t.subheading_bg = Color32::from_rgb(48, 55, 68);t.glyph_bg = Color32::from_rgb(44, 50, 60);t.glyph_edge = Color32::from_rgb(200, 130, 120);t.glyph_text = icon_primary(crate::icon_svg::CONSTRAINT_PRIMARY[1]);@@ -373,15 +344,8 @@ impl Tokens {if !dark {t.form_success = Color32::from_rgb(39, 88, 78);}- // The icons that show the same meanings follow; on the dark toolbar the blue is a little- // stronger, to stay clear of the icon fill.- let good = if dark { Color32::from_rgb(35, 115, 245) } else { Color32::from_rgb(51, 115, 230) };- t.icons.axes[0] = t.triad[0];- t.icons.axes[1] = t.triad[1];- t.icons.access = [good, Color32::from_rgb(217, 102, 13)];t.construction_geom = icon_primary(crate::icon_svg::CONSTRUCTION_RED_GREEN[dark as usize]);t.glyph_text = icon_primary(crate::icon_svg::CONSTRAINT_RED_GREEN[dark as usize]);- t.icons.draft = [good, Color32::from_rgb(242, 230, 153)];t.surface_accent = if dark { Color32::from_rgb(200, 135, 55) } else { Color32::from_rgb(164, 80, 0) };t.mesh_accent = if dark { Color32::from_rgb(190, 175, 70) } else { Color32::from_rgb(130, 103, 0) };t.form_accent = if dark { Color32::from_rgb(165, 135, 220) } else { Color32::from_rgb(115, 73, 205) };diff --git a/assets/styles/ui/themes/gruvbox-dark-hard.json b/assets/styles/ui/themes/gruvbox-dark-hard.jsonindex 29033943da..646057927f 100644--- a/assets/styles/ui/themes/gruvbox-dark-hard.json+++ b/assets/styles/ui/themes/gruvbox-dark-hard.json@@ -16,7 +16,6 @@"error": "#fb4934","warning": "#fabd2f","icon": "#d5c4a1",- "icon_fill": "#458588","timeline": "#141617","hover": "#46403e","sel_face": "#458588",@@ -62,8 +61,6 @@"dialog_bg": "#3c3836","dialog_border": "#504945","chip": "#458588",- "heading_bg": "#1d2021",- "subheading_bg": "#2c2c2c","section_cap": "#d65d0e","profile_fill": "#83a59828","glyph_bg": "#2c2c2c",@@ -96,24 +93,6 @@"#b8bb26","#83a598"],- "app_bar_icon": [- "#ebdbb2",- "#928374",- "#83a598"- ],- "icons.folder": "#d79921",- "icons.axes": [- "#fb4934",- "#b8bb26",- "#83a598"- ],- "icons.agent": "#d3869b",- "icons.warning": "#fabd2f",- "icons.interference": "#fb4934",- "icons.paint": [- "#fb4934",- "#83a598",- "#fabd2f"- ]+ "icons.agent": "#d3869b"}}diff --git a/assets/styles/ui/themes/gruvbox-dark-soft.json b/assets/styles/ui/themes/gruvbox-dark-soft.jsonindex ac5042e19a..34a895cc9c 100644--- a/assets/styles/ui/themes/gruvbox-dark-soft.json+++ b/assets/styles/ui/themes/gruvbox-dark-soft.json@@ -16,7 +16,6 @@"error": "#fb4934","warning": "#fabd2f","icon": "#d5c4a1",- "icon_fill": "#458588","timeline": "#1d2021","hover": "#46403e","sel_face": "#458588",@@ -62,8 +61,6 @@"dialog_bg": "#3c3836","dialog_border": "#504945","chip": "#458588",- "heading_bg": "#32302f",- "subheading_bg": "#373432","section_cap": "#d65d0e","profile_fill": "#83a59828","glyph_bg": "#373432",@@ -96,24 +93,6 @@"#b8bb26","#83a598"],- "app_bar_icon": [- "#ebdbb2",- "#928374",- "#83a598"- ],- "icons.folder": "#d79921",- "icons.axes": [- "#fb4934",- "#b8bb26",- "#83a598"- ],- "icons.agent": "#d3869b",- "icons.warning": "#fabd2f",- "icons.interference": "#fb4934",- "icons.paint": [- "#fb4934",- "#83a598",- "#fabd2f"- ]+ "icons.agent": "#d3869b"}}diff --git a/assets/styles/ui/themes/gruvbox-dark.json b/assets/styles/ui/themes/gruvbox-dark.jsonindex 4c55a6b23d..320f9ed96a 100644--- a/assets/styles/ui/themes/gruvbox-dark.json+++ b/assets/styles/ui/themes/gruvbox-dark.json@@ -16,7 +16,6 @@"error": "#fb4934","warning": "#fabd2f","icon": "#d5c4a1",- "icon_fill": "#458588","timeline": "#1d2021","hover": "#46403e","sel_face": "#458588",@@ -62,8 +61,6 @@"dialog_bg": "#3c3836","dialog_border": "#504945","chip": "#458588",- "heading_bg": "#282828",- "subheading_bg": "#32302f","section_cap": "#d65d0e","profile_fill": "#83a59828","glyph_bg": "#32302f",@@ -96,24 +93,6 @@"#b8bb26","#83a598"],- "app_bar_icon": [- "#ebdbb2",- "#928374",- "#83a598"- ],- "icons.folder": "#d79921",- "icons.axes": [- "#fb4934",- "#b8bb26",- "#83a598"- ],- "icons.agent": "#d3869b",- "icons.warning": "#fabd2f",- "icons.interference": "#fb4934",- "icons.paint": [- "#fb4934",- "#83a598",- "#fabd2f"- ]+ "icons.agent": "#d3869b"}}diff --git a/assets/styles/ui/themes/gruvbox-light-hard.json b/assets/styles/ui/themes/gruvbox-light-hard.jsonindex adbe04d4b7..902121fb66 100644--- a/assets/styles/ui/themes/gruvbox-light-hard.json+++ b/assets/styles/ui/themes/gruvbox-light-hard.json@@ -16,7 +16,6 @@"error": "#9d0006","warning": "#b57614","icon": "#504945",- "icon_fill": "#bdae93","timeline": "#ebdbb2","hover": "#f1e5c1","sel_face": "#458588",@@ -62,8 +61,6 @@"dialog_bg": "#f9f5d7","dialog_border": "#d5c4a1","chip": "#458588",- "heading_bg": "#d5c4a1",- "subheading_bg": "#ebdbb2","section_cap": "#d65d0e","profile_fill": "#fabd2f46","glyph_bg": "#fcfaeb",@@ -96,24 +93,6 @@"#98971a","#458588"],- "app_bar_icon": [- "#fbf1c7",- "#a89984",- "#83a598"- ],- "icons.folder": "#d79921",- "icons.axes": [- "#cc241d",- "#98971a",- "#458588"- ],- "icons.agent": "#8f3f71",- "icons.warning": "#d79921",- "icons.interference": "#cc241d",- "icons.paint": [- "#cc241d",- "#458588",- "#d79921"- ]+ "icons.agent": "#8f3f71"}}diff --git a/assets/styles/ui/themes/gruvbox-light-soft.json b/assets/styles/ui/themes/gruvbox-light-soft.jsonindex 14891bc6b9..d8c1c97832 100644--- a/assets/styles/ui/themes/gruvbox-light-soft.json+++ b/assets/styles/ui/themes/gruvbox-light-soft.json@@ -16,7 +16,6 @@"error": "#9d0006","warning": "#b57614","icon": "#504945",- "icon_fill": "#bdae93","timeline": "#ebdbb2","hover": "#eedfb6","sel_face": "#458588",@@ -62,8 +61,6 @@"dialog_bg": "#f2e5bc","dialog_border": "#d5c4a1","chip": "#458588",- "heading_bg": "#d5c4a1",- "subheading_bg": "#ebdbb2","section_cap": "#d65d0e","profile_fill": "#fabd2f46","glyph_bg": "#f8f2de",@@ -96,24 +93,6 @@"#98971a","#458588"],- "app_bar_icon": [- "#fbf1c7",- "#a89984",- "#83a598"- ],- "icons.folder": "#d79921",- "icons.axes": [- "#cc241d",- "#98971a",- "#458588"- ],- "icons.agent": "#8f3f71",- "icons.warning": "#d79921",- "icons.interference": "#cc241d",- "icons.paint": [- "#cc241d",- "#458588",- "#d79921"- ]+ "icons.agent": "#8f3f71"}}diff --git a/assets/styles/ui/themes/gruvbox-light.json b/assets/styles/ui/themes/gruvbox-light.jsonindex bd5191a466..c3789e80d0 100644--- a/assets/styles/ui/themes/gruvbox-light.json+++ b/assets/styles/ui/themes/gruvbox-light.json@@ -16,7 +16,6 @@"error": "#9d0006","warning": "#b57614","icon": "#504945",- "icon_fill": "#bdae93","timeline": "#ebdbb2","hover": "#f1e4ba","sel_face": "#458588",@@ -62,8 +61,6 @@"dialog_bg": "#fbf1c7","dialog_border": "#d5c4a1","chip": "#458588",- "heading_bg": "#d5c4a1",- "subheading_bg": "#ebdbb2","section_cap": "#d65d0e","profile_fill": "#fabd2f46","glyph_bg": "#fdf8e3",@@ -96,24 +93,6 @@"#98971a","#458588"],- "app_bar_icon": [- "#fbf1c7",- "#a89984",- "#83a598"- ],- "icons.folder": "#d79921",- "icons.axes": [- "#cc241d",- "#98971a",- "#458588"- ],- "icons.agent": "#8f3f71",- "icons.warning": "#d79921",- "icons.interference": "#cc241d",- "icons.paint": [- "#cc241d",- "#458588",- "#d79921"- ]+ "icons.agent": "#8f3f71"}}diff --git a/crates/engine/src/cmd/view_navigation.rs b/crates/engine/src/cmd/view_navigation.rsindex a8b9d3d328..2101e4d604 100644--- a/crates/engine/src/cmd/view_navigation.rs+++ b/crates/engine/src/cmd/view_navigation.rs@@ -7,6 +7,8 @@ use crate::params::{bad, num, req_vec2, req_vec3, vec3};use crate::{Result, Sel, Session};pub static COMMANDS: &[CommandSpec] = &[+CommandSpec::new("view.layout", "Workspace layout", layout)+ .icon("settings").noundo().doc_only().params("mode: floating|compact → validated workspace layout; display only, never opens a dialog"),CommandSpec::new("view.history_layout", "History layout", history_layout).icon("settings").noundo().doc_only().params("width?: 1..1000000; dock?: bottom|left|under_browser; collapsed?: bool → validated layout request; display only, never opens a dialog"),CommandSpec::new("view.graphics_preset", "Graphics Preset", graphics_preset)@@ -60,6 +62,15 @@ fn normal_to(s: &mut Session, p: &Value) -> Result<Value> {Ok(json!({"camera": to}))}+fn layout(_s: &mut Session, p: &Value) -> Result<Value> {+ let mode = p+ .get("mode")+ .and_then(Value::as_str)+ .filter(|mode| matches!(*mode, "floating" | "compact"))+ .ok_or_else(|| bad("view.layout", "mode must be floating or compact"))?;+ Ok(json!({"mode": mode}))+}+fn history_layout(_s: &mut Session, p: &Value) -> Result<Value> {let cmd = "view.history_layout";let mut result = serde_json::Map::new();@@ -587,3 +598,18 @@ fn history_layout_validates_geometry_without_changing_the_design() {assert_eq!(s.doc, doc);assert!(s.undo.is_empty());}++#[cfg(test)]+#[test]+fn workspace_layout_validates_modes_without_mutating_the_design() {+ let mut session = Session::default();+ let before = session.doc.to_json();+ for mode in ["floating", "compact"] {+ assert_eq!(session.execute("view.layout", &json!({"mode":mode})).unwrap(), json!({"mode":mode}));+ }+ for params in [json!({}), json!({"mode":"wide"}), json!({"mode":true}), json!({"mode":null}), json!({"mode":42})] {+ assert!(session.execute("view.layout", ¶ms).is_err());+ }+ assert_eq!(session.doc.to_json(), before);+ assert!(session.undo.is_empty());+}diff --git a/crates/ui-egui/src/agent_chat/markdown_view.rs b/crates/ui-egui/src/agent_chat/markdown_view.rsindex ba8647329b..8c6d6da585 100644--- a/crates/ui-egui/src/agent_chat/markdown_view.rs+++ b/crates/ui-egui/src/agent_chat/markdown_view.rs@@ -101,7 +101,7 @@ pub fn show(ui: &mut egui::Ui, slot: usize, src: &str) {.selectable(true).wrap(),);- if ui.small_button(tr("ui.agent_chat_copy")).clicked() {+ if crate::ui_kit::button(ui, tr("ui.agent_chat_copy"), crate::ui_kit::Button::Small).clicked() {ui.ctx().copy_text(text.clone());}});diff --git a/crates/ui-egui/src/agent_chat/mod.rs b/crates/ui-egui/src/agent_chat/mod.rsindex b1f8bb6063..e73f401fae 100644--- a/crates/ui-egui/src/agent_chat/mod.rs+++ b/crates/ui-egui/src/agent_chat/mod.rs@@ -45,6 +45,7 @@ use crate::i18n::{format as trf, tr};use crate::{ControlRequest, SolveApp};use backend::{ChatBackend, Event, PermissionOption, PromptPart, ToolStatus};+pub(crate) use panel::{left_inset, tool_space};pub use panel::{show, tip as panel_tip, toggle};/// Most entries kept in the conversation; older ones are dropped.@@ -331,6 +332,8 @@ pub struct AgentChat {pub confirm_new: bool,/// Where the panel was drawn last (for its shortcuts).pub panel_rect: Option<egui::Rect>,+ /// Unreserved sheet space, shared by the actual dock and its drag preview.+ pub(crate) dock_space: Option<egui::Rect>,/// The last message sent, kept to send again after a sign-in (its files too).last: Option<(String, bool, Option<usize>, Vec<attach::Attachment>)>,/// Files for the next message (pictures, text files, imported parts), shown as chips.diff --git a/crates/ui-egui/src/agent_chat/panel.rs b/crates/ui-egui/src/agent_chat/panel.rsindex a85fa15170..b225fbe49f 100644--- a/crates/ui-egui/src/agent_chat/panel.rs+++ b/crates/ui-egui/src/agent_chat/panel.rs@@ -3,6 +3,7 @@//! width and fold are preferences, so they come back next time.use crate::fonts::RichTextExt as _;+use crate::ui_kit::{Container, Edge, Surface};use egui::{Align, Align2, Color32, Id, Layout, Rect, RichText, Sense, Stroke, pos2, vec2};use super::*;@@ -60,6 +61,10 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {poll(app, &ctx);// Set again below if the chat is drawn this frame.app.agent_chat.drop_rect = None;+ // Retain the previous card for shortcut hover routing below; clear it when hidden.+ if !shown(app) || !app.agent_chat.open {+ app.agent_chat.panel_rect = None;+ }// With AI features off nothing of the chat is drawn, and the shortcut does nothing.if !shown(app) {return;@@ -91,14 +96,22 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {show_drop_hint(app, &ctx);return;}+ if Container::for_layout(app.ui.layout, Surface::Panel).floating() {+ floating(app, ui);+ show_drop_hint(app, &ctx);+ return;+ }+ let available = ui.available_rect_before_wrap();+ let screen = ctx.content_rect();+ app.agent_chat.dock_space = Some(Rect::from_x_y_ranges(screen.x_range(), available.y_range()));let t = Tokens::get();let left = app.preferences.agent_chat_side == "left";- let side = |id: Id| if left { egui::Panel::left(id) } else { egui::Panel::right(id) };+ let side = |id: Id| Container::new(ui.ctx(), Surface::Panel).edge(id, if left { Edge::Left } else { Edge::Right });if app.preferences.agent_chat_minimized {let r = side(Id::new("sc_agent_chat_strip")).exact_size(STRIP).resizable(false)- .frame(egui::Frame::NONE.fill(t.panel))+ .frame(Container::new(ui.ctx(), Surface::Panel).edge_frame(t.panel)).show(ui, |ui| strip(app, ui));app.agent_chat.drop_rect = Some(r.response.rect);show_drop_hint(app, &ctx);@@ -109,7 +122,7 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {.default_size(width).size_range(MIN_WIDTH..=MAX_WIDTH).resizable(true)- .frame(egui::Frame::NONE.fill(t.panel).inner_margin(egui::Margin::symmetric(8, 6)))+ .frame(Container::new(ui.ctx(), Surface::Panel).edge_frame(t.dialog_body)).show(ui, |ui| ui_kit::scope(ui, |ui| body(app, ui, left)));crate::scenario::publish_rect("agent_chat:panel", r.response.rect);app.agent_chat.panel_rect = Some(r.response.rect);@@ -123,6 +136,112 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {}}+/// Horizontal room reserved before the history and browser when Assistant is on the left.+pub(crate) fn left_inset(app: &SolveApp, available: Rect) -> f32 {+ if Container::for_layout(app.ui.layout, Surface::Panel).floating()+ && shown(app)+ && app.agent_chat.open+ && !app.preferences.agent_chat_popped+ && app.preferences.agent_chat_side == "left"+ {+ let width = if app.preferences.agent_chat_minimized { STRIP } else { app.preferences.agent_chat_width.clamp(MIN_WIDTH, MAX_WIDTH) };+ (width + crate::shell::SHELL_GAP).min(available.width().max(0.0))+ } else {+ 0.0+ }+}++/// Assistant-specific precedence over tool sheets. Keep this out of the shared container:+/// ordinary tool panels never reserve an outside rail for themselves.+pub(crate) fn tool_space(app: &SolveApp, mut available: Rect) -> Rect {+ if Container::for_layout(app.ui.layout, Surface::Panel).floating()+ && shown(app)+ && app.agent_chat.open+ && !app.preferences.agent_chat_popped+ && let Some(chat) = app.agent_chat.panel_rect.filter(|r| r.is_finite() && r.is_positive())+ {+ if app.preferences.agent_chat_side == "left" {+ available.min.x = (chat.right() + crate::shell::SHELL_GAP).clamp(available.left(), available.right());+ } else {+ available.max.x = (chat.left() - crate::shell::SHELL_GAP).clamp(available.left(), available.right());+ }+ }+ available+}++/// The same outer rectangle is used for the floating sheet and its docking preview.+fn floating_bounds(app: &SolveApp, available: Rect, left: bool) -> Rect {+ let t = Tokens::get();+ let gap = crate::shell::SHELL_GAP;+ let mut bounds = available.shrink(gap);+ // The ribbon already supplies the top gap shared by browser and history cards.+ bounds.min.y = available.top();+ if let Some(history) = app.shell.history.filter(|_| app.ui.show_timeline && !app.preferences.timeline_left) {+ bounds.max.y = (history.top() - gap).min(bounds.bottom()).max(bounds.top());+ }+ // Assistant owns the outside edge on either side. Tool sheets reserve space beside it.+ if !left {+ // Match the shared Panel's right-edge clearance.+ bounds.max.x = bounds.right().min(available.right() - t.space_8).max(bounds.left());+ }+ let width = if app.preferences.agent_chat_minimized { STRIP } else { app.preferences.agent_chat_width.clamp(MIN_WIDTH, MAX_WIDTH) };+ let height = if app.preferences.agent_chat_minimized { (t.space_24 * 3.0 + t.space_16).min(bounds.height()) } else { bounds.height() };+ let width = width.min(bounds.width().max(0.0));+ Rect::from_min_size(pos2(if left { bounds.left() } else { bounds.right() - width }, bounds.top()), vec2(width, height.max(0.0)))+}++/// Use the same bounded, rounded floating surface as feature panels. The sheet overlays+/// the viewport, leaving the model's rendering and picking projection unchanged.+fn floating(app: &mut SolveApp, ui: &mut egui::Ui) {+ let ctx = ui.ctx().clone();+ let t = Tokens::get();+ let available = ui.available_rect_before_wrap();+ app.agent_chat.dock_space = Some(available);+ let left = app.preferences.agent_chat_side == "left";+ let side = if left { crate::frame::Side::Left } else { crate::frame::Side::Right };+ let minimized = app.preferences.agent_chat_minimized;+ let bounds = floating_bounds(app, available, left);+ if !bounds.is_positive() {+ app.agent_chat.panel_rect = None;+ return;+ }+ let width = bounds.width();+ let height = bounds.height();+ let anchor = if left { bounds.left_top() } else { bounds.right_top() };+ let frame = ui_kit::Panel::feature_frame(&ctx, app.ui.layout, side);+ let inner = (vec2(width, height) - frame.total_margin().sum()).max(egui::Vec2::ZERO);+ let panel = ui_kit::Panel::new(tr("ui.assistant"), Id::new("sc_agent_chat_floating"), anchor, available, side, frame).width(width);+ if let Some(card) = panel.window(&ctx).fixed_size(inner).show(&ctx, |ui| {+ ui.set_min_size(inner);+ ui.set_max_size(inner);+ ui.set_clip_rect(ui.clip_rect().intersect(Rect::from_min_size(ui.max_rect().min, inner)));+ ui_kit::scope(ui, |ui| if minimized { strip(app, ui) } else { body(app, ui, left) });+ if !minimized {+ let rect = ui.max_rect();+ let rail = if left {+ Rect::from_x_y_ranges(rect.right() - t.space_4..=rect.right(), rect.y_range())+ } else {+ Rect::from_x_y_ranges(rect.left()..=rect.left() + t.space_4, rect.y_range())+ };+ let response = ui.interact(rail, Id::new("sc_agent_chat_resize"), Sense::drag()).on_hover_cursor(egui::CursorIcon::ResizeHorizontal);+ crate::scenario::publish_handle("agent_chat:resize", rail.center());+ if response.dragged() {+ let delta = ui.input(|i| i.pointer.delta().x) * if left { 1.0 } else { -1.0 };+ if delta.is_finite() {+ app.preferences.agent_chat_width = (width + delta).clamp(MIN_WIDTH, MAX_WIDTH);+ }+ }+ }+ }) {+ let rect = card.response.rect;+ app.agent_chat.panel_rect = Some(rect);+ app.agent_chat.drop_rect = Some(rect);+ crate::scenario::publish_rect("agent_chat:panel", rect);+ }+ #[cfg(not(target_arch = "wasm32"))]+ gallery_window(app, &ctx);+}+/// The pictures of a message as small thumbnails in a row. Hovering one shows it bigger for as long/// as the pointer stays; a click returns its place in the row, to open the viewer there.#[cfg(not(target_arch = "wasm32"))]@@ -182,7 +301,7 @@ fn gallery_window(app: &mut SolveApp, ctx: &egui::Context) {let mut step: isize = if left { -1 } else { isize::from(right) };let t = Tokens::get();let max = ctx.content_rect().size() * vec2(0.8, 0.7);- let modal = egui::Modal::new(Id::new("sc_agent_chat_gallery")).show(ctx, |ui| {+ let modal = ui_kit::Container::new(ctx, ui_kit::Surface::Window).modal(Id::new("sc_agent_chat_gallery")).show(ctx, |ui| {ui.set_max_width(max.x);ui.horizontal(|ui| {let prev = ui_kit::button(ui, tr("ui.agent_chat_previous_picture"), ui_kit::Button::Enabled(count > 1));@@ -301,8 +420,8 @@ fn window(app: &mut SolveApp, ctx: &egui::Context) {app.agent_chat.panel_rect = None;ctx.show_viewport_immediate(egui::ViewportId::from_hash_of("sc_agent_chat_window"), builder, |ui, class| {let t = Tokens::get();- let frame = egui::Frame::NONE.fill(t.panel).inner_margin(egui::Margin::symmetric(8, 6));- let r = egui::CentralPanel::default().frame(frame).show(ui, |ui| ui_kit::scope(ui, |ui| body(app, ui, false)));+ let frame = Container::new(ui.ctx(), Surface::Panel).edge_frame(t.dialog_body);+ let r = Container::new(ui.ctx(), Surface::Viewport).central().frame(frame).show(ui, |ui| ui_kit::scope(ui, |ui| body(app, ui, false)));// The picture viewer opens over this window, where the click was, not over the main one.gallery_window(app, ui.ctx());if class == egui::ViewportClass::EmbeddedWindow {@@ -351,7 +470,7 @@ pub fn take_focus_for_text(popped: bool, over_text: bool, chat_active: Option<bo/// A small drawn button: `kind` is `minimize`, `close`, `newchat`, `stopturn`, `pop_out` or `dock`.fn glyph_button(ui: &mut egui::Ui, kind: &str, tip: &str) -> egui::Response {let t = Tokens::get();- let (r, resp) = ui.allocate_exact_size(vec2(22.0, 22.0), Sense::click());+ let (r, resp) = ui.allocate_exact_size(vec2(t.form_close_size, t.form_close_size), Sense::click());if resp.hovered() {ui.painter().rect_filled(r, 4.0, t.hover);}@@ -392,6 +511,7 @@ fn glyph_button(ui: &mut egui::Ui, kind: &str, tip: &str) -> egui::Response {}_ => {}}+ crate::scenario::publish_rect(&format!("agent_chat:{kind}"), r);crate::scenario::publish_handle(&format!("agent_chat:{kind}"), r.center());resp.on_hover_text(tip)}@@ -445,70 +565,67 @@ fn strip(app: &mut SolveApp, ui: &mut egui::Ui) {/// Pop out (or Dock, in its own window), Minimise and Close. In its own window the system moves/// and minimises it, so there is no grip and no Minimise.fn header(app: &mut SolveApp, ui: &mut egui::Ui, left: bool) {+ let t = Tokens::get();let state = app.agent_chat.state();let popped = app.preferences.agent_chat_popped;- ui.horizontal(|ui| {- let title = {- let grip = if popped { ui.allocate_exact_size(vec2(0.0, 18.0), Sense::hover()).0 } else { ui_kit::panel_grip(ui).rect };- let l = ui.label(- RichText::new(tr("ui.agent_chat")).semibold().color(crate::theme::Tokens::get().text).size(crate::theme::Tokens::get().font_heading),- );- grip.union(l.rect)- };- let mut s = state.label().to_string();- if let Some(turn) = &app.agent_chat.turn- && state == State::Busy- {- let limit = app.preferences.agent_chat_turn_limit;- s = format!("{s} {}", trf("ui.agent_chat_changes_of", &[("n", &turn.changes.to_string()), ("limit", &limit.to_string())]));- }- ui.label(RichText::new(s).color(state_color(state)).small());- // Drag the header across the window to dock on the other side.- if !popped {- let drag = ui.interact(title, Id::new("sc_agent_chat_grip"), Sense::drag());- crate::scenario::publish_handle("agent_chat:grip", title.center());- dock_drag(app, ui, &drag, left);- }- ui.with_layout(Layout::right_to_left(Align::Center), |ui| {- if glyph_button(ui, "close", tr("ui.agent_chat_close")).clicked() {- app.agent_chat.open = false;- }- if !popped && glyph_button(ui, "minimize", tr("ui.agent_chat_minimize")).clicked() {- app.preferences.agent_chat_minimized = true;+ ui_kit::assistant_header(ui, |ui| {+ ui.horizontal(|ui| {+ let title = {+ let grip =+ if popped { ui.allocate_exact_size(vec2(0.0, t.space_16 + t.space_2), Sense::hover()).0 } else { ui_kit::panel_grip(ui).rect };+ let l = ui.label(RichText::new(tr("ui.assistant")).semibold().color(t.text).size(t.font_heading));+ grip.union(l.rect)+ };+ let waiting = app.agent_chat.waiting();+ let s = if waiting > 0 { tr("ui.agent_chat_waiting").to_string() } else { state.label().to_string() };+ if ui.available_width() > t.space_24 * 9.0 {+ ui_kit::assistant_badge(+ ui,+ &s,+ if waiting > 0 {+ ui_kit::AssistantTone::Warning+ } else {+ match state {+ State::Ready => ui_kit::AssistantTone::Success,+ State::Busy => ui_kit::AssistantTone::Working,+ State::NeedsAuth => ui_kit::AssistantTone::Warning,+ State::Exited => ui_kit::AssistantTone::Error,+ _ => ui_kit::AssistantTone::Neutral,+ }+ },+ );}- #[cfg(not(target_arch = "wasm32"))]- if glyph_button(- ui,- "newchat",- &format!("{} ({})", tr("ui.agent_chat_new"), if cfg!(target_os = "macos") { "Cmd+Shift+L" } else { "Ctrl+Shift+L" }),- )- .clicked()- {- request_new_chat(app);+ // Drag the header across the window to dock on the other side.+ if !popped {+ let drag = ui.interact(title, Id::new("sc_agent_chat_grip"), Sense::drag());+ crate::scenario::publish_handle("agent_chat:grip", title.center());+ dock_drag(app, ui, &drag, left);}- #[cfg(not(target_arch = "wasm32"))]- {- let (kind, tip) = if popped { ("dock", "ui.agent_chat_dock") } else { ("pop_out", "ui.agent_chat_pop_out") };- if glyph_button(ui, kind, tr(tip)).clicked() {- app.preferences.agent_chat_popped = !popped;+ ui.with_layout(Layout::right_to_left(Align::Center), |ui| {+ if glyph_button(ui, "close", tr("ui.agent_chat_close")).clicked() {+ app.agent_chat.open = false;}- }- #[cfg(not(target_arch = "wasm32"))]- {- let b = if state.running() {- ui_kit::button(ui, tr("ui.agent_chat_stop"), ui_kit::Button::Normal).on_hover_text(tr("ui.agent_chat_stop_tip"))- } else {- ui_kit::button(ui, tr("ui.agent_chat_connect"), ui_kit::Button::Normal)- };- crate::scenario::publish_handle("agent_chat:connect", b.rect.center());- if b.clicked() {- if state.running() {- disconnect(app);- } else {- connect(app, ui.ctx());+ if !popped && glyph_button(ui, "minimize", tr("ui.agent_chat_minimize")).clicked() {+ app.preferences.agent_chat_minimized = true;+ }+ #[cfg(not(target_arch = "wasm32"))]+ if glyph_button(+ ui,+ "newchat",+ &format!("{} ({})", tr("ui.agent_chat_new"), if cfg!(target_os = "macos") { "Cmd+Shift+L" } else { "Ctrl+Shift+L" }),+ )+ .clicked()+ {+ request_new_chat(app);+ }+ #[cfg(not(target_arch = "wasm32"))]+ {+ let (kind, tip) = if popped { ("dock", "ui.agent_chat_dock") } else { ("pop_out", "ui.agent_chat_pop_out") };+ if glyph_button(ui, kind, tr(tip)).clicked() {+ app.preferences.agent_chat_popped = !popped;}}- }+ });});});}@@ -526,16 +643,17 @@ fn dock_drag(app: &mut SolveApp, ui: &egui::Ui, drag: &egui::Response, left: boo{ui.ctx().set_cursor_icon(egui::CursorIcon::Grabbing);let to_left = target(p.x);- let w = app.preferences.agent_chat_width.clamp(MIN_WIDTH, MAX_WIDTH);- let top = screen.top() + crate::toolbar::APP_BAR_HEIGHT;- let zone = if to_left {- Rect::from_min_max(pos2(screen.left(), top), pos2(screen.left() + w, screen.bottom()))+ let available = app.agent_chat.dock_space.unwrap_or(screen);+ let zone = if Container::for_layout(app.ui.layout, Surface::Panel).floating() {+ floating_bounds(app, available, to_left)} else {- Rect::from_min_max(pos2(screen.right() - w, top), pos2(screen.right(), screen.bottom()))+ let w = app.preferences.agent_chat_width.clamp(MIN_WIDTH, MAX_WIDTH).min(available.width());+ Rect::from_min_size(pos2(if to_left { available.left() } else { available.right() - w }, available.top()), vec2(w, available.height()))};+ crate::scenario::publish_rect("agent_chat:dock_hint", zone);let t = Tokens::get();let painter = ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Foreground, Id::new("sc_agent_chat_dock_hint")));- painter.rect(zone.shrink(4.0), 8.0, t.accent.gamma_multiply(0.18), Stroke::new(2.0, t.accent), egui::StrokeKind::Inside);+ painter.rect(zone, t.radius_xl, t.accent.gamma_multiply(0.18), Stroke::new(2.0, t.accent), egui::StrokeKind::Inside);painter.text(zone.center(),Align2::CENTER_CENTER,@@ -555,7 +673,7 @@ fn dock_drag(app: &mut SolveApp, ui: &egui::Ui, drag: &egui::Response, left: boofn body(app: &mut SolveApp, ui: &mut egui::Ui, left: bool) {header(app, ui, left);#[cfg(not(target_arch = "wasm32"))]- switcher(app, ui);+ ui_kit::assistant_controls(ui, |ui| switcher(app, ui));#[cfg(target_arch = "wasm32")]{ui.label(tr("ui.agent_chat_desktop_only"));@@ -586,11 +704,16 @@ fn desktop_body(app: &mut SolveApp, ui: &mut egui::Ui) {});});}- picker(app, ui);+ // Discovery/install guidance must leave room for the pinned composer even when+ // several agents are listed, or when a long message grows the editor.+ egui::ScrollArea::vertical()+ .id_salt("sc_agent_chat_picker_scroll")+ .max_height(ui.available_height() / 3.0)+ .auto_shrink([false, true])+ .show(ui, |ui| picker(app, ui));if state == State::NeedsAuth {auth_box(app, ui);}- ui.separator();// The input sits at the bottom of the panel and grows upwards: a long message makes its box// taller up to `edit_max`, then it scrolls, and the conversation takes what is left above. It// is a panel of its own at the bottom, as high as its content this frame, so the buttons under@@ -606,55 +729,127 @@ fn desktop_body(app: &mut SolveApp, ui: &mut egui::Ui) {(false, false)};let (mut send_clicked, mut stop_clicked, mut enter) = (false, false, false);- egui::Panel::bottom(Id::new("sc_agent_chat_composer")).resizable(false).show_separator_line(false).frame(egui::Frame::NONE).show(ui, |ui| {- ui.separator();- // The files for the next message (#1744), as chips of their own.- attachment_chips(app, ui);- // Ctrl/Cmd+V: files and pictures on the clipboard attach; text goes to the box below.- #[cfg(not(target_arch = "wasm32"))]- if focused {- super::paste::handle(app, ui);- }- let r = egui::ScrollArea::vertical()- .id_salt("sc_agent_chat_input_scroll")- .max_height(edit_max)- .auto_shrink([false, true])- .show(ui, |ui| {- ui_kit::message_field(- ui,- Id::new("sc_agent_chat_input"),- &mut app.agent_chat.input,- tr(if busy { "ui.agent_chat_placeholder_busy" } else { "ui.agent_chat_placeholder" }),- )- })- .inner;- crate::scenario::publish_rect("agent_chat:input", r.rect);- // macOS shows a window's cursors only while it is the active window: over the text box of a- // chat window that isn't, the pointer stays an arrow. Coming from the main window, the chat- // window becomes active, so the text cursor shows and the first click places the caret.- let (chat_active, main_active) =- (ui.ctx().input(|i| i.viewport().focused), ui.ctx().input_for(egui::ViewportId::ROOT, |i| i.viewport().focused));- if take_focus_for_text(app.preferences.agent_chat_popped, r.hovered(), chat_active, main_active) {- ui.ctx().send_viewport_cmd(egui::ViewportCommand::Focus);- }- enter = r.has_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter) && !i.modifiers.shift);- ui.horizontal(|ui| {- add_menu(app, ui);- // A message waits for files still being read.- let reading = !app.agent_chat.loading.is_empty();- let send_b = ui_kit::button(ui, tr(if busy { "ui.agent_chat_queue" } else { "ui.agent_chat_send" }), ui_kit::Button::Enabled(!reading))- .on_disabled_hover_text(tr("ui.agent_chat_files_loading"));- crate::scenario::publish_handle("agent_chat:send", send_b.rect.center());- send_clicked = send_b.clicked();- stop_clicked = busy && glyph_button(ui, "stopturn", tr("ui.agent_chat_stop_turn_tip")).clicked();- // A picture of the view goes with the message to agents that take pictures.- let images = app.agent_chat.images || !state.running();- let attach = ui- .add_enabled_ui(images, |ui| ui_kit::checkbox(ui, tr("ui.agent_chat_attach_view"), &mut app.agent_chat.attach_view))- .inner- .on_hover_text(tr("ui.agent_chat_attach_view_tip"))- .on_disabled_hover_text(tr("ui.agent_chat_no_images"));- crate::scenario::publish_handle("agent_chat:attach", attach.rect.center());+ let frame = Container::new(ui.ctx(), Surface::Viewport).edge_frame(egui::Color32::TRANSPARENT);+ let composer = Container::new(ui.ctx(), Surface::Viewport).edge(Id::new("sc_agent_chat_composer"), Edge::Bottom);+ composer.resizable(false).show_separator_line(false).frame(frame).show(ui, |ui| {+ ui_kit::assistant_composer_footer(ui, |ui| {+ ui_kit::assistant_composer(ui, focused, |ui| {+ // The files for the next message (#1744), as chips of their own.+ attachment_chips(app, ui);+ // Ctrl/Cmd+V: files and pictures on the clipboard attach; text goes to the box below.+ #[cfg(not(target_arch = "wasm32"))]+ if focused {+ super::paste::handle(app, ui);+ }+ let r = egui::ScrollArea::vertical()+ .id_salt("sc_agent_chat_input_scroll")+ .max_height(edit_max)+ // Grow the bottom panel to the editor's scroll limit instead of letting+ // its previous short-message height clip the action rows below it.+ .min_scrolled_height(edit_max)+ .auto_shrink([false, true])+ .show(ui, |ui| {+ ui_kit::assistant_input(+ ui,+ Id::new("sc_agent_chat_input"),+ &mut app.agent_chat.input,+ tr(if busy { "ui.agent_chat_placeholder_busy" } else { "ui.agent_chat_placeholder" }),+ )+ })+ .inner;+ crate::scenario::publish_rect("agent_chat:input", r.rect);+ // macOS shows a window's cursors only while it is the active window: over the text box of a+ // chat window that isn't, the pointer stays an arrow. Coming from the main window, the chat+ // window becomes active, so the text cursor shows and the first click places the caret.+ let (chat_active, main_active) =+ (ui.ctx().input(|i| i.viewport().focused), ui.ctx().input_for(egui::ViewportId::ROOT, |i| i.viewport().focused));+ if take_focus_for_text(app.preferences.agent_chat_popped, r.hovered(), chat_active, main_active) {+ ui.ctx().send_viewport_cmd(egui::ViewportCommand::Focus);+ }+ enter = r.has_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter) && !i.modifiers.shift);+ ui.allocate_ui_with_layout(+ vec2(ui.available_width(), Tokens::get().control_height + Tokens::get().space_2),+ Layout::left_to_right(Align::Center),+ |ui| {+ ui.set_min_height(Tokens::get().control_height + Tokens::get().space_2);+ add_menu(app, ui);+ let agent =+ if state.running() { Some(app.agent_chat.running_id.clone()) } else { agents::current(app).map(|entry| entry.id) };+ let mode = agent.as_deref().map_or(app.preferences.ai_permissions, |id| agents::mode_for(&app.preferences, id));+ let permissions = ui+ .allocate_ui(vec2(Tokens::get().space_24 * 4.0, Tokens::get().control_height), |ui| {+ ui_kit::dropdown_menu(+ ui,+ "sc_agent_permissions",+ tr(match mode {+ agents::Mode::Ask => "ui.agent_chat_mode_ask",+ agents::Mode::Edits => "ui.agent_chat_mode_edits",+ agents::Mode::All => "ui.agent_chat_mode_all",+ }),+ |ui| {+ for choice in agents::Mode::ALL {+ if ui_kit::list_picker(ui, choice.id(), choice.label(), mode == choice).clicked() {+ if let Some(id) = &agent {+ app.preferences.agent_permissions.insert(id.clone(), choice);+ } else {+ app.preferences.ai_permissions = choice;+ }+ }+ }+ },+ )+ })+ .inner;+ let permissions = permissions.on_hover_text(mode.label());+ crate::scenario::publish_rect("agent_chat:permissions", permissions.rect);+ crate::scenario::publish_handle("agent_chat:permissions", permissions.rect.center());+ // A message waits for files still being read.+ let reading = !app.agent_chat.loading.is_empty();+ ui.with_layout(Layout::right_to_left(Align::Center), |ui| {+ let action = ui_kit::assistant_send(+ ui,+ busy || !reading,+ busy,+ tr(if busy { "ui.agent_chat_stop_turn_tip" } else { "ui.agent_chat_send" }),+ );+ if busy {+ crate::scenario::publish_handle("agent_chat:stopturn", action.rect.center());+ stop_clicked = action.clicked();+ let queued = ui_kit::button(ui, tr("ui.agent_chat_queue"), ui_kit::Button::Enabled(!reading));+ crate::scenario::publish_rect("agent_chat:send", queued.rect);+ crate::scenario::publish_handle("agent_chat:send", queued.rect.center());+ send_clicked = queued.clicked();+ } else {+ crate::scenario::publish_rect("agent_chat:send", action.rect);+ crate::scenario::publish_handle("agent_chat:send", action.rect.center());+ send_clicked = action.clicked();+ }+ });+ },+ );+ ui.allocate_ui_with_layout(+ vec2(ui.available_width(), Tokens::get().control_height),+ Layout::left_to_right(Align::Center).with_main_wrap(true),+ |ui| {+ ui.set_min_height(Tokens::get().control_height);+ // A picture of the view goes with the message to agents that take pictures.+ let images = app.agent_chat.images || !state.running();+ let attach = ui+ .add_enabled_ui(images, |ui| ui_kit::checkbox(ui, tr("ui.agent_chat_attach_view"), &mut app.agent_chat.attach_view))+ .inner+ .on_hover_text(tr("ui.agent_chat_attach_view_tip"))+ .on_disabled_hover_text(tr("ui.agent_chat_no_images"));+ crate::scenario::publish_handle("agent_chat:attach", attach.rect.center());+ if let Some(turn) = &app.agent_chat.turn {+ let count = trf(+ "ui.agent_chat_changes_of",+ &[("n", &turn.changes.to_string()), ("limit", &app.preferences.agent_chat_turn_limit.to_string())],+ );+ ui.label(RichText::new(count).color(Tokens::get().text_dim).size(Tokens::get().font_small));+ }+ },+ );+ });});});egui::ScrollArea::vertical()@@ -663,7 +858,10 @@ fn desktop_body(app: &mut SolveApp, ui: &mut egui::Ui) {.auto_shrink([false, false]).stick_to_bottom(true).show(ui, |ui| {- conversation(app, ui);+ egui::Frame::NONE.inner_margin(egui::Margin::same(Tokens::get().space_12 as i8)).show(ui, |ui| {+ ui.spacing_mut().item_spacing.y = Tokens::get().space_10;+ conversation(app, ui);+ });});if esc || stop_clicked {cancel(app);@@ -706,7 +904,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {let t = Tokens::get();let all = agents::entries(app);let current = agents::current(app);- ui.horizontal(|ui| {+ ui.horizontal_wrapped(|ui| {let label = current.as_ref().map_or_else(|| tr(if app.agent_chat.detecting.is_some() { "ui.agent_chat_detecting" } else { "ui.agent_chat_none_found_short" }).to_string(),|e| e.name.clone(),@@ -718,6 +916,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {let mut add = false;let combo = ui.allocate_ui(vec2(w, t.control_height), |ui| {+ ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate);ui_kit::dropdown_menu(ui, "sc_agent_switch", &label, |ui| {for e in &all {let sel = current.as_ref().is_some_and(|c| c.id == e.id);@@ -737,6 +936,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {})}).inner;+ crate::scenario::publish_rect("agent_chat:switcher", combo.rect);crate::scenario::publish_handle("agent_chat:switcher", combo.rect.center());combo.on_hover_text(tr("ui.ai_switch_tip"));if add {@@ -755,6 +955,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {let mut pick: Option<String> = None;let r = ui.allocate_ui(vec2(t.form_label_width, t.control_height), |ui| {+ ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate);ui_kit::dropdown_menu(ui, "sc_agent_mode", &cur, |ui| {for (id, name) in &modes {if ui_kit::list_picker(ui, id, name, *id == app.agent_chat.mode).clicked() {@@ -764,6 +965,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {})}).inner;+ crate::scenario::publish_rect("agent_chat:mode", r.rect);crate::scenario::publish_handle("agent_chat:mode", r.rect.center());r.on_hover_text(tr("ui.ai_agent_mode_tip"));if let Some(m) = pick {@@ -777,6 +979,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {let mut pick: Option<String> = None;let r = ui.allocate_ui(vec2(t.form_label_width, t.control_height), |ui| {+ ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate);ui_kit::dropdown_menu(ui, "sc_agent_model", &cur, |ui| {for m in &list {let row = ui_kit::list_picker(ui, &m.id, &m.name, m.id == app.agent_chat.model);@@ -789,6 +992,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {})}).inner;+ crate::scenario::publish_rect("agent_chat:model", r.rect);crate::scenario::publish_handle("agent_chat:model", r.rect.center());r.on_hover_text(tr("ui.agent_chat_model_tip"));if let Some(m) = pick {@@ -796,6 +1000,21 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {}}});+ ui.horizontal(|ui| {+ let b = if app.agent_chat.state().running() {+ ui_kit::button(ui, tr("ui.agent_chat_stop"), ui_kit::Button::Normal).on_hover_text(tr("ui.agent_chat_stop_tip"))+ } else {+ ui_kit::button(ui, tr("ui.agent_chat_connect"), ui_kit::Button::Normal)+ };+ crate::scenario::publish_handle("agent_chat:connect", b.rect.center());+ if b.clicked() {+ if app.agent_chat.state().running() {+ disconnect(app);+ } else {+ connect(app, ui.ctx());+ }+ }+ });if let Some(a) = &app.agent_chat.auth_status {ui.label(RichText::new(a).color(t.text_dim).size(crate::theme::Tokens::get().font_small));}@@ -910,9 +1129,7 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {for (n, item) in app.agent_chat.items.iter().enumerate() {match item {Item::User { text, image, pictures, files } => {- ui.add_space(6.0);- egui::Frame::NONE.fill(t.accent_soft).corner_radius(6.0).inner_margin(egui::Margin::same(6)).show(ui, |ui| {- ui.set_width(ui.available_width());+ ui_kit::assistant_bubble(ui, |ui| {if !text.is_empty() {ui.add(egui::Label::new(RichText::new(text).color(t.text)).selectable(true).wrap());}@@ -931,11 +1148,21 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {if *thought {ui.add(egui::Label::new(RichText::new(text).italics().color(t.text_dim)).selectable(true).wrap());} else {- super::markdown_view::show(ui, n, text);+ ui_kit::assistant_prose(ui, |ui| super::markdown_view::show(ui, n, text));}}- Item::Tool { title, kind, status, output, .. } => {- tool_card(ui, n, title, kind, *status, output.as_deref());+ Item::Tool { .. } => {+ if n > 0 && matches!(app.agent_chat.items.get(n - 1), Some(Item::Tool { .. })) {+ continue;+ }+ ui_kit::assistant_tool_frame(ui, false, |ui| {+ ui.spacing_mut().item_spacing.y = Tokens::get().space_2;+ for (offset, next) in app.agent_chat.items.iter().skip(n).take_while(|next| matches!(next, Item::Tool { .. })).enumerate() {+ if let Item::Tool { title, kind, status, output, .. } = next {+ tool_card(ui, n + offset, title, kind, *status, output.as_deref());+ }+ }+ });}Item::Plan(entries) => {for (c, s) in entries {@@ -951,36 +1178,41 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {}}Item::Permission { title, options, answer: given, .. } => {- egui::Frame::group(ui.style()).stroke(Stroke::new(1.0, t.accent)).show(ui, |ui| {- ui.set_width(ui.available_width());- ui.label(RichText::new(trf("ui.agent_chat_permission", &[("title", title)])).semibold().color(crate::theme::Tokens::get().text));- match given {- Some(a) => {- ui.label(RichText::new(trf("ui.agent_chat_answered", &[("option", a)])).color(t.text_dim));- }- None => {- ui.horizontal_wrapped(|ui| {- for o in options {- let r = if o.kind.starts_with("allow") {- ui_kit::primary_button(ui, &o.name)- } else {- ui_kit::button(ui, &o.name, ui_kit::Button::Normal)- };+ ui_kit::assistant_approval(ui, &trf("ui.agent_chat_permission", &[("title", title)]), |ui| match given {+ Some(a) => {+ ui.label(RichText::new(trf("ui.agent_chat_answered", &[("option", a)])).color(t.text_dim));+ }+ None => {+ ui_kit::assistant_actions(ui, |ui| {+ for o in options.iter().filter(|o| o.kind == "allow_once").chain(options.iter().filter(|o| o.kind == "allow_always")) {+ let r = if o.kind == "allow_once" {+ ui_kit::primary_button(ui, &o.name)+ } else {+ ui_kit::button(ui, &o.name, ui_kit::Button::Normal)+ };+ crate::scenario::publish_handle(&format!("agent_chat:permission:{}", o.id), r.rect.center());+ if r.clicked() {+ answer = Some((n, Some(o.id.clone())));+ }+ }+ ui.with_layout(Layout::left_to_right(Align::Center).with_main_wrap(true), |ui| {+ for o in options.iter().filter(|o| !matches!(o.kind.as_str(), "allow_once" | "allow_always")) {+ let r = ui_kit::button(ui, &o.name, ui_kit::Button::Normal);crate::scenario::publish_handle(&format!("agent_chat:permission:{}", o.id), r.rect.center());if r.clicked() {answer = Some((n, Some(o.id.clone())));}}});- }+ });}});}Item::Approval { id, title, tool, answer: given } => {- egui::Frame::group(ui.style()).stroke(Stroke::new(1.5, t.warning)).show(ui, |ui| {- ui.set_width(ui.available_width());- ui.label(RichText::new(tr("ui.agent_chat_approval")).semibold().color(crate::theme::Tokens::get().text));- ui.add(egui::Label::new(RichText::new(title).monospace().size(crate::theme::Tokens::get().font_caption)).selectable(true).wrap());+ ui_kit::assistant_approval(ui, tr("ui.agent_chat_approval"), |ui| {+ ui_kit::assistant_tool_detail(ui, |ui| {+ ui.add(egui::Label::new(RichText::new(title).monospace().size(t.font_caption)).selectable(true).wrap());+ });match given {Some(true) => {ui.label(RichText::new(tr("ui.agent_chat_allowed")).color(t.text_dim));@@ -989,11 +1221,15 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {ui.label(RichText::new(tr("ui.agent_chat_denied")).color(t.text_dim));}None => {- ui.horizontal(|ui| {- let allow = ui_kit::primary_button(ui, tr("ui.agent_chat_allow"));+ ui_kit::assistant_actions(ui, |ui| {+ let allow = ui_kit::primary_button(ui, tr("ui.agent_chat_allow_once"));let always = ui_kit::button(ui, tr("ui.ai_always_allow"), ui_kit::Button::Normal).on_hover_text(trf("ui.ai_always_allow_tip", &[("tool", tool)]));- let deny = ui_kit::button(ui, tr("ui.agent_chat_deny"), ui_kit::Button::Normal);+ let deny = ui+ .with_layout(Layout::left_to_right(Align::Center), |ui| {+ ui_kit::button(ui, tr("ui.agent_chat_deny"), ui_kit::Button::Normal)+ })+ .inner;crate::scenario::publish_handle("agent_chat:allow", allow.rect.center());crate::scenario::publish_handle("agent_chat:always", always.rect.center());crate::scenario::publish_handle("agent_chat:deny", deny.rect.center());@@ -1027,10 +1263,11 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {});}Item::Notice { text, error } => {- ui.label(RichText::new(text).color(if *error { t.error } else { t.text_dim }));+ ui_kit::assistant_banner(ui, if *error { ui_kit::AssistantTone::Error } else { ui_kit::AssistantTone::Neutral }, |ui| {+ ui.label(RichText::new(text).color(if *error { t.error } else { t.text_dim }));+ });}}- ui.add_space(2.0);}let (mut send_now_clicked, mut send_queue_clicked) = (false, false);let mut remove: Option<usize> = None;@@ -1042,50 +1279,55 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {let mut edit_buf = editing.as_ref().map(|(_, b)| b.clone());for (n, p) in app.agent_chat.pending.iter().enumerate() {ui.add_space(6.0);- egui::Frame::NONE.fill(t.panel).stroke(Stroke::new(1.0, t.accent)).corner_radius(6.0).inner_margin(egui::Margin::same(6)).show(ui, |ui| {- ui.set_width(ui.available_width());- ui.horizontal(|ui| {- let tag = if stopped && !busy { "ui.agent_chat_queued_stopped" } else { "ui.agent_chat_queued" };- ui.label(RichText::new(tr(tag)).color(t.accent).semibold().size(crate::theme::Tokens::get().font_small));- ui.with_layout(Layout::right_to_left(Align::Center), |ui| {- let x = ui_kit::button(ui, "×", ui_kit::Button::Small).on_hover_text(tr("ui.agent_chat_remove"));- crate::scenario::publish_handle(&format!("agent_chat:pending_remove:{n}"), x.rect.center());- if x.clicked() {- remove = Some(n);- }- if editing.as_ref().is_none_or(|(i, _)| *i != n) {- let e = ui_kit::button(ui, tr("ui.agent_chat_edit"), ui_kit::Button::Small);- crate::scenario::publish_handle(&format!("agent_chat:pending_edit:{n}"), e.rect.center());- if e.clicked() {- start_edit = Some((n, p.text.clone()));- }- }- });- });- match (&editing, edit_buf.as_mut()) {- (Some((i, _)), Some(buf)) if *i == n => {- let te = ui_kit::message_field(ui, Id::new(("sc_agent_pending_input", n)), buf, "");- crate::scenario::publish_rect("agent_chat:pending_input", te.rect);- ui.horizontal(|ui| {- if ui_kit::button(ui, tr("ui.agent_chat_save"), ui_kit::Button::Normal).clicked() {- edit_done = Some((n, Some(buf.clone())));+ Container::new(ui.ctx(), Surface::Panel)+ .edge_frame(t.panel)+ .stroke(Stroke::new(1.0, t.accent))+ .corner_radius(6.0)+ .inner_margin(egui::Margin::same(6))+ .show(ui, |ui| {+ ui.set_width(ui.available_width());+ ui.horizontal(|ui| {+ let tag = if stopped && !busy { "ui.agent_chat_queued_stopped" } else { "ui.agent_chat_queued" };+ ui.label(RichText::new(tr(tag)).color(t.accent).semibold().size(crate::theme::Tokens::get().font_small));+ ui.with_layout(Layout::right_to_left(Align::Center), |ui| {+ let x = ui_kit::button(ui, "×", ui_kit::Button::Small).on_hover_text(tr("ui.agent_chat_remove"));+ crate::scenario::publish_handle(&format!("agent_chat:pending_remove:{n}"), x.rect.center());+ if x.clicked() {+ remove = Some(n);}- if ui_kit::button(ui, tr("ui.agent_chat_cancel"), ui_kit::Button::Normal).clicked() {- edit_done = Some((n, None));+ if editing.as_ref().is_none_or(|(i, _)| *i != n) {+ let e = ui_kit::button(ui, tr("ui.agent_chat_edit"), ui_kit::Button::Small);+ crate::scenario::publish_handle(&format!("agent_chat:pending_edit:{n}"), e.rect.center());+ if e.clicked() {+ start_edit = Some((n, p.text.clone()));+ }}});- }- _ => {- if !p.text.is_empty() {- ui.add(egui::Label::new(RichText::new(&p.text).color(t.text)).selectable(true).wrap());+ });+ match (&editing, edit_buf.as_mut()) {+ (Some((i, _)), Some(buf)) if *i == n => {+ let te = ui_kit::message_field(ui, Id::new(("sc_agent_pending_input", n)), buf, "");+ crate::scenario::publish_rect("agent_chat:pending_input", te.rect);+ ui.horizontal(|ui| {+ if ui_kit::button(ui, tr("ui.agent_chat_save"), ui_kit::Button::Normal).clicked() {+ edit_done = Some((n, Some(buf.clone())));+ }+ if ui_kit::button(ui, tr("ui.agent_chat_cancel"), ui_kit::Button::Normal).clicked() {+ edit_done = Some((n, None));+ }+ });}- if p.image {- ui.label(RichText::new(tr("ui.agent_chat_view_attached")).color(t.text_dim).size(crate::theme::Tokens::get().font_small));+ _ => {+ if !p.text.is_empty() {+ ui.add(egui::Label::new(RichText::new(&p.text).color(t.text)).selectable(true).wrap());+ }+ if p.image {+ ui.label(RichText::new(tr("ui.agent_chat_view_attached")).color(t.text_dim).size(crate::theme::Tokens::get().font_small));+ }+ files_line(ui, p.files.iter().map(|f| f.name.as_str()));}- files_line(ui, p.files.iter().map(|f| f.name.as_str()));}- }- });+ });}if !app.agent_chat.pending.is_empty() && editing.is_none() {ui.horizontal(|ui| {@@ -1106,10 +1348,18 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {slot.1 = buf;}if app.agent_chat.items.is_empty() && app.agent_chat.pending.is_empty() {- ui.add_space(12.0);- ui.label(RichText::new(tr("ui.agent_chat_intro")).color(t.text_dim));- ui.add_space(6.0);- ui.label(RichText::new(tr("ui.agent_chat_privacy")).color(t.text_dim).size(crate::theme::Tokens::get().font_small));+ if agents::entries(app).is_empty() && app.agent_chat.detecting.is_none() {+ ui_kit::assistant_empty(ui, tr("ui.agent_chat_setup_title"), tr("ui.agent_chat_setup_body"), |ui| {+ if ui_kit::primary_button(ui, tr("ui.agent_chat_open_settings")).clicked() {+ crate::prefs::open_at(app, crate::prefs::PAGE_AI);+ }+ });+ } else {+ ui_kit::assistant_prose(ui, |ui| {+ ui.label(RichText::new(tr("ui.agent_chat_intro")).color(t.text_dim));+ ui.label(RichText::new(tr("ui.agent_chat_privacy")).color(t.text_dim).size(t.font_small));+ });+ }}if let Some((n, text)) = edit_done {if let (Some(text), Some(p)) = (text.filter(|t| !t.trim().is_empty()), app.agent_chat.pending.get_mut(n)) {@@ -1340,57 +1590,53 @@ fn add_menu(app: &mut SolveApp, ui: &mut egui::Ui) {#[cfg(not(target_arch = "wasm32"))]fn tool_card(ui: &mut egui::Ui, n: usize, title: &str, kind: &str, status: Option<ToolStatus>, output: Option<&str>) {let t = Tokens::get();- let (color, filled, state) = match status {- Some(ToolStatus::Completed) => (t.accent, true, "ui.ai_tool_done"),- Some(ToolStatus::Failed) => (t.error, true, "ui.ai_tool_failed"),- Some(ToolStatus::InProgress) => (t.warning, true, "ui.ai_tool_running"),- _ => (t.text_dim, false, "ui.ai_tool_waiting"),+ let (color, mark, state) = match status {+ Some(ToolStatus::Completed) => (t.form_success, ui_kit::AssistantToolState::Done, "ui.ai_tool_done"),+ Some(ToolStatus::Failed) => (t.error, ui_kit::AssistantToolState::Failed, "ui.ai_tool_failed"),+ Some(ToolStatus::InProgress) => (t.accent, ui_kit::AssistantToolState::Running, "ui.ai_tool_running"),+ _ => (t.text_dim, ui_kit::AssistantToolState::Pending, "ui.ai_tool_waiting"),};- egui::Frame::NONE.fill(t.toolbar).stroke(Stroke::new(1.0, t.border)).corner_radius(6.0).inner_margin(egui::Margin::symmetric(6, 3)).show(- ui,- |ui| {- ui.set_width(ui.available_width());- let id = ui.make_persistent_id(("sc_agent_tool", n));- let mut state_ = egui::collapsing_header::CollapsingState::load_with_default_open(ui.ctx(), id, false);- let head = ui.horizontal(|ui| {+ ui_kit::assistant_tool_row(ui, status == Some(ToolStatus::Failed), |ui| {+ ui.set_width(ui.available_width());+ let id = ui.make_persistent_id(("sc_agent_tool", n));+ let mut state_ = egui::collapsing_header::CollapsingState::load_with_default_open(ui.ctx(), id, false);+ let head = ui.allocate_ui_with_layout(vec2(ui.available_width(), t.control_height + t.space_2), Layout::left_to_right(Align::Center), |ui| {+ ui.spacing_mut().item_spacing.x = t.space_8;+ ui_kit::assistant_tool_status(ui, mark);+ ui.with_layout(Layout::right_to_left(Align::Center), |ui| {if output.is_some() {- let (rect, _) = ui.allocate_exact_size(vec2(t.form_section_icon_size, t.form_section_icon_size), Sense::hover());+ let (rect, _) = ui.allocate_exact_size(vec2(t.space_14, t.space_14), Sense::hover());ui_kit::disclosure(ui.painter(), rect.center(), state_.is_open(), t.text_dim);}- status_dot(ui, color, filled);- // The state and kind keep their room at the right; the title is cut short before them.- ui.with_layout(Layout::right_to_left(Align::Center), |ui| {- ui.label(RichText::new(tr(state)).size(crate::theme::Tokens::get().font_panel).color(color));- if !kind.is_empty() && kind != "other" {- ui.label(RichText::new(kind).size(crate::theme::Tokens::get().font_panel).color(t.text_dim));- }- ui.with_layout(Layout::left_to_right(Align::Center), |ui| {- ui.add(- egui::Label::new(RichText::new(title).monospace().size(crate::theme::Tokens::get().font_caption).color(t.text))- .truncate(),- )- .on_hover_text(title);- });+ ui.label(RichText::new(tr(state)).size(t.font_small).color(color));+ if !kind.is_empty() && kind != "other" {+ ui.label(RichText::new(kind).size(t.font_small).color(t.text_dim));+ }+ ui.with_layout(Layout::left_to_right(Align::Center), |ui| {+ ui.add(egui::Label::new(RichText::new(title).monospace().size(t.font_caption).color(t.text)).truncate()).on_hover_text(title);});});- let click = ui.interact(head.response.rect, id.with("head"), Sense::click());- crate::scenario::publish_handle(&format!("agent_chat:tool:{n}"), head.response.rect.center());- if output.is_some() && click.clicked() {- state_.toggle(ui);- }- if output.is_some() {- click.on_hover_text(tr("ui.ai_tool_unfold"));- }- state_.show_body_unindented(ui, |ui| {- if let Some(o) = output {- ui.separator();- egui::ScrollArea::vertical().id_salt(("sc_agent_tool_out", n)).max_height(180.0).show(ui, |ui| {- ui.add(egui::Label::new(RichText::new(o).monospace().size(crate::theme::Tokens::get().font_small)).selectable(true).wrap());+ });+ let click = ui.interact(head.response.rect, id.with("head"), Sense::click());+ crate::scenario::publish_handle(&format!("agent_chat:tool:{n}"), head.response.rect.center());+ if output.is_some() && click.clicked() {+ state_.toggle(ui);+ }+ if output.is_some() {+ click.on_hover_text(tr("ui.ai_tool_unfold"));+ }+ state_.show_body_unindented(ui, |ui| {+ if let Some(o) = output {+ ui.indent(id.with("detail"), |ui| {+ ui_kit::assistant_tool_detail(ui, |ui| {+ egui::ScrollArea::vertical().id_salt(("sc_agent_tool_out", n)).max_height(180.0).show(ui, |ui| {+ ui.add(egui::Label::new(RichText::new(o).monospace().size(t.font_small)).selectable(true).wrap());+ });});- }- });- },- );+ });+ }+ });+ });}/// A small status mark drawn as a shape (no glyph a system font might lack): filled when the@@ -1442,4 +1688,121 @@ mod tests {toggle(&mut app);assert!(!app.agent_chat.open);}++ #[test]+ fn assistant_header_and_composer_keep_actions_inside_each_panel_width() {+ for dark in [false, true] {+ crate::theme::set_dark(dark);+ for width in [280.0, 440.0, 760.0] {+ let ctx = crate::fonts::test_context();+ crate::theme::apply(&ctx);+ let mut app = SolveApp::new(solidcraft_engine::Session::default(), crate::Services::default());+ app.agent_chat.detection = Some(discover::Detection::default());+ app.agent_chat.picking = Some(false);+ app.agent_chat.state = Some(State::Ready);+ app.agent_chat.input = "Make a plate".to_string();+ let input =+ egui::RawInput { screen_rect: Some(Rect::from_min_size(egui::Pos2::ZERO, vec2(width + 16.0, 720.0))), ..Default::default() };+ for _ in 0..2 {+ crate::scenario::clear_handles();+ let mut output = ctx.run_ui(input.clone(), |ui| {+ ui.set_width(width);+ ui_kit::scope(ui, |ui| {+ header(&mut app, ui, false);+ desktop_body(&mut app, ui);+ });+ });+ output.textures_delta.clear();+ }+ let controls: Vec<_> = ["close", "minimize", "newchat", "pop_out", "permissions", "send"]+ .into_iter()+ .map(|name| {+ let key = format!("agent_chat:{name}");+ let rect = crate::scenario::rect_of(&key).unwrap_or_else(|| panic!("missing {key}"));+ assert!(rect.left() >= 0.0 && rect.right() <= width + 16.0, "{key} outside {width}: {rect:?}");+ rect+ })+ .collect();+ for (i, a) in controls.iter().enumerate() {+ for b in controls.iter().skip(i + 1) {+ assert!(!a.shrink(0.5).intersects(b.shrink(0.5)), "overlapping Assistant controls at {width}: {a:?} {b:?}");+ }+ }+ }+ }+ }++ #[test]+ fn assistant_permissions_keep_provider_choices_and_responsive_approval_actions() {+ for width in [280.0, 440.0, 760.0] {+ let ctx = crate::fonts::test_context();+ let mut app = SolveApp::new(solidcraft_engine::Session::default(), crate::Services::default());+ app.agent_chat.items.push(Item::Permission {+ key: 4,+ title: "Run solid.fillet".into(),+ answer: None,+ options: vec![+ PermissionOption { id: "reject".into(), name: "Deny".into(), kind: "reject_once".into() },+ PermissionOption { id: "remember".into(), name: "Always allow".into(), kind: "allow_always".into() },+ PermissionOption { id: "once".into(), name: "Allow once".into(), kind: "allow_once".into() },+ PermissionOption { id: "custom".into(), name: "Review details".into(), kind: "provider_specific".into() },+ ],+ });+ let input = egui::RawInput { screen_rect: Some(Rect::from_min_size(egui::Pos2::ZERO, vec2(width + 16.0, 720.0))), ..Default::default() };+ crate::scenario::clear_handles();+ let mut output = ctx.run_ui(input, |ui| {+ ui.set_width(width);+ ui_kit::scope(ui, |ui| conversation(&mut app, ui));+ });+ output.textures_delta.clear();+ for id in ["reject", "remember", "once", "custom"] {+ let at = crate::scenario::handle_at(&format!("agent_chat:permission:{id}")).expect("provider option retained");+ assert!(at.x > 0.0 && at.x < width + 16.0, "choice outside {width}: {id} {at:?}");+ }+ let once = crate::scenario::handle_at("agent_chat:permission:once").expect("once");+ let always = crate::scenario::handle_at("agent_chat:permission:remember").expect("always");+ assert!(once.x > always.x, "primary once choice remains on the right");+ assert_eq!(app.agent_chat.waiting(), 1, "drawing never answers an approval");+ }+ }++ #[test]+ fn assistant_agent_mode_and_model_wrap_without_escaping_narrow_width() {+ let ctx = crate::fonts::test_context();+ let mut app = SolveApp::new(solidcraft_engine::Session::default(), crate::Services::default());+ app.agent_chat.state = Some(State::Ready);+ app.agent_chat.detection = Some(discover::Detection::default());+ app.agent_chat.agent_id = Some("fixture".into());+ app.preferences.agents.push(agents::AgentConfig {+ id: "fixture".into(),+ name: "A coding agent with a long descriptive name".into(),+ command: "fixture".into(),+ ..Default::default()+ });+ app.agent_chat.modes = vec![("edit".into(), "A provider mode with a long descriptive label".into())];+ app.agent_chat.mode = "edit".into();+ app.agent_chat.models =+ vec![acp::ModelInfo { id: "model".into(), name: "A model with a long descriptive label".into(), description: String::new() }];+ app.agent_chat.model = "model".into();+ let input = egui::RawInput { screen_rect: Some(Rect::from_min_size(egui::Pos2::ZERO, vec2(296.0, 720.0))), ..Default::default() };+ crate::scenario::clear_handles();+ let mut output = ctx.run_ui(input, |ui| {+ ui.set_width(280.0);+ ui_kit::scope(ui, |ui| switcher(&mut app, ui));+ });+ output.textures_delta.clear();+ let rects: Vec<_> = ["switcher", "mode", "model"]+ .into_iter()+ .map(|name| {+ let rect = crate::scenario::rect_of(&format!("agent_chat:{name}")).expect("picker retained");+ assert!(rect.left() >= 0.0 && rect.right() <= 296.0, "{name} outside narrow panel: {rect:?}");+ rect+ })+ .collect();+ for (n, a) in rects.iter().enumerate() {+ for b in rects.iter().skip(n + 1) {+ assert!(!a.shrink(0.5).intersects(b.shrink(0.5)), "picker overlap: {a:?} {b:?}");+ }+ }+ }}diff --git a/crates/ui-egui/src/agent_chat/tests.rs b/crates/ui-egui/src/agent_chat/tests.rsindex d4ea32c878..04c215735b 100644--- a/crates/ui-egui/src/agent_chat/tests.rs+++ b/crates/ui-egui/src/agent_chat/tests.rs@@ -1468,12 +1468,17 @@ fn a_long_message_keeps_the_buttons_in_the_window() {}h.frames(4);let bottom = |h: &crate::scenario::Harness| f64::from(h.app.agent_chat.panel_rect.map(|r| r.bottom()).expect("the panel is drawn"));- let [_, rest] = h.widget("Send").expect("the Send button is drawn");- let rest = bottom(&h) - rest;+ let resting: Vec<_> = ["Send", "Attach view"]+ .into_iter()+ .map(|name| {+ let [_, y] = h.widget(name).unwrap_or_else(|| panic!("{name} is drawn"));+ (name, bottom(&h) - y)+ })+ .collect();h.app.agent_chat.input = "Please make the plate thicker and then add a fillet on every outside edge.\n".repeat(60);h.frames(8);let window = 1000.0;- for name in ["Send", "Attach view"] {+ for (name, rest) in resting {let [_, y] = h.widget(name).unwrap_or_else(|| panic!("{name} is drawn"));assert!(y < window, "{name} is at {y}, below the window's bottom at {window}");// The box is pinned to the bottom and grows upwards: the buttons stay where they werediff --git a/crates/ui-egui/src/bom_panel.rs b/crates/ui-egui/src/bom_panel.rsindex d57c05522b..a7cab4b1fa 100644--- a/crates/ui-egui/src/bom_panel.rs+++ b/crates/ui-egui/src/bom_panel.rs@@ -85,93 +85,93 @@ fn apply(app: &mut SolveApp, d: &mut BomPanel, row: &Value) {pub fn show(app: &mut SolveApp, ctx: &egui::Context) {let Some(mut d) = app.bom.take() else { return };let t = Tokens::get();- let mut open = true;let bom = d.rows(app);let rows: Vec<Value> = bom["rows"].as_array().cloned().unwrap_or_default();let (mut export, mut apply_row) = (None, None);- let title = RichText::new(crate::i18n::tr_label("Bill of Materials")).strong().size(t.font_button);- crate::frame::window(ctx, title, crate::frame::Width::Wide).id(egui::Id::new("sc_bom")).open(&mut open).resizable(true).show(ctx, |ui| {- ui.horizontal_wrapped(|ui| {- let was = (d.top, d.by_definition, d.group_children);- let mut levels = usize::from(d.top);- let levels_width = crate::ui_kit::ContentWidth::button(ui, "Parts only").max(crate::ui_kit::ContentWidth::button(ui, "Top level")) * 2.0;- ui.allocate_ui(egui::vec2(levels_width, crate::ui_kit::row_height()), |ui| {- crate::ui_kit::segmented(ui, &mut levels, &["Parts only", "Top level"], Default::default());- });- d.top = levels == 1;- ui.separator();- let mut grouping = usize::from(d.by_definition);- let grouping_width =- crate::ui_kit::ContentWidth::button(ui, "By part number").max(crate::ui_kit::ContentWidth::button(ui, "By definition")) * 2.0;- ui.allocate_ui(egui::vec2(grouping_width, crate::ui_kit::row_height()), |ui| {- crate::ui_kit::segmented(ui, &mut grouping, &["By part number", "By definition"], Default::default());+ let closed =+ crate::ui_kit::Window::new(egui::Id::new("sc_bom"), "bom", crate::i18n::tr_label("Bill of Materials")).cards(3.0).show_body(ctx, |ui| {+ ui.horizontal_wrapped(|ui| {+ let was = (d.top, d.by_definition, d.group_children);+ let mut levels = usize::from(d.top);+ let levels_width =+ crate::ui_kit::ContentWidth::button(ui, "Parts only").max(crate::ui_kit::ContentWidth::button(ui, "Top level")) * 2.0;+ ui.allocate_ui(egui::vec2(levels_width, crate::ui_kit::row_height()), |ui| {+ crate::ui_kit::segmented(ui, &mut levels, &["Parts only", "Top level"], Default::default());+ });+ d.top = levels == 1;+ ui.separator();+ let mut grouping = usize::from(d.by_definition);+ let grouping_width =+ crate::ui_kit::ContentWidth::button(ui, "By part number").max(crate::ui_kit::ContentWidth::button(ui, "By definition")) * 2.0;+ ui.allocate_ui(egui::vec2(grouping_width, crate::ui_kit::row_height()), |ui| {+ crate::ui_kit::segmented(ui, &mut grouping, &["By part number", "By definition"], Default::default());+ });+ d.by_definition = grouping == 1;+ ui.separator();+ crate::ui_kit::checkbox(ui, "Sub-parts in their part's row", &mut d.group_children);+ if was != (d.top, d.by_definition, d.group_children) {+ d.picked = None;+ }});- d.by_definition = grouping == 1;ui.separator();- crate::ui_kit::checkbox(ui, "Sub-parts in their part's row", &mut d.group_children);- if was != (d.top, d.by_definition, d.group_children) {- d.picked = None;- }- });- ui.separator();- egui::ScrollArea::vertical().max_height(320.0).show(ui, |ui| {- egui::Grid::new("sc_bom_grid").num_columns(6).striped(true).spacing([14.0, 4.0]).show(ui, |ui| {- for h in ["Item", "Part number", "Description", "Rev", "Qty", "Definition"] {- ui.label(RichText::new(h).strong().color(t.text_dim));- }- ui.end_row();- for (i, row) in rows.iter().enumerate() {- let picked = d.picked == Some(i);- if crate::ui_kit::list_picker(ui, &i.to_string(), &text(row, "item"), picked).clicked() {- d.picked = if picked { None } else { Some(i) };- d.fields = [text(row, "part_number"), text(row, "description"), text(row, "revision")];+ egui::ScrollArea::vertical().max_height(320.0).show(ui, |ui| {+ egui::Grid::new("sc_bom_grid").num_columns(6).striped(true).spacing([14.0, 4.0]).show(ui, |ui| {+ for h in ["Item", "Part number", "Description", "Rev", "Qty", "Definition"] {+ ui.label(RichText::new(h).strong().color(t.text_dim));}- ui.label(text(row, "part_number"));- ui.label(text(row, "description"));- ui.label(text(row, "revision"));- ui.label(text(row, "count"));- ui.label(RichText::new(text(row, "definition")).color(t.text_dim));ui.end_row();- for c in row["children"].as_array().into_iter().flatten() {- ui.label(RichText::new(text(c, "item")).color(t.text_dim));- ui.label(text(c, "part_number"));- ui.label(text(c, "description"));- ui.label(text(c, "revision"));- ui.label(text(c, "count"));- ui.label(RichText::new(text(c, "definition")).color(t.text_dim));+ for (i, row) in rows.iter().enumerate() {+ let picked = d.picked == Some(i);+ if crate::ui_kit::list_picker(ui, &i.to_string(), &text(row, "item"), picked).clicked() {+ d.picked = if picked { None } else { Some(i) };+ d.fields = [text(row, "part_number"), text(row, "description"), text(row, "revision")];+ }+ ui.label(text(row, "part_number"));+ ui.label(text(row, "description"));+ ui.label(text(row, "revision"));+ ui.label(text(row, "count"));+ ui.label(RichText::new(text(row, "definition")).color(t.text_dim));ui.end_row();+ for c in row["children"].as_array().into_iter().flatten() {+ ui.label(RichText::new(text(c, "item")).color(t.text_dim));+ ui.label(text(c, "part_number"));+ ui.label(text(c, "description"));+ ui.label(text(c, "revision"));+ ui.label(text(c, "count"));+ ui.label(RichText::new(text(c, "definition")).color(t.text_dim));+ ui.end_row();+ }}- }+ });});- });- ui.label(RichText::new(format!("{} rows, {} placed", rows.len(), text(&bom, "total_occurrences"))).small().color(t.text_dim));- if let Some(row) = d.picked.and_then(|i| rows.get(i)) {- ui.separator();- egui::Grid::new("sc_bom_edit").num_columns(2).spacing([12.0, 6.0]).show(ui, |ui| {- for (label, field) in ["Part number", "Description", "Revision"].into_iter().zip(d.fields.iter_mut()) {- ui.label(label);- ui.allocate_ui(egui::vec2(280.0, crate::ui_kit::row_height()), |ui| {- crate::ui_kit::cell_editor(ui, ui.make_persistent_id(label), field, label, false);- });- ui.end_row();+ ui.label(RichText::new(format!("{} rows, {} placed", rows.len(), text(&bom, "total_occurrences"))).small().color(t.text_dim));+ if let Some(row) = d.picked.and_then(|i| rows.get(i)) {+ ui.separator();+ egui::Grid::new("sc_bom_edit").num_columns(2).spacing([12.0, 6.0]).show(ui, |ui| {+ for (label, field) in ["Part number", "Description", "Revision"].into_iter().zip(d.fields.iter_mut()) {+ ui.label(label);+ ui.allocate_ui(egui::vec2(280.0, crate::ui_kit::row_height()), |ui| {+ crate::ui_kit::cell_editor(ui, ui.make_persistent_id(label), field, label, false);+ });+ ui.end_row();+ }+ });+ if crate::ui_kit::button(ui, "Apply", crate::ui_kit::Button::Normal).clicked() {+ apply_row = Some(row.clone());}- });- if crate::ui_kit::button(ui, "Apply", crate::ui_kit::Button::Normal).clicked() {- apply_row = Some(row.clone());}- }- if let Some(e) = &d.error {- ui.label(RichText::new(e).color(t.error));- }- ui.separator();- ui.horizontal(|ui| {- for (label, ext) in [("Export CSV…", "csv"), ("Export JSON…", "json")] {- if crate::ui_kit::button(ui, label, crate::ui_kit::Button::Normal).clicked() {- export = Some(ext);- }+ if let Some(e) = &d.error {+ ui.label(RichText::new(e).color(t.error));}+ ui.separator();+ ui.horizontal(|ui| {+ for (label, ext) in [("Export CSV…", "csv"), ("Export JSON…", "json")] {+ if crate::ui_kit::button(ui, label, crate::ui_kit::Button::Normal).clicked() {+ export = Some(ext);+ }+ }+ });});- });if let Some(row) = apply_row {apply(app, &mut d, &row);}@@ -180,7 +180,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {params["format"] = json!(ext);app.pick_save_command(&format!("bill-of-materials.{ext}"), &[ext], "assembly.bom", params);}- if open {+ if !closed {app.bom = Some(d);}}diff --git a/crates/ui-egui/src/browser.rs b/crates/ui-egui/src/browser.rsindex a2c9791fca..1cbb00d07a 100644--- a/crates/ui-egui/src/browser.rs+++ b/crates/ui-egui/src/browser.rs@@ -6,6 +6,7 @@//! viewport, a double-click on a sketch edits it, and a right-click opens the item's menu//! ([`crate::context_menu`]).+use crate::ui_kit::{Container, Surface};#[cfg(test)]#[path = "occurrence_ui_tests.rs"]mod occurrence_ui_tests;@@ -662,10 +663,6 @@ fn lit_row((selected, hovered): (bool, bool)) -> (bool, Mark) {(selected, if selected || hovered { Mark::Here } else { Mark::None })}-pub fn browser(app: &mut SolveApp, ui: &mut egui::Ui) {- browser_panel(app, ui);-}-/// How narrow the browser sidebar may be dragged, and how wide (the viewport keeps the rest).const MIN_BROWSER_WIDTH: f32 = 170.0;const MAX_BROWSER_WIDTH: f32 = 620.0;@@ -674,24 +671,6 @@ const BROWSER_RAIL: f32 = 6.0;/// How opaque the floating browser's card is; the workspace shows through the rest.const BROWSER_FLOAT_ALPHA: f32 = 0.4;-fn browser_panel(app: &mut SolveApp, ui: &mut egui::Ui) {- let t = Tokens::get();- app.tree.order.clear();- DRAWN.with(|d| d.borrow_mut().clear());- OCCURRENCES.with(|d| d.borrow_mut().clear());- let mut acts = Actions::default();- let width = browser_width(app.preferences.browser_width);- let panel = egui::Panel::left("sc_browser")- .exact_size(width)- .resizable(false)- .frame(egui::Frame::NONE.fill(t.panel).inner_margin(egui::Margin::symmetric(t.space_6 as i8, t.space_6 as i8)))- .show(ui, |ui| {- browser_contents(app, ui, &mut acts, false);- });- resize_column(app, ui, panel.response.rect, width, "left-browser-rail");- finish_browser(app, ui, acts);-}-pub(crate) fn browser_width(remembered: f32) -> f32 {if remembered.is_finite() { remembered.clamp(MIN_BROWSER_WIDTH, MAX_BROWSER_WIDTH) } else { crate::prefs::DEFAULT_BROWSER_WIDTH }}@@ -710,20 +689,24 @@ pub(crate) fn resize_column(app: &mut SolveApp, ui: &egui::Ui, rect: Rect, widthcrate::scenario::publish_handle(handle, pos2(rect.right() - BROWSER_RAIL / 2.0, rect.center().y));}-/// One browser card for the floating shell and the docked shell's optional overlay.-/// The preference keeps its translucent overlay semantics; the floating shell always has a card.-pub fn floating(app: &mut SolveApp, ui: &mut egui::Ui, available: Rect) {+/// One content-hugging browser; the shared container supplies floating or flush compact chrome.+pub fn browser(app: &mut SolveApp, ui: &mut egui::Ui) {+ let available = ui.available_rect_before_wrap();let t = Tokens::get();app.tree.order.clear();DRAWN.with(|d| d.borrow_mut().clear());OCCURRENCES.with(|d| d.borrow_mut().clear());let mut acts = Actions::default();- let gap = crate::shell::SHELL_GAP;- let top_gap = if app.ui.layout == crate::shell::LayoutMode::Docked { gap } else { 0.0 };+ let stacked = crate::timeline_left::stacked(app);+ let container =+ Container::new(ui.ctx(), Surface::Panel).joined(crate::ui_kit::DockEdges { left: true, top: true, bottom: stacked, ..Default::default() });+ let gap = container.gap();let width = browser_width(app.preferences.browser_width);let vertical = app.ui.show_timeline && app.preferences.timeline_left;let mut available = available;- let stacked = crate::timeline_left::stacked(app);+ if !stacked {+ available.min.x += crate::agent_chat::left_inset(app, available);+ }if vertical&& !stacked&& let Some(history) = app.shell.history@@ -734,33 +717,38 @@ pub fn floating(app: &mut SolveApp, ui: &mut egui::Ui, available: Rect) {let bounds = if stacked {crate::timeline_left::stacked_rects(app, available).0} else {- floating_bounds(available, if vertical { None } else { app.shell.history }, if collapsed { t.space_24 + t.space_10 } else { width }, top_gap)+ panel_bounds(available, if vertical { None } else { app.shell.history }, if collapsed { t.space_24 + t.space_10 } else { width }, gap)};app.shell.browser = None;let min_height = HEADER_H + 2.0 * (CARD_INSET + 1.0);if bounds.is_positive() && bounds.height() >= min_height {- let fill = if app.preferences.browser_float { t.panel.gamma_multiply(BROWSER_FLOAT_ALPHA) } else { t.panel };- let frame = crate::frame::shell_card(fill).inner_margin(CARD_INSET as i8);+ let fill = if container.floating() && app.preferences.browser_float { t.panel.gamma_multiply(BROWSER_FLOAT_ALPHA) } else { t.panel };+ let frame = container.frame(ui.ctx(), fill, crate::frame::Side::Left).inner_margin(CARD_INSET as i8);let inner_width = (bounds.width() - frame.total_margin().sum().x).max(0.0);let inner_height = (bounds.height() - frame.total_margin().sum().y).max(0.0);- let card = crate::frame::area(egui::Id::new("sc_browser_card")).fixed_pos(bounds.min).order(egui::Order::Middle).show(ui.ctx(), |ui| {- let response = frame.show(ui, |ui| {- ui.set_width(inner_width);- ui.set_max_height(inner_height);- if stacked {- ui.set_min_height(inner_height);- ui.set_clip_rect(ui.clip_rect().intersect(Rect::from_min_size(ui.max_rect().min, vec2(inner_width, inner_height))));- }- if collapsed {- browser_collapsed_rail(app, ui);- } else {- browser_contents(app, ui, &mut acts, true);+ let card = Container::new(ui.ctx(), Surface::Panel)+ .area(egui::Id::new("sc_browser_card"))+ .fixed_pos(bounds.min)+ .order(egui::Order::Middle)+ .show(ui.ctx(), |ui| {+ let limits = Rect::from_min_max(available.min, pos2(available.right(), bounds.bottom()));+ let response = container.show_frame(ui, frame, limits, |ui| {+ ui.set_width(inner_width);+ ui.set_max_height(inner_height);+ if stacked {+ ui.set_min_height(inner_height);+ ui.set_clip_rect(ui.clip_rect().intersect(Rect::from_min_size(ui.max_rect().min, vec2(inner_width, inner_height))));+ }+ if collapsed {+ browser_collapsed_rail(app, ui);+ } else {+ browser_contents(app, ui, &mut acts, true);+ }+ });+ if !collapsed {+ resize_column(app, ui, response.response.rect, width, "left-browser-rail");}});- if !collapsed {- resize_column(app, ui, response.response.rect, width, "left-browser-rail");- }- });let rect = card.response.rect;app.shell.browser = Some(rect);crate::scenario::publish_rect("browser:card", rect);@@ -799,9 +787,8 @@ fn browser_collapsed_rail(app: &mut SolveApp, ui: &mut egui::Ui) {);}-pub(crate) fn floating_bounds(available: Rect, history: Option<Rect>, width: f32, top_gap: f32) -> Rect {- let gap = crate::shell::SHELL_GAP;- let min = available.min + vec2(gap, top_gap);+pub(crate) fn panel_bounds(available: Rect, history: Option<Rect>, width: f32, gap: f32) -> Rect {+ let min = available.min + vec2(gap, 0.0);let right = (available.right() - gap).max(min.x);let bottom = history.map_or(available.bottom() - gap, |r| r.top() - gap).max(min.y);Rect::from_min_max(min, pos2((min.x + width).min(right), bottom))diff --git a/crates/ui-egui/src/browser_card_tests.rs b/crates/ui-egui/src/browser_card_tests.rsindex 263a40b023..7a208131fc 100644--- a/crates/ui-egui/src/browser_card_tests.rs+++ b/crates/ui-egui/src/browser_card_tests.rs@@ -34,8 +34,8 @@ fn browser_card_shrinks_and_scrolls_without_covering_history() {h.call("ui.set", json!({"layout":"docked"}));h.settle();- assert!(rect_of("browser:card").is_none());- assert_eq!(h.app.viewport.rect.unwrap().left(), 250.0);+ assert_eq!(rect_of("browser:card").unwrap().left(), 0.0);+ assert_eq!(h.app.viewport.rect.unwrap().left(), 0.0);assert!(drawn_rows().iter().all(|(_, rect, _, _)| rect.height() == 26.0));h.call("ui.set", json!({"layout":"floating"}));h.app.tree.collapsed.insert("c0".into());@@ -138,8 +138,8 @@ fn tiny_floating_windows_never_panic() {}}-/// Both shell layouts share one tree and one saved width. Docked can switch its card-/// back into a column; Floating keeps its card when the overlay preference is cleared.+/// Both shell layouts share one content-hugging tree and one saved width.+/// The translucency preference never creates a second browser renderer.#[test]fn one_browser_keeps_its_resized_width_across_layouts_and_overlay_preferences() {let mut h = Harness::new();@@ -150,15 +150,11 @@ fn one_browser_keeps_its_resized_width_across_layouts_and_overlay_preferences()h.app.preferences.browser_float = overlay;h.app.preferences.browser_width = 310.0;h.settle();- let card = mode == LayoutMode::Floating || overlay;- assert_eq!(rect_of("browser:card").is_some(), card);+ assert!(rect_of("browser:card").is_some());assert_eq!(crate::scenario::handles("browser:header").len(), 1, "only one browser header");assert_eq!(drawn_rows().iter().filter(|(name, ..)| name == "Untitled").count(), 1, "only one tree");- if card {- assert!((rect_of("browser:card").unwrap().width() - 310.0).abs() < 1.0);- } else {- assert_eq!(h.app.viewport.rect.unwrap().left(), 310.0);- }+ assert!((rect_of("browser:card").unwrap().width() - 310.0).abs() < 1.0);+ assert_eq!(h.app.viewport.rect.unwrap().left(), 0.0);let rail = handle_at("left-browser-rail").unwrap();h.call("ui.drag", json!({"x0":rail.x,"y0":rail.y,"x1":rail.x+60.0,"y1":rail.y,"steps":6}));h.settle();@@ -167,7 +163,7 @@ fn one_browser_keeps_its_resized_width_across_layouts_and_overlay_preferences()h.app.ui.layout = LayoutMode::Docked;h.app.preferences.browser_float = false;h.settle();- assert!((h.app.viewport.rect.unwrap().left() - width).abs() < 1.0, "the column uses the card's saved width");+ assert!((rect_of("browser:card").unwrap().width() - width).abs() < 1.0, "compact keeps the saved width");}}}@@ -213,12 +209,8 @@ fn resizing_browser_card_and_column_persists_width_including_floating_preferenceh.settle();let width = h.app.preferences.browser_width;assert!(width > crate::prefs::DEFAULT_BROWSER_WIDTH + 40.0, "{mode:?}, float={float}, width={width}");- if mode == LayoutMode::Floating || float {- assert!((rect_of("browser:card").unwrap().width() - width).abs() < 1.0);- assert_eq!(h.app.viewport.rect.unwrap(), before, "the card leaves the projection intact");- } else {- assert!((h.app.viewport.rect.unwrap().left() - width).abs() < 1.0);- }+ assert!((rect_of("browser:card").unwrap().width() - width).abs() < 1.0);+ assert_eq!(h.app.viewport.rect.unwrap(), before, "browser resizing leaves the projection intact");let mut restored = SolveApp::new(Default::default(), Default::default());restored.load_prefs(&h.app.prefs());assert_eq!(restored.preferences.browser_width, width);@@ -235,7 +227,7 @@ fn browser_width_rejects_hostile_preferences_and_tiny_windows_still_fit() {assert_eq!(browser_width(f32::MAX), MAX_BROWSER_WIDTH);let available = Rect::from_min_size(Pos2::ZERO, vec2(100.0, 300.0));for top_gap in [0.0, crate::shell::SHELL_GAP] {- let bounds = floating_bounds(available, None, MAX_BROWSER_WIDTH, top_gap);+ let bounds = panel_bounds(available, None, MAX_BROWSER_WIDTH, top_gap);assert!(available.contains_rect(bounds));}}@@ -269,7 +261,7 @@ fn collapsed_rail_shares_header_hover_inset_and_expands_from_its_whole_card() {let bounds = Rect::from_min_size(Pos2::ZERO, vec2(600.0, 700.0));let draw = |app: &mut SolveApp, events| {crate::test_support::frame(&ctx, egui::RawInput { screen_rect: Some(bounds), events, ..Default::default() }, |ui| {- floating(app, ui, bounds);+ browser(app, ui);})};for _ in 0..3 {diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rsindex 2203d74b48..e338c85417 100644--- a/crates/ui-egui/src/canvas.rs+++ b/crates/ui-egui/src/canvas.rs@@ -5,6 +5,7 @@//! command has its geometry, so typing a number sets the value at once; Enter applies, Tab//! moves on, Esc cancels.+use crate::ui_kit::{Container, Surface};use egui::{Color32, Pos2, Stroke, vec2};use solidcraft_engine::Sel;use solidcraft_engine::doc::expr::Kind as ValueKind;@@ -568,22 +569,26 @@ fn draw(app: &SolveApp, ui: &mut egui::Ui, painter: &egui::Painter, proj: &Proj,fn value_box(ui: &mut egui::Ui, label: &str, value: &mut String, at: Pos2, select_all: bool) {let t = Tokens::get();let id = egui::Id::new("sc_canvas_value");- crate::frame::area(egui::Id::new("sc_canvas_area")).fixed_pos(at).order(egui::Order::Foreground).show(ui.ctx(), |ui| {- egui::Frame::popup(ui.style()).inner_margin(egui::Margin::symmetric(6, 3)).show(ui, |ui| {- ui.horizontal(|ui| {- ui.label(egui::RichText::new(crate::i18n::tr_label(label)).color(t.text_dim).size(crate::theme::Tokens::get().font_caption));- let r = ui.add(egui::TextEdit::singleline(value).id(id).desired_width(72.0));- crate::params_dialog::complete(ui, &r, value);- if select_all {- r.request_focus();- let n = value.chars().count();- let mut st = egui::text_edit::TextEditState::load(ui.ctx(), id).unwrap_or_default();- st.cursor.set_char_range(Some(egui::text_selection::CCursorRange::two(egui::text::CCursor::new(0), egui::text::CCursor::new(n))));- st.store(ui.ctx(), id);- }+ Container::new(ui.ctx(), Surface::Canvas).area(egui::Id::new("sc_canvas_area")).fixed_pos(at).order(egui::Order::Foreground).show(+ ui.ctx(),+ |ui| {+ Container::popup_frame(ui.style()).inner_margin(egui::Margin::symmetric(6, 3)).show(ui, |ui| {+ ui.horizontal(|ui| {+ ui.label(egui::RichText::new(crate::i18n::tr_label(label)).color(t.text_dim).size(crate::theme::Tokens::get().font_caption));+ let r = crate::ui_kit::canvas_value_field(ui, id, value);+ crate::params_dialog::complete(ui, &r, value);+ if select_all {+ r.request_focus();+ let n = value.chars().count();+ let mut st = egui::text_edit::TextEditState::load(ui.ctx(), id).unwrap_or_default();+ st.cursor+ .set_char_range(Some(egui::text_selection::CCursorRange::two(egui::text::CCursor::new(0), egui::text::CCursor::new(n))));+ st.store(ui.ctx(), id);+ }+ });});- });- });+ },+ );}/// How far (logical points) from an arrow's stem a press still takes the arrow.@@ -1178,9 +1183,13 @@ fn draw_revolve(if to_mode {// This badge is read-only. Its placement follows the model and can overlap the// command dialog, whose buttons must keep receiving clicks.- let area = crate::frame::area(egui::Id::new("sc_canvas_area")).fixed_pos(box_at).order(egui::Order::Foreground).interactable(false);+ let area = Container::new(ui.ctx(), Surface::Canvas)+ .area(egui::Id::new("sc_canvas_area"))+ .fixed_pos(box_at)+ .order(egui::Order::Foreground)+ .interactable(false);area.show(ui.ctx(), |ui| {- egui::Frame::popup(ui.style()).inner_margin(egui::Margin::symmetric(6, 3)).show(ui, |ui| {+ Container::popup_frame(ui.style()).inner_margin(egui::Margin::symmetric(6, 3)).show(ui, |ui| {let text = if extent.curved_to {"To surface".into()} else if extent.sweep.is_finite() {diff --git a/crates/ui-egui/src/colour_tokens_tests.rs b/crates/ui-egui/src/colour_tokens_tests.rsindex 8239e23308..700cd73715 100644--- a/crates/ui-egui/src/colour_tokens_tests.rs+++ b/crates/ui-egui/src/colour_tokens_tests.rs@@ -29,9 +29,7 @@ fn moved_colours_keep_the_values_they_were_drawn_with() {assert_eq!(t.analysis.access, [[0.20, 0.75, 0.30], [0.85, 0.22, 0.20]]);assert_eq!(t.analysis.curvature, [[0.15, 0.35, 0.95], [0.10, 0.80, 0.25], [0.90, 0.15, 0.10]]);assert!(!t.analysis.hatch);- assert_eq!(t.app_bar_icon, [Color32::from_rgb(225, 230, 238), Color32::from_rgb(120, 140, 170), Color32::from_rgb(120, 190, 255)]);assert_eq!(t.logo, [Color32::from_rgb(96, 158, 236), Color32::from_rgb(58, 136, 238), Color32::from_rgb(55, 108, 197), Color32::WHITE]);- assert_eq!(t.icons.glint, Color32::from_white_alpha(160));assert_eq!(t.icons.marker_halo, Color32::from_black_alpha(150));assert_eq!(t.icons.agent, Color32::from_rgb(168, 85, 247));}@@ -59,7 +57,7 @@ fn analysis_colours_reach_the_shader_in_its_order() {// Icons no longer take their colours from the caller or from `IconColors`: the SVG masters name// palette roles (`assets/icons/ui/design/palette.toml`, light and dark, plus accents) that// `icon_svg` resolves. `icon_svg`'s own tests hold that every master parses and that only the-// palette's colours exist; the colour vision modes do not reach them yet.+// palette's colours exist, including its colour-vision variants./// The most colour literals each UI file may hold, and why. None of them carries a meaning that a/// colour vision mode must change. A file with more fails here: make the new colour a token in@@ -75,7 +73,6 @@ const ALLOWED_LITERALS: &[(&str, usize, &str)] = &[("dialogs_library.rs", 1, "a library appearance's swatch: the colour is the fact"),("dialogs_assembly.rs", 1, "the interference fill, shaded from its token"),("dialogs_motion.rs", 1, "a white outline"),- ("frame.rs", 1, "the window shadow"),("gizmo.rs", 2, "the gizmo's neutral grey ball"),("icons.rs", 1, "the white tint that carries an icon image's opacity"),("home.rs", 2, "thumbnail tints"),diff --git a/crates/ui-egui/src/colour_vision_tests.rs b/crates/ui-egui/src/colour_vision_tests.rsindex dc63b066cf..e2b1e3b9a3 100644--- a/crates/ui-egui/src/colour_vision_tests.rs+++ b/crates/ui-egui/src/colour_vision_tests.rs@@ -251,7 +251,6 @@ fn groups(t: &Tokens) -> Vec<Group> {let lift = |c: Color32| {Color32::from_rgb(c.r().saturating_add(t.hover_face_lift), c.g().saturating_add(t.hover_face_lift), c.b().saturating_add(t.hover_face_lift))};- let ic = &t.icons;let a = &t.analysis;let mut out = vec![group(@@ -337,37 +336,6 @@ fn groups(t: &Tokens) -> Vec<Group> {&[("glyph_text", t.glyph_text), ("sketch_accent", t.sketch_accent), ("construction_geom", t.construction_geom)],&[("toolbar", t.toolbar)],),- group(- "origin icon",- &[("icons.axes[0]", ic.axes[0]), ("icons.axes[1]", ic.axes[1]), ("icons.axes[2]", ic.axes[2])],- &[("toolbar", t.toolbar)],- ),- group(- "accessibility icon",- &[("icons.access[0]", ic.access[0]), ("icons.access[1]", ic.access[1]), ("icon_fill", t.icon_fill), ("icon", t.icon)],- &[],- ),- group("draft icon", &[("icons.draft[0]", ic.draft[0]), ("icons.draft[1]", ic.draft[1]), ("icon", t.icon)], &[]),- group(- "curvature icon",- &[("icons.curvature[0]", ic.curvature[0]), ("icons.curvature[1]", ic.curvature[1]), ("icons.curvature[2]", ic.curvature[2])],- &[],- ),- group(- "appearance icon",- &[("icons.paint[0]", ic.paint[0]), ("icons.paint[1]", ic.paint[1]), ("icons.paint[2]", ic.paint[2]), ("icon_fill", t.icon_fill)],- &[],- ),- group("environment icon", &[("icons.sky", ic.sky), ("icons.floor", ic.floor), ("icons.highlight", ic.highlight)], &[]),- group("warning icon", &[("icons.warning", ic.warning), ("icon", t.icon)], &[("toolbar", t.toolbar)]),- group("interference icon", &[("icons.interference", ic.interference), ("icon", t.icon)], &[("toolbar", t.toolbar)]),- group("folder icons", &[("icons.folder", ic.folder), ("icons.plane", ic.plane), ("icons.fold", ic.fold), ("icon", t.icon)], &[]),- group("sheet icons", &[("icons.sheet", ic.sheet), ("icons.sheet_2", ic.sheet_2), ("icon", t.icon)], &[]),- group(- "app bar buttons",- &[("app_bar_icon[0]", t.app_bar_icon[0]), ("app_bar_icon[1]", t.app_bar_icon[1]), ("app_bar_icon[2]", t.app_bar_icon[2])],- &[("app_bar", t.app_bar)],- ),// Tab names and icons identify the tabs; each accent must read against the toolbar.group("surface tab", &[("surface_accent", t.surface_accent)], &[("toolbar", t.toolbar)]),group("mesh tab", &[("mesh_accent", t.mesh_accent)], &[("toolbar", t.toolbar)]),@@ -478,6 +446,7 @@ const NO_MEANING: &[(&str, &str)] = &[("render_accent", "the Render workspace's identity colour"),// The window's chrome: grounds, text and borders (measured as grounds where meaning sits on them).("panel_header", "chrome"),+ ("icon", "neutral control ink; command artwork uses the SVG palette"),("border", "chrome"),("text_dim", "secondary text"),("accent", "the one interface accent"),@@ -485,8 +454,6 @@ const NO_MEANING: &[(&str, &str)] = &[("dialog_bg", "chrome"),("dialog_border", "chrome"),("chip", "a label's ground"),- ("heading_bg", "chrome"),- ("subheading_bg", "chrome"),("overlay", "a chip's ground over the view"),("app_bar_text", "text"),("app_bar_separator", "neutral chrome divider"),@@ -528,10 +495,7 @@ const NO_MEANING: &[(&str, &str)] = &[("analysis.hatch", "a flag: stripes on the failing faces"),("logo[3]", "the mark's white edge"),// Icon colours that are a shade of a measured one, or one mark alone.- ("icons.sheet_light", "a lighter shade of a sheet"),- ("icons.sheet_line", "lines on a sheet"),- ("icons.glint", "a highlight"),- ("icons.stripe", "zebra stripes, grey"),+ ("icons.highlight", "white ink on viewport markers and the agent pointer"),("icons.agent", "the agent's pointer, alone"),("icons.marker_halo", "a dark halo under a marker"),];@@ -736,9 +700,6 @@ fn each_mode_changes_only_its_table() {"analysis.draft","analysis.access","analysis.hatch",- "icons.axes",- "icons.access",- "icons.draft","bend_up","bend_down","surface_accent",diff --git a/crates/ui-egui/src/context_menu.rs b/crates/ui-egui/src/context_menu.rsindex 03fc3390f3..1987e2b9c3 100644--- a/crates/ui-egui/src/context_menu.rs+++ b/crates/ui-egui/src/context_menu.rs@@ -11,6 +11,7 @@//! state; [`items`] lists them and [`run_item`] runs one, so the control channel (`ui.menu`,//! `ui.menuPick`) and tests reach everything a click does.+use crate::ui_kit::{Container, Surface};use egui::{Color32, Pos2, Rect, Sense, Vec2, pos2, vec2};use serde::Serialize;use serde_json::{Value, json};@@ -1719,10 +1720,14 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {let area = Rect::from_center_size(c, vec2(2.0 * (RX + 4.0), 2.0 * (RY + 4.0)));inside |= pointer.is_some_and(|p| area.contains(p));let hot = pointer.and_then(|p| sector(p - c));- let resp = crate::frame::area(egui::Id::new("sc_marking_menu")).fixed_pos(area.min).order(egui::Order::Foreground).show(ctx, |ui| {- let _ = ui.allocate_exact_size(area.size(), Sense::hover());- picked = crate::ui_kit::radial_menu(ui, c, &radial, hot).or(picked.take());- });+ let resp = Container::new(ctx, Surface::Popup)+ .area(egui::Id::new("sc_marking_menu"))+ .fixed_pos(area.min)+ .order(egui::Order::Foreground)+ .show(ctx, |ui| {+ let _ = ui.allocate_exact_size(area.size(), Sense::hover());+ picked = crate::ui_kit::radial_menu(ui, c, &radial, hot).or(picked.take());+ });inside |= resp.response.contains_pointer();list_place(c, list_height(&list), screen)} else {@@ -1750,8 +1755,12 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {}let mut submenu_row = None;let key_row = app.menu.key_row;- let resp =- crate::frame::area(egui::Id::new("sc_context_menu")).fixed_pos(list_at).constrain(true).order(egui::Order::Foreground).show(ctx, |ui| {+ let resp = Container::new(ctx, Surface::Popup)+ .area(egui::Id::new("sc_context_menu"))+ .fixed_pos(list_at)+ .constrain(true)+ .order(egui::Order::Foreground)+ .show(ctx, |ui| {if target == Target::Workspace {picked = crate::ui_kit::workspace_menu(ui, &list, key_row, (screen.bottom() - list_at.y).max(160.0)).or(picked.take());} else {@@ -1888,9 +1897,13 @@ fn show_rename(app: &mut SolveApp, ctx: &egui::Context) {}let Some(mut r) = app.menu.rename.take() else { return };let mut done: Option<bool> = None;- let resp = crate::frame::area(egui::Id::new("sc_rename")).fixed_pos(r.at).constrain(true).order(egui::Order::Foreground).show(ctx, |ui| {- done = crate::ui_kit::rename_menu(ui, &mut r.text, &mut r.focused);- });+ let resp =+ Container::new(ctx, Surface::Popup).area(egui::Id::new("sc_rename")).fixed_pos(r.at).constrain(true).order(egui::Order::Foreground).show(+ ctx,+ |ui| {+ done = crate::ui_kit::rename_menu(ui, &mut r.text, &mut r.focused);+ },+ );if ctx.input(|i| i.pointer.any_pressed()) && !resp.response.contains_pointer() && r.focused {done = Some(true);}diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rsindex 3826e94845..058815d7fa 100644--- a/crates/ui-egui/src/control.rs+++ b/crates/ui-egui/src/control.rs@@ -101,7 +101,7 @@ fn key_from(name: &str) -> Option<egui::Key> {fn execute(app: &mut SolveApp, id: &str, params: Value) -> Result<Value, String> {let r = app.run(id, params);if r.is_ok()- && !matches!(id, "view.navigate" | "view.ambient_occlusion" | "view.graphics_preset" | "view.history_layout")+ && !matches!(id, "view.layout" | "view.navigate" | "view.ambient_occlusion" | "view.graphics_preset" | "view.history_layout")&& app.session.active_sketch.is_none()&& app.session.world_state().bodies.len() == 1&& app.session.undo.len() <= 2diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rsindex db7bbbc288..b35585a01d 100644--- a/crates/ui-egui/src/dialogs.rs+++ b/crates/ui-egui/src/dialogs.rs@@ -987,12 +987,6 @@ impl Dialog {})}- /// Dialogs holding a table get the wide limit.- pub fn is_wide(&self) -> bool {- (matches!(self.kind, Kind::PatternRect { .. }) && self.inputs.first().is_some_and(|i| i.accept == selection::FEATURES))- || matches!(&self.kind, Kind::Motion(k) if k.wide())- }-pub fn wants_picks(&self) -> bool {!self.inputs.is_empty()}@@ -2260,7 +2254,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {}// Physical materials: the library's, then the design's own (material.create).let t = Tokens::get();- let vp = crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect()));+ let vp = crate::agent_chat::tool_space(app, crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect())));// The Sketch Palette owns the right edge for as long as a sketch is being edited. A dialog// started there docks at the left instead, so neither panel hides the other.let side = if crate::sketch_palette::editing(app) && crate::sketch_palette::fits_beside_a_dialog(app, ctx) {@@ -2278,7 +2272,8 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {// is open (#1335), kept inside the viewport.let moved = crate::frame::dock_offset(ctx, title(&d.kind));let docked = egui::pos2(side.anchor_x(vp), top);- let anchor = crate::frame::offset_anchor(docked, moved, vp, side);+ let drag_bounds = crate::shell::tool_drag_rect(app, vp);+ let anchor = crate::frame::offset_anchor(docked, moved, drag_bounds, side);let mut keep = true;let mut ok = false;let mut applied = false;@@ -2310,8 +2305,8 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {Kind::ViewDxf { .. } => ("Export DXF…", "Cancel"),_ => ("OK", "Cancel"),};- let panel =- crate::ui_kit::Panel::new(&heading, egui::Id::new(("sc_dialog", title(&d.kind))), anchor, vp, side, frame).actions(ok_label, close_label);+ let panel = crate::ui_kit::Panel::new(&heading, egui::Id::new(("sc_dialog", title(&d.kind))), anchor, drag_bounds, side, frame)+ .actions(ok_label, close_label);let panel = if matches!(d.kind, Kind::Appearance(_)) {panel.width(t.form_card_width + t.form_label_width + t.space_6)} else if wide {@@ -2328,7 +2323,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {let reset_scroll = d.reset_scroll;let panel =panel.reset_scroll(reset_scroll && matches!(d.kind, Kind::Appearance(_) | Kind::Motion(crate::dialogs_motion::Mo::Configurations { .. })));- let window = panel.window();+ let window = panel.window(ctx);let repeatable =matches!(&d.kind, Kind::SketchModify(k) if crate::sketch_modify_ui::repeatable(k)) && d.editing.is_none() && !d.extra.contains_key("pattern");if let Kind::ConfirmDelete { with, fail, .. } = &d.kind {@@ -2349,7 +2344,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {cancel = closed || action == crate::ui_kit::Action::Cancel;app.viewport.dialog_rect = crate::scenario::rect_of("dialog:window");} else {- let response = window.frame(frame).open(&mut keep).show(ctx, |ui| {+ let response = window.open(&mut keep).show(ctx, |ui| {let spec = dense::command(&d.kind).and_then(solidcraft_engine::find_command);let icon = spec.as_ref().map_or("", |s| s.icon);let label = spec.as_ref().map_or(heading.as_str(), |s| tr(s.label));diff --git a/crates/ui-egui/src/dialogs_assembly.rs b/crates/ui-egui/src/dialogs_assembly.rsindex 73780d802b..350bae0918 100644--- a/crates/ui-egui/src/dialogs_assembly.rs+++ b/crates/ui-egui/src/dialogs_assembly.rs@@ -1225,7 +1225,7 @@ pub fn timeline_joints(app: &mut SolveApp, ui: &mut egui::Ui, p: &egui::Painter,t.timeline_item};p.rect(br, 3.0, bg, Stroke::new(1.0, t.border), egui::StrokeKind::Inside);- crate::icons::paint(p, br.shrink(4.0), "joint", if suppressed { t.border } else { t.icon }, t.icon_fill, t.accent);+ crate::icons::paint_icon(p, br.shrink(4.0), "joint", f32::from((if suppressed { t.border } else { t.icon }).a()) / 255.0);if suppressed {p.line_segment([br.left_bottom() + vec2(4.0, -4.0), br.right_top() + vec2(-4.0, 4.0)], Stroke::new(1.5, t.text_dim));}@@ -1238,7 +1238,7 @@ pub fn timeline_joints(app: &mut SolveApp, ui: &mut egui::Ui, p: &egui::Painter,if resp.secondary_clicked() && !app.tree.picked_joints.contains(&id) {pick_joint(app, id, false);}- resp.context_menu(|ui| joint_menu(app, ui, (id, kind, suppressed), &mut open, &mut run));+ crate::ui_kit::Menu::context(&resp, |ui| joint_menu(app, ui, (id, kind, suppressed), &mut open, &mut run));x += 32.0;}if let Some((c, prm)) = run {@@ -1276,7 +1276,7 @@ pub fn timeline_joints_vertical(app: &mut SolveApp, ui: &mut egui::Ui) {ui.painter().rect_filled(rect, 3.0, t.hover);}let icon = egui::Rect::from_min_size(egui::pos2(rect.left() + 4.0, rect.top() + 4.0), vec2(22.0, 22.0));- crate::icons::paint(ui.painter(), icon, "joint", if suppressed { t.border } else { t.icon }, t.icon_fill, t.accent);+ crate::icons::paint_icon(ui.painter(), icon, "joint", f32::from((if suppressed { t.border } else { t.icon }).a()) / 255.0);if suppressed {ui.painter().line_segment([icon.left_bottom(), icon.right_top()], Stroke::new(1.5, t.text_dim));}@@ -1296,7 +1296,7 @@ pub fn timeline_joints_vertical(app: &mut SolveApp, ui: &mut egui::Ui) {if response.secondary_clicked() && !app.tree.picked_joints.contains(&id) {pick_joint(app, id, false);}- response.context_menu(|ui| joint_menu(app, ui, (id, kind, suppressed), &mut open, &mut run));+ crate::ui_kit::Menu::context(&response, |ui| joint_menu(app, ui, (id, kind, suppressed), &mut open, &mut run));}if let Some((command, params)) = run {if command == "selection.delete" {diff --git a/crates/ui-egui/src/dialogs_sheet_tests.rs b/crates/ui-egui/src/dialogs_sheet_tests.rsindex 20811737a4..2f6bdd8982 100644--- a/crates/ui-egui/src/dialogs_sheet_tests.rs+++ b/crates/ui-egui/src/dialogs_sheet_tests.rs@@ -206,7 +206,7 @@ fn flat_pattern_islands_fit_before_the_actual_command_panel() {ctx.run_ui(egui::RawInput { screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(1400.0, 900.0))), ..Default::default() }, |ui| {crate::ui_kit::Panel::new("FLAT PATTERN", id, pos2(1400.0, 294.0), viewport, crate::frame::Side::Right, egui::Frame::NONE).width(360.0)- .window()+ .window(&ctx).show(ui.ctx(), |ui| {ui.label("Flat size: 50 × 10 × 2.5 mm");});diff --git a/crates/ui-egui/src/dim_view.rs b/crates/ui-egui/src/dim_view.rsindex e0af566cc5..7b4dd61b5c 100644--- a/crates/ui-egui/src/dim_view.rs+++ b/crates/ui-egui/src/dim_view.rs@@ -9,6 +9,7 @@//! Everything acts through commands: `sketch.dimension_text`, `sketch.delete`,//! `parameters.change`.+use crate::ui_kit::{Container, Surface};use std::cell::RefCell;use std::sync::Arc;@@ -720,8 +721,8 @@ fn edit_box(app: &mut SolveApp, ctx: &egui::Context) {anchor.x = anchor.x.clamp(rect.left(), (rect.right() - popup_width - 6.0).max(rect.left()));anchor.y = anchor.y.clamp(rect.top(), (rect.bottom() - 80.0).max(rect.top()));}- crate::frame::area(egui::Id::new("sc_dim_edit_area")).fixed_pos(anchor).order(egui::Order::Foreground).show(ctx, |ui| {- egui::Frame::popup(ui.style()).fill(Tokens::get().dialog_body).inner_margin(Tokens::get().space_4).show(ui, |ui| {+ Container::new(ctx, Surface::Canvas).area(egui::Id::new("sc_dim_edit_area")).fixed_pos(anchor).order(egui::Order::Foreground).show(ctx, |ui| {+ Container::popup_frame(ui.style()).fill(Tokens::get().dialog_body).inner_margin(Tokens::get().space_4).show(ui, |ui| {crate::ui_kit::scope(ui, |ui| {ui.set_max_width(popup_width);crate::ui_kit::text(ui, &crate::i18n::format("dialog.dimension_name", &[("name", &e.param)]), crate::ui_kit::Text::Inline)diff --git a/crates/ui-egui/src/documents.rs b/crates/ui-egui/src/documents.rsindex 06f1ca2991..31b0049421 100644--- a/crates/ui-egui/src/documents.rs+++ b/crates/ui-egui/src/documents.rs@@ -4,6 +4,7 @@//! Closing a design with unsaved changes asks first, and so does quitting: one "save changes?"//! per design with unsaved changes ([`request_quit`]).+use crate::ui_kit::{Container, Surface};use egui::{FontId, Rect, Sense, pos2, vec2};use serde_json::{Value, json};use solidcraft_engine::Session;@@ -529,8 +530,11 @@ pub fn tabs(app: &mut SolveApp, ui: &mut egui::Ui, r: Rect, x0: f32, x1: f32) {ui.ctx().data_mut(|d| d.insert_temp(id, !d.get_temp::<bool>(id).unwrap_or(false)));}if ui.ctx().data(|d| d.get_temp::<bool>(id).unwrap_or(false)) {- let resp =- crate::frame::area(id.with("area")).fixed_pos(pos2(mr.left(), r.bottom())).order(egui::Order::Foreground).show(ui.ctx(), |ui| {+ let resp = Container::new(ui.ctx(), Surface::Popup)+ .area(id.with("area"))+ .fixed_pos(pos2(mr.left(), r.bottom()))+ .order(egui::Order::Foreground)+ .show(ui.ctx(), |ui| {crate::context_menu::menu_frame(ui, |ui| {for (i, (name, dirty)) in info.iter().enumerate() {let label = format!("{name}{}", if *dirty { " •" } else { "" });@@ -551,23 +555,24 @@ pub fn tabs(app: &mut SolveApp, ui: &mut egui::Ui, r: Rect, x0: f32, x1: f32) {let mut many: Option<Vec<usize>> = None;if let Some((i, at)) = menu.filter(|(i, _)| *i < n) {let items = [("ui.closeTab", "Close"), ("ui.closeOtherTabs", "Close Other Tabs"), ("ui.closeAllTabs", "Close All Tabs")];- let resp = crate::frame::area(menu_id.with("area")).fixed_pos(at).order(egui::Order::Foreground).show(ui.ctx(), |ui| {- crate::context_menu::menu_frame(ui, |ui| {- let mut chosen = None;- for (id, label) in items {- let mut item = crate::context_menu::Item::action(id, label, "");- item.enabled = id != "ui.closeOtherTabs" || n > 1;- let top = ui.cursor().top();- let row = crate::context_menu::list_row(ui, &item);- let rect = Rect::from_min_max(pos2(ui.min_rect().left(), top), pos2(ui.min_rect().right(), ui.cursor().top()));- crate::scenario::publish_handle(&format!("tab_menu:{id}"), rect.center());- if row.is_some() {- chosen = Some(id);+ let resp =+ Container::new(ui.ctx(), Surface::Popup).area(menu_id.with("area")).fixed_pos(at).order(egui::Order::Foreground).show(ui.ctx(), |ui| {+ crate::context_menu::menu_frame(ui, |ui| {+ let mut chosen = None;+ for (id, label) in items {+ let mut item = crate::context_menu::Item::action(id, label, "");+ item.enabled = id != "ui.closeOtherTabs" || n > 1;+ let top = ui.cursor().top();+ let row = crate::context_menu::list_row(ui, &item);+ let rect = Rect::from_min_max(pos2(ui.min_rect().left(), top), pos2(ui.min_rect().right(), ui.cursor().top()));+ crate::scenario::publish_handle(&format!("tab_menu:{id}"), rect.center());+ if row.is_some() {+ chosen = Some(id);+ }}- }- chosen- })- });+ chosen+ })+ });match resp.inner {Some("ui.closeTab") => shut = Some(i),Some("ui.closeOtherTabs") => many = Some((0..n).filter(|k| *k != i).collect()),diff --git a/crates/ui-egui/src/edit_clipboard.rs b/crates/ui-egui/src/edit_clipboard.rsindex d5a41a8206..17d422a004 100644--- a/crates/ui-egui/src/edit_clipboard.rs+++ b/crates/ui-egui/src/edit_clipboard.rs@@ -40,15 +40,6 @@ fn sketch_selection(app: &SolveApp) -> Vec<String> {.collect()}-/// Is there something Copy would copy?-pub fn can_copy(app: &SolveApp) -> bool {- if app.session.active_sketch.is_some() {- !sketch_selection(app).is_empty()- } else {- app.tree.picked_components == [0] || !crate::timeline::selected_feature_ids(app).is_empty()- }-}-/// Is there something Paste would paste here?pub fn can_paste(app: &SolveApp) -> bool {if app.session.active_sketch.is_some() {diff --git a/crates/ui-egui/src/edit_clipboard_tests.rs b/crates/ui-egui/src/edit_clipboard_tests.rsindex a12d571a7f..3fccda2247 100644--- a/crates/ui-egui/src/edit_clipboard_tests.rs+++ b/crates/ui-egui/src/edit_clipboard_tests.rs@@ -187,7 +187,6 @@ fn contribution_saved_part(file: &ContributionPart) -> crate::SolveApp {fn contribution_linked_design_clipboard_crosses_tabs_reuses_links_and_undoes_once() {let file = ContributionPart::new();let mut app = contribution_saved_part(&file);- assert!(super::can_copy(&app));assert!(super::copy(&mut app));crate::documents::open_tab(&mut app, solidcraft_engine::Session::default()).unwrap();assert!(super::can_paste(&app));diff --git a/crates/ui-egui/src/file_load.rs b/crates/ui-egui/src/file_load.rsindex a987ffef29..6b20a1c3ff 100644--- a/crates/ui-egui/src/file_load.rs+++ b/crates/ui-egui/src/file_load.rs@@ -7,6 +7,7 @@//! control-channel commands that change the design are held until the file is in. A control//! (MCP) `doc.open` or import is answered when its file finishes loading.+use crate::ui_kit::{Container, Surface};use std::collections::VecDeque;use std::sync::{Arc,@@ -906,7 +907,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {// Above the dialogs over the design; menus, tooltips and the resize edges stay above it.ctx.move_to_top(egui::LayerId::new(egui::Order::Middle, id));ctx.move_to_top(egui::LayerId::new(egui::Order::Middle, card_id));- egui::Area::new(id).order(egui::Order::Middle).fixed_pos(cover.min).interactable(true).show(ctx, |ui| {+ Container::new(ctx, Surface::InputShield).area(id).order(egui::Order::Middle).fixed_pos(cover.min).interactable(true).show(ctx, |ui| {ui.set_min_size(cover.size());ui.interact(cover, egui::Id::new("file_loading_block"), egui::Sense::click_and_drag());ui.painter().rect_filled(cover, 0.0, egui::Color32::from_black_alpha(70));diff --git a/crates/ui-egui/src/fonts.rs b/crates/ui-egui/src/fonts.rsindex afc032bd48..ddb733095f 100644--- a/crates/ui-egui/src/fonts.rs+++ b/crates/ui-egui/src/fonts.rs@@ -236,12 +236,6 @@ fn promote_font_to_front(fonts: &mut FontDefinitions, name: &str) {}}-/// Install font bytes as fallback for every interface family, retaining its bundled weights.-/// Returns true if the font was parsed and installed successfully.-pub fn install_cjk_font(ctx: &egui::Context, bytes: Vec<u8>) -> bool {- install_cjk_font_for(ctx, bytes, "ja")-}-/// Install the downloaded font with the CJK UI's shared mixed-script baseline.pub fn install_cjk_font_for(ctx: &egui::Context, bytes: Vec<u8>, language: &str) -> bool {let fonts = ctx.data(|d| d.get_temp::<FontDefinitions>(installed_fonts_id())).unwrap_or_else(base_font_definitions);@@ -1009,9 +1003,10 @@ mod tests {let chosen = solidcraft_engine::sketch::DEFAULT_FONT_FAMILY;install(&ctx, web_font_definitions(chosen, None));// Both installations happen before the first frame, like a fast cached web fetch.- assert!(install_cjk_font(+ assert!(install_cjk_font_for(&ctx,- include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/fonts/biz-udp-gothic/BIZUDPGothic-Regular.ttf")).to_vec()+ include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/fonts/biz-udp-gothic/BIZUDPGothic-Regular.ttf")).to_vec(),+ "ja",));let installed = ctx.data(|d| d.get_temp::<FontDefinitions>(installed_fonts_id())).unwrap();for family in sans_families() {diff --git a/crates/ui-egui/src/frame.rs b/crates/ui-egui/src/frame.rsindex ba636db31e..289f8f28fa 100644--- a/crates/ui-egui/src/frame.rs+++ b/crates/ui-egui/src/frame.rs@@ -1,23 +1,10 @@-//! Shared dock dragging, bounded anchors and tokenised surfaces for `ui_kit::Panel`,-//! plus bounded floating windows for BOM, Messages and 3D mouse calibration.+//! Dock dragging and bounded anchors. Outer hosts and surfaces live in `ui_kit::Container`.-use egui::{Align2, Pos2, Ui, WidgetText, vec2};+use egui::{Pos2, Ui};/// Width limits of a docked command dialog.pub const DIALOG_MIN_W: f32 = 260.0;pub const DIALOG_MAX_W: f32 = 380.0;-/// Floating windows: prompts and panels, and those holding a table (Parameters, Keyboard-/// Shortcuts).-pub const WINDOW_MAX_W: f32 = 460.0;-pub const WINDOW_WIDE_MAX_W: f32 = 760.0;--/// How wide a window may get.-#[derive(Clone, Copy, Debug, PartialEq, Eq)]-pub enum Width {- Normal,- Wide,-}-/// Which edge of the viewport a docked panel sits against. The Sketch Palette holds the right/// edge while a sketch is open, so a dialog started there takes the left.#[derive(Clone, Copy, Debug, PartialEq, Eq)]@@ -36,21 +23,6 @@ impl Side {}}-/// The window frame of a docked panel: the two corners away from its edge are rounded, and the-/// shadow falls the same way, so a left dock mirrors a right one.-pub fn dock_frame(ctx: &egui::Context, side: Side) -> egui::Frame {- let t = crate::theme::Tokens::get();- let (corner_radius, shadow_x) = match side {- Side::Right => (egui::CornerRadius { nw: t.radius_sm, sw: t.radius_sm, ne: 0, se: 0 }, -2),- Side::Left => (egui::CornerRadius { nw: 0, sw: 0, ne: t.radius_sm, se: t.radius_sm }, 2),- };- egui::Frame::window(&ctx.global_style())- .fill(t.dialog_bg)- .stroke(egui::Stroke::new(1.0, t.dialog_border))- .corner_radius(corner_radius)- .shadow(egui::Shadow { offset: [shadow_x, 2], blur: 8, spread: 0, color: egui::Color32::from_black_alpha(40) })-}-/// How far the open docked dialog titled `title` was dragged from its docked place (#1335);/// zero for a dialog that was not dragged, or once another dialog opens.pub fn dock_offset(ctx: &egui::Context, title: &str) -> egui::Vec2 {@@ -82,8 +54,8 @@ pub fn offset_anchor(docked: Pos2, offset: egui::Vec2, vp: egui::Rect, side: Sid/// `moved` (as last frame left it; `applied` of it is where the dialog is now, after keeping/// it on screen). Called before the band's buttons are added, so they keep their clicks.pub fn drag_dock(ui: &Ui, band: egui::Rect, title: &str, moved: egui::Vec2, applied: egui::Vec2) {- let response = ui.interact(band, ui.id().with("sc_dock_drag"), egui::Sense::drag());crate::scenario::publish_handle("dialog:title", band.center());+ let response = ui.interact(band, ui.id().with("sc_dock_drag"), egui::Sense::drag());// The drag runs from where the press started, so no movement is lost while egui decides// it is a drag, nor on the frame it ends.let base = egui::Id::new("sc_dock_drag_base");@@ -108,33 +80,6 @@ pub fn drag_dock(ui: &Ui, band: egui::Rect, title: &str, moved: egui::Vec2, appl}}-/// A floating window, centred on the screen unless the caller places it, shrink-wrapped to its-/// content up to its width limit.-pub fn window<'a>(ctx: &egui::Context, title: impl Into<WidgetText>, width: Width) -> egui::Window<'a> {- let max = match width {- Width::Normal => WINDOW_MAX_W,- Width::Wide => WINDOW_WIDE_MAX_W,- };- let c = ctx.content_rect().center();- egui::Window::new(title)- .enabled(!crate::issue_report::cad_input_blocked())- .collapsible(false)- .pivot(Align2::CENTER_CENTER)- .default_pos(c - vec2(0.0, 60.0))- .max_width(max)-}--/// Floating model controls share the report's read-only drawing boundary with windows.-pub fn area(id: egui::Id) -> egui::Area {- egui::Area::new(id).enabled(!crate::issue_report::cad_input_blocked())-}--/// Shared rounded surface for floating shell cards.-pub(crate) fn shell_card(fill: egui::Color32) -> egui::Frame {- let t = crate::theme::Tokens::get();- egui::Frame::NONE.fill(fill).stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_lg).shadow(t.shell_shadow())-}-#[cfg(test)]mod tests {#[test]@@ -236,21 +181,4 @@ mod tests {assert!((h.app.viewport.dialog_rect.unwrap().min - rest.min).length() < 0.01, "a new dialog opens docked");}}-- /// Windows are made in this file only, so none can skip the width limits.- #[test]- fn windows_come_from_ui_kit_panel() {- let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src");- let mut bad = Vec::new();- for e in std::fs::read_dir(&dir).unwrap() {- let p = e.unwrap().path();- if p.extension().is_some_and(|x| x == "rs") && p.file_name().is_some_and(|n| n != "frame.rs") {- let text = std::fs::read_to_string(&p).unwrap();- if text.contains("egui::Window::new(") {- bad.push(p.display().to_string());- }- }- }- assert!(bad.is_empty(), "use ui_kit::Panel instead of egui::Window::new in {bad:?}");- }}diff --git a/crates/ui-egui/src/help.rs b/crates/ui-egui/src/help.rsindex 3b25229661..3e832fb021 100644--- a/crates/ui-egui/src/help.rs+++ b/crates/ui-egui/src/help.rs@@ -5,6 +5,7 @@use crate::SolveApp;use crate::ui_kit;+use crate::ui_kit::{Container, Surface};pub const VERSION: &str = env!("CARGO_PKG_VERSION");pub const COMMIT: &str = env!("SOLIDCRAFT_COMMIT");@@ -62,8 +63,12 @@ pub fn run(app: &mut SolveApp, ctx: &egui::Context, item: &str) {pub fn show(app: &mut SolveApp, ctx: &egui::Context, anchor: egui::Pos2) {if app.help.menu {let mut pick: Option<&str> = None;- let resp =- crate::frame::area(egui::Id::new("sc_help_menu")).fixed_pos(anchor).constrain(true).order(egui::Order::Foreground).show(ctx, |ui| {+ let resp = Container::new(ctx, Surface::Popup)+ .area(egui::Id::new("sc_help_menu"))+ .fixed_pos(anchor)+ .constrain(true)+ .order(egui::Order::Foreground)+ .show(ctx, |ui| {crate::context_menu::menu_frame(ui, |ui| {for (id, label, icon) in [("docs", "Documentation", "library"),diff --git a/crates/ui-egui/src/home.rs b/crates/ui-egui/src/home.rsindex a5bdc6eacc..16b33b2467 100644--- a/crates/ui-egui/src/home.rs+++ b/crates/ui-egui/src/home.rs@@ -3,6 +3,7 @@//! button or the first document tab; selecting a design returns to its view.use crate::fonts::RichTextExt as _;+use crate::ui_kit::{Container, Surface};use std::collections::HashMap;use egui::{Color32, CornerRadius, RichText, Sense, Stroke, vec2};@@ -530,7 +531,8 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {}}let mut action: Option<Box<dyn FnOnce(&mut SolveApp)>> = None;- egui::CentralPanel::default().frame(egui::Frame::NONE.fill(t.panel).inner_margin(egui::Margin::symmetric(36, 24))).show(ui, |ui| {+ let page = Container::new(ui.ctx(), Surface::Viewport).central();+ page.frame(Container::new(ui.ctx(), Surface::Viewport).edge_frame(t.panel).inner_margin(egui::Margin::symmetric(36, 24))).show(ui, |ui| {egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {ui.horizontal(|ui| {ui.label(RichText::new("SolidCraft").size(crate::theme::Tokens::get().font_display).semibold().color(t.text));@@ -559,13 +561,11 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {};ui.painter().rect(r, t.radius_md, fill, Stroke::new(1.0, if primary { t.accent } else { t.border }), egui::StrokeKind::Inside);let ink = if primary { t.on_accent } else { t.icon };- crate::icons::paint(+ crate::icons::paint_icon(ui.painter(),egui::Rect::from_center_size(r.left_center() + vec2(30.0, 0.0), vec2(30.0, 30.0)),icon,- ink,- t.icon_fill,- ink,+ f32::from(ink.a()) / 255.0,);ui.painter().galley(r.left_center() + vec2(56.0, -galley.size().y / 2.0), galley, ink_text);resp.clicked()@@ -637,7 +637,7 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {let response = card(ui, Pic::Ready(app.home.thumbs.get(p.as_str()).and_then(Option::as_ref)), &name, &sub, missing).on_hover_text(p.as_str());crate::scenario::publish_handle(&format!("home:recent:{i}"), response.rect.center());- response.context_menu(|ui| {+ crate::ui_kit::Menu::context(&response, |ui| {if crate::context_menu::button(ui, crate::i18n::tr_label("Remove from list"), "delete").clicked() {app.home.recent.retain(|x| x != p);app.home.opened_at.remove(p);@@ -727,7 +727,7 @@ fn card(ui: &mut egui::Ui, pic: Pic, name: &str, sub: &str, dim: bool) -> egui::match pic {Pic::Icon(icon) => {ui.painter().rect_filled(img, CornerRadius::same(t.radius_sm), t.panel_header);- crate::icons::paint(ui.painter(), egui::Rect::from_center_size(img.center(), vec2(56.0, 56.0)), icon, t.icon, t.icon_fill, t.icon);+ crate::icons::paint_icon(ui.painter(), egui::Rect::from_center_size(img.center(), vec2(56.0, 56.0)), icon, f32::from(t.icon.a()) / 255.0);}Pic::Ready(Some(tx)) => {let tint = if dim { Color32::from_white_alpha(90) } else { Color32::WHITE };diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rsindex 796e2eb955..c42c96c76e 100644--- a/crates/ui-egui/src/icons.rs+++ b/crates/ui-egui/src/icons.rs@@ -31,14 +31,7 @@ enum Finish {#[derive(Clone, Default)]struct Cache(Arc<Mutex<HashMap<(&'static str, Look, u32, Finish), TextureHandle>>>);-/// Draw the icon `name` in `r`. The ink, fill and accent colours the callers pass are no longer-/// used: the palette decides. Only the ink's opacity is kept, so a dimmed (disabled) button dims-/// its icon.-pub fn paint(p: &Painter, r: Rect, name: &str, ink: Color32, _fill: Color32, _accent: Color32) {- paint_icon(p, r, name, f32::from(ink.a()) / 255.0);-}--/// [`paint`] with an explicit opacity (0 to 1).+/// Draw palette-owned icon artwork with an explicit opacity (0 to 1).pub fn paint_icon(p: &Painter, r: Rect, name: &str, opacity: f32) {paint_on(p, r, name, None, opacity);}diff --git a/crates/ui-egui/src/issue_report.rs b/crates/ui-egui/src/issue_report.rsindex ee15ab23bf..9fefbe76c3 100644--- a/crates/ui-egui/src/issue_report.rs+++ b/crates/ui-egui/src/issue_report.rs@@ -1,5 +1,7 @@//! Reviewed issue drafts with local evidence; never publishes or uploads a report.+#[cfg(test)]+use crate::ui_kit::{Container, Surface};use std::fmt::Write as _;use std::hash::{Hash, Hasher};use std::sync::Arc;@@ -1046,7 +1048,7 @@ mod tests {ui.disable();assert_eq!(ui.opacity(), 1.0, "capture must retain normal drawing opacity");assert!(!ui.is_enabled());- crate::frame::area(egui::Id::new("cad-boundary-proof")).fade_in(false).show(&ctx, |ui| {+ Container::new(&ctx, Surface::Popup).area(egui::Id::new("cad-boundary-proof")).fade_in(false).show(&ctx, |ui| {assert!(!ui.is_enabled());assert_eq!(ui.opacity(), 1.0);ui.ctx().data_mut(|d| d.insert_temp(state, 42_u32));@@ -1055,7 +1057,7 @@ mod tests {drop(barrier);assert_eq!(ctx.memory(|m| m.focused()), Some(focus));assert_eq!(ctx.data(|d| d.get_temp::<u32>(state)), Some(42));- assert!(crate::frame::area(egui::Id::new("report-boundary-proof")).is_enabled());+ assert!(Container::new(&ctx, Surface::Popup).area(egui::Id::new("report-boundary-proof")).is_enabled());});output.textures_delta.clear();app.issue_report.draft = None;diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 84e0652048..3a007eff73 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -7,6 +7,7 @@//! right of the viewport, the command palette and a bottom or left-sidebar feature timeline.#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]#![forbid(unsafe_code)]+use crate::ui_kit::{Container, Surface};pub mod access;pub mod agent_chat;@@ -256,7 +257,7 @@ pub use control::{ControlRequest, ControlResponse};#[derive(Clone, Debug, Serialize, Deserialize)]#[serde(default, rename_all = "camelCase")]pub struct UiState {- /// Automation-only shell mode; never persisted in preferences.+ /// Effective shell mode; automation can override the saved preference for this session.pub layout: shell::LayoutMode,/// Ribbon tab; SHEET METAL and the contextual SKETCH join the seven design tabs.pub tab: String,@@ -728,6 +729,7 @@ impl SolveApp {if !prefs::MSAA.contains(&p.msaa) {p.msaa = prefs::Prefs::default().msaa;}+ self.ui.layout = p.layout;self.preferences = p;}// Saved before the theme was a preference: the Dark/Light flag says which.@@ -756,6 +758,12 @@ impl SolveApp {let r = self.session.execute(id, ¶ms).map_err(|e| e.to_string());self.big_operation |= now_ms() - t0 >= recovery_ui::BIG_OPERATION_MS;if let Ok(v) = &r {+ if id == "view.layout" {+ let layout =+ if v.get("mode").and_then(Value::as_str) == Some("compact") { shell::LayoutMode::Docked } else { shell::LayoutMode::Floating };+ self.preferences.layout = layout;+ self.ui.layout = layout;+ }if id == "view.history_layout" {if let Some(width) = v.get("width").and_then(Value::as_f64) {self.preferences.timeline_left_width = ui_kit::history_snap_width(width as f32);@@ -906,6 +914,11 @@ impl SolveApp {return;}// A display toggle leaves the current modelling tool and camera in place.+ if id == "view.layout" {+ let mode = if self.ui.layout == shell::LayoutMode::Floating { "compact" } else { "floating" };+ let _ = self.run(id, json!({"mode":mode}));+ return;+ }if id == "view.history_layout" {let _ = self.run(id, json!({}));return;@@ -1576,6 +1589,7 @@ impl SolveApp {}fn cad_ui(&mut self, ui: &mut egui::Ui, report_input: &mut Option<issue_report::CadInput>) {+ self.ui.layout.publish(ui.ctx());scenario::clear_handles();self.poll_deferred(ui.ctx());self.poll_delete_check(ui.ctx());@@ -1598,7 +1612,7 @@ impl SolveApp {return;}}- let floating = self.ui.layout == shell::LayoutMode::Floating;+ let floating = ui_kit::Container::new(ui.ctx(), ui_kit::Surface::Panel).floating();let show_timeline = self.ui.show_timeline && !render_workspace::active(self);let left_timeline = show_timeline && self.preferences.timeline_left;timeline_left::animate_folds(self, ui.ctx());@@ -1606,12 +1620,14 @@ impl SolveApp {toolbar::toolbar(self, ui);}theme::TabAccent::publish(self, ui.ctx());+ if !floating {+ agent_chat::show(self, ui);+ }if !floating && show_timeline && !left_timeline {timeline::timeline(self, ui);}- // A floating browser keeps the workspace the whole width and covers viewport input.- let browser_float = self.ui.show_browser && (self.preferences.browser_float || floating || left_timeline);- if !browser_float {+ // Browser hugs its contents in either layout; it never becomes a full-height blank column.+ if !self.ui.show_browser {self.shell.browser = None;}if floating || left_timeline || !show_timeline {@@ -1619,7 +1635,7 @@ impl SolveApp {}let full = ui.available_rect_before_wrap();if floating {- let cards = shell::Cards::new(full, self.ui.layout);+ let cards = shell::Cards::new(full, self.ui.layout, toolbar::ribbon_height(self.preferences.ribbon_labels));self.shell.cards = vec![cards.workspace, cards.ribbon];self.shell.history = if left_timeline {let below_ribbon = egui::Rect::from_min_max(egui::pos2(full.left(), cards.bottom), full.max);@@ -1655,49 +1671,35 @@ impl SolveApp {if left_timeline {timeline_left::left_panel(self, ui);}- if self.ui.show_browser && !browser_float {- browser::browser(self, ui);- }if render_workspace::active(self) {render_workspace::panel(self, ui);}- agent_chat::show(self, ui);- if browser_float {- // The remaining content starts below the ribbon in either shell layout.- let viewport = ui.available_rect_before_wrap();- browser::floating(self, ui, viewport);+ if self.ui.show_browser {+ browser::browser(self, ui);}- if !floating && timeline_left::stacked(self) {- let width = browser::browser_width(self.preferences.browser_width) + shell::SHELL_GAP * 2.0;- egui::Panel::left("sc_history_browser_column").exact_size(width).resizable(false).frame(egui::Frame::NONE).show(ui, |_| {});+ if floating {+ agent_chat::show(self, ui);}- egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| {- if floating {+ Container::new(ui.ctx(), Surface::Viewport)+ .central()+ .frame(Container::new(ui.ctx(), Surface::Viewport).edge_frame(egui::Color32::TRANSPARENT))+ .show(ui, |ui| {let panel_content = ui.max_rect();- let mut content = panel_content;- if let Some(history) = self.shell.history.filter(|_| !left_timeline) {- content.max.y = (history.top() - shell::SHELL_GAP).max(content.top());- }- if left_timeline && let Some(history) = self.shell.history {- content.min.x = (history.right() + shell::SHELL_GAP).min(content.right());- }- if let Some(browser) = self.shell.browser {- content.min.x = (browser.right() + shell::SHELL_GAP).min(content.right());+ self.shell.content = Some(shell::workspace_content(self, panel_content));+ if floating {+ self.shell.panels = [+ egui::Rect::from_min_max(egui::pos2(full.left(), panel_content.top()), egui::pos2(panel_content.left(), full.bottom())),+ egui::Rect::from_min_max(egui::pos2(panel_content.right(), panel_content.top()), full.max),+ ]+ .into_iter()+ .filter(|r| r.is_positive())+ .collect();+ viewport::refresh_layout(self, ui.ctx().pixels_per_point());+ } else {+ preview::update(self, ui.ctx());+ self.show_workspace(ui);}- self.shell.content = Some(content);- self.shell.panels = [- egui::Rect::from_min_max(egui::pos2(full.left(), panel_content.top()), egui::pos2(panel_content.left(), full.bottom())),- egui::Rect::from_min_max(egui::pos2(panel_content.right(), panel_content.top()), full.max),- ]- .into_iter()- .filter(|r| r.is_positive())- .collect();- viewport::refresh_layout(self, ui.ctx().pixels_per_point());- } else {- preview::update(self, ui.ctx());- self.show_workspace(ui);- }- });+ });dialogs::show(self, ui.ctx());issue_report::CadInput::block(self, ui, report_input);sketch_palette::show(self, ui.ctx());diff --git a/crates/ui-egui/src/manage_dialogs_tests.rs b/crates/ui-egui/src/manage_dialogs_tests.rsindex 47eecd9210..7b6db3f814 100644--- a/crates/ui-egui/src/manage_dialogs_tests.rs+++ b/crates/ui-egui/src/manage_dialogs_tests.rs@@ -537,7 +537,7 @@ fn parameters_header_drag_retains_offset_and_bounds_the_card() {h.call("ui.drag", json!({"x0":title.x,"y0":title.y,"x1":title.x+delta.x,"y1":title.y+delta.y,"steps":8}));h.frames(6);let card = scenario::rect_of("dialog:header").unwrap().union(scenario::rect_of("dialog:footer").unwrap());- let viewport = crate::shell::content_rect(&h.app, h.app.viewport.rect.unwrap());+ let viewport = crate::shell::tool_drag_rect(&h.app, crate::shell::content_rect(&h.app, h.app.viewport.rect.unwrap()));assert!(viewport.expand(2.0).contains_rect(card), "{layout:?}: {card:?} outside {viewport:?}");assert!(h.app.params.is_some());}diff --git a/crates/ui-egui/src/material_card_review.rs b/crates/ui-egui/src/material_card_review.rsindex 1416c6a241..03df3ca699 100644--- a/crates/ui-egui/src/material_card_review.rs+++ b/crates/ui-egui/src/material_card_review.rs@@ -49,7 +49,7 @@ impl ReviewWindow {/// Open only through ui.start; executing the validator never opens a window.pub fn show(app: &mut SolveApp, ctx: &egui::Context) {let Some(mut window) = app.material_card_review.take() else { return };- let viewport = crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect()));+ let viewport = crate::agent_chat::tool_space(app, crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect())));if !viewport.is_finite() || !viewport.is_positive() {app.material_card_review = Some(window);return;@@ -61,12 +61,13 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {let docked = egui::pos2(side.anchor_x(viewport), top);let title = tr("ui.material_review.title");let moved = crate::frame::dock_offset(ctx, "material_card_review");- let anchor = crate::frame::offset_anchor(docked, moved, viewport, side);+ let drag_bounds = crate::shell::tool_drag_rect(app, viewport);+ let anchor = crate::frame::offset_anchor(docked, moved, drag_bounds, side);let panel = ui_kit::Panel::new(title,egui::Id::new("sc_material_card_review"),anchor,- viewport,+ drag_bounds,side,ui_kit::Panel::feature_frame(ctx, app.ui.layout, side),)@@ -78,7 +79,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {panel};let mut close = false;- panel.window().show(ctx, |ui| {+ panel.window(ctx).show(ctx, |ui| {let (closed, action) = panel.feature(ui,ui_kit::FeatureOptions {diff --git a/crates/ui-egui/src/messages.rs b/crates/ui-egui/src/messages.rsindex 9447ae5a86..48285e0760 100644--- a/crates/ui-egui/src/messages.rs+++ b/crates/ui-egui/src/messages.rs@@ -109,19 +109,15 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {}let t = Tokens::get();let now = crate::now_ms();- let mut open = true;- crate::frame::window(ctx, tr("messages.title"), crate::frame::Width::Normal)- .id(egui::Id::new("sc_messages"))- .open(&mut open)- .default_size(vec2(460.0, 360.0))- .show(ctx, |ui| {+ let (closed, _) =+ crate::ui_kit::Window::new(egui::Id::new("sc_messages"), "list", tr("messages.title")).fields().actions("", "", None).show(ctx, true, |ui| {ui.horizontal(|ui| {- let copy = ui.add_enabled(app.messages.iter().len() > 0, egui::Button::new(tr("messages.copy_all")));+ let copy = crate::ui_kit::button(ui, tr("messages.copy_all"), crate::ui_kit::Button::Enabled(app.messages.iter().len() > 0));crate::scenario::publish_handle("messages:copy", copy.rect.center());if copy.clicked() {ctx.copy_text(app.messages.as_text(now));}- let clear = ui.add_enabled(app.messages.iter().len() > 0, egui::Button::new(tr("messages.clear")));+ let clear = crate::ui_kit::button(ui, tr("messages.clear"), crate::ui_kit::Button::Enabled(app.messages.iter().len() > 0));crate::scenario::publish_handle("messages:clear", clear.rect.center());if clear.clicked() {app.messages.clear();@@ -132,7 +128,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {ui.label(RichText::new(tr("messages.none")).color(t.text_dim));return;}- egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {+ egui::ScrollArea::vertical().max_height(crate::theme::Tokens::get().form_card_width).auto_shrink([false, true]).show(ui, |ui| {for m in app.messages.iter().rev() {ui.horizontal_top(|ui| {ui.add_sized(vec2(70.0, 14.0), egui::Label::new(RichText::new(ago(now, m.at)).small().color(t.text_dim)));@@ -142,7 +138,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {}});});- if !open {+ if closed {app.messages.open = false;}// The ages tick on while it is open.diff --git a/crates/ui-egui/src/mouse_gesture.rs b/crates/ui-egui/src/mouse_gesture.rsindex f85a8ba864..c8f09a8313 100644--- a/crates/ui-egui/src/mouse_gesture.rs+++ b/crates/ui-egui/src/mouse_gesture.rs@@ -20,6 +20,7 @@//! [`Config`] (kept with the preferences, edited in [`editor`]) holds the person's own list for//! any of them: how many tools and in which place, clockwise from the top.+use crate::ui_kit::{Container, Surface};use std::collections::BTreeMap;use egui::{Align2, Color32, FontId, Mesh, Painter, Pos2, Rect, Sense, Shape, Stroke, Vec2, pos2, vec2};@@ -340,7 +341,7 @@ pub(crate) fn paint(painter: &Painter, c: Pos2, scale: f32, studio: Studio, itemlet at = c + vec2(a.sin(), -a.cos()) * (hub + ring) / 2.0;let ink = if item.enabled { t.icon } else { t.border };let side = (24.0 * scale).max(12.0);- crate::icons::paint(painter, Rect::from_center_size(at, vec2(side, side)), &item.icon, ink, t.icon_fill, t.accent);+ crate::icons::paint_icon(painter, Rect::from_center_size(at, vec2(side, side)), &item.icon, f32::from(ink.a()) / 255.0);}}match hot.and_then(|k| items.get(k)).filter(|i| i.enabled) {@@ -500,7 +501,7 @@ fn paint_open(app: &SolveApp, ctx: &egui::Context) {let t = Tokens::get();let pointer = ctx.input(|i| i.pointer.latest_pos());let area = Rect::from_center_size(wheel.centre, vec2(2.0 * (RING + 6.0), 2.0 * (RING + 6.0)));- crate::frame::area(egui::Id::new("sc_mouse_gesture")).fixed_pos(area.min).order(egui::Order::Foreground).show(ctx, |ui| {+ Container::new(ctx, Surface::Canvas).area(egui::Id::new("sc_mouse_gesture")).fixed_pos(area.min).order(egui::Order::Foreground).show(ctx, |ui| {let (r, _) = ui.allocate_exact_size(area.size(), Sense::hover());paint(&ui.painter_at(r.expand(4.0)), wheel.centre, 1.0, wheel.studio, &list, pointer, t);});@@ -579,7 +580,9 @@ pub(crate) fn nav_rows(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {ui.label(crate::i18n::tr_label("Mouse gestures"));ui.horizontal(|ui| {crate::ui_kit::checkbox(ui, crate::i18n::tr_label("Ring of tools on the right button"), &mut app.preferences.mouse_gestures.enabled);- if crate::ui_kit::button(ui, crate::i18n::tr_label("Customize…"), crate::ui_kit::Button::Normal).clicked() {+ let customize = crate::ui_kit::button(ui, crate::i18n::tr_label("Customize…"), crate::ui_kit::Button::Normal);+ crate::scenario::publish_handle("gestures:customize", customize.rect.center());+ if customize.clicked() {app.gesture.editor.open = true;app.gesture.editor.studio = Studio::of(app);}@@ -613,13 +616,11 @@ fn editor(app: &mut SolveApp, ctx: &egui::Context) {return;}let t = Tokens::get();- let mut open = true;let mut studio = app.gesture.editor.studio;let mut config = app.preferences.mouse_gestures.clone();- crate::frame::window(ctx, crate::i18n::tr_label("Mouse gestures"), crate::frame::Width::Wide)- .id(egui::Id::new("sc_gesture_editor"))- .open(&mut open)- .show(ctx, |ui| {+ let closed = crate::ui_kit::Window::new(egui::Id::new("sc_gesture_editor"), "settings", crate::i18n::tr_label("Mouse gestures"))+ .cards(3.0)+ .show_body(ctx, |ui| {crate::ui_kit::checkbox(ui, crate::i18n::tr_label("Ring of tools on the right button"), &mut config.enabled);if app.preferences.nav != MOUSE_MODE {ui.colored_label(@@ -729,7 +730,7 @@ fn editor(app: &mut SolveApp, ctx: &egui::Context) {});app.gesture.editor.studio = studio;app.preferences.mouse_gestures = config;- app.gesture.editor.open = open;+ app.gesture.editor.open = !closed;}#[cfg(test)]@@ -947,6 +948,45 @@ mod tests {);}+ #[test]+ fn customization_uses_the_shared_header_keeps_edits_and_has_no_resize_edges() {+ use crate::scenario::{Harness, handle_at, rect_of};+ use serde_json::json;+ for dark in [false, true] {+ let mut h = Harness::new();+ h.app.home.open = false;+ h.call("ui.resize", json!({"width":1400,"height":900}));+ h.call("ui.set", json!({"dark":dark}));+ h.app.preferences.mouse_gestures.set_tools(Studio::Part, vec!["undo".into(), "solid.extrude".into()]);+ h.app.gesture.editor.open = true;+ h.app.gesture.editor.studio = Studio::Part;+ h.frames(6);+ let header = rect_of("dialog:header").unwrap();+ assert_eq!(header.height(), Tokens::get().form_header_height);+ assert_eq!(h.app.preferences.mouse_gestures.tools(Studio::Part).len(), 2);+ h.step(&json!({"widget":"Add a tool"})).unwrap();+ h.frames(4);+ assert_eq!(h.app.preferences.mouse_gestures.tools(Studio::Part).len(), 3);+ let window = rect_of("dialog:window").unwrap();+ for at in [window.left_center(), window.right_center(), window.right_bottom()] {+ h.call("ui.move", json!({"x":at.x,"y":at.y}));+ h.frames(2);+ assert!(!matches!(+ h.output.cursor_icon,+ egui::CursorIcon::ResizeHorizontal+ | egui::CursorIcon::ResizeVertical+ | egui::CursorIcon::ResizeNwSe+ | egui::CursorIcon::ResizeNeSw+ ));+ }+ let close = handle_at("dialog:close").unwrap();+ h.call("ui.click", json!({"x":close.x,"y":close.y}));+ h.frames(2);+ assert!(!h.app.gesture.editor.open);+ assert_eq!(h.app.preferences.mouse_gestures.tools(Studio::Part).len(), 3, "closing retains edits");+ }+ }+#[test]fn the_editor_changes_how_many_tools_and_where_they_sit() {let mut list: Vec<String> = ["solid.extrude", "undo", "solid.hole"].iter().map(|s| s.to_string()).collect();diff --git a/crates/ui-egui/src/navigation_cube.rs b/crates/ui-egui/src/navigation_cube.rsindex f0974003e9..ed1cc44597 100644--- a/crates/ui-egui/src/navigation_cube.rs+++ b/crates/ui-egui/src/navigation_cube.rs@@ -217,7 +217,7 @@ pub(super) fn show(app: &mut SolveApp, ui: &mut egui::Ui, rect: Rect) {crate::scenario::publish_target("axis_view:home", home);let home_hover = control(app, ui, home, "home", "Home: isometric view and fit model");if active {- icons::paint(&painter, home.shrink(4.0 * scale), "home", if home_hover { t.accent } else { t.cube_face }, t.cube_face, t.accent);+ icons::paint_icon(&painter, home.shrink(4.0 * scale), "home", f32::from((if home_hover { t.accent } else { t.cube_face }).a()) / 255.0);}let fit = Rect::from_center_size(c + vec2(67.0, 67.0) * scale, vec2(22.0, 22.0) * scale);let fit_hover = control(app, ui, fit, "fit", "Fit model in view");diff --git a/crates/ui-egui/src/open_meshing.rs b/crates/ui-egui/src/open_meshing.rsindex 7843ceef89..088929e9fd 100644--- a/crates/ui-egui/src/open_meshing.rs+++ b/crates/ui-egui/src/open_meshing.rs@@ -15,6 +15,7 @@//!//! Display only: commands, picking of what is drawn and exports read the session's world as ever.+use crate::ui_kit::{Container, Surface};use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};use std::sync::{Arc, Mutex};@@ -137,13 +138,14 @@ pub(crate) fn show(app: &SolveApp, ctx: &egui::Context) {let (Some((done, total)), Some(view)) = (progress(app), app.viewport.rect) else { return };let t = crate::theme::Tokens::get();let at = egui::pos2(view.left() + 12.0, view.bottom() - 12.0);- egui::Area::new(egui::Id::new("open_meshing"))+ Container::new(ctx, Surface::Toast)+ .area(egui::Id::new("open_meshing")).order(egui::Order::Foreground).pivot(egui::Align2::LEFT_BOTTOM).fixed_pos(at).interactable(false).show(ctx, |ui| {- egui::Frame::popup(ui.style()).fill(t.panel).show(ui, |ui| {+ Container::popup_frame(ui.style()).fill(t.panel).show(ui, |ui| {ui.horizontal(|ui| {ui.spinner();ui.label(egui::RichText::new(format!("Loading parts {done}/{total}")).color(t.text));diff --git a/crates/ui-egui/src/params_dialog.rs b/crates/ui-egui/src/params_dialog.rsindex 8241b8bcab..604ed9b2d3 100644--- a/crates/ui-egui/src/params_dialog.rs+++ b/crates/ui-egui/src/params_dialog.rs@@ -140,7 +140,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {}let Some(mut d) = app.params.take() else { return };ctx.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Enter));- let viewport = crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect()));+ let viewport = crate::agent_chat::tool_space(app, crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect())));if !viewport.is_finite() || !viewport.is_positive() {app.params = Some(d);return;@@ -151,12 +151,19 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {let top = crate::shell::panel_top(app, viewport, viewport.bottom(), side);let docked = egui::pos2(side.anchor_x(viewport), top);let moved = crate::frame::dock_offset(ctx, "PARAMETERS");- let anchor = crate::frame::offset_anchor(docked, moved, viewport, side);+ let drag_bounds = crate::shell::tool_drag_rect(app, viewport);+ let anchor = crate::frame::offset_anchor(docked, moved, drag_bounds, side);let title = crate::i18n::tr_label("Parameters");- let panel =- ui_kit::Panel::new(title, egui::Id::new("sc_params_dialog"), anchor, viewport, side, ui_kit::Panel::feature_frame(ctx, app.ui.layout, side))- .wide()- .reset_scroll(d.reset_scroll);+ let panel = ui_kit::Panel::new(+ title,+ egui::Id::new("sc_params_dialog"),+ anchor,+ drag_bounds,+ side,+ ui_kit::Panel::feature_frame(ctx, app.ui.layout, side),+ )+ .wide()+ .reset_scroll(d.reset_scroll);let panel = if side == crate::frame::Side::Left {let available = palette.map_or(viewport.width(), |r| (r.left() - viewport.left() - crate::theme::Tokens::get().space_8).max(0.0));panel.width((crate::theme::Tokens::get().form_card_width * 3.0).min(available))@@ -172,7 +179,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {rows};let mut close = false;- panel.window().show(ctx, |ui| {+ panel.window(ctx).show(ctx, |ui| {let (closed, action) = panel.feature(ui,ui_kit::FeatureOptions {diff --git a/crates/ui-egui/src/prefs.rs b/crates/ui-egui/src/prefs.rsindex eba5d7c2c4..9f2fcd5d68 100644--- a/crates/ui-egui/src/prefs.rs+++ b/crates/ui-egui/src/prefs.rs@@ -442,6 +442,10 @@ preference_settings! {custom_themes: Vec<crate::theme_files::ThemeFile> = Vec::new();/// Interface language (a registered locale ID).language: String = "en".into(), 0;+ /// Shared workspace composition; system windows and popups retain their purpose.+ layout: crate::shell::LayoutMode = Default::default(), 0;+ /// Show command names beneath ribbon icons, independently of workspace layout.+ ribbon_labels: bool = true, 0 => check_tr("ui.ribbon_labels");/// Interface scale (1 = 100 %).ui_scale: f32 = 1.0, 0, accept(0.5..=2.5) => slider("ui.ui_scale", 0.5..=2.5, 0.05, |v| format!("{:.0} %", v * 100.0), "prefs:scale");/// Interface font: an installed font family (or a font file), or empty for the built-in one@@ -455,8 +459,6 @@ preference_settings! {timeline_under_browser: bool = false, 0;/// Fold the shared-column history to its header.timeline_collapsed: bool = false, 0;- /// Legacy shared-column height, retained for preference compatibility.- timeline_left_height: f32 = 360.0, 0;/// Whether the browser beside the vertical history is collapsed to its rail.timeline_left_browser_collapsed: bool = false, 0;/// Width of the browser sidebar, which@@ -600,6 +602,7 @@ pub fn open_at(app: &mut SolveApp, page: usize) {struct Snapshot {prefs: Prefs,dark: bool,+ layout: crate::shell::LayoutMode,grid: bool,shadow: bool,perspective: bool,@@ -616,6 +619,7 @@ impl Snapshot {Snapshot {prefs: app.preferences.clone(),dark: app.ui.dark,+ layout: app.ui.layout,grid: app.ui.show_grid,shadow: app.ui.ground_shadow,perspective: app.ui.perspective,@@ -634,6 +638,7 @@ impl Snapshot {app.preferences = self.prefs;app.preferences.update = update;app.ui.dark = self.dark;+ app.ui.layout = self.layout;app.ui.show_grid = self.grid;app.ui.ground_shadow = self.shadow;app.ui.perspective = self.perspective;@@ -767,6 +772,7 @@ fn defaults(app: &mut SolveApp, page: usize) {match page {0 => {app.ui.dark = true;+ app.ui.layout = app.preferences.layout;app.ui.agent_cursor = Default::default();app.autosave_minutes = 5.0;set_autosave(app);@@ -1144,6 +1150,18 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {});});theme_row(app, ui);+ ui_kit::row(ui, app.tr("ui.workspace_layout"), |ui| {+ let mut selected = usize::from(app.ui.layout == crate::shell::LayoutMode::Docked);+ if ui_kit::segmented(+ ui,+ &mut selected,+ &[crate::i18n::tr("ui.layout_floating"), crate::i18n::tr("ui.layout_compact")],+ Default::default(),+ ) {+ let _ = app.run("view.layout", json!({"mode": if selected == 1 { "compact" } else { "floating" }}));+ }+ });+ setting::ribbon_labels(app, ui);setting::ui_scale(app, ui);if !cfg!(target_arch = "wasm32") {ui_kit::row(ui, app.tr_label("Interface font"), |ui| ui_font_row(app, ui));@@ -1165,7 +1183,7 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {});ui_kit::text(ui, app.tr("ui.timeline_left_note"), ui_kit::Text::Note("timeline"));ui_kit::row(ui, app.tr_label("Parts browser"), |ui| {- setting::browser_float(app, ui);+ ui.add_enabled_ui(app.ui.layout == crate::shell::LayoutMode::Floating, |ui| setting::browser_float(app, ui));});ui_kit::text(ui,@@ -1883,6 +1901,9 @@ pub fn set(app: &mut SolveApp, p: &serde_json::Value) -> Result<serde_json::Valu}let up_changed = new.up_axis != app.preferences.up_axis;let msaa_changed = new.msaa != app.preferences.msaa;+ if p.get("layout").is_some() {+ app.ui.layout = new.layout;+ }app.preferences = new;if msaa_changed {save_graphics(app);@@ -2475,7 +2496,6 @@ mod tests {// Switch language to Japaneseset(&mut app, &json!({"language": "ja", "timeline_left": true})).unwrap();- app.preferences.timeline_left_height = 275.0;app.preferences.timeline_left_browser_collapsed = true;assert_eq!(app.preferences.language, "ja");assert!(app.preferences.timeline_left);@@ -2487,7 +2507,6 @@ mod tests {other.load_prefs(&app.prefs());assert_eq!(other.preferences.language, "ja");assert!(other.preferences.timeline_left);- assert_eq!(other.preferences.timeline_left_height, 275.0);assert!(other.preferences.timeline_left_browser_collapsed);assert_eq!(other.tr("ui.preferences"), "環境設定");}diff --git a/crates/ui-egui/src/preview.rs b/crates/ui-egui/src/preview.rsindex b1bfee4b75..16e8510d24 100644--- a/crates/ui-egui/src/preview.rs+++ b/crates/ui-egui/src/preview.rs@@ -121,11 +121,6 @@ impl PreviewState {if self.rolled_back { &[] } else { &self.replaced }}- /// Whether the preview scene should be drawn.- pub fn draw_active(&self) -> bool {- self.active && !self.rolled_back- }-/// Stop drawing the preview scene and give the bodies it stood in for back to the model.fn hide_scene(&mut self) {if self.active || !self.replaced.is_empty() {diff --git a/crates/ui-egui/src/render_workspace.rs b/crates/ui-egui/src/render_workspace.rsindex f654379d6a..400089bd73 100644--- a/crates/ui-egui/src/render_workspace.rs+++ b/crates/ui-egui/src/render_workspace.rs@@ -1,5 +1,6 @@//! Integrated product preview. Shares the installed device/pipelines, not Design's scene policy.+use crate::ui_kit::{Container, Edge, Surface};use std::hash::{Hash, Hasher};use std::sync::{Arc, Mutex};@@ -173,10 +174,11 @@ pub fn panel(app: &mut SolveApp, ui: &mut egui::Ui) {app.render_workspace.view.draft = app.session.doc.render.setups.get(&app.render_workspace.view.name).cloned().unwrap_or_default();app.render_workspace.revision = app.session.revision;}- egui::Panel::right("sc_render_settings")+ Container::new(ui.ctx(), Surface::Panel)+ .edge("sc_render_settings", Edge::Right).exact_size(285.0).resizable(false)- .frame(egui::Frame::NONE.fill(Tokens::get().panel).inner_margin(10))+ .frame(Container::new(ui.ctx(), Surface::Panel).edge_frame(Tokens::get().panel).inner_margin(10)).show(ui, |ui| {crate::ui_kit::scope(ui, |ui| {egui::ScrollArea::vertical().show(ui, |ui| {diff --git a/crates/ui-egui/src/select_other.rs b/crates/ui-egui/src/select_other.rsindex bc34d93768..070418267e 100644--- a/crates/ui-egui/src/select_other.rs+++ b/crates/ui-egui/src/select_other.rs@@ -17,6 +17,7 @@//!//! The control channel's `ui.selectOther` opens, describes and picks from the list.+use crate::ui_kit::{Container, Surface};use egui::{Align2, FontId, Pos2, Rect, Sense, pos2, vec2};use serde_json::{Value, json};use solidcraft_engine::Sel;@@ -515,7 +516,8 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {let w = crate::context_menu::LIST_W - 10.0;// Title, rows up to the scroll height, margins and border.let size = vec2(w + 10.0, 30.0 + (p.rows.len() as f32 * 24.0).min(360.0));- let resp = crate::frame::area(egui::Id::new("sc_select_other"))+ let resp = Container::new(ctx, Surface::Popup)+ .area(egui::Id::new("sc_select_other")).fixed_pos(crate::context_menu::place(p.at, vec2(12.0, 12.0), size, ctx.content_rect())).constrain(true).order(egui::Order::Foreground)@@ -539,13 +541,11 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {hovered = Some(i);ui.painter().rect_filled(r.shrink2(vec2(2.0, 1.0)), 4.0, t.hover);}- crate::icons::paint(+ crate::icons::paint_icon(ui.painter(),Rect::from_center_size(pos2(r.left() + 16.0, r.center().y), vec2(16.0, 16.0)),row.icon,- t.icon,- t.icon_fill,- t.accent,+ f32::from(t.icon.a()) / 255.0,);ui.painter().text(pos2(r.left() + 32.0, r.center().y),diff --git a/crates/ui-egui/src/shell.rs b/crates/ui-egui/src/shell.rsindex 48f6d34eba..a424611eb8 100644--- a/crates/ui-egui/src/shell.rs+++ b/crates/ui-egui/src/shell.rs@@ -1,18 +1,30 @@//! Transient shell geometry shared by automation, drawing and viewport occlusion.+use crate::ui_kit::{Container, Surface};use egui::{Rect, pos2, vec2};use serde::{Deserialize, Serialize};use crate::{SolveApp, theme::Tokens, toolbar};-/// Shell frame selected by automation for this session.+/// Saved workspace layout; automation may override it for a session.#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "lowercase")]pub enum LayoutMode {#[default]Floating,+ #[serde(rename = "compact", alias = "docked")]Docked,}+impl LayoutMode {+ pub(crate) fn publish(self, ctx: &egui::Context) {+ ctx.data_mut(|data| data.insert_temp(egui::Id::new("sc_container_layout"), self));+ }++ pub(crate) fn current(ctx: &egui::Context) -> Self {+ ctx.data(|data| data.get_temp(egui::Id::new("sc_container_layout"))).unwrap_or_default()+ }+}+/// The gap from the viewport edge to the floating cards and between the cards.pub(crate) const SHELL_GAP: f32 = 7.0;@@ -58,17 +70,20 @@ pub(crate) struct Cards {}impl Cards {- pub fn new(available: Rect, mode: LayoutMode) -> Self {- let margin = if mode == LayoutMode::Floating { SHELL_GAP } else { 0.0 };- let gap = if mode == LayoutMode::Floating { SHELL_GAP } else { 1.0 };+ pub fn new(available: Rect, mode: LayoutMode, ribbon_height: f32) -> Self {+ let margin = Container::for_layout(mode, Surface::Chrome).gap();+ let gap = margin;let left = available.left() + margin;let top = available.top() + margin;let right = (available.right() - margin).max(left);let workspace = Rect::from_min_size(pos2(left, top),- vec2(toolbar::WORKSPACE_WIDTH.min((right - left).max(0.0)), toolbar::RIBBON_HEIGHT - if mode == LayoutMode::Docked { 1.0 } else { 0.0 }),+ vec2(+ toolbar::WORKSPACE_WIDTH.min((right - left).max(0.0)),+ ribbon_height - if !Container::for_layout(mode, Surface::Chrome).floating() { 1.0 } else { 0.0 },+ ),);- let ribbon = Rect::from_min_max(pos2((workspace.right() + gap).min(right), top), pos2(right, top + toolbar::RIBBON_HEIGHT));+ let ribbon = Rect::from_min_max(pos2((workspace.right() + gap).min(right), top), pos2(right, top + ribbon_height));Self { workspace, ribbon, bottom: ribbon.bottom() + margin }}}@@ -93,11 +108,14 @@ pub(crate) struct State {/// One source of occlusion for navigation, picking, overlays and fit.pub(crate) fn covered_rects(app: &SolveApp) -> Vec<Rect> {let mut rects = Vec::new();- if app.ui.layout == LayoutMode::Floating {+ if Container::for_layout(app.ui.layout, Surface::Panel).floating() {rects.extend(app.shell.cards.iter().copied());rects.extend(app.shell.panels.iter().copied());- rects.extend(app.shell.history);+ if crate::agent_chat::shown(app) && app.agent_chat.open && !app.preferences.agent_chat_popped {+ rects.extend(app.agent_chat.panel_rect);+ }}+ rects.extend(app.shell.history.filter(|_| app.ui.show_timeline));if app.ui.show_timeline && app.preferences.timeline_left {rects.extend(app.shell.history.map(|card| crate::ui_kit::HistorySeam::new(card).pill));}@@ -114,14 +132,42 @@ pub(crate) fn covered(app: &SolveApp, p: egui::Pos2) -> bool {/// The former central panel remains the anchor for controls and docked panels.pub(crate) fn content_rect(app: &SolveApp, viewport: Rect) -> Rect {- if app.ui.layout == LayoutMode::Floating { app.shell.content.unwrap_or(viewport).intersect(viewport) } else { viewport }+ app.shell.content.unwrap_or(viewport).intersect(viewport)+}++/// Free anchor space shared by both layouts. Compact edge hosts have already consumed+/// their allocation; content-hugging Browser and floating overlays reserve their measured span.+pub(crate) fn workspace_content(app: &SolveApp, mut content: Rect) -> Rect {+ let gap = Container::for_layout(app.ui.layout, Surface::Panel).gap();+ if let Some(history) = app.shell.history {+ if app.preferences.timeline_left {+ content.min.x = (history.right() + gap).clamp(content.left(), content.right());+ } else {+ content.max.y = (history.top() - gap).clamp(content.top(), content.bottom());+ }+ }+ if let Some(browser) = app.shell.browser {+ content.min.x = (browser.right() + gap).clamp(content.left(), content.right());+ }+ content+}++/// Tool sheets may cover Browser and History, while shell chrome and Assistant stay clear.+/// Assistant's outside-rail exception stays in its owner.+pub(crate) fn tool_drag_rect(app: &SolveApp, placement: Rect) -> Rect {+ let gap = Container::for_layout(app.ui.layout, Surface::Feature).gap();+ let mut bounds = crate::agent_chat::tool_space(app, app.viewport.rect.unwrap_or(placement));+ for card in app.shell.cards.iter().filter(|r| r.is_finite() && r.is_positive()) {+ bounds.min.y = (card.bottom() + gap).clamp(bounds.top(), bounds.bottom());+ }+ bounds}pub(crate) fn panel_top(app: &SolveApp, viewport: Rect, bottom: f32, side: crate::frame::Side) -> f32 {let content = content_rect(app, viewport);- if app.ui.layout == LayoutMode::Floating && side == crate::frame::Side::Right {- // Preserve measured compass clearance when there is room; reclaim it on short- // views with the same 360 px panel budget as Docked.+ if side == crate::frame::Side::Right {+ // Both layouts use the measured compass, rather than a legacy fixed-height gap.+ // Reclaim that space on short views while keeping the panel usable.app.viewport.layout.as_ref()diff --git a/crates/ui-egui/src/shell_tests.rs b/crates/ui-egui/src/shell_tests.rsindex 238eaf8004..e11dc3dfdf 100644--- a/crates/ui-egui/src/shell_tests.rs+++ b/crates/ui-egui/src/shell_tests.rs@@ -46,7 +46,7 @@ fn both_modes_keep_their_geometry_and_fit_clear_of_covered_rects() {assert_eq!(viewport.top(), toolbar.bottom());assert_eq!(toolbar.height(), toolbar::RIBBON_HEIGHT);assert_eq!(workspace.left(), 0.0);- assert!(covered_rects(&h.app).is_empty());+ assert_eq!(covered_rects(&h.app), vec![h.app.shell.history.unwrap(), rect_of("browser:card").unwrap()]);}h.app.fit_view();h.settle();@@ -230,9 +230,9 @@ fn floating_browser_clears_cards_shields_input_and_can_dock_again() {assert!(crate::browser::drawn_rows().iter().any(|(name, _, _, open)| name == "Origin" && *open == Some(true)));h.app.preferences.browser_float = false;h.settle();- assert_eq!(h.app.shell.browser.is_some(), mode == LayoutMode::Floating || timeline_left);+ assert!(h.app.shell.browser.is_some());assert!(rect_of("browser:float").is_none());- assert_eq!(rect_of("browser:card").is_some(), mode == LayoutMode::Floating || timeline_left);+ assert!(rect_of("browser:card").is_some());// The saved width follows both the floating card and the docked column.let rail = crate::scenario::handle_at("left-browser-rail").unwrap();let width = h.app.preferences.browser_width;@@ -294,12 +294,12 @@ fn left_history_and_browser_share_the_left_edge_without_moving_right_controls()assert!(rect_of("history:card").is_none());let history = rect_of("history:vertical").unwrap();let browser = rect_of("browser:card").unwrap();- assert!(history.right() < browser.left());+ assert!((browser.left() - history.right() - Container::for_layout(mode, Surface::Panel).gap()).abs() < 1.0);assert!(crate::scenario::handle_at("timeline:First").is_some());let viewport = h.app.viewport.rect.unwrap();let content = content_rect(&h.app, viewport);assert_eq!(viewport.left(), if mode == LayoutMode::Floating { 0.0 } else { crate::ui_kit::history_width(true) });- assert_eq!(content.left(), if mode == LayoutMode::Floating { browser.right() + SHELL_GAP } else { viewport.left() });+ assert_eq!(content.left(), browser.right() + Container::for_layout(mode, Surface::Panel).gap());assert_eq!(content.bottom(), viewport.bottom());if mode == LayoutMode::Floating {assert!(covered(&h.app, history.center()));@@ -310,3 +310,354 @@ fn left_history_and_browser_share_the_left_edge_without_moving_right_controls()}}}++#[test]+fn assistant_floats_without_changing_projection_and_shields_the_model() {+ for dark in [false, true] {+ for side in ["left", "right"] {+ let mut h = crate::scenario::Harness::new();+ h.app.home.open = false;+ h.call("ui.resize", serde_json::json!({"width":1400,"height":1000}));+ h.call("ui.set", serde_json::json!({"dark":dark,"layout":"floating"}));+ h.frames(4);+ let projection = h.app.viewport.rect.expect("viewport");+ let original_controls = h.app.viewport.layout.clone().expect("layout");+ h.call("ui.agent_chat", serde_json::json!({"open":true,"picker":false,"side":side,"width":440}));+ h.frames(6);+ let card = crate::scenario::rect_of("agent_chat:panel").expect("floating Assistant");+ assert_eq!(h.app.viewport.rect, Some(projection), "opening the card preserves projection");+ assert!(card.left() > projection.left() && card.right() < projection.right());+ assert!(card.bottom() < projection.bottom());+ let content = h.app.shell.content.expect("content");+ assert!((card.top() - content.top()).abs() < 1.0, "full-height top: {card:?} {content:?}");+ assert!((card.bottom() - content.bottom()).abs() < 1.0, "full-height bottom: {card:?} {content:?}");+ assert!(covered(&h.app, card.center()), "chat shields viewport input");+ if side == "right" {+ let layout = h.app.viewport.layout.as_ref().expect("layout");+ assert!(!card.intersect(layout.axis_view).is_positive(), "card clears compass");+ assert!(!card.intersect(layout.navigation).is_positive(), "card clears navigation");+ assert!(layout.axis_view.right() < original_controls.axis_view.right(), "compass moves left");+ assert!(layout.navigation.center().x < original_controls.navigation.center().x, "navigation moves left");+ } else {+ let browser = h.app.shell.browser.expect("browser card");+ assert!(card.right() < browser.left(), "left Assistant precedes browser");+ assert!((card.top() - browser.top()).abs() < 1.0, "Assistant and browser share the top margin");+ }+ let camera = h.app.cam;+ let at = card.center();+ h.call("ui.move", json!({"x":at.x,"y":at.y}));+ h.call("ui.scroll", json!({"x":at.x,"y":at.y,"delta":120}));+ h.call("ui.drag", json!({"x0":at.x,"y0":at.y,"x1":at.x-30.0,"y1":at.y+15.0,"button":"middle","steps":6}));+ assert_eq!(h.app.cam, camera, "chat consumes wheel and orbit input");+ assert!(h.app.viewport.boxsel.is_none());+ h.app.start("solid.extrude");+ h.frames(5);+ let feature = h.app.viewport.dialog_rect.expect("feature panel");+ let beside = crate::scenario::rect_of("agent_chat:panel").expect("Assistant beside feature");+ assert!(!beside.intersect(feature).is_positive(), "feature and Assistant coexist: {beside:?} {feature:?}");+ assert!(+ (beside.min - card.min).length() < 1.0 && (beside.max - card.max).length() < 1.0,+ "opening a tool must not move Assistant: {card:?} -> {beside:?}"+ );+ if side == "right" {+ assert!(feature.right() + SHELL_GAP <= beside.left() + 1.0, "tool stays inside Assistant's rail");+ }+ h.app.dialog = None;+ h.app.tool = None;+ h.frames(3);+ h.call("ui.agent_chat", serde_json::json!({"minimized":true}));+ h.frames(4);+ let folded = crate::scenario::rect_of("agent_chat:panel").expect("floating folded card");+ assert!(folded.width() < 60.0 && folded.height() < 120.0);+ assert!(covered(&h.app, folded.center()));+ assert_eq!(h.app.viewport.rect, Some(projection));+ let folded_controls = h.app.viewport.layout.as_ref().expect("layout");+ assert_eq!(folded_controls.axis_view, original_controls.axis_view);+ if side == "right" {+ assert_eq!(folded_controls.navigation, original_controls.navigation);+ } else {+ let shift = (folded.width() + SHELL_GAP) / 2.0;+ assert!((folded_controls.navigation.center().x - original_controls.navigation.center().x - shift).abs() < 1.0);+ }+ h.call("ui.agent_chat", serde_json::json!({"open":false}));+ h.frames(3);+ assert!(!covered(&h.app, card.center()), "closed chat leaves no stale obstruction");+ }+ }+}++#[test]+fn assistant_left_dock_precedes_history_and_drag_hints_match_the_result() {+ for layout in ["floating", "docked"] {+ for (names, stacked) in [(false, false), (true, false), (true, true)] {+ let mut h = Harness::new();+ h.app.home.open = false;+ h.app.preferences.timeline_left = true;+ h.app.preferences.timeline_under_browser = stacked;+ h.app.preferences.timeline_left_width = crate::ui_kit::history_width(names);+ h.call("ui.resize", json!({"width":1600,"height":1000}));+ h.call("ui.set", json!({"layout":layout}));+ h.call("ui.agent_chat", json!({"open":true,"side":"right","width":440,"picker":false}));+ h.frames(6);+ let projection = h.app.viewport.rect;+ for left in [true, false] {+ let grip = crate::scenario::handle_at("agent_chat:grip").expect("drag grip");+ let target = pos2(if left { 100.0 } else { 1500.0 }, grip.y);+ h.app.synthetic.push(egui::Event::PointerMoved(grip));+ h.frame();+ h.app.synthetic.push(egui::Event::PointerButton {+ pos: grip,+ button: egui::PointerButton::Primary,+ pressed: true,+ modifiers: egui::Modifiers::NONE,+ });+ h.frame();+ h.app.synthetic.push(egui::Event::PointerMoved(target));+ h.frames(2);+ let hint = rect_of("agent_chat:dock_hint").expect("visible dock target");+ h.app.synthetic.push(egui::Event::PointerButton {+ pos: target,+ button: egui::PointerButton::Primary,+ pressed: false,+ modifiers: egui::Modifiers::NONE,+ });+ h.frames(6);+ let card = h.app.agent_chat.panel_rect.expect("docked Assistant");+ assert_eq!(h.app.preferences.agent_chat_side, if left { "left" } else { "right" });+ assert!((hint.min - card.min).length() < 1.0 && (hint.max - card.max).length() < 1.0, "{layout} preview {hint:?} matches {card:?}");+ if layout == "floating" {+ assert_eq!(h.app.viewport.rect, projection, "docking keeps model projection");+ }+ if left {+ let history = h.app.shell.history.expect("vertical history");+ let browser = h.app.shell.browser.expect("browser");+ assert!(card.right() <= history.left(), "Assistant precedes history: {card:?} {history:?}");+ if stacked {+ assert!((history.left() - browser.left()).abs() < 1.0);+ assert!((history.width() - browser.width()).abs() < 1.0);+ assert!(browser.bottom() <= history.top(), "History stays below Browser");+ } else {+ assert!(history.right() <= browser.left(), "history precedes browser");+ }+ }+ }+ h.call("ui.agent_chat", json!({"side":"left","minimized":true}));+ h.frames(6);+ let strip = h.app.agent_chat.drop_rect.expect("minimized Assistant");+ assert!(strip.right() <= h.app.shell.history.expect("history").left());+ h.call("ui.agent_chat", json!({"open":false}));+ h.frames(6);+ assert!(h.app.shell.history.expect("history returns to outer edge").left() < strip.right());+ }+ }+}++#[test]+fn assistant_right_edge_survives_palette_tool_resize_and_minimize() {+ for layout in ["floating", "docked"] {+ let mut h = Harness::new();+ h.app.home.open = false;+ h.call("ui.resize", json!({"width":1800,"height":1000}));+ h.call("ui.set", json!({"layout":layout}));+ h.call("ui.agent_chat", json!({"open":true,"side":"right","width":380,"picker":false}));+ h.frames(5);+ let right = h.app.agent_chat.panel_rect.unwrap().right();+ h.app.run("sketch.create", json!({"plane":"XY"})).unwrap();+ h.frames(6);+ for width in [380.0, 480.0] {+ h.call("ui.agent_chat", json!({"width":width}));+ h.frames(6);+ let chat = h.app.agent_chat.panel_rect.unwrap();+ let palette = h.app.viewport.palette_rect.unwrap();+ assert!((chat.right() - right).abs() < 1.0, "{layout}: Assistant stays outside the palette");+ assert!(+ palette.right() + Container::for_layout(h.app.ui.layout, Surface::Panel).gap() <= chat.left() + 1.0,+ "{layout}: {palette:?}, {chat:?}"+ );+ }+ h.call("ui.agent_chat", json!({"minimized":true}));+ h.frames(5);+ let strip = h.app.agent_chat.drop_rect.unwrap();+ let palette = h.app.viewport.palette_rect.unwrap();+ assert!((strip.right() - right).abs() < 1.0);+ assert!(palette.right() <= strip.left(), "palette clears the minimized Assistant too");+ h.call("ui.agent_chat", json!({"open":false}));+ h.frames(5);+ assert!(h.app.viewport.palette_rect.unwrap().right() > palette.right(), "closing Assistant reclaims its rail");+ }+}++#[test]+fn tool_sheets_drag_over_browser_and_history_but_clear_protected_panels() {+ for side in ["left", "right"] {+ let mut h = Harness::new();+ h.app.home.open = false;+ h.call("ui.resize", json!({"width":1800,"height":1000}));+ h.call("ui.set", json!({"layout":"floating"}));+ h.call("ui.agent_chat", json!({"open":true,"side":side,"width":380,"picker":false}));+ h.frames(5);+ h.app.start("sketch.create");+ h.frames(5);+ let chat = h.app.agent_chat.panel_rect.unwrap();+ let browser = h.app.shell.browser.unwrap();+ let history = h.app.shell.history.unwrap();+ let ribbon = h.app.shell.cards[1];+ let workspace = h.app.shell.cards[0];+ for target in [browser.center(), history.center(), ribbon.center(), workspace.center(), egui::pos2(-1000.0, 400.0), egui::pos2(3000.0, 400.0)]+ {+ let title = crate::scenario::handle_at("dialog:title").unwrap();+ h.call("ui.drag", json!({"x0":title.x,"y0":title.y,"x1":target.x,"y1":target.y,"steps":10}));+ h.frames(4);+ let sheet = h.app.viewport.dialog_rect.unwrap();+ assert!(!sheet.intersect(chat).is_positive(), "{side}: {sheet:?} overlaps Assistant {chat:?}");+ assert!(!sheet.intersect(ribbon).is_positive(), "sheet clears ribbon");+ assert!(!sheet.intersect(workspace).is_positive(), "sheet clears workspace selector");+ if target == browser.center() {+ assert!(sheet.intersect(browser).is_positive(), "sheet can cover Browser");+ let layer = h.ctx.layer_id_at(sheet.intersect(browser).center()).unwrap();+ assert_eq!(layer.id, egui::Id::new(("sc_dialog", "CREATE SKETCH")), "sheet receives input above Browser");+ } else if target == history.center() {+ assert!(sheet.intersect(history).is_positive(), "sheet can cover History");+ }+ }+ h.step(&json!({"widget":"Cancel"})).unwrap();+ assert!(h.app.dialog.is_none(), "dragged sheet remains interactive");+ }+}++#[test]+fn compact_layout_is_saved_and_survives_cancel_apply_defaults_and_bad_input() {+ let mut h = Harness::new();+ h.app.run("solid.box", json!({"length":10,"width":10,"height":10})).unwrap();+ h.app.start("solid.extrude");+ h.settle();+ let design = h.app.session.doc.to_json();+ let undo = h.app.session.undo.len();+ let camera = h.app.cam;+ h.call("ui.prefs", json!({"open":"General"}));+ h.step(&json!({"click":{"handle":"dialog:Workspace layout:Compact"}})).unwrap();+ h.call("ui.prefs", json!({"button":"ok"}));+ h.settle();+ assert!(h.app.dialog.is_some(), "changing layout keeps the active tool");+ assert_eq!(h.app.preferences.layout, LayoutMode::Docked);+ assert_eq!(h.app.ui.layout, LayoutMode::Docked);+ assert_eq!(h.app.cam, camera);+ h.call("engine.execute", json!({"command":"view.layout", "params":{"mode":"compact"}}));+ assert_eq!(h.app.cam, camera, "programmatic layout changes never auto-fit");+ assert_eq!(h.app.session.doc.to_json(), design);+ assert_eq!(h.app.session.undo.len(), undo);+ let mut restored = crate::SolveApp::new(Default::default(), Default::default());+ restored.load_prefs(&h.app.prefs());+ assert_eq!(restored.ui.layout, LayoutMode::Docked);+ assert_eq!(restored.preferences.layout, LayoutMode::Docked);+ h.call("ui.prefs", json!({"open":"General","layout":"floating"}));+ h.call("ui.prefs", json!({"button":"cancel"}));+ assert_eq!(h.app.ui.layout, LayoutMode::Docked);+ h.call("ui.prefs", json!({"open":"General","layout":"floating"}));+ h.call("ui.prefs", json!({"button":"apply"}));+ h.call("ui.prefs", json!({"layout":"compact"}));+ h.call("ui.prefs", json!({"button":"cancel"}));+ assert_eq!(h.app.ui.layout, LayoutMode::Floating);+ h.call("ui.prefs", json!({"open":"General","layout":"compact"}));+ h.call("ui.prefs", json!({"button":"defaults"}));+ assert_eq!(h.app.ui.layout, LayoutMode::Floating);+ assert_eq!(h.app.preferences.layout, LayoutMode::Floating);+ h.call("ui.prefs", json!({"button":"ok"}));+ assert!(crate::prefs::set(&mut h.app, &json!({"layout":"invalid"})).is_err());+ assert_eq!(h.app.ui.layout, LayoutMode::Floating);+ restored.load_prefs(r#"{"preferences":{"layout":"invalid","default_units":"in"}}"#);+ assert_eq!(restored.ui.layout, LayoutMode::Floating);+ assert_eq!(restored.preferences.default_units, "in");+ assert_eq!(crate::prefs::lenient(&json!({})).layout, LayoutMode::Floating);+}++#[test]+fn compact_chrome_is_flush_and_browser_hugs_content_in_both_themes() {+ for dark in [false, true] {+ let mut h = Harness::new();+ h.call("ui.resize", json!({"width":1400,"height":900}));+ h.call("ui.prefs", json!({"layout":"compact"}));+ h.call("ui.set", json!({"dark":dark}));+ h.settle();+ let bar = rect_of("toolbar").unwrap();+ let browser = rect_of("browser:card").unwrap();+ let workspace = rect_of("ribbon:workspace").unwrap();+ assert_eq!(workspace.left(), bar.left());+ assert_eq!(workspace.top(), bar.top());+ assert_eq!(h.app.shell.cards.get(1).unwrap().left(), workspace.right(), "one joined top bar");+ assert_eq!(browser.left(), 0.0);+ assert_eq!(browser.top(), bar.bottom(), "square, flush Browser/ribbon join");+ assert!(browser.height() < h.app.viewport.rect.unwrap().height() / 2.0, "Browser hugs its contents");+ let compact = crate::ui_kit::Container::new(&h.ctx, crate::ui_kit::Surface::Panel);+ assert_eq!(compact.gap(), 0.0);+ let frame = compact.frame(&h.ctx, crate::theme::Tokens::get().panel, crate::frame::Side::Left);+ assert_eq!(frame.shadow, egui::Shadow::NONE);+ assert_eq!(frame.corner_radius, egui::CornerRadius::ZERO);+ h.app.start("solid.extrude");+ h.settle();+ let dialog = h.app.viewport.dialog_rect.unwrap();+ assert!((dialog.right() - h.app.viewport.rect.unwrap().right()).abs() < 1.0, "{dialog:?}");+ let before = dialog;+ h.step(&json!({"drag":[{"handle":"dialog:title"},[700,300]],"steps":6})).unwrap();+ h.settle();+ let moved = h.app.viewport.dialog_rect.unwrap();+ assert!(moved.right() < before.right() - 100.0, "compact tool sheets detach from the right edge");+ let feature = crate::ui_kit::Container::new(&h.ctx, crate::ui_kit::Surface::Feature);+ assert_eq!(feature.frame(&h.ctx, crate::theme::Tokens::get().dialog_body, crate::frame::Side::Right).shadow, egui::Shadow::NONE);+ h.app.run("view.layout", json!({"mode":"floating"})).unwrap();+ h.settle();+ assert_eq!(rect_of("browser:card").unwrap().left(), SHELL_GAP);+ assert!(h.app.dialog.is_some());+ }+}++#[test]+fn two_collapsed_compact_headers_leave_live_viewport_below_their_column() {+ for dark in [false, true] {+ let mut h = Harness::new();+ h.call("ui.resize", json!({"width":1400,"height":900}));+ h.call("ui.prefs", json!({"layout":"compact"}));+ h.call("ui.set", json!({"dark":dark}));+ h.app.run("view.history_layout", json!({"dock":"under_browser"})).unwrap();+ h.app.preferences.timeline_left_browser_collapsed = true;+ h.app.preferences.timeline_collapsed = true;+ h.frames(12);+ let browser = h.app.shell.browser.unwrap();+ let history = h.app.shell.history.unwrap();+ let below = egui::pos2(browser.center().x, history.bottom() + 40.0);+ assert!(h.app.viewport.rect.unwrap().contains(below));+ assert!(!covered(&h.app, below));+ assert!(covered(&h.app, browser.center()));+ assert!(covered(&h.app, history.center()));+ h.call("ui.move", json!({"x":below.x,"y":below.y}));+ assert_eq!(h.app.viewport.mouse, Some(below), "the vacated column remains live viewport");+ }+}++#[test]+fn ribbon_labels_are_saved_independently_and_icon_only_commands_remain_reachable() {+ for mode in [LayoutMode::Floating, LayoutMode::Docked] {+ let mut h = Harness::new();+ h.call("ui.resize", json!({"width":1400,"height":900}));+ h.call("ui.prefs", json!({"layout":mode}));+ h.settle();+ let labelled = rect_of("toolbar").unwrap();+ h.call("ui.prefs", json!({"ribbon_labels":false}));+ h.settle();+ let icons = rect_of("toolbar").unwrap();+ assert!(icons.height() < labelled.height());+ assert_eq!(h.app.ui.layout, mode);+ let command = rect_of("button:sketch.create").unwrap();+ assert!(icons.contains_rect(command));+ h.step(&json!({"click":{"handle":"button:sketch.create"}})).unwrap();+ assert!(h.app.dialog.is_some(), "the icon still starts Create Sketch");+ let mut restored = crate::SolveApp::new(Default::default(), Default::default());+ restored.load_prefs(&h.app.prefs());+ assert!(!restored.preferences.ribbon_labels);+ assert_eq!(restored.ui.layout, mode);+ h.call("ui.prefs", json!({"open":"General","ribbon_labels":true}));+ h.call("ui.prefs", json!({"button":"cancel"}));+ assert!(!h.app.preferences.ribbon_labels);+ }+ assert!(crate::prefs::lenient(&json!({})).ribbon_labels);+}diff --git a/crates/ui-egui/src/shortcut_box.rs b/crates/ui-egui/src/shortcut_box.rsindex 2c7903aeec..7f672672b7 100644--- a/crates/ui-egui/src/shortcut_box.rs+++ b/crates/ui-egui/src/shortcut_box.rs@@ -1,6 +1,7 @@//! Ribbon-anchored command search. Ranking comes from the registry; document results use//! existing feature-edit and parameter commands. JSON mode never starts an interactive tool.+use crate::ui_kit::{Container, Surface};use egui::{Pos2, Rect, pos2, vec2};use serde_json::{Value, json};use solidcraft_engine::command_specs;@@ -355,8 +356,13 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {let mut rows = Vec::new();let mut design = Vec::new();let mut mode = None;- let response =- crate::frame::area(egui::Id::new("sc_sbox")).fixed_pos(pos).order(egui::Order::Foreground).fade_in(false).constrain(false).show(ctx, |ui| {+ let response = Container::new(ctx, Surface::Popup)+ .area(egui::Id::new("sc_sbox"))+ .fixed_pos(pos)+ .order(egui::Order::Foreground)+ .fade_in(false)+ .constrain(false)+ .show(ctx, |ui| {// Area rounds its origin; place the child at the exact interpolated bounds// so the field's right edge does not drift during expansion.ui.scope_builder(egui::UiBuilder::new().max_rect(Rect::from_min_size(pos, vec2(field_size.x, height + field_size.y))), |ui| {@@ -374,7 +380,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {ui_kit::SearchFieldGeometry {height: field_size.y,progress,- radius: ui_kit::CommandSearch::field_radius(progress, app.ui.layout == crate::shell::LayoutMode::Floating),+ radius: ui_kit::CommandSearch::field_radius(progress, ui_kit::Container::new(ctx, ui_kit::Surface::Chrome).floating()),},MAX_QUERY,);diff --git a/crates/ui-egui/src/sketch_attachment_ui.rs b/crates/ui-egui/src/sketch_attachment_ui.rsindex 19217a57a3..101d5f88b7 100644--- a/crates/ui-egui/src/sketch_attachment_ui.rs+++ b/crates/ui-egui/src/sketch_attachment_ui.rs@@ -136,7 +136,7 @@ pub fn panel(app: &mut SolveApp, ctx: &egui::Context) {let mut apply = false;let mut cancel = false;let t = Tokens::get();- let viewport = crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect()));+ let viewport = crate::agent_chat::tool_space(app, crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect())));if !viewport.is_finite() || !viewport.is_positive() {app.tree.redefine_draft = Some(draft);return;@@ -149,13 +149,14 @@ pub fn panel(app: &mut SolveApp, ctx: &egui::Context) {let top = crate::shell::panel_top(app, viewport, viewport.bottom(), side);let docked = egui::pos2(side.anchor_x(viewport), top);let moved = crate::frame::dock_offset(ctx, "sc_redefine");- let anchor = crate::frame::offset_anchor(docked, moved, viewport, side);+ let drag_bounds = crate::shell::tool_drag_rect(app, viewport);+ let anchor = crate::frame::offset_anchor(docked, moved, drag_bounds, side);let frame = ui_kit::Panel::feature_frame(ctx, app.ui.layout, side);let spec = solidcraft_engine::find_command("sketch.redefine");let command = spec.as_ref().map_or("", |s| crate::i18n::tr_label(s.label));let title = crate::i18n::format("sketch_panel.redefine_title", &[("command", command), ("name", name)]);- let panel = ui_kit::Panel::new(&title, egui::Id::new("sc_redefine"), anchor, viewport, side, frame);- let response = panel.window().show(ctx, |ui| {+ let panel = ui_kit::Panel::new(&title, egui::Id::new("sc_redefine"), anchor, drag_bounds, side, frame);+ let response = panel.window(ctx).show(ctx, |ui| {let (closed, action) = panel.feature(ui,ui_kit::FeatureOptions {diff --git a/crates/ui-egui/src/sketch_dims.rs b/crates/ui-egui/src/sketch_dims.rsindex b79ba23c1b..c172d6aacb 100644--- a/crates/ui-egui/src/sketch_dims.rs+++ b/crates/ui-egui/src/sketch_dims.rs@@ -4,6 +4,7 @@//! locks that value; Tab moves to the next box; Enter places the shape with the typed values,//! which become dimension constraints. Values are expressions ("25", "1 in", "d1 * 2").+use crate::ui_kit::{Container, Surface};use egui::{Pos2, vec2};use serde_json::{Value, json};use solidcraft_engine::doc::expr::Kind as ValueKind;@@ -423,23 +424,27 @@ fn boxes(app: &SolveApp, ui: &mut egui::Ui, proj: &Proj, t: &mut Tool) -> Options.store(ui.ctx(), id);}let pos = in_view(sp + vec2(-34.0, -11.0), view, ui.ctx().pointer_latest_pos());- crate::frame::area(egui::Id::new(("sc_dim_area", i))).fixed_pos(pos).order(egui::Order::Foreground).show(ui.ctx(), |ui| {- let fill = if b.locked { tk.accent_soft } else { tk.panel };- egui::Frame::popup(ui.style()).fill(fill).inner_margin(egui::Margin::symmetric(tk.space_3 as i8, 1)).show(ui, |ui| {- let r = crate::ui_kit::placement_field(ui, id, &mut b.value, b.label);- // A completion gets first use of forward Tab. Shift+Tab always moves back;- // the box reached by egui's generic traversal must not complete its text.- let changed = (source.is_none() || (source == Some(i) && tab != Some(true))) && crate::params_dialog::complete(ui, &r, &mut b.value);- completed |= changed && source == Some(i);- if r.changed() || changed {- b.locked = true;- }- if focus && i == 0 {- r.request_focus();- }- any_focused |= r.has_focus() || r.lost_focus();- });- });+ Container::new(ui.ctx(), Surface::Canvas).area(egui::Id::new(("sc_dim_area", i))).fixed_pos(pos).order(egui::Order::Foreground).show(+ ui.ctx(),+ |ui| {+ let fill = if b.locked { tk.accent_soft } else { tk.panel };+ Container::popup_frame(ui.style()).fill(fill).inner_margin(egui::Margin::symmetric(tk.space_3 as i8, 1)).show(ui, |ui| {+ let r = crate::ui_kit::placement_field(ui, id, &mut b.value, b.label);+ // A completion gets first use of forward Tab. Shift+Tab always moves back;+ // the box reached by egui's generic traversal must not complete its text.+ let changed =+ (source.is_none() || (source == Some(i) && tab != Some(true))) && crate::params_dialog::complete(ui, &r, &mut b.value);+ completed |= changed && source == Some(i);+ if r.changed() || changed {+ b.locked = true;+ }+ if focus && i == 0 {+ r.request_focus();+ }+ any_focused |= r.has_focus() || r.lost_focus();+ });+ },+ );}if let Some(source) = source&& !completeddiff --git a/crates/ui-egui/src/sketch_palette.rs b/crates/ui-egui/src/sketch_palette.rsindex 0b27f38134..95f2415492 100644--- a/crates/ui-egui/src/sketch_palette.rs+++ b/crates/ui-egui/src/sketch_palette.rs@@ -237,7 +237,7 @@ fn width(vp: egui::Rect) -> f32 {/// The viewport the palette docks into.fn viewport(app: &SolveApp, ctx: &egui::Context) -> egui::Rect {- crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect()))+ crate::agent_chat::tool_space(app, crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect())))}/// Is a sketch being edited? That is the palette's own condition.@@ -334,10 +334,11 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {if !vp.is_finite() || !vp.is_positive() {return;}- let bottom = vp.bottom().min(ctx.content_rect().bottom()) - crate::shell::SHELL_GAP;+ let gap = crate::ui_kit::Container::new(ctx, crate::ui_kit::Surface::Palette).gap();+ let bottom = vp.bottom().min(ctx.content_rect().bottom()) - gap;let top = crate::shell::panel_top(app, vp, bottom, crate::frame::Side::Right);let frame = crate::ui_kit::Panel::palette_frame(ctx, app.ui.layout);- let anchor = egui::pos2(vp.right() - crate::shell::SHELL_GAP - frame.stroke.width, top + frame.stroke.width);+ let anchor = egui::pos2(vp.right() - gap - frame.stroke.width, top + frame.stroke.width);let shown = |key: &str| match key {"grid" => !opts.hide_grid,"snap" => !opts.no_snap,@@ -370,7 +371,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {frame,).width(width(vp));- let response = panel.window().show(ctx, |ui| {+ let response = panel.window(ctx).show(ctx, |ui| {panel.palette(ui, bottom, top, |ui, part| match part {crate::ui_kit::Part::Header => {let status = if !solved || !geometry || remaining == 0 {diff --git a/crates/ui-egui/src/sketch_tools.rs b/crates/ui-egui/src/sketch_tools.rsindex c3f162241b..a0fc473cf7 100644--- a/crates/ui-egui/src/sketch_tools.rs+++ b/crates/ui-egui/src/sketch_tools.rs@@ -521,20 +521,6 @@ pub fn glyph_positions() -> Vec<(String, Pos2)> {GLYPHS.with(|g| g.borrow().clone())}-/// A click on a constraint glyph selects it (true: the click was used).-pub fn click_glyph(app: &mut SolveApp, _proj: &Proj, pos: Pos2) -> bool {- if app.session.active_sketch.is_none() {- return false;- }- let hit = GLYPHS.with(|g| g.borrow().iter().find(|(_, c)| c.distance(pos) <= GLYPH * 0.6).map(|(id, _)| id.clone()));- let used = hit.is_some();- PICKED.with(|p| *p.borrow_mut() = hit.clone());- if let Some(id) = hit {- app.set_status(format!("Constraint {id} selected: Delete removes it"), false);- }- used-}-/// Delete the selected constraint glyph (true when one was selected).pub fn delete_glyph(app: &mut SolveApp) -> bool {let Some(id) = PICKED.with(|p| p.borrow_mut().take()) else { return false };@@ -1328,7 +1314,7 @@ fn glyphs(app: &SolveApp, painter: &egui::Painter, proj: &Proj, hover: Option<Po}});match pattern_icon.or_else(|| glyph_icon(c.kind.name())) {- Some(icon) => crate::icons::paint(painter, r.shrink(2.0), icon, col, tk.glyph_bg, col),+ Some(icon) => crate::icons::paint_icon(painter, r.shrink(2.0), icon, f32::from(col.a()) / 255.0),None => {painter.text(*sp,diff --git a/crates/ui-egui/src/space_mouse_calibration.rs b/crates/ui-egui/src/space_mouse_calibration.rsindex 06e2b0b3e6..848cdf47e0 100644--- a/crates/ui-egui/src/space_mouse_calibration.rs+++ b/crates/ui-egui/src/space_mouse_calibration.rs@@ -109,11 +109,8 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {Stage::Done => format!("{0} / {0}", STEP_PROMPTS.len()),};let (mut back, mut over, mut cancel, mut save) = (false, false, false, false);- crate::frame::window(ctx, app.tr("ui.space_mouse_calibrate_title"), crate::frame::Width::Normal)- .id(egui::Id::new("sc_space_mouse_calibration"))- .collapsible(false)- .resizable(false)- .show(ctx, |ui| {+ let closed = crate::ui_kit::Window::new(egui::Id::new("sc_space_mouse_calibration"), "settings", app.tr("ui.space_mouse_calibrate_title"))+ .show_body(ctx, |ui| {ui.label(app.tr(prompt));if let Some(axis) = weak {ui.label(egui::RichText::new(app.tr(axis)).strong());@@ -147,7 +144,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {save = matches!(result, Some(Ok(_))) && crate::ui_kit::button(ui, app.tr("ui.save"), crate::ui_kit::Button::Normal).clicked();});});- if cancel {+ if cancel || closed {app.space_mouse.calibrating = None;} else if let Some((device, wizard)) = &mut app.space_mouse.calibrating {wizard.set_dead_zone_share(dead_zone);diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rsindex eae1eb4f85..1edd0455b3 100644--- a/crates/ui-egui/src/theme.rs+++ b/crates/ui-egui/src/theme.rs@@ -215,39 +215,11 @@ pub fn srgb(c: [f32; 3]) -> Color32 {/// the same as when they were literals in the WGSL). The light theme's are the headless default.pub use solidcraft_engine::render::AnalysisColors;-/// The colours icons draw of their own (`icons::paint` takes ink, fill and accent from its-/// caller). Every icon colour is a token so a colour vision mode can reach it.+/// Colours for native viewport markers and the agent pointer. Command artwork uses the SVG palette.#[derive(Clone, Copy, Debug, PartialEq)]pub struct IconColors {- /// Surface sheets: a sheet, a second sheet beside it, a lighter sheet, iso lines and teeth.- pub sheet: Color32,- pub sheet_2: Color32,- pub sheet_light: Color32,- pub sheet_line: Color32,- /// Highlights (and the white ink of markers and the agent pointer), and the sphere's glint.pub highlight: Color32,- pub glint: Color32,- pub folder: Color32,- pub plane: Color32,- pub fold: Color32,- /// Zebra stripes, and the environment map's sky and floor.- pub stripe: Color32,- pub sky: Color32,- pub floor: Color32,- /// Appearance: red, blue and yellow paint dabs.- pub paint: [Color32; 3],- /// Origin: X, Y and Z arrows.- pub axes: [Color32; 3],- /// Accessibility: reachable, blocked. Draft: positive, between. Curvature: flat, middle,- /// tight.- pub access: [Color32; 2],- pub draft: [Color32; 2],- pub curvature: [Color32; 3],- pub interference: Color32,- pub warning: Color32,- /// The pointer an AI agent moves.pub agent: Color32,- /// The dark halo under viewport markers (snap points).pub marker_halo: Color32,}@@ -386,7 +358,6 @@ pub struct Tokens {pub error: Color32,pub warning: Color32,pub icon: Color32,- pub icon_fill: Color32,pub timeline: Color32,pub hover: Color32,// ---- viewport selection feedback ----@@ -462,10 +433,6 @@ pub struct Tokens {pub dialog_bg: Color32,pub dialog_border: Color32,pub chip: Color32,- /// Band behind a panel's heading and, lighter, behind its section headings (both set off- /// from `dialog_bg`).- pub heading_bg: Color32,- pub subheading_bg: Color32,/// Inside of bodies cut by a section.pub section_cap: Color32,/// Closed sketch profiles (translucent fill).@@ -528,8 +495,6 @@ pub struct Tokens {pub continuity: [Color32; 4],pub analysis: AnalysisColors,pub icons: IconColors,- /// The application bar's buttons: ink, fill and accent of their icons.- pub app_bar_icon: [Color32; 3],/// The SolidCraft mark on the application bar: light, mid and dark faces, and its edge.pub logo: [Color32; 4],}@@ -736,14 +701,4 @@ mod tests {}});}-- /// Title and section bands stand out from a dialog, the title more than its sections.- #[test]- fn heading_bands_are_darker_than_the_dialog_in_order() {- let luma = |c: egui::Color32| u32::from(c.r()) * 3 + u32::from(c.g()) * 6 + u32::from(c.b());- for t in [super::Tokens::light(), super::Tokens::dark()] {- assert!(luma(t.heading_bg) < luma(t.subheading_bg), "{t:?}");- assert!(luma(t.subheading_bg) < luma(t.dialog_bg), "{t:?}");- }- }}diff --git a/crates/ui-egui/src/theme_files.rs b/crates/ui-egui/src/theme_files.rsindex 09c4733aae..f102930e91 100644--- a/crates/ui-egui/src/theme_files.rs+++ b/crates/ui-egui/src/theme_files.rs@@ -26,6 +26,33 @@ pub const MAX_COLORS: usize = 512;const MAX_NAME: usize = 80;pub const MAX_CUSTOM: usize = 64;+// Older exports contain colours for retired window bands and procedural icons.+// Discard them at import; they have no token, renderer, or exported setting now.+const RETIRED_COLORS: &[&str] = &[+ "icon_fill",+ "heading_bg",+ "subheading_bg",+ "app_bar_icon",+ "icons.sheet",+ "icons.sheet_2",+ "icons.sheet_light",+ "icons.sheet_line",+ "icons.glint",+ "icons.folder",+ "icons.plane",+ "icons.fold",+ "icons.stripe",+ "icons.sky",+ "icons.floor",+ "icons.paint",+ "icons.axes",+ "icons.access",+ "icons.draft",+ "icons.curvature",+ "icons.interference",+ "icons.warning",+];+/// The palette a theme starts from.#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "lowercase")]@@ -53,15 +80,15 @@ pub struct ThemeFile {/// The settable colours: a key, and where it lives in [`Tokens`]. `one` keys take a colour,/// `many` keys a list of exactly as many colours as the token has; `icons.*` are the colours-/// icons draw of their own. The destructuring below fails to build when a token is added+/// viewport glyphs draw of their own. The destructuring below fails to build when a token is added/// without a key here, so every colour stays themeable.macro_rules! theme_keys {(one: [$($one:ident),* $(,)?], many: [$($many:ident),* $(,)?],- icons_one: [$($ione:ident),* $(,)?], icons_many: [$($imany:ident),* $(,)?] $(,)?) => {+ icons: [$($ione:ident),* $(,)?] $(,)?) => {/// Every key a theme file may set, in the order an export writes them.pub fn keys() -> Vec<&'static str> {let mut k = vec![$(stringify!($one),)* $(stringify!($many),)*];- k.extend([$(concat!("icons.", stringify!($ione)),)* $(concat!("icons.", stringify!($imany)),)*]);+ k.extend([$(concat!("icons.", stringify!($ione)),)*]);k}@@ -70,7 +97,6 @@ macro_rules! theme_keys {$(stringify!($one) => Some(std::slice::from_mut(&mut t.$one)),)*$(stringify!($many) => Some(&mut t.$many[..]),)*$(concat!("icons.", stringify!($ione)) => Some(std::slice::from_mut(&mut t.icons.$ione)),)*- $(concat!("icons.", stringify!($imany)) => Some(&mut t.icons.$imany[..]),)*_ => None,}}@@ -91,7 +117,7 @@ macro_rules! theme_keys {form_checkbox_height: _, form_button_height: _, sketch_palette_width: _, sketch_mode_size: _, sketch_mode_radius: _, sketch_mode_border: _,sketch_palette_alpha: _, sketch_mode_tint: _, sketch_footer_icon_size: _, font_section_tracking: _,} = t;- let IconColors { $($ione: _,)* $($imany: _,)* } = &t.icons;+ let IconColors { $($ione: _,)* } = &t.icons;}};}@@ -99,12 +125,12 @@ macro_rules! theme_keys {theme_keys! {one: [app_bar, toolbar, panel, panel_header, border, text, text_dim, accent, accent_soft, sketch_accent, error, warning,- icon, icon_fill, timeline, hover, sel_face, sel_edge, sel_edge_rim, hover_edge, hover_edge_halo, sel_profile,+ icon, timeline, hover, sel_face, sel_edge, sel_edge_rim, hover_edge, hover_edge_halo, sel_profile,sel_profile_edge, hover_profile, hover_profile_edge, sel_vertex, origin_plane, origin_plane_edge, origin_plane_hover,origin_point, axis_x, axis_y, axis_z, construction_plane, construction_geom, body, body_edge, manipulator,preview_add, preview_new, preview_sketch, preview_cut, cube_face, cube_border, cube_text, cube_hover, viewport_top,viewport_bottom, grid, grid_major, body_selected, sketch, sketch_fixed, sketch_locked, dimension, dimension_driven,- sketch_point, sketch_point_free, dialog_bg, dialog_border, chip, heading_bg, subheading_bg, section_cap,+ sketch_point, sketch_point_free, dialog_bg, dialog_border, chip, section_cap,profile_fill, glyph_bg, glyph_edge, glyph_text, overlay, rubber_band, app_bar_text, app_bar_hover, timeline_item,timeline_item_error, timeline_marker, field, box_window, box_crossing, sketch_projected, sketch_lost,sketch_construction, sketch_centerline, bend_up, bend_down, interference,@@ -113,12 +139,8 @@ theme_keys! {app_bar_hover_button, app_bar_hover_strong, app_bar_tab_active,form_ink, form_dim, form_primary, form_error, form_error_fill, form_success, form_success_fill, dialog_body, dialog_footer, dialog_rule, control_fill, control_border, dialog_label, selected_ink, selected_bg,],- many: [triad, gizmo, continuity, app_bar_icon, logo],- icons_one: [- sheet, sheet_2, sheet_light, sheet_line, highlight, glint, folder, plane, fold, stripe, sky, floor, interference,- warning, agent, marker_halo,- ],- icons_many: [paint, axes, access, draft, curvature],+ many: [triad, gizmo, continuity, logo],+ icons: [highlight, agent, marker_halo],}/// `#rrggbb` or `#rrggbbaa` (alpha not premultiplied).@@ -172,7 +194,7 @@ pub fn from_value(v: &Value) -> Result<ThemeFile, String> {Some("light") => Base::Light,_ => return Err("`base` must be \"dark\" or \"light\"".into()),};- let src = match v.get("colors") {+ let mut src = match v.get("colors") {None => serde_json::Map::new(),Some(Value::Object(o)) => o.clone(),Some(_) => return Err("`colors` must be an object of colour names and values".into()),@@ -180,6 +202,7 @@ pub fn from_value(v: &Value) -> Result<ThemeFile, String> {if src.len() > MAX_COLORS {return Err(format!("`colors` has more than {MAX_COLORS} entries"));}+ src.retain(|key, _| !RETIRED_COLORS.contains(&key.as_str()));let mut probe = Tokens::light();let mut bad = Vec::new();for (k, c) in &src {@@ -307,16 +330,6 @@ mod tests {}}- /// Title and section bands stand out from a dialog in every built-in theme, as in Dark and- /// Light (`heading_bands_are_darker_than_the_dialog_in_order`).- #[test]- fn built_in_themes_keep_heading_bands_in_order() {- let luma = |c: Color32| u32::from(c.r()) * 3 + u32::from(c.g()) * 6 + u32::from(c.b());- for t in builtin().iter().map(resolve) {- assert!(luma(t.heading_bg) < luma(t.subheading_bg) && luma(t.subheading_bg) < luma(t.dialog_bg), "{t:?}");- }- }-#[test]fn a_short_file_sets_only_its_colours() {let t = parse(r##"{"format":"solidcraft-theme/1","name":"My Theme!","base":"light","colors":{"panel":"#102030","triad":["#ff0000","#00ff00","#0000ff80"]}}"##).unwrap();@@ -327,6 +340,20 @@ mod tests {assert_eq!(p.text, Tokens::light().text);}+ #[test]+ fn older_exports_keep_active_overrides_without_retired_ui_settings() {+ let mut file = export("Older theme", Base::Dark, &Tokens::dark());+ let colors = file.get_mut("colors").and_then(Value::as_object_mut).unwrap();+ colors.insert("panel".into(), json!("#102030"));+ for key in RETIRED_COLORS {+ colors.insert((*key).into(), json!("#abcdef"));+ }+ let imported = from_value(&file).unwrap();+ assert_eq!(resolve(&imported).panel, Color32::from_rgb(0x10, 0x20, 0x30));+ assert_eq!(imported.colors.len(), keys().len());+ assert!(RETIRED_COLORS.iter().all(|key| !imported.colors.contains_key(*key)));+ }+#[test]fn bad_files_are_refused_naming_every_bad_key() {let ok = r#""format":"solidcraft-theme/1","name":"x","base":"dark""#;diff --git a/crates/ui-egui/src/timeline.rs b/crates/ui-egui/src/timeline.rsindex 03f82296fe..9002faa9ce 100644--- a/crates/ui-egui/src/timeline.rs+++ b/crates/ui-egui/src/timeline.rs@@ -1,6 +1,7 @@//! The timeline (bottom): features in order, the rollback marker, errors and warnings.-use egui::{Rect, Sense, Stroke, UiBuilder, pos2, vec2};+use crate::ui_kit::{Container, Edge, Surface};+use egui::{Rect, Sense, UiBuilder, pos2, vec2};use serde_json::{Value, json};use solidcraft_engine::doc::{FeatureKind, PlaneRef, SketchId,@@ -270,7 +271,7 @@ fn toggle_feature(app: &mut SolveApp, id: u64) {pub fn timeline(app: &mut SolveApp, ui: &mut egui::Ui) {let t = Tokens::get();app.shell.history_dock_space = Some(ui.available_rect_before_wrap());- if app.ui.layout == crate::shell::LayoutMode::Floating {+ if Container::for_layout(app.ui.layout, Surface::Panel).floating() {let rect = floating_rect(ui.available_rect_before_wrap());// A window too short for the card (the ribbon already fills it) leaves the history out// rather than drawing into a negative-size rectangle.@@ -281,13 +282,17 @@ pub fn timeline(app: &mut SolveApp, ui: &mut egui::Ui) {app.shell.history = Some(rect);crate::scenario::publish_rect("history:card", rect);let mut child = ui.new_child(UiBuilder::new().id_salt("sc_timeline").max_rect(rect));- ui.painter().add(crate::frame::shell_card(t.timeline).paint(rect));+ ui.painter().add(Container::new(ui.ctx(), Surface::Panel).frame(ui.ctx(), t.timeline, crate::frame::Side::Left).paint(rect));child.set_clip_rect(rect);timeline_contents(app, &mut child, true);} else {- let response = egui::Panel::bottom("sc_timeline").exact_size(40.0).frame(egui::Frame::NONE.fill(t.timeline)).show(ui, |ui| {- timeline_contents(app, ui, false);- });+ let response = Container::new(ui.ctx(), Surface::Panel)+ .edge("sc_timeline", Edge::Bottom)+ .exact_size(40.0)+ .frame(Container::new(ui.ctx(), Surface::Panel).edge_frame(t.timeline))+ .show(ui, |ui| {+ timeline_contents(app, ui, false);+ });app.shell.history = Some(response.response.rect);crate::scenario::publish_rect("history:strip", response.response.rect);}@@ -304,9 +309,7 @@ fn timeline_contents(app: &mut SolveApp, ui: &mut egui::Ui, floating: bool) {let accent = crate::theme::TabAccent::for_tab(&t, &app.ui.tab);let r = ui.max_rect();let p = ui.painter().clone();- if !floating {- p.line_segment([r.left_top(), r.right_top()], Stroke::new(1.0, t.border));- }+let n = app.session.doc.features.len();let marker = app.session.doc.marker.unwrap_or(n);// Playback controls.diff --git a/crates/ui-egui/src/timeline_left.rs b/crates/ui-egui/src/timeline_left.rsindex 50f0232e9a..3c5cd080d1 100644--- a/crates/ui-egui/src/timeline_left.rs+++ b/crates/ui-egui/src/timeline_left.rs@@ -1,5 +1,6 @@//! The left feature-history panel: named rows, folders, rollback and drag-and-drop.+use crate::ui_kit::{Container, Edge, Surface};use egui::{Rect, Sense, Stroke, pos2, vec2};use serde_json::json;@@ -133,9 +134,10 @@ fn column_rects(app: &SolveApp, available: Rect, browser_collapsed: bool, histor}fn column_rects_at(app: &SolveApp, available: Rect, browser_fold: f32, history_fold: f32) -> (Rect, Rect) {- let gap = crate::shell::SHELL_GAP;- let top_gap = if app.ui.layout == crate::shell::LayoutMode::Docked { gap } else { 0.0 };- let column = crate::browser::floating_bounds(available, None, crate::browser::browser_width(app.preferences.browser_width), top_gap);+ let mut available = available;+ available.min.x += crate::agent_chat::left_inset(app, available);+ let gap = Container::for_layout(app.ui.layout, Surface::Panel).gap();+ let column = crate::browser::panel_bounds(available, None, crate::browser::browser_width(app.preferences.browser_width), gap);if !app.ui.show_browser {let height = egui::lerp(column.height()..=header_outer_height().min(column.height()), history_fold);let history = Rect::from_min_size(column.min, vec2(column.width(), height));@@ -156,9 +158,8 @@ pub(crate) fn floating_rect(app: &SolveApp, available: Rect) -> Rect {if stacked(app) {return stacked_rects(app, available).1;}- let gap = crate::shell::SHELL_GAP;- let top_gap = if app.ui.layout == crate::shell::LayoutMode::Docked { gap } else { 0.0 };- let min = pos2((available.left() + gap).min(available.right()), (available.top() + top_gap).min(available.bottom()));+ let gap = Container::for_layout(app.ui.layout, Surface::Panel).gap();+ let min = pos2((available.left() + crate::agent_chat::left_inset(app, available) + gap).min(available.right()), available.top());Rect::from_min_max(min, pos2((min.x + strip_width(app)).min((available.right() - gap).max(min.x)), (available.bottom() - gap).max(min.y)))}@@ -167,26 +168,31 @@ pub fn left_panel(app: &mut SolveApp, ui: &mut egui::Ui) {let t = Tokens::get();let available = ui.available_rect_before_wrap();app.shell.history_dock_space = Some(available);- if app.ui.layout == crate::shell::LayoutMode::Floating || stacked(app) {+ if Container::for_layout(app.ui.layout, Surface::Panel).floating() || stacked(app) {let bounds = floating_rect(app, available);app.shell.history = None;if !bounds.is_finite() || bounds.width() < crate::ui_kit::history_width(false) || bounds.height() < t.control_height {return;}- let frame = crate::frame::shell_card(t.panel).inner_margin(t.space_4);+ let container = Container::new(ui.ctx(), Surface::Panel).joined(crate::ui_kit::DockEdges { left: true, top: true, ..Default::default() });+ let frame = container.frame(ui.ctx(), t.panel, crate::frame::Side::Left).inner_margin(t.space_4);let inner = (bounds.size() - frame.total_margin().sum()).max(egui::Vec2::ZERO);- let card = crate::frame::area(egui::Id::new("sc_timeline_left_card")).fixed_pos(bounds.min).order(egui::Order::Middle).show(ui.ctx(), |ui| {- let response = frame.show(ui, |ui| {- ui.set_min_size(inner);- ui.set_max_size(inner);- ui.set_clip_rect(ui.clip_rect().intersect(Rect::from_min_size(ui.max_rect().min, inner)));- left_timeline(app, ui);+ let card = Container::new(ui.ctx(), Surface::Panel)+ .area(egui::Id::new("sc_timeline_left_card"))+ .fixed_pos(bounds.min)+ .order(egui::Order::Middle)+ .show(ui.ctx(), |ui| {+ let response = container.show_frame(ui, frame, available, |ui| {+ ui.set_min_size(inner);+ ui.set_max_size(inner);+ ui.set_clip_rect(ui.clip_rect().intersect(Rect::from_min_size(ui.max_rect().min, inner)));+ left_timeline(app, ui);+ });+ if stacked(app) {+ let width = crate::browser::browser_width(app.preferences.browser_width);+ crate::browser::resize_column(app, ui, response.response.rect, width, "left-history-rail");+ }});- if stacked(app) {- let width = crate::browser::browser_width(app.preferences.browser_width);- crate::browser::resize_column(app, ui, response.response.rect, width, "left-history-rail");- }- });app.shell.history = Some(card.response.rect);crate::scenario::publish_rect("history:vertical", card.response.rect);if !stacked(app) {@@ -197,10 +203,11 @@ pub fn left_panel(app: &mut SolveApp, ui: &mut egui::Ui) {if width < crate::ui_kit::history_width(false) {return;}- let response = egui::Panel::left("sc_timeline_left")+ let response = Container::new(ui.ctx(), Surface::Panel)+ .edge("sc_timeline_left", Edge::Left).exact_size(width).resizable(false)- .frame(egui::Frame::NONE.fill(t.panel).inner_margin(t.space_4))+ .frame(Container::new(ui.ctx(), Surface::Panel).edge_frame(t.panel).inner_margin(t.space_4)).show(ui, |ui| left_timeline(app, ui));crate::scenario::publish_rect("history:vertical", response.response.rect);app.shell.history = Some(response.response.rect);@@ -216,23 +223,26 @@ fn names_fit(width: f32) -> bool {fn seam_handle(app: &mut SolveApp, ui: &mut egui::Ui, card: Rect) {let seam = crate::ui_kit::HistorySeam::new(card);let bounds = seam.edge.union(seam.pill);- crate::frame::area(egui::Id::new("history_seam_overlay")).order(egui::Order::Foreground).fixed_pos(bounds.min).show(ui.ctx(), |ui| {- ui.set_min_size(bounds.size());- ui.set_clip_rect(ui.ctx().content_rect());- let result = crate::ui_kit::history_seam(ui, card, card.width() >= crate::ui_kit::history_width(true));- if let Some(width) = result.width {- app.shell.history_drag_width = Some(width);- ui.ctx().request_repaint();- if result.released {- let _ = app.run("view.history_layout", json!({"width": width}));- app.shell.history_drag_width = None;+ Container::new(ui.ctx(), Surface::Canvas).area(egui::Id::new("history_seam_overlay")).order(egui::Order::Foreground).fixed_pos(bounds.min).show(+ ui.ctx(),+ |ui| {+ ui.set_min_size(bounds.size());+ ui.set_clip_rect(ui.ctx().content_rect());+ let result = crate::ui_kit::history_seam(ui, card, card.width() >= crate::ui_kit::history_width(true));+ if let Some(width) = result.width {+ app.shell.history_drag_width = Some(width);+ ui.ctx().request_repaint();+ if result.released {+ let _ = app.run("view.history_layout", json!({"width": width}));+ app.shell.history_drag_width = None;+ }+ } else if result.toggle {+ let width = crate::ui_kit::history_width(card.width() < crate::ui_kit::history_width(true));+ let _ = app.run("view.history_layout", json!({"width":width}));+ ui.ctx().request_repaint();}- } else if result.toggle {- let width = crate::ui_kit::history_width(card.width() < crate::ui_kit::history_width(true));- let _ = app.run("view.history_layout", json!({"width":width}));- ui.ctx().request_repaint();- }- });+ },+ );}/// Width alone chooses icons, names, horizontal transport and the optional title.@@ -363,7 +373,7 @@ pub(crate) fn dock_drag(app: &mut SolveApp, ui: &egui::Ui, drag: &egui::Responseif let Some(target) = target {let zone = match target {Dock::Bottom => {- if app.ui.layout == crate::shell::LayoutMode::Floating {+ if Container::for_layout(app.ui.layout, Surface::Panel).floating() {crate::timeline::floating_rect(available)} else {Rect::from_min_max(pos2(available.left(), (available.bottom() - 40.0).max(available.top())), available.max)@@ -371,7 +381,7 @@ pub(crate) fn dock_drag(app: &mut SolveApp, ui: &egui::Ui, drag: &egui::Response}Dock::Left => {let mut rect = available;- let gap = if app.ui.layout == crate::shell::LayoutMode::Floating { crate::shell::SHELL_GAP } else { 0.0 };+ let gap = if Container::for_layout(app.ui.layout, Surface::Panel).floating() { crate::shell::SHELL_GAP } else { 0.0 };rect.min.x += gap;rect.max.x = (rect.left() + strip_width(app)).min(available.right() - gap);rect.max.y -= gap;@@ -845,7 +855,7 @@ fn vertical_group_row(let centre = pos2(rect.left() + 9.0 + offset, rect.center().y);crate::ui_kit::disclosure(ui.painter(), centre, open, t.text_dim);let icon = Rect::from_center_size(pos2(rect.left() + 27.5 + offset, rect.center().y), vec2(17.0, 17.0));- icons::paint(ui.painter(), icon, "folder", t.icon, t.icon_fill, t.accent);+ icons::paint_icon(ui.painter(), icon, "folder", f32::from(t.icon.a()) / 255.0);let renaming = timeline_group_name(app, ui, group, rect, offset, names, &t);crate::scenario::publish_handle(&format!("timeline-folder:{}", group.name), rect.center());let fold_rect = Rect::from_min_max(pos2(rect.left() + offset, rect.top()), pos2(rect.left() + offset + 18.0, rect.bottom()));@@ -1235,7 +1245,7 @@ mod tests {let history = h.app.shell.history.unwrap();assert!((browser.width() - history.width()).abs() < 1.0);assert!((browser.height() - history.height()).abs() < 1.0);- assert!(browser.bottom() < history.top());+ assert!((history.top() - browser.bottom() - Container::for_layout(mode, Surface::Panel).gap()).abs() < 1.0);let at = handle_at("history:collapse").unwrap();h.call("ui.click", json!({"x":at.x,"y":at.y}));h.frames(5);@@ -1250,7 +1260,7 @@ mod tests {let folded_history = h.app.shell.history.unwrap();assert!(folded_browser.height() <= header_outer_height() + 1.0);assert!(folded_history.height() <= header_outer_height() + 1.0);- assert!((folded_history.top() - folded_browser.bottom() - crate::shell::SHELL_GAP).abs() < 1.0);+ assert!((folded_history.top() - folded_browser.bottom() - Container::for_layout(mode, Surface::Panel).gap()).abs() < 1.0);let at = handle_at("history:collapse").unwrap();h.call("ui.click", json!({"x":at.x,"y":at.y}));h.frames(5);@@ -1532,7 +1542,10 @@ mod tests {h.settle();let history = crate::scenario::rect_of("history:vertical").unwrap();let browser = crate::scenario::rect_of("browser:card").unwrap();- assert!(history.right() < browser.left(), "{mode:?}, names={names}, collapsed={collapsed}: {history:?}, {browser:?}");+ assert!(+ (browser.left() - history.right() - Container::for_layout(mode, Surface::Panel).gap()).abs() < 1.0,+ "{mode:?}, names={names}, collapsed={collapsed}: {history:?}, {browser:?}"+ );assert_eq!(history.width(), crate::ui_kit::history_width(names));assert_eq!(handle_at("row:Untitled").is_none(), collapsed);let folder = handle_at("timeline-folder:Housing").unwrap();@@ -1608,11 +1621,8 @@ mod tests {harness.app.preferences.browser_float = false;harness.frames(4);assert!(crate::scenario::rect_of("browser:float").is_none(), "the explicit overlay is off");- assert_eq!(crate::scenario::rect_of("browser:card").is_some(), mode == crate::shell::LayoutMode::Floating);- assert_eq!(- harness.app.viewport.rect.unwrap().left(),- if mode == crate::shell::LayoutMode::Docked { harness.app.preferences.browser_width } else { 0.0 }- );+ assert!(crate::scenario::rect_of("browser:card").is_some());+ assert_eq!(harness.app.viewport.rect.unwrap().left(), 0.0);assert!(handle_at("left-browser-rail").is_some(), "both card and sidebar resize");}}diff --git a/crates/ui-egui/src/tool_modifiers.rs b/crates/ui-egui/src/tool_modifiers.rsindex 10f0e3cba5..c91662f1ed 100644--- a/crates/ui-egui/src/tool_modifiers.rs+++ b/crates/ui-egui/src/tool_modifiers.rs@@ -7,7 +7,7 @@//! so that neither gizmo nor canvas needs access to application state.//!//! Strategy: bindings name a chord; call sites ask whether the chord matches the-//! held keys (`held` / `matches_exact`) instead of reading `Modifiers` fields+//! held keys (`held` / `matches`) instead of reading `Modifiers` fields//! directly. Platform primary is Ctrl on Windows/Linux and Cmd on macOS; the//! physical Ctrl key on macOS is never treated as primary.@@ -104,11 +104,6 @@ impl ModifierCombo {}}- /// True if **exactly** these modifiers (and no others) are held.- pub fn matches_exact(self, m: Modifiers) -> bool {- self.matches(Held::from_modifiers(m), Match::Exact)- }-/// True if **at least** these modifiers are held (subset / "held" match).pub fn held(self, m: Modifiers) -> bool {self.matches(Held::from_modifiers(m), Match::AtLeast)@@ -143,16 +138,9 @@ impl ModifierCombo {/// Combos offered by the sketch snap-suppress picker (classic OR first).pub const SNAP_SUPPRESS_CHOICES: [Self; 4] = [Self::CTRL_ALT, Self::CTRL, Self::ALT, Self::SHIFT];-- /// All single-key combos, in display order (for a picker widget).- pub const SINGLE_KEYS: [Self; 3] = [Self::CTRL, Self::ALT, Self::SHIFT];}/// "Ctrl/Cmd" on Windows/Linux, "Cmd" on macOS.-pub fn ctrl_name() -> &'static str {- ctrl_name_for(Platform::host())-}-pub fn ctrl_name_for(platform: Platform) -> &'static str {match platform {Platform::Mac => "Cmd",@@ -161,10 +149,6 @@ pub fn ctrl_name_for(platform: Platform) -> &'static str {}/// "Alt" on Windows/Linux, "Option" on macOS.-pub fn alt_name() -> &'static str {- alt_name_for(Platform::host())-}-pub fn alt_name_for(platform: Platform) -> &'static str {match platform {Platform::Mac => "Option",@@ -500,9 +484,9 @@ mod tests {#[test]fn exact_match_requires_no_extra_keys() {let ctrl = ModifierCombo::CTRL;- assert!(ctrl.matches_exact(mods(false, true, false)));- assert!(!ctrl.matches_exact(mods(true, true, false)), "extra shift must fail");- assert!(!ctrl.matches_exact(mods(false, false, false)));+ assert!(ctrl.matches(Held::from_modifiers(mods(false, true, false)), Match::Exact));+ assert!(!ctrl.matches(Held::from_modifiers(mods(true, true, false)), Match::Exact), "extra shift must fail");+ assert!(!ctrl.matches(Held::from_modifiers(mods(false, false, false)), Match::Exact));}#[test]@@ -526,7 +510,7 @@ mod tests {let ctrl = ModifierCombo::CTRL;let cmd_mods = Modifiers { command: true, ..Default::default() };assert!(ctrl.held(cmd_mods), "Cmd on macOS should match a ctrl binding");- assert!(ctrl.matches_exact(cmd_mods), "exact match also normalises command");+ assert!(ctrl.matches(Held::from_modifiers(cmd_mods), Match::Exact), "exact match also normalises command");}#[test]diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rsindex dd985f75be..e9f0ec7495 100644--- a/crates/ui-egui/src/toolbar.rs+++ b/crates/ui-egui/src/toolbar.rs@@ -2,6 +2,7 @@use crate::fonts::RichTextExt as _;use crate::icons::glyphs::pin_icon;+use crate::ui_kit::{Container, Edge, Surface};use egui::{Align2, Color32, FontId, Rect, Sense, Stroke, pos2, vec2};use serde_json::json;@@ -99,6 +100,13 @@ pub const GROUP_HEIGHT: f32 = 86.0;pub const RIBBON_HEIGHT: f32 = TAB_ROW_HEIGHT + GROUP_HEIGHT + 1.0;pub(crate) const WORKSPACE_WIDTH: f32 = 88.0;const BUTTON_HEIGHT: f32 = 60.0;+const ICON_BUTTON_HEIGHT: f32 = 36.0;+const ICON_GROUP_HEIGHT: f32 = 62.0;++/// The same height drives shell reservations and ribbon painting in either layout.+pub(crate) fn ribbon_height(labels: bool) -> f32 {+ if labels { RIBBON_HEIGHT } else { TAB_ROW_HEIGHT + ICON_GROUP_HEIGHT + 1.0 }+}const BUTTON_GAP: f32 = 3.0;const BUTTON_MIN_WIDTH: f32 = 54.0;const BUTTON_MAX_WIDTH: f32 = 76.0;@@ -271,7 +279,9 @@ pub const APP_BAR_HEIGHT: f32 = 34.0;pub fn app_bar(app: &mut SolveApp, ui: &mut egui::Ui) {let t = Tokens::get();- egui::Panel::top("sc_appbar").exact_size(APP_BAR_HEIGHT).show_separator_line(false).frame(egui::Frame::NONE.fill(t.app_bar)).show(ui, |ui| {+ let app_bar = Container::new(ui.ctx(), Surface::ApplicationBar).edge("sc_appbar", Edge::Top);+ let frame = Container::new(ui.ctx(), Surface::ApplicationBar).edge_frame(t.app_bar);+ app_bar.exact_size(APP_BAR_HEIGHT).show_separator_line(false).frame(frame).show(ui, |ui| {let r = ui.max_rect();// The bar is the window's title bar: its empty space moves the window.if app.custom_titlebar || app.integrated_titlebar {@@ -474,7 +484,8 @@ fn file_menu(app: &mut SolveApp, ctx: &egui::Context) {return;}let mut close = false;- let resp = crate::frame::area(egui::Id::new("sc_file_area"))+ let resp = Container::new(ctx, Surface::Popup)+ .area(egui::Id::new("sc_file_area")).fixed_pos(pos2(ctx.data(|d| d.get_temp::<f32>(egui::Id::new("sc_file_menu_x"))).unwrap_or(100.0), APP_BAR_HEIGHT)).order(egui::Order::Foreground).show(ctx, |ui| {@@ -797,7 +808,7 @@ fn ribbon_tabs(app: &mut SolveApp, ui: &mut egui::Ui, row: Rect) {let search_width = crate::ui_kit::CommandSearch::closed_width(ui.ctx());// The first tab and the search field sit the same distance from the card's top, left and right// edges, so their outer corners are concentric with the card's corners.- let floating = app.ui.layout == crate::shell::LayoutMode::Floating;+ let floating = Container::for_layout(app.ui.layout, Surface::Panel).floating();let inset = RIBBON_TAB_INSET;let corner = if floating { t.radius_lg.saturating_sub(inset as u8).max(2) } else { 5 };let search = Rect::from_min_size(pos2(row.right() - search_width - inset, row.top() + inset), vec2(search_width, TAB_ROW_HEIGHT - 2.0 * inset));@@ -900,23 +911,31 @@ fn dropdown_arrow(painter: &egui::Painter, at: egui::Pos2, ink: Color32) {pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {let t = Tokens::get();crate::workspace::sync_context(app);- let floating = app.ui.layout == crate::shell::LayoutMode::Floating;- let cards = crate::shell::Cards::new(ui.available_rect_before_wrap(), app.ui.layout);- let height = if floating { cards.bottom - ui.available_rect_before_wrap().top() } else { RIBBON_HEIGHT };+ let floating = Container::for_layout(app.ui.layout, Surface::Panel).floating();+ let labels = app.preferences.ribbon_labels;+ let button_height = if labels { BUTTON_HEIGHT } else { ICON_BUTTON_HEIGHT };+ let group_height = if labels { GROUP_HEIGHT } else { ICON_GROUP_HEIGHT };+ let ribbon_height = ribbon_height(labels);+ let gallery_width = if labels { CONSTRAINT_GRID_WIDTH } else { 6.0 * 27.0 };+ let cards = crate::shell::Cards::new(ui.available_rect_before_wrap(), app.ui.layout, ribbon_height);+ let height = if floating { cards.bottom - ui.available_rect_before_wrap().top() } else { ribbon_height };let fill = if floating { Color32::TRANSPARENT } else { t.toolbar };- egui::Panel::top("sc_toolbar").exact_size(height).show_separator_line(false).frame(egui::Frame::NONE.fill(fill)).show(ui, |ui| {- let r = if floating { Rect::from_min_max(cards.workspace.min, cards.ribbon.max) } else { ui.max_rect() };- let ws = if floating { cards.workspace } else { Rect::from_min_size(r.left_top(), vec2(WORKSPACE_WIDTH, RIBBON_HEIGHT - 1.0)) };- let ribbon_left = if floating { cards.ribbon.left() } else { ws.right() + 1.0 };+ let ribbon = Container::new(ui.ctx(), Surface::Chrome).edge("sc_toolbar", Edge::Top);+ let frame = Container::new(ui.ctx(), Surface::Chrome).edge_frame(fill);+ ribbon.exact_size(height).show_separator_line(false).frame(frame).show(ui, |ui| {+ let r = if floating { Rect::from_min_max(cards.workspace.min, cards.ribbon.max) } else { frame.outer_rect(ui.max_rect()) };+ let ws = if floating { cards.workspace } else { Rect::from_min_size(r.left_top(), vec2(WORKSPACE_WIDTH, ribbon_height - 1.0)) };+ let ribbon_left = if floating { cards.ribbon.left() } else { ws.right() };if floating {for card in [ws, cards.ribbon] {- let frame = egui::Frame::NONE.fill(t.toolbar).stroke(Stroke::new(1.0, t.border)).corner_radius(t.radius_lg).shadow(t.shell_shadow());+ let frame = Container::new(ui.ctx(), Surface::Chrome).frame(ui.ctx(), t.toolbar, crate::frame::Side::Left);ui.painter().add(frame.paint(card));// Blank card space owns clicks as well as its buttons.ui.interact(card, ui.id().with(("shell_card", card.left().to_bits())), Sense::click_and_drag());}crate::scenario::publish_rect("ribbon:card", cards.ribbon);}+ app.shell.cards = vec![ws, Rect::from_min_max(pos2(ribbon_left, r.top()), r.max)];let painter = ui.painter().clone();let bg = ui.interact(if floating { cards.ribbon } else { r }, ui.id().with("toolbar_bg"), Sense::click());if bg.secondary_clicked() {@@ -939,13 +958,25 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {}let render = crate::render_workspace::active(app);let workspace_icon = if render { "ws_render" } else { "ws_design" };- icons::paint_icon(&painter, Rect::from_center_size(pos2(ws.center().x, ws.top() + 39.0), vec2(30.0, 30.0)), workspace_icon, 1.0);- ribbon_text(ui, pos2(ws.center().x, ws.top() + 69.0), app.tr(if render { "ui.render" } else { "ui.design" }), t.font_button, t.text, true);+ icons::paint_icon(+ &painter,+ Rect::from_center_size(pos2(ws.center().x, ws.top() + if labels { 39.0 } else { 25.0 }), vec2(30.0, 30.0)),+ workspace_icon,+ 1.0,+ );+ ribbon_text(+ ui,+ pos2(ws.center().x, ws.top() + if labels { 69.0 } else { 50.0 }),+ app.tr(if render { "ui.render" } else { "ui.design" }),+ t.font_button,+ t.text,+ true,+ );let label = app.tr("ui.ribbon_workspace");let label_width =painter.layout_no_wrap(label.to_string(), FontId::proportional(crate::theme::Tokens::get().font_small), t.text_dim).size().x;- ribbon_text(ui, pos2(ws.center().x - 6.0, ws.top() + 89.0), label, t.font_small, t.text_dim, false);- dropdown_arrow(&painter, pos2(ws.center().x - 6.0 + label_width / 2.0 + 7.0, ws.top() + 89.5), t.text_dim);+ ribbon_text(ui, pos2(ws.center().x - 6.0, ws.top() + if labels { 89.0 } else { 70.0 }), label, t.font_small, t.text_dim, false);+ dropdown_arrow(&painter, pos2(ws.center().x - 6.0 + label_width / 2.0 + 7.0, ws.top() + if labels { 89.5 } else { 70.5 }), t.text_dim);if wresp.on_hover_text(app.tr("ui.change_workspace")).clicked() {crate::context_menu::toggle_for(app, ws, ws.left_bottom(), crate::context_menu::Target::Workspace);}@@ -995,11 +1026,16 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {let family = crate::sketch_families::family(c.id).filter(|f| tab == "SKETCH" && *panel == "CREATE" && f.commands.first().copied() == Some(c.id));let label = family.map_or_else(|| crate::workspace::ribbon_button_label(c), |f| f.label);- ButtonSize { width: ribbon_button_width(&painter, app.tr_label(label)), min_width: BUTTON_MIN_WIDTH }+ if labels {+ ButtonSize { width: ribbon_button_width(&painter, app.tr_label(label)), min_width: BUTTON_MIN_WIDTH }+ } else {+ let width = if family.is_some() { 50.0 } else { 40.0 };+ ButtonSize { width, min_width: width }+ }}).collect();if tab == "SKETCH" && *panel == "CONSTRAIN" && shown.iter().any(|c| crate::workspace::CONSTRAINT_GALLERY.contains(&c.id)) {- widths.push(ButtonSize { width: CONSTRAINT_GRID_WIDTH, min_width: CONSTRAINT_GRID_WIDTH });+ widths.push(ButtonSize { width: gallery_width, min_width: gallery_width });}PanelSize { buttons: widths }})@@ -1053,20 +1089,24 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {let inset = if drawn == 0 { 0.0 } else { ((width - 8.0 - buttons_width) / 2.0).max(0.0).floor() };let bx = px + 4.0 + inset;let free_x = bx + buttons_width + BUTTON_GAP;- let free = Rect::from_min_size(pos2(free_x, top + 2.0), vec2((px + width - 4.0 - free_x).max(0.0), BUTTON_HEIGHT));+ let free = Rect::from_min_size(pos2(free_x, top + 2.0), vec2((px + width - 4.0 - free_x).max(0.0), button_height));let fresp = ui.interact(free, ui.id().with(("panel_free", panel)), if collapsed { Sense::click() } else { Sense::hover() });let mut opened = false;if collapsed {// One button: the panel's first command's icon over a caret; it opens the// drop-down, which lists every command of the panel.- let br = Rect::from_center_size(free.center(), vec2((width - 8.0).max(0.0), BUTTON_HEIGHT));+ let br = Rect::from_center_size(free.center(), vec2((width - 8.0).max(0.0), button_height));crate::scenario::publish_handle(&format!("collapsed:{tab}:{panel}"), br.center());if fresp.hovered() && enabled_panel {painter.rect_filled(br, t.radius_sm, t.hover);}if let Some(c) = shown.first().or(cmds.first()) {- let acc = command_accent(c.icon);- icons::paint(&painter, Rect::from_center_size(br.center() - vec2(0.0, 3.0), vec2(26.0, 26.0)), c.icon, t.icon, t.icon_fill, acc);+ icons::paint_icon(+ &painter,+ Rect::from_center_size(br.center() - vec2(0.0, 3.0), vec2(26.0, 26.0)),+ c.icon,+ f32::from(t.icon.a()) / 255.0,+ );}dropdown_arrow(&painter, pos2(br.center().x, br.bottom() - 3.0), t.text_dim);let tip = format!("{} ({})", app.tr_label(panel), shown.len().max(cmds.len()));@@ -1081,11 +1121,15 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {// variants remain exact commands, including in customised toolbars.let family = crate::sketch_families::family(c.id).filter(|f| sketch_create && f.commands.first().copied() == Some(c.id));let selected = family.and_then(|f| app.preferences.sketch_variants.selected(f)).unwrap_or(c);- let whole = Rect::from_min_size(pos2(button_x, top + 2.0), vec2(button_width, BUTTON_HEIGHT));+ let whole = Rect::from_min_size(pos2(button_x, top + 2.0), vec2(button_width, button_height));button_x += button_width + BUTTON_GAP;let mut br = whole;if family.is_some() {- br.max.y = whole.top() + 32.0;+ if labels {+ br.max.y = whole.top() + 32.0;+ } else {+ br.max.x -= 14.0;+ }}let info = selected.info(&app.session);let resp = ui.interact(br, ui.id().with(("cmd", c.id)), Sense::click_and_drag());@@ -1122,7 +1166,8 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {}let icon = if selected.id == "sketch.finish" { "finish" } else { selected.icon };let side = if finish { 30.0 } else { 26.0 };- let icon_rect = Rect::from_center_size(pos2(br.center().x, whole.top() + 16.0), vec2(side, side));+ let icon_rect =+ Rect::from_center_size(pos2(br.center().x, whole.top() + if labels { 16.0 } else { button_height / 2.0 }), vec2(side, side));icons::paint_icon(&painter, icon_rect, icon, if info.enabled { 1.0 } else { 0.35 });let tr_label = app.tr_label(selected.label).to_string();resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled() && info.enabled, &tr_label));@@ -1131,24 +1176,32 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {app.start(id);}if let Some(f) = family {- let ar = Rect::from_min_max(pos2(whole.left(), whole.top() + 30.0), pos2(whole.right(), whole.top() + 48.0));+ let ar = if labels {+ Rect::from_min_max(pos2(whole.left(), whole.top() + 30.0), pos2(whole.right(), whole.top() + 48.0))+ } else {+ Rect::from_min_max(pos2(br.right(), whole.top()), whole.right_bottom())+ };let arrow = ui.interact(ar, ui.id().with(("family", f.label)), Sense::click());crate::scenario::publish_handle(&format!("family:{}", f.label), ar.center());if arrow.hovered() {painter.rect_filled(ar, t.radius_sm, t.hover);}// The title sits on the same line as the other buttons' labels.- let title_y = whole.top() + 39.0;- let galley = ribbon_button_galley(&painter, app.tr_label(f.label), ar.width() - 16.0, t.text);- painter.galley(pos2(ar.center().x - 4.0, title_y - galley.size().y / 2.0), galley, t.text);- dropdown_arrow(&painter, pos2(ar.right() - 6.0, title_y + 0.5), t.text_dim);+ if labels {+ let title_y = whole.top() + 39.0;+ let galley = ribbon_button_galley(&painter, app.tr_label(f.label), ar.width() - 16.0, t.text);+ painter.galley(pos2(ar.center().x - 4.0, title_y - galley.size().y / 2.0), galley, t.text);+ dropdown_arrow(&painter, pos2(ar.right() - 6.0, title_y + 0.5), t.text_dim);+ } else {+ dropdown_arrow(&painter, ar.center(), t.text_dim);+ }arrow.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, app.tr_label(f.label)));- egui::Popup::menu(&arrow).show(|ui| {+ Container::new(ui.ctx(), Surface::Popup).menu(&arrow).show(|ui| {let variants: Vec<_> = f.commands.iter().filter_map(|id| solidcraft_engine::find_command(id)).collect();dropdown_keys(app, ui, &variants);sketch_menu_rows(app, ui, &variants, &mut menu, &mut toggle);});- } else {+ } else if labels {let label = app.tr_label(crate::workspace::ribbon_button_label(selected));let color = if info.enabled { t.text } else { t.text_dim };let galley = ribbon_button_galley(&painter, label, whole.width() - BUTTON_LABEL_PADDING, color);@@ -1159,14 +1212,17 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {if !gallery.is_empty() {// A quiet rule sets the grid apart from the large button before it.painter.line_segment(- [pos2(button_x - 1.5, top + 8.0), pos2(button_x - 1.5, top + 46.0)],+ [pos2(button_x - 1.5, top + 8.0), pos2(button_x - 1.5, top + button_height.min(46.0))],Stroke::new(1.0, t.toolbar.lerp_to_gamma(t.border, 0.5)),);}for c in &gallery {let index = crate::workspace::CONSTRAINT_GALLERY.iter().position(|id| *id == c.id).unwrap_or(0);- let cell =- Rect::from_min_size(pos2(button_x + (index % 3) as f32 * 27.0, top + 6.0 + (index / 3) as f32 * 23.0), vec2(24.0, 20.0));+ let columns = if labels { 3 } else { 6 };+ let cell = Rect::from_min_size(+ pos2(button_x + (index % columns) as f32 * 27.0, top + 6.0 + (index / columns) as f32 * 23.0),+ vec2(24.0, 20.0),+ );let info = c.info(&app.session);let resp = ui.interact(cell, ui.id().with(("cmd", c.id)), Sense::click_and_drag());let active = running.as_deref() == Some(c.id);@@ -1218,7 +1274,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {// RIBBON_TAB_INSET from the card's bottom edge (and from its left edge in the first// section): its corner is concentric with the card's.let lr = Rect::from_min_size(- pos2(px + RIBBON_TAB_INSET, top + GROUP_HEIGHT - SECTION_HEIGHT - (RIBBON_TAB_INSET - 1.0)),+ pos2(px + RIBBON_TAB_INSET, top + group_height - SECTION_HEIGHT - (RIBBON_TAB_INSET - 1.0)),vec2((width - 2.0 * RIBBON_TAB_INSET).max(0.0), SECTION_HEIGHT),);let lresp = ui.interact(lr, ui.id().with(("panel", panel)), Sense::click());@@ -1259,7 +1315,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {let over_button = ui.input(|input| input.pointer.hover_pos()).is_some_and(|p| {let mut x = bx;button_widths.iter().take(drawn).any(|width| {- let rect = Rect::from_min_size(pos2(x, top + 2.0), vec2(*width, BUTTON_HEIGHT));+ let rect = Rect::from_min_size(pos2(x, top + 2.0), vec2(*width, button_height));x += width + BUTTON_GAP;rect.contains(p)})@@ -1275,69 +1331,72 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {let open = ui.ctx().data(|d| d.get_temp::<egui::Id>(egui::Id::new("sc_panel_open"))) == Some(popup_id);if open {let cmds = if collapsed || trimmed { menu_commands(&cmds, &shown) } else { cmds.clone() };- let area = crate::frame::area(popup_id).fixed_pos(lr.left_bottom()).order(egui::Order::Foreground).show(ui.ctx(), |ui| {- section_frame(ui).show(ui, |ui| {- ui.spacing_mut().item_spacing.y = 0.0;- ui.set_min_width(200.0);- if *panel == "SELECT" {- selection_filter(app, ui);- } else if cmds.is_empty() {- ui.label(egui::RichText::new(crate::i18n::tr_label("Not available yet")).color(t.text_dim));- }- if sketch_create {- sketch_create_menu(app, ui, &cmds, &mut menu, &mut toggle);- section_footer(ui);- return;- }- let grouped = crate::workspace::grouped_commands(&tab, panel, &cmds);- let cmds: Vec<_> = grouped.iter().map(|(_, c)| *c).collect();- let row_w = dropdown_width(app, ui, &cmds);- ui.set_width(row_w);- // Up and Down move the keyboard focus through the enabled rows (from none- // focused: the first or the last), instead of egui's own spatial move.- let (down, up) = ui.input(|i| (i.key_pressed(egui::Key::ArrowDown), i.key_pressed(egui::Key::ArrowUp)));- if down || up {- let enabled: Vec<&str> = cmds.iter().filter(|c| c.info(&app.session).enabled).map(|c| c.id).collect();- let focused = ui.ctx().memory(|m| m.focused());- let at = enabled.iter().position(|id| focused == Some(dropdown_row_id(id)));- let n = enabled.len();- let next = match (at, down) {- (None, true) => Some(0),- (None, false) => n.checked_sub(1),- (Some(i), true) => Some((i + 1) % n.max(1)),- (Some(i), false) => Some((i + n.max(1) - 1) % n.max(1)),- };- if let Some(id) = next.and_then(|i| enabled.get(i)) {- ui.ctx().memory_mut(|m| {- m.request_focus(dropdown_row_id(id));- m.move_focus(egui::FocusDirection::None);- });+ let area = Container::new(ui.ctx(), Surface::Popup).area(popup_id).fixed_pos(lr.left_bottom()).order(egui::Order::Foreground).show(+ ui.ctx(),+ |ui| {+ section_frame(ui).show(ui, |ui| {+ ui.spacing_mut().item_spacing.y = 0.0;+ ui.set_min_width(200.0);+ if *panel == "SELECT" {+ selection_filter(app, ui);+ } else if cmds.is_empty() {+ ui.label(egui::RichText::new(crate::i18n::tr_label("Not available yet")).color(t.text_dim));}- }- // The rows scroll when the drop-down would run past the window's bottom.- // `min_scrolled_height` lets the rows grow past the size the area kept from- // an earlier, shorter list (#874); they still shrink to fit their content.- let room = (ui.ctx().content_rect().bottom() - ui.cursor().top() - 64.0).max(ROW_H * 3.0);- egui::ScrollArea::vertical().id_salt("panel_menu_rows").max_height(room).min_scrolled_height(room).show(ui, |ui| {- for (heading, c) in &grouped {- if let Some(heading) = heading {- section_heading(ui, heading, row_w);+ if sketch_create {+ sketch_create_menu(app, ui, &cmds, &mut menu, &mut toggle);+ section_footer(ui);+ return;+ }+ let grouped = crate::workspace::grouped_commands(&tab, panel, &cmds);+ let cmds: Vec<_> = grouped.iter().map(|(_, c)| *c).collect();+ let row_w = dropdown_width(app, ui, &cmds);+ ui.set_width(row_w);+ // Up and Down move the keyboard focus through the enabled rows (from none+ // focused: the first or the last), instead of egui's own spatial move.+ let (down, up) = ui.input(|i| (i.key_pressed(egui::Key::ArrowDown), i.key_pressed(egui::Key::ArrowUp)));+ if down || up {+ let enabled: Vec<&str> = cmds.iter().filter(|c| c.info(&app.session).enabled).map(|c| c.id).collect();+ let focused = ui.ctx().memory(|m| m.focused());+ let at = enabled.iter().position(|id| focused == Some(dropdown_row_id(id)));+ let n = enabled.len();+ let next = match (at, down) {+ (None, true) => Some(0),+ (None, false) => n.checked_sub(1),+ (Some(i), true) => Some((i + 1) % n.max(1)),+ (Some(i), false) => Some((i + n.max(1) - 1) % n.max(1)),+ };+ if let Some(id) = next.and_then(|i| enabled.get(i)) {+ ui.ctx().memory_mut(|m| {+ m.request_focus(dropdown_row_id(id));+ m.move_focus(egui::FocusDirection::None);+ });}- let pinned = crate::toolbar_custom::pinned_on(app, &tab, c.id).is_some();- match dropdown_row(app, ui, c, row_w, pinned) {- RowAction::None => {}- RowAction::Menu(at) => menu = Some((at, c.id)),- RowAction::TogglePin => toggle = Some(c.id),- RowAction::Start => {- app.start(c.id);- ui.ctx().data_mut(|d| d.remove::<egui::Id>(egui::Id::new("sc_panel_open")));+ }+ // The rows scroll when the drop-down would run past the window's bottom.+ // `min_scrolled_height` lets the rows grow past the size the area kept from+ // an earlier, shorter list (#874); they still shrink to fit their content.+ let room = (ui.ctx().content_rect().bottom() - ui.cursor().top() - 64.0).max(ROW_H * 3.0);+ egui::ScrollArea::vertical().id_salt("panel_menu_rows").max_height(room).min_scrolled_height(room).show(ui, |ui| {+ for (heading, c) in &grouped {+ if let Some(heading) = heading {+ section_heading(ui, heading, row_w);+ }+ let pinned = crate::toolbar_custom::pinned_on(app, &tab, c.id).is_some();+ match dropdown_row(app, ui, c, row_w, pinned) {+ RowAction::None => {}+ RowAction::Menu(at) => menu = Some((at, c.id)),+ RowAction::TogglePin => toggle = Some(c.id),+ RowAction::Start => {+ app.start(c.id);+ ui.ctx().data_mut(|d| d.remove::<egui::Id>(egui::Id::new("sc_panel_open")));+ }}}- }+ });+ section_footer(ui);});- section_footer(ui);- });- });+ },+ );popup_rect = Some(area.response.rect);crate::scenario::publish_rect("toolbar_dropdown", area.response.rect);// A drag out of the drop-down ends with a release elsewhere: not a click elsewhere.@@ -1347,11 +1406,11 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {}}px += width;- painter.line_segment([pos2(px, top + 4.0), pos2(px, top + GROUP_HEIGHT - 3.0)], Stroke::new(1.0, t.border));+ painter.line_segment([pos2(px, top + 4.0), pos2(px, top + group_height - 3.0)], Stroke::new(1.0, t.border));px += PANEL_GAP;}if !overflow.is_empty() {- let at = Rect::from_min_size(pos2(px.min(right - finish_width - 40.0), top + 4.0), vec2(38.0, BUTTON_HEIGHT));+ let at = Rect::from_min_size(pos2(px.min(right - finish_width - 40.0), top + 4.0), vec2(38.0, button_height));ui.scope_builder(egui::UiBuilder::new().max_rect(at), |ui| {let response = crate::ui_kit::Menu::button(ui, "»", |ui| {for (panel, cmds) in &overflow {@@ -1379,9 +1438,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {response.response.on_hover_text(crate::i18n::tr_label("More toolbar panels"));});}- if !floating {- painter.line_segment([pos2(r.left(), r.bottom() - 0.5), pos2(r.right(), r.bottom() - 0.5)], Stroke::new(1.0, t.border));- }+// Dragging a command: its icon follows the pointer; a toolbar button dragged off the// toolbar (or into the open drop-down) shows it will be removed.let pointer = ui.input(|i| i.pointer.latest_pos());@@ -1423,58 +1480,20 @@ fn app_bar_separator(ui: &egui::Ui, bar: Rect, x: f32, group: &str) {/// The chat panel's compact entry point. State stays in agent_chat; the bar only paints it.fn assistant_button(app: &mut SolveApp, ui: &mut egui::Ui, at: Rect) {use crate::agent_chat::AssistantMark;- let t = Tokens::get();let resp = ui.interact(at, ui.id().with("assistant_button"), Sense::click());crate::scenario::publish_target("titlebar:assistant", at);let mark = crate::agent_chat::assistant_mark(app);let tip = crate::agent_chat::assistant_tip(mark);resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), &tip));- // The highlight is a 26 px square, like the other icon buttons; the mark sits on the bubble's corner.- let mut ring = t.app_bar;- if app.agent_chat.open || resp.hovered() || resp.has_focus() {- let fill = if app.agent_chat.open { t.app_bar_hover_strong } else { t.app_bar_hover_button };- ui.painter().rect_filled(at.shrink(3.0), t.radius_sm, fill);- ring = t.app_bar.blend(fill);- }- icons::paint_app_bar(ui.painter(), at.shrink(7.0), "assistant", 1.0);- let c = at.min + vec2(23.5, 9.5);- match mark {- AssistantMark::Quiet => {}- AssistantMark::Ready | AssistantMark::NeedsAuth | AssistantMark::Stopped => {- let color = match mark {- AssistantMark::Ready => t.agent_ok,- AssistantMark::NeedsAuth => t.warning,- _ => t.error,- };- ui.painter().circle_filled(c, 5.5, ring);- ui.painter().circle_filled(c, 4.0, color);- }- AssistantMark::Busy => {- let phase = if app.preferences.look_at_anim {- ui.ctx().request_repaint();- ui.input(|i| i.time) as f32 * 3.0- } else {- 0.0- };- ui.painter().circle_filled(c, 6.0, ring);- let points = (0..=24)- .map(|i| {- let angle = phase + i as f32 / 24.0 * std::f32::consts::TAU * 0.75;- c + vec2(angle.cos(), angle.sin()) * 4.0- })- .collect();- ui.painter().add(egui::Shape::line(points, Stroke::new(1.8, t.agent_busy)));- }- AssistantMark::Waiting(count) => {- let text = count.to_string();- let font = FontId::proportional(t.font_badge);- let galley = ui.painter().layout_no_wrap(text, font, t.app_bar);- let badge = Rect::from_center_size(c, vec2((galley.size().x + 6.0).max(14.0), 14.0));- ui.painter().rect_filled(badge.expand(1.5), 8.5, ring);- ui.painter().rect_filled(badge, 7.0, t.warning);- ui.painter().galley(badge.center() - galley.size() / 2.0, galley, t.app_bar);- }- }+ let state = match mark {+ AssistantMark::Quiet => crate::ui_kit::AssistantEntryState::Quiet,+ AssistantMark::Ready => crate::ui_kit::AssistantEntryState::Ready,+ AssistantMark::Busy => crate::ui_kit::AssistantEntryState::Busy,+ AssistantMark::NeedsAuth => crate::ui_kit::AssistantEntryState::NeedsAuth,+ AssistantMark::Stopped => crate::ui_kit::AssistantEntryState::Stopped,+ AssistantMark::Waiting(count) => crate::ui_kit::AssistantEntryState::Waiting(count),+ };+ crate::ui_kit::assistant_entry(ui, &resp, state, app.agent_chat.open, ui.ctx().global_style().animation_time > 0.0);if resp.on_hover_text(tip).clicked() {crate::agent_chat::toggle(app);}@@ -1512,7 +1531,7 @@ fn ribbon_tooltip(app: &SolveApp, response: egui::Response, command: &solidcraftribbon_text(ui, rect.center(), name, t.font_heading, t.text, true);if let Some(key) = command.shortcut {ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {- egui::Frame::new()+ egui::Frame::NONE.fill(t.panel_header).stroke(Stroke::new(1.0, t.border)).corner_radius(3.0)@@ -1750,7 +1769,7 @@ fn drag_ghost(ctx: &egui::Context, id: &str, at: egui::Pos2, removing: bool) {let p = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::new("sc_toolbar_drag")));let r = Rect::from_center_size(at + vec2(14.0, 16.0), vec2(30.0, 30.0));p.rect(r, t.radius_sm, t.toolbar.gamma_multiply(0.92), Stroke::new(1.0, if removing { t.error } else { t.accent }), egui::StrokeKind::Inside);- icons::paint(&p, r.shrink(5.0), c.icon, t.icon, t.icon_fill, command_accent(c.icon));+ icons::paint_icon(&p, r.shrink(5.0), c.icon, f32::from(t.icon.a()) / 255.0);if removing {let s = Stroke::new(2.0, t.error);let x = Rect::from_center_size(r.right_top(), vec2(9.0, 9.0));diff --git a/crates/ui-egui/src/ui_kit/actions.rs b/crates/ui-egui/src/ui_kit/actions.rsindex 444fe97046..c9bcb6027c 100644--- a/crates/ui-egui/src/ui_kit/actions.rs+++ b/crates/ui-egui/src/ui_kit/actions.rs@@ -68,6 +68,8 @@ pub(crate) struct Footer<'a> {pub selected: Option<Action>,pub danger: bool,pub confirm: bool,+ /// Parent surface corners; the footer inherits only its two bottom corners.+ pub corners: Option<egui::CornerRadius>,}pub(crate) fn footer(ui: &mut Ui, ok_label: &str, cancel_label: &str, ok_enabled: bool, options: Footer<'_>) -> Action {@@ -82,7 +84,7 @@ pub(super) fn footer_with_left(options: Footer<'_>,left: impl FnOnce(&mut Ui),) -> Action {- let Footer { apply: apply_label, status, selected, danger, confirm } = options;+ let Footer { apply: apply_label, status, selected, danger, confirm, corners } = options;let t = Tokens::get();let ok_enabled = ok_enabled && !ok_label.is_empty();// The footer is a full-width band (the card has no margin of its own): its own fill, a rule@@ -91,8 +93,12 @@ pub(super) fn footer_with_left(vec2(dimension(ui.available_width()), t.form_footer_height + if confirm { t.space_4 } else { 0.0 }),egui::Sense::hover(),);- let corner = t.radius_xl.saturating_sub(1);- ui.painter().rect_filled(band, egui::CornerRadius { nw: 0, ne: 0, sw: corner, se: corner }, t.dialog_footer);+ let corners = corners.unwrap_or(egui::CornerRadius::same(t.radius_xl));+ ui.painter().rect_filled(+ band,+ egui::CornerRadius { nw: 0, ne: 0, sw: corners.sw.saturating_sub(1), se: corners.se.saturating_sub(1) },+ t.dialog_footer,+ );ui.painter().hline(band.x_range(), band.top(), egui::Stroke::new(1.0, t.dialog_rule));scenario::publish_rect("dialog:footer", band);scenario::publish_count("dialog:ok:enabled", f64::from(ok_enabled && ui.is_enabled()));@@ -220,16 +226,14 @@ pub(crate) fn button_pair(ui: &mut egui::Ui, key: &str, states: [bool; 2], buttolet left = rect.center().x - (galley.size().x + icon_width) / 2.0;let painter = ui.painter().with_clip_rect(ui.clip_rect().intersect(rect));if let Some(icon) = button.icon {- crate::icons::paint(+ crate::icons::paint_icon(&painter,egui::Rect::from_center_size(egui::pos2(left + t.sketch_footer_icon_size / 2.0, rect.center().y),vec2(t.sketch_footer_icon_size, t.sketch_footer_icon_size),),icon,- t.icon,- t.icon_fill,- t.form_primary,+ f32::from(t.icon.a()) / 255.0,);}painter.galley(egui::pos2(left + icon_width, rect.center().y - galley.size().y / 2.0), galley, t.form_ink);@@ -246,13 +250,13 @@ pub(crate) fn button_pair(ui: &mut egui::Ui, key: &str, states: [bool; 2], butto}/// Secondary button variants preserve native sizing and enabled-button translation.-pub(crate) enum Button {+pub enum Button {Normal,Small,Enabled(bool),}-pub(crate) fn button(ui: &mut Ui, label: impl Into<egui::WidgetText>, options: Button) -> Response {+pub fn button(ui: &mut Ui, label: impl Into<egui::WidgetText>, options: Button) -> Response {let label = label.into();let key = label.text().to_owned();let draw = |ui: &mut Ui, label| match options {diff --git a/crates/ui-egui/src/ui_kit/assistant.rs b/crates/ui-egui/src/ui_kit/assistant.rsnew file mode 100644index 0000000000..f6e162d4e1--- /dev/null+++ b/crates/ui-egui/src/ui_kit/assistant.rs@@ -0,0 +1,408 @@+//! Assistant presentation primitives; protocol state and action dispatch stay with callers.+use crate::theme::Tokens;+use egui::{InnerResponse, Response, Ui, vec2};++#[derive(Clone, Copy)]+pub(crate) enum AssistantTone {+ Neutral,+ Working,+ Success,+ Warning,+ Error,+}++impl AssistantTone {+ fn colors(self, t: &Tokens) -> (egui::Color32, egui::Color32) {+ match self {+ Self::Neutral => (t.form_dim, t.dialog_footer),+ Self::Working => (t.selected_ink, t.accent_soft),+ Self::Success => (t.form_success, t.form_success_fill),+ Self::Warning => (t.warning, t.warning.gamma_multiply(0.12)),+ Self::Error => (t.form_error, t.form_error_fill),+ }+ }+}++/// A compact state pill. Tokens: font_small, space_6/12, radius_xl and semantic state colours.+pub(crate) fn assistant_badge(ui: &mut Ui, label: &str, tone: AssistantTone) -> Response {+ let t = Tokens::get();+ let (ink, fill) = tone.colors(&t);+ let font = egui::FontId::proportional(t.font_caption);+ let width = ui.painter().layout_no_wrap(label.to_owned(), font.clone(), ink).size().x + t.space_12;+ let (rect, response) = ui.allocate_exact_size(vec2(width, t.form_close_size - t.space_4), egui::Sense::hover());+ ui.painter().rect_filled(rect, t.radius_xl, fill);+ ui.painter().text(rect.center(), egui::Align2::CENTER_CENTER, label, font, ink);+ response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, ui.is_enabled(), label));+ response+}++/// The shared 40 pt header band. The caller owns its title, state and icon actions.+pub(crate) fn assistant_header<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {+ let t = Tokens::get();+ let output = egui::Frame::NONE+ .inner_margin(egui::Margin {+ left: t.space_12 as i8,+ right: t.space_8 as i8,+ top: (t.space_4 + t.space_3) as i8,+ bottom: (t.space_4 + t.space_3) as i8,+ })+ .show(ui, |ui| {+ ui.set_min_width(ui.available_width().max(0.0));+ ui.set_min_height(t.form_close_size);+ add(ui)+ });+ ui.painter().hline(output.response.rect.x_range(), output.response.rect.bottom(), egui::Stroke::new(1.0, t.dialog_rule));+ output+}++/// Inset controls band beneath the header, aligned with the conversation body.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_controls<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {+ let t = Tokens::get();+ egui::Frame::NONE.inner_margin(egui::Margin::symmetric(t.space_12 as i8, t.space_8 as i8)).show(ui, |ui| {+ ui.set_min_width(ui.available_width().max(0.0));+ add(ui)+ })+}++/// Right-aligned user message with a compact lower-right corner and 86% maximum width.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_bubble<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {+ let t = Tokens::get();+ let width = ui.available_width().max(0.0);+ let bubble_width = width * 0.86;+ ui.horizontal_top(|ui| {+ ui.spacing_mut().item_spacing.x = 0.0;+ ui.add_space(width - bubble_width);+ egui::Frame::NONE+ .fill(t.accent_soft)+ .corner_radius(egui::CornerRadius { nw: t.radius_xl, ne: t.radius_xl, sw: t.radius_xl, se: t.space_3 as u8 })+ .inner_margin(egui::Margin::symmetric((t.space_8 + t.space_3) as i8, t.space_8 as i8))+ .show(ui, |ui| {+ let content_width = (bubble_width - (t.space_8 + t.space_3) * 2.0).max(0.0);+ ui.set_width(content_width);+ ui.with_layout(egui::Layout::top_down(egui::Align::Min), |ui| {+ ui.set_width(content_width);+ ui.spacing_mut().item_spacing.y = t.space_6;+ ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Wrap);+ ui.visuals_mut().override_text_color = Some(t.form_ink);+ add(ui)+ })+ .inner+ })+ })+ .inner+}++/// Assistant prose remains unboxed and uses the shared readable body typography.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_prose<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> R {+ let t = Tokens::get();+ ui.scope(|ui| {+ ui.style_mut().text_styles.insert(egui::TextStyle::Body, egui::FontId::proportional(t.font_label));+ ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Wrap);+ ui.visuals_mut().override_text_color = Some(t.form_ink);+ add(ui)+ })+ .inner+}++#[cfg(any(not(target_arch = "wasm32"), test))]+#[derive(Clone, Copy)]+pub(crate) enum AssistantToolState {+ Pending,+ Running,+ Done,+ Failed,+}++/// A 15 pt status mark with distinct shape and colour for every tool state.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_tool_status(ui: &mut Ui, state: AssistantToolState) -> Response {+ let t = Tokens::get();+ let size = t.space_12 + t.space_3;+ let (rect, response) = ui.allocate_exact_size(vec2(size, size), egui::Sense::hover());+ let radius = (size - t.space_4) / 2.0;+ match state {+ AssistantToolState::Pending => {+ ui.painter().circle_stroke(rect.center(), radius, egui::Stroke::new(1.0, t.form_dim));+ }+ AssistantToolState::Running => {+ let phase = ui.input(|i| i.time) as f32 * t.space_3;+ let points = (0..=24)+ .map(|step| {+ let angle = phase + step as f32 / 24.0 * std::f32::consts::TAU * 0.75;+ rect.center() + vec2(angle.cos(), angle.sin()) * radius+ })+ .collect();+ ui.painter().add(egui::Shape::line(points, egui::Stroke::new(t.space_2, t.form_primary)));+ ui.ctx().request_repaint();+ }+ AssistantToolState::Done => {+ ui.painter().circle_filled(rect.center(), size / 2.0, t.form_success_fill);+ super::checks::paint_check_glyph(ui.painter(), rect, false, t.form_success);+ }+ AssistantToolState::Failed => {+ ui.painter().circle_filled(rect.center(), size / 2.0, t.form_error_fill);+ crate::icons::paint_ink(ui.painter(), rect, "close", t.form_error);+ }+ }+ response+}++/// Bordered tool group; the caller retains expansion, status and automation identities.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_tool_frame<R>(ui: &mut Ui, failed: bool, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {+ let t = Tokens::get();+ egui::Frame::NONE+ .fill(if failed { t.form_error_fill } else { t.dialog_body })+ .stroke(egui::Stroke::new(1.0, t.dialog_rule))+ .corner_radius(t.radius_lg)+ .inner_margin(t.space_3)+ .show(ui, |ui| {+ ui.set_min_width(ui.available_width().max(0.0));+ add(ui)+ })+}++/// Individual tool-row surface, retaining a failed row's tint inside a shared group.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_tool_row<R>(ui: &mut Ui, failed: bool, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {+ let t = Tokens::get();+ egui::Frame::NONE.fill(if failed { t.form_error_fill } else { t.dialog_body }).corner_radius(t.control_radius).show(ui, add)+}++/// Indented detail box using the same field surface as inline command parameters.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_tool_detail<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {+ let t = Tokens::get();+ egui::Frame::NONE+ .fill(t.control_fill)+ .stroke(egui::Stroke::new(1.0, t.dialog_rule))+ .corner_radius(t.control_radius)+ .inner_margin(egui::Margin::symmetric((t.space_6 + t.space_3) as i8, t.space_6 as i8))+ .show(ui, add)+}++/// Approval frame with a tinted heading. Permission choices remain entirely caller-owned.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_approval<R>(ui: &mut Ui, title: &str, body: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {+ let t = Tokens::get();+ let output = egui::Frame::NONE.fill(t.dialog_body).stroke(egui::Stroke::new(1.0, t.form_primary)).corner_radius(t.radius_xl).show(ui, |ui| {+ ui.set_min_width(ui.available_width().max(0.0));+ ui.spacing_mut().item_spacing.y = 0.0;+ egui::Frame::NONE+ .fill(t.accent_soft)+ .corner_radius(egui::CornerRadius { nw: t.radius_xl.saturating_sub(1), ne: t.radius_xl.saturating_sub(1), sw: 0, se: 0 })+ .inner_margin(egui::Margin::symmetric(t.space_10 as i8, t.space_8 as i8))+ .show(ui, |ui| {+ ui.set_min_width(ui.available_width().max(0.0));+ ui.horizontal_top(|ui| {+ ui.spacing_mut().item_spacing.x = t.space_6;+ let (icon, _) = ui.allocate_exact_size(vec2(t.space_16, t.space_16), egui::Sense::hover());+ crate::icons::paint_ink(ui.painter(), icon, "shield", t.selected_ink);+ ui.add(egui::Label::new(egui::RichText::new(title).font(crate::fonts::semibold(t.font_label)).color(t.form_ink)).wrap());+ });+ });+ egui::Frame::NONE+ .inner_margin(t.space_10)+ .show(ui, |ui| {+ ui.spacing_mut().item_spacing.y = t.space_8;+ body(ui)+ })+ .inner+ });+ crate::scenario::publish_rect("assistant:approval", output.response.rect);+ output+}++/// Unframed growing editor inside the composer. The caller retains focus ID and Enter routing.+/// Tokens: font_label, control_height, space_8 and shared text_input alignment.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_input(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -> Response {+ let t = Tokens::get();+ ui.add(+ super::fields::text_input(egui::TextEdit::multiline(value))+ .id(id)+ .frame(egui::Frame::NONE)+ .background_color(egui::Color32::TRANSPARENT)+ .hint_text(hint)+ .desired_rows(2)+ .desired_width(f32::INFINITY)+ .min_size(vec2(0.0, t.control_height + t.space_8))+ .font(egui::FontId::proportional(t.font_label)),+ )+}++/// Compact right-aligned approval actions; wrapping grows by control rows, not the remaining card height.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_actions<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {+ let t = Tokens::get();+ ui.allocate_ui_with_layout(+ vec2(ui.available_width(), t.control_height),+ egui::Layout::right_to_left(egui::Align::Center).with_main_wrap(true),+ add,+ )+}++/// Composer's rounded field surface with an accent border only while focused.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_composer<R>(ui: &mut Ui, focused: bool, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {+ let t = Tokens::get();+ egui::Frame::NONE+ .fill(t.control_fill)+ .stroke(egui::Stroke::new(1.0, if focused { t.form_primary } else { t.control_border }))+ .corner_radius(t.radius_xl)+ .inner_margin(egui::Margin::symmetric(t.space_10 as i8, t.space_8 as i8))+ .show(ui, |ui| {+ ui.set_min_width(ui.available_width().max(0.0));+ ui.spacing_mut().item_spacing.y = t.space_6;+ add(ui)+ })+}++/// Circular primary send or stop action. The caller retains queue and cancellation dispatch.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_send(ui: &mut Ui, enabled: bool, busy: bool, label: &str) -> Response {+ let t = Tokens::get();+ ui.add_enabled_ui(enabled, |ui| {+ let size = t.control_height + t.space_2;+ let (rect, response) = ui.allocate_exact_size(vec2(size, size), egui::Sense::click());+ let fill = if response.hovered() { t.form_primary.gamma_multiply(0.9) } else { t.form_primary };+ ui.painter().circle_filled(rect.center(), size / 2.0, fill);+ let ink = if crate::theme::contrast_ratio(t.on_accent, fill) >= 4.5 { t.on_accent } else { t.tab_on_fill_dark };+ crate::icons::paint_ink(ui.painter(), rect.shrink(t.space_6), if busy { "stop" } else { "send" }, ink);+ if response.has_focus() {+ ui.painter().circle_stroke(rect.center(), size / 2.0 + t.space_2, egui::Stroke::new(1.0, t.form_primary));+ }+ if response.hovered() {+ ui.ctx().set_cursor_icon(egui::CursorIcon::PointingHand);+ }+ response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), label));+ response.on_hover_text(label)+ })+ .inner+}++/// Pinned composer footer. The enclosing shell retains ownership of scrolling and sizing.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_composer_footer<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {+ let t = Tokens::get();+ let output = egui::Frame::NONE+ .fill(t.dialog_footer)+ .corner_radius(egui::CornerRadius { nw: 0, ne: 0, sw: t.radius_xl.saturating_sub(1), se: t.radius_xl.saturating_sub(1) })+ .inner_margin(t.space_10)+ .show(ui, add);+ ui.painter().hline(output.response.rect.x_range(), output.response.rect.top(), egui::Stroke::new(1.0, t.dialog_rule));+ output+}++/// Centred setup copy and caller-supplied action, bounded to a readable 300 pt column.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_empty<R>(ui: &mut Ui, title: &str, body: &str, add: impl FnOnce(&mut Ui) -> R) -> R {+ let t = Tokens::get();+ let width = ui.available_width().min(t.form_card_width + t.space_24 + t.space_12).max(0.0);+ ui.vertical_centered(|ui| {+ ui.set_max_width(width);+ ui.spacing_mut().item_spacing.y = t.space_8;+ let diameter = t.control_height + t.space_16;+ let (disc, _) = ui.allocate_exact_size(vec2(diameter, diameter), egui::Sense::hover());+ ui.painter().circle_filled(disc.center(), diameter / 2.0, t.accent_soft);+ crate::icons::paint_ink(ui.painter(), disc.shrink(t.space_8), "assistant", t.selected_ink);+ ui.add(egui::Label::new(egui::RichText::new(title).font(crate::fonts::semibold(t.font_body + t.space_2)).color(t.form_ink)).wrap());+ ui.add(egui::Label::new(egui::RichText::new(body).size(t.font_label).color(t.form_dim)).wrap());+ add(ui)+ })+ .inner+}++/// Semantic warning/error/information band with caller-owned text and actions.+#[cfg(any(not(target_arch = "wasm32"), test))]+pub(crate) fn assistant_banner<R>(ui: &mut Ui, tone: AssistantTone, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {+ let t = Tokens::get();+ let (_, fill) = tone.colors(&t);+ egui::Frame::NONE.fill(fill).stroke(egui::Stroke::new(1.0, t.dialog_rule)).corner_radius(t.radius_lg).inner_margin(t.space_10).show(ui, |ui| {+ ui.set_min_width(ui.available_width().max(0.0));+ ui.spacing_mut().item_spacing.y = t.space_8;+ add(ui)+ })+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn assistant_bubble_stays_right_aligned_at_narrow_and_wide_widths() {+ for width in [220.0, 280.0, 440.0, 740.0] {+ let ctx = crate::fonts::test_context();+ for _ in 0..2 {+ super::super::test_support::frame(&ctx, vec![], |ui| {+ ui.set_width(width);+ let left = ui.cursor().left();+ let available = ui.available_width();+ let bubble = assistant_bubble(ui, |ui| {+ ui.label("A message that wraps within its bubble.");+ });+ assert!((bubble.response.rect.right() - (left + available)).abs() < 1.0);+ assert!(bubble.response.rect.width() <= available * 0.86 + 1.0);+ });+ }+ }+ }++ #[test]+ fn assistant_bubble_stacks_message_and_file_summary_without_squeezing_either() {+ for width in [280.0, 440.0, 740.0] {+ let ctx = crate::fonts::test_context();+ for _ in 0..2 {+ super::super::test_support::frame(&ctx, vec![], |ui| {+ ui.set_width(width);+ let bubble = assistant_bubble(ui, |ui| {+ let message = ui.label("Make the plate thicker.").rect;+ let files = ui.label("Files: plate-dimensions.txt").rect;+ (message, files)+ });+ let (message, files) = bubble.inner;+ assert!(files.top() >= message.bottom(), "file summary must follow message vertically");+ assert!((message.left() - files.left()).abs() < 1.0, "both lines share the content inset");+ assert!(files.width() > Tokens::get().control_height * 3.0, "file summary must retain readable width");+ assert!(bubble.response.rect.height() < Tokens::get().control_height * 4.0, "two short lines remain compact");+ });+ }+ }+ }++ #[test]+ fn assistant_send_only_activates_when_enabled() {+ for enabled in [false, true] {+ let ctx = crate::fonts::test_context();+ let mut position = egui::Pos2::ZERO;+ let mut clicked = false;+ super::super::test_support::frame(&ctx, vec![], |ui| {+ position = assistant_send(ui, enabled, false, "Send").rect.center();+ });+ super::super::test_support::frame(&ctx, super::super::test_support::pointer(position, true), |ui| {+ clicked |= assistant_send(ui, enabled, false, "Send").clicked();+ });+ super::super::test_support::frame(&ctx, super::super::test_support::pointer(position, false), |ui| {+ clicked |= assistant_send(ui, enabled, false, "Send").clicked();+ });+ assert_eq!(clicked, enabled);+ }+ }++ #[test]+ fn assistant_header_and_badge_share_reference_control_heights() {+ let ctx = crate::fonts::test_context();+ super::super::test_support::frame(&ctx, vec![], |ui| {+ let t = Tokens::get();+ let header = assistant_header(ui, |ui| {+ ui.allocate_exact_size(vec2(t.space_24, t.form_close_size), egui::Sense::hover());+ });+ assert!((header.response.rect.height() - t.form_header_height).abs() < 1.0);+ let badge = assistant_badge(ui, "Ready", AssistantTone::Success);+ assert!((badge.rect.height() - (t.form_close_size - t.space_4)).abs() < 1.0);+ });+ }+}diff --git a/crates/ui-egui/src/ui_kit/assistant_entry.rs b/crates/ui-egui/src/ui_kit/assistant_entry.rsnew file mode 100644index 0000000000..80e6f2fd22--- /dev/null+++ b/crates/ui-egui/src/ui_kit/assistant_entry.rs@@ -0,0 +1,67 @@+//! Assistant entry point and its status mark, shared by application chrome and previews.+use crate::{icons, theme::Tokens};+use egui::{FontId, Rect, Response, Stroke, vec2};++#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub(crate) enum AssistantEntryState {+ Quiet,+ Ready,+ Busy,+ NeedsAuth,+ Stopped,+ Waiting(usize),+}++/// Paint the compact entry point in its caller-owned target. The caller owns state and actions.+/// Tokens: app_bar, app_bar_hover_button/strong, agent_ok/busy, warning/error, radius_sm, font_badge.+pub(crate) fn assistant_entry(ui: &egui::Ui, response: &Response, state: AssistantEntryState, open: bool, animate: bool) {+ let t = Tokens::get();+ let at = response.rect;+ let mark = state;+ // The highlight is a 26 px square, like the other icon buttons; the mark sits on the bubble's corner.+ let mut ring = t.app_bar;+ if open || response.hovered() || response.has_focus() {+ let fill = if open { t.app_bar_hover_strong } else { t.app_bar_hover_button };+ ui.painter().rect_filled(at.shrink(t.space_3), t.radius_sm, fill);+ ring = t.app_bar.blend(fill);+ }+ icons::paint_app_bar(ui.painter(), at.shrink(t.space_6 + 1.0), "assistant", 1.0);+ let c = egui::pos2(at.right() - t.space_8 - 0.5, at.top() + t.space_10 - 0.5);+ match mark {+ AssistantEntryState::Quiet => {}+ AssistantEntryState::Ready | AssistantEntryState::NeedsAuth | AssistantEntryState::Stopped => {+ let color = match mark {+ AssistantEntryState::Ready => t.agent_ok,+ AssistantEntryState::NeedsAuth => t.warning,+ _ => t.error,+ };+ ui.painter().circle_filled(c, 5.5, ring);+ ui.painter().circle_filled(c, 4.0, color);+ }+ AssistantEntryState::Busy => {+ let phase = if animate {+ ui.ctx().request_repaint();+ ui.input(|i| i.time) as f32 * 3.0+ } else {+ 0.0+ };+ ui.painter().circle_filled(c, 6.0, ring);+ let points = (0..=24)+ .map(|i| {+ let angle = phase + i as f32 / 24.0 * std::f32::consts::TAU * 0.75;+ c + vec2(angle.cos(), angle.sin()) * 4.0+ })+ .collect();+ ui.painter().add(egui::Shape::line(points, Stroke::new(1.8, t.agent_busy)));+ }+ AssistantEntryState::Waiting(count) => {+ let text = count.to_string();+ let font = FontId::proportional(t.font_badge);+ let galley = ui.painter().layout_no_wrap(text, font, t.app_bar);+ let badge = Rect::from_center_size(c, vec2((galley.size().x + t.space_6).max(t.space_14), t.space_14));+ ui.painter().rect_filled(badge.expand(1.5), 8.5, ring);+ ui.painter().rect_filled(badge, 7.0, t.warning);+ ui.painter().galley(badge.center() - galley.size() / 2.0, galley, t.app_bar);+ }+ }+}diff --git a/crates/ui-egui/src/ui_kit/choice.rs b/crates/ui-egui/src/ui_kit/choice.rsindex bb518beb85..ef9036e3f6 100644--- a/crates/ui-egui/src/ui_kit/choice.rs+++ b/crates/ui-egui/src/ui_kit/choice.rs@@ -5,6 +5,7 @@ use super::{metrics::*,text::paint_text,};+use crate::ui_kit::{Container, Surface};use crate::{scenario, theme::Tokens};use egui::{Ui, vec2};@@ -130,7 +131,7 @@ pub(crate) fn segmented_icons(ui: &mut Ui, selected: &mut usize, options: &[Icon// A square icon area inside the segment: dash gaps and dots need the room to read apart.let side = (segment.width().min(segment.height()) - t.space_4).max(t.space_12);let icon_rect = egui::Rect::from_center_size(segment.center(), vec2(side, side));- crate::icons::paint(ui.painter(), icon_rect, option.icon, t.icon, t.icon_fill, t.form_primary);+ crate::icons::paint_icon(ui.painter(), icon_rect, option.icon, f32::from(t.icon.a()) / 255.0);response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, ui.is_enabled(), on, option.key));scenario::publish_handle(&format!("dialog:{}:{}", label(ui), option.key), segment.center());let response = response.on_hover_text(&option.tip);@@ -239,7 +240,7 @@ pub(crate) fn tool_choices<'a>(ui: &mut Ui, label: &str, current: &str, choices:.corner_radius(t.sketch_mode_radius).min_size(vec2(t.sketch_mode_size, t.sketch_mode_size)),);- crate::icons::paint(ui.painter(), response.rect.shrink(t.space_6), choice.icon, t.icon, t.icon_fill, t.sketch_accent);+ crate::icons::paint_icon(ui.painter(), response.rect.shrink(t.space_6), choice.icon, f32::from(t.icon.a()) / 255.0);scenario::publish_target(&format!("sketch_palette:feature:{}", choice.key), response.rect);response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, enabled, on, choice.label));if response.on_hover_text(choice.label).clicked() && enabled {@@ -257,7 +258,7 @@ pub(crate) fn toggle_icon(ui: &mut Ui, row: &str, label: &str, selected: &mut bolet t = Tokens::get();let response =ui.add(egui::Button::new("").selected(*selected).min_size(vec2(t.space_24 + t.space_4, t.control_height)).sense(egui::Sense::CLICK));- crate::icons::paint(ui.painter(), response.rect.shrink(t.space_3), icon, t.icon, t.icon_fill, t.form_primary);+ crate::icons::paint_icon(ui.painter(), response.rect.shrink(t.space_3), icon, f32::from(t.icon.a()) / 255.0);response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, true, *selected, crate::i18n::tr_label(label)));crate::scenario::publish_handle(&format!("dialog:{row}:{label}"), response.rect.center());if response.clone().on_hover_text(crate::i18n::tr_label(label)).clicked() {@@ -363,8 +364,9 @@ pub(crate) fn popup_list(let t = crate::theme::Tokens::get();let mut chosen = None;let mut rows = Vec::with_capacity(options.len());- let area = crate::frame::area(id).order(egui::Order::Tooltip).fixed_pos(anchor.left_bottom() + egui::vec2(0.0, t.space_2)).show(ctx, |ui| {- egui::Frame::popup(ui.style())+ let popup = Container::new(ctx, Surface::Popup).area(id);+ let area = popup.order(egui::Order::Tooltip).fixed_pos(anchor.left_bottom() + egui::vec2(0.0, t.space_2)).show(ctx, |ui| {+ Container::popup_frame(ui.style()).fill(t.control_fill).stroke(egui::Stroke::new(1.0, t.dialog_border)).corner_radius(t.radius_lg)diff --git a/crates/ui-egui/src/ui_kit/color.rs b/crates/ui-egui/src/ui_kit/color.rsindex 81434ee9d9..8ac77c2ca5 100644--- a/crates/ui-egui/src/ui_kit/color.rs+++ b/crates/ui-egui/src/ui_kit/color.rs@@ -1,5 +1,6 @@//! Opaque document RGB editing. Interface paint uses tokens; the gradients are colour data.use super::{layout::label, metrics::dimension};+use crate::ui_kit::{Container, Surface};use crate::{i18n, scenario, theme::Tokens};use egui::{Color32, Response, Sense, Ui, ecolor::HsvaGamma, pos2, vec2};@@ -22,11 +23,12 @@ pub(crate) fn color_field(ui: &mut Ui, rgb: &mut [u8; 3]) -> Response {response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::ColorButton, ui.is_enabled(), i18n::tr("color.edit")));publish(&format!("dialog:color:{}", label(ui)), &response);let mut edited = false;- egui::Popup::menu(&response)+ Container::new(ui.ctx(), Surface::Popup)+ .menu(&response).close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside).width(t.form_card_width + t.space_24 + t.space_12).frame(- egui::Frame::popup(ui.style())+ Container::popup_frame(ui.style()).fill(t.control_fill).stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_xl)diff --git a/crates/ui-egui/src/ui_kit/container.rs b/crates/ui-egui/src/ui_kit/container.rsnew file mode 100644index 0000000000..8432e90afe--- /dev/null+++ b/crates/ui-egui/src/ui_kit/container.rs@@ -0,0 +1,249 @@+//! The only constructors for outer UI hosts. Content widgets belong to the other kit modules.+//! A surface declares its purpose; the shell supplies the layout once per frame. Never infer+//! floating/docked presentation from a panel name or keep a second layout preference here.+use crate::frame::Side;+use crate::{shell::LayoutMode, theme::Tokens};+use egui::{Color32, Context, Frame, Id, Stroke, WidgetText};++/// Persistent panels adapt to the layout; transient UI retains its anchoring and modality.+#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub enum Surface {+ /// Browser, History, Render settings and future workspace panels.+ Panel,+ /// Feature forms and the Assistant sheet.+ Feature,+ /// Sketch options, including their translucent background.+ Palette,+ /// Workspace switcher and ribbon cards.+ Chrome,+ /// Native application/title bar; its presentation is independent of workspace layout.+ ApplicationBar,+ /// Movable system windows and modal dialogs; never become workspace docks.+ Window,+ /// Anchored menus, completion lists and rename editors.+ Popup,+ /// Model-anchored editors and manipulation feedback.+ Canvas,+ /// Status/progress notifications, independent of the workspace layout.+ Toast,+ /// Viewport navigation controls (the compass itself is drawn geometry).+ Navigation,+ /// Full-page content, the model viewport and native pop-out content.+ Viewport,+ /// Deliberate input-blocking backdrops; must not inherit CAD input blocking.+ InputShield,+}++#[derive(Clone, Copy, Debug)]+pub enum Edge {+ Left,+ Right,+ Top,+ Bottom,+}++/// Edges that meet the window or another docked surface. Only exposed corners round.+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]+pub struct DockEdges {+ pub left: bool,+ pub right: bool,+ pub top: bool,+ pub bottom: bool,+}++impl DockEdges {+ pub const ALL: Self = Self { left: true, right: true, top: true, bottom: true };+}++/// Universal outer host and surface policy. Both host geometry and frame construction must go+/// through this API, including code in nested modules and platform apps.+#[derive(Clone, Copy)]+pub struct Container {+ surface: Surface,+ layout: LayoutMode,+ joined: Option<DockEdges>,+}++impl Container {+ pub fn new(ctx: &Context, surface: Surface) -> Self {+ Self::for_layout(LayoutMode::current(ctx), surface)+ }++ pub(crate) fn for_layout(layout: LayoutMode, surface: Surface) -> Self {+ Self { surface, layout, joined: None }+ }++ /// Declare contacts from shell geometry; styling remains entirely in the container.+ pub fn joined(mut self, edges: DockEdges) -> Self {+ self.joined = Some(edges);+ self+ }++ /// Shell-owned placement policy, shared by current and future adaptive panels.+ pub fn floating(self) -> bool {+ matches!(self.surface, Surface::Panel | Surface::Feature | Surface::Palette | Surface::Chrome) && self.layout == LayoutMode::Floating+ }++ /// Separation between adaptive workspace surfaces; compact surfaces meet their edge.+ pub fn gap(self) -> f32 {+ if self.floating() { crate::shell::SHELL_GAP } else { 0.0 }+ }++ /// Tokenised outer chrome. Callers may supply content padding, not another card surface.+ pub fn frame(self, ctx: &Context, fill: Color32, side: crate::frame::Side) -> Frame {+ let t = Tokens::get();+ let flat = Frame::NONE.fill(fill);+ match self.surface {+ Surface::Feature | Surface::Palette if !self.floating() => {+ let edges = self.joined.unwrap_or(DockEdges { left: side == Side::Left, right: side == Side::Right, ..Default::default() });+ Self::compact_frame(fill, t.dialog_border, edges)+ }+ Surface::Panel | Surface::Chrome if !self.floating() => Self::compact_frame(fill, t.border, self.joined.unwrap_or(DockEdges::ALL)),+ Surface::Feature | Surface::Window => {+ flat.stroke(egui::Stroke::new(1.0, t.dialog_border)).corner_radius(t.radius_xl).shadow(t.shell_shadow())+ }+ Surface::Palette => flat.stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_xl).shadow(t.shell_shadow()),+ Surface::Panel | Surface::Chrome => flat.stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_lg).shadow(t.shell_shadow()),+ Surface::Navigation => flat.stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_md),+ Surface::Toast => flat.stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_md).shadow(t.shell_shadow()),+ Surface::Popup => Self::popup_frame(&ctx.global_style()).fill(fill),+ Surface::ApplicationBar | Surface::Canvas | Surface::Viewport | Surface::InputShield => flat,+ }+ }++ /// Movable tool sheets round all exposed corners, joining only their right dock edge.+ pub(crate) fn tool_frame(self, mut frame: Frame, right_docked: bool) -> Frame {+ if self.surface == Surface::Feature && !self.floating() {+ frame.corner_radius = Self::compact_rounding(DockEdges { right: right_docked, ..Default::default() });+ }+ frame+ }++ /// Surface of an allocated dock or internal pinned band. Floating card decoration is+ /// supplied by `frame`; edge-hosted panes must not acquire outer shadows or card gaps.+ pub fn edge_frame(self, fill: Color32) -> Frame {+ if self.adaptive() && !self.floating() {+ Self::compact_frame(fill, Tokens::get().border, self.joined.unwrap_or(DockEdges::ALL))+ } else {+ Frame::NONE.fill(fill)+ }+ }++ fn adaptive(self) -> bool {+ matches!(self.surface, Surface::Panel | Surface::Feature | Surface::Palette | Surface::Chrome)+ }++ fn compact_rounding(edges: DockEdges) -> egui::CornerRadius {+ let radius = Tokens::get().radius_lg;+ egui::CornerRadius {+ nw: if edges.left || edges.top { 0 } else { radius },+ ne: if edges.right || edges.top { 0 } else { radius },+ sw: if edges.left || edges.bottom { 0 } else { radius },+ se: if edges.right || edges.bottom { 0 } else { radius },+ }+ }++ fn compact_frame(fill: Color32, border: Color32, edges: DockEdges) -> Frame {+ // Collapse adjoining borders onto the same one-point strip. North/west outlines+ // sit outside the allocation; south/east outlines sit inside it. Logical panel+ // rectangles still touch exactly, with neither gaps nor doubled strokes.+ Frame::NONE+ .fill(fill)+ .stroke(Stroke::new(1.0, border))+ .outer_margin(egui::Margin { left: -1, top: -1, right: 0, bottom: 0 })+ .corner_radius(Self::compact_rounding(edges))+ }++ /// Measure content before rounding a compact card. Reaching a dock boundary joins+ /// that edge, so a content-hugging card and a full-height card share one composition.+ pub(crate) fn show_frame<R>(+ self,+ ui: &mut egui::Ui,+ frame: Frame,+ bounds: egui::Rect,+ body: impl FnOnce(&mut egui::Ui) -> R,+ ) -> egui::InnerResponse<R> {+ let mut prepared = frame.begin(ui);+ let inner = body(&mut prepared.content_ui);+ if self.adaptive() && !self.floating() {+ let rect = prepared.frame.outer_rect(prepared.content_ui.min_rect());+ let mut edges = self.joined.unwrap_or(DockEdges::ALL);+ edges.left |= rect.left() <= bounds.left();+ edges.right |= rect.right() >= bounds.right();+ edges.top |= rect.top() <= bounds.top();+ edges.bottom |= rect.bottom() >= bounds.bottom();+ prepared.frame.corner_radius = Self::compact_rounding(edges);+ }+ egui::InnerResponse { inner, response: prepared.end(ui) }+ }++ pub fn area(self, id: Id) -> egui::Area {+ egui::Area::new(id).enabled(self.input_enabled())+ }++ pub fn edge(self, id: impl Into<Id>, edge: Edge) -> egui::Panel {+ let panel = match edge {+ Edge::Left => egui::Panel::left(id),+ Edge::Right => egui::Panel::right(id),+ Edge::Top => egui::Panel::top(id),+ Edge::Bottom => egui::Panel::bottom(id),+ };+ if self.adaptive() && !self.floating() { panel.show_separator_line(false) } else { panel }+ }++ pub(super) fn window<'a>(self, title: impl Into<WidgetText>) -> egui::Window<'a> {+ egui::Window::new(title).enabled(self.input_enabled())+ }++ /// Anchored editors inherit their containing widget's local style. Their host stays a+ /// popup in both layouts; only the universal module constructs the egui popup frame.+ pub fn popup_frame(style: &egui::Style) -> Frame {+ Frame::popup(style)+ }++ pub(crate) fn menu_frame() -> Frame {+ let t = Tokens::get();+ egui::Frame::NONE+ .fill(t.dialog_body)+ .stroke(Stroke::new(1.0, t.dialog_border))+ .corner_radius(t.radius_xl)+ .inner_margin(egui::Margin::symmetric(t.space_6 as i8, t.space_6 as i8))+ .shadow(egui::Shadow {+ offset: [0, t.space_14 as i8],+ blur: (t.space_24 + t.space_12) as u8,+ spread: 0,+ color: t.app_bar.gamma_multiply(0.18),+ })+ }++ pub(crate) fn submenu(self) -> egui::menu::SubMenu {+ egui::menu::SubMenu::new()+ }++ pub fn menu<'a>(self, response: &egui::Response) -> egui::Popup<'a> {+ egui::Popup::menu(response)+ }++ pub fn context_menu<'a>(self, response: &egui::Response) -> egui::Popup<'a> {+ egui::Popup::context_menu(response)+ }++ pub(crate) fn tooltip_frame(self, ctx: &Context) -> Frame {+ let t = Tokens::get();+ self.frame(ctx, t.dialog_body, crate::frame::Side::Right)+ .stroke(egui::Stroke::new(1.0, t.dialog_border))+ .inner_margin(egui::Margin::symmetric(t.space_8 as i8, t.space_4 as i8))+ }++ pub fn modal(self, id: Id) -> egui::Modal {+ egui::Modal::new(id).area(egui::Modal::default_area(id).fade_in(false))+ }++ pub fn central(self) -> egui::CentralPanel {+ egui::CentralPanel::default()+ }++ fn input_enabled(self) -> bool {+ self.surface == Surface::InputShield || !crate::issue_report::cad_input_blocked()+ }+}diff --git a/crates/ui-egui/src/ui_kit/disclosure_tests.rs b/crates/ui-egui/src/ui_kit/disclosure_tests.rsindex 2d3c157982..e08a14ed7d 100644--- a/crates/ui-egui/src/ui_kit/disclosure_tests.rs+++ b/crates/ui-egui/src/ui_kit/disclosure_tests.rs@@ -67,7 +67,7 @@ fn section_card_and_floating_window_folds_render_down_when_open_right_when_closecrate::frame::Side::Left,egui::Frame::NONE,)- .window()+ .window(&ctx).show(ui.ctx(), |ui| collapsible_header(ui, "fillet", "Fillet", &mut !open, || {}));}});diff --git a/crates/ui-egui/src/ui_kit/fields.rs b/crates/ui-egui/src/ui_kit/fields.rsindex 2c4b832b6d..760961c5a2 100644--- a/crates/ui-egui/src/ui_kit/fields.rs+++ b/crates/ui-egui/src/ui_kit/fields.rs@@ -4,6 +4,7 @@ use super::{metrics::*,text::paint_text,};+use crate::ui_kit::{Container, Surface};use crate::{scenario, theme::Tokens};use egui::{Response, RichText, Ui, vec2};@@ -257,7 +258,7 @@ mod tests;/// Stable-ID inline editor for tables. Completion is owned by the caller so Enter can commit/// a cell without submitting its panel. Tokens: control_height/fill, form_inset, font_label, text/error.-pub(crate) fn cell_editor(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str, invalid: bool) -> Response {+pub fn cell_editor(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str, invalid: bool) -> Response {bounded_cell_editor(ui, id, value, hint, invalid, usize::MAX)}@@ -485,6 +486,13 @@ fn length_drag<'a>(value: &'a mut f64, units: &str, decimals: u8) -> egui::DragV.custom_parser(move |text| crate::prefs::parse_length_mm(text, scale))}+/// Small model-anchored value editor. Retains its focus ID and native hit height so it does+/// not intercept nearby canvas picks; the owner keeps completion and selection handling.+pub(crate) fn canvas_value_field(ui: &mut Ui, id: egui::Id, value: &mut String) -> Response {+ let t = Tokens::get();+ ui.add(egui::TextEdit::singleline(value).id(id).desired_width(t.space_24 * 3.0))+}+/// Placement editor whose owner routes Enter and Tab (including rejected expressions)./// Completion remains with the caller. Tokens: cell_editor tokens.pub(crate) fn placement_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -> Response {@@ -534,7 +542,7 @@ pub(crate) fn library_cell(ui: &mut Ui, id: egui::Id, value: &mut String, hint:let library = super::icon_button_at(ui, button, "chevron", "Library");scenario::publish_handle("dialog:menu:Library", button.center());scenario::publish_rect("dialog:menu:Library", button);- let popup = egui::Popup::menu(&library);+ let popup = Container::new(ui.ctx(), Surface::Popup).menu(&library);let open = popup.is_open();popup.show(|ui| super::scope(ui, menu));if open {diff --git a/crates/ui-egui/src/ui_kit/gallery.rs b/crates/ui-egui/src/ui_kit/gallery.rsindex 84808167a6..787f036c90 100644--- a/crates/ui-egui/src/ui_kit/gallery.rs+++ b/crates/ui-egui/src/ui_kit/gallery.rs@@ -1,5 +1,6 @@//! Table-driven layout/paint references in both themes. No window or GPU required.use super::*;+use crate::ui_kit::{Container, Surface};use crate::{scenario, theme::Tokens};use egui::{Ui, vec2};@@ -28,6 +29,121 @@ macro_rules! element {// One entry per element/variant: names, rendering and geometry expectations stay together.const ELEMENTS: &[Element] = &[+ element!("assistant_entry", |ui, _| {+ let t = Tokens::get();+ egui::Frame::NONE.fill(t.app_bar).show(ui, |ui| {+ ui.horizontal(|ui| {+ for state in [+ AssistantEntryState::Quiet,+ AssistantEntryState::Ready,+ AssistantEntryState::Busy,+ AssistantEntryState::NeedsAuth,+ AssistantEntryState::Stopped,+ AssistantEntryState::Waiting(3),+ ] {+ let (_, response) = ui.allocate_exact_size(vec2(t.space_24 + t.space_8, t.space_24 + t.space_8), egui::Sense::click());+ assistant_entry(ui, &response, state, false, false);+ }+ });+ });+ }),+ element!("assistant_header", |ui, _| {+ assistant_header(ui, |ui| {+ ui.horizontal(|ui| {+ ui.label("Assistant");+ assistant_badge(ui, "Ready", AssistantTone::Success);+ });+ });+ }),+ element!("assistant_controls", |ui, _| {+ assistant_controls(ui, |ui| {+ button(ui, "Connect", Button::Normal);+ });+ }),+ element!("assistant_badge", |ui, _| {+ ui.horizontal(|ui| {+ for (label, tone) in [+ ("Ready", AssistantTone::Success),+ ("Working", AssistantTone::Working),+ ("Waiting", AssistantTone::Warning),+ ("Error", AssistantTone::Error),+ ("Offline", AssistantTone::Neutral),+ ] {+ assistant_badge(ui, label, tone);+ }+ });+ }),+ element!("assistant_bubble", |ui, _| {+ assistant_bubble(ui, |ui| {+ ui.label("Set the plate thickness to 8 mm.");+ });+ }),+ element!("assistant_prose", |ui, _| {+ assistant_prose(ui, |ui| {+ ui.label("The thickness is now 8 mm. The design rebuilt successfully.");+ });+ }),+ element!("assistant_tool_status", |ui, _| {+ ui.horizontal(|ui| {+ for state in [AssistantToolState::Pending, AssistantToolState::Running, AssistantToolState::Done, AssistantToolState::Failed] {+ assistant_tool_status(ui, state);+ }+ });+ }),+ element!("assistant_tool", |ui, _| {+ assistant_tool_frame(ui, false, |ui| {+ ui.monospace("parameters.set");+ assistant_tool_detail(ui, |ui| {+ ui.monospace("thickness = 8 mm");+ });+ });+ }),+ element!("assistant_tool_failed", |ui, _| {+ assistant_tool_frame(ui, false, |ui| {+ assistant_tool_row(ui, true, |ui| {+ ui.monospace("solid.fillet");+ });+ });+ }),+ element!("assistant_approval", |ui, _| {+ assistant_approval(ui, "Allow the Assistant to run this?", |ui| {+ ui.label("Change the design parameter.");+ assistant_actions(ui, |ui| {+ primary_button(ui, "Allow once");+ button(ui, "Always allow", Button::Normal);+ button(ui, "Deny", Button::Normal);+ });+ });+ }),+ element!("assistant_composer", |ui, s| {+ assistant_composer_footer(ui, |ui| {+ assistant_composer(ui, false, |ui| {+ assistant_input(ui, ui.id().with("assistant_gallery"), &mut s.value, "Ask for a change…");+ });+ });+ }),+ element!("assistant_composer_focused", |ui, _| {+ assistant_composer(ui, true, |ui| {+ ui.label("Ask for a change…");+ });+ }),+ element!("assistant_send", |ui, _| {+ ui.horizontal(|ui| {+ assistant_send(ui, true, false, "Send");+ assistant_send(ui, true, true, "Stop");+ assistant_send(ui, false, false, "Send");+ });+ }),+ element!("assistant_empty", |ui, _| {+ assistant_empty(ui, "Set up an assistant", "Choose an installed agent in Preferences.", |ui| {+ button(ui, "Open Preferences", Button::Normal);+ });+ }),+ element!("assistant_banner", |ui, _| {+ assistant_banner(ui, AssistantTone::Warning, |ui| {+ ui.label("Paused after the configured step limit.");+ });+ }),element!("history_transport", |ui, _| {ui.horizontal(|ui| {let side = Tokens::get().space_24;@@ -346,6 +462,9 @@ const ELEMENTS: &[Element] = &[element!("slider_integer_without_editor", |ui, _| {slider(ui, &mut 12.0, 0.0..=100.0, Slider { show_value: false, integer: true, ..Default::default() });}),+ element!("canvas_value_field", |ui, s| {+ canvas_value_field(ui, ui.id().with("canvas_value"), &mut s.value);+ }),element!("placement_field", |ui, s| {placement_field(ui, ui.id().with("placement"), &mut s.value, "Distance");}),@@ -1127,7 +1246,7 @@ fn history_example(ui: &mut Ui, names: bool) {let width = crate::timeline_left::strip_width(&app);let rect = ui.allocate_space(vec2(width, 650.0)).1;ui.scope_builder(egui::UiBuilder::new().max_rect(rect.shrink(5.0)), |ui| {- ui.painter().add(crate::frame::shell_card(Tokens::get().panel).paint(rect));+ ui.painter().add(Container::new(ui.ctx(), Surface::Panel).frame(ui.ctx(), Tokens::get().panel, crate::frame::Side::Left).paint(rect));crate::timeline_left::left_timeline(&mut app, ui);});}@@ -1177,7 +1296,7 @@ fn history_board_in_both_themes_and_widths() {|ui| {ui.painter().rect_filled(bounds, 0.0, Tokens::get().viewport_top);crate::timeline_left::left_panel(&mut app, ui);- crate::browser::floating(&mut app, ui, bounds);+ crate::browser::browser(&mut app, ui);},);textures_update(&mut textures, &output.textures_delta);diff --git a/crates/ui-egui/src/ui_kit/history.rs b/crates/ui-egui/src/ui_kit/history.rsindex 4272f89c0b..bae10ccbb6 100644--- a/crates/ui-egui/src/ui_kit/history.rs+++ b/crates/ui-egui/src/ui_kit/history.rs@@ -322,13 +322,7 @@ pub(crate) fn history_seam(ui: &mut egui::Ui, card: Rect, names: bool) -> Historlet response = button.clone().union(edge.clone());if hovered && !dragging {let mut tip = egui::Tooltip::for_widget(&response);- let t = Tokens::get();- let frame = egui::Frame::NONE- .fill(t.dialog_body)- .stroke(Stroke::new(1.0, t.dialog_border))- .corner_radius(t.radius_md)- .inner_margin(egui::Margin::symmetric(t.space_8 as i8, t.space_4 as i8))- .shadow(t.shell_shadow());+ let frame = super::Container::new(ui.ctx(), super::Surface::Toast).tooltip_frame(ui.ctx());tip.popup = tip.popup.anchor(seam.pill).align(egui::RectAlign::RIGHT_START).frame(frame);tip.show(|ui| {let t = Tokens::get();diff --git a/crates/ui-egui/src/ui_kit/menu.rs b/crates/ui-egui/src/ui_kit/menu.rsindex c8f534dd11..cd49e87d09 100644--- a/crates/ui-egui/src/ui_kit/menu.rs+++ b/crates/ui-egui/src/ui_kit/menu.rs@@ -1,4 +1,5 @@//! Menus share one popup surface and one row painter. Command dispatch stays with callers.+use crate::ui_kit::{Container, Surface};use crate::{context_menu::Item, fonts::RichTextExt as _, icons, theme::Tokens};use egui::{Color32, FontId, Rect, Response, Sense, Stroke, Ui, pos2, vec2};@@ -6,7 +7,7 @@ pub(crate) struct Menu;impl Menu {pub(crate) fn context<R>(response: &Response, add: impl FnOnce(&mut Ui) -> R) -> Option<egui::InnerResponse<R>> {- egui::Popup::context_menu(response).frame(Self::frame()).show(add)+ Container::new(&response.ctx, Surface::Popup).context_menu(response).frame(Self::frame()).show(add)}pub(crate) fn button<R>(ui: &mut Ui, label: impl Into<egui::WidgetText>, add: impl FnOnce(&mut Ui) -> R) -> egui::InnerResponse<Option<R>> {@@ -40,7 +41,7 @@ impl Menu {ui.add_enabled_ui(!opening_press, add).inner};let popup = if nested {- let submenu = egui::menu::SubMenu::new();+ let submenu = Container::new(ui.ctx(), Surface::Popup).submenu();let submenu = if opening_press {submenu.config(egui::menu::MenuConfig::new().close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside))} else {@@ -48,7 +49,7 @@ impl Menu {};submenu.show(ui, &response, content)} else {- egui::Popup::menu(&response).frame(frame).show(content)+ Container::new(ui.ctx(), Surface::Popup).menu(&response).frame(frame).show(content)};let response = egui::InnerResponse { response, inner: popup.map(|r| r.inner) };ui.set_style(previous);@@ -56,18 +57,7 @@ impl Menu {}pub(crate) fn frame() -> egui::Frame {- let t = Tokens::get();- egui::Frame::NONE- .fill(t.dialog_body)- .stroke(Stroke::new(1.0, t.dialog_border))- .corner_radius(t.radius_xl)- .inner_margin(egui::Margin::symmetric(t.space_6 as i8, t.space_6 as i8))- .shadow(egui::Shadow {- offset: [0, t.space_14 as i8],- blur: (t.space_24 + t.space_12) as u8,- spread: 0,- color: t.app_bar.gamma_multiply(0.18),- })+ super::Container::menu_frame()}pub(crate) fn show<R>(ui: &mut Ui, width: f32, add: impl FnOnce(&mut Ui) -> R) -> R {@@ -123,7 +113,7 @@ impl Menu {let width = crate::context_menu::LIST_W;let x = if row.right() + width <= screen.right() { row.right() } else { (row.left() - width).max(screen.left()) };let at = pos2(x, row.top().min((screen.bottom() - height).max(screen.top())));- crate::frame::area(id).fixed_pos(at).order(egui::Order::Foreground).show(ctx, |ui| Self::show(ui, width, add))+ Container::new(ctx, Surface::Popup).area(id).fixed_pos(at).order(egui::Order::Foreground).show(ctx, |ui| Self::show(ui, width, add))}}diff --git a/crates/ui-egui/src/ui_kit/mod.rs b/crates/ui-egui/src/ui_kit/mod.rsindex 0c5bb13a96..a4f40fb3a7 100644--- a/crates/ui-egui/src/ui_kit/mod.rs+++ b/crates/ui-egui/src/ui_kit/mod.rs@@ -2,10 +2,13 @@//! `Panel` owns card composition; rows own aligned label/control columns and retain egui focus.//! Geometry, typography and colours come from `theme::Tokens`. See `docs/ui-kit.md`.mod actions;+mod assistant;+mod assistant_entry;mod checks;mod choice;mod color;mod confirm;+pub mod container;mod disclosure;mod fields;mod history;@@ -21,17 +24,23 @@ mod table;mod text;pub(crate) use actions::*;+pub use actions::{Button, button};+pub(crate) use assistant::*;+pub(crate) use assistant_entry::*;pub(crate) use checks::*;pub(crate) use choice::*;pub(crate) use color::*;pub(crate) use confirm::{Confirm, Tone};+pub use container::{Container, DockEdges, Edge, Surface};pub(crate) use disclosure::*;+pub use fields::cell_editor;pub(crate) use fields::*;pub(crate) use history::*;pub(crate) use layout::*;pub(crate) use menu::{Menu, MenuItem, rename_menu, workspace_menu};pub(crate) use metrics::{ContentWidth, header_height, row_height, table_row_height};-pub(crate) use panel::{ComputeStatus, FeatureOptions, Panel, Part, Window, WindowPage, panel_header_hover};+pub use panel::Window;+pub(crate) use panel::{ComputeStatus, FeatureOptions, Panel, Part, WindowPage, panel_header_hover};#[cfg(test)]pub(crate) use panel::{collapsible_header, header};pub(crate) use radial::{RADIAL_RADIUS, radial_menu};diff --git a/crates/ui-egui/src/ui_kit/panel.rs b/crates/ui-egui/src/ui_kit/panel.rsindex 6bc0de46be..d349125935 100644--- a/crates/ui-egui/src/ui_kit/panel.rs+++ b/crates/ui-egui/src/ui_kit/panel.rs@@ -11,16 +11,16 @@ pub(crate) fn panel_header_hover(painter: &egui::Painter, rect: egui::Rect) {/// Feature title/icon/close band. Tokens: `form_header_height, form_icon_size, form_close_size, form_inset, font_label, text, dialog_rule, space_8/10; icon_button_at tokens`.pub(crate) fn header(ui: &mut Ui, icon: &str, title: &str, on_close: impl FnOnce()) {- header_impl(ui, icon, title, None, on_close);+ header_impl(ui, icon, title, None, true, on_close);}/// Optional fold action for managers which historically hide their inputs without losing edits./// Tokens: header tokens and space_4; retains the dialog:collapse scenario handle.pub(crate) fn collapsible_header(ui: &mut Ui, icon: &str, title: &str, collapsed: &mut bool, on_close: impl FnOnce()) {- header_impl(ui, icon, title, Some(collapsed), on_close);+ header_impl(ui, icon, title, Some(collapsed), true, on_close);}-fn header_impl(ui: &mut Ui, icon: &str, title: &str, collapsed: Option<&mut bool>, on_close: impl FnOnce()) {+fn header_impl(ui: &mut Ui, icon: &str, title: &str, collapsed: Option<&mut bool>, closeable: bool, on_close: impl FnOnce()) {let t = Tokens::get();let (rect, _) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), header_height()), egui::Sense::hover());// Shared card chrome: 12 pt left inset, 19 pt icon, 8 pt gap and 26 pt close target.@@ -33,10 +33,12 @@ fn header_impl(ui: &mut Ui, icon: &str, title: &str, collapsed: Option<&mut boolegui::pos2((rect.right() - t.space_8 - t.form_close_size / 2.0).max(rect.left()), rect.center().y),vec2(t.form_close_size, t.form_close_size),);- let close = icon_button_at(ui, close_rect, "close", "Close");- scenario::publish_handle("dialog:close", close.rect.center());- if close.clicked() {- on_close();+ if closeable {+ let close = icon_button_at(ui, close_rect, "close", "Close");+ scenario::publish_handle("dialog:close", close.rect.center());+ if close.clicked() {+ on_close();+ }}let right = if let Some(collapsed) = collapsed {let fold = egui::Rect::from_min_size(egui::pos2(close_rect.left() - t.form_close_size - t.space_4, close_rect.top()), close_rect.size());@@ -46,8 +48,10 @@ fn header_impl(ui: &mut Ui, icon: &str, title: &str, collapsed: Option<&mut bool*collapsed = !*collapsed;}fold.left()- } else {+ } else if closeable {close_rect.left()+ } else {+ rect.right() - t.space_8};let left = (icon_rect.right() + t.space_8).min(right);let title_rect = egui::Rect::from_min_max(egui::pos2(left, rect.top()), egui::pos2(right.max(left), rect.bottom()));@@ -97,29 +101,22 @@ pub(crate) enum Part {impl<'a> Panel<'a> {/// Shared floating card surface for panels, windows and modal confirmations.- pub(super) fn card_frame() -> egui::Frame {+ pub(super) fn card_frame(ctx: &egui::Context) -> egui::Frame {let t = Tokens::get();- crate::frame::shell_card(t.dialog_body).stroke(egui::Stroke::new(1.0, t.dialog_border)).corner_radius(t.radius_xl).inner_margin(0.0)+ super::Container::new(ctx, super::Surface::Window).frame(ctx, t.dialog_body, crate::frame::Side::Right).inner_margin(0.0)}- /// Feature surface; Tokens: dialog_body and shell_card/dock_frame's border/shadow tokens.+ /// Feature surface; shared container policy supplies the border and shadow.pub(crate) fn feature_frame(ctx: &egui::Context, layout: crate::shell::LayoutMode, side: crate::frame::Side) -> egui::Frame {- let t = Tokens::get();- if layout == crate::shell::LayoutMode::Floating {- Self::card_frame()- } else {- crate::frame::dock_frame(ctx, side).fill(t.dialog_body).inner_margin(0.0)- }+ super::Container::for_layout(layout, super::Surface::Feature).frame(ctx, Tokens::get().dialog_body, side).inner_margin(0.0)}- /// Palette surface; Tokens: panel, sketch_palette_alpha, radius_xl and shell/dock tokens.+ /// Sketch palette uses the same layout policy as every other workspace panel.pub(crate) fn palette_frame(ctx: &egui::Context, layout: crate::shell::LayoutMode) -> egui::Frame {let t = Tokens::get();- if layout == crate::shell::LayoutMode::Floating {- crate::frame::shell_card(t.panel.gamma_multiply(t.sketch_palette_alpha)).corner_radius(t.radius_xl).inner_margin(0.0)- } else {- crate::frame::dock_frame(ctx, crate::frame::Side::Right).fill(t.panel.gamma_multiply(t.sketch_palette_alpha)).inner_margin(0.0)- }+ super::Container::for_layout(layout, super::Surface::Palette)+ .frame(ctx, t.panel.gamma_multiply(t.sketch_palette_alpha), crate::frame::Side::Right)+ .inner_margin(0.0)}pub(crate) fn new(title: &'a str, id: egui::Id, anchor: egui::Pos2, viewport: egui::Rect, side: crate::frame::Side, frame: egui::Frame) -> Self {@@ -150,34 +147,46 @@ impl<'a> Panel<'a> {}/// The painted anchor also drives dragging, including the shell's edge clearance.- fn bounded_anchor(&self) -> egui::Pos2 {+ fn bounded_anchor(&self, ctx: &egui::Context) -> egui::Pos2 {let viewport = self.viewport;+ let gap = super::Container::new(ctx, super::Surface::Feature).gap();let width = self.width.min(viewport.width().max(0.0));let x = match self.side {- crate::frame::Side::Right => {- self.anchor.x.clamp(viewport.left() + width, (viewport.right() - Tokens::get().space_8).max(viewport.left() + width))- }+ crate::frame::Side::Right => self.anchor.x.clamp(+ viewport.left() + width,+ (viewport.right() - if gap > 0.0 { Tokens::get().space_8 } else { 0.0 }).max(viewport.left() + width),+ ),crate::frame::Side::Left => self.anchor.x.clamp(viewport.left(), viewport.right() - width),};- let chrome =- Tokens::get().form_header_height + Tokens::get().form_footer_height + self.frame.total_margin().sum().y + crate::shell::SHELL_GAP;+ let t = Tokens::get();+ let chrome = t.form_header_height + t.form_footer_height + t.form_gap_y * 2.0 + self.frame.total_margin().sum().y + gap;egui::pos2(x, self.anchor.y.clamp(viewport.top(), (viewport.bottom() - chrome).max(viewport.top())))}- pub(crate) fn window(&self) -> egui::Window<'a> {- let gap = crate::shell::SHELL_GAP;- let frame = self.frame;+ /// One positioned frame supplies both the outer surface and its footer corners.+ fn positioned_frame(&self, ctx: &egui::Context) -> egui::Frame {+ let anchor = self.bounded_anchor(ctx);+ let right = match self.side {+ crate::frame::Side::Right => anchor.x,+ crate::frame::Side::Left => anchor.x + self.width.min(self.viewport.width().max(0.0)),+ };+ super::Container::new(ctx, super::Surface::Feature).tool_frame(self.frame, right >= self.viewport.right() - 0.5)+ }++ pub(crate) fn window(&self, ctx: &egui::Context) -> egui::Window<'a> {+ let gap = super::Container::new(ctx, super::Surface::Feature).gap();let viewport = self.viewport;- let anchor = self.bounded_anchor();+ let anchor = self.bounded_anchor(ctx);let side = self.side;+ let frame = self.positioned_frame(ctx);let margin = frame.total_margin();let width = self.width.min(viewport.width().max(0.0));let inner_width = (width - margin.sum().x).max(0.0);let height = (viewport.bottom() - anchor.y - gap).max(0.0);// Keep drawing safe when even the header/footer cannot fit. egui clips the contents to// the remaining viewport; the normal small-height case still keeps both actions visible.- egui::Window::new(self.title)- .enabled(!crate::issue_report::cad_input_blocked())+ super::Container::new(ctx, super::Surface::Feature)+ .window(self.title).id(self.id).title_bar(false).pivot(match side {@@ -240,16 +249,19 @@ impl<'a> Panel<'a> {let t = Tokens::get();let min = ui.cursor().min;let band = egui::Rect::from_min_size(min, vec2(ui.available_width(), super::header_height()));- crate::frame::drag_dock(ui, band, heading.drag_key, heading.moved, self.bounded_anchor() - heading.docked);+ crate::frame::drag_dock(ui, band, heading.drag_key, heading.moved, self.bounded_anchor(ui.ctx()) - heading.docked);let mut close = false;if let Some(collapsed) = collapsed.as_deref_mut() {collapsible_header(ui, heading.icon, heading.title, collapsed, || close = true);} else {header(ui, heading.icon, heading.title, || close = true);}- let bottom = self.viewport.bottom() - crate::shell::SHELL_GAP - self.frame.inner_margin.bottomf() - self.frame.stroke.width;+ let bottom = self.viewport.bottom()+ - super::Container::new(ui.ctx(), super::Surface::Feature).gap()+ - self.frame.inner_margin.bottomf()+ - self.frame.stroke.width;let footer_height = t.form_footer_height;- let fields_height = (bottom - ui.cursor().top() - footer_height).max(0.0);+ let fields_height = (bottom - ui.cursor().top() - footer_height - ui.spacing().item_spacing.y).max(0.0);let fields_rect = egui::Rect::from_min_size(ui.cursor().min, vec2(ui.available_width(), fields_height));let state = if collapsed.as_deref().copied().unwrap_or(false) {scenario::publish_count("dialog:body:content_height", 0.0);@@ -282,12 +294,13 @@ impl<'a> Panel<'a> {}).inner};+ let corners = self.positioned_frame(ui.ctx()).corner_radius;let action = super::footer(ui,self.ok,self.cancel,valid && !state.applying,- super::Footer { apply: heading.apply_label, status: state.text.as_deref(), ..Default::default() },+ super::Footer { apply: heading.apply_label, status: state.text.as_deref(), corners: Some(corners), ..Default::default() },);if state.busy {let rect = egui::Rect::from_min_size(@@ -354,7 +367,7 @@ impl<'a> Panel<'a> {/// System window built on Panel's shared floating card: 40 pt header, bounded content,/// optional page list, and 48 pt actions with a left slot. Existing IDs and editor policies/// survive the migration. All geometry and colours derive from Tokens.-pub(crate) struct Window<'a> {+pub struct Window<'a> {id: egui::Id,icon: &'a str,title: &'a str,@@ -365,6 +378,7 @@ pub(crate) struct Window<'a> {apply: Option<&'a str>,enter_submits: bool,escape_closes: bool,+ closeable: bool,width: f32,body_padding: bool,left_slot: bool,@@ -372,7 +386,7 @@ pub(crate) struct Window<'a> {impl<'a> Window<'a> {/// A card with OK and Cancel, centred and movable.- pub(crate) fn new(id: egui::Id, icon: &'a str, title: &'a str) -> Self {+ pub fn new(id: egui::Id, icon: &'a str, title: &'a str) -> Self {Self {id,icon,@@ -384,6 +398,7 @@ impl<'a> Window<'a> {apply: None,enter_submits: true,escape_closes: true,+ closeable: true,width: Tokens::get().form_card_width * 1.5,body_padding: true,left_slot: false,@@ -424,13 +439,28 @@ impl<'a> Window<'a> {}/// `cards` times the card width instead of one and a half, for wide footers.- pub(crate) fn cards(mut self, cards: f32) -> Self {+ pub fn cards(mut self, cards: f32) -> Self {if cards.is_finite() && cards > 0.0 {self.width = Tokens::get().form_card_width * cards.min(16.0);}self}+ /// A required choice, such as web recovery, has no dismiss action. Existing data remains+ /// pending until the body explicitly handles a choice.+ pub fn required(mut self) -> Self {+ self.closeable = false;+ self.escape_closes = false;+ self+ }++ /// A standard closable window for platform content and reports. Uses the same header,+ /// bounded scrolling body and fixed outer chrome as every other system window.+ /// Returns whether the shared header's close action was clicked.+ pub fn show_body(self, ctx: &egui::Context, body: impl FnOnce(&mut Ui)) -> bool {+ self.fields().actions("", "", None).show(ctx, true, body).0+ }+/// Draw shared header, content and optional footer, retaining the caller's IDs.pub(crate) fn show(self, ctx: &egui::Context, valid: bool, body: impl FnOnce(&mut Ui)) -> (bool, super::Action) {self.surface(ctx, false, |ui| self.content(ui, valid, body, |_| {}))@@ -453,7 +483,7 @@ impl<'a> Window<'a> {let t = Tokens::get();ui.spacing_mut().item_spacing.y = 0.0;let mut close = false;- header(ui, self.icon, self.title, || close = true);+ header_impl(ui, self.icon, self.title, None, self.closeable, || close = true);egui::Frame::NONE.inner_margin(if self.body_padding { t.space_12 } else { 0.0 }).show(ui, |ui| {ui.spacing_mut().item_spacing.y = t.form_gap_y;if self.body_padding {@@ -499,11 +529,11 @@ impl<'a> Window<'a> {/// The same bounded card frame, either movable or an input-blocking modal.pub(super) fn surface(&self, ctx: &egui::Context, modal: bool, add: impl FnOnce(&mut Ui) -> (bool, super::Action)) -> (bool, super::Action) {- let frame = Panel::card_frame();+ let frame = Panel::card_frame(ctx);let inner_width = (self.width.min(dimension(ctx.content_rect().width())) - frame.total_margin().sum().x).max(0.0);if modal {- let shown = egui::Modal::new(self.id)- .area(egui::Modal::default_area(self.id).fade_in(false))+ let shown = super::Container::new(ctx, super::Surface::Window)+ .modal(self.id).backdrop_color(Tokens::get().tab_on_fill_dark.gamma_multiply(0.35)).frame(frame).show(ctx, |ui| {@@ -513,8 +543,8 @@ impl<'a> Window<'a> {scenario::publish_rect("dialog:window", shown.response.rect);return shown.inner;}- let window = egui::Window::new(self.title)- .enabled(!crate::issue_report::cad_input_blocked())+ let window = super::Container::new(ctx, super::Surface::Window)+ .window(self.title).id(self.id).title_bar(false).collapsible(false)diff --git a/crates/ui-egui/src/ui_kit/panel_tests.rs b/crates/ui-egui/src/ui_kit/panel_tests.rsindex 6365abc3a7..4f899c0109 100644--- a/crates/ui-egui/src/ui_kit/panel_tests.rs+++ b/crates/ui-egui/src/ui_kit/panel_tests.rs@@ -90,7 +90,7 @@ fn panel_keeps_actions_and_body_geometry_in_both_layouts() {let frame = Panel::feature_frame(&ctx, layout, side);let anchor = egui::pos2(vp.right() - crate::shell::SHELL_GAP, vp.top());let panel = Panel::new("Fillet", egui::Id::new("gallery_feature"), anchor, vp, side, frame);- panel.window().show(&ctx, |ui| {+ panel.window(&ctx).show(&ctx, |ui| {panel.feature(ui,FeatureOptions {@@ -147,7 +147,7 @@ fn palette_scrolls_short_views_and_retains_its_status_and_action_handles() {crate::frame::Side::Right,frame,);- panel.window().show(&ctx, |ui| {+ panel.window(&ctx).show(&ctx, |ui| {panel.palette(ui, bottom, 0.0, |ui, part| match part {Part::Header => {status_header(@@ -197,7 +197,7 @@ fn wide_tables_remain_bounded_with_pinned_actions_on_small_viewports() {let side = crate::frame::Side::Right;let anchor = viewport.right_top();let panel = Panel::new("Table", egui::Id::new("wide"), anchor, viewport, side, Panel::feature_frame(&ctx, layout, side)).wide();- panel.window().show(&ctx, |ui| {+ panel.window(&ctx).show(&ctx, |ui| {panel.feature(ui,FeatureOptions {@@ -549,3 +549,97 @@ fn window_footer_is_optional_and_can_contain_only_a_left_action() {assert!(scenario::handle_at("dialog:close").is_some());}}++#[test]+fn universal_containers_follow_one_layout_without_changing_transient_surfaces() {+ use crate::{frame::Side, shell::LayoutMode};+ let ctx = crate::fonts::test_context();+ let previous = crate::theme::is_dark();+ for dark in [false, true] {+ crate::theme::set_dark(dark);+ let t = Tokens::get();+ for surface in [Surface::Panel, Surface::Feature, Surface::Palette, Surface::Chrome] {+ LayoutMode::Floating.publish(&ctx);+ let floating = Container::new(&ctx, surface);+ assert!(floating.floating());+ let floating = floating.frame(&ctx, t.panel, Side::Left);+ assert_ne!(floating.shadow, egui::Shadow::NONE);+ assert!(floating.corner_radius.nw > 0);+ LayoutMode::Docked.publish(&ctx);+ let docked = Container::new(&ctx, surface);+ assert!(!docked.floating());+ assert_eq!(docked.gap(), 0.0);+ let docked = docked.frame(&ctx, t.panel, Side::Left);+ assert_eq!(docked.corner_radius.nw, 0, "{surface:?}: flush with left edge");+ assert_eq!(docked.fill, floating.fill);+ assert_eq!(docked.shadow, egui::Shadow::NONE, "compact surfaces meet their edge without shadows");+ }+ for surface in [+ Surface::ApplicationBar,+ Surface::Window,+ Surface::Popup,+ Surface::Canvas,+ Surface::Toast,+ Surface::Navigation,+ Surface::Viewport,+ Surface::InputShield,+ ] {+ LayoutMode::Floating.publish(&ctx);+ let floating = Container::new(&ctx, surface).frame(&ctx, t.panel, Side::Left);+ LayoutMode::Docked.publish(&ctx);+ let docked = Container::new(&ctx, surface).frame(&ctx, t.panel, Side::Left);+ assert_eq!(floating, docked, "{surface:?}: anchored/modal/canvas content never becomes a workspace dock");+ }+ }+ crate::theme::set_dark(previous);+}++#[test]+fn required_platform_window_keeps_recovery_pending_until_an_explicit_choice() {+ let ctx = crate::fonts::test_context();+ for _ in 0..3 {+ scenario::clear_handles();+ frame(&ctx, vec![], |ui| {+ assert!(!Window::new(ui.id().with("required_recovery"), "restore", "Recover unsaved work?").required().show_body(ui.ctx(), |ui| {+ button(ui, "Recover", Button::Normal);+ button(ui, "Discard", Button::Normal);+ }));+ });+ }+ assert!(scenario::handle_at("dialog:close").is_none(), "recovery cannot be dismissed through the header");+ assert!(scenario::rect_of("dialog:header").is_some());+ assert!(scenario::rect_of("dialog:footer").is_none());+}++#[test]+fn adjoining_compact_frames_share_one_stroke_and_only_exposed_corners_round() {+ use crate::ui_kit::DockEdges;+ use crate::{frame::Side, shell::LayoutMode};+ let ctx = crate::fonts::test_context();+ LayoutMode::Docked.publish(&ctx);+ let t = Tokens::get();+ let browser = Container::new(&ctx, Surface::Panel).joined(DockEdges { left: true, top: true, ..Default::default() });+ let frame = browser.frame(&ctx, t.panel, Side::Left);+ assert_eq!(frame.corner_radius, egui::CornerRadius { nw: 0, ne: 0, sw: 0, se: t.radius_lg });+ let joined = browser.joined(DockEdges { left: true, top: true, bottom: true, ..Default::default() });+ assert_eq!(joined.frame(&ctx, t.panel, Side::Left).corner_radius, egui::CornerRadius::ZERO);+ let a = egui::Rect::from_min_max(egui::Pos2::ZERO, egui::pos2(100.0, 60.0));+ let allocation = frame.outer_rect(a);+ let below = egui::Rect::from_min_size(egui::pos2(a.left(), allocation.bottom()), a.size());+ let beside = egui::Rect::from_min_size(egui::pos2(allocation.right(), a.top()), a.size());+ assert_eq!(frame.outer_rect(below).top(), allocation.bottom(), "vertical allocations touch");+ assert_eq!(frame.outer_rect(beside).left(), allocation.right(), "horizontal allocations touch");+ assert_eq!(frame.widget_rect(a).bottom() - frame.stroke.width, frame.widget_rect(below).top(), "one shared horizontal border");+ assert_eq!(frame.widget_rect(a).right() - frame.stroke.width, frame.widget_rect(beside).left(), "one shared vertical border");+}++#[test]+fn compact_tool_sheet_corners_follow_its_right_edge_contact() {+ let ctx = crate::fonts::test_context();+ crate::shell::LayoutMode::Docked.publish(&ctx);+ let t = Tokens::get();+ let container = Container::new(&ctx, Surface::Feature);+ let frame = container.frame(&ctx, t.dialog_body, crate::frame::Side::Right);+ assert_eq!(container.tool_frame(frame, false).corner_radius, egui::CornerRadius::same(t.radius_lg));+ assert_eq!(container.tool_frame(frame, true).corner_radius, egui::CornerRadius { nw: t.radius_lg, ne: 0, sw: t.radius_lg, se: 0 });+}diff --git a/crates/ui-egui/src/ui_kit/status.rs b/crates/ui-egui/src/ui_kit/status.rsindex e53433fc63..1451fc85ee 100644--- a/crates/ui-egui/src/ui_kit/status.rs+++ b/crates/ui-egui/src/ui_kit/status.rs@@ -23,7 +23,7 @@ pub(crate) fn status_header(ui: &mut egui::Ui, key: &str, name: &str, status: Stui.spacing_mut().interact_size.y = t.form_icon_size;ui.horizontal(|ui| {let (rect, _) = ui.allocate_exact_size(vec2(t.form_icon_size, t.form_icon_size), egui::Sense::hover());- crate::icons::paint(ui.painter(), rect, status.icon, t.icon, t.icon_fill, t.sketch_accent);+ crate::icons::paint_icon(ui.painter(), rect, status.icon, f32::from(t.icon.a()) / 255.0);ui.add(egui::Label::new(RichText::new(name).semibold().size(t.font_label)).truncate()).on_hover_text(name);});ui.horizontal(|ui| {diff --git a/crates/ui-egui/src/ui_kit/table.rs b/crates/ui-egui/src/ui_kit/table.rsindex d09956e6c7..224d11efab 100644--- a/crates/ui-egui/src/ui_kit/table.rs+++ b/crates/ui-egui/src/ui_kit/table.rs@@ -1,5 +1,6 @@//! Dense editable tables. Geometry and typography share the form label-column tokens.use super::metrics::*;+use crate::ui_kit::{Container, Surface};use crate::{scenario, theme::Tokens};use egui::{Response, Ui, vec2};@@ -356,7 +357,7 @@ pub(crate) fn plus_header<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> Opt}scenario::publish_handle("dialog:menu:Add Column", rect.center());scenario::publish_rect("dialog:menu:Add Column", rect);- let popup = egui::Popup::menu(&response);+ let popup = Container::new(ui.ctx(), Surface::Popup).menu(&response);let open = popup.is_open();let result = popup.show(|ui| super::scope(ui, add)).map(|r| r.inner);if open {diff --git a/crates/ui-egui/src/ui_kit_guard_tests.rs b/crates/ui-egui/src/ui_kit_guard_tests.rsindex 7dfcce537d..fa2901b5f9 100644--- a/crates/ui-egui/src/ui_kit_guard_tests.rs+++ b/crates/ui-egui/src/ui_kit_guard_tests.rs@@ -2,6 +2,10 @@use std::path::Path;use syn::visit::{self, Visit};+fn test_only(attrs: &[syn::Attribute]) -> bool {+ attrs.iter().any(|a| a.path().is_ident("test") || (a.path().is_ident("cfg") && a.parse_args::<syn::Path>().is_ok_and(|p| p.is_ident("test"))))+}+/// No caller may bypass the kit for a matching control.const ALLOWED: &[(&str, usize, &str)] = &[];@@ -96,7 +100,7 @@ fn violations(source: &str) -> Vec<String> {}#[test]-fn dense_panels_use_ui_kit_elements() {+fn all_ui_and_apps_use_ui_kit_controls() {let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");let mut failures = Vec::new();fn scan(dir: &Path, prefix: &str, failures: &mut Vec<String>) {@@ -114,10 +118,7 @@ fn dense_panels_use_ui_kit_elements() {continue;}let source = std::fs::read_to_string(&path).unwrap();- // Covers dense adapters and every future Panel caller, including imported Panel aliases.- if name != "dialogs_dense.rs" && name != "sketch_palette.rs" && !source.contains("ui_kit") {- continue;- }+ // Scan every feature module, including ones that have not imported the kit yet.let found = violations(&source);let allowed = ALLOWED.iter().find(|(file, _, _)| *file == relative).map_or(0, |(_, count, _)| *count);if found.len() > allowed {@@ -126,6 +127,7 @@ fn dense_panels_use_ui_kit_elements() {}}scan(&root, "", &mut failures);+ scan(&Path::new(env!("CARGO_MANIFEST_DIR")).join("../../apps"), "apps/", &mut failures);failures.sort();assert!(failures.is_empty(), "Use crate::ui_kit controls:\n{}", failures.join("\n"));}@@ -170,6 +172,13 @@ fn legacy_declarations(source: &str, removed: &[&str]) -> Vec<String> {}visit::visit_item_fn(self, item);}+ fn visit_impl_item_fn(&mut self, item: &'ast syn::ImplItemFn) {+ let name = item.sig.ident.to_string();+ if self.removed.contains(&name.as_str()) {+ self.found.push(name);+ }+ visit::visit_impl_item_fn(self, item);+ }}let mut guard = Declarations { removed, found: Vec::new() };guard.visit_file(&syn::parse_file(source).unwrap());@@ -180,8 +189,15 @@ fn legacy_declarations(source: &str, removed: &[&str]) -> Vec<String> {fn removed_legacy_helpers_stay_removed() {let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");let files: &[(&str, &[&str])] = &[+ ("ui_kit/container.rs", &["report"]),+ ("icons.rs", &["paint"]),+ ("preview.rs", &["draw_active"]),+ ("sketch_tools.rs", &["click_glyph"]),+ ("edit_clipboard.rs", &["can_copy"]),+ ("tool_modifiers.rs", &["ctrl_name", "alt_name", "matches_exact"]),+ ("fonts.rs", &["install_cjk_font"]),("frame.rs", &["docked", "docked_on", "heading", "add_outlined", "content_width", "remember_width", "right_aligned"]),- ("dialogs.rs", &["form_row", "publish_row"]),+ ("dialogs.rs", &["form_row", "publish_row", "is_wide"]),("dialogs_appearance.rs", &["swatch", "swatch_rows"]),("ui_kit/actions.rs",@@ -199,28 +215,6 @@ fn removed_legacy_helpers_stay_removed() {assert!(ALLOWED.is_empty(), "raw-control allowance table must stay empty");}-// Main added these floating windows after the panels branch. The helper is live for them;-// keep the bounded constructor until they migrate, and reject any new legacy callers.-#[test]-fn floating_window_helper_has_only_its_live_consumers() {- let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");- let frame = std::fs::read_to_string(root.join("frame.rs")).unwrap();- assert_eq!(legacy_declarations(&frame, &["window"]), ["window"]);- let mut callers = Vec::new();- for entry in std::fs::read_dir(&root).unwrap() {- let path = entry.unwrap().path();- if path.extension().is_some_and(|e| e == "rs") {- let source = std::fs::read_to_string(&path).unwrap();- // The guard's own expected-call string is test code.- if path.file_name().unwrap() != "ui_kit_guard_tests.rs" && source.contains("crate::frame::window(") {- callers.push(path.file_name().unwrap().to_str().unwrap().to_owned());- }- }- }- callers.sort();- assert_eq!(callers, ["bom_panel.rs", "messages.rs", "mouse_gesture.rs", "space_mouse_calibration.rs"]);-}-#[test]fn guard_detects_editor_constructors_aliases_and_legacy_declarations() {assert_eq!(@@ -241,6 +235,7 @@ fn guard_detects_editor_constructors_aliases_and_legacy_declarations() {5);assert_eq!(legacy_declarations("fn docked_on() {}", &["docked_on"]), ["docked_on"]);+ assert_eq!(legacy_declarations("impl Host { fn report() {} }", &["report"]), ["report"]);}/// Broader than the dense-panel guard: sliders and numeric fields have no caller exceptions,@@ -332,6 +327,16 @@ fn slider_guard(source: &str) -> SliderGuard {sliders: Vec<String>,}impl<'ast> Visit<'ast> for Imports {+ fn visit_item(&mut self, item: &'ast syn::Item) {+ let attrs = match item {+ syn::Item::Mod(i) => &i.attrs,+ syn::Item::Fn(i) => &i.attrs,+ _ => return visit::visit_item(self, item),+ };+ if !test_only(attrs) {+ visit::visit_item(self, item);+ }+ }fn visit_use_tree(&mut self, tree: &'ast syn::UseTree) {if let syn::UseTree::Rename(rename) = tree&& matches!(rename.ident.to_string().as_str(), "Slider" | "DragValue")@@ -498,6 +503,16 @@ fn check_guard(source: &str) -> Vec<String> {#[derive(Default)]struct Imports(Vec<String>);impl<'ast> Visit<'ast> for Imports {+ fn visit_item(&mut self, item: &'ast syn::Item) {+ let attrs = match item {+ syn::Item::Mod(i) => &i.attrs,+ syn::Item::Fn(i) => &i.attrs,+ _ => return visit::visit_item(self, item),+ };+ if !test_only(attrs) {+ visit::visit_item(self, item);+ }+ }fn visit_use_tree(&mut self, tree: &'ast syn::UseTree) {if let syn::UseTree::Rename(rename) = tree&& matches!(rename.ident.to_string().as_str(), "Checkbox" | "RadioButton")@@ -709,6 +724,16 @@ fn disclosure_guard(source: &str) -> DisclosureGuard {#[derive(Default)]struct Imports(Vec<String>);impl<'ast> Visit<'ast> for Imports {+ fn visit_item(&mut self, item: &'ast syn::Item) {+ let attrs = match item {+ syn::Item::Mod(i) => &i.attrs,+ syn::Item::Fn(i) => &i.attrs,+ _ => return visit::visit_item(self, item),+ };+ if !test_only(attrs) {+ visit::visit_item(self, item);+ }+ }fn visit_use_tree(&mut self, tree: &'ast syn::UseTree) {if let syn::UseTree::Rename(rename) = tree&& rename.ident == "CollapsingHeader"diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rsindex 464e89bece..b754118bd3 100644--- a/crates/ui-egui/src/viewport.rs+++ b/crates/ui-egui/src/viewport.rs@@ -2,6 +2,7 @@//! view and the navigation bar.use crate::fonts::RichTextExt as _;+use crate::ui_kit::{Container, Surface};use egui::{Align2, Color32, FontId, Pos2, Rect, Sense, Shape, Stroke, pos2, vec2};use serde_json::json;use solidcraft_engine::Sel;@@ -3096,7 +3097,7 @@ fn paint_toast(ui: &egui::Ui, free: Rect, text: String, error: bool, computing:if !r.is_finite() {return None;}- let frame = egui::Frame::NONE.fill(t.panel).stroke(Stroke::new(1.0, t.border)).corner_radius(t.radius_md).shadow(t.shell_shadow());+ let frame = Container::new(ui.ctx(), Surface::Toast).frame(ui.ctx(), t.panel, crate::frame::Side::Left);ui.painter().add(frame.paint(r.shrink(frame.stroke.width)));let dot = pos2(r.left() + 14.0, r.center().y);if computing {@@ -3619,7 +3620,22 @@ pub(crate) fn scene_palette(dark: bool, mode: crate::theme::ColorVision) -> solipub(crate) fn refresh_layout(app: &mut SolveApp, scale: f32) {if let Some(rect) = app.viewport.rect {let docks = crate::shell::covered_rects(app);- let content = crate::shell::content_rect(app, rect);+ let mut content = crate::shell::content_rect(app, rect);+ // The full-height Assistant reserves control space, while rendering and picking+ // keep the original viewport projection. Ordinary feature dialogs do not move controls.+ if app.ui.layout == crate::shell::LayoutMode::Floating+ && crate::agent_chat::shown(app)+ && app.agent_chat.open+ && !app.preferences.agent_chat_popped+ && !app.preferences.agent_chat_minimized+ && let Some(chat) = app.agent_chat.panel_rect.filter(|r| r.is_finite() && r.is_positive())+ {+ if app.preferences.agent_chat_side == "left" {+ content.min.x = (chat.right() + crate::shell::SHELL_GAP).clamp(content.left(), content.right());+ } else {+ content.max.x = (chat.left() - crate::shell::SHELL_GAP).clamp(content.left(), content.right());+ }+ }app.viewport.layout = Some(if app.ui.layout == crate::shell::LayoutMode::Docked {crate::viewport_layout::Layout::new(rect, &docks, scale, app.preferences.navigator_style)} else {@@ -3761,7 +3777,7 @@ fn signed_axis_view(app: &mut SolveApp, ui: &mut egui::Ui, rect: Rect) {let hr = ui.interact(home, ui.id().with("axis_view_home"), Sense::click());// The home button sits in its own small round chip.painter.circle(home.center(), 12.0, t.overlay.gamma_multiply(if hr.hovered() { 0.9 } else { 0.5 }), Stroke::new(1.0, t.border));- icons::paint(&painter, home, "home", t.icon, if hr.hovered() { t.accent_soft } else { t.overlay }, t.accent);+ icons::paint_icon(&painter, home, "home", f32::from(t.icon.a()) / 255.0);// Cursors: a grabbing hand while orbiting, an open hand over the circle, a pointer on the home// chip (the axis ends keep their pointing hand).if hr.hovered() {@@ -3853,7 +3869,8 @@ fn nav_bar(app: &mut SolveApp, ui: &mut egui::Ui, rect: Rect) {|| menu_open;let mut painter = ui.painter_at(rect);painter.set_opacity(if active || app.preferences.navigator_style == crate::prefs::NavigatorStyle::Axes { 1.0 } else { 0.45 });- painter.rect(bar, t.radius_md, t.overlay, Stroke::new(1.0, t.border), egui::StrokeKind::Inside);+ let surface = Container::new(ui.ctx(), Surface::Navigation).frame(ui.ctx(), t.overlay, crate::frame::Side::Left);+ painter.add(surface.paint(bar.shrink(surface.stroke.width)));let columns = ((bar.width() - 10.0) / 30.0).round().clamp(1.0, 10.0) as usize;for (i, (icon, tip)) in items.iter().enumerate() {let br = Rect::from_min_size(@@ -3873,7 +3890,7 @@ fn nav_bar(app: &mut SolveApp, ui: &mut egui::Ui, rect: Rect) {if active || resp.hovered() {painter.rect_filled(br, t.radius_sm, if active { t.accent_soft } else { t.hover });}- icons::paint(&painter, br.shrink(4.0), icon, t.icon, t.icon_fill, t.accent);+ icons::paint_icon(&painter, br.shrink(4.0), icon, f32::from(t.icon.a()) / 255.0);if resp.on_hover_text(*tip).clicked() {let toggle = |m: NavMode, cur: Option<NavMode>| if cur == Some(m) { None } else { Some(m) };match *icon {@@ -3908,12 +3925,13 @@ fn view_menu(app: &mut SolveApp, ui: &mut egui::Ui, button: Rect) -> bool {let t = crate::theme::Tokens::get();// A preset dropdown extends beyond this menu; let it consume its own clicks.let child_popup_open = egui::Popup::is_any_open(ui.ctx());- let area = crate::frame::area(egui::Id::new("sc_view_menu"))+ let area = Container::new(ui.ctx(), Surface::Popup)+ .area(egui::Id::new("sc_view_menu")).order(egui::Order::Foreground).pivot(Align2::RIGHT_BOTTOM).fixed_pos(button.right_top() - vec2(0.0, 6.0));let r = area.show(ui.ctx(), |ui| {- egui::Frame::popup(ui.style()).show(ui, |ui| {+ Container::popup_frame(ui.style()).show(ui, |ui| {ui.set_width(220.0);ui.label(egui::RichText::new(crate::i18n::tr_label("VIEW")).semibold().color(crate::theme::Tokens::get().text).size(t.font_caption));ui.label(app.tr("ui.graphics_preset"));diff --git a/crates/ui-egui/tests/assistant_render.rs b/crates/ui-egui/tests/assistant_render.rsnew file mode 100644index 0000000000..9902ecb464--- /dev/null+++ b/crates/ui-egui/tests/assistant_render.rs@@ -0,0 +1,110 @@+//! Render the actual Assistant panel with a public-safe transcript, without an agent or GPU.+#[path = "support/raster.rs"]+mod raster;++use std::collections::HashMap;++use egui::{ColorImage, TextureId};+use serde_json::json;+use solidcraft_ui_egui::{+ agent_chat::{+ Item,+ backend::{PermissionOption, ToolStatus},+ },+ scenario::{self, Harness},+ theme,+};++#[test]+fn assistant_transcript_tools_and_approvals_fit_in_both_themes() {+ let previous = theme::is_dark();+ for dark in [false, true] {+ for width in [280.0, 440.0, 760.0] {+ let mut h = Harness::new();+ h.app.home.open = false;+ h.call("ui.resize", json!({"width":1100,"height":1500}));+ h.call("ui.set", json!({"dark":dark}));+ h.call("ui.agent_chat", json!({"features":true,"open":true,"picker":false,"width":width}));+ h.app.agent_chat.items = vec![+ Item::User {+ text: "Make the plate 80 mm wide, soften its edges, and export a STEP file.".into(),+ image: false,+ pictures: vec![],+ files: vec!["plate-notes.txt".into()],+ },+ Item::Agent { thought: false, text: "I’ll update the width and check the selected edges before exporting.".into() },+ Item::Tool {+ id: "width".into(),+ title: "parameters.set".into(),+ kind: "other".into(),+ status: Some(ToolStatus::Completed),+ output: Some("plate_width = 80 mm".into()),+ },+ Item::Tool {+ id: "fillet".into(),+ title: "solid.fillet".into(),+ kind: "other".into(),+ status: Some(ToolStatus::Failed),+ output: Some("The requested radius is too large. Try a smaller radius.".into()),+ },+ Item::Agent {+ thought: false,+ text: "The width is updated. The fillet needs a smaller radius. May I export the current plate for review?".into(),+ },+ Item::Permission {+ key: 1,+ title: "Export plate.step".into(),+ answer: None,+ options: vec![+ PermissionOption { id: "deny".into(), name: "Deny".into(), kind: "reject_once".into() },+ PermissionOption { id: "always".into(), name: "Always allow".into(), kind: "allow_always".into() },+ PermissionOption { id: "once".into(), name: "Allow once".into(), kind: "allow_once".into() },+ ],+ },+ ];+ h.ctx = egui::Context::default();+ h.ctx.enable_accesskit();+ solidcraft_ui_egui::fonts::setup_fonts(&h.ctx);+ theme::apply(&h.ctx);+ let mut textures: HashMap<TextureId, ColorImage> = HashMap::new();+ for _ in 0..8 {+ raster::paint(&mut h, &mut textures, vec![]);+ }+ // Expanding the failed call must preserve every approval and composer target.+ let at = scenario::handle_at("agent_chat:tool:3").expect("failed tool target");+ for pressed in [true, false] {+ raster::paint(+ &mut h,+ &mut textures,+ vec![+ egui::Event::PointerMoved(at),+ egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE },+ ],+ );+ }+ for _ in 0..8 {+ raster::paint(&mut h, &mut textures, vec![]);+ }+ let output = raster::paint(&mut h, &mut textures, vec![]);+ h.output = output.platform_output.clone();+ let screenshot = raster::raster(&mut h, &textures, output);+ let panel = scenario::rect_of("agent_chat:panel").expect("Assistant panel");+ for name in ["permission:once", "permission:always", "permission:deny", "permissions", "send"] {+ let at = scenario::handle_at(&format!("agent_chat:{name}")).expect("Assistant action retained");+ assert!(panel.contains(at), "{name} outside {width} pt panel: {at:?} {panel:?}");+ }+ assert!(h.widget("The requested radius is too large. Try a smaller radius.").is_some(), "failed tool output expands");+ assert_eq!(h.app.agent_chat.waiting(), 1, "rendering and expanding tools never answer an approval");+ let approval = scenario::rect_of("assistant:approval").expect("approval card");+ assert!(approval.height() < 160.0, "approval stays compact at {width}: {approval:?}");+ if let Ok(dir) = std::env::var("SOLIDCRAFT_ASSISTANT_EVIDENCE") {+ std::fs::create_dir_all(&dir).unwrap();+ image::imageops::crop_imm(&screenshot, panel.left() as u32, panel.top() as u32, panel.width() as u32, panel.height() as u32)+ .to_image()+ .save(std::path::Path::new(&dir).join(format!("assistant-{width:.0}-{}.png", if dark { "dark" } else { "light" })))+ .unwrap();+ }+ }+ }+ theme::set_dark(previous);+}diff --git a/crates/ui-egui/tests/icon_audit.rs b/crates/ui-egui/tests/icon_audit.rsindex c642a4a8eb..f931c1db03 100644--- a/crates/ui-egui/tests/icon_audit.rs+++ b/crates/ui-egui/tests/icon_audit.rs@@ -97,6 +97,27 @@ fn ribbon(h: &mut Harness, requested: &mut BTreeMap<String, bool>) {}}+fn assistant(h: &mut Harness, requested: &mut BTreeMap<String, bool>) {+ use solidcraft_ui_egui::agent_chat::{Item, backend::ToolStatus};+ h.call("ui.agent_chat", json!({"features":true,"open":true,"picker":false,"width":440}));+ h.app.agent_chat.items = vec![+ Item::User { text: "Round the plate edges".into(), image: false, pictures: vec![], files: vec![] },+ Item::Tool {+ id: "audit".into(),+ title: "solid.fillet".into(),+ kind: "other".into(),+ status: Some(ToolStatus::Failed),+ output: Some("Use a smaller radius".into()),+ },+ Item::Approval { id: 1, title: "Export plate.step".into(), tool: "export".into(), answer: None },+ ];+ h.frames(3);+ collect(h, "Assistant composer, tool and approval", requested);+ h.app.agent_chat.items.clear();+ h.call("ui.agent_chat", json!({"open":false}));+ h.frames(2);+}+fn panels(h: &mut Harness, requested: &mut BTreeMap<String, bool>) {for command in solidcraft_engine::command_specs() {let panel = solidcraft_ui_egui::dialogs::Dialog::for_command(&h.app, command.id).is_some()@@ -147,6 +168,7 @@ fn requested_menu_icons_have_artwork_and_match_manifest() {h.frames(3);let mut requested = BTreeMap::new();collect(&mut h, "initial browser and timeline", &mut requested);+ assistant(&mut h, &mut requested);ribbon(&mut h, &mut requested);click(&mut h, "appbar:file");diff --git a/crates/ui-egui/tests/scenarios/sketch_centerline_toolbar_icon.json b/crates/ui-egui/tests/scenarios/sketch_centerline_toolbar_icon.jsonindex dab30c7021..cb8307de0a 100644--- a/crates/ui-egui/tests/scenarios/sketch_centerline_toolbar_icon.json+++ b/crates/ui-egui/tests/scenarios/sketch_centerline_toolbar_icon.json@@ -1,6 +1,6 @@[{- "note": "Centerline needs the same CREATE panel placement and icon as its neighbours (sketch.ellipse, sketch.conic): without them it never appeared in the CREATE panel's drop-down at all, pinned or not. Both it and the construction toggle draw their icon in the app's fixed construction orange, not the tab or panel accent colour a caller happens to pass to icons::paint."+ "note": "Centerline needs the same CREATE panel placement and icon as its neighbours (sketch.ellipse, sketch.conic): without them it never appeared in the CREATE panel's drop-down at all, pinned or not. Both it and the construction toggle draw their icon in the app's fixed construction orange, independently of the tab or panel accent colour."},{"start": "sketch.create"},{"click": {"plane": "XY"}},diff --git a/crates/ui-egui/tests/window_widths.rs b/crates/ui-egui/tests/window_widths.rsindex d6047b4110..f80d87fa66 100644--- a/crates/ui-egui/tests/window_widths.rs+++ b/crates/ui-egui/tests/window_widths.rs@@ -1,12 +1,9 @@-//! Every command dialog and every window stays within the width limits of `frame`: started+//! Every command dialog and shared window stays within its content-width limits: started//! through the control channel (the toolbar's way) and measured as drawn.use serde_json::json;use solidcraft_ui_egui::frame::{DIALOG_MAX_W, DIALOG_MIN_W};-// Preserve the established acceptance bounds after retiring the old window helpers.-const DIALOG_WIDE_MAX_W: f32 = 560.0;-const WINDOW_WIDE_MAX_W: f32 = 760.0;use solidcraft_ui_egui::scenario::Harness;/// Widths of the windows on screen (their areas in the middle layer).@@ -24,6 +21,8 @@ fn window_widths(h: &Harness) -> Vec<(egui::Id, f32)> {fn kit_table_limit(id: egui::Id) -> Option<f32> {[egui::Id::new("sc_prefs"),+ egui::Id::new("sc_bom"),+ egui::Id::new("sc_gesture_editor"),egui::Id::new("sc_params_dialog"),egui::Id::new("sc_material_card_review"),egui::Id::new(("sc_dialog", "CONFIGURATIONS")),@@ -50,17 +49,19 @@ fn command_dialogs_shrink_to_their_content_within_limits() {for spec in solidcraft_engine::command_specs() {h.call("ui.start", json!({"command": spec.id}));h.frames(4);- let wide = h.app.dialog.as_ref().is_some_and(|d| d.is_wide());- let max = if wide { DIALOG_WIDE_MAX_W } else { DIALOG_MAX_W };for (layer, w) in window_widths(&h) {// Floating windows a command opened (Parameters…) have their own limit.- let limit = kit_table_limit(layer).unwrap_or(if h.app.dialog.is_some() { max } else { WINDOW_WIDE_MAX_W });+ let limit = kit_table_limit(layer).unwrap_or(if h.app.dialog.is_some() {+ DIALOG_MAX_W+ } else {+ solidcraft_ui_egui::theme::Tokens::get().form_card_width * 3.0+ });if w > limit + slack {bad.push(format!("{} ({layer:?}): {w} px", spec.id));}}// The docked dialog shrinks to its content: most dialogs stay well under the maximum.- if h.app.dialog.is_some() && !wide {+ if h.app.dialog.is_some() {for (_, w) in window_widths(&h) {if w < DIALOG_MIN_W - slack {bad.push(format!("{}: {w} px is narrower than {DIALOG_MIN_W}", spec.id));@@ -111,7 +112,7 @@ fn floating_windows_stay_within_limits() {// Keyboard Shortcuts is a page of Preferences (one window, #36).assert!(ws.len() >= 3, "windows on screen: {ws:?}");for (layer, w) in ws {- let limit = kit_table_limit(layer).unwrap_or(WINDOW_WIDE_MAX_W);+ let limit = solidcraft_ui_egui::theme::Tokens::get().form_card_width * 3.0;assert!(w <= limit + 4.0, "{layer:?} is {w} px wide");}}diff --git a/docs/agent-chat.md b/docs/agent-chat.mdindex c4c80edaa1..2cc7d6d190 100644--- a/docs/agent-chat.md+++ b/docs/agent-chat.md@@ -32,7 +32,12 @@ when you send a message or press **Connect**.## The panel-- **Docking:** drag the panel's header (the dotted grip and the title) to the other half of the+In the floating layout, Assistant fills the viewport height in the shared rounded panel, with+space around its edges. The compass and navigation bar move into the remaining space beside it. It overlays the model without changing the viewport projection;+clicks and scrolling over the panel stay in the chat. The docked layout retains its side panel.++- **Docking:** on the left, Assistant is the first panel, before vertical history and the browser.+ The drag highlight shows the actual destination bounds. Drag the panel's header (the dotted grip and the title) to the other half of thewindow and let go. The side it would land on lights up while you drag. You can also pick**Left** or **Right** under Preferences → AI → Panel. SolidCraft remembers the side.- **Width:** drag the panel's inner edge. SolidCraft remembers it.@@ -42,7 +47,7 @@ when you send a message or press **Connect**.time; **Dock** (the same place in its header) puts it back in the side panel. You can alsopick **Own window** under Preferences → AI → Panel. SolidCraft remembers where the windowwas and how big.-- **Minimise** (the line in the header) folds the panel into a thin strip that keeps the chat+- **Minimise** (the line in the header) folds the panel into a small floating strip (a side strip in the docked layout) that keeps the chaticon, the agent's state, and a count of anything waiting for your answer. Click the icon tounfold it. **Close** (×) hides the panel. Neither stops the agent; **Stop** does.- **The agent switcher** under the title picks the agent for this conversation; switching stops@@ -53,6 +58,13 @@ when you send a message or press **Connect**.endpoint's agent also keeps it as its default model. An agent that reports no models shows nodrop-down.+Messages use right-aligned user bubbles and plain assistant text. Consecutive tool calls share+an activity group: click a row to inspect its output; failed calls have an error tint. Approval+cards retain the agent’s permission choices, and SolidCraft’s own approvals offer Deny, Always+allow and Allow once. The composer’s permission menu uses the same Ask / Edits / All policy as+Preferences, for the selected agent, and shows the actual changes used against the configured+turn limit. Queue, Send now and Stop keep their existing behavior.+## Files and picturesA message can carry up to eight files, to show the agent what you mean: a concept picture, adiff --git a/docs/book/src/guide/ui-tour.md b/docs/book/src/guide/ui-tour.mdindex 0847c8536a..68c84f831f 100644--- a/docs/book/src/guide/ui-tour.md+++ b/docs/book/src/guide/ui-tour.md@@ -86,7 +86,7 @@JSON as you type and shows parser errors. Shift+Enter runs it and keeps the popup open.Right-click a command for its existing pin and toolbar actions.-Preferences (File › Preferences) hold the theme, the units of new designs, the mouse preset, the+Preferences (File › Preferences) hold the theme, workspace layout, the units of new designs, the mouse preset, thevisual style and autosave. Graphics › Colour vision gives the colours that carry a meaning (sketchstates, axes, bends, analyses, icons) values for a weak red, green or blue sense: Protan, Deutan orTritan. In a mode, the faces Draft and Accessibility Analysis mark as failing are striped too.@@ -94,6 +94,21 @@ Command messages and errors show for a few seconds in the status chip at the botHelp › Keyboard Shortcuts lists every key, and File › KeyboardShortcuts changes them.+### Workspace layout++General › **Workspace layout** switches between **Floating** cards and **Compact**+panels. Compact joins the workspace selector and ribbon into one top bar, puts+Browser flush underneath with a square join, and docks tool sheets below the+compass. Tool sheets remain draggable: their four corners round away from the right+edge, and their two right corners square when docked there. Browser keeps only the height its contents need. Assistant remains on the+outside edge, and History keeps its chosen bottom, left or shared Browser column.+The choice is saved between launches. Switching preserves the current tool,+camera, selection and design; Cancel and Restore Defaults work like other preferences.++General › **Show text under ribbon icons** is a separate, saved option for either+layout. Turn it off for shorter icon-only command buttons; tooltips, section names+and command menus remain available.+### Colour themesGeneral › **Theme** lists Dark, Light and System (follows the operating system), the built-in@@ -139,6 +154,9 @@ pills when `on_accent` has less than 4.5:1 contrast with the fill. See thepoint for your own theme.- **Remove** deletes the selected imported theme.+Retired window-band and procedural icon colours in older exports are discarded on import.+Command icons use the shared SVG palette.+Imported themes are kept with your preferences, so they work in the browser app too. Colourvision modes still apply on top of any theme.diff --git a/docs/control-protocol.md b/docs/control-protocol.mdindex 0e85807c6d..1afc1e89e4 100644--- a/docs/control-protocol.md+++ b/docs/control-protocol.md@@ -173,7 +173,7 @@ labels; `prefs:measure_axis_distances` identifies the checkbox.| Method | Params | Notes ||---|---|---|| `ui.inspect` | — | UI state, pending file picker (`file_picker_busy`; compatibility alias `file_dialog_open`, no path), what is hidden (`visibility`: bodies, origin and construction items, sketches, joints (`hidden_joints`, joint ids); set it with the `browser.visibility` command), viewport rect, camera, active tool/dialog, the status line (`status`: text and whether it is an error), hover, renderer, timings, live preview (`active`, `busy`, `error`, `ms`, bodies it stands in for) |-| `ui.set` | any `UiState` field (`tab`, `perspective`, `showGrid`, `dark`, `layout`, …), and `hiddenBodies`, `hiddenOrigin`, `hiddenSketches`, `shownSketches`, `hiddenJoints`, `hiddenFolders` (whole lists; `browser.visibility` changes single items) | `dark: false` switches to the light theme; `layout: "floating"` (default) or `"docked"` selects the transient shell layout without saving a preference. Scenarios use `{"call":"ui.set","params":{"layout":"docked"}}` |+| `ui.set` | any `UiState` field (`tab`, `perspective`, `showGrid`, `dark`, `layout`, …), and `hiddenBodies`, `hiddenOrigin`, `hiddenSketches`, `shownSketches`, `hiddenJoints`, `hiddenFolders` (whole lists; `browser.visibility` changes single items) | `dark: false` switches to the light theme; `layout: "floating"` (default) or `"compact"` (`"docked"` is also accepted) selects the transient shell layout without saving a preference. Scenarios use `{"call":"ui.set","params":{"layout":"docked"}}` || `ui.view` | `view`: `front`, `back`, `top`, `bottom`, `left`, `right`, `iso`, `home`, `fit`; `animate` (bool, default false: snap) | || `ui.camera` | `target?`: `[x, y, z]` (mm), `yaw?`, `pitch?`, `roll?` (radians), `distance?` (mm), `fov?`, `up?`; `fit?`: `true`, `false` or `[occurrence id or name…]` (`root`: the bodies outside every component) | the viewport's orbit camera: it looks at `target` from `distance` away; `yaw` 0 looks along +Y (from the front), `pitch` is the elevation (±π/2: straight down or up), `roll` turns the image. Fields given are set first (the others keep their values), then `fit` frames the listed occurrences (or everything), keeping the direction. The reply, passed back, sets the same view again, so a framing can be stored and replayed. `fov` and `up` follow the perspective setting (`ui.set`) and the up axis preference (`ui.prefs`) and can't change here; a refused field changes nothing || `ui.start` | `command`, `params?` | like a toolbar click: starts the sketch tool or dialog for the command. `params` sets what the dialog opens on, and nothing runs until OK: `joint.drive` takes `joint` (id or name; without it, the joint picked in the browser, else the first joint that moves) and `values` (numbers in degrees or millimetres, or expressions); `motion.study` takes `study` (id or name), which opens that study to edit and chart. A command that takes no params is refused before it starts; a param the dialog doesn't take is refused and the dialog closes |@@ -209,6 +209,7 @@ labels; `prefs:measure_axis_distances` identifies the checkbox.| `ui.capture` | `action?`: `capture`, `revert`, `cancel` | answers the Capture Position question (asked when a command starts or the design is saved while components were moved without capturing); without `action`, what waits || `ui.window` | `action`: minimize, maximize, restore, toggle, close | what the title bar's caption buttons do (on Windows and Linux the application bar is the title bar); close asks about unsaved designs first || `ui.agent_cursor` | `show` (bool), `speed`: a number from 1 to 5 (times the normal speed) or `"instant"` (no animation: the command runs at once and the pointer jumps to where it acted), `follow_camera` (bool); all optional | the settings. While the cursor is shown, `engine.execute` first glides to the command's toolbar button and to each pick, then runs and replies; later requests wait their turn. `"animate": false` on a call skips it |+| `engine.execute` → `view.layout` | `mode`: `floating` or `compact` | Apply and save the workspace layout without opening a dialog, changing the design, resetting the camera or cancelling its active tool. General preferences expose the same choice; `ui.prefs {"layout":"compact"}` also saves it. || `engine.execute` → `view.history_layout` | `width?`, `dock?`: `bottom`, `left`, `under_browser`, `collapsed?` | Resize/dock the history without opening a dialog or changing the design. Contents respond to measured width; browser-stacked history shares its width and splits height equally. One folded header gives the expanded card the rest; two folded headers stay at the top. || `ui.agent_chat` | `features?`, `toolbar_button?`, `permissions?` (`ask`, `edits`, `all`), `add_agent?` ({`name`, `kind`: `acp` or `api`, `command` or `base_url` + `model`}; no keys), `default_agent?`, `agent?` (the conversation's agent, by id), `mode?` (the agent's own mode), `model?` (one of its models), `open?`, `side?` (`left`, `right`), `minimized?`, `popped?` (in its own window), `width?`, `picker?`, `refresh?`, `connect?`, `stop?`, `attach?`: a file's path (a picture, a text file or a CAD file, for the next message; CAD files are imported at once), `remove_file?` (index of a file on the next message), `send?`: text (files alone make a message too), `attach_view?`, `permission?`: an option id or `"cancel"` (the newest question of the agent's own), `approve?`: true, false or `"always"` (the oldest request held for Allow/Deny), `cancel?` (Stop: the queue stays), `send_now?` (stop the running step, then send the queued messages), `remove_pending?` (index), `new_chat?` (clear the chat, new session), `undo?` (the last message's changes) | the chat's state: `features`, `agents` (found and added), `currentAgent`, `state` (off, starting, ready, busy, auth, exited), `popped`, `window` (its place and size), `agent`, `modes`, `mode`, `models`, `model`, `authMethods`, `toolsPort`, `pid`, `waiting`, `turn`, `pending` (queued messages, with their `files`), `attachments` (the files on the next message, by name), `loading` (pictures still being read for it, by name), `stopped`, `detection` and the conversation (`items`). With `features` off only the settings apply. Desktop only; see [Agent chat](agent-chat.md) || `ui.resize` | `width`, `height` | |diff --git a/docs/features.md b/docs/features.mdindex 1196d2dc20..48c8d1911f 100644--- a/docs/features.md+++ b/docs/features.md@@ -592,6 +592,7 @@ SolidCraft's commands by area, generated by `cargo xtask features` from the comm| Delete Named View | `view.delete` | – || Graphics Preset | `view.graphics_preset` | – || History layout | `view.history_layout` | – |+| Workspace layout | `view.layout` | – || List Named Views | `view.list` | – || Navigate View | `view.navigate` | – || Normal to Selection | `view.normal_to` | – |diff --git a/docs/manage-ui-kit-audit.md b/docs/manage-ui-kit-audit.mdindex bb5c6244bc..b13b4ac565 100644--- a/docs/manage-ui-kit-audit.md+++ b/docs/manage-ui-kit-audit.md@@ -6,11 +6,15 @@ is empty. The cleanup removes unused frame chrome, row-publication state, appearwrappers and the plastic editor fallback. Shared controls and their options arelisted in [the kit reference](ui-kit.md).-These specialised surfaces remain in their owners:+Outer hosts for all of the surfaces below now use `ui_kit::Container`; see the+[layout-aware container audit](ui-container-audit.md). The boundaries in this table+concern content and domain behavior, not permission to create a separate panel shell.-| Surface / source | Why it remains outside the kit |+These specialised contents remain in their owners:++| Surface / source | Content ownership || --- | --- |-| Start page: `home.rs` | Painted start tiles, thumbnails and links rather than form cards |+| Start page: `home.rs` | Shared Home components with cached thumbnails and page navigation || Assistant transcript/composer containers, gallery and docking: `agent_chat/panel.rs` | Conversation/media layout, rich selectable content, drag/docking behavior; matching controls use the kit || Native file/program pickers: `file_picker.rs`, host services | Host-native sheets have no egui control surface; load/progress cards use the kit || Command-result ranking/list/pins: `shortcut_box.rs` | Search layout and ranking; popup shell and matching controls use the kit |diff --git a/docs/ui-container-audit.md b/docs/ui-container-audit.mdnew file mode 100644index 0000000000..2f580848b9--- /dev/null+++ b/docs/ui-container-audit.md@@ -0,0 +1,100 @@+# Layout-aware container audit++Shared container foundation (#4411) and compact composition (#2029), on top of+History #3953 and Assistant #3985. General preferences save Floating or Compact;+`view.layout` changes the same preference without changing the design.++## Ownership++`ui_kit::Container` is the only production constructor for outer egui hosts in the+UI crate and the desktop/web apps. `Surface` declares purpose, not a second layout+setting. The shell publishes `LayoutMode` before drawing any page. Adaptive panels+and shell layout use `Container::floating()`; frames use the same policy. There is+one definition of floating/compact chrome and workspace gaps in `ui_kit/container.rs`.+Compact joins the workspace and ribbon, puts Browser flush beneath it with a square+join and content-hugging height, and opens feature/palette sheets at their edge without+card gaps or shadows. Tool sheets remain draggable in either layout; compact sheets+round all four corners when detached and square only the right corners at their right dock. Contacts declare which edges meet; the container rounds only+exposed convex corners and collapses adjoining outlines into one stroke. Stacked+headers cover the viewport without reserving a blank column beneath them.+Floating keeps its card chrome; both layouts retain tool drag offsets.+Menus, system windows, notifications and canvas content retain their existing roles.++The shell still owns ordering, viewport reservations and shared-column geometry.+A container does not infer geometry from a title or panel ID. Browser and History+share a column width; Assistant remains outermost on either side. Tool sheets may overlap Browser and History,+but cannot enter Assistant’s reserved rail or cover the ribbon/workspace selector. Those relationships+must survive the compact composition. Existing `Panel`, `Window`, `Confirm` and+`Menu` are content compositions over the universal container, not alternative hosts.+The low-level window builder is visible only inside the UI kit: feature and platform+windows use the shared composition, including its header and fixed outer frame.++## Inventory and migration++| Surfaces | Owners / composition | Container policy |+| --- | --- | --- |+| Browser, vertical History and Browser/History shared column | `browser`, `timeline_left`, `lib` | Adaptive panel; shared shell placement, resizing and fold state remain with owners |+| Horizontal History | `timeline` | Adaptive panel surface; floating strip or bottom dock |+| Assistant sheet and folded strip | `agent_chat/panel` → `Panel` | Adaptive feature surface; left/right position, resize, drag targets and native pop-out retained |+| Feature forms, Parameters, material review, Redefine Sketch Plane | `dialogs`, `params_dialog`, `material_card_review`, `sketch_attachment_ui` → `Panel` | Adaptive feature surface; bounded anchors and pinned actions retained |+| Sketch options | `sketch_palette` → `Panel` | Adaptive palette surface, preserving transparency |+| Application bar, workspace and ribbon | `toolbar`, `shell` | Chrome hosts; adaptive card geometry comes from the shared policy |+| Render settings | `render_workspace` | Panel host; existing right dock retained |+| Preferences, managers, About, update/install/recovery/crash/issue prompts | `Window`, `Confirm` | System windows and modal sheets retain modality; these are not workspace sidebars |+| BOM, Messages, mouse gestures, 3D mouse calibration | respective modules → `Window::show_body` | Shared header, tokenised frame and bounded body; native egui title bars/resize highlights and legacy report/width helpers removed |+| Web stored-files and web recovery windows | `apps/solidcraft-web` → `Window::show_body` | Same shared composition; recovery requires an explicit choice and cannot be dismissed through the header |+| File/workspace/document/Help/context/overflow menus, radial menu, Select Other and inline rename | respective owners → `Menu` / container popup | Anchored transient hosts; never consume workspace dock space |+| Search, completions, colour and library popovers | `shortcut_box`, kit fields/choice/colour/table | Anchored popup containers; editor focus and completion semantics retained |+| Dimension values, canvas placement values, canvas feedback and History resize seam | `dim_view`, `sketch_dims`, `canvas`, `timeline_left` | Model/control-anchored overlays; retain their coordinates rather than becoming docks |+| Status and loading/progress messages | `viewport`, `open_meshing` | Notification surfaces independent of layout |+| Navigation bar | `viewport` | Shared navigation surface; shell still computes its available canvas bounds |+| Home, model viewport, Render canvas and native Assistant window content | `home`, `lib`, `agent_chat/panel` | Central content hosts, not floating workspace panels |+| Loading input shield | `file_load` | Explicit input shield; must remain interactive while CAD input is blocked |++The compass, geometry previews, drag handles, selection outlines, dimension lines,+charts and thumbnails are drawn content, not independent card hosts. Giving them+workspace docks would be incorrect. egui-managed tooltips and widget internals+remain with their owning shared widget. OS file/program/colour pickers and native+viewport creation remain host services, not in-app panels.++## Enforcement for additions++`cargo xtask ui-containers` is the mandatory repository gate, implemented once in+`xtask/src/ui_containers.rs`. The fast CI job runs it and its regression tests before+approval for heavy UI tests; `cargo xtask ci` runs it too. Draft PRs retain the repository’s+normal CI policy. It recursively parses Rust source and examples under every crate and+app, so new packages and nested modules are included automatically. The sole constructor+implementation exception is the exact `ui_kit/container.rs` path.++The gate rejects raw Area, Panel, Window, Modal, CentralPanel, Popup and SubMenu+constructors, imported/module/type aliases and re-exports, constructor function references,+qualified default constructors, struct literals, macro-hidden hosts and popup shortcuts.+Host APIs are default-denied except for explicit popup-state operations, so new egui+constructors are rejected automatically. Private raw host/module imports are rejected too,+preventing aliases from escaping into another source file.+It also rejects raw outer popup/window frames and custom outer shadows. Invalid Rust+fails closed. Read-only state queries, content-only frames, and test-only fixtures remain+valid; there are no per-feature allowances. This enforces the construction boundary;+surface purpose and hand-painted content still need ordinary review.++New workspace panels must declare an adaptive `Surface` and use this policy for+host choice and outer chrome. Do not introduce another layout bool, raw host,+shadow or mode-specific frame in the feature module. Body groups, message bubbles,+field backgrounds and image frames are content; they may use local zero-shadow+frames or existing kit controls. Add new surface policies in the universal module+and test both modes and themes. Never add a per-file allowance to bypass the guard.++## Retired implementation cleanup++The old report-window builder, window-width enum, heading-band colours and+caller-coloured icon API have been removed. Theme palettes and built-in theme+files no longer carry procedural command-icon colours; SVG artwork has one+palette authority. Only marker/pointer colours remain in the native glyph palette.+Older theme exports discard retired colour names at import so active overrides+still work; these names do not create renderer tokens or appear in new exports.+Unused History height state and superseded click/preview/modifier helpers are+also removed. The remaining `frame` helpers implement dragging and bounded+anchors used by current `Panel` compositions, rather than a second host or style.+Buttons and editors use shared kit controls too, including Assistant code-block+actions. The control guard scans all UI feature modules, even without a kit import,+so adding a new module cannot silently bypass the shared controls.diff --git a/docs/ui-kit.md b/docs/ui-kit.mdindex 241fa580e8..340cfc1ace 100644--- a/docs/ui-kit.md+++ b/docs/ui-kit.md@@ -2,10 +2,17 @@`crates/ui-egui/src/ui_kit/` contains the tokenised controls used by feature dialogs,preferences, manager cards, prompts, context menus and the sketch palette. Import through-`crate::ui_kit::{...}`. The API is crate-visible; implementation modules are private.+`crate::ui_kit::{...}`. Most controls are crate-visible; the container API is public so platform apps use the same hosts.## Composition and rules+- Every outer host uses `ui_kit::Container` with a semantic `Surface`. The shell+ publishes the layout once per frame; `Container::floating()` and `frame()` own+ adaptive placement policy and chrome. `Panel`, `Window`, `Confirm` and `Menu`+ compose it. Raw egui hosts and outer shadows are rejected recursively, including+ platform apps. The mandatory `cargo xtask ui-containers` gate runs in fast CI and+ scans new crates/apps automatically, including macro bodies and alias chains. See the [container audit and migration inventory](ui-container-audit.md).+- Colours, typography, dimensions and spacing come from `theme::Tokens`.- Sliders only via `ui_kit::slider`; `Slider` options change behaviour, never appearance.Raw sliders and duplicate track/thumb painters are forbidden in the UI and apps.@@ -57,6 +64,7 @@ table. Panel/Window/Confirm compositions also have dedicated geometry and intera| Module / element | Use and options | Main tokens || --- | --- | --- |+| assistant: `assistant_header`, `assistant_controls`, `assistant_badge`, `assistant_bubble`, `assistant_prose`, `assistant_tool_frame/row/detail/status`, `AssistantToolState`, `assistant_approval/actions`, `assistant_composer/footer`, `assistant_input`, `assistant_send`, `assistant_empty`, `assistant_banner`, `AssistantTone` | Shared Assistant presentation: 40 pt header, 22 pt state pill, right-aligned user messages limited to 86% width, unboxed assistant prose, bordered tool groups and command detail, tinted approval heading, rounded focused composer with one unframed growing editor and pinned footer, centred setup copy and semantic notices. Closures preserve existing permission choices, protocol routing, queue actions and scenario handles. | `form_header_height/close_size`, `font_label/small/body`, `dialog_body/footer/rule`, `control_fill/border/radius`, `form_ink/dim/primary/success/error`, `accent_soft/selected_ink`, `warning`, radii and spacing || history: `HistoryChip`, `HistoryStyle`, `history_drop_bar`, `history_marker`, `HistorySeam`, `history_seam` | One painter family for bottom chips, 38 pt vertical icon chips and single-line 26 pt name rows (the browser's shared `TREE_ROW_HEIGHT`). Selected items use the active tab tint/ink/border; all variants retain multi-tone feature artwork using one shared kind-to-accent rule (Sketch green, Surface orange, Mesh yellow, Form purple, solids base blue); rolled-back items have 42% opacity. Error/warning badges, suppression strikes, horizontal/vertical drop bars and rollback line/hollow circle are shared. No connector lines. | `control_height`, `space_2/3/4/6/8/10/12/14/16/24`, radii, typography, `TabAccent`, `timeline_item`, `control_border`, `text/dim`, `form_error/fill` || search: `CommandSearch`, `MenuItem::search_row` | Ribbon search composition: one persistent ribbon editor expands from 28 to 40 pt and to 520 pt wide with its right edge anchored, magnifier and S/Esc keycap, 38 pt two-line menu row with 26 pt icon tile, accent bold substring, path, shortcut/kind keycap, counts, JSON detail box and footer. The ordinary 30 pt menu row cannot fit a second line; this variant keeps its enabled/selected states and scenario IDs. Ranking and dispatch stay with the caller. | `form_card_width × 2 − space_8` (520 pt), `control_height`, `space_2/3/4/6/8/10/12/14/16/24`, `radius_xl/control_radius`, `control_fill`, `dialog_body/footer/rule/border`, `form_ink/dim/primary/error/error_fill/success/success_fill`, `selected_ink`, `accent_soft`, typography || menu: `Menu`, `MenuItem` | Shared popup, 30 pt rows, 28 pt icon column, clipped labels, right-aligned mono shortcuts, submenu chevrons, checked/unchecked and document swatches, inert 40% disabled rows and danger ink; headings and separators; ribbon drag/pin targets retained | `dialog_body/border/rule`, `radius_xl`, `control_height/radius`, `form_ink/dim/primary/error`, `accent_soft`, typography and spacing |@@ -95,6 +103,7 @@ table. Panel/Window/Confirm compositions also have dedicated geometry and intera| `list_picker` | Selectable row with caller identity and native checked state | `control_height`, form selection tokens || `popup_list`, `PopupOption` | Focus-neutral suggestions; owner retains keyboard routing | `space_2`, `form_label_width`, `control_height`, form tokens || `color_swatch`, `swatch_grid`, `color_thumbnail` | 30 pt draggable samples, 6 pt grid step gap, selected outer ring and checker pattern under transparent colours; caller payloads retained; local-library thumbnails use 16 pt | `control_height/radius`, `border`, `form_primary`, `control_fill`, `space_2/6/8` |+| `assistant_entry`, `AssistantEntryState` | Application-bar chat icon with quiet, ready, busy, auth, stopped and approval count marks; caller owns state and target | `app_bar`, `agent_ok/busy`, `warning/error`, `font_badge` || actions: `button`, `Button` | Secondary action: `Normal`, `Small`, or `Enabled(bool)` | native sizing, form font/control tokens || `primary_button` | Accent action outside a footer | `accent`, `on_accent`, form tokens || `icon_button_at` | Icon action inside a supplied rectangle | `form_icon_inset`, `text/dim`, icon palette |@@ -185,7 +194,7 @@ helpers private. Add interaction tests when the element introduces an action.The gallery checks geometry, label alignment, handles and effective paint bounds inboth themes. Field/footer/panel tests retain focus, completion and action coverage.-`ui_kit_guard_tests` scans kit callers recursively, rejects raw control constructors+`ui_kit_guard_tests` scans every UI feature module recursively, rejects raw control constructorsand methods (including aliases), and rejects removed legacy helpers. The raw-controlallowance table is empty and guarded against additions. Standard colour/font guards,Clippy, wasm, i18n, assets, icons and layers still apply.@@ -389,3 +398,18 @@ rule. Ranking, command mode and keyboard routing remain with the caller.Generate CPU-rendered evidence of all five search states and the actual ribbon'sclosed/opening/open/closing transition in both themes with`SOLIDCRAFT_SEARCH_EVIDENCE=/tmp/search cargo test -p solidcraft-ui-egui --lib command_search`.++### Compact workspace composition++`Container::gap` and `Container::frame` supply the layout policy for every adaptive+surface. Compact has no gaps or shadows between edge-bound panels; floating uses+the shared card spacing and frame. `Panel` bounds draggable compact sheets to the workspace. The shared frame rounds+all corners away from the right dock and only the left corners while right-docked;+the footer inherits that frame's bottom corners. Both layouts retain drag offsets. Browser uses the same content renderer and width in both modes,+with a square, flush ribbon join in Compact. Non-workspace surfaces keep their roles.+`DockEdges` declares touching edges. The container measures content-hugging cards+before rounding their exposed corners, and aligns touching outlines onto a single+border strip without changing logical panel allocations. The application bar has+an independent surface role.+The saved `Prefs::layout` is changed through `view.layout`; `ui.set` may still make a+transient automation override.diff --git a/xtask/Cargo.toml b/xtask/Cargo.tomlindex 6cf7964563..78df3f6528 100644--- a/xtask/Cargo.toml+++ b/xtask/Cargo.toml@@ -6,5 +6,7 @@ license.workspace = truepublish = false[dependencies]+proc-macro2 = { workspace = true }serde_json = { workspace = true }sha2 = { workspace = true }+syn = { workspace = true, features = ["visit"] }diff --git a/xtask/src/main.rs b/xtask/src/main.rsindex 96faebd550..f193d215b0 100644--- a/xtask/src/main.rs+++ b/xtask/src/main.rs@@ -13,6 +13,7 @@ mod layers;mod licences;mod lists;mod test;+mod ui_containers;mod web_offline;mod web_offline_test;@@ -23,6 +24,7 @@ const USAGE: &str = "\usage: cargo xtask <command>commands:+ ui-containers enforce the universal container for all UI hostslayers enforce the crate dependency layering (plan/architecture.md §3)assets check that every non-code asset file is attributed in ATTRIBUTION.mdapp-icons regenerate shared app-icon exports for Linux, FreeBSD and Windows@@ -64,7 +66,7 @@ commands:web-offline-test [--site DIR]check in headless Chrome that the web app works offline and updates to a newbuild (a stand-in app, or the web build in DIR such as dist/web)- ci fmt --check, assets, icons, licences --check, lists, layers, clippy -D warnings, then the tests+ ci fmt --check, assets, icons, licences --check, lists, layers, ui-containers, clippy -D warnings, then the testswith the wasm check alongside, then web-offline-test when Chrome is installed(stops at the first failing step)";@@ -74,6 +76,7 @@ fn main() -> ExitCode {let rest: Vec<&str> = args.iter().skip(1).map(String::as_str).collect();let result = match args.first().map(String::as_str) {Some("layers") => cmd_layers(),+ Some("ui-containers") => ui_containers::run(&root()),Some("assets") => assets::run(&root()),Some("icons") => icons::run(&root()),Some("app-icons") => app_icons::run(&root()),@@ -374,6 +377,7 @@ fn cmd_ci() -> Result<(), String> {licences::run(&root(), true)?;lists::run(&root(), false)?;cmd_layers()?;+ ui_containers::run(&root())?;let mut c = cargo();c.args(["clippy", "--workspace", "--all-targets", "--profile", "ci", "--", "-D", "warnings"]);run(c, "cargo clippy -D warnings")?;diff --git a/xtask/src/ui_containers.rs b/xtask/src/ui_containers.rsnew file mode 100644index 0000000000..5cddfa9467--- /dev/null+++ b/xtask/src/ui_containers.rs@@ -0,0 +1,487 @@+//! Mandatory source-level boundary for the universal UI container. Runs in fast CI.+use std::path::Path;+use syn::visit::{self, Visit};++/// Every production UI host, including nested modules and platform apps, goes through the+/// universal container. Parse Rust rather than searching strings: aliases cannot bypass this.+#[derive(Default)]+struct ContainerGuard {+ modules: Vec<String>,+ aliases: Vec<String>,+ frames: Vec<String>,+ found: Vec<String>,+}++impl ContainerGuard {+ fn host(name: &str) -> bool {+ matches!(name, "Area" | "Window" | "Modal" | "Panel" | "SidePanel" | "TopBottomPanel" | "CentralPanel" | "Popup" | "SubMenu")+ }++ fn raw_path(&self, names: &[String]) -> bool {+ names.iter().any(|n| self.aliases.contains(n) || self.frames.contains(n))+ || (names.iter().any(|n| n == "egui" || self.modules.contains(n)) && names.iter().any(|n| Self::host(n) || n == "Frame"))+ }++ fn host_path(&self, names: &[String]) -> bool {+ self.raw_path(names) && names.iter().any(|n| Self::host(n) || self.aliases.contains(n))+ }++ // Default-deny host APIs, so an egui update cannot silently add another constructor.+ // Only operations that inspect/control existing popup state are allowed outside the kit.+ fn state_operation(name: &str) -> bool {+ matches!(+ name,+ "is_any_open"+ | "is_id_open"+ | "default_response_id"+ | "id_from_widget_id"+ | "open_id"+ | "toggle_id"+ | "close_all"+ | "close_id"+ | "position_of_id"+ )+ }++ fn content_frame(&self, names: &[String]) -> bool {+ names.iter().any(|n| n == "Frame" || self.frames.contains(n)) && names.last().is_some_and(|n| matches!(n.as_str(), "new" | "default"))+ }++ fn constructor(name: &str) -> bool {+ matches!(name, "new" | "default" | "default_area" | "left" | "right" | "top" | "bottom" | "menu" | "context_menu" | "popup" | "window")+ }++ // syn intentionally leaves macro bodies opaque. Inspect tokens too, including macro_rules+ // definitions, so moving a constructor into a macro does not hide it from the boundary.+ fn macro_tokens(&mut self, tokens: proc_macro2::TokenStream) {+ let tokens: Vec<_> = tokens.into_iter().collect();+ for (index, token) in tokens.iter().enumerate() {+ if let proc_macro2::TokenTree::Group(group) = token {+ self.macro_tokens(group.stream());+ }+ let proc_macro2::TokenTree::Ident(ident) = token else { continue };+ let mut names = vec![ident.to_string()];+ let mut rest = tokens.get(index + 1..).unwrap_or_default();+ while let [proc_macro2::TokenTree::Punct(a), proc_macro2::TokenTree::Punct(b), proc_macro2::TokenTree::Ident(name), tail @ ..] = rest {+ if a.as_char() != ':' || b.as_char() != ':' {+ break;+ }+ names.push(name.to_string());+ rest = tail;+ }+ if self.raw_path(&names)+ && !self.content_frame(&names)+ && names.last().is_some_and(|n| if self.host_path(&names) { !Self::state_operation(n) } else { Self::constructor(n) })+ {+ self.found.push(format!("raw host in macro: {}", names.join("::")));+ }+ if tokens.get(index.wrapping_sub(1)).is_some_and(|t| matches!(t, proc_macro2::TokenTree::Punct(p) if p.as_char() == '.'))+ && matches!(ident.to_string().as_str(), "menu_button" | "menu_image_button" | "context_menu" | "shadow")+ {+ self.found.push(format!("raw popup/frame shorthand in macro: {ident}"));+ }+ }+ }++ fn imported(&mut self, tree: &syn::UseTree, egui: bool) {+ match tree {+ syn::UseTree::Path(p) => self.imported(+ &p.tree,+ p.ident == "egui"+ || self.modules.contains(&p.ident.to_string())+ || (egui && matches!(p.ident.to_string().as_str(), "containers" | "panel" | "window" | "area" | "popup" | "modal" | "frame")),+ ),+ syn::UseTree::Group(g) => {+ for item in &g.items {+ self.imported(item, egui);+ }+ }+ syn::UseTree::Name(n)+ if egui && matches!(n.ident.to_string().as_str(), "containers" | "panel" | "window" | "area" | "popup" | "modal" | "frame") =>+ {+ self.modules.push(n.ident.to_string())+ }+ syn::UseTree::Name(n) if egui && n.ident == "Frame" => self.frames.push(n.ident.to_string()),+ syn::UseTree::Rename(r) if egui && r.ident == "Frame" => self.frames.push(r.rename.to_string()),+ syn::UseTree::Name(n) if egui && Self::host(&n.ident.to_string()) => self.aliases.push(n.ident.to_string()),+ syn::UseTree::Rename(r) if egui && Self::host(&r.ident.to_string()) => self.aliases.push(r.rename.to_string()),+ syn::UseTree::Rename(r)+ if r.ident == "egui"+ || self.modules.contains(&r.ident.to_string())+ || (egui+ && matches!(+ r.ident.to_string().as_str(),+ "self" | "containers" | "panel" | "window" | "area" | "popup" | "modal" | "frame"+ )) =>+ {+ self.modules.push(r.rename.to_string())+ }+ syn::UseTree::Glob(_) if egui => self.found.push("egui glob import hides container constructors".into()),+ _ => {}+ }+ }+}++fn test_only(attrs: &[syn::Attribute]) -> bool {+ attrs.iter().any(|a| a.path().is_ident("test") || (a.path().is_ident("cfg") && a.parse_args::<syn::Path>().is_ok_and(|p| p.is_ident("test"))))+}++impl<'ast> Visit<'ast> for ContainerGuard {+ fn visit_item(&mut self, item: &'ast syn::Item) {+ let attrs = match item {+ syn::Item::Mod(i) => &i.attrs,+ syn::Item::Fn(i) => &i.attrs,+ _ => return visit::visit_item(self, item),+ };+ if !test_only(attrs) {+ visit::visit_item(self, item);+ }+ }++ fn visit_item_extern_crate(&mut self, item: &'ast syn::ItemExternCrate) {+ if item.ident == "egui" {+ if item.rename.is_some() {+ self.found.push("raw egui crate alias bypasses the shared factory".into());+ }+ self.modules.push(item.rename.as_ref().map_or_else(|| item.ident.to_string(), |(_, name)| name.to_string()));+ }+ }++ fn visit_item_use(&mut self, item: &'ast syn::ItemUse) {+ let before = (self.aliases.len(), self.modules.len(), self.frames.len());+ self.imported(&item.tree, false);+ // Private imports can leak into child modules too. Reject them at the boundary,+ // rather than depending on how another source file spells the imported name.+ if self.aliases.len() > before.0 || self.modules.len() > before.1 {+ self.found.push(format!(+ "raw host/module imports bypass the shared factory: {:?} {:?}",+ self.aliases.get(before.0..).unwrap_or_default(),+ self.modules.get(before.1..).unwrap_or_default()+ ));+ } else if !matches!(item.vis, syn::Visibility::Inherited) && self.frames.len() > before.2 {+ self.found.push("raw frame re-export bypasses the shared API".into());+ }+ }++ fn visit_local(&mut self, local: &'ast syn::Local) {+ if let syn::Pat::Type(pat) = &local.pat+ && let syn::Type::Path(path) = pat.ty.as_ref()+ {+ let names = path.path.segments.iter().map(|s| s.ident.to_string()).collect::<Vec<_>>();+ if self.raw_path(&names) && names.iter().any(|n| Self::host(n) || self.aliases.contains(n)) {+ self.found.push("raw host local type bypasses the shared factory".into());+ }+ }+ visit::visit_local(self, local);+ }++ fn visit_item_type(&mut self, item: &'ast syn::ItemType) {+ if let syn::Type::Path(path) = item.ty.as_ref() {+ let names: Vec<_> = path.path.segments.iter().map(|s| s.ident.to_string()).collect();+ if names.iter().any(|n| Self::host(n) || self.aliases.contains(n))+ && names.iter().any(|n| n == "egui" || self.modules.contains(n) || self.aliases.contains(n))+ {+ self.found.push(format!("raw host type alias {}", item.ident));+ }+ }+ visit::visit_item_type(self, item);+ }++ fn visit_expr_path(&mut self, path: &'ast syn::ExprPath) {+ let names: Vec<_> = path.path.segments.iter().map(|s| s.ident.to_string()).collect();+ let constructor = names.last().is_some_and(|n| Self::constructor(n));+ let qualified = path.qself.as_ref().is_some_and(|q| {+ if let syn::Type::Path(p) = q.ty.as_ref() {+ self.raw_path(&p.path.segments.iter().map(|s| s.ident.to_string()).collect::<Vec<_>>())+ } else {+ false+ }+ });+ let raw = self.raw_path(&names) || qualified;+ let blocked = names.last().is_some_and(|n| if self.host_path(&names) || qualified { !Self::state_operation(n) } else { constructor });+ if blocked && raw && !self.content_frame(&names) {+ self.found.push(names.join("::"));+ }+ if names.iter().any(|n| matches!(n.as_str(), "shell_card" | "dock_frame")) {+ self.found.push(names.join("::"));+ }+ visit::visit_expr_path(self, path);+ }++ fn visit_macro(&mut self, mac: &'ast syn::Macro) {+ self.macro_tokens(mac.tokens.clone());+ }++ fn visit_expr_struct(&mut self, expr: &'ast syn::ExprStruct) {+ let names = expr.path.segments.iter().map(|s| s.ident.to_string()).collect::<Vec<_>>();+ if self.raw_path(&names) && names.last().is_some_and(|n| Self::host(n) || self.aliases.contains(n)) {+ self.found.push(format!("raw host struct literal {}", names.join("::")));+ }+ visit::visit_expr_struct(self, expr);+ }++ fn visit_expr_method_call(&mut self, call: &'ast syn::ExprMethodCall) {+ fn container_root(expr: &syn::Expr) -> bool {+ match expr {+ syn::Expr::MethodCall(call) => container_root(&call.receiver),+ syn::Expr::Call(call) => matches!(call.func.as_ref(), syn::Expr::Path(p) if p.path.segments.iter().any(|s| s.ident == "Container")),+ _ => false,+ }+ }+ if call.method == "frame" && container_root(&call.receiver) {+ struct RawFrame<'a> {+ aliases: &'a [String],+ found: bool,+ }+ impl<'ast> Visit<'ast> for RawFrame<'_> {+ fn visit_expr_path(&mut self, expr: &'ast syn::ExprPath) {+ self.found |= expr.path.segments.iter().any(|s| s.ident == "Frame" || self.aliases.contains(&s.ident.to_string()));+ }+ }+ let mut frame = RawFrame { aliases: &self.frames, found: false };+ for arg in &call.args {+ frame.visit_expr(arg);+ }+ if frame.found {+ self.found.push("caller-defined frame on shared outer host".into());+ }+ }+ if matches!(call.method.to_string().as_str(), "context_menu" | "menu_button" | "menu_image_button") {+ let shared = if let syn::Expr::Call(receiver) = call.receiver.as_ref() {+ if let syn::Expr::Path(path) = receiver.func.as_ref() { path.path.segments.iter().any(|s| s.ident == "Container") } else { false }+ } else {+ false+ };+ if !shared {+ self.found.push(format!("raw popup shorthand .{}", call.method));+ }+ }+ if call.method == "shadow" {+ self.found.push("caller-defined outer shadow".into());+ }+ visit::visit_expr_method_call(self, call);+ }+}++fn violations(source: &str) -> Result<Vec<String>, String> {+ let ast = syn::parse_file(source).map_err(|e| format!("cannot parse Rust source: {e}"))?;+ // Collect aliases before visiting calls, also when a use appears after its consumer.+ struct Imports(ContainerGuard);+ impl<'ast> Visit<'ast> for Imports {+ fn visit_item(&mut self, item: &'ast syn::Item) {+ let attrs = match item {+ syn::Item::Mod(i) => &i.attrs,+ syn::Item::Fn(i) => &i.attrs,+ _ => return visit::visit_item(self, item),+ };+ if !test_only(attrs) {+ visit::visit_item(self, item);+ }+ }+ fn visit_item_extern_crate(&mut self, item: &'ast syn::ItemExternCrate) {+ self.0.visit_item_extern_crate(item);+ }+ fn visit_item_use(&mut self, item: &'ast syn::ItemUse) {+ self.0.imported(&item.tree, false);+ }+ }+ let mut imports = Imports(ContainerGuard::default());+ loop {+ let before = (imports.0.aliases.len(), imports.0.modules.len(), imports.0.frames.len());+ imports.visit_file(&ast);+ imports.0.aliases.sort();+ imports.0.aliases.dedup();+ imports.0.modules.sort();+ imports.0.modules.dedup();+ imports.0.frames.sort();+ imports.0.frames.dedup();+ if before == (imports.0.aliases.len(), imports.0.modules.len(), imports.0.frames.len()) {+ break;+ }+ }+ let mut guard = imports.0;+ guard.visit_file(&ast);+ guard.found.sort();+ guard.found.dedup();+ Ok(guard.found)+}++/// Scan current and future crates/apps, including nested source and examples.+/// The implementation module is the sole exception; feature-specific allowances are forbidden.+pub fn run(root: &Path) -> Result<(), String> {+ fn scan(root: &Path, dir: &Path, failures: &mut Vec<String>) -> Result<(), String> {+ for entry in std::fs::read_dir(dir).map_err(|e| format!("{}: {e}", dir.display()))? {+ let entry = entry.map_err(|e| e.to_string())?;+ let path = entry.path();+ let kind = entry.file_type().map_err(|e| e.to_string())?;+ if kind.is_dir() {+ if !matches!(entry.file_name().to_str(), Some("target" | ".git")) {+ scan(root, &path, failures)?;+ }+ } else if path.extension().is_some_and(|e| e == "rs")+ && path.components().any(|c| c.as_os_str() == "src" || c.as_os_str() == "examples")+ && path != root.join("crates/ui-egui/src/ui_kit/container.rs")+ {+ let source = std::fs::read_to_string(&path).map_err(|e| format!("{}: {e}", path.display()))?;+ let found = violations(&source).map_err(|e| format!("{}: {e}", path.display()))?;+ if !found.is_empty() {+ failures.push(format!("{}: {}", path.strip_prefix(root).unwrap_or(&path).display(), found.join(", ")));+ }+ }+ }+ Ok(())+ }+ let mut failures = Vec::new();+ for dir in ["crates", "apps"] {+ scan(root, &root.join(dir), &mut failures)?;+ }+ failures.sort();+ if !failures.is_empty() {+ return Err(format!("Use ui_kit::Container for outer hosts:\n{}", failures.join("\n")));+ }+ println!("ui-containers: all outer hosts use the shared API");+ Ok(())+}++#[cfg(test)]+mod tests {+ use super::*;+ fn container_violations(source: &str) -> Vec<String> {+ violations(source).unwrap()+ }+ #[test]+ fn container_guard_rejects_aliases_nested_modules_and_preserves_state_queries() {+ let bad = container_violations(+ r#"+ use egui::{Area as Floating, Frame as Card};+ mod nested {+ use egui::containers::Window as Dialog;+ fn show() { Dialog::new("Title"); }+ }+ fn show() {+ Floating::new(id); egui::Panel::left("side");+ egui::Modal::new(id); Card::popup(style);+ egui::CentralPanel::default(); frame.shadow(shadow);+ }+ "#,+ );+ assert_eq!(bad.len(), 9, "{bad:?}");+ assert!(+ container_violations(+ r#"+ fn show() {+ ui_kit::Container::new(ctx, ui_kit::Surface::Panel).area(id);+ ui_kit::Window::new(id, icon, title);+ egui::Popup::is_any_open(ctx);+ egui::containers::panel::PanelState::load(ctx, id);+ }+ #[cfg(test)] mod tests { fn fixture() { egui::Window::new("test"); } }+ "#+ )+ .is_empty()+ );+ }++ #[test]+ fn container_guard_catches_module_and_type_aliases_and_popup_shorthand() {+ let bad = container_violations(+ r#"+ use egui as gui;+ use eframe::egui as toolkit;+ use gui::Area as Other;+ type Raw = gui::Window<'static>;+ fn show(ui: &mut Ui) {+ gui::Area::new(id); toolkit::Panel::right(id); Other::new(id);+ response.context_menu(|ui| {}); ui.menu_button("More", |ui| {});+ }+ "#,+ );+ assert_eq!(bad.len(), 9, "{bad:?}");+ }++ #[test]+ fn container_guard_rejects_replacing_the_shared_outer_frame_but_allows_content_groups() {+ assert_eq!(+ container_violations(+ r#"+ fn show() {+ ui_kit::Container::new(ctx, ui_kit::Surface::Panel).edge(id, edge).frame(egui::Frame::NONE.fill(fill));+ }+ "#+ )+ .len(),+ 1+ );+ assert!(+ container_violations(+ r#"+ fn show(ui: &mut Ui) { egui::Frame::NONE.inner_margin(8).show(ui, |ui| {}); }+ "#+ )+ .is_empty()+ );+ }++ #[test]+ fn container_guard_rejects_raw_host_reexports() {+ assert_eq!(container_violations("pub(crate) use egui::Window as OtherHost;").len(), 1);+ }++ #[test]+ fn constructors_cannot_hide_in_function_values_ufcs_macros_or_struct_literals() {+ for source in [+ "fn show() { let make = egui::Window::new; make(title); }",+ "fn show() { egui::Popup::from_response(response); }",+ "fn show() { egui::Window::from_viewport(id, viewport); }",+ "fn show() { egui::Window::future_constructor(title); }",+ "use egui::Area as Alias; mod child;",+ "use egui as gui; mod child;",+ "fn show() { let panel: egui::CentralPanel = Default::default(); }",+ "extern crate egui as gui; fn show() { gui::Area::new(id); }",+ "use egui::containers; fn show() { containers::Window::new(title); }",+ "pub use egui::Frame as Unchecked;",+ "fn show() { <egui::CentralPanel as Default>::default(); }",+ "macro_rules! panel { () => { egui::Area::new(id) }; }",+ "fn show() { wrapper!({ egui::Window::new(title); }); }",+ "fn show() { wrapper!(ui.menu_button(title, content)); }",+ "fn show() { egui::Popup { anchor: x }; }",+ "use egui::containers::window as windows; fn show() { windows::Window::new(title); }",+ "use a::Area as B; use b as a; use c as b; use egui as c; fn show() { B::new(id); }",+ ] {+ assert!(!container_violations(source).is_empty(), "bypass: {source}");+ }+ assert!(container_violations("fn show() { wrapper!(egui::Frame::new().show(ui, body)); }").is_empty());+ assert!(violations("invalid Rust {{").is_err(), "unparseable source fails closed");+ }++ #[test]+ fn new_packages_examples_and_nested_modules_cannot_escape_the_gate() {+ let unique = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_nanos();+ let root = std::env::temp_dir().join(format!("solidcraft-container-guard-{}-{unique}", std::process::id()));+ let source = root.join("crates/future-ui/src/nested/panel.rs");+ let example = root.join("apps/future-platform/examples/viewer.rs");+ let implementation = root.join("crates/ui-egui/src/ui_kit/container.rs");+ for path in [&source, &example, &implementation] {+ std::fs::create_dir_all(path.parent().unwrap()).unwrap();+ }+ std::fs::write(&source, "fn show() { egui::Area::new(id); }").unwrap();+ std::fs::write(&example, "fn main() { egui::Window::new(title); }").unwrap();+ std::fs::write(&implementation, "fn factory() { egui::Window::new(title); }").unwrap();+ let rejected = run(&root).unwrap_err();+ assert!(rejected.contains("future-ui/src/nested/panel.rs"));+ assert!(rejected.contains("future-platform/examples/viewer.rs"));+ assert!(!rejected.contains("ui_kit/container.rs"), "only the implementation is exempt");+ for path in [&source, &example] {+ std::fs::write(path, "fn show() { Container::new(ctx, Surface::Panel).area(id); }").unwrap();+ }+ run(&root).unwrap();+ std::fs::write(&source, "invalid Rust {{").unwrap();+ assert!(run(&root).unwrap_err().contains("cannot parse Rust source"));+ std::fs::remove_dir_all(root).unwrap();+ }++ #[test]+ fn all_workspace_hosts_use_the_container() {+ run(Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap()).unwrap();+ }+}