vectify 2.0.5 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +12 -13
  2. package/README.zh-CN.md +12 -13
  3. package/dist/{chunk-CIKTK6HI.mjs → chunk-FS34P27H.mjs} +8 -0
  4. package/dist/{chunk-GY4VNET5.mjs → chunk-QYE23M3E.mjs} +625 -65
  5. package/dist/cli.js +676 -117
  6. package/dist/cli.mjs +3 -3
  7. package/dist/{helpers-UPZEBRGK.mjs → helpers-ZOR3OD66.mjs} +1 -1
  8. package/dist/index.d.mts +33 -2
  9. package/dist/index.d.ts +33 -2
  10. package/dist/index.js +669 -110
  11. package/dist/index.mjs +2 -2
  12. package/dist/templates/angular/component.ts.hbs +11 -2
  13. package/dist/templates/angular/createIcon.ts.hbs +11 -2
  14. package/dist/templates/astro/component.astro.hbs +12 -2
  15. package/dist/templates/astro/createIcon.astro.hbs +12 -2
  16. package/dist/templates/lit/component.js.hbs +1 -0
  17. package/dist/templates/lit/component.ts.hbs +1 -0
  18. package/dist/templates/lit/createIcon.js.hbs +12 -2
  19. package/dist/templates/lit/createIcon.ts.hbs +12 -2
  20. package/dist/templates/preact/component.jsx.hbs +1 -1
  21. package/dist/templates/preact/component.tsx.hbs +1 -1
  22. package/dist/templates/preact/createIcon.jsx.hbs +12 -3
  23. package/dist/templates/preact/createIcon.tsx.hbs +13 -3
  24. package/dist/templates/qwik/component.jsx.hbs +1 -1
  25. package/dist/templates/qwik/component.tsx.hbs +1 -1
  26. package/dist/templates/qwik/createIcon.jsx.hbs +12 -3
  27. package/dist/templates/qwik/createIcon.tsx.hbs +13 -3
  28. package/dist/templates/react/component.jsx.hbs +1 -1
  29. package/dist/templates/react/component.tsx.hbs +1 -1
  30. package/dist/templates/react/createIcon.jsx.hbs +12 -3
  31. package/dist/templates/react/createIcon.tsx.hbs +13 -3
  32. package/dist/templates/solid/component.tsx.hbs +1 -1
  33. package/dist/templates/solid/createIcon.jsx.hbs +13 -3
  34. package/dist/templates/solid/createIcon.tsx.hbs +14 -3
  35. package/dist/templates/svelte/component.js.svelte.hbs +4 -1
  36. package/dist/templates/svelte/component.ts.svelte.hbs +4 -1
  37. package/dist/templates/svelte/icon.js.svelte.hbs +23 -2
  38. package/dist/templates/svelte/icon.ts.svelte.hbs +23 -2
  39. package/dist/templates/vanilla/component.ts.hbs +1 -1
  40. package/dist/templates/vanilla/createIcon.js.hbs +12 -3
  41. package/dist/templates/vanilla/createIcon.ts.hbs +13 -3
  42. package/dist/templates/vue/component.js.vue.hbs +5 -2
  43. package/dist/templates/vue/component.ts.vue.hbs +5 -2
  44. package/dist/templates/vue/icon.js.vue.hbs +26 -2
  45. package/dist/templates/vue/icon.ts.vue.hbs +26 -2
  46. package/dist/templates/vue2/component.js.vue.hbs +4 -2
  47. package/dist/templates/vue2/component.ts.vue.hbs +5 -2
  48. package/dist/templates/vue2/icon.js.vue.hbs +25 -2
  49. package/dist/templates/vue2/icon.ts.vue.hbs +25 -2
  50. package/package.json +1 -1
package/README.md CHANGED
@@ -116,7 +116,7 @@ src/icons/
116
116
  ### 4. Use in Your Code
117
117
 
118
118
  ```tsx
119
- import { ArrowRight, User, Settings } from './icons'
119
+ import { ArrowRight, Settings, User } from './icons'
120
120
 
121
121
  function App() {
122
122
  return (
@@ -235,7 +235,7 @@ When `format: true`, Vectify looks for config files in this order:
235
235
  ```typescript
236
236
  export default defineConfig({
237
237
  format: {
238
- tool: 'prettier', // 'auto' | 'prettier' | 'eslint' | 'biome'
238
+ tool: 'prettier', // 'auto' | 'prettier' | 'eslint' | 'biome'
239
239
  args: '--single-quote', // Additional CLI arguments
240
240
  },
241
241
  })
@@ -357,7 +357,7 @@ export default defineConfig({
357
357
  hooks: {
358
358
  beforeParse: (svg, fileName) => {
359
359
  // Replace black with currentColor for customization
360
- return svg.replace(/#000000/gi, 'currentColor')
360
+ return svg.replace(/#000000/g, 'currentColor')
361
361
  },
362
362
  afterGenerate: (code, iconName) => {
363
363
  // Add JSDoc comment to each component
@@ -393,7 +393,6 @@ The index file automatically uses the correct export style for your chosen frame
393
393
  - `keepColors: false` - Best for single-color icons that should inherit text color. Uses `currentColor` and allows runtime customization via the `color` prop.
394
394
  - `keepColors: true` - Best for multi-color brand icons. Preserves original SVG fill/stroke colors.
395
395
 
396
-
397
396
  ## Component Props
398
397
 
399
398
  All generated components accept the following props:
@@ -401,19 +400,19 @@ All generated components accept the following props:
401
400
  ```typescript
402
401
  interface IconProps {
403
402
  // Icon size (default: 24)
404
- size?: number | string
403
+ 'size'?: number | string
405
404
 
406
405
  // Icon color (default: 'currentColor')
407
- color?: string
406
+ 'color'?: string
408
407
 
409
408
  // Stroke width for stroke-based icons (default: 2)
410
- strokeWidth?: number | string
409
+ 'strokeWidth'?: number | string
411
410
 
412
411
  // CSS class name
413
- className?: string
412
+ 'className'?: string
414
413
 
415
414
  // Accessibility: icon title
416
- title?: string
415
+ 'title'?: string
417
416
 
418
417
  // Accessibility: aria-label
419
418
  'aria-label'?: string
@@ -553,10 +552,10 @@ document.getElementById('app').appendChild(icon)
553
552
 
554
553
  ```typescript
555
554
  // For single-color icons (default)
556
- keepColors: false // Uses currentColor, customizable via color prop
555
+ keepColors: false // Uses currentColor, customizable via color prop
557
556
 
558
557
  // For multi-color icons
559
- keepColors: true // Preserves original colors from SVG
558
+ keepColors: true // Preserves original colors from SVG
560
559
  ```
561
560
 
562
561
  ### 4. Project Structure
@@ -696,10 +695,10 @@ export default defineConfig({
696
695
  ```tsx
697
696
  // Before
698
697
  import { FiArrowRight } from 'react-icons/fi'
699
- <FiArrowRight size={24} />
700
698
 
701
699
  // After
702
700
  import { ArrowRight } from './icons'
701
+ <FiArrowRight size={24} />
703
702
  <ArrowRight size={24} />
704
703
  ```
705
704
 
@@ -708,10 +707,10 @@ import { ArrowRight } from './icons'
708
707
  ```tsx
709
708
  // Before
710
709
  import { Icon } from '@iconify/react'
711
- <Icon icon="mdi:arrow-right" />
712
710
 
713
711
  // After
714
712
  import { ArrowRight } from './icons'
713
+ <Icon icon="mdi:arrow-right" />
715
714
  <ArrowRight />
716
715
  ```
717
716
 
package/README.zh-CN.md CHANGED
@@ -116,7 +116,7 @@ src/icons/
116
116
  ### 4. 在代码中使用
117
117
 
118
118
  ```tsx
119
- import { ArrowRight, User, Settings } from './icons'
119
+ import { ArrowRight, Settings, User } from './icons'
120
120
 
121
121
  function App() {
122
122
  return (
@@ -235,7 +235,7 @@ export default defineConfig({
235
235
  ```typescript
236
236
  export default defineConfig({
237
237
  format: {
238
- tool: 'prettier', // 'auto' | 'prettier' | 'eslint' | 'biome'
238
+ tool: 'prettier', // 'auto' | 'prettier' | 'eslint' | 'biome'
239
239
  args: '--single-quote', // 额外的 CLI 参数
240
240
  },
241
241
  })
@@ -357,7 +357,7 @@ export default defineConfig({
357
357
  hooks: {
358
358
  beforeParse: (svg, fileName) => {
359
359
  // 将黑色替换为 currentColor 以便自定义
360
- return svg.replace(/#000000/gi, 'currentColor')
360
+ return svg.replace(/#000000/g, 'currentColor')
361
361
  },
362
362
  afterGenerate: (code, iconName) => {
363
363
  // 为每个组件添加 JSDoc 注释
@@ -393,7 +393,6 @@ export default defineConfig({
393
393
  - `keepColors: false` - 适合应继承文本颜色的单色图标。使用 `currentColor` 并允许通过 `color` 属性进行运行时自定义。
394
394
  - `keepColors: true` - 适合多色品牌图标。保留原始 SVG 的 fill/stroke 颜色。
395
395
 
396
-
397
396
  ## 🎨 组件属性
398
397
 
399
398
  所有生成的组件都接受以下属性:
@@ -401,19 +400,19 @@ export default defineConfig({
401
400
  ```typescript
402
401
  interface IconProps {
403
402
  // 图标大小 (默认: 24)
404
- size?: number | string
403
+ 'size'?: number | string
405
404
 
406
405
  // 图标颜色 (默认: 'currentColor')
407
- color?: string
406
+ 'color'?: string
408
407
 
409
408
  // 描边图标的描边宽度 (默认: 2)
410
- strokeWidth?: number | string
409
+ 'strokeWidth'?: number | string
411
410
 
412
411
  // CSS 类名
413
- className?: string
412
+ 'className'?: string
414
413
 
415
414
  // 无障碍:图标标题
416
- title?: string
415
+ 'title'?: string
417
416
 
418
417
  // 无障碍:aria-label
419
418
  'aria-label'?: string
@@ -553,10 +552,10 @@ document.getElementById('app').appendChild(icon)
553
552
 
554
553
  ```typescript
555
554
  // 单色图标(默认)
556
- keepColors: false // 使用 currentColor,可通过 color 属性自定义
555
+ keepColors: false // 使用 currentColor,可通过 color 属性自定义
557
556
 
558
557
  // 多色图标
559
- keepColors: true // 保留 SVG 中的原始颜色
558
+ keepColors: true // 保留 SVG 中的原始颜色
560
559
  ```
561
560
 
562
561
  ### 4. 项目结构
@@ -696,10 +695,10 @@ export default defineConfig({
696
695
  ```tsx
697
696
  // 之前
698
697
  import { FiArrowRight } from 'react-icons/fi'
699
- <FiArrowRight size={24} />
700
698
 
701
699
  // 之后
702
700
  import { ArrowRight } from './icons'
701
+ <FiArrowRight size={24} />
703
702
  <ArrowRight size={24} />
704
703
  ```
705
704
 
@@ -708,10 +707,10 @@ import { ArrowRight } from './icons'
708
707
  ```tsx
709
708
  // 之前
710
709
  import { Icon } from '@iconify/react'
711
- <Icon icon="mdi:arrow-right" />
712
710
 
713
711
  // 之后
714
712
  import { ArrowRight } from './icons'
713
+ <Icon icon="mdi:arrow-right" />
715
714
  <ArrowRight />
716
715
  ```
717
716
 
@@ -1,3 +1,10 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
1
8
  // src/utils/helpers.ts
2
9
  function toPascalCase(str) {
3
10
  return str.replace(/[-_](.)/g, (_, char) => char.toUpperCase()).replace(/^(.)/, (char) => char.toUpperCase()).replace(/[^a-z0-9]/gi, "");
@@ -82,6 +89,7 @@ async function findProjectRoot(startDir = process.cwd()) {
82
89
  }
83
90
 
84
91
  export {
92
+ __require,
85
93
  toPascalCase,
86
94
  toKebabCase,
87
95
  mergeClasses,