summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2015-07-02 12:42:49 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2015-07-02 12:42:49 -0400
commitafc300a29b7e4cd868858ef5bcf9d0f9829f4b8a (patch)
tree84c32b122c45030cf86bff3b738bc742870b36eb /lib
parent9bc8214356403845bb44535127c46e6378fa1ba6 (diff)
Allow mouse and key events for <body>
Diffstat (limited to 'lib')
-rw-r--r--lib/ur/basis.urs33
1 files changed, 18 insertions, 15 deletions
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index 56c8d767..2defec9e 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -811,21 +811,6 @@ val head : unit -> tag [Data = data_attr] html head [] []
val title : unit -> tag [Data = data_attr] head [] [] []
val link : unit -> tag [Data = data_attr, Id = id, Rel = string, Typ = string, Href = url, Media = string] head [] [] []
-val body : unit -> tag [Data = data_attr, Onload = transaction unit, Onresize = transaction unit, Onunload = transaction unit, Onhashchange = transaction unit]
- html body [] []
-con bodyTag = fn (attrs :: {Type}) =>
- ctx ::: {Unit} ->
- [[Body] ~ ctx] =>
- unit -> tag attrs ([Body] ++ ctx) ([Body] ++ ctx) [] []
-con bodyTagStandalone = fn (attrs :: {Type}) =>
- ctx ::: {Unit}
- -> [[Body] ~ ctx] =>
- unit -> tag attrs ([Body] ++ ctx) [] [] []
-
-val br : bodyTagStandalone [Data = data_attr, Id = id]
-
-con focusEvents = [Onblur = transaction unit, Onfocus = transaction unit]
-
datatype mouseButton = Left | Right | Middle
type mouseEvent = { ScreenX : int, ScreenY : int, ClientX : int, ClientY : int,
@@ -841,6 +826,24 @@ type keyEvent = { KeyCode : int,
con keyEvents = map (fn _ :: Unit => keyEvent -> transaction unit)
[Onkeydown, Onkeypress, Onkeyup]
+val body : unit -> tag ([Data = data_attr, Onload = transaction unit, Onresize = transaction unit, Onunload = transaction unit, Onhashchange = transaction unit]
+ ++ mouseEvents ++ keyEvents)
+ html body [] []
+
+con bodyTag = fn (attrs :: {Type}) =>
+ ctx ::: {Unit} ->
+ [[Body] ~ ctx] =>
+ unit -> tag attrs ([Body] ++ ctx) ([Body] ++ ctx) [] []
+con bodyTagStandalone = fn (attrs :: {Type}) =>
+ ctx ::: {Unit}
+ -> [[Body] ~ ctx] =>
+ unit -> tag attrs ([Body] ++ ctx) [] [] []
+
+val br : bodyTagStandalone [Data = data_attr, Id = id]
+
+con focusEvents = [Onblur = transaction unit, Onfocus = transaction unit]
+
+
(* Key arguments are character codes. *)
con resizeEvents = [Onresize = transaction unit]
con scrollEvents = [Onscroll = transaction unit]