mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 14:54:16 +00:00
added all events I could find
This commit is contained in:
parent
64722604b5
commit
b69119f11f
2 changed files with 185 additions and 106 deletions
|
@ -34,18 +34,29 @@ features = [
|
|||
|
||||
# Events we cast to in leptos_macro -- added here so we don't force users to import them
|
||||
"AnimationEvent",
|
||||
"BeforeUnloadEvent",
|
||||
"ClipboardEvent",
|
||||
"CompositionEvent",
|
||||
"DeviceMotionEvent",
|
||||
"DeviceOrientationEvent",
|
||||
"DragEvent",
|
||||
"FocusEvent",
|
||||
"GamepadEvent",
|
||||
"HashChangeEvent",
|
||||
"InputEvent",
|
||||
"KeyboardEvent",
|
||||
"MouseEvent",
|
||||
"PageTransitionEvent",
|
||||
"PointerEvent",
|
||||
"PopStateEvent",
|
||||
"ProgressEvent",
|
||||
"PromiseRejectionEvent",
|
||||
"SecurityPolicyViolationEvent",
|
||||
"StorageEvent",
|
||||
"SubmitEvent",
|
||||
"TouchEvent",
|
||||
"TransitionEvent",
|
||||
"UiEvent",
|
||||
"WheelEvent",
|
||||
]
|
||||
|
||||
|
|
|
@ -66,113 +66,181 @@ impl<E: FromWasmAbi> Custom<E> {
|
|||
}
|
||||
|
||||
macro_rules! generate_event_types {
|
||||
[$([$web_sys_event:ident, [$($event:ident),* $(,)?]]),* $(,)?] => {
|
||||
paste::paste! {
|
||||
$(
|
||||
{$(
|
||||
$( #[$does_not_bubble:ident] )?
|
||||
$event:ident : $web_sys_event:ident
|
||||
),* $(,)?} => {
|
||||
|
||||
$(
|
||||
#[doc = "The "]
|
||||
#[doc = stringify!($event)]
|
||||
#[doc = "event."]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub struct $event;
|
||||
|
||||
impl EventDescriptor for $event {
|
||||
type EventType = web_sys::$web_sys_event;
|
||||
|
||||
fn name(&self) -> Cow<'static, str> {
|
||||
stringify!([<$event:lower>]).into()
|
||||
}
|
||||
|
||||
$(
|
||||
#[doc = "The "]
|
||||
#[doc = stringify!([<$event:lower>])]
|
||||
#[doc = "event."]
|
||||
pub struct $event;
|
||||
|
||||
impl EventDescriptor for $event {
|
||||
type EventType = web_sys::$web_sys_event;
|
||||
|
||||
fn name(&self) -> Cow<'static, str> {
|
||||
stringify!([<$event:lower>]).into()
|
||||
}
|
||||
}
|
||||
)*
|
||||
)*
|
||||
}
|
||||
generate_event_types!($does_not_bubble);
|
||||
)?
|
||||
}
|
||||
)*
|
||||
};
|
||||
|
||||
(does_not_bubble) => {
|
||||
fn bubbles(&self) -> bool { false }
|
||||
}
|
||||
}
|
||||
|
||||
generate_event_types![
|
||||
[Event, [Copy, Cut, Paste]],
|
||||
[
|
||||
CompositionEvent,
|
||||
[CompositionEnd, CompositionStart, CompositionUpdate]
|
||||
],
|
||||
[KeyboardEvent, [KeyDown, Keypress, Keyup]],
|
||||
[FocusEvent, [Focus, FocusOut, FocusIn, Blur]],
|
||||
[Event, [Change, Input, Invalid, Reset]],
|
||||
[
|
||||
MouseEvent,
|
||||
[
|
||||
Click,
|
||||
ContextMenu,
|
||||
DoubleClick,
|
||||
DblClick,
|
||||
Drag,
|
||||
DragEnd,
|
||||
DragEnter,
|
||||
DragExit,
|
||||
DragLeave,
|
||||
DragOver,
|
||||
DragStart,
|
||||
Drop,
|
||||
MouseDown,
|
||||
MouseEnter,
|
||||
MouseLeave,
|
||||
MouseMove,
|
||||
MouseOut,
|
||||
MouseOver,
|
||||
MouseUp,
|
||||
]
|
||||
],
|
||||
[Event, [Scroll]],
|
||||
[Event, [SubmitEvent]],
|
||||
[
|
||||
PointerEvent,
|
||||
[
|
||||
PointerDown,
|
||||
PointerMove,
|
||||
PointerUp,
|
||||
PointerCancel,
|
||||
GotPointerCapture,
|
||||
LostPointerCapture,
|
||||
PointerEnter,
|
||||
PointerLeave,
|
||||
PointerOver,
|
||||
PointerOut,
|
||||
]
|
||||
],
|
||||
[Event, [Select]],
|
||||
[TouchEvent, [TouchCancel, TouchEnd, TouchMove, TouchStart]],
|
||||
[WheelEvent, [Wheel]],
|
||||
[
|
||||
Event,
|
||||
[
|
||||
Abort,
|
||||
CanPlay,
|
||||
CanPlayThrough,
|
||||
DurationChange,
|
||||
Emptied,
|
||||
Encrypted,
|
||||
Ended,
|
||||
Error,
|
||||
LoadedData,
|
||||
LoadedMetadata,
|
||||
LoadStart,
|
||||
Pause,
|
||||
Play,
|
||||
Playing,
|
||||
Progress,
|
||||
RateChange,
|
||||
Seeked,
|
||||
Seeking,
|
||||
Stalled,
|
||||
Suspend,
|
||||
TimeUpdate,
|
||||
VolumeChange,
|
||||
Waiting,
|
||||
]
|
||||
],
|
||||
[
|
||||
AnimationEvent,
|
||||
[AnimationStart, AnimationEnd, AnimationIteration,]
|
||||
],
|
||||
[TransitionEvent, [TransitionEnd]],
|
||||
[Event, [Toggle]]
|
||||
];
|
||||
generate_event_types! {
|
||||
// =========================================================
|
||||
// WindowEventHandlersEventMap
|
||||
// =========================================================
|
||||
afterprint: Event,
|
||||
beforeprint: Event,
|
||||
beforeunload: BeforeUnloadEvent,
|
||||
gamepadconnected: GamepadEvent,
|
||||
gamepaddisconnected: GamepadEvent,
|
||||
hashchange: HashChangeEvent,
|
||||
languagechange: Event,
|
||||
message: MessageEvent,
|
||||
messageerror: MessageEvent,
|
||||
offline: Event,
|
||||
online: Event,
|
||||
pagehide: PageTransitionEvent,
|
||||
pageshow: PageTransitionEvent,
|
||||
popstate: PopStateEvent,
|
||||
rejectionhandled: PromiseRejectionEvent,
|
||||
storage: StorageEvent,
|
||||
unhandledrejection: PromiseRejectionEvent,
|
||||
unload: Event,
|
||||
|
||||
// =========================================================
|
||||
// GlobalEventHandlersEventMap
|
||||
// =========================================================
|
||||
abort: UiEvent,
|
||||
animationcancel: AnimationEvent,
|
||||
animationend: AnimationEvent,
|
||||
animationiteration: AnimationEvent,
|
||||
animationstart: AnimationEvent,
|
||||
auxclick: MouseEvent,
|
||||
beforeinput: InputEvent,
|
||||
blur: FocusEvent,
|
||||
canplay: Event,
|
||||
canplaythrough: Event,
|
||||
change: Event,
|
||||
click: MouseEvent,
|
||||
close: Event,
|
||||
compositionend: CompositionEvent,
|
||||
compositionstart: CompositionEvent,
|
||||
compositionupdate: CompositionEvent,
|
||||
contextmenu: MouseEvent,
|
||||
cuechange: Event,
|
||||
dblclick: MouseEvent,
|
||||
drag: DragEvent,
|
||||
dragend: DragEvent,
|
||||
dragenter: DragEvent,
|
||||
dragleave: DragEvent,
|
||||
dragover: DragEvent,
|
||||
dragstart: DragEvent,
|
||||
drop: DragEvent,
|
||||
durationchange: Event,
|
||||
emptied: Event,
|
||||
ended: Event,
|
||||
error: ErrorEvent,
|
||||
focus: FocusEvent,
|
||||
focusin: FocusEvent,
|
||||
focusout: FocusEvent,
|
||||
formdata: Event, // web_sys does not include `FormDataEvent`
|
||||
gotpointercapture: PointerEvent,
|
||||
input: Event,
|
||||
invalid: Event,
|
||||
keydown: KeyboardEvent,
|
||||
keypress: KeyboardEvent,
|
||||
keyup: KeyboardEvent,
|
||||
load: Event,
|
||||
loadeddata: Event,
|
||||
loadedmetadata: Event,
|
||||
loadstart: Event,
|
||||
lostpointercapture: PointerEvent,
|
||||
mousedown: MouseEvent,
|
||||
mouseenter: MouseEvent,
|
||||
mouseleave: MouseEvent,
|
||||
mousemove: MouseEvent,
|
||||
mouseout: MouseEvent,
|
||||
mouseover: MouseEvent,
|
||||
mouseup: MouseEvent,
|
||||
pause: Event,
|
||||
play: Event,
|
||||
playing: Event,
|
||||
pointercancel: PointerEvent,
|
||||
pointerdown: PointerEvent,
|
||||
pointerenter: PointerEvent,
|
||||
pointerleave: PointerEvent,
|
||||
pointermove: PointerEvent,
|
||||
pointerout: PointerEvent,
|
||||
pointerover: PointerEvent,
|
||||
pointerup: PointerEvent,
|
||||
progress: ProgressEvent,
|
||||
ratechange: Event,
|
||||
reset: Event,
|
||||
resize: UiEvent,
|
||||
scroll: Event,
|
||||
securitypolicyviolation: SecurityPolicyViolationEvent,
|
||||
seeked: Event,
|
||||
seeking: Event,
|
||||
select: Event,
|
||||
selectionchange: Event,
|
||||
selectstart: Event,
|
||||
slotchange: Event,
|
||||
stalled: Event,
|
||||
submit: SubmitEvent,
|
||||
suspend: Event,
|
||||
timeupdate: Event,
|
||||
toggle: Event,
|
||||
touchcancel: TouchEvent,
|
||||
touchend: TouchEvent,
|
||||
touchmove: TouchEvent,
|
||||
touchstart: TouchEvent,
|
||||
transitioncancel: TransitionEvent,
|
||||
transitionend: TransitionEvent,
|
||||
transitionrun: TransitionEvent,
|
||||
transitionstart: TransitionEvent,
|
||||
volumechange: Event,
|
||||
waiting: Event,
|
||||
webkitanimationend: Event,
|
||||
webkitanimationiteration: Event,
|
||||
webkitanimationstart: Event,
|
||||
webkittransitionend: Event,
|
||||
wheel: WheelEvent,
|
||||
|
||||
// =========================================================
|
||||
// WindowEventMap
|
||||
// =========================================================
|
||||
DOMContentLoaded: Event,
|
||||
devicemotion: DeviceMotionEvent,
|
||||
deviceorientation: DeviceOrientationEvent,
|
||||
orientationchange: Event,
|
||||
|
||||
// =========================================================
|
||||
// DocumentAndElementEventHandlersEventMap
|
||||
// =========================================================
|
||||
copy: Event, // ClipboardEvent is unstable
|
||||
cut: Event, // ClipboardEvent is unstable
|
||||
paste: Event, // ClipboardEvent is unstable
|
||||
|
||||
// =========================================================
|
||||
// DocumentEventMap
|
||||
// =========================================================
|
||||
fullscreenchange: Event,
|
||||
fullscreenerror: Event,
|
||||
pointerlockchange: Event,
|
||||
pointerlockerror: Event,
|
||||
readystatechange: Event,
|
||||
visibilitychange: Event,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue