Skip to content

Commit

Permalink
Add WebIDL definitions relating to Popover API.
Browse files Browse the repository at this point in the history
  • Loading branch information
CathalMullan committed Jul 18, 2024
1 parent 6536e60 commit da2601d
Show file tree
Hide file tree
Showing 17 changed files with 341 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
* Add bindings for `RTCRtpReceiver.jitterBufferTarget`.
[#3968](https://github.com/rustwasm/wasm-bindgen/pull/3968)

* Add WebIDL definitions relating to `Popover API`.
[#3977](https://github.com/rustwasm/wasm-bindgen/pull/3977)

### Changed

* Stabilize Web Share API.
Expand Down
2 changes: 2 additions & 0 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,8 @@ TextTrackList = ["EventTarget"]
TextTrackMode = []
TimeEvent = ["Event"]
TimeRanges = []
ToggleEvent = ["Event"]
ToggleEventInit = []
Touch = []
TouchEvent = ["Event", "UiEvent"]
TouchEventInit = []
Expand Down
14 changes: 14 additions & 0 deletions crates/web-sys/src/features/gen_Document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,20 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Document`*"]
pub fn set_onauxclick(this: &Document, value: Option<&::js_sys::Function>);
# [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = onbeforetoggle)]
#[doc = "Getter for the `onbeforetoggle` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/onbeforetoggle)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Document`*"]
pub fn onbeforetoggle(this: &Document) -> Option<::js_sys::Function>;
# [wasm_bindgen (structural , method , setter , js_class = "Document" , js_name = onbeforetoggle)]
#[doc = "Setter for the `onbeforetoggle` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Document/onbeforetoggle)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Document`*"]
pub fn set_onbeforetoggle(this: &Document, value: Option<&::js_sys::Function>);
# [wasm_bindgen (structural , method , getter , js_class = "Document" , js_name = oncanplay)]
#[doc = "Getter for the `oncanplay` field of this object."]
#[doc = ""]
Expand Down
28 changes: 28 additions & 0 deletions crates/web-sys/src/features/gen_HtmlButtonElement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,34 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`, `NodeList`*"]
pub fn labels(this: &HtmlButtonElement) -> NodeList;
# [wasm_bindgen (structural , method , getter , js_class = "HTMLButtonElement" , js_name = popoverTargetElement)]
#[doc = "Getter for the `popoverTargetElement` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/popoverTargetElement)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"]
pub fn popover_target_element(this: &HtmlButtonElement) -> Option<Element>;
# [wasm_bindgen (structural , method , setter , js_class = "HTMLButtonElement" , js_name = popoverTargetElement)]
#[doc = "Setter for the `popoverTargetElement` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/popoverTargetElement)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"]
pub fn set_popover_target_element(this: &HtmlButtonElement, value: Option<&Element>);
# [wasm_bindgen (structural , method , getter , js_class = "HTMLButtonElement" , js_name = popoverTargetAction)]
#[doc = "Getter for the `popoverTargetAction` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/popoverTargetAction)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"]
pub fn popover_target_action(this: &HtmlButtonElement) -> String;
# [wasm_bindgen (structural , method , setter , js_class = "HTMLButtonElement" , js_name = popoverTargetAction)]
#[doc = "Setter for the `popoverTargetAction` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/popoverTargetAction)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlButtonElement`*"]
pub fn set_popover_target_action(this: &HtmlButtonElement, value: &str);
# [wasm_bindgen (method , structural , js_class = "HTMLButtonElement" , js_name = checkValidity)]
#[doc = "The `checkValidity()` method."]
#[doc = ""]
Expand Down
56 changes: 56 additions & 0 deletions crates/web-sys/src/features/gen_HtmlElement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,20 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"]
pub fn is_content_editable(this: &HtmlElement) -> bool;
# [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = popover)]
#[doc = "Getter for the `popover` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/popover)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"]
pub fn popover(this: &HtmlElement) -> Option<String>;
# [wasm_bindgen (structural , catch , method , setter , js_class = "HTMLElement" , js_name = popover)]
#[doc = "Setter for the `popover` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/popover)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"]
pub fn set_popover(this: &HtmlElement, value: Option<&str>) -> Result<(), JsValue>;
# [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = spellcheck)]
#[doc = "Getter for the `spellcheck` field of this object."]
#[doc = ""]
Expand Down Expand Up @@ -357,6 +371,20 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"]
pub fn set_onauxclick(this: &HtmlElement, value: Option<&::js_sys::Function>);
# [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = onbeforetoggle)]
#[doc = "Getter for the `onbeforetoggle` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/onbeforetoggle)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"]
pub fn onbeforetoggle(this: &HtmlElement) -> Option<::js_sys::Function>;
# [wasm_bindgen (structural , method , setter , js_class = "HTMLElement" , js_name = onbeforetoggle)]
#[doc = "Setter for the `onbeforetoggle` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/onbeforetoggle)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"]
pub fn set_onbeforetoggle(this: &HtmlElement, value: Option<&::js_sys::Function>);
# [wasm_bindgen (structural , method , getter , js_class = "HTMLElement" , js_name = oncanplay)]
#[doc = "Getter for the `oncanplay` field of this object."]
#[doc = ""]
Expand Down Expand Up @@ -1548,4 +1576,32 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `FocusOptions`, `HtmlElement`*"]
pub fn focus_with_options(this: &HtmlElement, options: &FocusOptions) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "HTMLElement" , js_name = hidePopover)]
#[doc = "The `hidePopover()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/hidePopover)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"]
pub fn hide_popover(this: &HtmlElement) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "HTMLElement" , js_name = showPopover)]
#[doc = "The `showPopover()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/showPopover)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"]
pub fn show_popover(this: &HtmlElement) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "HTMLElement" , js_name = togglePopover)]
#[doc = "The `togglePopover()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/togglePopover)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"]
pub fn toggle_popover(this: &HtmlElement) -> Result<bool, JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "HTMLElement" , js_name = togglePopover)]
#[doc = "The `togglePopover()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/togglePopover)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlElement`*"]
pub fn toggle_popover_with_force(this: &HtmlElement, force: bool) -> Result<bool, JsValue>;
}
28 changes: 28 additions & 0 deletions crates/web-sys/src/features/gen_HtmlInputElement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,34 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"]
pub fn set_webkitdirectory(this: &HtmlInputElement, value: bool);
# [wasm_bindgen (structural , method , getter , js_class = "HTMLInputElement" , js_name = popoverTargetElement)]
#[doc = "Getter for the `popoverTargetElement` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/popoverTargetElement)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"]
pub fn popover_target_element(this: &HtmlInputElement) -> Option<Element>;
# [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = popoverTargetElement)]
#[doc = "Setter for the `popoverTargetElement` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/popoverTargetElement)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"]
pub fn set_popover_target_element(this: &HtmlInputElement, value: Option<&Element>);
# [wasm_bindgen (structural , method , getter , js_class = "HTMLInputElement" , js_name = popoverTargetAction)]
#[doc = "Getter for the `popoverTargetAction` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/popoverTargetAction)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"]
pub fn popover_target_action(this: &HtmlInputElement) -> String;
# [wasm_bindgen (structural , method , setter , js_class = "HTMLInputElement" , js_name = popoverTargetAction)]
#[doc = "Setter for the `popoverTargetAction` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/popoverTargetAction)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HtmlInputElement`*"]
pub fn set_popover_target_action(this: &HtmlInputElement, value: &str);
# [wasm_bindgen (method , structural , js_class = "HTMLInputElement" , js_name = checkValidity)]
#[doc = "The `checkValidity()` method."]
#[doc = ""]
Expand Down
14 changes: 14 additions & 0 deletions crates/web-sys/src/features/gen_SvgElement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,20 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `SvgElement`*"]
pub fn set_onauxclick(this: &SvgElement, value: Option<&::js_sys::Function>);
# [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = onbeforetoggle)]
#[doc = "Getter for the `onbeforetoggle` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/onbeforetoggle)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `SvgElement`*"]
pub fn onbeforetoggle(this: &SvgElement) -> Option<::js_sys::Function>;
# [wasm_bindgen (structural , method , setter , js_class = "SVGElement" , js_name = onbeforetoggle)]
#[doc = "Setter for the `onbeforetoggle` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/SVGElement/onbeforetoggle)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `SvgElement`*"]
pub fn set_onbeforetoggle(this: &SvgElement, value: Option<&::js_sys::Function>);
# [wasm_bindgen (structural , method , getter , js_class = "SVGElement" , js_name = oncanplay)]
#[doc = "Getter for the `oncanplay` field of this object."]
#[doc = ""]
Expand Down
47 changes: 47 additions & 0 deletions crates/web-sys/src/features/gen_ToggleEvent.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#![allow(unused_imports)]
#![allow(clippy::all)]
use super::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = Event , extends = :: js_sys :: Object , js_name = ToggleEvent , typescript_type = "ToggleEvent")]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `ToggleEvent` class."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ToggleEvent`*"]
pub type ToggleEvent;
# [wasm_bindgen (structural , method , getter , js_class = "ToggleEvent" , js_name = oldState)]
#[doc = "Getter for the `oldState` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent/oldState)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ToggleEvent`*"]
pub fn old_state(this: &ToggleEvent) -> String;
# [wasm_bindgen (structural , method , getter , js_class = "ToggleEvent" , js_name = newState)]
#[doc = "Getter for the `newState` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent/newState)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ToggleEvent`*"]
pub fn new_state(this: &ToggleEvent) -> String;
#[wasm_bindgen(catch, constructor, js_class = "ToggleEvent")]
#[doc = "The `new ToggleEvent(..)` constructor, creating a new instance of `ToggleEvent`."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent/ToggleEvent)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ToggleEvent`*"]
pub fn new(type_: &str) -> Result<ToggleEvent, JsValue>;
#[cfg(feature = "ToggleEventInit")]
#[wasm_bindgen(catch, constructor, js_class = "ToggleEvent")]
#[doc = "The `new ToggleEvent(..)` constructor, creating a new instance of `ToggleEvent`."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ToggleEvent/ToggleEvent)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ToggleEvent`, `ToggleEventInit`*"]
pub fn new_with_event_init_dict(
type_: &str,
event_init_dict: &ToggleEventInit,
) -> Result<ToggleEvent, JsValue>;
}
73 changes: 73 additions & 0 deletions crates/web-sys/src/features/gen_ToggleEventInit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#![allow(unused_imports)]
#![allow(clippy::all)]
use super::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = ToggleEventInit)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `ToggleEventInit` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"]
pub type ToggleEventInit;
#[wasm_bindgen(method, setter = "bubbles")]
fn bubbles_shim(this: &ToggleEventInit, val: bool);
#[wasm_bindgen(method, setter = "cancelable")]
fn cancelable_shim(this: &ToggleEventInit, val: bool);
#[wasm_bindgen(method, setter = "composed")]
fn composed_shim(this: &ToggleEventInit, val: bool);
#[wasm_bindgen(method, setter = "newState")]
fn new_state_shim(this: &ToggleEventInit, val: &str);
#[wasm_bindgen(method, setter = "oldState")]
fn old_state_shim(this: &ToggleEventInit, val: &str);
}
impl ToggleEventInit {
#[doc = "Construct a new `ToggleEventInit`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"]
pub fn new() -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret
}
#[doc = "Change the `bubbles` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"]
pub fn bubbles(&mut self, val: bool) -> &mut Self {
self.bubbles_shim(val);
self
}
#[doc = "Change the `cancelable` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"]
pub fn cancelable(&mut self, val: bool) -> &mut Self {
self.cancelable_shim(val);
self
}
#[doc = "Change the `composed` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"]
pub fn composed(&mut self, val: bool) -> &mut Self {
self.composed_shim(val);
self
}
#[doc = "Change the `newState` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"]
pub fn new_state(&mut self, val: &str) -> &mut Self {
self.new_state_shim(val);
self
}
#[doc = "Change the `oldState` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ToggleEventInit`*"]
pub fn old_state(&mut self, val: &str) -> &mut Self {
self.old_state_shim(val);
self
}
}
impl Default for ToggleEventInit {
fn default() -> Self {
Self::new()
}
}
14 changes: 14 additions & 0 deletions crates/web-sys/src/features/gen_Window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,20 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Window`*"]
pub fn set_onauxclick(this: &Window, value: Option<&::js_sys::Function>);
# [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = onbeforetoggle)]
#[doc = "Getter for the `onbeforetoggle` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/onbeforetoggle)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Window`*"]
pub fn onbeforetoggle(this: &Window) -> Option<::js_sys::Function>;
# [wasm_bindgen (structural , method , setter , js_class = "Window" , js_name = onbeforetoggle)]
#[doc = "Setter for the `onbeforetoggle` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/onbeforetoggle)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Window`*"]
pub fn set_onbeforetoggle(this: &Window, value: Option<&::js_sys::Function>);
# [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = oncanplay)]
#[doc = "Getter for the `oncanplay` field of this object."]
#[doc = ""]
Expand Down
Loading

0 comments on commit da2601d

Please sign in to comment.