@vezham/icons-mcp 27.0.2 → 27.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.
@@ -15,17 +15,16 @@ function sizeProp(size, framework) {
15
15
  return ` width="${size}" height="${size}"`;
16
16
  }
17
17
  function colorProp(color, framework) {
18
- if (framework === 'vue')
19
- return ` color="${color}"`;
20
- if (framework === 'html')
21
- return ` color="${color}"`;
22
18
  if (framework === 'svelte' ||
23
19
  framework === 'react' ||
24
20
  framework === 'react-native') {
25
- const val = color === 'currentColor' ? 'currentColor' : `"${color}"`;
26
- return ` color={${val}}`;
21
+ return ` color={${JSON.stringify(color)}}`;
27
22
  }
28
- return ` color="${color}"`;
23
+ const escaped = color
24
+ .replace(/&/g, '&')
25
+ .replace(/"/g, '"')
26
+ .replace(/</g, '&lt;');
27
+ return ` color="${escaped}"`;
29
28
  }
30
29
  export function generateCode(icon, input) {
31
30
  const size = input.size ?? 24;
@@ -39,41 +38,20 @@ export function generateCode(icon, input) {
39
38
  }
40
39
  const colorAttr = (framework) => hasColor ? colorProp(color, framework) : '';
41
40
  switch (input.framework) {
42
- case 'react': {
43
- const importStatement = `import { ${component} } from '@vezham/icons-react';`;
44
- const props = [
45
- sizeProp(size, 'react'),
46
- colorAttr('react'),
47
- weightProp(weight)
48
- ].join('');
49
- const docsSnippet = `<${component}${props} />`;
50
- return { importStatement, docsSnippet };
51
- }
52
- case 'react-native': {
53
- const importStatement = `import { ${component} } from '@vezham/icons-react-native';`;
54
- const props = [
55
- sizeProp(size, 'react-native'),
56
- colorAttr('react-native'),
57
- weightProp(weight)
58
- ].join('');
59
- const docsSnippet = `<${component}${props} />`;
60
- return { importStatement, docsSnippet };
61
- }
62
- case 'vue': {
63
- const importStatement = `import { ${component} } from '@vezham/icons-vue';`;
64
- const props = [
65
- sizeProp(size, 'vue'),
66
- colorAttr('vue'),
67
- weightProp(weight)
68
- ].join('');
69
- const docsSnippet = `<${component}${props} />`;
70
- return { importStatement, docsSnippet };
71
- }
41
+ case 'react':
42
+ case 'react-native':
43
+ case 'vue':
72
44
  case 'svelte': {
73
- const importStatement = `import { ${component} } from '@vezham/icons-svelte';`;
45
+ const framework = input.framework;
46
+ if (!/^[A-Z_$][\w$]*$/.test(component)) {
47
+ return {
48
+ error: 'Component names must be valid JSX component identifiers.'
49
+ };
50
+ }
51
+ const importStatement = `import ${component} from '@vezham/icons-${framework}/${icon.pascal}';`;
74
52
  const props = [
75
- sizeProp(size, 'svelte'),
76
- colorAttr('svelte'),
53
+ sizeProp(size, framework),
54
+ colorAttr(framework),
77
55
  weightProp(weight)
78
56
  ].join('');
79
57
  const docsSnippet = `<${component}${props} />`;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vezham/icons-mcp",
3
- "version": "1.0.7",
3
+ "version": "27.0.3",
4
4
  "type": "module",
5
5
  "description": "MCP server and CLI for browsing and applying Vezham icons.",
6
6
  "bin": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vezham/icons-mcp",
3
- "version": "27.0.2",
3
+ "version": "27.0.3",
4
4
  "description": "MCP server and CLI for browsing and applying Vezham icons.",
5
5
  "keywords": [
6
6
  "icons",