reanimate-svg- SVG file loader and serializer

Safe HaskellNone



Define the types used to describes CSS elements



data CssSelector Source #

Define complex selector.



Correspond to the + CSS selector.


Correspond to the > CSS selectro.

AllOf [CssDescriptor]

Grouping construct, all the elements of the list must be matched.

type CssSelectorRule = [CssSelector] Source #

A CssSelectorRule is a list of all the elements that must be meet in a depth first search fashion.

data CssRule Source #

Represent a CSS selector and the different declarations to apply to the matched elemens.




Eq CssRule Source # 
Instance details

Defined in Graphics.SvgTree.CssTypes


(==) :: CssRule -> CssRule -> Bool #

(/=) :: CssRule -> CssRule -> Bool #

Show CssRule Source # 
Instance details

Defined in Graphics.SvgTree.CssTypes

data CssDescriptor Source #

Describe an element of a CSS selector. Multiple elements can be combined in a CssSelector type.


OfClass Text


OfName Text


OfId Text


OfPseudoClass Text

`:IDENT` (ignore function syntax)



WithAttrib Text Text


data CssDeclaration Source #

Represent the content to apply to some CSS matched rules.




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.

type Dpi = Int Source #

Alias describing a "dot per inch" information used for size calculation (see toUserUnit).

data Number Source #

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.

Eq Number Source # 
Instance details

Defined in Graphics.SvgTree.CssTypes


(==) :: Number -> Number -> Bool #

(/=) :: Number -> Number -> Bool #

Show Number Source # 
Instance details

Defined in Graphics.SvgTree.CssTypes

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.