@hyper.fun/ionicons-game-controller
Version:
👉 https://hyper.fun/c/ionicons-game-controller/1.3.0
93 lines (87 loc) • 3.85 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 512 512"]];
const svgHtml = "<path d=\"M483.13 245.38C461.92 149.49 430 98.31 382.65 84.33A107.13 107.13 0 0 0 352 80c-13.71 0-25.65 3.34-38.28 6.88C298.5 91.15 281.21 96 256 96s-42.51-4.84-57.76-9.11C185.6 83.34 173.67 80 160 80a115.74 115.74 0 0 0-31.73 4.32c-47.1 13.92-79 65.08-100.52 161C4.61 348.54 16 413.71 59.69 428.83a56.62 56.62 0 0 0 18.64 3.22c29.93 0 53.93-24.93 70.33-45.34c18.53-23.1 40.22-34.82 107.34-34.82c59.95 0 84.76 8.13 106.19 34.82c13.47 16.78 26.2 28.52 38.9 35.91c16.89 9.82 33.77 12 50.16 6.37c25.82-8.81 40.62-32.1 44-69.24c2.57-28.48-1.39-65.89-12.12-114.37zM208 240h-32v32a16 16 0 0 1-32 0v-32h-32a16 16 0 0 1 0-32h32v-32a16 16 0 0 1 32 0v32h32a16 16 0 0 1 0 32zm84 4a20 20 0 1 1 20-20a20 20 0 0 1-20 20zm44 44a20 20 0 1 1 20-19.95A20 20 0 0 1 336 288zm0-88a20 20 0 1 1 20-20a20 20 0 0 1-20 20zm44 44a20 20 0 1 1 20-20a20 20 0 0 1-20 20z\" 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 };