language-css-0.0.3.1: CSS 2.1 syntax

Safe HaskellSafe
LanguageHaskell2010

Language.Css.Build

Contents

Description

Combinators to build AST

Example :

import Language.Css.Syntax
import Language.Css.Build
import Language.Css.Pretty
import Language.Css.Build.Idents
import Language.Css.Build.Tags hiding (center)

res = ruleSets [
         body [
             margin <:> int 0,
             border <:> int 0 ],

         h1 [ textAlign <:> center],

         p [
            backgroundColor <:> black,
            color <:> white,
            padding <:> spaces [pct 5, pct 5, pct 10, pct 10]  ],

         (star /. "warning") [ color <:> red ]
       ]

main = print $ pretty res
Synopsis

Classes

class Idents a where Source #

Methods

ident :: String -> a Source #

Instances
Idents String Source # 
Instance details

Defined in Language.Css.Build

Methods

ident :: String -> String Source #

Idents Value Source # 
Instance details

Defined in Language.Css.Build

Methods

ident :: String -> Value Source #

Idents Expr Source # 
Instance details

Defined in Language.Css.Build

Methods

ident :: String -> Expr Source #

Idents PseudoVal Source # 
Instance details

Defined in Language.Css.Build

Idents Attr Source # 
Instance details

Defined in Language.Css.Build

Methods

ident :: String -> Attr Source #

Idents Ident Source # 
Instance details

Defined in Language.Css.Build

Methods

ident :: String -> Ident Source #

Idents Sel' Source # 
Instance details

Defined in Language.Css.Build

Methods

ident :: String -> Sel' Source #

class ToExpr a where Source #

Methods

expr :: a -> Expr Source #

Instances
ToExpr Double Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Double -> Expr Source #

ToExpr Int Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Int -> Expr Source #

ToExpr Uri Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Uri -> Expr Source #

ToExpr S Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: S -> Expr Source #

ToExpr Ms Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Ms -> Expr Source #

ToExpr Percentage Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Percentage -> Expr Source #

ToExpr Pt Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Pt -> Expr Source #

ToExpr Pc Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Pc -> Expr Source #

ToExpr Mm Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Mm -> Expr Source #

ToExpr Cm Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Cm -> Expr Source #

ToExpr In Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: In -> Expr Source #

ToExpr Px Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Px -> Expr Source #

ToExpr Ex Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Ex -> Expr Source #

ToExpr Em Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Em -> Expr Source #

ToExpr KHz Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: KHz -> Expr Source #

ToExpr Hz Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Hz -> Expr Source #

ToExpr Color Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Color -> Expr Source #

ToExpr Grad Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Grad -> Expr Source #

ToExpr Rad Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Rad -> Expr Source #

ToExpr Deg Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Deg -> Expr Source #

ToExpr Func Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Func -> Expr Source #

ToExpr Value Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Value -> Expr Source #

ToExpr Expr Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Expr -> Expr Source #

ToExpr Ident Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: Ident -> Expr Source #

ToExpr a => ToExpr [a] Source # 
Instance details

Defined in Language.Css.Build

Methods

expr :: [a] -> Expr Source #

StyleSheet

rules :: [StyleBody] -> StyleSheet Source #

construct StyleSheet from list of AtRule 's or RuleSet 's

ruleSets :: [RuleSet] -> StyleSheet Source #

construct StyleSheet from list of RuleSet 's

addImports :: [AtImport] -> StyleSheet -> StyleSheet Source #

append imports

AtRules

media :: [String] -> [RuleSet] -> StyleBody Source #

@media

fontFace :: [Decl] -> StyleBody Source #

@font-face

RuleSets

Selectors

type Sel' = [Decl] -> RuleSet Source #

RuleSet constructor

star :: Sel' Source #

* selector

sels :: [Sel'] -> Sel' Source #

groups selectors

(/>) :: Sel' -> Sel' -> Sel' infixl 5 Source #

Child

> in css

(/-) :: Sel' -> Sel' -> Sel' infixl 5 Source #

Descendant

space in css

(/#) :: Sel' -> String -> Sel' infixl 6 Source #

set id

(/.) :: Sel' -> String -> Sel' infixl 6 Source #

set class

(/:) :: Sel' -> PseudoVal -> Sel' infixl 6 Source #

set pseudo classes/elements

class Attrs a where Source #

attribute selector

Methods

attr :: String -> a Source #

Instances
Attrs AttrIdent Source # 
Instance details

Defined in Language.Css.Build

Attrs Attr Source # 
Instance details

Defined in Language.Css.Build

Methods

attr :: String -> Attr Source #

(!) :: Sel' -> Attr -> Sel' infixl 6 Source #

set attributes

(.=) :: AttrIdent -> AttrVal -> Attr Source #

element's attribute is

(~=) :: AttrIdent -> AttrVal -> Attr Source #

element's attribute includes

(|=) :: AttrIdent -> AttrVal -> Attr Source #

element's attribute begins with

Declarations

(<:>) :: String -> Expr -> Decl infixr 0 Source #

declaration constructor

important :: Decl -> Decl Source #

set !important

space :: Expr -> Expr -> Expr Source #

space separated values

slash :: Expr -> Expr -> Expr Source #

slash separated values

comma :: Expr -> Expr -> Expr Source #

comma separated values

spaces :: [Expr] -> Expr Source #

space on list of values

slashes :: [Expr] -> Expr Source #

slash on list of values

commas :: [Expr] -> Expr Source #

comma on lists of values

Primitive values

fun :: ToExpr a => Ident -> a -> Func Source #

Func constructor

deg :: Double -> Expr Source #

<angle>

rad :: Double -> Expr Source #

<angle>

grad :: Double -> Expr Source #

<angle>

cword :: String -> Expr Source #

<color>

rgb :: Int -> Int -> Int -> Expr Source #

<color>

hz :: Double -> Expr Source #

<frequency>

khz :: Double -> Expr Source #

<frequency>

em :: Double -> Expr Source #

<length>

ex :: Double -> Expr Source #

<length>

px :: Int -> Expr Source #

<length>

in' :: Double -> Expr Source #

<length>

cm :: Double -> Expr Source #

<length>

mm :: Double -> Expr Source #

<length>

pc :: Double -> Expr Source #

<length>

pt :: Int -> Expr Source #

<length>

pct :: Double -> Expr Source #

<percentage>

ms :: Double -> Expr Source #

<time>

s :: Double -> Expr Source #

<time>

url :: String -> Expr Source #

<uri>

Colors