jsaddle-dom-0.10.0.0: src/JSDOM/Generated/HTMLElement.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from html (webref). Do not edit.
module JSDOM.Generated.HTMLElement
(attachInternals, attachInternals_, click, hidePopover, showPopover, togglePopover, togglePopover_, setTitle, getTitle, setLang, getLang, setTranslate, getTranslate, setDir, getDir, setHidden, getHidden, getHiddenUnsafe, getHiddenUnchecked, setInert, getInert, setAccessKey, getAccessKey, getAccessKeyLabel, setDraggable, getDraggable, setSpellcheck, getSpellcheck, setWritingSuggestions, getWritingSuggestions, setAutocapitalize, getAutocapitalize, setAutocorrect, getAutocorrect, setInnerText, getInnerText, setOuterText, getOuterText, setPopover, getPopover, getPopoverUnsafe, getPopoverUnchecked, getOffsetParent, getOffsetParentUnsafe, getOffsetParentUnchecked, getOffsetTop, getOffsetLeft, getOffsetWidth, getOffsetHeight, navbeforefocus, navnotarget, HTMLElement(..), gTypeHTMLElement, IsHTMLElement, toHTMLElement)
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://developer.mozilla.org/docs/Web/API/HTMLElement/attachInternals MDN HTMLElement.attachInternals documentation>
attachInternals :: (MonadDOM m, IsHTMLElement self) => self -> m ElementInternals
attachInternals self = liftDOM ((((Types.toHTMLElement self) ^. jsf "attachInternals" ()) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/attachInternals MDN HTMLElement.attachInternals documentation>
attachInternals_ :: (MonadDOM m, IsHTMLElement self) => self -> m ()
attachInternals_ self = liftDOM (void ((Types.toHTMLElement self) ^. jsf "attachInternals" ()))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/click MDN HTMLElement.click documentation>
click :: (MonadDOM m, IsHTMLElement self) => self -> m ()
click self = liftDOM (void ((Types.toHTMLElement self) ^. jsf "click" ()))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/hidePopover MDN HTMLElement.hidePopover documentation>
hidePopover :: (MonadDOM m, IsHTMLElement self) => self -> m ()
hidePopover self = liftDOM (void ((Types.toHTMLElement self) ^. jsf "hidePopover" ()))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/showPopover MDN HTMLElement.showPopover documentation>
showPopover :: (MonadDOM m, IsHTMLElement self, IsShowPopoverOptions options) => self -> Maybe options -> m ()
showPopover self options = liftDOM (void ((Types.toHTMLElement self) ^. jsf "showPopover" [P.maybe (P.return jsUndefined) toJSVal options]))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/togglePopover MDN HTMLElement.togglePopover documentation>
togglePopover :: (MonadDOM m, IsHTMLElement self, IsTogglePopoverOptionsOrBool options) => self -> Maybe options -> m Bool
togglePopover self options = liftDOM ((((Types.toHTMLElement self) ^. jsf "togglePopover" [P.maybe (P.return jsUndefined) toJSVal options]) >>= valToBool))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/togglePopover MDN HTMLElement.togglePopover documentation>
togglePopover_ :: (MonadDOM m, IsHTMLElement self, IsTogglePopoverOptionsOrBool options) => self -> Maybe options -> m ()
togglePopover_ self options = liftDOM (void ((Types.toHTMLElement self) ^. jsf "togglePopover" [P.maybe (P.return jsUndefined) toJSVal options]))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/title MDN HTMLElement.title documentation>
setTitle :: (MonadDOM m, IsHTMLElement self, ToJSString val) => self -> val -> m ()
setTitle self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "title" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/title MDN HTMLElement.title documentation>
getTitle :: (MonadDOM m, IsHTMLElement self, FromJSString result) => self -> m result
getTitle self = liftDOM ((((Types.toHTMLElement self) ^. js "title") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/lang MDN HTMLElement.lang documentation>
setLang :: (MonadDOM m, IsHTMLElement self, ToJSString val) => self -> val -> m ()
setLang self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "lang" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/lang MDN HTMLElement.lang documentation>
getLang :: (MonadDOM m, IsHTMLElement self, FromJSString result) => self -> m result
getLang self = liftDOM ((((Types.toHTMLElement self) ^. js "lang") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/translate MDN HTMLElement.translate documentation>
setTranslate :: (MonadDOM m, IsHTMLElement self) => self -> Bool -> m ()
setTranslate self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "translate" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/translate MDN HTMLElement.translate documentation>
getTranslate :: (MonadDOM m, IsHTMLElement self) => self -> m Bool
getTranslate self = liftDOM ((((Types.toHTMLElement self) ^. js "translate") >>= valToBool))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/dir MDN HTMLElement.dir documentation>
setDir :: (MonadDOM m, IsHTMLElement self, ToJSString val) => self -> val -> m ()
setDir self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "dir" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/dir MDN HTMLElement.dir documentation>
getDir :: (MonadDOM m, IsHTMLElement self, FromJSString result) => self -> m result
getDir self = liftDOM ((((Types.toHTMLElement self) ^. js "dir") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/hidden MDN HTMLElement.hidden documentation>
setHidden :: (MonadDOM m, IsHTMLElement self, IsBoolOrDoubleOrString val) => self -> Maybe val -> m ()
setHidden self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "hidden" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/hidden MDN HTMLElement.hidden documentation>
getHidden :: (MonadDOM m, IsHTMLElement self) => self -> m (Maybe BoolOrDoubleOrString)
getHidden self = liftDOM ((((Types.toHTMLElement self) ^. js "hidden") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/hidden MDN HTMLElement.hidden documentation>
getHiddenUnsafe :: (MonadDOM m, IsHTMLElement self, HasCallStack) => self -> m BoolOrDoubleOrString
getHiddenUnsafe self = liftDOM (((((Types.toHTMLElement self) ^. js "hidden") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/hidden MDN HTMLElement.hidden documentation>
getHiddenUnchecked :: (MonadDOM m, IsHTMLElement self) => self -> m BoolOrDoubleOrString
getHiddenUnchecked self = liftDOM ((((Types.toHTMLElement self) ^. js "hidden") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/inert MDN HTMLElement.inert documentation>
setInert :: (MonadDOM m, IsHTMLElement self) => self -> Bool -> m ()
setInert self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "inert" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/inert MDN HTMLElement.inert documentation>
getInert :: (MonadDOM m, IsHTMLElement self) => self -> m Bool
getInert self = liftDOM ((((Types.toHTMLElement self) ^. js "inert") >>= valToBool))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/accessKey MDN HTMLElement.accessKey documentation>
setAccessKey :: (MonadDOM m, IsHTMLElement self, ToJSString val) => self -> val -> m ()
setAccessKey self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "accessKey" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/accessKey MDN HTMLElement.accessKey documentation>
getAccessKey :: (MonadDOM m, IsHTMLElement self, FromJSString result) => self -> m result
getAccessKey self = liftDOM ((((Types.toHTMLElement self) ^. js "accessKey") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/accessKeyLabel MDN HTMLElement.accessKeyLabel documentation>
getAccessKeyLabel :: (MonadDOM m, IsHTMLElement self, FromJSString result) => self -> m result
getAccessKeyLabel self = liftDOM ((((Types.toHTMLElement self) ^. js "accessKeyLabel") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/draggable MDN HTMLElement.draggable documentation>
setDraggable :: (MonadDOM m, IsHTMLElement self) => self -> Bool -> m ()
setDraggable self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "draggable" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/draggable MDN HTMLElement.draggable documentation>
getDraggable :: (MonadDOM m, IsHTMLElement self) => self -> m Bool
getDraggable self = liftDOM ((((Types.toHTMLElement self) ^. js "draggable") >>= valToBool))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/spellcheck MDN HTMLElement.spellcheck documentation>
setSpellcheck :: (MonadDOM m, IsHTMLElement self) => self -> Bool -> m ()
setSpellcheck self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "spellcheck" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/spellcheck MDN HTMLElement.spellcheck documentation>
getSpellcheck :: (MonadDOM m, IsHTMLElement self) => self -> m Bool
getSpellcheck self = liftDOM ((((Types.toHTMLElement self) ^. js "spellcheck") >>= valToBool))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/writingSuggestions MDN HTMLElement.writingSuggestions documentation>
setWritingSuggestions :: (MonadDOM m, IsHTMLElement self, ToJSString val) => self -> val -> m ()
setWritingSuggestions self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "writingSuggestions" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/writingSuggestions MDN HTMLElement.writingSuggestions documentation>
getWritingSuggestions :: (MonadDOM m, IsHTMLElement self, FromJSString result) => self -> m result
getWritingSuggestions self = liftDOM ((((Types.toHTMLElement self) ^. js "writingSuggestions") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/autocapitalize MDN HTMLElement.autocapitalize documentation>
setAutocapitalize :: (MonadDOM m, IsHTMLElement self, ToJSString val) => self -> val -> m ()
setAutocapitalize self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "autocapitalize" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/autocapitalize MDN HTMLElement.autocapitalize documentation>
getAutocapitalize :: (MonadDOM m, IsHTMLElement self, FromJSString result) => self -> m result
getAutocapitalize self = liftDOM ((((Types.toHTMLElement self) ^. js "autocapitalize") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/autocorrect MDN HTMLElement.autocorrect documentation>
setAutocorrect :: (MonadDOM m, IsHTMLElement self) => self -> Bool -> m ()
setAutocorrect self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "autocorrect" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/autocorrect MDN HTMLElement.autocorrect documentation>
getAutocorrect :: (MonadDOM m, IsHTMLElement self) => self -> m Bool
getAutocorrect self = liftDOM ((((Types.toHTMLElement self) ^. js "autocorrect") >>= valToBool))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/innerText MDN HTMLElement.innerText documentation>
setInnerText :: (MonadDOM m, IsHTMLElement self, ToJSString val) => self -> val -> m ()
setInnerText self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "innerText" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/innerText MDN HTMLElement.innerText documentation>
getInnerText :: (MonadDOM m, IsHTMLElement self, FromJSString result) => self -> m result
getInnerText self = liftDOM ((((Types.toHTMLElement self) ^. js "innerText") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/outerText MDN HTMLElement.outerText documentation>
setOuterText :: (MonadDOM m, IsHTMLElement self, ToJSString val) => self -> val -> m ()
setOuterText self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "outerText" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/outerText MDN HTMLElement.outerText documentation>
getOuterText :: (MonadDOM m, IsHTMLElement self, FromJSString result) => self -> m result
getOuterText self = liftDOM ((((Types.toHTMLElement self) ^. js "outerText") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/popover MDN HTMLElement.popover documentation>
setPopover :: (MonadDOM m, IsHTMLElement self, ToJSString val) => self -> Maybe val -> m ()
setPopover self val = liftDOM (void ((Types.toHTMLElement self) ^. jss "popover" (toJSVal val)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/popover MDN HTMLElement.popover documentation>
getPopover :: (MonadDOM m, IsHTMLElement self, FromJSString result) => self -> m (Maybe result)
getPopover self = liftDOM ((((Types.toHTMLElement self) ^. js "popover") >>= fromMaybeJSString))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/popover MDN HTMLElement.popover documentation>
getPopoverUnsafe :: (MonadDOM m, IsHTMLElement self, HasCallStack, FromJSString result) => self -> m result
getPopoverUnsafe self = liftDOM (((((Types.toHTMLElement self) ^. js "popover") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/popover MDN HTMLElement.popover documentation>
getPopoverUnchecked :: (MonadDOM m, IsHTMLElement self, FromJSString result) => self -> m result
getPopoverUnchecked self = liftDOM ((((Types.toHTMLElement self) ^. js "popover") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/offsetParent MDN HTMLElement.offsetParent documentation>
getOffsetParent :: (MonadDOM m, IsHTMLElement self) => self -> m (Maybe Element)
getOffsetParent self = liftDOM ((((Types.toHTMLElement self) ^. js "offsetParent") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/offsetParent MDN HTMLElement.offsetParent documentation>
getOffsetParentUnsafe :: (MonadDOM m, IsHTMLElement self, HasCallStack) => self -> m Element
getOffsetParentUnsafe self = liftDOM (((((Types.toHTMLElement self) ^. js "offsetParent") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/offsetParent MDN HTMLElement.offsetParent documentation>
getOffsetParentUnchecked :: (MonadDOM m, IsHTMLElement self) => self -> m Element
getOffsetParentUnchecked self = liftDOM ((((Types.toHTMLElement self) ^. js "offsetParent") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/offsetTop MDN HTMLElement.offsetTop documentation>
getOffsetTop :: (MonadDOM m, IsHTMLElement self) => self -> m Int
getOffsetTop self = liftDOM ((P.round <$> (((Types.toHTMLElement self) ^. js "offsetTop") >>= valToNumber)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/offsetLeft MDN HTMLElement.offsetLeft documentation>
getOffsetLeft :: (MonadDOM m, IsHTMLElement self) => self -> m Int
getOffsetLeft self = liftDOM ((P.round <$> (((Types.toHTMLElement self) ^. js "offsetLeft") >>= valToNumber)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/offsetWidth MDN HTMLElement.offsetWidth documentation>
getOffsetWidth :: (MonadDOM m, IsHTMLElement self) => self -> m Int
getOffsetWidth self = liftDOM ((P.round <$> (((Types.toHTMLElement self) ^. js "offsetWidth") >>= valToNumber)))
-- | <https://developer.mozilla.org/docs/Web/API/HTMLElement/offsetHeight MDN HTMLElement.offsetHeight documentation>
getOffsetHeight :: (MonadDOM m, IsHTMLElement self) => self -> m Int
getOffsetHeight self = liftDOM ((P.round <$> (((Types.toHTMLElement self) ^. js "offsetHeight") >>= valToNumber)))
navbeforefocus :: (IsHTMLElement self, IsEventTarget self) => EventName self NavigationEvent
navbeforefocus = unsafeEventName (toJSString "navbeforefocus")
navnotarget :: (IsHTMLElement self, IsEventTarget self) => EventName self NavigationEvent
navnotarget = unsafeEventName (toJSString "navnotarget")