diff --git a/Cargo.toml b/Cargo.toml index d3b5aefef..5efc543d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -152,6 +152,7 @@ chrono = { version = "0.4.35", default-features = false } eyre = "0.6.12" image = { version = "0.25", default-features = false } rerun = { version = "0.19", default-features = false, features = ["sdk"] } +web-sys = { version = "0.3.72" } [replace] # "tokio-threadpool:0.1.6" = {git="https://bare-git.strawlab.org/tokio.git", rev="472e64c1ea67f3976191cb1b291061faf2082735"} diff --git a/ads-webasm/Cargo.toml b/ads-webasm/Cargo.toml index 783dc07c8..8fe7772c2 100644 --- a/ads-webasm/Cargo.toml +++ b/ads-webasm/Cargo.toml @@ -30,7 +30,7 @@ rust-cam-bui-types = { path = "../rust-cam-bui-types" } bui-backend-session-types = { path = "../bui-backend-session/types" } [dependencies.web-sys] -version = "0.3" +workspace = true features = [ "CanvasRenderingContext2d", "Document", diff --git a/braid-april-cal/braid-april-cal-webapp/Cargo.toml b/braid-april-cal/braid-april-cal-webapp/Cargo.toml index a02bb2e94..fe0ff6c1a 100644 --- a/braid-april-cal/braid-april-cal-webapp/Cargo.toml +++ b/braid-april-cal/braid-april-cal-webapp/Cargo.toml @@ -13,7 +13,7 @@ yew = { version = "0.21.0", features = ["csr"] } yew-tincture = "0.2.2" js-sys = "0.3" wasm-bindgen = "0.2.92" -web-sys = { version = "0.3", features = [ +web-sys = { workspace = true, features = [ "CssStyleDeclaration", "HtmlAnchorElement", "Url", diff --git a/braid-april-cal/braid-april-cal-webapp/src/lib.rs b/braid-april-cal/braid-april-cal-webapp/src/lib.rs index 33464c23f..85ad595ef 100644 --- a/braid-april-cal/braid-april-cal-webapp/src/lib.rs +++ b/braid-april-cal/braid-april-cal-webapp/src/lib.rs @@ -276,11 +276,9 @@ fn download_file(orig_buf: &[u8], filename: &str) { let array = js_sys::Array::new(); array.push(&b.buffer()); - let blob = web_sys::Blob::new_with_u8_array_sequence_and_options( - &array, - web_sys::BlobPropertyBag::new().type_(mime_type), - ) - .unwrap(); + let options = web_sys::BlobPropertyBag::new(); + options.set_type(mime_type); + let blob = web_sys::Blob::new_with_u8_array_sequence_and_options(&array, &options).unwrap(); let data_url = web_sys::Url::create_object_url_with_blob(&blob).unwrap(); let document = web_sys::window().unwrap().document().unwrap(); let anchor = document diff --git a/braid/braid-run/braid_frontend/Cargo.toml b/braid/braid-run/braid_frontend/Cargo.toml index 7db2a67e4..fb574c8fc 100644 --- a/braid/braid-run/braid_frontend/Cargo.toml +++ b/braid/braid-run/braid_frontend/Cargo.toml @@ -33,7 +33,7 @@ rust-cam-bui-types = { path = "../../../rust-cam-bui-types" } ads-webasm = { path = "../../../ads-webasm" } [dependencies.web-sys] -version = "0.3" +workspace = true features = [ "Event", "EventSource", diff --git a/braid/braid-run/braid_frontend/src/lib.rs b/braid/braid-run/braid_frontend/src/lib.rs index 6d71c7317..3e355aed8 100644 --- a/braid/braid-run/braid_frontend/src/lib.rs +++ b/braid/braid-run/braid_frontend/src/lib.rs @@ -471,16 +471,16 @@ fn view_model_server_link(opt_addr: &Option) -> Html { async fn post_callback(msg: &BraidHttpApiCallback) -> Result<(), FetchError> { use web_sys::{Request, RequestInit, Response}; - let mut opts = RequestInit::new(); - opts.method("POST"); - opts.cache(web_sys::RequestCache::NoStore); + let opts = RequestInit::new(); + opts.set_method("POST"); + opts.set_cache(web_sys::RequestCache::NoStore); let buf = serde_json::to_string(&msg).unwrap_throw(); - opts.body(Some(&JsValue::from_str(&buf))); + opts.set_body(&JsValue::from_str(&buf)); let headers = web_sys::Headers::new().unwrap_throw(); headers .append("Content-Type", "application/json") .unwrap_throw(); - opts.headers(&headers); + opts.set_headers(&headers); let url = "callback"; let request = Request::new_with_str_and_init(url, &opts)?; diff --git a/braidz-viewer/Cargo.toml b/braidz-viewer/Cargo.toml index dcb6fc493..b69022103 100644 --- a/braidz-viewer/Cargo.toml +++ b/braidz-viewer/Cargo.toml @@ -40,7 +40,7 @@ braidz-parser = { path = "../braidz-parser" } wasm-bindgen-futures = { version = "0.4.37" } [dependencies.web-sys] -version = "0.3.64" +workspace = true features = [ "Blob", "DateTimeValue", diff --git a/freemovr-calibration/freemovr-calibration-webapp/Cargo.toml b/freemovr-calibration/freemovr-calibration-webapp/Cargo.toml index 5e461fa19..cbd19a792 100644 --- a/freemovr-calibration/freemovr-calibration-webapp/Cargo.toml +++ b/freemovr-calibration/freemovr-calibration-webapp/Cargo.toml @@ -14,7 +14,7 @@ yew-agent = "0.2.0" yew-tincture = "0.2.2" js-sys = "0.3" wasm-bindgen = "0.2.92" -web-sys = { version = "0.3", features = [ +web-sys = { workspace = true, features = [ "CssStyleDeclaration", "HtmlAnchorElement", ] } diff --git a/freemovr-calibration/freemovr-calibration-webapp/src/lib.rs b/freemovr-calibration/freemovr-calibration-webapp/src/lib.rs index ca9f489d5..91da5b3ce 100644 --- a/freemovr-calibration/freemovr-calibration-webapp/src/lib.rs +++ b/freemovr-calibration/freemovr-calibration-webapp/src/lib.rs @@ -419,11 +419,10 @@ fn download_file(orig_buf: &[u8], filename: &str) { let array = js_sys::Array::new(); array.push(&b.buffer()); - let blob = web_sys::Blob::new_with_u8_array_sequence_and_options( - &array, - web_sys::BlobPropertyBag::new().type_(mime_type), - ) - .unwrap_throw(); + let options = web_sys::BlobPropertyBag::new(); + options.set_type(mime_type); + let blob = + web_sys::Blob::new_with_u8_array_sequence_and_options(&array, &options).unwrap_throw(); let data_url = web_sys::Url::create_object_url_with_blob(&blob).unwrap_throw(); let document = web_sys::window().unwrap_throw().document().unwrap_throw(); let anchor = document diff --git a/strand-cam/yew_frontend/Cargo.toml b/strand-cam/yew_frontend/Cargo.toml index 9aa310510..42e82f517 100644 --- a/strand-cam/yew_frontend/Cargo.toml +++ b/strand-cam/yew_frontend/Cargo.toml @@ -37,7 +37,7 @@ enum-iter = { path = "../../enum-iter" } ads-webasm = { path = "../../ads-webasm" } [dependencies.web-sys] -version = "0.3" +workspace = true features = [ "DomRect", "DomTokenList", diff --git a/strand-cam/yew_frontend/src/components/video_field.rs b/strand-cam/yew_frontend/src/components/video_field.rs index 2f1f0e95d..990b23a90 100644 --- a/strand-cam/yew_frontend/src/components/video_field.rs +++ b/strand-cam/yew_frontend/src/components/video_field.rs @@ -35,7 +35,7 @@ pub struct VideoField { last_frame_render: f64, mouse_xy: Option, green_stroke: StrokeStyle, - green: JsValue, + green: &'static str, rendered_frame_number: Option, timeout: Option, zoom_mode: ZoomMode, @@ -95,7 +95,7 @@ impl Component for VideoField { mouse_xy: None, show_div: true, green_stroke: StrokeStyle::from_rgb(0x7F, 0xFF, 0x7F), - green: JsValue::from("7fff7f"), + green: "7fff7f", rendered_frame_number: None, timeout: None, zoom_mode: ZoomMode::FitWidth, @@ -420,11 +420,11 @@ impl VideoField { ctx.draw_image_with_html_image_element(&self.image, 0.0, 0.0) .unwrap_throw(); - ctx.set_stroke_style(&self.green); + ctx.set_stroke_style_str(self.green); ctx.set_line_width(1.0); for drawable_shape in in_msg.draw_shapes.iter() { - ctx.set_stroke_style(&drawable_shape.stroke_style.clone().into()); + ctx.set_stroke_style_str(&drawable_shape.stroke_style); ctx.set_line_width(drawable_shape.line_width as f64); use http_video_streaming_types::Shape; match &drawable_shape.shape { diff --git a/strand-cam/yew_frontend/src/lib.rs b/strand-cam/yew_frontend/src/lib.rs index b9140b0a2..1be76a853 100644 --- a/strand-cam/yew_frontend/src/lib.rs +++ b/strand-cam/yew_frontend/src/lib.rs @@ -1348,16 +1348,16 @@ fn to_rate(rate_enum: &RecordingFrameRate) -> Option { async fn post_message(msg: &CallbackType) -> Result<(), FetchError> { use web_sys::{Request, RequestInit, Response}; - let mut opts = RequestInit::new(); - opts.method("POST"); - opts.cache(web_sys::RequestCache::NoStore); + let opts = RequestInit::new(); + opts.set_method("POST"); + opts.set_cache(web_sys::RequestCache::NoStore); let buf = serde_json::to_string(&msg).unwrap_throw(); - opts.body(Some(&JsValue::from_str(&buf))); + opts.set_body(&JsValue::from_str(&buf)); let headers = web_sys::Headers::new().unwrap_throw(); headers .append("Content-Type", "application/json") .unwrap_throw(); - opts.headers(&headers); + opts.set_headers(&headers); let url = "callback"; let request = Request::new_with_str_and_init(url, &opts)?;