{-# LANGUAGE OverloadedStrings #-}
# LANGUAGE CPP #
-----------------------------------------------------------------------------
-- |
-- Module      :  Miso.Html.Property
  Copyright    :   ( C ) 2016 - 2018   
-- License     :  BSD3-style (see the file LICENSE)
  Maintainer   :      <  >
-- Stability   :  experimental
-- Portability :  non-portable
--
  Construct custom properties on DOM elements
--
-- > div_ [ prop "id" "foo" ] [ ]
--
----------------------------------------------------------------------------
module Miso.Html.Property
 (   -- * Construction
     textProp
   , stringProp
   , boolProp
   , intProp
   , integerProp
   , doubleProp
    -- * Common attributes
   , class_
   , classList_
   , id_
   , title_
   , hidden_
   -- * Inputs
   , type_
   , value_
   , defaultValue_
   , checked_
   , placeholder_
   , selected_
   -- * Input Helpers
   , accept_
   , acceptCharset_
   , action_
   , autocomplete_
   , autofocus_
   , autosave_
   , disabled_
   , enctype_
   , formation_
   , list_
   , maxlength_
   , minlength_
   , method_
   , multiple_
   , name_
   , novalidate_
   , pattern_
   , readonly_
   , required_
   , size_
   , for_
   , ref_
   , form_
   -- * Input Ranges
   , max_
   , min_
   , step_
   -- * Input Text areas
   , cols_
   , rows_
   , wrap_
   -- * Links and areas
   , href_
   , target_
   , download_
   , downloadAs_
   , hreflang_
   , media_
   , ping_
   , rel_
   -- * Maps
   , ismap_
   , usemap_
   , shape_
   , coords_
   -- * Embedded Content
   , src_
   , height_
   , width_
   , alt_
   , loading_
   -- * Audio and Video
   , autoplay_
   , controls_
   , loop_
   , preload_
   , poster_
   , default_
   , kind_
   , srclang_
   -- * iframes
   , sandbox_
   , seamless_
   , srcdoc_
   -- * Ordered lists
   , reversed_
   , start_
   -- * Tables
   , align_
   , colspan_
   , rowspan_
   , headers_
   , scope_
   -- * Headers
   , async_
   , charset_
   , content_
   , defer_
   , httpEquiv_
   , language_
   , scoped_
   -- * Data
   , data_
   , styleInline_
   ) where

import           Miso.Html.Types
import           Miso.String (MisoString, intercalate)

#if __GLASGOW_HASKELL__ < 841
import           Data.Monoid ((<>))
#endif

-- | Set field to `Bool` value
boolProp :: MisoString -> Bool -> Attribute action
boolProp = prop
-- | Set field to `String` value
stringProp ::  MisoString -> String -> Attribute action
stringProp = prop
-- | Set field to `Text` value
textProp ::  MisoString -> MisoString -> Attribute action
textProp = prop
-- | Set field to `Int` value
intProp ::  MisoString -> Int -> Attribute action
intProp = prop
  | Set field to ` Integer ` value
integerProp ::  MisoString -> Int -> Attribute action
integerProp = prop
-- | Set field to `Double` value
doubleProp ::  MisoString -> Double -> Attribute action
doubleProp = prop
-- | Define multiple classes conditionally
--
-- > div_ [ classList_ [ ("empty", null items) ] [ ]
--
classList_ ::  [(MisoString, Bool)] -> Attribute action
classList_ xs =
  textProp "class" $ intercalate (" " :: MisoString) [ t | (t, True) <- xs ]
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/title>
title_ ::  MisoString -> Attribute action
title_ = textProp "title"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/selected>
selected_ ::  Bool -> Attribute action
selected_ = boolProp "selected"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/hidden>
hidden_ ::  Bool -> Attribute action
hidden_             = boolProp "hidden"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/value>
value_ ::  MisoString -> Attribute action
value_             = textProp "value"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/defaultValue>
defaultValue_ ::  MisoString -> Attribute action
defaultValue_      = textProp "defaultValue"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/accept>
accept_ ::  MisoString -> Attribute action
accept_            = textProp "accept"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/acceptCharset>
acceptCharset_ ::  MisoString -> Attribute action
acceptCharset_     = textProp "acceptCharset"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/action>
action_ ::  MisoString -> Attribute action
action_            = textProp "action"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/autocomplete>
autocomplete_ ::  Bool -> Attribute action
autocomplete_ b = textProp "autocomplete" (if b then "on" else "off")
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/autosave>
autosave_ ::  MisoString -> Attribute action
autosave_          = textProp "autosave"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/disabled>
disabled_ ::  Bool -> Attribute action
disabled_          = boolProp "disabled"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/enctype>
enctype_ ::  MisoString -> Attribute action
enctype_           = textProp "enctype"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/formation>
formation_ ::  MisoString -> Attribute action
formation_         = textProp "formation"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/list>
list_ ::  MisoString -> Attribute action
list_              = textProp "list"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/maxlength>
maxlength_ ::  MisoString -> Attribute action
maxlength_         = textProp "maxlength"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/minlength>
minlength_ ::  MisoString -> Attribute action
minlength_         = textProp "minlength"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/method>
method_ ::  MisoString -> Attribute action
method_            = textProp "method"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/multiple>
multiple_ ::  Bool -> Attribute action
multiple_          = boolProp "multiple"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/novalidate>
novalidate_ ::  Bool -> Attribute action
novalidate_        = boolProp "noValidate"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/pattern>
pattern_ ::  MisoString -> Attribute action
pattern_           = textProp "pattern"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/readonly>
readonly_ ::  Bool -> Attribute action
readonly_          = boolProp "readOnly"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/required>
required_ ::  Bool -> Attribute action
required_          = boolProp "required"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/size>
size_ ::  MisoString -> Attribute action
size_              = textProp "size"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/for>
for_ ::  MisoString -> Attribute action
for_               = textProp "for"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/ref>
ref_ ::  MisoString -> Attribute action
ref_               = textProp "ref"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/form>
form_ ::  MisoString -> Attribute action
form_               = textProp "form"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/max>
max_ ::  MisoString -> Attribute action
max_               = textProp "max"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/min>
min_ ::  MisoString -> Attribute action
min_               = textProp "min"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/step>
step_ ::  MisoString -> Attribute action
step_              = textProp "step"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/cols>
cols_ ::  MisoString -> Attribute action
cols_              = textProp "cols"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/rows>
rows_ ::  MisoString -> Attribute action
rows_              = textProp "rows"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/wrap>
wrap_ ::  MisoString -> Attribute action
wrap_              = textProp "wrap"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/target>
target_ ::  MisoString -> Attribute action
target_            = textProp "target"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/download>
download_ ::  MisoString -> Attribute action
download_          = textProp "download"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/downloadAs>
downloadAs_ ::  MisoString -> Attribute action
downloadAs_        = textProp "downloadAs"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/hreflang>
hreflang_ ::  MisoString -> Attribute action
hreflang_          = textProp "hreflang"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/media>
media_ ::  MisoString -> Attribute action
media_             = textProp "media"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/ping>
ping_ ::  MisoString -> Attribute action
ping_              = textProp "ping"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/rel>
rel_ ::  MisoString -> Attribute action
rel_               = textProp "rel"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/ismap>
ismap_ ::  MisoString -> Attribute action
ismap_             = textProp "ismap"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/usemap>
usemap_ ::  MisoString -> Attribute action
usemap_            = textProp "usemap"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/shape>
shape_ ::  MisoString -> Attribute action
shape_             = textProp "shape"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/coords>
coords_ ::  MisoString -> Attribute action
coords_            = textProp "coords"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/src>
src_ ::  MisoString -> Attribute action
src_               = textProp "src"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/height>
height_ ::  MisoString -> Attribute action
height_            = textProp "height"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/width>
width_ ::  MisoString -> Attribute action
width_             = textProp "width"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/alt>
alt_ ::  MisoString -> Attribute action
alt_               = textProp "alt"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/loading>
loading_ ::  MisoString -> Attribute action
loading_           = textProp "loading"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/autoplay>
autoplay_ ::  Bool -> Attribute action
autoplay_          = boolProp "autoplay"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/controls>
controls_ ::  Bool -> Attribute action
controls_          = boolProp "controls"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/loop>
loop_ ::  Bool -> Attribute action
loop_              = boolProp "loop"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/preload>
preload_ ::  MisoString -> Attribute action
preload_           = textProp "preload"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/poster>
poster_ ::  MisoString -> Attribute action
poster_            = textProp "poster"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/default>
default_ ::  Bool -> Attribute action
default_           = boolProp "default"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/kind>
kind_ ::  MisoString -> Attribute action
kind_              = textProp "kind"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/srclang>
srclang_ ::  MisoString -> Attribute action
srclang_           = textProp "srclang"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/sandbox>
sandbox_ ::  MisoString -> Attribute action
sandbox_           = textProp "sandbox"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/seamless>
seamless_ ::  MisoString -> Attribute action
seamless_          = textProp "seamless"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/srcdoc>
srcdoc_ ::  MisoString -> Attribute action
srcdoc_            = textProp "srcdoc"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/reversed>
reversed_ ::  MisoString -> Attribute action
reversed_          = textProp "reversed"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/start>
start_ ::  MisoString -> Attribute action
start_             = textProp "start"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/align>
align_ ::  MisoString -> Attribute action
align_             = textProp "align"
  | <  >
colspan_ ::  MisoString -> Attribute action
colspan_           = textProp "colspan"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/rowspan>
rowspan_ ::  MisoString -> Attribute action
rowspan_           = textProp "rowspan"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/headers>
headers_ ::  MisoString -> Attribute action
headers_           = textProp "headers"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/scope>
scope_ ::  MisoString -> Attribute action
scope_             = textProp "scope"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/async>
async_ ::  MisoString -> Attribute action
async_             = textProp "async"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/charset>
charset_ ::  MisoString -> Attribute action
charset_           = textProp "charset"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/content>
content_ ::  MisoString -> Attribute action
content_           = textProp "content"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/defer>
defer_ ::  MisoString -> Attribute action
defer_             = textProp "defer"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/httpEquiv>
httpEquiv_ ::  MisoString -> Attribute action
httpEquiv_         = textProp "httpEquiv"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/language>
language_ ::  MisoString -> Attribute action
language_          = textProp "language"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/scoped>
scoped_ ::  MisoString -> Attribute action
scoped_            = textProp "scoped"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/type>
type_ ::  MisoString -> Attribute action
type_ = textProp "type"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/name>
name_ ::  MisoString -> Attribute action
name_ = textProp "name"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/href>
href_ ::  MisoString -> Attribute action
href_ = textProp "href"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/id>
id_ ::  MisoString -> Attribute action
id_ = textProp "id"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/placeholder>
placeholder_ ::  MisoString -> Attribute action
placeholder_ = textProp "placeholder"
-- | <-US/docs/Mozilla/Tech/XUL/Attribute/checked>
checked_ ::  Bool -> Attribute action
checked_ = boolProp "checked"
-- | Set "autofocus" property
-- <-US/docs/Mozilla/Tech/XUL/Attribute/autofocus>
autofocus_ ::  Bool -> Attribute action
autofocus_ = boolProp "autofocus"
-- | Set "className" property
-- <-US/docs/Web/API/Element/className>
class_ ::  MisoString -> Attribute action
class_ = textProp "class"
-- | Set "data-*" property
-- -US/docs/Web/HTML/Global_attributes/data-*
data_ ::  MisoString -> MisoString -> Attribute action
data_ k v = textProp ("data-" <> k) v
-- | Set "style" property
--
-- > view m = div_ [ styleInline_ "background-color:red;color:blue;" ] [ "foo" ]
--
-- -US/docs/Web/CSS
styleInline_ ::  MisoString -> Attribute action
styleInline_ = textProp "style"

# LANGUAGE OverloadedStrings #
---------------------------------------------------------------------------
 |
 Module      :  Miso.Html.Property
 License     :  BSD3-style (see the file LICENSE)
 Stability   :  experimental
 Portability :  non-portable


 > div_ [ prop "id" "foo" ] [ ]

--------------------------------------------------------------------------
 * Construction
 * Common attributes
 * Inputs
 * Input Helpers
 * Input Ranges
 * Input Text areas
 * Links and areas
 * Maps
 * Embedded Content
 * Audio and Video
 * iframes
 * Ordered lists
 * Tables
 * Headers
 * Data
 | Set field to `Bool` value
 | Set field to `String` value
 | Set field to `Text` value
 | Set field to `Int` value
 | Set field to `Double` value
 | Define multiple classes conditionally

 > div_ [ classList_ [ ("empty", null items) ] [ ]

 | <-US/docs/Mozilla/Tech/XUL/Attribute/title>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/selected>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/hidden>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/value>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/defaultValue>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/accept>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/acceptCharset>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/action>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/autocomplete>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/autosave>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/disabled>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/enctype>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/formation>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/list>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/maxlength>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/minlength>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/method>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/multiple>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/novalidate>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/pattern>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/readonly>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/required>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/size>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/for>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/ref>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/form>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/max>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/min>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/step>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/cols>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/rows>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/wrap>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/target>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/download>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/downloadAs>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/hreflang>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/media>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/ping>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/rel>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/ismap>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/usemap>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/shape>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/coords>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/src>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/height>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/width>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/alt>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/loading>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/autoplay>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/controls>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/loop>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/preload>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/poster>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/default>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/kind>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/srclang>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/sandbox>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/seamless>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/srcdoc>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/reversed>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/start>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/align>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/rowspan>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/headers>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/scope>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/async>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/charset>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/content>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/defer>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/httpEquiv>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/language>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/scoped>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/type>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/name>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/href>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/id>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/placeholder>
 | <-US/docs/Mozilla/Tech/XUL/Attribute/checked>
 | Set "autofocus" property
 <-US/docs/Mozilla/Tech/XUL/Attribute/autofocus>
 | Set "className" property
 <-US/docs/Web/API/Element/className>
 | Set "data-*" property
 -US/docs/Web/HTML/Global_attributes/data-*
 | Set "style" property

 > view m = div_ [ styleInline_ "background-color:red;color:blue;" ] [ "foo" ]

 -US/docs/Web/CSS
# LANGUAGE CPP #
  Copyright    :   ( C ) 2016 - 2018   
  Maintainer   :      <  >
  Construct custom properties on DOM elements
module Miso.Html.Property
     textProp
   , stringProp
   , boolProp
   , intProp
   , integerProp
   , doubleProp
   , class_
   , classList_
   , id_
   , title_
   , hidden_
   , type_
   , value_
   , defaultValue_
   , checked_
   , placeholder_
   , selected_
   , accept_
   , acceptCharset_
   , action_
   , autocomplete_
   , autofocus_
   , autosave_
   , disabled_
   , enctype_
   , formation_
   , list_
   , maxlength_
   , minlength_
   , method_
   , multiple_
   , name_
   , novalidate_
   , pattern_
   , readonly_
   , required_
   , size_
   , for_
   , ref_
   , form_
   , max_
   , min_
   , step_
   , cols_
   , rows_
   , wrap_
   , href_
   , target_
   , download_
   , downloadAs_
   , hreflang_
   , media_
   , ping_
   , rel_
   , ismap_
   , usemap_
   , shape_
   , coords_
   , src_
   , height_
   , width_
   , alt_
   , loading_
   , autoplay_
   , controls_
   , loop_
   , preload_
   , poster_
   , default_
   , kind_
   , srclang_
   , sandbox_
   , seamless_
   , srcdoc_
   , reversed_
   , start_
   , align_
   , colspan_
   , rowspan_
   , headers_
   , scope_
   , async_
   , charset_
   , content_
   , defer_
   , httpEquiv_
   , language_
   , scoped_
   , data_
   , styleInline_
   ) where

import           Miso.Html.Types
import           Miso.String (MisoString, intercalate)

#if __GLASGOW_HASKELL__ < 841
import           Data.Monoid ((<>))
#endif

boolProp :: MisoString -> Bool -> Attribute action
boolProp = prop
stringProp ::  MisoString -> String -> Attribute action
stringProp = prop
textProp ::  MisoString -> MisoString -> Attribute action
textProp = prop
intProp ::  MisoString -> Int -> Attribute action
intProp = prop
  | Set field to ` Integer ` value
integerProp ::  MisoString -> Int -> Attribute action
integerProp = prop
doubleProp ::  MisoString -> Double -> Attribute action
doubleProp = prop
classList_ ::  [(MisoString, Bool)] -> Attribute action
classList_ xs =
  textProp "class" $ intercalate (" " :: MisoString) [ t | (t, True) <- xs ]
title_ ::  MisoString -> Attribute action
title_ = textProp "title"
selected_ ::  Bool -> Attribute action
selected_ = boolProp "selected"
hidden_ ::  Bool -> Attribute action
hidden_             = boolProp "hidden"
value_ ::  MisoString -> Attribute action
value_             = textProp "value"
defaultValue_ ::  MisoString -> Attribute action
defaultValue_      = textProp "defaultValue"
accept_ ::  MisoString -> Attribute action
accept_            = textProp "accept"
acceptCharset_ ::  MisoString -> Attribute action
acceptCharset_     = textProp "acceptCharset"
action_ ::  MisoString -> Attribute action
action_            = textProp "action"
autocomplete_ ::  Bool -> Attribute action
autocomplete_ b = textProp "autocomplete" (if b then "on" else "off")
autosave_ ::  MisoString -> Attribute action
autosave_          = textProp "autosave"
disabled_ ::  Bool -> Attribute action
disabled_          = boolProp "disabled"
enctype_ ::  MisoString -> Attribute action
enctype_           = textProp "enctype"
formation_ ::  MisoString -> Attribute action
formation_         = textProp "formation"
list_ ::  MisoString -> Attribute action
list_              = textProp "list"
maxlength_ ::  MisoString -> Attribute action
maxlength_         = textProp "maxlength"
minlength_ ::  MisoString -> Attribute action
minlength_         = textProp "minlength"
method_ ::  MisoString -> Attribute action
method_            = textProp "method"
multiple_ ::  Bool -> Attribute action
multiple_          = boolProp "multiple"
novalidate_ ::  Bool -> Attribute action
novalidate_        = boolProp "noValidate"
pattern_ ::  MisoString -> Attribute action
pattern_           = textProp "pattern"
readonly_ ::  Bool -> Attribute action
readonly_          = boolProp "readOnly"
required_ ::  Bool -> Attribute action
required_          = boolProp "required"
size_ ::  MisoString -> Attribute action
size_              = textProp "size"
for_ ::  MisoString -> Attribute action
for_               = textProp "for"
ref_ ::  MisoString -> Attribute action
ref_               = textProp "ref"
form_ ::  MisoString -> Attribute action
form_               = textProp "form"
max_ ::  MisoString -> Attribute action
max_               = textProp "max"
min_ ::  MisoString -> Attribute action
min_               = textProp "min"
step_ ::  MisoString -> Attribute action
step_              = textProp "step"
cols_ ::  MisoString -> Attribute action
cols_              = textProp "cols"
rows_ ::  MisoString -> Attribute action
rows_              = textProp "rows"
wrap_ ::  MisoString -> Attribute action
wrap_              = textProp "wrap"
target_ ::  MisoString -> Attribute action
target_            = textProp "target"
download_ ::  MisoString -> Attribute action
download_          = textProp "download"
downloadAs_ ::  MisoString -> Attribute action
downloadAs_        = textProp "downloadAs"
hreflang_ ::  MisoString -> Attribute action
hreflang_          = textProp "hreflang"
media_ ::  MisoString -> Attribute action
media_             = textProp "media"
ping_ ::  MisoString -> Attribute action
ping_              = textProp "ping"
rel_ ::  MisoString -> Attribute action
rel_               = textProp "rel"
ismap_ ::  MisoString -> Attribute action
ismap_             = textProp "ismap"
usemap_ ::  MisoString -> Attribute action
usemap_            = textProp "usemap"
shape_ ::  MisoString -> Attribute action
shape_             = textProp "shape"
coords_ ::  MisoString -> Attribute action
coords_            = textProp "coords"
src_ ::  MisoString -> Attribute action
src_               = textProp "src"
height_ ::  MisoString -> Attribute action
height_            = textProp "height"
width_ ::  MisoString -> Attribute action
width_             = textProp "width"
alt_ ::  MisoString -> Attribute action
alt_               = textProp "alt"
loading_ ::  MisoString -> Attribute action
loading_           = textProp "loading"
autoplay_ ::  Bool -> Attribute action
autoplay_          = boolProp "autoplay"
controls_ ::  Bool -> Attribute action
controls_          = boolProp "controls"
loop_ ::  Bool -> Attribute action
loop_              = boolProp "loop"
preload_ ::  MisoString -> Attribute action
preload_           = textProp "preload"
poster_ ::  MisoString -> Attribute action
poster_            = textProp "poster"
default_ ::  Bool -> Attribute action
default_           = boolProp "default"
kind_ ::  MisoString -> Attribute action
kind_              = textProp "kind"
srclang_ ::  MisoString -> Attribute action
srclang_           = textProp "srclang"
sandbox_ ::  MisoString -> Attribute action
sandbox_           = textProp "sandbox"
seamless_ ::  MisoString -> Attribute action
seamless_          = textProp "seamless"
srcdoc_ ::  MisoString -> Attribute action
srcdoc_            = textProp "srcdoc"
reversed_ ::  MisoString -> Attribute action
reversed_          = textProp "reversed"
start_ ::  MisoString -> Attribute action
start_             = textProp "start"
align_ ::  MisoString -> Attribute action
align_             = textProp "align"
  | <  >
colspan_ ::  MisoString -> Attribute action
colspan_           = textProp "colspan"
rowspan_ ::  MisoString -> Attribute action
rowspan_           = textProp "rowspan"
headers_ ::  MisoString -> Attribute action
headers_           = textProp "headers"
scope_ ::  MisoString -> Attribute action
scope_             = textProp "scope"
async_ ::  MisoString -> Attribute action
async_             = textProp "async"
charset_ ::  MisoString -> Attribute action
charset_           = textProp "charset"
content_ ::  MisoString -> Attribute action
content_           = textProp "content"
defer_ ::  MisoString -> Attribute action
defer_             = textProp "defer"
httpEquiv_ ::  MisoString -> Attribute action
httpEquiv_         = textProp "httpEquiv"
language_ ::  MisoString -> Attribute action
language_          = textProp "language"
scoped_ ::  MisoString -> Attribute action
scoped_            = textProp "scoped"
type_ ::  MisoString -> Attribute action
type_ = textProp "type"
name_ ::  MisoString -> Attribute action
name_ = textProp "name"
href_ ::  MisoString -> Attribute action
href_ = textProp "href"
id_ ::  MisoString -> Attribute action
id_ = textProp "id"
placeholder_ ::  MisoString -> Attribute action
placeholder_ = textProp "placeholder"
checked_ ::  Bool -> Attribute action
checked_ = boolProp "checked"
autofocus_ ::  Bool -> Attribute action
autofocus_ = boolProp "autofocus"
class_ ::  MisoString -> Attribute action
class_ = textProp "class"
data_ ::  MisoString -> MisoString -> Attribute action
data_ k v = textProp ("data-" <> k) v
styleInline_ ::  MisoString -> Attribute action
styleInline_ = textProp "style"
