jsaddle-dom-0.10.0.0: src/JSDOM/Generated/PropertyDefinition.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from css-properties-values-api-1 (webref). Do not edit.
module JSDOM.Generated.PropertyDefinition
(newPropertyDefinition, setName, getName, setSyntax, getSyntax, getSyntaxUnsafe, getSyntaxUnchecked, setInherits, getInherits, getInheritsUnsafe, getInheritsUnchecked, setInitialValue, getInitialValue, getInitialValueUnsafe, getInitialValueUnchecked, PropertyDefinition(..), gTypePropertyDefinition)
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-properties-values-api-1/#dictdef-propertydefinition PropertyDefinition specification>
newPropertyDefinition :: (MonadDOM m, ToJSString name) => name -> m PropertyDefinition
newPropertyDefinition name = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "name" (toJSVal name)) P.>> P.return o)) >>= fromJSValUnchecked))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-name PropertyDefinition.name specification>
setName :: (MonadDOM m, ToJSString val) => PropertyDefinition -> val -> m ()
setName self val = liftDOM (void (self ^. jss "name" (toJSVal val)))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-name PropertyDefinition.name specification>
getName :: (MonadDOM m, FromJSString result) => PropertyDefinition -> m result
getName self = liftDOM (((self ^. js "name") >>= fromJSValUnchecked))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-syntax PropertyDefinition.syntax specification>
setSyntax :: (MonadDOM m, ToJSString val) => PropertyDefinition -> val -> m ()
setSyntax self val = liftDOM (void (self ^. jss "syntax" (toJSVal val)))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-syntax PropertyDefinition.syntax specification>
getSyntax :: (MonadDOM m, FromJSString result) => PropertyDefinition -> m (Maybe result)
getSyntax self = liftDOM (((self ^. js "syntax") >>= fromMaybeJSString))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-syntax PropertyDefinition.syntax specification>
getSyntaxUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PropertyDefinition -> m result
getSyntaxUnsafe self = liftDOM ((((self ^. js "syntax") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-syntax PropertyDefinition.syntax specification>
getSyntaxUnchecked :: (MonadDOM m, FromJSString result) => PropertyDefinition -> m result
getSyntaxUnchecked self = liftDOM (((self ^. js "syntax") >>= fromJSValUnchecked))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-inherits PropertyDefinition.inherits specification>
setInherits :: (MonadDOM m) => PropertyDefinition -> Bool -> m ()
setInherits self val = liftDOM (void (self ^. jss "inherits" (toJSVal val)))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-inherits PropertyDefinition.inherits specification>
getInherits :: (MonadDOM m) => PropertyDefinition -> m (Maybe Bool)
getInherits self = liftDOM (((self ^. js "inherits") >>= fromJSValUnchecked))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-inherits PropertyDefinition.inherits specification>
getInheritsUnsafe :: (MonadDOM m, HasCallStack) => PropertyDefinition -> m Bool
getInheritsUnsafe self = liftDOM ((((self ^. js "inherits") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-inherits PropertyDefinition.inherits specification>
getInheritsUnchecked :: (MonadDOM m) => PropertyDefinition -> m Bool
getInheritsUnchecked self = liftDOM (((self ^. js "inherits") >>= valToBool))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-initialvalue PropertyDefinition.initialValue specification>
setInitialValue :: (MonadDOM m, ToJSString val) => PropertyDefinition -> val -> m ()
setInitialValue self val = liftDOM (void (self ^. jss "initialValue" (toJSVal val)))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-initialvalue PropertyDefinition.initialValue specification>
getInitialValue :: (MonadDOM m, FromJSString result) => PropertyDefinition -> m (Maybe result)
getInitialValue self = liftDOM (((self ^. js "initialValue") >>= fromMaybeJSString))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-initialvalue PropertyDefinition.initialValue specification>
getInitialValueUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PropertyDefinition -> m result
getInitialValueUnsafe self = liftDOM ((((self ^. js "initialValue") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-propertydefinition-initialvalue PropertyDefinition.initialValue specification>
getInitialValueUnchecked :: (MonadDOM m, FromJSString result) => PropertyDefinition -> m result
getInitialValueUnchecked self = liftDOM (((self ^. js "initialValue") >>= fromJSValUnchecked))