@iyulab/chat-components 0.3.0 → 0.5.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 +146 -0
- package/README.md +133 -16
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js +6 -0
- package/dist/_virtual/_glob-assets_raw/intent-prompt.md.1907474e.js +4 -0
- package/dist/_virtual/_glob-assets_raw/view-prompt.md.e0dbcffe.js +4 -0
- package/dist/components/blocks/UCodeBlock.d.ts +24 -2
- package/dist/components/blocks/UCodeBlock.js +65 -2
- package/dist/components/blocks/UCodeBlock.styles.js +10 -4
- package/dist/components/blocks/UFileBlock.d.ts +33 -0
- package/dist/components/blocks/UFileBlock.js +154 -0
- package/dist/components/blocks/UFileBlock.styles.js +128 -0
- package/dist/components/blocks/UJsonBlock.d.ts +44 -2
- package/dist/components/blocks/UJsonBlock.js +128 -3
- package/dist/components/blocks/UJsonBlock.styles.js +4 -4
- package/dist/components/blocks/UMarkedBlock.d.ts +44 -2
- package/dist/components/blocks/UMarkedBlock.js +154 -4
- package/dist/components/blocks/UMarkedBlock.styles.js +4 -4
- package/dist/components/blocks/URefBlock.d.ts +16 -2
- package/dist/components/blocks/URefBlock.js +58 -3
- package/dist/components/blocks/URefBlock.styles.js +4 -4
- package/dist/components/blocks/UTableBlock.d.ts +52 -0
- package/dist/components/blocks/UTableBlock.js +198 -0
- package/dist/components/blocks/UTableBlock.styles.js +133 -0
- package/dist/components/blocks/UTextBlock.d.ts +36 -2
- package/dist/components/blocks/UTextBlock.js +94 -4
- package/dist/components/blocks/UTextBlock.styles.js +4 -4
- package/dist/components/blocks/UThinkBlock.d.ts +30 -2
- package/dist/components/blocks/UThinkBlock.js +86 -4
- package/dist/components/blocks/UThinkBlock.styles.js +4 -4
- package/dist/components/blocks/UToolBlock.d.ts +19 -2
- package/dist/components/blocks/UToolBlock.js +68 -3
- package/dist/components/blocks/UToolBlock.styles.js +4 -4
- package/dist/components/buttons/UAttachButton.d.ts +21 -2
- package/dist/components/buttons/UAttachButton.js +61 -3
- package/dist/components/buttons/UAttachButton.styles.js +4 -4
- package/dist/components/buttons/UCopyButton.d.ts +19 -2
- package/dist/components/buttons/UCopyButton.js +57 -3
- package/dist/components/buttons/UCopyButton.styles.js +4 -4
- package/dist/components/buttons/UVoteButton.d.ts +14 -3
- package/dist/components/buttons/UVoteButton.js +62 -3
- package/dist/components/buttons/UVoteButton.styles.js +4 -4
- package/dist/components/intents/UQuestionIntent.d.ts +22 -0
- package/dist/components/intents/UQuestionIntent.js +41 -0
- package/dist/components/intents/UQuestionIntent.styles.js +43 -0
- package/dist/components/message/UMessage.d.ts +18 -2
- package/dist/components/message/UMessage.js +47 -2
- package/dist/components/message/UMessage.styles.js +42 -15
- package/dist/components/prompt/UPrompt.d.ts +32 -2
- package/dist/components/prompt/UPrompt.js +118 -2
- package/dist/components/prompt/UPrompt.styles.js +43 -5
- package/dist/components/references/URefCard.d.ts +30 -2
- package/dist/components/references/URefCard.js +97 -2
- package/dist/components/references/URefCard.styles.js +4 -4
- package/dist/components/references/URefCardGroup.d.ts +25 -2
- package/dist/components/references/URefCardGroup.js +69 -4
- package/dist/components/references/URefCardGroup.styles.js +4 -4
- package/dist/components/references/URefTag.d.ts +12 -2
- package/dist/components/references/URefTag.js +37 -2
- package/dist/components/references/URefTag.styles.js +4 -4
- package/dist/components/views/UChartView.d.ts +39 -0
- package/dist/components/views/UChartView.js +167 -0
- package/dist/components/views/UChartView.styles.js +86 -0
- package/dist/components/views/UImagesView.d.ts +33 -0
- package/dist/components/views/UImagesView.js +144 -0
- package/dist/components/views/UImagesView.styles.d.ts +1 -0
- package/dist/components/views/UImagesView.styles.js +219 -0
- package/dist/components/views/UMapView.d.ts +24 -0
- package/dist/components/views/UMapView.js +45 -0
- package/dist/components/views/UMapView.styles.d.ts +1 -0
- package/dist/components/views/UMapView.styles.js +47 -0
- package/dist/components/views/UVideoView.d.ts +25 -0
- package/dist/components/views/UVideoView.js +81 -0
- package/dist/components/views/UVideoView.styles.d.ts +1 -0
- package/dist/components/views/UVideoView.styles.js +36 -0
- package/dist/components/views/UView.d.ts +46 -0
- package/dist/components/views/UView.js +113 -0
- package/dist/components/views/UView.styles.d.ts +1 -0
- package/dist/components/views/UView.styles.js +33 -0
- package/dist/events/AttachEvent.d.ts +9 -0
- package/dist/events/ChoiceEvent.d.ts +9 -0
- package/dist/events/SendEvent.d.ts +7 -0
- package/dist/events/StopEvent.d.ts +7 -0
- package/dist/index.d.ts +15 -6
- package/dist/index.js +28 -38
- package/dist/react/UAttachButton.d.ts +11 -0
- package/dist/react/UAttachButton.js +12 -0
- package/dist/react/UChartView.d.ts +9 -0
- package/dist/react/UChartView.js +10 -0
- package/dist/react/UCodeBlock.d.ts +9 -0
- package/dist/react/UCodeBlock.js +10 -0
- package/dist/react/UCopyButton.d.ts +9 -0
- package/dist/react/UCopyButton.js +10 -0
- package/dist/react/UFileBlock.d.ts +11 -0
- package/dist/react/UFileBlock.js +12 -0
- package/dist/react/UImagesView.d.ts +9 -0
- package/dist/react/UImagesView.js +10 -0
- package/dist/react/UJsonBlock.d.ts +9 -0
- package/dist/react/UJsonBlock.js +10 -0
- package/dist/react/UMapView.d.ts +9 -0
- package/dist/react/UMapView.js +10 -0
- package/dist/react/UMarkedBlock.d.ts +9 -0
- package/dist/react/UMarkedBlock.js +10 -0
- package/dist/react/UMessage.d.ts +9 -0
- package/dist/react/UMessage.js +10 -0
- package/dist/react/UPrompt.d.ts +13 -0
- package/dist/react/UPrompt.js +13 -0
- package/dist/react/UQuestionIntent.d.ts +11 -0
- package/dist/react/UQuestionIntent.js +12 -0
- package/dist/react/URefBlock.d.ts +9 -0
- package/dist/react/URefBlock.js +10 -0
- package/dist/react/URefCard.d.ts +9 -0
- package/dist/react/URefCard.js +10 -0
- package/dist/react/URefCardGroup.d.ts +9 -0
- package/dist/react/URefCardGroup.js +10 -0
- package/dist/react/URefTag.d.ts +9 -0
- package/dist/react/URefTag.js +10 -0
- package/dist/react/UTableBlock.d.ts +9 -0
- package/dist/react/UTableBlock.js +10 -0
- package/dist/react/UTextBlock.d.ts +9 -0
- package/dist/react/UTextBlock.js +10 -0
- package/dist/react/UThinkBlock.d.ts +9 -0
- package/dist/react/UThinkBlock.js +10 -0
- package/dist/react/UToolBlock.d.ts +9 -0
- package/dist/react/UToolBlock.js +10 -0
- package/dist/react/UVideoView.d.ts +9 -0
- package/dist/react/UVideoView.js +10 -0
- package/dist/react/UView.d.ts +9 -0
- package/dist/react/UView.js +10 -0
- package/dist/react/UVoteButton.d.ts +9 -0
- package/dist/react/UVoteButton.js +10 -0
- package/dist/react/index.d.ts +23 -0
- package/dist/react/index.js +23 -0
- package/dist/types/BlockItem.d.ts +21 -1
- package/dist/types/Intents.d.ts +26 -0
- package/dist/types/Intents.js +30 -0
- package/dist/types/JsonSchema.d.ts +59 -0
- package/dist/types/Views.d.ts +34 -0
- package/dist/types/Views.js +150 -0
- package/dist/utilities/IntentPromptBuilder.d.ts +40 -0
- package/dist/utilities/IntentPromptBuilder.js +95 -0
- package/dist/utilities/ViewPromptBuilder.d.ts +28 -0
- package/dist/utilities/ViewPromptBuilder.js +76 -0
- package/dist/utilities/dom-agent/DOMAgent.d.ts +74 -0
- package/dist/utilities/dom-agent/DOMController.d.ts +78 -0
- package/dist/utilities/dom-agent/DOMPromptBuilder.d.ts +54 -0
- package/dist/utilities/dom-agent/DOMScanner.d.ts +83 -0
- package/dist/utilities/dom-agent/index.d.ts +9 -0
- package/dist/utilities/dom-agent/types.d.ts +209 -0
- package/package.json +34 -18
- package/dist/components/blocks/UCodeBlock.component.d.ts +0 -23
- package/dist/components/blocks/UCodeBlock.component.js +0 -76
- package/dist/components/blocks/UJsonBlock.component.d.ts +0 -45
- package/dist/components/blocks/UJsonBlock.component.js +0 -140
- package/dist/components/blocks/UMarkedBlock.component.d.ts +0 -45
- package/dist/components/blocks/UMarkedBlock.component.js +0 -129
- package/dist/components/blocks/URefBlock.component.d.ts +0 -17
- package/dist/components/blocks/URefBlock.component.js +0 -74
- package/dist/components/blocks/UTextBlock.component.d.ts +0 -37
- package/dist/components/blocks/UTextBlock.component.js +0 -123
- package/dist/components/blocks/UThinkBlock.component.d.ts +0 -23
- package/dist/components/blocks/UThinkBlock.component.js +0 -90
- package/dist/components/blocks/UToolBlock.component.d.ts +0 -20
- package/dist/components/blocks/UToolBlock.component.js +0 -80
- package/dist/components/buttons/UAttachButton.component.d.ts +0 -22
- package/dist/components/buttons/UAttachButton.component.js +0 -89
- package/dist/components/buttons/UCopyButton.component.d.ts +0 -20
- package/dist/components/buttons/UCopyButton.component.js +0 -81
- package/dist/components/buttons/UReportButton.component.d.ts +0 -9
- package/dist/components/buttons/UReportButton.component.js +0 -36
- package/dist/components/buttons/UReportButton.d.ts +0 -7
- package/dist/components/buttons/UReportButton.js +0 -5
- package/dist/components/buttons/UReportButton.styles.js +0 -14
- package/dist/components/buttons/URetryButton.component.d.ts +0 -11
- package/dist/components/buttons/URetryButton.component.js +0 -53
- package/dist/components/buttons/URetryButton.d.ts +0 -7
- package/dist/components/buttons/URetryButton.js +0 -5
- package/dist/components/buttons/URetryButton.styles.js +0 -26
- package/dist/components/buttons/UShareButton.component.d.ts +0 -9
- package/dist/components/buttons/UShareButton.component.js +0 -36
- package/dist/components/buttons/UShareButton.d.ts +0 -7
- package/dist/components/buttons/UShareButton.js +0 -5
- package/dist/components/buttons/UShareButton.styles.js +0 -14
- package/dist/components/buttons/UVoteButton.component.d.ts +0 -15
- package/dist/components/buttons/UVoteButton.component.js +0 -70
- package/dist/components/loaders/UDotLoader.component.d.ts +0 -9
- package/dist/components/loaders/UDotLoader.component.js +0 -23
- package/dist/components/loaders/UDotLoader.d.ts +0 -7
- package/dist/components/loaders/UDotLoader.js +0 -5
- package/dist/components/loaders/UDotLoader.styles.js +0 -50
- package/dist/components/message/UMessage.component.d.ts +0 -19
- package/dist/components/message/UMessage.component.js +0 -90
- package/dist/components/prompt/UPrompt.component.d.ts +0 -25
- package/dist/components/prompt/UPrompt.component.js +0 -113
- package/dist/components/references/URefCard.component.d.ts +0 -24
- package/dist/components/references/URefCard.component.js +0 -105
- package/dist/components/references/URefCardGroup.component.d.ts +0 -25
- package/dist/components/references/URefCardGroup.component.js +0 -88
- package/dist/components/references/URefTag.component.d.ts +0 -13
- package/dist/components/references/URefTag.component.js +0 -54
- package/dist/events/UCancelEvent.d.ts +0 -6
- package/dist/events/USubmitEvent.d.ts +0 -6
- package/dist/utilities/converters.d.ts +0 -9
- package/dist/utilities/converters.js +0 -19
- /package/dist/components/{buttons/UReportButton.styles.d.ts → blocks/UFileBlock.styles.d.ts} +0 -0
- /package/dist/components/{buttons/URetryButton.styles.d.ts → blocks/UTableBlock.styles.d.ts} +0 -0
- /package/dist/components/{buttons/UShareButton.styles.d.ts → intents/UQuestionIntent.styles.d.ts} +0 -0
- /package/dist/components/{loaders/UDotLoader.styles.d.ts → views/UChartView.styles.d.ts} +0 -0
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import { css } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
//#region src/components/message/UMessage.styles.ts
|
|
3
|
+
var styles = css`
|
|
4
4
|
:host {
|
|
5
|
+
width: auto;
|
|
6
|
+
max-width: 100%;
|
|
5
7
|
display: flex;
|
|
6
8
|
flex-direction: column;
|
|
7
9
|
}
|
|
8
|
-
:host([variant="default"]) {
|
|
9
|
-
width: 100%;
|
|
10
|
-
}
|
|
11
|
-
:host([variant="bubble"]) {
|
|
12
|
-
width: auto;
|
|
13
|
-
min-width: 40px;
|
|
14
|
-
max-width: 80%;
|
|
15
|
-
}
|
|
16
10
|
:host([position="left"]) {
|
|
17
11
|
align-self: flex-start;
|
|
18
12
|
align-items: flex-start;
|
|
@@ -44,10 +38,43 @@ const styles = css`
|
|
|
44
38
|
border-bottom-right-radius: 4px;
|
|
45
39
|
}
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
.dot-loader {
|
|
42
|
+
width: 24px;
|
|
43
|
+
height: 24px;
|
|
44
|
+
fill: var(--u-neutral-800, #6b7280);
|
|
45
|
+
}
|
|
46
|
+
.dot-loader circle {
|
|
47
|
+
animation: bounce 1.05s infinite;
|
|
48
|
+
transform-box: fill-box;
|
|
49
|
+
transform-origin: center;
|
|
50
|
+
}
|
|
51
|
+
.dot-loader circle.d1 {
|
|
52
|
+
animation-delay: 0.1s;
|
|
53
|
+
}
|
|
54
|
+
.dot-loader circle.d2 {
|
|
55
|
+
animation-delay: 0.2s;
|
|
50
56
|
}
|
|
51
|
-
`;
|
|
52
57
|
|
|
58
|
+
@media (prefers-reduced-motion: reduce) {
|
|
59
|
+
.dot-loader circle {
|
|
60
|
+
animation: none;
|
|
61
|
+
transform: none;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@keyframes bounce {
|
|
66
|
+
0%,57.14% {
|
|
67
|
+
animation-timing-function: cubic-bezier(0.33, 0.66, 0.66, 1);
|
|
68
|
+
transform: translateY(0);
|
|
69
|
+
}
|
|
70
|
+
28.57% {
|
|
71
|
+
animation-timing-function: cubic-bezier(0.33, 0, 0.66, 0.33);
|
|
72
|
+
transform: translateY(-6px);
|
|
73
|
+
}
|
|
74
|
+
100% {
|
|
75
|
+
transform: translateY(0);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
//#endregion
|
|
53
80
|
export { styles };
|
|
@@ -1,7 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
2
|
+
import { FileBlockItem } from '../../types/BlockItem.js';
|
|
3
|
+
/**
|
|
4
|
+
* 채팅 입력 컴포넌트입니다.
|
|
5
|
+
* 텍스트 입력 영역과 우측에 액션 버튼을 배치할 수 있는 슬롯을 제공합니다.
|
|
6
|
+
*/
|
|
7
|
+
export declare class UPrompt extends UElement {
|
|
8
|
+
static styles: import('lit').CSSResultGroup[];
|
|
9
|
+
/** 로딩 상태 여부 */
|
|
10
|
+
loading: boolean;
|
|
11
|
+
/** 최소 행 수 */
|
|
12
|
+
minRows: number;
|
|
13
|
+
/** 최대 행 수 */
|
|
14
|
+
maxRows: number;
|
|
15
|
+
/** 입력 필드의 플레이스홀더 텍스트 */
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/** 입력 필드의 값 */
|
|
18
|
+
value?: string;
|
|
19
|
+
/** 입력 첨부 파일 목록 */
|
|
20
|
+
files?: FileBlockItem[];
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
23
|
+
/**
|
|
24
|
+
* 입력된 텍스트와 첨부 파일을 제출하거나, 로딩 중인 경우 취소 이벤트를 발생시킵니다.
|
|
25
|
+
* 텍스트 또는 첨부 파일이 없는 경우에는 아무런 동작도 하지 않습니다.
|
|
26
|
+
*/
|
|
27
|
+
submit(): void;
|
|
28
|
+
private handleRemoveFile;
|
|
29
|
+
private handleTextBlockInput;
|
|
30
|
+
private handleTextBlockKeydown;
|
|
31
|
+
private handleSendButtonClick;
|
|
32
|
+
}
|
|
2
33
|
declare global {
|
|
3
34
|
interface HTMLElementTagNameMap {
|
|
4
35
|
"u-prompt": UPrompt;
|
|
5
36
|
}
|
|
6
37
|
}
|
|
7
|
-
export { UPrompt };
|
|
@@ -1,5 +1,121 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js";
|
|
2
|
+
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js";
|
|
3
|
+
import "../blocks/UFileBlock.js";
|
|
4
|
+
import { styles } from "./UPrompt.styles.js";
|
|
5
|
+
import { html } from "lit";
|
|
6
|
+
import { customElement, property } from "lit/decorators.js";
|
|
7
|
+
import "@iyulab/components/dist/components/icon/UIcon.js";
|
|
8
|
+
import "@iyulab/components/dist/components/button/UButton.js";
|
|
9
|
+
import { UElement } from "@iyulab/components/dist/components/UElement.js";
|
|
10
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
11
|
+
//#region src/components/prompt/UPrompt.ts
|
|
12
|
+
var UPrompt = class UPrompt extends UElement {
|
|
13
|
+
constructor(..._args) {
|
|
14
|
+
super(..._args);
|
|
15
|
+
this.loading = false;
|
|
16
|
+
this.minRows = 1;
|
|
17
|
+
this.maxRows = 10;
|
|
18
|
+
this.handleSendButtonClick = (e) => {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
this.submit();
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
static {
|
|
25
|
+
this.styles = [super.styles, styles];
|
|
26
|
+
}
|
|
27
|
+
connectedCallback() {
|
|
28
|
+
super.connectedCallback();
|
|
29
|
+
this.setAttribute("tabindex", "0");
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
return html`
|
|
33
|
+
<slot name="header"></slot>
|
|
2
34
|
|
|
3
|
-
|
|
35
|
+
<div class="files" part="files"
|
|
36
|
+
?hidden=${!this.files || this.files.length === 0}>
|
|
37
|
+
${repeat(this.files || [], (_, i) => i, (file, index) => html`
|
|
38
|
+
<u-file-block
|
|
39
|
+
data-index=${index}
|
|
40
|
+
.removable=${true}
|
|
41
|
+
.status=${file.status}
|
|
42
|
+
.name=${file.name}
|
|
43
|
+
.type=${file.mimeType}
|
|
44
|
+
.size=${file.size}
|
|
45
|
+
@remove=${this.handleRemoveFile}
|
|
46
|
+
></u-file-block>
|
|
47
|
+
`)}
|
|
48
|
+
</div>
|
|
4
49
|
|
|
50
|
+
<u-text-block class="input" part="input"
|
|
51
|
+
.editable=${true}
|
|
52
|
+
.minRows=${this.minRows}
|
|
53
|
+
.maxRows=${this.maxRows}
|
|
54
|
+
.value=${this.value}
|
|
55
|
+
.placeholder=${this.placeholder}
|
|
56
|
+
@input=${this.handleTextBlockInput}
|
|
57
|
+
@keydown=${this.handleTextBlockKeydown}
|
|
58
|
+
></u-text-block>
|
|
59
|
+
|
|
60
|
+
<div class="control" part="control">
|
|
61
|
+
<slot name="left-actions"></slot>
|
|
62
|
+
<div style="flex: 1;"></div>
|
|
63
|
+
<slot name="right-actions"></slot>
|
|
64
|
+
|
|
65
|
+
<u-button class="send-btn" part="send-btn"
|
|
66
|
+
?disabled=${!this.loading && !this.value}
|
|
67
|
+
@click=${this.handleSendButtonClick}>
|
|
68
|
+
<u-icon
|
|
69
|
+
lib="bootstrap"
|
|
70
|
+
name=${this.loading ? "stop-circle" : "arrow-up"}
|
|
71
|
+
></u-icon>
|
|
72
|
+
</u-button>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<slot name="footer"></slot>
|
|
76
|
+
`;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 입력된 텍스트와 첨부 파일을 제출하거나, 로딩 중인 경우 취소 이벤트를 발생시킵니다.
|
|
80
|
+
* 텍스트 또는 첨부 파일이 없는 경우에는 아무런 동작도 하지 않습니다.
|
|
81
|
+
*/
|
|
82
|
+
submit() {
|
|
83
|
+
if (this.loading) {
|
|
84
|
+
this.fire("stop");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const hasValue = this.value && this.value.trim() !== "";
|
|
88
|
+
const hasFiles = this.files && this.files.length > 0;
|
|
89
|
+
if (hasValue || hasFiles) this.fire("send");
|
|
90
|
+
}
|
|
91
|
+
handleRemoveFile(e) {
|
|
92
|
+
e.stopPropagation();
|
|
93
|
+
const index = e.target.dataset.index;
|
|
94
|
+
if (index !== void 0 && this.files) {
|
|
95
|
+
this.files = this.files.filter((_, i) => i !== Number(index));
|
|
96
|
+
this.relay(e);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
handleTextBlockInput(e) {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
this.value = e.target.value;
|
|
102
|
+
}
|
|
103
|
+
handleTextBlockKeydown(e) {
|
|
104
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
this.submit();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
__decorate([property({
|
|
111
|
+
type: Boolean,
|
|
112
|
+
reflect: true
|
|
113
|
+
}), __decorateMetadata("design:type", Boolean)], UPrompt.prototype, "loading", void 0);
|
|
114
|
+
__decorate([property({ type: Number }), __decorateMetadata("design:type", Number)], UPrompt.prototype, "minRows", void 0);
|
|
115
|
+
__decorate([property({ type: Number }), __decorateMetadata("design:type", Number)], UPrompt.prototype, "maxRows", void 0);
|
|
116
|
+
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], UPrompt.prototype, "placeholder", void 0);
|
|
117
|
+
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], UPrompt.prototype, "value", void 0);
|
|
118
|
+
__decorate([property({ type: Array }), __decorateMetadata("design:type", Array)], UPrompt.prototype, "files", void 0);
|
|
119
|
+
UPrompt = __decorate([customElement("u-prompt")], UPrompt);
|
|
120
|
+
//#endregion
|
|
5
121
|
export { UPrompt };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { css } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
//#region src/components/prompt/UPrompt.styles.ts
|
|
3
|
+
var styles = css`
|
|
4
4
|
:host {
|
|
5
|
+
position: relative;
|
|
5
6
|
display: flex;
|
|
6
7
|
flex-direction: column;
|
|
7
8
|
padding: 12px;
|
|
@@ -14,8 +15,40 @@ const styles = css`
|
|
|
14
15
|
border-color: var(--u-neutral-400, #9ca3af);
|
|
15
16
|
box-shadow: 0 0 0 1px var(--u-neutral-200, #9ca3af);
|
|
16
17
|
}
|
|
18
|
+
:host([loading])::before {
|
|
19
|
+
content: '';
|
|
20
|
+
position: absolute;
|
|
21
|
+
inset: -2px;
|
|
22
|
+
border-radius: 10px;
|
|
23
|
+
padding: 2px;
|
|
24
|
+
background: linear-gradient(90deg,
|
|
25
|
+
transparent 0%,
|
|
26
|
+
transparent 25%,
|
|
27
|
+
#f9a8d4 45%,
|
|
28
|
+
#fbbf24 55%,
|
|
29
|
+
transparent 75%,
|
|
30
|
+
transparent 100%
|
|
31
|
+
);
|
|
32
|
+
background-size: 300% 100%;
|
|
33
|
+
animation: border-shimmer 2s linear infinite;
|
|
34
|
+
-webkit-mask:
|
|
35
|
+
linear-gradient(#fff 0 0) content-box,
|
|
36
|
+
linear-gradient(#fff 0 0);
|
|
37
|
+
-webkit-mask-composite: xor;
|
|
38
|
+
mask-composite: exclude;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.files {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-wrap: wrap;
|
|
44
|
+
gap: 8px;
|
|
45
|
+
margin-bottom: 8px;
|
|
46
|
+
}
|
|
47
|
+
.files u-file-block {
|
|
48
|
+
flex: 0 1 auto;
|
|
49
|
+
}
|
|
17
50
|
|
|
18
|
-
|
|
51
|
+
.input {
|
|
19
52
|
flex: 1;
|
|
20
53
|
padding: 8px;
|
|
21
54
|
}
|
|
@@ -37,6 +70,11 @@ const styles = css`
|
|
|
37
70
|
opacity: 0.5;
|
|
38
71
|
cursor: not-allowed;
|
|
39
72
|
}
|
|
40
|
-
`;
|
|
41
73
|
|
|
74
|
+
@keyframes border-shimmer {
|
|
75
|
+
0% { background-position: 100% 0; }
|
|
76
|
+
100% { background-position: 0% 0; }
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
//#endregion
|
|
42
80
|
export { styles };
|
|
@@ -1,7 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UDataElement } from '@iyulab/components/dist/components/UDataElement.js';
|
|
2
|
+
/**
|
|
3
|
+
* 참조 소스를 카드 형태로 표시하는 공통 컴포넌트입니다.
|
|
4
|
+
* Web과 Document 타입 모두 지원합니다.
|
|
5
|
+
*/
|
|
6
|
+
export declare class URefCard extends UDataElement {
|
|
7
|
+
static styles: (import('lit').CSSResult | import('lit').CSSResultGroup[])[];
|
|
8
|
+
/** 카드 타입 (web 또는 document) */
|
|
9
|
+
type: 'web' | 'document';
|
|
10
|
+
/** 외부 링크 URL */
|
|
11
|
+
url?: string;
|
|
12
|
+
/** 카드 타이틀 */
|
|
13
|
+
title: string;
|
|
14
|
+
/** 카드 본문 스니펫 */
|
|
15
|
+
snippet?: string;
|
|
16
|
+
/** 태그 목록 */
|
|
17
|
+
tags?: string[];
|
|
18
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
19
|
+
/**
|
|
20
|
+
* UDataElement의 기본 동작을 오버라이드하여 에러를 처리합니다.
|
|
21
|
+
* 콘솔 출력만 수행합니다.
|
|
22
|
+
*/
|
|
23
|
+
protected error(error: unknown): Promise<void>;
|
|
24
|
+
/** 링크 클릭 핸들러 */
|
|
25
|
+
private handleAnchorClick;
|
|
26
|
+
/** URL에서 Google의 파비콘 URL을 반환합니다. */
|
|
27
|
+
private getFaviconUrl;
|
|
28
|
+
/** URL에서 도메인 사이트 주소를 반환합니다. */
|
|
29
|
+
private getDomainName;
|
|
30
|
+
}
|
|
2
31
|
declare global {
|
|
3
32
|
interface HTMLElementTagNameMap {
|
|
4
33
|
"u-ref-card": URefCard;
|
|
5
34
|
}
|
|
6
35
|
}
|
|
7
|
-
export { URefCard };
|
|
@@ -1,5 +1,100 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js";
|
|
2
|
+
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js";
|
|
3
|
+
import { styles } from "./URefCard.styles.js";
|
|
4
|
+
import { html } from "lit";
|
|
5
|
+
import { customElement, property } from "lit/decorators.js";
|
|
6
|
+
import "@iyulab/components/dist/components/icon/UIcon.js";
|
|
7
|
+
import { arrayAttrConverter } from "@iyulab/components/dist/utilities/converters.js";
|
|
8
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
9
|
+
import { UDataElement } from "@iyulab/components/dist/components/UDataElement.js";
|
|
10
|
+
//#region src/components/references/URefCard.ts
|
|
11
|
+
var URefCard = class URefCard extends UDataElement {
|
|
12
|
+
constructor(..._args) {
|
|
13
|
+
super(..._args);
|
|
14
|
+
this.type = "web";
|
|
15
|
+
this.title = "";
|
|
16
|
+
}
|
|
17
|
+
static {
|
|
18
|
+
this.styles = [super.styles, styles];
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
return html`
|
|
22
|
+
<a href="${ifDefined(this.url)}" target="_blank" rel="noopener noreferrer"
|
|
23
|
+
@click=${this.handleAnchorClick}>
|
|
24
|
+
<div class="header">
|
|
25
|
+
<img class="favicon"
|
|
26
|
+
src="${this.getFaviconUrl(this.url)}"
|
|
27
|
+
alt="favicon"
|
|
28
|
+
/>
|
|
29
|
+
<div class="title">
|
|
30
|
+
${this.title || this.getDomainName(this.url)}
|
|
31
|
+
</div>
|
|
2
32
|
|
|
3
|
-
|
|
33
|
+
<div style="flex: 1;"></div>
|
|
4
34
|
|
|
35
|
+
<div class="badge" type=${this.type}>
|
|
36
|
+
<u-icon
|
|
37
|
+
lib="bootstrap"
|
|
38
|
+
name=${this.type === "web" ? "globe" : "file-earmark"}
|
|
39
|
+
></u-icon>
|
|
40
|
+
${this.type.toUpperCase()}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div class="body">
|
|
45
|
+
${this.snippet}
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div class="footer" ?hidden=${!this.tags || this.tags.length === 0}>
|
|
49
|
+
${this.tags?.map((tag) => html`<span class="tag">${tag}</span>`)}
|
|
50
|
+
</div>
|
|
51
|
+
</a>
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* UDataElement의 기본 동작을 오버라이드하여 에러를 처리합니다.
|
|
56
|
+
* 콘솔 출력만 수행합니다.
|
|
57
|
+
*/
|
|
58
|
+
error(error) {
|
|
59
|
+
return Promise.resolve(console.error("Error in URefCard:", error));
|
|
60
|
+
}
|
|
61
|
+
/** 링크 클릭 핸들러 */
|
|
62
|
+
handleAnchorClick(e) {
|
|
63
|
+
if (!this.url) {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** URL에서 Google의 파비콘 URL을 반환합니다. */
|
|
69
|
+
getFaviconUrl(url) {
|
|
70
|
+
if (!url) return `/favicon.ico`;
|
|
71
|
+
try {
|
|
72
|
+
return `https://www.google.com/s2/favicons?sz=64&domain=${new URL(url).hostname}`;
|
|
73
|
+
} catch {
|
|
74
|
+
return `/favicon.ico`;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** URL에서 도메인 사이트 주소를 반환합니다. */
|
|
78
|
+
getDomainName(url) {
|
|
79
|
+
if (!url) return "";
|
|
80
|
+
try {
|
|
81
|
+
return new URL(url).hostname;
|
|
82
|
+
} catch {
|
|
83
|
+
return "";
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
__decorate([property({
|
|
88
|
+
type: String,
|
|
89
|
+
reflect: true
|
|
90
|
+
}), __decorateMetadata("design:type", String)], URefCard.prototype, "type", void 0);
|
|
91
|
+
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], URefCard.prototype, "url", void 0);
|
|
92
|
+
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], URefCard.prototype, "title", void 0);
|
|
93
|
+
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], URefCard.prototype, "snippet", void 0);
|
|
94
|
+
__decorate([property({
|
|
95
|
+
type: Array,
|
|
96
|
+
converter: arrayAttrConverter((v) => v)
|
|
97
|
+
}), __decorateMetadata("design:type", Array)], URefCard.prototype, "tags", void 0);
|
|
98
|
+
URefCard = __decorate([customElement("u-ref-card")], URefCard);
|
|
99
|
+
//#endregion
|
|
5
100
|
export { URefCard };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { css } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
//#region src/components/references/URefCard.styles.ts
|
|
3
|
+
var styles = css`
|
|
4
4
|
:host {
|
|
5
5
|
display: block;
|
|
6
6
|
width: 380px;
|
|
@@ -99,5 +99,5 @@ const styles = css`
|
|
|
99
99
|
white-space: nowrap;
|
|
100
100
|
}
|
|
101
101
|
`;
|
|
102
|
-
|
|
102
|
+
//#endregion
|
|
103
103
|
export { styles };
|
|
@@ -1,7 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
2
|
+
import { URefCard } from './URefCard.js';
|
|
3
|
+
/**
|
|
4
|
+
* 여러 참조 카드를 그룹으로 표시하는 컴포넌트입니다.
|
|
5
|
+
* 페이지네이션 기능을 제공하여 각 카드를 하나씩 탐색할 수 있습니다.
|
|
6
|
+
* 카드가 1개 이하인 경우 페이지네이션 UI는 자동으로 숨겨집니다.
|
|
7
|
+
*/
|
|
8
|
+
export declare class URefCardGroup extends UElement {
|
|
9
|
+
static styles: import('lit').CSSResultGroup[];
|
|
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
|
+
}
|
|
2
26
|
declare global {
|
|
3
27
|
interface HTMLElementTagNameMap {
|
|
4
28
|
"u-ref-card-group": URefCardGroup;
|
|
5
29
|
}
|
|
6
30
|
}
|
|
7
|
-
export { URefCardGroup };
|
|
@@ -1,5 +1,70 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js";
|
|
2
|
+
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js";
|
|
3
|
+
import { URefCard } from "./URefCard.js";
|
|
4
|
+
import { styles } from "./URefCardGroup.styles.js";
|
|
5
|
+
import { html } from "lit";
|
|
6
|
+
import { customElement, state } from "lit/decorators.js";
|
|
7
|
+
import "@iyulab/components/dist/components/icon/UIcon.js";
|
|
8
|
+
import { UElement } from "@iyulab/components/dist/components/UElement.js";
|
|
9
|
+
//#region src/components/references/URefCardGroup.ts
|
|
10
|
+
var URefCardGroup = class URefCardGroup extends UElement {
|
|
11
|
+
constructor(..._args) {
|
|
12
|
+
super(..._args);
|
|
13
|
+
this.cards = [];
|
|
14
|
+
this.currentIndex = 0;
|
|
15
|
+
}
|
|
16
|
+
static {
|
|
17
|
+
this.styles = [super.styles, styles];
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
20
|
+
return html`
|
|
21
|
+
<div class="header" ?hidden=${this.cards.length <= 1}>
|
|
22
|
+
<button class="nav-button"
|
|
23
|
+
@click=${this.handlePreviousButtonClick}>
|
|
24
|
+
<u-icon lib="internal" name="chevron-left"></u-icon>
|
|
25
|
+
</button>
|
|
26
|
+
|
|
27
|
+
<span class="page-indicator">
|
|
28
|
+
${this.currentIndex + 1} / ${this.cards.length}
|
|
29
|
+
</span>
|
|
30
|
+
|
|
31
|
+
<button class="nav-button"
|
|
32
|
+
@click=${this.handleNextButtonClick}>
|
|
33
|
+
<u-icon lib="internal" name="chevron-right"></u-icon>
|
|
34
|
+
</button>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div class="viewport">
|
|
38
|
+
<div class="track" style=${`transform: translateX(-${this.currentIndex * 100}%);`}>
|
|
39
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 해당하는 인덱스에 해당하는 카드로 변경합니다.
|
|
46
|
+
*/
|
|
47
|
+
switch(index) {
|
|
48
|
+
const len = this.cards.length;
|
|
49
|
+
if (len === 0) return;
|
|
50
|
+
this.currentIndex = index < 0 ? len - 1 : index >= len ? 0 : index;
|
|
51
|
+
}
|
|
52
|
+
/** 이전 카드로 이동합니다. */
|
|
53
|
+
handlePreviousButtonClick() {
|
|
54
|
+
this.switch(this.currentIndex - 1);
|
|
55
|
+
}
|
|
56
|
+
/** 다음 카드로 이동합니다. */
|
|
57
|
+
handleNextButtonClick() {
|
|
58
|
+
this.switch(this.currentIndex + 1);
|
|
59
|
+
}
|
|
60
|
+
/** slot 내용이 변경될 때 호출됩니다. */
|
|
61
|
+
handleSlotChange(e) {
|
|
62
|
+
this.cards = e.target.assignedElements({ flatten: true }).filter((el) => el instanceof URefCard);
|
|
63
|
+
this.switch(0);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
__decorate([state(), __decorateMetadata("design:type", Array)], URefCardGroup.prototype, "cards", void 0);
|
|
67
|
+
__decorate([state(), __decorateMetadata("design:type", Number)], URefCardGroup.prototype, "currentIndex", void 0);
|
|
68
|
+
URefCardGroup = __decorate([customElement("u-ref-card-group")], URefCardGroup);
|
|
69
|
+
//#endregion
|
|
5
70
|
export { URefCardGroup };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { css } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
//#region src/components/references/URefCardGroup.styles.ts
|
|
3
|
+
var styles = css`
|
|
4
4
|
:host {
|
|
5
5
|
display: flex;
|
|
6
6
|
flex-direction: column;
|
|
@@ -65,5 +65,5 @@ const styles = css`
|
|
|
65
65
|
border: none;
|
|
66
66
|
}
|
|
67
67
|
`;
|
|
68
|
-
|
|
68
|
+
//#endregion
|
|
69
69
|
export { styles };
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
2
|
+
/**
|
|
3
|
+
* 인용 태그 컴포넌트입니다.
|
|
4
|
+
*/
|
|
5
|
+
export declare class URefTag extends UElement {
|
|
6
|
+
static styles: import('lit').CSSResultGroup[];
|
|
7
|
+
/** 인용 출처 소스 데이터 */
|
|
8
|
+
href?: string;
|
|
9
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
10
|
+
/** 링크 클릭 핸들러 */
|
|
11
|
+
private handleAnchorClick;
|
|
12
|
+
}
|
|
2
13
|
declare global {
|
|
3
14
|
interface HTMLElementTagNameMap {
|
|
4
15
|
'u-ref-tag': URefTag;
|
|
5
16
|
}
|
|
6
17
|
}
|
|
7
|
-
export { URefTag };
|
|
@@ -1,5 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js";
|
|
2
|
+
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js";
|
|
3
|
+
import { styles } from "./URefTag.styles.js";
|
|
4
|
+
import { html } from "lit";
|
|
5
|
+
import { customElement, property } from "lit/decorators.js";
|
|
6
|
+
import "@iyulab/components/dist/components/icon/UIcon.js";
|
|
7
|
+
import "@iyulab/components/dist/components/tooltip/UTooltip.js";
|
|
8
|
+
import { UElement } from "@iyulab/components/dist/components/UElement.js";
|
|
9
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
|
+
//#region src/components/references/URefTag.ts
|
|
11
|
+
var URefTag = class URefTag extends UElement {
|
|
12
|
+
static {
|
|
13
|
+
this.styles = [super.styles, styles];
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
return html`
|
|
17
|
+
<a href="${ifDefined(this.href)}" target="_blank" rel="noopener noreferrer"
|
|
18
|
+
@click=${this.handleAnchorClick}>
|
|
19
|
+
<slot></slot>
|
|
20
|
+
</a>
|
|
2
21
|
|
|
3
|
-
|
|
22
|
+
<u-icon lib="bootstrap" name="box-arrow-up-right"></u-icon>
|
|
4
23
|
|
|
24
|
+
<u-tooltip interactive placement="bottom" distance="4">
|
|
25
|
+
<slot name="tooltip"></slot>
|
|
26
|
+
</u-tooltip>
|
|
27
|
+
`;
|
|
28
|
+
}
|
|
29
|
+
/** 링크 클릭 핸들러 */
|
|
30
|
+
handleAnchorClick(e) {
|
|
31
|
+
if (!this.href) {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
e.stopPropagation();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], URefTag.prototype, "href", void 0);
|
|
38
|
+
URefTag = __decorate([customElement("u-ref-tag")], URefTag);
|
|
39
|
+
//#endregion
|
|
5
40
|
export { URefTag };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { css } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
//#region src/components/references/URefTag.styles.ts
|
|
3
|
+
var styles = css`
|
|
4
4
|
:host {
|
|
5
5
|
display: inline-flex;
|
|
6
6
|
flex-direction: row;
|
|
@@ -47,5 +47,5 @@ const styles = css`
|
|
|
47
47
|
opacity: 1;
|
|
48
48
|
}
|
|
49
49
|
`;
|
|
50
|
-
|
|
50
|
+
//#endregion
|
|
51
51
|
export { styles };
|