packages feed

diagrams-svg 1.4.3.2 → 1.4.4

raw patch · 3 files changed

+15/−7 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Diagrams.Backend.SVG: svgAttr :: SVGFloat n => String -> String -> QDiagram SVG V2 n Any -> QDiagram SVG V2 n Any

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+## [v1.4.4](https://github.com/diagrams/diagrams-svg/tree/v1.4.4) (2025-03-05)++- New `svgAttr` function, for adding arbitrary attribute/value pairs+  to nodes.  Thanks to @Chobbes for the [PR](https://github.com/diagrams/diagrams-svg/pull/124).+ ## [v1.4.3.2](https://github.com/diagrams/diagrams-svg/tree/v1.4.3.2) (2024-08-27)  - Allow `hashable-1.5`
diagrams-svg.cabal view
@@ -1,5 +1,5 @@ Name:                diagrams-svg-Version:             1.4.3.2+Version:             1.4.4 Synopsis:            SVG backend for diagrams drawing EDSL. Homepage:            https://diagrams.github.io/ License:             BSD3
src/Diagrams/Backend/SVG.hs view
@@ -100,7 +100,7 @@   , B     -- for rendering options specific to SVG   , Options(..), sizeSpec, svgDefinitions, idPrefix, svgAttributes, generateDoctype-  , svgClass, svgId, svgTitle+  , svgClass, svgId, svgTitle, svgAttr   , SVGFloat    , renderSVG@@ -279,26 +279,29 @@   RStyle sty                    -> R $ local (over style (<> sty)) r   RAnnot (OpacityGroup o)       -> R $ g_ [Opacity_ <<- toText o] <$> r   RAnnot (Href uri)             -> R $ a_ [XlinkHref_ <<- T.pack uri] <$> r-  RAnnot (KeyVal ("class",v))   -> R $ with <$> r <*> pure [Class_ <<- T.pack v]-  RAnnot (KeyVal ("id",v))      -> R $ with <$> r <*> pure [Id_ <<- T.pack v]   RAnnot (KeyVal ("title",v))   -> R $ do     e <- r     pure $ g_ [] $ e <> title_ [] (toElement v)+  RAnnot (KeyVal (attr,v))      -> R $ with <$> r <*> pure [makeAttribute (T.pack attr) (T.pack v)]   _                             -> R r   where     R r = foldMap rtree rs  -- | Set the id for a particular SVG diagram svgId :: SVGFloat n => String -> QDiagram SVG V2 n Any -> QDiagram SVG V2 n Any-svgId = curry keyVal "id"+svgId = svgAttr "id"  -- | Set the class for a particular SVG diagram svgClass :: SVGFloat n => String -> QDiagram SVG V2 n Any -> QDiagram SVG V2 n Any-svgClass = curry keyVal "class"+svgClass = svgAttr "class"  -- | Set the title text for a particular SVG diagram svgTitle :: SVGFloat n => String -> QDiagram SVG V2 n Any -> QDiagram SVG V2 n Any-svgTitle = curry keyVal "title"+svgTitle = svgAttr "title"++-- | Set an arbitrary attribute for a particular SVG diagram+svgAttr :: SVGFloat n => String -> String -> QDiagram SVG V2 n Any -> QDiagram SVG V2 n Any+svgAttr attr = curry keyVal attr  -- | Lens onto the size of the svg options. sizeSpec :: Lens' (Options SVG V2 n) (SizeSpec V2 n)