UNPKG

maille

Version:

Component library for MithrilJS

50 lines (49 loc) 2.51 kB
"use strict"; // 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", "viewBox": "0 0 640 640", "shape-rendering": "geometricPrecision", "text-rendering": "geometricPrecision", "image-rendering": "optimizeQuality", "fill-rule": "evenodd", "clip-rule": "evenodd" }; class Tag { 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="M336.984 19.925l284.98 310.315c19.24 20.942 17.043 54.084-4.181 73.017L366.878 626.961c-21.19 18.91-54.095 17.032-73.005-4.193L26.267 322.564l.508-8.835L4.853.001l322.622 20.422c3.107-.213 6.272-.378 9.508-.496zM131.257 61.938c31.985.708 57.355 27.224 56.646 59.22-.708 31.986-27.224 57.356-59.209 56.647-31.985-.708-57.355-27.224-56.658-59.21.708-31.984 27.236-57.354 59.221-56.657zm50.41 218.093l184.16 200.66-36.709 33.709-184.16-200.684 36.71-33.686zm155.46-141.958l184.182 200.672-36.72 33.697-184.16-200.66 36.696-33.71zm-74.01 69.284L447.3 408.005l-36.732 33.697-184.16-200.66 36.709-33.685z"/>')); } 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 tag"; attrs.className = attrs.className ? (attrs.className + " " + additionalClasses) : additionalClasses; return attrs; } } exports.default = Tag;