diff --git a/Cargo.lock b/Cargo.lock index 1b57f15652..14d5119325 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1134,7 +1134,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-automation", "craft-behavior", @@ -1175,7 +1175,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "crc32fast", "flate2", @@ -1186,7 +1186,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "block2 0.6.2", "objc2-app-kit 0.3.2", @@ -1196,7 +1196,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "rustix 1.1.6", ] @@ -1204,7 +1204,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1229,7 +1229,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1247,7 +1247,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-docpath", @@ -1265,7 +1265,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "crc32fast", "flate2", @@ -1274,7 +1274,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "egui", ] @@ -1282,7 +1282,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "md-5", "rayon", @@ -1291,12 +1291,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-cms", @@ -1316,7 +1316,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "getrandom 0.3.4", "serde", @@ -1326,7 +1326,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "rayon", ] @@ -1334,7 +1334,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "block2 0.6.2", "craft-atomic", @@ -1359,7 +1359,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "serde", ] @@ -1367,7 +1367,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1386,7 +1386,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-codepage", "encoding_rs", @@ -1398,12 +1398,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1418,7 +1418,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1437,7 +1437,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "cap-primitives", "craft-atomic", @@ -1459,12 +1459,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "gif", ] @@ -1472,7 +1472,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "flate2", ] @@ -1480,7 +1480,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1493,7 +1493,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "chrono", "fixed_decimal", @@ -1521,7 +1521,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-dds", "craft-jpeg", @@ -1548,7 +1548,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1566,7 +1566,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "thiserror 2.0.21", ] @@ -1574,7 +1574,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1585,7 +1585,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-host", "craft-i18n", @@ -1600,7 +1600,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-i18n", @@ -1614,7 +1614,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-host", @@ -1632,7 +1632,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1644,7 +1644,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "encoding_rs", "image", @@ -1655,7 +1655,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "chrono", "craft-codepage", @@ -1665,7 +1665,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-keymap", @@ -1681,7 +1681,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1693,7 +1693,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "async-channel", "async-io", @@ -1724,7 +1724,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1733,7 +1733,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-host", @@ -1757,7 +1757,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -1768,7 +1768,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-eps", "flate2", @@ -1782,7 +1782,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "encoding_rs", "flate2", @@ -1793,7 +1793,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "dispatch2", "egui", @@ -1806,7 +1806,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1825,7 +1825,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-atomic", "craft-host", @@ -1842,7 +1842,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "fax", "hayro-ccitt", @@ -1853,7 +1853,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-image-codecs", "craft-xml", @@ -1874,7 +1874,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-keymap", @@ -1886,7 +1886,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-font-manager", @@ -1911,7 +1911,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -1926,7 +1926,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-atomic", "craft-behavior", @@ -1941,7 +1941,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "serde", "thiserror 2.0.21", @@ -1951,7 +1951,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "serde", "thiserror 2.0.21", @@ -1960,7 +1960,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-keymap", @@ -1975,12 +1975,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -1994,7 +1994,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-i18n", @@ -2010,7 +2010,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "accesskit", "craft-behavior", @@ -2048,7 +2048,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2059,7 +2059,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-host", @@ -2077,7 +2077,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-host", @@ -2098,7 +2098,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-host", @@ -2119,7 +2119,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-behavior", "craft-host", @@ -2138,7 +2138,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "chrono", "craft-host", @@ -2167,7 +2167,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "flate2", "serde", @@ -2178,7 +2178,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2188,7 +2188,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "js-sys", "serde_json", @@ -2199,7 +2199,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "winsafe", ] @@ -2207,7 +2207,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "craft-appkit", "craft-atomic", @@ -2239,7 +2239,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3507,7 +3507,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "brotli", "hayro-postscript", @@ -3516,7 +3516,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3534,7 +3534,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3552,12 +3552,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "flate2", "hayro-ccitt", @@ -4488,7 +4488,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "base64 0.22.1", "bumpalo", @@ -4645,7 +4645,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=4bed21baaa41d2b47bef90879c04df521f6f6043#4bed21baaa41d2b47bef90879c04df521f6f6043" +source = "git+https://github.com/storytold/craft-libs?rev=b0d422cf0c23baccdaca314b916458a89c0952e0#b0d422cf0c23baccdaca314b916458a89c0952e0" dependencies = [ "arrayvec", "kurbo 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 15f14067e6..51693818bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,44 +11,44 @@ rust-version = "1.95" repository = "https://github.com/storytold/vectorcraft" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } # 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 = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } # 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 = "4bed21baaa41d2b47bef90879c04df521f6f6043" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } # 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 = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -191,13 +191,13 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "4bed21baaa41d2b47bef90879c04df521f6f6043" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } emath = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } epaint = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } diff --git a/ROADMAP.md b/ROADMAP.md index 12f4bb334f..4d415cc0ba 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~13 points (ready for real work ~62% → ~75%, and reliable `.ai` exchange) and ~170–270 h away -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-15 · **Change:** minor (G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); G5 estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: Raster effects 85% → 88%, gallery thumbnails and in-dialog preview in; headline numbers unchanged; Symbols area ~87% → ~88%: dynamic instance parts take opacity, blend, gradient and pattern on the canvas; G5 docs sync for Overlap and Pattern auto corners; previously minor: Tools stays beside the canvas with left-side panels; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-22 · **Change:** minor (Upcoming: G11 names what is left (#864's unit preference, #885), not the fixed Shape Builder regions and Asset Export borders, with docs/roadmap.md's 6–13 h, and the Essentials row names Shape Builder's remaining depth, #8314; previously: G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); G5 estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: Raster effects 85% → 88%, gallery thumbnails and in-dialog preview in; headline numbers unchanged; Symbols area ~87% → ~88%: dynamic instance parts take opacity, blend, gradient and pattern on the canvas; G5 docs sync for Overlap and Pattern auto corners; previously minor: Tools stays beside the canvas with left-side panels; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) VectorCraft is a clean-room, open-source, pure-Rust reimplementation of the Adobe Illustrator workflow. It runs on macOS, Windows, Linux, FreeBSD and the web (WASM), and agents can drive all of it over MCP, the CLI and a JSON @@ -35,7 +35,7 @@ blocking it ([Alpha gate](docs/roadmap.md#alpha-gate)). |---|---:|---:|---:|---| | **Full Illustrator** (ready for real work; decides the stage) | **~62%** (57–67%) | **~340–560 h** | ~95–160 h | the mainstream work below, plus 3D (50–85 h), raster effects (23–39 h), advanced type (20–28 h), generative AI (30–60 h), localization (50–85 h) and ecosystem | | **Mainstream illustrator** | **~65%** (60–70%) | **~230–380 h** | ~65–110 h | the interaction-fidelity pass (60–90 h), hardening and QA (30–50 h), stability (20–35 h), performance budgets (15–25 h), `.ai` exchange (10–20 h), the remaining depth of the everyday areas | -| **Essentials user** | **~75%** (70–80%) | **~60–105 h** | ~25–45 h | launch and stability on Windows (20–35 h), in-app help and onboarding (8–15 h), basic QA (10–15 h), Shape Builder regions (4–8 h), UI polish | +| **Essentials user** | **~75%** (70–80%) | **~60–105 h** | ~25–45 h | launch and stability on Windows (20–35 h), in-app help and onboarding (8–15 h), basic QA (10–15 h), Shape Builder depth (4–8 h; #937's reproduced case is fixed, unconfirmed on the reporter's file), UI polish | Hours are Opus 5.5 agent wall-clock hours, calibrated from this repo's merged-PR timestamps (e.g. 0.7–1.2 h per Photoshop-style filter, ~0.8 h per medium feature); see [calibration](docs/target-app-parity.md#calibration). @@ -119,7 +119,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap 1. **Interaction-fidelity pass** (G1), tool by tool from [ui-parity.md](docs/ui-parity.md): 60–90 h. 2. **`.ai` files from real users** (G9): layer structure, guides, speed: 10–20 h. 3. **Launch and stability on real machines** (G10): 20–35 h. -4. **Core-tool correctness** (G11: Shape Builder regions, Asset Export borders): 8–15 h. +4. **Core-tool correctness** (G11: the unit preference reverting to points, #864, SVG export units fixed; a Transform effect in a fill's or stroke's own effects, #885; Shape Builder regions and Asset Export borders are fixed): 6–13 h. 5. **Then:** type core and advanced type (G4), the Illustrator 2026 additions (G13), 3D (G3). The Effect Gallery's filter thumbnails and in-dialog preview are in (G2). ## Progress log @@ -251,6 +251,7 @@ The full earlier record of what landed is kept in [docs/roadmap.md](docs/roadmap | Date | Change | Summary | |---|---|---| +| 2026-11-22 | minor | Upcoming: the G11 item names what is left, the unit preference reverting to points (#864; SVG export units are fixed) and a Transform effect in a fill's or stroke's own effects (#885), instead of Shape Builder regions and Asset Export borders, which are fixed (#937, #983 / #1037); its estimate follows docs/roadmap.md and docs/gaps.md, 8–15 → 6–13 h, #8314. The Essentials readiness row's Shape Builder item names what its 4–8 h still covers (checking #937's fix on the reporter's file, still unconfirmed). Headline numbers unchanged. | | 2026-11-15 | minor | Graphic Styles: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); G5 estimate unchanged (3–13 h). | | 2026-11-14 | minor | Tech Circuit adds three original procedural brushes (Circuit Trace, Bus Lines, Terminal Nodes); ten built-in brush libraries. G5 remaining estimate 3–13 h (estimated); parity scores and headline totals unchanged. | | 2026-11-14 | minor | Gujarati (#6613): contributor proofreading completed for all 387 additions, with 11 wording corrections; 4,673 reviewed catalog rows. Status/error messages remain partial; web selection requires a bundled Gujarati face. Scores and estimates unchanged. | diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index ce5110f8ac..6a5d1de9b7 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -27,7 +27,7 @@ log = { 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 = "4bed21baaa41d2b47bef90879c04df521f6f6043", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "b0d422cf0c23baccdaca314b916458a89c0952e0", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/apps/vectorcraft/src/gpu.rs b/apps/vectorcraft/src/gpu.rs index e79f7b522a..200bbf3095 100644 --- a/apps/vectorcraft/src/gpu.rs +++ b/apps/vectorcraft/src/gpu.rs @@ -398,6 +398,31 @@ pub fn adapter_order( order.into_iter().map(|(i, _)| i).collect() } +/// [`adapter_order`] without the adapters a restart left out after they failed (`skip`) and those +/// that crashed an earlier start (`crashed`), and `true` when that left none and the ones that +/// crashed are tried again. A crash record can't stop a start that has no other adapter to try: +/// the record may be from a start ended from outside before its first frame (#9183), which looks +/// the same as a crash in the driver. An adapter in `skip` failed in this run of the app and +/// stays left out. +pub fn order_leaving_out( + candidates: &[Candidate], + power: PowerPreference, + displays: &[DisplayGpu], + compositor: Option<(u32, u32)>, + named: Option<&str>, + skip: &[String], + crashed: &[String], +) -> (Vec, bool) { + let left_out: Vec = skip.iter().chain(crashed).cloned().collect(); + let order = adapter_order(candidates, power, displays, compositor, named, &left_out); + if !order.is_empty() || crashed.is_empty() { + return (order, false); + } + let again = adapter_order(candidates, power, displays, compositor, named, skip); + let retried = !again.is_empty(); + (again, retried) +} + /// wgpu's own ranking for a power preference: the preferred kind of GPU, the other kind, unknown, /// virtual, software. fn power_rank(t: DeviceType, power: PowerPreference) -> u8 { @@ -845,10 +870,9 @@ pub fn selector( ) -> NativeAdapterSelectorMethod { let named = std::env::var(NAME_ENV).ok(); let skip = skipped(); - let left_out: Vec = skip.iter().chain(&crashed).cloned().collect(); Arc::new(move |adapters, surface| { let candidates: Vec = adapters.iter().map(|a| Candidate::new(a, surface)).collect(); - let order = adapter_order(&candidates, power, &displays, compositor, named.as_deref(), &left_out); + let (order, retried) = order_leaving_out(&candidates, power, &displays, compositor, named.as_deref(), &skip, &crashed); let listed: Vec = candidates .iter() .map(|c| { @@ -872,6 +896,9 @@ pub fn selector( }) .collect(); log::info!("graphics adapters: {}", listed.join("; ")); + if retried { + log::warn!("every graphics adapter that can show the window crashed an earlier start: trying them again"); + } let first = order.first().and_then(|&i| adapters.get(i).zip(candidates.get(i))); let Some((adapter, chosen)) = first else { startup.none_left(); diff --git a/apps/vectorcraft/src/gpu/tests.rs b/apps/vectorcraft/src/gpu/tests.rs index f424280b30..fe4a4ddcc5 100644 --- a/apps/vectorcraft/src/gpu/tests.rs +++ b/apps/vectorcraft/src/gpu/tests.rs @@ -827,3 +827,17 @@ fn pci_ids_reject_a_sign_in_the_hex_digits() { assert_eq!(pci_ids("PCI\\VEN_+10DE&DEV_2204"), None); assert_eq!(pci_ids("PCI\\VEN_10DE&DEV_+2204"), None); } + +/// #9183: a Mac lists one adapter. A start ended from outside before its first frame left it +/// recorded as crashed, and the next start left it out and had nothing to draw on. It is tried +/// again when nothing else is left; an adapter a restart left out after it failed stays out, and +/// with another adapter to try, the one that crashed is still left out. +#[test] +fn an_adapter_that_crashed_an_earlier_start_is_tried_again_when_no_other_is_left() { + let mac = [gpu("Apple M6", Backend::Metal, DeviceType::IntegratedGpu)]; + let crashed = vec![mac[0].key.clone()]; + assert_eq!(order_leaving_out(&mac, PowerPreference::LowPower, &[], None, None, &[], &crashed), (vec![0], true)); + assert_eq!(order_leaving_out(&mac, PowerPreference::LowPower, &[], None, None, &crashed, &crashed), (vec![], false)); + let two = [gpu("Apple M6", Backend::Metal, DeviceType::IntegratedGpu), gpu("llvmpipe", Backend::Gl, DeviceType::Cpu)]; + assert_eq!(order_leaving_out(&two, PowerPreference::LowPower, &[], None, None, &[], &crashed), (vec![1], false)); +} diff --git a/crates/doc/src/blend.rs b/crates/doc/src/blend.rs index 0418477194..2770471f70 100644 --- a/crates/doc/src/blend.rs +++ b/crates/doc/src/blend.rs @@ -2192,6 +2192,13 @@ pub fn blend_steps(keys: &[Arc], spec: &BlendSpec) -> Vec { StepCount::default().blend(keys, spec, Rail::new(keys, spec).as_ref()).0 } +/// Most steps the blends in `n` and its subtree make in all when drawn: a step that copies a +/// blend counts that blend's steps again, and each instance of a repeat counts its source's +/// steps again. Objects that are not blend steps count 0. +pub fn blend_steps_made(n: &Node) -> usize { + StepCount::default().node(n, false) +} + /// Does each pair of `keys` blended with `spec` ask for the same number of steps /// ([`blend_step_count`]) when each coordinate it counts from moves by up to `length` points and, /// for Smooth Color, the difference between keys of different colors by up to `color` (0 to 1)? diff --git a/crates/doc/src/units.rs b/crates/doc/src/units.rs index 728c8aa816..f65fa1fd10 100644 --- a/crates/doc/src/units.rs +++ b/crates/doc/src/units.rs @@ -96,6 +96,18 @@ impl Unit { _ => None, } } + /// The SVG length unit an export writes this unit's sizes in: the unit itself when SVG has it, + /// else an SVG unit of the same kind (inches for feet and yards, centimeters for meters, + /// millimeters for Q and Ha). `None` for points and pixels. + pub fn svg_unit(self) -> Option { + match self { + Unit::Millimeters | Unit::Centimeters | Unit::Inches | Unit::Picas => Some(self), + Unit::FeetInches | Unit::Feet | Unit::Yards => Some(Unit::Inches), + Unit::Meters => Some(Unit::Centimeters), + Unit::Q | Unit::Ha => Some(Unit::Millimeters), + Unit::Points | Unit::Pixels => None, + } + } pub const fn label(self) -> &'static str { match self { Unit::Points => "Points", diff --git a/crates/engine/src/cmd/fileio/eps.rs b/crates/engine/src/cmd/fileio/eps.rs index 5067b1c6d5..0ff99200c8 100644 --- a/crates/engine/src/cmd/fileio/eps.rs +++ b/crates/engine/src/cmd/fileio/eps.rs @@ -33,7 +33,7 @@ pub fn specs() -> Vec { "Export EPS", [], None, - "{path?, level?: 2|3 (default; PostScript language level: 3 writes smooth gradients and masks transparent image pixels out, 2 steps gradients and writes those pixels white), previewFormat?: none|tiffBw|tiffColor (default: a TIFF preview other apps show), transparentPreview?: true (else on white), overprints?: preserve (default)|discard, flattenerPreset?: \"medium\" (default; high, low or a saved preset: flattener.presets.list), flattener?: {the options of object.flattenTransparency over the preset}, embedFonts?: true (type is always written as outlines, so no fonts are needed), includeLinkedFiles?: false (the embedded document keeps linked images whole, not just their previews), thumbnails?: true (a PNG thumbnail in the file), cmykPostScript?: true (RGB documents written in CMYK), compatibleGradients?: false (stepped gradients at level 3 too), selectedOnly?: false, useArtboards?: true (one file per chosen artboard, artboards?/range?, {stem}_{artboard}.eps, the bounding box the artboard; with two or more, also the central file {stem}.eps first: the whole document, the bounding box the visible art; none when no art shows) | false (one file, the bounding box the visible art, y up from the first artboard's bottom-left corner, even when artboards are named; the default when none are named), format?: \"eps\", artboard?: i | artboards?: [i…] | range?: \"1-3, 5\" (the artboards written; naming them without useArtboards works as useArtboards: true)} → {path, bytes, warnings, files?}; no path → {dataBase64, …}. Transparency is flattened with the preset (EPS has none); the native document rides along in comments, for reopening the file as it was. Same as document.export {format: eps}. A key EPS doesn't take, and an unknown key inside flattener, are refused", + "{path?, level?: 2|3 (default; PostScript language level: 3 writes smooth gradients and masks transparent image pixels out, 2 steps gradients and writes those pixels white), previewFormat?: none|tiffBw|tiffColor (default: a TIFF preview other apps show), transparentPreview?: true (else on white), overprints?: preserve (default; paper white fills and strokes knock out with document.setup discardWhiteOverprint; white linked to a spot swatch that has a color, at a tint above 0%, still overprints)|discard, flattenerPreset?: \"medium\" (default; high, low or a saved preset: flattener.presets.list), flattener?: {the options of object.flattenTransparency over the preset}, embedFonts?: true (type is always written as outlines, so no fonts are needed), includeLinkedFiles?: false (the embedded document keeps linked images whole, not just their previews), thumbnails?: true (a PNG thumbnail in the file), cmykPostScript?: true (RGB documents written in CMYK), compatibleGradients?: false (stepped gradients at level 3 too), selectedOnly?: false, useArtboards?: true (one file per chosen artboard, artboards?/range?, {stem}_{artboard}.eps, the bounding box the artboard; with two or more, also the central file {stem}.eps first: the whole document, the bounding box the visible art; none when no art shows) | false (one file, the bounding box the visible art, y up from the first artboard's bottom-left corner, even when artboards are named; the default when none are named), format?: \"eps\", artboard?: i | artboards?: [i…] | range?: \"1-3, 5\" (the artboards written; naming them without useArtboards works as useArtboards: true)} → {path, bytes, warnings, files?}; no path → {dataBase64, …}. Transparency is flattened with the preset (EPS has none); the native document rides along in comments, for reopening the file as it was. Same as document.export {format: eps}. A key EPS doesn't take, and an unknown key inside flattener, are refused", has_doc, export_eps )] diff --git a/crates/engine/src/cmd/fileio/tests_eps.rs b/crates/engine/src/cmd/fileio/tests_eps.rs index e37fd2be37..83037b5f9e 100644 --- a/crates/engine/src/cmd/fileio/tests_eps.rs +++ b/crates/engine/src/cmd/fileio/tests_eps.rs @@ -212,11 +212,29 @@ fn flattening_cropped_art_keeps_the_art_under_its_hidden_part() { fn overprints_are_kept_or_discarded() { let mut s = session(100.0, 100.0, 1); let id = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 30, "height": 30})).unwrap()["id"].as_u64().unwrap(); + s.execute("paint.setFill", &json!({"ids": [id], "color": {"c": 100, "m": 0, "y": 0, "k": 0}})).unwrap(); s.execute("attributes.set", &json!({"ids": [id], "overprintFill": true})).unwrap(); let kept = postscript(&b64(&s.execute("document.exportEps", &json!({"previewFormat": "none"})).unwrap())); assert!(kept.contains("true op\n"), "{kept}"); let dropped = postscript(&b64(&s.execute("document.exportEps", &json!({"previewFormat": "none", "overprints": "discard"})).unwrap())); assert!(!dropped.contains("true op")); + + // A white fill or stroke that overprints knocks out with Discard White Overprint (on by + // default), and overprints without it, as in PDF export. + let white = json!({"c": 0, "m": 0, "y": 0, "k": 0}); + let filled = [json!({"ids": [id], "color": white}), json!({"ids": [id], "none": true})]; + let stroked = [json!({"ids": [id], "none": true}), json!({"ids": [id], "color": white})]; + for (i, [fill, stroke]) in [filled, stroked].iter().enumerate() { + s.execute("paint.setFill", fill).unwrap(); + s.execute("paint.setStroke", stroke).unwrap(); + s.execute("attributes.set", &json!({"ids": [id], "overprintFill": i == 0, "overprintStroke": i == 1})).unwrap(); + s.execute("document.setup", &json!({"discardWhiteOverprint": true})).unwrap(); + let knocked_out = postscript(&b64(&s.execute("document.exportEps", &json!({"previewFormat": "none"})).unwrap())); + assert!(!knocked_out.contains("true op"), "{i}: {knocked_out}"); + s.execute("document.setup", &json!({"discardWhiteOverprint": false})).unwrap(); + let overprinted = postscript(&b64(&s.execute("document.exportEps", &json!({"previewFormat": "none"})).unwrap())); + assert!(overprinted.contains("true op\n"), "{i}: {overprinted}"); + } } #[test] diff --git a/crates/engine/src/cmd/layer.rs b/crates/engine/src/cmd/layer.rs index 73c92877e9..1782e60f9c 100644 --- a/crates/engine/src/cmd/layer.rs +++ b/crates/engine/src/cmd/layer.rs @@ -156,7 +156,7 @@ pub fn specs() -> Vec { "Artboard Options…", ["Window", "Artboards"], None, - "{index | artboards: [{index, name?, color?, guideLabel?, locked?, showCenterMark?, showCrossHairs?, showVideoSafeAreas?, videoRulerPixelAspectRatio?, x?, y?, width?, height?}…] (several artboards in one undo step, each with its own fields; the art inside each before any of them changes goes with it, and an object inside several goes with the first listed that moves or scales its art), name?, color?: color (\"#rrggbb\", {c,m,y,k}, … as the paint commands take, #rrggbbaa and #rgba refused: the background color the canvas draws the artboard's paper in, multiplied with the Simulate Colored Paper color while that is on; exports and print leave it out) | null (no background color), guideLabel?: name | \"#rrggbb\" | null (the guide label: the canvas draws the artboard's own guides (guide.add with artboard) in this color instead of the guide color preference, selected ones still in the selection color; a layer color's name spelled exactly as Layer Options lists it (\"Light Blue\", \"Red\", …) or #rrggbb; null for none, which new artboards and older files have; screen-only, so exports and print leave it out; it can change on a locked artboard; an invalid value anywhere in the list changes nothing), locked?: bool (the Artboards panel's lock column: a locked artboard keeps its rectangle (a new x, y, width or height is an error unless locked is false), can't be moved, deleted or cut, and Rearrange and Fit to Artwork Bounds leave it as it is; the art on it (each object of a layer or sublayer whose bounds with strokes overlap it, a group as one object) acts as locked art until it is unlocked: clicks, marquees, select.set, select.all and the tools pass over it (art drawn or pasted onto it stays selected and editable until a selection leaves it out or it is moved off the locked artboards), it is deselected, and when another artboard moves or scales it stays unless lockedAndHidden), showCenterMark?: bool (Artboard Options' Show Center Mark: the canvas draws a mark at the artboard's center), showCrossHairs?: bool (Show Cross Hairs: the canvas draws a line from the middle of each side through the center), showVideoSafeAreas?: bool (Show Video Safe Areas: the canvas draws the action-safe area 3.5% and the title-safe area 5% in from each edge, as EBU R 95 sets them; the three are screen-only, as the artboard's edges are: exports and print leave them out), videoRulerPixelAspectRatio?: number 0.1–10 (Video Ruler Pixel Aspect Ratio: the width of one video pixel over its height, which View › Rulers › Show Video Rulers counts the artboard in; default 1, square pixels), x?, y?, width?, height?, moveArt?: bool (default false; a position-only change moves the contained art with its artboard), scaleArt?: bool (Scale Artwork with Artboard: resized, the artboard takes the art fully inside it (locked and hidden art only with lockedAndHidden?: bool, default prefs moveLockedWithArtboard) and its guides from its old rectangle onto the new one, each side by its own ratio; strokes/corners/patterns as object.scale), strokes?: bool, corners?: bool, patterns?: bool (the three as object.scale, for art that moves or scales with the artboard), lockedAndHidden?: bool (locked and hidden art moves along; default: the preference; recorded in the journal so a replay matches)} → null, or with scaleArt {scaled: the art scaled}; no undo step when nothing changes", + "{index | artboards: [{index, name?, color?, guideLabel?, locked?, showCenterMark?, showCrossHairs?, showVideoSafeAreas?, videoRulerPixelAspectRatio?, x?, y?, width?, height?}…] (several artboards in one undo step, each with its own fields; the art inside each before any of them changes goes with it, and an object inside several goes with the first listed that moves or scales its art), name?, color?: color (\"#rrggbb\", {c,m,y,k}, … as the paint commands take, #rrggbbaa and #rgba refused: the background color the canvas draws the artboard's paper in, multiplied with the Simulate Colored Paper color while that is on. Supported artboard exports and printing include it by default. This includes raster exports with `selectedOnly: true` when the output area is an artboard. Set `includeArtboardFill: false` on the export or print command to omit it. Exports cropped to selection bounds, artwork bounds, or an explicit raster region leave it out, as do formats that do not support artboard fills) | null (no background color), guideLabel?: name | \"#rrggbb\" | null (the guide label: the canvas draws the artboard's own guides (guide.add with artboard) in this color instead of the guide color preference, selected ones still in the selection color; a layer color's name spelled exactly as Layer Options lists it (\"Light Blue\", \"Red\", …) or #rrggbb; null for none, which new artboards and older files have; screen-only, so exports and print leave it out; it can change on a locked artboard; an invalid value anywhere in the list changes nothing), locked?: bool (the Artboards panel's lock column: a locked artboard keeps its rectangle (a new x, y, width or height is an error unless locked is false), can't be moved, deleted or cut, and Rearrange and Fit to Artwork Bounds leave it as it is; the art on it (each object of a layer or sublayer whose bounds with strokes overlap it, a group as one object) acts as locked art until it is unlocked: clicks, marquees, select.set, select.all and the tools pass over it (art drawn or pasted onto it stays selected and editable until a selection leaves it out or it is moved off the locked artboards), it is deselected, and when another artboard moves or scales it stays unless lockedAndHidden), showCenterMark?: bool (Artboard Options' Show Center Mark: the canvas draws a mark at the artboard's center), showCrossHairs?: bool (Show Cross Hairs: the canvas draws a line from the middle of each side through the center), showVideoSafeAreas?: bool (Show Video Safe Areas: the canvas draws the action-safe area 3.5% and the title-safe area 5% in from each edge, as EBU R 95 sets them; the three are screen-only, as the artboard's edges are: exports and print leave them out), videoRulerPixelAspectRatio?: number 0.1–10 (Video Ruler Pixel Aspect Ratio: the width of one video pixel over its height, which View › Rulers › Show Video Rulers counts the artboard in; default 1, square pixels), x?, y?, width?, height?, moveArt?: bool (default false; a position-only change moves the contained art with its artboard), scaleArt?: bool (Scale Artwork with Artboard: resized, the artboard takes the art fully inside it (locked and hidden art only with lockedAndHidden?: bool, default prefs moveLockedWithArtboard) and its guides from its old rectangle onto the new one, each side by its own ratio; strokes/corners/patterns as object.scale), strokes?: bool, corners?: bool, patterns?: bool (the three as object.scale, for art that moves or scales with the artboard), lockedAndHidden?: bool (locked and hidden art moves along; default: the preference; recorded in the journal so a replay matches)} → null, or with scaleArt {scaled: the art scaled}; no undo step when nothing changes", has_doc, artboard_set ), diff --git a/crates/engine/src/script/include.rs b/crates/engine/src/script/include.rs index a024949a35..ae6b41b1a1 100644 --- a/crates/engine/src/script/include.rs +++ b/crates/engine/src/script/include.rs @@ -326,7 +326,7 @@ impl Files { /// The options a file of this run is parsed with, preprocessor lines aside. pub(crate) fn options(&self) -> Options { - Options { max_source_units: MAX_TOTAL_BYTES, es2015: self.es2015, ..Options::default() } + Options { max_source_units: MAX_TOTAL_BYTES, es2015: self.es2015, e4x: true, ..Options::default() } } /// The `JSINCLUDE` folders of this process: absolute folders separated by `;`. diff --git a/crates/engine/src/script/mod.rs b/crates/engine/src/script/mod.rs index 00d0a3a371..fdec594f69 100644 --- a/crates/engine/src/script/mod.rs +++ b/crates/engine/src/script/mod.rs @@ -2009,7 +2009,7 @@ impl Session { // A `.js` script reads ECMAScript 2015; `eval`, `Function`, includes and `$.evalFile` read // code the way the script does. let es2015 = include::es2015_script(request.file.as_deref()); - let options = Options { max_source_units: include::MAX_TOTAL_BYTES.saturating_mul(2), es2015, ..Options::default() }; + let options = Options { max_source_units: include::MAX_TOTAL_BYTES.saturating_mul(2), es2015, e4x: true, ..Options::default() }; let strict = options.strict; // A kept engine reads each run's code the way that run's script does. let mut realm = match realm { diff --git a/crates/engine/src/tests/script_run.rs b/crates/engine/src/tests/script_run.rs index fa0c2e35cc..56bc5854a1 100644 --- a/crates/engine/src/tests/script_run.rs +++ b/crates/engine/src/tests/script_run.rs @@ -391,6 +391,40 @@ fn a_js_script_reads_optional_chains_and_coalescing_and_a_jsx_script_does_not() let _ = std::fs::remove_dir_all(&dir); } +#[test] +fn every_script_reads_e4x_and_has_the_xml_objects() { + let dir = fresh_folder("e4x"); + let write = |name: &str, text: &str| { + let p = dir.join(name); + std::fs::write(&p, text).unwrap(); + p.to_string_lossy().into_owned() + }; + let mut s = two_docs(); + let path = |p: &str| json!({"path": p}); + // Script text: literals, selectors, for each and the four constructors. + let text = "var x = 12;\n\ + vc.log(x.item.length() + ' ' + x.item.(@id == 'b').toString() + ' ' + x..item[0].@id);\n\ + var sum = 0; for each (var i in x.item) sum += Number(i); vc.log(sum);\n\ + vc.log(new XML('').b.length() + new XMLList('').length());\n\ + vc.log(new Namespace('p', 'urn:p').prefix + ' ' + new QName('urn:q', 'n').localName + ' ' + isXMLName('ok'));\n\ + vc.log(typeof setDefaultXMLNamespace + ' ' + (1 < 2));\n"; + let r = run(&mut s, text).unwrap(); + assert_eq!(r["log"], json!(["2 2 a", 3, 3, "p n true", "function true"]), "{r}"); + // A .js file, a file it includes, eval, Function and $.evalFile read XML as well. + write("lib.jsxinc", "var fromLib = .@n.toString();\n"); + write("more.jsx", "{fromLib}.toString();\n"); + let modern = "#include \"lib.jsxinc\"\nlet tag = {fromLib};\nvc.log(tag.toString());\n\ + vc.log(eval('5').toString());\nvc.log(new Function('return 6.toString()')());\n\ + vc.log($.evalFile(File($.fileName).parent + '/more.jsx'));\n"; + let r = s.execute("script.run", &path(&write("modern.js", modern))).unwrap(); + assert_eq!(r["log"], json!(["7", "5", "6", "7"]), "{r}"); + // A named engine first made by a .js run gives a later .jsx run the XML objects too. + s.execute("script.run", &path(&write("first.js", "#targetengine xmlkept\nlet k = 1;"))).unwrap(); + let later = s.execute("script.run", &path(&write("second.jsx", "#targetengine xmlkept\nvc.log(XML('2').toString());"))).unwrap(); + assert_eq!(later["log"], json!(["2"]), "{later}"); + let _ = std::fs::remove_dir_all(&dir); +} + /// A new empty folder for test `name`. fn fresh_folder(name: &str) -> std::path::PathBuf { let dir = std::env::temp_dir().join(format!("vc-script-run-{name}-{}", std::process::id())); diff --git a/crates/engine/src/tooling.rs b/crates/engine/src/tooling.rs index 653ed92752..446d441fc4 100644 --- a/crates/engine/src/tooling.rs +++ b/crates/engine/src/tooling.rs @@ -1463,6 +1463,16 @@ impl Session { } } + /// The object a click of the active tool at `p` with `mods` would act on + /// ([`vectorcraft_tools::Tool::hover_object`]), for Smart Guides › Object Highlighting. None + /// while Cmd lends a selection tool to the press ([`Self::lent_tool_at`]). + pub fn hover_object(&mut self, p: Point, mods: Mods, view: ViewInfo) -> Option { + if mods.cmd && self.lender.is_none() && !self.tool_editing() && self.lent_tool_at(p, &mods, view).is_some() { + return None; + } + self.with_tool_cx(view, |t, cx| t.hover_object(cx, p, mods)) + } + pub fn tool_options(&self) -> Value { self.tool.options() } diff --git a/crates/engine/tests/it/script_host_vs_scriptcheck.rs b/crates/engine/tests/it/script_host_vs_scriptcheck.rs index 60239864d7..2ec927bd48 100644 --- a/crates/engine/tests/it/script_host_vs_scriptcheck.rs +++ b/crates/engine/tests/it/script_host_vs_scriptcheck.rs @@ -2,8 +2,8 @@ //! the tables below, and each name that reaches outside the document has the `outside` id //! `script.check` (`vectorcraft-scriptcheck`) gives it. The names are read from a run: the own //! properties of the global object, of each object or function it holds and of each function's -//! `prototype`, with a setter listed again as `name=`. The names a plain `vectorcraft_js::Realm` also -//! has are the language's, which reach files and other apps only through the host; `eval` and +//! `prototype`, with a setter listed again as `name=`. The names a plain `vectorcraft_js::Realm` with +//! E4X also has are the language's, which reach files and other apps only through the host; `eval` and //! `Function` still have rows, since they run code the checker can't read. A name the host adds //! without a row fails the test. @@ -11,7 +11,7 @@ use std::collections::BTreeSet; use serde_json::json; use vectorcraft_engine::Session; -use vectorcraft_js::{DirectiveName, JsValue, Realm}; +use vectorcraft_js::{DirectiveName, JsValue, Options, Realm}; use vectorcraft_scriptcheck::{Limits, check}; /// The names that reach outside the document: each with a script that uses it and the `outside` id @@ -110,9 +110,9 @@ fn host_names() -> BTreeSet { text.lines().map(str::to_string).collect() } -/// The names a plain JavaScript engine has. +/// The names a plain JavaScript engine with E4X has. fn language_names() -> BTreeSet { - match Realm::new().run(LIST) { + match Realm::with_options(Options { e4x: true, ..Options::default() }, vectorcraft_js::Limits::default()).run(LIST) { Ok(JsValue::String(text)) => text.lines().map(str::to_string).collect(), other => panic!("no list: {other:?}"), } diff --git a/crates/eps/src/print/tests.rs b/crates/eps/src/print/tests.rs index e560f7ab8d..f32bebaa4c 100644 --- a/crates/eps/src/print/tests.rs +++ b/crates/eps/src/print/tests.rs @@ -132,6 +132,15 @@ fn over(under: Option, art: &[Node]) -> Document { /// Ink `ink`'s plate of `d` as the print plan separates it for PostScript, and as a PostScript /// separation at `level` read back, both drawn at 1 px a point. fn plate_of(d: &Document, ink: &str, level: Level) -> (Image, Image) { + let area = Rect::new(0.0, 0.0, 200.0, 100.0); + let (plate, out) = separation(d, ink, level); + let back = crate::import(&out.bytes).unwrap().document; + (render_region(&plate, area, 1.0), render_region(&back, area, 1.0)) +} + +/// Ink `ink`'s plate of `d` as the print plan separates it for PostScript, and that plate written +/// as a PostScript separation at `level`. +fn separation(d: &Document, ink: &str, level: Level) -> (Document, EpsOutput) { let area = Rect::new(0.0, 0.0, 200.0, 100.0); let settings = serde_json::from_value(serde_json::json!({"output": {"mode": "separations"}})).unwrap(); let plan = vectorcraft_pdf::plan(d, &vectorcraft_pdf::PrintOptions { settings, postscript: true, ..Default::default() }).unwrap(); @@ -151,8 +160,7 @@ fn plate_of(d: &Document, ink: &str, level: Level) -> (Image, Image) { }; let out = print(&[page], &[0], &PrintJob { level, ..PrintJob::default() }).unwrap(); assert!(level == Level::Three || !text(&out).contains("shfill"), "Level 2 has no smooth shadings"); - let back = crate::import(&out.bytes).unwrap().document; - (render_region(plate, area, 1.0), render_region(&back, area, 1.0)) + (plate.clone(), out) } /// Ink `ink`'s PostScript plate of `art` over a page of 100% `ink` (`under`), checked against the @@ -234,6 +242,44 @@ fn an_overprinting_gradient_keeps_the_ink_below_where_it_puts_none_on_a_postscri assert_keeps_the_ink_below(&cases); } +/// With Discard White Overprint, a process white fill or stroke marked to overprint knocks out the +/// cyan below it on the Cyan plate and is written without overprinting, as in composite output. +/// Without the setting, and for a white linked to a spot swatch with a color at a tint above 0%, +/// the cyan below it prints. +#[test] +fn white_overprints_knock_out_on_postscript_plates_with_discard_white_overprint() { + let cyan = Paint::solid(Color::cmyk(1.0, 0.0, 0.0, 0.0)); + let white = Paint::solid(Color::cmyk(0.0, 0.0, 0.0, 0.0)); + let spot_white = Paint::Solid { color: Color::cmyk(0.0, 0.0, 0.0, 0.0), swatch: Some("White Ink".into()), tint: 1.0 }; + // The fill is sampled in the rectangle's middle, the stroke on its top edge. + let (fill_at, stroke_at) = ((100, 50), (100, 10)); + let cases = [ + ("process white fill", overprinting(white.clone(), Paint::None), fill_at, true, true), + ("process white stroke", overprinting(Paint::None, white.clone()), stroke_at, true, true), + ("process white fill without the setting", overprinting(white.clone(), Paint::None), fill_at, false, false), + ("process white stroke without the setting", overprinting(Paint::None, white), stroke_at, false, false), + ("spot white fill", overprinting(spot_white.clone(), Paint::None), fill_at, true, false), + ("spot white stroke", overprinting(Paint::None, spot_white), stroke_at, true, false), + ]; + let mut failed = vec![]; + for (name, art, (x, y), discard, knocks_out) in cases { + let mut d = over(Some(cyan.clone()), &[art]); + d.swatches.push(Swatch { name: "White Ink".into(), paint: Paint::solid(Color::cmyk(0.0, 0.0, 0.0, 0.0)), global: true, spot: true }); + d.setup.discard_white_overprint = discard; + for level in [Level::Three, Level::Two] { + let (_, printed) = plate_of(&d, "Cyan", level); + let paper = printed.over_white(x, y)[0] >= 254; + if paper != knocks_out { + failed.push(format!("{name} at level {level:?}: knocked out {paper}, expected {knocks_out}")); + } + if text(&separation(&d, "Cyan", level).1).contains("true op") { + failed.push(format!("{name} at level {level:?}: overprints on the plate")); + } + } + } + assert!(failed.is_empty(), "{failed:#?}"); +} + #[test] fn an_overprinting_gradient_with_a_hard_stop_at_an_end_keeps_the_ink_below_on_a_postscript_plate() { // Two stops at an end, one with cyan and one without: Level 2's bands pad with the end stop, diff --git a/crates/eps/src/scene.rs b/crates/eps/src/scene.rs index 1193839d0b..8452decdf6 100644 --- a/crates/eps/src/scene.rs +++ b/crates/eps/src/scene.rs @@ -298,6 +298,8 @@ pub(crate) struct Scene<'a> { /// The gradient being painted overprints on a plate: where it is paper white it puts none of /// the plate's ink down, and the plate below it is left as it is ([`Self::inked_spans`]). keep_below: bool, + /// Overprinting is on in the page's graphics state ([`Self::overprint_on`]). + overprinting: bool, /// The print job's fonts: type in a solid fill is shown through them (`None`: drawn as /// outlines). fonts: Option<&'a RefCell>, @@ -336,6 +338,7 @@ impl<'a> Scene<'a> { nest: 0, plate: false, keep_below: false, + overprinting: false, fonts: None, used: UsedGlyphs::new(), used_order: vec![], @@ -535,11 +538,30 @@ impl<'a> Scene<'a> { } } - /// Turn overprinting on for one paint (when overprints are preserved); `false` when it stays off. + /// Whether a fill or stroke of `paint` marked to overprint (`overprint`) does: not when it is + /// paper white with Discard White Overprint in Output (Document Setup); a spot white still + /// overprints ([`Self::spot_ink`]). On a plate the colors are already the plate's coverage, and + /// the plate's document has already turned overprinting off for each white the setting knocks + /// out, so white is not checked there. + fn overprints(&self, overprint: bool, paint: &Paint) -> bool { + let discarded = !self.plate && self.doc.setup.discard_white_overprint && vectorcraft_doc::overprint::is_white(paint) && !self.spot_ink(paint); + overprint && !discarded + } + + /// Whether `paint` is a tint above 0% of a spot swatch with a solid color, which the page writes + /// as a Separation ink of its own ([`Self::spot_space`]); a link is judged by the first swatch of + /// its name. + fn spot_ink(&self, paint: &Paint) -> bool { + matches!(paint, Paint::Solid { swatch: Some(name), tint, .. } if *tint > 0.0 && self.doc.swatch(name).is_some_and(|s| s.spot && s.paint.color().is_some())) + } + + /// Turn overprinting on for one paint (when overprints are preserved); `false` when it stays off + /// or is already on (a pattern's tiles inside an overprinting pattern fill). fn overprint_on(&mut self, overprint: bool) -> bool { - let on = overprint && self.o.overprint == Overprint::Preserve; + let on = overprint && self.o.overprint == Overprint::Preserve && !self.overprinting; if on { self.line("true op"); + self.overprinting = true; } on } @@ -547,6 +569,7 @@ impl<'a> Scene<'a> { fn overprint_off(&mut self, on: bool) { if on { self.line("false op"); + self.overprinting = false; } } @@ -611,7 +634,9 @@ impl<'a> Scene<'a> { && vectorcraft_doc::overprint::is_white(p) && vectorcraft_doc::overprint::DiscardWhite::of(self.doc).discards(p); let on = self.overprint_on(n.colorize_overprints() && !discarded); - self.colorized_image(im, blob, p, on); + // Inside an overprinting pattern fill the image overprints with its tiles. + let overprinting = self.overprinting; + self.colorized_image(im, blob, p, overprinting); self.overprint_off(on); } _ => self.image(&im.key, blob, im.width, im.height, im.xf), @@ -729,7 +754,8 @@ impl<'a> Scene<'a> { match item { AppearanceItem::Fill(fl) if fl.visible && !fl.paint.is_none() => { self.note_item(fl.opacity, fl.blend); - self.fill(bp, rule, &fl.paint, bounds, fl.overprint); + let overprint = self.overprints(fl.overprint, &fl.paint); + self.fill(bp, rule, &fl.paint, bounds, overprint); } AppearanceItem::Stroke(st) if st.visible && !st.paint.is_none() && st.width > 0.0 && st.width.is_finite() => { self.stroke(bp, rule, st, bounds); @@ -812,6 +838,7 @@ impl<'a> Scene<'a> { return; } self.note_item(st.opacity, st.blend); + let overprint = self.overprints(st.overprint, &st.paint); let paint_bounds = st.paint_bounds(bounds); let area_paint = match &st.paint { Paint::Pattern { .. } => true, @@ -822,7 +849,7 @@ impl<'a> Scene<'a> { // The area the stroke paints, as Outline Stroke makes it, painted with the pattern's // tiles or the freeform's image. let region = stroke::outline_region(&PathData::from_bezpath(bp), rule, st).to_bezpath(); - self.fill(®ion, FillRule::NonZero, &st.paint, paint_bounds, st.overprint); + self.fill(®ion, FillRule::NonZero, &st.paint, paint_bounds, overprint); return; } let w = stroke::for_writer(bp, st); @@ -847,7 +874,7 @@ impl<'a> Scene<'a> { }; match &w.shape { WrittenShape::Stroke { width } => { - let on = self.overprint_on(st.overprint); + let on = self.overprint_on(overprint); self.line_style(st, *width); match &st.paint { Paint::Solid { color, swatch, tint } => { @@ -861,7 +888,7 @@ impl<'a> Scene<'a> { self.line("q"); push_path(&mut self.body, bp); self.line("strokepath W"); - self.paint_overprinting(st.overprint, p, paint_bounds, w.reach(st, bounds)); + self.paint_overprinting(overprint, p, paint_bounds, w.reach(st, bounds)); self.line("Q"); } } @@ -874,14 +901,14 @@ impl<'a> Scene<'a> { push_path(&mut self.body, &ws.clip); self.body.push_str(clip_op(FillRule::NonZero)); for (shape, paint) in &ws.slices { - self.fill(shape, FillRule::NonZero, paint, shape.bounding_box(), st.overprint); + self.fill(shape, FillRule::NonZero, paint, shape.bounding_box(), overprint); } self.line("Q"); } } WrittenShape::Fill(outlines) => { for o in outlines { - self.fill(o, FillRule::NonZero, &st.paint, paint_bounds, st.overprint); + self.fill(o, FillRule::NonZero, &st.paint, paint_bounds, overprint); } } } @@ -989,12 +1016,13 @@ impl<'a> Scene<'a> { if bp.elements().is_empty() { continue; } + let overprint = self.overprints(run.style.overprint_fill, &run.style.fill); if fonts.is_none() { - self.fill(&bp, FillRule::NonZero, &run.style.fill, layout.bounds, run.style.overprint_fill); + self.fill(&bp, FillRule::NonZero, &run.style.fill, layout.bounds, overprint); } else { - self.show(&shown, &run.style.fill, run.style.overprint_fill); + self.show(&shown, &run.style.fill, overprint); if !art.elements().is_empty() { - self.fill(&art, FillRule::NonZero, &run.style.fill, layout.bounds, run.style.overprint_fill); + self.fill(&art, FillRule::NonZero, &run.style.fill, layout.bounds, overprint); } } if run.style.has_stroke() { @@ -1014,7 +1042,8 @@ impl<'a> Scene<'a> { match item { AppearanceItem::Fill(fl) if fl.visible && !fl.paint.is_none() => { self.note_item(fl.opacity, fl.blend); - self.fill(bp, FillRule::NonZero, &fl.paint, tb, fl.overprint); + let overprint = self.overprints(fl.overprint, &fl.paint); + self.fill(bp, FillRule::NonZero, &fl.paint, tb, overprint); } AppearanceItem::Stroke(st) if st.visible && !st.paint.is_none() && st.width > 0.0 && st.width.is_finite() => { self.stroke(bp, FillRule::NonZero, st, tb); diff --git a/crates/eps/src/tests.rs b/crates/eps/src/tests.rs index f505dbc0ec..3b45578deb 100644 --- a/crates/eps/src/tests.rs +++ b/crates/eps/src/tests.rs @@ -448,6 +448,106 @@ fn spot_colours_are_separations_and_overprints_are_kept_or_dropped() { assert!(!page_of(&d, &EpsOptions { overprint: Overprint::Discard, ..opts(&d) }).contains("true op")); } +/// Whether overprinting is on at each fill a page paints, by its `true op` and `false op` lines. +fn overprint_at_fills(page: &str) -> Vec { + let mut on = false; + let mut fills = vec![]; + for line in page.lines() { + match line { + "true op" => on = true, + "false op" => on = false, + l if l == "f" || l.ends_with(" f") || l.ends_with(" f*") || l == "f*" => fills.push(on), + _ => {} + } + } + fills +} + +#[test] +fn tiles_overprint_with_their_overprinting_pattern() { + // A rectangle filled with an overprinting pattern whose tile is a white square marked to + // overprint and then a cyan one that is not. + let mut d = doc_with(|_| vec![]); + let square = |d: &mut Document, paint: Paint, overprint: bool| { + let mut n = path(d, shapes::rectangle(Rect::new(0.0, 0.0, 10.0, 10.0)), paint, Paint::None, 0.0); + if let Some(AppearanceItem::Fill(f)) = n.appearance.items.first_mut() { + f.overprint = overprint; + } + Arc::new(n) + }; + let tile = vec![square(&mut d, Paint::solid(Color::WHITE), true), square(&mut d, Paint::solid(Color::cmyk(1.0, 0.0, 0.0, 0.0)), false)]; + d.patterns.push(vectorcraft_doc::PatternDef::new("tile", tile)); + let mut n = red_rect(&mut d); + if let Some(AppearanceItem::Fill(f)) = n.appearance.items.first_mut() { + f.paint = Paint::Pattern { pattern: "tile".into(), xf: Affine::IDENTITY }; + f.overprint = true; + } + let layer = d.layers[0].id; + d.insert(Some(layer), 0, n).unwrap(); + // The whole pattern overprints, as in PDF export: the white square's own mark does not turn + // overprinting off for the cyan square after it, and Discard White Overprint applies to the + // pattern fill, not to its tiles. + let fills = overprint_at_fills(&page_of(&d, &opts(&d))); + assert!(!fills.is_empty() && fills.iter().all(|&on| on), "{fills:?}"); + // On a plate too. + let plate = crate::scene::Scene::new(&d, &opts(&d)).on_plate(true).run(); + let fills = overprint_at_fills(&plate.body); + assert!(!fills.is_empty() && fills.iter().all(|&on| on), "{fills:?}"); +} + +/// A white character fill, and a white fill of the type object itself, marked to overprint knock +/// out with Discard White Overprint and overprint without it. +#[test] +fn white_type_fills_knock_out_with_discard_white_overprint() { + use vectorcraft_doc::{CharStyle, FillLayer, TextObject}; + let white = Paint::solid(Color::WHITE); + let char_fill = CharStyle { size: 30.0, fill: white.clone(), overprint_fill: true, ..CharStyle::default() }; + let object_fill = CharStyle { size: 30.0, fill: Paint::None, ..CharStyle::default() }; + for (i, style) in [char_fill, object_fill].into_iter().enumerate() { + let mut d = doc_with(|d| { + let mut n = Node::new(d.alloc_id(), NodeKind::Text(Box::new(TextObject::point(Point::new(20.0, 100.0), "AB", style)))); + if i == 1 { + n.appearance.items = vec![AppearanceItem::Fill(FillLayer { overprint: true, ..FillLayer::new(white.clone()) })]; + } + vec![n] + }); + let fills = overprint_at_fills(&page_of(&d, &opts(&d))); + assert!(!fills.is_empty() && fills.iter().all(|&on| !on), "{i}: {fills:?}"); + d.setup.discard_white_overprint = false; + let fills = overprint_at_fills(&page_of(&d, &opts(&d))); + assert!(!fills.is_empty() && fills.iter().all(|&on| on), "{i}: {fills:?}"); + } +} + +/// Discard White Overprint applies to paper white only: a white fill linked to a spot swatch +/// still overprints, at 100% and 50%; one linked to a global process swatch, at a 0% tint of a +/// spot swatch, or to a spot swatch without a color (written as process) knocks out. +#[test] +fn spot_white_fills_overprint_with_discard_white_overprint() { + let white = Paint::solid(Color::WHITE); + let cases = [ + (true, white.clone(), 1.0, true), + (true, white.clone(), 0.5, true), + (false, white.clone(), 1.0, false), + (true, white.clone(), 0.0, false), + (true, Paint::None, 1.0, false), + ]; + for (spot, swatch, tint, overprints) in cases { + let mut d = doc_with(|_| vec![]); + d.swatches.push(Swatch { name: "White Ink".into(), paint: swatch, global: true, spot }); + let mut n = red_rect(&mut d); + if let Some(AppearanceItem::Fill(f)) = n.appearance.items.first_mut() { + f.paint = Paint::Solid { color: Color::WHITE, swatch: Some("White Ink".into()), tint }; + f.overprint = true; + } + let layer = d.layers[0].id; + d.insert(Some(layer), 0, n).unwrap(); + assert!(d.setup.discard_white_overprint); + let fills = overprint_at_fills(&page_of(&d, &opts(&d))); + assert_eq!(fills, vec![overprints], "spot: {spot}, tint: {tint}, expected to overprint: {overprints}"); + } +} + const GOLD: Color = Color::Cmyk { c: 0.0, m: 0.2, y: 0.8, k: 0.1 }; const LEAF: Color = Color::Cmyk { c: 1.0, m: 0.0, y: 1.0, k: 0.0 }; @@ -1253,6 +1353,27 @@ fn an_overprinting_colorized_image_writes_only_its_process_inks() { assert!(ps.contains("VCdn0 setcolorspace") && ps.contains("/DeviceCMYK setcolorspace"), "{ps}"); } +/// An overprinting colorized image in the tile of an overprinting pattern fill is written in only +/// the process inks it puts down, as it is outside a pattern, so the inks below it stay. +#[test] +fn an_overprinting_colorized_image_in_an_overprinting_pattern_writes_only_its_process_inks() { + let mut d = overprinting_colorized_doc(vec![0, 128, 255], Color::cmyk(1.0, 0.0, 0.0, 0.0), true); + let id = d.layers[0].children().unwrap()[0].id; + let image = d.remove(id).unwrap(); + d.patterns.push(vectorcraft_doc::PatternDef::new("tile", vec![image])); + let mut n = red_rect(&mut d); + if let Some(AppearanceItem::Fill(f)) = n.appearance.items.first_mut() { + f.paint = Paint::Pattern { pattern: "tile".into(), xf: Affine::IDENTITY }; + f.overprint = true; + } + let layer = d.layers[0].id; + d.insert(Some(layer), 0, n).unwrap(); + for level in Level::ALL { + let ps = page_of(&d, &EpsOptions { level, ..opts(&d) }); + assert!(ps.contains("true op") && ps.contains("VCdn0 setcolorspace") && !ps.contains("/DeviceCMYK setcolorspace"), "{level:?}: {ps}"); + } +} + /// On a separation plate, an overprinting colorized image whose color puts none of the plate's ink /// down is drawn as nothing, so the ink below stays; one that knocks out, or whose overprint is /// discarded, is drawn as paper. (The plate's colors come from the separator, which has already diff --git a/crates/js/src/es2015_tests.rs b/crates/js/src/es2015_tests.rs index 77d28df820..c6b237aaca 100644 --- a/crates/js/src/es2015_tests.rs +++ b/crates/js/src/es2015_tests.rs @@ -613,26 +613,32 @@ fn an_array_s_spread_is_checked_against_the_elements_it_reads() { } #[test] -fn an_index_setter_without_a_getter_does_not_delay_the_spread_s_check() { - // A setter does not run when the elements are read, so the array is still checked when - // spread begins, on its own and on its prototype. +fn an_index_setter_without_a_getter_does_not_run_when_the_array_is_spread() { + // The iterator reads the element and the new array defines its own, so a setter on the array + // or on its prototype does not run, and the long array ends at the fuel limit. for setter in ["a", "Array.prototype"] { let mut realm = Realm::with_options(es_options(), Limits { fuel: 10_000, ..Limits::default() }); - let src = format!("var a = []; a.length = 4294967295; Object.defineProperty({setter}, 0, {{ set: function () {{}} }}); [...a]"); + let src = format!( + "var ran = false; var a = []; a.length = 4294967295; Object.defineProperty({setter}, 0, {{ set: function () {{ ran = true; }} }}); [...a]" + ); let long = realm.run(&src); - assert!(is_thrown(&long, "RangeError"), "{setter}: {long:?}"); + assert!(matches!(&long, Err(e) if e.kind == RunErrorKind::Limit(LimitKind::Fuel)), "{setter}: {long:?}"); + realm.set_limits(Limits::default()); + assert_eq!(realm.run("ran"), Ok(JsValue::Bool(false)), "{setter}"); } } #[test] -fn a_prototype_getter_behind_an_own_element_does_not_delay_the_spread_s_check() { - // The array's own element 0 is read instead of the getter on its prototype, so no getter can - // shrink it, and it is checked when spread begins. +fn a_prototype_getter_behind_an_own_element_is_not_read_by_the_spread() { + // The array's own element 0 is read instead of the getter on its prototype, so the getter does + // not shrink it, and the long array ends at the fuel limit. let mut realm = Realm::with_options(es_options(), Limits { fuel: 10_000, ..Limits::default() }); let src = "var a = [7]; Object.defineProperty(Array.prototype, 0, { get: function () { a.length = 1; return 0; } }); \ a.length = 4294967295; [...a]"; let long = realm.run(src); - assert!(is_thrown(&long, "RangeError"), "{long:?}"); + assert!(matches!(&long, Err(e) if e.kind == RunErrorKind::Limit(LimitKind::Fuel)), "{long:?}"); + realm.set_limits(Limits::default()); + assert_eq!(realm.run("a.length"), Ok(JsValue::Number(4294967295.0))); // A getter on the prototype with no own element in front of it is read, and shrinks the array. let shrink = "var a = []; a.length = 4294967295; \ Object.defineProperty(Array.prototype, 0, { get: function () { a.length = 1; return 7; } }); \ @@ -640,20 +646,6 @@ fn a_prototype_getter_behind_an_own_element_does_not_delay_the_spread_s_check() truth(shrink); } -#[test] -fn looking_for_index_getters_takes_fuel_for_each_property() { - // Each attempt to spread the long array looks at every one of its 10,000 elements, so each - // takes at least that much fuel. - let fuel = 10_000_000; - let mut realm = Realm::with_options(es_options(), Limits { fuel, ..Limits::default() }); - let setup = "var a = []; for (var i = 0; i < 10000; i++) a[i] = i; a.length = 4294967295; 0"; - assert_eq!(realm.run(setup), Ok(JsValue::Number(0.0))); - let attempt = "var ok = false; try { [...a]; } catch (e) { ok = e instanceof RangeError; } ok"; - assert_eq!(realm.run(attempt), Ok(JsValue::Bool(true))); - let used = fuel - realm.interp().fuel; - assert!(used >= 10_000, "{used}"); -} - #[test] fn spread_counts_each_index_name_against_the_heap() { // The elements' properties, with their index names and a string's characters, fit in the diff --git a/crates/pdf/src/print/plates.rs b/crates/pdf/src/print/plates.rs index 38e46654cf..f93b7a4d8a 100644 --- a/crates/pdf/src/print/plates.rs +++ b/crates/pdf/src/print/plates.rs @@ -238,8 +238,9 @@ impl<'a> Separator<'a> { /// Overprinting fills and strokes of `a`'s subtree with a Normal blending mode, and /// overprinting character fills and strokes, that put none of ink `plate` down leave its plate - /// as it is: they are drawn as nothing on it (paper white ones that `discard_white` knocks out - /// aside, [`DiscardWhite::discards`]). A writer without blending modes (PostScript) then keeps the ink below them, + /// as it is: they are drawn as nothing on it. Paper white ones that `discard_white` knocks out + /// ([`DiscardWhite::discards`]) stop overprinting instead, and knock out the ink below them on + /// the plate as in composite output. A writer without blending modes (PostScript) then keeps the ink below them, /// where it would draw their Darken as a knockout. One that puts any ink down is drawn, and on /// a PostScript plate its ink replaces the ink below, as a nonzero component of an overprinting /// color replaces the backdrop's with overprint mode 1 (ISO 32000-1, 11.7.4.2). On a @@ -259,6 +260,9 @@ impl<'a> Separator<'a> { } let image = whole && n.extras().colorize.as_deref().is_some_and(|p| self.no_ink(plate, p)); for it in &mut n.appearance.items { + if it.overprint() && discard_white.discards(it.paint()) { + *it.overprint_mut() = false; + } let normal = match it { AppearanceItem::Fill(l) => l.blend == BlendMode::Normal, AppearanceItem::Stroke(l) => l.blend == BlendMode::Normal, @@ -274,6 +278,8 @@ impl<'a> Separator<'a> { } if let NodeKind::Text(t) = &mut n.kind { for r in &mut t.runs { + r.style.overprint_fill &= !discard_white.discards(&r.style.fill); + r.style.overprint_stroke &= !discard_white.discards(&r.style.stroke); if inkless(r.style.overprint_fill, &r.style.fill) { r.style.fill = Paint::None; } else if r.style.overprint_fill { diff --git a/crates/scriptcheck/src/catalog.rs b/crates/scriptcheck/src/catalog.rs index 82fd61084b..dc4249b6a6 100644 --- a/crates/scriptcheck/src/catalog.rs +++ b/crates/scriptcheck/src/catalog.rs @@ -164,7 +164,7 @@ features! { DollarEnv "dollar.env" Files, DollarEvalFile "dollar.evalFile" Files, DynamicCode "dynamicCode" Language, - E4x "e4x" HostOnly, + E4x "e4x" Language, ExternalObject "externalObject" HostOnly, FileDialog "file.dialog" Files, FileExecute "file.execute" Files, @@ -186,6 +186,6 @@ features! { SelectTool "selectTool" HostOnly, Socket "socket" HostOnly, UnitValue "unitValue" Language, - Xml "xml" HostOnly, + Xml "xml" Language, Xmp "xmp" HostOnly, } diff --git a/crates/scriptcheck/src/lib.rs b/crates/scriptcheck/src/lib.rs index 2bd8c60fba..e74d299aaa 100644 --- a/crates/scriptcheck/src/lib.rs +++ b/crates/scriptcheck/src/lib.rs @@ -109,7 +109,8 @@ impl Kind { /// A kind of help a script needs from the app that runs it. #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum Need { - /// The script language's own objects and directives (`$`, `alert`, `UnitValue`, `#target`). + /// The script language's own objects, syntax and directives (`$`, `alert`, `UnitValue`, E4X + /// with the `XML` object, `#target`). Language, /// The reference app's document model (`app.activeDocument…`). Dom, @@ -120,7 +121,7 @@ pub enum Need { /// Dialogs and windows of its own. Dialogs, /// Features only the reference app has (palettes, messages to other apps, network - /// connections, native code, E4X, actions). + /// connections, native code, actions). HostOnly, } diff --git a/crates/scriptcheck/src/tests.rs b/crates/scriptcheck/src/tests.rs index fec22ed62d..45f5d02d02 100644 --- a/crates/scriptcheck/src/tests.rs +++ b/crates/scriptcheck/src/tests.rs @@ -1550,6 +1550,13 @@ fn application_methods_are_features_not_members() { assert_eq!(r.needs, [Need::MenuCommands, Need::HostOnly]); } +#[test] +fn e4x_and_the_xml_object_need_only_the_language() { + let r = report("var x = ;\nvar y = new XML(s);\nfor each (var v in x.b) {}\n"); + assert!(feature(&r, "e4x").is_some() && feature(&r, "xml").is_some()); + assert_eq!(r.needs, [Need::Language]); +} + #[test] fn type_names_compared_or_created_are_listed() { let r = report(concat!( diff --git a/crates/svg/src/export.rs b/crates/svg/src/export.rs index 84b2efa32b..e0f5540b7d 100644 --- a/crates/svg/src/export.rs +++ b/crates/svg/src/export.rs @@ -195,9 +195,9 @@ fn write(doc: &Document, opts: &ExportOptions, native: Option<&[u8]>, id_prefix: root = root.attr("version", "1.2").attr("baseProfile", "tiny"); } if !opts.responsive { - if let Some(suffix) = doc.units.svg_suffix() { - let w_val = physical_num(doc.units.from_pt(rect.width())); - let h_val = physical_num(doc.units.from_pt(rect.height())); + if let Some((unit, suffix)) = doc.units.svg_unit().and_then(|u| Some((u, u.svg_suffix()?))) { + let w_val = physical_num(unit.from_pt(rect.width())); + let h_val = physical_num(unit.from_pt(rect.height())); root = root.attr("width", format_args!("{w_val}{suffix}")).attr("height", format_args!("{h_val}{suffix}")); } else { root = root.attr("width", &ww).attr("height", &hh); diff --git a/crates/svg/tests/it/import_units.rs b/crates/svg/tests/it/import_units.rs index 0140741aeb..91138d8a93 100644 --- a/crates/svg/tests/it/import_units.rs +++ b/crates/svg/tests/it/import_units.rs @@ -192,3 +192,28 @@ fn export_physical_units_writes_unit_suffixes() { let back = import(&s).unwrap(); assert_eq!(back.units, Unit::Millimeters); } + +/// The `width` of `svg`'s root as a length in points, read by the SVG and CSS absolute units +/// (96 px per inch). `None` when it has no unit an SVG reader takes as physical. +fn root_width_in_points(svg: &str) -> Option { + let start = svg.find("().ok().map(|v| v * points_per_unit) +} + +#[test] +fn every_physical_document_unit_exports_its_printed_size() { + // 100 inches by 50: feet, yards, meters, Q and Ha have no SVG unit of their own. + for unit in [Unit::Feet, Unit::FeetInches, Unit::Yards, Unit::Meters, Unit::Q, Unit::Ha, Unit::Inches, Unit::Millimeters] { + let mut d = Document::new(7200.0, 3600.0); + d.units = unit; + let s = export(&d, &ExportOptions::default()); + let width = root_width_in_points(&s).unwrap_or_else(|| panic!("{unit:?}: no physical width in {s}")); + assert!((width - 7200.0).abs() < 0.01, "{unit:?}: {width} pt in {s}"); + let back = import(&s).unwrap(); + assert!(close_rect(back.artboards[0].rect, d.artboards[0].rect), "{unit:?}: {:?}", back.artboards[0].rect); + } +} diff --git a/crates/text/src/fontdb/build.rs b/crates/text/src/fontdb/build.rs index 38f5aece65..b3f6fbbff8 100644 --- a/crates/text/src/fontdb/build.rs +++ b/crates/text/src/fontdb/build.rs @@ -83,6 +83,7 @@ pub(super) fn make_face(bytes: FontBytes, index: u32, spec: FaceStyle, path: Opt unencoded: std::sync::OnceLock::new(), char_list: std::sync::OnceLock::new(), named_chars: std::sync::OnceLock::new(), + glyph_names: std::sync::OnceLock::new(), }) } diff --git a/crates/text/src/fontdb/face.rs b/crates/text/src/fontdb/face.rs index c418d40308..85633460dc 100644 --- a/crates/text/src/fontdb/face.rs +++ b/crates/text/src/fontdb/face.rs @@ -210,6 +210,8 @@ pub struct FontFace { pub(super) char_list: std::sync::OnceLock>, /// [`Self::name_owner`]'s glyph names to characters, read once. pub(super) named_chars: std::sync::OnceLock>, + /// [`Self::glyph_name`]'s names by glyph id, read once. + pub(super) glyph_names: std::sync::OnceLock>>>, } impl vectorcraft_doc::FileFontFace for FontFace { diff --git a/crates/text/src/fontdb/gsub.rs b/crates/text/src/fontdb/gsub.rs index 7529a82929..2fef163351 100644 --- a/crates/text/src/fontdb/gsub.rs +++ b/crates/text/src/fontdb/gsub.rs @@ -589,11 +589,23 @@ impl FontFace { } /// The name of glyph `gid` from the font's `post` or `CFF` table: `None` for a glyph past the - /// face's glyphs, or when the font has no names (the ids are then `gid12`). + /// face's glyphs, or when the font has no names (the ids are then `gid12`). The names are read + /// once for the face, in one pass over the table. pub fn glyph_name(&self, gid: u32) -> Option { - let font = self.skrifa()?; - let name = font.glyph_names().get(skrifa::GlyphId::new(gid))?; - (!name.is_synthesized()).then(|| name.as_str().to_string()) + let names = self.glyph_names.get_or_init(|| { + let Some(font) = self.skrifa() else { return Vec::new() }; + let names = font.glyph_names(); + let mut out = vec![None; names.num_glyphs() as usize]; + for (id, name) in names.iter() { + if let Some(slot) = out.get_mut(id.to_u32() as usize) + && !name.is_synthesized() + { + *slot = Some(Box::from(name.as_str())); + } + } + out + }); + names.get(usize::try_from(gid).ok()?)?.as_deref().map(str::to_string) } /// The kinds of glyph the face's `GSUB` table gives ([`GlyphCategoryKind`]), in the order of @@ -651,6 +663,28 @@ mod tests { assert!(face.glyph_categories().is_empty()); } + /// The names read in one pass are the names the font gives each glyph id, for every bundled + /// face, and a glyph past the face's glyphs has none. + #[test] + fn glyph_names_read_once_match_each_glyphs_own_name() { + let db = super::super::FontDb::with_font_dirs(vec![]); + let mut checked = 0; + for family in db.families() { + for style in db.styles(&family) { + let Some(face) = db.face(&family, &style) else { continue }; + let Some(font) = face.skrifa() else { continue }; + let names = font.glyph_names(); + for gid in 0..face.glyph_count() { + let own = names.get(skrifa::GlyphId::new(gid)).filter(|n| !n.is_synthesized()).map(|n| n.as_str().to_string()); + assert_eq!(face.glyph_name(gid), own, "{family} {style}: glyph {gid}"); + checked += 1; + } + assert_eq!(face.glyph_name(face.glyph_count()), None, "{family} {style}"); + } + } + assert!(checked > 0, "the bundled faces have glyphs"); + } + #[test] fn kinds_round_trip_through_their_ids() { for kind in GlyphCategoryKind::all() { diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs index ca01993a6e..486de86876 100644 --- a/crates/tools/src/lib.rs +++ b/crates/tools/src/lib.rs @@ -267,6 +267,12 @@ pub trait Tool: Send { fn wants_rehover(&self) -> bool { false } + /// The object a click at `p` with `mods` would act on, which Smart Guides › Object + /// Highlighting outlines while the pointer rests there (the Eyedropper's source). None when a + /// click there acts on no object, or the tool does not name one. + fn hover_object(&self, _cx: &ToolContext, _p: Point, _mods: Mods) -> Option { + None + } /// What the Info panel shows for the tool as it is now: the drag in progress (a move of the /// selection, a gradient vector, a handle the Pen pulls out, a Scale, Rotate, Reflect or Shear /// tool drag), or the Paintbrush's brush. None for a tool with nothing of its own to show. diff --git a/crates/tools/src/select.rs b/crates/tools/src/select.rs index ea677ec654..cb02554785 100644 --- a/crates/tools/src/select.rs +++ b/crates/tools/src/select.rs @@ -1675,15 +1675,22 @@ fn object_behind(cx: &ToolContext, p: Point) -> Option { /// member with only some anchors or segments selected does not count: the press selects `top`. /// A member with every anchor selected (as `select.anchors` and `select.key` leave a path) counts. fn selected_under(cx: &ToolContext, h: &Hit, top: NodeId) -> Option { - if cx.selection.contains(top) { + selected_under_in(cx.doc, cx.selection, h, top) +} + +/// [`selected_under`] in `doc` with `selection`: the selected object a Selection tool press on +/// `h` lands on, where `top` is the object the press would select. The canvas's hover outline +/// outlines nothing where this finds an object. +pub fn selected_under_in(doc: &vectorcraft_doc::Document, selection: &vectorcraft_doc::Selection, h: &Hit, top: NodeId) -> Option { + if selection.contains(top) { return Some(top); } let every_anchor = |id: NodeId| { - cx.selection + selection .partial(id) - .is_none_or(|picked| cx.doc.node(id).and_then(|n| n.path_data()).is_some_and(|p| p.anchors().all(|(s, i, _)| picked.contains(&(s, i))))) + .is_none_or(|picked| doc.node(id).and_then(|n| n.path_data()).is_some_and(|p| p.anchors().all(|(s, i, _)| picked.contains(&(s, i))))) }; - let whole = |id: NodeId| cx.selection.contains(id) && every_anchor(id) && !cx.selection.segments.contains_key(&id); + let whole = |id: NodeId| selection.contains(id) && every_anchor(id) && !selection.segments.contains_key(&id); let below = h.ancestry.iter().position(|id| *id == top).map_or(&[][..], |i| h.ancestry.get(i..).unwrap_or_default()); below.iter().copied().chain(std::iter::once(h.leaf)).find(|id| whole(*id)) } diff --git a/crates/tools/src/xform/eyedropper.rs b/crates/tools/src/xform/eyedropper.rs index d45dff84ed..0c63f2f21c 100644 --- a/crates/tools/src/xform/eyedropper.rs +++ b/crates/tools/src/xform/eyedropper.rs @@ -34,6 +34,9 @@ //! Image Trace's Ignore Color eyedropper passes its bound document point to the panel, which //! samples the original image pixels and ends the pick only when a color is accepted. A miss //! stays armed; this tool changes neither paint nor selection. +//! +//! The object a click at the pointer would act on, with the keys held, is the tool's hover object +//! ([`Tool::hover_object`]), which Smart Guides › Object Highlighting outlines. use std::collections::HashSet; @@ -165,6 +168,12 @@ pub(crate) fn sample_source(cx: &ToolContext, p: Point) -> Option<(vectorcraft_d /// The visible color under `p`, including image pixels, pattern tiles, mesh colors, intermediate /// gradient colors, the steps a blend draws and an envelope's distorted contents. pub(crate) fn sample_color_at(cx: &ToolContext, p: Point) -> Option { + sample_at(cx, p).map(|(c, _)| c) +} + +/// [`sample_color_at`] with the object of the document that gives the color: the object hit, the +/// blend or envelope whose art is sampled, or an object below them that was passed over to. +fn sample_at(cx: &ToolContext, p: Point) -> Option<(Color, NodeId)> { let (doc, opts, raster_sample) = (cx.doc, sample_options(cx), cx.raster_sample); vectorcraft_doc::depth::with_deep_stack(|| { let symbol_nodes = doc.symbols.iter().map(|s| s.art.count()).sum(); @@ -175,13 +184,13 @@ pub(crate) fn sample_color_at(cx: &ToolContext, p: Point) -> Option { }) } -/// The color the front-most object of `doc` hit at `p` with `opts` shows there. Where a stroke +/// The color the front-most object of `doc` hit at `p` with `opts` shows there, and that object. Where a stroke /// gives no color at `p` (a gap between its pattern's tiles), the object's own fill there does; /// an object that gives none at all is passed over for the ones below it. A hit on a blend or an /// envelope, or on an object it holds, samples the art it draws ([`live_color_at`]), and where /// that art leaves `p` empty the whole blend or envelope is passed over. `levels` holds the /// scratch documents for art inside art, one for each level deeper. -fn color_under(s: &mut Sampler, doc: &Document, levels: &mut [Option], p: Point, opts: HitOptions) -> Option { +fn color_under(s: &mut Sampler, doc: &Document, levels: &mut [Option], p: Point, opts: HitOptions) -> Option<(Color, NodeId)> { let mut passed: HashSet = HashSet::new(); let mut size = None; loop { @@ -197,7 +206,7 @@ fn color_under(s: &mut Sampler, doc: &Document, levels: &mut [Option], let h = hit_test_visible_skipping(doc, p, opts, &|id| passed.contains(&id))?; if let Some(live) = drawn_live(doc, &h.ancestry) { if let Some(c) = live_color_at(s, levels, live, p) { - return Some(c); + return Some((c, live.id)); } if !passed.insert(live.id) { return None; @@ -208,13 +217,13 @@ fn color_under(s: &mut Sampler, doc: &Document, levels: &mut [Option], let n = doc.node(id)?; let on_stroke = h.kind == HitKind::Stroke; if let Some(c) = node_color_at(s, levels, n, on_stroke, p) { - return Some(c); + return Some((c, id)); } if on_stroke && fill_covers(n, p) && let Some(c) = node_color_at(s, levels, n, false, p) { - return Some(c); + return Some((c, id)); } if !passed.insert(id) { return None; @@ -240,14 +249,28 @@ fn drawn_live<'d>(doc: &'d Document, ancestry: &[NodeId]) -> Option<&'d Node> { /// The color the art blend or envelope `n` draws shows at `p`, sampled as [`art_color_at`] samples /// art: a blend's keys and steps, an envelope's distorted contents, symbol instances in them by /// their symbols' art. Evaluating it counts the objects it holds, and the art made counts its -/// objects. +/// objects. When less work is left than the steps of its blends make in all, the steps that copy +/// a nested blend included ([`vectorcraft_doc::blend::blend_steps_made`]), it is not evaluated. fn live_color_at(s: &mut Sampler, levels: &mut [Option], n: &Node, p: Point) -> Option { + let steps = vectorcraft_doc::blend::blend_steps_made(n); + if s.work < steps { + // Too little work is left for the steps the blends make. + s.spend(steps)?; + } s.spend(n.count())?; + #[cfg(test)] + EXPANSIONS.with(|e| e.set(e.get() + 1)); let art = vectorcraft_effects::expand_live_deep(Some(s.doc), n); s.spend(art.count())?; art_color_at(s, levels, [art], p) } +#[cfg(test)] +thread_local! { + /// The blends and envelopes [`live_color_at`] has evaluated on this thread. + static EXPANSIONS: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + /// The color `n` shows at `p`: an image's pixels, a mesh's interpolated patch color, a symbol /// instance's art, or the color of its fill (or its stroke, when the stroke was hit or there is no /// fill) there. Images, symbols and patterns are looked up in the sampled document. @@ -464,7 +487,7 @@ fn art_color_at(s: &mut Sampler, levels: &mut [Option], art: impl Into scratch.insert(Some(layer), usize::MAX, n).ok()?; } let opts = HitOptions { scope: None, tol: 0.0, outline: false, ..s.opts }; - color_under(s, scratch, deeper, p, opts) + color_under(s, scratch, deeper, p, opts).map(|(c, _)| c) } /// Gives `n` and everything in it new ids from `doc` (pattern instances all have id 0). @@ -524,72 +547,50 @@ impl Tool for EyedropperTool { if ev.kind != PointerKind::Down { return vec![]; } - if let Some(binding) = &self.image_trace_ignore_color { - // The panel knows whether this hits an opaque source pixel. It clears the binding - // and restores the previous tool only after accepting a color, not on a miss. - return vec![Action::Dialog("imageTraceIgnoreColor".into(), json!({ "binding": binding, "point": [ev.pos.x, ev.pos.y] }))]; + let Some(click) = self.click(cx, ev.pos, ev.mods) else { return vec![] }; + match click { + Click::ImageTrace(binding) => { + // The panel knows whether this hits an opaque source pixel. It clears the binding + // and restores the previous tool only after accepting a color, not on a miss. + vec![Action::Dialog("imageTraceIgnoreColor".into(), json!({ "binding": binding, "point": [ev.pos.x, ev.pos.y] }))] + } + Click::BrushKeyColor(c, _) => { + let back = self.stop.take().unwrap_or_else(|| "selection".to_string()); + self.brush_key_color = false; + vec![Action::Dialog("brushKeyColor".into(), json!({ "color": color_json(&c) })), Action::SwitchTool(back)] + } + Click::BackToBucket => { + self.stop = None; + vec![Action::SwitchTool("livePaintBucket".into())] + } + Click::MeshPoints(id, points, color) => { + let params = json!({ "id": id.0, "points": points, "color": color_json(&color), "keepModel": true }); + vec![Action::Exec("object.mesh.setPointColor".into(), params)] + } + Click::CopyFrom(src, how) => { + let params = match how { + Some(how) => json!({ "source": src.0, how: true }), + None => json!({ "source": src.0 }), + }; + vec![Action::Exec("appearance.copyFrom".into(), params)] + } + Click::Sample { color, meshes, stop, .. } => { + let color = color_json(&color); + if !meshes.is_empty() { + let ids: Vec = meshes.iter().map(|id| id.0).collect(); + return vec![Action::Exec("paint.sampleColor".into(), json!({ "color": color, "stroke": false, "ids": ids }))]; + } + let Some((back, i)) = stop else { return vec![Action::Exec("paint.sampleColor".into(), json!({ "color": color }))] }; + self.stop = None; + vec![Action::Exec("paint.sampleColor".into(), json!({ "color": color, "stop": i })), Action::SwitchTool(back)] + } } - let opts = sample_options(cx); - if self.brush_key_color { - let Some(c) = sample_color_at(cx, ev.pos) else { return vec![] }; - let back = self.stop.clone().unwrap_or_else(|| "selection".to_string()); - self.brush_key_color = false; - self.stop = None; - return vec![Action::Dialog("brushKeyColor".into(), json!({ "color": color_json(&c) })), Action::SwitchTool(back)]; - } - // A pick for a stop of the Live Paint Bucket's gradient (the default paint's) ends without - // sampling once that stop is no longer selected (a Cmd-click selected another object) or no - // longer there (another paint was chosen): the click switches back. - let bucket_paint = if cx.fill_active { &cx.paint.fill } else { &cx.paint.stroke }; - let bucket_stop = cx.gradient_stop.filter(|i| matches!(bucket_paint, Paint::Gradient(g) if *i < g.gradient.stops.len())); - if self.stop.as_deref() == Some("livePaintBucket") && bucket_stop.is_none() { - self.stop = None; - return vec![Action::SwitchTool("livePaintBucket".into())]; - } - let stop = self.stop.as_ref().zip(cx.gradient_stop); - // A plain click on a selected gradient mesh gives the fill color to the point there, else - // to the four points of the patch there. - if stop.is_none() - && !ev.mods.alt - && !ev.mods.shift - && let Paint::Solid { color, .. } = &cx.paint.fill - && let Some((id, points)) = selected_mesh_points(cx, ev.pos) - { - let params = json!({ "id": id.0, "points": points, "color": color_json(color), "keepModel": true }); - return vec![Action::Exec("object.mesh.setPointColor".into(), params)]; - } - // Reading a source is independent of its editability. Only Alt's reverse operation - // writes to the clicked object; Shift+Alt appends its appearance to the selection. - let source = if ev.mods.alt && !ev.mods.shift && stop.is_none() { - hit_test(cx.doc, ev.pos, opts).map(|h| (paint_owner(cx.doc, h.leaf), h.kind)) - } else { - sample_source(cx, ev.pos) - }; - let Some((src, _)) = source else { return vec![] }; - let Some(n) = cx.doc.node(src) else { return vec![] }; - if ev.mods.alt && stop.is_none() { - let how = if ev.mods.shift { "append" } else { "reverse" }; - return vec![Action::Exec("appearance.copyFrom".into(), json!({ "source": src.0, how: true }))]; - } - let image = matches!(n.kind, NodeKind::Image(_)); - // Picked mesh points take only a color sampled from other art or an image: the sample goes - // to them as a fill, and to nothing else that is selected. A click on a mesh with picked - // points is handled as before. - let meshes = if stop.is_none() { picked_meshes(cx, &self.mesh_points) } else { vec![] }; - let meshes = if meshes.contains(&src) { vec![] } else { meshes }; - if !(ev.mods.shift || stop.is_some() || image || !meshes.is_empty()) { - return vec![Action::Exec("appearance.copyFrom".into(), json!({ "source": src.0 }))]; - } - let Some(c) = sample_color_at(cx, ev.pos) else { return vec![] }; - let color = color_json(&c); - if !meshes.is_empty() { - let ids: Vec = meshes.iter().map(|id| id.0).collect(); - return vec![Action::Exec("paint.sampleColor".into(), json!({ "color": color, "stroke": false, "ids": ids }))]; - } - let Some((back, i)) = stop else { return vec![Action::Exec("paint.sampleColor".into(), json!({ "color": color }))] }; - let out = vec![Action::Exec("paint.sampleColor".into(), json!({ "color": color, "stop": i })), Action::SwitchTool(back.clone())]; - self.stop = None; - out + } + + /// The object a click there samples, recolors or copies attributes to, as [`Self::click`] + /// finds it. + fn hover_object(&self, cx: &ToolContext, p: Point, mods: Mods) -> Option { + self.click(cx, p, mods)?.object() } /// Expose a transient text range alongside gradient-stop and brush-key sampling state. @@ -684,11 +685,92 @@ impl Tool for EyedropperTool { } } +/// What a click with the Eyedropper does, which [`EyedropperTool::pointer`] carries out. +enum Click { + /// Image Trace's Ignore Color pick: the panel samples the image with this binding. + ImageTrace(Value), + /// Brush Options › Key Color: this color, sampled from this object. + BrushKeyColor(Color, NodeId), + /// A pick for a Live Paint Bucket stop that is no longer selected switches back unsampled. + BackToBucket, + /// The fill color goes to these points of this selected gradient mesh. + MeshPoints(NodeId, Vec, Color), + /// `appearance.copyFrom` this source, with `reverse` or `append` or neither. + CopyFrom(NodeId, Option<&'static str>), + /// This color, sampled from `source`, goes to the picked points of `meshes`, else to the + /// gradient stop of `stop` (the tool to switch back to and the stop), else to the active fill + /// or stroke. + Sample { color: Color, source: NodeId, meshes: Vec, stop: Option<(String, usize)> }, +} + +impl Click { + /// The object of the document the click reads from or writes to. + fn object(&self) -> Option { + match self { + Click::ImageTrace(_) | Click::BackToBucket => None, + Click::BrushKeyColor(_, id) | Click::MeshPoints(id, ..) | Click::CopyFrom(id, _) | Click::Sample { source: id, .. } => Some(*id), + } + } +} + impl EyedropperTool { /// Is a gradient stop, Brush Key Color or Image Trace Ignore Color pick armed? fn picking(&self) -> bool { self.stop.is_some() || self.brush_key_color || self.image_trace_ignore_color.is_some() } + + /// What a click at `p` with `mods` does, or None when it does nothing. + fn click(&self, cx: &ToolContext, p: Point, mods: Mods) -> Option { + if let Some(binding) = &self.image_trace_ignore_color { + return Some(Click::ImageTrace(binding.clone())); + } + if self.brush_key_color { + let (c, source) = sample_at(cx, p)?; + return Some(Click::BrushKeyColor(c, source)); + } + // A pick for a stop of the Live Paint Bucket's gradient (the default paint's) ends without + // sampling once that stop is no longer selected (a Cmd-click selected another object) or no + // longer there (another paint was chosen): the click switches back. + let bucket_paint = if cx.fill_active { &cx.paint.fill } else { &cx.paint.stroke }; + let bucket_stop = cx.gradient_stop.filter(|i| matches!(bucket_paint, Paint::Gradient(g) if *i < g.gradient.stops.len())); + if self.stop.as_deref() == Some("livePaintBucket") && bucket_stop.is_none() { + return Some(Click::BackToBucket); + } + let stop = self.stop.clone().zip(cx.gradient_stop); + // A plain click on a selected gradient mesh gives the fill color to the point there, else + // to the four points of the patch there. + if stop.is_none() + && !mods.alt + && !mods.shift + && let Paint::Solid { color, .. } = &cx.paint.fill + && let Some((id, points)) = selected_mesh_points(cx, p) + { + return Some(Click::MeshPoints(id, points, *color)); + } + // Reading a source is independent of its editability. Only Alt's reverse operation + // writes to the clicked object; Shift+Alt appends its appearance to the selection. + let source = if mods.alt && !mods.shift && stop.is_none() { + hit_test(cx.doc, p, sample_options(cx)).map(|h| (paint_owner(cx.doc, h.leaf), h.kind)) + } else { + sample_source(cx, p) + }; + let (src, _) = source?; + let n = cx.doc.node(src)?; + if mods.alt && stop.is_none() { + return Some(Click::CopyFrom(src, Some(if mods.shift { "append" } else { "reverse" }))); + } + let image = matches!(n.kind, NodeKind::Image(_)); + // Picked mesh points take only a color sampled from other art or an image: the sample goes + // to them as a fill, and to nothing else that is selected. A click on a mesh with picked + // points is handled as before. + let meshes = if stop.is_none() { picked_meshes(cx, &self.mesh_points) } else { vec![] }; + let meshes = if meshes.contains(&src) { vec![] } else { meshes }; + if !(mods.shift || stop.is_some() || image || !meshes.is_empty()) { + return Some(Click::CopyFrom(src, None)); + } + let (color, source) = sample_at(cx, p)?; + Some(Click::Sample { color, source, meshes, stop }) + } } #[cfg(test)] @@ -1824,7 +1906,7 @@ mod tests { let opts = sample_options(&cx); let mut s = Sampler { doc: &d, opts, raster_sample: cx.raster_sample, symbol_nodes: 0, work: 1_000, exhausted: false, patterns: 0 }; let mut levels: Vec> = (0..MAX_NESTING).map(|_| None).collect(); - assert_eq!(color_under(&mut s, &d, &mut levels, Point::new(150.0, 150.0), opts).map(|c| c.to_hex()), None); + assert_eq!(color_under(&mut s, &d, &mut levels, Point::new(150.0, 150.0), opts).map(|(c, _)| c.to_hex()), None); assert!(s.exhausted); } @@ -1917,6 +1999,157 @@ mod tests { assert_eq!(sampled_hex(&below), "#00ff00"); } + /// The object the hover names for a Shift-click is the one whose color the click samples: the + /// blend where a step is drawn, and the rectangle below it in a gap between the steps. Away + /// from all art it names none. + #[test] + fn shift_hover_names_the_object_the_sample_comes_from() { + use vectorcraft_doc::live::{BlendSpacing, BlendSpec}; + use vectorcraft_geom::Rect; + let d = doc_with_live_over_green(|d| { + let red = solid_rect(d, Rect::new(300.0, 300.0, 320.0, 320.0), Color::rgb(1.0, 0.0, 0.0)); + let blue = solid_rect(d, Rect::new(400.0, 300.0, 420.0, 320.0), Color::rgb(0.0, 0.0, 1.0)); + let spec = BlendSpec { spacing: BlendSpacing::Steps(1), ..Default::default() }; + Node::new(d.alloc_id(), NodeKind::Blend { children: vec![std::sync::Arc::new(red), std::sync::Arc::new(blue)], spec: Box::new(spec) }) + }); + let ids: Vec = d.layers[0].children().unwrap().iter().map(|n| n.id).collect(); + let [.., green, blend] = ids[..] else { panic!("two objects over the rectangle expected") }; + let (s, p) = (Selection::default(), paint()); + let shift = Mods { shift: true, ..Default::default() }; + let t = EyedropperTool::default(); + let names = |x: f64, y: f64| t.hover_object(&cx(&d, &s, &p), Point::new(x, y), shift); + assert_eq!(names(360.0, 310.0), Some(blend), "a blend step"); + assert_eq!(names(335.0, 310.0), Some(green), "a gap between the steps"); + assert_eq!(names(480.0, 480.0), None, "no art"); + } + + /// A blend's steps count as work before it is evaluated: the steps of every blend it holds + /// are counted, and with less work left than that the sample gives no color and the blend is + /// not evaluated. + #[test] + fn blend_steps_count_before_the_blend_is_evaluated() { + use vectorcraft_doc::Document; + use vectorcraft_doc::blend::blend_steps_made; + use vectorcraft_doc::live::{BlendSpacing, BlendSpec}; + use vectorcraft_geom::Rect; + let blend = |d: &mut Document, steps: u32| { + let red = solid_rect(d, Rect::new(300.0, 300.0, 320.0, 320.0), Color::rgb(1.0, 0.0, 0.0)); + let blue = solid_rect(d, Rect::new(400.0, 300.0, 420.0, 320.0), Color::rgb(0.0, 0.0, 1.0)); + let spec = BlendSpec { spacing: BlendSpacing::Steps(steps), ..Default::default() }; + Node::new(d.alloc_id(), NodeKind::Blend { children: vec![std::sync::Arc::new(red), std::sync::Arc::new(blue)], spec: Box::new(spec) }) + }; + let mut scratch = Document::new(500.0, 500.0); + let (big, small) = (blend(&mut scratch, 1000), blend(&mut scratch, 3)); + let rect = solid_rect(&mut scratch, Rect::new(0.0, 0.0, 10.0, 10.0), Color::rgb(0.0, 1.0, 0.0)); + assert_eq!(blend_steps_made(&big), 1000); + assert_eq!(blend_steps_made(&rect), 0); + let group = + Node::new(scratch.alloc_id(), NodeKind::Group { children: vec![std::sync::Arc::new(big), std::sync::Arc::new(small)], clip: false }); + assert_eq!(blend_steps_made(&group), 1003, "every blend in the group"); + + let d = doc_with_live_over_green(|d| blend(d, 1000)); + let (sel, p) = (Selection::default(), paint()); + let cx = cx(&d, &sel, &p); + let opts = sample_options(&cx); + let mut levels: Vec> = (0..MAX_NESTING).map(|_| None).collect(); + let at = Point::new(360.0, 310.0); + let evaluated = || EXPANSIONS.with(std::cell::Cell::get); + let before = evaluated(); + let mut s = Sampler { doc: &d, opts, raster_sample: cx.raster_sample, symbol_nodes: 0, work: 900, exhausted: false, patterns: 0 }; + assert_eq!(color_under(&mut s, &d, &mut levels, at, opts).map(|(c, _)| c.to_hex()), None); + assert!(s.exhausted, "less work left than the blend's 1,000 steps"); + assert_eq!(evaluated(), before, "the blend is not evaluated"); + let mut s = Sampler { doc: &d, opts, raster_sample: cx.raster_sample, symbol_nodes: 0, work: MAX_WORK, exhausted: false, patterns: 0 }; + assert!(color_under(&mut s, &d, &mut levels, at, opts).is_some(), "a step is drawn at the point"); + assert!(evaluated() > before, "with enough work the blend is evaluated"); + } + + /// Each step of a blend whose keys are blends is a copy of one of them, so the steps it makes + /// in all count before it is evaluated: an outer blend of 20 steps between two blends of 100 + /// steps makes more than 2,000, though its blends have 220 steps between their own keys. + #[test] + fn steps_that_copy_a_nested_blend_count_before_it_is_evaluated() { + use vectorcraft_doc::Document; + use vectorcraft_doc::live::{BlendSpacing, BlendSpec}; + use vectorcraft_geom::Rect; + let blend = |d: &mut Document, keys: Vec, steps: u32| { + let spec = BlendSpec { spacing: BlendSpacing::Steps(steps), ..Default::default() }; + Node::new(d.alloc_id(), NodeKind::Blend { children: keys.into_iter().map(std::sync::Arc::new).collect(), spec: Box::new(spec) }) + }; + let inner = |d: &mut Document, y: f64| { + let red = solid_rect(d, Rect::new(300.0, y, 320.0, y + 10.0), Color::rgb(1.0, 0.0, 0.0)); + let blue = solid_rect(d, Rect::new(400.0, y, 420.0, y + 10.0), Color::rgb(0.0, 0.0, 1.0)); + blend(d, vec![red, blue], 100) + }; + let d = doc_with_live_over_green(|d| { + let (a, b) = (inner(d, 300.0), inner(d, 330.0)); + blend(d, vec![a, b], 20) + }); + let outer = d.layers[0].children().unwrap().last().unwrap(); + assert!(vectorcraft_doc::blend::blend_steps_made(outer) > 2_000, "the copies' steps count"); + let (sel, p) = (Selection::default(), paint()); + let cx = cx(&d, &sel, &p); + let opts = sample_options(&cx); + let mut levels: Vec> = (0..MAX_NESTING).map(|_| None).collect(); + let at = Point::new(310.0, 305.0); + let evaluated = || EXPANSIONS.with(std::cell::Cell::get); + let before = evaluated(); + let mut s = Sampler { doc: &d, opts, raster_sample: cx.raster_sample, symbol_nodes: 0, work: 1_000, exhausted: false, patterns: 0 }; + assert_eq!(color_under(&mut s, &d, &mut levels, at, opts).map(|(c, _)| c.to_hex()), None); + assert!(s.exhausted, "less work left than the steps the outer blend makes"); + assert_eq!(evaluated(), before, "the outer blend is not evaluated"); + let mut s = Sampler { doc: &d, opts, raster_sample: cx.raster_sample, symbol_nodes: 0, work: MAX_WORK, exhausted: false, patterns: 0 }; + assert!(color_under(&mut s, &d, &mut levels, at, opts).is_some(), "a key is drawn at the point"); + assert!(evaluated() > before, "with enough work the outer blend is evaluated"); + } + + /// For a Shift-click on an envelope, the hover names the envelope where its distorted contents + /// are drawn, and the rectangle below where they leave the point empty. + #[test] + fn shift_hover_names_the_envelope_where_its_art_is_drawn() { + use vectorcraft_geom::{Affine, Rect}; + let d = doc_with_live_over_green(|d| { + let red = solid_rect(d, Rect::new(300.0, 300.0, 420.0, 320.0), Color::rgb(1.0, 0.0, 0.0)); + let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 50.0, h: 0.0, v: 0.0, horizontal: true, version: 0 }; + let content = vec![std::sync::Arc::new(red)]; + let options = Default::default(); + Node::new( + d.alloc_id(), + NodeKind::Envelope { content, kind: Box::new(kind), fidelity: 50.0, editing: false, options, frame: Box::new(Affine::IDENTITY) }, + ) + }); + let ids: Vec = d.layers[0].children().unwrap().iter().map(|n| n.id).collect(); + let [.., green, envelope] = ids[..] else { panic!("two objects over the rectangle expected") }; + let (s, p) = (Selection::default(), paint()); + let shift = Mods { shift: true, ..Default::default() }; + let t = EyedropperTool::default(); + let names = |x: f64, y: f64| t.hover_object(&cx(&d, &s, &p), Point::new(x, y), shift); + assert_eq!(names(360.0, 310.0), Some(envelope), "the distorted contents"); + assert_eq!(names(360.0, 332.0), Some(green), "a point the contents leave empty"); + } + + /// A plain click on a selected gradient mesh recolors its points, and the hover names that + /// mesh; Image Trace's Ignore Color pick, which the panel samples, names nothing. + #[test] + fn hover_names_the_selected_mesh_a_click_recolors() { + use vectorcraft_doc::{Document, GradientMesh}; + let mut d = Document::new(500.0, 500.0); + let l = d.layers[0].id; + let mesh = d.alloc_id(); + let grid = GradientMesh::from_surface(1, 1, &|u, v| Point::new(100.0 + 100.0 * u, 100.0 + 100.0 * v), &|_, _| Color::WHITE); + d.insert(Some(l), 0, Node::new(mesh, NodeKind::Mesh(grid))).unwrap(); + let p = paint(); + let mut s = Selection::default(); + s.set([mesh]); + let mut t = EyedropperTool::default(); + let at = Point::new(150.0, 150.0); + let a = t.pointer(&cx(&d, &s, &p), &PointerEvent::new(PointerKind::Down, at.x, at.y)); + assert!(matches!(a.first(), Some(Action::Exec(id, _)) if id == "object.mesh.setPointColor"), "{a:?}"); + assert_eq!(t.hover_object(&cx(&d, &s, &p), at, Mods::default()), Some(mesh)); + t.set_option("imageTraceIgnoreColor", &json!({"binding": 1})); + assert_eq!(t.hover_object(&cx(&d, &s, &p), at, Mods::default()), None); + } + /// A blend of two instances of one symbol draws its steps as instances too: Shift-click on a /// step samples the symbol's art there, and where that art leaves the point empty, what lies /// below. diff --git a/crates/ui-egui/src/addons/shapes.rs b/crates/ui-egui/src/addons/shapes.rs index e02e323061..a134adeab4 100644 --- a/crates/ui-egui/src/addons/shapes.rs +++ b/crates/ui-egui/src/addons/shapes.rs @@ -52,7 +52,7 @@ pub fn control_bar(app: &mut VectorcraftApp, ui: &mut Ui) -> bool { if tool == "box3d" { let shapes: [Choice; 6] = [("box3d", "3D Box"), ("rectangle", "Rectangle"), ("ellipse", "Ellipse"), ("polygon", "Polygon"), ("star", "Star"), ("spiral", "Spiral")] - .map(|(id, label)| (id, label, shape_icon(id))); + .map(|(id, label)| (id, label, icon_for_shape(id))); if let Some(shape) = choice(ui, "Shape", &active_shape, &shapes) { app.run("tool.setOption", json!({ "key": "shape", "value": shape })).ok(); } @@ -309,7 +309,7 @@ fn draw_polygon_controls(app: &mut VectorcraftApp, ui: &mut Ui, opts: &Value, ac end_deg = a1; mode = mode_str(arc_mode); } - let kinds: [Choice; 2] = [("polygon", "Polygon", shape_icon("polygon")), ("star", "Star", shape_icon("star"))]; + let kinds: [Choice; 2] = [("polygon", "Polygon", icon_for_shape("polygon")), ("star", "Star", icon_for_shape("star"))]; match choice(ui, "Shape", if is_star { "star" } else { "polygon" }, &kinds) { Some("star") => apply_shape(app, &[("polyIsStar", json!(true))], json!({ "isStar": true, "spokeRatio": spoke })), Some(_) => apply_shape(app, &[("polyIsStar", json!(false))], json!({ "isStar": false })), @@ -410,7 +410,7 @@ fn draw_box3d_controls(app: &mut VectorcraftApp, ui: &mut Ui, opts: &Value, sele } /// The toolbar icon of the shape tool `id`, so the Control bar's shape buttons show the same icon. -fn shape_icon(id: &str) -> &'static str { +fn icon_for_shape(id: &str) -> &'static str { vectorcraft_tools::tool_info(id).map_or("square-dashed", |t| crate::icons::tool_icon(t.icon)) } @@ -428,7 +428,7 @@ mod tests { use craft::behavior::IconId; use craft::ui::primitives::{has_icon, register_app_icons}; - use super::shape_icon; + use super::icon_for_shape; /// The Control bar's shape buttons look their icons up by tool id; an id that names no tool /// would show the placeholder instead of the toolbar's icon. @@ -437,9 +437,9 @@ mod tests { register_app_icons(&crate::icons::APP_ICONS); for id in ["box3d", "rectangle", "ellipse", "polygon", "star", "spiral"] { let tool = vectorcraft_tools::tool_info(id).unwrap_or_else(|| panic!("{id} is a tool")); - assert_eq!(shape_icon(id), crate::icons::tool_icon(tool.icon), "{id}"); - assert!(has_icon(&IconId::new(shape_icon(id))), "{id}'s icon {} isn't an icon", shape_icon(id)); + assert_eq!(icon_for_shape(id), crate::icons::tool_icon(tool.icon), "{id}"); + assert!(has_icon(&IconId::new(icon_for_shape(id))), "{id}'s icon {} isn't an icon", icon_for_shape(id)); } - assert_eq!(shape_icon("no-such-tool"), "square-dashed"); + assert_eq!(icon_for_shape("no-such-tool"), "square-dashed"); } } diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index da60b104d3..2f25c3ea4d 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -6,10 +6,10 @@ use craft::platform::clock::monotonic_ms; use craft::theme::variant::Tone; use craft::ui::buttons::{ActiveLook, PushButtonLook}; use craft::ui::choice::ChoiceLook; -use craft::ui::contract::{Bind, CaptionInk, GlyphColon, LinkLabelInk, LinkLabelUnderline, QuietHeader, SectionRhythm}; +use craft::ui::contract::{Bind, CaptionInk, GlyphColon, LinkLabelInk, LinkLabelUnderline, MoveBandCursor, QuietHeader, SectionRhythm}; use craft::ui::docking::IconGroupSeparator; use craft::ui::list::{CommandHighlight, ThumbRows}; -use craft::ui::menu::MenuTitlePad; +use craft::ui::menu::MenuTitleLook; use craft::ui::patterns::form_dialogs::PresetCardLook; use craft::ui::runtime::env::{RootEnv, Scale, ScrubDrags, WindowKey}; use craft::ui::runtime::frame::{FrameInput, FrameOutput}; @@ -19,7 +19,7 @@ use craft::ui::sections::{DialogButtonLook, QuietTitleRow}; use craft::ui::shell::embed::CloseDecision; use craft::ui::shell::{AppShell, CanvasPanel, Slot}; use craft::ui::style::TrackFill; -use craft::ui::tabs::DocumentTabLook; +use craft::ui::tabs::{DocumentTabLook, TabCloseLook}; use craft::ui::text::{NumberLook, NumberPrecision}; use vectorcraft_engine::cmd::clipboard::PASTE_ORDER; use vectorcraft_engine::cmd::toast::Level; @@ -133,6 +133,7 @@ impl VectorcraftApp { find_font: None, hidden_chars: Default::default(), spelling: Default::default(), + text_nodes: Default::default(), momentary: None, selection_box: None, selection_bounds: None, @@ -144,6 +145,7 @@ impl VectorcraftApp { plugin_keys: Default::default(), placed_keys: Default::default(), view_moved: None, + hover_object: None, grab: None, carry_target: None, last_drag: None, @@ -739,10 +741,14 @@ pub(crate) fn root_env(prefs: &vectorcraft_engine::Prefs, native_ppp: f32) -> Ro root.values.set(ThumbRows::Tight); // The Layers Objects search field fills the filter bar up to its Filter button, as production's did. root.values.set(ObjectsSearch::Fill); - // The menu bar's titles stand as close as production's, which share the line with the bar's other controls. - root.values.set(MenuTitlePad::Control); + // The menu bar's titles are production's egui buttons: a push button high, 2 points beside the text, rounded. + root.values.set(MenuTitleLook::Button); + // The title bar and the panel headers keep the arrow, over the menu titles too, as production's did. + root.values.set(MoveBandCursor::Arrow); // Document tabs show their title and its `*` in the label's semibold face, as production drew them. root.values.set(DocumentTabLook::Semibold); + // A document tab's × is a small glyph that brightens under the pointer, with no fill, as production drew it. + root.values.set(TabCloseLook::Glyph); // A collapsed panel column's icon groups stand apart by a hairline, as production drew them. root.values.set(IconGroupSeparator::Rule); // New Document's preset cards show blank paper on a flat card, as production drew them. diff --git a/crates/ui-egui/src/caches.rs b/crates/ui-egui/src/caches.rs index 987de9a8da..90875851d4 100644 --- a/crates/ui-egui/src/caches.rs +++ b/crates/ui-egui/src/caches.rs @@ -60,6 +60,10 @@ pub struct CanvasCache { /// The words Edit › Spelling › Auto Spell Check underlined on each text object in the last /// frame; dropped while it is off. pub spelling: canvas::marks::SpellingMarks, + /// The active document's visible text objects for (document uid, revision), which Show Hidden + /// Characters and Auto Spell Check draw over. A pass that draws neither drops them + /// ([`canvas::marks::marks_of`]). + pub text_nodes: canvas::marks::TextNodes, /// The Hand, Zoom and Rotate View tools the Space key and its chords lend the canvas, between /// passes; the tool adapter takes it out for its call and puts it back. pub momentary: Option, @@ -87,6 +91,10 @@ pub struct CanvasCache { /// The view the canvas last drew and when it last changed (egui's input time): while it moves, /// the canvas doesn't hit-test the art under the pointer ([`canvas::hover_wait`], #2452). pub view_moved: Option<(canvas::ViewKey, f64)>, + /// The object the Eyedropper's click at the pointer would act on, which Object Highlighting + /// outlines, with what it was found for: finding it again, which can sample a color, waits + /// until one of those changes. + pub hover_object: Option<(canvas::HoverObjectKey, Option)>, /// Where the press of the gesture running on the canvas landed, in document points: a move carried out of the /// canvas drops its art there relative to the pointer (`canvas::drops`). pub grab: Option, @@ -343,6 +351,14 @@ pub struct CacheKey { /// The paper under the art that translucent art is blended with before the conversion /// ([`crate::display_profile::convert_over`]). None without a display profile, and in Outline. pub backdrop: Option>, + /// The active color settings ([`vectorcraft_color::cms::active_settings`]), the working color + /// settings ([`vectorcraft_color::cms::working_settings`]) and the loaded profiles' generation + /// ([`vectorcraft_color::cms::profiles_generation`]) the frame's colors were converted with: + /// Edit › Color Settings, a profile loaded again under its name or removed, and the front + /// document's assigned profiles change them without changing the document. A proof of the + /// working CMYK space converts through the working settings, which can change while the active + /// settings stay the same. + pub color: (vectorcraft_color::cms::ColorSettings, vectorcraft_color::cms::ColorSettings, u64), } impl CacheKey { diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index b097971511..596cb119f0 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -50,6 +50,7 @@ pub use panes::{Layout as TileLayout, Panes}; pub(crate) use panes::{consolidate, pane, tile, tiled_area}; pub(crate) use raster::{KeptFrame, color_image, color_image_owned, render_job}; pub(crate) use rulers::{general_lengths, stroke_lengths}; +pub use selection::HoverObjectKey; pub(crate) use task_bar::{TASK_BAR_ACTIONS, TASK_BAR_CHIPS, has_colors, is_task_bar_action, read_hidden_task_bar_actions}; pub use tool_adapter::{apply_requests, dispatch, mods}; pub(crate) use tool_adapter::{busy_tool, in_gesture, pose_on_page, tool_enter}; diff --git a/crates/ui-egui/src/canvas/drops.rs b/crates/ui-egui/src/canvas/drops.rs index 7a8b606305..274b1fde7f 100644 --- a/crates/ui-egui/src/canvas/drops.rs +++ b/crates/ui-egui/src/canvas/drops.rs @@ -76,17 +76,19 @@ pub struct CanvasDropsStyle { } /// A drop target for one payload type `P`: `make` turns the payload into the canvas's own, or refuses it. `seen` is -/// the operation of the last payload it accepted at the pointer. +/// the operation of the last payload it accepted at the pointer. Where `covered` (another window lies over the canvas), +/// it takes nothing: that window's targets take the drop. struct Target<'a, F> { rect: Rect, view: &'a CanvasView, + covered: &'a dyn Fn(Pos2) -> bool, make: F, seen: Cell>, } impl<'a, F> Target<'a, F> { - fn new(rect: Rect, view: &'a CanvasView, make: F) -> Self { - Target { rect, view, make, seen: Cell::new(None) } + fn new(rect: Rect, view: &'a CanvasView, covered: &'a dyn Fn(Pos2) -> bool, make: F) -> Self { + Target { rect, view, covered, make, seen: Cell::new(None) } } } @@ -94,6 +96,9 @@ impl Option> DropTarget

for Target<'_, F> { type Drop = Dropped; fn accept(&self, payload: &P, at: Pos2, op: DropOperation) -> Option { + if (self.covered)(at) { + return None; + } let payload = (self.make)(payload)?; self.seen.set(Some(op)); Some(Dropped { payload, at: self.view.to_doc(at), zoom: self.view.zoom, op }) @@ -121,6 +126,8 @@ pub(crate) struct CanvasDrops<'a> { /// has the content the move started from ([`CarriedArt::before`]), and the document a tab rest showed is still the /// current one. given_up: bool, + /// Whether another window lies over the canvas at a point of it: a floating panel's OS window. + covered: &'a dyn Fn(Pos2) -> bool, out: &'a RefCell>, /// The files from the OS the canvas places, and where their drop goes. files: (CanvasFiles<'a>, &'a RefCell>), @@ -150,9 +157,9 @@ impl Component for CanvasDrops<'_> { fn update(&mut self, cx: &mut Cx<'_, Self>) { let rect = cx.rect; - let (sources, given_up, view) = (&self.sources, self.given_up, &self.view); + let (sources, given_up, view, covered) = (&self.sources, self.given_up, &self.view, self.covered); let unchanged = |a: &CarriedArt| given_up || sources.contains(&(a.document, a.revision)); - let art = Target::new(rect, view, |a: &CarriedArt| unchanged(a).then(|| Payload::Art(a.clone()))); + let art = Target::new(rect, view, covered, |a: &CarriedArt| unchanged(a).then(|| Payload::Art(a.clone()))); let mut dropped = cx.drop_target::(&art); if self.kind == BodyKind::Pane && let (Some(op), Some((carried, _))) = (art.seen.get(), cx.dragging::()) @@ -163,11 +170,11 @@ impl Component for CanvasDrops<'_> { } if self.kind == BodyKind::Live { // The art of this canvas's own document is not accepted as a panel payload: its move resumes. - let panel = Target::new(rect, view, |p: &PanelDrag| (!matches!(p, PanelDrag::Art { .. })).then(|| Payload::Panel(p.clone()))); - let style = Target::new(rect, view, |d: &ListDrag| Some(Payload::Style(d.grabbed.clone()))); - let symbol = Target::new(rect, view, |d: &ListDrag| Some(Payload::Symbol(d.grabbed.clone()))); - let brush = Target::new(rect, view, |d: &ListDrag| Some(Payload::Brush(d.grabbed.clone()))); - let library = Target::new(rect, view, |d: &ListDrag| Some(Payload::Library(d.grabbed.clone()))); + let panel = Target::new(rect, view, covered, |p: &PanelDrag| (!matches!(p, PanelDrag::Art { .. })).then(|| Payload::Panel(p.clone()))); + let style = Target::new(rect, view, covered, |d: &ListDrag| Some(Payload::Style(d.grabbed.clone()))); + let symbol = Target::new(rect, view, covered, |d: &ListDrag| Some(Payload::Symbol(d.grabbed.clone()))); + let brush = Target::new(rect, view, covered, |d: &ListDrag| Some(Payload::Brush(d.grabbed.clone()))); + let library = Target::new(rect, view, covered, |d: &ListDrag| Some(Payload::Library(d.grabbed.clone()))); let panel = cx.drop_target::(&panel); let style = cx.drop_target::, _>(&style); let symbol = cx.drop_target::, _>(&symbol); @@ -215,8 +222,10 @@ pub(crate) fn show(app: &mut VectorcraftApp, ui: &mut Ui, win: Win, kind: BodyKi && app.session.documents().iter().any(|d| d.uid == a.document && d.same_content(&a.before)) }); let (out, files_out) = (RefCell::new(None), RefCell::new(None)); + let ctx = ui.ctx().clone(); + let covered = |at: Pos2| crate::panel_docking::os_window_at(app, &ctx, at); let files = (CanvasFiles::new(app, rect, &view), &files_out); - let drops = CanvasDrops { common: Common::new(), view, kind, document, sources, given_up, out: &out, files }; + let drops = CanvasDrops { common: Common::new(), view, kind, document, sources, given_up, covered: &covered, out: &out, files }; drops.id_salt(("canvas-drops", win)).show_at(ui, rect); if let Some(files) = files_out.take() { crate::place::canvas_drop(app, ui.ctx(), files); diff --git a/crates/ui-egui/src/canvas/home.rs b/crates/ui-egui/src/canvas/home.rs index e2dfa19c73..d95cdc02e1 100644 --- a/crates/ui-egui/src/canvas/home.rs +++ b/crates/ui-egui/src/canvas/home.rs @@ -1,9 +1,13 @@ -use craft::behavior::IconId; -use craft::ui::buttons::Button; -use craft::ui::contract::{Bind, Props as _, Show as _, ShowContainer as _}; +use craft::behavior::{ColumnWidth, IconId}; +use craft::ui::buttons::{Link, LinkLook}; +use craft::ui::contract::{Bind, Gap, Pad, Props as _, Show as _, ShowContainer as _, clicked}; use craft::ui::display::Text; -use craft::ui::layout_components::Row; -use craft::ui::shell::{RecentFile, StartAction, StartLayout, StartLink, StartScreen, Template}; +use craft::ui::layout::CellAlign; +use craft::ui::layout_components::{Grid, Stack}; +use craft::ui::runtime::env::{Env, Overrides, with_env}; +use craft::ui::sections::Section; +use craft::ui::shell::{RecentFile, StartAction, StartLayout, StartLink, StartPlace, StartScreen, Template}; +use craft::ui::style::{SurfaceKind, TypeRole}; use super::{Ui, VectorcraftApp, json}; @@ -13,6 +17,10 @@ const TEMPLATES: [&str; 6] = ["Letter", "A4", "Web 1920×1080", "Phone 390×844" /// The icons of the three `community::link_urls` links, in their order. const LINK_ICONS: [&str; 3] = ["globe", "external-link", "git-branch"]; +/// The Learn cards across a full-width column, and across a narrower one. +const FOUR: &[ColumnWidth] = &[ColumnWidth::fill(1.0); 4]; +const TWO: &[ColumnWidth] = &[ColumnWidth::fill(1.0); 2]; + /// The Home screen (`app.home`; with no document open, unless its preference is off). pub(super) fn home(app: &mut VectorcraftApp, ui: &mut Ui, rect: egui::Rect) { let recent: Vec = crate::io::recent_files(app) @@ -35,12 +43,14 @@ pub(super) fn home(app: &mut VectorcraftApp, ui: &mut Ui, rect: egui::Rect) { for ((label, url), icon) in crate::community::link_urls(app).into_iter().zip(LINK_ICONS) { links.push(StartLink::url(tl!(label), Some(IconId::new(icon)), url)); } - // The column shows no view switch or sort; the bindings hold copies so the Learn section can borrow the app. - let (mut view, mut sort) = (app.ui.home_view, app.ui.home_sort); let mut pressed = None; - let mut learn = |ui: &mut Ui| learn(app, ui, &mut pressed); let mut child = ui.new_child(egui::UiBuilder::new().max_rect(rect).layout(egui::Layout::top_down(egui::Align::Min))); - let out = StartScreen::new(Bind::bound(&mut view), Bind::bound(&mut sort), &recent) + // Production's community links read in the accent alone, with no underline. + let plain_links = |overrides: &mut Overrides| { + overrides.values.set(LinkLook::Plain); + }; + // Learn follows the presets, which stand right under New and Open as in production 0.24.1. + let start = StartScreen::new(Bind::bound(&mut app.ui.home_view), Bind::bound(&mut app.ui.home_sort), &recent) .layout(StartLayout::Column) .title(tl!("Welcome to VectorCraft")) .subtitle(tl!("Vector illustration — fast, open, scriptable.")) @@ -51,15 +61,13 @@ pub(super) fn home(app: &mut VectorcraftApp, ui: &mut Ui, rect: egui::Rect) { .templates_title(tl!("Quickly start a new file")) .links(&links) .links_title(tl!("Community")) - .app_section(tl!("Learn"), &mut learn) - .show(&mut child); - app.ui.home_view = view; - app.ui.home_sort = sort; + .section(StartPlace::AfterSections, |ui, _| learn(ui, &mut pressed)); + let out = with_env(&mut child, plain_links, |ui| start.show(ui)); for action in out.actions { run_action(app, action); } - if let Some(id) = pressed - && let Err(e) = app.run("learn.show", json!({ "tutorial": id })) + if let Some((command, args)) = pressed + && let Err(e) = app.run(command, args) { app.status(e); } @@ -86,21 +94,36 @@ fn run_action(app: &mut VectorcraftApp, action: StartAction) { } } -/// The Home screen's Learn section: the Quick skill guide card, which shows the Learn panel's list -/// of skills, and the Learn panel's tutorials under their skills, each a button that shows the -/// panel at its steps (`learn.show`). The start screen may run this twice in a pass, so it only -/// draws and records the tutorial pressed in `pressed`. -fn learn(app: &mut VectorcraftApp, ui: &mut Ui, pressed: &mut Option<&'static str>) { - use crate::panels::learn::{catalog, guide_card}; - guide_card(app, ui); // PLAN: assumed `guide_card(app, ui)` as document-panels-w18 leaves it, on `Button::detail`. - for skill in catalog::SKILLS { - let _ = Text::new(skill.title).show(ui); - let _ = Row::new().show(ui, |ui, _| { - for tutorial in skill.tutorials { - if Button::new(tutorial.title).id_salt(tutorial.id).show(ui).clicked() { - *pressed = Some(tutorial.id); - } +/// The Home screen's Learn section, after the new-file presets: a Column page section whose heading row ends in the +/// Quick skill guide link, which shows the Learn panel's list of skills (`learn.skills`), over a card per skill: its +/// title over its tutorials as links, each showing the panel at its steps (`learn.show`). The four cards stand in one +/// row in a column at its full `size.page.column` width, and two by two in a narrower one. The start screen may run +/// this twice in a pass, so it only draws and records the command chosen in `pressed`. +fn learn(ui: &mut Ui, pressed: &mut Option<(&'static str, serde_json::Value)>) { + use crate::panels::learn::catalog::SKILLS; + let (mut guide, mut tutorial) = (false, None); + let across = if ui.available_width() + 0.5 >= Env::of(ui).tokens.size.page.column { FOUR } else { TWO }; + let section = Section::fixed(tl!("Learn")).quiet_header().header_gap(Gap::PageHeading); + let _ = section.controls(|ui, _| guide |= clicked(&Link::new(tl!("Quick skill guide")).show(ui))).show(ui, |ui, _| { + let _ = Grid::new(across).gap(Gap::Section).cells(CellAlign::Top).fill_width().show(ui, |ui, _| { + for skill in SKILLS { + let card = Stack::new().surface(SurfaceKind::Raised).pad(Pad::Regular).gap(Gap::Stack).fill_width(); + let _ = card.show(ui, |ui, _| { + let _ = Text::new(skill.title).role(TypeRole::BodyStrong).show(ui); + let _ = Stack::new().gap(Gap::PageLink).show(ui, |ui, _| { + for t in skill.tutorials { + if clicked(&Link::new(t.title).id_salt(t.id).show(ui)) { + tutorial = Some(t.id); + } + } + }); + }); } }); + }); + if guide { + *pressed = Some(("learn.skills", json!({}))); + } else if let Some(id) = tutorial { + *pressed = Some(("learn.show", json!({ "tutorial": id }))); } } diff --git a/crates/ui-egui/src/canvas/marks.rs b/crates/ui-egui/src/canvas/marks.rs index 4565abe5ae..ca21ef7119 100644 --- a/crates/ui-egui/src/canvas/marks.rs +++ b/crates/ui-egui/src/canvas/marks.rs @@ -108,6 +108,17 @@ pub struct SpellingMarks { pub(super) lines: HashMap, Underlines)>, } +/// The visible text objects of a document, depth first in paint order ([`TextNodes`]). +pub(super) type TextList = Arc>>; + +/// The visible text objects of the active document, for (document uid, revision): Show Hidden +/// Characters and Auto Spell Check draw over them every pass ([`crate::CanvasCache::text_nodes`]). +/// A pass that draws neither drops them ([`marks_of`]). +#[derive(Default)] +pub struct TextNodes { + pub(super) list: Option<((u64, u64), TextList)>, +} + /// One print tile on the screen: its paper edge and its number. #[derive(Clone, Debug, PartialEq)] pub(crate) struct Tile { @@ -166,11 +177,15 @@ pub(crate) fn marks_of(app: &mut VectorcraftApp, view: &CanvasView) -> Marks { if !spelling_gate { app.canvas.spelling = SpellingMarks::default(); } + if !hidden_gate && !spelling_gate { + app.canvas.text_nodes = TextNodes::default(); + } let fades = artboards::fades_outside_artboards(app); let shows_artboards = artboards::shows_artboards(app); let Some(st) = app.session.active() else { app.canvas.hidden_chars.marks.clear(); app.canvas.spelling = SpellingMarks::default(); + app.canvas.text_nodes = TextNodes::default(); return m; }; let key = (st.uid, st.revision); @@ -181,11 +196,16 @@ pub(crate) fn marks_of(app: &mut VectorcraftApp, view: &CanvasView) -> Marks { m.bleed = artboards::bleed_paths(st); m.artboard_marks = artboards::mark_paths(st, view.zoom); } - if hidden_gate { - collect_hidden(st, view, &mut app.canvas.hidden_chars, &mut m.hidden); - } - if spelling_gate { - collect_spelling(st, view, &mut app.canvas.spelling, &mut m.spelling); + if hidden_gate || spelling_gate { + // Both draw over the same text objects, found among the document's other objects once + // for each revision. + let texts = cached(&mut app.canvas.text_nodes.list, key, || text_nodes(&st.doc.layers)); + if hidden_gate { + collect_hidden(&texts, view, &mut app.canvas.hidden_chars, &mut m.hidden); + } + if spelling_gate { + collect_spelling(st, &texts, view, &mut app.canvas.spelling, &mut m.spelling); + } } if inside_gate && let Some(id) = app.session.draw_inside @@ -267,14 +287,22 @@ fn cached(slot: &mut Option<((u64, u64), Arc)>, key: (u64, u64), make: imp v } -/// Depth first in paint order, leaving out hidden objects and what is inside them. -fn walk(nodes: &[Arc], f: &mut impl FnMut(&Arc)) { - for n in nodes.iter().filter(|n| n.visible) { - f(n); - if let Some(children) = n.children() { - walk(children, f); +/// The text objects in `layers`, depth first in paint order, leaving out hidden objects and what +/// is inside them. +fn text_nodes(layers: &[Arc]) -> Vec> { + fn walk(nodes: &[Arc], out: &mut Vec>) { + for n in nodes.iter().filter(|n| n.visible) { + if matches!(n.kind, NodeKind::Text(_)) { + out.push(n.clone()); + } + if let Some(children) = n.children() { + walk(children, out); + } } } + let mut out = Vec::new(); + walk(layers, &mut out); + out } /// Whether `n`'s box meets the part of the document the view shows (the box round the view's @@ -286,7 +314,7 @@ fn in_view(n: &Node, view: &CanvasView) -> bool { /// The marks of the visible text objects in view, laid out again only for the objects the memo /// doesn't hold as they are now. The objects not shown this pass are dropped from the memo. -fn collect_hidden(st: &DocState, view: &CanvasView, kept: &mut HiddenChars, out: &mut Vec) { +fn collect_hidden(texts: &[Arc], view: &CanvasView, kept: &mut HiddenChars, out: &mut Vec) { let mut last = std::mem::take(&mut kept.marks); // The inputs are read before any layout: when fonts load during this pass, the next pass lays // all type out again. @@ -295,10 +323,10 @@ fn collect_hidden(st: &DocState, view: &CanvasView, kept: &mut HiddenChars, out: last.clear(); kept.inputs = inputs; } - walk(&st.doc.layers, &mut |n| { - let NodeKind::Text(tx) = &n.kind else { return }; + for n in texts { + let NodeKind::Text(tx) = &n.kind else { continue }; if !in_view(n, view) { - return; + continue; } let marks = match last.remove(&n.id) { Some((was, marks)) if Arc::ptr_eq(&was, n) => marks, @@ -306,12 +334,12 @@ fn collect_hidden(st: &DocState, view: &CanvasView, kept: &mut HiddenChars, out: }; out.extend_from_slice(&marks); kept.marks.insert(n.id, (n.clone(), marks)); - }); + } } /// The Auto Spell Check segments of the visible text objects in view, checked again only for the /// objects the memo doesn't hold as they are now. -fn collect_spelling(st: &DocState, view: &CanvasView, kept: &mut SpellingMarks, out: &mut Vec<(Point, Point)>) { +fn collect_spelling(st: &DocState, texts: &[Arc], view: &CanvasView, kept: &mut SpellingMarks, out: &mut Vec<(Point, Point)>) { let mut last = std::mem::take(&mut kept.lines); let inputs = SpellingInputs { fonts: vectorcraft_text::FontDb::global().generation(), @@ -325,10 +353,10 @@ fn collect_spelling(st: &DocState, view: &CanvasView, kept: &mut SpellingMarks, last.clear(); kept.inputs = Some(inputs); } - walk(&st.doc.layers, &mut |n| { - let NodeKind::Text(tx) = &n.kind else { return }; + for n in texts { + let NodeKind::Text(tx) = &n.kind else { continue }; if !auto_spell_checks(n) || !in_view(n, view) { - return; + continue; } let lines = match last.remove(&n.id) { Some((was, lines)) if Arc::ptr_eq(&was, n) => lines, @@ -336,7 +364,7 @@ fn collect_spelling(st: &DocState, view: &CanvasView, kept: &mut SpellingMarks, }; out.extend_from_slice(&lines); kept.lines.insert(n.id, (n.clone(), lines)); - }); + } } /// Draw Inside's arms on the screen: round the corners of `bounds` (a few pixels outside the diff --git a/crates/ui-egui/src/canvas/marks/tests.rs b/crates/ui-egui/src/canvas/marks/tests.rs index 33784cf250..2bb6ecda50 100644 --- a/crates/ui-egui/src/canvas/marks/tests.rs +++ b/crates/ui-egui/src/canvas/marks/tests.rs @@ -40,20 +40,31 @@ fn settled(app: &mut VectorcraftApp, view: &CanvasView, ids: &[NodeId]) -> Vec