@nine-lab/nine-mu 0.1.288 → 0.1.290
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 +34 -72
- package/dist/nine-mu.js.map +1 -1
- package/dist/nine-mu.umd.js +1 -1
- package/dist/nine-mu.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/NineDiffPopup.js +40 -77
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
|
-
#fileList = []; // 최종
|
|
8
|
+
#fileList = []; // 최종 일괄 저장을 위한 데이터 버퍼
|
|
9
9
|
#host;
|
|
10
10
|
|
|
11
11
|
constructor() {
|
|
@@ -19,7 +19,8 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* 💡
|
|
22
|
+
* 💡 [기존 방식 복구] 스타일 전량 제거하고,
|
|
23
|
+
* 기존 소스처럼 nine-tab 내부에 nine-tab-page 2개를 정적으로 미리 박아 놓습니다.
|
|
23
24
|
*/
|
|
24
25
|
#renderScaffolding() {
|
|
25
26
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
@@ -29,55 +30,21 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
29
30
|
<style>
|
|
30
31
|
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${appVersion}/dist/css/nine-mu.css";
|
|
31
32
|
${customImport}
|
|
32
|
-
|
|
33
|
-
.main-layout {
|
|
34
|
-
display: flex;
|
|
35
|
-
flex-direction: column;
|
|
36
|
-
height: 80vh;
|
|
37
|
-
width: 85vw;
|
|
38
|
-
min-width: 800px;
|
|
39
|
-
}
|
|
40
|
-
.tab-area {
|
|
41
|
-
flex: 1;
|
|
42
|
-
overflow: hidden;
|
|
43
|
-
display: flex;
|
|
44
|
-
flex-direction: column;
|
|
45
|
-
}
|
|
46
|
-
nine-tab {
|
|
47
|
-
flex: 1;
|
|
48
|
-
display: flex;
|
|
49
|
-
flex-direction: column;
|
|
50
|
-
height: 100%;
|
|
51
|
-
}
|
|
52
|
-
/* 💡 에디터 영역의 가시성 및 너비/높이 한계선 고정 */
|
|
53
|
-
.diff-wrapper {
|
|
54
|
-
height: calc(80vh - 160px);
|
|
55
|
-
width: 100%;
|
|
56
|
-
display: block;
|
|
57
|
-
}
|
|
58
|
-
nine-diff {
|
|
59
|
-
display: block;
|
|
60
|
-
width: 100%;
|
|
61
|
-
height: 100%;
|
|
62
|
-
}
|
|
63
|
-
.footer {
|
|
64
|
-
display: flex;
|
|
65
|
-
justify-content: flex-end;
|
|
66
|
-
gap: 10px;
|
|
67
|
-
padding: 15px 0 0 0;
|
|
68
|
-
border-top: 1px solid #e5e7eb;
|
|
69
|
-
}
|
|
70
33
|
</style>
|
|
71
34
|
|
|
72
35
|
<nine-dialog>
|
|
73
|
-
<
|
|
74
|
-
<
|
|
75
|
-
<nine-
|
|
76
|
-
</
|
|
77
|
-
<
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
36
|
+
<nine-tab theme="theme-3">
|
|
37
|
+
<nine-tab-page caption="MYBATIS">
|
|
38
|
+
<nine-diff class="MyBatis"></nine-diff>
|
|
39
|
+
</nine-tab-page>
|
|
40
|
+
<nine-tab-page caption="JAVASCRIPT">
|
|
41
|
+
<nine-diff class="JavaScript"></nine-diff>
|
|
42
|
+
</nine-tab-page>
|
|
43
|
+
</nine-tab>
|
|
44
|
+
|
|
45
|
+
<div class="footer">
|
|
46
|
+
<button class="btn btn-cancel">취소</button>
|
|
47
|
+
<button class="btn btn-confirm">모두 저장</button>
|
|
81
48
|
</div>
|
|
82
49
|
</nine-dialog>
|
|
83
50
|
`;
|
|
@@ -95,17 +62,13 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
95
62
|
}
|
|
96
63
|
|
|
97
64
|
/**
|
|
98
|
-
* 💡 [
|
|
65
|
+
* 💡 [기존 정적 매핑 방식]
|
|
66
|
+
* 동적 생성 없이, 이미 조립되어 들어간 nine-tab 내부의 에디터를 정밀 타격하여 데이터만 꽂습니다.
|
|
99
67
|
*/
|
|
100
68
|
async data(fileList) {
|
|
101
69
|
if (!Array.isArray(fileList) || fileList.length === 0) return this;
|
|
102
70
|
this.#fileList = fileList;
|
|
103
71
|
|
|
104
|
-
// 1. 🧼 기존 동적 버퍼 완전 리셋
|
|
105
|
-
if (this.#tabContainer && typeof this.#tabContainer.clearTabs === 'function') {
|
|
106
|
-
this.#tabContainer.clearTabs();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
72
|
const detectLanguage = (path) => {
|
|
110
73
|
const lower = (path || "").toLowerCase();
|
|
111
74
|
if (lower.endsWith('.xml')) return 'xml';
|
|
@@ -114,40 +77,40 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
114
77
|
return 'javascript';
|
|
115
78
|
};
|
|
116
79
|
|
|
117
|
-
//
|
|
118
|
-
|
|
119
|
-
const { layer, full_path } = file;
|
|
120
|
-
const fileName = full_path.split('/').pop() || "Unknown";
|
|
121
|
-
const captionName = `${layer.toUpperCase()} (${fileName})`;
|
|
122
|
-
|
|
123
|
-
// 💡 탭 내부에 주입될 에디터 뼈대 마크업 준비
|
|
124
|
-
const targetHtmlContent = `
|
|
125
|
-
<div class="diff-wrapper">
|
|
126
|
-
<nine-diff class="${layer}"></nine-diff>
|
|
127
|
-
</div>
|
|
128
|
-
`;
|
|
129
|
-
|
|
130
|
-
if (this.#tabContainer && typeof this.#tabContainer.addTabPage === 'function') {
|
|
131
|
-
this.#tabContainer.addTabPage(captionName, targetHtmlContent);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
// 3. ⏰ [핵심 수정]: 마운트 완료 후, nine-tab의 Shadow DOM 내부로 깊숙이 파고들어 에디터를 셀렉팅합니다.
|
|
80
|
+
// 💡 중요: nine-tab의 #renderTabs()와 #init()이 끝난 뒤
|
|
81
|
+
// 섀도우 돔 내부(.tab-pages)로 이사 간 에디터 인스턴스들을 정확하게 추적합니다.
|
|
136
82
|
setTimeout(() => {
|
|
137
83
|
fileList.forEach((file) => {
|
|
138
84
|
const { layer, full_path, asis_source, source } = file;
|
|
139
85
|
|
|
140
|
-
// 🎯
|
|
86
|
+
// 🎯 렌더링이 완료된 실제 단말 장치는 nine-tab의 shadowRoot 안에 박혀 있습니다.
|
|
141
87
|
const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
|
|
142
88
|
|
|
143
89
|
if (diff) {
|
|
144
90
|
const lang = detectLanguage(full_path);
|
|
91
|
+
|
|
92
|
+
// 탭 버튼의 상단 텍스트(캡션)도 실제 파일명에 맞춰 동기화 시켜줍니다.
|
|
93
|
+
const fileName = full_path.split('/').pop() || "Unknown";
|
|
94
|
+
const tabButtons = this.#tabContainer.shadowRoot.querySelectorAll('.tab-button');
|
|
95
|
+
|
|
96
|
+
tabButtons.forEach(btn => {
|
|
97
|
+
if (btn.textContent.trim() === layer.toUpperCase()) {
|
|
98
|
+
btn.textContent = `${layer.toUpperCase()} (${fileName})`;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// 날것의 소스 데이터 바인딩 초기화 실행
|
|
145
103
|
diff.initialize(asis_source || "", source || "", lang);
|
|
146
104
|
} else {
|
|
147
|
-
trace.error(`❌ 에디터
|
|
105
|
+
trace.error(`❌ 에디터 인스턴스를 찾을 수 없습니다: nine-diff.${layer}`);
|
|
148
106
|
}
|
|
149
107
|
});
|
|
150
|
-
|
|
108
|
+
|
|
109
|
+
// 데이터 세팅 완료 후 nine-tab 초기 포커싱 가동
|
|
110
|
+
if (this.#tabContainer && typeof this.#tabContainer.initialize === 'function') {
|
|
111
|
+
this.#tabContainer.initialize();
|
|
112
|
+
}
|
|
113
|
+
}, 100);
|
|
151
114
|
|
|
152
115
|
return this;
|
|
153
116
|
}
|
|
@@ -161,7 +124,7 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
161
124
|
for (const file of this.#fileList) {
|
|
162
125
|
const { layer, full_path, asis_source } = file;
|
|
163
126
|
|
|
164
|
-
//
|
|
127
|
+
// 저장 시점에도 nine-tab의 shadowRoot를 관통하여 데이터를 스캔합니다.
|
|
165
128
|
const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
|
|
166
129
|
const currentContent = diff ? diff.getContents() : asis_source;
|
|
167
130
|
|