chore: iron out all events
This commit is contained in:
1 parent
491bf4332d
commit
08ca068d1c
15 files changed
+360
-1645
No files matched your search
@@ -9,3 +9,16 @@ pub struct AnimationData {
|
||||
pub pseudo_element: String,
|
||||
pub elapsed_time: f32,
|
||||
}
|
||||
|
||||
impl_event! [
|
||||
AnimationData;
|
||||
|
||||
/// onanimationstart
|
||||
onanimationstart
|
||||
|
||||
/// onanimationend
|
||||
onanimationend
|
||||
|
||||
/// onanimationiteration
|
||||
onanimationiteration
|
||||
];
|
||||
@@ -6,3 +6,16 @@ pub type ClipboardEvent = UiEvent<ClipboardData>;
|
||||
pub struct ClipboardData {
|
||||
// DOMDataTransfer clipboardData
|
||||
}
|
||||
|
||||
impl_event![
|
||||
ClipboardData;
|
||||
|
||||
/// oncopy
|
||||
oncopy
|
||||
|
||||
/// oncut
|
||||
oncut
|
||||
|
||||
/// onpaste
|
||||
onpaste
|
||||
];
|
||||
@@ -6,3 +6,16 @@ pub type CompositionEvent = UiEvent<CompositionData>;
|
||||
pub struct CompositionData {
|
||||
pub data: String,
|
||||
}
|
||||
|
||||
impl_event! [
|
||||
CompositionData;
|
||||
|
||||
/// oncompositionstart
|
||||
oncompositionstart
|
||||
|
||||
/// oncompositionend
|
||||
oncompositionend
|
||||
|
||||
/// oncompositionupdate
|
||||
oncompositionupdate
|
||||
];
|
||||
@@ -0,0 +1,47 @@
|
||||
use std::any::Any;
|
||||
|
||||
use dioxus_core::UiEvent;
|
||||
|
||||
use crate::MouseData;
|
||||
|
||||
pub type DragEvent = UiEvent<DragData>;
|
||||
|
||||
/// The DragEvent interface is a DOM event that represents a drag and drop interaction. The user initiates a drag by
|
||||
/// placing a pointer device (such as a mouse) on the touch surface and then dragging the pointer to a new location
|
||||
/// (such as another DOM element). Applications are free to interpret a drag and drop interaction in an
|
||||
/// application-specific way.
|
||||
pub struct DragData {
|
||||
/// Inherit mouse data
|
||||
pub mouse: MouseData,
|
||||
|
||||
/// And then add the rest of the drag data
|
||||
pub data: Box<dyn Any>,
|
||||
}
|
||||
|
||||
impl_event! {
|
||||
DragData;
|
||||
|
||||
/// ondrag
|
||||
ondrag
|
||||
|
||||
/// ondragend
|
||||
ondragend
|
||||
|
||||
/// ondragenter
|
||||
ondragenter
|
||||
|
||||
/// ondragexit
|
||||
ondragexit
|
||||
|
||||
/// ondragleave
|
||||
ondragleave
|
||||
|
||||
/// ondragover
|
||||
ondragover
|
||||
|
||||
/// ondragstart
|
||||
ondragstart
|
||||
|
||||
/// ondrop
|
||||
ondrop
|
||||
}
|
||||
@@ -6,3 +6,13 @@ pub type ImageEvent = UiEvent<ImageData>;
|
||||
pub struct ImageData {
|
||||
pub load_error: bool,
|
||||
}
|
||||
|
||||
impl_event! [
|
||||
ImageData;
|
||||
|
||||
/// onerror
|
||||
onerror
|
||||
|
||||
/// onload
|
||||
onload
|
||||
];
|
||||
@@ -4,3 +4,78 @@ pub type MediaEvent = UiEvent<MediaData>;
|
||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct MediaData {}
|
||||
|
||||
impl_event! [
|
||||
MediaData;
|
||||
|
||||
///abort
|
||||
onabort
|
||||
|
||||
///canplay
|
||||
oncanplay
|
||||
|
||||
///canplaythrough
|
||||
oncanplaythrough
|
||||
|
||||
///durationchange
|
||||
ondurationchange
|
||||
|
||||
///emptied
|
||||
onemptied
|
||||
|
||||
///encrypted
|
||||
onencrypted
|
||||
|
||||
///ended
|
||||
onended
|
||||
|
||||
// todo: this conflicts with image events
|
||||
// neither have data, so it's okay
|
||||
// ///error
|
||||
// onerror
|
||||
|
||||
///loadeddata
|
||||
onloadeddata
|
||||
|
||||
///loadedmetadata
|
||||
onloadedmetadata
|
||||
|
||||
///loadstart
|
||||
onloadstart
|
||||
|
||||
///pause
|
||||
onpause
|
||||
|
||||
///play
|
||||
onplay
|
||||
|
||||
///playing
|
||||
onplaying
|
||||
|
||||
///progress
|
||||
onprogress
|
||||
|
||||
///ratechange
|
||||
onratechange
|
||||
|
||||
///seeked
|
||||
onseeked
|
||||
|
||||
///seeking
|
||||
onseeking
|
||||
|
||||
///stalled
|
||||
onstalled
|
||||
|
||||
///suspend
|
||||
onsuspend
|
||||
|
||||
///timeupdate
|
||||
ontimeupdate
|
||||
|
||||
///volumechange
|
||||
onvolumechange
|
||||
|
||||
///waiting
|
||||
onwaiting
|
||||
];
|
||||
@@ -125,30 +125,6 @@ impl_event! {
|
||||
/// ondoubleclick
|
||||
ondblclick
|
||||
|
||||
/// ondrag
|
||||
ondrag
|
||||
|
||||
/// ondragend
|
||||
ondragend
|
||||
|
||||
/// ondragenter
|
||||
ondragenter
|
||||
|
||||
/// ondragexit
|
||||
ondragexit
|
||||
|
||||
/// ondragleave
|
||||
ondragleave
|
||||
|
||||
/// ondragover
|
||||
ondragover
|
||||
|
||||
/// ondragstart
|
||||
ondragstart
|
||||
|
||||
/// ondrop
|
||||
ondrop
|
||||
|
||||
/// onmousedown
|
||||
onmousedown
|
||||
|
||||
|
||||
@@ -29,3 +29,36 @@ pub struct PointerData {
|
||||
pub is_primary: bool,
|
||||
// pub get_modifier_state: bool,
|
||||
}
|
||||
|
||||
impl_event![
|
||||
PointerData;
|
||||
/// pointerdown
|
||||
onpointerdown
|
||||
|
||||
/// pointermove
|
||||
onpointermove
|
||||
|
||||
/// pointerup
|
||||
onpointerup
|
||||
|
||||
/// pointercancel
|
||||
onpointercancel
|
||||
|
||||
/// gotpointercapture
|
||||
ongotpointercapture
|
||||
|
||||
/// lostpointercapture
|
||||
onlostpointercapture
|
||||
|
||||
/// pointerenter
|
||||
onpointerenter
|
||||
|
||||
/// pointerleave
|
||||
onpointerleave
|
||||
|
||||
/// pointerover
|
||||
onpointerover
|
||||
|
||||
/// pointerout
|
||||
onpointerout
|
||||
];
|
||||
@@ -4,3 +4,10 @@ pub type ScrollEvent = UiEvent<ScrollData>;
|
||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ScrollData {}
|
||||
|
||||
impl_event! {
|
||||
ScrollData;
|
||||
|
||||
/// onscroll
|
||||
onscroll
|
||||
}
|
||||
@@ -4,3 +4,16 @@ pub type SelectionEvent = UiEvent<SelectionData>;
|
||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SelectionData {}
|
||||
|
||||
impl_event! [
|
||||
SelectionData;
|
||||
|
||||
/// select
|
||||
onselect
|
||||
|
||||
/// selectstart
|
||||
onselectstart
|
||||
|
||||
/// selectionchange
|
||||
onselectionchange
|
||||
];
|
||||
@@ -4,3 +4,10 @@ pub type ToggleEvent = UiEvent<ToggleData>;
|
||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ToggleData {}
|
||||
|
||||
impl_event! {
|
||||
ToggleData;
|
||||
|
||||
/// ontoggle
|
||||
ontoggle
|
||||
}
|
||||
@@ -13,3 +13,18 @@ pub struct TouchData {
|
||||
// targetTouches: DOMTouchList,
|
||||
// touches: DOMTouchList,
|
||||
}
|
||||
|
||||
impl_event! {
|
||||
TouchData;
|
||||
/// touchstart
|
||||
ontouchstart
|
||||
|
||||
/// touchmove
|
||||
ontouchmove
|
||||
|
||||
/// touchend
|
||||
ontouchend
|
||||
|
||||
/// touchcancel
|
||||
ontouchcancel
|
||||
}
|
||||
@@ -8,3 +8,10 @@ pub struct TransitionData {
|
||||
pub pseudo_element: String,
|
||||
pub elapsed_time: f32,
|
||||
}
|
||||
|
||||
impl_event! {
|
||||
TransitionData;
|
||||
|
||||
/// transitionend
|
||||
ontransitionend
|
||||
}
|
||||
Reference in new issue
Block a user