@nine-lab/nine-mu 0.1.31 → 0.1.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nine-lab/nine-mu",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "description": "AI-Driven Full-Stack Code Fabrication Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/nine-mu.umd.js",
@@ -206,6 +206,12 @@ export class NineDiff extends HTMLElement {
206
206
 
207
207
  requestAnimationFrame(() => {
208
208
  this.#initCodeMirror();
209
+
210
+ this.dispatchEvent(new CustomEvent('ready', {
211
+ detail: { target: this },
212
+ bubbles: true,
213
+ composed: true
214
+ }));
209
215
  });
210
216
  }
211
217
 
@@ -470,7 +476,6 @@ export class NineDiff extends HTMLElement {
470
476
  return;
471
477
  }
472
478
 
473
-
474
479
  //console.log(src1, src2, language);
475
480
 
476
481
  this.#isScrollSyncActive = false;
@@ -49,12 +49,15 @@ export class NineDiffPopup extends HTMLElement {
49
49
  this.#resolve = resolve;
50
50
  this.#asisBackup = data?.asis || "";
51
51
 
52
- // 에디터 초기화 (Container가 하던 일)
53
- if (this.#diffView) {
52
+ // 💡 에디터가 준비되었다는 신호를 받으면 데이터 주입
53
+ this.#diffView.addEventListener('ready', () => {
54
+ trace.log("NineDiff is Ready! Injecting data...");
55
+
54
56
  const asisStr = typeof data.asis === 'object' ? JSON.stringify(data.asis, null, 2) : data.asis;
55
57
  const tobeStr = typeof data.tobe === 'object' ? JSON.stringify(data.tobe, null, 2) : data.tobe;
58
+
56
59
  this.#diffView.initialize(asisStr, tobeStr, data.lang || "javascript");
57
- }
60
+ }, { once: true }); // 딱 한 번만 실행
58
61
 
59
62
  this.#dialog.showModal();
60
63
  });