From 4765448545d7bfc0223fd52f25d966b0bfbf8004 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 28 Sep 2024 13:31:54 +0200 Subject: [PATCH] Update Gamepad API (#4134) --- CHANGELOG.md | 9 + crates/web-sys/Cargo.toml | 9 +- crates/web-sys/src/features/gen_Gamepad.rs | 96 ++++++---- .../src/features/gen_GamepadAxisMoveEvent.rs | 47 ----- .../features/gen_GamepadAxisMoveEventInit.rs | 121 ------------ .../src/features/gen_GamepadButtonEvent.rs | 40 ---- .../features/gen_GamepadButtonEventInit.rs | 106 ---------- .../features/gen_GamepadEffectParameters.rs | 181 ++++++++++++++++++ .../src/features/gen_GamepadHapticActuator.rs | 57 ++++++ .../features/gen_GamepadHapticEffectType.rs | 16 ++ .../src/features/gen_GamepadHapticsResult.rs | 16 ++ .../src/features/gen_GamepadServiceTest.rs | 128 ------------- .../web-sys/src/features/gen_GamepadTouch.rs | 63 ++++++ .../src/features/gen_HtmlBodyElement.rs | 44 +++++ .../src/features/gen_HtmlFrameSetElement.rs | 47 +++++ crates/web-sys/src/features/gen_Navigator.rs | 8 - crates/web-sys/src/features/gen_Window.rs | 44 +++++ crates/web-sys/src/features/mod.rs | 51 +++-- crates/web-sys/webidls/enabled/Gamepad.webidl | 136 +++++-------- .../enabled/GamepadAxisMoveEvent.webidl | 19 -- .../webidls/enabled/GamepadButtonEvent.webidl | 17 -- .../webidls/enabled/GamepadEvent.webidl | 17 -- .../webidls/enabled/GamepadExtensions.webidl | 38 ++++ .../enabled/GamepadHapticActuator.webidl | 21 -- .../webidls/enabled/GamepadPose.webidl | 30 --- .../webidls/enabled/GamepadServiceTest.webidl | 45 ----- .../web-sys/webidls/enabled/Navigator.webidl | 10 - .../web-sys/webidls/unstable/Gamepad.webidl | 44 +++++ .../webidls/unstable/GamepadExtensions.webidl | 13 ++ 29 files changed, 705 insertions(+), 768 deletions(-) delete mode 100644 crates/web-sys/src/features/gen_GamepadAxisMoveEvent.rs delete mode 100644 crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs delete mode 100644 crates/web-sys/src/features/gen_GamepadButtonEvent.rs delete mode 100644 crates/web-sys/src/features/gen_GamepadButtonEventInit.rs create mode 100644 crates/web-sys/src/features/gen_GamepadEffectParameters.rs create mode 100644 crates/web-sys/src/features/gen_GamepadHapticEffectType.rs create mode 100644 crates/web-sys/src/features/gen_GamepadHapticsResult.rs delete mode 100644 crates/web-sys/src/features/gen_GamepadServiceTest.rs create mode 100644 crates/web-sys/src/features/gen_GamepadTouch.rs delete mode 100644 crates/web-sys/webidls/enabled/GamepadAxisMoveEvent.webidl delete mode 100644 crates/web-sys/webidls/enabled/GamepadButtonEvent.webidl delete mode 100644 crates/web-sys/webidls/enabled/GamepadEvent.webidl create mode 100644 crates/web-sys/webidls/enabled/GamepadExtensions.webidl delete mode 100644 crates/web-sys/webidls/enabled/GamepadHapticActuator.webidl delete mode 100644 crates/web-sys/webidls/enabled/GamepadPose.webidl delete mode 100644 crates/web-sys/webidls/enabled/GamepadServiceTest.webidl create mode 100644 crates/web-sys/webidls/unstable/Gamepad.webidl create mode 100644 crates/web-sys/webidls/unstable/GamepadExtensions.webidl diff --git a/CHANGELOG.md b/CHANGELOG.md index e4c194d67..57639df10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,15 @@ * Implicitly enable reference type and multivalue transformations if the module already makes use of the corresponding target features. [#4133](https://github.com/rustwasm/wasm-bindgen/pull/4133) +* Updated Gamepad API. + [#4134](https://github.com/rustwasm/wasm-bindgen/pull/4134) + +* Deprecated `Gamepad::display_id` and `GamepadHapticActuator::type_`. + [#4134](https://github.com/rustwasm/wasm-bindgen/pull/4134) + +* Removed `GamepadAxisMoveEvent`, `GamepadAxisMoveEventInit`, `GamepadButtonEvent`, `GamepadButtonEventInit` and `GamepadServiceTest`, which were seemingly never implemented by any JS environment. + [#4134](https://github.com/rustwasm/wasm-bindgen/pull/4134) + ### Fixed * Fixed linked modules emitting snippet files when not using `--split-linked-modules`. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 83c7c7441..0dd64d2cd 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -454,19 +454,18 @@ FuzzingFunctions = [] GainNode = ["AudioNode", "EventTarget"] GainOptions = [] Gamepad = [] -GamepadAxisMoveEvent = ["Event", "GamepadEvent"] -GamepadAxisMoveEventInit = [] GamepadButton = [] -GamepadButtonEvent = ["Event", "GamepadEvent"] -GamepadButtonEventInit = [] +GamepadEffectParameters = [] GamepadEvent = ["Event"] GamepadEventInit = [] GamepadHand = [] GamepadHapticActuator = [] GamepadHapticActuatorType = [] +GamepadHapticEffectType = [] +GamepadHapticsResult = [] GamepadMappingType = [] GamepadPose = [] -GamepadServiceTest = [] +GamepadTouch = [] Geolocation = [] GetAnimationsOptions = [] GetRootNodeOptions = [] diff --git a/crates/web-sys/src/features/gen_Gamepad.rs b/crates/web-sys/src/features/gen_Gamepad.rs index c9cd0e791..cb20fdf2e 100644 --- a/crates/web-sys/src/features/gen_Gamepad.rs +++ b/crates/web-sys/src/features/gen_Gamepad.rs @@ -26,6 +26,20 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] pub fn index(this: &Gamepad) -> u32; + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = connected)] + #[doc = "Getter for the `connected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/connected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] + pub fn connected(this: &Gamepad) -> bool; + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = timestamp)] + #[doc = "Getter for the `timestamp` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/timestamp)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] + pub fn timestamp(this: &Gamepad) -> f64; #[cfg(feature = "GamepadMappingType")] # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = mapping)] #[doc = "Getter for the `mapping` field of this object."] @@ -34,6 +48,28 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadMappingType`*"] pub fn mapping(this: &Gamepad) -> GamepadMappingType; + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = axes)] + #[doc = "Getter for the `axes` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/axes)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] + pub fn axes(this: &Gamepad) -> ::js_sys::Array; + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = buttons)] + #[doc = "Getter for the `buttons` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/buttons)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] + pub fn buttons(this: &Gamepad) -> ::js_sys::Array; + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = displayId)] + #[doc = "Getter for the `displayId` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/displayId)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] + #[deprecated] + pub fn display_id(this: &Gamepad) -> u32; #[cfg(feature = "GamepadHand")] # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = hand)] #[doc = "Getter for the `hand` field of this object."] @@ -42,41 +78,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadHand`*"] pub fn hand(this: &Gamepad) -> GamepadHand; - # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = displayId)] - #[doc = "Getter for the `displayId` field of this object."] + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = hapticActuators)] + #[doc = "Getter for the `hapticActuators` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/displayId)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/hapticActuators)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] - pub fn display_id(this: &Gamepad) -> u32; - # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = connected)] - #[doc = "Getter for the `connected` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/connected)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] - pub fn connected(this: &Gamepad) -> bool; - # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = buttons)] - #[doc = "Getter for the `buttons` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/buttons)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] - pub fn buttons(this: &Gamepad) -> ::js_sys::Array; - # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = axes)] - #[doc = "Getter for the `axes` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/axes)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] - pub fn axes(this: &Gamepad) -> ::js_sys::Array; - # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = timestamp)] - #[doc = "Getter for the `timestamp` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/timestamp)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] - pub fn timestamp(this: &Gamepad) -> f64; + pub fn haptic_actuators(this: &Gamepad) -> ::js_sys::Array; #[cfg(feature = "GamepadPose")] # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = pose)] #[doc = "Getter for the `pose` field of this object."] @@ -85,11 +93,27 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadPose`*"] pub fn pose(this: &Gamepad) -> Option; - # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = hapticActuators)] - #[doc = "Getter for the `hapticActuators` field of this object."] + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GamepadHapticActuator")] + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = vibrationActuator)] + #[doc = "Getter for the `vibrationActuator` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/hapticActuators)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/vibrationActuator)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadHapticActuator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn vibration_actuator(this: &Gamepad) -> GamepadHapticActuator; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "Gamepad" , js_name = touchEvents)] + #[doc = "Getter for the `touchEvents` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/touchEvents)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Gamepad`*"] - pub fn haptic_actuators(this: &Gamepad) -> ::js_sys::Array; + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn touch_events(this: &Gamepad) -> Option<::js_sys::Array>; } diff --git a/crates/web-sys/src/features/gen_GamepadAxisMoveEvent.rs b/crates/web-sys/src/features/gen_GamepadAxisMoveEvent.rs deleted file mode 100644 index 4ab18a1eb..000000000 --- a/crates/web-sys/src/features/gen_GamepadAxisMoveEvent.rs +++ /dev/null @@ -1,47 +0,0 @@ -#![allow(unused_imports)] -#![allow(clippy::all)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = GamepadEvent , extends = Event , extends = :: js_sys :: Object , js_name = GamepadAxisMoveEvent , typescript_type = "GamepadAxisMoveEvent")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GamepadAxisMoveEvent` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadAxisMoveEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEvent`*"] - pub type GamepadAxisMoveEvent; - # [wasm_bindgen (structural , method , getter , js_class = "GamepadAxisMoveEvent" , js_name = axis)] - #[doc = "Getter for the `axis` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadAxisMoveEvent/axis)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEvent`*"] - pub fn axis(this: &GamepadAxisMoveEvent) -> u32; - # [wasm_bindgen (structural , method , getter , js_class = "GamepadAxisMoveEvent" , js_name = value)] - #[doc = "Getter for the `value` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadAxisMoveEvent/value)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEvent`*"] - pub fn value(this: &GamepadAxisMoveEvent) -> f64; - #[wasm_bindgen(catch, constructor, js_class = "GamepadAxisMoveEvent")] - #[doc = "The `new GamepadAxisMoveEvent(..)` constructor, creating a new instance of `GamepadAxisMoveEvent`."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadAxisMoveEvent/GamepadAxisMoveEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEvent`*"] - pub fn new(type_: &str) -> Result; - #[cfg(feature = "GamepadAxisMoveEventInit")] - #[wasm_bindgen(catch, constructor, js_class = "GamepadAxisMoveEvent")] - #[doc = "The `new GamepadAxisMoveEvent(..)` constructor, creating a new instance of `GamepadAxisMoveEvent`."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadAxisMoveEvent/GamepadAxisMoveEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEvent`, `GamepadAxisMoveEventInit`*"] - pub fn new_with_event_init_dict( - type_: &str, - event_init_dict: &GamepadAxisMoveEventInit, - ) -> Result; -} diff --git a/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs b/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs deleted file mode 100644 index 885cee25e..000000000 --- a/crates/web-sys/src/features/gen_GamepadAxisMoveEventInit.rs +++ /dev/null @@ -1,121 +0,0 @@ -#![allow(unused_imports)] -#![allow(clippy::all)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GamepadAxisMoveEventInit)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GamepadAxisMoveEventInit` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - pub type GamepadAxisMoveEventInit; - #[doc = "Get the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, getter = "bubbles")] - pub fn get_bubbles(this: &GamepadAxisMoveEventInit) -> Option; - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, setter = "bubbles")] - pub fn set_bubbles(this: &GamepadAxisMoveEventInit, val: bool); - #[doc = "Get the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, getter = "cancelable")] - pub fn get_cancelable(this: &GamepadAxisMoveEventInit) -> Option; - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, setter = "cancelable")] - pub fn set_cancelable(this: &GamepadAxisMoveEventInit, val: bool); - #[doc = "Get the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, getter = "composed")] - pub fn get_composed(this: &GamepadAxisMoveEventInit) -> Option; - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, setter = "composed")] - pub fn set_composed(this: &GamepadAxisMoveEventInit, val: bool); - #[cfg(feature = "Gamepad")] - #[doc = "Get the `gamepad` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, getter = "gamepad")] - pub fn get_gamepad(this: &GamepadAxisMoveEventInit) -> Option; - #[cfg(feature = "Gamepad")] - #[doc = "Change the `gamepad` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, setter = "gamepad")] - pub fn set_gamepad(this: &GamepadAxisMoveEventInit, val: Option<&Gamepad>); - #[doc = "Get the `axis` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, getter = "axis")] - pub fn get_axis(this: &GamepadAxisMoveEventInit) -> Option; - #[doc = "Change the `axis` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, setter = "axis")] - pub fn set_axis(this: &GamepadAxisMoveEventInit, val: u32); - #[doc = "Get the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, getter = "value")] - pub fn get_value(this: &GamepadAxisMoveEventInit) -> Option; - #[doc = "Change the `value` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - #[wasm_bindgen(method, setter = "value")] - pub fn set_value(this: &GamepadAxisMoveEventInit, val: f64); -} -impl GamepadAxisMoveEventInit { - #[doc = "Construct a new `GamepadAxisMoveEventInit`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadAxisMoveEventInit`*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } - #[deprecated = "Use `set_bubbles()` instead."] - pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.set_bubbles(val); - self - } - #[deprecated = "Use `set_cancelable()` instead."] - pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.set_cancelable(val); - self - } - #[deprecated = "Use `set_composed()` instead."] - pub fn composed(&mut self, val: bool) -> &mut Self { - self.set_composed(val); - self - } - #[cfg(feature = "Gamepad")] - #[deprecated = "Use `set_gamepad()` instead."] - pub fn gamepad(&mut self, val: Option<&Gamepad>) -> &mut Self { - self.set_gamepad(val); - self - } - #[deprecated = "Use `set_axis()` instead."] - pub fn axis(&mut self, val: u32) -> &mut Self { - self.set_axis(val); - self - } - #[deprecated = "Use `set_value()` instead."] - pub fn value(&mut self, val: f64) -> &mut Self { - self.set_value(val); - self - } -} -impl Default for GamepadAxisMoveEventInit { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_GamepadButtonEvent.rs b/crates/web-sys/src/features/gen_GamepadButtonEvent.rs deleted file mode 100644 index 422621484..000000000 --- a/crates/web-sys/src/features/gen_GamepadButtonEvent.rs +++ /dev/null @@ -1,40 +0,0 @@ -#![allow(unused_imports)] -#![allow(clippy::all)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = GamepadEvent , extends = Event , extends = :: js_sys :: Object , js_name = GamepadButtonEvent , typescript_type = "GamepadButtonEvent")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GamepadButtonEvent` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadButtonEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEvent`*"] - pub type GamepadButtonEvent; - # [wasm_bindgen (structural , method , getter , js_class = "GamepadButtonEvent" , js_name = button)] - #[doc = "Getter for the `button` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadButtonEvent/button)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEvent`*"] - pub fn button(this: &GamepadButtonEvent) -> u32; - #[wasm_bindgen(catch, constructor, js_class = "GamepadButtonEvent")] - #[doc = "The `new GamepadButtonEvent(..)` constructor, creating a new instance of `GamepadButtonEvent`."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadButtonEvent/GamepadButtonEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEvent`*"] - pub fn new(type_: &str) -> Result; - #[cfg(feature = "GamepadButtonEventInit")] - #[wasm_bindgen(catch, constructor, js_class = "GamepadButtonEvent")] - #[doc = "The `new GamepadButtonEvent(..)` constructor, creating a new instance of `GamepadButtonEvent`."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadButtonEvent/GamepadButtonEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEvent`, `GamepadButtonEventInit`*"] - pub fn new_with_event_init_dict( - type_: &str, - event_init_dict: &GamepadButtonEventInit, - ) -> Result; -} diff --git a/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs b/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs deleted file mode 100644 index 9cd13854e..000000000 --- a/crates/web-sys/src/features/gen_GamepadButtonEventInit.rs +++ /dev/null @@ -1,106 +0,0 @@ -#![allow(unused_imports)] -#![allow(clippy::all)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GamepadButtonEventInit)] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GamepadButtonEventInit` dictionary."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - pub type GamepadButtonEventInit; - #[doc = "Get the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, getter = "bubbles")] - pub fn get_bubbles(this: &GamepadButtonEventInit) -> Option; - #[doc = "Change the `bubbles` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, setter = "bubbles")] - pub fn set_bubbles(this: &GamepadButtonEventInit, val: bool); - #[doc = "Get the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, getter = "cancelable")] - pub fn get_cancelable(this: &GamepadButtonEventInit) -> Option; - #[doc = "Change the `cancelable` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, setter = "cancelable")] - pub fn set_cancelable(this: &GamepadButtonEventInit, val: bool); - #[doc = "Get the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, getter = "composed")] - pub fn get_composed(this: &GamepadButtonEventInit) -> Option; - #[doc = "Change the `composed` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, setter = "composed")] - pub fn set_composed(this: &GamepadButtonEventInit, val: bool); - #[cfg(feature = "Gamepad")] - #[doc = "Get the `gamepad` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, getter = "gamepad")] - pub fn get_gamepad(this: &GamepadButtonEventInit) -> Option; - #[cfg(feature = "Gamepad")] - #[doc = "Change the `gamepad` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `Gamepad`, `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, setter = "gamepad")] - pub fn set_gamepad(this: &GamepadButtonEventInit, val: Option<&Gamepad>); - #[doc = "Get the `button` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, getter = "button")] - pub fn get_button(this: &GamepadButtonEventInit) -> Option; - #[doc = "Change the `button` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - #[wasm_bindgen(method, setter = "button")] - pub fn set_button(this: &GamepadButtonEventInit, val: u32); -} -impl GamepadButtonEventInit { - #[doc = "Construct a new `GamepadButtonEventInit`."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadButtonEventInit`*"] - pub fn new() -> Self { - #[allow(unused_mut)] - let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret - } - #[deprecated = "Use `set_bubbles()` instead."] - pub fn bubbles(&mut self, val: bool) -> &mut Self { - self.set_bubbles(val); - self - } - #[deprecated = "Use `set_cancelable()` instead."] - pub fn cancelable(&mut self, val: bool) -> &mut Self { - self.set_cancelable(val); - self - } - #[deprecated = "Use `set_composed()` instead."] - pub fn composed(&mut self, val: bool) -> &mut Self { - self.set_composed(val); - self - } - #[cfg(feature = "Gamepad")] - #[deprecated = "Use `set_gamepad()` instead."] - pub fn gamepad(&mut self, val: Option<&Gamepad>) -> &mut Self { - self.set_gamepad(val); - self - } - #[deprecated = "Use `set_button()` instead."] - pub fn button(&mut self, val: u32) -> &mut Self { - self.set_button(val); - self - } -} -impl Default for GamepadButtonEventInit { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_GamepadEffectParameters.rs b/crates/web-sys/src/features/gen_GamepadEffectParameters.rs new file mode 100644 index 000000000..078490526 --- /dev/null +++ b/crates/web-sys/src/features/gen_GamepadEffectParameters.rs @@ -0,0 +1,181 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GamepadEffectParameters)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `GamepadEffectParameters` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type GamepadEffectParameters; + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "duration")] + pub fn get_duration(this: &GamepadEffectParameters) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `duration` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "duration")] + pub fn set_duration(this: &GamepadEffectParameters, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `leftTrigger` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "leftTrigger")] + pub fn get_left_trigger(this: &GamepadEffectParameters) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `leftTrigger` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "leftTrigger")] + pub fn set_left_trigger(this: &GamepadEffectParameters, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `rightTrigger` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "rightTrigger")] + pub fn get_right_trigger(this: &GamepadEffectParameters) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `rightTrigger` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "rightTrigger")] + pub fn set_right_trigger(this: &GamepadEffectParameters, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `startDelay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "startDelay")] + pub fn get_start_delay(this: &GamepadEffectParameters) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `startDelay` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "startDelay")] + pub fn set_start_delay(this: &GamepadEffectParameters, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `strongMagnitude` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "strongMagnitude")] + pub fn get_strong_magnitude(this: &GamepadEffectParameters) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `strongMagnitude` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "strongMagnitude")] + pub fn set_strong_magnitude(this: &GamepadEffectParameters, val: f64); + #[cfg(web_sys_unstable_apis)] + #[doc = "Get the `weakMagnitude` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, getter = "weakMagnitude")] + pub fn get_weak_magnitude(this: &GamepadEffectParameters) -> Option; + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `weakMagnitude` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + #[wasm_bindgen(method, setter = "weakMagnitude")] + pub fn set_weak_magnitude(this: &GamepadEffectParameters, val: f64); +} +#[cfg(web_sys_unstable_apis)] +impl GamepadEffectParameters { + #[doc = "Construct a new `GamepadEffectParameters`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_duration()` instead."] + pub fn duration(&mut self, val: f64) -> &mut Self { + self.set_duration(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_left_trigger()` instead."] + pub fn left_trigger(&mut self, val: f64) -> &mut Self { + self.set_left_trigger(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_right_trigger()` instead."] + pub fn right_trigger(&mut self, val: f64) -> &mut Self { + self.set_right_trigger(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_start_delay()` instead."] + pub fn start_delay(&mut self, val: f64) -> &mut Self { + self.set_start_delay(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_strong_magnitude()` instead."] + pub fn strong_magnitude(&mut self, val: f64) -> &mut Self { + self.set_strong_magnitude(val); + self + } + #[cfg(web_sys_unstable_apis)] + #[deprecated = "Use `set_weak_magnitude()` instead."] + pub fn weak_magnitude(&mut self, val: f64) -> &mut Self { + self.set_weak_magnitude(val); + self + } +} +#[cfg(web_sys_unstable_apis)] +impl Default for GamepadEffectParameters { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_GamepadHapticActuator.rs b/crates/web-sys/src/features/gen_GamepadHapticActuator.rs index 8a6737528..b1d1ac87e 100644 --- a/crates/web-sys/src/features/gen_GamepadHapticActuator.rs +++ b/crates/web-sys/src/features/gen_GamepadHapticActuator.rs @@ -19,7 +19,53 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadHapticActuator/type)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GamepadHapticActuator`, `GamepadHapticActuatorType`*"] + #[deprecated] pub fn type_(this: &GamepadHapticActuator) -> GamepadHapticActuatorType; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GamepadHapticActuator" , js_name = effects)] + #[doc = "Getter for the `effects` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadHapticActuator/effects)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadHapticActuator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn effects(this: &GamepadHapticActuator) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GamepadHapticEffectType")] + # [wasm_bindgen (method , structural , js_class = "GamepadHapticActuator" , js_name = playEffect)] + #[doc = "The `playEffect()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadHapticActuator/playEffect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadHapticActuator`, `GamepadHapticEffectType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn play_effect( + this: &GamepadHapticActuator, + type_: GamepadHapticEffectType, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + #[cfg(all( + feature = "GamepadEffectParameters", + feature = "GamepadHapticEffectType", + ))] + # [wasm_bindgen (method , structural , js_class = "GamepadHapticActuator" , js_name = playEffect)] + #[doc = "The `playEffect()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadHapticActuator/playEffect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadEffectParameters`, `GamepadHapticActuator`, `GamepadHapticEffectType`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn play_effect_with_params( + this: &GamepadHapticActuator, + type_: GamepadHapticEffectType, + params: &GamepadEffectParameters, + ) -> ::js_sys::Promise; # [wasm_bindgen (catch , method , structural , js_class = "GamepadHapticActuator" , js_name = pulse)] #[doc = "The `pulse()` method."] #[doc = ""] @@ -31,4 +77,15 @@ extern "C" { value: f64, duration: f64, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GamepadHapticActuator" , js_name = reset)] + #[doc = "The `reset()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadHapticActuator/reset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadHapticActuator`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn reset(this: &GamepadHapticActuator) -> ::js_sys::Promise; } diff --git a/crates/web-sys/src/features/gen_GamepadHapticEffectType.rs b/crates/web-sys/src/features/gen_GamepadHapticEffectType.rs new file mode 100644 index 000000000..f78269698 --- /dev/null +++ b/crates/web-sys/src/features/gen_GamepadHapticEffectType.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `GamepadHapticEffectType` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `GamepadHapticEffectType`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum GamepadHapticEffectType { + DualRumble = "dual-rumble", + TriggerRumble = "trigger-rumble", +} diff --git a/crates/web-sys/src/features/gen_GamepadHapticsResult.rs b/crates/web-sys/src/features/gen_GamepadHapticsResult.rs new file mode 100644 index 000000000..14a59728c --- /dev/null +++ b/crates/web-sys/src/features/gen_GamepadHapticsResult.rs @@ -0,0 +1,16 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +#[doc = "The `GamepadHapticsResult` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `GamepadHapticsResult`*"] +#[doc = ""] +#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] +#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum GamepadHapticsResult { + Complete = "complete", + Preempted = "preempted", +} diff --git a/crates/web-sys/src/features/gen_GamepadServiceTest.rs b/crates/web-sys/src/features/gen_GamepadServiceTest.rs deleted file mode 100644 index a8cd86aef..000000000 --- a/crates/web-sys/src/features/gen_GamepadServiceTest.rs +++ /dev/null @@ -1,128 +0,0 @@ -#![allow(unused_imports)] -#![allow(clippy::all)] -use super::*; -use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GamepadServiceTest , typescript_type = "GamepadServiceTest")] - #[derive(Debug, Clone, PartialEq, Eq)] - #[doc = "The `GamepadServiceTest` class."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`*"] - pub type GamepadServiceTest; - #[cfg(feature = "GamepadMappingType")] - # [wasm_bindgen (structural , method , getter , js_class = "GamepadServiceTest" , js_name = noMapping)] - #[doc = "Getter for the `noMapping` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/noMapping)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadMappingType`, `GamepadServiceTest`*"] - pub fn no_mapping(this: &GamepadServiceTest) -> GamepadMappingType; - #[cfg(feature = "GamepadMappingType")] - # [wasm_bindgen (structural , method , getter , js_class = "GamepadServiceTest" , js_name = standardMapping)] - #[doc = "Getter for the `standardMapping` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/standardMapping)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadMappingType`, `GamepadServiceTest`*"] - pub fn standard_mapping(this: &GamepadServiceTest) -> GamepadMappingType; - #[cfg(feature = "GamepadHand")] - # [wasm_bindgen (structural , method , getter , js_class = "GamepadServiceTest" , js_name = noHand)] - #[doc = "Getter for the `noHand` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/noHand)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadHand`, `GamepadServiceTest`*"] - pub fn no_hand(this: &GamepadServiceTest) -> GamepadHand; - #[cfg(feature = "GamepadHand")] - # [wasm_bindgen (structural , method , getter , js_class = "GamepadServiceTest" , js_name = leftHand)] - #[doc = "Getter for the `leftHand` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/leftHand)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadHand`, `GamepadServiceTest`*"] - pub fn left_hand(this: &GamepadServiceTest) -> GamepadHand; - #[cfg(feature = "GamepadHand")] - # [wasm_bindgen (structural , method , getter , js_class = "GamepadServiceTest" , js_name = rightHand)] - #[doc = "Getter for the `rightHand` field of this object."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/rightHand)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadHand`, `GamepadServiceTest`*"] - pub fn right_hand(this: &GamepadServiceTest) -> GamepadHand; - #[cfg(all(feature = "GamepadHand", feature = "GamepadMappingType",))] - # [wasm_bindgen (catch , method , structural , js_class = "GamepadServiceTest" , js_name = addGamepad)] - #[doc = "The `addGamepad()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/addGamepad)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadHand`, `GamepadMappingType`, `GamepadServiceTest`*"] - pub fn add_gamepad( - this: &GamepadServiceTest, - id: &str, - mapping: GamepadMappingType, - hand: GamepadHand, - num_buttons: u32, - num_axes: u32, - num_haptics: u32, - ) -> Result<::js_sys::Promise, JsValue>; - # [wasm_bindgen (method , structural , js_class = "GamepadServiceTest" , js_name = newAxisMoveEvent)] - #[doc = "The `newAxisMoveEvent()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/newAxisMoveEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`*"] - pub fn new_axis_move_event(this: &GamepadServiceTest, index: u32, axis: u32, value: f64); - # [wasm_bindgen (method , structural , js_class = "GamepadServiceTest" , js_name = newButtonEvent)] - #[doc = "The `newButtonEvent()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/newButtonEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`*"] - pub fn new_button_event( - this: &GamepadServiceTest, - index: u32, - button: u32, - pressed: bool, - touched: bool, - ); - # [wasm_bindgen (method , structural , js_class = "GamepadServiceTest" , js_name = newButtonValueEvent)] - #[doc = "The `newButtonValueEvent()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/newButtonValueEvent)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`*"] - pub fn new_button_value_event( - this: &GamepadServiceTest, - index: u32, - button: u32, - pressed: bool, - touched: bool, - value: f64, - ); - # [wasm_bindgen (method , structural , js_class = "GamepadServiceTest" , js_name = newPoseMove)] - #[doc = "The `newPoseMove()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/newPoseMove)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`*"] - pub fn new_pose_move( - this: &GamepadServiceTest, - index: u32, - orient: Option<&mut [f32]>, - pos: Option<&mut [f32]>, - ang_velocity: Option<&mut [f32]>, - ang_acceleration: Option<&mut [f32]>, - lin_velocity: Option<&mut [f32]>, - lin_acceleration: Option<&mut [f32]>, - ); - # [wasm_bindgen (method , structural , js_class = "GamepadServiceTest" , js_name = removeGamepad)] - #[doc = "The `removeGamepad()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadServiceTest/removeGamepad)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`*"] - pub fn remove_gamepad(this: &GamepadServiceTest, index: u32); -} diff --git a/crates/web-sys/src/features/gen_GamepadTouch.rs b/crates/web-sys/src/features/gen_GamepadTouch.rs new file mode 100644 index 000000000..af4e60972 --- /dev/null +++ b/crates/web-sys/src/features/gen_GamepadTouch.rs @@ -0,0 +1,63 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GamepadTouch , typescript_type = "GamepadTouch")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `GamepadTouch` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadTouch)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadTouch`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub type GamepadTouch; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GamepadTouch" , js_name = touchId)] + #[doc = "Getter for the `touchId` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadTouch/touchId)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadTouch`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn touch_id(this: &GamepadTouch) -> u32; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GamepadTouch" , js_name = surfaceId)] + #[doc = "Getter for the `surfaceId` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadTouch/surfaceId)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadTouch`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn surface_id(this: &GamepadTouch) -> u8; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GamepadTouch" , js_name = position)] + #[doc = "Getter for the `position` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadTouch/position)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadTouch`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn position(this: &GamepadTouch) -> Vec; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "GamepadTouch" , js_name = surfaceDimensions)] + #[doc = "Getter for the `surfaceDimensions` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GamepadTouch/surfaceDimensions)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GamepadTouch`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn surface_dimensions(this: &GamepadTouch) -> Option>; +} diff --git a/crates/web-sys/src/features/gen_HtmlBodyElement.rs b/crates/web-sys/src/features/gen_HtmlBodyElement.rs index c7870c9af..9f1e6ed6b 100644 --- a/crates/web-sys/src/features/gen_HtmlBodyElement.rs +++ b/crates/web-sys/src/features/gen_HtmlBodyElement.rs @@ -292,4 +292,48 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] pub fn set_onunload(this: &HtmlBodyElement, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "HTMLBodyElement" , js_name = ongamepadconnected)] + #[doc = "Getter for the `ongamepadconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/ongamepadconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ongamepadconnected(this: &HtmlBodyElement) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "HTMLBodyElement" , js_name = ongamepadconnected)] + #[doc = "Setter for the `ongamepadconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/ongamepadconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ongamepadconnected(this: &HtmlBodyElement, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "HTMLBodyElement" , js_name = ongamepaddisconnected)] + #[doc = "Getter for the `ongamepaddisconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/ongamepaddisconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ongamepaddisconnected(this: &HtmlBodyElement) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "HTMLBodyElement" , js_name = ongamepaddisconnected)] + #[doc = "Setter for the `ongamepaddisconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement/ongamepaddisconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlBodyElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ongamepaddisconnected(this: &HtmlBodyElement, value: Option<&::js_sys::Function>); } diff --git a/crates/web-sys/src/features/gen_HtmlFrameSetElement.rs b/crates/web-sys/src/features/gen_HtmlFrameSetElement.rs index 85458a0d8..ed44859b3 100644 --- a/crates/web-sys/src/features/gen_HtmlFrameSetElement.rs +++ b/crates/web-sys/src/features/gen_HtmlFrameSetElement.rs @@ -236,4 +236,51 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `HtmlFrameSetElement`*"] pub fn set_onunload(this: &HtmlFrameSetElement, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "HTMLFrameSetElement" , js_name = ongamepadconnected)] + #[doc = "Getter for the `ongamepadconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameSetElement/ongamepadconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlFrameSetElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ongamepadconnected(this: &HtmlFrameSetElement) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "HTMLFrameSetElement" , js_name = ongamepadconnected)] + #[doc = "Setter for the `ongamepadconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameSetElement/ongamepadconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlFrameSetElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ongamepadconnected(this: &HtmlFrameSetElement, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "HTMLFrameSetElement" , js_name = ongamepaddisconnected)] + #[doc = "Getter for the `ongamepaddisconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameSetElement/ongamepaddisconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlFrameSetElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ongamepaddisconnected(this: &HtmlFrameSetElement) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "HTMLFrameSetElement" , js_name = ongamepaddisconnected)] + #[doc = "Setter for the `ongamepaddisconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFrameSetElement/ongamepaddisconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlFrameSetElement`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ongamepaddisconnected( + this: &HtmlFrameSetElement, + value: Option<&::js_sys::Function>, + ); } diff --git a/crates/web-sys/src/features/gen_Navigator.rs b/crates/web-sys/src/features/gen_Navigator.rs index bef2bb542..114e7faf1 100644 --- a/crates/web-sys/src/features/gen_Navigator.rs +++ b/crates/web-sys/src/features/gen_Navigator.rs @@ -379,14 +379,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Navigator`*"] pub fn get_vr_displays(this: &Navigator) -> Result<::js_sys::Promise, JsValue>; - #[cfg(feature = "GamepadServiceTest")] - # [wasm_bindgen (method , structural , js_class = "Navigator" , js_name = requestGamepadServiceTest)] - #[doc = "The `requestGamepadServiceTest()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/requestGamepadServiceTest)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GamepadServiceTest`, `Navigator`*"] - pub fn request_gamepad_service_test(this: &Navigator) -> GamepadServiceTest; # [wasm_bindgen (catch , method , structural , js_class = "Navigator" , js_name = requestMIDIAccess)] #[doc = "The `requestMIDIAccess()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index e9ba9d1a8..01a879dc9 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -1914,6 +1914,50 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Window`*"] pub fn set_onunload(this: &Window, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = ongamepadconnected)] + #[doc = "Getter for the `ongamepadconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/ongamepadconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ongamepadconnected(this: &Window) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "Window" , js_name = ongamepadconnected)] + #[doc = "Setter for the `ongamepadconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/ongamepadconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ongamepadconnected(this: &Window, value: Option<&::js_sys::Function>); + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = ongamepaddisconnected)] + #[doc = "Getter for the `ongamepaddisconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/ongamepaddisconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ongamepaddisconnected(this: &Window) -> Option<::js_sys::Function>; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (structural , method , setter , js_class = "Window" , js_name = ongamepaddisconnected)] + #[doc = "Setter for the `ongamepaddisconnected` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/ongamepaddisconnected)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn set_ongamepaddisconnected(this: &Window, value: Option<&::js_sys::Function>); #[cfg(feature = "Storage")] # [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = localStorage)] #[doc = "Getter for the `localStorage` field of this object."] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index d37dbf057..6568633ce 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -2924,20 +2924,6 @@ mod gen_Gamepad; #[allow(unused_imports)] pub use gen_Gamepad::*; -#[cfg(feature = "GamepadAxisMoveEvent")] -#[allow(non_snake_case)] -mod gen_GamepadAxisMoveEvent; -#[cfg(feature = "GamepadAxisMoveEvent")] -#[allow(unused_imports)] -pub use gen_GamepadAxisMoveEvent::*; - -#[cfg(feature = "GamepadAxisMoveEventInit")] -#[allow(non_snake_case)] -mod gen_GamepadAxisMoveEventInit; -#[cfg(feature = "GamepadAxisMoveEventInit")] -#[allow(unused_imports)] -pub use gen_GamepadAxisMoveEventInit::*; - #[cfg(feature = "GamepadButton")] #[allow(non_snake_case)] mod gen_GamepadButton; @@ -2945,19 +2931,12 @@ mod gen_GamepadButton; #[allow(unused_imports)] pub use gen_GamepadButton::*; -#[cfg(feature = "GamepadButtonEvent")] +#[cfg(feature = "GamepadEffectParameters")] #[allow(non_snake_case)] -mod gen_GamepadButtonEvent; -#[cfg(feature = "GamepadButtonEvent")] +mod gen_GamepadEffectParameters; +#[cfg(feature = "GamepadEffectParameters")] #[allow(unused_imports)] -pub use gen_GamepadButtonEvent::*; - -#[cfg(feature = "GamepadButtonEventInit")] -#[allow(non_snake_case)] -mod gen_GamepadButtonEventInit; -#[cfg(feature = "GamepadButtonEventInit")] -#[allow(unused_imports)] -pub use gen_GamepadButtonEventInit::*; +pub use gen_GamepadEffectParameters::*; #[cfg(feature = "GamepadEvent")] #[allow(non_snake_case)] @@ -2994,6 +2973,20 @@ mod gen_GamepadHapticActuatorType; #[allow(unused_imports)] pub use gen_GamepadHapticActuatorType::*; +#[cfg(feature = "GamepadHapticEffectType")] +#[allow(non_snake_case)] +mod gen_GamepadHapticEffectType; +#[cfg(feature = "GamepadHapticEffectType")] +#[allow(unused_imports)] +pub use gen_GamepadHapticEffectType::*; + +#[cfg(feature = "GamepadHapticsResult")] +#[allow(non_snake_case)] +mod gen_GamepadHapticsResult; +#[cfg(feature = "GamepadHapticsResult")] +#[allow(unused_imports)] +pub use gen_GamepadHapticsResult::*; + #[cfg(feature = "GamepadMappingType")] #[allow(non_snake_case)] mod gen_GamepadMappingType; @@ -3008,12 +3001,12 @@ mod gen_GamepadPose; #[allow(unused_imports)] pub use gen_GamepadPose::*; -#[cfg(feature = "GamepadServiceTest")] +#[cfg(feature = "GamepadTouch")] #[allow(non_snake_case)] -mod gen_GamepadServiceTest; -#[cfg(feature = "GamepadServiceTest")] +mod gen_GamepadTouch; +#[cfg(feature = "GamepadTouch")] #[allow(unused_imports)] -pub use gen_GamepadServiceTest::*; +pub use gen_GamepadTouch::*; #[cfg(feature = "Geolocation")] #[allow(non_snake_case)] diff --git a/crates/web-sys/webidls/enabled/Gamepad.webidl b/crates/web-sys/webidls/enabled/Gamepad.webidl index 480f94696..9d2b711a9 100644 --- a/crates/web-sys/webidls/enabled/Gamepad.webidl +++ b/crates/web-sys/webidls/enabled/Gamepad.webidl @@ -1,99 +1,57 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://w3c.github.io/gamepad/ - * https://w3c.github.io/gamepad/extensions.html - * https://w3c.github.io/webvr/spec/1.1/#interface-gamepad - */ +// https://www.w3.org/TR/gamepad -[Pref="dom.gamepad.enabled"] -interface GamepadButton { - readonly attribute boolean pressed; - readonly attribute boolean touched; - readonly attribute double value; +[Exposed=Window] +interface Gamepad { + readonly attribute DOMString id; + // TODO: remove `unsigned` + readonly attribute unsigned long index; + readonly attribute boolean connected; + readonly attribute DOMHighResTimeStamp timestamp; + readonly attribute GamepadMappingType mapping; + readonly attribute FrozenArray axes; + readonly attribute FrozenArray buttons; + [RustDeprecated] + readonly attribute unsigned long displayId; }; -enum GamepadHand { - "", - "left", - "right" +[Exposed=Window] +interface GamepadButton { + readonly attribute boolean pressed; + readonly attribute boolean touched; + readonly attribute double value; }; enum GamepadMappingType { "", - "standard" + "standard", }; -[Pref="dom.gamepad.enabled"] -interface Gamepad { - /** - * An identifier, unique per type of device. - */ - readonly attribute DOMString id; - - /** - * The game port index for the device. Unique per device - * attached to this system. - */ - readonly attribute unsigned long index; - - /** - * The mapping in use for this device. The empty string - * indicates that no mapping is in use. - */ - readonly attribute GamepadMappingType mapping; - - /** - * The hand in use for this device. The empty string - * indicates that unknown, both hands, or not applicable - */ - [Pref="dom.gamepad.extensions.enabled"] - readonly attribute GamepadHand hand; - - /** - * The displayId in use for as an association point in the VRDisplay API - * to identify which VRDisplay that the gamepad is associated with. - */ - [Pref="dom.vr.enabled"] - readonly attribute unsigned long displayId; - - /** - * true if this gamepad is currently connected to the system. - */ - readonly attribute boolean connected; - - /** - * The current state of all buttons on the device, an - * array of GamepadButton. - */ - [Pure, Cached, Frozen] - readonly attribute sequence buttons; - - /** - * The current position of all axes on the device, an - * array of doubles. - */ - [Pure, Cached, Frozen] - readonly attribute sequence axes; - - /** - * Timestamp from when the data of this device was last updated. - */ - readonly attribute DOMHighResTimeStamp timestamp; - - /** - * The current pose of the device, a GamepadPose. - */ - [Pref="dom.gamepad.extensions.enabled"] - readonly attribute GamepadPose? pose; - - /** - * The current haptic actuator of the device, an array of - * GamepadHapticActuator. - */ - [Constant, Cached, Frozen, Pref="dom.gamepad.extensions.enabled"] - readonly attribute sequence hapticActuators; +interface GamepadHapticActuator { + [RustDeprecated] + readonly attribute GamepadHapticActuatorType type; +}; + +[RustDeprecated] +enum GamepadHapticActuatorType { + "vibration" +}; + +[Exposed=Window] +partial interface Navigator { + [Throws] sequence getGamepads(); +}; + +[Exposed=Window] + +interface GamepadEvent: Event { + // TODO: remove `optional` modifier on `eventInitDict` + constructor(DOMString type, optional GamepadEventInit eventInitDict); + // TODO: remove `?` modifier + [SameObject] readonly attribute Gamepad? gamepad; +}; + +dictionary GamepadEventInit : EventInit { + // TODO: add `required` + // TODO: remove `?` modifier + Gamepad? gamepad; }; diff --git a/crates/web-sys/webidls/enabled/GamepadAxisMoveEvent.webidl b/crates/web-sys/webidls/enabled/GamepadAxisMoveEvent.webidl deleted file mode 100644 index 7699674b4..000000000 --- a/crates/web-sys/webidls/enabled/GamepadAxisMoveEvent.webidl +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -[Pref="dom.gamepad.non_standard_events.enabled", - Constructor(DOMString type, optional GamepadAxisMoveEventInit eventInitDict)] -interface GamepadAxisMoveEvent : GamepadEvent -{ - readonly attribute unsigned long axis; - readonly attribute double value; -}; - -dictionary GamepadAxisMoveEventInit : GamepadEventInit -{ - unsigned long axis = 0; - double value = 0; -}; diff --git a/crates/web-sys/webidls/enabled/GamepadButtonEvent.webidl b/crates/web-sys/webidls/enabled/GamepadButtonEvent.webidl deleted file mode 100644 index b8a9e086b..000000000 --- a/crates/web-sys/webidls/enabled/GamepadButtonEvent.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -[Pref="dom.gamepad.non_standard_events.enabled", - Constructor(DOMString type, optional GamepadButtonEventInit eventInitDict)] -interface GamepadButtonEvent : GamepadEvent -{ - readonly attribute unsigned long button; -}; - -dictionary GamepadButtonEventInit : GamepadEventInit -{ - unsigned long button = 0; -}; diff --git a/crates/web-sys/webidls/enabled/GamepadEvent.webidl b/crates/web-sys/webidls/enabled/GamepadEvent.webidl deleted file mode 100644 index f4c3092ac..000000000 --- a/crates/web-sys/webidls/enabled/GamepadEvent.webidl +++ /dev/null @@ -1,17 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -[Pref="dom.gamepad.enabled", - Constructor(DOMString type, optional GamepadEventInit eventInitDict)] -interface GamepadEvent : Event -{ - readonly attribute Gamepad? gamepad; -}; - -dictionary GamepadEventInit : EventInit -{ - Gamepad? gamepad = null; -}; diff --git a/crates/web-sys/webidls/enabled/GamepadExtensions.webidl b/crates/web-sys/webidls/enabled/GamepadExtensions.webidl new file mode 100644 index 000000000..09806f65f --- /dev/null +++ b/crates/web-sys/webidls/enabled/GamepadExtensions.webidl @@ -0,0 +1,38 @@ +// https://w3c.github.io/gamepad/extensions.html + +enum GamepadHand { + "", /* unknown, both hands, or not applicable */ + "left", + "right" +}; + +[Exposed=Window] +interface GamepadPose { + readonly attribute boolean hasOrientation; + readonly attribute boolean hasPosition; + + [Throws] // TODO: remove + readonly attribute Float32Array? position; + [Throws] // TODO: remove + readonly attribute Float32Array? linearVelocity; + [Throws] // TODO: remove + readonly attribute Float32Array? linearAcceleration; + [Throws] // TODO: remove + readonly attribute Float32Array? orientation; + [Throws] // TODO: remove + readonly attribute Float32Array? angularVelocity; + [Throws] // TODO: remove + readonly attribute Float32Array? angularAcceleration; +}; + +partial interface Gamepad { + readonly attribute GamepadHand hand; + readonly attribute FrozenArray hapticActuators; + readonly attribute GamepadPose? pose; +}; + +[Exposed=Window] +partial interface GamepadHapticActuator { + [Throws] // TODO: remove + Promise pulse(double value, double duration); +}; diff --git a/crates/web-sys/webidls/enabled/GamepadHapticActuator.webidl b/crates/web-sys/webidls/enabled/GamepadHapticActuator.webidl deleted file mode 100644 index 9255debe3..000000000 --- a/crates/web-sys/webidls/enabled/GamepadHapticActuator.webidl +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://w3c.github.io/gamepad/extensions.html#gamepadhapticactuator-interface - */ - -enum GamepadHapticActuatorType { - "vibration" -}; - -[Pref="dom.gamepad.extensions.enabled", - HeaderFile="mozilla/dom/GamepadHapticActuator.h"] -interface GamepadHapticActuator -{ - readonly attribute GamepadHapticActuatorType type; - [Throws, NewObject] - Promise pulse(double value, double duration); -}; diff --git a/crates/web-sys/webidls/enabled/GamepadPose.webidl b/crates/web-sys/webidls/enabled/GamepadPose.webidl deleted file mode 100644 index 4bc208698..000000000 --- a/crates/web-sys/webidls/enabled/GamepadPose.webidl +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://w3c.github.io/gamepad/extensions.html#gamepadpose-interface - */ - -[Pref="dom.gamepad.extensions.enabled"] -interface GamepadPose -{ - readonly attribute boolean hasOrientation; - readonly attribute boolean hasPosition; - - /** - * position, linearVelocity, and linearAcceleration are 3-component vectors. - * position is relative to a sitting space. Transforming this point with - * VRStageParameters.sittingToStandingTransform converts this to standing space. - */ - [Constant, Throws] readonly attribute Float32Array? position; - [Constant, Throws] readonly attribute Float32Array? linearVelocity; - [Constant, Throws] readonly attribute Float32Array? linearAcceleration; - - /* orientation is a 4-entry array representing the components of a quaternion. */ - [Constant, Throws] readonly attribute Float32Array? orientation; - /* angularVelocity and angularAcceleration are the components of 3-dimensional vectors. */ - [Constant, Throws] readonly attribute Float32Array? angularVelocity; - [Constant, Throws] readonly attribute Float32Array? angularAcceleration; -}; diff --git a/crates/web-sys/webidls/enabled/GamepadServiceTest.webidl b/crates/web-sys/webidls/enabled/GamepadServiceTest.webidl deleted file mode 100644 index bebce4de1..000000000 --- a/crates/web-sys/webidls/enabled/GamepadServiceTest.webidl +++ /dev/null @@ -1,45 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -[Pref="dom.gamepad.test.enabled"] -interface GamepadServiceTest -{ - readonly attribute GamepadMappingType noMapping; - readonly attribute GamepadMappingType standardMapping; - readonly attribute GamepadHand noHand; - readonly attribute GamepadHand leftHand; - readonly attribute GamepadHand rightHand; - - [Throws] - Promise addGamepad(DOMString id, - GamepadMappingType mapping, - GamepadHand hand, - unsigned long numButtons, - unsigned long numAxes, - unsigned long numHaptics); - - undefined removeGamepad(unsigned long index); - - undefined newButtonEvent(unsigned long index, - unsigned long button, - boolean pressed, - boolean touched); - - undefined newButtonValueEvent(unsigned long index, - unsigned long button, - boolean pressed, - boolean touched, - double value); - - undefined newAxisMoveEvent(unsigned long index, - unsigned long axis, - double value); - undefined newPoseMove(unsigned long index, - Float32Array? orient, - Float32Array? pos, - Float32Array? angVelocity, - Float32Array? angAcceleration, - Float32Array? linVelocity, - Float32Array? linAcceleration); -}; \ No newline at end of file diff --git a/crates/web-sys/webidls/enabled/Navigator.webidl b/crates/web-sys/webidls/enabled/Navigator.webidl index 0d116932b..f6e67ebe1 100644 --- a/crates/web-sys/webidls/enabled/Navigator.webidl +++ b/crates/web-sys/webidls/enabled/Navigator.webidl @@ -153,16 +153,6 @@ partial interface Navigator { readonly attribute NetworkInformation connection; }; -// https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension -partial interface Navigator { - [Throws, Pref="dom.gamepad.enabled"] - sequence getGamepads(); -}; -partial interface Navigator { - [Pref="dom.gamepad.test.enabled"] - GamepadServiceTest requestGamepadServiceTest(); -}; - partial interface Navigator { [Throws, Pref="dom.vr.enabled"] Promise> getVRDisplays(); diff --git a/crates/web-sys/webidls/unstable/Gamepad.webidl b/crates/web-sys/webidls/unstable/Gamepad.webidl new file mode 100644 index 000000000..ac537ef5e --- /dev/null +++ b/crates/web-sys/webidls/unstable/Gamepad.webidl @@ -0,0 +1,44 @@ +// https://www.w3.org/TR/gamepad + +partial interface Gamepad { + [SameObject] readonly attribute GamepadHapticActuator vibrationActuator; +}; + +/* TODO: requires partial or extend support. +enum GamepadMappingType { + "xr-standard", +}; +*/ + +partial interface GamepadHapticActuator { + [SameObject] readonly attribute FrozenArray effects; + Promise playEffect( + GamepadHapticEffectType type, + optional GamepadEffectParameters params = {} + ); + Promise reset(); +}; + +enum GamepadHapticsResult { + "complete", + "preempted" +}; + +enum GamepadHapticEffectType { + "dual-rumble", + "trigger-rumble" +}; + +dictionary GamepadEffectParameters { + unsigned long long duration = 0; + unsigned long long startDelay = 0; + double strongMagnitude = 0.0; + double weakMagnitude = 0.0; + double leftTrigger = 0.0; + double rightTrigger = 0.0; +}; + +partial interface mixin WindowEventHandlers { + attribute EventHandler ongamepadconnected; + attribute EventHandler ongamepaddisconnected; +}; diff --git a/crates/web-sys/webidls/unstable/GamepadExtensions.webidl b/crates/web-sys/webidls/unstable/GamepadExtensions.webidl new file mode 100644 index 000000000..d5c904671 --- /dev/null +++ b/crates/web-sys/webidls/unstable/GamepadExtensions.webidl @@ -0,0 +1,13 @@ +// https://w3c.github.io/gamepad/extensions.html + +[Exposed=Window, SecureContext] +interface GamepadTouch { + readonly attribute unsigned long touchId; + readonly attribute octet surfaceId; + readonly attribute Float32Array position; + readonly attribute Uint32Array? surfaceDimensions; +}; + +partial interface Gamepad { + readonly attribute FrozenArray? touchEvents; +};