maille
Version:
Component library for MithrilJS
55 lines (54 loc) • 2.88 kB
JavaScript
;
// This file was built automatically via the convert-ux-wing-svg.js script (v0.0.1)
// This icon was obtained from UXWing.com
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const mithril_1 = __importDefault(require("mithril")); // +standalone
const types_1 = require("../../../types");
// tslint:disable-next-line
const SVG_PROPS = { "xmlns": "http://www.w3.org/2000/svg", "width": "64", "height": "64", "shape-rendering": "geometricPrecision", "text-rendering": "geometricPrecision", "image-rendering": "optimizeQuality", "fill-rule": "evenodd", "clip-rule": "evenodd", "viewBox": "0 0 640 640" };
class PieChart {
constructor() {
this.defaults = {
height: "1em",
width: "1em",
fill: "black",
};
}
view(vnode) {
return mithril_1.default("svg", Object.assign({}, this.genAttrs(vnode)),
// tslint:disable-next-line
mithril_1.default.trust('<path d="M337.587 361.788l252.086 4.181c0 89.54-44.552 173.223-118.809 223.231L337.587 361.788zm-25.146-43.524l-2.846-293.165-.178-18.898 18.827 1.287H328.35a335.593 335.593 0 0 1 68.777 12.119c22.028 6.319 43.182 14.87 63.19 25.382 102.462 53.847 173.305 159.144 178.833 281.33l.85 18.815-18.803-.579-291.76-8.953-16.83-.507-.165-16.831zm32.303-273.89l2.493 256.799 255.51 7.83C591.8 207.712 530.476 121.42 444.007 75.97a298.22 298.22 0 0 0-56.47-22.642 300.278 300.278 0 0 0-42.791-8.953zm-57.307 301.977l143.742 248.956c-43.654 25.193-93.309 38.492-143.742 38.492C128.719 633.8 0 505.081 0 346.351c0-154.018 121.419-280.704 275.295-287.2l12.142 287.2z"/>'));
}
genAttrs(vnode) {
const overrides = Object.values(types_1.GeneralIconAttrName)
.reduce((acc, name) => {
if (!name) {
return acc;
}
if (vnode && vnode && vnode.attrs[name]) {
acc[name] = vnode.attrs[name];
return acc;
}
if (name in this.defaults) {
acc[name] = this.defaults[name];
}
return acc;
}, {});
const attrs = Object.assign({}, SVG_PROPS, overrides);
if (!("style" in attrs) || !attrs.style) {
attrs.style = {};
}
if (attrs.style && typeof attrs.style !== "object") {
throw new Error("attr.style must be an object for icons");
}
attrs.style["vertical-align"] = "middle";
attrs.style["min-width"] = "1.25em";
const additionalClasses = "maille maille-uxwing-icon pie-chart";
attrs.className = attrs.className ? (attrs.className + " " + additionalClasses) : additionalClasses;
return attrs;
}
}
exports.default = PieChart;