/
virtualdom.mli
221 lines (153 loc) · 6.92 KB
/
virtualdom.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
open Virtualdom_types
type 'a directive = 'a t
(** Set an element attribute. *)
val attr : ?namespace:string -> string -> string -> 'a t
(** Set an element class. *)
val className : string -> 'a t
(** Include a component. *)
val component :
('b -> 'c t) ->
(('c -> unit) -> 'c -> 'a) ->
'b -> 'a t
(** Include directive if condition is true. *)
val cond : 'a t -> bool -> 'a t
(** An empty array of directives *)
val empty : 'a t array
(** This function returns a new virtual DOM node. *)
val h :
?namespace:string ->
?onInsert:(Dom.element -> 'a option) ->
?onRemove:(Dom.element -> Dom.element -> unit) ->
string -> 'a t array -> 'a t
(** This function inserts an keyed array of directives. *)
val keyed : (Js.Dict.key * 'a t) array -> 'a t
(** Include directive if condition is true. *)
val maybe : ('c -> 'a t) -> 'c option -> 'a t
(** This function mounts the app on an existing DOM element. *)
val mount :
?namespace:string ->
?onPatch:('a -> unit) ->
Dom.element ->
('a -> 'b t array) ->
('a -> ('b -> unit) -> 'b -> 'a) -> 'a ->
('b -> unit)
(** Bind event listener to the "beforecopy" event. *)
val onBeforeCopy : ('a, Dom.clipboardEvent) listener
(** Bind event listener to the "beforecut" event. *)
val onBeforeCut : ('a, Dom.clipboardEvent) listener
(** Bind event listener to the "beforepaste" event. *)
val onBeforePaste : ('a, Dom.clipboardEvent) listener
(** Bind event listener to the "copy" event. *)
val onCopy : ('a, Dom.clipboardEvent) listener
(** Bind event listener to the "cut" event. *)
val onCut : ('a, Dom.clipboardEvent) listener
(** Bind event listener to the "paste" event. *)
val onPaste : ('a, Dom.clipboardEvent) listener
(** Bind event listener to the "clipboardchange" event. *)
val onClipboardChange : ('a, Dom.clipboardEvent) listener
(** Bind event listener to the "abort" event. *)
val onAbort : ('a, Dom.event) listener
(** Bind event listener to the "beforeinput" event. *)
val onBeforeInput : ('a, Dom.inputEvent) listener
(** Bind event listener to the "beforeunload" event. *)
val onBeforeUnload : ('a, Dom.event) listener
(** Bind event listener to the "blur" event. *)
val onBlur : ('a, Dom.focusEvent) listener
(** Bind event listener to the "change" event. *)
val onChange : ('a, Dom.event) listener
(** Bind event listener to the "click" event. *)
val onClick : ('a, Dom.mouseEvent) listener
(** Bind event listener to the "dblclick" event. *)
val onDblClick : ('a, Dom.mouseEvent) listener
(** Bind event listener to the "dragend" event. *)
val onDragEnd : ('a, Dom.dragEvent) listener
(** Bind event listener to the "dragenter" event. *)
val onDragEnter : ('a, Dom.dragEvent) listener
(** Bind event listener to the "dragexit" event. *)
val onDragExit : ('a, Dom.dragEvent) listener
(** Bind event listener to the "dragleave" event. *)
val onDragLeave : ('a, Dom.dragEvent) listener
(** Bind event listener to the "dragover" event. *)
val onDragOver : ('a, Dom.dragEvent) listener
(** Bind event listener to the "dragstart" event. *)
val onDragStart : ('a, Dom.dragEvent) listener
(** Bind event listener to the "drop" event. *)
val onDrop : ('a, Dom.dragEvent) listener
(** Bind event listener to the "focus" event. *)
val onFocus : ('a, Dom.focusEvent) listener
(** Bind event listener to the "focusin" event. *)
val onFocusIn : ('a, Dom.focusEvent) listener
(** Bind event listener to the "focusout" event. *)
val onFocusOut : ('a, Dom.focusEvent) listener
(** Bind event listener to the "input" event. *)
val onInput : ('a, Dom.inputEvent) listener
(** Bind event listener to the "keydown" event. *)
val onKeyDown : ('a, Dom.keyboardEvent) listener
(** Bind event listener to the "keypress" event. *)
val onKeyPress : ('a, Dom.keyboardEvent) listener
(** Bind event listener to the "keyup" event. *)
val onKeyUp : ('a, Dom.keyboardEvent) listener
(** Bind event listener to the "load" event. *)
val onLoad : ('a, Dom.inputEvent) listener
(** Bind event listener to the "mousedown" event. *)
val onMouseDown : ('a, Dom.mouseEvent) listener
(** Bind event listener to the "mouseenter" event. *)
val onMouseEnter : ('a, Dom.mouseEvent) listener
(** Bind event listener to the "mouseleave" event. *)
val onMouseLeave : ('a, Dom.mouseEvent) listener
(** Bind event listener to the "mousemove" event. *)
val onMouseMove : ('a, Dom.mouseEvent) listener
(** Bind event listener to the "mouseout" event. *)
val onMouseOut : ('a, Dom.mouseEvent) listener
(** Bind event listener to the "mouseup" event. *)
val onMouseUp : ('a, Dom.mouseEvent) listener
(** Bind event listener to the "popstate" event. *)
val onPopState : ('a, Dom.event) listener
(** Bind event listener to the "readystatechange" event. *)
val onReadyStateChange : ('a, Dom.event) listener
(** Bind event listener to the "resize" event. *)
val onResize : ('a, Dom.event) listener
(** Bind event listener to the "scroll" event. *)
val onScroll : ('a, Dom.uiEvent) listener
(** Bind event listener to the "select" event. *)
val onSelect : ('a, Dom.event) listener
(** Bind event listener to the "submit" event. *)
val onSubmit : ('a, Dom.event) listener
(** Bind event listener to the "touchcancel" event. *)
val onTouchCancel : ('a, Dom.touchEvent) listener
(** Bind event listener to the "touchend" event. *)
val onTouchEnd : ('a, Dom.touchEvent) listener
(** Bind event listener to the "touchmove" event. *)
val onTouchMove : ('a, Dom.touchEvent) listener
(** Bind event listener to the "touchstart" event. *)
val onTouchStart : ('a, Dom.touchEvent) listener
(** Bind event listener to the "transitioncancel" event. *)
val onTransitionCancel : ('a, Dom.transitionEvent) listener
(** Bind event listener to the "transitionend" event. *)
val onTransitionEnd : ('a, Dom.transitionEvent) listener
(** Bind event listener to the "transitionrun" event. *)
val onTransitionRun : ('a, Dom.transitionEvent) listener
(** Bind event listener to the "transitionstart" event. *)
val onTransitionStart : ('a, Dom.transitionEvent) listener
(** Bind event listener to the "unhandledrejection" event. *)
val onUnhandledRejection : ('a, Dom.event) listener
(** Bind event listener to the "unload" event. *)
val onUnload : ('a, Dom.event) listener
(** Bind event listener to the "wheel" event. *)
val onWheel : ('a, Dom.wheelEvent) listener
(** Set an element property. *)
val prop : string -> string -> 'a t
(** Include directive when element is to be removed and until transition ends. *)
val removeTransition : ?name:string -> 'a t array -> 'a t
(** Set an element style property. *)
val style : ?important:bool -> string -> string -> 'a t
(** Adds a text node. *)
val text : string -> 'a t
(** The lazy function takes a cache key and a function that returns a
directive, for example a text or virtual node, or a wedge that inserts
multiple directives. *)
val thunk : ('c -> 'a t) -> 'c -> 'a t
(** A wedge inserts an array of directives at the position, useful for
example to add an array of children to a node in addition to other
directives. *)
val wedge : 'a t array -> 'a t