@hyper.fun/fa-stackpath
Version:
👉 https://hyper.fun/c/fa-stackpath/1.3.0
93 lines (87 loc) • 3.73 kB
JavaScript
/******/ // 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 448 512"]];
const svgHtml = "<path d=\"M244.6 232.4c0 8.5-4.26 20.49-21.34 20.49h-19.61v-41.47h19.61c17.13 0 21.34 12.36 21.34 20.98zM448 32v448H0V32zM151.3 287.84c0-21.24-12.12-34.54-46.72-44.85c-20.57-7.41-26-10.91-26-18.63s7-14.61 20.41-14.61c14.09 0 20.79 8.45 20.79 18.35h30.7l.19-.57c.5-19.57-15.06-41.65-51.12-41.65c-23.37 0-52.55 10.75-52.55 38.29c0 19.4 9.25 31.29 50.74 44.37c17.26 6.15 21.91 10.4 21.91 19.48c0 15.2-19.13 14.23-19.47 14.23c-20.4 0-25.65-9.1-25.65-21.9h-30.8l-.18.56c-.68 31.32 28.38 45.22 56.63 45.22c29.98 0 51.12-13.55 51.12-38.29zm125.38-55.63c0-25.3-18.43-45.46-53.42-45.46h-51.78v138.18h32.17v-47.36h19.61c30.25 0 53.42-15.95 53.42-45.36zM297.94 325L347 186.78h-31.09L268 325zm106.52-138.22h-31.09L325.46 325h29.94z\" fill=\"currentColor\"></path>";
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 };