{-# LANGUAGE OverloadedStrings #-}
module Language.Ltml.HTML.CSS.CustomClay
(
renderStrict
, Counter (..)
, counter
, counterNum
, counterChar
, counterCharCapital
, stringCounter
, counterReset
, counterIncrement
, alignLeft
, alignRight
, displayContents
, autoLayout
, gap
, scrollMarginTop
, tableLayout
, justifyItems
) where
import Clay hiding (a, b, s)
import Data.Text (Text)
import Data.Text.Lazy (toStrict)
renderStrict :: Css -> Text
renderStrict :: Css -> Text
renderStrict = LazyText -> Text
toStrict (LazyText -> Text) -> (Css -> LazyText) -> Css -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Css -> LazyText
render
counterReset :: Text -> Css
counterReset :: Text -> Css
counterReset Text
t = Key Text
"counter-reset" Key Text -> Text -> Css
-: Text
t
counterIncrement :: Text -> Css
counterIncrement :: Text -> Css
counterIncrement Text
t = Key Text
"counter-increment" Key Text -> Text -> Css
-: Text
t
newtype Counter = Counter {Counter -> Text
unCounter :: Text}
counter :: Counter -> Css
counter :: Counter -> Css
counter Counter
c = Key Text
"content" Key Text -> Text -> Css
-: Counter -> Text
unCounter Counter
c
counterNum :: Text -> Counter
counterNum :: Text -> Counter
counterNum Text
t = Text -> Counter
Counter (Text -> Counter) -> Text -> Counter
forall a b. (a -> b) -> a -> b
$ Text
"counter(" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
t Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
")"
counterChar :: Text -> Counter
counterChar :: Text -> Counter
counterChar Text
t = Text -> Counter
Counter (Text -> Counter) -> Text -> Counter
forall a b. (a -> b) -> a -> b
$ Text
"counter(" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
t Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", lower-alpha)"
counterCharCapital :: Text -> Counter
counterCharCapital :: Text -> Counter
counterCharCapital Text
t = Text -> Counter
Counter (Text -> Counter) -> Text -> Counter
forall a b. (a -> b) -> a -> b
$ Text
"counter(" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
t Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", upper-alpha)"
stringCounter :: Text -> Counter
stringCounter :: Text -> Counter
stringCounter Text
t = Text -> Counter
Counter (Text -> Counter) -> Text -> Counter
forall a b. (a -> b) -> a -> b
$ Text
"\"" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
t Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\""
instance Monoid Counter where
mempty :: Counter
mempty = Text -> Counter
Counter Text
""
instance Semigroup Counter where
Counter Text
a <> :: Counter -> Counter -> Counter
<> Counter Text
b = Text -> Counter
Counter (Text
a Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
b)
alignLeft :: TextAlign
alignLeft :: TextAlign
alignLeft = Value -> TextAlign
forall a. Other a => Value -> a
other Value
"left"
alignRight :: TextAlign
alignRight :: TextAlign
alignRight = Value -> TextAlign
forall a. Other a => Value -> a
other Value
"right"
displayContents :: Display
displayContents :: Display
displayContents = Value -> Display
forall a. Other a => Value -> a
other Value
"contents"
autoLayout :: Position
autoLayout :: Position
autoLayout = Value -> Position
forall a. Other a => Value -> a
other Value
"auto"
gap :: Size LengthUnit -> Css
gap :: Size LengthUnit -> Css
gap Size LengthUnit
s = Key Text
"gap" Key Text -> Text -> Css
-: Prefixed -> Text
unPlain (Value -> Prefixed
unValue (Value -> Prefixed) -> Value -> Prefixed
forall a b. (a -> b) -> a -> b
$ Size LengthUnit -> Value
forall a. Val a => a -> Value
value Size LengthUnit
s)
scrollMarginTop :: Size LengthUnit -> Css
scrollMarginTop :: Size LengthUnit -> Css
scrollMarginTop Size LengthUnit
s = Key Text
"scroll-margin-top" Key Text -> Text -> Css
-: Prefixed -> Text
unPlain (Value -> Prefixed
unValue (Value -> Prefixed) -> Value -> Prefixed
forall a b. (a -> b) -> a -> b
$ Size LengthUnit -> Value
forall a. Val a => a -> Value
value Size LengthUnit
s)
tableLayout :: Position -> Css
tableLayout :: Position -> Css
tableLayout Position
arg = Key Text
"table-layout" Key Text -> Text -> Css
-: Prefixed -> Text
unPlain (Value -> Prefixed
unValue (Value -> Prefixed) -> Value -> Prefixed
forall a b. (a -> b) -> a -> b
$ Position -> Value
forall a. Val a => a -> Value
value Position
arg)
justifyItems :: JustifyContentValue -> Css
justifyItems :: JustifyContentValue -> Css
justifyItems JustifyContentValue
arg = Key Text
"justify-items" Key Text -> Text -> Css
-: Prefixed -> Text
unPlain (Value -> Prefixed
unValue (Value -> Prefixed) -> Value -> Prefixed
forall a b. (a -> b) -> a -> b
$ JustifyContentValue -> Value
forall a. Val a => a -> Value
value JustifyContentValue
arg)