@nine-lab/nine-mu 0.1.291 β 0.1.292
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 +21 -14
- 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 +26 -25
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")}";` : "";
|
|
@@ -73,57 +73,60 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
73
73
|
return 'javascript';
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
// 1. β° nine-tab
|
|
76
|
+
// 1. β° μμ nine-tabμ μ€λ¦¬μ§λ λΌλ νμ±μ΄ μλ²½ν λ§μ΄νΈλ λκΉμ§ 1μ°¨ λκΈ°
|
|
77
77
|
setTimeout(() => {
|
|
78
78
|
const activeLayers = fileList.map(f => f.layer);
|
|
79
|
-
|
|
80
|
-
// ν μ»΄ν¬λνΈ λ΄λΆ μλμ° λμΌλ‘ μ΄μ¬ κ° μ€μ ν νμ΄μ§ λ²νΌκ³Ό 컨ν
μΈ μ»¨ν
μ΄λ μμ ν보
|
|
81
79
|
const tabButtons = this.#tabContainer.shadowRoot.querySelectorAll('.tab-button');
|
|
82
|
-
|
|
83
|
-
// 4λ κ³ μ λ μ΄μ΄ λͺ
μΈ μ μ
|
|
84
80
|
const targetLayers = ["MyBatis", "Service", "Controller", "JavaScript"];
|
|
85
81
|
|
|
86
82
|
targetLayers.forEach((layerName, index) => {
|
|
87
83
|
const currentBtn = tabButtons[index];
|
|
88
|
-
// nine-tab λ΄λΆ μλμ° λμ 쑰립λμ΄ λκΈ° μ€μΈ μ€μ νμ΄μ§ λͺΈμ²΄ λ³Έλ¬Έ div
|
|
89
84
|
const pageBody = this.#tabContainer.shadowRoot.getElementById(`content${index}`);
|
|
90
85
|
|
|
91
86
|
if (!pageBody) return;
|
|
92
87
|
|
|
93
|
-
// μ΄λ² λ°±μλ μλ£ μκ·Έλμ ν΄λΉ λ μ΄μ΄ μμ λͺ
μΈκ° ν¬ν¨λμ΄ μλ€λ©΄?
|
|
94
88
|
if (activeLayers.includes(layerName)) {
|
|
95
89
|
const fileData = fileList.find(f => f.layer === layerName);
|
|
96
90
|
const fileName = fileData.full_path.split('/').pop() || "Unknown";
|
|
97
91
|
|
|
98
|
-
// A. μλ¨ ν λ²νΌ ν
μ€νΈλ₯Ό μ€μ νμΌλͺ
μΌλ‘ λμ μ
λ°μ΄νΈ λ° λ
ΈμΆ
|
|
99
92
|
if (currentBtn) {
|
|
100
93
|
currentBtn.textContent = `${layerName.toUpperCase()} (${fileName})`;
|
|
101
94
|
currentBtn.style.display = "unset";
|
|
102
95
|
}
|
|
103
96
|
|
|
104
|
-
//
|
|
97
|
+
// π‘ μλν° μ¬λ‘― λμ μ¬μμ±
|
|
105
98
|
pageBody.innerHTML = `<nine-diff class="${layerName}"></nine-diff>`;
|
|
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
99
|
} else {
|
|
114
|
-
// μ΄λ² νμ€ν¬μμ μμ λμ§ μμ μ μΈ μμμ μλ¨ λ²νΌμ hide μ²λ¦¬νμ¬ κΉλνκ² λ§μ€νΉ
|
|
115
100
|
if (currentBtn) {
|
|
116
101
|
currentBtn.style.display = "none";
|
|
117
102
|
currentBtn.classList.remove("active");
|
|
118
103
|
}
|
|
119
|
-
pageBody.innerHTML = "";
|
|
104
|
+
pageBody.innerHTML = "";
|
|
120
105
|
}
|
|
121
106
|
});
|
|
122
107
|
|
|
123
|
-
// 2.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
108
|
+
// 2. β‘ [κ²°μ μ ν¬λμ ν΄κ²° μ₯μΉ]:
|
|
109
|
+
// λΈλΌμ°μ κ° λμ μ£Όμ
λ <nine-diff>μ λ΄λΆ CodeMirror μΈμ€ν΄μ€ λ λλ§μ μμ ν λ§μΉ λκΉμ§
|
|
110
|
+
// νλ μ μ°μ°μ 2λ¨κ³(λλΈ ν±) μ§μ°μμΌ μμ κΈ°λ νλ₯Ό ν보ν©λλ€.
|
|
111
|
+
requestAnimationFrame(() => {
|
|
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
|
+
});
|
|
129
|
+
});
|
|
127
130
|
|
|
128
131
|
}, 120);
|
|
129
132
|
|
|
@@ -138,8 +141,6 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
138
141
|
|
|
139
142
|
for (const file of this.#fileList) {
|
|
140
143
|
const { layer, full_path, asis_source } = file;
|
|
141
|
-
|
|
142
|
-
// nine-tab λ΄λΆ μλμ° μμ μμμ λμ κ°λ μ€μΈ μλν° μ»¨ν
μΈ νκ²ν
μΊ‘μ²
|
|
143
144
|
const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
|
|
144
145
|
const currentContent = diff ? diff.getContents() : asis_source;
|
|
145
146
|
|