reicon-mcp 1.1.0 → 1.1.102
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 +1 -1
- package/cli/index.js +3 -3
- package/core/codegen.js +13 -13
- package/core/types.d.ts +1 -1
- package/data/icon-index.json +1 -1
- package/package.json +1 -1
- package/server/index.js +4 -4
- package/server/tools/apply-icon.d.ts +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ Or point directly at the local binary after building:
|
|
|
36
36
|
| :--- | :--- |
|
|
37
37
|
| `search_icons` | Rank icons by keyword |
|
|
38
38
|
| `view_icon` | Return raw SVG markup and metadata |
|
|
39
|
-
| `apply_icon` | Generate framework-specific import and
|
|
39
|
+
| `apply_icon` | Generate framework-specific import and docs snippets |
|
|
40
40
|
| `list_categories` | List all icon categories |
|
|
41
41
|
|
|
42
42
|
## CLI
|
package/cli/index.js
CHANGED
|
@@ -28,13 +28,13 @@ function parseArgs(argv) {
|
|
|
28
28
|
function print(data) {
|
|
29
29
|
console.log(JSON.stringify(data, null, 2));
|
|
30
30
|
}
|
|
31
|
-
function applyToFile(filePath, marker, importStatement,
|
|
31
|
+
function applyToFile(filePath, marker, importStatement, docsSnippet) {
|
|
32
32
|
const content = readFileSync(filePath, 'utf-8');
|
|
33
33
|
if (!content.includes(marker)) {
|
|
34
34
|
console.error(`Marker not found in ${filePath}: ${marker}`);
|
|
35
35
|
process.exit(1);
|
|
36
36
|
}
|
|
37
|
-
let updated = content.replace(marker,
|
|
37
|
+
let updated = content.replace(marker, docsSnippet);
|
|
38
38
|
if (importStatement && !updated.includes(importStatement)) {
|
|
39
39
|
const lines = updated.split('\n');
|
|
40
40
|
let insertAt = 0;
|
|
@@ -112,7 +112,7 @@ export async function run(argv) {
|
|
|
112
112
|
process.exit(1);
|
|
113
113
|
}
|
|
114
114
|
if (flags.file && flags.marker) {
|
|
115
|
-
applyToFile(flags.file, flags.marker, result.importStatement, result.
|
|
115
|
+
applyToFile(flags.file, flags.marker, result.importStatement, result.docsSnippet);
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
118
|
print(result);
|
package/core/codegen.js
CHANGED
|
@@ -44,8 +44,8 @@ export function generateCode(icon, input) {
|
|
|
44
44
|
colorAttr('react'),
|
|
45
45
|
weightProp(weight, 'react'),
|
|
46
46
|
].join('');
|
|
47
|
-
const
|
|
48
|
-
return { importStatement,
|
|
47
|
+
const docsSnippet = `<${component}${props} />`;
|
|
48
|
+
return { importStatement, docsSnippet };
|
|
49
49
|
}
|
|
50
50
|
case 'react-native': {
|
|
51
51
|
const importStatement = `import { ${component} } from 'reicon-react-native';`;
|
|
@@ -54,8 +54,8 @@ export function generateCode(icon, input) {
|
|
|
54
54
|
colorAttr('react-native'),
|
|
55
55
|
weightProp(weight, 'react-native'),
|
|
56
56
|
].join('');
|
|
57
|
-
const
|
|
58
|
-
return { importStatement,
|
|
57
|
+
const docsSnippet = `<${component}${props} />`;
|
|
58
|
+
return { importStatement, docsSnippet };
|
|
59
59
|
}
|
|
60
60
|
case 'vue': {
|
|
61
61
|
const importStatement = `import { ${component} } from 'reicon-vue';`;
|
|
@@ -64,8 +64,8 @@ export function generateCode(icon, input) {
|
|
|
64
64
|
colorAttr('vue'),
|
|
65
65
|
weightProp(weight, 'vue'),
|
|
66
66
|
].join('');
|
|
67
|
-
const
|
|
68
|
-
return { importStatement,
|
|
67
|
+
const docsSnippet = `<${component}${props} />`;
|
|
68
|
+
return { importStatement, docsSnippet };
|
|
69
69
|
}
|
|
70
70
|
case 'svelte': {
|
|
71
71
|
const importStatement = `import { ${component} } from 'reicon-svelte';`;
|
|
@@ -74,24 +74,24 @@ export function generateCode(icon, input) {
|
|
|
74
74
|
colorAttr('svelte'),
|
|
75
75
|
weightProp(weight, 'svelte'),
|
|
76
76
|
].join('');
|
|
77
|
-
const
|
|
78
|
-
return { importStatement,
|
|
77
|
+
const docsSnippet = `<${component}${props} />`;
|
|
78
|
+
return { importStatement, docsSnippet };
|
|
79
79
|
}
|
|
80
80
|
case 'html': {
|
|
81
|
-
const importStatement = '<script src="https://unpkg.com/reicon/cdn/reicon.
|
|
81
|
+
const importStatement = '<script src="https://unpkg.com/reicon/cdn/reicon.js"></script>';
|
|
82
82
|
const props = [
|
|
83
83
|
` icon="${icon.name}"`,
|
|
84
84
|
sizeProp(size, 'html'),
|
|
85
85
|
colorAttr('html'),
|
|
86
86
|
weightProp(weight, 'html'),
|
|
87
87
|
].join('');
|
|
88
|
-
const
|
|
89
|
-
return { importStatement,
|
|
88
|
+
const docsSnippet = `<re-icon${props}></re-icon>`;
|
|
89
|
+
return { importStatement, docsSnippet };
|
|
90
90
|
}
|
|
91
91
|
case 'svg': {
|
|
92
92
|
const importStatement = '';
|
|
93
|
-
const
|
|
94
|
-
return { importStatement,
|
|
93
|
+
const docsSnippet = `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="${weightData.viewBox}" fill="none">${weightData.code}</svg>`;
|
|
94
|
+
return { importStatement, docsSnippet };
|
|
95
95
|
}
|
|
96
96
|
default:
|
|
97
97
|
return { error: `Unknown framework: ${input.framework}` };
|
package/core/types.d.ts
CHANGED