Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

updates offsetX and offsetY, fixes bs warning. #207

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/Webapi.re
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ module Url = Webapi__Url;

type rafId;

[@bs.val] external requestAnimationFrame : (float => unit) => unit = "";
[@bs.val] external requestAnimationFrame : (float => unit) => unit = "requestAnimationFrame";
[@bs.val] external requestCancellableAnimationFrame : (float => unit) => rafId = "requestAnimationFrame";
[@bs.val] external cancelAnimationFrame : rafId => unit = "";
[@bs.val] external cancelAnimationFrame : rafId => unit = "cancelAnimationFrame";
96 changes: 48 additions & 48 deletions src/Webapi/Canvas/Webapi__Canvas__Canvas2d.re
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,25 @@ type style(_) =
| Pattern: style(pattern);

/* 2d Canvas API, following https://simon.html5.org/dump/html5-canvas-cheat-sheet.html */
[@bs.send.pipe : t] external save : unit = "";
[@bs.send.pipe : t] external restore : unit = "";
[@bs.send.pipe : t] external save : unit = "save";
[@bs.send.pipe : t] external restore : unit = "restore";

/* Transformation */
[@bs.send.pipe : t] external scale : (~x: float, ~y: float) => unit = "";
[@bs.send.pipe : t] external rotate : float => unit = "";
[@bs.send.pipe : t] external translate : (~x: float, ~y: float) => unit = "";
[@bs.send.pipe : t] external transform : (~m11: float, ~m12: float, ~m21: float, ~m22: float, ~dx: float, ~dy: float) => unit = "";
[@bs.send.pipe : t] external setTransform : (~m11: float, ~m12: float, ~m21: float, ~m22: float, ~dx: float, ~dy: float) => unit = "";
[@bs.send.pipe : t] external scale : (~x: float, ~y: float) => unit = "scale";
[@bs.send.pipe : t] external rotate : float => unit = "rotate";
[@bs.send.pipe : t] external translate : (~x: float, ~y: float) => unit = "translate";
[@bs.send.pipe : t] external transform : (~m11: float, ~m12: float, ~m21: float, ~m22: float, ~dx: float, ~dy: float) => unit = "transform";
[@bs.send.pipe : t] external setTransform : (~m11: float, ~m12: float, ~m21: float, ~m22: float, ~dx: float, ~dy: float) => unit = "setTransform";

/* Compositing */
[@bs.set] external globalAlpha : (t, float) => unit = "";
[@bs.set] external globalCompositeOperation : (t, Composite.t) => unit = "";
[@bs.set] external globalAlpha : (t, float) => unit = "globalAlpha";
[@bs.set] external globalCompositeOperation : (t, Composite.t) => unit = "globalCompositeOperation";

/* Line Styles */
[@bs.set] external lineWidth : (t, float) => unit = "";
[@bs.set] external lineCap : (t, LineCap.t) => unit = "";
[@bs.set] external lineJoin : (t, LineJoin.t) => unit = "";
[@bs.set] external miterLimit : (t, float) => unit = "";
[@bs.set] external lineWidth : (t, float) => unit = "lineWidth";
[@bs.set] external lineCap : (t, LineCap.t) => unit = "lineCap";
[@bs.set] external lineJoin : (t, LineJoin.t) => unit = "lineJoin";
[@bs.set] external miterLimit : (t, float) => unit = "miterLimit";

/* Colors, Styles, and Shadows */
[@bs.set] external setFillStyle : (t, 'a) => unit = "fillStyle";
Expand Down Expand Up @@ -130,24 +130,24 @@ let reifyStyle = (type a, x: 'a) : (style(a), a) => {
);
};

[@bs.get] external fillStyle : t => 'a = "";
[@bs.get] external strokeStyle : t => 'a = "";
[@bs.get] external fillStyle : t => 'a = "fillStyle";
[@bs.get] external strokeStyle : t => 'a = "strokeStyle";

let fillStyle = (ctx: t) =>
ctx |> fillStyle |> reifyStyle;

let strokeStyle = (ctx: t) =>
ctx |> strokeStyle |> reifyStyle;

[@bs.set] external shadowOffsetX : (t, float) => unit = "";
[@bs.set] external shadowOffsetY : (t, float) => unit = "";
[@bs.set] external shadowBlur : (t, float) => unit = "";
[@bs.set] external shadowColor : (t, string) => unit = "";
[@bs.set] external shadowOffsetX : (t, float) => unit = "shadowOffsetX";
[@bs.set] external shadowOffsetY : (t, float) => unit = "shadowOffsetY";
[@bs.set] external shadowBlur : (t, float) => unit = "shadowBlur";
[@bs.set] external shadowColor : (t, string) => unit = "shadowColor";

/* Gradients */
[@bs.send.pipe : t] external createLinearGradient : (~x0: float, ~y0: float, ~x1: float, ~y1: float) => gradient = "";
[@bs.send.pipe : t] external createRadialGradient : (~x0: float, ~y0: float, ~x1: float, ~y1: float, ~r0: float, ~r1: float) => gradient = "";
[@bs.send.pipe : gradient] external addColorStop : (float, string) => unit = "";
[@bs.send.pipe : t] external createLinearGradient : (~x0: float, ~y0: float, ~x1: float, ~y1: float) => gradient = "createLinearGradient";
[@bs.send.pipe : t] external createRadialGradient : (~x0: float, ~y0: float, ~x1: float, ~y1: float, ~r0: float, ~r1: float) => gradient = "createRadialGradient";
[@bs.send.pipe : gradient] external addColorStop : (float, string) => unit = "addColorStop";
[@bs.val] external createPattern : (
t,
Dom.element,
Expand All @@ -158,49 +158,49 @@ let strokeStyle = (ctx: t) =>
[@bs.as "no-repeat"] | `noRepeat
]
)
=> pattern = "";
=> pattern = "createPattern";

/* Paths */
[@bs.send.pipe : t] external beginPath : unit = "";
[@bs.send.pipe : t] external closePath : unit = "";
[@bs.send.pipe : t] external fill : unit = "";
[@bs.send.pipe : t] external stroke : unit = "";
[@bs.send.pipe : t] external clip : unit = "";
[@bs.send.pipe : t] external moveTo : (~x: float, ~y: float) => unit = "";
[@bs.send.pipe : t] external lineTo : (~x: float, ~y: float) => unit = "";
[@bs.send.pipe : t] external quadraticCurveTo : (~cp1x: float, ~cp1y: float, ~x: float, ~y: float) => unit = "";
[@bs.send.pipe : t] external bezierCurveTo : (~cp1x: float, ~cp1y: float, ~cp2x: float, ~cp2y: float, ~x: float, ~y: float) => unit = "";
[@bs.send.pipe : t] external arcTo : (~x1: float, ~y1: float, ~x2: float, ~y2: float, ~r: float) => unit = "";
[@bs.send.pipe : t] external arc : (~x: float, ~y: float, ~r: float, ~startAngle: float, ~endAngle: float, ~anticw: bool) => unit = "";
[@bs.send.pipe : t] external rect : (~x: float, ~y: float, ~w: float, ~h: float) => unit = "";
[@bs.send.pipe : t] external isPointInPath : (~x: float, ~y: float) => bool = "";
[@bs.send.pipe : t] external beginPath : unit = "beginPath";
[@bs.send.pipe : t] external closePath : unit = "closePath";
[@bs.send.pipe : t] external fill : unit = "fill";
[@bs.send.pipe : t] external stroke : unit = "stroke";
[@bs.send.pipe : t] external clip : unit = "clip";
[@bs.send.pipe : t] external moveTo : (~x: float, ~y: float) => unit = "moveTo";
[@bs.send.pipe : t] external lineTo : (~x: float, ~y: float) => unit = "lineTo";
[@bs.send.pipe : t] external quadraticCurveTo : (~cp1x: float, ~cp1y: float, ~x: float, ~y: float) => unit = "quadraticCurveTo";
[@bs.send.pipe : t] external bezierCurveTo : (~cp1x: float, ~cp1y: float, ~cp2x: float, ~cp2y: float, ~x: float, ~y: float) => unit = "bezierCurveTo";
[@bs.send.pipe : t] external arcTo : (~x1: float, ~y1: float, ~x2: float, ~y2: float, ~r: float) => unit = "arcTo";
[@bs.send.pipe : t] external arc : (~x: float, ~y: float, ~r: float, ~startAngle: float, ~endAngle: float, ~anticw: bool) => unit = "arc";
[@bs.send.pipe : t] external rect : (~x: float, ~y: float, ~w: float, ~h: float) => unit = "rect";
[@bs.send.pipe : t] external isPointInPath : (~x: float, ~y: float) => bool = "isPointInPath";

/* Text */
[@bs.set] external font : (t, string) => unit = "";
[@bs.set] external textAlign : (t, string) => unit = "";
[@bs.set] external textBaseline : (t, string) => unit = "";
[@bs.send.pipe : t] external fillText : (string, ~x: float, ~y: float, ~maxWidth: float=?) => unit = "";
[@bs.send.pipe : t] external strokeText : (string, ~x: float, ~y: float, ~maxWidth: float=?) => unit = "";
[@bs.send.pipe : t] external measureText : string => measureText = "";
[@bs.get] external width : measureText => float = "";
[@bs.set] external font : (t, string) => unit = "font";
[@bs.set] external textAlign : (t, string) => unit = "textAlign";
[@bs.set] external textBaseline : (t, string) => unit = "textBaseline";
[@bs.send.pipe : t] external fillText : (string, ~x: float, ~y: float, ~maxWidth: float=?) => unit = "fillText";
[@bs.send.pipe : t] external strokeText : (string, ~x: float, ~y: float, ~maxWidth: float=?) => unit = "strokeText";
[@bs.send.pipe : t] external measureText : string => measureText = "measureText";
[@bs.get] external width : measureText => float = "measureText";

/* Rectangles */
[@bs.send.pipe : t] external fillRect : (~x: float, ~y: float, ~w: float, ~h: float) => unit = "";
[@bs.send.pipe : t] external strokeRect : (~x: float, ~y: float, ~w: float, ~h: float) => unit = "";
[@bs.send.pipe : t] external clearRect : (~x: float, ~y: float, ~w: float, ~h: float) => unit = "";
[@bs.send.pipe : t] external fillRect : (~x: float, ~y: float, ~w: float, ~h: float) => unit = "fillRect";
[@bs.send.pipe : t] external strokeRect : (~x: float, ~y: float, ~w: float, ~h: float) => unit = "strokeRect";
[@bs.send.pipe : t] external clearRect : (~x: float, ~y: float, ~w: float, ~h: float) => unit = "clearRect";

[@bs.send] external createImageDataCoords : (t, ~width: float, ~height: float) => Webapi__Dom__Image.t = "createImageData";
[@bs.send] external createImageDataFromImage : (t, Webapi__Dom__Image.t) => Webapi__Dom__Image.t = "createImageData";

[@bs.send] external getImageData : (t, ~sx: float, ~sy: float, ~sw: float, ~sh: float) => Webapi__Dom__Image.t = "";
[@bs.send] external getImageData : (t, ~sx: float, ~sy: float, ~sw: float, ~sh: float) => Webapi__Dom__Image.t = "getImageData";

[@bs.send] external putImageData : (
t,
~imageData: Webapi__Dom__Image.t,
~dx: float,
~dy: float
)
=> unit = "";
=> unit = "putImageData";

[@bs.send] external putImageDataWithDirtyRect : (
t,
Expand Down
6 changes: 3 additions & 3 deletions src/Webapi/Dom/Webapi__Dom__AnimationEvent.re
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ include Webapi__Dom__Event.Impl({ type nonrec t = t; });
[@bs.new] external make : string => t = "AnimationEvent";
[@bs.new] external makeWithOptions : (string, Js.t({..})) => t = "AnimationEvent";

[@bs.get] external animationName : t => string = "";
[@bs.get] external elapsedTime : t => float = "";
[@bs.get] external pseudoElement : t => string /* enum-ish */ = "";
[@bs.get] external animationName : t => string = "animationName";
[@bs.get] external elapsedTime : t => float = "elapsedTime";
[@bs.get] external pseudoElement : t => string /* enum-ish */ = "pseudoElement";
14 changes: 7 additions & 7 deletions src/Webapi/Dom/Webapi__Dom__Attr.re
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ type t = Dom.attr;
include Webapi__Dom__Node.Impl({ type nonrec t = t; });
include Webapi__Dom__EventTarget.Impl({ type nonrec t = t; });

[@bs.get] external namespaceURI : t => string = "";
[@bs.get] external prefix : t => string = "";
[@bs.get] external localName : t => string = "";
[@bs.get] external name : t => string = "";
[@bs.get] external value : t => string = "";
[@bs.get] [@bs.return nullable] external ownerElement : t => option(Dom.element) = "";
[@bs.get] external specified : t => bool = ""; /* useless; always returns true (exact wording from spec) */
[@bs.get] external namespaceURI : t => string = "namespaceURI";
[@bs.get] external prefix : t => string = "prefix";
[@bs.get] external localName : t => string = "localName";
[@bs.get] external name : t => string = "name";
[@bs.get] external value : t => string = "value";
[@bs.get] [@bs.return nullable] external ownerElement : t => option(Dom.element) = "ownerElement";
[@bs.get] external specified : t => bool = "specified"; /* useless; always returns true (exact wording from spec) */
2 changes: 1 addition & 1 deletion src/Webapi/Dom/Webapi__Dom__BeforeUnloadEvent.re
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ include Webapi__Dom__Event.Impl({ type nonrec t = t; });
[@bs.new] external make : string => t = "BeforeUnloadEvent";
[@bs.new] external makeWithOptions : (string, Js.t({..})) => t = "BeforeUnloadEvent";

[@bs.get] external returnValue : t => string = "";
[@bs.get] external returnValue : t => string = "returnValue";
14 changes: 7 additions & 7 deletions src/Webapi/Dom/Webapi__Dom__CharacterData.re
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module Impl = (T: {type t;}) => {
[@bs.get] external data : T.t => string = "";
[@bs.get] external length : T.t => int = "";
[@bs.get] external data : T.t => string = "data";
[@bs.get] external length : T.t => int = "length";

[@bs.send.pipe : T.t] external substringData : (~offset: int, ~count: int) => string = "";
[@bs.send.pipe : T.t] external appendData : string => unit = "";
[@bs.send.pipe : T.t] external insertData : (~offset: int, string) => unit = "";
[@bs.send.pipe : T.t] external deleteData : (~offset: int, ~count: int) => unit = "";
[@bs.send.pipe : T.t] external replaceData : (~offset: int, ~count: int, string) => unit = "";
[@bs.send.pipe : T.t] external substringData : (~offset: int, ~count: int) => string = "substringData";
[@bs.send.pipe : T.t] external appendData : string => unit = "appendData";
[@bs.send.pipe : T.t] external insertData : (~offset: int, string) => unit = "insertData";
[@bs.send.pipe : T.t] external deleteData : (~offset: int, ~count: int) => unit = "deleteData";
[@bs.send.pipe : T.t] external replaceData : (~offset: int, ~count: int, string) => unit = "replaceData";
};

type t = Dom.characterData;
Expand Down
2 changes: 1 addition & 1 deletion src/Webapi/Dom/Webapi__Dom__ChildNode.re
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Mixin */
module Impl = (T: {type t;}) => {
[@bs.send.pipe : T.t] external remove : unit = "";
[@bs.send.pipe : T.t] external remove : unit = "remove";
};
2 changes: 1 addition & 1 deletion src/Webapi/Dom/Webapi__Dom__ClipboardEvent.re
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ include Webapi__Dom__Event.Impl({ type nonrec t = t; });
[@bs.new] external make : string => t = "ClipboardEvent";
[@bs.new] external makeWithOptions : (string, Js.t({..})) => t = "ClipboardEvent";

[@bs.get] external clipboardData : t => Dom.dataTransfer = "";
[@bs.get] external clipboardData : t => Dom.dataTransfer = "clipboardData";
6 changes: 3 additions & 3 deletions src/Webapi/Dom/Webapi__Dom__CloseEvent.re
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ include Webapi__Dom__Event.Impl({ type nonrec t = t; });
[@bs.new] external make : string => t = "CloseEvent";
[@bs.new] external makeWithOptions : (string, Js.t({..})) => t = "CloseEvent";

[@bs.get] external wasClean : t => bool = "";
[@bs.get] external code : t => int = "";
[@bs.get] external reason : t => string = "";
[@bs.get] external wasClean : t => bool = "wasClean";
[@bs.get] external code : t => int = "code";
[@bs.get] external reason : t => string = "reason";
2 changes: 1 addition & 1 deletion src/Webapi/Dom/Webapi__Dom__CompositionEvent.re
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ include Webapi__Dom__UiEvent.Impl({ type nonrec t = t; });
[@bs.new] external make : string => t = "CompositionEvent";
[@bs.new] external makeWithOptions : (string, Js.t({..})) => t = "CompositionEvent";

[@bs.get] external data : t => string = "";
[@bs.get] external data : t => string = "data";
Loading