@nine-lab/nine-mu 0.1.325 → 0.1.327
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/dist/nine-mu.js +31 -11
- package/dist/nine-mu.js.map +1 -1
- package/dist/nine-mu.umd.js +3 -3
- package/dist/nine-mu.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/NineChat.js +5 -1
- package/src/components/NotificationHandler.js +36 -22
package/package.json
CHANGED
|
@@ -50,6 +50,10 @@ export class NineChat extends HTMLElement {
|
|
|
50
50
|
this.#manager = new NineChatManager(this);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
get manager() {
|
|
54
|
+
return this.#manager;
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
// --- [그룹 1: Interaction] 화면 토글 및 메뉴 클릭 ---
|
|
54
58
|
#initInteractions() {
|
|
55
59
|
const $settings = this.shadowRoot.querySelector('nine-ai-settings');
|
|
@@ -126,7 +130,7 @@ export class NineChat extends HTMLElement {
|
|
|
126
130
|
const asis = await this.#manager.getRoutes();
|
|
127
131
|
|
|
128
132
|
/**
|
|
129
|
-
if (parsed?.selected_tool === "
|
|
133
|
+
if (parsed?.selected_tool === "generate-menu") {
|
|
130
134
|
const hasCreated = parsed?.data.some(item => item.action === 'CREATE');
|
|
131
135
|
const hasUpdated = parsed?.data.some(item => item.action === 'UPDATE');
|
|
132
136
|
const hasDeleted = parsed?.data.some(item => item.action === 'DELETE');
|
|
@@ -86,9 +86,7 @@ export class NotificationHandler {
|
|
|
86
86
|
if (this.#collectedFiles.length === 0) return;
|
|
87
87
|
|
|
88
88
|
const $oldPopup = this.#owner.shadowRoot.querySelector('nine-diff-popup');
|
|
89
|
-
if ($oldPopup)
|
|
90
|
-
$oldPopup.remove();
|
|
91
|
-
}
|
|
89
|
+
if ($oldPopup) $oldPopup.remove();
|
|
92
90
|
|
|
93
91
|
// DOM 상에 싱글톤 팝업 인스턴스 레이아웃 추출 및 빌드
|
|
94
92
|
|
|
@@ -107,6 +105,23 @@ export class NotificationHandler {
|
|
|
107
105
|
this.#collectedFiles = [];
|
|
108
106
|
};
|
|
109
107
|
|
|
108
|
+
#openRouteDiffPopup = (asis, tobe, lang) => {
|
|
109
|
+
// 1. 혹시 잔상이 남아있을지 모르니 기존에 생성된 팝업이 있다면 강제 제거
|
|
110
|
+
const $oldPopup = this.#owner.shadowRoot.querySelector('nine-menu-diff-popup');
|
|
111
|
+
if ($oldPopup) $oldPopup.remove();
|
|
112
|
+
|
|
113
|
+
// 2. 동적으로 커스텀 엘리먼트 생성
|
|
114
|
+
const $diffPopup = document.createElement('nine-menu-diff-popup');
|
|
115
|
+
|
|
116
|
+
// 3. 래퍼(wrapper) 안이나 shadowRoot 제일 밑바닥에 부착
|
|
117
|
+
const container = this.#owner.shadowRoot.querySelector('.wrapper') || this.shadowRoot;
|
|
118
|
+
container.appendChild($diffPopup);
|
|
119
|
+
|
|
120
|
+
// 4. 데이터 주입 및 팝업 실행
|
|
121
|
+
// 💡 팝업이 네이티브 <dialog> 기반이라면 .popup() 내부에서 showModal()이 실행될 겁니다.
|
|
122
|
+
$diffPopup.popup().data(asis, tobe, lang);
|
|
123
|
+
}
|
|
124
|
+
|
|
110
125
|
/**
|
|
111
126
|
* [분리 비즈니스 로직 2] 수신된 소스코드 데이터 유효성 검증 및 추후 파일 저장 연동
|
|
112
127
|
*/
|
|
@@ -126,25 +141,24 @@ export class NotificationHandler {
|
|
|
126
141
|
|
|
127
142
|
#generateMenu = async (data) => {
|
|
128
143
|
|
|
129
|
-
|
|
144
|
+
if (!data) return;
|
|
130
145
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
} */
|
|
146
|
+
const hasCreated = data.some(item => item.action === 'CREATE');
|
|
147
|
+
const hasUpdated = data.some(item => item.action === 'UPDATE');
|
|
148
|
+
const hasDeleted = data.some(item => item.action === 'DELETE');
|
|
149
|
+
|
|
150
|
+
if (hasUpdated || hasCreated || hasDeleted) {
|
|
151
|
+
|
|
152
|
+
const asis = await this.#owner.manager.getRoutes();
|
|
153
|
+
|
|
154
|
+
// 진짜 메뉴명 변경이나 이동만 요청한 경우
|
|
155
|
+
nine.alert("메뉴 정리를 위한 라우터 정보 저장 화면으로 이동합니다.").then(res => {
|
|
156
|
+
const tobe = (data || [])
|
|
157
|
+
.filter(item => item.action !== 'DELETE')
|
|
158
|
+
.map(({ isNew, action, ...rest }) => rest);
|
|
159
|
+
|
|
160
|
+
this.#openRouteDiffPopup(asis, tobe, "json");
|
|
161
|
+
});
|
|
162
|
+
}
|
|
149
163
|
}
|
|
150
164
|
}
|