@nine-lab/nine-mu 0.1.289 → 0.1.290

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.289",
3
+ "version": "0.1.290",
4
4
  "description": "AI-Driven Full-Stack Code Fabrication Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/nine-mu.umd.js",
@@ -5,7 +5,7 @@ import '@nine-lab/nine-util';
5
5
  export class NineDiffPopup extends HTMLElement {
6
6
  #dialog = null;
7
7
  #tabContainer = null;
8
- #fileList = []; // 최종 [모두 저장]을 위한 차분 명세 데이터 버퍼
8
+ #fileList = []; // 최종 일괄 저장을 위한 데이터 버퍼
9
9
  #host;
10
10
 
11
11
  constructor() {
@@ -19,7 +19,8 @@ export class NineDiffPopup extends HTMLElement {
19
19
  }
20
20
 
21
21
  /**
22
- * 💡 기본 다이얼로그 외곽 프레임 및 스타일 스케폴딩 렌더링
22
+ * 💡 [기존 방식 복구] 스타일 전량 제거하고,
23
+ * 기존 소스처럼 nine-tab 내부에 nine-tab-page 2개를 정적으로 미리 박아 놓습니다.
23
24
  */
24
25
  #renderScaffolding() {
25
26
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
@@ -32,14 +33,18 @@ export class NineDiffPopup extends HTMLElement {
32
33
  </style>
33
34
 
34
35
  <nine-dialog>
35
- <div class="main-layout">
36
- <div class="tab-area">
37
- <nine-tab theme="theme-3"></nine-tab>
38
- </div>
39
- <div class="footer">
40
- <button class="btn btn-cancel">취소</button>
41
- <button class="btn btn-confirm">모두 저장</button>
42
- </div>
36
+ <nine-tab theme="theme-3">
37
+ <nine-tab-page caption="MYBATIS">
38
+ <nine-diff class="MyBatis"></nine-diff>
39
+ </nine-tab-page>
40
+ <nine-tab-page caption="JAVASCRIPT">
41
+ <nine-diff class="JavaScript"></nine-diff>
42
+ </nine-tab-page>
43
+ </nine-tab>
44
+
45
+ <div class="footer">
46
+ <button class="btn btn-cancel">취소</button>
47
+ <button class="btn btn-confirm">모두 저장</button>
43
48
  </div>
44
49
  </nine-dialog>
45
50
  `;
@@ -57,17 +62,13 @@ export class NineDiffPopup extends HTMLElement {
57
62
  }
58
63
 
59
64
  /**
60
- * 💡 [정석 데이터 위임 연동 엔진]
65
+ * 💡 [기존 정적 매핑 방식]
66
+ * 동적 생성 없이, 이미 조립되어 들어간 nine-tab 내부의 에디터를 정밀 타격하여 데이터만 꽂습니다.
61
67
  */
62
68
  async data(fileList) {
63
69
  if (!Array.isArray(fileList) || fileList.length === 0) return this;
64
70
  this.#fileList = fileList;
65
71
 
66
- // 1. 🧼 기존 동적 버퍼 완전 리셋
67
- if (this.#tabContainer && typeof this.#tabContainer.clearTabs === 'function') {
68
- this.#tabContainer.clearTabs();
69
- }
70
-
71
72
  const detectLanguage = (path) => {
72
73
  const lower = (path || "").toLowerCase();
73
74
  if (lower.endsWith('.xml')) return 'xml';
@@ -76,40 +77,40 @@ export class NineDiffPopup extends HTMLElement {
76
77
  return 'javascript';
77
78
  };
78
79
 
79
- // 2. 백엔드 조립 데이터를 순회하며 탭 스케폴딩 빌드
80
- fileList.forEach((file) => {
81
- const { layer, full_path } = file;
82
- const fileName = full_path.split('/').pop() || "Unknown";
83
- const captionName = `${layer.toUpperCase()} (${fileName})`;
84
-
85
- // 💡 탭 내부에 주입될 에디터 뼈대 마크업 준비
86
- const targetHtmlContent = `
87
- <div class="diff-wrapper">
88
- <nine-diff class="${layer}"></nine-diff>
89
- </div>
90
- `;
91
-
92
- if (this.#tabContainer && typeof this.#tabContainer.addTabPage === 'function') {
93
- this.#tabContainer.addTabPage(captionName, targetHtmlContent);
94
- }
95
- });
96
-
97
- // 3. ⏰ [핵심 수정]: 마운트 완료 후, nine-tab의 Shadow DOM 내부로 깊숙이 파고들어 에디터를 셀렉팅합니다.
80
+ // 💡 중요: nine-tab의 #renderTabs()와 #init()이 끝난
81
+ // 섀도우 돔 내부(.tab-pages) 이사 간 에디터 인스턴스들을 정확하게 추적합니다.
98
82
  setTimeout(() => {
99
83
  fileList.forEach((file) => {
100
84
  const { layer, full_path, asis_source, source } = file;
101
85
 
102
- // 🎯 변경 포인트: 렌더링 결과물은 nine-tab 컴포넌트 내부 섀도우 루트 안에 안착해 있습니다!
86
+ // 🎯 렌더링이 완료된 실제 단말 장치는 nine-tab shadowRoot 안에 박혀 있습니다.
103
87
  const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
104
88
 
105
89
  if (diff) {
106
90
  const lang = detectLanguage(full_path);
91
+
92
+ // 탭 버튼의 상단 텍스트(캡션)도 실제 파일명에 맞춰 동기화 시켜줍니다.
93
+ const fileName = full_path.split('/').pop() || "Unknown";
94
+ const tabButtons = this.#tabContainer.shadowRoot.querySelectorAll('.tab-button');
95
+
96
+ tabButtons.forEach(btn => {
97
+ if (btn.textContent.trim() === layer.toUpperCase()) {
98
+ btn.textContent = `${layer.toUpperCase()} (${fileName})`;
99
+ }
100
+ });
101
+
102
+ // 날것의 소스 데이터 바인딩 초기화 실행
107
103
  diff.initialize(asis_source || "", source || "", lang);
108
104
  } else {
109
- trace.error(`❌ 에디터 탐색 실패: nine-diff.${layer}`);
105
+ trace.error(`❌ 에디터 인스턴스를 찾을 수 없습니다: nine-diff.${layer}`);
110
106
  }
111
107
  });
112
- }, 150); // 돔 트래킹 안정성을 위해 마진 확보
108
+
109
+ // 데이터 세팅 완료 후 nine-tab 초기 포커싱 가동
110
+ if (this.#tabContainer && typeof this.#tabContainer.initialize === 'function') {
111
+ this.#tabContainer.initialize();
112
+ }
113
+ }, 100);
113
114
 
114
115
  return this;
115
116
  }
@@ -123,7 +124,7 @@ export class NineDiffPopup extends HTMLElement {
123
124
  for (const file of this.#fileList) {
124
125
  const { layer, full_path, asis_source } = file;
125
126
 
126
- // 🎯 변경 포인트: 저장 시점에도 nine-tab의 shadowRoot를 경유하여 최종 수정본 소스를 캡처합니다.
127
+ // 저장 시점에도 nine-tab의 shadowRoot를 관통하여 데이터를 스캔합니다.
127
128
  const diff = this.#tabContainer.shadowRoot.querySelector(`nine-diff.${layer}`);
128
129
  const currentContent = diff ? diff.getContents() : asis_source;
129
130