reflex-dom-svg-0.3.2.0: Reflex functions for SVG elements.

Safe HaskellNone
LanguageHaskell2010

Reflex.Dom.Widget.SVG

Description

Main functions for creating SVG dom elements via Reflex

Synopsis

Documentation

class AsSVGTag s where Source #

Lawless class to provide a constraint indicating that a given type is capable of being represented by a SVG XML Tag. rect, circle, svg, etc.

Minimal complete definition

svgTagName

Methods

svgTagName :: s -> Text Source #

Instances
AsSVGTag BasicInner Source # 
Instance details

Defined in Reflex.Dom.Widget.SVG

AsSVGTag BasicSVG Source # 
Instance details

Defined in Reflex.Dom.Widget.SVG

AsSVGTag SVG_Root Source # 
Instance details

Defined in Reflex.Dom.Widget.SVG

data BasicSVG Source #

The basic SVG shapes.

Instances
Eq BasicSVG Source # 
Instance details

Defined in Reflex.Dom.Widget.SVG

Show BasicSVG Source # 
Instance details

Defined in Reflex.Dom.Widget.SVG

AsSVGTag BasicSVG Source # 
Instance details

Defined in Reflex.Dom.Widget.SVG

type CanBeNested BasicSVG Source # 
Instance details

Defined in Reflex.Dom.Widget.SVG

data BasicInner Source #

The simplest inner element for a basic shape, the "animate" tag.

Constructors

Animate 

data SVG_Root Source #

The SVG Root element: "svg"

Constructors

SVG_Root 
Instances
AsSVGTag SVG_Root Source # 
Instance details

Defined in Reflex.Dom.Widget.SVG

type family CanBeNested a :: * Source #

Create a relationship between a set of SVG tags that can be nested inside a different set of SVG tags. Currently this just creates the relationship between the "animate" tag and the basic shapes ("rect", "circle", etc).

Instances
type CanBeNested BasicSVG Source # 
Instance details

Defined in Reflex.Dom.Widget.SVG

data SVGEl t m a Source #

This represents an SVG element, containing both the raw Reflex.Dom El type and a Dynamic of all of the children that are nested in this element.

svg_ :: (DomBuilder t m, PostBuild t m, Reflex t, AsSVGTag a) => Dynamic t SVG_El -> m (SVGEl t m a) -> m (Element EventResult (DomBuilderSpace m) t, SVGEl t m a) Source #

Create the Root SVG element.

Note that there are no restrictions on the inner element, apart from the return type being of m (SVGEl t a). So you are free to place whatever you like in there, but bear in mind that the browser rules for SVG are still in play. So text inputs etc, won't work.

svgBasicDyn :: (DomBuilder t m, PostBuild t m, MonadFix m, MonadHold t m, AsSVGTag s, AsSVGTag (CanBeNested s), Ord (CanBeNested s)) => s -> (p -> Map Text Text) -> Dynamic t p -> Dynamic t (Map (CanBeNested s) (Map Text Text)) -> m (SVGEl t m s) Source #

Create a SVG element that has dynamic attributes and contains children that are acceptable children for this element. "rect" as a Basic Shape can only contain "animate" elements, for example.

The SVG element will have some Dynamic properties and a function that allows these properties to be converted into a Map Text Text, inline with other Reflex.Dom widgets.

svgBasicDyn_ :: (DomBuilder t m, PostBuild t m, MonadFix m, MonadHold t m, AsSVGTag s, AsSVGTag (CanBeNested s), Ord (CanBeNested s)) => s -> (p -> Map Text Text) -> Dynamic t p -> m (SVGEl t m s) Source #

As per the svgBasicDyn function, except with no inner elements.

svgElDynAttr' :: forall t m a e. (DomBuilder t m, PostBuild t m, AsSVGTag e) => e -> Dynamic t (Map Text Text) -> m a -> m (Element EventResult (DomBuilderSpace m) t, a) Source #

This is for creating a SVG element with Dynamic attributes, and ensuring we use the right namespace so the browser actually picks up on it. The name space in use is "http://www.w3.org/2000/svg".

svgElDynAttr_ :: forall t m e. (DomBuilder t m, PostBuild t m, AsSVGTag e) => e -> Dynamic t (Map Text Text) -> m (Element EventResult (DomBuilderSpace m) t) Source #

As per svgElDynAttr', but does not have any children.