cad-editor/Cargo.toml
Hakan Seven fefae274d4 feat(wasm): web Save/Save As go through the dialog with a direct download
On the web, Save and Save As now open the in-app Save dialog (filename +
format) like the desktop, and the unsaved-changes prompt's Save routes
through it too — instead of an immediate rfd download. Confirm serializes
to bytes and downloads directly via a Blob + hidden `<a download>` click
(a user gesture), so there is no intermediate "click to download" link.

Replaces the rfd-based download_web / WebSaveResult round-trip with a
synchronous sys::download_bytes. Native save is unchanged.

Native + web build; 75 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 00:52:20 +03:00

100 lines
4.5 KiB
TOML

[package]
name = "OpenCADStudio"
version = "0.5.7"
edition = "2021"
build = "build.rs"
[workspace]
members = ["crates/ocs_plugin_api"]
# Embed the application icon into the Windows .exe so Explorer, the taskbar,
# the Start-menu tile and file-association entries show it (issue #107).
[target.'cfg(windows)'.build-dependencies]
winresource = "0.1"
[features]
default = ["solid3d"]
# 3-D solid modelling: B-rep tessellation (truck-meshalgo) and booleans
# (truck-shapeops). Disabled for wasm builds — truck-meshalgo pulls
# vtkio → xz2 → lzma-sys (a C library) that does not cross-compile to
# wasm32. Without this feature the app is a 2-D CAD editor; the Model tab,
# solid tessellation and ACIS import become no-ops.
solid3d = ["dep:truck-meshalgo", "dep:truck-shapeops", "dep:lzma-sys"]
[dependencies]
# Stable, dependency-free add-on contract (manifest + ribbon/CadModule types).
# Plugin authors target this crate's semver, not OpenCADStudio internals.
ocs_plugin_api = { path = "crates/ocs_plugin_api" }
# vtkio (pulled in transitively via truck-meshalgo) depends on xz2 → lzma-sys,
# which by default links the system liblzma dynamically. On macOS that bakes a
# Homebrew dylib path (/opt/homebrew/.../liblzma.5.dylib) into the binary, so
# the .app crashes on launch on machines without that exact library (#56).
# Forcing the `static` feature builds liblzma from the bundled source, making
# the binary self-contained on every platform.
lzma-sys = { version = "0.1", features = ["static"], optional = true }
iced = { version = "0.14", features = ["image", "svg", "advanced", "canvas", "smol"] }
bytemuck = { version = "1.25", features = ["derive"] }
glam = { version = "0.33", features = ["bytemuck"] }
truck-modeling = "0.6"
truck-meshalgo = { version = "0.4", default-features = false, features = ["tessellation"], optional = true }
truck-polymesh = "0.6"
rfd = "0.17"
acadrust = "0.3.4"
printpdf = "0.9.1"
flate2 = "1"
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "bmp", "tiff"] }
inventory = "0.3"
truck-shapeops = { version = "0.4", optional = true }
# Fast non-cryptographic hasher. Handle/u64 keys dominate the hot block,
# hatch, draw-depth and wire caches; the default SipHash is overkill there.
rustc-hash = "2"
# TrueType/OpenType support: fontdb enumerates the user's installed system
# fonts; ttf-parser extracts glyph outlines we flatten into CAD wire strokes.
# Both are already in the tree transitively via iced's cosmic-text, so pinning
# them here adds no new downloads.
fontdb = "0.23"
ttf-parser = "0.25"
# Full text-layout engine: shaping (ligatures, Arabic joining, kerning), bidi
# reordering, and — crucially — automatic font fallback (a glyph missing from
# the chosen family is shaped from another installed font). We use it only to
# obtain positioned (font, glyph-id) runs; outlines come from ttf-parser and
# render through our own wire pipeline.
cosmic-text = "0.15"
[target.'cfg(target_os = "windows")'.dependencies]
# Win32_System_Com — COM behind "Set as default app"
# (IApplicationAssociationRegistrationUI dialog).
# Win32_System_Registry — HKCU registration that lists the app under
# "Open with" for the portable .exe.
windows-sys = { version = "0.61", features = ["Win32_UI_Shell", "Win32_UI_WindowsAndMessaging", "Win32_System_Com", "Win32_System_Registry", "Win32_Foundation"] }
[patch.crates-io]
# Tracks HakanSeven12/acadrust main, which carries the hatch
# boundary-handle cap, raster-image/wipeout clip-vertex fix, 3DFACE
# Z-decode fix, and CANNOSCALE/CANNOSCALEVALUE header support on top of
# upstream. Revert to upstream once those PRs land.
acadrust = { git = "https://github.com/HakanSeven12/acadrust", branch = "main" }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
rayon = "1"
open = "5"
ureq = { version = "3", default-features = false, features = ["rustls"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1"
wasm-bindgen = "0.2"
js-sys = "0.3"
# window.open (external URLs) + Blob/anchor file downloads (Save).
web-sys = { version = "0.3", features = [
"Window",
"Document",
"Element",
"HtmlAnchorElement",
"Blob",
"Url",
] }
# Browsers without WebGPU (e.g. Firefox by default) need wgpu's WebGL2 backend;
# `webgl` enables it. `fira-sans` embeds the default UI font — the web has no
# system fonts, so without it all iced text (ribbon labels, command line) is
# blank. Features merge with the main `iced` dependency.
iced = { version = "0.14", features = ["webgl", "fira-sans"] }