From 780fac72c5f6b49e1f5deab8f366f214f709581d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 29 Nov 2026 14:25:29 -0800 Subject: [PATCH 01/29] Artwork Cleanup: Release All Containers takes apart every group, clipping mask and compound path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Object › Plug-ins › Artwork Cleanup › Release All Containers… (addon.cleanup.releaseAll) takes apart every container in the selection, the objects named by ids or the whole document, at every level of nesting, as one undo step, so that only the objects they held are left. Groups are ungrouped, clipping groups are ungrouped and layers stop clipping (their clipping paths stay as plain paths), and compound paths and paths of several subpaths become one path per subpath. Each kind can be turned off; at least one must be on. Objects keep the opacity of the groups and compound paths they were in, and a compound path's paths take its paint. Live objects kept as groups or compound paths (compound shapes, Live Paint groups, graphs, dimensions, Objects on Path, generated art and others) and objects with an opacity mask stay whole, and the clipping path of a clipping group or layer that stays is left as it is. From the selection or the document, locked and hidden objects and objects on a locked artboard stay whole; named by ids, locked and hidden containers are taken apart too, as Deep Ungroup does. Nothing released records no undo step. The dialog previews on the canvas and turns OK off when no kind is ticked or when Selection is chosen with nothing selected. Docs: docs/mcp.md, docs/target-app-parity.md. --- crates/engine/src/cmd/addons/cleanup.rs | 8 +- .../engine/src/cmd/addons/cleanup/release.rs | 344 ++++++++++++++++ .../src/cmd/addons/cleanup/release/tests.rs | 371 ++++++++++++++++++ crates/engine/src/cmd/plugin_call/reviewed.rs | 1 + .../engine/src/tests/ids_without_selection.rs | 1 + crates/engine/tests/command_sweep.rs | 1 + crates/ui-egui/src/addons/cleanup.rs | 7 +- crates/ui-egui/src/addons/cleanup/release.rs | 57 +++ .../src/addons/cleanup/release/tests.rs | 99 +++++ crates/ui-egui/src/addons/dialogs.rs | 3 +- docs/mcp.md | 19 + docs/target-app-parity.md | 6 + docs/ui-parity.md | 2 +- 13 files changed, 912 insertions(+), 7 deletions(-) create mode 100644 crates/engine/src/cmd/addons/cleanup/release.rs create mode 100644 crates/engine/src/cmd/addons/cleanup/release/tests.rs create mode 100644 crates/ui-egui/src/addons/cleanup/release.rs create mode 100644 crates/ui-egui/src/addons/cleanup/release/tests.rs diff --git a/crates/engine/src/cmd/addons/cleanup.rs b/crates/engine/src/cmd/addons/cleanup.rs index d5f241b4ee..8f4def2dcd 100644 --- a/crates/engine/src/cmd/addons/cleanup.rs +++ b/crates/engine/src/cmd/addons/cleanup.rs @@ -1,9 +1,10 @@ //! Artwork Cleanup (`addon.cleanup.*`), a built-in add-on: Simplify Anchors (Keep Shape), the -//! Document Health Check (check, show and fix the issues it finds), Deep Ungroup and Rejoin Path -//! Pieces, and its text tools ([`text`]). Its panel and its submenu, Object › Plug-ins › Artwork -//! Cleanup, are the UI's. +//! Document Health Check (check, show and fix the issues it finds), Deep Ungroup, Release All +//! Containers ([`release`]) and Rejoin Path Pieces, and its text tools ([`text`]). Its panel and +//! its submenu, Object › Plug-ins › Artwork Cleanup, are the UI's. mod checks; +mod release; #[cfg(test)] mod tests; mod text; @@ -87,6 +88,7 @@ pub fn specs() -> Vec { rejoin ), ]; + v.extend(release::specs()); v.extend(text::specs()); v } diff --git a/crates/engine/src/cmd/addons/cleanup/release.rs b/crates/engine/src/cmd/addons/cleanup/release.rs new file mode 100644 index 0000000000..924803cd32 --- /dev/null +++ b/crates/engine/src/cmd/addons/cleanup/release.rs @@ -0,0 +1,344 @@ +//! Artwork Cleanup's Release All Containers (`addon.cleanup.releaseAll`): every group, clipping +//! mask and compound path in the selection, the objects named or the whole document, taken apart +//! at every level of nesting as one undo step, so that only the objects they held are left. + +#[cfg(test)] +mod tests; + +use std::collections::{HashMap, HashSet}; + +use serde_json::{Value, json}; +use vectorcraft_doc::{Document, Node, NodeId, NodeKind}; +use vectorcraft_geom::PathData; +use vectorcraft_tools::builder::is_live_paint; + +use super::checks::{MAX_OBJECTS, Scope}; +use super::{named, retain_targets, scope_of}; +use crate::cmd::{CommandSpec, bad, checked_ids_or_selection, cmd, has_doc, switch_or}; +use crate::{EngineError, Result, Session}; + +/// The command. +const COMMAND: &str = "addon.cleanup.releaseAll"; + +pub(super) fn specs() -> Vec { + vec![cmd!( + "addon.cleanup.releaseAll", + "Release All Containers…", + ["Object", "Plug-ins", "Artwork Cleanup"], + None, + "{scope?: \"selection\"|\"document\" (default: the selection, or the document while nothing is selected), ids?: [id…] (the objects, groups and layers to release in, instead of `scope`), groups?: bool (true: groups are ungrouped), clipGroups?: bool (true: clipping groups are ungrouped and layers stop clipping, their clipping paths kept as plain paths), compoundPaths?: bool (true: compound paths, and paths of several subpaths, become one path per subpath); at least one of the three} take apart every container of the kinds asked for, at every level of nesting, as one undo step when one goes; layers stay; each object keeps the opacity of the groups and compound paths it was in, and a compound path's paths take its paint; objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, blends, envelopes and other live objects stay whole, and the clipping path of a clipping group or layer that stays is left as it is, also when it is selected or named itself; from the selection or the document, locked and hidden objects, and objects on a locked artboard, stay whole; named by `ids`, locked and hidden ones are taken apart too (their objects become locked or hidden as they were), but not those on a locked artboard; the selection keeps what it held, each object taken apart replaced by what it left, locked and hidden objects left out → {scope (\"selection\", \"document\" or \"ids\"), ids (the objects selected), groups, clipGroups, compoundPaths (how many of each were released)}", + has_doc, + release_all + )] +} + +/// The kinds of container a request takes apart. +#[derive(Clone, Copy)] +struct Kinds { + groups: bool, + clips: bool, + compounds: bool, +} + +impl Kinds { + /// Whether a group is taken apart: a clipping group (`clip`) with `clips`, another with `groups`. + fn takes_group(self, clip: bool) -> bool { + if clip { self.clips } else { self.groups } + } +} + +/// One run over the objects: what it takes apart and what it found. +struct Release<'a> { + kinds: Kinds, + /// Locked and hidden objects are taken apart too. + named: bool, + /// The containers on a locked artboard, which stay whole. + held: &'a HashSet, + /// Groups, clipping groups and layers, and compound paths released. + counts: [usize; 3], + /// Objects made from the containers taken apart. + made: usize, + /// Each container taken apart and the objects left in its place. + left: HashMap>, +} + +/// Whether `n` stays whole whatever is asked: a live object kept as a group or compound path +/// (a compound shape, Live Paint group, graph, dimension, flare, Objects on Path, generated art, +/// Shaper Group, Image Trace object, a clipping path's painted pieces) or one with an opacity mask, +/// whose contents would lose what it does to them. +fn live(n: &Node) -> bool { + let x = n.extras(); + x.mask.is_some() + || x.shaper.is_some() + || x.trace.is_some() + || x.graph.is_some() + || x.dimension.is_some() + || x.flare.is_some() + || x.objects_on_path.is_some() + || x.generated.is_some() + || x.live_paint_gaps.is_some() + || x.clip_pieces + || n.is_compound_shape() + || is_live_paint(n) +} + +/// The containers under `roots` that a run could take apart, into `out`. +fn candidates(n: &Node, out: &mut Vec) { + match &n.kind { + NodeKind::Layer { children, .. } | NodeKind::Group { children, .. } | NodeKind::Compound { children, .. } => { + if !n.is_layer() { + out.push(n.id); + } + children.iter().for_each(|c| candidates(c, out)); + } + NodeKind::Path { path, .. } if path.subpaths.len() > 1 => out.push(n.id), + _ => {} + } +} + +impl Release<'_> { + fn total(&self) -> usize { + self.counts.iter().sum() + } + + /// Whether `n` is left as it is: locked or hidden (unless named), on a locked artboard, or live. + fn keeps(&self, n: &Node) -> bool { + (!self.named && (n.locked || !n.visible)) || self.held.contains(&n.id) || live(n) + } + + /// `n` with the containers in it released, into `out`; `member` counts what a container left. + fn node(&mut self, d: &mut Document, n: Node, member: bool, out: &mut Vec) -> Result<()> { + if self.keeps(&n) { + if member { + self.made(1)?; + } + out.push(n); + return Ok(()); + } + match &n.kind { + NodeKind::Group { clip, .. } if self.kinds.takes_group(*clip) => { + let clip = *clip; + self.counts[usize::from(clip)] += 1; + self.take_apart(d, n, clip, false, out) + } + NodeKind::Compound { .. } if self.kinds.compounds => { + self.counts[2] += 1; + self.take_apart(d, n, false, true, out) + } + NodeKind::Path { path, clipping: false, guide: false, .. } if self.kinds.compounds && path.subpaths.len() > 1 => { + self.counts[2] += 1; + self.split(d, n, out) + } + NodeKind::Group { .. } | NodeKind::Layer { .. } => self.keep(d, n, member, out), + _ => { + if member { + self.made(1)?; + } + out.push(n); + Ok(()) + } + } + } + + /// Group or compound path `n` replaced by its members, released in turn. Members take on the + /// container's opacity, are hidden when it was hidden and locked when it was locked; a + /// compound path's take its paint; a clipping group's clipping path becomes a plain path. + fn take_apart(&mut self, d: &mut Document, n: Node, clip: bool, compound: bool, out: &mut Vec) -> Result<()> { + let Some(children) = n.children() else { return Ok(()) }; + let mut parts = vec![]; + for (k, c) in children.iter().enumerate() { + let mut c = (**c).clone(); + if clip + && k == 0 + && let NodeKind::Path { clipping, .. } = &mut c.kind + { + *clipping = false; + } + if compound { + c.appearance = n.appearance.clone(); + if n.extras().pixel_aligned { + c.extras_mut().pixel_aligned = true; + } + } + c.opacity *= n.opacity; + c.visible &= n.visible; + c.locked |= n.locked; + self.node(d, c, true, &mut parts)?; + } + self.left.insert(n.id, parts.iter().map(|p| p.id).collect()); + out.extend(parts); + Ok(()) + } + + /// Path `n` of several subpaths as one path per subpath with its paint, in the same stacking + /// order; the first keeps its id. + fn split(&mut self, d: &mut Document, n: Node, out: &mut Vec) -> Result<()> { + let Some(path) = n.path_data() else { return Ok(()) }; + if self.made.saturating_add(path.subpaths.len()) > MAX_OBJECTS { + return Err(EngineError::Other("Release All Containers: too many objects to release at once".into())); + } + let mut template = n.clone(); + if let NodeKind::Path { path, live, .. } = &mut template.kind { + (*path, *live) = (PathData::single(Default::default()), None); + } + let mut parts = Vec::with_capacity(path.subpaths.len()); + for (k, sp) in path.subpaths.iter().enumerate() { + let mut c = if k == 0 { template.clone() } else { d.reid(&template) }; + if let NodeKind::Path { path, live, .. } = &mut c.kind { + (*path, *live) = (PathData::single(sp.clone()), None); + } + parts.push(c); + } + self.made(parts.len())?; + self.left.insert(n.id, parts.iter().map(|p| p.id).collect()); + out.extend(parts); + Ok(()) + } + + /// Group or layer `n` kept, with the containers in it released. A layer stops clipping when + /// clipping groups are released; the clipping path of a group or layer that still clips is + /// left as it is. Unchanged, `n` itself goes to `out`. + fn keep(&mut self, d: &mut Document, mut n: Node, member: bool, out: &mut Vec) -> Result<()> { + if member { + self.made(1)?; + } + let before = self.total(); + let mut clips = n.clips(); + if clips && n.is_layer() && self.kinds.clips { + self.counts[1] += 1; + n.set_clips(false); + clips = false; + if let Some(first) = n.children_mut().and_then(|c| c.first_mut()) + && let NodeKind::Path { clipping, .. } = &mut std::sync::Arc::make_mut(first).kind + { + *clipping = false; + } + } + let Some(children) = n.children().cloned() else { + out.push(n); + return Ok(()); + }; + let mut kept = Vec::with_capacity(children.len()); + for (k, c) in children.into_iter().enumerate() { + if clips && k == 0 { + if member { + self.made(1)?; + } + kept.push((*c).clone()); + } else { + self.node(d, (*c).clone(), member, &mut kept)?; + } + } + if self.total() != before + && let Some(ch) = n.children_mut() + { + *ch = kept.into_iter().map(std::sync::Arc::new).collect(); + } + out.push(n); + Ok(()) + } + + /// Counts the objects made, refusing a run that makes too many. + fn made(&mut self, count: usize) -> Result<()> { + self.made += count; + if self.made > MAX_OBJECTS { + return Err(EngineError::Other("Release All Containers: too many objects to release at once".into())); + } + Ok(()) + } + + /// `id`, or the objects left in its place when it was taken apart. + fn replaced(&self, id: NodeId, into: &mut Vec) { + match self.left.get(&id) { + Some(ids) => into.extend(ids), + None => into.push(id), + } + } +} + +/// Whether `id` is the clipping path of the clipping group or layer it is in. +fn clips_its_parent(d: &Document, id: NodeId) -> bool { + d.parent_of(id).and_then(|p| d.node(p)).is_some_and(|p| p.clips() && p.children().and_then(|c| c.first()).is_some_and(|c| c.id == id)) +} + +fn release_all(s: &mut Session, p: &Value) -> Result { + let kinds = Kinds { + groups: switch_or(p, "groups", true, COMMAND)?, + clips: switch_or(p, "clipGroups", true, COMMAND)?, + compounds: switch_or(p, "compoundPaths", true, COMMAND)?, + }; + if !(kinds.groups || kinds.clips || kinds.compounds) { + return Err(bad(COMMAND, "`groups`, `clipGroups` and `compoundPaths` are all false: there is nothing to release")); + } + let named = named(p); + if named && p.get("scope").is_some_and(|v| !v.is_null()) { + return Err(bad(COMMAND, "give `scope` or `ids`, not both")); + } + let (roots, name) = if named { + let mut roots = checked_ids_or_selection(s, p, COMMAND)?; + retain_targets(&s.doc()?.doc, &mut roots, true, |id| *id); + (roots, "ids") + } else { + match scope_of(s, p, COMMAND)? { + (Scope::Document, name) => (s.doc()?.doc.layers.iter().map(|l| l.id).collect(), name), + (Scope::Objects(mut roots), name) => { + retain_targets(&s.doc()?.doc, &mut roots, false, |id| *id); + (roots, name) + } + } + }; + let st = s.doc()?; + let (mut d, mut sel) = ((*st.doc).clone(), st.selection.clone()); + // The containers on a locked artboard, found while nothing is changed yet. + let held: HashSet = if d.artboards.iter().any(|a| a.locked) { + let mut found = vec![]; + for n in roots.iter().filter_map(|id| d.node(*id)) { + candidates(n, &mut found); + } + let locks = d.locked_artboards(); + found.into_iter().filter(|id| locks.holds_id(*id)).collect() + } else { + HashSet::new() + }; + let mut run = Release { kinds, named, held: &held, counts: [0; 3], made: 0, left: HashMap::new() }; + let mut items = vec![]; + for id in roots { + // A clipping path picked inside the clipping group or layer it clips stays as it is, as it + // does when that group or layer is released in. + if clips_its_parent(&d, id) { + continue; + } + let Some(n) = d.node(id).cloned() else { continue }; + let before = run.total(); + let mut out = vec![]; + run.node(&mut d, n, false, &mut out)?; + if run.total() != before { + items.push((id, out)); + } + } + let [groups, clips, compounds] = run.counts; + // With nothing to release, the document, the selection and the undo history stay as they are. + if run.total() == 0 { + let ids: Vec = sel.objects.iter().map(|i| i.0).collect(); + return Ok(json!({ "scope": name, "ids": ids, "groups": 0, "clipGroups": 0, "compoundPaths": 0 })); + } + d.insert_beside(items, true)?; + let mut ids = vec![]; + for id in sel.objects.iter() { + run.replaced(*id, &mut ids); + } + // Locked and hidden objects, and those in locked or hidden groups, are not selected. + { + let editable = d.editable(); + ids.retain(|id| editable(*id)); + } + sel.set(ids.iter().copied()); + sel.prune(&d); + let ids: Vec = sel.objects.iter().map(|i| i.0).collect(); + s.edit("Release All Containers", |doc, selection| { + *doc = d; + *selection = sel; + Ok(()) + })?; + Ok(json!({ "scope": name, "ids": ids, "groups": groups, "clipGroups": clips, "compoundPaths": compounds })) +} diff --git a/crates/engine/src/cmd/addons/cleanup/release/tests.rs b/crates/engine/src/cmd/addons/cleanup/release/tests.rs new file mode 100644 index 0000000000..b04ff4dd46 --- /dev/null +++ b/crates/engine/src/cmd/addons/cleanup/release/tests.rs @@ -0,0 +1,371 @@ +//! Release All Containers: every level taken apart as one undo step, the kinds asked for only, +//! the selection, the document and named objects, clipping layers, what stays whole, and refusals. + +use serde_json::{Value, json}; +use vectorcraft_color::{Color, Paint}; +use vectorcraft_doc::{Appearance, Node, NodeId, NodeKind}; + +use crate::Session; + +const C: &str = "addon.cleanup.releaseAll"; + +fn session() -> Session { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); + s +} + +fn id_of(v: &Value) -> NodeId { + NodeId(v["id"].as_u64().unwrap()) +} + +fn rect(s: &mut Session, x: f64, y: f64) -> NodeId { + id_of(&s.execute("shape.rectangle", &json!({"x": x, "y": y, "width": 20, "height": 20})).unwrap()) +} + +fn node(s: &Session, id: NodeId) -> Option { + s.doc().unwrap().doc.node(id).cloned() +} + +fn change(s: &mut Session, id: NodeId, f: impl FnOnce(&mut Node)) { + s.edit("t", |d, _| { + f(d.node_mut(id).unwrap()); + Ok(()) + }) + .unwrap(); +} + +fn select(s: &mut Session, ids: &[NodeId]) { + s.select(|_, sel| sel.set(ids.iter().copied())).unwrap(); +} + +fn selected(s: &Session) -> Vec { + s.doc().unwrap().selection.objects.to_vec() +} + +fn undo_steps(s: &Session) -> usize { + s.doc().unwrap().history.undo.len() +} + +/// The objects directly in layer `k`. +fn layer(s: &Session, k: usize) -> Vec { + s.doc().unwrap().doc.layers[k].children().unwrap().iter().map(|n| n.id).collect() +} + +fn group(s: &mut Session, ids: &[NodeId]) -> NodeId { + select(s, ids); + id_of(&s.execute("object.group", &json!({})).unwrap()) +} + +fn compound(s: &mut Session, ids: &[NodeId]) -> NodeId { + select(s, ids); + id_of(&s.execute("object.compoundPath.make", &json!({})).unwrap()) +} + +/// A clipping group of `ids`, the last of them the clipping path. +fn clip_group(s: &mut Session, ids: &[NodeId]) -> NodeId { + select(s, ids); + id_of(&s.execute("object.clippingMask.make", &json!({})).unwrap()) +} + +fn counts(r: &Value) -> (u64, u64, u64) { + (r["groups"].as_u64().unwrap(), r["clipGroups"].as_u64().unwrap(), r["compoundPaths"].as_u64().unwrap()) +} + +fn plain(s: &Session, id: NodeId) -> bool { + matches!(node(s, id).unwrap().kind, NodeKind::Path { clipping: false, ref path, .. } if path.subpaths.len() == 1) +} + +fn red() -> Appearance { + Appearance::basic(Paint::solid(Color::rgb(1.0, 0.0, 0.0)), Paint::None, 1.0) +} + +#[test] +fn release_all_takes_apart_every_level_as_one_step() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let b = rect(&mut s, 40.0, 10.0); + let p = rect(&mut s, 70.0, 10.0); + let q = rect(&mut s, 75.0, 15.0); + let holes = compound(&mut s, &[p, q]); + change(&mut s, holes, |n| n.appearance = red().into()); + let inner = group(&mut s, &[b, holes]); + change(&mut s, inner, |n| n.opacity = 0.5); + let clipped = rect(&mut s, 110.0, 10.0); + let clip = rect(&mut s, 105.0, 5.0); + let masked = clip_group(&mut s, &[clipped, clip]); + let outer = group(&mut s, &[a, inner, masked]); + select(&mut s, &[outer]); + let steps = undo_steps(&s); + let r = s.execute(C, &json!({})).unwrap(); + assert_eq!(counts(&r), (2, 1, 1), "{r}"); + assert_eq!(r["scope"], "selection"); + assert_eq!(undo_steps(&s), steps + 1, "one undo step"); + assert_eq!(s.doc().unwrap().history.undo.last().unwrap().label, "Release All Containers"); + assert_eq!(layer(&s, 0), [a, b, p, q, clip, clipped], "only paths are left, in their stacking order"); + assert!([a, b, p, q, clip, clipped].iter().all(|id| plain(&s, *id)), "the clipping path is a plain path"); + assert!(node(&s, outer).is_none() && node(&s, inner).is_none() && node(&s, holes).is_none() && node(&s, masked).is_none()); + assert_eq!((node(&s, b).unwrap().opacity, node(&s, p).unwrap().opacity), (0.5, 0.5), "members keep their groups' opacity"); + assert_eq!(*node(&s, q).unwrap().appearance, red(), "a compound path's paths take its paint"); + assert_eq!(selected(&s), [a, b, p, q, clip, clipped], "what the selected group left is selected"); + assert_eq!(r["ids"], json!([a.0, b.0, p.0, q.0, clip.0, clipped.0])); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(layer(&s, 0), [outer]); +} + +#[test] +fn release_all_counts_each_object_left_once() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let b = rect(&mut s, 40.0, 10.0); + let c = rect(&mut s, 70.0, 10.0); + let p = rect(&mut s, 100.0, 10.0); + let second = node(&s, p).unwrap().path_data().unwrap().subpaths[0].clone(); + change(&mut s, p, |n| { + if let NodeKind::Path { path, .. } = &mut n.kind { + path.subpaths.push(second); + } + }); + let inner = group(&mut s, &[a, b, c, p]); + change(&mut s, inner, |n| n.set_clips(true)); + let middle = group(&mut s, &[inner]); + let outer = group(&mut s, &[middle]); + let held = std::collections::HashSet::new(); + for clips in [true, false] { + let mut d = (*s.doc().unwrap().doc).clone(); + let n = d.node(outer).unwrap().clone(); + let mut run = super::Release { + kinds: super::Kinds { groups: true, clips, compounds: true }, + named: false, + held: &held, + counts: [0; 3], + made: 0, + left: std::collections::HashMap::new(), + }; + let mut out = vec![]; + run.node(&mut d, n, false, &mut out).unwrap(); + if clips { + assert_eq!(out.len(), 5); + assert_eq!(run.made, out.len(), "each path is counted once"); + } else { + assert_eq!(out.len(), 1); + let children = out[0].children().unwrap(); + assert_eq!(children.len(), 5); + assert_eq!(run.made, out.len() + children.len(), "the kept group and its paths are counted once"); + } + } +} + +#[test] +fn release_all_takes_only_the_kinds_asked_for() { + let mut s = session(); + let p = rect(&mut s, 10.0, 10.0); + let q = rect(&mut s, 15.0, 15.0); + let holes = compound(&mut s, &[p, q]); + let clipped = rect(&mut s, 110.0, 10.0); + let e = rect(&mut s, 105.0, 5.0); + let f = rect(&mut s, 108.0, 8.0); + let clip = compound(&mut s, &[e, f]); + let masked = clip_group(&mut s, &[clipped, clip]); + let outer = group(&mut s, &[holes, masked]); + // Without groups, the group stays and what is inside it is still released, but for the + // clipping path of the clipping group that stays. + select(&mut s, &[outer]); + let r = s.execute(C, &json!({"groups": false, "clipGroups": false})).unwrap(); + assert_eq!(counts(&r), (0, 0, 1), "{r}"); + let d = &s.doc().unwrap().doc; + assert_eq!(d.parent_of(p), Some(outer)); + assert!(d.node(holes).is_none() && d.node(clip).is_some() && d.node(masked).is_some()); + assert_eq!(selected(&s), [outer]); + // Without compound paths, the groups go and the compound path stays. + let r = s.execute(C, &json!({"compoundPaths": false})).unwrap(); + assert_eq!(counts(&r), (1, 1, 0), "{r}"); + assert_eq!(layer(&s, 0), [p, q, clip, clipped]); + assert!(matches!(node(&s, clip).unwrap().kind, NodeKind::Compound { .. })); + // Then only compound paths: the clipping path's paths, unpainted as it was. + select(&mut s, &[clip]); + let r = s.execute(C, &json!({"groups": false, "clipGroups": false})).unwrap(); + assert_eq!(counts(&r), (0, 0, 1), "{r}"); + assert_eq!(layer(&s, 0), [p, q, e, f, clipped]); +} + +#[test] +fn release_all_splits_paths_of_several_subpaths() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let b = rect(&mut s, 40.0, 10.0); + let second = node(&s, b).unwrap().path_data().unwrap().subpaths[0].clone(); + change(&mut s, a, |n| { + if let NodeKind::Path { path, .. } = &mut n.kind { + path.subpaths.push(second); + } + }); + s.edit("t", |d, _| Ok(d.remove_many(&[b])?)).unwrap(); + select(&mut s, &[a]); + let r = s.execute(C, &json!({})).unwrap(); + assert_eq!(counts(&r), (0, 0, 1), "{r}"); + let left = layer(&s, 0); + assert_eq!(left.len(), 2); + assert_eq!(left[0], a, "the first subpath keeps the path's id"); + assert!(left.iter().all(|id| plain(&s, *id))); + assert_eq!(selected(&s), left); + assert_eq!(node(&s, left[1]).unwrap().appearance, node(&s, a).unwrap().appearance, "each part keeps the path's paint"); +} + +#[test] +fn release_all_runs_on_the_document_while_nothing_is_selected() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let b = rect(&mut s, 40.0, 10.0); + let c = rect(&mut s, 70.0, 10.0); + let e = rect(&mut s, 100.0, 10.0); + let plain_group = group(&mut s, &[a]); + let locked = group(&mut s, &[b]); + change(&mut s, locked, |n| n.locked = true); + let hidden = group(&mut s, &[c]); + change(&mut s, hidden, |n| n.visible = false); + // A second layer that clips its art by its first path. + let second = id_of(&s.execute("layer.new", &json!({})).unwrap()); + let mask = rect(&mut s, 0.0, 100.0); + let art = rect(&mut s, 10.0, 110.0); + let art_group = group(&mut s, &[art]); + s.edit("t", |d, _| { + let layer = d.node_mut(second).unwrap(); + layer.set_clips(true); + if let Some(NodeKind::Path { clipping, .. }) = layer.children_mut().unwrap().first_mut().map(|c| &mut std::sync::Arc::make_mut(c).kind) { + *clipping = true; + } + Ok(()) + }) + .unwrap(); + select(&mut s, &[]); + assert!(s.execute(C, &json!({"scope": "selection"})).is_err(), "nothing selected"); + let steps = undo_steps(&s); + let r = s.execute(C, &json!({})).unwrap(); + assert_eq!(r["scope"], "document"); + assert_eq!(counts(&r), (2, 1, 0), "{r}"); + assert_eq!(undo_steps(&s), steps + 1); + assert_eq!(layer(&s, 0), [a, locked, hidden, e], "locked and hidden groups stay whole"); + assert!(node(&s, plain_group).is_none() && node(&s, art_group).is_none()); + let d = &s.doc().unwrap().doc; + assert!(!d.node(second).unwrap().clips(), "the layer stays and stops clipping"); + assert!(plain(&s, mask), "its clipping path is a plain path"); + assert_eq!(layer(&s, 1), [mask, art]); + assert!(selected(&s).is_empty(), "nothing was selected"); + // Asked for the document with a selection, the selection keeps what it held. + let g = group(&mut s, &[e]); + select(&mut s, &[g]); + let r = s.execute(C, &json!({"scope": "document"})).unwrap(); + assert_eq!(counts(&r), (1, 0, 0), "{r}"); + assert_eq!(selected(&s), [e]); +} + +#[test] +fn release_all_takes_named_locked_and_hidden_containers() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let b = rect(&mut s, 40.0, 10.0); + let locked = group(&mut s, &[a]); + change(&mut s, locked, |n| n.locked = true); + let hidden = group(&mut s, &[b]); + change(&mut s, hidden, |n| n.visible = false); + select(&mut s, &[locked, hidden]); + let steps = undo_steps(&s); + let r = s.execute(C, &json!({})).unwrap(); + assert_eq!((counts(&r), undo_steps(&s)), ((0, 0, 0), steps), "from the selection, they stay whole"); + let r = s.execute(C, &json!({"ids": [locked.0, hidden.0]})).unwrap(); + assert_eq!(r["scope"], "ids"); + assert_eq!(counts(&r), (2, 0, 0), "{r}"); + assert_eq!(undo_steps(&s), steps + 1); + let (na, nb) = (node(&s, a).unwrap(), node(&s, b).unwrap()); + assert!(na.locked && na.visible && !nb.visible && !nb.locked, "their objects become locked or hidden as they were"); + assert!(selected(&s).is_empty(), "locked and hidden objects are not selected"); + // On a locked artboard, a named group stays whole. + let c = rect(&mut s, 10.0, 200.0); + let on_board = group(&mut s, &[c]); + s.edit("Lock Artboard", |d, _| { + d.artboards[0].locked = true; + Ok(()) + }) + .unwrap(); + let steps = undo_steps(&s); + let r = s.execute(C, &json!({"ids": [on_board.0]})).unwrap(); + assert_eq!((counts(&r), undo_steps(&s)), ((0, 0, 0), steps)); + assert!(node(&s, on_board).is_some()); + // Nor does one inside a named layer. + let layer_id = s.doc().unwrap().doc.layers[0].id; + let r = s.execute(C, &json!({"ids": [layer_id.0]})).unwrap(); + assert_eq!((counts(&r), undo_steps(&s)), ((0, 0, 0), steps)); +} + +#[test] +fn release_all_leaves_masked_groups_whole_and_changes_nothing_without_a_container() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let b = rect(&mut s, 15.0, 15.0); + let held = group(&mut s, &[a, b]); + let m = rect(&mut s, 0.0, 0.0); + s.execute("transparency.makeOpacityMask", &json!({"ids": [held.0, m.0]})).unwrap(); + let masked = layer(&s, 0)[0]; + assert!(node(&s, masked).unwrap().extras().mask.is_some()); + let c = rect(&mut s, 100.0, 10.0); + select(&mut s, &[masked, c]); + let steps = undo_steps(&s); + let r = s.execute(C, &json!({})).unwrap(); + assert_eq!((counts(&r), undo_steps(&s)), ((0, 0, 0), steps), "no step when nothing is released"); + assert_eq!(r["ids"], json!([masked.0, c.0]), "the selection stays"); + assert_eq!(layer(&s, 0), [masked, c]); + // A compound shape is a group that stays whole too. + let e = rect(&mut s, 200.0, 10.0); + let f = rect(&mut s, 210.0, 15.0); + select(&mut s, &[e, f]); + s.execute("object.compoundShape.make", &json!({})).unwrap(); + let shape = selected(&s)[0]; + assert!(node(&s, shape).unwrap().is_compound_shape()); + let steps = undo_steps(&s); + let r = s.execute(C, &json!({})).unwrap(); + assert_eq!((counts(&r), undo_steps(&s)), ((0, 0, 0), steps)); + assert!(node(&s, shape).unwrap().is_compound_shape()); +} + +#[test] +fn release_all_leaves_a_picked_clipping_path_of_a_clipping_group_that_stays() { + let mut s = session(); + let clipped = rect(&mut s, 10.0, 10.0); + let e = rect(&mut s, 5.0, 5.0); + let f = rect(&mut s, 8.0, 8.0); + let clip = compound(&mut s, &[e, f]); + let masked = clip_group(&mut s, &[clipped, clip]); + let steps = undo_steps(&s); + for p in [json!({"ids": [clip.0]}), json!({"ids": [clip.0], "clipGroups": false})] { + let r = s.execute(C, &p).unwrap(); + assert_eq!((counts(&r), undo_steps(&s)), ((0, 0, 0), steps), "{p}"); + } + select(&mut s, &[clip]); + let r = s.execute(C, &json!({})).unwrap(); + assert_eq!((counts(&r), undo_steps(&s)), ((0, 0, 0), steps)); + let d = &s.doc().unwrap().doc; + assert_eq!(d.parent_of(clip), Some(masked)); + assert!(matches!(d.node(clip).unwrap().kind, NodeKind::Compound { .. })); +} + +#[test] +fn release_all_refuses_bad_params() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let g = group(&mut s, &[a]); + select(&mut s, &[g]); + let steps = undo_steps(&s); + for bad in [ + json!({"groups": false, "clipGroups": false, "compoundPaths": false}), + json!({"groups": "yes"}), + json!({"compoundPaths": 1}), + json!({"scope": "layer"}), + json!({"scope": "document", "ids": [g.0]}), + json!({"ids": [999_999]}), + ] { + assert!(s.execute(C, &bad).is_err(), "{bad}"); + } + assert_eq!(undo_steps(&s), steps); + assert!(node(&s, g).is_some()); +} diff --git a/crates/engine/src/cmd/plugin_call/reviewed.rs b/crates/engine/src/cmd/plugin_call/reviewed.rs index 75074c6c3c..704f940639 100644 --- a/crates/engine/src/cmd/plugin_call/reviewed.rs +++ b/crates/engine/src/cmd/plugin_call/reviewed.rs @@ -20,6 +20,7 @@ pub(super) const ALLOWED: &[&str] = &[ "addon.cleanup.fix", "addon.cleanup.joinText", "addon.cleanup.rejoin", + "addon.cleanup.releaseAll", "addon.cleanup.removeBreaks", "addon.cleanup.replaceFonts", "addon.cleanup.resetTextTransform", diff --git a/crates/engine/src/tests/ids_without_selection.rs b/crates/engine/src/tests/ids_without_selection.rs index 9a48655468..a314878bd0 100644 --- a/crates/engine/src/tests/ids_without_selection.rs +++ b/crates/engine/src/tests/ids_without_selection.rs @@ -521,6 +521,7 @@ fn ids_null_takes_the_selection_in_every_command_that_falls_back_to_it() { ("addon.arrange.sort", json!({"by": "area", "apply": "x"}), both), ("addon.cleanup.simplify", json!({}), rect), ("addon.cleanup.deepUngroup", json!({}), rect), + ("addon.cleanup.releaseAll", json!({}), rect), ("addon.cleanup.rejoin", json!({}), rect), ("addon.color.nearestSwatch", json!({}), rect), ("addon.pathtools.cornerSet", json!({"radius": 2}), rect), diff --git a/crates/engine/tests/command_sweep.rs b/crates/engine/tests/command_sweep.rs index c98cd9278e..a336a478aa 100644 --- a/crates/engine/tests/command_sweep.rs +++ b/crates/engine/tests/command_sweep.rs @@ -377,6 +377,7 @@ const NOT_LOCATIONS: &[&str] = &[ "emptyTextPaths", "sortPaths", "alterPaths", + "compoundPaths", "includeLinkedFiles", "linksFolder", ]; diff --git a/crates/ui-egui/src/addons/cleanup.rs b/crates/ui-egui/src/addons/cleanup.rs index 8ce1aa6812..08efc7e9d4 100644 --- a/crates/ui-egui/src/addons/cleanup.rs +++ b/crates/ui-egui/src/addons/cleanup.rs @@ -2,7 +2,10 @@ //! Document Health Check on the selection, or the document while nothing is selected, lists what it //! found, and shows or fixes the issues picked in the list (Fix All: every issue listed), each fix //! one undo step. Below, the add-on's one-click tools open their options as their menu items do, -//! and its text tools, which the panel can hide, act on the selected type. +//! and its text tools, which the panel can hide, act on the selected type. Release All +//! Containers… opens its own dialog ([`release`]). + +pub mod release; use craft::behavior::{DisplayOrder, ItemSource, Selection}; use craft::keymap::Mods; @@ -97,7 +100,7 @@ fn modified(id: &str, mut p: Value, held: Mods) -> Value { pub fn menu() -> Vec { let mut items = vec![cp("Document Health Check", "window.panel", json!({ "panel": ID })), Sep]; items.extend(tools().into_iter().map(|(label, id, p)| cp(label, id, p))); - items.extend([Sep, c("Fix All Issues", "addon.cleanup.fix"), Sep]); + items.extend([c("Release All Containers…", release::COMMAND), Sep, c("Fix All Issues", "addon.cleanup.fix"), Sep]); let by = |b: &str| json!({ "by": b }); let align = |a: &str| json!({ "align": a }); items.extend([ diff --git a/crates/ui-egui/src/addons/cleanup/release.rs b/crates/ui-egui/src/addons/cleanup/release.rs new file mode 100644 index 0000000000..78d7652ea2 --- /dev/null +++ b/crates/ui-egui/src/addons/cleanup/release.rs @@ -0,0 +1,57 @@ +//! Release All Containers in the interface: its dialog (where to release, the selection or the +//! whole document, and which containers: groups, clipping masks and compound paths), which +//! previews on the canvas and runs `addon.cleanup.releaseAll` on OK, one undo step. It opens on the +//! selection, or the document while nothing is selected, with every kind ticked. + +use craft::ui::contract::Bind; +use craft::ui::patterns::form_dialogs::{DialogFields, Param, ParamDialog, ParamKind}; +use serde_json::{Value, json}; + +use crate::VectorcraftApp; +use crate::addons::dialogs::{self, Spec}; +use crate::dialogs::form; + +/// The command. +pub const COMMAND: &str = "addon.cleanup.releaseAll"; +/// Where it releases, as the command's `scope` names it, and the labels. +const SCOPES: [(&str, &str); 2] = [("selection", "Selection"), ("document", "Document")]; +/// The kinds of container, as the command names them, and their labels. +const KINDS: [(&str, &str); 3] = [("groups", "Groups"), ("clipGroups", "Clipping Masks"), ("compoundPaths", "Compound Paths")]; + +/// How the dialog's values reach the command. +pub(crate) static SPEC: Spec = Spec { command: COMMAND, params, found: None }; + +/// The dialog's rows. +fn rows() -> Vec { + let scopes = SCOPES.iter().map(|&(id, label)| (id.to_string(), tl!(label).into())).collect(); + let mut rows = vec![Param::new("scope", tl!("Release In:"), ParamKind::choice(scopes, Some(SCOPES[0].0.into())))]; + rows.extend(KINDS.iter().map(|&(key, label)| Param::new(key, tl!(label), ParamKind::bool(true)))); + rows +} + +/// The command's parameters from the dialog's fields. +pub(crate) fn params(fields: &DialogFields) -> Value { + Value::Object(form::json_of(&rows(), fields)) +} + +/// Opens the dialog on the selection, or the document while nothing is selected, with every kind +/// of container ticked. +pub(crate) fn open(app: &mut VectorcraftApp) -> Result { + let selected = !app.session.active().ok_or("no document open")?.selection.is_empty(); + let scope = if selected { "selection" } else { "document" }; + let opening = json!({ "scope": scope, "groups": true, "clipGroups": true, "compoundPaths": true }); + let fields = form::fields_of(&rows(), opening.as_object().ok_or("no options")?); + dialogs::open(app, &SPEC, fields, move |fields| { + let any = KINDS.iter().any(|(key, _)| fields.bool(key).unwrap_or(true)); + let somewhere = selected || fields.text("scope") != Some("selection"); + let reason = if any { tl!("Nothing is selected.") } else { tl!("Tick at least one kind of container.") }; + ParamDialog::new(COMMAND, tl!("Release All Containers"), rows()) + .previews(true) + .ok_enabled(any && somewhere) + .ok_reason(reason.into()) + .values(Bind::bound(fields)) + }) +} + +#[cfg(test)] +mod tests; diff --git a/crates/ui-egui/src/addons/cleanup/release/tests.rs b/crates/ui-egui/src/addons/cleanup/release/tests.rs new file mode 100644 index 0000000000..2d3acdf274 --- /dev/null +++ b/crates/ui-egui/src/addons/cleanup/release/tests.rs @@ -0,0 +1,99 @@ +use serde_json::json; +use vectorcraft_doc::{NodeId, NodeKind}; +use vectorcraft_engine::Session; + +use crate::VectorcraftApp; +use crate::addons::dialogs::tests as host; +use crate::tests::panel_harness::Panel as Harness; + +/// An app with a window and a selected group holding a rectangle and a compound path of two; the +/// group, the rectangle and the compound path. +fn app() -> (VectorcraftApp, NodeId, NodeId, NodeId) { + let mut app = crate::testing::windowed(VectorcraftApp::new(Session::new(), Default::default())); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + let mut rect = |x| NodeId(app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap()); + let (a, p, q) = (rect(10), rect(50), rect(55)); + app.run("select.set", json!({"ids": [p.0, q.0]})).unwrap(); + let holes = NodeId(app.run("object.compoundPath.make", json!({})).unwrap()["id"].as_u64().unwrap()); + app.run("select.set", json!({"ids": [a.0, holes.0]})).unwrap(); + let group = NodeId(app.run("object.group", json!({})).unwrap()["id"].as_u64().unwrap()); + (app, group, a, holes) +} + +/// The objects directly in the first layer. +fn top(app: &VectorcraftApp) -> Vec { + app.session.doc().unwrap().doc.layers[0].children().unwrap().iter().map(|n| n.id).collect() +} + +fn undo_len(app: &VectorcraftApp) -> usize { + app.session.doc().unwrap().history.undo.len() +} + +#[test] +fn release_all_previews_keyboard_choices_cancels_and_commits_one_step() { + let (app, group, a, holes) = app(); + let mut panel = Harness::new(app, crate::tests::picks::dialogs); + let undo = undo_len(&panel.app()); + host::open_item(&mut panel.app(), "Artwork Cleanup", "Release All Containers…"); + panel.frame(); + let id = host::dialog_id(&panel.app()); + assert_eq!(host::read(&panel.app(), id, |f| f.text("scope").map(str::to_string)), Some("selection".into()), "opens on the selection"); + assert_eq!(top(&panel.app()).len(), 3, "the preview shows the rectangle and the compound path's two paths"); + // Compound Paths unticked with the keyboard: the compound path stays in the preview. + panel.focus("Compound Paths"); + panel.key(egui::Key::Space, egui::Modifiers::NONE); + panel.frame(); + assert_eq!(host::read(&panel.app(), id, |f| f.bool("compoundPaths")), Some(false)); + assert_eq!(top(&panel.app()), [a, holes], "the group is released and the compound path stays"); + panel.click("Cancel"); + panel.frame(); + assert_eq!(top(&panel.app()), [group], "rolled back"); + assert_eq!(undo_len(&panel.app()), undo); + host::open_item(&mut panel.app(), "Artwork Cleanup", "Release All Containers…"); + panel.frame(); + panel.click("OK"); + panel.frame(); + let app = panel.app(); + assert!(!app.any_dialog_open()); + assert_eq!(undo_len(&app), undo + 1, "one undo step"); + let left = top(&app); + assert_eq!(left.len(), 3); + let doc = &app.session.doc().unwrap().doc; + assert!(left.iter().all(|id| matches!(doc.node(*id).unwrap().kind, NodeKind::Path { .. })), "only paths are left"); +} + +#[test] +fn release_all_turns_ok_off_with_nothing_to_release_in() { + let (app, group, ..) = app(); + let mut panel = Harness::new(app, crate::tests::picks::dialogs); + host::open_item(&mut panel.app(), "Artwork Cleanup", "Release All Containers…"); + panel.frame(); + for label in ["Groups", "Clipping Masks", "Compound Paths"] { + panel.focus(label); + panel.key(egui::Key::Space, egui::Modifiers::NONE); + panel.frame(); + } + assert!(!panel.enabled("OK"), "no kind of container ticked"); + assert_eq!(top(&panel.app()), [group], "nothing previewed"); + panel.focus("Groups"); + panel.key(egui::Key::Space, egui::Modifiers::NONE); + panel.frame(); + assert!(panel.enabled("OK")); + panel.click("Cancel"); + panel.frame(); + // With nothing selected, it opens on the document, and Selection turns OK off. + panel.app().run("select.set", json!({"ids": []})).unwrap(); + host::open_item(&mut panel.app(), "Artwork Cleanup", "Release All Containers…"); + panel.frame(); + let id = host::dialog_id(&panel.app()); + assert_eq!(host::read(&panel.app(), id, |f| f.text("scope").map(str::to_string)), Some("document".into())); + assert!(panel.enabled("OK")); + host::set(&panel.app(), id, "scope", json!("selection")); + panel.frame(); + assert!(!panel.enabled("OK"), "nothing is selected"); + host::set(&panel.app(), id, "scope", json!("document")); + panel.frame(); + panel.click("OK"); + panel.frame(); + assert_eq!(top(&panel.app()).len(), 3, "the document's containers are released"); +} diff --git a/crates/ui-egui/src/addons/dialogs.rs b/crates/ui-egui/src/addons/dialogs.rs index e58443e259..07e9ac27b0 100644 --- a/crates/ui-egui/src/addons/dialogs.rs +++ b/crates/ui-egui/src/addons/dialogs.rs @@ -98,8 +98,9 @@ pub(crate) fn open( /// The dialog the menu item of command `id` opens, with no params; `None` for another command. pub(crate) fn open_from_menu(app: &mut VectorcraftApp, id: &str) -> Option> { - use super::{color, pathtools, select, typetools}; + use super::{cleanup, color, pathtools, select, typetools}; let open: fn(&mut VectorcraftApp) -> Result = match id { + cleanup::release::COMMAND => cleanup::release::open, pathtools::set_corners::COMMAND => pathtools::set_corners::open, pathtools::dashes::COMMAND => pathtools::dashes::open, pathtools::bridge::COMMAND => pathtools::bridge::open, diff --git a/docs/mcp.md b/docs/mcp.md index d984e7b92d..bb9c3711c7 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -16581,6 +16581,25 @@ apart the locked and hidden groups the ids name and the groups inside the groups stays a layer), but not groups on a locked artboard; an object of a hidden group becomes hidden, and an object of a locked group becomes locked. Locked and hidden objects stay locked or hidden and are left out of the selection. +`addon.cleanup.releaseAll {scope?, ids?, groups?, clipGroups?, compoundPaths?}` (Object › Plug-ins › Artwork Cleanup › +Release All Containers…) takes apart every container at every level of nesting as one undo step, so that only the +objects they held are left. `scope` is `"selection"` or `"document"`; by default it is the selection, or the document +while nothing is selected. `ids` names the objects, groups and layers to release in instead of `scope`; giving both is +an error. `groups` ungroups groups, `clipGroups` ungroups clipping groups and makes layers stop clipping (their +clipping paths stay as plain paths), and `compoundPaths` turns compound paths, and paths of several subpaths, into one +path per subpath. Each is true by default, and at least one must be true. Layers stay. Objects keep the opacity of +the groups and compound paths they were in, and the paths of a compound path take its paint. Objects with an opacity +mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, +Image Trace objects, blends, envelopes and other live objects stay whole, and the clipping path of a clipping group or +layer that stays is left as it is, also when it is selected or named itself. From the selection or the document, locked and hidden objects +and objects on a locked artboard stay whole. With `ids`, the locked and hidden containers it names, or that are in what +it names, are taken apart too and their objects become locked or hidden as the containers were, but containers on a +locked artboard stay whole. The selection keeps what it held, with each object taken apart replaced by the objects +left in its place, and locked and hidden objects left out. With nothing to release, the document, the selection and the +undo history stay as they are. It replies `{scope ("selection", "document" or "ids"), ids, groups, clipGroups, +compoundPaths}`, the last three counting what it released. The dialog previews on the canvas and turns OK off when no +kind is ticked, or when Selection is chosen with nothing selected. + `addon.cleanup.rejoin {gap?, ids?}` welds the selected open paths whose ends lie within `gap` (0 to 6 pt, 0.1 by default) back into paths. Each end joins one other end: where several are in reach, the one the path turns least to go on into. Pieces may run either way, and a chain whose ends meet closes. Each new path takes the place and paint of its diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index ee49042298..b82d3f3537 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2998,6 +2998,12 @@ alike in being hidden and in being locked, and the objects of a group Deep Ungro state. Tests: `simplify_named_locked_and_hidden_paths`, `deep_ungroup_named_locked_and_hidden_groups` and `rejoin_named_locked_and_hidden_pieces` in `cmd::addons::cleanup::tests`. +Release All Containers… (`addon.cleanup.releaseAll`) takes apart every group, clipping group and compound path in the +selection, the objects named or the whole document, at every level of nesting, as one undo step; layers stay and stop +clipping, and paths of several subpaths split into one path per subpath. Its dialog previews on the canvas and picks +where to release and which kinds (VectorCraft's own tool). Tests: `cmd::addons::cleanup::release::tests` in +`vectorcraft-engine` and `addons::cleanup::release::tests` in `vectorcraft-ui-egui`. + ## Path Precision Tools add-on (2026-10-30) A VectorCraft addition, not a feature of the reference app, so no area score moves. Object › Plug-ins › Path Precision Tools, diff --git a/docs/ui-parity.md b/docs/ui-parity.md index ac20453f86..721097d178 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -592,7 +592,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its six tools (Anchor Eraser Brush, Extend Path, Measure & Inspect, Parametric Shape, Corner Tool, Slide Anchor Along Path), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and the Parametric Shape panel (kind, count, W/H, rotation, the kind's own values and corner radius of the selected parametric shape, or of the tool's next one), and runs Add Points at / Split at Crossings and Convert to Parametric Shape; the Parametric Shape Tool draws ten re-editable kinds from the centre (↑/↓ and ←/→ change their numbers while dragging) and edits a selected one with handles; the Corner Tool cuts editable corners on any path (hover shows the anchor, a click uses its radius and kind, a drag sizes the corner, Shift whole values; a corner's marker selects it and loads its values, drags to resize, to 0 or double-clicked removes it; never past what fits; Alt-marquee cuts every anchor inside) with a Corners section in the Anchor Inspector (radius, kind, selected count, Apply to Selected Anchors); Slide Anchor Along Path drags an anchor along its curve with the segments beside it refitted, Shift snapping where the tangent is a multiple of 45°; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs`, `crates/ui-egui/src/addons/pathtools/` and their tests; not a feature of the reference app, so it is not scored | | Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool (also in the Pen tool's group in both shipped toolbars, after the Quick Pen; the All Tools drawer lists it under Draw; a toolbar edited before keeps its saved layout until Reset Toolbar; no shortcut), and opens the Smart Pen panel (next segment straight or curved; Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles, Close or Join). The tool draws (click: straight or curved segment, a curve after a straight one tangent; drag: smooth anchor, Alt breaks the handle, Shift 45°, Space moves it; Tab switches a segment; rubber band; close, join, continue) and edits without switching tools (click selects a point, drag moves it, Alt-click removes it keeping the shape, Shift+Alt-click deletes it, double-click toggles smooth/corner; handle drags with Shift and Alt; segment drags reshape, Alt-click adds a point); an Alt-drag away from paths selects the points inside a marquee | done | `addon.pen.*`, `crates/tools/src/addons/smart_pen.rs`, `crates/ui-egui/src/addons/pen.rs` and their tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its three tools (Anchor Eraser Brush, Extend Path, Measure & Inspect), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and runs Add Points at / Split at Crossings; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not a feature of the reference app, so it is not scored | -| Artwork Cleanup add-on (VectorCraft addition): Object › Plug-ins › Artwork Cleanup opens its panel, which checks the selection or the document for 16 kinds of issue, lists them with counts, and shows or fixes the picked rows or all of them, each fix one undo step; Simplify Anchors (Keep Shape), Rejoin Path Pieces and Deep Ungroup open their options first | done | `addon.cleanup.*`, `crates/ui-egui/src/addons/cleanup.rs` and its tests; not a feature of the reference app, so it is not scored | +| Artwork Cleanup add-on (VectorCraft addition): Object › Plug-ins › Artwork Cleanup opens its panel, which checks the selection or the document for 16 kinds of issue, lists them with counts, and shows or fixes the picked rows or all of them, each fix one undo step; Simplify Anchors (Keep Shape), Rejoin Path Pieces and Deep Ungroup open their options first; Release All Containers… takes apart every group, clipping mask and compound path in the selection or the document as one undo step | done | `addon.cleanup.*`, `crates/ui-egui/src/addons/cleanup.rs` and its tests; not a feature of the reference app, so it is not scored | | Artwork Cleanup add-on text tools (VectorCraft addition): the panel's Text row, which the panel can hide, and Object › Plug-ins › Artwork Cleanup set the alignment of point type keeping its place, break type into lines (Shift-click: paragraphs), words or glyphs, split type at the cursor, reset a text transform (Alt-click: and its horizontal scale), combine point type, remove line or paragraph breaks and replace missing fonts, each one undo step | done | `addon.cleanup.*` text commands, `crates/ui-egui/src/addons/cleanup.rs` and its tests; a VectorCraft addition, so it is not scored | | Color Effects add-on (VectorCraft addition): live Exposure, Desaturate and Invert Colors in Effect › Color Effects and Object › Plug-ins › Color Effects; its panel picks a colour adjustment and its values and adds it as a live effect or applies it as a filter, into the colours, as one undo step; Select by Color Kind selects the objects that use spot colours, carry colour effects, or are RGB, CMYK or grayscale images; Vector Halftone draws an object as halftone dots live (the dots Object › Vector Halftone makes), which Expand Appearance and the exporters write as paths; Duotone prints each colour's tone with one to four inks (a tint of a spot tone's swatch, or the CMYK mix of several), live or as a filter, its dialog a row per tone and the picked tone's curve; Print Ink Fixes (a CMYK document's ink limit, white overprint removed, black overprint set) opens its options from the submenu and the panel's Inks | done | `addon.color.*`, `crates/ui-egui/src/addons/color.rs` and its tests; not a feature of the reference app, so it is not scored | | Color Effects add-on (VectorCraft addition): Object › Plug-ins › Color Effects › Find Nearest Swatch… picks a Library (Document Swatches, a built-in library, or a library or colour book the user saved or loaded) and Fill and Stroke, lists each colour of the selection with its three closest swatches (chip, name, ΔE 2000), and Apply gives each colour its nearest swatch (global and spot swatches linked; a library's swatches added to the document first), one undo step | done | #4923; `addon.color.nearestSwatch`, `addon.color.applyNearestSwatch`, `crates/engine/src/cmd/addons/color/nearest.rs`, `crates/ui-egui/src/addons/color/nearest.rs` and their tests; not a feature of the reference app, so it is not scored | From 2116be3cf6bf35ef7bb78a35714be69c4b6d0d72 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 29 Nov 2026 16:59:18 -0800 Subject: [PATCH 02/29] Artwork Cleanup: Release All Containers keeps paths with Live Corners whole A path of several subpaths with Live Corners was split into one path per subpath, and each part lost its editable corners. Such a path now stays whole, as other live objects do. A plain path of several subpaths still splits. The Artwork Cleanup entries in docs/target-app-parity.md and docs/ui-parity.md now say that only containers of the kinds asked for are released, and name what stays whole. docs/mcp.md and the command help name paths with Live Corners among the objects that stay whole. --- .../engine/src/cmd/addons/cleanup/release.rs | 12 ++++--- .../src/cmd/addons/cleanup/release/tests.rs | 33 ++++++++++++++++++- docs/mcp.md | 4 +-- docs/target-app-parity.md | 7 ++-- docs/ui-parity.md | 2 +- 5 files changed, 46 insertions(+), 12 deletions(-) diff --git a/crates/engine/src/cmd/addons/cleanup/release.rs b/crates/engine/src/cmd/addons/cleanup/release.rs index 924803cd32..6901e6edf0 100644 --- a/crates/engine/src/cmd/addons/cleanup/release.rs +++ b/crates/engine/src/cmd/addons/cleanup/release.rs @@ -8,7 +8,7 @@ mod tests; use std::collections::{HashMap, HashSet}; use serde_json::{Value, json}; -use vectorcraft_doc::{Document, Node, NodeId, NodeKind}; +use vectorcraft_doc::{Document, LiveShape, Node, NodeId, NodeKind}; use vectorcraft_geom::PathData; use vectorcraft_tools::builder::is_live_paint; @@ -26,7 +26,7 @@ pub(super) fn specs() -> Vec { "Release All Containers…", ["Object", "Plug-ins", "Artwork Cleanup"], None, - "{scope?: \"selection\"|\"document\" (default: the selection, or the document while nothing is selected), ids?: [id…] (the objects, groups and layers to release in, instead of `scope`), groups?: bool (true: groups are ungrouped), clipGroups?: bool (true: clipping groups are ungrouped and layers stop clipping, their clipping paths kept as plain paths), compoundPaths?: bool (true: compound paths, and paths of several subpaths, become one path per subpath); at least one of the three} take apart every container of the kinds asked for, at every level of nesting, as one undo step when one goes; layers stay; each object keeps the opacity of the groups and compound paths it was in, and a compound path's paths take its paint; objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, blends, envelopes and other live objects stay whole, and the clipping path of a clipping group or layer that stays is left as it is, also when it is selected or named itself; from the selection or the document, locked and hidden objects, and objects on a locked artboard, stay whole; named by `ids`, locked and hidden ones are taken apart too (their objects become locked or hidden as they were), but not those on a locked artboard; the selection keeps what it held, each object taken apart replaced by what it left, locked and hidden objects left out → {scope (\"selection\", \"document\" or \"ids\"), ids (the objects selected), groups, clipGroups, compoundPaths (how many of each were released)}", + "{scope?: \"selection\"|\"document\" (default: the selection, or the document while nothing is selected), ids?: [id…] (the objects, groups and layers to release in, instead of `scope`), groups?: bool (true: groups are ungrouped), clipGroups?: bool (true: clipping groups are ungrouped and layers stop clipping, their clipping paths kept as plain paths), compoundPaths?: bool (true: compound paths, and paths of several subpaths, become one path per subpath); at least one of the three} take apart every container of the kinds asked for, at every level of nesting, as one undo step when one goes; layers stay; each object keeps the opacity of the groups and compound paths it was in, and a compound path's paths take its paint; objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, paths with Live Corners, blends, envelopes and other live objects stay whole, and the clipping path of a clipping group or layer that stays is left as it is, also when it is selected or named itself; from the selection or the document, locked and hidden objects, and objects on a locked artboard, stay whole; named by `ids`, locked and hidden ones are taken apart too (their objects become locked or hidden as they were), but not those on a locked artboard; the selection keeps what it held, each object taken apart replaced by what it left, locked and hidden objects left out → {scope (\"selection\", \"document\" or \"ids\"), ids (the objects selected), groups, clipGroups, compoundPaths (how many of each were released)}", has_doc, release_all )] @@ -64,11 +64,13 @@ struct Release<'a> { /// Whether `n` stays whole whatever is asked: a live object kept as a group or compound path /// (a compound shape, Live Paint group, graph, dimension, flare, Objects on Path, generated art, -/// Shaper Group, Image Trace object, a clipping path's painted pieces) or one with an opacity mask, -/// whose contents would lose what it does to them. +/// Shaper Group, Image Trace object, a clipping path's painted pieces), a path with Live Corners, +/// whose parts would lose their editable corners, or one with an opacity mask, whose contents +/// would lose what it does to them. fn live(n: &Node) -> bool { let x = n.extras(); - x.mask.is_some() + matches!(&n.kind, NodeKind::Path { live: Some(l), .. } if matches!(**l, LiveShape::Path { .. })) + || x.mask.is_some() || x.shaper.is_some() || x.trace.is_some() || x.graph.is_some() diff --git a/crates/engine/src/cmd/addons/cleanup/release/tests.rs b/crates/engine/src/cmd/addons/cleanup/release/tests.rs index b04ff4dd46..bb92cf8a8b 100644 --- a/crates/engine/src/cmd/addons/cleanup/release/tests.rs +++ b/crates/engine/src/cmd/addons/cleanup/release/tests.rs @@ -3,7 +3,7 @@ use serde_json::{Value, json}; use vectorcraft_color::{Color, Paint}; -use vectorcraft_doc::{Appearance, Node, NodeId, NodeKind}; +use vectorcraft_doc::{Appearance, LiveShape, Node, NodeId, NodeKind}; use crate::Session; @@ -212,6 +212,37 @@ fn release_all_splits_paths_of_several_subpaths() { assert_eq!(node(&s, left[1]).unwrap().appearance, node(&s, a).unwrap().appearance, "each part keeps the path's paint"); } +#[test] +fn release_all_keeps_a_path_of_several_subpaths_with_live_corners_whole() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let b = rect(&mut s, 40.0, 10.0); + let plain_path = rect(&mut s, 80.0, 10.0); + let second = node(&s, b).unwrap().path_data().unwrap().subpaths[0].clone(); + for id in [a, plain_path] { + let second = second.clone(); + change(&mut s, id, |n| { + if let NodeKind::Path { path, live, .. } = &mut n.kind { + path.subpaths.push(second); + *live = None; + } + }); + } + change(&mut s, a, |n| { + if let NodeKind::Path { path, live, .. } = &mut n.kind { + let base = path.clone(); + *live = Some(Box::new(LiveShape::Path { base, radii: vec![4.0], kinds: vec![], radii_relative: false })); + } + }); + s.edit("t", |d, _| Ok(d.remove_many(&[b])?)).unwrap(); + select(&mut s, &[a, plain_path]); + let r = s.execute(C, &json!({})).unwrap(); + assert_eq!(counts(&r), (0, 0, 1), "only the plain path is split: {r}"); + let kept = node(&s, a).unwrap(); + assert!(matches!(kept.kind, NodeKind::Path { live: Some(_), ref path, .. } if path.subpaths.len() == 2), "Live Corners stay"); + assert_eq!(layer(&s, 0).len(), 3); +} + #[test] fn release_all_runs_on_the_document_while_nothing_is_selected() { let mut s = session(); diff --git a/docs/mcp.md b/docs/mcp.md index bb9c3711c7..96633957ac 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -16590,8 +16590,8 @@ clipping paths stay as plain paths), and `compoundPaths` turns compound paths, a path per subpath. Each is true by default, and at least one must be true. Layers stay. Objects keep the opacity of the groups and compound paths they were in, and the paths of a compound path take its paint. Objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, -Image Trace objects, blends, envelopes and other live objects stay whole, and the clipping path of a clipping group or -layer that stays is left as it is, also when it is selected or named itself. From the selection or the document, locked and hidden objects +Image Trace objects, paths with Live Corners, blends, envelopes and other live objects stay whole, and the clipping +path of a clipping group or layer that stays is left as it is, also when it is selected or named itself. From the selection or the document, locked and hidden objects and objects on a locked artboard stay whole. With `ids`, the locked and hidden containers it names, or that are in what it names, are taken apart too and their objects become locked or hidden as the containers were, but containers on a locked artboard stay whole. The selection keeps what it held, with each object taken apart replaced by the objects diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b82d3f3537..817d8290d6 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2998,9 +2998,10 @@ alike in being hidden and in being locked, and the objects of a group Deep Ungro state. Tests: `simplify_named_locked_and_hidden_paths`, `deep_ungroup_named_locked_and_hidden_groups` and `rejoin_named_locked_and_hidden_pieces` in `cmd::addons::cleanup::tests`. -Release All Containers… (`addon.cleanup.releaseAll`) takes apart every group, clipping group and compound path in the -selection, the objects named or the whole document, at every level of nesting, as one undo step; layers stay and stop -clipping, and paths of several subpaths split into one path per subpath. Its dialog previews on the canvas and picks +Release All Containers… (`addon.cleanup.releaseAll`) takes apart the groups, clipping groups and compound paths of the +kinds asked for in the selection, the objects named or the whole document, at every level of nesting, as one undo step; +layers stay, and stop clipping when clipping groups are released; paths of several subpaths split into one path per +subpath. Objects with an opacity mask, live objects and paths with Live Corners stay whole. Its dialog previews on the canvas and picks where to release and which kinds (VectorCraft's own tool). Tests: `cmd::addons::cleanup::release::tests` in `vectorcraft-engine` and `addons::cleanup::release::tests` in `vectorcraft-ui-egui`. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 721097d178..84498acbe3 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -592,7 +592,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its six tools (Anchor Eraser Brush, Extend Path, Measure & Inspect, Parametric Shape, Corner Tool, Slide Anchor Along Path), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and the Parametric Shape panel (kind, count, W/H, rotation, the kind's own values and corner radius of the selected parametric shape, or of the tool's next one), and runs Add Points at / Split at Crossings and Convert to Parametric Shape; the Parametric Shape Tool draws ten re-editable kinds from the centre (↑/↓ and ←/→ change their numbers while dragging) and edits a selected one with handles; the Corner Tool cuts editable corners on any path (hover shows the anchor, a click uses its radius and kind, a drag sizes the corner, Shift whole values; a corner's marker selects it and loads its values, drags to resize, to 0 or double-clicked removes it; never past what fits; Alt-marquee cuts every anchor inside) with a Corners section in the Anchor Inspector (radius, kind, selected count, Apply to Selected Anchors); Slide Anchor Along Path drags an anchor along its curve with the segments beside it refitted, Shift snapping where the tangent is a multiple of 45°; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs`, `crates/ui-egui/src/addons/pathtools/` and their tests; not a feature of the reference app, so it is not scored | | Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool (also in the Pen tool's group in both shipped toolbars, after the Quick Pen; the All Tools drawer lists it under Draw; a toolbar edited before keeps its saved layout until Reset Toolbar; no shortcut), and opens the Smart Pen panel (next segment straight or curved; Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles, Close or Join). The tool draws (click: straight or curved segment, a curve after a straight one tangent; drag: smooth anchor, Alt breaks the handle, Shift 45°, Space moves it; Tab switches a segment; rubber band; close, join, continue) and edits without switching tools (click selects a point, drag moves it, Alt-click removes it keeping the shape, Shift+Alt-click deletes it, double-click toggles smooth/corner; handle drags with Shift and Alt; segment drags reshape, Alt-click adds a point); an Alt-drag away from paths selects the points inside a marquee | done | `addon.pen.*`, `crates/tools/src/addons/smart_pen.rs`, `crates/ui-egui/src/addons/pen.rs` and their tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its three tools (Anchor Eraser Brush, Extend Path, Measure & Inspect), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and runs Add Points at / Split at Crossings; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not a feature of the reference app, so it is not scored | -| Artwork Cleanup add-on (VectorCraft addition): Object › Plug-ins › Artwork Cleanup opens its panel, which checks the selection or the document for 16 kinds of issue, lists them with counts, and shows or fixes the picked rows or all of them, each fix one undo step; Simplify Anchors (Keep Shape), Rejoin Path Pieces and Deep Ungroup open their options first; Release All Containers… takes apart every group, clipping mask and compound path in the selection or the document as one undo step | done | `addon.cleanup.*`, `crates/ui-egui/src/addons/cleanup.rs` and its tests; not a feature of the reference app, so it is not scored | +| Artwork Cleanup add-on (VectorCraft addition): Object › Plug-ins › Artwork Cleanup opens its panel, which checks the selection or the document for 16 kinds of issue, lists them with counts, and shows or fixes the picked rows or all of them, each fix one undo step; Simplify Anchors (Keep Shape), Rejoin Path Pieces and Deep Ungroup open their options first; Release All Containers… takes apart the groups, clipping masks and compound paths of the kinds asked for in the selection or the document as one undo step, leaving objects with an opacity mask, live objects and paths with Live Corners whole | done | `addon.cleanup.*`, `crates/ui-egui/src/addons/cleanup.rs` and its tests; not a feature of the reference app, so it is not scored | | Artwork Cleanup add-on text tools (VectorCraft addition): the panel's Text row, which the panel can hide, and Object › Plug-ins › Artwork Cleanup set the alignment of point type keeping its place, break type into lines (Shift-click: paragraphs), words or glyphs, split type at the cursor, reset a text transform (Alt-click: and its horizontal scale), combine point type, remove line or paragraph breaks and replace missing fonts, each one undo step | done | `addon.cleanup.*` text commands, `crates/ui-egui/src/addons/cleanup.rs` and its tests; a VectorCraft addition, so it is not scored | | Color Effects add-on (VectorCraft addition): live Exposure, Desaturate and Invert Colors in Effect › Color Effects and Object › Plug-ins › Color Effects; its panel picks a colour adjustment and its values and adds it as a live effect or applies it as a filter, into the colours, as one undo step; Select by Color Kind selects the objects that use spot colours, carry colour effects, or are RGB, CMYK or grayscale images; Vector Halftone draws an object as halftone dots live (the dots Object › Vector Halftone makes), which Expand Appearance and the exporters write as paths; Duotone prints each colour's tone with one to four inks (a tint of a spot tone's swatch, or the CMYK mix of several), live or as a filter, its dialog a row per tone and the picked tone's curve; Print Ink Fixes (a CMYK document's ink limit, white overprint removed, black overprint set) opens its options from the submenu and the panel's Inks | done | `addon.color.*`, `crates/ui-egui/src/addons/color.rs` and its tests; not a feature of the reference app, so it is not scored | | Color Effects add-on (VectorCraft addition): Object › Plug-ins › Color Effects › Find Nearest Swatch… picks a Library (Document Swatches, a built-in library, or a library or colour book the user saved or loaded) and Fill and Stroke, lists each colour of the selection with its three closest swatches (chip, name, ΔE 2000), and Apply gives each colour its nearest swatch (global and spot swatches linked; a library's swatches added to the document first), one undo step | done | #4923; `addon.color.nearestSwatch`, `addon.color.applyNearestSwatch`, `crates/engine/src/cmd/addons/color/nearest.rs`, `crates/ui-egui/src/addons/color/nearest.rs` and their tests; not a feature of the reference app, so it is not scored | From eb780d9a06663884bc48f32da6156c87bdbcaa26 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 29 Nov 2026 18:00:25 -0800 Subject: [PATCH 03/29] Artwork Cleanup: Release All Containers keeps live objects, locked-artboard masks and selection details - A container named inside a live object, such as a Live Paint group's sources, is left whole. - A layer keeps its clipping mask when the mask clips artwork on a locked artboard. - Unchanged siblings are reused instead of copied when a layer is rebuilt. - Anchor, segment and guide selections on untouched artwork are kept. --- .../engine/src/cmd/addons/cleanup/release.rs | 82 +++++++------ .../src/cmd/addons/cleanup/release/tests.rs | 114 +++++++++++++++++- docs/mcp.md | 7 +- 3 files changed, 165 insertions(+), 38 deletions(-) diff --git a/crates/engine/src/cmd/addons/cleanup/release.rs b/crates/engine/src/cmd/addons/cleanup/release.rs index 6901e6edf0..b09994fc4a 100644 --- a/crates/engine/src/cmd/addons/cleanup/release.rs +++ b/crates/engine/src/cmd/addons/cleanup/release.rs @@ -6,6 +6,7 @@ mod tests; use std::collections::{HashMap, HashSet}; +use std::sync::Arc; use serde_json::{Value, json}; use vectorcraft_doc::{Document, LiveShape, Node, NodeId, NodeKind}; @@ -26,7 +27,7 @@ pub(super) fn specs() -> Vec { "Release All Containers…", ["Object", "Plug-ins", "Artwork Cleanup"], None, - "{scope?: \"selection\"|\"document\" (default: the selection, or the document while nothing is selected), ids?: [id…] (the objects, groups and layers to release in, instead of `scope`), groups?: bool (true: groups are ungrouped), clipGroups?: bool (true: clipping groups are ungrouped and layers stop clipping, their clipping paths kept as plain paths), compoundPaths?: bool (true: compound paths, and paths of several subpaths, become one path per subpath); at least one of the three} take apart every container of the kinds asked for, at every level of nesting, as one undo step when one goes; layers stay; each object keeps the opacity of the groups and compound paths it was in, and a compound path's paths take its paint; objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, paths with Live Corners, blends, envelopes and other live objects stay whole, and the clipping path of a clipping group or layer that stays is left as it is, also when it is selected or named itself; from the selection or the document, locked and hidden objects, and objects on a locked artboard, stay whole; named by `ids`, locked and hidden ones are taken apart too (their objects become locked or hidden as they were), but not those on a locked artboard; the selection keeps what it held, each object taken apart replaced by what it left, locked and hidden objects left out → {scope (\"selection\", \"document\" or \"ids\"), ids (the objects selected), groups, clipGroups, compoundPaths (how many of each were released)}", + "{scope?: \"selection\"|\"document\" (default: the selection, or the document while nothing is selected), ids?: [id…] (the objects, groups and layers to release in, instead of `scope`), groups?: bool (true: groups are ungrouped), clipGroups?: bool (true: clipping groups are ungrouped and layers stop clipping unless they clip artwork on a locked artboard, their released clipping paths kept as plain paths), compoundPaths?: bool (true: compound paths, and paths of several subpaths, become one path per subpath); at least one of the three} take apart every container of the kinds asked for, at every level of nesting, as one undo step when one goes; layers stay; each object keeps the opacity of the groups and compound paths it was in, and a compound path's paths take its paint; objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, paths with Live Corners, blends, envelopes and other live objects stay whole, and the clipping path of a clipping group or layer that stays is left as it is, also when it is selected or named itself; from the selection or the document, locked and hidden objects, and objects on a locked artboard, stay whole; named by `ids`, locked and hidden ones are taken apart too (their objects become locked or hidden as they were), but not those on a locked artboard; the selection keeps what it held, each object taken apart replaced by what it left, locked and hidden objects left out → {scope (\"selection\", \"document\" or \"ids\"), ids (the objects selected), groups, clipGroups, compoundPaths (how many of each were released)}", has_doc, release_all )] @@ -52,7 +53,7 @@ struct Release<'a> { kinds: Kinds, /// Locked and hidden objects are taken apart too. named: bool, - /// The containers on a locked artboard, which stay whole. + /// The artwork on a locked artboard, which stays whole. held: &'a HashSet, /// Groups, clipping groups and layers, and compound paths released. counts: [usize; 3], @@ -84,17 +85,19 @@ fn live(n: &Node) -> bool { || is_live_paint(n) } -/// The containers under `roots` that a run could take apart, into `out`. -fn candidates(n: &Node, out: &mut Vec) { - match &n.kind { - NodeKind::Layer { children, .. } | NodeKind::Group { children, .. } | NodeKind::Compound { children, .. } => { - if !n.is_layer() { - out.push(n.id); - } - children.iter().for_each(|c| candidates(c, out)); - } - NodeKind::Path { path, .. } if path.subpaths.len() > 1 => out.push(n.id), - _ => {} +/// The artwork under `n` is added to `out`. +fn candidates(n: &Node, clips: bool, out: &mut Vec) { + let candidate = match &n.kind { + NodeKind::Layer { .. } => false, + NodeKind::Group { .. } | NodeKind::Compound { .. } => true, + NodeKind::Path { path, .. } => clips || path.subpaths.len() > 1, + _ => clips, + }; + if candidate { + out.push(n.id); + } + if let Some(children) = n.children() { + children.iter().for_each(|c| candidates(c, clips, out)); } } @@ -109,7 +112,7 @@ impl Release<'_> { } /// `n` with the containers in it released, into `out`; `member` counts what a container left. - fn node(&mut self, d: &mut Document, n: Node, member: bool, out: &mut Vec) -> Result<()> { + fn node(&mut self, d: &mut Document, n: Arc, member: bool, out: &mut Vec>) -> Result<()> { if self.keeps(&n) { if member { self.made(1)?; @@ -129,7 +132,7 @@ impl Release<'_> { } NodeKind::Path { path, clipping: false, guide: false, .. } if self.kinds.compounds && path.subpaths.len() > 1 => { self.counts[2] += 1; - self.split(d, n, out) + self.split(d, (*n).clone(), out) } NodeKind::Group { .. } | NodeKind::Layer { .. } => self.keep(d, n, member, out), _ => { @@ -145,7 +148,7 @@ impl Release<'_> { /// Group or compound path `n` replaced by its members, released in turn. Members take on the /// container's opacity, are hidden when it was hidden and locked when it was locked; a /// compound path's take its paint; a clipping group's clipping path becomes a plain path. - fn take_apart(&mut self, d: &mut Document, n: Node, clip: bool, compound: bool, out: &mut Vec) -> Result<()> { + fn take_apart(&mut self, d: &mut Document, n: Arc, clip: bool, compound: bool, out: &mut Vec>) -> Result<()> { let Some(children) = n.children() else { return Ok(()) }; let mut parts = vec![]; for (k, c) in children.iter().enumerate() { @@ -165,7 +168,7 @@ impl Release<'_> { c.opacity *= n.opacity; c.visible &= n.visible; c.locked |= n.locked; - self.node(d, c, true, &mut parts)?; + self.node(d, Arc::new(c), true, &mut parts)?; } self.left.insert(n.id, parts.iter().map(|p| p.id).collect()); out.extend(parts); @@ -174,7 +177,7 @@ impl Release<'_> { /// Path `n` of several subpaths as one path per subpath with its paint, in the same stacking /// order; the first keeps its id. - fn split(&mut self, d: &mut Document, n: Node, out: &mut Vec) -> Result<()> { + fn split(&mut self, d: &mut Document, n: Node, out: &mut Vec>) -> Result<()> { let Some(path) = n.path_data() else { return Ok(()) }; if self.made.saturating_add(path.subpaths.len()) > MAX_OBJECTS { return Err(EngineError::Other("Release All Containers: too many objects to release at once".into())); @@ -189,7 +192,7 @@ impl Release<'_> { if let NodeKind::Path { path, live, .. } = &mut c.kind { (*path, *live) = (PathData::single(sp.clone()), None); } - parts.push(c); + parts.push(Arc::new(c)); } self.made(parts.len())?; self.left.insert(n.id, parts.iter().map(|p| p.id).collect()); @@ -200,46 +203,51 @@ impl Release<'_> { /// Group or layer `n` kept, with the containers in it released. A layer stops clipping when /// clipping groups are released; the clipping path of a group or layer that still clips is /// left as it is. Unchanged, `n` itself goes to `out`. - fn keep(&mut self, d: &mut Document, mut n: Node, member: bool, out: &mut Vec) -> Result<()> { + fn keep(&mut self, d: &mut Document, mut n: Arc, member: bool, out: &mut Vec>) -> Result<()> { if member { self.made(1)?; } let before = self.total(); let mut clips = n.clips(); - if clips && n.is_layer() && self.kinds.clips { + if clips && n.is_layer() && self.kinds.clips && !n.children().is_some_and(|children| children.iter().skip(1).any(|c| self.holds_art(c))) { self.counts[1] += 1; + let n = Arc::make_mut(&mut n); n.set_clips(false); clips = false; if let Some(first) = n.children_mut().and_then(|c| c.first_mut()) - && let NodeKind::Path { clipping, .. } = &mut std::sync::Arc::make_mut(first).kind + && let NodeKind::Path { clipping, .. } = &mut Arc::make_mut(first).kind { *clipping = false; } } - let Some(children) = n.children().cloned() else { + let Some(children) = n.children() else { out.push(n); return Ok(()); }; let mut kept = Vec::with_capacity(children.len()); - for (k, c) in children.into_iter().enumerate() { + for (k, c) in children.iter().enumerate() { if clips && k == 0 { if member { self.made(1)?; } - kept.push((*c).clone()); + kept.push(Arc::clone(c)); } else { - self.node(d, (*c).clone(), member, &mut kept)?; + self.node(d, Arc::clone(c), member, &mut kept)?; } } if self.total() != before - && let Some(ch) = n.children_mut() + && let Some(ch) = Arc::make_mut(&mut n).children_mut() { - *ch = kept.into_iter().map(std::sync::Arc::new).collect(); + *ch = kept; } out.push(n); Ok(()) } + fn holds_art(&self, n: &Node) -> bool { + self.held.contains(&n.id) || n.children().is_some_and(|children| children.iter().any(|c| self.holds_art(c))) + } + /// Counts the objects made, refusing a run that makes too many. fn made(&mut self, count: usize) -> Result<()> { self.made += count; @@ -291,11 +299,11 @@ fn release_all(s: &mut Session, p: &Value) -> Result { }; let st = s.doc()?; let (mut d, mut sel) = ((*st.doc).clone(), st.selection.clone()); - // The containers on a locked artboard, found while nothing is changed yet. + // The artwork on a locked artboard, found while nothing is changed yet. let held: HashSet = if d.artboards.iter().any(|a| a.locked) { let mut found = vec![]; for n in roots.iter().filter_map(|id| d.node(*id)) { - candidates(n, &mut found); + candidates(n, kinds.clips, &mut found); } let locks = d.locked_artboards(); found.into_iter().filter(|id| locks.holds_id(*id)).collect() @@ -307,15 +315,17 @@ fn release_all(s: &mut Session, p: &Value) -> Result { for id in roots { // A clipping path picked inside the clipping group or layer it clips stays as it is, as it // does when that group or layer is released in. - if clips_its_parent(&d, id) { + let protected = + d.ancestry(id).is_some_and(|chain| chain.iter().take(chain.len().saturating_sub(1)).filter_map(|id| d.node(*id)).any(|n| run.keeps(n))); + if clips_its_parent(&d, id) || protected { continue; } - let Some(n) = d.node(id).cloned() else { continue }; + let Some(n) = d.node_arc(id).cloned() else { continue }; let before = run.total(); let mut out = vec![]; run.node(&mut d, n, false, &mut out)?; if run.total() != before { - items.push((id, out)); + items.push((id, out.into_iter().map(Arc::unwrap_or_clone).collect())); } } let [groups, clips, compounds] = run.counts; @@ -334,7 +344,11 @@ fn release_all(s: &mut Session, p: &Value) -> Result { let editable = d.editable(); ids.retain(|id| editable(*id)); } - sel.set(ids.iter().copied()); + let kept: HashSet = ids.iter().copied().collect(); + let removed: Vec = sel.objects.iter().copied().filter(|id| run.left.contains_key(id) || !kept.contains(id)).collect(); + sel.remove_all(removed); + let mut seen = HashSet::new(); + sel.objects = ids.into_iter().filter(|id| seen.insert(*id)).collect(); sel.prune(&d); let ids: Vec = sel.objects.iter().map(|i| i.0).collect(); s.edit("Release All Containers", |doc, selection| { diff --git a/crates/engine/src/cmd/addons/cleanup/release/tests.rs b/crates/engine/src/cmd/addons/cleanup/release/tests.rs index bb92cf8a8b..2b1b4a23a2 100644 --- a/crates/engine/src/cmd/addons/cleanup/release/tests.rs +++ b/crates/engine/src/cmd/addons/cleanup/release/tests.rs @@ -133,7 +133,7 @@ fn release_all_counts_each_object_left_once() { let held = std::collections::HashSet::new(); for clips in [true, false] { let mut d = (*s.doc().unwrap().doc).clone(); - let n = d.node(outer).unwrap().clone(); + let n = d.node_arc(outer).unwrap().clone(); let mut run = super::Release { kinds: super::Kinds { groups: true, clips, compounds: true }, named: false, @@ -380,6 +380,118 @@ fn release_all_leaves_a_picked_clipping_path_of_a_clipping_group_that_stays() { assert!(matches!(d.node(clip).unwrap().kind, NodeKind::Compound { .. })); } +#[test] +fn release_all_keeps_a_directly_named_descendant_of_a_live_object() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let inner = group(&mut s, &[a]); + let sources = group(&mut s, &[inner]); + change(&mut s, sources, |n| n.name = Some("Live Paint Sources".into())); + let live = group(&mut s, &[sources]); + change(&mut s, live, |n| n.name = Some("Live Paint Group".into())); + change(&mut s, sources, |n| n.visible = false); + assert!(vectorcraft_tools::builder::is_live_paint(&node(&s, live).unwrap())); + let steps = undo_steps(&s); + for id in [sources, inner] { + let r = s.execute(C, &json!({"ids": [id.0]})).unwrap(); + assert_eq!((counts(&r), undo_steps(&s)), ((0, 0, 0), steps)); + assert!(vectorcraft_tools::builder::is_live_paint(&node(&s, live).unwrap())); + assert_eq!(s.doc().unwrap().doc.parent_of(inner), Some(sources)); + assert_eq!(s.doc().unwrap().doc.parent_of(a), Some(inner)); + } +} + +#[test] +fn release_all_keeps_a_layer_mask_over_locked_artboard_artwork() { + for named in [false, true] { + let mut s = session(); + let mask = rect(&mut s, 0.0, 0.0); + let art = rect(&mut s, 10.0, 10.0); + let outside = rect(&mut s, 500.0, 10.0); + let g = group(&mut s, &[outside]); + let layer_id = s.doc().unwrap().doc.layers[0].id; + change(&mut s, layer_id, |n| n.set_clips(true)); + change(&mut s, mask, |n| { + if let NodeKind::Path { clipping, .. } = &mut n.kind { + *clipping = true; + } + }); + select(&mut s, &[]); + s.edit("Lock Artboard", |d, _| { + d.artboards[0].locked = true; + Ok(()) + }) + .unwrap(); + let p = if named { json!({"ids": [layer_id.0]}) } else { json!({"scope": "document"}) }; + let r = s.execute(C, &p).unwrap(); + assert_eq!(counts(&r), (1, 0, 0), "{p}: {r}"); + assert!(node(&s, layer_id).unwrap().clips()); + assert!(matches!(node(&s, mask).unwrap().kind, NodeKind::Path { clipping: true, .. })); + assert_eq!(layer(&s, 0), [mask, art, outside]); + assert!(node(&s, g).is_none()); + } +} + +#[test] +fn release_all_reuses_unchanged_siblings_when_rebuilding_a_layer() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let b = rect(&mut s, 40.0, 10.0); + let g = group(&mut s, &[b]); + let original = s.doc().unwrap().doc.node_arc(a).unwrap().clone(); + let r = s.execute(C, &json!({"scope": "document"})).unwrap(); + assert_eq!(counts(&r), (1, 0, 0)); + assert!(node(&s, g).is_none()); + assert!(std::sync::Arc::ptr_eq(&original, s.doc().unwrap().doc.node_arc(a).unwrap())); +} + +#[test] +fn release_all_keeps_selection_details_for_untouched_artwork() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let b = rect(&mut s, 40.0, 10.0); + let c = rect(&mut s, 70.0, 10.0); + let g = group(&mut s, &[c]); + s.execute("guide.add", &json!({"vertical": true, "pos": 150})).unwrap(); + let guide = s.doc().unwrap().doc.ruler_guides()[0].id.unwrap(); + s.select(|_, sel| { + sel.set([a, b, g]); + sel.anchors.insert(a, [(0, 0), (0, 2)].into_iter().collect()); + sel.anchors.insert(b, [(0, 0), (0, 1)].into_iter().collect()); + sel.segments.insert(b, [(0, 0)].into_iter().collect()); + sel.guides.push(guide); + sel.key_anchor = Some((a, (0, 0))); + }) + .unwrap(); + let before = s.doc().unwrap().selection.clone(); + let r = s.execute(C, &json!({"scope": "document"})).unwrap(); + assert_eq!(counts(&r), (1, 0, 0)); + let after = &s.doc().unwrap().selection; + assert_eq!(after.objects, [a, b, c]); + assert_eq!(after.anchors, before.anchors); + assert_eq!(after.segments, before.segments); + assert_eq!(after.guides, before.guides); + assert_eq!(after.key_anchor, before.key_anchor); + assert!(!after.objects.contains(&g)); + change(&mut s, c, |n| { + if let NodeKind::Path { path, live, .. } = &mut n.kind { + path.subpaths.push(path.subpaths[0].clone()); + *live = None; + } + }); + s.select(|_, sel| { + sel.anchors.insert(c, [(0, 0), (0, 1)].into_iter().collect()); + sel.segments.insert(c, [(0, 0)].into_iter().collect()); + }) + .unwrap(); + let r = s.execute(C, &json!({"ids": [c.0]})).unwrap(); + assert_eq!(counts(&r), (0, 0, 1)); + let after = &s.doc().unwrap().selection; + assert_eq!(after.anchors, before.anchors); + assert_eq!(after.segments, before.segments); + assert_eq!(after.guides, before.guides); +} + #[test] fn release_all_refuses_bad_params() { let mut s = session(); diff --git a/docs/mcp.md b/docs/mcp.md index 96633957ac..abe55ce765 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -16585,9 +16585,10 @@ locked group becomes locked. Locked and hidden objects stay locked or hidden and Release All Containers…) takes apart every container at every level of nesting as one undo step, so that only the objects they held are left. `scope` is `"selection"` or `"document"`; by default it is the selection, or the document while nothing is selected. `ids` names the objects, groups and layers to release in instead of `scope`; giving both is -an error. `groups` ungroups groups, `clipGroups` ungroups clipping groups and makes layers stop clipping (their -clipping paths stay as plain paths), and `compoundPaths` turns compound paths, and paths of several subpaths, into one -path per subpath. Each is true by default, and at least one must be true. Layers stay. Objects keep the opacity of +an error. `groups` ungroups groups, `clipGroups` ungroups clipping groups and makes layers stop clipping unless they +clip artwork on a locked artboard (released clipping paths stay as plain paths), and `compoundPaths` turns compound +paths, and paths of several subpaths, into one path per subpath. Each is true by default, and at least one must be true. +Layers stay. Objects keep the opacity of the groups and compound paths they were in, and the paths of a compound path take its paint. Objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, paths with Live Corners, blends, envelopes and other live objects stay whole, and the clipping From 52b52c55242a2d725a5722e7d061378067fdb741 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 29 Nov 2026 21:31:15 -0800 Subject: [PATCH 04/29] Artwork Cleanup: Release All Containers keeps blend keys and compound clipping masks whole and rejects null and duplicate options - A directly named descendant of a blend, envelope, repeat or intertwine stays whole. - A target anywhere inside the clipping mask of a clipping group or layer that stays is left as it is. - Explicit null options and duplicate ids are parameter errors and leave the artwork unchanged. --- .../engine/src/cmd/addons/cleanup/release.rs | 43 ++++++-- .../src/cmd/addons/cleanup/release/tests.rs | 98 +++++++++++++++++++ docs/mcp.md | 8 +- 3 files changed, 137 insertions(+), 12 deletions(-) diff --git a/crates/engine/src/cmd/addons/cleanup/release.rs b/crates/engine/src/cmd/addons/cleanup/release.rs index b09994fc4a..9a4caccfbc 100644 --- a/crates/engine/src/cmd/addons/cleanup/release.rs +++ b/crates/engine/src/cmd/addons/cleanup/release.rs @@ -27,7 +27,7 @@ pub(super) fn specs() -> Vec { "Release All Containers…", ["Object", "Plug-ins", "Artwork Cleanup"], None, - "{scope?: \"selection\"|\"document\" (default: the selection, or the document while nothing is selected), ids?: [id…] (the objects, groups and layers to release in, instead of `scope`), groups?: bool (true: groups are ungrouped), clipGroups?: bool (true: clipping groups are ungrouped and layers stop clipping unless they clip artwork on a locked artboard, their released clipping paths kept as plain paths), compoundPaths?: bool (true: compound paths, and paths of several subpaths, become one path per subpath); at least one of the three} take apart every container of the kinds asked for, at every level of nesting, as one undo step when one goes; layers stay; each object keeps the opacity of the groups and compound paths it was in, and a compound path's paths take its paint; objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, paths with Live Corners, blends, envelopes and other live objects stay whole, and the clipping path of a clipping group or layer that stays is left as it is, also when it is selected or named itself; from the selection or the document, locked and hidden objects, and objects on a locked artboard, stay whole; named by `ids`, locked and hidden ones are taken apart too (their objects become locked or hidden as they were), but not those on a locked artboard; the selection keeps what it held, each object taken apart replaced by what it left, locked and hidden objects left out → {scope (\"selection\", \"document\" or \"ids\"), ids (the objects selected), groups, clipGroups, compoundPaths (how many of each were released)}", + "{scope?: \"selection\"|\"document\" (default: the selection, or the document while nothing is selected), ids?: [id…] (the objects, groups and layers to release in, instead of `scope`; duplicate ids are an error), groups?: bool (true: groups are ungrouped), clipGroups?: bool (true: clipping groups are ungrouped and layers stop clipping unless they clip artwork on a locked artboard, their released clipping paths kept as plain paths), compoundPaths?: bool (true: compound paths, and paths of several subpaths, become one path per subpath); at least one of the three; defaults apply only to omitted values, and explicit null values are errors} take apart every container of the kinds asked for, at every level of nesting, as one undo step when one goes; layers stay; each object keeps the opacity of the groups and compound paths it was in, and a compound path's paths take its paint; objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, paths with Live Corners, blends, envelopes, repeats, intertwines and other live objects stay whole, including directly selected or named descendants; the entire clipping mask subtree of a clipping group or layer that stays is left as it is, including directly selected or named descendants; from the selection or the document, locked and hidden objects, and objects on a locked artboard, stay whole; named by `ids`, locked and hidden ones are taken apart too (their objects become locked or hidden as they were), but not those on a locked artboard; the selection keeps what it held, each object taken apart replaced by what it left, locked and hidden objects left out → {scope (\"selection\", \"document\" or \"ids\"), ids (the objects selected), groups, clipGroups, compoundPaths (how many of each were released)}", has_doc, release_all )] @@ -70,7 +70,8 @@ struct Release<'a> { /// would lose what it does to them. fn live(n: &Node) -> bool { let x = n.extras(); - matches!(&n.kind, NodeKind::Path { live: Some(l), .. } if matches!(**l, LiveShape::Path { .. })) + matches!(&n.kind, NodeKind::Blend { .. } | NodeKind::Envelope { .. } | NodeKind::Repeat(_) | NodeKind::Intertwine { .. }) + || matches!(&n.kind, NodeKind::Path { live: Some(l), .. } if matches!(**l, LiveShape::Path { .. })) || x.mask.is_some() || x.shaper.is_some() || x.trace.is_some() @@ -266,12 +267,37 @@ impl Release<'_> { } } -/// Whether `id` is the clipping path of the clipping group or layer it is in. -fn clips_its_parent(d: &Document, id: NodeId) -> bool { - d.parent_of(id).and_then(|p| d.node(p)).is_some_and(|p| p.clips() && p.children().and_then(|c| c.first()).is_some_and(|c| c.id == id)) +/// Whether `id` is in the clipping mask subtree of a clipping group or layer. +fn in_clipping_mask(d: &Document, id: NodeId) -> bool { + d.ancestry(id).is_some_and(|chain| { + chain + .windows(2) + .any(|pair| d.node(pair[0]).is_some_and(|p| p.clips() && p.children().and_then(|c| c.first()).is_some_and(|c| c.id == pair[1]))) + }) } fn release_all(s: &mut Session, p: &Value) -> Result { + if !p.is_object() { + return Err(bad(COMMAND, "parameters must be an object")); + } + for key in ["groups", "clipGroups", "compoundPaths"] { + if p.get(key).is_some_and(|v| !v.is_boolean()) { + return Err(bad(COMMAND, format!("`{key}` must be true or false"))); + } + } + if p.get("scope").is_some_and(|v| !matches!(v.as_str(), Some("selection" | "document"))) { + return Err(bad(COMMAND, "`scope` must be \"selection\" or \"document\"")); + } + if let Some(ids) = p.get("ids") { + let ids = ids.as_array().ok_or_else(|| bad(COMMAND, "`ids` must be an array of non-negative integer object ids"))?; + let mut seen = HashSet::new(); + for id in ids { + let id = id.as_u64().ok_or_else(|| bad(COMMAND, "`ids` must contain non-negative integer object ids"))?; + if !seen.insert(id) { + return Err(bad(COMMAND, format!("duplicate object id {id} in `ids`"))); + } + } + } let kinds = Kinds { groups: switch_or(p, "groups", true, COMMAND)?, clips: switch_or(p, "clipGroups", true, COMMAND)?, @@ -281,7 +307,7 @@ fn release_all(s: &mut Session, p: &Value) -> Result { return Err(bad(COMMAND, "`groups`, `clipGroups` and `compoundPaths` are all false: there is nothing to release")); } let named = named(p); - if named && p.get("scope").is_some_and(|v| !v.is_null()) { + if named && p.get("scope").is_some() { return Err(bad(COMMAND, "give `scope` or `ids`, not both")); } let (roots, name) = if named { @@ -313,11 +339,10 @@ fn release_all(s: &mut Session, p: &Value) -> Result { let mut run = Release { kinds, named, held: &held, counts: [0; 3], made: 0, left: HashMap::new() }; let mut items = vec![]; for id in roots { - // A clipping path picked inside the clipping group or layer it clips stays as it is, as it - // does when that group or layer is released in. + // Direct targets inside a live object or clipping mask stay whole. let protected = d.ancestry(id).is_some_and(|chain| chain.iter().take(chain.len().saturating_sub(1)).filter_map(|id| d.node(*id)).any(|n| run.keeps(n))); - if clips_its_parent(&d, id) || protected { + if in_clipping_mask(&d, id) || protected { continue; } let Some(n) = d.node_arc(id).cloned() else { continue }; diff --git a/crates/engine/src/cmd/addons/cleanup/release/tests.rs b/crates/engine/src/cmd/addons/cleanup/release/tests.rs index 2b1b4a23a2..6d54c9d054 100644 --- a/crates/engine/src/cmd/addons/cleanup/release/tests.rs +++ b/crates/engine/src/cmd/addons/cleanup/release/tests.rs @@ -492,6 +492,104 @@ fn release_all_keeps_selection_details_for_untouched_artwork() { assert_eq!(after.guides, before.guides); } +#[test] +fn release_all_keeps_a_directly_named_blend_key() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let b = rect(&mut s, 40.0, 10.0); + let key = group(&mut s, &[a, b]); + let c = rect(&mut s, 100.0, 10.0); + select(&mut s, &[key, c]); + let blend = id_of(&s.execute("object.blend.make", &json!({})).unwrap()); + assert_eq!(s.doc().unwrap().doc.parent_of(key), Some(blend)); + let before = s.doc().unwrap().doc.clone(); + let selection = selected(&s); + let steps = undo_steps(&s); + let r = s.execute(C, &json!({"ids": [key.0]})).unwrap(); + assert_eq!(counts(&r), (0, 0, 0)); + assert!(std::sync::Arc::ptr_eq(&before, &s.doc().unwrap().doc)); + assert_eq!(selected(&s), selection); + assert_eq!(undo_steps(&s), steps); +} + +#[test] +fn release_all_keeps_a_direct_target_inside_a_compound_clipping_mask() { + for clipping_layer in [false, true] { + let mut s = session(); + let art = rect(&mut s, 10.0, 10.0); + let a = rect(&mut s, 5.0, 5.0); + let b = rect(&mut s, 8.0, 8.0); + change(&mut s, a, |n| { + if let NodeKind::Path { path, live, .. } = &mut n.kind { + path.subpaths.push(path.subpaths[0].clone()); + *live = None; + } + }); + let mask = compound(&mut s, &[a, b]); + let container = if clipping_layer { + let id = s.doc().unwrap().doc.layers[0].id; + change(&mut s, id, |n| { + n.children_mut().unwrap().swap(0, 1); + n.set_clips(true); + }); + id + } else { + clip_group(&mut s, &[art, mask]) + }; + assert_eq!(node(&s, container).unwrap().children().unwrap()[0].id, mask); + let before = s.doc().unwrap().doc.clone(); + let steps = undo_steps(&s); + for named in [false, true] { + select(&mut s, &[a]); + let p = if named { json!({"ids": [a.0]}) } else { json!({"clipGroups": false}) }; + let r = s.execute(C, &p).unwrap(); + assert_eq!(counts(&r), (0, 0, 0), "{p}"); + assert!(std::sync::Arc::ptr_eq(&before, &s.doc().unwrap().doc)); + assert_eq!(selected(&s), [a]); + assert_eq!(undo_steps(&s), steps); + } + } +} + +#[test] +fn release_all_rejects_null_options_without_editing_artwork() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let g = group(&mut s, &[a]); + for selection in [vec![], vec![g]] { + select(&mut s, &selection); + let before = s.doc().unwrap().doc.clone(); + let steps = undo_steps(&s); + for key in ["ids", "scope", "groups", "clipGroups", "compoundPaths"] { + let mut p = json!({}); + p[key] = Value::Null; + let error = s.execute(C, &p).unwrap_err(); + assert!(matches!(error, crate::EngineError::BadParams { ref cmd, .. } if cmd == C), "{p}: {error}"); + assert!(std::sync::Arc::ptr_eq(&before, &s.doc().unwrap().doc)); + assert_eq!(selected(&s), selection); + assert_eq!(undo_steps(&s), steps); + } + } +} + +#[test] +fn release_all_rejects_duplicate_ids_before_traversal() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let g = group(&mut s, &[a]); + let b = rect(&mut s, 50.0, 10.0); + select(&mut s, &[g]); + let before = s.doc().unwrap().doc.clone(); + let steps = undo_steps(&s); + for ids in [vec![g.0, g.0], vec![b.0, b.0], vec![g.0, a.0, a.0]] { + let error = s.execute(C, &json!({"ids": ids})).unwrap_err(); + assert!(matches!(error, crate::EngineError::BadParams { ref cmd, ref msg } if cmd == C && msg.contains("duplicate")), "{error}"); + assert!(std::sync::Arc::ptr_eq(&before, &s.doc().unwrap().doc)); + assert_eq!(selected(&s), [g]); + assert_eq!(undo_steps(&s), steps); + } +} + #[test] fn release_all_refuses_bad_params() { let mut s = session(); diff --git a/docs/mcp.md b/docs/mcp.md index abe55ce765..68f83dcaeb 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -16585,14 +16585,16 @@ locked group becomes locked. Locked and hidden objects stay locked or hidden and Release All Containers…) takes apart every container at every level of nesting as one undo step, so that only the objects they held are left. `scope` is `"selection"` or `"document"`; by default it is the selection, or the document while nothing is selected. `ids` names the objects, groups and layers to release in instead of `scope`; giving both is -an error. `groups` ungroups groups, `clipGroups` ungroups clipping groups and makes layers stop clipping unless they +an error. Duplicate IDs are an error. Defaults apply only to omitted values; explicit null values are errors. +`groups` ungroups groups, `clipGroups` ungroups clipping groups and makes layers stop clipping unless they clip artwork on a locked artboard (released clipping paths stay as plain paths), and `compoundPaths` turns compound paths, and paths of several subpaths, into one path per subpath. Each is true by default, and at least one must be true. Layers stay. Objects keep the opacity of the groups and compound paths they were in, and the paths of a compound path take its paint. Objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, -Image Trace objects, paths with Live Corners, blends, envelopes and other live objects stay whole, and the clipping -path of a clipping group or layer that stays is left as it is, also when it is selected or named itself. From the selection or the document, locked and hidden objects +Image Trace objects, paths with Live Corners, blends, envelopes, repeats, intertwines and other live objects stay whole, +including directly selected or named descendants. The entire clipping mask subtree of a clipping group or layer that +stays is left as it is, including directly selected or named descendants. From the selection or the document, locked and hidden objects and objects on a locked artboard stay whole. With `ids`, the locked and hidden containers it names, or that are in what it names, are taken apart too and their objects become locked or hidden as the containers were, but containers on a locked artboard stay whole. The selection keeps what it held, with each object taken apart replaced by the objects From bcdf0b28452be5b5c42a0aaeebff9b580794795f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 29 Nov 2026 22:45:25 -0800 Subject: [PATCH 05/29] Artwork Cleanup: Release All Containers keeps objects with live effects and layer masks on locked artboards - A group or other container with live effects on its appearance, or on its fill and stroke rows, stays whole with everything in it. - A layer keeps clipping when its clipping path alone overlaps a locked artboard. - A null \ids\ takes the selection, as in every other command that falls back to it. --- .../engine/src/cmd/addons/cleanup/release.rs | 12 +-- .../src/cmd/addons/cleanup/release/tests.rs | 79 ++++++++++++++++++- docs/mcp.md | 14 ++-- 3 files changed, 93 insertions(+), 12 deletions(-) diff --git a/crates/engine/src/cmd/addons/cleanup/release.rs b/crates/engine/src/cmd/addons/cleanup/release.rs index 9a4caccfbc..62b9c4c836 100644 --- a/crates/engine/src/cmd/addons/cleanup/release.rs +++ b/crates/engine/src/cmd/addons/cleanup/release.rs @@ -27,7 +27,7 @@ pub(super) fn specs() -> Vec { "Release All Containers…", ["Object", "Plug-ins", "Artwork Cleanup"], None, - "{scope?: \"selection\"|\"document\" (default: the selection, or the document while nothing is selected), ids?: [id…] (the objects, groups and layers to release in, instead of `scope`; duplicate ids are an error), groups?: bool (true: groups are ungrouped), clipGroups?: bool (true: clipping groups are ungrouped and layers stop clipping unless they clip artwork on a locked artboard, their released clipping paths kept as plain paths), compoundPaths?: bool (true: compound paths, and paths of several subpaths, become one path per subpath); at least one of the three; defaults apply only to omitted values, and explicit null values are errors} take apart every container of the kinds asked for, at every level of nesting, as one undo step when one goes; layers stay; each object keeps the opacity of the groups and compound paths it was in, and a compound path's paths take its paint; objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, paths with Live Corners, blends, envelopes, repeats, intertwines and other live objects stay whole, including directly selected or named descendants; the entire clipping mask subtree of a clipping group or layer that stays is left as it is, including directly selected or named descendants; from the selection or the document, locked and hidden objects, and objects on a locked artboard, stay whole; named by `ids`, locked and hidden ones are taken apart too (their objects become locked or hidden as they were), but not those on a locked artboard; the selection keeps what it held, each object taken apart replaced by what it left, locked and hidden objects left out → {scope (\"selection\", \"document\" or \"ids\"), ids (the objects selected), groups, clipGroups, compoundPaths (how many of each were released)}", + "{scope?: \"selection\"|\"document\" (default: the selection, or the document while nothing is selected), ids?: [id…] (the objects, groups and layers to release in, instead of `scope`; duplicate ids are an error), groups?: bool (true: groups are ungrouped), clipGroups?: bool (true: clipping groups are ungrouped and layers stop clipping unless their clipping path or clipped artwork overlaps a locked artboard, their released clipping paths kept as plain paths), compoundPaths?: bool (true: compound paths, and paths of several subpaths, become one path per subpath); at least one of the three true; `scope` and the three are never null} take apart every container of the kinds asked for, at every level of nesting, as one undo step when one goes; layers stay; each object keeps the opacity of the groups and compound paths it was in, and a compound path's paths take its paint; objects with live effects on their appearance or fill and stroke rows, objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, paths with Live Corners, blends, envelopes, repeats, intertwines and other live objects stay whole, including directly selected or named descendants; the entire clipping mask subtree of a clipping group or layer that stays is left as it is, including directly selected or named descendants; from the selection or the document, locked and hidden objects, and objects on a locked artboard, stay whole; named by `ids`, locked and hidden ones are taken apart too (their objects become locked or hidden as they were), but not those on a locked artboard; the selection keeps what it held, each object taken apart replaced by what it left, locked and hidden objects left out → {scope (\"selection\", \"document\" or \"ids\"), ids (the objects selected), groups, clipGroups, compoundPaths (how many of each were released)}", has_doc, release_all )] @@ -66,12 +66,14 @@ struct Release<'a> { /// Whether `n` stays whole whatever is asked: a live object kept as a group or compound path /// (a compound shape, Live Paint group, graph, dimension, flare, Objects on Path, generated art, /// Shaper Group, Image Trace object, a clipping path's painted pieces), a path with Live Corners, -/// whose parts would lose their editable corners, or one with an opacity mask, whose contents -/// would lose what it does to them. +/// whose parts would lose their editable corners, or one with an opacity mask or live effects +/// on its appearance or fill and stroke rows. fn live(n: &Node) -> bool { let x = n.extras(); matches!(&n.kind, NodeKind::Blend { .. } | NodeKind::Envelope { .. } | NodeKind::Repeat(_) | NodeKind::Intertwine { .. }) || matches!(&n.kind, NodeKind::Path { live: Some(l), .. } if matches!(**l, LiveShape::Path { .. })) + || !n.appearance.effects.is_empty() + || n.appearance.items.iter().any(|item| !item.effects().is_empty()) || x.mask.is_some() || x.shaper.is_some() || x.trace.is_some() @@ -210,7 +212,7 @@ impl Release<'_> { } let before = self.total(); let mut clips = n.clips(); - if clips && n.is_layer() && self.kinds.clips && !n.children().is_some_and(|children| children.iter().skip(1).any(|c| self.holds_art(c))) { + if clips && n.is_layer() && self.kinds.clips && !n.children().is_some_and(|children| children.iter().any(|c| self.holds_art(c))) { self.counts[1] += 1; let n = Arc::make_mut(&mut n); n.set_clips(false); @@ -288,7 +290,7 @@ fn release_all(s: &mut Session, p: &Value) -> Result { if p.get("scope").is_some_and(|v| !matches!(v.as_str(), Some("selection" | "document"))) { return Err(bad(COMMAND, "`scope` must be \"selection\" or \"document\"")); } - if let Some(ids) = p.get("ids") { + if let Some(ids) = p.get("ids").filter(|v| !v.is_null()) { let ids = ids.as_array().ok_or_else(|| bad(COMMAND, "`ids` must be an array of non-negative integer object ids"))?; let mut seen = HashSet::new(); for id in ids { diff --git a/crates/engine/src/cmd/addons/cleanup/release/tests.rs b/crates/engine/src/cmd/addons/cleanup/release/tests.rs index 6d54c9d054..f0b95941a1 100644 --- a/crates/engine/src/cmd/addons/cleanup/release/tests.rs +++ b/crates/engine/src/cmd/addons/cleanup/release/tests.rs @@ -401,6 +401,49 @@ fn release_all_keeps_a_directly_named_descendant_of_a_live_object() { } } +#[test] +fn release_all_keeps_appearance_effects_and_directly_targeted_descendants() { + for item in [None, Some(0), Some(1)] { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let b = rect(&mut s, 15.0, 15.0); + let inner = compound(&mut s, &[a, b]); + let c = rect(&mut s, 20.0, 20.0); + select(&mut s, &[inner, c]); + let applied = s.execute("effect.apply", &json!({"effect": "pathfinder.add"})).unwrap(); + assert_eq!(applied["grouped"], true); + let live = selected(&s)[0]; + assert!(matches!(node(&s, live).unwrap().kind, NodeKind::Group { clip: false, .. })); + assert!(!node(&s, live).unwrap().is_compound_shape()); + assert_eq!(node(&s, live).unwrap().appearance.effects[0].id, "pathfinder.add"); + if let Some(item) = item { + change(&mut s, live, |n| { + let effects = n.appearance.effects.clone(); + *n.appearance = red(); + *n.appearance.effects_mut(Some(item)).unwrap() = effects; + }); + } + let before = s.doc().unwrap().doc.clone(); + let steps = undo_steps(&s); + for (target, params) in [ + (live, json!({})), + (live, json!({"scope": "document"})), + (live, json!({"ids": [live.0]})), + (inner, json!({})), + (inner, json!({"ids": [inner.0]})), + ] { + select(&mut s, &[target]); + let r = s.execute(C, ¶ms).unwrap(); + assert_eq!(counts(&r), (0, 0, 0), "{item:?}: {params}: {r}"); + assert!(std::sync::Arc::ptr_eq(&before, &s.doc().unwrap().doc)); + assert_eq!(selected(&s), [target]); + assert_eq!(undo_steps(&s), steps); + assert_eq!(s.doc().unwrap().doc.parent_of(inner), Some(live)); + assert_eq!(s.doc().unwrap().doc.parent_of(a), Some(inner)); + } + } +} + #[test] fn release_all_keeps_a_layer_mask_over_locked_artboard_artwork() { for named in [false, true] { @@ -432,6 +475,40 @@ fn release_all_keeps_a_layer_mask_over_locked_artboard_artwork() { } } +#[test] +fn release_all_keeps_a_layer_mask_that_alone_overlaps_a_locked_artboard() { + for named in [false, true] { + let mut s = session(); + let mask = rect(&mut s, 0.0, 0.0); + let outside = rect(&mut s, 500.0, 10.0); + let g = group(&mut s, &[outside]); + let layer_id = s.doc().unwrap().doc.layers[0].id; + change(&mut s, layer_id, |n| n.set_clips(true)); + change(&mut s, mask, |n| { + if let NodeKind::Path { clipping, .. } = &mut n.kind { + *clipping = true; + } + }); + select(&mut s, &[]); + s.edit("Lock Artboard", |d, _| { + d.artboards[0].locked = true; + Ok(()) + }) + .unwrap(); + let original_mask = s.doc().unwrap().doc.node_arc(mask).unwrap().clone(); + let steps = undo_steps(&s); + let p = if named { json!({"ids": [layer_id.0]}) } else { json!({"scope": "document"}) }; + let r = s.execute(C, &p).unwrap(); + assert_eq!(counts(&r), (1, 0, 0), "{p}: {r}"); + assert_eq!(undo_steps(&s), steps + 1); + assert!(node(&s, layer_id).unwrap().clips()); + assert!(matches!(node(&s, mask).unwrap().kind, NodeKind::Path { clipping: true, .. })); + assert!(std::sync::Arc::ptr_eq(&original_mask, s.doc().unwrap().doc.node_arc(mask).unwrap())); + assert_eq!(layer(&s, 0), [mask, outside]); + assert!(node(&s, g).is_none()); + } +} + #[test] fn release_all_reuses_unchanged_siblings_when_rebuilding_a_layer() { let mut s = session(); @@ -560,7 +637,7 @@ fn release_all_rejects_null_options_without_editing_artwork() { select(&mut s, &selection); let before = s.doc().unwrap().doc.clone(); let steps = undo_steps(&s); - for key in ["ids", "scope", "groups", "clipGroups", "compoundPaths"] { + for key in ["scope", "groups", "clipGroups", "compoundPaths"] { let mut p = json!({}); p[key] = Value::Null; let error = s.execute(C, &p).unwrap_err(); diff --git a/docs/mcp.md b/docs/mcp.md index 68f83dcaeb..85abb148a5 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -16585,13 +16585,15 @@ locked group becomes locked. Locked and hidden objects stay locked or hidden and Release All Containers…) takes apart every container at every level of nesting as one undo step, so that only the objects they held are left. `scope` is `"selection"` or `"document"`; by default it is the selection, or the document while nothing is selected. `ids` names the objects, groups and layers to release in instead of `scope`; giving both is -an error. Duplicate IDs are an error. Defaults apply only to omitted values; explicit null values are errors. -`groups` ungroups groups, `clipGroups` ungroups clipping groups and makes layers stop clipping unless they -clip artwork on a locked artboard (released clipping paths stay as plain paths), and `compoundPaths` turns compound -paths, and paths of several subpaths, into one path per subpath. Each is true by default, and at least one must be true. +an error. Duplicate IDs are an error. A null `ids` takes the selection as an omitted one does; a null `scope`, `groups`, `clipGroups` or `compoundPaths` is an error. +`groups` ungroups groups, `clipGroups` ungroups clipping groups and makes layers stop clipping unless +their clipping path or clipped artwork overlaps a locked artboard (released clipping paths stay as plain paths), and +`compoundPaths` turns compound paths, and paths of several subpaths, into one path per subpath. Each is true by default, +and at least one must be true. Layers stay. Objects keep the opacity of -the groups and compound paths they were in, and the paths of a compound path take its paint. Objects with an opacity -mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, +the groups and compound paths they were in, and the paths of a compound path take its paint. Objects with live effects +on their appearance or fill and stroke rows, objects with an opacity mask, compound shapes, Live Paint groups, graphs, +dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, paths with Live Corners, blends, envelopes, repeats, intertwines and other live objects stay whole, including directly selected or named descendants. The entire clipping mask subtree of a clipping group or layer that stays is left as it is, including directly selected or named descendants. From the selection or the document, locked and hidden objects From 42a43cf36cc096bcabcca83fc04b42df1892071d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 30 Nov 2026 22:31:15 -0800 Subject: [PATCH 06/29] Panels: a panel floated in Essentials opens a window that shows In Essentials, a panel or the Tools rail dragged out of the dock left the dock but its OS window never appeared, and only Reset Workspace brought it back. The Contextual Task Bar counted as a layer that palette windows hide under, so a floating window opened hidden and stayed hidden while the bar showed. craft-libs now hides palette windows only under popup and modal layers (storytold/craft-libs#4616). The craft-libs pin moves to that pull request's head, and a test floats the Tools rail and the Properties group in every built-in workspace and checks that each OS window shows. --- Cargo.lock | 172 +++++++++--------- Cargo.toml | 76 ++++---- apps/vectorcraft-web/Cargo.toml | 2 +- .../ui-egui/src/panel_docking/native_tests.rs | 24 +++ xtask/src/pdf_deps.rs | 2 +- 5 files changed, 150 insertions(+), 126 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 344ae8dc34..a378b5a2a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-automation", "craft-behavior", @@ -1272,7 +1272,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "crc32fast", "flate2", @@ -1283,7 +1283,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "rustix 1.1.6", ] @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1346,7 +1346,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-docpath", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "crc32fast", "flate2", @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "egui", ] @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "md-5", "rayon", @@ -1390,12 +1390,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-cms", @@ -1415,7 +1415,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1436,7 +1436,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "rayon", ] @@ -1444,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "blake3", "craft-ecproj-format", @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "serde", ] @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-codepage", "encoding_rs", @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "serde", "serde_json", @@ -1535,12 +1535,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1583,7 +1583,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "cap-primitives", "craft-atomic", @@ -1606,12 +1606,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "gif", ] @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "flate2", ] @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-dds", "craft-jpeg", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1715,7 +1715,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "thiserror 2.0.21", ] @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-host", "craft-i18n", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-i18n", @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-host", @@ -1781,7 +1781,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "encoding_rs", "image", @@ -1804,7 +1804,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "chrono", "craft-codepage", @@ -1814,7 +1814,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "uds_windows", "winsafe", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-keymap", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "flate2", "serde", @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "async-channel", "async-io", @@ -1895,7 +1895,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1904,7 +1904,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-host", @@ -1928,7 +1928,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1939,7 +1939,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-eps", "flate2", @@ -1953,7 +1953,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "encoding_rs", "flate2", @@ -1964,7 +1964,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "dispatch2", "egui", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1996,7 +1996,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-atomic", "craft-host", @@ -2013,7 +2013,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "fax", "hayro-ccitt", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-keymap", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2082,7 +2082,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2097,7 +2097,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-atomic", "craft-behavior", @@ -2112,7 +2112,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "serde", "thiserror 2.0.21", @@ -2122,7 +2122,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "serde", "thiserror 2.0.21", @@ -2131,7 +2131,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-keymap", @@ -2146,12 +2146,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2165,7 +2165,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2182,7 +2182,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "accesskit", "craft-behavior", @@ -2220,7 +2220,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2231,7 +2231,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-host", @@ -2249,7 +2249,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-host", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-host", @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-behavior", "craft-host", @@ -2310,7 +2310,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "base64 0.22.1", "chrono", @@ -2342,7 +2342,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "flate2", "serde", @@ -2353,7 +2353,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2363,7 +2363,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "js-sys", "serde_json", @@ -2374,7 +2374,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "winsafe", ] @@ -2382,7 +2382,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "craft-appkit", "craft-atomic", @@ -2414,7 +2414,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3773,7 +3773,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3782,7 +3782,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3800,7 +3800,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3818,12 +3818,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "flate2", "hayro-ccitt", @@ -4806,7 +4806,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4963,7 +4963,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6" +source = "git+https://github.com/storytold/craft-libs?rev=adb8c1c22a42a7e67389b7428d01c9c630f6f71e#adb8c1c22a42a7e67389b7428d01c9c630f6f71e" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index fcc2a1ad8f..4db7b20cb5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,51 +10,51 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -194,13 +194,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 824600f90a..a4e97babd7 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/ui-egui/src/panel_docking/native_tests.rs b/crates/ui-egui/src/panel_docking/native_tests.rs index 3ceb28ad9f..1d69d478cd 100644 --- a/crates/ui-egui/src/panel_docking/native_tests.rs +++ b/crates/ui-egui/src/panel_docking/native_tests.rs @@ -25,6 +25,9 @@ struct Window { hovered: Vec, dropped: Vec, close_requested: bool, + /// Whether the window shows on the desktop: the builder's visibility when it opened, then each + /// `Visible` command. + visible: bool, frames: usize, /// The texts its last frame drew, with their rects in the window. texts: Vec<(String, Rect)>, @@ -72,6 +75,7 @@ impl Host { ViewportCommand::OuterPosition(pos) => window.rect = Rect::from_min_size(*pos, window.rect.size()), ViewportCommand::InnerSize(size) => window.rect = Rect::from_min_size(window.rect.min, *size), ViewportCommand::CancelClose => window.close_requested = false, + ViewportCommand::Visible(visible) => window.visible = *visible, _ => {} } } @@ -91,6 +95,7 @@ impl Host { hovered: Vec::new(), dropped: Vec::new(), close_requested: false, + visible: builder.visible != Some(false), frames: 0, texts: Vec::new(), nodes: Vec::new(), @@ -572,3 +577,22 @@ fn copy_and_cut_in_a_native_window_act_on_the_art_while_another_windows_label_ha assert!(![copied, cut].concat().iter().any(|t| t == LABEL), "{what}: the floating window copied no label text"); } } + +/// A panel or the Tools rail floated out of the dock opens an OS window that shows, in every built-in workspace, +/// including those whose Contextual Task Bar shows over the canvas. +#[test] +fn a_panel_floated_in_any_built_in_workspace_opens_a_shown_window() { + for workspace in crate::workspaces::builtins() { + for panel in ["tools", "properties"] { + let mut h = Harness::new(); + h.app.run("window.workspace", json!({"name": workspace.name})).unwrap(); + h.frames(3); + h.app.run("window.panel.float", json!({"panel": panel, "x": 200, "y": 200})).unwrap(); + h.frames(6); + let viewport = h.viewport(panel); + let host = h.host.borrow(); + let window = host.windows.get(&viewport).expect("the panel opened an OS window"); + assert!(window.visible, "{}: the {panel} window shows", workspace.name); + } + } +} diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 337ba6325e..f5717712de 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "965c7beeb6076480e016e448bddddcce0a738ff6"; +const REV: &str = "adb8c1c22a42a7e67389b7428d01c9c630f6f71e"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From 0a9d0ad95091b228f4d30d55077db4aceec932fd Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 1 Dec 2026 02:36:05 -0800 Subject: [PATCH 07/29] Tests: hold the font scan in a lister so the menu list test runs on the new craft-libs The craft-libs revision this branch moves to skips any font file that is not a regular file (craft-libs adb8c1c2, font-catalog `Catalog::rescan`), so the scan never opened the named pipe that `the_menu_family_list_now_does_not_wait_for_the_scan` used to hold it. The test's release thread then blocked opening the pipe for writing with no reader, and gate shard 5/6 ran the test for over two hours before the job was canceled. The test now holds the scan in a file lister added by a test-only constructor, `FontDb::with_font_dirs_and_scan_hook`. The lister reports that the scan started and waits until the lookups under test return. A lookup that waits for the scan makes the lister give up after 120 s and the test fails on that record instead of hanging. The test no longer needs `mkfifo`, so it runs on every platform. Its assertions are unchanged. --- crates/text/src/fontdb/db.rs | 14 ++++++++++++ crates/text/src/tests/sysfonts.rs | 38 ++++++++++++++++++------------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/crates/text/src/fontdb/db.rs b/crates/text/src/fontdb/db.rs index f506de34c5..dfc57e6bf8 100644 --- a/crates/text/src/fontdb/db.rs +++ b/crates/text/src/fontdb/db.rs @@ -34,6 +34,20 @@ impl FontDb { Self::new(catalog) } + /// [`FontDb::with_font_dirs`] whose every scan first calls `hook`, for tests that hold a scan + /// part way. + #[cfg(test)] + pub(crate) fn with_font_dirs_and_scan_hook(font_dirs: Vec, hook: impl Fn() + Send + Sync + 'static) -> Self { + let catalog = Catalog::new(FontEnv { os: Os::None, ..FontEnv::default() }).with_font_service(false); + let (folders, files): (Vec, Vec) = font_dirs.into_iter().partition(|p| p.is_dir()); + let catalog = catalog.with_lister(Arc::new(move || { + hook(); + files.clone() + })); + catalog.set_app_dirs(folders); + Self::new(catalog) + } + /// Same scan paths as [`FontDb::global`] (platform lister and font folders), for tests. #[cfg(test)] pub(crate) fn for_system_scan_test() -> Self { diff --git a/crates/text/src/tests/sysfonts.rs b/crates/text/src/tests/sysfonts.rs index 261cc1c54c..3d3776c7f6 100644 --- a/crates/text/src/tests/sysfonts.rs +++ b/crates/text/src/tests/sysfonts.rs @@ -524,30 +524,36 @@ fn a_background_scan_serves_the_first_lookup() { /// for the scan of the installed fonts: a large library would hold the first frame past the /// first-frame watchdog, and the app would never show its window (#5483). Once the scan ends, the /// list has the installed fonts. -#[cfg(unix)] #[test] fn the_menu_family_list_now_does_not_wait_for_the_scan() { let dir = font_dir("held-scan"); - // A named pipe with a font's name: the scan opens it and waits there until something writes. - let pipe = dir.join("Held.ttf"); - assert!(std::process::Command::new("mkfifo").arg(&pipe).status().unwrap().success()); - let db: &'static FontDb = Box::leak(Box::new(FontDb::with_font_dirs(vec![dir]))); + // The scan reports that it has started, then waits in its file lister until the calls below + // have returned and the sender is dropped. Every later scan proceeds with the sender disconnected. + // The gate CI runs has no test timeout, so a list that waited for the scan would hang its shard: + // after 120 s the lister lets the scan go on and records it, and the test fails on that record. + // A passing run never reaches the bound. + const BOUND: std::time::Duration = std::time::Duration::from_secs(120); + let (started, scanning) = std::sync::mpsc::channel::<()>(); + let (returned, waiting) = std::sync::mpsc::channel::<()>(); + let held = std::sync::Mutex::new((started, waiting)); + let gave_up = Arc::new(std::sync::atomic::AtomicBool::new(false)); + let gave_up_in_scan = gave_up.clone(); + let hold = move || { + if let Ok(held) = held.lock() { + let _ = held.0.send(()); + if let Err(std::sync::mpsc::RecvTimeoutError::Timeout) = held.1.recv_timeout(BOUND) { + gave_up_in_scan.store(true, std::sync::atomic::Ordering::SeqCst); + } + } + }; + let db: &'static FontDb = Box::leak(Box::new(FontDb::with_font_dirs_and_scan_hook(vec![dir], hold))); let generation = db.generation(); db.scan_in_background(); - // The scan can't end until the pipe is opened for writing, so a list that waited for it would - // hold the installed fonts. This thread lets the scan go on once the calls return, or after 10 s - // if they are still waiting, so that such a test fails instead of hanging. - let (returned, waiting) = std::sync::mpsc::channel::<()>(); - let release = pipe.clone(); - let guard = std::thread::spawn(move || { - let _ = waiting.recv_timeout(std::time::Duration::from_secs(10)); - // The pipe is opened and closed with nothing written. - drop(std::fs::OpenOptions::new().write(true).open(&release).unwrap()); - }); + scanning.recv_timeout(BOUND).expect("the background scan started"); let ready = db.installed_fonts_ready(); let listed = db.menu_family_list_now(); drop(returned); - guard.join().unwrap(); + assert!(!gave_up.load(std::sync::atomic::Ordering::SeqCst), "the list waited for the held scan"); assert!(!ready && !has(&listed, FAMILY), "before the scan ends, only the fonts already loaded"); // Waits for the scan. assert!(has(&db.menu_family_list(), FAMILY)); From bd72609eda7433abe4604c83c129a3cecc03ef7e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 06:53:23 -0800 Subject: [PATCH 08/29] MCP: ui.menuDialog lists addon.cleanup.releaseAll Main's 1662723c made ui.menuDialog's params text cover the add-on dialogs and the test menu_dialog_params_text_lists_every_command_whose_dialog_it_opens checks every dialog it opens is listed. The Release All Containers dialog this branch adds opens through ui.menuDialog but was missing from the list, so the test failed after main was merged in. --- crates/ui-egui/src/menus/ui_commands.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 3e4a834cb8..fe0d6bf09a 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1544,7 +1544,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.menuDialog", "Menu Dialog", "", - "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.commonTangents|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.type.numbers|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.color.randomFill|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `addon.pathtools.commonTangents` for addon.pathtools.bridge, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", + "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.commonTangents|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.type.numbers|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.color.randomFill|addon.select.byArtboards|addon.select.editPointsOnly|addon.cleanup.releaseAll|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `addon.pathtools.commonTangents` for addon.pathtools.bridge, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", ), ( "ui.widthPointEdit", From 7534049a6da71620ede27605d8e8ecc3d18ad0be Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 07:57:11 -0800 Subject: [PATCH 09/29] MCP: regenerate ui_catalog for addon.cleanup.releaseAll bd72609 added addon.cleanup.releaseAll to ui.menuDialog's params text in crates/ui-egui/src/menus/ui_commands.rs without regenerating the MCP mirror, so CI's ui-commands step failed. This is the output of cargo xtask ui-commands. --- crates/mcp/src/ui_catalog.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 8dfdfd28e3..d269e6c9bc 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1543,7 +1543,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.menuDialog", "Menu Dialog", "", - "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.commonTangents|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.type.numbers|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.color.randomFill|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `addon.pathtools.commonTangents` for addon.pathtools.bridge, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", + "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.commonTangents|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.type.numbers|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.color.randomFill|addon.select.byArtboards|addon.select.editPointsOnly|addon.cleanup.releaseAll|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `addon.pathtools.commonTangents` for addon.pathtools.bridge, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", ), ( "ui.widthPointEdit", From 7ee191182dce282ebe0c62dc9fdfe45c4b4549cb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 12:31:14 -0800 Subject: [PATCH 10/29] MCP: say a null ids on addon.cleanup.releaseAll falls back as an omitted one does A null `ids` counts as left out: `scope` applies, and without `scope` the command uses the selection, or the document while nothing is selected. --- docs/mcp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/mcp.md b/docs/mcp.md index ccd07e7276..cb89029b26 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -16910,7 +16910,7 @@ locked group becomes locked. Locked and hidden objects stay locked or hidden and Release All Containers…) takes apart every container at every level of nesting as one undo step, so that only the objects they held are left. `scope` is `"selection"` or `"document"`; by default it is the selection, or the document while nothing is selected. `ids` names the objects, groups and layers to release in instead of `scope`; giving both is -an error. Duplicate IDs are an error. A null `ids` takes the selection as an omitted one does; a null `scope`, `groups`, `clipGroups` or `compoundPaths` is an error. +an error. Duplicate IDs are an error. A null `ids` counts as left out: `scope` applies, and without `scope` the command uses the selection, or the document while nothing is selected; a null `scope`, `groups`, `clipGroups` or `compoundPaths` is an error. `groups` ungroups groups, `clipGroups` ungroups clipping groups and makes layers stop clipping unless their clipping path or clipped artwork overlaps a locked artboard (released clipping paths stay as plain paths), and `compoundPaths` turns compound paths, and paths of several subpaths, into one path per subpath. Each is true by default, From 209df6ab02226fec79f3725037ae64d1d158926c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 15:18:14 -0800 Subject: [PATCH 11/29] Scripts: retracing and releasing refuse a tracing with added opacity mask art Retracing and releasing a tracing discard every object the trace did not make, and refuse when there is one. The check walked only the tracing's children, so the art of an opacity mask given to the tracing or to an object the trace made was discarded without the refusal. The check now also walks that mask art. The source image's own mask is left out, since both keep the image whole. The refusal came with #9077 (a1b8b013). --- crates/engine/src/script/dom/tracing.rs | 27 +++++--- crates/engine/src/tests/script_dom_tracing.rs | 63 +++++++++++++++++++ docs/mcp.md | 3 +- 3 files changed, 85 insertions(+), 8 deletions(-) diff --git a/crates/engine/src/script/dom/tracing.rs b/crates/engine/src/script/dom/tracing.rs index a37a062849..04fac60a66 100644 --- a/crates/engine/src/script/dom/tracing.rs +++ b/crates/engine/src/script/dom/tracing.rs @@ -199,15 +199,24 @@ pub(super) fn remember_source(h: &Host, uid: u64, group: &Node) { } h.dom.tracing.descendants.borrow_mut().entry((uid, group.id.0)).or_insert_with(|| { let mut ids = HashSet::new(); - group.walk(&mut |n| { - if n.id != group.id { - ids.insert(n.id); + // The source image is kept whole, so the art of its own opacity mask is not looked at. + let source = group.children().and_then(|c| c.first()).map(|n| n.id); + let mut todo: Vec<&Node> = members(group).collect(); + while let Some(n) = todo.pop() { + ids.insert(n.id); + if Some(n.id) != source { + todo.extend(members(n)); } - }); + } ids }); } +/// The objects `n` holds: its children and the art of its opacity mask. +fn members(n: &Node) -> impl Iterator { + n.children().into_iter().flatten().map(|c| &**c).chain(n.extras().mask.as_deref().map(|m| &*m.art)) +} + pub(super) fn same_source(h: &Host, uid: u64, original: NodeId, group: &Node) -> bool { let source = h.dom.tracing.sources.borrow().get(&(uid, original.0)).copied(); source.is_some_and(|source| group.children().and_then(|c| c.first()).is_some_and(|n| n.id == source)) @@ -321,7 +330,8 @@ fn replace(h: &Host, item: Item, id: &str, params: &Value, key: &str) -> Result< }) } -/// Throws `refusal` when the Image Trace object of `item` holds an object its trace did not make, +/// Throws `refusal` when the Image Trace object of `item` holds an object its trace did not make +/// (the art of an opacity mask on it or on one of its objects other than the source image included), /// and "Cannot edit page item" when it holds a locked object other than its source image, which /// the replacement would discard. The objects looked at are charged to the run either way. fn refuse_added(h: &Host, item: Item, refusal: &str) -> Result<(), HostError> { @@ -338,7 +348,8 @@ fn refuse_added(h: &Host, item: Item, refusal: &str) -> Result<(), HostError> { let source = group.children().and_then(|c| c.first()).map(|n| n.id); let mut visited = 0u64; let mut locked = None; - let mut todo: Vec<&Arc> = group.children().map(|c| c.iter().collect()).unwrap_or_default(); + // The tracing's own opacity mask goes with it too; the source image is kept whole. + let mut todo: Vec<&Node> = members(group).collect(); while let Some(n) = todo.pop() { visited += 1; let added = match (&made, ids) { @@ -353,7 +364,9 @@ fn refuse_added(h: &Host, item: Item, refusal: &str) -> Result<(), HostError> { if n.locked && Some(n.id) != source && locked.is_none() { locked = Some(n.id); } - todo.extend(n.children().into_iter().flatten()); + if Some(n.id) != source { + todo.extend(members(n)); + } } Ok((visited, locked.map_or(Ok(()), |id| Err(HostError::Error(format!("Cannot edit page item {}", id.0)))))) })?; diff --git a/crates/engine/src/tests/script_dom_tracing.rs b/crates/engine/src/tests/script_dom_tracing.rs index 24223785dd..e6e3f4dfa1 100644 --- a/crates/engine/src/tests/script_dom_tracing.rs +++ b/crates/engine/src/tests/script_dom_tracing.rs @@ -1253,6 +1253,69 @@ fn retrace_and_release_refuse_locked_traced_artwork() { let _ = std::fs::remove_dir_all(base); } +/// The art of an opacity mask given to the tracing or to an object the trace made is added artwork +/// too: retracing and releasing discard it, so both refuse, before the document changes. +#[test] +fn retrace_and_release_refuse_added_opacity_mask_art() { + let base = folder("mask-art"); + for on_group in [false, true] { + for (action, refusal) in [ + ("p.tracing.tracingOptions.threshold = 90;", "Cannot retrace a tracing containing added artwork"), + ("p.tracing.releaseTracing();", "Cannot release a tracing containing added artwork"), + ] { + let (mut s, image) = session(&base, false); + let r = s.execute("imageTrace.make", &json!({"id": image.0})).unwrap(); + let group = NodeId(r["id"].as_u64().unwrap()); + let made = s.active().unwrap().doc.node(group).unwrap().children().unwrap()[1].id; + let masked = if on_group { group } else { made }; + s.edit("Mask traced artwork", |d, _| { + let art = crate::doc::Node::group(d.alloc_id(), vec![]); + d.node_mut(masked).unwrap().extras_mut().mask = Some(Box::new(vectorcraft_doc::OpacityMask::new(art, true))); + Ok(()) + }) + .unwrap(); + let before = vectorcraft_format::save(&s.active().unwrap().doc, false); + let steps = undo_steps(&s); + let out = log( + &mut s, + &base, + &format!("var p = app.activeDocument.pageItems[0], m = ''; try {{ {action} }} catch (e) {{ m = e.message; }} vc.log(m);"), + ); + assert_eq!(out, [json!(refusal)], "{on_group} {action}"); + assert_eq!(vectorcraft_format::save(&s.active().unwrap().doc, false), before, "{on_group} {action}"); + assert_eq!(undo_steps(&s), steps, "{on_group} {action}"); + } + } + let _ = std::fs::remove_dir_all(base); +} + +/// The source image keeps its opacity mask through retracing and releasing, so its mask art is +/// not added artwork. +#[test] +fn retrace_and_release_take_a_source_image_with_an_opacity_mask() { + let base = folder("source-mask"); + for action in ["p.tracing.tracingOptions.threshold = 90;", "p.tracing.releaseTracing();"] { + let (mut s, image) = session(&base, false); + s.edit("Mask the image", |d, _| { + let art = crate::doc::Node::group(d.alloc_id(), vec![]); + d.node_mut(image).unwrap().extras_mut().mask = Some(Box::new(vectorcraft_doc::OpacityMask::new(art, true))); + Ok(()) + }) + .unwrap(); + let mask = s.active().unwrap().doc.node(image).unwrap().extras().mask.clone(); + s.execute("imageTrace.make", &json!({"id": image.0})).unwrap(); + assert_eq!(s.active().unwrap().doc.node(image).unwrap().extras().mask, mask, "imageTrace.make: {action}"); + let out = log( + &mut s, + &base, + &format!("var p = app.activeDocument.pageItems[0], m = ''; try {{ {action} }} catch (e) {{ m = e.message; }} vc.log(m);"), + ); + assert_eq!(out, [json!("")], "{action}"); + assert_eq!(s.active().unwrap().doc.node(image).unwrap().extras().mask, mask, "{action}"); + } + let _ = std::fs::remove_dir_all(base); +} + /// The `TracingOptions` and `TracingObject` members that are not implemented are left out of /// `hasOwnProperty` and `reflect`, and still throw when read. #[test] diff --git a/docs/mcp.md b/docs/mcp.md index e716a1a08e..4f76bea4f6 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -3365,7 +3365,8 @@ through `$`: `viewVector` does not trace again: it runs `imageTrace.setView`. The `PluginItem`, `TracingObject` and `TracingOptions` follow the new object, and a run traces again at most 10,000 times. Tracing again throws `Cannot retrace a tracing containing added artwork`, with nothing changed, when the tracing holds an object its trace - did not make, whether this run, an earlier run or a command added it, and `releaseTracing()` throws + did not make, whether this run, an earlier run or a command added it (the art of an opacity mask on the tracing or on an + object the trace made counts; the source image's own mask does not, since both keep the image whole), and `releaseTracing()` throws `Cannot release a tracing containing added artwork` in the same case. When no object was added, both throw `Cannot edit page item `, with nothing changed, when an object the trace made is locked. `imageTrace.make` records the objects it made in the tracing's `trace` settings as `made`, ranges of ids `[[first, last], ...]`, and a copy of the tracing records From fbe16e8143a4a05463521544eabf5b4ebddbecff Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 16:31:36 -0800 Subject: [PATCH 12/29] Scripts: retracing and releasing refuse any opacity mask on traced artwork The check for added artwork compared mask art by id. A mask made with Make Opacity Mask from two traced paths keeps the art's id, which the tracing records as made, and a tracing saved without that record took a mask it already held as part of its own objects. Retracing or releasing then discarded the mask without the refusal. An opacity mask on the tracing or on any object in it other than the source image now makes retracing and releasing refuse, whatever the ids of its art. The source image keeps its own mask as before. --- crates/engine/src/script/dom/tracing.rs | 30 ++++---- crates/engine/src/tests/script_dom_tracing.rs | 69 +++++++++++++++++++ docs/mcp.md | 8 ++- docs/target-app-parity.md | 2 +- 4 files changed, 92 insertions(+), 17 deletions(-) diff --git a/crates/engine/src/script/dom/tracing.rs b/crates/engine/src/script/dom/tracing.rs index 04fac60a66..e423ec8511 100644 --- a/crates/engine/src/script/dom/tracing.rs +++ b/crates/engine/src/script/dom/tracing.rs @@ -199,14 +199,12 @@ pub(super) fn remember_source(h: &Host, uid: u64, group: &Node) { } h.dom.tracing.descendants.borrow_mut().entry((uid, group.id.0)).or_insert_with(|| { let mut ids = HashSet::new(); - // The source image is kept whole, so the art of its own opacity mask is not looked at. - let source = group.children().and_then(|c| c.first()).map(|n| n.id); - let mut todo: Vec<&Node> = members(group).collect(); + // Only children are recorded: an opacity mask is refused whatever its art, so the art of + // one held now must not become an object the trace made if the mask is later undone. + let mut todo: Vec<&Node> = group.children().into_iter().flatten().map(|c| &**c).collect(); while let Some(n) = todo.pop() { ids.insert(n.id); - if Some(n.id) != source { - todo.extend(members(n)); - } + todo.extend(n.children().into_iter().flatten().map(|c| &**c)); } ids }); @@ -330,8 +328,8 @@ fn replace(h: &Host, item: Item, id: &str, params: &Value, key: &str) -> Result< }) } -/// Throws `refusal` when the Image Trace object of `item` holds an object its trace did not make -/// (the art of an opacity mask on it or on one of its objects other than the source image included), +/// Throws `refusal` when the Image Trace object of `item` holds an object its trace did not make, +/// or has an opacity mask on it or on one of its objects other than the source image, whatever its art, /// and "Cannot edit page item" when it holds a locked object other than its source image, which /// the replacement would discard. The objects looked at are charged to the run either way. fn refuse_added(h: &Host, item: Item, refusal: &str) -> Result<(), HostError> { @@ -348,15 +346,21 @@ fn refuse_added(h: &Host, item: Item, refusal: &str) -> Result<(), HostError> { let source = group.children().and_then(|c| c.first()).map(|n| n.id); let mut visited = 0u64; let mut locked = None; + // An opacity mask on the tracing or on an object other than the source image is added + // artwork whatever the ids of its art: a mask made from traced objects keeps their ids. + if group.extras().mask.is_some() { + return Ok((visited, Err(HostError::Error(refusal.into())))); + } // The tracing's own opacity mask goes with it too; the source image is kept whole. let mut todo: Vec<&Node> = members(group).collect(); while let Some(n) = todo.pop() { visited += 1; - let added = match (&made, ids) { - (Some(m), _) => !m.contains(n.id), - (None, Some(ids)) => !ids.contains(&n.id), - (None, None) => false, - }; + let added = (Some(n.id) != source && n.extras().mask.is_some()) + || match (&made, ids) { + (Some(m), _) => !m.contains(n.id), + (None, Some(ids)) => !ids.contains(&n.id), + (None, None) => false, + }; // Added artwork is reported before a locked object, whichever comes first. if added { return Ok((visited, Err(HostError::Error(refusal.into())))); diff --git a/crates/engine/src/tests/script_dom_tracing.rs b/crates/engine/src/tests/script_dom_tracing.rs index e6e3f4dfa1..0ab4469719 100644 --- a/crates/engine/src/tests/script_dom_tracing.rs +++ b/crates/engine/src/tests/script_dom_tracing.rs @@ -1289,6 +1289,75 @@ fn retrace_and_release_refuse_added_opacity_mask_art() { let _ = std::fs::remove_dir_all(base); } +/// An opacity mask made from two objects the trace made keeps the mask art's id, which the tracing +/// records as made, but retracing and releasing still discard it, so both refuse. +#[test] +fn retrace_and_release_refuse_an_opacity_mask_made_from_traced_paths() { + let base = folder("traced-mask"); + for (action, refusal) in [ + ("p.tracing.tracingOptions.threshold = 90;", "Cannot retrace a tracing containing added artwork"), + ("p.tracing.releaseTracing();", "Cannot release a tracing containing added artwork"), + ] { + let (mut s, image) = session(&base, false); + let r = s.execute("imageTrace.make", &json!({"id": image.0})).unwrap(); + let group = NodeId(r["id"].as_u64().unwrap()); + let kids: Vec = s.active().unwrap().doc.node(group).unwrap().children().unwrap().iter().map(|n| n.id).collect(); + assert!(kids.len() > 2, "{kids:?}"); + s.execute("select.set", &json!({"ids": [kids[1].0, kids[2].0]})).unwrap(); + s.execute("transparency.makeOpacityMask", &json!({})).unwrap(); + let g = s.active().unwrap().doc.node(group).unwrap(); + assert!(g.children().unwrap().iter().any(|n| n.extras().mask.is_some()), "a traced path holds the mask"); + let before = vectorcraft_format::save(&s.active().unwrap().doc, false); + let steps = undo_steps(&s); + let out = log( + &mut s, + &base, + &format!("var p = app.activeDocument.pageItems[0], m = ''; try {{ {action} }} catch (e) {{ m = e.message; }} vc.log(m);"), + ); + assert_eq!(out, [json!(refusal)], "{action}"); + assert_eq!(vectorcraft_format::save(&s.active().unwrap().doc, false), before, "{action}"); + assert_eq!(undo_steps(&s), steps, "{action}"); + } + let _ = std::fs::remove_dir_all(base); +} + +/// A tracing saved without the record of what its trace made is checked against what it held when +/// the run first saw it; an opacity mask it already held then still counts as added artwork. +#[test] +fn retrace_and_release_refuse_a_mask_on_a_tracing_without_its_record() { + let base = folder("unrecorded-mask"); + for (action, refusal) in [ + ("p.tracing.tracingOptions.threshold = 90;", "Cannot retrace a tracing containing added artwork"), + ("p.tracing.releaseTracing();", "Cannot release a tracing containing added artwork"), + ] { + let (mut s, image) = session(&base, false); + let r = s.execute("imageTrace.make", &json!({"id": image.0})).unwrap(); + let group = NodeId(r["id"].as_u64().unwrap()); + let made = s.active().unwrap().doc.node(group).unwrap().children().unwrap()[1].id; + s.edit("Mask traced artwork of an older tracing", |d, _| { + if let Some(t) = d.node_mut(group).unwrap().extras_mut().trace.as_deref_mut().and_then(Value::as_object_mut) { + t.remove(vectorcraft_doc::trace::TRACE_MADE); + } + let art = crate::doc::Node::group(d.alloc_id(), vec![]); + d.node_mut(made).unwrap().extras_mut().mask = Some(Box::new(vectorcraft_doc::OpacityMask::new(art, true))); + Ok(()) + }) + .unwrap(); + assert!(s.active().unwrap().doc.node(group).unwrap().trace_made().is_none()); + let before = vectorcraft_format::save(&s.active().unwrap().doc, false); + let steps = undo_steps(&s); + let out = log( + &mut s, + &base, + &format!("var p = app.activeDocument.pageItems[0], m = ''; try {{ {action} }} catch (e) {{ m = e.message; }} vc.log(m);"), + ); + assert_eq!(out, [json!(refusal)], "{action}"); + assert_eq!(vectorcraft_format::save(&s.active().unwrap().doc, false), before, "{action}"); + assert_eq!(undo_steps(&s), steps, "{action}"); + } + let _ = std::fs::remove_dir_all(base); +} + /// The source image keeps its opacity mask through retracing and releasing, so its mask art is /// not added artwork. #[test] diff --git a/docs/mcp.md b/docs/mcp.md index 4f76bea4f6..9deeedb43c 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -3365,12 +3365,14 @@ through `$`: `viewVector` does not trace again: it runs `imageTrace.setView`. The `PluginItem`, `TracingObject` and `TracingOptions` follow the new object, and a run traces again at most 10,000 times. Tracing again throws `Cannot retrace a tracing containing added artwork`, with nothing changed, when the tracing holds an object its trace - did not make, whether this run, an earlier run or a command added it (the art of an opacity mask on the tracing or on an - object the trace made counts; the source image's own mask does not, since both keep the image whole), and `releaseTracing()` throws + did not make, whether this run, an earlier run or a command added it (any opacity mask on the tracing or on an object + the trace made counts, whether or not the trace made its art; the source image's own mask does not, since both keep + the image whole), and `releaseTracing()` throws `Cannot release a tracing containing added artwork` in the same case. When no object was added, both throw `Cannot edit page item `, with nothing changed, when an object the trace made is locked. `imageTrace.make` records the objects it made in the tracing's `trace` settings as `made`, ranges of ids `[[first, last], ...]`, and a copy of the tracing records - their copies. A tracing saved without `made` is checked only for objects added in the same run. `threshold` takes a whole + their copies. A tracing saved without `made` is checked only for objects added in the same run, but an opacity + mask counts with or without `made`, even one it held before the run. `threshold` takes a whole number from 0 to 255, `maxColors` from 2 to 256 and `minArea` (the Noise setting, in pixels) from 0 to the largest image the tracer reads; `fills` and `strokes` cannot both be `false`; `palette` is `""` (automatic), `"Limited"`, `"Full Tone"` or `"Document Library"`; `viewRaster` and `viewVector` take only the pairs that match an Image Trace diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 144759bf00..b50a826dff 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1115,7 +1115,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - The control server writes each reply through a 64 KiB buffer. On Windows 11 it sends the 17 MB `document.inspect` reply of a document with 50,000 objects on one layer to a client over loopback in 0.09 s instead of 34 s. - Scripts: File › Scripts › Other Script… and `script.run` run a JavaScript file against the open documents as one transaction with one undo step for each changed document. A failed or stopped run puts every document back. `crates/engine/src/tests/script_run.rs`. - Scripts: `Document.placedItems` and `Document.rasterItems` list a document's linked and embedded images; `placedItems.add()` with a `File` assigned to `file` places an image linked, and `PlacedItem.relink(file)` and `embed()` relink and embed it, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PlacedItems/, https://ai-scripting.docsforadobe.dev/jsobjref/PlacedItem/, https://ai-scripting.docsforadobe.dev/jsobjref/RasterItems/ and https://ai-scripting.docsforadobe.dev/jsobjref/RasterItem/ describe them. A raster item's bits per channel, channels, color space and transparency come from its encoded pixels' header. Only files the script may read, of at most 256 MiB and holding an image, are placed or relinked. Rasterizing and capturing are not there yet. `crates/engine/src/tests/script_dom_images.rs`. - - Scripts: `PlacedItem.trace()` and `RasterItem.trace()` make an Image Trace object and return it as a `PluginItem` whose `tracing` gives its path, anchor and color counts, the source image's resolution, `expandTracing()`, `releaseTracing()` and its `TracingOptions`; assigning an option or loading a preset traces it again, except that the view options (`viewRaster` and `viewVector`) only change the view, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PluginItem/, https://ai-scripting.docsforadobe.dev/jsobjref/TracingObject/ and https://ai-scripting.docsforadobe.dev/jsobjref/TracingOptions/ describe them. Option values are checked for type and range before any trace, a script cannot save a preset, and the options without a VectorCraft setting throw. The source image of a traced item is left out of `pageItems`, `placedItems` and `rasterItems`; a script reaches it through `PluginItem.tracing.sourceArt`. Renaming an ordinary group that holds an image first to `Image Trace`, or moving or duplicating an image to the bottom of an ordinary group with that name, throws an error. `crates/engine/src/tests/script_dom_tracing.rs`. + - Scripts: `PlacedItem.trace()` and `RasterItem.trace()` make an Image Trace object and return it as a `PluginItem` whose `tracing` gives its path, anchor and color counts, the source image's resolution, `expandTracing()`, `releaseTracing()` and its `TracingOptions`; assigning an option or loading a preset traces it again, except that the view options (`viewRaster` and `viewVector`) only change the view, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PluginItem/, https://ai-scripting.docsforadobe.dev/jsobjref/TracingObject/ and https://ai-scripting.docsforadobe.dev/jsobjref/TracingOptions/ describe them. Option values are checked for type and range before any trace, a script cannot save a preset, and the options without a VectorCraft setting throw. Tracing again and `releaseTracing()` throw, with nothing changed, when the tracing holds added artwork, an opacity mask on the tracing or on an object the trace made included; the source image keeps its own mask. The source image of a traced item is left out of `pageItems`, `placedItems` and `rasterItems`; a script reaches it through `PluginItem.tracing.sourceArt`. Renaming an ordinary group that holds an image first to `Image Trace`, or moving or duplicating an image to the bottom of an ordinary group with that name, throws an error. `crates/engine/src/tests/script_dom_tracing.rs`. - Scripts: `Document.pathItems` lists the paths and makes rectangles, rounded rectangles, ellipses, polygons, stars and empty paths with the defaults the help page https://ai-scripting.docsforadobe.dev/jsobjref/PathItems/ gives; each path's points, closed state, fill rule, area, length, guide state, selected points, fill and stroke colors, stroke options and transforms read and change as https://ai-scripting.docsforadobe.dev/jsobjref/PathItem/, https://ai-scripting.docsforadobe.dev/jsobjref/PathPoints/ and https://ai-scripting.docsforadobe.dev/jsobjref/PathPoint/ describe them, and `RGBColor`, `CMYKColor`, `GrayColor`, `LabColor` and `NoColor` make colors (`docs/mcp.md`). `pathItems["name"]` reads a path by name as `pageItems` does, and `removeAll()` deletes nothing and throws when any path is on a locked artboard. The transforms move gradients with the art: `changeFillGradients` false throws an error, as do `changeFillPatterns` and `changeStrokePattern` given as different values, and `transform` is not there yet (`docs/mcp.md` lists these limits). Gradient stops are not there yet. A `PathPoint` of a path in an Objects on Path group goes stale when an edit of another path in the group moves it. `crates/engine/src/tests/script_dom_paths.rs`. - Scripts: a document's `default*` members (https://ai-scripting.docsforadobe.dev/jsobjref/Document/) read and set the fill, stroke and stroke options of the next object drawn through `appearance.setNewArt`, leaving the selection and its art as they were, and `scaleFactor` reads 1 (`docs/mcp.md`). `crates/engine/src/tests/script_dom_defaults.rs`. - Scripts: `app.undo()` and `app.redo()` undo and redo the edits the run made, and each document open before and after the run that it changed gets one undo step. `crates/engine/src/tests/script_dom.rs`. From a70c687ee0b5029fe1f9acdd7d6ce70682f2bee7 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 17:58:23 -0800 Subject: [PATCH 13/29] Docs: a tracing saved without `made` is checked only for artwork added in the run The Scripts line for Image Trace now says that retracing or releasing a tracing saved without `made` can discard artwork added before the run, and that the opacity mask check applies with or without `made`. --- docs/target-app-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b117989989..3279b91ff8 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1118,7 +1118,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Scripts: `app.preferences` reads, stores and removes values by key with the type they were set as, keeps them across runs and restarts, and turns the warning before a picked script on with the key `ShowExternalJSXWarning`, and off only after the person answers Yes to a confirm (https://ai-scripting.docsforadobe.dev/jsobjref/Preferences/; the confirm is VectorCraft's own rule); `app` makes, joins, inverts and compares `Matrix` records (https://ai-scripting.docsforadobe.dev/jsobjref/Matrix/), rounding each joined value once from its exact sum of products, and runs Copy, Cut and Paste on the active document inside the run's transaction (https://ai-scripting.docsforadobe.dev/jsobjref/Application/). `crates/engine/src/tests/script_dom_prefs.rs`. - Scripts: `Document.pathItems` lists the paths and makes rectangles, rounded rectangles, ellipses, polygons, stars and empty paths with the defaults the help page https://ai-scripting.docsforadobe.dev/jsobjref/PathItems/ gives; each path's points, closed state, fill rule, area, length, guide state, selected points, fill and stroke colors, stroke options and transforms read and change as https://ai-scripting.docsforadobe.dev/jsobjref/PathItem/, https://ai-scripting.docsforadobe.dev/jsobjref/PathPoints/ and https://ai-scripting.docsforadobe.dev/jsobjref/PathPoint/ describe them, and `RGBColor`, `CMYKColor`, `GrayColor`, `LabColor` and `NoColor` make colors (`docs/mcp.md`). `pathItems["name"]` reads a path by name as `pageItems` does, and `removeAll()` deletes nothing and throws when any path is on a locked artboard. A path takes the page item transforms, and `resize` also sets its stroke weight to a `changeLineWidths` percent from 0 to 100000 (at most 1000 points; a member of a compound sets the compound's stroke); gradients move with positions, so a `changeFillGradients` different from `changePositions` throws an error, as do `changeFillPatterns` and `changeStrokePattern` given as different values (`docs/mcp.md` lists these limits). Gradient stops are not there yet. A `PathPoint` of a path in an Objects on Path group goes stale when an edit of another path in the group moves it. `crates/engine/src/tests/script_dom_paths.rs`. - Scripts: `Document.placedItems` and `Document.rasterItems` list a document's linked and embedded images; `placedItems.add()` with a `File` assigned to `file` places an image linked, and `PlacedItem.relink(file)` and `embed()` relink and embed it, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PlacedItems/, https://ai-scripting.docsforadobe.dev/jsobjref/PlacedItem/, https://ai-scripting.docsforadobe.dev/jsobjref/RasterItems/ and https://ai-scripting.docsforadobe.dev/jsobjref/RasterItem/ describe them. A raster item's bits per channel, channels, color space and transparency come from its encoded pixels' header. Only files the script may read, of at most 256 MiB and holding an image, are placed or relinked. Rasterizing and capturing are not there yet. `crates/engine/src/tests/script_dom_images.rs`. - - Scripts: `PlacedItem.trace()` and `RasterItem.trace()` make an Image Trace object and return it as a `PluginItem` whose `tracing` gives its path, anchor and color counts, the source image's resolution, `expandTracing()`, `releaseTracing()` and its `TracingOptions`; assigning an option or loading a preset traces it again, except that the view options (`viewRaster` and `viewVector`) only change the view, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PluginItem/, https://ai-scripting.docsforadobe.dev/jsobjref/TracingObject/ and https://ai-scripting.docsforadobe.dev/jsobjref/TracingOptions/ describe them. Option values are checked for type and range before any trace, a script cannot save a preset, and the options without a VectorCraft setting throw. Tracing again and `releaseTracing()` throw, with nothing changed, when the tracing holds added artwork, an opacity mask on the tracing or on an object the trace made included; the source image keeps its own mask. The source image of a traced item is left out of `pageItems`, `placedItems` and `rasterItems`; a script reaches it through `PluginItem.tracing.sourceArt`. Renaming an ordinary group that holds an image first to `Image Trace`, or moving or duplicating an image to the bottom of an ordinary group with that name, throws an error. `crates/engine/src/tests/script_dom_tracing.rs`. + - Scripts: `PlacedItem.trace()` and `RasterItem.trace()` make an Image Trace object and return it as a `PluginItem` whose `tracing` gives its path, anchor and color counts, the source image's resolution, `expandTracing()`, `releaseTracing()` and its `TracingOptions`; assigning an option or loading a preset traces it again, except that the view options (`viewRaster` and `viewVector`) only change the view, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PluginItem/, https://ai-scripting.docsforadobe.dev/jsobjref/TracingObject/ and https://ai-scripting.docsforadobe.dev/jsobjref/TracingOptions/ describe them. Option values are checked for type and range before any trace, a script cannot save a preset, and the options without a VectorCraft setting throw. Tracing again and `releaseTracing()` throw, with nothing changed, when the tracing holds added artwork, an opacity mask on the tracing or on an object the trace made included; the source image keeps its own mask. A tracing saved without `made` is checked only for artwork added during the same run, so tracing it again or releasing it discards artwork that was added before the run without an error, and the opacity mask check applies with or without `made`. The source image of a traced item is left out of `pageItems`, `placedItems` and `rasterItems`; a script reaches it through `PluginItem.tracing.sourceArt`. Renaming an ordinary group that holds an image first to `Image Trace`, or moving or duplicating an image to the bottom of an ordinary group with that name, throws an error. `crates/engine/src/tests/script_dom_tracing.rs`. - Scripts: a document's `default*` members (https://ai-scripting.docsforadobe.dev/jsobjref/Document/) read and set the fill, stroke and stroke options of the next object drawn through `appearance.setNewArt`, leaving the selection and its art as they were, and `scaleFactor` reads 1 (`docs/mcp.md`). `crates/engine/src/tests/script_dom_defaults.rs`. - Scripts: `app.undo()` and `app.redo()` undo and redo the edits the run made, and each document open before and after the run that it changed gets one undo step. `crates/engine/src/tests/script_dom.rs`. - Scripts: `document.textFrames` makes point type, area type and type on a path, and each text frame gives its kind, its contents, its text as text ranges with their characters, words and paragraphs (which can add text), their character attributes (size, leading, tracking, baseline shift, scales, rotation, underline, strikethrough, font) and paragraph attributes (alignment, indents, space before and after), outlines and point and area conversion; `app.textFonts` lists the fonts, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/TextFrameItems/, https://ai-scripting.docsforadobe.dev/jsobjref/TextFrameItem/, https://ai-scripting.docsforadobe.dev/jsobjref/TextRange/ and https://ai-scripting.docsforadobe.dev/jsobjref/TextFonts/ describe them (`docs/mcp.md`). Offsets count UTF-16 units, VectorCraft's own rule. Lines, tab stops and colors are not there yet. `crates/engine/src/tests/script_text.rs`. From cbec2281fed034e6199e622ee4ac13d618ceecf9 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 21:19:12 -0800 Subject: [PATCH 14/29] Blend: an unfinished Steps or Distance value stays with the blend it was typed for The Blend panel's Steps and Distance fields kept a typed but unfinished value when another blend or object was selected. If the new selection had the same spacing, the field went on showing the old text, and the next Enter applied it to the new selection: "3+" typed for one blend, then "1" and Enter after selecting another, gave the second blend 4 steps. Both fields now name what they edit (the document, its revert count, the selected objects and the selected symbol part) with NumberField::edit_target, so a change of selection drops the unfinished value and the field shows the new blend's spacing. --- crates/ui-egui/src/panels/blend.rs | 24 +++++++++++++-- crates/ui-egui/src/panels/tests_blend.rs | 38 ++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/panels/blend.rs b/crates/ui-egui/src/panels/blend.rs index 21bcf2ebcf..1b525a3df4 100644 --- a/crates/ui-egui/src/panels/blend.rs +++ b/crates/ui-egui/src/panels/blend.rs @@ -22,8 +22,8 @@ use craft::ui::pickers::Select; use craft::ui::text::NumberField; use egui::Ui; use serde_json::{Value, json}; -use vectorcraft_doc::NodeKind; use vectorcraft_doc::live::BlendSpineMode; +use vectorcraft_doc::{NodeId, NodeKind}; use super::selection_len; use crate::VectorcraftApp; @@ -102,10 +102,23 @@ fn percent_slider( }); } +/// What the Steps and Distance fields edit, as their edit target: the document, how many times File › Revert replaced +/// its content, the selected objects (or the object targeted in the Layers panel) and the selected symbol part. A +/// field drops an unfinished value when this changes, even where the new blend has the same spacing. +type EditTarget = Option<(u64, u64, Vec, Option<(NodeId, Vec)>)>; + +/// The [`EditTarget`] of the active document. +fn edit_target(app: &VectorcraftApp) -> EditTarget { + let st = app.session.active()?; + let part = st.selection.symbol_part.as_ref().map(|p| (p.instance, p.path.clone())); + Some((st.uid, st.reverts, st.selection.subjects().to_vec(), part)) +} + /// Spacing and Orientation, as `object.blend.info` reports them; a change runs /// `object.blend.options`. fn settings(app: &mut VectorcraftApp, ui: &mut Ui) { let info = app.session.execute("object.blend.info", &json!({})).unwrap_or_default(); + let target = edit_target(app); let mode = info["spacing"].as_str().unwrap_or("smooth"); let steps = info["steps"].as_f64().unwrap_or(5.0); let distance = info["distance"].as_f64().unwrap_or(10.0); @@ -119,7 +132,7 @@ fn settings(app: &mut VectorcraftApp, ui: &mut Ui) { }); if mode == "distance" { Field::new(tl!("Distance:")).show(ui, |ui, _| { - let out = NumberField::length(tl!("Distance:"), Bind::given(Some(distance)), general_lengths(app)).show(ui); + let out = NumberField::length(tl!("Distance:"), Bind::given(Some(distance)), general_lengths(app)).edit_target(&target).show(ui); if let Some(d) = out.events.committed().copied().flatten() { change = Some(spacing_params("distance", steps, d)); } @@ -128,7 +141,12 @@ fn settings(app: &mut VectorcraftApp, ui: &mut Ui) { // Smooth Color picks the count itself: the field shows the steps, disabled. let on = mode == "steps"; Field::new(tl!("Steps:")).enabled(on).show(ui, |ui, _| { - let out = NumberField::new(tl!("Steps:"), Bind::given(Some(steps))).range(1.0..=1000.0).commit_decimals(0).enabled(on).show(ui); + let out = NumberField::new(tl!("Steps:"), Bind::given(Some(steps))) + .range(1.0..=1000.0) + .commit_decimals(0) + .enabled(on) + .edit_target(&target) + .show(ui); if let Some(n) = out.events.committed().copied().flatten() { change = Some(spacing_params("steps", n, distance)); } diff --git a/crates/ui-egui/src/panels/tests_blend.rs b/crates/ui-egui/src/panels/tests_blend.rs index 1653488b5a..0212ddf931 100644 --- a/crates/ui-egui/src/panels/tests_blend.rs +++ b/crates/ui-egui/src/panels/tests_blend.rs @@ -257,3 +257,41 @@ fn ramp_and_reverse_spine_are_dimmed_while_a_selected_key_belongs_to_a_blend_wit p.frame(); assert!(!p.enabled("Ramp:") && !p.enabled("Reverse Spine")); } + +#[test] +fn an_unfinished_steps_or_distance_value_does_not_reach_another_blend() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + // Two blends with the same spacing; typing starts on `a`, and `b` is selected before the value is finished. + let (mut app, a, b) = two_blends(json!({"smooth": true})); + app.run("object.blend.options", json!({"spacing": "steps", "steps": 5})).unwrap(); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + let mut p = Panel::new(app, show); + let spacings = |p: &Panel| { + let app = p.app(); + (spec(&app, a).spacing, spec(&app, b).spacing) + }; + let unfinished = |p: &mut Panel, name: &str| { + p.click_role(name, Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("3+"); + }; + unfinished(&mut p, "Steps:"); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.frame(); + assert_eq!(p.value_role("Steps:", Role::SPIN_BUTTON).as_deref(), Some("5"), "the field shows the other blend's steps"); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + assert_eq!(spacings(&p), (BlendSpacing::Steps(5), BlendSpacing::Steps(1)), "b takes 1 step, not 3+1"); + + p.app().run("select.set", json!({"ids": [a.0, b.0]})).unwrap(); + p.app().run("object.blend.options", json!({"spacing": "distance", "distance": 10})).unwrap(); + p.app().run("select.set", json!({"ids": [a.0]})).unwrap(); + p.frame(); + unfinished(&mut p, "Distance:"); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.frame(); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + assert_eq!(spacings(&p), (BlendSpacing::Distance(10.0), BlendSpacing::Distance(1.0)), "b takes 1 pt, not 3+1"); +} From c729f30db4e79be4d4f8bc8eec0b103b79642f52 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 23:03:52 -0800 Subject: [PATCH 15/29] Blend: an unfinished Ramp or Shift value stays with the blend it was typed for The Blend panel's Ramp and Shift fields kept a typed but unfinished value when another blend was selected, as Steps and Distance did: "3+" typed in Shift for one blend, then "1" and Enter after selecting another blend with the same Shift, gave the second blend 4%. Ramp and Shift now pass the same edit target as Steps and Distance to SliderField::edit_target, so a change of selection or document drops the unfinished value. The craft-libs pin moves to 40b2b1e56e, which adds SliderField::edit_target on top of the commit pinned before. New tests cover Ramp and Shift, a switch to another document whose blend has the same id and steps, and an unchanged selection, which keeps the value typed so far. --- Cargo.lock | 172 +++++++++++------------ Cargo.toml | 76 +++++----- apps/vectorcraft-web/Cargo.toml | 2 +- crates/ui-egui/src/panels/blend.rs | 17 ++- crates/ui-egui/src/panels/tests_blend.rs | 71 ++++++++++ xtask/src/pdf_deps.rs | 2 +- 6 files changed, 209 insertions(+), 131 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d0216e2962..0a20eec3e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-automation", "craft-behavior", @@ -1272,7 +1272,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "crc32fast", "flate2", @@ -1283,7 +1283,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "rustix 1.1.6", ] @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1346,7 +1346,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-docpath", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "crc32fast", "flate2", @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "egui", ] @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "md-5", "rayon", @@ -1390,12 +1390,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-cms", @@ -1415,7 +1415,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1436,7 +1436,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "rayon", ] @@ -1444,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "blake3", "craft-ecproj-format", @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "serde", ] @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-codepage", "encoding_rs", @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "serde", "serde_json", @@ -1535,12 +1535,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1583,7 +1583,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "cap-primitives", "craft-atomic", @@ -1606,12 +1606,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "gif", ] @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "flate2", ] @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-dds", "craft-jpeg", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1715,7 +1715,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "thiserror 2.0.21", ] @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-host", "craft-i18n", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-i18n", @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-host", @@ -1781,7 +1781,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "encoding_rs", "image", @@ -1804,7 +1804,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "chrono", "craft-codepage", @@ -1814,7 +1814,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "uds_windows", "winsafe", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-keymap", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "flate2", "serde", @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "async-channel", "async-io", @@ -1895,7 +1895,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1904,7 +1904,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-host", @@ -1928,7 +1928,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1939,7 +1939,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-eps", "flate2", @@ -1953,7 +1953,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "encoding_rs", "flate2", @@ -1964,7 +1964,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "dispatch2", "egui", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1996,7 +1996,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-atomic", "craft-host", @@ -2013,7 +2013,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "fax", "hayro-ccitt", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-keymap", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2082,7 +2082,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2097,7 +2097,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-atomic", "craft-behavior", @@ -2112,7 +2112,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "serde", "thiserror 2.0.21", @@ -2122,7 +2122,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "serde", "thiserror 2.0.21", @@ -2131,7 +2131,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-keymap", @@ -2146,12 +2146,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2165,7 +2165,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2182,7 +2182,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "accesskit", "craft-behavior", @@ -2220,7 +2220,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2231,7 +2231,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-host", @@ -2249,7 +2249,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-host", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-host", @@ -2291,7 +2291,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-behavior", "craft-host", @@ -2310,7 +2310,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "base64 0.22.1", "chrono", @@ -2342,7 +2342,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "flate2", "serde", @@ -2353,7 +2353,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2363,7 +2363,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "js-sys", "serde_json", @@ -2374,7 +2374,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "winsafe", ] @@ -2382,7 +2382,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "craft-appkit", "craft-atomic", @@ -2414,7 +2414,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3773,7 +3773,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3782,7 +3782,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3800,7 +3800,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3818,12 +3818,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "flate2", "hayro-ccitt", @@ -4806,7 +4806,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4963,7 +4963,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" +source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 843f9cbb53..0155bc6ce3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,51 +10,51 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -194,13 +194,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } emath = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } epaint = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 70aae32f73..0c5a87c101 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/ui-egui/src/panels/blend.rs b/crates/ui-egui/src/panels/blend.rs index 1b525a3df4..98edf970b4 100644 --- a/crates/ui-egui/src/panels/blend.rs +++ b/crates/ui-egui/src/panels/blend.rs @@ -82,7 +82,8 @@ fn spacing_params(mode: &str, steps: f64, distance: f64) -> Value { /// The Ramp or Shift slider: `key` of `object.blend.options` as a percentage over `range`. A drag /// previews the selected blends and its release records one undo step; a change without a drag, -/// from the keyboard, records one at once. +/// from the keyboard, records one at once. A value typed into its field and not yet committed is +/// dropped when the [`EditTarget`] changes. fn percent_slider( app: &mut VectorcraftApp, ui: &mut Ui, @@ -92,19 +93,25 @@ fn percent_slider( range: RangeInclusive, on: bool, ) { + let target = edit_target(app); Field::new(label).enabled(on).show(ui, |ui, _| { let shown = value.unwrap_or(0.0).clamp(*range.start(), *range.end()); - let out = - SliderField::new(label, Bind::given(shown), range.clone()).layout(SliderFieldLayout::Inline).unit("%").step(1.0).enabled(on).show(ui); + let out = SliderField::new(label, Bind::given(shown), range.clone()) + .layout(SliderFieldLayout::Inline) + .unit("%") + .step(1.0) + .enabled(on) + .edit_target(&target) + .show(ui); apply_edits(app, &out.edit, EditPath::Preview, |app, v, phase| { crate::panels::live_run(app, "Blend Options", "object.blend.options", json!({ key: *v }), phase); }); }); } -/// What the Steps and Distance fields edit, as their edit target: the document, how many times File › Revert replaced +/// What the Steps, Distance, Ramp and Shift fields edit, as their edit target: the document, how many times File › Revert replaced /// its content, the selected objects (or the object targeted in the Layers panel) and the selected symbol part. A -/// field drops an unfinished value when this changes, even where the new blend has the same spacing. +/// field drops an unfinished value when this changes, even where the new blend has the same value. type EditTarget = Option<(u64, u64, Vec, Option<(NodeId, Vec)>)>; /// The [`EditTarget`] of the active document. diff --git a/crates/ui-egui/src/panels/tests_blend.rs b/crates/ui-egui/src/panels/tests_blend.rs index 0212ddf931..a871dcc119 100644 --- a/crates/ui-egui/src/panels/tests_blend.rs +++ b/crates/ui-egui/src/panels/tests_blend.rs @@ -295,3 +295,74 @@ fn an_unfinished_steps_or_distance_value_does_not_reach_another_blend() { p.key(Key::Enter, Modifiers::NONE); assert_eq!(spacings(&p), (BlendSpacing::Distance(10.0), BlendSpacing::Distance(1.0)), "b takes 1 pt, not 3+1"); } + +#[test] +fn an_unfinished_ramp_or_shift_value_does_not_reach_another_blend() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + // Two blends with a spine and the same Ramp and Shift; typing starts on `a`, and `b` is selected before the value + // is finished. + let (mut app, a, b) = two_blends(json!({"smooth": true, "orientation": "path"})); + app.run("object.blend.options", json!({"ramp": 30, "colorShift": 30})).unwrap(); + let mut p = Panel::new(app, show); + for name in ["Ramp:", "Shift:"] { + let value = |s: &BlendSpec| if name == "Ramp:" { s.ease.ramp * 100.0 } else { s.color_shift }; + p.app().run("select.set", json!({"ids": [a.0]})).unwrap(); + p.frame(); + p.click_role(name, Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("3+"); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.frame(); + assert_ne!(p.value_role(name, Role::SPIN_BUTTON).as_deref(), Some("3+"), "{name} drops the value typed for a"); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let (at_a, at_b) = { + let app = p.app(); + (value(&spec(&app, a)), value(&spec(&app, b))) + }; + assert!((at_a - 30.0).abs() < 1e-9 && (at_b - 1.0).abs() < 1e-9, "{name}: a keeps 30, b takes 1, not 3+1: {at_a} {at_b}"); + } +} + +#[test] +fn an_unfinished_steps_value_stays_with_its_blend_and_document() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + // The same document built twice: the second document's blend has the same id and the same steps as the first's. + let (mut app, id) = blended(); + app.run("object.blend.options", json!({"spacing": "steps", "steps": 5})).unwrap(); + app.run("file.new", json!({"width": 300, "height": 300})).unwrap(); + app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 20, "height": 20})).unwrap(); + app.run("shape.rectangle", json!({"x": 200, "y": 0, "width": 20, "height": 20})).unwrap(); + app.run("select.all", json!({})).unwrap(); + let other = NodeId(app.run("object.blend.make", json!({"spacing": "steps", "steps": 5})).unwrap()["id"].as_u64().unwrap()); + assert_eq!(other, id, "both documents' blends have the same id"); + app.run("document.activate", json!({"index": 0})).unwrap(); + let mut p = Panel::new(app, show); + let steps = |p: &mut Panel, index: u64| { + p.app().run("document.activate", json!({"index": index})).unwrap(); + spec(&p.app(), id).spacing + }; + let unfinished = |p: &mut Panel| { + p.click_role("Steps:", Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("3+"); + }; + + // With the selection and the document unchanged, the value typed so far is kept: 3+1 gives 4. + unfinished(&mut p); + p.frame(); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + assert_eq!(spec(&p.app(), id).spacing, BlendSpacing::Steps(4), "an unchanged target keeps the typed value"); + p.app().run("object.blend.options", json!({"spacing": "steps", "steps": 5})).unwrap(); + + // Another document with the same selection drops it. + unfinished(&mut p); + p.app().run("document.activate", json!({"index": 1})).unwrap(); + p.frame(); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + assert_eq!((steps(&mut p, 0), steps(&mut p, 1)), (BlendSpacing::Steps(5), BlendSpacing::Steps(1)), "the other document takes 1 step"); +} diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 542a3e8c41..113b654436 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6"; +const REV: &str = "40b2b1e56ef5f02a313877976290617cb6da8576"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From fe3305b9dc6e7deaeacab878fbf16afbf47b0c4c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 3 Dec 2026 02:05:33 -0800 Subject: [PATCH 16/29] Dialogs: a control confirm of a held OK replies with the app's answer A dialog that holds its OK files the answer for the app, which accepts or refuses it in the next dialog pump. `ui.dialog.confirm` and `ui.dialog.set` with `action: "confirm"` replied `{"ok": true}` as soon as the answer was filed, so a client could not tell that the app refused it (a color adjustment confirmed while another document is active) and the dialog stayed open. `ui.dialog.set` with an `action` also replied with the reply to the confirm or cancel alone. The MCP `answer_dialog` tool reads a reply without a `dialog` key as an app that did not answer the dialog, and sends another `ui.dialog.confirm` or `ui.dialog.cancel`: after an accepted OK that call failed with "no hosted dialog is open" or answered the dialog under it. - Both confirm paths answer with `dialog_reply`, and the app holds the reply of a confirm that waits on the dialog's held OK until the app answers that opening of the dialog. - A set with an `action` replies `{dialog, result}`: the dialog as the set left it, and the reply to its confirm or cancel, also once a held OK is answered. This covers the hosted dialogs, Preferences and ScriptUI dialogs; the Simplify and Smooth sliders already replied this way. - A held reply shows the paths outside the read root that the request sent by their file names, as a reply sent at once shows them. - The app polls the held replies right after the dialog pump, before the next pass closes an accepted dialog, and after the control requests. - While a confirm waits on a held OK, the control logic asks for a pass (a paint while the window is hidden), so a minimized window answers too. A dialog whose OK waits with no confirm on it, such as Print during its printer lookup, does not keep the window drawing. - docs/control-protocol.md describes the held reply and its errors. --- crates/ui-egui/src/app.rs | 5 + crates/ui-egui/src/app/control.rs | 49 +++++++- crates/ui-egui/src/control.rs | 120 ++++++++++++++++---- crates/ui-egui/src/control/tests.rs | 96 ++++++++++++++++ crates/ui-egui/src/dialogs/hyphenation.rs | 10 +- crates/ui-egui/src/dialogs/script_window.rs | 20 +++- crates/ui-egui/src/dialogs/tests_print.rs | 8 +- crates/ui-egui/src/lib.rs | 5 + crates/ui-egui/src/testing.rs | 24 ++++ crates/ui-egui/src/tests/automation.rs | 27 +++++ crates/ui-egui/src/tests/script_window.rs | 3 + crates/ui-egui/src/tests/synthetic.rs | 10 +- docs/control-protocol.md | 2 +- 13 files changed, 336 insertions(+), 43 deletions(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 571a355846..095eab171a 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -209,6 +209,8 @@ impl VectorcraftApp { run_count: 0, channel: None, deferred_control: None, + held_set: None, + held_confirms: Vec::new(), control_rotate_press: None, pointer_waits: Vec::new(), context: 0, @@ -802,6 +804,9 @@ impl VectorcraftApp { panel_docking::close_overlays_for_modal(self, &ctx); let drawn_document = self.session.active().map(|st| (st.uid, st.revision)); dialogs::host::pump(self, &ctx); + // The pump answered the held OKs it could: the confirms waiting on them reply before the next pass's shell + // closes an accepted dialog. + self.poll_held(); // The canvas has already painted. A dialog can apply or roll back its preview // on the final input frame, with no further mouse movement to wake the window. if self.session.active().map(|st| (st.uid, st.revision)) != drawn_document { diff --git a/crates/ui-egui/src/app/control.rs b/crates/ui-egui/src/app/control.rs index 2389373b4c..db564b4c34 100644 --- a/crates/ui-egui/src/app/control.rs +++ b/crates/ui-egui/src/app/control.rs @@ -80,14 +80,15 @@ impl VectorcraftApp { }; let document = self.document_identity(); let now = self.instant(); - if let Some(channel) = self.channel.as_mut() { - channel.settle_at(req, reply, document, settle, now); - } + self.settle_control(req, reply, document, settle, now); } + // A request above may have closed a dialog whose held OK a confirm waits on. + self.poll_held(); // A capture is issued only after passes settle it, and an idle window runs none; a hidden // one runs only this logic unless asked to paint. Its readback finishes only in a later frame, - // so frames keep coming until it is answered, as production's did. - if self.channel.as_ref().is_some_and(|channel| channel.captures.any_pending()) { + // so frames keep coming until it is answered, as production's did. The app answers a held OK + // only in a pass that pumps the dialogs, so frames also keep coming while a confirm waits on one. + if self.channel.as_ref().is_some_and(|channel| channel.captures.any_pending()) || !self.held_confirms.is_empty() { if self.viewport_hidden(ctx) { host.paint_while_hidden(); } @@ -118,6 +119,44 @@ impl VectorcraftApp { } } + /// Hands the reply to `req` to the control channel ([`ControlChannel::settle_at`]). The app holds the reply of a + /// confirm that waits for its answer to a dialog's held OK ([`craft::automation::Reply::AfterHeldOk`], + /// [`control::HeldConfirm`]), and [`Self::poll_held`] sends it. + pub(crate) fn settle_control( + &mut self, + mut req: craft::automation::ControlRequest, + reply: craft::automation::Reply, + document: Option, + settle: f64, + now: craft::ui::runtime::motion::Instant, + ) { + let held_set = self.held_set.take(); + let Some(channel) = self.channel.as_mut() else { return }; + if matches!(reply, craft::automation::Reply::AfterHeldOk { .. }) { + self.held_confirms.push(control::HeldConfirm::hold(&mut req, held_set)); + } + channel.settle_at(req, reply, document, settle, now); + } + + /// Answers the `ui.dialog.confirm` replies held on a dialog's OK ([`craft::automation::Reply::AfterHeldOk`]) once + /// the app accepted or refused it, or the dialog closed, each as its request's reply shows it + /// ([`control::HeldConfirm::forward`]). Called after the dialog pump of a pass, before the next pass's shell + /// closes a dialog the app accepted, and after the control requests. + pub(crate) fn poll_held(&mut self) { + if let Some(dialogs) = self.dialogs() + && let Some(channel) = self.channel.as_mut() + { + dialogs.with(|host| channel.poll_held(host)); + } + if self.held_confirms.is_empty() { + return; + } + let hiding = control::deferred_hiding(self); + let roots = self.automation_roots.clone(); + let held = &mut self.held_confirms; + file_access::confine(roots.as_ref(), || held.retain(|confirm| confirm.forward(&hiding))); + } + /// Answers the `ui.pointer` replies held on the tool's edit ([`control::PointerWait`]). The canvas /// checks on the tool each pass it is drawn; this checks too, for passes without it. fn answer_pointer_waits(&mut self, ctx: &egui::Context) { diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index bfe9f1991c..5e46bdeeda 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -18,8 +18,11 @@ //! - `ui.find`: the controls of the window's access tree that match a name or role //! - `ui.set {brightness?, panel?, dockTab?, rulers?, outline?, …}` //! - `ui.dialog.set` / `ui.dialog.confirm` / `ui.dialog.cancel`: answered by -//! `craft::automation::dialogs::dialog_method` for the dialog asked for (`dialog`, default `"top"`), and by -//! `dialogs::simplify_slider::dialog_method` for the Simplify and Smooth sliders +//! `craft::automation::dialogs::dialog_reply` for the dialog asked for (`dialog`, default `"top"`), and by +//! `dialogs::simplify_slider::dialog_method` for the Simplify and Smooth sliders. A set with an `action` replies +//! `{dialog, result}`: the dialog as the set left it, and the reply to its confirm or cancel. A confirm, or a set with +//! `action: "confirm"`, of a dialog that holds its OK replies once the app accepts it, or with the app's +//! refusal as its error //! - `ui.resize {width, height}`, `ui.focus`, `ui.screenshot {path?, focus?}` (without a path the //! PNG comes back in the reply) //! - `ui.render {path?, scale?, artboard?, data?, traceViews?}`: render an artboard headlessly @@ -129,6 +132,25 @@ fn wrap(r: Result) -> Reply { Reply::from_result(r) } +/// The hosted dialog that `params` names (`dialog`, `"top"` for the top one) as `ui.inspect` lists it, +/// `{id, parent, key, fields}`, or null when none is open. +fn set_dialog(host: &craft::ui::dialog::DialogHost, params: &Value) -> Value { + let open = craft::automation::dialogs::inspect(host); + let list = open.as_array().map_or(&[][..], Vec::as_slice); + let set = if params["dialog"] == "top" { list.last() } else { list.iter().find(|d| d["id"] == params["dialog"]) }; + set.cloned().unwrap_or(Value::Null) +} + +/// The reply to a `ui.dialog.set` with an `action`, from `reply`, the reply to its confirm or cancel: on success +/// `{dialog, result}`, with `dialog` as the set left it and `result` the answer's result, and otherwise `reply`. +pub(crate) fn answered_set(dialog: Value, reply: Value) -> Value { + if reply["ok"] != true { + return reply; + } + let result = reply.get("result").cloned().unwrap_or(Value::Null); + json!({"ok": true, "result": {"dialog": dialog, "result": result}}) +} + pub fn all_commands(app: &VectorcraftApp) -> Value { let mut v: Vec = app.session.commands().into_iter().map(|c| serde_json::to_value(c).unwrap_or_default()).collect(); for (id, label, sc, params) in crate::menus::UI_COMMANDS { @@ -1175,9 +1197,10 @@ const DOCKING_ACTION: &str = "action"; /// succeeded or failed ([`sent_paths`]), except where a `path` or `files` entry of its result names the /// file the request wrote inside the write roots, as the request gave it. A reply with no `/`, `\` or `%` in it is not searched, since every hidden path /// holds a separator, written or escaped. A screenshot's reply is hidden when it is sent -/// ([`Hiding::hide_error`]); a `ui.pointer` reply sent after the tool's edit holds no library id +/// ([`Hiding::hide_error`]), and so is a confirm's reply held on a dialog's OK ([`HeldConfirm::forward`]); a `ui.pointer` reply sent after the tool's edit holds no library id /// or path. pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context, req: &ControlRequest) -> Reply { + app.held_set = None; let method = req.method.as_str(); if vectorcraft_engine::file_access::current().is_none() { return dispatch(app, ctx, method, &req.params); @@ -1201,6 +1224,50 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context, req: &ControlReques Reply::Done(reply) } +/// A `ui.dialog.confirm`, or a `ui.dialog.set` with `action: "confirm"`, whose reply waits for the app's answer to +/// the dialog's held OK ([`Reply::AfterHeldOk`]). The control channel sends that answer to `answer`, and +/// [`Self::forward`] sends it on as the request's reply. +pub(crate) struct HeldConfirm { + /// Where the control channel sends the answer. + answer: std::sync::mpsc::Receiver, + /// Where the request's reply goes. + reply: std::sync::mpsc::Sender, + /// The request's params: the reply hides the paths outside the read root that they hold. + params: Value, + /// The dialog that a set with an `action` set, which the reply shows as `dialog`. + dialog: Option, +} + +impl HeldConfirm { + /// Holds the reply of `req`: the control channel answers the returned confirm in its place. `dialog` is the + /// dialog `req` set, for a set with an `action`. + pub(crate) fn hold(req: &mut ControlRequest, dialog: Option) -> Self { + let (to_confirm, answer) = std::sync::mpsc::channel(); + let reply = std::mem::replace(&mut req.reply, to_confirm); + Self { answer, reply, params: req.params.clone(), dialog } + } + + /// Sends the control channel's answer on as the request's reply: inside `{dialog, result}` for a set with an + /// `action`, and under a read root with what `hiding` hides, as [`handle`] hides a reply it sends at once. True + /// while the answer has not come. + pub(crate) fn forward(&self, hiding: &Hiding) -> bool { + let answer = match self.answer.try_recv() { + Ok(answer) => answer, + Err(std::sync::mpsc::TryRecvError::Empty) => return true, + Err(std::sync::mpsc::TryRecvError::Disconnected) => return false, + }; + let mut reply = match &self.dialog { + Some(dialog) => answered_set(dialog.clone(), answer), + None => answer, + }; + if vectorcraft_engine::file_access::current().is_some() { + hiding.hide(&mut reply, &self.params); + } + let _ = self.reply.send(reply); + false + } +} + /// Hides in `reply` the libraries hidden now and in `before`, and the paths outside the read root that /// `sent`, the request's params, holds ([`handle`]), and the recovery folders outside the read root /// that are in use or that a failure message named, with each folder on the way to one that the reply @@ -1473,6 +1540,7 @@ fn dispatch(app: &mut VectorcraftApp, ctx: &egui::Context, method: &str, p: &Val Some(_) => return err("`action` must be confirm or cancel"), }; let pdf = app.save_pdf.as_ref().map(|open| open.id).filter(|_| method == "ui.dialog.set"); + let mut held_set = None; let reply = dialogs.with(|host| { // The answer goes to the dialog the fields went to, even when setting them opens another over it. if answer.is_some() @@ -1491,34 +1559,39 @@ fn dispatch(app: &mut VectorcraftApp, ctx: &egui::Context, method: &str, p: &Val // A Save PDF settings object keeps the options it leaves out. match pdf.and_then(|id| crate::dialogs::save_pdf::set_settings_objects(host, ctx, id, ¶ms)) { Some(set) => Some(set.map(|()| Value::Null)), + // A confirm that files a dialog's held OK replies once the app accepts or refuses it. + None if method != "ui.dialog.set" => return craft::automation::dialogs::dialog_reply(host, ctx, method, ¶ms), None => craft::automation::dialogs::dialog_method(host, ctx, method, ¶ms), } } else { Some(Ok(Value::Null)) }; match (set, answer) { + // A set with an `action` replies `{dialog, result}`: the dialog as the set left it, and the answer's + // result. A confirm that files the dialog's held OK replies once the app answers it. (Some(Ok(_)), Some(answer)) => { + let dialog = set_dialog(host, ¶ms); if answer == "ui.dialog.confirm" && let Ok(id) = craft::automation::dialogs::dialog_id(host, ¶ms) { crate::dialogs::print::prepare_confirm(app, host, id); } - craft::automation::dialogs::dialog_method(host, ctx, answer, &json!({ "dialog": params["dialog"] })) + match craft::automation::dialogs::dialog_reply(host, ctx, answer, &json!({ "dialog": params["dialog"] })) { + Some(Reply::Done(reply)) => Some(Reply::Done(answered_set(dialog, reply))), + Some(held) => { + held_set = Some(dialog); + Some(held) + } + None => None, + } } // A set answers with the dialog it set, `{id, parent, key, fields}`, as production did. - (Some(Ok(_)), None) if method == "ui.dialog.set" => { - let open = craft::automation::dialogs::inspect(host); - let list = open.as_array().map_or(&[][..], Vec::as_slice); - let set = if params["dialog"] == "top" { list.last() } else { list.iter().find(|d| d["id"] == params["dialog"]) }; - Some(Ok(set.cloned().unwrap_or(Value::Null))) - } - (set, _) => set, + (Some(Ok(_)), None) if method == "ui.dialog.set" => Some(ok(set_dialog(host, ¶ms))), + (set, _) => set.map(wrap), } }); - match reply { - Some(r) => wrap(r), - None => err(format!("unknown method `{method}`")), - } + app.held_set = held_set; + reply.unwrap_or_else(|| err(format!("unknown method `{method}`"))) } "ui.resize" => { let (w, h) = match coord(p, "width", 1440.0).and_then(|w| Ok((w, coord(p, "height", 900.0)?))) { @@ -1678,14 +1751,21 @@ fn preferences_method(app: &mut VectorcraftApp, method: &str, p: &Value) -> Resu for (field, value) in fields { crate::prefs_dialog::set_field(app, &field, value)?; } - match action { - Some("confirm") => crate::prefs_dialog::confirm(app), + // A set with an `action` replies `{dialog, result}`: the window as the set left it, as `ui.inspect` shows it, and + // the answer's result. + let dialog = (method == "ui.dialog.set" && action.is_some()).then(|| json!({"kind": "preferences", "fields": crate::prefs_dialog::fields(app)})); + let result = match action { + Some("confirm") => crate::prefs_dialog::confirm(app)?, Some(_) => { crate::prefs_dialog::cancel(app); - Ok(Value::Null) + Value::Null } - None => Ok(Value::Null), - } + None => Value::Null, + }; + Ok(match dialog { + Some(dialog) => json!({"dialog": dialog, "result": result}), + None => result, + }) } /// `app.save` (`method`) or `app.export` with params `p`. diff --git a/crates/ui-egui/src/control/tests.rs b/crates/ui-egui/src/control/tests.rs index d267ab460e..96824a2057 100644 --- a/crates/ui-egui/src/control/tests.rs +++ b/crates/ui-egui/src/control/tests.rs @@ -648,16 +648,112 @@ fn dialog_set_with_an_action_answers_the_same_dialog() { } let r = request(&mut app, json!({"fields": [{"field": "text", "value": "b"}], "action": "confirm"})); assert_eq!(r["ok"], true, "{r}"); + // The reply is `{dialog, result}`: the dialog as the set left it, and the reply to confirm. + assert_eq!(r["result"]["dialog"]["id"], id.value().to_string(), "{r}"); + assert_eq!(r["result"]["dialog"]["fields"]["text"], "b", "{r}"); + assert_eq!(r["result"].get("result"), Some(&Value::Null), "{r}"); let Some(DialogResult::Ok(answer)) = taken(&app, id) else { panic!("confirmed in the same request") }; assert_eq!(answer.fields.text("text"), Some("b"), "the answer holds the field set with it"); let id = open(&mut app); let r = request(&mut app, json!({"fields": [{"field": "text", "value": "c"}], "action": "cancel"})); assert_eq!(r["ok"], true, "{r}"); + assert_eq!(r["result"]["dialog"]["fields"]["text"], "c", "{r}"); + assert_eq!(r["result"].get("result"), Some(&Value::Null), "{r}"); assert!(matches!(taken(&app, id), Some(DialogResult::Cancel)), "canceled in the same request"); let r = request(&mut app, json!({"fields": [], "action": "confirm"})); assert_eq!(r["ok"], false, "no dialog open: {r}"); } +/// A confirm of a dialog that holds its OK replies with the app's answer, through both ways of confirming: +/// `ui.dialog.confirm` gets the refusal of a color adjustment confirmed in another document than the one it +/// opened in, and `ui.dialog.set {action: "confirm"}` in its own document gets the acceptance. While the +/// window is hidden, the request asks for the pass that pumps the dialogs, and the reply waits for it. +#[test] +fn a_held_confirm_replies_with_the_apps_answer() { + let (tx, rx) = std::sync::mpsc::channel(); + let mut app = crate::testing::windowed(VectorcraftApp::new(Session::new(), Services::default()).with_control(rx)); + let ctx = app.ui_ctx.clone().unwrap(); + let mut ids = Vec::new(); + for _ in 0..2 { + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + ids.push(app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap()); + app.run("paint.setFill", json!({"color": "#808080"})).unwrap(); + } + let fill = |app: &VectorcraftApp, id: u64| { + let node = app.session.doc().unwrap().doc.node(vectorcraft_doc::NodeId(id)).unwrap().clone(); + node.appearance.fill_paint().color().unwrap().to_hex() + }; + app.run("document.activate", json!({"index": 0})).unwrap(); + crate::dialogs::color_balance::open(&mut app); + app.dialogs() + .unwrap() + .with(|h| h.set_json_field(&ctx, craft::ui::dialog::dialog_id(crate::dialogs::color_balance::KIND), "r", json!(20))) + .unwrap(); + app.run("document.activate", json!({"index": 1})).unwrap(); + let undo = app.session.active().unwrap().history.undo.len(); + + let (req, reply) = ControlRequest::new("ui.dialog.confirm", json!({})); + tx.send(req).unwrap(); + crate::testing::app_frame(&mut app, &ctx, egui::RawInput::default()); + let refused = json!({"ok": false, "error": "This adjustment can only apply to the document where it was opened."}); + assert_eq!(reply.try_recv().ok(), Some(refused), "the confirm replies with the app's refusal"); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo, "the other document is not adjusted"); + assert_eq!(fill(&app, ids[1]), "#808080"); + + app.run("document.activate", json!({"index": 0})).unwrap(); + let hidden = || { + let mut raw = egui::RawInput::default(); + raw.viewports.insert(egui::ViewportId::ROOT, egui::ViewportInfo { minimized: Some(true), ..Default::default() }); + raw + }; + let (req, reply) = ControlRequest::new("ui.dialog.set", json!({"fields": [], "action": "confirm"})); + tx.send(req).unwrap(); + // A hidden window runs only the app's logic until it is asked to paint. + let out = crate::testing::part_frame(&mut app, &ctx, hidden(), |app, ui| app.tick(ui.ctx())); + assert!(reply.try_recv().is_err(), "the reply waits for the app's answer"); + let commands = out.viewport_output.get(&egui::ViewportId::ROOT).map_or(&[][..], |v| v.commands.as_slice()); + assert!(commands.contains(&egui::ViewportCommand::RequestPaintWhileHidden), "the held OK asks for a pass: {commands:?}"); + crate::testing::app_frame(&mut app, &ctx, hidden()); + let r = reply.try_recv().expect("the confirm replies once the app accepts it"); + assert_eq!(r["ok"], true, "{r}"); + // A set with an `action` replies `{dialog, result}` once the app has answered too. + assert_eq!(r["result"]["dialog"]["key"], crate::dialogs::color_balance::KIND, "{r}"); + assert_eq!(r["result"]["dialog"]["fields"]["r"].as_f64(), Some(20.0), "{r}"); + assert_eq!(r["result"].get("result"), Some(&Value::Null), "{r}"); + assert_eq!(fill(&app, ids[0]), "#b38080", "the adjustment applies in its own document"); + assert!(app.held_confirms.is_empty(), "no confirm waits"); +} + +/// A held confirm whose dialog closes before the app answers its OK replies with an error, and a second confirm +/// sent while the first waits is refused without answering the first. +#[test] +fn a_held_confirm_answers_when_its_dialog_closes_first() { + let (tx, rx) = std::sync::mpsc::channel(); + let mut app = crate::testing::windowed(VectorcraftApp::new(Session::new(), Services::default()).with_control(rx)); + let ctx = app.ui_ctx.clone().unwrap(); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 50, "height": 50})).unwrap(); + crate::dialogs::color_balance::open(&mut app); + // A pass that runs only the app's logic answers the control requests, but not the held OK. + let logic = |app: &mut VectorcraftApp, method: &str| { + let (req, reply) = ControlRequest::new(method, json!({})); + tx.send(req).unwrap(); + crate::testing::part_frame(app, &ctx, egui::RawInput::default(), |app, ui| app.tick(ui.ctx())); + reply + }; + let first = logic(&mut app, "ui.dialog.confirm"); + assert!(first.try_recv().is_err(), "the reply waits for the app's answer"); + let second = logic(&mut app, "ui.dialog.confirm"); + let r = second.try_recv().expect("a second confirm replies at once"); + assert_eq!(r["ok"], false, "a second confirm while the first waits is refused: {r}"); + assert!(first.try_recv().is_err(), "the first confirm still waits"); + let cancel = logic(&mut app, "ui.dialog.cancel"); + assert_eq!(cancel.try_recv().ok().map(|r| r["ok"].clone()), Some(json!(true))); + let closed = json!({"ok": false, "error": "the dialog closed while its OK waited for the app's answer"}); + assert_eq!(first.try_recv().ok(), Some(closed), "the first confirm replies that the dialog closed"); + assert!(app.held_confirms.is_empty(), "no confirm waits"); +} + /// #1004: `ui.render` (the MCP `screenshot` of a connected app) renders the artboard asked /// for, at the scale asked for; the first without one. #[test] diff --git a/crates/ui-egui/src/dialogs/hyphenation.rs b/crates/ui-egui/src/dialogs/hyphenation.rs index 4e9fae0914..e660977d02 100644 --- a/crates/ui-egui/src/dialogs/hyphenation.rs +++ b/crates/ui-egui/src/dialogs/hyphenation.rs @@ -245,11 +245,11 @@ mod tests { } assert_eq!(paras(&app, id), original, "{lang}: only the draft changes while open"); if answer == "ui.dialog.confirm" { - let (request, _) = ControlRequest::new(answer, json!({})); - match crate::control::handle(&mut app, &ctx, &request) { - Reply::Done(reply) => assert_eq!(reply["ok"], true, "{reply}"), - _ => panic!("confirmation should reply immediately"), - } + let (request, sent) = ControlRequest::new(answer, json!({})); + let reply = crate::control::handle(&mut app, &ctx, &request); + assert!(matches!(reply, Reply::AfterHeldOk { .. }), "the confirm waits for the app's answer to the held OK"); + let reply = crate::testing::settled_reply(&mut app, &ctx, request, &sent, reply); + assert_eq!(reply["ok"], true, "{reply}"); } else { click(&mut app, &mut frame, footer.center()); } diff --git a/crates/ui-egui/src/dialogs/script_window.rs b/crates/ui-egui/src/dialogs/script_window.rs index c7a85c3e0c..51c59b32b9 100644 --- a/crates/ui-egui/src/dialogs/script_window.rs +++ b/crates/ui-egui/src/dialogs/script_window.rs @@ -846,15 +846,23 @@ pub(crate) fn dialog_method(app: &mut VectorcraftApp, method: &str, params: &Val return Some(Err(e)); } } - Some(match answer { - Some(true) => confirm(app), - Some(false) => cancel(app).map(|()| Value::Null), - // A set answers with the dialog it set, `{id, parent, key, fields}`, as the other dialogs' sets do. - None => Ok(with_host(app, |host, _| { + // A set answers with the dialog it set, `{id, parent, key, fields}`, as the other dialogs' sets do. + let set = (method == "ui.dialog.set").then(|| { + with_host(app, |host, _| { let id = dialog_id(KIND).value().to_string(); craft::automation::dialogs::inspect(host).as_array().and_then(|open| open.iter().find(|d| d["id"] == id.as_str()).cloned()) }) .flatten() - .unwrap_or(Value::Null)), + .unwrap_or(Value::Null) + }); + let result = match answer { + Some(true) => confirm(app), + Some(false) => cancel(app).map(|()| Value::Null), + None => return Some(Ok(set.unwrap_or(Value::Null))), + }; + // A set with an `action` replies `{dialog, result}`: the dialog as the set left it, and the answer's result. + Some(match (set, result) { + (Some(dialog), Ok(result)) => Ok(json!({ "dialog": dialog, "result": result })), + (_, result) => result, }) } diff --git a/crates/ui-egui/src/dialogs/tests_print.rs b/crates/ui-egui/src/dialogs/tests_print.rs index 35675bda64..4684955ec9 100644 --- a/crates/ui-egui/src/dialogs/tests_print.rs +++ b/crates/ui-egui/src/dialogs/tests_print.rs @@ -90,10 +90,11 @@ pub(super) fn confirm(app: &mut VectorcraftApp) { } /// One control request, answered as the control channel answers it: at once, or, for synthetic input (`ui.text`, -/// `ui.key`), once the frames after it have processed the input. +/// `ui.key`), once the frames after it have processed the input, or, for a confirm of Print's held OK, once the app +/// answered it. pub(super) fn call_raw(app: &mut VectorcraftApp, method: &str, params: Value) -> Value { let ctx = ctx(app); - let (req, _reply) = craft::automation::ControlRequest::new(method, params); + let (req, answer) = craft::automation::ControlRequest::new(method, params); let reply = match crate::control::handle(app, &ctx, &req) { craft::automation::Reply::Done(reply) => reply, craft::automation::Reply::AfterInput => { @@ -102,7 +103,8 @@ pub(super) fn call_raw(app: &mut VectorcraftApp, method: &str, params: Value) -> } json!({"ok": true, "result": null}) } - _ => panic!("{method} is answered at once or after its input"), + held @ craft::automation::Reply::AfterHeldOk { .. } => crate::testing::settled_reply(app, &ctx, req, &answer, held), + _ => panic!("{method} is answered at once, after its input or after the app's answer"), }; pump(app); reply diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 60e133e9f3..c066f803e1 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -179,6 +179,11 @@ pub struct VectorcraftApp { pub(crate) channel: Option, /// A `ui.pointer` or `ui.tool.select` held until the synthetic input sent before it reached the tool. deferred_control: Option, + /// The dialog that the request [`control::handle`] answered last set with `action: "confirm"`, when that confirm + /// filed the dialog's held OK: its reply shows it as `dialog` ([`control::HeldConfirm`]). + pub(crate) held_set: Option, + /// The confirms whose replies wait for the app's answer to a dialog's held OK. + pub(crate) held_confirms: Vec, /// Where a control-channel Rotate View drag began, kept between its requests. pub(crate) control_rotate_press: Option, /// The `ui.pointer` replies that wait for the edit their gesture started on another thread. diff --git a/crates/ui-egui/src/testing.rs b/crates/ui-egui/src/testing.rs index 89a74801bc..59667e5f7a 100644 --- a/crates/ui-egui/src/testing.rs +++ b/crates/ui-egui/src/testing.rs @@ -113,6 +113,30 @@ pub(crate) fn run_fired(app: &mut crate::VectorcraftApp, ctx: &egui::Context) { let _ = app.frame_input(take_output(ctx)); } +/// The reply to `req`, which [`crate::control::handle`] answered with `reply` just before, as the app sends it on +/// `answer` ([`crate::VectorcraftApp::settle_control`]): at once, or for a confirm that filed a dialog's held OK, after +/// the frame whose dialog pump accepted or refused that OK. For that frame the app answers a control channel that +/// holds the reply. +pub(crate) fn settled_reply( + app: &mut crate::VectorcraftApp, + ctx: &egui::Context, + req: craft::automation::ControlRequest, + answer: &std::sync::mpsc::Receiver, + reply: craft::automation::Reply, +) -> serde_json::Value { + let (_requests, rx) = std::sync::mpsc::channel(); + let previous = app.channel.replace(craft::automation::ControlChannel::new(rx)); + let now = app.instant(); + app.settle_control(req, reply, None, 0.0, now); + let sent = answer.try_recv().or_else(|_| { + app_frame(app, ctx, egui::RawInput::default()); + answer.try_recv() + }); + app.channel = previous; + app.held_confirms.clear(); + sent.unwrap_or_else(|_| serde_json::json!({"ok": false, "error": "no reply after the frame that pumps the dialogs"})) +} + /// Held by a test that changes the custom dictionary, which the whole process shares, or that needs it to hold still: /// every change moves the dictionary's generation, and a Check Spelling walk that sees it move checks its scope again /// from the start. diff --git a/crates/ui-egui/src/tests/automation.rs b/crates/ui-egui/src/tests/automation.rs index ac619939fe..65605a9e1f 100644 --- a/crates/ui-egui/src/tests/automation.rs +++ b/crates/ui-egui/src/tests/automation.rs @@ -161,6 +161,26 @@ fn control_saves_leave_out_the_documents_file_outside_the_read_root() { let _ = std::fs::remove_dir_all(base); } +/// A confirm's reply held on a dialog's OK, sent once the app answers it, shows a path outside the read root that the +/// request sent by its file name only, as a reply sent at once does. +#[test] +fn a_held_confirm_hides_the_paths_outside_the_read_root() { + let (mut app, _tx, base) = confined("held-confirm"); + let outside = s(base.join("outside/b.svg")); + let params = json!({"fields": [{"field": "file", "value": outside}], "action": "confirm"}); + let (mut req, reply) = ControlRequest::new("ui.dialog.set", params); + app.held_confirms.push(crate::control::HeldConfirm::hold(&mut req, None)); + // The control channel answers the held confirm with the app's refusal. + req.reply.send(json!({"ok": false, "error": format!("cannot read {outside}")})).unwrap(); + app.poll_held(); + let r = reply.try_recv().expect("the reply is sent once the answer has come"); + assert_eq!(r["ok"], false, "{r}"); + assert!(!r.to_string().contains(&s(base.join("outside"))), "{r}"); + assert!(r["error"].as_str().is_some_and(|e| e.contains("b.svg")), "{r}"); + assert!(app.held_confirms.is_empty(), "no confirm waits"); + let _ = std::fs::remove_dir_all(base); +} + /// In one session with a library loaded from outside the read root: the library keeps its file-name /// id, a reply that names its path shows the file name, a save without a path leaves out the /// document's file, and a save or export to a path the client gave in the write root keeps that path @@ -1782,6 +1802,13 @@ fn dialog_set_allows_hidden_controls() { let r = request(&mut app, &tx, "ui.dialog.set", json!({"field": "__search", "value": "grid"})); assert_eq!(r["ok"], true, "{r}"); assert_eq!(crate::prefs_dialog::fields(&app).unwrap()["__search"], "grid"); + // With an `action`, Preferences replies `{dialog, result}` as the hosted dialogs do. + let r = request(&mut app, &tx, "ui.dialog.set", json!({"field": "__search", "value": "rulers", "action": "cancel"})); + assert_eq!(r["ok"], true, "{r}"); + assert_eq!(r["result"]["dialog"]["kind"], "preferences", "{r}"); + assert_eq!(r["result"]["dialog"]["fields"]["__search"], "rulers", "{r}"); + assert_eq!(r["result"].get("result"), Some(&Value::Null), "{r}"); + assert!(!crate::prefs_dialog::is_open(&app), "canceled in the same request"); } /// Save PDF's and Print's OK export and print: `ui.dialog.set` can't add a preset name to turn OK diff --git a/crates/ui-egui/src/tests/script_window.rs b/crates/ui-egui/src/tests/script_window.rs index 403e20faea..0f819ee981 100644 --- a/crates/ui-egui/src/tests/script_window.rs +++ b/crates/ui-egui/src/tests/script_window.rs @@ -734,6 +734,9 @@ fn ui_dialog_set_with_an_action_gives_the_event() { let fields = json!({"fields": [{"field": "event", "value": "change"}, {"field": "control", "value": "name"}, {"field": "value", "value": "Ann"}], "action": "confirm"}); let r = run(&mut app, "ui.dialog.set", fields); assert_eq!(r["ok"], true, "{r}"); + // A set with an `action` replies `{dialog, result}`: the dialog as the set left it, and the answer's result. + assert!(r["result"]["dialog"]["fields"].is_object(), "{r}"); + assert!(r["result"].get("result").is_some(), "{r}"); assert!(until_window(&mut app)); let r = run(&mut app, "ui.dialog.set", json!({"field": "title", "value": "x"})); assert_eq!(r["ok"], false, "the title is read only: {r}"); diff --git a/crates/ui-egui/src/tests/synthetic.rs b/crates/ui-egui/src/tests/synthetic.rs index 5b516374d8..e5fdfffa3f 100644 --- a/crates/ui-egui/src/tests/synthetic.rs +++ b/crates/ui-egui/src/tests/synthetic.rs @@ -8,11 +8,15 @@ use vectorcraft_engine::Session; use crate::VectorcraftApp; -/// Send one control request (it must succeed). +/// Send one control request (it must succeed). A confirm that files a dialog's held OK is answered in the frames the +/// test runs after it, which check what the OK did. pub(crate) fn control(app: &mut VectorcraftApp, ctx: &egui::Context, method: &str, params: Value) { let (req, _rx) = ControlRequest::new(method, params); - let Reply::Done(r) = crate::control::handle(app, ctx, &req) else { panic!("not done") }; - assert_eq!(r["ok"], true, "{r}"); + match crate::control::handle(app, ctx, &req) { + Reply::Done(r) => assert_eq!(r["ok"], true, "{r}"), + Reply::AfterHeldOk { .. } => {} + _ => panic!("not done"), + } } /// One whole app frame (`tick` and `ui`, as production runs them) in an 800 × 600 window with diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 21c81bda1e..870dcfcb82 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -102,7 +102,7 @@ the two can still win that race. | `ui.click` / `ui.drag` | `{x, y, button?, count?, shift?, alt?, ctrl?, cmd?}` / `{x, y, toX, toY, steps?, count?, button?, shift?, alt?, ctrl?, cmd?}` | egui pointer input; see synthetic input budgets above | | `ui.wheel` | `{x, y, dy?, dx?, unit?: "line"\|"point", shift?, alt?, cmd?}` | a mouse wheel turn over screen point (x, y): `dy` notches up (+) or down, `dx` sideways. Over the canvas the wheel scrolls, Cmd-wheel (Ctrl on Windows and Linux) scrolls sideways and Alt-wheel (Option on the Mac) zooms about the pointer (with the `ctrlWheelScrollsSideways` preference off, Cmd-wheel zooms too); with the `zoomWithMouseWheel` preference the wheel and Alt-wheel zoom about the pointer, Shift-wheel scrolls up and down and Cmd-wheel (Ctrl on Windows and Linux) sideways. Over a focused numeric field (click it first) each notch steps its value as Up/Down do (Shift: ten, Cmd/Ctrl: a tenth) and the panel stays put; over anything else in a panel the wheel scrolls it. Over the canvas, the wheel preferences in `docs/mcp.md` change what these keys do | | `ui.set` | `{brightness?, panel?, rulers?, outline?, grid?, smartGuides?, boundingBox?, controlBar?, imageTracePreview?}` | `outline`: View › Outline for the active document only (each document has its own, a document opens in Preview, and `ui.inspect` shows it as `view.outline`; an error without a document). `imageTracePreview`: the Image Trace panel's Preview (`ui.inspect` shows it as `ui.image_trace_preview`) | -| `ui.dialog.set` / `.confirm` / `.cancel` | `{field, value, action?}` or `{fields: [{field, value}…], action?}` | fill and submit the open dialog. `ui.dialog.set` takes the fields the dialog has (`ui.inspect`) other than its `__` fields, the `__` fields that are controls of the dialog (such as `__section`, `__allArtboards` and `__bleedLinked` in Save PDF, `__constrain` in Transform Each and the shape dialogs, and `__search` and `__category` in Preferences; Save PDF's and Print's `__savePresetAs`, the preset name, only while Save Preset… asks for it, since OK then saves a preset), `discard` on a dialog with a discard button, `preview` on one with a live preview, the fields that the dialog reads but adds only when a control changes (such as `searchFolder`, or `copy` in the Transform dialogs), and the fields it passes to the command it runs: every parameter of the `command` dialog's command (`ui.paramDialog`), and the `textureImage` that Load Texture… sets in the Glass, Texturizer and Rough Pastels effects; any other field is an error that lists the dialog's fields, and the dialog stays as it was. Any other `__` field, held or not, holds what the dialog's OK acts on (such as the `__command` and `__params` of a `confirm` or `command` dialog) or the dialog's own state: setting it is the error "the `` dialog cannot set protected field ``", and the dialog stays as it was. `fields` sets the list (at most 256 items) in order (a missing `value` is `null`) and checks every item first: when one is refused, the call is an error and no field changes. `action: "confirm"` or `"cancel"` on `ui.dialog.set` then confirms or cancels the same dialog in the same request, as `ui.dialog.confirm` and `ui.dialog.cancel` do, and the reply is `{dialog, result}`: the dialog after the fields were set and the reply to confirm (`null` for cancel); any other `action` is an error and no field changes | +| `ui.dialog.set` / `.confirm` / `.cancel` | `{field, value, action?}` or `{fields: [{field, value}…], action?}` | fill and submit the open dialog. `ui.dialog.set` takes the fields the dialog has (`ui.inspect`) other than its `__` fields, the `__` fields that are controls of the dialog (such as `__section`, `__allArtboards` and `__bleedLinked` in Save PDF, `__constrain` in Transform Each and the shape dialogs, and `__search` and `__category` in Preferences; Save PDF's and Print's `__savePresetAs`, the preset name, only while Save Preset… asks for it, since OK then saves a preset), `discard` on a dialog with a discard button, `preview` on one with a live preview, the fields that the dialog reads but adds only when a control changes (such as `searchFolder`, or `copy` in the Transform dialogs), and the fields it passes to the command it runs: every parameter of the `command` dialog's command (`ui.paramDialog`), and the `textureImage` that Load Texture… sets in the Glass, Texturizer and Rough Pastels effects; any other field is an error that lists the dialog's fields, and the dialog stays as it was. Any other `__` field, held or not, holds what the dialog's OK acts on (such as the `__command` and `__params` of a `confirm` or `command` dialog) or the dialog's own state: setting it is the error "the `` dialog cannot set protected field ``", and the dialog stays as it was. `fields` sets the list (at most 256 items) in order (a missing `value` is `null`) and checks every item first: when one is refused, the call is an error and no field changes. `action: "confirm"` or `"cancel"` on `ui.dialog.set` then confirms or cancels the same dialog in the same request, as `ui.dialog.confirm` and `ui.dialog.cancel` do, and the reply is `{dialog, result}`: the dialog after the fields were set and the reply to confirm (`null` for cancel); any other `action` is an error and no field changes. When the dialog waits for the app to accept or refuse its OK (a color adjustment refuses OK while another document is the active one), `ui.dialog.confirm` and `action: "confirm"` reply once the app has answered: `null` (`result: null` for `action`) when it accepts the OK, and the app's refusal as the error when it refuses it, with the dialog left open. A confirm whose dialog closes first is the error "the dialog closed while its OK waited for the app's answer" | | `ui.screenshot` | `{path?, data?}` | capture the window (PNG), written to `path`; `data: true` sends it back as `pngBase64` too. The inline PNG is capped at 64 MiB: with a `path` the file is still written and `pngBase64` is omitted when the image is larger, while a path-less `data: true` request fails if either the raw RGBA image or the encoded PNG exceeds the cap. Needs a presented frame: with the screen locked or the window minimized/covered it fails after ~8 s with an explanatory error | | `ui.render` | `{path?, scale?, artboard?, data?, traceViews?}` | render an artboard headlessly (PNG with the pixels of `app.export {format: "png", background: "white"}` at the same scale; `artboard`: its 0-based index, default the first; `traceViews: true`: Image Trace objects draw in their View, as on the canvas, instead of their tracing result): written to `path`, else (or with `data: true` as well) sent back as `pngBase64` | | `ui.resize` | `{width?, height?}` | request the window's inner size; omitted or null `width` and `height` default to 1440 and 900. Returns `null` | From afc027a1d267909aa177f0cacbe10767ab48013d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 3 Dec 2026 02:14:14 -0800 Subject: [PATCH 17/29] Dialogs: a held confirm reads what its reply hides only when it replies While a confirm waits on a dialog's held OK, the app polls it after the dialog pump and after the control requests of every pass. Each poll read the libraries and recovery folders that a reply hides, also when no answer had come and when no read root was set. `HeldConfirm::forward` now takes that read as a closure, which `poll_held` runs once per poll, the first time an answer is sent under a read root. --- crates/ui-egui/src/app/control.rs | 9 ++++++--- crates/ui-egui/src/control.rs | 8 ++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/ui-egui/src/app/control.rs b/crates/ui-egui/src/app/control.rs index db564b4c34..13f9a536a0 100644 --- a/crates/ui-egui/src/app/control.rs +++ b/crates/ui-egui/src/app/control.rs @@ -151,10 +151,13 @@ impl VectorcraftApp { if self.held_confirms.is_empty() { return; } - let hiding = control::deferred_hiding(self); + // What a reply hides is read once, and only when an answer has come under a read root. + let hiding = std::cell::OnceCell::new(); let roots = self.automation_roots.clone(); - let held = &mut self.held_confirms; - file_access::confine(roots.as_ref(), || held.retain(|confirm| confirm.forward(&hiding))); + let mut held = std::mem::take(&mut self.held_confirms); + let app = &*self; + file_access::confine(roots.as_ref(), || held.retain(|confirm| confirm.forward(|| hiding.get_or_init(|| control::deferred_hiding(app))))); + self.held_confirms = held; } /// Answers the `ui.pointer` replies held on the tool's edit ([`control::PointerWait`]). The canvas diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index 5e46bdeeda..4fffc9980d 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -1248,9 +1248,9 @@ impl HeldConfirm { } /// Sends the control channel's answer on as the request's reply: inside `{dialog, result}` for a set with an - /// `action`, and under a read root with what `hiding` hides, as [`handle`] hides a reply it sends at once. True - /// while the answer has not come. - pub(crate) fn forward(&self, hiding: &Hiding) -> bool { + /// `action`, and under a read root with what `hiding` returns hidden, as [`handle`] hides a reply it sends at once. + /// `hiding` is called only for an answer sent under a read root. True while the answer has not come. + pub(crate) fn forward<'a>(&self, hiding: impl FnOnce() -> &'a Hiding) -> bool { let answer = match self.answer.try_recv() { Ok(answer) => answer, Err(std::sync::mpsc::TryRecvError::Empty) => return true, @@ -1261,7 +1261,7 @@ impl HeldConfirm { None => answer, }; if vectorcraft_engine::file_access::current().is_some() { - hiding.hide(&mut reply, &self.params); + hiding().hide(&mut reply, &self.params); } let _ = self.reply.send(reply); false From 9fcd88b12052077ae88dbf58133ff4dbe5224ee8 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 3 Dec 2026 02:26:38 -0800 Subject: [PATCH 18/29] Blend: an unfinished spacing value follows the selected objects, not the Layers target The Blend panel's Steps, Distance, Ramp and Shift fields keyed their edit target on the selection's subjects, which is the targeted layer while one is targeted. Locking an artboard keeps that target and deselects the objects on the artboard, so the blends the commands act on changed while the key did not, and a value typed for both blends was committed to the one left selected. The key is now the selected objects, which object.blend.info and object.blend.options read. The selected symbol part is no longer part of the key: with one selected, no blend is edited and the fields cannot be typed into. Tests cover a targeted layer losing a blend to a locked artboard and File > Revert dropping an unfinished Steps value. --- crates/ui-egui/src/panels/blend.rs | 7 ++- crates/ui-egui/src/panels/tests_blend.rs | 65 ++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/panels/blend.rs b/crates/ui-egui/src/panels/blend.rs index 98edf970b4..2d44e8a91a 100644 --- a/crates/ui-egui/src/panels/blend.rs +++ b/crates/ui-egui/src/panels/blend.rs @@ -110,15 +110,14 @@ fn percent_slider( } /// What the Steps, Distance, Ramp and Shift fields edit, as their edit target: the document, how many times File › Revert replaced -/// its content, the selected objects (or the object targeted in the Layers panel) and the selected symbol part. A +/// its content, and the selected objects, whose blends `object.blend.info` and `object.blend.options` read and change. A /// field drops an unfinished value when this changes, even where the new blend has the same value. -type EditTarget = Option<(u64, u64, Vec, Option<(NodeId, Vec)>)>; +type EditTarget = Option<(u64, u64, Vec)>; /// The [`EditTarget`] of the active document. fn edit_target(app: &VectorcraftApp) -> EditTarget { let st = app.session.active()?; - let part = st.selection.symbol_part.as_ref().map(|p| (p.instance, p.path.clone())); - Some((st.uid, st.reverts, st.selection.subjects().to_vec(), part)) + Some((st.uid, st.reverts, st.selection.objects.clone())) } /// Spacing and Orientation, as `object.blend.info` reports them; a change runs diff --git a/crates/ui-egui/src/panels/tests_blend.rs b/crates/ui-egui/src/panels/tests_blend.rs index a871dcc119..4fd2b7ecd5 100644 --- a/crates/ui-egui/src/panels/tests_blend.rs +++ b/crates/ui-egui/src/panels/tests_blend.rs @@ -366,3 +366,68 @@ fn an_unfinished_steps_value_stays_with_its_blend_and_document() { p.key(Key::Enter, Modifiers::NONE); assert_eq!((steps(&mut p, 0), steps(&mut p, 1)), (BlendSpacing::Steps(5), BlendSpacing::Steps(1)), "the other document takes 1 step"); } + +#[test] +fn an_unfinished_steps_value_is_dropped_when_a_targeted_layer_loses_a_blend() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + // Blend `a` on the first artboard and `b` on the second, both at 5 steps, with their layer targeted. + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 300, "artboards": 2})).unwrap(); + let blend_at = |app: &mut VectorcraftApp, board: usize| { + let at = app.session.active().unwrap().doc.artboards[board].rect; + let ids: Vec = [0.0, 200.0] + .map(|x| app.run("shape.rectangle", json!({"x": at.x0 + x, "y": at.y0, "width": 20, "height": 20})).unwrap()["id"].clone()) + .into(); + app.run("select.set", json!({"ids": ids})).unwrap(); + NodeId(app.run("object.blend.make", json!({"spacing": "steps", "steps": 5})).unwrap()["id"].as_u64().unwrap()) + }; + let a = blend_at(&mut app, 0); + let b = blend_at(&mut app, 1); + let layer = app.session.active().unwrap().doc.layers[0].id; + app.run("layer.target", json!({"id": layer.0})).unwrap(); + let mut p = Panel::new(app, show); + p.click_role("Steps:", Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("3+"); + + // Locking the first artboard deselects `a`; the layer stays targeted. + p.app().run("artboard.setProps", json!({"index": 0, "locked": true})).unwrap(); + { + let app = p.app(); + let sel = &app.session.active().unwrap().selection; + assert_eq!((sel.objects.clone(), sel.subjects().to_vec()), (vec![b], vec![layer]), "only b is selected, under the targeted layer"); + } + p.frame(); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + assert_eq!((spec(&app, a).spacing, spec(&app, b).spacing), (BlendSpacing::Steps(5), BlendSpacing::Steps(1)), "b takes 1 step, not 3+1"); +} + +#[test] +fn an_unfinished_steps_value_is_dropped_by_file_revert() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + let (mut app, id) = blended(); + app.run("object.blend.options", json!({"spacing": "steps", "steps": 5})).unwrap(); + let dir = vectorcraft_testkit::TempDir::new("blend-revert"); + app.services.read = Some(Box::new(|path| std::fs::read(path).map_err(|e| e.to_string()))); + app.services.write = Some(Box::new(|path, bytes| std::fs::write(path, bytes).map_err(|e| e.to_string()))); + app.run("file.saveAs", json!({"path": dir.join("Blend.vectorcraft")})).unwrap(); + // An unsaved change for Revert to undo, leaving the blend as saved. + app.run("shape.rectangle", json!({"x": 100, "y": 200, "width": 20, "height": 20})).unwrap(); + app.run("select.set", json!({"ids": [id.0]})).unwrap(); + let mut p = Panel::new(app, show); + p.click_role("Steps:", Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("3+"); + + // The restored document has the same blend and, selected again, the same selection. + p.app().run("file.revert", json!({"confirmed": true})).unwrap(); + p.app().run("select.set", json!({"ids": [id.0]})).unwrap(); + p.frame(); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + assert_eq!(spec(&p.app(), id).spacing, BlendSpacing::Steps(1), "Revert drops the unfinished value"); +} From ee145435efb9aee446633e76a81f127180c31cc8 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 3 Dec 2026 02:28:25 -0800 Subject: [PATCH 19/29] Dialogs: a set that names its dialog by a numeric id replies with it `ui.dialog.set` names its dialog by the id `ui.inspect` lists, as a decimal string or a number, or by "top". The dialog in its reply was looked up by comparing `dialog` with the listed ids, which are strings, so a set that named the dialog by a number replied `null` without an `action`, and `{dialog: null, result}` with one. The reply now resolves `dialog` as the set itself does (`dialog_id`) and lists that dialog. --- crates/ui-egui/src/control.rs | 10 +++++----- crates/ui-egui/src/control/tests.rs | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index 4fffc9980d..9b86a35ce3 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -132,13 +132,13 @@ fn wrap(r: Result) -> Reply { Reply::from_result(r) } -/// The hosted dialog that `params` names (`dialog`, `"top"` for the top one) as `ui.inspect` lists it, -/// `{id, parent, key, fields}`, or null when none is open. +/// The hosted dialog that `params` names (`dialog`: an id as a decimal string or a number, or `"top"` for the top +/// one) as `ui.inspect` lists it, `{id, parent, key, fields}`, or null when none is open. fn set_dialog(host: &craft::ui::dialog::DialogHost, params: &Value) -> Value { + let Ok(id) = craft::automation::dialogs::dialog_id(host, params) else { return Value::Null }; + let id = id.value().to_string(); let open = craft::automation::dialogs::inspect(host); - let list = open.as_array().map_or(&[][..], Vec::as_slice); - let set = if params["dialog"] == "top" { list.last() } else { list.iter().find(|d| d["id"] == params["dialog"]) }; - set.cloned().unwrap_or(Value::Null) + open.as_array().and_then(|list| list.iter().find(|d| d["id"] == id.as_str())).cloned().unwrap_or(Value::Null) } /// The reply to a `ui.dialog.set` with an `action`, from `reply`, the reply to its confirm or cancel: on success diff --git a/crates/ui-egui/src/control/tests.rs b/crates/ui-egui/src/control/tests.rs index 96824a2057..677e67df3b 100644 --- a/crates/ui-egui/src/control/tests.rs +++ b/crates/ui-egui/src/control/tests.rs @@ -660,6 +660,14 @@ fn dialog_set_with_an_action_answers_the_same_dialog() { assert_eq!(r["result"]["dialog"]["fields"]["text"], "c", "{r}"); assert_eq!(r["result"].get("result"), Some(&Value::Null), "{r}"); assert!(matches!(taken(&app, id), Some(DialogResult::Cancel)), "canceled in the same request"); + // A dialog named by its id as a number replies with that dialog too, with an `action` and without one. + let id = open(&mut app); + let r = request(&mut app, json!({"dialog": id.value(), "field": "text", "value": "d"})); + assert_eq!(r["result"]["id"], id.value().to_string(), "{r}"); + let r = request(&mut app, json!({"dialog": id.value(), "field": "text", "value": "e", "action": "cancel"})); + assert_eq!(r["result"]["dialog"]["id"], id.value().to_string(), "{r}"); + assert_eq!(r["result"]["dialog"]["fields"]["text"], "e", "{r}"); + assert!(matches!(taken(&app, id), Some(DialogResult::Cancel)), "canceled in the same request"); let r = request(&mut app, json!({"fields": [], "action": "confirm"})); assert_eq!(r["ok"], false, "no dialog open: {r}"); } From c63903ad0eb7af00b91b57ab8991dda2b010522f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 3 Dec 2026 03:12:48 -0800 Subject: [PATCH 20/29] Dialogs: a held confirm's reply hides the libraries hidden when it was sent A reply sent at once hides the libraries the request could not read before it ran as well as those hidden after it. A confirm held on a dialog's OK hid only the libraries hidden when the app answered, so a library that was unreadable when the request came and no longer in use by then showed its whole id and path in the reply, for example in the `dialog` a set with an `action` replies with. `handle` keeps the hiding it read before the request ran for a held reply, `HeldConfirm` holds it, and `forward` merges it with the hiding read when the answer is sent, as `hide_in_reply` does. --- crates/ui-egui/src/app.rs | 1 + crates/ui-egui/src/app/control.rs | 3 ++- crates/ui-egui/src/control.rs | 29 +++++++++++++++++++------- crates/ui-egui/src/control/tests.rs | 28 +++++++++++++++++++++++++ crates/ui-egui/src/lib.rs | 3 +++ crates/ui-egui/src/tests/automation.rs | 2 +- 6 files changed, 56 insertions(+), 10 deletions(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 095eab171a..73a298280e 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -210,6 +210,7 @@ impl VectorcraftApp { channel: None, deferred_control: None, held_set: None, + held_before: crate::control::Hiding::default(), held_confirms: Vec::new(), control_rotate_press: None, pointer_waits: Vec::new(), diff --git a/crates/ui-egui/src/app/control.rs b/crates/ui-egui/src/app/control.rs index 13f9a536a0..0c5710fb09 100644 --- a/crates/ui-egui/src/app/control.rs +++ b/crates/ui-egui/src/app/control.rs @@ -131,9 +131,10 @@ impl VectorcraftApp { now: craft::ui::runtime::motion::Instant, ) { let held_set = self.held_set.take(); + let before = std::mem::take(&mut self.held_before); let Some(channel) = self.channel.as_mut() else { return }; if matches!(reply, craft::automation::Reply::AfterHeldOk { .. }) { - self.held_confirms.push(control::HeldConfirm::hold(&mut req, held_set)); + self.held_confirms.push(control::HeldConfirm::hold(&mut req, held_set, before)); } channel.settle_at(req, reply, document, settle, now); } diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index 9b86a35ce3..d995f5d5cb 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -1201,6 +1201,7 @@ const DOCKING_ACTION: &str = "action"; /// or path. pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context, req: &ControlRequest) -> Reply { app.held_set = None; + app.held_before = Hiding::default(); let method = req.method.as_str(); if vectorcraft_engine::file_access::current().is_none() { return dispatch(app, ctx, method, &req.params); @@ -1219,7 +1220,14 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context, req: &ControlReques err(format!("internal error: {msg} (please report this bug)")) } }; - let Reply::Done(mut reply) = reply else { return reply }; + let mut reply = match reply { + Reply::Done(reply) => reply, + held @ Reply::AfterHeldOk { .. } => { + app.held_before = before; + return held; + } + other => return other, + }; hide_in_reply(app, &mut reply, &req.params, before); Reply::Done(reply) } @@ -1236,20 +1244,23 @@ pub(crate) struct HeldConfirm { params: Value, /// The dialog that a set with an `action` set, which the reply shows as `dialog`. dialog: Option, + /// The libraries hidden before the request ran ([`handle`]): the reply hides them too. + before: Hiding, } impl HeldConfirm { /// Holds the reply of `req`: the control channel answers the returned confirm in its place. `dialog` is the - /// dialog `req` set, for a set with an `action`. - pub(crate) fn hold(req: &mut ControlRequest, dialog: Option) -> Self { + /// dialog `req` set, for a set with an `action`, and `before` the libraries hidden before `req` ran. + pub(crate) fn hold(req: &mut ControlRequest, dialog: Option, before: Hiding) -> Self { let (to_confirm, answer) = std::sync::mpsc::channel(); let reply = std::mem::replace(&mut req.reply, to_confirm); - Self { answer, reply, params: req.params.clone(), dialog } + Self { answer, reply, params: req.params.clone(), dialog, before } } /// Sends the control channel's answer on as the request's reply: inside `{dialog, result}` for a set with an - /// `action`, and under a read root with what `hiding` returns hidden, as [`handle`] hides a reply it sends at once. - /// `hiding` is called only for an answer sent under a read root. True while the answer has not come. + /// `action`, and under a read root with the libraries hidden before the request ran and what `hiding` returns + /// hidden, as [`handle`] hides a reply it sends at once. `hiding` is called only for an answer sent under a read + /// root that holds a `/`, `\` or `%`. True while the answer has not come. pub(crate) fn forward<'a>(&self, hiding: impl FnOnce() -> &'a Hiding) -> bool { let answer = match self.answer.try_recv() { Ok(answer) => answer, @@ -1260,8 +1271,10 @@ impl HeldConfirm { Some(dialog) => answered_set(dialog.clone(), answer), None => answer, }; - if vectorcraft_engine::file_access::current().is_some() { - hiding().hide(&mut reply, &self.params); + if vectorcraft_engine::file_access::current().is_some() && holds_a_separator(&reply) { + let mut hiding = hiding().clone(); + hiding.merge(self.before.clone()); + hiding.hide(&mut reply, &self.params); } let _ = self.reply.send(reply); false diff --git a/crates/ui-egui/src/control/tests.rs b/crates/ui-egui/src/control/tests.rs index 677e67df3b..ae1fef71ea 100644 --- a/crates/ui-egui/src/control/tests.rs +++ b/crates/ui-egui/src/control/tests.rs @@ -762,6 +762,34 @@ fn a_held_confirm_answers_when_its_dialog_closes_first() { assert!(app.held_confirms.is_empty(), "no confirm waits"); } +/// Under a read root, a confirm's reply held on a dialog's OK shows a library the request could not read by the id +/// `ui.inspect` shows for it, even when the library is no longer in use once the app answers. +#[test] +fn a_held_confirm_hides_a_library_hidden_when_it_was_sent() { + let root = crate::tests_folder::Folder::new("held-before-root"); + let roots = vectorcraft_engine::file_access::AutomationRoots::new(&[root.as_path()], &[]).unwrap(); + let path = std::env::temp_dir().join("vc-held-before").join("b.svg").to_string_lossy().into_owned(); + let id = format!("loaded/{path}"); + let (tx, rx) = std::sync::mpsc::channel(); + let mut app = crate::testing::windowed(VectorcraftApp::new(Session::new(), Services::default()).with_control(rx).with_automation_roots(roots)); + let ctx = app.ui_ctx.clone().unwrap(); + app.ui.color_guide_limit = id.clone(); + crate::dialogs::action_set_options::open_new(&mut app); + let dialog = craft::ui::dialog::dialog_id("actionSetOptions"); + app.dialogs().unwrap().with(|h| h.set_json_field(&ctx, dialog, "name", json!(format!("from {id}")))).unwrap(); + let (req, reply) = ControlRequest::new("ui.dialog.set", json!({"fields": [], "action": "confirm"})); + tx.send(req).unwrap(); + // A pass that runs only the app's logic answers the request, but not the held OK. + crate::testing::part_frame(&mut app, &ctx, egui::RawInput::default(), |app, ui| app.tick(ui.ctx())); + assert!(reply.try_recv().is_err(), "the reply waits for the app's answer"); + app.ui.color_guide_limit.clear(); + crate::testing::app_frame(&mut app, &ctx, egui::RawInput::default()); + let r = reply.try_recv().expect("the confirm replies once the app accepts it"); + assert_eq!(r["ok"], true, "{r}"); + assert_eq!(r["result"]["dialog"]["fields"]["name"], "from loaded/b.svg", "{r}"); + assert!(app.held_confirms.is_empty(), "no confirm waits"); +} + /// #1004: `ui.render` (the MCP `screenshot` of a connected app) renders the artboard asked /// for, at the scale asked for; the first without one. #[test] diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index c066f803e1..41d8f8f00c 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -182,6 +182,9 @@ pub struct VectorcraftApp { /// The dialog that the request [`control::handle`] answered last set with `action: "confirm"`, when that confirm /// filed the dialog's held OK: its reply shows it as `dialog` ([`control::HeldConfirm`]). pub(crate) held_set: Option, + /// The libraries hidden before the request [`control::handle`] answered last ran, when its confirm filed a + /// dialog's held OK: its reply hides them as well as those hidden when it is sent ([`control::HeldConfirm`]). + pub(crate) held_before: control::Hiding, /// The confirms whose replies wait for the app's answer to a dialog's held OK. pub(crate) held_confirms: Vec, /// Where a control-channel Rotate View drag began, kept between its requests. diff --git a/crates/ui-egui/src/tests/automation.rs b/crates/ui-egui/src/tests/automation.rs index 65605a9e1f..6f5d836961 100644 --- a/crates/ui-egui/src/tests/automation.rs +++ b/crates/ui-egui/src/tests/automation.rs @@ -169,7 +169,7 @@ fn a_held_confirm_hides_the_paths_outside_the_read_root() { let outside = s(base.join("outside/b.svg")); let params = json!({"fields": [{"field": "file", "value": outside}], "action": "confirm"}); let (mut req, reply) = ControlRequest::new("ui.dialog.set", params); - app.held_confirms.push(crate::control::HeldConfirm::hold(&mut req, None)); + app.held_confirms.push(crate::control::HeldConfirm::hold(&mut req, None, crate::control::Hiding::default())); // The control channel answers the held confirm with the app's refusal. req.reply.send(json!({"ok": false, "error": format!("cannot read {outside}")})).unwrap(); app.poll_held(); From 6ddb2210ac8f60d7eede8b709b0156451d55b887 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 3 Dec 2026 07:24:58 -0800 Subject: [PATCH 21/29] Dialogs: a Preferences set with an action hides the folders outside the read root A `ui.dialog.set` with an `action` on the Preferences dialog replied with the dialog's whole draft, so a folder preference outside the read root showed its path, while `ui.inspect` leaves the same field out. `preferences_method` now runs `leave_out_unreadable_folders` on the snapshot under a read root, and `docs/mcp.md`'s `answer_dialog` row says so. --- crates/ui-egui/src/control.rs | 13 +++++++++++-- crates/ui-egui/src/tests/automation.rs | 19 +++++++++++++++++++ docs/mcp.md | 2 +- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index d995f5d5cb..9f279b8a17 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -1765,8 +1765,17 @@ fn preferences_method(app: &mut VectorcraftApp, method: &str, p: &Value) -> Resu crate::prefs_dialog::set_field(app, &field, value)?; } // A set with an `action` replies `{dialog, result}`: the window as the set left it, as `ui.inspect` shows it, and - // the answer's result. - let dialog = (method == "ui.dialog.set" && action.is_some()).then(|| json!({"kind": "preferences", "fields": crate::prefs_dialog::fields(app)})); + // the answer's result. Under a read root, the folder preferences the request may not read are left out, as + // `ui.inspect` leaves them out. + let dialog = (method == "ui.dialog.set" && action.is_some()).then(|| { + let mut fields = crate::prefs_dialog::fields(app); + if vectorcraft_engine::file_access::current().is_some() + && let Some(fields) = fields.as_mut() + { + leave_out_unreadable_folders(fields); + } + json!({"kind": "preferences", "fields": fields}) + }); let result = match action { Some("confirm") => crate::prefs_dialog::confirm(app)?, Some(_) => { diff --git a/crates/ui-egui/src/tests/automation.rs b/crates/ui-egui/src/tests/automation.rs index 6f5d836961..6242fcf9b1 100644 --- a/crates/ui-egui/src/tests/automation.rs +++ b/crates/ui-egui/src/tests/automation.rs @@ -181,6 +181,25 @@ fn a_held_confirm_hides_the_paths_outside_the_read_root() { let _ = std::fs::remove_dir_all(base); } +/// A `ui.dialog.set` with an `action` on Preferences replies with the dialog's fields as `ui.inspect` +/// shows them: a folder preference outside the read root is left out. +#[test] +fn a_preferences_set_with_an_action_hides_the_folders_outside_the_read_root() { + let (mut app, tx, base) = confined("prefs-set-action"); + let (inside, outside) = (s(base.join("in")), s(base.join("outside"))); + crate::prefs_dialog::open(&mut app, None); + // The person types the folder: their request is not confined. + let (fill, _) = ControlRequest::new("ui.dialog.set", json!({"fields": [{"field": "templatesFolder", "value": outside}]})); + let Reply::Done(filled) = crate::control::handle(&mut app, &crate::testing::ui_context(), &fill) else { panic!("deferred") }; + assert_eq!(filled["ok"], true, "{filled}"); + let params = json!({"dialog": "preferences", "fields": [{"field": "fontsFolder", "value": inside}], "action": "cancel"}); + let r = request(&mut app, &tx, "ui.dialog.set", params); + let fields = r["result"]["dialog"]["fields"].as_object().unwrap_or_else(|| panic!("no fields: {r}")); + assert_eq!((fields["fontsFolder"].as_str(), fields.get("templatesFolder")), (Some(inside.as_str()), None), "{r}"); + assert!(!r.to_string().contains(&outside), "no path outside the root: {r}"); + let _ = std::fs::remove_dir_all(base); +} + /// In one session with a library loaded from outside the read root: the library keeps its file-name /// id, a reply that names its path shows the file name, a save without a path leaves out the /// document's file, and a save or export to a path the client gave in the write root keeps that path diff --git a/docs/mcp.md b/docs/mcp.md index 1419fc3194..11ff74c586 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -815,7 +815,7 @@ ends the wait, so the sampler can be shown again. The BSDs and headless sessions | `set_paint` | `{fill?, stroke?, strokeWidth?, ids?}` | Applies to the selection (or `ids`) and becomes the default for new art. Returns `{applied, objects}`: `objects` is the number of objects painted, as the `objects` of the `paint.setFill`, `paint.setStroke` and `stroke.set` replies (the largest of them): a selected group counts the objects inside it. When it is 0, a `note` says that only the paint for new art changed. When some of those commands painted objects and others painted none (a fill while the Shape Builder is the active tool, say), `unpainted` lists the commands that painted none, with a `note`. | | `press_key` | `{key, mods?}` | Remote: a real key event. Headless: runs the command or tool bound to that shortcut, or sends the key to the busy tool (digits too: `5` while dragging with the Perspective Selection tool; `e` while dragging a Selection or Group Selection marquee; `c` and `f` while dragging out an arc; `f`, `v`, `x` and `c` while dragging out a rectangular or polar grid). | | `type_text` | `{text}` | Remote only. | -| `answer_dialog` | `{set?: [{field, value?}], action?}` | Remote only. Sets fields of the app's open dialog in the order given with one `ui.dialog.set {fields, action?}` (a missing `value` is `null`). The app stores all of them or none, then answers that same dialog with `action` in the same request: `confirm` (OK) or `cancel`. Another connection cannot open a dialog between the two steps. When the app refuses the `ui.dialog.set`, for example because no dialog is open, the call is an error and the dialog is not confirmed or canceled. `set` cannot change a `__` field other than the dialog's controls held under a `__` name (such as Save PDF's `__section` or the Preferences `__search`): the `__command` and `__params` of a `confirm` or `command` dialog, and every other `__` field that holds what OK acts on, are refused with "the `` dialog cannot set protected field ``", so OK runs what the dialog was opened for. `action` alone is sent as `ui.dialog.confirm` or `ui.dialog.cancel`. Give `set`, `action` or both; `set` holds at most 256 fields. `inspect_ui` shows the open dialog and its fields as `ui.dialog`. Returns `{dialog, result}`: the dialog after the fields were set (or `null`) and the reply to `confirm` or `cancel` (or `null`). After `invoke_menu` `app.quit`, `file.close` or `file.closeAll` replies `{"pending": "saveChanges"}`, `{action: "confirm"}` saves, `{set: [{field: "discard", value: true}], action: "confirm"}` closes without saving and `{action: "cancel"}` cancels the close or quit. | +| `answer_dialog` | `{set?: [{field, value?}], action?}` | Remote only. Sets fields of the app's open dialog in the order given with one `ui.dialog.set {fields, action?}` (a missing `value` is `null`). The app stores all of them or none, then answers that same dialog with `action` in the same request: `confirm` (OK) or `cancel`. Another connection cannot open a dialog between the two steps. When the app refuses the `ui.dialog.set`, for example because no dialog is open, the call is an error and the dialog is not confirmed or canceled. `set` cannot change a `__` field other than the dialog's controls held under a `__` name (such as Save PDF's `__section` or the Preferences `__search`): the `__command` and `__params` of a `confirm` or `command` dialog, and every other `__` field that holds what OK acts on, are refused with "the `` dialog cannot set protected field ``", so OK runs what the dialog was opened for. `action` alone is sent as `ui.dialog.confirm` or `ui.dialog.cancel`. Give `set`, `action` or both; `set` holds at most 256 fields. `inspect_ui` shows the open dialog and its fields as `ui.dialog`. Returns `{dialog, result}`: the dialog after the fields were set (or `null`; under a read root, Preferences leaves out the folder preferences outside it, as `inspect_ui` does) and the reply to `confirm` or `cancel` (or `null`). After `invoke_menu` `app.quit`, `file.close` or `file.closeAll` replies `{"pending": "saveChanges"}`, `{action: "confirm"}` saves, `{set: [{field: "discard", value: true}], action: "confirm"}` closes without saving and `{action: "cancel"}` cancels the close or quit. | | `invoke_menu` | `{command, params?}` | Invokes a menu item by command id. UI commands such as `view.*` and `window.*` are in `command_list` with `ui: true`; running them needs the desktop app (`--connect`). The app refuses `attributes.openUrl`, `file.export.svg.browser`, `file.saveForWeb.browser` and `file.showPackage` for every control and MCP request, since each opens another app, so the headless error for them does not suggest `--connect`. | | `open_panel` | `{panel}` | Remote only. `panel` is a panel id (`layers`, `swatches`, `colorGuide`, …, as `window.panel` takes) or its display label (`"Color Guide"`), in any case. | | `screenshot` | `{path?, scale?, artboard?, window?, max_side?, traceViews?}` | Returns MCP image content (`image/png`, base64) plus a text block. Renders the artboard with the pixels of a PNG `export` with `background: "white"` at the same scale; `traceViews:true` draws Image Trace objects in the view set with `imageTrace.setView`, as in the app's window; `window:true` captures the app window (remote only), as `ui_screenshot` does, and `max_side` (1–4096, window captures only) scales the returned image down as described for `ui_screenshot`. With `path` the backend (the headless session or the app) writes the PNG there too; a window capture written there keeps its full size with `max_side`. An app that does not send the image back writes a window capture without `path` to a file in a new folder inside the system's temporary folder (on Unix only the user can open it); the server reads the file and then removes the folder, also when the capture or the read fails. | From 0fb0dd49b6a6b92917f306d6703a314a3bc6df6a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 3 Dec 2026 08:47:46 -0800 Subject: [PATCH 22/29] Docs: progress line for replies to a confirm of a held OK --- docs/target-app-parity.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index f96e28264f..cb94339902 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -42,6 +42,7 @@ Native saves on Unix flush the destination directory after writing or replacing ## Feature submission evidence - Command dialogs can keep the uid of the document they edit. Their preview, confirmation, and cancellation do not change another active document. Tests cover confirmation in the original and another document, unscoped dialogs, and invalid document ids. +- A control-channel confirm of a dialog that holds its OK (`ui.dialog.confirm`, or `ui.dialog.set` with `action: "confirm"`) replies once the app accepts or refuses the OK, with the app's answer, and a set with an `action` that the app accepts replies `{dialog, result}`, while a refused one replies with the app's error alone. Tests: `crates/ui-egui/src/control/tests.rs`, `crates/ui-egui/src/tests/automation.rs`. Scores and estimates unchanged. Document Info › Objects reports total enclosed area (`pathArea` in square points) for eligible closed paths and compound paths according to their fill rule, subtracting holes and excluding guides and open paths, with duplicate nested compound geometry avoided. The Document Info panel inserts a formatted `Path Area` row in the document's active units (`Unit::format_area`) right after `Path Length` whenever the total area is positive. The area pass runs only for a request that covers the Objects category: `document.info` with another `category`, or with `pathArea: false`, skips it and gives `pathArea` as null, and the panel asks for the area only while it shows Objects or All Categories, so edits made with another category shown do not work it out again. Focused tests: `cmd::docinfo::tests::info_gives_the_paths_total_area`, `info_path_area_counts_selected_compound_members_once` and `info_works_out_the_path_area_only_for_the_objects_category` (vectorcraft-engine), `panels::doc_info::tests::the_path_area_is_worked_out_only_while_objects_is_shown` (vectorcraft-ui-egui) and `units::tests::format_area_formats_and_trims_cleanly` (vectorcraft-doc). Scores and estimates unchanged. From 87df9fdd55ddaa5683d5191bc769b83f5f64600e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 06:24:00 -0800 Subject: [PATCH 23/29] Blend: Ramp and Shift keep an unfinished value with their blend without the craft-libs pin The craft-libs revision goes back to the one main pins (77ade517), so this pull request no longer depends on an unmerged craft-libs head. Steps and Distance keep NumberField::edit_target, which that revision has. Ramp and Shift use SliderField, whose edit_target is in storytold/craft-libs#5024. Until the pin includes it, the panel gives the slider field a new id salt when the edit target changes while its number field holds the focus, so an unfinished value is dropped and never committed to the newly selected blend. The focus moves to the new number field, or to the new track after Shift+Tab onto it. A primary press on the row in that frame focuses the child under it; a drag or the track's keyboard focus keeps the id. New tests cover a valid draft and a Tab, Shift+Tab onto the track, a press on the same row and on another field in the frame of the change, a secondary press, a disabled Ramp, a return to the first blend, and a drag across a selection change. --- Cargo.lock | 176 +++++++-------- Cargo.toml | 78 +++---- apps/vectorcraft-web/Cargo.toml | 2 +- crates/ui-egui/src/panels/blend.rs | 86 +++++++- crates/ui-egui/src/panels/tests_blend.rs | 251 ++++++++++++++++++++++ crates/ui-egui/src/tests/panel_harness.rs | 22 ++ xtask/src/pdf_deps.rs | 2 +- 7 files changed, 486 insertions(+), 131 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ceafc18e22..be4b734a08 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-automation", "craft-behavior", @@ -1272,7 +1272,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "crc32fast", "flate2", @@ -1283,7 +1283,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1295,7 +1295,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "rustix 1.1.6", ] @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1346,7 +1346,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-docpath", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "crc32fast", "flate2", @@ -1373,7 +1373,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "egui", ] @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "md-5", "rayon", @@ -1390,12 +1390,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-cms", @@ -1415,7 +1415,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-control-protocol", "craft-platform", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1436,7 +1436,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "rayon", ] @@ -1444,7 +1444,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "blake3", "craft-ecproj-format", @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", ] @@ -1494,7 +1494,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-codepage", "encoding_rs", @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", "serde_json", @@ -1535,12 +1535,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1583,7 +1583,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "cap-primitives", "craft-atomic", @@ -1606,12 +1606,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "gif", ] @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", ] @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1640,7 +1640,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-dds", "craft-jpeg", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1715,7 +1715,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "thiserror 2.0.21", ] @@ -1723,7 +1723,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-host", "craft-i18n", @@ -1749,7 +1749,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-i18n", @@ -1763,7 +1763,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -1781,7 +1781,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "encoding_rs", "image", @@ -1804,7 +1804,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "chrono", "craft-codepage", @@ -1814,7 +1814,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "uds_windows", "winsafe", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-keymap", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "craft-pbr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-texture", "thiserror 2.0.21", @@ -1848,7 +1848,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", "serde", @@ -1859,7 +1859,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1871,7 +1871,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "async-channel", "async-io", @@ -1904,7 +1904,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1913,7 +1913,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -1937,7 +1937,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1948,7 +1948,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-eps", "flate2", @@ -1962,7 +1962,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "encoding_rs", "flate2", @@ -1973,7 +1973,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "dispatch2", "egui", @@ -1986,7 +1986,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -2005,7 +2005,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-atomic", "craft-host", @@ -2022,7 +2022,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "fax", "hayro-ccitt", @@ -2033,7 +2033,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2054,7 +2054,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2066,7 +2066,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2091,7 +2091,7 @@ dependencies = [ [[package]] name = "craft-texture" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "thiserror 2.0.21", ] @@ -2099,7 +2099,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2114,7 +2114,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-atomic", "craft-behavior", @@ -2129,7 +2129,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2139,7 +2139,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2148,7 +2148,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2163,12 +2163,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2182,7 +2182,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2199,7 +2199,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "accesskit", "craft-behavior", @@ -2237,7 +2237,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2248,7 +2248,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2266,7 +2266,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2287,7 +2287,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2308,7 +2308,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-behavior", "craft-host", @@ -2327,7 +2327,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.22.1", "chrono", @@ -2359,7 +2359,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", "serde", @@ -2370,7 +2370,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2380,7 +2380,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "js-sys", "serde_json", @@ -2391,7 +2391,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "winsafe", ] @@ -2399,7 +2399,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "craft-appkit", "craft-atomic", @@ -2431,7 +2431,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3791,7 +3791,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3800,7 +3800,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3818,7 +3818,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3836,12 +3836,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "flate2", "hayro-ccitt", @@ -4824,7 +4824,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4981,7 +4981,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=40b2b1e56ef5f02a313877976290617cb6da8576#40b2b1e56ef5f02a313877976290617cb6da8576" +source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index ab24a0aaf7..7dab0c8895 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,53 +10,53 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # The metallic-roughness BRDF and environment light the 3D effects' Roughness and Metallic shade with. -craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -196,13 +196,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } emath = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } epaint = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 0c5a87c101..70aae32f73 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "40b2b1e56ef5f02a313877976290617cb6da8576", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/ui-egui/src/panels/blend.rs b/crates/ui-egui/src/panels/blend.rs index 2d44e8a91a..5c24cf2fd6 100644 --- a/crates/ui-egui/src/panels/blend.rs +++ b/crates/ui-egui/src/panels/blend.rs @@ -19,6 +19,7 @@ use craft::ui::form::{Field, FieldGroup}; use craft::ui::form::{SliderField, SliderFieldLayout}; use craft::ui::layout_components::Row; use craft::ui::pickers::Select; +use craft::ui::runtime::focus::{self, FocusTarget}; use craft::ui::text::NumberField; use egui::Ui; use serde_json::{Value, json}; @@ -83,7 +84,7 @@ fn spacing_params(mode: &str, steps: f64, distance: f64) -> Value { /// The Ramp or Shift slider: `key` of `object.blend.options` as a percentage over `range`. A drag /// previews the selected blends and its release records one undo step; a change without a drag, /// from the keyboard, records one at once. A value typed into its field and not yet committed is -/// dropped when the [`EditTarget`] changes. +/// dropped when the [`EditTarget`] changes, and an enabled field keeps the focus. fn percent_slider( app: &mut VectorcraftApp, ui: &mut Ui, @@ -96,13 +97,81 @@ fn percent_slider( let target = edit_target(app); Field::new(label).enabled(on).show(ui, |ui, _| { let shown = value.unwrap_or(0.0).clamp(*range.start(), *range.end()); + // Until the craft-libs pin includes storytold/craft-libs#5024 (`SliderField::edit_target`), + // which then replaces this: when the edit target changes, the slider field gets a new id salt + // only if its number field held focus in the last pass or holds it now, so an unfinished + // value is dropped and never committed to the new target. Otherwise its id stays the same, + // including during a drag. When the id changes, the focus moves to the new track if the old + // track holds it now, or to the new number field if the old number field holds it now. + // Other focus moves keep their destination. + let held = ui.scope_id().with(("blend-percent-target", key)); + let mut kept = ui.ctx().data(|d| d.get_temp::(held)).unwrap_or_default(); + let previous_round = kept.round; + if kept.target != target { + kept.target = target.clone(); + let ctx = ui.ctx(); + let track_focused = kept.track.is_some_and(|id| focus::has(ctx, id)); + let typed_focused = kept.typed.is_some_and(|id| focus::has(ctx, id)); + if kept.typed_focused || typed_focused { + kept.round = kept.round.wrapping_add(1); + kept.hand_off = if track_focused { + Some("slider") + } else if typed_focused { + Some("field") + } else { + None + }; + } + } let out = SliderField::new(label, Bind::given(shown), range.clone()) .layout(SliderFieldLayout::Inline) .unit("%") .step(1.0) .enabled(on) - .edit_target(&target) + .id_salt(("blend-percent", key, kept.round)) .show(ui); + // The slider field's children are keyed "slider" (the track) and "field" (the number field + // that takes typing). A measuring pass moves no focus, so the hand-off waits for a pass that + // does. + let typed = out.edit.response.id.with("field"); + // Disabled children have no focus stop. A request for one can outlive this target. + if !on { + kept.hand_off = None; + } else if ui.input(|i| i.pointer.any_pressed()) { + // Pointer focus moves settle at the end of the pass against the old ids. When these + // children are replaced, a primary press on the visible part of the row, on this layer, + // focuses the new child under it, even if released in this frame. Other button presses + // cancel the hand-off. SliderField exposes only the whole response; response_of supplies + // its child rects. A track press gets focus, but its drag cannot start on the replacement + // this frame. + let pressed = ui.input(|i| { + i.events.iter().find_map(|event| match event { + egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed: true, .. } => Some(*pos), + _ => None, + }) + }); + kept.hand_off = if previous_round != kept.round || kept.hand_off.is_some() { + let on_row = |at: &egui::Pos2| { + out.edit.response.rect.contains(*at) && ui.clip_rect().contains(*at) && ui.ctx().layer_id_at(*at) == Some(ui.layer_id()) + }; + pressed.filter(on_row).and_then(|at| { + ["field", "slider"].into_iter().find(|child| { + craft::ui::contract::response_of(ui, out.edit.response.id.with(child)).is_some_and(|response| response.rect.contains(at)) + }) + }) + } else { + None + }; + } + if let Some(child) = kept.hand_off + && focus::request(ui.ctx(), FocusTarget::Id(out.edit.response.id.with(child))) + { + kept.hand_off = None; + } + kept.typed_focused = focus::has(ui.ctx(), typed); + kept.typed = Some(typed); + kept.track = Some(out.edit.response.id.with("slider")); + ui.ctx().data_mut(|d| d.insert_temp(held, kept)); apply_edits(app, &out.edit, EditPath::Preview, |app, v, phase| { crate::panels::live_run(app, "Blend Options", "object.blend.options", json!({ key: *v }), phase); }); @@ -114,6 +183,19 @@ fn percent_slider( /// field drops an unfinished value when this changes, even where the new blend has the same value. type EditTarget = Option<(u64, u64, Vec)>; +/// What the Ramp or Shift slider field keeps between passes: the [`EditTarget`] it last showed, the +/// round its id salt is on, the ids of its number field and its track, whether its number field +/// held focus in the last pass, and the child that still needs focus in a new round. +#[derive(Clone, Default)] +struct PercentField { + target: EditTarget, + round: u64, + typed: Option, + track: Option, + typed_focused: bool, + hand_off: Option<&'static str>, +} + /// The [`EditTarget`] of the active document. fn edit_target(app: &VectorcraftApp) -> EditTarget { let st = app.session.active()?; diff --git a/crates/ui-egui/src/panels/tests_blend.rs b/crates/ui-egui/src/panels/tests_blend.rs index 4fd2b7ecd5..7d4e2a4141 100644 --- a/crates/ui-egui/src/panels/tests_blend.rs +++ b/crates/ui-egui/src/panels/tests_blend.rs @@ -325,6 +325,257 @@ fn an_unfinished_ramp_or_shift_value_does_not_reach_another_blend() { } } +#[test] +fn a_disabled_ramp_drops_its_draft_and_does_not_take_focus_when_enabled_again() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + let (mut app, a, b) = two_blends(json!({"smooth": true, "createSpine": "never"})); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + app.run("object.blend.options", json!({"ramp": 30})).unwrap(); + let (before_a, before_b, depth) = (spec(&app, a), spec(&app, b), undo_depth(&app)); + let mut p = Panel::new(app, show); + p.click_role("Ramp:", Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("12"); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.frame(); + assert!(!p.enabled("Ramp:"), "the blend without a spine disables Ramp"); + assert_eq!(spec(&p.app(), a), before_a, "disabling Ramp leaves a's draft uncommitted"); + assert_eq!(spec(&p.app(), b), before_b, "disabling Ramp leaves b unchanged"); + p.app().run("select.set", json!({"ids": [a.0]})).unwrap(); + p.frame(); + p.frame(); + assert!(p.enabled("Ramp:"), "the blend with a spine enables Ramp again"); + assert!(!p.focused_role("Ramp:", Role::SPIN_BUTTON), "enabling Ramp does not return focus to its number field"); + assert!(!p.focused_role("Ramp:", Role::SLIDER), "enabling Ramp does not return focus to its track"); + p.type_text("7"); + p.key(Key::Enter, Modifiers::NONE); + assert_eq!(spec(&p.app(), a), before_a, "a keeps 30 without an explicit focus move to Ramp"); + assert_eq!(spec(&p.app(), b), before_b, "the draft never changes b"); + assert_eq!(undo_depth(&p.app()), depth, "dropping the draft adds no undo step"); +} + +#[test] +fn an_unfinished_ramp_or_shift_value_is_gone_when_its_blend_is_selected_again() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + // `3+` typed for `a`, `b` selected, then `a` selected again: the field shows a's value, and `1` and Enter give 1. + let (mut app, a, b) = two_blends(json!({"smooth": true, "orientation": "path"})); + app.run("object.blend.options", json!({"ramp": 30, "colorShift": 30})).unwrap(); + let mut p = Panel::new(app, show); + for name in ["Ramp:", "Shift:"] { + let value = |s: &BlendSpec| if name == "Ramp:" { s.ease.ramp * 100.0 } else { s.color_shift }; + p.app().run("select.set", json!({"ids": [a.0]})).unwrap(); + p.frame(); + p.click_role(name, Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("3+"); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.frame(); + p.app().run("select.set", json!({"ids": [a.0]})).unwrap(); + p.frame(); + assert_ne!(p.value_role(name, Role::SPIN_BUTTON).as_deref(), Some("3+"), "{name} drops the value typed for a before b was selected"); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let (at_a, at_b) = { + let app = p.app(); + (value(&spec(&app, a)), value(&spec(&app, b))) + }; + assert!((at_a - 1.0).abs() < 1e-9 && (at_b - 30.0).abs() < 1e-9, "{name} a takes 1, not 3+1, and b keeps 30: {at_a} {at_b}"); + } +} + +#[test] +fn a_tab_in_the_frame_that_selects_another_blend_drops_the_unfinished_value_and_moves_the_focus_on() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + // `12` typed into Ramp for `a` and not committed; `b` is selected and Tab pressed in the same frame. Neither blend + // takes 12, and the focus leaves Ramp, so the next digits and Enter do not change b's Ramp either. + let (mut app, a, b) = two_blends(json!({"smooth": true, "orientation": "path"})); + app.run("object.blend.options", json!({"ramp": 30, "colorShift": 30})).unwrap(); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + let mut p = Panel::new(app, show); + p.click_role("Ramp:", Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("12"); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.key(Key::Tab, Modifiers::NONE); + p.frame(); + let ramps = |p: &Panel| { + let app = p.app(); + (spec(&app, a).ease.ramp, spec(&app, b).ease.ramp) + }; + let (at_a, at_b) = ramps(&p); + assert!((at_a - 0.3).abs() < 1e-9 && (at_b - 0.3).abs() < 1e-9, "the Tab commits 12 to neither blend: {at_a} {at_b}"); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("7"); + p.key(Key::Enter, Modifiers::NONE); + let (at_a, at_b) = ramps(&p); + assert!((at_a - 0.3).abs() < 1e-9 && (at_b - 0.3).abs() < 1e-9, "Ramp keeps 30 on a and b after the Tab: {at_a} {at_b}"); +} + +#[test] +fn a_shift_tab_to_the_track_while_selecting_another_blend_drops_the_number_draft() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + for name in ["Ramp:", "Shift:"] { + let (mut app, a, b) = two_blends(json!({"smooth": true, "orientation": "path"})); + app.run("object.blend.options", json!({"ramp": 30, "colorShift": 30})).unwrap(); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + let mut p = Panel::new(app, show); + p.click_role(name, Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("12"); + let (before_a, before_b, depth) = { + let app = p.app(); + (spec(&app, a), spec(&app, b), undo_depth(&app)) + }; + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.key(Key::Tab, Modifiers::SHIFT); + assert_eq!(spec(&p.app(), a), before_a, "{name} leaves a unchanged"); + assert_eq!(spec(&p.app(), b), before_b, "{name} drops the draft instead of committing it to b on Shift+Tab"); + assert_eq!(undo_depth(&p.app()), depth, "{name} drops the draft without an undo step"); + assert!(p.focused_role(name, Role::SLIDER), "{name} keeps focus on its track"); + p.key(Key::ArrowRight, Modifiers::NONE); + assert_eq!(spec(&p.app(), a), before_a, "{name} leaves a unchanged after the arrow key"); + assert_ne!(spec(&p.app(), b), before_b, "{name} moves b with the focused track's arrow key"); + } +} + +#[test] +fn a_click_in_the_frame_that_selects_another_blend_keeps_the_focus_it_gives() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + // `12` typed into Ramp for `a` and not committed; `b` is selected and Shift's number field clicked in the same + // frame. Ramp keeps 30 on both blends, and the typing that follows goes to b's Shift. + let (mut app, a, b) = two_blends(json!({"smooth": true, "orientation": "path"})); + app.run("object.blend.options", json!({"ramp": 30, "colorShift": 30})).unwrap(); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + let mut p = Panel::new(app, show); + p.click_role("Ramp:", Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("12"); + let shift = p.rect_role("Shift:", Role::SPIN_BUTTON).center(); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.press_at_next_frame(shift); + p.release(); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("7"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + let (ramp_a, ramp_b, shift_b) = (spec(&app, a).ease.ramp, spec(&app, b).ease.ramp, spec(&app, b).color_shift); + assert!((ramp_a - 0.3).abs() < 1e-9 && (ramp_b - 0.3).abs() < 1e-9, "Ramp keeps 30 on a and b: {ramp_a} {ramp_b}"); + assert!((shift_b - 7.0).abs() < 1e-9, "the click gives the focus to Shift, which takes 7 on b: {shift_b}"); +} + +#[test] +fn a_click_on_ramp_while_selecting_another_blend_focuses_its_replacement_number_field() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + let (mut app, a, b) = two_blends(json!({"smooth": true, "orientation": "path"})); + app.run("object.blend.options", json!({"ramp": 30})).unwrap(); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + let mut p = Panel::new(app, show); + p.click_role("Ramp:", Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("12"); + let ramp = p.rect_role("Ramp:", Role::SPIN_BUTTON).center(); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.press_at_next_frame(ramp); + p.release(); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("7"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + let (at_a, at_b) = (spec(&app, a).ease.ramp, spec(&app, b).ease.ramp); + assert!((at_a - 0.3).abs() < 1e-9, "a keeps 30 after the draft is dropped: {at_a}"); + assert!((at_b - 0.07).abs() < 1e-9, "the same-row click focuses b's Ramp, which takes 7: {at_b}"); +} + +#[test] +fn a_same_frame_click_on_ramp_while_selecting_another_blend_focuses_its_replacement_number_field() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + let (mut app, a, b) = two_blends(json!({"smooth": true, "orientation": "path"})); + app.run("object.blend.options", json!({"ramp": 30})).unwrap(); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + let mut p = Panel::new(app, show); + p.click_role("Ramp:", Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("12"); + let ramp = p.rect_role("Ramp:", Role::SPIN_BUTTON).center(); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.click_at_next_frame(ramp); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("7"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + let (at_a, at_b) = (spec(&app, a).ease.ramp, spec(&app, b).ease.ramp); + assert!((at_a - 0.3).abs() < 1e-9, "a keeps 30 after the draft is dropped: {at_a}"); + assert!((at_b - 0.07).abs() < 1e-9, "the same-frame click focuses b's Ramp, which takes 7: {at_b}"); +} + +#[test] +fn a_secondary_press_on_ramp_while_selecting_another_blend_drops_its_draft_without_taking_focus() { + use craft::ui::contract::Role; + use egui::{Event, Key, Modifiers, PointerButton}; + let (mut app, a, b) = two_blends(json!({"smooth": true, "orientation": "path"})); + app.run("object.blend.options", json!({"ramp": 30})).unwrap(); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + let mut p = Panel::new(app, show); + p.click_role("Ramp:", Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("12"); + let ramp = p.rect_role("Ramp:", Role::SLIDER).center(); + let (before_a, before_b, depth) = { + let app = p.app(); + (spec(&app, a), spec(&app, b), undo_depth(&app)) + }; + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.frame_with(vec![ + Event::PointerMoved(ramp), + Event::PointerButton { pos: ramp, button: PointerButton::Secondary, pressed: true, modifiers: Modifiers::NONE }, + ]); + assert!(!p.focused_role("Ramp:", Role::SPIN_BUTTON), "a secondary press does not focus Ramp's number field"); + assert!(!p.focused_role("Ramp:", Role::SLIDER), "a secondary press does not focus Ramp's track"); + p.frame_with(vec![Event::PointerButton { pos: ramp, button: PointerButton::Secondary, pressed: false, modifiers: Modifiers::NONE }]); + p.key(Key::Enter, Modifiers::NONE); + assert_eq!(spec(&p.app(), a), before_a, "the secondary press leaves a unchanged"); + assert_eq!(spec(&p.app(), b), before_b, "the secondary press drops the draft without committing it to b"); + assert_eq!(undo_depth(&p.app()), depth, "dropping the draft adds no undo step"); +} + +#[test] +fn a_ramp_drag_ends_and_the_track_keeps_the_focus_across_a_selection_change() { + use egui::{Key, Modifiers}; + // A Ramp drag on `a`, `b` selected before the release: by the release the drag has ended as one undo step on `a`, + // with no interaction left open. The track keeps the focus, so an arrow key then changes `b`. + let (mut app, a, b) = two_blends(json!({"smooth": true, "orientation": "path"})); + app.run("object.blend.options", json!({"ramp": 30})).unwrap(); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + let depth = undo_depth(&app); + let mut p = Panel::new(app, show); + p.drag_hold_role("Ramp:", craft::ui::contract::Role::SLIDER, egui::vec2(60.0, 0.0)); + assert!(p.app().session.in_interaction(), "the drag is in progress"); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.frame(); + p.release(); + assert!(!p.app().session.in_interaction(), "the drag has ended by the release"); + let (dragged, before_b) = { + let app = p.app(); + (spec(&app, a).ease.ramp, spec(&app, b).ease.ramp) + }; + assert!(dragged > 0.3, "the drag changed a: {dragged}"); + assert!((before_b - 0.3).abs() < 1e-9, "the drag left b alone: {before_b}"); + assert_eq!(undo_depth(&p.app()), depth + 1, "the drag is one undo step"); + p.key(Key::ArrowRight, Modifiers::NONE); + let (at_a, at_b) = { + let app = p.app(); + (spec(&app, a).ease.ramp, spec(&app, b).ease.ramp) + }; + assert!((at_a - dragged).abs() < 1e-9 && at_b > before_b, "the arrow key changes b, not a: {at_a} {at_b}"); +} + #[test] fn an_unfinished_steps_value_stays_with_its_blend_and_document() { use craft::ui::contract::Role; diff --git a/crates/ui-egui/src/tests/panel_harness.rs b/crates/ui-egui/src/tests/panel_harness.rs index 7521da7d8c..41f5553fe0 100644 --- a/crates/ui-egui/src/tests/panel_harness.rs +++ b/crates/ui-egui/src/tests/panel_harness.rs @@ -217,6 +217,23 @@ impl Panel { self.after(); } + /// Presses at `pos` in the next frame without a preceding hover frame and keeps the button down until [`Panel::release`]. + pub(crate) fn press_at_next_frame(&mut self, pos: Pos2) { + self.frame_with(vec![ + Event::PointerMoved(pos), + Event::PointerButton { pos, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE }, + ]); + } + + /// Clicks at `pos` with a primary press and release in the next frame, without a preceding hover frame. + pub(crate) fn click_at_next_frame(&mut self, pos: Pos2) { + self.frame_with(vec![ + Event::PointerMoved(pos), + Event::PointerButton { pos, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE }, + Event::PointerButton { pos, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE }, + ]); + } + /// Presses on the control named `name` and keeps the button down until [`Panel::release`]. pub(crate) fn press(&mut self, name: &str) { let target = self.find_aimed(name); @@ -510,6 +527,11 @@ impl Panel { self.fixture.tree().focused_key() == self.look(name).node } + /// Whether the control of `role` named `name` has the focus, where nodes of other roles share the name. + pub(crate) fn focused_role(&self, name: &str, role: Role) -> bool { + self.fixture.tree().focused_key() == self.look_role(name, role).node + } + /// Whether the zero-based control of `role` has focus, including rows with identical names. pub(crate) fn focused_nth(&self, role: craft::ui::contract::Role, index: usize) -> bool { self.fixture.tree().focused_key() == self.look_nth(role, index).node diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 113b654436..542a3e8c41 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "40b2b1e56ef5f02a313877976290617cb6da8576"; +const REV: &str = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From 437e3167521b84e3699a3537f86db8c55c3202aa Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 07:43:14 -0800 Subject: [PATCH 24/29] Blend: unfinished values follow the blend each selected object resolves to The draft key for Steps, Distance, Ramp and Shift now pairs each selected id with the blend it resolves to, or with none for a symbol-part selection. An unfinished value is dropped when the same selected objects lose their blend (Release) or resolve to another one, not only when the selected ids change. The panel resolves the key once per pass and reuses it until the document, its revision or revert count, the symbol part or the selected ids change. The Ramp and Shift arguments move into a small struct. --- crates/ui-egui/src/panels/blend.rs | 111 ++++++++++++++++----- crates/ui-egui/src/panels/tests_blend.rs | 122 +++++++++++++++++++++++ 2 files changed, 208 insertions(+), 25 deletions(-) diff --git a/crates/ui-egui/src/panels/blend.rs b/crates/ui-egui/src/panels/blend.rs index 5c24cf2fd6..d8f8a573c5 100644 --- a/crates/ui-egui/src/panels/blend.rs +++ b/crates/ui-egui/src/panels/blend.rs @@ -9,6 +9,7 @@ //! selected. Easing and Reverse Spine are dimmed for a blend made without a spine. use std::ops::RangeInclusive; +use std::sync::Arc; use craft::behavior::IconId; use craft::ui::buttons::Button; @@ -24,7 +25,7 @@ use craft::ui::text::NumberField; use egui::Ui; use serde_json::{Value, json}; use vectorcraft_doc::live::BlendSpineMode; -use vectorcraft_doc::{NodeId, NodeKind}; +use vectorcraft_doc::{NodeId, NodeKind, SymbolPart}; use super::selection_len; use crate::VectorcraftApp; @@ -81,20 +82,19 @@ fn spacing_params(mode: &str, steps: f64, distance: f64) -> Value { } } -/// The Ramp or Shift slider: `key` of `object.blend.options` as a percentage over `range`. A drag +/// The label, options key and percentage range for a Ramp or Shift slider. +struct PercentSlider { + label: &'static str, + key: &'static str, + range: RangeInclusive, +} + +/// The Ramp or Shift slider: `slider.key` of `object.blend.options` over `slider.range`. A drag /// previews the selected blends and its release records one undo step; a change without a drag, /// from the keyboard, records one at once. A value typed into its field and not yet committed is /// dropped when the [`EditTarget`] changes, and an enabled field keeps the focus. -fn percent_slider( - app: &mut VectorcraftApp, - ui: &mut Ui, - label: &'static str, - key: &'static str, - value: Option, - range: RangeInclusive, - on: bool, -) { - let target = edit_target(app); +fn percent_slider(app: &mut VectorcraftApp, ui: &mut Ui, target: &EditTarget, slider: PercentSlider, value: Option, on: bool) { + let PercentSlider { label, key, range } = slider; Field::new(label).enabled(on).show(ui, |ui, _| { let shown = value.unwrap_or(0.0).clamp(*range.start(), *range.end()); // Until the craft-libs pin includes storytold/craft-libs#5024 (`SliderField::edit_target`), @@ -107,7 +107,7 @@ fn percent_slider( let held = ui.scope_id().with(("blend-percent-target", key)); let mut kept = ui.ctx().data(|d| d.get_temp::(held)).unwrap_or_default(); let previous_round = kept.round; - if kept.target != target { + if &kept.target != target { kept.target = target.clone(); let ctx = ui.ctx(); let track_focused = kept.track.is_some_and(|id| focus::has(ctx, id)); @@ -178,10 +178,21 @@ fn percent_slider( }); } -/// What the Steps, Distance, Ramp and Shift fields edit, as their edit target: the document, how many times File › Revert replaced -/// its content, and the selected objects, whose blends `object.blend.info` and `object.blend.options` read and change. A -/// field drops an unfinished value when this changes, even where the new blend has the same value. -type EditTarget = Option<(u64, u64, Vec)>; +/// The Steps, Distance, Ramp and Shift draft key: the document uid, its File › Revert count, and +/// each selected object id paired with its nearest blend id, or None when it resolves to no blend. +/// Symbol-part selections resolve to no blend, as the Blend commands require. A field drops an +/// unfinished value when this key changes, even when the new target shows the same value. +/// [`settings`] reuses this key until the document or selection changes and shares it with its fields. +pub(super) type EditTarget = Option<(u64, u64, Arc)>>)>; + +/// The resolved objects also hold the selection's ids, so checking the cache copies no selection. +struct TargetCache { + uid: u64, + revision: u64, + reverts: u64, + symbol_part: Option, + objects: Arc)>>, +} /// What the Ramp or Shift slider field keeps between passes: the [`EditTarget`] it last showed, the /// round its id salt is on, the ids of its number field and its track, whether its number field @@ -196,17 +207,53 @@ struct PercentField { hand_off: Option<&'static str>, } -/// The [`EditTarget`] of the active document. -fn edit_target(app: &VectorcraftApp) -> EditTarget { +/// The active document's uid and revert count, with each selected id and its resolved blend id. +/// Resolution uses the same nearest-node finder and symbol-part guard as the Blend commands. +/// Unchanged document revisions and selections reuse the resolved objects between passes. +pub(super) fn edit_target(app: &VectorcraftApp, ctx: &egui::Context) -> EditTarget { let st = app.session.active()?; - Some((st.uid, st.reverts, st.selection.objects.clone())) + let key = egui::Id::unique("blend-edit-target"); + if let Some(held) = ctx.data(|d| d.get_temp::>(key)) + && held.uid == st.uid + && held.revision == st.revision + && held.reverts == st.reverts + && held.symbol_part == st.selection.symbol_part + && held.objects.iter().map(|(id, _)| id).eq(st.selection.objects.iter()) + { + return Some((st.uid, st.reverts, held.objects.clone())); + } + let mut find = st.doc.nearest_finder(); + let objects: Vec<(NodeId, Option)> = st + .selection + .objects + .iter() + .map(|id| { + let blend = + if st.selection.symbol_part.is_none() { find.nearest(*id, |n| matches!(n.kind, NodeKind::Blend { .. })).map(|n| n.id) } else { None }; + (*id, blend) + }) + .collect(); + let objects = Arc::new(objects); + ctx.data_mut(|d| { + d.insert_temp( + key, + Arc::new(TargetCache { + uid: st.uid, + revision: st.revision, + reverts: st.reverts, + symbol_part: st.selection.symbol_part.clone(), + objects: objects.clone(), + }), + ); + }); + Some((st.uid, st.reverts, objects)) } /// Spacing and Orientation, as `object.blend.info` reports them; a change runs /// `object.blend.options`. fn settings(app: &mut VectorcraftApp, ui: &mut Ui) { let info = app.session.execute("object.blend.info", &json!({})).unwrap_or_default(); - let target = edit_target(app); + let target = &edit_target(app, ui.ctx()); let mode = info["spacing"].as_str().unwrap_or("smooth"); let steps = info["steps"].as_f64().unwrap_or(5.0); let distance = info["distance"].as_f64().unwrap_or(10.0); @@ -220,7 +267,7 @@ fn settings(app: &mut VectorcraftApp, ui: &mut Ui) { }); if mode == "distance" { Field::new(tl!("Distance:")).show(ui, |ui, _| { - let out = NumberField::length(tl!("Distance:"), Bind::given(Some(distance)), general_lengths(app)).edit_target(&target).show(ui); + let out = NumberField::length(tl!("Distance:"), Bind::given(Some(distance)), general_lengths(app)).edit_target(target).show(ui); if let Some(d) = out.events.committed().copied().flatten() { change = Some(spacing_params("distance", steps, d)); } @@ -233,7 +280,7 @@ fn settings(app: &mut VectorcraftApp, ui: &mut Ui) { .range(1.0..=1000.0) .commit_decimals(0) .enabled(on) - .edit_target(&target) + .edit_target(target) .show(ui); if let Some(n) = out.events.committed().copied().flatten() { change = Some(spacing_params("steps", n, distance)); @@ -266,8 +313,22 @@ fn settings(app: &mut VectorcraftApp, ui: &mut Ui) { change = Some(json!({"easingType": value})); } }); - percent_slider(app, ui, tl!("Ramp:"), "ramp", info["ramp"].as_f64(), 0.0..=100.0, selected && spined); - percent_slider(app, ui, tl!("Shift:"), "colorShift", info["colorShift"].as_f64(), -100.0..=100.0, selected); + percent_slider( + app, + ui, + target, + PercentSlider { label: tl!("Ramp:"), key: "ramp", range: 0.0..=100.0 }, + info["ramp"].as_f64(), + selected && spined, + ); + percent_slider( + app, + ui, + target, + PercentSlider { label: tl!("Shift:"), key: "colorShift", range: -100.0..=100.0 }, + info["colorShift"].as_f64(), + selected, + ); if let Some(p) = change { app.run("object.blend.options", p).ok(); } diff --git a/crates/ui-egui/src/panels/tests_blend.rs b/crates/ui-egui/src/panels/tests_blend.rs index 7d4e2a4141..936d6355a2 100644 --- a/crates/ui-egui/src/panels/tests_blend.rs +++ b/crates/ui-egui/src/panels/tests_blend.rs @@ -70,6 +70,104 @@ fn info(p: &Panel) -> Value { p.app().session.execute("object.blend.info", &json!({})).unwrap() } +#[test] +fn the_edit_target_is_reused_until_the_document_or_selection_changes() { + use std::sync::Arc; + use vectorcraft_doc::SymbolPart; + + use super::blend::edit_target; + + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + let ctx = egui::Context::default(); + let art = |app: &mut VectorcraftApp| { + app.run("file.new", json!({"width": 300, "height": 300})).unwrap(); + let ids: Vec = (0..3) + .map(|i| { + let value = app.run("shape.rectangle", json!({"x": i * 80, "y": 0, "width": 20, "height": 20})).unwrap(); + NodeId(value["id"].as_u64().unwrap()) + }) + .collect(); + app.run("select.set", json!({"ids": [ids[0].0, ids[1].0]})).unwrap(); + let blend = NodeId(app.run("object.blend.make", json!({"spacing": "steps", "steps": 5})).unwrap()["id"].as_u64().unwrap()); + app.run("select.set", json!({"ids": [ids[0].0, blend.0, ids[1].0]})).unwrap(); + (ids, blend) + }; + let resolved = |app: &VectorcraftApp| edit_target(app, &ctx).unwrap().2; + let (ids, blend) = art(&mut app); + let first = resolved(&app); + assert_eq!(*first, vec![(ids[0], Some(blend)), (blend, Some(blend)), (ids[1], Some(blend))]); + for _ in 0..3 { + assert!(Arc::ptr_eq(&first, &resolved(&app)), "unchanged passes reuse the resolved key"); + } + + // Release, Undo and Redo change the nearest blends while the selected ids stay the same. + let selection = app.session.active().unwrap().selection.objects.clone(); + let mut previous = first.clone(); + for (cmd, has_blend) in [("object.blend.release", false), ("edit.undo", true), ("edit.redo", false), ("edit.undo", true)] { + app.run(cmd, json!({})).unwrap(); + // Release selects its results; keep the original ids to isolate the document change. + app.session.active_mut().unwrap().selection.objects = selection.clone(); + let next = resolved(&app); + assert_ne!(previous, next, "{cmd} changes the nearest blends for the same selected ids"); + if has_blend { + assert_eq!(next, first, "Undo restores the nearest blends"); + } else { + assert_eq!(*next, vec![(ids[0], None), (blend, None), (ids[1], None)], "Release leaves no nearest blends"); + } + assert!(Arc::ptr_eq(&next, &resolved(&app)), "the new revision reuses its resolution"); + previous = next; + } + + // Only the middle selected id changes, at the same revision, length, first and last id. + app.session.active_mut().unwrap().selection.objects[1] = ids[2]; + let changed_selection = resolved(&app); + assert_ne!(previous, changed_selection, "a selection change updates the resolved pairs"); + assert_eq!(changed_selection[1], (ids[2], None), "the unblended rectangle has no nearest blend"); + assert!(Arc::ptr_eq(&changed_selection, &resolved(&app)), "the new selection reuses its resolution"); + + // Symbol parts resolve to no blends, including when the selected object ids stay the same. + app.session.active_mut().unwrap().selection.symbol_part = Some(SymbolPart { instance: blend, path: vec![0] }); + let part = resolved(&app); + assert_ne!(changed_selection, part); + assert_eq!( + *part, + vec![(ids[0], None), (ids[2], None), (ids[1], None)], + "symbol-part selections keep every selected id and resolve none to a blend" + ); + assert!(Arc::ptr_eq(&part, &resolved(&app)), "the same symbol part reuses its resolution"); + app.session.active_mut().unwrap().selection.symbol_part.as_mut().unwrap().path = vec![1]; + let other_part = resolved(&app); + assert!(!Arc::ptr_eq(&part, &other_part), "the key is resolved for the new symbol-part selection"); + app.session.active_mut().unwrap().selection.symbol_part = None; + let whole = resolved(&app); + assert_ne!(other_part, whole, "leaving symbol-part selection restores the nearest blends"); + assert_eq!(whole, changed_selection); + + // The revert count invalidates the cache even at the same revision and selection. + app.session.active_mut().unwrap().reverts += 1; + let reverted = resolved(&app); + assert!(!Arc::ptr_eq(&whole, &reverted), "the key is resolved for the new document state after reverting"); + assert!(Arc::ptr_eq(&reverted, &resolved(&app))); + + // Another document uses the same ids, revision, revert count and selection. + let st = app.session.active().unwrap(); + let (revision, reverts, selection) = (st.revision, st.reverts, st.selection.objects.clone()); + let (other_ids, other_blend) = art(&mut app); + assert_eq!((other_ids, other_blend), (ids, blend)); + let st = app.session.active_mut().unwrap(); + st.revision = revision; + st.reverts = reverts; + st.selection.objects = selection; + let other_document = resolved(&app); + assert!(!Arc::ptr_eq(&reverted, &other_document), "the key is resolved for the new document state in another document"); + assert!(Arc::ptr_eq(&other_document, &resolved(&app))); + app.run("document.activate", json!({"index": 0})).unwrap(); + let original_document = resolved(&app); + assert!(!Arc::ptr_eq(&other_document, &original_document), "the key is resolved for the new document state when returning to the first document"); + assert_eq!(original_document, reverted); + assert!(Arc::ptr_eq(&original_document, &resolved(&app))); +} + #[test] fn the_controls_are_dimmed_until_a_blend_or_two_objects_are_selected() { let mut app = app(); @@ -656,6 +754,30 @@ fn an_unfinished_steps_value_is_dropped_when_a_targeted_layer_loses_a_blend() { assert_eq!((spec(&app, a).spacing, spec(&app, b).spacing), (BlendSpacing::Steps(5), BlendSpacing::Steps(1)), "b takes 1 step, not 3+1"); } +#[test] +fn an_unfinished_steps_value_is_dropped_when_the_selected_keys_lose_their_blend() { + use craft::ui::contract::Role; + use egui::{Key, Modifiers}; + let mut app = app(); + let keys = app.session.active().unwrap().selection.objects.clone(); + app.run("object.blend.options", json!({"spacing": "steps", "steps": 5})).unwrap(); + app.run("object.blend.make", json!({"createSpine": "never"})).unwrap(); + app.run("select.set", json!({"ids": keys.iter().map(|id| id.0).collect::>()})).unwrap(); + let mut p = Panel::new(app, show); + assert_eq!(info(&p)["target"], "blend"); + p.click_role("Steps:", Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("3+"); + + p.app().run("object.blend.release", json!({})).unwrap(); + assert_eq!(p.app().session.active().unwrap().selection.objects, keys, "Release keeps the same keys selected"); + assert_eq!(info(&p)["target"], "defaults"); + p.frame(); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + assert_eq!(info(&p)["steps"], 1, "the new-blend defaults take 1 step, not 3+1"); +} + #[test] fn an_unfinished_steps_value_is_dropped_by_file_revert() { use craft::ui::contract::Role; From 1efdc3ffb1471f6c02c0d7ee650287f04993174b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 16:57:16 -0800 Subject: [PATCH 25/29] Fonts: text is hinted again, now that the pinned skrifa ends its blue-zone search The VectorCraft window drew all text without font hinting, because adopt_context turned egui's hinting off in both themes of each new context (ui_fonts::hinting_off). With hinting on, skrifa 0.44's automatic hinter never finished a tall narrow Hebrew letter in a face without hinting instructions, and the font list stopped responding. The craft-libs rev in Cargo.toml (37d0532f42, storytold/craft-libs#5222) carries skrifa 0.44.0 with the blue-zone exit, and the [patch.crates-io] entry takes skrifa from it. Remove hinting_off and its call, so every context hints text as egui does by default: interface text and the samples in the font list and the font picker. Type on the canvas is drawn from its own outlines and does not change. a_face_without_hinting_instructions_draws_its_sample now checks that a context the app adopts hints text in its global, light and dark styles, and still draws U+05D1 from a face without instructions. --- crates/ui-egui/src/graphics.rs | 3 +-- crates/ui-egui/src/tests/font_menu.rs | 10 +++++----- crates/ui-egui/src/ui_fonts.rs | 11 ----------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/crates/ui-egui/src/graphics.rs b/crates/ui-egui/src/graphics.rs index b90827aea0..0e200259b5 100644 --- a/crates/ui-egui/src/graphics.rs +++ b/crates/ui-egui/src/graphics.rs @@ -127,14 +127,13 @@ impl VectorcraftApp { /// after losing its graphics), everything uploaded to the old one is made again: the fonts and /// theme, the canvas, the place cursor's thumbnails and every [`TexCache`]. The host hands it /// the window's context when it creates the app, so the first frame's input has the app's - /// commands. Each new context draws its text without hinting ([`crate::ui_fonts::hinting_off`]). + /// commands. pub fn adopt_context(&mut self, ctx: &egui::Context) { let tag = context_tag(ctx); self.ui_ctx = Some(ctx.clone()); if self.context == tag { return; } - crate::ui_fonts::hinting_off(ctx); if self.context != 0 { log::info!("vectorcraft: new graphics context: uploading the UI again"); forget_textures(); diff --git a/crates/ui-egui/src/tests/font_menu.rs b/crates/ui-egui/src/tests/font_menu.rs index 2045e85976..3a8567ff7f 100644 --- a/crates/ui-egui/src/tests/font_menu.rs +++ b/crates/ui-egui/src/tests/font_menu.rs @@ -77,8 +77,8 @@ fn samples_show_the_text_in_the_family_or_a_generic_sample() { /// A face with no hinting instructions draws a sample in a context the app has adopted, as the font list and the /// font picker draw each family's sample in its own face (a document face of the context): a Hebrew letter that is a -/// bar 20 by 700 thousandths of an em, whose blue zones the automatic hinter of skrifa 0.44 never finishes measuring. -/// The face is served to the fixture's context only, so the font database other tests read does not change. The +/// bar 20 by 700 thousandths of an em. The context hints text in both themes, so the sample goes through skrifa's +/// automatic hinter, whose blue-zone search for such a letter ends with the pinned skrifa. The face is served to the fixture's context only, so the font database other tests read does not change. The /// sample is one rasterized glyph from that face. It is drawn on a thread of its own, and the test fails when it has /// not ended after 300 s. #[test] @@ -145,9 +145,9 @@ fn a_face_without_hinting_instructions_draws_its_sample() { let (texts, [hinting, light_hinting, dark_hinting], fixture_has_glyph, nonempty_glyph) = rx.recv_timeout(std::time::Duration::from_secs(300)).unwrap_or_else(|e| panic!("drawing the sample: {e}")); assert!(texts.iter().any(|t| t == "\u{5d1}"), "the sample is the letter, in the face: {texts:?}"); - assert!(!hinting, "a context the app adopts draws text without hinting"); - assert!(!light_hinting, "the light theme draws text without hinting"); - assert!(!dark_hinting, "the dark theme draws text without hinting"); + assert!(hinting, "a context the app adopts hints text"); + assert!(light_hinting, "the light theme hints text"); + assert!(dark_hinting, "the dark theme hints text"); assert!(fixture_has_glyph, "the sample's face maps U+05D1"); assert!(nonempty_glyph, "the sample is one rasterized glyph for U+05D1"); } diff --git a/crates/ui-egui/src/ui_fonts.rs b/crates/ui-egui/src/ui_fonts.rs index e75c8e21b1..24260dc24c 100644 --- a/crates/ui-egui/src/ui_fonts.rs +++ b/crates/ui-egui/src/ui_fonts.rs @@ -24,17 +24,6 @@ pub fn ui_fonts() -> UiFonts<'static> { } } -/// Turns font hinting off for all text `ctx` draws, in both themes. With hinting on, egui hints a TrueType face that -/// has no hinting instructions (no `fpgm`, no `prep` and no glyph instructions) with skrifa 0.44's automatic hinter, -/// whose blue-zone search never ends for some glyphs, such as a tall narrow Hebrew letter, so the font list stops -/// responding when a row draws such a face. The font list and the samples get their faces through craft-libs, which -/// sets no hinting option per face, so the switch covers every face of the context. Hinting stays off until the -/// skrifa blue-zone exit (storytold/craft-libs#5222) is in the build; the craft-libs pin that brings it removes this -/// function and its call. -pub(crate) fn hinting_off(ctx: &egui::Context) { - ctx.all_styles_mut(|style| style.visuals.text_options.font_hinting = false); -} - #[derive(Clone)] struct FontSelection { language: Lang, From 4e9a761be2959da21bd1b85fb5dc83a33b026ad0 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 17:26:55 -0800 Subject: [PATCH 26/29] Tests: wrap the unhinted sample test's doc comment like the rest of the file --- crates/ui-egui/src/tests/font_menu.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/tests/font_menu.rs b/crates/ui-egui/src/tests/font_menu.rs index 3a8567ff7f..2fc247cfe9 100644 --- a/crates/ui-egui/src/tests/font_menu.rs +++ b/crates/ui-egui/src/tests/font_menu.rs @@ -78,9 +78,9 @@ fn samples_show_the_text_in_the_family_or_a_generic_sample() { /// A face with no hinting instructions draws a sample in a context the app has adopted, as the font list and the /// font picker draw each family's sample in its own face (a document face of the context): a Hebrew letter that is a /// bar 20 by 700 thousandths of an em. The context hints text in both themes, so the sample goes through skrifa's -/// automatic hinter, whose blue-zone search for such a letter ends with the pinned skrifa. The face is served to the fixture's context only, so the font database other tests read does not change. The -/// sample is one rasterized glyph from that face. It is drawn on a thread of its own, and the test fails when it has -/// not ended after 300 s. +/// automatic hinter, whose blue-zone search for such a letter ends with the pinned skrifa. The face is served to the +/// fixture's context only, so the font database other tests read does not change. The sample is one rasterized glyph +/// from that face. It is drawn on a thread of its own, and the test fails when it has not ended after 300 s. #[test] fn a_face_without_hinting_instructions_draws_its_sample() { use std::sync::{Arc, Mutex}; From b4f7d20598657fc63a98eef80a00101b9d4f8cc2 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 17:44:33 -0800 Subject: [PATCH 27/29] Libraries: a library taller than the panel scrolls The panel's items sat in a stack that filled the panel's room without scrolling, so the wheel, touchpad and scroll bar did nothing and items past the bottom edge could not be reached, in both the list and the thumbnail view. The stack now scrolls vertically under the library picker and search field, and the footer stays in place. --- crates/ui-egui/src/panels/libraries.rs | 9 ++++--- crates/ui-egui/src/panels/libraries/tests.rs | 28 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/panels/libraries.rs b/crates/ui-egui/src/panels/libraries.rs index d9e2f9b70d..d69bf844fd 100644 --- a/crates/ui-egui/src/panels/libraries.rs +++ b/crates/ui-egui/src/panels/libraries.rs @@ -20,7 +20,7 @@ use craft::keymap::CommandRef; use craft::theme::variant::Tone; use craft::ui::choice::Segmented; use craft::ui::contract::{ - ActivateOn, Bind, BodyCx, CollectionEvent, DropAt, DropKind, DropPlace, Entry, ListDrag, Props as _, ReorderRule, SelectMode, Show as _, + ActivateOn, Bind, BodyCx, CollectionEvent, DropAt, DropKind, DropPlace, Entry, ListDrag, Props as _, ReorderRule, Scroll, SelectMode, Show as _, ShowCollection as _, ShowContainer as _, Sizing, Trigger, }; use craft::ui::display::{Divider, Shade, Text}; @@ -349,13 +349,14 @@ impl<'a> View<'a> { } } - /// The list: the ungrouped items, then the groups as sections. A drop anywhere on it away from - /// the items and groups takes an item out of its group, or adds art or a swatch ungrouped. + /// The list: the ungrouped items, then the groups as sections, scrolling under the header when + /// they are taller than the panel. A drop anywhere on it away from the items and groups takes an + /// item out of its group, or adds art or a swatch ungrouped. fn show(&self, ui: &mut Ui, closed: &mut HashSet<(String, String)>, acts: &RefCell>) { let membership = Arc::clone(&self.membership); let list = DropAction::new(move |drag: &PanelDrag| membership.landing(drag, None).is_some()) .sizing(Sizing::Fill) - .show(ui, |ui, _| Stack::new().fill().show(ui, |ui, cx| self.contents(ui, cx, closed, acts))); + .show(ui, |ui, _| Stack::new().fill().scroll(Scroll::vertical()).show(ui, |ui, cx| self.contents(ui, cx, closed, acts))); if let Some(drag) = &list.output.dropped && let Some(act) = self.membership.landing(drag, None) { diff --git a/crates/ui-egui/src/panels/libraries/tests.rs b/crates/ui-egui/src/panels/libraries/tests.rs index b9877b53ca..cfc1cd3a68 100644 --- a/crates/ui-egui/src/panels/libraries/tests.rs +++ b/crates/ui-egui/src/panels/libraries/tests.rs @@ -679,6 +679,34 @@ fn a_shrunk_thumbnail_keeps_its_color_beside_clear_pixels() { } } +/// A library longer than the panel scrolls: the wheel over the items brings the last one into view, in the list view +/// and in the thumbnail view, while the footer's New Group stays in view. +#[test] +fn a_long_library_scrolls_with_the_wheel() { + for list in [false, true] { + let mut app = app(); + app.run("library.create", json!({"name": "Brand"})).unwrap(); + for i in 0..400 { + app.run("library.add", json!({"kind": "fillColor", "color": format!("#{:06x}", i * 0x9731), "name": format!("Swatch {i}")})).unwrap(); + } + app.ui.libraries_list_view = list; + let mut panel = Harness::new(app, show); + panel.room(egui::vec2(300.0, 400.0)); + panel.frame(); + panel.frame(); + assert!(panel.in_view("Swatch 0"), "the first item shows (list view {list})"); + assert!(!panel.in_view("Swatch 399"), "the last item starts out of view (list view {list})"); + let at = panel.rect("Swatch 0").center(); + for _ in 0..40 { + panel.scroll_at(at, -400.0); + } + panel.frame(); + assert!(panel.in_view("Swatch 399"), "the wheel scrolls the last item into view (list view {list})"); + assert!(!panel.in_view("Swatch 0"), "the first item scrolls out of view (list view {list})"); + assert!(panel.in_view("New Group"), "the footer stays in view (list view {list})"); + } +} + /// Graphic thumbnails decoded while the panel draws one frame. fn decoded(panel: &mut Harness) -> usize { super::counters::DECODED.with(|c| c.set(0)); From ec78385f8ca7f96af05b9c1836817e9380a67ac9 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 17:45:02 -0800 Subject: [PATCH 28/29] Artwork Cleanup: Release All Containers keeps group paint and clipped art on locked artboards - A group with fill or stroke rows of its own stays whole, so its members keep the paint the group draws for them. - A clipping group whose shown clipped artwork overlaps a locked artboard stays whole even when its clipping path lies off the artboard, including when a target inside it is named by `ids`. Hidden artwork, art in pattern editing mode and runs with `clipGroups` false do not count. --- .../engine/src/cmd/addons/cleanup/release.rs | 45 ++++- .../src/cmd/addons/cleanup/release/tests.rs | 171 ++++++++++++++++++ docs/mcp.md | 2 +- docs/target-app-parity.md | 5 +- 4 files changed, 215 insertions(+), 8 deletions(-) diff --git a/crates/engine/src/cmd/addons/cleanup/release.rs b/crates/engine/src/cmd/addons/cleanup/release.rs index 62b9c4c836..2e09151866 100644 --- a/crates/engine/src/cmd/addons/cleanup/release.rs +++ b/crates/engine/src/cmd/addons/cleanup/release.rs @@ -9,7 +9,7 @@ use std::collections::{HashMap, HashSet}; use std::sync::Arc; use serde_json::{Value, json}; -use vectorcraft_doc::{Document, LiveShape, Node, NodeId, NodeKind}; +use vectorcraft_doc::{Document, LiveShape, LockedArtboards, Node, NodeId, NodeKind}; use vectorcraft_geom::PathData; use vectorcraft_tools::builder::is_live_paint; @@ -27,7 +27,7 @@ pub(super) fn specs() -> Vec { "Release All Containers…", ["Object", "Plug-ins", "Artwork Cleanup"], None, - "{scope?: \"selection\"|\"document\" (default: the selection, or the document while nothing is selected), ids?: [id…] (the objects, groups and layers to release in, instead of `scope`; duplicate ids are an error), groups?: bool (true: groups are ungrouped), clipGroups?: bool (true: clipping groups are ungrouped and layers stop clipping unless their clipping path or clipped artwork overlaps a locked artboard, their released clipping paths kept as plain paths), compoundPaths?: bool (true: compound paths, and paths of several subpaths, become one path per subpath); at least one of the three true; `scope` and the three are never null} take apart every container of the kinds asked for, at every level of nesting, as one undo step when one goes; layers stay; each object keeps the opacity of the groups and compound paths it was in, and a compound path's paths take its paint; objects with live effects on their appearance or fill and stroke rows, objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, paths with Live Corners, blends, envelopes, repeats, intertwines and other live objects stay whole, including directly selected or named descendants; the entire clipping mask subtree of a clipping group or layer that stays is left as it is, including directly selected or named descendants; from the selection or the document, locked and hidden objects, and objects on a locked artboard, stay whole; named by `ids`, locked and hidden ones are taken apart too (their objects become locked or hidden as they were), but not those on a locked artboard; the selection keeps what it held, each object taken apart replaced by what it left, locked and hidden objects left out → {scope (\"selection\", \"document\" or \"ids\"), ids (the objects selected), groups, clipGroups, compoundPaths (how many of each were released)}", + "{scope?: \"selection\"|\"document\" (default: the selection, or the document while nothing is selected), ids?: [id…] (the objects, groups and layers to release in, instead of `scope`; duplicate ids are an error), groups?: bool (true: groups are ungrouped), clipGroups?: bool (true: clipping groups are ungrouped and layers stop clipping unless their clipping path or clipped artwork overlaps a locked artboard, their released clipping paths kept as plain paths), compoundPaths?: bool (true: compound paths, and paths of several subpaths, become one path per subpath); at least one of the three true; `scope` and the three are never null} take apart every container of the kinds asked for, at every level of nesting, as one undo step when one goes; layers stay; each object keeps the opacity of the groups and compound paths it was in, and a compound path's paths take its paint; objects with live effects on their appearance or fill and stroke rows, groups with fill or stroke rows of their own, objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, paths with Live Corners, blends, envelopes, repeats, intertwines and other live objects stay whole, including directly selected or named descendants; the entire clipping mask subtree of a clipping group or layer that stays is left as it is, including directly selected or named descendants; from the selection or the document, locked and hidden objects, and objects on a locked artboard, stay whole; named by `ids`, locked and hidden ones are taken apart too (their objects become locked or hidden as they were), but not those on a locked artboard; the selection keeps what it held, each object taken apart replaced by what it left, locked and hidden objects left out → {scope (\"selection\", \"document\" or \"ids\"), ids (the objects selected), groups, clipGroups, compoundPaths (how many of each were released)}", has_doc, release_all )] @@ -66,8 +66,8 @@ struct Release<'a> { /// Whether `n` stays whole whatever is asked: a live object kept as a group or compound path /// (a compound shape, Live Paint group, graph, dimension, flare, Objects on Path, generated art, /// Shaper Group, Image Trace object, a clipping path's painted pieces), a path with Live Corners, -/// whose parts would lose their editable corners, or one with an opacity mask or live effects -/// on its appearance or fill and stroke rows. +/// whose parts would lose their editable corners, one with an opacity mask or live effects +/// on its appearance or fill and stroke rows, or a group with fill or stroke rows of its own. fn live(n: &Node) -> bool { let x = n.extras(); matches!(&n.kind, NodeKind::Blend { .. } | NodeKind::Envelope { .. } | NodeKind::Repeat(_) | NodeKind::Intertwine { .. }) @@ -84,6 +84,7 @@ fn live(n: &Node) -> bool { || x.generated.is_some() || x.live_paint_gaps.is_some() || x.clip_pieces + || (matches!(&n.kind, NodeKind::Group { .. }) && !n.appearance.items.is_empty()) || n.is_compound_shape() || is_live_paint(n) } @@ -269,6 +270,18 @@ impl Release<'_> { } } +/// Whether shown artwork in `n` overlaps a locked artboard: a plain group that is not live +/// ([`live`]) by its shown members, anything else by its own bounds. +fn shows_on(locks: &LockedArtboards<'_>, n: &Node) -> bool { + if !n.visible { + return false; + } + match (&n.kind, n.children()) { + (NodeKind::Group { clip: false, .. }, Some(children)) if !live(n) => children.iter().any(|c| shows_on(locks, c)), + _ => locks.holds(n), + } +} + /// Whether `id` is in the clipping mask subtree of a clipping group or layer. fn in_clipping_mask(d: &Document, id: NodeId) -> bool { d.ancestry(id).is_some_and(|chain| { @@ -334,7 +347,29 @@ fn release_all(s: &mut Session, p: &Value) -> Result { candidates(n, kinds.clips, &mut found); } let locks = d.locked_artboards(); - found.into_iter().filter(|id| locks.holds_id(*id)).collect() + let mut held: HashSet = found.iter().copied().filter(|id| locks.holds_id(*id)).collect(); + // A shown clipping group whose clipped artwork overlaps a locked artboard stays whole, + // wherever its clipping path lies, when clipping groups are released; the clipping groups + // the targets are in count too. + let ancestors = roots.iter().filter_map(|id| d.ancestry(*id)).flatten(); + let clip_groups: HashSet = found + .iter() + .copied() + .chain(ancestors) + .filter(|id| kinds.clips && d.node(*id).is_some_and(|n| matches!(&n.kind, NodeKind::Group { clip: true, .. }))) + .collect(); + // Pattern editing mode's art is on no artboard. + let pattern_layer = d.pattern_edit.as_ref().map(|e| e.layer); + for id in clip_groups { + let shown = d.ancestry(id).is_some_and(|chain| chain.iter().all(|a| Some(*a) != pattern_layer && d.node(*a).is_some_and(|n| n.visible))); + if shown + && let Some(n) = d.node(id) + && n.children().is_some_and(|c| c.iter().skip(1).any(|c| shows_on(&locks, c))) + { + held.insert(id); + } + } + held } else { HashSet::new() }; diff --git a/crates/engine/src/cmd/addons/cleanup/release/tests.rs b/crates/engine/src/cmd/addons/cleanup/release/tests.rs index f0b95941a1..991e74f854 100644 --- a/crates/engine/src/cmd/addons/cleanup/release/tests.rs +++ b/crates/engine/src/cmd/addons/cleanup/release/tests.rs @@ -509,6 +509,177 @@ fn release_all_keeps_a_layer_mask_that_alone_overlaps_a_locked_artboard() { } } +#[test] +fn release_all_keeps_a_clipping_group_whose_clipped_art_overlaps_a_locked_artboard() { + let mut s = session(); + let art = rect(&mut s, 10.0, 10.0); + let mask = rect(&mut s, 500.0, 10.0); + let g = clip_group(&mut s, &[art, mask]); + select(&mut s, &[]); + s.edit("Lock Artboard", |d, _| { + d.artboards[0].locked = true; + Ok(()) + }) + .unwrap(); + let r = s.execute(C, &json!({"scope": "document"})).unwrap(); + assert_eq!(counts(&r), (0, 0, 0), "{r}"); + assert_eq!(s.doc().unwrap().doc.parent_of(art), Some(g)); + assert!(node(&s, g).unwrap().clips()); +} + +#[test] +fn release_all_keeps_a_named_group_in_a_clipping_group_over_a_locked_artboard() { + let mut s = session(); + let art = rect(&mut s, 10.0, 10.0); + let other = rect(&mut s, 40.0, 10.0); + let inner = group(&mut s, &[art, other]); + let mask = rect(&mut s, 500.0, 10.0); + let g = clip_group(&mut s, &[inner, mask]); + select(&mut s, &[]); + s.edit("Lock Artboard", |d, _| { + d.artboards[0].locked = true; + Ok(()) + }) + .unwrap(); + let r = s.execute(C, &json!({"ids": [inner.0]})).unwrap(); + assert_eq!(counts(&r), (0, 0, 0), "{r}"); + assert_eq!(s.doc().unwrap().doc.parent_of(art), Some(inner)); + assert_eq!(s.doc().unwrap().doc.parent_of(inner), Some(g)); +} + +#[test] +fn release_all_takes_apart_a_named_hidden_clipping_group_with_visible_art() { + let mut s = session(); + let art = rect(&mut s, 10.0, 10.0); + let mask = rect(&mut s, 500.0, 10.0); + let g = clip_group(&mut s, &[art, mask]); + change(&mut s, g, |n| n.visible = false); + select(&mut s, &[]); + s.edit("Lock Artboard", |d, _| { + d.artboards[0].locked = true; + Ok(()) + }) + .unwrap(); + let r = s.execute(C, &json!({"ids": [g.0]})).unwrap(); + assert_eq!(counts(&r), (0, 1, 0), "{r}"); + assert!(node(&s, g).is_none()); + assert!(!node(&s, art).unwrap().visible); +} + +#[test] +fn release_all_takes_apart_a_clipping_group_in_a_named_hidden_group() { + let mut s = session(); + let art = rect(&mut s, 10.0, 10.0); + let mask = rect(&mut s, 500.0, 10.0); + let g = clip_group(&mut s, &[art, mask]); + let other = rect(&mut s, 40.0, 10.0); + let outer = group(&mut s, &[g, other]); + change(&mut s, outer, |n| n.visible = false); + select(&mut s, &[]); + s.edit("Lock Artboard", |d, _| { + d.artboards[0].locked = true; + Ok(()) + }) + .unwrap(); + let r = s.execute(C, &json!({"ids": [outer.0]})).unwrap(); + assert_eq!(counts(&r), (1, 1, 0), "{r}"); + assert!(node(&s, g).is_none()); +} + +#[test] +fn release_all_ignores_hidden_clipped_art_over_a_locked_artboard() { + let mut s = session(); + let hidden = rect(&mut s, 10.0, 10.0); + let shown = rect(&mut s, 600.0, 10.0); + let inner = group(&mut s, &[hidden, shown]); + change(&mut s, hidden, |n| n.visible = false); + let mask = rect(&mut s, 500.0, 10.0); + let g = clip_group(&mut s, &[inner, mask]); + select(&mut s, &[]); + s.edit("Lock Artboard", |d, _| { + d.artboards[0].locked = true; + Ok(()) + }) + .unwrap(); + let r = s.execute(C, &json!({"scope": "document"})).unwrap(); + assert_eq!(counts(&r), (1, 1, 0), "{r}"); + assert!(node(&s, g).is_none()); + assert!(!node(&s, hidden).unwrap().visible); +} + +#[test] +fn release_all_keeps_a_clipping_group_whose_group_stroke_reaches_a_locked_artboard() { + let mut s = session(); + let a = rect(&mut s, 600.0, 10.0); + let b = rect(&mut s, 640.0, 10.0); + let inner = group(&mut s, &[a, b]); + change(&mut s, inner, |n| n.appearance = Appearance::basic(Paint::None, Paint::solid(Color::rgb(0.0, 0.0, 0.0)), 500.0).into()); + let mask = rect(&mut s, 500.0, 10.0); + let g = clip_group(&mut s, &[inner, mask]); + select(&mut s, &[]); + s.edit("Lock Artboard", |d, _| { + d.artboards[0].locked = true; + Ok(()) + }) + .unwrap(); + let r = s.execute(C, &json!({"scope": "document"})).unwrap(); + assert_eq!(counts(&r), (0, 0, 0), "{r}"); + assert_eq!(s.doc().unwrap().doc.parent_of(inner), Some(g)); +} + +#[test] +fn release_all_ungroups_off_artboard_groups_in_a_kept_clipping_group() { + let mut s = session(); + let a = rect(&mut s, 600.0, 10.0); + let b = rect(&mut s, 640.0, 10.0); + let inner = group(&mut s, &[a, b]); + let on = rect(&mut s, 10.0, 10.0); + let mask = rect(&mut s, 500.0, 10.0); + let g = clip_group(&mut s, &[inner, on, mask]); + select(&mut s, &[]); + s.edit("Lock Artboard", |d, _| { + d.artboards[0].locked = true; + Ok(()) + }) + .unwrap(); + let r = s.execute(C, &json!({"scope": "document", "clipGroups": false})).unwrap(); + assert_eq!(counts(&r), (1, 0, 0), "{r}"); + assert!(node(&s, inner).is_none()); + assert_eq!(s.doc().unwrap().doc.parent_of(a), Some(g)); +} + +#[test] +fn release_all_takes_apart_pattern_editing_art_over_a_locked_artboard() { + let mut s = session(); + let art = rect(&mut s, 10.0, 10.0); + let mask = rect(&mut s, 500.0, 10.0); + let g = clip_group(&mut s, &[art, mask]); + select(&mut s, &[]); + s.edit("Lock Artboard", |d, _| { + d.artboards[0].locked = true; + let layer = d.layers[0].id; + d.pattern_edit = Some(vectorcraft_doc::PatternEdit { pattern: "Checks".into(), layer, original: None }); + Ok(()) + }) + .unwrap(); + let r = s.execute(C, &json!({"scope": "document"})).unwrap(); + assert_eq!(counts(&r), (0, 1, 0), "{r}"); + assert!(node(&s, g).is_none()); +} + +#[test] +fn release_all_keeps_a_group_with_its_own_fill_or_stroke() { + let mut s = session(); + let a = rect(&mut s, 10.0, 10.0); + let b = rect(&mut s, 40.0, 10.0); + let g = group(&mut s, &[a, b]); + change(&mut s, g, |n| n.appearance = red().into()); + let r = s.execute(C, &json!({"scope": "document"})).unwrap(); + assert_eq!(counts(&r), (0, 0, 0), "{r}"); + assert_eq!(s.doc().unwrap().doc.parent_of(a), Some(g)); + assert_eq!(*node(&s, g).unwrap().appearance, red()); +} + #[test] fn release_all_reuses_unchanged_siblings_when_rebuilding_a_layer() { let mut s = session(); diff --git a/docs/mcp.md b/docs/mcp.md index e77f4b9cf5..f6b8083815 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -17442,7 +17442,7 @@ their clipping path or clipped artwork overlaps a locked artboard (released clip and at least one must be true. Layers stay. Objects keep the opacity of the groups and compound paths they were in, and the paths of a compound path take its paint. Objects with live effects -on their appearance or fill and stroke rows, objects with an opacity mask, compound shapes, Live Paint groups, graphs, +on their appearance or fill and stroke rows, groups with fill or stroke rows of their own, objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, paths with Live Corners, blends, envelopes, repeats, intertwines and other live objects stay whole, including directly selected or named descendants. The entire clipping mask subtree of a clipping group or layer that diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 952ad949d4..20b4eb4d56 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -3021,8 +3021,9 @@ state. Tests: `simplify_named_locked_and_hidden_paths`, `deep_ungroup_named_lock Release All Containers… (`addon.cleanup.releaseAll`) takes apart the groups, clipping groups and compound paths of the kinds asked for in the selection, the objects named or the whole document, at every level of nesting, as one undo step; -layers stay, and stop clipping when clipping groups are released; paths of several subpaths split into one path per -subpath. Objects with an opacity mask, live objects and paths with Live Corners stay whole. Its dialog previews on the canvas and picks +layers stay, and stop clipping when clipping groups are released unless their clipping path or clipped artwork overlaps +a locked artboard; paths of several subpaths split into one path per subpath. Objects with an opacity mask, groups with +fill or stroke rows of their own, live objects, paths with Live Corners and artwork on a locked artboard stay whole. Its dialog previews on the canvas and picks where to release and which kinds (VectorCraft's own tool). Tests: `cmd::addons::cleanup::release::tests` in `vectorcraft-engine` and `addons::cleanup::release::tests` in `vectorcraft-ui-egui`. From 05ed058fb198e82e79af3df1dd4c2125d9664ef7 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 18:02:53 -0800 Subject: [PATCH 29/29] Shaper: new groups and clipping masks no longer delete a Shaper group A Shaper group keeps its source art at the bottom and rebuilds the rest from it. object.newGroup with a Shaper group as parent at index 0, and layer.clippingMask.toggle (also a script's clipped = true) on a Shaper group, put a new object where the source art was. The group then read no sources and was deleted. Both commands now refuse a Shaper group and leave the document as it is; the clipping check runs before the edit opens, so a refused call leaves typing as it is. --- crates/engine/src/cmd/layer.rs | 7 +++++- crates/engine/src/cmd/object/arrange.rs | 4 ++++ crates/engine/src/cmd/object/commands.rs | 2 +- crates/engine/src/tests/script_dom.rs | 27 ++++++++++++++++++++++++ docs/mcp.md | 8 +++++-- docs/target-app-parity.md | 2 +- 6 files changed, 45 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/layer.rs b/crates/engine/src/cmd/layer.rs index ca4a9d7022..a2dd7f83a6 100644 --- a/crates/engine/src/cmd/layer.rs +++ b/crates/engine/src/cmd/layer.rs @@ -192,7 +192,7 @@ pub fn specs() -> Vec { "Make/Release Clipping Mask", ["Window", "Layers"], None, - "{id?: layer or group (default: the one highlighted layer or group row, else the one selected group, else the current layer)} make: its top object (a path, compound path or text, which loses its paint) clips the rest and moves to the bottom (new art added on top is clipped); release: it stops clipping, the clipping path stays unpainted → {clip}", + "{id?: layer or group (default: the one highlighted layer or group row, else the one selected group, else the current layer)} make: its top object (a path, compound path or text, which loses its paint) clips the rest and moves to the bottom (new art added on top is clipped; a Shaper group is refused and changes nothing); release: it stops clipping, the clipping path stays unpainted → {clip}", has_doc, clip_toggle ), @@ -526,6 +526,11 @@ fn clip_toggle(s: &mut Session, p: &Value) -> Result { None => None, }; let id = given.or(row).or(group).or(st.current_layer()).ok_or_else(|| bad("layer.clippingMask.toggle", "no layer"))?; + // A Shaper group keeps its source art first; a clipping path there would replace it. The + // check comes before the edit so that a refused call leaves any typing as it is. + if st.doc.node(id).is_some_and(|n| !n.clips() && n.extras().shaper.is_some()) { + return Err(bad("layer.clippingMask.toggle", format!("{} is a Shaper group, whose contents are made from its source art", id.0))); + } let clip = s.edit("Make/Release Clipping Mask", |d, _| { let n = d.node(id).ok_or(EngineError::NoNode(id))?; if !matches!(n.kind, NodeKind::Layer { .. } | NodeKind::Group { .. }) { diff --git a/crates/engine/src/cmd/object/arrange.rs b/crates/engine/src/cmd/object/arrange.rs index 8ed4656295..ef37bd7d99 100644 --- a/crates/engine/src/cmd/object/arrange.rs +++ b/crates/engine/src/cmd/object/arrange.rs @@ -129,6 +129,10 @@ pub(super) fn new_group(s: &mut Session, p: &Value) -> Result { if !matches!(n.kind, NodeKind::Layer { .. } | NodeKind::Group { .. }) || n.extras().graph.is_some() { return Err(bad(C, format!("{} is not a layer or group", parent.0))); } + // A Shaper group rebuilds its contents from the source art it holds first. + if n.extras().shaper.is_some() { + return Err(bad(C, format!("{} is a Shaper group, whose contents are made from its source art", parent.0))); + } if !d.is_editable(parent) { return Err(bad(C, "the layer or group is hidden or locked")); } diff --git a/crates/engine/src/cmd/object/commands.rs b/crates/engine/src/cmd/object/commands.rs index d5a89f8789..782c5a9511 100644 --- a/crates/engine/src/cmd/object/commands.rs +++ b/crates/engine/src/cmd/object/commands.rs @@ -142,7 +142,7 @@ pub fn specs() -> Vec { "Group", [], None, - "{parent?: layer or group id (default: the current layer), index?: n (0 = bottom, or directly above the clipping path in a clipping layer or group; 0 is refused in an Image Trace object, whose source image stays at the bottom; default: on top), compound?: bool (default false; true: an empty compound path instead of a group)} → {id}: an empty group or compound path in a shown, unlocked layer or group; an omitted key takes its default; null is refused for parent, index and compound; the selection stays as it is", + "{parent?: layer or group id (default: the current layer), index?: n (0 = bottom, or directly above the clipping path in a clipping layer or group; 0 is refused in an Image Trace object, whose source image stays at the bottom; default: on top), compound?: bool (default false; true: an empty compound path instead of a group)} → {id}: an empty group or compound path in a shown, unlocked layer or group (a Shaper group is refused and changes nothing); an omitted key takes its default; null is refused for parent, index and compound; the selection stays as it is", has_doc, new_group ), diff --git a/crates/engine/src/tests/script_dom.rs b/crates/engine/src/tests/script_dom.rs index 54926e1659..905df7882a 100644 --- a/crates/engine/src/tests/script_dom.rs +++ b/crates/engine/src/tests/script_dom.rs @@ -3683,6 +3683,33 @@ fn compound_path_items_add_makes_an_empty_compound_path_that_takes_paths() { assert!(s.execute("object.newGroup", &json!({"compound": 1})).unwrap_err().to_string().contains("true or false")); } +/// A Shaper group rebuilds its contents from the source art it holds first, so `object.newGroup` +/// refuses it as a parent: at index 0 the empty group would take the sources' place and the +/// Shaper group would be deleted. +#[test] +fn new_group_refuses_a_shaper_group_as_its_parent() { + let (mut s, a, _) = doc(); + let b = rect(&mut s, 30.0, 20.0, 30.0, 40.0); + s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap(); + let shaper = NodeId(s.execute("shaper.scribble", &json!({"points": [[25, 40], [50, 40]]})).unwrap()["id"].as_u64().unwrap()); + let before = s.active().unwrap().doc.node(shaper).cloned().unwrap(); + for index in [json!(0), json!(1), Value::Null] { + let mut p = json!({"parent": shaper.0}); + if !index.is_null() { + p["index"] = index; + } + let err = s.execute("object.newGroup", &p).unwrap_err().to_string(); + assert!(err.contains("Shaper group"), "{p}: {err}"); + assert_eq!(s.active().unwrap().doc.node(shaper), Some(&before), "{p}"); + } + // Making a clipping mask moves the topmost object to index 0 the same way. + let err = s.execute("layer.clippingMask.toggle", &json!({"id": shaper.0})).unwrap_err().to_string(); + assert!(err.contains("Shaper group"), "{err}"); + let src = "var g = app.activeDocument.groupItems[0]; try { g.clipped = true; vc.log('clipped'); } catch (e) { vc.log(String(e).indexOf('Shaper group') >= 0); }"; + assert_eq!(log(&mut s, src), [json!(true)]); + assert_eq!(s.active().unwrap().doc.node(shaper), Some(&before)); +} + /// The paint of a compound path's only path is the compound path's: moved into an empty compound /// path, the path gives it that paint, not its own default one. #[test] diff --git a/docs/mcp.md b/docs/mcp.md index 183f042d80..508a5b09e1 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -3414,7 +3414,8 @@ through `$`: without art releases its mask in the same undo step. `groupItems.add()` makes an empty group on top of the layer's or group's contents, or of the current layer's for the document's collection, and `compoundPathItems.add()` makes an empty compound path in the same place - (https://ai-scripting.docsforadobe.dev/jsobjref/CompoundPathItems/). A path that `move` or `duplicate` puts into a + (https://ai-scripting.docsforadobe.dev/jsobjref/CompoundPathItems/). In a Shaper group, `groupItems.add()`, + `compoundPathItems.add()` and `clipped = true` throw and change nothing. A path that `move` or `duplicate` puts into a compound path becomes one of its paths and gives up its own paint, as Make Compound Path leaves its paths. The compound path becomes pixel-aligned when the path was, or when the compound path it leaves was. A path moved into an already pixel-aligned compound path is snapped to the pixel grid. An empty @@ -3444,6 +3445,8 @@ through `$`: since the source image stays at the bottom, and index 1 puts it directly above the source image), as one undo step named Group, and gives `{id}`. With `compound: true` it adds an empty compound path instead, as one undo step named Compound Path. + A Shaper group is refused as `parent` and changes nothing, since its contents are made from the source art it holds + at the bottom. An omitted key takes its default (`parent`: the current layer; `index`: on top; `compound`: false). Explicit `null` is refused for `parent`, `index` and `compound`. The selection stays as it is. `node.move` also puts a path into a shown, unlocked compound path (its layer and @@ -5281,7 +5284,8 @@ paints behind the clipped art and its stroke over it, not clipped, on screen and `layer.clippingMask.toggle {id?}` is the Layers panel's clipping mask button: the top object of the layer `id` (default: the one highlighted layer or group row, else the one selected group, else the current layer) becomes its clipping path (unpainted, moved to the bottom of the layer, so art added later is clipped too); called again it releases the mask. It returns `{clip}`, and the Layers panel -underlines clipping-path names. +underlines clipping-path names. Making a mask in a Shaper group is refused and changes nothing, since the group's +source art stays at its bottom. ## Object selection diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index bfccfd4a5a..7a7db00851 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1131,7 +1131,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Scripts: `document.characterStyles` and `document.paragraphStyles` add, find, rename, redefine, apply and remove character and paragraph styles, with the Normal styles listed first and kept, and a text range lists the styles its text is in, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/CharacterStyles/, https://ai-scripting.docsforadobe.dev/jsobjref/CharacterStyle/, https://ai-scripting.docsforadobe.dev/jsobjref/ParagraphStyles/, https://ai-scripting.docsforadobe.dev/jsobjref/ParagraphStyle/ and https://ai-scripting.docsforadobe.dev/jsobjref/TextRange/ describe them (`docs/mcp.md`). Style names of 1 to 256 characters without control characters, and at most 4,096 styles named in one run, are VectorCraft's own rules. Load Character Styles, Load Paragraph Styles and Load All Styles refuse a file larger than 64 MB. A paragraph style's character attributes are not there yet. `crates/engine/src/tests/script_styles.rs`. - Scripts: a text frame's `nextFrame` and `previousFrame` read and set its links to the frames before and after it, `areaText` and `pathText` thread a new frame to a base frame, and `document.stories` lists the stories, each with its frames in thread order and its text across them as one text range with its characters, words and paragraphs, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/TextFrameItem/, https://ai-scripting.docsforadobe.dev/jsobjref/Story/ and https://ai-scripting.docsforadobe.dev/jsobjref/Stories/ describe them; `text.thread.setNeighbor` links or unlinks two frames by id (`docs/mcp.md`). Which links are refused, and how a story is listed and found, are VectorCraft's own rules. `crates/engine/src/tests/script_threads.rs`. - Scripts: `PageItem.tags` reads, adds, renames and deletes an object's tags, name and value pairs that the native file keeps, and `Document.tags` reads, renames and deletes the tags of every page item but adds none (its `add` throws; a script adds a tag through the page item's `tags`), as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/Tags/ and https://ai-scripting.docsforadobe.dev/jsobjref/Tag/ describe them, through `object.tags` and the `object.tag.*` commands, at most 64 tags an object (`docs/mcp.md`). `crates/engine/src/tests/script_tags.rs`. - - Scripts: a document's layers and sublayers with their options, stacking and current layer, its groups and compound paths with clipping masks, new empty groups and compound paths and paths moved into compound paths, and its artboards with their rectangles, names, ruler origins and display options, added, inserted, removed and made active, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/Layer/, https://ai-scripting.docsforadobe.dev/jsobjref/Layers/, https://ai-scripting.docsforadobe.dev/jsobjref/GroupItems/, https://ai-scripting.docsforadobe.dev/jsobjref/CompoundPathItem/, https://ai-scripting.docsforadobe.dev/jsobjref/CompoundPathItems/, https://ai-scripting.docsforadobe.dev/jsobjref/Artboard/ and https://ai-scripting.docsforadobe.dev/jsobjref/Artboards/ describe them (`docs/mcp.md`); `artboards.add` returns the new artboard and `artboards.insert` returns nothing. Scoped collections support string conversion, which fails for `Layers`, `GroupItems`, `CompoundPathItems` and `Artboards` once their container is gone; a compound path's `pathItems` are `PathItems` objects whose `add()` and shape methods make the new path inside it; `removeAll()` on a compound path's `pathItems` throws when it would empty a compound path that clips a group or layer keeping other objects that are not ruler guides. Empty clipping containers release their masks in the deletion's undo step, and `clipped` changes check the group's, layer's and artboard's locks; turning clipping on also refuses a hidden or locked topmost object, which would become the mask. Layer selection changes keep unrelated selected objects, layer colors are assignable `RGBColor` values, stacking scans count toward the script budget, and paths moved into pixel-aligned compound paths are snapped. The `textFrames` of a layer or group list the type directly in it and put new type on top of its contents (VectorCraft's own rule), as https://ai-scripting.docsforadobe.dev/jsobjref/Layer/ and https://ai-scripting.docsforadobe.dev/jsobjref/GroupItem/ list them. `crates/engine/src/tests/script_dom.rs`, `crates/engine/src/tests/script_text.rs`, `crates/ui-egui/src/tests/script_run.rs`. + - Scripts: a document's layers and sublayers with their options, stacking and current layer, its groups and compound paths with clipping masks, new empty groups and compound paths and paths moved into compound paths, and its artboards with their rectangles, names, ruler origins and display options, added, inserted, removed and made active, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/Layer/, https://ai-scripting.docsforadobe.dev/jsobjref/Layers/, https://ai-scripting.docsforadobe.dev/jsobjref/GroupItems/, https://ai-scripting.docsforadobe.dev/jsobjref/CompoundPathItem/, https://ai-scripting.docsforadobe.dev/jsobjref/CompoundPathItems/, https://ai-scripting.docsforadobe.dev/jsobjref/Artboard/ and https://ai-scripting.docsforadobe.dev/jsobjref/Artboards/ describe them (`docs/mcp.md`); `artboards.add` returns the new artboard and `artboards.insert` returns nothing. Scoped collections support string conversion, which fails for `Layers`, `GroupItems`, `CompoundPathItems` and `Artboards` once their container is gone; a compound path's `pathItems` are `PathItems` objects whose `add()` and shape methods make the new path inside it; `removeAll()` on a compound path's `pathItems` throws when it would empty a compound path that clips a group or layer keeping other objects that are not ruler guides. Empty clipping containers release their masks in the deletion's undo step, and `clipped` changes check the group's, layer's and artboard's locks; turning clipping on also refuses a hidden or locked topmost object, which would become the mask. In a Shaper group, new empty groups and compound paths and turning clipping on are refused, since the group keeps its source art at the bottom. Layer selection changes keep unrelated selected objects, layer colors are assignable `RGBColor` values, stacking scans count toward the script budget, and paths moved into pixel-aligned compound paths are snapped. The `textFrames` of a layer or group list the type directly in it and put new type on top of its contents (VectorCraft's own rule), as https://ai-scripting.docsforadobe.dev/jsobjref/Layer/ and https://ai-scripting.docsforadobe.dev/jsobjref/GroupItem/ list them. `crates/engine/src/tests/script_dom.rs`, `crates/engine/src/tests/script_text.rs`, `crates/ui-egui/src/tests/script_run.rs`. - Scripts: `Document.print` prints the document to a file with `PrintOptions` and the job, color management, color separation, coordinate, flattener, font, page marks, paper and PostScript option classes the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/ and https://ai-scripting.docsforadobe.dev/jsobjref/PrintJobOptions/ describe, over the document's print settings, and `app.printPresetsList` lists the print presets (`docs/mcp.md`); `CUSTOMPROFILE` without a profile `name` throws. `crates/engine/src/tests/script_print.rs`. - Scripts: `Document.exportFile` with `ExportType.AutoCAD` writes a DXF file with the `ExportOptionsAutoCAD` options and the AutoCAD enumerations that https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsAutoCAD/ and https://ai-scripting.docsforadobe.dev/jsobjref/scripting-constants/ describe; DWG throws an error that says it is not available, and `unitScaleRatio` is a percentage, with 100 at full size (`docs/mcp.md`). `crates/engine/src/tests/script_save_open.rs`. - Scripts: `Document.print` without a file prints to the printer `PrintOptions.printerName` names, or the default printer, and `app.printerList` lists the installed printers as `Printer` objects, as the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/, https://ai-scripting.docsforadobe.dev/jsobjref/Application/ and https://ai-scripting.docsforadobe.dev/jsobjref/Printer/ describe. VectorCraft's own rules: the jobs are sent after the run's changes are kept and the person at the keyboard clicks Print or presses Space on it, which takes no click or focus for the first second, nothing is sent from a failed run, and the web build, and MCP or the command line without the app, cannot print to a printer from a script (`docs/mcp.md`); a batch submitted after a spool failure was reported clears it once the worker sends every job of the batch without a failure, while a failure reported after submission stays. `crates/engine/src/tests/script_print.rs`, `crates/ui-egui/src/tests/script_print.rs`.