DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge origin/main into fix/776-unknown-params
Gert Pellin57bb7f210735
diff --cc ROADMAP.mdindex cec69aea9,9f8168e50..a458bd1d5--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -126,9 -128,22 +128,23 @@@ list) · [roadmap.md](docs/roadmap.md)## Progress log+ - **2026-10-13** · Switching between document and parent pages refreshes the canvas immediately, preventing black parent pages and stale document objects when the zoom stays the same. Ordinary edits retain partial repainting. No readiness percentage change.+Newest first.+- **2026-10-13** · Commands refuse parameter keys their params description doesn't name (#776): the control channel, MCP (`-32602`, every `batch` step checked before the first runs) and `designcraft-cli --cmd` answer with an “unknown parameter” error naming the nearest or the accepted keys instead of running with defaults; journals still replay. Descriptions of the table, anchored-object, data-merge and placing commands now name every key they read. No readiness percentage change.+ - **2026-10-13** · Object › Fitting has InDesign's shortcuts: Fill Frame Proportionally ⌘⌥⇧C, Fit Content Proportionally ⌘⌥⇧E, Fit Frame to Content ⌘⌥C, Fit Content to Frame ⌘⌥E, Center Content ⌘⇧E. No readiness percentage change.+ - **2026-10-13** · Gradients between process colours blend as inks, as InDesign shows them: magenta to cyan passes through C 50 M 50 (a light lilac) on screen instead of the darker RGB mix, and a midpoint between CMYK or grey stops no longer turns the PDF shading RGB. No readiness percentage change.+ - **2026-10-14** · The Swatches panel has InDesign's header: a Fill/Stroke proxy, Formatting Affects Container/Text and the Tint of the colour in front (a tint alone keeps each object's own swatch). Clicking a swatch applies it to the fill or stroke in front (of the text, when formatting affects text), and the bottom row has New Color Group, New Swatch and Delete Swatch. No readiness percentage change.+ - **2026-10-14** · With the Page tool, the Control panel shows the page as InDesign's does: W/H from a reference point, page-size preset (US Business Card added), orientation, Liquid Page Rule (now with Controlled by Parent) and Show Parent Page Overlay, which draws the parent page's size over a resized page. No readiness percentage change.+ - **2026-10-14** · On an object-based page the Page tool shows a selected object's liquid pins and resize locks as InDesign does: a click pins a side to the page edge or locks the width or height, with InDesign's tooltips. No readiness percentage change.+ - **2026-10-14** · The Liquid Layout panel follows InDesign's: Liquid Page Rule with the page number, Content › Auto-Fit, and Object Constraints › Resize with Page and Pin for the selected object on an object-based page; Create Alternate Layout moved to the Layout menu. No readiness percentage change.+ - **2026-10-14** · With the Page tool, the Control panel shows the page as InDesign's does: W/H from a reference point, page-size preset (US Business Card added), orientation, Liquid Page Rule (now with Controlled by Parent) and Show Parent Page Overlay, which draws the parent page's size over a resized page. No readiness percentage change.+ - **2026-10-14** · With the Page tool, the Control panel shows the page as InDesign's does: W/H from a reference point, page-size preset (US Business Card added), orientation, Liquid Page Rule and Show Parent Page Overlay, which draws the parent page's size over a resized page. No readiness percentage change.+ - **2026-10-14** · The Page tool works as InDesign's: a click selects a page and shows its handles and liquid page rule; dragging a handle previews the rule and springs back, Alt-drag resizes the page from the opposite edge, Shift keeps proportions, with a W/H readout. No readiness percentage change.+ - **2026-10-14** · With the Page tool, a guide dragged from a ruler is a liquid guide (dashed), as in InDesign; guide-based pages stretch the objects it crosses. No readiness percentage change.+ - **2026-10-14** · The Pages panel menu follows InDesign's order: Insert Pages…, Move Pages…, Duplicate Spread (and at End of Document), Delete Page/Spread, New Parent…, Apply Parent to Pages, Override All Parent Page Items, Parent Pages, Create Alternate Layout…, Numbering & Section Options…, Allow Selected Spread to Shuffle. No readiness percentage change.+ - **2026-10-14** · Pages panel: Alt-drag copies a page, a page dropped on Create new page is duplicated at the end, Edit page size offers the presets and Custom Page Size…; duplicated pages keep their own size, rule and guides; thumbnails of pages of their own size stay in their rows. No readiness percentage change.- **2026-10-12** · Text threads by hand: click a selected text frame's in or out port to loadthe text cursor, then click a frame to thread it, click empty space for a column-wide frame ordrag one (it snaps like frame drawing); Shift-click autoflows, Alt-click stays loaded on thediff --cc crates/engine/src/cmd/find.rsindex ef9157c5f,f57845bab..3a0a910ab--- a/crates/engine/src/cmd/find.rs+++ b/crates/engine/src/cmd/find.rs@@@ -25,9 -30,10 +30,10 @@@ pub fn specs() -> Vec<CommandSpec>"Change All (Object)",[],None,- "{…find.objects criteria, change: {fill?, stroke?, strokeWeight?, opacity?}} → {changed}",+ "{…the criteria of find.objects, change: {fill?, stroke?, strokeWeight?, opacity?}} → {changed}",has_doc,|s, p| {+ s.reset_find_scope();let ids = find_objects(&s.doc()?.doc, p);let ch = p.get("change").cloned().unwrap_or(Value::Null);if !ch.is_object() {@@@ -54,7 -60,7 +60,7 @@@}),cmd!(query "find.find", "Find", ["Edit", "Find/Change"], None,-- "{find, grep?: bool, caseSensitive?: bool, wholeWord?: bool, scope?: document|story|selection, story?} → matches [{story, start, end, text}]",++ "{find, grep?: bool, caseSensitive?: bool, wholeWord?: bool, scope?: document|story|selection, story?, change?, first?, attrs?: find.change's fields (Find/Change sends the same set to all three; ignored here)} → matches [{story, start, end, text}]",has_doc, find),cmd!("find.change",@@@ -65,7 -71,7 +71,7 @@@has_doc,change),- cmd!(noundo "find.next", "Find Next", ["Edit"], Some("Cmd+Alt+F"), "{find, grep?, caseSensitive?, wholeWord?} — selects the next match after the caret", has_doc, find_next),- cmd!(noundo "find.next", "Find Next", ["Edit"], Some("Cmd+Alt+F"), "{find, grep?, caseSensitive?, wholeWord?, scope?: document|story|selection, story?} — Selection starts at its original beginning; later calls advance within the scope", has_doc, find_next),++ cmd!(noundo "find.next", "Find Next", ["Edit"], Some("Cmd+Alt+F"), "{find, grep?, caseSensitive?, wholeWord?, scope?: document|story|selection, story?, change?, first?, attrs?: find.change's fields (ignored here)} — Selection starts at its original beginning; later calls advance within the scope", has_doc, find_next),]}diff --cc crates/engine/src/cmd/layout.rsindex bd5320799,6d6e06ee1..fbdb1436c--- a/crates/engine/src/cmd/layout.rs+++ b/crates/engine/src/cmd/layout.rs@@@ -135,21 -135,63 +135,63 @@@ pub fn specs() -> Vec<CommandSpec>ok()})}),- cmd!("layout.pages.duplicateSpread", "Duplicate Spread", ["Layout", "Pages"], None, "{spread}", has_doc, |s, p| {- let si = p.get("spread").and_then(Value::as_u64).unwrap_or(0) as usize;- s.edit(|d, _| {- let sp = d.spreads.get(si).cloned().ok_or_else(|| bad("layout.pages.duplicateSpread", "no such spread"))?;- let after = d.first_page_of_spread(si) + sp.pages.len() - 1;- let parent = sp.pages.first().and_then(|p| p.parent);- d.insert_pages(Some(after), sp.pages.len(), parent)?;- // Copy items onto the new spread(s) at the same positions.- let src = d.clone();- let ids: Vec<_> = sp.items.iter().map(|i| i.id).collect();- let (nsi, _) = d.page_loc(after + 1).ok_or_else(|| bad("layout.pages.duplicateSpread", "insert failed"))?;- super::object::duplicate_from(d, &src, &ids, designcraft_doc::SpreadRef::Doc(nsi), designcraft_geom::Vec2::ZERO)?;- ok()- })- }),+ cmd!(+ "layout.pages.duplicateSpread",+ "Duplicate Spread",+ ["Layout", "Pages"],+ None,- "{spread, atEnd?: bool (Duplicate Spread at End of Document; the Pages panel's New Page button takes a dropped page there), to?: page index the copied pages move to, in the same undo step (the Pages panel's Alt-drag)} → {page: the copy's first page (0-based)} — the spread's pages (size, margins, columns, guides, liquid rule) and items",++ "{spread, atEnd?: bool (Duplicate Spread at End of Document; the Pages panel's New Page button takes a dropped page there), to?: page index the copied pages move to in the same undo step (the Pages panel's Alt-drag)} → {page: the copy's first page (0-based)} — the spread's pages (size, margins, columns, guides, liquid rule) and items",+ has_doc,+ |s, p| {+ let si = p.get("spread").and_then(Value::as_u64).unwrap_or(0) as usize;+ let at_end = p.get("atEnd").and_then(Value::as_bool).unwrap_or(false);+ let to = p.get("to").and_then(Value::as_u64).map(|t| t as usize);+ s.edit(|d, _| {+ let sp = d.spreads.get(si).cloned().ok_or_else(|| bad("layout.pages.duplicateSpread", "no such spread"))?;+ // The copies land at `to`..`to + n` of the document with them in it.+ if to.is_some_and(|t| t > d.page_count()) {+ return Err(bad("layout.pages.duplicateSpread", "no such page"));+ }+ let after = if at_end { d.page_count() - 1 } else { d.first_page_of_spread(si) + sp.pages.len() - 1 };+ let parent = sp.pages.first().and_then(|p| p.parent);+ d.insert_pages(Some(after), sp.pages.len(), parent)?;+ // The copies are the pages they copy: size, margins, columns, guides, liquid rule.+ for (k, src) in sp.pages.iter().enumerate() {+ let Some((nsi, npi)) = d.page_loc(after + 1 + k) else { continue };+ let nsp = std::sync::Arc::make_mut(&mut d.spreads[nsi]);+ let pg = &mut nsp.pages[npi];+ let dx = pg.x - src.x;+ (pg.width, pg.height, pg.margins, pg.columns, pg.liquid) =+ (src.width, src.height, src.margins, src.columns.clone(), src.liquid);+ pg.guides = src.guides.clone();+ for g in pg.guides.iter_mut().filter(|g| g.orientation == designcraft_doc::Orientation::Vertical) {+ g.position += dx;+ }+ nsp.relayout();+ }+ // Copy items onto the new spread(s) at the same positions.+ let src = d.clone();+ let ids: Vec<_> = sp.items.iter().map(|i| i.id).collect();+ let (nsi, _) = d.page_loc(after + 1).ok_or_else(|| bad("layout.pages.duplicateSpread", "insert failed"))?;+ super::object::duplicate_from(d, &src, &ids, designcraft_doc::SpreadRef::Doc(nsi), designcraft_geom::Vec2::ZERO)?;+ let first = after + 1;+ let Some(to) = to else { return Ok(json!({"page": first})) };+ // Moving a page shifts the ones between; order the moves so each copy keeps+ // its place among the others.+ let n = sp.pages.len();+ if first < to {+ for k in (0..n).rev() {+ d.move_page(first + k, to + k)?;+ }+ } else {+ for k in 0..n {+ d.move_page(first + k, to + k)?;+ }+ }+ Ok(json!({"page": to}))+ })+ }+ ),cmd!("layout.pages.applyParent","Apply Parent to Pages…",