Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module prives a DSL for HTML properties
This DSL is entirely optional. You may use the Prop
constructors
provided by Shpadoinkle core and completely ignore this module.
But for those who like a typed DSL with named functions for
different properties, and nice overloading, this is for you.
Unlike Events and Elements, Properties come in one flavor. Vanilla.
Each named function documents the type of property it constructs
whether it be Text
or Bool
. We also support other types
such as Int
, and Float
, but via converting them to Text
and
letting JavaScript weirdness cast them to the correct underlying type.
Synopsis
- type TextProperty t = forall m a. ToPropText t => t -> (Text, Prop m a)
- class ToPropText a where
- toPropText :: a -> Text
- textProperty :: ToPropText a => Text -> a -> (Text, Prop m o)
- newtype ClassList = ClassList {
- unClassList :: Set Text
- class ClassListRep a where
- flagProperty :: Text -> Bool -> (Text, Prop m a)
- className :: ClassListRep cl => cl -> (Text, Prop m a)
- class' :: ClassList -> (Text, Prop m a)
- for' :: Text -> (Text, Prop m a)
- reversed :: Bool -> (Text, Prop m a)
- default' :: Bool -> (Text, Prop m a)
- usemap :: Bool -> (Text, Prop m a)
- ismap :: Bool -> (Text, Prop m a)
- required :: Bool -> (Text, Prop m a)
- readonly :: Bool -> (Text, Prop m a)
- novalidate :: Bool -> (Text, Prop m a)
- multiple :: Bool -> (Text, Prop m a)
- loop :: Bool -> (Text, Prop m a)
- controls :: Bool -> (Text, Prop m a)
- autoplay :: Bool -> (Text, Prop m a)
- disabled :: Bool -> (Text, Prop m a)
- autofocus :: Bool -> (Text, Prop m a)
- autocomplete :: Bool -> (Text, Prop m a)
- hidden :: Bool -> (Text, Prop m a)
- selected :: Bool -> (Text, Prop m a)
- checked :: Bool -> (Text, Prop m a)
- property :: Text -> (Text, Prop m a)
- content :: Text -> (Text, Prop m a)
- charset :: Text -> (Text, Prop m a)
- itemprop :: Text -> (Text, Prop m a)
- dropzone :: Text -> (Text, Prop m a)
- draggable :: Text -> (Text, Prop m a)
- contextmenu :: Text -> (Text, Prop m a)
- manifest :: Text -> (Text, Prop m a)
- pubdate :: Text -> (Text, Prop m a)
- datetime :: Text -> (Text, Prop m a)
- scope :: Text -> (Text, Prop m a)
- headers :: Text -> (Text, Prop m a)
- align :: Text -> (Text, Prop m a)
- srcdoc :: Text -> (Text, Prop m a)
- sandbox :: Text -> (Text, Prop m a)
- srclang :: Text -> (Text, Prop m a)
- kind' :: Text -> (Text, Prop m a)
- name' :: Text -> (Text, Prop m a)
- poster :: Text -> (Text, Prop m a)
- preload :: Text -> (Text, Prop m a)
- alt :: Text -> (Text, Prop m a)
- coords :: Text -> (Text, Prop m a)
- shape :: Text -> (Text, Prop m a)
- ping :: Text -> (Text, Prop m a)
- media :: Text -> (Text, Prop m a)
- hreflang :: Text -> (Text, Prop m a)
- download :: Text -> (Text, Prop m a)
- target :: Text -> (Text, Prop m a)
- wrap :: Text -> (Text, Prop m a)
- step :: Text -> (Text, Prop m a)
- min :: Text -> (Text, Prop m a)
- max :: Text -> (Text, Prop m a)
- pattern :: Text -> (Text, Prop m a)
- method :: Text -> (Text, Prop m a)
- enctype :: Text -> (Text, Prop m a)
- acceptCharset :: Text -> (Text, Prop m a)
- action :: Text -> (Text, Prop m a)
- accpetCharset :: Text -> (Text, Prop m a)
- accept :: Text -> (Text, Prop m a)
- title :: Text -> (Text, Prop m a)
- src :: Text -> (Text, Prop m a)
- value :: Text -> (Text, Prop m a)
- placeholder :: Text -> (Text, Prop m a)
- href :: Text -> (Text, Prop m a)
- rel :: Text -> (Text, Prop m a)
- type' :: Text -> (Text, Prop m a)
- id' :: Text -> (Text, Prop m a)
- height :: Int -> (Text, Prop m a)
- width :: Int -> (Text, Prop m a)
- tabIndex :: Int -> (Text, Prop m a)
- tabbable :: (Text, Prop m o)
Documentation
type TextProperty t = forall m a. ToPropText t => t -> (Text, Prop m a) Source #
class ToPropText a where Source #
How do we take a non-textual value, and make it text JavaScript will cast appropriately
toPropText :: a -> Text Source #
Instances
ToPropText Bool Source # | |
Defined in Shpadoinkle.Html.Property toPropText :: Bool -> Text Source # | |
ToPropText Float Source # | |
Defined in Shpadoinkle.Html.Property toPropText :: Float -> Text Source # | |
ToPropText Int Source # | |
Defined in Shpadoinkle.Html.Property toPropText :: Int -> Text Source # | |
ToPropText Text Source # | |
Defined in Shpadoinkle.Html.Property toPropText :: Text -> Text Source # |
textProperty :: ToPropText a => Text -> a -> (Text, Prop m o) Source #
Instances
Eq ClassList Source # | |
Ord ClassList Source # | |
Defined in Shpadoinkle.Html.Property | |
Show ClassList Source # | |
IsString ClassList Source # | |
Defined in Shpadoinkle.Html.Property fromString :: String -> ClassList # | |
Semigroup ClassList Source # | |
Monoid ClassList Source # | |
ClassListRep ClassList Source # | |
class ClassListRep a where Source #
Instances
ClassListRep Text Source # | |
ClassListRep ClassList Source # | |
ClassListRep [(Text, Bool)] Source # | |
ClassListRep [Text] Source # | |
ClassListRep (Text, Bool) Source # | |