@nine-lab/nine-mu 0.1.84 → 0.1.86

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/dist/nine-mu.js CHANGED
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _getSourcePath, _service, _routes, _diffPopup, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _dialog, _diffView, _asisBackup, _host, _NineDiffPopup_instances, render_fn2, handleConfirm_fn, handleCancel_fn;
12
+ var _getSourcePath, _service, _routes, _diffPopup, _packageName, _routesPath, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _makeMenuHandler, _sourceGenHandler, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _dialog, _diffView, _asisBackup, _host, _NineDiffPopup_instances, render_fn2, handleConfirm_fn, handleCancel_fn;
13
13
  import { trace, api, nine } from "@nine-lab/nine-util";
14
14
  class NineMuService {
15
15
  constructor(connectorUrl) {
@@ -106,34 +106,53 @@ class NineChat extends HTMLElement {
106
106
  __privateAdd(this, _service, null);
107
107
  __privateAdd(this, _routes, []);
108
108
  __privateAdd(this, _diffPopup);
109
+ __privateAdd(this, _packageName);
110
+ __privateAdd(this, _routesPath);
111
+ __privateAdd(this, _makeMenuHandler, async (e) => {
112
+ const res = await api.post("/nine-mu/source/readFile", { path: __privateGet(this, _routesPath) });
113
+ trace.log(res);
114
+ const jsonRoutes = (res == null ? void 0 : res.contents) ? JSON.parse(res == null ? void 0 : res.contents) : {};
115
+ trace.log(jsonRoutes);
116
+ });
117
+ __privateAdd(this, _sourceGenHandler, async (e) => {
118
+ const command2 = "";
119
+ const targets = "";
120
+ try {
121
+ const result = await __privateGet(this, _service).generateAll(command2, targets, __privateGet(this, _routes));
122
+ $status.textContent = "✅ 완료";
123
+ nine.alert("소스 생성 성공").rgb();
124
+ this.dispatchEvent(new CustomEvent("nine-mu-completed", { detail: result, bubbles: true }));
125
+ } catch (err) {
126
+ $status.textContent = "❌ 실패";
127
+ nine.alert(err.message).rgb().shake();
128
+ }
129
+ });
109
130
  __publicField(this, "showDiff", (asis, tobe, lang) => {
110
131
  __privateGet(this, _diffPopup).popup().data(asis, tobe, lang);
111
132
  });
112
133
  this.attachShadow({ mode: "open" });
113
134
  }
114
135
  async connectedCallback() {
136
+ __privateSet(this, _packageName, this.getAttribute("package-name"));
115
137
  const connectorUrl = this.getAttribute("connector-url") || "http://localhost:3002";
116
138
  __privateSet(this, _service, new NineMuService(connectorUrl));
117
139
  __privateMethod(this, _NineChat_instances, render_fn).call(this);
118
140
  __privateMethod(this, _NineChat_instances, initInteractions_fn).call(this);
119
141
  __privateMethod(this, _NineChat_instances, initActions_fn).call(this);
120
142
  const res = await api.post("/nine-mu/config/get", {});
121
- const routeUrl = (res == null ? void 0 : res.userDir) + "/" + this.getAttribute("package-name") + "/public/prompts/data/routes.json";
122
- trace.log(routeUrl);
123
- const res2 = await api.post("/nine-mu/source/readFile", { path: routeUrl });
124
- trace.log(res2);
125
- const jsonData = res2.contents ? JSON.parse(res2.contents) : {};
126
- trace.log(jsonData);
143
+ __privateSet(this, _routesPath, (res == null ? void 0 : res.userDir) + "/" + __privateGet(this, _packageName) + "/public/prompts/data/routes.json");
127
144
  __privateSet(this, _routes, await __privateGet(this, _service).fetchRoutes(this.getAttribute("route-url")));
128
145
  }
129
146
  }
130
147
  _service = new WeakMap();
131
148
  _routes = new WeakMap();
132
149
  _diffPopup = new WeakMap();
150
+ _packageName = new WeakMap();
151
+ _routesPath = new WeakMap();
133
152
  _NineChat_instances = new WeakSet();
134
153
  // --- [그룹 1: Interaction] 화면 토글 및 메뉴 클릭 ---
135
154
  initInteractions_fn = function() {
136
- var _a2;
155
+ var _a2, _b;
137
156
  const $settings = this.shadowRoot.querySelector("nine-ai-settings");
138
157
  const $menuIcons = this.shadowRoot.querySelectorAll("menu .menu-icon");
139
158
  const toggleUI = () => this.classList.toggle("collapse");
@@ -147,19 +166,8 @@ initInteractions_fn = function() {
147
166
  $settings.classList.toggle("expand", clicked.classList.contains("menu-setting"));
148
167
  });
149
168
  });
150
- (_a2 = this.shadowRoot.querySelector(".source-gen")) == null ? void 0 : _a2.addEventListener("click", async (e) => {
151
- const command2 = "";
152
- const targets = "";
153
- try {
154
- const result = await __privateGet(this, _service).generateAll(command2, targets, __privateGet(this, _routes));
155
- $status.textContent = "✅ 완료";
156
- nine.alert("소스 생성 성공").rgb();
157
- this.dispatchEvent(new CustomEvent("nine-mu-completed", { detail: result, bubbles: true }));
158
- } catch (err) {
159
- $status.textContent = "❌ 실패";
160
- nine.alert(err.message).rgb().shake();
161
- }
162
- });
169
+ (_a2 = this.shadowRoot.querySelector(".make-menu")) == null ? void 0 : _a2.addEventListener("click", __privateGet(this, _makeMenuHandler));
170
+ (_b = this.shadowRoot.querySelector(".source-gen")) == null ? void 0 : _b.addEventListener("click", __privateGet(this, _sourceGenHandler));
163
171
  };
164
172
  // --- [그룹 2: Action] 엔터키 입력 시 서비스 호출 ---
165
173
  initActions_fn = function() {
@@ -190,7 +198,7 @@ render_fn = function() {
190
198
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
191
199
  this.shadowRoot.innerHTML = `
192
200
  <style>
193
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.83"}/dist/css/nine-mu.css";
201
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.85"}/dist/css/nine-mu.css";
194
202
  ${customImport}
195
203
  </style>
196
204
  <div class="wrapper">
@@ -229,6 +237,8 @@ render_fn = function() {
229
237
  `;
230
238
  __privateSet(this, _diffPopup, this.shadowRoot.querySelector("nine-diff-popup"));
231
239
  };
240
+ _makeMenuHandler = new WeakMap();
241
+ _sourceGenHandler = new WeakMap();
232
242
  if (!customElements.get("nine-chat")) {
233
243
  customElements.define("nine-chat", NineChat);
234
244
  }
@@ -26406,7 +26416,7 @@ class NineDiff extends HTMLElement {
26406
26416
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
26407
26417
  this.shadowRoot.innerHTML = `
26408
26418
  <style>
26409
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.83"}/dist/css/nine-mu.css";
26419
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.85"}/dist/css/nine-mu.css";
26410
26420
  ${customImport}
26411
26421
  </style>
26412
26422
 
@@ -26516,7 +26526,7 @@ render_fn2 = function() {
26516
26526
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
26517
26527
  this.shadowRoot.innerHTML = `
26518
26528
  <style>
26519
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.83"}/dist/css/nine-mu.css";
26529
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.85"}/dist/css/nine-mu.css";
26520
26530
  ${customImport}
26521
26531
  </style>
26522
26532
 
@@ -26555,7 +26565,7 @@ handleCancel_fn = function() {
26555
26565
  };
26556
26566
  customElements.define("nine-diff-popup", NineDiffPopup);
26557
26567
  const NineMu = {
26558
- version: "0.1.83",
26568
+ version: "0.1.85",
26559
26569
  init: (config) => {
26560
26570
  trace.log("🛠️ Nine-Mu Engine initialized", config);
26561
26571
  }