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