UNPKG

@hyper.fun/carbon-icon-calibrate

Version:

👉 https://hyper.fun/c/carbon-icon-calibrate/1.3.0

93 lines (87 loc) • 3.52 kB
/******/ // 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 32 32"]]; const svgHtml = "<path d=\"M28.83 21.17L25 17.37l.67-.67a1 1 0 0 0 0-1.41l-6-6a1 1 0 0 0-1.41 0l-.79.79l-6.76-6.79a1 1 0 0 0-1.41 0l-4 4l-.12.15l-4 6a1 1 0 0 0 .12 1.26l3 3a1 1 0 0 0 1.42 0L10 13.41l2.09 2.09l-4.8 4.79a1 1 0 0 0 0 1.41l2 2a1 1 0 0 0 .71.3a1 1 0 0 0 .52-.15l4.33-2.6l2.44 2.45a1 1 0 0 0 1.41 0l.67-.7l3.79 3.83a4 4 0 0 0 5.66-5.66zM10 10.58l-5 5l-1.71-1.71l3.49-5.24L10 5.41l6.09 6.09l-2.59 2.58zm8 11l-2.84-2.84l-5 3l-.74-.74L19 11.41L23.59 16zm9.42 3.83a2 2 0 0 1-2.83 0l-3.8-3.79l2.83-2.83l3.8 3.79a2 2 0 0 1 0 2.83z\" 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 };