@nine-lab/nine-mu 0.1.22 → 0.1.24
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 +100 -18
- package/dist/nine-mu.js.map +1 -1
- package/dist/nine-mu.umd.js +1 -1
- package/dist/nine-mu.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/NineDiffContainer.js +7 -3
- package/src/components/NineDiffPopup.js +1 -1
- package/src/index.js +2 -1
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.
|
|
181
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.23"}/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.
|
|
26381
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.23"}/dist/css/nine-mu.css";
|
|
26382
26382
|
${customImport}
|
|
26383
26383
|
</style>
|
|
26384
26384
|
|
|
@@ -26431,9 +26431,12 @@ class NineDiffContainer extends HTMLElement {
|
|
|
26431
26431
|
* @param {Object} data - { asis, tobe, lang }
|
|
26432
26432
|
*/
|
|
26433
26433
|
__publicField(this, "setData", ({ asis, tobe, lang }) => {
|
|
26434
|
-
|
|
26435
|
-
|
|
26436
|
-
|
|
26434
|
+
try {
|
|
26435
|
+
__privateSet(this, _asis, asis || "");
|
|
26436
|
+
__privateSet(this, _tobe, tobe || "");
|
|
26437
|
+
__privateSet(this, _lang, lang || "javascript");
|
|
26438
|
+
} catch (e) {
|
|
26439
|
+
}
|
|
26437
26440
|
this.render();
|
|
26438
26441
|
});
|
|
26439
26442
|
// 최종 결과물(사용자가 편집한 ASIS 내용)을 가져옵니다.
|
|
@@ -26479,22 +26482,100 @@ _diffView = new WeakMap();
|
|
|
26479
26482
|
if (!customElements.get("nine-diff-container")) {
|
|
26480
26483
|
customElements.define("nine-diff-container", NineDiffContainer);
|
|
26481
26484
|
}
|
|
26485
|
+
class NineDiffPopup extends HTMLElement {
|
|
26486
|
+
constructor() {
|
|
26487
|
+
super();
|
|
26488
|
+
__privateAdd(this, _NineDiffPopup_instances);
|
|
26489
|
+
__privateAdd(this, _container, null);
|
|
26490
|
+
__privateAdd(this, _dialog, null);
|
|
26491
|
+
__privateAdd(this, _resolve, null);
|
|
26492
|
+
this.attachShadow({ mode: "open" });
|
|
26493
|
+
}
|
|
26494
|
+
connectedCallback() {
|
|
26495
|
+
this.render();
|
|
26496
|
+
}
|
|
26497
|
+
render() {
|
|
26498
|
+
this.shadowRoot.innerHTML = `
|
|
26499
|
+
<style>
|
|
26500
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ai@${"0.1.23"}/dist/css/nine-ai.css";
|
|
26501
|
+
/* nx-dialog 내부 스타일 조정 */
|
|
26502
|
+
nx-dialog { --dialog-width: 90vw; --dialog-height: 85vh; }
|
|
26503
|
+
.footer {
|
|
26504
|
+
display: flex;
|
|
26505
|
+
justify-content: flex-end;
|
|
26506
|
+
gap: 10px;
|
|
26507
|
+
padding: 15px;
|
|
26508
|
+
background: #f9f9f9;
|
|
26509
|
+
border-top: 1px solid #ddd;
|
|
26510
|
+
}
|
|
26511
|
+
.btn { padding: 8px 20px; cursor: pointer; border-radius: 4px; border: 1px solid #ccc; }
|
|
26512
|
+
.btn.primary { background: #007bff; color: white; border: none; }
|
|
26513
|
+
</style>
|
|
26514
|
+
|
|
26515
|
+
<nx-dialog>
|
|
26516
|
+
<div style="width: 100%; height: 100%; display: flex; flex-direction: column;">
|
|
26517
|
+
<div style="flex: 1; min-height: 0;">
|
|
26518
|
+
<nine-diff-container id="diff-container"></nine-diff-container>
|
|
26519
|
+
</div>
|
|
26520
|
+
<div class="footer">
|
|
26521
|
+
<button class="btn btn-cancel">취소</button>
|
|
26522
|
+
<button class="btn btn-confirm primary">최종 확정 및 저장</button>
|
|
26523
|
+
</div>
|
|
26524
|
+
</div>
|
|
26525
|
+
</nx-dialog>
|
|
26526
|
+
`;
|
|
26527
|
+
__privateSet(this, _dialog, this.shadowRoot.querySelector("nx-dialog"));
|
|
26528
|
+
__privateSet(this, _container, this.shadowRoot.querySelector("#diff-container"));
|
|
26529
|
+
this.shadowRoot.querySelector(".btn-confirm").onclick = () => __privateMethod(this, _NineDiffPopup_instances, handleConfirm_fn).call(this);
|
|
26530
|
+
this.shadowRoot.querySelector(".btn-cancel").onclick = () => __privateMethod(this, _NineDiffPopup_instances, handleCancel_fn).call(this);
|
|
26531
|
+
}
|
|
26532
|
+
/**
|
|
26533
|
+
* 외부 호출용 팝업 실행 메서드
|
|
26534
|
+
* @param {Object} diffData - { asis, tobe, lang }
|
|
26535
|
+
* @returns {Promise<string|null>} - 확정 시 수정된 텍스트, 취소 시 null
|
|
26536
|
+
*/
|
|
26537
|
+
async popup(diffData) {
|
|
26538
|
+
return new Promise((resolve) => {
|
|
26539
|
+
__privateSet(this, _resolve, resolve);
|
|
26540
|
+
__privateGet(this, _container).setData(diffData);
|
|
26541
|
+
__privateGet(this, _dialog).showModal();
|
|
26542
|
+
});
|
|
26543
|
+
}
|
|
26544
|
+
}
|
|
26545
|
+
_container = new WeakMap();
|
|
26546
|
+
_dialog = new WeakMap();
|
|
26547
|
+
_resolve = new WeakMap();
|
|
26548
|
+
_NineDiffPopup_instances = new WeakSet();
|
|
26549
|
+
handleConfirm_fn = function() {
|
|
26550
|
+
const finalContent = __privateGet(this, _container).getContents();
|
|
26551
|
+
__privateGet(this, _dialog).close();
|
|
26552
|
+
if (__privateGet(this, _resolve)) __privateGet(this, _resolve).call(this, finalContent);
|
|
26553
|
+
this.remove();
|
|
26554
|
+
};
|
|
26555
|
+
handleCancel_fn = function() {
|
|
26556
|
+
__privateGet(this, _dialog).close();
|
|
26557
|
+
if (__privateGet(this, _resolve)) __privateGet(this, _resolve).call(this, null);
|
|
26558
|
+
this.remove();
|
|
26559
|
+
};
|
|
26560
|
+
if (!customElements.get("nine-diff-popup")) {
|
|
26561
|
+
customElements.define("nine-diff-popup", NineDiffPopup);
|
|
26562
|
+
}
|
|
26482
26563
|
class NineDialog extends HTMLElement {
|
|
26483
26564
|
constructor() {
|
|
26484
26565
|
super();
|
|
26485
|
-
__privateAdd(this,
|
|
26566
|
+
__privateAdd(this, _dialog2);
|
|
26486
26567
|
__privateAdd(this, _shift);
|
|
26487
26568
|
__publicField(this, "showModal", () => {
|
|
26488
|
-
__privateGet(this,
|
|
26569
|
+
__privateGet(this, _dialog2).showModal();
|
|
26489
26570
|
});
|
|
26490
26571
|
__publicField(this, "close", () => {
|
|
26491
|
-
__privateGet(this,
|
|
26572
|
+
__privateGet(this, _dialog2).close();
|
|
26492
26573
|
this.remove();
|
|
26493
26574
|
});
|
|
26494
26575
|
__privateAdd(this, _init, () => {
|
|
26495
26576
|
const closeBtn = this.shadowRoot.querySelector(".close");
|
|
26496
26577
|
closeBtn.addEventListener("click", () => {
|
|
26497
|
-
__privateGet(this,
|
|
26578
|
+
__privateGet(this, _dialog2).classList.add("out");
|
|
26498
26579
|
setTimeout(() => this.close(), 200);
|
|
26499
26580
|
});
|
|
26500
26581
|
const head = this.shadowRoot.querySelector(".head");
|
|
@@ -26502,16 +26583,16 @@ class NineDialog extends HTMLElement {
|
|
|
26502
26583
|
});
|
|
26503
26584
|
// 드래그 로직 이식 시 querySelector 대신 this.#dialog 사용
|
|
26504
26585
|
__privateAdd(this, _onMouseDown, (e) => {
|
|
26505
|
-
var rect = __privateGet(this,
|
|
26586
|
+
var rect = __privateGet(this, _dialog2).getBoundingClientRect();
|
|
26506
26587
|
__privateSet(this, _shift, { x: e.clientX - rect.x, y: e.clientY - rect.y });
|
|
26507
26588
|
document.addEventListener("mousemove", __privateGet(this, _onMouseMove));
|
|
26508
26589
|
document.addEventListener("mouseup", __privateGet(this, _onMouseUp));
|
|
26509
26590
|
});
|
|
26510
26591
|
__privateAdd(this, _onMouseMove, (e) => {
|
|
26511
|
-
__privateGet(this,
|
|
26512
|
-
__privateGet(this,
|
|
26513
|
-
__privateGet(this,
|
|
26514
|
-
__privateGet(this,
|
|
26592
|
+
__privateGet(this, _dialog2).style.position = "fixed";
|
|
26593
|
+
__privateGet(this, _dialog2).style.left = `${e.pageX - __privateGet(this, _shift).x}px`;
|
|
26594
|
+
__privateGet(this, _dialog2).style.top = `${e.pageY - __privateGet(this, _shift).y}px`;
|
|
26595
|
+
__privateGet(this, _dialog2).style.margin = "0";
|
|
26515
26596
|
});
|
|
26516
26597
|
__privateAdd(this, _onMouseUp, () => {
|
|
26517
26598
|
document.removeEventListener("mousemove", __privateGet(this, _onMouseMove));
|
|
@@ -26553,7 +26634,7 @@ class NineDialog extends HTMLElement {
|
|
|
26553
26634
|
</div>
|
|
26554
26635
|
</dialog>
|
|
26555
26636
|
`;
|
|
26556
|
-
__privateSet(this,
|
|
26637
|
+
__privateSet(this, _dialog2, this.shadowRoot.querySelector("dialog"));
|
|
26557
26638
|
}
|
|
26558
26639
|
// 외부에서 타이틀을 바꿀 수 있게 제공
|
|
26559
26640
|
setTitle(text) {
|
|
@@ -26561,7 +26642,7 @@ class NineDialog extends HTMLElement {
|
|
|
26561
26642
|
if (titleEl) titleEl.textContent = text;
|
|
26562
26643
|
}
|
|
26563
26644
|
}
|
|
26564
|
-
|
|
26645
|
+
_dialog2 = new WeakMap();
|
|
26565
26646
|
_shift = new WeakMap();
|
|
26566
26647
|
_init = new WeakMap();
|
|
26567
26648
|
_onMouseDown = new WeakMap();
|
|
@@ -26571,7 +26652,7 @@ if (!customElements.get("nine-dialog")) {
|
|
|
26571
26652
|
customElements.define("nine-dialog", NineDialog);
|
|
26572
26653
|
}
|
|
26573
26654
|
const NineMu = {
|
|
26574
|
-
version: "0.1.
|
|
26655
|
+
version: "0.1.23",
|
|
26575
26656
|
init: (config) => {
|
|
26576
26657
|
trace.log("🛠️ Nine-Mu Engine initialized", config);
|
|
26577
26658
|
}
|
|
@@ -26581,6 +26662,7 @@ export {
|
|
|
26581
26662
|
NineDialog,
|
|
26582
26663
|
NineDiff,
|
|
26583
26664
|
NineDiffContainer,
|
|
26665
|
+
NineDiffPopup,
|
|
26584
26666
|
NineMu,
|
|
26585
26667
|
NineMu as default
|
|
26586
26668
|
};
|