Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add detailsElement and toggleEvent objects. #1728

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* Runtime: allow dynlink of precompiled js with separate compilation (#1676)
* Runtime: reimplement the runtime of weak and ephemeron (#1707)
* Lib: Modify Typed_array API for compatibility with WebAssembly
* Lib: add details element and toggle event (#1728)
* Toplevel: no longer set globals for toplevel initialization

## Bug fixes
Expand Down
22 changes: 22 additions & 0 deletions lib/js_of_ocaml/dom_html.ml
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,14 @@ and clipboardEvent = object
method clipboardData : dataTransfer t readonly_prop
end

and toggleEvent = object
inherit event

method newState : js_string t readonly_prop

method oldState : js_string t readonly_prop
end

and dataTransfer = object
method dropEffect : js_string t prop

Expand Down Expand Up @@ -959,6 +967,8 @@ module Event = struct

let waiting = Dom.Event.make "waiting"

let toggle = Dom.Event.make "toggle"

let make = Dom.Event.make
end

Expand Down Expand Up @@ -1372,6 +1382,16 @@ class type anchorElement = object
method _type : js_string t prop
end

class type detailsElement = object ('self)
inherit element

method open_ : bool t prop

method name : js_string t prop

method ontoggle : ('self t, toggleEvent t) event_listener prop
end

class type imageElement = object ('self)
inherit element

Expand Down Expand Up @@ -2736,6 +2756,8 @@ module CoerceTo = struct

let del e = unsafeCoerce "del" e

let details e = unsafeCoerce "details" e

let div e = unsafeCoerce "div" e

let dl e = unsafeCoerce "dl" e
Expand Down
22 changes: 22 additions & 0 deletions lib/js_of_ocaml/dom_html.mli
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,14 @@ and clipboardEvent = object
method clipboardData : dataTransfer t readonly_prop
end

and toggleEvent = object
inherit event

method newState : js_string t readonly_prop

method oldState : js_string t readonly_prop
end

and dataTransfer = object
method dropEffect : js_string t prop

Expand Down Expand Up @@ -1190,6 +1198,16 @@ class type anchorElement = object
method _type : js_string t prop
end

class type detailsElement = object ('self)
inherit element

method open_ : bool t prop

method name : js_string t prop

method ontoggle : ('self t, toggleEvent t) event_listener prop
end

class type imageElement = object ('self)
inherit element

Expand Down Expand Up @@ -2503,6 +2521,8 @@ module Event : sig

val waiting : mediaEvent t typ

val toggle : toggleEvent t typ

val make : string -> 'a typ
end

Expand Down Expand Up @@ -3048,6 +3068,8 @@ module CoerceTo : sig

val del : #element t -> modElement t opt

val details : #element t -> detailsElement t opt

val div : #element t -> divElement t opt

val embed : #element t -> embedElement t opt
Expand Down
6 changes: 4 additions & 2 deletions lib/tyxml/tyxml_cast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ end) : Tyxml_cast_sigs.TO with type 'a elt = 'a C.elt = struct

let of_li elt = rebuild_node "of_li" elt

let of_details elt = rebuild_node "of_details" elt

let of_dialog elt = rebuild_node "of_dialog" elt

let of_div elt = rebuild_node "of_div" elt
Expand Down Expand Up @@ -177,8 +179,6 @@ end) : Tyxml_cast_sigs.TO with type 'a elt = 'a C.elt = struct

let of_dd elt = rebuild_node "of_dd" elt

let of_details elt = rebuild_node "of_details" elt

let of_dfn elt = rebuild_node "of_dfn" elt

let of_dt elt = rebuild_node "of_dt" elt
Expand Down Expand Up @@ -311,6 +311,8 @@ end) : Tyxml_cast_sigs.OF with type 'a elt = 'a C.elt = struct

let of_li elt = rebuild_node "of_li" elt

let of_details elt = rebuild_node "of_details" elt

let of_dialog elt = rebuild_node "of_dialog" elt

let of_div elt = rebuild_node "of_div" elt
Expand Down
6 changes: 4 additions & 2 deletions lib/tyxml/tyxml_cast_sigs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ module type OF = sig

val of_li : Dom_html.liElement Js.t -> [> Html_types.li ] elt

val of_details : Dom_html.detailsElement Js.t -> [> Html_types.details ] elt

val of_dialog : Dom_html.dialogElement Js.t -> [> Html_types.dialog ] elt

val of_div : Dom_html.divElement Js.t -> [> Html_types.div ] elt
Expand Down Expand Up @@ -182,6 +184,8 @@ module type TO = sig

val of_li : [< Html_types.li ] elt -> Dom_html.liElement Js.t

val of_details : [< Html_types.details ] elt -> Dom_html.detailsElement Js.t

val of_dialog : [< Html_types.dialog ] elt -> Dom_html.dialogElement Js.t

val of_div : [< Html_types.div ] elt -> Dom_html.divElement Js.t
Expand Down Expand Up @@ -280,8 +284,6 @@ module type TO = sig

val of_dd : [> Html_types.dd ] elt -> Dom_html.element Js.t

val of_details : [> Html_types.details ] elt -> Dom_html.element Js.t

val of_dfn : [> Html_types.dfn ] elt -> Dom_html.element Js.t

val of_dt : [> Html_types.dt ] elt -> Dom_html.element Js.t
Expand Down
6 changes: 4 additions & 2 deletions lib/tyxml/tyxml_cast_sigs.mli
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ module type OF = sig

val of_li : Dom_html.liElement Js.t -> [> Html_types.li ] elt

val of_details : Dom_html.detailsElement Js.t -> [> Html_types.details ] elt

val of_dialog : Dom_html.dialogElement Js.t -> [> Html_types.dialog ] elt

val of_div : Dom_html.divElement Js.t -> [> Html_types.div ] elt
Expand Down Expand Up @@ -181,6 +183,8 @@ module type TO = sig

val of_li : [< Html_types.li ] elt -> Dom_html.liElement Js.t

val of_details : [< Html_types.details ] elt -> Dom_html.detailsElement Js.t

val of_dialog : [< Html_types.dialog ] elt -> Dom_html.dialogElement Js.t

val of_div : [< Html_types.div ] elt -> Dom_html.divElement Js.t
Expand Down Expand Up @@ -279,8 +283,6 @@ module type TO = sig

val of_dd : [> Html_types.dd ] elt -> Dom_html.element Js.t

val of_details : [> Html_types.details ] elt -> Dom_html.element Js.t

val of_dfn : [> Html_types.dfn ] elt -> Dom_html.element Js.t

val of_dt : [> Html_types.dt ] elt -> Dom_html.element Js.t
Expand Down