grapesjs-icon-set 1.0.0 → 1.0.3
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 +104 -0
- package/package.json +2 -2
package/Readme.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
|
|
2
|
+
# grapesjs-icon-set
|
|
3
|
+
|
|
4
|
+
A massive, high-performance icon library for **GrapesJS** featuring over 10,000+ SVG icons. This package includes multiple style variants (Round, Sharp, Two-Tone, etc.) organized for easy integration into the GrapesJS Block Manager and Asset Manager.
|
|
5
|
+
|
|
6
|
+
## Key Features
|
|
7
|
+
|
|
8
|
+
* **10,000+ Icons**: A complete set of professional icons.
|
|
9
|
+
* **Variant Support**: Access `round`, `sharp`, `twotone`, and `outlined` styles.
|
|
10
|
+
* **Tree-Shakeable**: Import only the icons you need to keep your bundle small.
|
|
11
|
+
* **GrapesJS Optimized**: Ready-to-use snippets for custom blocks and assets.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install the package into your project using npm:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install grapesjs-icon-set
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 🛠 Usage
|
|
27
|
+
|
|
28
|
+
### 1. Basic Import
|
|
29
|
+
|
|
30
|
+
Import the icon set into your GrapesJS configuration file:
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
import grapesjs from 'grapesjs';
|
|
34
|
+
import { icons } from 'grapesjs-icon-set';
|
|
35
|
+
import 'grapesjs/dist/css/grapes.min.css';
|
|
36
|
+
import grapesjsIconSet from 'grapesjs-icon-set';
|
|
37
|
+
|
|
38
|
+
const editor = grapesjs.init({
|
|
39
|
+
container: '#gjs',
|
|
40
|
+
plugins: [grapesjsIconSet],
|
|
41
|
+
pluginsOpts: {
|
|
42
|
+
[grapesjsIconSet]: {
|
|
43
|
+
category: 'UI Icons',
|
|
44
|
+
addDefaultIcons: false, // Set to false if you want to add icons manually for performance
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
// ... rest of your config
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 2. Adding Icons to the Block Manager
|
|
53
|
+
|
|
54
|
+
To let users drag icons into their canvas, add them as blocks:
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
editor.Blocks.add('icon-zoom-out', {
|
|
58
|
+
label: 'Zoom Out',
|
|
59
|
+
media: icons.zoom_out.round, // Use the SVG string from the package
|
|
60
|
+
content: {
|
|
61
|
+
type: 'svg',
|
|
62
|
+
content: icons.zoom_out.round,
|
|
63
|
+
attributes: { style: 'width: 50px; height: 50px;' }
|
|
64
|
+
},
|
|
65
|
+
category: 'Icons',
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 3. Integrating with Asset Manager
|
|
71
|
+
|
|
72
|
+
If you want to provide these as selectable images for users:
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
const am = editor.AssetManager;
|
|
76
|
+
|
|
77
|
+
am.add([
|
|
78
|
+
{ src: 'node_modules/grapesjs-icon-set/src/svg/home/round.svg', name: 'Home' },
|
|
79
|
+
{ src: 'node_modules/grapesjs-icon-set/src/svg/zoom_out/sharp.svg', name: 'Zoom Out' }
|
|
80
|
+
]);
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 📁 Directory Structure
|
|
87
|
+
|
|
88
|
+
Your installation includes the following organized paths:
|
|
89
|
+
grapesjs-icon-set/
|
|
90
|
+
├── dist/
|
|
91
|
+
│ ├── index.js # CommonJS build
|
|
92
|
+
│ └── index.esm.js # ES Module (Tree-shakeable)
|
|
93
|
+
├── src/
|
|
94
|
+
│ └── svg/ # Raw .svg source files
|
|
95
|
+
│ ├── home/
|
|
96
|
+
│ │ ├── round.svg
|
|
97
|
+
│ │ └── sharp.svg
|
|
98
|
+
└── icons.json # Manifest for metadata & searching
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 📄 License
|
|
103
|
+
|
|
104
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grapesjs-icon-set",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Custom SVG icon set plugin for GrapesJS",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
20
|
-
|
|
20
|
+
"build": "rollup -c"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@rollup/plugin-node-resolve": "^16.0.3",
|