@nine-lab/nine-mu 0.1.45 → 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 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.44"}/dist/css/nine-mu.css";
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.44"}/dist/css/nine-mu.css";
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.44"}/dist/css/nine-mu.css";
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
- let finalAsis = asis;
26513
- const isRemote = typeof asis === "string" && (asis.startsWith("url:") || asis.startsWith("file:"));
26514
- if (isRemote) {
26515
- const targetUrl = asis.replace(/^(url:|file:)/, "");
26516
- try {
26517
- trace.log(`📡 원격 소스 로드 시도: ${targetUrl}`);
26518
- const res = await fetch(targetUrl);
26519
- if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`);
26520
- finalAsis = await res.text();
26521
- } catch (e) {
26522
- trace.error(`파일 로드 실패 [${targetUrl}]:`, e);
26523
- finalAsis = `// 파일을 불러오는데 실패했습니다.
26524
- // 경로: ${targetUrl}`;
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 tobe === "object" ? JSON.stringify(tobe, null, 2) : tobe;
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.44",
26655
+ version: "0.1.45",
26646
26656
  init: (config) => {
26647
26657
  trace.log("🛠️ Nine-Mu Engine initialized", config);
26648
26658
  }