@nine-lab/nine-mu 0.1.45 → 0.1.47
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 -46
- 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 +34 -48
package/dist/nine-mu.js
CHANGED
|
@@ -183,7 +183,7 @@ render_fn = function() {
|
|
|
183
183
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
184
184
|
this.shadowRoot.innerHTML = `
|
|
185
185
|
<style>
|
|
186
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
186
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.46"}/dist/css/nine-mu.css";
|
|
187
187
|
${customImport}
|
|
188
188
|
</style>
|
|
189
189
|
<div class="wrapper">
|
|
@@ -26396,7 +26396,7 @@ class NineDiff extends HTMLElement {
|
|
|
26396
26396
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
26397
26397
|
this.shadowRoot.innerHTML = `
|
|
26398
26398
|
<style>
|
|
26399
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
26399
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.46"}/dist/css/nine-mu.css";
|
|
26400
26400
|
${customImport}
|
|
26401
26401
|
</style>
|
|
26402
26402
|
|
|
@@ -26461,73 +26461,61 @@ class NineDiffPopup extends HTMLElement {
|
|
|
26461
26461
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
26462
26462
|
this.shadowRoot.innerHTML = `
|
|
26463
26463
|
<style>
|
|
26464
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
26464
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.46"}/dist/css/nine-mu.css";
|
|
26465
26465
|
${customImport}
|
|
26466
26466
|
</style>
|
|
26467
26467
|
|
|
26468
|
-
<
|
|
26468
|
+
<nine-dialog>
|
|
26469
26469
|
<div class="main-layout">
|
|
26470
26470
|
<div class="diff-area">
|
|
26471
|
-
<nine-diff
|
|
26471
|
+
<nine-diff></nine-diff>
|
|
26472
26472
|
</div>
|
|
26473
26473
|
<div class="footer">
|
|
26474
26474
|
<button class="btn btn-cancel">취소</button>
|
|
26475
26475
|
<button class="btn btn-confirm">최종 확정 및 저장</button>
|
|
26476
26476
|
</div>
|
|
26477
26477
|
</div>
|
|
26478
|
-
</
|
|
26478
|
+
</nine-dialog>
|
|
26479
26479
|
`;
|
|
26480
|
-
__privateSet(this, _dialog, this.shadowRoot.querySelector("
|
|
26481
|
-
__privateSet(this, _diffView, this.shadowRoot.querySelector("
|
|
26480
|
+
__privateSet(this, _dialog, this.shadowRoot.querySelector("nine-dialog"));
|
|
26481
|
+
__privateSet(this, _diffView, this.shadowRoot.querySelector("nine-diff"));
|
|
26482
26482
|
this.shadowRoot.querySelector(".btn-confirm").onclick = () => __privateMethod(this, _NineDiffPopup_instances, handleConfirm_fn).call(this);
|
|
26483
26483
|
this.shadowRoot.querySelector(".btn-cancel").onclick = () => __privateMethod(this, _NineDiffPopup_instances, handleCancel_fn).call(this);
|
|
26484
26484
|
}
|
|
26485
|
-
/**
|
|
26486
|
-
async popup1(data) {
|
|
26487
|
-
return new Promise((resolve) => {
|
|
26488
|
-
this.#resolve = resolve;
|
|
26489
|
-
this.#asisBackup = data?.asis || "";
|
|
26490
|
-
|
|
26491
|
-
|
|
26492
|
-
// 💡 에디터가 준비되었다는 신호를 받으면 데이터 주입
|
|
26493
|
-
this.#diffView.addEventListener('ready', () => {
|
|
26494
|
-
trace.log("NineDiff is Ready! Injecting data...");
|
|
26495
|
-
|
|
26496
|
-
const asisStr = typeof data.asis === 'object' ? JSON.stringify(data.asis, null, 2) : data.asis;
|
|
26497
|
-
const tobeStr = typeof data.tobe === 'object' ? JSON.stringify(data.tobe, null, 2) : data.tobe;
|
|
26498
|
-
|
|
26499
|
-
trace.log(asisStr, tobeStr);
|
|
26500
|
-
|
|
26501
|
-
this.#diffView.initialize(asisStr, tobeStr, data.lang);
|
|
26502
|
-
}, { once: true }); // 딱 한 번만 실행
|
|
26503
|
-
|
|
26504
|
-
this.#dialog.showModal();
|
|
26505
|
-
});
|
|
26506
|
-
} */
|
|
26507
26485
|
popup() {
|
|
26508
26486
|
__privateGet(this, _dialog).showModal();
|
|
26509
26487
|
return this;
|
|
26510
26488
|
}
|
|
26489
|
+
/**
|
|
26490
|
+
* @param {string|object} asis - 소스 텍스트 또는 url:/file: 경로
|
|
26491
|
+
* @param {string|object} tobe - 소스 텍스트 또는 url:/file: 경로
|
|
26492
|
+
* @param {string} lang - 언어 설정
|
|
26493
|
+
*/
|
|
26511
26494
|
async data(asis, tobe, lang = "javascript") {
|
|
26512
|
-
|
|
26513
|
-
|
|
26514
|
-
|
|
26515
|
-
|
|
26516
|
-
|
|
26517
|
-
|
|
26518
|
-
|
|
26519
|
-
|
|
26520
|
-
|
|
26521
|
-
|
|
26522
|
-
|
|
26523
|
-
|
|
26524
|
-
|
|
26495
|
+
const loadSource = async (src) => {
|
|
26496
|
+
if (typeof src === "string" && (src.startsWith("url:") || src.startsWith("file:"))) {
|
|
26497
|
+
const targetUrl = src.replace(/^(url:|file:)/, "");
|
|
26498
|
+
try {
|
|
26499
|
+
trace.log(`📡 리모트 로드: ${targetUrl}`);
|
|
26500
|
+
const res = await fetch(targetUrl);
|
|
26501
|
+
if (!res.ok) throw new Error(`Status: ${res.status}`);
|
|
26502
|
+
return await res.text();
|
|
26503
|
+
} catch (e) {
|
|
26504
|
+
trace.error(`로드 실패 [${targetUrl}]:`, e);
|
|
26505
|
+
return `// 로드 실패: ${targetUrl}
|
|
26506
|
+
${e.message}`;
|
|
26507
|
+
}
|
|
26525
26508
|
}
|
|
26526
|
-
|
|
26509
|
+
return src;
|
|
26510
|
+
};
|
|
26511
|
+
const [finalAsis, finalTobe] = await Promise.all([
|
|
26512
|
+
loadSource(asis),
|
|
26513
|
+
loadSource(tobe)
|
|
26514
|
+
]);
|
|
26527
26515
|
__privateSet(this, _asisBackup, finalAsis);
|
|
26528
26516
|
__privateGet(this, _diffView).addEventListener("ready", () => {
|
|
26529
26517
|
const asisStr = typeof finalAsis === "object" ? JSON.stringify(finalAsis, null, 2) : finalAsis;
|
|
26530
|
-
const tobeStr = typeof
|
|
26518
|
+
const tobeStr = typeof finalTobe === "object" ? JSON.stringify(finalTobe, null, 2) : finalTobe;
|
|
26531
26519
|
__privateGet(this, _diffView).initialize(asisStr, tobeStr, lang);
|
|
26532
26520
|
}, { once: true });
|
|
26533
26521
|
return this;
|
|
@@ -26642,7 +26630,7 @@ if (!customElements.get("nine-dialog")) {
|
|
|
26642
26630
|
customElements.define("nine-dialog", NineDialog);
|
|
26643
26631
|
}
|
|
26644
26632
|
const NineMu = {
|
|
26645
|
-
version: "0.1.
|
|
26633
|
+
version: "0.1.46",
|
|
26646
26634
|
init: (config) => {
|
|
26647
26635
|
trace.log("🛠️ Nine-Mu Engine initialized", config);
|
|
26648
26636
|
}
|