packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/CSSNumericType.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from css-typed-om-1 (webref). Do not edit.
module JSDOM.Generated.CSSNumericType
       (newCSSNumericType, setLength, getLength, getLengthUnsafe, getLengthUnchecked, setAngle, getAngle, getAngleUnsafe, getAngleUnchecked, setTime, getTime, getTimeUnsafe, getTimeUnchecked, setFrequency, getFrequency, getFrequencyUnsafe, getFrequencyUnchecked, setResolution, getResolution, getResolutionUnsafe, getResolutionUnchecked, setFlex, getFlex, getFlexUnsafe, getFlexUnchecked, setPercent, getPercent, getPercentUnsafe, getPercentUnchecked, setPercentHint, getPercentHint, getPercentHintUnsafe, getPercentHintUnchecked, CSSNumericType(..), gTypeCSSNumericType)
       where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dictdef-cssnumerictype CSSNumericType specification>
newCSSNumericType :: (MonadDOM m) => m CSSNumericType
newCSSNumericType = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-length CSSNumericType.length specification>
setLength :: (MonadDOM m) => CSSNumericType -> Int -> m ()
setLength self val = liftDOM (void (self ^. jss "length" (toJSVal val)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-length CSSNumericType.length specification>
getLength :: (MonadDOM m) => CSSNumericType -> m (Maybe Int)
getLength self = liftDOM (((self ^. js "length") >>= fromJSValUnchecked))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-length CSSNumericType.length specification>
getLengthUnsafe :: (MonadDOM m, HasCallStack) => CSSNumericType -> m Int
getLengthUnsafe self = liftDOM ((((self ^. js "length") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-length CSSNumericType.length specification>
getLengthUnchecked :: (MonadDOM m) => CSSNumericType -> m Int
getLengthUnchecked self = liftDOM ((P.round <$> ((self ^. js "length") >>= valToNumber)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-angle CSSNumericType.angle specification>
setAngle :: (MonadDOM m) => CSSNumericType -> Int -> m ()
setAngle self val = liftDOM (void (self ^. jss "angle" (toJSVal val)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-angle CSSNumericType.angle specification>
getAngle :: (MonadDOM m) => CSSNumericType -> m (Maybe Int)
getAngle self = liftDOM (((self ^. js "angle") >>= fromJSValUnchecked))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-angle CSSNumericType.angle specification>
getAngleUnsafe :: (MonadDOM m, HasCallStack) => CSSNumericType -> m Int
getAngleUnsafe self = liftDOM ((((self ^. js "angle") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-angle CSSNumericType.angle specification>
getAngleUnchecked :: (MonadDOM m) => CSSNumericType -> m Int
getAngleUnchecked self = liftDOM ((P.round <$> ((self ^. js "angle") >>= valToNumber)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-time CSSNumericType.time specification>
setTime :: (MonadDOM m) => CSSNumericType -> Int -> m ()
setTime self val = liftDOM (void (self ^. jss "time" (toJSVal val)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-time CSSNumericType.time specification>
getTime :: (MonadDOM m) => CSSNumericType -> m (Maybe Int)
getTime self = liftDOM (((self ^. js "time") >>= fromJSValUnchecked))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-time CSSNumericType.time specification>
getTimeUnsafe :: (MonadDOM m, HasCallStack) => CSSNumericType -> m Int
getTimeUnsafe self = liftDOM ((((self ^. js "time") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-time CSSNumericType.time specification>
getTimeUnchecked :: (MonadDOM m) => CSSNumericType -> m Int
getTimeUnchecked self = liftDOM ((P.round <$> ((self ^. js "time") >>= valToNumber)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-frequency CSSNumericType.frequency specification>
setFrequency :: (MonadDOM m) => CSSNumericType -> Int -> m ()
setFrequency self val = liftDOM (void (self ^. jss "frequency" (toJSVal val)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-frequency CSSNumericType.frequency specification>
getFrequency :: (MonadDOM m) => CSSNumericType -> m (Maybe Int)
getFrequency self = liftDOM (((self ^. js "frequency") >>= fromJSValUnchecked))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-frequency CSSNumericType.frequency specification>
getFrequencyUnsafe :: (MonadDOM m, HasCallStack) => CSSNumericType -> m Int
getFrequencyUnsafe self = liftDOM ((((self ^. js "frequency") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-frequency CSSNumericType.frequency specification>
getFrequencyUnchecked :: (MonadDOM m) => CSSNumericType -> m Int
getFrequencyUnchecked self = liftDOM ((P.round <$> ((self ^. js "frequency") >>= valToNumber)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-resolution CSSNumericType.resolution specification>
setResolution :: (MonadDOM m) => CSSNumericType -> Int -> m ()
setResolution self val = liftDOM (void (self ^. jss "resolution" (toJSVal val)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-resolution CSSNumericType.resolution specification>
getResolution :: (MonadDOM m) => CSSNumericType -> m (Maybe Int)
getResolution self = liftDOM (((self ^. js "resolution") >>= fromJSValUnchecked))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-resolution CSSNumericType.resolution specification>
getResolutionUnsafe :: (MonadDOM m, HasCallStack) => CSSNumericType -> m Int
getResolutionUnsafe self = liftDOM ((((self ^. js "resolution") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-resolution CSSNumericType.resolution specification>
getResolutionUnchecked :: (MonadDOM m) => CSSNumericType -> m Int
getResolutionUnchecked self = liftDOM ((P.round <$> ((self ^. js "resolution") >>= valToNumber)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-flex CSSNumericType.flex specification>
setFlex :: (MonadDOM m) => CSSNumericType -> Int -> m ()
setFlex self val = liftDOM (void (self ^. jss "flex" (toJSVal val)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-flex CSSNumericType.flex specification>
getFlex :: (MonadDOM m) => CSSNumericType -> m (Maybe Int)
getFlex self = liftDOM (((self ^. js "flex") >>= fromJSValUnchecked))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-flex CSSNumericType.flex specification>
getFlexUnsafe :: (MonadDOM m, HasCallStack) => CSSNumericType -> m Int
getFlexUnsafe self = liftDOM ((((self ^. js "flex") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-flex CSSNumericType.flex specification>
getFlexUnchecked :: (MonadDOM m) => CSSNumericType -> m Int
getFlexUnchecked self = liftDOM ((P.round <$> ((self ^. js "flex") >>= valToNumber)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-percent CSSNumericType.percent specification>
setPercent :: (MonadDOM m) => CSSNumericType -> Int -> m ()
setPercent self val = liftDOM (void (self ^. jss "percent" (toJSVal val)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-percent CSSNumericType.percent specification>
getPercent :: (MonadDOM m) => CSSNumericType -> m (Maybe Int)
getPercent self = liftDOM (((self ^. js "percent") >>= fromJSValUnchecked))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-percent CSSNumericType.percent specification>
getPercentUnsafe :: (MonadDOM m, HasCallStack) => CSSNumericType -> m Int
getPercentUnsafe self = liftDOM ((((self ^. js "percent") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-percent CSSNumericType.percent specification>
getPercentUnchecked :: (MonadDOM m) => CSSNumericType -> m Int
getPercentUnchecked self = liftDOM ((P.round <$> ((self ^. js "percent") >>= valToNumber)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-percenthint CSSNumericType.percentHint specification>
setPercentHint :: (MonadDOM m) => CSSNumericType -> CSSNumericBaseType -> m ()
setPercentHint self val = liftDOM (void (self ^. jss "percentHint" (toJSVal val)))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-percenthint CSSNumericType.percentHint specification>
getPercentHint :: (MonadDOM m) => CSSNumericType -> m (Maybe CSSNumericBaseType)
getPercentHint self = liftDOM (((self ^. js "percentHint") >>= fromJSValUnchecked))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-percenthint CSSNumericType.percentHint specification>
getPercentHintUnsafe :: (MonadDOM m, HasCallStack) => CSSNumericType -> m CSSNumericBaseType
getPercentHintUnsafe self = liftDOM ((((self ^. js "percentHint") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumerictype-percenthint CSSNumericType.percentHint specification>
getPercentHintUnchecked :: (MonadDOM m) => CSSNumericType -> m CSSNumericBaseType
getPercentHintUnchecked self = liftDOM (((self ^. js "percentHint") >>= fromJSValUnchecked))