{-# LANGUAGE PatternSynonyms #-}
-- For HasCallStack compatibility
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.DOMRectReadOnly
       (newDOMRectReadOnly, fromRect, fromRect_, getX, getY, getWidth,
        getHeight, getTop, getRight, getBottom, getLeft,
        DOMRectReadOnly(..), gTypeDOMRectReadOnly, IsDOMRectReadOnly,
        toDOMRectReadOnly)
       where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums

-- | <https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly Mozilla DOMRectReadOnly documentation> 
newDOMRectReadOnly ::
                   (MonadDOM m) =>
                     Maybe Double ->
                       Maybe Double -> Maybe Double -> Maybe Double -> m DOMRectReadOnly
newDOMRectReadOnly :: Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> m DOMRectReadOnly
newDOMRectReadOnly Maybe Double
x Maybe Double
y Maybe Double
width Maybe Double
height
  = DOM DOMRectReadOnly -> m DOMRectReadOnly
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (JSVal -> DOMRectReadOnly
DOMRectReadOnly (JSVal -> DOMRectReadOnly) -> JSM JSVal -> DOM DOMRectReadOnly
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
         JSM JSVal -> [JSM JSVal] -> JSM JSVal
forall constructor args.
(MakeObject constructor, MakeArgs args) =>
constructor -> args -> JSM JSVal
new ([Char] -> JSM JSVal
forall a. ToJSString a => a -> JSM JSVal
jsg [Char]
"DOMRectReadOnly")
           [Maybe Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Double
x, Maybe Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Double
y, Maybe Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Double
width, Maybe Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Double
height])

-- | <https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly.fromRect Mozilla DOMRectReadOnly.fromRect documentation> 
fromRect :: (MonadDOM m) => Maybe DOMRectInit -> m DOMRectReadOnly
fromRect :: Maybe DOMRectInit -> m DOMRectReadOnly
fromRect Maybe DOMRectInit
other
  = DOM DOMRectReadOnly -> m DOMRectReadOnly
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      ((([Char] -> JSM JSVal
forall a. ToJSString a => a -> JSM JSVal
jsg [Char]
"DOMRectReadOnly") JSM JSVal
-> Getting (JSM JSVal) (JSM JSVal) (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf [Char]
"fromRect" [Maybe DOMRectInit -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe DOMRectInit
other]) JSM JSVal -> (JSVal -> DOM DOMRectReadOnly) -> DOM DOMRectReadOnly
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
         JSVal -> DOM DOMRectReadOnly
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly.fromRect Mozilla DOMRectReadOnly.fromRect documentation> 
fromRect_ :: (MonadDOM m) => Maybe DOMRectInit -> m ()
fromRect_ :: Maybe DOMRectInit -> m ()
fromRect_ Maybe DOMRectInit
other
  = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (([Char] -> JSM JSVal
forall a. ToJSString a => a -> JSM JSVal
jsg [Char]
"DOMRectReadOnly") JSM JSVal
-> Getting (JSM JSVal) (JSM JSVal) (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf [Char]
"fromRect" [Maybe DOMRectInit -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe DOMRectInit
other]))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly.x Mozilla DOMRectReadOnly.x documentation> 
getX :: (MonadDOM m, IsDOMRectReadOnly self) => self -> m Double
getX :: self -> m Double
getX self
self
  = DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (((self -> DOMRectReadOnly
forall o. IsDOMRectReadOnly o => o -> DOMRectReadOnly
toDOMRectReadOnly self
self) DOMRectReadOnly
-> Getting (JSM JSVal) DOMRectReadOnly (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> IndexPreservingGetter DOMRectReadOnly (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js [Char]
"x") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall value. ToJSVal value => value -> DOM Double
valToNumber)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly.y Mozilla DOMRectReadOnly.y documentation> 
getY :: (MonadDOM m, IsDOMRectReadOnly self) => self -> m Double
getY :: self -> m Double
getY self
self
  = DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (((self -> DOMRectReadOnly
forall o. IsDOMRectReadOnly o => o -> DOMRectReadOnly
toDOMRectReadOnly self
self) DOMRectReadOnly
-> Getting (JSM JSVal) DOMRectReadOnly (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> IndexPreservingGetter DOMRectReadOnly (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js [Char]
"y") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall value. ToJSVal value => value -> DOM Double
valToNumber)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly.width Mozilla DOMRectReadOnly.width documentation> 
getWidth ::
         (MonadDOM m, IsDOMRectReadOnly self) => self -> m Double
getWidth :: self -> m Double
getWidth self
self
  = DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (((self -> DOMRectReadOnly
forall o. IsDOMRectReadOnly o => o -> DOMRectReadOnly
toDOMRectReadOnly self
self) DOMRectReadOnly
-> Getting (JSM JSVal) DOMRectReadOnly (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> IndexPreservingGetter DOMRectReadOnly (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js [Char]
"width") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall value. ToJSVal value => value -> DOM Double
valToNumber)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly.height Mozilla DOMRectReadOnly.height documentation> 
getHeight ::
          (MonadDOM m, IsDOMRectReadOnly self) => self -> m Double
getHeight :: self -> m Double
getHeight self
self
  = DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (((self -> DOMRectReadOnly
forall o. IsDOMRectReadOnly o => o -> DOMRectReadOnly
toDOMRectReadOnly self
self) DOMRectReadOnly
-> Getting (JSM JSVal) DOMRectReadOnly (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> IndexPreservingGetter DOMRectReadOnly (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js [Char]
"height") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall value. ToJSVal value => value -> DOM Double
valToNumber)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly.top Mozilla DOMRectReadOnly.top documentation> 
getTop :: (MonadDOM m, IsDOMRectReadOnly self) => self -> m Double
getTop :: self -> m Double
getTop self
self
  = DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (((self -> DOMRectReadOnly
forall o. IsDOMRectReadOnly o => o -> DOMRectReadOnly
toDOMRectReadOnly self
self) DOMRectReadOnly
-> Getting (JSM JSVal) DOMRectReadOnly (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> IndexPreservingGetter DOMRectReadOnly (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js [Char]
"top") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall value. ToJSVal value => value -> DOM Double
valToNumber)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly.right Mozilla DOMRectReadOnly.right documentation> 
getRight ::
         (MonadDOM m, IsDOMRectReadOnly self) => self -> m Double
getRight :: self -> m Double
getRight self
self
  = DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (((self -> DOMRectReadOnly
forall o. IsDOMRectReadOnly o => o -> DOMRectReadOnly
toDOMRectReadOnly self
self) DOMRectReadOnly
-> Getting (JSM JSVal) DOMRectReadOnly (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> IndexPreservingGetter DOMRectReadOnly (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js [Char]
"right") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall value. ToJSVal value => value -> DOM Double
valToNumber)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly.bottom Mozilla DOMRectReadOnly.bottom documentation> 
getBottom ::
          (MonadDOM m, IsDOMRectReadOnly self) => self -> m Double
getBottom :: self -> m Double
getBottom self
self
  = DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (((self -> DOMRectReadOnly
forall o. IsDOMRectReadOnly o => o -> DOMRectReadOnly
toDOMRectReadOnly self
self) DOMRectReadOnly
-> Getting (JSM JSVal) DOMRectReadOnly (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> IndexPreservingGetter DOMRectReadOnly (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js [Char]
"bottom") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall value. ToJSVal value => value -> DOM Double
valToNumber)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly.left Mozilla DOMRectReadOnly.left documentation> 
getLeft :: (MonadDOM m, IsDOMRectReadOnly self) => self -> m Double
getLeft :: self -> m Double
getLeft self
self
  = DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (((self -> DOMRectReadOnly
forall o. IsDOMRectReadOnly o => o -> DOMRectReadOnly
toDOMRectReadOnly self
self) DOMRectReadOnly
-> Getting (JSM JSVal) DOMRectReadOnly (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> IndexPreservingGetter DOMRectReadOnly (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js [Char]
"left") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall value. ToJSVal value => value -> DOM Double
valToNumber)