diff --git a/Cargo.lock b/Cargo.lock index 785493348..dfdde30e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -995,6 +995,15 @@ dependencies = [ "zip 9.1.0", ] +[[package]] +name = "craft-web-host" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=2e2312ddaf21bc3d85cd3395d0955c7d239306f6#2e2312ddaf21bc3d85cd3395d0955c7d239306f6" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + [[package]] name = "craft-window" version = "0.1.0" @@ -2186,6 +2195,7 @@ dependencies = [ name = "gridcraft-web" version = "0.16.0" dependencies = [ + "craft-web-host", "eframe", "egui", "gridcraft-engine", diff --git a/apps/gridcraft-web/Cargo.toml b/apps/gridcraft-web/Cargo.toml index e384ffe09..e5c599bd8 100644 --- a/apps/gridcraft-web/Cargo.toml +++ b/apps/gridcraft-web/Cargo.toml @@ -16,6 +16,8 @@ path = "src/main.rs" [dependencies] gridcraft-engine = { workspace = true } gridcraft-ui-egui = { workspace = true } +# The host messages (storytold/craft-libs): one contract and one bridge for the web builds. +craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "2e2312ddaf21bc3d85cd3395d0955c7d239306f6", version = "0.1.0" } egui = { workspace = true } log = { workspace = true } serde_json = { workspace = true } diff --git a/apps/gridcraft-web/src/host.rs b/apps/gridcraft-web/src/host.rs index 0ab4fefbb..4a7193b73 100644 --- a/apps/gridcraft-web/src/host.rs +++ b/apps/gridcraft-web/src/host.rs @@ -1,127 +1,61 @@ //! Host modes: a page that runs GridCraft (as an iframe, or in its own document) opens workbooks -//! in it and stores what it saves instead of the browser downloading. +//! in it and stores what it saves instead of the browser downloading. The messages and the two +//! transports are `craft-web-host`'s (storytold/craft-libs), the same contract as the other Craft +//! apps' bridges, with the `gridcraft:` prefix. This module is GridCraft's part of it. //! -//! ## `?host=parent` — an `