@iyulab/chat-components 0.4.0 → 0.5.1
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 +83 -52
- package/README.md +133 -16
- package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.124.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 +4 -4
- package/dist/components/blocks/UFileBlock.d.ts +33 -0
- package/dist/components/blocks/UFileBlock.js +154 -0
- package/dist/components/blocks/{UFilesBlock.styles.js → UFileBlock.styles.js} +12 -90
- 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 +47 -2
- package/dist/components/blocks/UTableBlock.js +197 -4
- package/dist/components/blocks/UTableBlock.styles.js +4 -5
- 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/{actions/UQuestionAction.component.d.ts → intents/UQuestionIntent.d.ts} +6 -2
- package/dist/components/intents/UQuestionIntent.js +41 -0
- package/dist/components/{actions/UQuestionAction.styles.js → intents/UQuestionIntent.styles.js} +4 -6
- package/dist/components/message/UMessage.d.ts +18 -2
- package/dist/components/message/UMessage.js +47 -2
- package/dist/components/message/UMessage.styles.js +4 -4
- package/dist/components/prompt/UPrompt.d.ts +37 -2
- package/dist/components/prompt/UPrompt.js +139 -2
- package/dist/components/prompt/UPrompt.styles.js +15 -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/{widgets/UChartWidget.component.d.ts → views/UChartView.d.ts} +7 -4
- package/dist/components/views/UChartView.js +167 -0
- package/dist/components/{widgets/UChartWidget.styles.js → views/UChartView.styles.js} +4 -4
- package/dist/components/{widgets/UImagesWidget.component.d.ts → views/UImagesView.d.ts} +7 -4
- package/dist/components/views/UImagesView.js +144 -0
- package/dist/components/{widgets/UImagesWidget.styles.js → views/UImagesView.styles.js} +6 -5
- package/dist/components/{widgets/UMapWidget.component.d.ts → views/UMapView.d.ts} +7 -3
- package/dist/components/views/UMapView.js +45 -0
- package/dist/components/{widgets/UMapWidget.styles.js → views/UMapView.styles.js} +4 -4
- package/dist/components/{widgets/UVideoWidget.component.d.ts → views/UVideoView.d.ts} +7 -3
- package/dist/components/views/UVideoView.js +81 -0
- package/dist/components/{widgets/UVideoWidget.styles.js → views/UVideoView.styles.js} +4 -4
- package/dist/components/{widgets/UWidget.component.d.ts → views/UView.d.ts} +8 -5
- package/dist/components/views/UView.js +113 -0
- package/dist/components/{widgets/UWidget.styles.js → views/UView.styles.js} +4 -4
- package/dist/events/AttachEvent.d.ts +9 -0
- package/dist/events/ChoiceEvent.d.ts +9 -0
- package/dist/events/SendEvent.d.ts +21 -0
- package/dist/events/StopEvent.d.ts +17 -0
- package/dist/index.d.ts +13 -16
- package/dist/index.js +28 -56
- 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 -32
- package/dist/types/Intents.d.ts +26 -0
- package/dist/types/Intents.js +30 -0
- package/dist/types/{Widgets.d.ts → Views.d.ts} +8 -8
- 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 +33 -16
- package/skills/iyulab-chat-components/SKILL.md +107 -0
- package/skills/iyulab-chat-components/references/components/attach-button.md +69 -0
- package/skills/iyulab-chat-components/references/components/chart-view.md +65 -0
- package/skills/iyulab-chat-components/references/components/code-block.md +42 -0
- package/skills/iyulab-chat-components/references/components/copy-button.md +46 -0
- package/skills/iyulab-chat-components/references/components/file-block.md +64 -0
- package/skills/iyulab-chat-components/references/components/images-view.md +63 -0
- package/skills/iyulab-chat-components/references/components/json-block.md +41 -0
- package/skills/iyulab-chat-components/references/components/map-view.md +54 -0
- package/skills/iyulab-chat-components/references/components/marked-block.md +53 -0
- package/skills/iyulab-chat-components/references/components/message.md +60 -0
- package/skills/iyulab-chat-components/references/components/prompt.md +102 -0
- package/skills/iyulab-chat-components/references/components/question-intent.md +75 -0
- package/skills/iyulab-chat-components/references/components/ref-block.md +45 -0
- package/skills/iyulab-chat-components/references/components/ref-card-group.md +41 -0
- package/skills/iyulab-chat-components/references/components/ref-card.md +48 -0
- package/skills/iyulab-chat-components/references/components/ref-tag.md +40 -0
- package/skills/iyulab-chat-components/references/components/table-block.md +63 -0
- package/skills/iyulab-chat-components/references/components/text-block.md +59 -0
- package/skills/iyulab-chat-components/references/components/think-block.md +48 -0
- package/skills/iyulab-chat-components/references/components/tool-block.md +57 -0
- package/skills/iyulab-chat-components/references/components/video-view.md +55 -0
- package/skills/iyulab-chat-components/references/components/view.md +51 -0
- package/skills/iyulab-chat-components/references/components/vote-button.md +60 -0
- package/skills/iyulab-chat-components/references/types.md +115 -0
- package/skills/iyulab-chat-components/references/usage.md +254 -0
- package/skills/iyulab-chat-components/references/utilities/intent-prompt-builder.md +123 -0
- package/skills/iyulab-chat-components/references/utilities/view-prompt-builder.md +112 -0
- package/dist/assets/action-prompt.md.js +0 -3
- package/dist/assets/widget-prompt.md.js +0 -3
- package/dist/components/actions/UQuestionAction.component.js +0 -58
- package/dist/components/actions/UQuestionAction.d.ts +0 -7
- package/dist/components/actions/UQuestionAction.js +0 -5
- package/dist/components/blocks/UCodeBlock.component.d.ts +0 -25
- package/dist/components/blocks/UCodeBlock.component.js +0 -88
- package/dist/components/blocks/UFilesBlock.component.d.ts +0 -22
- package/dist/components/blocks/UFilesBlock.component.js +0 -192
- package/dist/components/blocks/UFilesBlock.d.ts +0 -7
- package/dist/components/blocks/UFilesBlock.js +0 -5
- 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 -40
- package/dist/components/blocks/UMarkedBlock.component.js +0 -159
- package/dist/components/blocks/URefBlock.component.d.ts +0 -17
- package/dist/components/blocks/URefBlock.component.js +0 -73
- package/dist/components/blocks/UTableBlock.component.d.ts +0 -49
- package/dist/components/blocks/UTableBlock.component.js +0 -228
- 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 -73
- package/dist/components/message/UMessage.component.d.ts +0 -19
- package/dist/components/message/UMessage.component.js +0 -56
- 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 -27
- package/dist/components/references/URefCard.component.js +0 -109
- package/dist/components/references/URefCardGroup.component.d.ts +0 -26
- 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/components/widgets/UChartWidget.component.js +0 -180
- package/dist/components/widgets/UChartWidget.d.ts +0 -7
- package/dist/components/widgets/UChartWidget.js +0 -5
- package/dist/components/widgets/UImagesWidget.component.js +0 -164
- package/dist/components/widgets/UImagesWidget.d.ts +0 -7
- package/dist/components/widgets/UImagesWidget.js +0 -5
- package/dist/components/widgets/UMapWidget.component.js +0 -65
- package/dist/components/widgets/UMapWidget.d.ts +0 -7
- package/dist/components/widgets/UMapWidget.js +0 -5
- package/dist/components/widgets/UMapWidget.styles.d.ts +0 -1
- package/dist/components/widgets/UVideoWidget.component.js +0 -106
- package/dist/components/widgets/UVideoWidget.d.ts +0 -7
- package/dist/components/widgets/UVideoWidget.js +0 -5
- package/dist/components/widgets/UVideoWidget.styles.d.ts +0 -1
- package/dist/components/widgets/UWidget.component.js +0 -140
- package/dist/components/widgets/UWidget.d.ts +0 -7
- package/dist/components/widgets/UWidget.js +0 -5
- package/dist/components/widgets/UWidget.styles.d.ts +0 -1
- package/dist/events/UCancelEvent.d.ts +0 -6
- package/dist/events/USubmitEvent.d.ts +0 -6
- package/dist/types/Actions.d.ts +0 -24
- package/dist/types/Actions.js +0 -34
- package/dist/types/Widgets.js +0 -115
- package/dist/utilities/ActionPromptBuilder.d.ts +0 -40
- package/dist/utilities/ActionPromptBuilder.js +0 -93
- package/dist/utilities/WidgetPromptBuilder.d.ts +0 -28
- package/dist/utilities/WidgetPromptBuilder.js +0 -87
- package/dist/utilities/converters.d.ts +0 -9
- package/dist/utilities/converters.js +0 -19
- /package/dist/components/{actions/UQuestionAction.styles.d.ts → blocks/UFileBlock.styles.d.ts} +0 -0
- /package/dist/components/{blocks/UFilesBlock.styles.d.ts → intents/UQuestionIntent.styles.d.ts} +0 -0
- /package/dist/components/{buttons/UReportButton.styles.d.ts → views/UChartView.styles.d.ts} +0 -0
- /package/dist/components/{buttons/URetryButton.styles.d.ts → views/UImagesView.styles.d.ts} +0 -0
- /package/dist/components/{buttons/UShareButton.styles.d.ts → views/UMapView.styles.d.ts} +0 -0
- /package/dist/components/{widgets/UChartWidget.styles.d.ts → views/UVideoView.styles.d.ts} +0 -0
- /package/dist/components/{widgets/UImagesWidget.styles.d.ts → views/UView.styles.d.ts} +0 -0
|
@@ -1,5 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
UVoteButton.
|
|
1
|
+
import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorateMetadata.js";
|
|
2
|
+
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js";
|
|
3
|
+
import { styles } from "./UVoteButton.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/button/UButton.js";
|
|
8
|
+
import "@iyulab/components/dist/components/tooltip/UTooltip.js";
|
|
9
|
+
import { UElement } from "@iyulab/components/dist/components/UElement.js";
|
|
10
|
+
//#region src/components/buttons/UVoteButton.ts
|
|
11
|
+
var UVoteButton = class UVoteButton extends UElement {
|
|
12
|
+
constructor(..._args) {
|
|
13
|
+
super(..._args);
|
|
14
|
+
this.value = "none";
|
|
15
|
+
this.handleUpButtonClick = () => {
|
|
16
|
+
this.value = this.value === "up" ? "none" : "up";
|
|
17
|
+
this.dispatchEvent(new Event("change", {
|
|
18
|
+
bubbles: true,
|
|
19
|
+
composed: true
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
this.handleDownButtonClick = () => {
|
|
23
|
+
this.value = this.value === "down" ? "none" : "down";
|
|
24
|
+
this.dispatchEvent(new Event("change", {
|
|
25
|
+
bubbles: true,
|
|
26
|
+
composed: true
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
static {
|
|
31
|
+
this.styles = [super.styles, styles];
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
return html`
|
|
35
|
+
<u-button class="up-btn" part="up-btn"
|
|
36
|
+
variant="ghost"
|
|
37
|
+
@click=${this.handleUpButtonClick}>
|
|
38
|
+
<u-icon part="icon"
|
|
39
|
+
lib="bootstrap"
|
|
40
|
+
name=${this.value === "up" ? "hand-thumbs-up-fill" : "hand-thumbs-up"}
|
|
41
|
+
></u-icon>
|
|
42
|
+
</u-button>
|
|
43
|
+
<u-button class="down-btn" part="down-btn"
|
|
44
|
+
variant="ghost"
|
|
45
|
+
@click=${this.handleDownButtonClick}>
|
|
46
|
+
<u-icon part="icon"
|
|
47
|
+
lib="bootstrap"
|
|
48
|
+
name=${this.value === "down" ? "hand-thumbs-down-fill" : "hand-thumbs-down"}
|
|
49
|
+
></u-icon>
|
|
50
|
+
</u-button>
|
|
4
51
|
|
|
52
|
+
<u-tooltip for=".up-btn" placement="bottom" distance="8">
|
|
53
|
+
<slot name="up"></slot>
|
|
54
|
+
</u-tooltip>
|
|
55
|
+
<u-tooltip for=".down-btn" placement="bottom" distance="8">
|
|
56
|
+
<slot name="down"></slot>
|
|
57
|
+
</u-tooltip>
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
__decorate([property({ type: String }), __decorateMetadata("design:type", Object)], UVoteButton.prototype, "value", void 0);
|
|
62
|
+
UVoteButton = __decorate([customElement("u-vote-button")], UVoteButton);
|
|
63
|
+
//#endregion
|
|
5
64
|
export { UVoteButton };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { css } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
//#region src/components/buttons/UVoteButton.styles.ts
|
|
3
|
+
var styles = css`
|
|
4
4
|
:host {
|
|
5
5
|
display: flex;
|
|
6
6
|
flex-direction: row;
|
|
@@ -15,5 +15,5 @@ const styles = css`
|
|
|
15
15
|
font-size: 16px;
|
|
16
16
|
}
|
|
17
17
|
`;
|
|
18
|
-
|
|
18
|
+
//#endregion
|
|
19
19
|
export { styles };
|
package/dist/components/{actions/UQuestionAction.component.d.ts → intents/UQuestionIntent.d.ts}
RENAMED
|
@@ -6,9 +6,8 @@ import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
|
6
6
|
* LLM이 질문 텍스트(`question`)와 클릭 선택지(`choices`)를 제시하고,
|
|
7
7
|
* `input: true`일 때는 사용자가 직접 텍스트를 입력할 수도 있습니다.
|
|
8
8
|
*/
|
|
9
|
-
export declare class
|
|
9
|
+
export declare class UQuestionIntent extends UElement {
|
|
10
10
|
static styles: import('lit').CSSResultGroup[];
|
|
11
|
-
static dependencies: Record<string, typeof UElement>;
|
|
12
11
|
/** LLM이 제시하는 질문 텍스트 */
|
|
13
12
|
question?: string;
|
|
14
13
|
/** 클릭 가능한 선택지 목록 */
|
|
@@ -16,3 +15,8 @@ export declare class UQuestionAction extends UElement {
|
|
|
16
15
|
render(): import('lit-html').TemplateResult<1> | typeof nothing;
|
|
17
16
|
private handleChoiceClick;
|
|
18
17
|
}
|
|
18
|
+
declare global {
|
|
19
|
+
interface HTMLElementTagNameMap {
|
|
20
|
+
"u-question-intent": UQuestionIntent;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorateMetadata.js";
|
|
2
|
+
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js";
|
|
3
|
+
import { styles } from "./UQuestionIntent.styles.js";
|
|
4
|
+
import { html, nothing } from "lit";
|
|
5
|
+
import { customElement, property } from "lit/decorators.js";
|
|
6
|
+
import "@iyulab/components/dist/components/button/UButton.js";
|
|
7
|
+
import { UElement } from "@iyulab/components/dist/components/UElement.js";
|
|
8
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
9
|
+
//#region src/components/intents/UQuestionIntent.ts
|
|
10
|
+
var UQuestionIntent = class UQuestionIntent extends UElement {
|
|
11
|
+
constructor(..._args) {
|
|
12
|
+
super(..._args);
|
|
13
|
+
this.choices = [];
|
|
14
|
+
}
|
|
15
|
+
static {
|
|
16
|
+
this.styles = [super.styles, styles];
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
if (!this.choices || this.choices.length === 0) return nothing;
|
|
20
|
+
return html`
|
|
21
|
+
<p class="question" ?hidden=${!this.question}>${this.question}</p>
|
|
22
|
+
<div class="choices">
|
|
23
|
+
${repeat(this.choices, (value, index) => html`
|
|
24
|
+
<u-button @click=${() => this.handleChoiceClick(index)}>
|
|
25
|
+
${value}
|
|
26
|
+
</u-button>
|
|
27
|
+
`)}
|
|
28
|
+
</div>
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
31
|
+
handleChoiceClick(index) {
|
|
32
|
+
const value = this.choices[index];
|
|
33
|
+
if (!value) return;
|
|
34
|
+
this.fire("choice", { detail: { value } });
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], UQuestionIntent.prototype, "question", void 0);
|
|
38
|
+
__decorate([property({ type: Array }), __decorateMetadata("design:type", Array)], UQuestionIntent.prototype, "choices", void 0);
|
|
39
|
+
UQuestionIntent = __decorate([customElement("u-question-intent")], UQuestionIntent);
|
|
40
|
+
//#endregion
|
|
41
|
+
export { UQuestionIntent };
|
package/dist/components/{actions/UQuestionAction.styles.js → intents/UQuestionIntent.styles.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { css } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
//#region src/components/intents/UQuestionIntent.styles.ts
|
|
3
|
+
var styles = css`
|
|
4
4
|
:host {
|
|
5
5
|
display: flex;
|
|
6
6
|
flex-direction: column;
|
|
@@ -33,13 +33,11 @@ const styles = css`
|
|
|
33
33
|
transition: all 0.15s ease;
|
|
34
34
|
}
|
|
35
35
|
u-button:hover {
|
|
36
|
-
background-color: var(--u-blue-0);
|
|
37
|
-
border-color: var(--u-blue-400);
|
|
38
36
|
transform: translateY(-1px);
|
|
39
37
|
}
|
|
40
38
|
u-button:active {
|
|
41
39
|
transform: translateY(0);
|
|
42
40
|
}
|
|
43
41
|
`;
|
|
44
|
-
|
|
42
|
+
//#endregion
|
|
45
43
|
export { styles };
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
2
|
+
/** 메시지 variant 타입 */
|
|
3
|
+
export type MessageVariant = 'default' | 'bubble';
|
|
4
|
+
/** 메시지 위치 타입 */
|
|
5
|
+
export type MessagePosition = 'left' | 'right';
|
|
6
|
+
/** 메시지 너비 타입 */
|
|
7
|
+
export type MessageFit = 'full' | 'auto';
|
|
8
|
+
/**
|
|
9
|
+
* 채팅 메시지 컴포넌트입니다.
|
|
10
|
+
* 슬롯을 통해 다양한 블록 컴포넌트를 자유롭게 배치할 수 있습니다.
|
|
11
|
+
*/
|
|
12
|
+
export declare class UMessage extends UElement {
|
|
13
|
+
static styles: import('lit').CSSResultGroup[];
|
|
14
|
+
loading: boolean;
|
|
15
|
+
variant: MessageVariant;
|
|
16
|
+
position: MessagePosition;
|
|
17
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
18
|
+
}
|
|
2
19
|
declare global {
|
|
3
20
|
interface HTMLElementTagNameMap {
|
|
4
21
|
"u-message": UMessage;
|
|
5
22
|
}
|
|
6
23
|
}
|
|
7
|
-
export { UMessage };
|
|
@@ -1,5 +1,50 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorateMetadata.js";
|
|
2
|
+
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js";
|
|
3
|
+
import { styles } from "./UMessage.styles.js";
|
|
4
|
+
import { html } from "lit";
|
|
5
|
+
import { customElement, property } from "lit/decorators.js";
|
|
6
|
+
import { UElement } from "@iyulab/components/dist/components/UElement.js";
|
|
7
|
+
//#region src/components/message/UMessage.ts
|
|
8
|
+
var UMessage = class UMessage extends UElement {
|
|
9
|
+
constructor(..._args) {
|
|
10
|
+
super(..._args);
|
|
11
|
+
this.loading = false;
|
|
12
|
+
this.variant = "default";
|
|
13
|
+
this.position = "left";
|
|
14
|
+
}
|
|
15
|
+
static {
|
|
16
|
+
this.styles = [super.styles, styles];
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
return html`
|
|
20
|
+
<slot name="header"></slot>
|
|
2
21
|
|
|
3
|
-
|
|
22
|
+
<div class="body" part="body" variant=${this.variant} position=${this.position}>
|
|
23
|
+
<slot></slot>
|
|
24
|
+
<svg class="dot-loader" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
|
|
25
|
+
?hidden=${!this.loading}>
|
|
26
|
+
<circle class="d0" cx="4" cy="12" r="3" />
|
|
27
|
+
<circle class="d1" cx="12" cy="12" r="3" />
|
|
28
|
+
<circle class="d2" cx="20" cy="12" r="3" />
|
|
29
|
+
</svg>
|
|
30
|
+
</div>
|
|
4
31
|
|
|
32
|
+
<slot name="footer" ?hidden=${this.loading}></slot>
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
__decorate([property({
|
|
37
|
+
type: Boolean,
|
|
38
|
+
reflect: true
|
|
39
|
+
}), __decorateMetadata("design:type", Boolean)], UMessage.prototype, "loading", void 0);
|
|
40
|
+
__decorate([property({
|
|
41
|
+
type: String,
|
|
42
|
+
reflect: true
|
|
43
|
+
}), __decorateMetadata("design:type", Object)], UMessage.prototype, "variant", void 0);
|
|
44
|
+
__decorate([property({
|
|
45
|
+
type: String,
|
|
46
|
+
reflect: true
|
|
47
|
+
}), __decorateMetadata("design:type", Object)], UMessage.prototype, "position", void 0);
|
|
48
|
+
UMessage = __decorate([customElement("u-message")], UMessage);
|
|
49
|
+
//#endregion
|
|
5
50
|
export { UMessage };
|
|
@@ -1,6 +1,6 @@
|
|
|
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
5
|
width: auto;
|
|
6
6
|
max-width: 100%;
|
|
@@ -76,5 +76,5 @@ const styles = css`
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
`;
|
|
79
|
-
|
|
79
|
+
//#endregion
|
|
80
80
|
export { styles };
|
|
@@ -1,7 +1,42 @@
|
|
|
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
|
+
/**
|
|
29
|
+
* 0.4.x 호환을 위한 legacy 이벤트를 함께 발행합니다.
|
|
30
|
+
* `u-submit`/`u-cancel`은 0.6.0에서 제거 예정.
|
|
31
|
+
*/
|
|
32
|
+
private dispatchLegacy;
|
|
33
|
+
private handleRemoveFile;
|
|
34
|
+
private handleTextBlockInput;
|
|
35
|
+
private handleTextBlockKeydown;
|
|
36
|
+
private handleSendButtonClick;
|
|
37
|
+
}
|
|
2
38
|
declare global {
|
|
3
39
|
interface HTMLElementTagNameMap {
|
|
4
40
|
"u-prompt": UPrompt;
|
|
5
41
|
}
|
|
6
42
|
}
|
|
7
|
-
export { UPrompt };
|
|
@@ -1,5 +1,142 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorateMetadata.js";
|
|
2
|
+
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.124.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
|
+
const stopDetail = {};
|
|
85
|
+
this.fire("stop", { detail: stopDetail });
|
|
86
|
+
this.dispatchLegacy("u-cancel", stopDetail);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const hasValue = this.value && this.value.trim() !== "";
|
|
90
|
+
const hasFiles = this.files && this.files.length > 0;
|
|
91
|
+
if (hasValue || hasFiles) {
|
|
92
|
+
const sendDetail = {
|
|
93
|
+
value: this.value?.trim() ?? "",
|
|
94
|
+
files: this.files ? [...this.files] : void 0
|
|
95
|
+
};
|
|
96
|
+
this.fire("send", { detail: sendDetail });
|
|
97
|
+
this.dispatchLegacy("u-submit", sendDetail);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 0.4.x 호환을 위한 legacy 이벤트를 함께 발행합니다.
|
|
102
|
+
* `u-submit`/`u-cancel`은 0.6.0에서 제거 예정.
|
|
103
|
+
*/
|
|
104
|
+
dispatchLegacy(name, detail) {
|
|
105
|
+
this.dispatchEvent(new CustomEvent(name, {
|
|
106
|
+
bubbles: true,
|
|
107
|
+
composed: true,
|
|
108
|
+
cancelable: true,
|
|
109
|
+
detail
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
handleRemoveFile(e) {
|
|
113
|
+
e.stopPropagation();
|
|
114
|
+
const index = e.target.dataset.index;
|
|
115
|
+
if (index !== void 0 && this.files) {
|
|
116
|
+
this.files = this.files.filter((_, i) => i !== Number(index));
|
|
117
|
+
this.relay(e);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
handleTextBlockInput(e) {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
this.value = e.target.value;
|
|
123
|
+
}
|
|
124
|
+
handleTextBlockKeydown(e) {
|
|
125
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
this.submit();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
__decorate([property({
|
|
132
|
+
type: Boolean,
|
|
133
|
+
reflect: true
|
|
134
|
+
}), __decorateMetadata("design:type", Boolean)], UPrompt.prototype, "loading", void 0);
|
|
135
|
+
__decorate([property({ type: Number }), __decorateMetadata("design:type", Number)], UPrompt.prototype, "minRows", void 0);
|
|
136
|
+
__decorate([property({ type: Number }), __decorateMetadata("design:type", Number)], UPrompt.prototype, "maxRows", void 0);
|
|
137
|
+
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], UPrompt.prototype, "placeholder", void 0);
|
|
138
|
+
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], UPrompt.prototype, "value", void 0);
|
|
139
|
+
__decorate([property({ type: Array }), __decorateMetadata("design:type", Array)], UPrompt.prototype, "files", void 0);
|
|
140
|
+
UPrompt = __decorate([customElement("u-prompt")], UPrompt);
|
|
141
|
+
//#endregion
|
|
5
142
|
export { UPrompt };
|
|
@@ -1,6 +1,6 @@
|
|
|
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
5
|
position: relative;
|
|
6
6
|
display: flex;
|
|
@@ -38,7 +38,17 @@ const styles = css`
|
|
|
38
38
|
mask-composite: exclude;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
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
|
+
}
|
|
50
|
+
|
|
51
|
+
.input {
|
|
42
52
|
flex: 1;
|
|
43
53
|
padding: 8px;
|
|
44
54
|
}
|
|
@@ -66,5 +76,5 @@ const styles = css`
|
|
|
66
76
|
100% { background-position: 0% 0; }
|
|
67
77
|
}
|
|
68
78
|
`;
|
|
69
|
-
|
|
79
|
+
//#endregion
|
|
70
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.124.0/helpers/decorateMetadata.js";
|
|
2
|
+
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.124.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 };
|