Files
AniCraft/Cargo.toml
T
FredAppsandDylan M. Taylor 4a75c49e3b refactor(svg): read SVG text and path data through craft-svg (#386)
* refactor(svg): read SVG text and path data through craft-svg

SVG import now decodes its bytes with craft-svg (SVGZ, UTF-16 and Latin-1,
within the shared size limit) and refuses entity bombs, very wide elements
and deep nesting with craft-svg's guards before anicraft_xml builds a tree.

Path data (SVG import, the path.d and motion path commands, the interface
icons) is read by craft_svg::path_data. anicraft-geom keeps only the
elliptical-arc-to-cubic geometry; its own tokenizer is removed.

craft-svg is pinned to craft-libs main 57288eda.

Refs storytold/craft-libs#778, storytold/craft-libs#789

* refactor(svg): pin craft-svg to #1848 and parse colours through it

craft-svg is now at craft-libs main b836a718 (#1848), with default features
off, so the lock no longer pulls vectorcraft or the image codecs. Colours
go through parse_color_alpha; transparent stays in the app because the
shared parser rejects it. Percentage rgb channels follow the shared
parser's 8-bit rounding (50% is 128/255).

* fix(svg): clip out-of-range rgb() and bound decoded text

parse_color_alpha rejects rgb(300,0,0); CSS clips that to red, and so
did the previous local parser. If the shared parser fails, clip rgb()
channels and try once more. Also refuse text that grows past the 64 MiB
limit after Latin-1 or UTF-16 decoding, which svgz::text does not count.

* refactor(svg): pin craft-svg to #1878

craft-svg is now at craft-libs main c7a872e2 (#1878), which bounds the
entity-declaration scan and resets smooth-control history after Z.
default-features stays false. The other craft-libs pins are unchanged.

* fix(svg): bound rgb() components and emit integer channels

clipped_rgb now stops at a fifth component instead of collecting an
unbounded comma list, and number-form channels are retried as integers
so a value such as 127.5 is accepted by the shared parser.

* fix(svg): finish parser routing and reject missing moveto

Route the newer Continue Path entry point through the shared adapter. Require an initial moveto and assert precise preflight refusal variants. Focused geom/SVG tests: 137 + 31 passed. Quadratic gradient parity remains a separate merge blocker.

---------

Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
2026-11-18 15:14:56 -05:00

222 lines
11 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[workspace]
resolver = "3"
members = [".", "crates/*"]
default-members = [".", "crates/*"]
[workspace.package]
# 0.1.0 is the early alpha (release stage in src/app.rs, RELEASE_STAGE); see CHANGELOG.md
# and docs/release.md.
version = "0.3.0"
edition = "2024"
license = "MIT OR Apache-2.0"
# An application, not a library: not published to crates.io.
publish = false
repository = "https://github.com/storytold/AniCraft"
rust-version = "1.95"
[workspace.dependencies]
craft-video = { git = "https://github.com/storytold/craft-libs", rev = "fd91be74f078d7062945ff6512cf65afea0c73ac", default-features = false, features = ["screen-video"] }
craft-palette = { git = "https://github.com/storytold/craft-libs", rev = "de97c35f2b2af01c62371647e57a6affeab456fd" }
craft-lottie = { git = "https://github.com/storytold/craft-libs", rev = "83cb1133dd2bdd0d655ba2300f88863f0f53db0b" }
anicraft-geom = { path = "crates/geom" }
anicraft-doc = { path = "crates/doc" }
anicraft-render = { path = "crates/render" }
anicraft-engine = { path = "crates/engine" }
anicraft-xfl = { path = "crates/xfl" }
anicraft-xml = { path = "crates/xml" }
anicraft-svg = { path = "crates/svg" }
anicraft-text = { path = "crates/text" }
anicraft-plugins = { path = "crates/plugins" }
anicraft-audio = { path = "crates/audio" }
anicraft-gpu = { path = "crates/gpu" }
anicraft-guide = { path = "crates/guide" }
craft-anicraft-format = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" }
craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "221efe1b01c6e2d1108204a200f0b094abdffba1", default-features = false }
craft-mime = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" }
craft-html = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18", default-features = false }
craft-audio = { git = "https://github.com/storytold/craft-libs", rev = "e2bf53f2bdba4828e21097774a568ed9c74b0004", default-features = false, features = ["decode", "pcm-encode"] }
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" }
# Isolate the already-merged APNG container from the existing raster-codec pin.
craft-apng-container = { package = "craft-image-codecs", version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "55b1d7f3c598b600a130ae63f4a40334a230ae7b", default-features = false }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" }
craft-webp = { git = "https://github.com/storytold/craft-libs", rev = "0c144b7d983899d4b5b281046dd03a8b1ab35fbb" }
craft-xfl = { git = "https://github.com/storytold/craft-libs", rev = "b67b9f90c50091a3090f93fa054c34e409edba11" }
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "b67b9f90c50091a3090f93fa054c34e409edba11" }
# The GPU stage (ADR 0019) uses the wgpu that eframe's egui-wgpu brings, with the same
# (default) features, so the tree keeps one wgpu build.
wgpu = "30"
# The WGSL front end wgpu already builds, for checking the shaders in tests.
naga = { version = "30", features = ["wgsl-in"] }
pollster = "1"
bytemuck = "1"
anicraft-actions = { path = "crates/actions" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "2"
rayon = "1"
# Unions of flattened polygons on an integer grid, for a stroke's outline (ADR 0110): pure
# Rust, no unsafe in our use, MIT OR Apache-2.0 (its i_float, i_shape, i_tree and i_key_sort: MIT).
i_overlay = { version = "9.2", default-features = false }
# wgpu is the primary renderer; glow (OpenGL) is the fallback for GPUs/VMs where wgpu fails.
# Default features off: we skip `links` (opening web links pulls in url/idna/ICU Unicode
# tables we don't use) and the web-only screen-reader shim. Same set as PhotoCraft, plus glow.
eframe = { version = "0.36", default-features = false, features = ["accesskit", "default_fonts", "wgpu", "glow", "wayland", "x11"] }
# Native file dialogs: Windows common dialogs, macOS NSOpenPanel, Linux XDG desktop portal.
rfd = "0.17"
# Lists and loads the OS's installed fonts for Preferences › Appearance (MIT).
# Without the `fontconfig` feature, Linux scans the standard font folders directly
# (/usr/share/fonts, /usr/local/share/fonts, ~/.local/share/fonts, ~/.fonts).
fontdb = { version = "0.23", default-features = false, features = ["std", "fs", "memmap"] }
egui = "0.36"
# `Instant` and `SystemTime` that work in the browser too (std's panic on wasm32-unknown-unknown);
# on other targets a re-export of std::time (MIT OR Apache-2.0; already in the tree via winit).
web-time = "1"
# Find and Replace's pattern matching (ADR 0058): linear time, with size limits on what a
# pattern compiles to (MIT OR Apache-2.0). Unicode case folding and word boundaries only.
regex = { version = "1", default-features = false, features = ["std", "perf", "unicode-case", "unicode-perl"] }
[workspace.lints.rust]
unsafe_code = "forbid"
[workspace.lints.clippy]
dbg_macro = "warn"
todo = "warn"
[package]
name = "anicraft"
description = "AniCraft desktop app: egui shell over the AniCraft engine"
version.workspace = true
edition.workspace = true
license.workspace = true
publish.workspace = true
repository.workspace = true
default-run = "anicraft"
[features]
# Plays sound during stage playback. Off: playback is silent (for builders without ALSA headers).
default = ["sound-output", "gpu-stage"]
sound-output = ["dep:cpal"]
# GPU stage renderer (ADR 0019, 0029, 0031), on by default: the stage draws on the graphics card
# when there is a usable one, and on the CPU (the oracle, and what exports use) otherwise and
# for anything the GPU can't draw. Preferences › Stage › Renderer can choose the CPU. Build with
# `--no-default-features --features sound-output` for a CPU-only shell.
gpu-stage = ["dep:anicraft-gpu"]
[[bin]]
name = "anicraft"
path = "src/main.rs"
[dependencies]
anicraft-geom.workspace = true
anicraft-doc.workspace = true
anicraft-render.workspace = true
anicraft-engine.workspace = true
anicraft-gpu = { workspace = true, optional = true }
egui.workspace = true
serde.workspace = true
fontdb.workspace = true
anicraft-audio.workspace = true
serde_json.workspace = true
web-time.workspace = true
# The system's interface language, for the default language (ADR 0040; MIT OR Apache-2.0).
sys-locale = "0.3"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# The user guide, bundled for Help › User Guide (ADR 0069). The web build serves it as pages instead.
anicraft-guide.workspace = true
# The live control port and the tools it serves (ADR 0104): the same dispatcher as the
# headless MCP server, so live and headless never drift.
anicraft-cli = { path = "crates/cli" }
craft-update = { git = "https://github.com/storytold/craft-libs", rev = "6ac2a6a34ae83fc0f0bfb25a569ba6388b72266a" }
eframe = { workspace = true, features = ["links"] }
rfd.workspace = true
# Pictures copied in other apps, for Paste (#263). The clipboard library eframe already uses
# for text (MIT OR Apache-2.0), with the same features, so no crate is added to the build.
arboard = { version = "3.6", default-features = false, features = ["image-data"] }
# Sound output (Apache-2.0): WASAPI on Windows, CoreAudio on macOS, ALSA on Linux and the BSDs.
cpal = { version = "0.18", optional = true }
# macOS hands a double-clicked document to the app as an Apple Event, which winit 0.30 doesn't
# deliver (ADR 0062). This small crate (MIT OR Apache-2.0, ~170 lines, read in full) registers the
# open-documents and quit handlers with AppKit and hands us plain paths, so our code stays free of
# `unsafe`. Pinned exactly: it is young, and a new version is read again before it comes in. Its
# objc2 / objc2-app-kit / objc2-foundation are the versions wgpu already brings on macOS.
[target.'cfg(target_os = "macos")'.dependencies]
fmv-macos-events = "=0.1.0"
# Waits for the answer of a file dialog shown as a sheet (`platform::start_file_dialog`).
pollster.workspace = true
# The system's high-contrast setting (ADR 0064): one registry value. MIT, already in the tree
# through craft-update.
[target.'cfg(windows)'.dependencies]
winreg = "0.55"
# The web build (ADR 0036, docs/web.md). The window draws with WebGL2 (glow): every current
# browser has it, the stage is drawn on the CPU there, and leaving wgpu out keeps the download
# smaller. The browser glue is wasm-bindgen's (MIT OR Apache-2.0), already under eframe's web
# backend.
[target.'cfg(target_arch = "wasm32")'.dependencies]
eframe = { version = "0.36", default-features = false, features = ["accesskit", "default_fonts", "glow"] }
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
# Sound output in the browser (ADR 0095): cpal's Web Audio host, on the wasm-bindgen glue above
# (Apache-2.0). The AudioContext opens on the first play, which is a click, as browsers ask.
cpal = { version = "0.18", optional = true, features = ["wasm-bindgen"] }
# In the browser the page's language (navigator.languages) is the system's.
sys-locale = { version = "0.3", features = ["js"] }
web-sys = { version = "0.3", features = ["BeforeUnloadEvent", "Blob", "BlobPropertyBag", "CssStyleDeclaration", "DomRect", "DragEvent", "Document", "Element", "Event", "EventTarget", "File", "FileList", "HtmlAnchorElement", "HtmlCanvasElement", "HtmlElement", "HtmlInputElement", "MediaQueryList", "Navigator", "Storage", "Url", "Window", "console"] }
[dev-dependencies]
# Plug-in fixtures for the shell's plug-in tests, in WebAssembly text (Apache-2.0 WITH
# LLVM-exception; already in the tree for the engine's tests).
wat = "1.228"
[build-dependencies]
# Embeds the app icon in anicraft.exe on Windows (build.rs); does nothing on other targets.
winresource = "0.1"
[lints]
workspace = true
# ----- build profiles: biased for disk space, then time (docs/development.md › Build footprint) --
[profile.dev]
opt-level = 1
# File:line in backtraces and panics, without full variable debug info (a fraction of the size;
# also keeps Windows PDBs under the LNK1140 limit).
debug = "line-tables-only"
# The incremental cache was ~3 GB for our crates; they rebuild from scratch in seconds.
incremental = false
[profile.dev.package."*"]
# Dependencies: optimized once (fast app in debug builds), no debug info at all.
opt-level = 2
debug = false
[profile.dev.build-override]
# Build scripts and proc-macros: compile fast, no debug info.
opt-level = 0
debug = false
[profile.release]
lto = "thin"
codegen-units = 1
strip = "debuginfo"
[profile.web]
# The web editor (scripts/build-web.sh, ADR 0036): the release build optimized for size, since
# the browser downloads and compiles the whole module before anything shows (9.1 MB, 3.3 MB
# gzipped, against 11.3 / 4.0 MB at opt-level 3), and without the symbol names.
inherits = "release"
opt-level = "s"
strip = true
# ...except the CPU renderer and the geometry under it, which draw the stage there on one thread.
[profile.web.package.anicraft-render]
opt-level = 3
[profile.web.package.anicraft-geom]
opt-level = 3