diff --git a/Cargo.lock b/Cargo.lock index 36bd121b6..5fdb9e27b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1157,10 +1157,21 @@ dependencies = [ "zip 9.1.1", ] +[[package]] +name = "craft-web-api" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=fd5e2feff6ea25bed371a99cc732b3968d621505#fd5e2feff6ea25bed371a99cc732b3968d621505" +dependencies = [ + "js-sys", + "serde_json", + "wasm-bindgen", + "wasm-bindgen-futures", +] + [[package]] name = "craft-web-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=2e2312ddaf21bc3d85cd3395d0955c7d239306f6#2e2312ddaf21bc3d85cd3395d0955c7d239306f6" +source = "git+https://github.com/storytold/craft-libs?rev=fd5e2feff6ea25bed371a99cc732b3968d621505#fd5e2feff6ea25bed371a99cc732b3968d621505" dependencies = [ "wasm-bindgen", "web-sys", @@ -2130,6 +2141,7 @@ name = "figcraft-web" version = "0.15.0" dependencies = [ "base64 0.22.1", + "craft-web-api", "craft-web-host", "eframe", "egui", diff --git a/apps/figcraft-web/Cargo.toml b/apps/figcraft-web/Cargo.toml index 7f0b4ded5..c37663258 100644 --- a/apps/figcraft-web/Cargo.toml +++ b/apps/figcraft-web/Cargo.toml @@ -20,7 +20,9 @@ figcraft-ui-egui = { workspace = true } figcraft-collab-net = { workspace = true } figcraft-text = { 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" } +# The page command API (storytold/craft-libs#413): the request plumbing behind window.figcraft. +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "fd5e2feff6ea25bed371a99cc732b3968d621505", version = "0.1.0" } +craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "fd5e2feff6ea25bed371a99cc732b3968d621505", version = "0.1.0" } base64 = { workspace = true } egui = { workspace = true } log = { workspace = true } diff --git a/apps/figcraft-web/src/api.rs b/apps/figcraft-web/src/api.rs index 7f6a0ec4d..167ea7687 100644 --- a/apps/figcraft-web/src/api.rs +++ b/apps/figcraft-web/src/api.rs @@ -1,36 +1,54 @@ -//! `window.figcraft`: the control channel for the page, as promises. +//! `window.figcraft`: the page command API (`craft-web-api`, storytold/craft-libs#413) plus FigCraft's +//! own file functions. //! -//! The same JSON methods as the desktop control server (`docs/control-protocol.md`), so an agent -//! driving FigCraft in a browser tab (or an `