diff --git a/Cargo.lock b/Cargo.lock index 32cffe9fd..6f92cb310 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1093,6 +1093,17 @@ dependencies = [ "thiserror 2.0.21", ] +[[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-window" version = "0.1.0" @@ -6594,6 +6605,7 @@ dependencies = [ name = "vectorcraft-web" version = "0.21.0" dependencies = [ + "craft-web-api", "eframe", "egui", "js-sys", diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 8decb13d8..ff4bcef86 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -16,6 +16,8 @@ path = "src/main.rs" [dependencies] vectorcraft-engine = { workspace = true, features = ["bundled-fonts"] } vectorcraft-ui-egui = { workspace = true } +# The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "fd5e2feff6ea25bed371a99cc732b3968d621505", version = "0.1.0" } vectorcraft-format = { workspace = true } vectorcraft-text = { workspace = true } egui = { workspace = true } diff --git a/apps/vectorcraft-web/src/api.rs b/apps/vectorcraft-web/src/api.rs index 526e56be1..eddd04f1b 100644 --- a/apps/vectorcraft-web/src/api.rs +++ b/apps/vectorcraft-web/src/api.rs @@ -1,14 +1,18 @@ //! `window.vectorcraft`: the control channel for the page, as promises. //! +//! `request`, `execute`, `commands`, `docInspect`, `uiInspect` and `screenshot` come from +//! `craft-web-api` (storytold/craft-libs#413), the same in every Craft app; VectorCraft adds its own +//! functions on the same object. +//! //! The same JSON methods as the desktop control server (`docs/control-protocol.md`), so an agent //! driving VectorCraft in a browser tab (or an `