Source file aria.ml

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
(** WAI-ARIA states and properties. *)

type t =
  | Active_descendant
  | Atomic
  | Autocomplete
  | Braillelabel
  | Brailleroledescription
  | Busy
  | Checked
  | Colcount
  | Colindex
  | Colindextext
  | Colspan
  | Controls
  | Current
  | Describedby
  | Description
  | Details
  | Disabled
  | Dropeffect
  | Errormessage
  | Expanded
  | Flowto
  | Grabbed
  | Haspopup
  | Hidden
  | Invalid
  | Keyshortcuts
  | Label
  | Labelledby
  | Level
  | Live
  | Modal
  | Multiline
  | Multiselectable
  | Orientation
  | Owns
  | Placeholder
  | Posinset
  | Pressed
  | Readonly
  | Relevant
  | Required
  | Roledescription
  | Rowcount
  | Rowindex
  | Rowindextext
  | Rowspan
  | Selected
  | Setsize
  | Sort
  | Valuemax
  | Valuemin
  | Valuenow
  | Valuetext

let suffix = function
  | Active_descendant -> "activedescendant"
  | Atomic -> "atomic"
  | Autocomplete -> "autocomplete"
  | Braillelabel -> "braillelabel"
  | Brailleroledescription -> "brailleroledescription"
  | Busy -> "busy"
  | Checked -> "checked"
  | Colcount -> "colcount"
  | Colindex -> "colindex"
  | Colindextext -> "colindextext"
  | Colspan -> "colspan"
  | Controls -> "controls"
  | Current -> "current"
  | Describedby -> "describedby"
  | Description -> "description"
  | Details -> "details"
  | Disabled -> "disabled"
  | Dropeffect -> "dropeffect"
  | Errormessage -> "errormessage"
  | Expanded -> "expanded"
  | Flowto -> "flowto"
  | Grabbed -> "grabbed"
  | Haspopup -> "haspopup"
  | Hidden -> "hidden"
  | Invalid -> "invalid"
  | Keyshortcuts -> "keyshortcuts"
  | Label -> "label"
  | Labelledby -> "labelledby"
  | Level -> "level"
  | Live -> "live"
  | Modal -> "modal"
  | Multiline -> "multiline"
  | Multiselectable -> "multiselectable"
  | Orientation -> "orientation"
  | Owns -> "owns"
  | Placeholder -> "placeholder"
  | Posinset -> "posinset"
  | Pressed -> "pressed"
  | Readonly -> "readonly"
  | Relevant -> "relevant"
  | Required -> "required"
  | Roledescription -> "roledescription"
  | Rowcount -> "rowcount"
  | Rowindex -> "rowindex"
  | Rowindextext -> "rowindextext"
  | Rowspan -> "rowspan"
  | Selected -> "selected"
  | Setsize -> "setsize"
  | Sort -> "sort"
  | Valuemax -> "valuemax"
  | Valuemin -> "valuemin"
  | Valuenow -> "valuenow"
  | Valuetext -> "valuetext"

let pp ctx attr =
  Pp.string ctx "aria-";
  Pp.string ctx (suffix attr)

let to_string attr = Pp.to_string pp attr

let of_string = function
  | "aria-activedescendant" -> Active_descendant
  | "aria-atomic" -> Atomic
  | "aria-autocomplete" -> Autocomplete
  | "aria-braillelabel" -> Braillelabel
  | "aria-brailleroledescription" -> Brailleroledescription
  | "aria-busy" -> Busy
  | "aria-checked" -> Checked
  | "aria-colcount" -> Colcount
  | "aria-colindex" -> Colindex
  | "aria-colindextext" -> Colindextext
  | "aria-colspan" -> Colspan
  | "aria-controls" -> Controls
  | "aria-current" -> Current
  | "aria-describedby" -> Describedby
  | "aria-description" -> Description
  | "aria-details" -> Details
  | "aria-disabled" -> Disabled
  | "aria-dropeffect" -> Dropeffect
  | "aria-errormessage" -> Errormessage
  | "aria-expanded" -> Expanded
  | "aria-flowto" -> Flowto
  | "aria-grabbed" -> Grabbed
  | "aria-haspopup" -> Haspopup
  | "aria-hidden" -> Hidden
  | "aria-invalid" -> Invalid
  | "aria-keyshortcuts" -> Keyshortcuts
  | "aria-label" -> Label
  | "aria-labelledby" -> Labelledby
  | "aria-level" -> Level
  | "aria-live" -> Live
  | "aria-modal" -> Modal
  | "aria-multiline" -> Multiline
  | "aria-multiselectable" -> Multiselectable
  | "aria-orientation" -> Orientation
  | "aria-owns" -> Owns
  | "aria-placeholder" -> Placeholder
  | "aria-posinset" -> Posinset
  | "aria-pressed" -> Pressed
  | "aria-readonly" -> Readonly
  | "aria-relevant" -> Relevant
  | "aria-required" -> Required
  | "aria-roledescription" -> Roledescription
  | "aria-rowcount" -> Rowcount
  | "aria-rowindex" -> Rowindex
  | "aria-rowindextext" -> Rowindextext
  | "aria-rowspan" -> Rowspan
  | "aria-selected" -> Selected
  | "aria-setsize" -> Setsize
  | "aria-sort" -> Sort
  | "aria-valuemax" -> Valuemax
  | "aria-valuemin" -> Valuemin
  | "aria-valuenow" -> Valuenow
  | "aria-valuetext" -> Valuetext
  | name -> invalid_arg ("not a supported aria attribute: " ^ name)