From 78a01f47dbe1c61f6bf533df0e258abc2a1efacf Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Oct 2026 11:29:52 +0000 Subject: [PATCH 01/64] #2270: a host bridge for pages framing the web build (?host=parent) A same-origin page that embeds LightCraft in an iframe can now speak to it over postMessage, with the protocol PdfCraft, GridCraft and DeckCraft share (deckcraft#983), under lightcraft: message types: - ready {version} / failed {error} at start-up; - open {name, bytes} from the page adds a photo, as one dropped on the window (the name gives the format); - save {name, bytes} replaces every download: exports, preset and keyword files, the library backup (handed over as a transferred ArrayBuffer); - dirty {dirty} whenever closing the page would start or stop losing something (a write to browser storage queued or running, or changes storage refused), so the page can ask before closing a window with edits; - cmd {id, params} runs a command like lightcraft.command(..) and is answered with response {ok, value}. Only the parent window on the page's own origin is heard or answered. There is no docClosed: LightCraft has a library, not documents. The message layer (apps/lightcraft-web/src/host.rs) is plain Rust with native tests; the postMessage part is wasm32 only. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01AbegtYaPuwqZ81pGfELsFK --- apps/lightcraft-web/src/host.rs | 340 ++++++++++++++++++++++++++++++ apps/lightcraft-web/src/lib.rs | 3 + apps/lightcraft-web/src/safety.rs | 10 +- apps/lightcraft-web/src/web.rs | 112 ++++++++-- docs/web.md | 13 ++ docs/whats-new.md | 7 + 6 files changed, 469 insertions(+), 16 deletions(-) create mode 100644 apps/lightcraft-web/src/host.rs diff --git a/apps/lightcraft-web/src/host.rs b/apps/lightcraft-web/src/host.rs new file mode 100644 index 0000000000..8b6a5997db --- /dev/null +++ b/apps/lightcraft-web/src/host.rs @@ -0,0 +1,340 @@ +//! The `postMessage` bridge to a same-origin parent page (`?host=parent`), for pages that embed +//! LightCraft in an `