UNPKG

@thi.ng/hiccup-svg

Version:

SVG element functions for @thi.ng/hiccup & related tooling

26 lines (25 loc) 562 B
import { XML_INKSCAPE, XML_SVG, XML_XLINK } from "@thi.ng/prefixes/xml"; import { convertTree } from "./convert.js"; import { fattribs } from "./format.js"; const svg = (attribs, ...body) => { attribs = fattribs( { version: "1.1", xmlns: XML_SVG, "xmlns:xlink": XML_XLINK, "xmlns:inkscape": XML_INKSCAPE, ...attribs }, "width", "height", "stroke-width" ); if (attribs.__convert) { delete attribs.__convert; body = body.map(convertTree); } return ["svg", attribs, ...body]; }; export { svg };