@nine-lab/nine-mu 0.1.17 → 0.1.19

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.
@@ -0,0 +1,63 @@
1
+ export class NineDiffContainer extends HTMLElement {
2
+ #asis = "";
3
+ #tobe = "";
4
+ #lang = "javascript";
5
+ #diffView = null;
6
+
7
+ constructor() {
8
+ super();
9
+ this.attachShadow({ mode: 'open' });
10
+ }
11
+
12
+ /**
13
+ * 단일 비교 데이터를 설정합니다.
14
+ * @param {Object} data - { asis, tobe, lang }
15
+ */
16
+ setData = ({ asis, tobe, lang }) => {
17
+ this.#asis = asis || "";
18
+ this.#tobe = tobe || "";
19
+ this.#lang = lang || "javascript";
20
+
21
+ this.render();
22
+ }
23
+
24
+ // 최종 결과물(사용자가 편집한 ASIS 내용)을 가져옵니다.
25
+ getContents = () => {
26
+ return this.#diffView ? this.#diffView.getContents() : this.#asis;
27
+ }
28
+
29
+ render() {
30
+ this.shadowRoot.innerHTML = `
31
+ <style>
32
+ :host {
33
+ display: block;
34
+ width: 100%;
35
+ height: 100%;
36
+ border: 1px solid #ddd;
37
+ background: #fff;
38
+ }
39
+ .diff-wrapper {
40
+ width: 100%;
41
+ height: 100%;
42
+ overflow: hidden;
43
+ }
44
+ nine-diff {
45
+ width: 100%;
46
+ height: 100%;
47
+ }
48
+ </style>
49
+ <div class="diff-wrapper">
50
+ <nine-diff id="single-diff"></nine-diff>
51
+ </div>
52
+ `;
53
+
54
+ this.#diffView = this.shadowRoot.querySelector('#single-diff');
55
+
56
+ // 데이터 주입 (DOM이 렌더링된 직후 실행)
57
+ if (this.#diffView) {
58
+ this.#diffView.initialize(this.#asis, this.#tobe, this.#lang);
59
+ }
60
+ }
61
+ }
62
+
63
+ customElements.define("nine-diff-container", NineDiffContainer);
File without changes
package/src/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  import { trace } from '@nine-lab/nine-util';
2
2
  import { NineChat } from './components/NineChat.js';
3
+ import { NineDiff } from './components/NineDiff.js';
4
+ import { NineDiffContainer } from './components/NineDiffContainer.js';
5
+ import { NineDialog } from './components/NineDialog.js';
3
6
 
4
7
  /**
5
8
  * Nine-Mu 엔진 메인 클래스
@@ -14,4 +17,4 @@ export const NineMu = {
14
17
 
15
18
  // 기본 export 및 컴포넌트 export
16
19
  export default NineMu;
17
- export { NineChat };
20
+ export { NineChat, NineDiff, NineDiffContainer, NineDialog };
@@ -1,4 +1,4 @@
1
- import { nine, trace } from '@nine-lab/nine-util';
1
+ import { nine, trace, api } from '@nine-lab/nine-util';
2
2
 
3
3
  export class NineMuService {
4
4
  constructor(connectorUrl) {
@@ -39,6 +39,85 @@ export class NineMuService {
39
39
  }
40
40
  }
41
41
 
42
+ #getSourcePath = (menuUrl) => {
43
+ return null;
44
+ };
45
+
46
+ async generateAll(command) {
47
+
48
+ }
49
+
50
+ async generateAll_BAK(command, targets, currentRoutes) {
51
+ /**
52
+ api.post("/nine-mu/source/read", { menuUrl : "/admin/payment/order-list", feProjectName: pkg.name }).then((res) => {
53
+ trace.log(res);
54
+ }); */
55
+
56
+ try {
57
+ trace.log(`공정 시작: "${command}" [대상: ${targets.join(', ')}]`);
58
+
59
+ /**
60
+ * return {
61
+ * package: packageName,
62
+ * namespace: namespace,
63
+ * baseClass: fileName,
64
+ * //resultType: this.#parent.config.basePackage.split(".").slice(0, -1).join(".") + ".core.utils.CamelCaseMap",
65
+ * resultType: "com.ninelab.ai.util.CamelCaseMap",
66
+ * mybatis: `${cleaned.split(".").slice(0, -1).join("/")}/${fileName}Mapper.xml`,
67
+ * //javascript: `${javascript}.jsx`,
68
+ * //javascriptFrom: `${javascriptFrom}.jsx`,
69
+ * //javascriptTo: `${javascriptTo}.jsx`,
70
+ * classFrom: classFrom,
71
+ * classTo: classTo,
72
+ * activeIndex: activeIndex,
73
+ * emptyIndex: emptyIndex,
74
+ * mybatisPullPath: `${this.#parent.settings.beProjectName}/src/main/resources/mapper/${cleaned.split(".").slice(0, -1).join("/")}/${fileName}Mapper.xml`,
75
+ * controllerPullPath: `${this.#parent.settings.beProjectName}/src/main/java/${packageName.replaceAll(".", "/")}/controller/${fileName}Controller.java`,
76
+ * servicePullPath: `${this.#parent.settings.beProjectName}/src/main/java/${packageName.replaceAll(".", "/")}/service/${fileName}Service.java`,
77
+ * //javascriptPullPath: `${this.#parent.settings.feProjectName}${javascript}.jsx`,
78
+ * javascriptFrom: `${this.#parent.settings.feProjectName}/src/views/${javascriptFrom}.jsx`,
79
+ * javascriptTo: `${this.#parent.settings.feProjectName}/src/views/${javascriptTo}.jsx`,
80
+ * };
81
+ */
82
+ const srcPath = this.#getSourcePath("/admin/payment/order-list");
83
+ const srcPath1 = {
84
+ mybatis : "",
85
+ servicePullPath : "",
86
+ controllerPullPath : "",
87
+ javascriptFrom : "",
88
+ javascriptTo : "",
89
+ };
90
+
91
+ trace.log(srcPath);
92
+ const src = await api.post("/nine-ai/source/read", srcPath);
93
+ trace.log(src);
94
+
95
+ const response = await fetch(`${this.connectorUrl}/api/mu/generateAll`, {
96
+ method: 'POST',
97
+ headers: { 'Content-Type': 'application/json' },
98
+ body: JSON.stringify({
99
+ //command,
100
+ //targets,
101
+ projectType: 'spring-react',
102
+ //currentRoutes
103
+ })
104
+ });
105
+
106
+ trace.log(response);
107
+
108
+ const result = await response.json();
109
+
110
+ if (!result.success) {
111
+ throw new Error(result.error || "소스 생성 중 서버 오류가 발생했습니다.");
112
+ }
113
+
114
+ return result;
115
+ } catch (error) {
116
+ trace.error("NineMu Service Error:", error);
117
+ throw error;
118
+ }
119
+ }
120
+
42
121
  /**
43
122
  * 초기 경로 정보 로드
44
123
  */