@hyper.fun/fa-user-secret
Version:
👉 https://hyper.fun/c/fa-user-secret/1.3.0
93 lines (87 loc) • 3.86 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=\"M383.9 308.3l23.9-62.6c4-10.5-3.7-21.7-15-21.7h-58.5c11-18.9 17.8-40.6 17.8-64v-.3c39.2-7.8 64-19.1 64-31.7c0-13.3-27.3-25.1-70.1-33c-9.2-32.8-27-65.8-40.6-82.8c-9.5-11.9-25.9-15.6-39.5-8.8l-27.6 13.8c-9 4.5-19.6 4.5-28.6 0L182.1 3.4c-13.6-6.8-30-3.1-39.5 8.8c-13.5 17-31.4 50-40.6 82.8c-42.7 7.9-70 19.7-70 33c0 12.6 24.8 23.9 64 31.7v.3c0 23.4 6.8 45.1 17.8 64H56.3c-11.5 0-19.2 11.7-14.7 22.3l25.8 60.2C27.3 329.8 0 372.7 0 422.4v44.8C0 491.9 20.1 512 44.8 512h358.4c24.7 0 44.8-20.1 44.8-44.8v-44.8c0-48.4-25.8-90.4-64.1-114.1zM176 480l-41.6-192l49.6 32l24 40l-32 120zm96 0l-32-120l24-40l49.6-32L272 480zm41.7-298.5c-3.9 11.9-7 24.6-16.5 33.4c-10.1 9.3-48 22.4-64-25c-2.8-8.4-15.4-8.4-18.3 0c-17 50.2-56 32.4-64 25c-9.5-8.8-12.7-21.5-16.5-33.4c-.8-2.5-6.3-5.7-6.3-5.8v-10.8c28.3 3.6 61 5.8 96 5.8s67.7-2.1 96-5.8v10.8c-.1.1-5.6 3.2-6.4 5.8z\" 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 };