Transmutable.Html.Interior

This module contains the core building blocks that make up the AST.

⚠️ This module should only be used by code that transmutes HTML. If you just want to write HTML, use the main Html module and the other modules such as Html.Attributes.

Types

type Html msg
= Node NodeProperties (Array (Attribute msg)) (Descendants msg)
| TextNode String
type Attribute msg
= Attribute String String
| BoolProperty String Bool
| Event String (EventDecoder msg)
| StringProperty String String
| Style String String
| ValueProperty String Value
type EventDecoder msg
= Normal (Decoder msg)
| MayStopPropagation (Decoder { message : msg, stopPropagation : Bool })
| MayPreventDefault (Decoder { message : msg, preventDefault : Bool })
| Custom (Decoder { message : msg, stopPropagation : Bool, preventDefault : Bool })
type alias NodeProperties = { key : Maybe String, tagName : String }
type Descendants msg
= Regular (Array (Html msg))

Transmute

transmute :
{ node : NodeProperties -> Array (Attribute msg)
-> TransmuteContext -> outcome, injectDescendants : outcome -> Array transmuted -> transmuted , text : TransmuteContext -> String -> transmuted }
-> Html msg
-> transmuted

Use this helper function to translate Html into another data type.

Mapping

map : (a -> b) -> Html a -> Html b