@iyulab/chat-components 0.6.0 → 0.7.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 (211) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +15 -39
  3. package/dist/_virtual/{_@oxc-project_runtime@0.130.0/helpers → _@oxc-project_runtime@0.138.0/helpers/esm}/decorate.js +2 -2
  4. package/dist/_virtual/{_@oxc-project_runtime@0.130.0/helpers → _@oxc-project_runtime@0.138.0/helpers/esm}/decorateMetadata.js +2 -2
  5. package/dist/_virtual/_glob-assets_raw/alert-triangle-fill.svg.4cfc4305.js +4 -0
  6. package/dist/_virtual/_glob-assets_raw/arrows-sort.svg.dda43a85.js +4 -0
  7. package/dist/_virtual/_glob-assets_raw/code.svg.c69bc144.js +4 -0
  8. package/dist/_virtual/_glob-assets_raw/download.svg.bce82177.js +4 -0
  9. package/dist/_virtual/_glob-assets_raw/element-prompt.md.7047ffcc.js +4 -0
  10. package/dist/_virtual/_glob-assets_raw/external-link.svg.a9f7f02d.js +4 -0
  11. package/dist/_virtual/_glob-assets_raw/file-code.svg.0e706f93.js +4 -0
  12. package/dist/_virtual/_glob-assets_raw/file-music.svg.b9970203.js +4 -0
  13. package/dist/_virtual/_glob-assets_raw/file-spreadsheet.svg.8c03bdfa.js +4 -0
  14. package/dist/_virtual/_glob-assets_raw/file-text.svg.85bdd923.js +4 -0
  15. package/dist/_virtual/_glob-assets_raw/file-type-pdf.svg.bc12db6d.js +4 -0
  16. package/dist/_virtual/_glob-assets_raw/file-zip.svg.76dde660.js +4 -0
  17. package/dist/_virtual/_glob-assets_raw/file.svg.28f5d6f1.js +4 -0
  18. package/dist/_virtual/_glob-assets_raw/photo.svg.cc273cc1.js +4 -0
  19. package/dist/_virtual/_glob-assets_raw/player-stop-fill.svg.5378b752.js +4 -0
  20. package/dist/_virtual/_glob-assets_raw/send.svg.02326253.js +4 -0
  21. package/dist/_virtual/_glob-assets_raw/sort-ascending-letters.svg.14a3df67.js +4 -0
  22. package/dist/_virtual/_glob-assets_raw/sort-descending-letters.svg.3e03647c.js +4 -0
  23. package/dist/_virtual/_glob-assets_raw/video.svg.c183f03c.js +4 -0
  24. package/dist/_virtual/_glob-assets_raw/world.svg.cd9903c8.js +4 -0
  25. package/dist/components/UDataElement.d.ts +44 -0
  26. package/dist/components/UDataElement.js +76 -0
  27. package/dist/components/blocks/UCodeBlock.d.ts +0 -4
  28. package/dist/components/blocks/UCodeBlock.js +6 -12
  29. package/dist/components/{views/UView.d.ts → blocks/UElementBlock.d.ts} +18 -8
  30. package/dist/components/{views/UView.js → blocks/UElementBlock.js} +31 -21
  31. package/dist/components/{views/UView.styles.js → blocks/UElementBlock.styles.js} +1 -1
  32. package/dist/components/blocks/UFileBlock.d.ts +15 -5
  33. package/dist/components/blocks/UFileBlock.js +81 -68
  34. package/dist/components/blocks/UFileBlock.styles.js +86 -29
  35. package/dist/components/blocks/UMarkedBlock.d.ts +3 -1
  36. package/dist/components/blocks/UMarkedBlock.js +23 -18
  37. package/dist/components/blocks/URefBlock.js +2 -2
  38. package/dist/components/blocks/UTableBlock.d.ts +2 -2
  39. package/dist/components/blocks/UTableBlock.js +9 -8
  40. package/dist/components/blocks/UTableBlock.styles.js +1 -1
  41. package/dist/components/blocks/UTextBlock.d.ts +2 -0
  42. package/dist/components/blocks/UTextBlock.js +4 -5
  43. package/dist/components/message/UMessage.js +2 -2
  44. package/dist/components/prompt/UPrompt.d.ts +0 -5
  45. package/dist/components/prompt/UPrompt.js +18 -27
  46. package/dist/components/prompt/UPrompt.styles.js +9 -10
  47. package/dist/components/references/URefCard.d.ts +2 -2
  48. package/dist/components/references/URefCard.js +8 -7
  49. package/dist/components/references/URefCardGroup.js +2 -2
  50. package/dist/components/references/URefTag.js +5 -4
  51. package/dist/{components/views/UChartView.d.ts → components-extra/UChartBlock.d.ts} +4 -4
  52. package/dist/{components/views/UChartView.js → components-extra/UChartBlock.js} +22 -34
  53. package/dist/components-extra/UChartBlock.schema.d.ts +3 -0
  54. package/dist/components-extra/UChartBlock.schema.js +34 -0
  55. package/dist/{components/views/UChartView.styles.js → components-extra/UChartBlock.styles.js} +1 -1
  56. package/dist/{components/views/UImagesView.d.ts → components-extra/UImagesBlock.d.ts} +4 -4
  57. package/dist/{components/views/UImagesView.js → components-extra/UImagesBlock.js} +15 -15
  58. package/dist/components-extra/UImagesBlock.schema.d.ts +3 -0
  59. package/dist/components-extra/UImagesBlock.schema.js +31 -0
  60. package/dist/{components/views/UImagesView.styles.js → components-extra/UImagesBlock.styles.js} +5 -5
  61. package/dist/{components/views/UMapView.d.ts → components-extra/UMapBlock.d.ts} +4 -4
  62. package/dist/{components/views/UMapView.js → components-extra/UMapBlock.js} +18 -18
  63. package/dist/components-extra/UMapBlock.schema.d.ts +3 -0
  64. package/dist/components-extra/UMapBlock.schema.js +33 -0
  65. package/dist/{components/views/UMapView.styles.js → components-extra/UMapBlock.styles.js} +1 -1
  66. package/dist/{components/views/UVideoView.d.ts → components-extra/UVideoBlock.d.ts} +4 -4
  67. package/dist/{components/views/UVideoView.js → components-extra/UVideoBlock.js} +10 -10
  68. package/dist/components-extra/UVideoBlock.schema.d.ts +3 -0
  69. package/dist/components-extra/UVideoBlock.schema.js +28 -0
  70. package/dist/{components/views/UVideoView.styles.js → components-extra/UVideoBlock.styles.js} +1 -1
  71. package/dist/events/SendEvent.d.ts +0 -5
  72. package/dist/events/StopEvent.d.ts +0 -5
  73. package/dist/extra.d.ts +6 -0
  74. package/dist/extra.js +14 -0
  75. package/dist/index.d.ts +5 -17
  76. package/dist/index.js +6 -16
  77. package/dist/react/UCodeBlock.js +2 -2
  78. package/dist/react/UElementBlock.d.ts +9 -0
  79. package/dist/react/UElementBlock.js +10 -0
  80. package/dist/react/UFileBlock.js +2 -2
  81. package/dist/react/UImagesBlock.d.ts +9 -0
  82. package/dist/react/UImagesBlock.js +10 -0
  83. package/dist/react/UMapBlock.d.ts +9 -0
  84. package/dist/react/UMapBlock.js +10 -0
  85. package/dist/react/UMarkedBlock.js +2 -2
  86. package/dist/react/UMessage.js +2 -2
  87. package/dist/react/UPrompt.js +2 -2
  88. package/dist/react/URefBlock.js +2 -2
  89. package/dist/react/URefCard.js +2 -2
  90. package/dist/react/URefCardGroup.js +2 -2
  91. package/dist/react/URefTag.js +2 -2
  92. package/dist/react/UTableBlock.js +2 -2
  93. package/dist/react/UTextBlock.d.ts +1 -0
  94. package/dist/react/UTextBlock.js +5 -3
  95. package/dist/react/UVideoBlock.d.ts +9 -0
  96. package/dist/react/UVideoBlock.js +10 -0
  97. package/dist/react/index.d.ts +4 -11
  98. package/dist/react/index.js +4 -11
  99. package/dist/types/BlockItem.d.ts +1 -24
  100. package/dist/types/{JsonSchema.d.ts → Schema.d.ts} +13 -0
  101. package/dist/utilities/HtmlBuilder.d.ts +28 -0
  102. package/dist/utilities/HtmlBuilder.js +41 -0
  103. package/dist/utilities/PromptBuilder.d.ts +21 -0
  104. package/dist/utilities/PromptBuilder.js +60 -0
  105. package/dist/utilities/icons.d.ts +1 -0
  106. package/dist/utilities/icons.js +52 -0
  107. package/dist/utilities/sanitizers.d.ts +35 -0
  108. package/dist/utilities/sanitizers.js +75 -0
  109. package/package.json +13 -18
  110. package/skills/iyulab-chat-components/SKILL.md +18 -33
  111. package/skills/iyulab-chat-components/references/components/{chart-view.md → chart-block.md} +16 -12
  112. package/skills/iyulab-chat-components/references/components/code-block.md +1 -5
  113. package/skills/iyulab-chat-components/references/components/element-block.md +57 -0
  114. package/skills/iyulab-chat-components/references/components/file-block.md +22 -25
  115. package/skills/iyulab-chat-components/references/components/{images-view.md → images-block.md} +10 -10
  116. package/skills/iyulab-chat-components/references/components/{map-view.md → map-block.md} +9 -9
  117. package/skills/iyulab-chat-components/references/components/marked-block.md +5 -4
  118. package/skills/iyulab-chat-components/references/components/message.md +1 -2
  119. package/skills/iyulab-chat-components/references/components/prompt.md +12 -21
  120. package/skills/iyulab-chat-components/references/components/{video-view.md → video-block.md} +10 -10
  121. package/skills/iyulab-chat-components/references/extra-system.md +95 -0
  122. package/skills/iyulab-chat-components/references/types.md +17 -31
  123. package/skills/iyulab-chat-components/references/usage.md +13 -81
  124. package/skills/iyulab-chat-components/references/utilities/html-builder.md +35 -0
  125. package/skills/iyulab-chat-components/references/utilities/prompt-builder.md +73 -0
  126. package/dist/_virtual/_glob-assets_raw/intent-prompt.md.1907474e.js +0 -4
  127. package/dist/_virtual/_glob-assets_raw/view-prompt.md.e0dbcffe.js +0 -4
  128. package/dist/chart.d.ts +0 -1
  129. package/dist/chart.js +0 -2
  130. package/dist/components/blocks/UJsonBlock.d.ts +0 -49
  131. package/dist/components/blocks/UJsonBlock.js +0 -130
  132. package/dist/components/blocks/UJsonBlock.styles.js +0 -115
  133. package/dist/components/blocks/UThinkBlock.d.ts +0 -35
  134. package/dist/components/blocks/UThinkBlock.js +0 -87
  135. package/dist/components/blocks/UThinkBlock.styles.js +0 -74
  136. package/dist/components/blocks/UToolBlock.d.ts +0 -24
  137. package/dist/components/blocks/UToolBlock.js +0 -70
  138. package/dist/components/blocks/UToolBlock.styles.js +0 -66
  139. package/dist/components/buttons/UAttachButton.d.ts +0 -26
  140. package/dist/components/buttons/UAttachButton.js +0 -63
  141. package/dist/components/buttons/UAttachButton.styles.js +0 -14
  142. package/dist/components/buttons/UCopyButton.d.ts +0 -24
  143. package/dist/components/buttons/UCopyButton.js +0 -59
  144. package/dist/components/buttons/UCopyButton.styles.js +0 -18
  145. package/dist/components/buttons/UVoteButton.d.ts +0 -19
  146. package/dist/components/buttons/UVoteButton.js +0 -64
  147. package/dist/components/buttons/UVoteButton.styles.d.ts +0 -1
  148. package/dist/components/buttons/UVoteButton.styles.js +0 -19
  149. package/dist/components/intents/UQuestionIntent.d.ts +0 -22
  150. package/dist/components/intents/UQuestionIntent.js +0 -41
  151. package/dist/components/intents/UQuestionIntent.styles.d.ts +0 -1
  152. package/dist/components/intents/UQuestionIntent.styles.js +0 -43
  153. package/dist/components/views/UChartView.styles.d.ts +0 -1
  154. package/dist/components/views/UImagesView.styles.d.ts +0 -1
  155. package/dist/components/views/UMapView.styles.d.ts +0 -1
  156. package/dist/components/views/UVideoView.styles.d.ts +0 -1
  157. package/dist/components/views/UView.styles.d.ts +0 -1
  158. package/dist/events/AttachEvent.d.ts +0 -9
  159. package/dist/events/ChoiceEvent.d.ts +0 -9
  160. package/dist/react/UAttachButton.d.ts +0 -11
  161. package/dist/react/UAttachButton.js +0 -12
  162. package/dist/react/UCopyButton.d.ts +0 -9
  163. package/dist/react/UCopyButton.js +0 -10
  164. package/dist/react/UImagesView.d.ts +0 -9
  165. package/dist/react/UImagesView.js +0 -10
  166. package/dist/react/UJsonBlock.d.ts +0 -9
  167. package/dist/react/UJsonBlock.js +0 -10
  168. package/dist/react/UMapView.d.ts +0 -9
  169. package/dist/react/UMapView.js +0 -10
  170. package/dist/react/UQuestionIntent.d.ts +0 -11
  171. package/dist/react/UQuestionIntent.js +0 -12
  172. package/dist/react/UThinkBlock.d.ts +0 -9
  173. package/dist/react/UThinkBlock.js +0 -10
  174. package/dist/react/UToolBlock.d.ts +0 -9
  175. package/dist/react/UToolBlock.js +0 -10
  176. package/dist/react/UVideoView.d.ts +0 -9
  177. package/dist/react/UVideoView.js +0 -10
  178. package/dist/react/UView.d.ts +0 -9
  179. package/dist/react/UView.js +0 -10
  180. package/dist/react/UVoteButton.d.ts +0 -9
  181. package/dist/react/UVoteButton.js +0 -10
  182. package/dist/types/Intents.d.ts +0 -26
  183. package/dist/types/Intents.js +0 -30
  184. package/dist/types/JsonNode.d.ts +0 -20
  185. package/dist/types/Views.d.ts +0 -34
  186. package/dist/types/Views.js +0 -148
  187. package/dist/utilities/IntentPromptBuilder.d.ts +0 -40
  188. package/dist/utilities/IntentPromptBuilder.js +0 -95
  189. package/dist/utilities/ViewPromptBuilder.d.ts +0 -28
  190. package/dist/utilities/ViewPromptBuilder.js +0 -78
  191. package/dist/utilities/dom-agent/DOMAgent.d.ts +0 -74
  192. package/dist/utilities/dom-agent/DOMController.d.ts +0 -78
  193. package/dist/utilities/dom-agent/DOMPromptBuilder.d.ts +0 -54
  194. package/dist/utilities/dom-agent/DOMScanner.d.ts +0 -83
  195. package/dist/utilities/dom-agent/index.d.ts +0 -9
  196. package/dist/utilities/dom-agent/types.d.ts +0 -209
  197. package/skills/iyulab-chat-components/references/components/attach-button.md +0 -69
  198. package/skills/iyulab-chat-components/references/components/copy-button.md +0 -46
  199. package/skills/iyulab-chat-components/references/components/json-block.md +0 -41
  200. package/skills/iyulab-chat-components/references/components/question-intent.md +0 -75
  201. package/skills/iyulab-chat-components/references/components/think-block.md +0 -48
  202. package/skills/iyulab-chat-components/references/components/tool-block.md +0 -57
  203. package/skills/iyulab-chat-components/references/components/view.md +0 -51
  204. package/skills/iyulab-chat-components/references/components/vote-button.md +0 -60
  205. package/skills/iyulab-chat-components/references/utilities/intent-prompt-builder.md +0 -123
  206. package/skills/iyulab-chat-components/references/utilities/view-prompt-builder.md +0 -112
  207. /package/dist/components/{buttons/UCopyButton.styles.d.ts → blocks/UElementBlock.styles.d.ts} +0 -0
  208. /package/dist/{components/blocks/UJsonBlock.styles.d.ts → components-extra/UChartBlock.styles.d.ts} +0 -0
  209. /package/dist/{components/blocks/UThinkBlock.styles.d.ts → components-extra/UImagesBlock.styles.d.ts} +0 -0
  210. /package/dist/{components/blocks/UToolBlock.styles.d.ts → components-extra/UMapBlock.styles.d.ts} +0 -0
  211. /package/dist/{components/buttons/UAttachButton.styles.d.ts → components-extra/UVideoBlock.styles.d.ts} +0 -0
@@ -1,209 +0,0 @@
1
- /**
2
- * DOM Interaction Types
3
- * LLM이 웹 페이지를 스캔하고 인터랙션할 수 있게 하는 타입 정의
4
- */
5
- /**
6
- * 스캔된 요소의 타입
7
- */
8
- export type ElementType = 'button' | 'input' | 'link' | 'select' | 'textarea' | 'checkbox' | 'radio' | 'custom' | 'other';
9
- /**
10
- * 스캔된 DOM 요소
11
- */
12
- export interface ScannedElement {
13
- /** 랜덤 생성된 고유 식별자 (예: elm_a1b2c3) */
14
- id: string;
15
- /** 요소 타입 */
16
- type: ElementType;
17
- /** HTML 태그명 */
18
- tag: string;
19
- /** 텍스트 콘텐츠 */
20
- text?: string;
21
- /** input 값 */
22
- value?: string;
23
- /** placeholder 텍스트 */
24
- placeholder?: string;
25
- /** aria-label 또는 연결된 label */
26
- label?: string;
27
- /** data-llm-description 값 (LLM을 위한 설명) */
28
- description?: string;
29
- /** ARIA role */
30
- role?: string;
31
- /** disabled 상태 */
32
- disabled: boolean;
33
- /** 시각적으로 보이는지 여부 */
34
- visible: boolean;
35
- /** 포커스 상태 */
36
- focused: boolean;
37
- /** 체크 상태 (checkbox/radio) */
38
- checked?: boolean;
39
- /** Shadow DOM 내부 요소 여부 */
40
- inShadowDom: boolean;
41
- /** 화면 상 x 위치 */
42
- x: number;
43
- /** 화면 상 y 위치 */
44
- y: number;
45
- /** 너비 */
46
- width: number;
47
- /** 높이 */
48
- height: number;
49
- /** 우선순위 점수 (필터링용) */
50
- priority: number;
51
- /** 자식 요소들 (필터링된) */
52
- children?: ScannedElement[];
53
- }
54
- /**
55
- * DOM 스캔 결과
56
- */
57
- export interface ScanResult {
58
- /** 스캔 타임스탬프 */
59
- timestamp: number;
60
- /** 현재 URL */
61
- url: string;
62
- /** 페이지 제목 */
63
- title: string;
64
- /** 스캔된 요소들 */
65
- elements: ScannedElement[];
66
- /** Base64 인코딩된 스크린샷 (optional) */
67
- screenshot?: string;
68
- /** 스크롤 위치 */
69
- scrollPosition: {
70
- x: number;
71
- y: number;
72
- };
73
- /** 뷰포트 크기 */
74
- viewport: {
75
- width: number;
76
- height: number;
77
- };
78
- /** 전체 DOM 요소 수 */
79
- totalElements: number;
80
- /** LLM에게 제공되는 필터링된 요소 수 */
81
- filteredElements: number;
82
- }
83
- /**
84
- * 필터링 전략
85
- */
86
- export type FilterStrategy = 'all' | 'interactive' | 'described' | 'visible';
87
- /**
88
- * 스캔 옵션
89
- */
90
- export interface ScanOptions {
91
- /** 스크린샷 포함 여부 */
92
- includeScreenshot?: boolean;
93
- /** 최대 요소 수 제한 */
94
- maxElements?: number;
95
- /** 최대 깊이 제한 */
96
- maxDepth?: number;
97
- /** 필터링 전략 */
98
- filterStrategy?: FilterStrategy;
99
- /** 디버그 로그 활성화 (기본값: false) */
100
- debug?: boolean;
101
- /** 캐싱 사용 여부 (기본값: true) */
102
- useCache?: boolean;
103
- /** iframe 포함 여부 (기본값: false) */
104
- includeIframes?: boolean;
105
- /** ARIA Landmark 우선순위 증가 (기본값: true) */
106
- prioritizeLandmarks?: boolean;
107
- }
108
- /**
109
- * DOM 명령 액션
110
- */
111
- export type DOMAction = 'click' | 'input' | 'select' | 'focus' | 'blur' | 'scroll' | 'scrollTo' | 'hover' | 'clear' | 'check' | 'wait';
112
- /**
113
- * DOM 명령
114
- */
115
- export interface DOMCommand {
116
- /** 실행할 액션 */
117
- action: DOMAction;
118
- /** 대상 요소 ID (DOMScanner가 생성한 랜덤 ID) */
119
- target?: string;
120
- /** 명령 값 (input 텍스트, select 옵션 등) */
121
- value?: string | number | boolean;
122
- /** 추가 옵션 */
123
- options?: {
124
- /** 명령 실행 전 대기 시간 (ms) */
125
- delay?: number;
126
- /** 네비게이션 대기 여부 */
127
- waitForNavigation?: boolean;
128
- };
129
- }
130
- /**
131
- * 명령 실행 결과
132
- */
133
- export interface ExecutionResult {
134
- /** 성공 여부 */
135
- success: boolean;
136
- /** 실행된 명령 */
137
- command: DOMCommand;
138
- /** 에러 메시지 (실패 시) */
139
- error?: string;
140
- /** 실행 타임스탬프 */
141
- timestamp: number;
142
- /** 페이지 네비게이션 발생 여부 */
143
- navigationOccurred?: boolean;
144
- }
145
- /**
146
- * DOMAgent 이벤트 타입
147
- */
148
- export interface DOMAgentEvents {
149
- /** 스캔 완료 */
150
- scan: ScanResult;
151
- /** 명령 수신 */
152
- command: DOMCommand;
153
- /** 명령 실행 완료 */
154
- execute: ExecutionResult;
155
- /** 에러 발생 */
156
- error: Error;
157
- /** 반복 횟수 */
158
- iteration: number;
159
- }
160
- /**
161
- * 자동화 옵션
162
- */
163
- export interface AutomationOptions {
164
- /** 최대 반복 횟수 */
165
- maxIterations?: number;
166
- /** 중지 조건 함수 */
167
- stopCondition?: (scan: ScanResult) => boolean;
168
- /** 스크린샷 포함 여부 */
169
- includeScreenshot?: boolean;
170
- }
171
- /**
172
- * 히스토리 항목
173
- */
174
- export interface HistoryItem {
175
- /** 스캔 결과 */
176
- scan: ScanResult;
177
- /** 실행된 명령들 */
178
- commands: DOMCommand[];
179
- /** 실행 결과들 */
180
- results: ExecutionResult[];
181
- }
182
- /**
183
- * LLM 콜백 함수 타입
184
- */
185
- export type LLMCallback = (scan: ScanResult) => Promise<DOMCommand[]>;
186
- /**
187
- * 캐시 항목
188
- */
189
- export interface CachedScan {
190
- /** 캐시된 스캔 결과 */
191
- result: ScanResult;
192
- /** 캐시 생성 시간 */
193
- timestamp: number;
194
- /** DOM 해시 (변경 감지용) */
195
- domHash: string;
196
- }
197
- /**
198
- * Diff 결과
199
- */
200
- export interface ScanDiff {
201
- /** 추가된 요소 */
202
- added: ScannedElement[];
203
- /** 제거된 요소 */
204
- removed: ScannedElement[];
205
- /** 변경된 요소 */
206
- modified: ScannedElement[];
207
- /** 변경되지 않은 요소 */
208
- unchanged: ScannedElement[];
209
- }
@@ -1,69 +0,0 @@
1
- # u-attach-button
2
-
3
- ```ts
4
- import '@iyulab/chat-components/dist/components/buttons/UAttachButton.js';
5
- ```
6
-
7
- **Tag:** `u-attach-button`
8
-
9
- Opens a file picker dialog. Fires an `attach` event with the selected files. Place in `u-prompt`'s `left-actions` slot.
10
-
11
- ```html
12
- <!-- Basic usage -->
13
- <u-attach-button></u-attach-button>
14
-
15
- <!-- Images only -->
16
- <u-attach-button accept="image/*">Add image</u-attach-button>
17
-
18
- <!-- Multiple files allowed -->
19
- <u-attach-button multiple accept="image/*,application/pdf">Attach files</u-attach-button>
20
-
21
- <!-- Inside u-prompt -->
22
- <u-prompt>
23
- <u-attach-button
24
- slot="left-actions"
25
- multiple
26
- accept="image/*,application/pdf,text/*"
27
- @attach=${handleAttach}
28
- >
29
- Files
30
- </u-attach-button>
31
- </u-prompt>
32
- ```
33
-
34
- ```ts
35
- const attachBtn = document.querySelector('u-attach-button');
36
-
37
- attachBtn.addEventListener('attach', (e) => {
38
- const { files } = e.detail; // File[]
39
- console.log('Selected files:', files.map(f => f.name));
40
- });
41
- ```
42
-
43
- ---
44
-
45
- ## Slots
46
-
47
- | Name | Description |
48
- |------|-------------|
49
- | *(default)* | Tooltip label text |
50
-
51
- ## Properties
52
-
53
- | Property | Type | Default | Description |
54
- |----------|------|---------|-------------|
55
- | `accept` | `string` | `undefined` | Accepted MIME types (comma-separated). E.g. `"image/*"`, `"image/*,application/pdf"` |
56
- | `multiple` | `boolean` | `false` | Allow selecting multiple files |
57
-
58
- ## Events
59
-
60
- | Event | Detail | Description |
61
- |-------|--------|-------------|
62
- | `attach` | `{ files: File[] }` | Fired after file selection. The file input is reset automatically |
63
-
64
- ## CSS Parts
65
-
66
- | Part | Description |
67
- |------|-------------|
68
- | `base` | The button element (`u-button`) |
69
- | `icon` | Paperclip icon |
@@ -1,46 +0,0 @@
1
- # u-copy-button
2
-
3
- ```ts
4
- import '@iyulab/chat-components/dist/components/buttons/UCopyButton.js';
5
- ```
6
-
7
- **Tag:** `u-copy-button`
8
-
9
- Copies text to the clipboard on click. The icon switches to a checkmark temporarily to confirm the action. Used inside `u-code-block` for code copying.
10
-
11
- ```html
12
- <!-- Basic usage -->
13
- <u-copy-button .value=${"Text to copy"}></u-copy-button>
14
-
15
- <!-- With tooltip text -->
16
- <u-copy-button .value=${"code content"}>Copy</u-copy-button>
17
-
18
- <!-- Custom reset delay (default: 1000ms) -->
19
- <u-copy-button .value=${"text"} .delay=${2000}></u-copy-button>
20
- ```
21
-
22
- Typical placement in a message footer:
23
-
24
- ```html
25
- <u-message>
26
- <u-marked-block slot="default" .value=${content}></u-marked-block>
27
- <div slot="footer">
28
- <u-copy-button .value=${content}>Copy</u-copy-button>
29
- </div>
30
- </u-message>
31
- ```
32
-
33
- ---
34
-
35
- ## Slots
36
-
37
- | Name | Description |
38
- |------|-------------|
39
- | *(default)* | Tooltip label text |
40
-
41
- ## Properties
42
-
43
- | Property | Type | Default | Description |
44
- |----------|------|---------|-------------|
45
- | `value` | `string` | `undefined` | Text to copy to clipboard |
46
- | `delay` | `number` | `1000` | Time in ms before the icon resets after copying. `0` resets immediately |
@@ -1,41 +0,0 @@
1
- # u-json-block
2
-
3
- ```ts
4
- import '@iyulab/chat-components/dist/components/blocks/UJsonBlock.js';
5
- ```
6
-
7
- **Tag:** `u-json-block`
8
-
9
- Renders JSON data as a collapsible, interactive tree. Used inside `u-tool-block` to display tool call input and output.
10
-
11
- ```html
12
- <!-- Basic usage -->
13
- <u-json-block .value=${{ name: "Alice", age: 30, hobbies: ["reading", "coding"] }}></u-json-block>
14
-
15
- <!-- Collapsed by default -->
16
- <u-json-block .expanded=${false} .value=${complexData}></u-json-block>
17
- ```
18
-
19
- Pass JSON via HTML attribute:
20
-
21
- ```html
22
- <u-json-block value='{"key": "value", "count": 42}'></u-json-block>
23
- ```
24
-
25
- ---
26
-
27
- ## Properties
28
-
29
- | Property | Type | Default | Description |
30
- |----------|------|---------|-------------|
31
- | `value` | `JsonNode` | `{}` | JSON data to render (object, array, or primitive) |
32
- | `expanded` | `boolean` | `true` | Initial expand state for all object/array nodes |
33
-
34
- ## JsonNode Type
35
-
36
- ```ts
37
- type JsonValue = string | number | boolean | null;
38
- type JsonArray = JsonNode[];
39
- type JsonObject = { [key: string]: JsonNode };
40
- type JsonNode = JsonValue | JsonArray | JsonObject;
41
- ```
@@ -1,75 +0,0 @@
1
- # u-question-intent
2
-
3
- ```ts
4
- import '@iyulab/chat-components/dist/components/intents/UQuestionIntent.js';
5
- ```
6
-
7
- **Tag:** `u-question-intent`
8
-
9
- Renders a question with clickable choice buttons generated by the LLM. Fires a `choice` event when the user selects an option.
10
-
11
- `u-marked-block` strips `intent-json` code blocks from the rendered output, so you must parse them manually using `IntentPromptBuilder` and create this component yourself.
12
-
13
- ```html
14
- <!-- Basic usage -->
15
- <u-question-intent
16
- question="What topic are you interested in?"
17
- .choices=${["Artificial Intelligence", "Blockchain", "Cloud Computing"]}
18
- ></u-question-intent>
19
-
20
- <!-- Choices only, no question text -->
21
- <u-question-intent
22
- .choices=${["Yes, continue", "No, stop"]}
23
- ></u-question-intent>
24
- ```
25
-
26
- ```ts
27
- const intent = document.querySelector('u-question-intent');
28
-
29
- intent.addEventListener('choice', (e) => {
30
- const { value } = e.detail; // selected choice text
31
- console.log('Selected:', value);
32
-
33
- // Auto-fill and submit the prompt
34
- prompt.value = value;
35
- prompt.submit();
36
- });
37
- ```
38
-
39
- Parsing from an LLM response with `IntentPromptBuilder`:
40
-
41
- ```ts
42
- import { IntentPromptBuilder, PresetIntent } from '@iyulab/chat-components';
43
-
44
- // Setup
45
- IntentPromptBuilder.instance.use(PresetIntent.Questions);
46
-
47
- // Parse LLM response
48
- const [cleanText, intents] = IntentPromptBuilder.instance.parse(llmResponse);
49
-
50
- for (const intent of intents) {
51
- if (intent.type === 'question') {
52
- const el = document.createElement('u-question-intent');
53
- el.question = intent.properties?.question;
54
- el.choices = intent.properties?.choices ?? [];
55
- messageContainer.appendChild(el);
56
- }
57
- }
58
-
59
- markedBlock.value = cleanText;
60
- ```
61
-
62
- ---
63
-
64
- ## Properties
65
-
66
- | Property | Type | Default | Description |
67
- |----------|------|---------|-------------|
68
- | `question` | `string` | `undefined` | Question text shown above choices. Hidden if not set |
69
- | `choices` | `string[]` | `[]` | Clickable choices (1–5 recommended). Renders nothing if empty |
70
-
71
- ## Events
72
-
73
- | Event | Detail | Description |
74
- |-------|--------|-------------|
75
- | `choice` | `{ value: string }` | Fired when a choice button is clicked |
@@ -1,48 +0,0 @@
1
- # u-think-block
2
-
3
- ```ts
4
- import '@iyulab/chat-components/dist/components/blocks/UThinkBlock.js';
5
- ```
6
-
7
- **Tag:** `u-think-block`
8
-
9
- Displays LLM reasoning (thinking) content. Shows "Thinking..." while loading and switches to "Thought" on completion. Content can be collapsed or expanded via a header click.
10
-
11
- ```html
12
- <!-- Reasoning in progress -->
13
- <u-think-block loading .value=${"Analyzing..."}></u-think-block>
14
-
15
- <!-- Completed (default: collapsed) -->
16
- <u-think-block .value=${"Full reasoning content here."}></u-think-block>
17
-
18
- <!-- Expanded with auto-scroll during streaming -->
19
- <u-think-block
20
- auto-scroll
21
- .collapsed=${false}
22
- .value=${streamingThought}
23
- ></u-think-block>
24
- ```
25
-
26
- ---
27
-
28
- ## Properties
29
-
30
- | Property | Type | Default | Reflect | Description |
31
- |----------|------|---------|---------|-------------|
32
- | `value` | `string` | `undefined` | — | Reasoning text (rendered as markdown) |
33
- | `loading` | `boolean` | `false` | ✓ | Loading state. Shows spinner, displays "Thinking..." label |
34
- | `collapsed` | `boolean` | `true` | ✓ | Collapsed state. Toggle by clicking the header |
35
- | `autoScroll` | `boolean` | `false` | — | (`auto-scroll`) Scrolls to bottom on each `value` update. Disables on user scroll interaction |
36
-
37
- ## Methods
38
-
39
- | Method | Returns | Description |
40
- |--------|---------|-------------|
41
- | `scrollToBottom()` | `boolean` | Smoothly scrolls the body to the bottom. Returns `true` if body element exists |
42
-
43
- ## CSS Parts
44
-
45
- | Part | Description |
46
- |------|-------------|
47
- | `header` | Header row (icon + title + collapse toggle) |
48
- | `body` | Scrollable content area |
@@ -1,57 +0,0 @@
1
- # u-tool-block
2
-
3
- ```ts
4
- import '@iyulab/chat-components/dist/components/blocks/UToolBlock.js';
5
- ```
6
-
7
- **Tag:** `u-tool-block`
8
-
9
- Displays a tool call's input and output as collapsible JSON trees. Used to show LLM tool usage inline in a message.
10
-
11
- ```html
12
- <!-- Tool call in progress -->
13
- <u-tool-block loading title="search_web"></u-tool-block>
14
-
15
- <!-- Completed tool call -->
16
- <u-tool-block
17
- title="search_web"
18
- .input=${{ query: "weather today" }}
19
- .output=${{ results: ["Sunny, 25°C"] }}
20
- ></u-tool-block>
21
-
22
- <!-- Expanded by default -->
23
- <u-tool-block
24
- title="code_execution"
25
- .collapsed=${false}
26
- .input=${{ code: "print('hello')" }}
27
- .output=${{ stdout: "hello\n" }}
28
- ></u-tool-block>
29
- ```
30
-
31
- Pass JSON via HTML attribute (uses `jsonAttrConverter`):
32
-
33
- ```html
34
- <u-tool-block
35
- title="calculator"
36
- input='{"expression": "2 + 2"}'
37
- output='{"result": 4}'
38
- ></u-tool-block>
39
- ```
40
-
41
- ---
42
-
43
- ## Properties
44
-
45
- | Property | Type | Default | Reflect | Description |
46
- |----------|------|---------|---------|-------------|
47
- | `title` | `string` | `''` | — | Tool name shown in the header (falls back to 'Tool Usage') |
48
- | `loading` | `boolean` | `false` | ✓ | Loading state. Shows spinner in header |
49
- | `collapsed` | `boolean` | `true` | ✓ | Collapsed state. Toggle by clicking the header |
50
- | `input` | `JsonNode` | `undefined` | — | Tool input JSON |
51
- | `output` | `JsonNode` | `undefined` | — | Tool output JSON |
52
-
53
- ## CSS Parts
54
-
55
- | Part | Description |
56
- |------|-------------|
57
- | `body` | Input / output display area |
@@ -1,51 +0,0 @@
1
- # u-view
2
-
3
- ```ts
4
- import '@iyulab/chat-components/dist/components/views/UView.js';
5
- ```
6
-
7
- **Tag:** `u-view`
8
-
9
- Dynamic custom element renderer. Creates the element specified by `tag`, binds `properties` to it, and handles loading and error states. Used internally by `u-marked-block` to render `view-json` code blocks.
10
-
11
- ```html
12
- <!-- Render u-chart-view dynamically -->
13
- <u-view
14
- tag="u-chart-view"
15
- .properties=${{
16
- type: 'bar',
17
- data: { labels: ['A', 'B'], datasets: [{ data: [10, 20] }] }
18
- }}
19
- ></u-view>
20
-
21
- <!-- Loading state (skeleton placeholder) -->
22
- <u-view tag="u-chart-view" loading></u-view>
23
- ```
24
-
25
- How `u-marked-block` processes a `view-json` block:
26
-
27
- ````
28
- ```view-json
29
- {
30
- "tag": "u-images-view",
31
- "properties": { "items": [{ "src": "https://..." }] }
32
- }
33
- ```
34
- ````
35
-
36
- This is converted to `<u-view tag="u-images-view" ...>` via `UView.buildHTML()`.
37
-
38
- ---
39
-
40
- ## Properties
41
-
42
- | Property | Type | Default | Reflect | Description |
43
- |----------|------|---------|---------|-------------|
44
- | `tag` | `string` | `undefined` | — | Custom element tag to render. Must already be registered |
45
- | `properties` | `Record<string, unknown>` | `undefined` | — | Properties to bind to the rendered element |
46
- | `loading` | `boolean` | `false` | ✓ | Shows a skeleton placeholder instead of the element |
47
- | `blacklist` | `string[]` | `['innerHTML', 'outerHTML', ...]` | — | Property names blocked from binding for XSS prevention |
48
-
49
- ## Security
50
-
51
- The following property names are blocked by default to prevent XSS: `innerHTML`, `outerHTML`, `textContent`, `innerText`, `outerText`, `srcdoc`. Extend `blacklist` to add more restrictions.
@@ -1,60 +0,0 @@
1
- # u-vote-button
2
-
3
- ```ts
4
- import '@iyulab/chat-components/dist/components/buttons/UVoteButton.js';
5
- ```
6
-
7
- **Tag:** `u-vote-button`
8
-
9
- Thumbs-up / thumbs-down vote button pair. Clicking a button toggles its active state; clicking the same button again resets back to `none`.
10
-
11
- ```html
12
- <!-- Basic usage -->
13
- <u-vote-button></u-vote-button>
14
-
15
- <!-- Pre-set state -->
16
- <u-vote-button value="up"></u-vote-button>
17
-
18
- <!-- With tooltips -->
19
- <u-vote-button>
20
- <span slot="up">Helpful</span>
21
- <span slot="down">Not helpful</span>
22
- </u-vote-button>
23
- ```
24
-
25
- ```ts
26
- const voteBtn = document.querySelector('u-vote-button');
27
-
28
- voteBtn.addEventListener('change', () => {
29
- console.log('vote:', voteBtn.value); // 'up' | 'down' | 'none'
30
- });
31
- ```
32
-
33
- ---
34
-
35
- ## Slots
36
-
37
- | Name | Description |
38
- |------|-------------|
39
- | `up` | Tooltip text for the thumbs-up button |
40
- | `down` | Tooltip text for the thumbs-down button |
41
-
42
- ## Properties
43
-
44
- | Property | Type | Default | Description |
45
- |----------|------|---------|-------------|
46
- | `value` | `'none'\|'up'\|'down'` | `'none'` | Current vote state |
47
-
48
- ## Events
49
-
50
- | Event | Description |
51
- |-------|-------------|
52
- | `change` | Fired when vote state changes (`bubbles: true, composed: true`) |
53
-
54
- ## CSS Parts
55
-
56
- | Part | Description |
57
- |------|-------------|
58
- | `up-btn` | Thumbs-up button |
59
- | `down-btn` | Thumbs-down button |
60
- | `icon` | Button icon |