@nine-lab/nine-mu 0.1.32 → 0.1.34

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.32",
3
+ "version": "0.1.34",
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
 
@@ -49,15 +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;
56
58
 
57
- setTimeout(() => {
58
- this.#diffView.initialize(asisStr, tobeStr, data.lang || "");
59
- }, 100);
60
- }
59
+ this.#diffView.initialize(asisStr, tobeStr, data.lang || "javascript");
60
+ }, { once: true }); // 딱 한 번만 실행
61
61
 
62
62
  this.#dialog.showModal();
63
63
  });