reicon-mcp 1.0.1 → 1.1.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/core/index-builder.js +12 -10
- package/core/search.js +1118 -92
- package/data/icon-index.json +1 -1
- package/package.json +1 -1
- package/server/index.js +6 -6
package/core/index-builder.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
const W_KEYS = ['Outline', 'Filled'];
|
|
2
|
-
const SEARCH_ALIASES = {
|
|
3
|
-
x: ['close', 'dismiss', 'cancel'],
|
|
4
|
-
cart: ['shopping cart', 'shopping'],
|
|
5
|
-
trash: ['delete', 'remove', 'bin'],
|
|
6
|
-
settings: ['gear', 'cog'],
|
|
7
|
-
search: ['magnifier', 'find'],
|
|
8
|
-
user: ['profile', 'account', 'avatar'],
|
|
9
|
-
heart: ['love', 'favorite', 'like'],
|
|
10
|
-
};
|
|
11
2
|
function toPascalCase(str) {
|
|
12
3
|
return str
|
|
13
4
|
.split('-')
|
|
@@ -22,6 +13,17 @@ function stripSvgWrapper(code) {
|
|
|
22
13
|
function rewriteColors(svg) {
|
|
23
14
|
return svg.replace(/fill="white"/g, 'fill="currentColor"');
|
|
24
15
|
}
|
|
16
|
+
function generateTags(name, description) {
|
|
17
|
+
const tags = new Set();
|
|
18
|
+
for (const t of description)
|
|
19
|
+
tags.add(t);
|
|
20
|
+
const parts = name.split('-');
|
|
21
|
+
for (const part of parts) {
|
|
22
|
+
if (part.length > 1)
|
|
23
|
+
tags.add(part);
|
|
24
|
+
}
|
|
25
|
+
return [...tags];
|
|
26
|
+
}
|
|
25
27
|
export function buildIconIndex(data) {
|
|
26
28
|
const icons = [];
|
|
27
29
|
const categorySet = new Set();
|
|
@@ -49,7 +51,7 @@ export function buildIconIndex(data) {
|
|
|
49
51
|
name: iconKey,
|
|
50
52
|
pascal,
|
|
51
53
|
category: catKey,
|
|
52
|
-
tags:
|
|
54
|
+
tags: generateTags(iconKey, icon.description || []),
|
|
53
55
|
weights,
|
|
54
56
|
});
|
|
55
57
|
}
|