@nine-lab/nine-mu 0.1.44 → 0.1.46
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 +31 -21
- 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 +2 -2
- package/src/components/NineDiffPopup.js +29 -20
package/dist/nine-mu.js
CHANGED
|
@@ -106,8 +106,8 @@ class NineChat extends HTMLElement {
|
|
|
106
106
|
__privateAdd(this, _service, null);
|
|
107
107
|
__privateAdd(this, _routes, []);
|
|
108
108
|
__privateAdd(this, _diffPopup);
|
|
109
|
-
__publicField(this, "showDiff", (
|
|
110
|
-
__privateGet(this, _diffPopup).popup().data(
|
|
109
|
+
__publicField(this, "showDiff", (asis, tobe, lang) => {
|
|
110
|
+
__privateGet(this, _diffPopup).popup().data(asis, tobe, lang);
|
|
111
111
|
});
|
|
112
112
|
this.attachShadow({ mode: "open" });
|
|
113
113
|
}
|
|
@@ -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.45"}/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.45"}/dist/css/nine-mu.css";
|
|
26400
26400
|
${customImport}
|
|
26401
26401
|
</style>
|
|
26402
26402
|
|
|
@@ -26461,7 +26461,7 @@ 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.45"}/dist/css/nine-mu.css";
|
|
26465
26465
|
${customImport}
|
|
26466
26466
|
</style>
|
|
26467
26467
|
|
|
@@ -26508,26 +26508,36 @@ class NineDiffPopup extends HTMLElement {
|
|
|
26508
26508
|
__privateGet(this, _dialog).showModal();
|
|
26509
26509
|
return this;
|
|
26510
26510
|
}
|
|
26511
|
+
/**
|
|
26512
|
+
* @param {string|object} asis - 소스 텍스트 또는 url:/file: 경로
|
|
26513
|
+
* @param {string|object} tobe - 소스 텍스트 또는 url:/file: 경로
|
|
26514
|
+
* @param {string} lang - 언어 설정
|
|
26515
|
+
*/
|
|
26511
26516
|
async data(asis, tobe, lang = "javascript") {
|
|
26512
|
-
|
|
26513
|
-
|
|
26514
|
-
|
|
26515
|
-
|
|
26516
|
-
|
|
26517
|
-
|
|
26518
|
-
|
|
26519
|
-
|
|
26520
|
-
|
|
26521
|
-
|
|
26522
|
-
|
|
26523
|
-
|
|
26524
|
-
|
|
26517
|
+
const loadSource = async (src) => {
|
|
26518
|
+
if (typeof src === "string" && (src.startsWith("url:") || src.startsWith("file:"))) {
|
|
26519
|
+
const targetUrl = src.replace(/^(url:|file:)/, "");
|
|
26520
|
+
try {
|
|
26521
|
+
trace.log(`📡 리모트 로드: ${targetUrl}`);
|
|
26522
|
+
const res = await fetch(targetUrl);
|
|
26523
|
+
if (!res.ok) throw new Error(`Status: ${res.status}`);
|
|
26524
|
+
return await res.text();
|
|
26525
|
+
} catch (e) {
|
|
26526
|
+
trace.error(`로드 실패 [${targetUrl}]:`, e);
|
|
26527
|
+
return `// 로드 실패: ${targetUrl}
|
|
26528
|
+
${e.message}`;
|
|
26529
|
+
}
|
|
26525
26530
|
}
|
|
26526
|
-
|
|
26531
|
+
return src;
|
|
26532
|
+
};
|
|
26533
|
+
const [finalAsis, finalTobe] = await Promise.all([
|
|
26534
|
+
loadSource(asis),
|
|
26535
|
+
loadSource(tobe)
|
|
26536
|
+
]);
|
|
26527
26537
|
__privateSet(this, _asisBackup, finalAsis);
|
|
26528
26538
|
__privateGet(this, _diffView).addEventListener("ready", () => {
|
|
26529
26539
|
const asisStr = typeof finalAsis === "object" ? JSON.stringify(finalAsis, null, 2) : finalAsis;
|
|
26530
|
-
const tobeStr = typeof
|
|
26540
|
+
const tobeStr = typeof finalTobe === "object" ? JSON.stringify(finalTobe, null, 2) : finalTobe;
|
|
26531
26541
|
__privateGet(this, _diffView).initialize(asisStr, tobeStr, lang);
|
|
26532
26542
|
}, { once: true });
|
|
26533
26543
|
return this;
|
|
@@ -26642,7 +26652,7 @@ if (!customElements.get("nine-dialog")) {
|
|
|
26642
26652
|
customElements.define("nine-dialog", NineDialog);
|
|
26643
26653
|
}
|
|
26644
26654
|
const NineMu = {
|
|
26645
|
-
version: "0.1.
|
|
26655
|
+
version: "0.1.45",
|
|
26646
26656
|
init: (config) => {
|
|
26647
26657
|
trace.log("🛠️ Nine-Mu Engine initialized", config);
|
|
26648
26658
|
}
|