Safe Haskell | None |
---|---|
Language | Haskell2010 |
Evaluates conditional CSS rules.
Parse a CSS stylesheet to
document & ConditionalStyles
to evaluate supports rules.
Call
import rules to loadImports
to resolve any media rules.
And call
media rules.resolve
to convert into another StyleSheet
instance whilst resolving
Synopsis
- data ConditionalStyles p = ConditionalStyles {
- hostURL :: URI
- mediaDocument :: String
- isUnstyled :: Bool
- rules :: [ConditionalRule p]
- propertyParser :: p
- layers :: Tree
- layerNamespace :: [Text]
- layerPath' :: [Int]
- conditionalStyles :: PropertyParser p => URI -> String -> ConditionalStyles p
- data ConditionalRule p
- extractImports :: (Text -> Datum) -> (Token -> Datum) -> ConditionalStyles p -> [URI]
- resolveImports :: ConditionalStyles p -> [(URI, ConditionalStyles p)] -> ConditionalStyles p
- loadImports :: PropertyParser p => (URI -> IO Text) -> (Text -> Datum) -> (Token -> Datum) -> ConditionalStyles p -> [URI] -> IO (ConditionalStyles p)
- resolve :: StyleSheet s => (Text -> Datum) -> (Token -> Datum) -> s -> ConditionalStyles p -> s
- testIsStyled :: ConditionalStyles p -> ConditionalStyles p
- data Datum
Documentation
data ConditionalStyles p Source #
Collects and evaluates conditional at-rules.
ConditionalStyles | |
|
Instances
PropertyParser p => StyleSheet (ConditionalStyles p) Source # | |
Defined in Data.CSS.Preprocessor.Conditions setPriority :: Int -> ConditionalStyles p -> ConditionalStyles p # setPriorities :: [Int] -> ConditionalStyles p -> ConditionalStyles p # addRule :: ConditionalStyles p -> StyleRule -> ConditionalStyles p # addAtRule :: ConditionalStyles p -> Text -> [Token] -> (ConditionalStyles p, [Token]) # |
conditionalStyles :: PropertyParser p => URI -> String -> ConditionalStyles p Source #
Constructs an empty ConditionalStyles
.
data ConditionalRule p Source #
Style rules that can be queued in a ConditionalStyles
.
extractImports :: (Text -> Datum) -> (Token -> Datum) -> ConditionalStyles p -> [URI] Source #
Returns `@import` URLs that need to be imported.
resolveImports :: ConditionalStyles p -> [(URI, ConditionalStyles p)] -> ConditionalStyles p Source #
Substitutes external values in for `@import` rules.
loadImports :: PropertyParser p => (URI -> IO Text) -> (Text -> Datum) -> (Token -> Datum) -> ConditionalStyles p -> [URI] -> IO (ConditionalStyles p) Source #
Evaluates a given "loader" to resolve any `@import` rules.
resolve :: StyleSheet s => (Text -> Datum) -> (Token -> Datum) -> s -> ConditionalStyles p -> s Source #
Evaluates any media queries, returning a new StyleSheet with the queued operations.
testIsStyled :: ConditionalStyles p -> ConditionalStyles p Source #
Flags whether any style rules have been applied yet, for the sake of evaluating "@document unstyled {...}".