UNPKG

vue-unicons

Version:

1000+ Pixel-perfect svg icons for your next project as Vue components

2 lines (1 loc) 3.15 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["vue-unicons"]={},e.vue)}(this,(function(e,t){"use strict";function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e))&&"[object Arguments]"!==Object.prototype.toString.call(e))return;var n=[],i=!0,o=!1,r=void 0;try{for(var l,a=e[Symbol.iterator]();!(i=(l=a.next()).done)&&(n.push(l.value),!t||n.length!==t);i=!0);}catch(e){o=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(o)throw r}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var i={name:"Unicon",inheritAttrs:!1,props:{name:{type:String,default:""},iconStyle:{type:String,default:"line"},width:{type:[String,Number],default:24},height:{type:[String,Number],default:24},fill:{type:String,default:"inherit"},hoverFill:{type:String,default:null},viewBox:{type:String,default:"0 0 24 24"}},lib:[],add(e){Array.isArray(e)?this.lib=e:this.lib.push(e)},data(){return{localFill:this.fill}},computed:{icon(){const e=this.$options.lib.find((e=>e.name===this.name&&e.style===this.iconStyle));return e?e.path:void console.error(`Name '${this.name}' of the icon is not correct`)}},watch:{fill(e){this.localFill=e}},methods:{onHover(){this.hoverFill&&(this.localFill=this.hoverFill)},onLeave(){this.hoverFill&&(this.localFill=this.fill)}}};const o={class:"unicon"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.unicon {\n display: inline-block;\n}\n.unicon svg {\n -webkit-transition: 0.2s all;\n transition: 0.2s all;\n}\n.uim-primary {\n opacity: 1;\n}\n.uim-secondary {\n opacity: 0.7;\n}\n.uim-tertiary {\n opacity: 0.5;\n}\n.uim-quaternary {\n opacity: 0.25;\n}\n.uim-quinary {\n opacity: 0;\n}\n"),i.render=function(e,n,i,r,l,a){return t.openBlock(),t.createBlock(t.Fragment,null,[t.createCommentVNode(" eslint-disable vue/no-v-html "),t.createVNode("div",o,[(t.openBlock(),t.createBlock("svg",t.mergeProps({xmlns:"http://www.w3.org/2000/svg",width:i.width,height:i.height,viewBox:i.viewBox,fill:l.localFill},e.$attrs,{onClick:n[1]||(n[1]=t=>e.$emit("click")),onMouseover:n[2]||(n[2]=(...e)=>a.onHover&&a.onHover(...e)),onMouseout:n[3]||(n[3]=(...e)=>a.onLeave&&a.onLeave(...e)),innerHTML:a.icon}),null,16,["width","height","viewBox","fill","innerHTML"]))])],2112)},i.__file="src/components/Unicon.vue";var r={install:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.component(i.name,i);for(var o=0,r=Object.entries(t);o<r.length;o++){var l=n(r[o],2),a=l[0],c=l[1];i.props[a]&&(i.props[a].default=c)}},add:function(e){i.add(e)}};e.Unicon=i,e.default=r,Object.defineProperty(e,"__esModule",{value:!0})}));