@nine-lab/nine-mu 0.1.281 → 0.1.283
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
|
@@ -5,7 +5,7 @@ import '@nine-lab/nine-util';
|
|
|
5
5
|
export class NineDiffPopup extends HTMLElement {
|
|
6
6
|
#dialog = null;
|
|
7
7
|
#tabContainer = null;
|
|
8
|
-
#filesMap = new Map(); // 각 탭(파일)별
|
|
8
|
+
#filesMap = new Map(); // 각 탭(파일)별 메타데이터 및 에디터 인스턴스를 관리할 고유 저장소
|
|
9
9
|
#host;
|
|
10
10
|
|
|
11
11
|
constructor() {
|
|
@@ -19,7 +19,7 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* 💡 기본 다이얼로그 및
|
|
22
|
+
* 💡 기본 다이얼로그 프레임 및 스타일 스케폴딩 렌더링
|
|
23
23
|
*/
|
|
24
24
|
#renderScaffolding() {
|
|
25
25
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
@@ -43,15 +43,23 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
43
43
|
display: flex;
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
}
|
|
46
|
+
/* 💡 nx-tab / nine-tab 프레임워크가 100% 자라나도록 높이 강제 배치 */
|
|
46
47
|
nine-tab {
|
|
47
48
|
flex: 1;
|
|
48
49
|
display: flex;
|
|
49
50
|
flex-direction: column;
|
|
50
51
|
height: 100%;
|
|
51
52
|
}
|
|
53
|
+
/* 💡 내부 에디터 가시성이 유실되어 숨겨지는 현상을 확실하게 방어 */
|
|
52
54
|
.diff-wrapper {
|
|
53
|
-
height: calc(80vh - 120px);
|
|
55
|
+
height: calc(80vh - 120px);
|
|
54
56
|
width: 100%;
|
|
57
|
+
display: block;
|
|
58
|
+
}
|
|
59
|
+
nine-diff {
|
|
60
|
+
display: block;
|
|
61
|
+
width: 100%;
|
|
62
|
+
height: 100%;
|
|
55
63
|
}
|
|
56
64
|
.footer {
|
|
57
65
|
display: flex;
|
|
@@ -88,17 +96,18 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
88
96
|
}
|
|
89
97
|
|
|
90
98
|
/**
|
|
91
|
-
* 💡 [
|
|
99
|
+
* 💡 [완벽 동적 빌딩 시스템]
|
|
100
|
+
* 백엔드 완료 시그널로부터 모아진 collectedFiles 가 들어오면, 런타임에 해당하는 탭만 정확하게 파싱하여 주입합니다.
|
|
92
101
|
* @param {Array} fileList - [{ layer: "MyBatis", full_path: "...", asis_source: "...", source: "..." }]
|
|
93
102
|
*/
|
|
94
103
|
async data(fileList) {
|
|
95
104
|
if (!Array.isArray(fileList) || fileList.length === 0) return this;
|
|
96
105
|
|
|
97
|
-
// 기존에
|
|
106
|
+
// 1. 기존에 잔존하던 동적 탭 컨텐츠 구성원 완전 청소
|
|
98
107
|
this.#tabContainer.innerHTML = "";
|
|
99
108
|
this.#filesMap.clear();
|
|
100
109
|
|
|
101
|
-
// 확장자 기반
|
|
110
|
+
// 확장자 기반 언어셋 하이라이팅 추론 헬퍼
|
|
102
111
|
const detectLanguage = (path) => {
|
|
103
112
|
const lower = (path || "").toLowerCase();
|
|
104
113
|
if (lower.endsWith('.xml')) return 'xml';
|
|
@@ -107,25 +116,32 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
107
116
|
return 'javascript';
|
|
108
117
|
};
|
|
109
118
|
|
|
110
|
-
//
|
|
119
|
+
// 2. 수신된 파일 명세 묶음 크기만큼 루프를 돌며 웹 컴포넌트 런타임 인스턴싱
|
|
111
120
|
fileList.forEach((file, index) => {
|
|
112
121
|
const { layer, full_path, asis_source, source } = file;
|
|
113
122
|
const lang = detectLanguage(full_path);
|
|
114
|
-
const caption = `${layer} (${full_path.split('/').pop()})`; // 탭 캡션 명세 (레이어명 + 파일명)
|
|
115
123
|
|
|
116
|
-
//
|
|
124
|
+
// 파일명만 추출하여 보기 좋게 캡션 가공
|
|
125
|
+
const fileName = full_path.split('/').pop() || "Unknown";
|
|
126
|
+
const caption = `${layer.toUpperCase()} (${fileName})`;
|
|
127
|
+
|
|
128
|
+
// A. <nine-tab-page> 엘리먼트 동적 생성 및 헤더 캡션 설정
|
|
117
129
|
const tabPage = document.createElement('nine-tab-page');
|
|
118
130
|
tabPage.setAttribute('caption', caption);
|
|
119
131
|
|
|
132
|
+
// B. 차분 레이아웃 정밀 래퍼 생성
|
|
120
133
|
const diffWrapper = document.createElement('div');
|
|
121
134
|
diffWrapper.className = 'diff-wrapper';
|
|
122
135
|
|
|
136
|
+
// C. <nine-diff> 소스 비교 전용 에디터 장치 인스턴싱
|
|
123
137
|
const diffView = document.createElement('nine-diff');
|
|
138
|
+
|
|
139
|
+
// D. 계층 하위 조립 및 완성된 컴포넌트 트리를 실제 탭 컨테이너에 피딩
|
|
124
140
|
diffWrapper.appendChild(diffView);
|
|
125
141
|
tabPage.appendChild(diffWrapper);
|
|
126
142
|
this.#tabContainer.appendChild(tabPage);
|
|
127
143
|
|
|
128
|
-
//
|
|
144
|
+
// E. 추후 [모두 저장] 작동시 순회 타겟 명세 확보를 위한 고유 맵 바인딩
|
|
129
145
|
const fileKey = `file_tab_${index}`;
|
|
130
146
|
this.#filesMap.set(fileKey, {
|
|
131
147
|
layer,
|
|
@@ -134,26 +150,34 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
134
150
|
diffView: diffView
|
|
135
151
|
});
|
|
136
152
|
|
|
137
|
-
//
|
|
153
|
+
// F. 동적으로 추가된 에디터 가상 장치가 준비 완료(ready) 상태를 발행하면 소스 코드 로드 기동
|
|
138
154
|
diffView.addEventListener('ready', () => {
|
|
139
155
|
diffView.initialize(asis_source || "", source || "", lang);
|
|
140
156
|
}, { once: true });
|
|
141
157
|
});
|
|
142
158
|
|
|
159
|
+
// 3. 렌더링 트리 결합 후 nine-tab 컴포넌트 자체 라이프사이클 엔진 강제 구동
|
|
160
|
+
setTimeout(() => {
|
|
161
|
+
if (typeof this.#tabContainer.initialize === 'function') {
|
|
162
|
+
this.#tabContainer.initialize();
|
|
163
|
+
}
|
|
164
|
+
}, 50);
|
|
165
|
+
|
|
143
166
|
return this;
|
|
144
167
|
}
|
|
145
168
|
|
|
146
169
|
/**
|
|
147
|
-
* 💡 [일괄
|
|
170
|
+
* 💡 [일괄 물리 파일 라이팅]
|
|
171
|
+
* 활성화된 모든 탭 영역의 우측 창(TO-BE) 최종 소스들을 취합하여 단 한 번의 일괄 요청으로 커밋
|
|
148
172
|
*/
|
|
149
173
|
async #handleConfirmAll() {
|
|
150
174
|
const payloadList = [];
|
|
151
175
|
|
|
152
|
-
//
|
|
176
|
+
// 관리용 맵 저장소를 순회하며 최종 수정본 코드 스냅샷 추출
|
|
153
177
|
for (const [key, fileObj] of this.#filesMap.entries()) {
|
|
154
178
|
const { diffView, fullPath, asisSource, layer } = fileObj;
|
|
155
179
|
|
|
156
|
-
// 사용자가 수정한 최종
|
|
180
|
+
// 사용자가 수정한 최종 우측 창 텍스트를 추출 (에디터 로드 전 예외 발생 시 원본 보호용 fallback)
|
|
157
181
|
const currentContent = diffView ? diffView.getContents() : asisSource;
|
|
158
182
|
|
|
159
183
|
payloadList.push({
|
|
@@ -165,15 +189,14 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
165
189
|
}
|
|
166
190
|
|
|
167
191
|
try {
|
|
168
|
-
//
|
|
169
|
-
// (컨트롤러 측 구조에 맞춰 묶음 발송 처리 하거나 루프를 활용하세요)
|
|
192
|
+
// 변경된 멀티 레이어 파일 묶음을 전송하는 일괄 일치 컨트롤러 API 최종 동기화
|
|
170
193
|
await api.post(`/nine-mu/source/generateJsonFileBatch`, { fileList: payloadList });
|
|
171
194
|
|
|
172
195
|
await nine.alert("요청하신 모든 파일의 소스 변경 사항이 성공적으로 반영되었습니다.");
|
|
173
|
-
this.#dialog.close();
|
|
196
|
+
this.#dialog.close(); // 팝업 모달 소멸
|
|
174
197
|
} catch (error) {
|
|
175
198
|
trace.error("일괄 파일 저장 처리 중 실패:", error);
|
|
176
|
-
nine.alert("소스 저장 중 오류가 발생했습니다.");
|
|
199
|
+
nine.alert("소스 일괄 저장 연동 중 치명적인 오류가 발생했습니다.");
|
|
177
200
|
}
|
|
178
201
|
}
|
|
179
202
|
|
|
@@ -182,4 +205,7 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
182
205
|
}
|
|
183
206
|
}
|
|
184
207
|
|
|
185
|
-
|
|
208
|
+
// 중복 등록 충돌 방지 처리 포함 등록
|
|
209
|
+
if (!customElements.get("nine-diff-popup")) {
|
|
210
|
+
customElements.define("nine-diff-popup", NineDiffPopup);
|
|
211
|
+
}
|
|
@@ -59,10 +59,8 @@ export class NotificationHandler {
|
|
|
59
59
|
break;
|
|
60
60
|
|
|
61
61
|
case "modify-source-brain-completed":
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.#openDiffPopup();
|
|
65
|
-
}
|
|
62
|
+
//trace.log(`[시그널 감지] 설계 완료`, data);
|
|
63
|
+
this.#openDiffPopup();
|
|
66
64
|
break;
|
|
67
65
|
}
|
|
68
66
|
}
|