Module

Bonsai.Html.Internal

Package
purescript-bonsai
Repository
grmble/purescript-bonsai

Bonsai HTML Internal module.

Implements the HTML DSL. Heavily inspired by Smolder.

#HasAttribute Source

class HasAttribute a b | a -> b where

Members

Instances

#HasStyle Source

class HasStyle a  where

Members

Instances

#Style Source

type Style = { name :: String, value :: String }

A style that will be collected for VD.style

#Markup Source

type Markup msg = Free (MarkupF msg)

#MarkupF Source

data MarkupF msg a

Markup Functor for the DSL

Instances

#MarkupT Source

type MarkupT msg = Markup msg Unit

#(!) Source

Operator alias for Bonsai.Html.Internal.withAttribute (left-associative / precedence 4)

#(!?) Source

Operator alias for Bonsai.Html.Internal.withOptionalAttribute (left-associative / precedence 4)

#(#!) Source

Operator alias for Bonsai.Html.Internal.withStyle (left-associative / precedence 4)

#(#!?) Source

Operator alias for Bonsai.Html.Internal.withOptionalStyle (left-associative / precedence 4)

#attribute Source

attribute :: forall msg. String -> String -> Property msg

Create a custom attribute

#stringProperty Source

stringProperty :: forall msg. String -> String -> Property msg

Create a string property.

#booleanProperty Source

booleanProperty :: forall msg. String -> Boolean -> Property msg

Create a boolean property.

#text Source

text :: forall msg. String -> MarkupT msg

Create a text node.

#leaf Source

leaf :: forall msg. String -> MarkupT msg

Create a leaf element - will not have children

#parent Source

parent :: forall msg. String -> MarkupT msg -> MarkupT msg

Create an element with children.

#keyedElement Source

keyedElement :: forall msg. String -> Array (Property msg) -> Array (Tuple String (VNode msg)) -> MarkupT msg

keyedElement renders to a VirtualDom keyedNode. The DSL does not work here to give it attributes and/or styles

#render Source

render :: forall msg. MarkupT msg -> VNode msg

Render the content DSL to a VirtualDom node.

#render' Source

render' :: forall msg. MarkupT msg -> Array (VNode msg)

Render the content DSL to an Array of VirtualDom nodes.

#withOptionalAttribute Source

withOptionalAttribute :: forall h msg. HasAttribute h (Property msg) => h -> Maybe (Property msg) -> h

Add an optional attribute (operator !?)

#withOptionalStyle Source

withOptionalStyle :: forall h. HasStyle h => h -> Maybe Style -> h

#vnode Source

vnode :: forall msg. VNode msg -> MarkupT msg

Wrap a (already rendered?) VNode