UNPKG

maille

Version:

Component library for MithrilJS

50 lines (49 loc) 2.42 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 ImageFile { 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="M587.062 640H52.937V0H457.41l129.651 137.683V640zM208.266 237.027c22.536 0 40.831 18.236 40.831 40.796 0 22.524-18.295 40.796-40.831 40.796-22.5 0-40.784-18.272-40.784-40.796 0-22.56 18.284-40.796 40.784-40.796zm171.297 155.022l73.005-126.238 10.76-18.614 7.913 19.984 49.217 233.53H133.288v-47.493l9.933-.508 27.378-1.393 31.536-77.127 19.619 1.063 14.787 51.957h36.036l41.658-107.234 7.441-19.193 11.02 17.362 46.867 73.903zM543.62 594.044V168.547H425.473V40.774H96.874v553.271H543.62z"/>')); } 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 image-file"; attrs.className = attrs.className ? (attrs.className + " " + additionalClasses) : additionalClasses; return attrs; } } exports.default = ImageFile;