@iyulab/chat-components 0.4.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 +124 -21
- 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 +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 +32 -2
- package/dist/components/prompt/UPrompt.js +118 -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 +7 -0
- package/dist/events/StopEvent.d.ts +7 -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 +32 -16
- 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,164 +0,0 @@
|
|
|
1
|
-
import { nothing, html } from 'lit';
|
|
2
|
-
import { property, state } from 'lit/decorators.js';
|
|
3
|
-
import { repeat } from 'lit/directives/repeat.js';
|
|
4
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
5
|
-
import { UCarousel } from '@iyulab/components/dist/components/carousel/UCarousel.component.js';
|
|
6
|
-
import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
|
|
7
|
-
import { styles } from './UImagesWidget.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 UImagesWidget extends UElement {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.items = [];
|
|
22
|
-
this.index = null;
|
|
23
|
-
this.open = (i) => {
|
|
24
|
-
this.index = i;
|
|
25
|
-
};
|
|
26
|
-
this.close = () => {
|
|
27
|
-
this.index = null;
|
|
28
|
-
};
|
|
29
|
-
this.prev = () => {
|
|
30
|
-
if (this.index !== null && this.index > 0) {
|
|
31
|
-
this.index--;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
this.next = () => {
|
|
35
|
-
if (this.index !== null && this.index < this.items.length - 1) {
|
|
36
|
-
this.index++;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
this.handlePrevClick = (e) => {
|
|
40
|
-
e.stopPropagation();
|
|
41
|
-
this.prev();
|
|
42
|
-
};
|
|
43
|
-
this.handleNextClick = (e) => {
|
|
44
|
-
e.stopPropagation();
|
|
45
|
-
this.next();
|
|
46
|
-
};
|
|
47
|
-
this.handleKeyDown = (e) => {
|
|
48
|
-
if (this.index === null) return;
|
|
49
|
-
if (e.key === "Escape") this.close();
|
|
50
|
-
else if (e.key === "ArrowLeft") this.prev();
|
|
51
|
-
else if (e.key === "ArrowRight") this.next();
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
static {
|
|
55
|
-
this.styles = [super.styles, styles];
|
|
56
|
-
}
|
|
57
|
-
static {
|
|
58
|
-
this.dependencies = {
|
|
59
|
-
"u-carousel": UCarousel,
|
|
60
|
-
"u-icon": UIcon
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
connectedCallback() {
|
|
64
|
-
super.connectedCallback();
|
|
65
|
-
document.addEventListener("keydown", this.handleKeyDown);
|
|
66
|
-
}
|
|
67
|
-
disconnectedCallback() {
|
|
68
|
-
document.removeEventListener("keydown", this.handleKeyDown);
|
|
69
|
-
super.disconnectedCallback();
|
|
70
|
-
}
|
|
71
|
-
render() {
|
|
72
|
-
if (!this.items?.length) return nothing;
|
|
73
|
-
const count = this.items.length;
|
|
74
|
-
return html`
|
|
75
|
-
<u-carousel
|
|
76
|
-
.loop=${false}
|
|
77
|
-
.navigation=${false}
|
|
78
|
-
.pagination=${true}
|
|
79
|
-
.draggable=${true}
|
|
80
|
-
.slidesPerView=${Math.min(count, 3)}
|
|
81
|
-
.gap=${8}
|
|
82
|
-
>
|
|
83
|
-
${repeat(this.items, (item, i) => html`
|
|
84
|
-
<div class="slide"
|
|
85
|
-
@click=${() => this.open(i)}>
|
|
86
|
-
<img
|
|
87
|
-
src=${item.src}
|
|
88
|
-
alt=${item.alt || ""}
|
|
89
|
-
loading="lazy"
|
|
90
|
-
/>
|
|
91
|
-
<div class="caption"
|
|
92
|
-
?hidden=${!item.caption}>
|
|
93
|
-
${item.caption}
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
`)}
|
|
97
|
-
</u-carousel>
|
|
98
|
-
|
|
99
|
-
${this.renderLightbox()}
|
|
100
|
-
`;
|
|
101
|
-
}
|
|
102
|
-
renderLightbox() {
|
|
103
|
-
const idx = this.index;
|
|
104
|
-
if (idx === null) return nothing;
|
|
105
|
-
if (idx < 0 || idx >= this.items.length) return nothing;
|
|
106
|
-
const item = this.items[idx];
|
|
107
|
-
if (!item) return nothing;
|
|
108
|
-
const total = this.items.length;
|
|
109
|
-
const translateX = `calc(15vw - ${idx} * (70vw + 16px))`;
|
|
110
|
-
return html`
|
|
111
|
-
<div class="lb-overlay">
|
|
112
|
-
|
|
113
|
-
<!-- 상단: 카운터(중앙) + 닫기 버튼(우측) -->
|
|
114
|
-
<header class="lb-header">
|
|
115
|
-
<div class="lb-counter" ?hidden=${total <= 1}>
|
|
116
|
-
${idx + 1} / ${total}
|
|
117
|
-
</div>
|
|
118
|
-
<button class="lb-close" @click=${this.close}>
|
|
119
|
-
<u-icon lib="internal" name="x-lg"></u-icon>
|
|
120
|
-
</button>
|
|
121
|
-
</header>
|
|
122
|
-
|
|
123
|
-
<!-- 중앙: 뷰포트 + 이전/다음 버튼(absolute 오버레이) -->
|
|
124
|
-
<div class="lb-body">
|
|
125
|
-
<div class="lb-viewport">
|
|
126
|
-
<div class="lb-track" style="transform:translateX(${translateX})">
|
|
127
|
-
${repeat(this.items, (img, i) => html`
|
|
128
|
-
<div class="lb-slide" ?active=${i === idx}>
|
|
129
|
-
<img src=${img.src} alt=${img.alt || ""} />
|
|
130
|
-
</div>
|
|
131
|
-
`)}
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
|
|
135
|
-
<button class="lb-nav prev"
|
|
136
|
-
?hidden=${idx <= 0}
|
|
137
|
-
@click=${this.handlePrevClick}>
|
|
138
|
-
<u-icon lib="internal" name="chevron-left"></u-icon>
|
|
139
|
-
</button>
|
|
140
|
-
|
|
141
|
-
<button class="lb-nav next"
|
|
142
|
-
?hidden=${idx >= total - 1}
|
|
143
|
-
@click=${this.handleNextClick}>
|
|
144
|
-
<u-icon lib="internal" name="chevron-right"></u-icon>
|
|
145
|
-
</button>
|
|
146
|
-
</div>
|
|
147
|
-
|
|
148
|
-
<!-- 하단: 캡션 -->
|
|
149
|
-
<footer class="lb-footer" ?hidden=${!item.caption}>
|
|
150
|
-
<p class="lb-caption">${item.caption}</p>
|
|
151
|
-
</footer>
|
|
152
|
-
|
|
153
|
-
</div>
|
|
154
|
-
`;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
__decorateClass([
|
|
158
|
-
property({ type: Array })
|
|
159
|
-
], UImagesWidget.prototype, "items");
|
|
160
|
-
__decorateClass([
|
|
161
|
-
state()
|
|
162
|
-
], UImagesWidget.prototype, "index");
|
|
163
|
-
|
|
164
|
-
export { UImagesWidget };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { nothing, html } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
4
|
-
import { styles } from './UMapWidget.styles.js';
|
|
5
|
-
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
-
var result = void 0 ;
|
|
9
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
-
if (decorator = decorators[i])
|
|
11
|
-
result = (decorator(target, key, result) ) || result;
|
|
12
|
-
if (result) __defProp(target, key, result);
|
|
13
|
-
return result;
|
|
14
|
-
};
|
|
15
|
-
class UMapWidget extends UElement {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this.zoom = 15;
|
|
19
|
-
}
|
|
20
|
-
static {
|
|
21
|
-
this.styles = [super.styles, styles];
|
|
22
|
-
}
|
|
23
|
-
static {
|
|
24
|
-
this.dependencies = {};
|
|
25
|
-
}
|
|
26
|
-
render() {
|
|
27
|
-
if (this.lat == null || this.lng == null) return nothing;
|
|
28
|
-
const offset = 360 / Math.pow(2, this.zoom);
|
|
29
|
-
const bbox = `${this.lng - offset},${this.lat - offset},${this.lng + offset},${this.lat + offset}`;
|
|
30
|
-
const embedUrl = `https://www.openstreetmap.org/export/embed.html?bbox=${bbox}&layer=mapnik&marker=${this.lat},${this.lng}`;
|
|
31
|
-
const linkUrl = `https://www.openstreetmap.org/?mlat=${this.lat}&mlon=${this.lng}#map=${this.zoom}/${this.lat}/${this.lng}`;
|
|
32
|
-
return html`
|
|
33
|
-
<iframe
|
|
34
|
-
src="${embedUrl}"
|
|
35
|
-
loading="lazy"
|
|
36
|
-
></iframe>
|
|
37
|
-
<a class="caption"
|
|
38
|
-
?hidden=${!this.label && !this.description}
|
|
39
|
-
href="${linkUrl}"
|
|
40
|
-
target="_blank"
|
|
41
|
-
rel="noopener"
|
|
42
|
-
>
|
|
43
|
-
<strong>${this.label}</strong>
|
|
44
|
-
<span>${this.description}</span>
|
|
45
|
-
</a>
|
|
46
|
-
`;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
__decorateClass([
|
|
50
|
-
property({ type: Number })
|
|
51
|
-
], UMapWidget.prototype, "lat");
|
|
52
|
-
__decorateClass([
|
|
53
|
-
property({ type: Number })
|
|
54
|
-
], UMapWidget.prototype, "lng");
|
|
55
|
-
__decorateClass([
|
|
56
|
-
property({ type: Number })
|
|
57
|
-
], UMapWidget.prototype, "zoom");
|
|
58
|
-
__decorateClass([
|
|
59
|
-
property({ type: String })
|
|
60
|
-
], UMapWidget.prototype, "label");
|
|
61
|
-
__decorateClass([
|
|
62
|
-
property({ type: String })
|
|
63
|
-
], UMapWidget.prototype, "description");
|
|
64
|
-
|
|
65
|
-
export { UMapWidget };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const styles: import('lit').CSSResult;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { nothing, html } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
5
|
-
import { styles } from './UVideoWidget.styles.js';
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
-
var result = void 0 ;
|
|
10
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
-
if (decorator = decorators[i])
|
|
12
|
-
result = (decorator(target, key, result) ) || result;
|
|
13
|
-
if (result) __defProp(target, key, result);
|
|
14
|
-
return result;
|
|
15
|
-
};
|
|
16
|
-
class UVideoWidget extends UElement {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
this.ratio = "16:9";
|
|
20
|
-
}
|
|
21
|
-
static {
|
|
22
|
-
this.styles = [super.styles, styles];
|
|
23
|
-
}
|
|
24
|
-
static {
|
|
25
|
-
this.dependencies = {};
|
|
26
|
-
}
|
|
27
|
-
updated(changedProperties) {
|
|
28
|
-
super.updated(changedProperties);
|
|
29
|
-
if (changedProperties.has("ratio")) {
|
|
30
|
-
this.style.setProperty("--video-ratio", this.ratio.replace(":", " / "));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
render() {
|
|
34
|
-
if (!this.src) return nothing;
|
|
35
|
-
if (this.isYouTube(this.src)) {
|
|
36
|
-
const videoId = this.extractYouTubeId(this.src);
|
|
37
|
-
if (videoId) {
|
|
38
|
-
return html`
|
|
39
|
-
<div class="video-wrapper">
|
|
40
|
-
<iframe
|
|
41
|
-
src="https://www.youtube.com/embed/${videoId}"
|
|
42
|
-
loading="lazy"
|
|
43
|
-
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
44
|
-
allowfullscreen
|
|
45
|
-
></iframe>
|
|
46
|
-
</div>
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (this.isVimeo(this.src)) {
|
|
51
|
-
const videoId = this.extractVimeoId(this.src);
|
|
52
|
-
if (videoId) {
|
|
53
|
-
return html`
|
|
54
|
-
<div class="video-wrapper">
|
|
55
|
-
<iframe
|
|
56
|
-
src="https://player.vimeo.com/video/${videoId}"
|
|
57
|
-
loading="lazy"
|
|
58
|
-
allow="autoplay; fullscreen; picture-in-picture"
|
|
59
|
-
allowfullscreen
|
|
60
|
-
></iframe>
|
|
61
|
-
</div>
|
|
62
|
-
`;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return html`
|
|
66
|
-
<video
|
|
67
|
-
src=${this.src}
|
|
68
|
-
poster=${ifDefined(this.poster)}
|
|
69
|
-
controls
|
|
70
|
-
playsinline
|
|
71
|
-
></video>
|
|
72
|
-
`;
|
|
73
|
-
}
|
|
74
|
-
isYouTube(url) {
|
|
75
|
-
return /youtube\.com|youtu\.be/i.test(url);
|
|
76
|
-
}
|
|
77
|
-
isVimeo(url) {
|
|
78
|
-
return /vimeo\.com/i.test(url);
|
|
79
|
-
}
|
|
80
|
-
extractYouTubeId(url) {
|
|
81
|
-
const patterns = [
|
|
82
|
-
/(?:youtube\.com\/watch\?v=|youtu\.be\/)([^&\s]+)/,
|
|
83
|
-
/youtube\.com\/embed\/([^&\s]+)/
|
|
84
|
-
];
|
|
85
|
-
for (const pattern of patterns) {
|
|
86
|
-
const match = url.match(pattern);
|
|
87
|
-
if (match && match[1]) return match[1];
|
|
88
|
-
}
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
extractVimeoId(url) {
|
|
92
|
-
const match = url.match(/vimeo\.com\/(\d+)/);
|
|
93
|
-
return match ? match[1] : null;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
__decorateClass([
|
|
97
|
-
property({ type: String })
|
|
98
|
-
], UVideoWidget.prototype, "src");
|
|
99
|
-
__decorateClass([
|
|
100
|
-
property({ type: String })
|
|
101
|
-
], UVideoWidget.prototype, "poster");
|
|
102
|
-
__decorateClass([
|
|
103
|
-
property({ type: String })
|
|
104
|
-
], UVideoWidget.prototype, "ratio");
|
|
105
|
-
|
|
106
|
-
export { UVideoWidget };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const styles: import('lit').CSSResult;
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { html, nothing } from 'lit';
|
|
2
|
-
import { property, state } from 'lit/decorators.js';
|
|
3
|
-
import { UJsonElement } from '@iyulab/components/dist/components/UJsonElement.js';
|
|
4
|
-
import { USkeleton } from '@iyulab/components/dist/components/skeleton/USkeleton.component.js';
|
|
5
|
-
import { styles } from './UWidget.styles.js';
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
-
var result = void 0 ;
|
|
10
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
-
if (decorator = decorators[i])
|
|
12
|
-
result = (decorator(target, key, result) ) || result;
|
|
13
|
-
if (result) __defProp(target, key, result);
|
|
14
|
-
return result;
|
|
15
|
-
};
|
|
16
|
-
const DEFAULT_BLACKLIST = ["innerHTML", "outerHTML", "textContent", "innerText", "outerText", "srcdoc"];
|
|
17
|
-
class UWidget extends UJsonElement {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.loading = false;
|
|
21
|
-
this.blacklist = DEFAULT_BLACKLIST;
|
|
22
|
-
this.element = null;
|
|
23
|
-
}
|
|
24
|
-
static {
|
|
25
|
-
this.styles = [super.styles, styles];
|
|
26
|
-
}
|
|
27
|
-
static {
|
|
28
|
-
this.dependencies = {
|
|
29
|
-
"u-skeleton": USkeleton
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
willUpdate(changedProperties) {
|
|
33
|
-
super.willUpdate(changedProperties);
|
|
34
|
-
if (changedProperties.has("tag")) {
|
|
35
|
-
this.updateElement(this.tag);
|
|
36
|
-
}
|
|
37
|
-
if (changedProperties.has("properties") && this.element) {
|
|
38
|
-
this.updateProperties(this.element, this.properties);
|
|
39
|
-
}
|
|
40
|
-
if (changedProperties.has("blacklist") && this.element && this.properties) {
|
|
41
|
-
this.updateProperties(this.element, this.properties);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
render() {
|
|
45
|
-
if (this.loading === true) {
|
|
46
|
-
return html`
|
|
47
|
-
<div class="sk-container">
|
|
48
|
-
<div class="sk-card">
|
|
49
|
-
<u-skeleton effect="shimmer" width="100%" height="5em" shape="default"></u-skeleton>
|
|
50
|
-
<u-skeleton effect="shimmer" width="80%" height="0.8em" shape="rounded"></u-skeleton>
|
|
51
|
-
<u-skeleton effect="shimmer" width="40%" height="0.75em" shape="rounded"></u-skeleton>
|
|
52
|
-
</div>
|
|
53
|
-
<div class="sk-doc">
|
|
54
|
-
<u-skeleton effect="shimmer" width="40%" height="0.75em" shape="rounded"></u-skeleton>
|
|
55
|
-
<u-skeleton effect="shimmer" width="80%" height="0.75em" shape="rounded"></u-skeleton>
|
|
56
|
-
<u-skeleton effect="shimmer" width="60%" height="0.8em" shape="rounded"></u-skeleton>
|
|
57
|
-
<u-skeleton effect="shimmer" width="100%" height="0.8em" shape="rounded"></u-skeleton>
|
|
58
|
-
<u-skeleton effect="shimmer" width="80%" height="0.8em" shape="rounded"></u-skeleton>
|
|
59
|
-
</div>
|
|
60
|
-
</div>`;
|
|
61
|
-
}
|
|
62
|
-
if (this.element != null) {
|
|
63
|
-
return this.element;
|
|
64
|
-
}
|
|
65
|
-
return nothing;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* `loading`이 `true`인 경우, 에러 UI로 대체하지 않습니다.
|
|
69
|
-
*/
|
|
70
|
-
async error(error) {
|
|
71
|
-
if (this.loading) return;
|
|
72
|
-
await super.error(error);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* `tag` 프로퍼티에 등록된 커스텀 엘리먼트를 렌더링하는 컴포넌트입니다.
|
|
76
|
-
* `tag`가 변경될 때마다 등록된 커스텀 엘리먼트를 새로 생성하여 렌더링합니다.
|
|
77
|
-
* `tag`가 유효하지 않거나 등록된 커스텀 엘리먼트가 아닌 경우, 에러 처리합니다.
|
|
78
|
-
*/
|
|
79
|
-
updateElement(tag) {
|
|
80
|
-
tag = tag?.trim();
|
|
81
|
-
if (!tag) {
|
|
82
|
-
this.element = null;
|
|
83
|
-
void super.error(new Error("Tag is required"));
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (!customElements.get(tag)) {
|
|
87
|
-
this.element = null;
|
|
88
|
-
void super.error(new Error(`Unknown tag: ${tag}`));
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
this.element = document.createElement(tag);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* `properties` 객체의 키가 렌더링된 엘리먼트의 프로퍼티 이름과 일치하면 자동으로 할당됩니다.
|
|
95
|
-
* `properties` 객체에 위험한 프로퍼티가 포함되어 있는지 검증하여, 유효한 경우에만 할당합니다.
|
|
96
|
-
* 할당 중 오류가 발생한 경우, 에러 처리합니다.
|
|
97
|
-
*/
|
|
98
|
-
updateProperties(element, props) {
|
|
99
|
-
if (this.validateProperties(props)) {
|
|
100
|
-
try {
|
|
101
|
-
Object.assign(element, props);
|
|
102
|
-
} catch (error) {
|
|
103
|
-
void super.error(error);
|
|
104
|
-
}
|
|
105
|
-
} else {
|
|
106
|
-
void super.error(new Error(`Not allowed properties: ${JSON.stringify(props)}`));
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* `properties` 객체에 위험한 프로퍼티가 포함되어 있는지 검증합니다.
|
|
111
|
-
* DOM 조작이나 이벤트 핸들러로 악용될 수 있는 프로퍼티를 최소한으로 차단합니다.
|
|
112
|
-
*/
|
|
113
|
-
validateProperties(props) {
|
|
114
|
-
if (typeof props !== "object" || props === null || Array.isArray(props)) {
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
const obj = props;
|
|
118
|
-
for (const key of Object.keys(obj)) {
|
|
119
|
-
if (this.blacklist.includes(key)) return false;
|
|
120
|
-
}
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
__decorateClass([
|
|
125
|
-
property({ type: Boolean, reflect: true })
|
|
126
|
-
], UWidget.prototype, "loading");
|
|
127
|
-
__decorateClass([
|
|
128
|
-
property({ type: String })
|
|
129
|
-
], UWidget.prototype, "tag");
|
|
130
|
-
__decorateClass([
|
|
131
|
-
property({ type: Object })
|
|
132
|
-
], UWidget.prototype, "properties");
|
|
133
|
-
__decorateClass([
|
|
134
|
-
property({ type: Array })
|
|
135
|
-
], UWidget.prototype, "blacklist");
|
|
136
|
-
__decorateClass([
|
|
137
|
-
state()
|
|
138
|
-
], UWidget.prototype, "element");
|
|
139
|
-
|
|
140
|
-
export { UWidget };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const styles: import('lit').CSSResult;
|
package/dist/types/Actions.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { JsonSchema } from '../types/JsonSchema.js';
|
|
2
|
-
/** LLM에서 action-json 블록으로 출력되는 구조입니다.*/
|
|
3
|
-
export interface ActionSchema {
|
|
4
|
-
type: string;
|
|
5
|
-
properties?: Record<string, unknown>;
|
|
6
|
-
}
|
|
7
|
-
/** Action 정의 구조체 */
|
|
8
|
-
export interface ActionDefinition {
|
|
9
|
-
/** action 식별자 (action-json의 "type" 필드와 매칭) */
|
|
10
|
-
type: string;
|
|
11
|
-
/** LLM용 설명 */
|
|
12
|
-
description: string;
|
|
13
|
-
/** LLM용 속성 스키마 */
|
|
14
|
-
properties?: Record<string, JsonSchema>;
|
|
15
|
-
}
|
|
16
|
-
/** 프리셋 Action 비트 플래그 */
|
|
17
|
-
export declare enum PresetAction {
|
|
18
|
-
Questions = 1,
|
|
19
|
-
All = 1
|
|
20
|
-
}
|
|
21
|
-
/** 프리셋 Action 목록 (비트 플래그 순서대로) */
|
|
22
|
-
export declare const PRESET_ACTION_LIST: readonly [PresetAction];
|
|
23
|
-
/** 프리셋 Action 정의 매핑 */
|
|
24
|
-
export declare const PRESET_ACTION_DEFINITIONS: Map<PresetAction, ActionDefinition>;
|
package/dist/types/Actions.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var PresetAction = /* @__PURE__ */ ((PresetAction2) => {
|
|
2
|
-
PresetAction2[PresetAction2["Questions"] = 1] = "Questions";
|
|
3
|
-
PresetAction2[PresetAction2["All"] = 1 /* Questions */] = "All";
|
|
4
|
-
return PresetAction2;
|
|
5
|
-
})(PresetAction || {});
|
|
6
|
-
const PRESET_ACTION_LIST = [
|
|
7
|
-
1 /* Questions */
|
|
8
|
-
];
|
|
9
|
-
const PRESET_ACTION_DEFINITIONS = /* @__PURE__ */ new Map([
|
|
10
|
-
[
|
|
11
|
-
1 /* Questions */,
|
|
12
|
-
{
|
|
13
|
-
type: "question",
|
|
14
|
-
description: "Present a question to the user with clickable choices",
|
|
15
|
-
properties: {
|
|
16
|
-
question: {
|
|
17
|
-
type: "string",
|
|
18
|
-
description: 'Optional question text displayed above the choices (e.g. "What would you like to explore?")',
|
|
19
|
-
examples: ["What would you like to do next?"]
|
|
20
|
-
},
|
|
21
|
-
choices: {
|
|
22
|
-
type: "array",
|
|
23
|
-
items: { type: "string" },
|
|
24
|
-
minItems: 1,
|
|
25
|
-
maxItems: 5,
|
|
26
|
-
description: "Clickable choice buttons (1–5 items)",
|
|
27
|
-
examples: [["What are the main differences?", "Can you show me an example?", "What should I learn next?"]]
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
]);
|
|
33
|
-
|
|
34
|
-
export { PRESET_ACTION_DEFINITIONS, PRESET_ACTION_LIST, PresetAction };
|