@nine-lab/nine-mu 0.1.344 โ†’ 0.1.345

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.344",
3
+ "version": "0.1.345",
4
4
  "description": "AI-Driven Full-Stack Code Fabrication Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/nine-mu.umd.js",
@@ -11,14 +11,11 @@ export class ExceptionHook extends HTMLElement {
11
11
  constructor() {
12
12
  super();
13
13
  this.attachShadow({ mode: 'open' });
14
- trace.log("๐Ÿ” [nine-exception-hook] ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ๋จ");
15
14
  }
16
15
 
17
16
  connectedCallback() {
18
- trace.log("๐Ÿ” [nine-exception-hook] DOM์— ๋งˆ์šดํŠธ๋จ. ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ ๋ฐ”์ธ๋”ฉ ์‹œ์ž‘");
19
17
  this.#renderer();
20
18
  this.#injectShadowStylesheet();
21
-
22
19
  this.#setupGlobalSniffer();
23
20
 
24
21
  window.addEventListener('unhandledrejection', this.#handlePromiseError, true);
@@ -27,7 +24,6 @@ export class ExceptionHook extends HTMLElement {
27
24
  }
28
25
 
29
26
  disconnectedCallback() {
30
- trace.log("๐Ÿ” [nine-exception-hook] DOM์—์„œ ์–ธ๋งˆ์šดํŠธ๋จ. ๋ฆฌ์Šค๋„ˆ ํ•ด์ œ");
31
27
  window.removeEventListener('error', this.#handleRuntimeError, true);
32
28
  window.removeEventListener('unhandledrejection', this.#handlePromiseError, true);
33
29
  window.removeEventListener('popstate', this.#handleLocationChange);
@@ -35,56 +31,67 @@ export class ExceptionHook extends HTMLElement {
35
31
 
36
32
  if (window.onerror === this.#handleRuntimeError || this.#oldOnError) {
37
33
  window.onerror = this.#oldOnError;
38
- trace.log("๐Ÿ” [nine-exception-hook] window.onerror ๋ณต๊ตฌ ์™„๋ฃŒ");
39
34
  }
40
-
41
- // ํ™”๋ฉด ๋ฆฌ์…‹ ์‹œ ๋ฐ•ํ˜€์žˆ๋˜ ๋ฐ”๊นฅ์ชฝ ์—๋Ÿฌ ์ปจํ…Œ์ด๋„ˆ ์ œ๊ฑฐ
42
- this.#removeExternalOverlay();
43
35
  }
44
36
 
45
37
  #setupGlobalSniffer() {
46
38
  window.addEventListener('error', this.#handleRuntimeError, true);
47
- trace.log("๐Ÿ” [nine-exception-hook] window.addEventListener('error') ๋“ฑ๋ก ์™„๋ฃŒ");
48
39
 
49
40
  this.#oldOnError = window.onerror;
50
41
  window.onerror = (message, source, lineno, colno, error) => {
51
- trace.log("๐Ÿšจ [nine-exception-hook] ์›์‹œ window.onerror ํฌ์ฐฉ!!", { message, source, lineno, error });
52
-
53
42
  if (!this.#hasError) {
54
- trace.log("๐ŸŽฏ [nine-exception-hook] ํ˜„์žฌ ์—๋Ÿฌ ์ƒํƒœ ์—†์Œ -> ์—๋Ÿฌ ๋ณด๋“œ ์ถœ๋ ฅ ์‹œ๋„");
55
43
  const errorMessage = error?.message || message || "์•Œ ์ˆ˜ ์—†๋Š” ๋Ÿฐํƒ€์ž„ ์˜ˆ์™ธ";
56
44
  const errorStack = error?.stack || `${source}:${lineno}:${colno}`;
57
45
  this.#renderError(errorMessage, errorStack);
58
- } else {
59
- trace.log("โš ๏ธ [nine-exception-hook] ์ด๋ฏธ ์—๋Ÿฌ ํ™”๋ฉด์ด ํ™œ์„ฑํ™”๋˜์–ด ์žˆ์–ด ์›์‹œ onerror ํŒจ์Šค");
60
46
  }
61
-
62
47
  if (this.#oldOnError) {
63
- trace.log("๐Ÿ”„ [nine-exception-hook] ๊ธฐ์กด์— ๋“ฑ๋ก๋˜์–ด ์žˆ๋˜ ๋‹ค๋ฅธ onerror ์—”์ง„์œผ๋กœ ์œ„์ž„");
64
48
  return this.#oldOnError(message, source, lineno, colno, error);
65
49
  }
66
50
  return false;
67
51
  };
68
- trace.log("๐Ÿ” [nine-exception-hook] ์›์‹œ window.onerror ๊ฐ€๋กœ์ฑ„๊ธฐ(Chaining) ์™„๋ฃŒ");
69
52
  }
70
53
 
71
54
  #renderer = () => {
72
55
  const customImport = nine.cssPath ? `@import "${nine.cssPath}/nine-mu.css";` : "";
73
56
 
57
+ // ๐ŸŽฏ [ํ•ต์‹ฌ ๋ณ€๊ฒฝ 1] :host ์ž์ฒด๋ฅผ absolute์˜ ๊ธฐ์ค€์ ์ด ๋˜๋Š” block์œผ๋กœ ์žก๊ณ ,
58
+ // ๋ฆฌ์•กํŠธ ์Šฌ๋กฏ ๋‚ด์šฉ๋ฌผ(๋ฉ”๋‰ด ๋“ฑ)์€ ์ ˆ๋Œ€ ์ˆจ๊ธฐ์ง€ ์•Š๊ณ  100% ํฌ๊ธฐ๋กœ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.
74
59
  this.shadowRoot.innerHTML = `
75
60
  <style>
76
61
  @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${__APP_VERSION__}/dist/css/nine-mu.css";
77
62
  ${customImport}
63
+
78
64
  :host {
79
65
  display: block;
80
66
  width: 100%;
81
67
  height: 100%;
68
+ position: relative !important; /* ๋‚ด๋ถ€ ์—๋Ÿฌ ๋ณด๋“œ์˜ ๊ธฐ์ค€์  ๊ธฐ๋‘ฅ ์ƒ์„ฑ */
69
+ }
70
+
71
+ .nine-hook-core {
72
+ width: 100%;
73
+ height: 100%;
74
+ }
75
+
76
+ /* ๐ŸŽฏ [ํ•ต์‹ฌ ๋ณ€๊ฒฝ 2] ๋ฆฌ์•กํŠธ ์Šฌ๋กฏ์„ ๊ฐ€๋ฆฌ์ง€ ์•Š๊ณ , ์˜ค์ง "์ด ์ปดํฌ๋„ŒํŠธ ๊ตฌ์—ญ"๋งŒ ๊ฐ€๋“ ์ฑ„์šฐ๋Š” ๋…๋ฆฝ ํŒ์—… ๋ ˆ์ด์–ด */
77
+ .nine-hook-inner-cover {
78
+ position: absolute !important;
79
+ top: 0 !important;
80
+ left: 0 !important;
81
+ width: 100% !important;
82
+ height: 100% !important;
83
+ box-sizing: border-box !important;
84
+ background-color: #FFF5F5 !important;
85
+ z-index: 2147483647 !important; /* ๋ฆฌ์•กํŠธ ๋‚ด๋ถ€ ๊ทธ ์–ด๋–ค ์˜ค๋ฒ„๋ ˆ์ด๋ณด๋‹ค ๋ฌด์กฐ๊ฑด ์œ„ */
86
+ overflow: auto !important;
87
+ display: none; /* ํ‰์†Œ์—” ์ˆจ๊น€ */
82
88
  }
83
89
  </style>
84
- <div class="nine-hook-core" style="width: 100%; height: 100%;">
90
+
91
+ <div class="nine-hook-core">
85
92
  <slot></slot>
86
93
  </div>
87
- <div class="nine-exception-board"></div>
94
+ <div class="nine-exception-board class-target-board"></div>
88
95
  `;
89
96
  }
90
97
 
@@ -98,8 +105,6 @@ export class ExceptionHook extends HTMLElement {
98
105
  }
99
106
 
100
107
  #handleRuntimeError = (event) => {
101
- trace.log("๐Ÿšจ [nine-exception-hook] window.addEventListener('error') ๋ฆฌ์Šค๋„ˆ ํฌ์ฐฉ!!", event);
102
-
103
108
  if (this.#hasError) return;
104
109
 
105
110
  const errorMessage = event.error?.message || event.message || String(event);
@@ -111,8 +116,6 @@ export class ExceptionHook extends HTMLElement {
111
116
  }
112
117
 
113
118
  #handlePromiseError = (event) => {
114
- trace.log("๐Ÿšจ [nine-exception-hook] unhandledrejection (Promise ์—๋Ÿฌ) ํฌ์ฐฉ!!", event);
115
-
116
119
  if (this.#hasError) return;
117
120
 
118
121
  const reason = event.reason;
@@ -125,28 +128,21 @@ export class ExceptionHook extends HTMLElement {
125
128
  #handleLocationChange = () => {
126
129
  setTimeout(() => {
127
130
  if (this.#hasError && this.#lastPath !== window.location.pathname) {
128
- trace.log("โœจ [nine-exception-hook] Shadow DOM ๋ฐ ๊ธ€๋กœ๋ฒŒ ์˜ค๋ฒ„๋ ˆ์ด ๋‚ด๋ถ€ ์˜ˆ์™ธ ์ฒญ์†Œ ๋ฐ ์ •์ƒ ๋ณต๊ตฌ");
129
131
  this.#lastPath = window.location.pathname;
130
132
  this.#hasError = false;
131
133
 
132
- this.#removeExternalOverlay();
133
-
134
- const coreContainer = this.shadowRoot.querySelector('.nine-hook-core');
135
- if (coreContainer) coreContainer.style.display = '';
134
+ const exceptionBoard = this.shadowRoot.querySelector('.nine-exception-board');
135
+ if (exceptionBoard) {
136
+ exceptionBoard.innerHTML = '';
137
+ exceptionBoard.className = 'nine-exception-board'; // ํด๋ž˜์Šค ๋ฆฌ์…‹
138
+ }
136
139
  }
137
140
  }, 50);
138
141
  }
139
142
 
140
- #removeExternalOverlay() {
141
- const target = document.getElementById('nine-global-exception-container');
142
- if (target) target.remove();
143
- }
144
-
145
143
  #sendToAiAction = async (errorMessage, errorStack) => {
146
- // ๊ธ€๋กœ๋ฒŒ ์—˜๋ฆฌ๋จผํŠธ ๋‚ด์—์„œ ํƒ์ƒ‰ํ•˜๋„๋ก ๋ณ€๊ฒฝ
147
- const root = document.getElementById('nine-global-exception-container') || this.shadowRoot;
148
- const btn = root.querySelector('.nine-ai-btn');
149
- const footer = root.querySelector('.nine-error-footer');
144
+ const btn = this.shadowRoot.querySelector('.nine-ai-btn');
145
+ const footer = this.shadowRoot.querySelector('.nine-error-footer');
150
146
  if (!btn) return;
151
147
 
152
148
  btn.disabled = true;
@@ -167,7 +163,6 @@ export class ExceptionHook extends HTMLElement {
167
163
  throw new Error("window.triggerAutoRecovery ๊ด€์ œํƒ‘ ์—”์ง„์ด ๋กœ๋“œ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.");
168
164
  }
169
165
  } catch (err) {
170
- trace.error("โŒ AI ์ „์†ก ์‹คํŒจ:", err);
171
166
  btn.disabled = false;
172
167
  btn.innerText = "โŒ ์žฌ์ „์†ก ์‹œ๋„";
173
168
  footer.innerHTML = `<span style="color: #E53E3E;">โš ๏ธ ์ „์†ก ์‹คํŒจ: ${err.message}</span>`;
@@ -179,55 +174,33 @@ export class ExceptionHook extends HTMLElement {
179
174
  this.#hasError = true;
180
175
 
181
176
  setTimeout(() => {
182
- trace.log("๐ŸŽจ [nine-exception-hook] ๋ฆฌ์•กํŠธ ์‚ฌ์ดํด ์ข…๋ฃŒ ํ›„ ์ตœ์ƒ๋‹จ ๊ธ€๋กœ๋ฒŒ ์—๋Ÿฌ ๋ ˆ์ด์–ด ์ƒ์„ฑ");
183
-
184
- const coreContainer = this.shadowRoot.querySelector('.nine-hook-core');
185
- if (coreContainer) coreContainer.style.display = 'none';
186
-
187
- // ๐ŸŽฏ [ํ•ต์‹ฌ ๋ณ€๊ฒฝ] Shadow DOM ๋‚ด๋ถ€๊ฐ€ ์•„๋‹ˆ๋ผ document.body์— ์ง์ ‘ fixed ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๊ฝ‚์•„๋ฒ„๋ ค
188
- // global-loading-overlay๋ฅผ ์™„๋ฒฝํžˆ ๋ฎ์–ด๋ฒ„๋ฆฝ๋‹ˆ๋‹ค.
189
- this.#removeExternalOverlay();
190
-
191
- const externalContainer = document.createElement('div');
192
- externalContainer.id = 'nine-global-exception-container';
193
-
194
- // ์ธ๋ผ์ธ ์Šคํƒ€์ผ๋กœ ์™ธ๋ถ€ ์š”์†Œ๋ฅผ ์™„์ „ํžˆ ์ฐจ๋‹จํ•˜๊ณ  ๋งจ ์•ž์œผ๋กœ ๋ฐฐ์น˜
195
- Object.assign(externalContainer.style, {
196
- position: 'fixed',
197
- top: '0',
198
- left: '0',
199
- width: '100vw',
200
- height: '100vh',
201
- backgroundColor: '#FFF5F5',
202
- zIndex: '2147483647', // ๋ธŒ๋ผ์šฐ์ € ํ‘œํ˜„ ์ตœ๋Œ€ z-index ๊ฐ’ ๋ถ€์—ฌ
203
- overflow: 'auto',
204
- boxSizing: 'border-box',
205
- display: 'block'
206
- });
177
+ const exceptionBoard = this.shadowRoot.querySelector('.nine-exception-board');
178
+ if (!exceptionBoard) return;
179
+
180
+ // ๐ŸŽฏ [ํ•ต์‹ฌ ๋ณ€๊ฒฝ 3] ๊ธฐ์กด ์Šฌ๋กฏ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ˆจ๊ธฐ์ง€(display: none) ์•Š์Šต๋‹ˆ๋‹ค!
181
+ // ๋Œ€์‹  ์—๋Ÿฌ ๋ณด๋“œ์— ์ปค๋ฒ„ ํด๋ž˜์Šค๋ฅผ ์ฃผ์ž…ํ•˜์—ฌ "์˜ค์ง ๋ณธ๋ฌธ ๊ณต๊ฐ„๋งŒ" ๋ฌผ๋ฆฌ์ ์œผ๋กœ ์™„์ „ํžˆ ๋ฎ์–ด์”Œ์›๋‹ˆ๋‹ค.
182
+ exceptionBoard.className = 'nine-hook-inner-cover';
207
183
 
208
184
  const errorHTML = `
209
- <div class="nine-error-container" style="padding: 40px; max-width: 1200px; margin: 40px auto; font-family: sans-serif; background: white; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.08); text-align: left;">
210
- <h3 class="nine-error-title" style="color: #C53030; margin-top: 0; font-size: 22px; font-weight: 700; border-bottom: 2px solid #FED2D2; padding-bottom: 12px; font-family: sans-serif;">โš ๏ธ ์‹œ์Šคํ…œ ์˜ˆ์™ธ ๊ฐ์ง€ (nine-exception-hook)</h3>
211
- <p class="nine-error-label" style="font-weight: bold; margin: 20px 0 8px 0; color: #4A5568; font-size: 15px; font-family: sans-serif;">[์—๋Ÿฌ ์›์ธ ๋กœ๊ทธ]:</p>
212
- <pre class="nine-error-log" style="background: #1A202C; color: #EDF2F7; padding: 20px; border-radius: 6px; overflow-x: auto; white-space: pre-wrap; font-family: monospace; font-size: 14px; line-height: 1.6; margin-bottom: 25px;">${errorMessage}\n\n[Stack Trace]\n${errorStack}</pre>
185
+ <div class="nine-error-container" style="padding: 30px; box-sizing: border-box; font-family: sans-serif; background: white; min-height: 100%; text-align: left;">
186
+ <h3 class="nine-error-title" style="color: #C53030; margin-top: 0; font-size: 20px; font-weight: 700; border-bottom: 2px solid #FED2D2; padding-bottom: 12px; font-family: sans-serif;">โš ๏ธ ์‹œ์Šคํ…œ ์˜ˆ์™ธ ๊ฐ์ง€ (${this.tagName.toLowerCase()})</h3>
187
+ <p class="nine-error-label" style="font-weight: bold; margin: 15px 0 6px 0; color: #4A5568; font-size: 14px; font-family: sans-serif;">[์—๋Ÿฌ ์›์ธ ๋กœ๊ทธ]:</p>
188
+ <pre class="nine-error-log" style="background: #1A202C; color: #EDF2F7; padding: 15px; border-radius: 6px; overflow-x: auto; white-space: pre-wrap; font-family: monospace; font-size: 13px; line-height: 1.5; margin-bottom: 20px;">${errorMessage}\n\n[Stack Trace]\n${errorStack}</pre>
213
189
 
214
- <div class="nine-action-area" style="display: flex; align-items: center; gap: 20px; border-top: 1px solid #E2E8F0; padding-top: 20px;">
215
- <button class="nine-ai-btn" style="background: #3182CE; color: white; border: none; padding: 14px 28px; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 16px;">๐Ÿค– AI์—๊ฒŒ ์†Œ์Šค์ฝ”๋“œ ์ˆ˜์ • ์š”์ฒญ</button>
216
- <div class="nine-error-footer" style="font-size: 14px; color: #718096; line-height: 1.4; font-family: sans-serif;">
190
+ <div class="nine-action-area" style="display: flex; align-items: center; gap: 15px; border-top: 1px solid #E2E8F0; padding-top: 15px;">
191
+ <button class="nine-ai-btn" style="background: #3182CE; color: white; border: none; padding: 10px 20px; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 14px;">๐Ÿค– AI์—๊ฒŒ ์†Œ์Šค์ฝ”๋“œ ์ˆ˜์ • ์š”์ฒญ</button>
192
+ <div class="nine-error-footer" style="font-size: 13px; color: #718096; line-height: 1.4; font-family: sans-serif;">
217
193
  ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด AI๊ฐ€ ๋กœ๊ทธ ๋ฐ ์ปดํฌ๋„ŒํŠธ ๋งต์„ ์—ญ์ถ”์ ํ•˜์—ฌ ์ˆ˜์ •์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.
218
194
  </div>
219
195
  </div>
220
196
  </div>
221
197
  `;
222
198
 
223
- externalContainer.innerHTML = errorHTML;
224
- document.body.appendChild(externalContainer);
225
- trace.log("๐ŸŽจ [nine-exception-hook] ๋ธŒ๋ผ์šฐ์ € Body ์ตœ์ƒ๋‹จ ๋ ˆ์ด์–ด ๋ฐฐ์ • ์„ฑ๊ณต");
199
+ exceptionBoard.innerHTML = errorHTML;
226
200
 
227
- const aiBtn = externalContainer.querySelector('.nine-ai-btn');
201
+ const aiBtn = exceptionBoard.querySelector('.nine-ai-btn');
228
202
  if (aiBtn) {
229
203
  aiBtn.addEventListener('click', () => this.#sendToAiAction(errorMessage, errorStack));
230
- trace.log("๐ŸŽจ [nine-exception-hook] AI ์š”์ฒญ ๋ฒ„ํŠผ ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ ์ตœ์ข… ๋ฐ”์ธ๋”ฉ ์„ฑ๊ณต");
231
204
  }
232
205
  }, 0);
233
206
  }