feat(wasm): single-window web entry + trunk harness (issue #45)

The binary now compiles for wasm32 as a runnable web target:

- Split the main-window render into `view_main`, bypassing the
  multi-window id dispatch the browser cannot use.
- Add `run_web` / `boot_web`: a single-window `iced::application`
  entry for wasm (the browser canvas is the only window). Native
  keeps the multi-window `iced::daemon` via cfg-split in `main`.
- Add a `console_error_panic_hook` (wasm-only) for readable panics.
- Add `index.html` + `Trunk.toml` so `trunk serve` builds the wasm
  bundle (no-default-features → no solid3d) with COOP/COEP headers.

Native build and all 75 tests unchanged. Browser runtime (rayon
threads, canvas attach, real file I/O) is the next iteration.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-16 13:16:35 +03:00
1 parent b2e20c95fe
commit 157d54a4d4
7 files changed
+93 -1

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
# Trunk config for the web (wasm) build of Open CAD Studio (issue #45).
#
# Build: trunk build --release
# Dev: trunk serve
#
# Requires: rustup target add wasm32-unknown-unknown
# cargo install trunk wasm-bindgen-cli
[build]
target = "index.html"
[serve]
# Cross-origin isolation headers enable SharedArrayBuffer, which wasm threads
# (rayon) need. GitHub Pages cannot set these; a self-hosted server (e.g. the
# Open-AEC host) can. Without them the app still runs single-threaded.
headers = { "Cross-Origin-Opener-Policy" = "same-origin", "Cross-Origin-Embedder-Policy" = "require-corp" }