Skip to content

Improve ReadDOM properties using polyvariants #12

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

Closed
wants to merge 1 commit into from
Closed
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
114 changes: 70 additions & 44 deletions src/ReactDOM.res
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,29 @@ module Props = {
/* accessibility */
/* https://www.w3.org/TR/wai-aria-1.1/ */
/* https://accessibilityresources.org/<aria-tag> is a great resource for these */
/* [@optional] [@as "aria-current"] ariaCurrent: page|step|location|date|time|true|false, */
@optional @as("aria-current")
ariaCurrent: [#page | #step | #location | #date | #time | #\"true" | #\"false"],
@optional @as("aria-details")
ariaDetails: string,
@optional @as("aria-disabled")
ariaDisabled: bool,
@optional @as("aria-hidden")
ariaHidden: bool,
/* [@optional] [@as "aria-invalid"] ariaInvalid: grammar|false|spelling|true, */
@optional @as("aria-invalid") ariaInvalid: [#grammar | #\"false" | #spelling | #\"true"],
@optional @as("aria-keyshortcuts")
ariaKeyshortcuts: string,
@optional @as("aria-label")
ariaLabel: string,
@optional @as("aria-roledescription")
ariaRoledescription: string,
/* Widget Attributes */
/* [@optional] [@as "aria-autocomplete"] ariaAutocomplete: inline|list|both|none, */
/* [@optional] [@as "aria-checked"] ariaChecked: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */
@optional @as("aria-autocomplete") ariaAutocomplete: [#inline | #list | #both | #none],
@optional @as("aria-checked")
ariaChecked: [#\"true" | #\"false" | #mixed],
@optional @as("aria-expanded")
ariaExpanded: bool,
/* [@optional] [@as "aria-haspopup"] ariaHaspopup: false|true|menu|listbox|tree|grid|dialog, */
ariaExpanded: [#\"true\" | #\"false" | #undefined],
@optional @as("aria-haspopup")
ariaHaspopup: [#\"false" | #\"true" | #menu | #listbox | #tree | #grid | #dialog],
@optional @as("aria-level")
ariaLevel: int,
@optional @as("aria-modal")
Expand All @@ -91,10 +94,11 @@ module Props = {
ariaMultiline: bool,
@optional @as("aria-multiselectable")
ariaMultiselectable: bool,
/* [@optional] [@as "aria-orientation"] ariaOrientation: horizontal|vertical|undefined, */
@optional @as("aria-orientation") ariaOrientation: [#horizontal | #vertical | #undefined],
@optional @as("aria-placeholder")
ariaPlaceholder: string,
/* [@optional] [@as "aria-pressed"] ariaPressed: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */
@optional @as("aria-pressed")
ariaPressed: [#\"true" | #\"false" | #mixed | #undefined],
@optional @as("aria-readonly")
ariaReadonly: bool,
@optional @as("aria-required")
Expand All @@ -116,11 +120,12 @@ module Props = {
ariaAtomic: bool,
@optional @as("aria-busy")
ariaBusy: bool,
/* [@optional] [@as "aria-live"] ariaLive: off|polite|assertive|rude, */
@optional @as("aria-live") ariaLive: [#off | #polite | #assertive | #rude],
@optional @as("aria-relevant")
ariaRelevant: string,
/* Drag-and-Drop Attributes */
/* [@optional] [@as "aria-dropeffect"] ariaDropeffect: copy|move|link|execute|popup|none, */
@optional @as("aria-dropeffect")
ariaDropeffect: [#copy | #move | #link | #execute | #popup | #none],
@optional @as("aria-grabbed")
ariaGrabbed: bool,
/* Relationship Attributes */
Expand Down Expand Up @@ -169,7 +174,7 @@ module Props = {
@optional
contextMenu: string,
@optional
dir: string /* "ltr", "rtl" or "auto" */,
dir: [#ltr | #rtl | #auto],
@optional
draggable: bool,
@optional
Expand Down Expand Up @@ -229,7 +234,7 @@ module Props = {
@optional
cite: string /* uri */,
@optional
crossOrigin: string /* anonymous, use-credentials */,
crossOrigin: [#anonymous | #\"use-credentials"],
@optional
cols: int,
@optional
Expand All @@ -253,15 +258,15 @@ module Props = {
@optional
download: string /* should really be either a boolean, signifying presence, or a string */,
@optional
encType: string /* "application/x-www-form-urlencoded", "multipart/form-data" or "text/plain" */,
encType: [#\"application/x-www-form-urlencoded" | #\"multipart/form-data" | #\"text/plain"],
@optional
form: string,
@optional
formAction: string /* uri */,
@optional
formTarget: string /* "_blank", "_self", etc. */,
@optional
formMethod: string /* "post", "get", "put" */,
formMethod: [#get | #post | #dialog],
@optional
headers: string,
@optional
Expand All @@ -275,17 +280,25 @@ module Props = {
@optional
htmlFor: string /* substitute for "for" */,
@optional
httpEquiv: string /* has a fixed set of possible values */,
httpEquiv: [
| #\"content-language"
| #\"content-type"
| #\"default-style"
| #refresh
| #\"set-cookie"
| #\"x-ua-compatible"
| #\"content-security-policy"
],
@optional
icon: string /* uri? */,
@optional
inputMode: string /* "verbatim", "latin", "numeric", etc. */,
inputMode: [#none | #text | #tel | #url | #email | #numeric | #decimal | #search],
@optional
integrity: string,
@optional
keyType: string,
@optional
kind: string /* has a fixed set of possible values */,
kind: [#subtitles | #captions | #descriptions | #chapters | #metadata],
@optional
label: string,
@optional
Expand All @@ -305,7 +318,7 @@ module Props = {
@optional
mediaGroup: string,
@optional
method: string /* "post" or "get" */,
method: [#get | #post | #dialog],
@optional
min: string,
@optional
Expand Down Expand Up @@ -333,7 +346,7 @@ module Props = {
@optional
poster: string /* uri */,
@optional
preload: string /* "none", "metadata" or "auto" (and "" as a synonym for "auto") */,
preload: [#none | #metadata | #auto],
@optional
radioGroup: string,
@optional
Expand All @@ -351,11 +364,11 @@ module Props = {
@optional
sandbox: string /* has a fixed set of possible values */,
@optional
scope: string /* has a fixed set of possible values */,
scope: [#row | #col | #rowgroup | #colgroup],
@optional
scoped: bool,
@optional
scrolling: string /* html4 only, "auto", "yes" or "no" */,
scrolling: [#auto | #yes | #no] /* html4 only */,
/* seamless - supported by React, but removed from the html5 spec */
@optional
selected: bool,
Expand Down Expand Up @@ -392,7 +405,7 @@ module Props = {
@optional
width: string /* in html5 this can only be a number, but in html4 it can ba a percentage as well */,
@optional
wrap: string /* "hard" or "soft" */,
wrap: [#hard | #soft],
/* Clipboard events */
@optional
onCopy: ReactEvent.Clipboard.t => unit,
Expand Down Expand Up @@ -1088,26 +1101,29 @@ module Props = {
/* accessibility */
/* https://www.w3.org/TR/wai-aria-1.1/ */
/* https://accessibilityresources.org/<aria-tag> is a great resource for these */
/* [@optional] [@as "aria-current"] ariaCurrent: page|step|location|date|time|true|false, */
@optional @as("aria-current")
ariaCurrent: [#page | #step | #location | #date | #time | #\"true" | #\"false"],
@optional @as("aria-details")
ariaDetails: string,
@optional @as("aria-disabled")
ariaDisabled: bool,
@optional @as("aria-hidden")
ariaHidden: bool,
/* [@optional] [@as "aria-invalid"] ariaInvalid: grammar|false|spelling|true, */
@optional @as("aria-invalid") ariaInvalid: [#grammar | #\"false" | #spelling | #\"true"],
@optional @as("aria-keyshortcuts")
ariaKeyshortcuts: string,
@optional @as("aria-label")
ariaLabel: string,
@optional @as("aria-roledescription")
ariaRoledescription: string,
/* Widget Attributes */
/* [@optional] [@as "aria-autocomplete"] ariaAutocomplete: inline|list|both|none, */
/* [@optional] [@as "aria-checked"] ariaChecked: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */
@optional @as("aria-autocomplete") ariaAutocomplete: [#inline | #list | #both | #none],
@optional @as("aria-checked")
ariaChecked: [#\"true" | #\"false" | #mixed],
@optional @as("aria-expanded")
ariaExpanded: bool,
/* [@optional] [@as "aria-haspopup"] ariaHaspopup: false|true|menu|listbox|tree|grid|dialog, */
ariaExpanded: [#\"true\" | #\"false" | #undefined],
@optional @as("aria-haspopup")
ariaHaspopup: [#\"false" | #\"true" | #menu | #listbox | #tree | #grid | #dialog],
@optional @as("aria-level")
ariaLevel: int,
@optional @as("aria-modal")
Expand All @@ -1116,10 +1132,11 @@ module Props = {
ariaMultiline: bool,
@optional @as("aria-multiselectable")
ariaMultiselectable: bool,
/* [@optional] [@as "aria-orientation"] ariaOrientation: horizontal|vertical|undefined, */
@optional @as("aria-orientation") ariaOrientation: [#horizontal | #vertical | #undefined],
@optional @as("aria-placeholder")
ariaPlaceholder: string,
/* [@optional] [@as "aria-pressed"] ariaPressed: true|false|mixed, /* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */ */
@optional @as("aria-pressed")
ariaPressed: [#\"true" | #\"false" | #mixed | #undefined],
@optional @as("aria-readonly")
ariaReadonly: bool,
@optional @as("aria-required")
Expand All @@ -1141,11 +1158,12 @@ module Props = {
ariaAtomic: bool,
@optional @as("aria-busy")
ariaBusy: bool,
/* [@optional] [@as "aria-live"] ariaLive: off|polite|assertive|rude, */
@optional @as("aria-live") ariaLive: [#off | #polite | #assertive | #rude],
@optional @as("aria-relevant")
ariaRelevant: string,
/* Drag-and-Drop Attributes */
/* [@optional] [@as "aria-dropeffect"] ariaDropeffect: copy|move|link|execute|popup|none, */
@optional @as("aria-dropeffect")
ariaDropeffect: [#copy | #move | #link | #execute | #popup | #none],
@optional @as("aria-grabbed")
ariaGrabbed: bool,
/* Relationship Attributes */
Expand Down Expand Up @@ -1194,7 +1212,7 @@ module Props = {
@optional
contextMenu: string,
@optional
dir: string /* "ltr", "rtl" or "auto" */,
dir: [#ltr | #rtl | #auto],
@optional
draggable: bool,
@optional
Expand Down Expand Up @@ -1254,7 +1272,7 @@ module Props = {
@optional
cite: string /* uri */,
@optional
crossorigin: bool,
crossorigin: [#anonymous | #\"use-credentials"],
@optional
cols: int,
@optional
Expand All @@ -1278,15 +1296,15 @@ module Props = {
@optional
download: string /* should really be either a boolean, signifying presence, or a string */,
@optional
encType: string /* "application/x-www-form-urlencoded", "multipart/form-data" or "text/plain" */,
encType: [#\"application/x-www-form-urlencoded" | #\"multipart/form-data" | #\"text/plain"],
@optional
form: string,
@optional
formAction: string /* uri */,
@optional
formTarget: string /* "_blank", "_self", etc. */,
@optional
formMethod: string /* "post", "get", "put" */,
formMethod: [#get | #post | #dialog],
@optional
headers: string,
@optional
Expand All @@ -1300,17 +1318,25 @@ module Props = {
@optional
htmlFor: string /* substitute for "for" */,
@optional
httpEquiv: string /* has a fixed set of possible values */,
httpEquiv: [
| #\"content-language"
| #\"content-type"
| #\"default-style"
| #refresh
| #\"set-cookie"
| #\"x-ua-compatible"
| #\"content-security-policy"
],
@optional
icon: string /* uri? */,
@optional
inputMode: string /* "verbatim", "latin", "numeric", etc. */,
inputMode: [#none | #text | #tel | #url | #email | #numeric | #decimal | #search],
@optional
integrity: string,
@optional
keyType: string,
@optional
kind: string /* has a fixed set of possible values */,
kind: [#subtitles | #captions | #descriptions | #chapters | #metadata],
@optional
label: string,
@optional
Expand All @@ -1330,7 +1356,7 @@ module Props = {
@optional
mediaGroup: string,
@optional
method: string /* "post" or "get" */,
method: [#get | #post | #dialog],
@optional
min: string,
@optional
Expand All @@ -1356,7 +1382,7 @@ module Props = {
@optional
poster: string /* uri */,
@optional
preload: string /* "none", "metadata" or "auto" (and "" as a synonym for "auto") */,
preload: [#none | #metadata | #auto],
@optional
radioGroup: string,
@optional
Expand All @@ -1374,11 +1400,11 @@ module Props = {
@optional
sandbox: string /* has a fixed set of possible values */,
@optional
scope: string /* has a fixed set of possible values */,
scope: [#row | #col | #rowgroup | #colgroup],
@optional
scoped: bool,
@optional
scrolling: string /* html4 only, "auto", "yes" or "no" */,
scrolling: [#auto | #yes | #no] /* html4 only */,
/* seamless - supported by React, but removed from the html5 spec */
@optional
selected: bool,
Expand Down Expand Up @@ -1415,7 +1441,7 @@ module Props = {
@optional
width: string /* in html5 this can only be a number, but in html4 it can ba a percentage as well */,
@optional
wrap: string /* "hard" or "soft" */,
wrap: [#hard | #soft],
/* Clipboard events */
@optional
onCopy: ReactEvent.Clipboard.t => unit,
Expand Down