ide-assi 0.444.0 → 0.446.0
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/bundle.cjs.js +912 -614
- package/dist/bundle.esm.js +912 -614
- package/dist/components/ideAssi.js +46 -3
- package/package.json +1 -1
- package/src/components/ideAssi.js +46 -3
- package/src/components/ideDiff.js.bak +0 -141
- package/src/components/ideDiff.js.bak2 +0 -725
|
@@ -464,7 +464,7 @@ const DocManager = () => {
|
|
|
464
464
|
);
|
|
465
465
|
};
|
|
466
466
|
|
|
467
|
-
export default
|
|
467
|
+
export default DocManager;
|
|
468
468
|
`;
|
|
469
469
|
/**
|
|
470
470
|
src1 = `
|
|
@@ -492,9 +492,13 @@ export default DocManager1;
|
|
|
492
492
|
</tr>
|
|
493
493
|
`; */
|
|
494
494
|
|
|
495
|
-
this.shadowRoot.querySelector("ide-diff-popup").popup(src1, src2);
|
|
495
|
+
//this.shadowRoot.querySelector("ide-diff-popup").popup(src1, src2);
|
|
496
|
+
|
|
497
|
+
//return;
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
496
501
|
|
|
497
|
-
return;
|
|
498
502
|
|
|
499
503
|
const apply = {
|
|
500
504
|
mybatis: this.shadowRoot.querySelector("#mybatis").checked,
|
|
@@ -528,9 +532,48 @@ export default DocManager1;
|
|
|
528
532
|
|
|
529
533
|
const elAiChat = this.shadowRoot.querySelector("nx-ai-chat");
|
|
530
534
|
|
|
535
|
+
|
|
536
|
+
// 1. 초기 진행 상태 메시지 추가
|
|
537
|
+
const initialProgressData = [
|
|
538
|
+
{ id: 'analysis', message: '1. 분석중입니다...', completedMessage: '1-1. 분석이 완료되었습니다.' },
|
|
539
|
+
{ id: 'design', message: '2. 설계중...', completedMessage: '2-1. 설계가 완료되었습니다.' },
|
|
540
|
+
{ id: 'development', message: '3. 개발중...', completedMessage: '3-1. 개발이 완료되었습니다.' }
|
|
541
|
+
];
|
|
542
|
+
|
|
543
|
+
// aiChat.add 호출 시, progressData를 마지막 인자로 전달하고 생성된 엘리먼트를 받습니다.
|
|
544
|
+
const progressMessageInstance = elAiChat.addProgress(initialProgressData);
|
|
545
|
+
|
|
546
|
+
// 2. 시간이 지난 후, 특정 단계의 완료를 알림
|
|
547
|
+
// 예를 들어, 3초 후에 분석 완료
|
|
548
|
+
setTimeout(() => {
|
|
549
|
+
if (progressMessageInstance) {
|
|
550
|
+
progressMessageInstance.updateProgress('analysis', 'completed');
|
|
551
|
+
console.log("분석 완료 메시지 업데이트");
|
|
552
|
+
}
|
|
553
|
+
}, 3000);
|
|
554
|
+
|
|
555
|
+
// 예를 들어, 6초 후에 설계 완료
|
|
556
|
+
setTimeout(() => {
|
|
557
|
+
if (progressMessageInstance) {
|
|
558
|
+
progressMessageInstance.updateProgress('design', 'completed');
|
|
559
|
+
console.log("설계 완료 메시지 업데이트");
|
|
560
|
+
}
|
|
561
|
+
}, 6000);
|
|
562
|
+
|
|
563
|
+
// 모든 단계가 완료된 후, 일반 AI 메시지 추가 (선택 사항)
|
|
564
|
+
setTimeout(() => {
|
|
565
|
+
elAiChat.add("ai", "모든 작업이 성공적으로 완료되었습니다!", [], []);
|
|
566
|
+
}, 9000);
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
return;
|
|
571
|
+
|
|
572
|
+
|
|
531
573
|
elAiChat.add("me", userPrompt);
|
|
532
574
|
elAiChat.add("ing", "...");
|
|
533
575
|
|
|
576
|
+
|
|
534
577
|
try {
|
|
535
578
|
const r = await this.#ai.generateSourceClient(userPrompt, apply);
|
|
536
579
|
elAiChat.add("ai", r);
|
package/package.json
CHANGED
|
@@ -464,7 +464,7 @@ const DocManager = () => {
|
|
|
464
464
|
);
|
|
465
465
|
};
|
|
466
466
|
|
|
467
|
-
export default
|
|
467
|
+
export default DocManager;
|
|
468
468
|
`;
|
|
469
469
|
/**
|
|
470
470
|
src1 = `
|
|
@@ -492,9 +492,13 @@ export default DocManager1;
|
|
|
492
492
|
</tr>
|
|
493
493
|
`; */
|
|
494
494
|
|
|
495
|
-
this.shadowRoot.querySelector("ide-diff-popup").popup(src1, src2);
|
|
495
|
+
//this.shadowRoot.querySelector("ide-diff-popup").popup(src1, src2);
|
|
496
|
+
|
|
497
|
+
//return;
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
496
501
|
|
|
497
|
-
return;
|
|
498
502
|
|
|
499
503
|
const apply = {
|
|
500
504
|
mybatis: this.shadowRoot.querySelector("#mybatis").checked,
|
|
@@ -528,9 +532,48 @@ export default DocManager1;
|
|
|
528
532
|
|
|
529
533
|
const elAiChat = this.shadowRoot.querySelector("nx-ai-chat");
|
|
530
534
|
|
|
535
|
+
|
|
536
|
+
// 1. 초기 진행 상태 메시지 추가
|
|
537
|
+
const initialProgressData = [
|
|
538
|
+
{ id: 'analysis', message: '1. 분석중입니다...', completedMessage: '1-1. 분석이 완료되었습니다.' },
|
|
539
|
+
{ id: 'design', message: '2. 설계중...', completedMessage: '2-1. 설계가 완료되었습니다.' },
|
|
540
|
+
{ id: 'development', message: '3. 개발중...', completedMessage: '3-1. 개발이 완료되었습니다.' }
|
|
541
|
+
];
|
|
542
|
+
|
|
543
|
+
// aiChat.add 호출 시, progressData를 마지막 인자로 전달하고 생성된 엘리먼트를 받습니다.
|
|
544
|
+
const progressMessageInstance = elAiChat.addProgress(initialProgressData);
|
|
545
|
+
|
|
546
|
+
// 2. 시간이 지난 후, 특정 단계의 완료를 알림
|
|
547
|
+
// 예를 들어, 3초 후에 분석 완료
|
|
548
|
+
setTimeout(() => {
|
|
549
|
+
if (progressMessageInstance) {
|
|
550
|
+
progressMessageInstance.updateProgress('analysis', 'completed');
|
|
551
|
+
console.log("분석 완료 메시지 업데이트");
|
|
552
|
+
}
|
|
553
|
+
}, 3000);
|
|
554
|
+
|
|
555
|
+
// 예를 들어, 6초 후에 설계 완료
|
|
556
|
+
setTimeout(() => {
|
|
557
|
+
if (progressMessageInstance) {
|
|
558
|
+
progressMessageInstance.updateProgress('design', 'completed');
|
|
559
|
+
console.log("설계 완료 메시지 업데이트");
|
|
560
|
+
}
|
|
561
|
+
}, 6000);
|
|
562
|
+
|
|
563
|
+
// 모든 단계가 완료된 후, 일반 AI 메시지 추가 (선택 사항)
|
|
564
|
+
setTimeout(() => {
|
|
565
|
+
elAiChat.add("ai", "모든 작업이 성공적으로 완료되었습니다!", [], []);
|
|
566
|
+
}, 9000);
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
return;
|
|
571
|
+
|
|
572
|
+
|
|
531
573
|
elAiChat.add("me", userPrompt);
|
|
532
574
|
elAiChat.add("ing", "...");
|
|
533
575
|
|
|
576
|
+
|
|
534
577
|
try {
|
|
535
578
|
const r = await this.#ai.generateSourceClient(userPrompt, apply);
|
|
536
579
|
elAiChat.add("ai", r);
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import ninegrid from "ninegrid2";
|
|
2
|
-
import {diff_match_patch} from 'diff-match-patch';
|
|
3
|
-
|
|
4
|
-
export class IdeDiff extends HTMLElement
|
|
5
|
-
{
|
|
6
|
-
#asisSrc;
|
|
7
|
-
#tobeSrc;
|
|
8
|
-
#asisPre; // <pre> 요소 참조 저장
|
|
9
|
-
#tobePre; // <pre> 요소 참조 저장
|
|
10
|
-
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
this.attachShadow({ mode: 'open' });
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
connectedCallback() {
|
|
17
|
-
this.shadowRoot.innerHTML = `
|
|
18
|
-
<style>
|
|
19
|
-
/* 전역 또는 컴포넌트 스코프에서 box-sizing: border-box; 적용 권장 */
|
|
20
|
-
* {
|
|
21
|
-
box-sizing: border-box;
|
|
22
|
-
}
|
|
23
|
-
@import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/ideDiff.css";
|
|
24
|
-
${ninegrid.getCustomPath(this,"ideDiff.css")}
|
|
25
|
-
|
|
26
|
-
/* 추가 CSS (필요 시) */
|
|
27
|
-
.wrapper {
|
|
28
|
-
display: flex; /* 스플리터와 함께 작동하도록 flex 컨테이너 */
|
|
29
|
-
height: 100%; /* 부모의 높이를 채우도록 설정 */
|
|
30
|
-
overflow: hidden; /* 내부 스크롤을 위해 overflow 처리 */
|
|
31
|
-
}
|
|
32
|
-
.panel {
|
|
33
|
-
flex: 1; /* 패널들이 남은 공간을 채우도록 */
|
|
34
|
-
overflow: auto; /* 각 패널 내부에서 스크롤 가능하게 */
|
|
35
|
-
position: relative; /* 자식 요소의 absolute 포지셔닝 기준 */
|
|
36
|
-
}
|
|
37
|
-
.panel pre {
|
|
38
|
-
margin: 0; /* pre 태그의 기본 마진 제거 */
|
|
39
|
-
padding: 10px; /* 코드 가독성을 위한 내부 패딩 */
|
|
40
|
-
white-space: pre-wrap; /* 긴 줄 자동 줄바꿈 */
|
|
41
|
-
word-break: break-all; /* 단어가 길어도 강제 줄바꿈 */
|
|
42
|
-
/* white-space: pre-wrap; 을 사용하면 가로 스크롤 없이 줄바꿈됩니다.
|
|
43
|
-
만약 가로 스크롤을 원하면 white-space: pre; 로 두고 overflow-x: auto; 를 panel에 추가 */
|
|
44
|
-
}
|
|
45
|
-
ins {
|
|
46
|
-
background-color: #d4edda; /* 삽입된 텍스트 배경색 (예시) */
|
|
47
|
-
text-decoration: none; /* 밑줄 제거 (일반적으로) */
|
|
48
|
-
}
|
|
49
|
-
del {
|
|
50
|
-
background-color: #f8d7da; /* 삭제된 텍스트 배경색 (예시) */
|
|
51
|
-
text-decoration: none; /* 취소선 제거 (일반적으로) */
|
|
52
|
-
}
|
|
53
|
-
</style>
|
|
54
|
-
|
|
55
|
-
<div class="wrapper">
|
|
56
|
-
<div class="panel asis"><pre></pre></div>
|
|
57
|
-
<nx-splitter></nx-splitter>
|
|
58
|
-
<div class="panel tobe"><pre></pre></div>
|
|
59
|
-
</div>
|
|
60
|
-
`;
|
|
61
|
-
|
|
62
|
-
requestAnimationFrame(() => {
|
|
63
|
-
this.#init();
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
#init = () => {
|
|
68
|
-
// 패널 pre 요소에 대한 참조를 저장
|
|
69
|
-
this.#asisPre = this.shadowRoot.querySelector('.asis pre');
|
|
70
|
-
this.#tobePre = this.shadowRoot.querySelector('.tobe pre');
|
|
71
|
-
|
|
72
|
-
// 스크롤 동기화 이벤트 리스너 추가
|
|
73
|
-
this.#asisPre.addEventListener('scroll', this.#syncScroll);
|
|
74
|
-
this.#tobePre.addEventListener('scroll', this.#syncScroll);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
#syncScroll = (e) => {
|
|
78
|
-
// 스크롤 이벤트 발생 시 다른 패널의 스크롤 위치를 동기화
|
|
79
|
-
// `e.target`이 스크롤 이벤트를 발생시킨 요소
|
|
80
|
-
if (e.target === this.#asisPre) {
|
|
81
|
-
this.#tobePre.scrollTop = this.#asisPre.scrollTop;
|
|
82
|
-
} else if (e.target === this.#tobePre) {
|
|
83
|
-
this.#asisPre.scrollTop = this.#tobePre.scrollTop;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
#renderDiff = () => {
|
|
88
|
-
const dmp = new diff_match_patch();
|
|
89
|
-
// 공백 문자를 정규화하여 diff 정확도 향상 (선택 사항)
|
|
90
|
-
const cleanedAsisSrc = this.#asisSrc.replace(/\r\n/g, '\n');
|
|
91
|
-
const cleanedTobeSrc = this.#tobeSrc.replace(/\r\n/g, '\n');
|
|
92
|
-
|
|
93
|
-
const diffs = dmp.diff_main(cleanedAsisSrc, cleanedTobeSrc);
|
|
94
|
-
dmp.diff_cleanupSemantic(diffs);
|
|
95
|
-
|
|
96
|
-
const asisHtml = [];
|
|
97
|
-
const tobeHtml = [];
|
|
98
|
-
|
|
99
|
-
for (const [op, text] of diffs) {
|
|
100
|
-
// HTML 이스케이프 처리: <, >, & 등 특수문자 변환
|
|
101
|
-
const escapedText = text
|
|
102
|
-
.replace(/&/g, '&')
|
|
103
|
-
.replace(/</g, '<')
|
|
104
|
-
.replace(/>/g, '>');
|
|
105
|
-
|
|
106
|
-
switch (op) {
|
|
107
|
-
case diff_match_patch.DIFF_INSERT:
|
|
108
|
-
tobeHtml.push(`<ins>${escapedText}</ins>`);
|
|
109
|
-
// 삭제된 내용이 없으므로 asis에는 공백을 유지 (줄 맞춤 고려)
|
|
110
|
-
// 만약 줄 단위로 완벽하게 매칭하려면 여기에 다른 로직 필요
|
|
111
|
-
break;
|
|
112
|
-
case diff_match_patch.DIFF_DELETE:
|
|
113
|
-
asisHtml.push(`<del>${escapedText}</del>`);
|
|
114
|
-
// 추가된 내용이 없으므로 tobe에는 공백을 유지
|
|
115
|
-
break;
|
|
116
|
-
case diff_match_patch.DIFF_EQUAL:
|
|
117
|
-
asisHtml.push(`<span>${escapedText}</span>`);
|
|
118
|
-
tobeHtml.push(`<span>${escapedText}</span>`);
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// 중요한 부분: `innerHTML` 대신 `textContent`를 사용하면
|
|
124
|
-
// `diff-match-patch`의 출력에 따라 HTML 태그가 그대로 보이므로,
|
|
125
|
-
// 여기서는 `innerHTML`을 사용하되, 텍스트는 `escapedText`로 처리하여 XSS 방지.
|
|
126
|
-
this.#asisPre.innerHTML = asisHtml.join('');
|
|
127
|
-
this.#tobePre.innerHTML = tobeHtml.join('');
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
initialize = (src1, src2) => {
|
|
132
|
-
console.log("Initializing IdeDiff with sources:", src1, src2);
|
|
133
|
-
|
|
134
|
-
this.#asisSrc = src1;
|
|
135
|
-
this.#tobeSrc = src2;
|
|
136
|
-
|
|
137
|
-
this.#renderDiff();
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
customElements.define("ide-diff", IdeDiff);
|