fix: rename the Icon component to IconifyIcon to prevent name conflicts and fix type issues (#4704)

This commit is contained in:
Vben 2024-10-21 20:14:25 +08:00 committed by GitHub
parent 88d2b3e569
commit 1b172b0329
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 74 additions and 54 deletions

View File

@ -57,6 +57,7 @@ const tableData = [
<ElCard class="mb-5">
<template #header> 按钮 </template>
<ElSpace>
<ElButton text>Text</ElButton>
<ElButton>Default</ElButton>
<ElButton type="primary"> Primary </ElButton>
<ElButton type="info"> Info </ElButton>

View File

@ -68,7 +68,7 @@ async function initComponentAdapter() {
DatePicker: NDatePicker,
// 自定义默认按钮
DefaultButton: (props, { attrs, slots }) => {
return h(NButton, { ...props, attrs, type: 'info' }, slots);
return h(NButton, { ...props, attrs, type: 'default' }, slots);
},
// 自定义主要按钮
PrimaryButton: (props, { attrs, slots }) => {

View File

@ -333,6 +333,8 @@ export interface ActionButtonOptions {
show?: boolean;
/** 按钮文本 */
text?: string;
/** 任意属性 */
[key: string]: any;
}
```

View File

@ -60,8 +60,8 @@ function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
rollupOptions: {
output: {
assetFileNames: '[ext]/[name]-[hash].[ext]',
chunkFileNames: 'js/[name]-[hash].mjs',
entryFileNames: 'jse/index-[name]-[hash].mjs',
chunkFileNames: 'js/[name]-[hash].js',
entryFileNames: 'jse/index-[name]-[hash].js',
},
},
target: 'es2015',

View File

@ -58,7 +58,7 @@
/* Used for accents such as hover effects on <DropdownMenuItem>, <SelectItem>...etc */
--accent: 216 5% 19%;
--accent-lighter: 216 5% 11%;
--accent-lighter: 216 5% 12%;
--accent-hover: 216 5% 24%;
--accent-foreground: 0 0% 98%;

View File

@ -2,4 +2,6 @@ export { default as EmptyIcon } from './components/empty.vue';
export * from './create-icon';
export * from './lucide';
export * from '@iconify/vue';
export type { IconifyIcon as IconifyIconStructure } from '@iconify/vue';
export { addCollection, addIcon, Icon as IconifyIcon } from '@iconify/vue';

View File

@ -0,0 +1,9 @@
import { TinyColor } from '@ctrl/tinycolor';
export function isDarkColor(color: string) {
return new TinyColor(color).isDark();
}
export function isLightColor(color: string) {
return new TinyColor(color).isLight();
}

View File

@ -1,2 +1,3 @@
export * from './color';
export * from './convert';
export * from './generator';

View File

@ -289,6 +289,7 @@ export interface FormRenderProps<
}
export interface ActionButtonOptions extends VbenButtonProps {
[key: string]: any;
content?: string;
show?: boolean;
}

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { type Component, computed } from 'vue';
import { Icon, IconDefault } from '@vben-core/icons';
import { IconDefault, IconifyIcon } from '@vben-core/icons';
import {
isFunction,
isHttpUrl,
@ -28,6 +28,6 @@ const isComponent = computed(() => {
<template>
<component :is="icon as Component" v-if="isComponent" v-bind="$attrs" />
<img v-else-if="isRemoteIcon" :src="icon as string" v-bind="$attrs" />
<Icon v-else-if="icon" v-bind="$attrs" :icon="icon as string" />
<IconifyIcon v-else-if="icon" v-bind="$attrs" :icon="icon as string" />
<IconDefault v-else-if="fallback" v-bind="$attrs" />
</template>

View File

@ -217,12 +217,13 @@ export function useElementPlusDesignTokens() {
'--el-color-info-light-8': border,
'--el-color-info-light-9': getCssVariableValue('--info'), // getCssVariableValue('--secondary'),
'--el-color-primary': getCssVariableValue('--primary-500'),
'--el-color-primary-dark-2': getCssVariableValue('--primary'),
'--el-color-primary-light-3': getCssVariableValue('--primary-400'),
'--el-color-primary-light-5': getCssVariableValue('--primary-300'),
'--el-color-primary-light-7': getCssVariableValue('--primary-200'),
'--el-color-primary-light-7': isDark.value
? border
: getCssVariableValue('--primary-200'),
'--el-color-primary-light-8': isDark.value
? border
: getCssVariableValue('--primary-100'),
@ -268,6 +269,7 @@ export function useElementPlusDesignTokens() {
'--el-text-color-regular': getCssVariableValue('--foreground'),
};
updateCSSVariables(variables, `__vben_design_styles__`);
},
{ immediate: true },

View File

@ -1,2 +1,2 @@
export * from './iconify/index';
export * from './svg/index';
export * from './iconify/index.js';
export * from './svg/index.js';

View File

@ -1,6 +1,6 @@
import { createIconifyIcon } from '@vben-core/icons';
import './load';
import './load.js';
const SvgAvatar1Icon = createIconifyIcon('svg:avatar-1');
const SvgAvatar2Icon = createIconifyIcon('svg:avatar-2');

View File

@ -1,4 +1,6 @@
import { addIcon, type IconifyIcon } from '@vben-core/icons';
import type { IconifyIconStructure } from '@vben-core/icons';
import { addIcon } from '@vben-core/icons';
let loaded = false;
if (!loaded) {
@ -6,7 +8,7 @@ if (!loaded) {
loaded = true;
}
function parseSvg(svgData: string): IconifyIcon {
function parseSvg(svgData: string): IconifyIconStructure {
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(svgData, 'image/svg+xml');
const svgElement = xmlDoc.documentElement;

66
pnpm-lock.yaml generated
View File

@ -31,8 +31,8 @@ catalogs:
specifier: ^9.0.3
version: 9.0.3
'@iconify/json':
specifier: ^2.2.261
version: 2.2.261
specifier: ^2.2.262
version: 2.2.262
'@iconify/tailwind':
specifier: ^1.1.3
version: 1.1.3
@ -73,8 +73,8 @@ catalogs:
specifier: ^5.59.13
version: 5.59.13
'@tanstack/vue-store':
specifier: ^0.5.5
version: 0.5.5
specifier: ^0.5.6
version: 0.5.6
'@types/archiver':
specifier: ^6.0.2
version: 6.0.2
@ -211,7 +211,7 @@ catalogs:
specifier: ^9.13.0
version: 9.13.0
eslint-config-turbo:
specifier: ^2.2.0
specifier: ^2.2.1
version: 2.2.1
eslint-plugin-command:
specifier: ^0.2.6
@ -253,8 +253,8 @@ catalogs:
specifier: ^0.5.4
version: 0.5.4
eslint-plugin-vue:
specifier: ^9.29.0
version: 9.29.0
specifier: ^9.29.1
version: 9.29.1
execa:
specifier: ^9.4.1
version: 9.4.1
@ -415,7 +415,7 @@ catalogs:
specifier: ^0.1.0
version: 0.1.0
turbo:
specifier: ^2.2.0
specifier: ^2.2.1
version: 2.2.1
typescript:
specifier: ^5.6.3
@ -475,11 +475,11 @@ catalogs:
specifier: ^2.1.6
version: 2.1.6
vxe-pc-ui:
specifier: ^4.2.24
version: 4.2.24
specifier: ^4.2.26
version: 4.2.26
vxe-table:
specifier: ^4.7.86
version: 4.7.92
specifier: ^4.7.93
version: 4.7.93
watermark-js-plus:
specifier: ^1.5.7
version: 1.5.7
@ -938,7 +938,7 @@ importers:
version: 0.5.4(@typescript-eslint/eslint-plugin@8.10.0(@typescript-eslint/parser@8.10.0(eslint@9.13.0(jiti@2.3.3))(typescript@5.6.3))(eslint@9.13.0(jiti@2.3.3))(typescript@5.6.3))(eslint@9.13.0(jiti@2.3.3))(typescript@5.6.3)(vitest@2.1.3(@types/node@22.7.7)(happy-dom@15.7.4)(less@4.2.0)(sass@1.79.5)(terser@5.36.0))
eslint-plugin-vue:
specifier: 'catalog:'
version: 9.29.0(eslint@9.13.0(jiti@2.3.3))
version: 9.29.1(eslint@9.13.0(jiti@2.3.3))
globals:
specifier: 'catalog:'
version: 15.11.0
@ -1051,7 +1051,7 @@ importers:
dependencies:
'@iconify/json':
specifier: 'catalog:'
version: 2.2.261
version: 2.2.262
'@iconify/tailwind':
specifier: 'catalog:'
version: 1.1.3
@ -1208,7 +1208,7 @@ importers:
version: 4.1.0
'@tanstack/vue-store':
specifier: 'catalog:'
version: 0.5.5(vue@3.5.12(typescript@5.6.3))
version: 0.5.6(vue@3.5.12(typescript@5.6.3))
'@vue/shared':
specifier: 'catalog:'
version: 3.5.12
@ -1634,10 +1634,10 @@ importers:
version: 3.5.12(typescript@5.6.3)
vxe-pc-ui:
specifier: 'catalog:'
version: 4.2.24(vue@3.5.12(typescript@5.6.3))
version: 4.2.26(vue@3.5.12(typescript@5.6.3))
vxe-table:
specifier: 'catalog:'
version: 4.7.92(vue@3.5.12(typescript@5.6.3))
version: 4.7.93(vue@3.5.12(typescript@5.6.3))
packages/effects/request:
dependencies:
@ -3876,8 +3876,8 @@ packages:
'@iconify-json/vscode-icons@1.2.2':
resolution: {integrity: sha512-bTpT0HJDRqGkxQv8oiETNHLEnBZpnA1QaRD35CQyO7M7qgWVLx2xwn/lK6e4waojmlPC3ckMBx3WFIUUn0/Jdg==}
'@iconify/json@2.2.261':
resolution: {integrity: sha512-uUm8Svulz5aRRF0X+r2/UG5P0xcUCGOGVmAFJ/ZANx29wqE79PvGCYXHuznNC0h8+UW1fnvprj7FmgJELvMYZw==}
'@iconify/json@2.2.262':
resolution: {integrity: sha512-h7zMbLxsKohKXvf2Lpq6Xob7dxkqXxrUVR58ZvZBgCSrHcE69QJmcFG/KaAwM1eGuKToWvgPWeb1xE6zy7juqg==}
'@iconify/tailwind@1.1.3':
resolution: {integrity: sha512-SfyeT+2b/aKWA6DjwdevXdLUqaEqJ5xWTegD92KItaWc47IYsGuqrt/GOz4dJCPcTVCrsUjlvMpy8cNd+uV5nQ==}
@ -4498,8 +4498,8 @@ packages:
'@vue/composition-api':
optional: true
'@tanstack/vue-store@0.5.5':
resolution: {integrity: sha512-j+CDrxVhtQQNOjWzLmCqJeDwmmTAQGvEaNbLr1uPJ9rxJITodJtFNdBFj7l+Nd5o34v2ayEv64Ugh6+1BtuGNg==}
'@tanstack/vue-store@0.5.6':
resolution: {integrity: sha512-gMRicUGGWTN5QGlv9yBKWaAiHTmbH5DX0vozEblhRGYnBfFBwr51l3uzYndtilsFYfZvphEyngKTRdUb5KQ1OQ==}
peerDependencies:
'@vue/composition-api': ^1.2.1
vue: ^3.5.12
@ -6351,8 +6351,8 @@ packages:
vitest:
optional: true
eslint-plugin-vue@9.29.0:
resolution: {integrity: sha512-hamyjrBhNH6Li6R1h1VF9KHfshJlKgKEg3ARbGTn72CMNDSMhWbgC7NdkRDEh25AFW+4SDATzyNM+3gWuZii8g==}
eslint-plugin-vue@9.29.1:
resolution: {integrity: sha512-MH/MbVae4HV/tM8gKAVWMPJbYgW04CK7SuzYRrlNERpxbO0P3+Zdsa2oAcFBW6xNu7W6lIkGOsFAMCRTYmrlWQ==}
engines: {node: ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.2.0 || ^7.0.0 || ^8.0.0 || ^9.0.0
@ -10198,11 +10198,11 @@ packages:
peerDependencies:
vue: ^3.5.12
vxe-pc-ui@4.2.24:
resolution: {integrity: sha512-ARriApnY+xuJTVAwmLgV47tZry0Fi6IbRzkxgP4kKbWJ8YFoqfU+Abe6fmhQsftRVpRBIiFwNz8SzBfX90xAWQ==}
vxe-pc-ui@4.2.26:
resolution: {integrity: sha512-dwPN0r0X+C6fr8ve0Tug19RZjxcdWQRfYy3V2fzqOoz+t2eB2F085/Pn7+Zpjps7mxajJCsgfQKSakN9tOKTmg==}
vxe-table@4.7.92:
resolution: {integrity: sha512-yzLggd7Xjl5HPd22NknPDPEXn8pec/fB8QbxOWdlMTbvRGA7586whG01gk/Exf6e7HJuQky4kt4gw9LrQVrzGQ==}
vxe-table@4.7.93:
resolution: {integrity: sha512-LkL/VWenJFGrPRG3BZdbThOJd3WGv1IXLfxVmaeWb8Oyj9LG902o9FP8GNQWFbZ+8Kj5SCUaUUF5S3pvbPXN+g==}
warning@4.0.3:
resolution: {integrity: sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==}
@ -12519,7 +12519,7 @@ snapshots:
dependencies:
'@iconify/types': 2.0.0
'@iconify/json@2.2.261':
'@iconify/json@2.2.262':
dependencies:
'@iconify/types': 2.0.0
pathe: 1.1.2
@ -13352,7 +13352,7 @@ snapshots:
vue: 3.5.12(typescript@5.6.3)
vue-demi: 0.14.10(vue@3.5.12(typescript@5.6.3))
'@tanstack/vue-store@0.5.5(vue@3.5.12(typescript@5.6.3))':
'@tanstack/vue-store@0.5.6(vue@3.5.12(typescript@5.6.3))':
dependencies:
'@tanstack/store': 0.5.5
vue: 3.5.12(typescript@5.6.3)
@ -15606,7 +15606,7 @@ snapshots:
- supports-color
- typescript
eslint-plugin-vue@9.29.0(eslint@9.13.0(jiti@2.3.3)):
eslint-plugin-vue@9.29.1(eslint@9.13.0(jiti@2.3.3)):
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@9.13.0(jiti@2.3.3))
eslint: 9.13.0(jiti@2.3.3)
@ -19787,15 +19787,15 @@ snapshots:
vooks: 0.2.12(vue@3.5.12(typescript@5.6.3))
vue: 3.5.12(typescript@5.6.3)
vxe-pc-ui@4.2.24(vue@3.5.12(typescript@5.6.3)):
vxe-pc-ui@4.2.26(vue@3.5.12(typescript@5.6.3)):
dependencies:
'@vxe-ui/core': 4.0.16(vue@3.5.12(typescript@5.6.3))
transitivePeerDependencies:
- vue
vxe-table@4.7.92(vue@3.5.12(typescript@5.6.3)):
vxe-table@4.7.93(vue@3.5.12(typescript@5.6.3)):
dependencies:
vxe-pc-ui: 4.2.24(vue@3.5.12(typescript@5.6.3))
vxe-pc-ui: 4.2.26(vue@3.5.12(typescript@5.6.3))
transitivePeerDependencies:
- vue

View File

@ -22,7 +22,7 @@ catalog:
'@ctrl/tinycolor': ^4.1.0
'@eslint/js': ^9.13.0
'@faker-js/faker': ^9.0.3
'@iconify/json': ^2.2.261
'@iconify/json': ^2.2.262
'@iconify/tailwind': ^1.1.3
'@iconify/vue': ^4.1.2
'@intlify/core-base': ^10.0.4
@ -36,7 +36,7 @@ catalog:
'@tailwindcss/nesting': 0.0.0-insiders.565cd3e
'@tailwindcss/typography': ^0.5.15
'@tanstack/vue-query': ^5.59.13
'@tanstack/vue-store': ^0.5.5
'@tanstack/vue-store': ^0.5.6
'@types/archiver': ^6.0.2
'@types/chalk': ^2.2.0
'@types/eslint': ^9.6.1
@ -84,7 +84,7 @@ catalog:
echarts: ^5.5.1
element-plus: ^2.8.6
eslint: ^9.13.0
eslint-config-turbo: ^2.2.0
eslint-config-turbo: ^2.2.1
eslint-plugin-command: ^0.2.6
eslint-plugin-eslint-comments: ^3.2.0
eslint-plugin-import-x: ^4.3.1
@ -98,7 +98,7 @@ catalog:
eslint-plugin-unicorn: ^56.0.0
eslint-plugin-unused-imports: ^4.1.4
eslint-plugin-vitest: ^0.5.4
eslint-plugin-vue: ^9.29.0
eslint-plugin-vue: ^9.29.1
execa: ^9.4.1
find-up: ^7.0.0
get-port: ^7.1.0
@ -153,7 +153,7 @@ catalog:
tailwindcss: ^3.4.14
tailwindcss-animate: ^1.0.7
theme-colors: ^0.1.0
turbo: ^2.2.0
turbo: ^2.2.1
typescript: ^5.6.3
unbuild: ^2.0.0
unplugin-element-plus: ^0.8.0
@ -174,8 +174,8 @@ catalog:
vue-i18n: ^10.0.4
vue-router: ^4.4.5
vue-tsc: ^2.1.6
vxe-pc-ui: ^4.2.24
vxe-table: ^4.7.86
vxe-pc-ui: ^4.2.26
vxe-table: ^4.7.93
watermark-js-plus: ^1.5.7
zod: ^3.23.8
zod-defaults: ^0.1.3