stylist-2.4.0.2: Apply CSS styles to a document tree.
Safe HaskellNone
LanguageHaskell2010

Data.CSS.Style

Description

Queries computed styles out of a specially-parsed CSS stylesheet. See in particular QueryableStyleSheet, queryRules, & cascade`.

Synopsis

Documentation

type QueryableStyleSheet parser = QueryableStyleSheet' (ImportanceSplitter (PropertyExpander parser (OrderedRuleStore (WhereLowerer (InterpretedRuleStore StyleIndex))))) parser Source #

A parsed CSS stylesheet from which you can query styles to match an element.

data QueryableStyleSheet' store parser Source #

More generic version of QueryableStyleSheet.

Constructors

QueryableStyleSheet' 

Fields

  • store :: store

    Internal datastructure for efficient style lookup.

  • parser :: parser

    The PropertyParser to use for property syntax validation.

  • priority :: Int

    Whether author, useragent, or user styles are currently being parsed.

queryableStyleSheet :: PropertyParser p => QueryableStyleSheet p Source #

Constructs an empty QueryableStyleSheet'.

queryRules :: (PropertyParser p, RuleStore s) => QueryableStyleSheet' s p -> Element -> HashMap Text [StyleRule'] Source #

Looks up style rules matching the specified element, grouped by psuedoelement.

class PropertyParser a where Source #

Defines how to parse CSS properties into an output "style" format.

Minimal complete definition

temp, longhand

Methods

temp :: a Source #

Default styles.

inherit :: a -> a Source #

Creates a style inherited from a parent style.

shorthand :: a -> Text -> [Token] -> [(Text, [Token])] Source #

Expand a shorthand property into longhand properties.

longhand :: a -> a -> Text -> [Token] -> Maybe a Source #

getVars :: a -> Props Source #

Retrieve stored variables, optional.

setVars :: Props -> a -> a Source #

Save variable values, optional.

cascade :: PropertyParser p => QueryableStyleSheet p -> Element -> Props -> p -> p Source #

Facade over queryRules & cascade` for simple cases you don't care about psuedoelements.

cascade' :: PropertyParser p => [StyleRule'] -> Props -> p -> p Source #

Selects used property values from the given style rules, & populates into a new PropertyParser inheriting from the one given.

data VarParser a Source #

PropertyParser that lowers var() calls before forwarding to another.

Constructors

VarParser 

Fields

Instances

Instances details
PropertyParser p => PropertyParser (VarParser p) Source # 
Instance details

Defined in Data.CSS.Style

data Element Source #

An inversely-linked tree of elements, to apply CSS selectors to.

Constructors

ElementNode 

Fields

data Attribute Source #

A key-value attribute.

Constructors

Attribute Text Text String 

Instances

Instances details
Eq Attribute Source # 
Instance details

Defined in Data.CSS.Style.Common

Ord Attribute Source # 
Instance details

Defined in Data.CSS.Style.Common