@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
@@ -1,7 +1,24 @@
1
- import { UToolBlock } from './UToolBlock.component.js';
1
+ import { UElement } from '@iyulab/components/dist/components/UElement.js';
2
+ import { JsonNode } from '../../types/JsonNode.js';
3
+ /**
4
+ * 툴 사용 블록 컴포넌트입니다.
5
+ */
6
+ export declare class UToolBlock extends UElement {
7
+ static styles: import('lit').CSSResultGroup[];
8
+ /** 로딩 상태 */
9
+ loading: boolean;
10
+ /** 블록 접힘 여부 */
11
+ collapsed: boolean;
12
+ /** 헤딩 텍스트 */
13
+ title: string;
14
+ /** 입력 데이터 (JSON Object) */
15
+ input?: JsonNode;
16
+ /** 출력 데이터 (JSON Object) */
17
+ output?: JsonNode;
18
+ render(): import('lit-html').TemplateResult<1>;
19
+ }
2
20
  declare global {
3
21
  interface HTMLElementTagNameMap {
4
22
  "u-tool-block": UToolBlock;
5
23
  }
6
24
  }
7
- export { UToolBlock };
@@ -1,5 +1,70 @@
1
- import { UToolBlock } from './UToolBlock.component.js';
2
-
3
- UToolBlock.define("u-tool-block");
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 "./UJsonBlock.js";
4
+ import { styles } from "./UToolBlock.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/spinner/USpinner.js";
9
+ import { UElement } from "@iyulab/components/dist/components/UElement.js";
10
+ import { jsonAttrConverter } from "@iyulab/components/dist/utilities/converters.js";
11
+ //#region src/components/blocks/UToolBlock.ts
12
+ var UToolBlock = class UToolBlock extends UElement {
13
+ constructor(..._args) {
14
+ super(..._args);
15
+ this.loading = false;
16
+ this.collapsed = true;
17
+ this.title = "";
18
+ }
19
+ static {
20
+ this.styles = [super.styles, styles];
21
+ }
22
+ render() {
23
+ return html`
24
+ <div class="header" @click=${() => this.collapsed = !this.collapsed}>
25
+ ${this.loading ? html`<u-spinner></u-spinner>` : html`<u-icon lib="bootstrap" name="tools"></u-icon>`}
26
+ <div class="title">
27
+ ${this.title || "Tool Usage"}
28
+ </div>
29
+ <u-icon
30
+ lib="internal"
31
+ name=${this.collapsed ? "plus-lg" : "dash-lg"}
32
+ ></u-icon>
33
+ </div>
4
34
 
35
+ <div class="body" part="body" scrollable ?hidden=${this.collapsed}>
36
+ <div class="input-view" ?hidden=${!this.input}>
37
+ <u-json-block
38
+ .value=${this.input || {}}
39
+ ></u-json-block>
40
+ </div>
41
+ <div class="output-view" ?hidden=${!this.output}>
42
+ <u-icon lib="internal" name="chevron-down"></u-icon>
43
+ <u-json-block
44
+ .value=${this.output || {}}
45
+ ></u-json-block>
46
+ </div>
47
+ </div>
48
+ `;
49
+ }
50
+ };
51
+ __decorate([property({
52
+ type: Boolean,
53
+ reflect: true
54
+ }), __decorateMetadata("design:type", Boolean)], UToolBlock.prototype, "loading", void 0);
55
+ __decorate([property({
56
+ type: Boolean,
57
+ reflect: true
58
+ }), __decorateMetadata("design:type", Boolean)], UToolBlock.prototype, "collapsed", void 0);
59
+ __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UToolBlock.prototype, "title", void 0);
60
+ __decorate([property({
61
+ type: Object,
62
+ converter: jsonAttrConverter()
63
+ }), __decorateMetadata("design:type", Object)], UToolBlock.prototype, "input", void 0);
64
+ __decorate([property({
65
+ type: Object,
66
+ converter: jsonAttrConverter()
67
+ }), __decorateMetadata("design:type", Object)], UToolBlock.prototype, "output", void 0);
68
+ UToolBlock = __decorate([customElement("u-tool-block")], UToolBlock);
69
+ //#endregion
5
70
  export { UToolBlock };
@@ -1,6 +1,6 @@
1
- import { css } from 'lit';
2
-
3
- const styles = css`
1
+ import { css } from "lit";
2
+ //#region src/components/blocks/UToolBlock.styles.ts
3
+ var styles = css`
4
4
  :host {
5
5
  display: flex;
6
6
  flex-direction: column;
@@ -62,5 +62,5 @@ const styles = css`
62
62
  flex-direction: column;
63
63
  }
64
64
  `;
65
-
65
+ //#endregion
66
66
  export { styles };
@@ -1,7 +1,26 @@
1
- import { UAttachButton } from './UAttachButton.component.js';
1
+ import { UElement } from '@iyulab/components/dist/components/UElement.js';
2
+ /**
3
+ * 파일 첨부 버튼 컴포넌트입니다.
4
+ */
5
+ export declare class UAttachButton extends UElement {
6
+ static styles: import('lit').CSSResultGroup[];
7
+ /** 첨부 파일 유형 제한, 컴마로 구분된 MIME 타입 문자열 (예: "image/*,application/pdf") */
8
+ accept?: string;
9
+ /** 다중 파일 선택 가능 여부 */
10
+ multiple: boolean;
11
+ input?: HTMLInputElement;
12
+ render(): import('lit-html').TemplateResult<1>;
13
+ /**
14
+ * 버튼 클릭 핸들러
15
+ */
16
+ private handleButtonClick;
17
+ /**
18
+ * 파일 선택 이벤트 핸들러
19
+ */
20
+ private handleInputChange;
21
+ }
2
22
  declare global {
3
23
  interface HTMLElementTagNameMap {
4
24
  "u-attach-button": UAttachButton;
5
25
  }
6
26
  }
7
- export { UAttachButton };
@@ -1,5 +1,63 @@
1
- import { UAttachButton } from './UAttachButton.component.js';
2
-
3
- UAttachButton.define("u-attach-button");
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 "./UAttachButton.styles.js";
4
+ import { html } from "lit";
5
+ import { customElement, property, query } 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/UAttachButton.ts
11
+ var _ref;
12
+ var UAttachButton = class UAttachButton extends UElement {
13
+ constructor(..._args) {
14
+ super(..._args);
15
+ this.multiple = false;
16
+ this.handleButtonClick = () => {
17
+ if (!this.input) return;
18
+ this.input.click();
19
+ };
20
+ this.handleInputChange = (e) => {
21
+ e.preventDefault();
22
+ e.stopPropagation();
23
+ const target = e.target;
24
+ const files = target.files;
25
+ if (!files || files.length === 0) return;
26
+ this.fire("attach", { detail: { files: Array.from(files) } });
27
+ target.value = "";
28
+ };
29
+ }
30
+ static {
31
+ this.styles = [super.styles, styles];
32
+ }
33
+ render() {
34
+ return html`
35
+ <u-button part="base"
36
+ variant="ghost"
37
+ @click=${this.handleButtonClick}>
38
+ <u-icon part="icon"
39
+ lib="bootstrap"
40
+ name="paperclip"
41
+ ></u-icon>
42
+ </u-button>
4
43
 
44
+ <u-tooltip for="u-button" placement="bottom" distance="8">
45
+ <slot></slot>
46
+ </u-tooltip>
47
+
48
+ <input
49
+ hidden
50
+ type="file"
51
+ ?multiple=${this.multiple}
52
+ .accept=${this.accept || "*"}
53
+ @change=${this.handleInputChange}
54
+ />
55
+ `;
56
+ }
57
+ };
58
+ __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UAttachButton.prototype, "accept", void 0);
59
+ __decorate([property({ type: Boolean }), __decorateMetadata("design:type", Boolean)], UAttachButton.prototype, "multiple", void 0);
60
+ __decorate([query("input[type=\"file\"]"), __decorateMetadata("design:type", typeof (_ref = typeof HTMLInputElement !== "undefined" && HTMLInputElement) === "function" ? _ref : Object)], UAttachButton.prototype, "input", void 0);
61
+ UAttachButton = __decorate([customElement("u-attach-button")], UAttachButton);
62
+ //#endregion
5
63
  export { UAttachButton };
@@ -1,6 +1,6 @@
1
- import { css } from 'lit';
2
-
3
- const styles = css`
1
+ import { css } from "lit";
2
+ //#region src/components/buttons/UAttachButton.styles.ts
3
+ var styles = css`
4
4
  :host(:empty) u-tooltip {
5
5
  display: none;
6
6
  }
@@ -10,5 +10,5 @@ const styles = css`
10
10
  font-size: 16px;
11
11
  }
12
12
  `;
13
-
13
+ //#endregion
14
14
  export { styles };
@@ -1,7 +1,24 @@
1
- import { UCopyButton } from './UCopyButton.component.js';
1
+ import { UElement } from '@iyulab/components/dist/components/UElement.js';
2
+ /**
3
+ * 클릭 시 클립보드에 텍스트를 복사하는 버튼입니다. 복사 상태를 표시하기 위해 아이콘이 변경됩니다.
4
+ */
5
+ export declare class UCopyButton extends UElement {
6
+ static styles: import('lit').CSSResultGroup[];
7
+ /** 클립보드 복사 후 재사용 대기 시간 (ms) */
8
+ delay: number;
9
+ /** 복사할 텍스트를 설정합니다. */
10
+ value?: string;
11
+ /** 클립보드 복사 상태를 나타내는 플래그입니다. */
12
+ isCopied: boolean;
13
+ render(): import('lit-html').TemplateResult<1>;
14
+ /**
15
+ * 클립보드에 텍스트를 복사하는 메서드입니다.
16
+ * 복사 후 재사용 대기 시간이 설정되어 있으면, 일정 시간 후에 복사 가능 상태로 되돌립니다.
17
+ */
18
+ private copyToClipboard;
19
+ }
2
20
  declare global {
3
21
  interface HTMLElementTagNameMap {
4
22
  "u-copy-button": UCopyButton;
5
23
  }
6
24
  }
7
- export { UCopyButton };
@@ -1,5 +1,59 @@
1
- import { UCopyButton } from './UCopyButton.component.js';
2
-
3
- UCopyButton.define("u-copy-button");
1
+ import { styles } from "./UCopyButton.styles.js";
2
+ import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js";
3
+ import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js";
4
+ import { html } from "lit";
5
+ import { customElement, property, state } from "lit/decorators.js";
6
+ import "@iyulab/components/dist/components/icon/UIcon.js";
7
+ import "@iyulab/components/dist/components/icon-button/UIconButton.js";
8
+ import "@iyulab/components/dist/components/button/UButton.js";
9
+ import "@iyulab/components/dist/components/tooltip/UTooltip.js";
10
+ import { UElement } from "@iyulab/components/dist/components/UElement.js";
11
+ //#region src/components/buttons/UCopyButton.ts
12
+ var UCopyButton = class UCopyButton extends UElement {
13
+ constructor(..._args) {
14
+ super(..._args);
15
+ this.delay = 1e3;
16
+ this.isCopied = false;
17
+ this.copyToClipboard = async () => {
18
+ if (!this.value) return;
19
+ if (this.isCopied) return;
20
+ try {
21
+ await window.navigator.clipboard.writeText(this.value);
22
+ if (this.delay <= 0) return;
23
+ this.isCopied = true;
24
+ setTimeout(() => {
25
+ this.isCopied = false;
26
+ }, this.delay);
27
+ } catch (error) {
28
+ console.error("Failed to copy text to clipboard:", error);
29
+ this.isCopied = false;
30
+ }
31
+ };
32
+ }
33
+ static {
34
+ this.styles = [super.styles, styles];
35
+ }
36
+ render() {
37
+ return html`
38
+ <u-button part="base"
39
+ variant="ghost"
40
+ ?disabled=${this.isCopied}
41
+ @click=${this.copyToClipboard}>
42
+ <u-icon part="icon"
43
+ lib="bootstrap"
44
+ name=${this.isCopied ? "check-lg" : "copy"}
45
+ ></u-icon>
46
+ </u-button>
4
47
 
48
+ <u-tooltip for="u-button" placement="bottom" distance="8">
49
+ <slot></slot>
50
+ </u-tooltip>
51
+ `;
52
+ }
53
+ };
54
+ __decorate([property({ type: Number }), __decorateMetadata("design:type", Number)], UCopyButton.prototype, "delay", void 0);
55
+ __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UCopyButton.prototype, "value", void 0);
56
+ __decorate([state(), __decorateMetadata("design:type", Boolean)], UCopyButton.prototype, "isCopied", void 0);
57
+ UCopyButton = __decorate([customElement("u-copy-button")], UCopyButton);
58
+ //#endregion
5
59
  export { UCopyButton };
@@ -1,6 +1,6 @@
1
- import { css } from 'lit';
2
-
3
- const styles = css`
1
+ import { css } from "lit";
2
+ //#region src/components/buttons/UCopyButton.styles.ts
3
+ var styles = css`
4
4
  :host(:empty) u-tooltip {
5
5
  display: none;
6
6
  }
@@ -14,5 +14,5 @@ const styles = css`
14
14
  color: var(--u-green-500);
15
15
  }
16
16
  `;
17
-
17
+ //#endregion
18
18
  export { styles };
@@ -1,8 +1,19 @@
1
- import { UVoteButton } from './UVoteButton.component.js';
1
+ import { UElement } from '@iyulab/components/dist/components/UElement.js';
2
+ /** 투표 상태 타입 */
3
+ export type VoteValue = 'none' | 'up' | 'down';
4
+ /**
5
+ * 투표 버튼 컴포넌트입니다.
6
+ */
7
+ export declare class UVoteButton extends UElement {
8
+ static styles: import('lit').CSSResultGroup[];
9
+ /** 현재 투표 상태 */
10
+ value: VoteValue;
11
+ render(): import('lit-html').TemplateResult<1>;
12
+ private handleUpButtonClick;
13
+ private handleDownButtonClick;
14
+ }
2
15
  declare global {
3
16
  interface HTMLElementTagNameMap {
4
17
  'u-vote-button': UVoteButton;
5
18
  }
6
19
  }
7
- export { UVoteButton };
8
- export type { VoteValue } from './UVoteButton.component.js';
@@ -1,5 +1,64 @@
1
- import { UVoteButton } from './UVoteButton.component.js';
2
-
3
- UVoteButton.define("u-vote-button");
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 "./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 'lit';
2
-
3
- const styles = css`
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 };
@@ -0,0 +1,22 @@
1
+ import { nothing } from 'lit';
2
+ import { UElement } from '@iyulab/components/dist/components/UElement.js';
3
+ /**
4
+ * 질문/선택지 제안 블록 컴포넌트
5
+ *
6
+ * LLM이 질문 텍스트(`question`)와 클릭 선택지(`choices`)를 제시하고,
7
+ * `input: true`일 때는 사용자가 직접 텍스트를 입력할 수도 있습니다.
8
+ */
9
+ export declare class UQuestionIntent extends UElement {
10
+ static styles: import('lit').CSSResultGroup[];
11
+ /** LLM이 제시하는 질문 텍스트 */
12
+ question?: string;
13
+ /** 클릭 가능한 선택지 목록 */
14
+ choices: string[];
15
+ render(): import('lit-html').TemplateResult<1> | typeof nothing;
16
+ private handleChoiceClick;
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.122.0/helpers/decorateMetadata.js";
2
+ import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.122.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 };
@@ -0,0 +1,43 @@
1
+ import { css } from "lit";
2
+ //#region src/components/intents/UQuestionIntent.styles.ts
3
+ var styles = css`
4
+ :host {
5
+ display: flex;
6
+ flex-direction: column;
7
+ gap: 0.5em;
8
+ margin: 0.75em 0;
9
+ }
10
+
11
+ .question {
12
+ margin: 0 0 0.25em;
13
+ font-size: 0.9em;
14
+ color: var(--u-txt-color-weak);
15
+ line-height: 1.5;
16
+ }
17
+
18
+ .choices {
19
+ display: flex;
20
+ flex-direction: column;
21
+ gap: 0.4em;
22
+ }
23
+
24
+ u-button {
25
+ display: block;
26
+ width: fit-content;
27
+ padding: 0.5em 0.75em;
28
+ font-size: 0.875em;
29
+ justify-content: flex-start;
30
+ line-height: 1.4;
31
+ border-radius: 10px;
32
+ box-shadow: 0 1px 2px var(--u-shadow-color-weaker);
33
+ transition: all 0.15s ease;
34
+ }
35
+ u-button:hover {
36
+ transform: translateY(-1px);
37
+ }
38
+ u-button:active {
39
+ transform: translateY(0);
40
+ }
41
+ `;
42
+ //#endregion
43
+ export { styles };
@@ -1,7 +1,23 @@
1
- import { UMessage } from './UMessage.component.js';
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 { UMessage } from './UMessage.component.js';
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 "./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
- UMessage.define("u-message");
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 };