@hyper.fun/fa-pied-piper
Version:
👉 https://hyper.fun/c/fa-pied-piper/1.3.0
93 lines (87 loc) • 3.55 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 480 512"]];
const svgHtml = "<path d=\"M455.93 23.2c-26.7 6.8-68.14 28.49-114.58 67.46A206 206 0 0 0 240 64C125.13 64 32 157.12 32 272s93.13 208 208 208s208-93.13 208-208a207.25 207.25 0 0 0-58.75-144.81a155.35 155.35 0 0 0-17 27.4A176.16 176.16 0 0 1 417.1 272c0 97.66-79.44 177.11-177.09 177.11a175.81 175.81 0 0 1-87.63-23.4c82.94-107.33 150.79-37.77 184.31-226.65c5.79-32.62 28-94.26 126.23-160.18c8.08-5.43 2.43-18.08-6.99-15.68zM125 406.4A176.66 176.66 0 0 1 62.9 272c0-97.66 79.45-177.1 177.1-177.1a174 174 0 0 1 76.63 17.75C250.64 174.76 189.77 265.52 125 406.4z\" 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 };