glazier-react-1.0.0.0: ReactJS binding using Glazier.Command.

Safe HaskellNone
LanguageHaskell2010

Glazier.React.Markup

Description

HtmlT inspired monad for creating ReactElements

Synopsis

Documentation

data BranchParam Source #

The parameters required to create a branch ReactElement with children

data LeafParam Source #

The parameters required to create a leaf ReactElement (no children)

Constructors

LeafParam JSRep (DList Property) 

fromMarkup :: ReactMarkup -> IO ReactElement Source #

Create ReactElements from a ReactMarkup

fromElement :: MonadState (DList ReactMarkup) m => ReactElement -> m () Source #

To use an exisitng ReactElement

toElements :: DList ReactMarkup -> IO [ReactElement] Source #

Convert the ReactMlt to [Z.ReactElement]

toElement :: DList ReactMarkup -> IO ReactElement Source #

Fully render the ReactMlt into a single Z.ReactElement

txt :: MonadState (DList ReactMarkup) m => JSString -> m () Source #

For text content

lf :: MonadState (DList ReactMarkup) m => JSRep -> DList Property -> m () Source #

For the contentless elements: eg br_. Memonic: lf for leaf. Duplicate listeners with the same key will be combined, but it is a silent error if the same key is used across listeners and props. "If an attribute/prop is duplicated the last one defined wins." https://www.reactenlightenment.com/react-nodes/4.4.html

bh :: MonadState (DList ReactMarkup) m => JSRep -> DList Property -> m a -> m a Source #

For the contentful elements: eg div_. Memonic: bh for branch. Duplicate listeners with the same key will be combined, but it is a silent error if the same key is used across listeners and props. "If an attribute/prop is duplicated the last one defined wins." https://www.reactenlightenment.com/react-nodes/4.4.html

withMarkup :: MonadState (DList ReactMarkup) m => (DList ReactMarkup -> DList ReactMarkup -> DList ReactMarkup) -> m a -> m a Source #

Create a MonadState that run the given given a combining function where the first arg is the state from running the markup producing MonadState with mempty, and the 2nd arg the starting state of the resultant MonadState.