Merge main into feat/scripts-api-d3-layers-artboards

This commit is contained in:
dotCooCoo
2026-11-30 21:04:45 -08:00
56 changed files with 1678 additions and 523 deletions
Generated
+86 -86
View File
@@ -1231,7 +1231,7 @@ dependencies = [
[[package]]
name = "craft"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-automation",
"craft-behavior",
@@ -1272,7 +1272,7 @@ dependencies = [
[[package]]
name = "craft-affinity"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"crc32fast",
"flate2",
@@ -1283,7 +1283,7 @@ dependencies = [
[[package]]
name = "craft-appkit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"block2 0.6.2",
"objc2 0.6.5",
@@ -1295,7 +1295,7 @@ dependencies = [
[[package]]
name = "craft-atomic"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"rustix 1.1.6",
]
@@ -1303,7 +1303,7 @@ dependencies = [
[[package]]
name = "craft-automation"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -1328,7 +1328,7 @@ dependencies = [
[[package]]
name = "craft-behavior"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"accesskit",
"bitflags 2.13.2",
@@ -1346,7 +1346,7 @@ dependencies = [
[[package]]
name = "craft-browse"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-docpath",
@@ -1364,7 +1364,7 @@ dependencies = [
[[package]]
name = "craft-cdr"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"crc32fast",
"flate2",
@@ -1373,7 +1373,7 @@ dependencies = [
[[package]]
name = "craft-cloud-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"egui",
]
@@ -1381,7 +1381,7 @@ dependencies = [
[[package]]
name = "craft-cms"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"md-5",
"rayon",
@@ -1390,12 +1390,12 @@ dependencies = [
[[package]]
name = "craft-codepage"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
[[package]]
name = "craft-color-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-cms",
@@ -1415,7 +1415,7 @@ dependencies = [
[[package]]
name = "craft-control"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-control-protocol",
"craft-platform",
@@ -1426,7 +1426,7 @@ dependencies = [
[[package]]
name = "craft-control-protocol"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"getrandom 0.3.4",
"serde_json",
@@ -1436,7 +1436,7 @@ dependencies = [
[[package]]
name = "craft-dds"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"rayon",
]
@@ -1444,7 +1444,7 @@ dependencies = [
[[package]]
name = "craft-dialogs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"block2 0.6.2",
"craft-appkit",
@@ -1470,7 +1470,7 @@ dependencies = [
[[package]]
name = "craft-doc"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"blake3",
"craft-ecproj-format",
@@ -1486,7 +1486,7 @@ dependencies = [
[[package]]
name = "craft-docpath"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"serde",
]
@@ -1494,7 +1494,7 @@ dependencies = [
[[package]]
name = "craft-draw"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1513,7 +1513,7 @@ dependencies = [
[[package]]
name = "craft-dxf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-codepage",
"encoding_rs",
@@ -1525,7 +1525,7 @@ dependencies = [
[[package]]
name = "craft-ecproj-format"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"serde",
"serde_json",
@@ -1535,12 +1535,12 @@ dependencies = [
[[package]]
name = "craft-eps"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
[[package]]
name = "craft-font-catalog"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"fontique",
"harfrust 0.13.3",
@@ -1555,7 +1555,7 @@ dependencies = [
[[package]]
name = "craft-font-manager"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-font-catalog",
@@ -1574,7 +1574,7 @@ dependencies = [
[[package]]
name = "craft-font-os-windows"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"windows-registry",
"windows-sys 0.61.2",
@@ -1583,7 +1583,7 @@ dependencies = [
[[package]]
name = "craft-font-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"cap-primitives",
"craft-atomic",
@@ -1606,12 +1606,12 @@ dependencies = [
[[package]]
name = "craft-fonts-build"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
[[package]]
name = "craft-gif"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"gif",
]
@@ -1619,7 +1619,7 @@ dependencies = [
[[package]]
name = "craft-gzip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"flate2",
]
@@ -1627,7 +1627,7 @@ dependencies = [
[[package]]
name = "craft-host"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"bitflags 2.13.2",
"craft-i18n",
@@ -1640,7 +1640,7 @@ dependencies = [
[[package]]
name = "craft-i18n"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"brotli 9.1.3",
"brotli-decompressor 6.3.2",
@@ -1670,7 +1670,7 @@ dependencies = [
[[package]]
name = "craft-image-codecs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-dds",
"craft-jpeg",
@@ -1697,7 +1697,7 @@ dependencies = [
[[package]]
name = "craft-imaging"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-color-ui",
@@ -1715,7 +1715,7 @@ dependencies = [
[[package]]
name = "craft-jpeg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"thiserror 2.0.21",
]
@@ -1723,7 +1723,7 @@ dependencies = [
[[package]]
name = "craft-jxl"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"brotli-decompressor 5.0.3",
"jixel",
@@ -1734,7 +1734,7 @@ dependencies = [
[[package]]
name = "craft-keymap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-host",
"craft-i18n",
@@ -1749,7 +1749,7 @@ dependencies = [
[[package]]
name = "craft-layers"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-i18n",
@@ -1763,7 +1763,7 @@ dependencies = [
[[package]]
name = "craft-menu"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-host",
@@ -1781,7 +1781,7 @@ dependencies = [
[[package]]
name = "craft-metadata"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"brotli-decompressor 6.3.2",
"chrono",
@@ -1793,7 +1793,7 @@ dependencies = [
[[package]]
name = "craft-metafile"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"encoding_rs",
"image",
@@ -1804,7 +1804,7 @@ dependencies = [
[[package]]
name = "craft-mime"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"chrono",
"craft-codepage",
@@ -1814,7 +1814,7 @@ dependencies = [
[[package]]
name = "craft-nightly"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"uds_windows",
"winsafe",
@@ -1823,7 +1823,7 @@ dependencies = [
[[package]]
name = "craft-pages"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -1839,7 +1839,7 @@ dependencies = [
[[package]]
name = "craft-pcraft-format"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"flate2",
"serde",
@@ -1850,7 +1850,7 @@ dependencies = [
[[package]]
name = "craft-pdf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"hayro-interpret",
"hayro-syntax",
@@ -1862,7 +1862,7 @@ dependencies = [
[[package]]
name = "craft-platform"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"async-channel",
"async-io",
@@ -1895,7 +1895,7 @@ dependencies = [
[[package]]
name = "craft-plotter"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"kurbo 0.13.1",
"thiserror 2.0.21",
@@ -1904,7 +1904,7 @@ dependencies = [
[[package]]
name = "craft-print"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-host",
@@ -1928,7 +1928,7 @@ dependencies = [
[[package]]
name = "craft-proof"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"log",
"miniz_oxide 0.9.1",
@@ -1939,7 +1939,7 @@ dependencies = [
[[package]]
name = "craft-ps"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-eps",
"flate2",
@@ -1953,7 +1953,7 @@ dependencies = [
[[package]]
name = "craft-psd"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"encoding_rs",
"flate2",
@@ -1964,7 +1964,7 @@ dependencies = [
[[package]]
name = "craft-quit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"dispatch2",
"egui",
@@ -1977,7 +1977,7 @@ dependencies = [
[[package]]
name = "craft-review"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"base64 0.23.1",
"craft-behavior",
@@ -1996,7 +1996,7 @@ dependencies = [
[[package]]
name = "craft-settings"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-atomic",
"craft-host",
@@ -2013,7 +2013,7 @@ dependencies = [
[[package]]
name = "craft-stream-codecs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"fax",
"hayro-ccitt",
@@ -2024,7 +2024,7 @@ dependencies = [
[[package]]
name = "craft-svg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-image-codecs",
"craft-xml",
@@ -2045,7 +2045,7 @@ dependencies = [
[[package]]
name = "craft-table"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2057,7 +2057,7 @@ dependencies = [
[[package]]
name = "craft-text"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-font-manager",
@@ -2082,7 +2082,7 @@ dependencies = [
[[package]]
name = "craft-theme"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"bitflags 2.13.2",
"craft-tracked",
@@ -2097,7 +2097,7 @@ dependencies = [
[[package]]
name = "craft-theme-store"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-atomic",
"craft-behavior",
@@ -2112,7 +2112,7 @@ dependencies = [
[[package]]
name = "craft-tiff"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2122,7 +2122,7 @@ dependencies = [
[[package]]
name = "craft-time"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -2131,7 +2131,7 @@ dependencies = [
[[package]]
name = "craft-timeline"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-keymap",
@@ -2146,12 +2146,12 @@ dependencies = [
[[package]]
name = "craft-tracked"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
[[package]]
name = "craft-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-cloud-ui",
"craft-ui-canvas",
@@ -2165,7 +2165,7 @@ dependencies = [
[[package]]
name = "craft-ui-canvas"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-i18n",
@@ -2181,7 +2181,7 @@ dependencies = [
[[package]]
name = "craft-ui-contract"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"accesskit",
"craft-behavior",
@@ -2219,7 +2219,7 @@ dependencies = [
[[package]]
name = "craft-ui-macros"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"proc-macro-crate",
"proc-macro2",
@@ -2230,7 +2230,7 @@ dependencies = [
[[package]]
name = "craft-ui-panels"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2248,7 +2248,7 @@ dependencies = [
[[package]]
name = "craft-ui-patterns"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2269,7 +2269,7 @@ dependencies = [
[[package]]
name = "craft-ui-shell"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2290,7 +2290,7 @@ dependencies = [
[[package]]
name = "craft-ui-widgets"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-behavior",
"craft-host",
@@ -2309,7 +2309,7 @@ dependencies = [
[[package]]
name = "craft-update"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"base64 0.22.1",
"chrono",
@@ -2341,7 +2341,7 @@ dependencies = [
[[package]]
name = "craft-vectorcraft-format"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"flate2",
"serde",
@@ -2352,7 +2352,7 @@ dependencies = [
[[package]]
name = "craft-wayland"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"raw-window-handle",
"wayland-backend",
@@ -2362,7 +2362,7 @@ dependencies = [
[[package]]
name = "craft-web-api"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"js-sys",
"serde_json",
@@ -2373,7 +2373,7 @@ dependencies = [
[[package]]
name = "craft-win32"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"winsafe",
]
@@ -2381,7 +2381,7 @@ dependencies = [
[[package]]
name = "craft-window"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"craft-appkit",
"craft-atomic",
@@ -2413,7 +2413,7 @@ dependencies = [
[[package]]
name = "craft-xml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"quick-xml 0.41.0",
"serde",
@@ -3772,7 +3772,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a"
[[package]]
name = "hayro-cmap"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"brotli 8.0.4",
"hayro-postscript",
@@ -3781,7 +3781,7 @@ dependencies = [
[[package]]
name = "hayro-interpret"
version = "0.7.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"bitflags 2.13.2",
"hayro-cmap",
@@ -3799,7 +3799,7 @@ dependencies = [
[[package]]
name = "hayro-jbig2"
version = "0.3.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"fearless_simd",
"hayro-ccitt",
@@ -3817,12 +3817,12 @@ dependencies = [
[[package]]
name = "hayro-postscript"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
[[package]]
name = "hayro-syntax"
version = "0.7.2"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"flate2",
"hayro-ccitt",
@@ -4805,7 +4805,7 @@ dependencies = [
[[package]]
name = "krilla"
version = "0.8.2"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"base64 0.22.1",
"bumpalo",
@@ -4962,7 +4962,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
[[package]]
name = "linesweeper"
version = "0.5.0"
source = "git+https://github.com/storytold/craft-libs?rev=2680a3b3fe464c7afa3d260b33a828fa94e12f6d#2680a3b3fe464c7afa3d260b33a828fa94e12f6d"
source = "git+https://github.com/storytold/craft-libs?rev=a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0#a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0"
dependencies = [
"arrayvec",
"kurbo 0.13.1",
+38 -38
View File
@@ -10,51 +10,51 @@ license = "MIT OR Apache-2.0"
rust-version = "1.95"
[workspace.dependencies]
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d", default-features = false, features = ["interpret", "write"] }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", default-features = false, features = ["interpret", "write"] }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
# Language packs: the Craft apps' shared font store installs them (#4936).
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
# 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 = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
# `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile.
craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d", features = ["pcraft-pixels"] }
craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", features = ["pcraft-pixels"] }
# Native Affinity documents (craft-libs#914).
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
# Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778).
craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
# SVG parsing, limits, SVGZ and writer (craft-libs#778).
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d", features = ["tree"] }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", features = ["tree"] }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
# EPS container, previews, ASCII85 and DSC comments (craft-libs#778).
craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
# DXF tags, reader and writer (craft-libs#778, #926, #927).
craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
# WMF, EMF and EMF+ reader (craft-libs#778).
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d", default-features = false, features = ["read", "write"] }
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", default-features = false, features = ["read", "write"] }
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
# 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 = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
# 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 = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
# Nightly profile isolation, launch protocol, and security fence.
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
# internal
vectorcraft-geom = { path = "crates/geom" }
vectorcraft-color = { path = "crates/color" }
@@ -194,13 +194,13 @@ lto = "thin"
codegen-units = 1
[patch.crates-io]
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
krilla = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
krilla = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0" }
ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
+2 -2
View File
@@ -233,8 +233,8 @@ VectorCraft is under active development. [**ROADMAP.md**](ROADMAP.md) has the st
and what's next; [`docs/target-app-parity.md`](docs/target-app-parity.md) the full parity assessment and
[`docs/gaps.md`](docs/gaps.md) the ranked list of what's missing.
**Where we are (2026-10-10): alpha.** About 88% of core menu items, tools, effects and formats exist
(92.5% of menu items do something), feature depth is ~75%, and we estimate ~65% ready for real work for a mainstream illustrator (~62% across all tracked features): everyday
**Where we are (2026-11-30): alpha.** About 96% of core menu items, tools, effects and formats exist
(99.9% of menu items do something), feature depth is ~79%, and we estimate ~65% ready for real work for a mainstream illustrator (~67% across all tracked features): everyday
vector illustration is close to usable: drawing and path tools,
Pathfinder and Shape Builder, paint, gradients, appearance and transparency, type with styles, threading and Hebrew/Arabic bidirectional layout, and
files (SVG, PDF and PDF-compatible `.ai` with PDF/X, legacy version 7 `.ai` keeping layers, groups and type, EPS, DXF, EMF/WMF, raster formats, PSD out, PSD/PSB opened with their layers and placed as their merged image, JPEG XL in, Print, Package).
+29 -29
View File
@@ -10,7 +10,7 @@ control channel. This page is the summary; the evidence is in [`docs/target-app-
and the work list in [`docs/gaps.md`](docs/gaps.md).
**Why alpha:** the core workflows exist end to end (drawing and path editing, Pathfinder, paint and appearance,
type, SVG/PDF/EPS, print, export) and feature depth is ~75%, but a professional can't yet switch: Illustrator's
type, SVG/PDF/EPS, print, export) and feature depth is ~79%, but a professional can't yet switch: Illustrator's
own `.ai` files open with a wrong layer structure in real cases and are saved back with an editing copy that
keeps live effects only on paths, compound paths and groups that qualify (at most a fill and a stroke, a non-zero fill rule when filled, no large canvas) and whose appearance and effects the art-style writer supports (see [docs/file-format-parity.md](docs/file-format-parity.md)), and writes live objects as their art, the interaction details have never been checked side by side, and some machines fail to start the
app. Beta needs those closed (the beta list in [gaps.md](docs/gaps.md)). It passes the core-workflow
@@ -24,8 +24,8 @@ blocking it ([Alpha gate](docs/roadmap.md#alpha-gate)).
| | Value | Kind |
|---|---|---|
| **Feature breadth** (Illustrator's menu items, tools, effects, formats exist) | **~88%** | measured in part: menu items 717/719 wired (99.7%), tools 89/92, Illustrator effects 46/50, Photoshop effects 57/57, 3D 4/4 (initial types, no materials) |
| **Feature depth** (weighted by use, scored by behaviour) | **~75%** | estimated |
| **Feature breadth** (Illustrator's menu items, tools, effects, formats exist) | **~96%** | measured in part: menu items 815/816 wired (99.9%), tools 91/92, Illustrator effects 50/50, Photoshop effects 57/57, 3D 4/4 plus 3 Classic (initial types, graphics on the Materials page (#6960), no base materials) |
| **Feature depth** (weighted by use, scored by behaviour) | **~79%** | estimated |
| **To beta** | **~170–270 h** one agent · ~50–80 h with 4–6 agents | estimated |
| **To full parity** | **~360–590 h** one agent · ~95–165 h with 4–6 agents | estimated |
@@ -33,9 +33,9 @@ blocking it ([Alpha gate](docs/roadmap.md#alpha-gate)).
| Audience | Ready % | Opus 5.5 agent hours to ~95% (one agent) | With 4–6 agents | Work that dominates |
|---|---:|---:|---:|---|
| **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 |
| **Full Illustrator** (ready for real work; decides the stage) | **~67%** (62–72%) | **~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 depth (4–8 h; #937's reproduced case is fixed, unconfirmed on the reporter's file), UI polish |
| **Essentials user** | **~77%** (72–82%) | **~60–105 h** | ~25–45 h | launch and stability on Windows (20–35 h), the Windows print crashes (#8021, #9261), help articles 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).
@@ -46,15 +46,15 @@ everything is measured from our code against Illustrator's public documentation.
| Dimension | % | One agent (h) | Doc |
|---|---:|---:|---|
| Features (depth) | 75% | 220–360 | [target-app-parity.md](docs/target-app-parity.md) |
| UI/UX fidelity | 55% | 70–110 | [ui-parity.md](docs/ui-parity.md) |
| Features (depth) | 79% | 220–360 | [target-app-parity.md](docs/target-app-parity.md) |
| UI/UX fidelity | 60% | 70–110 | [ui-parity.md](docs/ui-parity.md) |
| File formats | 75% | 15–30 | [file-format-parity.md](docs/file-format-parity.md) |
| Hardware (GPU, pen, touch, displays) | 35% | 25–45 | [hardware-parity.md](docs/hardware-parity.md) |
| Localization (12 key languages) | 74% (measured) | 50–85 | [localization-parity.md](docs/localization-parity.md) |
| Hardware (GPU, pen, touch, displays) | 45% | 25–45 | [hardware-parity.md](docs/hardware-parity.md) |
| Localization (12 key languages) | 87% (measured) | 50–85 | [localization-parity.md](docs/localization-parity.md) |
| Performance | ~60% | 15–25 | [gaps.md › G15](docs/gaps.md#g15-performance-budgets-and-a-gpu-renderer) |
| Stability | ~60% | 30–50 | [gaps.md › G10](docs/gaps.md#g10-launch-and-stability-on-real-machines) |
| Platforms | 80% | 15–25 | [gaps.md › G8](docs/gaps.md#g8-hardening-at-scale) |
| Ecosystem and plug-ins | 15% | 30–60 | [gaps.md › G17](docs/gaps.md#g17-ecosystem-third-party-plug-ins) |
| Stability | ~55% | 30–50 | [gaps.md › G10](docs/gaps.md#g10-launch-and-stability-on-real-machines) |
| Platforms | 82% | 15–25 | [gaps.md › G8](docs/gaps.md#g8-hardening-at-scale) |
| Ecosystem and plug-ins | 30% | 30–60 | [gaps.md › G17](docs/gaps.md#g17-ecosystem-third-party-plug-ins) |
| AI features (generative) | 0% | 30–60 + owner decision | [gaps.md › G18](docs/gaps.md#g18-generative-ai-features) |
| Agent automation | beyond Illustrator | — | [mcp.md](docs/mcp.md) |
@@ -64,26 +64,26 @@ The dimension hours overlap (feature rows hold some UI, format and AI work), so
| Area | % | One agent (h) |
|---|---:|---:|
| Selection, transform & align | 85% | 4–6 |
| Drawing tools | 85% | 8–13 |
| Path operations, Pathfinder, Shape Builder, Live Paint | 80% | 4–8 |
| Selection, transform & align | 86% | 4–6 |
| Drawing tools | 88% | 8–13 |
| Path operations, Pathfinder, Shape Builder, Live Paint | 85% | 4–8 |
| Colour, swatches, gradients, patterns, mesh, recolor | 92% | 4–7 |
| Strokes, brushes, width profiles | 88% | 8–15 |
| Strokes, brushes, width profiles | 90% | 8–15 |
| Appearance, transparency, graphic styles, masks | 97% | 1–2 |
| Live vector effects | 85% | 4–8 |
| Raster effects (Effect Gallery) — [effects-parity.md](docs/effects-parity.md) | 88% | — |
| 3D and Materials | ~25% | 30–55 |
| Type core — [type-parity.md](docs/type-parity.md) | 80% | 14–19 |
| Type advanced (CJK, spelling, Touch Type) | 50% | 20–28 |
| Symbols, blends, envelopes, Repeat, perspective | 88% | 4–7 |
| Image Trace, graphs, image tools | 75% | 5–8 |
| Layers, artboards, document setup | 78% | 5–8 |
| View & navigation | 70% | 9–14 |
| Live vector effects | 90% | 4–8 |
| Raster effects (Effect Gallery) — [effects-parity.md](docs/effects-parity.md) | 55% | — |
| 3D and Materials | ~35% | 30–55 |
| Type core — [type-parity.md](docs/type-parity.md) | 83% | 14–19 |
| Type advanced (CJK, spelling, Touch Type) | 60% | 20–28 |
| Symbols, blends, envelopes, Repeat, perspective | 90% | 4–7 |
| Image Trace, graphs, image tools | 78% | 5–8 |
| Layers, artboards, document setup | 82% | 5–8 |
| View & navigation | 80% | 9–14 |
| Guides, grids, smart guides, snapping | 80% | 4–7 |
| File formats — [file-format-parity.md](docs/file-format-parity.md) | 75% | 10–20 |
| Export for Screens, Asset Export, slices | 85% | 2–4 |
| Export for Screens, Asset Export, slices | 87% | 2–4 |
| Print, colour management, separations | 80% | 2–4 |
| Automation (Actions, Variables, scripting) | 60% | 8–14 |
| Automation (Actions, Variables, scripting) | 80% | 8–14 |
| UI chrome (panels, Properties, preferences) | 80% | 13–20 |
| Libraries, Links, Package | 82% | 2–3 |
| Generative AI | 0% | 30–60 |
@@ -95,7 +95,7 @@ Weights, evidence and the missing items per area: [target-app-parity.md](docs/ta
| Language | Code | Status | Translated |
|---|---|---|---:|
| English | `en` | full | 100% |
| Simplified Chinese | `zh-hans` | partial (messages in English) | 85% |
| Simplified Chinese | `zh-hans` | partial (messages translated, #2578) | 85% |
| Spanish | `es` | full | 100% |
| Hindi | `hi` | catalog complete; machine-assisted draft, native review pending | complete under the scanner |
| Gujarati | `gu` | 4,673 contributor-reviewed catalog rows; 11 corrections applied to the 387 additions | menus and dialogs; status/error messages partial |
@@ -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: 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.
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 (#5221, #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
+1 -1
View File
@@ -28,7 +28,7 @@ egui_extras = { workspace = true }
# `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback.
eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] }
# The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft.
craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d", version = "0.1.0" }
craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0", version = "0.1.0" }
wasm-bindgen = "0.2"
serde_json = { workspace = true }
+1 -1
View File
@@ -171,7 +171,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Nudge in Perspective",
[],
None,
"{dx, dy: arrow direction (-1, 0 or 1), big?: bool (×10), copy?: bool} move the selection in perspective by the keyboard increment, as the arrow keys do with the Perspective Selection tool → {ids}",
"{dx, dy: arrow direction (-1, 0 or 1), big?: bool (×10), fine?: bool (÷10; with big, one increment), copy?: bool} move the selection in perspective by the keyboard increment (Snap to Grid doesn't apply), as the arrow keys do with the Perspective Selection tool → {ids}",
has_selection,
persp_nudge
),
@@ -563,13 +563,16 @@ pub(super) fn plane_match(s: &mut Session, p: &Value) -> Result<Value> {
Ok(json!({ "plane": plane.id(), "offset": depth }))
}
/// `perspective.nudge`, the arrow keys with the Perspective Selection tool: the selection moves
/// within its plane by [`nudge_step`](crate::cmd::object::nudge_step), measured on the page at the
/// centre of its perspective box, without Snap to Grid.
pub(super) fn persp_nudge(s: &mut Session, p: &Value) -> Result<Value> {
const C: &str = "perspective.nudge";
let (dx, dy) = (number_or(p, "dx", 0.0, C)?, number_or(p, "dy", 0.0, C)?);
if !(dx.is_finite() && dy.is_finite()) || (dx == 0.0 && dy == 0.0) {
return Err(bad(C, "dx and dy give the arrow's direction"));
}
let k = s.prefs.keyboard_increment * if switch_or(p, "big", false, C)? { 10.0 } else { 1.0 };
let k = crate::cmd::object::nudge_step(s.prefs.keyboard_increment, switch_or(p, "big", false, C)?, switch_or(p, "fine", false, C)?);
let copy = switch_or(p, "copy", false, C)?;
let ids = selected_roots(s)?;
// The step is measured on the page at the centre of the selection's perspective box.
@@ -578,7 +581,12 @@ pub(super) fn persp_nudge(s: &mut Session, p: &Value) -> Result<Value> {
let (plane, depth, rect) = g.plane_bounds(&st.doc, &ids).ok_or_else(|| EngineError::Other("the selection isn't in perspective".into()))?;
let from = g.homography_at(plane, depth).and_then(|h| h.apply(rect.center())).ok_or_else(beyond_horizon)?;
let to = from + vectorcraft_geom::Vec2::new(dx.clamp(-1.0, 1.0), dy.clamp(-1.0, 1.0)) * k;
persp_move(s, &json!({"ids": ids.iter().map(|i| i.0).collect::<Vec<_>>(), "from": [from.x, from.y], "to": [to.x, to.y], "copy": copy}))
// The arrow keys move by the step: Snap to Grid would pull an edge on a gridline back onto it,
// so a nudge smaller than a quarter cell would move nothing.
persp_move(
s,
&json!({"ids": ids.iter().map(|i| i.0).collect::<Vec<_>>(), "from": [from.x, from.y], "to": [to.x, to.y], "copy": copy, "snap": false}),
)
}
pub(super) fn persp_draw(s: &mut Session, p: &Value) -> Result<Value> {
+1 -1
View File
@@ -41,5 +41,5 @@ pub(crate) use pixelgrid::{
snap_if_aligned, snap_symbol_art,
};
pub(super) use shape::recut;
pub(crate) use transform::{apply_transform, preview_copies, scaling, transform_node, transform_patterns, transforms_objects};
pub(crate) use transform::{apply_transform, nudge_step, preview_copies, scaling, transform_node, transform_patterns, transforms_objects};
pub use transform::{reflect_axis, scale_factors, shear_tangent};
+1 -1
View File
@@ -79,7 +79,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Nudge",
[],
None,
"{dx: -1|0|1, dy: -1|0|1, big?: bool (×10), copy?: bool, patterns?: bool (Transform Patterns: pattern fills and strokes transform with the objects that move whole; default: prefs transformPatternTiles), typeAreas?: bool (area type: the frame is reshaped and the text reflows at its size), objects?: bool (Transform Objects, as object.move), interpolate?: bool (as path.moveAnchors's; default: prefs interpolateControlPoints)} arrow-key nudge by the keyboard increment (the selected anchors (a selected curved segment bends instead: its anchors stay and its handles keep their directions while its middle moves by the step), else objects, along the x and y axes turned by the constrainAngle preference; else ruler guides, along the page axes)",
"{dx: -1|0|1, dy: -1|0|1, big?: bool (×10), fine?: bool (÷10; with big, one increment), copy?: bool, patterns?: bool (Transform Patterns: pattern fills and strokes transform with the objects that move whole; default: prefs transformPatternTiles), typeAreas?: bool (area type: the frame is reshaped and the text reflows at its size), objects?: bool (Transform Objects, as object.move), interpolate?: bool (as path.moveAnchors's; default: prefs interpolateControlPoints)} arrow-key nudge by the keyboard increment (the selected anchors (a selected curved segment bends instead: its anchors stay and its handles keep their directions while its middle moves by the step), else objects, along the x and y axes turned by the constrainAngle preference; else ruler guides, along the page axes)",
has_selection_or_guides,
nudge
),
+7 -2
View File
@@ -438,11 +438,16 @@ pub(crate) fn along_constrain_angle(dx: f64, dy: f64, deg: f64) -> (f64, f64) {
(v.x, v.y)
}
pub(crate) use vectorcraft_tools::nudge_step;
/// `object.nudge`, the arrow keys: the selected anchors, else the selected objects (and the guides
/// that move with them), else the selected ruler guides move by [`nudge_step`] in the arrow's
/// direction, in one undo step.
pub(super) fn nudge(s: &mut Session, p: &Value) -> Result<Value> {
check_numbers(p, &["dx", "dy"], "object.nudge")?;
check_switches(p, &TRANSFORM_SWITCHES, "object.nudge")?;
check_switches(p, &["big", "interpolate"], "object.nudge")?;
let k = s.prefs.keyboard_increment * if bool_or(p, "big", false) { 10.0 } else { 1.0 };
check_switches(p, &["big", "fine", "interpolate"], "object.nudge")?;
let k = nudge_step(s.prefs.keyboard_increment, bool_or(p, "big", false), bool_or(p, "fine", false));
let (dx, dy) = (f64_or(p, "dx", 0.0) * k, f64_or(p, "dy", 0.0) * k);
// Guides keep to the page's axes; art and anchors move along the constrain angle's.
let (gx, gy) = (dx, dy);
+26 -7
View File
@@ -4,11 +4,11 @@
use serde_json::{Value, json};
use vectorcraft_geom::{Rect, Vec2, rotate_deg};
use super::edit::{copy_above, selected_roots};
use super::edit::selected_roots;
use super::object::group_nodes;
use super::{Affine, CommandSpec, NodeId, Result, Session, bad, check_numbers, check_switches, cmd, has_selection, switch_or};
use crate::EngineError;
use vectorcraft_doc::Scaling;
use vectorcraft_doc::{Node, Scaling};
const CMD: &str = "object.stepAndRepeat";
const MAX_CELLS: usize = 10_000;
@@ -20,7 +20,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Step and Repeat…",
["Object", "Transform"],
None,
"{rows?: n (default 1), columns?: n (default 1), fill?: bool (rows and columns are as many as fit the sheet, ignoring `rows` and `columns`; the first copy goes to the sheet's top-left corner plus `margin`), sheet?: {x, y, width, height} (pt; default the artboard that holds the selection's center, else the first), margin?: pt (fill only, default 0), gap?: pt (between neighbors, both axes), gapX?: pt, gapY?: pt (default `gap`, default 0; measured between the bounds of `cutId`, else of the selection, not between centers), cutId?: id (a selected object whose geometric bounds measure the spacing and the 180° turn; default the selection), rotate?: \"none\"|\"columns\"|\"rows\" (turn every other column or row by 180° about its cell's center, the same clockwise or counter-clockwise; default none), patterns?: bool} copy the selection into a grid of cells, left to right and top to bottom, the first cell being the selection itself (moved to the sheet's corner with fill); copies of pixel-aligned objects stay on the pixel grid, so a fractional gap between them is rounded to it, and gaps of other objects are exact; a selection of several objects is grouped first, so that a cut contour stays with its artwork in every copy; one undo step; the copies are selected → {ids: [id…], rows, columns, count}",
"{rows?: n (default 1), columns?: n (default 1), fill?: bool (rows and columns are as many as fit the sheet, ignoring `rows` and `columns`; the first copy goes to the sheet's top-left corner plus `margin`), sheet?: {x, y, width, height} (pt; default the artboard that holds the selection's center, else the first), margin?: pt (fill only, default 0, not negative), gap?: pt (between neighbors, both axes), gapX?: pt, gapY?: pt (default `gap`, default 0; measured between the bounds of `cutId`, else of the selection, not between centers; a negative gap overlaps neighbors and must be smaller than the width or height it is between), cutId?: id (a selected object whose geometric bounds measure the spacing and the 180° turn; default the selection), rotate?: \"none\"|\"columns\"|\"rows\" (turn every other column or row by 180° about its cell's center, the same clockwise or counter-clockwise; default none), patterns?: bool} copy the selection into a grid of cells, left to right and top to bottom, the first cell being the selection itself (moved to the sheet's corner with fill); copies of pixel-aligned objects stay on the pixel grid, so a fractional gap between them is rounded to it, and gaps of other objects are exact; a selection of several objects is grouped first, so that a cut contour stays with its artwork in every copy; one undo step; the copies are selected → {ids: [id…], rows, columns, count}",
has_selection,
step_and_repeat
)]
@@ -119,6 +119,9 @@ fn step_and_repeat(s: &mut Session, p: &Value) -> Result<Value> {
if !(gx.is_finite() && gy.is_finite() && margin.is_finite()) {
return Err(bad(CMD, "gaps and margin must be finite"));
}
if margin < 0.0 {
return Err(bad(CMD, "`margin` must be 0 or more"));
}
let (rows, cols) = if fill { (1, 1) } else { (count_param(p, "rows")?, count_param(p, "columns")?) };
let sheet = sheet_param(p)?;
let mut roots = selected_roots(s)?;
@@ -148,6 +151,9 @@ fn step_and_repeat(s: &mut Session, p: &Value) -> Result<Value> {
if !(w.is_finite() && h.is_finite()) || w <= 0.0 || h <= 0.0 {
return Err(EngineError::Other("the selection has no area to repeat".into()));
}
if w + gx <= EPS || h + gy <= EPS {
return Err(bad(CMD, "a negative gap must be smaller than the width or height it is between"));
}
let anchor = if fill {
let sheet = sheet.or_else(|| {
let c = d.bounds_of(&roots, false).unwrap_or(b).center();
@@ -180,6 +186,9 @@ fn step_and_repeat(s: &mut Session, p: &Value) -> Result<Value> {
if roots.len() > 1 {
roots = vec![group_nodes(d, &roots)?];
}
// Every copy is made first, and all of them go in with one insertion.
let originals: Vec<(NodeId, Node)> = roots.iter().filter_map(|id| d.node(*id).map(|n| (*id, n.clone()))).collect();
let mut lists: Vec<(NodeId, Vec<Node>)> = originals.iter().map(|(id, _)| (*id, Vec::with_capacity(cells.len()))).collect();
let mut copied: Vec<NodeId> = vec![];
let mut first = Affine::IDENTITY;
for c in &cells {
@@ -188,11 +197,21 @@ fn step_and_repeat(s: &mut Session, p: &Value) -> Result<Value> {
first = m;
continue;
}
let copies = copy_above(d, &roots, |_, _, n| {
for ((_, original), (_, list)) in originals.iter().zip(lists.iter_mut()) {
let mut n = d.reid(original);
n.transform(m, sc);
super::object::keep_pixel_aligned(n, sc);
})?;
copied.extend(copies);
super::object::keep_pixel_aligned(&mut n, sc);
copied.push(n.id);
list.push(n);
}
}
if !copied.is_empty() {
// The copy of the last cell goes directly above its original and the first cell's on top.
for (_, list) in &mut lists {
list.reverse();
}
d.insert_beside(lists, false)?;
super::typecmd::refresh_bounds_of(d, &copied);
}
if first != Affine::IDENTITY {
for id in &roots {
@@ -131,6 +131,46 @@ fn rejects_bad_params_and_a_selection_that_does_not_fit() {
assert!(e.execute(CMD, &json!({})).is_err());
}
#[test]
fn rejects_a_negative_margin_and_gaps_that_fold_the_grid_back() {
let (mut s, _) = setup();
let steps = undo_steps(&s);
assert!(s.execute(CMD, &json!({"fill": true, "margin": -5})).is_err());
assert!(s.execute(CMD, &json!({"rows": 1, "columns": 3, "gapX": -50})).is_err());
assert!(s.execute(CMD, &json!({"rows": 3, "columns": 1, "gapY": -40})).is_err());
assert!(s.execute(CMD, &json!({"fill": true, "gap": -50})).is_err());
assert_eq!(undo_steps(&s), steps, "a refusal records no undo step");
let r = s.execute(CMD, &json!({"rows": 1, "columns": 2, "gapX": -10})).unwrap();
assert_eq!(bounds(&s, r["ids"][1].as_u64().unwrap()), (40.0, 0.0, 90.0, 30.0), "a gap above minus the width overlaps neighbors");
}
#[test]
fn copies_go_in_with_one_walk_of_the_document_whatever_the_count() {
let walks = |columns: u64| {
let (mut s, _) = setup();
for i in 0..50 {
s.execute("shape.rectangle", &json!({"x": 0, "y": 100 + i, "width": 5, "height": 5})).unwrap();
}
let id = s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 2, "height": 2})).unwrap()["id"].as_u64().unwrap();
s.execute("select.set", &json!({"ids": [id]})).unwrap();
let before = vectorcraft_doc::tree_walks();
let r = s.execute(CMD, &json!({"rows": 1, "columns": columns, "gap": 1})).unwrap();
assert_eq!(r["count"], json!(columns));
vectorcraft_doc::tree_walks() - before
};
assert_eq!(walks(40), walks(2), "the walks of the document do not grow with the number of copies");
}
#[test]
fn the_last_cells_copy_sits_directly_above_the_original() {
let (mut s, id) = setup();
let r = s.execute(CMD, &json!({"rows": 1, "columns": 3, "gap": 1})).unwrap();
let ids: Vec<u64> = r["ids"].as_array().unwrap().iter().map(|i| i.as_u64().unwrap()).collect();
let d = &s.doc().unwrap().doc;
let order: Vec<u64> = d.layers[0].children().unwrap().iter().map(|n| n.id.0).collect();
assert_eq!(order, [id, ids[2], ids[1]]);
}
#[test]
fn fill_ignores_explicit_counts() {
let (mut s, _) = setup();
+91 -20
View File
@@ -643,10 +643,12 @@ fn item_ref(h: &Host, st: &DocState, id: NodeId) -> Data {
}
/// The ids of a document's page items, topmost first, each group or compound path before the
/// objects in it ([`State`] keeps the lists of the last documents read).
fn page_items(h: &Host, st: &DocState) -> Rc<Vec<NodeId>> {
/// objects in it ([`State`] keeps the lists of the last documents read). Building the list again,
/// after an edit or for another document, counts against the run's host-call allowance as a list
/// of that many objects does ([`list_charge`]).
fn page_items(h: &Host, st: &DocState) -> std::result::Result<Rc<Vec<NodeId>>, HostError> {
if let Some(ids) = kept_items(&h.dom.items.borrow(), st.uid, &st.doc) {
return ids;
return Ok(ids);
}
fn walk(nodes: &[Arc<crate::doc::Node>], out: &mut Vec<NodeId>) {
for n in nodes.iter().rev() {
@@ -664,9 +666,16 @@ fn page_items(h: &Host, st: &DocState) -> Rc<Vec<NodeId>> {
}
let mut ids = Vec::new();
walk(&st.doc.layers, &mut ids);
h.charge_call(list_charge(ids.len()))?;
let ids = Rc::new(ids);
keep_items(&mut h.dom.items.borrow_mut(), (st.uid, st.doc.clone(), ids.clone()));
ids
Ok(ids)
}
/// The bytes a list of `n` objects that a collection builds again counts against the run's
/// host-call allowance, as the selection's list counts them ([`selection_of`]).
pub(super) fn list_charge(n: usize) -> u64 {
16u64.saturating_mul(n as u64)
}
/// The objects directly in the layers and sublayers of a document: what deleting every page item
@@ -943,8 +952,8 @@ fn on_doc_steps<T>(
restored = restore_layer(h, uid, layer.0, &layer.1);
}
}
// The document that was active is active again before any error is given: `f`'s error first,
// then the selection's, then the switch back's.
// The document that was active is active again before any error is given: an error that ends
// the run first, then `f`'s error, then the selection's, then the switch back's.
let back = match active {
Some(a) if switch => command(h, "document.activate", &json!({"index": a})).map(drop),
_ => Ok(()),
@@ -956,12 +965,35 @@ fn on_doc_steps<T>(
{
st.activated = activated;
}
first_error(r, restored, back)
}
/// [`on_doc`]'s result from `f`'s result `r`, then putting back the selection and the layer
/// (`restored`) and the active document (`back`): an error that ends the run first, since a
/// script could catch `f`'s ordinary error, then the first error in that order.
fn first_error<T>(
r: std::result::Result<T, HostError>,
restored: std::result::Result<(), HostError>,
back: std::result::Result<(), HostError>,
) -> std::result::Result<T, HostError> {
if !r.as_ref().is_err_and(ends_run) {
restored.as_ref().err().into_iter().chain(back.as_ref().err()).find(|e| ends_run(e)).map_or(Ok(()), |e| Err(e.clone()))?;
}
let v = r?;
restored?;
back?;
Ok(v)
}
/// Whether `e` ends the run, so that a script cannot catch it.
fn ends_run(e: &HostError) -> bool {
match e {
HostError::Abort(_) => true,
HostError::Marked { error, .. } => ends_run(error),
_ => false,
}
}
/// Marks stale the style objects whose styles a command the run ran removed or renamed.
pub(super) fn after_kept_command(h: &Host) {
text::styles::after_command(h);
@@ -1055,13 +1087,13 @@ fn app_set_coords(h: &Host, a: &[Data]) -> Answer {
Ok(Data::Undefined)
}
/// A path as `getIsFileOpen` compares it: `\` and `/` alike, and on Windows paths (a drive letter
/// or a `\`) letters in one case.
/// A path as `getIsFileOpen` compares it. A Windows path (any path on Windows, or one that starts
/// with a drive letter) takes `\` and `/` alike and letters in one case. On other systems `\` is a
/// character of a file name, so `/work/a\b.ai` and `/work/a/b.ai` are different files.
fn path_key(p: &str) -> String {
let windows = p.contains('\\') || p.as_bytes().get(1) == Some(&b':');
let p = p.replace('\\', "/");
let p = p.trim_end_matches('/').to_string();
if windows { p.to_lowercase() } else { p }
let b = p.as_bytes();
let windows = cfg!(windows) || (b.len() >= 2 && b[0].is_ascii_alphabetic() && b[1] == b':');
if windows { p.replace('\\', "/").trim_end_matches('/').to_lowercase() } else { p.trim_end_matches('/').to_string() }
}
/// `app.redraw()`: returns without changing anything. The app draws a frame between the run's
@@ -1545,6 +1577,13 @@ fn docs_add_document(h: &Host, a: &[Data]) -> Answer {
})
}
/// `documents.addDocumentNoUI(startupPreset)`: a new document from the New Document profile
/// `startupPreset` names, as `addDocument(startupPreset)` makes it, without the New Document
/// dialog. Arguments after `startupPreset` are ignored.
fn docs_add_document_no_ui(h: &Host, a: &[Data]) -> Answer {
docs_add_document(h, &a[..a.len().min(2)])
}
/// `new DocumentPreset()`: a record of new-document settings with the defaults the help page
/// <https://ai-scripting.docsforadobe.dev/jsobjref/DocumentPreset/> gives; the other settings are
/// left out. The settings stay with the run, which hands the script an object of the
@@ -1623,6 +1662,19 @@ fn preset_of(h: &Host, d: &Data) -> Option<usize> {
(i < h.dom.presets.borrow().len()).then_some(i)
}
/// `DocumentPreset.typename`: a `TypeError` for a preset from an earlier run, as its settings give.
fn preset_typename(h: &Host, a: &[Data]) -> Answer {
preset_of(h, arg(a, 0)).ok_or_else(|| HostError::Type("this is not a DocumentPreset".into()))?;
Ok(text("DocumentPreset"))
}
/// `DocumentPreset.toString()`: `[DocumentPreset]`, or a `TypeError` for a preset from an earlier
/// run.
fn preset_to_string(h: &Host, a: &[Data]) -> Answer {
preset_of(h, arg(a, 0)).ok_or_else(|| HostError::Type("this is not a DocumentPreset".into()))?;
Ok(text("[DocumentPreset]"))
}
/// The enumeration whose values the `DocumentPreset` setting `key` takes, when it takes one.
fn preset_enum(key: &str) -> Option<&'static str> {
Some(match key {
@@ -2106,7 +2158,7 @@ fn items_length(h: &Host, a: &[Data]) -> Answer {
return layers::scoped_length(h, a);
}
let doc = items_doc(h, a)?;
let n = with_doc(h, doc, |_, st| page_items(h, st).len());
let n = with_doc(h, doc, |_, st| page_items(h, st).map(|ids| ids.len()))?;
Ok(num(float(n as u64)))
}
@@ -2160,7 +2212,7 @@ fn items_at(h: &Host, a: &[Data]) -> Answer {
r => r,
},
Data::Number(n) => match position(*n) {
Some(i) => Ok(item_at(h, doc, i)),
Some(i) => item_at(h, doc, i),
None => match items_named(h, doc, &vectorcraft_js::number_to_string(*n)) {
Err(HostError::Error(e)) if e == NOT_FOUND => Ok(Data::Undefined),
r => r,
@@ -2171,8 +2223,8 @@ fn items_at(h: &Host, a: &[Data]) -> Answer {
}
/// The object at position `i` of `pageItems`, or `undefined` past the end.
fn item_at(h: &Host, doc: Doc, i: usize) -> Data {
with_doc(h, doc, |_, st| page_items(h, st).get(i).map_or(Data::Undefined, |id| item_ref(h, st, *id)))
fn item_at(h: &Host, doc: Doc, i: usize) -> Answer {
with_doc(h, doc, |_, st| Ok(page_items(h, st)?.get(i).map_or(Data::Undefined, |id| item_ref(h, st, *id))))
}
fn items_by_name(h: &Host, a: &[Data]) -> Answer {
@@ -2187,7 +2239,7 @@ fn items_by_name(h: &Host, a: &[Data]) -> Answer {
/// The first object of `pageItems` named `name`, or `Not found`.
fn items_named(h: &Host, doc: Doc, name: &str) -> Answer {
with_doc(h, doc, |_, st| {
let ids = page_items(h, st);
let ids = page_items(h, st)?;
h.charge_call(ids.len() as u64)?;
let id = ids.iter().find(|i| st.doc.node(**i).and_then(|n| n.name.as_deref()) == Some(name));
id.map(|id| item_ref(h, st, *id)).ok_or_else(|| HostError::Error(NOT_FOUND.into()))
@@ -2202,7 +2254,7 @@ fn items_index(h: &Host, a: &[Data]) -> Answer {
Data::String(_) => items_by_name(h, a),
Data::Number(n) => {
let doc = items_doc(h, a)?;
match position(*n).map(|i| item_at(h, doc, i)) {
match position(*n).map(|i| item_at(h, doc, i)).transpose()? {
None | Some(Data::Undefined) => Err(HostError::Error(NOT_FOUND.into())),
Some(d) => Ok(d),
}
@@ -3009,8 +3061,8 @@ fn classes(link: &Link) -> Vec<HostClass> {
new_preset(&h)
});
let mut members = vec![
("typename".to_string(), typename_of("DocumentPreset"), typed("string")),
("toString".to_string(), class_text("DocumentPreset"), returns("string", &[])),
("typename".to_string(), get(link, preset_typename), typed("string")),
("toString".to_string(), method(link, preset_to_string), returns("string", &[])),
];
members.extend(PRESET_FIELDS.iter().map(|k| (k.to_string(), preset_field(link, k), typed(preset_type(k)))));
HostClass { construct: Some(f), ..class("DocumentPreset", None, members, None) }
@@ -3048,6 +3100,7 @@ fn classes(link: &Link) -> Vec<HostClass> {
method(l, docs_add_document),
returns("Document", &[("startupPreset", "string"), ("presetSettings", "DocumentPreset"), ("showOptionsDialog", "boolean")]),
),
("addDocumentNoUI", method(l, docs_add_document_no_ui), returns("Document", &[("startupPreset", "string")])),
("toString", class_text("Documents"), returns("string", &[])),
]),
Some(function(l, docs_at)),
@@ -3210,6 +3263,24 @@ mod tests {
assert_eq!(done_unless_refused(Err(HostError::Range("too large".into()))), Err(HostError::Range("too large".into())));
}
/// A stop from putting back the selection or the active document is not hidden by the edit's
/// own error, which a script could catch; ordinary errors keep their order.
#[test]
fn an_edit_gives_a_stop_ahead_of_its_own_error() {
let error = |m: &str| HostError::Error(m.into());
let stop = || HostError::Abort("stop".into());
let marked = || HostError::Marked { error: Box::new(stop()), mark: 0 };
assert_eq!(first_error::<()>(Err(error("edit")), Err(stop()), Ok(())), Err(stop()));
assert_eq!(first_error::<()>(Err(error("edit")), Ok(()), Err(stop())), Err(stop()));
assert_eq!(first_error::<()>(Err(error("edit")), Err(error("selection")), Err(marked())), Err(marked()));
assert_eq!(first_error(Ok(1), Ok(()), Err(stop())), Err(stop()));
// The edit's own stop comes first, and with no stop the edit's error does.
assert_eq!(first_error::<()>(Err(HostError::Abort("edit".into())), Err(stop()), Ok(())), Err(HostError::Abort("edit".into())));
assert_eq!(first_error::<()>(Err(error("edit")), Err(error("selection")), Err(error("back"))), Err(error("edit")));
assert_eq!(first_error::<()>(Ok(()), Err(error("selection")), Err(error("back"))), Err(error("selection")));
assert_eq!(first_error(Ok(1), Ok(()), Ok(())), Ok(1));
}
#[test]
fn page_item_lists_are_kept_for_several_documents() {
let docs: Vec<Arc<Document>> = (0..=ITEM_LISTS).map(|_| Arc::new(Document::new(100.0, 100.0))).collect();
+1 -1
View File
@@ -674,7 +674,7 @@ fn art_list(h: &Host, st: &DocState, kind: Kind, container: Option<NodeId>) -> R
}
let ids: Vec<NodeId> = match container {
None => {
let all = page_items(h, st);
let all = page_items(h, st)?;
h.charge_call(all.len() as u64)?;
all.iter().copied().filter(|i| st.doc.node(*i).is_some_and(|n| kind.holds(n))).collect()
}
+13 -11
View File
@@ -367,16 +367,18 @@ fn keeping_paint<T>(h: &super::Host, f: impl FnOnce() -> T) -> T {
// ---- Document.pathItems ----
/// The ids of a document's paths, in the order of its page items.
fn path_items(h: &super::Host, st: &DocState) -> Rc<Vec<NodeId>> {
/// The ids of a document's paths, in the order of its page items. Building the list again counts
/// the page items it looks through against the run's host-call allowance.
fn path_items(h: &super::Host, st: &DocState) -> Result<Rc<Vec<NodeId>>, HostError> {
if let Some(ids) = super::kept_list(&h.dom.paths, st) {
return ids;
return Ok(ids);
}
let all = super::page_items(h, st);
let all = super::page_items(h, st)?;
h.charge_call(all.len() as u64)?;
let ids: Rc<Vec<NodeId>> =
Rc::new(all.iter().copied().filter(|i| st.doc.node(*i).is_some_and(|n| matches!(n.kind, NodeKind::Path { .. }))).collect());
super::keep_list(&h.dom.paths, st, &ids);
ids
Ok(ids)
}
pub(super) fn doc_path_items(h: &super::Host, a: &[Data]) -> Answer {
@@ -405,7 +407,7 @@ fn items_length(h: &super::Host, a: &[Data]) -> Answer {
return super::layers::scoped_length(h, a);
}
let doc = items_doc(h, a)?;
Ok(num(float(with_doc(h, doc, |_, st| path_items(h, st).len()) as u64)))
Ok(num(float(with_doc(h, doc, |_, st| path_items(h, st).map(|ids| ids.len()))? as u64)))
}
fn items_parent(h: &super::Host, a: &[Data]) -> Answer {
@@ -423,7 +425,7 @@ fn items_at(h: &super::Host, a: &[Data]) -> Answer {
let doc = items_doc(h, a)?;
let Data::Number(n) = arg(a, 1) else { return Ok(Data::Undefined) };
let Some(i) = whole(*n).and_then(|i| usize::try_from(i).ok()) else { return Ok(Data::Undefined) };
Ok(with_doc(h, doc, |_, st| path_items(h, st).get(i).map_or(Data::Undefined, |id| super::item_ref(h, st, *id))))
with_doc(h, doc, |_, st| Ok(path_items(h, st)?.get(i).map_or(Data::Undefined, |id| super::item_ref(h, st, *id))))
}
fn items_by_name(h: &super::Host, a: &[Data]) -> Answer {
@@ -433,7 +435,7 @@ fn items_by_name(h: &super::Host, a: &[Data]) -> Answer {
let doc = items_doc(h, a)?;
let Data::String(name) = arg(a, 1) else { return Err(HostError::Type("give a name, as a string".into())) };
with_doc(h, doc, |_, st| {
let ids = path_items(h, st);
let ids = path_items(h, st)?;
h.charge_call(ids.len() as u64)?;
let id = ids.iter().find(|i| st.doc.node(**i).and_then(|n| n.name.as_deref()) == Some(name.as_str()));
id.map(|id| super::item_ref(h, st, *id)).ok_or_else(|| HostError::Error(NOT_FOUND.into()))
@@ -459,10 +461,10 @@ fn items_remove_all(h: &super::Host, a: &[Data]) -> Answer {
}
let doc = items_doc(h, a)?;
let (ids, refused) = with_doc(h, doc, |_, st| {
let ids = path_items(h, st);
let ids = path_items(h, st)?;
let refused: Vec<u64> = ids.iter().filter(|i| !editable(&st.doc, **i)).map(|i| i.0).take(20).collect();
(ids, refused)
});
Ok::<_, HostError>((ids, refused))
})?;
if !refused.is_empty() {
let list = refused.iter().map(u64::to_string).collect::<Vec<_>>().join(", ");
return Err(HostError::Error(format!("cannot delete hidden or locked paths: {list}")));
+1 -1
View File
@@ -74,7 +74,7 @@ fn each(h: &Host, owner: Owner, mut f: impl FnMut(NodeId, &ObjectTag) -> Control
Ok(())
}),
Owner::Doc(doc) => with_doc(h, doc, |_, st| {
let ids = page_items(h, st);
let ids = page_items(h, st)?;
h.charge_call(ids.len() as u64)?;
for id in ids.iter() {
if let Some(n) = st.doc.node(*id) {
+14 -11
View File
@@ -1233,18 +1233,21 @@ pub(super) fn doc_text_frames(link: &Link) -> HostMember {
}
/// The ids of the document's type objects, topmost first as `pageItems` lists them, kept while the
/// document is unchanged.
fn frame_ids(h: &Host, st: &DocState) -> Rc<Vec<NodeId>> {
/// document is unchanged. Building the list again counts the page items it looks through against
/// the run's host-call allowance.
fn frame_ids(h: &Host, st: &DocState) -> std::result::Result<Rc<Vec<NodeId>>, HostError> {
if let Some((uid, doc, ids)) = &*h.dom.text.list.borrow()
&& *uid == st.uid
&& std::ptr::eq(doc.as_ptr(), Arc::as_ptr(&st.doc))
{
return ids.clone();
return Ok(ids.clone());
}
let ids: Vec<NodeId> = page_items(h, st).iter().copied().filter(|i| text_of(st, *i).is_some()).collect();
let all = page_items(h, st)?;
h.charge_call(all.len() as u64)?;
let ids: Vec<NodeId> = all.iter().copied().filter(|i| text_of(st, *i).is_some()).collect();
let ids = Rc::new(ids);
*h.dom.text.list.borrow_mut() = Some((st.uid, Arc::downgrade(&st.doc), ids.clone()));
ids
Ok(ids)
}
fn frames_doc(h: &Host, a: &[Data]) -> std::result::Result<Doc, HostError> {
@@ -1253,7 +1256,7 @@ fn frames_doc(h: &Host, a: &[Data]) -> std::result::Result<Doc, HostError> {
fn frames_length(h: &Host, a: &[Data]) -> Answer {
let doc = frames_doc(h, a)?;
Ok(num(float(with_doc(h, doc, |_, st| frame_ids(h, st).len()) as u64)))
Ok(num(float(with_doc(h, doc, |_, st| frame_ids(h, st).map(|ids| ids.len()))? as u64)))
}
fn frames_parent(h: &Host, a: &[Data]) -> Answer {
@@ -1265,14 +1268,14 @@ fn frames_at(h: &Host, a: &[Data]) -> Answer {
let doc = frames_doc(h, a)?;
let Data::Number(n) = arg(a, 1) else { return Ok(Data::Undefined) };
let Some(i) = usize_of(*n) else { return Ok(Data::Undefined) };
Ok(with_doc(h, doc, |_, st| frame_ids(h, st).get(i).map_or(Data::Undefined, |id| item_ref(h, st, *id))))
with_doc(h, doc, |_, st| Ok(frame_ids(h, st)?.get(i).map_or(Data::Undefined, |id| item_ref(h, st, *id))))
}
fn frames_by_name(h: &Host, a: &[Data]) -> Answer {
let doc = frames_doc(h, a)?;
let Data::String(name) = arg(a, 1) else { return Err(HostError::Type("give a name, as a string".into())) };
with_doc(h, doc, |_, st| {
let ids = frame_ids(h, st);
let ids = frame_ids(h, st)?;
h.charge_call(ids.len() as u64)?;
let id = ids.iter().find(|i| st.doc.node(**i).and_then(|n| n.name.as_deref()) == Some(name.as_str()));
id.map(|id| item_ref(h, st, *id)).ok_or_else(|| HostError::Error(NOT_FOUND.into()))
@@ -1364,13 +1367,13 @@ fn frames_path_text(h: &Host, a: &[Data]) -> Answer {
fn frames_remove_all(h: &Host, a: &[Data]) -> Answer {
let doc = frames_doc(h, a)?;
let (ids, refused, on_locked) = with_doc(h, doc, |_, st| {
let ids = frame_ids(h, st);
let ids = frame_ids(h, st)?;
let ok = |id: &NodeId| editable(&st.doc, *id) && st.doc.node(*id).is_some_and(all_editable);
let refused: Vec<u64> = ids.iter().filter(|i| !ok(i)).map(|i| i.0).take(20).collect();
let locks = st.doc.locked_artboards();
let on_locked: Vec<u64> = ids.iter().filter(|i| locks.holds_id(**i)).map(|i| i.0).take(20).collect();
(ids, refused, on_locked)
});
Ok::<_, HostError>((ids, refused, on_locked))
})?;
if !refused.is_empty() {
let list = refused.iter().map(u64::to_string).collect::<Vec<_>>().join(", ");
return Err(HostError::Error(format!("cannot delete hidden or locked type: {list}")));
+1 -1
View File
@@ -633,7 +633,7 @@ fn heads(h: &Host, st: &DocState) -> std::result::Result<Rc<Vec<NodeId>>, HostEr
{
return Ok(ids.clone());
}
let ids = frame_ids(h, st);
let ids = frame_ids(h, st)?;
h.charge_call(ids.len() as u64 + st.doc.text_threads.iter().map(|t| t.len() as u64).sum::<u64>())?;
// A frame listed by an earlier thread belongs to that one, as `story_of` finds it.
let (mut threaded, mut first) = (HashSet::new(), HashSet::new());
+1
View File
@@ -1517,6 +1517,7 @@ fn a_boolean_given_as_text_for_a_transform_is_an_error() {
("object.move", json!({"dx": 5, "copy": "true"}), "copy"),
("object.move", json!({"dx": 5, "objects": 0}), "objects"),
("object.nudge", json!({"dx": 1, "big": "true"}), "big"),
("object.nudge", json!({"dx": 1, "fine": "true"}), "fine"),
("object.rotate", json!({"angle": 45, "absolute": "true"}), "absolute"),
("object.scale", json!({"sx": 200, "strokes": "false"}), "strokes"),
("object.scale", json!({"sx": 200, "corners": [true]}), "corners"),
+10 -14
View File
@@ -835,9 +835,10 @@ fn perspective_grid_commands_refuse_a_boolean_given_as_text() {
/// For an object in perspective, Move in Perspective by 0 (along its plane or its normal),
/// Transform in Perspective by the identity, Transform Again after each, and a Perspective Selection
/// drag that ends where it started record no undo step. So do a Move by 0 and a 1 pt Nudge that
/// Snap to Grid takes back to the gridlines the object's edges are on, and Transform Again after
/// each. With Copy, the identity copies the object in one undo step.
/// drag that ends where it started record no undo step. So do a Move by 0 of an object Snap to Grid
/// keeps on the gridlines its edges are on, and Transform Again after it. With Copy, the identity
/// copies the object in one undo step. (A Nudge in Perspective isn't snapped: it moves by its step,
/// see `arrow_keys_nudge_in_perspective_by_the_step_with_snap_to_grid`.)
#[test]
fn perspective_moves_that_move_nothing_record_no_undo_step() {
let mut s = session();
@@ -869,8 +870,8 @@ fn perspective_moves_that_move_nothing_record_no_undo_step() {
assert_eq!(s.journal.last().unwrap().0, "perspective.move");
let (undo, redo, _) = history(&s);
assert_eq!(((undo, redo), path(&s, a)), ((before.0, before.1), shape.clone()), "a drag back to its start");
// Snap to Grid takes a move that ends 0.3 pt past a gridline crossing onto the crossing. Then it
// takes a move by 0 and a 1 pt nudge back there, and Transform Again after each moves nothing.
// Snap to Grid takes a move that ends 0.3 pt past a gridline crossing onto the crossing. Then a
// move by 0 there, and Transform Again after it, moves nothing.
s.execute("perspective.grid.snap", &json!({"on": true})).unwrap();
let g = grid(&s);
let (_, _, b) = g.plane_bounds(&s.doc().unwrap().doc, &[a]).unwrap();
@@ -881,12 +882,7 @@ fn perspective_moves_that_move_nothing_record_no_undo_step() {
with_a_step_to_redo(&mut s);
let before = history(&s);
let on_grid = path(&s, a);
let calls = [
("perspective.move", json!({"from": [to.x, to.y], "to": [to.x, to.y]})),
("object.transformAgain", json!({})),
("perspective.nudge", json!({"dx": 1, "dy": 0})),
("object.transformAgain", json!({})),
];
let calls = [("perspective.move", json!({"from": [to.x, to.y], "to": [to.x, to.y]})), ("object.transformAgain", json!({}))];
for (c, p) in calls {
assert_eq!(s.execute(c, &p).unwrap(), json!({"ids": [a.0]}), "{c} {p}");
assert_eq!((history(&s), path(&s, a)), (before, on_grid.clone()), "{c} {p}");
@@ -898,7 +894,7 @@ fn perspective_moves_that_move_nothing_record_no_undo_step() {
}
/// Move in Perspective refuses a `copy`, `perpendicular` or `snap`, Transform in Perspective a `copy`,
/// and Nudge in Perspective a `big` or `copy`, given as text or as another value that is not true or
/// and Nudge in Perspective a `big`, `fine` or `copy`, given as text or as another value that is not true or
/// false: the object stays where it is, nothing is copied, and the undo history stays as it was. Null
/// is read as the key left out.
#[test]
@@ -916,7 +912,7 @@ fn perspective_moves_refuse_a_boolean_given_as_text() {
refuses_non_boolean(&mut s, "perspective.move", &json!({"from": from, "to": to, key: v}), key);
}
refuses_non_boolean(&mut s, "perspective.transform", &json!({"matrix": [1.5, 0, 0, 1.5, 0, 0], "copy": v}), "copy");
for key in ["big", "copy"] {
for key in ["big", "fine", "copy"] {
refuses_non_boolean(&mut s, "perspective.nudge", &json!({"dx": 1, "dy": 0, key: v}), key);
}
assert_eq!(state(&s), before, "{v}");
@@ -924,7 +920,7 @@ fn perspective_moves_refuse_a_boolean_given_as_text() {
let calls = [
("perspective.move", json!({"from": from, "to": to, "copy": null, "perpendicular": null, "snap": null})),
("perspective.transform", json!({"matrix": [1.5, 0, 0, 1.5, 0, 0], "copy": null})),
("perspective.nudge", json!({"dx": 1, "dy": 0, "big": null, "copy": null})),
("perspective.nudge", json!({"dx": 1, "dy": 0, "big": null, "fine": null, "copy": null})),
];
for (i, (c, p)) in calls.into_iter().enumerate() {
assert_eq!(s.execute(c, &p).unwrap(), json!({"ids": [a.0]}), "{c} {p}");
+19 -32
View File
@@ -631,13 +631,14 @@ fn rearrange_refuses_bad_indices_and_at() {
assert_eq!((r["indices"].clone(), boards(&s)[2]), (json!([2]), Rect::new(0.0, 500.0, 100.0, 550.0)));
}
/// A session whose New Document profiles are in a fresh folder for test `name` (not made yet).
fn with_profiles(name: &str) -> (Session, std::path::PathBuf) {
let dir = std::env::temp_dir().join(format!("vc-newdoc-profiles-{name}-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
/// A session whose New Document profiles are in a fresh folder for test `name` (not made yet),
/// inside the returned temporary folder, which is removed when dropped, also when the test fails.
fn with_profiles(name: &str) -> (Session, std::path::PathBuf, vectorcraft_testkit::TempDir) {
let root = vectorcraft_testkit::TempDir::new(&format!("newdoc-profiles-{name}"));
let dir = root.join(format!("vc-newdoc-profiles-{name}"));
let mut s = Session::new();
s.attach_new_doc_profiles(dir.clone());
(s, dir)
(s, dir, root)
}
fn swatch_names(s: &Session) -> Vec<String> {
@@ -705,7 +706,7 @@ fn edit_print_profile(s: &mut Session, dir: &std::path::Path) {
#[test]
fn an_edited_profile_starts_the_documents_of_its_category() {
let (mut s, dir) = with_profiles("edited");
let (mut s, dir, _root) = with_profiles("edited");
let listed = s.execute("file.newProfiles", &json!({})).unwrap();
let names: Vec<&str> = listed["profiles"].as_array().unwrap().iter().map(|p| p["name"].as_str().unwrap()).collect();
assert_eq!(names, ["Mobile", "Web", "Print", "Film & Video", "Art & Illustration", "Branding", "Social"]);
@@ -733,7 +734,6 @@ fn an_edited_profile_starts_the_documents_of_its_category() {
s.execute("file.new", &json!({"preset": "A4", "colorMode": "rgb"})).unwrap();
let red = s.doc().unwrap().doc.swatches.iter().find(|w| w.name == "Brand Red").cloned().expect("converted, not dropped");
assert!(matches!(red.paint, vectorcraft_color::Paint::Solid { color: vectorcraft_color::Color::Rgb { .. }, .. }), "{:?}", red.paint);
let _ = std::fs::remove_dir_all(&dir);
}
/// The fill, stroke and weight of `id` in the active document.
@@ -745,7 +745,7 @@ fn look(s: &Session, id: u64) -> (vectorcraft_color::Paint, vectorcraft_color::P
#[test]
fn a_redefined_default_graphic_style_in_a_profile_is_the_default_fill_and_stroke() {
use vectorcraft_color::Paint;
let (mut s, dir) = with_profiles("default-style");
let (mut s, _, _root) = with_profiles("default-style");
// The Print profile's Default Graphic Style becomes no fill and a 0.25 pt red stroke.
s.execute("file.newProfiles.edit", &json!({"name": "Print"})).unwrap();
s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 40, "height": 40})).unwrap();
@@ -796,12 +796,11 @@ fn a_redefined_default_graphic_style_in_a_profile_is_the_default_fill_and_stroke
assert_eq!(s.paint.fill, green);
s.execute("paint.default", &json!({})).unwrap();
assert_eq!(s.paint, vectorcraft_tools::PaintDefaults::default());
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
fn the_profile_follows_the_preset_access_and_reset() {
let (mut s, dir) = with_profiles("choice");
let (mut s, dir, _root) = with_profiles("choice");
edit_print_profile(&mut s, &dir);
// A request that may not read the folder gets the defaults, and the reason; edit is refused
// before anything is written.
@@ -841,7 +840,6 @@ fn the_profile_follows_the_preset_access_and_reset() {
assert_eq!(s.execute("file.newProfiles.reset", &json!({"name": "Print"})).unwrap(), json!({"name": "Print", "reset": false}));
let r = s.execute("file.new", &json!({"preset": "A4"})).unwrap();
assert!(r.get("profile").is_none() && !swatch_names(&s).contains(&"Brand Red".to_string()), "{r}");
let _ = std::fs::remove_dir_all(&dir);
}
/// The first run's style of text object `id`.
@@ -853,7 +851,7 @@ fn first_run(s: &Session, id: &Value) -> vectorcraft_doc::CharStyle {
#[test]
fn a_profiles_normal_character_style_is_the_default_font() {
let (mut s, dir) = with_profiles("default-font");
let (mut s, _, _root) = with_profiles("default-font");
// The Print profile's [Normal Character Style] becomes Source Serif 4 Regular at 9 pt.
s.execute("file.newProfiles.edit", &json!({"name": "Print"})).unwrap();
let attrs = json!({"font_family": "Source Serif 4", "font_style": "Regular", "size": 9, "charAlign": "emBoxBottom"});
@@ -891,13 +889,12 @@ fn a_profiles_normal_character_style_is_the_default_font() {
let st = first_run(&s, &made["id"]);
let default = vectorcraft_doc::CharStyle::default();
assert_eq!((st.font_family, st.size), (default.font_family, default.size));
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
fn an_open_document_takes_another_profiles_default_fill_stroke_and_font() {
use vectorcraft_color::Paint;
let (mut s, dir) = with_profiles("apply-defaults");
let (mut s, _, _root) = with_profiles("apply-defaults");
const GLOW: &str = r#"<filter id="Glow7653"><feOffset dx="3" dy="3"/></filter>"#;
// The CMYK Print profile: no fill and a 0.25 pt stroke of the global swatch Laser Red, with
// the SVG filter Glow7653, and red type in Source Serif 4 at 9 pt.
@@ -987,7 +984,6 @@ fn an_open_document_takes_another_profiles_default_fill_stroke_and_font() {
assert!(s.execute("file.newProfiles.applyDefaults", &json!({"name": "Posters"})).is_err());
assert!(s.execute("file.newProfiles.applyDefaults", &json!({})).is_err());
assert_eq!(s.doc().unwrap().history.step(), step);
let _ = std::fs::remove_dir_all(&dir);
}
/// With New Art Has Basic Appearance off, the selected object's look does not replace the profile's
@@ -995,7 +991,7 @@ fn an_open_document_takes_another_profiles_default_fill_stroke_and_font() {
#[test]
fn profile_defaults_stay_with_an_unrelated_object_selected() {
use vectorcraft_color::Paint;
let (mut s, dir) = with_profiles("apply-defaults-selected");
let (mut s, _, _root) = with_profiles("apply-defaults-selected");
s.execute("file.newProfiles.edit", &json!({"name": "Print"})).unwrap();
s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 40, "height": 40})).unwrap();
s.execute("paint.setFill", &json!({"none": true})).unwrap();
@@ -1013,7 +1009,6 @@ fn profile_defaults_stay_with_an_unrelated_object_selected() {
assert_eq!((s.paint.fill.clone(), s.paint.stroke_width), (Paint::None, 0.25));
let id = s.execute("shape.rectangle", &json!({"x": 60, "y": 80, "width": 30, "height": 30})).unwrap()["id"].as_u64().unwrap();
assert_eq!((look(&s, id).0, look(&s, id).2), (Paint::None, Some(0.25)));
let _ = std::fs::remove_dir_all(&dir);
}
/// A profile whose [Normal Character Style] is set in one of its composite fonts gives the open
@@ -1026,7 +1021,7 @@ fn profile_defaults_bring_the_composite_font_of_the_default_font() {
"roman": {"font": "JetBrains Mono", "size": roman},
}})
};
let (mut s, dir) = with_profiles("apply-defaults-composite");
let (mut s, _, _root) = with_profiles("apply-defaults-composite");
s.execute("file.newProfiles.edit", &json!({"name": "Print"})).unwrap();
s.execute("type.compositeFonts.set", &json!({"fonts": [font(50.0)]})).unwrap();
let t = s.execute("text.create", &json!({"x": 10, "y": 80, "text": "Ab", "font": "CF Profile 7653", "size": 12})).unwrap();
@@ -1052,12 +1047,11 @@ fn profile_defaults_bring_the_composite_font_of_the_default_font() {
s.execute("edit.undo", &json!({})).unwrap();
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(profile(&s), Some(100.0));
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
fn profile_errors_name_the_file_by_its_name_outside_the_read_roots() {
let (mut s, dir) = with_profiles("errors");
let (mut s, dir, _root) = with_profiles("errors");
let elsewhere = dir.with_extension("elsewhere");
std::fs::create_dir_all(&dir).unwrap();
std::fs::create_dir_all(&elsewhere).unwrap();
@@ -1084,22 +1078,19 @@ fn profile_errors_name_the_file_by_its_name_outside_the_read_roots() {
let inside = crate::file_access::AutomationRoots::new(&[dir.as_path()], &[dir.as_path()]).unwrap().unwrap();
let e = run(&mut s, &inside, "file.newProfiles.reset");
assert!(e.starts_with(&format!("{whole}: ")), "{e}");
let _ = std::fs::remove_dir_all(&elsewhere);
let _ = std::fs::remove_dir_all(&dir);
}
/// The new document's links find their files from the profile's file, as a document opened from
/// that file does; a document without a profile has no such file.
#[test]
fn the_new_document_links_from_the_profile_file() {
let (mut s, dir) = with_profiles("links");
let (mut s, dir, _root) = with_profiles("links");
edit_print_profile(&mut s, &dir);
assert_eq!(s.execute("file.new", &json!({"preset": "A4"})).unwrap()["profile"], "Print");
let file = dir.join("Print.vectorcraft").to_string_lossy().to_string();
assert_eq!(s.doc().unwrap().links_from.as_deref(), Some(file.as_str()));
s.execute("file.new", &json!({"preset": "Web 1920×1080"})).unwrap();
assert_eq!(s.doc().unwrap().links_from, None);
let _ = std::fs::remove_dir_all(&dir);
}
/// A color profile the profile's file carries is installed when this machine lacks it, as opening
@@ -1111,7 +1102,7 @@ fn a_profile_brings_the_color_profile_its_file_carries() {
return;
}
use vectorcraft_color::cms;
let (mut s, dir) = with_profiles("icc");
let (mut s, dir, _root) = with_profiles("icc");
let builtin = cms::profiles().into_iter().find(|p| p.kind == cms::ProfileKind::Rgb && p.builtin && p.name != cms::SRGB).unwrap();
let icc = cms::icc_bytes(&builtin.name).unwrap().to_vec();
let name = format!("Profile RGB {}", std::process::id());
@@ -1140,12 +1131,11 @@ fn a_profile_brings_the_color_profile_its_file_carries() {
std::fs::write(dir.join("Web.vectorcraft"), serde_json::to_vec(&v).unwrap()).unwrap();
let r = s.execute("file.new", &json!({"preset": "Web 1920×1080"})).unwrap();
assert!(r["profile"] == "Web" && r["warnings"][0].as_str().unwrap_or_default().contains(&broken), "{r}");
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
fn a_damaged_or_oversized_profile_leaves_the_defaults_and_is_reported() {
let (mut s, dir) = with_profiles("damaged");
let (mut s, dir, _root) = with_profiles("damaged");
s.execute("file.new", &json!({"preset": "Letter", "profile": null})).unwrap();
let defaults = swatch_names(&s);
std::fs::create_dir_all(&dir).unwrap();
@@ -1162,23 +1152,20 @@ fn a_damaged_or_oversized_profile_leaves_the_defaults_and_is_reported() {
let r = s.execute("file.new", &json!({"preset": "Web 1920×1080"})).unwrap();
assert!(r["profileError"]["reason"].as_str().unwrap_or("").contains("larger than"), "{r}");
assert_eq!(s.doc().unwrap().doc.artboards[0].rect.width(), 1920.0);
let _ = std::fs::remove_dir_all(&dir);
}
#[cfg(unix)]
#[test]
fn a_profile_that_is_a_link_is_not_followed() {
let (mut s, dir) = with_profiles("link");
let (mut s, dir, root) = with_profiles("link");
s.execute("file.newProfiles.edit", &json!({"name": "Print"})).unwrap();
// A profile the folder held, moved out and linked back in.
let outside = std::env::temp_dir().join(format!("vc-newdoc-profile-outside-{}.vectorcraft", std::process::id()));
let outside = root.join("outside.vectorcraft");
std::fs::rename(dir.join("Print.vectorcraft"), &outside).unwrap();
std::os::unix::fs::symlink(&outside, dir.join("Print.vectorcraft")).unwrap();
let r = s.execute("file.new", &json!({"preset": "Letter"})).unwrap();
assert_eq!(r["profileError"]["reason"], "not a plain file", "{r}");
assert!(r.get("profile").is_none(), "{r}");
let _ = std::fs::remove_file(&outside);
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
+42
View File
@@ -561,6 +561,41 @@ fn transform_again_repeats_a_perspective_scale_and_copies() {
assert!(s.execute("perspective.transform", &json!({"matrix": [1, 0, 0, 1, 0, 0], "depth": f64::MAX})).is_err());
}
/// Snap to Grid (on by default) leaves the arrow keys' step alone: art whose edges are on
/// gridlines moves by the step (a tenth of it with Ctrl/Cmd) in one undo step each, instead of
/// being pulled back onto the gridlines and not moving at all.
#[test]
fn arrow_keys_nudge_in_perspective_by_the_step_with_snap_to_grid() {
let (mut s, id) = persp_session();
s.execute("perspective.grid.snap", &json!({"on": true})).unwrap();
// A move that ends 0.3 pt past a gridline crossing snaps the corner onto it.
let g = grid(&s);
let b = bounds_of(&plane_pts(&s, id, Plane::Right, 0.0));
let past = |v: f64| (v / g.cell).ceil() * g.cell + 0.3 - v;
let (c, dv) = (b.center(), Vec2::new(past(b.x0), past(b.y0)));
let (from, to) = (g.to_page(Plane::Right, c).unwrap(), g.to_page(Plane::Right, c + dv).unwrap());
s.execute("perspective.move", &json!({"from": [from.x, from.y], "to": [to.x, to.y]})).unwrap();
let on_grid = bounds_of(&plane_pts(&s, id, Plane::Right, 0.0));
assert!((on_grid.x0 / g.cell - (on_grid.x0 / g.cell).round()).abs() < 1e-6, "{on_grid:?}");
// The page step measured at the centre of the selection, as `perspective.nudge` measures it.
let page_step = |s: &Session, before: &[Point]| {
let after = plane_pts(s, id, Plane::Right, 0.0);
let h = grid(s).homography(Plane::Right).unwrap();
let c = bounds_of(before).center();
h.apply(c + (after[0] - before[0])).unwrap() - h.apply(c).unwrap()
};
let v = ViewInfo::default();
s.select_tool("perspectiveSelection", v).unwrap();
let k = s.prefs.keyboard_increment;
for (mods, step) in [(Mods::default(), k), (Mods { cmd: true, ..Default::default() }, k / 10.0)] {
let (before, n) = (plane_pts(&s, id, Plane::Right, 0.0), undo_len(&s));
s.tool_key(ToolKey::Right, mods, v).unwrap();
assert_eq!(undo_len(&s), n + 1, "{mods:?}");
let d = page_step(&s, &before);
assert!((d - Vec2::new(step, 0.0)).hypot() < 1e-6, "{mods:?} {d:?}");
}
}
#[test]
fn arrow_keys_nudge_in_perspective() {
let (mut s, id) = persp_session();
@@ -581,6 +616,13 @@ fn arrow_keys_nudge_in_perspective() {
let c = bounds_of(&before).center();
let step = h.apply(c + d).unwrap() - h.apply(c).unwrap();
assert!((step - Vec2::new(s.prefs.keyboard_increment, 0.0)).hypot() < 1e-6, "{step:?}");
// Ctrl/Cmd takes a tenth of a step.
let before = plane_pts(&s, id, Plane::Right, 0.0);
s.tool_key(ToolKey::Right, Mods { cmd: true, ..Default::default() }, v).unwrap();
let after = plane_pts(&s, id, Plane::Right, 0.0);
let c = bounds_of(&before).center();
let step = h.apply(c + (after[0] - before[0])).unwrap() - h.apply(c).unwrap();
assert!((step - Vec2::new(s.prefs.keyboard_increment / 10.0, 0.0)).hypot() < 1e-6, "{step:?}");
// Alt copies; Shift takes ten steps.
s.tool_key(ToolKey::Left, Mods { alt: true, shift: true, ..Default::default() }, v).unwrap();
let copy = *s.doc().unwrap().selection.objects.first().unwrap();
+43
View File
@@ -64,6 +64,49 @@ fn set_and_get_keyboard_increment_drives_nudge() {
assert!((b.x0 - 15.0).abs() < 1e-9);
}
/// Ctrl/Cmd+arrow (`fine`) nudges by a tenth of the keyboard increment, and Shift+Ctrl+arrow
/// (`big` and `fine`) by one increment: art, direct-selected anchors and ruler guides, one undo
/// step per press, and repeated fine nudges add up to whole increments.
#[test]
fn fine_nudge_moves_a_tenth_of_the_keyboard_increment() {
let mut s = Session::new();
s.execute("prefs.set", &json!({"key": "keyboardIncrement", "value": 5})).unwrap();
s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap();
let r = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap();
let id = NodeId(r["id"].as_u64().unwrap());
let x0 = |s: &Session| s.doc().unwrap().doc.node(id).unwrap().geometric_bounds().unwrap().x0;
let undo = |s: &Session| s.doc().unwrap().history.undo.len();
let n = undo(&s);
s.execute("object.nudge", &json!({"dx": 1, "dy": 0, "fine": true})).unwrap();
assert!((x0(&s) - 10.5).abs() < 1e-9, "{}", x0(&s));
assert_eq!(undo(&s), n + 1, "one undo step per press");
s.execute("object.nudge", &json!({"dx": -1, "dy": 0, "big": true, "fine": true})).unwrap();
assert!((x0(&s) - 5.5).abs() < 1e-9, "Shift+Ctrl: one increment, {}", x0(&s));
for _ in 0..10 {
s.execute("object.nudge", &json!({"dx": 1, "dy": 0, "fine": true})).unwrap();
}
assert!((x0(&s) - 10.5).abs() < 1e-9, "ten fine nudges are one increment, {}", x0(&s));
assert_eq!(undo(&s), n + 12);
// Direct-selected anchors.
s.execute("select.anchors", &json!({"id": id.0, "anchors": [[0, 0]]})).unwrap();
let p0 = |s: &Session| s.doc().unwrap().doc.node(id).unwrap().path_data().unwrap().subpaths[0].anchors[0].p;
let before = p0(&s);
s.execute("object.nudge", &json!({"dx": 0, "dy": 1, "fine": true})).unwrap();
let d = p0(&s) - before;
assert!(d.x.abs() < 1e-9 && (d.y - 0.5).abs() < 1e-9, "{d:?}");
// Ruler guides.
s.execute("select.none", &json!({})).unwrap();
s.execute("guide.add", &json!({"vertical": true, "pos": 100})).unwrap();
s.execute("guide.select", &json!({"indexes": [0]})).unwrap();
s.execute("object.nudge", &json!({"dx": 1, "dy": 0, "fine": true})).unwrap();
let pos = s.doc().unwrap().doc.ruler_guides()[0].pos;
assert!((pos - 100.5).abs() < 1e-9, "{pos}");
assert!(s.execute("object.nudge", &json!({"dx": 1, "fine": "true"})).is_err());
}
#[test]
fn set_rejects_out_of_range_and_wrong_types() {
let mut s = Session::new();
+114 -18
View File
@@ -987,7 +987,11 @@ fn clearing_anchors_with_keep_empty_keeps_the_compound_path() {
s.execute("edit.clear", &json!({"keepEmpty": keep})).unwrap();
let d = &s.active().unwrap().doc;
assert!(d.node(a).is_none() && d.node(b).is_none(), "keepEmpty {keep}: both paths are deleted");
assert_eq!(d.node(compound).is_some_and(|n| n.children().is_some_and(|c| c.is_empty())), keep, "keepEmpty {keep}");
if keep {
assert!(d.node(compound).is_some_and(|n| n.children().is_some_and(|c| c.is_empty())), "keepEmpty true keeps it, empty");
} else {
assert!(d.node(compound).is_none(), "keepEmpty false deletes the compound path");
}
}
}
@@ -1019,11 +1023,23 @@ fn a_grid_by_column_takes_the_number_of_rows() {
let distinct = |mut v: Vec<i64>| {
v.sort_unstable();
v.dedup();
v.len()
v
};
let tops = distinct(boards.iter().map(|b| b.rect.y0.round() as i64).collect());
let lefts = distinct(boards.iter().map(|b| b.rect.x0.round() as i64).collect());
assert_eq!((tops, lefts), (rows, cols), "{layout} {count}");
assert_eq!((tops.len(), lefts.len()), (rows, cols), "{layout} {count}");
// Each artboard's row and column, counted from the top and from the left: a grid by column
// fills each column top to bottom, and the right-to-left grid starts at the rightmost column.
let index = |v: &[i64], x: f64| v.iter().position(|&t| t == x.round() as i64);
let placed: Vec<_> = boards.iter().map(|b| (index(&tops, b.rect.y0), index(&lefts, b.rect.x0))).collect();
let expected: Vec<_> = (0..count)
.map(|i| match layout {
"GridByRow" => (Some(i / cols), Some(i % cols)),
"GridByCol" => (Some(i % rows), Some(i / rows)),
_ => (Some(i % rows), Some(cols - 1 - i / rows)),
})
.collect();
assert_eq!(placed, expected, "{layout} {count}");
}
}
@@ -1399,6 +1415,18 @@ fn a_document_preset_is_an_instance_of_its_class() {
assert_eq!(out, vec![json!(true), json!("DocumentPreset"), json!(612)]);
}
/// A preset kept from an earlier run throws from `typename` and `toString()` as it does from its
/// settings.
#[test]
fn a_document_preset_from_an_earlier_run_throws_from_typename_and_to_string() {
let mut s = Session::new();
run(&mut s, "#targetengine keep\nvar p = new DocumentPreset();").unwrap();
for member in ["p.width", "p.typename", "p.toString()", "String(p)"] {
let e = failure(&mut s, &format!("#targetengine keep\n{member};"));
assert!(e.contains("TypeError") && e.contains("not a DocumentPreset"), "{member}: {e}");
}
}
/// The values the presets hold count against the run's heap, a value assigned again in place of
/// the one before it.
#[test]
@@ -1576,6 +1604,23 @@ fn headless_add_document_dialog_fails_without_creating() {
assert_eq!(s.documents().len(), 1);
}
/// `addDocumentNoUI(startupPreset)` makes the document `addDocument(startupPreset)` makes, and
/// ignores the arguments after the preset's name.
#[test]
fn add_document_no_ui_makes_the_startup_presets_document() {
let mut s = Session::new();
let out = log(
&mut s,
"var a = app.documents.addDocument('Web'); var p = new DocumentPreset(); p.width = 333;\
var b = app.documents.addDocumentNoUI('Web', p, true);\
vc.log([b.typename, b.width === a.width, b.height === a.height, b.width === 333, app.documents.length]);",
);
assert_eq!(out, vec![json!(["Document", true, true, false, 2])]);
let e = failure(&mut s, "app.documents.addDocumentNoUI('No Such Preset');");
assert!(e.contains("no startup preset called No Such Preset"), "{e}");
assert_eq!(s.documents().len(), 2);
}
#[test]
fn setting_selected_keeps_how_the_other_objects_are_selected() {
let (mut s, a, b) = doc();
@@ -1615,16 +1660,19 @@ fn add_document_takes_only_a_document_preset() {
#[test]
fn add_document_applies_the_profile_file_and_throws_when_it_cannot_be_read() {
let dir = std::env::temp_dir().join(format!("vc-script-add-document-profile-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
let root = vectorcraft_testkit::TempDir::new("script-add-document-profile");
let dir = root.join("profiles");
let mut s = Session::new();
s.attach_new_doc_profiles(dir.clone());
// A profile with no file gives the defaults.
let out = log(&mut s, "vc.log(app.documents.addDocument('Web').typename);");
assert_eq!(out, vec![json!("Document")]);
assert_eq!(s.doc().unwrap().links_from, None);
// A script reads the profile's file in the app's own folder.
// A script reads the profile's file in the app's own folder, with no document open from it.
s.execute("file.newProfiles.edit", &json!({"name": "Print"})).unwrap();
while !s.documents().is_empty() {
s.execute("file.close", &json!({})).unwrap();
}
let file = dir.join("Print.vectorcraft").to_string_lossy().to_string();
log(&mut s, "app.documents.addDocument('Print');");
assert_eq!(s.doc().unwrap().links_from.as_deref(), Some(file.as_str()));
@@ -1651,13 +1699,12 @@ fn add_document_applies_the_profile_file_and_throws_when_it_cannot_be_read() {
// A startup preset with no profile reads no file.
let out = log(&mut s, "vc.log(app.documents.addDocument('Basic RGB').documentColorSpace);");
assert_eq!(out, vec![json!("DocumentColorSpace.RGB")]);
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
fn add_document_names_a_color_profile_of_the_profile_file_that_cannot_be_used() {
let dir = std::env::temp_dir().join(format!("vc-script-add-document-warning-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
let root = vectorcraft_testkit::TempDir::new("script-add-document-warning");
let dir = root.join("profiles");
let mut s = Session::new();
s.attach_new_doc_profiles(dir.clone());
s.execute("file.newProfiles.edit", &json!({"name": "Print"})).unwrap();
@@ -1675,7 +1722,6 @@ fn add_document_names_a_color_profile_of_the_profile_file_that_cannot_be_used()
let named = lines.iter().filter_map(Value::as_str).any(|l| l.starts_with("addDocument: ") && l.contains(&broken));
assert!(named, "{lines:?}");
assert_eq!(s.documents().len(), 1);
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
@@ -1778,8 +1824,7 @@ fn setters_on_a_stale_item_report_it_before_a_bad_value() {
fn objects_read_before_a_revert_are_stale_and_ones_read_after_are_the_loaded_ones() {
// `pageItems[0]` is the topmost object, the one made last.
let (mut s, _, b) = doc();
let dir = std::env::temp_dir().join(format!("vc-dom-revert-{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let dir = vectorcraft_testkit::TempDir::new("dom-revert");
let path = dir.join("saved.vectorcraft");
s.execute("document.save", &json!({"path": path.to_string_lossy()})).unwrap();
for read in ["i.name", "i.name = 'after'", "app.activeDocument.selection = i", "l.name"] {
@@ -1795,7 +1840,6 @@ fn objects_read_before_a_revert_are_stale_and_ones_read_after_are_the_loaded_one
);
assert_eq!(out, vec![json!(2)]);
assert_eq!(s.active().unwrap().doc.node(b).unwrap().name.as_deref(), Some("loaded"));
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
@@ -2140,6 +2184,21 @@ fn get_is_file_open_cannot_probe_outside_script_scope() {
assert!(failure(&mut s, "app.getIsFileOpen(new Array(5000).join('a'));").contains("too long"));
}
/// Outside Windows a `\` is part of a file name: `<dir>/a\b.svg` is not the open `<dir>/a/b.svg`.
#[test]
fn get_is_file_open_keeps_a_backslash_in_a_unix_file_name() {
let (mut s, _, _) = doc();
let fixture = vectorcraft_testkit::TempDir::new("script-file-open-backslash");
let dir = fixture.join("a");
std::fs::create_dir_all(&dir).unwrap();
let path = dir.join("b.svg");
s.execute("document.save", &json!({"path": path.to_string_lossy()})).unwrap();
let same = serde_json::to_string(&path.to_string_lossy()).unwrap();
let backslash = serde_json::to_string(&format!("{}\\b.svg", dir.to_string_lossy())).unwrap();
let out = log(&mut s, &format!("vc.log(app.getIsFileOpen({same})); vc.log(app.getIsFileOpen({backslash}));"));
assert_eq!(out, vec![json!(true), json!(cfg!(windows))]);
}
#[test]
fn a_menu_command_runs_its_command_on_the_selection() {
let (mut s, a, b) = doc();
@@ -3583,8 +3642,17 @@ fn the_selection_follows_page_items_and_costs_the_same_in_a_large_document() {
assert_eq!(out[0][0].as_array().map(Vec::len), Some(3));
// Each pass edits the document, so nothing kept from the last read can be reused.
let edits = "var d = app.activeDocument; for (var i = 0; i < 50; i++) d.selection[0].opacity = 50 + i % 2;";
// The script's fuel, and the host's calls and the bytes they count, which hold the work the
// host does for them: 64 KiB is less than one list of the large document's objects.
let cost = |s: &mut Session| {
crate::script::TEST_BRIDGE_BYTES.with(|b| b.set(Some(1 << 16)));
let r = run(s, edits);
crate::script::TEST_BRIDGE_BYTES.with(|b| b.set(None));
let r = r.unwrap_or_else(|e| panic!("the reads went over: {e}"));
(r["fuelUsed"].as_u64().unwrap(), r["hostCalls"].as_u64().unwrap())
};
s.execute("select.set", &json!({"ids": [c.0]})).unwrap();
let small = run(&mut s, edits).unwrap()["fuelUsed"].as_u64().unwrap();
let small = cost(&mut s);
// 3 objects doubled 11 times: 6,144.
s.execute("select.all", &json!({})).unwrap();
for _ in 0..11 {
@@ -3592,11 +3660,39 @@ fn the_selection_follows_page_items_and_costs_the_same_in_a_large_document() {
s.execute("select.all", &json!({})).unwrap();
}
s.execute("select.set", &json!({"ids": [c.0]})).unwrap();
crate::script::TEST_BRIDGE_BYTES.with(|b| b.set(Some(1 << 16)));
let large = run(&mut s, edits);
assert_eq!(small, cost(&mut s));
}
/// Building a collection's list again after an edit counts the objects it lists against the
/// run's allowance, so a loop that edits and reads `pageItems`, `pathItems` or `textFrames` in a
/// large document ends with the limit instead of walking the document each time for nothing.
#[test]
fn rebuilding_a_collection_after_an_edit_counts_against_the_run() {
let (mut s, a, _) = doc();
let source = |list: &str| {
format!("var d = app.activeDocument, it = d.pageItems[0]; for (var i = 0; i < 40; i++) {{ it.opacity = 50 + i % 2; d.{list}.length; }}")
};
let lists = ["pageItems", "pathItems", "textFrames"];
crate::script::TEST_BRIDGE_BYTES.with(|b| b.set(Some(1 << 20)));
let small: Vec<bool> = lists.iter().map(|l| run(&mut s, &source(l)).is_ok()).collect();
crate::script::TEST_BRIDGE_BYTES.with(|b| b.set(None));
let large = large.unwrap_or_else(|e| panic!("the reads in a large document went over: {e}"))["fuelUsed"].as_u64().unwrap();
assert_eq!(small, large);
assert_eq!(small, vec![true; 3], "a small document stays under 1 MiB");
// 2 objects doubled 11 times: 4,096, a list of 64 KiB each time it is built again.
s.execute("select.set", &json!({"ids": [a.0]})).unwrap();
s.execute("select.all", &json!({})).unwrap();
for _ in 0..11 {
s.execute("edit.duplicate", &json!({})).unwrap();
s.execute("select.all", &json!({})).unwrap();
}
// Nothing selected, so putting the selection back after each edit passes no list of ids.
s.execute("select.none", &json!({})).unwrap();
for list in lists {
crate::script::TEST_BRIDGE_BYTES.with(|b| b.set(Some(1 << 20)));
let r = run(&mut s, &source(list));
crate::script::TEST_BRIDGE_BYTES.with(|b| b.set(None));
let e = r.map(|r| panic!("{list}: 40 lists of 4,096 objects stayed under 1 MiB: {r}")).unwrap_err().to_string();
assert!(e.contains("passed more data to and from commands"), "{list}: {e}");
}
}
/// A collection read with a name gives what `getByName` gives, and throws as it does for no match.
+16 -35
View File
@@ -88,10 +88,10 @@ fn a_run_is_one_undo_step_in_each_document_it_changed() {
#[test]
fn a_run_that_changes_nothing_leaves_no_step_no_mark_and_no_journal_entry() {
let dir = fresh_folder("noop");
for source in ["", "var a = 1 + 2;", "vc.log(vc.document); vc.commands.length;"] {
let mut s = two_docs();
s.execute("document.save", &json!({"path": std::env::temp_dir().join(format!("vc-noop-{}.svg", std::process::id())).to_string_lossy()}))
.unwrap();
s.execute("document.save", &json!({"path": dir.join("noop.svg").to_string_lossy()})).unwrap();
let before = state(&s);
let revisions = |s: &Session| s.documents().iter().map(|d| d.revision).collect::<Vec<_>>();
let revisions_before = revisions(&s);
@@ -183,6 +183,11 @@ fn failed_script_report_keeps_message_and_adds_origin() {
("throw new RangeError('invalid array length');", "thrown", "RangeError: invalid array length", "script"),
("throw 'invalid array length';", "thrown", "invalid array length", "script"),
("throw 'ReferenceError: BridgeTalk is not defined';", "thrown", "ReferenceError: BridgeTalk is not defined", "script"),
("throw new ReferenceError('BridgeTalk is not defined');", "thrown", "ReferenceError: BridgeTalk is not defined", "script"),
("throw 'ReferenceError: Window is not defined';", "thrown", "ReferenceError: Window is not defined", "script"),
("throw new ReferenceError('Window is not defined');", "thrown", "ReferenceError: Window is not defined", "script"),
("throw 'ReferenceError: activeDocument is not defined';", "thrown", "ReferenceError: activeDocument is not defined", "script"),
("throw new ReferenceError('activeDocument is not defined');", "thrown", "ReferenceError: activeDocument is not defined", "script"),
("try { new Array(-1); } catch (e) { throw new Error(e.message); }", "thrown", "Error: invalid array length", "script"),
("new Array(-1);", "thrown", "RangeError: invalid array length", "built-in"),
("try { new Array(-1); } catch (e) { throw e; }", "thrown", "RangeError: invalid array length", "built-in"),
@@ -266,9 +271,7 @@ fn bad_parameters_are_refused_before_anything_runs() {
#[test]
fn files_are_checked_before_they_are_read() {
let dir = std::env::temp_dir().join(format!("vc-script-run-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
let dir = fresh_folder("checked");
let write = |name: &str, bytes: &[u8]| {
let p = dir.join(name);
std::fs::write(&p, bytes).unwrap();
@@ -296,7 +299,6 @@ fn files_are_checked_before_they_are_read() {
assert_eq!(s.execute("script.run", &path(&upper)).unwrap()["log"], json!([3]));
std::fs::create_dir_all(dir.join("folder.js")).unwrap();
assert!(s.execute("script.run", &path(&dir.join("folder.js").to_string_lossy())).is_err());
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
@@ -341,7 +343,6 @@ fn a_js_script_reads_ecmascript_2015_and_a_jsx_script_does_not() {
assert_eq!(kept["log"], json!(["1xy"]), "{kept}");
let e = s.execute("script.run", &path(&write("pattern.jsx", "var [a] = [1];"))).unwrap_err().to_string();
assert!(e.contains("SyntaxError"), "{e}");
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
@@ -367,7 +368,6 @@ fn a_js_script_reads_object_literal_extensions_and_function_names_and_a_jsx_scri
assert_eq!(legacy["log"], json!([false]), "{legacy}");
// Script text given without a file keeps the ExtendScript language.
assert!(run(&mut s, "var a = 1; var o = { a };").unwrap_err().to_string().contains("SyntaxError"));
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
@@ -390,7 +390,6 @@ fn a_js_script_reads_optional_chains_and_coalescing_and_a_jsx_script_does_not()
}
// Script text given without a file keeps the ExtendScript language.
assert!(run(&mut s, "vc.log(null ?? 1);").unwrap_err().to_string().contains("SyntaxError"));
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
@@ -417,7 +416,6 @@ fn a_js_script_runs_generators_and_a_jsx_script_does_not_read_them() {
s.execute("script.run", &path(&write("keep.jsx", "#targetengine genkept\nvar a = 1;"))).unwrap();
let e = s.execute("script.run", &path(&write("keep.js", "#targetengine genkept\nfunction* g() {}\ng();"))).unwrap_err().to_string();
assert!(e.contains("TypeError"), "{e}");
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
@@ -451,7 +449,6 @@ fn every_script_reads_e4x_and_has_the_xml_objects() {
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('<k>2</k>').toString());"))).unwrap();
assert_eq!(later["log"], json!(["2"]), "{later}");
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
@@ -474,15 +471,11 @@ fn a_js_script_defines_classes_and_a_jsx_script_cannot() {
assert!(e.contains("SyntaxError"), "{name}: {e}");
}
assert!(run(&mut s, "var C = class {};").unwrap_err().to_string().contains("SyntaxError"));
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()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
dir
/// A new empty folder for test `name`, removed when dropped, also when the test fails.
fn fresh_folder(name: &str) -> vectorcraft_testkit::TempDir {
vectorcraft_testkit::TempDir::new(&format!("script-run-{name}"))
}
/// Starts `source` in the app after a folder dialog it opens first, and allows the script the folder
@@ -530,7 +523,6 @@ fn a_failed_batch_puts_back_the_session_and_names_a_file_it_wrote() {
assert!(!s.guides_locked(), "the failed batch's Lock Guides does not stay");
assert!(path.exists());
assert_eq!(r["written"], json!([p]), "{r}");
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
@@ -544,7 +536,6 @@ fn an_export_that_fails_names_no_file() {
assert_eq!(r["log"], json!(["Error"]), "{r}");
assert!(!path.exists());
assert_eq!(r["written"], json!([]), "{r}");
let _ = std::fs::remove_dir_all(&dir);
}
/// The commands a script runs read and write only where its `File` and `Folder` objects may (its
@@ -594,7 +585,6 @@ fn a_scripts_commands_reach_only_its_own_places_and_the_open_documents() {
let r = run(&mut s, &call("document.save", &own)).unwrap();
assert_eq!(r["log"], json!(["ok"]), "a document's own file that was removed is made again: {r}");
assert!(own.exists());
let _ = std::fs::remove_dir_all(&dir);
}
/// The color at the middle of the PNG at `path`.
@@ -656,7 +646,6 @@ fn a_scripts_export_reads_the_files_the_documents_open_before_it_link_to() {
assert!(near(middle_color(&first), BLUE), "the linked file, not its preview: {:?}", middle_color(&first));
assert!(near(middle_color(&second), RED), "a document the script opened gets no linked file: {:?}", middle_color(&second));
assert_eq!(std::fs::read(&pic).unwrap(), png(600, 300, BLUE), "the linked file is not written");
let _ = std::fs::remove_dir_all(&dir);
}
/// A script line that runs command `id` with `params` and logs `ok`, or `denied` when the gate
@@ -674,7 +663,8 @@ fn tried(id: &str, params: &str) -> String {
#[test]
fn a_document_a_script_opened_from_a_linked_file_stays_read_only_in_later_runs() {
use crate::tests_links::{RED, open, place, png, save, session, write};
let art = fresh_folder("gate-linked-runs").join("art");
let root = fresh_folder("gate-linked-runs");
let art = root.join("art");
std::fs::create_dir_all(&art).unwrap();
let p = |f: std::path::PathBuf| f.to_string_lossy().into_owned();
let (pic, inner, poster) = (p(art.join("photo.png")), p(art.join("inner.vectorcraft")), p(art.join("poster.vectorcraft")));
@@ -704,7 +694,6 @@ fn a_document_a_script_opened_from_a_linked_file_stays_read_only_in_later_runs()
log.push(later["log"][0].clone());
assert_eq!(log, [json!("denied"), json!("denied")], "a save in the next run, then a read once nothing the person left links to it");
assert_eq!(std::fs::read(&inner).unwrap(), bytes, "the linked file is as it was");
let _ = std::fs::remove_dir_all(art.parent().unwrap());
}
/// A data set value a script gives a document, and a document a script opens, let no later run
@@ -741,7 +730,6 @@ fn what_a_script_adds_to_the_documents_lets_no_later_run_read_more() {
s.execute("document.save", &json!({"path": mine})).unwrap();
let saved = run(&mut s, &read_secret).unwrap();
assert_eq!(saved["log"], json!(["ok"]), "saved by the person: {saved}");
let _ = std::fs::remove_dir_all(&dir);
}
/// A save the person started before a script's command changed the document, and that finishes
@@ -766,7 +754,6 @@ fn a_save_started_before_a_scripts_change_lets_no_later_run_read_more() {
job.complete(&mut s, uid);
let r = run(&mut s, &tried("file.place", &format!("{{path: {secret:?}, at: [200, 150]}}"))).unwrap();
assert_eq!(r["log"], json!(["denied"]), "{r}");
let _ = std::fs::remove_dir_all(&dir);
}
/// A command a script runs does not save into the app's own libraries; the same command run
@@ -784,7 +771,6 @@ fn a_scripts_commands_do_not_save_into_the_apps_libraries() {
assert!(std::fs::read_dir(&user).map_or(true, |mut d| d.next().is_none()), "nothing is written in the user library folder");
s.execute("swatch.library.save", &json!({"user": true, "name": "Mine"})).unwrap();
assert_eq!(std::fs::read_dir(&user).unwrap().count(), 1);
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
@@ -867,7 +853,6 @@ fn an_abandoned_run_reports_the_files_it_wrote() {
let report = s.script_report().unwrap();
assert_eq!((report["kind"].as_str(), report["written"].clone()), (Some("stopped"), json!([p])), "{report}");
assert!(s.script_failure_text().unwrap().contains(&p));
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
@@ -1457,15 +1442,13 @@ fn a_file_saved_before_a_failure_stays_written_and_is_named() {
assert!(e.contains(&p), "{e}");
assert_eq!(s.script_report().unwrap()["written"], json!([p]));
assert_eq!(state(&s), before, "the document does not keep the new path");
let _ = std::fs::remove_dir_all(&dir);
}
/// A run in the app's frames keeps the file-access scope its `script.run` came in, whatever scope
/// the frames that advance it run in.
#[test]
fn a_framed_run_keeps_the_file_access_scope_it_started_in() {
let dir = std::env::temp_dir().join(format!("vc-script-scope-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
let dir = fresh_folder("scope");
let (allowed, outside) = (dir.join("allowed"), dir.join("outside"));
std::fs::create_dir_all(&allowed).unwrap();
std::fs::create_dir_all(&outside).unwrap();
@@ -1492,13 +1475,12 @@ fn a_framed_run_keeps_the_file_access_scope_it_started_in() {
let r = crate::file_access::confine(Some(&roots), || finish(&mut s)).unwrap();
assert_eq!(r["log"], json!(["ok"]), "a run the person started is not confined by a later caller: {r}");
assert!(user_target.exists());
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
fn a_committed_run_exports_what_it_drew() {
let path = std::env::temp_dir().join(format!("vc-script-export-{}.svg", std::process::id()));
let _ = std::fs::remove_file(&path);
let dir = fresh_folder("export");
let path = dir.join("export.svg");
let p = path.to_string_lossy().into_owned();
let mut s = Session::new();
s.execute("file.new", &json!({})).unwrap();
@@ -1509,7 +1491,6 @@ fn a_committed_run_exports_what_it_drew() {
assert_eq!(svg.matches("<rect").count() + svg.matches("<path").count(), 7, "{svg}");
let inspected = s.execute("document.inspect", &json!({})).unwrap();
assert_eq!(inspected["layers"][0]["children"].as_array().map(Vec::len), Some(7));
let _ = std::fs::remove_file(&path);
}
#[test]
+1
View File
@@ -679,6 +679,7 @@ fn structured_junk() {
("perspective.transform", json!({"matrix": [1, 0, 0, 1, 0, 0], "depth": -1e9, "plane": "left", "copy": true})),
("perspective.transform", json!({"matrix": [1, 0, 0, 1, 1e300, 0], "plane": "left"})),
("perspective.nudge", json!({"dx": 1e308, "dy": -1e308, "big": true, "copy": true})),
("perspective.nudge", json!({"dx": 1e308, "dy": -1e308, "fine": true})),
("perspective.plane.move", json!({"plane": "ground", "offset": 1e308, "objects": "copy"})),
("perspective.plane.move", json!({"plane": "left", "by": -1e7, "objects": "move"})),
("perspective.plane.move", json!({"plane": "none", "offset": 0})),
@@ -110,7 +110,7 @@ const INSIDE: &[(&str, &str)] = &[
toString transparencyGrid transparencyGrid= typename units units= width width=",
),
("Documents.", "prototype"),
("Documents.prototype.", "add addDocument constructor getByName index length parent toString typename"),
("Documents.prototype.", "add addDocument addDocumentNoUI constructor getByName index length parent toString typename"),
("Document.", "prototype"),
(
"Document.prototype.",
+15 -2
View File
@@ -314,8 +314,21 @@ fn get_at(interp: &mut Interp, o: ObjId, k: f64) -> JsResult<Value> {
interp.get_from(o, &key_of(k), &Value::Object(o))
}
fn has_at(interp: &mut Interp, o: ObjId, k: f64) -> JsResult<bool> {
interp.has_property_indexed(o, &key_of(k))
/// The element at `k` when the object or its prototypes have one: [[HasProperty]], then [[Get]].
/// An object of a host class with an indexer answers an array index with one call of the indexer,
/// made as `k in object` makes it, and has the element when the answer is not `undefined`.
fn element_at(interp: &mut Interp, o: ObjId, k: f64) -> JsResult<Option<Value>> {
let key = key_of(k);
if crate::value::array_index(&key).is_some()
&& let Some(f) = interp.host_indexer(o)?
{
let v = interp.host_index(&f, o, crate::Data::Number(k), true)?;
return Ok((!matches!(v, Value::Undefined)).then_some(v));
}
if !interp.has_property_indexed(o, &key)? {
return Ok(None);
}
interp.get_from(o, &key, &Value::Object(o)).map(Some)
}
/// The estimated bytes a new element adds.
+8 -9
View File
@@ -5,11 +5,12 @@
//! the range is much longer than the object has properties (a sparse array such as
//! `new Array(4294967295)`), so a long empty range costs nothing and no index is allocated for
//! it. The list of indices is made again whenever a script adds an index property to any object
//! while the method runs. Every index visited takes a unit of fuel.
//! while the method runs. An object of a host class with an indexer has every index of the range
//! visited, since its elements are not properties. Every index visited takes a unit of fuel.
use super::{
Builder, ELEMENT_BYTES, arg, constructor, create_at, delete_at, get_at, has_at, length_of, method, native, new_array, object_to_string, put_at,
require_callable, to_integer,
Builder, ELEMENT_BYTES, arg, constructor, create_at, delete_at, element_at, get_at, length_of, method, native, new_array, object_to_string,
put_at, require_callable, to_integer,
};
use crate::heap::{Class, NativeKind, ObjId};
use crate::interp::{Abrupt, Interp, JsResult, strict_eq};
@@ -121,7 +122,9 @@ fn chain(interp: &Interp, obj: ObjId) -> Vec<(ObjId, usize)> {
impl Indices {
fn new(interp: &mut Interp, obj: ObjId, lo: u64, hi: u64, ascending: bool, maps: Vec<Map>) -> JsResult<Self> {
let mut it = Indices { obj, lo, hi, ascending, maps, sparse: None };
if hi.saturating_sub(lo) > DENSE_SPAN {
// An object of a host class with an indexer holds its elements in the host, not in
// properties, so every index of the range is visited.
if hi.saturating_sub(lo) > DENSE_SPAN && interp.host_indexer(obj)?.is_none() {
let present: usize = chain(interp, obj).iter().map(|(_, n)| *n).fold(0, usize::saturating_add);
if hi - lo > (present as u64).saturating_mul(8) {
it.sparse = Some(it.gather(interp)?);
@@ -206,11 +209,7 @@ impl Indices {
/// The element at `k` when the object or its prototypes have one.
fn element(interp: &mut Interp, o: ObjId, k: u64) -> JsResult<Option<Value>> {
let k = k as f64;
if !has_at(interp, o, k)? {
return Ok(None);
}
get_at(interp, o, k).map(Some)
element_at(interp, o, k as f64)
}
/// ToObject of `this`, kept reachable while `f` runs.
+10 -3
View File
@@ -21,7 +21,10 @@
//! has. Names the engine looks up itself, such as `toJSON` in `JSON.stringify`, do not go to the
//! indexer. Assigning to such a name reads it with the indexer first, so the assignment throws what
//! the read throws; otherwise the value is not kept. `k in object` calls the indexer with `true` as
//! a third argument, and is true when it gives a value other than `undefined`.
//! a third argument, and is true when it gives a value other than `undefined`. The `Array.prototype`
//! methods that skip missing elements, such as `forEach` and `map`, read each index of such an
//! object with that one call and take its answer as the element, so an indexer called with `true`
//! gives the element itself, or `undefined` when there is none.
//!
//! `hasOwnProperty` and `propertyIsEnumerable` are true on an object of a host class for each
//! member of its class and of the classes it descends from, apart from the members that are not
@@ -105,7 +108,10 @@ pub struct HostClass {
/// What `reflect` tells of the members, each under the name of one of `members`. A member
/// without an entry has the type `unknown` and nothing else.
pub info: Vec<(String, MemberInfo)>,
/// What `object[i]` gives for an array index `i`.
/// What `object[i]` gives for an array index `i`. Called with `true` as a third argument, it
/// gives the same element, or `undefined` when there is none. The `Array.prototype` methods that
/// skip missing elements, such as `forEach` and `map`, make that call and use its answer as the
/// element; reads without the third argument, such as those of `join`, are ordinary reads.
pub index: Option<HostFunction>,
/// What `new Name(...)` and `Name(...)` give; without it both throw a `TypeError`.
pub construct: Option<HostFunction>,
@@ -365,7 +371,8 @@ impl Interp {
/// `object[k]` of an object of a host class, which its class's indexer `f` answers: `k` is an
/// array index as a number, or a name as a string. With `probe`, for `k in object`, the indexer
/// gets `true` as a third argument.
/// gets `true` as a third argument and gives the element itself, or `undefined` when there is
/// none, not a marker.
pub(crate) fn host_index(&mut self, f: &HostFunction, id: ObjId, k: Data, probe: bool) -> JsResult<Value> {
self.use_fuel()?;
if self.host_ref_size(id)?.is_none() {
+66
View File
@@ -874,6 +874,29 @@ fn the_answer_to_a_waiting_member_of_a_host_class_is_an_object_of_its_class() {
assert_eq!(finish(&mut r, 1_000).0.unwrap(), JsValue::String("true,2,true,false".into()));
}
/// An answer that cannot be read as a value, for a global function or a member of a host class,
/// is thrown at the call that waited, where the script catches it, and the run goes on.
#[test]
fn an_answer_that_cannot_be_read_is_thrown_at_the_waiting_call() {
let mut nested = Data::Null;
for _ in 0..20 {
nested = Data::Array(vec![nested]);
}
for call in ["ask('x')", "thing.fetch()"] {
let source = format!("var m = 'none'; try {{ {call}; }} catch (e) {{ m = e.name + '|' + e.message; }} m + '|after'");
let mut r = realm(1_000_000);
with_ask(&mut r);
with_thing(&mut r, None);
r.set_data_limits(DataLimits { depth: 8, bytes: 16 << 20, entries: 1_000 });
r.start(&source).unwrap();
assert_eq!(r.advance(1_000).unwrap(), Progress::Paused);
assert!(r.waits());
r.answer(nested.clone()).unwrap();
let JsValue::String(out) = finish(&mut r, 1_000).0.unwrap() else { panic!("{call}: not a string") };
assert!(out.starts_with("RangeError|") && out.contains("nested too deep") && out.ends_with("|after"), "{call}: {out}");
}
}
/// A realm with the host class `Thing`: `make(n)` gives the `Thing` whose handle is `n` followed by
/// zeros, `len` numbers in all, and `take()` gives `undefined`; and the global `thing`, the `Thing`
/// with the handle `[0]`.
@@ -1044,6 +1067,49 @@ fn assigning_a_name_a_prototype_has_does_not_call_the_indexer() {
assert_eq!(calls.get(), 1);
}
/// A realm with `it`, a host collection of `len` numbers whose element `i` is `i`, and the count
/// of the indexer's calls.
fn numbers(len: usize) -> (Realm, Rc<Cell<u32>>) {
let mut r = realm(10_000_000);
let calls: Rc<Cell<u32>> = Rc::default();
let seen = calls.clone();
let index: HostFunction = Rc::new(move |a| {
seen.set(seen.get() + 1);
match a.get(1) {
Some(Data::Number(n)) if *n < len as f64 => Ok(Data::Number(*n)),
_ => Ok(Data::Undefined),
}
});
let length: HostFunction = Rc::new(move |_| Ok(Data::Number(len as f64)));
let class = HostClass {
name: "Numbers".into(),
parent: None,
members: vec![("length".into(), HostMember::Get(length))],
info: Vec::new(),
index: Some(index),
construct: None,
};
r.define_host_classes(vec![class], vec![("it".into(), host_ref("Numbers", &[1.0]))]).unwrap();
(r, calls)
}
#[test]
fn array_methods_visit_every_element_of_a_long_host_collection() {
let (mut r, _) = numbers(5000);
let source = "var n = 0; Array.prototype.forEach.call(it, function () { n++; }); \
var m = Array.prototype.map.call(it, function (x) { return x; }); \
[n, m.length, m[4999], Array.prototype.lastIndexOf.call(it, 0), Array.prototype.indexOf.call(it, 4999)].join()";
assert_eq!(r.run(source).unwrap(), JsValue::String("5000,5000,4999,0,4999".into()));
}
#[test]
fn array_methods_call_the_indexer_once_for_each_element() {
let (mut r, calls) = numbers(3);
let source = "var s = 0; Array.prototype.forEach.call(it, function (x) { s += x; }); s";
assert_eq!(r.run(source).unwrap(), JsValue::Number(3.0));
assert_eq!(calls.get(), 3);
}
#[test]
fn a_converted_function_reads_each_argument_as_its_list_says() {
let mut r = realm(1_000_000);
+38 -4
View File
@@ -254,8 +254,10 @@ pub(crate) type PausableFn = fn(&mut Interp, Value, &[Value]) -> JsResult<Pause>
/// resume function gives.
pub(crate) type ResumeFn = fn(&mut Interp, &[Value], Value) -> JsResult<Value>;
/// What a [`Pause`] does with its kept values when its host call fails.
pub(crate) type FailFn = fn(&mut Interp, &[Value]);
/// What a [`Pause`] does with its kept values when its host call fails. An error it gives that is
/// not thrown (a stop, such as a host's Abort) ends the run in place of a thrown failure; a thrown
/// one gives way to the failure.
pub(crate) type FailFn = fn(&mut Interp, &[Value]) -> JsResult<()>;
/// The host call a [`PausableFn`] makes: the host function `host` with `args`. Its answer goes to
/// `resume` with `keep`, at once when the host answers at once. When the host waits
@@ -274,6 +276,23 @@ pub(crate) struct Pause {
pub(crate) struct Resumption {
resume: ResumeFn,
keep: Vec<Value>,
/// Runs when the answer cannot be read, so the resume function never gets it.
failed: Option<FailFn>,
}
impl Resumption {
/// The built-in does not get the host's answer: its failure function runs with its kept
/// values, which `thrown` is kept from collection with. → the stop the failure function
/// gave, which ends the run in place of `thrown`.
pub(crate) fn fail(self, interp: &mut Interp, thrown: &Value) -> JsResult<()> {
let Some(failed) = self.failed else { return Ok(()) };
let mark = interp.temp_roots.len();
interp.temp_roots.extend(self.keep.iter().cloned());
interp.temp_roots.push(thrown.clone());
let r = failed(interp, &self.keep);
interp.temp_roots.truncate(mark);
r
}
}
pub(crate) struct Interp {
@@ -378,6 +397,10 @@ pub(crate) struct Interp {
/// The call that waits is a member of a host class ([`crate::host::ArgRead::Hosted`]): its
/// answer is read as such a member's result is ([`Interp::write_hosted`]).
pub(crate) waiting_hosted: bool,
/// The answer to the call that waited could not be read as a value
/// ([`crate::Realm::answer`]): the value on top of the stack is the exception, which the next
/// step throws at that call.
pub(crate) answer_throws: bool,
/// A host class's constructor runs with `new`: it may not wait for its result.
pub(crate) constructing: bool,
/// The built-in that waits with the host's call ([`Pause::Ask`]): it takes the answer before
@@ -690,6 +713,7 @@ impl Interp {
can_wait: Rc::default(),
waiting: false,
waiting_hosted: false,
answer_throws: false,
constructing: false,
resuming: None,
again: None,
@@ -1031,6 +1055,11 @@ impl Interp {
fn step(&mut self) -> JsResult<Option<Value>> {
self.tick()?;
// An answer that could not be read is thrown at the call that waited for it.
if std::mem::take(&mut self.answer_throws) {
let thrown = self.pop()?;
return Err(Abrupt::Throw(thrown));
}
// A built-in that waited for the host takes the answer on top of the stack before the
// instruction after its call runs; what it throws is thrown at that call.
if let Some(r) = self.resuming.take() {
@@ -3560,6 +3589,7 @@ impl Interp {
Some(Func::Data { f, name, read }) => self.call_data(&f, &name, &Value::Undefined, &args, &read),
_ => self.call(&host, &Value::Undefined, &args),
};
let mut stop = Ok(());
if let Err(e) = &answer
&& let Some(failed) = failed
{
@@ -3567,11 +3597,15 @@ impl Interp {
if let Abrupt::Throw(v) = e {
self.temp_roots.push(v.clone());
}
failed(self, &keep);
stop = failed(self, &keep);
}
self.temp_roots.truncate(mark);
// A stop from `failed` is not masked by a thrown error the script could catch.
if matches!(answer, Err(Abrupt::Throw(_))) {
stop?;
}
let answer = answer?;
let r = Resumption { resume, keep };
let r = Resumption { resume, keep, failed };
if self.waiting && !was_waiting {
self.resuming = Some(r);
return Ok(answer);
+28 -6
View File
@@ -380,6 +380,7 @@ impl Realm {
interp.host_abort = None;
interp.waiting = false;
interp.waiting_hosted = false;
interp.answer_throws = false;
interp.constructing = false;
interp.resuming = None;
interp.again = None;
@@ -426,6 +427,7 @@ impl Realm {
interp.join_stack.clear();
interp.waiting = false;
interp.waiting_hosted = false;
interp.answer_throws = false;
interp.constructing = false;
interp.resuming = None;
interp.again = None;
@@ -566,8 +568,10 @@ impl Realm {
/// Gives the call that waits ([`crate::HostError::Wait`]) its result `d`; the next
/// [`Realm::advance`] goes on from there. When a built-in such as `File.openDialog` made the
/// call, the built-in takes `d` first and gives its own result, and what it throws is thrown
/// at its call. A result past the heap limit ends the run with that
/// limit, and with no call waiting this gives an internal error.
/// at its call. A result that cannot be read as a value, such as one nested too deep, is
/// thrown at the call as an immediate result would be, and the built-in does not get it. A
/// result past the heap limit ends the run with that limit, and with no call waiting this gives
/// an internal error.
pub fn answer(&mut self, d: crate::Data) -> Result<(), RunError> {
let interp = &mut self.interp;
if !interp.waiting {
@@ -584,10 +588,28 @@ impl Realm {
let hosted = std::mem::take(&mut interp.waiting_hosted);
// The value on top of the stack stood in for the result.
let written = if hosted { interp.write_hosted(d) } else { interp.write_data(d, 0, false) };
let r = written.and_then(|v| {
interp.stack.pop();
interp.push(v)
});
let r = match written {
// An answer that cannot be read as a value (too deep, too many entries, a stale host
// reference) is thrown at the call, where the script can catch it, and a built-in
// that waited with the call does not get it: it fails as when its host call throws. A
// stop its failure gives (an Abort from the host) ends the run before the error is
// thrown.
Err(Abrupt::Throw(thrown)) => {
interp.stack.pop();
let stop = match interp.resuming.take() {
Some(r) => r.fail(interp, &thrown),
None => Ok(()),
};
stop.and_then(|()| {
interp.answer_throws = true;
interp.push(thrown)
})
}
written => written.and_then(|v| {
interp.stack.pop();
interp.push(v)
}),
};
match r {
Ok(()) => Ok(()),
Err(e) => self.outcome(Err(e)).map(drop),
+16 -6
View File
@@ -1543,16 +1543,21 @@ fn show(i: &mut Interp, this: Value, _: &[Value]) -> JsResult<Pause> {
})
}
/// A host call of `show()` failed, or a handler threw: the dialog is no longer showing.
fn failed(i: &mut Interp, keep: &[Value]) {
let Some(win) = arg(keep, 0).as_object() else { return };
/// A host call of `show()` failed, or a handler threw: the dialog is no longer showing. → a stop
/// (an Abort) the host's `end` gave; an error `end` throws gives way to the failure.
fn failed(i: &mut Interp, keep: &[Value]) -> JsResult<()> {
let Some(win) = arg(keep, 0).as_object() else { return Ok(()) };
if classes(i).ok().and_then(|c| c.showing) != Some(win) {
return;
return Ok(());
}
set_showing(i, None);
if let Ok(end) = host_fn(i, "end") {
let _ = i.call(&end, &Value::Undefined, &[Value::Number(0.0), Value::Bool(false)]);
match i.call(&end, &Value::Undefined, &[Value::Number(0.0), Value::Bool(false)]) {
Ok(_) | Err(Abrupt::Throw(_)) => {}
Err(stop) => return Err(stop),
}
}
Ok(())
}
/// `show()` ends with `result`.
@@ -1611,10 +1616,15 @@ fn guarded(i: &mut Interp, keep: &[Value], r: impl FnOnce(&mut Interp) -> JsResu
Abrupt::Throw(t) => vec![t.clone()],
_ => Vec::new(),
};
let thrown_error = !thrown.is_empty();
let mark = i.temp_roots.len();
i.temp_roots.extend(thrown);
failed(i, keep);
let stop = failed(i, keep);
i.temp_roots.truncate(mark);
// A stop from `end` is not masked by a thrown error the script could catch.
if thrown_error {
stop?;
}
}
v
}
+76
View File
@@ -229,6 +229,82 @@ fn a_dialog_can_be_shown_again_after_it_closed() {
assert_eq!(r.run(&format!("{FORM} [w.show(), w.show()].join()")).unwrap(), JsValue::String("1,2".into()));
}
/// An event the host gives a waiting `show()` that cannot be read is thrown at `show()`, and the
/// dialog is no longer showing, so it can be shown again.
#[test]
fn an_event_that_cannot_be_read_ends_show_and_the_dialog_can_show_again() {
let (mut r, seen, _) = realm(Vec::new());
r.set_data_limits(DataLimits { depth: 8, bytes: 16 << 20, entries: 1_000 });
let mut nested = Data::Null;
for _ in 0..20 {
nested = Data::Array(vec![nested]);
}
r.start("var w = new Window('dialog'), m = 'none'; try { w.show(); } catch (e) { m = e.name; } m + '|' + w.show()").unwrap();
assert_eq!(r.advance(100_000).unwrap(), Progress::Paused);
assert!(r.waits());
r.answer(nested).unwrap();
assert_eq!(seen.borrow().ends, vec![(0.0, false)], "show ended without its result");
assert_eq!(r.advance(100_000).unwrap(), Progress::Paused);
assert!(r.waits(), "the second show waits for its event");
r.answer(close()).unwrap();
let mut out = r.advance(100_000).unwrap();
while out == Progress::Paused {
out = r.advance(100_000).unwrap();
}
assert_eq!(out, Progress::Done(JsValue::String("RangeError|0".into())));
assert_eq!(seen.borrow().ends, vec![(0.0, false), (0.0, true)]);
}
/// A realm whose `end` stops the run (an Abort) when `show()` ends without its result, whose
/// `open` throws when `open_fails`, and whose `wait` gives `events` in order, then waits.
fn stopping_realm(open_fails: bool, events: Vec<Data>) -> Realm {
let mut r = Realm::new();
r.set_limits(Limits { fuel: 10_000_000, ..Limits::default() });
let queue = RefCell::new(VecDeque::from(events));
let open: HostFunction = Rc::new(move |_| if open_fails { Err(HostError::Error("no window".into())) } else { Ok(Data::Undefined) });
let wait: HostFunction = Rc::new(move |_| queue.borrow_mut().pop_front().ok_or(HostError::Wait));
let end: HostFunction = Rc::new(|args| match args.get(1) {
Some(Data::Bool(true)) => Ok(Data::Undefined),
_ => Err(HostError::Abort("stopped by the host".into())),
});
let items = vec![("open".into(), HostItem::Function(open)), ("wait".into(), HostItem::Function(wait)), ("end".into(), HostItem::Function(end))];
r.define_script_ui(items).unwrap();
r
}
fn is_host_stop(e: &RunError) -> bool {
e.kind == RunErrorKind::Limit(LimitKind::Host) && e.message == "stopped by the host"
}
/// A stop the host's `end` gives when `show()` fails ends the run: the script cannot catch the
/// failure and go on, whether the event could not be read, the host call threw or a handler threw.
#[test]
fn a_stop_from_end_when_show_fails_ends_the_run() {
let caught = "var w = new Window('dialog'); var b = w.add('button', undefined, 'Go'); \
b.onClick = function () { throw new Error('handler'); }; \
try { w.show(); } catch (e) {} 'went on'";
let mut r = stopping_realm(false, Vec::new());
r.set_data_limits(DataLimits { depth: 8, bytes: 16 << 20, entries: 1_000 });
let mut nested = Data::Null;
for _ in 0..20 {
nested = Data::Array(vec![nested]);
}
r.start(caught).unwrap();
assert_eq!(r.advance(100_000).unwrap(), Progress::Paused);
assert!(r.waits());
let answered = r.answer(nested);
assert!(answered.as_ref().is_err_and(is_host_stop), "unreadable event: {answered:?}");
let mut r = stopping_realm(true, Vec::new());
let ran = r.run(caught);
assert!(ran.as_ref().is_err_and(is_host_stop), "open threw: {ran:?}");
let mut r = stopping_realm(false, vec![click(1)]);
let ran = r.run(caught);
assert!(ran.as_ref().is_err_and(is_host_stop), "handler threw: {ran:?}");
}
#[test]
fn types_that_are_not_available_yet_throw_errors_that_say_so() {
for (source, want) in [
File diff suppressed because one or more lines are too long
+16 -3
View File
@@ -409,11 +409,12 @@ impl ToolContext<'_> {
pub fn star_radii_label(&self, outer: f64, inner: f64) -> String {
format!("R1: {}\nR2: {}", self.len(outer), self.len(inner))
}
/// The move an arrow key nudges by: General › Keyboard Increment (ten times with Shift),
/// along General › Constrain Angle's axes; `None` for other keys.
/// The move an arrow key nudges by: General › Keyboard Increment, ten times with Shift and a
/// tenth with Ctrl/Cmd ([`nudge_step`]), along General › Constrain Angle's axes; `None` for
/// other keys.
pub fn arrow_nudge(&self, key: crate::ToolKey, mods: crate::Mods) -> Option<Vec2> {
use crate::ToolKey;
let step = self.keyboard_increment * if mods.shift { 10.0 } else { 1.0 };
let step = nudge_step(self.keyboard_increment, mods.shift, mods.cmd);
let d = match key {
ToolKey::Left => Point::new(-step, 0.0),
ToolKey::Right => Point::new(step, 0.0),
@@ -486,3 +487,15 @@ impl ToolContext<'_> {
vectorcraft_doc::hit::HitOptions { clip_outlines: true, unfilled_interiors: true, ..self.hit_options() }
}
}
/// The arrow keys' step: the keyboard increment, ×10 with Shift (`big`) and ÷10 with Ctrl/Cmd
/// (`fine`), so Shift+Ctrl+arrow moves by one increment. Divided, not multiplied by 0.1, so a tenth
/// of a 1 pt increment is the nearest `f64` to 0.1.
pub fn nudge_step(increment: f64, big: bool, fine: bool) -> f64 {
match (big, fine) {
(true, true) => increment,
(true, false) => increment * 10.0,
(false, true) => increment / 10.0,
(false, false) => increment,
}
}
+4 -1
View File
@@ -681,7 +681,8 @@ fn a_marquee_selects_frame_anchors_of_area_type() {
assert_eq!(a[0], Action::Begin("Reshape Type Area".into()));
assert_eq!(a[1], Action::Preview("text.reshapeArea".into(), json!({"id": text.0, "anchors": [[0, 1], [0, 2]], "dx": 20.0, "dy": 20.0})));
assert_eq!(t.pointer(&cx2, &ev(PointerKind::Up, 440.0, 360.0)), vec![Action::Commit, Action::Notify(FRAME_PICKED.into())]);
// The arrow keys nudge them by the keyboard increment, ten times that with Shift.
// The arrow keys nudge them by the keyboard increment, ten times that with Shift, a tenth with
// Ctrl/Cmd and one increment with both (#5258).
let nudged = |anchors: Value, dx: f64, dy: f64| {
vec![
Action::Exec("text.reshapeArea".into(), json!({"id": text.0, "anchors": anchors, "dx": dx, "dy": dy})),
@@ -691,6 +692,8 @@ fn a_marquee_selects_frame_anchors_of_area_type() {
assert!(t.claims_key(&cx2, ToolKey::Right) && !t.claims_key(&cx2, ToolKey::Enter));
assert_eq!(t.key(&cx2, ToolKey::Right, Mods::default()), nudged(json!([[0, 1], [0, 2]]), 1.0, 0.0));
assert_eq!(t.key(&cx2, ToolKey::Up, Mods { shift: true, ..Mods::default() }), nudged(json!([[0, 1], [0, 2]]), 0.0, -10.0));
assert_eq!(t.key(&cx2, ToolKey::Left, Mods { cmd: true, ..Mods::default() }), nudged(json!([[0, 1], [0, 2]]), -0.1, 0.0));
assert_eq!(t.key(&cx2, ToolKey::Down, Mods { shift: true, cmd: true, ..Mods::default() }), nudged(json!([[0, 1], [0, 2]]), 0.0, 1.0));
// Any other change of the document or the selection (Deselect, then the same type selected
// again) leaves the type selected whole: the arrow keys are no longer the tool's.
let mut later = cx(&d, &s, &p);
@@ -337,7 +337,7 @@ impl Tool for PerspectiveSelectionTool {
if !self.claims_key(cx, key) {
return vec![];
}
vec![Action::Exec("perspective.nudge".into(), json!({"dx": dx, "dy": dy, "big": mods.shift, "copy": mods.alt}))]
vec![Action::Exec("perspective.nudge".into(), json!({"dx": dx, "dy": dy, "big": mods.shift, "fine": mods.cmd, "copy": mods.alt}))]
}
fn claims_key(&self, cx: &ToolContext, key: ToolKey) -> bool {
// The arrows nudge a selection in perspective.
+1 -1
View File
@@ -67,7 +67,7 @@ mod cursor;
mod input;
mod readout;
pub use context::{GlyphSnap, MarqueeMode, PaintDefaults, PixelOp, PixelSnap, ScreenFrame, ToolContext, ordinary_isolation};
pub use context::{GlyphSnap, MarqueeMode, PaintDefaults, PixelOp, PixelSnap, ScreenFrame, ToolContext, nudge_step, ordinary_isolation};
pub use cursor::Cursor;
pub use input::{Action, Mods, PenPose, PointerEvent, PointerKind, ToolKey};
pub use readout::Readout;
+42 -6
View File
@@ -29,7 +29,6 @@ use super::outline::{ViewHides, c32, linked_crosses, node_outline, selection_hit
// PLAN: `BodyKind`, `Win` and `ViewKey::from(CanvasView)` are canvas-w10's (cv.S1, S2, S5); their paths here follow the contract.
use super::{BodyKind, VectorcraftApp, Win};
// PLAN: `anchors` takes `tool_points` because the Curvature tool's own points come from `session.overlays`, which only `show` may call (`&mut app`).
// PLAN: BezierOverlay selects anchors of every path under `HandlesShown`, so a whole-selected container draws handles that the old marks hid outside Direct Selection.
/// The anchor square's side at Selection & Anchor Display › Size 3, the default, in points.
const ANCHOR_AT_DEFAULT_SIZE: f32 = 5.0;
@@ -60,6 +59,12 @@ pub(super) struct Anchors {
pub paths: Vec<EditPath>,
/// The selected anchors and the selected segment.
pub selection: PathSelection,
/// The paths whose anchors show selected without direction handles: paths selected whole, or inside a container
/// selected whole, under a tool that does not drag handles, and the paths inside a container selected whole under
/// one that does ([`vectorcraft_tools::catalog::edits_anchors`]).
pub plain: Vec<EditPath>,
/// Every anchor of `plain`, selected.
pub plain_selection: PathSelection,
/// Anchors as squares, or as circles under the Curvature tool.
pub shown: AnchorsShown,
/// Whose direction handles show.
@@ -259,15 +264,21 @@ fn grid_path(key: u64, points: impl Iterator<Item = Point>, color: Color32) -> E
/// The anchors and handles of the selection. An object selected whole has every anchor selected, and so do the
/// paths inside a group, compound path or clip group selected whole; with Direct Selection's partial selection only
/// the chosen anchors are, and a selected segment hollows the others. `tool_points` is whether the tool draws its own
/// points (the Curvature tool while it draws), which leaves nothing here. `tool` is the tool whose marks show
/// ([`super::shown_tool`]). Nothing too big to outline, and nothing during Halftone Preview.
/// the chosen anchors are, and a selected segment hollows the others. Direction handles show for a partial selection's
/// anchors, for a selected segment, and for a path selected whole when `tool` drags handles
/// ([`vectorcraft_tools::catalog::edits_anchors`]); every other path goes to [`Anchors::plain`], whose anchors show
/// without handles. `tool_points` is whether the tool draws its own points (the Curvature tool while it draws), which
/// leaves nothing here. `tool` is the tool whose marks show ([`super::shown_tool`]). Nothing too big to outline, and
/// nothing during Halftone Preview.
pub(super) fn anchors(app: &VectorcraftApp, st: &DocState, tool: &str, tool_points: bool) -> Anchors {
let curvature = tool == "curvature";
let drags_handles = vectorcraft_tools::catalog::edits_anchors(tool);
let prefs = &app.session.prefs;
let mut out = Anchors {
paths: vec![],
selection: PathSelection::default(),
plain: vec![],
plain_selection: PathSelection::default(),
shown: if curvature { AnchorsShown::Curvature } else { AnchorsShown::All },
handles: if prefs.show_handles_multiple_anchors { HandlesShown::Selected } else { HandlesShown::OneAnchor },
segment_mark: SegmentMark::Line,
@@ -279,6 +290,7 @@ pub(super) fn anchors(app: &VectorcraftApp, st: &DocState, tool: &str, tool_poin
let (sel, hides) = (&st.selection, ViewHides::of(app));
// The selected anchors by path, and the selected segment with its path.
let mut chosen: Vec<(u64, Vec<KnotRef>)> = vec![];
let mut plain: Vec<(u64, Vec<KnotRef>)> = vec![];
let mut segment: Option<(u64, KnotRef)> = None;
for id in &sel.objects {
let Some(node) = st.doc.node(*id) else { continue };
@@ -295,8 +307,15 @@ pub(super) fn anchors(app: &VectorcraftApp, st: &DocState, tool: &str, tool_poin
return;
}
let NodeKind::Path { path, .. } = &c.kind else { return };
out.paths.push(edit_path(c.id.0, path, color));
let segments = sel.segments.get(&c.id);
// The handles the tools drag ([`vectorcraft_tools::direct`]'s `handle_anchors`): a partial selection's, a
// selected segment's, and those of a path selected itself under a tool that edits anchors.
if partial.is_none() && segments.is_none() && !(drags_handles && c.id == *id) {
out.plain.push(edit_path(c.id.0, path, color));
plain.push((c.id.0, path.anchors().map(|(si, ai, _)| KnotRef::new(si, ai)).collect()));
return;
}
out.paths.push(edit_path(c.id.0, path, color));
if let Some(&(si, seg)) = segments.and_then(|s| s.iter().next()) {
segment.get_or_insert((c.id.0, KnotRef::new(si, seg)));
}
@@ -326,6 +345,14 @@ pub(super) fn anchors(app: &VectorcraftApp, st: &DocState, tool: &str, tool_poin
);
selection.others = by_key(chosen.into_iter().filter(|(key, _)| Some(*key) != primary));
out.selection = selection;
// `show` draws `plain` with `HandlesShown::OneAnchor`, which shows handles only while one anchor is selected. A
// lone anchor is drawn with its handles retracted instead; the selection's outline still draws its path.
if plain.iter().map(|(_, knots)| knots.len()).sum::<usize>() == 1 {
for knot in out.plain.iter_mut().flat_map(|p| &mut p.subpaths).flat_map(|sp| &mut sp.knots) {
(knot.in_ctrl, knot.out_ctrl) = (knot.anchor, knot.anchor);
}
}
out.plain_selection.others = by_key(plain);
out
}
@@ -660,6 +687,15 @@ pub(super) fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui, space: &CanvasSp
.path_options(&anchors.options)
.show_at(ui, rect);
}
if !anchors.plain.is_empty() {
let mut paths = anchors.plain.clone();
let _ = BezierOverlay::new("Selected anchors", Bind::bound(&mut paths), &anchors.plain_selection)
.tool(BezierTool::Anchors)
.handles(HandlesShown::OneAnchor)
.anchors(anchors.shown)
.path_options(&anchors.options)
.show_at(ui, rect);
}
let dots = &marks.dots;
if !(dots.centers.is_empty() && dots.origins.is_empty() && dots.key_anchor.is_none()) {
SelectionDots { common: Common::new(), dots }.label("Selection dots").show_at(ui, rect);
@@ -734,7 +770,7 @@ impl SelectionMarks {
o.paths.iter_mut().chain(o.key.as_mut()).for_each(|path| path.apply_affine(shift));
o.revision = outline_revision(&o.paths, o.key.as_ref(), o.color.to_array());
}
for knot in self.anchors.paths.iter_mut().flat_map(|p| &mut p.subpaths).flat_map(|sp| &mut sp.knots) {
for knot in self.anchors.paths.iter_mut().chain(&mut self.anchors.plain).flat_map(|p| &mut p.subpaths).flat_map(|sp| &mut sp.knots) {
knot.anchor += by;
knot.in_ctrl += by;
knot.out_ctrl += by;
+74 -13
View File
@@ -50,6 +50,11 @@ fn marks(app: &VectorcraftApp) -> Anchors {
anchors(app, app.session.active().unwrap(), app.session.tool_id(), false)
}
/// Every path whose anchors show, with handles or without.
fn shown_paths(anchors: &Anchors) -> Vec<&EditPath> {
anchors.paths.iter().chain(&anchors.plain).collect()
}
fn all_selected(selection: &PathSelection) -> usize {
selection.anchors.len() + selection.others.iter().map(|(_, knots)| knots.len()).sum::<usize>()
}
@@ -215,7 +220,7 @@ fn a_clip_group_over_a_huge_path_shows_its_clipping_path() {
vec![vectorcraft_geom::Rect::new(100.0, 100.0, 200.0, 200.0)],
"the square's outline, not the bounds of the huge art"
);
assert_eq!(marks(&app).paths.iter().map(|p| p.anchor_count()).sum::<usize>(), 4, "and its four anchors");
assert_eq!(shown_paths(&marks(&app)).iter().map(|p| p.anchor_count()).sum::<usize>(), 4, "and its four anchors");
}
#[test]
@@ -228,13 +233,13 @@ fn a_huge_selection_shows_its_bounds_instead_of_every_outline() {
assert_eq!((huge.len(), huge[0].0, huge[0].1.len()), (1, color, 1), "one bounds path in the layer colour");
let st = app.session.active().unwrap();
assert!(outlines(&app, st)[0].paths[0].elements().len() < 10, "a rectangle, not the outline");
assert!(marks(&app).paths.is_empty(), "no anchors either");
assert!(shown_paths(&marks(&app)).is_empty(), "no anchors either");
assert!(dots(&app, st).origins.is_empty());
app.run("edit.undo", json!({})).unwrap();
app.run("path.create", json!({"d": format!("M20 20 {} Z", points(200))})).unwrap();
let st = app.session.active().unwrap();
assert!(outlines(&app, st)[0].paths[0].elements().len() > 200, "a path of few points is outlined whole");
assert_eq!(marks(&app).paths.len(), 1);
assert_eq!(shown_paths(&marks(&app)).len(), 1);
}
#[test]
@@ -389,7 +394,7 @@ fn a_selected_group_leaves_its_hidden_members_unmarked() {
app.run("select.set", json!({"ids": [group.0]})).unwrap();
let st = app.session.active().unwrap();
let outlined: Vec<Vec<PathEl>> = outlines(app, st).into_iter().flat_map(|o| o.paths).map(|p| p.elements().to_vec()).collect();
let anchored = marks(app).paths.iter().map(|p| p.anchor_count()).collect::<Vec<_>>();
let anchored = shown_paths(&marks(app)).iter().map(|p| p.anchor_count()).collect::<Vec<_>>();
let hovered = outline_of(st, group, ViewHides::of(app)).map(|h| h.path.elements().to_vec());
(outlined, anchored, hovered)
};
@@ -422,7 +427,7 @@ fn a_selected_group_leaves_out_its_guides_while_guides_are_hidden() {
app.run("select.set", json!({"ids": [group.0]})).unwrap();
let st = app.session.active().unwrap();
let outlined: Vec<vectorcraft_geom::Rect> = outlines(app, st).into_iter().flat_map(|o| o.paths).map(|p| p.bounding_box()).collect();
let anchored = marks(app).paths.iter().map(|p| p.anchor_count()).collect::<Vec<_>>();
let anchored = shown_paths(&marks(app)).iter().map(|p| p.anchor_count()).collect::<Vec<_>>();
let hovered = outline_of(st, group, ViewHides::of(app)).map(|h| h.path.bounding_box());
(outlined, anchored, hovered)
};
@@ -554,9 +559,64 @@ fn the_anchors_of_a_container_selected_whole_draw_selected() {
app.select_tool("directSelection");
app.run("select.set", json!({"ids": [group.0]})).unwrap();
let shown = marks(&app);
// The ellipse's four anchors and the square's four.
assert_eq!(all_selected(&shown.selection), 8);
assert_eq!(shown.paths.len(), 2);
// The ellipse's four anchors and the square's four, drawn without handles: the tools drag only the handles of a
// path selected itself.
assert_eq!(all_selected(&shown.plain_selection), 8);
assert_eq!(shown.plain.len(), 2);
assert!(shown.paths.is_empty() && all_selected(&shown.selection) == 0, "no member's handles show");
}
/// The Selection tool shows a path selected whole with every anchor selected and no direction handles; Direct
/// Selection shows the same path's handles, and a partial selection's anchors keep theirs under either tool.
#[test]
fn the_selection_tool_shows_a_whole_paths_anchors_without_handles() {
let (mut app, curve) = scene();
let count = {
let NodeKind::Path { path, .. } = &app.session.active().unwrap().doc.node(curve).unwrap().kind else { panic!("a path") };
path.anchor_count()
};
app.select_tool("selection");
app.run("select.set", json!({"ids": [curve.0]})).unwrap();
let shown = marks(&app);
assert!(shown.paths.is_empty(), "no path of the Selection tool's marks shows handles");
assert_eq!(shown.plain.iter().map(|p| p.key).collect::<Vec<_>>(), vec![curve.0]);
assert_eq!(all_selected(&shown.plain_selection), count, "every anchor draws selected");
app.select_tool("directSelection");
let direct = marks(&app);
assert!(direct.plain.is_empty(), "Direct Selection draws the path with its handles");
assert_eq!((direct.selection.path, direct.selection.anchors.len()), (Some(curve.0), count));
app.select_tool("selection");
app.run("select.anchors", json!({"id": curve.0, "anchors": [[0, 2]], "mode": "set"})).unwrap();
let partial = marks(&app);
assert!(partial.plain.is_empty(), "a partial selection keeps its anchor's handles");
assert_eq!(partial.selection.anchors, vec![KnotRef::new(0, 2)]);
}
/// A lone anchor selected whole under the Selection tool is drawn with its handles retracted, since the overlay shows
/// handles while one anchor is selected.
#[test]
fn a_lone_anchor_selected_whole_shows_no_handles() {
let mut app = blank();
let point = id_of(&app.run("path.create", json!({"d": "M40 40"})).unwrap());
app.run("path.setHandle", json!({"id": point.0, "anchor": 0, "which": "out", "x": 60, "y": 10, "independent": true})).unwrap();
let NodeKind::Path { path, .. } = &app.session.active().unwrap().doc.node(point).unwrap().kind else { panic!("a path") };
assert_eq!((path.anchor_count(), path.subpaths[0].anchors[0].h_out), (1, Point::new(60.0, 10.0)), "one anchor with a handle");
app.select_tool("selection");
app.run("select.set", json!({"ids": [point.0]})).unwrap();
let shown = marks(&app);
assert_eq!(all_selected(&shown.plain_selection), 1);
let knots: Vec<_> = shown.plain.iter().flat_map(|p| &p.subpaths).flat_map(|sp| &sp.knots).collect();
assert_eq!(knots.len(), 1);
assert!(knots.iter().all(|k| k.in_ctrl == k.anchor && k.out_ctrl == k.anchor), "the lone anchor's handles are retracted");
// Two anchors keep their handles in the marks: the overlay shows none while more than one is selected.
let curve = id_of(&app.run("path.create", json!({"d": "M40 140 C60 110 90 110 110 140"})).unwrap());
app.run("select.set", json!({"ids": [curve.0]})).unwrap();
let two = marks(&app);
assert_eq!(all_selected(&two.plain_selection), 2);
assert!(two.plain.iter().flat_map(|p| &p.subpaths).flat_map(|sp| &sp.knots).any(|k| k.out_ctrl != k.anchor), "the curve keeps its shape");
}
#[test]
@@ -844,9 +904,9 @@ fn the_outline_revision_follows_what_is_drawn() {
#[test]
fn an_empty_selection_has_no_marks() {
let (mut app, _) = scene();
assert!(!seen(&app).is_empty() && !marks(&app).paths.is_empty());
assert!(!seen(&app).is_empty() && !shown_paths(&marks(&app)).is_empty());
app.run("select.none", json!({})).unwrap();
assert!(seen(&app).is_empty() && marks(&app).paths.is_empty());
assert!(seen(&app).is_empty() && shown_paths(&marks(&app)).is_empty());
let st = app.session.active().unwrap();
assert_eq!(dots(&app, st).centers.len() + dots(&app, st).origins.len(), 0);
}
@@ -891,7 +951,7 @@ thread_local! {
fn kept(app: &VectorcraftApp) -> (Vec<Vec<vectorcraft_geom::Rect>>, usize) {
let marks = app.canvas.selection_marks.as_ref().expect("the canvas drew the selection's marks");
let boxes = marks.outlines.iter().map(|o| o.paths.iter().map(|p| p.bounding_box()).collect()).collect();
(boxes, all_selected(&marks.anchors.selection))
(boxes, all_selected(&marks.anchors.selection) + all_selected(&marks.anchors.plain_selection))
}
// Whole-app frames build the selection's marks once for each change: none in frames that change nothing, one after
@@ -914,7 +974,8 @@ fn the_canvas_builds_the_selection_marks_once_per_change() {
assert_eq!(frames(&mut app, 5), 1, "a new selection builds its marks once");
let st = app.session.active().unwrap();
let boxes = outlines(&app, st).iter().map(|o| o.paths.iter().map(|p| p.bounding_box()).collect()).collect::<Vec<_>>();
assert_eq!(kept(&app), (boxes, all_selected(&marks(&app).selection)));
let shown = marks(&app);
assert_eq!(kept(&app), (boxes, all_selected(&shown.selection) + all_selected(&shown.plain_selection)));
app.select_tool("directSelection");
assert_eq!(frames(&mut app, 5), 1, "another tool builds the marks once");
}
@@ -932,7 +993,7 @@ fn points_of(outlines: &[Outlined], anchors: &Anchors, dots: &Dots) -> Vec<Point
}
}
}
for knot in anchors.paths.iter().flat_map(|p| &p.subpaths).flat_map(|sp| &sp.knots) {
for knot in anchors.paths.iter().chain(&anchors.plain).flat_map(|p| &p.subpaths).flat_map(|sp| &sp.knots) {
out.extend([knot.anchor, knot.in_ctrl, knot.out_ctrl]);
}
out.extend(dots.origins.iter().chain(&dots.centers).chain(&dots.key_anchor).map(|(at, _)| *at));
+24 -10
View File
@@ -1127,21 +1127,35 @@ mod tests {
open(&mut app);
let out = laid_out(&mut app);
let nodes = out.platform_output.accesskit_update.as_ref().map(|u| u.nodes.clone()).unwrap_or_default();
let card = nodes
// The Home screen's own document cards stand behind the dialog, and the update lists nodes in no fixed order:
// the card is looked for under the dialog only.
let by_id: std::collections::HashMap<_, _> = nodes.iter().map(|(id, n)| (*id, n)).collect();
let mut in_dialog = Vec::new();
let mut stack: Vec<_> = nodes.iter().filter(|(_, n)| n.role() == egui::accesskit::Role::Dialog).map(|(id, _)| *id).collect();
while let Some(id) = stack.pop() {
if let Some(node) = by_id.get(&id) {
in_dialog.push(*node);
stack.extend(node.children().iter().copied());
}
}
let cards: Vec<_> = in_dialog
.iter()
.find(|(_, n)| n.role() == egui::accesskit::Role::ListItem && n.label().is_some_and(|l| !l.is_empty()) && n.is_selected() == Some(false))
.and_then(|(_, n)| n.bounds())
.filter(|n| n.role() == egui::accesskit::Role::ListItem && n.label().is_some_and(|l| !l.is_empty()) && n.is_selected() == Some(false))
.filter_map(|n| n.bounds())
.map(|b| egui::Rect::from_min_max(egui::pos2(b.x0 as f32, b.y0 as f32), egui::pos2(b.x1 as f32, b.y1 as f32)))
.expect("a preset card that is not selected");
.collect();
assert!(!cards.is_empty(), "a preset card that is not selected");
let shapes = crate::tests_labels::flat_painted_shapes(&out.shapes);
let rects: Vec<_> = shapes.iter().filter_map(|shape| if let egui::Shape::Rect(rect) = shape { Some(rect) } else { None }).collect();
let veil = |fill: egui::Color32| fill.a() > 0 && fill.a() < scrim.a() && fill.to_opaque() == scrim.to_opaque();
assert!(
rects.iter().any(|rect| veil(rect.fill) && rect.rect.contains_rect(card.shrink(1.0)) && card.expand(1.0).contains_rect(rect.rect)),
"a veil of the scrim {scrim:?} covers the resting card {card:?}: {:?}",
rects.iter().filter(|rect| card.expand(1.0).contains_rect(rect.rect)).map(|rect| (rect.rect, rect.fill)).collect::<Vec<_>>()
);
assert!(rects.iter().any(|rect| rect.fill == egui::Color32::WHITE && card.contains_rect(rect.rect)), "the card's paper is on the tile");
for card in cards {
assert!(
rects.iter().any(|rect| veil(rect.fill) && rect.rect.contains_rect(card.shrink(1.0)) && card.expand(1.0).contains_rect(rect.rect)),
"a veil of the scrim {scrim:?} covers the resting card {card:?}: {:?}",
rects.iter().filter(|rect| card.expand(1.0).contains_rect(rect.rect)).map(|rect| (rect.rect, rect.fill)).collect::<Vec<_>>()
);
assert!(rects.iter().any(|rect| rect.fill == egui::Color32::WHITE && card.contains_rect(rect.rect)), "the card's paper is on the tile");
}
}
/// Recent shows each entry as it was made: a portrait and a landscape A3 are two documents, and
+144 -6
View File
@@ -21,6 +21,40 @@ pub(crate) const CMD: &str = "object.stepAndRepeat";
pub(crate) struct Open {
pub id: DialogId,
pub preview: LivePreview,
/// The opening document's uid and revert count.
document: (u64, u64),
}
impl Open {
fn in_source(&self, app: &VectorcraftApp) -> bool {
app.session.active().is_some_and(|doc| (doc.uid, doc.reverts) == self.document)
}
/// Why OK is refused while the opening document is not the active one, after a revert too.
fn away(&self, app: &mut VectorcraftApp) -> Option<String> {
if self.in_source(app) {
return None;
}
let (uid, _) = self.document;
if app.session.active().is_some_and(|doc| doc.uid == uid) {
let reason = tl!("The document was reverted. Reopen this dialog to continue.");
app.status(reason);
Some(reason.into())
} else if app.session.documents().iter().any(|doc| doc.uid == uid) {
Some("switch back to the document where Step and Repeat was opened".into())
} else {
Some("the document where Step and Repeat was opened has closed".into())
}
}
}
/// Rolls back the preview of an open dialog and drops its record.
fn cancel_open(app: &mut VectorcraftApp) {
if let Some(open) = app.object_dialogs.step.take()
&& open.in_source(app)
{
open.preview.cancel(app);
}
}
fn cut_ids(doc: &vectorcraft_doc::Document, selected: &[vectorcraft_doc::NodeId]) -> Vec<(u64, String)> {
@@ -104,6 +138,9 @@ pub(crate) fn open(app: &mut VectorcraftApp) {
fn try_open(app: &mut VectorcraftApp) -> Result<Value, String> {
let ctx = app.ui_ctx.clone().ok_or("no window")?;
// Rolls back the preview of a dialog this one replaces, before the cut paths are listed.
cancel_open(app);
let document = app.session.active().map(|doc| (doc.uid, doc.reverts)).ok_or("no document")?;
let lengths = LengthUnits::new(UnitKind::Points, super::rearrange_artboards::length_kind(app.session.general_unit()), 72.0);
let lengths = crate::fields::bare_points(lengths, app.session.prefs.numbers_without_units_are_points);
let cuts = cut_options(app);
@@ -112,23 +149,28 @@ fn try_open(app: &mut VectorcraftApp) -> Result<Value, String> {
});
let ok = |app: &mut VectorcraftApp, result: &ParamResult| {
let mut open = app.object_dialogs.step.take().ok_or("the dialog is closed")?;
if let Some(reason) = open.away(app) {
app.object_dialogs.step = Some(open);
return Err(reason);
}
let done = std::mem::take(&mut open.preview).commit(app, CMD, params(&result.fields));
if done.is_err() {
app.object_dialogs.step = Some(open);
}
done.map(|_| ())
};
let cancel: Box<dyn FnOnce(&mut VectorcraftApp)> = Box::new(|app| {
if let Some(open) = app.object_dialogs.step.take() {
open.preview.cancel(app);
}
});
let cancel: Box<dyn FnOnce(&mut VectorcraftApp)> = Box::new(cancel_open);
let id = open_held_with(app, dialog, ok, HeldOptions { cancel: Some(cancel), ..Default::default() }).ok_or("no window")?;
app.object_dialogs.step = Some(Open { id, preview: LivePreview::default() });
app.object_dialogs.step = Some(Open { id, preview: LivePreview::default(), document });
Ok(Value::Null)
}
/// Each frame: previews the dialog's values on the opening document while Preview is on. Another
/// document, or the opening one after a revert, gets no preview.
pub(crate) fn pump(app: &mut VectorcraftApp, _ctx: &egui::Context) {
if !app.object_dialogs.step.as_ref().is_some_and(|open| open.in_source(app)) {
return;
}
let Some(mut open) = app.object_dialogs.step.take() else { return };
let shown =
app.dialogs().and_then(|host| host.with(|h| h.get_by_id::<HostedParamDialog>(open.id).map(|d| (d.is_previewing(), params(d.fields())))));
@@ -165,4 +207,100 @@ mod tests {
let ids: Vec<u64> = cut_ids(doc, &[vectorcraft_doc::NodeId(outer)]).into_iter().map(|(i, _)| i).collect();
assert!([outer, inner, a, b, c].iter().all(|i| ids.contains(i)));
}
type Harness = egui_kittest::Harness<'static, VectorcraftApp>;
/// An app with two documents, each with one selected square, the first one active.
fn two_documents() -> VectorcraftApp {
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
for x in [20, 70] {
app.run("file.new", json!({"width": 300, "height": 300})).unwrap();
app.run("shape.rectangle", json!({"x": x, "y": 20, "width": 50, "height": 50})).unwrap();
app.run("select.all", json!({})).unwrap();
}
app.run("document.activate", json!({"index": 0})).unwrap();
app
}
/// A harness that shows the dialog host and runs this module's pump each frame.
fn start(app: VectorcraftApp) -> Harness {
let mut ready = false;
let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(900.0, 700.0)).build_ui_state(
move |ui, app: &mut VectorcraftApp| {
if !std::mem::replace(&mut ready, true) {
crate::testing::install(ui.ctx());
app.adopt_context(ui.ctx());
return;
}
if let Some(dialogs) = app.dialogs() {
dialogs.with(|host| host.run(ui));
}
pump(app, ui.ctx());
crate::dialogs::host::pump(app, ui.ctx());
},
app,
);
h.run_steps(2);
h
}
fn id(h: &Harness) -> DialogId {
h.state().object_dialogs.step.as_ref().expect("Step and Repeat is open").id
}
fn set(h: &mut Harness, key: &str, value: Value) {
let (ctx, id) = (h.ctx.clone(), id(h));
h.state().dialogs().unwrap().with(|host| host.set_json_field(&ctx, id, key, value)).unwrap();
h.run_steps(2);
}
fn confirm(h: &mut Harness) {
let (ctx, id) = (h.ctx.clone(), id(h));
assert!(h.state().dialogs().unwrap().with(|host| host.confirm_by_id(&ctx, id)) || h.state().object_dialogs.step.is_some());
h.run_steps(3);
}
fn objects(h: &Harness) -> usize {
h.state().session.doc().unwrap().doc.layers[0].children().unwrap().len()
}
#[test]
fn preview_and_ok_stay_on_the_opening_document() {
let mut h = start(two_documents());
open(h.state_mut());
h.run_steps(2);
set(&mut h, "columns", json!(3));
assert_eq!(objects(&h), 6, "the opening document previews 2 × 3");
h.state_mut().run("document.activate", json!({"index": 1})).unwrap();
let other = h.state().session.doc().unwrap().doc.clone();
set(&mut h, "columns", json!(4));
assert_eq!(h.state().session.doc().unwrap().doc, other, "Preview must leave the other document unchanged");
confirm(&mut h);
assert_eq!(h.state().session.doc().unwrap().doc, other, "OK must leave the other document unchanged");
assert!(h.state().object_dialogs.step.is_some(), "the dialog stays open");
h.state_mut().run("document.activate", json!({"index": 0})).unwrap();
confirm(&mut h);
assert!(h.state().object_dialogs.step.is_none(), "OK applies on the opening document");
assert_eq!(objects(&h), 8);
}
#[test]
fn reopening_rolls_back_the_earlier_preview() {
let mut h = start(two_documents());
open(h.state_mut());
h.run_steps(2);
set(&mut h, "columns", json!(3));
assert_eq!(objects(&h), 6);
open(h.state_mut());
h.run_steps(2);
set(&mut h, "preview", json!(false));
assert_eq!(objects(&h), 1, "the first dialog's preview is rolled back");
assert!(!h.state().session.in_interaction());
set(&mut h, "columns", json!(3));
confirm(&mut h);
assert!(h.state().object_dialogs.step.is_none(), "OK of the reopened dialog applies");
assert_eq!(objects(&h), 6);
}
}
+228
View File
@@ -1003,3 +1003,231 @@ fn a_failed_tool_choice_restores_the_brush_key_color_initiator() {
assert_eq!(app.session.tool_id(), "rectangle", "Cancel must preserve the successful replacement");
assert_eq!(unchanged(&app), before);
}
/// The `key` of each dialog `ui.inspect` lists, bottom first.
fn dialog_keys(app: &VectorcraftApp) -> Vec<String> {
let ctx = app.ui_ctx.clone().expect("a window app");
let ui = crate::control::inspect(app, &ctx);
ui["dialogs"].as_array().into_iter().flatten().filter_map(|d| d["key"].as_str().map(str::to_string)).collect()
}
/// The `key` of each dialog `ui.inspect` lists, bottom first, `None` for a dialog without one.
fn dialog_entries(app: &VectorcraftApp) -> Vec<Option<String>> {
let ctx = app.ui_ctx.clone().expect("a window app");
let ui = crate::control::inspect(app, &ctx);
ui["dialogs"].as_array().into_iter().flatten().map(|d| d["key"].as_str().map(str::to_string)).collect()
}
/// A drawing every dialog `ui.menuDialog` lists can open on: two artboards and two selected rectangles, the first a
/// crease, and for `command` a selected envelope when Reset or Envelope Options needs one.
fn menu_dialog_app(command: &str) -> VectorcraftApp {
let mut app = window(VectorcraftApp::new(Session::new(), Default::default()));
app.run("file.new", json!({"width": 200, "height": 200, "artboards": 2})).unwrap();
let crease = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 60, "height": 20})).unwrap()["id"].as_u64().unwrap();
app.run("shape.rectangle", json!({"x": 100, "y": 10, "width": 60, "height": 20})).unwrap();
app.run(crate::addons::packaging::SET_ROLE, json!({"role": "crease", "ids": [crease]})).unwrap();
// A variable and a data set, for the dialogs that edit one.
app.session.execute("variable.define", &json!({"name": "Name", "kind": "text"})).unwrap();
app.session.execute("dataset.new", &json!({"name": "Row"})).unwrap();
app.run("select.all", json!({})).unwrap();
if let Some(make) = envelope_for(command) {
app.session.execute(make, &json!({})).unwrap();
}
app
}
/// The command that makes the envelope `command`'s dialog needs selected, if it needs one.
fn envelope_for(command: &str) -> Option<&'static str> {
match command {
"object.envelope.resetWithWarp" | "object.envelope.options" => Some("object.envelope.makeWithWarp"),
"object.envelope.resetWithMesh" => Some("object.envelope.makeWithMesh"),
_ => None,
}
}
/// The part of `doc` after `start`, up to the first of `ends`; empty when `doc` does not have `start`.
fn clause<'a>(doc: &'a str, start: &str, ends: &[char]) -> &'a str {
let Some(at) = doc.find(start) else { return "" };
let rest = &doc[at + start.len()..];
&rest[..rest.find(ends).unwrap_or(rest.len())]
}
/// Whether `clause` names command `id` as a word of its own.
fn names(clause: &str, id: &str) -> bool {
clause.split([' ', ',']).any(|word| word == id)
}
/// Each command `ui.menuDialog`'s params text lists opens the dialog that text names, by the `key` `ui.inspect`
/// reports: the command id unless the text names another key for that command, none for the commands the text says
/// have no key, and the slider's key for Smooth and Simplify, whose sliders show over the canvas. Every key the text
/// names is one a listed command opens.
#[test]
fn menu_dialog_opens_the_dialog_keys_its_params_text_names() {
let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == "ui.menuDialog").expect("registered").3;
let list = doc.strip_prefix("{command: ").and_then(|rest| rest.split_once('}')).expect("a command list").0;
let keyless = clause(doc, "the dialogs of ", &[';']);
let except = clause(doc, "is the command id, except ", &[';']);
let mut opened = Vec::new();
for id in list.split('|') {
let expected = except
.split(',')
.filter_map(|entry| entry.split_once('`')?.1.split_once("` for "))
.find_map(|(key, commands)| names(commands, id).then_some(key))
.unwrap_or(id);
let mut app = menu_dialog_app(id);
app.run("ui.menuDialog", json!({"command": id})).unwrap_or_else(|e| panic!("{id}: {e}"));
settle(&mut app);
let entries = dialog_entries(&app);
assert_eq!(
entries.last().is_some_and(Option::is_none),
names(keyless, id),
"{id}: whether its dialog has a `key` differs from the params text"
);
let keys: Vec<String> = entries.into_iter().flatten().collect();
match keys.last() {
None => assert!(names(keyless, id), "{id} opens no dialog"),
Some(key) => assert_eq!(key, expected, "{id}: its dialog key differs from the params text"),
}
// Smooth and Simplify open the slider over the canvas, which ui.inspect lists under its own key.
let showing = match id {
"object.path.simplify" => crate::dialogs::simplify_slider::showing(&app),
"object.path.smooth" => crate::dialogs::smooth_slider::showing(&app),
_ => true,
};
assert!(showing, "{id}: its slider is not showing");
opened.extend(keys);
}
for named in except.split('`').skip(1).step_by(2) {
assert!(opened.iter().any(|key| key == named), "the params text names `{named}`, which no listed command opens");
}
// Simplify opens its dialog, under its command id, with the kept tolerance once OK in that dialog has kept the
// settings.
let mut app = menu_dialog_app("object.path.simplify");
app.run("ui.menuDialog", json!({"command": "object.path.simplify"})).unwrap();
settle(&mut app);
app.run("ui.simplifyMoreOptions", json!({})).unwrap();
settle(&mut app);
set_all(&mut app, [("tolerance", json!(7.5)), ("retain", json!(true))]);
assert!(confirm(&mut app), "OK in the Simplify dialog is taken");
settle(&mut app);
app.run("ui.menuDialog", json!({"command": "object.path.simplify"})).unwrap();
settle(&mut app);
assert_eq!(dialog_keys(&app), ["object.path.simplify"]);
assert_eq!(field(&app, "tolerance"), Some(7.5), "the reopened dialog shows the kept tolerance");
assert!(flag(&app, "retain"), "the reopened dialog keeps Retain on");
}
/// Every command whose dialog `ui.menuDialog` opens and `ui.inspect` lists, with a `key` or without one, is one its
/// params text lists. Open Simplify and Smooth sliders count as dialogs too.
#[test]
fn menu_dialog_params_text_lists_every_command_whose_dialog_it_opens() {
let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == "ui.menuDialog").expect("registered").3;
let list: Vec<&str> = doc.strip_prefix("{command: ").and_then(|rest| rest.split_once('}')).expect("a command list").0.split('|').collect();
let mut app = menu_dialog_app("");
let ids: Vec<String> =
app.session.commands().into_iter().map(|c| c.id.to_string()).chain(crate::menus::UI_COMMANDS.iter().map(|c| c.0.to_string())).collect();
let mut missing = Vec::new();
for id in ids {
// The Reset and Envelope Options dialogs open only with an envelope selected.
if envelope_for(&id).is_some() {
app = menu_dialog_app(&id);
}
if app.run("ui.menuDialog", json!({"command": id})).is_err() {
if envelope_for(&id).is_some() {
app = menu_dialog_app("");
}
continue;
}
settle(&mut app);
let opened =
!dialog_entries(&app).is_empty() || crate::dialogs::simplify_slider::showing(&app) || crate::dialogs::smooth_slider::showing(&app);
if opened && !list.contains(&id.as_str()) {
missing.push(id.clone());
}
app = menu_dialog_app("");
}
assert!(missing.is_empty(), "ui.menuDialog opens a dialog for {missing:?}, which its params text does not list");
}
/// The transform, selection and Type on a Path tools' `tool.options` open dialogs whose `key` its params text names.
#[test]
fn tool_options_opens_the_dialog_keys_its_params_text_names() {
let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == "tool.options").expect("registered").3;
let plain = doc.replace('`', "");
assert!(plain.contains("key in ui.inspect"), "the params text must say the dialog names are the `key` in ui.inspect");
let field = clause(&plain, "returned dialog field holds ", &['.']);
// The `dialog` value the params text gives for `tool`: "<values> for <tools>" pairs, where <values> names the tool
// itself (with <tools> a phrase rather than a `|` list of tool ids, and every value in the transform group) or one
// value for every tool in <tools>.
let documented_dialog = |tool: &str| -> Option<String> {
let mut mappings = field.split(", ").map(|part| part.trim_start_matches("and ")).filter_map(|part| {
let (values, tools) = part.split_once(" for ")?;
if tools.contains(' ') && values.split('|').any(|v| v == tool) {
Some(tool.to_string())
} else if tools.split('|').any(|t| t == tool) {
Some(values.to_string())
} else {
None
}
});
let mapping = mappings.next();
assert!(mappings.next().is_none(), "{tool}: the params text gives more than one `dialog` mapping");
mapping
};
let groups = ["rotate|scale|reflect|shear", "selection|directSelection|groupSelection", "typeOnPath|verticalTypeOnPath"];
let checked: Vec<&str> = groups.iter().flat_map(|g| g.split('|')).collect();
let mut named_tools = Vec::new();
for part in field.split(", ").map(|part| part.trim_start_matches("and ")) {
let (values, tools) = part.split_once(" for ").unwrap_or_else(|| panic!("`{part}` pairs no dialog value with tools"));
let named = if tools.contains(' ') {
assert!(values.split('|').all(|value| groups[0].split('|').any(|tool| tool == value)), "`{part}` names a non-transform tool");
values
} else {
tools
};
for tool in named.split('|') {
assert!(checked.contains(&tool), "the params text gives a `dialog` value for {tool}, which this test does not check");
assert!(!named_tools.contains(&tool), "{tool}: the params text gives more than one `dialog` mapping");
named_tools.push(tool);
}
}
for group in groups {
let documented = clause(doc, &format!("{group} → "), &[';']);
let keys: Vec<&str> = documented.split('`').skip(1).step_by(2).collect();
let tools: Vec<&str> = group.split('|').collect();
assert!(keys.len() == 1 || keys.len() == tools.len(), "{group}: the params text must pair tools with dialog keys");
for (index, tool) in tools.into_iter().enumerate() {
let expected = keys[if keys.len() == 1 { 0 } else { index }];
let mut app = window(VectorcraftApp::new(Session::new(), Default::default()));
app.run("file.new", json!({"width": 200, "height": 200})).unwrap();
let path = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 60, "height": 20})).unwrap()["id"].as_u64().unwrap();
if tool.ends_with("OnPath") {
let text = app.session.execute("text.createInPath", &json!({"path": path, "mode": "onPath", "text": "Along"})).unwrap();
app.session.execute("select.set", &json!({"ids": [text["id"]]})).unwrap();
}
let response = app.run("tool.options", json!({"tool": tool})).unwrap_or_else(|e| panic!("{tool}: {e}"));
let expected_dialog =
documented_dialog(tool).unwrap_or_else(|| panic!("{tool}: the params text does not say which `dialog` its response holds"));
assert_eq!(response["dialog"], expected_dialog.as_str(), "{tool}: its response names a `dialog` other than the params text's");
settle(&mut app);
let keys = dialog_keys(&app);
let key = keys.last().unwrap_or_else(|| panic!("{tool} opens no dialog"));
assert_eq!(key, expected, "{tool}: its dialog key differs from the params text");
assert!(doc.contains(&format!("`{key}`")), "{tool} opens `{key}`, which the tool.options params text does not name");
}
}
}
/// More Options on the Simplify slider opens the dialog whose `key` the ui.simplifyMoreOptions params text names.
#[test]
fn simplify_more_options_opens_the_dialog_key_its_params_text_names() {
let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == "ui.simplifyMoreOptions").expect("registered").3;
let mut app = menu_dialog_app("object.path.simplify");
app.run("ui.menuDialog", json!({"command": "object.path.simplify"})).unwrap();
settle(&mut app);
app.run("ui.simplifyMoreOptions", json!({})).unwrap();
settle(&mut app);
let keys = dialog_keys(&app);
let key = keys.last().expect("More Options opens a dialog");
assert!(doc.contains(&format!("(dialog `{key}`")), "More Options opens `{key}`, which its params text does not name");
}
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -225,7 +225,7 @@ fn escape_ends_one_thing(app: &mut VectorcraftApp, ctx: &egui::Context) {
/// An arrow nudge of the window or of a tool that left it. `direction` points the way of the arrow. In
/// Presentation Mode Left and Right step the artboard and nothing moves; with only type selected, Alt steps the
/// type's spacing; otherwise the selection moves (Shift ×10, Alt copies, `patterns_only` moves pattern fills only).
/// type's spacing; otherwise the selection moves (Shift ×10, Ctrl/Cmd ÷10, Alt copies, `patterns_only` moves pattern fills only).
pub(crate) fn nudge(app: &mut VectorcraftApp, direction: egui::Vec2, mods: Mods, patterns_only: bool) {
if app.ui.screen_mode == 3 {
if direction.x != 0.0 {
@@ -249,7 +249,7 @@ pub(crate) fn nudge(app: &mut VectorcraftApp, direction: egui::Vec2, mods: Mods,
return;
}
if app.session.active().is_some_and(|d| d.selection.has_objects_or_guides()) {
let mut params = json!({"dx": f64::from(direction.x), "dy": f64::from(direction.y), "big": mods.shift, "copy": mods.alt});
let mut params = json!({"dx": f64::from(direction.x), "dy": f64::from(direction.y), "big": mods.shift, "fine": mods.cmd, "copy": mods.alt});
if patterns_only {
params["objects"] = json!(false);
params["patterns"] = json!(true);
+18
View File
@@ -1172,6 +1172,24 @@ fn selected_vertical_area_and_path_type_use_vertical_spacing_chords() {
}
}
/// #5258: Ctrl/Cmd+arrow nudges the selection by a tenth of the keyboard increment, and Shift+Ctrl/Cmd+arrow by one
/// increment, one undo step each.
#[test]
fn command_arrows_nudge_by_a_tenth_of_the_keyboard_increment() {
let mut app = new_app();
let id = app.session.execute("shape.rectangle", &json!({"x": 20, "y": 20, "width": 10, "height": 10})).unwrap()["id"].as_u64().unwrap();
app.select_tool("selection");
app.session.execute("select.set", &json!({"ids": [id]})).unwrap();
let x0 = |app: &VectorcraftApp| app.session.active().unwrap().doc.node(NodeId(id)).unwrap().geometric_bounds().unwrap().x0;
let ctx = ready(&mut app);
let before = undo_len(&app);
for (m, x, n) in [(cmd(), 20.1, 1), (cmd() | Modifiers::SHIFT, 21.1, 2), (Modifiers::NONE, 22.1, 3)] {
key_frame(&mut app, &ctx, tap(Key::ArrowRight, m));
assert!((x0(&app) - x).abs() < 1e-9, "{m:?}: {}", x0(&app));
assert_eq!(undo_len(&app), before + n, "{m:?}");
}
}
/// Alt+arrows step a selected type object instead of copying it; a rectangle with Alt is copied.
#[test]
fn alt_arrows_step_selected_type_object() {
@@ -0,0 +1,110 @@
//! A menu bar menu opens under its title when the window sits on a second monitor that does not start at a multiple
//! of its own size (a landscape monitor beside a portrait one, their bottoms aligned).
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use std::sync::{Arc, Mutex};
use craft::behavior::{Monitor, MonitorKey};
use craft::ui::testing::windows::FakeSystem;
use egui::accesskit::Role;
use egui::{Event, Pos2, RawInput, Rect, pos2, vec2};
use serde_json::json;
use vectorcraft_engine::Session;
use vectorcraft_ui_egui::{VectorcraftApp, i18n};
// Integration tests link the production global shortcut mirror; each App owns it until its case ends.
static INPUT: Mutex<()> = Mutex::new(());
/// The window's content size in pixels, below a 44 px title bar on the landscape monitor.
const WINDOW_PX: [f32; 2] = [1920.0, 1156.0];
/// Where the window's content starts on the desktop, in pixels.
const WINDOW_AT_PX: [f32; 2] = [1200.0, 764.0];
/// A portrait monitor at the desktop's origin and a landscape one to its right, their bottoms aligned.
fn monitors(scale: f32) -> Vec<Monitor> {
let portrait = Monitor::new(MonitorKey::new("portrait", [1200, 1920]), [0, 0], [1200, 1920], scale);
let landscape = Monitor::new(MonitorKey::new("landscape", [1920, 1200]), [1200, 720], [1920, 1200], scale);
vec![portrait, landscape]
}
struct Scene {
app: VectorcraftApp,
ctx: egui::Context,
time: f64,
scale: f32,
}
impl Scene {
fn new(scale: f32) -> Self {
let mut app = VectorcraftApp::new(Session::new(), Default::default());
app.run("file.new", json!({"width": 400, "height": 300})).unwrap();
let ctx = egui::Context::default();
ctx.enable_accesskit();
let system = FakeSystem::new();
system.set_monitors(monitors(scale));
let spec = craft::ui::InstallSpec::new(craft::host::target::ShellInfo::default(), Arc::new(system));
craft::ui::shell::embed::install(&ctx, spec, &vectorcraft_ui_egui::ui_fonts()).unwrap();
Self { app, ctx, time: 0.0, scale }
}
/// One frame of the whole window; returns the accessibility nodes with their bounds.
fn frame(&mut self, events: Vec<Event>) -> Vec<(Role, String, Rect)> {
self.time += 1.0 / 30.0;
let points = |[x, y]: [f32; 2]| pos2(x, y) / self.scale;
let size = points(WINDOW_PX).to_vec2();
let mut raw =
RawInput { events, time: Some(self.time), focused: true, screen_rect: Some(Rect::from_min_size(Pos2::ZERO, size)), ..Default::default() };
let viewport = raw.viewports.entry(egui::ViewportId::ROOT).or_default();
viewport.native_pixels_per_point = Some(self.scale);
viewport.monitor_size = Some(vec2(1920.0, 1200.0) / self.scale);
viewport.inner_rect = Some(Rect::from_min_size(points(WINDOW_AT_PX), size));
viewport.outer_rect = Some(Rect::from_min_size(points(WINDOW_AT_PX) - vec2(0.0, 44.0 / self.scale), size + vec2(0.0, 44.0 / self.scale)));
craft::ui::shell::embed::before_input(&self.ctx, |out| self.app.frame_input(out));
let mut out = self.ctx.run_ui(raw, |ui| self.app.ui(ui));
let _ = self.app.frame_input(craft::ui::runtime::frame::take_output(&self.ctx));
out.textures_delta.clear();
let update = out.platform_output.accesskit_update.take().unwrap();
update
.nodes
.into_iter()
.filter_map(|(_, node)| {
let b = node.bounds()?;
let rect = Rect::from_min_max(pos2(b.x0 as f32, b.y0 as f32), pos2(b.x1 as f32, b.y1 as f32));
Some((node.role(), node.label().unwrap_or_default().to_string(), rect))
})
.collect()
}
}
#[test]
fn the_file_menu_opens_under_its_title_on_a_monitor_beside_a_portrait_one() {
let _input = INPUT.lock().unwrap_or_else(std::sync::PoisonError::into_inner);
let previous = i18n::current();
i18n::set_current(i18n::Lang::EN);
for scale in [1.0, 1.5] {
let mut scene = Scene::new(scale);
for _ in 0..3 {
scene.frame(vec![]);
}
let nodes = scene.frame(vec![]);
let title = nodes.iter().find(|(role, label, _)| *role == Role::MenuItem && label == "File").map(|(_, _, rect)| *rect);
let title = title.unwrap_or_else(|| panic!("no File title at {scale}x: {nodes:?}"));
let at = title.center();
let button = |pressed| Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE };
scene.frame(vec![Event::PointerMoved(at)]);
scene.frame(vec![button(true)]);
scene.frame(vec![button(false)]);
let nodes = scene.frame(vec![]);
let menu = nodes.iter().filter(|(role, _, _)| *role == Role::Menu).map(|(_, _, rect)| *rect).next();
let menu = menu.unwrap_or_else(|| panic!("the File menu did not open at {scale}x: {nodes:?}"));
// The menu's list sits inside the popup's frame, a few points in from the title's corner.
assert!(
(menu.left() - title.left()).abs() <= 8.0 && (menu.top() - title.bottom()).abs() <= 8.0,
"at {scale}x the File menu opens at {menu:?}, not under its title at {title:?}"
);
// The whole menu shows: the window's content lies on the landscape monitor, so nothing cuts its room.
let items = nodes.iter().filter(|(role, _, rect)| *role == Role::MenuItem && menu.contains_rect(*rect)).count();
assert!(items >= 15, "at {scale}x the File menu shows {items} items in {menu:?}");
}
i18n::set_current(previous);
}
+12 -9
View File
@@ -194,8 +194,10 @@ for `eyedropper` it opens Eyedropper Options, an `eyedropperOptions` dialog (fie
`apply`, the attribute trees of `eyedropper.setOptions`) whose `ui.dialog.confirm` runs `eyedropper.setOptions` (what
`appearance.copyFrom` copies). For `hand` it fits the artboard in the window (`view.fitArtboard`) and for `zoom` it
shows 100% (`view.actualSize`). For `rotate`, `scale`, `reflect` and `shear` it opens the same dialog as Object ›
Transform (dialog kind = the tool id), or fails with `nothing selected`. For `selection`, `directSelection` and
`groupSelection` it opens the Move dialog (kind `move`), with the same failure; Move opens on the offset of the last
Transform (`key` in `ui.inspect`: `object.<tool>`, such as `object.rotate`), or fails with `nothing selected`.
The returned `dialog` field holds `rotate`, `scale`, `reflect` or `shear`, respectively. For `selection`, `directSelection` and
`groupSelection` it opens the Move dialog (`key` in `ui.inspect`: `object.move`), with the same failure, and returns
`dialog: "move"`. Move opens on the offset of the last
drag or Move (`dx`, `dy`) and with the `copy`, `objects` and `preview` it was last confirmed with (its `patterns` is
the `transformPatternTiles` preference, which its OK sets). `ui.key` Enter with one of those seven
tools opens its dialog too (nothing happens without a selection), with the transform tools' `origin` at their reference
@@ -203,8 +205,9 @@ point. For `lineSegment`, `arc`, `rectangularGrid` and `polarGrid` it opens the
click opens (kind = the tool id), without `x` and `y` and with `__toolOptions: true`, whose `ui.dialog.confirm` runs
`tool.setOption {tool, values}` and draws nothing; the next drag with the tool and its click dialog use the values
(the line's `fillLine`, the grids' Default Size `width`, `height` and `reference` too). For `typeOnPath` and
`verticalTypeOnPath` it opens Type on a Path Options for the selected type on a path (a `command` dialog running
`type.pathOptions`), or fails when no type on a path is selected. Gradient tool handles snap to
`verticalTypeOnPath` it opens Type on a Path Options for the selected type on a path (`key` in `ui.inspect`:
`type.pathOptions`, which runs that command), or fails when no type on a path is selected. The returned `dialog` field
holds `command`. Gradient tool handles snap to
anchors, edges and smart guides; Shift constrains them to 45° steps from the `constrainAngle` preference.
Effect dialogs: `engine.execute {command: "effect.dialog", params: {effect, index?, item?}}` opens the `effect` dialog
@@ -637,9 +640,9 @@ Spot Colors: the Swatches panel menu's Spot Colors… (`ui.spotColors`) opens th
true shows and separates spot colours defined in Lab from their Lab values, false from their working-CMYK
equivalents); `ui.dialog.confirm` runs `swatch.spotOptions {useLab}` as one undo step.
Scale options: `ui.menuDialog {command}` opens the dialog a command's menu item opens (`object.scale` → `scale`,
Scale options: `ui.menuDialog {command}` opens the dialog a command's menu item opens (`object.scale` → `object.scale`,
`object.transformEach` → `transformEach`, also Move, Rotate, Reflect, Shear and the Path dialogs). The Scale dialog
(`scale`) and Object → Transform → Transform Each… (dialog `transformEach`: `scaleH`,
(`object.scale`) and Object → Transform → Transform Each… (dialog `transformEach`: `scaleH`,
`scaleV` %, and `absH`, `absV` pt, the width and height each object becomes with `relative` false, absent while they
read "Mixed"; `moveH`, `moveV` pt, `rotate` °, `reflectX`, `reflectY`, `random`, `reference` 0–8, `copy`, `preview`)
have the fields `corners` (Scale Corners) and `strokes` (Scale Strokes & Effects). They start from the preferences
@@ -768,8 +771,8 @@ stays open.
Document Raster Effects Settings: Effect → Document Raster Effects Settings… (`ui.rasterEffectsSettingsDialog` for
agents) opens the `rasterEffectsSettings` dialog. Its fields are what `document.rasterEffectsSettings` reports
(`resolution`, `colorModel`, `background`, `antiAlias`, `clippingMask`, `addAround` in pt, `preserveSpotColors`);
`ui.dialog.confirm` runs it with them as one undo step; a bad value keeps the dialog open. Object → Rasterize… opens a
`command` dialog for `object.rasterize` whose fields (`ppi`, `colorModel`, `background`, `antiAlias`, `clippingMask`,
`ui.dialog.confirm` runs it with them as one undo step; a bad value keeps the dialog open. Object → Rasterize… opens the
`object.rasterize` dialog, whose fields (`ppi`, `colorModel`, `background`, `antiAlias`, `clippingMask`,
`addAround`) start from these settings. `colorModel`, `antiAlias` (`none`, `art`, `type`) and `background` (`white`,
`transparent`) are dropdowns; `ui.dialog.set` also takes any other value the command takes, and the dialog sends it
unchanged.
@@ -1074,7 +1077,7 @@ Colour adjustment effects (Effect → Color Adjustments) open the `effect` dialo
`channel` for Curves and Levels, `points` for Curves, `color` for Shift to Color) and they preview live; set them with
`ui.dialog.set` and `ui.dialog.confirm` to apply (Curves also has a graph: drag its points). Object → Vector
Halftone… (`engine.execute {command: "ui.menuDialog", params: {command: "object.vectorHalftone"}}`) opens the
`vectorHalftone` dialog (fields `shape`, `frequency`, `angle`, `mode`, `color`, `invert`, `clip`, `keepOriginal`,
`object.vectorHalftone` dialog (fields `shape`, `frequency`, `angle`, `mode`, `color`, `invert`, `clip`, `keepOriginal`,
`preview`): it previews live and `ui.dialog.confirm` keeps the halftone as one undo step.
Tool options last: `tool.setOption {key, value}` or `{values: {…}}` (and `tool` to set another tool's) sets them, and
+1 -1
View File
@@ -13,7 +13,7 @@ Part of [target-app-parity.md](target-app-parity.md); open work is in [gaps.md](
|---|---:|---:|---:|---:|
| Illustrator effects (vector and stylize) | 50 | 50 | 100% | — |
| Photoshop effects (raster, Effect Gallery) | 57 | 57 | 100% | — |
| 3D and Materials | 4 (+3 Classic) | 4 (+3 Classic; initial: Extrude & Bevel, Revolve, Inflate, Rotate, Extrude & Bevel (Classic), Revolve (Classic), Rotate (Classic)) | ~25% | 25–45 |
| 3D and Materials | 4 (+3 Classic) | 4 (+3 Classic; initial: Extrude & Bevel, Revolve, Inflate, Rotate, Extrude & Bevel (Classic), Revolve (Classic), Rotate (Classic)) | ~35% | 25–45 |
| Beyond Illustrator: Effect › Color Adjustments (6), effect plug-ins (WebAssembly) | — | 6 + plug-ins | — | — |
## Illustrator effects
File diff suppressed because one or more lines are too long
+45 -31
View File
@@ -2524,7 +2524,7 @@ The transform, Align, Object Properties and Live Shape Properties commands refus
that is not true or false with `` `strokes` must be true or false ``, naming the key, and leave the document and its
undo history as they were: the options `copy`, `strokes`, `corners`, `patterns`, `objects` and `typeAreas` in
`object.transform`, `object.move`, `object.nudge`, `object.rotate`, `object.scale`, `object.reflect`, `object.shear`,
`object.transformAgain` and `object.setBounds`; `anchors`, `releaseOutside` and `drawBehind` in `object.transform`; `big` in `object.nudge`;
`object.transformAgain` and `object.setBounds`; `anchors`, `releaseOutside` and `drawBehind` in `object.transform`; `big` and `fine` in `object.nudge`;
`absolute` in `object.rotate`; `proportional` in `object.setBounds`; `patterns` in `object.align`, `object.distribute`
and `object.distributeSpacing`; `visible`, `locked`, `isolate` and `knockoutShape` in `object.setProps`; and
`invertPie`, `makeSidesEqual`, `relativeRadii`, `strokes` and `patterns` in `object.setLiveShape`. A null is read as a
@@ -2969,8 +2969,10 @@ through `$`:
name in that thread chooses is VectorCraft's own reading; names with no VectorCraft tool throw. `app.documents`
(https://ai-scripting.docsforadobe.dev/jsobjref/Documents/) has `length`, `[i]`, `index(key)`, `getByName(name)`
and `add(colorSpace?, width?, height?, numArtBoards?, artboardLayout?, artboardSpacing?, artboardRowsOrCols?)`,
which runs `file.new` (`artboardRowsOrCols` is the number of rows for `GridByCol` and `RLGridByCol`, and of
columns for the other layouts), and `addDocument(startupPreset, presetSettings?, showOptionsDialog?)`, which runs `file.new`
which runs `file.new` (`artboardRowsOrCols` is the number of rows for `GridByCol` and `RLGridByCol` and the number
of columns for `GridByRow` and `RLGridByRow`; `Row`, `RLRow` and `Column` put the artboards in one row or column and
do not use it; a supplied value must still be a whole number from 1 to `numArtBoards`, which is 1 when omitted, or
`add` throws a `RangeError`), and `addDocument(startupPreset, presetSettings?, showOptionsDialog?)`, which runs `file.new`
with the New Document profile `startupPreset` names (`Print`, `Web`, `Mobile`, `Video`, another profile of
`file.newPresets`, or `Basic CMYK` and `Basic RGB` for no profile), starting from the first preset
`file.newPresets` lists for that profile, and the settings of a `new DocumentPreset()`
@@ -2990,7 +2992,10 @@ through `$`:
profile and the reason, and makes no document. Each warning from reading the profile's file (a color profile in it
that cannot be used, for example) goes to the Script Console as a line `addDocument: <warning>`. A `previewMode` of
`DocumentPreviewMode.PixelPreview` throws an error that says it is not available yet, and no document is made.
`showOptionsDialog` true throws `Dialog unavailable` with no document made. A `Document` (https://ai-scripting.docsforadobe.dev/jsobjref/Document/) has `name`,
`showOptionsDialog` true throws `Dialog unavailable` with no document made. `addDocumentNoUI(startupPreset)`
makes the document `addDocument(startupPreset)` makes and ignores any further arguments. A `DocumentPreset` kept
from an earlier run (with `#targetengine`) throws a `TypeError` when its settings are read or assigned and when its `typename`
or `toString()` is read. A `Document` (https://ai-scripting.docsforadobe.dev/jsobjref/Document/) has `name`,
`width`, `height`, `rulerUnits`, `documentColorSpace`, `rulerOrigin`, `convertCoordinate(point, source,
destination)`, `pageItems`, `selection` and `views`. `views` (https://ai-scripting.docsforadobe.dev/jsobjref/Views/)
lists each window, tab, or tiled pane the desktop app has drawn for the document, in view-number order. Each view
@@ -3022,8 +3027,9 @@ through `$`:
object that is hidden or locked, in a hidden or locked layer or group, or on a locked artboard), `zOrderPosition`,
`duplicate(relativeObject?, insertionLocation?)`,
`move(relativeObject, insertionLocation?)`, `remove()` and `zOrder(method)`
(https://ai-scripting.docsforadobe.dev/jsobjref/GroupItem/). `move` runs `node.move`, and `duplicate` runs
`edit.duplicate` and then `node.move` on the copy. The relative object is a page item or a layer of the same
(https://ai-scripting.docsforadobe.dev/jsobjref/GroupItem/). `move` runs `node.move` unless the object is already in
the place it names. `duplicate` runs `edit.duplicate`, and with a relative object it then runs `node.move` on the
copy the same way; without one, the copy stays where `edit.duplicate` puts it. The relative object is a page item or a layer of the same
document; `ElementPlacement.INSIDE` and `PLACEATBEGINNING` (the default) put the object on top of a layer's, a
group's or a compound path's contents, `PLACEATEND` under them (a compound path takes only paths), `PLACEBEFORE`
directly above the relative object and `PLACEAFTER` directly below it. An object of another document throws `Cross-document placement is not available`, and when
@@ -3100,7 +3106,9 @@ through `$`:
nothing changed. While View › Guides › Lock Guides is on, a path made into a guide cannot be selected this way or
with `selected`. Assigning a page item's `selected` leaves the direct-selected anchors and segments of the other
selected objects selected. `getIsFileOpen` compares the path with the open documents' files as text (in a Windows path,
letter case is ignored and `\` matches `/`) and does not resolve the path it is given. A document counts only when
letter case is ignored and `\` matches `/`) and does not resolve the path it is given. On Windows every path is a
Windows path; on macOS and Linux only a path that starts with a drive letter is, and in the others `\` is a
character of a file name. A document counts only when
the automation read roots allow its file, and that check can look the document's file up on disk. A path with
`..`, a network path, a NUL character or more than 4,096 bytes throws an error. `app.redraw()` returns `undefined`
and does not change the documents or add an undo step. In the app, the documents are drawn as they were before the
@@ -4591,8 +4599,9 @@ or unknown id leaves the document unchanged. An empty `ids` array does nothing.
are kept, and selecting an ancestor together with its descendants deletes that subtree once.
Without `ids`, direct-selected anchors or selected ruler guides retain their usual Clear behavior.
With `ids`, `guides: true` also deletes the selected ruler guides. The command rejects a `guides` value that is not a
boolean. A compound path left with no paths is deleted too, unless `keepEmpty: true` is given, which keeps it, empty,
also when the deleted parts are direct-selected anchors; a `keepEmpty` value that is not a boolean is rejected.
boolean or `null`. A compound path left with no paths is deleted too, unless `keepEmpty: true` is given, which keeps
it, empty, also when the deleted parts are direct-selected anchors; a `keepEmpty` value that is not a boolean or `null`
is rejected. `null` for `guides`, `keepEmpty` or `keepJoined` counts as leaving the key out.
A clipping group or layer left without art releases its mask in the same undo step.
Without `ids`, `keepJoined: true` removes the direct-selected anchors of each path that has no selected segment as
`path.removeAnchors` does (see Removing anchor points): the path stays joined, and the next anchor along is selected
@@ -4601,7 +4610,7 @@ whole, as `path.removeAnchors` leaves it, so the next Delete removes the whole p
cut there, and their selected anchors stay in the path, as with `keepJoined: false`; and objects selected whole are deleted, in the
same undo step. `keepJoined` defaults to the `deleteKeepsPathsJoined` preference, and the value used joins the journal
entry; a saved step without it opens the paths, as it did when it was recorded. With `ids`, `keepJoined` has no
effect. A `keepJoined` value that is not a boolean is an error, with or without `ids`.
effect. A `keepJoined` value that is not a boolean or `null` is an error, with or without `ids`.
`edit.copy` takes a compound-path member selected on its own (whole or in part, with Direct or Group Selection) as an
ordinary path with the compound's paint, transparency, opacity mask and fill rule. The path is linked to the compound's
@@ -8756,9 +8765,12 @@ A path with only lone anchors selected, and every path with `wholePaths: true`,
{"name":"run_command","arguments":{"command":"object.path.simplify","params":{"auto":true}}}
```
In the desktop app, Object › Path › Simplify opens the slider (`ui.menuDialog {command: "object.path.simplify"}`,
dialog `simplifySlider` with field `level`) at the Auto-Simplify level for the selection and previews the result until
`ui.dialog.confirm`. `ui.simplifyAuto` moves the open slider back to the Auto-Simplify level, and `ui.simplifyMoreOptions`
In the desktop app, unless retained settings select the Simplify dialog (see below), Object › Path › Simplify opens a
canvas popover (`ui.menuDialog {command: "object.path.simplify"}`) with a slider for `level` (0..100) at the Auto-Simplify level for the selection. The canvas previews the result.
Enter or a click outside the popover keeps the result, recording one undo step if the paths changed and none otherwise; Escape restores the paths. `ui.inspect` lists
the popover as dialog `simplifySlider` with field `level`. `ui.dialog.set` moves the slider and refuses a level outside
0..100, `ui.dialog.confirm` keeps the result as Enter does, and `ui.dialog.cancel` restores the paths as Escape does.
`ui.simplifyAuto` moves the open slider back to the Auto-Simplify level, and `ui.simplifyMoreOptions`
opens the Simplify dialog at the slider's tolerance. When OK confirms the dialog with `retain` ticked, the menu item opens
the dialog on those settings next time.
@@ -8844,9 +8856,11 @@ are VectorCraft's own.
In the desktop app, Object › Path › Smooth, the canvas context menu's Smooth… (listed while the selection holds a
path) and the Contextual Task Bar's Smooth (with a path selected whole with the Direct Selection tool) open the
slider (`ui.menuDialog {command: "object.path.smooth"}`, dialog `smoothSlider` with field `level`) at the
Auto-Smooth level, and the slider previews the result until `ui.dialog.confirm`; `ui.smoothAuto` moves the open
slider back to the Auto-Smooth level.
canvas popover (`ui.menuDialog {command: "object.path.smooth"}`) with a slider for `level` (0..100) at the
Auto-Smooth level. The canvas previews the result. Enter or a click outside the popover keeps the result, recording one undo step if the paths changed and none otherwise;
Escape restores the paths. `ui.inspect` lists the popover as dialog `smoothSlider` with field `level`. `ui.dialog.set`
moves the slider and refuses a level outside 0..100, `ui.dialog.confirm` keeps the result as Enter does, and
`ui.dialog.cancel` restores the paths as Escape does. `ui.smoothAuto` moves the open slider back to the Auto-Smooth level.
## Circle through two or three points
@@ -11184,7 +11198,7 @@ Artboard tool has selected, else its active one. One artboard takes `name`, trim
order, `name-1`, `name-2` and so on. A locked artboard is renamed too. An empty name fails with
`` `name` must not be empty ``, a name that is not a string fails with `` `name` must be a string ``, and an artboard
that is not in the document fails with `no such artboard`. When every artboard already has its new name, the command
records no undo step → `{renamed: [index…]}`. With no params, a menu click opens the `renameArtboards` dialog (fields
records no undo step → `{renamed: [index…]}`. With no params, a menu click opens the `artboard.rename` dialog (fields
`name` and `indices`), and OK with an empty name changes nothing. The Artboards panel's name field runs this command too.
Switch Orientation: `artboard.switchOrientation {index? | indices?, scaleArt?, patterns?, lockedAndHidden?}` swaps the width and height of each
@@ -11289,7 +11303,7 @@ The reply adds `indices` and `moved`, the number of artboards that moved; with n
locked, or already in place) no undo step is recorded. Without `indices` the command lays out every artboard, and its
reply is `{artboards, rows, columns}`; `at` there puts the grid's top-left at `at` too. In the desktop app, the
Artboard tool's canvas menu and Contextual Task Bar (Rearrange), and while the Artboard tool is in use the Artboards
panel's menu (Rearrange…), open the Rearrange dialog (kind `rearrangeArtboards` with field `indices`) for the
panel's menu (Rearrange…), open the Rearrange dialog (key `artboard.rearrange` with field `indices`) for the
artboards the tool has selected, showing their count. With another tool Rearrange… is off. The panel's Rearrange
button stays Rearrange All Artboards. Its OK changes nothing yet: the grid's outline follows the pointer, and the
next press on the canvas runs `artboard.rearrange` with `indices` and `at` at the press, as one undo step. Enter, when
@@ -16250,8 +16264,8 @@ edge also lands only when it ends within a quarter cell of a gridline: a horizon
edge on its own axis, and a 45° move lands the edge on the axis whose nonzero correction is smaller. When no edge on
those axes is that close, the move does not snap. A perpendicular move does not snap.
`press_key` Escape during a move, a resize or a plane widget drag cancels it and puts the objects and the
grid back. The arrow keys nudge a selection in perspective by the keyboard increment (`perspective.nudge`; Shift ×10, Alt
copies). Object › Transform › Transform Again repeats the last perspective move or scale in plane space.
grid back. The arrow keys nudge a selection in perspective by the keyboard increment (`perspective.nudge`; Shift ×10,
Ctrl/Cmd ÷10 (`fine`), Shift+Ctrl/Cmd one increment, Alt copies); Snap to Grid doesn't pull a nudge onto the gridlines. Object › Transform › Transform Again repeats the last perspective move or scale in plane space.
```json
{"name":"pointer_gesture","arguments":{"tool":"perspectiveSelection","events":[{"kind":"down","x":480,"y":410},{"kind":"drag","x":470,"y":405}]}}
@@ -16263,8 +16277,8 @@ copies). Object › Transform › Transform Again repeats the last perspective m
The perspective, width point, Liquify and Puppet Warp commands refuse a string, a number or another value that is not
true or false with `` `copy` must be true or false ``, naming the key, and leave the document and its undo history as
they were: `copy`, `perpendicular` and `snap` in `perspective.move`; `copy` in `perspective.transform`; `big` and
`copy` in `perspective.nudge`; `snap` in `perspective.draw`; `reproject` in `perspective.grid.set`; `visible` in
they were: `copy`, `perpendicular` and `snap` in `perspective.move`; `copy` in `perspective.transform`; `big`, `fine`
and `copy` in `perspective.nudge`; `snap` in `perspective.draw`; `reproject` in `perspective.grid.set`; `visible` in
`perspective.grid.show`; `adjustAdjoining` in `stroke.widthPoint.set`; `usePressure`, `simplifyOn`, `affectAnchors`,
`affectIn` and `affectOut` in `object.liquify`, with any `tool`; and `rest` in `object.puppetWarp`. A null is read as
a key left out.
@@ -17024,7 +17038,7 @@ Commands:
With `fit`, every run between corners and ends holds a whole number of dashes, all stretched or squeezed alike so it
starts and ends on a dash (a closed path with no corner holds whole periods); otherwise the lengths are exact and the
last piece of each run is what is left. The pieces are selected; more than 100,000 is refused. → `{ids, dashes}`.
Divide into Dashes… opens a dialog (`ui.menuDialog {command}`, kind `divideDashes`) whose fields are these
Divide into Dashes… opens a dialog (`ui.menuDialog {command}`, key `addon.pathtools.divideDashes`) whose fields are these
parameters, with Preview.
- `addon.pathtools.expandDashes {ids?}` turns the dashed stroke of each path and compound path under `ids` (default:
the selection) into separate open paths, one per dash, as one undo step (Object › Plug-ins › Path Precision Tools ›
@@ -17071,7 +17085,7 @@ Commands:
reach has one circle inside the other, when no pair within reach can be bridged (suggesting a larger radius or gap
only when the largest would bridge a pair of them under these rules), when no two circles are within reach, and above 2,000 circles or 8,000 bridges. → `{ids, alone}`:
the shapes and the circles left as they are, with `id` as well for two circles. Smooth Bridge… opens a dialog
(`ui.menuDialog {command}`, kind `smoothBridge`) with Constant Gap (a Gap field in place of the Radius field in
(`ui.menuDialog {command}`, key `addon.pathtools.bridge`) with Constant Gap (a Gap field in place of the Radius field in
percent), Reach (unavailable when the selection, a selected group's objects counted, holds two objects), Keep Originals
and Preview.
- `addon.pathtools.tangentCircle {ids?, radius?, circle?}` draws the circles that touch two paths or compound paths
@@ -17092,7 +17106,7 @@ Commands:
circles), when `circle` is past the last one, when `ids` names an object twice, when the shapes lie at one point or
are too small for the radius, above 2,000 segments in all, and when the search for other shapes goes past its
limits. → `{ids, found}` (`found`: how many circles touch the shapes). Tangent Circle… opens a dialog
(`ui.menuDialog {command}`, kind `tangentCircle`) with the radius (used with two shapes selected; 36 pt to start), a
(`ui.menuDialog {command}`, key `addon.pathtools.tangentCircle`) with the radius (used with two shapes selected; 36 pt to start), a
Circle menu (All, or one circle by number, as many as the last preview found) and Preview, which starts on.
- `addon.pathtools.cornerSet {ids?, anchors?, items?, radius, kind?, every?, minAngle?, maxAngle?}` cuts live corners, the ones Direct Selection's
corner widgets and the Corners dialog edit, as one undo step. `ids` (default: the selection) are the paths and
@@ -17679,8 +17693,8 @@ anchor points selected on them. Nothing selected, no anchor point left to keep (
{"name":"run_command","arguments":{"command":"addon.select.editPointsOnly","params":{"segmentEnds":false}}}
```
In the desktop app, Object › Plug-ins › Selection Tools › Edit Points Only… opens a dialog with Keep Ends of Selected
Segments (off). With Preview on, the canvas shows the narrowed selection; OK keeps it and Cancel puts the selection
In the desktop app, Object › Plug-ins › Selection Tools › Edit Points Only… opens a dialog (`ui.menuDialog {command}`, key
`addon.select.editPointsOnly`) with Keep Ends of Selected Segments (off). With Preview on, the canvas shows the narrowed selection; OK keeps it and Cancel puts the selection
back.
After a failed preview, a successful preview or OK clears the dialog's error only if that error is still the current
status message. Messages from other commands stay displayed.
@@ -17819,7 +17833,7 @@ as `object.setBounds` measures them (Use Preview Bounds), except Arrange in Grid
Zoom to Selection is the UI command `addon.arrange.zoomSelection {}` (remote mode only): it zooms and centres the
active view so the selection's visual bounds fill the window with a margin, as `view.fitArtboard` fits the artboard,
and fails with nothing selected. Arrange in Grid…, Replace with Top Object…, Set Size of Each…, Randomize Opacity… and Sort Objects… open dialogs
(`ui.menuDialog {command}`, dialog kinds `arrangeGrid`, `arrangeReplace`, `arrangeSize`, `arrangeOpacity` and `arrangeSort`) whose
(`ui.menuDialog {command}`; each dialog's `key` is its command id, such as `addon.arrange.grid`) whose
fields are the command's parameters, with Preview (Randomize Opacity's seed, and Sort Objects' `seed`, which is not shown, start new whenever the document has changed); Set Size of Each's `__width` and `__height` say which sizes OK applies.
Match Objects… opens a dialog of its own in the same way, keyed by its command, whose fields are the command's
parameters, with Preview; it opens on the key object when the selection has one, else on the top object, and OK is
@@ -18022,7 +18036,7 @@ are skipped as `addon.packaging.setRole` skips them; cut lines and objects witho
command fails when the objects hold no Crease, Partial Cut or Perforation line it can change, and with an angle outside
the range or one that is not a number. One undo step, none when nothing changes. Result: `{ids, changed, skipped}`.
Set Fold Angle… opens its options (`ui.menuDialog {command: "addon.packaging.setFoldAngle"}`, kind `command`) on the
Set Fold Angle… opens its options (`ui.menuDialog {command: "addon.packaging.setFoldAngle"}`, key `addon.packaging.setFoldAngle`) on the
angle that the selected lines it can change fold at (90° when they differ), shown with every decimal place it has.
While the selection holds no such line, `ui.menuDialog` fails with the reason the command gives. While the selection
holds such lines, the Fold Lines panel shows a Fold Angle field with that angle, empty when they differ. Typing an angle there sets it as it is typed, as one undo step; canceling the edit restores the lines' angles and leaves no undo step. The Reset button beside it takes their own angles away.
@@ -18211,8 +18225,8 @@ A `start` or `end` byte inside a character rounds down to that character's start
| `seed` | whole number (0): `random` with the same seed and text gives the same values |
| `skipSpaces` | true: spaces and line breaks keep their values and don't count |
→ `{count (characters changed), ids}`. Text Tweaker… opens a dialog (`ui.menuDialog {command}`, dialog kind
`textTweaker`) whose fields are the command's parameters, with Preview; another attribute starts from its own
→ `{count (characters changed), ids}`. Text Tweaker… opens a dialog (`ui.menuDialog {command}`, dialog key
`addon.type.textTweaker`) whose fields are the command's parameters, with Preview; another attribute starts from its own
default values, and the seed starts new whenever the document has changed.
```json
File diff suppressed because one or more lines are too long
+13 -12
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -5,7 +5,7 @@ use std::process::Command;
use serde_json::Value;
const REV: &str = "2680a3b3fe464c7afa3d260b33a828fa94e12f6d";
const REV: &str = "a5669ed2f1ba62545a1f0d884ecbd0fd0fbd06e0";
const PACKAGES: &[(&str, &str, &str)] = &[
("craft-pdf", "0.1.0", REV),
("krilla", "0.8.2", REV),