From c137d0fef393b975de63ccee5965729bcf30a677 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Fri, 6 Dec 2024 12:14:57 +0800 Subject: [PATCH 1/4] Tooltip: use open object type --- src/Tooltip.re | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/src/Tooltip.re b/src/Tooltip.re index 3fd42f1..caa32e3 100644 --- a/src/Tooltip.re +++ b/src/Tooltip.re @@ -6,32 +6,23 @@ external make: ~allowEscapeViewBox: Js.t({..})=?, ~animationBegin: int=?, ~animationDuration: int=?, - ~animationEasing: - [@mel.string] [ - | `ease - | [@mel.as "ease-in"] `easeIn - | [@mel.as "ease-out"] `easeOut - | [@mel.as "ease-in-out"] `easeInOut - | `linear - ] - =?, + ~animationEasing: [@mel.string] [ + | `ease + | [@mel.as "ease-in"] `easeIn + | [@mel.as "ease-out"] `easeOut + | [@mel.as "ease-in-out"] `easeInOut + | `linear + ] + =?, ~className: string=?, ~content: 'content=?, ~position: Js.t({..})=?, - ~cursor: - [@mel.unwrap] [ - | `Bool(bool) - | `Obj( - Js.t({ - . - "fill": option(string), - "stroke": option(string), - "strokeWidth": option(int), - }), - ) - | `Element(React.element) - ] - =?, + ~cursor: [@mel.unwrap] [ + | `Bool(bool) + | `Obj(Js.t({..})) + | `Element(React.element) + ] + =?, ~filterNull: bool=?, ~formatter: 'formatter=?, ~isAnimationActive: bool=?, From f02efb48ab361cca6d643644179d30bb6a6d76d9 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Fri, 6 Dec 2024 12:15:14 +0800 Subject: [PATCH 2/4] fmt --- example/Example.re | 4 +- src/Area.re | 20 +++---- src/AreaChart.re | 3 +- src/Bar.re | 64 +++++++++++++-------- src/BarChart.re | 3 +- src/CartesianAxis.re | 3 +- src/ComposedChart.re | 3 +- src/Dot.re | 3 +- src/Legend.re | 44 +++++--------- src/Line.re | 20 +++---- src/LineChart.re | 3 +- src/Pie.re | 115 +++++++++++++++++++------------------ src/PieChart.re | 3 +- src/ReferenceArea.re | 3 +- src/ReferenceDot.re | 3 +- src/ReferenceLine.re | 3 +- src/ResponsiveContainer.re | 5 +- src/Scatter.re | 20 +++---- src/ScatterChart.re | 3 +- src/Treemap.re | 3 +- src/Utils.re | 18 +----- src/XAxis.re | 100 +++++++++++--------------------- src/YAxis.re | 100 +++++++++++--------------------- src/ZAxis.re | 100 +++++++++++--------------------- src/dune | 1 - 25 files changed, 267 insertions(+), 380 deletions(-) diff --git a/example/Example.re b/example/Example.re index adbf79f..6c78172 100644 --- a/example/Example.re +++ b/example/Example.re @@ -2,9 +2,9 @@ open Recharts; [@react.component] let make = (~data) => - + diff --git a/src/Area.re b/src/Area.re index 728e3b6..0c07bac 100644 --- a/src/Area.re +++ b/src/Area.re @@ -8,15 +8,14 @@ external make: ~activeDot: 'activeDot=?, ~animationBegin: int=?, ~animationDuration: int=?, - ~animationEasing: - [@mel.string] [ - | `ease - | [@mel.as "ease-in"] `easeIn - | [@mel.as "ease-out"] `easeOut - | [@mel.as "ease-in-out"] `easeInOut - | `linear - ] - =?, + ~animationEasing: [@mel.string] [ + | `ease + | [@mel.as "ease-in"] `easeIn + | [@mel.as "ease-out"] `easeOut + | [@mel.as "ease-in-out"] `easeInOut + | `linear + ] + =?, ~baseLine: 'baseLine=?, ~connectNulls: bool=?, ~hide: bool=?, @@ -33,8 +32,7 @@ external make: ~name: string=?, ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseDown: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseMove: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseOut: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, diff --git a/src/AreaChart.re b/src/AreaChart.re index 362ae87..1fdda96 100644 --- a/src/AreaChart.re +++ b/src/AreaChart.re @@ -14,8 +14,7 @@ external make: ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseUp: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseDown: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseMove: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~stackOffset: stackOffset=?, diff --git a/src/Bar.re b/src/Bar.re index 0ae8d5d..39d6246 100644 --- a/src/Bar.re +++ b/src/Bar.re @@ -6,15 +6,14 @@ external make: ( ~animationBegin: int=?, ~animationDuration: int=?, - ~animationEasing: - [@mel.string] [ - | `ease - | [@mel.as "ease-in"] `easeIn - | [@mel.as "ease-out"] `easeOut - | [@mel.as "ease-in-out"] `easeInOut - | `linear - ] - =?, + ~animationEasing: [@mel.string] [ + | `ease + | [@mel.as "ease-in"] `easeIn + | [@mel.as "ease-out"] `easeOut + | [@mel.as "ease-in-out"] `easeInOut + | `linear + ] + =?, ~background: 'background=?, ~barSize: int=?, ~className: string=?, @@ -30,22 +29,37 @@ external make: ~maxBarSize: int=?, ~minPointSize: int=?, ~name: string=?, - ~onClick: - (Js.t({.. "payload": 'dataItem}), int, React.Event.Mouse.t) => unit=?, - ~onMouseDown: - (Js.t({.. "payload": 'dataItem}), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.t({.. "payload": 'dataItem}), int, React.Event.Mouse.t) => unit=?, - ~onMouseLeave: - (Js.t({.. "payload": 'dataItem}), int, React.Event.Mouse.t) => unit=?, - ~onMouseMove: - (Js.t({.. "payload": 'dataItem}), React.Event.Mouse.t) => unit=?, - ~onMouseOut: - (Js.t({.. "payload": 'dataItem}), React.Event.Mouse.t) => unit=?, - ~onMouseOver: - (Js.t({.. "payload": 'dataItem}), React.Event.Mouse.t) => unit=?, - ~onMouseUp: - (Js.t({.. "payload": 'dataItem}), React.Event.Mouse.t) => unit=?, + ~onClick: (Js.t({.. "payload": 'dataItem}), int, React.Event.Mouse.t) => + unit + =?, + ~onMouseDown: (Js.t({.. "payload": 'dataItem}), React.Event.Mouse.t) => + unit + =?, + ~onMouseEnter: ( + Js.t({.. "payload": 'dataItem}), + int, + React.Event.Mouse.t + ) => + unit + =?, + ~onMouseLeave: ( + Js.t({.. "payload": 'dataItem}), + int, + React.Event.Mouse.t + ) => + unit + =?, + ~onMouseMove: (Js.t({.. "payload": 'dataItem}), React.Event.Mouse.t) => + unit + =?, + ~onMouseOut: (Js.t({.. "payload": 'dataItem}), React.Event.Mouse.t) => + unit + =?, + ~onMouseOver: (Js.t({.. "payload": 'dataItem}), React.Event.Mouse.t) => + unit + =?, + ~onMouseUp: (Js.t({.. "payload": 'dataItem}), React.Event.Mouse.t) => unit + =?, ~radius: array(int)=?, ~shape: 'shape=?, ~stackId: string=?, diff --git a/src/BarChart.re b/src/BarChart.re index 43fab2d..c0aeced 100644 --- a/src/BarChart.re +++ b/src/BarChart.re @@ -17,8 +17,7 @@ external make: ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseUp: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseDown: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseMove: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~reverseStackOrder: bool=?, diff --git a/src/CartesianAxis.re b/src/CartesianAxis.re index a6f89e5..234c724 100644 --- a/src/CartesianAxis.re +++ b/src/CartesianAxis.re @@ -24,4 +24,5 @@ external make: React.element = "CartesianAxis"; -let makeProps = (~interval=?) => makeProps(~interval=?interval->AxisInterval.encodeOpt); +let makeProps = (~interval=?) => + makeProps(~interval=?interval->AxisInterval.encodeOpt); diff --git a/src/ComposedChart.re b/src/ComposedChart.re index bcb882d..bf11abd 100644 --- a/src/ComposedChart.re +++ b/src/ComposedChart.re @@ -16,8 +16,7 @@ external make: ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseUp: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseDown: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseMove: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~reverseStackOrder: bool=?, diff --git a/src/Dot.re b/src/Dot.re index 438cd56..e6d3057 100644 --- a/src/Dot.re +++ b/src/Dot.re @@ -9,8 +9,7 @@ external make: ~fill: string, ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseDown: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseMove: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseOut: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, diff --git a/src/Legend.re b/src/Legend.re index 2da2009..59f8116 100644 --- a/src/Legend.re +++ b/src/Legend.re @@ -4,51 +4,37 @@ open Utils; [@mel.module "recharts"] [@react.component] external make: ( - ~align: - [ - | `left - | `center - | `right - ] - =?, + ~align: [ | `left | `center | `right]=?, ~chartHeight: int=?, ~chartWidth: int=?, ~content: 'content=?, ~className: string=?, ~height: int=?, ~iconSize: int=?, - ~iconType: - [ - | `line - | `square - | `rect - | `circle - | `cross - | `diamond - | `star - | `triangle - | `wye - ] - =?, + ~iconType: [ + | `line + | `square + | `rect + | `circle + | `cross + | `diamond + | `star + | `triangle + | `wye + ] + =?, ~layout: layout=?, ~margin: margin=?, ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseDown: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseMove: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseOut: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseOver: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseUp: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~payload: array(Js.t({..}))=?, - ~verticalAlign: - [ - | `top - | `middle - | `bottom - ] - =?, + ~verticalAlign: [ | `top | `middle | `bottom]=?, ~width: int=?, ~wrapperStyle: Js.t({..})=? ) => diff --git a/src/Line.re b/src/Line.re index fe41999..3f7aba6 100644 --- a/src/Line.re +++ b/src/Line.re @@ -8,15 +8,14 @@ external make: ~activeDot: 'activeDot=?, ~animationBegin: int=?, ~animationDuration: int=?, - ~animationEasing: - [@mel.string] [ - | `ease - | [@mel.as "ease-in"] `easeIn - | [@mel.as "ease-out"] `easeOut - | [@mel.as "ease-in-out"] `easeInOut - | `linear - ] - =?, + ~animationEasing: [@mel.string] [ + | `ease + | [@mel.as "ease-in"] `easeIn + | [@mel.as "ease-out"] `easeOut + | [@mel.as "ease-in-out"] `easeInOut + | `linear + ] + =?, ~className: string=?, ~connectNulls: bool=?, ~hide: bool=?, @@ -31,8 +30,7 @@ external make: ~name: string=?, ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseDown: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseMove: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseOut: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, diff --git a/src/LineChart.re b/src/LineChart.re index 0db7dbb..f559c6c 100644 --- a/src/LineChart.re +++ b/src/LineChart.re @@ -13,8 +13,7 @@ external make: ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseUp: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseDown: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseMove: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~syncId: string=?, diff --git a/src/Pie.re b/src/Pie.re index 5dfa0ef..4610819 100644 --- a/src/Pie.re +++ b/src/Pie.re @@ -8,15 +8,14 @@ external make: ~activeShape: 'activeShape=?, ~animationBegin: int=?, ~animationDuration: int=?, - ~animationEasing: - [@mel.string] [ - | `ease - | [@mel.as "ease-in"] `easeIn - | [@mel.as "ease-out"] `easeOut - | [@mel.as "ease-in-out"] `easeInOut - | `linear - ] - =?, + ~animationEasing: [@mel.string] [ + | `ease + | [@mel.as "ease-in"] `easeIn + | [@mel.as "ease-out"] `easeOut + | [@mel.as "ease-in-out"] `easeInOut + | `linear + ] + =?, ~className: string=?, ~cx: PxOrPrc.t=?, ~cy: PxOrPrc.t=?, @@ -34,53 +33,57 @@ external make: ~nameKey: string=?, // Pulled from: // https://github.com/recharts/recharts/blob/7fb227dae542c3d3093506e6d80a2c2c366f9a26/src/polar/Pie.tsx#L107-L109 - ~onClick: - (Js.Nullable.t({.. "payload": 'dataItem}), int, React.Event.Mouse.t) => - unit - =?, - ~onMouseEnter: - (Js.Nullable.t({.. "payload": 'dataItem}), int, React.Event.Mouse.t) => - unit - =?, - ~onMouseLeave: - (Js.Nullable.t({.. "payload": 'dataItem}), int, React.Event.Mouse.t) => - unit - =?, - ~onMouseDown: - ( - Js.Nullable.t(Js.t({.. "payload": 'dataItem})), - React.Event.Mouse.t - ) => - unit - =?, - ~onMouseMove: - ( - Js.Nullable.t(Js.t({.. "payload": 'dataItem})), - React.Event.Mouse.t - ) => - unit - =?, - ~onMouseOut: - ( - Js.Nullable.t(Js.t({.. "payload": 'dataItem})), - React.Event.Mouse.t - ) => - unit - =?, - ~onMouseOver: - ( - Js.Nullable.t(Js.t({.. "payload": 'dataItem})), - React.Event.Mouse.t - ) => - unit - =?, - ~onMouseUp: - ( - Js.Nullable.t(Js.t({.. "payload": 'dataItem})), - React.Event.Mouse.t - ) => - unit - =?, + ~onClick: ( + Js.Nullable.t({.. "payload": 'dataItem}), + int, + React.Event.Mouse.t + ) => + unit + =?, + ~onMouseEnter: ( + Js.Nullable.t({.. "payload": 'dataItem}), + int, + React.Event.Mouse.t + ) => + unit + =?, + ~onMouseLeave: ( + Js.Nullable.t({.. "payload": 'dataItem}), + int, + React.Event.Mouse.t + ) => + unit + =?, + ~onMouseDown: ( + Js.Nullable.t(Js.t({.. "payload": 'dataItem})), + React.Event.Mouse.t + ) => + unit + =?, + ~onMouseMove: ( + Js.Nullable.t(Js.t({.. "payload": 'dataItem})), + React.Event.Mouse.t + ) => + unit + =?, + ~onMouseOut: ( + Js.Nullable.t(Js.t({.. "payload": 'dataItem})), + React.Event.Mouse.t + ) => + unit + =?, + ~onMouseOver: ( + Js.Nullable.t(Js.t({.. "payload": 'dataItem})), + React.Event.Mouse.t + ) => + unit + =?, + ~onMouseUp: ( + Js.Nullable.t(Js.t({.. "payload": 'dataItem})), + React.Event.Mouse.t + ) => + unit + =?, ~outerRadius: PxOrPrc.t=?, ~paddingAngle: int=?, ~startAngle: int=?, diff --git a/src/PieChart.re b/src/PieChart.re index 3cd3ca7..79039fb 100644 --- a/src/PieChart.re +++ b/src/PieChart.re @@ -9,8 +9,7 @@ external make: ~margin: margin=?, ~style: ReactDOM.Style.t=?, ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~width: int=?, ~children: React.element diff --git a/src/ReferenceArea.re b/src/ReferenceArea.re index 79b2823..e0b2101 100644 --- a/src/ReferenceArea.re +++ b/src/ReferenceArea.re @@ -11,8 +11,7 @@ external make: ~fillOpacity: float=?, ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseDown: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseMove: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseOut: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, diff --git a/src/ReferenceDot.re b/src/ReferenceDot.re index 2c91057..cceec20 100644 --- a/src/ReferenceDot.re +++ b/src/ReferenceDot.re @@ -10,8 +10,7 @@ external make: ~label: 'label=?, ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseDown: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseMove: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseOut: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, diff --git a/src/ReferenceLine.re b/src/ReferenceLine.re index b7a2242..faa07f1 100644 --- a/src/ReferenceLine.re +++ b/src/ReferenceLine.re @@ -10,8 +10,7 @@ external make: ~label: 'label=?, ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseDown: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseMove: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseOut: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, diff --git a/src/ResponsiveContainer.re b/src/ResponsiveContainer.re index 4ab4463..f867129 100644 --- a/src/ResponsiveContainer.re +++ b/src/ResponsiveContainer.re @@ -17,4 +17,7 @@ external make: "ResponsiveContainer"; let makeProps = (~height=?, ~width=?) => - makeProps(~height=?height->PxOrPrc.encodeOpt, ~width=?width->PxOrPrc.encodeOpt); + makeProps( + ~height=?height->PxOrPrc.encodeOpt, + ~width=?width->PxOrPrc.encodeOpt, + ); diff --git a/src/Scatter.re b/src/Scatter.re index 0638295..acc7d10 100644 --- a/src/Scatter.re +++ b/src/Scatter.re @@ -22,18 +22,16 @@ external make: ~isAnimationActive: bool=?, ~animationBegin: int=?, ~animationDuration: int=?, - ~animationEasing: - [@mel.string] [ - | `ease - | [@mel.as "ease-in"] `easeIn - | [@mel.as "ease-out"] `easeOut - | [@mel.as "ease-in-out"] `easeInOut - | `linear - ] - =?, + ~animationEasing: [@mel.string] [ + | `ease + | [@mel.as "ease-in"] `easeIn + | [@mel.as "ease-out"] `easeOut + | [@mel.as "ease-in-out"] `easeInOut + | `linear + ] + =?, ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseOut: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseUp: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, diff --git a/src/ScatterChart.re b/src/ScatterChart.re index 4755ff2..866f231 100644 --- a/src/ScatterChart.re +++ b/src/ScatterChart.re @@ -9,8 +9,7 @@ external make: ~margin: margin=?, ~style: ReactDOM.Style.t=?, ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseOut: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseUp: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, diff --git a/src/Treemap.re b/src/Treemap.re index a2e2154..2b96d32 100644 --- a/src/Treemap.re +++ b/src/Treemap.re @@ -18,8 +18,7 @@ external make: ~onClick: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseUp: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseDown: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseEnter: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~onMouseLeave: (Js.t({..}), React.Event.Mouse.t) => unit=?, ~onMouseMove: (Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, ~children: React.element=? diff --git a/src/Utils.re b/src/Utils.re index 92a1172..35ac952 100644 --- a/src/Utils.re +++ b/src/Utils.re @@ -44,23 +44,11 @@ type scale = [ | `threshold ]; -type axisType = [ - | `number - | `category -]; +type axisType = [ | `number | `category]; -type layout = [ - | `horizontal - | `vertical -]; +type layout = [ | `horizontal | `vertical]; -type stackOffset = [ - | `expand - | `none - | `wiggle - | `silhouette - | `sign -]; +type stackOffset = [ | `expand | `none | `wiggle | `silhouette | `sign]; type margin = { . diff --git a/src/XAxis.re b/src/XAxis.re index 884e9ce..0cce10f 100644 --- a/src/XAxis.re +++ b/src/XAxis.re @@ -8,91 +8,61 @@ external make: ~allowDataOverflow: bool=?, ~allowDecimals: bool=?, ~allowDuplicatedCategory: bool=?, - ~axisLine: - [@mel.unwrap] [ - | `Bool(bool) - | `Obj(Js.t({..})) - ] - =?, + ~axisLine: [@mel.unwrap] [ | `Bool(bool) | `Obj(Js.t({..}))]=?, ~className: string=?, - ~dataKey: - [@mel.unwrap] [ - | `Str(string) - | `Int(int) - | `Fn('dataObj => 'data) - ] - =?, + ~dataKey: [@mel.unwrap] [ + | `Str(string) + | `Int(int) + | `Fn('dataObj => 'data) + ] + =?, ~domain: array('domain)=?, ~height: int=?, ~hide: bool=?, ~interval: AxisInterval.t=?, - ~label: - [@mel.unwrap] [ - | `Str(string) - | `Int(int) - | `Float(float) - | `Element(React.element) - | `Obj(Js.t({..})) - ] - =?, + ~label: [@mel.unwrap] [ + | `Str(string) + | `Int(int) + | `Float(float) + | `Element(React.element) + | `Obj(Js.t({..})) + ] + =?, ~minTickGap: int=?, ~mirror: bool=?, - ~name: - [@mel.unwrap] [ - | `Str(string) - | `Int(int) - | `Float(float) - ] - =?, + ~name: [@mel.unwrap] [ | `Str(string) | `Int(int) | `Float(float)]=?, ~onClick: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseDown: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseDown: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit + =?, + ~onMouseEnter: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit + =?, ~onMouseLeave: (. Js.t({..}), React.Event.Mouse.t) => unit=?, - ~onMouseMove: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseOut: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseOver: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseMove: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit + =?, + ~onMouseOut: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseOver: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit + =?, ~onMouseUp: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~orientation: - [ - | `bottom - | `top - ] - =?, + ~orientation: [ | `bottom | `top]=?, ~padding: paddingHorizontal=?, ~range: array(int)=?, ~reversed: bool=?, ~scale: scale=?, ~stroke: string=?, ~style: ReactDOM.Style.t=?, - ~tick: - [@mel.unwrap] [ - | `Obj(Js.t({..})) - | `Element(React.element) - | `Bool(bool) - | `Fn('tick => React.element) - ] - =?, + ~tick: [@mel.unwrap] [ + | `Obj(Js.t({..})) + | `Element(React.element) + | `Bool(bool) + | `Fn('tick => React.element) + ] + =?, ~tickCount: int=?, ~tickFormatter: (. 'tick, int) => string=?, - ~tickLine: - [@mel.unwrap] [ - | `Bool(bool) - | `Obj(Js.t({..})) - ] - =?, + ~tickLine: [@mel.unwrap] [ | `Bool(bool) | `Obj(Js.t({..}))]=?, ~tickMargin: int=?, ~ticks: array('ticks)=?, - ~tickSize: - [@mel.unwrap] [ - | `Float(float) - | `Int(int) - ] - =?, + ~tickSize: [@mel.unwrap] [ | `Float(float) | `Int(int)]=?, ~transform: string=?, ~unit: string=?, ~width: int=?, diff --git a/src/YAxis.re b/src/YAxis.re index ae0a94f..8082b3a 100644 --- a/src/YAxis.re +++ b/src/YAxis.re @@ -8,91 +8,61 @@ external make: ~allowDataOverflow: bool=?, ~allowDecimals: bool=?, ~allowDuplicatedCategory: bool=?, - ~axisLine: - [@mel.unwrap] [ - | `Bool(bool) - | `Obj(Js.t({..})) - ] - =?, + ~axisLine: [@mel.unwrap] [ | `Bool(bool) | `Obj(Js.t({..}))]=?, ~className: string=?, - ~dataKey: - [@mel.unwrap] [ - | `Str(string) - | `Int(int) - | `Fn('dataObj => 'data) - ] - =?, + ~dataKey: [@mel.unwrap] [ + | `Str(string) + | `Int(int) + | `Fn('dataObj => 'data) + ] + =?, ~domain: array('domain)=?, ~height: int=?, ~hide: bool=?, ~interval: AxisInterval.t=?, - ~label: - [@mel.unwrap] [ - | `Str(string) - | `Int(int) - | `Float(float) - | `Element(React.element) - | `Obj(Js.t({..})) - ] - =?, + ~label: [@mel.unwrap] [ + | `Str(string) + | `Int(int) + | `Float(float) + | `Element(React.element) + | `Obj(Js.t({..})) + ] + =?, ~minTickGap: int=?, ~mirror: bool=?, - ~name: - [@mel.unwrap] [ - | `Str(string) - | `Int(int) - | `Float(float) - ] - =?, + ~name: [@mel.unwrap] [ | `Str(string) | `Int(int) | `Float(float)]=?, ~onClick: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseDown: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseDown: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit + =?, + ~onMouseEnter: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit + =?, ~onMouseLeave: (. Js.t({..}), React.Event.Mouse.t) => unit=?, - ~onMouseMove: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseOut: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseOver: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseMove: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit + =?, + ~onMouseOut: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseOver: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit + =?, ~onMouseUp: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~orientation: - [ - | `left - | `right - ] - =?, + ~orientation: [ | `left | `right]=?, ~padding: paddingVertical=?, ~range: array(int)=?, ~reversed: bool=?, ~scale: scale=?, ~stroke: string=?, ~style: ReactDOM.Style.t=?, - ~tick: - [@mel.unwrap] [ - | `Obj(Js.t({..})) - | `Element(React.element) - | `Bool(bool) - | `Fn('tick => React.element) - ] - =?, + ~tick: [@mel.unwrap] [ + | `Obj(Js.t({..})) + | `Element(React.element) + | `Bool(bool) + | `Fn('tick => React.element) + ] + =?, ~tickCount: int=?, ~tickFormatter: (. 'tick, int) => string=?, - ~tickLine: - [@mel.unwrap] [ - | `Bool(bool) - | `Obj(Js.t({..})) - ] - =?, + ~tickLine: [@mel.unwrap] [ | `Bool(bool) | `Obj(Js.t({..}))]=?, ~tickMargin: int=?, ~ticks: array('ticks)=?, - ~tickSize: - [@mel.unwrap] [ - | `Float(float) - | `Int(int) - ] - =?, + ~tickSize: [@mel.unwrap] [ | `Float(float) | `Int(int)]=?, ~transform: string=?, ~unit: string=?, ~width: int=?, diff --git a/src/ZAxis.re b/src/ZAxis.re index cf0b64b..d71dc47 100644 --- a/src/ZAxis.re +++ b/src/ZAxis.re @@ -8,91 +8,61 @@ external make: ~allowDataOverflow: bool=?, ~allowDecimals: bool=?, ~allowDuplicatedCategory: bool=?, - ~axisLine: - [@mel.unwrap] [ - | `Bool(bool) - | `Obj(Js.t({..})) - ] - =?, + ~axisLine: [@mel.unwrap] [ | `Bool(bool) | `Obj(Js.t({..}))]=?, ~className: string=?, - ~dataKey: - [@mel.unwrap] [ - | `Str(string) - | `Int(int) - | `Fn('dataObj => 'tick) - ] - =?, + ~dataKey: [@mel.unwrap] [ + | `Str(string) + | `Int(int) + | `Fn('dataObj => 'tick) + ] + =?, ~domain: array('domain)=?, ~height: int=?, ~hide: bool=?, ~interval: AxisInterval.t=?, - ~label: - [@mel.unwrap] [ - | `Str(string) - | `Int(int) - | `Float(float) - | `Element(React.element) - | `Obj(Js.t({..})) - ] - =?, + ~label: [@mel.unwrap] [ + | `Str(string) + | `Int(int) + | `Float(float) + | `Element(React.element) + | `Obj(Js.t({..})) + ] + =?, ~minTickGap: int=?, ~mirror: bool=?, - ~name: - [@mel.unwrap] [ - | `Str(string) - | `Int(int) - | `Float(float) - ] - =?, + ~name: [@mel.unwrap] [ | `Str(string) | `Int(int) | `Float(float)]=?, ~onClick: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseDown: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseEnter: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseDown: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit + =?, + ~onMouseEnter: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit + =?, ~onMouseLeave: (. Js.t({..}), React.Event.Mouse.t) => unit=?, - ~onMouseMove: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseOut: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~onMouseOver: - (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseMove: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit + =?, + ~onMouseOut: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, + ~onMouseOver: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit + =?, ~onMouseUp: (. Js.Nullable.t(Js.t({..})), React.Event.Mouse.t) => unit=?, - ~orientation: - [ - | `left - | `right - ] - =?, + ~orientation: [ | `left | `right]=?, ~padding: paddingVertical=?, ~range: array(int)=?, ~reversed: bool=?, ~scale: scale=?, ~stroke: string=?, ~style: ReactDOM.Style.t=?, - ~tick: - [@mel.unwrap] [ - | `Obj(Js.t({..})) - | `Element(React.element) - | `Bool(bool) - | `Fn('tick => React.element) - ] - =?, + ~tick: [@mel.unwrap] [ + | `Obj(Js.t({..})) + | `Element(React.element) + | `Bool(bool) + | `Fn('tick => React.element) + ] + =?, ~tickCount: int=?, ~tickFormatter: (. 'tick, int) => string=?, - ~tickLine: - [@mel.unwrap] [ - | `Bool(bool) - | `Obj(Js.t({..})) - ] - =?, + ~tickLine: [@mel.unwrap] [ | `Bool(bool) | `Obj(Js.t({..}))]=?, ~tickMargin: int=?, ~ticks: array('ticks)=?, - ~tickSize: - [@mel.unwrap] [ - | `Float(float) - | `Int(int) - ] - =?, + ~tickSize: [@mel.unwrap] [ | `Float(float) | `Int(int)]=?, ~transform: string=?, ~unit: string=?, ~width: int=?, diff --git a/src/dune b/src/dune index 5c6809e..f3f2a85 100644 --- a/src/dune +++ b/src/dune @@ -5,4 +5,3 @@ (libraries reason-react) (preprocess (pps melange.ppx reason-react-ppx))) - From 3a357fbdcd9a0852298308d1dab729984d513730 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Fri, 6 Dec 2024 12:18:48 +0800 Subject: [PATCH 3/4] update CHANGES.md --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 849ed5f..16717ac 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +## 5.0.3 + +- change Tooltip.cursor Obj type to open object type + ## 5.0.1 - update `recharts` to `2.14.1` From 4c11a57f80be430558bcba95fd883ad7bba037be Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Fri, 6 Dec 2024 12:19:28 +0800 Subject: [PATCH 4/4] fix buggy version number in CHANGES --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 16717ac..019afed 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -## 5.0.3 +## 5.0.2 - change Tooltip.cursor Obj type to open object type