From 30755ea3705deea9649c8941a83626ecbedf5f89 Mon Sep 17 00:00:00 2001 From: Phil Freeman Date: Wed, 13 May 2015 11:09:12 -0700 Subject: [PATCH] SVG support --- Gruntfile.js | 2 + docs/README.md | 446 +++++++++++++++++++++++++++++++ src/Thermite/SVG.purs | 61 +++++ src/Thermite/SVG/Attributes.purs | 138 ++++++++++ 4 files changed, 647 insertions(+) create mode 100644 src/Thermite/SVG.purs create mode 100644 src/Thermite/SVG/Attributes.purs diff --git a/Gruntfile.js b/Gruntfile.js index 20fac73..53c7bdc 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -20,6 +20,8 @@ module.exports = function(grunt) { "src/Thermite/Html.purs", "src/Thermite/Html/Attributes.purs", "src/Thermite/Html/Elements.purs", + "src/Thermite/SVG.purs", + "src/Thermite/SVG/Attributes.purs", "src/Thermite/Events.purs" ], dest: "docs/README.md" diff --git a/docs/README.md b/docs/README.md index 97242d1..02199d3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2591,6 +2591,452 @@ wbr' :: forall eff. [Html eff] -> Html eff +## Module Thermite.SVG + + +This module defines helper functions for creating SVG elements. + +#### `circle` + +``` purescript +circle :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `clipPath` + +``` purescript +clipPath :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `defs` + +``` purescript +defs :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `ellipse` + +``` purescript +ellipse :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `g` + +``` purescript +g :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `line` + +``` purescript +line :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `linearGradient` + +``` purescript +linearGradient :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `mask` + +``` purescript +mask :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `path` + +``` purescript +path :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `pattern` + +``` purescript +pattern :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `polygon` + +``` purescript +polygon :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `polyline` + +``` purescript +polyline :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `radialGradient` + +``` purescript +radialGradient :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `rect` + +``` purescript +rect :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `stop` + +``` purescript +stop :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `svg` + +``` purescript +svg :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `text` + +``` purescript +text :: forall eff. Attr -> [Html eff] -> Html eff +``` + + +#### `tspan` + +``` purescript +tspan :: forall eff. Attr -> [Html eff] -> Html eff +``` + + + +## Module Thermite.SVG.Attributes + + +This module defines helper functions for creating SVG attributes. + +#### `clipPath` + +``` purescript +clipPath :: String -> Attr +``` + + +#### `cx` + +``` purescript +cx :: String -> Attr +``` + + +#### `cy` + +``` purescript +cy :: String -> Attr +``` + + +#### `d` + +``` purescript +d :: String -> Attr +``` + + +#### `dx` + +``` purescript +dx :: String -> Attr +``` + + +#### `dy` + +``` purescript +dy :: String -> Attr +``` + + +#### `fill` + +``` purescript +fill :: String -> Attr +``` + + +#### `fillOpacity` + +``` purescript +fillOpacity :: String -> Attr +``` + + +#### `fontFamily` + +``` purescript +fontFamily :: String -> Attr +``` + + +#### `fontSize` + +``` purescript +fontSize :: String -> Attr +``` + + +#### `fx` + +``` purescript +fx :: String -> Attr +``` + + +#### `fy` + +``` purescript +fy :: String -> Attr +``` + + +#### `gradientTransform` + +``` purescript +gradientTransform :: String -> Attr +``` + + +#### `gradientUnits` + +``` purescript +gradientUnits :: String -> Attr +``` + + +#### `markerEnd` + +``` purescript +markerEnd :: String -> Attr +``` + + +#### `markerMid` + +``` purescript +markerMid :: String -> Attr +``` + + +#### `markerStart` + +``` purescript +markerStart :: String -> Attr +``` + + +#### `offset` + +``` purescript +offset :: String -> Attr +``` + + +#### `opacity` + +``` purescript +opacity :: String -> Attr +``` + + +#### `patternContentUnits` + +``` purescript +patternContentUnits :: String -> Attr +``` + + +#### `patternUnits` + +``` purescript +patternUnits :: String -> Attr +``` + + +#### `points` + +``` purescript +points :: String -> Attr +``` + + +#### `preserveAspectRatio` + +``` purescript +preserveAspectRatio :: String -> Attr +``` + + +#### `r` + +``` purescript +r :: String -> Attr +``` + + +#### `rx` + +``` purescript +rx :: String -> Attr +``` + + +#### `ry` + +``` purescript +ry :: String -> Attr +``` + + +#### `spreadMethod` + +``` purescript +spreadMethod :: String -> Attr +``` + + +#### `stopColor` + +``` purescript +stopColor :: String -> Attr +``` + + +#### `stopOpacity` + +``` purescript +stopOpacity :: String -> Attr +``` + + +#### `stroke` + +``` purescript +stroke :: String -> Attr +``` + + +#### `strokeDasharray` + +``` purescript +strokeDasharray :: String -> Attr +``` + + +#### `strokeLinecap` + +``` purescript +strokeLinecap :: String -> Attr +``` + + +#### `strokeOpacity` + +``` purescript +strokeOpacity :: String -> Attr +``` + + +#### `strokeWidth` + +``` purescript +strokeWidth :: String -> Attr +``` + + +#### `textAnchor` + +``` purescript +textAnchor :: String -> Attr +``` + + +#### `transform` + +``` purescript +transform :: String -> Attr +``` + + +#### `version` + +``` purescript +version :: String -> Attr +``` + + +#### `viewBox` + +``` purescript +viewBox :: String -> Attr +``` + + +#### `x1` + +``` purescript +x1 :: String -> Attr +``` + + +#### `x2` + +``` purescript +x2 :: String -> Attr +``` + + +#### `x` + +``` purescript +x :: String -> Attr +``` + + +#### `y1` + +``` purescript +y1 :: String -> Attr +``` + + +#### `y2` + +``` purescript +y2 :: String -> Attr +``` + + +#### `y` + +``` purescript +y :: String -> Attr +``` + + + ## Module Thermite.Events diff --git a/src/Thermite/SVG.purs b/src/Thermite/SVG.purs new file mode 100644 index 0000000..974d3d3 --- /dev/null +++ b/src/Thermite/SVG.purs @@ -0,0 +1,61 @@ +-- | This module defines helper functions for creating SVG elements. + +module Thermite.SVG where + +import Thermite.Types +import Thermite.Internal + +circle :: forall eff. Attr -> [Html eff] -> Html eff +circle = createElementImpl "circle" + +clipPath :: forall eff. Attr -> [Html eff] -> Html eff +clipPath = createElementImpl "clipPath" + +defs :: forall eff. Attr -> [Html eff] -> Html eff +defs = createElementImpl "defs" + +ellipse :: forall eff. Attr -> [Html eff] -> Html eff +ellipse = createElementImpl "ellipse" + +g :: forall eff. Attr -> [Html eff] -> Html eff +g = createElementImpl "g" + +line :: forall eff. Attr -> [Html eff] -> Html eff +line = createElementImpl "line" + +linearGradient :: forall eff. Attr -> [Html eff] -> Html eff +linearGradient = createElementImpl "linearGradient" + +mask :: forall eff. Attr -> [Html eff] -> Html eff +mask = createElementImpl "mask" + +path :: forall eff. Attr -> [Html eff] -> Html eff +path = createElementImpl "path" + +pattern :: forall eff. Attr -> [Html eff] -> Html eff +pattern = createElementImpl "pattern" + +polygon :: forall eff. Attr -> [Html eff] -> Html eff +polygon = createElementImpl "polygon" + +polyline :: forall eff. Attr -> [Html eff] -> Html eff +polyline = createElementImpl "polyline" + +radialGradient :: forall eff. Attr -> [Html eff] -> Html eff +radialGradient = createElementImpl "radialGradient" + +rect :: forall eff. Attr -> [Html eff] -> Html eff +rect = createElementImpl "rect" + +stop :: forall eff. Attr -> [Html eff] -> Html eff +stop = createElementImpl "stop" + +svg :: forall eff. Attr -> [Html eff] -> Html eff +svg = createElementImpl "svg" + +text :: forall eff. Attr -> [Html eff] -> Html eff +text = createElementImpl "text" + +tspan :: forall eff. Attr -> [Html eff] -> Html eff +tspan = createElementImpl "tspan" + diff --git a/src/Thermite/SVG/Attributes.purs b/src/Thermite/SVG/Attributes.purs new file mode 100644 index 0000000..7270d24 --- /dev/null +++ b/src/Thermite/SVG/Attributes.purs @@ -0,0 +1,138 @@ +-- | This module defines helper functions for creating SVG attributes. + +module Thermite.SVG.Attributes where + +import Thermite.Types +import Thermite.Internal + +clipPath :: String -> Attr +clipPath = unsafeAttribute "clipPath" + +cx :: String -> Attr +cx = unsafeAttribute "cx" + +cy :: String -> Attr +cy = unsafeAttribute "cy" + +d :: String -> Attr +d = unsafeAttribute "d" + +dx :: String -> Attr +dx = unsafeAttribute "dx" + +dy :: String -> Attr +dy = unsafeAttribute "dy" + +fill :: String -> Attr +fill = unsafeAttribute "fill" + +fillOpacity :: String -> Attr +fillOpacity = unsafeAttribute "fillOpacity" + +fontFamily :: String -> Attr +fontFamily = unsafeAttribute "fontFamily" + +fontSize :: String -> Attr +fontSize = unsafeAttribute "fontSize" + +fx :: String -> Attr +fx = unsafeAttribute "fx" + +fy :: String -> Attr +fy = unsafeAttribute "fy" + +gradientTransform :: String -> Attr +gradientTransform = unsafeAttribute "gradientTransform" + +gradientUnits :: String -> Attr +gradientUnits = unsafeAttribute "gradientUnits" + +markerEnd :: String -> Attr +markerEnd = unsafeAttribute "markerEnd" + +markerMid :: String -> Attr +markerMid = unsafeAttribute "markerMid" + +markerStart :: String -> Attr +markerStart = unsafeAttribute "markerStart" + +offset :: String -> Attr +offset = unsafeAttribute "offset" + +opacity :: String -> Attr +opacity = unsafeAttribute "opacity" + +patternContentUnits :: String -> Attr +patternContentUnits = unsafeAttribute "patternContentUnits" + +patternUnits :: String -> Attr +patternUnits = unsafeAttribute "patternUnits" + +points :: String -> Attr +points = unsafeAttribute "points" + +preserveAspectRatio :: String -> Attr +preserveAspectRatio = unsafeAttribute "preserveAspectRatio" + +r :: String -> Attr +r = unsafeAttribute "r" + +rx :: String -> Attr +rx = unsafeAttribute "rx" + +ry :: String -> Attr +ry = unsafeAttribute "ry" + +spreadMethod :: String -> Attr +spreadMethod = unsafeAttribute "spreadMethod" + +stopColor :: String -> Attr +stopColor = unsafeAttribute "stopColor" + +stopOpacity :: String -> Attr +stopOpacity = unsafeAttribute "stopOpacity" + +stroke :: String -> Attr +stroke = unsafeAttribute "stroke" + +strokeDasharray :: String -> Attr +strokeDasharray = unsafeAttribute "strokeDasharray" + +strokeLinecap :: String -> Attr +strokeLinecap = unsafeAttribute "strokeLinecap" + +strokeOpacity :: String -> Attr +strokeOpacity = unsafeAttribute "strokeOpacity" + +strokeWidth :: String -> Attr +strokeWidth = unsafeAttribute "strokeWidth" + +textAnchor :: String -> Attr +textAnchor = unsafeAttribute "textAnchor" + +transform :: String -> Attr +transform = unsafeAttribute "transform" + +version :: String -> Attr +version = unsafeAttribute "version" + +viewBox :: String -> Attr +viewBox = unsafeAttribute "viewBox" + +x1 :: String -> Attr +x1 = unsafeAttribute "x1" + +x2 :: String -> Attr +x2 = unsafeAttribute "x2" + +x :: String -> Attr +x = unsafeAttribute "x" + +y1 :: String -> Attr +y1 = unsafeAttribute "y1" + +y2 :: String -> Attr +y2 = unsafeAttribute "y2" + +y :: String -> Attr +y = unsafeAttribute "y" \ No newline at end of file