///|
#external
pub type KeyboardEvent

///|
pub extern "js" fn KeyboardEvent::new_with_init_dict(
  type_ : String,
  event_init_dict : KeyboardEventInit,
) -> KeyboardEvent =
  #| (type_, event_init_dict) => new KeyboardEvent(type_, event_init_dict)

// key

///|
pub extern "js" fn KeyboardEvent::key(self : KeyboardEvent) -> String =
  #| (self) => self.key

// type_

///|
pub extern "js" fn KeyboardEvent::type_(self : KeyboardEvent) -> String =
  #| (self) => self.type

// key_code

///|
pub extern "js" fn KeyboardEvent::key_code(self : KeyboardEvent) -> UInt =
  #| (self) => self.keyCode

// shift_key

///|
pub extern "js" fn KeyboardEvent::shift_key(self : KeyboardEvent) -> Bool =
  #| (self) => self.shiftKey

// ctrl_key

///|
pub extern "js" fn KeyboardEvent::ctrl_key(self : KeyboardEvent) -> Bool =
  #| (self) => self.ctrlKey

// alt_key

///|
pub extern "js" fn KeyboardEvent::alt_key(self : KeyboardEvent) -> Bool =
  #| (self) => self.altKey

// meta_key

///|
pub extern "js" fn KeyboardEvent::meta_key(self : KeyboardEvent) -> Bool =
  #| (self) => self.metaKey

// repeat

///|
pub extern "js" fn KeyboardEvent::repeat(self : KeyboardEvent) -> Bool =
  #| (self) => self.repeat

///|
pub extern "js" fn KeyboardEvent::view(self : KeyboardEvent) -> Window =
  #| (self) => self.view

///|
pub extern "js" fn KeyboardEvent::code(self : KeyboardEvent) -> String =
  #| (self) => self.code

///|
pub extern "js" fn KeyboardEvent::char_code(self : KeyboardEvent) -> UInt =
  #| (self) => self.charCode

///|
pub extern "js" fn KeyboardEvent::location(self : KeyboardEvent) -> UInt =
  #| (self) => self.location

// dispatch_event

///|
pub extern "js" fn Node::dispatch_event(
  self : Node,
  event : KeyboardEvent,
) -> Bool =
  #| (self, event) => self.dispatchEvent(event)

///|
pub extern "js" fn KeyboardEvent::prevent_default(self : KeyboardEvent) -> Unit =
  #| (self) => self.preventDefault()

///|
pub extern "js" fn KeyboardEvent::stop_propagation(
  self : KeyboardEvent,
) -> Unit =
  #| (self) => self.stopPropagation()

// set_repeat

///|
pub extern "js" fn KeyboardEvent::set_repeat(
  self : KeyboardEvent,
  repeat : Bool,
) -> Unit =
  #| (self, repeat) => { self.repeat = repeat }

///|
/// need to init function first before creating real event
#external
pub type KeyboardEventInit

///|
pub extern "js" fn KeyboardEventInit::new() -> KeyboardEventInit =
  #| () => ({})

///|
pub extern "js" fn Window::keyboard_event_init(
  self : Window,
  type_ : String,
) -> KeyboardEventInit =
  #| (self, type) => ({})

///|
pub extern "js" fn KeyboardEventInit::set_key(
  self : KeyboardEventInit,
  key : String,
) -> Unit =
  #| (self, key) => { self.key = key }

///|
pub extern "js" fn KeyboardEventInit::set_code(
  self : KeyboardEventInit,
  code : String,
) -> Unit =
  #| (self, code) => { self.code = code }

///|
pub extern "js" fn KeyboardEventInit::set_char_code(
  self : KeyboardEventInit,
  char_code : UInt,
) -> Unit =
  #| (self, char_code) => { self.charCode = char_code }

///|
pub extern "js" fn KeyboardEventInit::set_view(
  self : KeyboardEventInit,
  view : Window,
) -> Unit =
  #| (self, view) => { self.view = view }

///|
pub extern "js" fn KeyboardEventInit::set_location(
  self : KeyboardEventInit,
  location : UInt,
) -> Unit =
  #| (self, location) => { self.location = location }

///|
pub extern "js" fn KeyboardEventInit::set_key_code(
  self : KeyboardEventInit,
  key_code : UInt,
) -> Unit =
  #| (self, key_code) => { self.keyCode = key_code }

///|
#external
pub type InputEvent

///|
#external
pub type FocusEvent

///|
#external
pub type BlurEvent

///|
#external
pub type MouseEvent

///|
pub extern "js" fn MouseEvent::stop_propagation(self : MouseEvent) -> Unit =
  #| (self) => self.stopPropagation()

///|
pub extern "js" fn MouseEvent::prevent_default(self : MouseEvent) -> Unit =
  #| (self) => self.preventDefault()

// client_x

///|
/// | Returns the horizontal coordinate within the viewport at which the event occurred.
/// |
/// | [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/clientX)
pub extern "js" fn MouseEvent::client_x(self : MouseEvent) -> Float =
  #| (self) => self.clientX

// client_y

///|
/// | Returns the vertical coordinate within the viewport at which the event occurred.
/// |
/// | [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/clientY)
pub extern "js" fn MouseEvent::client_y(self : MouseEvent) -> Float =
  #| (self) => self.clientY

// page_x

///|
/// | Returns the horizontal coordinate (in pixels) at which the mouse was clicked, relative to the left edge of the entire document.
/// |
/// | [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/pageX)
pub extern "js" fn MouseEvent::page_x(self : MouseEvent) -> Float =
  #| (self) => self.pageX

// page_y

///|
/// | Returns the vertical coordinate (in pixels) at which the mouse was clicked, relative to the top edge of the entire document.
/// |
/// | [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/pageY)
pub extern "js" fn MouseEvent::page_y(self : MouseEvent) -> Float =
  #| (self) => self.pageY

// offset_x

///|
/// | Returns the horizontal offset (in pixels) of the pointer from the left edge of the target element's padding edge.
/// |
/// | [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/offsetX)
pub extern "js" fn MouseEvent::offset_x(self : MouseEvent) -> Float =
  #| (self) => self.offsetX

// offset_y

///|
/// | Returns the vertical offset (in pixels) of the pointer from the top edge of the target element's padding edge.
/// |
/// | [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/offsetY)
pub extern "js" fn MouseEvent::offset_y(self : MouseEvent) -> Float =
  #| (self) => self.offsetY

///|
#external
pub type DragEvent

///|
pub extern "js" fn DragEvent::stop_propagation(self : DragEvent) -> Unit =
  #| (self) => self.stopPropagation()

///|
pub extern "js" fn DragEvent::prevent_default(self : DragEvent) -> Unit =
  #| (self) => self.preventDefault()

///|
/// | Returns the horizontal coordinate within the viewport at which the event occurred.
/// |
/// | [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/clientX)
pub extern "js" fn DragEvent::client_x(self : DragEvent) -> Float =
  #| (self) => self.clientX

///|
/// | Returns the vertical coordinate within the viewport at which the event occurred.
/// |
/// | [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/clientY)
pub extern "js" fn DragEvent::client_y(self : DragEvent) -> Float =
  #| (self) => self.clientY

// page_x

///|
/// | Returns the horizontal coordinate (in pixels) relative to the left edge of the entire document.
/// |
/// | [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/pageX)
pub extern "js" fn DragEvent::page_x(self : DragEvent) -> Float =
  #| (self) => self.pageX

// page_y

///|
/// | Returns the vertical coordinate (in pixels) relative to the top edge of the entire document.
/// |
/// | [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/pageY)
pub extern "js" fn DragEvent::page_y(self : DragEvent) -> Float =
  #| (self) => self.pageY

// offset_x

///|
/// | Returns the horizontal offset (in pixels) from the left edge of the target element's padding edge.
/// |
/// | [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/offsetX)
pub extern "js" fn DragEvent::offset_x(self : DragEvent) -> Float =
  #| (self) => self.offsetX

// offset_y

///|
/// | Returns the vertical offset (in pixels) from the top edge of the target element's padding edge.
/// |
/// | [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/offsetY)
pub extern "js" fn DragEvent::offset_y(self : DragEvent) -> Float =
  #| (self) => self.offsetY

///|
/// | Returns the data being dragged, during a drag and drop operation.
/// |
/// | [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/dataTransfer)
pub extern "js" fn DragEvent::data_transfer(self : DragEvent) -> DataTransfer =
  #| (self) => self.dataTransfer

///|
#external
pub type DataTransfer

///|
pub extern "js" fn DataTransfer::set_data(
  self : DataTransfer,
  format : String,
  data : String,
) -> Unit =
  #| (self, format, data) => self.setData(format, data)

///|
pub extern "js" fn DataTransfer::get_data(
  self : DataTransfer,
  format : String,
) -> String =
  #| (self, format) => self.getData(format)

///|
pub extern "js" fn DataTransfer::clear_data(self : DataTransfer) -> Unit =
  #| (self) => self.clearData()

///|
pub extern "js" fn DataTransfer::set_drop_effect(
  self : DataTransfer,
  effect : String,
) -> Unit =
  #| (self, effect) => { self.dropEffect = effect }

///|
pub extern "js" fn DataTransfer::set_effect_allowed(
  self : DataTransfer,
  effect : String,
) -> Unit =
  #| (self, effect) => { self.effectAllowed = effect }