simple-iconify-picker 1.0.0
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/LICENSE +21 -0
- package/README.md +211 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Sedat Bilen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# Simple Iconify Picker Extension
|
|
2
|
+
A custom interface extension for Directus that provides an intuitive icon picker powered by the Iconify API. Browse and select from thousands of icons across multiple icon sets.
|
|
3
|
+
|
|
4
|
+
## ✨ Features
|
|
5
|
+
- 🎨 Massive Icon Library - Access to 150+ icon sets with over 200,000 icons via Iconify API
|
|
6
|
+
- 🔍 Real-time Search - Quickly find icons with instant search filtering
|
|
7
|
+
- 🌐 Cross-Collection Search - Search across all icon sets simultaneously
|
|
8
|
+
- 📦 Collection Filtering - Browse icons by specific collection (Material Design, FontAwesome, etc.)
|
|
9
|
+
- 🎯 Visual Preview - See selected icons directly in your field
|
|
10
|
+
- ⚙️ Configurable - Customize default collections, allowed sets, and icon sizes
|
|
11
|
+
- 🚀 Lightweight - No external dependencies, uses native Fetch API
|
|
12
|
+
- 🔒 CSP Compliant - Built-in proxy to bypass Content Security Policy restrictions
|
|
13
|
+
- ⚡ Smart Caching - Reduces API calls with intelligent caching
|
|
14
|
+
- 🛡️ Rate Limiting - Built-in rate limiting to prevent API abuse
|
|
15
|
+
|
|
16
|
+
## 📋 Requirements
|
|
17
|
+
- Directus 10.0.0 or higher
|
|
18
|
+
- Node.js 16.x or higher
|
|
19
|
+
|
|
20
|
+
## Screenshots
|
|
21
|
+

|
|
22
|
+

|
|
23
|
+

|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
## 🚀 Installation
|
|
27
|
+
Option 1: NPM Package (Recommended)
|
|
28
|
+
```
|
|
29
|
+
npm install directus-extension-iconify-picker
|
|
30
|
+
```
|
|
31
|
+
Option 2: Manual Installation
|
|
32
|
+
Download or clone this repository
|
|
33
|
+
```
|
|
34
|
+
git clone https://github.com/yourusername/directus-extension-iconify-picker.git
|
|
35
|
+
cd directus-extension-iconify-picker
|
|
36
|
+
```
|
|
37
|
+
Install dependencies
|
|
38
|
+
```
|
|
39
|
+
npm install
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Build the extension
|
|
43
|
+
```
|
|
44
|
+
npm run build
|
|
45
|
+
```
|
|
46
|
+
Copy to Directus extensions folder
|
|
47
|
+
```
|
|
48
|
+
# Copy the entire dist folder to your Directus extensions directory
|
|
49
|
+
cp -r dist /path/to/your/directus/extensions/simple-iconify-picker
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
# 🎯 Usage
|
|
53
|
+
## 1. Add Field to Collection
|
|
54
|
+
- Navigate to Settings → Data Model
|
|
55
|
+
- Select your collection or create a new one
|
|
56
|
+
- Click Create Field
|
|
57
|
+
- Choose Input → String as the field type
|
|
58
|
+
- In the Interface section, select Iconify Picker
|
|
59
|
+
- Configure options (see below)
|
|
60
|
+
- Save your field
|
|
61
|
+
|
|
62
|
+
## 2 . Configure Options
|
|
63
|
+
Default Icon Collection - Set the default collection that loads when opening the picker.
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
Default: mdi (Material Design Icons)
|
|
67
|
+
Examples: mdi, fa, heroicons, lucide
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Allowed Collections - Restrict the picker to specific icon collections. Leave empty to allow all collections.
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
Examples:
|
|
74
|
+
- mdi, fa, heroicons
|
|
75
|
+
- material-symbols, lucide, tabler
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Preview Icon Size - Set the size (in pixels) for icon previews.
|
|
79
|
+
```
|
|
80
|
+
Default: 24
|
|
81
|
+
Range: 16-64
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 3. Using in Your Application
|
|
85
|
+
The extension stores the icon identifier as a string in the format collection:icon-name.
|
|
86
|
+
|
|
87
|
+
Example stored value:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
mdi:home
|
|
91
|
+
fa:user
|
|
92
|
+
heroicons:bell
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
# 🎨 Popular Icon Collections
|
|
96
|
+
| Collection | Prefix | Icons | Description |
|
|
97
|
+
|---------------|-----------|-------|-------------|
|
|
98
|
+
|Material Design Icons | mdi | 7,000+ | Google's Material Design icons||
|
|
99
|
+
|Font Awesome |fa, fa6-solid |2,000+ |Popular icon toolkit|
|
|
100
|
+
|Heroicons |heroicons |300+ |Beautiful hand-crafted SVG icons|
|
|
101
|
+
|Lucide |lucide |1,000+ |Clean, consistent icon set|
|
|
102
|
+
|Bootstrap Icons |bi |1,800+| Official Bootstrap icons|
|
|
103
|
+
|Tabler Icons |tabler |4,000+| Customizable open-source icons|
|
|
104
|
+
|Feather |feather |280+| Simply beautiful icons|
|
|
105
|
+
|Phosphor |ph |6,000+| Flexible icon family|
|
|
106
|
+
|
|
107
|
+
[Browse all collections →](https://icon-sets.iconify.design/)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 🛠️ Development
|
|
111
|
+
Setup Development Environment
|
|
112
|
+
|
|
113
|
+
### Clone the repository
|
|
114
|
+
```
|
|
115
|
+
git clone https://github.com/yourusername/directus-extension-iconify-picker.git
|
|
116
|
+
cd directus-extension-iconify-picker
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Install dependencies
|
|
120
|
+
```
|
|
121
|
+
npm install
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Start development mode (watch for changes)
|
|
125
|
+
```
|
|
126
|
+
npm run dev
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Build for Production
|
|
130
|
+
```
|
|
131
|
+
npm run build
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Project Structure
|
|
135
|
+
```
|
|
136
|
+
simple-iconify-picker/
|
|
137
|
+
├── src/
|
|
138
|
+
│ ├── endpoint/
|
|
139
|
+
│ ├────── api.ts # API proxy endpoint entry point
|
|
140
|
+
│ ├── interface/
|
|
141
|
+
│ ├────── index.ts # Interface extension entry point
|
|
142
|
+
│ ├────── interface.vue # Main Vue component
|
|
143
|
+
│ ├────── types.ts # TypeScript type definitions
|
|
144
|
+
│ └────── shims.d.ts # TypeScript module declarations
|
|
145
|
+
├── package.json # Package configuration
|
|
146
|
+
├── tsconfig.json # TypeScript configuration
|
|
147
|
+
└── README.md # This file
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
# 🔧 Technical Details
|
|
151
|
+
## Bundle Architecture
|
|
152
|
+
This extension is built as a bundle containing two components:
|
|
153
|
+
|
|
154
|
+
Interface Extension (app.js) - The Vue-based UI component that runs in the Directus admin panel
|
|
155
|
+
Endpoint Extension (api.js) - A proxy API that handles requests to the Iconify API
|
|
156
|
+
## API Proxy Features
|
|
157
|
+
- **Rate Limiting**: 10 requests per minute per IP address
|
|
158
|
+
- **Caching**: 1-hour cache for collections and icons
|
|
159
|
+
- **Error Handling**: Graceful error handling with user-friendly messages
|
|
160
|
+
- **CSP Bypass**: Proxies requests to avoid Content Security Policy restrictions
|
|
161
|
+
|
|
162
|
+
## Endpoints
|
|
163
|
+
- **GET** /iconify-proxy/collections - Fetch all available icon collections
|
|
164
|
+
- **GET** /iconify-proxy/collection?prefix={prefix} - Fetch icons from a specific collection
|
|
165
|
+
- **GET** /iconify-proxy/search?query={query}&limit={limit} - Search across all icon sets
|
|
166
|
+
- **GET** /iconify-proxy/icon/{collection}/{icon}?height={height} - Fetch a specific icon as SVG
|
|
167
|
+
|
|
168
|
+
# 🐛 Troubleshooting
|
|
169
|
+
### Problem: The icon picker opens but no icons are displayed.
|
|
170
|
+
- Check your internet connection (Iconify API requires internet access)
|
|
171
|
+
- Verify that the extension is properly installed in the extensions folder
|
|
172
|
+
- Check browser console for error messages
|
|
173
|
+
- Ensure Directus has been restarted after installation
|
|
174
|
+
|
|
175
|
+
### Problem: Search doesn't filter icons or returns no results.
|
|
176
|
+
- When searching in a specific collection, ensure icons are loaded first
|
|
177
|
+
- For "All Icon Sets" search, type at least 2 characters
|
|
178
|
+
- Wait for the debounce delay (500ms for all sets, instant for single collection)
|
|
179
|
+
- Check for rate limiting errors in the console
|
|
180
|
+
|
|
181
|
+
### Problem: 429 Too Many Requests error - Getting rate limit errors from the API.
|
|
182
|
+
- The extension has built-in rate limiting (10 requests/minute)
|
|
183
|
+
- Wait a minute before trying again
|
|
184
|
+
- The cache should reduce API calls significantly
|
|
185
|
+
- Consider increasing the cache duration in endpoint-entry.ts
|
|
186
|
+
|
|
187
|
+
### Problem: Can't find "Iconify Picker" in the interface dropdown.
|
|
188
|
+
- Ensure both app.js and api.js are in the extensions folder
|
|
189
|
+
- Verify the extension folder structure is correct
|
|
190
|
+
- Restart your Directus instance
|
|
191
|
+
- Check Directus logs for extension loading errors
|
|
192
|
+
- Ensure the extension type is set to "bundle" in package.json
|
|
193
|
+
|
|
194
|
+
### Problem: Icon is selected but doesn't show in the field.
|
|
195
|
+
- Ensure the field type is set to String
|
|
196
|
+
- Check that the value is being saved correctly in the database
|
|
197
|
+
- Verify the icon identifier format is collection:icon-name
|
|
198
|
+
- Check browser console for image loading errors
|
|
199
|
+
|
|
200
|
+
# 🙏 Acknowledgments
|
|
201
|
+
- [Iconify](https://iconify.design/) - For providing the amazing icon API
|
|
202
|
+
- [Directus](https://directus.io/) - For the excellent headless CMS platform
|
|
203
|
+
- All icon set creators and maintainers
|
|
204
|
+
|
|
205
|
+
# 🔗 Links
|
|
206
|
+
- [Iconify API Documentation](https://iconify.design/docs/api/)
|
|
207
|
+
- [Directus Extensions Documentation](https://docs.directus.io/extensions/)
|
|
208
|
+
- [Browse Icon Collections](https://icon-sets.iconify.design/)
|
|
209
|
+
|
|
210
|
+
--------------------
|
|
211
|
+
Made with ❤️ for the Directus community
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "simple-iconify-picker",
|
|
3
|
+
"description": "Simple iconify picker interface for Directus",
|
|
4
|
+
"icon": "extension",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"directus",
|
|
8
|
+
"directus-extension",
|
|
9
|
+
"directus-extension-interface"
|
|
10
|
+
],
|
|
11
|
+
"type": "module",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"directus:extension": {
|
|
16
|
+
"type": "bundle",
|
|
17
|
+
"path": {
|
|
18
|
+
"app": "dist/app.js",
|
|
19
|
+
"api": "dist/api.js"
|
|
20
|
+
},
|
|
21
|
+
"entries": [
|
|
22
|
+
{
|
|
23
|
+
"type": "interface",
|
|
24
|
+
"name": "iconify-picker",
|
|
25
|
+
"source": "src/interface/index.ts"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"type": "endpoint",
|
|
29
|
+
"name": "iconify-proxy",
|
|
30
|
+
"source": "src/endpoint/api.ts"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"host": "^10.10.0"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "directus-extension build",
|
|
37
|
+
"dev": "directus-extension build -w --no-minify",
|
|
38
|
+
"link": "directus-extension link",
|
|
39
|
+
"validate": "directus-extension validate"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@directus/extensions-sdk": "17.0.4",
|
|
43
|
+
"typescript": "^5.9.3",
|
|
44
|
+
"vue": "^3.5.26"
|
|
45
|
+
}
|
|
46
|
+
}
|