@hyper.fun/fa-award
Version:
👉 https://hyper.fun/c/fa-award/1.3.0
93 lines (87 loc) • 4.48 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 384 512"]];
const svgHtml = "<path d=\"M97.12 362.63c-8.69-8.69-4.16-6.24-25.12-11.85c-9.51-2.55-17.87-7.45-25.43-13.32L1.2 448.7c-4.39 10.77 3.81 22.47 15.43 22.03l52.69-2.01L105.56 507c8 8.44 22.04 5.81 26.43-4.96l52.05-127.62c-10.84 6.04-22.87 9.58-35.31 9.58c-19.5 0-37.82-7.59-51.61-21.37zM382.8 448.7l-45.37-111.24c-7.56 5.88-15.92 10.77-25.43 13.32c-21.07 5.64-16.45 3.18-25.12 11.85c-13.79 13.78-32.12 21.37-51.62 21.37c-12.44 0-24.47-3.55-35.31-9.58L252 502.04c4.39 10.77 18.44 13.4 26.43 4.96l36.25-38.28l52.69 2.01c11.62.44 19.82-11.27 15.43-22.03zM263 340c15.28-15.55 17.03-14.21 38.79-20.14c13.89-3.79 24.75-14.84 28.47-28.98c7.48-28.4 5.54-24.97 25.95-45.75c10.17-10.35 14.14-25.44 10.42-39.58c-7.47-28.38-7.48-24.42 0-52.83c3.72-14.14-.25-29.23-10.42-39.58c-20.41-20.78-18.47-17.36-25.95-45.75c-3.72-14.14-14.58-25.19-28.47-28.98c-27.88-7.61-24.52-5.62-44.95-26.41c-10.17-10.35-25-14.4-38.89-10.61c-27.87 7.6-23.98 7.61-51.9 0c-13.89-3.79-28.72.25-38.89 10.61c-20.41 20.78-17.05 18.8-44.94 26.41c-13.89 3.79-24.75 14.84-28.47 28.98c-7.47 28.39-5.54 24.97-25.95 45.75c-10.17 10.35-14.15 25.44-10.42 39.58c7.47 28.36 7.48 24.4 0 52.82c-3.72 14.14.25 29.23 10.42 39.59c20.41 20.78 18.47 17.35 25.95 45.75c3.72 14.14 14.58 25.19 28.47 28.98C104.6 325.96 106.27 325 121 340c13.23 13.47 33.84 15.88 49.74 5.82a39.676 39.676 0 0 1 42.53 0c15.89 10.06 36.5 7.65 49.73-5.82zM97.66 175.96c0-53.03 42.24-96.02 94.34-96.02s94.34 42.99 94.34 96.02s-42.24 96.02-94.34 96.02s-94.34-42.99-94.34-96.02z\" 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 };