UNPKG

@hyper.fun/tabler-lungs

Version:

👉 https://hyper.fun/c/tabler-lungs/1.3.0

93 lines (87 loc) • 3.65 kB
/******/ // The require scope /******/ var __wp_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __wp_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__wp_require__.o(definition, key) && !__wp_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __wp_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /************************************************************************/ var __wp_exports__ = {}; // EXPORTS __wp_require__.d(__wp_exports__, { "Z": () => (/* binding */ AwesomeHfc) }); ;// CONCATENATED MODULE: ./.hfc/propnames.js /* harmony default export */ const propnames = ([["size","class","color"],[],[]]); ;// CONCATENATED MODULE: ./src/index.ts const svgAttrs = [["xmlns","http://www.w3.org/2000/svg"],["viewBox","0 0 24 24"]]; const svgHtml = "<g fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"> <path d=\"M6.081 20C7.693 20 9 18.665 9 17.02V7.257C9 6.563 8.448 6 7.768 6c-.205 0-.405.052-.584.15l-.13.083C5.594 7.292 4.622 8.88 3.65 12.057c-.42 1.37-.636 2.962-.648 4.775c-.012 1.675 1.261 3.054 2.877 3.161l.203.007z\"></path> <path d=\"M17.92 20C16.307 20 15 18.665 15 17.02V7.257C15 6.563 15.552 6 16.233 6c.204 0 .405.052.584.15l.13.083c1.46 1.059 2.432 2.647 3.405 5.824c.42 1.37.636 2.962.648 4.775c.012 1.675-1.261 3.054-2.878 3.161L17.92 20z\"></path> <path d=\"M9 12a3 3 0 0 0 3-3a3 3 0 0 0 3 3\"></path> <path d=\"M12 4v5\"></path> </g>"; class AwesomeHfc { constructor(container, props) { this.container = container; for (let i = 0; i < svgAttrs.length; i++) { container.setAttribute(svgAttrs[i][0], svgAttrs[i][1]); } this.render(props); container.innerHTML = svgHtml; } changed(props) { this.render(props); } disconnected() { } render(props) { if (props.attrs.size) { this.container.setAttribute("width", props.attrs.size); this.container.setAttribute("height", props.attrs.size); } if (props.attrs.class) { this.container.setAttributeNS(null, "class", props.attrs.class); } if (props.attrs.color) { this.container.style.fill = props.attrs.color; this.container.style.color = props.attrs.color; } bindToElement(this.container, props.others); } } AwesomeHfc.tag = "svg"; AwesomeHfc.props = propnames; function bindToElement(elem, obj) { for (let i = 0, keys = Object.keys(obj); i < keys.length; i++) { const key = keys[i]; const value = obj[key]; if (key === "style") { if (typeof value === "object") { Object.assign(elem.style, value); } else { elem.style.cssText += value; } continue; } if (typeof value === "function") { elem[key] = function (event) { value(event); }; } else { elem.setAttribute(key, value); } } } var __wp_exports__default = __wp_exports__.Z; export { __wp_exports__default as default };