From 412536135094735deadaf2f686723feebf2be864 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 13:59:35 -0800 Subject: [PATCH 01/41] Stroke: drop an unfinished value when the stroke it edits changes A value typed into the Stroke panel's Weight, Miter limit, dash, gap, Dash offset or arrowhead Scale field without Enter stayed in the field after another object with the same value was selected, and Enter then applied it to the new selection: "3+" typed for one line and finished as "1" on another set that line to 4 pt. The Appearance panel's weight fields and the Control bar and Properties weight fields did the same. The fields now take an edit target: the document, its File > Revert count, the revision of the document the next edit builds on, the new-art paint, the selection and its subjects, the active Appearance row, the symbol part, the Live Paint Bucket, the Type tool's characters or story, and the Global Edit members. When it changes, the field drops the unfinished value and keeps its focus. While the stroke editor's or the arrowhead Scale fields' own scrub or step runs, they keep the target they started with, and an outside change to the document ends the gesture. A command that replaces a tool drag's starting document, or changes the perspective grid during a drag, now advances the drag's baseline revision, so the target changes with it. craft-libs is pinned to the commit that adds StrokeEditor::edit_target and LinkedFields::edit_target. --- Cargo.lock | 184 +-- Cargo.toml | 84 +- apps/vectorcraft-web/Cargo.toml | 2 +- .../engine/src/cmd/distortcmds/perspective.rs | 2 + crates/engine/src/inspect.rs | 5 + crates/engine/src/interaction.rs | 4 +- crates/engine/src/session/edit.rs | 2 + .../engine/src/tests/interaction_commands.rs | 32 + crates/ui-egui/src/panels/appearance.rs | 13 +- crates/ui-egui/src/panels/stroke.rs | 248 +++- crates/ui-egui/src/panels/tests_stroke.rs | 1140 ++++++++++++++++- xtask/src/pdf_deps.rs | 2 +- 12 files changed, 1561 insertions(+), 157 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 65c0466fa9..9b875b2ea3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1255,7 +1255,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-automation", "craft-behavior", @@ -1297,7 +1297,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "crc32fast", "flate2", @@ -1318,7 +1318,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1330,7 +1330,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "rustix 1.1.6", ] @@ -1338,7 +1338,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1363,7 +1363,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1381,7 +1381,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-docpath", @@ -1399,7 +1399,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "crc32fast", "flate2", @@ -1408,7 +1408,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "egui", ] @@ -1416,7 +1416,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "md-5", "rayon", @@ -1425,12 +1425,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-cms", @@ -1450,7 +1450,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-ai-agents", "craft-atomic", @@ -1466,7 +1466,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1476,7 +1476,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "rayon", ] @@ -1484,7 +1484,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1510,7 +1510,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "blake3", "craft-ecproj-format", @@ -1526,7 +1526,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "serde", ] @@ -1534,7 +1534,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1553,7 +1553,7 @@ dependencies = [ [[package]] name = "craft-dwg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "acadrust", "log", @@ -1562,7 +1562,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-codepage", "encoding_rs", @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "serde", "serde_json", @@ -1584,12 +1584,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" [[package]] name = "craft-flags" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-atomic", "dirs", @@ -1599,7 +1599,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1614,7 +1614,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1633,7 +1633,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1642,7 +1642,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "cap-primitives", "craft-atomic", @@ -1665,12 +1665,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "gif", ] @@ -1678,7 +1678,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "flate2", ] @@ -1686,7 +1686,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1699,7 +1699,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1729,7 +1729,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-dds", "craft-jpeg", @@ -1756,7 +1756,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1774,7 +1774,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "thiserror 2.0.21", ] @@ -1782,7 +1782,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-host", "craft-i18n", @@ -1808,7 +1808,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-i18n", @@ -1822,7 +1822,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-host", @@ -1840,7 +1840,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1852,7 +1852,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "encoding_rs", "image", @@ -1863,7 +1863,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "chrono", "craft-codepage", @@ -1873,7 +1873,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "uds_windows", "winsafe", @@ -1882,7 +1882,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-keymap", @@ -1898,7 +1898,7 @@ dependencies = [ [[package]] name = "craft-pbr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-texture", "thiserror 2.0.21", @@ -1907,7 +1907,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "flate2", "serde", @@ -1918,7 +1918,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1930,7 +1930,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "async-channel", "async-io", @@ -1963,7 +1963,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1972,7 +1972,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-host", @@ -1996,7 +1996,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -2007,7 +2007,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-eps", "flate2", @@ -2021,7 +2021,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "encoding_rs", "flate2", @@ -2032,7 +2032,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "dispatch2", "egui", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-raster3d" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "rayon", "thiserror 2.0.21", @@ -2054,7 +2054,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -2073,7 +2073,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-atomic", "craft-host", @@ -2090,7 +2090,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "fax", "hayro-ccitt", @@ -2101,7 +2101,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2122,7 +2122,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-keymap", @@ -2134,7 +2134,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2159,7 +2159,7 @@ dependencies = [ [[package]] name = "craft-texture" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "thiserror 2.0.21", ] @@ -2167,7 +2167,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2182,7 +2182,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-atomic", "craft-behavior", @@ -2197,7 +2197,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "serde", "thiserror 2.0.21", @@ -2207,7 +2207,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "serde", "thiserror 2.0.21", @@ -2216,7 +2216,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-keymap", @@ -2231,12 +2231,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2250,7 +2250,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2267,7 +2267,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "accesskit", "craft-behavior", @@ -2305,7 +2305,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2316,7 +2316,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-host", @@ -2334,7 +2334,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-host", @@ -2355,7 +2355,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-host", @@ -2376,7 +2376,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-behavior", "craft-host", @@ -2395,7 +2395,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "base64 0.22.1", "chrono", @@ -2427,7 +2427,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "flate2", "serde", @@ -2438,7 +2438,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2448,7 +2448,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "js-sys", "serde_json", @@ -2459,7 +2459,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "winsafe", ] @@ -2467,7 +2467,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "craft-appkit", "craft-atomic", @@ -2499,7 +2499,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3859,7 +3859,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3868,7 +3868,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3886,7 +3886,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3904,12 +3904,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "flate2", "hayro-ccitt", @@ -4892,7 +4892,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "base64 0.22.1", "bumpalo", @@ -5049,7 +5049,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "arrayvec", "kurbo 0.13.1", @@ -7615,7 +7615,7 @@ dependencies = [ [[package]] name = "skrifa" version = "0.44.0" -source = "git+https://github.com/storytold/craft-libs?rev=37d0532f42eb3421769c8a454e3e25a20fbcff97#37d0532f42eb3421769c8a454e3e25a20fbcff97" +source = "git+https://github.com/storytold/craft-libs?rev=b14d8ac4faba5da4c3c7e733e7c763d5add21d70#b14d8ac4faba5da4c3c7e733e7c763d5add21d70" dependencies = [ "bytemuck", "read-fonts 0.41.0", diff --git a/Cargo.toml b/Cargo.toml index 03de727454..dbd24cdf1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,57 +10,57 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # 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 = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # DWG to DXF bytes, in a child process on desktop builds (acadrust 0.6.6, MPL-2.0, unmodified). -craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # 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 = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # The CPU rasterizer that draws a 3D effect's Render Settings › Rendered image: depth-buffered triangles, shadow maps. -craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # 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 = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # 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 = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -200,15 +200,15 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } # skrifa 0.44 (epaint, glifo, usvg) with the automatic hinter's long blue-zone exit (craft-libs vendor/skrifa). -skrifa = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } +skrifa = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70" } 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 0d227adb15..4c31295602 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 = "37d0532f42eb3421769c8a454e3e25a20fbcff97", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/engine/src/cmd/distortcmds/perspective.rs b/crates/engine/src/cmd/distortcmds/perspective.rs index 3f100acc5a..8c74451a02 100644 --- a/crates/engine/src/cmd/distortcmds/perspective.rs +++ b/crates/engine/src/cmd/distortcmds/perspective.rs @@ -32,6 +32,7 @@ pub(crate) fn silent(s: &mut Session, f: impl FnOnce(&mut PerspectiveGrid)) -> R store_grid(Arc::make_mut(&mut st.doc), &g); if let Some(it) = &mut st.interaction { store_grid(Arc::make_mut(&mut it.doc), &g); + it.revision = st.revision + 1; } st.revision += 1; Ok(g) @@ -714,6 +715,7 @@ pub(crate) fn finish_edit_text(st: &mut crate::DocState, id: NodeId) { } if let Some(it) = &mut st.interaction { clear(&mut it.doc); + it.revision = st.revision + 1; } st.revision += 1; } diff --git a/crates/engine/src/inspect.rs b/crates/engine/src/inspect.rs index 323d5d0918..ea28d8675e 100644 --- a/crates/engine/src/inspect.rs +++ b/crates/engine/src/inspect.rs @@ -7,6 +7,11 @@ use vectorcraft_geom::Rect; use crate::Session; +/// The new-art paint state before the running preview, or its current value without a preview. +pub fn new_art_paint_before_preview(s: &Session) -> &vectorcraft_tools::PaintDefaults { + s.active().and_then(|st| st.interaction.as_ref()).map_or(&s.paint, |it| &it.paint) +} + pub(crate) fn rect_json(r: Option) -> Value { match r { Some(r) => json!({ "x": r.x0, "y": r.y0, "width": r.width(), "height": r.height() }), diff --git a/crates/engine/src/interaction.rs b/crates/engine/src/interaction.rs index 1ede3c2509..35a384dc05 100644 --- a/crates/engine/src/interaction.rs +++ b/crates/engine/src/interaction.rs @@ -11,8 +11,8 @@ pub struct Interaction { /// The selection the previews start from (shared, so a preview frame copies nothing). pub selection: Arc, pub(crate) active_appearance_item: Option, - /// The document's [`crate::DocState::revision`] when the interaction began. The previews change the document's - /// revision, and this value stays the same until the interaction ends. + /// The baseline document's [`crate::DocState::revision`]. Previews keep this value; replacing or changing the + /// baseline advances it to the document's next revision. pub revision: u64, pub preview: Option<(String, Value)>, /// The active tool began it (a drag): a command from outside the tool runs as a step of its diff --git a/crates/engine/src/session/edit.rs b/crates/engine/src/session/edit.rs index 604ca822df..5143ee3287 100644 --- a/crates/engine/src/session/edit.rs +++ b/crates/engine/src/session/edit.rs @@ -471,6 +471,8 @@ impl Session { return; } let began = std::mem::replace(&mut it.doc, st.doc.clone()); + st.revision += 1; + it.revision = st.revision; // The drag acts on the objects it began with: a selection the command made (a paste, a // duplicate, Select All) does not change what the drag moves. it.selection = Arc::new(drag_selection(&it.selection, &st.doc)); diff --git a/crates/engine/src/tests/interaction_commands.rs b/crates/engine/src/tests/interaction_commands.rs index 00588ecf0c..20ab3876ee 100644 --- a/crates/engine/src/tests/interaction_commands.rs +++ b/crates/engine/src/tests/interaction_commands.rs @@ -846,3 +846,35 @@ fn a_command_during_a_quick_pen_press_runs_inside_it() { assert_eq!(s.doc().unwrap().history.undo.len(), steps, "{at}: no step of its own during the press"); } } + +#[test] +fn a_rebased_drag_advances_its_baseline_revision() { + for real_time in [true, false] { + let (mut s, _, other) = two_squares(real_time); + s.select_tool("selection", view()).unwrap(); + pointer(&mut s, PointerKind::Down, 120.0, 120.0); + pointer(&mut s, PointerKind::Drag, 140.0, 130.0); + let revision = s.doc().unwrap().interaction.as_ref().unwrap().revision; + pointer(&mut s, PointerKind::Drag, 150.0, 140.0); + assert_eq!(s.doc().unwrap().interaction.as_ref().unwrap().revision, revision, "previews keep the baseline revision"); + s.execute("appearance.setItem", &json!({"ids": [other.0], "index": 1, "weight": 3})).unwrap(); + let rebased = s.doc().unwrap().interaction.as_ref().unwrap().revision; + assert!(rebased > revision, "an outside document edit advances the baseline revision"); + pointer(&mut s, PointerKind::Drag, 160.0, 150.0); + assert_eq!(s.doc().unwrap().interaction.as_ref().unwrap().revision, rebased, "later previews keep the rebased revision"); + s.cancel_interaction().unwrap(); + assert_eq!(s.doc().unwrap().doc.node(other).unwrap().appearance.stroke().unwrap().width, 3.0); + } +} + +#[test] +fn a_grid_change_during_an_interaction_advances_its_baseline_revision() { + let (mut s, _) = session(true); + s.begin_interaction("Grid").unwrap(); + let revision = s.doc().unwrap().interaction.as_ref().unwrap().revision; + crate::cmd::distortcmds::silent(&mut s, |grid| grid.visible = !grid.visible).unwrap(); + let st = s.doc().unwrap(); + let it = st.interaction.as_ref().unwrap(); + assert!(it.revision > revision, "a direct baseline change advances its revision"); + assert_eq!(crate::cmd::distortcmds::grid_of(&it.doc).visible, crate::cmd::distortcmds::grid_of(&st.doc).visible); +} diff --git a/crates/ui-egui/src/panels/appearance.rs b/crates/ui-egui/src/panels/appearance.rs index c6c791b645..c98048a526 100644 --- a/crates/ui-egui/src/panels/appearance.rs +++ b/crates/ui-egui/src/panels/appearance.rs @@ -452,9 +452,11 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let copy = craft::ui::runtime::pointer::frame(ui.ctx()).mods.alt; let pass = RefCell::new(Pass::default()); let footer = RefCell::new(None); + let shown_target = stroke::target_key(&stroke::edit_target(app, ui.ctx())); let shared: &VectorcraftApp = app; let cx = RowCx { app: shared, + shown_target, node: node.as_deref(), new_art: &new_art, mix, @@ -751,6 +753,7 @@ struct Pass { /// What a row reads to build itself. struct RowCx<'a> { app: &'a VectorcraftApp, + shown_target: u64, node: Option<&'a Node>, new_art: &'a Appearance, mix: Option<&'a Mixed>, @@ -860,10 +863,12 @@ fn item_row<'r>(cx: &'r RowCx<'_>, key: RowKey, i: usize) -> ListRow<'r> { } if let Some(st) = stroke_layer { let target = if new_art { WeightTarget::Shown } else { WeightTarget::Item(i) }; + let field = + if new_art { row_weight(cx.app, Some(st.width), &cx.shown_target) } else { row_weight(cx.app, Some(st.width), &(cx.shown_target, i)) }; let pass = cx.pass; - row = row.trailing_field(row_weight(cx.app, Some(st.width)), move |out| pass.borrow_mut().acts.push(Act::Weight(target, Box::new(out)))); + row = row.trailing_field(field, move |out| pass.borrow_mut().acts.push(Act::Weight(target, Box::new(out)))); } else { - row = row.trailing_space(row_weight(cx.app, None)); + row = row.trailing_space(row_weight(cx.app, None, &())); } let painted = if new_art { Painted::NewArt { fill } } else { Painted::Item(i) }; let pass = cx.pass; @@ -894,8 +899,8 @@ fn paint_swatch(fill: bool, paint: &Paint) -> Swatch { /// The weight field of a stroke row, or the room it takes in a fill row: the Stroke panel's field as a small control, /// as the row's swatch is, without the presets list (a step still stops at each preset), so the row's label shows /// whole in the narrowest group. -fn row_weight(app: &VectorcraftApp, weight: Option) -> NumberField<'static> { - stroke::steps_weight(app, weight).size(ControlSize::Sm) +fn row_weight(app: &VectorcraftApp, weight: Option, target: &impl egui::AsIdSalt) -> NumberField<'static> { + stroke::steps_weight(app, weight, target).size(ControlSize::Sm) } /// A stroke row's notes after the weight: its brush and "Dashed". diff --git a/crates/ui-egui/src/panels/stroke.rs b/crates/ui-egui/src/panels/stroke.rs index 8ea894b54a..ab8ca628d2 100644 --- a/crates/ui-egui/src/panels/stroke.rs +++ b/crates/ui-egui/src/panels/stroke.rs @@ -3,6 +3,7 @@ // PLAN: import paths of craft_ui / craft_draw items are assumed from the crates' own module layout (craft_draw is // not yet a dependency of ui-egui; its owner adds it to Cargo.toml). +use std::hash::{DefaultHasher, Hash, Hasher}; use std::sync::LazyLock; use craft::behavior::{ColumnWidth, EditEvent, GestureId, IconId, Mixed}; @@ -27,7 +28,9 @@ use craft::ui::text::{NumberField, NumberOutput, NumberPick, StepArrows}; use egui::{Rect, Ui, pos2}; use serde_json::{Value, json}; use vectorcraft_color::{Color, Paint}; -use vectorcraft_doc::{Appearance, ArrowAlign, Arrowhead, Dash, Document, LineCap, LineJoin, Node, StrokeAlign, StrokeLayer, Unit, WidthProfile}; +use vectorcraft_doc::{ + Appearance, ArrowAlign, Arrowhead, Dash, Document, LineCap, LineJoin, Node, NodeId, StrokeAlign, StrokeLayer, Unit, WidthProfile, +}; use vectorcraft_engine::inspect::StrokeMixed; use vectorcraft_tools::PaintDefaults; @@ -45,6 +48,15 @@ const ARROWHEAD_ASPECT: (u16, u16) = (2, 1); /// The key of [`StrokePanel::brushed`]: (document uid, revision, active Appearance row). type BrushedKey = (u64, u64, Option); +#[derive(Clone, Debug, Default)] +struct FieldGesture { + held: Option<(EditTarget, EditTarget)>, + serial: u64, +} + +/// Global Edit members in propagation order, with the transforms that place each member. +type GlobalEditTarget = Option>; + /// What the Stroke panel remembers between frames; `UiState::stroke_panel` holds it. #[derive(Clone, Debug, Default)] pub(crate) struct StrokePanel { @@ -60,6 +72,10 @@ pub(crate) struct StrokePanel { pub link_open: bool, /// The running gesture of a Stroke panel select. pub select_gesture: Option, + /// The editor gesture's starting target and targeting state. + editor_gesture: FieldGesture, + /// The arrow scale gesture's starting target and targeting state. + scale_gesture: FieldGesture, } /// The stroke a weight edit goes to. @@ -391,22 +407,125 @@ static BLANK_WEIGHT_STOPS: [f64; 2] = [0.25, 0.5]; /// scrubbing by its label, blank when mixed. A plain step stops at each preset (0.52 pt goes down to 0.5 pt, not to /// 0 pt); Shift or Page steps the grid by ten. // PLAN: the sheet names `NumberField<'static, f64>`; `NumberField::length` takes `Option`. -pub(crate) fn weight_number(app: &VectorcraftApp, weight: Option) -> NumberField<'static> { - let field = steps_weight(app, weight); +pub(crate) fn weight_number(app: &VectorcraftApp, weight: Option, target: &EditTarget) -> NumberField<'static> { + let field = steps_weight(app, weight, target); match weight_ladder(app) { Some(l) => field.presets(&l.rows), None => field, } } +/// The document edit state and session destination before a preview. +/// A field drops its unfinished value when either changes. +#[derive(Clone, Debug, Hash, PartialEq, Eq)] +pub(crate) struct Target { + /// The document. + doc: u64, + /// How many times File > Revert replaced the document's content. + reverts: u64, + /// The revision of the document that the next preview builds on. + revision: u64, + /// The pre-preview new-art paint state. + new_art: u64, + /// Whether new art uses a basic appearance. + new_art_basic: bool, + /// The selected objects and subjects, in targeting order. + objects: Vec, + subjects: Vec, + /// The active appearance row. + row: Option, + /// The selected object inside a dynamic symbol instance: its instance and path through the symbol's art. + symbol_part: Option<(NodeId, Vec)>, + /// Whether the Live Paint Bucket's stroke is edited. + bucket: bool, + /// The type object and characters the Type tool has selected. + characters: Option<(NodeId, usize, usize)>, + /// The frame ids in thread order when the Type tool has selected the whole story. + story: Option>, + /// The members and placement transforms used to propagate Global Edit changes. + global_edit: GlobalEditTarget, + /// Distinguishes a canceled gesture from a replacement with the same starting content. + gesture: u64, +} + +/// The edit target of the Stroke panel's fields, `None` without a document. +pub(crate) type EditTarget = Option; + +/// The [`EditTarget`] of the active document. +pub(crate) fn edit_target(app: &VectorcraftApp, _ctx: &egui::Context) -> EditTarget { + let st = app.session.active()?; + Some(Target { + doc: st.uid, + reverts: st.reverts, + revision: st.interaction.as_ref().map_or(st.revision, |it| it.revision), + new_art: if may_edit_new_art(app) { + paint_digest(vectorcraft_engine::inspect::new_art_paint_before_preview(&app.session)) + } else { + vectorcraft_engine::inspect::new_art_paint_before_preview(&app.session).stroke_width.to_bits() + }, + new_art_basic: app.session.prefs.new_art_basic, + objects: st.selection.objects.clone(), + subjects: st.selection.subjects().to_vec(), + row: app.session.appearance_item(), + symbol_part: st.selection.symbol_part.as_ref().map(|part| (part.instance, part.path.clone())), + bucket: app.session.tool_paints(true), + characters: character::text_editing(app), + story: character::text_story(app), + global_edit: st.global_edit.as_ref().map(|ge| ge.members.iter().map(|(id, xf)| (*id, xf.as_coeffs().map(f64::to_bits))).collect()), + gesture: 0, + }) +} + +pub(crate) fn target_key(target: &EditTarget) -> u64 { + let mut hasher = DefaultHasher::new(); + target.hash(&mut hasher); + hasher.finish() +} + +/// Whether the fields can edit the new-art paint. A selected path the Stroke panel edits directly +/// (not a guide, a clipping path or a Live Paint part) is always a target, so with one selected +/// the fields edit objects and the target skips formatting the new-art paint. +fn may_edit_new_art(app: &VectorcraftApp) -> bool { + use vectorcraft_tools::builder::{SOURCES_NAME, is_live_paint}; + let Some(st) = app.session.active() else { return true }; + if app.session.tool_paints(true) { + return true; + } + let d = &st.doc; + let edited_path = |id: NodeId| { + d.node(id).is_some_and(|n| matches!(n.kind, vectorcraft_doc::NodeKind::Path { guide: false, clipping: false, .. }) && !n.is_ruler_guide()) + && d.parent_of(id).and_then(|p| d.node(p)).is_none_or(|p| !is_live_paint(p) && p.name.as_deref() != Some(SOURCES_NAME)) + }; + !st.selection.objects.iter().any(|id| edited_path(*id)) +} + +fn paint_digest(paint: &impl std::fmt::Debug) -> u64 { + use std::fmt::Write as _; + + struct HashSink(DefaultHasher); + impl std::fmt::Write for HashSink { + fn write_str(&mut self, s: &str) -> std::fmt::Result { + self.0.write(s.as_bytes()); + Ok(()) + } + } + + let mut sink = HashSink(DefaultHasher::new()); + let _ = write!(sink, "{paint:?}"); + sink.0.finish() +} + /// [`weight_number`] without the presets list: a plain step still stops at each preset. -pub(crate) fn steps_weight(app: &VectorcraftApp, weight: Option) -> NumberField<'static> { +pub(crate) fn steps_weight(app: &VectorcraftApp, weight: Option, target: &impl egui::AsIdSalt) -> NumberField<'static> { let unit = app.session.stroke_unit(); let lengths = crate::fields::bare_points(LengthUnits::new(UnitKind::Points, shown_kind(unit), 72.0), app.session.prefs.numbers_without_units_are_points); let ladder = weight_ladder(app); - let field = - NumberField::length(tl!("Weight"), Bind::given(weight), lengths).range(0.0..=1000.0).step_arrows(StepArrows::Leading).scrub_by_label(); + let field = NumberField::length(tl!("Weight"), Bind::given(weight), lengths) + .range(0.0..=1000.0) + .step_arrows(StepArrows::Leading) + .scrub_by_label() + .edit_target(target); // The stepper steps the number the field shows; the ladders are in points. let in_points = move |stops: &'static [f64], blank: bool| { let step = crate::fields::stops_stepper(1.0, stops, move |pt| unit.format(pt)); @@ -449,8 +568,15 @@ pub(crate) fn apply_weight(app: &mut VectorcraftApp, out: &NumberOutput, target: /// The weight field in a row labelled `label` with the side label `side`: the output of the number field, none when /// the row's body did not run. -fn weight_row(app: &VectorcraftApp, ui: &mut Ui, label: &'static str, side: SideLabel, weight: Option) -> Option { - Field::new(label).side(side).id_salt("weight").sizing(Sizing::Content).show(ui, |ui, _| weight_number(app, weight).show(ui)).inner +fn weight_row( + app: &VectorcraftApp, + ui: &mut Ui, + label: &'static str, + side: SideLabel, + weight: Option, + target: &EditTarget, +) -> Option { + Field::new(label).side(side).id_salt("weight").sizing(Sizing::Content).show(ui, |ui, _| weight_number(app, weight, target).show(ui)).inner } /// The weight field whose link side label (`label`: the Control bar's "Stroke:", the Properties panel's "Stroke") @@ -459,7 +585,8 @@ fn weight_row(app: &VectorcraftApp, ui: &mut Ui, label: &'static str, side: Side pub(crate) fn link_field(app: &mut VectorcraftApp, ui: &mut Ui, label: &'static str, weight: Option) { let side = SideLabel::new().scrub(true).link().role(FieldLabelRole::Describes).tooltip(TooltipSpec::new(tl!("Stroke options"))); let mut open = app.ui.stroke_panel.link_open; - if let Some(out) = weight_row(app, ui, label, side, weight) { + let target = edit_target(app, ui.ctx()); + if let Some(out) = weight_row(app, ui, label, side, weight, &target) { apply_weight(app, &out, WeightTarget::Shown); open ^= out.link; } @@ -487,30 +614,66 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { } } +/// Keeps a group's starting key while its own gesture runs in the same targeting state. +fn gesture_target(gesture: &mut FieldGesture, target: EditTarget) -> EditTarget { + let changed = gesture.held.as_ref().is_some_and(|(_, produced)| produced != &target); + if changed { + gesture.held = None; + gesture.serial = gesture.serial.wrapping_add(1); + } + let mut target = gesture.held.as_ref().map_or(target, |(target, _)| target.clone()); + if let Some(target) = &mut target { + target.gesture = gesture.serial; + } + target +} + +/// Keeps the starting target and the content produced after the component's edits are applied. +fn remember_gesture(gesture: &mut FieldGesture, target: &EditTarget, events: &craft::behavior::EditEvents, produced: EditTarget) { + for event in events.iter() { + match event { + EditEvent::Begin { .. } => gesture.held = Some((target.clone(), produced.clone())), + EditEvent::Commit { .. } | EditEvent::Cancel { .. } => gesture.held = None, + _ => {} + } + } + if let Some((_, last)) = &mut gesture.held { + *last = produced; + } +} + /// The rows of [`show`]. fn rows(app: &mut VectorcraftApp, ui: &mut Ui) { let st = current_stroke(app); let mixed = stroke_mixed(app, ui.ctx()); let weight = shown_weight(app, st.as_ref(), &mixed); - if let Some(out) = weight_row(app, ui, tl!("Weight"), SideLabel::new().scrub(true), weight) { + let mut target = edit_target(app, ui.ctx()); + if let Some(out) = weight_row(app, ui, tl!("Weight"), SideLabel::new().scrub(true), weight, &target) { apply_weight(app, &out, WeightTarget::Shown); + target = edit_target(app, ui.ctx()); } if app.ui.stroke_panel.hide_options { + app.ui.stroke_panel.editor_gesture.held = None; + app.ui.stroke_panel.scale_gesture.held = None; return; } let style = style_of(st.as_ref()); + let editor_target = gesture_target(&mut app.ui.stroke_panel.editor_gesture, target.clone()); let editor = StrokeEditor::new(tl!("Stroke"), Bind::given(style.clone())) .sections(StrokeSections::PANEL | StrokeSections::DASH_ALIGN) .closed(mixed.can_align) .caps_on_closed(true) .mixed(&mixed_of(&mixed)) - .host_labels(true); + .host_labels(true) + .edit_target(&editor_target); let output = editor.show(ui); if let (Some(new), Some(field)) = (output.events.landed(), output.field) { apply_style(app, &style, new.clone(), field); + target = edit_target(app, ui.ctx()); } + remember_gesture(&mut app.ui.stroke_panel.editor_gesture, &editor_target, &output.events, target.clone()); Divider::horizontal().show(ui); - arrow_rows(app, ui, st.as_ref()); + arrow_rows(app, ui, st.as_ref(), target); Divider::horizontal().show(ui); Field::new(tl!("Profile")).show(ui, |ui, _| { Row::new().wrap(true).show(ui, |ui, _| { @@ -520,8 +683,11 @@ fn rows(app: &mut VectorcraftApp, ui: &mut Ui) { }); } -/// The arrowhead rows: the start and end heads with Swap, the two scales with their link, and the alignment. -fn arrow_rows(app: &mut VectorcraftApp, ui: &mut Ui, st: Option<&StrokeLayer>) { +/// The arrowhead rows: the start and end heads with Swap, the two scales with their link, and the alignment. `target` +/// is the current edit target used to track scale gestures. +fn arrow_rows(app: &mut VectorcraftApp, ui: &mut Ui, st: Option<&StrokeLayer>, target: EditTarget) { + let scale_target = gesture_target(&mut app.ui.stroke_panel.scale_gesture, target.clone()); + let mut updated = false; let custom: Vec = app.session.arrowheads.heads().iter().cloned().map(Arrowhead::Custom).collect(); let entries: Vec>> = std::iter::once(None) .chain(Arrowhead::ALL.iter().cloned().map(Some)) @@ -546,10 +712,12 @@ fn arrow_rows(app: &mut VectorcraftApp, ui: &mut Ui, st: Option<&StrokeLayer>) { let out = if listed { select } else { select.unlisted_label(unlisted_arrow_name(head.as_ref())) }.show(ui); // A custom head goes with its art, as document.inspect reports it. apply_select(app, key, &out, |app, a| set(app, json!({ key: a }))); + updated |= out.events.iter().next().is_some(); } let swap = IconButton::new(IconId::new("arrow-left-right")).label(tl!("Swap start and end arrowheads")).enabled(st.is_some()).show(ui); if swap.clicked() { app.run("stroke.setAdvanced", json!({"swapArrows": true})).ok(); + updated = true; } }); }); @@ -563,6 +731,7 @@ fn arrow_rows(app: &mut VectorcraftApp, ui: &mut Ui, st: Option<&StrokeLayer>) { .mode(LinkMode::Equal) .unit_kind(UnitKind::Percent) .enabled(has_head) + .edit_target(&scale_target) .show(ui) }) .inner; @@ -571,6 +740,13 @@ fn arrow_rows(app: &mut VectorcraftApp, ui: &mut Ui, st: Option<&StrokeLayer>) { } if let Some([a, b]) = out.as_ref().and_then(|out| out.edit.events.landed()).map(|p| (*p).map(|m| m.same().copied().flatten())) { app.run("stroke.setAdvanced", json!({"arrowScale": [a.unwrap_or(scale.0), b.unwrap_or(scale.1)]})).ok(); + updated = true; + } + if let Some(out) = &out { + let produced = if updated { edit_target(app, ui.ctx()) } else { target }; + remember_gesture(&mut app.ui.stroke_panel.scale_gesture, &scale_target, &out.edit.events, produced); + } else { + app.ui.stroke_panel.scale_gesture.held = None; } let aligns: Vec> = ARROW_ALIGN.iter().map(|(v, _, icon, tip)| Entry::new(*v, *tip).icon(IconId::new(icon))).collect(); let out = Field::new(tl!("Align")) @@ -988,6 +1164,15 @@ mod tests { use super::*; use crate::tests::panel_harness::Panel; + #[test] + fn paint_digest_tracks_stroke_width() { + let paint = PaintDefaults::default(); + let mut changed = paint.clone(); + assert_eq!(paint_digest(&paint), paint_digest(&changed)); + changed.stroke_width += 1.0; + assert_ne!(paint_digest(&paint), paint_digest(&changed)); + } + #[test] fn editing_an_extended_dash_keeps_other_stroke_options_and_is_undoable() { use vectorcraft_engine::Session; @@ -1009,6 +1194,41 @@ mod tests { assert_eq!(current_stroke(&app).unwrap(), after); } + /// A field group's running gesture keeps the target it began with while its own edits change the stroke, and + /// takes the current target again once the gesture ends or the selection changes. + #[test] + fn a_gesture_keeps_its_starting_target_until_it_ends() { + let (mut app, path) = profiled_line(None); + let other = app.run("shape.line", json!({"x1": 10, "y1": 80, "x2": 90, "y2": 80})).unwrap(); + app.run("select.set", json!({"ids": [path["id"]]})).unwrap(); + let ctx = egui::Context::default(); + let shown = |target: &EditTarget| format!("{target:?}"); + let event = |e: EditEvent| craft::behavior::EditEvents::from(e); + let id = GestureId::new(1); + let mut gesture = FieldGesture::default(); + + let start = edit_target(&app, &ctx); + remember_gesture(&mut gesture, &start, &event(EditEvent::begin(id, Mixed::Same(10.0), std::sync::Arc::from("Miter"), None)), start.clone()); + app.run("stroke.set", json!({"miterLimit": 22})).unwrap(); + let fresh = edit_target(&app, &ctx); + assert_ne!(shown(&fresh), shown(&start), "the gesture's own edit changes the stroke's target"); + remember_gesture(&mut gesture, &start, &craft::behavior::EditEvents::::new(), fresh.clone()); + let held = gesture_target(&mut gesture, fresh.clone()); + assert_eq!(shown(&held), shown(&start), "the running gesture keeps its starting target"); + + remember_gesture(&mut gesture, &held, &event(EditEvent::commit(id, Mixed::Same(10.0), 22.0)), fresh.clone()); + let fresh = edit_target(&app, &ctx); + assert_eq!(shown(&gesture_target(&mut gesture, fresh)), shown(&edit_target(&app, &ctx)), "a commit ends it"); + + let start = edit_target(&app, &ctx); + remember_gesture(&mut gesture, &start, &event(EditEvent::begin(id, Mixed::Same(22.0), std::sync::Arc::from("Miter"), None)), start.clone()); + app.run("select.set", json!({"ids": [other["id"]]})).unwrap(); + let fresh = edit_target(&app, &ctx); + let now = gesture_target(&mut gesture, fresh); + assert_ne!(shown(&now), shown(&start), "another selection ends the held target"); + assert!(gesture.held.is_none()); + } + /// The Profile and arrowhead selects name a current value that is none of their choices on the closed face, and /// the open list keeps only the choices. #[test] diff --git a/crates/ui-egui/src/panels/tests_stroke.rs b/crates/ui-egui/src/panels/tests_stroke.rs index 66cf954339..c2747a2615 100644 --- a/crates/ui-egui/src/panels/tests_stroke.rs +++ b/crates/ui-egui/src/panels/tests_stroke.rs @@ -1,6 +1,9 @@ -//! Headless frames of the Stroke panel's Dashed Line section. +//! Headless frames of the Stroke panel: its Dashed Line section, its row layout, and what its number fields edit. +use craft::ui::contract::Role; +use egui::{Key, Modifiers}; use serde_json::json; +use vectorcraft_doc::NodeId; use crate::tests::panel_harness::Panel; // PLAN: assumed path of object-panels-w8's `Panel` harness (op.A15). @@ -41,3 +44,1138 @@ fn the_panel_rows_start_their_controls_at_one_x() { let first = starts[0].1; assert!(starts.iter().all(|(_, x)| (x - first).abs() < 0.5), "controls start at {starts:?}"); } + +/// A document with two lines, `a` and `b`, with the same dashed stroke and start arrowhead, and `a` selected. +fn two_lines() -> (VectorcraftApp, NodeId, NodeId) { + let mut app = crate::testing::windowed(VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default())); + run(&mut app, "file.new", json!({"width": 200, "height": 200})); + let mut line = |y: f64| NodeId(run(&mut app, "shape.line", json!({"x1": 10, "y1": y, "x2": 190, "y2": y}))["id"].as_u64().unwrap()); + let (a, b) = (line(50.0), line(150.0)); + let head = serde_json::to_value(&vectorcraft_doc::Arrowhead::ALL[0]).unwrap(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "stroke.set", json!({"dash": [12, 12], "startArrow": head})); + run(&mut app, "select.set", json!({"ids": [a.0]})); + (app, a, b) +} + +/// The top stroke of object `id`. +fn stroke_of(app: &VectorcraftApp, id: NodeId) -> vectorcraft_doc::StrokeLayer { + app.session.active().unwrap().doc.node(id).unwrap().appearance.stroke().unwrap().clone() +} + +/// Starts an unfinished value in the number field `name`: selects its text and types `3+`. +fn start_typing(p: &mut Panel, name: &str) { + p.click_role(name, Role::SPIN_BUTTON); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("3+"); +} + +/// Types `5` into the focused field and presses Enter. +fn finish_typing(p: &mut Panel) { + p.type_text("5"); + p.key(Key::Enter, Modifiers::NONE); +} + +#[test] +fn an_unfinished_value_does_not_reach_another_line_with_the_same_stroke() { + type Read = fn(&vectorcraft_doc::StrokeLayer) -> f64; + let fields: [(&str, Read); 6] = [ + ("Weight", |s| s.width), + ("Miter limit", |s| s.miter_limit), + ("Dash 1", |s| s.dash.as_ref().map_or(0.0, |d| d.pattern[0])), + ("Gap 1", |s| s.dash.as_ref().map_or(0.0, |d| d.pattern[1])), + ("Dash offset", |s| s.dash.as_ref().map_or(0.0, |d| d.offset)), + ("Scale 1", |s| s.arrow_scale.0), + ]; + for (name, read) in fields { + let (app, a, b) = two_lines(); + let before = read(&stroke_of(&app, a)); + assert_eq!(before, read(&stroke_of(&app, b)), "{name}: both lines start with one value"); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, name); + 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}: the field drops the value typed for a"); + finish_typing(&mut p); + let app = p.app(); + assert_eq!((read(&stroke_of(&app, a)), read(&stroke_of(&app, b))), (before, 5.0), "{name}: b takes 5, not 3+5"); + } +} + +/// The weight field the Control bar and the Properties panel show beside their Stroke link label. +fn show_link_field(app: &mut VectorcraftApp, ui: &mut egui::Ui) { + let shown = current_stroke(app); + let mixed = stroke_mixed(app, ui.ctx()); + let weight = stroke::shown_weight(app, shown.as_ref(), &mixed); + stroke::link_field(app, ui, "Stroke:", weight); +} + +#[test] +fn an_unfinished_link_field_weight_does_not_reach_another_line() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "stroke.set", json!({"weight": 2})); + run(&mut app, "select.set", json!({"ids": [a.0]})); + let mut p = Panel::new(app, show_link_field); + start_typing(&mut p, "Weight"); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+"), "the field drops the value typed for a"); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + assert_eq!((stroke_of(&app, a).width, stroke_of(&app, b).width), (2.0, 1.0), "b takes 1 pt, not 3+1, and a keeps 2 pt"); +} + +#[test] +fn changing_the_new_art_width_drops_an_unfinished_weight_on_a_selected_path() { + let mut app = app_with_rect(); + let id = app.session.active().unwrap().selection.objects[0]; + run(&mut app, "stroke.set", json!({"weight": 2})); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("stroke.set", json!({"defaultsOnly": true, "weight": 7})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + assert_ne!(app.session.paint.stroke_width, 4.0, "the new-art width does not receive the unfinished expression"); + assert_eq!(stroke_of(&app, id).width, 1.0); +} + +#[test] +fn replacing_the_new_art_stroke_drops_an_unfinished_weight() { + let (mut app, _, _) = two_lines(); + run(&mut app, "select.set", json!({"ids": []})); + let before = app.session.new_art_stroke(); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("stroke.set", json!({"cap": "round"})).unwrap(); + assert_eq!(p.app().session.new_art_stroke().width, before.width); + assert_ne!(p.app().session.new_art_stroke().cap, before.cap); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + assert_eq!(p.app().session.new_art_stroke().width, 5.0); +} + +#[test] +fn adding_an_identical_new_art_stroke_drops_an_unfinished_weight() { + let (mut app, _, _) = two_lines(); + let name = run(&mut app, "graphicStyle.new", json!({"name": "Stroke"}))["name"].as_str().unwrap().to_owned(); + run(&mut app, "select.set", json!({"ids": []})); + run(&mut app, "graphicStyle.apply", json!({"name": name})); + let before = app.session.new_art(); + assert_eq!(before.items.iter().filter(|item| !item.is_fill()).count(), 1); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("graphicStyle.apply", json!({"name": name, "add": true})).unwrap(); + let after = p.app().session.new_art(); + assert_eq!(after.items.iter().filter(|item| !item.is_fill()).count(), 2); + assert_eq!(before.stroke(), after.stroke()); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + let app = p.app(); + assert_eq!(app.session.new_art_stroke().width, 5.0); + assert!(app.session.new_art().items.iter().all(|item| match item { + vectorcraft_doc::AppearanceItem::Stroke(stroke) => stroke.width != 8.0, + _ => true, + })); +} + +#[test] +fn changing_a_later_character_stroke_drops_an_unfinished_weight() { + use vectorcraft_doc::NodeKind; + let mut app = app_with_rect(); + let id = NodeId(run(&mut app, "text.create", json!({"x": 20, "y": 100, "text": "Stroke"}))["id"].as_u64().unwrap()); + run(&mut app, "select.set", json!({"ids": [id.0]})); + run(&mut app, "paint.setStroke", json!({"color": "#ff0000"})); + let before = app.session.shown_stroke().unwrap().width; + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("text.setRangeStyle", json!({"id": id.0, "start": 2, "end": 6, "strokeOptions": {"weight": 2}})).unwrap(); + assert_eq!(p.app().session.shown_stroke().unwrap().width, before); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + assert!(t.runs.iter().all(|run| run.style.stroke_width == 1.0), "each character takes the fresh weight"); +} + +#[test] +fn a_collapsed_type_caret_drops_an_unfinished_weight_when_other_characters_change() { + use vectorcraft_doc::NodeKind; + let mut app = app_with_rect(); + let id = NodeId(run(&mut app, "text.create", json!({"x": 20, "y": 100, "text": "Stroke"}))["id"].as_u64().unwrap()); + run(&mut app, "text.setRangeStyle", json!({"id": id.0, "strokeOptions": {"weight": 1}})); + run(&mut app, "select.set", json!({"ids": [id.0]})); + app.session.select_tool("type", Default::default()).unwrap(); + app.session.set_tool_option("textSelection", &json!({"editing": id.0, "anchor": 1, "caret": 1})); + assert_eq!(character::text_editing(&app), Some((id, 1, 1))); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("text.setRangeStyle", json!({"id": id.0, "start": 3, "end": 6, "strokeOptions": {"weight": 2}})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + assert!(t.runs.iter().all(|run| run.style.stroke_width != 4.0), "the unfinished expression reaches no character"); + assert!(t.runs.iter().all(|run| run.style.stroke_width == 1.0), "the fresh weight edits the whole frame"); +} + +#[test] +fn moving_a_run_boundary_in_selected_characters_drops_an_unfinished_weight() { + use vectorcraft_doc::NodeKind; + let mut app = app_with_rect(); + let id = NodeId(run(&mut app, "text.create", json!({"x": 20, "y": 100, "text": "Stroke"}))["id"].as_u64().unwrap()); + run(&mut app, "text.setRangeStyle", json!({"id": id.0, "start": 0, "end": 2, "strokeOptions": {"weight": 1}})); + run(&mut app, "text.setRangeStyle", json!({"id": id.0, "start": 2, "end": 6, "strokeOptions": {"weight": 2}})); + run(&mut app, "select.set", json!({"ids": [id.0]})); + app.session.select_tool("type", Default::default()).unwrap(); + app.session.set_tool_option("textSelection", &json!({"editing": id.0, "anchor": 1, "caret": 5})); + assert_eq!(character::text_editing(&app), Some((id, 1, 5))); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("text.setRangeStyle", json!({"id": id.0, "start": 2, "end": 3, "strokeOptions": {"weight": 1}})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + assert!(t.runs.iter().all(|run| run.style.stroke_width != 4.0), "the unfinished expression reaches no character"); + let widths: Vec<_> = t.runs.iter().map(|run| (run.text.as_str(), run.style.stroke_width)).collect(); + assert_eq!(widths, [("Strok", 1.0), ("e", 2.0)], "the fresh weight edits only the selected characters"); +} + +/// Enables drags on numeric field bodies while showing the Stroke panel. +fn show_with_field_scrubbing(app: &mut VectorcraftApp, ui: &mut egui::Ui) { + use craft::ui::runtime::env::{ScrubDrags, with_env}; + with_env( + ui, + |env| { + env.values.set(ScrubDrags::FieldAndLabel); + }, + |ui| stroke::show(app, ui), + ); +} + +#[test] +fn moving_another_stroke_to_the_top_ends_a_held_dash_scrub() { + let (mut app, a, _) = two_lines(); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "stroke.set", json!({"dash": [12, 12]})); + run(&mut app, "appearance.moveItem", json!({"from": 0, "to": 2})); + assert_eq!(app.session.active().unwrap().doc.node(a).unwrap().appearance.items.iter().rposition(|item| !item.is_fill()), Some(1)); + let mut p = Panel::new(app, show_with_field_scrubbing); + p.drag_hold_role("Dash 1", Role::SPIN_BUTTON, egui::vec2(12.0, 0.0)); + let first = stroke_of(&p.app(), a).dash.unwrap().pattern[0]; + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(24.0, 0.0))]); + assert!(stroke_of(&p.app(), a).dash.unwrap().pattern[0] > first, "the held gesture changes its starting stroke"); + p.app().run("appearance.moveItem", json!({"from": 0, "to": 2})).unwrap(); + assert_eq!(p.app().session.active().unwrap().doc.node(a).unwrap().appearance.items.iter().rposition(|item| !item.is_fill()), Some(2)); + let before = stroke_of(&p.app(), a); + p.frame(); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(48.0, 0.0))]); + p.frame(); + p.release(); + assert_eq!(stroke_of(&p.app(), a), before, "later pointer moves leave the new top stroke unchanged"); +} + +#[test] +fn swapping_the_top_strokes_ends_a_held_scrub_at_the_same_row() { + let (mut app, a, _) = two_lines(); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "stroke.set", json!({"dash": [12, 12]})); + let top = app.session.active().unwrap().doc.node(a).unwrap().appearance.items.iter().rposition(|item| !item.is_fill()); + let mut p = Panel::new(app, show_with_field_scrubbing); + p.drag_hold_role("Dash 1", Role::SPIN_BUTTON, egui::vec2(12.0, 0.0)); + let first = stroke_of(&p.app(), a).dash.unwrap().pattern[0]; + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(24.0, 0.0))]); + p.frame(); + assert!(stroke_of(&p.app(), a).dash.unwrap().pattern[0] > first, "the scrub keeps changing its starting stroke"); + p.app().run("appearance.moveItem", json!({"from": 1, "to": 2})).unwrap(); + assert_eq!(p.app().session.active().unwrap().doc.node(a).unwrap().appearance.items.iter().rposition(|item| !item.is_fill()), top); + let before = stroke_of(&p.app(), a); + p.frame(); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(48.0, 0.0))]); + p.frame(); + p.release(); + assert_eq!(stroke_of(&p.app(), a), before, "the held scrub leaves the replacement stroke unchanged"); +} + +#[test] +fn changing_global_edit_members_drops_an_unfinished_weight() { + for change in ["start", "stop", "exclude"] { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + let b = NodeId(run(&mut app, "edit.duplicate", json!({"dx": 20}))["ids"][0].as_u64().unwrap()); + let c = NodeId(run(&mut app, "edit.duplicate", json!({"dy": 20}))["ids"][0].as_u64().unwrap()); + run(&mut app, "select.set", json!({"ids": [a.0]})); + if change != "start" { + run(&mut app, "select.globalEdit", json!({})); + assert_eq!(app.session.active().unwrap().global_edit.as_ref().unwrap().members.len(), 3); + } + let before = [a, b, c].map(|id| stroke_of(&app, id)); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + if change == "exclude" { + p.app().run("select.globalEditExclude", json!({"id": b.0})).unwrap(); + } else { + p.app().run("select.globalEdit", json!({})).unwrap(); + } + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+"), "{change}: the draft is dropped"); + finish_typing(&mut p); + for (id, before) in [a, b, c].into_iter().zip(before) { + let after = stroke_of(&p.app(), id); + assert_ne!(after.width, 8.0, "{change}: the unfinished value reaches no member"); + assert!(after.width == before.width || after.width == 5.0, "{change}: only the fresh weight can be applied"); + } + } +} + +#[test] +fn replacing_text_with_the_same_byte_length_drops_an_unfinished_weight() { + use vectorcraft_doc::NodeKind; + let mut app = app_with_rect(); + let id = NodeId(run(&mut app, "text.create", json!({"x": 20, "y": 100, "text": "Stroke"}))["id"].as_u64().unwrap()); + run(&mut app, "select.set", json!({"ids": [id.0]})); + run(&mut app, "paint.setStroke", json!({"color": "#ff0000"})); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("text.setText", json!({"id": id.0, "text": "Weight"})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + let app = p.app(); + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + assert_eq!(t.plain_text(), "Weight"); + assert!(t.runs.iter().all(|run| run.style.stroke_width == 5.0), "the replacement text takes only the fresh value"); +} + +#[test] +fn a_new_art_weight_scrub_keeps_going() { + let (mut app, _, _) = two_lines(); + run(&mut app, "select.set", json!({"ids": []})); + let mut p = Panel::new(app, stroke::show); + p.drag_hold_role("Weight", Role::LABEL, egui::vec2(12.0, 0.0)); + let first = p.app().session.new_art_stroke().width; + p.frame(); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(24.0, 0.0))]); + p.frame(); + let further = p.app().session.new_art_stroke().width; + assert!(further > first, "the held scrub keeps increasing the new-art weight"); + p.release(); + assert_eq!(p.app().session.new_art_stroke().width, further); +} + +#[test] +fn an_unfinished_weight_stays_with_its_line_and_document() { + let (mut app, a, _) = two_lines(); + // A second document built the same way: its line `a` has the same id and weight. + run(&mut app, "file.new", json!({"width": 200, "height": 200})); + let other = run(&mut app, "shape.line", json!({"x1": 10, "y1": 50, "x2": 190, "y2": 50}))["id"].as_u64().unwrap(); + assert_eq!(other, a.0, "both documents' lines have the same id"); + run(&mut app, "select.set", json!({"ids": [a.0]})); + run(&mut app, "document.activate", json!({"index": 0})); + let mut p = Panel::new(app, stroke::show); + + // With the selection and the document unchanged, the value typed so far is kept: 3+5 gives 8. + start_typing(&mut p, "Weight"); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), a).width, 8.0, "an unchanged target keeps the typed value"); + p.app().run("stroke.set", json!({"weight": 1})).unwrap(); + + // Another document with the same selection drops it. + start_typing(&mut p, "Weight"); + p.app().run("document.activate", json!({"index": 1})).unwrap(); + p.frame(); + finish_typing(&mut p); + let width = |index: u64| { + p.app().run("document.activate", json!({"index": index})).unwrap(); + stroke_of(&p.app(), a).width + }; + assert_eq!((width(0), width(1)), (1.0, 5.0), "the other document takes 5 pt"); +} + +#[test] +fn an_unfinished_weight_is_dropped_by_file_revert() { + let (mut app, a, _) = two_lines(); + let dir = vectorcraft_testkit::TempDir::new("stroke-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("Lines.vectorcraft")})).unwrap(); + // An unsaved change for Revert to undo, leaving the lines as saved. + app.run("shape.rectangle", json!({"x": 100, "y": 80, "width": 20, "height": 20})).unwrap(); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + + // The restored document has the same line and, selected again, the same selection. + p.app().run("file.revert", json!({"confirmed": true})).unwrap(); + p.app().run("select.set", json!({"ids": [a.0]})).unwrap(); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "Revert drops the unfinished value"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_another_appearance_row_becomes_active() { + let (mut app, a, _) = two_lines(); + // Two strokes of 1 pt: the Stroke panel edits the active one. + run(&mut app, "appearance.addStroke", json!({})); + let strokes: Vec = { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect() + }; + let [first, second] = strokes[..] else { panic!("two stroke rows: {strokes:?}") }; + appearance::select_row(&mut app, appearance::Sel::Item(first)); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + appearance::select_row(&mut p.app(), appearance::Sel::Item(second)); + assert_eq!(p.app().session.appearance_item(), Some(second)); + p.frame(); + finish_typing(&mut p); + let widths = { + let app = p.app(); + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + (ap.stroke_at(Some(first)).unwrap().width, ap.stroke_at(Some(second)).unwrap().width) + }; + assert_eq!(widths, (1.0, 5.0), "the second row takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_its_layer_is_targeted() { + let (mut app, a, b) = two_lines(); + run(&mut app, "edit.clear", json!({"ids": [b.0]})); + let layer = app.session.active().unwrap().doc.parent_of(a).unwrap(); + // The layer's rows match the path's: a fill under a 1 pt stroke. + run(&mut app, "appearance.addFill", json!({"ids": [layer.0]})); + run(&mut app, "appearance.addStroke", json!({"ids": [layer.0]})); + assert_eq!(stroke_of(&app, a).width, stroke_of(&app, layer).width); + let fills = |id: NodeId| -> Vec { + app.session.active().unwrap().doc.node(id).unwrap().appearance.items.iter().map(|item| item.is_fill()).collect() + }; + assert_eq!(fills(a), fills(layer), "the path and the layer have their rows in one order"); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + // The path stays selected, and `stroke.set` with no active row still edits the path's stroke. + p.app().run("layer.target", json!({"id": layer.0})).unwrap(); + assert_eq!(p.app().session.active().unwrap().selection.objects, [a]); + assert_eq!(p.app().session.appearance_item(), None, "no row is active"); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + assert_eq!((stroke_of(&app, a).width, stroke_of(&app, layer).width), (5.0, 1.0), "the subject change drops the draft and the layer keeps 1 pt"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_strokes_of_one_color_swap_places() { + let (mut app, a, _) = two_lines(); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "stroke.set", json!({"cap": "round"})); + let strokes: Vec = { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect() + }; + let [bottom, top] = strokes[..] else { panic!("two stroke rows: {strokes:?}") }; + { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + let (lower, upper) = (ap.stroke_at(Some(bottom)).unwrap(), ap.stroke_at(Some(top)).unwrap()); + assert_eq!((&lower.paint, lower.width), (&upper.paint, upper.width)); + assert_ne!(lower.cap, upper.cap); + } + let before = stroke_of(&app, a); + assert_eq!(app.session.appearance_item(), None); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.moveItem", json!({"from": top, "to": bottom})).unwrap(); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + let moved = app.session.active().unwrap().doc.node(a).unwrap().appearance.stroke_at(Some(bottom)).unwrap(); + assert_eq!((moved.cap, moved.width), (before.cap, before.width), "the moved stroke keeps its weight"); + let shown = stroke_of(&app, a); + assert_ne!(shown.cap, before.cap, "the other stroke is now on top"); + assert_eq!(shown.width, 5.0, "the top stroke takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_strokes_that_differ_in_miter_limit_swap() { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + run(&mut app, "stroke.set", json!({"miterLimit": 4})); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "stroke.set", json!({"miterLimit": 10})); + let strokes: Vec = { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect() + }; + let [bottom, top] = strokes[..] else { panic!("two stroke rows: {strokes:?}") }; + { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + let (lower, upper) = (ap.stroke_at(Some(bottom)).unwrap(), ap.stroke_at(Some(top)).unwrap()); + assert_eq!(lower.width, upper.width); + assert_eq!((lower.miter_limit, upper.miter_limit), (4.0, 10.0)); + let mut matched = upper.clone(); + matched.miter_limit = lower.miter_limit; + assert_eq!(lower, &matched, "only the miter limits differ"); + } + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.moveItem", json!({"from": top, "to": bottom})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + let app = p.app(); + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + let (lower, upper) = (ap.stroke_at(Some(bottom)).unwrap(), ap.stroke_at(Some(top)).unwrap()); + assert_eq!((lower.miter_limit, upper.miter_limit), (10.0, 4.0)); + assert_eq!((lower.width, upper.width), (1.0, 5.0), "the top stroke takes a fresh 5 pt, not 3+5"); +} + +#[test] +fn a_miter_only_stroke_swap_drops_the_miter_draft() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [b.0]})); + run(&mut app, "stroke.set", json!({"miterLimit": 6})); + let lower = stroke_of(&app, b); + run(&mut app, "appearance.addStroke", json!({})); + let upper = stroke_of(&app, a); + app.session + .edit("Strokes", |d, _| { + let ap = &mut d.node_mut(b).unwrap().appearance; + let indices: Vec<_> = (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect(); + *ap.stroke_at_mut(Some(indices[0])).unwrap() = lower.clone(); + *ap.stroke_at_mut(Some(indices[1])).unwrap() = upper.clone(); + Ok(()) + }) + .unwrap(); + let strokes: Vec<_> = { + let ap = &app.session.active().unwrap().doc.node(b).unwrap().appearance; + (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect() + }; + let [bottom, top] = strokes[..] else { panic!("two stroke rows: {strokes:?}") }; + let mut matched = lower.clone(); + matched.miter_limit = upper.miter_limit; + assert_eq!(matched, upper, "only the miter limits differ"); + assert_ne!(lower.miter_limit, upper.miter_limit); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + let shown = current_stroke(&app).unwrap().miter_limit; + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Miter limit"); + assert_eq!(p.value_role("Miter limit", Role::SPIN_BUTTON).as_deref(), Some("3+")); + p.app().run("appearance.moveItem", json!({"ids": [b.0], "from": top, "to": bottom})).unwrap(); + p.frame(); + assert_eq!(current_stroke(&p.app()).unwrap().miter_limit, shown, "the first path keeps the shown value"); + assert_ne!(p.value_role("Miter limit", Role::SPIN_BUTTON).as_deref(), Some("3+"), "the field drops the draft"); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + for id in [a, b] { + let ap = &app.session.active().unwrap().doc.node(id).unwrap().appearance; + for i in 0..ap.items.len() { + if let Some(stroke) = ap.stroke_at(Some(i)) { + assert_ne!(stroke.miter_limit, 4.0, "the draft cannot reach either path's strokes"); + } + } + } +} + +#[test] +fn an_unfinished_weight_is_dropped_when_strokes_swap_places() { + let (mut app, a, _) = two_lines(); + run(&mut app, "paint.setStroke", json!({"color": "#ff0000"})); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "paint.setStroke", json!({"color": "#0000ff"})); + let strokes: Vec = { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect() + }; + let [bottom, top] = strokes[..] else { panic!("two stroke rows: {strokes:?}") }; + let before = stroke_of(&app, a); + assert_eq!(app.session.appearance_item(), None); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.moveItem", json!({"from": top, "to": bottom})).unwrap(); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + let moved = ap.stroke_at(Some(bottom)).unwrap(); + assert_eq!((moved.paint.clone(), moved.width), (before.paint.clone(), before.width), "the moved stroke keeps its weight"); + let shown = stroke_of(&app, a); + assert_ne!(shown.paint, before.paint, "the other stroke is now on top"); + assert_eq!(shown.width, 5.0, "the top stroke takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_the_group_gets_its_own_stroke() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "object.group", json!({})); + let group = app.session.active().unwrap().selection.objects[0]; + assert!(app.session.active().unwrap().doc.node(group).unwrap().appearance.stroke().is_none()); + let before = stroke_of(&app, a).width; + assert_eq!(stroke_of(&app, b).width, before); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.addStroke", json!({"ids": [group.0]})).unwrap(); + assert_eq!(stroke_of(&p.app(), group).width, before, "the group's stroke has the members' weight"); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), group).width, 5.0, "the group's stroke takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_a_group_member_gets_a_stroke_on_top() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "object.group", json!({})); + let group = app.session.active().unwrap().selection.objects[0]; + assert!(app.session.active().unwrap().doc.node(group).unwrap().appearance.stroke().is_none()); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.addStroke", json!({"ids": [a.0]})).unwrap(); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "the member's top stroke takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_arrowhead_scale_is_dropped_when_a_member_of_a_stroked_group_gets_a_stroke_on_top() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "object.group", json!({})); + let group = app.session.active().unwrap().selection.objects[0]; + run(&mut app, "appearance.addStroke", json!({"ids": [group.0]})); + assert!(app.session.active().unwrap().doc.node(group).unwrap().appearance.stroke().is_some()); + assert_eq!(app.session.appearance_item(), None, "no row is active"); + let before = stroke_of(&app, b).arrow_scale; + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Scale 1"); + p.app().run("appearance.addStroke", json!({"ids": [b.0]})).unwrap(); + assert_eq!(stroke_of(&p.app(), b).arrow_scale, before, "the new top stroke has the same arrowhead scale"); + assert_eq!(p.app().session.active().unwrap().selection.objects, [group]); + assert_eq!(p.app().session.appearance_item(), None, "no row is active"); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), b).arrow_scale.0, 5.0, "the member's top stroke takes 5, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_a_stroke_is_added_to_the_compound_of_a_selected_member() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + let compound = NodeId(run(&mut app, "object.compoundPath.make", json!({}))["id"].as_u64().unwrap()); + run(&mut app, "select.set", json!({"ids": [a.0]})); + assert_eq!(app.session.active().unwrap().selection.objects, [a]); + assert_eq!(app.session.active().unwrap().doc.parent_of(a), Some(compound)); + let before = stroke_of(&app, compound).width; + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.addStroke", json!({"ids": [compound.0]})).unwrap(); + assert_eq!(p.app().session.active().unwrap().selection.objects, [a]); + assert_eq!(p.app().session.appearance_item(), None, "no row is active"); + assert_eq!(stroke_of(&p.app(), compound).width, before, "the top stroke has the same weight"); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + let widths: Vec = app.session.active().unwrap().doc.node(compound).unwrap().appearance.painted_strokes().map(|s| s.width).collect(); + assert_eq!(widths, [before, 5.0], "the compound's new top stroke takes 5 pt, not 3+5"); + assert!(app.session.active().unwrap().doc.node(a).unwrap().appearance.stroke().is_none(), "the member has no stroke of its own"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_another_symbol_part_is_selected() { + let (mut app, a, b) = two_lines(); + let instance = run(&mut app, "symbol.new", json!({"name": "Lines", "ids": [a.0, b.0], "type": "dynamic"}))["id"].as_u64().unwrap(); + run(&mut app, "symbol.instance.selectPart", json!({"id": instance, "path": [0]})); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("symbol.instance.selectPart", json!({"id": instance, "path": [1]})).unwrap(); + p.frame(); + assert_eq!(p.app().session.active().unwrap().selection.objects, [NodeId(instance)]); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+"), "the field drops the first part's draft"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_a_fill_row_becomes_active() { + let (mut app, a, _) = two_lines(); + run(&mut app, "appearance.addFill", json!({})); + let fill = app.session.active().unwrap().doc.node(a).unwrap().appearance.items.iter().position(|item| item.is_fill()).unwrap(); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + appearance::select_row(&mut p.app(), appearance::Sel::Item(fill)); + assert_eq!(p.app().session.appearance_item(), Some(fill)); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "the edit state change drops the unfinished value"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_the_live_paint_bucket_is_chosen() { + let (app, a, _) = two_lines(); + assert_eq!(stroke_of(&app, a).width, app.session.paint.stroke_width, "the line and the bucket's stroke have one weight"); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().session.select_tool("livePaintBucket", Default::default()).unwrap(); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + assert_eq!((stroke_of(&app, a).width, app.session.paint.stroke_width), (1.0, 5.0), "the bucket's stroke takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_other_characters_are_selected() { + use vectorcraft_doc::NodeKind; + use vectorcraft_engine::ViewInfo; + use vectorcraft_tools::{PointerEvent, PointerKind}; + let mut app = crate::testing::windowed(VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default())); + run(&mut app, "file.new", json!({"width": 400, "height": 300})); + let v = ViewInfo::default(); + app.session.select_tool("type", v).unwrap(); + for k in [PointerKind::Down, PointerKind::Up] { + app.session.pointer(&PointerEvent::new(k, 50.0, 200.0), v).unwrap(); + } + app.session.tool_text("Make this bold", v).unwrap(); + app.session.set_tool_option("select", &json!({"start": 0, "end": 4})); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().session.set_tool_option("select", &json!({"start": 5, "end": 9})); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + let id = app.session.active().unwrap().selection.objects[0]; + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + let widths: Vec<(&str, f64)> = t.runs.iter().map(|r| (r.text.as_str(), r.style.stroke_width)).collect(); + assert_eq!(widths, [("Make ", 0.0), ("this", 5.0), (" bold", 0.0)], "the second selection takes 5 pt, not 3+5"); +} + +#[test] +fn a_weight_scrub_that_creates_the_stroke_keeps_going() { + let (mut app, a, _) = two_lines(); + let stroke = app.session.active().unwrap().doc.node(a).unwrap().appearance.items.iter().position(|item| !item.is_fill()).unwrap(); + run(&mut app, "appearance.removeItem", json!({"index": stroke})); + assert!(app.session.active().unwrap().doc.node(a).unwrap().appearance.stroke().is_none()); + let original = app.session.active().unwrap().doc.clone(); + let undo = app.session.active().unwrap().history.undo.len(); + let mut p = Panel::new(app, stroke::show); + p.drag_hold_role("Weight", Role::LABEL, egui::vec2(12.0, 0.0)); + let first = stroke_of(&p.app(), a).width; + p.frame(); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(24.0, 0.0))]); + p.frame(); + let further = stroke_of(&p.app(), a).width; + assert!(further > first, "the held scrub keeps increasing the weight after creating the stroke: {first} to {further}"); + p.release(); + assert_eq!(stroke_of(&p.app(), a).width, further, "release keeps the weight from the whole drag"); + { + let app = p.app(); + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + assert_eq!(ap.items.iter().filter(|item| !item.is_fill()).count(), 1, "the scrub creates exactly one stroke row"); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo + 1, "the whole scrub is one undo step"); + } + p.app().run("edit.undo", json!({})).unwrap(); + assert_eq!(p.app().session.active().unwrap().doc, original, "one undo removes the scrub's stroke"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_a_stroke_is_added_on_top() { + let (app, a, _) = two_lines(); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + // The new stroke has the line's 1 pt and goes on top, where `stroke.set` edits with no active row. + p.app().run("appearance.addStroke", json!({})).unwrap(); + assert_eq!(p.app().session.appearance_item(), None, "no row is active"); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + let widths: Vec = app.session.active().unwrap().doc.node(a).unwrap().appearance.painted_strokes().map(|s| s.width).collect(); + assert_eq!(widths, [1.0, 5.0], "the new top stroke takes 5 pt, not 3+5"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_a_fill_is_added() { + let (app, a, _) = two_lines(); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + // A fill on top leaves the stroke `stroke.set` edits as it was. + p.app().run("appearance.addFill", json!({})).unwrap(); + p.frame(); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "the edit state change drops the unfinished value"); +} + +#[test] +fn an_unfinished_weight_is_dropped_when_the_whole_story_is_selected() { + use vectorcraft_doc::NodeKind; + let mut app = crate::testing::windowed(VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default())); + run(&mut app, "file.new", json!({"width": 900, "height": 300})); + let story = "The quick brown fox jumps over the lazy dog and keeps running far beyond the first frame. ".repeat(6); + let area = json!({"x": 10, "y": 10, "text": story, "size": 12, "area": {"width": 150, "height": 100}}); + let a = run(&mut app, "text.create", area)["id"].as_u64().unwrap(); + let b = run(&mut app, "text.thread.add", json!({"from": a, "rect": [200, 10, 150, 200]}))["id"].as_u64().unwrap(); + // Every character of frame `a`, then the whole story from it: the same frame and characters either way. + run(&mut app, "select.set", json!({"ids": [a]})); + app.session.select_tool("type", Default::default()).unwrap(); + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(NodeId(a)).unwrap().kind else { panic!("type") }; + let len = vectorcraft_text::edit::runs_len(&t.runs); + app.session.set_tool_option("textSelection", &json!({"editing": a, "anchor": 0, "caret": len})); + let frame = character::text_editing(&app); + assert!(character::text_story(&app).is_none(), "one frame's characters"); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("select.all", json!({})).unwrap(); + assert!(character::text_story(&p.app()).is_some(), "the whole story"); + assert_eq!(character::text_editing(&p.app()), frame, "the same frame and characters"); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + let widths = |id: u64| { + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(NodeId(id)).unwrap().kind else { panic!("type") }; + t.runs.iter().map(|r| r.style.stroke_width).collect::>() + }; + assert!(widths(a).iter().chain(&widths(b)).all(|w| *w == 5.0), "the story takes 5 pt, not 3+5: {:?} {:?}", widths(a), widths(b)); +} + +#[test] +fn an_unfinished_weight_in_an_appearance_row_does_not_reach_another_line() { + let (app, a, b) = two_lines(); + let mut p = Panel::new(app, appearance::show); + start_typing(&mut p, "Weight"); + p.app().run("select.set", json!({"ids": [b.0]})).unwrap(); + p.frame(); + finish_typing(&mut p); + let app = p.app(); + assert_eq!((stroke_of(&app, a).width, stroke_of(&app, b).width), (1.0, 5.0), "b takes 5 pt, not 3+5"); +} + +#[test] +fn changing_global_edit_members_drops_an_unfinished_appearance_weight() { + for change in ["start", "stop", "exclude"] { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + let b = NodeId(run(&mut app, "edit.duplicate", json!({"dx": 20}))["ids"][0].as_u64().unwrap()); + let c = NodeId(run(&mut app, "edit.duplicate", json!({"dy": 20}))["ids"][0].as_u64().unwrap()); + run(&mut app, "select.set", json!({"ids": [a.0]})); + if change != "start" { + run(&mut app, "select.globalEdit", json!({})); + assert_eq!(app.session.active().unwrap().global_edit.as_ref().unwrap().members.len(), 3); + } + let before = [a, b, c].map(|id| stroke_of(&app, id)); + let mut p = Panel::new(app, appearance::show); + start_typing(&mut p, "Weight"); + if change == "exclude" { + p.app().run("select.globalEditExclude", json!({"id": b.0})).unwrap(); + } else { + p.app().run("select.globalEdit", json!({})).unwrap(); + } + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+"), "{change}: the draft is dropped"); + finish_typing(&mut p); + for (id, before) in [a, b, c].into_iter().zip(before) { + let after = stroke_of(&p.app(), id); + assert_ne!(after.width, 8.0, "{change}: the unfinished value reaches no member"); + assert!(after.width == before.width || after.width == 5.0, "{change}: only the fresh weight can be applied"); + } + } +} + +#[test] +fn an_unfinished_weight_in_an_appearance_row_is_dropped_when_equal_width_strokes_swap() { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + run(&mut app, "stroke.set", json!({"miterLimit": 4})); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "stroke.set", json!({"miterLimit": 10})); + let strokes: Vec = { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + (0..ap.items.len()).filter(|i| ap.stroke_at(Some(*i)).is_some()).collect() + }; + let [bottom, top] = strokes[..] else { panic!("two stroke rows: {strokes:?}") }; + { + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + let (lower, upper) = (ap.stroke_at(Some(bottom)).unwrap(), ap.stroke_at(Some(top)).unwrap()); + assert_eq!(lower.width, upper.width); + assert_ne!(lower.miter_limit, upper.miter_limit); + let mut matched = upper.clone(); + matched.miter_limit = lower.miter_limit; + assert_eq!(lower, &matched, "only the miter limits differ"); + } + let mut p = Panel::new(app, appearance::show); + start_typing(&mut p, "Weight"); + p.frame(); + assert_eq!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + let focused = p.ctx().memory(|m| m.focused()).expect("the row weight has focus"); + p.app().run("appearance.moveItem", json!({"from": top, "to": bottom})).unwrap(); + p.frame(); + assert_eq!(p.ctx().memory(|m| m.focused()), Some(focused), "the same row field keeps focus across the swap"); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + let app = p.app(); + let ap = &app.session.active().unwrap().doc.node(a).unwrap().appearance; + let widths: Vec<_> = ap + .items + .iter() + .filter_map(|item| match item { + vectorcraft_doc::AppearanceItem::Stroke(stroke) => Some(stroke.width), + _ => None, + }) + .collect(); + assert!(widths.iter().all(|width| *width != 8.0), "neither stroke receives 3+5: {widths:?}"); + assert_eq!(widths.iter().filter(|width| **width == 5.0).count(), 1, "the focused row takes a fresh 5 pt: {widths:?}"); +} + +#[test] +fn an_unfinished_group_weight_is_dropped_when_a_member_gets_a_stroke() { + let (mut app, a, b) = two_lines(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "object.group", json!({})); + let group = app.session.active().unwrap().selection.objects[0]; + run(&mut app, "appearance.addStroke", json!({"ids": [group.0]})); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + p.app().run("appearance.addStroke", json!({"ids": [a.0]})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), group).width, 5.0, "the document change drops the unfinished value"); +} + +#[test] +fn a_weight_scrub_on_an_active_row_at_different_indices_keeps_going() { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + let b = NodeId(run(&mut app, "shape.rectangle", json!({"x": 120, "y": 10, "width": 50, "height": 100}))["id"].as_u64().unwrap()); + run(&mut app, "appearance.addFill", json!({"ids": [b.0]})); + run(&mut app, "appearance.moveItem", json!({"ids": [b.0], "from": 2, "to": 0})); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "appearance.setActiveItem", json!({"index": 1})); + for (id, index) in [(a, 1), (b, 2)] { + assert!(app.session.active().unwrap().doc.node(id).unwrap().appearance.stroke_at(Some(index)).is_some()); + } + let original = app.session.active().unwrap().doc.clone(); + let undo = app.session.active().unwrap().history.undo.len(); + let mut p = Panel::new(app, stroke::show); + p.drag_hold_role("Weight", Role::LABEL, egui::vec2(12.0, 0.0)); + let first = stroke_of(&p.app(), a).width; + assert!(first > 1.0, "the first preview changes the weight"); + assert_eq!(stroke_of(&p.app(), b).width, first, "both matched rows receive the preview"); + p.frame(); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(24.0, 0.0))]); + p.frame(); + let further = stroke_of(&p.app(), a).width; + assert!(further > first, "the held scrub continues after its first preview"); + assert_eq!(stroke_of(&p.app(), b).width, further); + p.release(); + assert_eq!(stroke_of(&p.app(), a).width, further); + assert_eq!(stroke_of(&p.app(), b).width, further); + assert_eq!(p.app().session.active().unwrap().history.undo.len(), undo + 1, "the whole scrub is one undo step"); + p.app().run("edit.undo", json!({})).unwrap(); + assert_eq!(p.app().session.active().unwrap().doc, original); +} + +#[test] +fn a_weight_scrub_matching_a_lower_stroke_keeps_going() { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + let b = NodeId(run(&mut app, "shape.rectangle", json!({"x": 120, "y": 10, "width": 50, "height": 100}))["id"].as_u64().unwrap()); + app.session + .edit("Strokes", |d, _| { + let top = d.node(a).unwrap().appearance.stroke().unwrap().clone(); + let ap = &mut d.node_mut(b).unwrap().appearance; + ap.stroke_mut().unwrap().width = 2.0; + ap.items.push(vectorcraft_doc::AppearanceItem::Stroke(top)); + Ok(()) + }) + .unwrap(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + run(&mut app, "appearance.setActiveItem", json!({"index": 1})); + let original = app.session.active().unwrap().doc.clone(); + let undo = app.session.active().unwrap().history.undo.len(); + let mut p = Panel::new(app, stroke::show); + // A vertical move starts the horizontal scrub without changing the weight. + p.drag_hold_role("Weight", Role::LABEL, egui::vec2(0.0, 12.0)); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(1.0, 0.0))]); + p.frame(); + assert_eq!(stroke_of(&p.app(), a).width, 2.0); + assert_eq!(stroke_of(&p.app(), b).width, 2.0, "the top stroke receives the matching preview"); + assert!(p.app().session.active().unwrap().interaction.is_some(), "the held scrub is still running at 2 pt"); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(3.0, 0.0))]); + p.frame(); + let further = stroke_of(&p.app(), a).width; + assert!(further > 2.0, "the scrub continues past the lower stroke's weight"); + assert_eq!(stroke_of(&p.app(), b).width, further, "both top strokes keep receiving previews"); + assert_eq!(p.app().session.active().unwrap().doc.node(b).unwrap().appearance.stroke_at(Some(1)).unwrap().width, 2.0); + p.release(); + assert_eq!(stroke_of(&p.app(), a).width, further); + assert_eq!(stroke_of(&p.app(), b).width, further); + assert_eq!(p.app().session.active().unwrap().history.undo.len(), undo + 1, "the scrub is one undo step"); + p.app().run("edit.undo", json!({})).unwrap(); + assert_eq!(p.app().session.active().unwrap().doc, original); +} + +#[test] +fn a_width_only_stroke_swap_drops_the_weight_draft() { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + let b = NodeId(run(&mut app, "shape.rectangle", json!({"x": 120, "y": 10, "width": 50, "height": 100}))["id"].as_u64().unwrap()); + app.session + .edit("Strokes", |d, _| { + let mut top = d.node(a).unwrap().appearance.stroke().unwrap().clone(); + top.width = 3.0; + let ap = &mut d.node_mut(b).unwrap().appearance; + ap.stroke_mut().unwrap().width = 2.0; + ap.items.push(vectorcraft_doc::AppearanceItem::Stroke(top)); + Ok(()) + }) + .unwrap(); + run(&mut app, "select.set", json!({"ids": [a.0, b.0]})); + let mut p = Panel::new(app, stroke::show); + assert_eq!(p.value_role("Weight", Role::SPIN_BUTTON).unwrap_or_default(), ""); + start_typing(&mut p, "Weight"); + p.app().run("appearance.moveItem", json!({"ids": [b.0], "from": 2, "to": 1})).unwrap(); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+"), "the swap drops the typed value"); + p.type_text("1"); + p.key(Key::Enter, Modifiers::NONE); + let app = p.app(); + for id in [a, b] { + let ap = &app.session.active().unwrap().doc.node(id).unwrap().appearance; + assert!(ap.painted_strokes().all(|s| s.width != 4.0), "no stroke receives the discarded 3+1 draft"); + } + assert_eq!((stroke_of(&app, a).width, stroke_of(&app, b).width), (1.0, 1.0), "the fresh value reaches both top strokes"); +} + +#[test] +fn an_empty_groups_new_art_stroke_change_drops_an_unfinished_weight() { + let (mut app, _, _) = two_lines(); + let group = app + .session + .edit("Empty group", |doc, _| { + let id = doc.alloc_id(); + doc.insert(doc.default_layer(), 0, vectorcraft_doc::Node::group(id, vec![]))?; + Ok(id) + }) + .unwrap(); + run(&mut app, "select.set", json!({"ids": [group.0]})); + let mut p = Panel::new(app, stroke::show); + start_typing(&mut p, "Weight"); + let before = p.app().session.new_art_stroke(); + p.app().run("stroke.set", json!({"cap": "round"})).unwrap(); + let after = p.app().session.new_art_stroke(); + assert_eq!(after.width, before.width); + assert_ne!(after.cap, before.cap); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + assert_eq!(p.app().session.new_art_stroke().width, 5.0, "new art receives only the fresh value"); +} + +#[test] +fn simplifying_the_new_art_stack_drops_an_unfinished_appearance_weight() { + let mut app = app_with_rect(); + run(&mut app, "appearance.setNewArtBasic", json!({"on": false})); + run(&mut app, "appearance.addStroke", json!({})); + run(&mut app, "select.none", json!({})); + let inherited = app.session.new_art(); + assert_eq!(inherited.items.len(), 3, "a fill below two strokes"); + let lower = inherited.stroke_at(Some(1)).unwrap(); + assert_eq!(lower.width, inherited.stroke_at(Some(2)).unwrap().width); + let mut p = Panel::new(app, appearance::show); + p.click_role_nth("Weight", Role::SPIN_BUTTON, 1); + p.key(Key::A, Modifiers::COMMAND); + p.type_text("3+"); + p.frame(); + assert!(p.shows_value("3+"), "the lower stroke holds the unfinished value"); + let revision = p.app().session.active().unwrap().revision; + p.app().run("appearance.setNewArtBasic", json!({"on": true})).unwrap(); + assert_eq!(p.app().session.active().unwrap().revision, revision, "only the preference changes"); + assert_eq!(p.app().session.new_art().items.len(), 2, "one stroke survives at the lower stroke's row index"); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + assert_eq!(p.app().session.new_art_stroke().width, 5.0, "new art receives 5 pt, not 3+5"); +} + +#[test] +fn unlocking_a_global_edit_member_drops_an_unfinished_weight() { + for show in [stroke::show, appearance::show] { + let mut app = app_with_rect(); + let a = app.session.active().unwrap().selection.objects[0]; + let b = NodeId(run(&mut app, "edit.duplicate", json!({"dx": 20}))["ids"][0].as_u64().unwrap()); + run(&mut app, "select.set", json!({"ids": [a.0]})); + run(&mut app, "select.globalEdit", json!({})); + run(&mut app, "object.lock", json!({"ids": [b.0]})); + assert!(app.session.active().unwrap().global_edit.as_ref().unwrap().members.iter().any(|(id, _)| *id == b)); + let mut p = Panel::new(app, show); + start_typing(&mut p, "Weight"); + p.app().run("object.unlockAll", json!({})).unwrap(); + assert!(!p.app().session.active().unwrap().doc.node(b).unwrap().locked); + p.app().run("select.set", json!({"ids": [a.0]})).unwrap(); + assert_eq!(p.app().session.active().unwrap().global_edit.as_ref().unwrap().members.len(), 2); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + assert_ne!(stroke_of(&p.app(), b).width, 8.0, "the unfinished expression does not reach the unlocked member"); + } +} + +#[test] +fn an_outside_appearance_change_ends_a_held_scrub() { + for name in ["Miter limit", "Dash 1", "Gap 1", "Dash offset", "Scale 1"] { + let (app, a, _) = two_lines(); + let mut p = Panel::new(app, show_with_field_scrubbing); + p.drag_hold_role(name, Role::SPIN_BUTTON, egui::vec2(12.0, 0.0)); + p.app().run("appearance.setItem", json!({"index": 0, "opacity": 0.5})).unwrap(); + let before = stroke_of(&p.app(), a); + p.frame(); + let at = p.ctx().input(|i| i.pointer.latest_pos()).unwrap(); + p.frame_with(vec![egui::Event::PointerMoved(at + egui::vec2(48.0, 0.0))]); + p.frame(); + p.release(); + assert_eq!(stroke_of(&p.app(), a), before, "{name}: later pointer moves leave the changed stroke alone"); + } +} + +#[test] +fn rebasing_a_tool_preview_drops_an_unfinished_weight() { + use vectorcraft_engine::ViewInfo; + use vectorcraft_tools::{PointerEvent, PointerKind}; + for show in [stroke::show, appearance::show] { + let (mut app, a, b) = two_lines(); + let view = ViewInfo { smart_guides: false, ..Default::default() }; + app.session.select_tool("selection", view).unwrap(); + for (kind, x) in [(PointerKind::Down, 50.0), (PointerKind::Drag, 60.0)] { + app.session.pointer(&PointerEvent::new(kind, x, 50.0), view).unwrap(); + } + assert!(app.session.active().unwrap().interaction.as_ref().unwrap().by_tool()); + let mut p = Panel::new(app, show); + start_typing(&mut p, "Weight"); + let revision = p.app().session.active().unwrap().interaction.as_ref().unwrap().revision; + p.app().run("appearance.setItem", json!({"ids": [b.0], "index": 1, "opacity": 0.5})).unwrap(); + assert!(p.app().session.active().unwrap().interaction.as_ref().unwrap().revision > revision); + p.frame(); + assert_ne!(p.value_role("Weight", Role::SPIN_BUTTON).as_deref(), Some("3+")); + finish_typing(&mut p); + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "the rebased document receives only the fresh value"); + assert_ne!(stroke_of(&p.app(), b).width, 8.0, "the unfinished expression reaches no other stroke"); + } +} diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 95c0b2f649..fc3210dc19 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 = "37d0532f42eb3421769c8a454e3e25a20fbcff97"; +const REV: &str = "b14d8ac4faba5da4c3c7e733e7c763d5add21d70"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From 6d1850e630687a3a42d05d539cafb98d983a5edc Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 4 Dec 2026 23:27:33 -0800 Subject: [PATCH 02/41] Tests: leaving Edit Text during a drag advances the baseline revision Type in perspective enters Object > Perspective > Edit Text, an interaction begins, and the edit ends: the interaction's baseline text is projected again and its revision advances to the document's, so a field shown during the drag drops a value typed before the change. --- .../engine/src/tests/interaction_commands.rs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/crates/engine/src/tests/interaction_commands.rs b/crates/engine/src/tests/interaction_commands.rs index 20ab3876ee..4eefe43bc3 100644 --- a/crates/engine/src/tests/interaction_commands.rs +++ b/crates/engine/src/tests/interaction_commands.rs @@ -878,3 +878,26 @@ fn a_grid_change_during_an_interaction_advances_its_baseline_revision() { assert!(it.revision > revision, "a direct baseline change advances its revision"); assert_eq!(crate::cmd::distortcmds::grid_of(&it.doc).visible, crate::cmd::distortcmds::grid_of(&st.doc).visible); } + +#[test] +fn leaving_perspective_type_editing_during_an_interaction_advances_its_baseline_revision() { + let (mut s, _) = crate::tests_persp_select::persp_session(); + let r = s.execute("text.create", &json!({"x": 430, "y": 400, "text": "HELLO", "size": 48})).unwrap(); + let id = NodeId(r["id"].as_u64().unwrap()); + s.execute("perspective.attach", &json!({"ids": [id.0], "plane": "right"})).unwrap(); + s.execute("perspective.editText", &json!({"id": id.0})).unwrap(); + s.begin_interaction("Edit").unwrap(); + let it = s.doc().unwrap().interaction.as_ref().unwrap(); + let revision = it.revision; + let text = it.doc.node(id).unwrap(); + assert!(text.extras().perspective.as_deref().unwrap().editing, "the baseline starts in Edit Text mode"); + assert!(text.projection().is_none(), "the baseline text is flat while editing"); + crate::cmd::distortcmds::finish_edit_text(s.doc_mut().unwrap(), id); + let st = s.doc().unwrap(); + let it = st.interaction.as_ref().unwrap(); + let text = it.doc.node(id).unwrap(); + assert!(!text.extras().perspective.as_deref().unwrap().editing, "the baseline leaves Edit Text mode"); + assert!(text.projection().is_some(), "the baseline text is projected again"); + assert!(it.revision > revision, "leaving Edit Text advances the baseline revision"); + assert_eq!(it.revision, st.revision, "the baseline revision is the document's new revision"); +} From f1ca37ae68cd0016b91e731fa049d6e776635605 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 00:39:50 -0800 Subject: [PATCH 03/41] Dependencies: move the craft-libs pin to the edit-target branch on 4c330f6bd1 The branch's two commits on the craft-libs commit main pins: the stroke editor and linked fields take an edit target, and the linked fields' Equal link history starts again when the target changes. The skrifa patch stays at 37d0532f42. --- Cargo.lock | 182 ++++++++++++++++---------------- Cargo.toml | 82 +++++++------- apps/vectorcraft-web/Cargo.toml | 2 +- xtask/src/pdf_deps.rs | 2 +- 4 files changed, 134 insertions(+), 134 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 48b15a71b0..2e9cf8544c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1256,7 +1256,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-automation", "craft-behavior", @@ -1298,7 +1298,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "crc32fast", "flate2", @@ -1319,7 +1319,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1331,7 +1331,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "rustix 1.1.6", ] @@ -1339,7 +1339,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1383,7 +1383,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-docpath", @@ -1401,7 +1401,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "crc32fast", "flate2", @@ -1410,7 +1410,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "egui", ] @@ -1418,7 +1418,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "md-5", "rayon", @@ -1427,12 +1427,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-cms", @@ -1452,7 +1452,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-ai-agents", "craft-atomic", @@ -1468,7 +1468,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1478,7 +1478,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "rayon", ] @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1512,7 +1512,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "blake3", "craft-ecproj-format", @@ -1528,7 +1528,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "serde", ] @@ -1536,7 +1536,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-dwg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "acadrust", "craft-dxf", @@ -1565,7 +1565,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-codepage", "encoding_rs", @@ -1577,7 +1577,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "serde", "serde_json", @@ -1587,12 +1587,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" [[package]] name = "craft-flags" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-atomic", "dirs", @@ -1602,7 +1602,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1617,7 +1617,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1636,7 +1636,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1645,7 +1645,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "cap-primitives", "craft-atomic", @@ -1668,12 +1668,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "gif", ] @@ -1681,7 +1681,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "flate2", ] @@ -1689,7 +1689,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1702,7 +1702,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1732,7 +1732,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-dds", "craft-jpeg", @@ -1759,7 +1759,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1777,7 +1777,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "thiserror 2.0.21", ] @@ -1785,7 +1785,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1796,7 +1796,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-host", "craft-i18n", @@ -1811,7 +1811,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-i18n", @@ -1825,7 +1825,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-host", @@ -1843,7 +1843,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1855,7 +1855,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "encoding_rs", "image", @@ -1866,7 +1866,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "chrono", "craft-codepage", @@ -1876,7 +1876,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "uds_windows", "winsafe", @@ -1885,7 +1885,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-keymap", @@ -1901,7 +1901,7 @@ dependencies = [ [[package]] name = "craft-pbr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-texture", "thiserror 2.0.21", @@ -1910,7 +1910,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "flate2", "serde", @@ -1921,7 +1921,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1933,7 +1933,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "async-channel", "async-io", @@ -1966,7 +1966,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1975,7 +1975,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-host", @@ -1999,7 +1999,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -2010,7 +2010,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-eps", "flate2", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "encoding_rs", "flate2", @@ -2035,7 +2035,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "dispatch2", "egui", @@ -2048,7 +2048,7 @@ dependencies = [ [[package]] name = "craft-raster3d" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "rayon", "thiserror 2.0.21", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -2076,7 +2076,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-atomic", "craft-host", @@ -2093,7 +2093,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "fax", "hayro-ccitt", @@ -2104,7 +2104,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2125,7 +2125,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-keymap", @@ -2137,7 +2137,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2162,7 +2162,7 @@ dependencies = [ [[package]] name = "craft-texture" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "thiserror 2.0.21", ] @@ -2170,7 +2170,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2185,7 +2185,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-atomic", "craft-behavior", @@ -2200,7 +2200,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "serde", "thiserror 2.0.21", @@ -2210,7 +2210,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "serde", "thiserror 2.0.21", @@ -2219,7 +2219,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-keymap", @@ -2234,12 +2234,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2253,7 +2253,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "accesskit", "craft-behavior", @@ -2308,7 +2308,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2319,7 +2319,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-host", @@ -2337,7 +2337,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-host", @@ -2358,7 +2358,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-host", @@ -2379,7 +2379,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-behavior", "craft-host", @@ -2398,7 +2398,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "base64 0.22.1", "chrono", @@ -2430,7 +2430,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "flate2", "serde", @@ -2441,7 +2441,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2451,7 +2451,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "js-sys", "serde_json", @@ -2462,7 +2462,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "winsafe", ] @@ -2470,7 +2470,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "craft-appkit", "craft-atomic", @@ -2502,7 +2502,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3862,7 +3862,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3871,7 +3871,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3889,7 +3889,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3907,12 +3907,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "flate2", "hayro-ccitt", @@ -4895,7 +4895,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "base64 0.22.1", "bumpalo", @@ -5052,7 +5052,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=dfe897b82f964d4e69df6d8528fbe0bd11de44c6#dfe897b82f964d4e69df6d8528fbe0bd11de44c6" +source = "git+https://github.com/storytold/craft-libs?rev=2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727#2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index e092abae33..02aa062b65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,57 +10,57 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # 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 = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # DWG to DXF bytes, in a child process on desktop builds (acadrust 0.6.6, MPL-2.0, unmodified). -craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # 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 = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # The CPU rasterizer that draws a 3D effect's Render Settings › Rendered image: depth-buffered triangles, shadow maps. -craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # 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 = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # 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 = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -200,13 +200,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727" } # skrifa 0.44 (epaint, glifo, usvg) with the automatic hinter's long blue-zone exit (craft-libs vendor/skrifa). # It stays at this rev until craft-libs#5222 merges. skrifa = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 4162ab4a03..26168a76c8 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 = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index b1cbae54ee..e7d414901e 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 = "dfe897b82f964d4e69df6d8528fbe0bd11de44c6"; +const REV: &str = "2a32dc69eb4c2eac0d68efa1f3d4ae1ce2d77727"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV), From 52ae4d5dd52f6301b86ee43b8aba839e5bc851eb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 00:51:41 -0800 Subject: [PATCH 04/41] DXF/DWG import: scaled block inserts scale their dashes and polyline widths A named block becomes a symbol whose art is drawn once, at the import's scale, and each insert becomes an instance that carries the insert's scale. Instances leave the strokes in their art unscaled, so a block inserted at scale 10 drew its geometry 10 times larger but kept its linetype dashes and constant-width polylines at scale 1. When a block (or a block it places) draws dashes or wide polylines, its symbol is now made per insert scale, with the art drawn at that scale and the instance taking the rest of the transform. Inserts at one scale share a symbol, and blocks without dashes or wide polylines keep one symbol for every scale. Lineweights are physical widths and stay unscaled. --- crates/cad/src/import/build.rs | 112 ++++++++++++++++++++++++------ crates/cad/src/import/tests.rs | 122 +++++++++++++++++++++++++++++++++ 2 files changed, 213 insertions(+), 21 deletions(-) diff --git a/crates/cad/src/import/build.rs b/crates/cad/src/import/build.rs index 0b3532ca87..870283af2c 100644 --- a/crates/cad/src/import/build.rs +++ b/crates/cad/src/import/build.rs @@ -67,8 +67,12 @@ pub(crate) struct Build<'d, 'a> { blocks: HashMap>>, bounds: HashMap>, sensitive: HashMap, - /// Symbol names by block and what it inherits (`None`: the block has no art). - symbols: HashMap<(String, Inherit), Option>, + /// Symbol names by block, what it inherits and the scale its art is drawn at (the bits of + /// [`symbol_scale`]'s answer; `None`: the block has no art). + symbols: HashMap<(String, Inherit, u64), Option>, + /// Whether a block placed with what it inherits draws dashes or wide polylines, whose + /// lengths and widths follow the insert's scale. + scaled_looks: HashMap<(String, Inherit), bool>, /// Names of the symbols made so far, and the next suffix to try for each label. symbol_names: HashSet, next_suffix: HashMap, @@ -134,6 +138,7 @@ impl<'d, 'a> Build<'d, 'a> { bounds: HashMap::new(), sensitive: HashMap::new(), symbols: HashMap::new(), + scaled_looks: HashMap::new(), symbol_names: HashSet::new(), next_suffix: HashMap::new(), stack: vec![], @@ -597,24 +602,39 @@ impl<'d, 'a> Build<'d, 'a> { let base = self.d.blocks.get(&ins.block).map_or(Point::ZERO, |b| b.base); let unbase = Affine::translate(-base.to_vec2()); let anonymous = ins.block.starts_with('*'); - let symbol = if anonymous { None } else { self.symbol(&ins.block, &child, depth) }; let mut parts = vec![]; + // An array's cells share their scale: the symbol is looked up again only when it changes. + let mut last: Option<(f64, Option<(String, f64)>)> = None; for cell in &ins.cells { - let node = match &symbol { - Some(name) => { - if self.nodes >= MAX_NODES { - self.warn(TOO_MANY); - break; + let node = if anonymous { + self.art(&ins.block, map * *cell * unbase, &child, depth) + } else { + let scale = symbol_scale(map * *cell, self.symbol_map); + let symbol = match &last { + Some((s, symbol)) if s.to_bits() == scale.to_bits() => symbol.clone(), + _ => { + let symbol = self.symbol(&ins.block, &child, scale, depth); + last = Some((scale, symbol.clone())); + symbol } - if !self.charge_text(name.len()) { - break; + }; + match symbol { + Some((name, drawn_at)) => { + if self.nodes >= MAX_NODES { + self.warn(TOO_MANY); + break; + } + if !self.charge_text(name.len()) { + break; + } + // The symbol's art is drawn `drawn_at` times larger than a drawing unit + // at the import's scale; the instance takes the rest of the transform. + let xf = map * *cell * (self.symbol_map * Affine::scale(drawn_at)).inverse(); + self.nodes += 1; + Some(Node::new(self.doc.alloc_id(), NodeKind::SymbolInstance { symbol: name, xf })) } - let xf = map * *cell * self.symbol_map.inverse(); - self.nodes += 1; - Some(Node::new(self.doc.alloc_id(), NodeKind::SymbolInstance { symbol: name.clone(), xf })) + None => None, } - None if anonymous => self.art(&ins.block, map * *cell * unbase, &child, depth), - None => None, }; parts.extend(node); } @@ -664,15 +684,52 @@ impl<'d, 'a> Build<'d, 'a> { } } - /// The symbol for block `name` placed with `inh` (made once per look). - fn symbol(&mut self, name: &str, inh: &Inherit, depth: u32) -> Option { + /// Does block `name` placed with `inh` draw dashes or wide polylines (its own art or that of + /// the blocks it places)? + fn is_scaled_look(&mut self, name: &str, inh: &Inherit, depth: u32) -> bool { + let key = (name.to_string(), inh.clone()); + if let Some(s) = self.scaled_looks.get(&key) { + return *s; + } + let Some(items) = self.block(name) else { return false }; + if !self.enter(name, depth) { + return false; + } + let mut s = false; + for it in items.iter() { + s = match &it.geom { + Geom::Path { fill: true, .. } => false, + Geom::Path { width, .. } => { + *width > 0.0 || self.d.linetypes.get(&self.linetype(&it.props, inh)).is_some_and(|p| p.iter().take(64).any(|v| *v < 0.0)) + } + Geom::Text(_) => false, + Geom::Insert(ins) => { + let child = self.inherit(&it.props, inh); + let child = if self.is_sensitive(&ins.block, depth + 1) { child } else { Inherit::default() }; + self.is_scaled_look(&ins.block, &child, depth + 1) + } + }; + if s { + break; + } + } + self.stack.pop(); + self.scaled_looks.insert(key, s); + s + } + + /// The symbol for block `name` placed with `inh` at `scale` (from [`symbol_scale`]), made + /// once per look, with the scale its art is drawn at: `scale` when the block draws dashes or + /// wide polylines, else 1. + fn symbol(&mut self, name: &str, inh: &Inherit, scale: f64, depth: u32) -> Option<(String, f64)> { let inh = if self.is_sensitive(name, depth) { inh.clone() } else { Inherit::default() }; - let key = (name.to_string(), inh); + let scale = if self.is_scaled_look(name, &inh, depth) { scale } else { 1.0 }; + let key = (name.to_string(), inh, scale.to_bits()); if let Some(s) = self.symbols.get(&key) { - return s.clone(); + return s.clone().map(|s| (s, scale)); } let base = self.d.blocks.get(name).map_or(Point::ZERO, |b| b.base); - let map = self.symbol_map * Affine::translate(-base.to_vec2()); + let map = self.symbol_map * Affine::scale(scale) * Affine::translate(-base.to_vec2()); let art = self.art(name, map, &key.1, depth); let made = art.and_then(|art| { let label = self.d.blocks.get(name).map_or(name, |b| b.name.as_str()); @@ -686,10 +743,23 @@ impl<'d, 'a> Build<'d, 'a> { Some(symbol) }); self.symbols.insert(key, made.clone()); - made + made.map(|s| (s, scale)) } } +/// How much larger than `symbol_map` an insert copy drawn by `placed` is (the square root of the +/// ratio of their areas), rounded to 9 significant digits so that copies at one scale share a +/// symbol; 1 when either is degenerate. +fn symbol_scale(placed: Affine, symbol_map: Affine) -> f64 { + let s = (placed.determinant().abs() / symbol_map.determinant().abs()).sqrt(); + if !(s.is_finite() && s > 0.0) { + return 1.0; + } + let digits = 10f64.powi(8 - s.log10().floor() as i32); + let r = (s * digits).round() / digits; + if r.is_finite() && r > 0.0 { r } else { 1.0 } +} + /// Fit text stretched or squeezed across, aligned text scaled as a whole, to run its span /// (`s`: points per drawing unit), measured in the font it is set in. fn fill_span(obj: &mut TextObject, span: Span, s: f64) { diff --git a/crates/cad/src/import/tests.rs b/crates/cad/src/import/tests.rs index d53694343a..89f6e81ce8 100644 --- a/crates/cad/src/import/tests.rs +++ b/crates/cad/src/import/tests.rs @@ -858,6 +858,128 @@ fn by_block_colours_make_a_symbol_per_look() { assert_eq!(doc.symbols.len(), 1); } +/// The dash pattern and weight of the stroke of `n` (a path) or its first loop (a compound path). +fn dash_and_weight(n: &Node) -> (Vec, f64) { + let n = match &n.kind { + NodeKind::Path { .. } => n, + _ => n.children().and_then(|c| c.first()).map(|c| &**c).unwrap_or_else(|| panic!("no path: {:?}", n.kind)), + }; + let s = n.appearance.stroke().unwrap_or_else(|| panic!("no stroke: {:?}", n.appearance)); + (s.dash.as_ref().map(|d| d.pattern.clone()).unwrap_or_default(), s.width) +} + +/// The strokes of `inst`'s symbol's art (and of the symbols it places): each path's dash +/// pattern and weight, in paint order. +fn instance_strokes(doc: &Document, inst: &Node) -> Vec<(Vec, f64)> { + let NodeKind::SymbolInstance { symbol, .. } = &inst.kind else { panic!("{:?}", inst.kind) }; + let art = &doc.symbols.iter().find(|s| &s.name == symbol).unwrap().art; + let mut out = vec![]; + let mut walk = vec![art.clone()]; + while let Some(n) = walk.pop() { + match &n.kind { + NodeKind::Path { .. } => out.push(dash_and_weight(&n)), + NodeKind::SymbolInstance { .. } => out.extend(instance_strokes(doc, &n)), + _ => walk.extend(n.children().into_iter().flatten().rev().cloned()), + } + } + out +} + +#[test] +fn scaled_inserts_scale_their_blocks_dashes_and_polyline_widths() { + let tables = [(0, "TABLE"), (2, "LTYPE"), (0, "LTYPE"), (2, "DASHED"), (73, "2"), (40, "15"), (49, "10"), (49, "-5"), (0, "ENDTAB")]; + // "Mark": a dashed line with a 0.5 mm lineweight and a polyline 2 units wide. "Pair" places + // "Mark" at scale 1, so the scale of an insert of "Pair" reaches it. + let blocks = [ + (0, "BLOCK"), + (8, "0"), + (2, "Mark"), + (70, "0"), + (10, "0"), + (20, "0"), + (0, "LINE"), + (8, "0"), + (6, "DASHED"), + (370, "50"), + (10, "0"), + (20, "0"), + (11, "100"), + (21, "0"), + (0, "LWPOLYLINE"), + (8, "0"), + (90, "2"), + (70, "0"), + (43, "2"), + (10, "0"), + (20, "10"), + (10, "100"), + (20, "10"), + (0, "ENDBLK"), + (0, "BLOCK"), + (8, "0"), + (2, "Pair"), + (70, "0"), + (10, "0"), + (20, "0"), + (0, "INSERT"), + (8, "0"), + (2, "Mark"), + (10, "0"), + (20, "0"), + (0, "ENDBLK"), + ]; + let inserts = [ + (0, "INSERT"), + (2, "Mark"), + (10, "0"), + (20, "0"), + (0, "INSERT"), + (2, "Mark"), + (10, "0"), + (20, "100"), + (41, "10"), + (42, "10"), + (0, "INSERT"), + (2, "Pair"), + (10, "0"), + (20, "300"), + (41, "10"), + (42, "10"), + (0, "INSERT"), + (2, "Mark"), + (10, "0"), + (20, "500"), + (41, "10"), + (42, "10"), + ]; + let doc = open(&drawing(&[], &tables, &blocks, &inserts), &points()).document; + let insts = leaves(&doc); + let [one, ten, nested, ten_again] = &insts[..] else { panic!("{insts:?}") }; + let at_one = instance_strokes(&doc, one); + let [(dash, lw), (no_dash, width)] = &at_one[..] else { panic!("{at_one:?}") }; + assert!(dash.len() >= 2 && no_dash.is_empty() && *width > 0.0, "{at_one:?}"); + // Instances leave the strokes in their art as they are, so the art carries the insert's scale. + let tenfold: Vec = dash.iter().map(|v| v * 10.0).collect(); + for inst in [ten, nested] { + let got = instance_strokes(&doc, inst); + let [(d, w_lw), (_, w)] = &got[..] else { panic!("{got:?}") }; + assert_eq!(d.len(), tenfold.len()); + assert!(d.iter().zip(&tenfold).all(|(a, b)| (a - b).abs() < 1e-9), "dashes {d:?}, want {tenfold:?}"); + assert!((w - width * 10.0).abs() < 1e-9, "polyline width {w}, want {}", width * 10.0); + assert!((w_lw - lw).abs() < 1e-12, "a lineweight is a physical width: {w_lw}, want {lw}"); + } + // The copies still land where their inserts put them. + let NodeKind::SymbolInstance { symbol, xf } = &ten.kind else { panic!() }; + let art = &doc.symbols.iter().find(|s| &s.name == symbol).unwrap().art; + let line = art.children().and_then(|c| c.first()).unwrap(); + let end = *xf * *path_points(line).last().unwrap(); + assert!(end.distance(Point::new(1000.0, height(&doc) - 100.0)) < 1e-6, "{end:?}"); + // Inserts at one scale share a symbol. + let symbol_of = |n: &Node| if let NodeKind::SymbolInstance { symbol, .. } = &n.kind { symbol.clone() } else { panic!() }; + assert_eq!(symbol_of(ten), symbol_of(ten_again)); + assert_ne!(symbol_of(one), symbol_of(ten)); +} + #[test] fn many_by_block_looks_import_in_linear_time() { let by_block: &[(i32, &str)] = &[(0, "LINE"), (8, "0"), (62, "0"), (10, "5"), (20, "5"), (11, "15"), (21, "5")]; From de5582cc836c452188edd85de5bf0f277177788e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 01:49:20 -0800 Subject: [PATCH 05/41] DXF/DWG import: the scale check of blocks skips hidden art and keeps to the work budget The check that decides whether a block's symbol is drawn per insert scale now skips art on hidden layers, which the import does not draw, so a block whose only dashes are hidden keeps one symbol for every scale. The check also counts the items it looks at against the block work budget and stops with the existing warning when the budget runs out. Text in a block drawn at a tiny insert scale is kept: any invertible text transform is accepted, instead of only those above 1e-12 points per unit. --- crates/cad/src/import/build.rs | 26 ++++++- crates/cad/src/import/tests.rs | 126 +++++++++++++++++++++++++++++++++ 2 files changed, 149 insertions(+), 3 deletions(-) diff --git a/crates/cad/src/import/build.rs b/crates/cad/src/import/build.rs index 870283af2c..02da2f46fc 100644 --- a/crates/cad/src/import/build.rs +++ b/crates/cad/src/import/build.rs @@ -24,7 +24,8 @@ const THINNEST: f64 = 0.25; /// The most objects an import makes. const MAX_NODES: usize = 2_000_000; /// The most block work an import does, whatever it produces: one per insert copy drawn, and one -/// per item of the block looked at for it (art on hidden layers too). +/// per item of the block looked at for it (art on hidden layers too), and the same for each block +/// whose dashes and widths are checked for a symbol's scale. const MAX_VISITS: usize = if cfg!(test) { 1_000_000 } else { 20_000_000 }; /// The most path elements an import makes (blocks drawn as art are copied for every placement). pub(crate) const MAX_ELEMENTS: usize = if cfg!(test) { 1_000_000 } else { 4_000_000 }; @@ -568,7 +569,9 @@ impl<'d, 'a> Build<'d, 'a> { // Text space is y-down points; the item's is y-up drawing units. let m = map * t.xf * Affine::FLIP_Y; let s = m.determinant().abs().sqrt(); - if !(s > 1e-12 && s.is_finite()) { + // Any invertible map will do: a symbol drawn at a tiny insert scale draws its text far + // below a point per unit, and its instances scale it back up. + if !(s > 0.0 && s.is_finite() && s.recip().is_finite()) { return None; } let d = self.d; @@ -691,12 +694,27 @@ impl<'d, 'a> Build<'d, 'a> { if let Some(s) = self.scaled_looks.get(&key) { return *s; } - let Some(items) = self.block(name) else { return false }; + let items = self.block(name); + // Looking at a block's items counts against the block work as placing it does, so the + // scan stops at the same limit as `art`. + self.visits = self.visits.saturating_add(1 + items.as_ref().map_or(0, |i| i.len())); + if self.visits > MAX_VISITS { + self.warn(TOO_MUCH_BLOCK_WORK); + return false; + } + let Some(items) = items else { return false }; if !self.enter(name, depth) { return false; } let mut s = false; for it in items.iter() { + #[cfg(test)] + SCALED_LOOK_ITEMS.with(|n| n.set(n.get().saturating_add(1))); + // Art on a hidden layer is not drawn (see `art`), so it does not make the block's + // look depend on its scale. + if self.d.layer(self.layer_name(&it.props, inh)).is_some_and(|l| l.hidden) && it.props.layer != "0" { + continue; + } s = match &it.geom { Geom::Path { fill: true, .. } => false, Geom::Path { width, .. } => { @@ -782,6 +800,8 @@ fn rgb_color([r, g, b]: [u8; 3]) -> Color { thread_local! { /// How many names [`unique`] tried on this thread (tests). pub(crate) static SYMBOL_NAMES_TRIED: std::cell::Cell = const { std::cell::Cell::new(0) }; + /// How many block items [`Build::is_scaled_look`] looked at on this thread (tests). + pub(crate) static SCALED_LOOK_ITEMS: std::cell::Cell = const { std::cell::Cell::new(0) }; } /// Whether `taken` holds `name`, counted as one name tried (tests). diff --git a/crates/cad/src/import/tests.rs b/crates/cad/src/import/tests.rs index 89f6e81ce8..ae3a86d180 100644 --- a/crates/cad/src/import/tests.rs +++ b/crates/cad/src/import/tests.rs @@ -980,6 +980,132 @@ fn scaled_inserts_scale_their_blocks_dashes_and_polyline_widths() { assert_ne!(symbol_of(one), symbol_of(ten)); } +#[test] +fn dashes_on_a_hidden_layer_leave_a_block_one_symbol_for_every_scale() { + let tables = [ + (0, "TABLE"), + (2, "LTYPE"), + (0, "LTYPE"), + (2, "DASHED"), + (73, "2"), + (40, "15"), + (49, "10"), + (49, "-5"), + (0, "ENDTAB"), + (0, "TABLE"), + (2, "LAYER"), + (0, "LAYER"), + (2, "Off"), + (70, "0"), + (62, "-1"), + (0, "ENDTAB"), + ]; + // "Mark": a solid line, and a dashed line on a hidden layer, which is not drawn. + let blocks = [ + (0, "BLOCK"), + (8, "0"), + (2, "Mark"), + (70, "0"), + (10, "0"), + (20, "0"), + (0, "LINE"), + (8, "0"), + (10, "0"), + (20, "0"), + (11, "100"), + (21, "0"), + (0, "LINE"), + (8, "Off"), + (6, "DASHED"), + (10, "0"), + (20, "10"), + (11, "100"), + (21, "10"), + (0, "ENDBLK"), + ]; + let inserts = [(0, "INSERT"), (2, "Mark"), (10, "0"), (20, "0"), (0, "INSERT"), (2, "Mark"), (10, "0"), (20, "100"), (41, "10"), (42, "10")]; + let doc = open(&drawing(&[], &tables, &blocks, &inserts), &points()).document; + assert_eq!(leaves(&doc).len(), 2); + assert_eq!(doc.symbols.len(), 1, "{:?}", doc.symbols.iter().map(|s| &s.name).collect::>()); +} + +#[test] +fn the_scale_check_of_blocks_stops_at_the_work_budget() { + // "Outer" places "Leaf" 1,100 times, each in its own color, and "Leaf" has 1,000 solid + // lines that take their insert's color: 1,100,000 items to look at, past the 1,000,000 + // tests import with. + let mut blocks: Vec<(i32, &'static str)> = vec![(0, "BLOCK"), (8, "0"), (2, "Leaf"), (70, "0"), (10, "0"), (20, "0")]; + for _ in 0..1000 { + blocks.extend([(0, "LINE"), (8, "0"), (62, "0"), (10, "0"), (20, "0"), (11, "1"), (21, "0")]); + } + blocks.extend([(0, "ENDBLK"), (0, "BLOCK"), (8, "0"), (2, "Outer"), (70, "0"), (10, "0"), (20, "0")]); + for i in 0..1100 { + let color: &'static str = Box::leak((i + 1).to_string().into_boxed_str()); + blocks.extend([(0, "INSERT"), (8, "0"), (2, "Leaf"), (420, color), (10, "0"), (20, "0")]); + } + blocks.push((0, "ENDBLK")); + let top = [(0, "INSERT"), (2, "Outer"), (10, "0"), (20, "0")]; + build::SCALED_LOOK_ITEMS.with(|n| n.set(0)); + let r = open(&drawing(&[], &[], &blocks, &top), &points()); + let looked = build::SCALED_LOOK_ITEMS.with(std::cell::Cell::get); + assert!(looked <= 1_000_000, "{looked} items looked at"); + assert!(r.warnings.iter().any(|w| w.contains("too much work")), "{:?}", r.warnings); +} + +#[test] +fn text_in_a_dashed_block_inserted_at_a_tiny_scale_is_kept() { + let tables = [(0, "TABLE"), (2, "LTYPE"), (0, "LTYPE"), (2, "DASHED"), (73, "2"), (40, "15"), (49, "10"), (49, "-5"), (0, "ENDTAB")]; + // "Inner" draws a dashed line and a label; "Outer" places it at 1e-7, and the drawing places + // "Outer" at 1e-7, so "Inner"'s symbol is drawn at 1e-14. + let blocks = [ + (0, "BLOCK"), + (8, "0"), + (2, "Inner"), + (70, "0"), + (10, "0"), + (20, "0"), + (0, "LINE"), + (8, "0"), + (6, "DASHED"), + (10, "0"), + (20, "0"), + (11, "100"), + (21, "0"), + (0, "TEXT"), + (8, "0"), + (10, "0"), + (20, "10"), + (40, "5"), + (1, "Label"), + (0, "ENDBLK"), + (0, "BLOCK"), + (8, "0"), + (2, "Outer"), + (70, "0"), + (10, "0"), + (20, "0"), + (0, "INSERT"), + (8, "0"), + (2, "Inner"), + (10, "0"), + (20, "0"), + (41, "1e-7"), + (42, "1e-7"), + (0, "ENDBLK"), + ]; + let top = [(0, "INSERT"), (2, "Outer"), (10, "0"), (20, "0"), (41, "1e-7"), (42, "1e-7")]; + let doc = open(&drawing(&[], &tables, &blocks, &top), &points()).document; + let mut texts = vec![]; + for s in &doc.symbols { + s.art.walk(&mut |n| { + if let NodeKind::Text(t) = &n.kind { + texts.push(t.plain_text()); + } + }); + } + assert_eq!(texts, ["Label"]); +} + #[test] fn many_by_block_looks_import_in_linear_time() { let by_block: &[(i32, &str)] = &[(0, "LINE"), (8, "0"), (62, "0"), (10, "5"), (20, "5"), (11, "15"), (21, "5")]; From 1da36ce346e60c6cf1a6ad90f2a271690992ed5b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 02:45:59 -0800 Subject: [PATCH 06/41] DXF/DWG import: block copies drawn at a tiny scale keep a finite transform An instance's transform inverted the symbol map and the scale its art is drawn at as one product. In a fitted drawing with a tiny points-per-unit scale, a dashed block placed at a tiny nested scale made that product's determinant subnormal, its inverse overflowed, and the instance carried NaN coefficients. The two factors are now inverted apart, and a copy whose transform still is not finite is left out with a warning. --- crates/cad/src/import/build.rs | 13 ++++++-- crates/cad/src/import/tests.rs | 56 ++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/crates/cad/src/import/build.rs b/crates/cad/src/import/build.rs index 02da2f46fc..2115104bcf 100644 --- a/crates/cad/src/import/build.rs +++ b/crates/cad/src/import/build.rs @@ -46,6 +46,7 @@ const TOO_MANY: &str = "the drawing has more than 2,000,000 objects: the rest ar const TOO_MANY_POINTS: &str = "the drawing has more than 4,000,000 path points: the rest are left out"; const TOO_MUCH_BLOCK_WORK: &str = "the drawing's blocks take too much work to place: the rest are left out"; const TOO_MANY_DASHES: &str = "the drawing has more dashed lines than can be kept: the rest are drawn solid"; +const TOO_SMALL: &str = "block copies drawn too small to place are left out"; const TOO_MUCH_TEXT: &str = "the drawing has more than 64 MB of text and block names: the rest are left out"; /// What a block's art takes from the insert that places it: its colour, lineweight, linetype @@ -627,12 +628,18 @@ impl<'d, 'a> Build<'d, 'a> { self.warn(TOO_MANY); break; } + // The symbol's art is drawn `drawn_at` times larger than a drawing unit + // at the import's scale; the instance takes the rest of the transform. + // The two factors are inverted apart, so a tiny `drawn_at` at a tiny fitted + // scale does not overflow the inverse of their product. + let xf = map * *cell * Affine::scale(drawn_at.recip()) * self.symbol_map.inverse(); + if !xf.as_coeffs().iter().all(|c| c.is_finite()) { + self.warn(TOO_SMALL); + continue; + } if !self.charge_text(name.len()) { break; } - // The symbol's art is drawn `drawn_at` times larger than a drawing unit - // at the import's scale; the instance takes the rest of the transform. - let xf = map * *cell * (self.symbol_map * Affine::scale(drawn_at)).inverse(); self.nodes += 1; Some(Node::new(self.doc.alloc_id(), NodeKind::SymbolInstance { symbol: name, xf })) } diff --git a/crates/cad/src/import/tests.rs b/crates/cad/src/import/tests.rs index ae3a86d180..08f683a65f 100644 --- a/crates/cad/src/import/tests.rs +++ b/crates/cad/src/import/tests.rs @@ -1106,6 +1106,62 @@ fn text_in_a_dashed_block_inserted_at_a_tiny_scale_is_kept() { assert_eq!(texts, ["Label"]); } +#[test] +fn a_dashed_block_at_a_tiny_scale_in_a_huge_fitted_drawing_keeps_a_finite_instance() { + let tables = [(0, "TABLE"), (2, "LTYPE"), (0, "LTYPE"), (2, "DASHED"), (73, "2"), (40, "15"), (49, "10"), (49, "-5"), (0, "ENDTAB")]; + // "G0" draws a line 1e12 long and "G1" to "G6" each place the one before at 1e12, so the + // drawing spans about 1e96 and fits at about 6e-94 points per unit. "D0" draws a dashed line, + // "D1" places it at 1e-4 and "D2" to "D5" each place the one before at 1e-12, so "D0" is drawn + // at about 6e-158 points per unit: the square of that is below the smallest normal number. + let mut blocks: Vec<(i32, &'static str)> = vec![]; + blocks.extend([(0, "BLOCK"), (8, "0"), (2, "G0"), (70, "0"), (10, "0"), (20, "0")]); + blocks.extend([(0, "LINE"), (8, "0"), (10, "0"), (20, "0"), (11, "1e12"), (21, "1e12"), (0, "ENDBLK")]); + blocks.extend([(0, "BLOCK"), (8, "0"), (2, "D0"), (70, "0"), (10, "0"), (20, "0")]); + blocks.extend([(0, "LINE"), (8, "0"), (6, "DASHED"), (10, "0"), (20, "0"), (11, "100"), (21, "0"), (0, "ENDBLK")]); + let names = |p: &str, i: usize| -> &'static str { Box::leak(format!("{p}{i}").into_boxed_str()) }; + for (p, from, to) in [("G", 1, 6), ("D", 1, 5)] { + for i in from..=to { + let scale = match (p, i) { + ("G", _) => "1e12", + (_, 1) => "1e-4", + _ => "1e-12", + }; + blocks.extend([(0, "BLOCK"), (8, "0"), (2, names(p, i)), (70, "0"), (10, "0"), (20, "0")]); + blocks.extend([(0, "INSERT"), (8, "0"), (2, names(p, i - 1)), (10, "0"), (20, "0"), (41, scale), (42, scale), (0, "ENDBLK")]); + } + } + let top = [ + (0, "INSERT"), + (2, "G6"), + (10, "0"), + (20, "0"), + (41, "1e12"), + (42, "1e12"), + (0, "INSERT"), + (2, "D5"), + (10, "0"), + (20, "0"), + (41, "1e-12"), + (42, "1e-12"), + ]; + let o = ImportOptions { fit: true, center: false, ..ImportOptions::default() }; + let doc = open(&drawing(&[], &tables, &blocks, &top), &o).document; + let mut instances = vec![]; + let mut collect = |n: &Node| { + if let NodeKind::SymbolInstance { symbol, xf } = &n.kind { + instances.push((symbol.clone(), *xf)); + } + }; + doc.walk(&mut collect); + for s in &doc.symbols { + s.art.walk(&mut collect); + } + assert!(instances.iter().any(|(symbol, _)| symbol == "D0"), "{instances:?}"); + for (symbol, xf) in &instances { + assert!(xf.as_coeffs().iter().all(|c| c.is_finite()), "{symbol}: {xf:?}"); + } +} + #[test] fn many_by_block_looks_import_in_linear_time() { let by_block: &[(i32, &str)] = &[(0, "LINE"), (8, "0"), (62, "0"), (10, "5"), (20, "5"), (11, "15"), (21, "5")]; From cda16b5163d4f7d9c05b4ce851f4411b6de8b94b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 04:14:07 -0800 Subject: [PATCH 07/41] Fix #10734: Save asks about a changed file only when its bytes changed Save asked "File changed" on every save of a file in a cloud-sync folder. The save flow counts any new change time or inode as a change by another app, and a sync client sets attributes on the file after uploading it, or puts the same bytes back as a new file. The app now keeps a SHA-256 digest of each document's file as it last read or wrote it, taken on a thread after the open and after each save. When the flow would ask, the file is compared with that digest on a thread; a file that still holds the same bytes becomes the recorded version and is written over without asking. A file whose bytes differ, that changes during the comparison, or that has no digest is asked about as before. Digests of closed documents are dropped. --- Cargo.lock | 1 + crates/ui-egui/Cargo.toml | 3 + crates/ui-egui/src/app.rs | 1 + crates/ui-egui/src/io.rs | 2 + crates/ui-egui/src/io/open.rs | 2 +- crates/ui-egui/src/io/save.rs | 181 +++++++++++++++++++++-- crates/ui-egui/src/io/saved_contents.rs | 185 ++++++++++++++++++++++++ crates/ui-egui/src/tests/save.rs | 56 +++++++ 8 files changed, 415 insertions(+), 16 deletions(-) create mode 100644 crates/ui-egui/src/io/saved_contents.rs diff --git a/Cargo.lock b/Cargo.lock index b878d75456..1395815475 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9289,6 +9289,7 @@ dependencies = [ "rustix 1.1.6", "serde", "serde_json", + "sha2 0.10.9", "toml", "vectorcraft-apischema", "vectorcraft-brush", diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml index eddc4bf6bd..a94d788e91 100644 --- a/crates/ui-egui/Cargo.toml +++ b/crates/ui-egui/Cargo.toml @@ -87,6 +87,9 @@ craft = { workspace = true, features = ["dialogs", "update", "automation-agents" # The local date and time the status bar's Date and Time readout shows (`chrono::Local`). Already in # Cargo.lock with the time-zone crates `clock` uses. chrono = { workspace = true, features = ["clock"] } +# The digest of each open document's file, which Save compares with the file before asking whether to replace it +# (`src/io/saved_contents.rs`). Already in Cargo.lock (the engine's and the plug-ins' digests). +sha2 = { version = "0.10", default-features = false } [target.'cfg(target_arch = "wasm32")'.dependencies] # The status bar's Date and Time readout reads the page's clock with this crate in the web build. It diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index e2b89abff8..b769dac802 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -658,6 +658,7 @@ impl VectorcraftApp { if !self.background.jobs.is_empty() || !self.opening.pending.is_empty() || !self.opening.converting.is_empty() + || io::save::checks_pending(self) || plugin_runs::any_pending(self) || !self.placing.pending.is_empty() || !self.trace_runs.running.is_empty() diff --git a/crates/ui-egui/src/io.rs b/crates/ui-egui/src/io.rs index 8d311212aa..ba7b2d856f 100644 --- a/crates/ui-egui/src/io.rs +++ b/crates/ui-egui/src/io.rs @@ -16,6 +16,8 @@ pub(crate) mod export; mod open; mod read_only_save; pub(crate) mod save; +#[cfg(not(target_arch = "wasm32"))] +mod saved_contents; #[cfg(test)] mod tests_read_only_save; diff --git a/crates/ui-egui/src/io/open.rs b/crates/ui-egui/src/io/open.rs index dce5bac6e5..a536eb1e1c 100644 --- a/crates/ui-egui/src/io/open.rs +++ b/crates/ui-egui/src/io/open.rs @@ -178,7 +178,7 @@ pub(crate) fn opened(app: &mut VectorcraftApp, r: &Value) { if let Some(st) = index.and_then(|i| app.session.documents().get(i)) && let Some(path) = &st.path { - app.saves.watch.known_now(st.uid, Path::new(path)); + app.saves.known_now(st.uid, Path::new(path)); } let notes = open_notes(app, r); crate::dialogs::missing_links::after_open(app, r, notes); diff --git a/crates/ui-egui/src/io/save.rs b/crates/ui-egui/src/io/save.rs index fc42da3c77..c09cbe7106 100644 --- a/crates/ui-egui/src/io/save.rs +++ b/crates/ui-egui/src/io/save.rs @@ -1,14 +1,16 @@ use std::collections::HashMap; -use std::path::PathBuf; -// The save panel's flow is the desktop's (craft-dialogs is native only); the web downloads. +use std::path::{Path, PathBuf}; #[cfg(not(target_arch = "wasm32"))] -use std::path::Path; +use std::sync::mpsc::{Receiver, TryRecvError}; +// The save panel's flow is the desktop's (craft-dialogs is native only); the web downloads. #[cfg(not(target_arch = "wasm32"))] use craft::dialogs::save::{SAVE_IN_PROGRESS, SaveDocument, SaveFlow, SaveStep, SaveTarget}; #[cfg(not(target_arch = "wasm32"))] use craft::host::Files; use craft::host::{FileFilter, PickRequest, Picked, Wake}; +#[cfg(not(target_arch = "wasm32"))] +use craft::platform::watch::FileStamp; use craft::platform::watch::FileWatch; use craft::ui::dialog::DialogId; #[cfg(not(target_arch = "wasm32"))] @@ -48,12 +50,27 @@ struct SaveDone { then: Option, } +/// A save whose flow would ask whether to replace its document's file, waiting for the file to be +/// compared with the bytes the app last read or wrote. +#[cfg(not(target_arch = "wasm32"))] +struct Checking { + path: PathBuf, + /// The file's version when it holds those bytes, else `None`. + answer: Receiver>, +} + /// The saves of the app: one [`SaveFlow`] per document, and what the flows need to ask and write. pub(crate) struct Saves { #[cfg(not(target_arch = "wasm32"))] flows: HashMap>, /// The version of each document's file the app last read or wrote. pub(crate) watch: FileWatch, + /// The digest of the bytes of each document's file, as the app last read or wrote them. + #[cfg(not(target_arch = "wasm32"))] + contents: super::saved_contents::SavedContents, + /// The saves waiting for a comparison of their document's file with those bytes. + #[cfg(not(target_arch = "wasm32"))] + checks: HashMap, /// The files written beside each document's file, which its next save replaces. pub(crate) written_beside: HashMap>, /// The files the OK of the replace question allows the save it runs again to replace. @@ -68,6 +85,10 @@ impl Saves { Self { #[cfg(not(target_arch = "wasm32"))] flows: HashMap::new(), + #[cfg(not(target_arch = "wasm32"))] + contents: super::saved_contents::SavedContents::new(), + #[cfg(not(target_arch = "wasm32"))] + checks: HashMap::new(), watch: FileWatch::new(wake), written_beside: HashMap::new(), replace_files_ok: Vec::new(), @@ -76,12 +97,55 @@ impl Saves { } } + /// The app just read document `uid`'s file at `path`: that version is not a change on disk. + pub(crate) fn known_now(&mut self, uid: u64, path: &Path) { + self.watch.known_now(uid, path); + #[cfg(not(target_arch = "wasm32"))] + self.note_contents(uid, path); + } + + /// Takes the digest of document `uid`'s file at `path`, the version the watcher just recorded. + #[cfg(not(target_arch = "wasm32"))] + fn note_contents(&mut self, uid: u64, path: &Path) { + match FileStamp::at(path) { + // Not differing from the watcher's version: the file has not changed since it was recorded. + Some(stamp) if !self.watch.disk_differs(&uid, path, None) => self.contents.note(uid, path, stamp), + _ => self.contents.forget(uid), + } + } + + /// Stops tracking document `uid`'s file (the document closed). + #[cfg(not(target_arch = "wasm32"))] + fn forget(&mut self, uid: u64) { + self.watch.forget(&uid); + self.contents.forget(uid); + self.checks.remove(&uid); + } + #[cfg(not(target_arch = "wasm32"))] fn start(&mut self, files: &dyn Files, document: SaveDocument, target: SaveTarget) -> SaveStep { let Self { flows, watch, .. } = self; flows.entry(document.key).or_default().start(files, watch, document, target) } + /// The answer of document `uid`'s file comparison, once it has come (with `wait`, once it + /// comes): the file's version when it holds the bytes the app last read or wrote, and the + /// file's path. `None` while there is no answer yet, or no comparison. + #[cfg(not(target_arch = "wasm32"))] + fn answer(&mut self, uid: u64, wait: bool) -> Option<(Option, PathBuf)> { + let check = self.checks.get(&uid)?; + let same = if wait { + check.answer.recv().ok().flatten() + } else { + match check.answer.try_recv() { + Ok(same) => same, + Err(TryRecvError::Empty) => return None, + Err(TryRecvError::Disconnected) => None, + } + }; + self.checks.remove(&uid).map(|c| (same, c.path)) + } + /// Frees the document's flow after a write that wrote nothing. #[cfg(not(target_arch = "wasm32"))] pub(super) fn release(&mut self, uid: u64) { @@ -91,6 +155,18 @@ impl Saves { } } +/// Whether file comparisons need another frame to collect their answers. +#[cfg(not(target_arch = "wasm32"))] +pub(crate) fn checks_pending(app: &VectorcraftApp) -> bool { + !app.saves.checks.is_empty() +} + +/// The web has no file comparisons to collect. +#[cfg(target_arch = "wasm32")] +pub(crate) fn checks_pending(_: &VectorcraftApp) -> bool { + false +} + /// Calls the `then` of the document's save, once. #[cfg(not(target_arch = "wasm32"))] fn terminate(app: &mut VectorcraftApp, uid: u64, r: Result) { @@ -107,7 +183,13 @@ fn finish(app: &mut VectorcraftApp, uid: u64, retargets: bool, out: &Result flow.written(&mut app.saves.watch, uid, Path::new(path)), + Some(path) if flow.is_busy() || retargets => { + flow.written(&mut app.saves.watch, uid, Path::new(path)); + // The document's own file (not a copy's): its digest goes with the version the watcher took. + if app.session.documents().iter().any(|d| d.uid == uid && d.path.as_deref() == Some(path)) { + app.saves.note_contents(uid, Path::new(path)); + } + } _ => flow.failed(&uid), } if !matches!(out, Ok(v) if v.get("pending").is_some()) { @@ -124,10 +206,12 @@ pub(crate) fn allow_replacing(app: &mut VectorcraftApp, files: &[String]) { } } -/// Takes what the flows and their questions have answered since the last pass: the pick, the -/// changed-on-disk question's answer. A save whose document closed is cancelled and forgotten. +/// Takes what the flows and their questions have answered since the last pass: the comparison of +/// a document's file, the pick, the changed-on-disk question's answer. A save whose document +/// closed is cancelled and forgotten. Closed documents' digest state is dropped on every pass. #[cfg(not(target_arch = "wasm32"))] pub(crate) fn pump(app: &mut VectorcraftApp, _ctx: &egui::Context) { + resume_checked(app, false); let busy: Vec = app.saves.flows.iter().filter(|(_, f)| f.is_busy()).map(|(uid, _)| *uid).collect(); for uid in busy { if !app.session.documents().iter().any(|d| d.uid == uid) { @@ -136,7 +220,7 @@ pub(crate) fn pump(app: &mut VectorcraftApp, _ctx: &egui::Context) { if let Some(mut flow) = app.saves.flows.remove(&uid) { flow.cancel(app.host.files()); } - app.saves.watch.forget(&uid); + app.saves.forget(uid); continue; } let (scope, automated) = app.saves.done.get(&uid).map_or_else(|| (ScopeHandle::capture(), app.automation_asked()), |d| d.asked.clone()); @@ -152,6 +236,54 @@ pub(crate) fn pump(app: &mut VectorcraftApp, _ctx: &egui::Context) { app.status(e); } } + app.saves.contents.retain_open(app.session.documents().iter().map(|d| d.uid)); +} + +/// Goes on with the saves whose file comparison has answered (with `wait`, every one, once it +/// answers): an unchanged file is written over, and a changed one is asked about. +#[cfg(not(target_arch = "wasm32"))] +fn resume_checked(app: &mut VectorcraftApp, wait: bool) { + let checking: Vec = app.saves.checks.keys().copied().collect(); + for uid in checking { + // A closed document's save is cancelled with its flow, in [`pump`]. + if !app.session.documents().iter().any(|d| d.uid == uid) { + continue; + } + let (scope, automated) = app.saves.done.get(&uid).map_or_else(|| (ScopeHandle::capture(), app.automation_asked()), |d| d.asked.clone()); + let r = scope.run(|| { + file_asks::as_automated(app, automated, |app| { + let (same, path) = app.saves.answer(uid, wait)?; + // Still that version: a change made since the comparison is asked about. + let Some(stamp) = same.filter(|stamp| FileStamp::at(&path) == Some(*stamp)) else { + let asked = ask_changed_on_disk(app, uid, &path); + return Some(settle(app, uid, asked)); + }; + // The same bytes: the file's version now is the document's, and the flow writes over it. + app.saves.watch.known_as(uid, &path, Some(stamp)); + let step = app.saves.flows.get_mut(&uid).map_or(SaveStep::Busy, SaveFlow::replace); + Some(run_step(app, uid, step)) + }) + }); + if let Some(Err(e)) = r + && e != "cancelled" + { + app.status(e); + } + } +} + +/// Waits for every save's file comparison and goes on with those saves. +#[cfg(all(test, not(target_arch = "wasm32")))] +pub(crate) fn wait_for_checks(app: &mut VectorcraftApp) { + resume_checked(app, true); +} + +/// Waits for the active document's baseline digest and compares it with the file. +#[cfg(all(test, not(target_arch = "wasm32")))] +pub(crate) fn wait_for_contents(app: &VectorcraftApp) -> Option { + let document = app.session.active()?; + let path = Path::new(document.path.as_deref()?); + app.saves.contents.check(document.uid, path)?.recv().ok().flatten() } /// The web has no save flows: nothing answers between passes. @@ -182,6 +314,12 @@ fn next_step(app: &mut VectorcraftApp, uid: u64) -> Option> { /// Runs `step` of the document `uid`'s save; a failure frees the flow and tells the caller. fn run_step(app: &mut VectorcraftApp, uid: u64, step: SaveStep) -> Result { let r = proceed(app, step); + settle(app, uid, r) +} + +#[cfg(not(target_arch = "wasm32"))] +/// The result `r` of a step of document `uid`'s save; a failure frees the flow and tells the caller. +fn settle(app: &mut VectorcraftApp, uid: u64, r: Result) -> Result { if r.is_err() { app.saves.release(uid); terminate(app, uid, r.clone()); @@ -189,19 +327,32 @@ fn run_step(app: &mut VectorcraftApp, uid: u64, step: SaveStep) -> Result Result { + let name = fileio::file_name(&path.to_string_lossy()); + let prompt = StandardPrompt::changed_on_disk(name).instance(("changed-on-disk", key)); + let id = app.dialogs().ok_or("no window to ask in")?.with(|host| host.open(prompt)); + if let Some(done) = app.saves.done.get_mut(&key) { + done.question = Some(id); + } + Ok(json!({ "pending": "changedOnDisk" })) +} + #[cfg(not(target_arch = "wasm32"))] fn proceed(app: &mut VectorcraftApp, step: SaveStep) -> Result { match step { SaveStep::Picking => Ok(json!({ "pending": "fileDialog" })), - SaveStep::AskChangedOnDisk { key, path } => { - let name = fileio::file_name(&path.to_string_lossy()); - let prompt = StandardPrompt::changed_on_disk(name).instance(("changed-on-disk", key)); - let id = app.dialogs().ok_or("no window to ask in")?.with(|host| host.open(prompt)); - if let Some(done) = app.saves.done.get_mut(&key) { - done.question = Some(id); + // Before asking, the file is compared with the bytes the app last read or wrote: a file + // whose metadata alone changed (a cloud-sync folder sets attributes on it, or puts the same + // bytes back as a new file) is written over without asking (#10734). [`pump`] goes on. + SaveStep::AskChangedOnDisk { key, path } => match app.saves.contents.check(key, &path) { + Some(answer) => { + app.saves.checks.insert(key, Checking { path, answer }); + Ok(json!({ "pending": "checkingFile" })) } - Ok(json!({ "pending": "changedOnDisk" })) - } + None => ask_changed_on_disk(app, key, &path), + }, SaveStep::Write { key, path, target, file_type } => write_step(app, key, &path.to_string_lossy(), target, file_type), SaveStep::Cancelled { key } => { terminate(app, key, Err("cancelled".into())); diff --git a/crates/ui-egui/src/io/saved_contents.rs b/crates/ui-egui/src/io/saved_contents.rs new file mode 100644 index 0000000000..3e3ff170b8 --- /dev/null +++ b/crates/ui-egui/src/io/saved_contents.rs @@ -0,0 +1,185 @@ +//! The bytes of each open document's file as the app last read or wrote them, kept as a SHA-256 +//! digest (#10734). Save asks before replacing a file another app changed, and the save flow +//! counts a new change time or a new inode as a change. A cloud-sync folder sets +//! attributes on a file after uploading it, or puts the same bytes back as a new file. When the +//! file on disk still holds the bytes the app wrote, Save writes without asking. +//! +//! Files are read and digested on threads of their own: a file in a cloud folder may have to be +//! downloaded first. + +use std::collections::HashMap; +use std::fs::File; +use std::io::Read; +use std::path::{Path, PathBuf}; +use std::sync::mpsc::{self, Receiver}; +use std::sync::{Arc, Mutex, MutexGuard, PoisonError}; +use std::thread::JoinHandle; + +use craft::platform::watch::FileStamp; +use sha2::{Digest, Sha256}; + +/// A version of a document's file: its path, its stamp when read, and the digest of its bytes. +#[derive(Clone)] +struct Version { + path: PathBuf, + stamp: FileStamp, + digest: [u8; 32], +} + +#[derive(Default)] +struct State { + versions: HashMap, + /// Counts the notes of each document: a digest taken for an older note is dropped. + notes: HashMap, + /// The digest being taken for each document's newest note. + pending: HashMap>, +} + +/// The digests of the open documents' files. +pub(crate) struct SavedContents { + state: Arc>, +} + +fn lock(state: &Mutex) -> MutexGuard<'_, State> { + state.lock().unwrap_or_else(PoisonError::into_inner) +} + +impl SavedContents { + /// No digests yet. + pub(crate) fn new() -> Self { + Self { state: Arc::default() } + } + + /// The app just read or wrote document `key`'s file at `path`, and `stamp` is that version. + /// The file is opened and its digest taken on a thread of its own. Any stamp change + /// before or during the read leaves no digest, so Save asks on a change. + pub(crate) fn note(&self, key: u64, path: &Path, stamp: FileStamp) { + let note = { + let mut state = lock(&self.state); + state.versions.remove(&key); + state.pending.remove(&key); + let note = state.notes.entry(key).or_default(); + *note = note.wrapping_add(1); + *note + }; + let state = Arc::clone(&self.state); + let path = path.to_path_buf(); + let work = move || { + let Ok(file) = File::open(&path) else { return }; + let Some(digest) = digest_of(file, stamp) else { return }; + let mut state = lock(&state); + if state.notes.get(&key) == Some(¬e) { + state.versions.insert(key, Version { path, stamp, digest }); + } + }; + // Without a thread nothing is recorded, and Save asks on any change, as before. + if let Ok(handle) = std::thread::Builder::new().name("vectorcraft-file-digest".into()).spawn(work) { + lock(&self.state).pending.insert(key, handle); + } + } + + /// Starts comparing document `key`'s file at `path` with the version the app last read or + /// wrote, on a thread of its own that first waits for that version's digest. The answer is + /// the file's version now when it holds the same bytes, and `None` when the bytes differ, the + /// file can't be read, or no digest of `path` was taken. `None` here when no thread starts. + pub(crate) fn check(&self, key: u64, path: &Path) -> Option>> { + let pending = lock(&self.state).pending.remove(&key); + let state = Arc::clone(&self.state); + let path = path.to_path_buf(); + let (send, answer) = mpsc::channel(); + let work = move || { + if let Some(handle) = pending { + // A digest thread that panicked recorded nothing. + let _ = handle.join(); + } + // The caller may be gone (its document closed): the answer is dropped. + let _ = send.send(unchanged(&state, key, &path)); + }; + std::thread::Builder::new().name("vectorcraft-file-check".into()).spawn(work).ok().map(|_| answer) + } + + /// Document `key` closed: its digest is dropped, and one still being taken is not recorded. + pub(crate) fn forget(&self, key: u64) { + let mut state = lock(&self.state); + state.versions.remove(&key); + state.pending.remove(&key); + let note = state.notes.entry(key).or_default(); + *note = note.wrapping_add(1); + } + + /// Drops closed documents' versions, pending handles and note counters only when needed. + /// Removing a note counter prevents its digest thread from recording a version later. + pub(crate) fn retain_open(&self, open: impl Iterator + Clone) { + let mut state = lock(&self.state); + let is_open = |key: &u64| open.clone().any(|uid| uid == *key); + if state.notes.keys().any(|key| !is_open(key)) { + state.versions.retain(|key, _| is_open(key)); + state.pending.retain(|key, _| is_open(key)); + state.notes.retain(|key, _| is_open(key)); + } + } +} + +/// [`SavedContents::check`]'s answer, on its thread. +fn unchanged(state: &Mutex, key: u64, path: &Path) -> Option { + let version = lock(state).versions.get(&key).filter(|v| v.path == path).cloned()?; + let now = FileStamp::at(path)?; + if now.len() != version.stamp.len() || digest_of(File::open(path).ok()?, now)? != version.digest || FileStamp::at(path) != Some(now) { + return None; + } + if let Some(v) = lock(state).versions.get_mut(&key).filter(|v| v.digest == version.digest) { + v.stamp = now; + } + Some(now) +} + +/// The digest of `file`, read while its full stamp stays at `stamp`; `None` when the stamp +/// differs or the file can't be read. A Unix change time alone can also signal changed bytes. +fn digest_of(mut file: File, stamp: FileStamp) -> Option<[u8; 32]> { + if !file.metadata().is_ok_and(|m| FileStamp::of(&m) == stamp) { + return None; + } + let mut hasher = Sha256::new(); + let mut buffer = vec![0u8; 64 * 1024]; + loop { + let n = file.read(&mut buffer).ok()?; + if n == 0 { + break; + } + hasher.update(buffer.get(..n)?); + } + file.metadata().is_ok_and(|m| FileStamp::of(&m) == stamp).then(|| hasher.finalize().into()) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn retaining_open_documents_drops_closed_documents_state() { + let folder = crate::tests_folder::Folder::new("saved-contents-retain"); + let file = folder.file("document", b"saved contents"); + let path = Path::new(&file); + let stamp = FileStamp::at(path).unwrap(); + let contents = SavedContents::new(); + for uid in [1, 2] { + contents.note(uid, path, stamp); + assert!(contents.check(uid, path).unwrap().recv().unwrap().is_some()); + } + // A third document closes while its digest handle is still retained. + contents.note(3, path, stamp); + contents.retain_open([2].into_iter()); + + { + let state = lock(&contents.state); + for uid in [1, 3] { + assert!(!state.versions.contains_key(&uid)); + assert!(!state.pending.contains_key(&uid)); + assert!(!state.notes.contains_key(&uid)); + } + } + assert!(contents.check(1, path).unwrap().recv().unwrap().is_none()); + assert!(contents.check(3, path).unwrap().recv().unwrap().is_none()); + assert!(contents.check(2, path).unwrap().recv().unwrap().is_some()); + } +} diff --git a/crates/ui-egui/src/tests/save.rs b/crates/ui-egui/src/tests/save.rs index b1fa7cb347..de7728f9e7 100644 --- a/crates/ui-egui/src/tests/save.rs +++ b/crates/ui-egui/src/tests/save.rs @@ -593,3 +593,59 @@ fn acknowledging_import_loss_does_not_overwrite_the_source_with_another_drawing( assert!(after_switch == saved, "drawing B must never overwrite A's file"); assert!(after_original != saved, "approval in drawing A must still save A"); } + +/// Puts `bytes` at `path` as a new file, as a cloud-sync folder puts a file back after uploading +/// it: the file gets a new inode and new change and modification times. +fn put_back(path: &str, bytes: &[u8]) { + let next = format!("{path}.sync"); + std::fs::write(&next, bytes).unwrap(); + std::fs::rename(&next, path).unwrap(); +} + +/// Once its baseline digest is recorded, Save writes without asking while the file holds the +/// bytes the app last read or wrote (#10734), and asks once they differ, even at the same length. +#[test] +fn save_asks_about_a_changed_file_only_when_its_bytes_changed() { + let d = dir("same-bytes"); + let path = d.join("a.vectorcraft").to_string_lossy().to_string(); + let mut writer = app(); + writer.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + rect(&mut writer); + writer.run("file.saveAs", json!({"path": path})).unwrap(); + crate::background::wait_all(&mut writer); + let mut app = app(); + io::open_path(&mut app, &path).unwrap(); + assert!(io::save::wait_for_contents(&app).is_some(), "the opened file's baseline is recorded before sync"); + + let saved = |app: &VectorcraftApp| vectorcraft_format::load(&std::fs::read(&path).unwrap()).unwrap().node_count() == objects(app); + // File › Save, once the file has been compared: did it ask? + let save = |app: &mut VectorcraftApp| { + rect(app); + assert_eq!(app.run("file.save", json!({})).unwrap()["pending"], "checkingFile"); + io::save::wait_for_checks(app); + crate::background::wait_all(app); + if !app.any_dialog_open() { + assert!(io::save::wait_for_contents(app).is_some(), "the written file's baseline is recorded before sync"); + } + app.any_dialog_open() + }; + + // Read from the file: the same bytes put back. + put_back(&path, &std::fs::read(&path).unwrap()); + assert!(!save(&mut app)); + assert!(saved(&app)); + + // Written by that save: the same bytes put back. + put_back(&path, &std::fs::read(&path).unwrap()); + assert!(!save(&mut app)); + assert!(saved(&app)); + + // Other bytes of the same length. + let mut other = std::fs::read(&path).unwrap(); + let last = other.last_mut().unwrap(); + *last ^= 0xff; + put_back(&path, &other); + assert!(save(&mut app), "asks whether to replace the file"); + assert_eq!(std::fs::read(&path).unwrap(), other, "nothing is written before the answer"); + let _ = std::fs::remove_dir_all(d); +} From e009722fe8f069a1c67adff8360ffe0db896f6d4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 05:02:06 -0800 Subject: [PATCH 08/41] Canvas: a drag moves the kept anchor marks mesh instead of tessellating it Each step of a drag moved the kept selection marks, but the anchor marks' mesh was keyed on the marks key, which changes with every revision, so every step tessellated the anchors, handles and outlines again and flattened every outline. With about 2,000 paths selected that was the largest part of each step. The kept mesh now moves with the marks when that gives what a new tessellation gives: the move since the mesh was tessellated is a whole number of physical pixels on screen, so pixel rounding lands the same, and every anchor and handle is inside the canvas and the clip before and after the move, so no mark is left out or culled. Otherwise the next paint tessellates the marks as before. A new revision of the same document and selection also keeps the mesh. --- crates/ui-egui/src/canvas/selection.rs | 68 ++++++++++++++++- crates/ui-egui/src/canvas/selection/tests.rs | 77 ++++++++++++++++++++ 2 files changed, 143 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/canvas/selection.rs b/crates/ui-egui/src/canvas/selection.rs index 861eda0790..b6421c882b 100644 --- a/crates/ui-egui/src/canvas/selection.rs +++ b/crates/ui-egui/src/canvas/selection.rs @@ -688,6 +688,59 @@ struct MeshKey { pub(crate) struct KeptMesh { key: MeshKey, mesh: Arc, + /// How far the marks moved on screen since they were tessellated, in physical pixels, unrounded + /// ([`KeptMesh::translate`]). The mesh moved by this distance rounded. + moved: [f64; 2], +} + +/// How far from a whole number of physical pixels the marks' move since they were tessellated may be on screen, and +/// still count as whole: rounding noise of the screen position, well under what the tessellator's `f32` positions hold. +const PIXEL_SLACK: f64 = 1e-6; + +impl KeptMesh { + /// Moves the mesh by `by` in the document when tessellating the moved marks would give the same mesh moved, and + /// returns whether it did. `was` is the box of the marks' points before the move ([`knots_box`]). The mesh moves + /// when the marks' whole move since they were tessellated is a whole number of physical pixels on screen, so the + /// tessellator's rounding to pixels lands the same, and when every point is inside the canvas the marks are drawn + /// near and inside the clip both before and after the move, so no anchor, handle or outline is left out or culled + /// on either side. + fn translate(&mut self, by: Vec2, was: Option) -> bool { + let key = &self.key; + let ppp = f64::from(key.pixels_per_point); + let view = key.view.affine(); + let shift = (view * (Point::ZERO + by)) - (view * Point::ZERO); + let moved = [self.moved[0] + shift.x * ppp, self.moved[1] + shift.y * ppp]; + if moved.iter().any(|p| !p.is_finite() || (p - p.round()).abs() > PIXEL_SLACK) { + return false; + } + if let Some(was) = was { + let area = key.rect.expand(key.look.reach).intersect(key.clip); + let inside = |r: vectorcraft_geom::Rect| { + [(r.x0, r.y0), (r.x1, r.y0), (r.x1, r.y1), (r.x0, r.y1)].into_iter().all(|(x, y)| area.contains(key.view.to_screen(Point::new(x, y)))) + }; + if !(inside(was) && inside(was + by)) { + return false; + } + } + let step = |axis: usize| ((moved[axis].round() - self.moved[axis].round()) / ppp) as f32; + let offset = vec2(step(0), step(1)); + self.moved = moved; + Arc::make_mut(&mut self.mesh).translate(offset); + true + } +} + +/// The box of every anchor and direction handle of `anchors`, in document units, or `None` without any. The outlines +/// lie inside it too, as a curve lies inside the hull of its points. +fn knots_box(anchors: &Anchors) -> Option { + anchors + .paths + .iter() + .chain(&anchors.plain) + .flat_map(|p| &p.subpaths) + .flat_map(|sp| &sp.knots) + .flat_map(|knot| [knot.anchor, knot.in_ctrl, knot.out_ctrl]) + .fold(None, |r: Option, p| Some(r.map_or(vectorcraft_geom::Rect::from_points(p, p), |r| r.union_pt(p)))) } /// One set of anchors as `BezierOverlay` took it: the paths, which anchors are selected and how they show. @@ -809,7 +862,7 @@ impl Component for AnchorMarks<'_> { None => { let shapes = shapes(); let mesh = Arc::new(tessellate(shapes, &key)); - *kept = Some(KeptMesh { key, mesh: Arc::clone(&mesh) }); + *kept = Some(KeptMesh { key, mesh: Arc::clone(&mesh), moved: [0.0; 2] }); mesh } }; @@ -1198,12 +1251,23 @@ impl SelectionMarks { self.from = (moved.from.clone(), moved.by); self.doc = moved.to.clone(); } + // The kept mesh shows these marks, so it stays theirs under the new key. + let was = self.key; + if let Some(kept) = self.mesh.get_mut().as_mut().filter(|kept| kept.key.marks == was) { + kept.key.marks = key; + } self.key = key; Some(self) } - /// Moves every mark by `by`. + /// Moves every mark by `by`, and the kept mesh of the anchor marks with them when it can move as it is + /// ([`KeptMesh::translate`]); otherwise the next paint tessellates the marks again. fn translate(&mut self, by: Vec2) { + let was = knots_box(&self.anchors); + let mesh = self.mesh.get_mut(); + if mesh.as_mut().is_some_and(|kept| !kept.translate(by, was)) { + *mesh = None; + } let shift = vectorcraft_geom::Affine::translate(by); for o in &mut self.outlines { o.paths.iter_mut().chain(o.key.as_mut()).for_each(|path| path.apply_affine(shift)); diff --git a/crates/ui-egui/src/canvas/selection/tests.rs b/crates/ui-egui/src/canvas/selection/tests.rs index 65ca87aff3..f23e4087aa 100644 --- a/crates/ui-egui/src/canvas/selection/tests.rs +++ b/crates/ui-egui/src/canvas/selection/tests.rs @@ -1283,3 +1283,80 @@ fn a_move_of_the_selection_moves_its_marks_without_building_them() { assert_eq!(frames(&mut app, 3), 1, "an undo"); assert!(kept_marks_are_current(&app), "after an undo"); } + +/// The mesh of the anchor marks the canvas keeps. +fn kept_mesh(app: &VectorcraftApp) -> Arc { + let marks = app.canvas.selection_marks.as_ref().expect("the canvas drew the selection's marks"); + let kept = marks.mesh.borrow(); + Arc::clone(&kept.as_ref().expect("the canvas kept the anchor marks' mesh").mesh) +} + +// A drag of the selection moves the kept mesh of its anchor marks instead of tessellating them again: steps of whole +// pixels tessellate nothing and leave the mesh a new tessellation gives, a new revision of the same marks keeps it, and +// a step of part of a pixel or one that takes the marks past the canvas's edge tessellates them once. +#[test] +fn a_drag_of_the_selection_moves_the_anchor_marks_mesh_without_tessellating_it() { + let (mut app, curve) = canvas_app(); + app.select_tool("selection"); + app.run("select.set", json!({"ids": [curve.0]})).unwrap(); + let ctx = crate::testing::ui_context(); + let frames = |app: &mut VectorcraftApp, n: usize| { + let before = MESHES_BUILT.with(std::cell::Cell::get); + for _ in 0..n { + canvas_frame(app, &ctx, vec![]); + } + MESHES_BUILT.with(std::cell::Cell::get) - before + }; + assert_eq!(frames(&mut app, 2), 1, "the first frame tessellates the marks"); + // A document distance that is `px` physical pixels across on screen. + let pixels = |app: &VectorcraftApp, px: f64| px / (app.canvas_view().unwrap().zoom * f64::from(ctx.pixels_per_point())); + let step = |app: &mut VectorcraftApp, dx: f64| { + app.session.preview("object.transform", &json!({"matrix": [1, 0, 0, 1, dx, 0], "copy": false})).unwrap(); + }; + + let layer = app.session.active().unwrap().doc.layers[0].id; + app.run("layer.setCurrent", json!({"id": layer.0})).unwrap(); + assert_eq!(frames(&mut app, 2), 0, "a new revision of the same document and selection"); + + // The kept mesh matches the one marks built now tessellate; the kept marks go back afterwards, so the drag + // goes on moving them. + let matches_new = |app: &mut VectorcraftApp, case: &str| { + let moved = kept_mesh(app); + let kept = app.canvas.selection_marks.take(); + canvas_frame(app, &ctx, vec![]); + let fresh = kept_mesh(app); + app.canvas.selection_marks = kept; + assert!(!fresh.vertices.is_empty(), "{case}: the marks drew something"); + assert_eq!(moved.indices, fresh.indices, "{case}: the moved mesh has the triangles of a new one"); + assert_eq!(moved.vertices.len(), fresh.vertices.len(), "{case}"); + for (a, b) in moved.vertices.iter().zip(&fresh.vertices) { + assert_eq!(a.color, b.color, "{case}"); + assert!((a.pos - b.pos).length() < 1e-3, "{case}: a moved vertex at {:?}, a new one at {:?}", a.pos, b.pos); + } + }; + + app.session.begin_interaction("Move").unwrap(); + let built = MARKS_BUILT.with(std::cell::Cell::get); + for px in [3.0, 10.0, -4.0] { + let dx = pixels(&app, px); + step(&mut app, dx); + assert_eq!(frames(&mut app, 2), 0, "a drag's step to {px} pixels"); + } + assert_eq!(MARKS_BUILT.with(std::cell::Cell::get), built, "the drag moved the kept marks"); + matches_new(&mut app, "after whole pixels"); + + let built = MARKS_BUILT.with(std::cell::Cell::get); + let dx = pixels(&app, -4.5); + step(&mut app, dx); + assert_eq!(frames(&mut app, 2), 1, "a step to part of a pixel"); + let dx = pixels(&app, -3.5); + step(&mut app, dx); + assert_eq!(frames(&mut app, 2), 0, "a whole pixel from the marks tessellated at part of one"); + assert_eq!(MARKS_BUILT.with(std::cell::Cell::get), built, "the drag moved the kept marks"); + matches_new(&mut app, "after part of a pixel and a whole one"); + // Whole pixels from the last step. + let dx = pixels(&app, 1996.5); + step(&mut app, dx); + assert_eq!(frames(&mut app, 2), 1, "a step past the canvas's edge"); + app.session.commit_interaction().unwrap(); +} From 7961e2563b77137edbcbd5b52ca205333847de41 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 05:57:45 -0800 Subject: [PATCH 09/41] Tests: check the imported instance transforms with is_finite The gate's test-lint flagged the coefficient .all() check as unguarded. --- crates/cad/src/import/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cad/src/import/tests.rs b/crates/cad/src/import/tests.rs index 08f683a65f..fae4602028 100644 --- a/crates/cad/src/import/tests.rs +++ b/crates/cad/src/import/tests.rs @@ -1158,7 +1158,7 @@ fn a_dashed_block_at_a_tiny_scale_in_a_huge_fitted_drawing_keeps_a_finite_instan } assert!(instances.iter().any(|(symbol, _)| symbol == "D0"), "{instances:?}"); for (symbol, xf) in &instances { - assert!(xf.as_coeffs().iter().all(|c| c.is_finite()), "{symbol}: {xf:?}"); + assert!(xf.is_finite(), "{symbol}: {xf:?}"); } } From ada6cc4f55d08f1ac4940d7b06749c3a7560644c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 06:51:48 -0800 Subject: [PATCH 10/41] Tests: Global Edit weight tests check that the field takes a fresh value Both Global Edit tests now assert that the selected object takes the 5 pt typed after the member change, so a draft cleared together with the field's focus fails them. --- crates/ui-egui/src/panels/tests_stroke.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/ui-egui/src/panels/tests_stroke.rs b/crates/ui-egui/src/panels/tests_stroke.rs index c2747a2615..758a5031c1 100644 --- a/crates/ui-egui/src/panels/tests_stroke.rs +++ b/crates/ui-egui/src/panels/tests_stroke.rs @@ -342,6 +342,7 @@ fn changing_global_edit_members_drops_an_unfinished_weight() { assert_ne!(after.width, 8.0, "{change}: the unfinished value reaches no member"); assert!(after.width == before.width || after.width == 5.0, "{change}: only the fresh weight can be applied"); } + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "{change}: the field still takes a fresh weight"); } } @@ -893,6 +894,7 @@ fn changing_global_edit_members_drops_an_unfinished_appearance_weight() { assert_ne!(after.width, 8.0, "{change}: the unfinished value reaches no member"); assert!(after.width == before.width || after.width == 5.0, "{change}: only the fresh weight can be applied"); } + assert_eq!(stroke_of(&p.app(), a).width, 5.0, "{change}: the field still takes a fresh weight"); } } From 276a00fe18b8974bcf16b99db64ae362493fbe3e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 07:06:19 -0800 Subject: [PATCH 11/41] Tests: check the stroke tests' collections before their all() assertions The gate's test-lint rejects an assert!(...all(...)) with no length or emptiness check, since an empty collection passes it. Four new stroke tests asserted every run's weight without one. Each now checks that the text keeps its characters (and runs) first; the new-art test checks that both strokes remain, and the threaded-story test that both frames hold characters. --- crates/ui-egui/src/panels/tests_stroke.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/ui-egui/src/panels/tests_stroke.rs b/crates/ui-egui/src/panels/tests_stroke.rs index 758a5031c1..08c60f1093 100644 --- a/crates/ui-egui/src/panels/tests_stroke.rs +++ b/crates/ui-egui/src/panels/tests_stroke.rs @@ -179,6 +179,7 @@ fn adding_an_identical_new_art_stroke_drops_an_unfinished_weight() { finish_typing(&mut p); let app = p.app(); assert_eq!(app.session.new_art_stroke().width, 5.0); + assert_eq!(app.session.new_art().items.iter().filter(|item| !item.is_fill()).count(), 2, "new art keeps both strokes"); assert!(app.session.new_art().items.iter().all(|item| match item { vectorcraft_doc::AppearanceItem::Stroke(stroke) => stroke.width != 8.0, _ => true, @@ -203,6 +204,8 @@ fn changing_a_later_character_stroke_drops_an_unfinished_weight() { p.key(Key::Enter, Modifiers::NONE); let app = p.app(); let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + assert_eq!(t.plain_text(), "Stroke"); + assert!(!t.runs.is_empty(), "the text keeps its runs"); assert!(t.runs.iter().all(|run| run.style.stroke_width == 1.0), "each character takes the fresh weight"); } @@ -225,6 +228,8 @@ fn a_collapsed_type_caret_drops_an_unfinished_weight_when_other_characters_chang p.key(Key::Enter, Modifiers::NONE); let app = p.app(); let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; + assert_eq!(t.plain_text(), "Stroke"); + assert!(!t.runs.is_empty(), "the text keeps its runs"); assert!(t.runs.iter().all(|run| run.style.stroke_width != 4.0), "the unfinished expression reaches no character"); assert!(t.runs.iter().all(|run| run.style.stroke_width == 1.0), "the fresh weight edits the whole frame"); } @@ -362,6 +367,7 @@ fn replacing_text_with_the_same_byte_length_drops_an_unfinished_weight() { let app = p.app(); let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(id).unwrap().kind else { panic!("type") }; assert_eq!(t.plain_text(), "Weight"); + assert!(!t.runs.is_empty(), "the replacement text has runs"); assert!(t.runs.iter().all(|run| run.style.stroke_width == 5.0), "the replacement text takes only the fresh value"); } @@ -851,6 +857,11 @@ fn an_unfinished_weight_is_dropped_when_the_whole_story_is_selected() { let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(NodeId(id)).unwrap().kind else { panic!("type") }; t.runs.iter().map(|r| r.style.stroke_width).collect::>() }; + let text_len = |id: u64| { + let NodeKind::Text(t) = &app.session.active().unwrap().doc.node(NodeId(id)).unwrap().kind else { panic!("type") }; + vectorcraft_text::edit::runs_len(&t.runs) + }; + assert!(text_len(a) > 0 && text_len(b) > 0, "both frames hold characters"); assert!(widths(a).iter().chain(&widths(b)).all(|w| *w == 5.0), "the story takes 5 pt, not 3+5: {:?} {:?}", widths(a), widths(b)); } From e90b66052709aff0f3abb10bf525fee747b8c0f8 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 07:35:32 -0800 Subject: [PATCH 12/41] Save: a file comparison waits for another document's dialog and drops a stale file A save waiting for its file comparison now goes on only when no dialog or file picker of another document is open, so writing it does not activate its document under that dialog. While it waits, no frames are requested. A comparison for a file the document no longer uses is dropped and its save canceled, without asking about the old file, and the next Save starts. --- crates/ui-egui/src/io/save.rs | 36 ++++++++++++++- crates/ui-egui/src/tests/save.rs | 76 ++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/io/save.rs b/crates/ui-egui/src/io/save.rs index c09cbe7106..1fb7d89d3a 100644 --- a/crates/ui-egui/src/io/save.rs +++ b/crates/ui-egui/src/io/save.rs @@ -158,7 +158,15 @@ impl Saves { /// Whether file comparisons need another frame to collect their answers. #[cfg(not(target_arch = "wasm32"))] pub(crate) fn checks_pending(app: &VectorcraftApp) -> bool { - !app.saves.checks.is_empty() + // A save waiting for a dialog goes on in the frame that closes the dialog. + app.saves.checks.keys().any(|uid| !under_dialog(app, *uid)) +} + +/// Whether a dialog or file picker of a document other than `uid` is open: writing document +/// `uid`'s save would activate it under the dialog. +#[cfg(not(target_arch = "wasm32"))] +fn under_dialog(app: &VectorcraftApp, uid: u64) -> bool { + app.session.active().map(|d| d.uid) != Some(uid) && (app.any_dialog_open() || app.file_dialog_open()) } /// The web has no file comparisons to collect. @@ -246,12 +254,24 @@ fn resume_checked(app: &mut VectorcraftApp, wait: bool) { let checking: Vec = app.saves.checks.keys().copied().collect(); for uid in checking { // A closed document's save is cancelled with its flow, in [`pump`]. - if !app.session.documents().iter().any(|d| d.uid == uid) { + let Some(file) = app.session.documents().iter().find(|d| d.uid == uid).map(|d| d.path.clone()) else { + continue; + }; + // Writing activates the save's document: while a dialog or file picker of another document + // is open, the answer stays in its channel for a later pass. + if !wait && under_dialog(app, uid) { continue; } let (scope, automated) = app.saves.done.get(&uid).map_or_else(|| (ScopeHandle::capture(), app.automation_asked()), |d| d.asked.clone()); let r = scope.run(|| { file_asks::as_automated(app, automated, |app| { + // The document now uses another file (a Save As finished meanwhile): the comparison + // is dropped and its save cancelled, without asking about the old file. + if app.saves.checks.get(&uid).is_some_and(|c| file.as_deref().map(Path::new) != Some(c.path.as_path())) { + app.saves.checks.remove(&uid); + let step = app.saves.flows.get_mut(&uid).and_then(|f| f.cancel(app.host.files())); + return step.map(|step| run_step(app, uid, step)); + } let (same, path) = app.saves.answer(uid, wait)?; // Still that version: a change made since the comparison is asked about. let Some(stamp) = same.filter(|stamp| FileStamp::at(&path) == Some(*stamp)) else { @@ -278,6 +298,18 @@ pub(crate) fn wait_for_checks(app: &mut VectorcraftApp) { resume_checked(app, true); } +/// Waits for every save's file comparison to answer, leaving each answer for the next [`pump`]. +#[cfg(all(test, not(target_arch = "wasm32")))] +pub(crate) fn wait_for_answers(app: &mut VectorcraftApp) { + for check in app.saves.checks.values_mut() { + let (send, answer) = std::sync::mpsc::channel(); + if let Ok(same) = check.answer.recv() { + let _ = send.send(same); + } + check.answer = answer; + } +} + /// Waits for the active document's baseline digest and compares it with the file. #[cfg(all(test, not(target_arch = "wasm32")))] pub(crate) fn wait_for_contents(app: &VectorcraftApp) -> Option { diff --git a/crates/ui-egui/src/tests/save.rs b/crates/ui-egui/src/tests/save.rs index de7728f9e7..d6c1d0b34d 100644 --- a/crates/ui-egui/src/tests/save.rs +++ b/crates/ui-egui/src/tests/save.rs @@ -649,3 +649,79 @@ fn save_asks_about_a_changed_file_only_when_its_bytes_changed() { assert_eq!(std::fs::read(&path).unwrap(), other, "nothing is written before the answer"); let _ = std::fs::remove_dir_all(d); } + +/// Opens a file saved by another app, with the file then put back (with other bytes of the same +/// length unless `same`), and one more object: File › Save compares the file before it writes. +fn opened_then_put_back(tag: &str, same: bool) -> (std::path::PathBuf, String, VectorcraftApp) { + let d = dir(tag); + let path = d.join("a.vectorcraft").to_string_lossy().to_string(); + let mut writer = app(); + writer.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + rect(&mut writer); + writer.run("file.saveAs", json!({"path": path})).unwrap(); + crate::background::wait_all(&mut writer); + let mut app = app(); + io::open_path(&mut app, &path).unwrap(); + assert!(io::save::wait_for_contents(&app).is_some(), "the opened file's baseline is recorded"); + let mut other = std::fs::read(&path).unwrap(); + if !same { + let last = other.last_mut().unwrap(); + *last ^= 0xff; + } + put_back(&path, &other); + rect(&mut app); + (d, path, app) +} + +/// A comparison that answers after the document took another file does not ask about the old one. +#[test] +fn a_comparison_for_a_file_the_document_no_longer_uses_asks_nothing() { + let (d, path, mut app) = opened_then_put_back("compare-retargeted", false); + assert_eq!(app.run("file.save", json!({})).unwrap()["pending"], "checkingFile"); + let other = d.join("b.vectorcraft").to_string_lossy().to_string(); + app.session.doc_mut().unwrap().path = Some(other.clone()); + let before = std::fs::read(&path).unwrap(); + io::save::wait_for_checks(&mut app); + crate::background::wait_all(&mut app); + let asked = app.any_dialog_open(); + let pending = io::save::checks_pending(&app); + let after = std::fs::read(&path).unwrap(); + // The dropped save freed the flow: the next File › Save writes the new file. + let next = app.run("file.save", json!({})); + crate::background::wait_all(&mut app); + let wrote_new = std::path::Path::new(&other).exists(); + let _ = std::fs::remove_dir_all(d); + assert!(next.is_ok(), "the next save starts: {next:?}"); + assert!(wrote_new, "the next save writes the document's new file"); + assert!(!asked, "no changed-on-disk question about a file the document no longer uses"); + assert!(!pending, "the comparison is dropped"); + assert_eq!(after, before, "the old file is not written"); +} + +/// A comparison that answers while a dialog is open over another document waits for it to close, +/// so the save does not activate its own document under the dialog. +#[test] +fn a_comparison_waits_while_a_dialog_is_open_over_another_document() { + let (d, path, mut app) = opened_then_put_back("compare-under-dialog", true); + let before = std::fs::read(&path).unwrap(); + assert_eq!(app.run("file.save", json!({})).unwrap()["pending"], "checkingFile"); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + let prompt = craft::ui::dialog::StandardPrompt::changed_on_disk("other"); + app.dialogs().unwrap().with(|h| h.open(prompt)); + io::save::wait_for_answers(&mut app); + let ctx = egui::Context::default(); + io::save::pump(&mut app, &ctx); + let active = app.session.active_index(); + let pending = io::save::checks_pending(&app); + let unwritten = std::fs::read(&path).unwrap() == before; + // Once the dialog closes, the save goes on and writes the file. + answer_top(&mut app, false); + io::save::pump(&mut app, &ctx); + crate::background::wait_all(&mut app); + let written = std::fs::read(&path).unwrap() != before; + let _ = std::fs::remove_dir_all(d); + assert_eq!(active, Some(1), "the document under the dialog stays active"); + assert!(!pending, "no frames are asked for while the save waits for the dialog"); + assert!(unwritten, "nothing is written while the dialog is open"); + assert!(written, "the save finishes once the dialog closes"); +} From 8ff9a8c9eb59501a8812c052d8ceacd3a4e61eb2 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 08:05:39 -0800 Subject: [PATCH 13/41] Canvas: keep the moved anchor marks mesh only when every mark moves by whole pixels A move of whole pixels on screen did not guarantee that each mark's f32 screen position moved by whole pixels: `CanvasView::to_screen` casts to f32, so a point at x = 255.999991 lands at 255.99998 before a one-pixel move and at 257.0 after it, and its square rounds to other pixels than the moved mesh's. The move now checks every anchor and handle's f32 screen position before and after, and tessellates again when one does not move by the whole pixels. The same pass checks that every point stays inside the canvas, in place of the box of the points. --- crates/ui-egui/src/canvas/selection.rs | 43 +++++++++++--------- crates/ui-egui/src/canvas/selection/tests.rs | 37 +++++++++++++++++ 2 files changed, 60 insertions(+), 20 deletions(-) diff --git a/crates/ui-egui/src/canvas/selection.rs b/crates/ui-egui/src/canvas/selection.rs index b6421c882b..6151e3affb 100644 --- a/crates/ui-egui/src/canvas/selection.rs +++ b/crates/ui-egui/src/canvas/selection.rs @@ -699,12 +699,12 @@ const PIXEL_SLACK: f64 = 1e-6; impl KeptMesh { /// Moves the mesh by `by` in the document when tessellating the moved marks would give the same mesh moved, and - /// returns whether it did. `was` is the box of the marks' points before the move ([`knots_box`]). The mesh moves - /// when the marks' whole move since they were tessellated is a whole number of physical pixels on screen, so the - /// tessellator's rounding to pixels lands the same, and when every point is inside the canvas the marks are drawn - /// near and inside the clip both before and after the move, so no anchor, handle or outline is left out or culled - /// on either side. - fn translate(&mut self, by: Vec2, was: Option) -> bool { + /// returns whether it did. `points` are the marks' anchors and direction handles before the move ([`knot_points`]). + /// The mesh moves when the marks' whole move since they were tessellated is a whole number of physical pixels on + /// screen, and when every point's `f32` screen position moves by this move's whole pixels too, so the tessellator's + /// rounding to pixels lands the same. It also needs every point inside the canvas before and after the move, so the + /// marks are drawn near and inside the clip on both sides and no anchor, handle or outline is left out or culled. + fn translate(&mut self, by: Vec2, points: impl IntoIterator) -> bool { let key = &self.key; let ppp = f64::from(key.pixels_per_point); let view = key.view.affine(); @@ -713,26 +713,31 @@ impl KeptMesh { if moved.iter().any(|p| !p.is_finite() || (p - p.round()).abs() > PIXEL_SLACK) { return false; } - if let Some(was) = was { - let area = key.rect.expand(key.look.reach).intersect(key.clip); - let inside = |r: vectorcraft_geom::Rect| { - [(r.x0, r.y0), (r.x1, r.y0), (r.x1, r.y1), (r.x0, r.y1)].into_iter().all(|(x, y)| area.contains(key.view.to_screen(Point::new(x, y)))) - }; - if !(inside(was) && inside(was + by)) { + // This move in whole physical pixels. + let pixels = [moved[0].round() - self.moved[0].round(), moved[1].round() - self.moved[1].round()]; + let area = key.rect.expand(key.look.reach).intersect(key.clip); + // `CanvasView::to_screen` with the affine computed once. + let screen = |p: Point| { + let s = view * p; + egui::pos2(s.x as f32, s.y as f32) + }; + let whole = |from: f32, to: f32, px: f64| ((f64::from(to) - f64::from(from)) * ppp - px).abs() <= PIXEL_SLACK; + for p in points { + let (from, to) = (screen(p), screen(p + by)); + if !(area.contains(from) && area.contains(to) && whole(from.x, to.x, pixels[0]) && whole(from.y, to.y, pixels[1])) { return false; } } - let step = |axis: usize| ((moved[axis].round() - self.moved[axis].round()) / ppp) as f32; - let offset = vec2(step(0), step(1)); + let offset = vec2((pixels[0] / ppp) as f32, (pixels[1] / ppp) as f32); self.moved = moved; Arc::make_mut(&mut self.mesh).translate(offset); true } } -/// The box of every anchor and direction handle of `anchors`, in document units, or `None` without any. The outlines -/// lie inside it too, as a curve lies inside the hull of its points. -fn knots_box(anchors: &Anchors) -> Option { +/// Every anchor and direction handle of `anchors`, in document units. The outlines lie inside the hull of these +/// points, as a curve lies inside the hull of its points. +fn knot_points(anchors: &Anchors) -> impl Iterator + '_ { anchors .paths .iter() @@ -740,7 +745,6 @@ fn knots_box(anchors: &Anchors) -> Option { .flat_map(|p| &p.subpaths) .flat_map(|sp| &sp.knots) .flat_map(|knot| [knot.anchor, knot.in_ctrl, knot.out_ctrl]) - .fold(None, |r: Option, p| Some(r.map_or(vectorcraft_geom::Rect::from_points(p, p), |r| r.union_pt(p)))) } /// One set of anchors as `BezierOverlay` took it: the paths, which anchors are selected and how they show. @@ -1263,9 +1267,8 @@ impl SelectionMarks { /// Moves every mark by `by`, and the kept mesh of the anchor marks with them when it can move as it is /// ([`KeptMesh::translate`]); otherwise the next paint tessellates the marks again. fn translate(&mut self, by: Vec2) { - let was = knots_box(&self.anchors); let mesh = self.mesh.get_mut(); - if mesh.as_mut().is_some_and(|kept| !kept.translate(by, was)) { + if mesh.as_mut().is_some_and(|kept| !kept.translate(by, knot_points(&self.anchors))) { *mesh = None; } let shift = vectorcraft_geom::Affine::translate(by); diff --git a/crates/ui-egui/src/canvas/selection/tests.rs b/crates/ui-egui/src/canvas/selection/tests.rs index f23e4087aa..3b979256c5 100644 --- a/crates/ui-egui/src/canvas/selection/tests.rs +++ b/crates/ui-egui/src/canvas/selection/tests.rs @@ -1360,3 +1360,40 @@ fn a_drag_of_the_selection_moves_the_anchor_marks_mesh_without_tessellating_it() assert_eq!(frames(&mut app, 2), 1, "a step past the canvas's edge"); app.session.commit_interaction().unwrap(); } + +// A move of whole pixels keeps the mesh only when every point's `f32` screen position moves by those whole pixels: +// at x = 255.999991 the screen position before a one-pixel move is 255.99998 and after it 257.0, so the marks' +// squares would round to other pixels than the moved mesh's. +#[test] +fn a_whole_pixel_move_keeps_the_mesh_only_when_the_screen_positions_move_by_whole_pixels() { + let screen = Rect::from_min_size(egui::pos2(0.0, 0.0), vec2(1000.0, 1000.0)); + let look = MarkLook { + line: Color32::BLACK, + fill: Color32::WHITE, + edge: Color32::BLACK, + anchor: 5.0, + large: 7.0, + thin: 1.0, + medium: 2.0, + thick: 3.0, + reach: 20.0, + }; + let kept = || KeptMesh { + key: MeshKey { + marks: 0, + view: CanvasView::new(screen, Point::new(500.0, 500.0), 1.0), + rect: screen, + clip: screen, + pixels_per_point: 1.0, + options: egui::epaint::TessellationOptions::default(), + look, + }, + mesh: Arc::new(egui::Mesh::default()), + moved: [0.0; 2], + }; + let by = Vec2::new(1.0, 0.0); + assert!(kept().translate(by, [Point::new(255.5, 10.0)]), "a point whose screen position moves one whole pixel"); + let mut off = kept(); + assert!(!off.translate(by, [Point::new(255.5, 10.0), Point::new(255.999_991, 10.0)]), "a point that moves 1.0000153 pixels"); + assert_eq!(off.moved, [0.0; 2], "the refused move leaves the mesh where it was"); +} From 3493a12c0056af2919a3c5c44965e72872dbfbdb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 08:05:49 -0800 Subject: [PATCH 14/41] Tests: check each threaded frame's runs before its all() assertion test-lint counts a size check only on a plain local just before the all() that reads it, so the threaded-story test still failed the gate's all-unguarded rule. Each frame's widths are now a local, checked for runs, then asserted. --- crates/ui-egui/src/panels/tests_stroke.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/tests_stroke.rs b/crates/ui-egui/src/panels/tests_stroke.rs index 08c60f1093..04057e291d 100644 --- a/crates/ui-egui/src/panels/tests_stroke.rs +++ b/crates/ui-egui/src/panels/tests_stroke.rs @@ -862,7 +862,11 @@ fn an_unfinished_weight_is_dropped_when_the_whole_story_is_selected() { vectorcraft_text::edit::runs_len(&t.runs) }; assert!(text_len(a) > 0 && text_len(b) > 0, "both frames hold characters"); - assert!(widths(a).iter().chain(&widths(b)).all(|w| *w == 5.0), "the story takes 5 pt, not 3+5: {:?} {:?}", widths(a), widths(b)); + let (first, second) = (widths(a), widths(b)); + assert!(!first.is_empty(), "the first frame has runs"); + assert!(first.iter().all(|w| *w == 5.0), "the story takes 5 pt, not 3+5: {first:?}"); + assert!(!second.is_empty(), "the second frame has runs"); + assert!(second.iter().all(|w| *w == 5.0), "the story takes 5 pt, not 3+5: {second:?}"); } #[test] From 1bc0c5ba7825048b93195848a9ee02904cf6ec6c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 08:06:12 -0800 Subject: [PATCH 15/41] CI: analyze main in SonarCloud only at the nightly's commit SonarCloud ran a full instrumented analysis for every merge commit on main (about 90 a day, 97 to 191 minutes each). Stage 2 only reads the analysis of the commit the nightly builds, so main is now analyzed once a day: - sonarcloud.yml drops the push trigger and starts when the unsigned nightly starts (workflow_run, requested). A first job fails the run when main has moved past the nightly's commit, so the analysis is never of another commit. Pull request analysis is unchanged. - nightly-dispatch.yml waits, for up to 280 minutes, for the SonarCloud check on the producer's commit to complete before it dispatches the signer. A SonarCloud run that ended without a check stops the wait after 20 minutes. The job gains checks: read and a 300-minute timeout. - packaging/nightly-release-tests.py runs the dispatch script against a fake API: it dispatches only after the check completes, and refuses when the SonarCloud run ended without one or when the deadline passes. - docs/nightly-release-preparation.md describes both workflows. --- .github/workflows/nightly-dispatch.yml | 66 ++++++++++++++---- .github/workflows/sonarcloud.yml | 32 ++++++++- docs/nightly-release-preparation.md | 16 +++-- packaging/nightly-release-tests.py | 92 ++++++++++++++++++++++++++ 4 files changed, 186 insertions(+), 20 deletions(-) diff --git a/.github/workflows/nightly-dispatch.yml b/.github/workflows/nightly-dispatch.yml index 4ef372c40b..4581f75d39 100644 --- a/.github/workflows/nightly-dispatch.yml +++ b/.github/workflows/nightly-dispatch.yml @@ -16,9 +16,11 @@ jobs: github.repository == 'storytold/vectorcraft' && github.event_name == 'workflow_run' runs-on: ubuntu-latest - timeout-minutes: 5 + # Most of the time is the wait for the producer commit's SonarCloud analysis (up to 280 minutes). + timeout-minutes: 300 permissions: actions: write + checks: read steps: - name: Dispatch only the exact completed producer run and attempt shell: python @@ -27,6 +29,10 @@ jobs: run: | import json import os + import re + import time + import urllib.error + import urllib.parse import urllib.request def require(value, message): @@ -51,22 +57,58 @@ jobs: run_id, attempt = producer.get('id'), producer.get('run_attempt') require(type(run_id) is int and run_id > 0, 'invalid producer run id') require(type(attempt) is int and attempt == 1, 'invalid automatic producer attempt') + source = producer.get('head_sha') + require(isinstance(source, str) and re.fullmatch(r'[0-9a-f]{40}', source), 'invalid producer commit') + headers = { + 'Authorization': 'Bearer ' + os.environ['GH_TOKEN'], + 'Accept': 'application/vnd.github+json', + 'X-GitHub-Api-Version': '2022-11-28', + 'User-Agent': 'vectorcraft-nightly-dispatch' + } + class NoRedirect(urllib.request.HTTPRedirectHandler): + def redirect_request(self, req, fp, code, msg, headers, newurl): + raise RuntimeError('dispatch redirects are forbidden') + opener = urllib.request.build_opener(NoRedirect()) + + def read(path): + request = urllib.request.Request('https://api.github.com/repos/storytold/vectorcraft' + path, headers=headers) + with opener.open(request, timeout=20) as response: + require(response.status == 200, 'read was not accepted') + return json.load(response) + + # Stage 2 admits the producer only on its commit's own SonarCloud analysis, which + # sonarcloud.yml starts when the producer starts. Wait for the check that analysis posts; + # a SonarCloud run that ended without one gets 20 minutes before the wait gives up. + checks_path = '/commits/' + source + '/check-runs?' + urllib.parse.urlencode( + {'app_id': 12526, 'check_name': 'SonarCloud Code Analysis', 'filter': 'latest'}) + runs_path = '/actions/workflows/sonarcloud.yml/runs?' + urllib.parse.urlencode( + {'event': 'workflow_run', 'head_sha': source, 'per_page': 1}) + deadline = time.monotonic() + 280 * 60 + ended = None + while True: + try: + checks = read(checks_path).get('check_runs', []) + if any(c.get('head_sha') == source and c.get('status') == 'completed' for c in checks): + break + runs = read(runs_path).get('workflow_runs', []) + if runs and runs[0].get('status') == 'completed' and ended is None: + ended = time.monotonic() + print('SonarCloud run', runs[0].get('id'), 'ended:', runs[0].get('conclusion')) + except (urllib.error.URLError, OSError, ValueError) as error: + print('Read failed, polling again:', error) + require(ended is None or time.monotonic() < ended + 20 * 60, + 'the SonarCloud run for the producer commit ended without an analysis check') + require(time.monotonic() < deadline, 'no SonarCloud analysis of the producer commit in time') + time.sleep(60) + print('SonarCloud analysis check of', source, 'is complete.') + body = json.dumps({'ref': 'refs/heads/nightly-signer', 'inputs': { 'producer_run_id': str(run_id), 'producer_run_attempt': str(attempt) }}).encode('utf-8') request = urllib.request.Request( 'https://api.github.com/repos/storytold/vectorcraft/actions/workflows/nightly-sign.yml/dispatches', - data=body, method='POST', headers={ - 'Authorization': 'Bearer ' + os.environ['GH_TOKEN'], - 'Accept': 'application/vnd.github+json', - 'Content-Type': 'application/json', - 'X-GitHub-Api-Version': '2022-11-28', - 'User-Agent': 'vectorcraft-nightly-dispatch' - }) - class NoRedirect(urllib.request.HTTPRedirectHandler): - def redirect_request(self, req, fp, code, msg, headers, newurl): - raise RuntimeError('dispatch redirects are forbidden') + data=body, method='POST', headers=dict(headers, **{'Content-Type': 'application/json'})) # One bounded request, no retry: duplicate transport is not publication authority. - with urllib.request.build_opener(NoRedirect()).open(request, timeout=20) as response: + with opener.open(request, timeout=20) as response: require(response.status == 204, 'dispatch was not accepted') print('Dispatched producer run/attempt to the release-ref validator; not a signing result.') diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 98e9c1d00a..312ab1cbda 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -1,8 +1,12 @@ name: SonarCloud +# Main is analyzed once a day, at the commit the nightly builds: Stage 2 admits a nightly only on +# that commit's own analysis, and nightly-dispatch.yml waits for it before dispatching the signer. on: workflow_dispatch: - push: + workflow_run: + workflows: [VectorCraft unsigned nightly] + types: [requested] branches: [main] pull_request: types: [opened, synchronize, reopened] @@ -12,11 +16,35 @@ permissions: concurrency: group: ${{ github.ref == 'refs/heads/main' && format('sonarcloud-main-{0}', github.sha) || format('sonarcloud-{0}', github.ref) }} - # A push to main is the run that publishes coverage; superseded runs there would never finish. + # A main run is the analysis a nightly waits for; superseded runs there would never finish. cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: + nightly-commit: + name: Nightly commit is main's head + # A workflow_run checks out and analyzes main's head, so main must not have moved since the + # nightly started. + if: github.event_name == 'workflow_run' + runs-on: ubuntu-latest + timeout-minutes: 2 + steps: + - name: Harden runner + uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + with: + egress-policy: audit + - name: Require main's head to be the nightly's commit + env: + NIGHTLY_SHA: ${{ github.event.workflow_run.head_sha }} + RUN_SHA: ${{ github.sha }} + run: | + if [ "$NIGHTLY_SHA" != "$RUN_SHA" ]; then + echo "::error::main moved from $NIGHTLY_SHA to $RUN_SHA after the nightly started; this run would not analyze the nightly's commit" + exit 1 + fi + sonarcloud: + needs: nightly-commit + if: ${{ !cancelled() && contains(fromJSON('["success","skipped"]'), needs.nightly-commit.result) }} # Tracked at @main so org-wide CI improvements propagate without PR churn. # The reusable workflow defaults build-jobs to 2 so a cold instrumented # archive stays within hosted-runner memory (craft-common-actions#333). diff --git a/docs/nightly-release-preparation.md b/docs/nightly-release-preparation.md index 29ca838f1d..1074e90299 100644 --- a/docs/nightly-release-preparation.md +++ b/docs/nightly-release-preparation.md @@ -79,7 +79,7 @@ Read on 2026-11-24; re-read anything that may have moved before `nightly-signer` | `max_age_seconds`, `max_artifact_bytes` | `86400`, `2147483648` | Go-live checklist | | `platforms` | three rows | Learning Machines stable identities (Windows Authenticode publisher subject, Linux OpenPGP fingerprint, Apple Developer ID team `DJ6XS33FX8`) | | `candidate_policy.required_workflows` | CI (`ci.yml`, workflow `380135806`), 9 jobs | Workflow list API; jobs that succeeded on recent main push runs | -| `candidate_policy.sonar` | `storytold` / `storytold_vectorcraft`, app `12526` | `sonar-project.properties`; the SonarCloud check on main commits | +| `candidate_policy.sonar` | `storytold` / `storytold_vectorcraft`, app `12526` | `sonar-project.properties`; the SonarCloud check on the nightly's commit | The signer reads the policy from `nightly-signer`, so a candidate whose CI built the tests once (`build`, `lint` and `test 1/5` to `test 5/5`) is admitted only after `nightly-signer` advances to @@ -97,9 +97,12 @@ a main commit with this policy. Candidates whose CI ran six shards (`cache warm` from stable, cancellation is off and `queue: max` must be hosted-qualified. The caller itself passes no credentials; only the shared callee's sign jobs bind the `release` environment, which must admit `nightly-signer` alongside `release` before the first dispatch. -- `.github/workflows/nightly-dispatch.yml`: transport only, never authorization. It is literally - off (`false &&`) and forwards only a first-attempt scheduled producer to `nightly-sign.yml` on - `nightly-signer`. No schedule is registered until activation is reviewed. +- `.github/workflows/nightly-dispatch.yml`: transport only, never authorization. It forwards only + a first-attempt scheduled producer to `nightly-sign.yml` on `nightly-signer`, after the + SonarCloud check on the producer's commit has completed. +- `.github/workflows/sonarcloud.yml`: analyzes main only at the commit a nightly builds. It starts + when the producer starts and fails when main has moved past the producer's commit. Pull requests + are analyzed on every push as before. - Shared reusable entrypoints are `nightly-unsigned.yml` and `nightly-release.yml` in `storytold/craft-common-actions`. Both must resolve to a **real reviewed public immutable commit**; the defining workflow SHA and tooling input must match. @@ -117,8 +120,9 @@ a main commit with this policy. Candidates whose CI ran six shards (`cache warm` - A trust-closure scan reads every workflow: nothing binds an `environment`, only `nightly-sign.yml` calls `nightly-release.yml` (at a full SHA), and the only caller of the shared stable `release.yml` is `release.yml`. -- `nightly-dispatch.yml` keeps a literal-off guard, a `workflow_run`-only trigger and a - `refs/heads/nightly-signer` request. +- `nightly-dispatch.yml` keeps its exact context guard, a `workflow_run`-only trigger and a + `refs/heads/nightly-signer` request, and sends that request only after the SonarCloud check on + the producer's commit has completed. ## The app side of a Nightly build diff --git a/packaging/nightly-release-tests.py b/packaging/nightly-release-tests.py index 2729b40282..ef1003f46e 100755 --- a/packaging/nightly-release-tests.py +++ b/packaging/nightly-release-tests.py @@ -2,10 +2,15 @@ """Local regression checks for VectorCraft nightly workflow and signing-policy contracts.""" import copy from decimal import Decimal +import io import json +import os from pathlib import Path import re +import tempfile +import textwrap import unittest +from unittest import mock ROOT = Path(__file__).resolve().parents[1] INSTALLED_POLICY = ROOT / ".github/nightly-signing-policy.json" @@ -907,5 +912,92 @@ class NightlyDispatchTransport(unittest.TestCase): self.assertIn("repos/storytold/" + APP_NAME + "/actions/workflows/nightly-sign.yml/dispatches", self.source) self.assertNotIn("'ref': 'release'", self.source) + +SONAR_SOURCE = "c" * 40 + + +def dispatch_script(): + """The dispatch job's inline Python, as the runner's `shell: python` step receives it.""" + source = (ROOT / ".github/workflows/nightly-dispatch.yml").read_text() + block = source.split(" run: |\n", 1)[1] + return textwrap.dedent(block) + + +class FakeGitHub: + """Answers the dispatch script's API reads from scripted poll results and records every request.""" + + def __init__(self, polls, run=None): + self.polls = list(polls) + self.run = run + self.requests = [] + self.now = 0.0 + + def open(self, request, timeout): + self.requests.append((request.get_method(), request.full_url)) + if request.get_method() == "POST": + payload = b"" + status = 204 + elif "/check-runs?" in request.full_url: + done = self.polls.pop(0) if self.polls else False + rows = [{"head_sha": SONAR_SOURCE, "status": "completed" if done else "in_progress"}] + payload, status = json.dumps({"check_runs": rows}).encode(), 200 + else: + runs = [self.run] if self.run else [] + payload, status = json.dumps({"workflow_runs": runs}).encode(), 200 + response = io.BytesIO(payload) + response.status = status + return response + + def sleep(self, seconds): + self.now += seconds + + +def run_dispatch(github): + producer = {"head_repository": {"full_name": "storytold/vectorcraft"}, "path": ".github/workflows/nightly.yml", + "head_branch": "main", "status": "completed", "conclusion": "success", "event": "schedule", + "id": 7, "run_attempt": 1, "head_sha": SONAR_SOURCE} + event = {"action": "completed", "repository": {"full_name": "storytold/vectorcraft"}, "workflow_run": producer} + with tempfile.TemporaryDirectory() as folder: + path = Path(folder) / "event.json" + path.write_text(json.dumps(event)) + env = {"GITHUB_REPOSITORY": "storytold/vectorcraft", "GITHUB_EVENT_NAME": "workflow_run", + "GITHUB_EVENT_PATH": str(path), "GH_TOKEN": "token"} + with mock.patch.dict(os.environ, env), \ + mock.patch("urllib.request.build_opener", return_value=github), \ + mock.patch("time.monotonic", side_effect=lambda: github.now), \ + mock.patch("time.sleep", side_effect=github.sleep), \ + mock.patch("builtins.print"): + exec(compile(dispatch_script(), "nightly-dispatch.yml", "exec"), {}) + + +class NightlyDispatchWaitsForSonar(unittest.TestCase): + """The signer is dispatched only after the producer commit's SonarCloud check completes.""" + + def posts(self, github): + return [url for method, url in github.requests if method == "POST"] + + def test_dispatch_waits_for_the_completed_check_of_the_producer_commit(self): + github = FakeGitHub([False, False, True]) + run_dispatch(github) + checks = [url for method, url in github.requests if "/check-runs?" in url] + self.assertEqual(len(checks), 3) + self.assertTrue(all("/commits/" + SONAR_SOURCE + "/" in url and "app_id=12526" in url for url in checks)) + self.assertEqual(len(self.posts(github)), 1) + self.assertEqual(github.requests[-1][0], "POST", "the dispatch comes after the last check read") + + def test_a_sonar_run_that_ended_without_a_check_stops_the_dispatch(self): + github = FakeGitHub([], run={"id": 9, "status": "completed", "conclusion": "failure"}) + with self.assertRaisesRegex(RuntimeError, "ended without an analysis check"): + run_dispatch(github) + self.assertEqual(self.posts(github), []) + self.assertLessEqual(github.now, 21 * 60, "a finished run does not wait for the whole deadline") + + def test_no_analysis_by_the_deadline_stops_the_dispatch(self): + github = FakeGitHub([]) + with self.assertRaisesRegex(RuntimeError, "in time"): + run_dispatch(github) + self.assertEqual(self.posts(github), []) + + if __name__ == "__main__": unittest.main(verbosity=2) From a1e9779fba1212894cd9b518bd026aac1a33c91c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 07:59:53 -0800 Subject: [PATCH 16/41] Save: a file comparison waits for a drag in another document and wakes after a dialog closes A save whose file comparison answered made its document active even while a drag went on in the active document, and the switch canceled the drag. The save now waits until the drag ends (no interaction and no held press in the active document), as it already waited for another document's dialog or file picker. A save that waited for a dialog went on only at the next input after the dialog closed, because the dialogs close in the UI pass, after the save pump has run. The pass that closes the dialog, or ends the drag, now asks for one more frame, and no frames are asked for while the save waits. --- crates/ui-egui/src/app.rs | 1 + crates/ui-egui/src/io/save.rs | 40 ++++++++++++++---- crates/ui-egui/src/tests/save.rs | 71 ++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index b769dac802..f2ca6fae4d 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -777,6 +777,7 @@ impl VectorcraftApp { self.handle_input(&ctx); self.ui_frame(ui); self.window_keys(&ctx); + io::save::after_ui(self, &ctx); // What the canvas, a panel, a dialog or a window key changed in this pass reaches // the plug-ins that react to it now, since an idle app draws no further frame; a // line a handler wrote shows in the next one. The handlers' time counts toward the diff --git a/crates/ui-egui/src/io/save.rs b/crates/ui-egui/src/io/save.rs index 1fb7d89d3a..f373ed900b 100644 --- a/crates/ui-egui/src/io/save.rs +++ b/crates/ui-egui/src/io/save.rs @@ -71,6 +71,10 @@ pub(crate) struct Saves { /// The saves waiting for a comparison of their document's file with those bytes. #[cfg(not(target_arch = "wasm32"))] checks: HashMap, + /// A comparison's save waited in the last pass for a dialog, a file picker or a gesture in + /// another document: [`after_ui`] asks for a frame once it no longer has to. + #[cfg(not(target_arch = "wasm32"))] + held: bool, /// The files written beside each document's file, which its next save replaces. pub(crate) written_beside: HashMap>, /// The files the OK of the replace question allows the save it runs again to replace. @@ -89,6 +93,8 @@ impl Saves { contents: super::saved_contents::SavedContents::new(), #[cfg(not(target_arch = "wasm32"))] checks: HashMap::new(), + #[cfg(not(target_arch = "wasm32"))] + held: false, watch: FileWatch::new(wake), written_beside: HashMap::new(), replace_files_ok: Vec::new(), @@ -158,17 +164,34 @@ impl Saves { /// Whether file comparisons need another frame to collect their answers. #[cfg(not(target_arch = "wasm32"))] pub(crate) fn checks_pending(app: &VectorcraftApp) -> bool { - // A save waiting for a dialog goes on in the frame that closes the dialog. - app.saves.checks.keys().any(|uid| !under_dialog(app, *uid)) + // A save waiting for a dialog or a gesture goes on in the frame after the one that ends it ([`after_ui`]). + app.saves.checks.keys().any(|uid| !held(app, *uid)) } -/// Whether a dialog or file picker of a document other than `uid` is open: writing document -/// `uid`'s save would activate it under the dialog. +/// Whether document `uid`'s save has to wait: writing it activates its document, which would +/// put it under an open dialog or file picker of another document, or cancel a drag in progress +/// in the active one. #[cfg(not(target_arch = "wasm32"))] -fn under_dialog(app: &VectorcraftApp, uid: u64) -> bool { - app.session.active().map(|d| d.uid) != Some(uid) && (app.any_dialog_open() || app.file_dialog_open()) +fn held(app: &VectorcraftApp, uid: u64) -> bool { + let active = app.session.active(); + active.map(|d| d.uid) != Some(uid) + && (app.any_dialog_open() || app.file_dialog_open() || active.is_some_and(|d| d.interaction.is_some()) || app.canvas.grab.is_some()) } +/// Asks for one frame when a save waited in the last pass and this pass's UI closed what it +/// waited for: the dialog pumps and the canvas run after [`pump`], so nothing else would. +#[cfg(not(target_arch = "wasm32"))] +pub(crate) fn after_ui(app: &mut VectorcraftApp, ctx: &egui::Context) { + if app.saves.held && app.saves.checks.keys().any(|uid| !held(app, *uid)) { + app.saves.held = false; + ctx.request_repaint(); + } +} + +/// The web has no saves that wait. +#[cfg(target_arch = "wasm32")] +pub(crate) fn after_ui(_: &mut VectorcraftApp, _: &egui::Context) {} + /// The web has no file comparisons to collect. #[cfg(target_arch = "wasm32")] pub(crate) fn checks_pending(_: &VectorcraftApp) -> bool { @@ -258,8 +281,9 @@ fn resume_checked(app: &mut VectorcraftApp, wait: bool) { continue; }; // Writing activates the save's document: while a dialog or file picker of another document - // is open, the answer stays in its channel for a later pass. - if !wait && under_dialog(app, uid) { + // is open, or a drag goes on in it, the answer stays in its channel for a later pass. + if !wait && held(app, uid) { + app.saves.held = true; continue; } let (scope, automated) = app.saves.done.get(&uid).map_or_else(|| (ScopeHandle::capture(), app.automation_asked()), |d| d.asked.clone()); diff --git a/crates/ui-egui/src/tests/save.rs b/crates/ui-egui/src/tests/save.rs index d6c1d0b34d..912626e647 100644 --- a/crates/ui-egui/src/tests/save.rs +++ b/crates/ui-egui/src/tests/save.rs @@ -725,3 +725,74 @@ fn a_comparison_waits_while_a_dialog_is_open_over_another_document() { assert!(unwritten, "nothing is written while the dialog is open"); assert!(written, "the save finishes once the dialog closes"); } + +/// A context whose first frames have run, so it asks for no more frames of its own. +fn settled() -> egui::Context { + let ctx = egui::Context::default(); + for _ in 0..10 { + if !ctx.has_requested_repaint() { + break; + } + ctx.run_ui(egui::RawInput::default(), |_| {}).textures_delta.clear(); + } + assert!(!ctx.has_requested_repaint(), "the context settled"); + ctx +} + +/// A save that waited for a dialog asks for a frame in the pass whose UI closes the dialog, since +/// its pump ran earlier in that pass and an idle app draws no other frame. +#[test] +fn a_comparison_held_by_a_dialog_asks_for_a_frame_once_the_dialog_closes() { + let (d, _path, mut app) = opened_then_put_back("compare-wake", true); + assert_eq!(app.run("file.save", json!({})).unwrap()["pending"], "checkingFile"); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + let prompt = craft::ui::dialog::StandardPrompt::changed_on_disk("other"); + app.dialogs().unwrap().with(|h| h.open(prompt)); + io::save::wait_for_answers(&mut app); + io::save::pump(&mut app, &egui::Context::default()); + let open = settled(); + io::save::after_ui(&mut app, &open); + let while_open = open.has_requested_repaint(); + // The dialog's own pump, which runs after the save's, takes its answer. + let id = open_dialogs(&app).pop().map(|d| d.id).expect("a dialog is open"); + let window = app.ui_ctx.clone().expect("a window context"); + app.dialogs().unwrap().with(|h| { + assert!(h.cancel_by_id(&window, id)); + let _ = h.take_by_id::(id); + }); + let closed = settled(); + io::save::after_ui(&mut app, &closed); + let after_close = closed.has_requested_repaint(); + io::save::wait_for_checks(&mut app); + crate::background::wait_all(&mut app); + let _ = std::fs::remove_dir_all(d); + assert!(!while_open, "no frame is asked for while the dialog is open"); + assert!(after_close, "a frame is asked for once the dialog has closed"); +} + +/// A comparison that answers while a drag goes on in another document waits for the drag to end, +/// so making the save's document active does not cancel the drag. +#[test] +fn a_comparison_waits_while_a_drag_goes_on_in_another_document() { + let (d, path, mut app) = opened_then_put_back("compare-under-drag", true); + let before = std::fs::read(&path).unwrap(); + assert_eq!(app.run("file.save", json!({})).unwrap()["pending"], "checkingFile"); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + app.begin_interaction("drag").unwrap(); + io::save::wait_for_answers(&mut app); + let ctx = egui::Context::default(); + io::save::pump(&mut app, &ctx); + let active = app.session.active_index(); + let dragging = app.session.active().is_some_and(|d| d.interaction.is_some()); + let unwritten = std::fs::read(&path).unwrap() == before; + // Once the drag ends, the save goes on and writes the file. + app.session.commit_interaction().unwrap(); + io::save::pump(&mut app, &ctx); + crate::background::wait_all(&mut app); + let written = std::fs::read(&path).unwrap() != before; + let _ = std::fs::remove_dir_all(d); + assert_eq!(active, Some(1), "the document with the drag stays active"); + assert!(dragging, "the drag is not canceled"); + assert!(unwritten, "nothing is written while the drag goes on"); + assert!(written, "the save finishes once the drag ends"); +} From d4e73489ef13f27aff14cfd7f39e171d3006fd0e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 5 Dec 2026 09:07:54 -0800 Subject: [PATCH 17/41] Dependencies: craft-libs pin to main, with the opacity and edit-target workarounds removed Every craft-libs rev moves from 4f3e34d0dd, the head of craft-libs#5489, to craft-libs main. The egui and winit revs are the ones that craft-libs rev pins, unchanged. - Opacity fields (Control bar, Color Wheel, Gradient) show the stored fraction times 100 again. craft-libs#5466 makes the number field step on from a value such as 50.999999 %, so panels::shown_percent is removed. - The Blend Options Ramp and Shift sliders, the Image Trace rows and the Divider field use SliderField::edit_target (craft-libs#5024) in place of the id-salt workarounds. A value typed for one object and not yet committed is still dropped when another is selected. - CDR import: craft-libs now reads bitmaps as their own object kind. They are not placed; the warnings name them with the other objects not read, and a PowerClip frame that clips only a bitmap is named as a frame that opened empty. --- Cargo.lock | 182 +++++++++--------- Cargo.toml | 82 ++++---- apps/vectorcraft-web/Cargo.toml | 2 +- crates/engine/src/cmd/fileio/cdr.rs | 6 +- crates/engine/src/cmd/fileio/cdr/shapes.rs | 4 + crates/engine/src/cmd/fileio/tests_cdr.rs | 39 +++- crates/ui-egui/src/chrome/control_bar.rs | 2 +- crates/ui-egui/src/panels.rs | 9 - crates/ui-egui/src/panels/blend.rs | 84 +------- crates/ui-egui/src/panels/color_wheel.rs | 2 +- crates/ui-egui/src/panels/gradient.rs | 2 +- crates/ui-egui/src/panels/image_trace.rs | 5 +- crates/ui-egui/src/panels/image_trace/rows.rs | 4 +- xtask/src/pdf_deps.rs | 2 +- 14 files changed, 187 insertions(+), 238 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bb23758ef6..522005f52c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1256,7 +1256,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-automation", "craft-behavior", @@ -1298,7 +1298,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "crc32fast", "flate2", @@ -1319,7 +1319,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1331,7 +1331,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "rustix 1.1.6", ] @@ -1339,7 +1339,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1383,7 +1383,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-docpath", @@ -1401,7 +1401,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "crc32fast", "flate2", @@ -1410,7 +1410,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "egui", ] @@ -1418,7 +1418,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "md-5", "rayon", @@ -1427,12 +1427,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-cms", @@ -1452,7 +1452,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-ai-agents", "craft-atomic", @@ -1468,7 +1468,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1478,7 +1478,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "rayon", ] @@ -1486,7 +1486,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1512,7 +1512,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "blake3", "craft-ecproj-format", @@ -1528,7 +1528,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "serde", ] @@ -1536,7 +1536,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1555,7 +1555,7 @@ dependencies = [ [[package]] name = "craft-dwg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "acadrust", "craft-dxf", @@ -1565,7 +1565,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-codepage", "encoding_rs", @@ -1577,7 +1577,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "serde", "serde_json", @@ -1587,12 +1587,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" [[package]] name = "craft-flags" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-atomic", "dirs", @@ -1602,7 +1602,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1617,7 +1617,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1636,7 +1636,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1645,7 +1645,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "cap-primitives", "craft-atomic", @@ -1668,12 +1668,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "gif", ] @@ -1681,7 +1681,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "flate2", ] @@ -1689,7 +1689,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1702,7 +1702,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1732,7 +1732,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-dds", "craft-jpeg", @@ -1759,7 +1759,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1777,7 +1777,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "thiserror 2.0.21", ] @@ -1785,7 +1785,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1796,7 +1796,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-host", "craft-i18n", @@ -1811,7 +1811,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-i18n", @@ -1825,7 +1825,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-host", @@ -1843,7 +1843,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1855,7 +1855,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "encoding_rs", "image", @@ -1866,7 +1866,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "chrono", "craft-codepage", @@ -1876,7 +1876,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "uds_windows", "winsafe", @@ -1885,7 +1885,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-keymap", @@ -1901,7 +1901,7 @@ dependencies = [ [[package]] name = "craft-pbr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-texture", "thiserror 2.0.21", @@ -1910,7 +1910,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "flate2", "serde", @@ -1921,7 +1921,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1933,7 +1933,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "async-channel", "async-io", @@ -1966,7 +1966,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1975,7 +1975,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-host", @@ -1999,7 +1999,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -2010,7 +2010,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-eps", "flate2", @@ -2024,7 +2024,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "encoding_rs", "flate2", @@ -2035,7 +2035,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "dispatch2", "egui", @@ -2048,7 +2048,7 @@ dependencies = [ [[package]] name = "craft-raster3d" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "rayon", "thiserror 2.0.21", @@ -2057,7 +2057,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -2076,7 +2076,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-atomic", "craft-host", @@ -2093,7 +2093,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "fax", "hayro-ccitt", @@ -2104,7 +2104,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2125,7 +2125,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-keymap", @@ -2137,7 +2137,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2162,7 +2162,7 @@ dependencies = [ [[package]] name = "craft-texture" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "thiserror 2.0.21", ] @@ -2170,7 +2170,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2185,7 +2185,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-atomic", "craft-behavior", @@ -2200,7 +2200,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "serde", "thiserror 2.0.21", @@ -2210,7 +2210,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "serde", "thiserror 2.0.21", @@ -2219,7 +2219,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-keymap", @@ -2234,12 +2234,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2253,7 +2253,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2270,7 +2270,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "accesskit", "craft-behavior", @@ -2308,7 +2308,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2319,7 +2319,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-host", @@ -2337,7 +2337,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-host", @@ -2358,7 +2358,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-host", @@ -2379,7 +2379,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-behavior", "craft-host", @@ -2398,7 +2398,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "base64 0.22.1", "chrono", @@ -2430,7 +2430,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "flate2", "serde", @@ -2441,7 +2441,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2451,7 +2451,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "js-sys", "serde_json", @@ -2462,7 +2462,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "winsafe", ] @@ -2470,7 +2470,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "craft-appkit", "craft-atomic", @@ -2502,7 +2502,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3862,7 +3862,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3871,7 +3871,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3889,7 +3889,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3907,12 +3907,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "flate2", "hayro-ccitt", @@ -4895,7 +4895,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "base64 0.22.1", "bumpalo", @@ -5052,7 +5052,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da#4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" +source = "git+https://github.com/storytold/craft-libs?rev=2cab29095590d3681f131e35aab2498e6cd9a0cc#2cab29095590d3681f131e35aab2498e6cd9a0cc" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 73e26d5375..f6b9cc431c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,57 +10,57 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # DWG to DXF bytes, in a child process on desktop builds (acadrust 0.6.6, MPL-2.0, unmodified). -craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # The CPU rasterizer that draws a 3D effect's Render Settings › Rendered image: depth-buffered triangles, shadow maps. -craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -200,13 +200,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc" } # skrifa 0.44 (epaint, glifo, usvg) with the automatic hinter's long blue-zone exit (craft-libs vendor/skrifa). # It stays at this rev until craft-libs#5222 merges. skrifa = { git = "https://github.com/storytold/craft-libs", rev = "37d0532f42eb3421769c8a454e3e25a20fbcff97" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 62605759eb..45c7aad7ed 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 = "4f3e34d0dda2a6862f5ba5fc4cfe3e323602a2da", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "2cab29095590d3681f131e35aab2498e6cd9a0cc", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/engine/src/cmd/fileio/cdr.rs b/crates/engine/src/cmd/fileio/cdr.rs index 04aef3563a..3633d06553 100644 --- a/crates/engine/src/cmd/fileio/cdr.rs +++ b/crates/engine/src/cmd/fileio/cdr.rs @@ -112,7 +112,9 @@ pub(super) fn import(bytes: &[u8]) -> Result<(Document, Vec)> { why => err(format!("this CDR drawing can't be read ({why})")), })?; let (doc, mut warnings) = build(&d, note, PAGES_CUT); - if d.version >= FRAMES_FROM && d.warnings.iter().any(|w| matches!(w, Warning::UnsupportedObjects | Warning::TooDeep)) { + // Objects the reader or the mapping left out (bitmaps are read but not placed), or content past the reader's limits. + let left_out = warnings.iter().any(|w| w == UNSUPPORTED_OBJECTS) || d.warnings.contains(&Warning::TooDeep); + if d.version >= FRAMES_FROM && left_out { warnings.push(EMPTY_FRAMES.to_string()); } Ok((doc, warnings)) @@ -423,6 +425,8 @@ fn copy_cost(objects: &[cd::Object]) -> usize { match o { cd::Object::Group { objects: kids, .. } => stack.extend(kids), cd::Object::Shape(s) => n = n.saturating_add(shape_cost(s)), + // A bitmap is not placed, so it takes nothing past the object itself. + cd::Object::Image(_) => {} cd::Object::Clip { container, objects } => { // A container whose outline is behind its fill is built twice, as that outline // and as the clipping path, inside a group of their own. diff --git a/crates/engine/src/cmd/fileio/cdr/shapes.rs b/crates/engine/src/cmd/fileio/cdr/shapes.rs index 320fda877c..127f97d87c 100644 --- a/crates/engine/src/cmd/fileio/cdr/shapes.rs +++ b/crates/engine/src/cmd/fileio/cdr/shapes.rs @@ -74,6 +74,8 @@ impl Builder { self.learn_spot(c); } } + // Bitmaps are not placed, so their colors add no swatch. + cd::Object::Image(_) => {} cd::Object::Group { objects: kids, .. } => stack.extend(kids), cd::Object::Clip { container, objects } => { for c in container.fill.iter().chain(container.outline.iter().map(|o| &o.color)) { @@ -123,6 +125,8 @@ impl Builder { for o in objects.iter().rev() { match o { cd::Object::Shape(s) => out.extend(self.shape(s, to_doc, false).map(|n| with_flags(n, s.flags))), + // Bitmaps are left out, and the warnings name them with the other objects not read. + cd::Object::Image(_) => self.note(Warning::UnsupportedObjects), cd::Object::Group { objects: kids, flags } => { let children = self.objects_at(kids, to_doc, depth + 1); if !children.is_empty() { diff --git a/crates/engine/src/cmd/fileio/tests_cdr.rs b/crates/engine/src/cmd/fileio/tests_cdr.rs index 2e4d82822b..4728c56065 100644 --- a/crates/engine/src/cmd/fileio/tests_cdr.rs +++ b/crates/engine/src/cmd/fileio/tests_cdr.rs @@ -537,7 +537,7 @@ fn containers_open_as_clipping_groups() { assert!(children[1..].iter().all(|n| matches!(n.kind, NodeKind::Path { clipping: false, .. }))); } -/// A container whose clipped group holds only objects the reader leaves out (a bitmap here), or +/// A container whose clipped group holds only objects the reader leaves out (text here), or /// whose group holds a container of that same group, opens as a plain shape, and the warnings /// say that such frames opened empty. #[test] @@ -554,7 +554,7 @@ fn containers_whose_contents_were_left_out_are_named_in_the_warnings() { super::cdr::import(&synth::riff(1100, &[chunk(b"vrsn", 1100u16.to_le_bytes().to_vec()), doc, page])).unwrap() }; let frames = "PowerClip frames whose contents were left out opened empty"; - let (doc, warnings) = open(vec![synth::object(v, 5, &[(30, v.rect(10.0, 10.0, 0.0))], None)]); + let (doc, warnings) = open(vec![synth::object(v, 4, &[(30, v.rect(10.0, 10.0, 0.0))], None)]); let p = paths(&doc); let [frame] = p.as_slice() else { panic!("{p:?}") }; assert!(matches!(frame.kind, NodeKind::Path { clipping: false, .. }), "{:?}", frame.kind); @@ -566,6 +566,41 @@ fn containers_whose_contents_were_left_out_are_named_in_the_warnings() { assert!(warnings.iter().any(|w| w.contains(frames)), "{warnings:?}"); } +/// A bitmap the reader decodes is not placed: the drawing opens without it, and the warnings name +/// the bitmaps left out. A container that clips only a bitmap opens with its clipping path alone, +/// and the warnings say that such frames opened empty. +#[test] +fn bitmaps_are_left_out_and_named_in_the_warnings() { + let v = V(1300); + let gray = synth::Bitmap { model: 5, bpp: 8, width: 3, height: 2, palette: vec![], rows: vec![vec![0; 3], vec![0; 3]] }; + let open = |bitmaps: Vec, objects: Vec| { + let body = vec![ + chunk(b"vrsn", 1300u16.to_le_bytes().to_vec()), + list(b"bmpt", bitmaps), + synth::page(false, vec![synth::layer(v, [0, 0, 0, 0x98], "Art", objects)]), + ]; + super::cdr::import(&synth::riff(1300, &body)).unwrap() + }; + let rect = || synth::object(v, 1, &[(30, v.rect(40.0, 40.0, 0.0))], None); + let frames = "PowerClip frames whose contents were left out opened empty"; + + let (doc, warnings) = open(vec![synth::bmp(v, 1, &gray, None)], vec![synth::bitmap_object(v, 1, (0.0, 2.0), (3.0, 0.0), None), rect()]); + let p = paths(&doc); + let [shape] = p.as_slice() else { panic!("{p:?}") }; + assert!(matches!(shape.kind, NodeKind::Path { clipping: false, .. }), "{:?}", shape.kind); + assert!(warnings.iter().any(|w| w.contains("text, bitmaps")), "{warnings:?}"); + assert!(warnings.iter().any(|w| w.contains(frames)), "{warnings:?}"); + + let clipped = synth::clpt(vec![(0x77, vec![synth::bitmap_object(v, 1, (0.0, 2.0), (3.0, 0.0), None)])]); + let container = synth::object(v, 1, &[(30, v.rect(40.0, 40.0, 0.0)), synth::container(0x77)], None); + let (doc, warnings) = open(vec![synth::bmp(v, 1, &gray, None), clipped], vec![container]); + let p = paths(&doc); + let [frame] = p.as_slice() else { panic!("{p:?}") }; + assert!(matches!(frame.kind, NodeKind::Path { clipping: true, .. }), "{:?}", frame.kind); + assert!(warnings.iter().any(|w| w.contains("text, bitmaps")), "{warnings:?}"); + assert!(warnings.iter().any(|w| w.contains(frames)), "{warnings:?}"); +} + /// An object with a lens or transparency opens opaque, and the warnings say so. #[test] fn lenses_and_transparency_are_named_in_the_warnings() { diff --git a/crates/ui-egui/src/chrome/control_bar.rs b/crates/ui-egui/src/chrome/control_bar.rs index 266726909a..0c02c32828 100644 --- a/crates/ui-egui/src/chrome/control_bar.rs +++ b/crates/ui-egui/src/chrome/control_bar.rs @@ -289,7 +289,7 @@ fn opacity_field(app: &mut VectorcraftApp, ui: &mut Ui, opacity: f32, selected: let target = crate::panels::transparency_target(app); group(ui, rank::OPACITY, |ui| { Field::new(label).side(SideLabel::new().link().scrub(true)).show(ui, |ui, _| { - let number = NumberField::new(label, Bind::given(Some(crate::panels::shown_percent(opacity)))) + let number = NumberField::new(label, Bind::given(Some(f64::from(opacity) * 100.0))) .range(0.0..=100.0) .unit("%") .scrub_by_label() diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index cf129bf26c..689e9a7254 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -1264,15 +1264,6 @@ pub(crate) fn whole_steps(range: std::ops::RangeInclusive) -> ChannelRule { rule } -/// An opacity stored as an f32 fraction (0 to 1), as the percent an Opacity field shows: the whole percent when it -/// stores as the same f32, so that an arrow key steps on from it, and the exact percent otherwise. 51 % stores as -/// 0.51f32, which reads back as 50.999999 %; an Up press from there would step to 51 % again. -pub(crate) fn shown_percent(fraction: f32) -> f64 { - let percent = f64::from(fraction) * 100.0; - let whole = percent.round(); - if (whole / 100.0) as f32 == fraction { whole } else { percent } -} - /// A section of a panel or dialog under its heading in label text: the reference app's section headings are regular /// weight, not bold. pub(crate) fn section<'a>(title: impl Into