diff --git a/Cargo.lock b/Cargo.lock index afaecd644..159ea55a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5007,6 +5007,7 @@ dependencies = [ "js-sys", "log", "rfd", + "serde_json", "vectorcraft-engine", "vectorcraft-format", "vectorcraft-text", diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 2e9218dc3..f67a377ef 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -26,6 +26,7 @@ log = { workspace = true } eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } rfd = { workspace = true } wasm-bindgen = "0.2" +serde_json = { workspace = true } wasm-bindgen-futures = "0.4" js-sys = "0.3" web-sys = { version = "0.3", features = ["Window", "Document", "Element", "HtmlElement", "HtmlCanvasElement", "HtmlIFrameElement", "HtmlAnchorElement", "Blob", "BlobPropertyBag", "ClipboardEvent", "DataTransfer", "File", "FileList", "Url", "Location", "CssStyleDeclaration", "Event", "EventTarget", "MouseEvent", "PointerEvent", "TouchEvent", "AddEventListenerOptions", "DomRect", "DragEvent", "Storage", "Navigator", "RequestInit", "Response", "AbortController", "AbortSignal"] } diff --git a/apps/vectorcraft-web/src/api.rs b/apps/vectorcraft-web/src/api.rs new file mode 100644 index 000000000..47252756d --- /dev/null +++ b/apps/vectorcraft-web/src/api.rs @@ -0,0 +1,183 @@ +//! `window.vectorcraft`: the control channel for the page, as promises. +//! +//! The same JSON methods as the desktop control server (`docs/control-protocol.md`), so an agent +//! driving VectorCraft in a browser tab (or an `