1use crate::*;
2
3impl NativeEventName {
5 pub(crate) const DELEGATABLE_EVENT_NAMES: [&str; 46] = [
12 "click",
13 "dblclick",
14 "mousedown",
15 "mouseup",
16 "mousemove",
17 "mouseenter",
18 "mouseleave",
19 "mouseover",
20 "mouseout",
21 "contextmenu",
22 "input",
23 "keydown",
24 "keyup",
25 "keypress",
26 "focus",
27 "blur",
28 "focusin",
29 "focusout",
30 "submit",
31 "change",
32 "drag",
33 "dragstart",
34 "dragend",
35 "dragover",
36 "dragenter",
37 "dragleave",
38 "drop",
39 "touchstart",
40 "touchend",
41 "touchmove",
42 "touchcancel",
43 "wheel",
44 "copy",
45 "cut",
46 "paste",
47 "play",
48 "pause",
49 "ended",
50 "loadeddata",
51 "canplay",
52 "volumechange",
53 "timeupdate",
54 "scroll",
55 "animationstart",
56 "animationend",
57 "transitionend",
58 ];
59
60 pub fn as_str(&self) -> Cow<'static, str> {
69 match self {
70 NativeEventName::Click => Cow::Borrowed("click"),
71 NativeEventName::DblClick => Cow::Borrowed("dblclick"),
72 NativeEventName::MouseDown => Cow::Borrowed("mousedown"),
73 NativeEventName::MouseUp => Cow::Borrowed("mouseup"),
74 NativeEventName::MouseMove => Cow::Borrowed("mousemove"),
75 NativeEventName::MouseEnter => Cow::Borrowed("mouseenter"),
76 NativeEventName::MouseLeave => Cow::Borrowed("mouseleave"),
77 NativeEventName::MouseOver => Cow::Borrowed("mouseover"),
78 NativeEventName::MouseOut => Cow::Borrowed("mouseout"),
79 NativeEventName::ContextMenu => Cow::Borrowed("contextmenu"),
80 NativeEventName::Input => Cow::Borrowed("input"),
81 NativeEventName::KeyDown => Cow::Borrowed("keydown"),
82 NativeEventName::KeyUp => Cow::Borrowed("keyup"),
83 NativeEventName::KeyPress => Cow::Borrowed("keypress"),
84 NativeEventName::Focus => Cow::Borrowed("focus"),
85 NativeEventName::Blur => Cow::Borrowed("blur"),
86 NativeEventName::FocusIn => Cow::Borrowed("focusin"),
87 NativeEventName::FocusOut => Cow::Borrowed("focusout"),
88 NativeEventName::Submit => Cow::Borrowed("submit"),
89 NativeEventName::Change => Cow::Borrowed("change"),
90 NativeEventName::Drag => Cow::Borrowed("drag"),
91 NativeEventName::DragStart => Cow::Borrowed("dragstart"),
92 NativeEventName::DragEnd => Cow::Borrowed("dragend"),
93 NativeEventName::DragOver => Cow::Borrowed("dragover"),
94 NativeEventName::DragEnter => Cow::Borrowed("dragenter"),
95 NativeEventName::DragLeave => Cow::Borrowed("dragleave"),
96 NativeEventName::Drop => Cow::Borrowed("drop"),
97 NativeEventName::TouchStart => Cow::Borrowed("touchstart"),
98 NativeEventName::TouchEnd => Cow::Borrowed("touchend"),
99 NativeEventName::TouchMove => Cow::Borrowed("touchmove"),
100 NativeEventName::TouchCancel => Cow::Borrowed("touchcancel"),
101 NativeEventName::Wheel => Cow::Borrowed("wheel"),
102 NativeEventName::Copy => Cow::Borrowed("copy"),
103 NativeEventName::Cut => Cow::Borrowed("cut"),
104 NativeEventName::Paste => Cow::Borrowed("paste"),
105 NativeEventName::Play => Cow::Borrowed("play"),
106 NativeEventName::Pause => Cow::Borrowed("pause"),
107 NativeEventName::Ended => Cow::Borrowed("ended"),
108 NativeEventName::LoadedData => Cow::Borrowed("loadeddata"),
109 NativeEventName::CanPlay => Cow::Borrowed("canplay"),
110 NativeEventName::VolumeChange => Cow::Borrowed("volumechange"),
111 NativeEventName::TimeUpdate => Cow::Borrowed("timeupdate"),
112 NativeEventName::HashChange => Cow::Borrowed("hashchange"),
113 NativeEventName::Resize => Cow::Borrowed("resize"),
114 NativeEventName::Scroll => Cow::Borrowed("scroll"),
115 NativeEventName::Load => Cow::Borrowed("load"),
116 NativeEventName::Unload => Cow::Borrowed("unload"),
117 NativeEventName::BeforeUnload => Cow::Borrowed("beforeunload"),
118 NativeEventName::Error => Cow::Borrowed("error"),
119 NativeEventName::Online => Cow::Borrowed("online"),
120 NativeEventName::Offline => Cow::Borrowed("offline"),
121 NativeEventName::VisibilityChange => Cow::Borrowed("visibilitychange"),
122 NativeEventName::AnimationStart => Cow::Borrowed("animationstart"),
123 NativeEventName::AnimationEnd => Cow::Borrowed("animationend"),
124 NativeEventName::AnimationIteration => Cow::Borrowed("animationiteration"),
125 NativeEventName::TransitionStart => Cow::Borrowed("transitionstart"),
126 NativeEventName::TransitionEnd => Cow::Borrowed("transitionend"),
127 NativeEventName::TransitionRun => Cow::Borrowed("transitionrun"),
128 NativeEventName::EuvSignalUpdate => Cow::Borrowed("__euv_signal_update__"),
129 NativeEventName::Other(name) => Cow::Owned(name.clone()),
130 }
131 }
132}
133
134impl std::fmt::Display for NativeEventName {
136 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
146 write!(f, "{}", self.as_str())
147 }
148}