@iyulab/chat-components 0.1.1 → 0.2.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/CHANGELOG.md +24 -1
- package/dist/components/blocks/UCodeBlock.component.d.ts +7 -8
- package/dist/components/blocks/UCodeBlock.component.js +32 -21
- package/dist/components/blocks/UCodeBlock.styles.js +7 -6
- package/dist/components/{json-viewer/UJsonViewer.component.d.ts → blocks/UJsonBlock.component.d.ts} +5 -4
- package/dist/components/{json-viewer/UJsonViewer.component.js → blocks/UJsonBlock.component.js} +20 -17
- package/dist/components/blocks/UJsonBlock.d.ts +7 -0
- package/dist/components/blocks/UJsonBlock.js +5 -0
- package/dist/components/blocks/UMarkedBlock.component.d.ts +30 -9
- package/dist/components/blocks/UMarkedBlock.component.js +75 -26
- package/dist/components/blocks/UMarkedBlock.styles.js +288 -949
- package/dist/components/blocks/UThinkBlock.component.d.ts +3 -8
- package/dist/components/blocks/UThinkBlock.component.js +28 -22
- package/dist/components/blocks/UThinkBlock.styles.js +35 -54
- package/dist/components/blocks/UToolBlock.component.d.ts +13 -9
- package/dist/components/blocks/UToolBlock.component.js +30 -76
- package/dist/components/blocks/UToolBlock.styles.js +21 -62
- package/dist/components/buttons/UAttachButton.component.d.ts +3 -5
- package/dist/components/buttons/UAttachButton.component.js +30 -19
- package/dist/components/buttons/UAttachButton.styles.js +5 -12
- package/dist/components/buttons/UCopyButton.component.d.ts +3 -8
- package/dist/components/buttons/UCopyButton.component.js +29 -53
- package/dist/components/buttons/UCopyButton.styles.js +8 -37
- package/dist/components/buttons/UReportButton.component.d.ts +9 -0
- package/dist/components/buttons/UReportButton.component.js +36 -0
- package/dist/components/buttons/UReportButton.d.ts +7 -0
- package/dist/components/buttons/UReportButton.js +5 -0
- package/dist/components/buttons/UReportButton.styles.js +14 -0
- package/dist/components/buttons/URetryButton.component.d.ts +11 -0
- package/dist/components/buttons/URetryButton.component.js +53 -0
- package/dist/components/buttons/URetryButton.d.ts +7 -0
- package/dist/components/buttons/URetryButton.js +5 -0
- package/dist/components/buttons/URetryButton.styles.js +26 -0
- package/dist/components/buttons/UShareButton.component.d.ts +9 -0
- package/dist/components/buttons/UShareButton.component.js +36 -0
- package/dist/components/buttons/UShareButton.d.ts +7 -0
- package/dist/components/buttons/UShareButton.js +5 -0
- package/dist/components/buttons/UShareButton.styles.d.ts +1 -0
- package/dist/components/buttons/UShareButton.styles.js +14 -0
- package/dist/components/buttons/UVoteButton.component.d.ts +15 -0
- package/dist/components/buttons/UVoteButton.component.js +70 -0
- package/dist/components/buttons/UVoteButton.d.ts +8 -0
- package/dist/components/buttons/UVoteButton.js +5 -0
- package/dist/components/buttons/UVoteButton.styles.d.ts +1 -0
- package/dist/components/buttons/UVoteButton.styles.js +19 -0
- package/dist/components/loaders/UDotLoader.component.d.ts +9 -0
- package/dist/components/loaders/UDotLoader.component.js +23 -0
- package/dist/components/loaders/UDotLoader.d.ts +7 -0
- package/dist/components/loaders/UDotLoader.js +5 -0
- package/dist/components/loaders/UDotLoader.styles.d.ts +1 -0
- package/dist/components/loaders/UDotLoader.styles.js +50 -0
- package/dist/components/message/UMessage.component.d.ts +12 -6
- package/dist/components/message/UMessage.component.js +39 -59
- package/dist/components/message/UMessage.d.ts +0 -1
- package/dist/components/message/UMessage.styles.js +30 -49
- package/dist/components/prompt/UPrompt.component.d.ts +25 -0
- package/dist/components/prompt/UPrompt.component.js +113 -0
- package/dist/components/prompt/UPrompt.d.ts +7 -0
- package/dist/components/prompt/UPrompt.js +5 -0
- package/dist/components/prompt/UPrompt.styles.d.ts +1 -0
- package/dist/components/prompt/UPrompt.styles.js +42 -0
- package/dist/components/references/URefCard.component.d.ts +22 -0
- package/dist/components/references/URefCard.component.js +96 -0
- package/dist/components/references/URefCard.d.ts +7 -0
- package/dist/components/references/URefCard.js +5 -0
- package/dist/components/references/URefCard.styles.d.ts +1 -0
- package/dist/components/references/URefCard.styles.js +103 -0
- package/dist/components/references/URefCardGroup.component.d.ts +25 -0
- package/dist/components/references/URefCardGroup.component.js +88 -0
- package/dist/components/references/URefCardGroup.d.ts +7 -0
- package/dist/components/references/URefCardGroup.js +5 -0
- package/dist/components/references/URefCardGroup.styles.d.ts +1 -0
- package/dist/components/references/URefCardGroup.styles.js +69 -0
- package/dist/components/references/URefTag.component.d.ts +11 -0
- package/dist/components/{buttons/USendButton.component.js → references/URefTag.component.js} +17 -14
- package/dist/components/references/URefTag.d.ts +7 -0
- package/dist/components/references/URefTag.js +5 -0
- package/dist/components/references/URefTag.styles.d.ts +1 -0
- package/dist/components/references/URefTag.styles.js +51 -0
- package/dist/events/UCancelEvent.d.ts +6 -0
- package/dist/index.d.ts +15 -5
- package/dist/index.js +20 -6
- package/dist/types/BlockItem.d.ts +36 -0
- package/dist/types/BlockReference.d.ts +32 -0
- package/dist/types/JsonNode.d.ts +20 -0
- package/dist/utilities/converters.d.ts +9 -0
- package/dist/utilities/converters.js +19 -0
- package/package.json +9 -10
- package/dist/components/buttons/USendButton.component.d.ts +0 -13
- package/dist/components/buttons/USendButton.d.ts +0 -7
- package/dist/components/buttons/USendButton.js +0 -5
- package/dist/components/buttons/USendButton.styles.js +0 -23
- package/dist/components/buttons/UThinkButton.component.d.ts +0 -19
- package/dist/components/buttons/UThinkButton.component.js +0 -73
- package/dist/components/buttons/UThinkButton.d.ts +0 -7
- package/dist/components/buttons/UThinkButton.js +0 -5
- package/dist/components/buttons/UThinkButton.styles.js +0 -72
- package/dist/components/json-viewer/UJsonViewer.d.ts +0 -7
- package/dist/components/json-viewer/UJsonViewer.js +0 -5
- package/dist/components/json-viewer/UJsonViewer.lib.d.ts +0 -16
- package/dist/components/json-viewer/UJsonViewer.lib.js +0 -28
- package/dist/components/message/UMessage.types.d.ts +0 -21
- package/dist/events/UStopEvent.d.ts +0 -6
- package/dist/internals/date-helpers.d.ts +0 -8
- package/dist/internals/date-helpers.js +0 -27
- /package/dist/components/{buttons/USendButton.styles.d.ts → blocks/UJsonBlock.styles.d.ts} +0 -0
- /package/dist/components/{json-viewer/UJsonViewer.styles.js → blocks/UJsonBlock.styles.js} +0 -0
- /package/dist/components/buttons/{UThinkButton.styles.d.ts → UReportButton.styles.d.ts} +0 -0
- /package/dist/components/{json-viewer/UJsonViewer.styles.d.ts → buttons/URetryButton.styles.d.ts} +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
width: 380px;
|
|
7
|
+
padding: 6px;
|
|
8
|
+
border: 1px solid var(--u-border-color);
|
|
9
|
+
border-radius: 8px;
|
|
10
|
+
background: var(--u-panel-bg-color);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
a {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
padding: 6px;
|
|
17
|
+
color: inherit;
|
|
18
|
+
text-decoration: none;
|
|
19
|
+
transition: all 0.2s ease;
|
|
20
|
+
}
|
|
21
|
+
a:hover {
|
|
22
|
+
color: var(--u-blue-600);
|
|
23
|
+
background-color: var(--u-neutral-50);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.header {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: space-between;
|
|
31
|
+
gap: 8px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.favicon {
|
|
35
|
+
width: 20px;
|
|
36
|
+
height: 20px;
|
|
37
|
+
object-fit: contain;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.title {
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
line-height: 1.4;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
text-overflow: ellipsis;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.badge {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: row;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: 4px;
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
line-height: 1;
|
|
56
|
+
font-weight: 600;
|
|
57
|
+
padding: 4px 8px;
|
|
58
|
+
border-radius: 4px;
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
}
|
|
61
|
+
.badge[type="web"] {
|
|
62
|
+
color: var(--u-blue-700);
|
|
63
|
+
background: var(--u-blue-0);
|
|
64
|
+
}
|
|
65
|
+
.badge[type="document"] {
|
|
66
|
+
color: var(--u-green-700);
|
|
67
|
+
background: var(--u-green-0);
|
|
68
|
+
}
|
|
69
|
+
.badge u-icon {
|
|
70
|
+
color: inherit;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.body {
|
|
74
|
+
display: -webkit-box;
|
|
75
|
+
color: var(--u-txt-color-weak);
|
|
76
|
+
font-size: 12px;
|
|
77
|
+
line-height: 1.5;
|
|
78
|
+
-webkit-line-clamp: 3;
|
|
79
|
+
-webkit-box-orient: vertical;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
text-overflow: ellipsis;
|
|
82
|
+
margin-top: 8px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.footer {
|
|
86
|
+
display: flex;
|
|
87
|
+
gap: 4px;
|
|
88
|
+
flex-wrap: wrap;
|
|
89
|
+
margin-top: 8px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.tag {
|
|
93
|
+
font-size: 10px;
|
|
94
|
+
line-height: 1.4;
|
|
95
|
+
color: var(--u-txt-color-weak);
|
|
96
|
+
background: var(--u-neutral-100);
|
|
97
|
+
padding: 2px 6px;
|
|
98
|
+
border-radius: 4px;
|
|
99
|
+
white-space: nowrap;
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
export { styles };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
2
|
+
import { URefCard } from './URefCard.component.js';
|
|
3
|
+
/**
|
|
4
|
+
* 여러 참조 카드를 그룹으로 표시하는 컴포넌트입니다.
|
|
5
|
+
* 페이지네이션 기능을 제공하여 각 카드를 하나씩 탐색할 수 있습니다.
|
|
6
|
+
*/
|
|
7
|
+
export declare class URefCardGroup extends BaseElement {
|
|
8
|
+
static styles: import('lit').CSSResultGroup[];
|
|
9
|
+
static dependencies: Record<string, typeof BaseElement>;
|
|
10
|
+
/** slot으로 받은 카드 엘리먼트들 */
|
|
11
|
+
cards: URefCard[];
|
|
12
|
+
/** 현재 표시 중인 카드의 인덱스 */
|
|
13
|
+
currentIndex: number;
|
|
14
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
15
|
+
/**
|
|
16
|
+
* 해당하는 인덱스에 해당하는 카드로 변경합니다.
|
|
17
|
+
*/
|
|
18
|
+
switch(index: number): void;
|
|
19
|
+
/** 이전 카드로 이동합니다. */
|
|
20
|
+
private handlePreviousButtonClick;
|
|
21
|
+
/** 다음 카드로 이동합니다. */
|
|
22
|
+
private handleNextButtonClick;
|
|
23
|
+
/** slot 내용이 변경될 때 호출됩니다. */
|
|
24
|
+
private handleSlotChange;
|
|
25
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { state } from 'lit/decorators.js';
|
|
3
|
+
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
4
|
+
import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
|
|
5
|
+
import { URefCard } from './URefCard.component.js';
|
|
6
|
+
import { styles } from './URefCardGroup.styles.js';
|
|
7
|
+
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
+
var result = void 0 ;
|
|
11
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
+
if (decorator = decorators[i])
|
|
13
|
+
result = (decorator(target, key, result) ) || result;
|
|
14
|
+
if (result) __defProp(target, key, result);
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
17
|
+
class URefCardGroup extends BaseElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.cards = [];
|
|
21
|
+
this.currentIndex = 0;
|
|
22
|
+
}
|
|
23
|
+
static {
|
|
24
|
+
this.styles = [super.styles, styles];
|
|
25
|
+
}
|
|
26
|
+
static {
|
|
27
|
+
this.dependencies = {
|
|
28
|
+
"u-icon": UIcon,
|
|
29
|
+
"u-ref-card": URefCard
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
return html`
|
|
34
|
+
<div class="header">
|
|
35
|
+
<button class="nav-button"
|
|
36
|
+
@click=${this.handlePreviousButtonClick}>
|
|
37
|
+
<u-icon lib="internal" name="chevron-left"></u-icon>
|
|
38
|
+
</button>
|
|
39
|
+
|
|
40
|
+
<span class="page-indicator">
|
|
41
|
+
${this.currentIndex + 1} / ${this.cards.length}
|
|
42
|
+
</span>
|
|
43
|
+
|
|
44
|
+
<button class="nav-button"
|
|
45
|
+
@click=${this.handleNextButtonClick}>
|
|
46
|
+
<u-icon lib="internal" name="chevron-right"></u-icon>
|
|
47
|
+
</button>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div class="viewport">
|
|
51
|
+
<div class="track" style=${`transform: translateX(-${this.currentIndex * 100}%);`}>
|
|
52
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 해당하는 인덱스에 해당하는 카드로 변경합니다.
|
|
59
|
+
*/
|
|
60
|
+
switch(index) {
|
|
61
|
+
const len = this.cards.length;
|
|
62
|
+
if (len === 0) return;
|
|
63
|
+
this.currentIndex = index < 0 ? len - 1 : index >= len ? 0 : index;
|
|
64
|
+
}
|
|
65
|
+
/** 이전 카드로 이동합니다. */
|
|
66
|
+
handlePreviousButtonClick() {
|
|
67
|
+
this.switch(this.currentIndex - 1);
|
|
68
|
+
}
|
|
69
|
+
/** 다음 카드로 이동합니다. */
|
|
70
|
+
handleNextButtonClick() {
|
|
71
|
+
this.switch(this.currentIndex + 1);
|
|
72
|
+
}
|
|
73
|
+
/** slot 내용이 변경될 때 호출됩니다. */
|
|
74
|
+
handleSlotChange(e) {
|
|
75
|
+
const slot = e.target;
|
|
76
|
+
const elements = slot.assignedElements({ flatten: true });
|
|
77
|
+
this.cards = elements.filter((el) => el instanceof URefCard);
|
|
78
|
+
this.switch(0);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
__decorateClass([
|
|
82
|
+
state()
|
|
83
|
+
], URefCardGroup.prototype, "cards");
|
|
84
|
+
__decorateClass([
|
|
85
|
+
state()
|
|
86
|
+
], URefCardGroup.prototype, "currentIndex");
|
|
87
|
+
|
|
88
|
+
export { URefCardGroup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import('lit').CSSResult;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
width: 380px;
|
|
8
|
+
border: 1px solid var(--u-border-color);
|
|
9
|
+
border-radius: 8px;
|
|
10
|
+
background: var(--u-panel-bg-color);
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.header {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
padding: 6px 8px;
|
|
20
|
+
color: var(--u-txt-color-weak);
|
|
21
|
+
background-color: var(--u-neutral-100);
|
|
22
|
+
border-bottom: 1px solid var(--u-border-color);
|
|
23
|
+
user-select: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.nav-button {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
padding: 0;
|
|
31
|
+
border: none;
|
|
32
|
+
background-color: transparent;
|
|
33
|
+
color: inherit;
|
|
34
|
+
font-size: 16px;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
}
|
|
37
|
+
.nav-button:hover u-icon {
|
|
38
|
+
opacity: 0.6;
|
|
39
|
+
}
|
|
40
|
+
.nav-button u-icon {
|
|
41
|
+
color: inherit;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.page-indicator {
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.viewport {
|
|
50
|
+
width: 100%;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.track {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: row;
|
|
57
|
+
width: 100%;
|
|
58
|
+
will-change: transform;
|
|
59
|
+
transition: transform 260ms ease;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* slot 안의 각 카드가 한 페이지(100%)를 차지하도록 */
|
|
63
|
+
::slotted(u-ref-card) {
|
|
64
|
+
flex: 0 0 100%;
|
|
65
|
+
border: none;
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
export { styles };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
2
|
+
/**
|
|
3
|
+
* 인용 태그 컴포넌트입니다.
|
|
4
|
+
*/
|
|
5
|
+
export declare class URefTag extends BaseElement {
|
|
6
|
+
static styles: import('lit').CSSResultGroup[];
|
|
7
|
+
static dependencies: Record<string, typeof BaseElement>;
|
|
8
|
+
/** 인용 출처 소스 데이터 */
|
|
9
|
+
href: string;
|
|
10
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
11
|
+
}
|
package/dist/components/{buttons/USendButton.component.js → references/URefTag.component.js}
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
4
|
+
import { UTooltip } from '@iyulab/components/dist/components/tooltip/UTooltip.component.js';
|
|
4
5
|
import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
|
|
5
|
-
import { styles } from './
|
|
6
|
+
import { styles } from './URefTag.styles.js';
|
|
6
7
|
|
|
7
8
|
var __defProp = Object.defineProperty;
|
|
8
9
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -13,34 +14,36 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
13
14
|
if (result) __defProp(target, key, result);
|
|
14
15
|
return result;
|
|
15
16
|
};
|
|
16
|
-
class
|
|
17
|
+
class URefTag extends BaseElement {
|
|
17
18
|
constructor() {
|
|
18
19
|
super(...arguments);
|
|
19
|
-
this.
|
|
20
|
-
this.disabled = false;
|
|
20
|
+
this.href = "#";
|
|
21
21
|
}
|
|
22
22
|
static {
|
|
23
23
|
this.styles = [super.styles, styles];
|
|
24
24
|
}
|
|
25
25
|
static {
|
|
26
26
|
this.dependencies = {
|
|
27
|
-
"u-icon": UIcon
|
|
27
|
+
"u-icon": UIcon,
|
|
28
|
+
"u-tooltip": UTooltip
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
render() {
|
|
31
32
|
return html`
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
<a href="${this.href}" target="_blank" rel="noopener noreferrer">
|
|
34
|
+
<slot></slot>
|
|
35
|
+
</a>
|
|
36
|
+
|
|
37
|
+
<u-icon lib="internal" name="box-arrow-up-right"></u-icon>
|
|
38
|
+
|
|
39
|
+
<u-tooltip interactive placement="bottom" distance="4">
|
|
40
|
+
<slot name="tooltip"></slot>
|
|
41
|
+
</u-tooltip>
|
|
36
42
|
`;
|
|
37
43
|
}
|
|
38
44
|
}
|
|
39
45
|
__decorateClass([
|
|
40
46
|
property({ type: String })
|
|
41
|
-
],
|
|
42
|
-
__decorateClass([
|
|
43
|
-
property({ type: Boolean, reflect: true })
|
|
44
|
-
], USendButton.prototype, "disabled");
|
|
47
|
+
], URefTag.prototype, "href");
|
|
45
48
|
|
|
46
|
-
export {
|
|
49
|
+
export { URefTag };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import('lit').CSSResult;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
flex-direction: row;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: 4px;
|
|
9
|
+
color: var(--u-neutral-800);
|
|
10
|
+
font-size: 10px;
|
|
11
|
+
border: 1px solid var(--u-neutral-300);
|
|
12
|
+
border-radius: 9999px;
|
|
13
|
+
background-color: var(--u-neutral-100);
|
|
14
|
+
padding: 2px 6px;
|
|
15
|
+
transition: background-color 0.2s ease-in-out;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
:host(:hover) {
|
|
19
|
+
color: var(--u-neutral-100);
|
|
20
|
+
background-color: var(--u-neutral-900);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
a {
|
|
24
|
+
min-width: 1em;
|
|
25
|
+
max-width: 6em;
|
|
26
|
+
display: inline-block;
|
|
27
|
+
text-decoration: none;
|
|
28
|
+
color: inherit;
|
|
29
|
+
line-height: 1.5;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
text-overflow: ellipsis;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
u-icon {
|
|
36
|
+
color: inherit;
|
|
37
|
+
font-size: inherit;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
u-tooltip {
|
|
41
|
+
padding: 0;
|
|
42
|
+
border: none;
|
|
43
|
+
background-color: transparent;
|
|
44
|
+
box-shadow: none;
|
|
45
|
+
}
|
|
46
|
+
u-tooltip[visible] {
|
|
47
|
+
opacity: 1;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
export { styles };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
export * from './components/blocks/UCodeBlock.js';
|
|
2
|
+
export * from './components/blocks/UJsonBlock.js';
|
|
2
3
|
export * from './components/blocks/UMarkedBlock.js';
|
|
3
4
|
export * from './components/blocks/UTextBlock.js';
|
|
4
5
|
export * from './components/blocks/UThinkBlock.js';
|
|
5
6
|
export * from './components/blocks/UToolBlock.js';
|
|
6
7
|
export * from './components/buttons/UAttachButton.js';
|
|
7
8
|
export * from './components/buttons/UCopyButton.js';
|
|
8
|
-
export * from './components/buttons/
|
|
9
|
-
export * from './components/buttons/
|
|
10
|
-
export * from './components/
|
|
9
|
+
export * from './components/buttons/UVoteButton.js';
|
|
10
|
+
export * from './components/buttons/UReportButton.js';
|
|
11
|
+
export * from './components/buttons/URetryButton.js';
|
|
12
|
+
export * from './components/buttons/UShareButton.js';
|
|
13
|
+
export * from './components/loaders/UDotLoader.js';
|
|
11
14
|
export * from './components/message/UMessage.js';
|
|
12
|
-
export
|
|
13
|
-
export
|
|
15
|
+
export * from './components/prompt/UPrompt.js';
|
|
16
|
+
export * from './components/references/URefTag.js';
|
|
17
|
+
export * from './components/references/URefCard.js';
|
|
18
|
+
export * from './components/references/URefCardGroup.js';
|
|
19
|
+
export type * from './types/BlockItem';
|
|
20
|
+
export type * from './types/BlockReference';
|
|
21
|
+
export type * from './types/JsonNode';
|
|
22
|
+
export type * from './events/UCancelEvent';
|
|
23
|
+
export type * from './events/USubmitEvent';
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
import './components/blocks/UCodeBlock.js';
|
|
2
|
+
import './components/blocks/UJsonBlock.js';
|
|
2
3
|
import './components/blocks/UMarkedBlock.js';
|
|
3
4
|
import './components/blocks/UTextBlock.js';
|
|
4
5
|
import './components/blocks/UThinkBlock.js';
|
|
5
6
|
import './components/blocks/UToolBlock.js';
|
|
6
7
|
import './components/buttons/UAttachButton.js';
|
|
7
8
|
import './components/buttons/UCopyButton.js';
|
|
8
|
-
import './components/buttons/
|
|
9
|
-
import './components/buttons/
|
|
10
|
-
import './components/
|
|
9
|
+
import './components/buttons/UVoteButton.js';
|
|
10
|
+
import './components/buttons/UReportButton.js';
|
|
11
|
+
import './components/buttons/URetryButton.js';
|
|
12
|
+
import './components/buttons/UShareButton.js';
|
|
13
|
+
import './components/loaders/UDotLoader.js';
|
|
11
14
|
import './components/message/UMessage.js';
|
|
15
|
+
import './components/prompt/UPrompt.js';
|
|
16
|
+
import './components/references/URefTag.js';
|
|
17
|
+
import './components/references/URefCard.js';
|
|
18
|
+
import './components/references/URefCardGroup.js';
|
|
12
19
|
export { UCodeBlock } from './components/blocks/UCodeBlock.component.js';
|
|
20
|
+
export { UJsonBlock } from './components/blocks/UJsonBlock.component.js';
|
|
13
21
|
export { UMarkedBlock } from './components/blocks/UMarkedBlock.component.js';
|
|
14
22
|
export { UTextBlock } from './components/blocks/UTextBlock.component.js';
|
|
15
23
|
export { UThinkBlock } from './components/blocks/UThinkBlock.component.js';
|
|
16
24
|
export { UToolBlock } from './components/blocks/UToolBlock.component.js';
|
|
17
25
|
export { UAttachButton } from './components/buttons/UAttachButton.component.js';
|
|
18
26
|
export { UCopyButton } from './components/buttons/UCopyButton.component.js';
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
27
|
+
export { UVoteButton } from './components/buttons/UVoteButton.component.js';
|
|
28
|
+
export { UReportButton } from './components/buttons/UReportButton.component.js';
|
|
29
|
+
export { URetryButton } from './components/buttons/URetryButton.component.js';
|
|
30
|
+
export { UShareButton } from './components/buttons/UShareButton.component.js';
|
|
31
|
+
export { UDotLoader } from './components/loaders/UDotLoader.component.js';
|
|
22
32
|
export { UMessage } from './components/message/UMessage.component.js';
|
|
33
|
+
export { UPrompt } from './components/prompt/UPrompt.component.js';
|
|
34
|
+
export { URefTag } from './components/references/URefTag.component.js';
|
|
35
|
+
export { URefCard } from './components/references/URefCard.component.js';
|
|
36
|
+
export { URefCardGroup } from './components/references/URefCardGroup.component.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BlockReference } from './BlockReference';
|
|
2
|
+
import { JsonNode } from './JsonNode';
|
|
3
|
+
/** LLM 추론 텍스트 블록입니다. */
|
|
4
|
+
export interface ThinkingBlockItem {
|
|
5
|
+
type: "thinking";
|
|
6
|
+
/** 추론 텍스트 내용 */
|
|
7
|
+
value?: string;
|
|
8
|
+
}
|
|
9
|
+
/** 일반 텍스트 블록입니다. */
|
|
10
|
+
export interface TextBlockItem {
|
|
11
|
+
type: "text";
|
|
12
|
+
/** 텍스트 내용 */
|
|
13
|
+
value?: string;
|
|
14
|
+
}
|
|
15
|
+
/** 마크다운 텍스트 블록입니다. */
|
|
16
|
+
export interface MarkdownBlockItem {
|
|
17
|
+
type: "markdown";
|
|
18
|
+
/** 마크다운 텍스트 */
|
|
19
|
+
value?: string;
|
|
20
|
+
/** 마크다운 내 인용 출처들 */
|
|
21
|
+
refs?: BlockReference[];
|
|
22
|
+
}
|
|
23
|
+
/** 툴 사용 블록입니다. */
|
|
24
|
+
export interface ToolBlockItem {
|
|
25
|
+
type: "tool";
|
|
26
|
+
/** 도구 블록 제목 */
|
|
27
|
+
title?: string;
|
|
28
|
+
/** 도구 블록 입력값(json) */
|
|
29
|
+
input?: JsonNode;
|
|
30
|
+
/** 도구 블록 출력값(json) */
|
|
31
|
+
output?: JsonNode;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 타입별 메시지 컨텐츠 아이템
|
|
35
|
+
*/
|
|
36
|
+
export type BlockItem = (ThinkingBlockItem | TextBlockItem | MarkdownBlockItem | ToolBlockItem);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 블록 참조에서 사용되는 참조 내용입니다.
|
|
3
|
+
*/
|
|
4
|
+
export interface ReferenceSource {
|
|
5
|
+
/** 자료의 종류 입니다. */
|
|
6
|
+
type: 'web' | 'document';
|
|
7
|
+
/** 참조 링크 URL */
|
|
8
|
+
url: string;
|
|
9
|
+
/** 제목 */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** 발췌 내용 */
|
|
12
|
+
snippet?: string;
|
|
13
|
+
/** 태그 */
|
|
14
|
+
tags?: string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 텍스트 컨텐츠 내 인용 참조 블록
|
|
18
|
+
*/
|
|
19
|
+
export interface TextBlockReference {
|
|
20
|
+
/** 인용 출처 이름 */
|
|
21
|
+
name: string;
|
|
22
|
+
/** 참조 텍스트 시작 위치 (문자 인덱스) */
|
|
23
|
+
startIndex: number;
|
|
24
|
+
/** 참조 텍스트 종료 위치 (문자 인덱스) */
|
|
25
|
+
endIndex: number;
|
|
26
|
+
/** 원본 참조 내용 */
|
|
27
|
+
sources: ReferenceSource[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 메시지 컨텐츠 내에서 인용 참조 블록
|
|
31
|
+
*/
|
|
32
|
+
export type BlockReference = TextBlockReference;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** JSON 값 타입 */
|
|
2
|
+
export type JsonValue = string | number | boolean | null;
|
|
3
|
+
/** JSON 객체 타입 */
|
|
4
|
+
export type JsonObject = {
|
|
5
|
+
[x: string]: JsonNode;
|
|
6
|
+
};
|
|
7
|
+
/** JSON 배열 타입 */
|
|
8
|
+
export type JsonArray = Array<JsonNode>;
|
|
9
|
+
/**
|
|
10
|
+
* JSON 데이터 구조에서 사용할 수 있는 모든 유형의 노드를 표현합니다.
|
|
11
|
+
* JsonValue(원시값), JsonObject(객체), JsonArray(배열) 중 하나가 될 수 있습니다.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const primitiveNode: JsonNode = "string value";
|
|
16
|
+
* const objectNode: JsonNode = { key: "value" };
|
|
17
|
+
* const arrayNode: JsonNode = [1, 2, 3];
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export type JsonNode = JsonValue | JsonObject | JsonArray;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JsonNode } from '../types/JsonNode';
|
|
2
|
+
/**
|
|
3
|
+
* 이 컨버터는 JsonNode 타입을 사용하여 JSON 데이터를 처리합니다.
|
|
4
|
+
* 문자열 어트리뷰트로 전달된 JSON 문자열을 객체로 변환/직렬화합니다.
|
|
5
|
+
*/
|
|
6
|
+
export declare const jsonAttrConverter: {
|
|
7
|
+
fromAttribute: (value: string | null) => JsonNode;
|
|
8
|
+
toAttribute: (value: JsonNode) => string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const jsonAttrConverter = {
|
|
2
|
+
fromAttribute: (value) => {
|
|
3
|
+
if (!value || !value.trim()) return {};
|
|
4
|
+
try {
|
|
5
|
+
return JSON.parse(value);
|
|
6
|
+
} catch {
|
|
7
|
+
return {};
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
toAttribute: (value) => {
|
|
11
|
+
try {
|
|
12
|
+
return JSON.stringify(value);
|
|
13
|
+
} catch {
|
|
14
|
+
return "{}";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { jsonAttrConverter };
|