maille
Version:
Component library for MithrilJS
50 lines (49 loc) • 2.52 kB
JavaScript
;
// THIS FILE WAS AUTO-GENERATED FOR PACKAGING, DO NOT MODIFY
Object.defineProperty(exports, "__esModule", { value: true });
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 Compass {
constructor() {
this.defaults = {
height: "1em",
width: "1em",
fill: "black",
};
}
view(vnode) {
return m("svg", Object.assign({}, this.genAttrs(vnode)),
// tslint:disable-next-line
m.trust('<path d="M399.489 299.496l-36.85 20.965a40.557 40.557 0 0 1-1.312 8.02c-5.8 21.661-28.075 34.524-49.748 28.724a41.251 41.251 0 0 1-8.056-3.106l-39.118 22.252 157.608 116.08-22.524-192.935zM319.999 0c176.696 0 320 143.305 320 320S496.696 640 320 640C143.306 640 0 496.695 0 320S143.306 0 320 0zm0 83.682c130.49 0 236.319 105.828 236.319 236.318S450.49 556.318 320 556.318 83.682 450.49 83.682 320 189.51 83.682 320 83.682zM244.03 342.666l37.572-21.366c-.378-4.536.012-9.201 1.264-13.843 5.799-21.662 28.075-34.524 49.736-28.725a40.522 40.522 0 0 1 13.04 6.13l33.484-19.051-157.62-116.068 22.524 192.924z"/>'));
}
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 compass";
attrs.className = attrs.className ? (attrs.className + " " + additionalClasses) : additionalClasses;
return attrs;
}
}
exports.default = Compass;