@nine-lab/nine-mu 0.1.293 β†’ 0.1.294

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.293",
3
+ "version": "0.1.294",
4
4
  "description": "AI-Driven Full-Stack Code Fabrication Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/nine-mu.umd.js",
@@ -19,7 +19,7 @@ export class NineDiffPopup extends HTMLElement {
19
19
  }
20
20
 
21
21
  /**
22
- * πŸ’‘ [μŠ€μΌ€ν΄λ”©] νƒ­ λ‚΄λΆ€λŠ” μ™„μ „νžˆ λΉ„μ›Œλ‘κ³  였직 μˆœμˆ˜ν•œ μ»΄ν¬λ„ŒνŠΈ ν‹€λ§Œ λ°°μΉ˜ν•©λ‹ˆλ‹€.
22
+ * πŸ’‘ μŠ€νƒ€μΌ κ°„μ„­ μ—†λŠ” κΉ¨λ—ν•œ 순수 μŠ€μΌ€ν΄λ”© μ„ μ–Έ
23
23
  */
24
24
  #renderScaffolding() {
25
25
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
@@ -54,13 +54,13 @@ export class NineDiffPopup extends HTMLElement {
54
54
  }
55
55
 
56
56
  /**
57
- * πŸ’‘ [100% 데이터 기반 동적 νƒ­/에디터 λΉŒλ“œ μ—”μ§„]
57
+ * πŸ’‘ [μ™„λ²½ μΊ‘μŠν™” 데이터 ν”Όλ”©]
58
58
  */
59
59
  async data(fileList) {
60
60
  if (!Array.isArray(fileList) || fileList.length === 0) return this;
61
61
  this.#fileList = fileList;
62
62
 
63
- // 1. 🧼 μƒˆλ‘œμš΄ 바인딩 μ„Έμ…˜ μ‹œμž‘ μ „ Light DOM μžμ‹ λ…Έλ“œ μ „λŸ‰ μ²­μ†Œ (이전 μž”μƒ 제거)
63
+ // 1. 🧼 이전 μ„Έμ…˜μ˜ 동적 λ²„νŠΌκ³Ό 컨텐츠듀을 μ™„μ „νžˆ μ΄ˆκΈ°ν™”(Clean)
64
64
  if (this.#tabContainer && typeof this.#tabContainer.clearTabs === 'function') {
65
65
  this.#tabContainer.clearTabs();
66
66
  }
@@ -73,59 +73,51 @@ export class NineDiffPopup extends HTMLElement {
73
73
  return 'javascript';
74
74
  };
75
75
 
76
- // 2. ⚑ λ“€μ–΄μ˜¨ 데이터 κ°―μˆ˜μ™€ λ ˆμ΄μ–΄ λͺ…세에 맞좰 <nine-tab-page> ꡬ쑰λ₯Ό μ‘°λ¦½ν•˜μ—¬ λ°€μ–΄ λ„£μŠ΅λ‹ˆλ‹€.
76
+ // 2. ⚑ λ°±μ—”λ“œ λͺ…μ„Έ 개수만큼 μˆœμˆ˜ν•˜κ²Œ 고유 κ΄€μ œνƒ‘ API만 트리거
77
77
  fileList.forEach((file) => {
78
78
  const { layer, full_path } = file;
79
79
  const fileName = full_path.split('/').pop() || "Unknown";
80
80
  const captionName = `${layer.toUpperCase()} (${fileName})`;
81
81
 
82
- // πŸ’‘ 정석 μ»΄ν¬λ„ŒνŠΈ κ·œκ²©μ— λ§žμΆ”μ–΄ νƒœκ·Έ ν…œν”Œλ¦Ώ 슀트링 ν˜•νƒœλ‘œ κ°€κ³΅ν•˜μ—¬ push
82
+ // λ‚ κ²ƒμ˜ 에디터 λ§ˆν¬μ—… λ¬Έμžμ—΄ νŒ¨ν‚€μ§•
83
83
  const targetHtmlContent = `<nine-diff class="${layer}"></nine-diff>`;
84
84
 
85
+ // πŸ’‘ 핡심: μ •μ„λŒ€λ‘œ NineTab λ‚΄λΆ€ μ‹€μ‹œκ°„ 쑰립 기동 μ§€μ‹œ
85
86
  if (this.#tabContainer && typeof this.#tabContainer.addTabPage === 'function') {
86
87
  this.#tabContainer.addTabPage(captionName, targetHtmlContent);
87
88
  }
88
89
  });
89
90
 
90
- // 3. ⏰ [결정적 타이밍 νŠœλ‹]: nine-tab λ‚΄λΆ€μ—μ„œ refresh() 연산이 λλ‚˜
91
- // 에디터 단말 μž₯μΉ˜λ“€μ΄ μ„€λ„μš° 돔 μ•ˆμ°©μ„ μ™„λ²½ν•˜κ²Œ λλ§ˆμΉ˜λ„λ‘ 더블 ν”„λ ˆμž„ λ§ˆμ§„(requestAnimationFrame) 확보
92
- requestAnimationFrame(() => {
93
- requestAnimationFrame(() => {
94
- fileList.forEach((file) => {
95
- const { layer, full_path, asis_source, source } = file;
96
-
97
- // nine-tab의 shadowRoot λ‚΄λΆ€ κ΄€μ œλ₯Ό 톡해 μ•ˆμ •μ μœΌλ‘œ λΆ„ν•  이사 μ™„λ£Œλœ 에디터 μΈμŠ€ν„΄μŠ€ μ •λ°€ 좔적
98
- const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
99
-
100
- if (diff && typeof diff.initialize === 'function') {
101
- const lang = detectLanguage(full_path);
102
- // 에디터 핡심 λͺ¨λ“ˆ(CodeMirror) 기동 μ‹œκ·Έλ„ 전솑
103
- diff.initialize(asis_source || "", source || "", lang);
104
- } else {
105
- trace.error(`❌ 동적 에디터 탐색 μœ μ‹€: nine-diff.${layer}`);
106
- }
107
- });
108
-
109
- // 4. λͺ¨λ“  데이터 λ‘œλ“œκ°€ μ—λŸ¬ 없이 μ™„μ „νžˆ νƒ‘μž¬λœ 것을 ν™•μ •ν•˜κ³  포컀싱 앑츄에이터 μ΅œμ’… 가동!
110
- if (this.#tabContainer && typeof this.#tabContainer.initialize === 'function') {
111
- this.#tabContainer.initialize();
91
+ // 3. ⏰ 데이터 μ£Όμž… μ—°μ‚° μ‹€ν–‰
92
+ // μš”μ†Œλ₯Ό μ„€λ„μš° λ”μ˜ κ°€μ‹œ λ Œλ” νŠΈλ¦¬μ— 직접 κ½‚μ•˜κΈ° λ•Œλ¬Έμ— κΈ΄ μ§€μ—° μ‹œκ°„μ΄ μ „ν˜€ ν•„μš” μ—†μŠ΅λ‹ˆλ‹€.
93
+ setTimeout(() => {
94
+ fileList.forEach((file) => {
95
+ const { layer, full_path, asis_source, source } = file;
96
+ const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
97
+
98
+ if (diff && typeof diff.initialize === 'function') {
99
+ const lang = detectLanguage(full_path);
100
+ diff.initialize(asis_source || "", source || "", lang);
112
101
  }
113
102
  });
114
- });
103
+
104
+ // 4. λͺ¨λ“  μ†ŒμŠ€ 동기화 μ™„λ£Œ ν›„ μ˜€λ¦¬μ§€λ„ 포컀싱 앑츄에이터 트리거 (첫 번째 ν™œμ„± νƒ­ μ—΄κΈ°)
105
+ if (this.#tabContainer && typeof this.#tabContainer.initialize === 'function') {
106
+ this.#tabContainer.initialize();
107
+ }
108
+ }, 50);
115
109
 
116
110
  return this;
117
111
  }
118
112
 
119
113
  /**
120
- * πŸ’‘ [일괄 물리 파일 μ €μž₯]
114
+ * πŸ’‘ [일괄 물리 μ €μž₯]
121
115
  */
122
116
  async #handleConfirmAll() {
123
117
  const payloadList = [];
124
118
 
125
119
  for (const file of this.#fileList) {
126
120
  const { layer, full_path, asis_source } = file;
127
-
128
- // 일괄 μˆ˜μ§‘ μ‹œμ μ—λ„ μ•ˆμ „ν•˜κ²Œ nine-tab의 shadowRootλ₯Ό κ΄€ν†΅ν•˜μ—¬ μ΅œμ’… 버퍼 μŠ€μΊ”
129
121
  const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
130
122
  const currentContent = diff ? diff.getContents() : asis_source;
131
123