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
= Cdata String
| Comment String
| Declaration String
| Node ({ properties : NodeProperties, attributes : Array (Attribute msg), descendants : Descendants msg })
| ProcessingInstruction String
| TextNode String
type Attribute msg
= Attribute ({ key : String, value : String })
| BoolProperty ({ key : String, value : Bool })
| Event ({ name : String, decoder : EventDecoder msg })
| StringProperty ({ key : String, value : String })
| Style ({ key : String, value : String })
| ValueProperty ({ key : String, value : 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 -> TransmuteContext -> transmuted , cdata : TransmuteContext -> String -> transmuted , comment : TransmuteContext -> String -> transmuted , declaration : TransmuteContext -> String -> transmuted , processingInstruction : TransmuteContext -> String -> 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