From 767221ca069405fc24d87fde86909ff986aaedeb Mon Sep 17 00:00:00 2001 From: tydude001 Date: Wed, 14 Oct 2026 12:15:46 -0500 Subject: [PATCH 001/326] packaging: RPM requires library sonames, so openSUSE can install it DeckCraft's RPM requires Fedora package names: `libxkbcommon`, `(vulkan-loader or libglvnd-egl)`, `alsa-lib`. openSUSE has no `libxkbcommon`, `vulkan-loader` or `libglvnd-egl` package, so zypper refuses it with `nothing provides 'libxkbcommon'` (exit 4, which the ArtCraft Launcher shows as "error 4"; storytold/craft-launcher#341). Co-Authored-By: Claude Opus 5.5 --- packaging/linux/nfpm.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packaging/linux/nfpm.yaml b/packaging/linux/nfpm.yaml index 0d41fc7ec..0f1111b45 100644 --- a/packaging/linux/nfpm.yaml +++ b/packaging/linux/nfpm.yaml @@ -44,10 +44,17 @@ overrides: - mesa-vulkan-drivers - xdg-desktop-portal rpm: + # Library sonames rather than package names, so the same requirements resolve on Fedora/RHEL + # and openSUSE (which has no libxkbcommon, vulkan-loader or libglvnd-egl package). The glibc + # floor names libm because the binaries' GLIBC_2.35 symbols (hypot, hypotf) are libm's: RHEL 9's + # glibc 2.34 provides libc.so.6(GLIBC_2.35) through backports, but not this, so it refuses. depends: - - libxkbcommon - - alsa-lib - - (vulkan-loader or libglvnd-egl) + - libc.so.6()(64bit) + - libm.so.6(GLIBC_2.35)(64bit) + - libgcc_s.so.1()(64bit) + - libxkbcommon.so.0()(64bit) + - (libvulkan.so.1()(64bit) or libEGL.so.1()(64bit)) + - libasound.so.2()(64bit) recommends: - libwayland-client - libX11 From 78b64ed2fc0e97ef5d84427c7f90f53faff772cd Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 24 Oct 2026 20:22:00 -0700 Subject: [PATCH 002/326] Format: OK in the Font dialog keeps a preset or system text color The Font dialog got a preset text color as its bare name, which dropped its transforms, and a system color as its last RGB value, which dropped the system color. Pressing OK then replaced the run's color: a preset "red" at 50% luminance came back as plain red. `color_command_value` now writes `{"preset": name}` and `{"system": name, "last": "#RRGGBB"}` with the transforms, and `color_value` reads both forms. The dialog's Color field shows the preset's name or the system color's last value. --- crates/engine/src/cmd/format.rs | 29 ++++++++++++++++++++++-- crates/engine/src/cmd/mod.rs | 7 ++++++ crates/ui-egui/src/dialogs.rs | 2 +- crates/ui-egui/src/font_dialog_tests.rs | 30 +++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index a3b2c40a4..31ab7290d 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -597,8 +597,15 @@ fn color_command_value(c: &deckcraft_model::ColorRef) -> Value { o.insert("scheme".into(), json!(slot.xml_name())); Value::Object(o) } - ColorBase::Preset { name } => json!(name), - ColorBase::System { last, .. } => json!(format!("#{}", last.hex())), + ColorBase::Preset { name } => { + o.insert("preset".into(), json!(name)); + Value::Object(o) + } + ColorBase::System { name, last } => { + o.insert("system".into(), json!(name)); + o.insert("last".into(), json!(format!("#{}", last.hex()))); + Value::Object(o) + } } } @@ -1497,6 +1504,24 @@ mod tests { assert!(r.size.is_none() && r.fill.is_none()); } + #[test] + fn font_dialog_ok_keeps_preset_and_system_colors() { + let preset = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] }.with(ColorTransform::LumMod(50_000)); + let system = + ColorRef { base: ColorBase::System { name: "windowText".into(), last: deckcraft_color::Rgba::rgb(0x12, 0x34, 0x56) }, mods: vec![] } + .with(ColorTransform::Alpha(60_000)); + for color in [preset, system] { + let mut s = shape(); + let fill = Fill::Solid { color: color.clone() }; + format_run(&mut s, &|r| r.fill = Some(fill.clone())).unwrap(); + s.ui_requests.clear(); + s.execute("format.fontDialog", &json!({})).unwrap(); + let Some(UiRequest::Dialog { params, .. }) = s.ui_requests.last().cloned() else { panic!("dialog request") }; + s.execute("format.fontDialog", &json!({"color": params["color"]})).unwrap(); + assert_eq!(props(&s).fill, Some(Fill::Solid { color }), "{}", params["color"]); + } + } + #[test] fn font_dialog_with_no_fields_asks_the_ui_to_open() { let mut s = shape(); diff --git a/crates/engine/src/cmd/mod.rs b/crates/engine/src/cmd/mod.rs index fa3f64598..e2442025c 100644 --- a/crates/engine/src/cmd/mod.rs +++ b/crates/engine/src/cmd/mod.rs @@ -371,6 +371,8 @@ pub(crate) fn ok() -> Result { } /// Parse a colour param: `"#RRGGBB"`, `"accent1"`…, or `{"scheme":"accent2","lumMod":75000}`. +/// A preset or system colour keeps its base: `{"preset":"red"}`, +/// `{"system":"windowText","last":"#000000"}`. pub(crate) fn color_param(p: &Value, key: &str) -> Option { let v = p.get(key)?; color_value(v) @@ -391,6 +393,11 @@ pub(crate) fn color_value(v: &Value) -> Option { Value::Object(o) => { let mut c = if let Some(s) = o.get("scheme").and_then(Value::as_str) { ColorRef::scheme(deckcraft_color::SchemeSlot::from_xml(s)?) + } else if let Some(name) = o.get("preset").and_then(Value::as_str) { + ColorRef { base: deckcraft_model::ColorBase::Preset { name: name.to_string() }, mods: vec![] } + } else if let Some(name) = o.get("system").and_then(Value::as_str) { + let last = deckcraft_color::Rgba::from_hex(o.get("last").and_then(Value::as_str)?)?; + ColorRef { base: deckcraft_model::ColorBase::System { name: name.to_string(), last }, mods: vec![] } } else { ColorRef::rgb(deckcraft_color::Rgba::from_hex(o.get("rgb").and_then(Value::as_str)?)?) }; diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index e0fa02e95..e6a70f168 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -2798,7 +2798,7 @@ fn json_text(v: Option<&Value>, default: &str) -> String { fn color_label(v: &Value) -> String { match v { Value::String(s) => s.clone(), - Value::Object(o) => o.get("scheme").or_else(|| o.get("rgb")).and_then(Value::as_str).unwrap_or("").to_string(), + Value::Object(o) => ["scheme", "rgb", "preset", "last"].iter().find_map(|k| o.get(*k)).and_then(Value::as_str).unwrap_or("").to_string(), _ => String::new(), } } diff --git a/crates/ui-egui/src/font_dialog_tests.rs b/crates/ui-egui/src/font_dialog_tests.rs index 06ccfc024..e3076c62a 100644 --- a/crates/ui-egui/src/font_dialog_tests.rs +++ b/crates/ui-egui/src/font_dialog_tests.rs @@ -63,3 +63,33 @@ fn command_t_opens_the_font_dialog_and_cancel_keeps_the_text() { assert!(h.state().dialog.is_none()); assert_eq!(bold_of(&h), None); } + +#[test] +fn preset_and_system_colors_show_in_the_dialog_and_ok_keeps_them() { + for (color, shown) in + [(json!({"preset": "red", "lumMod": 50000}), "red"), (json!({"system": "windowText", "last": "#123456", "alpha": 60000}), "#123456")] + { + let mut h = harness(); + h.state_mut().session.execute("format.fontDialog", &json!({ "color": color })).unwrap(); + let before = fill_of(&h); + assert!(before.is_some()); + h.get_by_label("Font…").click(); + h.run_steps(2); + let d = h.state().dialog.as_ref().expect("font dialog"); + assert_eq!(d.fields.get("color").map(String::as_str), Some(shown)); + h.get_by_label("OK").click_accesskit(); + h.run_steps(1); + assert!(h.state().dialog.is_none(), "status {:?}", h.state().status); + assert_eq!(fill_of(&h), before, "{shown}"); + } +} + +fn fill_of(h: &Harness<'_, SlideApp>) -> Option { + let st = h.state().session.active().unwrap(); + st.selected_shapes() + .first() + .and_then(|sh| sh.text.as_ref()) + .and_then(|t| t.paragraphs.first()) + .and_then(|p| p.runs.first()) + .and_then(|r| r.props.fill.clone()) +} From aa0afa1462cb933b08663001d7a8d0fcdc0b26d2 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 24 Oct 2026 21:14:43 -0700 Subject: [PATCH 003/326] Format: the Font dialog's color keeps inv, comp and gray, and a color's alpha A transform without a value (inv, comp, gray) is written as `true`, and an RGB or a system color's last value that is not opaque is written as `#RRGGBBAA`, so OK in the Font dialog keeps both. --- crates/engine/src/cmd/format.rs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index 31ab7290d..b1e01ae93 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -583,14 +583,15 @@ fn color_command_value(c: &deckcraft_model::ColorRef) -> Value { use deckcraft_model::ColorBase; let mut o = serde_json::Map::new(); for m in &c.mods { - if let Some(v) = m.value() { - o.insert(m.xml_name().to_string(), json!(v)); - } + // `inv`, `comp` and `gray` have no value. + o.insert(m.xml_name().to_string(), m.value().map_or(json!(true), |v| json!(v))); } + // `#RRGGBB`, or `#RRGGBBAA` for a colour that is not opaque. + let hex = |c: &deckcraft_color::Rgba| if c.a == 255 { format!("#{}", c.hex()) } else { format!("#{}{:02X}", c.hex(), c.a) }; match &c.base { - ColorBase::Rgb { rgb } if o.is_empty() => json!(format!("#{}", rgb.hex())), + ColorBase::Rgb { rgb } if o.is_empty() => json!(hex(rgb)), ColorBase::Rgb { rgb } => { - o.insert("rgb".into(), json!(format!("#{}", rgb.hex()))); + o.insert("rgb".into(), json!(hex(rgb))); Value::Object(o) } ColorBase::Scheme { slot } => { @@ -603,7 +604,7 @@ fn color_command_value(c: &deckcraft_model::ColorRef) -> Value { } ColorBase::System { name, last } => { o.insert("system".into(), json!(name)); - o.insert("last".into(), json!(format!("#{}", last.hex()))); + o.insert("last".into(), json!(hex(last))); Value::Object(o) } } @@ -1505,12 +1506,16 @@ mod tests { } #[test] - fn font_dialog_ok_keeps_preset_and_system_colors() { + fn font_dialog_ok_keeps_the_text_color() { + use deckcraft_color::Rgba; let preset = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] }.with(ColorTransform::LumMod(50_000)); - let system = - ColorRef { base: ColorBase::System { name: "windowText".into(), last: deckcraft_color::Rgba::rgb(0x12, 0x34, 0x56) }, mods: vec![] } - .with(ColorTransform::Alpha(60_000)); - for color in [preset, system] { + let system = ColorRef { base: ColorBase::System { name: "windowText".into(), last: Rgba::rgb(0x12, 0x34, 0x56) }, mods: vec![] } + .with(ColorTransform::Alpha(60_000)); + // A transform without a value, and a colour that is not opaque. + let inverted = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] }.with(ColorTransform::Inv); + let translucent = ColorRef { base: ColorBase::System { name: "windowText".into(), last: Rgba::rgba(0x12, 0x34, 0x56, 0x80) }, mods: vec![] }; + let rgb = ColorRef::rgb(Rgba::rgba(0x12, 0x34, 0x56, 0x80)); + for color in [preset, system, inverted, translucent, rgb] { let mut s = shape(); let fill = Fill::Solid { color: color.clone() }; format_run(&mut s, &|r| r.fill = Some(fill.clone())).unwrap(); From 36bf5591c1b4f83bafed23539ef28faf4a8a89b4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 25 Oct 2026 08:57:11 -0700 Subject: [PATCH 004/326] Format: spell color the American way in the new comments --- crates/engine/src/cmd/format.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index 7fba5ce04..dcb4ba3b8 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -594,7 +594,7 @@ fn color_command_value(c: &deckcraft_model::ColorRef) -> Value { // `inv`, `comp` and `gray` have no value. o.insert(m.xml_name().to_string(), m.value().map_or(json!(true), |v| json!(v))); } - // `#RRGGBB`, or `#RRGGBBAA` for a colour that is not opaque. + // `#RRGGBB`, or `#RRGGBBAA` for a color that is not opaque. let hex = |c: &deckcraft_color::Rgba| if c.a == 255 { format!("#{}", c.hex()) } else { format!("#{}{:02X}", c.hex(), c.a) }; match &c.base { ColorBase::Rgb { rgb } if o.is_empty() => json!(hex(rgb)), @@ -1552,7 +1552,7 @@ mod tests { let preset = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] }.with(ColorTransform::LumMod(50_000)); let system = ColorRef { base: ColorBase::System { name: "windowText".into(), last: Rgba::rgb(0x12, 0x34, 0x56) }, mods: vec![] } .with(ColorTransform::Alpha(60_000)); - // A transform without a value, and a colour that is not opaque. + // A transform without a value, and a color that is not opaque. let inverted = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] }.with(ColorTransform::Inv); let translucent = ColorRef { base: ColorBase::System { name: "windowText".into(), last: Rgba::rgba(0x12, 0x34, 0x56, 0x80) }, mods: vec![] }; let rgb = ColorRef::rgb(Rgba::rgba(0x12, 0x34, 0x56, 0x80)); From 37ac38cac784fb60fbff0358d539fdaaed629d97 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 25 Oct 2026 13:26:55 -0700 Subject: [PATCH 005/326] Format: the Font dialog keeps the order of a color's transforms The dialog's color parameter lists transforms in order under `mods`, in the form the model stores them, so OK keeps repeats such as [inv, inv] and transforms that are not in alphabetical order. Color parameters accept `mods` alongside the keyed form. --- crates/engine/src/cmd/format.rs | 11 +++++++---- crates/engine/src/cmd/mod.rs | 11 ++++++++++- crates/ui-egui/src/font_dialog_tests.rs | 9 ++++++--- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index dcb4ba3b8..8b8785aa8 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -590,9 +590,9 @@ fn font_edits(p: &Value) -> Result { fn color_command_value(c: &deckcraft_model::ColorRef) -> Value { use deckcraft_model::ColorBase; let mut o = serde_json::Map::new(); - for m in &c.mods { - // `inv`, `comp` and `gray` have no value. - o.insert(m.xml_name().to_string(), m.value().map_or(json!(true), |v| json!(v))); + // An ordered list, so the order of the transforms and repeated ones such as `[inv, inv]` are kept. + if !c.mods.is_empty() { + o.insert("mods".into(), json!(c.mods)); } // `#RRGGBB`, or `#RRGGBBAA` for a color that is not opaque. let hex = |c: &deckcraft_color::Rgba| if c.a == 255 { format!("#{}", c.hex()) } else { format!("#{}{:02X}", c.hex(), c.a) }; @@ -1556,7 +1556,10 @@ mod tests { let inverted = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] }.with(ColorTransform::Inv); let translucent = ColorRef { base: ColorBase::System { name: "windowText".into(), last: Rgba::rgba(0x12, 0x34, 0x56, 0x80) }, mods: vec![] }; let rgb = ColorRef::rgb(Rgba::rgba(0x12, 0x34, 0x56, 0x80)); - for color in [preset, system, inverted, translucent, rgb] { + // A repeated transform, and two transforms in an order that is not alphabetical. + let twice = inverted.clone().with(ColorTransform::Inv); + let ordered = ColorRef::scheme(SchemeSlot::Accent2).with(ColorTransform::LumOff(20_000)).with(ColorTransform::LumMod(50_000)); + for color in [preset, system, inverted, translucent, rgb, twice, ordered] { let mut s = shape(); let fill = Fill::Solid { color: color.clone() }; format_run(&mut s, &|r| r.fill = Some(fill.clone())).unwrap(); diff --git a/crates/engine/src/cmd/mod.rs b/crates/engine/src/cmd/mod.rs index f0f1141fb..9c6aadd2f 100644 --- a/crates/engine/src/cmd/mod.rs +++ b/crates/engine/src/cmd/mod.rs @@ -372,7 +372,8 @@ pub(crate) fn ok() -> Result { /// Parse a colour param: `"#RRGGBB"`, `"accent1"`…, or `{"scheme":"accent2","lumMod":75000}`. /// A preset or system colour keeps its base: `{"preset":"red"}`, -/// `{"system":"windowText","last":"#000000"}`. +/// `{"system":"windowText","last":"#000000"}`. `"mods"` lists transforms in order: +/// `{"preset":"red","mods":[{"op":"inv"},{"op":"inv"}]}`. pub(crate) fn color_param(p: &Value, key: &str) -> Option { let v = p.get(key)?; color_value(v) @@ -412,6 +413,10 @@ pub(crate) fn color_value(v: &Value) -> Option { c.mods.push(t); } } + // `mods` lists transforms in order, repeats included: `[{"op":"inv"},{"op":"lumMod","val":50000}]`. + if let Some(list) = o.get("mods") { + c.mods.extend(serde_json::from_value::>(list.clone()).ok()?); + } Some(c) } _ => None, @@ -669,5 +674,9 @@ mod tests { assert!(color_value(&json!({"preset": name})).is_some(), "{name}"); } assert!(color_value(&json!({"system": "3dDkShadow", "last": "#000000"})).is_some()); + let listed = color_value(&json!({"preset": "red", "mods": [{"op": "inv"}, {"op": "lumOff", "val": 20_000}, {"op": "inv"}]})); + let mods = vec![ColorTransform::Inv, ColorTransform::LumOff(20_000), ColorTransform::Inv]; + assert_eq!(listed, Some(ColorRef { base: ColorBase::Preset { name: "red".into() }, mods })); + assert_eq!(color_value(&json!({"preset": "red", "mods": [{"op": "notATransform"}]})), None); } } diff --git a/crates/ui-egui/src/font_dialog_tests.rs b/crates/ui-egui/src/font_dialog_tests.rs index e3076c62a..60b18f02d 100644 --- a/crates/ui-egui/src/font_dialog_tests.rs +++ b/crates/ui-egui/src/font_dialog_tests.rs @@ -66,9 +66,12 @@ fn command_t_opens_the_font_dialog_and_cancel_keeps_the_text() { #[test] fn preset_and_system_colors_show_in_the_dialog_and_ok_keeps_them() { - for (color, shown) in - [(json!({"preset": "red", "lumMod": 50000}), "red"), (json!({"system": "windowText", "last": "#123456", "alpha": 60000}), "#123456")] - { + for (color, shown) in [ + (json!({"preset": "red", "lumMod": 50000}), "red"), + (json!({"system": "windowText", "last": "#123456", "alpha": 60000}), "#123456"), + (json!({"preset": "red", "mods": [{"op": "inv"}, {"op": "inv"}]}), "red"), + (json!({"scheme": "accent2", "mods": [{"op": "lumOff", "val": 20000}, {"op": "lumMod", "val": 50000}]}), "accent2"), + ] { let mut h = harness(); h.state_mut().session.execute("format.fontDialog", &json!({ "color": color })).unwrap(); let before = fill_of(&h); From 11362ac715857a6721873ffbff08ad2ba4a2d938 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:13:21 -0500 Subject: [PATCH 006/326] docs: path map for the #1433 module split; drop CLAUDE.md references to the gitignored plan/ directory --- CLAUDE.md | 6 ++-- docs/module-split-map.md | 67 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 docs/module-split-map.md diff --git a/CLAUDE.md b/CLAUDE.md index 67853ff06..334385580 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ Read [AGENTS.md](AGENTS.md) first: its rules (asset policy, clean room, never cr win over anything here. ## Start every session -1. Read `plan/STATUS.md`, then the current milestone in `plan/execution-plan.md`. +1. Read `ROADMAP.md` and `docs/roadmap.md`. 2. Read `../../craftrules/AGENTS.md` and the standards it lists for your task. 3. Run `cargo xtask ci` before you change anything, so you know the tree is green. @@ -13,5 +13,5 @@ win over anything here. - Look at UI changes: `deckcraft --sample --control 7990` + `ui.screenshot`, or `deckcraft-cli render`. - Commit after each landed arc (`M.: what`) and push to `origin main`. -- Keep `ROADMAP.md`, the progress docs in `docs/` (AGENTS.md §7) and `plan/STATUS.md` current. -- Don't ask the user questions; record genuinely-theirs decisions in `plan/STATUS.md`. +- Keep `ROADMAP.md` and the progress docs in `docs/` (AGENTS.md §7) current. +- Don't ask the user questions; record genuinely-theirs decisions in `ROADMAP.md`. diff --git a/docs/module-split-map.md b/docs/module-split-map.md new file mode 100644 index 000000000..fc1ba1d38 --- /dev/null +++ b/docs/module-split-map.md @@ -0,0 +1,67 @@ +# Where things moved in #1433 + +[#1433](https://github.com/storytold/deckcraft/pull/1433) (merge `ee875abf`) split the largest +source files into modules. Nothing changed in behaviour, but a branch that edits an old file now +conflicts with it. This note says which new modules received each old file's code, so you can place +your hunks by hand after `git merge origin/main`. Paths are relative to `crates/` unless noted; each +old file stays as the parent module and keeps its re-exports, so import paths are unchanged. + +To find the exact new home of one function: `git grep -n 'fn name' origin/main -- crates` (or +`git log -S'fn name' --oneline origin/main -- crates`). + +## Plain renames (content unchanged) + +| Old | New | +|---|---| +| `engine/src/cmd/mod.rs` | `engine/src/cmd.rs` | +| `opus/src/celt/mod.rs`, `opus/src/silk/mod.rs` | `opus/src/celt.rs`, `opus/src/silk.rs` | +| `pptx/src/read/mod.rs`, `pptx/src/write/mod.rs` | `pptx/src/read.rs`, `pptx/src/write.rs` | +| `ui-egui/src/backstage_tests.rs` | `ui-egui/src/backstage/tests.rs` | +| `ui-egui/src/selpane_tests.rs`, `sorter_tests.rs` | `ui-egui/src/panels/selpane/ui_tests.rs`, `ui-egui/src/sorter/ui_tests.rs` | + +`ui-egui/src` files moved into a folder: `guides_tests`, `preview`, `ruler_tests`, `squiggles` → +`canvas/`; `columns_dialog_tests`, `credits`, `font_dialog_tests`, `paragraph_dialog_tests`, +`photo_album_tests`, `preferences_tests`, `size_position_tests`, `spelling_tests`, +`theme_colors_tests`, `theme_fonts_tests`, `updates_ui` → `dialogs/`; `animtimeline`, +`background_tests`, `fillui`, `notes`, `pattern_fill_tests`, `smartart_tests`, `thesaurus_tests`, +`thumbs` → `panels/`; `align_tests`, `drawtable_tests`, `effects_tests`, `icons_popup_tests`, +`inktoshape_tests`, `master_layout_tests`, `qat` → `ribbon/`. + +## Split files (old file → new modules, all under the old file's folder) + +Each old file now holds only the module list and shared items. + +| Old file | New modules | +|---|---| +| `apps/deckcraft/src/control_server.rs` | `control_server/tests.rs` (its tests) | +| `engine/src/cmd/design.rs` | `design/{colors, master_view, slide_background, slide_setup, browse_theme_tests, tests}.rs` | +| `engine/src/cmd/format.rs` | `format/{font, paragraph, painter, ruler, text_effects}.rs` | +| `engine/src/cmd/insert.rs` | `insert/{album, chart, links, picture, text_fields, icon_and_picture_tests}.rs` | +| `engine/src/cmd/shape.rs` | `shape/{appearance, freeform, picture, size}.rs` | +| `engine/src/cmd/smartart.rs` | `smartart/{diagrams, edit, layout, nodes, paint}.rs` | +| `engine/src/cmd/text.rs` | `text/{autocorrect, caret, editing, formatting, ime, layout}.rs` | +| `engine/src/tools.rs` | `tools/{click, drag, geometry, hit, pointer}.rs` | +| `fonts/src/lib.rs`, `format/src/lib.rs` | `src/tests.rs` (their tests) | +| `geom/src/preset.rs` | `preset/{build, builder, catalog, shapes, tests}.rs` | +| `media/src/player.rs` | `player/tests.rs` | +| `render/src/lib.rs` | `src/{geometry, opts, raster, renderer, slide, stroke, text_draw}.rs` | +| `text/src/lib.rs` | `src/{autonum, breaking, layout, run, shape, symbol}.rs` | +| `ui-egui/src/lib.rs` | `src/{app, state, services, clock, ime_hooks, tests}.rs`; the `SlideApp` impl is in `app.rs` and `app/{clipboard, commands, control, files, frame, ime, input, keys, playback}.rs` | +| `ui-egui/src/panes.rs` (deleted) | `panels.rs` and `panels/{animation, background, comments, designer, format_shape, smartart, thesaurus}.rs` (format-shape pane → `format_shape.rs`, slide background → `background.rs`, animation pane → `animation.rs`, comments and revisions → `comments.rs`) | +| `ui-egui/src/backstage.rs` | `backstage/{files, info, print}.rs` | +| `ui-egui/src/canvas.rs` | `canvas/{context_menu, guides, ime, input, media, overlays, rulers, scroll, tests}.rs` | +| `ui-egui/src/capture.rs` | `capture/tests.rs` | +| `ui-egui/src/dialogs.rs` | `dialogs/{about, alt_text, body, columns, date_time, equation, export, find, font, grid_options, hyperlink, language, paragraph, photo_album, preferences, size_position, slide_size, tabs, theme_colors, theme_fonts, trim, zoom, tests}.rs`; dialogs not listed (for example most bodies) are in `body.rs` | +| `ui-egui/src/icons.rs` | `icons/{draw, geometry}.rs` | +| `ui-egui/src/ribbon.rs` | `ribbon/{animations, arrange, chart, design, draw, galleries, home, insert, masters, picture_format, playback, review, shape_format, slide_show, smartart, table, title_bar, transitions, view}.rs`; one file per ribbon tab, plus `galleries.rs` for the shared gallery popups | +| `ui-egui/src/show.rs` | `show/{keys, media, presenter, render, ui, zoom, tests}.rs` | + +Also touched: `engine/src/file_access.rs` (16 lines), `docs/file-format-parity.md`, `docs/gaps.md` +and `packaging/common.sh` (one line each, path references). + +## Carrying a branch forward + +1. `git merge origin/main` (never rebase) and let git list the conflicting old files. +2. For each conflicting hunk, find the new module above, apply the hunk there by hand, and keep + the old file's side only for module declarations. +3. Run `cargo xtask ci`. From 1da4e33490aefdeae565bbb2ac63fdc0b162d0d9 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Tue, 27 Oct 2026 20:53:24 -0500 Subject: [PATCH 007/326] docs: qualify what the old files keep, list style.rs, say where panes.rs hunks go --- docs/module-split-map.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/module-split-map.md b/docs/module-split-map.md index fc1ba1d38..7ee0f7ce1 100644 --- a/docs/module-split-map.md +++ b/docs/module-split-map.md @@ -29,7 +29,8 @@ To find the exact new home of one function: `git grep -n 'fn name' origin/main - ## Split files (old file → new modules, all under the old file's folder) -Each old file now holds only the module list and shared items. +Each old file keeps its module declarations and any code that was not moved; several rows move +only the tests. | Old file | New modules | |---|---| @@ -45,7 +46,7 @@ Each old file now holds only the module list and shared items. | `geom/src/preset.rs` | `preset/{build, builder, catalog, shapes, tests}.rs` | | `media/src/player.rs` | `player/tests.rs` | | `render/src/lib.rs` | `src/{geometry, opts, raster, renderer, slide, stroke, text_draw}.rs` | -| `text/src/lib.rs` | `src/{autonum, breaking, layout, run, shape, symbol}.rs` | +| `text/src/lib.rs` | `src/{autonum, breaking, layout, run, shape, style, symbol}.rs` | | `ui-egui/src/lib.rs` | `src/{app, state, services, clock, ime_hooks, tests}.rs`; the `SlideApp` impl is in `app.rs` and `app/{clipboard, commands, control, files, frame, ime, input, keys, playback}.rs` | | `ui-egui/src/panes.rs` (deleted) | `panels.rs` and `panels/{animation, background, comments, designer, format_shape, smartart, thesaurus}.rs` (format-shape pane → `format_shape.rs`, slide background → `background.rs`, animation pane → `animation.rs`, comments and revisions → `comments.rs`) | | `ui-egui/src/backstage.rs` | `backstage/{files, info, print}.rs` | @@ -63,5 +64,7 @@ and `packaging/common.sh` (one line each, path references). 1. `git merge origin/main` (never rebase) and let git list the conflicting old files. 2. For each conflicting hunk, find the new module above, apply the hunk there by hand, and keep - the old file's side only for module declarations. + the old file's side only for module declarations. `ui-egui/src/panes.rs` is deleted: do not + restore it, move its hunks into `panels.rs` or the listed `panels/` modules (the crate exposes + `panels` and aliases it as `panes`). 3. Run `cargo xtask ci`. From 93caf4d222207781c8eef57217cd05bc5b95b090 Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Fri, 30 Oct 2026 16:37:27 +0100 Subject: [PATCH 008/326] Paste copied shapes while a text box is being edited (#1550) --- crates/engine/src/cmd/edit.rs | 3 ++- crates/engine/src/tests.rs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index b098503ca..725808e4d 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -278,7 +278,8 @@ fn paste(s: &mut Session, p: &Value) -> Result { return paste_plain(s, t); } let editing = s.doc()?.selection.text.is_some(); - if editing { + // Copied shapes are pasted as shapes even while a text box is being edited (the caret leaves it). + if editing && (s.clipboard.text.is_some() || s.clipboard.shapes.is_empty()) { if let Some(body) = s.clipboard.text.clone() { return super::text::paste_body(s, &body); } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 4dfc21f45..6692ee155 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -214,6 +214,20 @@ fn clipboard_copy_paste_shapes_and_slides() { assert!(s.doc().unwrap().doc.validate().is_empty()); } +#[test] +fn copied_shapes_paste_as_shapes_while_a_text_box_is_being_edited() { + let mut s = session(); + s.execute("shape.insert", &json!({"preset": "ellipse", "rect": [10, 10, 50, 50]})).unwrap(); + s.execute("edit.copy", &json!({})).unwrap(); + let r = s.execute("insert.textBox", &json!({"text": "Hello"})).unwrap(); + let id = r["id"].as_u64().unwrap(); + s.execute("text.edit", &json!({"id": id})).unwrap(); + let before = s.doc().unwrap().current_slide().unwrap().shapes.len(); + s.execute("edit.paste", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().current_slide().unwrap().shapes.len(), before + 1); + assert!(s.doc().unwrap().selection.text.is_none()); +} + #[test] fn pasted_shapes_get_the_next_automatic_name() { let mut s = session(); From d403e047cf88200a6abd7424ba2daba30ca61949 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Fri, 30 Oct 2026 14:22:02 -0500 Subject: [PATCH 009/326] docs: preserve optional local session context --- CLAUDE.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 1f8193103..88256c23a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -8,9 +8,10 @@ New workspace crates must include `[lints] workspace = true` in `Cargo.toml` to before modules or other crate items; crate-level `//!` documentation may precede them. ## Start every session -1. Read `ROADMAP.md` and `docs/roadmap.md`. -2. Read `../../craftrules/AGENTS.md` and the standards it lists for your task. -3. Run `cargo xtask ci` before you change anything, so you know the tree is green. +1. Read `plan/STATUS.md` when it exists. +2. Read `ROADMAP.md` and `docs/roadmap.md`. +3. Read `../../craftrules/AGENTS.md` and the standards it lists for your task. +4. Run `cargo xtask ci` before you change anything, so you know the tree is green. ## Habits - Every user-visible action is a command with tests (`crates/engine/src/cmd/*`). From 5529c695bf04b6149019c0964a2cd72fe1164151 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Fri, 30 Oct 2026 14:32:09 -0500 Subject: [PATCH 010/326] docs: complete module split path mappings --- docs/module-split-map.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/module-split-map.md b/docs/module-split-map.md index 7ee0f7ce1..e56464c52 100644 --- a/docs/module-split-map.md +++ b/docs/module-split-map.md @@ -16,8 +16,9 @@ To find the exact new home of one function: `git grep -n 'fn name' origin/main - | `engine/src/cmd/mod.rs` | `engine/src/cmd.rs` | | `opus/src/celt/mod.rs`, `opus/src/silk/mod.rs` | `opus/src/celt.rs`, `opus/src/silk.rs` | | `pptx/src/read/mod.rs`, `pptx/src/write/mod.rs` | `pptx/src/read.rs`, `pptx/src/write.rs` | +| `ui-egui/src/selpane.rs` | `ui-egui/src/panels/selpane.rs` | | `ui-egui/src/backstage_tests.rs` | `ui-egui/src/backstage/tests.rs` | -| `ui-egui/src/selpane_tests.rs`, `sorter_tests.rs` | `ui-egui/src/panels/selpane/ui_tests.rs`, `ui-egui/src/sorter/ui_tests.rs` | +| `ui-egui/src/selpane_tests.rs`, `ui-egui/src/sorter_tests.rs` | `ui-egui/src/panels/selpane/ui_tests.rs`, `ui-egui/src/sorter/ui_tests.rs` | `ui-egui/src` files moved into a folder: `guides_tests`, `preview`, `ruler_tests`, `squiggles` → `canvas/`; `columns_dialog_tests`, `credits`, `font_dialog_tests`, `paragraph_dialog_tests`, From 4ab850e248a074abe300b435367131ec750dfb76 Mon Sep 17 00:00:00 2001 From: marshiyar <57055687+marshiyar@users.noreply.github.com> Date: Fri, 30 Oct 2026 20:26:20 -0700 Subject: [PATCH 011/326] Media: cap symphonia audio decode and measure unindexed audio without decoding --- crates/media/src/audio.rs | 65 +++++++++++++++++++++++++++++++++++++++ crates/media/src/probe.rs | 9 +++--- 2 files changed, 70 insertions(+), 4 deletions(-) diff --git a/crates/media/src/audio.rs b/crates/media/src/audio.rs index 5f623a3e2..cca566be0 100644 --- a/crates/media/src/audio.rs +++ b/crates/media/src/audio.rs @@ -169,6 +169,11 @@ fn contained(f: impl FnOnce() -> Result) -> Result { const MAX_DEMUX_ERRORS: u32 = 64; fn decode_symphonia(bytes: &Bytes, ext: &str) -> Result { + decode_symphonia_capped(bytes, ext, MAX_PCM_SAMPLES) +} + +/// [`decode_symphonia`] failing once more than `max_samples` samples have been decoded. +fn decode_symphonia_capped(bytes: &Bytes, ext: &str, max_samples: usize) -> Result { let mss = MediaSourceStream::new(Box::new(Cursor::new(Shared(bytes.clone()))), MediaSourceStreamOptions::default()); let mut hint = Hint::new(); match ext { @@ -242,6 +247,9 @@ fn decode_symphonia(bytes: &Bytes, ext: &str) -> Result { } if let Some(b) = buf.as_mut() { b.copy_interleaved_ref(decoded); + if b.samples().len() > max_samples.saturating_sub(out.len()) { + return Err(MediaError::Unsupported("audio this long".into())); + } out.extend_from_slice(b.samples()); } } @@ -277,6 +285,48 @@ pub(crate) fn probe_symphonia(bytes: &Bytes, ext: &str) -> Option<(String, u32, Some((name, p.sample_rate.unwrap_or(0), p.channels.map(|c| c.count() as u16).unwrap_or(0), p.n_frames)) } +/// Length in milliseconds of the first decodable track, summed from its packet durations: the +/// file is demuxed but not decoded. `None` when the demuxer reports no durations. +pub(crate) fn demux_duration_ms(bytes: &Bytes, ext: &str) -> Option { + std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + let mss = MediaSourceStream::new(Box::new(Cursor::new(Shared(bytes.clone()))), MediaSourceStreamOptions::default()); + let mut hint = Hint::new(); + if ext != "unknown" { + hint.with_extension(ext); + } + let opts = FormatOptions { enable_gapless: true, ..Default::default() }; + let mut format = symphonia::default::get_probe().format(&hint, mss, &opts, &MetadataOptions::default()).ok()?.format; + let t = format.tracks().iter().find(|t| t.codec_params.codec != CODEC_TYPE_NULL)?; + let (id, tb) = (t.id, t.codec_params.time_base?); + let mut ticks = 0u64; + let mut errors = 0u32; + loop { + match format.next_packet() { + Ok(p) => { + errors = 0; + if p.track_id() == id { + ticks = ticks.saturating_add(p.dur); + } + } + Err(SymError::DecodeError(_)) => { + errors += 1; + if errors > MAX_DEMUX_ERRORS { + break; + } + } + Err(_) => break, + } + } + if ticks == 0 { + return None; + } + let t = tb.calc_time(ticks); + Some(t.seconds.saturating_mul(1000).saturating_add((t.frac * 1000.0).round() as u64)) + })) + .ok() + .flatten() +} + /// Interleaved PCM resampled (linear) to `rate`. pub fn resample(pcm: &Pcm, rate: u32) -> Pcm { if pcm.rate == rate || pcm.rate == 0 || rate == 0 { @@ -313,6 +363,21 @@ mod tests { assert!((r.at(101, 0) - 0.505).abs() < 1e-3); } + /// A sample cap makes a long decode fail instead of growing without bound. + #[test] + fn decode_past_the_sample_cap_is_an_error() { + let b: Bytes = std::sync::Arc::new(std::fs::read(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/fixtures/tone.aac")).unwrap_or_default()); + assert!(decode_symphonia_capped(&b, "aac", usize::MAX).is_ok()); + assert!(decode_symphonia_capped(&b, "aac", 1000).is_err()); + } + + #[test] + fn demux_duration_matches_decoded_length() { + let b: Bytes = std::sync::Arc::new(std::fs::read(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/fixtures/tone.aac")).unwrap_or_default()); + let ms = demux_duration_ms(&b, "aac").unwrap_or(0) as i64; + assert!((ms - 500).abs() <= 60, "{ms} ms"); + } + #[test] fn wma_is_reported_unsupported() { let mut b = crate::ASF_HEADER.to_vec(); diff --git a/crates/media/src/probe.rs b/crates/media/src/probe.rs index 97d9a751f..67f4a2c26 100644 --- a/crates/media/src/probe.rs +++ b/crates/media/src/probe.rs @@ -1,5 +1,5 @@ //! Media probing: container, duration, audio and video stream parameters — without decoding -//! (except for audio files whose container doesn't state a length). +//! (audio files whose container doesn't state a length are demuxed, not decoded). use crate::video::{codec_name, mkv_codec_name}; use crate::{ASF_HEADER, Bytes, Container, MediaError, Result}; @@ -50,9 +50,10 @@ fn ms(secs: f64) -> u64 { pub fn probe(bytes: &Bytes) -> Result { let mut info = probe_headers(bytes)?; if info.duration_ms == 0 && info.audio.as_ref().is_some_and(|a| a.decodable) && info.video.is_none() { - // No length in the header (raw MP3 / ADTS without an index): decode to measure. - if let Ok(pcm) = crate::audio::decode(bytes) { - info.duration_ms = ms(pcm.duration()); + // No length in the header (raw MP3 / ADTS without an index): add up the packet + // lengths. This only demuxes, so a long file neither allocates its PCM nor stalls the caller. + if let Some(d) = crate::audio::demux_duration_ms(bytes, Container::sniff(bytes).name()) { + info.duration_ms = d; } } Ok(info) From 0540fe22cfe34a6e1da677324cebb47919428658 Mon Sep 17 00:00:00 2001 From: marshiyar <57055687+marshiyar@users.noreply.github.com> Date: Fri, 30 Oct 2026 22:13:52 -0700 Subject: [PATCH 012/326] Media: stop the Symphonia decode at the sample cap and measure the track playback decodes A decode past MAX_PCM_SAMPLES returned an error, so an MP3 or AAC longer than about 12 minutes that played before would not play at all. It now stops at the cap with whole frames and keeps what it has, like the Opus paths. demux_duration_ms measured the first track with any codec; it now measures the track playback decodes, picked by the same playable_track. Tests: decode_stops_at_the_sample_cap and duration_and_playback_pick_the_same_track fail without the change. --- crates/media/src/audio.rs | 72 +++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/crates/media/src/audio.rs b/crates/media/src/audio.rs index cca566be0..3feb87365 100644 --- a/crates/media/src/audio.rs +++ b/crates/media/src/audio.rs @@ -7,9 +7,9 @@ use std::io::Cursor; use symphonia::core::audio::SampleBuffer; -use symphonia::core::codecs::{CODEC_TYPE_NULL, DecoderOptions}; +use symphonia::core::codecs::{CODEC_TYPE_NULL, Decoder, DecoderOptions}; use symphonia::core::errors::Error as SymError; -use symphonia::core::formats::FormatOptions; +use symphonia::core::formats::{FormatOptions, Track}; use symphonia::core::io::{MediaSourceStream, MediaSourceStreamOptions}; use symphonia::core::meta::MetadataOptions; use symphonia::core::probe::Hint; @@ -172,7 +172,17 @@ fn decode_symphonia(bytes: &Bytes, ext: &str) -> Result { decode_symphonia_capped(bytes, ext, MAX_PCM_SAMPLES) } -/// [`decode_symphonia`] failing once more than `max_samples` samples have been decoded. +/// The track playback decodes, with its decoder: the first one a decoder can be made for (a +/// video's audio track follows its video track). The duration probe measures the same track. +fn playable_track(tracks: &[Track]) -> Option<(u32, Box)> { + let codecs = symphonia::default::get_codecs(); + tracks + .iter() + .filter(|t| t.codec_params.codec != CODEC_TYPE_NULL) + .find_map(|t| codecs.make(&t.codec_params, &DecoderOptions::default()).ok().map(|d| (t.id, d))) +} + +/// [`decode_symphonia`] stopping once `max_samples` samples have been decoded. fn decode_symphonia_capped(bytes: &Bytes, ext: &str, max_samples: usize) -> Result { let mss = MediaSourceStream::new(Box::new(Cursor::new(Shared(bytes.clone()))), MediaSourceStreamOptions::default()); let mut hint = Hint::new(); @@ -191,14 +201,7 @@ fn decode_symphonia_capped(bytes: &Bytes, ext: &str, max_samples: usize) -> Resu other => sym_err(other), })?; let mut format = probed.format; - let codecs = symphonia::default::get_codecs(); - // The first track we can decode (a video's audio track follows its video track). - let (track_id, mut decoder) = format - .tracks() - .iter() - .filter(|t| t.codec_params.codec != CODEC_TYPE_NULL) - .find_map(|t| codecs.make(&t.codec_params, &DecoderOptions::default()).ok().map(|d| (t.id, d))) - .ok_or(MediaError::Missing("audio track we can decode"))?; + let (track_id, mut decoder) = playable_track(format.tracks()).ok_or(MediaError::Missing("audio track we can decode"))?; let mut out: Vec = Vec::new(); let mut rate = 0; let mut channels = 0u16; @@ -247,10 +250,15 @@ fn decode_symphonia_capped(bytes: &Bytes, ext: &str, max_samples: usize) -> Resu } if let Some(b) = buf.as_mut() { b.copy_interleaved_ref(decoded); - if b.samples().len() > max_samples.saturating_sub(out.len()) { - return Err(MediaError::Unsupported("audio this long".into())); + // stop at the cap with whole frames, keeping what fits, like the Opus paths + let room = max_samples.saturating_sub(out.len()); + let s = b.samples(); + if s.len() > room { + let fit = room - room % (ch.max(1) as usize); + out.extend_from_slice(s.get(..fit).unwrap_or_default()); + break; } - out.extend_from_slice(b.samples()); + out.extend_from_slice(s); } } Err(SymError::DecodeError(e)) => log::debug!("audio decode: {e}"), @@ -285,7 +293,7 @@ pub(crate) fn probe_symphonia(bytes: &Bytes, ext: &str) -> Option<(String, u32, Some((name, p.sample_rate.unwrap_or(0), p.channels.map(|c| c.count() as u16).unwrap_or(0), p.n_frames)) } -/// Length in milliseconds of the first decodable track, summed from its packet durations: the +/// Length in milliseconds of the track playback decodes, summed from its packet durations: the /// file is demuxed but not decoded. `None` when the demuxer reports no durations. pub(crate) fn demux_duration_ms(bytes: &Bytes, ext: &str) -> Option { std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { @@ -296,8 +304,8 @@ pub(crate) fn demux_duration_ms(bytes: &Bytes, ext: &str) -> Option { } let opts = FormatOptions { enable_gapless: true, ..Default::default() }; let mut format = symphonia::default::get_probe().format(&hint, mss, &opts, &MetadataOptions::default()).ok()?.format; - let t = format.tracks().iter().find(|t| t.codec_params.codec != CODEC_TYPE_NULL)?; - let (id, tb) = (t.id, t.codec_params.time_base?); + let (id, _) = playable_track(format.tracks())?; + let tb = format.tracks().iter().find(|t| t.id == id)?.codec_params.time_base?; let mut ticks = 0u64; let mut errors = 0u32; loop { @@ -363,12 +371,34 @@ mod tests { assert!((r.at(101, 0) - 0.505).abs() < 1e-3); } - /// A sample cap makes a long decode fail instead of growing without bound. + /// A long decode stops at the sample cap and keeps what it has, like the Opus paths, so audio + /// past the cap still plays (up to the cap) instead of failing. #[test] - fn decode_past_the_sample_cap_is_an_error() { + fn decode_stops_at_the_sample_cap() { let b: Bytes = std::sync::Arc::new(std::fs::read(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/fixtures/tone.aac")).unwrap_or_default()); - assert!(decode_symphonia_capped(&b, "aac", usize::MAX).is_ok()); - assert!(decode_symphonia_capped(&b, "aac", 1000).is_err()); + let full = decode_symphonia_capped(&b, "aac", usize::MAX).unwrap(); + let capped = decode_symphonia_capped(&b, "aac", 1001).unwrap(); + assert!(full.samples.len() > 1001, "the fixture is longer than the cap"); + assert!(!capped.samples.is_empty() && capped.samples.len() <= 1001, "{}", capped.samples.len()); + assert_eq!(capped.samples.len() % capped.channels as usize, 0, "whole frames only"); + assert_eq!(capped.samples[..], full.samples[..capped.samples.len()], "the start is kept as decoded"); + } + + /// The duration is measured on the track playback decodes: the first one a decoder can be made + /// for, not the first one with any codec. + #[test] + fn duration_and_playback_pick_the_same_track() { + use symphonia::core::audio::Channels; + use symphonia::core::codecs::{CODEC_TYPE_AAC, CODEC_TYPE_OPUS, CodecParameters}; + let stereo = Channels::FRONT_LEFT | Channels::FRONT_RIGHT; + let mut opus = CodecParameters::new(); + opus.for_codec(CODEC_TYPE_OPUS).with_sample_rate(48_000).with_channels(stereo); + let mut aac = CodecParameters::new(); + aac.for_codec(CODEC_TYPE_AAC).with_sample_rate(44_100).with_channels(stereo); + let tracks = [Track::new(1, opus), Track::new(2, aac)]; + // the first track has a codec but no decoder in this build (Symphonia has no Opus decoder) + assert_ne!(tracks[0].codec_params.codec, CODEC_TYPE_NULL); + assert_eq!(playable_track(&tracks).map(|(id, _)| id), Some(2)); } #[test] From a1217166292752a75026c0d476038044f293076c Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Sun, 18 Oct 2026 23:31:04 -0500 Subject: [PATCH 013/326] [CC2] Style commands given none of their optional keys are refused shape.line, shape.effects, picture.adjust, format.paragraph and format.margins answered changed for a call that set nothing. They now say what to pass. shape.fill already refused; the toggles (bold, bullets) and geometry commands keep their meaningful defaults. Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd.rs | 15 +++++++++ crates/engine/src/cmd/format.rs | 6 ++-- crates/engine/src/cmd/format/paragraph.rs | 25 ++++++++++++++- crates/engine/src/cmd/shape.rs | 8 ++--- crates/engine/src/cmd/shape/appearance.rs | 12 ++++++- crates/engine/src/cmd/shape/picture.rs | 3 +- crates/engine/src/tests.rs | 38 +++++++++++++++++++++++ 7 files changed, 97 insertions(+), 10 deletions(-) diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index 6f20c4143..04e63f5bf 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -297,6 +297,16 @@ pub fn parse_params(doc: &str) -> std::result::Result>, String> { /// growing would duplicate ids (#407). pub(crate) const NO_ID_SPACE: &str = "the presentation has used every object id and can hold no more"; +/// A style command whose keys are all optional is refused when it is given none of them, rather +/// than answering `changed` for a call that sets nothing. +pub(crate) fn require_any(p: &Value, cmd: &str, keys: &[&str]) -> Result<()> { + if keys.iter().any(|k| p.get(*k).is_some_and(|v| !v.is_null())) { + return Ok(()); + } + let (last, rest) = keys.split_last().map_or(("", &[][..]), |(l, r)| (*l, r)); + Err(bad(cmd, format!("`{cmd}` was given nothing to set: pass {} or {last}", rest.join(", ")))) +} + pub(crate) fn bad(cmd: &str, msg: impl Into) -> EngineError { EngineError::BadParams { cmd: cmd.into(), msg: msg.into() } } @@ -534,6 +544,10 @@ pub(crate) fn current_names(doc: &deckcraft_model::Presentation, sel: &crate::Se /// A name ending in `?` is optional. Text after `→` is the result, not an input. pub fn needs_arguments(params: &str) -> bool { let input = params.split('→').next().unwrap_or(params); + // Every key optional, but the command refuses a call that gives none of them. + if input.contains("(at least one key)") { + return true; + } let Some(start) = input.find('{') else { return false }; let inside = input.get(start + 1..).unwrap_or(""); let inside = inside.split('}').next().unwrap_or(inside); @@ -657,6 +671,7 @@ mod tests { assert!(needs_arguments("{axis: horizontal|vertical, ids?}")); assert!(needs_arguments("{percent}")); assert!(!needs_arguments("{}")); + assert!(needs_arguments("{left?: pt, top?: pt} (at least one key)")); assert!(!needs_arguments("{on?: bool}")); assert!(!needs_arguments("{theme?: name, size?: [w,h] pt, blank?: bool}")); assert!(!needs_arguments("{uid?: one entry, else all}")); diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index 4e273dc1c..d96739a05 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -11,7 +11,7 @@ use std::sync::Arc; use super::text::{format_body, format_para, format_run, format_run_levels}; use super::{ CommandSpec, always, bad, base64_decode, bool_or, bool_param, cmd, color_param, edit_shapes, f64_or, f64_param, has_doc, has_text, - has_text_or_shapes, ids_param, ok, str_param, + has_text_or_shapes, ids_param, ok, require_any, str_param, }; use crate::{Result, Session}; use deckcraft_model::ShapeId; @@ -199,7 +199,7 @@ pub fn specs() -> Vec { "Paragraph…", ["Format"], None, - "{align?, indentLeft?: pt, indentFirst?: pt (negative = hanging), spaceBefore?: pt, spaceAfter?: pt, lineSpacing?: lines}", + "{align?, indentLeft?: pt, indentFirst?: pt (negative = hanging), spaceBefore?: pt, spaceAfter?: pt, lineSpacing?: lines, lineSpacingPt?: pt} (at least one key)", has_text_or_shapes, paragraph ), @@ -248,7 +248,7 @@ pub fn specs() -> Vec { "Text Box Margins", ["Format Shape", "Text Box"], None, - "{left?: pt, top?: pt, right?: pt, bottom?: pt}", + "{left?: pt, top?: pt, right?: pt, bottom?: pt} (at least one key)", has_text_or_shapes, margins ), diff --git a/crates/engine/src/cmd/format/paragraph.rs b/crates/engine/src/cmd/format/paragraph.rs index f036068f6..c508c3573 100644 --- a/crates/engine/src/cmd/format/paragraph.rs +++ b/crates/engine/src/cmd/format/paragraph.rs @@ -1,6 +1,6 @@ use super::{ Align, Anchor, AutoFit, Bullet, Result, Session, Spacing, TextDir, Value, bad, bool_or, color_param, current_para, f64_or, f64_param, - format_body, format_para, json, ok, on_param, resolve, str_param, + format_body, format_para, json, ok, on_param, require_any, resolve, str_param, }; pub(super) fn align_to(s: &mut Session, a: Align) -> Result { @@ -117,6 +117,28 @@ pub(super) fn line_spacing(s: &mut Session, p: &Value) -> Result { } pub(super) fn paragraph(s: &mut Session, p: &Value) -> Result { + if let Err(e) = + require_any(p, "format.paragraph", &["align", "indentLeft", "indentFirst", "spaceBefore", "spaceAfter", "lineSpacing", "lineSpacingPt"]) + { + // The Paragraph dialog's other fields are format.paragraphDialog's; say so instead of + // calling the call empty. + if let Some(k) = + ["special", "specialBy", "indentRight", "spaceBeforeKind", "spaceAfterKind"].into_iter().find(|k| p.get(*k).is_some_and(|v| !v.is_null())) + { + // The dialog applies a kind or `specialBy` only with the value it qualifies. + let with = match k { + "spaceBeforeKind" => " together with `spaceBefore`", + "spaceAfterKind" => " together with `spaceAfter`", + "specialBy" => " together with `special`", + _ => "", + }; + return Err(bad( + "format.paragraph", + format!("`{k}` is a field of format.paragraphDialog (the whole Paragraph dialog), given{with}; format.paragraph does not read it"), + )); + } + return Err(e); + } let a = str_param(p, "align").map(|a| match a { "center" => Align::Center, "right" => Align::Right, @@ -405,6 +427,7 @@ pub(super) fn wrap(s: &mut Session, p: &Value) -> Result { } pub(super) fn margins(s: &mut Session, p: &Value) -> Result { + require_any(p, "format.margins", &["left", "top", "right", "bottom"])?; let (l, t, r, b) = (f64_param(p, "left"), f64_param(p, "top"), f64_param(p, "right"), f64_param(p, "bottom")); format_body(s, &move |bp| { if l.is_some() { diff --git a/crates/engine/src/cmd/shape.rs b/crates/engine/src/cmd/shape.rs index 9565cdf7b..1d58dd254 100644 --- a/crates/engine/src/cmd/shape.rs +++ b/crates/engine/src/cmd/shape.rs @@ -10,7 +10,7 @@ use serde_json::{Value, json}; use super::{ CommandSpec, NO_ID_SPACE, bad, bool_or, bool_param, cmd, color_param, color_value, edit_geometry, edit_shapes, f64_param, has_selection, - has_slide, id_param, ok, str_param, targets, usize_param, with_param, xfrm_of, + has_slide, id_param, ok, require_any, str_param, targets, usize_param, with_param, xfrm_of, }; use crate::{Result, Session}; @@ -112,7 +112,7 @@ pub fn specs() -> Vec { "Shape Outline", ["Shape Format", "Shape Styles"], None, - "{color?, none?, width?: pt, dash?: solid|dot|dash|lgDash|dashDot|sysDot|sysDash, cap?: flat|round|square, join?: round|bevel|miter, compound?: single|double|thickThin|thinThick|triple, head?: none|triangle|stealth|diamond|oval|arrow, tail?, headSize?: sm|med|lg, tailSize?, reset?, ids?}; a group also formats its members", + "{color?, none?, width?: pt, dash?: solid|dot|dash|lgDash|dashDot|sysDot|sysDash, cap?: flat|round|square, join?: round|bevel|miter, compound?: single|double|thickThin|thinThick|triple, head?: none|triangle|stealth|diamond|oval|arrow, tail?, headSize?: sm|med|lg, tailSize?, reset?, ids?} (at least one key); a group also formats its members", has_selection, line ), @@ -121,7 +121,7 @@ pub fn specs() -> Vec { "Shape Effects", ["Shape Format", "Shape Styles"], None, - "{shadow?: none|outer|inner|perspective|{color, blur, dist, dir}, glow?: none|{color, radius}, softEdges?: pt, reflection?: none|tight|half|full, bevel?: none|circle|…, threeD?: {camera?: preset, rotX?, rotY?, rotZ?: deg, z?: pt, bevelTop?, bevelBottom?: none|circle|…, bevelTopW?, bevelTopH?, bevelBottomW?, bevelBottomH?, depth?, contour?: pt, material?, lighting?, reset?: true}, shadowProps?: {color?, transparency?: 0..1, size?: 0.01..2 (1 = 100%), blur?: pt, dist?: pt, dir?: deg}, glowProps?: {color?, transparency?, radius?: pt}, reflectionProps?: {transparency?, size?: 0..1, dist?: pt, blur?: pt}, reset?, ids?} (the *Props keys adjust the current effect, adding a default one when there is none)", + "{shadow?: none|outer|inner|perspective|{color, blur, dist, dir}, glow?: none|{color, radius}, softEdges?: pt, reflection?: none|tight|half|full, bevel?: none|circle|…, threeD?: {camera?: preset, rotX?, rotY?, rotZ?: deg, z?: pt, bevelTop?, bevelBottom?: none|circle|…, bevelTopW?, bevelTopH?, bevelBottomW?, bevelBottomH?, depth?, contour?: pt, material?, lighting?, reset?: true}, shadowProps?: {color?, transparency?: 0..1, size?: 0.01..2 (1 = 100%), blur?: pt, dist?: pt, dir?: deg}, glowProps?: {color?, transparency?, radius?: pt}, reflectionProps?: {transparency?, size?: 0..1, dist?: pt, blur?: pt}, reset?, ids?} (at least one key) (the *Props keys adjust the current effect, adding a default one when there is none)", has_selection, effects ), @@ -161,7 +161,7 @@ pub fn specs() -> Vec { "Corrections", ["Picture Format", "Adjust"], None, - "{brightness?: -1..1, contrast?: -1..1, saturation?: 0..4, grayscale?: bool, transparency?: 0..1, reset?: bool, ids?}", + "{brightness?: -1..1, contrast?: -1..1, saturation?: 0..4, grayscale?: bool, transparency?: 0..1, reset?: bool, ids?} (at least one key)", has_selection, picture_adjust ), diff --git a/crates/engine/src/cmd/shape/appearance.rs b/crates/engine/src/cmd/shape/appearance.rs index 24bfbabf8..0200ea10c 100644 --- a/crates/engine/src/cmd/shape/appearance.rs +++ b/crates/engine/src/cmd/shape/appearance.rs @@ -1,7 +1,7 @@ use super::{ ColorRef, ColorTransform, Dash, Effects, Fill, Geom, Glow, Gradient, GradientShape, GradientStop, Line, LineEnd, PictureFill, PictureMode, Reflection, Result, Rgba, SchemeSlot, Session, Shadow, ShapeStyle, Value, apply_fill, bad, bool_or, color_param, color_value, edit_geometry, - edit_shapes, f64_param, inherited_fills, json, requested_fill, str_param, targets, usize_param, + edit_shapes, f64_param, inherited_fills, json, requested_fill, require_any, str_param, targets, usize_param, }; pub(super) fn adjust(s: &mut Session, p: &Value) -> Result { @@ -236,6 +236,7 @@ fn line_end(v: &str) -> Option { } pub(super) fn line(s: &mut Session, p: &Value) -> Result { + require_any(p, "shape.line", &["color", "none", "width", "dash", "cap", "join", "compound", "head", "tail", "headSize", "tailSize", "reset"])?; let reset = bool_or(p, "reset", false); let none = bool_or(p, "none", false); let color = color_param(p, "color"); @@ -355,6 +356,15 @@ fn shadow_preset(v: &Value) -> Option> { } pub(super) fn effects(s: &mut Session, p: &Value) -> Result { + // `glow: null` and `softEdges: null` clear those effects (No Glow, No Soft Edges), so a null + // counts as something to set for them. + if !["glow", "softEdges"].iter().any(|k| p.get(*k).is_some()) { + require_any( + p, + "shape.effects", + &["shadow", "glow", "softEdges", "reflection", "bevel", "threeD", "shadowProps", "glowProps", "reflectionProps", "reset"], + )?; + } let reset = bool_or(p, "reset", false); let shadow = p.get("shadow").and_then(shadow_preset); let glow: Option> = p.get("glow").map(|g| match g { diff --git a/crates/engine/src/cmd/shape/picture.rs b/crates/engine/src/cmd/shape/picture.rs index 09cf22ae0..5db75277f 100644 --- a/crates/engine/src/cmd/shape/picture.rs +++ b/crates/engine/src/cmd/shape/picture.rs @@ -1,4 +1,4 @@ -use super::{NO_ID_SPACE, Result, Session, Value, bad, bool_or, bool_param, edit_geometry, edit_shapes, f64_param, json}; +use super::{NO_ID_SPACE, Result, Session, Value, bad, bool_or, bool_param, edit_geometry, edit_shapes, f64_param, json, require_any}; pub(super) fn crop(s: &mut Session, p: &Value) -> Result { let c = [f64_param(p, "left"), f64_param(p, "top"), f64_param(p, "right"), f64_param(p, "bottom")]; @@ -15,6 +15,7 @@ pub(super) fn crop(s: &mut Session, p: &Value) -> Result { } pub(super) fn picture_adjust(s: &mut Session, p: &Value) -> Result { + require_any(p, "picture.adjust", &["brightness", "contrast", "saturation", "grayscale", "transparency", "reset"])?; edit_shapes(s, p, "picture.adjust", |sh| { if let deckcraft_model::ShapeKind::Picture { fill } = &mut sh.kind { let a = &mut fill.adjust; diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index a687de95c..953322922 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -5970,6 +5970,44 @@ fn invalid_slide_index_never_falls_back_to_the_selection_in_export_commands() { let _ = std::fs::remove_dir_all(&dir); } +#[test] +fn style_commands_given_nothing_to_set_are_refused() { + let mut s = session(); + s.execute("insert.textBox", &json!({"text": "Hi", "rect": [50.0, 50.0, 200.0, 100.0]})).unwrap(); + for cmd in ["shape.line", "shape.effects", "picture.adjust", "format.paragraph", "format.margins"] { + let rev = s.doc().unwrap().revision; + let e = s.execute(cmd, &json!({})).unwrap_err().to_string(); + assert!(e.contains("given nothing to set") && e.contains(cmd), "{cmd}: {e}"); + assert_eq!(s.doc().unwrap().revision, rev, "{cmd} changed the deck"); + } + let e = s.execute("shape.line", &json!({})).unwrap_err().to_string(); + assert!(e.contains("pass color, none, width, dash"), "{e}"); + // A key, even one that changes nothing visible, is something to set. + s.execute("shape.line", &json!({"width": 2})).unwrap(); + s.execute("format.margins", &json!({"left": 5})).unwrap(); + // A null glow or soft edge clears it (No Glow, No Soft Edges): that is something to set. + let fx = |s: &Session| s.doc().unwrap().selected_shapes()[0].effects.clone().unwrap_or_default(); + s.execute("shape.effects", &json!({"glow": 8, "softEdges": 5})).unwrap(); + assert!(fx(&s).glow.is_some() && fx(&s).soft_edge.is_some()); + s.execute("shape.effects", &json!({"glow": null})).unwrap(); + assert!(fx(&s).glow.is_none() && fx(&s).soft_edge.is_some()); + s.execute("shape.effects", &json!({"softEdges": null})).unwrap(); + assert!(fx(&s).soft_edge.is_none()); + // The Paragraph dialog's own fields are format.paragraphDialog's, and the refusal says so. + for (k, v) in [("special", json!("hanging")), ("spaceBeforeKind", json!("pct")), ("indentRight", json!(10))] { + let e = s.execute("format.paragraph", &json!({ k: v })).unwrap_err().to_string(); + assert!(e.contains("format.paragraphDialog") && e.contains(k), "{k}: {e}"); + } + let e = s.execute("format.paragraph", &json!({"spaceBeforeKind": "pct"})).unwrap_err().to_string(); + assert!(e.contains("together with `spaceBefore`"), "{e}"); + // The palette lists only commands that run without arguments; these need one key. + for cmd in ["shape.line", "shape.effects", "picture.adjust", "format.paragraph", "format.margins"] { + let spec = crate::command_specs().iter().find(|c| c.id == cmd).unwrap(); + assert!(crate::cmd::needs_arguments(spec.params), "{cmd}: {}", spec.params); + } + s.execute("format.paragraphDialog", &json!({"special": "hanging", "specialBy": 18})).unwrap(); +} + #[test] fn highlight_with_an_invalid_colour_is_rejected_and_keeps_the_highlight() { let mut s = session(); From 0d190bc0af375d12b22f14c522f34a7ecb9e87e6 Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Sun, 1 Nov 2026 07:38:17 +0100 Subject: [PATCH 014/326] Keep pasting into the notes while they are being edited (#1550) --- crates/engine/src/cmd/edit.rs | 6 +++--- crates/engine/src/tests.rs | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 6d39cc050..9a25b008d 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -277,9 +277,9 @@ fn paste(s: &mut Session, p: &Value) -> Result { } return paste_plain(s, t); } - let editing = s.doc()?.selection.text.is_some(); - // Copied shapes are pasted as shapes even while a text box is being edited (the caret leaves it). - if editing && (s.clipboard.text.is_some() || s.clipboard.shapes.is_empty()) { + let (editing, notes) = s.doc()?.selection.text.as_ref().map_or((false, false), |t| (true, t.notes)); + // Copied shapes are pasted as shapes even while a text box is being edited (the caret leaves it), but never into the notes. + if editing && (notes || s.clipboard.text.is_some() || s.clipboard.shapes.is_empty()) { if let Some(body) = s.clipboard.text.clone() { return super::text::paste_body(s, &body); } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 2a75b08fd..4c79476d2 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -228,6 +228,18 @@ fn copied_shapes_paste_as_shapes_while_a_text_box_is_being_edited() { assert!(s.doc().unwrap().selection.text.is_none()); } +#[test] +fn copied_shapes_are_not_pasted_while_the_notes_are_being_edited() { + let mut s = session(); + s.execute("shape.insert", &json!({"preset": "ellipse", "rect": [10, 10, 50, 50]})).unwrap(); + s.execute("edit.copy", &json!({})).unwrap(); + s.execute("text.edit", &json!({"notes": true})).unwrap(); + let before = s.doc().unwrap().current_slide().unwrap().shapes.len(); + s.execute("edit.paste", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().current_slide().unwrap().shapes.len(), before); + assert!(s.doc().unwrap().selection.text.as_ref().is_some_and(|t| t.notes)); +} + #[test] fn pasted_shapes_get_the_next_automatic_name() { let mut s = session(); From d542b35bd4bb8be9a6f3239459ba798300cc474d Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Mon, 2 Nov 2026 17:03:05 -0600 Subject: [PATCH 015/326] Test: picture.adjust and format.paragraph refuse only-null calls and take one key Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/tests.rs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 953322922..feedb1338 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6008,6 +6008,43 @@ fn style_commands_given_nothing_to_set_are_refused() { s.execute("format.paragraphDialog", &json!({"special": "hanging", "specialBy": 18})).unwrap(); } +/// A call whose keys are all null sets nothing and is refused like an empty one, changing +/// nothing; one valid key is enough, nulls beside it ignored. +#[test] +fn style_commands_refuse_only_nulls_and_take_one_key() { + let mut png = vec![]; + image::DynamicImage::ImageRgba8(image::RgbaImage::from_pixel(4, 2, image::Rgba([200, 30, 30, 255]))) + .write_to(&mut std::io::Cursor::new(&mut png), image::ImageFormat::Png) + .unwrap(); + let mut s = session(); + let pic = + s.execute("insert.picture", &json!({"data": cmd::base64_encode(&png), "name": "a.png", "rect": [100, 100, 40, 20]})).unwrap()["id"].clone(); + let text = s.execute("insert.textBox", &json!({"text": "Hi", "rect": [50, 300, 200, 100]})).unwrap()["id"].clone(); + let nulls = |keys: &[&str]| serde_json::Value::Object(keys.iter().map(|k| ((*k).to_string(), serde_json::Value::Null)).collect()); + for (cmd, id, keys, one) in [ + ( + "picture.adjust", + &pic, + &["brightness", "contrast", "saturation", "grayscale", "transparency", "reset"][..], + json!({"brightness": 0.3, "contrast": null}), + ), + ( + "format.paragraph", + &text, + &["align", "indentLeft", "indentFirst", "spaceBefore", "spaceAfter", "lineSpacing", "lineSpacingPt"][..], + json!({"align": "center", "spaceBefore": null}), + ), + ] { + s.execute("edit.select", &json!({"ids": [id]})).unwrap(); + let rev = s.doc().unwrap().revision; + let e = s.execute(cmd, &nulls(keys)).unwrap_err().to_string(); + assert!(e.contains("given nothing to set") && e.contains(cmd), "{cmd}: {e}"); + assert_eq!(s.doc().unwrap().revision, rev, "{cmd}: only nulls changed the deck"); + s.execute(cmd, &one).unwrap_or_else(|e| panic!("{cmd} {one}: {e}")); + assert_ne!(s.doc().unwrap().revision, rev, "{cmd}: one key set something"); + } +} + #[test] fn highlight_with_an_invalid_colour_is_rejected_and_keeps_the_highlight() { let mut s = session(); From 2427c605116fa29484f6169270b1bcec842ffe74 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 3 Nov 2026 20:30:46 -0800 Subject: [PATCH 016/326] Format: test color mods lists with two mods, unknown ops, empty lists and keyed transforms Adds tests for the `mods` list of a color parameter: a preset with two transforms round-trips through the Font dialog, an unknown op makes the color invalid and the dialog returns an error without editing, an empty list gives the color with no transforms, and a scheme color with a keyed lumMod and a list keeps both, the keyed one first. --- crates/engine/src/cmd.rs | 22 ++++++++++++++++++++++ crates/engine/src/cmd/format.rs | 30 ++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index 042733555..95800655d 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -688,4 +688,26 @@ mod tests { assert_eq!(listed, Some(ColorRef { base: ColorBase::Preset { name: "red".into() }, mods })); assert_eq!(color_value(&json!({"preset": "red", "mods": [{"op": "notATransform"}]})), None); } + + #[test] + fn color_mods_lists_follow_keyed_transforms() { + use deckcraft_color::{ColorTransform, SchemeSlot}; + use deckcraft_model::{ColorBase, ColorRef}; + use serde_json::json; + let red = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] }; + assert_eq!(color_value(&json!({"preset": "red", "mods": []})), Some(red.clone()), "an empty list adds no transforms"); + let two = color_value(&json!({"preset": "red", "mods": [{"op": "lumMod", "val": 75_000}, {"op": "lumOff", "val": 10_000}]})); + assert_eq!(two, Some(red.with(ColorTransform::LumMod(75_000)).with(ColorTransform::LumOff(10_000)))); + // The keyed `lumMod` comes first, then the list in order. + let both = + color_value(&json!({"scheme": "accent2", "lumMod": 75_000, "mods": [{"op": "lumOff", "val": 10_000}, {"op": "lumMod", "val": 50_000}]})); + let want = ColorRef::scheme(SchemeSlot::Accent2) + .with(ColorTransform::LumMod(75_000)) + .with(ColorTransform::LumOff(10_000)) + .with(ColorTransform::LumMod(50_000)); + assert_eq!(both, Some(want)); + // An unknown op anywhere in the list, or a `mods` value that is not a list, makes the color invalid. + assert_eq!(color_value(&json!({"scheme": "accent2", "lumMod": 75_000, "mods": [{"op": "lumOff", "val": 10_000}, {"op": "sparkle"}]})), None); + assert_eq!(color_value(&json!({"preset": "red", "mods": {"op": "inv"}})), None); + } } diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index 47314a800..0336dc41f 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -422,6 +422,36 @@ mod tests { } } + #[test] + fn font_dialog_color_mods_round_trip_and_unknown_ops_are_errors() { + let two = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] } + .with(ColorTransform::LumMod(75_000)) + .with(ColorTransform::LumOff(10_000)); + let mut s = shape(); + let fill = Fill::Solid { color: two.clone() }; + format_run(&mut s, &|r| r.fill = Some(fill.clone())).unwrap(); + s.ui_requests.clear(); + s.execute("format.fontDialog", &json!({})).unwrap(); + let Some(UiRequest::Dialog { params, .. }) = s.ui_requests.last().cloned() else { panic!("dialog request") }; + assert_eq!(params["color"], json!({"preset": "red", "mods": [{"op": "lumMod", "val": 75_000}, {"op": "lumOff", "val": 10_000}]})); + s.execute("format.fontDialog", &json!({"color": params["color"]})).unwrap(); + assert_eq!(props(&s).fill, Some(Fill::Solid { color: two.clone() })); + // An unknown op is an error, and the run keeps its color. + let n = s.doc().unwrap().history.undo.len(); + let err = s.execute("format.fontDialog", &json!({"color": {"preset": "red", "mods": [{"op": "sparkle"}]}})).unwrap_err(); + assert!(err.to_string().contains("color"), "{err}"); + assert_eq!(s.doc().unwrap().history.undo.len(), n); + assert_eq!(props(&s).fill, Some(Fill::Solid { color: two })); + // An empty list gives the color with no transforms. + s.execute("format.fontDialog", &json!({"color": {"preset": "red", "mods": []}})).unwrap(); + assert_eq!(props(&s).fill, Some(Fill::Solid { color: ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] } })); + // A scheme color with a keyed `lumMod` and a list keeps both, the keyed one first. + s.execute("format.fontDialog", &json!({"color": {"scheme": "accent2", "lumMod": 75_000, "mods": [{"op": "lumOff", "val": 10_000}]}})) + .unwrap(); + let scheme = ColorRef::scheme(SchemeSlot::Accent2).with(ColorTransform::LumMod(75_000)).with(ColorTransform::LumOff(10_000)); + assert_eq!(props(&s).fill, Some(Fill::Solid { color: scheme })); + } + #[test] fn font_dialog_with_no_fields_asks_the_ui_to_open() { let mut s = shape(); From c3aab3ac1ed3c0e1e8ddfaeb09fca184475b0d8f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 4 Nov 2026 07:51:35 -0800 Subject: [PATCH 017/326] Format: a color's mods list holds at most 256 transforms color_value reads a mods list element by element instead of cloning it, and a list longer than MAX_COLOR_MODS (256) makes the color invalid. --- crates/engine/src/cmd.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index 95800655d..e68dce576 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -378,12 +378,16 @@ pub(crate) fn ok() -> Result { /// Parse a colour param: `"#RRGGBB"`, `"accent1"`…, or `{"scheme":"accent2","lumMod":75000}`. /// A preset or system colour keeps its base: `{"preset":"red"}`, /// `{"system":"windowText","last":"#000000"}`. `"mods"` lists transforms in order: -/// `{"preset":"red","mods":[{"op":"inv"},{"op":"inv"}]}`. +/// `{"preset":"red","mods":[{"op":"inv"},{"op":"inv"}]}`. A list longer than [`MAX_COLOR_MODS`] +/// makes the color invalid. pub(crate) fn color_param(p: &Value, key: &str) -> Option { let v = p.get(key)?; color_value(v) } +/// Most transforms a color param's `"mods"` list may hold. +pub(crate) const MAX_COLOR_MODS: usize = 256; + pub(crate) fn color_value(v: &Value) -> Option { use deckcraft_model::ColorRef; match v { @@ -420,7 +424,13 @@ pub(crate) fn color_value(v: &Value) -> Option { } // `mods` lists transforms in order, repeats included: `[{"op":"inv"},{"op":"lumMod","val":50000}]`. if let Some(list) = o.get("mods") { - c.mods.extend(serde_json::from_value::>(list.clone()).ok()?); + let list = list.as_array()?; + if list.len() > MAX_COLOR_MODS { + return None; + } + for m in list { + c.mods.push(::deserialize(m).ok()?); + } } Some(c) } @@ -710,4 +720,13 @@ mod tests { assert_eq!(color_value(&json!({"scheme": "accent2", "lumMod": 75_000, "mods": [{"op": "lumOff", "val": 10_000}, {"op": "sparkle"}]})), None); assert_eq!(color_value(&json!({"preset": "red", "mods": {"op": "inv"}})), None); } + + #[test] + fn color_mods_lists_longer_than_the_cap_are_invalid() { + use deckcraft_color::ColorTransform; + use serde_json::json; + let at_cap = color_value(&json!({"preset": "red", "mods": vec![json!({"op": "inv"}); MAX_COLOR_MODS]})); + assert_eq!(at_cap.map(|c| c.mods), Some(vec![ColorTransform::Inv; MAX_COLOR_MODS])); + assert_eq!(color_value(&json!({"preset": "red", "mods": vec![json!({"op": "inv"}); MAX_COLOR_MODS + 1]})), None); + } } From d379334ea5d461b57081a9108a128d0b9208fb7e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 4 Nov 2026 08:04:50 -0800 Subject: [PATCH 018/326] Format: the Font dialog gives an unknown preset or system name as the color it draws A preset or system color name kept from an opened file that the color parser does not know is given to the dialog as its drawn RGB (black for a preset, the stored last color for a system color), so OK no longer rejects the color when another field changes. --- crates/engine/src/cmd/format.rs | 18 ++++++++++++++++++ crates/engine/src/cmd/format/font.rs | 9 ++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index 0336dc41f..83ec891b3 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -422,6 +422,24 @@ mod tests { } } + #[test] + fn font_dialog_ok_accepts_preset_and_system_names_it_does_not_know() { + use deckcraft_color::Rgba; + let last = Rgba::rgb(0x12, 0x34, 0x56); + let preset = ColorRef { base: ColorBase::Preset { name: "notAColor".into() }, mods: vec![] }.with(ColorTransform::LumMod(50_000)); + let system = ColorRef { base: ColorBase::System { name: "notAColor".into(), last }, mods: vec![] }; + for (color, drawn) in [(preset, ColorRef::rgb(Rgba::BLACK).with(ColorTransform::LumMod(50_000))), (system, ColorRef::rgb(last))] { + let mut s = shape(); + let fill = Fill::Solid { color }; + format_run(&mut s, &|r| r.fill = Some(fill.clone())).unwrap(); + s.ui_requests.clear(); + s.execute("format.fontDialog", &json!({})).unwrap(); + let Some(UiRequest::Dialog { params, .. }) = s.ui_requests.last().cloned() else { panic!("dialog request") }; + s.execute("format.fontDialog", &json!({"color": params["color"], "size": 20.0})).unwrap(); + assert_eq!(props(&s).fill, Some(Fill::Solid { color: drawn }), "{}", params["color"]); + } + } + #[test] fn font_dialog_color_mods_round_trip_and_unknown_ops_are_errors() { let two = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![] } diff --git a/crates/engine/src/cmd/format/font.rs b/crates/engine/src/cmd/format/font.rs index 57fd81c34..82d47568e 100644 --- a/crates/engine/src/cmd/format/font.rs +++ b/crates/engine/src/cmd/format/font.rs @@ -396,7 +396,14 @@ fn color_command_value(c: &deckcraft_model::ColorRef) -> Value { } // `#RRGGBB`, or `#RRGGBBAA` for a color that is not opaque. let hex = |c: &deckcraft_color::Rgba| if c.a == 255 { format!("#{}", c.hex()) } else { format!("#{}{:02X}", c.hex(), c.a) }; - match &c.base { + // A preset or system name that `color_value` does not know (kept from an opened file) is given as + // the color it is drawn with, so OK does not reject it. + let base = match &c.base { + ColorBase::Preset { name } if !deckcraft_color::is_preset_name(name) => ColorBase::Rgb { rgb: deckcraft_color::Rgba::BLACK }, + ColorBase::System { name, last } if !deckcraft_color::is_system_name(name) => ColorBase::Rgb { rgb: *last }, + b => b.clone(), + }; + match &base { ColorBase::Rgb { rgb } if o.is_empty() => json!(hex(rgb)), ColorBase::Rgb { rgb } => { o.insert("rgb".into(), json!(hex(rgb))); From 456cecdc58cf63ab2ff0e08a355db9de8f0385e5 Mon Sep 17 00:00:00 2001 From: aiongg <67543387+aiongg@users.noreply.github.com> Date: Wed, 4 Nov 2026 20:55:50 +0000 Subject: [PATCH 019/326] Apply review fixes - crates/engine/src/cmd/format/paragraph.rs --- crates/engine/src/cmd/format/paragraph.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/format/paragraph.rs b/crates/engine/src/cmd/format/paragraph.rs index c508c3573..d4a1c754d 100644 --- a/crates/engine/src/cmd/format/paragraph.rs +++ b/crates/engine/src/cmd/format/paragraph.rs @@ -134,7 +134,9 @@ pub(super) fn paragraph(s: &mut Session, p: &Value) -> Result { }; return Err(bad( "format.paragraph", - format!("`{k}` is a field of format.paragraphDialog (the whole Paragraph dialog), given{with}; format.paragraph does not read it"), + format!( + "`{k}` is a field of format.paragraphDialog (the whole Paragraph dialog); pass it there{with}. format.paragraph does not read it" + ), )); } return Err(e); From 76c05c1225c522989af4f01199fa56348eb04290 Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Sun, 18 Oct 2026 17:30:17 -0500 Subject: [PATCH 020/326] table.insertColumn* keeps the table's width and copies the neighbour column's cell formatting Inserting a column grew the table by one column width, so a full-width table ran off the slide, and the new cells came with none of the fill, bold or anchor the neighbouring cells had. The new column now takes the width of the column it is inserted beside and the other columns shrink in proportion, so the table keeps its total width (`keepWidth: false` restores the growth); each new cell takes the neighbour cell's fill, borders, margins, anchor, text direction and text properties (kept on the empty paragraph's end mark). Rows are left alone: a table growing by a row is normal. Found by an AI agent building a deck through the MCP server. Co-Authored-By: Claude Fable 5.1 --- crates/engine/src/cmd/table.rs | 90 ++++++++++++++++++++++++++++------ crates/engine/src/tests.rs | 42 ++++++++++++++++ 2 files changed, 117 insertions(+), 15 deletions(-) diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rs index 91ac7ac70..23f591719 100644 --- a/crates/engine/src/cmd/table.rs +++ b/crates/engine/src/cmd/table.rs @@ -1,7 +1,7 @@ //! Table Design and Table Layout tabs. use deckcraft_geom::{Affine, Point, Rect}; -use deckcraft_model::{Shape, ShapeKind, Table}; +use deckcraft_model::{Cell, Shape, ShapeKind, Table}; use serde_json::{Value, json}; use super::{ @@ -24,18 +24,24 @@ pub fn specs() -> Vec { "rowBelow", "table.insertRowBelow" )), - cmd!("table.insertColumnLeft", "Insert Left", ["Table Layout", "Rows & Columns"], None, "{col?, id?}", has_selection, |s, p| rows_cols( - s, - p, - "colLeft", - "table.insertColumnLeft" - )), - cmd!("table.insertColumnRight", "Insert Right", ["Table Layout", "Rows & Columns"], None, "{col?, id?}", has_selection, |s, p| rows_cols( - s, - p, - "colRight", - "table.insertColumnRight" - )), + cmd!( + "table.insertColumnLeft", + "Insert Left", + ["Table Layout", "Rows & Columns"], + None, + "{col?, keepWidth?: bool (default true: the other columns shrink in proportion so the table keeps its width; false: the table grows by the new column), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside", + has_selection, + |s, p| rows_cols(s, p, "colLeft", "table.insertColumnLeft") + ), + cmd!( + "table.insertColumnRight", + "Insert Right", + ["Table Layout", "Rows & Columns"], + None, + "{col?, keepWidth?: bool (default true: the other columns shrink in proportion so the table keeps its width; false: the table grows by the new column), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside", + has_selection, + |s, p| rows_cols(s, p, "colRight", "table.insertColumnRight") + ), cmd!("table.deleteRow", "Delete Rows", ["Table Layout", "Rows & Columns"], None, "{row?, id?}", has_selection, |s, p| rows_cols( s, p, @@ -315,13 +321,14 @@ fn with_table(s: &mut Session, p: &Value, cmd: &str, f: impl Fn(&mut Table) -> R fn rows_cols(s: &mut Session, p: &Value, op: &str, name: &'static str) -> Result { let (r, c) = at(s, p, name)?; + let keep_width = bool_or(p, "keepWidth", true); let op = op.to_string(); with_table(s, p, name, move |t| { match op.as_str() { "rowAbove" => t.insert_row(r), "rowBelow" => t.insert_row(r.saturating_add(1)), - "colLeft" => t.insert_col(c), - "colRight" => t.insert_col(c.saturating_add(1)), + "colLeft" => insert_col_like(t, c, c, keep_width), + "colRight" => insert_col_like(t, c.saturating_add(1), c, keep_width), "delRow" => { if !t.delete_row(r) { return Err(bad(name, "can't delete the last row")); @@ -337,6 +344,59 @@ fn rows_cols(s: &mut Session, p: &Value, op: &str, name: &'static str) -> Result }) } +/// Insert a column before `at` that looks like column `neighbour` (the one it is inserted beside): +/// its width, and in every row the neighbour cell's explicit formatting with no text. With +/// `keep_width` the columns then shrink in proportion so the table keeps its total width; +/// otherwise the table grows by the new column. +fn insert_col_like(t: &mut Table, at: usize, neighbour: usize, keep_width: bool) { + let total = t.width(); + let neighbour = neighbour.min(t.cols.len().saturating_sub(1)); + let w = t.cols.get(neighbour).copied(); + let templates: Vec> = t.rows.iter().map(|r| r.cells.get(neighbour).cloned()).collect(); + t.insert_col(at); + let at = at.min(t.cols.len().saturating_sub(1)); + if let (Some(w), Some(slot)) = (w, t.cols.get_mut(at)) { + *slot = w; + } + for (row, tpl) in t.rows.iter_mut().zip(templates) { + if let (Some(cell), Some(tpl)) = (row.cells.get_mut(at), tpl) { + copy_cell_format(cell, &tpl); + } + } + let grown = t.width(); + if keep_width && total > 1e-9 && grown > 1e-9 { + let k = total / grown; + for cw in &mut t.cols { + *cw *= k; + } + } +} + +/// `dst` takes `src`'s formatting (fill, borders, margins, anchor, text direction and the text +/// properties of its first paragraph, kept on the end mark of an empty paragraph) and keeps its +/// own spans and merge cover. +fn copy_cell_format(dst: &mut Cell, src: &Cell) { + dst.fill.clone_from(&src.fill); + dst.borders.clone_from(&src.borders); + dst.diag_down.clone_from(&src.diag_down); + dst.diag_up.clone_from(&src.diag_up); + dst.margins = src.margins; + dst.anchor = src.anchor; + dst.vertical = src.vertical; + let para = src.text.paragraphs.first().map(|p0| deckcraft_model::text::Paragraph { + level: p0.level, + props: p0.props.clone(), + runs: vec![], + def_props: p0.def_props.clone(), + end_props: p0.runs.first().map_or_else(|| p0.end_props.clone(), |r| r.props.clone()), + }); + dst.text = deckcraft_model::text::TextBody { + body: src.text.body.clone(), + list_style: src.text.list_style.clone(), + paragraphs: vec![para.unwrap_or_default()], + }; +} + fn merge(s: &mut Session, p: &Value) -> Result { let sel = s.doc()?.selection.cells; let from = cell_param(p, "from", "table.merge")?.or(sel.map(|c| c.1)).ok_or_else(|| bad("table.merge", "missing `from`"))?; diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 12fac5efc..81f9ed82a 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6483,6 +6483,48 @@ fn master_body_placeholder_format_keeps_per_level_formatting() { assert_eq!(shown(&s), vec![Some(28.0), Some(24.0)]); } +#[test] +fn table_insert_column_keeps_the_table_width_and_copies_the_neighbour_format() { + let mut s = session(); + let id = table_at(&mut s, &[280.0, 280.0, 280.0], json!([["a", "b", "c"], ["d", "e", "f"]])); + s.execute("table.cellFill", &json!({"id": id.0, "color": "#FF0000", "cells": [[0, 2], [1, 2]]})).unwrap(); + s.execute("table.cellMargins", &json!({"id": id.0, "left": 20, "right": 20, "top": 5, "bottom": 5, "cells": [[0, 2]]})).unwrap(); + s.execute("table.cellAlign", &json!({"id": id.0, "anchor": "bottom", "cells": [[0, 2]]})).unwrap(); + s.execute("edit.select", &json!({"ids": [id.0]})).unwrap(); + s.execute("table.selectCells", &json!({"from": [0, 2], "to": [1, 2]})).unwrap(); + s.execute("format.bold", &json!({"bold": true})).unwrap(); + // Right of the last column: four columns in the same 840 pt, the new one as wide as its + // neighbour, the others shrunk to make room. + s.execute("table.insertColumnRight", &json!({"id": id.0, "col": 2})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.n_cols(), 4); + assert!((t.width() - 840.0).abs() < 1e-6, "width {}", t.width()); + assert!(t.cols.iter().all(|w| (w - 210.0).abs() < 1e-6), "{:?}", t.cols); + let x = s.doc().unwrap().shape(id).unwrap().xfrm.unwrap(); + assert!((x.w - 840.0).abs() < 1e-6, "frame {}", x.w); + // The new cells take the neighbour's explicit formatting. + let new = t.cell(0, 3).unwrap(); + assert_eq!(new.fill, Some(deckcraft_model::Fill::solid(deckcraft_model::ColorRef::rgb(deckcraft_color::Rgba::rgb(255, 0, 0))))); + assert_eq!(new.margins, Some([20.0, 20.0, 5.0, 5.0])); + assert_eq!(new.anchor, Some(deckcraft_model::text::Anchor::Bottom)); + assert_eq!(new.text.text(), "", "the new cell is empty"); + let bold = new.text.paragraphs.first().map(|p| p.end_props.bold.or(p.def_props.bold)); + assert_eq!(bold, Some(Some(true)), "the neighbour's bold carries over: {:?}", new.text); + assert_eq!(t.cell(1, 3).unwrap().fill, t.cell(1, 2).unwrap().fill); + // Left of the first column: the neighbour is the old first column. + s.execute("table.insertColumnLeft", &json!({"id": id.0, "col": 0})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.n_cols(), 5); + assert!((t.width() - 840.0).abs() < 1e-6, "width {}", t.width()); + assert_eq!(t.cell(0, 1).unwrap().text.text(), "a"); + assert_eq!(t.cell(0, 0).unwrap().fill, None); + // keepWidth: false grows the table by the neighbour's width, as before. + s.execute("table.insertColumnRight", &json!({"id": id.0, "col": 4, "keepWidth": false})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.n_cols(), 6); + assert!((t.width() - 840.0 - 168.0).abs() < 1e-6, "width {}", t.width()); +} + #[test] fn slide_master_view_rejects_invalid_indices() { let mut s = Session::with_new(); From 63d1d2e588aefc83ad412b415addec0a2d9a3622 Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Sun, 18 Oct 2026 18:23:05 -0500 Subject: [PATCH 021/326] table.insertColumn* refuses a `keepWidth` that is not a bool, so a mistyped value is not taken as the default A `"keepWidth": "false"` was read as absent and the columns shrunk as if `true` had been asked; now the command answers an error naming the field and leaves the table alone, as the other bool params that are validated do. Co-Authored-By: Claude Fable 5.1 --- crates/engine/src/cmd/table.rs | 10 +++++++++- crates/engine/src/tests.rs | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rs index 23f591719..930849ef8 100644 --- a/crates/engine/src/cmd/table.rs +++ b/crates/engine/src/cmd/table.rs @@ -321,7 +321,15 @@ fn with_table(s: &mut Session, p: &Value, cmd: &str, f: impl Fn(&mut Table) -> R fn rows_cols(s: &mut Session, p: &Value, op: &str, name: &'static str) -> Result { let (r, c) = at(s, p, name)?; - let keep_width = bool_or(p, "keepWidth", true); + // Absent: keep the table's width; present, it must be a bool, so a mistyped value is refused + // rather than silently taken as the default. + let keep_width = match (op, p.get("keepWidth")) { + (_, None) | (_, Some(Value::Null)) => true, + (_, Some(Value::Bool(b))) => *b, + ("colLeft", Some(_)) => return Err(bad("table.insertColumnLeft", "`keepWidth` must be true or false")), + ("colRight", Some(_)) => return Err(bad("table.insertColumnRight", "`keepWidth` must be true or false")), + _ => true, + }; let op = op.to_string(); with_table(s, p, name, move |t| { match op.as_str() { diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 81f9ed82a..d6769a07a 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6525,6 +6525,21 @@ fn table_insert_column_keeps_the_table_width_and_copies_the_neighbour_format() { assert!((t.width() - 840.0 - 168.0).abs() < 1e-6, "width {}", t.width()); } +/// A `keepWidth` that is not a bool is refused, naming it, and the table is left alone; it used +/// to be read as absent and the columns shrunk as if `true` had been asked. +#[test] +fn table_insert_column_refuses_a_keep_width_that_is_not_a_bool() { + let mut s = session(); + let id = table_at(&mut s, &[280.0, 280.0, 280.0], json!([["a", "b", "c"]])); + for (cmd, bad) in [("table.insertColumnRight", json!("false")), ("table.insertColumnLeft", json!(0))] { + let err = s.execute(cmd, &json!({"id": id.0, "col": 1, "keepWidth": bad})).unwrap_err().to_string(); + assert!(err.contains("keepWidth") && err.contains(cmd), "{err}"); + let t = table_of(&s, id); + assert_eq!(t.n_cols(), 3, "{cmd} changed the table: {:?}", t.cols); + assert!((t.width() - 840.0).abs() < 1e-6, "width {}", t.width()); + } +} + #[test] fn slide_master_view_rejects_invalid_indices() { let mut s = Session::with_new(); From 6d04a70cd8a209dca70ede848a1d47302eaccea6 Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Sun, 18 Oct 2026 18:30:01 -0500 Subject: [PATCH 022/326] The column-insertion test also checks the journal entry and that each insertion is one undo step The test went through Session::execute but only read the table afterwards; it now checks the last journal entry is the call as made and that three undos bring back the three 280 pt columns, their text and the frame width. Co-Authored-By: Claude Fable 5.1 --- crates/engine/src/tests.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index d6769a07a..9ba9e1598 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6523,6 +6523,23 @@ fn table_insert_column_keeps_the_table_width_and_copies_the_neighbour_format() { let t = table_of(&s, id); assert_eq!(t.n_cols(), 6); assert!((t.width() - 840.0 - 168.0).abs() < 1e-6, "width {}", t.width()); + // The insertion is journaled as called, and each one is a single undo step back to the table + // as it was: the columns, their widths and the frame. + let (jid, jp) = s.journal.last().cloned().unwrap(); + assert_eq!(jid, "table.insertColumnRight"); + assert_eq!(jp["keepWidth"], json!(false), "{jp}"); + s.execute("edit.undo", &json!({})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.n_cols(), 5); + assert!((t.width() - 840.0).abs() < 1e-6, "width {}", t.width()); + s.execute("edit.undo", &json!({})).unwrap(); + s.execute("edit.undo", &json!({})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.n_cols(), 3); + assert!(t.cols.iter().all(|w| (w - 280.0).abs() < 1e-6), "{:?}", t.cols); + assert_eq!(t.cell(0, 2).unwrap().text.text(), "c"); + let x = s.doc().unwrap().shape(id).unwrap().xfrm.unwrap(); + assert!((x.w - 840.0).abs() < 1e-6, "frame {}", x.w); } /// A `keepWidth` that is not a bool is refused, naming it, and the table is left alone; it used From 522f097f50298435bef1a208b1d9a2701b65dfa6 Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Sun, 18 Oct 2026 23:18:25 -0500 Subject: [PATCH 023/326] [EE1] table.insertColumn* extends a merge that spans the neighbour column A horizontal merge covering the column the new one is inserted beside now grows over it, also at its edge (a merged title row keeps spanning the table). Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd/table.rs | 14 +++++++++---- crates/engine/src/tests.rs | 38 ++++++++++++++++++++++++++++++++++ crates/model/src/table.rs | 34 +++++++++++++++++++++++++++++- 3 files changed, 81 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rs index 930849ef8..76be6bfb0 100644 --- a/crates/engine/src/cmd/table.rs +++ b/crates/engine/src/cmd/table.rs @@ -29,7 +29,7 @@ pub fn specs() -> Vec { "Insert Left", ["Table Layout", "Rows & Columns"], None, - "{col?, keepWidth?: bool (default true: the other columns shrink in proportion so the table keeps its width; false: the table grows by the new column), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside", + "{col?, keepWidth?: bool (default true: the other columns shrink in proportion so the table keeps its width; false: the table grows by the new column), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside; a merged row that spans that column grows to span the new one", has_selection, |s, p| rows_cols(s, p, "colLeft", "table.insertColumnLeft") ), @@ -38,7 +38,7 @@ pub fn specs() -> Vec { "Insert Right", ["Table Layout", "Rows & Columns"], None, - "{col?, keepWidth?: bool (default true: the other columns shrink in proportion so the table keeps its width; false: the table grows by the new column), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside", + "{col?, keepWidth?: bool (default true: the other columns shrink in proportion so the table keeps its width; false: the table grows by the new column), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside; a merged row that spans that column grows to span the new one", has_selection, |s, p| rows_cols(s, p, "colRight", "table.insertColumnRight") ), @@ -361,13 +361,19 @@ fn insert_col_like(t: &mut Table, at: usize, neighbour: usize, keep_width: bool) let neighbour = neighbour.min(t.cols.len().saturating_sub(1)); let w = t.cols.get(neighbour).copied(); let templates: Vec> = t.rows.iter().map(|r| r.cells.get(neighbour).cloned()).collect(); - t.insert_col(at); + t.insert_col_beside(at, Some(neighbour)); let at = at.min(t.cols.len().saturating_sub(1)); if let (Some(w), Some(slot)) = (w, t.cols.get_mut(at)) { *slot = w; } for (row, tpl) in t.rows.iter_mut().zip(templates) { - if let (Some(cell), Some(tpl)) = (row.cells.get_mut(at), tpl) { + let Some(tpl) = tpl else { continue }; + // Inserted left of a merge's anchor, the merge now starts at the new cell, which took the + // anchor's cell whole, text and formatting (Table::insert_col_beside); the old anchor, + // covered now, is the empty cell that gets the neighbour's formatting. Read off the table + // as it is now: a span the file lets run past the last column is no merge to the model. + let anchor_moved = row.cells.get(at).is_some_and(|c| c.grid_span > 1 && !c.is_covered()); + if let Some(cell) = row.cells.get_mut(if anchor_moved { at + 1 } else { at }) { copy_cell_format(cell, &tpl); } } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 9ba9e1598..fc6548597 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6557,6 +6557,44 @@ fn table_insert_column_refuses_a_keep_width_that_is_not_a_bool() { } } +#[test] +fn table_insert_column_extends_a_merge_that_spans_the_neighbour() { + let mut s = session(); + let id = table_at(&mut s, &[100.0, 100.0, 100.0], json!([["title", "", ""], ["a", "b", "c"]])); + s.execute("table.merge", &json!({"id": id.0, "from": [0, 0], "to": [0, 2]})).unwrap(); + s.execute("table.insertColumnRight", &json!({"id": id.0, "col": 2})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.cell(0, 0).unwrap().grid_span, 4, "the title now spans the new column"); + assert!(t.cell(0, 3).unwrap().h_merge); + assert_eq!(t.cell(1, 0).unwrap().grid_span, 1); + s.execute("table.insertColumnLeft", &json!({"id": id.0, "col": 0})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.cell(0, 0).unwrap().grid_span, 5, "left of the first column too"); + assert_eq!(t.cell(0, 0).unwrap().text.text(), "title"); +} + +/// A span a file lets run past the last column is no merge to the model, so inserting left of +/// that cell adds a plain column: the cell keeps its text and the new one gets its formatting. +#[test] +fn table_insert_column_left_of_an_overflowing_span_keeps_the_text() { + let mut s = session(); + let id = table_at(&mut s, &[100.0, 100.0, 100.0], json!([["a", "b", "wide"], ["d", "e", "f"]])); + { + let doc = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc); + let slide = std::sync::Arc::make_mut(&mut doc.slides[0]); + let sh = deckcraft_model::find_shape_mut(&mut slide.shapes, id).unwrap(); + let deckcraft_model::ShapeKind::Table(t) = &mut sh.kind else { panic!("a table") }; + t.cell_mut(0, 2).unwrap().grid_span = 4; + } + s.execute("table.cellFill", &json!({"id": id.0, "color": "#FF0000", "cells": [[0, 2]]})).unwrap(); + s.execute("table.insertColumnLeft", &json!({"id": id.0, "col": 2})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.n_cols(), 4); + assert_eq!(t.cell(0, 3).unwrap().text.text(), "wide", "the cell keeps its text"); + assert_eq!(t.cell(0, 2).unwrap().text.text(), ""); + assert_eq!(t.cell(0, 2).unwrap().fill, t.cell(0, 3).unwrap().fill, "the new cell takes the neighbour's fill"); +} + #[test] fn slide_master_view_rejects_invalid_indices() { let mut s = Session::with_new(); diff --git a/crates/model/src/table.rs b/crates/model/src/table.rs index 118851ecd..bb2ee48f0 100644 --- a/crates/model/src/table.rs +++ b/crates/model/src/table.rs @@ -122,6 +122,12 @@ impl Table { } /// Insert an empty column before `at`. A merge the new column falls inside grows to cover it. pub fn insert_col(&mut self, at: usize) { + self.insert_col_beside(at, None); + } + /// Like [`Table::insert_col`], for a column inserted beside column `neighbour` (as before the + /// insertion): a horizontal merge that spans the neighbour also grows over the new column, even when the + /// insertion point is at its edge. + pub fn insert_col_beside(&mut self, at: usize, neighbour: Option) { let at = at.min(self.cols.len()); let merges = self.merges(); let w = self.cols.get(at.saturating_sub(1)).copied().unwrap_or(80.0); @@ -130,7 +136,13 @@ impl Table { let i = at.min(r.cells.len()); r.cells.insert(i, Cell::new("")); } - self.set_merges(merges.into_iter().map(|m| m.insert_col(at))); + let grows = |m: &Merge| matches!(neighbour, Some(n) if m.gs > 1 && m.c <= n && n < m.c + m.gs && (at == m.c || at == m.c + m.gs)); + // A merge that grows to the left starts at the new cell, which takes the anchor's text and + // formatting; the old anchor becomes a covered, empty cell. + for m in merges.iter().filter(|m| grows(m) && at == m.c) { + self.move_anchor((m.r, at + 1), (m.r, at)); + } + self.set_merges(merges.into_iter().map(|m| if grows(&m) { Merge { gs: m.gs + 1, ..m } } else { m.insert_col(at) })); } /// Delete row `at`. Merges through it shrink; a merge anchored on it moves its anchor (and /// text) to the next row it covers. @@ -644,4 +656,24 @@ mod tests { assert!(t.split(0, 0)); assert_eq!(t.cell(0, 0).map(|c| (c.grid_span, c.row_span)), Some((1, 1))); } + + /// A column inserted left of a merge's anchor grows the merge, which now starts at the new + /// cell: that cell holds the text, and the old anchor is a covered, empty cell. + #[test] + fn a_column_inserted_left_of_a_merge_keeps_the_text_in_its_anchor() { + let mut t = merged(); + t.insert_col_beside(1, Some(1)); + assert_topology(&t); + let a = t.cell(1, 1).unwrap(); + assert_eq!((a.grid_span, a.row_span), (3, 2)); + assert_eq!(anchor_text(&t, 1, 1), "M"); + assert!(t.cell(1, 2).unwrap().is_covered()); + assert_eq!(anchor_text(&t, 1, 2), ""); + // Right of the merge, the anchor stays where it is. + let mut t = merged(); + t.insert_col_beside(3, Some(2)); + assert_topology(&t); + assert_eq!(t.cell(1, 1).map(|c| c.grid_span), Some(3)); + assert_eq!(anchor_text(&t, 1, 1), "M"); + } } From d3161f6bb8435243f531e2bd38b4cc34dfff30df Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Mon, 19 Oct 2026 10:07:03 -0500 Subject: [PATCH 024/326] [CCC1] table.insertColumn leaves the other column widths alone PowerPoint inserts the new column as wide as the column it is inserted beside and widens the table by that amount; the existing widths stay. DeckCraft rescaled every column to keep the table width by default. keepWidth now defaults to false (true stays as an opt-in). Deleting a column already narrows the table by its width and leaves the rest alone; a test pins both. Co-Authored-By: Claude Fable 5.1 --- crates/engine/src/cmd/table.rs | 12 +-- crates/engine/src/tests.rs | 147 ++++++++++++++++++++------------- 2 files changed, 94 insertions(+), 65 deletions(-) diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rs index 76be6bfb0..7ea66acfd 100644 --- a/crates/engine/src/cmd/table.rs +++ b/crates/engine/src/cmd/table.rs @@ -29,7 +29,7 @@ pub fn specs() -> Vec { "Insert Left", ["Table Layout", "Rows & Columns"], None, - "{col?, keepWidth?: bool (default true: the other columns shrink in proportion so the table keeps its width; false: the table grows by the new column), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside; a merged row that spans that column grows to span the new one", + "{col?, keepWidth?: bool (default false, as in PowerPoint: the table grows by the new column and the other widths stay; true: the other columns shrink in proportion so the table keeps its width), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside; a merged row that spans that column grows to span the new one", has_selection, |s, p| rows_cols(s, p, "colLeft", "table.insertColumnLeft") ), @@ -38,7 +38,7 @@ pub fn specs() -> Vec { "Insert Right", ["Table Layout", "Rows & Columns"], None, - "{col?, keepWidth?: bool (default true: the other columns shrink in proportion so the table keeps its width; false: the table grows by the new column), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside; a merged row that spans that column grows to span the new one", + "{col?, keepWidth?: bool (default false, as in PowerPoint: the table grows by the new column and the other widths stay; true: the other columns shrink in proportion so the table keeps its width), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside; a merged row that spans that column grows to span the new one", has_selection, |s, p| rows_cols(s, p, "colRight", "table.insertColumnRight") ), @@ -321,14 +321,14 @@ fn with_table(s: &mut Session, p: &Value, cmd: &str, f: impl Fn(&mut Table) -> R fn rows_cols(s: &mut Session, p: &Value, op: &str, name: &'static str) -> Result { let (r, c) = at(s, p, name)?; - // Absent: keep the table's width; present, it must be a bool, so a mistyped value is refused + // Absent: the table grows, as in PowerPoint; present, it must be a bool, so a mistyped value is refused // rather than silently taken as the default. let keep_width = match (op, p.get("keepWidth")) { - (_, None) | (_, Some(Value::Null)) => true, + (_, None) | (_, Some(Value::Null)) => false, (_, Some(Value::Bool(b))) => *b, ("colLeft", Some(_)) => return Err(bad("table.insertColumnLeft", "`keepWidth` must be true or false")), ("colRight", Some(_)) => return Err(bad("table.insertColumnRight", "`keepWidth` must be true or false")), - _ => true, + _ => false, }; let op = op.to_string(); with_table(s, p, name, move |t| { @@ -355,7 +355,7 @@ fn rows_cols(s: &mut Session, p: &Value, op: &str, name: &'static str) -> Result /// Insert a column before `at` that looks like column `neighbour` (the one it is inserted beside): /// its width, and in every row the neighbour cell's explicit formatting with no text. With /// `keep_width` the columns then shrink in proportion so the table keeps its total width; -/// otherwise the table grows by the new column. +/// otherwise (PowerPoint's behaviour) the table grows by the new column and the widths stay. fn insert_col_like(t: &mut Table, at: usize, neighbour: usize, keep_width: bool) { let total = t.width(); let neighbour = neighbour.min(t.cols.len().saturating_sub(1)); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index fc6548597..04d26951f 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6483,65 +6483,6 @@ fn master_body_placeholder_format_keeps_per_level_formatting() { assert_eq!(shown(&s), vec![Some(28.0), Some(24.0)]); } -#[test] -fn table_insert_column_keeps_the_table_width_and_copies_the_neighbour_format() { - let mut s = session(); - let id = table_at(&mut s, &[280.0, 280.0, 280.0], json!([["a", "b", "c"], ["d", "e", "f"]])); - s.execute("table.cellFill", &json!({"id": id.0, "color": "#FF0000", "cells": [[0, 2], [1, 2]]})).unwrap(); - s.execute("table.cellMargins", &json!({"id": id.0, "left": 20, "right": 20, "top": 5, "bottom": 5, "cells": [[0, 2]]})).unwrap(); - s.execute("table.cellAlign", &json!({"id": id.0, "anchor": "bottom", "cells": [[0, 2]]})).unwrap(); - s.execute("edit.select", &json!({"ids": [id.0]})).unwrap(); - s.execute("table.selectCells", &json!({"from": [0, 2], "to": [1, 2]})).unwrap(); - s.execute("format.bold", &json!({"bold": true})).unwrap(); - // Right of the last column: four columns in the same 840 pt, the new one as wide as its - // neighbour, the others shrunk to make room. - s.execute("table.insertColumnRight", &json!({"id": id.0, "col": 2})).unwrap(); - let t = table_of(&s, id); - assert_eq!(t.n_cols(), 4); - assert!((t.width() - 840.0).abs() < 1e-6, "width {}", t.width()); - assert!(t.cols.iter().all(|w| (w - 210.0).abs() < 1e-6), "{:?}", t.cols); - let x = s.doc().unwrap().shape(id).unwrap().xfrm.unwrap(); - assert!((x.w - 840.0).abs() < 1e-6, "frame {}", x.w); - // The new cells take the neighbour's explicit formatting. - let new = t.cell(0, 3).unwrap(); - assert_eq!(new.fill, Some(deckcraft_model::Fill::solid(deckcraft_model::ColorRef::rgb(deckcraft_color::Rgba::rgb(255, 0, 0))))); - assert_eq!(new.margins, Some([20.0, 20.0, 5.0, 5.0])); - assert_eq!(new.anchor, Some(deckcraft_model::text::Anchor::Bottom)); - assert_eq!(new.text.text(), "", "the new cell is empty"); - let bold = new.text.paragraphs.first().map(|p| p.end_props.bold.or(p.def_props.bold)); - assert_eq!(bold, Some(Some(true)), "the neighbour's bold carries over: {:?}", new.text); - assert_eq!(t.cell(1, 3).unwrap().fill, t.cell(1, 2).unwrap().fill); - // Left of the first column: the neighbour is the old first column. - s.execute("table.insertColumnLeft", &json!({"id": id.0, "col": 0})).unwrap(); - let t = table_of(&s, id); - assert_eq!(t.n_cols(), 5); - assert!((t.width() - 840.0).abs() < 1e-6, "width {}", t.width()); - assert_eq!(t.cell(0, 1).unwrap().text.text(), "a"); - assert_eq!(t.cell(0, 0).unwrap().fill, None); - // keepWidth: false grows the table by the neighbour's width, as before. - s.execute("table.insertColumnRight", &json!({"id": id.0, "col": 4, "keepWidth": false})).unwrap(); - let t = table_of(&s, id); - assert_eq!(t.n_cols(), 6); - assert!((t.width() - 840.0 - 168.0).abs() < 1e-6, "width {}", t.width()); - // The insertion is journaled as called, and each one is a single undo step back to the table - // as it was: the columns, their widths and the frame. - let (jid, jp) = s.journal.last().cloned().unwrap(); - assert_eq!(jid, "table.insertColumnRight"); - assert_eq!(jp["keepWidth"], json!(false), "{jp}"); - s.execute("edit.undo", &json!({})).unwrap(); - let t = table_of(&s, id); - assert_eq!(t.n_cols(), 5); - assert!((t.width() - 840.0).abs() < 1e-6, "width {}", t.width()); - s.execute("edit.undo", &json!({})).unwrap(); - s.execute("edit.undo", &json!({})).unwrap(); - let t = table_of(&s, id); - assert_eq!(t.n_cols(), 3); - assert!(t.cols.iter().all(|w| (w - 280.0).abs() < 1e-6), "{:?}", t.cols); - assert_eq!(t.cell(0, 2).unwrap().text.text(), "c"); - let x = s.doc().unwrap().shape(id).unwrap().xfrm.unwrap(); - assert!((x.w - 840.0).abs() < 1e-6, "frame {}", x.w); -} - /// A `keepWidth` that is not a bool is refused, naming it, and the table is left alone; it used /// to be read as absent and the columns shrunk as if `true` had been asked. #[test] @@ -6595,6 +6536,94 @@ fn table_insert_column_left_of_an_overflowing_span_keeps_the_text() { assert_eq!(t.cell(0, 2).unwrap().fill, t.cell(0, 3).unwrap().fill, "the new cell takes the neighbour's fill"); } +#[test] +fn table_insert_column_with_keep_width_keeps_the_table_width_and_copies_the_neighbour_format() { + let mut s = session(); + let id = table_at(&mut s, &[280.0, 280.0, 280.0], json!([["a", "b", "c"], ["d", "e", "f"]])); + s.execute("table.cellFill", &json!({"id": id.0, "color": "#FF0000", "cells": [[0, 2], [1, 2]]})).unwrap(); + s.execute("table.cellMargins", &json!({"id": id.0, "left": 20, "right": 20, "top": 5, "bottom": 5, "cells": [[0, 2]]})).unwrap(); + s.execute("table.cellAlign", &json!({"id": id.0, "anchor": "bottom", "cells": [[0, 2]]})).unwrap(); + s.execute("edit.select", &json!({"ids": [id.0]})).unwrap(); + s.execute("table.selectCells", &json!({"from": [0, 2], "to": [1, 2]})).unwrap(); + s.execute("format.bold", &json!({"on": true})).unwrap(); + // Right of the last column: four columns in the same 840 pt, the new one as wide as its + // neighbour, the others shrunk to make room. + s.execute("table.insertColumnRight", &json!({"id": id.0, "col": 2, "keepWidth": true})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.n_cols(), 4); + assert!((t.width() - 840.0).abs() < 1e-6, "width {}", t.width()); + assert!(t.cols.iter().all(|w| (w - 210.0).abs() < 1e-6), "{:?}", t.cols); + let x = s.doc().unwrap().shape(id).unwrap().xfrm.unwrap(); + assert!((x.w - 840.0).abs() < 1e-6, "frame {}", x.w); + // The new cells take the neighbour's explicit formatting. + let new = t.cell(0, 3).unwrap(); + assert_eq!(new.fill, Some(deckcraft_model::Fill::solid(deckcraft_model::ColorRef::rgb(deckcraft_color::Rgba::rgb(255, 0, 0))))); + assert_eq!(new.margins, Some([20.0, 20.0, 5.0, 5.0])); + assert_eq!(new.anchor, Some(deckcraft_model::text::Anchor::Bottom)); + assert_eq!(new.text.text(), "", "the new cell is empty"); + let bold = new.text.paragraphs.first().map(|p| p.end_props.bold.or(p.def_props.bold)); + assert_eq!(bold, Some(Some(true)), "the neighbour's bold carries over: {:?}", new.text); + assert_eq!(t.cell(1, 3).unwrap().fill, t.cell(1, 2).unwrap().fill); + // Left of the first column: the neighbour is the old first column. + s.execute("table.insertColumnLeft", &json!({"id": id.0, "col": 0, "keepWidth": true})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.n_cols(), 5); + assert!((t.width() - 840.0).abs() < 1e-6, "width {}", t.width()); + assert_eq!(t.cell(0, 1).unwrap().text.text(), "a"); + assert_eq!(t.cell(0, 0).unwrap().fill, None); + // keepWidth: false grows the table by the neighbour's width, as before. + s.execute("table.insertColumnRight", &json!({"id": id.0, "col": 4, "keepWidth": false})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.n_cols(), 6); + assert!((t.width() - 840.0 - 168.0).abs() < 1e-6, "width {}", t.width()); + // The insertion is journaled as called, and each one is a single undo step back to the table + // as it was: the columns, their widths and the frame. + let (jid, jp) = s.journal.last().cloned().unwrap(); + assert_eq!(jid, "table.insertColumnRight"); + assert_eq!(jp["keepWidth"], json!(false), "{jp}"); + s.execute("edit.undo", &json!({})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.n_cols(), 5); + assert!((t.width() - 840.0).abs() < 1e-6, "width {}", t.width()); + s.execute("edit.undo", &json!({})).unwrap(); + s.execute("edit.undo", &json!({})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.n_cols(), 3); + assert!(t.cols.iter().all(|w| (w - 280.0).abs() < 1e-6), "{:?}", t.cols); + assert_eq!(t.cell(0, 2).unwrap().text.text(), "c"); + let x = s.doc().unwrap().shape(id).unwrap().xfrm.unwrap(); + assert!((x.w - 840.0).abs() < 1e-6, "frame {}", x.w); +} + +/// PowerPoint inserts a column as wide as its neighbour and widens the table by that amount; the +/// other widths stay. Deleting a column narrows the table by its width, the others untouched. +#[test] +fn table_insert_and_delete_column_leave_other_widths_alone() { + let mut s = session(); + let id = table_at(&mut s, &[160.0, 234.0, 235.0, 235.0], json!([["a", "b", "c", "d"]])); + for (cmd, col, at, wide) in [("table.insertColumnRight", 0, 1, 160.0), ("table.insertColumnLeft", 3, 3, 235.0)] { + let before = table_of(&s, id).cols.clone(); + let w0 = table_of(&s, id).width(); + s.execute(cmd, &json!({"id": id.0, "col": col})).unwrap(); + let t = table_of(&s, id); + let mut want = before.clone(); + want.insert(at, wide); + assert_eq!(t.cols, want, "{cmd}"); + assert!((t.width() - w0 - wide).abs() < 1e-6, "{cmd} width {}", t.width()); + let x = s.doc().unwrap().shape(id).unwrap().xfrm.unwrap(); + assert!((x.w - t.width()).abs() < 1e-6, "{cmd} frame {}", x.w); + } + let before = table_of(&s, id).cols.clone(); + s.execute("table.deleteColumn", &json!({"id": id.0, "col": 1})).unwrap(); + let t = table_of(&s, id); + let mut want = before.clone(); + let gone = want.remove(1); + assert_eq!(t.cols, want); + assert!((t.width() - (before.iter().sum::() - gone)).abs() < 1e-6); + let x = s.doc().unwrap().shape(id).unwrap().xfrm.unwrap(); + assert!((x.w - t.width()).abs() < 1e-6, "frame {}", x.w); +} + #[test] fn slide_master_view_rejects_invalid_indices() { let mut s = Session::with_new(); From 54a9f741d6327ef8794de6237e7d81f3aad0b267 Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Mon, 2 Nov 2026 17:02:15 -0600 Subject: [PATCH 025/326] Test: a column inserted into a table near the slide's edge By default the table grows past the edge, as PowerPoint's Insert Right does (the frame keeps its left); keepWidth: true keeps it on the slide. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/tests.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 04d26951f..fbc0ebd4b 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6595,6 +6595,30 @@ fn table_insert_column_with_keep_width_keeps_the_table_width_and_copies_the_neig assert!((x.w - 840.0).abs() < 1e-6, "frame {}", x.w); } +/// A table near the slide's right edge, with no room for another column: by default an inserted +/// column widens it past the edge, as PowerPoint's Insert Right does (the frame keeps its left and +/// grows), and `keepWidth: true` keeps it on the slide. +#[test] +fn table_insert_column_near_the_slide_edge_grows_past_it_unless_it_keeps_its_width() { + let mut s = session(); + let id = table_at(&mut s, &[280.0, 280.0, 280.0], json!([["a", "b", "c"]])); + let slide_w = s.doc().unwrap().doc.slide_size.width; + let frame = |s: &Session| s.doc().unwrap().shape(id).unwrap().xfrm.unwrap(); + let before = frame(&s); + assert!(before.x + before.w <= slide_w && before.x + before.w + 280.0 > slide_w, "another column won't fit: {before:?}"); + s.execute("table.insertColumnRight", &json!({"id": id.0, "col": 2})).unwrap(); + assert_eq!(table_of(&s, id).n_cols(), 4); + let grown = frame(&s); + assert!((grown.x - before.x).abs() < 1e-6 && (grown.w - 1120.0).abs() < 1e-6, "{grown:?}"); + assert!(grown.x + grown.w > slide_w, "past the edge"); + s.execute("edit.undo", &json!({})).unwrap(); + s.execute("table.insertColumnRight", &json!({"id": id.0, "col": 2, "keepWidth": true})).unwrap(); + let kept = frame(&s); + assert_eq!(table_of(&s, id).n_cols(), 4); + assert!((kept.x - before.x).abs() < 1e-6 && (kept.w - before.w).abs() < 1e-6, "{kept:?}"); + assert!(kept.x + kept.w <= slide_w, "still on the slide"); +} + /// PowerPoint inserts a column as wide as its neighbour and widens the table by that amount; the /// other widths stay. Deleting a column narrows the table by its width, the others untouched. #[test] From 8b6fdce1ba83464ca39f041bed40cd2134116d5e Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Wed, 4 Nov 2026 19:50:27 -0600 Subject: [PATCH 026/326] Move growing a merge at its edge on column insertion to its own change The review asked for it separately: this PR keeps the neighbour's width and cell formatting for an inserted column, and an optional keepWidth. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/table.rs | 14 ++++--------- crates/engine/src/tests.rs | 38 ---------------------------------- crates/model/src/table.rs | 34 +----------------------------- 3 files changed, 5 insertions(+), 81 deletions(-) diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rs index 7ea66acfd..8d5305ce1 100644 --- a/crates/engine/src/cmd/table.rs +++ b/crates/engine/src/cmd/table.rs @@ -29,7 +29,7 @@ pub fn specs() -> Vec { "Insert Left", ["Table Layout", "Rows & Columns"], None, - "{col?, keepWidth?: bool (default false, as in PowerPoint: the table grows by the new column and the other widths stay; true: the other columns shrink in proportion so the table keeps its width), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside; a merged row that spans that column grows to span the new one", + "{col?, keepWidth?: bool (default false, as in PowerPoint: the table grows by the new column and the other widths stay; true: the other columns shrink in proportion so the table keeps its width), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside", has_selection, |s, p| rows_cols(s, p, "colLeft", "table.insertColumnLeft") ), @@ -38,7 +38,7 @@ pub fn specs() -> Vec { "Insert Right", ["Table Layout", "Rows & Columns"], None, - "{col?, keepWidth?: bool (default false, as in PowerPoint: the table grows by the new column and the other widths stay; true: the other columns shrink in proportion so the table keeps its width), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside; a merged row that spans that column grows to span the new one", + "{col?, keepWidth?: bool (default false, as in PowerPoint: the table grows by the new column and the other widths stay; true: the other columns shrink in proportion so the table keeps its width), id?} the new column takes the width and cell formatting (fill, margins, anchor, text properties) of the column it is inserted beside", has_selection, |s, p| rows_cols(s, p, "colRight", "table.insertColumnRight") ), @@ -361,19 +361,13 @@ fn insert_col_like(t: &mut Table, at: usize, neighbour: usize, keep_width: bool) let neighbour = neighbour.min(t.cols.len().saturating_sub(1)); let w = t.cols.get(neighbour).copied(); let templates: Vec> = t.rows.iter().map(|r| r.cells.get(neighbour).cloned()).collect(); - t.insert_col_beside(at, Some(neighbour)); + t.insert_col(at); let at = at.min(t.cols.len().saturating_sub(1)); if let (Some(w), Some(slot)) = (w, t.cols.get_mut(at)) { *slot = w; } for (row, tpl) in t.rows.iter_mut().zip(templates) { - let Some(tpl) = tpl else { continue }; - // Inserted left of a merge's anchor, the merge now starts at the new cell, which took the - // anchor's cell whole, text and formatting (Table::insert_col_beside); the old anchor, - // covered now, is the empty cell that gets the neighbour's formatting. Read off the table - // as it is now: a span the file lets run past the last column is no merge to the model. - let anchor_moved = row.cells.get(at).is_some_and(|c| c.grid_span > 1 && !c.is_covered()); - if let Some(cell) = row.cells.get_mut(if anchor_moved { at + 1 } else { at }) { + if let (Some(cell), Some(tpl)) = (row.cells.get_mut(at), tpl) { copy_cell_format(cell, &tpl); } } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index fbc0ebd4b..96669cb01 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6498,44 +6498,6 @@ fn table_insert_column_refuses_a_keep_width_that_is_not_a_bool() { } } -#[test] -fn table_insert_column_extends_a_merge_that_spans_the_neighbour() { - let mut s = session(); - let id = table_at(&mut s, &[100.0, 100.0, 100.0], json!([["title", "", ""], ["a", "b", "c"]])); - s.execute("table.merge", &json!({"id": id.0, "from": [0, 0], "to": [0, 2]})).unwrap(); - s.execute("table.insertColumnRight", &json!({"id": id.0, "col": 2})).unwrap(); - let t = table_of(&s, id); - assert_eq!(t.cell(0, 0).unwrap().grid_span, 4, "the title now spans the new column"); - assert!(t.cell(0, 3).unwrap().h_merge); - assert_eq!(t.cell(1, 0).unwrap().grid_span, 1); - s.execute("table.insertColumnLeft", &json!({"id": id.0, "col": 0})).unwrap(); - let t = table_of(&s, id); - assert_eq!(t.cell(0, 0).unwrap().grid_span, 5, "left of the first column too"); - assert_eq!(t.cell(0, 0).unwrap().text.text(), "title"); -} - -/// A span a file lets run past the last column is no merge to the model, so inserting left of -/// that cell adds a plain column: the cell keeps its text and the new one gets its formatting. -#[test] -fn table_insert_column_left_of_an_overflowing_span_keeps_the_text() { - let mut s = session(); - let id = table_at(&mut s, &[100.0, 100.0, 100.0], json!([["a", "b", "wide"], ["d", "e", "f"]])); - { - let doc = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc); - let slide = std::sync::Arc::make_mut(&mut doc.slides[0]); - let sh = deckcraft_model::find_shape_mut(&mut slide.shapes, id).unwrap(); - let deckcraft_model::ShapeKind::Table(t) = &mut sh.kind else { panic!("a table") }; - t.cell_mut(0, 2).unwrap().grid_span = 4; - } - s.execute("table.cellFill", &json!({"id": id.0, "color": "#FF0000", "cells": [[0, 2]]})).unwrap(); - s.execute("table.insertColumnLeft", &json!({"id": id.0, "col": 2})).unwrap(); - let t = table_of(&s, id); - assert_eq!(t.n_cols(), 4); - assert_eq!(t.cell(0, 3).unwrap().text.text(), "wide", "the cell keeps its text"); - assert_eq!(t.cell(0, 2).unwrap().text.text(), ""); - assert_eq!(t.cell(0, 2).unwrap().fill, t.cell(0, 3).unwrap().fill, "the new cell takes the neighbour's fill"); -} - #[test] fn table_insert_column_with_keep_width_keeps_the_table_width_and_copies_the_neighbour_format() { let mut s = session(); diff --git a/crates/model/src/table.rs b/crates/model/src/table.rs index bb2ee48f0..118851ecd 100644 --- a/crates/model/src/table.rs +++ b/crates/model/src/table.rs @@ -122,12 +122,6 @@ impl Table { } /// Insert an empty column before `at`. A merge the new column falls inside grows to cover it. pub fn insert_col(&mut self, at: usize) { - self.insert_col_beside(at, None); - } - /// Like [`Table::insert_col`], for a column inserted beside column `neighbour` (as before the - /// insertion): a horizontal merge that spans the neighbour also grows over the new column, even when the - /// insertion point is at its edge. - pub fn insert_col_beside(&mut self, at: usize, neighbour: Option) { let at = at.min(self.cols.len()); let merges = self.merges(); let w = self.cols.get(at.saturating_sub(1)).copied().unwrap_or(80.0); @@ -136,13 +130,7 @@ impl Table { let i = at.min(r.cells.len()); r.cells.insert(i, Cell::new("")); } - let grows = |m: &Merge| matches!(neighbour, Some(n) if m.gs > 1 && m.c <= n && n < m.c + m.gs && (at == m.c || at == m.c + m.gs)); - // A merge that grows to the left starts at the new cell, which takes the anchor's text and - // formatting; the old anchor becomes a covered, empty cell. - for m in merges.iter().filter(|m| grows(m) && at == m.c) { - self.move_anchor((m.r, at + 1), (m.r, at)); - } - self.set_merges(merges.into_iter().map(|m| if grows(&m) { Merge { gs: m.gs + 1, ..m } } else { m.insert_col(at) })); + self.set_merges(merges.into_iter().map(|m| m.insert_col(at))); } /// Delete row `at`. Merges through it shrink; a merge anchored on it moves its anchor (and /// text) to the next row it covers. @@ -656,24 +644,4 @@ mod tests { assert!(t.split(0, 0)); assert_eq!(t.cell(0, 0).map(|c| (c.grid_span, c.row_span)), Some((1, 1))); } - - /// A column inserted left of a merge's anchor grows the merge, which now starts at the new - /// cell: that cell holds the text, and the old anchor is a covered, empty cell. - #[test] - fn a_column_inserted_left_of_a_merge_keeps_the_text_in_its_anchor() { - let mut t = merged(); - t.insert_col_beside(1, Some(1)); - assert_topology(&t); - let a = t.cell(1, 1).unwrap(); - assert_eq!((a.grid_span, a.row_span), (3, 2)); - assert_eq!(anchor_text(&t, 1, 1), "M"); - assert!(t.cell(1, 2).unwrap().is_covered()); - assert_eq!(anchor_text(&t, 1, 2), ""); - // Right of the merge, the anchor stays where it is. - let mut t = merged(); - t.insert_col_beside(3, Some(2)); - assert_topology(&t); - assert_eq!(t.cell(1, 1).map(|c| c.grid_span), Some(3)); - assert_eq!(anchor_text(&t, 1, 1), "M"); - } } From 555e12c1a069ebfffb82455a4aa546014d4109d6 Mon Sep 17 00:00:00 2001 From: aiongg <67543387+aiongg@users.noreply.github.com> Date: Thu, 5 Nov 2026 03:45:16 +0000 Subject: [PATCH 027/326] Apply review fixes - crates/engine/src/cmd/table.rs --- crates/engine/src/cmd/table.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rs index 8d5305ce1..c6f2be0f7 100644 --- a/crates/engine/src/cmd/table.rs +++ b/crates/engine/src/cmd/table.rs @@ -391,12 +391,13 @@ fn copy_cell_format(dst: &mut Cell, src: &Cell) { dst.margins = src.margins; dst.anchor = src.anchor; dst.vertical = src.vertical; - let para = src.text.paragraphs.first().map(|p0| deckcraft_model::text::Paragraph { - level: p0.level, - props: p0.props.clone(), - runs: vec![], - def_props: p0.def_props.clone(), - end_props: p0.runs.first().map_or_else(|| p0.end_props.clone(), |r| r.props.clone()), + dst.anchor_ctr = src.anchor_ctr; + dst.horz_overflow = src.horz_overflow; + let para = src.text.paragraphs.first().map(|p0| { + let mut end_props = p0.runs.first().map_or_else(|| p0.end_props.clone(), |r| r.props.clone()); + end_props.link = None; + end_props.hover = None; + deckcraft_model::text::Paragraph { level: p0.level, props: p0.props.clone(), runs: vec![], def_props: p0.def_props.clone(), end_props } }); dst.text = deckcraft_model::text::TextBody { body: src.text.body.clone(), From f0c202dca8552467cb594550f93b159e3162593e Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Wed, 4 Nov 2026 22:04:32 -0600 Subject: [PATCH 028/326] Insert column: copy the merge anchor's format when the neighbour is covered A neighbour cell covered by a horizontal merge has no formatting of its own, so the inserted cell looked different from what is shown. Resolve it to the leftmost anchor before copying. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/table.rs | 13 ++++++++++++- crates/engine/src/tests.rs | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rs index c6f2be0f7..f8a13723b 100644 --- a/crates/engine/src/cmd/table.rs +++ b/crates/engine/src/cmd/table.rs @@ -360,7 +360,18 @@ fn insert_col_like(t: &mut Table, at: usize, neighbour: usize, keep_width: bool) let total = t.width(); let neighbour = neighbour.min(t.cols.len().saturating_sub(1)); let w = t.cols.get(neighbour).copied(); - let templates: Vec> = t.rows.iter().map(|r| r.cells.get(neighbour).cloned()).collect(); + // A neighbour covered by a horizontal merge is formatted as its anchor, which is what shows. + let templates: Vec> = t + .rows + .iter() + .map(|r| { + let mut n = neighbour; + while n > 0 && r.cells.get(n).is_some_and(|c| c.h_merge) { + n -= 1; + } + r.cells.get(n).cloned() + }) + .collect(); t.insert_col(at); let at = at.min(t.cols.len().saturating_sub(1)); if let (Some(w), Some(slot)) = (w, t.cols.get_mut(at)) { diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 96669cb01..c3e419e0a 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6557,6 +6557,20 @@ fn table_insert_column_with_keep_width_keeps_the_table_width_and_copies_the_neig assert!((x.w - 840.0).abs() < 1e-6, "frame {}", x.w); } +#[test] +fn table_insert_column_beside_a_merge_copies_the_anchor_format() { + let mut s = session(); + let id = table_at(&mut s, &[280.0, 280.0, 280.0], json!([["a", "b", "c"], ["d", "e", "f"]])); + s.execute("table.cellFill", &json!({"id": id.0, "color": "#FF0000", "cells": [[0, 0]]})).unwrap(); + s.execute("table.merge", &json!({"id": id.0, "from": [0, 0], "to": [0, 1]})).unwrap(); + // Right of the merge: the neighbour column holds the covered cell, but the anchor shows. + s.execute("table.insertColumnRight", &json!({"id": id.0, "col": 1})).unwrap(); + let t = table_of(&s, id); + assert!(t.cell(0, 1).unwrap().h_merge, "the merge stays put"); + assert_eq!(t.cell(0, 2).unwrap().fill, t.cell(0, 0).unwrap().fill); + assert!(t.cell(0, 2).unwrap().fill.is_some()); +} + /// A table near the slide's right edge, with no room for another column: by default an inserted /// column widens it past the edge, as PowerPoint's Insert Right does (the frame keeps its left and /// grows), and `keepWidth: true` keeps it on the slide. From c86eee0355cf6e5dd45f8f691075a477cf8623fe Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Wed, 4 Nov 2026 22:33:17 -0600 Subject: [PATCH 029/326] Insert column: resolve a covered neighbour to its anchor vertically too A neighbour cell inside a multi-row merge sits below the anchor and carries the vertical cover flag, so the new column's cell copied an unformatted cell. Walk up and left to the visible anchor; the test merges two rows. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/table.rs | 24 +++++++++++++++--------- crates/engine/src/tests.rs | 13 +++++++++++++ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rs index f8a13723b..960dbae76 100644 --- a/crates/engine/src/cmd/table.rs +++ b/crates/engine/src/cmd/table.rs @@ -360,16 +360,22 @@ fn insert_col_like(t: &mut Table, at: usize, neighbour: usize, keep_width: bool) let total = t.width(); let neighbour = neighbour.min(t.cols.len().saturating_sub(1)); let w = t.cols.get(neighbour).copied(); - // A neighbour covered by a horizontal merge is formatted as its anchor, which is what shows. - let templates: Vec> = t - .rows - .iter() - .map(|r| { - let mut n = neighbour; - while n > 0 && r.cells.get(n).is_some_and(|c| c.h_merge) { - n -= 1; + // A neighbour covered by a merge (horizontally or vertically) is formatted as its anchor, which is what shows. + let covered = |r: usize, c: usize| t.rows.get(r).and_then(|row| row.cells.get(c)).is_some_and(|x| x.h_merge || x.v_merge); + let templates: Vec> = (0..t.rows.len()) + .map(|r0| { + let (mut r, mut n) = (r0, neighbour); + while covered(r, n) { + let cell = &t.rows[r].cells[n]; + if cell.h_merge && n > 0 { + n -= 1; + } else if cell.v_merge && r > 0 { + r -= 1; + } else { + break; + } } - r.cells.get(n).cloned() + t.rows[r].cells.get(n).cloned() }) .collect(); t.insert_col(at); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index c3e419e0a..6759b6f92 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6571,6 +6571,19 @@ fn table_insert_column_beside_a_merge_copies_the_anchor_format() { assert!(t.cell(0, 2).unwrap().fill.is_some()); } +#[test] +fn table_insert_column_beside_a_two_row_merge_copies_the_anchor_format() { + let mut s = session(); + let id = table_at(&mut s, &[280.0, 280.0, 280.0], json!([["a", "b", "c"], ["d", "e", "f"]])); + s.execute("table.cellFill", &json!({"id": id.0, "color": "#FF0000", "cells": [[0, 0]]})).unwrap(); + s.execute("table.merge", &json!({"id": id.0, "from": [0, 0], "to": [1, 1]})).unwrap(); + s.execute("table.insertColumnRight", &json!({"id": id.0, "col": 1})).unwrap(); + let t = table_of(&s, id); + assert!(t.cell(1, 1).unwrap().h_merge && t.cell(1, 1).unwrap().v_merge, "the merge stays put"); + assert!(t.cell(0, 2).unwrap().fill.is_some()); + assert_eq!(t.cell(1, 2).unwrap().fill, t.cell(0, 0).unwrap().fill); +} + /// A table near the slide's right edge, with no room for another column: by default an inserted /// column widens it past the edge, as PowerPoint's Insert Right does (the frame keeps its left and /// grows), and `keepWidth: true` keeps it on the slide. From 0aaadb2914905205eaa486a761f2f7471248c31b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 5 Nov 2026 07:01:23 -0800 Subject: [PATCH 030/326] Apply gradient tile rectangles to path fills --- crates/render/src/paint.rs | 10 ++++++---- crates/render/src/pathgrad.rs | 35 ++++++++++++++++++++++++++++++--- crates/render/src/tests_wild.rs | 25 +++++++++++++++++++++++ 3 files changed, 63 insertions(+), 7 deletions(-) diff --git a/crates/render/src/paint.rs b/crates/render/src/paint.rs index 74d111236..a0a4c2161 100644 --- a/crates/render/src/paint.rs +++ b/crates/render/src/paint.rs @@ -51,16 +51,18 @@ pub fn fill_path( // its edges); a radial one ends on the circle around it, from a focus placed in the // shape's own box (PowerPoint's "from corner" presets centre the tile on the corner). let tile = tile_box(bounds, g.tile); - let stops: Vec<(f64, Rgba)> = g.stops.iter().map(|s| (s.pos, shade(rctx.color(&s.color, ph), mode))).collect(); - ctx.set_paint(gradient(&g.shape, stops, bounds, alpha)); - let mut stops: Vec<(f64, Rgba)> = g.stops.iter().map(|s| (s.pos.clamp(0.0, 1.0), shade(rctx.color(&s.color, ph), mode))).collect(); stops.sort_by(|a, b| a.0.total_cmp(&b.0)); // Rectangle and outline paths: rasterised (see `pathgrad`). if let GradientShape::Path { path: kind, focus } = &g.shape && matches!(kind.as_str(), "rect" | "shape") { - crate::pathgrad::fill(ctx, kind, *focus, &crate::ramp::expand(&stops), bounds, path, m, alpha); + let ramp = crate::ramp::expand(&stops); + if g.tile.iter().all(|v| *v == 0.0) { + crate::pathgrad::fill(ctx, kind, *focus, &ramp, bounds, path, m, alpha); + } else { + crate::pathgrad::fill_tiled(ctx, kind, *focus, &ramp, bounds, tile, path, m, alpha); + } return; } // PowerPoint's ramp between stops (linear light, S-shaped), see `ramp`. diff --git a/crates/render/src/pathgrad.rs b/crates/render/src/pathgrad.rs index 168d9e0a3..27cce00c5 100644 --- a/crates/render/src/pathgrad.rs +++ b/crates/render/src/pathgrad.rs @@ -29,6 +29,10 @@ const MIN_POLY_EDGES: usize = 8; /// focus rect `focus` (fractions inset from left, top, right, bottom), `outline` being the /// shape's flattened polygon(s) for `shape`. pub fn position(kind: &str, bounds: Rect, focus: [f64; 4], outline: &[Vec], p: Point) -> f64 { + position_in_tile(kind, bounds, bounds, focus, outline, p) +} + +fn position_in_tile(kind: &str, bounds: Rect, tile: Rect, focus: [f64; 4], outline: &[Vec], p: Point) -> f64 { let f = Rect::new( bounds.x0 + bounds.width() * focus[0].clamp(0.0, 1.0), bounds.y0 + bounds.height() * focus[1].clamp(0.0, 1.0), @@ -74,7 +78,7 @@ pub fn position(kind: &str, bounds: Rect, focus: [f64; 4], outline: &[Vec 0.0 } }; - axis(p.x, f.x0, f.x1, bounds.x0, bounds.x1).max(axis(p.y, f.y0, f.y1, bounds.y0, bounds.y1)).clamp(0.0, 1.0) + axis(p.x, f.x0, f.x1, tile.x0, tile.x1).max(axis(p.y, f.y0, f.y1, tile.y0, tile.y1)).clamp(0.0, 1.0) } } } @@ -224,15 +228,32 @@ pub fn ramp(stops: &[(f64, Rgba)]) -> Vec { /// `ramp::expand`) over `bounds`, faded by `alpha`; `m` maps the path to the output. #[allow(clippy::too_many_arguments)] pub fn fill(ctx: &mut RenderContext, kind: &str, focus: [f64; 4], stops: &[(f64, Rgba)], bounds: Rect, path: &BezPath, m: Affine, alpha: f64) { + fill_tiled(ctx, kind, focus, stops, bounds, bounds, path, m, alpha); +} + +#[allow(clippy::too_many_arguments)] +pub fn fill_tiled( + ctx: &mut RenderContext, + kind: &str, + focus: [f64; 4], + stops: &[(f64, Rgba)], + bounds: Rect, + tile: Rect, + path: &BezPath, + m: Affine, + alpha: f64, +) { if bounds.width() <= 0.0 || bounds.height() <= 0.0 || !bounds.is_finite() || stops.is_empty() { return; } + let tile = if tile.is_finite() && tile.width() > 0.0 && tile.height() > 0.0 { tile } else { bounds }; + let untiled = tile == bounds; let k = crate::scale_of(m); let k = if k.is_finite() && k > 0.0 { k } else { 1.0 }; let longest = bounds.width().max(bounds.height()) * k; let s = (MAX_SIDE / longest).min(1.0) * k; let (pw, ph) = (((bounds.width() * s).ceil() as u32).clamp(1, 4096), ((bounds.height() * s).ceil() as u32).clamp(1, 4096)); - let outline = if kind == "shape" { + let mut outline = if kind == "shape" { let pixels = u64::from(pw).saturating_mul(u64::from(ph)).max(1); let max_edges = usize::try_from(MAX_EDGE_WORK / pixels).unwrap_or(usize::MAX).max(MIN_POLY_EDGES); let pixel = (bounds.width() / f64::from(pw)).min(bounds.height() / f64::from(ph)); @@ -240,13 +261,21 @@ pub fn fill(ctx: &mut RenderContext, kind: &str, focus: [f64; 4], stops: &[(f64, } else { Vec::new() }; + if !untiled { + for poly in &mut outline { + for p in poly { + p.x = tile.x0 + (p.x - bounds.x0) * tile.width() / bounds.width(); + p.y = tile.y0 + (p.y - bounds.y0) * tile.height() / bounds.height(); + } + } + } let lut = ramp(stops); let a = alpha.clamp(0.0, 1.0); let mut data = Vec::with_capacity((pw * ph) as usize); for j in 0..ph { for i in 0..pw { let p = Point::new(bounds.x0 + (i as f64 + 0.5) / pw as f64 * bounds.width(), bounds.y0 + (j as f64 + 0.5) / ph as f64 * bounds.height()); - let t = position(kind, bounds, focus, &outline, p); + let t = if untiled { position(kind, bounds, focus, &outline, p) } else { position_in_tile(kind, bounds, tile, focus, &outline, p) }; let c = lut.get((t * 255.0).round().clamp(0.0, 255.0) as usize).copied().unwrap_or(Rgba::BLACK); let ca = (c.a as f64 * a).round().clamp(0.0, 255.0); let mul = |v: u8| (v as f64 * ca / 255.0).round().clamp(0.0, 255.0) as u8; diff --git a/crates/render/src/tests_wild.rs b/crates/render/src/tests_wild.rs index 2da29cb37..03587c5ec 100644 --- a/crates/render/src/tests_wild.rs +++ b/crates/render/src/tests_wild.rs @@ -397,6 +397,31 @@ fn a_linear_gradient_spans_its_tile_rect() { assert!(img.pixel(305, 150)[0] < 15 && img.pixel(495, 150)[0] < 15, "{:?}", img.pixel(305, 150)); } +#[test] +fn a_rectangular_gradient_spans_its_tile_rect() { + let mut sh = radial([0.5; 4]); + if let Some(Fill::Gradient(g)) = &mut sh.fill { + g.shape = deckcraft_model::style::GradientShape::Path { path: "rect".into(), focus: [0.5; 4] }; + g.tile = [0.25, 0.0, 0.25, 0.0]; + } + let img = render(vec![sh]); + assert!(img.pixel(300, 200)[0] > 240, "center {:?}", img.pixel(300, 200)); + assert!(img.pixel(395, 200)[0] < 80, "tile edge {:?}", img.pixel(395, 200)); +} + +#[test] +fn a_shape_gradient_spans_its_tile_rect() { + let mut sh = radial([0.5; 4]); + sh.geom = Geom::Preset { name: "ellipse".into(), adj: vec![] }; + if let Some(Fill::Gradient(g)) = &mut sh.fill { + g.shape = deckcraft_model::style::GradientShape::Path { path: "shape".into(), focus: [0.5; 4] }; + g.tile = [0.25, 0.0, 0.25, 0.0]; + } + let img = render(vec![sh]); + assert!(img.pixel(300, 200)[0] > 240, "center {:?}", img.pixel(300, 200)); + assert!(img.pixel(395, 200)[0] < 80, "tile edge {:?}", img.pixel(395, 200)); +} + #[test] fn a_3d_pictures_border_stays_centred_on_its_edge() { let mut p = picture_deck(Some(Line::solid(ColorRef::rgb(RED), 8.0))); From 926b7a863357a572150719463bba1c3d925998a9 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 5 Nov 2026 07:44:21 -0800 Subject: [PATCH 031/326] Repeat tiled path gradients --- crates/render/src/paint.rs | 4 +-- crates/render/src/pathgrad.rs | 43 +++++++++++++++++++++++++++------ crates/render/src/tests_wild.rs | 33 ++++++++++++++++++++++++- 3 files changed, 69 insertions(+), 11 deletions(-) diff --git a/crates/render/src/paint.rs b/crates/render/src/paint.rs index a0a4c2161..e494f1f75 100644 --- a/crates/render/src/paint.rs +++ b/crates/render/src/paint.rs @@ -3,7 +3,7 @@ use deckcraft_color::Rgba; use deckcraft_geom::preset::FillMode; use deckcraft_model::resolve::Ctx; -use deckcraft_model::style::{ColorRef, Fill, GradientShape, PictureFill, PictureMode}; +use deckcraft_model::style::{ColorRef, Fill, GradientFlip, GradientShape, PictureFill, PictureMode}; use deckcraft_model::{PhType, Presentation}; use kurbo::{Affine, BezPath, Point, Rect, Shape as _}; use vello_cpu::{RenderContext, peniko}; @@ -61,7 +61,7 @@ pub fn fill_path( if g.tile.iter().all(|v| *v == 0.0) { crate::pathgrad::fill(ctx, kind, *focus, &ramp, bounds, path, m, alpha); } else { - crate::pathgrad::fill_tiled(ctx, kind, *focus, &ramp, bounds, tile, path, m, alpha); + crate::pathgrad::fill_tiled_flipped(ctx, kind, *focus, &ramp, bounds, tile, g.flip.unwrap_or(GradientFlip::None), path, m, alpha); } return; } diff --git a/crates/render/src/pathgrad.rs b/crates/render/src/pathgrad.rs index 27cce00c5..476fa0837 100644 --- a/crates/render/src/pathgrad.rs +++ b/crates/render/src/pathgrad.rs @@ -12,6 +12,7 @@ use std::sync::Arc; use deckcraft_color::Rgba; +use deckcraft_model::style::GradientFlip; use kurbo::{Affine, BezPath, PathEl, Point, Rect}; use vello_cpu::{Pixmap, RenderContext, peniko}; @@ -242,17 +243,35 @@ pub fn fill_tiled( path: &BezPath, m: Affine, alpha: f64, +) { + fill_tiled_flipped(ctx, kind, focus, stops, bounds, tile, GradientFlip::None, path, m, alpha); +} + +/// Fill `path` with repeated path-gradient tiles, reflecting alternate tiles along `flip` axes. +#[allow(clippy::too_many_arguments)] +pub(crate) fn fill_tiled_flipped( + ctx: &mut RenderContext, + kind: &str, + focus: [f64; 4], + stops: &[(f64, Rgba)], + bounds: Rect, + tile: Rect, + flip: GradientFlip, + path: &BezPath, + m: Affine, + alpha: f64, ) { if bounds.width() <= 0.0 || bounds.height() <= 0.0 || !bounds.is_finite() || stops.is_empty() { return; } let tile = if tile.is_finite() && tile.width() > 0.0 && tile.height() > 0.0 { tile } else { bounds }; let untiled = tile == bounds; + let sample = if untiled { bounds } else { tile }; let k = crate::scale_of(m); let k = if k.is_finite() && k > 0.0 { k } else { 1.0 }; - let longest = bounds.width().max(bounds.height()) * k; + let longest = sample.width().max(sample.height()) * k; let s = (MAX_SIDE / longest).min(1.0) * k; - let (pw, ph) = (((bounds.width() * s).ceil() as u32).clamp(1, 4096), ((bounds.height() * s).ceil() as u32).clamp(1, 4096)); + let (pw, ph) = (((sample.width() * s).ceil() as u32).clamp(1, 4096), ((sample.height() * s).ceil() as u32).clamp(1, 4096)); let mut outline = if kind == "shape" { let pixels = u64::from(pw).saturating_mul(u64::from(ph)).max(1); let max_edges = usize::try_from(MAX_EDGE_WORK / pixels).unwrap_or(usize::MAX).max(MIN_POLY_EDGES); @@ -274,7 +293,7 @@ pub fn fill_tiled( let mut data = Vec::with_capacity((pw * ph) as usize); for j in 0..ph { for i in 0..pw { - let p = Point::new(bounds.x0 + (i as f64 + 0.5) / pw as f64 * bounds.width(), bounds.y0 + (j as f64 + 0.5) / ph as f64 * bounds.height()); + let p = Point::new(sample.x0 + (i as f64 + 0.5) / pw as f64 * sample.width(), sample.y0 + (j as f64 + 0.5) / ph as f64 * sample.height()); let t = if untiled { position(kind, bounds, focus, &outline, p) } else { position_in_tile(kind, bounds, tile, focus, &outline, p) }; let c = lut.get((t * 255.0).round().clamp(0.0, 255.0) as usize).copied().unwrap_or(Rgba::BLACK); let ca = (c.a as f64 * a).round().clamp(0.0, 255.0); @@ -284,12 +303,20 @@ pub fn fill_tiled( } let pm = Arc::new(Pixmap::from_parts(data, pw as u16, ph as u16)); ctx.set_transform(m); - ctx.set_paint(vello_cpu::Image { - image: vello_cpu::ImageSource::Pixmap(pm), - sampler: peniko::ImageSampler { quality: peniko::ImageQuality::Medium, ..Default::default() }, - }); + let extend = |reflected: bool| if reflected { peniko::Extend::Reflect } else { peniko::Extend::Repeat }; + let sampler = if untiled { + peniko::ImageSampler { quality: peniko::ImageQuality::Medium, ..Default::default() } + } else { + peniko::ImageSampler { + x_extend: extend(matches!(flip, GradientFlip::X | GradientFlip::Xy)), + y_extend: extend(matches!(flip, GradientFlip::Y | GradientFlip::Xy)), + quality: peniko::ImageQuality::Medium, + ..Default::default() + } + }; + ctx.set_paint(vello_cpu::Image { image: vello_cpu::ImageSource::Pixmap(pm), sampler }); ctx.set_paint_transform( - Affine::translate(bounds.origin().to_vec2()) * Affine::scale_non_uniform(bounds.width() / pw as f64, bounds.height() / ph as f64), + Affine::translate(sample.origin().to_vec2()) * Affine::scale_non_uniform(sample.width() / pw as f64, sample.height() / ph as f64), ); ctx.fill_path(path); ctx.reset_paint_transform(); diff --git a/crates/render/src/tests_wild.rs b/crates/render/src/tests_wild.rs index 03587c5ec..d79ba3653 100644 --- a/crates/render/src/tests_wild.rs +++ b/crates/render/src/tests_wild.rs @@ -6,7 +6,7 @@ use super::{ render_slide, trim_ends, }; use deckcraft_color::Rgba; -use deckcraft_model::style::ColorRef; +use deckcraft_model::style::{ColorRef, GradientFlip}; use deckcraft_model::{CustomPath, Geom, Presentation, Shape, ShapeId, Xfrm}; use kurbo::Shape as _; @@ -407,6 +407,7 @@ fn a_rectangular_gradient_spans_its_tile_rect() { let img = render(vec![sh]); assert!(img.pixel(300, 200)[0] > 240, "center {:?}", img.pixel(300, 200)); assert!(img.pixel(395, 200)[0] < 80, "tile edge {:?}", img.pixel(395, 200)); + assert!(img.pixel(450, 200)[0] > 80, "next tile {:?}", img.pixel(450, 200)); } #[test] @@ -420,6 +421,36 @@ fn a_shape_gradient_spans_its_tile_rect() { let img = render(vec![sh]); assert!(img.pixel(300, 200)[0] > 240, "center {:?}", img.pixel(300, 200)); assert!(img.pixel(395, 200)[0] < 80, "tile edge {:?}", img.pixel(395, 200)); + assert!(img.pixel(450, 200)[0] > 80, "next tile {:?}", img.pixel(450, 200)); +} + +#[test] +fn a_rectangular_gradient_reflects_alternate_tiles() { + let mut sh = radial([0.5; 4]); + if let Some(Fill::Gradient(g)) = &mut sh.fill { + g.shape = deckcraft_model::style::GradientShape::Path { path: "rect".into(), focus: [0.25, 0.5, 0.75, 0.5] }; + g.tile = [0.25, 0.0, 0.25, 0.0]; + } + let repeated = render(vec![sh.clone()]).pixel(450, 200)[0]; + if let Some(Fill::Gradient(g)) = &mut sh.fill { + g.flip = Some(GradientFlip::X); + } + let reflected = render(vec![sh]).pixel(450, 200)[0]; + assert!(repeated > reflected + 60, "repeat {repeated}, reflected {reflected}"); +} + +#[test] +fn small_rectangular_gradient_tiles_remain_distinct_in_a_large_shape() { + let mut sh = radial([0.5; 4]); + sh.xfrm = Some(Xfrm::new(100.0, 100.0, 4000.0, 200.0)); + if let Some(Fill::Gradient(g)) = &mut sh.fill { + g.shape = deckcraft_model::style::GradientShape::Path { path: "rect".into(), focus: [0.5; 4] }; + g.tile = [0.4995, 0.0, 0.4995, 0.0]; + } + let img = render(vec![sh]); + let edge = img.pixel(150, 200)[0]; + let center = img.pixel(152, 200)[0]; + assert!(i32::from(center) > i32::from(edge) + 100, "edge {edge}, center {center}"); } #[test] From b78f16a1cc99147f2cd6d0d3f3a2f5c2f97ea07b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 5 Nov 2026 07:59:08 -0800 Subject: [PATCH 032/326] Preserve detail in narrow gradient tiles --- crates/render/src/pathgrad.rs | 6 +++--- crates/render/src/tests_wild.rs | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/crates/render/src/pathgrad.rs b/crates/render/src/pathgrad.rs index 476fa0837..0175185d2 100644 --- a/crates/render/src/pathgrad.rs +++ b/crates/render/src/pathgrad.rs @@ -269,9 +269,9 @@ pub(crate) fn fill_tiled_flipped( let sample = if untiled { bounds } else { tile }; let k = crate::scale_of(m); let k = if k.is_finite() && k > 0.0 { k } else { 1.0 }; - let longest = sample.width().max(sample.height()) * k; - let s = (MAX_SIDE / longest).min(1.0) * k; - let (pw, ph) = (((sample.width() * s).ceil() as u32).clamp(1, 4096), ((sample.height() * s).ceil() as u32).clamp(1, 4096)); + let s = if untiled { (MAX_SIDE / (sample.width().max(sample.height()) * k)).min(1.0) * k } else { k }; + let limit = if untiled { 4096.0 } else { MAX_SIDE }; + let (pw, ph) = ((sample.width() * s).ceil().clamp(1.0, limit) as u32, (sample.height() * s).ceil().clamp(1.0, limit) as u32); let mut outline = if kind == "shape" { let pixels = u64::from(pw).saturating_mul(u64::from(ph)).max(1); let max_edges = usize::try_from(MAX_EDGE_WORK / pixels).unwrap_or(usize::MAX).max(MIN_POLY_EDGES); diff --git a/crates/render/src/tests_wild.rs b/crates/render/src/tests_wild.rs index d79ba3653..94e1bac88 100644 --- a/crates/render/src/tests_wild.rs +++ b/crates/render/src/tests_wild.rs @@ -453,6 +453,20 @@ fn small_rectangular_gradient_tiles_remain_distinct_in_a_large_shape() { assert!(i32::from(center) > i32::from(edge) + 100, "edge {edge}, center {center}"); } +#[test] +fn narrow_rectangular_gradient_tiles_keep_their_horizontal_ramp() { + let mut sh = radial([0.5; 4]); + sh.xfrm = Some(Xfrm::new(100.0, 100.0, 400.0, 4000.0)); + if let Some(Fill::Gradient(g)) = &mut sh.fill { + g.shape = deckcraft_model::style::GradientShape::Path { path: "rect".into(), focus: [0.5, 0.025, 0.5, 0.975] }; + g.tile = [0.495, 0.0, 0.495, 0.0]; + } + let img = render(vec![sh]); + let edge = img.pixel(150, 200)[0]; + let center = img.pixel(152, 200)[0]; + assert!(i32::from(center) > i32::from(edge) + 100, "edge {edge}, center {center}"); +} + #[test] fn a_3d_pictures_border_stays_centred_on_its_edge() { let mut p = picture_deck(Some(Line::solid(ColorRef::rgb(RED), 8.0))); From 0c79f0dd5588c80e329087653a61af04eb10698b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 5 Nov 2026 08:36:47 -0800 Subject: [PATCH 033/326] Preserve tiled gradient detail under nonuniform transforms --- crates/render/src/pathgrad.rs | 9 ++++++++- crates/render/src/tests_wild.rs | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/crates/render/src/pathgrad.rs b/crates/render/src/pathgrad.rs index 0175185d2..647daa5c5 100644 --- a/crates/render/src/pathgrad.rs +++ b/crates/render/src/pathgrad.rs @@ -270,8 +270,15 @@ pub(crate) fn fill_tiled_flipped( let k = crate::scale_of(m); let k = if k.is_finite() && k > 0.0 { k } else { 1.0 }; let s = if untiled { (MAX_SIDE / (sample.width().max(sample.height()) * k)).min(1.0) * k } else { k }; + let (sx, sy) = if untiled { + (s, s) + } else { + let [a, b, c, d, _, _] = m.as_coeffs(); + let valid_scale = |v: f64| if v.is_finite() && v > 0.0 { v } else { 1.0 }; + (valid_scale(a.hypot(b)), valid_scale(c.hypot(d))) + }; let limit = if untiled { 4096.0 } else { MAX_SIDE }; - let (pw, ph) = ((sample.width() * s).ceil().clamp(1.0, limit) as u32, (sample.height() * s).ceil().clamp(1.0, limit) as u32); + let (pw, ph) = ((sample.width() * sx).ceil().clamp(1.0, limit) as u32, (sample.height() * sy).ceil().clamp(1.0, limit) as u32); let mut outline = if kind == "shape" { let pixels = u64::from(pw).saturating_mul(u64::from(ph)).max(1); let max_edges = usize::try_from(MAX_EDGE_WORK / pixels).unwrap_or(usize::MAX).max(MIN_POLY_EDGES); diff --git a/crates/render/src/tests_wild.rs b/crates/render/src/tests_wild.rs index 94e1bac88..3df3096c6 100644 --- a/crates/render/src/tests_wild.rs +++ b/crates/render/src/tests_wild.rs @@ -467,6 +467,22 @@ fn narrow_rectangular_gradient_tiles_keep_their_horizontal_ramp() { assert!(i32::from(center) > i32::from(edge) + 100, "edge {edge}, center {center}"); } +#[test] +fn a_scaled_group_keeps_detail_across_a_narrow_gradient_tile() { + let img = in_a_scaled_group(8.0, 0.125, Presentation::default(), |w, h| { + let mut sh = radial([0.5, 0.025, 0.5, 0.975]); + sh.xfrm = Some(Xfrm::new(0.0, 0.0, w, h)); + if let Some(Fill::Gradient(g)) = &mut sh.fill { + g.shape = deckcraft_model::style::GradientShape::Path { path: "rect".into(), focus: [0.5, 0.025, 0.5, 0.975] }; + g.tile = [0.491_666_666_666_666_64, 0.0, 0.491_666_666_666_666_64, 0.0]; + } + sh + }); + let edge = img.pixel(110, 130)[0]; + let center = img.pixel(112, 130)[0]; + assert!(i32::from(center) > i32::from(edge) + 60, "edge {edge}, center {center}"); +} + #[test] fn a_3d_pictures_border_stays_centred_on_its_edge() { let mut p = picture_deck(Some(Line::solid(ColorRef::rgb(RED), 8.0))); From ffcb3fe68a0ec4e41b1590100de60023c2a46157 Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Sun, 18 Oct 2026 13:45:08 -0500 Subject: [PATCH 034/326] Connector default sites face the other shape; formatting set before the text survives text.set shape.connect with no sites given picked the closest pair of sites, which for a diagonal neighbour chose a side site and drew the arrow across the boxes. Each shape now uses the site that faces the other along the direction between their centres (a box mostly below is left from the bottom), which is where a person glues an arrow; the params doc says so. format.size, format.bold, format.color on a shape that has no text yet kept nothing, so the size vanished when set_text then landed the text. An empty body now keeps that formatting on the paragraph's end mark and text.set keeps the first run's properties, or those, so the two work in either order. A test for each. Co-Authored-By: Claude Fable 5.1 --- crates/engine/src/cmd/shape.rs | 2 +- crates/engine/src/cmd/shape/freeform.rs | 36 +++++++++++++++--------- crates/engine/src/cmd/text/caret.rs | 8 +++++- crates/engine/src/cmd/text/formatting.rs | 5 ++++ crates/engine/src/tests.rs | 35 +++++++++++++++++++++++ 5 files changed, 70 insertions(+), 16 deletions(-) diff --git a/crates/engine/src/cmd/shape.rs b/crates/engine/src/cmd/shape.rs index a447a20b9..db91a48ed 100644 --- a/crates/engine/src/cmd/shape.rs +++ b/crates/engine/src/cmd/shape.rs @@ -34,7 +34,7 @@ pub fn specs() -> Vec { "Connect Shapes", [], None, - "{from: shape id, to: shape id, fromSite?, toSite?: site index (default: the closest pair), id?: existing line to glue (else a new connector), preset?: straightConnector1|bentConnector3|curvedConnector3} → {id}", + "{from: shape id, to: shape id, fromSite?, toSite?: site index (default: the sites facing each other along the dominant direction between the shapes; a box has 0 top, 1 left, 2 bottom, 3 right; shape.sites lists them), id?: existing line to glue (else a new connector), preset?: straightConnector1|bentConnector3|curvedConnector3} → {id}", has_slide, connect ), diff --git a/crates/engine/src/cmd/shape/freeform.rs b/crates/engine/src/cmd/shape/freeform.rs index 5fd299c9e..b068f86ac 100644 --- a/crates/engine/src/cmd/shape/freeform.rs +++ b/crates/engine/src/cmd/shape/freeform.rs @@ -24,21 +24,29 @@ pub(super) fn connect(s: &mut Session, p: &Value) -> Result { return Err(bad("shape.connect", "both shapes need connection sites (lines and groups have none)")); } let pick = |v: &[deckcraft_geom::Point], key: &str| usize_param(p, key).filter(|i| *i < v.len()); - let (ia, ib) = match (pick(&a, "fromSite"), pick(&b, "toSite")) { - (Some(i), Some(j)) => (i, j), - (fi, fj) => { - let mut best = (f64::MAX, 0, 0); - for (i, pa) in a.iter().enumerate().filter(|(i, _)| fi.is_none_or(|f| f == *i)) { - for (j, pb) in b.iter().enumerate().filter(|(j, _)| fj.is_none_or(|f| f == *j)) { - let d = (*pa - *pb).hypot(); - if d < best.0 { - best = (d, i, j); - } - } - } - (best.1, best.2) - } + // A site left unsaid is the one facing the other shape along the dominant direction between + // the two (a box mostly below is left from the bottom), which is where a person glues an + // arrow; "the closest pair" chose a side site for a diagonal neighbour and crossed boxes. + let centre = |v: &[deckcraft_geom::Point]| { + let n = v.len().max(1) as f64; + deckcraft_geom::Point::new(v.iter().map(|q| q.x).sum::() / n, v.iter().map(|q| q.y).sum::() / n) }; + let (ca, cb) = (centre(&a), centre(&b)); + let facing = |v: &[deckcraft_geom::Point], c: deckcraft_geom::Point, dx: f64, dy: f64| { + let len = dx.hypot(dy).max(1e-9); + v.iter() + .enumerate() + .map(|(i, q)| { + let (sx, sy) = (q.x - c.x, q.y - c.y); + let sl = sx.hypot(sy).max(1e-9); + (i, (sx * dx + sy * dy) / (sl * len)) + }) + .max_by(|p, q| p.1.total_cmp(&q.1)) + .map(|(i, _)| i) + .unwrap_or(0) + }; + let ia = pick(&a, "fromSite").unwrap_or_else(|| facing(&a, ca, cb.x - ca.x, cb.y - ca.y)); + let ib = pick(&b, "toSite").unwrap_or_else(|| facing(&b, cb, ca.x - cb.x, ca.y - cb.y)); let (p0, p1) = (a[ia], b[ib]); let id = match id_param(p, "id", "shape.connect")? { // The ends are in slide space and rerouting follows the slide's own connectors, so a line diff --git a/crates/engine/src/cmd/text/caret.rs b/crates/engine/src/cmd/text/caret.rs index c7305d62e..845e72d60 100644 --- a/crates/engine/src/cmd/text/caret.rs +++ b/crates/engine/src/cmd/text/caret.rs @@ -338,7 +338,10 @@ pub(super) fn set(s: &mut Session, p: &Value) -> Result { _ => Some(sh.text.get_or_insert_with(TextBody::default)), }; let Some(body) = target else { return Err(bad("text.set", "no text here (tables need `cell`)")) }; - let keep = body.paragraphs.first().and_then(|p| p.runs.first()).map(|r| r.props.clone()).unwrap_or_default(); + // The first run's formatting, or for text that is still empty the formatting its end + // mark holds (format.* before any text lands there), so a size set before text.set survives. + let keep = + body.paragraphs.first().map(|p| p.runs.first().map(|r| r.props.clone()).unwrap_or_else(|| p.end_props.clone())).unwrap_or_default(); let levels: Vec<(u8, deckcraft_model::text::ParaProps)> = body.paragraphs.iter().map(|p| (p.level, p.props.clone())).collect(); let mut nb = TextBody::from_text(&text); for (i, para) in nb.paragraphs.iter_mut().enumerate() { @@ -353,6 +356,9 @@ pub(super) fn set(s: &mut Session, p: &Value) -> Result { for r in &mut para.runs { r.props = keep.clone(); } + // The end mark keeps it too, so an empty `text` (no runs) carries the formatting to + // the text set next. + para.end_props = keep.clone(); } body.paragraphs = nb.paragraphs; Ok(()) diff --git a/crates/engine/src/cmd/text/formatting.rs b/crates/engine/src/cmd/text/formatting.rs index d942ee282..60923c9c2 100644 --- a/crates/engine/src/cmd/text/formatting.rs +++ b/crates/engine/src/cmd/text/formatting.rs @@ -72,6 +72,11 @@ pub(crate) fn format_run_levels( } _ => { let body = sh.text.get_or_insert_with(TextBody::default); + // Text that is still empty keeps the formatting on an end mark, so a size set + // before the text lands survives it; a body with no paragraph has none. + if body.paragraphs.is_empty() { + body.paragraphs.push(Default::default()); + } let eff = effective.iter().find(|(i, _)| *i == id).map(|(_, e)| e); match eff { Some(eff) => { diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index ca1f93d26..af36218e0 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6750,6 +6750,41 @@ fn invalid_slide_index_never_falls_back_to_the_selection_in_export_commands() { let _ = std::fs::remove_dir_all(&dir); } +/// G6: with no sites given, shape.connect joins the sites that face each other along the +/// dominant direction between the two shapes (a box mostly below leaves from the bottom), not +/// "the closest pair", which for a diagonal neighbour picked a side site and crossed boxes. +#[test] +fn connector_default_sites_follow_the_dominant_direction() { + let mut s = session(); + let a = s.execute("shape.insert", &json!({"preset": "rect", "rect": [0, 0, 100, 50]})).unwrap()["id"].as_u64().unwrap(); + let diag = s.execute("shape.insert", &json!({"preset": "rect", "rect": [150, 200, 100, 50]})).unwrap()["id"].as_u64().unwrap(); + let r = s.execute("shape.connect", &json!({"from": a, "to": diag})).unwrap(); + assert_eq!((r["fromSite"].as_u64(), r["toSite"].as_u64()), (Some(2), Some(0)), "mostly below: bottom → top, not right → left: {r}"); + let r = s.execute("shape.connect", &json!({"from": diag, "to": a})).unwrap(); + assert_eq!((r["fromSite"].as_u64(), r["toSite"].as_u64()), (Some(0), Some(2)), "and back: top → bottom: {r}"); +} + +/// A size (or colour, bold…) set on a shape before it has any text survives the text that is +/// then set: text.set keeps the first run's properties, and an empty paragraph keeps them on its +/// end mark, which is what the agent's format.size then set_text sequence relies on. +#[test] +fn text_set_keeps_the_formatting_of_an_empty_shape() { + let mut s = session(); + let id = s.execute("shape.insert", &json!({"preset": "rect", "rect": [10, 10, 300, 60]})).unwrap()["id"].as_u64().unwrap(); + s.execute("format.size", &json!({"size": 30})).unwrap(); + s.execute("format.bold", &json!({"on": true})).unwrap(); + s.execute("text.set", &json!({"id": id, "text": "Hello"})).unwrap(); + let props = + |s: &Session| s.doc().unwrap().shape(deckcraft_model::ShapeId(id as u32)).unwrap().text.as_ref().unwrap().paragraphs[0].runs[0].props.clone(); + let run = props(&s); + assert_eq!((run.size, run.bold), (Some(30.0), Some(true)), "{run:?}"); + // Emptied and filled again: the empty paragraph's end mark carried the formatting. + s.execute("text.set", &json!({"id": id, "text": ""})).unwrap(); + s.execute("text.set", &json!({"id": id, "text": "Again"})).unwrap(); + let run = props(&s); + assert_eq!((run.size, run.bold), (Some(30.0), Some(true)), "after an empty text.set: {run:?}"); +} + #[test] fn highlight_with_an_invalid_colour_is_rejected_and_keeps_the_highlight() { let mut s = session(); From 6cf52800385164141ed09b7edd27d644589304fb Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Sun, 18 Oct 2026 18:26:52 -0500 Subject: [PATCH 035/326] shape.connect takes the direction between the shapes' box centres, not the means of their sites The mean of a shape's connection sites is off its centre when the sites are not symmetric (a triangle's lie mostly along its base), which pulled the dominant direction sideways and glued an arrow to a box's side when the box was mostly below. The centres come from xfrm_of, so placeholders and tables are measured as drawn. Co-Authored-By: Claude Fable 5.1 --- crates/engine/src/cmd/shape/freeform.rs | 9 ++++----- crates/engine/src/tests.rs | 7 +++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/shape/freeform.rs b/crates/engine/src/cmd/shape/freeform.rs index b068f86ac..b85e9b52f 100644 --- a/crates/engine/src/cmd/shape/freeform.rs +++ b/crates/engine/src/cmd/shape/freeform.rs @@ -27,11 +27,10 @@ pub(super) fn connect(s: &mut Session, p: &Value) -> Result { // A site left unsaid is the one facing the other shape along the dominant direction between // the two (a box mostly below is left from the bottom), which is where a person glues an // arrow; "the closest pair" chose a side site for a diagonal neighbour and crossed boxes. - let centre = |v: &[deckcraft_geom::Point]| { - let n = v.len().max(1) as f64; - deckcraft_geom::Point::new(v.iter().map(|q| q.x).sum::() / n, v.iter().map(|q| q.y).sum::() / n) - }; - let (ca, cb) = (centre(&a), centre(&b)); + // The direction runs between the shapes' box centres: the mean of the sites is off-centre + // for a shape whose sites are not symmetric (a triangle's lie mostly along its base). + let centre = |id| st.shape(id).map(|sh| xfrm_of(&st.doc, &st.selection, sh).center()).unwrap_or_default(); + let (ca, cb) = (centre(from), centre(to)); let facing = |v: &[deckcraft_geom::Point], c: deckcraft_geom::Point, dx: f64, dy: f64| { let len = dx.hypot(dy).max(1e-9); v.iter() diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index af36218e0..135d83df5 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6762,6 +6762,13 @@ fn connector_default_sites_follow_the_dominant_direction() { assert_eq!((r["fromSite"].as_u64(), r["toSite"].as_u64()), (Some(2), Some(0)), "mostly below: bottom → top, not right → left: {r}"); let r = s.execute("shape.connect", &json!({"from": diag, "to": a})).unwrap(); assert_eq!((r["fromSite"].as_u64(), r["toSite"].as_u64()), (Some(0), Some(2)), "and back: top → bottom: {r}"); + // The direction runs between the shapes' centres, not between the means of their sites: a + // triangle's sites lie mostly along its base, which pulled the direction sideways and chose + // the box's left site for a box that is mostly below. + let tri = s.execute("shape.insert", &json!({"preset": "triangle", "rect": [400, 0, 100, 100]})).unwrap()["id"].as_u64().unwrap(); + let below = s.execute("shape.insert", &json!({"preset": "rect", "rect": [520, 155, 100, 50]})).unwrap()["id"].as_u64().unwrap(); + let r = s.execute("shape.connect", &json!({"from": tri, "to": below})).unwrap(); + assert_eq!(r["toSite"].as_u64(), Some(0), "centre to centre is mostly down: the box's top, not its left: {r}"); } /// A size (or colour, bold…) set on a shape before it has any text survives the text that is From 0666ef9980924d61577fa40cbeeba8256e316320 Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:01:35 -0500 Subject: [PATCH 036/326] Imports after upstream replaced wildcard imports (#1444) Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/shape/freeform.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/shape/freeform.rs b/crates/engine/src/cmd/shape/freeform.rs index b85e9b52f..1b853b14d 100644 --- a/crates/engine/src/cmd/shape/freeform.rs +++ b/crates/engine/src/cmd/shape/freeform.rs @@ -1,4 +1,4 @@ -use super::{ColorRef, Fill, Geom, Line, NO_ID_SPACE, Result, Session, Value, bad, bool_or, id_param, json, str_param, usize_param}; +use super::{ColorRef, Fill, Geom, Line, NO_ID_SPACE, Result, Session, Value, bad, bool_or, id_param, json, str_param, usize_param, xfrm_of}; pub(super) fn sites(s: &mut Session, p: &Value) -> Result { let id = id_param(p, "id", "shape.sites")?.ok_or_else(|| bad("shape.sites", "missing `id`"))?; From 39d8c5d7dd89a403b2816c2fe3c62acf2057269f Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Mon, 2 Nov 2026 17:02:15 -0600 Subject: [PATCH 037/326] shape.connect: a tie between sites goes to the lower site index The default sites follow the direction between the shapes' centres, but an exact diagonal ties a box's bottom with its right side (and its top with its left), and shapes with one centre tie every site; the pick then fell to whichever site came last. A tie now goes to the lower index: an exact diagonal connects bottom to top, and shapes with one centre both take site 0. The spec says so. Tests for both. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/shape.rs | 2 +- crates/engine/src/cmd/shape/freeform.rs | 25 ++++++++++++++++--------- crates/engine/src/tests.rs | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/crates/engine/src/cmd/shape.rs b/crates/engine/src/cmd/shape.rs index db91a48ed..ee911363c 100644 --- a/crates/engine/src/cmd/shape.rs +++ b/crates/engine/src/cmd/shape.rs @@ -34,7 +34,7 @@ pub fn specs() -> Vec { "Connect Shapes", [], None, - "{from: shape id, to: shape id, fromSite?, toSite?: site index (default: the sites facing each other along the dominant direction between the shapes; a box has 0 top, 1 left, 2 bottom, 3 right; shape.sites lists them), id?: existing line to glue (else a new connector), preset?: straightConnector1|bentConnector3|curvedConnector3} → {id}", + "{from: shape id, to: shape id, fromSite?, toSite?: site index (default: the sites facing each other along the dominant direction between the shapes, a tie to the lower index; a box has 0 top, 1 left, 2 bottom, 3 right; shape.sites lists them), id?: existing line to glue (else a new connector), preset?: straightConnector1|bentConnector3|curvedConnector3} → {id}", has_slide, connect ), diff --git a/crates/engine/src/cmd/shape/freeform.rs b/crates/engine/src/cmd/shape/freeform.rs index 1b853b14d..54321c84c 100644 --- a/crates/engine/src/cmd/shape/freeform.rs +++ b/crates/engine/src/cmd/shape/freeform.rs @@ -29,20 +29,27 @@ pub(super) fn connect(s: &mut Session, p: &Value) -> Result { // arrow; "the closest pair" chose a side site for a diagonal neighbour and crossed boxes. // The direction runs between the shapes' box centres: the mean of the sites is off-centre // for a shape whose sites are not symmetric (a triangle's lie mostly along its base). - let centre = |id| st.shape(id).map(|sh| xfrm_of(&st.doc, &st.selection, sh).center()).unwrap_or_default(); + // In slide space, as the sites are: a shape inside a group is placed where the group draws it. + let centre = |id| { + crate::connect::locate(&st.doc, &st.selection, st.shapes(), id) + .map(|(sh, to_abs)| to_abs * xfrm_of(&st.doc, &st.selection, sh).center()) + .unwrap_or_default() + }; let (ca, cb) = (centre(from), centre(to)); + // A tie goes to the lowest site index: an exact diagonal leaves a box from its bottom (site 2, + // before the right side, 3) and enters the other at its top (0, before the left side, 1), and + // shapes with one centre, where every direction is as good, both take site 0. let facing = |v: &[deckcraft_geom::Point], c: deckcraft_geom::Point, dx: f64, dy: f64| { let len = dx.hypot(dy).max(1e-9); - v.iter() - .enumerate() - .map(|(i, q)| { + let cos: Vec = v + .iter() + .map(|q| { let (sx, sy) = (q.x - c.x, q.y - c.y); - let sl = sx.hypot(sy).max(1e-9); - (i, (sx * dx + sy * dy) / (sl * len)) + (sx * dx + sy * dy) / (sx.hypot(sy).max(1e-9) * len) }) - .max_by(|p, q| p.1.total_cmp(&q.1)) - .map(|(i, _)| i) - .unwrap_or(0) + .collect(); + let best = cos.iter().copied().fold(f64::NEG_INFINITY, f64::max); + cos.iter().position(|x| *x >= best - 1e-9).unwrap_or(0) }; let ia = pick(&a, "fromSite").unwrap_or_else(|| facing(&a, ca, cb.x - ca.x, cb.y - ca.y)); let ib = pick(&b, "toSite").unwrap_or_else(|| facing(&b, cb, ca.x - cb.x, ca.y - cb.y)); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 135d83df5..64e48696c 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6769,6 +6769,20 @@ fn connector_default_sites_follow_the_dominant_direction() { let below = s.execute("shape.insert", &json!({"preset": "rect", "rect": [520, 155, 100, 50]})).unwrap()["id"].as_u64().unwrap(); let r = s.execute("shape.connect", &json!({"from": tri, "to": below})).unwrap(); assert_eq!(r["toSite"].as_u64(), Some(0), "centre to centre is mostly down: the box's top, not its left: {r}"); + // An exact diagonal ties the bottom with the right side (and the top with the left): the lower + // site index wins, so bottom → top, and top → bottom back. + let p = s.execute("shape.insert", &json!({"preset": "rect", "rect": [0, 300, 100, 50]})).unwrap()["id"].as_u64().unwrap(); + let q = s.execute("shape.insert", &json!({"preset": "rect", "rect": [200, 500, 100, 50]})).unwrap()["id"].as_u64().unwrap(); + let sites = |s: &mut Session, from: u64, to: u64| { + let r = s.execute("shape.connect", &json!({"from": from, "to": to})).unwrap(); + (r["fromSite"].as_u64(), r["toSite"].as_u64()) + }; + assert_eq!(sites(&mut s, p, q), (Some(2), Some(0))); + assert_eq!(sites(&mut s, q, p), (Some(0), Some(2))); + // Shapes with one centre tie every site: site 0 on both. + let big = s.execute("shape.insert", &json!({"preset": "rect", "rect": [600, 300, 200, 100]})).unwrap()["id"].as_u64().unwrap(); + let small = s.execute("shape.insert", &json!({"preset": "rect", "rect": [650, 325, 100, 50]})).unwrap()["id"].as_u64().unwrap(); + assert_eq!(sites(&mut s, big, small), (Some(0), Some(0))); } /// A size (or colour, bold…) set on a shape before it has any text survives the text that is From f0c4bd6e6fcd5a478ede61ecc06ba73ed645c930 Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Thu, 5 Nov 2026 21:53:02 -0600 Subject: [PATCH 038/326] shape.connect: with one site given, the other end is the site closest to it The facing rule is for when neither site is given; with exactly one given the other end is the other shape's site closest to it, as it was before the default changed. Test extended. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/shape.rs | 2 +- crates/engine/src/cmd/shape/freeform.rs | 20 ++++++++++++++++++-- crates/engine/src/tests.rs | 9 +++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/shape.rs b/crates/engine/src/cmd/shape.rs index ee911363c..3c00ac4dd 100644 --- a/crates/engine/src/cmd/shape.rs +++ b/crates/engine/src/cmd/shape.rs @@ -34,7 +34,7 @@ pub fn specs() -> Vec { "Connect Shapes", [], None, - "{from: shape id, to: shape id, fromSite?, toSite?: site index (default: the sites facing each other along the dominant direction between the shapes, a tie to the lower index; a box has 0 top, 1 left, 2 bottom, 3 right; shape.sites lists them), id?: existing line to glue (else a new connector), preset?: straightConnector1|bentConnector3|curvedConnector3} → {id}", + "{from: shape id, to: shape id, fromSite?, toSite?: site index (default: with neither given, the sites facing each other along the dominant direction between the shapes, a tie to the lower index; with one given, the closest site of the other shape; a box has 0 top, 1 left, 2 bottom, 3 right; shape.sites lists them), id?: existing line to glue (else a new connector), preset?: straightConnector1|bentConnector3|curvedConnector3} → {id}", has_slide, connect ), diff --git a/crates/engine/src/cmd/shape/freeform.rs b/crates/engine/src/cmd/shape/freeform.rs index 54321c84c..da6fe408e 100644 --- a/crates/engine/src/cmd/shape/freeform.rs +++ b/crates/engine/src/cmd/shape/freeform.rs @@ -51,8 +51,24 @@ pub(super) fn connect(s: &mut Session, p: &Value) -> Result { let best = cos.iter().copied().fold(f64::NEG_INFINITY, f64::max); cos.iter().position(|x| *x >= best - 1e-9).unwrap_or(0) }; - let ia = pick(&a, "fromSite").unwrap_or_else(|| facing(&a, ca, cb.x - ca.x, cb.y - ca.y)); - let ib = pick(&b, "toSite").unwrap_or_else(|| facing(&b, cb, ca.x - cb.x, ca.y - cb.y)); + // With one site given, the other end is the site of the other shape closest to it, as before; + // the facing rule is for the case where neither is given. + let closest = |v: &[deckcraft_geom::Point], to: deckcraft_geom::Point| { + let mut best = (f64::MAX, 0); + for (i, q) in v.iter().enumerate() { + let d = (*q - to).hypot(); + if d < best.0 { + best = (d, i); + } + } + best.1 + }; + let (ia, ib) = match (pick(&a, "fromSite"), pick(&b, "toSite")) { + (Some(i), Some(j)) => (i, j), + (Some(i), None) => (i, closest(&b, a[i])), + (None, Some(j)) => (closest(&a, b[j]), j), + (None, None) => (facing(&a, ca, cb.x - ca.x, cb.y - ca.y), facing(&b, cb, ca.x - cb.x, ca.y - cb.y)), + }; let (p0, p1) = (a[ia], b[ib]); let id = match id_param(p, "id", "shape.connect")? { // The ends are in slide space and rerouting follows the slide's own connectors, so a line diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 64e48696c..5b89efe49 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6783,6 +6783,15 @@ fn connector_default_sites_follow_the_dominant_direction() { let big = s.execute("shape.insert", &json!({"preset": "rect", "rect": [600, 300, 200, 100]})).unwrap()["id"].as_u64().unwrap(); let small = s.execute("shape.insert", &json!({"preset": "rect", "rect": [650, 325, 100, 50]})).unwrap()["id"].as_u64().unwrap(); assert_eq!(sites(&mut s, big, small), (Some(0), Some(0))); + // One site given: the other end is the other shape's site closest to it, as before the facing + // rule (which is for when neither is given). From a's right side (100, 25) the diagonal box's + // top (200, 200) is nearest; to its left side (150, 225), a's bottom (50, 50). + let r = s.execute("shape.connect", &json!({"from": a, "to": diag, "fromSite": 3})).unwrap(); + assert_eq!((r["fromSite"].as_u64(), r["toSite"].as_u64()), (Some(3), Some(0)), "fromSite only: {r}"); + let r = s.execute("shape.connect", &json!({"from": a, "to": diag, "toSite": 1})).unwrap(); + assert_eq!((r["fromSite"].as_u64(), r["toSite"].as_u64()), (Some(2), Some(1)), "toSite only: {r}"); + let r = s.execute("shape.connect", &json!({"from": a, "to": diag, "fromSite": 2, "toSite": 3})).unwrap(); + assert_eq!((r["fromSite"].as_u64(), r["toSite"].as_u64()), (Some(2), Some(3)), "both given: {r}"); } /// A size (or colour, bold…) set on a shape before it has any text survives the text that is From 996d67c1a62741d8b76a3eb2ea914b63b07dab38 Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Thu, 5 Nov 2026 21:55:15 -0600 Subject: [PATCH 039/326] Move the empty-shape formatting fix to its own change It is unrelated to the connector default sites; it is now its own change on its own branch. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/text/caret.rs | 8 +------- crates/engine/src/cmd/text/formatting.rs | 5 ----- crates/engine/src/tests.rs | 21 --------------------- 3 files changed, 1 insertion(+), 33 deletions(-) diff --git a/crates/engine/src/cmd/text/caret.rs b/crates/engine/src/cmd/text/caret.rs index 845e72d60..c7305d62e 100644 --- a/crates/engine/src/cmd/text/caret.rs +++ b/crates/engine/src/cmd/text/caret.rs @@ -338,10 +338,7 @@ pub(super) fn set(s: &mut Session, p: &Value) -> Result { _ => Some(sh.text.get_or_insert_with(TextBody::default)), }; let Some(body) = target else { return Err(bad("text.set", "no text here (tables need `cell`)")) }; - // The first run's formatting, or for text that is still empty the formatting its end - // mark holds (format.* before any text lands there), so a size set before text.set survives. - let keep = - body.paragraphs.first().map(|p| p.runs.first().map(|r| r.props.clone()).unwrap_or_else(|| p.end_props.clone())).unwrap_or_default(); + let keep = body.paragraphs.first().and_then(|p| p.runs.first()).map(|r| r.props.clone()).unwrap_or_default(); let levels: Vec<(u8, deckcraft_model::text::ParaProps)> = body.paragraphs.iter().map(|p| (p.level, p.props.clone())).collect(); let mut nb = TextBody::from_text(&text); for (i, para) in nb.paragraphs.iter_mut().enumerate() { @@ -356,9 +353,6 @@ pub(super) fn set(s: &mut Session, p: &Value) -> Result { for r in &mut para.runs { r.props = keep.clone(); } - // The end mark keeps it too, so an empty `text` (no runs) carries the formatting to - // the text set next. - para.end_props = keep.clone(); } body.paragraphs = nb.paragraphs; Ok(()) diff --git a/crates/engine/src/cmd/text/formatting.rs b/crates/engine/src/cmd/text/formatting.rs index 60923c9c2..d942ee282 100644 --- a/crates/engine/src/cmd/text/formatting.rs +++ b/crates/engine/src/cmd/text/formatting.rs @@ -72,11 +72,6 @@ pub(crate) fn format_run_levels( } _ => { let body = sh.text.get_or_insert_with(TextBody::default); - // Text that is still empty keeps the formatting on an end mark, so a size set - // before the text lands survives it; a body with no paragraph has none. - if body.paragraphs.is_empty() { - body.paragraphs.push(Default::default()); - } let eff = effective.iter().find(|(i, _)| *i == id).map(|(_, e)| e); match eff { Some(eff) => { diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 5b89efe49..dd0963cfb 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6794,27 +6794,6 @@ fn connector_default_sites_follow_the_dominant_direction() { assert_eq!((r["fromSite"].as_u64(), r["toSite"].as_u64()), (Some(2), Some(3)), "both given: {r}"); } -/// A size (or colour, bold…) set on a shape before it has any text survives the text that is -/// then set: text.set keeps the first run's properties, and an empty paragraph keeps them on its -/// end mark, which is what the agent's format.size then set_text sequence relies on. -#[test] -fn text_set_keeps_the_formatting_of_an_empty_shape() { - let mut s = session(); - let id = s.execute("shape.insert", &json!({"preset": "rect", "rect": [10, 10, 300, 60]})).unwrap()["id"].as_u64().unwrap(); - s.execute("format.size", &json!({"size": 30})).unwrap(); - s.execute("format.bold", &json!({"on": true})).unwrap(); - s.execute("text.set", &json!({"id": id, "text": "Hello"})).unwrap(); - let props = - |s: &Session| s.doc().unwrap().shape(deckcraft_model::ShapeId(id as u32)).unwrap().text.as_ref().unwrap().paragraphs[0].runs[0].props.clone(); - let run = props(&s); - assert_eq!((run.size, run.bold), (Some(30.0), Some(true)), "{run:?}"); - // Emptied and filled again: the empty paragraph's end mark carried the formatting. - s.execute("text.set", &json!({"id": id, "text": ""})).unwrap(); - s.execute("text.set", &json!({"id": id, "text": "Again"})).unwrap(); - let run = props(&s); - assert_eq!((run.size, run.bold), (Some(30.0), Some(true)), "after an empty text.set: {run:?}"); -} - #[test] fn highlight_with_an_invalid_colour_is_rejected_and_keeps_the_highlight() { let mut s = session(); From 29296c87459d780aca86e2d197d5e0c14574ba17 Mon Sep 17 00:00:00 2001 From: aiongg <67543387+aiongg@users.noreply.github.com> Date: Fri, 6 Nov 2026 07:15:44 +0000 Subject: [PATCH 040/326] Fix runs with draw private-use symbol Fixes #1916. - crates/text/src/shape.rs - crates/text/src/symbol.rs - crates/text/src/style.rs - crates/text/src/tests.rs - crates/text/tests/autocraft_regression_1916.rs --- crates/text/src/shape.rs | 14 ++++- crates/text/src/symbol.rs | 24 ++++++++ .../text/tests/autocraft_regression_1916.rs | 55 +++++++++++++++++++ 3 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 crates/text/tests/autocraft_regression_1916.rs diff --git a/crates/text/src/shape.rs b/crates/text/src/shape.rs index d5558001d..56219275f 100644 --- a/crates/text/src/shape.rs +++ b/crates/text/src/shape.rs @@ -1,7 +1,7 @@ use super::autonum::autonum; use super::run::{RunEffects, TextShadow}; use super::style::{Cell, Opts, ParaShaped, Style, face_chain, make_style}; -use super::symbol::{covers_symbol, is_symbol_font, map_symbol_bullet, symbol_font_char, symbol_map_char}; +use super::symbol::{covers_symbol, is_symbol_font, map_symbol_bullet, symbol_fallback_char, symbol_font_char, symbol_map_char}; use super::{ Arc, Bullet, Caps, Ctx, Fill, FontDb, FontFace, FontSlot, HashMap, ParaProps, RunKind, RunProps, ScriptTag, Shape, ShapeParams, TextBody, UnicodeSegmentation, bidi, resolve, script, @@ -201,6 +201,15 @@ fn shape_cells( .filter(|f| db.has_family(f)) .map(|f| db.face(f, st.style_name)) .filter(|f| covers_symbol(f, cluster.first().copied().unwrap_or(' '))); + // Without that font, the code draws as the Unicode look-alike (not a missing-glyph box). + let mapped: Vec; + let cluster = match cluster.first().and_then(|c| symbol_fallback_char(*c, st.sym.as_deref())).filter(|_| sym_face.is_none()) { + Some(m) => { + mapped = std::iter::once(m).chain(cluster.iter().skip(1).copied()).collect(); + mapped.as_slice() + } + None => cluster, + }; let face = match (sym_face, prev.as_ref()) { (Some(f), _) => f, (None, Some(p)) @@ -391,7 +400,8 @@ fn shape_item( let sym = styles.get(first.style).and_then(|st| st.sym.as_deref()); let glyphs = deckcraft_fonts::shape_range(face, text, b0..b1, ¶ms, |ch| { let ch = if upper { caps_char(ch) } else { ch }; - symbol_map_char(face, ch, sym).unwrap_or(ch) + let own_font = sym.is_some_and(|s| face.family.eq_ignore_ascii_case(s)); + symbol_map_char(face, ch, sym).or_else(|| symbol_fallback_char(ch, sym).filter(|_| !own_font)).unwrap_or(ch) }); let upem = face.upem.max(1.0); let scale_of = |cell: &Cell| { diff --git a/crates/text/src/symbol.rs b/crates/text/src/symbol.rs index 77cb64995..a8e7ee753 100644 --- a/crates/text/src/symbol.rs +++ b/crates/text/src/symbol.rs @@ -30,6 +30,29 @@ pub(crate) fn symbol_map_char(face: &FontFace, ch: char, sym: Option<&str>) -> O symbol_font_draw(face, code) } +/// The Unicode look-alike that draws `ch`, a U+F0xx private-use code of the `a:sym` symbol font +/// `sym`, when that font is not installed (or does not draw the code): the characters bullets use +/// for these fonts. `None` when `ch` is not such a code, `sym` is not a symbol font, or the code +/// has no standard Unicode character (the Symbol font's fragment glyphs). +pub(crate) fn symbol_fallback_char(ch: char, sym: Option<&str>) -> Option { + let code = ch as u32; + if !(0xF000..=0xF0FF).contains(&code) { + return None; + } + let sym = sym?; + if !is_symbol_font(sym) { + return None; + } + let low = code & 0xFF; + if low == 0x20 { + return Some(' '); + } + if sym.eq_ignore_ascii_case("symbol") { + return symbol_unicode(low).or_else(|| (0x21..=0x7E).contains(&low).then_some(low)).and_then(char::from_u32); + } + map_symbol_bullet(&ch.to_string(), Some(sym)).chars().next() +} + /// The real-Unicode character the Symbol font's code `code` (0x00–0xFF) maps to, in the Adobe /// Symbol encoding (Unicode, Inc.'s `MAPPINGS/VENDORS/ADOBE/symbol.txt`; Apple's Mac OS Symbol /// shares this layout, with a few alternative Unicode choices — see `symbol_unicode_alts`): the @@ -306,6 +329,7 @@ pub fn map_symbol_bullet(c: &str, font: Option<&str>) -> String { let m = match code { 0xa7 => '▪', 0xd8 => '➢', + 0xe8 => '➔', 0xfc => '✓', 0x76 => '❖', 0x71 => '❑', diff --git a/crates/text/tests/autocraft_regression_1916.rs b/crates/text/tests/autocraft_regression_1916.rs new file mode 100644 index 000000000..9ea567925 --- /dev/null +++ b/crates/text/tests/autocraft_regression_1916.rs @@ -0,0 +1,55 @@ +use deckcraft_fonts::FontDb; +use deckcraft_geom::Rect; +use deckcraft_model::defaults; +use deckcraft_model::resolve::Ctx; +use deckcraft_model::text::{Bullet, TextBody}; +use deckcraft_model::{LayoutType, Presentation, Xfrm}; +use deckcraft_text::{GlyphRun, NoFields, Opts, layout}; + +fn lay_sym(text: &str, sym: &str) -> Vec { + let mut p = Presentation::default(); + let lay = defaults::layout_of_kind(&p, LayoutType::TitleAndContent).expect("layout"); + let mut s = defaults::new_slide(&mut p, lay).expect("slide"); + let mut body = s.shapes.remove(1); + body.xfrm = Some(Xfrm::new(0.0, 0.0, 600.0, 300.0)); + body.text = Some(TextBody::from_text(text)); + let para = &mut body.text.as_mut().expect("text").paragraphs[0]; + para.props.bullet = Some(Bullet::None); + para.runs[0].props.font = Some("Arial".into()); + para.runs[0].props.font_sym = Some(sym.into()); + s.shapes = vec![body.clone()]; + p.slides = vec![std::sync::Arc::new(s)]; + let ctx = Ctx::for_slide(&p, &p.slides[0]).expect("ctx"); + let rect = Rect::new(0.0, 0.0, 600.0, 300.0); + layout(&ctx, &body, body.text.as_ref().expect("text"), &Opts { rect, fields: &NoFields, prompt_color: None, no_shrink: false }).runs +} + +#[test] +fn wingdings_arrow_without_the_sym_font_draws_the_unicode_arrow() { + let db = FontDb::global(); + if db.has_family("Wingdings") { + eprintln!("skipped: Wingdings is installed"); + return; + } + let arrow = '\u{2794}'; + let has_arrow = ["DejaVu Sans", "Noto Sans Symbols", "Noto Sans Symbols2", "Apple Symbols", "Segoe UI Symbol"] + .iter() + .any(|f| db.has_family(f) && db.face(f, "Regular").covers(arrow)); + if !has_arrow { + eprintln!("skipped: no installed font draws U+2794"); + return; + } + // U+F0E8 is Wingdings' right arrow (the issue's "F0 E8" box). + let runs = lay_sym("\u{F0E8} x", "Wingdings"); + let (run, i) = runs.iter().find_map(|r| r.cells.iter().position(|c| c.0 == 0).map(|i| (r, i))).expect("the symbol is drawn"); + let gid = run.glyphs.get(i).map(|g| g.0).expect("a glyph"); + assert_ne!(gid, 0, "the private-use code drew a missing-glyph box"); + assert_eq!(gid, run.face.glyph_for(arrow), "the code draws the arrow, not another character"); + // The Symbol font's bullet code (U+F0B7) draws its bullet, U+2022. + let runs = lay_sym("\u{F0B7} x", "Symbol"); + if let Some((run, i)) = runs.iter().find_map(|r| r.cells.iter().position(|c| c.0 == 0).map(|i| (r, i))) + && !db.has_family("Symbol") + { + assert_eq!(run.glyphs.get(i).map(|g| g.0), Some(run.face.glyph_for('\u{2022}'))); + } +} From f3de3f7146d9c2ad5d95f922bff60751dce593a0 Mon Sep 17 00:00:00 2001 From: aiongg <67543387+aiongg@users.noreply.github.com> Date: Fri, 6 Nov 2026 07:24:44 +0000 Subject: [PATCH 041/326] Apply review fixes - crates/text/src/shape.rs - crates/text/src/symbol.rs --- crates/text/src/shape.rs | 5 +++-- crates/text/src/symbol.rs | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/text/src/shape.rs b/crates/text/src/shape.rs index 56219275f..e69bf2333 100644 --- a/crates/text/src/shape.rs +++ b/crates/text/src/shape.rs @@ -255,12 +255,13 @@ fn shape_cells( } } } - // Items: maximal ranges of one level, face, script and shaping style (case mapping, language). + // Items: maximal ranges of one level, face, script and shaping style (case mapping, language, a:sym symbol font). let upper = |i: usize| styles.get(char_style.get(i).copied().unwrap_or(0)).is_some_and(|st| st.caps != Caps::None); let lang = |i: usize| styles.get(char_style.get(i).copied().unwrap_or(0)).and_then(|st| st.lang.as_deref()); let kern = |i: usize| styles.get(char_style.get(i).copied().unwrap_or(0)).is_some_and(|st| st.kern); let up = |i: usize| cells.get(i).is_some_and(|c| c.upright); - let key = |i: usize| (levels.get(i).copied(), char_face.get(i).copied(), scripts.get(i).map(|s| s.0), upper(i), lang(i), kern(i), up(i)); + let sym = |i: usize| styles.get(char_style.get(i).copied().unwrap_or(0)).and_then(|st| st.sym.as_deref()); + let key = |i: usize| (levels.get(i).copied(), char_face.get(i).copied(), scripts.get(i).map(|s| s.0), upper(i), lang(i), kern(i), up(i), sym(i)); let mut items: Vec<(usize, usize)> = Vec::new(); let mut a = 0; while a < n { diff --git a/crates/text/src/symbol.rs b/crates/text/src/symbol.rs index a8e7ee753..12f84926f 100644 --- a/crates/text/src/symbol.rs +++ b/crates/text/src/symbol.rs @@ -32,8 +32,8 @@ pub(crate) fn symbol_map_char(face: &FontFace, ch: char, sym: Option<&str>) -> O /// The Unicode look-alike that draws `ch`, a U+F0xx private-use code of the `a:sym` symbol font /// `sym`, when that font is not installed (or does not draw the code): the characters bullets use -/// for these fonts. `None` when `ch` is not such a code, `sym` is not a symbol font, or the code -/// has no standard Unicode character (the Symbol font's fragment glyphs). +/// for these fonts. `None` when `ch` is not such a code, `sym` is not a symbol font, or a Symbol-font code +/// has no standard Unicode character (its fragment glyphs); Wingdings and Webdings codes without a look-alike draw as a bullet. pub(crate) fn symbol_fallback_char(ch: char, sym: Option<&str>) -> Option { let code = ch as u32; if !(0xF000..=0xF0FF).contains(&code) { From e779415cce19847197f9a27ac99c55f42d44abb3 Mon Sep 17 00:00:00 2001 From: tydude001 Date: Fri, 6 Nov 2026 12:43:50 -0600 Subject: [PATCH 042/326] packaging: name /usr/share's files one by one, so the RPM doesn't own /usr/share/mime A tree of /usr/share made the RPM own /usr/share/mime and /usr/share/mime/packages at 0755, which openSUSE's filesystem package owns at 0555: rpm -U refuses the package, and zypper installs it but leaves the directory at 0755. This is the layout WordCraft took in storytold/wordcraft#5369. --- packaging/linux/nfpm.yaml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packaging/linux/nfpm.yaml b/packaging/linux/nfpm.yaml index 0f1111b45..014b84dd5 100644 --- a/packaging/linux/nfpm.yaml +++ b/packaging/linux/nfpm.yaml @@ -71,8 +71,20 @@ contents: - src: ${STAGE}/usr/bin/deckcraft-cli dst: /usr/bin/deckcraft-cli file_info: { mode: 0755 } - - src: ${STAGE}/usr/share/ - dst: /usr/share/ + # Named one by one rather than as a tree of /usr/share: a tree would also own shared directories + # such as /usr/share/mime, which openSUSE's filesystem package owns with other modes, and RPM + # refuses to install a package that conflicts with it. + - src: ${STAGE}/usr/share/applications/ai.storyteller.deckcraft.desktop + dst: /usr/share/applications/ai.storyteller.deckcraft.desktop + - src: ${STAGE}/usr/share/mime/packages/ai.storyteller.deckcraft.xml + dst: /usr/share/mime/packages/ai.storyteller.deckcraft.xml + - src: ${STAGE}/usr/share/metainfo/ai.storyteller.deckcraft.metainfo.xml + dst: /usr/share/metainfo/ai.storyteller.deckcraft.metainfo.xml + - src: ${STAGE}/usr/share/icons/hicolor/ + dst: /usr/share/icons/hicolor/ + type: tree + - src: ${STAGE}/usr/share/doc/deckcraft/ + dst: /usr/share/doc/deckcraft/ type: tree scripts: From 6cee207f77f0fa896b9916fad6d86fe05958319b Mon Sep 17 00:00:00 2001 From: aiongg <67543387+aiongg@users.noreply.github.com> Date: Sat, 7 Nov 2026 10:38:16 +0000 Subject: [PATCH 043/326] Fix [Bug] PPTX inherited symbol-font bullets render as literal characters Fixes #1935. - crates/text/src/symbol.rs - crates/text/src/shape.rs - crates/text/tests/autocraft_regression_1935.rs --- crates/text/src/symbol.rs | 4 +++- crates/text/tests/autocraft_regression_1935.rs | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 crates/text/tests/autocraft_regression_1935.rs diff --git a/crates/text/src/symbol.rs b/crates/text/src/symbol.rs index 77cb64995..5fee4e382 100644 --- a/crates/text/src/symbol.rs +++ b/crates/text/src/symbol.rs @@ -277,7 +277,7 @@ pub fn map_symbol_bullet(c: &str, font: Option<&str>) -> String { } // Only the legacy symbol fonts: "Noto Sans Symbols" and the like are Unicode fonts whose // characters (❑ ❖) are drawn as they are. Private-use codes are mapped only when no font is named. - if f.contains("wingdings") || f == "symbol" || (font.is_none() && ('\u{f000}'..='\u{f0ff}').contains(&first)) { + if f.contains("wingdings") || f.starts_with("monotype sorts") || f == "symbol" || (font.is_none() && ('\u{f000}'..='\u{f0ff}').contains(&first)) { let code = (first as u32) & 0xff; // Wingdings 2 and 3 put different shapes at the same codes. if f.starts_with("wingdings 2") { @@ -304,6 +304,8 @@ pub fn map_symbol_bullet(c: &str, font: Option<&str>) -> String { return m.to_string(); } let m = match code { + 0x6d if f.starts_with("monotype sorts") => '○', + 0xf0 if f.contains("wingdings") => '⇨', 0xa7 => '▪', 0xd8 => '➢', 0xfc => '✓', diff --git a/crates/text/tests/autocraft_regression_1935.rs b/crates/text/tests/autocraft_regression_1935.rs new file mode 100644 index 000000000..77f48211c --- /dev/null +++ b/crates/text/tests/autocraft_regression_1935.rs @@ -0,0 +1,12 @@ +use deckcraft_text::map_symbol_bullet; + +#[test] +fn monotype_sorts_m_bullet_is_open_circle() { + assert_eq!(map_symbol_bullet("m", Some("Monotype Sorts")), "\u{25CB}"); +} + +#[test] +fn wingdings_eth_bullet_is_right_arrow() { + assert_eq!(map_symbol_bullet("\u{f0}", Some("Wingdings")), "\u{21E8}"); + assert_eq!(map_symbol_bullet("\u{f0f0}", Some("Wingdings")), "\u{21E8}"); +} From 77d0ad61c222b9b3f94081a8c427dff97b6684df Mon Sep 17 00:00:00 2001 From: aiongg <67543387+aiongg@users.noreply.github.com> Date: Sat, 7 Nov 2026 10:53:38 +0000 Subject: [PATCH 044/326] Apply review fixes - crates/text/src/symbol.rs --- crates/text/src/symbol.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/text/src/symbol.rs b/crates/text/src/symbol.rs index 5fee4e382..5a33b04cd 100644 --- a/crates/text/src/symbol.rs +++ b/crates/text/src/symbol.rs @@ -3,7 +3,7 @@ use super::{FontFace, UnicodeSegmentation}; /// Is `family` a symbol font (characters at U+F000 + code)? pub(crate) fn is_symbol_font(family: &str) -> bool { let f = family.to_ascii_lowercase(); - f.starts_with("wingdings") || f == "symbol" || f.starts_with("webdings") || f.starts_with("marlett") + f.starts_with("wingdings") || f == "symbol" || f.starts_with("webdings") || f.starts_with("marlett") || f.starts_with("monotype sorts") } /// Does `face` draw the symbol-font character `c` (a U+F0xx private-use code)? Either directly at @@ -277,7 +277,11 @@ pub fn map_symbol_bullet(c: &str, font: Option<&str>) -> String { } // Only the legacy symbol fonts: "Noto Sans Symbols" and the like are Unicode fonts whose // characters (❑ ❖) are drawn as they are. Private-use codes are mapped only when no font is named. - if f.contains("wingdings") || f.starts_with("monotype sorts") || f == "symbol" || (font.is_none() && ('\u{f000}'..='\u{f0ff}').contains(&first)) { + if f.contains("wingdings") + || (f.starts_with("monotype sorts") && ((first as u32) < 0x100 || ('\u{f000}'..='\u{f0ff}').contains(&first))) + || f == "symbol" + || (font.is_none() && ('\u{f000}'..='\u{f0ff}').contains(&first)) + { let code = (first as u32) & 0xff; // Wingdings 2 and 3 put different shapes at the same codes. if f.starts_with("wingdings 2") { From 348014c7ff19b4d677b020cec6722ce103e90364 Mon Sep 17 00:00:00 2001 From: Neil Cawse Date: Sat, 7 Nov 2026 18:14:23 +0000 Subject: [PATCH 045/326] pptx: strip VML conditional comments and index o:spid for legacy previews --- crates/pptx/src/read/shapes.rs | 60 ++++++++++++++++++++++++++++++---- crates/pptx/src/xml.rs | 17 ++++++---- 2 files changed, 63 insertions(+), 14 deletions(-) diff --git a/crates/pptx/src/read/shapes.rs b/crates/pptx/src/read/shapes.rs index e1368b427..467d889da 100644 --- a/crates/pptx/src/read/shapes.rs +++ b/crates/pptx/src/read/shapes.rs @@ -512,21 +512,51 @@ fn vml_preview(imp: &mut Imp, part: &Part, spid: &str) -> Option std::borrow::Cow<'_, [u8]> { + let mut out = Vec::with_capacity(bytes.len()); + let mut at = 0; + let mut changed = false; + while at < bytes.len() { + let rest = &bytes[at..]; + let marker = rest.iter().position(|b| *b == b'<').map(|i| at + i); + let Some(start) = marker else { + out.extend_from_slice(rest); + break; + }; + out.extend_from_slice(&bytes[at..start]); + let rest = &bytes[start..]; + let conditional = rest.starts_with(b"") { + next += 3; + } + at = next; + changed = true; + continue; + } + out.push(b'<'); + at = start + 1; + } + if changed { std::borrow::Cow::Owned(out) } else { std::borrow::Cow::Borrowed(bytes) } +} + fn vml_index(pkg: &crate::opc::Package, vml: &str) -> std::collections::HashMap { let mut out = std::collections::HashMap::new(); - let Some(doc) = pkg.xml(vml) else { return out }; + let Some(bytes) = pkg.xml_bytes(vml) else { return out }; + let decoded = crate::xml::decode_xml_bytes(bytes); + let bytes = strip_vml_conditionals(&decoded); + let Ok(doc) = crate::xml::parse(&bytes) else { return out }; let rels = pkg.rels(vml); let mut shapes = vec![]; doc.root.find_all("shape", &mut shapes); for s in shapes { - let Some(id) = s.attr("id") else { continue }; - if out.contains_key(id) { - continue; // the first shape with an id wins, as the old lookup did - } let Some(img) = s.find("imagedata") else { continue }; let Some(rid) = img.attr("o:relid").or(img.attr("r:id")) else { continue }; - if let Some(r) = rels.get(rid).filter(|r| !r.external) { - out.insert(id.to_string(), r.target.clone()); + let Some(r) = rels.get(rid).filter(|r| !r.external) else { continue }; + let keys = [s.attr("o:spid").or_else(|| s.attr("spid")), s.attr("id")]; + for key in keys.into_iter().flatten().filter(|key| !key.is_empty()) { + out.entry(key.to_string()).or_insert_with(|| r.target.clone()); } } out @@ -829,3 +859,19 @@ fn cell(imp: &mut Imp, part: &Part, tc: &El) -> Cell { } c } + +#[cfg(test)] +mod vml_tests { + use super::strip_vml_conditionals; + + #[test] + fn strips_vml_conditional_blocks_and_preserves_shape_xml() { + let raw = br#""#; + let cleaned = strip_vml_conditionals(raw); + let doc = crate::xml::parse(&cleaned).expect("parse VML"); + let mut shapes = vec![]; + doc.root.find_all("shape", &mut shapes); + assert_eq!(shapes.len(), 1); + assert_eq!(shapes[0].attr("o:spid"), Some("_x0000_s2049")); + } +} diff --git a/crates/pptx/src/xml.rs b/crates/pptx/src/xml.rs index b1160a639..b0a098878 100644 --- a/crates/pptx/src/xml.rs +++ b/crates/pptx/src/xml.rs @@ -211,16 +211,19 @@ impl Doc { } } +pub(crate) fn decode_xml_bytes(bytes: &[u8]) -> std::borrow::Cow<'_, [u8]> { + if bytes.starts_with(&[0xFF, 0xFE]) || bytes.starts_with(&[0xFE, 0xFF]) { + std::borrow::Cow::Owned(decode_utf16(bytes).into_bytes()) + } else { + std::borrow::Cow::Borrowed(bytes.strip_prefix(&[0xEF, 0xBB, 0xBF]).unwrap_or(bytes)) + } +} + /// Parse XML bytes into a DOM. Bounded depth and node count; entity references are resolved. pub fn parse(bytes: &[u8]) -> Result { // Skip a UTF-8 BOM; UTF-16 parts (rare) are decoded first. - let owned; - let bytes = if bytes.starts_with(&[0xFF, 0xFE]) || bytes.starts_with(&[0xFE, 0xFF]) { - owned = decode_utf16(bytes); - owned.as_bytes() - } else { - bytes.strip_prefix(&[0xEF, 0xBB, 0xBF]).unwrap_or(bytes) - }; + let decoded = decode_xml_bytes(bytes); + let bytes = decoded.as_ref(); let mut reader = quick_xml::Reader::from_reader(bytes); { let c = reader.config_mut(); From 3e8da178f2a93808733f7e9ccb9528ffdff0e87d Mon Sep 17 00:00:00 2001 From: aiongg <67543387+aiongg@users.noreply.github.com> Date: Sat, 7 Nov 2026 18:28:35 +0000 Subject: [PATCH 046/326] Apply review fixes - crates/pptx/src/read.rs - crates/pptx/src/read/shapes.rs --- crates/pptx/src/read.rs | 2 +- crates/pptx/src/read/shapes.rs | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/pptx/src/read.rs b/crates/pptx/src/read.rs index 47f6229c3..fa71f07e4 100644 --- a/crates/pptx/src/read.rs +++ b/crates/pptx/src/read.rs @@ -34,7 +34,7 @@ pub struct Imp<'a> { pub custom_show_names: HashMap, /// GUIDs (upper case) of the table styles the file defines. pub table_style_ids: Vec, - /// Per legacy VML drawing part: shape id → preview picture part (see `shapes::vml_preview`). + /// Per legacy VML drawing part: shape id or o:spid → preview picture part (see `shapes::vml_preview`). pub vml_previews: HashMap>, /// Aggregate byte count of retained chart sidecars across the presentation. pub kept_sidecar_bytes: usize, diff --git a/crates/pptx/src/read/shapes.rs b/crates/pptx/src/read/shapes.rs index 467d889da..84af20600 100644 --- a/crates/pptx/src/read/shapes.rs +++ b/crates/pptx/src/read/shapes.rs @@ -510,8 +510,7 @@ fn vml_preview(imp: &mut Imp, part: &Part, spid: &str) -> Option`, ``, ``) removed, so shapes wrapped in them are parsed. fn strip_vml_conditionals(bytes: &[u8]) -> std::borrow::Cow<'_, [u8]> { let mut out = Vec::with_capacity(bytes.len()); let mut at = 0; @@ -541,12 +540,20 @@ fn strip_vml_conditionals(bytes: &[u8]) -> std::borrow::Cow<'_, [u8]> { if changed { std::borrow::Cow::Owned(out) } else { std::borrow::Cow::Borrowed(bytes) } } +/// Every shape id and o:spid in a VML drawing with a picture, mapped to that picture's part: parsed once per +/// drawing however many objects look it up. fn vml_index(pkg: &crate::opc::Package, vml: &str) -> std::collections::HashMap { let mut out = std::collections::HashMap::new(); let Some(bytes) = pkg.xml_bytes(vml) else { return out }; let decoded = crate::xml::decode_xml_bytes(bytes); let bytes = strip_vml_conditionals(&decoded); - let Ok(doc) = crate::xml::parse(&bytes) else { return out }; + let doc = match crate::xml::parse(&bytes) { + Ok(d) => d, + Err(e) => { + log::warn!("pptx: {vml}: {e}"); + return out; + } + }; let rels = pkg.rels(vml); let mut shapes = vec![]; doc.root.find_all("shape", &mut shapes); From 41063f36f9d5b03f4ed13a26aa5d1119fc7fe827 Mon Sep 17 00:00:00 2001 From: "autocraft-bot[bot]" <354215646+autocraft-bot[bot]@users.noreply.github.com> Date: Wed, 11 Nov 2026 09:37:56 +0000 Subject: [PATCH 047/326] Apply review fixes - crates/engine/src/cmd/table.rs --- crates/engine/src/cmd/table.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rs index 6b636f21e..07ee38b9b 100644 --- a/crates/engine/src/cmd/table.rs +++ b/crates/engine/src/cmd/table.rs @@ -400,7 +400,7 @@ fn insert_col_like(t: &mut Table, at: usize, neighbour: usize, keep_width: bool) /// `dst` takes `src`'s formatting (fill, borders, margins, anchor, text direction and the text /// properties of its first paragraph, kept on the end mark of an empty paragraph) and keeps its -/// own spans and merge cover. +/// own spans and merge cover. Hyperlinks are not copied. fn copy_cell_format(dst: &mut Cell, src: &Cell) { dst.fill.clone_from(&src.fill); dst.borders.clone_from(&src.borders); @@ -415,13 +415,17 @@ fn copy_cell_format(dst: &mut Cell, src: &Cell) { let mut end_props = p0.runs.first().map_or_else(|| p0.end_props.clone(), |r| r.props.clone()); end_props.link = None; end_props.hover = None; - deckcraft_model::text::Paragraph { level: p0.level, props: p0.props.clone(), runs: vec![], def_props: p0.def_props.clone(), end_props } + let mut def_props = p0.def_props.clone(); + def_props.link = None; + def_props.hover = None; + deckcraft_model::text::Paragraph { level: p0.level, props: p0.props.clone(), runs: vec![], def_props, end_props } }); - dst.text = deckcraft_model::text::TextBody { - body: src.text.body.clone(), - list_style: src.text.list_style.clone(), - paragraphs: vec![para.unwrap_or_default()], - }; + let mut list_style = src.text.list_style.clone(); + for l in list_style.levels.iter_mut().flatten() { + l.run.link = None; + l.run.hover = None; + } + dst.text = deckcraft_model::text::TextBody { body: src.text.body.clone(), list_style, paragraphs: vec![para.unwrap_or_default()] }; } fn merge(s: &mut Session, p: &Value) -> Result { From d0fd5d8d89597f9221ddd3240b5f6a21313a8d3e Mon Sep 17 00:00:00 2001 From: "autocraft-bot[bot]" <354215646+autocraft-bot[bot]@users.noreply.github.com> Date: Wed, 11 Nov 2026 18:57:26 +0000 Subject: [PATCH 048/326] Apply review fixes - crates/pptx/src/read/shapes.rs --- crates/pptx/src/read/shapes.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/pptx/src/read/shapes.rs b/crates/pptx/src/read/shapes.rs index 131cafead..80bb10f77 100644 --- a/crates/pptx/src/read/shapes.rs +++ b/crates/pptx/src/read/shapes.rs @@ -525,7 +525,11 @@ fn strip_vml_conditionals(bytes: &[u8]) -> std::borrow::Cow<'_, [u8]> { out.extend_from_slice(&bytes[at..start]); let rest = &bytes[start..]; let conditional = rest.starts_with(b"") { next += 3; From e187f1d229fe0da7f18f2b4ab3c4b9fdefc1d28a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 12 Nov 2026 08:41:55 -0800 Subject: [PATCH 049/326] Sample only the shape where a gradient tile spans it A tile rectangle larger than the shape on an axis (the from-corner presets) no longer stretches the raster over the whole tile. On that axis the raster covers the shape and its path, and nothing repeats. --- crates/render/src/pathgrad.rs | 56 ++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/crates/render/src/pathgrad.rs b/crates/render/src/pathgrad.rs index 7ea82dc15..8bb580f50 100644 --- a/crates/render/src/pathgrad.rs +++ b/crates/render/src/pathgrad.rs @@ -310,6 +310,18 @@ pub fn fill_tiled( fill_tiled_flipped(ctx, kind, focus, stops, bounds, tile, GradientFlip::None, path, m, alpha); } +/// The part of `tile` a tiled gradient raster covers, with whether it repeats across and down. On +/// an axis where `tile` spans all of `cover` (the shape's box and path), the raster covers only +/// `cover` and nothing repeats on that axis; on any other axis it covers the whole tile, which +/// repeats. +pub(crate) fn tiled_sample(cover: Rect, tile: Rect) -> (Rect, bool, bool) { + let spans_x = tile.x0 <= cover.x0 && tile.x1 >= cover.x1; + let spans_y = tile.y0 <= cover.y0 && tile.y1 >= cover.y1; + let (x0, x1) = if spans_x { (cover.x0, cover.x1) } else { (tile.x0, tile.x1) }; + let (y0, y1) = if spans_y { (cover.y0, cover.y1) } else { (tile.y0, tile.y1) }; + (Rect::new(x0, y0, x1, y1), !spans_x, !spans_y) +} + /// Fill `path` with repeated path-gradient tiles, reflecting alternate tiles along `flip` axes. #[allow(clippy::too_many_arguments)] pub(crate) fn fill_tiled_flipped( @@ -329,7 +341,9 @@ pub(crate) fn fill_tiled_flipped( } let tile = if tile.is_finite() && tile.width() > 0.0 && tile.height() > 0.0 { tile } else { bounds }; let untiled = tile == bounds; - let sample = if untiled { bounds } else { tile }; + let cover = kurbo::Shape::bounding_box(path); + let cover = if cover.is_finite() { cover.union(bounds) } else { bounds }; + let (sample, repeat_x, repeat_y) = if untiled { (bounds, false, false) } else { tiled_sample(cover, tile) }; let k = crate::scale_of(m); let k = if k.is_finite() && k > 0.0 { k } else { 1.0 }; let s = if untiled { (MAX_SIDE / (sample.width().max(sample.height()) * k)).min(1.0) * k } else { k }; @@ -379,13 +393,17 @@ pub(crate) fn fill_tiled_flipped( } let pm = Arc::new(Pixmap::from_parts(data, pw as u16, ph as u16)); ctx.set_transform(m); - let extend = |reflected: bool| if reflected { peniko::Extend::Reflect } else { peniko::Extend::Repeat }; + let extend = |repeats: bool, reflected: bool| match (repeats, reflected) { + (false, _) => peniko::Extend::Pad, + (true, true) => peniko::Extend::Reflect, + (true, false) => peniko::Extend::Repeat, + }; let sampler = if untiled { peniko::ImageSampler { quality: peniko::ImageQuality::Medium, ..Default::default() } } else { peniko::ImageSampler { - x_extend: extend(matches!(flip, GradientFlip::X | GradientFlip::Xy)), - y_extend: extend(matches!(flip, GradientFlip::Y | GradientFlip::Xy)), + x_extend: extend(repeat_x, matches!(flip, GradientFlip::X | GradientFlip::Xy)), + y_extend: extend(repeat_y, matches!(flip, GradientFlip::Y | GradientFlip::Xy)), quality: peniko::ImageQuality::Medium, ..Default::default() } @@ -518,6 +536,36 @@ mod tests { assert!(px.chunks(4).all(|p| p[3] == 0), "nothing was painted"); } + #[test] + fn a_tile_reaching_past_the_shape_samples_only_the_shape() { + let b = Rect::new(0.0, 0.0, 400.0, 200.0); + // A corner preset's tile reaches a box up and left: nothing repeats, the shape is sampled. + assert_eq!(tiled_sample(b, Rect::new(-400.0, -200.0, 400.0, 200.0)), (b, false, false)); + // A tile inside the shape repeats on both axes. + let inner = Rect::new(100.0, 50.0, 200.0, 150.0); + assert_eq!(tiled_sample(b, inner), (inner, true, true)); + // A tile as tall as the shape and narrower repeats across only. + assert_eq!(tiled_sample(b, Rect::new(100.0, -10.0, 200.0, 210.0)), (Rect::new(100.0, 0.0, 200.0, 200.0), true, false)); + } + + #[test] + fn a_tile_reaching_past_the_shape_keeps_its_detail() { + // The tile is four boxes wide; the hard stop half way sits 200 pt in. The raster covers the + // shape only, so the edge stays within about a point. + let b = Rect::new(0.0, 0.0, 400.0, 200.0); + let tile = Rect::new(-1200.0, -200.0, 400.0, 200.0); + let (w, k) = (800u16, 2.0); + let stops = [(0.0, Rgba::WHITE), (0.5, Rgba::WHITE), (0.5, Rgba::BLACK), (1.0, Rgba::BLACK)]; + let mut ctx = RenderContext::new(w, 400); + fill_tiled(&mut ctx, "rect", [0.0, 0.0, 1.0, 1.0], &stops, b, tile, &b.to_path(0.1), Affine::scale(k), 1.0); + ctx.flush(); + let mut px = vec![0u8; usize::from(w) * 400 * 4]; + ctx.render(vello_cpu::PixmapMut::new(w, 400, &mut px).unwrap(), &mut vello_cpu::Resources::new()); + let red = |x: usize, y: usize| px[(y * usize::from(w) + x) * 4]; + assert!(red(397, 20) > 240, "before the edge {}", red(397, 20)); + assert!(red(403, 20) < 15, "after the edge {}", red(403, 20)); + } + #[test] fn the_ramp_runs_through_the_stops() { let stops = [(0.0, Rgba::rgb(0, 0, 0)), (0.5, Rgba::rgb(128, 128, 128)), (1.0, Rgba::rgb(255, 255, 255))]; From 8a9159a4011f8fb34b74d04163a4a9d3e8a3a5f3 Mon Sep 17 00:00:00 2001 From: tydude001 Date: Thu, 12 Nov 2026 14:51:54 -0600 Subject: [PATCH 050/326] packaging: RPM recommends the windowing libraries by soname, so they resolve on openSUSE The recommendations named Fedora's packages (libwayland-client, libX11, libXcursor, libXi, libXrandr), which openSUSE calls libwayland-client0, libX11-6 and so on, so zypper skipped all five. As sonames, like the requirements above them, they resolve on both: with recommendations on, as on a desktop install, Tumbleweed and Leap 15.6 now select all five for the package itself, and Fedora 44 installs the same five as before. --- packaging/linux/nfpm.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packaging/linux/nfpm.yaml b/packaging/linux/nfpm.yaml index 014b84dd5..6cf2aad45 100644 --- a/packaging/linux/nfpm.yaml +++ b/packaging/linux/nfpm.yaml @@ -55,12 +55,13 @@ overrides: - libxkbcommon.so.0()(64bit) - (libvulkan.so.1()(64bit) or libEGL.so.1()(64bit)) - libasound.so.2()(64bit) + # The windowing libraries by soname too, so the recommendations resolve on openSUSE as well. recommends: - - libwayland-client - - libX11 - - libXcursor - - libXi - - libXrandr + - libwayland-client.so.0()(64bit) + - libX11.so.6()(64bit) + - libXcursor.so.1()(64bit) + - libXi.so.6()(64bit) + - libXrandr.so.2()(64bit) - mesa-vulkan-drivers - xdg-desktop-portal From 0bce1064034a9bd1398a17c1e46260f116c93b14 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Wed, 28 Oct 2026 14:55:00 +0100 Subject: [PATCH 051/326] Skip non-integer colour transform values instead of zeroing them Found while testing crates/engine/src/cmd.rs:~425 (color_value) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index 59160df14..7b521cb58 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -413,8 +413,12 @@ pub(crate) fn color_value(v: &Value) -> Option { ColorRef::rgb(deckcraft_color::Rgba::from_hex(o.get("rgb").and_then(Value::as_str)?)?) }; for (k, val) in o { - if let Some(t) = deckcraft_color::ColorTransform::from_xml(k, val.as_i64().and_then(|x| i32::try_from(x).ok())) { - c.mods.push(t); + let n = val.as_i64().and_then(|x| i32::try_from(x).ok()); + if let Some(t) = deckcraft_color::ColorTransform::from_xml(k, n) { + // A value-bearing transform without a usable integer is skipped, not zeroed. + if n.is_some() || t.value().is_none() { + c.mods.push(t); + } } } Some(c) @@ -690,6 +694,16 @@ mod tests { } } + #[test] + fn a_non_integer_colour_transform_is_skipped_not_zeroed() { + for bad in [serde_json::json!("75000"), serde_json::json!(75000.0), serde_json::json!(0.75), serde_json::json!(3_000_000_000i64)] { + let c = color_value(&serde_json::json!({"scheme": "accent1", "lumMod": bad})).unwrap(); + assert!(c.mods.is_empty(), "{bad}: {:?}", c.mods); + } + let c = color_value(&serde_json::json!({"scheme": "accent1", "lumMod": 75000})).unwrap(); + assert_eq!(c.mods, vec![deckcraft_color::ColorTransform::LumMod(75000)]); + } + #[test] fn the_palette_skips_a_command_that_needs_a_value() { assert!(needs_arguments("{path}")); From e79e653839324b9a507595387e9b2956813d3c56 Mon Sep 17 00:00:00 2001 From: Hamza Date: Mon, 16 Nov 2026 16:11:08 +0500 Subject: [PATCH 052/326] Spelling: compound parts take their flags from affixes, and ONLYINCOMPOUND affixes stay in compounds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit German frami gives most compound beginnings their flag through a zero suffix's continuation flags (Vor/hij with SFX j 0 0/xoc), not on the root, so Vorschlag, Werkzeuge, Maßnahme and most other compounds were reported as misspelt. A compound part may now be a root with one affix whose continuation flags (or root) carry the compound flag: a suffix on the last part, a prefix on the first, and elsewhere only with COMPOUNDPERMITFLAG, which is now read. An affix marked ONLYINCOMPOUND no longer makes a word on its own (Vor, Deckungs). Fixes #2145. --- crates/engine/src/spell.rs | 101 ++++++++++++++++++++++++++++++------- 1 file changed, 84 insertions(+), 17 deletions(-) diff --git a/crates/engine/src/spell.rs b/crates/engine/src/spell.rs index 8bc88e646..3bfbf7652 100644 --- a/crates/engine/src/spell.rs +++ b/crates/engine/src/spell.rs @@ -22,6 +22,14 @@ enum FlagMode { Num, } +/// Where a part sits in a compound. +#[derive(Clone, Copy, Debug, PartialEq)] +enum Pos { + First, + Middle, + Last, +} + #[derive(Clone, Debug)] enum Cond { Any, @@ -108,6 +116,8 @@ pub struct Dictionary { compound_begin: Option, compound_middle: Option, compound_end: Option, + /// `COMPOUNDPERMITFLAG`: an affix carrying it may sit inside a compound, not only at its ends. + compound_permit: Option, compound_min: usize, compound_max: usize, } @@ -167,6 +177,7 @@ impl Dictionary { ["COMPOUNDBEGIN", f, ..] => d.compound_begin = one_flag(Some(f), mode), ["COMPOUNDMIDDLE", f, ..] => d.compound_middle = one_flag(Some(f), mode), ["COMPOUNDEND", f, ..] | ["COMPOUNDLAST", f, ..] => d.compound_end = one_flag(Some(f), mode), + ["COMPOUNDPERMITFLAG", f, ..] => d.compound_permit = one_flag(Some(f), mode), ["COMPOUNDMIN", n, ..] => d.compound_min = n.parse::().unwrap_or(3).max(1), ["COMPOUNDWORDMAX", n, ..] => d.compound_max = n.parse().unwrap_or(0), ["REP", n] => { @@ -250,11 +261,18 @@ impl Dictionary { self.words.get(word).is_some_and(|hs| hs.iter().any(|f| self.has(f, self.forbidden))) } + /// An affix that may only be used inside a compound (`ONLYINCOMPOUND` among its continuation + /// flags): frami's zero suffixes that turn `Vor` into a compound's first part don't make `Vor` + /// a word of its own (#2145). + fn only_in_compound_affix(&self, a: &Affix) -> bool { + self.only_in_compound.is_some_and(|o| a.cont.contains(&o)) + } + /// Strip suffixes from `w` (one, or two through continuation flags); `extra` flags must also be /// on the root, `cross` means the suffix must allow a prefix. fn suffixed(&self, w: &[char], extra: &[Flag], cross: bool) -> bool { for s in &self.sfx { - if cross && !s.cross { + if (cross && !s.cross) || self.only_in_compound_affix(s) { continue; } let Some(stem) = strip_end(w, &s.add, &s.strip) else { continue }; @@ -269,7 +287,7 @@ impl Dictionary { } // A second suffix whose continuation allows this one (`walk/A` + `ing/B`…). for s2 in &self.sfx { - if !s.cont.is_empty() || !s2.cont.contains(&s.flag) { + if !s.cont.is_empty() || !s2.cont.contains(&s.flag) || self.only_in_compound_affix(s2) { continue; } let Some(stem2) = strip_end(&stem, &s2.add, &s2.strip) else { continue }; @@ -285,24 +303,36 @@ impl Dictionary { false } - /// A root (or, for the last part, a suffixed root) carrying `flag`, as a compound part. - fn compound_part(&self, part: &[char], flag: Flag, last: bool) -> bool { + /// A root carrying `flag`, or a root with one affix, as a compound part at `pos`. + fn compound_part(&self, part: &[char], flag: Flag, pos: Pos) -> bool { let word: String = part.iter().collect(); let ok = self.words.get(&word).is_some_and(|hs| hs.iter().any(|f| !self.has(f, self.forbidden) && f.contains(&flag))); - ok || (last && self.suffixed_compound_end(part, flag)) + ok || self.affixed_compound_part(part, flag, pos) } - /// The last part of a compound with a suffix: the root must carry the compound `flag`. - fn suffixed_compound_end(&self, w: &[char], flag: Flag) -> bool { - self.sfx.iter().any(|s| { - strip_end(w, &s.add, &s.strip).is_some_and(|stem| { - s.cond_ok(&stem, false) - && self - .words - .get(&stem.iter().collect::()) - .is_some_and(|hs| hs.iter().any(|f| !self.has(f, self.forbidden) && f.contains(&flag) && f.contains(&s.flag))) + /// A compound part made of a root and one affix, as Hunspell reads them: a suffix ends the last + /// part and a prefix starts the first; anywhere else the affix needs `COMPOUNDPERMITFLAG`. The + /// compound `flag` may be on the root or among the affix's continuation flags. German frami + /// gives many first parts their flag that way: `Vor/hij` with `SFX j 0 0/xoc` begins + /// `Vorschlag` (#2145). + fn affixed_compound_part(&self, w: &[char], flag: Flag, pos: Pos) -> bool { + let permit = |a: &Affix| self.compound_permit.is_some_and(|p| a.cont.contains(&p)); + let fits = |a: &Affix, stem: &[char]| { + self.words.get(&stem.iter().collect::()).is_some_and(|hs| { + hs.iter().any(|f| !self.has(f, self.forbidden) && f.contains(&a.flag) && (f.contains(&flag) || a.cont.contains(&flag))) }) - }) + }; + let suffixed = self + .sfx + .iter() + .filter(|s| pos == Pos::Last || permit(s)) + .any(|s| strip_end(w, &s.add, &s.strip).is_some_and(|stem| s.cond_ok(&stem, false) && fits(s, &stem))); + suffixed + || self + .pfx + .iter() + .filter(|p| pos == Pos::First || permit(p)) + .any(|p| strip_start(w, &p.add, &p.strip).is_some_and(|stem| p.cond_ok(&stem, true) && fits(p, &stem))) } /// `w` made of dictionary parts allowed in compounds (`COMPOUNDFLAG`, or the begin, middle and @@ -323,11 +353,12 @@ impl Dictionary { let role = if index == 0 { self.compound_begin } else { self.compound_middle }; for i in min..=w.len() - min { let (head, rest) = w.split_at(i); - let head_ok = [self.compound, role].into_iter().flatten().any(|f| self.compound_part(head, f, false)); + let pos = if index == 0 { Pos::First } else { Pos::Middle }; + let head_ok = [self.compound, role].into_iter().flatten().any(|f| self.compound_part(head, f, pos)); if !head_ok { continue; } - if [self.compound, self.compound_end].into_iter().flatten().any(|f| self.compound_part(rest, f, true)) { + if [self.compound, self.compound_end].into_iter().flatten().any(|f| self.compound_part(rest, f, Pos::Last)) { return true; } if self.compounded(rest, index + 1, failed) { @@ -350,6 +381,9 @@ impl Dictionary { return true; } for p in &self.pfx { + if self.only_in_compound_affix(p) { + continue; + } let Some(stem) = strip_start(&w, &p.add, &p.strip) else { continue }; if !p.cond_ok(&stem, true) { continue; @@ -972,6 +1006,39 @@ SFX D Y 1\nSFX D 0 ed/S .\n"; } } + #[test] + fn affixes_give_compound_parts_their_flags() { + // #2145, the way German frami builds compounds: the first and middle parts get their flags + // from zero affixes' continuation classes, not from the root, and those roots need an affix. + let aff = "COMPOUNDBEGIN B\nCOMPOUNDMIDDLE M\nCOMPOUNDEND E\nCOMPOUNDPERMITFLAG P\nONLYINCOMPOUND O\nNEEDAFFIX N\n\ + COMPOUNDMIN 2\nSFX j Y 1\nSFX j 0 0/BOP .\nSFX m Y 1\nSFX m 0 0/MOP .\nPFX q Y 1\nPFX q 0 0/BO .\n\ + SFX s Y 1\nSFX s 0 e .\nSFX u Y 1\nSFX u 0 s .\nPFX v Y 1\nPFX v 0 un .\n"; + let dic = "6\nvor/Nj\nschlag/OEs\nwerk/Njm\nzeug/OEs\nding/Nq\nhaus/E\n"; + let d = Dictionary::parse(aff.as_bytes(), dic.as_bytes()); + // First part through SFX j, middle part through SFX m (it carries the permit flag), last + // part from its root, with or without a suffix there. + for w in ["vorschlag", "vorschlage", "werkzeug", "werkzeuge", "vorwerkzeug", "werkhaus", "dinghaus"] { + assert!(d.check(w), "{w}"); + } + for w in [ + // A NEEDAFFIX or ONLYINCOMPOUND root alone, or a part with no compound flag at all. + "vor", + "werk", + "schlag", + "hausvor", + "schlagzeug", + // A suffix on the first part without the permit flag (s), and a prefix on a later part + // without it (v). + "vorschlageschlag", + "werkunhaus", + // Not words. + "vorschlagx", + "xvorschlag", + ] { + assert!(!d.check(w), "{w}"); + } + } + #[test] fn overlapping_compound_roots_with_a_failing_ending_stay_cheap() { // Roots a..aaaaaaaa overlap, so many splits of "aaa…ab" reach the same (tail, part) state; unmemoized that is millions of searches. From 77cc922b7fc5c9fd0fbccdc85febb87149fa75e6 Mon Sep 17 00:00:00 2001 From: Hamza Date: Mon, 16 Nov 2026 16:36:04 +0500 Subject: [PATCH 053/326] Spelling: an affix that needs another doesn't finish a part, and compound-only suffixes don't end a compound As Hunspell 1.7.6 reads the same dictionaries: an affix carrying NEEDAFFIX among its continuation flags finishes neither a word nor a compound part (cat/S with SFX S 0 s/XN: cats and suncats are wrong), and at the end of a compound a suffix that may only be used inside compounds may be empty but may not add letters (SFX S 0 s/XO: suncats is wrong, SFX S 0 0/XO: suncat is right). --- crates/engine/src/spell.rs | 50 +++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/spell.rs b/crates/engine/src/spell.rs index 3bfbf7652..e0c4fbc46 100644 --- a/crates/engine/src/spell.rs +++ b/crates/engine/src/spell.rs @@ -268,11 +268,17 @@ impl Dictionary { self.only_in_compound.is_some_and(|o| a.cont.contains(&o)) } + /// An affix that needs a further affix (`NEEDAFFIX` among its continuation flags): it can't be + /// the last affix of a word or of a compound part. + fn needs_another_affix(&self, a: &Affix) -> bool { + self.need_affix.is_some_and(|n| a.cont.contains(&n)) + } + /// Strip suffixes from `w` (one, or two through continuation flags); `extra` flags must also be /// on the root, `cross` means the suffix must allow a prefix. fn suffixed(&self, w: &[char], extra: &[Flag], cross: bool) -> bool { for s in &self.sfx { - if (cross && !s.cross) || self.only_in_compound_affix(s) { + if (cross && !s.cross) || self.only_in_compound_affix(s) || self.needs_another_affix(s) { continue; } let Some(stem) = strip_end(w, &s.add, &s.strip) else { continue }; @@ -317,15 +323,20 @@ impl Dictionary { /// `Vorschlag` (#2145). fn affixed_compound_part(&self, w: &[char], flag: Flag, pos: Pos) -> bool { let permit = |a: &Affix| self.compound_permit.is_some_and(|p| a.cont.contains(&p)); + // An affix that itself needs another (`NEEDAFFIX` among its continuation flags) doesn't + // finish a part on its own. let fits = |a: &Affix, stem: &[char]| { - self.words.get(&stem.iter().collect::()).is_some_and(|hs| { - hs.iter().any(|f| !self.has(f, self.forbidden) && f.contains(&a.flag) && (f.contains(&flag) || a.cont.contains(&flag))) - }) + !self.needs_another_affix(a) + && self.words.get(&stem.iter().collect::()).is_some_and(|hs| { + hs.iter().any(|f| !self.has(f, self.forbidden) && f.contains(&a.flag) && (f.contains(&flag) || a.cont.contains(&flag))) + }) }; let suffixed = self .sfx .iter() - .filter(|s| pos == Pos::Last || permit(s)) + // At the end of a compound, Hunspell refuses a suffix that adds letters and may only be + // used inside compounds; a zero-length one is accepted. + .filter(|s| if pos == Pos::Last { s.add.is_empty() || !self.only_in_compound_affix(s) } else { permit(s) }) .any(|s| strip_end(w, &s.add, &s.strip).is_some_and(|stem| s.cond_ok(&stem, false) && fits(s, &stem))); suffixed || self @@ -388,7 +399,7 @@ impl Dictionary { if !p.cond_ok(&stem, true) { continue; } - if self.root(&stem.iter().collect::(), &[p.flag], true) { + if !self.needs_another_affix(p) && self.root(&stem.iter().collect::(), &[p.flag], true) { return true; } if p.cross && self.suffixed(&stem, &[p.flag], true) { @@ -1039,6 +1050,33 @@ SFX D Y 1\nSFX D 0 ed/S .\n"; } } + #[test] + fn affixes_that_need_another_or_only_live_in_compounds_follow_hunspell() { + // Each row as Hunspell 1.7.6 reads the same dictionary: `sun/X` and `cat/S`, `SFX S` adding + // the compound flag X and NEEDAFFIX (N) or ONLYINCOMPOUND (O). + let dict = |sfx: &str| { + let aff = format!("COMPOUNDFLAG X\nCOMPOUNDMIN 3\nNEEDAFFIX N\nONLYINCOMPOUND O\nSFX S Y 1\nSFX S {sfx} .\n"); + Dictionary::parse(aff.as_bytes(), b"2\nsun/X\ncat/S\n".as_slice()) + }; + let rows: [(&str, &[&str], &[&str]); 4] = [ + // An affix that needs another finishes neither a word nor a compound part. + ("0 s/XN", &["sun", "cat"], &["cats", "suncats", "catssun"]), + ("0 0/XN", &["sun", "cat"], &["suncat"]), + // At the end of a compound a compound-only suffix may be empty, not add letters. + ("0 s/XO", &["sun", "cat"], &["cats", "suncats"]), + ("0 0/XO", &["sun", "cat", "suncat"], &["catsun", "suncatsun"]), + ]; + for (sfx, good, bad) in rows { + let d = dict(sfx); + for w in good { + assert!(d.check(w), "{sfx}: {w}"); + } + for w in bad { + assert!(!d.check(w), "{sfx}: {w}"); + } + } + } + #[test] fn overlapping_compound_roots_with_a_failing_ending_stay_cheap() { // Roots a..aaaaaaaa overlap, so many splits of "aaa…ab" reach the same (tail, part) state; unmemoized that is millions of searches. From 74f6e2c9b43b6b2aa7a1a86b7cc9b42c66ca209e Mon Sep 17 00:00:00 2001 From: "autocraft-bot[bot]" <354215646+autocraft-bot[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 11:40:03 +0000 Subject: [PATCH 054/326] Apply review fixes - crates/engine/src/spell.rs --- crates/engine/src/spell.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/spell.rs b/crates/engine/src/spell.rs index 3bfbf7652..678e8ecda 100644 --- a/crates/engine/src/spell.rs +++ b/crates/engine/src/spell.rs @@ -311,16 +311,18 @@ impl Dictionary { } /// A compound part made of a root and one affix, as Hunspell reads them: a suffix ends the last - /// part and a prefix starts the first; anywhere else the affix needs `COMPOUNDPERMITFLAG`. The + /// part and a prefix starts the first; anywhere else the affix needs `COMPOUNDPERMITFLAG`. + /// An affix that carries NEEDAFFIX needs a second one and doesn't count. The /// compound `flag` may be on the root or among the affix's continuation flags. German frami /// gives many first parts their flag that way: `Vor/hij` with `SFX j 0 0/xoc` begins /// `Vorschlag` (#2145). fn affixed_compound_part(&self, w: &[char], flag: Flag, pos: Pos) -> bool { let permit = |a: &Affix| self.compound_permit.is_some_and(|p| a.cont.contains(&p)); let fits = |a: &Affix, stem: &[char]| { - self.words.get(&stem.iter().collect::()).is_some_and(|hs| { - hs.iter().any(|f| !self.has(f, self.forbidden) && f.contains(&a.flag) && (f.contains(&flag) || a.cont.contains(&flag))) - }) + !self.need_affix.is_some_and(|n| a.cont.contains(&n)) + && self.words.get(&stem.iter().collect::()).is_some_and(|hs| { + hs.iter().any(|f| !self.has(f, self.forbidden) && f.contains(&a.flag) && (f.contains(&flag) || a.cont.contains(&flag))) + }) }; let suffixed = self .sfx @@ -1012,8 +1014,8 @@ SFX D Y 1\nSFX D 0 ed/S .\n"; // from zero affixes' continuation classes, not from the root, and those roots need an affix. let aff = "COMPOUNDBEGIN B\nCOMPOUNDMIDDLE M\nCOMPOUNDEND E\nCOMPOUNDPERMITFLAG P\nONLYINCOMPOUND O\nNEEDAFFIX N\n\ COMPOUNDMIN 2\nSFX j Y 1\nSFX j 0 0/BOP .\nSFX m Y 1\nSFX m 0 0/MOP .\nPFX q Y 1\nPFX q 0 0/BO .\n\ - SFX s Y 1\nSFX s 0 e .\nSFX u Y 1\nSFX u 0 s .\nPFX v Y 1\nPFX v 0 un .\n"; - let dic = "6\nvor/Nj\nschlag/OEs\nwerk/Njm\nzeug/OEs\nding/Nq\nhaus/E\n"; + SFX s Y 1\nSFX s 0 e .\nSFX u Y 1\nSFX u 0 s .\nPFX v Y 1\nPFX v 0 un .\nSFX t Y 1\nSFX t 0 0/BNP .\n"; + let dic = "8\nvor/Nj\nschlag/OEs\nwerk/Njm\nzeug/OEs\nding/Nq\nhaus/Ev\ntag/Bs\ntor/t\n"; let d = Dictionary::parse(aff.as_bytes(), dic.as_bytes()); // First part through SFX j, middle part through SFX m (it carries the permit flag), last // part from its root, with or without a suffix there. @@ -1031,6 +1033,9 @@ SFX D Y 1\nSFX D 0 ed/S .\n"; // without it (v). "vorschlageschlag", "werkunhaus", + // tag carries B but its suffix s has no permit flag; SFX t gives B but carries NEEDAFFIX. + "tageschlag", + "torhaus", // Not words. "vorschlagx", "xvorschlag", From 4bc331c46dc761c47b1fe61a547bff030beff7fb Mon Sep 17 00:00:00 2001 From: Hamza Date: Mon, 16 Nov 2026 17:07:40 +0500 Subject: [PATCH 055/326] Spelling: a prefix completes a suffix that needs another affix work/US with SFX S 0 s/N: unworks is a word (the prefix completes the suffix), works isn't. The last change refused the suffix in the prefix's cross product too; a prefix that needs nothing more now completes it, as Hunspell 1.7.6 reads it. When both need another affix, neither completes the other. --- crates/engine/src/spell.rs | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/spell.rs b/crates/engine/src/spell.rs index af25f270d..6d0bde8d1 100644 --- a/crates/engine/src/spell.rs +++ b/crates/engine/src/spell.rs @@ -275,10 +275,12 @@ impl Dictionary { } /// Strip suffixes from `w` (one, or two through continuation flags); `extra` flags must also be - /// on the root, `cross` means the suffix must allow a prefix. - fn suffixed(&self, w: &[char], extra: &[Flag], cross: bool) -> bool { + /// on the root, `cross` means the suffix must allow a prefix. `completed`: a prefix that needs + /// nothing more is already on the word, so a suffix that needs another affix has it + /// (`work/US` with `SFX S 0 s/N` makes `unworks`, not `works`). + fn suffixed(&self, w: &[char], extra: &[Flag], cross: bool, completed: bool) -> bool { for s in &self.sfx { - if (cross && !s.cross) || self.only_in_compound_affix(s) || self.needs_another_affix(s) { + if (cross && !s.cross) || self.only_in_compound_affix(s) || (self.needs_another_affix(s) && !completed) { continue; } let Some(stem) = strip_end(w, &s.add, &s.strip) else { continue }; @@ -389,7 +391,7 @@ impl Dictionary { return true; } let w: Vec = word.chars().collect(); - if self.suffixed(&w, &[], false) { + if self.suffixed(&w, &[], false, false) { return true; } for p in &self.pfx { @@ -403,7 +405,7 @@ impl Dictionary { if !self.needs_another_affix(p) && self.root(&stem.iter().collect::(), &[p.flag], true) { return true; } - if p.cross && self.suffixed(&stem, &[p.flag], true) { + if p.cross && self.suffixed(&stem, &[p.flag], true, !self.needs_another_affix(p)) { return true; } } @@ -1081,6 +1083,25 @@ SFX D Y 1\nSFX D 0 ed/S .\n"; } } + #[test] + fn a_prefix_completes_a_suffix_that_needs_another_affix() { + // As Hunspell 1.7.6 reads it: `work/US`, a suffix needing another affix (N). The prefix + // completes it (`unworks`); alone it doesn't (`works`); when both need another, neither + // completes the other. + for (pfx, good, bad) in + [("0 un", &["work", "unwork", "unworks"][..], &["works"][..]), ("0 un/N", &["work"][..], &["works", "unwork", "unworks"][..])] + { + let aff = format!("NEEDAFFIX N\nPFX U Y 1\nPFX U {pfx} .\nSFX S Y 1\nSFX S 0 s/N .\n"); + let d = Dictionary::parse(aff.as_bytes(), b"1\nwork/US\n".as_slice()); + for w in good { + assert!(d.check(w), "{pfx}: {w}"); + } + for w in bad { + assert!(!d.check(w), "{pfx}: {w}"); + } + } + } + #[test] fn overlapping_compound_roots_with_a_failing_ending_stay_cheap() { // Roots a..aaaaaaaa overlap, so many splits of "aaa…ab" reach the same (tail, part) state; unmemoized that is millions of searches. From d163b84e530a606f7231d0b49e9103ab27cdeae5 Mon Sep 17 00:00:00 2001 From: "autocraft-bot[bot]" <354215646+autocraft-bot[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 14:12:15 +0000 Subject: [PATCH 056/326] Apply review fixes - crates/engine/src/spell.rs --- crates/engine/src/spell.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/spell.rs b/crates/engine/src/spell.rs index 6d0bde8d1..21e2f3e69 100644 --- a/crates/engine/src/spell.rs +++ b/crates/engine/src/spell.rs @@ -320,7 +320,7 @@ impl Dictionary { /// A compound part made of a root and one affix, as Hunspell reads them: a suffix ends the last /// part and a prefix starts the first; anywhere else the affix needs `COMPOUNDPERMITFLAG`. - /// An affix that carries `NEEDAFFIX` needs a second one and doesn't count. The compound `flag` + /// An affix that carries `NEEDAFFIX` needs a second one and doesn't count. One whose continuation flags carry `COMPOUNDEND` may only be on the last part. The compound `flag` /// may be on the root or among the affix's continuation flags. German frami /// gives many first parts their flag that way: `Vor/hij` with `SFX j 0 0/xoc` begins /// `Vorschlag` (#2145). @@ -330,6 +330,8 @@ impl Dictionary { // finish a part on its own. let fits = |a: &Affix, stem: &[char]| { !self.needs_another_affix(a) + // Only the last part may take an affix whose continuation flags carry the compound end flag. + && (pos == Pos::Last || !self.compound_end.is_some_and(|e| a.cont.contains(&e))) && self.words.get(&stem.iter().collect::()).is_some_and(|hs| { hs.iter().any(|f| !self.has(f, self.forbidden) && f.contains(&a.flag) && (f.contains(&flag) || a.cont.contains(&flag))) }) @@ -1102,6 +1104,15 @@ SFX D Y 1\nSFX D 0 ed/S .\n"; } } + #[test] + fn an_affix_carrying_the_compound_end_flag_only_ends_a_compound() { + let aff = "COMPOUNDFLAG X\nCOMPOUNDEND E\nCOMPOUNDPERMITFLAG P\nCOMPOUNDMIN 3\nSFX S Y 1\nSFX S 0 s/XEP .\n"; + let d = Dictionary::parse(aff.as_bytes(), b"2\nsun/X\ncat/S\n".as_slice()); + assert!(d.check("suncats")); + assert!(d.check("cats")); + assert!(!d.check("catssun")); + } + #[test] fn overlapping_compound_roots_with_a_failing_ending_stay_cheap() { // Roots a..aaaaaaaa overlap, so many splits of "aaa…ab" reach the same (tail, part) state; unmemoized that is millions of searches. From 6921db0f835557ed77a3dddd766e831dacb0ee2d Mon Sep 17 00:00:00 2001 From: Hamza Date: Tue, 17 Nov 2026 13:54:46 +0500 Subject: [PATCH 057/326] Spelling: wrap affixed_compound_part's doc comment --- crates/engine/src/spell.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/spell.rs b/crates/engine/src/spell.rs index 21e2f3e69..61c5117ae 100644 --- a/crates/engine/src/spell.rs +++ b/crates/engine/src/spell.rs @@ -320,10 +320,10 @@ impl Dictionary { /// A compound part made of a root and one affix, as Hunspell reads them: a suffix ends the last /// part and a prefix starts the first; anywhere else the affix needs `COMPOUNDPERMITFLAG`. - /// An affix that carries `NEEDAFFIX` needs a second one and doesn't count. One whose continuation flags carry `COMPOUNDEND` may only be on the last part. The compound `flag` - /// may be on the root or among the affix's continuation flags. German frami - /// gives many first parts their flag that way: `Vor/hij` with `SFX j 0 0/xoc` begins - /// `Vorschlag` (#2145). + /// An affix that carries `NEEDAFFIX` needs a second one and doesn't count. One whose + /// continuation flags carry `COMPOUNDEND` may only be on the last part. The compound `flag` + /// may be on the root or among the affix's continuation flags. German frami gives many first + /// parts their flag that way: `Vor/hij` with `SFX j 0 0/xoc` begins `Vorschlag` (#2145). fn affixed_compound_part(&self, w: &[char], flag: Flag, pos: Pos) -> bool { let permit = |a: &Affix| self.compound_permit.is_some_and(|p| a.cont.contains(&p)); // An affix that itself needs another (`NEEDAFFIX` among its continuation flags) doesn't From 62e00839c72553485ec79e435e2e0f0aed7fdb67 Mon Sep 17 00:00:00 2001 From: Hamza Date: Tue, 17 Nov 2026 14:15:49 +0500 Subject: [PATCH 058/326] Spelling: the compound-end exclusion applies to the plain compound flag only A suffix whose continuation flags carry COMPOUNDEND was refused in any part but the last, whichever flag found it. Hunspell refuses it only on the plain COMPOUNDFLAG lookup: with COMPOUNDBEGIN B, COMPOUNDEND E and SFX S 0 s/BEP, Hunspell 1.7.6 accepts `catssun`, which this rejected (CodeRabbit's review). --- crates/engine/src/spell.rs | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/spell.rs b/crates/engine/src/spell.rs index 61c5117ae..a5654ccea 100644 --- a/crates/engine/src/spell.rs +++ b/crates/engine/src/spell.rs @@ -320,18 +320,21 @@ impl Dictionary { /// A compound part made of a root and one affix, as Hunspell reads them: a suffix ends the last /// part and a prefix starts the first; anywhere else the affix needs `COMPOUNDPERMITFLAG`. - /// An affix that carries `NEEDAFFIX` needs a second one and doesn't count. One whose - /// continuation flags carry `COMPOUNDEND` may only be on the last part. The compound `flag` + /// An affix that carries `NEEDAFFIX` needs a second one and doesn't count. A suffix found + /// through the plain compound flag whose continuation flags carry `COMPOUNDEND` may only be on + /// the last part. The compound `flag` /// may be on the root or among the affix's continuation flags. German frami gives many first /// parts their flag that way: `Vor/hij` with `SFX j 0 0/xoc` begins `Vorschlag` (#2145). fn affixed_compound_part(&self, w: &[char], flag: Flag, pos: Pos) -> bool { let permit = |a: &Affix| self.compound_permit.is_some_and(|p| a.cont.contains(&p)); // An affix that itself needs another (`NEEDAFFIX` among its continuation flags) doesn't // finish a part on its own. - let fits = |a: &Affix, stem: &[char]| { + let fits = |a: &Affix, stem: &[char], suffix: bool| { !self.needs_another_affix(a) - // Only the last part may take an affix whose continuation flags carry the compound end flag. - && (pos == Pos::Last || !self.compound_end.is_some_and(|e| a.cont.contains(&e))) + // Only the last part may take a suffix found through the plain compound flag whose + // continuation flags carry the compound end flag; the begin, middle and prefix + // lookups don't check it, as in Hunspell. + && (pos == Pos::Last || !suffix || Some(flag) != self.compound || !self.compound_end.is_some_and(|e| a.cont.contains(&e))) && self.words.get(&stem.iter().collect::()).is_some_and(|hs| { hs.iter().any(|f| !self.has(f, self.forbidden) && f.contains(&a.flag) && (f.contains(&flag) || a.cont.contains(&flag))) }) @@ -342,13 +345,13 @@ impl Dictionary { // At the end of a compound, Hunspell refuses a suffix that adds letters and may only be // used inside compounds; a zero-length one is accepted. .filter(|s| if pos == Pos::Last { s.add.is_empty() || !self.only_in_compound_affix(s) } else { permit(s) }) - .any(|s| strip_end(w, &s.add, &s.strip).is_some_and(|stem| s.cond_ok(&stem, false) && fits(s, &stem))); + .any(|s| strip_end(w, &s.add, &s.strip).is_some_and(|stem| s.cond_ok(&stem, false) && fits(s, &stem, true))); suffixed || self .pfx .iter() .filter(|p| pos == Pos::First || permit(p)) - .any(|p| strip_start(w, &p.add, &p.strip).is_some_and(|stem| p.cond_ok(&stem, true) && fits(p, &stem))) + .any(|p| strip_start(w, &p.add, &p.strip).is_some_and(|stem| p.cond_ok(&stem, true) && fits(p, &stem, false))) } /// `w` made of dictionary parts allowed in compounds (`COMPOUNDFLAG`, or the begin, middle and @@ -1111,6 +1114,15 @@ SFX D Y 1\nSFX D 0 ed/S .\n"; assert!(d.check("suncats")); assert!(d.check("cats")); assert!(!d.check("catssun")); + // Through the begin flag, the end flag on the suffix doesn't matter: Hunspell 1.7.6 + // accepts `catssun` here (and `cats`), and rejects `catsun`, `suncats` and `suncat`. + let aff = "COMPOUNDBEGIN B\nCOMPOUNDEND E\nCOMPOUNDPERMITFLAG P\nCOMPOUNDMIN 3\nSFX S Y 1\nSFX S 0 s/BEP .\n"; + let d = Dictionary::parse(aff.as_bytes(), b"2\nsun/E\ncat/S\n".as_slice()); + assert!(d.check("catssun")); + assert!(d.check("cats")); + for w in ["catsun", "suncats", "suncat"] { + assert!(!d.check(w), "{w}"); + } } #[test] From 8f82023a06b3b19ae78aff28b0607104829d86ba Mon Sep 17 00:00:00 2001 From: Neil Cawse Date: Tue, 17 Nov 2026 12:38:58 +0000 Subject: [PATCH 059/326] test(pptx): cover VML preview inside conditional comment by o:spid in ole_vml --- crates/pptx/tests/it/ole_vml.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/pptx/tests/it/ole_vml.rs b/crates/pptx/tests/it/ole_vml.rs index ccdc803a2..ddaae24dd 100644 --- a/crates/pptx/tests/it/ole_vml.rs +++ b/crates/pptx/tests/it/ole_vml.rs @@ -32,6 +32,11 @@ fn deck() -> Vec { /// [`deck`] with `frames` in place of [`FRAME`]. fn deck_with(frames: &str) -> Vec { + deck_with_vml(frames, VML) +} + +/// [`deck`] with `frames` in place of [`FRAME`] and `vml` as the drawing. +fn deck_with_vml(frames: &str, vml: &str) -> Vec { let bytes = deckcraft_pptx::export(&defaults::new_presentation(None)).expect("export"); let mut z = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip"); let mut out = zip::ZipWriter::new(Cursor::new(Vec::new())); @@ -55,7 +60,7 @@ fn deck_with(frames: &str) -> Vec { out.write_all(&d).expect("write"); } for (name, data) in [ - ("ppt/drawings/vmlDrawing1.vml", VML.as_bytes().to_vec()), + ("ppt/drawings/vmlDrawing1.vml", vml.as_bytes().to_vec()), ("ppt/drawings/_rels/vmlDrawing1.vml.rels", VML_RELS.as_bytes().to_vec()), ("ppt/media/other.png", png(10)), ("ppt/media/preview.png", png(200)), @@ -77,6 +82,18 @@ fn an_ole_object_without_a_picture_shows_its_vml_preview() { assert_eq!(media.name, "preview.png"); } +#[test] +fn a_vml_preview_inside_a_conditional_comment_is_found_by_its_o_spid() { + let head = &VML[..VML.find('>').expect("xml start") + 1]; + let vml = format!( + r#"{head}"# + ); + let p = deckcraft_pptx::import(&deck_with_vml(FRAME, &vml)).expect("import"); + let s = p.slides[0].shapes.iter().find(|s| s.name == "Object 3").expect("frame"); + let ShapeKind::Opaque { preview: Some(m), .. } = &s.kind else { panic!("{:?}", s.kind) }; + assert_eq!(p.media.iter().find(|x| x.id == *m).map(|x| x.name.as_str()), Some("preview.png")); +} + #[test] fn activex_controls_show_their_pictures() { let p = deckcraft_pptx::import(&deck()).expect("import"); From 75f798124e83c6a315c9542dab91e5f491db61d4 Mon Sep 17 00:00:00 2001 From: Josias Eli Rodriguez <339499413+chamber074@users.noreply.github.com> Date: Tue, 17 Nov 2026 19:06:31 -0600 Subject: [PATCH 060/326] fix(mcp): drop the integer enum from the export tool's perPage (#2211) --- crates/mcp/src/tests.rs | 6 +++++- crates/mcp/src/tools.rs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/mcp/src/tests.rs b/crates/mcp/src/tests.rs index 665591872..b02120fc0 100644 --- a/crates/mcp/src/tests.rs +++ b/crates/mcp/src/tests.rs @@ -247,7 +247,11 @@ fn export_tool_lists_pdf_and_its_options() { assert!(formats.iter().any(|x| x == f), "format {f}: {export}"); } assert_eq!(props["layout"]["enum"], json!(["slides", "notes", "handouts"])); - assert_eq!(props["perPage"]["enum"], json!([1, 2, 3, 4, 6, 9])); + // Gemini function declarations accept only string enums (#2211): perPage stays a plain integer + // and the allowed values are spelled out in the description (the engine validates the set). + assert_eq!(props["perPage"]["type"], "integer"); + assert!(props["perPage"].get("enum").is_none(), "{export}"); + assert!(props["perPage"]["description"].as_str().unwrap().contains("1, 2, 3, 4, 6 or 9"), "{export}"); for p in ["dpi", "slides", "includeHidden", "textLayer", "frame", "paper", "orientation"] { assert!(props.get(p).is_some(), "{p}: {export}"); } diff --git a/crates/mcp/src/tools.rs b/crates/mcp/src/tools.rs index d09b2a439..bab4c259b 100644 --- a/crates/mcp/src/tools.rs +++ b/crates/mcp/src/tools.rs @@ -124,7 +124,7 @@ pub fn tool_definitions() -> Vec { "all": boolean("All slides (images)"), "scale": num("Pixels per point for images (default 2)"), "layout": {"type": "string", "enum": ["slides", "notes", "handouts"], "description": "PDF page layout (default slides)"}, - "perPage": {"type": "integer", "enum": [1, 2, 3, 4, 6, 9], "description": "PDF handouts: slides per page (default 6)"}, + "perPage": {"type": "integer", "description": "PDF handouts: slides per page (1, 2, 3, 4, 6 or 9; default 6)"}, "dpi": num("PDF: raster resolution of slide artwork, 36-600 (default 200)"), "slides": {"type": "array", "items": {"type": "integer", "minimum": 0}, "description": "PDF and GIF: slide indices to export, in order (default all)"}, "includeHidden": boolean("PDF and GIF: include hidden slides (default false)"), From f65e481c95586f25273227cb51e56bea81df8dbe Mon Sep 17 00:00:00 2001 From: Zach Berry <1112351+zberry@users.noreply.github.com> Date: Tue, 17 Nov 2026 20:57:38 -0600 Subject: [PATCH 061/326] Column insert: the per-row template keeps the formatting only The template cloned the whole anchor cell, text included, once per covered row. It is now an empty cell given the anchor's formatting. A test comment described a default the command never had. Co-Authored-By: Claude Fable 5.2 --- crates/engine/src/cmd/table.rs | 7 ++++++- crates/engine/src/tests.rs | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rs index 7695dc1ad..5d0ad0237 100644 --- a/crates/engine/src/cmd/table.rs +++ b/crates/engine/src/cmd/table.rs @@ -390,7 +390,12 @@ fn insert_col_like(t: &mut Table, at: usize, neighbour: usize, keep_width: bool) break; } } - t.rows[r].cells.get(n).cloned() + // Only the formatting is kept: the anchor's text is not copied once per covered row. + t.rows[r].cells.get(n).map(|src| { + let mut tpl = Cell::new(""); + copy_cell_format(&mut tpl, src); + tpl + }) }) .collect(); if !t.insert_col(at) { diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 6a5aaa015..c78f06699 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -7297,8 +7297,8 @@ fn master_body_placeholder_format_keeps_per_level_formatting() { assert_eq!(shown(&s), vec![Some(28.0), Some(24.0)]); } -/// A `keepWidth` that is not a bool is refused, naming it, and the table is left alone; it used -/// to be read as absent and the columns shrunk as if `true` had been asked. +/// A `keepWidth` that is not a bool is refused, naming it, and the table is left alone, not read +/// as the default (the table growing by the new column). #[test] fn table_insert_column_refuses_a_keep_width_that_is_not_a_bool() { let mut s = session(); From f41ae047009c4c59f8425d60045ff8351c00ce74 Mon Sep 17 00:00:00 2001 From: tydude001 <291262504+tydude001@users.noreply.github.com> Date: Wed, 18 Nov 2026 07:34:53 -0600 Subject: [PATCH 062/326] packaging: RPM recommends libX11-xcb and libxkbcommon-x11, so the GUI starts on X11 The GUI opens libX11-xcb.so.1 and libxkbcommon-x11.so.0 at runtime on X11, and its binary also names libwayland-egl.so.1, but nothing in the RPM asked for them. Fresh Fedora 44, Leap 15.6 and Tumbleweed installs, with recommendations on, left libxkbcommon-x11 out. Started on X11 (Xvfb) in Fedora 44 and Leap 15.6, GridCraft then panicked ("Library libxkbcommon-x11.so could not be loaded"). With only libX11-xcb missing, winit fails to create its event loop ("libX11-xcb.so.1: cannot open shared object file"). All three are now recommended by soname. libXrandr is dropped: no binary names it. --- packaging/linux/nfpm.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packaging/linux/nfpm.yaml b/packaging/linux/nfpm.yaml index 6cf2aad45..b60116aaf 100644 --- a/packaging/linux/nfpm.yaml +++ b/packaging/linux/nfpm.yaml @@ -55,13 +55,16 @@ overrides: - libxkbcommon.so.0()(64bit) - (libvulkan.so.1()(64bit) or libEGL.so.1()(64bit)) - libasound.so.2()(64bit) - # The windowing libraries by soname too, so the recommendations resolve on openSUSE as well. + # The windowing libraries the GUI loads at runtime, by soname too, so the recommendations resolve on + # openSUSE as well. Without libX11-xcb and libxkbcommon-x11 the GUI cannot start on X11. recommends: - libwayland-client.so.0()(64bit) - libX11.so.6()(64bit) - libXcursor.so.1()(64bit) - libXi.so.6()(64bit) - - libXrandr.so.2()(64bit) + - libX11-xcb.so.1()(64bit) + - libxkbcommon-x11.so.0()(64bit) + - libwayland-egl.so.1()(64bit) - mesa-vulkan-drivers - xdg-desktop-portal From eec73f339675616d5328935c59a1fb4807b5e799 Mon Sep 17 00:00:00 2001 From: Hamza Date: Wed, 18 Nov 2026 19:15:17 +0500 Subject: [PATCH 063/326] Check Accessibility: alt text that is only a file name is reported (#2224) Insert Picture sets a picture's alt text to its file name, so the picture counted as described and review.accessibility said nothing, though a screen reader would read only "IMG_2041.png". Alt text that is one word ending in a picture extension, or that is the name of the file the picture came from, is now reported as "Alternative text is a file name", until it is described or marked decorative. --- crates/engine/src/cmd/review.rs | 58 +++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/crates/engine/src/cmd/review.rs b/crates/engine/src/cmd/review.rs index 351ca29dc..355b6dfda 100644 --- a/crates/engine/src/cmd/review.rs +++ b/crates/engine/src/cmd/review.rs @@ -246,6 +246,26 @@ fn neighbour(s: &mut Session, p: &Value, forward: bool) -> Result { Ok(json!({"slide": slide, "index": index, "text": text})) } +/// Whether alternative text is a picture's file name and nothing else: one word ending in a +/// picture file's extension (`IMG_2041.png`, `C:\\photos\\a.JPG`), or the name of the file the +/// picture came from, which may have spaces (`Screenshot 2024 at 10.00.png`). +fn is_file_name(alt: &str, file: Option<&str>) -> bool { + const PICTURE_EXTENSIONS: [&str; 15] = + ["png", "jpg", "jpeg", "jpe", "gif", "bmp", "tif", "tiff", "webp", "svg", "emf", "wmf", "heic", "avif", "ico"]; + let alt = alt.trim(); + let one_word = !alt.is_empty() && !alt.contains(char::is_whitespace); + (one_word && alt.rsplit_once('.').is_some_and(|(stem, ext)| !stem.is_empty() && PICTURE_EXTENSIONS.iter().any(|e| ext.eq_ignore_ascii_case(e)))) + || file.is_some_and(|f| !alt.is_empty() && f.trim().eq_ignore_ascii_case(alt)) +} + +/// The name of the file a picture shape's picture came from, if it has one. +fn picture_file<'a>(doc: &'a deckcraft_model::Presentation, sh: &deckcraft_model::Shape) -> Option<&'a str> { + match &sh.kind { + deckcraft_model::ShapeKind::Picture { fill } => doc.media(fill.media).map(|m| m.name.as_str()), + _ => None, + } +} + fn accessibility(s: &mut Session, _p: &Value) -> Result { let st = s.doc()?; let mut out = vec![]; @@ -263,6 +283,10 @@ fn accessibility(s: &mut Session, _p: &Value) -> Result { ); if needs_alt && sh.descr.trim().is_empty() && !sh.decorative { out.push(json!({"slide": i, "shape": sh.id, "name": sh.name, "issue": "Missing alternative text"})); + } else if needs_alt && !sh.decorative && is_file_name(&sh.descr, picture_file(&st.doc, sh)) { + // Insert Picture names a picture after its file, which is all a screen reader + // would then say (#2224). + out.push(json!({"slide": i, "shape": sh.id, "name": sh.name, "issue": "Alternative text is a file name"})); } }); // Low-contrast text against the slide background. @@ -1041,4 +1065,38 @@ mod accessibility_contrast_tests { assert!(!contrasts.iter().any(|issue| issue["shape"] == 6), "black control warned: {issues}"); assert!(!contrasts.iter().any(|issue| issue["shape"] == 8), "white break or spaces warned: {issues}"); } + + /// #2224: Insert Picture's alt text is the file name, which says nothing; it is reported until + /// it is described or marked decorative. A description that mentions a file is fine. + #[test] + fn alt_text_that_is_a_file_name_is_reported() { + let png: Vec = vec![ + 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 8, 0, 0, 0, 8, 8, 2, 0, 0, 0, 75, 109, 41, 220, 0, 0, 0, 17, 73, + 68, 65, 84, 120, 156, 99, 184, 163, 161, 129, 21, 49, 12, 45, 9, 0, 123, 123, 75, 1, 251, 162, 81, 240, 0, 0, 0, 0, 73, 69, 78, 68, 174, + 66, 96, 130, + ]; + let mut s = Session::with_new(); + let id = s.execute("insert.picture", &json!({"data": crate::cmd::base64_encode(&png), "name": "IMG_2041.png"})).unwrap()["id"].clone(); + let named = |s: &mut Session| { + let issues = s.execute("review.accessibility", &json!({})).unwrap(); + issues.as_array().unwrap().iter().filter(|i| i["shape"] == id && i["issue"] == "Alternative text is a file name").count() + }; + assert_eq!(named(&mut s), 1); + for (text, decorative, expected) in [ + ("photo.JPEG", false, 1), + ("C:\\Users\\me\\Pictures\\holiday.png", false, 1), + ("A red square", false, 0), + ("A red square, from IMG_2041.png", false, 0), + ("IMG_2041.png", true, 0), + ] { + s.execute("shape.altText", &json!({"text": text, "decorative": decorative, "ids": [id]})).unwrap(); + assert_eq!(named(&mut s), expected, "{text:?} decorative {decorative}"); + } + assert!(!is_file_name("Version 2.0", None), "a version number is not a picture's extension"); + assert!(!is_file_name(".png", None)); + assert!(!is_file_name("A red square, from IMG_2041.png", None)); + // The picture's own file name counts, spaces and all. + assert!(is_file_name("Screenshot 2024 at 10.00.png", Some("Screenshot 2024 at 10.00.png"))); + assert!(!is_file_name("Screenshot 2024 at 10.00.png", None)); + } } From 43815b285fce01b250c7214002725967d2dec5e7 Mon Sep 17 00:00:00 2001 From: Hamza Date: Wed, 18 Nov 2026 19:16:33 +0500 Subject: [PATCH 064/326] Check Accessibility test: a picture's own spaced file name is reported --- crates/engine/src/cmd/review.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/engine/src/cmd/review.rs b/crates/engine/src/cmd/review.rs index 355b6dfda..996b556b7 100644 --- a/crates/engine/src/cmd/review.rs +++ b/crates/engine/src/cmd/review.rs @@ -1092,6 +1092,13 @@ mod accessibility_contrast_tests { s.execute("shape.altText", &json!({"text": text, "decorative": decorative, "ids": [id]})).unwrap(); assert_eq!(named(&mut s), expected, "{text:?} decorative {decorative}"); } + // A file name with spaces is reported when it is the picture's own file's. + let mut s = Session::with_new(); + let id = + s.execute("insert.picture", &json!({"data": crate::cmd::base64_encode(&png), "name": "Screenshot 2024 at 10.00.png"})).unwrap()["id"] + .clone(); + let issues = s.execute("review.accessibility", &json!({})).unwrap(); + assert!(issues.as_array().unwrap().iter().any(|i| i["shape"] == id && i["issue"] == "Alternative text is a file name"), "{issues}"); assert!(!is_file_name("Version 2.0", None), "a version number is not a picture's extension"); assert!(!is_file_name(".png", None)); assert!(!is_file_name("A red square, from IMG_2041.png", None)); From 4ca6a795d9a917eefaf2d05b7ab91baf5013df3c Mon Sep 17 00:00:00 2001 From: Josias Eli Rodriguez <339499413+chamber074@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:50:39 +0000 Subject: [PATCH 065/326] table: reject row and column resizes past the table (#2260) table.rowHeight and table.columnWidth accepted a row or column the table doesn't have (row 99 on a 2 x 2 table) and reported success. Both now return an invalid-argument error, checked inside the edit before any change, so a refused resize leaves the presentation and the undo and redo history as they were. This is the follow-up #1189's review named. The old test that expected a huge col to be ignored now expects the error. --- crates/engine/src/cmd/table.rs | 8 +++++++ crates/engine/src/tests.rs | 42 ++++++++++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/table.rs b/crates/engine/src/cmd/table.rs index 0034645f8..cb298073d 100644 --- a/crates/engine/src/cmd/table.rs +++ b/crates/engine/src/cmd/table.rs @@ -626,11 +626,18 @@ fn distribute(s: &mut Session, p: &Value, rows: bool) -> Result { }) } +/// A row or column the table doesn't have is an error, like a malformed index (#2260): checked +/// inside the edit, so a refused resize changes nothing and adds no undo step. +fn index_in_table(cmd: &str, key: &str, i: usize, n: usize, what: &str) -> Result<()> { + if i < n { Ok(()) } else { Err(bad(cmd, format!("`{key}` {i} is out of range: the table has {n} {what}"))) } +} + fn column_width(s: &mut Session, p: &Value) -> Result { let (_, c) = at(s, p, "table.columnWidth")?; let w = f64_param(p, "width").ok_or_else(|| bad("table.columnWidth", "missing `width`"))?.clamp(4.0, 4000.0); let keep_total = bool_or(p, "keepTotal", false); with_table(s, p, "table.columnWidth", move |t| { + index_in_table("table.columnWidth", "col", c, t.n_cols(), "columns")?; // Keeping the table's width, the column to the right gives or takes the difference (dragging // an inner border). The last column has none: the table gets wider or narrower. let pair = t.cols.get(c).zip(t.cols.get(c.saturating_add(1))).map(|(a, b)| a.max(0.0) + b.max(0.0)).filter(|x| x.is_finite()); @@ -659,6 +666,7 @@ fn row_height(s: &mut Session, p: &Value) -> Result { let (r, _) = at(s, p, "table.rowHeight")?; let h = f64_param(p, "height").ok_or_else(|| bad("table.rowHeight", "missing `height`"))?.clamp(4.0, 4000.0); with_table(s, p, "table.rowHeight", move |t| { + index_in_table("table.rowHeight", "row", r, t.n_rows(), "rows")?; if let Some(x) = t.rows.get_mut(r) { x.height = h; } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 52006b7a7..d7a997c93 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -6061,15 +6061,47 @@ fn table_cell_commands_reject_an_invalid_cell_and_name_the_registered_command() assert!(e.contains("table.insertColumnLeft"), "error should name the registered command: {e}"); } +/// #2260 (the follow-up #1189's review named): a resize of a row or column the table doesn't +/// have is an error, and leaves the presentation and the undo and redo history as they were. #[test] -fn table_column_width_of_a_huge_column_is_ignored() { +fn table_resize_rejects_a_row_or_column_past_the_table() { let mut s = session(); let id = table_at(&mut s, &[100.0, 100.0], json!([["a", "b"], ["c", "d"]])); - for keep_total in [true, false] { - let r = s.execute("table.columnWidth", &json!({"id": id.0, "col": u64::MAX, "width": 50.0, "keepTotal": keep_total})); - assert!(r.is_ok(), "columnWidth must ignore a huge col (keepTotal {keep_total}), got {r:?}"); - assert_eq!(table_of(&s, id).cols, vec![100.0, 100.0], "no column changes"); + // A row height undone, so there is a redo step for the rejected resizes to keep. + s.execute("table.rowHeight", &json!({"id": id.0, "row": 0, "height": 30.0})).unwrap(); + s.execute("edit.undo", &json!({})).unwrap(); + for (cmd, params) in [ + ("table.rowHeight", json!({"id": id.0, "row": 2, "height": 50.0})), + ("table.rowHeight", json!({"id": id.0, "row": 99, "height": 50.0})), + ("table.columnWidth", json!({"id": id.0, "col": 2, "width": 50.0})), + ("table.columnWidth", json!({"id": id.0, "col": 99, "width": 50.0})), + ("table.columnWidth", json!({"id": id.0, "col": 99, "width": 50.0, "keepTotal": true})), + ("table.columnWidth", json!({"id": id.0, "col": u64::MAX, "width": 50.0, "keepTotal": true})), + ] { + let doc = s.doc().unwrap().doc.clone(); + let (undo, redo) = (s.doc().unwrap().history.undo.len(), s.doc().unwrap().history.redo.len()); + let e = s.execute(cmd, ¶ms).expect_err(&format!("{cmd} {params} should be rejected")); + assert!(e.to_string().contains(cmd), "the error should name {cmd}: {e}"); + assert!(std::sync::Arc::ptr_eq(&s.doc().unwrap().doc, &doc), "{cmd} {params} must leave the presentation unchanged"); + assert_eq!(s.doc().unwrap().history.undo.len(), undo, "{cmd} {params} must not add an undo step"); + assert_eq!(s.doc().unwrap().history.redo.len(), redo, "{cmd} {params} must keep the redo step"); } + // The history behaves as if they never ran: redo still brings back the row height. + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(table_of(&s, id).rows.first().map(|r| r.height), Some(30.0), "the redo step is still the row height"); +} + +#[test] +fn table_resize_in_range_still_works() { + let mut s = session(); + let id = table_at(&mut s, &[100.0, 100.0], json!([["a", "b"], ["c", "d"]])); + let undo = s.doc().unwrap().history.undo.len(); + s.execute("table.rowHeight", &json!({"id": id.0, "row": 1, "height": 50.0})).unwrap(); + s.execute("table.columnWidth", &json!({"id": id.0, "col": 1, "width": 150.0})).unwrap(); + let t = table_of(&s, id); + assert_eq!(t.rows.get(1).map(|r| r.height), Some(50.0)); + assert_eq!(t.cols, vec![100.0, 150.0]); + assert_eq!(s.doc().unwrap().history.undo.len(), undo + 2, "one undo step each"); } /// Slides imported from an outline join the section of the slide they follow, like `slide.new`. From 5503791117895ea48cbadeb04f3a68e489bff6e7 Mon Sep 17 00:00:00 2001 From: Josias Eli Rodriguez <339499413+chamber074@users.noreply.github.com> Date: Sat, 21 Nov 2026 18:57:31 +0000 Subject: [PATCH 066/326] fix(engine): keep a tags part per owner when reusing slides (#2279) slide.reuse copied every source media item through add_media, which shares identical bytes. Tags parts (think-cell or OLE custDataLst) with the same tag list on a master and its layouts collapsed into one media item, so the saved PPTX had one tags part referenced by several owners and PowerPoint asked to repair it. copy_media now gives a tags part a fresh item under a new id, as it already does for linked media. Every other item keeps the byte dedupe. --- crates/engine/src/cmd/reuse.rs | 96 +++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/reuse.rs b/crates/engine/src/cmd/reuse.rs index c85d5dc0f..22190d4a7 100644 --- a/crates/engine/src/cmd/reuse.rs +++ b/crates/engine/src/cmd/reuse.rs @@ -501,15 +501,19 @@ pub(crate) fn import_master( Ok(m) } +/// The content type of a tags part (`p:custDataLst`/`p:tags`), which belongs to exactly one owner. +const TAGS_CONTENT_TYPE: &str = "application/vnd.openxmlformats-officedocument.presentationml.tags+xml"; + /// Copy the source media `used` into `doc` under fresh ids, once each (identical bytes already in -/// `doc` are shared; a linked item keeps its link). +/// `doc` are shared; a linked item keeps its link). A tags part is never shared: identical tag lists +/// on a master and its layouts must stay one part per owner, or PowerPoint repairs the file. fn copy_media(cmd: &str, doc: &mut Presentation, src: &Presentation, used: &[MediaId], map: &mut HashMap) -> Result<()> { for &id in used { if map.contains_key(&id) { continue; } let Some(m) = src.media(id) else { continue }; - let new = if m.link.is_some() { + let new = if m.link.is_some() || m.content_type.eq_ignore_ascii_case(TAGS_CONTENT_TYPE) { let mut item = m.clone(); item.id = MediaId(doc.alloc_id().ok_or_else(|| bad(cmd, NO_ID_SPACE))?); let new = item.id; @@ -792,6 +796,94 @@ mod tests { assert_eq!(got, want, "every reference resolves to its own copied bytes"); } + /// A tags part belongs to one owner. Identical tag lists on a master and its layouts (a + /// think-cell or OLE object on each) come over as one item per owner, never one shared item, + /// so the saved file has a part for each and PowerPoint opens it without a repair. + #[test] + fn reused_master_keeps_a_tags_part_per_owner() { + const TAGS: &str = "application/vnd.openxmlformats-officedocument.presentationml.tags+xml"; + const TAGS_REL: &str = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/tags"; + let tags = br#""#.to_vec(); + let mut src = defaults::new_presentation(None); + let ids: Vec = (0..3) + .map(|_| { + let id = MediaId(src.alloc_id().expect("id")); + src.media.push(deckcraft_model::MediaItem { + id, + name: "tag1.xml".into(), + content_type: TAGS.into(), + data: Arc::new(tags.clone()), + link: None, + }); + id + }) + .collect(); + let object = |id: MediaId| { + Shape { + id: ShapeId(9100), + kind: ShapeKind::Opaque { + xml: r#""#.into(), + preview: None, + label: "think-cell".into(), + parts: vec![("rId2".into(), TAGS_REL.into(), id)], + }, + ..Default::default() + } + }; + let master = src.masters.first_mut().map(Arc::make_mut).expect("master"); + assert!(master.layouts.len() >= 2, "the default master has layouts to share the tags"); + master.shapes = vec![object(ids[0])]; + for (layout, id) in master.layouts.iter_mut().zip(&ids[1..]) { + layout.shapes = vec![object(*id)]; + } + let bytes = deckcraft_format::save(&src).expect("save"); + + let mut s = Session::with_new(); + let own = s.edit(|doc, _| Ok(doc.add_media("tag1.xml", TAGS, tags.clone()).expect("media"))).expect("own tags"); + s.execute( + "slide.reuse", + &json!({"data": super::super::base64_encode(&bytes), "name": "src.deckcraft", "slides": [0], "keepFormatting": true}), + ) + .expect("reuse"); + let doc = &s.doc().expect("doc").doc; + let imported = doc.masters.last().expect("imported master"); + let parts = |shapes: &[Shape]| -> Vec { + shapes + .iter() + .filter_map(|sh| match &sh.kind { + ShapeKind::Opaque { parts, .. } => Some(parts.iter().map(|(_, _, m)| *m)), + _ => None, + }) + .flatten() + .collect() + }; + let mut got = parts(&imported.shapes); + for layout in imported.layouts.iter().take(2) { + got.extend(parts(&layout.shapes)); + } + assert_eq!(got.len(), 3, "the master and two layouts each hold their object"); + for m in &got { + let item = doc.media(*m).expect("copied tags item"); + assert_eq!((item.content_type.as_str(), item.data.as_slice()), (TAGS, tags.as_slice()), "each copy keeps the tag list"); + assert_ne!(*m, own, "a copied tags part is not shared with the destination's own"); + } + let mut distinct = got.clone(); + distinct.sort_by_key(|m| m.0); + distinct.dedup(); + assert_eq!(distinct.len(), got.len(), "each owner has its own tags item: {got:?}"); + + let pptx = deckcraft_pptx::export(doc).expect("export"); + let mut z = zip::ZipArchive::new(std::io::Cursor::new(&pptx)).expect("zip"); + let mut written = 0; + for i in 0..z.len() { + let mut f = z.by_index(i).expect("entry"); + let mut body = Vec::new(); + std::io::Read::read_to_end(&mut f, &mut body).expect("read"); + written += usize::from(body == tags); + } + assert!(written >= 3, "the saved file has a tags part per owner, found {written}"); + } + fn link_to(slide: SlideId) -> Hyperlink { Hyperlink { action: Action::Slide { slide }, From 25dc8b9dcfeb7ca211d4c5e490245f6b09408245 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 21 Nov 2026 22:30:26 -0800 Subject: [PATCH 067/326] Format: OK with the Font dialog's Color untouched keeps the stored color The Font dialog's OK sent the `color` it was opened with back to `format.fontDialog`. For a preset or system name that `color_value` does not know, that color is the RGB it is drawn with, so OK replaced the name even when only another field changed. A color with more than 256 transforms made OK fail with "invalid `color`", so the other edits were not applied either. OK now sends no `color` when the Color field is untouched, and the text keeps its color reference as stored. An edited Color field is sent as before. Tests: a UI test opens the dialog on an unknown preset with 257 transforms and on an unknown system color, ticks Bold and presses OK; an engine test sends the dialog's fields without `color` and checks that the stored color, size and bold are kept. --- crates/engine/src/cmd/format.rs | 20 +++++++--- crates/engine/src/cmd/format/font.rs | 3 +- crates/ui-egui/src/dialogs/font.rs | 8 +--- .../ui-egui/src/dialogs/font_dialog_tests.rs | 37 +++++++++++++++++++ 4 files changed, 55 insertions(+), 13 deletions(-) diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index 7cee895ee..b00da2f89 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -431,20 +431,28 @@ mod tests { } #[test] - fn font_dialog_ok_accepts_preset_and_system_names_it_does_not_know() { + fn font_dialog_ok_without_color_keeps_colors_a_command_cannot_give() { use deckcraft_color::Rgba; let last = Rgba::rgb(0x12, 0x34, 0x56); let preset = ColorRef { base: ColorBase::Preset { name: "notAColor".into() }, mods: vec![] }.with(ColorTransform::LumMod(50_000)); let system = ColorRef { base: ColorBase::System { name: "notAColor".into(), last }, mods: vec![] }; - for (color, drawn) in [(preset, ColorRef::rgb(Rgba::BLACK).with(ColorTransform::LumMod(50_000))), (system, ColorRef::rgb(last))] { + // More transforms than a command's `mods` list may carry, as an opened file can hold. + let many = ColorRef { base: ColorBase::Preset { name: "red".into() }, mods: vec![ColorTransform::Inv; crate::cmd::MAX_COLOR_MODS + 1] }; + for color in [preset, system, many] { let mut s = shape(); - let fill = Fill::Solid { color }; + let fill = Fill::Solid { color: color.clone() }; format_run(&mut s, &|r| r.fill = Some(fill.clone())).unwrap(); s.ui_requests.clear(); s.execute("format.fontDialog", &json!({})).unwrap(); - let Some(UiRequest::Dialog { params, .. }) = s.ui_requests.last().cloned() else { panic!("dialog request") }; - s.execute("format.fontDialog", &json!({"color": params["color"], "size": 20.0})).unwrap(); - assert_eq!(props(&s).fill, Some(Fill::Solid { color: drawn }), "{}", params["color"]); + let Some(UiRequest::Dialog { mut params, .. }) = s.ui_requests.last().cloned() else { panic!("dialog request") }; + // OK with the Color field untouched and another field edited, as the dialog sends it. + params.as_object_mut().unwrap().remove("color"); + params["size"] = json!(20.0); + params["bold"] = json!(true); + s.execute("format.fontDialog", ¶ms).unwrap(); + let r = props(&s); + assert_eq!((r.size, r.bold), (Some(20.0), Some(true))); + assert_eq!(r.fill, Some(Fill::Solid { color })); } } diff --git a/crates/engine/src/cmd/format/font.rs b/crates/engine/src/cmd/format/font.rs index d5c604f10..13dcd5cd0 100644 --- a/crates/engine/src/cmd/format/font.rs +++ b/crates/engine/src/cmd/format/font.rs @@ -450,7 +450,8 @@ fn color_command_value(c: &deckcraft_model::ColorRef) -> Value { // `#RRGGBB`, or `#RRGGBBAA` for a color that is not opaque. let hex = |c: &deckcraft_color::Rgba| if c.a == 255 { format!("#{}", c.hex()) } else { format!("#{}{:02X}", c.hex(), c.a) }; // A preset or system name that `color_value` does not know (kept from an opened file) is given as - // the color it is drawn with, so OK does not reject it. + // the color it is drawn with, so a caller that sends this `color` back gets a valid color. The + // Font dialog sends no `color` when its Color field is untouched, so the run keeps the stored name. let base = match &c.base { ColorBase::Preset { name } if !deckcraft_color::is_preset_name(name) => ColorBase::Rgb { rgb: deckcraft_color::Rgba::BLACK }, ColorBase::System { name, last } if !deckcraft_color::is_system_name(name) => ColorBase::Rgb { rgb: *last }, diff --git a/crates/ui-egui/src/dialogs/font.rs b/crates/ui-egui/src/dialogs/font.rs index a163e7bce..994f15126 100644 --- a/crates/ui-egui/src/dialogs/font.rs +++ b/crates/ui-egui/src/dialogs/font.rs @@ -147,13 +147,9 @@ pub(super) fn font_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bo "caps": d.get("caps", "none"), "spacing": spacing, }); + // An untouched Color field sends no `color`, so the text keeps its color reference as stored. let color = d.get("color", ""); - let seed = d.get("colorSeed", ""); - if color == seed { - if let Some(c) = d.params.get("color").filter(|v| !v.is_null()) { - params["color"] = c.clone(); - } - } else if !color.trim().is_empty() { + if color != d.get("colorSeed", "") && !color.trim().is_empty() { params["color"] = json!(color.trim()); } let _ = app.run("format.fontDialog", params); diff --git a/crates/ui-egui/src/dialogs/font_dialog_tests.rs b/crates/ui-egui/src/dialogs/font_dialog_tests.rs index 60b18f02d..b342223fd 100644 --- a/crates/ui-egui/src/dialogs/font_dialog_tests.rs +++ b/crates/ui-egui/src/dialogs/font_dialog_tests.rs @@ -87,6 +87,43 @@ fn preset_and_system_colors_show_in_the_dialog_and_ok_keeps_them() { } } +#[test] +fn ok_with_color_untouched_keeps_a_color_the_dialog_cannot_send_back() { + use deckcraft_color::{ColorTransform, Rgba}; + use deckcraft_model::{ColorBase, ColorRef, Fill}; + // Names that `color_value` does not know, as an opened file can hold, and more transforms than a + // command's `mods` list may carry. + let unknown_preset = ColorRef { base: ColorBase::Preset { name: "notAColor".into() }, mods: vec![ColorTransform::Inv; 257] }; + let unknown_system = ColorRef { base: ColorBase::System { name: "notAColor".into(), last: Rgba::rgb(0x12, 0x34, 0x56) }, mods: vec![] }; + for color in [unknown_preset, unknown_system] { + let mut h = harness(); + set_fill(&mut h, Fill::Solid { color }); + let before = fill_of(&h); + h.get_by_label("Font…").click(); + h.run_steps(2); + assert_eq!(h.state().dialog.as_ref().map(|d| d.id.as_str()), Some("font")); + h.get_by_label("Bold").click_accesskit(); + h.run_steps(1); + h.get_by_label("OK").click_accesskit(); + h.run_steps(1); + assert!(h.state().dialog.is_none(), "status {:?}", h.state().status); + assert_eq!(bold_of(&h), Some(true), "status {:?}", h.state().status); + assert_eq!(fill_of(&h), before); + } +} + +/// Sets the first run's fill directly, so the test can hold a color that a command would reject. +fn set_fill(h: &mut Harness<'_, SlideApp>, fill: deckcraft_model::Fill) { + let st = h.state_mut().session.active_mut().unwrap(); + let id = st.selection.shapes[0]; + let slide = st.selection.slide; + let doc = std::sync::Arc::make_mut(&mut st.doc); + let slide = std::sync::Arc::make_mut(&mut doc.slides[slide]); + let shape = slide.shapes.iter_mut().find(|sh| sh.id == id).unwrap(); + let run = shape.text.as_mut().and_then(|t| t.paragraphs.first_mut()).and_then(|p| p.runs.first_mut()).unwrap(); + run.props.fill = Some(fill); +} + fn fill_of(h: &Harness<'_, SlideApp>) -> Option { let st = h.state().session.active().unwrap(); st.selected_shapes() From 2ee3785c5ec231c74ea15313be6722d04d91d63e Mon Sep 17 00:00:00 2001 From: cloutier <1014864+cloutier@users.noreply.github.com> Date: Wed, 25 Nov 2026 08:55:18 -0500 Subject: [PATCH 068/326] Review: report missing alt text on inserted icons --- crates/engine/src/cmd/insert.rs | 2 ++ crates/engine/src/cmd/review.rs | 2 +- crates/engine/src/icons.rs | 45 +++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/insert.rs b/crates/engine/src/cmd/insert.rs index 1fd6e258e..38c0f009c 100644 --- a/crates/engine/src/cmd/insert.rs +++ b/crates/engine/src/cmd/insert.rs @@ -275,6 +275,7 @@ fn insert_icon(s: &mut Session, p: &Value) -> Result { if rect.w < 1.0 || rect.h < 1.0 { return Err(bad("insert.icon", "rect needs a positive width and height")); } + let (tag, value) = crate::icons::INSERTED_ICON_TAG; let shape = Shape { name: icon.label.to_string(), xfrm: Some(rect), @@ -296,6 +297,7 @@ fn insert_icon(s: &mut Session, p: &Value) -> Result { ..Default::default() }), style: Some(ShapeStyle::line(SchemeSlot::Tx1)), + tags: vec![(tag.into(), value.into())], ..Default::default() }; let id = add_shape(s, "insert.icon", shape, true)?; diff --git a/crates/engine/src/cmd/review.rs b/crates/engine/src/cmd/review.rs index 351ca29dc..7accdc734 100644 --- a/crates/engine/src/cmd/review.rs +++ b/crates/engine/src/cmd/review.rs @@ -261,7 +261,7 @@ fn accessibility(s: &mut Session, _p: &Value) -> Result { | deckcraft_model::ShapeKind::Media(_) | deckcraft_model::ShapeKind::Group { .. } ); - if needs_alt && sh.descr.trim().is_empty() && !sh.decorative { + if sh.descr.trim().is_empty() && !sh.decorative && (needs_alt || crate::icons::is_inserted_icon(sh)) { out.push(json!({"slide": i, "shape": sh.id, "name": sh.name, "issue": "Missing alternative text"})); } }); diff --git a/crates/engine/src/icons.rs b/crates/engine/src/icons.rs index bdd462894..ea66dbf5d 100644 --- a/crates/engine/src/icons.rs +++ b/crates/engine/src/icons.rs @@ -12,6 +12,14 @@ use deckcraft_geom::{BezPath, PathEl}; /// Design size of every icon, in path units. Lucide's viewBox is `0 0 24 24`. pub const VIEW: f64 = 24.0; +/// Shape tag that preserves gallery icon identity in native and PPTX files. +pub(crate) const INSERTED_ICON_TAG: (&str, &str) = ("DECKCRAFT_INSERTED_ICON", "1"); + +pub(crate) fn is_inserted_icon(shape: &deckcraft_model::Shape) -> bool { + let (name, value) = INSERTED_ICON_TAG; + shape.tags.iter().any(|(key, tag_value)| key == name && tag_value == value) +} + /// One icon from the Insert gallery. pub struct Icon { pub name: &'static str, @@ -210,6 +218,43 @@ mod tests { assert!((width - 8.0).abs() < 0.05, "{width}"); } + #[test] + fn missing_icon_alt_text_is_reported_after_round_trips() { + let mut s = Session::with_new(); + let insert_icon = |s: &mut Session| s.execute("insert.icon", &json!({"name": "star"})).unwrap()["id"].as_u64().unwrap(); + let missing = insert_icon(&mut s); + let described = insert_icon(&mut s); + let decorative = insert_icon(&mut s); + let freeform = s.execute("shape.freeform", &json!({"points": [[0, 0], [20, 10], [5, 25]], "closed": true})).unwrap()["id"].as_u64().unwrap(); + s.execute("shape.rename", &json!({"ids": [freeform], "name": "Star"})).unwrap(); + s.execute("shape.rename", &json!({"ids": [missing], "name": "Repainted symbol"})).unwrap(); + s.execute("shape.altText", &json!({"ids": [described], "text": "Five-point outline"})).unwrap(); + s.execute("shape.altText", &json!({"ids": [decorative], "decorative": true})).unwrap(); + + let assert_alert = |s: &mut Session| { + let issues = s.execute("review.accessibility", &json!({})).unwrap(); + let shapes: Vec<_> = issues + .as_array() + .unwrap() + .iter() + .filter(|issue| issue["issue"] == "Missing alternative text") + .map(|issue| issue["shape"].as_u64().unwrap()) + .collect(); + assert_eq!(shapes, [missing], "{issues}"); + }; + assert_alert(&mut s); + + let doc = &s.doc().unwrap().doc; + let native = deckcraft_format::load(&deckcraft_format::save(doc).unwrap()).unwrap(); + let pptx = deckcraft_pptx::import(&deckcraft_pptx::export(doc).unwrap()).unwrap(); + let second_pptx = deckcraft_pptx::import(&deckcraft_pptx::export(&pptx).unwrap()).unwrap(); + for doc in [native, pptx, second_pptx] { + let mut reopened = Session::new(); + reopened.add_document(crate::DocState::new(doc, None, "Reopened deck".into())); + assert_alert(&mut reopened); + } + } + fn ink_in(img: &deckcraft_render::Image, x: f64, y: f64, w: f64, h: f64, scale: f64) -> usize { let x0 = (x * scale).floor().max(0.0) as u32; let y0 = (y * scale).floor().max(0.0) as u32; From 237718c81aeae6f5894976e18393bb8c5ceee8ac Mon Sep 17 00:00:00 2001 From: cloutier <1014864+cloutier@users.noreply.github.com> Date: Wed, 25 Nov 2026 11:20:08 -0500 Subject: [PATCH 069/326] Preserve empty PPTX presentation text styles on save (#2363) --- crates/pptx/src/lib.rs | 4 -- crates/pptx/tests/it/default_text_style.rs | 75 ++++++++++++++++++++++ crates/pptx/tests/it/main.rs | 1 + 3 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 crates/pptx/tests/it/default_text_style.rs diff --git a/crates/pptx/src/lib.rs b/crates/pptx/src/lib.rs index 941b76e66..28dd4db22 100644 --- a/crates/pptx/src/lib.rs +++ b/crates/pptx/src/lib.rs @@ -59,10 +59,6 @@ impl craft_pptx::Defaults for DeckDefaults { Default::default() } - fn default_text_style(&self) -> craft_drawingml::text::ListStyle { - convert::list_style_to_craft(&defaults::default_text_style()) - } - fn application(&self) -> &str { "DeckCraft" } diff --git a/crates/pptx/tests/it/default_text_style.rs b/crates/pptx/tests/it/default_text_style.rs new file mode 100644 index 000000000..add9a43d9 --- /dev/null +++ b/crates/pptx/tests/it/default_text_style.rs @@ -0,0 +1,75 @@ +//! Presentation text defaults across PPTX import, export and reopen. + +use std::io::{Cursor, Read, Write}; + +use craft_xml::Local; +use deckcraft_model::{Presentation, defaults}; + +const PRESENTATION: &str = "ppt/presentation.xml"; + +fn imported_with_style(style_xml: &str) -> Presentation { + let base = deckcraft_pptx::export(&defaults::new_presentation(None)).expect("author fixture"); + let mut original = zip::ZipArchive::new(Cursor::new(base)).expect("open fixture package"); + let mut fixture = zip::ZipWriter::new(Cursor::new(Vec::new())); + for i in 0..original.len() { + let mut part = original.by_index(i).expect("package part"); + fixture.start_file(part.name(), zip::write::SimpleFileOptions::default()).expect("write package part"); + if part.name() == PRESENTATION { + let mut xml = String::new(); + part.read_to_string(&mut xml).expect("author fixture presentation XML"); + let start = xml.find("").expect("new decks have a populated style"); + let end_tag = ""; + let end = xml.find(end_tag).expect("end of presentation text style") + end_tag.len(); + xml.replace_range(start..end, style_xml); + fixture.write_all(xml.as_bytes()).expect("write fixture presentation XML"); + } else { + std::io::copy(&mut part, &mut fixture).expect("copy fixture part"); + } + } + let bytes = fixture.finish().expect("finish fixture package").into_inner(); + deckcraft_pptx::import(&bytes).expect("import authored fixture") +} + +fn assert_empty_after_two_saves(mut presentation: Presentation) { + assert!(presentation.default_text_style.is_empty(), "the imported style begins empty"); + for save in 1..=2 { + let bytes = deckcraft_pptx::export(&presentation).expect("save PPTX"); + let mut package = zip::ZipArchive::new(Cursor::new(&bytes)).expect("open saved package"); + let mut xml = Vec::new(); + package.by_name(PRESENTATION).expect("presentation part").read_to_end(&mut xml).expect("read presentation XML"); + let document = craft_drawingml::xmlx::parse(&xml).expect("parse saved presentation XML"); + assert!( + document.child(Local("defaultTextStyle")).is_none_or(|style| style.elements().next().is_none()), + "save {save} must not add inherited text formatting to an empty presentation style" + ); + presentation = deckcraft_pptx::import(&bytes).expect("reopen PPTX"); + assert!(presentation.default_text_style.is_empty(), "reopen {save} must retain the empty style"); + } +} + +#[test] +fn an_absent_presentation_text_style_stays_empty_after_two_saves() { + assert_empty_after_two_saves(imported_with_style("")); +} + +#[test] +fn an_empty_presentation_text_style_stays_empty_after_two_saves() { + assert_empty_after_two_saves(imported_with_style("")); +} + +#[test] +fn authored_presentation_text_styles_survive_two_saves() { + let imported = imported_with_style(r#""#); + assert_eq!(imported.default_text_style.level(0).expect("explicit level").run.kern, Some(88.0)); + let new_deck = defaults::new_presentation(None); + assert!(!new_deck.default_text_style.is_empty()); + + for mut presentation in [imported, new_deck] { + let expected = presentation.default_text_style.clone(); + for _ in 0..2 { + let bytes = deckcraft_pptx::export(&presentation).expect("save authored style"); + presentation = deckcraft_pptx::import(&bytes).expect("reopen authored style"); + assert_eq!(presentation.default_text_style, expected); + } + } +} diff --git a/crates/pptx/tests/it/main.rs b/crates/pptx/tests/it/main.rs index 6c136a37d..4d279a775 100644 --- a/crates/pptx/tests/it/main.rs +++ b/crates/pptx/tests/it/main.rs @@ -9,6 +9,7 @@ mod corpus_kinds; mod corpus_media; mod corpus_style; mod corpus_themes; +mod default_text_style; mod export_scale; mod fills; mod kept_parts; From a31d74c53fbd5cc93847032e57c4e5fdbdc31347 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 26 Nov 2026 01:44:49 +0000 Subject: [PATCH 070/326] Select every workspace package for cl's app mode --- Cargo.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index c089e8ecc..28cb93dfc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -139,3 +139,8 @@ eframe = { git = "https://github.com/storytold/egui.git", rev = "6d518fc79968157 egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" } + +[workspace.metadata.cl] +selection = ["deckcraft", "deckcraft-anim", "deckcraft-cli", "deckcraft-color", "deckcraft-engine", "deckcraft-format", "deckcraft-geom", "deckcraft-mcp", "deckcraft-model", "deckcraft-pdf", "deckcraft-ppt", "deckcraft-pptx", "deckcraft-render", "deckcraft-text", "deckcraft-ui-egui", "deckcraft-web"] +tracked = ["egui", "eframe", "craft-ui", "craft-pptx", "craft-drawingml"] +unset_env = ["DECKCRAFT_BUILD_CHANNEL", "DECKCRAFT_VERSION", "DECKCRAFT_REQUIRE_WINRES", "CRAFT_FONTS_REQUIRED"] From 0750909b148b71543c1735ef2990a17f8ba46f57 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 26 Nov 2026 02:12:37 +0000 Subject: [PATCH 071/326] Pin craft-libs main at 0b8bbaf4 and egui at b9770908 craft-update's egui feature is named ui on main; rustix moves to 1.1.6 for craft-atomic. --- Cargo.lock | 1497 ++++++++++++++++++++++++++++++--- Cargo.toml | 62 +- apps/deckcraft-web/Cargo.toml | 4 +- 3 files changed, 1428 insertions(+), 135 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dd197290f..23f5d3bdd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,6 +129,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + [[package]] name = "aligned" version = "0.4.3" @@ -209,6 +218,22 @@ dependencies = [ "libc", ] +[[package]] +name = "annotate-snippets" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710e8eae58854cdc1790fcb56cca04d712a17be849eeb81da2a724bf4bae2bc4" +dependencies = [ + "anstyle", + "unicode-width", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + [[package]] name = "anyhow" version = "1.0.104" @@ -240,7 +265,7 @@ dependencies = [ "objc2-foundation 0.3.2", "parking_lot", "percent-encoding", - "windows-sys 0.52.0", + "windows-sys 0.59.0", "wl-clipboard-rs", "x11rb", ] @@ -267,6 +292,9 @@ name = "arrayvec" version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" +dependencies = [ + "serde", +] [[package]] name = "as-raw-xcb-connection" @@ -343,7 +371,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix 1.1.5", + "rustix 1.1.6", "slab", "windows-sys 0.61.2", ] @@ -374,7 +402,7 @@ dependencies = [ "cfg-if", "event-listener", "futures-lite", - "rustix 1.1.5", + "rustix 1.1.6", ] [[package]] @@ -400,7 +428,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 1.1.5", + "rustix 1.1.6", "signal-hook-registry", "slab", "windows-sys 0.61.2", @@ -501,7 +529,7 @@ dependencies = [ "anyhow", "arrayvec", "log", - "nom", + "nom 8.0.0", "num-rational", "v_frame", ] @@ -518,6 +546,25 @@ version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" +[[package]] +name = "bindgen" +version = "0.72.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" +dependencies = [ + "annotate-snippets", + "bitflags 2.13.2", + "cexpr", + "clang-sys", + "itertools 0.13.0", + "proc-macro2", + "quote", + "regex", + "rustc-hash 2.1.3", + "shlex 1.3.0", + "syn 2.0.119", +] + [[package]] name = "bit-set" version = "0.10.0" @@ -554,6 +601,12 @@ dependencies = [ "no_std_io2", ] +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + [[package]] name = "block-buffer" version = "0.10.4" @@ -638,6 +691,16 @@ version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" +[[package]] +name = "calendrical_calculations" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5abbd6eeda6885048d357edc66748eea6e0268e3dd11f326fff5bd248d779c26" +dependencies = [ + "core_maths", + "displaydoc", +] + [[package]] name = "calloop" version = "0.13.0" @@ -660,7 +723,7 @@ checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" dependencies = [ "bitflags 2.13.2", "polling", - "rustix 1.1.5", + "rustix 1.1.6", "tracing", ] @@ -683,7 +746,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" dependencies = [ "calloop 0.14.5", - "rustix 1.1.5", + "rustix 1.1.6", "wayland-backend", "wayland-client", ] @@ -703,7 +766,7 @@ dependencies = [ "find-msvc-tools", "jobserver", "libc", - "shlex", + "shlex 2.0.1", ] [[package]] @@ -712,6 +775,25 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom 7.1.3", +] + +[[package]] +name = "cfg-expr" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd44d82755fb9210fb10d9daf8dd7e522da0efe1d5f263cffc5db07725663ff" +dependencies = [ + "smallvec", + "target-lexicon", +] + [[package]] name = "cfg-if" version = "1.0.5" @@ -733,6 +815,17 @@ dependencies = [ "libc", ] +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core 0.10.1", +] + [[package]] name = "chrono" version = "0.4.45" @@ -740,10 +833,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" dependencies = [ "iana-time-zone", + "js-sys", "num-traits", + "wasm-bindgen", "windows-link", ] +[[package]] +name = "clang-sys" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clipboard-win" version = "5.4.1" @@ -817,6 +923,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "cookie-factory" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9885fa71e26b8ab7855e2ec7cae6e9b380edff76cd052e07c683a0319d51b3a2" + [[package]] name = "core-foundation" version = "0.9.4" @@ -867,6 +979,19 @@ dependencies = [ "libc", ] +[[package]] +name = "core-graphics2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b65858d95344d2711161cd92196732f67d6c5fea238cf12f994584828731a5c" +dependencies = [ + "bitflags 2.13.2", + "block", + "cfg-if", + "core-foundation 0.10.1", + "libc", +] + [[package]] name = "core_detect" version = "1.0.0" @@ -931,64 +1056,152 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "craft-appkit" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "block2 0.6.2", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "craft-atomic" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "rustix 1.1.6", +] + [[package]] name = "craft-audio" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=010702ee9b030844c852939095b1da0d0656a890#010702ee9b030844c852939095b1da0d0656a890" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-media", "thiserror 2.0.21", ] +[[package]] +name = "craft-behavior" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "accesskit", + "bitflags 2.13.2", + "craft-host", + "craft-keymap", + "craft-theme", + "craft-tracked", + "craft-ui-macros", + "emath", + "kurbo", + "serde", + "smallvec", +] + [[package]] name = "craft-cfb" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=8048f8ef92da80fb3ce5a056d59ca591ee66faf1#8048f8ef92da80fb3ce5a056d59ca591ee66faf1" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" + +[[package]] +name = "craft-cloud-ui" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "egui", +] [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=254e9a409b410dc93c0e06ff66cd1e767893ac32#254e9a409b410dc93c0e06ff66cd1e767893ac32" - -[[package]] -name = "craft-codepage" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d0193d7e94b5ec180ecc2a152ea72047d39ac632#d0193d7e94b5ec180ecc2a152ea72047d39ac632" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" [[package]] name = "craft-deckcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=254e9a409b410dc93c0e06ff66cd1e767893ac32#254e9a409b410dc93c0e06ff66cd1e767893ac32" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ - "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=254e9a409b410dc93c0e06ff66cd1e767893ac32)", + "craft-zip", "serde", "serde_json", "thiserror 2.0.21", "zip 9.1.0", ] +[[package]] +name = "craft-docpath" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "serde", +] + [[package]] name = "craft-drawingml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=8048f8ef92da80fb3ce5a056d59ca591ee66faf1#8048f8ef92da80fb3ce5a056d59ca591ee66faf1" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ + "chrono", "craft-xml", "kurbo", "log", "serde", ] +[[package]] +name = "craft-font-catalog" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "harfrust 0.13.3", + "kurbo", + "skrifa 0.47.0", + "thiserror 2.0.21", + "unicode-bidi", + "unicode-segmentation", + "windows-registry", +] + [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=63196e66f3033a6623eb629af95a104d26986725#63196e66f3033a6623eb629af95a104d26986725" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" + +[[package]] +name = "craft-host" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "bitflags 2.13.2", + "craft-i18n", + "egui", + "serde", + "toml", + "web-time", +] [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=63196e66f3033a6623eb629af95a104d26986725#63196e66f3033a6623eb629af95a104d26986725" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ + "chrono", "fixed_decimal", + "icu_calendar", + "icu_collator", + "icu_datetime", "icu_decimal", "icu_locale_core", "icu_locale_fallback", @@ -998,6 +1211,7 @@ dependencies = [ "icu_provider", "icu_provider_adapters", "icu_provider_blob", + "icu_time", "log", "objc2-foundation 0.3.2", "sys-locale", @@ -1006,10 +1220,25 @@ dependencies = [ "writeable", ] +[[package]] +name = "craft-keymap" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "craft-host", + "craft-i18n", + "craft-tracked", + "craft-ui-macros", + "craft-xml", + "egui", + "serde", + "serde_json", +] + [[package]] name = "craft-mcp-server" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=bc186ca719958fcce3b6ee24794277eabed14609#bc186ca719958fcce3b6ee24794277eabed14609" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "serde_json", ] @@ -1017,7 +1246,7 @@ dependencies = [ [[package]] name = "craft-media" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=010702ee9b030844c852939095b1da0d0656a890#010702ee9b030844c852939095b1da0d0656a890" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "thiserror 2.0.21", ] @@ -1025,7 +1254,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f428c3d36e0faf3924b76956a01334c051543527#f428c3d36e0faf3924b76956a01334c051543527" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "encoding_rs", "image", @@ -1036,20 +1265,20 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=254e9a409b410dc93c0e06ff66cd1e767893ac32#254e9a409b410dc93c0e06ff66cd1e767893ac32" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "chrono", - "craft-codepage 0.1.0 (git+https://github.com/storytold/craft-libs?rev=254e9a409b410dc93c0e06ff66cd1e767893ac32)", + "craft-codepage", "encoding_rs", ] [[package]] name = "craft-opc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=8048f8ef92da80fb3ce5a056d59ca591ee66faf1#8048f8ef92da80fb3ce5a056d59ca591ee66faf1" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-xml", - "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8048f8ef92da80fb3ce5a056d59ca591ee66faf1)", + "craft-zip", "log", "thiserror 2.0.21", ] @@ -1057,16 +1286,48 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=63196e66f3033a6623eb629af95a104d26986725#63196e66f3033a6623eb629af95a104d26986725" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "krilla", + "serde", "thiserror 2.0.21", ] +[[package]] +name = "craft-platform" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "async-channel", + "async-io", + "async-process", + "core-graphics2", + "craft-atomic", + "craft-docpath", + "craft-host", + "craft-i18n", + "craft-theme", + "futures-lite", + "js-sys", + "log", + "objc2-app-kit 0.3.2", + "rfd", + "serde", + "serde_json", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "web-time", + "windows 0.62.2", + "x11rb", + "xcap", + "zbus", +] + [[package]] name = "craft-pptx" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=8048f8ef92da80fb3ce5a056d59ca591ee66faf1#8048f8ef92da80fb3ce5a056d59ca591ee66faf1" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-drawingml", "craft-opc", @@ -1078,49 +1339,254 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-quit" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "dispatch2", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "craft-rtf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d0193d7e94b5ec180ecc2a152ea72047d39ac632#d0193d7e94b5ec180ecc2a152ea72047d39ac632" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ - "craft-codepage 0.1.0 (git+https://github.com/storytold/craft-libs?rev=d0193d7e94b5ec180ecc2a152ea72047d39ac632)", + "craft-codepage", "encoding_rs", ] +[[package]] +name = "craft-settings" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "craft-atomic", + "craft-host", + "dirs", + "log", + "serde", + "serde_json", + "toml", + "toml_edit", + "web-sys", + "web-time", +] + +[[package]] +name = "craft-svg" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "craft-xml", + "flate2", + "kurbo", + "quick-xml 0.41.0", + "resvg", + "roxmltree", + "thiserror 2.0.21", + "usvg", + "vectorcraft-geom", + "vectorcraft-pathops", +] + +[[package]] +name = "craft-theme" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "bitflags 2.13.2", + "craft-tracked", + "craft-ui-macros", + "ecolor", + "log", + "serde", + "serde_json", + "smallvec", +] + +[[package]] +name = "craft-tracked" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" + [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=63196e66f3033a6623eb629af95a104d26986725#63196e66f3033a6623eb629af95a104d26986725" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ - "craft-fonts-build", + "craft-cloud-ui", + "craft-ui-canvas", + "craft-ui-contract", + "craft-ui-panels", + "craft-ui-patterns", + "craft-ui-shell", + "craft-ui-widgets", +] + +[[package]] +name = "craft-ui-canvas" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "craft-behavior", "craft-i18n", + "craft-keymap", + "craft-theme", + "craft-ui-macros", + "craft-ui-panels", "egui", - "epaint", - "js-sys", + "serde", + "serde_json", +] + +[[package]] +name = "craft-ui-contract" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "accesskit", + "craft-behavior", + "craft-codepage", + "craft-font-catalog", + "craft-fonts-build", + "craft-host", + "craft-i18n", + "craft-keymap", + "craft-platform", + "craft-quit", + "craft-settings", + "craft-svg", + "craft-theme", + "craft-tracked", + "craft-ui-macros", + "craft-window", + "egui", + "epaint_default_fonts", + "flate2", + "inventory", "log", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-foundation 0.3.2", + "scoped-tls", + "serde", + "serde_json", + "siphasher", "skrifa 0.44.0", - "wasm-bindgen", + "smallvec", + "toml", + "typeid", "wasm-bindgen-futures", - "web-sys", + "web-time", +] + +[[package]] +name = "craft-ui-macros" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "craft-ui-panels" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "craft-behavior", + "craft-host", + "craft-i18n", + "craft-keymap", + "craft-quit", + "craft-theme", + "craft-ui-macros", + "craft-ui-widgets", + "egui", + "serde", + "serde_json", +] + +[[package]] +name = "craft-ui-patterns" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "craft-behavior", + "craft-host", + "craft-i18n", + "craft-keymap", + "craft-pdf", + "craft-theme", + "craft-ui-macros", + "craft-ui-panels", + "egui", + "serde", + "serde_json", + "toml", + "toml_edit", + "zeroize", +] + +[[package]] +name = "craft-ui-shell" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "craft-behavior", + "craft-host", + "craft-i18n", + "craft-platform", + "craft-svg", + "craft-theme", + "craft-ui-macros", + "craft-ui-panels", + "craft-window", + "egui", + "raw-window-handle", + "serde", + "web-time", +] + +[[package]] +name = "craft-ui-widgets" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "craft-behavior", + "craft-host", + "craft-i18n", + "craft-keymap", + "craft-svg", + "craft-theme", + "craft-ui-contract", + "craft-ui-macros", + "egui", + "log", + "serde", + "smallvec", ] [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=63196e66f3033a6623eb629af95a104d26986725#63196e66f3033a6623eb629af95a104d26986725" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "chrono", + "craft-host", + "craft-theme", + "craft-ui", "dunce", "egui", "flate2", - "getrandom 0.3.4", "image", "log", "plist", - "rustix 1.1.5", + "rustix 1.1.6", "semver", "serde", "serde_json", @@ -1137,7 +1603,7 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=010702ee9b030844c852939095b1da0d0656a890#010702ee9b030844c852939095b1da0d0656a890" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-media", "rav1e", @@ -1148,7 +1614,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=fd5e2feff6ea25bed371a99cc732b3968d621505#fd5e2feff6ea25bed371a99cc732b3968d621505" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "js-sys", "serde_json", @@ -1159,16 +1625,51 @@ dependencies = [ [[package]] name = "craft-web-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=fd5e2feff6ea25bed371a99cc732b3968d621505#fd5e2feff6ea25bed371a99cc732b3968d621505" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ + "craft-host", + "craft-platform", "wasm-bindgen", + "wasm-bindgen-futures", "web-sys", ] +[[package]] +name = "craft-win32" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "winsafe", +] + +[[package]] +name = "craft-window" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" +dependencies = [ + "craft-appkit", + "craft-atomic", + "craft-behavior", + "craft-host", + "craft-settings", + "craft-win32", + "egui", + "muda", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "raw-window-handle", + "serde", + "serde_json", + "wayland-client", + "winsafe", + "x11rb", +] + [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=8048f8ef92da80fb3ce5a056d59ca591ee66faf1#8048f8ef92da80fb3ce5a056d59ca591ee66faf1" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "quick-xml 0.41.0", "serde", @@ -1178,17 +1679,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=254e9a409b410dc93c0e06ff66cd1e767893ac32#254e9a409b410dc93c0e06ff66cd1e767893ac32" -dependencies = [ - "flate2", - "thiserror 2.0.21", - "zip 9.1.0", -] - -[[package]] -name = "craft-zip" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=8048f8ef92da80fb3ce5a056d59ca591ee66faf1#8048f8ef92da80fb3ce5a056d59ca591ee66faf1" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "flate2", "thiserror 2.0.21", @@ -1266,6 +1757,12 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" +[[package]] +name = "data-url" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" + [[package]] name = "deckcraft" version = "0.19.0" @@ -1584,6 +2081,27 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "dirs" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.59.0", +] + [[package]] name = "dispatch" version = "0.2.0" @@ -1643,6 +2161,61 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" +[[package]] +name = "drm" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80bc8c5c6c2941f70a55c15f8d9f00f9710ebda3ffda98075f996a0e6c92756f" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "drm-ffi", + "drm-fourcc", + "libc", + "rustix 0.38.44", +] + +[[package]] +name = "drm" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a41816e58f47f49acfd956651055ddcf137c4882c2098c30c448817af21183a" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "bytemuck_derive", + "drm-ffi", + "drm-fourcc", + "libc", + "rustix 1.1.6", +] + +[[package]] +name = "drm-ffi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51a91c9b32ac4e8105dec255e849e0d66e27d7c34d184364fb93e469db08f690" +dependencies = [ + "drm-sys", + "rustix 1.1.6", +] + +[[package]] +name = "drm-fourcc" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aafbcdb8afc29c1a7ee5fbe53b5d62f4565b35a042a662ca9fecd0b54dae6f4" + +[[package]] +name = "drm-sys" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8e1361066d91f5ffccff060a3c3be9c3ecde15be2959c1937595f7a82a9f8" +dependencies = [ + "libc", + "linux-raw-sys 0.9.4", +] + [[package]] name = "dunce" version = "1.0.5" @@ -1652,7 +2225,7 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "ecolor" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "bytemuck", "emath", @@ -1661,7 +2234,7 @@ dependencies = [ [[package]] name = "eframe" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "ahash", "bytemuck", @@ -1696,7 +2269,7 @@ dependencies = [ [[package]] name = "egui" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "accesskit", "ahash", @@ -1715,7 +2288,7 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "ahash", "bytemuck", @@ -1734,7 +2307,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "accesskit_winit", "arboard", @@ -1760,7 +2333,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "ahash", "egui", @@ -1773,7 +2346,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "bytemuck", "egui", @@ -1786,7 +2359,7 @@ dependencies = [ [[package]] name = "egui_kittest" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "dify", "eframe", @@ -1812,11 +2385,23 @@ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] name = "emath" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "bytemuck", ] +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + [[package]] name = "encoding_rs" version = "0.8.42" @@ -1881,7 +2466,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "ahash", "bytemuck", @@ -1907,7 +2492,7 @@ dependencies = [ [[package]] name = "epaint_default_fonts" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" [[package]] name = "equator" @@ -1942,7 +2527,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2198,6 +2783,30 @@ dependencies = [ "slab", ] +[[package]] +name = "gbm" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce852e998d3ca5e4a97014fb31c940dc5ef344ec7d364984525fd11e8a547e6a" +dependencies = [ + "bitflags 2.13.2", + "drm 0.14.1", + "drm-fourcc", + "gbm-sys", + "libc", + "wayland-backend", + "wayland-server", +] + +[[package]] +name = "gbm-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13a5f2acc785d8fb6bf6b7ab6bfb0ef5dad4f4d97e8e70bb8e470722312f76f" +dependencies = [ + "libc", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -2214,7 +2823,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" dependencies = [ - "rustix 1.1.5", + "rustix 1.1.6", "windows-link", ] @@ -2260,6 +2869,7 @@ dependencies = [ "js-sys", "libc", "r-efi 6.0.0", + "rand_core 0.10.1", "wasm-bindgen", ] @@ -2273,6 +2883,15 @@ dependencies = [ "weezl", ] +[[package]] +name = "gl" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a94edab108827d67608095e269cf862e60d920f144a5026d3dbcfd8b877fb404" +dependencies = [ + "gl_generator", +] + [[package]] name = "gl_generator" version = "0.14.0" @@ -2301,6 +2920,12 @@ dependencies = [ "vello_common", ] +[[package]] +name = "glob" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" + [[package]] name = "glow" version = "0.17.0" @@ -2502,6 +3127,12 @@ dependencies = [ "zune-jpeg", ] +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.5.3" @@ -2596,6 +3227,39 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_calendar" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58655df2f728e46e4eee80bddebefacf52ec3e77cdb925014b47c5a5905eb55c" +dependencies = [ + "calendrical_calculations", + "displaydoc", + "icu_locale_core", + "icu_provider", + "serde", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_collator" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08984ed58ac439ebf3e13d2cf26b0c46a60afcd21721c1d14087c0b240344dda" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_normalizer", + "icu_properties", + "icu_provider", + "serde", + "smallvec", + "utf16_iter", + "utf8_iter", + "zerovec", +] + [[package]] name = "icu_collections" version = "2.3.0" @@ -2604,12 +3268,37 @@ checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" dependencies = [ "displaydoc", "potential_utf", + "serde", "utf8_iter", "yoke", "zerofrom", "zerovec", ] +[[package]] +name = "icu_datetime" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c44df99c4c5297b05653d1a1629f13bdc9fd4044acfbbaf30b15194a1eed4cd6" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_calendar", + "icu_decimal", + "icu_locale_core", + "icu_pattern", + "icu_plurals", + "icu_provider", + "icu_time", + "potential_utf", + "serde", + "smallvec", + "tinystr", + "writeable", + "zerotrie", + "zerovec", +] + [[package]] name = "icu_decimal" version = "2.3.0" @@ -2671,6 +3360,7 @@ dependencies = [ "icu_normalizer_data", "icu_properties", "icu_provider", + "serde", "smallvec", "utf16_iter", "utf8_iter", @@ -2721,6 +3411,7 @@ dependencies = [ "icu_locale_core", "icu_properties_data", "icu_provider", + "serde", "zerotrie", "zerovec", ] @@ -2773,6 +3464,22 @@ dependencies = [ "zerovec", ] +[[package]] +name = "icu_time" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af37e1c3b9f3ab564b619fdf4b22de169f6381eb0f7048e3ca454290c438126b" +dependencies = [ + "calendrical_calculations", + "displaydoc", + "icu_calendar", + "icu_locale_core", + "icu_provider", + "serde", + "zerotrie", + "zerovec", +] + [[package]] name = "idna" version = "1.1.0" @@ -2829,6 +3536,12 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09e54e57b4c48b40f7aec75635392b12b3421fa26fe8b4332e63138ed278459c" +[[package]] +name = "imagesize" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65b27460c2c92b037f3f94c538ed9a3342f3fdf923606781629ccb35f82d042a" + [[package]] name = "indexmap" version = "2.14.2" @@ -2850,6 +3563,15 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "inventory" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6928282826c822ad91bf1c9a1cb90a30ba1c26770749929b4656cd6be829cd7c" +dependencies = [ + "rustversion", +] + [[package]] name = "is-docker" version = "0.2.0" @@ -2869,6 +3591,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.14.0" @@ -2988,6 +3719,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "keyboard-types" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d" +dependencies = [ + "bitflags 2.13.2", + "serde", +] + [[package]] name = "khronos-egl" version = "6.0.0" @@ -3018,7 +3759,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=63196e66f3033a6623eb629af95a104d26986725#63196e66f3033a6623eb629af95a104d26986725" +source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "base64 0.22.1", "bumpalo", @@ -3026,7 +3767,7 @@ dependencies = [ "float-cmp", "gif", "image-webp", - "imagesize", + "imagesize 0.14.0", "indexmap", "pdf-writer", "png", @@ -3106,18 +3847,85 @@ dependencies = [ "redox_syscall 0.9.4", ] +[[package]] +name = "libspa" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882f7427e7989dcc9d388b7f05c4630390a1d7696f9ffa469cd4a7a48f0b4c40" +dependencies = [ + "bitflags 2.13.2", + "cc", + "cookie-factory", + "libc", + "libspa-sys", + "nom 8.0.0", + "rustix 1.1.6", + "system-deps", +] + +[[package]] +name = "libspa-sys" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b6e17bdaf63ed0d5e4144022624032b41fd9733112e8c74ac26fc9bf1291924" +dependencies = [ + "bindgen", + "cc", + "system-deps", +] + +[[package]] +name = "libwayshot-xcap" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea8a46e4d016ef464e386e4970f5415fe0939c2d63abe0c2f539c05ef88c5fe5" +dependencies = [ + "drm 0.15.0", + "gbm", + "gl", + "image", + "khronos-egl", + "memmap2", + "rustix 1.1.6", + "thiserror 2.0.21", + "tracing", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", +] + [[package]] name = "linebender_resource_handle" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" +[[package]] +name = "linesweeper" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a25df1b0c5432893f41bba817150e323703ee5f6d974f3a6808ac7fd7f046d18" +dependencies = [ + "arrayvec", + "kurbo", + "polycool", + "rustc-hash 2.1.3", + "smallvec", +] + [[package]] name = "linux-raw-sys" version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + [[package]] name = "linux-raw-sys" version = "0.12.1" @@ -3207,6 +4015,12 @@ dependencies = [ "walkdir", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -3237,6 +4051,24 @@ dependencies = [ "pxfm", ] +[[package]] +name = "muda" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4340e89c178916e62879c5c36b7f699019369be413e496178a6983ce91b8bc03" +dependencies = [ + "crossbeam-channel", + "dpi", + "keyboard-types", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "png", + "thiserror 2.0.21", + "windows-sys 0.61.2", +] + [[package]] name = "multiversion_no_op" version = "1.0.0" @@ -3344,6 +4176,16 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "nom" version = "8.0.0" @@ -3482,8 +4324,8 @@ dependencies = [ "block2 0.5.1", "libc", "objc2 0.5.3", - "objc2-core-data", - "objc2-core-image", + "objc2-core-data 0.2.2", + "objc2-core-image 0.2.2", "objc2-foundation 0.2.2", "objc2-quartz-core 0.2.2", ] @@ -3496,10 +4338,17 @@ checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" dependencies = [ "bitflags 2.13.2", "block2 0.6.2", + "libc", "objc2 0.6.5", + "objc2-cloud-kit 0.3.2", + "objc2-core-data 0.3.2", "objc2-core-foundation", "objc2-core-graphics", + "objc2-core-image 0.3.2", + "objc2-core-text", + "objc2-core-video", "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", ] [[package]] @@ -3517,6 +4366,38 @@ dependencies = [ "objc2-foundation 0.3.2", ] +[[package]] +name = "objc2-av-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478ae33fcac9df0a18db8302387c666b8ef08a3e2d62b510ca4fc278a384b6c0" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "dispatch2", + "objc2 0.6.5", + "objc2-avf-audio", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-image 0.3.2", + "objc2-core-video", + "objc2-foundation 0.3.2", + "objc2-image-io", + "objc2-media-toolbox", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "objc2-avf-audio" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13a380031deed8e99db00065c45937da434ca987c034e13b87e4441f9e4090be" +dependencies = [ + "objc2 0.6.5", + "objc2-foundation 0.3.2", +] + [[package]] name = "objc2-cloud-kit" version = "0.2.2" @@ -3530,6 +4411,17 @@ dependencies = [ "objc2-foundation 0.2.2", ] +[[package]] +name = "objc2-cloud-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-foundation 0.3.2", +] + [[package]] name = "objc2-contacts" version = "0.2.2" @@ -3575,6 +4467,17 @@ dependencies = [ "objc2-foundation 0.2.2", ] +[[package]] +name = "objc2-core-data" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-foundation 0.3.2", +] + [[package]] name = "objc2-core-foundation" version = "0.3.2" @@ -3582,7 +4485,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ "bitflags 2.13.2", + "block2 0.6.2", "dispatch2", + "libc", "objc2 0.6.5", ] @@ -3593,10 +4498,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" dependencies = [ "bitflags 2.13.2", + "block2 0.6.2", "dispatch2", + "libc", "objc2 0.6.5", "objc2-core-foundation", "objc2-io-surface", + "objc2-metal 0.3.2", ] [[package]] @@ -3611,6 +4519,16 @@ dependencies = [ "objc2-metal 0.2.2", ] +[[package]] +name = "objc2-core-image" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006" +dependencies = [ + "objc2 0.6.5", + "objc2-foundation 0.3.2", +] + [[package]] name = "objc2-core-location" version = "0.2.2" @@ -3623,6 +4541,49 @@ dependencies = [ "objc2-foundation 0.2.2", ] +[[package]] +name = "objc2-core-media" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05ec576860167a15dd9fce7fbee7512beb4e31f532159d3482d1f9c6caedf31d" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "dispatch2", + "objc2 0.6.5", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-core-video", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", +] + +[[package]] +name = "objc2-core-video" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-io-surface", + "objc2-metal 0.3.2", +] + [[package]] name = "objc2-encode" version = "4.1.0" @@ -3650,10 +4611,22 @@ checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ "bitflags 2.13.2", "block2 0.6.2", + "libc", "objc2 0.6.5", "objc2-core-foundation", ] +[[package]] +name = "objc2-image-io" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b0446e98cf4a784cc7a0177715ff317eeaa8463841c616cfc78aa4f953c4ea" +dependencies = [ + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", +] + [[package]] name = "objc2-io-surface" version = "0.3.2" @@ -3677,6 +4650,18 @@ dependencies = [ "objc2-foundation 0.2.2", ] +[[package]] +name = "objc2-media-toolbox" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd9fdde720df3da7046bb9097811000c1e7ab5cd579fa89d96b27d56781fb30" +dependencies = [ + "objc2 0.6.5", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-core-media", +] + [[package]] name = "objc2-metal" version = "0.2.2" @@ -3747,9 +4732,9 @@ dependencies = [ "bitflags 2.13.2", "block2 0.5.1", "objc2 0.5.3", - "objc2-cloud-kit", - "objc2-core-data", - "objc2-core-image", + "objc2-cloud-kit 0.2.2", + "objc2-core-data 0.2.2", + "objc2-core-image 0.2.2", "objc2-core-location", "objc2-foundation 0.2.2", "objc2-link-presentation", @@ -3823,6 +4808,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "orbclient" version = "0.3.55" @@ -3997,6 +4988,12 @@ dependencies = [ "siphasher", ] +[[package]] +name = "pico-args" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" + [[package]] name = "pin-project" version = "1.1.13" @@ -4034,6 +5031,31 @@ dependencies = [ "futures-io", ] +[[package]] +name = "pipewire" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde71084c4e25959d68f1ea54daa75e5ecdb338e5caf0b5510143b79baa32d5c" +dependencies = [ + "bitflags 2.13.2", + "libc", + "libspa", + "libspa-sys", + "pipewire-sys", + "rustix 1.1.6", +] + +[[package]] +name = "pipewire-sys" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce653f53e63e5b93853218092ee9a8906a5d082c92f3f1db26316955dd63ce0" +dependencies = [ + "bindgen", + "libspa-sys", + "system-deps", +] + [[package]] name = "pkg-config" version = "0.3.34" @@ -4082,7 +5104,7 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix 1.1.5", + "rustix 1.1.6", "windows-sys 0.61.2", ] @@ -4129,6 +5151,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" dependencies = [ "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", "serde", ] @@ -4259,7 +5283,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" dependencies = [ "rand_chacha", - "rand_core", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", ] [[package]] @@ -4269,7 +5304,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.9.5", ] [[package]] @@ -4281,6 +5316,12 @@ dependencies = [ "getrandom 0.3.4", ] +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + [[package]] name = "range-alloc" version = "0.1.5" @@ -4314,7 +5355,7 @@ dependencies = [ "num-traits", "paste", "profiling", - "rand", + "rand 0.9.5", "rand_chacha", "simd_helpers", "thiserror 2.0.21", @@ -4429,12 +5470,66 @@ dependencies = [ "bitflags 2.13.2", ] +[[package]] +name = "redox_users" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60dc65c0ff1a7ae1294b0c67b9f14baf70b644404010370171787bfac1038fc0" +dependencies = [ + "libredox", + "thiserror 2.0.21", +] + +[[package]] +name = "regex" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6" + [[package]] name = "renderdoc-sys" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" +[[package]] +name = "resvg" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e3803f97b999e80cbf7c6ecdd07a8102204d92e1633cf48783720c521196bd" +dependencies = [ + "bytemuck", + "log", + "pico-args", + "rgb", + "svgtypes", + "tiny-skia", + "usvg", +] + [[package]] name = "rfd" version = "0.17.2" @@ -4462,6 +5557,15 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "rgb" +version = "0.8.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" +dependencies = [ + "bytemuck", +] + [[package]] name = "ring" version = "0.17.14" @@ -4476,6 +5580,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "roxmltree" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9da7f59328b09405b181fee1018925fad50f157afb43c0c0f5c522c256dd5907" +dependencies = [ + "memchr", +] + [[package]] name = "rustc-hash" version = "1.1.0" @@ -4512,15 +5625,15 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" dependencies = [ "bitflags 2.13.2", "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4577,7 +5690,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4772,10 +5885,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "shlex" version = "2.0.1" @@ -4823,6 +5942,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" +[[package]] +name = "simplecss" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9c6883ca9c3c7c90e888de77b7a5c849c779d25d74a1269b0218b14e8b136c" +dependencies = [ + "log", +] + [[package]] name = "siphasher" version = "1.0.4" @@ -4921,7 +6049,7 @@ dependencies = [ "libc", "log", "memmap2", - "rustix 1.1.5", + "rustix 1.1.6", "thiserror 2.0.21", "wayland-backend", "wayland-client", @@ -4981,6 +6109,9 @@ name = "strict-num" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" +dependencies = [ + "float-cmp", +] [[package]] name = "subsetter" @@ -5000,6 +6131,16 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "svgtypes" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f12b12995e3638c70618c1facb1ce65302f6a6f706b675f07c58a5d7391120e" +dependencies = [ + "kurbo", + "siphasher", +] + [[package]] name = "symphonia" version = "0.5.5" @@ -5240,6 +6381,19 @@ dependencies = [ "web-sys", ] +[[package]] +name = "system-deps" +version = "7.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396a35feb67335377e0251fcbc1092fc85c484bd4e3a7a54319399da127796e7" +dependencies = [ + "cfg-expr", + "heck", + "pkg-config", + "toml", + "version-compare", +] + [[package]] name = "tar" version = "0.4.46" @@ -5250,6 +6404,12 @@ dependencies = [ "libc", ] +[[package]] +name = "target-lexicon" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" + [[package]] name = "tempfile" version = "3.27.0" @@ -5259,8 +6419,8 @@ dependencies = [ "fastrand", "getrandom 0.3.4", "once_cell", - "rustix 1.1.5", - "windows-sys 0.52.0", + "rustix 1.1.6", + "windows-sys 0.59.0", ] [[package]] @@ -5365,6 +6525,21 @@ dependencies = [ "time-core", ] +[[package]] +name = "tiny-skia" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47ffee5eaaf5527f630fb0e356b90ebdec84d5d18d937c5e440350f88c5a91ea" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "png", + "tiny-skia-path", +] + [[package]] name = "tiny-skia-path" version = "0.12.0" @@ -5427,8 +6602,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614" dependencies = [ "indexmap", + "serde_core", + "serde_spanned", "toml_datetime", "toml_parser", + "toml_writer", "winnow", ] @@ -5486,7 +6664,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6" dependencies = [ "memchr", - "nom", + "nom 8.0.0", "petgraph", ] @@ -5514,6 +6692,12 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e" +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + [[package]] name = "typenum" version = "1.20.1" @@ -5638,6 +6822,25 @@ dependencies = [ "serde", ] +[[package]] +name = "usvg" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "977d0a4abdef933f424a99fe09f95576e089b90aebc6f016a3bc813762493e91" +dependencies = [ + "data-url", + "imagesize 0.15.0", + "kurbo", + "log", + "pico-args", + "roxmltree", + "simplecss", + "siphasher", + "strict-num", + "svgtypes", + "tiny-skia-path", +] + [[package]] name = "utf16_iter" version = "1.0.5" @@ -5678,6 +6881,27 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "vectorcraft-geom" +version = "0.18.0" +source = "git+https://github.com/storytold/vectorcraft.git?rev=6b3a6b8788ebcb420d69449199cbdf323888d27e#6b3a6b8788ebcb420d69449199cbdf323888d27e" +dependencies = [ + "kurbo", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "vectorcraft-pathops" +version = "0.18.0" +source = "git+https://github.com/storytold/vectorcraft.git?rev=6b3a6b8788ebcb420d69449199cbdf323888d27e#6b3a6b8788ebcb420d69449199cbdf323888d27e" +dependencies = [ + "kurbo", + "linesweeper", + "thiserror 2.0.21", + "vectorcraft-geom", +] + [[package]] name = "vello_common" version = "0.2.0" @@ -5721,6 +6945,12 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "version-compare" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e" + [[package]] name = "version_check" version = "0.9.5" @@ -5855,7 +7085,7 @@ checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" dependencies = [ "cc", "downcast-rs", - "rustix 1.1.5", + "rustix 1.1.6", "scoped-tls", "smallvec", "wayland-sys", @@ -5868,7 +7098,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" dependencies = [ "bitflags 2.13.2", - "rustix 1.1.5", + "rustix 1.1.6", "wayland-backend", "wayland-scanner", ] @@ -5890,7 +7120,7 @@ version = "0.31.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" dependencies = [ - "rustix 1.1.5", + "rustix 1.1.6", "wayland-client", "xcursor", ] @@ -5970,6 +7200,19 @@ dependencies = [ "quote", ] +[[package]] +name = "wayland-server" +version = "0.31.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dde9c29be0f723a573977de51ee455bf3dfa03652730a74f9dd3b337e374d75" +dependencies = [ + "bitflags 2.13.2", + "downcast-rs", + "rustix 1.1.6", + "wayland-backend", + "wayland-scanner", +] + [[package]] name = "wayland-sys" version = "0.31.11" @@ -5977,7 +7220,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" dependencies = [ "dlib", + "libc", "log", + "memoffset", "once_cell", "pkg-config", ] @@ -6216,13 +7461,19 @@ dependencies = [ "web-sys", ] +[[package]] +name = "widestring" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" + [[package]] name = "winapi-util" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6632,7 +7883,7 @@ dependencies = [ "libc", "log", "os_pipe", - "rustix 1.1.5", + "rustix 1.1.6", "thiserror 2.0.21", "tree_magic_mini", "wayland-backend", @@ -6691,7 +7942,7 @@ dependencies = [ "libc", "libloading", "once_cell", - "rustix 1.1.5", + "rustix 1.1.6", "x11rb-protocol", ] @@ -6701,6 +7952,48 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" +[[package]] +name = "xcap" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da270fd7c8581d43d731cb690bcc791fc0a7b3bc96e131a4b6552d0379640a9e" +dependencies = [ + "dispatch2", + "image", + "libwayshot-xcap", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-av-foundation", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-media", + "objc2-core-video", + "objc2-foundation 0.3.2", + "percent-encoding", + "pipewire", + "rand 0.10.4", + "scopeguard", + "serde", + "thiserror 2.0.21", + "url", + "widestring", + "windows 0.62.2", + "xcb", + "zbus", +] + +[[package]] +name = "xcb" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6c2ad15e0e922856ee89afe862b8992334bbe7953adad56cd1199358cb30566" +dependencies = [ + "bitflags 2.13.2", + "libc", + "quick-xml 0.41.0", +] + [[package]] name = "xcursor" version = "0.3.11" @@ -6796,7 +8089,7 @@ dependencies = [ "hex", "libc", "ordered-stream", - "rustix 1.1.5", + "rustix 1.1.6", "serde", "serde_repr", "tracing", @@ -7077,14 +8370,14 @@ dependencies = [ [[patch.unused]] name = "egui_demo_lib" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" [[patch.unused]] name = "egui_inspection" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" [[patch.unused]] name = "egui_system_font_provider" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" diff --git a/Cargo.toml b/Cargo.toml index 28cb93dfc..f24ffe2ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,17 +12,17 @@ repository = "https://github.com/storytold/deckcraft" [workspace.dependencies] # OPC part-name primitives and package reader/writer. -craft-opc = { git = "https://github.com/storytold/craft-libs", rev = "8048f8ef92da80fb3ce5a056d59ca591ee66faf1", version = "0.1.0" } +craft-opc = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "0.1.0" } # Compound File Binary directory reads (password-protected deck detection). -craft-cfb = { git = "https://github.com/storytold/craft-libs", rev = "8048f8ef92da80fb3ce5a056d59ca591ee66faf1", version = "0.1.0" } +craft-cfb = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "0.1.0" } # Bounded XML reader and writer primitives. -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "8048f8ef92da80fb3ce5a056d59ca591ee66faf1", version = "0.1.0" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "0.1.0" } # DrawingML colours, themes, charts, tables and text (craft-libs#778, #792). -craft-drawingml = { git = "https://github.com/storytold/craft-libs", rev = "8048f8ef92da80fb3ce5a056d59ca591ee66faf1", version = "0.1.0" } +craft-drawingml = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "0.1.0" } # PresentationML PPTX/POTX/PPSX reader and writer (craft-libs#778). -craft-pptx = { git = "https://github.com/storytold/craft-libs", rev = "8048f8ef92da80fb3ce5a056d59ca591ee66faf1", version = "0.1.0" } +craft-pptx = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "0.1.0" } # Shared MCP stdio framing and protocol constants (craft-libs#778). -craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "bc186ca719958fcce3b6ee24794277eabed14609", version = "0.1.0" } +craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "0.1.0" } # internal deckcraft-geom = { path = "crates/geom" } deckcraft-color = { path = "crates/color" } @@ -62,21 +62,21 @@ vello_cpu = "0.2" vello_common = { version = "0.2", default-features = false } image = { version = "0.25", default-features = false, features = ["png", "jpeg", "webp", "gif", "tiff", "bmp"] } # Base64 for command payloads (engine); base64_compat keeps the legacy lenient decoder. Same rev as craft-deckcraft-format. -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "254e9a409b410dc93c0e06ff66cd1e767893ac32", version = "=0.1.0" } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" } # craft-media, craft-audio and craft-video share types and stay on one rev. # The .deckcraft package layer (identity, manifest, member names, bounded reads); crates/format maps the presentation onto it. -craft-deckcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "254e9a409b410dc93c0e06ff66cd1e767893ac32", version = "=0.1.0" } -craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "d0193d7e94b5ec180ecc2a152ea72047d39ac632", version = "=0.1.0" } -craft-media = { git = "https://github.com/storytold/craft-libs", rev = "010702ee9b030844c852939095b1da0d0656a890", version = "=0.1.0", default-features = false } -craft-audio = { git = "https://github.com/storytold/craft-libs", rev = "010702ee9b030844c852939095b1da0d0656a890", version = "=0.1.0", default-features = false, features = ["opus-decode"] } +craft-deckcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" } +craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" } +craft-media = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0", default-features = false } +craft-audio = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0", default-features = false, features = ["opus-decode"] } # H.264, HEVC, VP9 and AV1 decoders. -craft-video = { git = "https://github.com/storytold/craft-libs", rev = "010702ee9b030844c852939095b1da0d0656a890", version = "=0.1.0", default-features = false, features = ["h264-decode", "hevc-decode", "vp9-decode", "av1-decode", "threads"] } +craft-video = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0", default-features = false, features = ["h264-decode", "hevc-decode", "vp9-decode", "av1-decode", "threads"] } # WMF, EMF and EMF+ reader. -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "f428c3d36e0faf3924b76956a01334c051543527", version = "=0.1.0" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "63196e66f3033a6623eb629af95a104d26986725", version = "=0.1.0", default-features = false, features = ["write", "write-simple-text"] } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0", default-features = false, features = ["write", "write-simple-text"] } # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "63196e66f3033a6623eb629af95a104d26986725", features = ["egui"] } -craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "63196e66f3033a6623eb629af95a104d26986725", version = "=0.1.0" } +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", features = ["ui"] } +craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.1.0" } i_overlay = "9" quick-xml = "0.41" zip = { version = "3", default-features = false, features = ["deflate"] } @@ -123,21 +123,21 @@ codegen-units = 16 debug = 0 [patch.crates-io] -krilla = { git = "https://github.com/storytold/craft-libs", rev = "63196e66f3033a6623eb629af95a104d26986725", version = "=0.8.2" } -ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -emath = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -epaint = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui-winit = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui_glow = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui_extras = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -eframe = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.8.2" } +ecolor = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +emath = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +epaint = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui-winit = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui_glow = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui_extras = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +eframe = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" } [workspace.metadata.cl] diff --git a/apps/deckcraft-web/Cargo.toml b/apps/deckcraft-web/Cargo.toml index da9dc7d8e..9807655f5 100644 --- a/apps/deckcraft-web/Cargo.toml +++ b/apps/deckcraft-web/Cargo.toml @@ -17,9 +17,9 @@ path = "src/main.rs" deckcraft-engine = { workspace = true } deckcraft-ui-egui = { workspace = true } # The page command API (storytold/craft-libs#413): window.deckcraft over the control channel. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "fd5e2feff6ea25bed371a99cc732b3968d621505", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "0.1.0" } # The host messages (storytold/craft-libs): one contract and one bridge for the web builds. -craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "fd5e2feff6ea25bed371a99cc732b3968d621505", version = "0.1.0" } +craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "0.1.0" } egui = { workspace = true } log = { workspace = true } serde_json = { workspace = true } From b4294d8f25a4a3282cf7e3a701276fe947732dcf Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 25 Nov 2026 21:13:43 -0800 Subject: [PATCH 072/326] Render: document position_in_tile and fill_tiled --- crates/render/src/pathgrad.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/render/src/pathgrad.rs b/crates/render/src/pathgrad.rs index 8bb580f50..4fecec004 100644 --- a/crates/render/src/pathgrad.rs +++ b/crates/render/src/pathgrad.rs @@ -66,6 +66,8 @@ pub fn position(kind: &str, bounds: Rect, focus: [f64; 4], outline: &[Vec position_in_tile(kind, bounds, bounds, focus, outline, p) } +/// [`position`] with the `rect` ramp ending on the edges of `tile` instead of `bounds`; the focus +/// rect is still measured in `bounds`. fn position_in_tile(kind: &str, bounds: Rect, tile: Rect, focus: [f64; 4], outline: &[Vec], p: Point) -> f64 { let f = Rect::new( bounds.x0 + bounds.width() * focus[0].clamp(0.0, 1.0), @@ -295,6 +297,9 @@ pub fn fill(ctx: &mut RenderContext, kind: &str, focus: [f64; 4], stops: &[(f64, fill_tiled(ctx, kind, focus, stops, bounds, bounds, path, m, alpha); } +/// [`fill`] with the gradient laid out in `tile` (the `a:tileRect` box in path units) and +/// repeated across the shape where `tile` does not cover it; a `tile` equal to `bounds` draws +/// as [`fill`] does. #[allow(clippy::too_many_arguments)] pub fn fill_tiled( ctx: &mut RenderContext, From df8f2bae571996542fbed6a84e6bf4df5cb56846 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 26 Nov 2026 14:20:58 +0000 Subject: [PATCH 073/326] port: patch the framework to the local stub tree (local only, never pushed) Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 109 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 78 +++++++++++++++++++++++++++++++++++++- 2 files changed, 131 insertions(+), 56 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 23f5d3bdd..084076002 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1068,7 +1068,6 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "block2 0.6.2", "objc2-app-kit 0.3.2", @@ -1078,7 +1077,6 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "rustix 1.1.6", ] @@ -1086,7 +1084,6 @@ dependencies = [ [[package]] name = "craft-audio" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-media", "thiserror 2.0.21", @@ -1095,7 +1092,6 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1113,12 +1109,10 @@ dependencies = [ [[package]] name = "craft-cfb" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "egui", ] @@ -1126,12 +1120,10 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" [[package]] name = "craft-deckcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-zip", "serde", @@ -1143,7 +1135,6 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "serde", ] @@ -1151,7 +1142,6 @@ dependencies = [ [[package]] name = "craft-drawingml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "chrono", "craft-xml", @@ -1163,7 +1153,6 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "harfrust 0.13.3", "kurbo", @@ -1177,12 +1166,10 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1195,7 +1182,6 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "chrono", "fixed_decimal", @@ -1223,7 +1209,6 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-host", "craft-i18n", @@ -1238,7 +1223,6 @@ dependencies = [ [[package]] name = "craft-mcp-server" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "serde_json", ] @@ -1246,7 +1230,6 @@ dependencies = [ [[package]] name = "craft-media" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "thiserror 2.0.21", ] @@ -1254,7 +1237,6 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "encoding_rs", "image", @@ -1265,7 +1247,6 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "chrono", "craft-codepage", @@ -1275,7 +1256,6 @@ dependencies = [ [[package]] name = "craft-opc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-xml", "craft-zip", @@ -1286,7 +1266,6 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "krilla", "serde", @@ -1296,7 +1275,6 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "async-channel", "async-io", @@ -1327,7 +1305,6 @@ dependencies = [ [[package]] name = "craft-pptx" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-drawingml", "craft-opc", @@ -1342,7 +1319,6 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "dispatch2", "objc2 0.6.5", @@ -1354,7 +1330,6 @@ dependencies = [ [[package]] name = "craft-rtf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-codepage", "encoding_rs", @@ -1363,7 +1338,6 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-atomic", "craft-host", @@ -1380,7 +1354,6 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-xml", "flate2", @@ -1397,7 +1370,6 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -1412,12 +1384,10 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -1431,7 +1401,6 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-behavior", "craft-i18n", @@ -1447,7 +1416,6 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "accesskit", "craft-behavior", @@ -1485,7 +1453,6 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1496,7 +1463,6 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-behavior", "craft-host", @@ -1514,7 +1480,6 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-behavior", "craft-host", @@ -1535,7 +1500,6 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-behavior", "craft-host", @@ -1555,7 +1519,6 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-behavior", "craft-host", @@ -1574,7 +1537,6 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "chrono", "craft-host", @@ -1603,7 +1565,6 @@ dependencies = [ [[package]] name = "craft-video" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-media", "rav1e", @@ -1614,7 +1575,6 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "js-sys", "serde_json", @@ -1625,7 +1585,6 @@ dependencies = [ [[package]] name = "craft-web-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-host", "craft-platform", @@ -1637,7 +1596,6 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "winsafe", ] @@ -1645,7 +1603,6 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "craft-appkit", "craft-atomic", @@ -1669,7 +1626,6 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "quick-xml 0.41.0", "serde", @@ -1679,7 +1635,6 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "flate2", "thiserror 2.0.21", @@ -3095,15 +3050,13 @@ dependencies = [ [[package]] name = "hayro-ccitt" -version = "0.4.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2866f0d976e76497480b853d5e258dab6e4b89ecfe991124e08f15dfa8fd03ad" +checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-jbig2" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000e025850f4592ddcaee85640db70704151f2bafd43b6f431aa5b6a2c6a35a9" +version = "0.3.0" dependencies = [ "hayro-ccitt", ] @@ -3117,13 +3070,12 @@ checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0edeafd70aa2db743de8ede8637d07ec87db05efe69cde371d03f1b185fcef27" dependencies = [ "hayro-jbig2", "hayro-jpeg2000", "rustc-hash 2.1.3", "smallvec", + "stringprep", "zune-jpeg", ] @@ -3759,7 +3711,6 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=0b8bbaf4c842da2d47de7b3fddd7170ba6115541#0b8bbaf4c842da2d47de7b3fddd7170ba6115541" dependencies = [ "base64 0.22.1", "bumpalo", @@ -3904,8 +3855,6 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a25df1b0c5432893f41bba817150e323703ee5f6d974f3a6808ac7fd7f046d18" dependencies = [ "arrayvec", "kurbo", @@ -6113,6 +6062,17 @@ dependencies = [ "float-cmp", ] +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + [[package]] name = "subsetter" version = "0.2.6" @@ -6562,6 +6522,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + [[package]] name = "tokio" version = "1.53.2" @@ -6751,6 +6717,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" +[[package]] +name = "unicode-normalization" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75cd3fb03d5288b3ba9a1ee103ac7e9cbb59f0b03d64f8ddfcc04dd42758a85d" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-properties" version = "0.1.4" @@ -8381,3 +8356,27 @@ source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d2 name = "egui_system_font_provider" version = "0.37.0" source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" + +[[patch.unused]] +name = "hayro" +version = "0.7.1" + +[[patch.unused]] +name = "hayro-cmap" +version = "0.1.0" + +[[patch.unused]] +name = "hayro-interpret" +version = "0.7.0" + +[[patch.unused]] +name = "hayro-postscript" +version = "0.1.0" + +[[patch.unused]] +name = "vello_common" +version = "0.0.8" + +[[patch.unused]] +name = "vello_cpu" +version = "0.0.8" diff --git a/Cargo.toml b/Cargo.toml index f24ffe2ea..60e4dfb97 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,7 +123,17 @@ codegen-units = 16 debug = 0 [patch.crates-io] -krilla = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.8.2" } +# BEGIN port-kit framework overrides +krilla = { path = "../craft-libs/vendor/krilla" } +hayro = { path = "../craft-libs/vendor/hayro" } +hayro-interpret = { path = "../craft-libs/vendor/hayro-interpret" } +hayro-syntax = { path = "../craft-libs/vendor/hayro-syntax" } +hayro-jbig2 = { path = "../craft-libs/vendor/hayro-jbig2" } +hayro-cmap = { path = "../craft-libs/vendor/hayro-cmap" } +hayro-postscript = { path = "../craft-libs/vendor/hayro-postscript" } +linesweeper = { path = "../craft-libs/vendor/linesweeper" } +vello_common = { path = "../craft-libs/vendor/vello_common" } +vello_cpu = { path = "../craft-libs/vendor/vello_cpu" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } emath = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } epaint = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } @@ -139,8 +149,74 @@ eframe = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f3048 egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" } +# END port-kit framework overrides +# port-kit overridden: krilla = { git = "https://github.com/storytold/craft-libs", rev = "0b8bbaf4c842da2d47de7b3fddd7170ba6115541", version = "=0.8.2" } +# port-kit overridden: ecolor = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: emath = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: epaint = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: egui = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: egui-winit = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: egui_glow = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: egui_extras = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: eframe = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +# port-kit overridden: winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" } [workspace.metadata.cl] selection = ["deckcraft", "deckcraft-anim", "deckcraft-cli", "deckcraft-color", "deckcraft-engine", "deckcraft-format", "deckcraft-geom", "deckcraft-mcp", "deckcraft-model", "deckcraft-pdf", "deckcraft-ppt", "deckcraft-pptx", "deckcraft-render", "deckcraft-text", "deckcraft-ui-egui", "deckcraft-web"] tracked = ["egui", "eframe", "craft-ui", "craft-pptx", "craft-drawingml"] unset_env = ["DECKCRAFT_BUILD_CHANNEL", "DECKCRAFT_VERSION", "DECKCRAFT_REQUIRE_WINRES", "CRAFT_FONTS_REQUIRED"] + +# BEGIN port-kit framework patch +[patch."https://github.com/storytold/craft-libs"] +craft-appkit = { path = "../craft-libs/crates/appkit" } +craft-atomic = { path = "../craft-libs/crates/atomic" } +craft-audio = { path = "../craft-libs/crates/audio" } +craft-behavior = { path = "../craft-libs/crates/behavior" } +craft-cfb = { path = "../craft-libs/crates/cfb" } +craft-cloud-ui = { path = "../craft-libs/crates/cloud-ui" } +craft-codepage = { path = "../craft-libs/crates/codepage" } +craft-deckcraft-format = { path = "../craft-libs/crates/deckcraft-format" } +craft-docpath = { path = "../craft-libs/crates/docpath" } +craft-drawingml = { path = "../craft-libs/crates/drawingml" } +craft-font-catalog = { path = "../craft-libs/crates/font-catalog" } +craft-fonts-build = { path = "../craft-libs/crates/fonts-build" } +craft-host = { path = "../craft-libs/crates/host" } +craft-i18n = { path = "../craft-libs/crates/i18n" } +craft-keymap = { path = "../craft-libs/crates/keymap" } +craft-mcp-server = { path = "../craft-libs/crates/mcp-server" } +craft-media = { path = "../craft-libs/crates/media" } +craft-metafile = { path = "../craft-libs/crates/metafile" } +craft-mime = { path = "../craft-libs/crates/mime" } +craft-opc = { path = "../craft-libs/crates/opc" } +craft-pdf = { path = "../craft-libs/crates/pdf" } +craft-platform = { path = "../craft-libs/crates/platform" } +craft-pptx = { path = "../craft-libs/crates/pptx" } +craft-quit = { path = "../craft-libs/crates/quit" } +craft-rtf = { path = "../craft-libs/crates/rtf" } +craft-settings = { path = "../craft-libs/crates/settings" } +craft-svg = { path = "../craft-libs/crates/svg" } +craft-theme = { path = "../craft-libs/crates/theme" } +craft-tracked = { path = "../craft-libs/crates/tracked" } +craft-ui = { path = "../craft-libs/crates/ui" } +craft-ui-canvas = { path = "../craft-libs/crates/ui-canvas" } +craft-ui-contract = { path = "../craft-libs/crates/ui-contract" } +craft-ui-macros = { path = "../craft-libs/crates/ui-macros" } +craft-ui-panels = { path = "../craft-libs/crates/ui-panels" } +craft-ui-patterns = { path = "../craft-libs/crates/ui-patterns" } +craft-ui-shell = { path = "../craft-libs/crates/ui-shell" } +craft-ui-widgets = { path = "../craft-libs/crates/ui-widgets" } +craft-update = { path = "../craft-libs/crates/update" } +craft-video = { path = "../craft-libs/crates/video" } +craft-web-api = { path = "../craft-libs/crates/web-api" } +craft-web-host = { path = "../craft-libs/crates/web-host" } +craft-win32 = { path = "../craft-libs/crates/win32" } +craft-window = { path = "../craft-libs/crates/window" } +craft-xml = { path = "../craft-libs/crates/xml" } +craft-zip = { path = "../craft-libs/crates/zip" } +# END port-kit framework patch From d7f1166664120cad0ac1319da668cbcd3b9c61dc Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 26 Nov 2026 15:41:55 +0000 Subject: [PATCH 074/326] Contract stubs: app Written by a Codex stage agent; committed by bin/codex-stubs (the sandbox keeps .git read-only). --- Cargo.lock | 1537 ++++++++++++++++- crates/pptx/src/convert.rs | 3 + crates/ui-egui/Cargo.toml | 1 + crates/ui-egui/src/app.rs | 120 +- crates/ui-egui/src/app/catalog.rs | 62 + crates/ui-egui/src/app/clipboard.rs | 14 +- crates/ui-egui/src/app/commands.rs | 12 +- crates/ui-egui/src/app/control.rs | 9 + crates/ui-egui/src/app/files.rs | 47 +- crates/ui-egui/src/app/input.rs | 20 +- crates/ui-egui/src/app/keys.rs | 4 + crates/ui-egui/src/app/playback.rs | 30 +- crates/ui-egui/src/app/scheme.rs | 7 + crates/ui-egui/src/backstage.rs | 10 +- crates/ui-egui/src/backstage/info.rs | 6 +- crates/ui-egui/src/backstage/print.rs | 15 +- crates/ui-egui/src/canvas.rs | 7 +- crates/ui-egui/src/canvas/context_menu.rs | 11 + crates/ui-egui/src/canvas/guides.rs | 14 + crates/ui-egui/src/canvas/handles.rs | 6 + crates/ui-egui/src/canvas/media.rs | 14 + crates/ui-egui/src/canvas/picture.rs | 15 + crates/ui-egui/src/canvas/previews.rs | 6 + crates/ui-egui/src/canvas/rulers.rs | 14 + crates/ui-egui/src/canvas/squiggles.rs | 16 + crates/ui-egui/src/canvas/tool.rs | 39 + crates/ui-egui/src/dialogs.rs | 113 +- crates/ui-egui/src/dialogs/about.rs | 19 + crates/ui-egui/src/dialogs/accessibility.rs | 18 + crates/ui-egui/src/dialogs/action.rs | 15 + crates/ui-egui/src/dialogs/alt_text.rs | 16 + crates/ui-egui/src/dialogs/body.rs | 21 +- crates/ui-egui/src/dialogs/bullets.rs | 15 + crates/ui-egui/src/dialogs/chart_data.rs | 15 + crates/ui-egui/src/dialogs/choice_forms.rs | 15 + crates/ui-egui/src/dialogs/closing.rs | 43 + crates/ui-egui/src/dialogs/columns.rs | 16 + crates/ui-egui/src/dialogs/credits.rs | 3 +- crates/ui-egui/src/dialogs/custom_shows.rs | 18 + crates/ui-egui/src/dialogs/date_time.rs | 19 +- crates/ui-egui/src/dialogs/export.rs | 19 +- crates/ui-egui/src/dialogs/find.rs | 27 + crates/ui-egui/src/dialogs/font.rs | 22 +- crates/ui-egui/src/dialogs/grid_options.rs | 16 + crates/ui-egui/src/dialogs/header_footer.rs | 15 + crates/ui-egui/src/dialogs/hyperlink.rs | 19 + crates/ui-egui/src/dialogs/insert_forms.rs | 15 + crates/ui-egui/src/dialogs/language.rs | 16 + crates/ui-egui/src/dialogs/paragraph.rs | 22 +- crates/ui-egui/src/dialogs/photo_album.rs | 26 +- crates/ui-egui/src/dialogs/preferences.rs | 55 + crates/ui-egui/src/dialogs/replace_fonts.rs | 15 + crates/ui-egui/src/dialogs/reuse_slides.rs | 15 + crates/ui-egui/src/dialogs/size_position.rs | 16 + crates/ui-egui/src/dialogs/slide_size.rs | 16 + crates/ui-egui/src/dialogs/spelling.rs | 25 + crates/ui-egui/src/dialogs/symbol.rs | 15 + crates/ui-egui/src/dialogs/tabs.rs | 19 + crates/ui-egui/src/dialogs/theme_colors.rs | 16 + crates/ui-egui/src/dialogs/theme_fonts.rs | 19 +- crates/ui-egui/src/dialogs/trim.rs | 16 + crates/ui-egui/src/dialogs/updates_ui.rs | 51 +- crates/ui-egui/src/dialogs/zoom.rs | 16 + crates/ui-egui/src/eyedropper.rs | 33 + crates/ui-egui/src/host_save_tests.rs | 3 +- crates/ui-egui/src/icon_sheet.rs | 13 + crates/ui-egui/src/icons.rs | 13 + crates/ui-egui/src/lib.rs | 94 + crates/ui-egui/src/media.rs | 4 + crates/ui-egui/src/menus.rs | 7 + crates/ui-egui/src/panels.rs | 23 +- crates/ui-egui/src/panels/animation.rs | 7 + crates/ui-egui/src/panels/background.rs | 12 +- crates/ui-egui/src/panels/color_row.rs | 32 + crates/ui-egui/src/panels/comments.rs | 3 +- crates/ui-egui/src/panels/fillui.rs | 40 +- crates/ui-egui/src/panels/format_shape.rs | 31 +- .../src/panels/format_shape/effects.rs | 6 + .../ui-egui/src/panels/format_shape/size.rs | 6 + crates/ui-egui/src/panels/notes.rs | 21 + crates/ui-egui/src/panels/preset_grid.rs | 13 + crates/ui-egui/src/panels/selpane.rs | 7 + crates/ui-egui/src/panels/thumbs.rs | 14 +- crates/ui-egui/src/platform.rs | 19 + crates/ui-egui/src/presenter_view.rs | 64 + crates/ui-egui/src/ribbon.rs | 8 + crates/ui-egui/src/ribbon/diagram_thumbs.rs | 32 + crates/ui-egui/src/ribbon/fonts.rs | 12 + crates/ui-egui/src/ribbon/galleries.rs | 20 + crates/ui-egui/src/ribbon/home.rs | 7 + crates/ui-egui/src/ribbon/states.rs | 20 + crates/ui-egui/src/ribbon/title_bar.rs | 4 +- crates/ui-egui/src/ribbon/transitions.rs | 3 +- crates/ui-egui/src/ribbon/view.rs | 8 + crates/ui-egui/src/settings.rs | 19 + crates/ui-egui/src/show.rs | 102 +- crates/ui-egui/src/show/bars.rs | 6 + crates/ui-egui/src/show/commands.rs | 95 + crates/ui-egui/src/show/frames.rs | 90 + crates/ui-egui/src/show/grid.rs | 35 + crates/ui-egui/src/show/media.rs | 2 +- crates/ui-egui/src/show/presenter.rs | 7 + crates/ui-egui/src/show/tool.rs | 42 + crates/ui-egui/src/sorter.rs | 3 +- crates/ui-egui/src/state.rs | 9 +- crates/ui-egui/src/test_harness.rs | 20 + crates/ui-egui/src/thumb_source.rs | 73 + 107 files changed, 3870 insertions(+), 88 deletions(-) create mode 100644 crates/ui-egui/src/app/catalog.rs create mode 100644 crates/ui-egui/src/app/scheme.rs create mode 100644 crates/ui-egui/src/canvas/handles.rs create mode 100644 crates/ui-egui/src/canvas/picture.rs create mode 100644 crates/ui-egui/src/canvas/previews.rs create mode 100644 crates/ui-egui/src/canvas/tool.rs create mode 100644 crates/ui-egui/src/dialogs/accessibility.rs create mode 100644 crates/ui-egui/src/dialogs/action.rs create mode 100644 crates/ui-egui/src/dialogs/bullets.rs create mode 100644 crates/ui-egui/src/dialogs/chart_data.rs create mode 100644 crates/ui-egui/src/dialogs/choice_forms.rs create mode 100644 crates/ui-egui/src/dialogs/closing.rs create mode 100644 crates/ui-egui/src/dialogs/custom_shows.rs create mode 100644 crates/ui-egui/src/dialogs/header_footer.rs create mode 100644 crates/ui-egui/src/dialogs/insert_forms.rs create mode 100644 crates/ui-egui/src/dialogs/replace_fonts.rs create mode 100644 crates/ui-egui/src/dialogs/reuse_slides.rs create mode 100644 crates/ui-egui/src/dialogs/spelling.rs create mode 100644 crates/ui-egui/src/dialogs/symbol.rs create mode 100644 crates/ui-egui/src/icon_sheet.rs create mode 100644 crates/ui-egui/src/panels/color_row.rs create mode 100644 crates/ui-egui/src/panels/format_shape/effects.rs create mode 100644 crates/ui-egui/src/panels/format_shape/size.rs create mode 100644 crates/ui-egui/src/panels/preset_grid.rs create mode 100644 crates/ui-egui/src/platform.rs create mode 100644 crates/ui-egui/src/presenter_view.rs create mode 100644 crates/ui-egui/src/ribbon/diagram_thumbs.rs create mode 100644 crates/ui-egui/src/ribbon/fonts.rs create mode 100644 crates/ui-egui/src/ribbon/states.rs create mode 100644 crates/ui-egui/src/show/bars.rs create mode 100644 crates/ui-egui/src/show/commands.rs create mode 100644 crates/ui-egui/src/show/frames.rs create mode 100644 crates/ui-egui/src/show/grid.rs create mode 100644 crates/ui-egui/src/show/tool.rs create mode 100644 crates/ui-egui/src/test_harness.rs create mode 100644 crates/ui-egui/src/thumb_source.rs diff --git a/Cargo.lock b/Cargo.lock index 084076002..af4b6c8fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -156,6 +156,12 @@ dependencies = [ "equator", ] +[[package]] +name = "alloc-no-stdlib" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2fb6cfd47bf496ff64095c20eaba0c201404ee38714d4142fcfa1dc334fcc7a" + [[package]] name = "allocator-api2" version = "0.2.21" @@ -184,6 +190,12 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "ambient-authority" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b" + [[package]] name = "android-activity" version = "0.6.1" @@ -534,6 +546,30 @@ dependencies = [ "v_frame", ] +[[package]] +name = "aws-lc-rs" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "048006790404103c488e6c5616b3e7e702a71292aadda08e8f7698a9e0d2eb53" +dependencies = [ + "aws-lc-sys", + "untrusted 0.7.1", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bfbe32ac36b3c428696ce315464181bc4029d689fd58e3f2a4e58c252242f52" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", + "pkg-config", +] + [[package]] name = "base64" version = "0.22.1" @@ -546,6 +582,12 @@ version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + [[package]] name = "bindgen" version = "0.72.1" @@ -647,6 +689,15 @@ dependencies = [ "piper", ] +[[package]] +name = "brotli-decompressor" +version = "6.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75c74c9c51b9140663e196b5fb88bc94c334d7a497c8311cb759d8557874747f" +dependencies = [ + "alloc-no-stdlib", +] + [[package]] name = "built" version = "0.8.1" @@ -751,6 +802,24 @@ dependencies = [ "wayland-client", ] +[[package]] +name = "cap-primitives" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b5f74729fd2f44701d1a8eb47e906cdb3ccd9ec0f02baad85a744b791940b18" +dependencies = [ + "ambient-authority", + "fs-set-times", + "io-extras", + "io-lifetimes 3.0.1", + "ipnet", + "maybe-owned", + "rustix 1.1.6", + "rustix-linux-procfs", + "windows-sys 0.61.2", + "winx", +] + [[package]] name = "cast" version = "0.3.0" @@ -835,6 +904,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-link", ] @@ -859,6 +929,39 @@ dependencies = [ "error-code", ] +[[package]] +name = "cmake" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" +dependencies = [ + "cc", +] + +[[package]] +name = "cmpv2" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "961b955a666e25ee5a1091d219128d6e6401e3dab84efb1a2bf6b4035d797b39" +dependencies = [ + "crmf", + "der", + "spki", + "x509-cert", +] + +[[package]] +name = "cms" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b77c319abfd5219629c45c34c89ba945ed3c5e49fcde9d16b6c3885f118a730" +dependencies = [ + "const-oid", + "der", + "spki", + "x509-cert", +] + [[package]] name = "cobs" version = "0.3.0" @@ -923,6 +1026,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "cookie-factory" version = "0.3.3" @@ -1065,6 +1174,42 @@ dependencies = [ "libc", ] +[[package]] +name = "craft" +version = "0.1.0" +dependencies = [ + "craft-automation", + "craft-behavior", + "craft-browse", + "craft-color-ui", + "craft-dialogs", + "craft-draw", + "craft-font-catalog", + "craft-font-manager", + "craft-host", + "craft-i18n", + "craft-imaging", + "craft-keymap", + "craft-menu", + "craft-pages", + "craft-platform", + "craft-print", + "craft-quit", + "craft-review", + "craft-settings", + "craft-table", + "craft-text", + "craft-theme", + "craft-theme-store", + "craft-timeline", + "craft-ui", + "craft-update", + "craft-web-host", + "craft-window", + "egui", + "toml", +] + [[package]] name = "craft-appkit" version = "0.1.0" @@ -1089,6 +1234,30 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-automation" +version = "0.1.0" +dependencies = [ + "base64 0.23.1", + "craft-behavior", + "craft-control", + "craft-host", + "craft-keymap", + "craft-platform", + "craft-theme", + "craft-ui", + "egui", + "getrandom 0.3.4", + "hmac", + "log", + "png 0.17.16", + "serde", + "serde_json", + "sha2", + "thiserror 2.0.21", + "web-time", +] + [[package]] name = "craft-behavior" version = "0.1.0" @@ -1106,6 +1275,23 @@ dependencies = [ "smallvec", ] +[[package]] +name = "craft-browse" +version = "0.1.0" +dependencies = [ + "craft-behavior", + "craft-docpath", + "craft-host", + "craft-i18n", + "craft-platform", + "craft-settings", + "craft-theme", + "craft-ui", + "egui", + "kurbo", + "serde", +] + [[package]] name = "craft-cfb" version = "0.1.0" @@ -1117,10 +1303,46 @@ dependencies = [ "egui", ] +[[package]] +name = "craft-cms" +version = "0.1.0" +dependencies = [ + "md-5", + "rayon", +] + [[package]] name = "craft-codepage" version = "0.1.0" +[[package]] +name = "craft-color-ui" +version = "0.1.0" +dependencies = [ + "craft-behavior", + "craft-cms", + "craft-host", + "craft-i18n", + "craft-keymap", + "craft-platform", + "craft-settings", + "craft-theme", + "craft-ui", + "craft-window", + "egui", + "serde", + "serde_json", +] + +[[package]] +name = "craft-control" +version = "0.1.0" +dependencies = [ + "getrandom 0.3.4", + "serde", + "serde_json", +] + [[package]] name = "craft-deckcraft-format" version = "0.1.0" @@ -1132,6 +1354,30 @@ dependencies = [ "zip 9.1.0", ] +[[package]] +name = "craft-dialogs" +version = "0.1.0" +dependencies = [ + "block2 0.6.2", + "craft-atomic", + "craft-behavior", + "craft-browse", + "craft-host", + "craft-i18n", + "craft-platform", + "craft-ui", + "egui", + "futures-lite", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "raw-window-handle", + "rfd", + "serde_json", + "zbus", +] + [[package]] name = "craft-docpath" version = "0.1.0" @@ -1139,6 +1385,24 @@ dependencies = [ "serde", ] +[[package]] +name = "craft-draw" +version = "0.1.0" +dependencies = [ + "craft-behavior", + "craft-color-ui", + "craft-host", + "craft-i18n", + "craft-keymap", + "craft-settings", + "craft-theme", + "craft-ui", + "egui", + "kurbo", + "serde", + "serde_json", +] + [[package]] name = "craft-drawingml" version = "0.1.0" @@ -1154,6 +1418,7 @@ dependencies = [ name = "craft-font-catalog" version = "0.1.0" dependencies = [ + "fontique", "harfrust 0.13.3", "kurbo", "skrifa 0.47.0", @@ -1163,6 +1428,54 @@ dependencies = [ "windows-registry", ] +[[package]] +name = "craft-font-manager" +version = "0.1.0" +dependencies = [ + "craft-behavior", + "craft-font-catalog", + "craft-font-store", + "craft-fonts-build", + "craft-host", + "craft-i18n", + "craft-theme", + "craft-ui", + "egui", + "log", + "serde", + "skrifa 0.47.0", +] + +[[package]] +name = "craft-font-os-windows" +version = "0.1.0" +dependencies = [ + "windows-registry", + "windows-sys 0.61.2", +] + +[[package]] +name = "craft-font-store" +version = "0.1.0" +dependencies = [ + "cap-primitives", + "craft-atomic", + "craft-font-catalog", + "craft-font-os-windows", + "flate2", + "log", + "ruzstd", + "serde", + "serde_json", + "sha2", + "skrifa 0.47.0", + "tar", + "thiserror 2.0.21", + "toml", + "ureq", + "wuff", +] + [[package]] name = "craft-fonts-build" version = "0.1.0" @@ -1206,6 +1519,23 @@ dependencies = [ "writeable", ] +[[package]] +name = "craft-imaging" +version = "0.1.0" +dependencies = [ + "craft-behavior", + "craft-color-ui", + "craft-host", + "craft-i18n", + "craft-keymap", + "craft-theme", + "craft-ui", + "egui", + "kurbo", + "serde", + "serde_json", +] + [[package]] name = "craft-keymap" version = "0.1.0" @@ -1234,6 +1564,23 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-menu" +version = "0.1.0" +dependencies = [ + "craft-behavior", + "craft-host", + "craft-i18n", + "craft-keymap", + "craft-quit", + "craft-theme", + "craft-ui", + "craft-window", + "egui", + "serde", + "serde_json", +] + [[package]] name = "craft-metafile" version = "0.1.0" @@ -1263,6 +1610,21 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-pages" +version = "0.1.0" +dependencies = [ + "craft-behavior", + "craft-keymap", + "craft-text", + "craft-theme", + "craft-ui", + "egui", + "kurbo", + "serde", + "serde_json", +] + [[package]] name = "craft-pdf" version = "0.1.0" @@ -1316,17 +1678,59 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-print" +version = "0.1.0" +dependencies = [ + "craft-behavior", + "craft-host", + "craft-theme", + "craft-ui", + "craft-winprint-gdi", + "egui", + "js-sys", + "log", + "miniz_oxide 0.9.1", + "roxmltree", + "serde", + "serde_json", + "tempfile", + "wasm-bindgen", + "web-sys", + "winprint", + "winsafe", +] + [[package]] name = "craft-quit" version = "0.1.0" dependencies = [ "dispatch2", + "egui", "objc2 0.6.5", "objc2-app-kit 0.3.2", "wasm-bindgen", "web-sys", ] +[[package]] +name = "craft-review" +version = "0.1.0" +dependencies = [ + "base64 0.23.1", + "craft-behavior", + "craft-host", + "craft-i18n", + "craft-keymap", + "craft-pages", + "craft-theme", + "craft-ui", + "egui", + "image", + "kurbo", + "serde", +] + [[package]] name = "craft-rtf" version = "0.1.0" @@ -1367,6 +1771,38 @@ dependencies = [ "vectorcraft-pathops", ] +[[package]] +name = "craft-table" +version = "0.1.0" +dependencies = [ + "craft-behavior", + "craft-keymap", + "craft-theme", + "craft-ui", + "egui", +] + +[[package]] +name = "craft-text" +version = "0.1.0" +dependencies = [ + "craft-behavior", + "craft-host", + "craft-keymap", + "craft-theme", + "craft-ui", + "egui", + "hypher", + "miniz_oxide 0.8.9", + "serde", + "serde_json", + "unicode-bidi", + "unicode-bidi-mirroring", + "unicode-general-category", + "unicode-linebreak", + "unicode-segmentation", +] + [[package]] name = "craft-theme" version = "0.1.0" @@ -1381,6 +1817,42 @@ dependencies = [ "smallvec", ] +[[package]] +name = "craft-theme-store" +version = "0.1.0" +dependencies = [ + "craft-atomic", + "craft-behavior", + "craft-theme", + "craft-ui", + "dirs", + "egui", + "serde", + "serde_json", +] + +[[package]] +name = "craft-time" +version = "0.1.0" +dependencies = [ + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-timeline" +version = "0.1.0" +dependencies = [ + "craft-behavior", + "craft-keymap", + "craft-theme", + "craft-time", + "craft-ui", + "egui", + "serde", + "web-time", +] + [[package]] name = "craft-tracked" version = "0.1.0" @@ -1623,6 +2095,14 @@ dependencies = [ "x11rb", ] +[[package]] +name = "craft-winprint-gdi" +version = "0.1.0" +source = "git+https://github.com/storytold/winprint.rs?rev=64e7afd4d1483512385012c340ecaaaf0f3beb7f#64e7afd4d1483512385012c340ecaaaf0f3beb7f" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "craft-xml" version = "0.1.0" @@ -1650,6 +2130,18 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crmf" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36fe21b96d5b87f5de4b5b7202ec41c00110ac817ce6728fe75fb2fe5962ed92" +dependencies = [ + "cms", + "der", + "spki", + "x509-cert", +] + [[package]] name = "crossbeam-channel" version = "0.5.17" @@ -1955,6 +2447,7 @@ dependencies = [ name = "deckcraft-ui-egui" version = "0.19.0" dependencies = [ + "craft", "craft-ui", "craft-update", "deckcraft-anim", @@ -1996,6 +2489,30 @@ dependencies = [ "web-sys", ] +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "der_derive", + "flagset", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "der_derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8034092389675178f570469e6c3b0465d3d30b4505c294a6550db47f3c17ad18" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "deranged" version = "0.5.9" @@ -2034,6 +2551,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -2586,6 +3104,12 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flagset" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7ac824320a75a52197e8f2d787f6a38b6718bb6897a35142d749af3c0e8f4fe" + [[package]] name = "flate2" version = "1.1.10" @@ -2606,6 +3130,28 @@ dependencies = [ "num-traits", ] +[[package]] +name = "fmt-derive" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cb4a4b45c26455885f8b462db12978e51f60cc914337bccb9a36faf93410169" +dependencies = [ + "fmt-derive-proc", +] + +[[package]] +name = "fmt-derive-proc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7704da0760734344ce8753f15b21e97c6be85dc5a8f2c3a963fbd042b3380d23" +dependencies = [ + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "fmv-macos-events" version = "0.1.0" @@ -2617,6 +3163,12 @@ dependencies = [ "objc2-foundation 0.3.2", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "foldhash" version = "0.1.5" @@ -2647,6 +3199,28 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "fontique" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6688bc1294fe7117d788937b6c53480169b29c566954af490830d4c09da9516a" +dependencies = [ + "hashbrown 0.17.1", + "linebender_resource_handle", + "memmap2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-text", + "objc2-foundation 0.3.2", + "parlance", + "read-fonts 0.41.0", + "roxmltree", + "smallvec", + "windows 0.62.2", + "windows-core 0.62.2", + "yeslogic-fontconfig-sys", +] + [[package]] name = "foreign-types" version = "0.5.0" @@ -2683,6 +3257,33 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs-set-times" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a" +dependencies = [ + "io-lifetimes 2.0.4", + "rustix 1.1.6", + "windows-sys 0.52.0", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + [[package]] name = "futures-core" version = "0.3.34" @@ -2719,6 +3320,12 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + [[package]] name = "futures-task" version = "0.3.34" @@ -2732,8 +3339,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" dependencies = [ "futures-core", + "futures-io", "futures-macro", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "slab", ] @@ -2798,8 +3408,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -2869,7 +3481,7 @@ dependencies = [ "hashbrown 0.17.1", "log", "peniko", - "png", + "png 0.18.1", "skrifa 0.44.0", "smallvec", "vello_common", @@ -2982,6 +3594,25 @@ dependencies = [ "euclid", ] +[[package]] +name = "h2" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "half" version = "2.7.1" @@ -3097,6 +3728,15 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "http" version = "1.5.0" @@ -3107,12 +3747,103 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + [[package]] name = "httparse" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "hypher" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45f2b4f6b5da34d400d4c112eadcc14512cc5d04307a8eee182586d9bebd7ce6" + [[package]] name = "i_float" version = "5.0.0" @@ -3466,7 +4197,7 @@ dependencies = [ "image-webp", "moxcms", "num-traits", - "png", + "png 0.18.1", "tiff", "zune-core", "zune-jpeg", @@ -3524,6 +4255,34 @@ dependencies = [ "rustversion", ] +[[package]] +name = "io-extras" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20fd6de4ccfcc187e38bc21cfa543cb5a302cb86a8b114eb7f0bf0dc9f8ac00f" +dependencies = [ + "io-lifetimes 3.0.1", + "windows-sys 0.52.0", +] + +[[package]] +name = "io-lifetimes" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06432fb54d3be7964ecd3649233cddf80db2832f47fec34c01f65b3d9d774983" + +[[package]] +name = "io-lifetimes" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0fb0570afe1fed943c5c3d4102d5358592d8625fda6a0007fdbe65a92fba96" + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + [[package]] name = "is-docker" version = "0.2.0" @@ -3721,7 +4480,7 @@ dependencies = [ "imagesize 0.14.0", "indexmap", "pdf-writer", - "png", + "png 0.18.1", "rayon", "rustc-hash 2.1.3", "rustybuzz", @@ -3911,6 +4670,12 @@ version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" +[[package]] +name = "lru-slab" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f" + [[package]] name = "mach2" version = "0.4.3" @@ -3920,6 +4685,12 @@ dependencies = [ "libc", ] +[[package]] +name = "maybe-owned" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" + [[package]] name = "maybe-rayon" version = "0.1.1" @@ -3930,6 +4701,16 @@ dependencies = [ "rayon", ] +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + [[package]] name = "memchr" version = "2.8.3" @@ -3954,6 +4735,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mime" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5848f5a9e8117cf94f2f90faac24a87ff81600ff8628c1e3deaab572e76bfa1" + [[package]] name = "minicov" version = "0.3.8" @@ -3990,6 +4777,17 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "mio" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + [[package]] name = "moxcms" version = "0.8.1" @@ -4013,7 +4811,7 @@ dependencies = [ "objc2-app-kit 0.3.2", "objc2-core-foundation", "objc2-foundation 0.3.2", - "png", + "png 0.18.1", "thiserror 2.0.21", "windows-sys 0.61.2", ] @@ -4840,6 +5638,12 @@ dependencies = [ "windows-link", ] +[[package]] +name = "parlance" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73072a9470554c8e794778acece2312661218aaabb635600957d952cf01c716e" + [[package]] name = "paste" version = "1.0.15" @@ -4864,6 +5668,25 @@ dependencies = [ "ryu", ] +[[package]] +name = "pem" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be" +dependencies = [ + "base64 0.22.1", + "serde_core", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "peniko" version = "0.6.1" @@ -5030,6 +5853,19 @@ dependencies = [ "time", ] +[[package]] +name = "png" +version = "0.17.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + [[package]] name = "png" version = "0.18.1" @@ -5146,6 +5982,30 @@ dependencies = [ "toml_edit", ] +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" version = "1.0.107" @@ -5204,6 +6064,63 @@ dependencies = [ "memchr", ] +[[package]] +name = "quinn" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash 2.1.3", + "rustls", + "socket2", + "thiserror 2.0.21", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe" +dependencies = [ + "aws-lc-rs", + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand 0.10.4", + "rand_pcg", + "ring", + "rustc-hash 2.1.3", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.21", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.52.0", +] + [[package]] name = "quote" version = "1.0.47" @@ -5256,6 +6173,12 @@ dependencies = [ "rand_core 0.9.5", ] +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + [[package]] name = "rand_core" version = "0.9.5" @@ -5271,6 +6194,15 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" +[[package]] +name = "rand_pcg" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" +dependencies = [ + "rand_core 0.10.1", +] + [[package]] name = "range-alloc" version = "0.1.5" @@ -5464,6 +6396,49 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" +[[package]] +name = "reqwest" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029" +dependencies = [ + "base64 0.23.1", + "bytes", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "mime", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "resvg" version = "0.48.1" @@ -5525,7 +6500,7 @@ dependencies = [ "cfg-if", "getrandom 0.2.17", "libc", - "untrusted", + "untrusted 0.9.0", "windows-sys 0.52.0", ] @@ -5585,12 +6560,23 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "rustix-linux-procfs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc84bf7e9aa16c4f2c758f27412dc9841341e16aa682d9c7ac308fe3ee12056" +dependencies = [ + "once_cell", + "rustix 1.1.6", +] + [[package]] name = "rustls" version = "0.23.46" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" dependencies = [ + "aws-lc-rs", "log", "once_cell", "ring", @@ -5618,6 +6604,7 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" dependencies = [ + "web-time", "zeroize", ] @@ -5654,9 +6641,10 @@ version = "0.103.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" dependencies = [ + "aws-lc-rs", "ring", "rustls-pki-types", - "untrusted", + "untrusted 0.9.0", ] [[package]] @@ -5683,12 +6671,24 @@ dependencies = [ "unicode-script", ] +[[package]] +name = "ruzstd" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e4ce4a039f42bf25920b95667e4d789e98749ab11bbb8d2c2936f788421bb5" + [[package]] name = "ryu" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" +[[package]] +name = "ryu-js" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04d056b875a9d2e6cb9a61d127afee9ac5999b9f87bcb32079d1318e505be714" + [[package]] name = "same-file" version = "1.0.6" @@ -5807,6 +6807,17 @@ dependencies = [ "zmij", ] +[[package]] +name = "serde_json_canonicalizer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe52319a927259afbfa5180c5157cd8167edfd3e8c254f9558c7fef44c5649f2" +dependencies = [ + "ryu-js", + "serde", + "serde_json", +] + [[package]] name = "serde_repr" version = "0.1.21" @@ -5827,6 +6838,29 @@ dependencies = [ "serde_core", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + [[package]] name = "sha2" version = "0.10.9" @@ -5860,6 +6894,175 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "sigstore-bundle" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7dc53c8a941858d01479622dbb7650aaa2ee0ca1fb58fb6cdddbfc3064abbb" +dependencies = [ + "base64 0.22.1", + "hex", + "serde", + "serde_json", + "sigstore-crypto", + "sigstore-merkle", + "sigstore-rekor", + "sigstore-tsa", + "sigstore-types", + "thiserror 2.0.21", +] + +[[package]] +name = "sigstore-crypto" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da90c3d9af638898a5fdc347479b18f950bb0dde11ecf2244f94cd28135da53b" +dependencies = [ + "aws-lc-rs", + "base64 0.22.1", + "const-oid", + "der", + "digest", + "pem", + "rand_core 0.10.1", + "sha2", + "signature", + "sigstore-types", + "spki", + "thiserror 2.0.21", + "tracing", + "x509-cert", +] + +[[package]] +name = "sigstore-merkle" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c0d53558825c77716855c13794306fff766854c1bf92948e77d7890da3f2455" +dependencies = [ + "base64 0.22.1", + "hex", + "sigstore-crypto", + "sigstore-types", + "thiserror 2.0.21", +] + +[[package]] +name = "sigstore-rekor" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "641fdaaa40d0cd6e249cf1671c2240beff1a3ece578062cf43e750779e8db2b3" +dependencies = [ + "base64 0.22.1", + "hex", + "reqwest", + "serde", + "serde_json", + "sigstore-crypto", + "sigstore-merkle", + "sigstore-types", + "thiserror 2.0.21", + "url", +] + +[[package]] +name = "sigstore-trust-root" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6b0d2550f05c096400066e858db13d91f9de3b750a7541fb1291c1dc80ca290" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "rustls-pki-types", + "serde", + "serde_json", + "sigstore-crypto", + "sigstore-types", + "thiserror 2.0.21", + "x509-cert", +] + +[[package]] +name = "sigstore-tsa" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bc86c8abc1ece6832236e7e34e9baebb5d4d40490c0332b814a0d8624ca7255" +dependencies = [ + "aws-lc-rs", + "base64 0.22.1", + "chrono", + "cmpv2", + "cms", + "const-oid", + "der", + "hex", + "rand 0.10.4", + "reqwest", + "rustls-pki-types", + "rustls-webpki", + "sigstore-crypto", + "sigstore-types", + "thiserror 2.0.21", + "tracing", + "x509-cert", + "x509-tsp", +] + +[[package]] +name = "sigstore-types" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8d870c9bcfdf83396ac2bd2d6a23c5d09ec02cc9fda50fa1cbb3dd71a9bee53" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "pem", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "sigstore-verify" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d30aff69036e4579b416956e9ba68cec45b793116f78f10842d04c7f8b924bab" +dependencies = [ + "base64 0.22.1", + "chrono", + "cms", + "const-oid", + "hex", + "pem", + "rustls-pki-types", + "rustls-webpki", + "serde", + "serde_json", + "serde_json_canonicalizer", + "sigstore-bundle", + "sigstore-crypto", + "sigstore-merkle", + "sigstore-rekor", + "sigstore-trust-root", + "sigstore-tsa", + "sigstore-types", + "thiserror 2.0.21", + "tls_codec", + "tracing", + "x509-cert", +] + [[package]] name = "simd-adler32" version = "0.3.10" @@ -6032,6 +7235,16 @@ dependencies = [ "serde", ] +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + [[package]] name = "spirv" version = "0.4.0+sdk-1.4.341.0" @@ -6041,6 +7254,16 @@ dependencies = [ "bitflags 2.13.2", ] +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -6073,6 +7296,27 @@ dependencies = [ "unicode-properties", ] +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "subsetter" version = "0.2.6" @@ -6296,6 +7540,16 @@ dependencies = [ "symphonia-metadata", ] +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.119" @@ -6318,6 +7572,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + [[package]] name = "synstructure" version = "0.14.0" @@ -6341,6 +7604,27 @@ dependencies = [ "web-sys", ] +[[package]] +name = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "system-deps" version = "7.0.8" @@ -6362,6 +7646,7 @@ checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840" dependencies = [ "filetime", "libc", + "xattr", ] [[package]] @@ -6496,7 +7781,7 @@ dependencies = [ "bytemuck", "cfg-if", "log", - "png", + "png 0.18.1", "tiny-skia-path", ] @@ -6528,13 +7813,63 @@ version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" +[[package]] +name = "tls_codec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de2e01245e2bb89d6f05801c564fa27624dbd7b1846859876c7dad82e90bf6b" +dependencies = [ + "tls_codec_derive", + "zeroize", +] + +[[package]] +name = "tls_codec_derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2e76690929402faae40aebdda620a2c0e25dd6d3b9afe48867dfd95991f4bd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "tokio" version = "1.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e95f91fcc7a621e8b030f6aa23c71fe9838ae2fb4d8118b75602a328f5144044" dependencies = [ + "bytes", + "libc", + "mio", "pin-project-lite", + "socket2", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "libc", + "pin-project-lite", + "tokio", ] [[package]] @@ -6591,6 +7926,51 @@ version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags 2.13.2", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + [[package]] name = "tracing" version = "0.1.44" @@ -6634,6 +8014,12 @@ dependencies = [ "petgraph", ] +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "ttf-parser" version = "0.25.1" @@ -6750,6 +8136,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "untrusted" version = "0.9.0" @@ -6771,6 +8163,7 @@ dependencies = [ "rustls-platform-verifier", "ureq-proto", "utf8-zero", + "webpki-roots", ] [[package]] @@ -6888,7 +8281,7 @@ dependencies = [ "guillotiere", "log", "peniko", - "png", + "png 0.18.1", "smallvec", "thiserror 2.0.21", ] @@ -6904,7 +8297,7 @@ dependencies = [ "glifo", "hashbrown 0.17.1", "ordered-channel", - "png", + "png 0.18.1", "rayon", "thread_local", "vello_common", @@ -6942,6 +8335,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" @@ -7247,6 +8649,15 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "webpki-roots" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5f280bbb2b287bc8e7de7e3852945a0ff50d1bbcb5ed42b6c7a568c546df171" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "weezl" version = "0.1.12" @@ -7817,6 +9228,28 @@ dependencies = [ "memchr", ] +[[package]] +name = "winprint" +version = "0.2.1" +source = "git+https://github.com/storytold/winprint.rs?rev=8ae097ef941b432b0e7671b1ec3a506800e65e57#8ae097ef941b432b0e7671b1ec3a506800e65e57" +dependencies = [ + "flate2", + "fmt-derive", + "reqwest", + "scopeguard", + "sigstore-trust-root", + "sigstore-types", + "sigstore-verify", + "strum", + "tar", + "thiserror 2.0.21", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-implement", + "windows-numerics", + "xml", +] + [[package]] name = "winreg" version = "0.55.0" @@ -7843,6 +9276,16 @@ version = "0.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ef0ffc427f045c0cc9ebffd6f4f91153dcd2a1547b5c3c29ee3f541e16e95c6" +[[package]] +name = "winx" +version = "0.36.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f3fd376f71958b862e7afb20cfe5a22830e1963462f3a17f49d82a6c1d1f42d" +dependencies = [ + "bitflags 2.13.2", + "windows-sys 0.52.0", +] + [[package]] name = "wit-bindgen" version = "0.57.1" @@ -7895,6 +9338,16 @@ dependencies = [ "either", ] +[[package]] +name = "wuff" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6a992b57b3d1ee972b2e3fd9225e44793104d49818836dd812d5459187712dd" +dependencies = [ + "brotli-decompressor", + "bytes", +] + [[package]] name = "x11-dl" version = "2.21.0" @@ -7927,6 +9380,41 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" +[[package]] +name = "x509-cert" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1301e935010a701ae5f8655edc0ad17c44bad3ac5ce8c39185f75453b720ae94" +dependencies = [ + "const-oid", + "der", + "sha1", + "signature", + "spki", + "tls_codec", +] + +[[package]] +name = "x509-tsp" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5ceece934a21607055b7ac5c25adb56a2ff559804b10705dc674d1d838c15e1" +dependencies = [ + "cmpv2", + "cms", + "der", +] + +[[package]] +name = "xattr" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" +dependencies = [ + "libc", + "rustix 1.1.6", +] + [[package]] name = "xcap" version = "0.9.8" @@ -7994,6 +9482,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" +[[package]] +name = "xml" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f45bb2c13fec6a6cb4c0f76a7e94839e110a14ec803ec2940777a94c347bc52" + [[package]] name = "xml-rs" version = "0.8.29" @@ -8019,6 +9513,17 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" +[[package]] +name = "yeslogic-fontconfig-sys" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8b8abf912b9a29ff112e1671c97c33636903d13a69712037190e6805af4f76" +dependencies = [ + "dlib", + "once_cell", + "pkg-config", +] + [[package]] name = "yoke" version = "0.8.3" @@ -8194,6 +9699,20 @@ name = "zeroize" version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] [[package]] name = "zerotrie" diff --git a/crates/pptx/src/convert.rs b/crates/pptx/src/convert.rs index 3a31b1a3f..e977b827c 100644 --- a/crates/pptx/src/convert.rs +++ b/crates/pptx/src/convert.rs @@ -1281,6 +1281,9 @@ fn chart_kept_from(k: cd_chart::ChartKept) -> dm_chart::ChartKept { fn chart_to(c: &dm_chart::Chart) -> cd_chart::Chart { let mut out = cd_chart::Chart { + // P3(unowned): earlier framework Chart fields (no contract id) + category_format: Default::default(), + date_1904: Default::default(), kind: chart_type_to(c.kind), title: c.title.clone(), categories: c.categories.clone(), diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml index 166eba220..bf30974ed 100644 --- a/crates/ui-egui/Cargo.toml +++ b/crates/ui-egui/Cargo.toml @@ -9,6 +9,7 @@ description = "DeckCraft egui frontend (PowerPoint-style UI); swappable — noth workspace = true [dependencies] +craft = { path = "../../../fw-int/crates/craft", features = ["ui", "platform", "settings", "window", "color-ui", "menu", "font-manager", "font-catalog", "review", "text", "web-host", "quit", "automation"] } deckcraft-geom = { workspace = true } deckcraft-color = { workspace = true } deckcraft-model = { workspace = true } diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 6fa915a29..99eafbbc8 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -1,4 +1,6 @@ use super::clock::{monotonic_secs, now_ms}; +pub(crate) mod catalog; +pub(crate) mod scheme; use super::ime_hooks::ime_in_ui_pass_key; use super::services::{InboxEvent, Services}; use super::state::{FilePlace, FilePurpose, ImeDescriptorKey, ImeDestination, ImeTerminalStamp, LocatedPlace, RECENT_MAX, UiState, ViewMode}; @@ -39,7 +41,72 @@ impl SlideApp { /// synthetic input, and timing fields. pub fn new(session: Session, mut services: Services) -> Self { let audio_out = services.audio_out.take(); + // P3(shell-w11): sh.A8 + let catalog = match craft::ui::runtime::commands::AppCatalog::new(Vec::new(), 0) { + Ok(catalog) => catalog, + Err(_) => todo!("sh.A8"), + }; SlideApp { + // P3(shell-w11): sh.A8 + host: craft::host::Host::builder(craft::host::AppInfo { + id: "deckcraft", + name: "DeckCraft".into(), + version: env!("CARGO_PKG_VERSION").into(), + }) + .build(), + // P3(shell-w11): sh.A8 + control: Default::default(), + // P3(shell-w11): sh.A8 + autosave: Default::default(), + // P3(shell-w11): sh.A8 + notices: Default::default(), + // P3(shell-w11): sh.A8 + palette_open: Default::default(), + // P3(shell-w11): sh.A8 + palette_recents: Default::default(), + // P3(shell-w11): sh.A8 + catalog: catalog, + // P3(shell-w11): sh.A8 + catalog_generation: Default::default(), + // P3(shell-w11): sh.A8 + injected_target: Default::default(), + // P3(shell-w11): sh.A8 + clock: Default::default(), + // P3(shell-w11): sh.A8 + opening_jobs: Default::default(), + // P3(shell-w11): dl.A1 + dialogs: Default::default(), + // P3(shell-w11): pn.A12 + format_pane: Default::default(), + // P3(shell-w11): pn.A12 + anim_pane: Default::default(), + // P3(shell-w11): pn.A12 + fill_editor: Default::default(), + // P3(shell-w11): pn.A12 + comments_pane: Default::default(), + // P3(shell-w11): pn.A12 + pane_menu: Default::default(), + // P3(shell-w11): pn.A12 + smartart_focus: Default::default(), + // P3(shell-w11): pn.A12 + slide_reveal: Default::default(), + // P3(shell-w11): rb.A15 + insert_zoom: Default::default(), + // P3(shell-w11): rb.A15 + smooth_corners: Default::default(), + // P3(shell-w11): wg.A3 + host_answers: Default::default(), + // P3(shell-w11): wg.A4 + icon_sheet: Default::default(), + // P3(shell-w11): cv.A1 + canvas_view: craft::behavior::CanvasView::new(egui::Rect::NOTHING, craft::behavior::kurbo::Point::ZERO, 1.0), + // P3(shell-w11): cv.A1 + picture: Default::default(), + // P3(shell-w11): cv.A1 + ruler_tab_kind: Default::default(), + // P3(shell-w11): cv.A1 + canvas_menu: Default::default(), + last_fill: serde_json::json!("accent1"), last_outline: serde_json::json!("tx1"), table_pen: serde_json::json!({"width": 1.0}), @@ -155,12 +222,14 @@ impl SlideApp { /// The transient status message while it is fresh; clears it once stale. Both the status bar /// and the start screen draw it — the start screen has no status bar, and errors raised there /// (a missing recent file, a failed sample) used to vanish (issue #172). - pub fn fresh_status(&mut self) -> Option { - let (msg, at) = self.status.clone()?; + pub(crate) fn fresh_status(&self) -> Option<&str> { + // P3(shell-w11): sh.A12 + let (msg, at) = self.status.as_ref()?; if now_ms() - at < STATUS_LINGER_MS { - Some(msg) + Some(msg.as_str()) } else { - self.status = None; + // P3(shell-w11): sh.A12 + let _ = &self.status; None } } @@ -317,7 +386,8 @@ impl SlideApp { self.sync_backstage(); self.keyboard(&ctx); self.sync_backstage(); - ribbon::title_bar(self, ui); + // P3(shell-w11): rb.A2 + craft::ui::contract::ShowContainer::show(craft::ui::layout_components::Stack::new(), ui, |ui, cx| ribbon::title_bar(self, ui, cx)); if self.backstage.is_none() && self.session.active().is_some() { ribbon::show(self, ui); status::status_bar(self, ui); @@ -378,3 +448,43 @@ impl SlideApp { self.pending_urls.push(url.to_string()); } } + +impl crate::SlideApp { + /// Holds closing while a document needs its closing prompt. + #[allow(dead_code)] // P3(shell-w11): sh.A3 + pub fn close_decision(&mut self) -> craft::ui::shell::embed::CloseDecision { + todo!("sh.A3") + } +} + +impl crate::SlideApp { + /// Flushes settings and runs the platform exit work once. + #[allow(dead_code)] // P3(shell-w11): sh.A4 + pub fn leave(&mut self) { + todo!("sh.A4") + } +} + +impl crate::SlideApp { + /// Derives the canvas geometry from the canvas view. + #[allow(dead_code)] // P3(shell-w11): cv.A1 + pub fn canvas_rect(&self) -> Option { + todo!("cv.A1") + } +} + +impl crate::SlideApp { + /// Derives the canvas geometry from the canvas view. + #[allow(dead_code)] // P3(shell-w11): cv.A1 + pub fn slide_rect(&self) -> Option { + todo!("cv.A1") + } +} + +impl crate::SlideApp { + /// Derives the canvas geometry from the canvas view. + #[allow(dead_code)] // P3(shell-w11): cv.A1 + pub fn canvas_scale(&self) -> f32 { + todo!("cv.A1") + } +} diff --git a/crates/ui-egui/src/app/catalog.rs b/crates/ui-egui/src/app/catalog.rs new file mode 100644 index 000000000..209deaf6d --- /dev/null +++ b/crates/ui-egui/src/app/catalog.rs @@ -0,0 +1,62 @@ +use crate::{Session, SlideApp}; +use craft::ui::runtime::commands::{AppCatalog, CommandStates}; + +/// A UI command and its parameter documentation. +#[allow(dead_code)] // P3(shell-w4): sh.A14 +pub struct UiCommand { + /// Command id. + pub id: &'static str, + /// Visible command label. + pub label: &'static str, + /// Parameter documentation. + pub params: &'static str, +} + +/// The UI commands shared by the app. +#[allow(dead_code)] // P3(shell-w4): sh.A14 +pub static UI_COMMANDS: &[UiCommand] = &[]; + +/// A default app chord bound to a command and its parameters. +#[allow(dead_code)] // P3(shell-w4): sh.A14 +pub(crate) struct DefaultChord { + pub keys: &'static [&'static str], + pub id: &'static str, + pub params: &'static str, + pub label: &'static str, +} + +/// The app default chord bindings. +#[allow(dead_code)] // P3(shell-w4): sh.A14 +pub(crate) static DEFAULT_CHORDS: &[DefaultChord] = &[]; + +/// Builds the app command catalogue and its defaults. +#[allow(dead_code)] // P3(shell-w4): sh.A15 +pub(crate) fn build(session: &Session, generation: u64) -> AppCatalog { + let _ = (session, generation); + todo!("sh.A15") +} + +/// Whether an id belongs to an app UI command. +#[allow(dead_code)] // P3(shell-w4): sh.A15 +pub fn is_ui_command(id: &str) -> bool { + let _ = id; + todo!("sh.A15") +} + +/// The edit command corresponding to an app command. +#[allow(dead_code)] // P3(shell-w4): sh.A15 +pub(crate) fn edit_command_of(id: &str) -> &str { + let _ = id; + todo!("sh.A15") +} + +/// Publishes enabled states and the ribbon command states. +#[allow(dead_code)] // P3(shell-w4): sh.A15 +pub(crate) fn command_states(app: &mut SlideApp) -> CommandStates { + let _ = app; + todo!("sh.A15") +} + +/// Commands admitted while no document is open. +#[allow(dead_code)] // P3(shell-w4): sh.A15 +pub(crate) const START_SCREEN: &[&str] = &["app.openDialog", "app.palette", "app.preferences", "app.backstage", "file.new"]; diff --git a/crates/ui-egui/src/app/clipboard.rs b/crates/ui-egui/src/app/clipboard.rs index f6003dd04..913fbc32d 100644 --- a/crates/ui-egui/src/app/clipboard.rs +++ b/crates/ui-egui/src/app/clipboard.rs @@ -64,7 +64,8 @@ impl SlideApp { /// back into DeckCraft still uses the internal clipboard. A textless shape leaves the /// invisible [`OBJECTS_MARKER`] rather than a picture: with only an image on the clipboard /// egui-winit drops Ctrl+V, and the shortcut could no longer paste the shape here (#182). - pub(super) fn publish_clipboard(&mut self, ctx: &egui::Context, cut: bool) { + // P3(shell-w4): sh.A17 + pub(crate) fn publish_clipboard(&mut self, ctx: &egui::Context, cut: bool) { let cmd = if cut { "edit.cut" } else { "edit.copy" }; let Ok(v) = self.session.execute(cmd, &json!({})) else { return }; let text = v.get("text").and_then(Value::as_str).unwrap_or("").to_string(); @@ -76,3 +77,14 @@ impl SlideApp { ctx.copy_text(system_clipboard_text(&text)); } } + +impl crate::SlideApp {} + +impl crate::SlideApp { + /// Pastes content from the framework clipboard. + #[allow(dead_code)] // P3(shell-w4): sh.A17 + pub(crate) fn paste(&mut self, ctx: &egui::Context, pasted: Option) { + let _ = (ctx, pasted); + todo!("sh.A17") + } +} diff --git a/crates/ui-egui/src/app/commands.rs b/crates/ui-egui/src/app/commands.rs index e5c43af1a..352f6e000 100644 --- a/crates/ui-egui/src/app/commands.rs +++ b/crates/ui-egui/src/app/commands.rs @@ -241,7 +241,8 @@ impl SlideApp { if self.services.pick_open.is_none() { return Err("picking a Diagram picture needs the desktop app".into()); } - self.pick_and_run("picture", "smartArt.picture", p); + // P3(shell-w4): sh.A23 + self.pick_and_run("picture", "smartArt.picture", p.clone()); } "app.changePictureDialog" => self.pick_and_insert("picture", "picture.change"), "app.insertAudioDialog" => self.pick_and_insert("audio", "insert.audio"), @@ -292,3 +293,12 @@ impl SlideApp { Ok(Value::Null) } } + +impl crate::SlideApp { + /// Runs a fired command, including app save and palette actions. + #[allow(dead_code)] // P3(shell-w4): sh.A16 + pub(crate) fn fire(&mut self, fired: &craft::ui::runtime::commands::Fired) { + let _ = fired; + todo!("sh.A16") + } +} diff --git a/crates/ui-egui/src/app/control.rs b/crates/ui-egui/src/app/control.rs index 81e6c4798..ce0140d14 100644 --- a/crates/ui-egui/src/app/control.rs +++ b/crates/ui-egui/src/app/control.rs @@ -43,3 +43,12 @@ impl SlideApp { } } } + +impl crate::SlideApp { + /// Issues screenshot requests through the library control channel. + #[allow(dead_code)] // P3(shell-w5): sh.A20 + pub(crate) fn issue_captures(&mut self, ui: &mut egui::Ui) { + let _ = ui; + todo!("sh.A20") + } +} diff --git a/crates/ui-egui/src/app/files.rs b/crates/ui-egui/src/app/files.rs index 5d2d49d37..9ffc424e7 100644 --- a/crates/ui-egui/src/app/files.rs +++ b/crates/ui-egui/src/app/files.rs @@ -416,11 +416,14 @@ impl SlideApp { } pub(crate) fn pick_and_insert(&mut self, purpose: &str, cmd: &str) { - self.pick_and_run(purpose, cmd, &json!({})); + // P3(shell-w6): sh.A23 + self.pick_and_run(purpose, cmd, json!({})); } /// Pick a file and run `cmd` with it (`name` + `data`, or `path`) added to `extra`. - pub(super) fn pick_and_run(&mut self, purpose: &str, cmd: &str, extra: &Value) { + pub(crate) fn pick_and_run(&mut self, purpose: &str, command: &str, params: Value) { + // P3(shell-w6): sh.A23 + let (cmd, extra) = (command, ¶ms); if let Some(pick) = self.services.pick_open.as_mut() { if let Some(path) = pick(purpose) { let mut args = if extra.is_object() { extra.clone() } else { json!({}) }; @@ -644,7 +647,9 @@ impl SlideApp { /// A dropped or picked file read synchronously: presentations open, media is inserted on /// the slide that is current now. - pub fn open_or_insert_bytes(&mut self, name: &str, bytes: &[u8]) { + pub(crate) fn open_or_insert_bytes(&mut self, name: &str, bytes: Vec) { + // P3(shell-w6): sh.A23 + let bytes = bytes.as_slice(); let id = self.begin_external_file("drop"); self.apply_external_file(id, name, bytes); } @@ -872,3 +877,39 @@ mod print_preview_tests { std::fs::remove_dir(base).unwrap(); } } + +impl crate::SlideApp { + /// Consumes file answers from the installed host. + #[allow(dead_code)] // P3(shell-w6): sh.A23 + pub(crate) fn take_file_answers(&mut self) { + todo!("sh.A23") + } +} + +/// The closing prompt save result, including a pending file pick. +#[allow(dead_code)] // P3(shell-w6): dl.A8 +pub(crate) enum SaveOutcome { + Saved, + Downloaded, + Failed(String), + Cancelled, + Pending, +} + +impl crate::SlideApp { + /// Saves a document for the closing prompt. + #[allow(dead_code)] // P3(shell-w6): dl.A8 + pub(crate) fn save_document(&mut self, uid: u64) -> SaveOutcome { + let _ = uid; + todo!("dl.A8") + } +} + +impl crate::SlideApp { + /// Settles a closing save when its file pick answers. + #[allow(dead_code)] // P3(shell-w6): dl.A8 + pub(crate) fn save_settled(&mut self, uid: u64, outcome: SaveOutcome) { + let _ = (uid, outcome); + todo!("dl.A8") + } +} diff --git a/crates/ui-egui/src/app/input.rs b/crates/ui-egui/src/app/input.rs index c50601712..f71b851b7 100644 --- a/crates/ui-egui/src/app/input.rs +++ b/crates/ui-egui/src/app/input.rs @@ -206,7 +206,8 @@ impl SlideApp { for f in std::mem::take(&mut raw.dropped_files) { let name = f.path().file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_else(|| "dropped file".into()); match f.bytes() { - Ok(bytes) => self.open_or_insert_bytes(&name, &bytes), + // P3(shell-w5): sh.A23 + Ok(bytes) => self.open_or_insert_bytes(&name, bytes), Err(e) => self.set_status(e), } } @@ -268,3 +269,20 @@ impl SlideApp { self.synthetic_focus = focus; } } + +impl crate::SlideApp { + /// Records injected input for the current target. + #[allow(dead_code)] // P3(shell-w5): sh.A21 + pub(crate) fn note_injected(&mut self) { + todo!("sh.A21") + } +} + +impl crate::SlideApp { + /// Withdraws injected input when its target changed. + #[allow(dead_code)] // P3(shell-w5): sh.A21 + pub(crate) fn withdraw_if_retargeted(&mut self, ctx: &egui::Context) { + let _ = ctx; + todo!("sh.A21") + } +} diff --git a/crates/ui-egui/src/app/keys.rs b/crates/ui-egui/src/app/keys.rs index 7523308c0..7a845c05b 100644 --- a/crates/ui-egui/src/app/keys.rs +++ b/crates/ui-egui/src/app/keys.rs @@ -251,3 +251,7 @@ fn color_image_png(image: &egui::ColorImage) -> Result, String> { let rgba: Vec = image.pixels.iter().flat_map(|c| c.to_array()).collect(); Ok(deckcraft_render::Image { width: w as u32, height: h as u32, pixels: rgba }.to_png()) } + +/// The Alt digit chords reserved for the quick access toolbar. +#[allow(dead_code)] // P3(shell-w4): sh.A19 +pub(crate) const QAT_CLAIMS: &'static [craft::keymap::Chord] = &[]; diff --git a/crates/ui-egui/src/app/playback.rs b/crates/ui-egui/src/app/playback.rs index c46286807..d1a9bcea6 100644 --- a/crates/ui-egui/src/app/playback.rs +++ b/crates/ui-egui/src/app/playback.rs @@ -140,7 +140,17 @@ impl SlideApp { } self.close_backstage(); let duration = timeline.total_duration(); - self.anim_preview = Some(AnimPreview { uid, slide, slide_ptr: ptr, started: None, from: from_secs, elapsed: from_secs, timeline }); + self.anim_preview = Some(AnimPreview { + // P3(show-w9): cv.A1 + held: Default::default(), + uid, + slide, + slide_ptr: ptr, + started: None, + from: from_secs, + elapsed: from_secs, + timeline, + }); self.set_status("Previewing animations"); Ok(json!({"playing": true, "slide": slide, "duration": duration, "from": from_secs})) } @@ -183,3 +193,21 @@ impl SlideApp { } } } + +impl crate::SlideApp { + /// Holds animation preview at a requested time. + #[allow(dead_code)] // P3(show-w9): cv.A8 + pub fn hold_anim_preview(&mut self, time: Option) -> Result { + let _ = time; + todo!("cv.A8") + } +} + +impl crate::SlideApp { + /// Starts a show with an explicit presenter mode. + #[allow(dead_code)] // P3(show-w9): ss.A6 + pub(crate) fn start_show_with(&mut self, from: usize, reading: bool, presenter: crate::show::PresenterStart) { + let _ = (from, reading, presenter); + todo!("ss.A6") + } +} diff --git a/crates/ui-egui/src/app/scheme.rs b/crates/ui-egui/src/app/scheme.rs new file mode 100644 index 000000000..cb627a1f7 --- /dev/null +++ b/crates/ui-egui/src/app/scheme.rs @@ -0,0 +1,7 @@ +impl crate::SlideApp { + /// Returns the current presentation colour scheme. + #[allow(dead_code)] // P3(panels-w8): pn.A6 + pub(crate) fn color_scheme(&self) -> deckcraft_color::ColorScheme { + todo!("pn.A6") + } +} diff --git a/crates/ui-egui/src/backstage.rs b/crates/ui-egui/src/backstage.rs index 814669728..d49d281b8 100644 --- a/crates/ui-egui/src/backstage.rs +++ b/crates/ui-egui/src/backstage.rs @@ -405,7 +405,8 @@ pub fn show(app: &mut SlideApp, ui: &mut Ui) { // otherwise vanish: the status bar only draws once the backstage is closed (#172). // A real label, not painted text, so screen readers see it too. if let Some(msg) = app.fresh_status() { - ui.label(RichText::new(&msg).font(theme::font(12.0)).color(t.accent)); + // P3(shell-w7): sh.A12 + ui.label(RichText::new(msg).font(theme::font(12.0)).color(t.accent)); ui.add_space(8.0); ui.ctx().request_repaint_after(std::time::Duration::from_millis(500)); } @@ -514,3 +515,10 @@ fn bullets(ui: &mut Ui, items: &[&str]) { #[cfg(test)] mod tests; + +/// Shows the File page as a shell page. +#[allow(dead_code)] // P3(shell-w7): sh.A24 +pub(crate) fn page(app: &mut SlideApp, ui: &mut egui::Ui, cx: &mut craft::ui::contract::BodyCx<'_>) { + let _ = (app, ui, cx); + todo!("sh.A24") +} diff --git a/crates/ui-egui/src/backstage/info.rs b/crates/ui-egui/src/backstage/info.rs index c01168467..0c833f96e 100644 --- a/crates/ui-egui/src/backstage/info.rs +++ b/crates/ui-egui/src/backstage/info.rs @@ -156,7 +156,8 @@ pub(super) fn save_as(app: &mut SlideApp, ui: &mut Ui, bs: &mut Backstage, out: ui.add_space(14.0); let current = SAVE_TYPES.iter().find(|s| s.0 == bs.file_type).map_or(SAVE_TYPES[0].1, |s| s.1); ui.horizontal(|ui| { - craft_ui::ComboBox::from_id_salt("backstage_save_type") + // P3(shell-w8): earlier framework ComboBox removal (no contract id) + egui::ComboBox::from_id_salt("backstage_save_type") .width(340.0) // Every type in view: at the default height the last ones were behind a scroll. .height(f32::INFINITY) @@ -234,7 +235,8 @@ pub(super) fn about(app: &mut SlideApp, ui: &mut Ui) { ui.set_width(340.0); heading(ui, "Appearance"); let dark = app.ui.brightness == theme::Brightness::Dark; - craft_ui::ComboBox::from_id_salt("backstage_appearance") + // P3(shell-w8): earlier framework ComboBox removal (no contract id) + egui::ComboBox::from_id_salt("backstage_appearance") .width(260.0) .selected_text(if dark { "Dark" } else { "Light" }) .show_ui(ui, |ui| { diff --git a/crates/ui-egui/src/backstage/print.rs b/crates/ui-egui/src/backstage/print.rs index f345fb73b..4e4a0fa8b 100644 --- a/crates/ui-egui/src/backstage/print.rs +++ b/crates/ui-egui/src/backstage/print.rs @@ -96,7 +96,8 @@ pub(super) fn print(app: &mut SlideApp, ui: &mut Ui, bs: &mut Backstage) { PrintScope::Current => "Print Current Slide", PrintScope::Custom => "Custom Range", }; - let combo = craft_ui::ComboBox::from_id_salt("backstage_print_scope").width(240.0).selected_text(scope).show_ui(ui, |ui| { + // P3(shell-w8): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("backstage_print_scope").width(240.0).selected_text(scope).show_ui(ui, |ui| { for (s, label) in [(PrintScope::All, "Print All Slides"), (PrintScope::Current, "Print Current Slide"), (PrintScope::Custom, "Custom Range")] { @@ -119,7 +120,8 @@ pub(super) fn print(app: &mut SlideApp, ui: &mut Ui, bs: &mut Backstage) { }); ui.add_space(4.0); let layout = LAYOUTS.iter().find(|l| l.0 == bs.print_layout).map_or("Full Page Slides", |l| l.1); - let combo = craft_ui::ComboBox::from_id_salt("backstage_print_layout").width(240.0).selected_text(layout).show_ui(ui, |ui| { + // P3(shell-w8): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("backstage_print_layout").width(240.0).selected_text(layout).show_ui(ui, |ui| { for (id, label) in LAYOUTS { if ui.selectable_label(bs.print_layout == id, label).clicked() { bs.print_layout = id; @@ -133,7 +135,8 @@ pub(super) fn print(app: &mut SlideApp, ui: &mut Ui, bs: &mut Backstage) { // for notes pages and handouts. ui.add_enabled_ui(bs.print_layout != "slides", |ui| { let paper = deckcraft_engine::cmd::file::PAPERS.iter().find(|p| p.0 == bs.print_paper).map_or("Letter", |p| p.1); - craft_ui::ComboBox::from_id_salt("backstage_print_paper") + // P3(shell-w8): earlier framework ComboBox removal (no contract id) + egui::ComboBox::from_id_salt("backstage_print_paper") .width(240.0) .selected_text(paper) .show_ui(ui, |ui| { @@ -147,7 +150,8 @@ pub(super) fn print(app: &mut SlideApp, ui: &mut Ui, bs: &mut Backstage) { .widget_info(|| egui::WidgetInfo::labeled(egui::Role::ComboBox, true, "Paper size")); ui.add_space(4.0); let orient = if bs.print_landscape { "Landscape Orientation" } else { "Portrait Orientation" }; - craft_ui::ComboBox::from_id_salt("backstage_print_orientation") + // P3(shell-w8): earlier framework ComboBox removal (no contract id) + egui::ComboBox::from_id_salt("backstage_print_orientation") .width(240.0) .selected_text(orient) .show_ui(ui, |ui| { @@ -321,7 +325,8 @@ pub(super) fn export(app: &mut SlideApp, ui: &mut Ui, bs: &mut Backstage) { ExportTask::Handouts => { ui.label(RichText::new("Create Handouts").font(theme::font(16.0)).color(t.text)); bullets(ui, &["Several slides on each page of a PDF", "Three a page leaves lines for notes", "Print them for your audience"]); - let combo = craft_ui::ComboBox::from_id_salt("backstage_handouts") + // P3(shell-w8): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("backstage_handouts") .width(240.0) .selected_text(format!("{} slides per page", bs.handouts_per_page)) .show_ui(ui, |ui| { diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 526d046cd..f7e93e49f 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -15,7 +15,7 @@ use serde_json::json; use crate::SlideApp; use crate::theme::{self, Tokens}; -mod context_menu; +pub(crate) mod context_menu; mod guides; mod ime; mod input; @@ -405,3 +405,8 @@ mod guides_tests; #[cfg(test)] #[path = "media_bar_tests.rs"] mod media_bar_tests; + +pub(crate) mod handles; +pub(crate) mod picture; +pub(crate) mod previews; +pub(crate) mod tool; diff --git a/crates/ui-egui/src/canvas/context_menu.rs b/crates/ui-egui/src/canvas/context_menu.rs index 1aa1c9286..e180bcce4 100644 --- a/crates/ui-egui/src/canvas/context_menu.rs +++ b/crates/ui-egui/src/canvas/context_menu.rs @@ -298,3 +298,14 @@ fn slide_items(app: &mut SlideApp, ui: &mut egui::Ui) { ui.close(); } } + +/// The canvas context menu state. +#[allow(dead_code)] // P3(canvas-w11): cv.A6 +pub struct CanvasMenu; + +/// Shows the canvas command menu with published command states. +#[allow(dead_code)] // P3(canvas-w11): cv.A6 +pub(crate) fn show(app: &mut crate::SlideApp, ui: &mut egui::Ui, canvas: &egui::Response, ask: Option) { + let _ = (app, ui, canvas, ask); + todo!("cv.A6") +} diff --git a/crates/ui-egui/src/canvas/guides.rs b/crates/ui-egui/src/canvas/guides.rs index 50899615e..5dada2091 100644 --- a/crates/ui-egui/src/canvas/guides.rs +++ b/crates/ui-egui/src/canvas/guides.rs @@ -83,3 +83,17 @@ pub(super) fn draw_grid(painter: &egui::Painter, slide: Rect, step: f32) { fn grid_fits(span: f32, step: f32) -> bool { span.is_finite() && span > 0.0 && step >= 1.0 && span / step <= 800.0 } + +/// Paints or hosts this canvas part over the slide picture. +#[allow(dead_code)] // P3(canvas-w10): cv.A3 +pub(crate) fn show_grid(app: &mut crate::SlideApp, ui: &mut egui::Ui, space: &craft::ui::canvas::CanvasSpace) { + let _ = (app, ui, space); + todo!("cv.A3") +} + +/// Paints or hosts this canvas part over the slide picture. +#[allow(dead_code)] // P3(canvas-w10): cv.A3 +pub(crate) fn show_guides(app: &mut crate::SlideApp, ui: &mut egui::Ui, space: &craft::ui::canvas::CanvasSpace) { + let _ = (app, ui, space); + todo!("cv.A3") +} diff --git a/crates/ui-egui/src/canvas/handles.rs b/crates/ui-egui/src/canvas/handles.rs new file mode 100644 index 000000000..b166332e3 --- /dev/null +++ b/crates/ui-egui/src/canvas/handles.rs @@ -0,0 +1,6 @@ +/// Paints or hosts this canvas part over the slide picture. +#[allow(dead_code)] // P3(canvas-w9): cv.A3 +pub(crate) fn show(app: &mut crate::SlideApp, ui: &mut egui::Ui, space: &craft::ui::canvas::CanvasSpace) { + let _ = (app, ui, space); + todo!("cv.A3") +} diff --git a/crates/ui-egui/src/canvas/media.rs b/crates/ui-egui/src/canvas/media.rs index 5beb44b16..fdffaf83e 100644 --- a/crates/ui-egui/src/canvas/media.rs +++ b/crates/ui-egui/src/canvas/media.rs @@ -73,3 +73,17 @@ pub(super) fn media_bar(app: &mut SlideApp, ui: &mut Ui, xf: Xf) { None => {} } } + +/// Paints or hosts this canvas part over the slide picture. +#[allow(dead_code)] // P3(canvas-w14): cv.A3 +pub(crate) fn show_frames(app: &mut crate::SlideApp, ui: &mut egui::Ui, space: &craft::ui::canvas::CanvasSpace) { + let _ = (app, ui, space); + todo!("cv.A3") +} + +/// Paints or hosts this canvas part over the slide picture. +#[allow(dead_code)] // P3(canvas-w14): cv.A3 +pub(crate) fn show_controls(app: &mut crate::SlideApp, ui: &mut egui::Ui, space: &craft::ui::canvas::CanvasSpace) { + let _ = (app, ui, space); + todo!("cv.A3") +} diff --git a/crates/ui-egui/src/canvas/picture.rs b/crates/ui-egui/src/canvas/picture.rs new file mode 100644 index 000000000..8de97ba11 --- /dev/null +++ b/crates/ui-egui/src/canvas/picture.rs @@ -0,0 +1,15 @@ +/// The cached slide picture, its bounds and render statistics. +#[allow(dead_code)] // P3(canvas-w7): cv.A5 +#[derive(Default)] +pub struct SlidePicture { + pub canvas_renders: u64, + pub region: Option, + pub last_render_ms: f64, +} + +/// Shows the slide picture through the raster display. +#[allow(dead_code)] // P3(canvas-w7): cv.A5 +pub(crate) fn show(app: &mut crate::SlideApp, ui: &mut egui::Ui, space: &craft::ui::canvas::CanvasSpace) { + let _ = (app, ui, space); + todo!("cv.A5") +} diff --git a/crates/ui-egui/src/canvas/previews.rs b/crates/ui-egui/src/canvas/previews.rs new file mode 100644 index 000000000..965088d27 --- /dev/null +++ b/crates/ui-egui/src/canvas/previews.rs @@ -0,0 +1,6 @@ +/// Paints animation preview overlays. +#[allow(dead_code)] // P3(canvas-w9): cv.A3 +pub(crate) fn paint(draw: &craft::ui::primitives::Draw<'_>, view: &craft::behavior::CanvasView, app: &crate::SlideApp) { + let _ = (draw, view, app); + todo!("cv.A3") +} diff --git a/crates/ui-egui/src/canvas/rulers.rs b/crates/ui-egui/src/canvas/rulers.rs index db7149912..cca9cea13 100644 --- a/crates/ui-egui/src/canvas/rulers.rs +++ b/crates/ui-egui/src/canvas/rulers.rs @@ -233,3 +233,17 @@ fn tab_glyph(p: &egui::Painter, at: Pos2, align: &str, col: Color32) { } } } + +/// Paints or hosts this canvas part over the slide picture. +#[allow(dead_code)] // P3(canvas-w10): cv.A3 +pub(crate) fn show_text_ruler(app: &mut crate::SlideApp, ui: &mut egui::Ui, space: &craft::ui::canvas::CanvasSpace) { + let _ = (app, ui, space); + todo!("cv.A3") +} + +/// Builds the canvas rulers with owned values. +#[allow(dead_code)] // P3(canvas-w10): cv.A3 +pub(crate) fn rulers(app: &crate::SlideApp) -> Option> { + let _ = app; + todo!("cv.A3") +} diff --git a/crates/ui-egui/src/canvas/squiggles.rs b/crates/ui-egui/src/canvas/squiggles.rs index f4437ef42..431c0f1a3 100644 --- a/crates/ui-egui/src/canvas/squiggles.rs +++ b/crates/ui-egui/src/canvas/squiggles.rs @@ -507,3 +507,19 @@ pub fn paint(painter: &egui::Painter, a: egui::Pos2, b: egui::Pos2, scale: f32) } painter.add(egui::Shape::line(pts, egui::Stroke::new(1.0, egui::Color32::from_rgb(0xE0, 0x20, 0x20)))); } + +/// Paints or hosts this canvas part over the slide picture. +#[allow(dead_code)] // P3(canvas-w12): cv.A3 +pub(crate) fn show_marks(app: &mut crate::SlideApp, ui: &mut egui::Ui, space: &craft::ui::canvas::CanvasSpace) { + let _ = (app, ui, space); + todo!("cv.A3") +} + +impl Squiggles { + /// Creates spelling work over the host job queue. + #[allow(dead_code)] // P3(canvas-w12): cv.A10 + pub(crate) fn new(jobs: Arc, wake: craft::host::Wake) -> Squiggles { + let _ = (jobs, wake); + todo!("cv.A10") + } +} diff --git a/crates/ui-egui/src/canvas/tool.rs b/crates/ui-egui/src/canvas/tool.rs new file mode 100644 index 000000000..a132f7805 --- /dev/null +++ b/crates/ui-egui/src/canvas/tool.rs @@ -0,0 +1,39 @@ +/// The engine pointer tool used by the editor canvas. +#[allow(dead_code)] // P3(canvas-w6): cv.A4 +pub(crate) struct EngineTool<'a> { + app: &'a mut crate::SlideApp, +} + +/// Returns the engine resize cursor for a handle. +#[allow(dead_code)] // P3(canvas-w6): cv.A4 +pub(crate) fn resize_cursor(session: &deckcraft_engine::Session, id: deckcraft_model::ShapeId, handle: u8) -> craft::behavior::CursorIcon { + let _ = (session, id, handle); + todo!("cv.A4") +} + +use craft::ui::canvas::{CanvasTool, ToolAction, ToolContext, ToolPath, ToolPointer}; +impl CanvasTool for EngineTool<'_> { + fn press(&mut self, pointer: &ToolPointer, cx: &mut ToolContext<'_>) -> ToolAction { + let _ = (pointer, cx); + todo!("cv.A4") + } + fn drag(&mut self, pointer: &ToolPointer, cx: &mut ToolContext<'_>) { + let _ = (pointer, cx); + todo!("cv.A4") + } + fn release(&mut self, pointer: &ToolPointer, cx: &mut ToolContext<'_>) { + let _ = (pointer, cx); + todo!("cv.A4") + } + fn cancel(&mut self, reason: craft::behavior::CancelReason, cx: &mut ToolContext<'_>) { + let _ = (reason, cx); + todo!("cv.A4") + } + fn paint(&self, draw: &craft::ui::primitives::Draw<'_>, cx: &ToolContext<'_>) { + let _ = (draw, cx); + todo!("cv.A4") + } + fn command_form(&self) -> ToolPath { + todo!("cv.A4") + } +} diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index c7575dfd9..85b22f48c 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -262,7 +262,8 @@ fn color_label(v: &Value) -> String { fn choice(ui: &mut Ui, d: &mut Dialog, salt: &str, name: &str, key: &str, choices: &[(&str, &str)]) { let cur = d.get(key, ""); let label = choices.iter().find(|(v, _)| *v == cur).map(|(_, l)| *l).unwrap_or(cur.as_str()); - let combo = craft_ui::ComboBox::from_id_salt(salt).selected_text(label).width(140.0).show_ui(ui, |ui| { + // P3(dialogs-w4): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt(salt).selected_text(label).width(140.0).show_ui(ui, |ui| { for (v, l) in choices { if ui.selectable_label(cur == *v, *l).clicked() { d.fields.insert((*key).into(), (*v).into()); @@ -327,3 +328,113 @@ mod paragraph_dialog_tests; #[cfg(test)] mod preferences_tests; + +use craft::ui::dialog::{DialogHost, DialogId}; +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; +use egui::Context; + +/// All dialog state and pending requests. +#[allow(dead_code)] // P3(dialogs-w4): dl.A2 +#[derive(Default)] +pub(crate) struct DialogState { + pub requests: Vec, + pub paragraph_draft: Option, + pub spelling: Option, + pub album_pick: Option, + pub find: find::FindProgress, + pub closing: Option, + pub preferences_opening: Option, +} + +/// A queued dialog request and its parameters. +#[allow(dead_code)] // P3(dialogs-w4): dl.A2 +pub(crate) struct DialogRequest { + pub id: String, + pub params: Value, +} + +impl crate::SlideApp { + /// Queues a dialog request for the current pass. + #[allow(dead_code)] // P3(dialogs-w4): dl.A3 + pub(crate) fn open_dialog(&mut self, id: &str, params: Value) { + let _ = (id, params); + todo!("dl.A3") + } +} + +/// The open, finish and per-pass steps for a hosted form. +#[allow(dead_code)] // P3(dialogs-w4): dl.A4 +pub(crate) struct FormSpec { + pub open: fn(&SlideApp, &Context, &Value) -> HostedParamDialog, + pub finish: fn(&mut SlideApp, &ParamResult) -> Result<(), String>, + pub held: bool, + pub each_pass: Option, +} + +/// The hosted form registry. +#[allow(dead_code)] // P3(dialogs-w4): dl.A4 +const FORMS: &[(&str, FormSpec)] = &[]; + +/// Opens a registered or typed dialog now. +#[allow(dead_code)] // P3(dialogs-w4): dl.A5 +pub(crate) fn open_now(app: &mut SlideApp, ctx: &Context, host: &mut DialogHost, id: &str, params: &Value) -> Result, String> { + let _ = (app, ctx, host, id, params); + todo!("dl.A5") +} + +/// Drains requests and advances hosted dialogs. +#[allow(dead_code)] // P3(dialogs-w4): dl.A6 +pub(crate) fn pump(app: &mut SlideApp, ctx: &Context) { + let _ = (app, ctx); + todo!("dl.A6") +} + +/// Runs a dialog control request. +#[allow(dead_code)] // P3(dialogs-w4): dl.A7 +pub(crate) fn control(app: &mut SlideApp, ctx: &Context, method: &str, params: &Value) -> Option> { + let _ = (app, ctx, method, params); + todo!("dl.A7") +} + +/// Inspects the hosted dialogs. +#[allow(dead_code)] // P3(dialogs-w4): dl.A7 +pub(crate) fn inspect(ctx: &Context) -> Value { + let _ = ctx; + todo!("dl.A7") +} + +/// Whether a hosted modal is open. +#[allow(dead_code)] // P3(dialogs-w4): dl.A7 +pub(crate) fn modal_open(ctx: &Context) -> bool { + let _ = ctx; + todo!("dl.A7") +} + +/// The top hosted dialog. +#[allow(dead_code)] // P3(dialogs-w4): dl.A7 +pub(crate) fn top_dialog(ctx: &Context) -> Option { + let _ = ctx; + todo!("dl.A7") +} + +#[cfg(test)] +/// The ids of the open dialogs. +#[allow(dead_code)] // P3(dialogs-w4): dl.A7 +pub(crate) fn open_keys(ctx: &Context) -> Vec { + let _ = ctx; + todo!("dl.A7") +} + +mod accessibility; +mod action; +mod bullets; +mod chart_data; +mod choice_forms; +mod closing; +mod custom_shows; +mod header_footer; +mod insert_forms; +mod replace_fonts; +mod reuse_slides; +mod spelling; +mod symbol; diff --git a/crates/ui-egui/src/dialogs/about.rs b/crates/ui-egui/src/dialogs/about.rs index 79fa0c7b8..193c84fdb 100644 --- a/crates/ui-egui/src/dialogs/about.rs +++ b/crates/ui-egui/src/dialogs/about.rs @@ -121,3 +121,22 @@ mod about_credits_tests { } } } + +/// Opens this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w18): dl.A10 +pub(crate) fn open( + app: &mut crate::SlideApp, + ctx: &egui::Context, + host: &mut craft::ui::dialog::DialogHost, + params: &serde_json::Value, +) -> Result, String> { + let _ = (app, ctx, host, params); + todo!("dl.A10") +} + +/// Advances this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w18): dl.A10 +pub(crate) fn pump(app: &mut crate::SlideApp, ctx: &egui::Context, host: &mut craft::ui::dialog::DialogHost) { + let _ = (app, ctx, host); + todo!("dl.A10") +} diff --git a/crates/ui-egui/src/dialogs/accessibility.rs b/crates/ui-egui/src/dialogs/accessibility.rs new file mode 100644 index 000000000..f830519f2 --- /dev/null +++ b/crates/ui-egui/src/dialogs/accessibility.rs @@ -0,0 +1,18 @@ +/// Opens this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w16): dl.A10 +pub(crate) fn open( + app: &mut crate::SlideApp, + ctx: &egui::Context, + host: &mut craft::ui::dialog::DialogHost, + params: &serde_json::Value, +) -> Result, String> { + let _ = (app, ctx, host, params); + todo!("dl.A10") +} + +/// Advances this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w16): dl.A10 +pub(crate) fn pump(app: &mut crate::SlideApp, ctx: &egui::Context, host: &mut craft::ui::dialog::DialogHost) { + let _ = (app, ctx, host); + todo!("dl.A10") +} diff --git a/crates/ui-egui/src/dialogs/action.rs b/crates/ui-egui/src/dialogs/action.rs new file mode 100644 index 000000000..7e3c4dc32 --- /dev/null +++ b/crates/ui-egui/src/dialogs/action.rs @@ -0,0 +1,15 @@ +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w12): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w12): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/alt_text.rs b/crates/ui-egui/src/dialogs/alt_text.rs index 091f958cb..fb2d78284 100644 --- a/crates/ui-egui/src/dialogs/alt_text.rs +++ b/crates/ui-egui/src/dialogs/alt_text.rs @@ -23,3 +23,19 @@ mod alt_text_tests { assert!(!alt_text_starts_decorative([true, false])); } } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w12): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w12): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/body.rs b/crates/ui-egui/src/dialogs/body.rs index 5399735ac..9b9179269 100644 --- a/crates/ui-egui/src/dialogs/body.rs +++ b/crates/ui-egui/src/dialogs/body.rs @@ -101,7 +101,8 @@ fn dlg_slide_size(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bool { } let label = ui.label("Slides sized for:"); let preset = d.get("preset", ""); - let combo = craft_ui::ComboBox::from_id_salt("sizes").selected_text(if preset.is_empty() { "Custom" } else { &preset }).show_ui(ui, |ui| { + // P3(dialogs-w4): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("sizes").selected_text(if preset.is_empty() { "Custom" } else { &preset }).show_ui(ui, |ui| { for (label, w, h) in deckcraft_model::defaults::SLIDE_SIZES { if ui.selectable_label(preset == *label, *label).clicked() { d.fields.insert("preset".into(), label.to_string()); @@ -149,7 +150,8 @@ fn dlg_header_footer(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bool { ui.add_enabled_ui(date && automatic, |ui| { ui.horizontal(|ui| { ui.label(" Format:"); - craft_ui::ComboBox::from_id_salt("hf-date-format").selected_text(label).width(200.0).show_ui(ui, |ui| { + // P3(dialogs-w4): earlier framework ComboBox removal (no contract id) + egui::ComboBox::from_id_salt("hf-date-format").selected_text(label).width(200.0).show_ui(ui, |ui| { for (kind, sample) in &rows { if ui.selectable_label(fmt == *kind, sample).clicked() { d.fields.insert("dateFormat".into(), (*kind).to_string()); @@ -264,7 +266,8 @@ fn dlg_setup_show(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bool { let chosen = d.fields.entry("custom".into()).or_insert_with(|| sh.custom_show.clone().unwrap_or_default()).clone(); let field = ui.label("Slides"); let label = if chosen.is_empty() { "All slides".to_string() } else { chosen.clone() }; - let combo = craft_ui::ComboBox::from_id_salt("setup_custom").selected_text(label).show_ui(ui, |ui| { + // P3(dialogs-w4): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("setup_custom").selected_text(label).show_ui(ui, |ui| { if ui.selectable_label(chosen.is_empty(), "All slides").clicked() { d.fields.insert("custom".into(), String::new()); } @@ -428,7 +431,8 @@ fn dlg_bullets(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bool { let color = d.get("color", ""); ui.horizontal(|ui| { let field = ui.add_sized(vec2(120.0, 20.0), egui::Label::new("Color:")); - let combo = craft_ui::ComboBox::from_id_salt("bullet-color") + // P3(dialogs-w4): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("bullet-color") .selected_text(colors.iter().find(|c| c.0 == color).map_or("Automatic", |c| c.1)) .show_ui(ui, |ui| { for (k, l) in colors { @@ -535,7 +539,8 @@ fn dlg_action(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bool { ]; let shown = targets.iter().find(|t| t.0 == kind).map_or("Next Slide", |t| t.1); ui.add_enabled_ui(hyperlink, |ui| { - let combo = craft_ui::ComboBox::from_id_salt("action-target").selected_text(shown).show_ui(ui, |ui| { + // P3(dialogs-w4): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("action-target").selected_text(shown).show_ui(ui, |ui| { for (k, l) in targets { if ui.selectable_label(kind == k, l).clicked() { d.fields.insert("kind".into(), k.into()); @@ -733,7 +738,8 @@ fn dlg_export(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bool { ui.add_space(4.0); ui.horizontal(|ui| { let field = ui.label("Print layout:"); - let combo = craft_ui::ComboBox::from_id_salt("pdf_layout") + // P3(dialogs-w4): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("pdf_layout") .selected_text(match pdf_layout.as_str() { "notes" => "Notes Pages", "h1" => "Handouts (1 slide per page)", @@ -818,7 +824,8 @@ fn dlg_replace_fonts(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bool { let mut to = d.get("to", ""); egui::Grid::new("replace_fonts").num_columns(2).spacing(vec2(10.0, 8.0)).show(ui, |ui| { let field = ui.label("Replace:"); - let combo = craft_ui::ComboBox::from_id_salt("rf_from").width(240.0).selected_text(from.clone()).show_ui(ui, |ui| { + // P3(dialogs-w4): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("rf_from").width(240.0).selected_text(from.clone()).show_ui(ui, |ui| { for f in &used { ui.selectable_value(&mut from, f.clone(), f); } diff --git a/crates/ui-egui/src/dialogs/bullets.rs b/crates/ui-egui/src/dialogs/bullets.rs new file mode 100644 index 000000000..a0d6a80d5 --- /dev/null +++ b/crates/ui-egui/src/dialogs/bullets.rs @@ -0,0 +1,15 @@ +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w10): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w10): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/chart_data.rs b/crates/ui-egui/src/dialogs/chart_data.rs new file mode 100644 index 000000000..28bbd3dca --- /dev/null +++ b/crates/ui-egui/src/dialogs/chart_data.rs @@ -0,0 +1,15 @@ +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w14): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w14): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/choice_forms.rs b/crates/ui-egui/src/dialogs/choice_forms.rs new file mode 100644 index 000000000..8006c8d81 --- /dev/null +++ b/crates/ui-egui/src/dialogs/choice_forms.rs @@ -0,0 +1,15 @@ +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w7): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w7): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/closing.rs b/crates/ui-egui/src/dialogs/closing.rs new file mode 100644 index 000000000..c1d3d97fd --- /dev/null +++ b/crates/ui-egui/src/dialogs/closing.rs @@ -0,0 +1,43 @@ +/// Opens this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w5): dl.A10 +pub(crate) fn open( + app: &mut crate::SlideApp, + ctx: &egui::Context, + host: &mut craft::ui::dialog::DialogHost, + params: &serde_json::Value, +) -> Result, String> { + let _ = (app, ctx, host, params); + todo!("dl.A10") +} + +/// Advances this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w5): dl.A10 +pub(crate) fn pump(app: &mut crate::SlideApp, ctx: &egui::Context, host: &mut craft::ui::dialog::DialogHost) { + let _ = (app, ctx, host); + todo!("dl.A10") +} + +/// The closing guard, its scope and prompt state. +#[allow(dead_code)] // P3(dialogs-w5): dl.A11 +pub(crate) struct Closing { + guard: craft::quit::CloseGuard, + scope: craft::quit::CloseScope, + asked: bool, +} + +impl crate::SlideApp { + /// Starts the closing prompt for the named documents. + #[allow(dead_code)] // P3(dialogs-w5): dl.A11 + pub(crate) fn start_closing(&mut self, scope: craft::quit::CloseScope, uids: Vec) { + let _ = (scope, uids); + todo!("dl.A11") + } +} + +impl crate::SlideApp { + /// Whether the closing guard allows quitting. + #[allow(dead_code)] // P3(dialogs-w5): dl.A11 + pub(crate) fn quit_allowed(&self) -> bool { + todo!("dl.A11") + } +} diff --git a/crates/ui-egui/src/dialogs/columns.rs b/crates/ui-egui/src/dialogs/columns.rs index f436fce62..8c6e625a7 100644 --- a/crates/ui-egui/src/dialogs/columns.rs +++ b/crates/ui-egui/src/dialogs/columns.rs @@ -54,3 +54,19 @@ pub(super) fn columns_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> } cancel } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w8): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w8): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/credits.rs b/crates/ui-egui/src/dialogs/credits.rs index b9b32e56e..d43686495 100644 --- a/crates/ui-egui/src/dialogs/credits.rs +++ b/crates/ui-egui/src/dialogs/credits.rs @@ -223,7 +223,8 @@ pub fn contributors_ui(ui: &mut egui::Ui) { } ui.separator(); let field = ui.label("Sort"); - let combo = craft_ui::ComboBox::from_id_salt("credits_sort").selected_text(v.key.label().0).show_ui(ui, |ui| { + // P3(dialogs-w18): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("credits_sort").selected_text(v.key.label().0).show_ui(ui, |ui| { for k in SortKey::ALL { if ui.selectable_label(v.key == k, k.label().0).clicked() { v.key = k; diff --git a/crates/ui-egui/src/dialogs/custom_shows.rs b/crates/ui-egui/src/dialogs/custom_shows.rs new file mode 100644 index 000000000..fc0c57381 --- /dev/null +++ b/crates/ui-egui/src/dialogs/custom_shows.rs @@ -0,0 +1,18 @@ +/// Opens this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w15): dl.A10 +pub(crate) fn open( + app: &mut crate::SlideApp, + ctx: &egui::Context, + host: &mut craft::ui::dialog::DialogHost, + params: &serde_json::Value, +) -> Result, String> { + let _ = (app, ctx, host, params); + todo!("dl.A10") +} + +/// Advances this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w15): dl.A10 +pub(crate) fn pump(app: &mut crate::SlideApp, ctx: &egui::Context, host: &mut craft::ui::dialog::DialogHost) { + let _ = (app, ctx, host); + todo!("dl.A10") +} diff --git a/crates/ui-egui/src/dialogs/date_time.rs b/crates/ui-egui/src/dialogs/date_time.rs index 3ba1c3d7e..02d142d02 100644 --- a/crates/ui-egui/src/dialogs/date_time.rs +++ b/crates/ui-egui/src/dialogs/date_time.rs @@ -49,7 +49,8 @@ pub(super) fn date_time_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) let lang_label = DATE_LANGS.iter().find(|(k, _)| *k == lang).map(|(_, l)| *l).unwrap_or("English (United States)"); ui.horizontal(|ui| { ui.label("Language:"); - let opened = craft_ui::ComboBox::from_id_salt("date-lang").selected_text(lang_label).width(240.0).show_ui(ui, |ui| { + // P3(dialogs-w10): earlier framework ComboBox removal (no contract id) + let opened = egui::ComboBox::from_id_salt("date-lang").selected_text(lang_label).width(240.0).show_ui(ui, |ui| { for (k, l) in DATE_LANGS { if ui.selectable_label(lang == *k, *l).clicked() { d.fields.insert("language".into(), (*k).to_string()); @@ -81,3 +82,19 @@ pub(super) fn date_time_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) } cancel } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w10): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w10): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/export.rs b/crates/ui-egui/src/dialogs/export.rs index 432ac58ef..b264e9bb0 100644 --- a/crates/ui-egui/src/dialogs/export.rs +++ b/crates/ui-egui/src/dialogs/export.rs @@ -16,7 +16,8 @@ pub(super) fn gif_options(app: &SlideApp, ui: &mut Ui, d: &mut Dialog) -> Result ui.add_space(4.0); ui.horizontal(|ui| { let field = ui.add_sized(vec2(120.0, 20.0), egui::Label::new("Size:")); - let combo = craft_ui::ComboBox::from_id_salt("gif_size").selected_text(size_label(&size)).show_ui(ui, |ui| { + // P3(dialogs-w12): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("gif_size").selected_text(size_label(&size)).show_ui(ui, |ui| { for k in SIZE_PRESETS.iter().map(|(k, _)| *k).chain(["custom"]) { if ui.selectable_label(size == k, size_label(k)).clicked() { d.fields.insert("gifSize".into(), k.into()); @@ -58,3 +59,19 @@ pub(super) fn gif_options(app: &SlideApp, ui: &mut Ui, d: &mut Dialog) -> Result } Ok(p) } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w12): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w12): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/find.rs b/crates/ui-egui/src/dialogs/find.rs index c702db926..353db23d3 100644 --- a/crates/ui-egui/src/dialogs/find.rs +++ b/crates/ui-egui/src/dialogs/find.rs @@ -89,3 +89,30 @@ pub(super) fn find_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bo } close } + +/// Opens this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w16): dl.A10 +pub(crate) fn open( + app: &mut crate::SlideApp, + ctx: &egui::Context, + host: &mut craft::ui::dialog::DialogHost, + params: &serde_json::Value, +) -> Result, String> { + let _ = (app, ctx, host, params); + todo!("dl.A10") +} + +/// Advances this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w16): dl.A10 +pub(crate) fn pump(app: &mut crate::SlideApp, ctx: &egui::Context, host: &mut craft::ui::dialog::DialogHost) { + let _ = (app, ctx, host); + todo!("dl.A10") +} + +/// The next and current find results. +#[allow(dead_code)] // P3(dialogs-w16): dl.A13 +#[derive(Default)] +pub(crate) struct FindProgress { + pub(crate) next: usize, + pub(crate) current: Option, +} diff --git a/crates/ui-egui/src/dialogs/font.rs b/crates/ui-egui/src/dialogs/font.rs index a163e7bce..3f29fca56 100644 --- a/crates/ui-egui/src/dialogs/font.rs +++ b/crates/ui-egui/src/dialogs/font.rs @@ -26,7 +26,8 @@ pub(super) fn font_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bo } ui.horizontal(|ui| { let field = ui.add_sized(vec2(88.0, 20.0), egui::Label::new("Font")); - let combo = craft_ui::ComboBox::from_id_salt("font_dialog_family") + // P3(dialogs-w11): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("font_dialog_family") .selected_text(if family.is_empty() { " " } else { family.as_str() }) .width(300.0) .show_ui(ui, |ui| { @@ -75,7 +76,8 @@ pub(super) fn font_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bo let mut spacing = d.get("spacing", "0"); let edited = ui.add(egui::TextEdit::singleline(&mut spacing).desired_width(64.0).hint_text("pt")); let mut picked = None; - let combo = craft_ui::ComboBox::from_id_salt("font_dialog_spacing") + // P3(dialogs-w11): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("font_dialog_spacing") .selected_text(match spacing.as_str() { "-3" => "Very tight", "-1.5" => "Tight", @@ -160,3 +162,19 @@ pub(super) fn font_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bo } ok || cancel } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w11): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w11): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/grid_options.rs b/crates/ui-egui/src/dialogs/grid_options.rs index 0e7f9c979..df55959b7 100644 --- a/crates/ui-egui/src/dialogs/grid_options.rs +++ b/crates/ui-egui/src/dialogs/grid_options.rs @@ -36,3 +36,19 @@ pub(super) fn grid_options(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> b } cancel } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w8): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w8): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/header_footer.rs b/crates/ui-egui/src/dialogs/header_footer.rs new file mode 100644 index 000000000..691b92d98 --- /dev/null +++ b/crates/ui-egui/src/dialogs/header_footer.rs @@ -0,0 +1,15 @@ +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w8): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w8): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/hyperlink.rs b/crates/ui-egui/src/dialogs/hyperlink.rs index a28826007..74518ea1f 100644 --- a/crates/ui-egui/src/dialogs/hyperlink.rs +++ b/crates/ui-egui/src/dialogs/hyperlink.rs @@ -179,3 +179,22 @@ pub(super) fn hyperlink_command(mode: &str, url: &str, email: &str, slide: usize _ => json!({"url": url, "tooltip": tip, "highlightClick": highlight}), } } + +/// Opens this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w9): dl.A10 +pub(crate) fn open( + app: &mut crate::SlideApp, + ctx: &egui::Context, + host: &mut craft::ui::dialog::DialogHost, + params: &serde_json::Value, +) -> Result, String> { + let _ = (app, ctx, host, params); + todo!("dl.A10") +} + +/// Advances this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w9): dl.A10 +pub(crate) fn pump(app: &mut crate::SlideApp, ctx: &egui::Context, host: &mut craft::ui::dialog::DialogHost) { + let _ = (app, ctx, host); + todo!("dl.A10") +} diff --git a/crates/ui-egui/src/dialogs/insert_forms.rs b/crates/ui-egui/src/dialogs/insert_forms.rs new file mode 100644 index 000000000..8006c8d81 --- /dev/null +++ b/crates/ui-egui/src/dialogs/insert_forms.rs @@ -0,0 +1,15 @@ +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w7): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w7): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/language.rs b/crates/ui-egui/src/dialogs/language.rs index 11b941c52..1a9e51729 100644 --- a/crates/ui-egui/src/dialogs/language.rs +++ b/crates/ui-egui/src/dialogs/language.rs @@ -26,3 +26,19 @@ pub fn selected_language(app: &SlideApp) -> (String, bool) { let props = props.unwrap_or_default(); (props.lang.unwrap_or_else(|| "en-US".into()), props.no_proof == Some(true)) } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w10): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w10): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/paragraph.rs b/crates/ui-egui/src/dialogs/paragraph.rs index 217076c35..b2b6fb89d 100644 --- a/crates/ui-egui/src/dialogs/paragraph.rs +++ b/crates/ui-egui/src/dialogs/paragraph.rs @@ -104,7 +104,8 @@ pub(super) fn paragraph_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) let kind = d.get("lineKind", "multiple"); let value = d.get("lineValue", "1"); let combo = - craft_ui::ComboBox::from_id_salt("paragraph_line").selected_text(line_preset_label(&kind, &value)).width(140.0).show_ui(ui, |ui| { + // P3(dialogs-w9): earlier framework ComboBox removal (no contract id) + egui::ComboBox::from_id_salt("paragraph_line").selected_text(line_preset_label(&kind, &value)).width(140.0).show_ui(ui, |ui| { for (label, k, v) in [ ("Single", "multiple", Some("1")), ("1.5 lines", "multiple", Some("1.5")), @@ -196,3 +197,22 @@ pub(super) fn paragraph_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) } ok || cancel } + +/// Opens this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w9): dl.A10 +pub(crate) fn open( + app: &mut crate::SlideApp, + ctx: &egui::Context, + host: &mut craft::ui::dialog::DialogHost, + params: &serde_json::Value, +) -> Result, String> { + let _ = (app, ctx, host, params); + todo!("dl.A10") +} + +/// Advances this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w9): dl.A10 +pub(crate) fn pump(app: &mut crate::SlideApp, ctx: &egui::Context, host: &mut craft::ui::dialog::DialogHost) { + let _ = (app, ctx, host); + todo!("dl.A10") +} diff --git a/crates/ui-egui/src/dialogs/photo_album.rs b/crates/ui-egui/src/dialogs/photo_album.rs index 340e5832c..3f2c8107a 100644 --- a/crates/ui-egui/src/dialogs/photo_album.rs +++ b/crates/ui-egui/src/dialogs/photo_album.rs @@ -69,7 +69,8 @@ fn pick_album_picture(app: &mut SlideApp) -> Option { fn album_choice(ui: &mut Ui, d: &mut Dialog, id: &str, name: &str, key: &str, default: &str, choices: &[(&str, &str)]) { let cur = d.get(key, default); let label = choices.iter().find(|(k, _)| *k == cur).map(|(_, l)| *l).unwrap_or(default); - let opened = craft_ui::ComboBox::from_id_salt(id).selected_text(label).width(220.0).show_ui(ui, |ui| { + // P3(dialogs-w13): earlier framework ComboBox removal (no contract id) + let opened = egui::ComboBox::from_id_salt(id).selected_text(label).width(220.0).show_ui(ui, |ui| { for (k, l) in choices { if ui.selectable_label(cur == *k, *l).clicked() { d.fields.insert(key.into(), (*k).to_string()); @@ -337,3 +338,26 @@ fn nudge_picture(d: &mut Dialog, key: &str, delta: f64) { obj.insert(key.into(), json!(next)); }); } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w13): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w13): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} + +/// Advances the photo album file pick. +#[allow(dead_code)] // P3(dialogs-w13): dl.A9 +pub(crate) fn each_pass(app: &mut crate::SlideApp, ctx: &egui::Context, dialog: &mut HostedParamDialog) { + let _ = (app, ctx, dialog); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/preferences.rs b/crates/ui-egui/src/dialogs/preferences.rs index b0b98fe55..6a5ab3b85 100644 --- a/crates/ui-egui/src/dialogs/preferences.rs +++ b/crates/ui-egui/src/dialogs/preferences.rs @@ -24,3 +24,58 @@ pub(super) fn restore_preferences(app: &mut SlideApp, d: &Dialog) { app.session.prefs = prefs; } } + +/// Opens this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w17): dl.A10 +pub(crate) fn open( + app: &mut crate::SlideApp, + ctx: &egui::Context, + host: &mut craft::ui::dialog::DialogHost, + params: &serde_json::Value, +) -> Result, String> { + let _ = (app, ctx, host, params); + todo!("dl.A10") +} + +/// Advances this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w17): dl.A10 +pub(crate) fn pump(app: &mut crate::SlideApp, ctx: &egui::Context, host: &mut craft::ui::dialog::DialogHost) { + let _ = (app, ctx, host); + todo!("dl.A10") +} + +/// The preferences draft with the app and engine setting types. +#[allow(dead_code)] // P3(dialogs-w17): dl.A14 +#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub(crate) struct PrefDraft { + dark: bool, + ui_scale: f64, + units: deckcraft_geom::Unit, + smart_guides: bool, + snap_to_grid: bool, + smart_quotes: bool, + autocorrect: bool, + author: String, + ac_two_initials: bool, + ac_sentence_caps: bool, + ac_days: bool, + ac_caps_lock: bool, + ac_fractions: bool, + ac_ordinals: bool, + ac_lists: bool, +} + +/// Copies current preferences into a draft. +#[allow(dead_code)] // P3(dialogs-w17): dl.A14 +pub(crate) fn of(app: &crate::SlideApp) -> PrefDraft { + let _ = app; + todo!("dl.A14") +} + +/// Applies a preferences draft. +#[allow(dead_code)] // P3(dialogs-w17): dl.A14 +pub(crate) fn write(app: &mut crate::SlideApp, draft: &PrefDraft) { + let _ = (app, draft); + todo!("dl.A14") +} diff --git a/crates/ui-egui/src/dialogs/replace_fonts.rs b/crates/ui-egui/src/dialogs/replace_fonts.rs new file mode 100644 index 000000000..4d2f16aed --- /dev/null +++ b/crates/ui-egui/src/dialogs/replace_fonts.rs @@ -0,0 +1,15 @@ +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w11): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w11): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/reuse_slides.rs b/crates/ui-egui/src/dialogs/reuse_slides.rs new file mode 100644 index 000000000..28bbd3dca --- /dev/null +++ b/crates/ui-egui/src/dialogs/reuse_slides.rs @@ -0,0 +1,15 @@ +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w14): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w14): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/size_position.rs b/crates/ui-egui/src/dialogs/size_position.rs index 73e6274f0..24abd8b9b 100644 --- a/crates/ui-egui/src/dialogs/size_position.rs +++ b/crates/ui-egui/src/dialogs/size_position.rs @@ -205,3 +205,19 @@ pub(super) fn size_position_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dial } cancel } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w9): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w9): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/slide_size.rs b/crates/ui-egui/src/dialogs/slide_size.rs index a69a478e9..1a738198a 100644 --- a/crates/ui-egui/src/dialogs/slide_size.rs +++ b/crates/ui-egui/src/dialogs/slide_size.rs @@ -27,3 +27,19 @@ pub(super) fn unit_abbr(unit: deckcraft_geom::Unit) -> &'static str { deckcraft_geom::Unit::Pixels => "px", } } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w8): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w8): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/spelling.rs b/crates/ui-egui/src/dialogs/spelling.rs new file mode 100644 index 000000000..bf2ae97d8 --- /dev/null +++ b/crates/ui-egui/src/dialogs/spelling.rs @@ -0,0 +1,25 @@ +/// Opens this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w15): dl.A10 +pub(crate) fn open( + app: &mut crate::SlideApp, + ctx: &egui::Context, + host: &mut craft::ui::dialog::DialogHost, + params: &serde_json::Value, +) -> Result, String> { + let _ = (app, ctx, host, params); + todo!("dl.A10") +} + +/// Advances this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w15): dl.A10 +pub(crate) fn pump(app: &mut crate::SlideApp, ctx: &egui::Context, host: &mut craft::ui::dialog::DialogHost) { + let _ = (app, ctx, host); + todo!("dl.A10") +} + +/// The locations in the spelling review. +#[allow(dead_code)] // P3(dialogs-w15): dl.A12 +#[derive(Default)] +pub(crate) struct SpellingRun { + pub(crate) locations: Vec, +} diff --git a/crates/ui-egui/src/dialogs/symbol.rs b/crates/ui-egui/src/dialogs/symbol.rs new file mode 100644 index 000000000..a0d6a80d5 --- /dev/null +++ b/crates/ui-egui/src/dialogs/symbol.rs @@ -0,0 +1,15 @@ +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w10): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w10): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/tabs.rs b/crates/ui-egui/src/dialogs/tabs.rs index a74760c55..00ef45c6a 100644 --- a/crates/ui-egui/src/dialogs/tabs.rs +++ b/crates/ui-egui/src/dialogs/tabs.rs @@ -89,3 +89,22 @@ pub(super) fn tabs_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bo } ok || cancel } + +/// Opens this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w9): dl.A10 +pub(crate) fn open( + app: &mut crate::SlideApp, + ctx: &egui::Context, + host: &mut craft::ui::dialog::DialogHost, + params: &serde_json::Value, +) -> Result, String> { + let _ = (app, ctx, host, params); + todo!("dl.A10") +} + +/// Advances this typed dialog in the host. +#[allow(dead_code)] // P3(dialogs-w9): dl.A10 +pub(crate) fn pump(app: &mut crate::SlideApp, ctx: &egui::Context, host: &mut craft::ui::dialog::DialogHost) { + let _ = (app, ctx, host); + todo!("dl.A10") +} diff --git a/crates/ui-egui/src/dialogs/theme_colors.rs b/crates/ui-egui/src/dialogs/theme_colors.rs index 250dfea49..d10e0c13e 100644 --- a/crates/ui-egui/src/dialogs/theme_colors.rs +++ b/crates/ui-egui/src/dialogs/theme_colors.rs @@ -93,3 +93,19 @@ pub(super) fn theme_colors_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialo } cancel } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w13): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w13): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/theme_fonts.rs b/crates/ui-egui/src/dialogs/theme_fonts.rs index 0adcd3372..873ace79d 100644 --- a/crates/ui-egui/src/dialogs/theme_fonts.rs +++ b/crates/ui-egui/src/dialogs/theme_fonts.rs @@ -30,7 +30,8 @@ fn theme_font_choices(app: &SlideApp, selected: &str) -> Vec { /// Draw an accessible font combo box and update the selected family; the caller supplies the /// visible label. fn font_combo(ui: &mut Ui, label: &str, choices: &[String], selected: &mut String) { - let resp = craft_ui::ComboBox::from_id_salt(label).selected_text(selected.as_str()).width(240.0).show_ui(ui, |ui| { + // P3(dialogs-w11): earlier framework ComboBox removal (no contract id) + let resp = egui::ComboBox::from_id_salt(label).selected_text(selected.as_str()).width(240.0).show_ui(ui, |ui| { for face in choices { if ui.selectable_label(selected == face, face).clicked() { *selected = face.clone(); @@ -112,3 +113,19 @@ pub(super) fn theme_fonts_dialog(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog } cancel } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w11): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w11): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/trim.rs b/crates/ui-egui/src/dialogs/trim.rs index 758070aba..bda2a446e 100644 --- a/crates/ui-egui/src/dialogs/trim.rs +++ b/crates/ui-egui/src/dialogs/trim.rs @@ -95,3 +95,19 @@ mod trim_media_tests { assert_eq!(seed.fade_out, "1"); } } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w8): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w8): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/dialogs/updates_ui.rs b/crates/ui-egui/src/dialogs/updates_ui.rs index 41bebcc9c..43fc9de0e 100644 --- a/crates/ui-egui/src/dialogs/updates_ui.rs +++ b/crates/ui-egui/src/dialogs/updates_ui.rs @@ -2,7 +2,8 @@ //! prompt that offers to update and restart. The flow itself is `craft_update::updater::Updater`. use craft_update::updater::{Action, Status, Updater}; -use craft_update::{CheckResultDialog, CheckResultResponse}; +// P3(dialogs-w18): dl.A10 +use craft_update::stack_dialogs::CheckChoice as CheckResultResponse; use crate::SlideApp; @@ -63,9 +64,11 @@ pub(crate) fn tick(app: &mut SlideApp, ctx: &egui::Context) { return; } if std::mem::take(&mut rt.check_requested) { - rt.updater.check_now(ctx); + // P3(dialogs-w18): dl.A10 + rt.updater.check_now(); } else if rt.enabled { - rt.updater.check_at_start(ctx); + // P3(dialogs-w18): dl.A10 + rt.updater.check_at_start(); } rt.updater.tick(ctx); } @@ -76,29 +79,37 @@ pub(crate) fn show(app: &mut SlideApp, ctx: &egui::Context) { } // An installation starts, and a ready update asks the app to close, only while nothing is unsaved. let clean = !app.session.documents().iter().any(|d| d.is_dirty()); - match app.updates_rt.updater.show_if(ctx, clean) { + // P3(dialogs-w18): dl.A10 + let host = craft::ui::shell::WindowDialogs::of(ctx, &craft::ui::runtime::env::WindowKey::main()); + match host.with(|host| app.updates_rt.updater.run(host, clean)) { Action::OpenUrl(url) => ctx.open_url(egui::OpenUrl::new_tab(url)), // The app's close path asks about unsaved work; `on_exit` starts the restart helper. Action::Close => ctx.send_viewport_cmd(egui::ViewportCommand::Close), Action::None => {} + // P3(dialogs-w18): dl.A10 + _ => todo!("dl.A10"), } // The result window reports a requested check, and at the first start after an update what // that update came to (installed, or why it failed). let rt = &mut app.updates_rt; if !matches!(rt.updater.status(), Status::Idle) { - let response = CheckResultDialog::new(&crate::UPDATE_APP, VERSION).show(ctx, rt.updater.status()); + // P3(dialogs-w18): dl.A10 + // Updater::run consumes its hosted result; the old answer path has no separate result. + let response = None; answer(rt, response); } } /// Acts on the result window's answer. -fn answer(rt: &mut Runtime, response: CheckResultResponse) { +fn answer(rt: &mut Runtime, response: Option) { + // P3(dialogs-w18): dl.A10 match response { - CheckResultResponse::Close => rt.updater.dismiss_status(), - CheckResultResponse::CheckAgain => rt.check_requested = true, + Some(CheckResultResponse::Close) => rt.updater.dismiss_status(), + Some(CheckResultResponse::CheckAgain) => rt.check_requested = true, // The next frame's `show_if` asks the window to close once nothing is unsaved. - CheckResultResponse::RestartToUpdate => rt.updater.restart_to_update(), - CheckResultResponse::None => {} + Some(CheckResultResponse::RestartToUpdate) => rt.updater.restart_to_update(), + None => {} + Some(_) => todo!("dl.A10"), } } @@ -176,7 +187,8 @@ mod tests { .textures_delta .clear(); assert!(matches!(app.updates_rt.updater.status(), Status::Updated(_)), "{:?}", app.updates_rt.updater.status()); - answer(&mut app.updates_rt, CheckResultResponse::Close); + // P3(dialogs-w18): dl.A10 + answer(&mut app.updates_rt, Some(CheckResultResponse::Close)); assert_eq!(app.updates_rt.updater.status(), &Status::Idle); let _ = std::fs::remove_dir_all(&root); } @@ -196,8 +208,23 @@ mod tests { .textures_delta .clear(); assert_eq!(app.updates_rt.updater.status(), &Status::InstallFailed("the disk is full".into())); - answer(&mut app.updates_rt, CheckResultResponse::CheckAgain); + // P3(dialogs-w18): dl.A10 + answer(&mut app.updates_rt, Some(CheckResultResponse::CheckAgain)); assert!(app.updates_rt.check_requested); let _ = std::fs::remove_dir_all(&root); } } + +/// Advances the update dialog in the pump host. +#[allow(dead_code)] // P3(dialogs-w18): dl.A10 +pub(crate) fn run(app: &mut crate::SlideApp, ctx: &egui::Context, host: &mut craft::ui::dialog::DialogHost) { + let _ = (app, ctx, host); + todo!("dl.A10") +} + +/// Offers an update or returns the Nightly update notice. +#[allow(dead_code)] // P3(dialogs-w18): dl.A10 +pub(crate) fn offer(app: &mut crate::SlideApp, tag: &str) -> Result<(), String> { + let _ = (app, tag); + todo!("dl.A10") +} diff --git a/crates/ui-egui/src/dialogs/zoom.rs b/crates/ui-egui/src/dialogs/zoom.rs index e257b9f95..b02e7737e 100644 --- a/crates/ui-egui/src/dialogs/zoom.rs +++ b/crates/ui-egui/src/dialogs/zoom.rs @@ -82,3 +82,19 @@ mod zoom_tests { assert!(parse_zoom_percent("inf").is_none()); } } + +use craft::ui::patterns::form_dialogs::{HostedParamDialog, ParamResult}; + +/// Opens this hosted form with the supplied parameters. +#[allow(dead_code)] // P3(dialogs-w7): dl.A9 +pub(crate) fn open(app: &crate::SlideApp, ctx: &egui::Context, params: &serde_json::Value) -> HostedParamDialog { + let _ = (app, ctx, params); + todo!("dl.A9") +} + +/// Applies an accepted form result. +#[allow(dead_code)] // P3(dialogs-w7): dl.A9 +pub(crate) fn finish(app: &mut crate::SlideApp, result: &ParamResult) -> Result<(), String> { + let _ = (app, result); + todo!("dl.A9") +} diff --git a/crates/ui-egui/src/eyedropper.rs b/crates/ui-egui/src/eyedropper.rs index 09a91a12a..71024de0c 100644 --- a/crates/ui-egui/src/eyedropper.rs +++ b/crates/ui-egui/src/eyedropper.rs @@ -183,3 +183,36 @@ fn loupe(ui: &Ui, pos: Pos2, c: [u8; 4]) { painter.rect_filled(label, 3, Color32::WHITE); painter.text(label.center(), egui::Align2::CENTER_CENTER, format!("#{}", hex(c)), theme::bold(11.0), Color32::BLACK); } + +/// The armed target and its single dropper tool. +#[allow(dead_code)] // P3(canvas-w13): cv.A7 +pub struct Armed { + target: Target, + tool: Option>, +} + +/// The target that receives a sampled colour. +pub enum Target { + /// A colour menu identified by its request key. + Menu(String), + /// The picture transparent colour. + TransparentColor, +} + +/// Arms the canvas eyedropper for a target. +pub fn arm(app: &mut crate::SlideApp, target: Target) { + let _ = (app, target); + todo!("cv.A7") +} + +/// Takes the arming dropper tool for this pass. +pub fn tool(app: &mut crate::SlideApp) -> Option> { + let _ = app; + todo!("cv.A7") +} + +/// Returns the dropper tool after the pass and settles its answer. +pub fn after_pass(app: &mut crate::SlideApp, ctx: &egui::Context, tool: craft::color_ui::ui::DropperTool<'static>, canvas_rect: Rect) { + let _ = (app, ctx, tool, canvas_rect); + todo!("cv.A7") +} diff --git a/crates/ui-egui/src/host_save_tests.rs b/crates/ui-egui/src/host_save_tests.rs index 78fad53ef..bf371b4d4 100644 --- a/crates/ui-egui/src/host_save_tests.rs +++ b/crates/ui-egui/src/host_save_tests.rs @@ -100,7 +100,8 @@ fn host_save_of_an_untitled_presentation_is_save_as() { #[test] fn a_file_the_page_never_sent_saves_as_a_new_file() { let (mut app, got) = host_app(false); - app.open_or_insert_bytes("dropped.pptx", &pptx(1)); + // P3(shell-w6): sh.A23 + app.open_or_insert_bytes("dropped.pptx", pptx(1)); app.save(); assert_eq!(calls(&got), [("dropped.deckcraft".to_string(), true)]); } diff --git a/crates/ui-egui/src/icon_sheet.rs b/crates/ui-egui/src/icon_sheet.rs new file mode 100644 index 000000000..9cdf943a0 --- /dev/null +++ b/crates/ui-egui/src/icon_sheet.rs @@ -0,0 +1,13 @@ +/// Lists icons matching a filter. +#[allow(dead_code)] // P3(widgets-w5): wg.A6 +pub(crate) fn matching(filter: &str) -> impl Iterator { + let _ = filter; + std::iter::from_fn(|| todo!("wg.A6")) +} + +/// Shows the icon sheet window. +#[allow(dead_code)] // P3(widgets-w5): wg.A6 +pub(crate) fn window(ui: &mut egui::Ui, filter: &str) -> bool { + let _ = (ui, filter); + todo!("wg.A6") +} diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rs index c3aa288b7..e35884966 100644 --- a/crates/ui-egui/src/icons.rs +++ b/crates/ui-egui/src/icons.rs @@ -385,3 +385,16 @@ mod tests { assert_eq!(triangulate(&pts).len(), pts.len() - 2); } } + +impl Icon { + /// The registered application icon identity. + pub fn id(self) -> craft::behavior::IconId { + let _ = self; + todo!("wg.A1") + } +} + +/// Registers the app icons before the runtime draws them. +pub fn register() { + todo!("wg.A2") +} diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 3654fa153..ef45f4ca6 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -179,6 +179,8 @@ struct AnimPreview { /// Where on the play-everything clock playback began (Play From the selected effect). from: f64, elapsed: f64, + #[allow(dead_code)] // P3(shell-w11): cv.A1 + held: Option, timeline: deckcraft_anim::Timeline, } @@ -217,6 +219,88 @@ struct InputTarget { } pub struct SlideApp { + /// Host. + #[allow(dead_code)] // P3(shell-w11): sh.A8 + pub(crate) host: craft::host::Host, + /// Control. + #[allow(dead_code)] // P3(shell-w11): sh.A8 + control: Option, + /// Autosave. + #[allow(dead_code)] // P3(shell-w11): sh.A8 + autosave: Option, + /// Notices. + #[allow(dead_code)] // P3(shell-w11): sh.A8 + notices: craft::ui::notices::NoticeCenter, + /// Palette open. + #[allow(dead_code)] // P3(shell-w11): sh.A8 + palette_open: bool, + /// Palette recents. + #[allow(dead_code)] // P3(shell-w11): sh.A8 + palette_recents: Vec, + /// Catalog. + #[allow(dead_code)] // P3(shell-w11): sh.A8 + catalog: craft::ui::runtime::commands::AppCatalog, + /// Catalog generation. + #[allow(dead_code)] // P3(shell-w11): sh.A8 + catalog_generation: u64, + /// Injected target. + #[allow(dead_code)] // P3(shell-w11): sh.A8 + injected_target: Option, + /// Clock. + #[allow(dead_code)] // P3(shell-w11): sh.A8 + clock: craft::platform::clock::Clock, + /// Opening jobs. + #[allow(dead_code)] // P3(shell-w11): sh.A8 + opening_jobs: Option>>, + /// Dialogs. + #[allow(dead_code)] // P3(shell-w11): dl.A1 + pub(crate) dialogs: dialogs::DialogState, + /// Format pane. + #[allow(dead_code)] // P3(shell-w11): pn.A12 + pub format_pane: panels::format_shape::FormatPaneState, + /// Anim pane. + #[allow(dead_code)] // P3(shell-w11): pn.A12 + pub anim_pane: panels::animation::AnimPaneState, + /// Fill editor. + #[allow(dead_code)] // P3(shell-w11): pn.A12 + pub fill_editor: panels::fillui::FillEditorState, + /// Comments pane. + #[allow(dead_code)] // P3(shell-w11): pn.A12 + pub comments_pane: craft::review::ui::CommentsPanelState, + /// Pane menu. + #[allow(dead_code)] // P3(shell-w11): pn.A12 + pane_menu: Option<(String, u64)>, + /// Smartart focus. + #[allow(dead_code)] // P3(shell-w11): pn.A12 + smartart_focus: Option, + /// Slide reveal. + #[allow(dead_code)] // P3(shell-w11): pn.A12 + slide_reveal: Option, + /// Insert zoom. + #[allow(dead_code)] // P3(shell-w11): rb.A15 + pub(crate) insert_zoom: ribbon::ZoomPick, + /// Smooth corners. + #[allow(dead_code)] // P3(shell-w11): rb.A15 + pub(crate) smooth_corners: HashMap, + /// Host answers. + #[allow(dead_code)] // P3(shell-w11): wg.A3 + pub host_answers: Vec, + /// Icon sheet. + #[allow(dead_code)] // P3(shell-w11): wg.A4 + pub(crate) icon_sheet: Option, + /// Canvas view. + #[allow(dead_code)] // P3(shell-w11): cv.A1 + pub canvas_view: craft::behavior::CanvasView, + /// Picture. + #[allow(dead_code)] // P3(shell-w11): cv.A1 + pub picture: canvas::picture::SlidePicture, + /// Ruler tab kind. + #[allow(dead_code)] // P3(shell-w11): cv.A1 + pub ruler_tab_kind: craft::text::ui::ruler::TabAlign, + /// Canvas menu. + #[allow(dead_code)] // P3(shell-w11): cv.A1 + pub canvas_menu: Option, + /// Shape Fill's last colour (a command colour parameter): the button applies it again. Accent 1 until one is picked. pub last_fill: serde_json::Value, /// Shape Outline's last colour, likewise. Text 1 until one is picked. @@ -498,3 +582,13 @@ mod host_save_tests; #[cfg(test)] mod tests; + +pub use platform::Platform; + +mod icon_sheet; +mod platform; +pub mod presenter_view; +pub mod thumb_source; + +#[cfg(test)] +pub(crate) mod test_harness; diff --git a/crates/ui-egui/src/media.rs b/crates/ui-egui/src/media.rs index 562b9236c..d68eb6bb1 100644 --- a/crates/ui-egui/src/media.rs +++ b/crates/ui-egui/src/media.rs @@ -45,6 +45,8 @@ struct Probed { } pub struct MediaHost { + #[allow(dead_code)] // P3(canvas-w14): cv.A9 + serials: craft::ui::primitives::Serials, player: Player, /// Presentation the voices and GIF clocks belong to. `None` before the first document is /// bound, and after the last one closes. @@ -100,6 +102,8 @@ fn key(id: ShapeId) -> u64 { impl MediaHost { pub fn new(out: Option>) -> MediaHost { MediaHost { + // P3(canvas-w14): cv.A9 + serials: Default::default(), player: Player::new(out), doc: None, owners: HashMap::new(), diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index b1b44200e..5cd1f2da5 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -336,3 +336,10 @@ mod tests { } } } + +/// Lists enabled commands that can run without arguments. +#[allow(dead_code)] // P3(shell-w4): sh.A18 +pub(crate) fn palette_entries(session: &crate::Session) -> Vec { + let _ = session; + todo!("sh.A18") +} diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 202f45b3c..3a230bffc 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -10,12 +10,12 @@ use crate::ribbon::{cref_param, paint_anim_tile}; use crate::theme::{self, Tokens}; use crate::{SlideApp, widgets}; -mod animation; +pub mod animation; mod background; mod comments; mod designer; mod effect_presets; -mod format_shape; +pub mod format_shape; mod smartart; mod thesaurus; @@ -421,3 +421,22 @@ mod tests { #[cfg(test)] mod thesaurus_tests; + +/// An editor pane or named task pane. +#[allow(dead_code)] // P3(panels-w5): pn.A2 +pub(crate) enum Pane { + Thumbs, + Outline, + Notes, + Task(String), +} + +/// Shows the editor panes and canvas. +#[allow(dead_code)] // P3(panels-w5): pn.A2 +pub(crate) fn show_editor(app: &mut SlideApp, ui: &mut Ui) { + let _ = (app, ui); + todo!("pn.A2") +} + +pub(crate) mod color_row; +pub(crate) mod preset_grid; diff --git a/crates/ui-egui/src/panels/animation.rs b/crates/ui-egui/src/panels/animation.rs index 22d3c68ec..346c9ccc5 100644 --- a/crates/ui-egui/src/panels/animation.rs +++ b/crates/ui-egui/src/panels/animation.rs @@ -185,3 +185,10 @@ pub(super) fn animation(app: &mut SlideApp, ui: &mut Ui) { } let _ = paint_anim_tile; } + +/// The animation pane selected effect. +#[allow(dead_code)] // P3(panels-w11): pn.A11 +#[derive(Default)] +pub struct AnimPaneState { + picked: Option<(u64, usize, usize)>, +} diff --git a/crates/ui-egui/src/panels/background.rs b/crates/ui-egui/src/panels/background.rs index 906408a97..2010afaac 100644 --- a/crates/ui-egui/src/panels/background.rs +++ b/crates/ui-egui/src/panels/background.rs @@ -65,13 +65,15 @@ pub(super) fn background(app: &mut SlideApp, ui: &mut Ui) { } Some(Fill::Gradient(g)) => { current = Some(json!({"gradient": crate::fillui::gradient_json(g)})); - if let Some(ng) = crate::fillui::gradient_editor(ui, "bg-grad", g, &sc) { + // P3(panels-w10): pn.A10 + if let Some(ng) = crate::fillui::gradient_editor(app, ui, "bg-grad", g) { run(app, "design.background", json!({"gradient": crate::fillui::gradient_json(&ng)})); } } Some(Fill::Pattern(pt)) => { current = Some(json!({"pattern": crate::fillui::pattern_json(pt)})); - if let Some(np) = crate::fillui::pattern_editor(ui, pt, &sc) { + // P3(panels-w10): pn.A10 + if let Some(np) = crate::fillui::pattern_editor(app, ui, pt) { run(app, "design.background", json!({"pattern": crate::fillui::pattern_json(&np)})); } } @@ -156,7 +158,8 @@ fn picture_background_options(app: &mut SlideApp, ui: &mut Ui, pf: &deckcraft_mo }; ui.horizontal(|ui| { let field = ui.add_sized(vec2(72.0, 20.0), egui::Label::new("Alignment")); - let combo = craft_ui::ComboBox::from_id_salt("bg-align").selected_text(align_name).width(140.0).show_ui(ui, |ui| { + // P3(panels-w10): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("bg-align").selected_text(align_name).width(140.0).show_ui(ui, |ui| { for (k, l) in [ ("tl", "Top Left"), ("t", "Top"), @@ -183,7 +186,8 @@ fn picture_background_options(app: &mut SlideApp, ui: &mut Ui, pf: &deckcraft_mo }; ui.horizontal(|ui| { let field = ui.add_sized(vec2(72.0, 20.0), egui::Label::new("Mirror")); - let combo = craft_ui::ComboBox::from_id_salt("bg-mirror").selected_text(mirror_name).width(140.0).show_ui(ui, |ui| { + // P3(panels-w10): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("bg-mirror").selected_text(mirror_name).width(140.0).show_ui(ui, |ui| { for (k, l) in [("none", "None"), ("x", "Horizontal"), ("y", "Vertical"), ("xy", "Both")] { if ui.selectable_label(flip == k, l).clicked() { run(app, "design.background", json!({"pictureProps": {"mirror": k}})); diff --git a/crates/ui-egui/src/panels/color_row.rs b/crates/ui-egui/src/panels/color_row.rs new file mode 100644 index 000000000..defa0616f --- /dev/null +++ b/crates/ui-egui/src/panels/color_row.rs @@ -0,0 +1,32 @@ +/// Shows a colour row and reports the selected colour. +#[allow(dead_code)] // P3(panels-w8): pn.A7 +pub(crate) fn color_row( + app: &mut crate::SlideApp, + ui: &mut egui::Ui, + label: &str, + none: Option<&str>, + on_pick: impl FnOnce(&mut crate::SlideApp, Option), +) { + let _ = (app, ui, label, none, on_pick); + todo!("pn.A7") +} + +/// Reports the colour menu or eyedropper answer. +#[allow(dead_code)] // P3(panels-w8): pn.A15 +pub(crate) fn color_menu( + app: &mut crate::SlideApp, + ui: &mut egui::Ui, + cx: &mut craft::ui::contract::BodyCx<'_>, + key: &str, + none: Option<&str>, +) -> Option> { + let _ = (app, ui, cx, key, none); + todo!("pn.A15") +} + +/// Reports the colour menu or eyedropper answer. +#[allow(dead_code)] // P3(panels-w8): pn.A15 +pub(crate) fn take_color_answer(app: &mut crate::SlideApp, key: &str) -> Option> { + let _ = (app, key); + todo!("pn.A15") +} diff --git a/crates/ui-egui/src/panels/comments.rs b/crates/ui-egui/src/panels/comments.rs index 5acb71402..e9f553b60 100644 --- a/crates/ui-egui/src/panels/comments.rs +++ b/crates/ui-egui/src/panels/comments.rs @@ -90,7 +90,8 @@ pub(super) fn comments(app: &mut SlideApp, ui: &mut Ui) { } } -fn focus_comment(app: &mut SlideApp, slide: usize, index: usize) { +// P3(panels-w13): pn.A13 +pub(crate) fn focus_comment(app: &mut SlideApp, slide: usize, index: usize) { let _ = app.run("slide.go", json!({"index": slide})); app.ui.comment_focus = Some((slide, index)); } diff --git a/crates/ui-egui/src/panels/fillui.rs b/crates/ui-egui/src/panels/fillui.rs index a8a29680d..8e9f298bb 100644 --- a/crates/ui-egui/src/panels/fillui.rs +++ b/crates/ui-egui/src/panels/fillui.rs @@ -108,7 +108,10 @@ const DIRECTIONS_PATH: [(&str, [f64; 4]); 5] = [ ]; /// The editor for `g`; returns the new gradient when the user changed something. -pub fn gradient_editor(ui: &mut Ui, id: &str, g: &Gradient, sc: &ColorScheme) -> Option { +pub(crate) fn gradient_editor(app: &mut crate::SlideApp, ui: &mut Ui, label: &str, g: &Gradient) -> Option { + // P3(panels-w10): pn.A10 + let (id, scheme) = (label, app.color_scheme()); + let sc = &scheme; let t = Tokens::get(ui.ctx()); let mut out: Option = None; let sel_id = ui.scope_id().with((id, "stop")); @@ -174,7 +177,8 @@ pub fn gradient_editor(ui: &mut Ui, id: &str, g: &Gradient, sc: &ColorScheme) -> }; ui.horizontal(|ui| { let field = ui.add_sized(vec2(70.0, 20.0), egui::Label::new("Type")); - let combo = craft_ui::ComboBox::from_id_salt((id, "kind")).selected_text(kind).width(120.0).show_ui(ui, |ui| { + // P3(panels-w10): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt((id, "kind")).selected_text(kind).width(120.0).show_ui(ui, |ui| { for k in ["Linear", "Radial", "Rectangular", "Path"] { if ui.selectable_label(kind == k, k).clicked() && kind != k { let focus = match &g.shape { @@ -486,7 +490,10 @@ fn paint_pattern(p: &egui::Painter, r: Rect, name: &str, fg: Color32, bg: Color3 /// The editor for `pt`: a gallery of the presets drawn in the current colors, then Foreground and /// Background color menus. Returns the new pattern when the user changed something. -pub fn pattern_editor(ui: &mut Ui, pt: &PatternFill, sc: &ColorScheme) -> Option { +pub(crate) fn pattern_editor(app: &mut crate::SlideApp, ui: &mut Ui, p: &PatternFill) -> Option { + // P3(panels-w10): pn.A10 + let (pt, scheme) = (p, app.color_scheme()); + let sc = &scheme; let t = Tokens::get(ui.ctx()); let mut out: Option = None; let (fg, bg) = (c32(&pt.fg, sc), c32(&pt.bg, sc)); @@ -538,6 +545,9 @@ mod tests { #[test] fn double_clicking_a_stop_opens_its_color_menu() { let sc = deckcraft_model::Theme::default().colors; + // P3(panels-w10): pn.A10 + let _ = ≻ + let mut app = crate::SlideApp::new(deckcraft_engine::Session::new(), crate::Services::default()); let start = Gradient { stops: vec![ GradientStop { pos: 0.0, color: ColorRef::scheme(SchemeSlot::Accent1) }, @@ -553,7 +563,8 @@ mod tests { *fonts = true; return; } - if let Some(ng) = gradient_editor(ui, "test-grad", &g.clone(), &sc) { + // P3(panels-w10): pn.A10 + if let Some(ng) = gradient_editor(&mut app, ui, "test-grad", &g.clone()) { *g = ng; } }, @@ -592,3 +603,24 @@ mod tests { assert_eq!(gradient_json(&gradient).get("flip"), Some(&json!("xy"))); } } + +/// The selected gradient stop and its position. +#[allow(dead_code)] // P3(panels-w10): pn.A10 +#[derive(Default)] +pub struct FillEditorState { + stop: Option<(usize, egui::Pos2)>, +} + +/// Converts a gradient to framework stops. +#[allow(dead_code)] // P3(panels-w10): pn.A10 +pub(crate) fn to_stops(g: &Gradient, sc: &ColorScheme) -> craft::color_ui::gradient::GradientStops { + let _ = (g, sc); + todo!("pn.A10") +} + +/// Applies framework stops while preserving other gradient settings. +#[allow(dead_code)] // P3(panels-w10): pn.A10 +pub(crate) fn from_stops(stops: &craft::color_ui::gradient::GradientStops, g: &Gradient) -> Gradient { + let _ = (stops, g); + todo!("pn.A10") +} diff --git a/crates/ui-egui/src/panels/format_shape.rs b/crates/ui-egui/src/panels/format_shape.rs index deaac9c20..f324c314b 100644 --- a/crates/ui-egui/src/panels/format_shape.rs +++ b/crates/ui-egui/src/panels/format_shape.rs @@ -1,4 +1,6 @@ use super::effect_presets; +mod effects; +mod size; use super::{Fill, Icon, ShapeKind, SlideApp, Tokens, Ui, color_button, cref_param, json, run, scheme, theme, vec2, widgets}; /// Percent transparency (0 = opaque) of a solid fill, the same number `shape.fill`'s @@ -218,7 +220,8 @@ fn size_tab(app: &mut SlideApp, ui: &mut Ui, sh: &deckcraft_model::Shape, x: dec ui.horizontal(|ui| { ui.add_sized(vec2(90.0, 20.0), egui::Label::new("From")); let combo = - craft_ui::ComboBox::from_id_salt("fmt-origin").selected_text(if center { "Center" } else { "Top Left Corner" }).show_ui(ui, |ui| { + // P3(panels-w8): earlier framework ComboBox removal (no contract id) + egui::ComboBox::from_id_salt("fmt-origin").selected_text(if center { "Center" } else { "Top Left Corner" }).show_ui(ui, |ui| { ui.selectable_value(&mut center, false, "Top Left Corner"); ui.selectable_value(&mut center, true, "Center"); }); @@ -437,7 +440,10 @@ pub(super) fn format_shape(app: &mut SlideApp, ui: &mut Ui) { } if let Some(Fill::Gradient(g)) = shown_fill { let sc = scheme(app); - if let Some(ng) = crate::fillui::gradient_editor(ui, "shape-grad", g, &sc) { + // P3(panels-w8): pn.A10 + let _ = ≻ + // P3(panels-w8): pn.A10 + if let Some(ng) = crate::fillui::gradient_editor(app, ui, "shape-grad", g) { run(app, "shape.fill", json!({"gradient": crate::fillui::gradient_json(&ng)})); } let mut rot = g.rotate_with_shape; @@ -447,7 +453,8 @@ pub(super) fn format_shape(app: &mut SlideApp, ui: &mut Ui) { } } if let Some(Fill::Pattern(pt)) = shown_fill - && let Some(np) = crate::fillui::pattern_editor(ui, pt, &scheme(app)) + // P3(panels-w8): pn.A10 + && let Some(np) = crate::fillui::pattern_editor(app, ui, pt) { run(app, "shape.fill", json!({"pattern": crate::fillui::pattern_json(&np)})); } @@ -493,7 +500,8 @@ fn line_choice(app: &mut SlideApp, ui: &mut Ui, label: &str, key: &str, current: ui.horizontal(|ui| { let field = ui.add_sized(vec2(90.0, 20.0), egui::Label::new(label)); let shown = items.iter().find(|(_, v)| *v == current).map_or(current, |(l, _)| *l); - let combo = craft_ui::ComboBox::from_id_salt(("fmt-line", key)).selected_text(shown).width(120.0).show_ui(ui, |ui| { + // P3(panels-w8): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt(("fmt-line", key)).selected_text(shown).width(120.0).show_ui(ui, |ui| { for (l, v) in items { if ui.selectable_label(*v == current, *l).clicked() { run(app, "shape.line", json!({key: v})); @@ -653,7 +661,8 @@ fn picture_fill_options(app: &mut SlideApp, ui: &mut Ui, id: u32, pf: &deckcraft ui.horizontal(|ui| { let field = ui.add_sized(vec2(90.0, 20.0), egui::Label::new(label)); let shown = opts.iter().find(|(k, _)| k == cur).map_or(opts[0].1, |(_, l)| *l); - let combo = craft_ui::ComboBox::from_id_salt(("picfill", id, key)).selected_text(shown).show_ui(ui, |ui| { + // P3(panels-w8): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt(("picfill", id, key)).selected_text(shown).show_ui(ui, |ui| { for (k, l) in opts { if ui.selectable_label(*k == cur.as_str(), *l).clicked() { run(app, "shape.fill", json!({"pictureProps": {key: k}})); @@ -705,7 +714,8 @@ fn preset_label(name: &str) -> String { fn three_d_combo(app: &mut SlideApp, ui: &mut Ui, id: u32, label: &str, key: &str, cur: &str, options: &[&str]) { ui.horizontal(|ui| { let field = ui.add_sized(vec2(90.0, 20.0), egui::Label::new(label)); - let combo = craft_ui::ComboBox::from_id_salt(("3d", id, key)).selected_text(preset_label(cur)).width(170.0).show_ui(ui, |ui| { + // P3(panels-w8): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt(("3d", id, key)).selected_text(preset_label(cur)).width(170.0).show_ui(ui, |ui| { for o in options { if ui.selectable_label(*o == cur, preset_label(o)).clicked() { run(app, "shape.effects", json!({"threeD": {key: o}})); @@ -785,3 +795,12 @@ pub(crate) fn text_transparency_slider(app: &mut SlideApp, ui: &mut Ui, sh: &dec } }); } + +/// The formatting pane scale bases and reference options. +#[allow(dead_code)] // P3(panels-w8): pn.A8 +#[derive(Default)] +pub struct FormatPaneState { + scale_base: std::collections::HashMap<(u64, u32), (f64, f64)>, + lock_aspect: bool, + centre_origin: bool, +} diff --git a/crates/ui-egui/src/panels/format_shape/effects.rs b/crates/ui-egui/src/panels/format_shape/effects.rs new file mode 100644 index 000000000..fb5904f13 --- /dev/null +++ b/crates/ui-egui/src/panels/format_shape/effects.rs @@ -0,0 +1,6 @@ +/// Shows the formatting tab for a shape. +#[allow(dead_code)] // P3(panels-w9): pn.A14 +pub(super) fn tab(app: &mut crate::SlideApp, ui: &mut egui::Ui, sh: &deckcraft_model::Shape) { + let _ = (app, ui, sh); + todo!("pn.A14") +} diff --git a/crates/ui-egui/src/panels/format_shape/size.rs b/crates/ui-egui/src/panels/format_shape/size.rs new file mode 100644 index 000000000..2c2e50ca3 --- /dev/null +++ b/crates/ui-egui/src/panels/format_shape/size.rs @@ -0,0 +1,6 @@ +/// Shows the formatting tab for a shape. +#[allow(dead_code)] // P3(panels-w9): pn.A14 +pub(super) fn tab(app: &mut crate::SlideApp, ui: &mut egui::Ui, sh: &deckcraft_model::Shape, uid: u64) { + let _ = (app, ui, sh, uid); + todo!("pn.A14") +} diff --git a/crates/ui-egui/src/panels/notes.rs b/crates/ui-egui/src/panels/notes.rs index f61479f62..0f46f0412 100644 --- a/crates/ui-egui/src/panels/notes.rs +++ b/crates/ui-egui/src/panels/notes.rs @@ -372,3 +372,24 @@ mod tests { assert!(j.sections.iter().all(|s| s.leading_space.is_finite() && s.format.font_id.size <= 24.0)); } } + +/// Shows the pane body inside the pane host. +#[allow(dead_code)] // P3(panels-w7): pn.A2 +pub(crate) fn pane_body(app: &mut crate::SlideApp, ui: &mut egui::Ui, cx: &mut craft::ui::contract::BodyCx<'_>) { + let _ = (app, ui, cx); + todo!("pn.A2") +} + +/// Converts notes while preserving the document text formatting. +#[allow(dead_code)] // P3(panels-w7): pn.A4 +pub fn to_notes(body: &deckcraft_model::text::TextBody) -> craft::text::ui::notes::NotesText { + let _ = body; + todo!("pn.A4") +} + +/// Converts notes while preserving the document text formatting. +#[allow(dead_code)] // P3(panels-w7): pn.A4 +pub fn apply(body: &deckcraft_model::text::TextBody, notes: &craft::text::ui::notes::NotesText) -> deckcraft_model::text::TextBody { + let _ = (body, notes); + todo!("pn.A4") +} diff --git a/crates/ui-egui/src/panels/preset_grid.rs b/crates/ui-egui/src/panels/preset_grid.rs new file mode 100644 index 000000000..3c39e2d97 --- /dev/null +++ b/crates/ui-egui/src/panels/preset_grid.rs @@ -0,0 +1,13 @@ +/// Shows a preset grid and returns the selected key. +#[allow(dead_code)] // P3(panels-w9): pn.A9 +pub(crate) fn preset_grid( + ui: &mut egui::Ui, + label: &str, + presets: &[(K, craft::ui::runtime::env::Label)], + current: Option, + aspect: craft::ui::list::ThumbAspect, + paint: impl Fn(&craft::ui::primitives::ContentPainterCx<'_>, egui::Rect, &K), +) -> Option { + let _ = (ui, label, presets, current, aspect, paint); + todo!("pn.A9") +} diff --git a/crates/ui-egui/src/panels/selpane.rs b/crates/ui-egui/src/panels/selpane.rs index b9325548d..f7941f050 100644 --- a/crates/ui-egui/src/panels/selpane.rs +++ b/crates/ui-egui/src/panels/selpane.rs @@ -452,3 +452,10 @@ mod tests { #[cfg(test)] mod ui_tests; + +/// The selection list identity for a document. +#[allow(dead_code)] // P3(panels-w12): pn.A16 +pub fn list_id(uid: u64) -> egui::Id { + let _ = uid; + todo!("pn.A16") +} diff --git a/crates/ui-egui/src/panels/thumbs.rs b/crates/ui-egui/src/panels/thumbs.rs index 4956f2b0b..9585f98a9 100644 --- a/crates/ui-egui/src/panels/thumbs.rs +++ b/crates/ui-egui/src/panels/thumbs.rs @@ -263,7 +263,8 @@ fn list(app: &mut SlideApp, ui: &mut Ui) { if resp.drag_started() { start_slide_drag(app, i); } - resp.context_menu(|ui| slide_menu(app, ui, i)); + // P3(panels-w5): pn.A3 + resp.context_menu(|ui| slide_menu(ui, app, i as u64, &resp)); } if need_more { ui.ctx().request_repaint(); @@ -302,7 +303,9 @@ fn list(app: &mut SlideApp, ui: &mut Ui) { } } -pub fn slide_menu(app: &mut SlideApp, ui: &mut Ui, i: usize) { +pub(crate) fn slide_menu(ui: &mut Ui, app: &mut SlideApp, key: u64, opener: &egui::Response) { + // P3(panels-w5): pn.A3 + let (i, _) = (key as usize, opener); if app.session.active().is_some_and(|d| d.selection.slide != i && !d.selection.slides.iter().any(|id| d.doc.slide_index(*id) == Some(i))) { let _ = app.run("slide.go", json!({"index": i})); } @@ -620,3 +623,10 @@ mod tests { assert_eq!(order(&h), ids, "and the first presentation is untouched"); } } + +/// Shows the pane body inside the pane host. +#[allow(dead_code)] // P3(panels-w5): pn.A2 +pub(crate) fn body(app: &mut crate::SlideApp, ui: &mut egui::Ui, cx: &mut craft::ui::contract::BodyCx<'_>) { + let _ = (app, ui, cx); + todo!("pn.A2") +} diff --git a/crates/ui-egui/src/platform.rs b/crates/ui-egui/src/platform.rs new file mode 100644 index 000000000..6b118eafd --- /dev/null +++ b/crates/ui-egui/src/platform.rs @@ -0,0 +1,19 @@ +/// Everything an entry point chooses for its platform, handed to the app in one value. +pub struct Platform { + /// The runtime installation specification. + pub install: craft::ui::runtime::InstallSpec, + /// The app host services. + pub host: craft::host::Host, + /// The settings store location. + pub settings: craft::settings::Location, + /// The operating system file intake. + pub intake: Option, + /// The platform audio output. + pub audio_out: Option>, + /// The automation control channel. + pub control: Option, + /// The platform window frame policy. + pub frame: craft::window::policy::Frame, + /// The entry point exit work, run once. + pub at_exit: Option>, +} diff --git a/crates/ui-egui/src/presenter_view.rs b/crates/ui-egui/src/presenter_view.rs new file mode 100644 index 000000000..e0e98eaeb --- /dev/null +++ b/crates/ui-egui/src/presenter_view.rs @@ -0,0 +1,64 @@ +use crate::show::{Blank, GridSource}; +use craft::ui::primitives::CachedTexture; +use deckcraft_model::text::TextBody; + +/// The current slide picture state. +pub enum PreviewPic<'a> { + /// The current picture is ready. + Shown(&'a CachedTexture), + /// The picture is being prepared. + Pending, +} + +/// The next slide picture state. +pub enum NextPic<'a> { + /// The next picture is ready. + Shown(&'a CachedTexture), + /// The picture is being prepared. + Pending, + /// There is no next slide. + End, +} + +/// The audience state displayed by the presenter window. +pub struct PresenterModel<'a> { + /// Slide. + pub slide: usize, + /// Total. + pub total: usize, + /// Ended. + pub ended: bool, + /// Elapsed. + pub elapsed: f64, + /// Paused. + pub paused: bool, + /// Notes. + pub notes: &'a TextBody, + /// Notes px. + pub notes_px: f32, + /// Blank. + pub blank: Option, + /// Grid. + pub grid: bool, + /// Zoom armed. + pub zoom_armed: bool, + /// Zoom frame. + pub zoom_frame: Option, + /// Current. + pub current: PreviewPic<'a>, + /// Next. + pub next: NextPic<'a>, + /// Slides. + pub slides: GridSource<'a>, +} + +/// Shows presenter pictures, notes and controls. +pub fn presenter_body( + ui: &mut egui::Ui, + cx: &mut craft::ui::contract::BodyCx<'_>, + model: &PresenterModel<'_>, + out: &mut Vec, +) { + let _ = (ui, cx, model, out); + todo!("ss.A10") +} diff --git a/crates/ui-egui/src/ribbon.rs b/crates/ui-egui/src/ribbon.rs index 90a3869ed..2a64839cd 100644 --- a/crates/ui-egui/src/ribbon.rs +++ b/crates/ui-egui/src/ribbon.rs @@ -480,3 +480,11 @@ mod feature_name_tests { assert_eq!(super::tab_label("Home"), "Home"); } } + +pub(crate) use view::ZoomPick; + +pub(crate) mod diagram_thumbs; +pub(crate) mod fonts; +pub(crate) mod states; + +pub use galleries::preset_outline; diff --git a/crates/ui-egui/src/ribbon/diagram_thumbs.rs b/crates/ui-egui/src/ribbon/diagram_thumbs.rs new file mode 100644 index 000000000..f20718393 --- /dev/null +++ b/crates/ui-egui/src/ribbon/diagram_thumbs.rs @@ -0,0 +1,32 @@ +use craft::ui::primitives::{Revision, ThumbRender, ThumbRequest, ThumbSource, Thumbnails}; + +/// The SmartArt layout thumbnail source. +#[allow(dead_code)] // P3(ribbon-w5): rb.A17 +pub(crate) struct DiagramThumbs<'a> { + source: std::marker::PhantomData<&'a ()>, +} + +impl ThumbSource for DiagramThumbs<'_> { + fn revision(&self, key: &u64, request: &ThumbRequest) -> Revision { + let _ = (key, request); + todo!("rb.A17") + } + fn render(&self, key: &u64, request: &ThumbRequest) -> ThumbRender { + let _ = (key, request); + todo!("rb.A17") + } +} + +/// The layout thumbnail key. +#[allow(dead_code)] // P3(ribbon-w5): rb.A17 +pub(crate) fn key(kind: &str, outline: bool) -> u64 { + let _ = (kind, outline); + todo!("rb.A17") +} + +/// Returns the shared layout thumbnail store. +#[allow(dead_code)] // P3(ribbon-w5): rb.A17 +pub(crate) fn thumbnails(ctx: &egui::Context) -> Thumbnails { + let _ = ctx; + todo!("rb.A17") +} diff --git a/crates/ui-egui/src/ribbon/fonts.rs b/crates/ui-egui/src/ribbon/fonts.rs new file mode 100644 index 000000000..04bdf8516 --- /dev/null +++ b/crates/ui-egui/src/ribbon/fonts.rs @@ -0,0 +1,12 @@ +/// Returns the shared font catalogue. +#[allow(dead_code)] // P3(ribbon-w6): rb.A18 +pub fn catalog() -> &'static std::sync::Arc { + todo!("rb.A18") +} + +/// Returns the presentation theme font rows. +#[allow(dead_code)] // P3(ribbon-w6): rb.A18 +pub fn theme_font_rows(app: &crate::SlideApp) -> Vec { + let _ = app; + todo!("rb.A18") +} diff --git a/crates/ui-egui/src/ribbon/galleries.rs b/crates/ui-egui/src/ribbon/galleries.rs index 41291062f..d13c4d636 100644 --- a/crates/ui-egui/src/ribbon/galleries.rs +++ b/crates/ui-egui/src/ribbon/galleries.rs @@ -388,3 +388,23 @@ fn paint_freeform_icon(p: &egui::Painter, r: Rect, name: &str, ink: Color32) { }; p.add(egui::Shape::line(pts, egui::Stroke::new(1.3, ink))); } + +/// Shows the line style menu. +#[allow(dead_code)] // P3(ribbon-w5): rb.A16 +pub(crate) fn line_menu(app: &mut SlideApp, ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>) { + let _ = (app, ui, cx); + todo!("rb.A16") +} + +/// Shows the slide layout gallery for a command. +#[allow(dead_code)] // P3(ribbon-w5): rb.A16 +pub(crate) fn layout_gallery(app: &mut SlideApp, ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>, cmd: &str) { + let _ = (app, ui, cx, cmd); + todo!("rb.A16") +} + +/// Returns the preset shape outline. +pub fn preset_outline(r: Rect, name: &str) -> Vec> { + let _ = (r, name); + todo!("rb.A16") +} diff --git a/crates/ui-egui/src/ribbon/home.rs b/crates/ui-egui/src/ribbon/home.rs index 73a917567..e19278eca 100644 --- a/crates/ui-egui/src/ribbon/home.rs +++ b/crates/ui-egui/src/ribbon/home.rs @@ -472,3 +472,10 @@ pub(super) fn home(app: &mut SlideApp, ui: &mut Ui) { big(app, ui, Icon::DesignIdeas, "Design\nIdeas", "view.pane", json!({"pane": "designer"})); }); } + +/// Shows a command-bound painter toggle. +#[allow(dead_code)] // P3(ribbon-w6): rb.A19 +pub(super) fn painter_toggle(app: &mut SlideApp, ui: &mut Ui, icon: Icon, label: &str, cmd: &str, armed: bool) { + let _ = (app, ui, icon, label, cmd, armed); + todo!("rb.A19") +} diff --git a/crates/ui-egui/src/ribbon/states.rs b/crates/ui-egui/src/ribbon/states.rs new file mode 100644 index 000000000..08a19d66a --- /dev/null +++ b/crates/ui-egui/src/ribbon/states.rs @@ -0,0 +1,20 @@ +/// Publishes checked command states for the ribbon. +#[allow(dead_code)] // P3(ribbon-w3): rb.A8 +pub(crate) fn publish(app: &mut crate::SlideApp, states: &mut craft::ui::runtime::commands::CommandStates) { + let _ = (app, states); + todo!("rb.A8") +} + +/// The command reference for a tool and its toggle behaviour. +#[allow(dead_code)] // P3(ribbon-w3): rb.A8 +pub(crate) fn tool_ref(kind: &deckcraft_engine::ToolKind, toggle: bool) -> craft::ui::runtime::commands::CommandRef { + let _ = (kind, toggle); + todo!("rb.A8") +} + +/// Returns the current format state for command publication. +#[allow(dead_code)] // P3(ribbon-w3): rb.A9 +pub fn fmt_state(app: &mut crate::SlideApp) -> serde_json::Value { + let _ = app; + todo!("rb.A9") +} diff --git a/crates/ui-egui/src/ribbon/title_bar.rs b/crates/ui-egui/src/ribbon/title_bar.rs index 6c7e825e8..0e689c2b9 100644 --- a/crates/ui-egui/src/ribbon/title_bar.rs +++ b/crates/ui-egui/src/ribbon/title_bar.rs @@ -29,7 +29,9 @@ pub(super) fn title_geometry(integrated: bool) -> (f32, f32, f32) { } /// The window's title row: traffic-light space, quick access, centred title, actions. -pub fn title_bar(app: &mut SlideApp, ui: &mut Ui) { +pub fn title_bar(app: &mut SlideApp, ui: &mut Ui, cx: &mut craft::ui::contract::BodyCx<'_>) { + // P3(ribbon-w4): rb.A2 + let _ = cx; let t = Tokens::get(ui.ctx()); let (height, left, control_h) = title_geometry(app.integrated_titlebar); egui::Panel::top("title_bar").exact_size(height).frame(egui::Frame::NONE.fill(t.chrome)).show(ui, |ui| { diff --git a/crates/ui-egui/src/ribbon/transitions.rs b/crates/ui-egui/src/ribbon/transitions.rs index 6986d828c..e2013ed3d 100644 --- a/crates/ui-egui/src/ribbon/transitions.rs +++ b/crates/ui-egui/src/ribbon/transitions.rs @@ -82,7 +82,8 @@ pub(super) fn transitions(app: &mut SlideApp, ui: &mut Ui) { .and_then(|t| t.sound) .and_then(|m| app.session.active().and_then(|d| d.doc.media(m).map(|i| i.name.trim_end_matches(".wav").to_string()))) .unwrap_or_else(|| if stop { "[Stop Previous Sound]".into() } else { "[No Sound]".into() }); - let combo = craft_ui::ComboBox::from_id_salt("transition_sound").width(140.0).selected_text(name).show_ui(ui, |ui| { + // P3(ribbon-w8): earlier framework ComboBox removal (no contract id) + let combo = egui::ComboBox::from_id_salt("transition_sound").width(140.0).selected_text(name).show_ui(ui, |ui| { let none = cur.as_ref().is_none_or(|t| t.sound.is_none() && !t.stop_sound); if ui.selectable_label(none, "[No Sound]").clicked() { run(app, "transition.sound", json!({"none": true})); diff --git a/crates/ui-egui/src/ribbon/view.rs b/crates/ui-egui/src/ribbon/view.rs index c67f1c80e..7e045b7d2 100644 --- a/crates/ui-egui/src/ribbon/view.rs +++ b/crates/ui-egui/src/ribbon/view.rs @@ -153,3 +153,11 @@ pub(super) fn zoom_menu(app: &mut SlideApp, ui: &mut Ui) { ui.close(); } } + +/// Unsaved ribbon zoom selection. +#[allow(dead_code)] // P3(ribbon-w7): rb.A15 +#[derive(Default)] +pub(crate) struct ZoomPick { + kind: u8, + picked: Vec, +} diff --git a/crates/ui-egui/src/settings.rs b/crates/ui-egui/src/settings.rs index 1fd5223b2..749bcb8ea 100644 --- a/crates/ui-egui/src/settings.rs +++ b/crates/ui-egui/src/settings.rs @@ -169,3 +169,22 @@ mod tests { } } } + +/// Imports the old ui.json and prefs.json settings once. +#[allow(dead_code)] // P3(shell-w12): sh.A25 +pub(crate) fn legacy() -> Vec> { + todo!("sh.A25") +} + +/// The application settings stored by the framework. +#[allow(dead_code)] // P3(shell-w12): sh.A25 +pub(crate) struct DeckSettings; + +impl DeckSettings { + /// Returns settings with values brought into range. + #[allow(dead_code)] // P3(shell-w12): sh.A25 + pub(crate) fn sanitized(self) -> DeckSettings { + let _ = self; + todo!("sh.A25") + } +} diff --git a/crates/ui-egui/src/show.rs b/crates/ui-egui/src/show.rs index 64f0b4dc7..ad417d477 100644 --- a/crates/ui-egui/src/show.rs +++ b/crates/ui-egui/src/show.rs @@ -36,6 +36,19 @@ use zoom::Zoom; use zoom::{GOTO_DIGITS, norm_on_slide, see_all_cells, see_all_hit, toggle_blank, unit_uv, wheel_zoom_lines, zoom_uv}; pub struct Show { + #[allow(dead_code)] // P3(show-w4): ss.A4 + view: craft::behavior::CanvasView, + #[allow(dead_code)] // P3(show-w4): ss.A4 + zoomed: bool, + #[allow(dead_code)] // P3(show-w4): ss.A4 + frames: frames::ShowFrames, + #[allow(dead_code)] // P3(show-w4): ss.A4 + next_preview: Option<(std::sync::Arc, usize, std::sync::Arc)>, + #[allow(dead_code)] // P3(show-w4): ss.A4 + presenter_start: PresenterStart, + #[allow(dead_code)] // P3(show-w4): ss.A4 + remote_images: crate::presenter::DeltaCache, + /// Monotonic identity of this show instance. Starting a show again (even at the same slide /// and step) is a new instance, so a queued click cannot cross an ABA transition. pub(crate) instance: u64, @@ -119,7 +132,7 @@ pub struct Show { hidden_anchor: Option<(f64, web_time::Instant)>, } -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq, Hash)] struct Key { slide: usize, step: usize, @@ -140,8 +153,8 @@ struct Prefetch { } /// What a slide's backdrop was rendered for. -#[derive(Clone, Copy, Debug, PartialEq)] -struct BackKey { +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub(crate) struct BackKey { slide: usize, size: (u32, u32), doc: usize, @@ -219,6 +232,19 @@ impl Show { /// slide starts an ended show. pub fn new(doc: &Presentation, from: usize, reading: bool, presenter: bool) -> Self { Show { + // P3(show-w4): ss.A4 + view: craft::behavior::CanvasView::new(egui::Rect::NOTHING, craft::behavior::kurbo::Point::ZERO, 1.0), + // P3(show-w4): ss.A4 + zoomed: Default::default(), + // P3(show-w4): ss.A4 + frames: Default::default(), + // P3(show-w4): ss.A4 + next_preview: Default::default(), + // P3(show-w4): ss.A4 + presenter_start: if presenter { PresenterStart::Forced } else { PresenterStart::Off }, + // P3(show-w4): ss.A4 + remote_images: Default::default(), + instance: 0, state: ShowState::start_at(doc, from), reading, @@ -621,3 +647,73 @@ fn show_fills_screen(reading: bool, show_type: &str) -> bool { #[cfg(test)] mod tests; + +/// The requested presenter start mode. +#[allow(dead_code)] // P3(show-w4): ss.A4 +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub(crate) enum PresenterStart { + Off, + Setting, + Forced, +} + +/// The blank audience screen colour. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Blank { + /// Black audience screen. + Black, + /// White audience screen. + White, +} + +impl Show { + /// The current zoom window in slide space. + #[allow(dead_code)] // P3(show-w4): ss.A5 + pub(crate) fn zoom_window(&self) -> Option { + todo!("ss.A5") + } +} + +impl Show { + /// Zooms the audience at a slide point. + #[allow(dead_code)] // P3(show-w4): ss.A5 + pub(crate) fn zoom_at(&mut self, at: craft::behavior::kurbo::Point) { + let _ = at; + todo!("ss.A5") + } +} + +impl Show { + /// The next show wake deadline. + #[allow(dead_code)] // P3(show-w4): ss.A5 + pub(crate) fn next_wake(&self, now: f64) -> Option { + let _ = now; + todo!("ss.A5") + } +} + +impl Show { + /// Holds the show at the requested time. + #[allow(dead_code)] // P3(show-w4): ss.A5 + pub(crate) fn set_hold(&mut self, t: Option) { + let _ = t; + todo!("ss.A5") + } +} + +impl Show { + /// The shell page kind for this show. + #[allow(dead_code)] // P3(show-w4): ss.A5 + pub(crate) fn page_kind(&self, doc: &Presentation, remote: bool) -> craft::ui::shell::PageKind { + let _ = (doc, remote); + todo!("ss.A5") + } +} + +pub use grid::GridSource; + +pub(crate) mod bars; +pub(crate) mod commands; +pub(crate) mod frames; +pub(crate) mod grid; +pub(crate) mod tool; diff --git a/crates/ui-egui/src/show/bars.rs b/crates/ui-egui/src/show/bars.rs new file mode 100644 index 000000000..59a4d4b1c --- /dev/null +++ b/crates/ui-egui/src/show/bars.rs @@ -0,0 +1,6 @@ +/// Shows the audience show bars. +#[allow(dead_code)] // P3(show-w5): ss.A9 +pub(crate) fn show(ui: &mut egui::Ui, show: &super::Show, room: egui::Rect) { + let _ = (ui, show, room); + todo!("ss.A9") +} diff --git a/crates/ui-egui/src/show/commands.rs b/crates/ui-egui/src/show/commands.rs new file mode 100644 index 000000000..3df4634a0 --- /dev/null +++ b/crates/ui-egui/src/show/commands.rs @@ -0,0 +1,95 @@ +/// The show window a command targets. +#[allow(dead_code)] // P3(show-w4): ss.A2 +pub(crate) enum ShowWindow { + Audience, + Presenter, +} + +/// The commands shared by audience and presenter windows. +#[allow(dead_code)] // P3(show-w4): ss.A1 +#[derive(Clone, Copy, Debug, PartialEq, Eq, craft::ui::contract::CommandSet)] +#[command(prefix = "show", scope = "show")] +pub(crate) enum ShowCommands { + #[command(label = "Next")] + Next, + #[command(label = "Previous")] + Previous, + #[command(label = "First")] + First, + #[command(label = "Last")] + Last, + #[command(label = "GoToTyped")] + GoToTyped, + #[command(label = "EraseTyped")] + EraseTyped, + #[command(label = "Cancel")] + Cancel, + #[command(label = "Back")] + Back, + #[command(label = "Pen")] + Pen, + #[command(label = "Laser")] + Laser, + #[command(label = "Arrow")] + Arrow, + #[command(label = "Black")] + Black, + #[command(label = "White")] + White, + #[command(label = "EraseInk")] + EraseInk, + #[command(label = "Grid")] + Grid, + #[command(label = "Zoom")] + Zoom, + #[command(label = "Timer")] + Timer, + #[command(label = "TimerReset")] + TimerReset, + #[command(label = "NotesSmaller")] + NotesSmaller, + #[command(label = "NotesLarger")] + NotesLarger, + #[command(label = "End")] + End, + #[command(label = "Digit0")] + Digit0, + #[command(label = "Digit1")] + Digit1, + #[command(label = "Digit2")] + Digit2, + #[command(label = "Digit3")] + Digit3, + #[command(label = "Digit4")] + Digit4, + #[command(label = "Digit5")] + Digit5, + #[command(label = "Digit6")] + Digit6, + #[command(label = "Digit7")] + Digit7, + #[command(label = "Digit8")] + Digit8, + #[command(label = "Digit9")] + Digit9, +} + +/// Runs a show command for its window. +#[allow(dead_code)] // P3(show-w4): ss.A2 +pub(crate) fn run_command( + show: &mut super::Show, + doc: &std::sync::Arc, + now: f64, + command: ShowCommands, + window: ShowWindow, +) -> bool { + let _ = (show, doc, now, command, window); + todo!("ss.A2") +} + +/// Adds a typed slide number digit. +#[allow(dead_code)] // P3(show-w4): ss.A2 +pub(crate) fn type_digit(show: &mut super::Show, digit: char, now: f64) { + let _ = (show, digit, now); + todo!("ss.A2") +} diff --git a/crates/ui-egui/src/show/frames.rs b/crates/ui-egui/src/show/frames.rs new file mode 100644 index 000000000..894b33153 --- /dev/null +++ b/crates/ui-egui/src/show/frames.rs @@ -0,0 +1,90 @@ +use craft::ui::primitives::{CachedTexture, ContentPainterCx}; +use deckcraft_model::Presentation; +use std::sync::Arc; + +/// The next slide preview job key. +#[allow(dead_code)] // P3(show-w6): ss.A7 +#[derive(Clone, PartialEq, Eq, Hash)] +pub(crate) struct NextPreview; + +/// A landed next slide preview. +#[allow(dead_code)] // P3(show-w6): ss.A7 +pub(crate) struct PreviewFrame { + pub doc: Arc, + pub slide: usize, + pub image: egui::ColorImage, +} + +/// The show frame jobs and cached pictures. +#[allow(dead_code)] // P3(show-w6): ss.A7 +pub(crate) struct ShowFrames { + pub(crate) previews: craft::host::queue::JobQueue, +} + +/// Prepares show frames and preview jobs. +#[allow(dead_code)] // P3(show-w6): ss.A7 +pub(crate) fn prepare(show: &mut super::Show, doc: &Arc, media: &crate::media::MediaHost, room_px: egui::Vec2) { + let _ = (show, doc, media, room_px); + todo!("ss.A7") +} + +/// Paints prepared frames in the canvas view. +#[allow(dead_code)] // P3(show-w6): ss.A7 +pub(crate) fn paint( + frames: &ShowFrames, + media: &crate::media::MediaHost, + doc: &Presentation, + cx: &ContentPainterCx<'_>, + view: craft::behavior::CanvasView, +) { + let _ = (frames, media, doc, cx, view); + todo!("ss.A7") +} + +impl ShowFrames { + /// Returns a show backdrop. + #[allow(dead_code)] // P3(show-w6): ss.A7 + pub(crate) fn backdrop(&mut self, doc: &Arc, key: super::BackKey) -> Arc { + let _ = (doc, key); + todo!("ss.A7") + } +} + +impl ShowFrames { + /// Prefetches a show backdrop. + #[allow(dead_code)] // P3(show-w6): ss.A7 + pub(crate) fn prefetch_backdrop(&mut self, doc: &Arc, key: super::BackKey) { + let _ = (doc, key); + todo!("ss.A7") + } +} + +impl ShowFrames { + /// The slide of the frame on screen. + #[allow(dead_code)] // P3(show-w6): ss.A7 + pub(crate) fn shown_slide(&self) -> Option { + todo!("ss.A7") + } +} + +impl ShowFrames { + /// The current presenter picture. + #[allow(dead_code)] // P3(show-w6): ss.A7 + pub(crate) fn current_texture(&self) -> Option<&CachedTexture> { + todo!("ss.A7") + } +} + +impl ShowFrames { + /// The next presenter picture. + #[allow(dead_code)] // P3(show-w6): ss.A7 + pub(crate) fn next_texture(&self) -> Option<&CachedTexture> { + todo!("ss.A7") + } +} + +impl Default for ShowFrames { + fn default() -> Self { + todo!("ss.A7") + } +} diff --git a/crates/ui-egui/src/show/grid.rs b/crates/ui-egui/src/show/grid.rs new file mode 100644 index 000000000..0985c7fca --- /dev/null +++ b/crates/ui-egui/src/show/grid.rs @@ -0,0 +1,35 @@ +/// The slide pictures for a show grid. +pub enum GridSource<'a> { + /// Presentation slides rendered as thumbnails. + Deck { + /// Presentation. + doc: &'a deckcraft_model::Presentation, + /// Thumbnail store. + thumbs: &'a craft::ui::primitives::Thumbnails, + /// Presentation thumbnail source. + source: &'a crate::thumb_source::DeckThumbs, + }, + /// Pictures received from the audience window. + Pictures(&'a [craft::ui::primitives::CachedTexture]), +} + +/// The selected slide and grid cell bounds. +#[allow(dead_code)] // P3(show-w6): ss.A8 +pub(crate) struct GridPick { + pub picked: Option, + pub cells: Vec, +} + +/// Shows the slide grid. +#[allow(dead_code)] // P3(show-w6): ss.A8 +pub(crate) fn sheet(ui: &mut egui::Ui, slides: GridSource<'_>, current: usize, aspect: f32) -> GridPick { + let _ = (ui, slides, current, aspect); + todo!("ss.A8") +} + +/// The slide grid cell rectangles. +#[allow(dead_code)] // P3(show-w6): ss.A8 +pub(crate) fn cells(ctx: &egui::Context, room: egui::Rect, count: usize, aspect: f32) -> Vec { + let _ = (ctx, room, count, aspect); + todo!("ss.A8") +} diff --git a/crates/ui-egui/src/show/media.rs b/crates/ui-egui/src/show/media.rs index 51cd7b99f..259b09f05 100644 --- a/crates/ui-egui/src/show/media.rs +++ b/crates/ui-egui/src/show/media.rs @@ -146,7 +146,7 @@ pub(super) enum Pick { /// The slide's shapes at the pointer, for [`ShowState::click`]. #[derive(Default)] -pub(super) struct Under { +pub(crate) struct Under { shapes: Vec, /// Whether each of `shapes` is currently shown (an animation may have hidden it). visible: Vec, diff --git a/crates/ui-egui/src/show/presenter.rs b/crates/ui-egui/src/show/presenter.rs index 38b8d76bd..b435b5852 100644 --- a/crates/ui-egui/src/show/presenter.rs +++ b/crates/ui-egui/src/show/presenter.rs @@ -299,3 +299,10 @@ pub(super) fn presenter_notes(ui: &mut Ui, notes: &deckcraft_model::text::TextBo crate::notes::view(ui, notes, &crate::notes::Look { size: px, color: Some(color) }) } } + +/// Shows one presenter pass over the shared presenter body. +#[allow(dead_code)] // P3(show-w7): ss.A10 +pub(super) fn presenter_pass(ui: &mut Ui, app: &mut crate::SlideApp, show: &mut Show, doc: &std::sync::Arc, now: f64) -> bool { + let _ = (ui, app, show, doc, now); + todo!("ss.A10") +} diff --git a/crates/ui-egui/src/show/tool.rs b/crates/ui-egui/src/show/tool.rs new file mode 100644 index 000000000..c6b9a07ba --- /dev/null +++ b/crates/ui-egui/src/show/tool.rs @@ -0,0 +1,42 @@ +/// The audience pointer tool and its output. +#[allow(dead_code)] // P3(show-w4): ss.A3 +pub(crate) struct ShowTool<'a> { + pub show: &'a mut super::Show, + pub doc: &'a std::sync::Arc, + pub under: Option, + pub out: &'a mut Out, +} + +/// The show tool actions and keep-show decision. +#[allow(dead_code)] // P3(show-w4): ss.A3 +pub(crate) struct Out { + pub keep: bool, + pub actions: Vec, +} + +use craft::ui::canvas::{CanvasTool, ToolAction, ToolContext, ToolPath, ToolPointer}; +impl CanvasTool for ShowTool<'_> { + fn press(&mut self, pointer: &ToolPointer, cx: &mut ToolContext<'_>) -> ToolAction { + let _ = (pointer, cx); + todo!("ss.A3") + } + fn drag(&mut self, pointer: &ToolPointer, cx: &mut ToolContext<'_>) { + let _ = (pointer, cx); + todo!("ss.A3") + } + fn release(&mut self, pointer: &ToolPointer, cx: &mut ToolContext<'_>) { + let _ = (pointer, cx); + todo!("ss.A3") + } + fn cancel(&mut self, reason: craft::behavior::CancelReason, cx: &mut ToolContext<'_>) { + let _ = (reason, cx); + todo!("ss.A3") + } + fn paint(&self, draw: &craft::ui::primitives::Draw<'_>, cx: &ToolContext<'_>) { + let _ = (draw, cx); + todo!("ss.A3") + } + fn command_form(&self) -> ToolPath { + todo!("ss.A3") + } +} diff --git a/crates/ui-egui/src/sorter.rs b/crates/ui-egui/src/sorter.rs index 638cdb267..42fccd5e9 100644 --- a/crates/ui-egui/src/sorter.rs +++ b/crates/ui-egui/src/sorter.rs @@ -251,7 +251,8 @@ fn place_slides(app: &mut SlideApp, ui: &mut Ui, g: &Grid<'_>, budget: &mut u32, if resp.drag_started() && app.sorter.drag.is_none() { crate::thumbs::start_slide_drag(app, i); } - resp.context_menu(|ui| crate::thumbs::slide_menu(app, ui, i)); + // P3(panels-w6): pn.A3 + resp.context_menu(|ui| crate::thumbs::slide_menu(ui, app, i as u64, &resp)); } }); } diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index e7b1c054d..164694930 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -1,4 +1,4 @@ -use super::{Deserialize, LayoutId, MasterId, Serialize, SlideId, Target, qat, theme}; +use super::{Deserialize, LayoutId, MasterId, Serialize, SlideId, Target, qat}; /// The operation the user asked for. Kept with the request so a late completion does not /// guess a command from the file name. @@ -50,7 +50,7 @@ pub enum ViewMode { #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(default, rename_all = "camelCase")] pub struct UiState { - pub brightness: theme::Brightness, + pub brightness: Brightness, pub tab: String, pub ribbon_collapsed: bool, pub view: ViewMode, @@ -99,7 +99,7 @@ pub struct UiState { impl Default for UiState { fn default() -> Self { UiState { - brightness: theme::Brightness::Light, + brightness: Brightness::Light, tab: "Home".into(), ribbon_collapsed: false, view: ViewMode::Normal, @@ -204,3 +204,6 @@ impl ImeDescriptorKey { Self { owner, context_generation, purpose } } } + +/// The interface brightness saved in app settings. +pub use crate::theme::Brightness; diff --git a/crates/ui-egui/src/test_harness.rs b/crates/ui-egui/src/test_harness.rs new file mode 100644 index 000000000..e758d34e6 --- /dev/null +++ b/crates/ui-egui/src/test_harness.rs @@ -0,0 +1,20 @@ +use crate::{Platform, Services, Session, SlideApp}; + +/// Builds the app on the harness context with in-memory settings. +#[allow(dead_code)] // P3(shell-w11): sh.A11 +pub(crate) fn harness(session: Session, services: Services) -> egui_kittest::Harness<'static, SlideApp> { + let _ = (session, services); + todo!("sh.A11") +} + +/// Builds the app through an adjusted platform and the caller harness builder. +#[allow(dead_code)] // P3(shell-w11): sh.A11 +pub(crate) fn harness_with( + session: Session, + services: Services, + builder: egui_kittest::HarnessBuilder, + adjust: impl FnOnce(&mut Platform), +) -> egui_kittest::Harness<'static, SlideApp> { + let _ = (session, services, builder, adjust); + todo!("sh.A11") +} diff --git a/crates/ui-egui/src/thumb_source.rs b/crates/ui-egui/src/thumb_source.rs new file mode 100644 index 000000000..511b8c056 --- /dev/null +++ b/crates/ui-egui/src/thumb_source.rs @@ -0,0 +1,73 @@ +use craft::ui::display::Picture; +use craft::ui::primitives::{ContentPainterCx, Revision, ThumbRender, ThumbRequest, ThumbSource, Thumbnails}; +use craft::ui::runtime::env::Label; +use deckcraft_model::{Presentation, SlideId}; +use egui::Rect; +use std::sync::Arc; + +/// A slide or master layout thumbnail key. +#[allow(dead_code)] // P3(panels-w4): pn.A1 +#[derive(Clone, Copy)] +pub(crate) enum ThumbKey { + Slide(SlideId), + Layout { master: usize, layout: Option }, +} + +impl ThumbKey { + /// Encodes the thumbnail key. + #[allow(dead_code)] // P3(panels-w4): pn.A1 + pub(crate) fn bits(self) -> u64 { + let _ = self; + todo!("pn.A1") + } + /// Decodes a thumbnail key. + #[allow(dead_code)] // P3(panels-w4): pn.A1 + pub(crate) fn of(bits: u64) -> Option { + let _ = bits; + todo!("pn.A1") + } +} + +/// The presentation thumbnail source. +pub struct DeckThumbs; + +impl DeckThumbs { + /// Creates a presentation thumbnail source. + #[allow(dead_code)] // P3(panels-w4): pn.A1 + pub(crate) fn new(doc: Arc, grayscale: bool) -> Self { + let _ = (doc, grayscale); + todo!("pn.A1") + } +} + +impl ThumbSource for DeckThumbs { + fn revision(&self, key: &u64, request: &ThumbRequest) -> Revision { + let _ = (key, request); + todo!("pn.A1") + } + fn render(&self, key: &u64, request: &ThumbRequest) -> ThumbRender { + let _ = (key, request); + todo!("pn.A1") + } +} + +/// Returns the shared deck thumbnail store. +#[allow(dead_code)] // P3(panels-w4): pn.A1 +pub(crate) fn thumbnails(ctx: &egui::Context) -> Thumbnails { + let _ = ctx; + todo!("pn.A1") +} + +/// Shows a deck thumbnail picture. +#[allow(dead_code)] // P3(panels-w4): pn.A1 +pub(crate) fn picture<'a>(label: impl Into