fix: visibility

This commit is contained in:
orion 2023-11-06 16:51:05 -06:00
parent 33c0299bb8
commit 5db9c3e5b0
Signed by: orion
GPG Key ID: 6D4165AE4C928719

View File

@ -1,4 +1,15 @@
module Puppeteer.Mouse where
module Puppeteer.Mouse
( MouseButton(..)
, scroll
, down
, up
, moveTo
, click
, MouseWheelOptions
, MouseMoveOptions
, MouseOptions
, MouseClickOptions
) where
import Prelude
@ -30,16 +41,16 @@ type MouseMoveOptions r = (steps :: Number | r)
type MouseOptions r = (button :: MouseButton | r)
type MouseClickOptions r = (count :: Int, delay :: Number | MouseOptions r)
foreign import scrollImpl :: Mouse -> { deltaX :: Number, deltaY :: Number } -> Effect (Promise Unit)
foreign import clickImpl :: Mouse -> { x :: Number, y :: Number } -> { button :: String, count :: Int, delay :: Number } -> Effect (Promise Unit)
foreign import downImpl :: Mouse -> String -> Effect (Promise Unit)
foreign import upImpl :: Mouse -> String -> Effect (Promise Unit)
foreign import moveImpl :: Mouse -> { x :: Number, y :: Number } -> { steps :: Number } -> Effect (Promise Unit)
foreign import scrollImpl :: Mouse -> {deltaX :: Number, deltaY :: Number} -> Effect (Promise Unit)
foreign import clickImpl :: Mouse -> {x :: Number, y :: Number} -> {button :: String, count :: Int, delay :: Number} -> Effect (Promise Unit)
foreign import downImpl :: Mouse -> String -> Effect (Promise Unit)
foreign import upImpl :: Mouse -> String -> Effect (Promise Unit)
foreign import moveImpl :: Mouse -> {x :: Number, y :: Number} -> {steps :: Number} -> Effect (Promise Unit)
scroll :: forall options missing. Union options missing (MouseWheelOptions ()) => Union options (MouseWheelOptions ()) (MouseWheelOptions ()) => Record options -> Mouse -> Aff Unit
scroll options mouse = Promise.toAffE
$ scrollImpl mouse
$ Record.merge options { deltaX: 0.0, deltaY: 0.0 }
$ scrollImpl mouse
$ Record.merge options {deltaX: 0.0, deltaY: 0.0}
down :: MouseButton -> Mouse -> Aff Unit
down btn mouse = Promise.toAffE $ downImpl mouse (mouseButtonToString btn)
@ -47,29 +58,25 @@ down btn mouse = Promise.toAffE $ downImpl mouse (mouseButtonToString btn)
up :: MouseButton -> Mouse -> Aff Unit
up btn mouse = Promise.toAffE $ upImpl mouse (mouseButtonToString btn)
moveTo
:: forall options missing fullU
. Nub fullU (MouseMoveOptions ())
=> Union options missing (MouseMoveOptions ())
=> Union options (MouseMoveOptions ()) fullU
=> Record options
-> Mouse
-> { x :: Number, y :: Number }
-> Aff Unit
moveTo :: forall options missing fullU. Nub fullU (MouseMoveOptions ())
=> Union options missing (MouseMoveOptions ())
=> Union options (MouseMoveOptions ()) fullU
=> Record options
-> Mouse
-> {x :: Number, y :: Number}
-> Aff Unit
moveTo opts mouse xy = Promise.toAffE
$ moveImpl mouse xy
$ Record.merge opts { steps: 1.0 }
$ moveImpl mouse xy
$ Record.merge opts {steps: 1.0}
click
:: forall options missing fullU
. Nub fullU (MouseClickOptions ())
=> Union options missing (MouseClickOptions ())
=> Union options (MouseClickOptions ()) fullU
=> Record options
-> Mouse
-> { x :: Number, y :: Number }
-> Aff Unit
click :: forall options missing fullU. Nub fullU (MouseClickOptions ())
=> Union options missing (MouseClickOptions ())
=> Union options (MouseClickOptions ()) fullU
=> Record options
-> Mouse
-> {x :: Number, y :: Number}
-> Aff Unit
click opts mouse xy = Promise.toAffE
$ clickImpl mouse xy
$ Record.modify (Proxy @"button") mouseButtonToString
$ Record.merge opts { button: MouseLeft, count: 1, delay: 0.0 }
$ clickImpl mouse xy
$ Record.modify (Proxy @"button") mouseButtonToString
$ Record.merge opts {button: MouseLeft, count: 1, delay: 0.0}