reicon-mcp 1.0.0 → 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/cli/index.js CHANGED
@@ -94,7 +94,7 @@ export async function run(argv) {
94
94
  case 'apply': {
95
95
  const name = positional[1];
96
96
  if (!name) {
97
- console.error('Usage: reicon-mcp apply <name> --framework react|vue|svelte|html|svg');
97
+ console.error('Usage: reicon-mcp apply <name> --framework react|react-native|vue|svelte|html|svg [--weight Outline|Filled] [--size 24] [--color #hex] [--file path] [--marker "{/* ICON */}"]');
98
98
  process.exit(1);
99
99
  }
100
100
  const framework = flags.framework || 'react';
package/core/codegen.js CHANGED
@@ -10,7 +10,7 @@ function sizeProp(size, framework) {
10
10
  return ` :size="${size}"`;
11
11
  if (framework === 'html')
12
12
  return ` size="${size}"`;
13
- if (framework === 'svelte' || framework === 'react')
13
+ if (framework === 'svelte' || framework === 'react' || framework === 'react-native')
14
14
  return ` size={${size}}`;
15
15
  return ` width="${size}" height="${size}"`;
16
16
  }
@@ -19,7 +19,7 @@ function colorProp(color, framework) {
19
19
  return ` color="${color}"`;
20
20
  if (framework === 'html')
21
21
  return ` color="${color}"`;
22
- if (framework === 'svelte' || framework === 'react') {
22
+ if (framework === 'svelte' || framework === 'react' || framework === 'react-native') {
23
23
  const val = color === 'currentColor' ? 'currentColor' : `"${color}"`;
24
24
  return ` color={${val}}`;
25
25
  }
@@ -47,6 +47,16 @@ export function generateCode(icon, input) {
47
47
  const usageSnippet = `<${component}${props} />`;
48
48
  return { importStatement, usageSnippet };
49
49
  }
50
+ case 'react-native': {
51
+ const importStatement = `import { ${component} } from 'reicon-react-native';`;
52
+ const props = [
53
+ sizeProp(size, 'react-native'),
54
+ colorAttr('react-native'),
55
+ weightProp(weight, 'react-native'),
56
+ ].join('');
57
+ const usageSnippet = `<${component}${props} />`;
58
+ return { importStatement, usageSnippet };
59
+ }
50
60
  case 'vue': {
51
61
  const importStatement = `import { ${component} } from 'reicon-vue';`;
52
62
  const props = [
@@ -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: [...(icon.description || []), ...(SEARCH_ALIASES[iconKey] || [])],
54
+ tags: generateTags(iconKey, icon.description || []),
53
55
  weights,
54
56
  });
55
57
  }