@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.
Files changed (208) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/README.md +133 -16
  3. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js +9 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js +6 -0
  5. package/dist/_virtual/_glob-assets_raw/intent-prompt.md.1907474e.js +4 -0
  6. package/dist/_virtual/_glob-assets_raw/view-prompt.md.e0dbcffe.js +4 -0
  7. package/dist/components/blocks/UCodeBlock.d.ts +24 -2
  8. package/dist/components/blocks/UCodeBlock.js +65 -2
  9. package/dist/components/blocks/UCodeBlock.styles.js +10 -4
  10. package/dist/components/blocks/UFileBlock.d.ts +33 -0
  11. package/dist/components/blocks/UFileBlock.js +154 -0
  12. package/dist/components/blocks/UFileBlock.styles.js +128 -0
  13. package/dist/components/blocks/UJsonBlock.d.ts +44 -2
  14. package/dist/components/blocks/UJsonBlock.js +128 -3
  15. package/dist/components/blocks/UJsonBlock.styles.js +4 -4
  16. package/dist/components/blocks/UMarkedBlock.d.ts +44 -2
  17. package/dist/components/blocks/UMarkedBlock.js +154 -4
  18. package/dist/components/blocks/UMarkedBlock.styles.js +4 -4
  19. package/dist/components/blocks/URefBlock.d.ts +16 -2
  20. package/dist/components/blocks/URefBlock.js +58 -3
  21. package/dist/components/blocks/URefBlock.styles.js +4 -4
  22. package/dist/components/blocks/UTableBlock.d.ts +52 -0
  23. package/dist/components/blocks/UTableBlock.js +198 -0
  24. package/dist/components/blocks/UTableBlock.styles.js +133 -0
  25. package/dist/components/blocks/UTextBlock.d.ts +36 -2
  26. package/dist/components/blocks/UTextBlock.js +94 -4
  27. package/dist/components/blocks/UTextBlock.styles.js +4 -4
  28. package/dist/components/blocks/UThinkBlock.d.ts +30 -2
  29. package/dist/components/blocks/UThinkBlock.js +86 -4
  30. package/dist/components/blocks/UThinkBlock.styles.js +4 -4
  31. package/dist/components/blocks/UToolBlock.d.ts +19 -2
  32. package/dist/components/blocks/UToolBlock.js +68 -3
  33. package/dist/components/blocks/UToolBlock.styles.js +4 -4
  34. package/dist/components/buttons/UAttachButton.d.ts +21 -2
  35. package/dist/components/buttons/UAttachButton.js +61 -3
  36. package/dist/components/buttons/UAttachButton.styles.js +4 -4
  37. package/dist/components/buttons/UCopyButton.d.ts +19 -2
  38. package/dist/components/buttons/UCopyButton.js +57 -3
  39. package/dist/components/buttons/UCopyButton.styles.js +4 -4
  40. package/dist/components/buttons/UVoteButton.d.ts +14 -3
  41. package/dist/components/buttons/UVoteButton.js +62 -3
  42. package/dist/components/buttons/UVoteButton.styles.js +4 -4
  43. package/dist/components/intents/UQuestionIntent.d.ts +22 -0
  44. package/dist/components/intents/UQuestionIntent.js +41 -0
  45. package/dist/components/intents/UQuestionIntent.styles.js +43 -0
  46. package/dist/components/message/UMessage.d.ts +18 -2
  47. package/dist/components/message/UMessage.js +47 -2
  48. package/dist/components/message/UMessage.styles.js +42 -15
  49. package/dist/components/prompt/UPrompt.d.ts +32 -2
  50. package/dist/components/prompt/UPrompt.js +118 -2
  51. package/dist/components/prompt/UPrompt.styles.js +43 -5
  52. package/dist/components/references/URefCard.d.ts +30 -2
  53. package/dist/components/references/URefCard.js +97 -2
  54. package/dist/components/references/URefCard.styles.js +4 -4
  55. package/dist/components/references/URefCardGroup.d.ts +25 -2
  56. package/dist/components/references/URefCardGroup.js +69 -4
  57. package/dist/components/references/URefCardGroup.styles.js +4 -4
  58. package/dist/components/references/URefTag.d.ts +12 -2
  59. package/dist/components/references/URefTag.js +37 -2
  60. package/dist/components/references/URefTag.styles.js +4 -4
  61. package/dist/components/views/UChartView.d.ts +39 -0
  62. package/dist/components/views/UChartView.js +167 -0
  63. package/dist/components/views/UChartView.styles.js +86 -0
  64. package/dist/components/views/UImagesView.d.ts +33 -0
  65. package/dist/components/views/UImagesView.js +144 -0
  66. package/dist/components/views/UImagesView.styles.d.ts +1 -0
  67. package/dist/components/views/UImagesView.styles.js +219 -0
  68. package/dist/components/views/UMapView.d.ts +24 -0
  69. package/dist/components/views/UMapView.js +45 -0
  70. package/dist/components/views/UMapView.styles.d.ts +1 -0
  71. package/dist/components/views/UMapView.styles.js +47 -0
  72. package/dist/components/views/UVideoView.d.ts +25 -0
  73. package/dist/components/views/UVideoView.js +81 -0
  74. package/dist/components/views/UVideoView.styles.d.ts +1 -0
  75. package/dist/components/views/UVideoView.styles.js +36 -0
  76. package/dist/components/views/UView.d.ts +46 -0
  77. package/dist/components/views/UView.js +113 -0
  78. package/dist/components/views/UView.styles.d.ts +1 -0
  79. package/dist/components/views/UView.styles.js +33 -0
  80. package/dist/events/AttachEvent.d.ts +9 -0
  81. package/dist/events/ChoiceEvent.d.ts +9 -0
  82. package/dist/events/SendEvent.d.ts +7 -0
  83. package/dist/events/StopEvent.d.ts +7 -0
  84. package/dist/index.d.ts +15 -6
  85. package/dist/index.js +28 -38
  86. package/dist/react/UAttachButton.d.ts +11 -0
  87. package/dist/react/UAttachButton.js +12 -0
  88. package/dist/react/UChartView.d.ts +9 -0
  89. package/dist/react/UChartView.js +10 -0
  90. package/dist/react/UCodeBlock.d.ts +9 -0
  91. package/dist/react/UCodeBlock.js +10 -0
  92. package/dist/react/UCopyButton.d.ts +9 -0
  93. package/dist/react/UCopyButton.js +10 -0
  94. package/dist/react/UFileBlock.d.ts +11 -0
  95. package/dist/react/UFileBlock.js +12 -0
  96. package/dist/react/UImagesView.d.ts +9 -0
  97. package/dist/react/UImagesView.js +10 -0
  98. package/dist/react/UJsonBlock.d.ts +9 -0
  99. package/dist/react/UJsonBlock.js +10 -0
  100. package/dist/react/UMapView.d.ts +9 -0
  101. package/dist/react/UMapView.js +10 -0
  102. package/dist/react/UMarkedBlock.d.ts +9 -0
  103. package/dist/react/UMarkedBlock.js +10 -0
  104. package/dist/react/UMessage.d.ts +9 -0
  105. package/dist/react/UMessage.js +10 -0
  106. package/dist/react/UPrompt.d.ts +13 -0
  107. package/dist/react/UPrompt.js +13 -0
  108. package/dist/react/UQuestionIntent.d.ts +11 -0
  109. package/dist/react/UQuestionIntent.js +12 -0
  110. package/dist/react/URefBlock.d.ts +9 -0
  111. package/dist/react/URefBlock.js +10 -0
  112. package/dist/react/URefCard.d.ts +9 -0
  113. package/dist/react/URefCard.js +10 -0
  114. package/dist/react/URefCardGroup.d.ts +9 -0
  115. package/dist/react/URefCardGroup.js +10 -0
  116. package/dist/react/URefTag.d.ts +9 -0
  117. package/dist/react/URefTag.js +10 -0
  118. package/dist/react/UTableBlock.d.ts +9 -0
  119. package/dist/react/UTableBlock.js +10 -0
  120. package/dist/react/UTextBlock.d.ts +9 -0
  121. package/dist/react/UTextBlock.js +10 -0
  122. package/dist/react/UThinkBlock.d.ts +9 -0
  123. package/dist/react/UThinkBlock.js +10 -0
  124. package/dist/react/UToolBlock.d.ts +9 -0
  125. package/dist/react/UToolBlock.js +10 -0
  126. package/dist/react/UVideoView.d.ts +9 -0
  127. package/dist/react/UVideoView.js +10 -0
  128. package/dist/react/UView.d.ts +9 -0
  129. package/dist/react/UView.js +10 -0
  130. package/dist/react/UVoteButton.d.ts +9 -0
  131. package/dist/react/UVoteButton.js +10 -0
  132. package/dist/react/index.d.ts +23 -0
  133. package/dist/react/index.js +23 -0
  134. package/dist/types/BlockItem.d.ts +21 -1
  135. package/dist/types/Intents.d.ts +26 -0
  136. package/dist/types/Intents.js +30 -0
  137. package/dist/types/JsonSchema.d.ts +59 -0
  138. package/dist/types/Views.d.ts +34 -0
  139. package/dist/types/Views.js +150 -0
  140. package/dist/utilities/IntentPromptBuilder.d.ts +40 -0
  141. package/dist/utilities/IntentPromptBuilder.js +95 -0
  142. package/dist/utilities/ViewPromptBuilder.d.ts +28 -0
  143. package/dist/utilities/ViewPromptBuilder.js +76 -0
  144. package/dist/utilities/dom-agent/DOMAgent.d.ts +74 -0
  145. package/dist/utilities/dom-agent/DOMController.d.ts +78 -0
  146. package/dist/utilities/dom-agent/DOMPromptBuilder.d.ts +54 -0
  147. package/dist/utilities/dom-agent/DOMScanner.d.ts +83 -0
  148. package/dist/utilities/dom-agent/index.d.ts +9 -0
  149. package/dist/utilities/dom-agent/types.d.ts +209 -0
  150. package/package.json +34 -18
  151. package/dist/components/blocks/UCodeBlock.component.d.ts +0 -23
  152. package/dist/components/blocks/UCodeBlock.component.js +0 -76
  153. package/dist/components/blocks/UJsonBlock.component.d.ts +0 -45
  154. package/dist/components/blocks/UJsonBlock.component.js +0 -140
  155. package/dist/components/blocks/UMarkedBlock.component.d.ts +0 -45
  156. package/dist/components/blocks/UMarkedBlock.component.js +0 -129
  157. package/dist/components/blocks/URefBlock.component.d.ts +0 -17
  158. package/dist/components/blocks/URefBlock.component.js +0 -74
  159. package/dist/components/blocks/UTextBlock.component.d.ts +0 -37
  160. package/dist/components/blocks/UTextBlock.component.js +0 -123
  161. package/dist/components/blocks/UThinkBlock.component.d.ts +0 -23
  162. package/dist/components/blocks/UThinkBlock.component.js +0 -90
  163. package/dist/components/blocks/UToolBlock.component.d.ts +0 -20
  164. package/dist/components/blocks/UToolBlock.component.js +0 -80
  165. package/dist/components/buttons/UAttachButton.component.d.ts +0 -22
  166. package/dist/components/buttons/UAttachButton.component.js +0 -89
  167. package/dist/components/buttons/UCopyButton.component.d.ts +0 -20
  168. package/dist/components/buttons/UCopyButton.component.js +0 -81
  169. package/dist/components/buttons/UReportButton.component.d.ts +0 -9
  170. package/dist/components/buttons/UReportButton.component.js +0 -36
  171. package/dist/components/buttons/UReportButton.d.ts +0 -7
  172. package/dist/components/buttons/UReportButton.js +0 -5
  173. package/dist/components/buttons/UReportButton.styles.js +0 -14
  174. package/dist/components/buttons/URetryButton.component.d.ts +0 -11
  175. package/dist/components/buttons/URetryButton.component.js +0 -53
  176. package/dist/components/buttons/URetryButton.d.ts +0 -7
  177. package/dist/components/buttons/URetryButton.js +0 -5
  178. package/dist/components/buttons/URetryButton.styles.js +0 -26
  179. package/dist/components/buttons/UShareButton.component.d.ts +0 -9
  180. package/dist/components/buttons/UShareButton.component.js +0 -36
  181. package/dist/components/buttons/UShareButton.d.ts +0 -7
  182. package/dist/components/buttons/UShareButton.js +0 -5
  183. package/dist/components/buttons/UShareButton.styles.js +0 -14
  184. package/dist/components/buttons/UVoteButton.component.d.ts +0 -15
  185. package/dist/components/buttons/UVoteButton.component.js +0 -70
  186. package/dist/components/loaders/UDotLoader.component.d.ts +0 -9
  187. package/dist/components/loaders/UDotLoader.component.js +0 -23
  188. package/dist/components/loaders/UDotLoader.d.ts +0 -7
  189. package/dist/components/loaders/UDotLoader.js +0 -5
  190. package/dist/components/loaders/UDotLoader.styles.js +0 -50
  191. package/dist/components/message/UMessage.component.d.ts +0 -19
  192. package/dist/components/message/UMessage.component.js +0 -90
  193. package/dist/components/prompt/UPrompt.component.d.ts +0 -25
  194. package/dist/components/prompt/UPrompt.component.js +0 -113
  195. package/dist/components/references/URefCard.component.d.ts +0 -24
  196. package/dist/components/references/URefCard.component.js +0 -105
  197. package/dist/components/references/URefCardGroup.component.d.ts +0 -25
  198. package/dist/components/references/URefCardGroup.component.js +0 -88
  199. package/dist/components/references/URefTag.component.d.ts +0 -13
  200. package/dist/components/references/URefTag.component.js +0 -54
  201. package/dist/events/UCancelEvent.d.ts +0 -6
  202. package/dist/events/USubmitEvent.d.ts +0 -6
  203. package/dist/utilities/converters.d.ts +0 -9
  204. package/dist/utilities/converters.js +0 -19
  205. /package/dist/components/{buttons/UReportButton.styles.d.ts → blocks/UFileBlock.styles.d.ts} +0 -0
  206. /package/dist/components/{buttons/URetryButton.styles.d.ts → blocks/UTableBlock.styles.d.ts} +0 -0
  207. /package/dist/components/{buttons/UShareButton.styles.d.ts → intents/UQuestionIntent.styles.d.ts} +0 -0
  208. /package/dist/components/{loaders/UDotLoader.styles.d.ts → views/UChartView.styles.d.ts} +0 -0
@@ -0,0 +1,24 @@
1
+ import { nothing } from 'lit';
2
+ import { UElement } from '@iyulab/components/dist/components/UElement.js';
3
+ /**
4
+ * 지도 뷰 컴포넌트 (OpenStreetMap embed)
5
+ */
6
+ export declare class UMapView extends UElement {
7
+ static styles: import('lit').CSSResultGroup[];
8
+ /** 위도 (latitude) */
9
+ lat?: number;
10
+ /** 경도 (longitude) */
11
+ lng?: number;
12
+ /** 지도 확대 레벨 (zoom level, 기본값: 15) */
13
+ zoom: number;
14
+ /** 지도 마커 라벨 */
15
+ label?: string;
16
+ /** 지도 마커 설명 */
17
+ description?: string;
18
+ render(): import('lit-html').TemplateResult<1> | typeof nothing;
19
+ }
20
+ declare global {
21
+ interface HTMLElementTagNameMap {
22
+ "u-map-view": UMapView;
23
+ }
24
+ }
@@ -0,0 +1,45 @@
1
+ import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js";
2
+ import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js";
3
+ import { styles } from "./UMapView.styles.js";
4
+ import { html, nothing } from "lit";
5
+ import { customElement, property } from "lit/decorators.js";
6
+ import { UElement } from "@iyulab/components/dist/components/UElement.js";
7
+ //#region src/components/views/UMapView.ts
8
+ var UMapView = class UMapView extends UElement {
9
+ constructor(..._args) {
10
+ super(..._args);
11
+ this.zoom = 15;
12
+ }
13
+ static {
14
+ this.styles = [super.styles, styles];
15
+ }
16
+ render() {
17
+ if (this.lat == null || this.lng == null) return nothing;
18
+ const offset = 360 / Math.pow(2, this.zoom);
19
+ const embedUrl = `https://www.openstreetmap.org/export/embed.html?bbox=${`${this.lng - offset},${this.lat - offset},${this.lng + offset},${this.lat + offset}`}&layer=mapnik&marker=${this.lat},${this.lng}`;
20
+ const linkUrl = `https://www.openstreetmap.org/?mlat=${this.lat}&mlon=${this.lng}#map=${this.zoom}/${this.lat}/${this.lng}`;
21
+ return html`
22
+ <iframe
23
+ src="${embedUrl}"
24
+ loading="lazy"
25
+ ></iframe>
26
+ <a class="caption"
27
+ ?hidden=${!this.label && !this.description}
28
+ href="${linkUrl}"
29
+ target="_blank"
30
+ rel="noopener"
31
+ >
32
+ <strong>${this.label}</strong>
33
+ <span>${this.description}</span>
34
+ </a>
35
+ `;
36
+ }
37
+ };
38
+ __decorate([property({ type: Number }), __decorateMetadata("design:type", Number)], UMapView.prototype, "lat", void 0);
39
+ __decorate([property({ type: Number }), __decorateMetadata("design:type", Number)], UMapView.prototype, "lng", void 0);
40
+ __decorate([property({ type: Number }), __decorateMetadata("design:type", Object)], UMapView.prototype, "zoom", void 0);
41
+ __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UMapView.prototype, "label", void 0);
42
+ __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UMapView.prototype, "description", void 0);
43
+ UMapView = __decorate([customElement("u-map-view")], UMapView);
44
+ //#endregion
45
+ export { UMapView };
@@ -0,0 +1 @@
1
+ export declare const styles: import('lit').CSSResult;
@@ -0,0 +1,47 @@
1
+ import { css } from "lit";
2
+ //#region src/components/views/UMapView.styles.ts
3
+ var styles = css`
4
+ :host {
5
+ position: relative;
6
+ display: block;
7
+ width: 100%;
8
+ border-radius: 8px;
9
+ overflow: hidden;
10
+ margin: 0.75em 0;
11
+ }
12
+
13
+ iframe {
14
+ width: 100%;
15
+ height: 300px;
16
+ display: block;
17
+ border: none;
18
+ }
19
+
20
+ .caption {
21
+ text-decoration: none;
22
+ max-width: 60%;
23
+ position: absolute;
24
+ top: 8px;
25
+ right: 8px;
26
+ display: flex;
27
+ flex-direction: column;
28
+ gap: 0.25em;
29
+ padding: 0.25em 0.5em;
30
+ color: #fff;
31
+ background: rgba(0, 0, 0, 0.6);
32
+ border-radius: 6px;
33
+ backdrop-filter: blur(4px);
34
+ }
35
+ .caption:hover {
36
+ background: rgba(0, 0, 0, 0.8);
37
+ }
38
+ .caption strong {
39
+ font-size: 0.8em;
40
+ }
41
+ .caption span {
42
+ font-size: 0.7em;
43
+ opacity: 0.8;
44
+ }
45
+ `;
46
+ //#endregion
47
+ export { styles };
@@ -0,0 +1,25 @@
1
+ import { nothing, PropertyValues } from 'lit';
2
+ import { UElement } from '@iyulab/components/dist/components/UElement.js';
3
+ /**
4
+ * 비디오 플레이어 뷰 컴포넌트
5
+ */
6
+ export declare class UVideoView extends UElement {
7
+ static styles: import('lit').CSSResultGroup[];
8
+ /** 비디오 URL (YouTube, Vimeo, 직접 파일) */
9
+ src?: string;
10
+ /** 포스터 이미지 URL */
11
+ poster?: string;
12
+ /** 비디오 비율 */
13
+ ratio: '16:9' | '4:3' | '1:1';
14
+ protected updated(changedProperties: PropertyValues): void;
15
+ render(): import('lit-html').TemplateResult<1> | typeof nothing;
16
+ private isYouTube;
17
+ private isVimeo;
18
+ private extractYouTubeId;
19
+ private extractVimeoId;
20
+ }
21
+ declare global {
22
+ interface HTMLElementTagNameMap {
23
+ "u-video-view": UVideoView;
24
+ }
25
+ }
@@ -0,0 +1,81 @@
1
+ import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js";
2
+ import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js";
3
+ import { styles } from "./UVideoView.styles.js";
4
+ import { html, nothing } from "lit";
5
+ import { customElement, property } from "lit/decorators.js";
6
+ import { UElement } from "@iyulab/components/dist/components/UElement.js";
7
+ import { ifDefined } from "lit/directives/if-defined.js";
8
+ //#region src/components/views/UVideoView.ts
9
+ var UVideoView = class UVideoView extends UElement {
10
+ constructor(..._args) {
11
+ super(..._args);
12
+ this.ratio = "16:9";
13
+ }
14
+ static {
15
+ this.styles = [super.styles, styles];
16
+ }
17
+ updated(changedProperties) {
18
+ super.updated(changedProperties);
19
+ if (changedProperties.has("ratio")) this.style.setProperty("--video-ratio", this.ratio.replace(":", " / "));
20
+ }
21
+ render() {
22
+ if (!this.src) return nothing;
23
+ if (this.isYouTube(this.src)) {
24
+ const videoId = this.extractYouTubeId(this.src);
25
+ if (videoId) return html`
26
+ <div class="video-wrapper">
27
+ <iframe
28
+ src="https://www.youtube.com/embed/${videoId}"
29
+ loading="lazy"
30
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
31
+ allowfullscreen
32
+ ></iframe>
33
+ </div>
34
+ `;
35
+ }
36
+ if (this.isVimeo(this.src)) {
37
+ const videoId = this.extractVimeoId(this.src);
38
+ if (videoId) return html`
39
+ <div class="video-wrapper">
40
+ <iframe
41
+ src="https://player.vimeo.com/video/${videoId}"
42
+ loading="lazy"
43
+ allow="autoplay; fullscreen; picture-in-picture"
44
+ allowfullscreen
45
+ ></iframe>
46
+ </div>
47
+ `;
48
+ }
49
+ return html`
50
+ <video
51
+ src=${this.src}
52
+ poster=${ifDefined(this.poster)}
53
+ controls
54
+ playsinline
55
+ ></video>
56
+ `;
57
+ }
58
+ isYouTube(url) {
59
+ return /youtube\.com|youtu\.be/i.test(url);
60
+ }
61
+ isVimeo(url) {
62
+ return /vimeo\.com/i.test(url);
63
+ }
64
+ extractYouTubeId(url) {
65
+ for (const pattern of [/(?:youtube\.com\/watch\?v=|youtu\.be\/)([^&\s]+)/, /youtube\.com\/embed\/([^&\s]+)/]) {
66
+ const match = url.match(pattern);
67
+ if (match && match[1]) return match[1];
68
+ }
69
+ return null;
70
+ }
71
+ extractVimeoId(url) {
72
+ const match = url.match(/vimeo\.com\/(\d+)/);
73
+ return match ? match[1] : null;
74
+ }
75
+ };
76
+ __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UVideoView.prototype, "src", void 0);
77
+ __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UVideoView.prototype, "poster", void 0);
78
+ __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UVideoView.prototype, "ratio", void 0);
79
+ UVideoView = __decorate([customElement("u-video-view")], UVideoView);
80
+ //#endregion
81
+ export { UVideoView };
@@ -0,0 +1 @@
1
+ export declare const styles: import('lit').CSSResult;
@@ -0,0 +1,36 @@
1
+ import { css } from "lit";
2
+ //#region src/components/views/UVideoView.styles.ts
3
+ var styles = css`
4
+ :host {
5
+ --video-ratio: 16 / 9;
6
+ }
7
+
8
+ :host {
9
+ display: block;
10
+ position: relative;
11
+ width: 100%;
12
+ max-width: 800px;
13
+ margin: 0.75em auto;
14
+ }
15
+
16
+ video {
17
+ width: 100%;
18
+ aspect-ratio: var(--video-ratio);
19
+ border-radius: 8px;
20
+ background: #000;
21
+ }
22
+
23
+ .video-wrapper {
24
+ width: 100%;
25
+ aspect-ratio: var(--video-ratio);
26
+ }
27
+
28
+ .video-wrapper iframe {
29
+ width: 100%;
30
+ height: 100%;
31
+ border: none;
32
+ border-radius: 8px;
33
+ }
34
+ `;
35
+ //#endregion
36
+ export { styles };
@@ -0,0 +1,46 @@
1
+ import { nothing, PropertyValues } from 'lit';
2
+ import { UDataElement } from '@iyulab/components/dist/components/UDataElement.js';
3
+ /**
4
+ * 뷰 컴포넌트를 렌더링 또는 오류를 표시하는 컴포넌트입니다.
5
+ */
6
+ export declare class UView extends UDataElement {
7
+ static styles: (import('lit').CSSResult | import('lit').CSSResultGroup[])[];
8
+ /** 로딩 상태입니다. `true`인 경우, 위젯이 로딩 중임을 나타냅니다. */
9
+ loading: boolean;
10
+ /** `tag` 프로퍼티에 등록된 커스텀 엘리먼트를 렌더링하는 컴포넌트입니다. */
11
+ tag?: string;
12
+ /** `properties` 객체의 키가 렌더링된 엘리먼트의 프로퍼티 이름과 일치하면 자동으로 할당됩니다. */
13
+ properties?: Record<string, unknown>;
14
+ /** `properties` 객체에서 위험한 프로퍼티 이름을 지정하여 차단할 수 있습니다. */
15
+ blacklist: string[];
16
+ /** 실제 렌더링된 엘리먼트입니다. `tag` 프로퍼티가 변경될 때마다 업데이트됩니다. */
17
+ private element;
18
+ protected willUpdate(changedProperties: PropertyValues): void;
19
+ render(): HTMLElement | import('lit-html').TemplateResult<1> | typeof nothing;
20
+ /**
21
+ * `loading`이 `true`인 경우, 에러 UI로 대체하지 않습니다.
22
+ */
23
+ protected error(error: Error): Promise<void>;
24
+ /**
25
+ * `tag` 프로퍼티에 등록된 커스텀 엘리먼트를 렌더링하는 컴포넌트입니다.
26
+ * `tag`가 변경될 때마다 등록된 커스텀 엘리먼트를 새로 생성하여 렌더링합니다.
27
+ * `tag`가 유효하지 않거나 등록된 커스텀 엘리먼트가 아닌 경우, 에러 처리합니다.
28
+ */
29
+ private updateElement;
30
+ /**
31
+ * `properties` 객체의 키가 렌더링된 엘리먼트의 프로퍼티 이름과 일치하면 자동으로 할당됩니다.
32
+ * `properties` 객체에 위험한 프로퍼티가 포함되어 있는지 검증하여, 유효한 경우에만 할당합니다.
33
+ * 할당 중 오류가 발생한 경우, 에러 처리합니다.
34
+ */
35
+ private updateProperties;
36
+ /**
37
+ * `properties` 객체에 위험한 프로퍼티가 포함되어 있는지 검증합니다.
38
+ * DOM 조작이나 이벤트 핸들러로 악용될 수 있는 프로퍼티를 최소한으로 차단합니다.
39
+ */
40
+ private validateProperties;
41
+ }
42
+ declare global {
43
+ interface HTMLElementTagNameMap {
44
+ "u-view": UView;
45
+ }
46
+ }
@@ -0,0 +1,113 @@
1
+ import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js";
2
+ import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js";
3
+ import { styles } from "./UView.styles.js";
4
+ import { html, nothing } from "lit";
5
+ import { customElement, property, state } from "lit/decorators.js";
6
+ import { UDataElement } from "@iyulab/components/dist/components/UDataElement.js";
7
+ import "@iyulab/components/dist/components/skeleton/USkeleton.js";
8
+ //#region src/components/views/UView.ts
9
+ var _ref;
10
+ var DEFAULT_BLACKLIST = [
11
+ "innerHTML",
12
+ "outerHTML",
13
+ "textContent",
14
+ "innerText",
15
+ "outerText",
16
+ "srcdoc"
17
+ ];
18
+ var UView = class UView extends UDataElement {
19
+ constructor(..._args) {
20
+ super(..._args);
21
+ this.loading = false;
22
+ this.blacklist = DEFAULT_BLACKLIST;
23
+ this.element = null;
24
+ }
25
+ static {
26
+ this.styles = [super.styles, styles];
27
+ }
28
+ willUpdate(changedProperties) {
29
+ super.willUpdate(changedProperties);
30
+ if (changedProperties.has("tag")) this.updateElement(this.tag);
31
+ if (changedProperties.has("properties") && this.element) this.updateProperties(this.element, this.properties);
32
+ if (changedProperties.has("blacklist") && this.element && this.properties) this.updateProperties(this.element, this.properties);
33
+ }
34
+ render() {
35
+ if (this.loading === true) return html`
36
+ <div class="sk-container">
37
+ <div class="sk-card">
38
+ <u-skeleton effect="shimmer" width="100%" height="5em" shape="rectangle"></u-skeleton>
39
+ <u-skeleton effect="shimmer" width="80%" height="0.8em" shape="rounded"></u-skeleton>
40
+ <u-skeleton effect="shimmer" width="40%" height="0.75em" shape="rounded"></u-skeleton>
41
+ </div>
42
+ <div class="sk-doc">
43
+ <u-skeleton effect="shimmer" width="40%" height="0.75em" shape="rounded"></u-skeleton>
44
+ <u-skeleton effect="shimmer" width="80%" height="0.75em" shape="rounded"></u-skeleton>
45
+ <u-skeleton effect="shimmer" width="60%" height="0.8em" shape="rounded"></u-skeleton>
46
+ <u-skeleton effect="shimmer" width="100%" height="0.8em" shape="rounded"></u-skeleton>
47
+ <u-skeleton effect="shimmer" width="80%" height="0.8em" shape="rounded"></u-skeleton>
48
+ </div>
49
+ </div>`;
50
+ if (this.element != null) return this.element;
51
+ return nothing;
52
+ }
53
+ /**
54
+ * `loading`이 `true`인 경우, 에러 UI로 대체하지 않습니다.
55
+ */
56
+ async error(error) {
57
+ if (this.loading) return;
58
+ await super.error(error);
59
+ }
60
+ /**
61
+ * `tag` 프로퍼티에 등록된 커스텀 엘리먼트를 렌더링하는 컴포넌트입니다.
62
+ * `tag`가 변경될 때마다 등록된 커스텀 엘리먼트를 새로 생성하여 렌더링합니다.
63
+ * `tag`가 유효하지 않거나 등록된 커스텀 엘리먼트가 아닌 경우, 에러 처리합니다.
64
+ */
65
+ updateElement(tag) {
66
+ tag = tag?.trim();
67
+ if (!tag) {
68
+ this.element = null;
69
+ super.error(/* @__PURE__ */ new Error("Tag is required"));
70
+ return;
71
+ }
72
+ if (!customElements.get(tag)) {
73
+ this.element = null;
74
+ super.error(/* @__PURE__ */ new Error(`Unknown tag: ${tag}`));
75
+ return;
76
+ }
77
+ this.element = document.createElement(tag);
78
+ }
79
+ /**
80
+ * `properties` 객체의 키가 렌더링된 엘리먼트의 프로퍼티 이름과 일치하면 자동으로 할당됩니다.
81
+ * `properties` 객체에 위험한 프로퍼티가 포함되어 있는지 검증하여, 유효한 경우에만 할당합니다.
82
+ * 할당 중 오류가 발생한 경우, 에러 처리합니다.
83
+ */
84
+ updateProperties(element, props) {
85
+ if (this.validateProperties(props)) try {
86
+ Object.assign(element, props);
87
+ } catch (error) {
88
+ super.error(error);
89
+ }
90
+ else super.error(/* @__PURE__ */ new Error(`Not allowed properties: ${JSON.stringify(props)}`));
91
+ }
92
+ /**
93
+ * `properties` 객체에 위험한 프로퍼티가 포함되어 있는지 검증합니다.
94
+ * DOM 조작이나 이벤트 핸들러로 악용될 수 있는 프로퍼티를 최소한으로 차단합니다.
95
+ */
96
+ validateProperties(props) {
97
+ if (typeof props !== "object" || props === null || Array.isArray(props)) return false;
98
+ const obj = props;
99
+ for (const key of Object.keys(obj)) if (this.blacklist.includes(key)) return false;
100
+ return true;
101
+ }
102
+ };
103
+ __decorate([property({
104
+ type: Boolean,
105
+ reflect: true
106
+ }), __decorateMetadata("design:type", Object)], UView.prototype, "loading", void 0);
107
+ __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UView.prototype, "tag", void 0);
108
+ __decorate([property({ type: Object }), __decorateMetadata("design:type", typeof (_ref = typeof Record !== "undefined" && Record) === "function" ? _ref : Object)], UView.prototype, "properties", void 0);
109
+ __decorate([property({ type: Array }), __decorateMetadata("design:type", Array)], UView.prototype, "blacklist", void 0);
110
+ __decorate([state(), __decorateMetadata("design:type", Object)], UView.prototype, "element", void 0);
111
+ UView = __decorate([customElement("u-view")], UView);
112
+ //#endregion
113
+ export { UView };
@@ -0,0 +1 @@
1
+ export declare const styles: import('lit').CSSResult;
@@ -0,0 +1,33 @@
1
+ import { css } from "lit";
2
+ //#region src/components/views/UView.styles.ts
3
+ var styles = css`
4
+ :host {
5
+ display: contents;
6
+ }
7
+
8
+ /* ── 스켈레톤: 카드(좌) + 문서(우) ── */
9
+ .sk-container {
10
+ display: flex;
11
+ flex-direction: row;
12
+ align-items: stretch;
13
+ gap: 1em;
14
+ margin: 0.75em 0;
15
+ width: 100%;
16
+ }
17
+
18
+ .sk-card {
19
+ flex: 0 0 40%;
20
+ display: flex;
21
+ flex-direction: column;
22
+ gap: 0.55em;
23
+ }
24
+
25
+ .sk-doc {
26
+ flex: 1;
27
+ display: flex;
28
+ flex-direction: column;
29
+ justify-content: space-between;
30
+ }
31
+ `;
32
+ //#endregion
33
+ export { styles };
@@ -0,0 +1,9 @@
1
+ export interface AttachEventDetail {
2
+ files: File[];
3
+ }
4
+ export type AttachEvent = CustomEvent<AttachEventDetail>;
5
+ declare global {
6
+ interface HTMLElementEventMap {
7
+ 'attach': AttachEvent;
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ export interface ChoiceEventDetail {
2
+ value: string;
3
+ }
4
+ export type ChoiceEvent = CustomEvent<ChoiceEventDetail>;
5
+ declare global {
6
+ interface HTMLElementEventMap {
7
+ 'choice': ChoiceEvent;
8
+ }
9
+ }
@@ -0,0 +1,7 @@
1
+ export type SendEventDetail = unknown;
2
+ export type SendEvent = CustomEvent<SendEventDetail>;
3
+ declare global {
4
+ interface HTMLElementEventMap {
5
+ 'send': SendEvent;
6
+ }
7
+ }
@@ -0,0 +1,7 @@
1
+ export type StopEventDetail = unknown;
2
+ export type StopEvent = CustomEvent<StopEventDetail>;
3
+ declare global {
4
+ interface HTMLElementEventMap {
5
+ 'stop': StopEvent;
6
+ }
7
+ }
package/dist/index.d.ts CHANGED
@@ -1,24 +1,33 @@
1
1
  export * from './components/blocks/UCodeBlock.js';
2
+ export * from './components/blocks/UFileBlock.js';
2
3
  export * from './components/blocks/UJsonBlock.js';
3
4
  export * from './components/blocks/UMarkedBlock.js';
4
5
  export * from './components/blocks/UTextBlock.js';
5
6
  export * from './components/blocks/UThinkBlock.js';
6
7
  export * from './components/blocks/UToolBlock.js';
7
8
  export * from './components/blocks/URefBlock.js';
9
+ export * from './components/blocks/UTableBlock.js';
8
10
  export * from './components/buttons/UAttachButton.js';
9
11
  export * from './components/buttons/UCopyButton.js';
10
12
  export * from './components/buttons/UVoteButton.js';
11
- export * from './components/buttons/UReportButton.js';
12
- export * from './components/buttons/URetryButton.js';
13
- export * from './components/buttons/UShareButton.js';
14
- export * from './components/loaders/UDotLoader.js';
15
13
  export * from './components/message/UMessage.js';
16
14
  export * from './components/prompt/UPrompt.js';
17
15
  export * from './components/references/URefTag.js';
18
16
  export * from './components/references/URefCard.js';
19
17
  export * from './components/references/URefCardGroup.js';
18
+ export * from './components/intents/UQuestionIntent.js';
19
+ export * from './components/views/UImagesView.js';
20
+ export * from './components/views/UVideoView.js';
21
+ export * from './components/views/UMapView.js';
22
+ export * from './components/views/UChartView.js';
23
+ export * from './components/views/UView.js';
20
24
  export type * from './types/BlockItem';
21
25
  export type * from './types/JsonNode';
26
+ export type * from './types/JsonSchema';
22
27
  export type * from './types/References';
23
- export type * from './events/UCancelEvent';
24
- export type * from './events/USubmitEvent';
28
+ export * from './types/Intents';
29
+ export * from './types/Views';
30
+ export type * from './events/SendEvent';
31
+ export type * from './events/StopEvent';
32
+ export * from './utilities/IntentPromptBuilder.js';
33
+ export * from './utilities/ViewPromptBuilder.js';
package/dist/index.js CHANGED
@@ -1,38 +1,28 @@
1
- import './components/blocks/UCodeBlock.js';
2
- import './components/blocks/UJsonBlock.js';
3
- import './components/blocks/UMarkedBlock.js';
4
- import './components/blocks/UTextBlock.js';
5
- import './components/blocks/UThinkBlock.js';
6
- import './components/blocks/UToolBlock.js';
7
- import './components/blocks/URefBlock.js';
8
- import './components/buttons/UAttachButton.js';
9
- import './components/buttons/UCopyButton.js';
10
- import './components/buttons/UVoteButton.js';
11
- import './components/buttons/UReportButton.js';
12
- import './components/buttons/URetryButton.js';
13
- import './components/buttons/UShareButton.js';
14
- import './components/loaders/UDotLoader.js';
15
- import './components/message/UMessage.js';
16
- import './components/prompt/UPrompt.js';
17
- import './components/references/URefTag.js';
18
- import './components/references/URefCard.js';
19
- import './components/references/URefCardGroup.js';
20
- export { UAttachButton } from './components/buttons/UAttachButton.component.js';
21
- export { UCodeBlock } from './components/blocks/UCodeBlock.component.js';
22
- export { UCopyButton } from './components/buttons/UCopyButton.component.js';
23
- export { UDotLoader } from './components/loaders/UDotLoader.component.js';
24
- export { UJsonBlock } from './components/blocks/UJsonBlock.component.js';
25
- export { UMarkedBlock } from './components/blocks/UMarkedBlock.component.js';
26
- export { UMessage } from './components/message/UMessage.component.js';
27
- export { UPrompt } from './components/prompt/UPrompt.component.js';
28
- export { URefBlock } from './components/blocks/URefBlock.component.js';
29
- export { URefCard } from './components/references/URefCard.component.js';
30
- export { URefCardGroup } from './components/references/URefCardGroup.component.js';
31
- export { URefTag } from './components/references/URefTag.component.js';
32
- export { UReportButton } from './components/buttons/UReportButton.component.js';
33
- export { URetryButton } from './components/buttons/URetryButton.component.js';
34
- export { UShareButton } from './components/buttons/UShareButton.component.js';
35
- export { UTextBlock } from './components/blocks/UTextBlock.component.js';
36
- export { UThinkBlock } from './components/blocks/UThinkBlock.component.js';
37
- export { UToolBlock } from './components/blocks/UToolBlock.component.js';
38
- export { UVoteButton } from './components/buttons/UVoteButton.component.js';
1
+ import { UCopyButton } from "./components/buttons/UCopyButton.js";
2
+ import { UCodeBlock } from "./components/blocks/UCodeBlock.js";
3
+ import { UFileBlock } from "./components/blocks/UFileBlock.js";
4
+ import { UJsonBlock } from "./components/blocks/UJsonBlock.js";
5
+ import { URefTag } from "./components/references/URefTag.js";
6
+ import { URefCard } from "./components/references/URefCard.js";
7
+ import { URefCardGroup } from "./components/references/URefCardGroup.js";
8
+ import { UTableBlock } from "./components/blocks/UTableBlock.js";
9
+ import { UView } from "./components/views/UView.js";
10
+ import { UMarkedBlock } from "./components/blocks/UMarkedBlock.js";
11
+ import { UTextBlock } from "./components/blocks/UTextBlock.js";
12
+ import { UThinkBlock } from "./components/blocks/UThinkBlock.js";
13
+ import { UToolBlock } from "./components/blocks/UToolBlock.js";
14
+ import { URefBlock } from "./components/blocks/URefBlock.js";
15
+ import { UAttachButton } from "./components/buttons/UAttachButton.js";
16
+ import { UVoteButton } from "./components/buttons/UVoteButton.js";
17
+ import { UMessage } from "./components/message/UMessage.js";
18
+ import { UPrompt } from "./components/prompt/UPrompt.js";
19
+ import { UQuestionIntent } from "./components/intents/UQuestionIntent.js";
20
+ import { UImagesView } from "./components/views/UImagesView.js";
21
+ import { UVideoView } from "./components/views/UVideoView.js";
22
+ import { UMapView } from "./components/views/UMapView.js";
23
+ import { UChartView } from "./components/views/UChartView.js";
24
+ import { PRESET_INTENT_DEFINITIONS, PRESET_INTENT_LIST, PresetIntent } from "./types/Intents.js";
25
+ import { PRESET_VIEW_DEFINITIONS, PRESET_VIEW_LIST, PresetView } from "./types/Views.js";
26
+ import { IntentPromptBuilder } from "./utilities/IntentPromptBuilder.js";
27
+ import { ViewPromptBuilder } from "./utilities/ViewPromptBuilder.js";
28
+ export { IntentPromptBuilder, PRESET_INTENT_DEFINITIONS, PRESET_INTENT_LIST, PRESET_VIEW_DEFINITIONS, PRESET_VIEW_LIST, PresetIntent, PresetView, UAttachButton, UChartView, UCodeBlock, UCopyButton, UFileBlock, UImagesView, UJsonBlock, UMapView, UMarkedBlock, UMessage, UPrompt, UQuestionIntent, URefBlock, URefCard, URefCardGroup, URefTag, UTableBlock, UTextBlock, UThinkBlock, UToolBlock, UVideoView, UView, UVoteButton, ViewPromptBuilder };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { UAttachButton as UAttachButtonElement } from '../components/buttons/UAttachButton';
3
+ import { type AttachEventDetail } from '../events/AttachEvent';
4
+
5
+ export declare const UAttachButton: React.ForwardRefExoticComponent<
6
+ Partial<UAttachButtonElement> & React.HTMLAttributes<UAttachButtonElement> & {
7
+ onAttach?: (event: CustomEvent<AttachEventDetail>) => void;
8
+ }
9
+ >;
10
+
11
+ export type UAttachButtonProps = React.ComponentProps<typeof UAttachButton>;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { createComponent } from '@lit/react';
3
+ import { UAttachButton } from '../components/buttons/UAttachButton.js';
4
+
5
+ export const UAttachButton = createComponent({
6
+ react: React,
7
+ tagName: 'u-attach-button',
8
+ elementClass: UAttachButton,
9
+ events: {
10
+ onAttach: 'attach',
11
+ },
12
+ });
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { UChartView as UChartViewElement } from '../components/views/UChartView';
3
+
4
+ export declare const UChartView: React.ForwardRefExoticComponent<
5
+ Partial<UChartViewElement> & React.HTMLAttributes<UChartViewElement> & {
6
+ }
7
+ >;
8
+
9
+ export type UChartViewProps = React.ComponentProps<typeof UChartView>;