@nine-lab/nine-mu 0.1.50 → 0.1.52
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 +5 -97
- 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/index.js +1 -2
- package/src/components/NineDialog.js +0 -100
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import { trace } from '@nine-lab/nine-util';
|
|
|
2
2
|
import { NineChat } from './components/NineChat.js';
|
|
3
3
|
import { NineDiff } from './components/NineDiff.js';
|
|
4
4
|
import { NineDiffPopup } from './components/NineDiffPopup.js';
|
|
5
|
-
import { NineDialog } from './components/NineDialog.js';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Nine-Mu 엔진 메인 클래스
|
|
@@ -17,4 +16,4 @@ export const NineMu = {
|
|
|
17
16
|
|
|
18
17
|
// 기본 export 및 컴포넌트 export
|
|
19
18
|
export default NineMu;
|
|
20
|
-
export { NineChat, NineDiff,
|
|
19
|
+
export { NineChat, NineDiff, NineDiffPopup };
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
export class NineDialog extends HTMLElement {
|
|
2
|
-
#dialog;
|
|
3
|
-
#shift;
|
|
4
|
-
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
|
-
// Shadow DOM을 사용하여 내부 스타일을 보호합니다.
|
|
8
|
-
this.attachShadow({ mode: 'open' });
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
connectedCallback() {
|
|
12
|
-
this.render();
|
|
13
|
-
this.#init();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
render() {
|
|
17
|
-
this.shadowRoot.innerHTML = `
|
|
18
|
-
<style>
|
|
19
|
-
@import "https://cdn.jsdelivr.net/npm/ninegrid2@${ninegrid.version}/dist/css/nxDialog.css";
|
|
20
|
-
/* 커스텀 스타일 경로 로직 유지 */
|
|
21
|
-
${ninegrid.getCustomPath(this, "nxDialog.css") || ""}
|
|
22
|
-
|
|
23
|
-
:host { display: contents; }
|
|
24
|
-
dialog { padding: 0; border: none; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
|
|
25
|
-
.contents { display: flex; flex-direction: column; min-width: 600px; min-height: 400px; }
|
|
26
|
-
.body { flex: 1; overflow: auto; padding: 10px; }
|
|
27
|
-
.head { cursor: move; user-select: none; }
|
|
28
|
-
/* 애니메이션 처리용 */
|
|
29
|
-
dialog.out { opacity: 0; transform: scale(0.9); transition: 0.3s; }
|
|
30
|
-
</style>
|
|
31
|
-
|
|
32
|
-
<dialog>
|
|
33
|
-
<div class="head">
|
|
34
|
-
<span class="title">Details</span>
|
|
35
|
-
<buttons>
|
|
36
|
-
<button class="close">×</button>
|
|
37
|
-
</buttons>
|
|
38
|
-
</div>
|
|
39
|
-
<div class="contents">
|
|
40
|
-
<div class="body">
|
|
41
|
-
<slot></slot>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</dialog>
|
|
45
|
-
`;
|
|
46
|
-
this.#dialog = this.shadowRoot.querySelector('dialog');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// 외부에서 타이틀을 바꿀 수 있게 제공
|
|
50
|
-
setTitle(text) {
|
|
51
|
-
const titleEl = this.shadowRoot.querySelector('.title');
|
|
52
|
-
if (titleEl) titleEl.textContent = text;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
showModal = () => {
|
|
56
|
-
this.#dialog.showModal();
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
close = () => {
|
|
60
|
-
this.#dialog.close();
|
|
61
|
-
// 팝업이 닫히면 DOM에서 아예 제거할지 선택 (일반적으로 제거함)
|
|
62
|
-
this.remove();
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
#init = () => {
|
|
66
|
-
const closeBtn = this.shadowRoot.querySelector('.close');
|
|
67
|
-
closeBtn.addEventListener('click', () => {
|
|
68
|
-
this.#dialog.classList.add('out');
|
|
69
|
-
setTimeout(() => this.close(), 200);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// 드래그 로직 (생략 - 기존 로직을 shadowRoot 기반으로 이식)
|
|
73
|
-
const head = this.shadowRoot.querySelector('.head');
|
|
74
|
-
head.addEventListener('mousedown', this.#onMouseDown);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// 드래그 로직 이식 시 querySelector 대신 this.#dialog 사용
|
|
78
|
-
#onMouseDown = e => {
|
|
79
|
-
var rect = this.#dialog.getBoundingClientRect();
|
|
80
|
-
this.#shift = { x: e.clientX - rect.x, y: e.clientY - rect.y };
|
|
81
|
-
document.addEventListener('mousemove', this.#onMouseMove);
|
|
82
|
-
document.addEventListener('mouseup', this.#onMouseUp);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
#onMouseMove = e => {
|
|
86
|
-
this.#dialog.style.position = 'fixed';
|
|
87
|
-
this.#dialog.style.left = `${e.pageX - this.#shift.x}px`;
|
|
88
|
-
this.#dialog.style.top = `${e.pageY - this.#shift.y}px`;
|
|
89
|
-
this.#dialog.style.margin = '0';
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
#onMouseUp = () => {
|
|
93
|
-
document.removeEventListener('mousemove', this.#onMouseMove);
|
|
94
|
-
document.removeEventListener('mouseup', this.#onMouseUp);
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (!customElements.get('nine-dialog')) {
|
|
99
|
-
customElements.define("nine-dialog", NineDialog);
|
|
100
|
-
}
|