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

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.291",
3
+ "version": "0.1.293",
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")}";` : "";
@@ -32,12 +32,7 @@ export class NineDiffPopup extends HTMLElement {
32
32
  </style>
33
33
 
34
34
  <nine-dialog>
35
- <nine-tab theme="theme-3">
36
- <nine-tab-page caption="MYBATIS" id="layer_MyBatis"></nine-tab-page>
37
- <nine-tab-page caption="SERVICE" id="layer_Service"></nine-tab-page>
38
- <nine-tab-page caption="CONTROLLER" id="layer_Controller"></nine-tab-page>
39
- <nine-tab-page caption="JAVASCRIPT" id="layer_JavaScript"></nine-tab-page>
40
- </nine-tab>
35
+ <nine-tab theme="theme-3"></nine-tab>
41
36
 
42
37
  <div class="footer">
43
38
  <button class="btn btn-cancel">μ·¨μ†Œ</button>
@@ -59,12 +54,17 @@ export class NineDiffPopup extends HTMLElement {
59
54
  }
60
55
 
61
56
  /**
62
- * πŸ’‘ [ν‹€ κ³ μ • + 에디터 동적 μΈμŠ€ν„΄μ‹± μ—”μ§„]
57
+ * πŸ’‘ [100% 데이터 기반 동적 νƒ­/에디터 λΉŒλ“œ μ—”μ§„]
63
58
  */
64
59
  async data(fileList) {
65
60
  if (!Array.isArray(fileList) || fileList.length === 0) return this;
66
61
  this.#fileList = fileList;
67
62
 
63
+ // 1. 🧼 μƒˆλ‘œμš΄ 바인딩 μ„Έμ…˜ μ‹œμž‘ μ „ Light DOM μžμ‹ λ…Έλ“œ μ „λŸ‰ μ²­μ†Œ (이전 μž”μƒ 제거)
64
+ if (this.#tabContainer && typeof this.#tabContainer.clearTabs === 'function') {
65
+ this.#tabContainer.clearTabs();
66
+ }
67
+
68
68
  const detectLanguage = (path) => {
69
69
  const lower = (path || "").toLowerCase();
70
70
  if (lower.endsWith('.xml')) return 'xml';
@@ -73,65 +73,51 @@ export class NineDiffPopup extends HTMLElement {
73
73
  return 'javascript';
74
74
  };
75
75
 
76
- // 1. ⏰ nine-tab μ»΄ν¬λ„ŒνŠΈμ˜ μ˜€λ¦¬μ§€λ„ 정적 νŒŒμ‹±(#renderTabs) 연산이 μ™„λ£Œλ  λ•ŒκΉŒμ§€ λ―Έμ„Έν•œ λ§ˆμ§„ 확보
77
- setTimeout(() => {
78
- const activeLayers = fileList.map(f => f.layer);
79
-
80
- // νƒ­ μ»΄ν¬λ„ŒνŠΈ λ‚΄λΆ€ μ„€λ„μš° λ”μœΌλ‘œ 이사 κ°„ μ‹€μ œ νƒ­ νŽ˜μ΄μ§€ λ²„νŠΌκ³Ό 컨텐츠 μ»¨ν…Œμ΄λ„ˆ μ˜μ—­ 확보
81
- const tabButtons = this.#tabContainer.shadowRoot.querySelectorAll('.tab-button');
82
-
83
- // 4λŒ€ κ³ μ • λ ˆμ΄μ–΄ λͺ…μ„Έ μ •μ˜
84
- const targetLayers = ["MyBatis", "Service", "Controller", "JavaScript"];
76
+ // 2. ⚑ λ“€μ–΄μ˜¨ 데이터 κ°―μˆ˜μ™€ λ ˆμ΄μ–΄ λͺ…세에 맞좰 <nine-tab-page> ꡬ쑰λ₯Ό μ‘°λ¦½ν•˜μ—¬ λ°€μ–΄ λ„£μŠ΅λ‹ˆλ‹€.
77
+ fileList.forEach((file) => {
78
+ const { layer, full_path } = file;
79
+ const fileName = full_path.split('/').pop() || "Unknown";
80
+ const captionName = `${layer.toUpperCase()} (${fileName})`;
85
81
 
86
- targetLayers.forEach((layerName, index) => {
87
- const currentBtn = tabButtons[index];
88
- // nine-tab λ‚΄λΆ€ μ„€λ„μš° 돔에 μ‘°λ¦½λ˜μ–΄ λŒ€κΈ° 쀑인 μ‹€μ œ νŽ˜μ΄μ§€ λͺΈμ²΄ λ³Έλ¬Έ div
89
- const pageBody = this.#tabContainer.shadowRoot.getElementById(`content${index}`);
82
+ // πŸ’‘ 정석 μ»΄ν¬λ„ŒνŠΈ κ·œκ²©μ— λ§žμΆ”μ–΄ νƒœκ·Έ ν…œν”Œλ¦Ώ 슀트링 ν˜•νƒœλ‘œ κ°€κ³΅ν•˜μ—¬ push
83
+ const targetHtmlContent = `<nine-diff class="${layer}"></nine-diff>`;
90
84
 
91
- if (!pageBody) return;
92
-
93
- // 이번 λ°±μ—”λ“œ μ™„λ£Œ μ‹œκ·Έλ„μ— ν•΄λ‹Ή λ ˆμ΄μ–΄ μˆ˜μ • λͺ…μ„Έκ°€ ν¬ν•¨λ˜μ–΄ μžˆλ‹€λ©΄?
94
- if (activeLayers.includes(layerName)) {
95
- const fileData = fileList.find(f => f.layer === layerName);
96
- const fileName = fileData.full_path.split('/').pop() || "Unknown";
97
-
98
- // A. 상단 νƒ­ λ²„νŠΌ ν…μŠ€νŠΈλ₯Ό μ‹€μ œ 파일λͺ…μœΌλ‘œ 동적 μ—…λ°μ΄νŠΈ 및 λ…ΈμΆœ
99
- if (currentBtn) {
100
- currentBtn.textContent = `${layerName.toUpperCase()} (${fileName})`;
101
- currentBtn.style.display = "unset";
85
+ if (this.#tabContainer && typeof this.#tabContainer.addTabPage === 'function') {
86
+ this.#tabContainer.addTabPage(captionName, targetHtmlContent);
87
+ }
88
+ });
89
+
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}`);
102
106
  }
107
+ });
103
108
 
104
- // B. πŸ”₯ [핡심 μˆ˜μ •]: λ‚΄λΆ€ 에디터 슬둯만 λŸ°νƒ€μž„μ— μ‹±μ‹±ν•˜κ²Œ μ™„μ „νžˆ μƒˆλ‘œ κ΅¬μ›Œμ„œ μ£Όμž… (μ§€μ—° 차단)
105
- pageBody.innerHTML = `<nine-diff class="${layerName}"></nine-diff>`;
106
-
107
- // C. μƒˆλ‘œ νƒœμ–΄λ‚œ 동적 에디터 단말 μž₯치 μ¦‰μ‹œ μΈν„°νŽ˜μ΄μŠ€ μ΄ˆκΈ°ν™”
108
- const freshDiff = pageBody.querySelector(`nine-diff.${layerName}`);
109
- if (freshDiff) {
110
- const lang = detectLanguage(fileData.full_path);
111
- freshDiff.initialize(fileData.asis_source || "", fileData.source || "", lang);
112
- }
113
- } else {
114
- // 이번 νƒœμŠ€ν¬μ—μ„œ μˆ˜μ •λ˜μ§€ μ•Šμ€ μ œμ™Έ μ˜μ—­μ€ 상단 λ²„νŠΌμ„ hide μ²˜λ¦¬ν•˜μ—¬ κΉ”λ”ν•˜κ²Œ λ§ˆμŠ€ν‚Ή
115
- if (currentBtn) {
116
- currentBtn.style.display = "none";
117
- currentBtn.classList.remove("active");
118
- }
119
- pageBody.innerHTML = ""; // 컨텐츠 λ³Έλ¬Έ μ΄ˆκΈ°ν™”
109
+ // 4. λͺ¨λ“  데이터 λ‘œλ“œκ°€ μ—λŸ¬ 없이 μ™„μ „νžˆ νƒ‘μž¬λœ 것을 ν™•μ •ν•˜κ³  포컀싱 앑츄에이터 μ΅œμ’… 가동!
110
+ if (this.#tabContainer && typeof this.#tabContainer.initialize === 'function') {
111
+ this.#tabContainer.initialize();
120
112
  }
121
113
  });
122
-
123
- // 2. 동적 에디터 κ°±μ‹  및 λ§ˆμŠ€ν‚Ή μ™„λ£Œ ν›„, 첫 번째 ν™œμ„±ν™”(Visible)된 νƒ­μœΌλ‘œ μžλ™ 클릭 이동
124
- if (this.#tabContainer && typeof this.#tabContainer.initialize === 'function') {
125
- this.#tabContainer.initialize();
126
- }
127
-
128
- }, 120);
114
+ });
129
115
 
130
116
  return this;
131
117
  }
132
118
 
133
119
  /**
134
- * πŸ’‘ [일괄 물리 μ €μž₯]
120
+ * πŸ’‘ [일괄 물리 파일 μ €μž₯]
135
121
  */
136
122
  async #handleConfirmAll() {
137
123
  const payloadList = [];
@@ -139,7 +125,7 @@ export class NineDiffPopup extends HTMLElement {
139
125
  for (const file of this.#fileList) {
140
126
  const { layer, full_path, asis_source } = file;
141
127
 
142
- // nine-tab λ‚΄λΆ€ μ„€λ„μš° μ˜μ—­ μ•ˆμ—μ„œ 동적 가동 쀑인 에디터 컨텐츠 νƒ€κ²ŸνŒ… 캑처
128
+ // 일괄 μˆ˜μ§‘ μ‹œμ μ—λ„ μ•ˆμ „ν•˜κ²Œ nine-tab의 shadowRootλ₯Ό κ΄€ν†΅ν•˜μ—¬ μ΅œμ’… 버퍼 μŠ€μΊ”
143
129
  const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
144
130
  const currentContent = diff ? diff.getContents() : asis_source;
145
131