lucid-svg-0.6.0.1/0000755000000000000000000000000012641323365011744 5ustar0000000000000000lucid-svg-0.6.0.1/LICENSE0000644000000000000000000000277612641323365012765 0ustar0000000000000000Copyright (c) 2015, Jeffrey Rosenbluth All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Jeffrey Rosenbluth nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. lucid-svg-0.6.0.1/lucid-svg.cabal0000644000000000000000000000212112641323365014621 0ustar0000000000000000name: lucid-svg version: 0.6.0.1 synopsis: DSL for SVG using lucid for HTML description: Easy to write SVG in the syle of lucid. homepage: http://github.com/jeffreyrosenbluth/lucid-svg.git license: BSD3 license-file: LICENSE author: Jeffrey Rosenbluth maintainer: jeffrey.rosenbluth@gmail.com copyright: 2015 Jeffrey Rosenbluth category: Graphics build-type: Simple extra-source-files: README.md cabal-version: >=1.10 library ghc-options: -Wall -rtsopts -O2 exposed-modules: Lucid.Svg, Lucid.Svg.Path, Lucid.Svg.Elements, Lucid.Svg.Attributes build-depends: base >= 4.5 && < 4.9, blaze-builder >= 0.2 && < 0.5, transformers >= 0.2 && < 0.5, text >= 0.11 && < 1.3, lucid >= 2.9.2 && < 3.0 hs-source-dirs: src default-language: Haskell2010 lucid-svg-0.6.0.1/README.md0000644000000000000000000000127412641323365013227 0ustar0000000000000000lucid-svg [![Hackage](https://img.shields.io/hackage/v/lucid-svg.svg?style=flat)](https://hackage.haskell.org/package/lucid-svg) ========= Simple DSL for writing SVG, based on lucid ## Example ``` haskell {-# LANGUAGE OverloadedStrings #-} import Lucid.Svg svg :: Svg () -> Svg () svg content = do doctype_ with (svg11_ content) [width_ "300" , height_ "200"] contents :: Svg () contents = do rect_ [width_ "100%", height_ "100%", fill_ "red"] circle_ [cx_ "150", cy_ "100", r_ "80", fill_ "green"] text_ [x_ "150", y_ "125", font_size_ "60", text_anchor_ "middle", fill_ "white"] "SVG" main :: IO () main = do print $ svg contents ``` ![SVG](http://i.imgur.com/dXu84xR.png) lucid-svg-0.6.0.1/Setup.hs0000644000000000000000000000005612641323365013401 0ustar0000000000000000import Distribution.Simple main = defaultMain lucid-svg-0.6.0.1/src/0000755000000000000000000000000012641323365012533 5ustar0000000000000000lucid-svg-0.6.0.1/src/Lucid/0000755000000000000000000000000012641323365013573 5ustar0000000000000000lucid-svg-0.6.0.1/src/Lucid/Svg.hs0000644000000000000000000001137712641323365014677 0ustar0000000000000000{-# LANGUAGE OverloadedStrings #-} {-# OPTIONS -fno-warn-unused-imports #-} ------------------------------------------------------------------------------- -- | -- Module : Lucid.Svg -- Copyright : (c) 2015 Jeffrey Rosenbluth -- License : BSD-style (see LICENSE) -- Maintainer : jeffrey.rosenbluth@gmail.com -- -- DSL for creating SVG. -- ------------------------------------------------------------------------------- module Lucid.Svg ( -- * Intro -- $intro -- * Types Svg -- * Rendering , prettyText -- * Re-exports , module Lucid.Svg.Path , module Lucid.Svg.Elements , module Lucid.Svg.Attributes -- * From Lucid.Base , renderText , renderBS , renderTextT , renderBST , renderToFile -- ** Running -- $running , execHtmlT , evalHtmlT , runHtmlT -- ** Types , Attribute(..) -- ** Classes -- $overloaded , Term(..) , ToHtml(..) , With(..) ) where import Data.Functor.Identity import Data.Int (Int64) import Data.Monoid import Data.Text.Lazy import Data.Text.Lazy as LT import Data.Text.Lazy.Builder as B import Lucid.Base import qualified Lucid.Svg.Attributes as A import Lucid.Svg.Attributes hiding (cursor_, filter_, path_, style_) import Lucid.Svg.Elements import Lucid.Svg.Path type Svg = SvgT Identity prettyText :: Svg a -> Text prettyText svg = B.toLazyText $ LT.foldr go mempty text Nothing (-1) where text = renderText svg go c f Nothing n | c == '<' || c == '/' = f (Just c) n go c f (Just '<') n | c == '?' = " f Nothing n | c == '!' = " f Nothing n | c == '/' = "\n" <> (B.fromLazyText $ LT.replicate n " " ) <> " f Nothing (n-1) | otherwise = "\n" <> (B.fromLazyText $ LT.replicate (n+1) " " ) <> "<" <> B.singleton c <> f Nothing (n+1) go '>' f (Just _) n = "/>" <> f Nothing (n-1) go c f s n = s' <> B.singleton c <> f Nothing n where s' = maybe mempty B.singleton s -- $intro -- -- SVG elements and attributes in Lucid-Svg are written with a postfix ‘@_@’. -- Some examples: -- -- 'path_', 'circle_', 'color_', 'scale_' -- -- Note: If you're testing in the REPL you need to add a type annotation to -- indicate that you want SVG. In normal code your top-level -- declaration signatures handle that. -- -- Plain text is written using the @OverloadedStrings@ and -- @ExtendedDefaultRules@ extensions, and is automatically escaped: -- -- As in Lucid, elements nest by function application: -- -- >>> g_ (text_ "Hello SVG") :: Svg () -- Hello SVG -- -- and elements are juxtaposed via monoidal append or monadic sequencing: -- -- >>> text_ "Hello" <> text_ "SVG" :: Svg () -- HelloSVG -- -- >>> do text_ "Hello"; text_ "SVG" :: Svg () -- HelloSVG -- -- Attributes are set by providing an argument list. In contrast to HTML -- many SVG elements have no content, only attributes. -- -- >>> rect_ [width_ "100%", height_ "100%", fill_ "red"] :: Svg () -- -- -- Attributes and elements that share the same name are not conflicting -- unless they appear on the list in the note below: -- -- >>> mask_ [mask_ "attribute"] "element" :: Svg () -- element -- -- Note: The following element and attribute names overlap and cannot be -- handled polymorphically since doing so would create conflicting functional -- dependencies. The unqualifed name refers to the element. -- We qualify the attribute name as @A@. For example, 'path_' and 'A.path_'. -- -- 'colorProfile_', 'cursor_', 'filter_', 'path_', and 'style_' -- -- Path data can be constructed using the functions in 'Lucid.Svg.Path' -- and combined monoidally: -- -- @ -- path_ ( -- [ d_ (mA 10 80 <> qA 52.5 10 95 80 <> tA 180 80 <> z) -- , stroke_ "blue" -- , fill_ "orange" -- ]) -- @ -- > -- -- __A slightly longer example__: -- -- > import Lucid.Svg -- > -- > svg :: Svg () -> Svg () -- > svg content = do -- > doctype_ -- > with (svg11_ content) [version_ "1.1", width_ "300" , height_ "200"] -- > -- > contents :: Svg () -- > contents = do -- > rect_ [width_ "100%", height_ "100%", fill_ "red"] -- > circle_ [cx_ "150", cy_ "100", r_ "80", fill_ "green"] -- > text_ [x_ "150", y_ "125", fontSize_ "60", textAnchor_ "middle", fill_ "white"] "SVG" -- > -- > -- > main :: IO () -- > main = do -- > print $ svg contents -- <> lucid-svg-0.6.0.1/src/Lucid/Svg/0000755000000000000000000000000012641323365014332 5ustar0000000000000000lucid-svg-0.6.0.1/src/Lucid/Svg/Attributes.hs0000644000000000000000000006725512641323365017033 0ustar0000000000000000{-# LANGUAGE OverloadedStrings #-} ------------------------------------------------------------------------------- -- | -- Module : Lucid.Svg.Attributes -- Copyright : (c) 2015 Jeffrey Rosenbluth -- License : BSD-style (see LICENSE) -- Maintainer : jeffrey.rosenbluth@gmail.com -- -- SVG Attributes. -- ------------------------------------------------------------------------------- module Lucid.Svg.Attributes where import Lucid.Base import Data.Text (Text) -- | The @accentHeight@ attribute. accent_height_ :: Text -> Attribute accent_height_ = makeAttribute "accent-height" -- | The @accumulate@ attribute. accumulate_ :: Text -> Attribute accumulate_ = makeAttribute "accumulate" -- | The @additive@ attribute. additive_ :: Text -> Attribute additive_ = makeAttribute "additive" -- | The @alignmentBaseline@ attribute. alignment_baseline_ :: Text -> Attribute alignment_baseline_ = makeAttribute "alignment-baseline" -- | The @alphabetic@ attribute. alphabetic_ :: Text -> Attribute alphabetic_ = makeAttribute "alphabetic" -- | The @amplitude@ attribute. amplitude_ :: Text -> Attribute amplitude_ = makeAttribute "amplitude" -- | The @arabicForm@ attribute. arabic_form_ :: Text -> Attribute arabic_form_ = makeAttribute "arabic-form" -- | The @ascent@ attribute. ascent_ :: Text -> Attribute ascent_ = makeAttribute "ascent" -- | The @attributename@ attribute. attributeName_ :: Text -> Attribute attributeName_ = makeAttribute "attributeName" -- | The @attributetype@ attribute. attributeType_ :: Text -> Attribute attributeType_ = makeAttribute "attributeType" -- | The @azimuth@ attribute. azimuth_ :: Text -> Attribute azimuth_ = makeAttribute "azimuth" -- | The @basefrequency@ attribute. baseFrequency_ :: Text -> Attribute baseFrequency_ = makeAttribute "baseFrequency" -- | The @baseprofile@ attribute. baseprofile_ :: Text -> Attribute baseprofile_ = makeAttribute "baseprofile" -- | The @baselineShift@ attribute. baseline_shift_ :: Text -> Attribute baseline_shift_ = makeAttribute "baseline-shift" -- | The @bbox@ attribute. bbox_ :: Text -> Attribute bbox_ = makeAttribute "bbox" -- | The @begin@ attribute. begin_ :: Text -> Attribute begin_ = makeAttribute "begin" -- | The @bias@ attribute. bias_ :: Text -> Attribute bias_ = makeAttribute "bias" -- | The @by@ attribute. by_ :: Text -> Attribute by_ = makeAttribute "by" -- | The @calcmode@ attribute. calcMode_ :: Text -> Attribute calcMode_ = makeAttribute "calcMode" -- | The @capHeight@ attribute. cap_height_ :: Text -> Attribute cap_height_ = makeAttribute "cap-height" -- | The @class@ attribute. class_ :: Text -> Attribute class_ = makeAttribute "class" -- | The @clip@ attribute. clip_ :: Text -> Attribute clip_ = makeAttribute "clip" -- | The @clip-path@ attribute. clip_path_ :: Text -> Attribute clip_path_ = makeAttribute "clip-path" -- | The @clipRule@ attribute. clip_rule_ :: Text -> Attribute clip_rule_ = makeAttribute "clip-rule" -- | The @clippathunits@ attribute. clipPathUnits_ :: Text -> Attribute clipPathUnits_ = makeAttribute "clipPathUnits" -- | The @color@ attribute. color_ :: Text -> Attribute color_ = makeAttribute "color" -- | The @colorInterpolation@ attribute. color_interpolation_ :: Text -> Attribute color_interpolation_ = makeAttribute "color-interpolation" -- | The @colorInterpolationFilters@ attribute. color_interpolation_filters_ :: Text -> Attribute color_interpolation_filters_ = makeAttribute "color-interpolation-filters" -- | The @colorProfile@ attribute. color_profile_ :: Text -> Attribute color_profile_ = makeAttribute "color-profile" -- | The @colorRendering@ attribute. color_rendering_ :: Text -> Attribute color_rendering_ = makeAttribute "color-rendering" -- | The @contentscripttype@ attribute. contentScriptType_ :: Text -> Attribute contentScriptType_ = makeAttribute "contentScriptType" -- | The @contentstyletype@ attribute. contentStyleType_ :: Text -> Attribute contentStyleType_ = makeAttribute "contentStyleType" -- | The @cursor@ attribute. cursor_ :: Text -> Attribute cursor_ = makeAttribute "cursor" -- | The @cx@ attribute. cx_ :: Text -> Attribute cx_ = makeAttribute "cx" -- | The @cy@ attribute. cy_ :: Text -> Attribute cy_ = makeAttribute "cy" -- | The @d@ attribute. d_ :: Text -> Attribute d_ = makeAttribute "d" -- | The @descent@ attribute. descent_ :: Text -> Attribute descent_ = makeAttribute "descent" -- | The @diffuseconstant@ attribute. diffuseConstant_ :: Text -> Attribute diffuseConstant_ = makeAttribute "diffuseConstant" -- | The @direction@ attribute. direction_ :: Text -> Attribute direction_ = makeAttribute "direction" -- | The @display@ attribute. display_ :: Text -> Attribute display_ = makeAttribute "display" -- | The @divisor@ attribute. divisor_ :: Text -> Attribute divisor_ = makeAttribute "divisor" -- | The @dominantBaseline@ attribute. dominant_baseline_ :: Text -> Attribute dominant_baseline_ = makeAttribute "dominant-baseline" -- | The @dur@ attribute. dur_ :: Text -> Attribute dur_ = makeAttribute "dur" -- | The @dx@ attribute. dx_ :: Text -> Attribute dx_ = makeAttribute "dx" -- | The @dy@ attribute. dy_ :: Text -> Attribute dy_ = makeAttribute "dy" -- | The @edgemode@ attribute. edgeMode_ :: Text -> Attribute edgeMode_ = makeAttribute "edgeMode" -- | The @elevation@ attribute. elevation_ :: Text -> Attribute elevation_ = makeAttribute "elevation" -- | The @enableBackground@ attribute. enable_background_ :: Text -> Attribute enable_background_ = makeAttribute "enable-background" -- | The @end@ attribute. end_ :: Text -> Attribute end_ = makeAttribute "end" -- | The @exponent@ attribute. exponent_ :: Text -> Attribute exponent_ = makeAttribute "exponent" -- | The @externalresourcesrequired@ attribute. externalResourcesRequired_ :: Text -> Attribute externalResourcesRequired_ = makeAttribute "externalResourcesRequired" -- | The @fill@ attribute. fill_ :: Text -> Attribute fill_ = makeAttribute "fill" -- | The @fillOpacity@ attribute. fill_opacity_ :: Text -> Attribute fill_opacity_ = makeAttribute "fill-opacity" -- | The @fillRule@ attribute. fill_rule_ :: Text -> Attribute fill_rule_ = makeAttribute "fill-rule" -- | The @filter@ attribute. filter_ :: Text -> Attribute filter_ = makeAttribute "filter" -- | The @filterres@ attribute. filterRes_ :: Text -> Attribute filterRes_ = makeAttribute "filterRes" -- | The @filterunits@ attribute. filterUnits_ :: Text -> Attribute filterUnits_ = makeAttribute "filterUnits" -- | The @floodColor@ attribute. flood_color_ :: Text -> Attribute flood_color_ = makeAttribute "flood-color" -- | The @floodOpacity@ attribute. flood_opacity_ :: Text -> Attribute flood_opacity_ = makeAttribute "flood-opacity" -- | The @fontFamily@ attribute. font_family_ :: Text -> Attribute font_family_ = makeAttribute "font-family" -- | The @fontSize@ attribute. font_size_ :: Text -> Attribute font_size_ = makeAttribute "font-size" -- | The @fontSizeAdjust@ attribute. font_size_adjust_ :: Text -> Attribute font_size_adjust_ = makeAttribute "font-size-adjust" -- | The @fontStretch@ attribute. font_stretch_ :: Text -> Attribute font_stretch_ = makeAttribute "font-stretch" -- | The @fontStyle@ attribute. font_style_ :: Text -> Attribute font_style_ = makeAttribute "font-style" -- | The @fontVariant@ attribute. font_variant_ :: Text -> Attribute font_variant_ = makeAttribute "font-variant" -- | The @fontWeight@ attribute. font_weight_ :: Text -> Attribute font_weight_ = makeAttribute "font-weight" -- | The @format@ attribute. format_ :: Text -> Attribute format_ = makeAttribute "format" -- | The @from@ attribute. from_ :: Text -> Attribute from_ = makeAttribute "from" -- | The @fx@ attribute. fx_ :: Text -> Attribute fx_ = makeAttribute "fx" -- | The @fy@ attribute. fy_ :: Text -> Attribute fy_ = makeAttribute "fy" -- | The @g1@ attribute. g1_ :: Text -> Attribute g1_ = makeAttribute "g1" -- | The @g2@ attribute. g2_ :: Text -> Attribute g2_ = makeAttribute "g2" -- | The @glyphName@ attribute. glyph_name_ :: Text -> Attribute glyph_name_ = makeAttribute "glyph-name" -- | The @glyphOrientationHorizontal@ attribute. glyph_orientation_horizontal_ :: Text -> Attribute glyph_orientation_horizontal_ = makeAttribute "glyph-orientation-horizontal" -- | The @glyphOrientationVertical@ attribute. glyph_orientation_vertical_ :: Text -> Attribute glyph_orientation_vertical_ = makeAttribute "glyph-orientation-vertical" -- | The @-- | The @gradienttransform@ attribute. gradientTransform_ :: Text -> Attribute gradientTransform_ = makeAttribute "gradientTransform" -- | The @gradientunits@ attribute. gradientUnits_ :: Text -> Attribute gradientUnits_ = makeAttribute "gradientUnits" -- | The @hanging@ attribute. hanging_ :: Text -> Attribute hanging_ = makeAttribute "hanging" -- | The @height@ attribute. height_ :: Text -> Attribute height_ = makeAttribute "height" -- | The @horizAdvX@ attribute. horiz_adv_x_ :: Text -> Attribute horiz_adv_x_ = makeAttribute "horiz-adv-x" -- | The @horizOriginX@ attribute. horiz_origin_x_ :: Text -> Attribute horiz_origin_x_ = makeAttribute "horiz-origin-x" -- | The @horizOriginY@ attribute. horiz_origin_y_ :: Text -> Attribute horiz_origin_y_ = makeAttribute "horiz-origin-y" -- | The @id@ attribute. id_ :: Text -> Attribute id_ = makeAttribute "id" -- | The @ideographic@ attribute. ideographic_ :: Text -> Attribute ideographic_ = makeAttribute "ideographic" -- | The @imageRendering@ attribute. image_rendering_ :: Text -> Attribute image_rendering_ = makeAttribute "image-rendering" -- | The @in@ attribute. in_ :: Text -> Attribute in_ = makeAttribute "in" -- | The @in2@ attribute. in2_ :: Text -> Attribute in2_ = makeAttribute "in2" -- | The @intercept@ attribute. intercept_ :: Text -> Attribute intercept_ = makeAttribute "intercept" -- | The @k@ attribute. k_ :: Text -> Attribute k_ = makeAttribute "k" -- | The @k1@ attribute. k1_ :: Text -> Attribute k1_ = makeAttribute "k1" -- | The @k2@ attribute. k2_ :: Text -> Attribute k2_ = makeAttribute "k2" -- | The @k3@ attribute. k3_ :: Text -> Attribute k3_ = makeAttribute "k3" -- | The @k4@ attribute. k4_ :: Text -> Attribute k4_ = makeAttribute "k4" -- | The @kernelmatrix@ attribute. kernelMatrix_ :: Text -> Attribute kernelMatrix_ = makeAttribute "kernelMatrix" -- | The @kernelunitlength@ attribute. kernelUnitLength_ :: Text -> Attribute kernelUnitLength_ = makeAttribute "kernelUnitLength" -- | The @kerning@ attribute. kerning_ :: Text -> Attribute kerning_ = makeAttribute "kerning" -- | The @keypoints@ attribute. keyPoints_ :: Text -> Attribute keyPoints_ = makeAttribute "keyPoints" -- | The @keysplines@ attribute. keySplines_ :: Text -> Attribute keySplines_ = makeAttribute "keySplines" -- | The @keytimes@ attribute. keyTimes_ :: Text -> Attribute keyTimes_ = makeAttribute "keyTimes" -- | The @lang@ attribute. lang_ :: Text -> Attribute lang_ = makeAttribute "lang" -- | The @lengthadjust@ attribute. lengthAdjust_ :: Text -> Attribute lengthAdjust_ = makeAttribute "lengthAdjust" -- | The @letterSpacing@ attribute. letter_spacing_ :: Text -> Attribute letter_spacing_ = makeAttribute "letter-spacing" -- | The @lightingColor@ attribute. lighting_color_ :: Text -> Attribute lighting_color_ = makeAttribute "lighting-color" -- | The @limitingconeangle@ attribute. limitingConeAngle_ :: Text -> Attribute limitingConeAngle_ = makeAttribute "limitingConeAngle" -- | The @local@ attribute. local_ :: Text -> Attribute local_ = makeAttribute "local" -- | The @markerEnd@ attribute. marker_end_ :: Text -> Attribute marker_end_ = makeAttribute "marker-end" -- | The @markerMid@ attribute. marker_mid_ :: Text -> Attribute marker_mid_ = makeAttribute "marker-mid" -- | The @markerStart@ attribute. marker_start_ :: Text -> Attribute marker_start_ = makeAttribute "marker-start" -- | The @markerheight@ attribute. markerHeight_ :: Text -> Attribute markerHeight_ = makeAttribute "markerHeight" -- | The @markerunits@ attribute. markerUnits_ :: Text -> Attribute markerUnits_ = makeAttribute "markerUnits" -- | The @markerwidth@ attribute. markerWidth_ :: Text -> Attribute markerWidth_ = makeAttribute "markerWidth" -- | The @maskcontentunits@ attribute. maskContentUnits_ :: Text -> Attribute maskContentUnits_ = makeAttribute "maskContentUnits" -- | The @maskunits@ attribute. maskUnits_ :: Text -> Attribute maskUnits_ = makeAttribute "maskUnits" -- | The @mathematical@ attribute. mathematical_ :: Text -> Attribute mathematical_ = makeAttribute "mathematical" -- | The @max@ attribute. max_ :: Text -> Attribute max_ = makeAttribute "max" -- | The @media@ attribute. media_ :: Text -> Attribute media_ = makeAttribute "media" -- | The @method@ attribute. method_ :: Text -> Attribute method_ = makeAttribute "method" -- | The @min@ attribute. min_ :: Text -> Attribute min_ = makeAttribute "min" -- | The @mode@ attribute. mode_ :: Text -> Attribute mode_ = makeAttribute "mode" -- | The @name@ attribute. name_ :: Text -> Attribute name_ = makeAttribute "name" -- | The @numoctaves@ attribute. numOctaves_ :: Text -> Attribute numOctaves_ = makeAttribute "numOctaves" -- | The @offset@ attribute. offset_ :: Text -> Attribute offset_ = makeAttribute "offset" -- | The @onabort@ attribute. onabort_ :: Text -> Attribute onabort_ = makeAttribute "onabort" -- | The @onactivate@ attribute. onactivate_ :: Text -> Attribute onactivate_ = makeAttribute "onactivate" -- | The @onbegin@ attribute. onbegin_ :: Text -> Attribute onbegin_ = makeAttribute "onbegin" -- | The @onclick@ attribute. onclick_ :: Text -> Attribute onclick_ = makeAttribute "onclick" -- | The @onend@ attribute. onend_ :: Text -> Attribute onend_ = makeAttribute "onend" -- | The @onerror@ attribute. onerror_ :: Text -> Attribute onerror_ = makeAttribute "onerror" -- | The @onfocusin@ attribute. onfocusin_ :: Text -> Attribute onfocusin_ = makeAttribute "onfocusin" -- | The @onfocusout@ attribute. onfocusout_ :: Text -> Attribute onfocusout_ = makeAttribute "onfocusout" -- | The @onload@ attribute. onload_ :: Text -> Attribute onload_ = makeAttribute "onload" -- | The @onmousedown@ attribute. onmousedown_ :: Text -> Attribute onmousedown_ = makeAttribute "onmousedown" -- | The @onmousemove@ attribute. onmousemove_ :: Text -> Attribute onmousemove_ = makeAttribute "onmousemove" -- | The @onmouseout@ attribute. onmouseout_ :: Text -> Attribute onmouseout_ = makeAttribute "onmouseout" -- | The @onmouseover@ attribute. onmouseover_ :: Text -> Attribute onmouseover_ = makeAttribute "onmouseover" -- | The @onmouseup@ attribute. onmouseup_ :: Text -> Attribute onmouseup_ = makeAttribute "onmouseup" -- | The @onrepeat@ attribute. onrepeat_ :: Text -> Attribute onrepeat_ = makeAttribute "onrepeat" -- | The @onresize@ attribute. onresize_ :: Text -> Attribute onresize_ = makeAttribute "onresize" -- | The @onscroll@ attribute. onscroll_ :: Text -> Attribute onscroll_ = makeAttribute "onscroll" -- | The @onunload@ attribute. onunload_ :: Text -> Attribute onunload_ = makeAttribute "onunload" -- | The @onzoom@ attribute. onzoom_ :: Text -> Attribute onzoom_ = makeAttribute "onzoom" -- | The @opacity@ attribute. opacity_ :: Text -> Attribute opacity_ = makeAttribute "opacity" -- | The @operator@ attribute. operator_ :: Text -> Attribute operator_ = makeAttribute "operator" -- | The @order@ attribute. order_ :: Text -> Attribute order_ = makeAttribute "order" -- | The @orient@ attribute. orient_ :: Text -> Attribute orient_ = makeAttribute "orient" -- | The @orientation@ attribute. orientation_ :: Text -> Attribute orientation_ = makeAttribute "orientation" -- | The @origin@ attribute. origin_ :: Text -> Attribute origin_ = makeAttribute "origin" -- | The @overflow@ attribute. overflow_ :: Text -> Attribute overflow_ = makeAttribute "overflow" -- | The @overlinePosition@ attribute. overline_position_ :: Text -> Attribute overline_position_ = makeAttribute "overline-position" -- | The @overlineThickness@ attribute. overline_thickness_ :: Text -> Attribute overline_thickness_ = makeAttribute "overline-thickness" -- | The @panose1@ attribute. panose_1_ :: Text -> Attribute panose_1_ = makeAttribute "panose-1" -- | The @paint-order@ attribute. paint_order_ :: Text -> Attribute paint_order_ = makeAttribute "paint-order" -- | The @path@ attribute. path_ :: Text -> Attribute path_ = makeAttribute "path" -- | The @pathlength@ attribute. pathLength_ :: Text -> Attribute pathLength_ = makeAttribute "pathLength" -- | The @patterncontentunits@ attribute. patternContentUnits_ :: Text -> Attribute patternContentUnits_ = makeAttribute "patternContentUnits" -- | The @patterntransform@ attribute. patternTransform_ :: Text -> Attribute patternTransform_ = makeAttribute "patternTransform" -- | The @patternunits@ attribute. patternUnits_ :: Text -> Attribute patternUnits_ = makeAttribute "patternUnits" -- | The @pointerEvents@ attribute. pointer_events_ :: Text -> Attribute pointer_events_ = makeAttribute "pointer-events" -- | The @points@ attribute. points_ :: Text -> Attribute points_ = makeAttribute "points" -- | The @pointsatx@ attribute. pointsAtX_ :: Text -> Attribute pointsAtX_ = makeAttribute "pointsAtX" -- | The @pointsaty@ attribute. pointsAtY_ :: Text -> Attribute pointsAtY_ = makeAttribute "pointsAtY" -- | The @pointsatz@ attribute. pointsAtZ_ :: Text -> Attribute pointsAtZ_ = makeAttribute "pointsAtZ" -- | The @preservealpha@ attribute. preserveAlpha_ :: Text -> Attribute preserveAlpha_ = makeAttribute "preserveAlpha" -- | The @preserveaspectratio@ attribute. preserveAspectRatio_ :: Text -> Attribute preserveAspectRatio_ = makeAttribute "preserveAspectRatio" -- | The @primitiveunits@ attribute. primitiveUnits_ :: Text -> Attribute primitiveUnits_ = makeAttribute "primitiveUnits" -- | The @r@ attribute. r_ :: Text -> Attribute r_ = makeAttribute "r" -- | The @radius@ attribute. radius_ :: Text -> Attribute radius_ = makeAttribute "radius" -- | The @refx@ attribute. refX_ :: Text -> Attribute refX_ = makeAttribute "refX" -- | The @refy@ attribute. refY_ :: Text -> Attribute refY_ = makeAttribute "refY" -- | The @renderingIntent@ attribute. rendering_intent_ :: Text -> Attribute rendering_intent_ = makeAttribute "rendering-intent" -- | The @repeatcount@ attribute. repeatCount_ :: Text -> Attribute repeatCount_ = makeAttribute "repeatCount" -- | The @repeatdur@ attribute. repeatDur_ :: Text -> Attribute repeatDur_ = makeAttribute "repeatDur" -- | The @requiredextensions@ attribute. requiredExtensions_ :: Text -> Attribute requiredExtensions_ = makeAttribute "requiredExtensions" -- | The @requiredfeatures@ attribute. requiredFeatures_ :: Text -> Attribute requiredFeatures_ = makeAttribute "requiredFeatures" -- | The @restart@ attribute. restart_ :: Text -> Attribute restart_ = makeAttribute "restart" -- | The @result@ attribute. result_ :: Text -> Attribute result_ = makeAttribute "result" -- | The @rotate@ attribute. rotate_ :: Text -> Attribute rotate_ = makeAttribute "rotate" -- | The @rx@ attribute. rx_ :: Text -> Attribute rx_ = makeAttribute "rx" -- | The @ry@ attribute. ry_ :: Text -> Attribute ry_ = makeAttribute "ry" -- | The @scale@ attribute. scale_ :: Text -> Attribute scale_ = makeAttribute "scale" -- | The @seed@ attribute. seed_ :: Text -> Attribute seed_ = makeAttribute "seed" -- | The @shapeRendering@ attribute. shape_rendering_ :: Text -> Attribute shape_rendering_ = makeAttribute "shape-rendering" -- | The @slope@ attribute. slope_ :: Text -> Attribute slope_ = makeAttribute "slope" -- | The @spacing@ attribute. spacing_ :: Text -> Attribute spacing_ = makeAttribute "spacing" -- | The @specularconstant@ attribute. specularConstant_ :: Text -> Attribute specularConstant_ = makeAttribute "specularConstant" -- | The @specularexponent@ attribute. specularExponent_ :: Text -> Attribute specularExponent_ = makeAttribute "specularExponent" -- | The @spreadmethod@ attribute. spreadMethod_ :: Text -> Attribute spreadMethod_ = makeAttribute "spreadMethod" -- | The @startoffset@ attribute. startOffset_ :: Text -> Attribute startOffset_ = makeAttribute "startOffset" -- | The @stddeviation@ attribute. stdDeviation_ :: Text -> Attribute stdDeviation_ = makeAttribute "stdDeviation" -- | The @stemh@ attribute. stemh_ :: Text -> Attribute stemh_ = makeAttribute "stemh" -- | The @stemv@ attribute. stemv_ :: Text -> Attribute stemv_ = makeAttribute "stemv" -- | The @stitchtiles@ attribute. stitchTiles_ :: Text -> Attribute stitchTiles_ = makeAttribute "stitchTiles" -- | The @stopColor@ attribute. stop_color_ :: Text -> Attribute stop_color_ = makeAttribute "stop-color" -- | The @stopOpacity@ attribute. stop_opacity_ :: Text -> Attribute stop_opacity_ = makeAttribute "stop-opacity" -- | The @strikethroughPosition@ attribute. strikethrough_position_ :: Text -> Attribute strikethrough_position_ = makeAttribute "strikethrough-position" -- | The @strikethroughThickness@ attribute. strikethrough_thickness_ :: Text -> Attribute strikethrough_thickness_ = makeAttribute "strikethrough-thickness" -- | The @string@ attribute. string_ :: Text -> Attribute string_ = makeAttribute "string" -- | The @stroke@ attribute. stroke_ :: Text -> Attribute stroke_ = makeAttribute "stroke" -- | The @strokeDasharray@ attribute. stroke_dasharray_ :: Text -> Attribute stroke_dasharray_ = makeAttribute "stroke-dasharray" -- | The @strokeDashoffset@ attribute. stroke_dashoffset_ :: Text -> Attribute stroke_dashoffset_ = makeAttribute "stroke-dashoffset" -- | The @strokeLinecap@ attribute. stroke_linecap_ :: Text -> Attribute stroke_linecap_ = makeAttribute "stroke-linecap" -- | The @strokeLinejoin@ attribute. stroke_linejoin_ :: Text -> Attribute stroke_linejoin_ = makeAttribute "stroke-linejoin" -- | The @strokeMiterlimit@ attribute. stroke_miterlimit_ :: Text -> Attribute stroke_miterlimit_ = makeAttribute "stroke-miterlimit" -- | The @strokeOpacity@ attribute. stroke_opacity_ :: Text -> Attribute stroke_opacity_ = makeAttribute "stroke-opacity" -- | The @strokeWidth@ attribute. stroke_width_ :: Text -> Attribute stroke_width_ = makeAttribute "stroke-width" -- | The @style@ attribute. style_ :: Text -> Attribute style_ = makeAttribute "style" -- | The @surfacescale@ attribute. surfaceScale_ :: Text -> Attribute surfaceScale_ = makeAttribute "surfaceScale" -- | The @systemlanguage@ attribute. systemLanguage_ :: Text -> Attribute systemLanguage_ = makeAttribute "systemLanguage" -- | The @tablevalues@ attribute. tableValues_ :: Text -> Attribute tableValues_ = makeAttribute "tableValues" -- | The @target@ attribute. target_ :: Text -> Attribute target_ = makeAttribute "target" -- | The @targetx@ attribute. targetX_ :: Text -> Attribute targetX_ = makeAttribute "targetX" -- | The @targety@ attribute. targetY_ :: Text -> Attribute targetY_ = makeAttribute "targetY" -- | The @textAnchor@ attribute. text_anchor_ :: Text -> Attribute text_anchor_ = makeAttribute "text-anchor" -- | The @textDecoration@ attribute. text_decoration_ :: Text -> Attribute text_decoration_ = makeAttribute "text-decoration" -- | The @textRendering@ attribute. text_rendering_ :: Text -> Attribute text_rendering_ = makeAttribute "text-rendering" -- | The @textlength@ attribute. textLength_ :: Text -> Attribute textLength_ = makeAttribute "textLength" -- | The @to@ attribute. to_ :: Text -> Attribute to_ = makeAttribute "to" -- | The @transform@ attribute. transform_ :: Text -> Attribute transform_ = makeAttribute "transform" -- | The @type@ attribute. type_ :: Text -> Attribute type_ = makeAttribute "type" -- | The @u1@ attribute. u1_ :: Text -> Attribute u1_ = makeAttribute "u1" -- | The @u2@ attribute. u2_ :: Text -> Attribute u2_ = makeAttribute "u2" -- | The @underlinePosition@ attribute. underline_position_ :: Text -> Attribute underline_position_ = makeAttribute "underline-position" -- | The @underlineThickness@ attribute. underline_thickness_ :: Text -> Attribute underline_thickness_ = makeAttribute "underline-thickness" -- | The @unicode@ attribute. unicode_ :: Text -> Attribute unicode_ = makeAttribute "unicode" -- | The @unicodeBidi@ attribute. unicode_bidi_ :: Text -> Attribute unicode_bidi_ = makeAttribute "unicode-bidi" -- | The @unicodeRange@ attribute. unicode_range_ :: Text -> Attribute unicode_range_ = makeAttribute "unicode-range" -- | The @unitsPerEm@ attribute. units_per_em_ :: Text -> Attribute units_per_em_ = makeAttribute "units-per-em" -- | The @vAlphabetic@ attribute. v_alphabetic_ :: Text -> Attribute v_alphabetic_ = makeAttribute "v-alphabetic" -- | The @vHanging@ attribute. v_hanging_ :: Text -> Attribute v_hanging_ = makeAttribute "v-hanging" -- | The @vIdeographic@ attribute. v_ideographic_ :: Text -> Attribute v_ideographic_ = makeAttribute "v-ideographic" -- | The @vMathematical@ attribute. v_mathematical_ :: Text -> Attribute v_mathematical_ = makeAttribute "v-mathematical" -- | The @values@ attribute. values_ :: Text -> Attribute values_ = makeAttribute "values" -- | The @version@ attribute. version_ :: Text -> Attribute version_ = makeAttribute "version" -- | The @vertAdvY@ attribute. vert_adv_y_ :: Text -> Attribute vert_adv_y_ = makeAttribute "vert-adv-y" -- | The @vertOriginX@ attribute. vert_origin_x_ :: Text -> Attribute vert_origin_x_ = makeAttribute "vert-origin-x" -- | The @vertOriginY@ attribute. vert_origin_y_ :: Text -> Attribute vert_origin_y_ = makeAttribute "vert-origin-y" -- | The @viewbox@ attribute. viewBox_ :: Text -> Attribute viewBox_ = makeAttribute "viewBox" -- | The @viewtarget@ attribute. viewTarget_ :: Text -> Attribute viewTarget_ = makeAttribute "viewTarget" -- | The @visibility@ attribute. visibility_ :: Text -> Attribute visibility_ = makeAttribute "visibility" -- | The @width@ attribute. width_ :: Text -> Attribute width_ = makeAttribute "width" -- | The @widths@ attribute. widths_ :: Text -> Attribute widths_ = makeAttribute "widths" -- | The @wordSpacing@ attribute. word_spacing_ :: Text -> Attribute word_spacing_ = makeAttribute "word-spacing" -- | The @writingMode@ attribute. writing_mode_ :: Text -> Attribute writing_mode_ = makeAttribute "writing-mode" -- | The @x@ attribute. x_ :: Text -> Attribute x_ = makeAttribute "x" -- | The @xHeight@ attribute. x_height_ :: Text -> Attribute x_height_ = makeAttribute "x-height" -- | The @x1@ attribute. x1_ :: Text -> Attribute x1_ = makeAttribute "x1" -- | The @x2@ attribute. x2_ :: Text -> Attribute x2_ = makeAttribute "x2" -- | The @xchannelselector@ attribute. xChannelSelector_ :: Text -> Attribute xChannelSelector_ = makeAttribute "xChannelSelector" -- | The @xlinkActuate@ attribute. xlinkActuate_ :: Text -> Attribute xlinkActuate_ = makeAttribute "xlink:actuate" -- | The @xlinkArcrole@ attribute. xlinkArcrole_ :: Text -> Attribute xlinkArcrole_ = makeAttribute "xlink:arcrole" -- | The @xlinkHref@ attribute. xlinkHref_ :: Text -> Attribute xlinkHref_ = makeAttribute "xlink:href" -- | The @xlinkRole@ attribute. xlinkRole_ :: Text -> Attribute xlinkRole_ = makeAttribute "xlink:role" -- | The @xlinkShow@ attribute. xlinkShow_ :: Text -> Attribute xlinkShow_ = makeAttribute "xlink:show" -- | The @xlinkTitle@ attribute. xlinkTitle_ :: Text -> Attribute xlinkTitle_ = makeAttribute "xlink:title" -- | The @xlinkType@ attribute. xlinkType_ :: Text -> Attribute xlinkType_ = makeAttribute "xlink:type" -- | The @xmlBase@ attribute. xmlBase_ :: Text -> Attribute xmlBase_ = makeAttribute "xml:base" -- | The @xmlLang@ attribute. xmlLang_ :: Text -> Attribute xmlLang_ = makeAttribute "xml:lang" -- | The @xmlSpace@ attribute. xmlSpace_ :: Text -> Attribute xmlSpace_ = makeAttribute "xml:space" -- | The @y@ attribute. y_ :: Text -> Attribute y_ = makeAttribute "y" -- | The @y1@ attribute. y1_ :: Text -> Attribute y1_ = makeAttribute "y1" -- | The @y2@ attribute. y2_ :: Text -> Attribute y2_ = makeAttribute "y2" -- | The @ychannelselector@ attribute. yChannelselector_ :: Text -> Attribute yChannelselector_ = makeAttribute "yChannelSelector" -- | The @z@ attribute. z_ :: Text -> Attribute z_ = makeAttribute "z" -- | The @zoomandpan@ attribute. zoomAndPan_ :: Text -> Attribute zoomAndPan_ = makeAttribute "zoomAndPan" lucid-svg-0.6.0.1/src/Lucid/Svg/Elements.hs0000644000000000000000000002501212641323365016442 0ustar0000000000000000{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE FlexibleContexts #-} ------------------------------------------------------------------------------- -- | -- Module : Lucid.Svg.Elements -- Copyright : (c) 2015 Jeffrey Rosenbluth -- License : BSD-style (see LICENSE) -- Maintainer : jeffrey.rosenbluth@gmail.com -- -- SVG elements. -- ------------------------------------------------------------------------------- module Lucid.Svg.Elements where import Lucid.Base -- | A type alias for the 'SvgT m a' monad transformer. type SvgT = HtmlT -- | @DOCTYPE@ element doctype_ :: Monad m => SvgT m () doctype_ = makeElementNoEnd "?xml version=\"1.0\" encoding=\"UTF-8\"?>\n t) => s -> t svg11_ m = svg_ [ makeAttribute "xmlns" "http://www.w3.org/2000/svg" , makeAttribute "xmlns:xlink" "http://www.w3.org/1999/xlink" , makeAttribute "version" "1.1" ] m -- | @a@ element a_ :: Term arg result => arg -> result a_ = term "a" -- | @altglyph@ element altGlyph_ :: Monad m => [Attribute] -> SvgT m () altGlyph_ = with $ makeXmlElementNoEnd "altGlyph" -- | @altglyphdef@ element altGlyphDef_ :: Monad m => [Attribute] -> SvgT m () altGlyphDef_ = with $ makeXmlElementNoEnd "altGlyphDef" -- | @altglyphitem@ element altGlyphItem_ :: Monad m => [Attribute] -> SvgT m () altGlyphItem_ = with $ makeXmlElementNoEnd "altGlyphItem" -- | @animate@ element animate_ :: Monad m => [Attribute] -> SvgT m () animate_ = with $ makeXmlElementNoEnd "animate" -- | @animatecolor@ element animateColor_ :: Monad m => [Attribute] -> SvgT m () animateColor_ = with $ makeXmlElementNoEnd "animateColor" -- | @animatemotion@ element animateMotion_ :: Monad m => [Attribute] -> SvgT m () animateMotion_ = with $ makeXmlElementNoEnd "animateMotion" -- | @animatetransform@ element animateTransform_ :: Monad m => [Attribute] -> SvgT m () animateTransform_ = with $ makeXmlElementNoEnd "animateTransform" -- | @circle@ element circle_ :: Monad m => [Attribute] -> SvgT m () circle_ = with $ makeXmlElementNoEnd "circle" -- | @clipPath@ element or attribute clipPath_ :: Term arg result => arg -> result clipPath_ = term "clipPath" -- | @colorProfile@ element colorProfile_ :: Monad m => [Attribute] -> SvgT m () colorProfile_ = with $ makeXmlElementNoEnd "color-profile" -- | @cursor@ element cursor_ :: Monad m => [Attribute] -> SvgT m () cursor_ = with $ makeXmlElementNoEnd "cursor" -- | @defs@ element defs_ :: Term arg result => arg -> result defs_ = term "defs" -- | @desc@ element desc_ :: Monad m => [Attribute] -> SvgT m () desc_ = with $ makeXmlElementNoEnd "desc" -- | @ellipse@ element ellipse_ :: Monad m => [Attribute] -> SvgT m () ellipse_ = with $ makeXmlElementNoEnd "ellipse" -- | @feblend@ element feBlend_ :: Monad m => [Attribute] -> SvgT m () feBlend_ = with $ makeXmlElementNoEnd "feBlend" -- | @fecolormatrix@ element feColorMatrix_ :: Monad m => [Attribute] -> SvgT m () feColorMatrix_ = with $ makeXmlElementNoEnd "feColorMatrix" -- | @fecomponenttransfer@ element feComponentTransfer_ :: Monad m => [Attribute] -> SvgT m () feComponentTransfer_ = with $ makeXmlElementNoEnd "feComponentTransfer" -- | @fecomposite@ element feComposite_ :: Monad m => [Attribute] -> SvgT m () feComposite_ = with $ makeXmlElementNoEnd "feComposite" -- | @feconvolvematrix@ element feConvolveMatrix_ :: Monad m => [Attribute] -> SvgT m () feConvolveMatrix_ = with $ makeXmlElementNoEnd "feConvolveMatrix" -- | @fediffuselighting@ element feDiffuseLighting_ :: Monad m => [Attribute] -> SvgT m () feDiffuseLighting_ = with $ makeXmlElementNoEnd "feDiffuseLighting" -- | @fedisplacementmap@ element feDisplacementMap_ :: Monad m => [Attribute] -> SvgT m () feDisplacementMap_ = with $ makeXmlElementNoEnd "feDisplacementMap" -- | @fedistantlight@ element feDistantLight_ :: Monad m => [Attribute] -> SvgT m () feDistantLight_ = with $ makeXmlElementNoEnd "feDistantLight" -- | @feflood@ element feFlood_ :: Monad m => [Attribute] -> SvgT m () feFlood_ = with $ makeXmlElementNoEnd "feFlood" -- | @fefunca@ element feFuncA_ :: Monad m => [Attribute] -> SvgT m () feFuncA_ = with $ makeXmlElementNoEnd "feFuncA" -- | @fefuncb@ element feFuncB_ :: Monad m => [Attribute] -> SvgT m () feFuncB_ = with $ makeXmlElementNoEnd "feFuncB" -- | @fefuncg@ element feFuncG_ :: Monad m => [Attribute] -> SvgT m () feFuncG_ = with $ makeXmlElementNoEnd "feFuncG" -- | @fefuncr@ element feFuncR_ :: Monad m => [Attribute] -> SvgT m () feFuncR_ = with $ makeXmlElementNoEnd "feFuncR" -- | @fegaussianblur@ element feGaussianBlur_ :: Monad m => [Attribute] -> SvgT m () feGaussianBlur_ = with $ makeXmlElementNoEnd "feGaussianBlur" -- | @feimage@ element feImage_ :: Monad m => [Attribute] -> SvgT m () feImage_ = with $ makeXmlElementNoEnd "feImage" -- | @femerge@ element feMerge_ :: Monad m => [Attribute] -> SvgT m () feMerge_ = with $ makeXmlElementNoEnd "feMerge" -- | @femergenode@ element feMergeNode_ :: Monad m => [Attribute] -> SvgT m () feMergeNode_ = with $ makeXmlElementNoEnd "feMergeNode" -- | @femorphology@ element feMorphology_ :: Monad m => [Attribute] -> SvgT m () feMorphology_ = with $ makeXmlElementNoEnd "feMorphology" -- | @feoffset@ element feOffset_ :: Monad m => [Attribute] -> SvgT m () feOffset_ = with $ makeXmlElementNoEnd "feOffset" -- | @fepointlight@ element fePointLight_ :: Monad m => [Attribute] -> SvgT m () fePointLight_ = with $ makeXmlElementNoEnd "fePointLight" -- | @fespecularlighting@ element feSpecularLighting_ :: Monad m => [Attribute] -> SvgT m () feSpecularLighting_ = with $ makeXmlElementNoEnd "feSpecularLighting" -- | @fespotlight@ element feSpotLight_ :: Monad m => [Attribute] -> SvgT m () feSpotLight_ = with $ makeXmlElementNoEnd "feSpotLight" -- | @fetile@ element feTile_ :: Monad m => [Attribute] -> SvgT m () feTile_ = with $ makeXmlElementNoEnd "feTile" -- | @feturbulence@ element feTurbulence_ :: Monad m => [Attribute] -> SvgT m () feTurbulence_ = with $ makeXmlElementNoEnd "feTurbulence" -- | @filter_@ element filter_ :: Monad m => [Attribute] -> SvgT m () filter_ = with $ makeXmlElementNoEnd "filter" -- | @font@ element font_ :: Monad m => [Attribute] -> SvgT m () font_ = with $ makeXmlElementNoEnd "font" -- | @fontFace@ element fontFace_ :: Monad m => [Attribute] -> SvgT m () fontFace_ = with $ makeXmlElementNoEnd "font-face" -- | @fontFaceFormat@ element fontFaceFormat_ :: Monad m => [Attribute] -> SvgT m () fontFaceFormat_ = with $ makeXmlElementNoEnd "font-face-format" -- | @fontFaceName@ element fontFaceName_ :: Monad m => [Attribute] -> SvgT m () fontFaceName_ = with $ makeXmlElementNoEnd "font-face-name" -- | @fontFaceSrc@ element fontFaceSrc_ :: Monad m => [Attribute] -> SvgT m () fontFaceSrc_ = with $ makeXmlElementNoEnd "font-face-src" -- | @fontFaceUri@ element fontFaceUri_ :: Monad m => [Attribute] -> SvgT m () fontFaceUri_ = with $ makeXmlElementNoEnd "font-face-uri" -- | @foreignobject@ element foreignObject_ :: Monad m => [Attribute] -> SvgT m () foreignObject_ = with $ makeXmlElementNoEnd "foreignObject" -- | @g@ element g_ :: Term arg result => arg -> result g_ = term "g" -- | @glyph@ element or attribute glyph_ :: Term arg result => arg -> result glyph_ = term "glyph" -- | @glyphref@ element glyphRef_ :: Monad m => [Attribute] -> SvgT m () glyphRef_ = with $ makeXmlElementNoEnd "glyphRef" -- | @hkern@ element hkern_ :: Monad m => [Attribute] -> SvgT m () hkern_ = with $ makeXmlElementNoEnd "hkern" -- | @image@ element image_ :: Monad m => [Attribute] -> SvgT m () image_ = with $ makeXmlElementNoEnd "image" -- | @line@ element line_ :: Monad m => [Attribute] -> SvgT m () line_ = with $ makeXmlElementNoEnd "line" -- | @lineargradient@ element linearGradient_ :: Term arg result => arg -> result linearGradient_ = term "linearGradient" -- | @marker@ element marker_ :: Term arg result => arg -> result marker_ = term "marker" -- | @mask@ element or attribute mask_ :: Term arg result => arg -> result mask_ = term "mask" -- | @metadata@ element metadata_ :: Monad m => [Attribute] -> SvgT m () metadata_ = with $ makeXmlElementNoEnd "metadata" -- | @missingGlyph@ element missingGlyph_ :: Term arg result => arg -> result missingGlyph_ = term "missing-glyph" -- | @mpath@ element mpath_ :: Monad m => [Attribute] -> SvgT m () mpath_ = with $ makeXmlElementNoEnd "mpath" -- | @path@ element path_ :: Monad m => [Attribute] -> SvgT m () path_ = with $ makeXmlElementNoEnd "path" -- | @pattern@ element pattern_ :: Term arg result => arg -> result pattern_ = term "pattern" -- | @polygon@ element polygon_ :: Monad m => [Attribute] -> SvgT m () polygon_ = with $ makeXmlElementNoEnd "polygon" -- | @polyline@ element polyline_ :: Monad m => [Attribute] -> SvgT m () polyline_ = with $ makeXmlElementNoEnd "polyline" -- | @radialgradient@ element radialGradient_ :: Term arg result => arg -> result radialGradient_ = term "radialGradient" -- | @rect@ element rect_ :: Monad m => [Attribute] -> SvgT m () rect_ = with $ makeXmlElementNoEnd "rect" -- | @script@ element script_ :: Monad m => [Attribute] -> SvgT m () script_ = with $ makeXmlElementNoEnd "script" -- | @set@ element set_ :: Monad m => [Attribute] -> SvgT m () set_ = with $ makeXmlElementNoEnd "set" -- | @stop@ element stop_ :: Monad m => [Attribute] -> SvgT m () stop_ = with $ makeXmlElementNoEnd "stop" -- | @style@ element style_ :: Monad m => [Attribute] -> SvgT m () style_ = with $ makeXmlElementNoEnd "style" -- | @svg@ element svg_ :: Term arg result => arg -> result svg_ = term "svg" -- | @switch@ element switch_ :: Term arg result => arg -> result switch_ = term "switch" -- | @symbol@ element symbol_ :: Term arg result => arg -> result symbol_ = term "symbol" -- | @text_@ element text_ :: Term arg result => arg -> result text_ = term "text" -- | @textpath@ element textPath_ :: Term arg result => arg -> result textPath_ = term "textPath" -- | @title@ element title_ :: Monad m => [Attribute] -> SvgT m () title_ = with $ makeXmlElementNoEnd "title" -- | @tref@ element tref_ :: Monad m => [Attribute] -> SvgT m () tref_ = with $ makeXmlElementNoEnd "tref" -- | @tspan@ element tspan_ :: Monad m => [Attribute] -> SvgT m () tspan_ = with $ makeXmlElementNoEnd "tspan" -- | @use@ element use_ :: Monad m => [Attribute] -> SvgT m () use_ = with $ makeXmlElementNoEnd "use" -- | @view@ element view_ :: Monad m => [Attribute] -> SvgT m () view_ = with $ makeXmlElementNoEnd "view" -- | @vkern@ element vkern_ :: Monad m => [Attribute] -> SvgT m () vkern_ = with $ makeXmlElementNoEnd "vkern" lucid-svg-0.6.0.1/src/Lucid/Svg/Path.hs0000644000000000000000000001205412641323365015564 0ustar0000000000000000{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} ------------------------------------------------------------------------------- -- | -- Module : Lucid.Svg.Path -- Copyright : (c) 2015 Jeffrey Rosenbluth -- License : BSD-style (see LICENSE) -- Maintainer : jeffrey.rosenbluth@gmail.com -- -- Utility functions to help create SVG path attributes, -- and transforms. -- ------------------------------------------------------------------------------- module Lucid.Svg.Path where import Data.Text (Text) import qualified Data.Text as T import Data.Text.Lazy (toStrict) import Data.Text.Lazy.Builder (toLazyText) import Data.Text.Lazy.Builder.RealFloat -- | Convert a number to Text. toText :: RealFloat a => a -> Text toText = toStrict . toLazyText . formatRealFloat Fixed (Just 4) -- | moveto (absolute) mA :: RealFloat a => a -> a -> Text mA x y = T.concat ["M " ,toText x, ",", toText y, " "] -- | moveto (relative) mR :: RealFloat a => a -> a -> Text mR dx dy = T.concat ["m ", toText dx, ",", toText dy, " "] -- | lineto (absolute) lA :: RealFloat a => a -> a -> Text lA x y = T.concat ["L ", toText x, ",", toText y, " "] -- | lineto (relative) lR :: RealFloat a => a -> a -> Text lR dx dy = T.concat ["l ", toText dx, ",", toText dy, " "] -- | horizontal lineto (absolute) hA :: RealFloat a => a -> Text hA x = T.concat ["H ", toText x, " "] -- | horizontal lineto (relative) hR :: RealFloat a => a -> Text hR dx = T.concat ["h ", toText dx, " "] -- | vertical lineto (absolute) vA :: RealFloat a => a -> Text vA y = T.concat ["V ", toText y, " "] -- | vertical lineto (relative) vR :: RealFloat a => a -> Text vR dy = T.concat ["v ", toText dy, " "] -- | Cubic Bezier curve (absolute) cA :: RealFloat a => a -> a -> a -> a -> a -> a -> Text cA c1x c1y c2x c2y x y = T.concat [ "C ", toText c1x, ",", toText c1y, " ", toText c2x, "," , toText c2y, " ", toText x, " ", toText y] -- | Cubic Bezier curve (relative) cR :: RealFloat a => a -> a -> a -> a -> a -> a -> Text cR dc1x dc1y dc2x dc2y dx dy = T.concat [ "c ", toText dc1x, ",", toText dc1y, " ", toText dc2x , ",", toText dc2y, " ", toText dx, " ", toText dy] -- | Smooth Cubic Bezier curve (absolute) sA :: RealFloat a => a -> a -> a -> a -> Text sA c2x c2y x y = T.concat ["S ", toText c2x, ",", toText c2y, " ", toText x, ",", toText y, " "] -- | Smooth Cubic Bezier curve (relative) sR :: RealFloat a => a -> a -> a -> a -> Text sR dc2x dc2y dx dy = T.concat ["s ", toText dc2x, ",", toText dc2y, " ", toText dx, ",", toText dy, " "] -- | Quadratic Bezier curve (absolute) qA :: RealFloat a => a -> a -> a -> a -> Text qA cx cy x y = T.concat ["Q ", toText cx, ",", toText cy, " ", toText x, ",", toText y, " "] -- | Quadratic Bezier curve (relative) qR :: RealFloat a => a -> a -> a -> a -> Text qR dcx dcy dx dy = T.concat ["q ", toText dcx, ",", toText dcy, " ", toText dx, ",", toText dy, " " ] -- | Smooth Quadratic Bezier curve (absolute) tA :: RealFloat a => a -> a -> Text tA x y = T.concat ["T ", " ", toText x, ",", toText y, " "] -- | Smooth Quadratic Bezier curve (relative) tR :: RealFloat a => a -> a -> Text tR x y = T.concat [ "t ", toText x, ",", toText y, " "] -- | Arc (absolute) aA :: RealFloat a => a -> a -> a -> a -> a -> a -> a -> Text aA rx ry xrot largeFlag sweepFlag x y = T.concat [ "A ", toText rx, ",", toText ry, " ", toText xrot, " ", toText largeFlag , " ", toText sweepFlag, " ", toText x, " ", toText y, " "] -- | Arc (relative) aR :: RealFloat a => a -> a -> a -> a -> a -> a -> a -> Text aR rx ry xrot largeFlag sweepFlag x y = T.concat [ "a ", toText rx, ",", toText ry, " ", toText xrot, " ", toText largeFlag , " ", toText sweepFlag, " ", toText x, " ", toText y, " "] -- | closepath z :: Text z = "Z" -- | SVG Transform components -- | Specifies a translation by @x@ and @y@ translate :: RealFloat a => a -> a -> Text translate x y = T.concat ["translate(", toText x, " ", toText y, ")"] -- | Specifies a scale operation by @x@ and @y@ scale :: RealFloat a => a -> a -> Text scale x y = T.concat ["scale(", toText x, " ", toText y, ")"] -- | Specifies a rotation by @rotate-angle@ degrees rotate :: RealFloat a => a -> Text rotate angle = T.concat ["rotate(", toText angle, ")"] -- | Specifies a rotation by @rotate-angle@ degrees about the given time @rx,ry@ rotateAround :: RealFloat a => a -> a -> a -> Text rotateAround angle rx ry = T.concat ["rotate(", toText angle, ",", toText rx, ",", toText ry, ")"] -- | Skew tansformation along x-axis skewX :: RealFloat a => a -> Text skewX angle = T.concat ["skewX(", toText angle, ")"] -- | Skew tansformation along y-axis skewY :: RealFloat a => a -> Text skewY angle = T.concat ["skewY(", toText angle, ")"] -- | Specifies a transform in the form of a transformation matrix matrix :: RealFloat a => a -> a -> a -> a -> a -> a -> Text matrix a b c d e f = T.concat [ "matrix(", toText a, ",", toText b, ",", toText c , ",", toText d, ",", toText e, ",", toText f, ")"]