Skip to content
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
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = 0.27.0
version = 0.28.1
16 changes: 8 additions & 8 deletions ppx/reason_react_ppx.ml
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ let jsxExprAndChildren ~component_type ~loc ~ctxt mapper ~keyProps children =
children *)
( Builder.pexp_ident ~loc { loc; txt = Ldot (ident, "jsxs") },
None,
Some (Binding.React.array ~loc children))
Some (Binding.React.array ~loc children) )
| None, (label, key) :: _ ->
( Builder.pexp_ident ~loc { loc; txt = Ldot (ident, "jsxKeyed") },
Some (label, key),
Expand Down Expand Up @@ -527,10 +527,10 @@ let jsxMapper =
in
let propsArg =
(match childrenProp with
| Some childrenProp -> (labelled "children", childrenProp) :: otherProps
| None -> otherProps)
| Some childrenProp -> (labelled "children", childrenProp) :: otherProps
| None -> otherProps)
|> List.map (fun (label, expression) ->
(label, mapper#expression ctxt expression))
(label, mapper#expression ctxt expression))
in
let isCap str =
match String.length str with
Expand Down Expand Up @@ -611,11 +611,11 @@ let jsxMapper =
in
let props =
(match childrenProp with
| Some childrenProp ->
(labelled "children", childrenProp) :: nonChildrenProps
| None -> nonChildrenProps)
| Some childrenProp ->
(labelled "children", childrenProp) :: nonChildrenProps
| None -> nonChildrenProps)
|> List.map (fun (label, expression) ->
(label, mapper#expression ctxt expression))
(label, mapper#expression ctxt expression))
in
let component = (nolabel, componentNameExpr)
and props =
Expand Down
77 changes: 50 additions & 27 deletions src/ReactDOM.re
Original file line number Diff line number Diff line change
Expand Up @@ -484,30 +484,35 @@ module Experimental = {
external preloadOptions:
(
~_as: [
| `audio
| `document
| `embed
| `fetch
| `font
| `image
| [@mel.as "object"] `object_
| `script
| `style
| `track
| `video
| `worker
],
~fetchPriority: [ | `auto | `high | `low]=?,
~referrerPolicy: [
| [@mel.as "no-referrer"] `noReferrer
| [@mel.as "no-referrer-when-downgrade"]
`noReferrerWhenDowngrade
| [@mel.as "origin"] `origin
| [@mel.as "origin-when-cross-origin"]
`originWhenCrossOrigin
| [@mel.as "unsafe-url"] `unsafeUrl
]
=?,
| `audio
| `document
| `embed
| `fetch
| `font
| `image
| [@mel.as "object"] `object_
| `script
| `style
| `track
| `video
| `worker
],
~fetchPriority:
[
| `auto
| `high
| `low
]
=?,
~referrerPolicy:
[
| [@mel.as "no-referrer"] `noReferrer
| [@mel.as "no-referrer-when-downgrade"] `noReferrerWhenDowngrade
| [@mel.as "origin"] `origin
| [@mel.as "origin-when-cross-origin"] `originWhenCrossOrigin
| [@mel.as "unsafe-url"] `unsafeUrl
]
=?,
~imageSrcSet: string=?,
~imageSizes: string=?,
~crossOrigin: string=?,
Expand All @@ -520,11 +525,29 @@ module Experimental = {
[@deriving jsProperties]
type preinitOptions = {
[@mel.as "as"]
_as: [ | `script | `style],
_as: [
| `script
| `style
],
[@mel.optional]
fetchPriority: option([ | `auto | `high | `low]),
fetchPriority:
option(
[
| `auto
| `high
| `low
],
),
[@mel.optional]
precedence: option([ | `reset | `low | `medium | `high]),
precedence:
option(
[
| `reset
| `low
| `medium
| `high
],
),
[@mel.optional]
crossOrigin: option(string),
[@mel.optional]
Expand Down
79 changes: 51 additions & 28 deletions src/ReactDOM.rei
Original file line number Diff line number Diff line change
Expand Up @@ -490,42 +490,47 @@ module Experimental: {
type preloadOptions;

[@mel.obj]
/* Its possible values are audio, document, embed, fetch, font, image, object, script, style, track, video, worker. */
external preloadOptions:
/* Its possible values are audio, document, embed, fetch, font, image, object, script, style, track, video, worker. */
(
~_as: [
| `audio
| `document
| `embed
| `fetch
| `font
| `image
| [@mel.as "object"] `object_
| `script
| `style
| `track
| `video
| `worker
],
| `audio
| `document
| `embed
| `fetch
| `font
| `image
| [@mel.as "object"] `object_
| `script
| `style
| `track
| `video
| `worker
],
/*
Suggests a relative priority for fetching the resource.
The possible values are auto (the default), high, and low.
*/
~fetchPriority: [ | `auto | `high | `low]=?,
~fetchPriority:
[
| `auto
| `high
| `low
]
=?,
/*
The Referrer header to send when fetching.
Its possible values are no-referrer-when-downgrade (the default), no-referrer, origin, origin-when-cross-origin, and unsafe-url.
*/
~referrerPolicy: [
| [@mel.as "no-referrer"] `noReferrer
| [@mel.as "no-referrer-when-downgrade"]
`noReferrerWhenDowngrade
| [@mel.as "origin"] `origin
| [@mel.as "origin-when-cross-origin"]
`originWhenCrossOrigin
| [@mel.as "unsafe-url"] `unsafeUrl
]
=?,
~referrerPolicy:
[
| [@mel.as "no-referrer"] `noReferrer
| [@mel.as "no-referrer-when-downgrade"] `noReferrerWhenDowngrade
| [@mel.as "origin"] `origin
| [@mel.as "origin-when-cross-origin"] `originWhenCrossOrigin
| [@mel.as "unsafe-url"] `unsafeUrl
]
=?,
/*
For use only with as: "image". Specifies the source set of the image.
https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images
Expand Down Expand Up @@ -563,20 +568,38 @@ module Experimental: {
type preinitOptions = {
/* possible values: "script" or "style" */
[@mel.as "as"]
_as: [ | `script | `style],
_as: [
| `script
| `style
],
/*
Suggests a relative priority for fetching the resource.
The possible values are auto (the default), high, and low.
*/
[@mel.optional]
fetchPriority: option([ | `auto | `high | `low]),
fetchPriority:
option(
[
| `auto
| `high
| `low
],
),
/*
Required with Stylesheets (`style). Says where to insert the stylesheet relative to others.
Stylesheets with higher precedence can override those with lower precedence.
The possible values are reset, low, medium, high.
*/
[@mel.optional]
precedence: option([ | `reset | `low | `medium | `high]),
precedence:
option(
[
| `reset
| `low
| `medium
| `high
],
),
/*
a required string. It must be "anonymous", "use-credentials", and "".
https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin
Expand Down
Loading