@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,9 +0,0 @@
|
|
|
1
|
-
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
2
|
-
/**
|
|
3
|
-
* 점 3개 로더 컴포넌트입니다.
|
|
4
|
-
*/
|
|
5
|
-
export declare class UDotLoader extends BaseElement {
|
|
6
|
-
static styles: import('lit').CSSResultGroup[];
|
|
7
|
-
static dependencies: Record<string, typeof BaseElement>;
|
|
8
|
-
render(): import('lit-html').TemplateResult<1>;
|
|
9
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
3
|
-
import { styles } from './UDotLoader.styles.js';
|
|
4
|
-
|
|
5
|
-
class UDotLoader extends BaseElement {
|
|
6
|
-
static {
|
|
7
|
-
this.styles = [super.styles, styles];
|
|
8
|
-
}
|
|
9
|
-
static {
|
|
10
|
-
this.dependencies = {};
|
|
11
|
-
}
|
|
12
|
-
render() {
|
|
13
|
-
return html`
|
|
14
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
15
|
-
<circle class="d0" cx="4" cy="12" r="3" />
|
|
16
|
-
<circle class="d1" cx="12" cy="12" r="3" />
|
|
17
|
-
<circle class="d2" cx="20" cy="12" r="3" />
|
|
18
|
-
</svg>
|
|
19
|
-
`;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { UDotLoader };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
|
|
3
|
-
const styles = css`
|
|
4
|
-
svg {
|
|
5
|
-
width: 1em;
|
|
6
|
-
height: 1em;
|
|
7
|
-
fill: currentColor;
|
|
8
|
-
display: inline-block;
|
|
9
|
-
vertical-align: middle;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
circle {
|
|
13
|
-
animation: bounce 1.05s infinite;
|
|
14
|
-
transform-box: fill-box;
|
|
15
|
-
transform-origin: center;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
circle.d1 {
|
|
19
|
-
animation-delay: 0.1s;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
circle.d2 {
|
|
23
|
-
animation-delay: 0.2s;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@media (prefers-reduced-motion: reduce) {
|
|
27
|
-
circle {
|
|
28
|
-
animation: none;
|
|
29
|
-
transform: none;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@keyframes bounce {
|
|
34
|
-
0%,57.14% {
|
|
35
|
-
animation-timing-function: cubic-bezier(0.33, 0.66, 0.66, 1);
|
|
36
|
-
transform: translateY(0);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
28.57% {
|
|
40
|
-
animation-timing-function: cubic-bezier(0.33, 0, 0.66, 0.33);
|
|
41
|
-
transform: translateY(-6px);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
100% {
|
|
45
|
-
transform: translateY(0);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
export { styles };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
2
|
-
import { BlockItem } from '../../types/BlockItem';
|
|
3
|
-
/** 메시지 variant 타입 */
|
|
4
|
-
export type MessageVariant = 'default' | 'bubble';
|
|
5
|
-
/** 메시지 위치 타입 */
|
|
6
|
-
export type MessagePosition = 'left' | 'right';
|
|
7
|
-
/**
|
|
8
|
-
* 채팅 메시지 컴포넌트입니다.
|
|
9
|
-
* 다양한 유형의 블록 아이템과 인용 출처를 렌더링할 수 있습니다.
|
|
10
|
-
*/
|
|
11
|
-
export declare class UMessage extends BaseElement {
|
|
12
|
-
static styles: import('lit').CSSResultGroup[];
|
|
13
|
-
static dependencies: Record<string, typeof BaseElement>;
|
|
14
|
-
variant: MessageVariant;
|
|
15
|
-
position: MessagePosition;
|
|
16
|
-
loading: boolean;
|
|
17
|
-
items?: BlockItem[];
|
|
18
|
-
render(): import('lit-html').TemplateResult<1>;
|
|
19
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { nothing, html } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { repeat } from 'lit/directives/repeat.js';
|
|
4
|
-
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
5
|
-
import { UTextBlock } from '../blocks/UTextBlock.component.js';
|
|
6
|
-
import { UMarkedBlock } from '../blocks/UMarkedBlock.component.js';
|
|
7
|
-
import { UThinkBlock } from '../blocks/UThinkBlock.component.js';
|
|
8
|
-
import { UToolBlock } from '../blocks/UToolBlock.component.js';
|
|
9
|
-
import { URefBlock } from '../blocks/URefBlock.component.js';
|
|
10
|
-
import { UDotLoader } from '../loaders/UDotLoader.component.js';
|
|
11
|
-
import { styles } from './UMessage.styles.js';
|
|
12
|
-
|
|
13
|
-
var __defProp = Object.defineProperty;
|
|
14
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
15
|
-
var result = void 0 ;
|
|
16
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17
|
-
if (decorator = decorators[i])
|
|
18
|
-
result = (decorator(target, key, result) ) || result;
|
|
19
|
-
if (result) __defProp(target, key, result);
|
|
20
|
-
return result;
|
|
21
|
-
};
|
|
22
|
-
class UMessage extends BaseElement {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(...arguments);
|
|
25
|
-
this.variant = "default";
|
|
26
|
-
this.position = "left";
|
|
27
|
-
this.loading = false;
|
|
28
|
-
}
|
|
29
|
-
static {
|
|
30
|
-
this.styles = [super.styles, styles];
|
|
31
|
-
}
|
|
32
|
-
static {
|
|
33
|
-
this.dependencies = {
|
|
34
|
-
"u-text-block": UTextBlock,
|
|
35
|
-
"u-marked-block": UMarkedBlock,
|
|
36
|
-
"u-think-block": UThinkBlock,
|
|
37
|
-
"u-tool-block": UToolBlock,
|
|
38
|
-
"u-ref-block": URefBlock,
|
|
39
|
-
"u-dot-loader": UDotLoader
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
render() {
|
|
43
|
-
return html`
|
|
44
|
-
<slot name="header"></slot>
|
|
45
|
-
|
|
46
|
-
<div class="body" part="body" variant=${this.variant} position=${this.position}>
|
|
47
|
-
${repeat(this.items || [], (_, idx) => idx, (item, idx) => item.type === "text" ? html`
|
|
48
|
-
<u-text-block
|
|
49
|
-
.value=${item.value}
|
|
50
|
-
></u-text-block>` : item.type === "markdown" ? html`
|
|
51
|
-
<u-marked-block
|
|
52
|
-
.value=${item.value}
|
|
53
|
-
.refs=${item.refs}
|
|
54
|
-
></u-marked-block>` : item.type === "thinking" ? html`
|
|
55
|
-
<u-think-block
|
|
56
|
-
.value=${item.value}
|
|
57
|
-
></u-think-block>` : item.type === "tool" ? html`
|
|
58
|
-
<u-tool-block
|
|
59
|
-
index=${idx}
|
|
60
|
-
.heading=${item.title}
|
|
61
|
-
.input=${item.input}
|
|
62
|
-
.output=${item.output}
|
|
63
|
-
></u-tool-block>` : item.type === "reference" ? html`
|
|
64
|
-
<u-ref-block
|
|
65
|
-
.heading=${"References"}
|
|
66
|
-
.sources=${item.sources}
|
|
67
|
-
></u-ref-block>` : nothing)}
|
|
68
|
-
<u-dot-loader
|
|
69
|
-
?hidden=${!this.loading}
|
|
70
|
-
></u-dot-loader>
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
<slot name="footer" ?hidden=${this.loading}></slot>
|
|
74
|
-
`;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
__decorateClass([
|
|
78
|
-
property({ type: String, reflect: true })
|
|
79
|
-
], UMessage.prototype, "variant");
|
|
80
|
-
__decorateClass([
|
|
81
|
-
property({ type: String, reflect: true })
|
|
82
|
-
], UMessage.prototype, "position");
|
|
83
|
-
__decorateClass([
|
|
84
|
-
property({ type: Boolean, reflect: true })
|
|
85
|
-
], UMessage.prototype, "loading");
|
|
86
|
-
__decorateClass([
|
|
87
|
-
property({ type: Array })
|
|
88
|
-
], UMessage.prototype, "items");
|
|
89
|
-
|
|
90
|
-
export { UMessage };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
2
|
-
/**
|
|
3
|
-
* 채팅 입력 컴포넌트입니다.
|
|
4
|
-
* 텍스트 입력 영역과 우측에 액션 버튼을 배치할 수 있는 슬롯을 제공합니다.
|
|
5
|
-
*/
|
|
6
|
-
export declare class UPrompt extends BaseElement {
|
|
7
|
-
static styles: import('lit').CSSResultGroup[];
|
|
8
|
-
static dependencies: Record<string, typeof BaseElement>;
|
|
9
|
-
/** 로딩 상태 여부 */
|
|
10
|
-
loading: boolean;
|
|
11
|
-
/** 최소 행 수 */
|
|
12
|
-
minRows: number;
|
|
13
|
-
/** 최대 행 수 */
|
|
14
|
-
maxRows: number;
|
|
15
|
-
/** 입력 필드의 플레이스홀더 텍스트 */
|
|
16
|
-
placeholder?: string;
|
|
17
|
-
/** 입력 필드의 값 */
|
|
18
|
-
value?: string;
|
|
19
|
-
connectedCallback(): void;
|
|
20
|
-
render(): import('lit-html').TemplateResult<1>;
|
|
21
|
-
send(): void;
|
|
22
|
-
private handleTextBlockInput;
|
|
23
|
-
private handleTextBlockKeydown;
|
|
24
|
-
private handleSendButtonClick;
|
|
25
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
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 { UButton } from '@iyulab/components/dist/components/button/UButton.component.js';
|
|
6
|
-
import { UTextBlock } from '../blocks/UTextBlock.component.js';
|
|
7
|
-
import { styles } from './UPrompt.styles.js';
|
|
8
|
-
|
|
9
|
-
var __defProp = Object.defineProperty;
|
|
10
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
-
var result = void 0 ;
|
|
12
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
-
if (decorator = decorators[i])
|
|
14
|
-
result = (decorator(target, key, result) ) || result;
|
|
15
|
-
if (result) __defProp(target, key, result);
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
|
-
class UPrompt extends BaseElement {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.loading = false;
|
|
22
|
-
this.minRows = 1;
|
|
23
|
-
this.maxRows = 10;
|
|
24
|
-
this.handleSendButtonClick = (e) => {
|
|
25
|
-
e.preventDefault();
|
|
26
|
-
e.stopPropagation();
|
|
27
|
-
this.send();
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
static {
|
|
31
|
-
this.styles = [super.styles, styles];
|
|
32
|
-
}
|
|
33
|
-
static {
|
|
34
|
-
this.dependencies = {
|
|
35
|
-
"u-icon": UIcon,
|
|
36
|
-
"u-button": UButton,
|
|
37
|
-
"u-text-block": UTextBlock
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
connectedCallback() {
|
|
41
|
-
super.connectedCallback();
|
|
42
|
-
this.setAttribute("tabindex", "0");
|
|
43
|
-
}
|
|
44
|
-
render() {
|
|
45
|
-
return html`
|
|
46
|
-
<slot name="header"></slot>
|
|
47
|
-
|
|
48
|
-
<u-text-block part="input"
|
|
49
|
-
editable
|
|
50
|
-
.minRows=${this.minRows}
|
|
51
|
-
.maxRows=${this.maxRows}
|
|
52
|
-
.value=${this.value}
|
|
53
|
-
.placeholder=${this.placeholder}
|
|
54
|
-
@input=${this.handleTextBlockInput}
|
|
55
|
-
@keydown=${this.handleTextBlockKeydown}
|
|
56
|
-
></u-text-block>
|
|
57
|
-
|
|
58
|
-
<div class="control" part="control">
|
|
59
|
-
<slot name="left-actions"></slot>
|
|
60
|
-
<div style="flex: 1;"></div>
|
|
61
|
-
<slot name="right-actions"></slot>
|
|
62
|
-
|
|
63
|
-
<u-button class="send-btn" part="send-btn"
|
|
64
|
-
?disabled=${!this.loading && !this.value}
|
|
65
|
-
@click=${this.handleSendButtonClick}>
|
|
66
|
-
<u-icon
|
|
67
|
-
lib="internal"
|
|
68
|
-
name=${this.loading ? "stop-circle" : "arrow-up"}
|
|
69
|
-
></u-icon>
|
|
70
|
-
</u-button>
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
<slot name="footer"></slot>
|
|
74
|
-
`;
|
|
75
|
-
}
|
|
76
|
-
send() {
|
|
77
|
-
const value = this.value?.trim();
|
|
78
|
-
if (this.loading) {
|
|
79
|
-
this.emit("u-cancel");
|
|
80
|
-
} else if (value) {
|
|
81
|
-
this.emit("u-submit", { value: this.value });
|
|
82
|
-
this.value = "";
|
|
83
|
-
} else ;
|
|
84
|
-
}
|
|
85
|
-
handleTextBlockInput(e) {
|
|
86
|
-
e.preventDefault();
|
|
87
|
-
const target = e.target;
|
|
88
|
-
this.value = target.value;
|
|
89
|
-
}
|
|
90
|
-
handleTextBlockKeydown(e) {
|
|
91
|
-
if (e.key === "Enter" && !e.shiftKey) {
|
|
92
|
-
e.preventDefault();
|
|
93
|
-
this.send();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
__decorateClass([
|
|
98
|
-
property({ type: Boolean, reflect: true })
|
|
99
|
-
], UPrompt.prototype, "loading");
|
|
100
|
-
__decorateClass([
|
|
101
|
-
property({ type: Number })
|
|
102
|
-
], UPrompt.prototype, "minRows");
|
|
103
|
-
__decorateClass([
|
|
104
|
-
property({ type: Number })
|
|
105
|
-
], UPrompt.prototype, "maxRows");
|
|
106
|
-
__decorateClass([
|
|
107
|
-
property({ type: String })
|
|
108
|
-
], UPrompt.prototype, "placeholder");
|
|
109
|
-
__decorateClass([
|
|
110
|
-
property({ type: String })
|
|
111
|
-
], UPrompt.prototype, "value");
|
|
112
|
-
|
|
113
|
-
export { UPrompt };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
2
|
-
/**
|
|
3
|
-
* 참조 소스를 카드 형태로 표시하는 공통 컴포넌트입니다.
|
|
4
|
-
* Web과 Document 타입 모두 지원합니다.
|
|
5
|
-
*/
|
|
6
|
-
export declare class URefCard extends BaseElement {
|
|
7
|
-
static styles: import('lit').CSSResultGroup[];
|
|
8
|
-
static dependencies: Record<string, typeof BaseElement>;
|
|
9
|
-
/** 카드 타입 (web 또는 document) */
|
|
10
|
-
type: 'web' | 'document';
|
|
11
|
-
/** 외부 링크 URL */
|
|
12
|
-
href?: string;
|
|
13
|
-
/** 카드 타이틀 */
|
|
14
|
-
heading?: string;
|
|
15
|
-
/** 태그 목록 */
|
|
16
|
-
tags?: string[];
|
|
17
|
-
render(): import('lit-html').TemplateResult<1>;
|
|
18
|
-
/** 링크 클릭 핸들러 */
|
|
19
|
-
private handleAnchorClick;
|
|
20
|
-
/** URL에서 Google의 파비콘 URL을 반환합니다. */
|
|
21
|
-
private getFaviconUrl;
|
|
22
|
-
/** URL에서 도메인 사이트 주소를 반환합니다. */
|
|
23
|
-
private getDomainName;
|
|
24
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
|
-
import { arrayAttrConverter } from '@iyulab/components/dist/utilities/converters.js';
|
|
5
|
-
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
6
|
-
import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
|
|
7
|
-
import { styles } from './URefCard.styles.js';
|
|
8
|
-
|
|
9
|
-
var __defProp = Object.defineProperty;
|
|
10
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
-
var result = void 0 ;
|
|
12
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
-
if (decorator = decorators[i])
|
|
14
|
-
result = (decorator(target, key, result) ) || result;
|
|
15
|
-
if (result) __defProp(target, key, result);
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
|
-
class URefCard extends BaseElement {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.type = "web";
|
|
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
|
-
<a href="${ifDefined(this.href)}" target="_blank" rel="noopener noreferrer"
|
|
34
|
-
@click=${this.handleAnchorClick}>
|
|
35
|
-
<div class="header">
|
|
36
|
-
<img class="favicon"
|
|
37
|
-
src="${this.getFaviconUrl(this.href)}"
|
|
38
|
-
alt="favicon"
|
|
39
|
-
/>
|
|
40
|
-
<div class="title" title="${ifDefined(this.heading)}">
|
|
41
|
-
${this.heading || this.getDomainName(this.href)}
|
|
42
|
-
</div>
|
|
43
|
-
|
|
44
|
-
<div style="flex: 1;"></div>
|
|
45
|
-
|
|
46
|
-
<div class="badge" type=${this.type}>
|
|
47
|
-
<u-icon
|
|
48
|
-
lib="internal"
|
|
49
|
-
name=${this.type === "web" ? "globe" : "file-earmark"}
|
|
50
|
-
></u-icon>
|
|
51
|
-
${this.type.toUpperCase()}
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
<div class="body">
|
|
56
|
-
<slot></slot>
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
|
-
<div class="footer" ?hidden=${!this.tags || this.tags.length === 0}>
|
|
60
|
-
${this.tags?.map((tag) => html`<span class="tag">${tag}</span>`)}
|
|
61
|
-
</div>
|
|
62
|
-
</a>
|
|
63
|
-
`;
|
|
64
|
-
}
|
|
65
|
-
/** 링크 클릭 핸들러 */
|
|
66
|
-
handleAnchorClick(e) {
|
|
67
|
-
if (!this.href) {
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
e.stopPropagation();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/** URL에서 Google의 파비콘 URL을 반환합니다. */
|
|
73
|
-
getFaviconUrl(url) {
|
|
74
|
-
if (!url) return `/favicon.ico`;
|
|
75
|
-
try {
|
|
76
|
-
const hostname = new URL(url).hostname;
|
|
77
|
-
return `https://www.google.com/s2/favicons?sz=64&domain=${hostname}`;
|
|
78
|
-
} catch {
|
|
79
|
-
return `/favicon.ico`;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/** URL에서 도메인 사이트 주소를 반환합니다. */
|
|
83
|
-
getDomainName(url) {
|
|
84
|
-
if (!url) return "";
|
|
85
|
-
try {
|
|
86
|
-
return new URL(url).hostname;
|
|
87
|
-
} catch {
|
|
88
|
-
return "";
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
__decorateClass([
|
|
93
|
-
property({ type: String, reflect: true })
|
|
94
|
-
], URefCard.prototype, "type");
|
|
95
|
-
__decorateClass([
|
|
96
|
-
property({ type: String })
|
|
97
|
-
], URefCard.prototype, "href");
|
|
98
|
-
__decorateClass([
|
|
99
|
-
property({ type: String })
|
|
100
|
-
], URefCard.prototype, "heading");
|
|
101
|
-
__decorateClass([
|
|
102
|
-
property({ type: Array, converter: arrayAttrConverter((v) => v) })
|
|
103
|
-
], URefCard.prototype, "tags");
|
|
104
|
-
|
|
105
|
-
export { URefCard };
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
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 };
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
/** 링크 클릭 핸들러 */
|
|
12
|
-
private handleAnchorClick;
|
|
13
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
|
-
import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
|
|
5
|
-
import { UTooltip } from '@iyulab/components/dist/components/tooltip/UTooltip.component.js';
|
|
6
|
-
import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
|
|
7
|
-
import { styles } from './URefTag.styles.js';
|
|
8
|
-
|
|
9
|
-
var __defProp = Object.defineProperty;
|
|
10
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
-
var result = void 0 ;
|
|
12
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
-
if (decorator = decorators[i])
|
|
14
|
-
result = (decorator(target, key, result) ) || result;
|
|
15
|
-
if (result) __defProp(target, key, result);
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
|
-
class URefTag extends BaseElement {
|
|
19
|
-
static {
|
|
20
|
-
this.styles = [super.styles, styles];
|
|
21
|
-
}
|
|
22
|
-
static {
|
|
23
|
-
this.dependencies = {
|
|
24
|
-
"u-icon": UIcon,
|
|
25
|
-
"u-tooltip": UTooltip
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
render() {
|
|
29
|
-
return html`
|
|
30
|
-
<a href="${ifDefined(this.href)}" target="_blank" rel="noopener noreferrer"
|
|
31
|
-
@click=${this.handleAnchorClick}>
|
|
32
|
-
<slot></slot>
|
|
33
|
-
</a>
|
|
34
|
-
|
|
35
|
-
<u-icon lib="internal" name="box-arrow-up-right"></u-icon>
|
|
36
|
-
|
|
37
|
-
<u-tooltip interactive placement="bottom" distance="4">
|
|
38
|
-
<slot name="tooltip"></slot>
|
|
39
|
-
</u-tooltip>
|
|
40
|
-
`;
|
|
41
|
-
}
|
|
42
|
-
/** 링크 클릭 핸들러 */
|
|
43
|
-
handleAnchorClick(e) {
|
|
44
|
-
if (!this.href) {
|
|
45
|
-
e.preventDefault();
|
|
46
|
-
e.stopPropagation();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
__decorateClass([
|
|
51
|
-
property({ type: String })
|
|
52
|
-
], URefTag.prototype, "href");
|
|
53
|
-
|
|
54
|
-
export { URefTag };
|