@nine-lab/nine-mu 0.1.292 β 0.1.294
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 +30 -50
- 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 +37 -60
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
|
+
* π‘ [μλ²½ μΊ‘μν λ°μ΄ν° νΌλ©]
|
|
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. π§Ό μ΄μ μΈμ
μ λμ λ²νΌκ³Ό 컨ν
μΈ λ€μ μμ ν μ΄κΈ°ν(Clean)
|
|
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,62 +73,39 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
73
73
|
return 'javascript';
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
//
|
|
76
|
+
// 2. β‘ λ°±μλ λͺ
μΈ κ°μλ§νΌ μμνκ² κ³ μ κ΄μ ν APIλ§ νΈλ¦¬κ±°
|
|
77
|
+
fileList.forEach((file) => {
|
|
78
|
+
const { layer, full_path } = file;
|
|
79
|
+
const fileName = full_path.split('/').pop() || "Unknown";
|
|
80
|
+
const captionName = `${layer.toUpperCase()} (${fileName})`;
|
|
81
|
+
|
|
82
|
+
// λ κ²μ μλν° λ§ν¬μ
λ¬Έμμ΄ ν¨ν€μ§
|
|
83
|
+
const targetHtmlContent = `<nine-diff class="${layer}"></nine-diff>`;
|
|
84
|
+
|
|
85
|
+
// π‘ ν΅μ¬: μ μλλ‘ NineTab λ΄λΆ μ€μκ° μ‘°λ¦½ κΈ°λ μ§μ
|
|
86
|
+
if (this.#tabContainer && typeof this.#tabContainer.addTabPage === 'function') {
|
|
87
|
+
this.#tabContainer.addTabPage(captionName, targetHtmlContent);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// 3. β° λ°μ΄ν° μ£Όμ
μ°μ° μ€ν
|
|
92
|
+
// μμλ₯Ό μλμ° λμ κ°μ λ λ νΈλ¦¬μ μ§μ κ½μκΈ° λλ¬Έμ κΈ΄ μ§μ° μκ°μ΄ μ ν νμ μμ΅λλ€.
|
|
77
93
|
setTimeout(() => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
targetLayers.forEach((layerName, index) => {
|
|
83
|
-
const currentBtn = tabButtons[index];
|
|
84
|
-
const pageBody = this.#tabContainer.shadowRoot.getElementById(`content${index}`);
|
|
85
|
-
|
|
86
|
-
if (!pageBody) return;
|
|
87
|
-
|
|
88
|
-
if (activeLayers.includes(layerName)) {
|
|
89
|
-
const fileData = fileList.find(f => f.layer === layerName);
|
|
90
|
-
const fileName = fileData.full_path.split('/').pop() || "Unknown";
|
|
91
|
-
|
|
92
|
-
if (currentBtn) {
|
|
93
|
-
currentBtn.textContent = `${layerName.toUpperCase()} (${fileName})`;
|
|
94
|
-
currentBtn.style.display = "unset";
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// π‘ μλν° μ¬λ‘― λμ μ¬μμ±
|
|
98
|
-
pageBody.innerHTML = `<nine-diff class="${layerName}"></nine-diff>`;
|
|
99
|
-
} else {
|
|
100
|
-
if (currentBtn) {
|
|
101
|
-
currentBtn.style.display = "none";
|
|
102
|
-
currentBtn.classList.remove("active");
|
|
103
|
-
}
|
|
104
|
-
pageBody.innerHTML = "";
|
|
105
|
-
}
|
|
106
|
-
});
|
|
94
|
+
fileList.forEach((file) => {
|
|
95
|
+
const { layer, full_path, asis_source, source } = file;
|
|
96
|
+
const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
|
|
107
97
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
requestAnimationFrame(() => {
|
|
113
|
-
fileList.forEach((file) => {
|
|
114
|
-
const { layer, full_path, asis_source, source } = file;
|
|
115
|
-
const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
|
|
116
|
-
|
|
117
|
-
if (diff && typeof diff.initialize === 'function') {
|
|
118
|
-
const lang = detectLanguage(full_path);
|
|
119
|
-
// λ΄λΆ CodeMirror νλ μμν¬κ° μμ ν ready λ μμ μ λ°μ΄ν°λ₯Ό λ°μΈλ©ν©λλ€.
|
|
120
|
-
diff.initialize(asis_source || "", source || "", lang);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
// λ°μ΄ν° μ£Όμ
μλ£ ν 첫 νμ± νμΌλ‘ νλ©΄ μ ν ν¬μ»€μ±
|
|
125
|
-
if (this.#tabContainer && typeof this.#tabContainer.initialize === 'function') {
|
|
126
|
-
this.#tabContainer.initialize();
|
|
127
|
-
}
|
|
128
|
-
});
|
|
98
|
+
if (diff && typeof diff.initialize === 'function') {
|
|
99
|
+
const lang = detectLanguage(full_path);
|
|
100
|
+
diff.initialize(asis_source || "", source || "", lang);
|
|
101
|
+
}
|
|
129
102
|
});
|
|
130
103
|
|
|
131
|
-
|
|
104
|
+
// 4. λͺ¨λ μμ€ λκΈ°ν μλ£ ν μ€λ¦¬μ§λ ν¬μ»€μ± μ‘μΈμμ΄ν° νΈλ¦¬κ±° (첫 λ²μ§Έ νμ± ν μ΄κΈ°)
|
|
105
|
+
if (this.#tabContainer && typeof this.#tabContainer.initialize === 'function') {
|
|
106
|
+
this.#tabContainer.initialize();
|
|
107
|
+
}
|
|
108
|
+
}, 50);
|
|
132
109
|
|
|
133
110
|
return this;
|
|
134
111
|
}
|