elm-athlete/athlete/2.1.0

NOTE: the latest version is 7.0.0

BodyBuilder.Attributes

This module entirely replaces Html.Attributes, providing a type-safer alternatives. This is designed to work with BodyBuilder. It is not compatible with Html.Attributes, though.

type alias StyleSelector =
{ media : Maybe MediaQuery
, pseudoClass : Maybe String
}
defaultStyleSelector : StyleSelector
= Greater Int
| Lesser Int
| Between Int Int
type alias StyleModifier a =
StyleSelector -> Modifier a
style : List (StyleModifier a) -> Modifier a
rawStyle : b -> { a | rawStyle : Maybe b } -> { a | rawStyle : Maybe b }
a
-> { c | rawAttributes : List a }
-> { c | rawAttributes : List a }
type alias AutocompleteAttribute a =
{ a | autocomplete : Bool }
type alias WidthAttribute a =
{ a | width : Maybe Int }
type alias HeightAttribute a =
{ a | height : Maybe Int }
type alias ValueAttribute b a =
{ a | value : Maybe b }
type alias StepAttribute a =
{ a | step : Maybe Int }
type alias MaxAttribute a =
{ a | max : Maybe Int }
type alias MinAttribute a =
{ a | min : Maybe Int }
type alias TargetAttribute a =
{ a | target : Maybe String }
type alias HrefAttribute a =
{ a | href : Maybe String }
type alias NameAttribute a =
{ a | name : Maybe String }
type alias DisabledAttribute a =
{ a | disabled : Bool }
type alias PlaceholderAttribute a =
{ a | placeholder : Maybe String }
type alias DataAttribute a =
{ a | data : List ( String, String ) }
data : a -> { c | data : a } -> { c | data : a }
type alias TypeContainer a =
{ a | type_ : String }
type alias BoxContainer a =
{ a | box : List ( Modifiers Box, StyleSelector ) }
type alias CheckedContainer a =
{ a | checked : Bool }
type alias UniversalContainer a =
{ a | universal : UniversalAttributes }
title : String -> Modifier { a | universal : UniversalAttributes }
id : String -> Modifier { a | universal : UniversalAttributes }
class : List String -> Modifier { a | universal : UniversalAttributes }
tabindex : Int -> Modifier { a | universal : UniversalAttributes }
type alias MaybeBlockContainer a =
{ a
| block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
}
type alias BlockContainer a =
{ a | block : List ( Modifiers BlockDetails, StyleSelector ) }
{ a
| flexContainerProperties :
List ( Modifiers FlexContainerDetails, StyleSelector )
}
type alias FlexItemProperties a =
{ a
| flexItemProperties :
List ( Modifiers FlexItemDetails, StyleSelector )
}
{ a
| gridContainerProperties :
List ( Modifiers GridContainerDetails, StyleSelector )
}
type alias GridItemProperties a =
{ a
| gridItemProperties :
List ( Modifiers GridItemDetails, StyleSelector )
}
type alias VisibleAttributes a =
{ a
| box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, rawStyle : Maybe CommonStyle
}

Computed :

visibleAttributesToHtmlAttributes : VisibleAttributesAndEvents msg a -> List (Attribute msg)
rawStyleToHtmlAttributes : CommonStyle -> List (Attribute msg)
type alias VisibleAttributesAndEvents msg a =
{ a
| onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}

OnEvent msg (OnFocusEvent msg (OnBlurEvent msg (OnMouseEvents msg (VisibleAttributes a))))

type alias UniversalAttributes =
{ title : Maybe String
, tabindex : Maybe Int
, id : Maybe String
, class : List String
}

TitleAttribute (TabindexAttribute (IdAttribute (ClassAttribute {})))

defaultUniversalAttributes : UniversalAttributes
universalAttributesToHtmlAttributes : UniversalAttributes -> List (Attribute msg)
type alias NodeAttributes msg =
{ onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}

Computed : MaybeBlockContainer (FlowAttributes msg)

defaultNodeAttributes : NodeAttributes msg
nodeAttributesToHtmlAttributes : NodeAttributes msg -> List (Attribute msg)
type alias BlockAttributes msg =
{ block : List ( Modifiers BlockDetails, StyleSelector )
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
width : Int -> Modifier (WidthAttribute a)
height : Int -> Modifier (HeightAttribute a)
type alias HeadingAttributes msg =
BlockAttributes msg
defaultHeadingAttributes : HeadingAttributes msg
headingAttributesToHtmlAttributes : HeadingAttributes msg -> List (Attribute msg)
type alias FlowAttributes msg =
{ onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
defaultFlowAttributes : FlowAttributes msg
flowAttributesToHtmlAttributes : FlowAttributes msg -> List (Attribute msg)
type alias FlexContainerAttributes msg =
{ flexContainerProperties :
List ( Modifiers FlexContainerDetails, StyleSelector )
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
defaultFlexContainerAttributes : FlexContainerAttributes msg
flexContainerAttributesToHtmlAttributes : FlexContainerAttributes msg -> List (Attribute msg)
type alias FlexItemAttributes msg =
{ flexItemProperties :
List ( Modifiers FlexItemDetails, StyleSelector )
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
defaultFlexItemAttributes : FlexItemAttributes msg
flexItemAttributesToHtmlAttributes : FlexItemAttributes msg -> List (Attribute msg)
type alias GridContainerAttributes msg =
{ gridContainerProperties :
List ( Modifiers GridContainerDetails, StyleSelector )
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
defaultGridContainerAttributes : GridContainerAttributes msg
gridContainerAttributesToHtmlAttributes : GridContainerAttributes msg -> List (Attribute msg)
type alias GridItemAttributes msg =
{ gridItemProperties :
List ( Modifiers GridItemDetails, StyleSelector )
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
defaultGridItemAttributes : GridItemAttributes msg
gridItemAttributesToHtmlAttributes : GridItemAttributes msg -> List (Attribute msg)
type alias ButtonAttributes msg =
{ disabled : Bool
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
defaultButtonAttributes : ButtonAttributes msg
buttonAttributesToHtmlAttributes : ButtonAttributes msg -> List (Attribute msg)
type alias AAttributes msg =
{ onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, href : Maybe String
, target : Maybe String
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
target : String -> Modifier (TargetAttribute a)
href : String -> Modifier (HrefAttribute a)
defaultAAttributes : AAttributes msg
aAttributesToHtmlAttributes : AAttributes msg -> List (Attribute msg)
type alias ImgAttributes msg =
{ onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, src : String
, alt : String
, width : Maybe Int
, height : Maybe Int
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
defaultImgAttributes : String -> String -> ImgAttributes msg
imgAttributesToHtmlAttributes : ImgAttributes msg -> List (Attribute msg)
type alias AudioAttributes msg =
{ onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, src : String
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
defaultAudioAttributes : AudioAttributes msg
audioAttributesToHtmlAttributes : AudioAttributes msg -> List (Attribute msg)
type alias ScriptAttributes msg =
{ onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, src : String
, data : List ( String, String )
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
defaultScriptAttributes : ScriptAttributes msg
scriptAttributesToHtmlAttributes : ScriptAttributes msg -> List (Attribute msg)
type alias ProgressAttributes msg =
{ onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
defaultProgressAttributes : ProgressAttributes msg
progressAttributesToHtmlAttributes : ProgressAttributes msg -> List (Attribute msg)
type alias SelectAttributes msg =
{ block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, value : Maybe String
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
, onInputEvent : Maybe (String -> msg)
, fromStringInput : String -> String
}

Computed : -- MaybeBlockContainer (StringValue (FlowAttributes msg))

defaultSelectAttributes : SelectAttributes msg
selectAttributesToHtmlAttributes : SelectAttributes msg -> List (Attribute msg)
type alias LabelAttributes msg =
{ onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, position : Position
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
-> List (Html msg)
-> { c | label : Maybe (Label msg) }
-> { c | label : Maybe (Label msg) }
type alias PositionAttribute a =
{ a | position : Position }
= Before
| After
type alias InputAttributes a =
{ a | type_ : String, name : Maybe String }
value : a -> { c | value : Maybe a } -> { c | value : Maybe a }
disabled : Modifier (DisabledAttribute a)
name : String -> Modifier (NameAttribute a)
disabledAttributeToHtmlAttributes : Bool -> List (Attribute msg)
inputAttributesToHtmlAttributes : InputAttributes a -> List (Attribute msg)
VisibleAttributesAndEvents
msg
{ a | name : Maybe String, type_ : String }
-> List (Attribute msg)
{ name : Maybe String
, type_ : String
, value : Maybe String
, universal : UniversalAttributes
}
defaultInputHiddenAttributes : InputHiddenAttributes
inputHiddenAttributesToHtmlAttributes : InputHiddenAttributes -> List (Attribute msg)
type alias InputPasswordAttributes msg =
InputTextAttributes msg
defaultInputPasswordAttributes : InputPasswordAttributes msg
inputPasswordAttributesToHtmlAttributes : InputPasswordAttributes msg -> List (Attribute msg)
type alias InputRangeAttributes msg =
InputNumberAttributes msg
step : Int -> Modifier (StepAttribute a)
defaultInputRangeAttributes : InputRangeAttributes msg
inputRangeAttributesToHtmlAttributes : InputRangeAttributes msg -> List (Attribute msg)
type alias InputRadioAttributes msg =
{ name : Maybe String
, type_ : String
, universal : UniversalAttributes
, box : List ( Modifiers Box, StyleSelector )
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, value : Maybe String
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, label : Maybe (Label msg)
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
defaultInputRadioAttributes : InputRadioAttributes msg
inputRadioAttributesToHtmlAttributes : InputRadioAttributes msg -> List (Attribute msg)
type alias InputCheckboxAttributes msg =
{ name : Maybe String
, type_ : String
, universal : UniversalAttributes
, box : List ( Modifiers Box, StyleSelector )
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, value : Maybe String
, label : Maybe (Label msg)
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, checked : Bool
, onCheckEvent : Maybe (Bool -> msg)
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
checked : Bool -> Modifier (InputCheckboxAttributes msg)
defaultInputCheckboxAttributes : InputCheckboxAttributes msg
inputCheckboxAttributesToHtmlAttributes : InputCheckboxAttributes msg -> List (Attribute msg)
type alias InputTextAttributes msg =
{ name : Maybe String
, type_ : String
, universal : UniversalAttributes
, box : List ( Modifiers Box, StyleSelector )
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, value : Maybe String
, label : Maybe (Label msg)
, placeholder : Maybe String
, autocomplete : Bool
, onInputEvent : Maybe (String -> msg)
, fromStringInput : String -> String
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
autocomplete : Bool -> Modifier (AutocompleteAttribute a)
defaultInputTextAttributes : InputTextAttributes msg
inputTextAttributesToHtmlAttributes : InputTextAttributes msg -> List (Attribute msg)
type alias InputTelAttributes msg =
InputTextAttributes msg
defaultInputTelAttributes : InputTelAttributes msg
type alias InputSubmitAttributes msg =
{ label : Maybe (Label msg)
, type_ : String
, disabled : Bool
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, onSubmitEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
defaultInputSubmitAttributes : InputSubmitAttributes msg
inputSubmitAttributesToHtmlAttributes : InputSubmitAttributes msg -> List (Attribute msg)
type alias InputUrlAttributes msg =
InputTextAttributes msg
defaultInputUrlAttributes : InputUrlAttributes msg
inputUrlAttributesToHtmlAttributes : InputUrlAttributes msg -> List (Attribute msg)
type alias InputNumberAttributes msg =
{ name : Maybe String
, type_ : String
, universal : UniversalAttributes
, box : List ( Modifiers Box, StyleSelector )
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, label : Maybe (Label msg)
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
, value : Maybe Int
, onInputEvent : Maybe (Int -> msg)
, fromStringInput : String -> Int
, step : Maybe Int
, max : Maybe Int
, min : Maybe Int
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, disabled : Bool
}
max : Int -> Modifier (MaxAttribute a)
min : Int -> Modifier (MinAttribute a)
defaultInputNumberAttributes : InputNumberAttributes msg
inputNumberAttributesToHtmlAttributes : InputNumberAttributes msg -> List (Attribute msg)
type alias InputColorAttributes msg =
{ name : Maybe String
, type_ : String
, universal : UniversalAttributes
, box : List ( Modifiers Box, StyleSelector )
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, label : Maybe (Label msg)
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
, value : Maybe Color
, onInputEvent : Maybe (Color -> msg)
, fromStringInput : String -> Color
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
}
defaultInputColorAttributes : InputColorAttributes msg
inputColorAttributesToHtmlAttributes : InputColorAttributes msg -> List (Attribute msg)
type alias InputFileAttributes msg =
{ name : Maybe String
, type_ : String
, universal : UniversalAttributes
, box : List ( Modifiers Box, StyleSelector )
, onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, label : Maybe (Label msg)
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
}
defaultInputFileAttributes : InputFileAttributes msg
inputFileAttributesToHtmlAttributes : InputFileAttributes msg -> List (Attribute msg)
type alias TextareaAttributes msg =
{ onMouseEvents : Maybe (OnMouseEventsInside msg)
, onEvent : Maybe ( String, Handler msg )
, onBlurEvent : Maybe msg
, onFocusEvent : Maybe msg
, box : List ( Modifiers Box, StyleSelector )
, universal : UniversalAttributes
, value : Maybe String
, onInputEvent : Maybe (String -> msg)
, fromStringInput : String -> String
, name : Maybe String
, placeholder : Maybe String
, block : Maybe (List ( Modifiers BlockDetails, StyleSelector ))
, rawStyle : Maybe CommonStyle
, rawAttributes : List (Attribute msg)
}
placeholder : String -> Modifier (PlaceholderAttribute a)
defaultTextareaAttributes : TextareaAttributes msg
textareaAttributesToHtmlAttributes : TextareaAttributes msg -> List (Attribute msg)