UNPKG

vue-unicons

Version:

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

2 lines (1 loc) 2.86 kB
import{openBlock as t,createBlock as e,Fragment as n,createCommentVNode as i,createVNode as o,mergeProps as r}from"vue";function l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t))&&"[object Arguments]"!==Object.prototype.toString.call(t))return;var n=[],i=!0,o=!1,r=void 0;try{for(var l,a=t[Symbol.iterator]();!(i=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);i=!0);}catch(t){o=!0,r=t}finally{try{i||null==a.return||a.return()}finally{if(o)throw r}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var a={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(t){Array.isArray(t)?this.lib=t:this.lib.push(t)},data(){return{localFill:this.fill}},computed:{icon(){const t=this.$options.lib.find((t=>t.name===this.name&&t.style===this.iconStyle));return t?t.path:void console.error(`Name '${this.name}' of the icon is not correct`)}},watch:{fill(t){this.localFill=t}},methods:{onHover(){this.hoverFill&&(this.localFill=this.hoverFill)},onLeave(){this.hoverFill&&(this.localFill=this.fill)}}};const s={class:"unicon"};!function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"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=t:o.appendChild(document.createTextNode(t))}}("\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"),a.render=function(l,a,c,u,h,d){return t(),e(n,null,[i(" eslint-disable vue/no-v-html "),o("div",s,[(t(),e("svg",r({xmlns:"http://www.w3.org/2000/svg",width:c.width,height:c.height,viewBox:c.viewBox,fill:h.localFill},l.$attrs,{onClick:a[1]||(a[1]=t=>l.$emit("click")),onMouseover:a[2]||(a[2]=(...t)=>d.onHover&&d.onHover(...t)),onMouseout:a[3]||(a[3]=(...t)=>d.onLeave&&d.onLeave(...t)),innerHTML:d.icon}),null,16,["width","height","viewBox","fill","innerHTML"]))])],2112)},a.__file="src/components/Unicon.vue";var c={install:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.component(a.name,a);for(var n=0,i=Object.entries(e);n<i.length;n++){var o=l(i[n],2),r=o[0],s=o[1];a.props[r]&&(a.props[r].default=s)}},add:function(t){a.add(t)}};export default c;export{a as Unicon};