@nine-lab/nine-mu 0.1.293 β 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 +18 -22
- 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 +23 -31
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")}";` : "";
|
|
@@ -54,13 +54,13 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
* π‘ [
|
|
57
|
+
* π‘ [μλ²½ μΊ‘μν λ°μ΄ν° νΌλ©]
|
|
58
58
|
*/
|
|
59
59
|
async data(fileList) {
|
|
60
60
|
if (!Array.isArray(fileList) || fileList.length === 0) return this;
|
|
61
61
|
this.#fileList = fileList;
|
|
62
62
|
|
|
63
|
-
// 1. π§Ό
|
|
63
|
+
// 1. π§Ό μ΄μ μΈμ
μ λμ λ²νΌκ³Ό 컨ν
μΈ λ€μ μμ ν μ΄κΈ°ν(Clean)
|
|
64
64
|
if (this.#tabContainer && typeof this.#tabContainer.clearTabs === 'function') {
|
|
65
65
|
this.#tabContainer.clearTabs();
|
|
66
66
|
}
|
|
@@ -73,59 +73,51 @@ export class NineDiffPopup extends HTMLElement {
|
|
|
73
73
|
return 'javascript';
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
// 2. β‘
|
|
76
|
+
// 2. β‘ λ°±μλ λͺ
μΈ κ°μλ§νΌ μμνκ² κ³ μ κ΄μ ν APIλ§ νΈλ¦¬κ±°
|
|
77
77
|
fileList.forEach((file) => {
|
|
78
78
|
const { layer, full_path } = file;
|
|
79
79
|
const fileName = full_path.split('/').pop() || "Unknown";
|
|
80
80
|
const captionName = `${layer.toUpperCase()} (${fileName})`;
|
|
81
81
|
|
|
82
|
-
//
|
|
82
|
+
// λ κ²μ μλν° λ§ν¬μ
λ¬Έμμ΄ ν¨ν€μ§
|
|
83
83
|
const targetHtmlContent = `<nine-diff class="${layer}"></nine-diff>`;
|
|
84
84
|
|
|
85
|
+
// π‘ ν΅μ¬: μ μλλ‘ NineTab λ΄λΆ μ€μκ° μ‘°λ¦½ κΈ°λ μ§μ
|
|
85
86
|
if (this.#tabContainer && typeof this.#tabContainer.addTabPage === 'function') {
|
|
86
87
|
this.#tabContainer.addTabPage(captionName, targetHtmlContent);
|
|
87
88
|
}
|
|
88
89
|
});
|
|
89
90
|
|
|
90
|
-
// 3. β°
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const
|
|
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}`);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// 4. λͺ¨λ λ°μ΄ν° λ‘λκ° μλ¬ μμ΄ μμ ν νμ¬λ κ²μ νμ νκ³ ν¬μ»€μ± μ‘μΈμμ΄ν° μ΅μ’
κ°λ!
|
|
110
|
-
if (this.#tabContainer && typeof this.#tabContainer.initialize === 'function') {
|
|
111
|
-
this.#tabContainer.initialize();
|
|
91
|
+
// 3. β° λ°μ΄ν° μ£Όμ
μ°μ° μ€ν
|
|
92
|
+
// μμλ₯Ό μλμ° λμ κ°μ λ λ νΈλ¦¬μ μ§μ κ½μκΈ° λλ¬Έμ κΈ΄ μ§μ° μκ°μ΄ μ ν νμ μμ΅λλ€.
|
|
93
|
+
setTimeout(() => {
|
|
94
|
+
fileList.forEach((file) => {
|
|
95
|
+
const { layer, full_path, asis_source, source } = file;
|
|
96
|
+
const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
|
|
97
|
+
|
|
98
|
+
if (diff && typeof diff.initialize === 'function') {
|
|
99
|
+
const lang = detectLanguage(full_path);
|
|
100
|
+
diff.initialize(asis_source || "", source || "", lang);
|
|
112
101
|
}
|
|
113
102
|
});
|
|
114
|
-
|
|
103
|
+
|
|
104
|
+
// 4. λͺ¨λ μμ€ λκΈ°ν μλ£ ν μ€λ¦¬μ§λ ν¬μ»€μ± μ‘μΈμμ΄ν° νΈλ¦¬κ±° (첫 λ²μ§Έ νμ± ν μ΄κΈ°)
|
|
105
|
+
if (this.#tabContainer && typeof this.#tabContainer.initialize === 'function') {
|
|
106
|
+
this.#tabContainer.initialize();
|
|
107
|
+
}
|
|
108
|
+
}, 50);
|
|
115
109
|
|
|
116
110
|
return this;
|
|
117
111
|
}
|
|
118
112
|
|
|
119
113
|
/**
|
|
120
|
-
* π‘ [μΌκ΄ 물리
|
|
114
|
+
* π‘ [μΌκ΄ 물리 μ μ₯]
|
|
121
115
|
*/
|
|
122
116
|
async #handleConfirmAll() {
|
|
123
117
|
const payloadList = [];
|
|
124
118
|
|
|
125
119
|
for (const file of this.#fileList) {
|
|
126
120
|
const { layer, full_path, asis_source } = file;
|
|
127
|
-
|
|
128
|
-
// μΌκ΄ μμ§ μμ μλ μμ νκ² nine-tabμ shadowRootλ₯Ό κ΄ν΅νμ¬ μ΅μ’
λ²νΌ μ€μΊ
|
|
129
121
|
const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
|
|
130
122
|
const currentContent = diff ? diff.getContents() : asis_source;
|
|
131
123
|
|