From 8b2e5228a3ab1be2f3df18c1a399fe77da7a3a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Holeczek?= Date: Wed, 4 Aug 2021 13:39:29 +0200 Subject: [PATCH] release: v2.0.0-alpha.1 --- package.json | 6 ++++-- src/CIcon.ts | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 17b71f5..2ffe61a 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,7 @@ { "name": "@coreui/icons-vue", - "version": "2.0.0-alpha.0", + "version": "2.0.0-alpha.1", "license": "MIT", - "sideEffects": "src/CIcon.vue", "main": "dist/index.js", "module": "dist/index.es.js", "jsnext:main": "dist/index.es.js", @@ -45,6 +44,9 @@ "build": "rollup -c", "lint": "eslint 'src/**/*.{js,ts,tsx}'" }, + "dependencies": { + "vue": "^3.0.10" + }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^4.28.5", "@typescript-eslint/parser": "^4.28.5", diff --git a/src/CIcon.ts b/src/CIcon.ts index 82620a5..8c29b4a 100644 --- a/src/CIcon.ts +++ b/src/CIcon.ts @@ -57,7 +57,6 @@ const CIcon = defineComponent({ }, }, setup(props, { attrs }) { - const icons: any = inject('icons') console.log(icons) @@ -98,25 +97,30 @@ const CIcon = defineComponent({ const viewBox = attrs.viewBox || `0 0 ${scale}` - // const size = () => { - // const addCustom = !props.size && (attrs.width || attrs.height) - // return props.size === 'custom' || addCustom ? 'custom-size' : props.size - // } - const classNames = props.customClasses || ['icon', { [`icon-${props.size}`]: props.size }] + const size = () => { + const addCustom = !props.size && (attrs.width || attrs.height) + return props.size === 'custom' || addCustom ? 'custom-size' : props.size + } + + const classNames = (() => { + return props.customClasses || ['icon', { [`icon-${size()}`]: size() }] + })() return () => [ !props.src && !props.use && h('svg', { + ...attrs, xmlns: 'http://www.w3.org/2000/svg', class: classNames, viewBox: viewBox, - innerHTML: `${titleCode} + ${iconCode}`, + innerHTML: `${titleCode}${iconCode}`, role: 'img', }), props.src && !props.use && h('img', { + ...attrs, class: classNames, src: props.src, role: 'img', @@ -126,6 +130,7 @@ const CIcon = defineComponent({ h( 'svg', { + ...attrs, xmlns: 'http://www.w3.org/2000/svg', class: classNames, role: 'img',