@nine-lab/nine-mu 0.1.28 → 0.1.30
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/css/nine-mu.css +9 -3
- package/dist/nine-mu.js +24 -87
- 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/public/css/nine-mu.css +9 -3
- package/src/components/NineDiffPopup.js +21 -33
- package/src/index.js +1 -2
- package/src/components/NineDiffContainer.js +0 -58
package/dist/css/nine-mu.css
CHANGED
|
@@ -813,10 +813,16 @@
|
|
|
813
813
|
cursor: pointer;
|
|
814
814
|
outline: none;
|
|
815
815
|
}
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
:host(nine-diff-container) {
|
|
819
816
|
|
|
817
|
+
nx-dialog { --dialog-width: 90vw; --dialog-height: 85vh; }
|
|
818
|
+
.main-layout { width: 100%; height: 100%; display: flex; flex-direction: column; }
|
|
819
|
+
.diff-area { flex: 1; min-height: 0; border: 1px solid #ddd; }
|
|
820
|
+
.footer {
|
|
821
|
+
display: flex; justify-content: flex-end; gap: 10px;
|
|
822
|
+
padding: 12px; background: #f9f9f9; border-top: 1px solid #eee;
|
|
823
|
+
}
|
|
824
|
+
.btn { padding: 8px 20px; cursor: pointer; border-radius: 4px; border: 1px solid #ccc; font-weight: bold; }
|
|
825
|
+
.btn-confirm { background: #007bff; color: white; border: none; }
|
|
820
826
|
}
|
|
821
827
|
|
|
822
828
|
:host(nine-diff) {
|
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,
|
|
12
|
+
var _getSourcePath, _service, _routes, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _dialog, _diffView, _resolve, _asisBackup, _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.29"}/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.29"}/dist/css/nine-mu.css";
|
|
26382
26382
|
${customImport}
|
|
26383
26383
|
</style>
|
|
26384
26384
|
|
|
@@ -26419,64 +26419,15 @@ _applyDiffDecorations = new WeakMap();
|
|
|
26419
26419
|
if (!customElements.get("nine-diff")) {
|
|
26420
26420
|
customElements.define("nine-diff", NineDiff);
|
|
26421
26421
|
}
|
|
26422
|
-
class NineDiffContainer extends HTMLElement {
|
|
26423
|
-
constructor() {
|
|
26424
|
-
super();
|
|
26425
|
-
__privateAdd(this, _asis, "");
|
|
26426
|
-
__privateAdd(this, _tobe, "");
|
|
26427
|
-
__privateAdd(this, _lang, "javascript");
|
|
26428
|
-
__privateAdd(this, _diffView, null);
|
|
26429
|
-
/**
|
|
26430
|
-
* 단일 비교 데이터를 설정합니다.
|
|
26431
|
-
* @param {Object} data - { asis, tobe, lang }
|
|
26432
|
-
*/
|
|
26433
|
-
__publicField(this, "setData", (data) => {
|
|
26434
|
-
try {
|
|
26435
|
-
__privateSet(this, _asis, (data == null ? void 0 : data.asis) || "");
|
|
26436
|
-
__privateSet(this, _tobe, (data == null ? void 0 : data.tobe) || "");
|
|
26437
|
-
__privateSet(this, _lang, (data == null ? void 0 : data.lang) || "");
|
|
26438
|
-
} catch (e) {
|
|
26439
|
-
}
|
|
26440
|
-
this.render();
|
|
26441
|
-
});
|
|
26442
|
-
// 최종 결과물(사용자가 편집한 ASIS 내용)을 가져옵니다.
|
|
26443
|
-
__publicField(this, "getContents", () => {
|
|
26444
|
-
return __privateGet(this, _diffView) ? __privateGet(this, _diffView).getContents() : __privateGet(this, _asis);
|
|
26445
|
-
});
|
|
26446
|
-
this.attachShadow({ mode: "open" });
|
|
26447
|
-
}
|
|
26448
|
-
render() {
|
|
26449
|
-
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
26450
|
-
this.shadowRoot.innerHTML = `
|
|
26451
|
-
<style>
|
|
26452
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.27"}/dist/css/nine-mu.css";
|
|
26453
|
-
${customImport}
|
|
26454
|
-
</style>
|
|
26455
|
-
|
|
26456
|
-
<div class="diff-wrapper">
|
|
26457
|
-
<nine-diff id="single-diff"></nine-diff>
|
|
26458
|
-
</div>
|
|
26459
|
-
`;
|
|
26460
|
-
__privateSet(this, _diffView, this.shadowRoot.querySelector("#single-diff"));
|
|
26461
|
-
if (__privateGet(this, _diffView)) {
|
|
26462
|
-
__privateGet(this, _diffView).initialize(__privateGet(this, _asis), __privateGet(this, _tobe), __privateGet(this, _lang));
|
|
26463
|
-
}
|
|
26464
|
-
}
|
|
26465
|
-
}
|
|
26466
|
-
_asis = new WeakMap();
|
|
26467
|
-
_tobe = new WeakMap();
|
|
26468
|
-
_lang = new WeakMap();
|
|
26469
|
-
_diffView = new WeakMap();
|
|
26470
|
-
if (!customElements.get("nine-diff-container")) {
|
|
26471
|
-
customElements.define("nine-diff-container", NineDiffContainer);
|
|
26472
|
-
}
|
|
26473
26422
|
class NineDiffPopup extends HTMLElement {
|
|
26474
26423
|
constructor() {
|
|
26475
26424
|
super();
|
|
26476
26425
|
__privateAdd(this, _NineDiffPopup_instances);
|
|
26477
|
-
__privateAdd(this, _container, null);
|
|
26478
26426
|
__privateAdd(this, _dialog, null);
|
|
26427
|
+
__privateAdd(this, _diffView, null);
|
|
26428
|
+
// Container 대신 직접 에디터 뷰를 참조
|
|
26479
26429
|
__privateAdd(this, _resolve, null);
|
|
26430
|
+
__privateAdd(this, _asisBackup, "");
|
|
26480
26431
|
this.attachShadow({ mode: "open" });
|
|
26481
26432
|
}
|
|
26482
26433
|
connectedCallback() {
|
|
@@ -26485,57 +26436,46 @@ class NineDiffPopup extends HTMLElement {
|
|
|
26485
26436
|
render() {
|
|
26486
26437
|
this.shadowRoot.innerHTML = `
|
|
26487
26438
|
<style>
|
|
26488
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-
|
|
26489
|
-
/* nx-dialog 내부 스타일 조정 */
|
|
26490
|
-
nx-dialog { --dialog-width: 90vw; --dialog-height: 85vh; }
|
|
26491
|
-
.footer {
|
|
26492
|
-
display: flex;
|
|
26493
|
-
justify-content: flex-end;
|
|
26494
|
-
gap: 10px;
|
|
26495
|
-
padding: 15px;
|
|
26496
|
-
background: #f9f9f9;
|
|
26497
|
-
border-top: 1px solid #ddd;
|
|
26498
|
-
}
|
|
26499
|
-
.btn { padding: 8px 20px; cursor: pointer; border-radius: 4px; border: 1px solid #ccc; }
|
|
26500
|
-
.btn.primary { background: #007bff; color: white; border: none; }
|
|
26439
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.29"}/dist/css/nine-mu.css";
|
|
26501
26440
|
</style>
|
|
26502
26441
|
|
|
26503
26442
|
<nx-dialog>
|
|
26504
|
-
<div
|
|
26505
|
-
<div
|
|
26506
|
-
<nine-diff
|
|
26443
|
+
<div class="main-layout">
|
|
26444
|
+
<div class="diff-area">
|
|
26445
|
+
<nine-diff id="editor"></nine-diff>
|
|
26507
26446
|
</div>
|
|
26508
26447
|
<div class="footer">
|
|
26509
26448
|
<button class="btn btn-cancel">취소</button>
|
|
26510
|
-
<button class="btn btn-confirm
|
|
26449
|
+
<button class="btn btn-confirm">최종 확정 및 저장</button>
|
|
26511
26450
|
</div>
|
|
26512
26451
|
</div>
|
|
26513
26452
|
</nx-dialog>
|
|
26514
26453
|
`;
|
|
26515
26454
|
__privateSet(this, _dialog, this.shadowRoot.querySelector("nx-dialog"));
|
|
26516
|
-
__privateSet(this,
|
|
26455
|
+
__privateSet(this, _diffView, this.shadowRoot.querySelector("#editor"));
|
|
26517
26456
|
this.shadowRoot.querySelector(".btn-confirm").onclick = () => __privateMethod(this, _NineDiffPopup_instances, handleConfirm_fn).call(this);
|
|
26518
26457
|
this.shadowRoot.querySelector(".btn-cancel").onclick = () => __privateMethod(this, _NineDiffPopup_instances, handleCancel_fn).call(this);
|
|
26519
26458
|
}
|
|
26520
|
-
|
|
26521
|
-
* 외부 호출용 팝업 실행 메서드
|
|
26522
|
-
* @param {Object} diffData - { asis, tobe, lang }
|
|
26523
|
-
* @returns {Promise<string|null>} - 확정 시 수정된 텍스트, 취소 시 null
|
|
26524
|
-
*/
|
|
26525
|
-
async popup(diffData) {
|
|
26459
|
+
async popup(data) {
|
|
26526
26460
|
return new Promise((resolve) => {
|
|
26527
26461
|
__privateSet(this, _resolve, resolve);
|
|
26528
|
-
|
|
26462
|
+
__privateSet(this, _asisBackup, (data == null ? void 0 : data.asis) || "");
|
|
26463
|
+
if (__privateGet(this, _diffView)) {
|
|
26464
|
+
const asisStr = typeof data.asis === "object" ? JSON.stringify(data.asis, null, 2) : data.asis;
|
|
26465
|
+
const tobeStr = typeof data.tobe === "object" ? JSON.stringify(data.tobe, null, 2) : data.tobe;
|
|
26466
|
+
__privateGet(this, _diffView).initialize(asisStr, tobeStr, data.lang || "javascript");
|
|
26467
|
+
}
|
|
26529
26468
|
__privateGet(this, _dialog).showModal();
|
|
26530
26469
|
});
|
|
26531
26470
|
}
|
|
26532
26471
|
}
|
|
26533
|
-
_container = new WeakMap();
|
|
26534
26472
|
_dialog = new WeakMap();
|
|
26473
|
+
_diffView = new WeakMap();
|
|
26535
26474
|
_resolve = new WeakMap();
|
|
26475
|
+
_asisBackup = new WeakMap();
|
|
26536
26476
|
_NineDiffPopup_instances = new WeakSet();
|
|
26537
26477
|
handleConfirm_fn = function() {
|
|
26538
|
-
const finalContent = __privateGet(this,
|
|
26478
|
+
const finalContent = __privateGet(this, _diffView) ? __privateGet(this, _diffView).getContents() : __privateGet(this, _asisBackup);
|
|
26539
26479
|
__privateGet(this, _dialog).close();
|
|
26540
26480
|
if (__privateGet(this, _resolve)) __privateGet(this, _resolve).call(this, finalContent);
|
|
26541
26481
|
this.remove();
|
|
@@ -26545,9 +26485,7 @@ handleCancel_fn = function() {
|
|
|
26545
26485
|
if (__privateGet(this, _resolve)) __privateGet(this, _resolve).call(this, null);
|
|
26546
26486
|
this.remove();
|
|
26547
26487
|
};
|
|
26548
|
-
|
|
26549
|
-
customElements.define("nine-diff-popup", NineDiffPopup);
|
|
26550
|
-
}
|
|
26488
|
+
customElements.define("nine-diff-popup", NineDiffPopup);
|
|
26551
26489
|
class NineDialog extends HTMLElement {
|
|
26552
26490
|
constructor() {
|
|
26553
26491
|
super();
|
|
@@ -26640,7 +26578,7 @@ if (!customElements.get("nine-dialog")) {
|
|
|
26640
26578
|
customElements.define("nine-dialog", NineDialog);
|
|
26641
26579
|
}
|
|
26642
26580
|
const NineMu = {
|
|
26643
|
-
version: "0.1.
|
|
26581
|
+
version: "0.1.29",
|
|
26644
26582
|
init: (config) => {
|
|
26645
26583
|
trace.log("🛠️ Nine-Mu Engine initialized", config);
|
|
26646
26584
|
}
|
|
@@ -26649,7 +26587,6 @@ export {
|
|
|
26649
26587
|
NineChat,
|
|
26650
26588
|
NineDialog,
|
|
26651
26589
|
NineDiff,
|
|
26652
|
-
NineDiffContainer,
|
|
26653
26590
|
NineDiffPopup,
|
|
26654
26591
|
NineMu,
|
|
26655
26592
|
NineMu as default
|