@nine-lab/nine-mu 0.1.42 → 0.1.43
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 +60 -19
- 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/NineChat.js +10 -2
- package/src/components/NineDiffPopup.js +44 -1
package/dist/nine-mu.js
CHANGED
|
@@ -106,8 +106,13 @@ class NineChat extends HTMLElement {
|
|
|
106
106
|
__privateAdd(this, _service, null);
|
|
107
107
|
__privateAdd(this, _routes, []);
|
|
108
108
|
__privateAdd(this, _diffPopup);
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
/**
|
|
110
|
+
* 소스 비교 팝업을 띄우고 사용자의 최종 확정 본을 반환합니다.
|
|
111
|
+
* @param {Object} params - { asis, tobe, lang }
|
|
112
|
+
* @returns {Promise<string|null>} - 확정 시 소스코드, 취소 시 null
|
|
113
|
+
*/
|
|
114
|
+
__publicField(this, "showDiff", async ({ asis, tobe, lang }) => {
|
|
115
|
+
return await __privateGet(this, _diffPopup).popup().data(asis, tobe, lang).wait();
|
|
111
116
|
});
|
|
112
117
|
this.attachShadow({ mode: "open" });
|
|
113
118
|
}
|
|
@@ -183,7 +188,7 @@ render_fn = function() {
|
|
|
183
188
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
184
189
|
this.shadowRoot.innerHTML = `
|
|
185
190
|
<style>
|
|
186
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
191
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.42"}/dist/css/nine-mu.css";
|
|
187
192
|
${customImport}
|
|
188
193
|
</style>
|
|
189
194
|
<div class="wrapper">
|
|
@@ -26396,7 +26401,7 @@ class NineDiff extends HTMLElement {
|
|
|
26396
26401
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
26397
26402
|
this.shadowRoot.innerHTML = `
|
|
26398
26403
|
<style>
|
|
26399
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
26404
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.42"}/dist/css/nine-mu.css";
|
|
26400
26405
|
${customImport}
|
|
26401
26406
|
</style>
|
|
26402
26407
|
|
|
@@ -26461,7 +26466,7 @@ class NineDiffPopup extends HTMLElement {
|
|
|
26461
26466
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
26462
26467
|
this.shadowRoot.innerHTML = `
|
|
26463
26468
|
<style>
|
|
26464
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
26469
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.42"}/dist/css/nine-mu.css";
|
|
26465
26470
|
${customImport}
|
|
26466
26471
|
</style>
|
|
26467
26472
|
|
|
@@ -26482,19 +26487,55 @@ class NineDiffPopup extends HTMLElement {
|
|
|
26482
26487
|
this.shadowRoot.querySelector(".btn-confirm").onclick = () => __privateMethod(this, _NineDiffPopup_instances, handleConfirm_fn).call(this);
|
|
26483
26488
|
this.shadowRoot.querySelector(".btn-cancel").onclick = () => __privateMethod(this, _NineDiffPopup_instances, handleCancel_fn).call(this);
|
|
26484
26489
|
}
|
|
26485
|
-
|
|
26486
|
-
|
|
26487
|
-
|
|
26488
|
-
|
|
26489
|
-
|
|
26490
|
-
|
|
26491
|
-
|
|
26492
|
-
|
|
26493
|
-
|
|
26494
|
-
|
|
26495
|
-
|
|
26496
|
-
|
|
26497
|
-
|
|
26490
|
+
/**
|
|
26491
|
+
async popup1(data) {
|
|
26492
|
+
return new Promise((resolve) => {
|
|
26493
|
+
this.#resolve = resolve;
|
|
26494
|
+
this.#asisBackup = data?.asis || "";
|
|
26495
|
+
|
|
26496
|
+
|
|
26497
|
+
// 💡 에디터가 준비되었다는 신호를 받으면 데이터 주입
|
|
26498
|
+
this.#diffView.addEventListener('ready', () => {
|
|
26499
|
+
trace.log("NineDiff is Ready! Injecting data...");
|
|
26500
|
+
|
|
26501
|
+
const asisStr = typeof data.asis === 'object' ? JSON.stringify(data.asis, null, 2) : data.asis;
|
|
26502
|
+
const tobeStr = typeof data.tobe === 'object' ? JSON.stringify(data.tobe, null, 2) : data.tobe;
|
|
26503
|
+
|
|
26504
|
+
trace.log(asisStr, tobeStr);
|
|
26505
|
+
|
|
26506
|
+
this.#diffView.initialize(asisStr, tobeStr, data.lang);
|
|
26507
|
+
}, { once: true }); // 딱 한 번만 실행
|
|
26508
|
+
|
|
26509
|
+
this.#dialog.showModal();
|
|
26510
|
+
});
|
|
26511
|
+
} */
|
|
26512
|
+
popup() {
|
|
26513
|
+
__privateGet(this, _dialog).showModal();
|
|
26514
|
+
return this;
|
|
26515
|
+
}
|
|
26516
|
+
async data(asis, tobe, lang = "javascript") {
|
|
26517
|
+
let finalAsis = asis;
|
|
26518
|
+
const isRemote = typeof asis === "string" && (asis.startsWith("url:") || asis.startsWith("file:"));
|
|
26519
|
+
if (isRemote) {
|
|
26520
|
+
const targetUrl = asis.replace(/^(url:|file:)/, "");
|
|
26521
|
+
try {
|
|
26522
|
+
trace.log(`📡 원격 소스 로드 시도: ${targetUrl}`);
|
|
26523
|
+
const res = await fetch(targetUrl);
|
|
26524
|
+
if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`);
|
|
26525
|
+
finalAsis = await res.text();
|
|
26526
|
+
} catch (e) {
|
|
26527
|
+
trace.error(`파일 로드 실패 [${targetUrl}]:`, e);
|
|
26528
|
+
finalAsis = `// 파일을 불러오는데 실패했습니다.
|
|
26529
|
+
// 경로: ${targetUrl}`;
|
|
26530
|
+
}
|
|
26531
|
+
}
|
|
26532
|
+
__privateSet(this, _asisBackup, finalAsis);
|
|
26533
|
+
__privateGet(this, _diffView).addEventListener("ready", () => {
|
|
26534
|
+
const asisStr = typeof finalAsis === "object" ? JSON.stringify(finalAsis, null, 2) : finalAsis;
|
|
26535
|
+
const tobeStr = typeof tobe === "object" ? JSON.stringify(tobe, null, 2) : tobe;
|
|
26536
|
+
__privateGet(this, _diffView).initialize(asisStr, tobeStr, lang);
|
|
26537
|
+
}, { once: true });
|
|
26538
|
+
return this;
|
|
26498
26539
|
}
|
|
26499
26540
|
}
|
|
26500
26541
|
_dialog = new WeakMap();
|
|
@@ -26606,7 +26647,7 @@ if (!customElements.get("nine-dialog")) {
|
|
|
26606
26647
|
customElements.define("nine-dialog", NineDialog);
|
|
26607
26648
|
}
|
|
26608
26649
|
const NineMu = {
|
|
26609
|
-
version: "0.1.
|
|
26650
|
+
version: "0.1.42",
|
|
26610
26651
|
init: (config) => {
|
|
26611
26652
|
trace.log("🛠️ Nine-Mu Engine initialized", config);
|
|
26612
26653
|
}
|