diff --git a/package.json b/package.json index d6aa933..448446e 100644 --- a/package.json +++ b/package.json @@ -135,6 +135,7 @@ "@esbuild/darwin-arm64": "0.20.2", "@esbuild/darwin-x64": "0.20.2", "@iconify-json/carbon": "^1.2.4", + "@iconify/utils": "^3.0.2", "@rollup/rollup-darwin-x64": "^4.28.0", "@types/node": "^20.17.9", "@uni-helper/eslint-config": "0.5.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1eb301d..a6022c6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -127,6 +127,9 @@ importers: '@iconify-json/carbon': specifier: ^1.2.4 version: 1.2.13 + '@iconify/utils': + specifier: ^3.0.2 + version: 3.0.2 '@rollup/rollup-darwin-x64': specifier: ^4.28.0 version: 4.50.0 @@ -320,6 +323,9 @@ packages: '@antfu/utils@8.1.1': resolution: {integrity: sha512-Mex9nXf9vR6AhcXmMrlz/HVgYYZpVGJ6YlPgwl7UnaFpnshXs6EK/oa5Gpf3CzENMjkvEx2tQtntGnb7UtSTOQ==} + '@antfu/utils@9.3.0': + resolution: {integrity: sha512-9hFT4RauhcUzqOE4f1+frMKLZrgNog5b06I7VmZQV1BkvwvqrbC8EBZf3L1eEL2AKb6rNKjER0sEvJiSP1FXEA==} + '@babel/code-frame@7.27.1': resolution: {integrity: sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==} engines: {node: '>=6.9.0'} @@ -1393,6 +1399,9 @@ packages: '@iconify/utils@2.3.0': resolution: {integrity: sha512-GmQ78prtwYW6EtzXRU1rY+KwOKfz32PD7iJh6Iyqw68GiKuoZ2A6pRtzWONz5VQJbp50mEjXh/7NkumtrAgRKA==} + '@iconify/utils@3.0.2': + resolution: {integrity: sha512-EfJS0rLfVuRuJRn4psJHtK2A9TqVnkxPpHY6lYHiB9+8eSuudsxbwMiavocG45ujOo6FJ+CIRlRnlOGinzkaGQ==} + '@intlify/core-base@9.1.9': resolution: {integrity: sha512-x5T0p/Ja0S8hs5xs+ImKyYckVkL4CzcEXykVYYV6rcbXxJTe2o58IquSqX9bdncVKbRZP7GlBU1EcRaQEEJ+vw==} engines: {node: '>= 10'} @@ -6343,6 +6352,8 @@ snapshots: '@antfu/utils@8.1.1': {} + '@antfu/utils@9.3.0': {} + '@babel/code-frame@7.27.1': dependencies: '@babel/helper-validator-identifier': 7.27.1 @@ -6416,7 +6427,7 @@ snapshots: '@babel/core': 7.28.3 '@babel/helper-compilation-targets': 7.27.2 '@babel/helper-plugin-utils': 7.27.1 - debug: 4.4.1 + debug: 4.4.3 lodash.debounce: 4.0.8 resolve: 1.22.10 transitivePeerDependencies: @@ -7083,7 +7094,7 @@ snapshots: '@babel/parser': 7.28.3 '@babel/template': 7.27.2 '@babel/types': 7.28.2 - debug: 4.4.1 + debug: 4.4.3 transitivePeerDependencies: - supports-color @@ -7288,7 +7299,7 @@ snapshots: '@vue/compiler-sfc': 3.4.21 '@vue/consolidate': 1.0.0 '@vue/shared': 3.4.21 - debug: 4.4.1 + debug: 4.4.3 es-module-lexer: 1.7.0 estree-walker: 2.0.2 fast-glob: 3.3.3 @@ -7316,7 +7327,7 @@ snapshots: '@vitejs/plugin-vue': 5.1.0(vite@5.2.8(@types/node@20.19.11)(sass@1.77.8)(terser@5.43.1))(vue@3.4.21(typescript@5.8.3)) '@vue/compiler-dom': 3.4.21 '@vue/compiler-sfc': 3.4.21 - debug: 4.4.1 + debug: 4.4.3 fs-extra: 10.1.0 picocolors: 1.1.1 transitivePeerDependencies: @@ -7402,7 +7413,7 @@ snapshots: base64url: 3.0.1 chokidar: 3.6.0 compare-versions: 3.6.0 - debug: 4.4.1 + debug: 4.4.3 es-module-lexer: 1.7.0 esbuild: 0.20.2 estree-walker: 2.0.2 @@ -7548,7 +7559,7 @@ snapshots: '@vue/compiler-sfc': 3.4.21 '@vue/server-renderer': 3.4.21(vue@3.4.21(typescript@5.8.3)) '@vue/shared': 3.4.21 - debug: 4.4.1 + debug: 4.4.3 fs-extra: 10.1.0 mime: 3.0.0 module-alias: 2.2.3 @@ -7782,7 +7793,7 @@ snapshots: '@vue/compiler-dom': 3.4.21 '@vue/compiler-sfc': 3.4.21 '@vue/shared': 3.4.21 - debug: 4.4.1 + debug: 4.4.3 transitivePeerDependencies: - '@nuxt/kit' - '@vueuse/core' @@ -7885,7 +7896,7 @@ snapshots: dependencies: '@dcloudio/uni-cli-shared': 3.0.0-4070620250821001(postcss@8.5.6)(rollup@4.50.0)(vue@3.4.21(typescript@5.8.3)) '@dcloudio/uni-shared': 3.0.0-4070620250821001 - debug: 4.4.1 + debug: 4.4.3 transitivePeerDependencies: - '@nuxt/kit' - '@vueuse/core' @@ -8157,6 +8168,19 @@ snapshots: transitivePeerDependencies: - supports-color + '@iconify/utils@3.0.2': + dependencies: + '@antfu/install-pkg': 1.1.0 + '@antfu/utils': 9.3.0 + '@iconify/types': 2.0.0 + debug: 4.4.3 + globals: 15.15.0 + kolorist: 1.8.0 + local-pkg: 1.1.2 + mlly: 1.8.0 + transitivePeerDependencies: + - supports-color + '@intlify/core-base@9.1.9': dependencies: '@intlify/devtools-if': 9.1.9 @@ -9015,7 +9039,7 @@ snapshots: dependencies: '@typescript-eslint/tsconfig-utils': 8.41.0(typescript@5.8.3) '@typescript-eslint/types': 8.41.0 - debug: 4.4.1 + debug: 4.4.3 typescript: 5.8.3 transitivePeerDependencies: - supports-color @@ -9069,7 +9093,7 @@ snapshots: '@typescript-eslint/tsconfig-utils': 8.41.0(typescript@5.8.3) '@typescript-eslint/types': 8.41.0 '@typescript-eslint/visitor-keys': 8.41.0 - debug: 4.4.1 + debug: 4.4.3 fast-glob: 3.3.3 is-glob: 4.0.3 minimatch: 9.0.5 diff --git a/src/static/my-icons/copyright.svg b/src/static/my-icons/copyright.svg new file mode 100644 index 0000000..8e69a8c --- /dev/null +++ b/src/static/my-icons/copyright.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/uno.config.ts b/uno.config.ts index 82809b2..f837b58 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -1,9 +1,10 @@ import type { Preset, } from 'unocss' +import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders' + // https://www.npmjs.com/package/@uni-helper/unocss-preset-uni import { presetUni } from '@uni-helper/unocss-preset-uni' - // @see https://unocss.dev/presets/legacy-compat import { presetLegacyCompat } from '@unocss/preset-legacy-compat' import { @@ -26,6 +27,26 @@ export default defineConfig({ 'display': 'inline-block', 'vertical-align': 'middle', }, + collections: { + // 注册本地 SVG 图标集合, 从本地文件系统加载图标 + // 在 './src/static/my-icons' 目录下的所有 svg 文件将被注册为图标, + // my-icons 是图标集合名称,使用 `i-my-icons-图标名` 调用 + 'my-icons': FileSystemIconLoader( + './src/static/my-icons', + // 可选的,你可以提供一个 transform 回调来更改每个图标 + (svg) => { + let svgStr = svg + + // 如果 SVG 文件未定义 `fill` 属性,则默认填充 `currentColor`, 这样图标颜色会继承文本颜色,方便在不同场景下适配 + svgStr = svgStr.includes('fill="') ? svgStr : svgStr.replace(/^