{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
#if !MIN_VERSION_base(4,9,0)
{-# LANGUAGE ImpredicativeTypes #-}
#endif
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
#ifdef USE_TEMPLATE_HASKELL
{-# LANGUAGE TemplateHaskell #-}
#endif
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Reflex.Dom.Builder.Class
       ( module Reflex.Dom.Builder.Class
       , module Reflex.Dom.Builder.Class.Events
       , module Reflex.NotReady.Class
       ) where

import Reflex.Adjustable.Class
import Reflex.Class as Reflex
import Reflex.Dom.Builder.Class.Events
#ifdef USE_TEMPLATE_HASKELL
import Reflex.Dom.Builder.Class.TH
#endif
import Reflex.BehaviorWriter.Base
import Reflex.DynamicWriter.Base
import Reflex.EventWriter.Base
import Reflex.NotReady.Class
import Reflex.PerformEvent.Class
import Reflex.PostBuild.Base
import Reflex.Query.Base
import Reflex.Query.Class
import Reflex.Requester.Base

import qualified Control.Category
import Control.Lens hiding (element)
import Control.Monad.Reader
import qualified Control.Monad.State as Lazy
import Control.Monad.State.Strict
import Control.Monad.Trans.Control
import Data.Default
import Data.Functor.Misc
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe
import Data.Proxy
import Data.Semigroup
import Data.String
import Data.Text (Text)
import Data.Type.Coercion
import GHCJS.DOM.Types (JSM)
import qualified GHCJS.DOM.Types as DOM

class Default (EventSpec d EventResult) => DomSpace d where
  type EventSpec d :: (EventTag -> *) -> *
  type RawDocument d :: *
  type RawTextNode d :: *
  type RawCommentNode d :: *
  type RawElement d :: *
  type RawInputElement d :: *
  type RawTextAreaElement d :: *
  type RawSelectElement d :: *
  addEventSpecFlags :: proxy d -> EventName en -> (Maybe (er en) -> EventFlags) -> EventSpec d er -> EventSpec d er

-- | @'DomBuilder' t m@ indicates that @m@ is a 'Monad' capable of building
-- dynamic DOM in the 'Reflex' timeline @t@
class (Monad m, Reflex t, DomSpace (DomBuilderSpace m), NotReady t m, Adjustable t m) => DomBuilder t m | m -> t where
  type DomBuilderSpace m :: *
  textNode :: TextNodeConfig t -> m (TextNode (DomBuilderSpace m) t)
  default textNode :: ( MonadTrans f
                      , m ~ f m'
                      , DomBuilderSpace m' ~ DomBuilderSpace m
                      , DomBuilder t m'
                      )
                   => TextNodeConfig t -> m (TextNode (DomBuilderSpace m) t)
  textNode = m' (TextNode (DomBuilderSpace m') t)
-> f m' (TextNode (DomBuilderSpace m') t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m' (TextNode (DomBuilderSpace m') t)
 -> f m' (TextNode (DomBuilderSpace m') t))
-> (TextNodeConfig t -> m' (TextNode (DomBuilderSpace m') t))
-> TextNodeConfig t
-> f m' (TextNode (DomBuilderSpace m') t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TextNodeConfig t -> m' (TextNode (DomBuilderSpace m') t)
forall t (m :: * -> *).
DomBuilder t m =>
TextNodeConfig t -> m (TextNode (DomBuilderSpace m) t)
textNode
  {-# INLINABLE textNode #-}
  commentNode :: CommentNodeConfig t -> m (CommentNode (DomBuilderSpace m) t)
  default commentNode :: ( MonadTrans f
                      , m ~ f m'
                      , DomBuilderSpace m' ~ DomBuilderSpace m
                      , DomBuilder t m'
                      )
                   => CommentNodeConfig t -> m (CommentNode (DomBuilderSpace m) t)
  commentNode = m' (CommentNode (DomBuilderSpace m') t)
-> f m' (CommentNode (DomBuilderSpace m') t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m' (CommentNode (DomBuilderSpace m') t)
 -> f m' (CommentNode (DomBuilderSpace m') t))
-> (CommentNodeConfig t -> m' (CommentNode (DomBuilderSpace m') t))
-> CommentNodeConfig t
-> f m' (CommentNode (DomBuilderSpace m') t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CommentNodeConfig t -> m' (CommentNode (DomBuilderSpace m') t)
forall t (m :: * -> *).
DomBuilder t m =>
CommentNodeConfig t -> m (CommentNode (DomBuilderSpace m) t)
commentNode
  {-# INLINABLE commentNode #-}
  element :: Text -> ElementConfig er t (DomBuilderSpace m) -> m a -> m (Element er (DomBuilderSpace m) t, a)
  default element :: ( MonadTransControl f
                     , StT f a ~ a
                     , m ~ f m'
                     , DomBuilderSpace m' ~ DomBuilderSpace m
                     , DomBuilder t m'
                     )
                  => Text -> ElementConfig er t (DomBuilderSpace m) -> m a -> m (Element er (DomBuilderSpace m) t, a)
  element t :: Text
t cfg :: ElementConfig er t (DomBuilderSpace m)
cfg child :: m a
child = (Run f -> m' (Element er (DomBuilderSpace m) t, a))
-> m (Element er (DomBuilderSpace m) t, a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTransControl t, Monad m) =>
(Run t -> m a) -> t m a
liftWith ((Run f -> m' (Element er (DomBuilderSpace m) t, a))
 -> m (Element er (DomBuilderSpace m) t, a))
-> (Run f -> m' (Element er (DomBuilderSpace m) t, a))
-> m (Element er (DomBuilderSpace m) t, a)
forall a b. (a -> b) -> a -> b
$ \run :: Run f
run -> Text
-> ElementConfig er t (DomBuilderSpace m')
-> m' a
-> m' (Element er (DomBuilderSpace m') t, a)
forall t (m :: * -> *) (er :: EventTag -> *) a.
DomBuilder t m =>
Text
-> ElementConfig er t (DomBuilderSpace m)
-> m a
-> m (Element er (DomBuilderSpace m) t, a)
element Text
t ElementConfig er t (DomBuilderSpace m)
ElementConfig er t (DomBuilderSpace m')
cfg (m' a -> m' (Element er (DomBuilderSpace m) t, a))
-> m' a -> m' (Element er (DomBuilderSpace m) t, a)
forall a b. (a -> b) -> a -> b
$ f m' a -> m' (StT f a)
Run f
run m a
f m' a
child
  {-# INLINABLE element #-}
  inputElement :: InputElementConfig er t (DomBuilderSpace m) -> m (InputElement er (DomBuilderSpace m) t)
  default inputElement :: ( MonadTransControl f
                          , m ~ f m'
                          , DomBuilderSpace m' ~ DomBuilderSpace m
                          , DomBuilder t m'
                          )
                       => InputElementConfig er t (DomBuilderSpace m) -> m (InputElement er (DomBuilderSpace m) t)
  inputElement = m' (InputElement er (DomBuilderSpace m') t)
-> f m' (InputElement er (DomBuilderSpace m') t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m' (InputElement er (DomBuilderSpace m') t)
 -> f m' (InputElement er (DomBuilderSpace m') t))
-> (InputElementConfig er t (DomBuilderSpace m')
    -> m' (InputElement er (DomBuilderSpace m') t))
-> InputElementConfig er t (DomBuilderSpace m')
-> f m' (InputElement er (DomBuilderSpace m') t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. InputElementConfig er t (DomBuilderSpace m')
-> m' (InputElement er (DomBuilderSpace m') t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
InputElementConfig er t (DomBuilderSpace m)
-> m (InputElement er (DomBuilderSpace m) t)
inputElement
  {-# INLINABLE inputElement #-}
  textAreaElement :: TextAreaElementConfig er t (DomBuilderSpace m) -> m (TextAreaElement er (DomBuilderSpace m) t)
  default textAreaElement :: ( MonadTransControl f
                             , m ~ f m'
                             , DomBuilderSpace m' ~ DomBuilderSpace m
                             , DomBuilder t m'
                             )
                          => TextAreaElementConfig er t (DomBuilderSpace m) -> m (TextAreaElement er (DomBuilderSpace m) t)
  textAreaElement = m' (TextAreaElement er (DomBuilderSpace m') t)
-> f m' (TextAreaElement er (DomBuilderSpace m') t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m' (TextAreaElement er (DomBuilderSpace m') t)
 -> f m' (TextAreaElement er (DomBuilderSpace m') t))
-> (TextAreaElementConfig er t (DomBuilderSpace m')
    -> m' (TextAreaElement er (DomBuilderSpace m') t))
-> TextAreaElementConfig er t (DomBuilderSpace m')
-> f m' (TextAreaElement er (DomBuilderSpace m') t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TextAreaElementConfig er t (DomBuilderSpace m')
-> m' (TextAreaElement er (DomBuilderSpace m') t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
TextAreaElementConfig er t (DomBuilderSpace m)
-> m (TextAreaElement er (DomBuilderSpace m) t)
textAreaElement
  {-# INLINABLE textAreaElement #-}
  selectElement :: SelectElementConfig er t (DomBuilderSpace m) -> m a -> m (SelectElement er (DomBuilderSpace m) t, a)
  default selectElement :: ( MonadTransControl f
                           , StT f a ~ a
                           , m ~ f m'
                           , DomBuilderSpace m' ~ DomBuilderSpace m
                           , DomBuilder t m'
                           )
                        => SelectElementConfig er t (DomBuilderSpace m) -> m a -> m (SelectElement er (DomBuilderSpace m) t, a)
  selectElement cfg :: SelectElementConfig er t (DomBuilderSpace m)
cfg child :: m a
child = do
    (Run f -> m' (SelectElement er (DomBuilderSpace m) t, a))
-> m (SelectElement er (DomBuilderSpace m) t, a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTransControl t, Monad m) =>
(Run t -> m a) -> t m a
liftWith ((Run f -> m' (SelectElement er (DomBuilderSpace m) t, a))
 -> m (SelectElement er (DomBuilderSpace m) t, a))
-> (Run f -> m' (SelectElement er (DomBuilderSpace m) t, a))
-> m (SelectElement er (DomBuilderSpace m) t, a)
forall a b. (a -> b) -> a -> b
$ \run :: Run f
run -> SelectElementConfig er t (DomBuilderSpace m')
-> m' a -> m' (SelectElement er (DomBuilderSpace m') t, a)
forall t (m :: * -> *) (er :: EventTag -> *) a.
DomBuilder t m =>
SelectElementConfig er t (DomBuilderSpace m)
-> m a -> m (SelectElement er (DomBuilderSpace m) t, a)
selectElement SelectElementConfig er t (DomBuilderSpace m)
SelectElementConfig er t (DomBuilderSpace m')
cfg (m' a -> m' (SelectElement er (DomBuilderSpace m) t, a))
-> m' a -> m' (SelectElement er (DomBuilderSpace m) t, a)
forall a b. (a -> b) -> a -> b
$ f m' a -> m' (StT f a)
Run f
run m a
f m' a
child
  {-# INLINABLE selectElement #-}
  placeRawElement :: RawElement (DomBuilderSpace m) -> m ()
  default placeRawElement :: ( MonadTrans f
                             , m ~ f m'
                             , DomBuilderSpace m' ~ DomBuilderSpace m
                             , DomBuilder t m'
                             )
                          => RawElement (DomBuilderSpace m) -> m ()
  placeRawElement = m' () -> f m' ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m' () -> f m' ())
-> (RawElement (DomBuilderSpace m) -> m' ())
-> RawElement (DomBuilderSpace m)
-> f m' ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawElement (DomBuilderSpace m) -> m' ()
forall t (m :: * -> *).
DomBuilder t m =>
RawElement (DomBuilderSpace m) -> m ()
placeRawElement
  {-# INLINABLE placeRawElement #-}
  wrapRawElement :: RawElement (DomBuilderSpace m) -> RawElementConfig er t (DomBuilderSpace m) -> m (Element er (DomBuilderSpace m) t)
  default wrapRawElement :: ( MonadTrans f
                            , m ~ f m'
                            , DomBuilderSpace m' ~ DomBuilderSpace m
                            , DomBuilder t m'
                            )
                         => RawElement (DomBuilderSpace m) -> RawElementConfig er t (DomBuilderSpace m) -> m (Element er (DomBuilderSpace m) t)
  wrapRawElement e :: RawElement (DomBuilderSpace m)
e cfg :: RawElementConfig er t (DomBuilderSpace m)
cfg = m' (Element er (DomBuilderSpace m') t)
-> m (Element er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m' (Element er (DomBuilderSpace m') t)
 -> m (Element er (DomBuilderSpace m) t))
-> m' (Element er (DomBuilderSpace m') t)
-> m (Element er (DomBuilderSpace m) t)
forall a b. (a -> b) -> a -> b
$ RawElement (DomBuilderSpace m')
-> RawElementConfig er t (DomBuilderSpace m')
-> m' (Element er (DomBuilderSpace m') t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
RawElement (DomBuilderSpace m)
-> RawElementConfig er t (DomBuilderSpace m)
-> m (Element er (DomBuilderSpace m) t)
wrapRawElement RawElement (DomBuilderSpace m)
RawElement (DomBuilderSpace m')
e (RawElementConfig er t (DomBuilderSpace m')
 -> m' (Element er (DomBuilderSpace m') t))
-> RawElementConfig er t (DomBuilderSpace m')
-> m' (Element er (DomBuilderSpace m') t)
forall a b. (a -> b) -> a -> b
$ RawElementConfig er t (DomBuilderSpace m)
cfg
    { _rawElementConfig_eventSpec :: EventSpec (DomBuilderSpace m) er
_rawElementConfig_eventSpec = RawElementConfig er t (DomBuilderSpace m)
-> EventSpec (DomBuilderSpace m) er
forall (er :: EventTag -> *) k (t :: k) k (s :: k).
RawElementConfig er t s -> EventSpec s er
_rawElementConfig_eventSpec RawElementConfig er t (DomBuilderSpace m)
cfg
    }
  {-# INLINABLE wrapRawElement #-}

class DomBuilder t m => MountableDomBuilder t m where
  type DomFragment m :: *
  buildDomFragment :: m a -> m (DomFragment m, a)
  mountDomFragment :: DomFragment m -> Event t (DomFragment m) -> m ()

type Namespace = Text

data TextNodeConfig t
   = TextNodeConfig { TextNodeConfig t -> Text
_textNodeConfig_initialContents :: {-# UNPACK #-} !Text
                    , TextNodeConfig t -> Maybe (Event t Text)
_textNodeConfig_setContents :: !(Maybe (Event t Text))
                    }

#ifndef USE_TEMPLATE_HASKELL
textNodeConfig_initialContents :: Lens' (TextNodeConfig t) Text
textNodeConfig_initialContents f (TextNodeConfig a b) = (\a' -> TextNodeConfig a' b) <$> f a
{-# INLINE textNodeConfig_initialContents #-}
#endif

instance (Reflex t) => Default (TextNodeConfig t) where
  {-# INLINABLE def #-}
  def :: TextNodeConfig t
def = $WTextNodeConfig :: forall k (t :: k). Text -> Maybe (Event t Text) -> TextNodeConfig t
TextNodeConfig
    { _textNodeConfig_initialContents :: Text
_textNodeConfig_initialContents = Text
forall a. Monoid a => a
mempty
    , _textNodeConfig_setContents :: Maybe (Event t Text)
_textNodeConfig_setContents = Maybe (Event t Text)
forall a. Maybe a
Nothing
    }

newtype TextNode d t = TextNode
  { TextNode d t -> RawTextNode d
_textNode_raw :: RawTextNode d
  }

data CommentNodeConfig t
   = CommentNodeConfig { CommentNodeConfig t -> Text
_commentNodeConfig_initialContents :: {-# UNPACK #-} !Text
                       , CommentNodeConfig t -> Maybe (Event t Text)
_commentNodeConfig_setContents :: !(Maybe (Event t Text))
                       }

#ifndef USE_TEMPLATE_HASKELL
commentNodeConfig_initialContents :: Lens' (CommentNodeConfig t) Text
commentNodeConfig_initialContents f (CommentNodeConfig a b) = (\a' -> CommentNodeConfig a' b) <$> f a
{-# INLINE commentNodeConfig_initialContents #-}
#endif

instance (Reflex t) => Default (CommentNodeConfig t) where
  {-# INLINABLE def #-}
  def :: CommentNodeConfig t
def = $WCommentNodeConfig :: forall k (t :: k).
Text -> Maybe (Event t Text) -> CommentNodeConfig t
CommentNodeConfig
    { _commentNodeConfig_initialContents :: Text
_commentNodeConfig_initialContents = Text
forall a. Monoid a => a
mempty
    , _commentNodeConfig_setContents :: Maybe (Event t Text)
_commentNodeConfig_setContents = Maybe (Event t Text)
forall a. Maybe a
Nothing
    }

newtype CommentNode d t = CommentNode
  { CommentNode d t -> RawCommentNode d
_commentNode_raw :: RawCommentNode d
  }

data AttributeName = AttributeName !(Maybe Namespace) !Text deriving (Int -> AttributeName -> ShowS
[AttributeName] -> ShowS
AttributeName -> String
(Int -> AttributeName -> ShowS)
-> (AttributeName -> String)
-> ([AttributeName] -> ShowS)
-> Show AttributeName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttributeName] -> ShowS
$cshowList :: [AttributeName] -> ShowS
show :: AttributeName -> String
$cshow :: AttributeName -> String
showsPrec :: Int -> AttributeName -> ShowS
$cshowsPrec :: Int -> AttributeName -> ShowS
Show, ReadPrec [AttributeName]
ReadPrec AttributeName
Int -> ReadS AttributeName
ReadS [AttributeName]
(Int -> ReadS AttributeName)
-> ReadS [AttributeName]
-> ReadPrec AttributeName
-> ReadPrec [AttributeName]
-> Read AttributeName
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttributeName]
$creadListPrec :: ReadPrec [AttributeName]
readPrec :: ReadPrec AttributeName
$creadPrec :: ReadPrec AttributeName
readList :: ReadS [AttributeName]
$creadList :: ReadS [AttributeName]
readsPrec :: Int -> ReadS AttributeName
$creadsPrec :: Int -> ReadS AttributeName
Read, AttributeName -> AttributeName -> Bool
(AttributeName -> AttributeName -> Bool)
-> (AttributeName -> AttributeName -> Bool) -> Eq AttributeName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttributeName -> AttributeName -> Bool
$c/= :: AttributeName -> AttributeName -> Bool
== :: AttributeName -> AttributeName -> Bool
$c== :: AttributeName -> AttributeName -> Bool
Eq, Eq AttributeName
Eq AttributeName =>
(AttributeName -> AttributeName -> Ordering)
-> (AttributeName -> AttributeName -> Bool)
-> (AttributeName -> AttributeName -> Bool)
-> (AttributeName -> AttributeName -> Bool)
-> (AttributeName -> AttributeName -> Bool)
-> (AttributeName -> AttributeName -> AttributeName)
-> (AttributeName -> AttributeName -> AttributeName)
-> Ord AttributeName
AttributeName -> AttributeName -> Bool
AttributeName -> AttributeName -> Ordering
AttributeName -> AttributeName -> AttributeName
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AttributeName -> AttributeName -> AttributeName
$cmin :: AttributeName -> AttributeName -> AttributeName
max :: AttributeName -> AttributeName -> AttributeName
$cmax :: AttributeName -> AttributeName -> AttributeName
>= :: AttributeName -> AttributeName -> Bool
$c>= :: AttributeName -> AttributeName -> Bool
> :: AttributeName -> AttributeName -> Bool
$c> :: AttributeName -> AttributeName -> Bool
<= :: AttributeName -> AttributeName -> Bool
$c<= :: AttributeName -> AttributeName -> Bool
< :: AttributeName -> AttributeName -> Bool
$c< :: AttributeName -> AttributeName -> Bool
compare :: AttributeName -> AttributeName -> Ordering
$ccompare :: AttributeName -> AttributeName -> Ordering
$cp1Ord :: Eq AttributeName
Ord)

mapKeysToAttributeName :: Map Text v -> Map AttributeName v
mapKeysToAttributeName :: Map Text v -> Map AttributeName v
mapKeysToAttributeName = (Text -> AttributeName) -> Map Text v -> Map AttributeName v
forall k1 k2 a. (k1 -> k2) -> Map k1 a -> Map k2 a
Map.mapKeysMonotonic (Maybe Text -> Text -> AttributeName
AttributeName Maybe Text
forall a. Maybe a
Nothing)

-- | By default, AttributeNames are unnamespaced
instance IsString AttributeName where
  fromString :: String -> AttributeName
fromString = Maybe Text -> Text -> AttributeName
AttributeName Maybe Text
forall a. Maybe a
Nothing (Text -> AttributeName)
-> (String -> Text) -> String -> AttributeName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
forall a. IsString a => String -> a
fromString

data Propagation
   = Propagation_Continue
   | Propagation_Stop
   | Propagation_StopImmediate
   deriving (Int -> Propagation -> ShowS
[Propagation] -> ShowS
Propagation -> String
(Int -> Propagation -> ShowS)
-> (Propagation -> String)
-> ([Propagation] -> ShowS)
-> Show Propagation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Propagation] -> ShowS
$cshowList :: [Propagation] -> ShowS
show :: Propagation -> String
$cshow :: Propagation -> String
showsPrec :: Int -> Propagation -> ShowS
$cshowsPrec :: Int -> Propagation -> ShowS
Show, ReadPrec [Propagation]
ReadPrec Propagation
Int -> ReadS Propagation
ReadS [Propagation]
(Int -> ReadS Propagation)
-> ReadS [Propagation]
-> ReadPrec Propagation
-> ReadPrec [Propagation]
-> Read Propagation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Propagation]
$creadListPrec :: ReadPrec [Propagation]
readPrec :: ReadPrec Propagation
$creadPrec :: ReadPrec Propagation
readList :: ReadS [Propagation]
$creadList :: ReadS [Propagation]
readsPrec :: Int -> ReadS Propagation
$creadsPrec :: Int -> ReadS Propagation
Read, Propagation -> Propagation -> Bool
(Propagation -> Propagation -> Bool)
-> (Propagation -> Propagation -> Bool) -> Eq Propagation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Propagation -> Propagation -> Bool
$c/= :: Propagation -> Propagation -> Bool
== :: Propagation -> Propagation -> Bool
$c== :: Propagation -> Propagation -> Bool
Eq, Eq Propagation
Eq Propagation =>
(Propagation -> Propagation -> Ordering)
-> (Propagation -> Propagation -> Bool)
-> (Propagation -> Propagation -> Bool)
-> (Propagation -> Propagation -> Bool)
-> (Propagation -> Propagation -> Bool)
-> (Propagation -> Propagation -> Propagation)
-> (Propagation -> Propagation -> Propagation)
-> Ord Propagation
Propagation -> Propagation -> Bool
Propagation -> Propagation -> Ordering
Propagation -> Propagation -> Propagation
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Propagation -> Propagation -> Propagation
$cmin :: Propagation -> Propagation -> Propagation
max :: Propagation -> Propagation -> Propagation
$cmax :: Propagation -> Propagation -> Propagation
>= :: Propagation -> Propagation -> Bool
$c>= :: Propagation -> Propagation -> Bool
> :: Propagation -> Propagation -> Bool
$c> :: Propagation -> Propagation -> Bool
<= :: Propagation -> Propagation -> Bool
$c<= :: Propagation -> Propagation -> Bool
< :: Propagation -> Propagation -> Bool
$c< :: Propagation -> Propagation -> Bool
compare :: Propagation -> Propagation -> Ordering
$ccompare :: Propagation -> Propagation -> Ordering
$cp1Ord :: Eq Propagation
Ord)

instance Semigroup Propagation where
  {-# INLINABLE (<>) #-}
  <> :: Propagation -> Propagation -> Propagation
(<>) = Propagation -> Propagation -> Propagation
forall a. Ord a => a -> a -> a
max

instance Monoid Propagation where
  {-# INLINABLE mempty #-}
  mempty :: Propagation
mempty = Propagation
Propagation_Continue
  {-# INLINABLE mappend #-}
  mappend :: Propagation -> Propagation -> Propagation
mappend = Propagation -> Propagation -> Propagation
forall a. Semigroup a => a -> a -> a
(<>)

data EventFlags = EventFlags --TODO: Monoid; ways of building each flag
  { EventFlags -> Propagation
_eventFlags_propagation :: Propagation
  , EventFlags -> Bool
_eventFlags_preventDefault :: Bool
  }

instance Semigroup EventFlags where
  {-# INLINABLE (<>) #-}
  EventFlags p :: Propagation
p pd :: Bool
pd <> :: EventFlags -> EventFlags -> EventFlags
<> EventFlags p' :: Propagation
p' pd' :: Bool
pd' = Propagation -> Bool -> EventFlags
EventFlags (Propagation
p Propagation -> Propagation -> Propagation
forall a. Semigroup a => a -> a -> a
<> Propagation
p') (Bool
pd Bool -> Bool -> Bool
|| Bool
pd')

instance Monoid EventFlags where
  {-# INLINABLE mempty #-}
  mempty :: EventFlags
mempty = Propagation -> Bool -> EventFlags
EventFlags Propagation
Propagation_Continue Bool
False
  {-# INLINABLE mappend #-}
  mappend :: EventFlags -> EventFlags -> EventFlags
mappend = EventFlags -> EventFlags -> EventFlags
forall a. Semigroup a => a -> a -> a
(<>)

preventDefault :: EventFlags
preventDefault :: EventFlags
preventDefault = EventFlags
forall a. Monoid a => a
mempty { _eventFlags_preventDefault :: Bool
_eventFlags_preventDefault = Bool
True }

stopPropagation :: EventFlags
stopPropagation :: EventFlags
stopPropagation = EventFlags
forall a. Monoid a => a
mempty { _eventFlags_propagation :: Propagation
_eventFlags_propagation = Propagation
Propagation_Stop }

data ElementConfig er t s
   = ElementConfig { ElementConfig er t s -> Maybe Text
_elementConfig_namespace :: Maybe Namespace
                   , ElementConfig er t s -> Map AttributeName Text
_elementConfig_initialAttributes :: Map AttributeName Text
                   , ElementConfig er t s
-> Maybe (Event t (Map AttributeName (Maybe Text)))
_elementConfig_modifyAttributes :: Maybe (Event t (Map AttributeName (Maybe Text)))
                   , ElementConfig er t s -> EventSpec s er
_elementConfig_eventSpec :: EventSpec s er
                   }

#ifndef USE_TEMPLATE_HASKELL
elementConfig_namespace :: Lens' (ElementConfig er t s) (Maybe Namespace)
elementConfig_namespace f (ElementConfig a b c d) = (\a' -> ElementConfig a' b c d) <$> f a
{-# INLINE elementConfig_namespace #-}
elementConfig_initialAttributes :: Lens' (ElementConfig er t s) (Map AttributeName Text)
elementConfig_initialAttributes f (ElementConfig a b c d) = (\b' -> ElementConfig a b' c d) <$> f b
{-# INLINE elementConfig_initialAttributes #-}
elementConfig_eventSpec :: Lens
    (ElementConfig er1 t s1)
    (ElementConfig er2 t s2)
    (EventSpec s1 er1)
    (EventSpec s2 er2)
elementConfig_eventSpec f (ElementConfig a b c d) = (\d' -> ElementConfig a b c d') <$> f d
{-# INLINE elementConfig_eventSpec #-}
#endif

data Element er d t
   = Element { Element er d t -> EventSelector t (WrapArg er EventName)
_element_events :: EventSelector t (WrapArg er EventName) --TODO: EventSelector should have two arguments
             , Element er d t -> RawElement d
_element_raw :: RawElement d
             }

data InputElementConfig er t s
   = InputElementConfig { InputElementConfig er t s -> Text
_inputElementConfig_initialValue :: Text
                        , InputElementConfig er t s -> Maybe (Event t Text)
_inputElementConfig_setValue :: Maybe (Event t Text)
                        , InputElementConfig er t s -> Bool
_inputElementConfig_initialChecked :: Bool
                        , InputElementConfig er t s -> Maybe (Event t Bool)
_inputElementConfig_setChecked :: Maybe (Event t Bool)
                        , InputElementConfig er t s -> ElementConfig er t s
_inputElementConfig_elementConfig :: ElementConfig er t s
                        }

#ifndef USE_TEMPLATE_HASKELL
inputElementConfig_initialValue :: Lens' (InputElementConfig er t m) Text
inputElementConfig_initialValue f (InputElementConfig a b c d e) = (\a' -> InputElementConfig a' b c d e) <$> f a
{-# INLINE inputElementConfig_initialValue #-}
inputElementConfig_initialChecked :: Lens' (InputElementConfig er t m) Bool
inputElementConfig_initialChecked f (InputElementConfig a b c d e) = (\c' -> InputElementConfig a b c' d e) <$> f c
{-# INLINE inputElementConfig_initialChecked #-}
inputElementConfig_elementConfig :: Lens
    (InputElementConfig er1 t m1)
    (InputElementConfig er2 t m2)
    (ElementConfig er1 t m1)
    (ElementConfig er2 t m2)
inputElementConfig_elementConfig f (InputElementConfig a b c d e) = (\e' -> InputElementConfig a b c d e') <$> f e
{-# INLINE inputElementConfig_elementConfig #-}
#endif

instance (Reflex t, er ~ EventResult, DomSpace s) => Default (InputElementConfig er t s) where
  {-# INLINABLE def #-}
  def :: InputElementConfig er t s
def = InputElementConfig :: forall k k (er :: EventTag -> *) (t :: k) (s :: k).
Text
-> Maybe (Event t Text)
-> Bool
-> Maybe (Event t Bool)
-> ElementConfig er t s
-> InputElementConfig er t s
InputElementConfig
    { _inputElementConfig_initialValue :: Text
_inputElementConfig_initialValue = ""
    , _inputElementConfig_setValue :: Maybe (Event t Text)
_inputElementConfig_setValue = Maybe (Event t Text)
forall a. Maybe a
Nothing
    , _inputElementConfig_initialChecked :: Bool
_inputElementConfig_initialChecked = Bool
False
    , _inputElementConfig_setChecked :: Maybe (Event t Bool)
_inputElementConfig_setChecked = Maybe (Event t Bool)
forall a. Maybe a
Nothing
    , _inputElementConfig_elementConfig :: ElementConfig er t s
_inputElementConfig_elementConfig = ElementConfig er t s
forall a. Default a => a
def
    }

data InputElement er d t
   = InputElement { InputElement er d t -> Dynamic t Text
_inputElement_value :: Dynamic t Text
                  , InputElement er d t -> Dynamic t Bool
_inputElement_checked :: Dynamic t Bool
                  , InputElement er d t -> Event t Bool
_inputElement_checkedChange :: Event t Bool
                  , InputElement er d t -> Event t Text
_inputElement_input :: Event t Text
                  , InputElement er d t -> Dynamic t Bool
_inputElement_hasFocus :: Dynamic t Bool
                  , InputElement er d t -> Element er d t
_inputElement_element :: Element er d t
                  , InputElement er d t -> RawInputElement d
_inputElement_raw :: RawInputElement d
                  , InputElement er d t -> Dynamic t [File]
_inputElement_files :: Dynamic t [DOM.File]
                  }

data TextAreaElementConfig er t m
   = TextAreaElementConfig { TextAreaElementConfig er t m -> Text
_textAreaElementConfig_initialValue :: Text
                           , TextAreaElementConfig er t m -> Maybe (Event t Text)
_textAreaElementConfig_setValue :: Maybe (Event t Text)
                           , TextAreaElementConfig er t m -> ElementConfig er t m
_textAreaElementConfig_elementConfig :: ElementConfig er t m
                           }

#ifndef USE_TEMPLATE_HASKELL
textAreaElementConfig_initialValue :: Lens' (TextAreaElementConfig er t m) Text
textAreaElementConfig_initialValue f (TextAreaElementConfig a b c) = (\a' -> TextAreaElementConfig a' b c) <$> f a
{-# INLINE textAreaElementConfig_initialValue #-}
textAreaElementConfig_elementConfig :: Lens
    (TextAreaElementConfig er1 t m1)
    (TextAreaElementConfig er2 t m2)
    (ElementConfig er1 t m1)
    (ElementConfig er2 t m2)
textAreaElementConfig_elementConfig f (TextAreaElementConfig a b c) = (\c' -> TextAreaElementConfig a b c') <$> f c
{-# INLINE textAreaElementConfig_elementConfig #-}
#endif

instance (Reflex t, er ~ EventResult, DomSpace s) => Default (TextAreaElementConfig er t s) where
  {-# INLINABLE def #-}
  def :: TextAreaElementConfig er t s
def = TextAreaElementConfig :: forall k k (er :: EventTag -> *) (t :: k) (m :: k).
Text
-> Maybe (Event t Text)
-> ElementConfig er t m
-> TextAreaElementConfig er t m
TextAreaElementConfig
    { _textAreaElementConfig_initialValue :: Text
_textAreaElementConfig_initialValue = ""
    , _textAreaElementConfig_setValue :: Maybe (Event t Text)
_textAreaElementConfig_setValue = Maybe (Event t Text)
forall a. Maybe a
Nothing
    , _textAreaElementConfig_elementConfig :: ElementConfig er t s
_textAreaElementConfig_elementConfig = ElementConfig er t s
forall a. Default a => a
def
    }

data TextAreaElement er d t
   = TextAreaElement { TextAreaElement er d t -> Dynamic t Text
_textAreaElement_value :: Dynamic t Text
                     , TextAreaElement er d t -> Event t Text
_textAreaElement_input :: Event t Text
                     , TextAreaElement er d t -> Dynamic t Bool
_textAreaElement_hasFocus :: Dynamic t Bool
                     , TextAreaElement er d t -> Element er d t
_textAreaElement_element :: Element er d t
                     , TextAreaElement er d t -> RawTextAreaElement d
_textAreaElement_raw :: RawTextAreaElement d
                     }

extractRawElementConfig :: ElementConfig er t m -> RawElementConfig er t m
extractRawElementConfig :: ElementConfig er t m -> RawElementConfig er t m
extractRawElementConfig cfg :: ElementConfig er t m
cfg = RawElementConfig :: forall k k (er :: EventTag -> *) (t :: k) (s :: k).
Maybe (Event t (Map AttributeName (Maybe Text)))
-> EventSpec s er -> RawElementConfig er t s
RawElementConfig
  { _rawElementConfig_modifyAttributes :: Maybe (Event t (Map AttributeName (Maybe Text)))
_rawElementConfig_modifyAttributes = ElementConfig er t m
-> Maybe (Event t (Map AttributeName (Maybe Text)))
forall (er :: EventTag -> *) k (t :: k) k (s :: k).
ElementConfig er t s
-> Maybe (Event t (Map AttributeName (Maybe Text)))
_elementConfig_modifyAttributes ElementConfig er t m
cfg
  , _rawElementConfig_eventSpec :: EventSpec m er
_rawElementConfig_eventSpec = ElementConfig er t m -> EventSpec m er
forall (er :: EventTag -> *) k (t :: k) k (s :: k).
ElementConfig er t s -> EventSpec s er
_elementConfig_eventSpec ElementConfig er t m
cfg
  }

data RawElementConfig er t s = RawElementConfig
  { RawElementConfig er t s
-> Maybe (Event t (Map AttributeName (Maybe Text)))
_rawElementConfig_modifyAttributes :: Maybe (Event t (Map AttributeName (Maybe Text)))
  , RawElementConfig er t s -> EventSpec s er
_rawElementConfig_eventSpec :: EventSpec s er
  }

#ifndef USE_TEMPLATE_HASKELL
rawElementConfig_eventSpec :: Lens
    (RawElementConfig er1 t s1)
    (RawElementConfig er2 t s2)
    (EventSpec s1 er1)
    (EventSpec s2 er2)
rawElementConfig_eventSpec f (RawElementConfig a b) = (\b' -> RawElementConfig a b') <$> f b
{-# INLINE rawElementConfig_eventSpec #-}
#endif

instance (Reflex t, er ~ EventResult, DomSpace s) => Default (RawElementConfig er t s) where
  def :: RawElementConfig er t s
def = RawElementConfig :: forall k k (er :: EventTag -> *) (t :: k) (s :: k).
Maybe (Event t (Map AttributeName (Maybe Text)))
-> EventSpec s er -> RawElementConfig er t s
RawElementConfig
    { _rawElementConfig_modifyAttributes :: Maybe (Event t (Map AttributeName (Maybe Text)))
_rawElementConfig_modifyAttributes = Maybe (Event t (Map AttributeName (Maybe Text)))
forall a. Maybe a
Nothing
    , _rawElementConfig_eventSpec :: EventSpec s er
_rawElementConfig_eventSpec = EventSpec s er
forall a. Default a => a
def
    }

data SelectElementConfig er t m = SelectElementConfig
  { SelectElementConfig er t m -> Text
_selectElementConfig_initialValue :: Text
  , SelectElementConfig er t m -> Maybe (Event t Text)
_selectElementConfig_setValue :: Maybe (Event t Text)
  , SelectElementConfig er t m -> ElementConfig er t m
_selectElementConfig_elementConfig :: ElementConfig er t m
  }

#ifndef USE_TEMPLATE_HASKELL
selectElementConfig_initialValue :: Lens' (SelectElementConfig er t m) Text
selectElementConfig_initialValue f (SelectElementConfig a b c) = (\a' -> SelectElementConfig a' b c) <$> f a
{-# INLINE selectElementConfig_initialValue #-}
selectElementConfig_elementConfig :: Lens
    (SelectElementConfig er1 t m1)
    (SelectElementConfig er2 t m2)
    (ElementConfig er1 t m1)
    (ElementConfig er2 t m2)
selectElementConfig_elementConfig f (SelectElementConfig a b c) = (\c' -> SelectElementConfig a b c') <$> f c
{-# INLINE selectElementConfig_elementConfig #-}
#endif

instance (Reflex t, er ~ EventResult, DomSpace s) => Default (SelectElementConfig er t s) where
  def :: SelectElementConfig er t s
def = SelectElementConfig :: forall k k (er :: EventTag -> *) (t :: k) (m :: k).
Text
-> Maybe (Event t Text)
-> ElementConfig er t m
-> SelectElementConfig er t m
SelectElementConfig
    { _selectElementConfig_initialValue :: Text
_selectElementConfig_initialValue = ""
    , _selectElementConfig_setValue :: Maybe (Event t Text)
_selectElementConfig_setValue = Maybe (Event t Text)
forall a. Maybe a
Nothing
    , _selectElementConfig_elementConfig :: ElementConfig er t s
_selectElementConfig_elementConfig = ElementConfig er t s
forall a. Default a => a
def
    }

data SelectElement er d t = SelectElement
  { SelectElement er d t -> Element er d t
_selectElement_element :: Element er d t
  , SelectElement er d t -> Dynamic t Text
_selectElement_value :: Dynamic t Text
  , SelectElement er d t -> Event t Text
_selectElement_change :: Event t Text -- ^ Fires when the value is changed by the user, but not when it is set by setValue
  , SelectElement er d t -> Dynamic t Bool
_selectElement_hasFocus :: Dynamic t Bool
  , SelectElement er d t -> RawSelectElement d
_selectElement_raw :: RawSelectElement d
  }

#ifdef USE_TEMPLATE_HASKELL
concat <$> mapM (uncurry makeLensesWithoutField)
  [ (["_textNodeConfig_setContents"], ''TextNodeConfig)
  , (["_commentNodeConfig_setContents"], ''CommentNodeConfig)
  , ([ "_inputElementConfig_setValue"
     , "_inputElementConfig_setChecked" ], ''InputElementConfig)
  , (["_rawElementConfig_modifyAttributes"], ''RawElementConfig)
  , (["_elementConfig_modifyAttributes"], ''ElementConfig)
  , (["_textAreaElementConfig_setValue"], ''TextAreaElementConfig)
  , (["_selectElementConfig_setValue"], ''SelectElementConfig)
  ]
#endif

-- | This lens is technically illegal. The implementation of 'TextNodeConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'TextNodeConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
textNodeConfig_setContents :: Reflex t => Lens' (TextNodeConfig t) (Event t Text)
textNodeConfig_setContents :: Lens' (TextNodeConfig t) (Event t Text)
textNodeConfig_setContents =
  let getter :: TextNodeConfig t -> Event t Text
getter = Event t Text -> Maybe (Event t Text) -> Event t Text
forall a. a -> Maybe a -> a
fromMaybe Event t Text
forall k (t :: k) a. Reflex t => Event t a
never (Maybe (Event t Text) -> Event t Text)
-> (TextNodeConfig t -> Maybe (Event t Text))
-> TextNodeConfig t
-> Event t Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TextNodeConfig t -> Maybe (Event t Text)
forall k (t :: k). TextNodeConfig t -> Maybe (Event t Text)
_textNodeConfig_setContents
      setter :: TextNodeConfig t -> Event t Text -> TextNodeConfig t
setter t :: TextNodeConfig t
t e :: Event t Text
e = TextNodeConfig t
t { _textNodeConfig_setContents :: Maybe (Event t Text)
_textNodeConfig_setContents = Event t Text -> Maybe (Event t Text)
forall a. a -> Maybe a
Just Event t Text
e }
  in (TextNodeConfig t -> Event t Text)
-> (TextNodeConfig t -> Event t Text -> TextNodeConfig t)
-> Lens' (TextNodeConfig t) (Event t Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TextNodeConfig t -> Event t Text
getter TextNodeConfig t -> Event t Text -> TextNodeConfig t
forall k k (t :: k) (t :: k).
TextNodeConfig t -> Event t Text -> TextNodeConfig t
setter

-- | This lens is technically illegal. The implementation of 'CommentNodeConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'CommentNodeConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
commentNodeConfig_setContents :: Reflex t => Lens (CommentNodeConfig t) (CommentNodeConfig t) (Event t Text) (Event t Text)
commentNodeConfig_setContents :: Lens
  (CommentNodeConfig t)
  (CommentNodeConfig t)
  (Event t Text)
  (Event t Text)
commentNodeConfig_setContents =
  let getter :: CommentNodeConfig t -> Event t Text
getter = Event t Text -> Maybe (Event t Text) -> Event t Text
forall a. a -> Maybe a -> a
fromMaybe Event t Text
forall k (t :: k) a. Reflex t => Event t a
never (Maybe (Event t Text) -> Event t Text)
-> (CommentNodeConfig t -> Maybe (Event t Text))
-> CommentNodeConfig t
-> Event t Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CommentNodeConfig t -> Maybe (Event t Text)
forall k (t :: k). CommentNodeConfig t -> Maybe (Event t Text)
_commentNodeConfig_setContents
      setter :: CommentNodeConfig t -> Event t Text -> CommentNodeConfig t
setter t :: CommentNodeConfig t
t e :: Event t Text
e = CommentNodeConfig t
t { _commentNodeConfig_setContents :: Maybe (Event t Text)
_commentNodeConfig_setContents = Event t Text -> Maybe (Event t Text)
forall a. a -> Maybe a
Just Event t Text
e }
  in (CommentNodeConfig t -> Event t Text)
-> (CommentNodeConfig t -> Event t Text -> CommentNodeConfig t)
-> Lens
     (CommentNodeConfig t)
     (CommentNodeConfig t)
     (Event t Text)
     (Event t Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens CommentNodeConfig t -> Event t Text
getter CommentNodeConfig t -> Event t Text -> CommentNodeConfig t
forall k k (t :: k) (t :: k).
CommentNodeConfig t -> Event t Text -> CommentNodeConfig t
setter

-- | This lens is technically illegal. The implementation of 'InputElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'InputElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
inputElementConfig_setValue :: Reflex t => Lens' (InputElementConfig er t m) (Event t Text)
inputElementConfig_setValue :: Lens' (InputElementConfig er t m) (Event t Text)
inputElementConfig_setValue =
  let getter :: InputElementConfig er t s -> Event t Text
getter = Event t Text -> Maybe (Event t Text) -> Event t Text
forall a. a -> Maybe a -> a
fromMaybe Event t Text
forall k (t :: k) a. Reflex t => Event t a
never (Maybe (Event t Text) -> Event t Text)
-> (InputElementConfig er t s -> Maybe (Event t Text))
-> InputElementConfig er t s
-> Event t Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. InputElementConfig er t s -> Maybe (Event t Text)
forall (er :: EventTag -> *) k (t :: k) k (s :: k).
InputElementConfig er t s -> Maybe (Event t Text)
_inputElementConfig_setValue
      setter :: InputElementConfig er t s
-> Event t Text -> InputElementConfig er t s
setter t :: InputElementConfig er t s
t e :: Event t Text
e = InputElementConfig er t s
t { _inputElementConfig_setValue :: Maybe (Event t Text)
_inputElementConfig_setValue = Event t Text -> Maybe (Event t Text)
forall a. a -> Maybe a
Just Event t Text
e }
  in (InputElementConfig er t m -> Event t Text)
-> (InputElementConfig er t m
    -> Event t Text -> InputElementConfig er t m)
-> Lens' (InputElementConfig er t m) (Event t Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens InputElementConfig er t m -> Event t Text
forall k (er :: EventTag -> *) (s :: k).
InputElementConfig er t s -> Event t Text
getter InputElementConfig er t m
-> Event t Text -> InputElementConfig er t m
forall k k (er :: EventTag -> *) (t :: k) (s :: k).
InputElementConfig er t s
-> Event t Text -> InputElementConfig er t s
setter

-- | This lens is technically illegal. The implementation of 'InputElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'InputElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
inputElementConfig_setChecked :: Reflex t => Lens' (InputElementConfig er t m) (Event t Bool)
inputElementConfig_setChecked :: Lens' (InputElementConfig er t m) (Event t Bool)
inputElementConfig_setChecked =
  let getter :: InputElementConfig er t s -> Event t Bool
getter = Event t Bool -> Maybe (Event t Bool) -> Event t Bool
forall a. a -> Maybe a -> a
fromMaybe Event t Bool
forall k (t :: k) a. Reflex t => Event t a
never (Maybe (Event t Bool) -> Event t Bool)
-> (InputElementConfig er t s -> Maybe (Event t Bool))
-> InputElementConfig er t s
-> Event t Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. InputElementConfig er t s -> Maybe (Event t Bool)
forall (er :: EventTag -> *) k (t :: k) k (s :: k).
InputElementConfig er t s -> Maybe (Event t Bool)
_inputElementConfig_setChecked
      setter :: InputElementConfig er t s
-> Event t Bool -> InputElementConfig er t s
setter t :: InputElementConfig er t s
t e :: Event t Bool
e = InputElementConfig er t s
t { _inputElementConfig_setChecked :: Maybe (Event t Bool)
_inputElementConfig_setChecked = Event t Bool -> Maybe (Event t Bool)
forall a. a -> Maybe a
Just Event t Bool
e }
  in (InputElementConfig er t m -> Event t Bool)
-> (InputElementConfig er t m
    -> Event t Bool -> InputElementConfig er t m)
-> Lens' (InputElementConfig er t m) (Event t Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens InputElementConfig er t m -> Event t Bool
forall k (er :: EventTag -> *) (s :: k).
InputElementConfig er t s -> Event t Bool
getter InputElementConfig er t m
-> Event t Bool -> InputElementConfig er t m
forall k k (er :: EventTag -> *) (t :: k) (s :: k).
InputElementConfig er t s
-> Event t Bool -> InputElementConfig er t s
setter

-- | This lens is technically illegal. The implementation of 'RawElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'RawElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
rawElementConfig_modifyAttributes :: Reflex t => Lens' (RawElementConfig er t m) (Event t (Map AttributeName (Maybe Text)))
rawElementConfig_modifyAttributes :: Lens'
  (RawElementConfig er t m)
  (Event t (Map AttributeName (Maybe Text)))
rawElementConfig_modifyAttributes =
  let getter :: RawElementConfig er t s -> Event t (Map AttributeName (Maybe Text))
getter = Event t (Map AttributeName (Maybe Text))
-> Maybe (Event t (Map AttributeName (Maybe Text)))
-> Event t (Map AttributeName (Maybe Text))
forall a. a -> Maybe a -> a
fromMaybe Event t (Map AttributeName (Maybe Text))
forall k (t :: k) a. Reflex t => Event t a
never (Maybe (Event t (Map AttributeName (Maybe Text)))
 -> Event t (Map AttributeName (Maybe Text)))
-> (RawElementConfig er t s
    -> Maybe (Event t (Map AttributeName (Maybe Text))))
-> RawElementConfig er t s
-> Event t (Map AttributeName (Maybe Text))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawElementConfig er t s
-> Maybe (Event t (Map AttributeName (Maybe Text)))
forall (er :: EventTag -> *) k (t :: k) k (s :: k).
RawElementConfig er t s
-> Maybe (Event t (Map AttributeName (Maybe Text)))
_rawElementConfig_modifyAttributes
      setter :: RawElementConfig er t s
-> Event t (Map AttributeName (Maybe Text))
-> RawElementConfig er t s
setter t :: RawElementConfig er t s
t e :: Event t (Map AttributeName (Maybe Text))
e = RawElementConfig er t s
t { _rawElementConfig_modifyAttributes :: Maybe (Event t (Map AttributeName (Maybe Text)))
_rawElementConfig_modifyAttributes = Event t (Map AttributeName (Maybe Text))
-> Maybe (Event t (Map AttributeName (Maybe Text)))
forall a. a -> Maybe a
Just Event t (Map AttributeName (Maybe Text))
e }
  in (RawElementConfig er t m
 -> Event t (Map AttributeName (Maybe Text)))
-> (RawElementConfig er t m
    -> Event t (Map AttributeName (Maybe Text))
    -> RawElementConfig er t m)
-> Lens'
     (RawElementConfig er t m)
     (Event t (Map AttributeName (Maybe Text)))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens RawElementConfig er t m -> Event t (Map AttributeName (Maybe Text))
forall k (er :: EventTag -> *) (s :: k).
RawElementConfig er t s -> Event t (Map AttributeName (Maybe Text))
getter RawElementConfig er t m
-> Event t (Map AttributeName (Maybe Text))
-> RawElementConfig er t m
forall k k k (er :: EventTag -> *) (t :: k) (s :: k) (t :: k).
RawElementConfig er t s
-> Event t (Map AttributeName (Maybe Text))
-> RawElementConfig er t s
setter

-- | This lens is technically illegal. The implementation of 'RawElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'RawElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
elementConfig_modifyAttributes :: Reflex t => Lens' (ElementConfig er t m) (Event t (Map AttributeName (Maybe Text)))
elementConfig_modifyAttributes :: Lens'
  (ElementConfig er t m) (Event t (Map AttributeName (Maybe Text)))
elementConfig_modifyAttributes =
  let getter :: ElementConfig er t s -> Event t (Map AttributeName (Maybe Text))
getter = Event t (Map AttributeName (Maybe Text))
-> Maybe (Event t (Map AttributeName (Maybe Text)))
-> Event t (Map AttributeName (Maybe Text))
forall a. a -> Maybe a -> a
fromMaybe Event t (Map AttributeName (Maybe Text))
forall k (t :: k) a. Reflex t => Event t a
never (Maybe (Event t (Map AttributeName (Maybe Text)))
 -> Event t (Map AttributeName (Maybe Text)))
-> (ElementConfig er t s
    -> Maybe (Event t (Map AttributeName (Maybe Text))))
-> ElementConfig er t s
-> Event t (Map AttributeName (Maybe Text))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ElementConfig er t s
-> Maybe (Event t (Map AttributeName (Maybe Text)))
forall (er :: EventTag -> *) k (t :: k) k (s :: k).
ElementConfig er t s
-> Maybe (Event t (Map AttributeName (Maybe Text)))
_elementConfig_modifyAttributes
      setter :: ElementConfig er t s
-> Event t (Map AttributeName (Maybe Text)) -> ElementConfig er t s
setter t :: ElementConfig er t s
t e :: Event t (Map AttributeName (Maybe Text))
e = ElementConfig er t s
t { _elementConfig_modifyAttributes :: Maybe (Event t (Map AttributeName (Maybe Text)))
_elementConfig_modifyAttributes = Event t (Map AttributeName (Maybe Text))
-> Maybe (Event t (Map AttributeName (Maybe Text)))
forall a. a -> Maybe a
Just Event t (Map AttributeName (Maybe Text))
e }
  in (ElementConfig er t m -> Event t (Map AttributeName (Maybe Text)))
-> (ElementConfig er t m
    -> Event t (Map AttributeName (Maybe Text))
    -> ElementConfig er t m)
-> Lens'
     (ElementConfig er t m) (Event t (Map AttributeName (Maybe Text)))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ElementConfig er t m -> Event t (Map AttributeName (Maybe Text))
forall k (er :: EventTag -> *) (s :: k).
ElementConfig er t s -> Event t (Map AttributeName (Maybe Text))
getter ElementConfig er t m
-> Event t (Map AttributeName (Maybe Text)) -> ElementConfig er t m
forall k k k (er :: EventTag -> *) (t :: k) (s :: k) (t :: k).
ElementConfig er t s
-> Event t (Map AttributeName (Maybe Text)) -> ElementConfig er t s
setter

-- | This lens is technically illegal. The implementation of 'TextAreaElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'TextAreaElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
textAreaElementConfig_setValue :: Reflex t => Lens' (TextAreaElementConfig er t m) (Event t Text)
textAreaElementConfig_setValue :: Lens' (TextAreaElementConfig er t m) (Event t Text)
textAreaElementConfig_setValue =
  let getter :: TextAreaElementConfig er t m -> Event t Text
getter = Event t Text -> Maybe (Event t Text) -> Event t Text
forall a. a -> Maybe a -> a
fromMaybe Event t Text
forall k (t :: k) a. Reflex t => Event t a
never (Maybe (Event t Text) -> Event t Text)
-> (TextAreaElementConfig er t m -> Maybe (Event t Text))
-> TextAreaElementConfig er t m
-> Event t Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TextAreaElementConfig er t m -> Maybe (Event t Text)
forall (er :: EventTag -> *) k (t :: k) k (m :: k).
TextAreaElementConfig er t m -> Maybe (Event t Text)
_textAreaElementConfig_setValue
      setter :: TextAreaElementConfig er t m
-> Event t Text -> TextAreaElementConfig er t m
setter t :: TextAreaElementConfig er t m
t e :: Event t Text
e = TextAreaElementConfig er t m
t { _textAreaElementConfig_setValue :: Maybe (Event t Text)
_textAreaElementConfig_setValue = Event t Text -> Maybe (Event t Text)
forall a. a -> Maybe a
Just Event t Text
e }
  in (TextAreaElementConfig er t m -> Event t Text)
-> (TextAreaElementConfig er t m
    -> Event t Text -> TextAreaElementConfig er t m)
-> Lens' (TextAreaElementConfig er t m) (Event t Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens TextAreaElementConfig er t m -> Event t Text
forall k (er :: EventTag -> *) (m :: k).
TextAreaElementConfig er t m -> Event t Text
getter TextAreaElementConfig er t m
-> Event t Text -> TextAreaElementConfig er t m
forall k k (er :: EventTag -> *) (t :: k) (m :: k).
TextAreaElementConfig er t m
-> Event t Text -> TextAreaElementConfig er t m
setter

-- | This lens is technically illegal. The implementation of 'SelectElementConfig' uses a 'Maybe' under the hood for efficiency reasons. However, always interacting with 'SelectElementConfig' via lenses will always behave correctly, and if you pattern match on it, you should always treat 'Nothing' as 'never'.
selectElementConfig_setValue :: Reflex t => Lens' (SelectElementConfig er t m) (Event t Text)
selectElementConfig_setValue :: Lens' (SelectElementConfig er t m) (Event t Text)
selectElementConfig_setValue =
  let getter :: SelectElementConfig er t m -> Event t Text
getter = Event t Text -> Maybe (Event t Text) -> Event t Text
forall a. a -> Maybe a -> a
fromMaybe Event t Text
forall k (t :: k) a. Reflex t => Event t a
never (Maybe (Event t Text) -> Event t Text)
-> (SelectElementConfig er t m -> Maybe (Event t Text))
-> SelectElementConfig er t m
-> Event t Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SelectElementConfig er t m -> Maybe (Event t Text)
forall (er :: EventTag -> *) k (t :: k) k (m :: k).
SelectElementConfig er t m -> Maybe (Event t Text)
_selectElementConfig_setValue
      setter :: SelectElementConfig er t m
-> Event t Text -> SelectElementConfig er t m
setter t :: SelectElementConfig er t m
t e :: Event t Text
e = SelectElementConfig er t m
t { _selectElementConfig_setValue :: Maybe (Event t Text)
_selectElementConfig_setValue = Event t Text -> Maybe (Event t Text)
forall a. a -> Maybe a
Just Event t Text
e }
  in (SelectElementConfig er t m -> Event t Text)
-> (SelectElementConfig er t m
    -> Event t Text -> SelectElementConfig er t m)
-> Lens' (SelectElementConfig er t m) (Event t Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens SelectElementConfig er t m -> Event t Text
forall k (er :: EventTag -> *) (m :: k).
SelectElementConfig er t m -> Event t Text
getter SelectElementConfig er t m
-> Event t Text -> SelectElementConfig er t m
forall k k (er :: EventTag -> *) (t :: k) (m :: k).
SelectElementConfig er t m
-> Event t Text -> SelectElementConfig er t m
setter

class InitialAttributes a where
  initialAttributes :: Lens' a (Map AttributeName Text)

instance InitialAttributes (ElementConfig er t m) where
  {-# INLINABLE initialAttributes #-}
  initialAttributes :: (Map AttributeName Text -> f (Map AttributeName Text))
-> ElementConfig er t m -> f (ElementConfig er t m)
initialAttributes = (Map AttributeName Text -> f (Map AttributeName Text))
-> ElementConfig er t m -> f (ElementConfig er t m)
forall k k (er :: EventTag -> *) (t :: k) (m :: k).
Lens' (ElementConfig er t m) (Map AttributeName Text)
elementConfig_initialAttributes

instance InitialAttributes (InputElementConfig er t m) where
  {-# INLINABLE initialAttributes #-}
  initialAttributes :: (Map AttributeName Text -> f (Map AttributeName Text))
-> InputElementConfig er t m -> f (InputElementConfig er t m)
initialAttributes = (ElementConfig er t m -> f (ElementConfig er t m))
-> InputElementConfig er t m -> f (InputElementConfig er t m)
forall k k k (er :: EventTag -> *) (t :: k) (s :: k)
       (er :: EventTag -> *) (s :: k).
Lens
  (InputElementConfig er t s)
  (InputElementConfig er t s)
  (ElementConfig er t s)
  (ElementConfig er t s)
inputElementConfig_elementConfig ((ElementConfig er t m -> f (ElementConfig er t m))
 -> InputElementConfig er t m -> f (InputElementConfig er t m))
-> ((Map AttributeName Text -> f (Map AttributeName Text))
    -> ElementConfig er t m -> f (ElementConfig er t m))
-> (Map AttributeName Text -> f (Map AttributeName Text))
-> InputElementConfig er t m
-> f (InputElementConfig er t m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Map AttributeName Text -> f (Map AttributeName Text))
-> ElementConfig er t m -> f (ElementConfig er t m)
forall k k (er :: EventTag -> *) (t :: k) (m :: k).
Lens' (ElementConfig er t m) (Map AttributeName Text)
elementConfig_initialAttributes

instance InitialAttributes (TextAreaElementConfig er t m) where
  {-# INLINABLE initialAttributes #-}
  initialAttributes :: (Map AttributeName Text -> f (Map AttributeName Text))
-> TextAreaElementConfig er t m -> f (TextAreaElementConfig er t m)
initialAttributes = (ElementConfig er t m -> f (ElementConfig er t m))
-> TextAreaElementConfig er t m -> f (TextAreaElementConfig er t m)
forall k k k (er :: EventTag -> *) (t :: k) (m :: k)
       (er :: EventTag -> *) (m :: k).
Lens
  (TextAreaElementConfig er t m)
  (TextAreaElementConfig er t m)
  (ElementConfig er t m)
  (ElementConfig er t m)
textAreaElementConfig_elementConfig ((ElementConfig er t m -> f (ElementConfig er t m))
 -> TextAreaElementConfig er t m
 -> f (TextAreaElementConfig er t m))
-> ((Map AttributeName Text -> f (Map AttributeName Text))
    -> ElementConfig er t m -> f (ElementConfig er t m))
-> (Map AttributeName Text -> f (Map AttributeName Text))
-> TextAreaElementConfig er t m
-> f (TextAreaElementConfig er t m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Map AttributeName Text -> f (Map AttributeName Text))
-> ElementConfig er t m -> f (ElementConfig er t m)
forall k k (er :: EventTag -> *) (t :: k) (m :: k).
Lens' (ElementConfig er t m) (Map AttributeName Text)
elementConfig_initialAttributes

instance InitialAttributes (SelectElementConfig er t m) where
  {-# INLINABLE initialAttributes #-}
  initialAttributes :: (Map AttributeName Text -> f (Map AttributeName Text))
-> SelectElementConfig er t m -> f (SelectElementConfig er t m)
initialAttributes = (ElementConfig er t m -> f (ElementConfig er t m))
-> SelectElementConfig er t m -> f (SelectElementConfig er t m)
forall k k k (er :: EventTag -> *) (t :: k) (m :: k)
       (er :: EventTag -> *) (m :: k).
Lens
  (SelectElementConfig er t m)
  (SelectElementConfig er t m)
  (ElementConfig er t m)
  (ElementConfig er t m)
selectElementConfig_elementConfig ((ElementConfig er t m -> f (ElementConfig er t m))
 -> SelectElementConfig er t m -> f (SelectElementConfig er t m))
-> ((Map AttributeName Text -> f (Map AttributeName Text))
    -> ElementConfig er t m -> f (ElementConfig er t m))
-> (Map AttributeName Text -> f (Map AttributeName Text))
-> SelectElementConfig er t m
-> f (SelectElementConfig er t m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Map AttributeName Text -> f (Map AttributeName Text))
-> ElementConfig er t m -> f (ElementConfig er t m)
forall k k (er :: EventTag -> *) (t :: k) (m :: k).
Lens' (ElementConfig er t m) (Map AttributeName Text)
elementConfig_initialAttributes

class ModifyAttributes t a | a -> t where
  modifyAttributes :: Reflex t => Lens' a (Event t (Map AttributeName (Maybe Text)))

instance ModifyAttributes t (ElementConfig er t m) where
  {-# INLINABLE modifyAttributes #-}
  modifyAttributes :: Lens'
  (ElementConfig er t m) (Event t (Map AttributeName (Maybe Text)))
modifyAttributes = (Event t (Map AttributeName (Maybe Text))
 -> f (Event t (Map AttributeName (Maybe Text))))
-> ElementConfig er t m -> f (ElementConfig er t m)
forall k k (t :: k) (er :: EventTag -> *) (m :: k).
Reflex t =>
Lens'
  (ElementConfig er t m) (Event t (Map AttributeName (Maybe Text)))
elementConfig_modifyAttributes

instance ModifyAttributes t (InputElementConfig er t m) where
  {-# INLINABLE modifyAttributes #-}
  modifyAttributes :: Lens'
  (InputElementConfig er t m)
  (Event t (Map AttributeName (Maybe Text)))
modifyAttributes = (ElementConfig er t m -> f (ElementConfig er t m))
-> InputElementConfig er t m -> f (InputElementConfig er t m)
forall k k k (er :: EventTag -> *) (t :: k) (s :: k)
       (er :: EventTag -> *) (s :: k).
Lens
  (InputElementConfig er t s)
  (InputElementConfig er t s)
  (ElementConfig er t s)
  (ElementConfig er t s)
inputElementConfig_elementConfig ((ElementConfig er t m -> f (ElementConfig er t m))
 -> InputElementConfig er t m -> f (InputElementConfig er t m))
-> ((Event t (Map AttributeName (Maybe Text))
     -> f (Event t (Map AttributeName (Maybe Text))))
    -> ElementConfig er t m -> f (ElementConfig er t m))
-> (Event t (Map AttributeName (Maybe Text))
    -> f (Event t (Map AttributeName (Maybe Text))))
-> InputElementConfig er t m
-> f (InputElementConfig er t m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Event t (Map AttributeName (Maybe Text))
 -> f (Event t (Map AttributeName (Maybe Text))))
-> ElementConfig er t m -> f (ElementConfig er t m)
forall k k (t :: k) (er :: EventTag -> *) (m :: k).
Reflex t =>
Lens'
  (ElementConfig er t m) (Event t (Map AttributeName (Maybe Text)))
elementConfig_modifyAttributes

instance ModifyAttributes t (TextAreaElementConfig er t m) where
  {-# INLINABLE modifyAttributes #-}
  modifyAttributes :: Lens'
  (TextAreaElementConfig er t m)
  (Event t (Map AttributeName (Maybe Text)))
modifyAttributes = (ElementConfig er t m -> f (ElementConfig er t m))
-> TextAreaElementConfig er t m -> f (TextAreaElementConfig er t m)
forall k k k (er :: EventTag -> *) (t :: k) (m :: k)
       (er :: EventTag -> *) (m :: k).
Lens
  (TextAreaElementConfig er t m)
  (TextAreaElementConfig er t m)
  (ElementConfig er t m)
  (ElementConfig er t m)
textAreaElementConfig_elementConfig ((ElementConfig er t m -> f (ElementConfig er t m))
 -> TextAreaElementConfig er t m
 -> f (TextAreaElementConfig er t m))
-> ((Event t (Map AttributeName (Maybe Text))
     -> f (Event t (Map AttributeName (Maybe Text))))
    -> ElementConfig er t m -> f (ElementConfig er t m))
-> (Event t (Map AttributeName (Maybe Text))
    -> f (Event t (Map AttributeName (Maybe Text))))
-> TextAreaElementConfig er t m
-> f (TextAreaElementConfig er t m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Event t (Map AttributeName (Maybe Text))
 -> f (Event t (Map AttributeName (Maybe Text))))
-> ElementConfig er t m -> f (ElementConfig er t m)
forall k k (t :: k) (er :: EventTag -> *) (m :: k).
Reflex t =>
Lens'
  (ElementConfig er t m) (Event t (Map AttributeName (Maybe Text)))
elementConfig_modifyAttributes

instance ModifyAttributes t (SelectElementConfig er t m) where
  {-# INLINABLE modifyAttributes #-}
  modifyAttributes :: Lens'
  (SelectElementConfig er t m)
  (Event t (Map AttributeName (Maybe Text)))
modifyAttributes = (ElementConfig er t m -> f (ElementConfig er t m))
-> SelectElementConfig er t m -> f (SelectElementConfig er t m)
forall k k k (er :: EventTag -> *) (t :: k) (m :: k)
       (er :: EventTag -> *) (m :: k).
Lens
  (SelectElementConfig er t m)
  (SelectElementConfig er t m)
  (ElementConfig er t m)
  (ElementConfig er t m)
selectElementConfig_elementConfig ((ElementConfig er t m -> f (ElementConfig er t m))
 -> SelectElementConfig er t m -> f (SelectElementConfig er t m))
-> ((Event t (Map AttributeName (Maybe Text))
     -> f (Event t (Map AttributeName (Maybe Text))))
    -> ElementConfig er t m -> f (ElementConfig er t m))
-> (Event t (Map AttributeName (Maybe Text))
    -> f (Event t (Map AttributeName (Maybe Text))))
-> SelectElementConfig er t m
-> f (SelectElementConfig er t m)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Event t (Map AttributeName (Maybe Text))
 -> f (Event t (Map AttributeName (Maybe Text))))
-> ElementConfig er t m -> f (ElementConfig er t m)
forall k k (t :: k) (er :: EventTag -> *) (m :: k).
Reflex t =>
Lens'
  (ElementConfig er t m) (Event t (Map AttributeName (Maybe Text)))
elementConfig_modifyAttributes

instance ModifyAttributes t (RawElementConfig er t m) where
  {-# INLINABLE modifyAttributes #-}
  modifyAttributes :: Lens'
  (RawElementConfig er t m)
  (Event t (Map AttributeName (Maybe Text)))
modifyAttributes = (Event t (Map AttributeName (Maybe Text))
 -> f (Event t (Map AttributeName (Maybe Text))))
-> RawElementConfig er t m -> f (RawElementConfig er t m)
forall k k (t :: k) (er :: EventTag -> *) (m :: k).
Reflex t =>
Lens'
  (RawElementConfig er t m)
  (Event t (Map AttributeName (Maybe Text)))
rawElementConfig_modifyAttributes

class HasNamespace a where
  namespace :: Lens' a (Maybe Namespace)

instance HasNamespace (ElementConfig er t m) where
  {-# INLINABLE namespace #-}
  namespace :: (Maybe Text -> f (Maybe Text))
-> ElementConfig er t m -> f (ElementConfig er t m)
namespace = (Maybe Text -> f (Maybe Text))
-> ElementConfig er t m -> f (ElementConfig er t m)
forall k k (er :: EventTag -> *) (t :: k) (m :: k).
Lens' (ElementConfig er t m) (Maybe Text)
elementConfig_namespace

instance (Reflex t, er ~ EventResult, DomSpace s) => Default (ElementConfig er t s) where
  {-# INLINABLE def #-}
  def :: ElementConfig er t s
def = ElementConfig :: forall k k (er :: EventTag -> *) (t :: k) (s :: k).
Maybe Text
-> Map AttributeName Text
-> Maybe (Event t (Map AttributeName (Maybe Text)))
-> EventSpec s er
-> ElementConfig er t s
ElementConfig
    { _elementConfig_namespace :: Maybe Text
_elementConfig_namespace = Maybe Text
forall a. Maybe a
Nothing
    , _elementConfig_initialAttributes :: Map AttributeName Text
_elementConfig_initialAttributes = Map AttributeName Text
forall a. Monoid a => a
mempty
    , _elementConfig_modifyAttributes :: Maybe (Event t (Map AttributeName (Maybe Text)))
_elementConfig_modifyAttributes = Maybe (Event t (Map AttributeName (Maybe Text)))
forall a. Maybe a
Nothing
    , _elementConfig_eventSpec :: EventSpec s er
_elementConfig_eventSpec = EventSpec s er
forall a. Default a => a
def
    }

instance (DomBuilder t m, PerformEvent t m, MonadFix m, MonadHold t m) => DomBuilder t (PostBuildT t m) where
  type DomBuilderSpace (PostBuildT t m) = DomBuilderSpace m
  wrapRawElement :: RawElement (DomBuilderSpace (PostBuildT t m))
-> RawElementConfig er t (DomBuilderSpace (PostBuildT t m))
-> PostBuildT t m (Element er (DomBuilderSpace (PostBuildT t m)) t)
wrapRawElement e :: RawElement (DomBuilderSpace (PostBuildT t m))
e = m (Element er (DomBuilderSpace m) t)
-> PostBuildT t m (Element er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (Element er (DomBuilderSpace m) t)
 -> PostBuildT t m (Element er (DomBuilderSpace m) t))
-> (RawElementConfig er t (DomBuilderSpace m)
    -> m (Element er (DomBuilderSpace m) t))
-> RawElementConfig er t (DomBuilderSpace m)
-> PostBuildT t m (Element er (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawElement (DomBuilderSpace m)
-> RawElementConfig er t (DomBuilderSpace m)
-> m (Element er (DomBuilderSpace m) t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
RawElement (DomBuilderSpace m)
-> RawElementConfig er t (DomBuilderSpace m)
-> m (Element er (DomBuilderSpace m) t)
wrapRawElement RawElement (DomBuilderSpace m)
RawElement (DomBuilderSpace (PostBuildT t m))
e

instance (MountableDomBuilder t m, PerformEvent t m, MonadFix m, MonadHold t m) => MountableDomBuilder t (PostBuildT t m) where
  type DomFragment (PostBuildT t m) = DomFragment m
  buildDomFragment :: PostBuildT t m a
-> PostBuildT t m (DomFragment (PostBuildT t m), a)
buildDomFragment = (m (StT (PostBuildT t) a)
 -> m (StT (PostBuildT t) (DomFragment m, a)))
-> PostBuildT t m a -> PostBuildT t m (DomFragment m, a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b.
(MonadTransControl t, Monad (t m), Monad m) =>
(m (StT t a) -> m (StT t b)) -> t m a -> t m b
liftThrough m (StT (PostBuildT t) a)
-> m (StT (PostBuildT t) (DomFragment m, a))
forall t (m :: * -> *) a.
MountableDomBuilder t m =>
m a -> m (DomFragment m, a)
buildDomFragment
  mountDomFragment :: DomFragment (PostBuildT t m)
-> Event t (DomFragment (PostBuildT t m)) -> PostBuildT t m ()
mountDomFragment f0 :: DomFragment (PostBuildT t m)
f0 f' :: Event t (DomFragment (PostBuildT t m))
f' = m () -> PostBuildT t m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> PostBuildT t m ()) -> m () -> PostBuildT t m ()
forall a b. (a -> b) -> a -> b
$ DomFragment m -> Event t (DomFragment m) -> m ()
forall t (m :: * -> *).
MountableDomBuilder t m =>
DomFragment m -> Event t (DomFragment m) -> m ()
mountDomFragment DomFragment m
DomFragment (PostBuildT t m)
f0 Event t (DomFragment m)
Event t (DomFragment (PostBuildT t m))
f'

instance (DomBuilder t m, Monoid w, MonadHold t m, MonadFix m) => DomBuilder t (DynamicWriterT t w m) where
  type DomBuilderSpace (DynamicWriterT t w m) = DomBuilderSpace m
  textNode :: TextNodeConfig t
-> DynamicWriterT
     t w m (TextNode (DomBuilderSpace (DynamicWriterT t w m)) t)
textNode = TextNodeConfig t
-> DynamicWriterT
     t w m (TextNode (DomBuilderSpace (DynamicWriterT t w m)) t)
forall (f :: (* -> *) -> * -> *) t (m :: * -> *).
(MonadTrans f, DomBuilder t m) =>
TextNodeConfig t -> f m (TextNode (DomBuilderSpace m) t)
liftTextNode
  commentNode :: CommentNodeConfig t
-> DynamicWriterT
     t w m (CommentNode (DomBuilderSpace (DynamicWriterT t w m)) t)
commentNode = CommentNodeConfig t
-> DynamicWriterT
     t w m (CommentNode (DomBuilderSpace (DynamicWriterT t w m)) t)
forall (f :: (* -> *) -> * -> *) t (m :: * -> *).
(MonadTrans f, DomBuilder t m) =>
CommentNodeConfig t -> f m (CommentNode (DomBuilderSpace m) t)
liftCommentNode
  element :: Text
-> ElementConfig er t (DomBuilderSpace (DynamicWriterT t w m))
-> DynamicWriterT t w m a
-> DynamicWriterT
     t w m (Element er (DomBuilderSpace (DynamicWriterT t w m)) t, a)
element elementTag :: Text
elementTag cfg :: ElementConfig er t (DomBuilderSpace (DynamicWriterT t w m))
cfg (DynamicWriterT child :: StateT [Dynamic t w] m a
child) = StateT [Dynamic t w] m (Element er (DomBuilderSpace m) t, a)
-> DynamicWriterT
     t w m (Element er (DomBuilderSpace (DynamicWriterT t w m)) t, a)
forall t w (m :: * -> *) a.
StateT [Dynamic t w] m a -> DynamicWriterT t w m a
DynamicWriterT (StateT [Dynamic t w] m (Element er (DomBuilderSpace m) t, a)
 -> DynamicWriterT
      t w m (Element er (DomBuilderSpace (DynamicWriterT t w m)) t, a))
-> StateT [Dynamic t w] m (Element er (DomBuilderSpace m) t, a)
-> DynamicWriterT
     t w m (Element er (DomBuilderSpace (DynamicWriterT t w m)) t, a)
forall a b. (a -> b) -> a -> b
$ do
    [Dynamic t w]
s <- StateT [Dynamic t w] m [Dynamic t w]
forall s (m :: * -> *). MonadState s m => m s
get
    (el :: Element er (DomBuilderSpace m) t
el, (a :: a
a, newS :: [Dynamic t w]
newS)) <- m (Element er (DomBuilderSpace m) t, (a, [Dynamic t w]))
-> StateT
     [Dynamic t w]
     m
     (Element er (DomBuilderSpace m) t, (a, [Dynamic t w]))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (Element er (DomBuilderSpace m) t, (a, [Dynamic t w]))
 -> StateT
      [Dynamic t w]
      m
      (Element er (DomBuilderSpace m) t, (a, [Dynamic t w])))
-> m (Element er (DomBuilderSpace m) t, (a, [Dynamic t w]))
-> StateT
     [Dynamic t w]
     m
     (Element er (DomBuilderSpace m) t, (a, [Dynamic t w]))
forall a b. (a -> b) -> a -> b
$ Text
-> ElementConfig er t (DomBuilderSpace m)
-> m (a, [Dynamic t w])
-> m (Element er (DomBuilderSpace m) t, (a, [Dynamic t w]))
forall t (m :: * -> *) (er :: EventTag -> *) a.
DomBuilder t m =>
Text
-> ElementConfig er t (DomBuilderSpace m)
-> m a
-> m (Element er (DomBuilderSpace m) t, a)
element Text
elementTag ElementConfig er t (DomBuilderSpace m)
ElementConfig er t (DomBuilderSpace (DynamicWriterT t w m))
cfg (m (a, [Dynamic t w])
 -> m (Element er (DomBuilderSpace m) t, (a, [Dynamic t w])))
-> m (a, [Dynamic t w])
-> m (Element er (DomBuilderSpace m) t, (a, [Dynamic t w]))
forall a b. (a -> b) -> a -> b
$ StateT [Dynamic t w] m a -> [Dynamic t w] -> m (a, [Dynamic t w])
forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s)
runStateT StateT [Dynamic t w] m a
child [Dynamic t w]
s
    [Dynamic t w] -> StateT [Dynamic t w] m ()
forall s (m :: * -> *). MonadState s m => s -> m ()
put [Dynamic t w]
newS
    (Element er (DomBuilderSpace m) t, a)
-> StateT [Dynamic t w] m (Element er (DomBuilderSpace m) t, a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Element er (DomBuilderSpace m) t
el, a
a)
  inputElement :: InputElementConfig er t (DomBuilderSpace (DynamicWriterT t w m))
-> DynamicWriterT
     t w m (InputElement er (DomBuilderSpace (DynamicWriterT t w m)) t)
inputElement = m (InputElement er (DomBuilderSpace m) t)
-> DynamicWriterT t w m (InputElement er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (InputElement er (DomBuilderSpace m) t)
 -> DynamicWriterT t w m (InputElement er (DomBuilderSpace m) t))
-> (InputElementConfig er t (DomBuilderSpace m)
    -> m (InputElement er (DomBuilderSpace m) t))
-> InputElementConfig er t (DomBuilderSpace m)
-> DynamicWriterT t w m (InputElement er (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. InputElementConfig er t (DomBuilderSpace m)
-> m (InputElement er (DomBuilderSpace m) t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
InputElementConfig er t (DomBuilderSpace m)
-> m (InputElement er (DomBuilderSpace m) t)
inputElement
  textAreaElement :: TextAreaElementConfig er t (DomBuilderSpace (DynamicWriterT t w m))
-> DynamicWriterT
     t
     w
     m
     (TextAreaElement er (DomBuilderSpace (DynamicWriterT t w m)) t)
textAreaElement = m (TextAreaElement er (DomBuilderSpace m) t)
-> DynamicWriterT t w m (TextAreaElement er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (TextAreaElement er (DomBuilderSpace m) t)
 -> DynamicWriterT t w m (TextAreaElement er (DomBuilderSpace m) t))
-> (TextAreaElementConfig er t (DomBuilderSpace m)
    -> m (TextAreaElement er (DomBuilderSpace m) t))
-> TextAreaElementConfig er t (DomBuilderSpace m)
-> DynamicWriterT t w m (TextAreaElement er (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TextAreaElementConfig er t (DomBuilderSpace m)
-> m (TextAreaElement er (DomBuilderSpace m) t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
TextAreaElementConfig er t (DomBuilderSpace m)
-> m (TextAreaElement er (DomBuilderSpace m) t)
textAreaElement
  selectElement :: SelectElementConfig er t (DomBuilderSpace (DynamicWriterT t w m))
-> DynamicWriterT t w m a
-> DynamicWriterT
     t
     w
     m
     (SelectElement er (DomBuilderSpace (DynamicWriterT t w m)) t, a)
selectElement cfg :: SelectElementConfig er t (DomBuilderSpace (DynamicWriterT t w m))
cfg (DynamicWriterT child :: StateT [Dynamic t w] m a
child) = StateT [Dynamic t w] m (SelectElement er (DomBuilderSpace m) t, a)
-> DynamicWriterT
     t
     w
     m
     (SelectElement er (DomBuilderSpace (DynamicWriterT t w m)) t, a)
forall t w (m :: * -> *) a.
StateT [Dynamic t w] m a -> DynamicWriterT t w m a
DynamicWriterT (StateT [Dynamic t w] m (SelectElement er (DomBuilderSpace m) t, a)
 -> DynamicWriterT
      t
      w
      m
      (SelectElement er (DomBuilderSpace (DynamicWriterT t w m)) t, a))
-> StateT
     [Dynamic t w] m (SelectElement er (DomBuilderSpace m) t, a)
-> DynamicWriterT
     t
     w
     m
     (SelectElement er (DomBuilderSpace (DynamicWriterT t w m)) t, a)
forall a b. (a -> b) -> a -> b
$ do
    [Dynamic t w]
s <- StateT [Dynamic t w] m [Dynamic t w]
forall s (m :: * -> *). MonadState s m => m s
get
    (el :: SelectElement er (DomBuilderSpace m) t
el, (a :: a
a, newS :: [Dynamic t w]
newS)) <- m (SelectElement er (DomBuilderSpace m) t, (a, [Dynamic t w]))
-> StateT
     [Dynamic t w]
     m
     (SelectElement er (DomBuilderSpace m) t, (a, [Dynamic t w]))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SelectElement er (DomBuilderSpace m) t, (a, [Dynamic t w]))
 -> StateT
      [Dynamic t w]
      m
      (SelectElement er (DomBuilderSpace m) t, (a, [Dynamic t w])))
-> m (SelectElement er (DomBuilderSpace m) t, (a, [Dynamic t w]))
-> StateT
     [Dynamic t w]
     m
     (SelectElement er (DomBuilderSpace m) t, (a, [Dynamic t w]))
forall a b. (a -> b) -> a -> b
$ SelectElementConfig er t (DomBuilderSpace m)
-> m (a, [Dynamic t w])
-> m (SelectElement er (DomBuilderSpace m) t, (a, [Dynamic t w]))
forall t (m :: * -> *) (er :: EventTag -> *) a.
DomBuilder t m =>
SelectElementConfig er t (DomBuilderSpace m)
-> m a -> m (SelectElement er (DomBuilderSpace m) t, a)
selectElement SelectElementConfig er t (DomBuilderSpace m)
SelectElementConfig er t (DomBuilderSpace (DynamicWriterT t w m))
cfg (m (a, [Dynamic t w])
 -> m (SelectElement er (DomBuilderSpace m) t, (a, [Dynamic t w])))
-> m (a, [Dynamic t w])
-> m (SelectElement er (DomBuilderSpace m) t, (a, [Dynamic t w]))
forall a b. (a -> b) -> a -> b
$ StateT [Dynamic t w] m a -> [Dynamic t w] -> m (a, [Dynamic t w])
forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s)
runStateT StateT [Dynamic t w] m a
child [Dynamic t w]
s
    [Dynamic t w] -> StateT [Dynamic t w] m ()
forall s (m :: * -> *). MonadState s m => s -> m ()
put [Dynamic t w]
newS
    (SelectElement er (DomBuilderSpace m) t, a)
-> StateT
     [Dynamic t w] m (SelectElement er (DomBuilderSpace m) t, a)
forall (m :: * -> *) a. Monad m => a -> m a
return (SelectElement er (DomBuilderSpace m) t
el, a
a)
  placeRawElement :: RawElement (DomBuilderSpace (DynamicWriterT t w m))
-> DynamicWriterT t w m ()
placeRawElement = m () -> DynamicWriterT t w m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> DynamicWriterT t w m ())
-> (RawElement (DomBuilderSpace m) -> m ())
-> RawElement (DomBuilderSpace m)
-> DynamicWriterT t w m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawElement (DomBuilderSpace m) -> m ()
forall t (m :: * -> *).
DomBuilder t m =>
RawElement (DomBuilderSpace m) -> m ()
placeRawElement
  wrapRawElement :: RawElement (DomBuilderSpace (DynamicWriterT t w m))
-> RawElementConfig er t (DomBuilderSpace (DynamicWriterT t w m))
-> DynamicWriterT
     t w m (Element er (DomBuilderSpace (DynamicWriterT t w m)) t)
wrapRawElement e :: RawElement (DomBuilderSpace (DynamicWriterT t w m))
e = m (Element er (DomBuilderSpace m) t)
-> DynamicWriterT t w m (Element er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (Element er (DomBuilderSpace m) t)
 -> DynamicWriterT t w m (Element er (DomBuilderSpace m) t))
-> (RawElementConfig er t (DomBuilderSpace m)
    -> m (Element er (DomBuilderSpace m) t))
-> RawElementConfig er t (DomBuilderSpace m)
-> DynamicWriterT t w m (Element er (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawElement (DomBuilderSpace m)
-> RawElementConfig er t (DomBuilderSpace m)
-> m (Element er (DomBuilderSpace m) t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
RawElement (DomBuilderSpace m)
-> RawElementConfig er t (DomBuilderSpace m)
-> m (Element er (DomBuilderSpace m) t)
wrapRawElement RawElement (DomBuilderSpace m)
RawElement (DomBuilderSpace (DynamicWriterT t w m))
e

instance (DomBuilder t m, MonadHold t m, MonadFix m) => DomBuilder t (RequesterT t request response m) where
  type DomBuilderSpace (RequesterT t request response m) = DomBuilderSpace m
  textNode :: TextNodeConfig t
-> RequesterT
     t
     request
     response
     m
     (TextNode (DomBuilderSpace (RequesterT t request response m)) t)
textNode = TextNodeConfig t
-> RequesterT
     t
     request
     response
     m
     (TextNode (DomBuilderSpace (RequesterT t request response m)) t)
forall (f :: (* -> *) -> * -> *) t (m :: * -> *).
(MonadTrans f, DomBuilder t m) =>
TextNodeConfig t -> f m (TextNode (DomBuilderSpace m) t)
liftTextNode
  commentNode :: CommentNodeConfig t
-> RequesterT
     t
     request
     response
     m
     (CommentNode (DomBuilderSpace (RequesterT t request response m)) t)
commentNode = CommentNodeConfig t
-> RequesterT
     t
     request
     response
     m
     (CommentNode (DomBuilderSpace (RequesterT t request response m)) t)
forall (f :: (* -> *) -> * -> *) t (m :: * -> *).
(MonadTrans f, DomBuilder t m) =>
CommentNodeConfig t -> f m (CommentNode (DomBuilderSpace m) t)
liftCommentNode
  element :: Text
-> ElementConfig
     er t (DomBuilderSpace (RequesterT t request response m))
-> RequesterT t request response m a
-> RequesterT
     t
     request
     response
     m
     (Element er (DomBuilderSpace (RequesterT t request response m)) t,
      a)
element elementTag :: Text
elementTag cfg :: ElementConfig
  er t (DomBuilderSpace (RequesterT t request response m))
cfg (RequesterT child :: StateT
  (RequesterState t request) (ReaderT (EventSelectorInt t Any) m) a
child) = StateT
  (RequesterState t request)
  (ReaderT (EventSelectorInt t Any) m)
  (Element er (DomBuilderSpace m) t, a)
-> RequesterT
     t
     request
     response
     m
     (Element er (DomBuilderSpace (RequesterT t request response m)) t,
      a)
forall t (request :: * -> *) (response :: * -> *) (m :: * -> *) a.
StateT
  (RequesterState t request) (ReaderT (EventSelectorInt t Any) m) a
-> RequesterT t request response m a
RequesterT (StateT
   (RequesterState t request)
   (ReaderT (EventSelectorInt t Any) m)
   (Element er (DomBuilderSpace m) t, a)
 -> RequesterT
      t
      request
      response
      m
      (Element er (DomBuilderSpace (RequesterT t request response m)) t,
       a))
-> StateT
     (RequesterState t request)
     (ReaderT (EventSelectorInt t Any) m)
     (Element er (DomBuilderSpace m) t, a)
-> RequesterT
     t
     request
     response
     m
     (Element er (DomBuilderSpace (RequesterT t request response m)) t,
      a)
forall a b. (a -> b) -> a -> b
$ do
    EventSelectorInt t Any
r <- StateT
  (RequesterState t request)
  (ReaderT (EventSelectorInt t Any) m)
  (EventSelectorInt t Any)
forall r (m :: * -> *). MonadReader r m => m r
ask
    RequesterState t request
old <- StateT
  (RequesterState t request)
  (ReaderT (EventSelectorInt t Any) m)
  (RequesterState t request)
forall s (m :: * -> *). MonadState s m => m s
get
    (el :: Element er (DomBuilderSpace m) t
el, (a :: a
a, new :: RequesterState t request
new)) <- ReaderT
  (EventSelectorInt t Any)
  m
  (Element er (DomBuilderSpace m) t, (a, RequesterState t request))
-> StateT
     (RequesterState t request)
     (ReaderT (EventSelectorInt t Any) m)
     (Element er (DomBuilderSpace m) t, (a, RequesterState t request))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ReaderT
   (EventSelectorInt t Any)
   m
   (Element er (DomBuilderSpace m) t, (a, RequesterState t request))
 -> StateT
      (RequesterState t request)
      (ReaderT (EventSelectorInt t Any) m)
      (Element er (DomBuilderSpace m) t, (a, RequesterState t request)))
-> ReaderT
     (EventSelectorInt t Any)
     m
     (Element er (DomBuilderSpace m) t, (a, RequesterState t request))
-> StateT
     (RequesterState t request)
     (ReaderT (EventSelectorInt t Any) m)
     (Element er (DomBuilderSpace m) t, (a, RequesterState t request))
forall a b. (a -> b) -> a -> b
$ m (Element er (DomBuilderSpace m) t, (a, RequesterState t request))
-> ReaderT
     (EventSelectorInt t Any)
     m
     (Element er (DomBuilderSpace m) t, (a, RequesterState t request))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (Element er (DomBuilderSpace m) t,
    (a, RequesterState t request))
 -> ReaderT
      (EventSelectorInt t Any)
      m
      (Element er (DomBuilderSpace m) t, (a, RequesterState t request)))
-> m (Element er (DomBuilderSpace m) t,
      (a, RequesterState t request))
-> ReaderT
     (EventSelectorInt t Any)
     m
     (Element er (DomBuilderSpace m) t, (a, RequesterState t request))
forall a b. (a -> b) -> a -> b
$ Text
-> ElementConfig er t (DomBuilderSpace m)
-> m (a, RequesterState t request)
-> m (Element er (DomBuilderSpace m) t,
      (a, RequesterState t request))
forall t (m :: * -> *) (er :: EventTag -> *) a.
DomBuilder t m =>
Text
-> ElementConfig er t (DomBuilderSpace m)
-> m a
-> m (Element er (DomBuilderSpace m) t, a)
element Text
elementTag ElementConfig er t (DomBuilderSpace m)
ElementConfig
  er t (DomBuilderSpace (RequesterT t request response m))
cfg (m (a, RequesterState t request)
 -> m (Element er (DomBuilderSpace m) t,
       (a, RequesterState t request)))
-> m (a, RequesterState t request)
-> m (Element er (DomBuilderSpace m) t,
      (a, RequesterState t request))
forall a b. (a -> b) -> a -> b
$ ReaderT (EventSelectorInt t Any) m (a, RequesterState t request)
-> EventSelectorInt t Any -> m (a, RequesterState t request)
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT (StateT
  (RequesterState t request) (ReaderT (EventSelectorInt t Any) m) a
-> RequesterState t request
-> ReaderT (EventSelectorInt t Any) m (a, RequesterState t request)
forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s)
runStateT StateT
  (RequesterState t request) (ReaderT (EventSelectorInt t Any) m) a
child RequesterState t request
old) EventSelectorInt t Any
r
    RequesterState t request
-> StateT
     (RequesterState t request) (ReaderT (EventSelectorInt t Any) m) ()
forall s (m :: * -> *). MonadState s m => s -> m ()
put RequesterState t request
new
    (Element er (DomBuilderSpace m) t, a)
-> StateT
     (RequesterState t request)
     (ReaderT (EventSelectorInt t Any) m)
     (Element er (DomBuilderSpace m) t, a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Element er (DomBuilderSpace m) t
el, a
a)
  inputElement :: InputElementConfig
  er t (DomBuilderSpace (RequesterT t request response m))
-> RequesterT
     t
     request
     response
     m
     (InputElement
        er (DomBuilderSpace (RequesterT t request response m)) t)
inputElement = m (InputElement er (DomBuilderSpace m) t)
-> RequesterT
     t request response m (InputElement er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (InputElement er (DomBuilderSpace m) t)
 -> RequesterT
      t request response m (InputElement er (DomBuilderSpace m) t))
-> (InputElementConfig er t (DomBuilderSpace m)
    -> m (InputElement er (DomBuilderSpace m) t))
-> InputElementConfig er t (DomBuilderSpace m)
-> RequesterT
     t request response m (InputElement er (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. InputElementConfig er t (DomBuilderSpace m)
-> m (InputElement er (DomBuilderSpace m) t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
InputElementConfig er t (DomBuilderSpace m)
-> m (InputElement er (DomBuilderSpace m) t)
inputElement
  textAreaElement :: TextAreaElementConfig
  er t (DomBuilderSpace (RequesterT t request response m))
-> RequesterT
     t
     request
     response
     m
     (TextAreaElement
        er (DomBuilderSpace (RequesterT t request response m)) t)
textAreaElement = m (TextAreaElement er (DomBuilderSpace m) t)
-> RequesterT
     t request response m (TextAreaElement er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (TextAreaElement er (DomBuilderSpace m) t)
 -> RequesterT
      t request response m (TextAreaElement er (DomBuilderSpace m) t))
-> (TextAreaElementConfig er t (DomBuilderSpace m)
    -> m (TextAreaElement er (DomBuilderSpace m) t))
-> TextAreaElementConfig er t (DomBuilderSpace m)
-> RequesterT
     t request response m (TextAreaElement er (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TextAreaElementConfig er t (DomBuilderSpace m)
-> m (TextAreaElement er (DomBuilderSpace m) t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
TextAreaElementConfig er t (DomBuilderSpace m)
-> m (TextAreaElement er (DomBuilderSpace m) t)
textAreaElement
  selectElement :: SelectElementConfig
  er t (DomBuilderSpace (RequesterT t request response m))
-> RequesterT t request response m a
-> RequesterT
     t
     request
     response
     m
     (SelectElement
        er (DomBuilderSpace (RequesterT t request response m)) t,
      a)
selectElement cfg :: SelectElementConfig
  er t (DomBuilderSpace (RequesterT t request response m))
cfg (RequesterT child :: StateT
  (RequesterState t request) (ReaderT (EventSelectorInt t Any) m) a
child) = StateT
  (RequesterState t request)
  (ReaderT (EventSelectorInt t Any) m)
  (SelectElement er (DomBuilderSpace m) t, a)
-> RequesterT
     t
     request
     response
     m
     (SelectElement
        er (DomBuilderSpace (RequesterT t request response m)) t,
      a)
forall t (request :: * -> *) (response :: * -> *) (m :: * -> *) a.
StateT
  (RequesterState t request) (ReaderT (EventSelectorInt t Any) m) a
-> RequesterT t request response m a
RequesterT (StateT
   (RequesterState t request)
   (ReaderT (EventSelectorInt t Any) m)
   (SelectElement er (DomBuilderSpace m) t, a)
 -> RequesterT
      t
      request
      response
      m
      (SelectElement
         er (DomBuilderSpace (RequesterT t request response m)) t,
       a))
-> StateT
     (RequesterState t request)
     (ReaderT (EventSelectorInt t Any) m)
     (SelectElement er (DomBuilderSpace m) t, a)
-> RequesterT
     t
     request
     response
     m
     (SelectElement
        er (DomBuilderSpace (RequesterT t request response m)) t,
      a)
forall a b. (a -> b) -> a -> b
$ do
    EventSelectorInt t Any
r <- StateT
  (RequesterState t request)
  (ReaderT (EventSelectorInt t Any) m)
  (EventSelectorInt t Any)
forall r (m :: * -> *). MonadReader r m => m r
ask
    RequesterState t request
old <- StateT
  (RequesterState t request)
  (ReaderT (EventSelectorInt t Any) m)
  (RequesterState t request)
forall s (m :: * -> *). MonadState s m => m s
get
    (el :: SelectElement er (DomBuilderSpace m) t
el, (a :: a
a, new :: RequesterState t request
new)) <- ReaderT
  (EventSelectorInt t Any)
  m
  (SelectElement er (DomBuilderSpace m) t,
   (a, RequesterState t request))
-> StateT
     (RequesterState t request)
     (ReaderT (EventSelectorInt t Any) m)
     (SelectElement er (DomBuilderSpace m) t,
      (a, RequesterState t request))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ReaderT
   (EventSelectorInt t Any)
   m
   (SelectElement er (DomBuilderSpace m) t,
    (a, RequesterState t request))
 -> StateT
      (RequesterState t request)
      (ReaderT (EventSelectorInt t Any) m)
      (SelectElement er (DomBuilderSpace m) t,
       (a, RequesterState t request)))
-> ReaderT
     (EventSelectorInt t Any)
     m
     (SelectElement er (DomBuilderSpace m) t,
      (a, RequesterState t request))
-> StateT
     (RequesterState t request)
     (ReaderT (EventSelectorInt t Any) m)
     (SelectElement er (DomBuilderSpace m) t,
      (a, RequesterState t request))
forall a b. (a -> b) -> a -> b
$ m (SelectElement er (DomBuilderSpace m) t,
   (a, RequesterState t request))
-> ReaderT
     (EventSelectorInt t Any)
     m
     (SelectElement er (DomBuilderSpace m) t,
      (a, RequesterState t request))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SelectElement er (DomBuilderSpace m) t,
    (a, RequesterState t request))
 -> ReaderT
      (EventSelectorInt t Any)
      m
      (SelectElement er (DomBuilderSpace m) t,
       (a, RequesterState t request)))
-> m (SelectElement er (DomBuilderSpace m) t,
      (a, RequesterState t request))
-> ReaderT
     (EventSelectorInt t Any)
     m
     (SelectElement er (DomBuilderSpace m) t,
      (a, RequesterState t request))
forall a b. (a -> b) -> a -> b
$ SelectElementConfig er t (DomBuilderSpace m)
-> m (a, RequesterState t request)
-> m (SelectElement er (DomBuilderSpace m) t,
      (a, RequesterState t request))
forall t (m :: * -> *) (er :: EventTag -> *) a.
DomBuilder t m =>
SelectElementConfig er t (DomBuilderSpace m)
-> m a -> m (SelectElement er (DomBuilderSpace m) t, a)
selectElement SelectElementConfig er t (DomBuilderSpace m)
SelectElementConfig
  er t (DomBuilderSpace (RequesterT t request response m))
cfg (m (a, RequesterState t request)
 -> m (SelectElement er (DomBuilderSpace m) t,
       (a, RequesterState t request)))
-> m (a, RequesterState t request)
-> m (SelectElement er (DomBuilderSpace m) t,
      (a, RequesterState t request))
forall a b. (a -> b) -> a -> b
$ ReaderT (EventSelectorInt t Any) m (a, RequesterState t request)
-> EventSelectorInt t Any -> m (a, RequesterState t request)
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT (StateT
  (RequesterState t request) (ReaderT (EventSelectorInt t Any) m) a
-> RequesterState t request
-> ReaderT (EventSelectorInt t Any) m (a, RequesterState t request)
forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s)
runStateT StateT
  (RequesterState t request) (ReaderT (EventSelectorInt t Any) m) a
child RequesterState t request
old) EventSelectorInt t Any
r
    RequesterState t request
-> StateT
     (RequesterState t request) (ReaderT (EventSelectorInt t Any) m) ()
forall s (m :: * -> *). MonadState s m => s -> m ()
put RequesterState t request
new
    (SelectElement er (DomBuilderSpace m) t, a)
-> StateT
     (RequesterState t request)
     (ReaderT (EventSelectorInt t Any) m)
     (SelectElement er (DomBuilderSpace m) t, a)
forall (m :: * -> *) a. Monad m => a -> m a
return (SelectElement er (DomBuilderSpace m) t
el, a
a)
  placeRawElement :: RawElement (DomBuilderSpace (RequesterT t request response m))
-> RequesterT t request response m ()
placeRawElement = m () -> RequesterT t request response m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> RequesterT t request response m ())
-> (RawElement (DomBuilderSpace m) -> m ())
-> RawElement (DomBuilderSpace m)
-> RequesterT t request response m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawElement (DomBuilderSpace m) -> m ()
forall t (m :: * -> *).
DomBuilder t m =>
RawElement (DomBuilderSpace m) -> m ()
placeRawElement
  wrapRawElement :: RawElement (DomBuilderSpace (RequesterT t request response m))
-> RawElementConfig
     er t (DomBuilderSpace (RequesterT t request response m))
-> RequesterT
     t
     request
     response
     m
     (Element er (DomBuilderSpace (RequesterT t request response m)) t)
wrapRawElement e :: RawElement (DomBuilderSpace (RequesterT t request response m))
e = m (Element er (DomBuilderSpace m) t)
-> RequesterT
     t request response m (Element er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (Element er (DomBuilderSpace m) t)
 -> RequesterT
      t request response m (Element er (DomBuilderSpace m) t))
-> (RawElementConfig er t (DomBuilderSpace m)
    -> m (Element er (DomBuilderSpace m) t))
-> RawElementConfig er t (DomBuilderSpace m)
-> RequesterT
     t request response m (Element er (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawElement (DomBuilderSpace m)
-> RawElementConfig er t (DomBuilderSpace m)
-> m (Element er (DomBuilderSpace m) t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
RawElement (DomBuilderSpace m)
-> RawElementConfig er t (DomBuilderSpace m)
-> m (Element er (DomBuilderSpace m) t)
wrapRawElement RawElement (DomBuilderSpace m)
RawElement (DomBuilderSpace (RequesterT t request response m))
e

instance (DomBuilder t m, MonadHold t m, MonadFix m, Semigroup w) => DomBuilder t (EventWriterT t w m) where
  type DomBuilderSpace (EventWriterT t w m) = DomBuilderSpace m
  textNode :: TextNodeConfig t
-> EventWriterT
     t w m (TextNode (DomBuilderSpace (EventWriterT t w m)) t)
textNode = TextNodeConfig t
-> EventWriterT
     t w m (TextNode (DomBuilderSpace (EventWriterT t w m)) t)
forall (f :: (* -> *) -> * -> *) t (m :: * -> *).
(MonadTrans f, DomBuilder t m) =>
TextNodeConfig t -> f m (TextNode (DomBuilderSpace m) t)
liftTextNode
  commentNode :: CommentNodeConfig t
-> EventWriterT
     t w m (CommentNode (DomBuilderSpace (EventWriterT t w m)) t)
commentNode = CommentNodeConfig t
-> EventWriterT
     t w m (CommentNode (DomBuilderSpace (EventWriterT t w m)) t)
forall (f :: (* -> *) -> * -> *) t (m :: * -> *).
(MonadTrans f, DomBuilder t m) =>
CommentNodeConfig t -> f m (CommentNode (DomBuilderSpace m) t)
liftCommentNode
  element :: Text
-> ElementConfig er t (DomBuilderSpace (EventWriterT t w m))
-> EventWriterT t w m a
-> EventWriterT
     t w m (Element er (DomBuilderSpace (EventWriterT t w m)) t, a)
element elementTag :: Text
elementTag cfg :: ElementConfig er t (DomBuilderSpace (EventWriterT t w m))
cfg (EventWriterT child :: StateT (EventWriterState t w) m a
child) = StateT
  (EventWriterState t w) m (Element er (DomBuilderSpace m) t, a)
-> EventWriterT
     t w m (Element er (DomBuilderSpace (EventWriterT t w m)) t, a)
forall t w (m :: * -> *) a.
StateT (EventWriterState t w) m a -> EventWriterT t w m a
EventWriterT (StateT
   (EventWriterState t w) m (Element er (DomBuilderSpace m) t, a)
 -> EventWriterT
      t w m (Element er (DomBuilderSpace (EventWriterT t w m)) t, a))
-> StateT
     (EventWriterState t w) m (Element er (DomBuilderSpace m) t, a)
-> EventWriterT
     t w m (Element er (DomBuilderSpace (EventWriterT t w m)) t, a)
forall a b. (a -> b) -> a -> b
$ do
    EventWriterState t w
old <- StateT (EventWriterState t w) m (EventWriterState t w)
forall s (m :: * -> *). MonadState s m => m s
get
    (el :: Element er (DomBuilderSpace m) t
el, (a :: a
a, new :: EventWriterState t w
new)) <- m (Element er (DomBuilderSpace m) t, (a, EventWriterState t w))
-> StateT
     (EventWriterState t w)
     m
     (Element er (DomBuilderSpace m) t, (a, EventWriterState t w))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (Element er (DomBuilderSpace m) t, (a, EventWriterState t w))
 -> StateT
      (EventWriterState t w)
      m
      (Element er (DomBuilderSpace m) t, (a, EventWriterState t w)))
-> m (Element er (DomBuilderSpace m) t, (a, EventWriterState t w))
-> StateT
     (EventWriterState t w)
     m
     (Element er (DomBuilderSpace m) t, (a, EventWriterState t w))
forall a b. (a -> b) -> a -> b
$ Text
-> ElementConfig er t (DomBuilderSpace m)
-> m (a, EventWriterState t w)
-> m (Element er (DomBuilderSpace m) t, (a, EventWriterState t w))
forall t (m :: * -> *) (er :: EventTag -> *) a.
DomBuilder t m =>
Text
-> ElementConfig er t (DomBuilderSpace m)
-> m a
-> m (Element er (DomBuilderSpace m) t, a)
element Text
elementTag ElementConfig er t (DomBuilderSpace m)
ElementConfig er t (DomBuilderSpace (EventWriterT t w m))
cfg (m (a, EventWriterState t w)
 -> m (Element er (DomBuilderSpace m) t, (a, EventWriterState t w)))
-> m (a, EventWriterState t w)
-> m (Element er (DomBuilderSpace m) t, (a, EventWriterState t w))
forall a b. (a -> b) -> a -> b
$ StateT (EventWriterState t w) m a
-> EventWriterState t w -> m (a, EventWriterState t w)
forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s)
runStateT StateT (EventWriterState t w) m a
child EventWriterState t w
old
    EventWriterState t w -> StateT (EventWriterState t w) m ()
forall s (m :: * -> *). MonadState s m => s -> m ()
put EventWriterState t w
new
    (Element er (DomBuilderSpace m) t, a)
-> StateT
     (EventWriterState t w) m (Element er (DomBuilderSpace m) t, a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Element er (DomBuilderSpace m) t
el, a
a)
  inputElement :: InputElementConfig er t (DomBuilderSpace (EventWriterT t w m))
-> EventWriterT
     t w m (InputElement er (DomBuilderSpace (EventWriterT t w m)) t)
inputElement = m (InputElement er (DomBuilderSpace m) t)
-> EventWriterT t w m (InputElement er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (InputElement er (DomBuilderSpace m) t)
 -> EventWriterT t w m (InputElement er (DomBuilderSpace m) t))
-> (InputElementConfig er t (DomBuilderSpace m)
    -> m (InputElement er (DomBuilderSpace m) t))
-> InputElementConfig er t (DomBuilderSpace m)
-> EventWriterT t w m (InputElement er (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. InputElementConfig er t (DomBuilderSpace m)
-> m (InputElement er (DomBuilderSpace m) t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
InputElementConfig er t (DomBuilderSpace m)
-> m (InputElement er (DomBuilderSpace m) t)
inputElement
  textAreaElement :: TextAreaElementConfig er t (DomBuilderSpace (EventWriterT t w m))
-> EventWriterT
     t w m (TextAreaElement er (DomBuilderSpace (EventWriterT t w m)) t)
textAreaElement = m (TextAreaElement er (DomBuilderSpace m) t)
-> EventWriterT t w m (TextAreaElement er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (TextAreaElement er (DomBuilderSpace m) t)
 -> EventWriterT t w m (TextAreaElement er (DomBuilderSpace m) t))
-> (TextAreaElementConfig er t (DomBuilderSpace m)
    -> m (TextAreaElement er (DomBuilderSpace m) t))
-> TextAreaElementConfig er t (DomBuilderSpace m)
-> EventWriterT t w m (TextAreaElement er (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TextAreaElementConfig er t (DomBuilderSpace m)
-> m (TextAreaElement er (DomBuilderSpace m) t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
TextAreaElementConfig er t (DomBuilderSpace m)
-> m (TextAreaElement er (DomBuilderSpace m) t)
textAreaElement
  selectElement :: SelectElementConfig er t (DomBuilderSpace (EventWriterT t w m))
-> EventWriterT t w m a
-> EventWriterT
     t
     w
     m
     (SelectElement er (DomBuilderSpace (EventWriterT t w m)) t, a)
selectElement cfg :: SelectElementConfig er t (DomBuilderSpace (EventWriterT t w m))
cfg (EventWriterT child :: StateT (EventWriterState t w) m a
child) = StateT
  (EventWriterState t w)
  m
  (SelectElement er (DomBuilderSpace m) t, a)
-> EventWriterT
     t
     w
     m
     (SelectElement er (DomBuilderSpace (EventWriterT t w m)) t, a)
forall t w (m :: * -> *) a.
StateT (EventWriterState t w) m a -> EventWriterT t w m a
EventWriterT (StateT
   (EventWriterState t w)
   m
   (SelectElement er (DomBuilderSpace m) t, a)
 -> EventWriterT
      t
      w
      m
      (SelectElement er (DomBuilderSpace (EventWriterT t w m)) t, a))
-> StateT
     (EventWriterState t w)
     m
     (SelectElement er (DomBuilderSpace m) t, a)
-> EventWriterT
     t
     w
     m
     (SelectElement er (DomBuilderSpace (EventWriterT t w m)) t, a)
forall a b. (a -> b) -> a -> b
$ do
    EventWriterState t w
old <- StateT (EventWriterState t w) m (EventWriterState t w)
forall s (m :: * -> *). MonadState s m => m s
get
    (el :: SelectElement er (DomBuilderSpace m) t
el, (a :: a
a, new :: EventWriterState t w
new)) <- m (SelectElement er (DomBuilderSpace m) t,
   (a, EventWriterState t w))
-> StateT
     (EventWriterState t w)
     m
     (SelectElement er (DomBuilderSpace m) t, (a, EventWriterState t w))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SelectElement er (DomBuilderSpace m) t,
    (a, EventWriterState t w))
 -> StateT
      (EventWriterState t w)
      m
      (SelectElement er (DomBuilderSpace m) t,
       (a, EventWriterState t w)))
-> m (SelectElement er (DomBuilderSpace m) t,
      (a, EventWriterState t w))
-> StateT
     (EventWriterState t w)
     m
     (SelectElement er (DomBuilderSpace m) t, (a, EventWriterState t w))
forall a b. (a -> b) -> a -> b
$ SelectElementConfig er t (DomBuilderSpace m)
-> m (a, EventWriterState t w)
-> m (SelectElement er (DomBuilderSpace m) t,
      (a, EventWriterState t w))
forall t (m :: * -> *) (er :: EventTag -> *) a.
DomBuilder t m =>
SelectElementConfig er t (DomBuilderSpace m)
-> m a -> m (SelectElement er (DomBuilderSpace m) t, a)
selectElement SelectElementConfig er t (DomBuilderSpace m)
SelectElementConfig er t (DomBuilderSpace (EventWriterT t w m))
cfg (m (a, EventWriterState t w)
 -> m (SelectElement er (DomBuilderSpace m) t,
       (a, EventWriterState t w)))
-> m (a, EventWriterState t w)
-> m (SelectElement er (DomBuilderSpace m) t,
      (a, EventWriterState t w))
forall a b. (a -> b) -> a -> b
$ StateT (EventWriterState t w) m a
-> EventWriterState t w -> m (a, EventWriterState t w)
forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s)
runStateT StateT (EventWriterState t w) m a
child EventWriterState t w
old
    EventWriterState t w -> StateT (EventWriterState t w) m ()
forall s (m :: * -> *). MonadState s m => s -> m ()
put EventWriterState t w
new
    (SelectElement er (DomBuilderSpace m) t, a)
-> StateT
     (EventWriterState t w)
     m
     (SelectElement er (DomBuilderSpace m) t, a)
forall (m :: * -> *) a. Monad m => a -> m a
return (SelectElement er (DomBuilderSpace m) t
el, a
a)
  placeRawElement :: RawElement (DomBuilderSpace (EventWriterT t w m))
-> EventWriterT t w m ()
placeRawElement = m () -> EventWriterT t w m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> EventWriterT t w m ())
-> (RawElement (DomBuilderSpace m) -> m ())
-> RawElement (DomBuilderSpace m)
-> EventWriterT t w m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawElement (DomBuilderSpace m) -> m ()
forall t (m :: * -> *).
DomBuilder t m =>
RawElement (DomBuilderSpace m) -> m ()
placeRawElement
  wrapRawElement :: RawElement (DomBuilderSpace (EventWriterT t w m))
-> RawElementConfig er t (DomBuilderSpace (EventWriterT t w m))
-> EventWriterT
     t w m (Element er (DomBuilderSpace (EventWriterT t w m)) t)
wrapRawElement e :: RawElement (DomBuilderSpace (EventWriterT t w m))
e = m (Element er (DomBuilderSpace m) t)
-> EventWriterT t w m (Element er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (Element er (DomBuilderSpace m) t)
 -> EventWriterT t w m (Element er (DomBuilderSpace m) t))
-> (RawElementConfig er t (DomBuilderSpace m)
    -> m (Element er (DomBuilderSpace m) t))
-> RawElementConfig er t (DomBuilderSpace m)
-> EventWriterT t w m (Element er (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawElement (DomBuilderSpace m)
-> RawElementConfig er t (DomBuilderSpace m)
-> m (Element er (DomBuilderSpace m) t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
RawElement (DomBuilderSpace m)
-> RawElementConfig er t (DomBuilderSpace m)
-> m (Element er (DomBuilderSpace m) t)
wrapRawElement RawElement (DomBuilderSpace m)
RawElement (DomBuilderSpace (EventWriterT t w m))
e

instance (DomBuilder t m, MonadFix m, MonadHold t m, Group q, Query q, Additive q, Eq q) => DomBuilder t (QueryT t q m) where
  type DomBuilderSpace (QueryT t q m) = DomBuilderSpace m
  textNode :: TextNodeConfig t
-> QueryT t q m (TextNode (DomBuilderSpace (QueryT t q m)) t)
textNode = TextNodeConfig t
-> QueryT t q m (TextNode (DomBuilderSpace (QueryT t q m)) t)
forall (f :: (* -> *) -> * -> *) t (m :: * -> *).
(MonadTrans f, DomBuilder t m) =>
TextNodeConfig t -> f m (TextNode (DomBuilderSpace m) t)
liftTextNode
  commentNode :: CommentNodeConfig t
-> QueryT t q m (CommentNode (DomBuilderSpace (QueryT t q m)) t)
commentNode = CommentNodeConfig t
-> QueryT t q m (CommentNode (DomBuilderSpace (QueryT t q m)) t)
forall (f :: (* -> *) -> * -> *) t (m :: * -> *).
(MonadTrans f, DomBuilder t m) =>
CommentNodeConfig t -> f m (CommentNode (DomBuilderSpace m) t)
liftCommentNode
  element :: Text
-> ElementConfig er t (DomBuilderSpace (QueryT t q m))
-> QueryT t q m a
-> QueryT t q m (Element er (DomBuilderSpace (QueryT t q m)) t, a)
element elementTag :: Text
elementTag cfg :: ElementConfig er t (DomBuilderSpace (QueryT t q m))
cfg (QueryT child :: StateT
  [Behavior t q]
  (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
  a
child) = StateT
  [Behavior t q]
  (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
  (Element er (DomBuilderSpace m) t, a)
-> QueryT t q m (Element er (DomBuilderSpace (QueryT t q m)) t, a)
forall t q (m :: * -> *) a.
StateT
  [Behavior t q]
  (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
  a
-> QueryT t q m a
QueryT (StateT
   [Behavior t q]
   (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
   (Element er (DomBuilderSpace m) t, a)
 -> QueryT t q m (Element er (DomBuilderSpace (QueryT t q m)) t, a))
-> StateT
     [Behavior t q]
     (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
     (Element er (DomBuilderSpace m) t, a)
-> QueryT t q m (Element er (DomBuilderSpace (QueryT t q m)) t, a)
forall a b. (a -> b) -> a -> b
$ do
    [Behavior t q]
s <- StateT
  [Behavior t q]
  (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
  [Behavior t q]
forall s (m :: * -> *). MonadState s m => m s
get
    (e :: Element er (DomBuilderSpace m) t
e, (a :: a
a, newS :: [Behavior t q]
newS)) <- EventWriterT
  t
  q
  (ReaderT (Dynamic t (QueryResult q)) m)
  (Element er (DomBuilderSpace m) t, (a, [Behavior t q]))
-> StateT
     [Behavior t q]
     (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
     (Element er (DomBuilderSpace m) t, (a, [Behavior t q]))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (EventWriterT
   t
   q
   (ReaderT (Dynamic t (QueryResult q)) m)
   (Element er (DomBuilderSpace m) t, (a, [Behavior t q]))
 -> StateT
      [Behavior t q]
      (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
      (Element er (DomBuilderSpace m) t, (a, [Behavior t q])))
-> EventWriterT
     t
     q
     (ReaderT (Dynamic t (QueryResult q)) m)
     (Element er (DomBuilderSpace m) t, (a, [Behavior t q]))
-> StateT
     [Behavior t q]
     (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
     (Element er (DomBuilderSpace m) t, (a, [Behavior t q]))
forall a b. (a -> b) -> a -> b
$ Text
-> ElementConfig
     er
     t
     (DomBuilderSpace
        (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m)))
-> EventWriterT
     t q (ReaderT (Dynamic t (QueryResult q)) m) (a, [Behavior t q])
-> EventWriterT
     t
     q
     (ReaderT (Dynamic t (QueryResult q)) m)
     (Element
        er
        (DomBuilderSpace
           (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m)))
        t,
      (a, [Behavior t q]))
forall t (m :: * -> *) (er :: EventTag -> *) a.
DomBuilder t m =>
Text
-> ElementConfig er t (DomBuilderSpace m)
-> m a
-> m (Element er (DomBuilderSpace m) t, a)
element Text
elementTag ElementConfig er t (DomBuilderSpace (QueryT t q m))
ElementConfig
  er
  t
  (DomBuilderSpace
     (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m)))
cfg (EventWriterT
   t q (ReaderT (Dynamic t (QueryResult q)) m) (a, [Behavior t q])
 -> EventWriterT
      t
      q
      (ReaderT (Dynamic t (QueryResult q)) m)
      (Element er (DomBuilderSpace m) t, (a, [Behavior t q])))
-> EventWriterT
     t q (ReaderT (Dynamic t (QueryResult q)) m) (a, [Behavior t q])
-> EventWriterT
     t
     q
     (ReaderT (Dynamic t (QueryResult q)) m)
     (Element er (DomBuilderSpace m) t, (a, [Behavior t q]))
forall a b. (a -> b) -> a -> b
$ StateT
  [Behavior t q]
  (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
  a
-> [Behavior t q]
-> EventWriterT
     t q (ReaderT (Dynamic t (QueryResult q)) m) (a, [Behavior t q])
forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s)
runStateT StateT
  [Behavior t q]
  (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
  a
child [Behavior t q]
s
    [Behavior t q]
-> StateT
     [Behavior t q]
     (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
     ()
forall s (m :: * -> *). MonadState s m => s -> m ()
put [Behavior t q]
newS
    (Element er (DomBuilderSpace m) t, a)
-> StateT
     [Behavior t q]
     (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
     (Element er (DomBuilderSpace m) t, a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Element er (DomBuilderSpace m) t
e, a
a)
  inputElement :: InputElementConfig er t (DomBuilderSpace (QueryT t q m))
-> QueryT
     t q m (InputElement er (DomBuilderSpace (QueryT t q m)) t)
inputElement = m (InputElement er (DomBuilderSpace m) t)
-> QueryT t q m (InputElement er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (InputElement er (DomBuilderSpace m) t)
 -> QueryT t q m (InputElement er (DomBuilderSpace m) t))
-> (InputElementConfig er t (DomBuilderSpace m)
    -> m (InputElement er (DomBuilderSpace m) t))
-> InputElementConfig er t (DomBuilderSpace m)
-> QueryT t q m (InputElement er (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. InputElementConfig er t (DomBuilderSpace m)
-> m (InputElement er (DomBuilderSpace m) t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
InputElementConfig er t (DomBuilderSpace m)
-> m (InputElement er (DomBuilderSpace m) t)
inputElement
  textAreaElement :: TextAreaElementConfig er t (DomBuilderSpace (QueryT t q m))
-> QueryT
     t q m (TextAreaElement er (DomBuilderSpace (QueryT t q m)) t)
textAreaElement = m (TextAreaElement er (DomBuilderSpace m) t)
-> QueryT t q m (TextAreaElement er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (TextAreaElement er (DomBuilderSpace m) t)
 -> QueryT t q m (TextAreaElement er (DomBuilderSpace m) t))
-> (TextAreaElementConfig er t (DomBuilderSpace m)
    -> m (TextAreaElement er (DomBuilderSpace m) t))
-> TextAreaElementConfig er t (DomBuilderSpace m)
-> QueryT t q m (TextAreaElement er (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TextAreaElementConfig er t (DomBuilderSpace m)
-> m (TextAreaElement er (DomBuilderSpace m) t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
TextAreaElementConfig er t (DomBuilderSpace m)
-> m (TextAreaElement er (DomBuilderSpace m) t)
textAreaElement
  selectElement :: SelectElementConfig er t (DomBuilderSpace (QueryT t q m))
-> QueryT t q m a
-> QueryT
     t q m (SelectElement er (DomBuilderSpace (QueryT t q m)) t, a)
selectElement cfg :: SelectElementConfig er t (DomBuilderSpace (QueryT t q m))
cfg (QueryT child :: StateT
  [Behavior t q]
  (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
  a
child) = StateT
  [Behavior t q]
  (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
  (SelectElement er (DomBuilderSpace m) t, a)
-> QueryT
     t q m (SelectElement er (DomBuilderSpace (QueryT t q m)) t, a)
forall t q (m :: * -> *) a.
StateT
  [Behavior t q]
  (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
  a
-> QueryT t q m a
QueryT (StateT
   [Behavior t q]
   (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
   (SelectElement er (DomBuilderSpace m) t, a)
 -> QueryT
      t q m (SelectElement er (DomBuilderSpace (QueryT t q m)) t, a))
-> StateT
     [Behavior t q]
     (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
     (SelectElement er (DomBuilderSpace m) t, a)
-> QueryT
     t q m (SelectElement er (DomBuilderSpace (QueryT t q m)) t, a)
forall a b. (a -> b) -> a -> b
$ do
    [Behavior t q]
s <- StateT
  [Behavior t q]
  (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
  [Behavior t q]
forall s (m :: * -> *). MonadState s m => m s
get
    (e :: SelectElement er (DomBuilderSpace m) t
e, (a :: a
a, newS :: [Behavior t q]
newS)) <- EventWriterT
  t
  q
  (ReaderT (Dynamic t (QueryResult q)) m)
  (SelectElement er (DomBuilderSpace m) t, (a, [Behavior t q]))
-> StateT
     [Behavior t q]
     (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
     (SelectElement er (DomBuilderSpace m) t, (a, [Behavior t q]))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (EventWriterT
   t
   q
   (ReaderT (Dynamic t (QueryResult q)) m)
   (SelectElement er (DomBuilderSpace m) t, (a, [Behavior t q]))
 -> StateT
      [Behavior t q]
      (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
      (SelectElement er (DomBuilderSpace m) t, (a, [Behavior t q])))
-> EventWriterT
     t
     q
     (ReaderT (Dynamic t (QueryResult q)) m)
     (SelectElement er (DomBuilderSpace m) t, (a, [Behavior t q]))
-> StateT
     [Behavior t q]
     (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
     (SelectElement er (DomBuilderSpace m) t, (a, [Behavior t q]))
forall a b. (a -> b) -> a -> b
$ SelectElementConfig
  er
  t
  (DomBuilderSpace
     (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m)))
-> EventWriterT
     t q (ReaderT (Dynamic t (QueryResult q)) m) (a, [Behavior t q])
-> EventWriterT
     t
     q
     (ReaderT (Dynamic t (QueryResult q)) m)
     (SelectElement
        er
        (DomBuilderSpace
           (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m)))
        t,
      (a, [Behavior t q]))
forall t (m :: * -> *) (er :: EventTag -> *) a.
DomBuilder t m =>
SelectElementConfig er t (DomBuilderSpace m)
-> m a -> m (SelectElement er (DomBuilderSpace m) t, a)
selectElement SelectElementConfig er t (DomBuilderSpace (QueryT t q m))
SelectElementConfig
  er
  t
  (DomBuilderSpace
     (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m)))
cfg (EventWriterT
   t q (ReaderT (Dynamic t (QueryResult q)) m) (a, [Behavior t q])
 -> EventWriterT
      t
      q
      (ReaderT (Dynamic t (QueryResult q)) m)
      (SelectElement er (DomBuilderSpace m) t, (a, [Behavior t q])))
-> EventWriterT
     t q (ReaderT (Dynamic t (QueryResult q)) m) (a, [Behavior t q])
-> EventWriterT
     t
     q
     (ReaderT (Dynamic t (QueryResult q)) m)
     (SelectElement er (DomBuilderSpace m) t, (a, [Behavior t q]))
forall a b. (a -> b) -> a -> b
$ StateT
  [Behavior t q]
  (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
  a
-> [Behavior t q]
-> EventWriterT
     t q (ReaderT (Dynamic t (QueryResult q)) m) (a, [Behavior t q])
forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s)
runStateT StateT
  [Behavior t q]
  (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
  a
child [Behavior t q]
s
    [Behavior t q]
-> StateT
     [Behavior t q]
     (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
     ()
forall s (m :: * -> *). MonadState s m => s -> m ()
put [Behavior t q]
newS
    (SelectElement er (DomBuilderSpace m) t, a)
-> StateT
     [Behavior t q]
     (EventWriterT t q (ReaderT (Dynamic t (QueryResult q)) m))
     (SelectElement er (DomBuilderSpace m) t, a)
forall (m :: * -> *) a. Monad m => a -> m a
return (SelectElement er (DomBuilderSpace m) t
e, a
a)
  placeRawElement :: RawElement (DomBuilderSpace (QueryT t q m)) -> QueryT t q m ()
placeRawElement = m () -> QueryT t q m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> QueryT t q m ())
-> (RawElement (DomBuilderSpace m) -> m ())
-> RawElement (DomBuilderSpace m)
-> QueryT t q m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawElement (DomBuilderSpace m) -> m ()
forall t (m :: * -> *).
DomBuilder t m =>
RawElement (DomBuilderSpace m) -> m ()
placeRawElement
  wrapRawElement :: RawElement (DomBuilderSpace (QueryT t q m))
-> RawElementConfig er t (DomBuilderSpace (QueryT t q m))
-> QueryT t q m (Element er (DomBuilderSpace (QueryT t q m)) t)
wrapRawElement e :: RawElement (DomBuilderSpace (QueryT t q m))
e = m (Element er (DomBuilderSpace m) t)
-> QueryT t q m (Element er (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (Element er (DomBuilderSpace m) t)
 -> QueryT t q m (Element er (DomBuilderSpace m) t))
-> (RawElementConfig er t (DomBuilderSpace m)
    -> m (Element er (DomBuilderSpace m) t))
-> RawElementConfig er t (DomBuilderSpace m)
-> QueryT t q m (Element er (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RawElement (DomBuilderSpace m)
-> RawElementConfig er t (DomBuilderSpace m)
-> m (Element er (DomBuilderSpace m) t)
forall t (m :: * -> *) (er :: EventTag -> *).
DomBuilder t m =>
RawElement (DomBuilderSpace m)
-> RawElementConfig er t (DomBuilderSpace m)
-> m (Element er (DomBuilderSpace m) t)
wrapRawElement RawElement (DomBuilderSpace m)
RawElement (DomBuilderSpace (QueryT t q m))
e

-- * Convenience functions

class HasDomEvent t target eventName | target -> t where
  type DomEventType target eventName :: *
  domEvent :: EventName eventName -> target -> Event t (DomEventType target eventName)

instance Reflex t => HasDomEvent t (Element EventResult d t) en where
  type DomEventType (Element EventResult d t) en = EventResultType en
  {-# INLINABLE domEvent #-}
  domEvent :: EventName en
-> Element EventResult d t
-> Event t (DomEventType (Element EventResult d t) en)
domEvent en :: EventName en
en e :: Element EventResult d t
e = Event t (EventResult en)
-> Event t (DomEventType (Element EventResult d t) en)
forall k (t :: k) a b.
(Reflex t, Coercible a b) =>
Event t a -> Event t b
coerceEvent (Event t (EventResult en)
 -> Event t (DomEventType (Element EventResult d t) en))
-> Event t (EventResult en)
-> Event t (DomEventType (Element EventResult d t) en)
forall a b. (a -> b) -> a -> b
$ EventSelector t (WrapArg EventResult EventName)
-> WrapArg EventResult EventName (EventResult en)
-> Event t (EventResult en)
forall k1 (t :: k1) (k2 :: * -> *).
EventSelector t k2 -> forall a. k2 a -> Event t a
Reflex.select (Element EventResult d t
-> EventSelector t (WrapArg EventResult EventName)
forall (er :: EventTag -> *) k (d :: k) k (t :: k).
Element er d t -> EventSelector t (WrapArg er EventName)
_element_events Element EventResult d t
e) (EventName en -> WrapArg EventResult EventName (EventResult en)
forall k (b :: k -> *) (a1 :: k) (a :: k -> *).
b a1 -> WrapArg a b (a a1)
WrapArg EventName en
en)

instance Reflex t => HasDomEvent t (InputElement EventResult d t) en where
  type DomEventType (InputElement EventResult d t) en = EventResultType en
  {-# INLINABLE domEvent #-}
  domEvent :: EventName en
-> InputElement EventResult d t
-> Event t (DomEventType (InputElement EventResult d t) en)
domEvent en :: EventName en
en = EventName en
-> Element EventResult d t
-> Event t (DomEventType (Element EventResult d t) en)
forall k (t :: k) target (eventName :: EventTag).
HasDomEvent t target eventName =>
EventName eventName
-> target -> Event t (DomEventType target eventName)
domEvent EventName en
en (Element EventResult d t -> Event t (EventResultType en))
-> (InputElement EventResult d t -> Element EventResult d t)
-> InputElement EventResult d t
-> Event t (EventResultType en)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. InputElement EventResult d t -> Element EventResult d t
forall (er :: EventTag -> *) k (d :: k) k (t :: k).
InputElement er d t -> Element er d t
_inputElement_element

instance Reflex t => HasDomEvent t (TextAreaElement EventResult d t) en where
  type DomEventType (TextAreaElement EventResult d t) en = EventResultType en
  {-# INLINABLE domEvent #-}
  domEvent :: EventName en
-> TextAreaElement EventResult d t
-> Event t (DomEventType (TextAreaElement EventResult d t) en)
domEvent en :: EventName en
en = EventName en
-> Element EventResult d t
-> Event t (DomEventType (Element EventResult d t) en)
forall k (t :: k) target (eventName :: EventTag).
HasDomEvent t target eventName =>
EventName eventName
-> target -> Event t (DomEventType target eventName)
domEvent EventName en
en (Element EventResult d t -> Event t (EventResultType en))
-> (TextAreaElement EventResult d t -> Element EventResult d t)
-> TextAreaElement EventResult d t
-> Event t (EventResultType en)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TextAreaElement EventResult d t -> Element EventResult d t
forall (er :: EventTag -> *) k (d :: k) k (t :: k).
TextAreaElement er d t -> Element er d t
_textAreaElement_element

instance DomBuilder t m => DomBuilder t (ReaderT r m) where
  type DomBuilderSpace (ReaderT r m) = DomBuilderSpace m

type LiftDomBuilder t f m =
  ( Reflex t
  , MonadTransControlStateless f
  , Monad m
  , DomBuilder t m
  , DomBuilderSpace (f m) ~ DomBuilderSpace m
  )

class MonadTransControl t => MonadTransControlStateless t where
  stTCoercion :: proxy t -> Coercion (StT t a) a
  default stTCoercion :: (a ~ StT t a) => proxy t -> Coercion (StT t a) a
  stTCoercion _ = Coercion (StT t a) a
forall k (cat :: k -> k -> *) (a :: k). Category cat => cat a a
Control.Category.id

toStT :: MonadTransControlStateless t => proxy t -> a -> StT t a
toStT :: proxy t -> a -> StT t a
toStT = Coercion a (StT t a) -> a -> StT t a
forall a b. Coercion a b -> a -> b
coerceWith (Coercion a (StT t a) -> a -> StT t a)
-> (proxy t -> Coercion a (StT t a)) -> proxy t -> a -> StT t a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Coercion (StT t a) a -> Coercion a (StT t a)
forall k (a :: k) (b :: k). Coercion a b -> Coercion b a
sym (Coercion (StT t a) a -> Coercion a (StT t a))
-> (proxy t -> Coercion (StT t a) a)
-> proxy t
-> Coercion a (StT t a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. proxy t -> Coercion (StT t a) a
forall (t :: (* -> *) -> * -> *)
       (proxy :: ((* -> *) -> * -> *) -> *) a.
MonadTransControlStateless t =>
proxy t -> Coercion (StT t a) a
stTCoercion

fromStT :: MonadTransControlStateless t => proxy t -> StT t a -> a
fromStT :: proxy t -> StT t a -> a
fromStT = Coercion (StT t a) a -> StT t a -> a
forall a b. Coercion a b -> a -> b
coerceWith (Coercion (StT t a) a -> StT t a -> a)
-> (proxy t -> Coercion (StT t a) a) -> proxy t -> StT t a -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. proxy t -> Coercion (StT t a) a
forall (t :: (* -> *) -> * -> *)
       (proxy :: ((* -> *) -> * -> *) -> *) a.
MonadTransControlStateless t =>
proxy t -> Coercion (StT t a) a
stTCoercion

instance MonadTransControlStateless (ReaderT r)

type RunStateless t = forall n b. Monad n => t n b -> n b

liftWithStateless :: forall m t a. (Monad m, MonadTransControlStateless t) => (RunStateless t -> m a) -> t m a
liftWithStateless :: (RunStateless t -> m a) -> t m a
liftWithStateless a :: RunStateless t -> m a
a = (Run t -> m a) -> t m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTransControl t, Monad m) =>
(Run t -> m a) -> t m a
liftWith ((Run t -> m a) -> t m a) -> (Run t -> m a) -> t m a
forall a b. (a -> b) -> a -> b
$ \run :: Run t
run -> RunStateless t -> m a
a (RunStateless t -> m a) -> RunStateless t -> m a
forall a b. (a -> b) -> a -> b
$ (StT t b -> b) -> n (StT t b) -> n b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Proxy t -> StT t b -> b
forall (t :: (* -> *) -> * -> *)
       (proxy :: ((* -> *) -> * -> *) -> *) a.
MonadTransControlStateless t =>
proxy t -> StT t a -> a
fromStT (Proxy t
forall k (t :: k). Proxy t
Proxy :: Proxy t)) (n (StT t b) -> n b) -> (t n b -> n (StT t b)) -> t n b -> n b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t n b -> n (StT t b)
Run t
run

liftTextNode :: (MonadTrans f, DomBuilder t m) => TextNodeConfig t -> f m (TextNode (DomBuilderSpace m) t)
liftTextNode :: TextNodeConfig t -> f m (TextNode (DomBuilderSpace m) t)
liftTextNode = m (TextNode (DomBuilderSpace m) t)
-> f m (TextNode (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (TextNode (DomBuilderSpace m) t)
 -> f m (TextNode (DomBuilderSpace m) t))
-> (TextNodeConfig t -> m (TextNode (DomBuilderSpace m) t))
-> TextNodeConfig t
-> f m (TextNode (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TextNodeConfig t -> m (TextNode (DomBuilderSpace m) t)
forall t (m :: * -> *).
DomBuilder t m =>
TextNodeConfig t -> m (TextNode (DomBuilderSpace m) t)
textNode

liftCommentNode :: (MonadTrans f, DomBuilder t m) => CommentNodeConfig t -> f m (CommentNode (DomBuilderSpace m) t)
liftCommentNode :: CommentNodeConfig t -> f m (CommentNode (DomBuilderSpace m) t)
liftCommentNode = m (CommentNode (DomBuilderSpace m) t)
-> f m (CommentNode (DomBuilderSpace m) t)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (CommentNode (DomBuilderSpace m) t)
 -> f m (CommentNode (DomBuilderSpace m) t))
-> (CommentNodeConfig t -> m (CommentNode (DomBuilderSpace m) t))
-> CommentNodeConfig t
-> f m (CommentNode (DomBuilderSpace m) t)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CommentNodeConfig t -> m (CommentNode (DomBuilderSpace m) t)
forall t (m :: * -> *).
DomBuilder t m =>
CommentNodeConfig t -> m (CommentNode (DomBuilderSpace m) t)
commentNode

liftElement :: LiftDomBuilder t f m => Text -> ElementConfig er t (DomBuilderSpace m) -> f m a -> f m (Element er (DomBuilderSpace m) t, a)
liftElement :: Text
-> ElementConfig er t (DomBuilderSpace m)
-> f m a
-> f m (Element er (DomBuilderSpace m) t, a)
liftElement elementTag :: Text
elementTag cfg :: ElementConfig er t (DomBuilderSpace m)
cfg child :: f m a
child = (RunStateless f -> m (Element er (DomBuilderSpace m) t, a))
-> f m (Element er (DomBuilderSpace m) t, a)
forall (m :: * -> *) (t :: (* -> *) -> * -> *) a.
(Monad m, MonadTransControlStateless t) =>
(RunStateless t -> m a) -> t m a
liftWithStateless ((RunStateless f -> m (Element er (DomBuilderSpace m) t, a))
 -> f m (Element er (DomBuilderSpace m) t, a))
-> (RunStateless f -> m (Element er (DomBuilderSpace m) t, a))
-> f m (Element er (DomBuilderSpace m) t, a)
forall a b. (a -> b) -> a -> b
$ \run :: RunStateless f
run -> Text
-> ElementConfig er t (DomBuilderSpace m)
-> m a
-> m (Element er (DomBuilderSpace m) t, a)
forall t (m :: * -> *) (er :: EventTag -> *) a.
DomBuilder t m =>
Text
-> ElementConfig er t (DomBuilderSpace m)
-> m a
-> m (Element er (DomBuilderSpace m) t, a)
element Text
elementTag ElementConfig er t (DomBuilderSpace m)
cfg (m a -> m (Element er (DomBuilderSpace m) t, a))
-> m a -> m (Element er (DomBuilderSpace m) t, a)
forall a b. (a -> b) -> a -> b
$ f m a -> m a
RunStateless f
run f m a
child

class (Reflex t, Monad m) => DomRenderHook t m | m -> t where
  withRenderHook :: (forall x. JSM x -> JSM x) -> m a -> m a
  requestDomAction :: Event t (JSM a) -> m (Event t a)
  requestDomAction_ :: Event t (JSM a) -> m ()

instance DomRenderHook t m => DomRenderHook t (ReaderT e m) where
  withRenderHook :: (forall x. JSM x -> JSM x) -> ReaderT e m a -> ReaderT e m a
withRenderHook hook :: forall x. JSM x -> JSM x
hook (ReaderT a :: e -> m a
a) = (e -> m a) -> ReaderT e m a
forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
ReaderT ((e -> m a) -> ReaderT e m a) -> (e -> m a) -> ReaderT e m a
forall a b. (a -> b) -> a -> b
$ \e :: e
e -> (forall x. JSM x -> JSM x) -> m a -> m a
forall k (t :: k) (m :: * -> *) a.
DomRenderHook t m =>
(forall x. JSM x -> JSM x) -> m a -> m a
withRenderHook forall x. JSM x -> JSM x
hook (m a -> m a) -> m a -> m a
forall a b. (a -> b) -> a -> b
$ e -> m a
a e
e
  requestDomAction :: Event t (JSM a) -> ReaderT e m (Event t a)
requestDomAction = m (Event t a) -> ReaderT e m (Event t a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (Event t a) -> ReaderT e m (Event t a))
-> (Event t (JSM a) -> m (Event t a))
-> Event t (JSM a)
-> ReaderT e m (Event t a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Event t (JSM a) -> m (Event t a)
forall k (t :: k) (m :: * -> *) a.
DomRenderHook t m =>
Event t (JSM a) -> m (Event t a)
requestDomAction
  requestDomAction_ :: Event t (JSM a) -> ReaderT e m ()
requestDomAction_ = m () -> ReaderT e m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> ReaderT e m ())
-> (Event t (JSM a) -> m ()) -> Event t (JSM a) -> ReaderT e m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Event t (JSM a) -> m ()
forall k (t :: k) (m :: * -> *) a.
DomRenderHook t m =>
Event t (JSM a) -> m ()
requestDomAction_

instance DomRenderHook t m => DomRenderHook t (StateT e m) where
  withRenderHook :: (forall x. JSM x -> JSM x) -> StateT e m a -> StateT e m a
withRenderHook hook :: forall x. JSM x -> JSM x
hook (StateT a :: e -> m (a, e)
a) = (e -> m (a, e)) -> StateT e m a
forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
StateT ((e -> m (a, e)) -> StateT e m a)
-> (e -> m (a, e)) -> StateT e m a
forall a b. (a -> b) -> a -> b
$ \s :: e
s -> (forall x. JSM x -> JSM x) -> m (a, e) -> m (a, e)
forall k (t :: k) (m :: * -> *) a.
DomRenderHook t m =>
(forall x. JSM x -> JSM x) -> m a -> m a
withRenderHook forall x. JSM x -> JSM x
hook (m (a, e) -> m (a, e)) -> m (a, e) -> m (a, e)
forall a b. (a -> b) -> a -> b
$ e -> m (a, e)
a e
s
  requestDomAction :: Event t (JSM a) -> StateT e m (Event t a)
requestDomAction = m (Event t a) -> StateT e m (Event t a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (Event t a) -> StateT e m (Event t a))
-> (Event t (JSM a) -> m (Event t a))
-> Event t (JSM a)
-> StateT e m (Event t a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Event t (JSM a) -> m (Event t a)
forall k (t :: k) (m :: * -> *) a.
DomRenderHook t m =>
Event t (JSM a) -> m (Event t a)
requestDomAction
  requestDomAction_ :: Event t (JSM a) -> StateT e m ()
requestDomAction_ = m () -> StateT e m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> StateT e m ())
-> (Event t (JSM a) -> m ()) -> Event t (JSM a) -> StateT e m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Event t (JSM a) -> m ()
forall k (t :: k) (m :: * -> *) a.
DomRenderHook t m =>
Event t (JSM a) -> m ()
requestDomAction_

instance DomRenderHook t m => DomRenderHook t (Lazy.StateT e m) where
  withRenderHook :: (forall x. JSM x -> JSM x) -> StateT e m a -> StateT e m a
withRenderHook hook :: forall x. JSM x -> JSM x
hook (Lazy.StateT a :: e -> m (a, e)
a) = (e -> m (a, e)) -> StateT e m a
forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a
Lazy.StateT ((e -> m (a, e)) -> StateT e m a)
-> (e -> m (a, e)) -> StateT e m a
forall a b. (a -> b) -> a -> b
$ \s :: e
s -> (forall x. JSM x -> JSM x) -> m (a, e) -> m (a, e)
forall k (t :: k) (m :: * -> *) a.
DomRenderHook t m =>
(forall x. JSM x -> JSM x) -> m a -> m a
withRenderHook forall x. JSM x -> JSM x
hook (m (a, e) -> m (a, e)) -> m (a, e) -> m (a, e)
forall a b. (a -> b) -> a -> b
$ e -> m (a, e)
a e
s
  requestDomAction :: Event t (JSM a) -> StateT e m (Event t a)
requestDomAction = m (Event t a) -> StateT e m (Event t a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (Event t a) -> StateT e m (Event t a))
-> (Event t (JSM a) -> m (Event t a))
-> Event t (JSM a)
-> StateT e m (Event t a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Event t (JSM a) -> m (Event t a)
forall k (t :: k) (m :: * -> *) a.
DomRenderHook t m =>
Event t (JSM a) -> m (Event t a)
requestDomAction
  requestDomAction_ :: Event t (JSM a) -> StateT e m ()
requestDomAction_ = m () -> StateT e m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m () -> StateT e m ())
-> (Event t (JSM a) -> m ()) -> Event t (JSM a) -> StateT e m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Event t (JSM a) -> m ()
forall k (t :: k) (m :: * -> *) a.
DomRenderHook t m =>
Event t (JSM a) -> m ()
requestDomAction_

deriving instance DomRenderHook t m => DomRenderHook t (BehaviorWriterT t w m)
deriving instance DomRenderHook t m => DomRenderHook t (EventWriterT t w m)
deriving instance DomRenderHook t m => DomRenderHook t (DynamicWriterT t w m)
deriving instance DomRenderHook t m => DomRenderHook t (RequesterT t req rsp m)
deriving instance DomRenderHook t m => DomRenderHook t (PostBuildT t m)
deriving instance DomRenderHook t m => DomRenderHook t (QueryT t q m)

{-# DEPRECATED liftElementConfig "Use 'id' instead; this function is no longer necessary" #-}
liftElementConfig :: ElementConfig er t s -> ElementConfig er t s
liftElementConfig :: ElementConfig er t s -> ElementConfig er t s
liftElementConfig = ElementConfig er t s -> ElementConfig er t s
forall a. a -> a
id

class Monad m => HasDocument m where
  askDocument :: m (RawDocument (DomBuilderSpace m))
  default askDocument
    :: ( m ~ f m'
       , RawDocument (DomBuilderSpace m) ~ RawDocument (DomBuilderSpace m')
       , MonadTrans f
       , Monad m'
       , HasDocument m'
       )
    => m (RawDocument (DomBuilderSpace m))
  askDocument = m' (RawDocument (DomBuilderSpace m'))
-> f m' (RawDocument (DomBuilderSpace m'))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m' (RawDocument (DomBuilderSpace m'))
forall (m :: * -> *).
HasDocument m =>
m (RawDocument (DomBuilderSpace m))
askDocument

instance HasDocument m => HasDocument (ReaderT r m)
instance HasDocument m => HasDocument (EventWriterT t w m)
instance HasDocument m => HasDocument (DynamicWriterT t w m)
instance HasDocument m => HasDocument (PostBuildT t m)
instance HasDocument m => HasDocument (RequesterT t request response m)
instance HasDocument m => HasDocument (QueryT t q m)