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AAI,WAAW,EAAf;AAEA;AACA,YAAI,KAAK,QAAT,EAAmB;AACjB,uBAAW,KAAK,QAAL,CAAc,WAAd,IACT,KAAK,QAAL,CAAc,SADL,IAET,QAFF;AAIA;AACA;AACA,mBAAO,KAAK,QAAL,CAAc,WAArB;AACA,mBAAO,KAAK,QAAL,CAAc,SAArB;AACD;AAED,eAAO,EAAE,KAAF,EAAS,IAAT,EAAe,WAAW,CAAC,QAAD,CAAX,GAAwB,QAAvC,CAAP;AACD;AAvBuB,CAAX,CAAf","sourcesContent":["import '../../stylus/components/_icons.styl'\n// Mixins\nimport Colorable from '../../mixins/colorable'\nimport Sizeable from '../../mixins/sizeable'\nimport Themeable from '../../mixins/themeable'\n// Util\nimport { convertToUnit, keys, remapInternalIcon } from '../../util/helpers'\n// Types\nimport Vue, { CreateElement, VNode, VNodeChildren, VNodeData } from 'vue'\nimport mixins from '../../util/mixins'\nimport { VuetifyIcon, VuetifyIconComponent } from 'vuetify'\n\nenum SIZE_MAP {\n small = '16px',\n default = '24px',\n medium = '28px',\n large = '36px',\n xLarge = '40px'\n}\n\nfunction isFontAwesome5 (iconType: string): boolean {\n return ['fas', 'far', 'fal', 'fab'].some(val => iconType.includes(val))\n}\n\nconst VIcon = mixins(\n Colorable,\n Sizeable,\n Themeable\n /* @vue/component */\n).extend({\n name: 'v-icon',\n\n props: {\n disabled: Boolean,\n left: Boolean,\n right: Boolean\n },\n\n methods: {\n getIcon (): VuetifyIcon {\n let iconName = ''\n if (this.$slots.default) iconName = this.$slots.default[0].text!.trim()\n\n return remapInternalIcon(this, iconName)\n },\n getSize (): string | undefined {\n const sizes = {\n small: this.small,\n medium: this.medium,\n large: this.large,\n xLarge: this.xLarge\n }\n\n const explicitSize = keys(sizes).find(key => sizes[key])\n\n return (explicitSize && SIZE_MAP[explicitSize]) || convertToUnit(this.size)\n },\n // Component data for both font and svg icon.\n getDefaultData (): VNodeData {\n const data: VNodeData = {\n staticClass: 'v-icon',\n class: {\n 'v-icon--disabled': this.disabled,\n 'v-icon--left': this.left,\n 'v-icon--link': this.$listeners.click || this.$listeners['!click'],\n 'v-icon--right': this.right\n },\n attrs: {\n 'aria-hidden': true,\n ...this.$attrs\n },\n on: this.$listeners\n }\n\n return data\n },\n applyColors (data: VNodeData): void {\n data.class = { ...data.class, ...this.themeClasses }\n this.setTextColor(this.color, data)\n },\n renderFontIcon (icon: string, h: CreateElement): VNode {\n const newChildren: VNodeChildren = []\n const data = this.getDefaultData()\n\n let iconType = 'material-icons'\n // Material Icon delimiter is _\n // https://material.io/icons/\n const delimiterIndex = icon.indexOf('-')\n const isMaterialIcon = delimiterIndex <= -1\n\n if (isMaterialIcon) {\n // Material icon uses ligatures.\n newChildren.push(icon)\n } else {\n iconType = icon.slice(0, delimiterIndex)\n if (isFontAwesome5(iconType)) iconType = ''\n }\n\n data.class[iconType] = true\n data.class[icon] = !isMaterialIcon\n\n const fontSize = this.getSize()\n if (fontSize) data.style = { fontSize }\n\n this.applyColors(data)\n\n return h('i', data, newChildren)\n },\n renderSvgIcon (icon: VuetifyIconComponent, h: CreateElement): VNode {\n const data = this.getDefaultData()\n data.class['v-icon--is-component'] = true\n\n const size = this.getSize()\n if (size) {\n data.style = {\n fontSize: size,\n height: size\n }\n }\n\n this.applyColors(data)\n\n const component = icon.component\n data.props = icon.props\n data.nativeOn = data.on\n\n return h(component, data)\n }\n },\n\n render (h: CreateElement): VNode {\n const icon = this.getIcon()\n\n if (typeof icon === 'string') {\n return this.renderFontIcon(icon, h)\n }\n\n return this.renderSvgIcon(icon, h)\n }\n})\n\nexport default Vue.extend({\n name: 'v-icon',\n\n $_wrapperFor: VIcon,\n\n functional: true,\n\n render (h, { data, children }): VNode {\n let iconName = ''\n\n // Support usage of v-text and v-html\n if (data.domProps) {\n iconName = data.domProps.textContent ||\n data.domProps.innerHTML ||\n iconName\n\n // Remove nodes so it doesn't\n // overwrite our changes\n delete data.domProps.textContent\n delete data.domProps.innerHTML\n }\n\n return h(VIcon, data, iconName ? [iconName] : children)\n }\n})\n"],"sourceRoot":""}
|