Safe Haskell | None |
---|---|
Language | Haskell2010 |
Define the types used to describes CSS elements
Synopsis
- data CssSelector
- type CssSelectorRule = [CssSelector]
- data CssRule = CssRule {}
- data CssDescriptor
- data CssDeclaration = CssDeclaration {}
- data CssElement
- = CssIdent !Text
- | CssString !Text
- | CssReference !Text
- | CssNumber !Number
- | CssColor !PixelRGBA8
- | CssFunction !Text ![CssElement]
- | CssOpComa
- | CssOpSlash
- class CssMatcheable a where
- type CssContext a = [[a]]
- type Dpi = Int
- data Number
- serializeNumber :: Number -> String
- findMatchingDeclarations :: CssMatcheable a => [CssRule] -> CssContext a -> [CssDeclaration]
- toUserUnit :: Dpi -> Number -> Number
- mapNumber :: (Double -> Double) -> Number -> Number
- tserialize :: TextBuildable a => a -> Builder
Documentation
data CssSelector Source #
Define complex selector.
Nearby | Correspond to the |
DirectChildren | Correspond to the |
AllOf [CssDescriptor] | Grouping construct, all the elements of the list must be matched. |
Instances
Eq CssSelector Source # | |
Defined in Graphics.SvgTree.CssTypes (==) :: CssSelector -> CssSelector -> Bool # (/=) :: CssSelector -> CssSelector -> Bool # | |
Show CssSelector Source # | |
Defined in Graphics.SvgTree.CssTypes showsPrec :: Int -> CssSelector -> ShowS # show :: CssSelector -> String # showList :: [CssSelector] -> ShowS # |
type CssSelectorRule = [CssSelector] Source #
A CssSelectorRule is a list of all the elements that must be meet in a depth first search fashion.
Represent a CSS selector and the different declarations to apply to the matched elemens.
CssRule | |
|
data CssDescriptor Source #
Describe an element of a CSS selector. Multiple elements can be combined in a CssSelector type.
OfClass Text | .IDENT |
OfName Text | IDENT |
OfId Text | #IDENT |
OfPseudoClass Text | `:IDENT` (ignore function syntax) |
AnyElem | |
WithAttrib Text Text | `` |
Instances
Eq CssDescriptor Source # | |
Defined in Graphics.SvgTree.CssTypes (==) :: CssDescriptor -> CssDescriptor -> Bool # (/=) :: CssDescriptor -> CssDescriptor -> Bool # | |
Show CssDescriptor Source # | |
Defined in Graphics.SvgTree.CssTypes showsPrec :: Int -> CssDescriptor -> ShowS # show :: CssDescriptor -> String # showList :: [CssDescriptor] -> ShowS # |
data CssDeclaration Source #
Represent the content to apply to some CSS matched rules.
CssDeclaration | |
|
Instances
Eq CssDeclaration Source # | |
Defined in Graphics.SvgTree.CssTypes (==) :: CssDeclaration -> CssDeclaration -> Bool # (/=) :: CssDeclaration -> CssDeclaration -> Bool # | |
Show CssDeclaration Source # | |
Defined in Graphics.SvgTree.CssTypes showsPrec :: Int -> CssDeclaration -> ShowS # show :: CssDeclaration -> String # showList :: [CssDeclaration] -> ShowS # |
data CssElement Source #
Value of a CSS property.
CssIdent !Text | |
CssString !Text | |
CssReference !Text | |
CssNumber !Number | |
CssColor !PixelRGBA8 | |
CssFunction !Text ![CssElement] | |
CssOpComa | |
CssOpSlash |
Instances
Eq CssElement Source # | |
Defined in Graphics.SvgTree.CssTypes (==) :: CssElement -> CssElement -> Bool # (/=) :: CssElement -> CssElement -> Bool # | |
Show CssElement Source # | |
Defined in Graphics.SvgTree.CssTypes showsPrec :: Int -> CssElement -> ShowS # show :: CssElement -> String # showList :: [CssElement] -> ShowS # |
class CssMatcheable a where Source #
Interface for elements to be matched against some CssRule.
cssIdOf :: a -> Maybe Text Source #
For an element, tell its optional ID attribute.
cssClassOf :: a -> [Text] Source #
For an element, return all of it's class attributes.
cssNameOf :: a -> Text Source #
Return the name of the tagname of the element
cssAttribOf :: a -> Text -> Maybe Text Source #
Return a value of a given attribute if present
type CssContext a = [[a]] Source #
Represent a zipper in depth at the first list level, and the previous nodes at in the second list level.
Alias describing a "dot per inch" information used for size calculation (see toUserUnit).
Encode complex number possibly dependant to the current render size.
Num Double | Simple coordinate in current user coordinate. |
Px Double | With suffix "px" |
Em Double | Number relative to the current font size. |
Percent Double | Number relative to the current viewport size. |
Pc Double | |
Mm Double | Number in millimeters, relative to DPI. |
Cm Double | Number in centimeters, relative to DPI. |
Point Double | Number in points, relative to DPI. |
Inches Double | Number in inches, relative to DPI. |
Instances
serializeNumber :: Number -> String Source #
Encode the number to string which can be used in a CSS or a svg attributes.
findMatchingDeclarations :: CssMatcheable a => [CssRule] -> CssContext a -> [CssDeclaration] Source #
Given CSS rules, find all the declaration to apply to the element in a given context.
toUserUnit :: Dpi -> Number -> Number Source #
This function replace all device dependant units to user units given it's DPI configuration. Preserve percentage and "em" notation.
mapNumber :: (Double -> Double) -> Number -> Number Source #
Helper function to modify inner value of a number
tserialize :: TextBuildable a => a -> Builder Source #
Serialize an element to a text builder.