Skip to content

Commit

Permalink
Update formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
davesnx committed Nov 13, 2024
1 parent 6000935 commit 4474483
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 37 deletions.
12 changes: 10 additions & 2 deletions demo/universal/native/lib/Align.re
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
type verticalAlign = [ | `top | `center | `bottom];
type horizontalAlign = [ | `left | `center | `right];
type verticalAlign = [
| `top
| `center
| `bottom
];
type horizontalAlign = [
| `left
| `center
| `right
];

[@react.component]
let make = (~h: horizontalAlign=`center, ~v: verticalAlign=`center, ~children) => {
Expand Down
5 changes: 4 additions & 1 deletion demo/universal/native/lib/App.re
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ module Title = {
label: "Issues",
link: "https://github.com/ml-in-barcelona/server-reason-react/issues",
},
{label: "About", link: "https://twitter.com/davesnx"},
{
label: "About",
link: "https://twitter.com/davesnx",
},
|];

<div
Expand Down
14 changes: 6 additions & 8 deletions demo/universal/native/lib/MelRaw.re
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
let%browser_only mockInitWebsocket = () => [%mel.raw
{|
let%browser_only mockInitWebsocket = () =>
{%mel.raw |
function mockInitWebsocket() {
console.log("Load JS");
}
|}
];
|};

let%browser_only initWebsocket = () => [%mel.raw
{|
let%browser_only initWebsocket = () =>
{%mel.raw |
function initWebsocket() {
var socketUrl = "ws://" + location.host + "/_livereload";
var s = new WebSocket(socketUrl);
Expand Down Expand Up @@ -40,7 +39,6 @@ let%browser_only initWebsocket = () => [%mel.raw
console.debug("Live reload: WebSocket error:", event);
};
}
|}
];
|};

let x = 22;
15 changes: 13 additions & 2 deletions demo/universal/native/lib/Theme.re
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
type align = [ | `start | `center | `end_];
type justify = [ | `around | `between | `evenly | `start | `center | `end_];
type align = [
| `start
| `center
| `end_
];
type justify = [
| `around
| `between
| `evenly
| `start
| `center
| `end_
];

module Media = {
let onDesktop = rules => {
Expand Down
6 changes: 2 additions & 4 deletions packages/promise/js/promise.re
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ let onUnhandledException =
Js.Console.error(exn);
});

[%%mel.raw
{|
{%%mel.raw |
function PromiseBox(p) {
this.nested = p;
};
Expand Down Expand Up @@ -72,8 +71,7 @@ function catch_(promise, callback) {

return promise.catch(safeCallback);
};
|}
];
|};

module Js_ = {
type t('a, 'e) = rejectable('a, 'e);
Expand Down
26 changes: 22 additions & 4 deletions packages/promise/native/promise.re
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ module MutableList: MutableList = {
mutable last: node('a),
};

type list('a) = ref([ | `Empty | `NonEmpty(listEnds('a))]);
type list('a) =
ref(
[
| `Empty
| `NonEmpty(listEnds('a))
],
);

let create = () => ref(`Empty);

Expand All @@ -48,12 +54,24 @@ module MutableList: MutableList = {
let append = (list, value) =>
switch (list^) {
| `Empty =>
let node = {previous: None, next: None, content: value};
list := `NonEmpty({first: node, last: node});
let node = {
previous: None,
next: None,
content: value,
};
list :=
`NonEmpty({
first: node,
last: node,
});
node;

| `NonEmpty(ends) =>
let node = {previous: Some(ends.last), next: None, content: value};
let node = {
previous: Some(ends.last),
next: None,
content: value,
};
ends.last.next = Some(node);
ends.last = node;
node;
Expand Down
8 changes: 7 additions & 1 deletion packages/webapi/tests/Dom/Webapi__Dom__Element__test.re
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ let _ = scrollIntoView(el);
/*let _ = scrollIntoViewNoAlignToTop(el);*/
let _ = scrollIntoViewNoAlignToTop(el);
let _ =
scrollIntoViewWithOptions({"block": "end", "behavior": "smooth"}, el);
scrollIntoViewWithOptions(
{
"block": "end",
"behavior": "smooth",
},
el,
);
let _ = setAttribute("href", "http://...", el);
let _ = setAttributeNS("http://...", "foo", "bar", el);
let _ = setPointerCapture(PointerEvent.pointerId(event), el);
24 changes: 17 additions & 7 deletions packages/webapi/tests/Dom/Webapi__Dom__EventTarget__test.re
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,35 @@ addEventListener("click", handleClick, target);
addEventListenerWithOptions(
"click",
handleClick,
{"passive": true, "once": true, "capture": false},
{
"passive": true,
"once": true,
"capture": false,
},
target,
);
addEventListenerUseCapture("click", handleClick, target);
removeEventListener("click", handleClick, target);
removeEventListenerWithOptions(
"click",
handleClick,
{"passive": true, "capture": false},
{
"passive": true,
"capture": false,
},
target,
);
removeEventListenerUseCapture("click", handleClick, target);
let _ = dispatchEvent(event, target);

/* https://github.com/reasonml-community/bs-webapi-incubator/issues/103 */
let customEvent =
CustomEvent.makeWithOptions("custom-event", {
"detail": {
"test": "test",
},
});
CustomEvent.makeWithOptions(
"custom-event",
{
"detail": {
"test": "test",
},
},
);
dispatchEvent(customEvent, target);
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ let elm = document |> Document.createElement("strong");

Element.addSelectionChangeEventListenerWithOptions(
handleSelection,
{"passive": true, "once": true, "capture": false},
{
"passive": true,
"once": true,
"capture": false,
},
elm,
);
Element.addSelectionChangeEventListenerUseCapture(handleSelection, elm);
Element.removeSelectionChangeEventListener(handleSelection, elm);
Element.removeSelectionChangeEventListenerWithOptions(
handleSelection,
{"passive": true, "capture": false},
{
"passive": true,
"capture": false,
},
elm,
);
Element.removeSelectionChangeEventListenerUseCapture(handleSelection, elm);
Expand All @@ -26,7 +33,11 @@ let htmlElm =

HtmlElement.addSelectionChangeEventListenerWithOptions(
handleSelection,
{"passive": true, "once": true, "capture": false},
{
"passive": true,
"once": true,
"capture": false,
},
htmlElm,
);
HtmlElement.addSelectionChangeEventListenerUseCapture(
Expand All @@ -36,7 +47,10 @@ HtmlElement.addSelectionChangeEventListenerUseCapture(
HtmlElement.removeSelectionChangeEventListener(handleSelection, htmlElm);
HtmlElement.removeSelectionChangeEventListenerWithOptions(
handleSelection,
{"passive": true, "capture": false},
{
"passive": true,
"capture": false,
},
htmlElm,
);
HtmlElement.removeSelectionChangeEventListenerUseCapture(
Expand All @@ -49,7 +63,11 @@ let htmlDoc =

HtmlDocument.addSelectionChangeEventListenerWithOptions(
handleSelection,
{"passive": true, "once": true, "capture": false},
{
"passive": true,
"once": true,
"capture": false,
},
htmlDoc,
);
HtmlDocument.addSelectionChangeEventListenerUseCapture(
Expand All @@ -59,7 +77,10 @@ HtmlDocument.addSelectionChangeEventListenerUseCapture(
HtmlDocument.removeSelectionChangeEventListener(handleSelection, htmlDoc);
HtmlDocument.removeSelectionChangeEventListenerWithOptions(
handleSelection,
{"passive": true, "capture": false},
{
"passive": true,
"capture": false,
},
htmlDoc,
);
HtmlDocument.removeSelectionChangeEventListenerUseCapture(
Expand All @@ -69,14 +90,21 @@ HtmlDocument.removeSelectionChangeEventListenerUseCapture(

Window.addSelectionChangeEventListenerWithOptions(
handleSelection,
{"passive": true, "once": true, "capture": false},
{
"passive": true,
"once": true,
"capture": false,
},
window,
);
Window.addSelectionChangeEventListenerUseCapture(handleSelection, window);
Window.removeSelectionChangeEventListener(handleSelection, window);
Window.removeSelectionChangeEventListenerWithOptions(
handleSelection,
{"passive": true, "capture": false},
{
"passive": true,
"capture": false,
},
window,
);
Window.removeSelectionChangeEventListenerUseCapture(handleSelection, window);

0 comments on commit 4474483

Please sign in to comment.