@nine-lab/nine-mu 0.1.22 → 0.1.23

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, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _asis, _tobe, _lang, _diffView, _dialog, _shift, _init, _onMouseDown, _onMouseMove, _onMouseUp;
12
+ var _getSourcePath, _service, _routes, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _asis, _tobe, _lang, _diffView, _container, _dialog, _resolve, _NineDiffPopup_instances, handleConfirm_fn, handleCancel_fn, _dialog2, _shift, _init, _onMouseDown, _onMouseMove, _onMouseUp;
13
13
  import { trace, api, nine } from "@nine-lab/nine-util";
14
14
  class NineMuService {
15
15
  constructor(connectorUrl) {
@@ -178,7 +178,7 @@ render_fn = function() {
178
178
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
179
179
  this.shadowRoot.innerHTML = `
180
180
  <style>
181
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.21"}/dist/css/nine-mu.css";
181
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.22"}/dist/css/nine-mu.css";
182
182
  ${customImport}
183
183
  </style>
184
184
  <div class="wrapper">
@@ -26378,7 +26378,7 @@ class NineDiff extends HTMLElement {
26378
26378
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
26379
26379
  this.shadowRoot.innerHTML = `
26380
26380
  <style>
26381
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.21"}/dist/css/nine-mu.css";
26381
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.22"}/dist/css/nine-mu.css";
26382
26382
  ${customImport}
26383
26383
  </style>
26384
26384
 
@@ -26479,22 +26479,100 @@ _diffView = new WeakMap();
26479
26479
  if (!customElements.get("nine-diff-container")) {
26480
26480
  customElements.define("nine-diff-container", NineDiffContainer);
26481
26481
  }
26482
+ class NineDiffPopup extends HTMLElement {
26483
+ constructor() {
26484
+ super();
26485
+ __privateAdd(this, _NineDiffPopup_instances);
26486
+ __privateAdd(this, _container, null);
26487
+ __privateAdd(this, _dialog, null);
26488
+ __privateAdd(this, _resolve, null);
26489
+ this.attachShadow({ mode: "open" });
26490
+ }
26491
+ connectedCallback() {
26492
+ this.render();
26493
+ }
26494
+ render() {
26495
+ this.shadowRoot.innerHTML = `
26496
+ <style>
26497
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ai@${"0.1.22"}/dist/css/nine-ai.css";
26498
+ /* nx-dialog 내부 스타일 조정 */
26499
+ nx-dialog { --dialog-width: 90vw; --dialog-height: 85vh; }
26500
+ .footer {
26501
+ display: flex;
26502
+ justify-content: flex-end;
26503
+ gap: 10px;
26504
+ padding: 15px;
26505
+ background: #f9f9f9;
26506
+ border-top: 1px solid #ddd;
26507
+ }
26508
+ .btn { padding: 8px 20px; cursor: pointer; border-radius: 4px; border: 1px solid #ccc; }
26509
+ .btn.primary { background: #007bff; color: white; border: none; }
26510
+ </style>
26511
+
26512
+ <nx-dialog>
26513
+ <div style="width: 100%; height: 100%; display: flex; flex-direction: column;">
26514
+ <div style="flex: 1; min-height: 0;">
26515
+ <nine-diff-container id="diff-container"></nine-diff-container>
26516
+ </div>
26517
+ <div class="footer">
26518
+ <button class="btn btn-cancel">취소</button>
26519
+ <button class="btn btn-confirm primary">최종 확정 및 저장</button>
26520
+ </div>
26521
+ </div>
26522
+ </nx-dialog>
26523
+ `;
26524
+ __privateSet(this, _dialog, this.shadowRoot.querySelector("nx-dialog"));
26525
+ __privateSet(this, _container, this.shadowRoot.querySelector("#diff-container"));
26526
+ this.shadowRoot.querySelector(".btn-confirm").onclick = () => __privateMethod(this, _NineDiffPopup_instances, handleConfirm_fn).call(this);
26527
+ this.shadowRoot.querySelector(".btn-cancel").onclick = () => __privateMethod(this, _NineDiffPopup_instances, handleCancel_fn).call(this);
26528
+ }
26529
+ /**
26530
+ * 외부 호출용 팝업 실행 메서드
26531
+ * @param {Object} diffData - { asis, tobe, lang }
26532
+ * @returns {Promise<string|null>} - 확정 시 수정된 텍스트, 취소 시 null
26533
+ */
26534
+ async popup(diffData) {
26535
+ return new Promise((resolve) => {
26536
+ __privateSet(this, _resolve, resolve);
26537
+ __privateGet(this, _container).setData(diffData);
26538
+ __privateGet(this, _dialog).showModal();
26539
+ });
26540
+ }
26541
+ }
26542
+ _container = new WeakMap();
26543
+ _dialog = new WeakMap();
26544
+ _resolve = new WeakMap();
26545
+ _NineDiffPopup_instances = new WeakSet();
26546
+ handleConfirm_fn = function() {
26547
+ const finalContent = __privateGet(this, _container).getContents();
26548
+ __privateGet(this, _dialog).close();
26549
+ if (__privateGet(this, _resolve)) __privateGet(this, _resolve).call(this, finalContent);
26550
+ this.remove();
26551
+ };
26552
+ handleCancel_fn = function() {
26553
+ __privateGet(this, _dialog).close();
26554
+ if (__privateGet(this, _resolve)) __privateGet(this, _resolve).call(this, null);
26555
+ this.remove();
26556
+ };
26557
+ if (!customElements.get("nine-diff-popup")) {
26558
+ customElements.define("nine-diff-popup", NineDiffPopup);
26559
+ }
26482
26560
  class NineDialog extends HTMLElement {
26483
26561
  constructor() {
26484
26562
  super();
26485
- __privateAdd(this, _dialog);
26563
+ __privateAdd(this, _dialog2);
26486
26564
  __privateAdd(this, _shift);
26487
26565
  __publicField(this, "showModal", () => {
26488
- __privateGet(this, _dialog).showModal();
26566
+ __privateGet(this, _dialog2).showModal();
26489
26567
  });
26490
26568
  __publicField(this, "close", () => {
26491
- __privateGet(this, _dialog).close();
26569
+ __privateGet(this, _dialog2).close();
26492
26570
  this.remove();
26493
26571
  });
26494
26572
  __privateAdd(this, _init, () => {
26495
26573
  const closeBtn = this.shadowRoot.querySelector(".close");
26496
26574
  closeBtn.addEventListener("click", () => {
26497
- __privateGet(this, _dialog).classList.add("out");
26575
+ __privateGet(this, _dialog2).classList.add("out");
26498
26576
  setTimeout(() => this.close(), 200);
26499
26577
  });
26500
26578
  const head = this.shadowRoot.querySelector(".head");
@@ -26502,16 +26580,16 @@ class NineDialog extends HTMLElement {
26502
26580
  });
26503
26581
  // 드래그 로직 이식 시 querySelector 대신 this.#dialog 사용
26504
26582
  __privateAdd(this, _onMouseDown, (e) => {
26505
- var rect = __privateGet(this, _dialog).getBoundingClientRect();
26583
+ var rect = __privateGet(this, _dialog2).getBoundingClientRect();
26506
26584
  __privateSet(this, _shift, { x: e.clientX - rect.x, y: e.clientY - rect.y });
26507
26585
  document.addEventListener("mousemove", __privateGet(this, _onMouseMove));
26508
26586
  document.addEventListener("mouseup", __privateGet(this, _onMouseUp));
26509
26587
  });
26510
26588
  __privateAdd(this, _onMouseMove, (e) => {
26511
- __privateGet(this, _dialog).style.position = "fixed";
26512
- __privateGet(this, _dialog).style.left = `${e.pageX - __privateGet(this, _shift).x}px`;
26513
- __privateGet(this, _dialog).style.top = `${e.pageY - __privateGet(this, _shift).y}px`;
26514
- __privateGet(this, _dialog).style.margin = "0";
26589
+ __privateGet(this, _dialog2).style.position = "fixed";
26590
+ __privateGet(this, _dialog2).style.left = `${e.pageX - __privateGet(this, _shift).x}px`;
26591
+ __privateGet(this, _dialog2).style.top = `${e.pageY - __privateGet(this, _shift).y}px`;
26592
+ __privateGet(this, _dialog2).style.margin = "0";
26515
26593
  });
26516
26594
  __privateAdd(this, _onMouseUp, () => {
26517
26595
  document.removeEventListener("mousemove", __privateGet(this, _onMouseMove));
@@ -26553,7 +26631,7 @@ class NineDialog extends HTMLElement {
26553
26631
  </div>
26554
26632
  </dialog>
26555
26633
  `;
26556
- __privateSet(this, _dialog, this.shadowRoot.querySelector("dialog"));
26634
+ __privateSet(this, _dialog2, this.shadowRoot.querySelector("dialog"));
26557
26635
  }
26558
26636
  // 외부에서 타이틀을 바꿀 수 있게 제공
26559
26637
  setTitle(text) {
@@ -26561,7 +26639,7 @@ class NineDialog extends HTMLElement {
26561
26639
  if (titleEl) titleEl.textContent = text;
26562
26640
  }
26563
26641
  }
26564
- _dialog = new WeakMap();
26642
+ _dialog2 = new WeakMap();
26565
26643
  _shift = new WeakMap();
26566
26644
  _init = new WeakMap();
26567
26645
  _onMouseDown = new WeakMap();
@@ -26571,7 +26649,7 @@ if (!customElements.get("nine-dialog")) {
26571
26649
  customElements.define("nine-dialog", NineDialog);
26572
26650
  }
26573
26651
  const NineMu = {
26574
- version: "0.1.21",
26652
+ version: "0.1.22",
26575
26653
  init: (config) => {
26576
26654
  trace.log("🛠️ Nine-Mu Engine initialized", config);
26577
26655
  }
@@ -26581,6 +26659,7 @@ export {
26581
26659
  NineDialog,
26582
26660
  NineDiff,
26583
26661
  NineDiffContainer,
26662
+ NineDiffPopup,
26584
26663
  NineMu,
26585
26664
  NineMu as default
26586
26665
  };