@developershre/icona 2.0.0 → 2.0.2
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.
- package/README.md +32 -239
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,266 +1,59 @@
|
|
|
1
|
-
# Icona
|
|
1
|
+
# Icona
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A lightweight, modern SVG icon library designed for web applications. Built with TypeScript support and framework-agnostic architecture for seamless integration across your projects.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
- 🎨 **Multi-Framework Support**: Generate components for React, React Native, and Vue
|
|
8
|
-
- 🌐 **Remote Icon Sources**: Fetch icons from GitHub, CDNs, cloud storage (S3, Supabase, etc.)
|
|
9
|
-
- ⚡ **SVG Optimization**: Automatic optimization using SVGO (reduces file sizes by 20-50%)
|
|
10
|
-
- 📁 **Nested Structure**: Maintains folder hierarchies for organized icon categories
|
|
11
|
-
- 🔧 **Environment-Based Config**: Configure sources via environment variables
|
|
12
|
-
- 📦 **Type Safety**: Full TypeScript support with generated components
|
|
13
|
-
- 📤 **Ready-to-Publish**: Build and publish your own icon library
|
|
14
|
-
|
|
15
|
-
## 🚀 Quick Start
|
|
16
|
-
|
|
17
|
-
### Installation
|
|
5
|
+
## Installation
|
|
18
6
|
|
|
19
7
|
```bash
|
|
20
8
|
npm install @developershre/icona
|
|
21
9
|
```
|
|
22
10
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
1. **Configure Environment**: Copy `.env.example` to `.env` and configure your icon source
|
|
26
|
-
2. **Generate Icons**: Run the generator to create components
|
|
27
|
-
3. **Use Components**: Import and use generated icons in your projects
|
|
28
|
-
|
|
29
|
-
### Local Icons
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
# .env
|
|
33
|
-
ICONS_SOURCE=local
|
|
34
|
-
ICONS_LOCAL_PATH=./icons
|
|
35
|
-
ENABLE_SVG_OPTIMIZATION=true
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Place your SVG files in the `icons/` directory and run:
|
|
11
|
+
## Quick Start
|
|
39
12
|
|
|
40
13
|
```typescript
|
|
41
|
-
import {
|
|
42
|
-
await generateIcons();
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Remote Icons (GitHub)
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
# .env
|
|
49
|
-
ICONS_SOURCE=remote
|
|
50
|
-
ICONS_REMOTE_URL=https://api.github.com/repos/feathericons/feather/contents/icons
|
|
51
|
-
ICONS_AUTH_TOKEN=your_github_token_here
|
|
52
|
-
ENABLE_SVG_OPTIMIZATION=true
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## 🌐 Remote Sources Support
|
|
56
|
-
|
|
57
|
-
### GitHub Repositories
|
|
58
|
-
|
|
59
|
-
Fetch icons directly from GitHub repositories like Feather Icons, Tabler Icons, etc.
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
# .env for GitHub
|
|
63
|
-
ICONS_SOURCE=remote
|
|
64
|
-
ICONS_REMOTE_URL=https://api.github.com/repos/feathericons/feather/contents/icons
|
|
65
|
-
ICONS_AUTH_TOKEN=ghp_your_github_token_here
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Examples of popular icon repositories:
|
|
69
|
-
- **Feather**: `https://api.github.com/repos/feathericons/feather/contents/icons`
|
|
70
|
-
- **Tabler**: `https://api.github.com/repos/tabler/tabler-icons/contents/icons`
|
|
71
|
-
- **Lucide**: `https://api.github.com/repos/lucide-icons/lucide/contents/icons`
|
|
72
|
-
- **Heroicons**: `https://api.github.com/repos/tailwindlabs/heroicons/contents/src`
|
|
73
|
-
|
|
74
|
-
## ⚡ Generated Components
|
|
75
|
-
|
|
76
|
-
After running the generator, you'll get framework-specific components:
|
|
77
|
-
|
|
78
|
-
### React Usage
|
|
79
|
-
|
|
80
|
-
```tsx
|
|
81
|
-
import { ActivityIcon, AirplayIcon, AlertCircleIcon } from './dist/react';
|
|
82
|
-
|
|
83
|
-
function App() {
|
|
84
|
-
return (
|
|
85
|
-
<div>
|
|
86
|
-
<ActivityIcon size={24} color="blue" />
|
|
87
|
-
<AirplayIcon size={32} className="text-red-500" />
|
|
88
|
-
<AlertCircleIcon size={20} style={{ color: '#green' }} />
|
|
89
|
-
</div>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### Vue 3 Usage
|
|
95
|
-
|
|
96
|
-
```vue
|
|
97
|
-
<template>
|
|
98
|
-
<div>
|
|
99
|
-
<ActivityIcon :size="24" color="blue" />
|
|
100
|
-
<AirplayIcon :size="32" class="text-red-500" />
|
|
101
|
-
<AlertCircleIcon :size="20" :style="{ color: 'green' }" />
|
|
102
|
-
</div>
|
|
103
|
-
</template>
|
|
104
|
-
|
|
105
|
-
<script setup>
|
|
106
|
-
import { ActivityIcon, AirplayIcon, AlertCircleIcon } from './dist/vue';
|
|
107
|
-
</script>
|
|
108
|
-
```
|
|
14
|
+
import { Icon } from 'icona';
|
|
109
15
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
```tsx
|
|
113
|
-
import { ActivityIcon, AirplayIcon, AlertCircleIcon } from './dist/react-native';
|
|
114
|
-
|
|
115
|
-
function App() {
|
|
116
|
-
return (
|
|
117
|
-
<View>
|
|
118
|
-
<ActivityIcon size={24} color="blue" />
|
|
119
|
-
<AirplayIcon size={32} color="red" />
|
|
120
|
-
<AlertCircleIcon size={20} color="green" />
|
|
121
|
-
</View>
|
|
122
|
-
);
|
|
16
|
+
export default function App() {
|
|
17
|
+
return <Icon name="arrow-right" size={24} />;
|
|
123
18
|
}
|
|
124
19
|
```
|
|
125
20
|
|
|
126
|
-
##
|
|
127
|
-
|
|
128
|
-
All generated components support consistent props:
|
|
129
|
-
|
|
130
|
-
| Prop | Type | Default | Description |
|
|
131
|
-
|------|------|---------|-------------|
|
|
132
|
-
| `size` | `number \| string` | `24` | Width and height |
|
|
133
|
-
| `color` | `string` | `'currentColor'` | Icon color |
|
|
134
|
-
| `className` | `string` | - | CSS classes (React/Vue) |
|
|
135
|
-
| `style` | `object` | - | Inline styles |
|
|
136
|
-
| `title` | `string` | - | Accessibility title |
|
|
137
|
-
| `aria-label` | `string` | - | ARIA label |
|
|
21
|
+
## Features
|
|
138
22
|
|
|
139
|
-
|
|
23
|
+
- **Lightweight SVG Icons** - Minimal file sizes with optimized SVG format
|
|
24
|
+
- **TypeScript Support** - Full type definitions for better development experience
|
|
25
|
+
- **Framework Agnostic** - Works with React, Vue, Angular, or vanilla JavaScript
|
|
26
|
+
- **Customizable** - Control colors, sizes, and stroke widths on the fly
|
|
27
|
+
- **Tree-Shakeable** - Import only the icons you need for smaller bundle sizes
|
|
140
28
|
|
|
141
|
-
|
|
29
|
+
## Available Icons
|
|
142
30
|
|
|
143
|
-
|
|
144
|
-
|----------|------|---------|-------------|
|
|
145
|
-
| `ICONS_SOURCE` | `local\|remote` | `local` | Source type |
|
|
146
|
-
| `ICONS_LOCAL_PATH` | `string` | `./icons` | Local icons directory |
|
|
147
|
-
| `ICONS_REMOTE_URL` | `string` | - | GitHub repository URL |
|
|
148
|
-
| `ICONS_AUTH_TOKEN` | `string` | - | GitHub authentication token |
|
|
149
|
-
| `ICONS_TIMEOUT` | `number` | `30000` | Request timeout (ms) |
|
|
150
|
-
| `BUILD_OUTPUT_DIR` | `string` | `./dist` | Output directory |
|
|
151
|
-
| `BUILD_REACT` | `boolean` | `true` | Generate React components |
|
|
152
|
-
| `BUILD_VUE` | `boolean` | `true` | Generate Vue components |
|
|
153
|
-
| `BUILD_REACT_NATIVE` | `boolean` | `true` | Generate RN components |
|
|
154
|
-
| `ENABLE_SVG_OPTIMIZATION` | `boolean` | `true` | Enable SVGO optimization |
|
|
31
|
+
Browse the complete icon collection at the [icon showcase](https://icona.dev/icons).
|
|
155
32
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
```typescript
|
|
159
|
-
import { generateIcons, reactOnlyConfig } from '@developershre/icona';
|
|
160
|
-
|
|
161
|
-
// Use environment + custom config
|
|
162
|
-
await generateIcons({
|
|
163
|
-
config: {
|
|
164
|
-
output: {
|
|
165
|
-
directory: './my-icons',
|
|
166
|
-
react: true,
|
|
167
|
-
vue: false,
|
|
168
|
-
reactNative: false
|
|
169
|
-
},
|
|
170
|
-
optimization: {
|
|
171
|
-
enabled: true
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## 🏗️ Building Your Own Icon Library
|
|
178
|
-
|
|
179
|
-
### 1. Setup Project
|
|
180
|
-
|
|
181
|
-
```bash
|
|
182
|
-
mkdir my-icon-library
|
|
183
|
-
cd my-icon-library
|
|
184
|
-
npm init -y
|
|
185
|
-
npm install @developershre/icona
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### 2. Configure Icons
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
# .env
|
|
192
|
-
ICONS_SOURCE=remote
|
|
193
|
-
ICONS_REMOTE_URL=https://api.github.com/repos/your-org/your-icons/contents/icons
|
|
194
|
-
ICONS_AUTH_TOKEN=your_github_token
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
### 3. Generate & Build
|
|
198
|
-
|
|
199
|
-
```json
|
|
200
|
-
// package.json scripts
|
|
201
|
-
{
|
|
202
|
-
"scripts": {
|
|
203
|
-
"generate": "node -e \"require('@developershre/icona').generateIcons()\"",
|
|
204
|
-
"build": "npm run generate && tsc",
|
|
205
|
-
"prepublishOnly": "npm run build"
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### 4. Publish
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
npm run build
|
|
214
|
-
npm publish
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
Now users can install your icon library:
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
npm install your-icon-library
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
```tsx
|
|
224
|
-
import { YourIcon } from 'your-icon-library/dist/react';
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
## 🔧 SVG Optimization
|
|
228
|
-
|
|
229
|
-
Powered by [SVGO](https://github.com/svg/svgo) with sensible defaults:
|
|
230
|
-
|
|
231
|
-
- Removes comments, metadata, and unused elements
|
|
232
|
-
- Optimizes paths and transforms
|
|
233
|
-
- Reduces file size by 20-50% typically
|
|
234
|
-
- Maintains icon quality and accessibility
|
|
235
|
-
|
|
236
|
-
Modify optimization in your config or environment:
|
|
237
|
-
|
|
238
|
-
```bash
|
|
239
|
-
ENABLE_SVG_OPTIMIZATION=true
|
|
240
|
-
```
|
|
33
|
+
## Props
|
|
241
34
|
|
|
242
|
-
|
|
35
|
+
| Prop | Type | Default | Description |
|
|
36
|
+
| ------------- | ------ | ------------ | -------------------------------- |
|
|
37
|
+
| `name` | string | required | Icon name identifier |
|
|
38
|
+
| `size` | number | 24 | Icon size in pixels |
|
|
39
|
+
| `color` | string | currentColor | Icon color (any CSS color value) |
|
|
40
|
+
| `strokeWidth` | number | 2 | Stroke width for outlined icons |
|
|
243
41
|
|
|
244
|
-
|
|
245
|
-
- [Local icons example](./examples/local)
|
|
246
|
-
- [GitHub remote example](./examples/github-remote)
|
|
247
|
-
- [Cloud storage example](./examples/cloud-storage)
|
|
42
|
+
## Browser Support
|
|
248
43
|
|
|
249
|
-
|
|
44
|
+
Compatible with all modern browsers supporting SVG and ES6+.
|
|
250
45
|
|
|
251
|
-
|
|
46
|
+
## Credits
|
|
252
47
|
|
|
253
|
-
|
|
48
|
+
Icon designs created and curated by our Figma design team. We extend our gratitude to the Figma community for their contributions to icon design and refinement.
|
|
49
|
+
## Inspiration
|
|
254
50
|
|
|
255
|
-
|
|
51
|
+
The following resources inspired our icon design:
|
|
256
52
|
|
|
257
|
-
|
|
53
|
+
- [Hicon](https://www.figma.com/community/file/1023171235158207826/hicon-free-icon-pack-2700-editable-icons) - Free icon pack with 2700 editable icons
|
|
54
|
+
- [Wave Icons](https://www.figma.com/community/file/1200076315140068212/wave-icons-essential-icons-community) - Essential icons community collection
|
|
258
55
|
|
|
259
|
-
Built for the community. Icons in examples may be sourced from:
|
|
260
|
-
- [Feather Icons](https://feathericons.com/)
|
|
261
|
-
- [Tabler Icons](https://tabler-icons.io/)
|
|
262
|
-
- [Lucide Icons](https://lucide.dev/)
|
|
263
56
|
|
|
264
|
-
|
|
57
|
+
## License
|
|
265
58
|
|
|
266
|
-
|
|
59
|
+
MIT
|
package/package.json
CHANGED