diff --git a/build/generate/icon/index.ts b/build/generate/icon/index.ts
deleted file mode 100644
index 8d7ced5..0000000
--- a/build/generate/icon/index.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-import path from 'node:path'
-import fs from 'fs-extra'
-import inquirer from 'inquirer'
-import colors from 'picocolors'
-import pkg from '../../../package.json'
-
-async function generateIcon() {
- const dir = path.resolve(process.cwd(), 'node_modules/@iconify/json')
-
- const raw = await fs.readJSON(path.join(dir, 'collections.json'))
-
- const collections = Object.entries(raw).map(([id, v]) => ({
- ...(v as any),
- id,
- }))
-
- const choices = collections.map(item => ({ key: item.id, value: item.id, name: item.name }))
-
- inquirer
- .prompt([
- {
- type: 'list',
- name: 'useType',
- choices: [
- { key: 'local', value: 'local', name: 'Local' },
- { key: 'onLine', value: 'onLine', name: 'OnLine' },
- ],
- message: 'How to use icons?',
- },
- {
- type: 'list',
- name: 'iconSet',
- choices,
- message: 'Select the icon set that needs to be generated?',
- },
- {
- type: 'input',
- name: 'output',
- message: 'Select the icon set that needs to be generated?',
- default: 'src/components/Icon/data',
- },
- ])
- .then(async (answers) => {
- const { iconSet, output, useType } = answers
- const outputDir = path.resolve(process.cwd(), output)
- await fs.ensureDir(outputDir)
- const genCollections = collections.filter(item => [iconSet].includes(item.id))
- const prefixSet: string[] = []
- for (const info of genCollections) {
- const data = await fs.readJSON(path.join(dir, 'json', `${info.id}.json`))
- if (data) {
- const { prefix } = data
- const isLocal = useType === 'local'
- const icons = Object.keys(data.icons).map(item => `${isLocal ? `${prefix}:` : ''}${item}`)
-
- fs.writeFileSync(
- path.join(output, 'icons.data.ts'),
- `export default ${isLocal ? JSON.stringify(icons) : JSON.stringify({ prefix, icons })}`,
- )
- prefixSet.push(prefix)
- }
- }
- await fs.emptyDir(path.join(process.cwd(), 'node_modules/.vite'))
- console.log(`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]`)
- })
-}
-
-generateIcon()
diff --git a/build/vite/optimize.ts b/build/vite/optimize.ts
index 335b359..e40957c 100644
--- a/build/vite/optimize.ts
+++ b/build/vite/optimize.ts
@@ -22,7 +22,6 @@ const include = [
'echarts/renderers',
'@vueuse/core',
'@zxcvbn-ts/core',
- '@iconify/iconify',
'vue-json-pretty',
'ant-design-vue',
'ant-design-vue/es/style',
diff --git a/package.json b/package.json
index 9dc7ae7..238c530 100644
--- a/package.json
+++ b/package.json
@@ -32,13 +32,11 @@
"preview": "vite preview",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
- "prepare": "husky install",
- "gen:icon": "esno ./build/generate/icon/index.ts"
+ "prepare": "husky install"
},
"dependencies": {
"@ant-design/colors": "^7.0.2",
"@ant-design/icons-vue": "^7.0.1",
- "@iconify/iconify": "^3.1.1",
"@videojs-player/vue": "^1.0.0",
"@vue/runtime-core": "^3.3.8",
"@vueuse/core": "^10.6.1",
@@ -76,7 +74,6 @@
"@commitlint/cli": "^18.4.4",
"@commitlint/config-conventional": "^18.4.4",
"@iconify/json": "^2.2.164",
- "@purge-icons/generated": "^0.10.0",
"@types/codemirror": "^5.60.15",
"@types/crypto-js": "^4.2.1",
"@types/fs-extra": "^11.0.4",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 95481ee..57ed7dd 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -11,9 +11,6 @@ dependencies:
'@ant-design/icons-vue':
specifier: ^7.0.1
version: 7.0.1(vue@3.4.10)
- '@iconify/iconify':
- specifier: ^3.1.1
- version: 3.1.1
'@videojs-player/vue':
specifier: ^1.0.0
version: 1.0.0(@types/video.js@7.3.56)(video.js@7.21.5)(vue@3.4.10)
@@ -121,9 +118,6 @@ devDependencies:
'@iconify/json':
specifier: ^2.2.164
version: 2.2.168
- '@purge-icons/generated':
- specifier: ^0.10.0
- version: 0.10.0
'@types/codemirror':
specifier: ^5.60.15
version: 5.60.15
@@ -2051,6 +2045,7 @@ packages:
resolution: {integrity: sha512-1nemfyD/OJzh9ALepH7YfuuP8BdEB24Skhd8DXWh0hzcOxImbb1ZizSZkpCzAwSZSGcJFmscIBaBQu+yLyWaxQ==}
dependencies:
'@iconify/types': 2.0.0
+ dev: true
/@iconify/json@2.2.168:
resolution: {integrity: sha512-NuimrvW7/BfOK97Kx0YMWG8UMcqdfc0GZ0mZfewA90Qvl3+dchLmbyvNXnFraUFrrS8Luie3P6R0+3gHE9DnIA==}
@@ -2061,6 +2056,7 @@ packages:
/@iconify/types@2.0.0:
resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==}
+ dev: true
/@iconify/utils@2.1.14:
resolution: {integrity: sha512-9pKIntkbLbjVVFxH32td21Am3AGGJfyI2KY2d8yDQxkZe4BBZtufJI8NgcamFn8B5QKLU9ai2VMo8OEov8jAtw==}
diff --git a/src/components/Application/index.ts b/src/components/Application/index.ts
index d7ffa26..2c6090d 100644
--- a/src/components/Application/index.ts
+++ b/src/components/Application/index.ts
@@ -1,7 +1,6 @@
import appLogo from './src/AppLogo.vue'
import appProvider from './src/AppProvider.vue'
import appSearch from './src/search/AppSearch.vue'
-import appSizePicker from './src/AppSizePicker.vue'
import appLocalePicker from './src/AppLocalePicker.vue'
import appDarkModeToggle from './src/AppDarkModeToggle.vue'
import { withInstall } from '@/utils'
@@ -11,6 +10,5 @@ export { useAppProviderContext } from './src/useAppContext'
export const AppLogo = withInstall(appLogo)
export const AppProvider = withInstall(appProvider)
export const AppSearch = withInstall(appSearch)
-export const AppSizePicker = withInstall(appSizePicker)
export const AppLocalePicker = withInstall(appLocalePicker)
export const AppDarkModeToggle = withInstall(appDarkModeToggle)
diff --git a/src/components/Application/src/AppLocalePicker.vue b/src/components/Application/src/AppLocalePicker.vue
index d9ae5e6..401c60c 100644
--- a/src/components/Application/src/AppLocalePicker.vue
+++ b/src/components/Application/src/AppLocalePicker.vue
@@ -3,7 +3,6 @@ import { computed, ref, unref, watchEffect } from 'vue'
import type { LocaleType } from '@/types/config'
import type { DropMenu } from '@/components/Dropdown'
import { Dropdown } from '@/components/Dropdown'
-import { Icon } from '@/components/Icon'
import { useLocale } from '@/locales/useLocale'
import { localeList } from '@/settings/localeSetting'
@@ -58,7 +57,7 @@ function handleMenuEvent(menu: DropMenu) {
@menu-event="handleMenuEvent"
>
-
+
{{ getLocaleText }}
diff --git a/src/components/Application/src/AppSizePicker.vue b/src/components/Application/src/AppSizePicker.vue
deleted file mode 100644
index fc9103f..0000000
--- a/src/components/Application/src/AppSizePicker.vue
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
-
-
- {{ getSizeText }}
-
-
-
-
-
diff --git a/src/components/Application/src/search/AppSearchFooter.vue b/src/components/Application/src/search/AppSearchFooter.vue
index 2b44980..4b682f5 100644
--- a/src/components/Application/src/search/AppSearchFooter.vue
+++ b/src/components/Application/src/search/AppSearchFooter.vue
@@ -1,5 +1,4 @@
-
-
-
-
-
-
diff --git a/src/components/Application/src/search/AppSearchModal.vue b/src/components/Application/src/search/AppSearchModal.vue
index 13287be..012cd6f 100644
--- a/src/components/Application/src/search/AppSearchModal.vue
+++ b/src/components/Application/src/search/AppSearchModal.vue
@@ -3,7 +3,6 @@ import { computed, nextTick, ref, unref, watch } from 'vue'
import { SearchOutlined } from '@ant-design/icons-vue'
import AppSearchFooter from './AppSearchFooter.vue'
import { useMenuSearch } from './useMenuSearch'
-import { Icon } from '@/components/Icon'
import vClickOutside from '@/directives/clickOutside'
import { useDesign } from '@/hooks/web/useDesign'
import { useRefs } from '@/hooks/core/useRefs'
@@ -89,13 +88,13 @@ function handleClose() {
@click="handleEnter"
>
-
+
{{ item.name }}
-
+
diff --git a/src/components/Basic/src/BasicArrow.vue b/src/components/Basic/src/BasicArrow.vue
index 4445e0e..329730b 100644
--- a/src/components/Basic/src/BasicArrow.vue
+++ b/src/components/Basic/src/BasicArrow.vue
@@ -1,6 +1,5 @@
-
-
-
-
-
-
-
diff --git a/src/components/Icon/src/IconPicker.vue b/src/components/Icon/src/IconPicker.vue
index 0f71acc..74c2f30 100644
--- a/src/components/Icon/src/IconPicker.vue
+++ b/src/components/Icon/src/IconPicker.vue
@@ -3,9 +3,8 @@ import { ref, watch, watchEffect } from 'vue'
import { Empty, Input, Pagination, Popover } from 'ant-design-vue'
import { useDebounceFn } from '@vueuse/core'
import svgIcons from 'virtual:svg-icons-names'
-import iconsData from '../data/icons.data'
-import Icon from './Icon.vue'
import SvgIcon from './SvgIcon.vue'
+import { getIcons } from './icons'
import { useDesign } from '@/hooks/web/useDesign'
import { ScrollContainer } from '@/components/Container'
@@ -31,18 +30,6 @@ const props = withDefaults(defineProps(), {
const emit = defineEmits(['change', 'update:value'])
-function getIcons() {
- const data = iconsData as any
- const prefix: string = data?.prefix ?? ''
- let result: string[] = []
- if (prefix)
- result = (data?.icons ?? []).map(item => `${prefix}:${item}`)
- else if (Array.isArray(iconsData))
- result = iconsData as string[]
-
- return result
-}
-
function getSvgIcons() {
return svgIcons.map((icon: string) => icon.replace('icon-', ''))
}
@@ -119,7 +106,7 @@ function handleSearchChange(e: ChangeEvent) {
>
-
+
@@ -137,7 +124,7 @@ function handleSearchChange(e: ChangeEvent) {
-
+
diff --git a/src/components/Icon/src/icons.ts b/src/components/Icon/src/icons.ts
new file mode 100644
index 0000000..38ef130
--- /dev/null
+++ b/src/components/Icon/src/icons.ts
@@ -0,0 +1,8 @@
+import antDesignIconsJson from '@iconify/json/json/ant-design.json'
+
+/**
+ * Get global icons, defaulting to ant-design.
+ */
+export function getIcons() {
+ return Object.keys(antDesignIconsJson.icons).map(item => `i-${antDesignIconsJson.prefix}:${item}`)
+}
diff --git a/src/components/Menu/src/components/MenuItemContent.vue b/src/components/Menu/src/components/MenuItemContent.vue
index 11eed3e..053460b 100644
--- a/src/components/Menu/src/components/MenuItemContent.vue
+++ b/src/components/Menu/src/components/MenuItemContent.vue
@@ -1,7 +1,6 @@
@@ -14,7 +72,7 @@ import { Icon } from '@/components/Icon'
-
+
{{ item.title }}
diff --git a/src/views/dashboard/workbench/components/QuickNav.vue b/src/views/dashboard/workbench/components/QuickNav.vue
index d949d47..ed8d6cc 100644
--- a/src/views/dashboard/workbench/components/QuickNav.vue
+++ b/src/views/dashboard/workbench/components/QuickNav.vue
@@ -1,14 +1,51 @@
-
+
{{ item.title }}
diff --git a/src/views/dashboard/workbench/components/data.ts b/src/views/dashboard/workbench/components/data.ts
index 750b142..abad974 100644
--- a/src/views/dashboard/workbench/components/data.ts
+++ b/src/views/dashboard/workbench/components/data.ts
@@ -1,18 +1,3 @@
-interface GroupItem {
- title: string
- icon: string
- color: string
- desc: string
- date: string
- group: string
-}
-
-interface NavItem {
- title: string
- icon: string
- color: string
-}
-
interface DynamicInfoItem {
avatar: string
name: string
@@ -20,137 +5,53 @@ interface DynamicInfoItem {
desc: string
}
-export const navItems: NavItem[] = [
- {
- title: '首页',
- icon: 'ion:home-outline',
- color: '#1fdaca',
- },
- {
- title: '仪表盘',
- icon: 'ion:grid-outline',
- color: '#bf0c2c',
- },
- {
- title: '组件',
- icon: 'ion:layers-outline',
- color: '#e18525',
- },
- {
- title: '系统管理',
- icon: 'ion:settings-outline',
- color: '#3fb27f',
- },
- {
- title: '权限管理',
- icon: 'ion:key-outline',
- color: '#4daf1bc9',
- },
- {
- title: '图表',
- icon: 'ion:bar-chart-outline',
- color: '#00d8ff',
- },
-]
-
export const dynamicInfoItems: DynamicInfoItem[] = [
{
- avatar: 'dynamic-avatar-1|svg',
+ avatar: 'dynamic-avatar-1',
name: '威廉',
date: '刚刚',
desc: '在 开源组 创建了项目 Vue',
},
{
- avatar: 'dynamic-avatar-2|svg',
+ avatar: 'dynamic-avatar-2',
name: '艾文',
date: '1个小时前',
desc: '关注了 威廉 ',
},
{
- avatar: 'dynamic-avatar-3|svg',
+ avatar: 'dynamic-avatar-3',
name: '克里斯',
date: '1天前',
desc: '发布了 个人动态 ',
},
{
- avatar: 'dynamic-avatar-4|svg',
+ avatar: 'dynamic-avatar-4',
name: 'XingyuV',
date: '2天前',
desc: '发表文章 如何编写一个Vite插件 ',
},
{
- avatar: 'dynamic-avatar-5|svg',
+ avatar: 'dynamic-avatar-5',
name: '皮特',
date: '3天前',
desc: '回复了 杰克 的问题 如何进行项目优化?',
},
{
- avatar: 'dynamic-avatar-6|svg',
+ avatar: 'dynamic-avatar-6',
name: '杰克',
date: '1周前',
desc: '关闭了问题 如何运行项目 ',
},
{
- avatar: 'dynamic-avatar-1|svg',
+ avatar: 'dynamic-avatar-1',
name: '威廉',
date: '1周前',
desc: '发布了 个人动态 ',
},
{
- avatar: 'dynamic-avatar-1|svg',
+ avatar: 'dynamic-avatar-1',
name: '威廉',
date: '2021-04-01 20:00',
desc: '推送了代码到 Github',
},
]
-
-export const groupItems: GroupItem[] = [
- {
- title: 'Github',
- icon: 'carbon:logo-github',
- color: '',
- desc: '不要等待机会,而要创造机会。',
- group: '开源组',
- date: '2021-04-01',
- },
- {
- title: 'Vue',
- icon: 'ion:logo-vue',
- color: '#3fb27f',
- desc: '现在的你决定将来的你。',
- group: '算法组',
- date: '2021-04-01',
- },
- {
- title: 'Html5',
- icon: 'ion:logo-html5',
- color: '#e18525',
- desc: '没有什么才能比努力更重要。',
- group: '上班摸鱼',
- date: '2021-04-01',
- },
- {
- title: 'Angular',
- icon: 'ion:logo-angular',
- color: '#bf0c2c',
- desc: '热情和欲望可以突破一切难关。',
- group: 'UI',
- date: '2021-04-01',
- },
- {
- title: 'React',
- icon: 'bx:bxl-react',
- color: '#00d8ff',
- desc: '健康的身体是实现目标的基石。',
- group: '技术牛',
- date: '2021-04-01',
- },
- {
- title: 'Js',
- icon: 'ion:logo-javascript',
- color: '#EBD94E',
- desc: '路是走出来的,而不是空想出来的。',
- group: '架构组',
- date: '2021-04-01',
- },
-]
diff --git a/uno.config.ts b/uno.config.ts
index 2f30b51..db5d54f 100644
--- a/uno.config.ts
+++ b/uno.config.ts
@@ -1,13 +1,24 @@
-import { defineConfig, presetTypography, presetUno } from 'unocss'
+import { defineConfig, presetIcons, presetTypography, presetUno } from 'unocss'
+import { getIcons } from './src/components/Icon/src/icons'
export default defineConfig({
presets: [
presetUno(),
presetTypography(),
+ presetIcons({
+ extraProperties: {
+ 'font-size': '16px',
+ 'display': 'inline-block',
+ 'vertical-align': 'middle',
+ },
+ }),
],
theme: {
colors: {
primary: '#0960bd',
},
},
+ safelist: [
+ ...getIcons(),
+ ],
})