m8-mcp-server 1.0.6 → 1.0.8

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.
Files changed (75) hide show
  1. package/dist/cli.d.ts +1 -1
  2. package/dist/cli.js +1 -13
  3. package/dist/docs/apis.d.ts +1 -1
  4. package/dist/docs/apis.js +9 -326
  5. package/dist/docs/components.d.ts +1 -1
  6. package/dist/docs/components.js +2 -186
  7. package/dist/docs/index.d.ts +1 -1
  8. package/dist/docs/index.js +18 -177
  9. package/dist/docs/loader.d.ts +1 -1
  10. package/dist/docs/loader.js +1 -165
  11. package/dist/docs/search.d.ts +1 -1
  12. package/dist/docs/search.js +2 -196
  13. package/dist/docs/standards.d.ts +1 -1
  14. package/dist/docs/standards.js +3 -134
  15. package/dist/docs/utils.d.ts +1 -1
  16. package/dist/docs/utils.js +3 -129
  17. package/dist/generator/card-component.d.ts +55 -0
  18. package/dist/generator/card-component.d.ts.map +1 -0
  19. package/dist/generator/card-component.js +262 -0
  20. package/dist/generator/header.d.ts +1 -1
  21. package/dist/generator/header.js +3 -83
  22. package/dist/generator/index.d.ts +1 -1
  23. package/dist/generator/index.js +283 -648
  24. package/dist/generator/vue-template.d.ts +1 -1
  25. package/dist/generator/vue-template.js +336 -1016
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +1 -73
  28. package/dist/recommend/index.d.ts +1 -1
  29. package/dist/recommend/index.js +2 -412
  30. package/dist/tools/generate-card-component.d.ts +16 -0
  31. package/dist/tools/generate-card-component.d.ts.map +1 -0
  32. package/dist/tools/generate-card-component.js +4 -0
  33. package/dist/tools/generate-code.d.ts +1 -1
  34. package/dist/tools/generate-code.js +39 -211
  35. package/dist/tools/get-api-info.d.ts +1 -1
  36. package/dist/tools/get-api-info.js +1 -65
  37. package/dist/tools/get-coding-standard.d.ts +1 -1
  38. package/dist/tools/get-coding-standard.js +1 -66
  39. package/dist/tools/get-component-info.d.ts +1 -1
  40. package/dist/tools/get-component-info.js +1 -60
  41. package/dist/tools/get-util-info.d.ts +1 -1
  42. package/dist/tools/get-util-info.js +1 -65
  43. package/dist/tools/index.d.ts +2 -1
  44. package/dist/tools/index.d.ts.map +1 -1
  45. package/dist/tools/index.js +3 -101
  46. package/dist/tools/recommend-solution.d.ts +1 -1
  47. package/dist/tools/recommend-solution.js +1 -67
  48. package/dist/tools/search-docs.d.ts +1 -1
  49. package/dist/tools/search-docs.js +1 -71
  50. package/dist/types/index.d.ts +74 -1
  51. package/dist/types/index.d.ts.map +1 -1
  52. package/dist/types/index.js +0 -8
  53. package/package.json +4 -2
  54. package/dist/cli.js.map +0 -1
  55. package/dist/docs/apis.js.map +0 -1
  56. package/dist/docs/components.js.map +0 -1
  57. package/dist/docs/index.js.map +0 -1
  58. package/dist/docs/loader.js.map +0 -1
  59. package/dist/docs/search.js.map +0 -1
  60. package/dist/docs/standards.js.map +0 -1
  61. package/dist/docs/utils.js.map +0 -1
  62. package/dist/generator/header.js.map +0 -1
  63. package/dist/generator/index.js.map +0 -1
  64. package/dist/generator/vue-template.js.map +0 -1
  65. package/dist/index.js.map +0 -1
  66. package/dist/recommend/index.js.map +0 -1
  67. package/dist/tools/generate-code.js.map +0 -1
  68. package/dist/tools/get-api-info.js.map +0 -1
  69. package/dist/tools/get-coding-standard.js.map +0 -1
  70. package/dist/tools/get-component-info.js.map +0 -1
  71. package/dist/tools/get-util-info.js.map +0 -1
  72. package/dist/tools/index.js.map +0 -1
  73. package/dist/tools/recommend-solution.js.map +0 -1
  74. package/dist/tools/search-docs.js.map +0 -1
  75. package/dist/types/index.js.map +0 -1
@@ -1,134 +1,3 @@
1
- /**
2
- * 编码规范查询
3
- * @作者 li peng
4
- * @创建时间 2024-12-29
5
- * @描述 实现编码规范信息的查询功能
6
- */
7
- /**
8
- * 获取编码规范
9
- * @param standards 规范文档映射
10
- * @param type 规范类型
11
- * @returns 规范文档或 null
12
- */
13
- export function getCodingStandard(standards, type) {
14
- if (type === 'all') {
15
- return Array.from(standards.values());
16
- }
17
- // 处理 project-structure 类型映射
18
- const typeMap = {
19
- 'project-structure': 'project-structure',
20
- 'project': 'project-structure'
21
- };
22
- const normalizedType = typeMap[type] || type;
23
- return standards.get(normalizedType) || null;
24
- }
25
- /**
26
- * 按关键词过滤规则
27
- * @param doc 规范文档
28
- * @param keyword 关键词
29
- * @returns 过滤后的规则数组
30
- */
31
- export function filterRulesByKeyword(doc, keyword) {
32
- const normalized = keyword.toLowerCase();
33
- return doc.rules.filter(rule => rule.title.toLowerCase().includes(normalized) ||
34
- rule.description.toLowerCase().includes(normalized) ||
35
- rule.id.toLowerCase().includes(normalized));
36
- }
37
- /**
38
- * 获取所有可用的规范类型
39
- * @param standards 规范文档映射
40
- * @returns 类型数组
41
- */
42
- export function getAvailableStandardTypes(standards) {
43
- return Array.from(standards.keys());
44
- }
45
- /**
46
- * 格式化编码规范为文本
47
- * @param doc 规范文档或文档数组
48
- * @param keyword 可选的关键词过滤
49
- * @returns 格式化的文本
50
- */
51
- export function formatCodingStandard(doc, keyword) {
52
- const lines = [];
53
- if (Array.isArray(doc)) {
54
- // 格式化所有规范的摘要
55
- lines.push('# M8 编码规范汇总');
56
- lines.push('');
57
- for (const d of doc) {
58
- lines.push(`## ${d.title}`);
59
- lines.push('');
60
- lines.push(d.description || '');
61
- lines.push('');
62
- lines.push(`包含 ${d.rules.length} 条规则`);
63
- lines.push('');
64
- // 列出前 5 条规则
65
- const rulesToShow = d.rules.slice(0, 5);
66
- for (const rule of rulesToShow) {
67
- lines.push(`- ${rule.title}`);
68
- }
69
- if (d.rules.length > 5) {
70
- lines.push(`- ... 还有 ${d.rules.length - 5} 条规则`);
71
- }
72
- lines.push('');
73
- }
74
- lines.push('使用 `get_coding_standard` 工具并指定 `type` 参数可获取具体类型的详细规范。');
75
- }
76
- else {
77
- // 格式化单个规范
78
- lines.push(`# ${doc.title}`);
79
- lines.push('');
80
- lines.push(doc.description || '');
81
- lines.push('');
82
- const rules = keyword ? filterRulesByKeyword(doc, keyword) : doc.rules;
83
- if (keyword && rules.length === 0) {
84
- lines.push(`未找到包含关键词 "${keyword}" 的规则。`);
85
- lines.push('');
86
- lines.push('所有可用规则:');
87
- for (const rule of doc.rules) {
88
- lines.push(`- ${rule.title}`);
89
- }
90
- }
91
- else {
92
- if (keyword) {
93
- lines.push(`找到 ${rules.length} 条包含 "${keyword}" 的规则:`);
94
- lines.push('');
95
- }
96
- for (const rule of rules) {
97
- lines.push(`## ${rule.title}`);
98
- lines.push('');
99
- lines.push(rule.description);
100
- lines.push('');
101
- if (rule.correctExample) {
102
- lines.push('### ✅ 正确示例');
103
- lines.push('```');
104
- lines.push(rule.correctExample);
105
- lines.push('```');
106
- lines.push('');
107
- }
108
- if (rule.incorrectExample) {
109
- lines.push('### ❌ 错误示例');
110
- lines.push('```');
111
- lines.push(rule.incorrectExample);
112
- lines.push('```');
113
- lines.push('');
114
- }
115
- }
116
- }
117
- }
118
- return lines.join('\n');
119
- }
120
- /**
121
- * 获取规范摘要
122
- * @param standards 规范文档映射
123
- * @returns 摘要文本
124
- */
125
- export function getStandardsSummary(standards) {
126
- const lines = ['# M8 编码规范', ''];
127
- for (const [type, doc] of standards) {
128
- lines.push(`- **${doc.title}** (${type}): ${doc.rules.length} 条规则`);
129
- }
130
- lines.push('');
131
- lines.push('使用 `get_coding_standard` 工具获取详细规范。');
132
- return lines.join('\n');
133
- }
134
- //# sourceMappingURL=standards.js.map
1
+ function i(n,s){if(s==="all")return Array.from(n.values());const r={"project-structure":"project-structure",project:"project-structure"}[s]||s;return n.get(r)||null}function u(n,s){const t=s.toLowerCase();return n.rules.filter(r=>r.title.toLowerCase().includes(t)||r.description.toLowerCase().includes(t)||r.id.toLowerCase().includes(t))}function p(n){return Array.from(n.keys())}function a(n,s){const t=[];if(Array.isArray(n)){t.push("# M8 \u7F16\u7801\u89C4\u8303\u6C47\u603B"),t.push("");for(const r of n){t.push(`## ${r.title}`),t.push(""),t.push(r.description||""),t.push(""),t.push(`\u5305\u542B ${r.rules.length} \u6761\u89C4\u5219`),t.push("");const e=r.rules.slice(0,5);for(const o of e)t.push(`- ${o.title}`);r.rules.length>5&&t.push(`- ... \u8FD8\u6709 ${r.rules.length-5} \u6761\u89C4\u5219`),t.push("")}t.push("\u4F7F\u7528 `get_coding_standard` \u5DE5\u5177\u5E76\u6307\u5B9A `type` \u53C2\u6570\u53EF\u83B7\u53D6\u5177\u4F53\u7C7B\u578B\u7684\u8BE6\u7EC6\u89C4\u8303\u3002")}else{t.push(`# ${n.title}`),t.push(""),t.push(n.description||""),t.push("");const r=s?u(n,s):n.rules;if(s&&r.length===0){t.push(`\u672A\u627E\u5230\u5305\u542B\u5173\u952E\u8BCD "${s}" \u7684\u89C4\u5219\u3002`),t.push(""),t.push("\u6240\u6709\u53EF\u7528\u89C4\u5219:");for(const e of n.rules)t.push(`- ${e.title}`)}else{s&&(t.push(`\u627E\u5230 ${r.length} \u6761\u5305\u542B "${s}" \u7684\u89C4\u5219:`),t.push(""));for(const e of r)t.push(`## ${e.title}`),t.push(""),t.push(e.description),t.push(""),e.correctExample&&(t.push("### \u2705 \u6B63\u786E\u793A\u4F8B"),t.push("```"),t.push(e.correctExample),t.push("```"),t.push("")),e.incorrectExample&&(t.push("### \u274C \u9519\u8BEF\u793A\u4F8B"),t.push("```"),t.push(e.incorrectExample),t.push("```"),t.push(""))}}return t.join(`
2
+ `)}function l(n){const s=["# M8 \u7F16\u7801\u89C4\u8303",""];for(const[t,r]of n)s.push(`- **${r.title}** (${t}): ${r.rules.length} \u6761\u89C4\u5219`);return s.push(""),s.push("\u4F7F\u7528 `get_coding_standard` \u5DE5\u5177\u83B7\u53D6\u8BE6\u7EC6\u89C4\u8303\u3002"),s.join(`
3
+ `)}export{u as filterRulesByKeyword,a as formatCodingStandard,p as getAvailableStandardTypes,i as getCodingStandard,l as getStandardsSummary};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Util 工具信息查询
3
3
  * @作者 li peng
4
- * @创建时间 2024-12-29
4
+ * @创建时间 2025-12-20
5
5
  * @描述 实现 Util 工具方法信息的查询功能
6
6
  */
7
7
  import type { UtilDoc, UtilMethod } from '../types/index.js';
@@ -1,129 +1,3 @@
1
- /**
2
- * Util 工具信息查询
3
- * @作者 li peng
4
- * @创建时间 2024-12-29
5
- * @描述 实现 Util 工具方法信息的查询功能
6
- */
7
- /**
8
- * 获取 Util 分类信息
9
- * @param utils Util 文档映射
10
- * @param category 分类名称
11
- * @returns Util 分类信息或 null
12
- */
13
- export function getUtilInfo(utils, category) {
14
- const normalized = category.toLowerCase().trim();
15
- return utils.get(normalized) || null;
16
- }
17
- /**
18
- * 获取 Util 方法信息
19
- * @param utils Util 文档映射
20
- * @param category 分类名称
21
- * @param methodName 方法名称
22
- * @returns Util 方法信息或 null
23
- */
24
- export function getUtilMethodInfo(utils, category, methodName) {
25
- const doc = getUtilInfo(utils, category);
26
- if (!doc)
27
- return null;
28
- const normalized = methodName.toLowerCase().trim();
29
- return doc.methods.find(m => m.name.toLowerCase() === normalized) || null;
30
- }
31
- /**
32
- * 获取所有可用的 Util 分类
33
- * @param utils Util 文档映射
34
- * @returns 分类名称数组
35
- */
36
- export function getAvailableCategories(utils) {
37
- return Array.from(utils.keys());
38
- }
39
- /**
40
- * 格式化 Util 信息为文本
41
- * @param doc Util 文档
42
- * @param methodName 可选的方法名称
43
- * @returns 格式化的文本
44
- */
45
- export function formatUtilInfo(doc, methodName) {
46
- const lines = [];
47
- if (methodName) {
48
- // 格式化单个方法
49
- const method = doc.methods.find(m => m.name.toLowerCase() === methodName.toLowerCase());
50
- if (!method) {
51
- return `方法 ${methodName} 不存在于 Util.${doc.category} 分类中。\n可用方法: ${doc.methods.map(m => m.name).join(', ')}`;
52
- }
53
- const prefix = doc.category === 'common' ? 'Util' : `Util.${doc.category}`;
54
- lines.push(`# ${prefix}.${method.name}`);
55
- lines.push('');
56
- lines.push(method.description);
57
- lines.push('');
58
- // 参数
59
- if (method.parameters.length > 0) {
60
- lines.push('## 参数');
61
- lines.push('');
62
- lines.push('| 参数 | 类型 | 必填 | 说明 |');
63
- lines.push('| --- | --- | --- | --- |');
64
- for (const param of method.parameters) {
65
- lines.push(`| ${param.name} | ${param.type} | ${param.required ? '是' : '否'} | ${param.description} |`);
66
- }
67
- lines.push('');
68
- }
69
- // 返回值
70
- lines.push('## 返回值');
71
- lines.push('');
72
- lines.push(`- 类型: \`${method.returnValue.type}\``);
73
- lines.push(`- 说明: ${method.returnValue.description}`);
74
- lines.push('');
75
- // 示例
76
- if (method.examples.length > 0) {
77
- lines.push('## 示例');
78
- lines.push('');
79
- for (const example of method.examples) {
80
- lines.push(`### ${example.title}`);
81
- if (example.description) {
82
- lines.push(example.description);
83
- }
84
- lines.push('```javascript');
85
- lines.push(example.code);
86
- lines.push('```');
87
- lines.push('');
88
- }
89
- }
90
- }
91
- else {
92
- // 格式化整个分类
93
- const prefix = doc.category === 'common' ? 'Util' : `Util.${doc.category}`;
94
- lines.push(`# ${prefix}`);
95
- lines.push('');
96
- lines.push(doc.description || doc.title);
97
- lines.push('');
98
- lines.push('## 方法列表');
99
- lines.push('');
100
- lines.push('| 方法 | 说明 |');
101
- lines.push('| --- | --- |');
102
- for (const method of doc.methods) {
103
- lines.push(`| ${method.name} | ${method.description} |`);
104
- }
105
- lines.push('');
106
- lines.push('使用 `get_util_info` 工具并指定 `method` 参数可获取具体方法的详细信息。');
107
- }
108
- return lines.join('\n');
109
- }
110
- /**
111
- * 搜索 Util 方法
112
- * @param utils Util 文档映射
113
- * @param query 搜索关键词
114
- * @returns 匹配的方法列表
115
- */
116
- export function searchUtilMethods(utils, query) {
117
- const results = [];
118
- const normalized = query.toLowerCase();
119
- for (const [category, doc] of utils) {
120
- for (const method of doc.methods) {
121
- if (method.name.toLowerCase().includes(normalized) ||
122
- method.description.toLowerCase().includes(normalized)) {
123
- results.push({ category, method });
124
- }
125
- }
126
- }
127
- return results;
128
- }
129
- //# sourceMappingURL=utils.js.map
1
+ function p(e,r){const t=r.toLowerCase().trim();return e.get(t)||null}function u(e,r,t){const s=p(e,r);if(!s)return null;const n=t.toLowerCase().trim();return s.methods.find(o=>o.name.toLowerCase()===n)||null}function h(e){return Array.from(e.keys())}function a(e,r){const t=[];if(r){const s=e.methods.find(o=>o.name.toLowerCase()===r.toLowerCase());if(!s)return`\u65B9\u6CD5 ${r} \u4E0D\u5B58\u5728\u4E8E Util.${e.category} \u5206\u7C7B\u4E2D\u3002
2
+ \u53EF\u7528\u65B9\u6CD5: ${e.methods.map(o=>o.name).join(", ")}`;const n=e.category==="common"?"Util":`Util.${e.category}`;if(t.push(`# ${n}.${s.name}`),t.push(""),t.push(s.description),t.push(""),s.parameters.length>0){t.push("## \u53C2\u6570"),t.push(""),t.push("| \u53C2\u6570 | \u7C7B\u578B | \u5FC5\u586B | \u8BF4\u660E |"),t.push("| --- | --- | --- | --- |");for(const o of s.parameters)t.push(`| ${o.name} | ${o.type} | ${o.required?"\u662F":"\u5426"} | ${o.description} |`);t.push("")}if(t.push("## \u8FD4\u56DE\u503C"),t.push(""),t.push(`- \u7C7B\u578B: \`${s.returnValue.type}\``),t.push(`- \u8BF4\u660E: ${s.returnValue.description}`),t.push(""),s.examples.length>0){t.push("## \u793A\u4F8B"),t.push("");for(const o of s.examples)t.push(`### ${o.title}`),o.description&&t.push(o.description),t.push("```javascript"),t.push(o.code),t.push("```"),t.push("")}}else{const s=e.category==="common"?"Util":`Util.${e.category}`;t.push(`# ${s}`),t.push(""),t.push(e.description||e.title),t.push(""),t.push("## \u65B9\u6CD5\u5217\u8868"),t.push(""),t.push("| \u65B9\u6CD5 | \u8BF4\u660E |"),t.push("| --- | --- |");for(const n of e.methods)t.push(`| ${n.name} | ${n.description} |`);t.push(""),t.push("\u4F7F\u7528 `get_util_info` \u5DE5\u5177\u5E76\u6307\u5B9A `method` \u53C2\u6570\u53EF\u83B7\u53D6\u5177\u4F53\u65B9\u6CD5\u7684\u8BE6\u7EC6\u4FE1\u606F\u3002")}return t.join(`
3
+ `)}function l(e,r){const t=[],s=r.toLowerCase();for(const[n,o]of e)for(const i of o.methods)(i.name.toLowerCase().includes(s)||i.description.toLowerCase().includes(s))&&t.push({category:n,method:i});return t}export{a as formatUtilInfo,h as getAvailableCategories,p as getUtilInfo,u as getUtilMethodInfo,l as searchUtilMethods};
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Card Component Generator
3
+ * @作者 Antigravity
4
+ * @创建时间 2026-01-04
5
+ * @描述 生成低码平台组件代码,包括 Vue、SCSS、Config 等文件
6
+ */
7
+ import { CardComponentGeneratedResult, CardComponentOptions } from '../types/index.js';
8
+ export declare class CardComponentGenerator {
9
+ /**
10
+ * 生成低码组件代码
11
+ * @param options 生成选项
12
+ */
13
+ generate(options: CardComponentOptions): CardComponentGeneratedResult;
14
+ /**
15
+ * 检测组件类型
16
+ */
17
+ private detectComponentType;
18
+ /**
19
+ * 生成配置项
20
+ */
21
+ private generateConfigs;
22
+ /**
23
+ * 生成 index.vue
24
+ */
25
+ private generateIndexVue;
26
+ /**
27
+ * 生成 index.js
28
+ */
29
+ private generateIndexJs;
30
+ /**
31
+ * 生成 css/index.scss
32
+ */
33
+ private generateScss;
34
+ /**
35
+ * 生成 js/base.js
36
+ */
37
+ private generateBaseJs;
38
+ /**
39
+ * 生成 js/config.js
40
+ */
41
+ private generateConfigJs;
42
+ /**
43
+ * 生成 mock/data.js
44
+ */
45
+ private generateMockData;
46
+ /**
47
+ * 生成 plugin/boxoptions/config.js
48
+ */
49
+ private generatePluginBoxOptions;
50
+ /**
51
+ * 生成 plugin/eventgenerate/index.js
52
+ */
53
+ private generatePluginEventGenerate;
54
+ }
55
+ //# sourceMappingURL=card-component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-component.d.ts","sourceRoot":"","sources":["../../src/generator/card-component.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACH,4BAA4B,EAC5B,oBAAoB,EAKvB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,sBAAsB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,oBAAoB,GAAG,4BAA4B;IAuErE;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAiB3B;;OAEG;IACH,OAAO,CAAC,eAAe;IAyIvB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA+FxB;;OAEG;IACH,OAAO,CAAC,eAAe;IAuBvB;;OAEG;IACH,OAAO,CAAC,YAAY;IAmBpB;;OAEG;IACH,OAAO,CAAC,cAAc;IAStB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA+GxB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAaxB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAqBhC;;OAEG;IACH,OAAO,CAAC,2BAA2B;CAQtC"}
@@ -0,0 +1,262 @@
1
+ class p{generate(a){const{componentName:n,description:i,displayName:t}=a,e=a.componentType||this.detectComponentType(i),o=this.generateConfigs(i,e,a.customConfigs),l=[{filename:"index.vue",relativePath:"index.vue",language:"vue",content:this.generateIndexVue(n,e)},{filename:"index.js",relativePath:"index.js",language:"javascript",content:this.generateIndexJs()},{filename:"index.scss",relativePath:"css/index.scss",language:"scss",content:this.generateScss()},{filename:"base.js",relativePath:"js/base.js",language:"javascript",content:this.generateBaseJs(n,t||n)},{filename:"config.js",relativePath:"js/config.js",language:"javascript",content:this.generateConfigJs(o)},{filename:"data.js",relativePath:"mock/data.js",language:"javascript",content:this.generateMockData()},{filename:"config.js",relativePath:"plugin/boxoptions/config.js",language:"javascript",content:this.generatePluginBoxOptions()},{filename:"index.js",relativePath:"plugin/eventgenerate/index.js",language:"javascript",content:this.generatePluginEventGenerate()}];return{componentName:n,files:l,createCommand:`npm run ioc create ${n}`,explanation:`\u5DF2\u751F\u6210\u7EC4\u4EF6 ${n} (${t||n}) \u7684\u5B8C\u6574\u4EE3\u7801\u3002
2
+ \u7EC4\u4EF6\u7C7B\u578B: ${e}
3
+ \u914D\u7F6E\u9879\u5305\u542B: ${o.map(s=>s.displayName||s.name).join(", ")}`}}detectComponentType(a){const n={chart:["\u56FE\u8868","\u67F1\u72B6","\u6298\u7EBF","\u997C\u56FE","echarts","\u7EDF\u8BA1","\u6570\u636E\u53EF\u89C6\u5316","\u5206\u6790"],form:["\u8868\u5355","\u8F93\u5165","\u9009\u62E9","\u63D0\u4EA4","\u586B\u5199","\u9A8C\u8BC1","search","\u641C\u7D22"],list:["\u5217\u8868","\u5361\u7247","\u6570\u636E\u5C55\u793A","\u5FAA\u73AF","\u904D\u5386","\u6E05\u5355"],basic:["\u6309\u94AE","\u6587\u5B57","\u56FE\u7247","\u56FE\u6807","\u6807\u9898","\u5BFC\u822A","banner","\u8F6E\u64AD","\u9876\u90E8","\u5E95\u90E8"]};for(const[i,t]of Object.entries(n))if(t.some(e=>a.toLowerCase().includes(e)))return i;return"custom"}generateConfigs(a,n,i=[]){const t=[],e=a.toLowerCase();return e.includes("\u5706\u89D2")&&t.push({displayName:"\u5706\u89D2",name:"radius",value:"0,0,0,0",type:"text",tip:"\u5DE6\u4E0A\u89D2\u3001\u53F3\u4E0A\u89D2\u3001\u53F3\u4E0B\u89D2\u3001\u5DE6\u4E0B\u89D2"}),(e.includes("\u989C\u8272")||e.includes("\u80CC\u666F"))&&(e.includes("\u6E10\u53D8")||e.includes("\u591A\u8272")?t.push({displayName:"\u914D\u8272",name:"colors",type:"colors",dynamic:!0,value:["#2ccbff"]}):t.push({name:"color",displayName:"\u989C\u8272",value:"rgba(18,137,221,1)",type:"color"})),e.includes("\u900F\u660E\u5EA6")&&t.push({name:"opacity",displayName:"\u900F\u660E\u5EA6",value:1,type:"range",min:0,max:1,step:.01}),(e.includes("\u56FE\u7247")||e.includes("icon")||e.includes("\u56FE\u6807"))&&t.push({name:"image",displayName:"\u56FE\u7247",value:"",type:"uploadimage"}),e.includes("\u89C6\u9891")&&t.push({name:"video",displayName:"\u89C6\u9891",value:"",type:"uploadvideo"}),(n==="list"||e.includes("\u5217\u8868")||e.includes("\u5FAA\u73AF"))&&t.push({name:"items",displayName:"\u5217\u8868\u9879",dynamic:!0,type:"array",value:[],template:{name:"item",displayName:"\u9879",value:[{name:"title",displayName:"\u6807\u9898",type:"text",value:"\u6807\u9898"}]}}),(e.includes("\u5F00\u5173")||e.includes("\u662F\u5426")||e.includes("\u52A8\u753B"))&&t.push({name:"enableEffect",displayName:"\u5F00\u542F\u7279\u6548",value:!0,type:"boolean"}),(e.includes("\u9009\u62E9")||e.includes("\u7C7B\u578B"))&&t.push({name:"type",displayName:"\u7C7B\u578B",type:"select",value:"option1",options:[{name:"\u9009\u98791",value:"option1"},{name:"\u9009\u98792",value:"option2"}]}),(e.includes("\u5730\u56FE")||e.includes("\u533A\u57DF"))&&t.push({name:"map",displayName:"\u5730\u56FE\u533A\u57DF",value:"320000",type:"area"}),t.length===0&&i.length===0&&t.push({displayName:"\u6807\u9898\u5185\u5BB9",name:"title",value:"\u9ED8\u8BA4\u6807\u9898",type:"text"}),[...t,...i]}generateIndexVue(a,n){return`<template>
4
+ <div class="epoint-component">
5
+ <div class="component-wrap" :style="[boxOptions]">
6
+ <!-- \u7EC4\u4EF6\u5185\u5BB9\u533A\u57DF -->
7
+ <div class="content">
8
+ {{ textContent }}
9
+ </div>
10
+ </div>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ // \u5C0F\u5C4F\u4F4E\u7801\u7EC4\u4EF6\u76F8\u5173\u914D\u7F6E
16
+ import '@boot';
17
+ import mockData from './mock/data';
18
+ import defaultConfig from './js/config';
19
+ import base from './js/base';
20
+ // \u4E8B\u4EF6\u4EA4\u4E92
21
+ import eventMixin from './plugin/eventgenerate';
22
+
23
+ export default {
24
+ name: base.module_name,
25
+ mixins: [eventMixin],
26
+ props: {
27
+ // mock\u4E2D\u7684data.js
28
+ data: {
29
+ type: Array,
30
+ default: () => {
31
+ return mockData.data;
32
+ }
33
+ },
34
+ // \u914D\u7F6E\u9879
35
+ config: {
36
+ type: Object
37
+ },
38
+ //\u83B7\u53D6\u7236\u7EA7\u7EC4\u4EF6\u6570\u636E
39
+ cdata: Object
40
+ },
41
+ data() {
42
+ return {
43
+ };
44
+ },
45
+ watch: {
46
+ },
47
+ computed: {
48
+ // \u6CE8\u610F\uFF1A\u4F7F\u7528el.style\u7B49\u64CD\u4F5CDOM\u7684\u65B9\u5F0F\u5728\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F\u4E0D\u652F\u6301
49
+ boxOptions() {
50
+ const { boxOptions } = this.config.options;
51
+ const boxmodel = boxOptions.boxmodel;
52
+ //\u6839\u636E\u5B9E\u9645\u60C5\u51B5\u8FDB\u884C\u5355\u4F4D\u4FEE\u6539
53
+ Object.keys(boxmodel).forEach((key) => {
54
+ if (!isNaN(Number(boxmodel[key]))) {
55
+ //\u662F\u7EAF\u6570\u5B57\u624D\u52A0\u5355\u4F4D
56
+ boxmodel[key] = boxmodel[key] + 'px';
57
+ }
58
+ });
59
+ return boxOptions;
60
+ },
61
+ myData() {
62
+ return this.data;
63
+ },
64
+ // \u793A\u4F8B\uFF1A\u83B7\u53D6\u914D\u7F6E\u9879\u4E2D\u7684\u6807\u9898
65
+ textContent() {
66
+ // \u6CE8\u610F\uFF1A\u8FD9\u91CC\u9700\u8981\u6839\u636E\u5B9E\u9645config.js\u4E2D\u7684\u7ED3\u6784\u6765\u83B7\u53D6
67
+ // \u5047\u8BBEconfig\u4E2D\u5B9A\u4E49\u4E86\u4E00\u4E2A\u540D\u4E3Atitle\u7684\u914D\u7F6E\u9879
68
+ // \u5982\u679Ctitle\u662F\u5728\u6700\u5916\u5C42options\u4E2D
69
+ const options = this.config.options;
70
+ // \u5C1D\u8BD5\u67E5\u627E title \u5B57\u6BB5\uFF0C\u5982\u679C\u4E0D\u5728\u9876\u5C42\u53EF\u80FD\u5728\u67D0\u4E2A\u5BF9\u8C61\u6570\u7EC4\u7684value\u4E2D
71
+ // \u8FD9\u91CC\u505A\u4E00\u4E2A\u7B80\u5355\u7684\u793A\u4F8B\u83B7\u53D6
72
+ return options.title && options.title.content ? options.title.content : (options.title || '\u9ED8\u8BA4\u5185\u5BB9');
73
+ }
74
+ },
75
+ created() {},
76
+ mounted() {
77
+ this.eventGenerate('onMounted', '\u7EC4\u4EF6\u52A0\u8F7D\u5B8C\u6210');
78
+ },
79
+ methods: {
80
+ handleClick() {
81
+ this.eventGenerate('onClick', { type: 'click' });
82
+ }
83
+ },
84
+ beforeDestroy() {},
85
+ // \u6240\u6709\u7EC4\u4EF6\u5FC5\u987B\u8BBE\u7F6E_getConfig\u548C_getMockData\uFF0C\u7528\u4E8E\u4F4E\u7801\u5E73\u53F0\u83B7\u53D6\u7EC4\u4EF6\u914D\u7F6E\u4FE1\u606F
86
+ _getConfig: () => defaultConfig,
87
+ _getMockData: () => mockData
88
+ };
89
+ </script>
90
+
91
+ <style lang="scss" scoped>
92
+ @import './css/index.scss';
93
+ </style>
94
+ `}generateIndexJs(){return`//\u6784\u5EFA\u5165\u53E3\uFF0C\u52FF\u52A8
95
+ import Component from './index.vue';
96
+
97
+ if (!Component.name) {
98
+ console.error('\u5361\u7247\u7EC4\u4EF6vue\u5185\u8BF7\u5B9A\u4E49name\u5B57\u6BB5\u540E\u91CD\u65B0\u6784\u5EFA\uFF01');
99
+ }
100
+ const install = function (Vue) {
101
+ Vue.component(Component.name, Component);
102
+ };
103
+
104
+ if (typeof window !== 'undefined' && window.Vue) {
105
+ install(window.Vue);
106
+ }
107
+
108
+ export { default as component } from './index.vue';
109
+
110
+ export default {
111
+ install
112
+ };
113
+ `}generateScss(){return`.epoint-component {
114
+ width: 100%;
115
+ height: 100%;
116
+
117
+ .component-wrap {
118
+ width: 100%;
119
+ height: 100%;
120
+ position: relative;
121
+ }
122
+
123
+ .content {
124
+ font-size: 14px;
125
+ color: #333;
126
+ }
127
+ }
128
+ `}generateBaseJs(a,n){return`export default {
129
+ name: '${n}', //\u7EC4\u4EF6\u540D\u79F0
130
+ module_name: '${a}', //\u9700\u8981\u548C\u7EC4\u4EF6\u6587\u4EF6\u5939\u540D\u5339\u914D
131
+ version: '1.0.0'
132
+ };
133
+ `}generateConfigJs(a){const n=JSON.stringify(a,null,4);return`import base from './base';
134
+ // \u901A\u7528\u5BB9\u5668\u6837\u5F0F
135
+ import boxOptions from '../plugin/boxoptions/config';
136
+
137
+ export default {
138
+ base,
139
+ dimension: {
140
+ width: '100%',
141
+ height: 'auto'
142
+ },
143
+ configuration: [
144
+ {
145
+ name: 'options',
146
+ displayName: '\u914D\u7F6E\u9879',
147
+ value: [
148
+ boxOptions,
149
+ ...${JSON.stringify(a,null,16).slice(1,-1).trim()}
150
+ ]
151
+ },
152
+ {
153
+ name: 'interaction',
154
+ displayName: '\u4EA4\u4E92',
155
+ value: [
156
+ {
157
+ name: 'callback',
158
+ displayName: '\u56DE\u8C03\u53C2\u6570',
159
+ type: 'array',
160
+ dynamic: true,
161
+ value: [],
162
+ template: {
163
+ name: 'callback',
164
+ displayName: '\u53C2\u6570',
165
+ value: [
166
+ {
167
+ name: 'param',
168
+ displayName: '\u53D8\u91CF\u540D',
169
+ type: 'text',
170
+ value: ''
171
+ },
172
+ {
173
+ name: 'field',
174
+ displayName: '\u5B57\u6BB5\u503C',
175
+ type: 'text',
176
+ value: ''
177
+ }
178
+ ]
179
+ }
180
+ },
181
+ {
182
+ name: 'event',
183
+ displayName: '\u4E8B\u4EF6\uFF08\u65B0\uFF09',
184
+ type: 'array',
185
+ value: [
186
+ {
187
+ name: 'onMounted',
188
+ displayName: 'onMounted\u4E8B\u4EF6',
189
+ dynamic: true,
190
+ type: 'array',
191
+ value: [],
192
+ template: {
193
+ name: 'templeteMounted_1',
194
+ displayName: '\u52A8\u4F5C',
195
+ type: 'text',
196
+ value: 'console.log("onMounted\u4E8B\u4EF6:", e)'
197
+ }
198
+ },
199
+ {
200
+ name: 'onClick',
201
+ displayName: 'onClick\u4E8B\u4EF6',
202
+ dynamic: true,
203
+ type: 'array',
204
+ value: [],
205
+ template: {
206
+ name: 'templeteOnClick_1',
207
+ displayName: '\u52A8\u4F5C',
208
+ type: 'text',
209
+ value: 'console.log("OnClick\u4E8B\u4EF6:", e)'
210
+ }
211
+ },
212
+ {
213
+ name: 'onChange',
214
+ displayName: 'onChange\u4E8B\u4EF6',
215
+ dynamic: true,
216
+ type: 'array',
217
+ value: [],
218
+ template: {
219
+ name: 'templeteOnChange_1',
220
+ displayName: '\u503C\u53D8\u52A8',
221
+ type: 'text',
222
+ value: 'console.log("onChange\u4E8B\u4EF6:", e)'
223
+ }
224
+ }
225
+ ]
226
+ }
227
+ ]
228
+ }
229
+ ]
230
+ };
231
+ `}generateMockData(){return`export default {
232
+ data: [ //\u8FD9\u4E00\u5C42\u52FF\u5220
233
+ {
234
+ // \u6A21\u62DF\u6570\u636E
235
+ id: 1,
236
+ title: '\u793A\u4F8B\u6570\u636E'
237
+ }
238
+ ]
239
+ };
240
+ `}generatePluginBoxOptions(){return`export default {
241
+ displayName: '\u76D2\u5B50\u95F4\u8DDD',
242
+ name: 'boxmodel',
243
+ tip: '\u8BBE\u7F6E\u76D2\u5B50\u7684\u5185\u5916\u95F4\u8DDD',
244
+ type: 'boxmodel',
245
+ //\u9ED8\u8BA4\u503C \u56FA\u5B9A\u683C\u5F0F
246
+ value: [
247
+ { name: 'marginTop', value: '0' },
248
+ { name: 'marginRight', value: '0' },
249
+ { name: 'marginBottom', value: '0' },
250
+ { name: 'marginLeft', value: '0' },
251
+ { name: 'paddingTop', value: '0' },
252
+ { name: 'paddingRight', value: '0' },
253
+ { name: 'paddingBottom', value: '0' },
254
+ { name: 'paddingLeft', value: '0' }
255
+ ]
256
+ };
257
+ `}generatePluginEventGenerate(){return`import eventGenerate from '@epoint-mrc/vue-cli-plugin-mc/src/mccontext/eventgenerate.js';
258
+
259
+ export default {
260
+ mixins: [eventGenerate]
261
+ };
262
+ `}}export{p as CardComponentGenerator};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 文件头注释生成器
3
3
  * @作者 li peng
4
- * @创建时间 2024-12-29
4
+ * @创建时间 2025-12-20
5
5
  * @描述 生成符合 M8 规范的文件头部注释
6
6
  */
7
7
  import type { HeaderOptions } from '../types/index.js';