@nine-lab/nine-mu 0.1.325 → 0.1.326

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