@iyulab/chat-components 0.1.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 +4 -0
- package/LICENSE +21 -0
- package/README.md +20 -0
- package/dist/components/blocks/UCodeBlock.component.d.ts +24 -0
- package/dist/components/blocks/UCodeBlock.component.js +65 -0
- package/dist/components/blocks/UCodeBlock.d.ts +7 -0
- package/dist/components/blocks/UCodeBlock.js +5 -0
- package/dist/components/blocks/UCodeBlock.styles.d.ts +1 -0
- package/dist/components/blocks/UCodeBlock.styles.js +175 -0
- package/dist/components/blocks/UMarkedBlock.component.d.ts +24 -0
- package/dist/components/blocks/UMarkedBlock.component.js +80 -0
- package/dist/components/blocks/UMarkedBlock.d.ts +7 -0
- package/dist/components/blocks/UMarkedBlock.js +5 -0
- package/dist/components/blocks/UMarkedBlock.styles.d.ts +1 -0
- package/dist/components/blocks/UMarkedBlock.styles.js +1240 -0
- package/dist/components/blocks/UTextBlock.component.d.ts +37 -0
- package/dist/components/blocks/UTextBlock.component.js +123 -0
- package/dist/components/blocks/UTextBlock.d.ts +7 -0
- package/dist/components/blocks/UTextBlock.js +5 -0
- package/dist/components/blocks/UTextBlock.styles.d.ts +1 -0
- package/dist/components/blocks/UTextBlock.styles.js +71 -0
- package/dist/components/blocks/UThinkBlock.component.d.ts +28 -0
- package/dist/components/blocks/UThinkBlock.component.js +84 -0
- package/dist/components/blocks/UThinkBlock.d.ts +7 -0
- package/dist/components/blocks/UThinkBlock.js +5 -0
- package/dist/components/blocks/UThinkBlock.styles.d.ts +1 -0
- package/dist/components/blocks/UThinkBlock.styles.js +93 -0
- package/dist/components/blocks/UToolBlock.component.d.ts +16 -0
- package/dist/components/blocks/UToolBlock.component.js +126 -0
- package/dist/components/blocks/UToolBlock.d.ts +7 -0
- package/dist/components/blocks/UToolBlock.js +5 -0
- package/dist/components/blocks/UToolBlock.styles.d.ts +1 -0
- package/dist/components/blocks/UToolBlock.styles.js +107 -0
- package/dist/components/buttons/UAttachButton.component.d.ts +24 -0
- package/dist/components/buttons/UAttachButton.component.js +78 -0
- package/dist/components/buttons/UAttachButton.d.ts +7 -0
- package/dist/components/buttons/UAttachButton.js +5 -0
- package/dist/components/buttons/UAttachButton.styles.d.ts +1 -0
- package/dist/components/buttons/UAttachButton.styles.js +21 -0
- package/dist/components/buttons/UCopyButton.component.d.ts +25 -0
- package/dist/components/buttons/UCopyButton.component.js +105 -0
- package/dist/components/buttons/UCopyButton.d.ts +7 -0
- package/dist/components/buttons/UCopyButton.js +5 -0
- package/dist/components/buttons/UCopyButton.styles.d.ts +1 -0
- package/dist/components/buttons/UCopyButton.styles.js +47 -0
- package/dist/components/buttons/USendButton.component.d.ts +13 -0
- package/dist/components/buttons/USendButton.component.js +46 -0
- package/dist/components/buttons/USendButton.d.ts +7 -0
- package/dist/components/buttons/USendButton.js +5 -0
- package/dist/components/buttons/USendButton.styles.d.ts +1 -0
- package/dist/components/buttons/USendButton.styles.js +23 -0
- package/dist/components/buttons/UThinkButton.component.d.ts +19 -0
- package/dist/components/buttons/UThinkButton.component.js +73 -0
- package/dist/components/buttons/UThinkButton.d.ts +7 -0
- package/dist/components/buttons/UThinkButton.js +5 -0
- package/dist/components/buttons/UThinkButton.styles.d.ts +1 -0
- package/dist/components/buttons/UThinkButton.styles.js +72 -0
- package/dist/components/json-viewer/UJsonViewer.component.d.ts +44 -0
- package/dist/components/json-viewer/UJsonViewer.component.js +137 -0
- package/dist/components/json-viewer/UJsonViewer.d.ts +7 -0
- package/dist/components/json-viewer/UJsonViewer.js +5 -0
- package/dist/components/json-viewer/UJsonViewer.lib.d.ts +16 -0
- package/dist/components/json-viewer/UJsonViewer.lib.js +28 -0
- package/dist/components/json-viewer/UJsonViewer.styles.d.ts +1 -0
- package/dist/components/json-viewer/UJsonViewer.styles.js +115 -0
- package/dist/components/message/UMessage.component.d.ts +13 -0
- package/dist/components/message/UMessage.component.js +104 -0
- package/dist/components/message/UMessage.d.ts +8 -0
- package/dist/components/message/UMessage.js +5 -0
- package/dist/components/message/UMessage.styles.d.ts +1 -0
- package/dist/components/message/UMessage.styles.js +72 -0
- package/dist/components/message/UMessage.types.d.ts +21 -0
- package/dist/events/UStopEvent.d.ts +6 -0
- package/dist/events/USubmitEvent.d.ts +6 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +22 -0
- package/dist/internals/date-helpers.d.ts +8 -0
- package/dist/internals/date-helpers.js +27 -0
- package/package.json +65 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: auto;
|
|
8
|
+
border: 1px solid var(--u-border-color);
|
|
9
|
+
border-radius: 8px;
|
|
10
|
+
font-size: 14px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.container {
|
|
14
|
+
width: 100%;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.header {
|
|
20
|
+
width: 100%;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: row;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
gap: 8px;
|
|
26
|
+
padding: 8px;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
user-select: none;
|
|
29
|
+
}
|
|
30
|
+
.header u-icon[name="eye"] {
|
|
31
|
+
font-size: 16px;
|
|
32
|
+
color: var(--u-blue-500);
|
|
33
|
+
}
|
|
34
|
+
.header u-icon[name="check-lg"] {
|
|
35
|
+
color: var(--u-green-500);
|
|
36
|
+
}
|
|
37
|
+
.header u-icon[name="x-lg"] {
|
|
38
|
+
color: var(--u-red-500);
|
|
39
|
+
}
|
|
40
|
+
.header .display {
|
|
41
|
+
flex: 1;
|
|
42
|
+
font-size: inherit;
|
|
43
|
+
font-weight: 600;
|
|
44
|
+
line-height: 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.body {
|
|
48
|
+
display: block;
|
|
49
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
50
|
+
width: 100%;
|
|
51
|
+
max-height: 260px;
|
|
52
|
+
overflow: auto;
|
|
53
|
+
scrollbar-width: thin;
|
|
54
|
+
scrollbar-color: var(--u-scrollbar-color) transparent;
|
|
55
|
+
}
|
|
56
|
+
.body .viewer {
|
|
57
|
+
width: 100%;
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: row;
|
|
60
|
+
align-items: flex-start;
|
|
61
|
+
gap: 8px;
|
|
62
|
+
padding: 4px 8px;
|
|
63
|
+
}
|
|
64
|
+
.body .viewer:not(:last-child) {
|
|
65
|
+
border-bottom: 1px dashed var(--u-border-color);
|
|
66
|
+
}
|
|
67
|
+
.body .viewer .label {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
font-size: inherit;
|
|
72
|
+
font-weight: 400;
|
|
73
|
+
width: 1.5em;
|
|
74
|
+
height: 1.5em;
|
|
75
|
+
}
|
|
76
|
+
.body .viewer u-json-viewer {
|
|
77
|
+
width: calc(100% - 1.5em);
|
|
78
|
+
font-size: inherit;
|
|
79
|
+
font-family: inherit;
|
|
80
|
+
line-height: 1.5;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.footer {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: row;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: flex-end;
|
|
88
|
+
gap: 8px;
|
|
89
|
+
padding: 4px 12px;
|
|
90
|
+
}
|
|
91
|
+
.footer u-button {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: row;
|
|
94
|
+
align-items: center;
|
|
95
|
+
gap: 4px;
|
|
96
|
+
padding: 6px 8px;
|
|
97
|
+
font-size: 12px;
|
|
98
|
+
}
|
|
99
|
+
.footer u-icon[name="check-lg"] {
|
|
100
|
+
color: var(--u-green-500);
|
|
101
|
+
}
|
|
102
|
+
.footer u-icon[name="x-lg"] {
|
|
103
|
+
color: var(--u-red-500);
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
|
|
107
|
+
export { styles };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
2
|
+
/**
|
|
3
|
+
* 파일 첨부 버튼 컴포넌트입니다.
|
|
4
|
+
*/
|
|
5
|
+
export declare class UAttachButton extends BaseElement {
|
|
6
|
+
static styles: import('lit').CSSResultGroup[];
|
|
7
|
+
static dependencies: Record<string, typeof BaseElement>;
|
|
8
|
+
input: HTMLInputElement;
|
|
9
|
+
/** 첨부 파일 유형 제한, 컴마로 구분된 MIME 타입 문자열 (예: "image/*,application/pdf") */
|
|
10
|
+
accept?: string;
|
|
11
|
+
/** 다중 파일 선택 가능 여부 */
|
|
12
|
+
multiple: boolean;
|
|
13
|
+
connectedCallback(): void;
|
|
14
|
+
disconnectedCallback(): void;
|
|
15
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
16
|
+
/**
|
|
17
|
+
* 버튼 클릭 핸들러
|
|
18
|
+
*/
|
|
19
|
+
private openFileExplorer;
|
|
20
|
+
/**
|
|
21
|
+
* 파일 선택 이벤트 핸들러
|
|
22
|
+
*/
|
|
23
|
+
private handleFileSelected;
|
|
24
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { query, property } 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 { styles } from './UAttachButton.styles.js';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
+
var result = void 0 ;
|
|
10
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
+
if (decorator = decorators[i])
|
|
12
|
+
result = (decorator(target, key, result) ) || result;
|
|
13
|
+
if (result) __defProp(target, key, result);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
class UAttachButton extends BaseElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.multiple = false;
|
|
20
|
+
/**
|
|
21
|
+
* 버튼 클릭 핸들러
|
|
22
|
+
*/
|
|
23
|
+
this.openFileExplorer = () => {
|
|
24
|
+
if (!this.input) return;
|
|
25
|
+
this.input.click();
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 파일 선택 이벤트 핸들러
|
|
29
|
+
*/
|
|
30
|
+
this.handleFileSelected = (e) => {
|
|
31
|
+
const target = e.target;
|
|
32
|
+
const files = target.files;
|
|
33
|
+
if (!files || files.length === 0) return;
|
|
34
|
+
this.emit("select-files", files);
|
|
35
|
+
target.value = "";
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
static {
|
|
39
|
+
this.styles = [super.styles, styles];
|
|
40
|
+
}
|
|
41
|
+
static {
|
|
42
|
+
this.dependencies = {
|
|
43
|
+
"u-icon": UIcon
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
connectedCallback() {
|
|
47
|
+
super.connectedCallback();
|
|
48
|
+
this.addEventListener("click", this.openFileExplorer);
|
|
49
|
+
}
|
|
50
|
+
disconnectedCallback() {
|
|
51
|
+
this.removeEventListener("click", this.openFileExplorer);
|
|
52
|
+
super.disconnectedCallback();
|
|
53
|
+
}
|
|
54
|
+
render() {
|
|
55
|
+
return html`
|
|
56
|
+
<u-icon
|
|
57
|
+
lib="internal"
|
|
58
|
+
name="paperclip"
|
|
59
|
+
></u-icon>
|
|
60
|
+
<input type="file"
|
|
61
|
+
?multiple=${this.multiple}
|
|
62
|
+
.accept=${this.accept || ""}
|
|
63
|
+
@change=${this.handleFileSelected}
|
|
64
|
+
/>
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
__decorateClass([
|
|
69
|
+
query('input[type="file"]')
|
|
70
|
+
], UAttachButton.prototype, "input");
|
|
71
|
+
__decorateClass([
|
|
72
|
+
property({ type: String })
|
|
73
|
+
], UAttachButton.prototype, "accept");
|
|
74
|
+
__decorateClass([
|
|
75
|
+
property({ type: Boolean })
|
|
76
|
+
], UAttachButton.prototype, "multiple");
|
|
77
|
+
|
|
78
|
+
export { UAttachButton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import('lit').CSSResult;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
position: relative;
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
padding: 8px;
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
border-radius: 8px;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
}
|
|
12
|
+
:host(:hover) {
|
|
13
|
+
background-color: var(--u-neutral-100, #f3f4f6);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
input[type="file"] {
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export { styles };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { nothing } from 'lit';
|
|
2
|
+
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
3
|
+
/**
|
|
4
|
+
* 클릭 시 클립보드에 텍스트를 복사하는 버튼입니다. 복사 상태를 표시하기 위해 아이콘이 변경됩니다.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UCopyButton extends BaseElement {
|
|
7
|
+
static styles: import('lit').CSSResultGroup[];
|
|
8
|
+
static dependencies: Record<string, typeof BaseElement>;
|
|
9
|
+
/** 버튼의 모드를 설정합니다. 기본은 'symbol'입니다. */
|
|
10
|
+
mode: 'badge' | 'symbol';
|
|
11
|
+
/** 클립보드 복사 상태를 나타내는 플래그입니다. */
|
|
12
|
+
isCopied: boolean;
|
|
13
|
+
/** 복사할 텍스트를 설정합니다. */
|
|
14
|
+
value?: string;
|
|
15
|
+
/** 클립보드 복사 후 재사용 대기 시간 (ms) */
|
|
16
|
+
delay: number;
|
|
17
|
+
connectedCallback(): void;
|
|
18
|
+
disconnectedCallback(): void;
|
|
19
|
+
render(): typeof nothing | import('lit-html').TemplateResult<1>;
|
|
20
|
+
/**
|
|
21
|
+
* 클립보드에 텍스트를 복사하는 메서드입니다.
|
|
22
|
+
* 복사 후 재사용 대기 시간이 설정되어 있으면, 일정 시간 후에 복사 가능 상태로 되돌립니다.
|
|
23
|
+
*/
|
|
24
|
+
private copyToClipboard;
|
|
25
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { html, nothing } from 'lit';
|
|
2
|
+
import { property } 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 { UTooltip } from '@iyulab/components/dist/components/tooltip/UTooltip.component.js';
|
|
6
|
+
import { styles } from './UCopyButton.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 UCopyButton extends BaseElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.mode = "symbol";
|
|
21
|
+
this.isCopied = false;
|
|
22
|
+
this.delay = 1e3;
|
|
23
|
+
/**
|
|
24
|
+
* 클립보드에 텍스트를 복사하는 메서드입니다.
|
|
25
|
+
* 복사 후 재사용 대기 시간이 설정되어 있으면, 일정 시간 후에 복사 가능 상태로 되돌립니다.
|
|
26
|
+
*/
|
|
27
|
+
this.copyToClipboard = async () => {
|
|
28
|
+
if (!this.value) return;
|
|
29
|
+
if (this.isCopied) return;
|
|
30
|
+
if (navigator.clipboard) {
|
|
31
|
+
await navigator.clipboard.writeText(this.value);
|
|
32
|
+
} else {
|
|
33
|
+
const area = document.createElement("textarea");
|
|
34
|
+
area.style.position = "fixed";
|
|
35
|
+
area.style.opacity = "0";
|
|
36
|
+
area.style.pointerEvents = "none";
|
|
37
|
+
area.value = this.value;
|
|
38
|
+
document.body.appendChild(area);
|
|
39
|
+
area.focus();
|
|
40
|
+
area.select();
|
|
41
|
+
try {
|
|
42
|
+
document.execCommand("copy");
|
|
43
|
+
} catch (err) {
|
|
44
|
+
console.error("Failed to copy: ", err);
|
|
45
|
+
} finally {
|
|
46
|
+
document.body.removeChild(area);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (this.delay > 0) {
|
|
50
|
+
this.isCopied = true;
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
this.isCopied = false;
|
|
53
|
+
}, this.delay);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
static {
|
|
58
|
+
this.styles = [super.styles, styles];
|
|
59
|
+
}
|
|
60
|
+
static {
|
|
61
|
+
this.dependencies = {
|
|
62
|
+
"u-icon": UIcon,
|
|
63
|
+
"u-tooltip": UTooltip
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
connectedCallback() {
|
|
67
|
+
super.connectedCallback();
|
|
68
|
+
this.addEventListener("click", this.copyToClipboard);
|
|
69
|
+
}
|
|
70
|
+
disconnectedCallback() {
|
|
71
|
+
this.removeEventListener("click", this.copyToClipboard);
|
|
72
|
+
super.disconnectedCallback();
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
if (this.mode === "badge") {
|
|
76
|
+
return html`
|
|
77
|
+
<u-icon lib="internal" name=${this.isCopied ? "check-lg" : "copy"}></u-icon>
|
|
78
|
+
<span class="display">${this.isCopied ? "Copied!" : "Copy"}</span>
|
|
79
|
+
`;
|
|
80
|
+
} else if (this.mode === "symbol") {
|
|
81
|
+
return html`
|
|
82
|
+
<u-icon lib="internal" name=${this.isCopied ? "check-lg" : "copy"}></u-icon>
|
|
83
|
+
<u-tooltip for="u-icon" distance="6">
|
|
84
|
+
${this.isCopied ? "Copied!" : "Copy"}
|
|
85
|
+
</u-tooltip>
|
|
86
|
+
`;
|
|
87
|
+
} else {
|
|
88
|
+
return nothing;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
__decorateClass([
|
|
93
|
+
property({ type: String, reflect: true })
|
|
94
|
+
], UCopyButton.prototype, "mode");
|
|
95
|
+
__decorateClass([
|
|
96
|
+
property({ type: Boolean, reflect: true })
|
|
97
|
+
], UCopyButton.prototype, "isCopied");
|
|
98
|
+
__decorateClass([
|
|
99
|
+
property({ type: String })
|
|
100
|
+
], UCopyButton.prototype, "value");
|
|
101
|
+
__decorateClass([
|
|
102
|
+
property({ type: Number })
|
|
103
|
+
], UCopyButton.prototype, "delay");
|
|
104
|
+
|
|
105
|
+
export { UCopyButton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import('lit').CSSResult;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
position: relative;
|
|
6
|
+
padding: 8px;
|
|
7
|
+
border-radius: 8px;
|
|
8
|
+
font-size: inherit;
|
|
9
|
+
color: inherit;
|
|
10
|
+
background-color: transparent;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
}
|
|
13
|
+
:host(:hover) {
|
|
14
|
+
background-color: var(--u-neutral-100, #f3f4f6);
|
|
15
|
+
}
|
|
16
|
+
:host([isCopied]) {
|
|
17
|
+
pointer-events: none;
|
|
18
|
+
background-color: transparent;
|
|
19
|
+
}
|
|
20
|
+
:host([mode="symbol"]) {
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
}
|
|
23
|
+
:host([mode="badge"]) {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: row;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: 6px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
u-icon {
|
|
31
|
+
font-size: inherit;
|
|
32
|
+
}
|
|
33
|
+
u-icon[name="copy"] {
|
|
34
|
+
color: inherit;
|
|
35
|
+
}
|
|
36
|
+
u-icon[name="check"] {
|
|
37
|
+
color: var(--u-green-500);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.display {
|
|
41
|
+
font-size: inherit;
|
|
42
|
+
color: inherit;
|
|
43
|
+
line-height: 1;
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
export { styles };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
2
|
+
/**
|
|
3
|
+
* 메시지 전송/중단 버튼 컴포넌트입니다.
|
|
4
|
+
*/
|
|
5
|
+
export declare class USendButton extends BaseElement {
|
|
6
|
+
static styles: import('lit').CSSResultGroup[];
|
|
7
|
+
static dependencies: Record<string, typeof BaseElement>;
|
|
8
|
+
/** 로딩 상태 (로딩 중일 때 중단 버튼으로 변경됨) */
|
|
9
|
+
mode: "send" | "stop" | "retry";
|
|
10
|
+
/** 비활성화 상태 */
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { property } 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 { styles } from './USendButton.styles.js';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
+
var result = void 0 ;
|
|
10
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
+
if (decorator = decorators[i])
|
|
12
|
+
result = (decorator(target, key, result) ) || result;
|
|
13
|
+
if (result) __defProp(target, key, result);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
class USendButton extends BaseElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.mode = "send";
|
|
20
|
+
this.disabled = false;
|
|
21
|
+
}
|
|
22
|
+
static {
|
|
23
|
+
this.styles = [super.styles, styles];
|
|
24
|
+
}
|
|
25
|
+
static {
|
|
26
|
+
this.dependencies = {
|
|
27
|
+
"u-icon": UIcon
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
return html`
|
|
32
|
+
<u-icon
|
|
33
|
+
lib="internal"
|
|
34
|
+
name=${this.mode === "send" ? "arrow-up" : this.mode === "stop" ? "ban" : this.mode === "retry" ? "arrow-clockwise" : ""}
|
|
35
|
+
></u-icon>
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
__decorateClass([
|
|
40
|
+
property({ type: String })
|
|
41
|
+
], USendButton.prototype, "mode");
|
|
42
|
+
__decorateClass([
|
|
43
|
+
property({ type: Boolean, reflect: true })
|
|
44
|
+
], USendButton.prototype, "disabled");
|
|
45
|
+
|
|
46
|
+
export { USendButton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import('lit').CSSResult;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
padding: 8px;
|
|
7
|
+
border: none;
|
|
8
|
+
border-radius: 8px;
|
|
9
|
+
font-size: 16px;
|
|
10
|
+
border: 1px solid var(--u-border-color, #d1d5db);
|
|
11
|
+
background-color: var(--u-neutral-200, #e5e7eb);
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
}
|
|
14
|
+
:host(:hover) {
|
|
15
|
+
background-color: var(--u-neutral-300, #d1d5db);
|
|
16
|
+
}
|
|
17
|
+
:host([disabled]) {
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
opacity: 0.5;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export { styles };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
2
|
+
export type ThinkingValue = "low" | "medium" | "high" | "none";
|
|
3
|
+
/**
|
|
4
|
+
* 모델이 추론을 사용하고자 할 때 사용하는 버튼입니다.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UThinkButton extends BaseElement {
|
|
7
|
+
static styles: import('lit').CSSResultGroup[];
|
|
8
|
+
static dependencies: Record<string, typeof BaseElement>;
|
|
9
|
+
private readonly states;
|
|
10
|
+
/** 비활성화 상태 */
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
/** 추론 활성화 값 */
|
|
13
|
+
value: ThinkingValue;
|
|
14
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
15
|
+
/** 현재 추론 상태에 따라 아이콘 이름을 반환합니다. */
|
|
16
|
+
private getIconName;
|
|
17
|
+
/** 현재 추론 상태를 변경합니다. */
|
|
18
|
+
private changeValue;
|
|
19
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { property } 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 { styles } from './UThinkButton.styles.js';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
+
var result = void 0 ;
|
|
10
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
+
if (decorator = decorators[i])
|
|
12
|
+
result = (decorator(target, key, result) ) || result;
|
|
13
|
+
if (result) __defProp(target, key, result);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
class UThinkButton extends BaseElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.states = ["none", "low", "medium", "high"];
|
|
20
|
+
this.disabled = false;
|
|
21
|
+
this.value = "none";
|
|
22
|
+
}
|
|
23
|
+
static {
|
|
24
|
+
this.styles = [super.styles, styles];
|
|
25
|
+
}
|
|
26
|
+
static {
|
|
27
|
+
this.dependencies = {
|
|
28
|
+
"u-icon": UIcon
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
return html`
|
|
33
|
+
<div class="container" @click="${this.changeValue}">
|
|
34
|
+
<u-icon lib="internal" name=${this.getIconName()}></u-icon>
|
|
35
|
+
<div class="indicators">
|
|
36
|
+
<span></span>
|
|
37
|
+
<span></span>
|
|
38
|
+
<span></span>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
`;
|
|
42
|
+
}
|
|
43
|
+
/** 현재 추론 상태에 따라 아이콘 이름을 반환합니다. */
|
|
44
|
+
getIconName() {
|
|
45
|
+
switch (this.value) {
|
|
46
|
+
case "low":
|
|
47
|
+
return "lightbulb";
|
|
48
|
+
case "medium":
|
|
49
|
+
return "lightbulb";
|
|
50
|
+
case "high":
|
|
51
|
+
return "lightbulb-fill";
|
|
52
|
+
default:
|
|
53
|
+
return "lightbulb-off";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** 현재 추론 상태를 변경합니다. */
|
|
57
|
+
changeValue() {
|
|
58
|
+
if (this.disabled) return;
|
|
59
|
+
this.value ||= "none";
|
|
60
|
+
const currentIdx = this.states.indexOf(this.value);
|
|
61
|
+
const nextIdx = (currentIdx + 1) % this.states.length;
|
|
62
|
+
this.value = this.states[nextIdx];
|
|
63
|
+
this.emit("change", this.value);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
__decorateClass([
|
|
67
|
+
property({ type: Boolean, reflect: true })
|
|
68
|
+
], UThinkButton.prototype, "disabled");
|
|
69
|
+
__decorateClass([
|
|
70
|
+
property({ type: String, reflect: true })
|
|
71
|
+
], UThinkButton.prototype, "value");
|
|
72
|
+
|
|
73
|
+
export { UThinkButton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import('lit').CSSResult;
|