UNPKG

maille

Version:

Component library for MithrilJS

50 lines (49 loc) 2.36 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", "shape-rendering": "geometricPrecision", "text-rendering": "geometricPrecision", "image-rendering": "optimizeQuality", "fill-rule": "evenodd", "clip-rule": "evenodd", "viewBox": "0 0 640 640" }; class MarkupSymbols { 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 fill-rule="nonzero" d="M234.227 122.352h-89.576L.001 312.618 144.65 502.86h89.576L89.576 312.618l144.651-190.266zm171.557 0h89.576L640 312.618 495.36 502.86h-89.576l144.651-190.242-144.651-190.266zm-40.3-66.639l31.016 7.229c4.878 1.122 7.938 6.047 6.804 10.913L286.137 577.471c-1.146 4.867-6.048 7.926-10.926 6.804l-31.016-7.229c-4.878-1.122-7.937-6.047-6.803-10.913L354.559 62.517c1.146-4.867 6.06-7.926 10.925-6.804z"/>')); } 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 markup-symbols"; attrs.className = attrs.className ? (attrs.className + " " + additionalClasses) : additionalClasses; return attrs; } } exports.default = MarkupSymbols;