clay-0.15.0: CSS preprocessor as embedded Haskell.

Safe Haskell | None
Language | Haskell2010

Clay.Selector

Synopsis

- star :: Selector
- element :: Text -> Selector
- deep :: Selector -> Selector -> Selector
- (**) :: Selector -> Selector -> Selector
- child :: Selector -> Selector -> Selector
- (|>) :: Selector -> Selector -> Selector
- (|+) :: Selector -> Selector -> Selector
- (|~) :: Selector -> Selector -> Selector
- with :: Selector -> Refinement -> Selector
- (#) :: Selector -> Refinement -> Selector
- byId :: Text -> Refinement
- byClass :: Text -> Refinement
- pseudo :: Text -> Refinement
- func :: Text -> [Text] -> Refinement
- attr :: Text -> Refinement
- (@=) :: Text -> Text -> Refinement
- (^=) :: Text -> Text -> Refinement
- ($=) :: Text -> Text -> Refinement
- (*=) :: Text -> Text -> Refinement
- (~=) :: Text -> Text -> Refinement
- (|=) :: Text -> Text -> Refinement
- data Predicate
  - = Id Text
  - | Class Text
  - | Attr Text
  - | AttrVal Text Text
  - | AttrBegins Text Text
  - | AttrEnds Text Text
  - | AttrContains Text Text
  - | AttrSpace Text Text
  - | AttrHyph Text Text
  - | Pseudo Text
  - | PseudoFunc Text [Text]
  - | PseudoElem Text
- newtype Refinement = Refinement {
  - unFilter :: [Predicate]
  }
- refinementFromText :: Text -> Refinement
- data Path f
  - = Star
  - | Elem Text
  - | Child f f
  - | Deep f f
  - | Adjacent f f
  - | Sibling f f
  - | Combined f f
- newtype Fix (f :: Type -> Type) = In {
  - out :: f (Fix f)
  }
- data SelectorF a = SelectorF Refinement (Path a)
- type Selector = Fix SelectorF
- selectorFromText :: Text -> Selector

# Documentation

star :: Selector #

The star selector applies to all elements. Maps to `*` in CSS.

element :: Text -> Selector #

Select elements by name. The preferred syntax is to enable `OverloadedStrings` and actually just use `"element-name"` or use one of the predefined elements from Clay.Elements.

deep :: Selector -> Selector -> Selector #

Named alias for `**`.

(**) :: Selector -> Selector -> Selector #

The deep selector composer. Maps to `sel1 sel2` in CSS.

child :: Selector -> Selector -> Selector #

Named alias for `|>`.

(|>) :: Selector -> Selector -> Selector #

The child selector composer. Maps to `sel1 > sel2` in CSS.

(|+) :: Selector -> Selector -> Selector #

The adjacent selector composer. Maps to `sel1 + sel2` in CSS.

(|~) :: Selector -> Selector -> Selector #

The general sibling selector composer. Maps to `sel1 ~ sel2` in CSS.

with :: Selector -> Refinement -> Selector #

Named alias for `#`.

(#) :: Selector -> Refinement -> Selector #

The filter selector composer, adds a filter to a selector. Maps to something like `sel#filter` or `sel.filter` in CSS, depending on the filter.

byId :: Text -> Refinement #

Filter elements by id. The preferred syntax is to enable `OverloadedStrings` and use `"#id-name"`.

byClass :: Text -> Refinement #

Filter elements by class. The preferred syntax is to enable `OverloadedStrings` and use `".class-name"`.

pseudo :: Text -> Refinement #

Filter elements by pseudo selector or pseudo class. The preferred syntax is to enable `OverloadedStrings` and use `":pseudo-selector"` or use one of the predefined ones from Clay.Pseudo.

func :: Text -> [Text] -> Refinement #

Filter elements by pseudo selector functions. The preferred way is to use one of the predefined functions from Clay.Pseudo.

attr :: Text -> Refinement #

Filter elements based on the presence of a certain attribute. The preferred syntax is to enable `OverloadedStrings` and use `"@attr"` or use one of the predefined ones from Clay.Attributes.

(@=) :: Text -> Text -> Refinement #

Filter elements based on the presence of a certain attribute with the specified value.

(^=) :: Text -> Text -> Refinement #

Filter elements based on the presence of a certain attribute that begins with the selected value.

($=) :: Text -> Text -> Refinement #

Filter elements based on the presence of a certain attribute that ends with the specified value.

(*=) :: Text -> Text -> Refinement #

Filter elements based on the presence of a certain attribute that contains the specified value as a substring.

(~=) :: Text -> Text -> Refinement #

Filter elements based on the presence of a certain attribute that have the specified value contained in a space separated list.

(|=) :: Text -> Text -> Refinement #

Filter elements based on the presence of a certain attribute that have the specified value contained in a hyphen separated list.

data Predicate #

Constructors

Id Text |
Class Text |
Attr Text |
AttrVal Text Text |
AttrBegins Text Text |
AttrEnds Text Text |
AttrContains Text Text |
AttrSpace Text Text |
AttrHyph Text Text |
Pseudo Text |
PseudoFunc Text [Text] |
PseudoElem Text |

#### Instances

Instances details

Show Predicate # |
Instance details Defined in Clay.Selector Methods showsPrec :: Int -> Predicate -> ShowS # show :: Predicate -> String # showList :: [Predicate] -> ShowS #
Eq Predicate # |
Instance details Defined in Clay.Selector Methods (==) :: Predicate -> Predicate -> Bool # (/=) :: Predicate -> Predicate -> Bool #
Ord Predicate # |
Instance details Defined in Clay.Selector Methods compare :: Predicate -> Predicate -> Ordering # (<) :: Predicate -> Predicate -> Bool # (<=) :: Predicate -> Predicate -> Bool # (>) :: Predicate -> Predicate -> Bool # (>=) :: Predicate -> Predicate -> Bool # max :: Predicate -> Predicate -> Predicate # min :: Predicate -> Predicate -> Predicate #

newtype Refinement #

Constructors

Refinement |
Fields unFilter :: [Predicate]

#### Instances

Instances details

IsString Refinement # |
Instance details Defined in Clay.Selector Methods fromString :: String -> Refinement #
Monoid Refinement # |
Instance details Defined in Clay.Selector Methods mempty :: Refinement # mappend :: Refinement -> Refinement -> Refinement # mconcat :: [Refinement] -> Refinement #
Semigroup Refinement # |
Instance details Defined in Clay.Selector Methods (<>) :: Refinement -> Refinement -> Refinement # sconcat :: NonEmpty Refinement -> Refinement # stimes :: Integral b => b -> Refinement -> Refinement #
Show Refinement # |
Instance details Defined in Clay.Selector Methods showsPrec :: Int -> Refinement -> ShowS # show :: Refinement -> String # showList :: [Refinement] -> ShowS #

refinementFromText :: Text -> Refinement #

data Path f #

Constructors

Star |
Elem Text |
Child f f |
Deep f f |
Adjacent f f |
Sibling f f |
Combined f f |

#### Instances

Instances details

Show f => Show (Path f) # |
Instance details Defined in Clay.Selector Methods showsPrec :: Int -> Path f -> ShowS # show :: Path f -> String # showList :: [Path f] -> ShowS #

newtype Fix (f :: Type -> Type) #

Constructors

In |
Fields out :: f (Fix f)

#### Instances

Instances details

IsString (Fix SelectorF) # |
Instance details Defined in Clay.Selector Methods fromString :: String -> Fix SelectorF #
Monoid (Fix SelectorF) # |
Instance details Defined in Clay.Selector Methods mempty :: Fix SelectorF # mappend :: Fix SelectorF -> Fix SelectorF -> Fix SelectorF # mconcat :: [Fix SelectorF] -> Fix SelectorF #
Semigroup (Fix SelectorF) # |
Instance details Defined in Clay.Selector Methods (<>) :: Fix SelectorF -> Fix SelectorF -> Fix SelectorF # sconcat :: NonEmpty (Fix SelectorF) -> Fix SelectorF # stimes :: Integral b => b -> Fix SelectorF -> Fix SelectorF #
Show (f (Fix f)) => Show (Fix f) # |
Instance details Defined in Clay.Selector Methods showsPrec :: Int -> Fix f -> ShowS # show :: Fix f -> String # showList :: [Fix f] -> ShowS #

data SelectorF a #

Constructors

SelectorF Refinement (Path a) |

#### Instances

Instances details

IsString (Fix SelectorF) # |
Instance details Defined in Clay.Selector Methods fromString :: String -> Fix SelectorF #
Monoid (Fix SelectorF) # |
Instance details Defined in Clay.Selector Methods mempty :: Fix SelectorF # mappend :: Fix SelectorF -> Fix SelectorF -> Fix SelectorF # mconcat :: [Fix SelectorF] -> Fix SelectorF #
Semigroup (Fix SelectorF) # |
Instance details Defined in Clay.Selector Methods (<>) :: Fix SelectorF -> Fix SelectorF -> Fix SelectorF # sconcat :: NonEmpty (Fix SelectorF) -> Fix SelectorF # stimes :: Integral b => b -> Fix SelectorF -> Fix SelectorF #
Show a => Show (SelectorF a) # |
Instance details Defined in Clay.Selector Methods showsPrec :: Int -> SelectorF a -> ShowS # show :: SelectorF a -> String # showList :: [SelectorF a] -> ShowS #

type Selector = Fix SelectorF #

selectorFromText :: Text -> Selector #