@nine-lab/nine-mu 0.1.291 β 0.1.293
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 -43
- 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 +43 -57
package/package.json
CHANGED
|
@@ -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")}";` : "";
|
|
@@ -32,12 +32,7 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
32
32
|
</style>
|
|
33
33
|
|
|
34
34
|
<nine-dialog>
|
|
35
|
-
<nine-tab theme="theme-3">
|
|
36
|
-
<nine-tab-page caption="MYBATIS" id="layer_MyBatis"></nine-tab-page>
|
|
37
|
-
<nine-tab-page caption="SERVICE" id="layer_Service"></nine-tab-page>
|
|
38
|
-
<nine-tab-page caption="CONTROLLER" id="layer_Controller"></nine-tab-page>
|
|
39
|
-
<nine-tab-page caption="JAVASCRIPT" id="layer_JavaScript"></nine-tab-page>
|
|
40
|
-
</nine-tab>
|
|
35
|
+
<nine-tab theme="theme-3"></nine-tab>
|
|
41
36
|
|
|
42
37
|
<div class="footer">
|
|
43
38
|
<button class="btn btn-cancel">μ·¨μ</button>
|
|
@@ -59,12 +54,17 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
59
54
|
}
|
|
60
55
|
|
|
61
56
|
/**
|
|
62
|
-
* π‘ [
|
|
57
|
+
* π‘ [100% λ°μ΄ν° κΈ°λ° λμ ν/μλν° λΉλ μμ§]
|
|
63
58
|
*/
|
|
64
59
|
async data(fileList) {
|
|
65
60
|
if (!Array.isArray(fileList) || fileList.length === 0) return this;
|
|
66
61
|
this.#fileList = fileList;
|
|
67
62
|
|
|
63
|
+
// 1. π§Ό μλ‘μ΄ λ°μΈλ© μΈμ
μμ μ Light DOM μμ λ
Έλ μ λ μ²μ (μ΄μ μμ μ κ±°)
|
|
64
|
+
if (this.#tabContainer && typeof this.#tabContainer.clearTabs === 'function') {
|
|
65
|
+
this.#tabContainer.clearTabs();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
68
|
const detectLanguage = (path) => {
|
|
69
69
|
const lower = (path || "").toLowerCase();
|
|
70
70
|
if (lower.endsWith('.xml')) return 'xml';
|
|
@@ -73,65 +73,51 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
73
73
|
return 'javascript';
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const tabButtons = this.#tabContainer.shadowRoot.querySelectorAll('.tab-button');
|
|
82
|
-
|
|
83
|
-
// 4λ κ³ μ λ μ΄μ΄ λͺ
μΈ μ μ
|
|
84
|
-
const targetLayers = ["MyBatis", "Service", "Controller", "JavaScript"];
|
|
76
|
+
// 2. β‘ λ€μ΄μ¨ λ°μ΄ν° κ°―μμ λ μ΄μ΄ λͺ
μΈμ λ§μΆ° <nine-tab-page> ꡬ쑰λ₯Ό 쑰립νμ¬ λ°μ΄ λ£μ΅λλ€.
|
|
77
|
+
fileList.forEach((file) => {
|
|
78
|
+
const { layer, full_path } = file;
|
|
79
|
+
const fileName = full_path.split('/').pop() || "Unknown";
|
|
80
|
+
const captionName = `${layer.toUpperCase()} (${fileName})`;
|
|
85
81
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
// nine-tab λ΄λΆ μλμ° λμ 쑰립λμ΄ λκΈ° μ€μΈ μ€μ νμ΄μ§ λͺΈμ²΄ λ³Έλ¬Έ div
|
|
89
|
-
const pageBody = this.#tabContainer.shadowRoot.getElementById(`content${index}`);
|
|
82
|
+
// π‘ μ μ μ»΄ν¬λνΈ κ·κ²©μ λ§μΆμ΄ νκ·Έ ν
νλ¦Ώ μ€νΈλ§ ννλ‘ κ°κ³΅νμ¬ push
|
|
83
|
+
const targetHtmlContent = `<nine-diff class="${layer}"></nine-diff>`;
|
|
90
84
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
85
|
+
if (this.#tabContainer && typeof this.#tabContainer.addTabPage === 'function') {
|
|
86
|
+
this.#tabContainer.addTabPage(captionName, targetHtmlContent);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// 3. β° [κ²°μ μ νμ΄λ° νλ]: nine-tab λ΄λΆμμ refresh() μ°μ°μ΄ λλ
|
|
91
|
+
// μλν° λ¨λ§ μ₯μΉλ€μ΄ μλμ° λ μμ°©μ μλ²½νκ² λλ§μΉλλ‘ λλΈ νλ μ λ§μ§(requestAnimationFrame) ν보
|
|
92
|
+
requestAnimationFrame(() => {
|
|
93
|
+
requestAnimationFrame(() => {
|
|
94
|
+
fileList.forEach((file) => {
|
|
95
|
+
const { layer, full_path, asis_source, source } = file;
|
|
96
|
+
|
|
97
|
+
// nine-tabμ shadowRoot λ΄λΆ κ΄μ λ₯Ό ν΅ν΄ μμ μ μΌλ‘ λΆν μ΄μ¬ μλ£λ μλν° μΈμ€ν΄μ€ μ λ° μΆμ
|
|
98
|
+
const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
|
|
99
|
+
|
|
100
|
+
if (diff && typeof diff.initialize === 'function') {
|
|
101
|
+
const lang = detectLanguage(full_path);
|
|
102
|
+
// μλν° ν΅μ¬ λͺ¨λ(CodeMirror) κΈ°λ μκ·Έλ μ μ‘
|
|
103
|
+
diff.initialize(asis_source || "", source || "", lang);
|
|
104
|
+
} else {
|
|
105
|
+
trace.error(`β λμ μλν° νμ μ μ€: nine-diff.${layer}`);
|
|
102
106
|
}
|
|
107
|
+
});
|
|
103
108
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// C. μλ‘ νμ΄λ λμ μλν° λ¨λ§ μ₯μΉ μ¦μ μΈν°νμ΄μ€ μ΄κΈ°ν
|
|
108
|
-
const freshDiff = pageBody.querySelector(`nine-diff.${layerName}`);
|
|
109
|
-
if (freshDiff) {
|
|
110
|
-
const lang = detectLanguage(fileData.full_path);
|
|
111
|
-
freshDiff.initialize(fileData.asis_source || "", fileData.source || "", lang);
|
|
112
|
-
}
|
|
113
|
-
} else {
|
|
114
|
-
// μ΄λ² νμ€ν¬μμ μμ λμ§ μμ μ μΈ μμμ μλ¨ λ²νΌμ hide μ²λ¦¬νμ¬ κΉλνκ² λ§μ€νΉ
|
|
115
|
-
if (currentBtn) {
|
|
116
|
-
currentBtn.style.display = "none";
|
|
117
|
-
currentBtn.classList.remove("active");
|
|
118
|
-
}
|
|
119
|
-
pageBody.innerHTML = ""; // 컨ν
μΈ λ³Έλ¬Έ μ΄κΈ°ν
|
|
109
|
+
// 4. λͺ¨λ λ°μ΄ν° λ‘λκ° μλ¬ μμ΄ μμ ν νμ¬λ κ²μ νμ νκ³ ν¬μ»€μ± μ‘μΈμμ΄ν° μ΅μ’
κ°λ!
|
|
110
|
+
if (this.#tabContainer && typeof this.#tabContainer.initialize === 'function') {
|
|
111
|
+
this.#tabContainer.initialize();
|
|
120
112
|
}
|
|
121
113
|
});
|
|
122
|
-
|
|
123
|
-
// 2. λμ μλν° κ°±μ λ° λ§μ€νΉ μλ£ ν, 첫 λ²μ§Έ νμ±ν(Visible)λ νμΌλ‘ μλ ν΄λ¦ μ΄λ
|
|
124
|
-
if (this.#tabContainer && typeof this.#tabContainer.initialize === 'function') {
|
|
125
|
-
this.#tabContainer.initialize();
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
}, 120);
|
|
114
|
+
});
|
|
129
115
|
|
|
130
116
|
return this;
|
|
131
117
|
}
|
|
132
118
|
|
|
133
119
|
/**
|
|
134
|
-
* π‘ [μΌκ΄ 물리 μ μ₯]
|
|
120
|
+
* π‘ [μΌκ΄ 물리 νμΌ μ μ₯]
|
|
135
121
|
*/
|
|
136
122
|
async #handleConfirmAll() {
|
|
137
123
|
const payloadList = [];
|
|
@@ -139,7 +125,7 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
139
125
|
for (const file of this.#fileList) {
|
|
140
126
|
const { layer, full_path, asis_source } = file;
|
|
141
127
|
|
|
142
|
-
//
|
|
128
|
+
// μΌκ΄ μμ§ μμ μλ μμ νκ² nine-tabμ shadowRootλ₯Ό κ΄ν΅νμ¬ μ΅μ’
λ²νΌ μ€μΊ
|
|
143
129
|
const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
|
|
144
130
|
const currentContent = diff ? diff.getContents() : asis_source;
|
|
145
131
|
|