@nine-lab/nine-mu 0.1.42 β†’ 0.1.44

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
@@ -107,7 +107,7 @@ class NineChat extends HTMLElement {
107
107
  __privateAdd(this, _routes, []);
108
108
  __privateAdd(this, _diffPopup);
109
109
  __publicField(this, "showDiff", (data) => {
110
- __privateGet(this, _diffPopup).popup(data);
110
+ __privateGet(this, _diffPopup).popup().data(data);
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.41"}/dist/css/nine-mu.css";
186
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.43"}/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.41"}/dist/css/nine-mu.css";
26399
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.43"}/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.41"}/dist/css/nine-mu.css";
26464
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.43"}/dist/css/nine-mu.css";
26465
26465
  ${customImport}
26466
26466
  </style>
26467
26467
 
@@ -26482,19 +26482,55 @@ class NineDiffPopup extends HTMLElement {
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
- async popup(data) {
26486
- return new Promise((resolve) => {
26487
- __privateSet(this, _resolve, resolve);
26488
- __privateSet(this, _asisBackup, (data == null ? void 0 : data.asis) || "");
26489
- __privateGet(this, _diffView).addEventListener("ready", () => {
26490
- trace.log("NineDiff is Ready! Injecting data...");
26491
- const asisStr = typeof data.asis === "object" ? JSON.stringify(data.asis, null, 2) : data.asis;
26492
- const tobeStr = typeof data.tobe === "object" ? JSON.stringify(data.tobe, null, 2) : data.tobe;
26493
- trace.log(asisStr, tobeStr);
26494
- __privateGet(this, _diffView).initialize(asisStr, tobeStr, data.lang);
26495
- }, { once: true });
26496
- __privateGet(this, _dialog).showModal();
26497
- });
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
+ popup() {
26508
+ __privateGet(this, _dialog).showModal();
26509
+ return this;
26510
+ }
26511
+ 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}`;
26525
+ }
26526
+ }
26527
+ __privateSet(this, _asisBackup, finalAsis);
26528
+ __privateGet(this, _diffView).addEventListener("ready", () => {
26529
+ const asisStr = typeof finalAsis === "object" ? JSON.stringify(finalAsis, null, 2) : finalAsis;
26530
+ const tobeStr = typeof tobe === "object" ? JSON.stringify(tobe, null, 2) : tobe;
26531
+ __privateGet(this, _diffView).initialize(asisStr, tobeStr, lang);
26532
+ }, { once: true });
26533
+ return this;
26498
26534
  }
26499
26535
  }
26500
26536
  _dialog = new WeakMap();
@@ -26606,7 +26642,7 @@ if (!customElements.get("nine-dialog")) {
26606
26642
  customElements.define("nine-dialog", NineDialog);
26607
26643
  }
26608
26644
  const NineMu = {
26609
- version: "0.1.41",
26645
+ version: "0.1.43",
26610
26646
  init: (config) => {
26611
26647
  trace.log("πŸ› οΈ Nine-Mu Engine initialized", config);
26612
26648
  }