@thi.ng/hiccup-svg
Version:
SVG element functions for @thi.ng/hiccup & related tooling
21 lines (20 loc) • 500 B
JavaScript
import { fattribs, ff } from "./format.js";
const rect = (p, width, height, attribs, ...body) => roundedRect(p, width, height, 0, 0, attribs, ...body);
const roundedRect = (p, width, height, rx, ry, attribs, ...body) => {
attribs = fattribs({
...attribs,
x: ff(p[0]),
y: ff(p[1]),
width: ff(width),
height: ff(height)
});
if (rx > 0 || ry > 0) {
attribs.rx = ff(rx);
attribs.ry = ff(ry);
}
return ["rect", attribs, ...body];
};
export {
rect,
roundedRect
};