feat: add new SVG icons and update package.json

- Added multiple new SVG icons to the logos directory.
- Removed the deprecated dmxapiLogo component.
- Updated package.json to reflect the new icons.
This commit is contained in:
MyPrototypeWhat 2025-12-16 15:53:27 +08:00
parent 31484b7cd9
commit 4d7989c220
83 changed files with 61 additions and 46 deletions

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 140 KiB

View File

Before

Width:  |  Height:  |  Size: 866 B

After

Width:  |  Height:  |  Size: 866 B

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 714 B

After

Width:  |  Height:  |  Size: 714 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 992 B

After

Width:  |  Height:  |  Size: 992 B

View File

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 428 B

After

Width:  |  Height:  |  Size: 428 B

View File

Before

Width:  |  Height:  |  Size: 943 B

After

Width:  |  Height:  |  Size: 943 B

View File

Before

Width:  |  Height:  |  Size: 921 B

After

Width:  |  Height:  |  Size: 921 B

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 470 B

After

Width:  |  Height:  |  Size: 470 B

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 564 B

After

Width:  |  Height:  |  Size: 564 B

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 865 B

After

Width:  |  Height:  |  Size: 865 B

View File

Before

Width:  |  Height:  |  Size: 889 B

After

Width:  |  Height:  |  Size: 889 B

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 728 B

View File

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

View File

Before

Width:  |  Height:  |  Size: 1019 B

After

Width:  |  Height:  |  Size: 1019 B

View File

Before

Width:  |  Height:  |  Size: 816 B

After

Width:  |  Height:  |  Size: 816 B

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 794 KiB

After

Width:  |  Height:  |  Size: 794 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -16,7 +16,8 @@
"type-check": "tsc --noEmit -p tsconfig.json --composite false",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"icons:generate": "tsx scripts/generate-icons.ts"
"icons:generate": "tsx scripts/generate-icons.ts --type=icons",
"logos:generate": "tsx scripts/generate-icons.ts --type=logos"
},
"keywords": [
"ui",

View File

@ -6,8 +6,44 @@ import { transform } from '@svgr/core'
import fs from 'fs/promises'
import path from 'path'
const ICONS_DIR = path.join(__dirname, '../icons')
const OUTPUT_DIR = path.join(__dirname, '../src/components/icons/logos')
type IconType = 'icons' | 'logos'
const DEFAULT_TYPE: IconType = 'icons'
const SOURCE_DIR_MAP: Record<IconType, string> = {
icons: path.join(__dirname, '../icons/general'),
logos: path.join(__dirname, '../icons/logos')
}
const OUTPUT_DIR_MAP: Record<IconType, string> = {
icons: path.join(__dirname, '../src/components/icons/general'),
logos: path.join(__dirname, '../src/components/icons/logos')
}
function parseTypeArg(): IconType {
const arg = process.argv.find((item) => item.startsWith('--type='))
if (!arg) return DEFAULT_TYPE
const value = arg.split('=')[1]
if (value === 'icons' || value === 'logos') return value
throw new Error(`Invalid --type value: ${value}. Use "icons" or "logos".`)
}
async function ensureInputDir(type: IconType): Promise<string> {
const inputDir = SOURCE_DIR_MAP[type]
const stat = await fs.stat(inputDir).catch(() => null)
if (!stat || !stat.isDirectory()) {
throw new Error(`Source directory not found for type=${type}. Expected: ${inputDir}`)
}
return inputDir
}
async function ensureOutputDir(type: IconType): Promise<string> {
const outputDir = OUTPUT_DIR_MAP[type]
await fs.mkdir(outputDir, { recursive: true })
return outputDir
}
/**
* Convert filename to PascalCase component name
@ -55,13 +91,18 @@ function toCamelCase(filename: string): string {
/**
* Generate a single icon component
*/
async function generateIcon(svgFile: string): Promise<{ filename: string; componentName: string }> {
const svgPath = path.join(ICONS_DIR, svgFile)
async function generateIcon(
type: IconType,
inputDir: string,
outputDir: string,
svgFile: string
): Promise<{ filename: string; componentName: string }> {
const svgPath = path.join(inputDir, svgFile)
const svgCode = await fs.readFile(svgPath, 'utf-8')
const componentName = toPascalCase(svgFile)
const outputFilename = toCamelCase(svgFile) + '.tsx'
const outputPath = path.join(OUTPUT_DIR, outputFilename)
const outputPath = path.join(outputDir, outputFilename)
// Use SVGR with simple config
let jsCode = await transform(
@ -110,7 +151,7 @@ async function generateIcon(svgFile: string): Promise<{ filename: string; compon
/**
* Generate index.ts file
*/
async function generateIndex(components: Array<{ filename: string; componentName: string }>) {
async function generateIndex(outputDir: string, components: Array<{ filename: string; componentName: string }>) {
const exports = components
.map(({ filename, componentName }) => {
const basename = filename.replace('.tsx', '')
@ -130,29 +171,30 @@ async function generateIndex(components: Array<{ filename: string; componentName
${exports}
`
await fs.writeFile(path.join(OUTPUT_DIR, 'index.ts'), indexContent, 'utf-8')
await fs.writeFile(path.join(outputDir, 'index.ts'), indexContent, 'utf-8')
}
/**
* Main function
*/
async function main() {
console.log('🔧 Starting icon generation...\n')
const type = parseTypeArg()
// Ensure output directory exists
await fs.mkdir(OUTPUT_DIR, { recursive: true })
console.log(`🔧 Starting icon generation (type: ${type})...\n`)
// Get all SVG files
const files = await fs.readdir(ICONS_DIR)
const inputDir = await ensureInputDir(type)
const outputDir = await ensureOutputDir(type)
const files = await fs.readdir(inputDir)
const svgFiles = files.filter((f) => f.endsWith('.svg'))
console.log(`📁 Found ${svgFiles.length} SVG files\n`)
console.log(`📁 Found ${svgFiles.length} SVG files in ${inputDir}\n`)
const components: Array<{ filename: string; componentName: string }> = []
for (const svgFile of svgFiles) {
try {
const result = await generateIcon(svgFile)
const result = await generateIcon(type, inputDir, outputDir, svgFile)
components.push(result)
console.log(`${svgFile} -> ${result.filename} (${result.componentName})`)
} catch (error) {
@ -160,9 +202,8 @@ async function main() {
}
}
// Generate index.ts
console.log('\n📝 Generating index.ts...')
await generateIndex(components)
await generateIndex(outputDir, components)
console.log(`\n✨ Generation complete! Successfully processed ${components.length}/${svgFiles.length} files`)
}

File diff suppressed because one or more lines are too long

View File

@ -2,8 +2,8 @@
* Auto-generated icon exports
* Do not edit manually
*
* Generated at: 2025-11-14T10:23:25.580Z
* Total icons: 80
* Generated at: 2025-12-16T07:41:23.902Z
* Total icons: 79
*/
export { Ai302 } from './302ai'