@iyulab/chat-components 0.4.0 → 0.5.1

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 (265) hide show
  1. package/CHANGELOG.md +83 -52
  2. package/README.md +133 -16
  3. package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js +9 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.124.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 +4 -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/{UFilesBlock.styles.js → UFileBlock.styles.js} +12 -90
  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 +47 -2
  23. package/dist/components/blocks/UTableBlock.js +197 -4
  24. package/dist/components/blocks/UTableBlock.styles.js +4 -5
  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/{actions/UQuestionAction.component.d.ts → intents/UQuestionIntent.d.ts} +6 -2
  44. package/dist/components/intents/UQuestionIntent.js +41 -0
  45. package/dist/components/{actions/UQuestionAction.styles.js → intents/UQuestionIntent.styles.js} +4 -6
  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 +4 -4
  49. package/dist/components/prompt/UPrompt.d.ts +37 -2
  50. package/dist/components/prompt/UPrompt.js +139 -2
  51. package/dist/components/prompt/UPrompt.styles.js +15 -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/{widgets/UChartWidget.component.d.ts → views/UChartView.d.ts} +7 -4
  62. package/dist/components/views/UChartView.js +167 -0
  63. package/dist/components/{widgets/UChartWidget.styles.js → views/UChartView.styles.js} +4 -4
  64. package/dist/components/{widgets/UImagesWidget.component.d.ts → views/UImagesView.d.ts} +7 -4
  65. package/dist/components/views/UImagesView.js +144 -0
  66. package/dist/components/{widgets/UImagesWidget.styles.js → views/UImagesView.styles.js} +6 -5
  67. package/dist/components/{widgets/UMapWidget.component.d.ts → views/UMapView.d.ts} +7 -3
  68. package/dist/components/views/UMapView.js +45 -0
  69. package/dist/components/{widgets/UMapWidget.styles.js → views/UMapView.styles.js} +4 -4
  70. package/dist/components/{widgets/UVideoWidget.component.d.ts → views/UVideoView.d.ts} +7 -3
  71. package/dist/components/views/UVideoView.js +81 -0
  72. package/dist/components/{widgets/UVideoWidget.styles.js → views/UVideoView.styles.js} +4 -4
  73. package/dist/components/{widgets/UWidget.component.d.ts → views/UView.d.ts} +8 -5
  74. package/dist/components/views/UView.js +113 -0
  75. package/dist/components/{widgets/UWidget.styles.js → views/UView.styles.js} +4 -4
  76. package/dist/events/AttachEvent.d.ts +9 -0
  77. package/dist/events/ChoiceEvent.d.ts +9 -0
  78. package/dist/events/SendEvent.d.ts +21 -0
  79. package/dist/events/StopEvent.d.ts +17 -0
  80. package/dist/index.d.ts +13 -16
  81. package/dist/index.js +28 -56
  82. package/dist/react/UAttachButton.d.ts +11 -0
  83. package/dist/react/UAttachButton.js +12 -0
  84. package/dist/react/UChartView.d.ts +9 -0
  85. package/dist/react/UChartView.js +10 -0
  86. package/dist/react/UCodeBlock.d.ts +9 -0
  87. package/dist/react/UCodeBlock.js +10 -0
  88. package/dist/react/UCopyButton.d.ts +9 -0
  89. package/dist/react/UCopyButton.js +10 -0
  90. package/dist/react/UFileBlock.d.ts +11 -0
  91. package/dist/react/UFileBlock.js +12 -0
  92. package/dist/react/UImagesView.d.ts +9 -0
  93. package/dist/react/UImagesView.js +10 -0
  94. package/dist/react/UJsonBlock.d.ts +9 -0
  95. package/dist/react/UJsonBlock.js +10 -0
  96. package/dist/react/UMapView.d.ts +9 -0
  97. package/dist/react/UMapView.js +10 -0
  98. package/dist/react/UMarkedBlock.d.ts +9 -0
  99. package/dist/react/UMarkedBlock.js +10 -0
  100. package/dist/react/UMessage.d.ts +9 -0
  101. package/dist/react/UMessage.js +10 -0
  102. package/dist/react/UPrompt.d.ts +13 -0
  103. package/dist/react/UPrompt.js +13 -0
  104. package/dist/react/UQuestionIntent.d.ts +11 -0
  105. package/dist/react/UQuestionIntent.js +12 -0
  106. package/dist/react/URefBlock.d.ts +9 -0
  107. package/dist/react/URefBlock.js +10 -0
  108. package/dist/react/URefCard.d.ts +9 -0
  109. package/dist/react/URefCard.js +10 -0
  110. package/dist/react/URefCardGroup.d.ts +9 -0
  111. package/dist/react/URefCardGroup.js +10 -0
  112. package/dist/react/URefTag.d.ts +9 -0
  113. package/dist/react/URefTag.js +10 -0
  114. package/dist/react/UTableBlock.d.ts +9 -0
  115. package/dist/react/UTableBlock.js +10 -0
  116. package/dist/react/UTextBlock.d.ts +9 -0
  117. package/dist/react/UTextBlock.js +10 -0
  118. package/dist/react/UThinkBlock.d.ts +9 -0
  119. package/dist/react/UThinkBlock.js +10 -0
  120. package/dist/react/UToolBlock.d.ts +9 -0
  121. package/dist/react/UToolBlock.js +10 -0
  122. package/dist/react/UVideoView.d.ts +9 -0
  123. package/dist/react/UVideoView.js +10 -0
  124. package/dist/react/UView.d.ts +9 -0
  125. package/dist/react/UView.js +10 -0
  126. package/dist/react/UVoteButton.d.ts +9 -0
  127. package/dist/react/UVoteButton.js +10 -0
  128. package/dist/react/index.d.ts +23 -0
  129. package/dist/react/index.js +23 -0
  130. package/dist/types/BlockItem.d.ts +21 -32
  131. package/dist/types/Intents.d.ts +26 -0
  132. package/dist/types/Intents.js +30 -0
  133. package/dist/types/{Widgets.d.ts → Views.d.ts} +8 -8
  134. package/dist/types/Views.js +150 -0
  135. package/dist/utilities/IntentPromptBuilder.d.ts +40 -0
  136. package/dist/utilities/IntentPromptBuilder.js +95 -0
  137. package/dist/utilities/ViewPromptBuilder.d.ts +28 -0
  138. package/dist/utilities/ViewPromptBuilder.js +76 -0
  139. package/dist/utilities/dom-agent/DOMAgent.d.ts +74 -0
  140. package/dist/utilities/dom-agent/DOMController.d.ts +78 -0
  141. package/dist/utilities/dom-agent/DOMPromptBuilder.d.ts +54 -0
  142. package/dist/utilities/dom-agent/DOMScanner.d.ts +83 -0
  143. package/dist/utilities/dom-agent/index.d.ts +9 -0
  144. package/dist/utilities/dom-agent/types.d.ts +209 -0
  145. package/package.json +33 -16
  146. package/skills/iyulab-chat-components/SKILL.md +107 -0
  147. package/skills/iyulab-chat-components/references/components/attach-button.md +69 -0
  148. package/skills/iyulab-chat-components/references/components/chart-view.md +65 -0
  149. package/skills/iyulab-chat-components/references/components/code-block.md +42 -0
  150. package/skills/iyulab-chat-components/references/components/copy-button.md +46 -0
  151. package/skills/iyulab-chat-components/references/components/file-block.md +64 -0
  152. package/skills/iyulab-chat-components/references/components/images-view.md +63 -0
  153. package/skills/iyulab-chat-components/references/components/json-block.md +41 -0
  154. package/skills/iyulab-chat-components/references/components/map-view.md +54 -0
  155. package/skills/iyulab-chat-components/references/components/marked-block.md +53 -0
  156. package/skills/iyulab-chat-components/references/components/message.md +60 -0
  157. package/skills/iyulab-chat-components/references/components/prompt.md +102 -0
  158. package/skills/iyulab-chat-components/references/components/question-intent.md +75 -0
  159. package/skills/iyulab-chat-components/references/components/ref-block.md +45 -0
  160. package/skills/iyulab-chat-components/references/components/ref-card-group.md +41 -0
  161. package/skills/iyulab-chat-components/references/components/ref-card.md +48 -0
  162. package/skills/iyulab-chat-components/references/components/ref-tag.md +40 -0
  163. package/skills/iyulab-chat-components/references/components/table-block.md +63 -0
  164. package/skills/iyulab-chat-components/references/components/text-block.md +59 -0
  165. package/skills/iyulab-chat-components/references/components/think-block.md +48 -0
  166. package/skills/iyulab-chat-components/references/components/tool-block.md +57 -0
  167. package/skills/iyulab-chat-components/references/components/video-view.md +55 -0
  168. package/skills/iyulab-chat-components/references/components/view.md +51 -0
  169. package/skills/iyulab-chat-components/references/components/vote-button.md +60 -0
  170. package/skills/iyulab-chat-components/references/types.md +115 -0
  171. package/skills/iyulab-chat-components/references/usage.md +254 -0
  172. package/skills/iyulab-chat-components/references/utilities/intent-prompt-builder.md +123 -0
  173. package/skills/iyulab-chat-components/references/utilities/view-prompt-builder.md +112 -0
  174. package/dist/assets/action-prompt.md.js +0 -3
  175. package/dist/assets/widget-prompt.md.js +0 -3
  176. package/dist/components/actions/UQuestionAction.component.js +0 -58
  177. package/dist/components/actions/UQuestionAction.d.ts +0 -7
  178. package/dist/components/actions/UQuestionAction.js +0 -5
  179. package/dist/components/blocks/UCodeBlock.component.d.ts +0 -25
  180. package/dist/components/blocks/UCodeBlock.component.js +0 -88
  181. package/dist/components/blocks/UFilesBlock.component.d.ts +0 -22
  182. package/dist/components/blocks/UFilesBlock.component.js +0 -192
  183. package/dist/components/blocks/UFilesBlock.d.ts +0 -7
  184. package/dist/components/blocks/UFilesBlock.js +0 -5
  185. package/dist/components/blocks/UJsonBlock.component.d.ts +0 -45
  186. package/dist/components/blocks/UJsonBlock.component.js +0 -140
  187. package/dist/components/blocks/UMarkedBlock.component.d.ts +0 -40
  188. package/dist/components/blocks/UMarkedBlock.component.js +0 -159
  189. package/dist/components/blocks/URefBlock.component.d.ts +0 -17
  190. package/dist/components/blocks/URefBlock.component.js +0 -73
  191. package/dist/components/blocks/UTableBlock.component.d.ts +0 -49
  192. package/dist/components/blocks/UTableBlock.component.js +0 -228
  193. package/dist/components/blocks/UTextBlock.component.d.ts +0 -37
  194. package/dist/components/blocks/UTextBlock.component.js +0 -123
  195. package/dist/components/blocks/UThinkBlock.component.d.ts +0 -23
  196. package/dist/components/blocks/UThinkBlock.component.js +0 -90
  197. package/dist/components/blocks/UToolBlock.component.d.ts +0 -20
  198. package/dist/components/blocks/UToolBlock.component.js +0 -80
  199. package/dist/components/buttons/UAttachButton.component.d.ts +0 -22
  200. package/dist/components/buttons/UAttachButton.component.js +0 -89
  201. package/dist/components/buttons/UCopyButton.component.d.ts +0 -20
  202. package/dist/components/buttons/UCopyButton.component.js +0 -81
  203. package/dist/components/buttons/UReportButton.component.d.ts +0 -9
  204. package/dist/components/buttons/UReportButton.component.js +0 -36
  205. package/dist/components/buttons/UReportButton.d.ts +0 -7
  206. package/dist/components/buttons/UReportButton.js +0 -5
  207. package/dist/components/buttons/UReportButton.styles.js +0 -14
  208. package/dist/components/buttons/URetryButton.component.d.ts +0 -11
  209. package/dist/components/buttons/URetryButton.component.js +0 -53
  210. package/dist/components/buttons/URetryButton.d.ts +0 -7
  211. package/dist/components/buttons/URetryButton.js +0 -5
  212. package/dist/components/buttons/URetryButton.styles.js +0 -26
  213. package/dist/components/buttons/UShareButton.component.d.ts +0 -9
  214. package/dist/components/buttons/UShareButton.component.js +0 -36
  215. package/dist/components/buttons/UShareButton.d.ts +0 -7
  216. package/dist/components/buttons/UShareButton.js +0 -5
  217. package/dist/components/buttons/UShareButton.styles.js +0 -14
  218. package/dist/components/buttons/UVoteButton.component.d.ts +0 -15
  219. package/dist/components/buttons/UVoteButton.component.js +0 -73
  220. package/dist/components/message/UMessage.component.d.ts +0 -19
  221. package/dist/components/message/UMessage.component.js +0 -56
  222. package/dist/components/prompt/UPrompt.component.d.ts +0 -25
  223. package/dist/components/prompt/UPrompt.component.js +0 -113
  224. package/dist/components/references/URefCard.component.d.ts +0 -27
  225. package/dist/components/references/URefCard.component.js +0 -109
  226. package/dist/components/references/URefCardGroup.component.d.ts +0 -26
  227. package/dist/components/references/URefCardGroup.component.js +0 -88
  228. package/dist/components/references/URefTag.component.d.ts +0 -13
  229. package/dist/components/references/URefTag.component.js +0 -54
  230. package/dist/components/widgets/UChartWidget.component.js +0 -180
  231. package/dist/components/widgets/UChartWidget.d.ts +0 -7
  232. package/dist/components/widgets/UChartWidget.js +0 -5
  233. package/dist/components/widgets/UImagesWidget.component.js +0 -164
  234. package/dist/components/widgets/UImagesWidget.d.ts +0 -7
  235. package/dist/components/widgets/UImagesWidget.js +0 -5
  236. package/dist/components/widgets/UMapWidget.component.js +0 -65
  237. package/dist/components/widgets/UMapWidget.d.ts +0 -7
  238. package/dist/components/widgets/UMapWidget.js +0 -5
  239. package/dist/components/widgets/UMapWidget.styles.d.ts +0 -1
  240. package/dist/components/widgets/UVideoWidget.component.js +0 -106
  241. package/dist/components/widgets/UVideoWidget.d.ts +0 -7
  242. package/dist/components/widgets/UVideoWidget.js +0 -5
  243. package/dist/components/widgets/UVideoWidget.styles.d.ts +0 -1
  244. package/dist/components/widgets/UWidget.component.js +0 -140
  245. package/dist/components/widgets/UWidget.d.ts +0 -7
  246. package/dist/components/widgets/UWidget.js +0 -5
  247. package/dist/components/widgets/UWidget.styles.d.ts +0 -1
  248. package/dist/events/UCancelEvent.d.ts +0 -6
  249. package/dist/events/USubmitEvent.d.ts +0 -6
  250. package/dist/types/Actions.d.ts +0 -24
  251. package/dist/types/Actions.js +0 -34
  252. package/dist/types/Widgets.js +0 -115
  253. package/dist/utilities/ActionPromptBuilder.d.ts +0 -40
  254. package/dist/utilities/ActionPromptBuilder.js +0 -93
  255. package/dist/utilities/WidgetPromptBuilder.d.ts +0 -28
  256. package/dist/utilities/WidgetPromptBuilder.js +0 -87
  257. package/dist/utilities/converters.d.ts +0 -9
  258. package/dist/utilities/converters.js +0 -19
  259. /package/dist/components/{actions/UQuestionAction.styles.d.ts → blocks/UFileBlock.styles.d.ts} +0 -0
  260. /package/dist/components/{blocks/UFilesBlock.styles.d.ts → intents/UQuestionIntent.styles.d.ts} +0 -0
  261. /package/dist/components/{buttons/UReportButton.styles.d.ts → views/UChartView.styles.d.ts} +0 -0
  262. /package/dist/components/{buttons/URetryButton.styles.d.ts → views/UImagesView.styles.d.ts} +0 -0
  263. /package/dist/components/{buttons/UShareButton.styles.d.ts → views/UMapView.styles.d.ts} +0 -0
  264. /package/dist/components/{widgets/UChartWidget.styles.d.ts → views/UVideoView.styles.d.ts} +0 -0
  265. /package/dist/components/{widgets/UImagesWidget.styles.d.ts → views/UView.styles.d.ts} +0 -0
@@ -0,0 +1,46 @@
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 |
@@ -0,0 +1,64 @@
1
+ # u-file-block
2
+
3
+ ```ts
4
+ import '@iyulab/chat-components/dist/components/blocks/UFileBlock.js';
5
+ ```
6
+
7
+ **Tag:** `u-file-block`
8
+
9
+ Displays a single file as a card. Shows a type-appropriate icon, upload status, download link, and an optional remove button.
10
+
11
+ ```html
12
+ <!-- Image file -->
13
+ <u-file-block name="photo.png" type="image/png" size=${102400}></u-file-block>
14
+
15
+ <!-- Uploading state -->
16
+ <u-file-block name="document.pdf" type="application/pdf" status="uploading"></u-file-block>
17
+
18
+ <!-- With download link -->
19
+ <u-file-block
20
+ name="report.xlsx"
21
+ type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
22
+ size=${512000}
23
+ url="https://example.com/report.xlsx"
24
+ ></u-file-block>
25
+
26
+ <!-- Removable (e.g. prompt attachment) -->
27
+ <u-file-block
28
+ removable
29
+ name="image.jpg"
30
+ type="image/jpeg"
31
+ @remove=${handleRemove}
32
+ ></u-file-block>
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Properties
38
+
39
+ | Property | Type | Default | Reflect | Description |
40
+ |----------|------|---------|---------|-------------|
41
+ | `removable` | `boolean` | `false` | ✓ | Shows the remove button |
42
+ | `status` | `'idle'\|'uploading'\|'error'` | `undefined` | ✓ | File state. `uploading` shows spinner; `error` shows error icon |
43
+ | `name` | `string` | `undefined` | — | File name |
44
+ | `type` | `string` | `undefined` | — | MIME type (determines icon) |
45
+ | `size` | `number` | `undefined` | — | File size in bytes; auto-formatted to KB/MB |
46
+ | `url` | `string` | `undefined` | — | Download URL. Shows download button when set |
47
+
48
+ ## Events
49
+
50
+ | Event | Detail | Description |
51
+ |-------|--------|-------------|
52
+ | `remove` | `RemoveEventDetail` | Fired when the remove button is clicked. If not cancelled, the element removes itself from the DOM |
53
+
54
+ ## Icon Resolution by MIME Type
55
+
56
+ | MIME | Icon |
57
+ |------|------|
58
+ | `image/*` | `file-earmark-image` |
59
+ | `video/*` | `file-earmark-play` |
60
+ | `audio/*` | `file-earmark-music` |
61
+ | `application/pdf` | `file-earmark-pdf` |
62
+ | `application/zip` | `file-earmark-zip` |
63
+ | `text/*` | `file-earmark-text` |
64
+ | other | `file-earmark` |
@@ -0,0 +1,63 @@
1
+ # u-images-view
2
+
3
+ ```ts
4
+ import '@iyulab/chat-components/dist/components/views/UImagesView.js';
5
+ ```
6
+
7
+ **Tag:** `u-images-view`
8
+
9
+ Image gallery view. Uses `u-carousel` for a horizontal slide layout, with a click-to-open lightbox. Shows up to 3 slides at once. Keyboard arrow keys navigate the lightbox.
10
+
11
+ Automatically rendered by `u-marked-block` from a `view-json` code block.
12
+
13
+ ```html
14
+ <!-- Direct usage -->
15
+ <u-images-view
16
+ .items=${[
17
+ { src: 'https://example.com/photo1.jpg', alt: 'First photo', caption: 'Seoul at night' },
18
+ { src: 'https://example.com/photo2.jpg', caption: 'Busan beach' },
19
+ { src: 'https://example.com/photo3.jpg' }
20
+ ]}
21
+ ></u-images-view>
22
+ ```
23
+
24
+ LLM output example (`view-json` code block):
25
+
26
+ ````
27
+ ```view-json
28
+ {
29
+ "tag": "u-images-view",
30
+ "properties": {
31
+ "items": [
32
+ { "src": "https://example.com/photo.jpg", "alt": "Description", "caption": "Caption" }
33
+ ]
34
+ }
35
+ }
36
+ ```
37
+ ````
38
+
39
+ ---
40
+
41
+ ## Properties
42
+
43
+ | Property | Type | Default | Description |
44
+ |----------|------|---------|-------------|
45
+ | `items` | `ImageSlide[]` | `[]` | Array of image slide objects |
46
+
47
+ ## ImageSlide Type
48
+
49
+ ```ts
50
+ interface ImageSlide {
51
+ src: string; // Image URL (required)
52
+ alt?: string; // Accessibility alt text
53
+ caption?: string; // Caption shown below the image
54
+ }
55
+ ```
56
+
57
+ ## Features
58
+
59
+ | Feature | Description |
60
+ |---------|-------------|
61
+ | Carousel | Up to 3 slides visible; draggable |
62
+ | Lightbox | Full-screen modal on image click |
63
+ | Keyboard | `←` `→` to navigate, `Esc` to close |
@@ -0,0 +1,41 @@
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
+ ```
@@ -0,0 +1,54 @@
1
+ # u-map-view
2
+
3
+ ```ts
4
+ import '@iyulab/chat-components/dist/components/views/UMapView.js';
5
+ ```
6
+
7
+ **Tag:** `u-map-view`
8
+
9
+ Embeds an OpenStreetMap iframe centered on a given coordinate. A marker is placed at the specified `lat`/`lng` position.
10
+
11
+ ```html
12
+ <!-- Basic map -->
13
+ <u-map-view lat="37.5665" lng="126.9780"></u-map-view>
14
+
15
+ <!-- With label, description, and zoom -->
16
+ <u-map-view
17
+ lat="37.5665"
18
+ lng="126.9780"
19
+ zoom="13"
20
+ label="Seoul City Hall"
21
+ description="110 Sejong-daero, Jung-gu, Seoul"
22
+ ></u-map-view>
23
+ ```
24
+
25
+ LLM output example (`view-json` code block):
26
+
27
+ ````
28
+ ```view-json
29
+ {
30
+ "tag": "u-map-view",
31
+ "properties": {
32
+ "lat": 37.5665,
33
+ "lng": 126.9780,
34
+ "zoom": 15,
35
+ "label": "Seoul City Hall",
36
+ "description": "Jung-gu, Seoul"
37
+ }
38
+ }
39
+ ```
40
+ ````
41
+
42
+ ---
43
+
44
+ ## Properties
45
+
46
+ | Property | Type | Default | Description |
47
+ |----------|------|---------|-------------|
48
+ | `lat` | `number` | `undefined` | Latitude (required) |
49
+ | `lng` | `number` | `undefined` | Longitude (required) |
50
+ | `zoom` | `number` | `15` | Zoom level (1–19) |
51
+ | `label` | `string` | `undefined` | Bold label shown below the map |
52
+ | `description` | `string` | `undefined` | Description shown below the label |
53
+
54
+ Renders nothing if either `lat` or `lng` is missing.
@@ -0,0 +1,53 @@
1
+ # u-marked-block
2
+
3
+ ```ts
4
+ import '@iyulab/chat-components/dist/components/blocks/UMarkedBlock.js';
5
+ ```
6
+
7
+ **Tag:** `u-marked-block`
8
+
9
+ Renders markdown text to HTML. Supports KaTeX math equations, code syntax highlighting, inline citation tag injection, and special handling for `view-json` and `intent-json` code blocks. Applying an 80ms debounce makes it suitable for LLM streaming.
10
+
11
+ **Special code fences:**
12
+ - `` ```view-json `` → automatically rendered as a `u-view` component
13
+ - `` ```intent-json `` → stripped from output (must be parsed separately via `IntentPromptBuilder`)
14
+ - All other HTML inside markdown is escaped to prevent XSS
15
+
16
+ ```html
17
+ <!-- Basic markdown -->
18
+ <u-marked-block value="# Hello\n\nThis is **bold** and `code`."></u-marked-block>
19
+
20
+ <!-- Math equations -->
21
+ <u-marked-block value="Euler's identity: $e^{i\pi} + 1 = 0$"></u-marked-block>
22
+
23
+ <!-- With citation references -->
24
+ <u-marked-block
25
+ .value=${"The Earth orbits the Sun."}
26
+ .refs=${[{
27
+ startIndex: 4,
28
+ endIndex: 9,
29
+ label: '[1]',
30
+ sources: [{ type: 'web', url: 'https://...', title: 'Source' }]
31
+ }]}
32
+ ></u-marked-block>
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Properties
38
+
39
+ | Property | Type | Default | Description |
40
+ |----------|------|---------|-------------|
41
+ | `value` | `string` | `undefined` | Markdown text to render |
42
+ | `refs` | `ReferenceCitation[]` | `undefined` | Citation list. `u-ref-tag` elements are automatically inserted at `startIndex`/`endIndex` positions |
43
+
44
+ ## ReferenceCitation Type
45
+
46
+ ```ts
47
+ interface ReferenceCitation {
48
+ startIndex: number; // Start character index in the markdown text
49
+ endIndex: number; // End character index
50
+ label?: string; // Display label, e.g. "[1]" or "(Smith, 2023)"
51
+ sources: ReferenceSource[];
52
+ }
53
+ ```
@@ -0,0 +1,60 @@
1
+ # u-message
2
+
3
+ ```ts
4
+ import '@iyulab/chat-components/dist/components/message/UMessage.js';
5
+ ```
6
+
7
+ **Tag:** `u-message`
8
+
9
+ Chat message wrapper component. Arranges content blocks via slots, shows a loading animation while the response streams in, and supports bubble or default visual styles.
10
+
11
+ ```html
12
+ <!-- Default AI message -->
13
+ <u-message>
14
+ <u-marked-block .value=${"## Hello\nMarkdown here."}></u-marked-block>
15
+ </u-message>
16
+
17
+ <!-- User message (right-aligned, bubble style) -->
18
+ <u-message position="right" variant="bubble">
19
+ <u-text-block .value=${"Hello!"}></u-text-block>
20
+ </u-message>
21
+
22
+ <!-- Loading state (streaming) -->
23
+ <u-message loading>
24
+ <u-marked-block .value=${"Streaming..."}></u-marked-block>
25
+ </u-message>
26
+
27
+ <!-- With header and footer slots -->
28
+ <u-message>
29
+ <div slot="header">AI Assistant</div>
30
+ <u-marked-block .value=${content}></u-marked-block>
31
+ <div slot="footer">
32
+ <u-copy-button .value=${content}></u-copy-button>
33
+ <u-vote-button></u-vote-button>
34
+ </div>
35
+ </u-message>
36
+ ```
37
+
38
+ ---
39
+
40
+ ## Slots
41
+
42
+ | Name | Description |
43
+ |------|-------------|
44
+ | `header` | Area above the message body (avatar, name, etc.) |
45
+ | *(default)* | Message content blocks |
46
+ | `footer` | Area below the message body (buttons, etc.); hidden while `loading` |
47
+
48
+ ## Properties
49
+
50
+ | Property | Type | Default | Reflect | Description |
51
+ |----------|------|---------|---------|-------------|
52
+ | `loading` | `boolean` | `false` | ✓ | Loading state. Shows three-dot animation; hides `footer` slot |
53
+ | `variant` | `'default'\|'bubble'` | `'default'` | ✓ | Visual style |
54
+ | `position` | `'left'\|'right'` | `'left'` | ✓ | Message alignment |
55
+
56
+ ## CSS Parts
57
+
58
+ | Part | Description |
59
+ |------|-------------|
60
+ | `body` | Message body wrapper |
@@ -0,0 +1,102 @@
1
+ # u-prompt
2
+
3
+ ```ts
4
+ import '@iyulab/chat-components/dist/components/prompt/UPrompt.js';
5
+ ```
6
+
7
+ **Tag:** `u-prompt`
8
+
9
+ Chat input component. Combines a text input area, file attachment previews, and an integrated send/stop button.
10
+
11
+ ```html
12
+ <!-- Basic usage -->
13
+ <u-prompt placeholder="Type a message..."></u-prompt>
14
+
15
+ <!-- Loading (streaming) state -->
16
+ <u-prompt loading></u-prompt>
17
+
18
+ <!-- With file attach button -->
19
+ <u-prompt>
20
+ <u-attach-button slot="left-actions" multiple accept="image/*,application/pdf">
21
+ Attach
22
+ </u-attach-button>
23
+ </u-prompt>
24
+ ```
25
+
26
+ ```ts
27
+ const prompt = document.querySelector('u-prompt');
28
+
29
+ // Send event
30
+ prompt.addEventListener('send', () => {
31
+ console.log('value:', prompt.value);
32
+ console.log('files:', prompt.files);
33
+ });
34
+
35
+ // Stop event (fired when send button is clicked while loading=true)
36
+ prompt.addEventListener('stop', () => {
37
+ console.log('stopped');
38
+ });
39
+
40
+ // Wire up file attach button
41
+ prompt.addEventListener('attach', (e) => {
42
+ const { files } = e.detail;
43
+ prompt.files = [
44
+ ...(prompt.files ?? []),
45
+ ...files.map(f => ({
46
+ type: 'file' as const,
47
+ name: f.name,
48
+ size: f.size,
49
+ mimeType: f.type,
50
+ status: 'idle' as const,
51
+ }))
52
+ ];
53
+ });
54
+
55
+ // Programmatic submit
56
+ prompt.submit();
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Slots
62
+
63
+ | Name | Description |
64
+ |------|-------------|
65
+ | `header` | Area above the input |
66
+ | `left-actions` | Left side of the control bar (e.g. attach button) |
67
+ | `right-actions` | Right side of the control bar |
68
+ | `footer` | Area below the input |
69
+
70
+ ## Properties
71
+
72
+ | Property | Type | Default | Reflect | Description |
73
+ |----------|------|---------|---------|-------------|
74
+ | `loading` | `boolean` | `false` | ✓ | Loading state. Send button becomes a stop button |
75
+ | `value` | `string` | `undefined` | — | Text input value |
76
+ | `files` | `FileBlockItem[]` | `undefined` | — | Attached file list |
77
+ | `placeholder` | `string` | `undefined` | — | Input placeholder text |
78
+ | `minRows` | `number` | `1` | — | Minimum textarea rows |
79
+ | `maxRows` | `number` | `10` | — | Maximum textarea rows (scrolls beyond) |
80
+
81
+ ## Methods
82
+
83
+ | Method | Description |
84
+ |--------|-------------|
85
+ | `submit()` | Programmatically submit. Fires `stop` if loading, otherwise fires `send` (only when value or files present) |
86
+
87
+ ## Events
88
+
89
+ | Event | Detail | Description |
90
+ |-------|--------|-------------|
91
+ | `send` | `unknown` | Fired on Enter or send button click |
92
+ | `stop` | `unknown` | Fired on send button click while loading |
93
+ | `remove` | `RemoveEventDetail` | Fired when an attached file's remove button is clicked |
94
+
95
+ ## CSS Parts
96
+
97
+ | Part | Description |
98
+ |------|-------------|
99
+ | `input` | Text input area (`u-text-block`) |
100
+ | `files` | File attachment preview area |
101
+ | `control` | Bottom control row (actions + send button) |
102
+ | `send-btn` | Send / stop button |
@@ -0,0 +1,75 @@
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 |
@@ -0,0 +1,45 @@
1
+ # u-ref-block
2
+
3
+ ```ts
4
+ import '@iyulab/chat-components/dist/components/blocks/URefBlock.js';
5
+ ```
6
+
7
+ **Tag:** `u-ref-block`
8
+
9
+ Displays a group of reference sources as a collapsible block with a `u-ref-card` grid layout.
10
+
11
+ ```html
12
+ <!-- Basic usage -->
13
+ <u-ref-block
14
+ title="References"
15
+ .sources=${[
16
+ { type: 'web', url: 'https://example.com', title: 'Example Page', snippet: 'Summary...' },
17
+ { type: 'document', title: 'Internal Report', snippet: 'Excerpt...', tags: ['report'] }
18
+ ]}
19
+ ></u-ref-block>
20
+
21
+ <!-- Expanded by default -->
22
+ <u-ref-block .collapsed=${false} .sources=${sources}></u-ref-block>
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Properties
28
+
29
+ | Property | Type | Default | Reflect | Description |
30
+ |----------|------|---------|---------|-------------|
31
+ | `title` | `string` | `''` | — | Header title (falls back to 'References') |
32
+ | `collapsed` | `boolean` | `true` | ✓ | Collapsed state. Toggle by clicking the header |
33
+ | `sources` | `ReferenceSource[]` | `undefined` | — | List of reference sources |
34
+
35
+ ## ReferenceSource Type
36
+
37
+ ```ts
38
+ interface ReferenceSource {
39
+ type: 'web' | 'document';
40
+ url?: string; // Link URL
41
+ title?: string; // Card title
42
+ snippet?: string; // Excerpt text
43
+ tags?: string[]; // Tag list
44
+ }
45
+ ```
@@ -0,0 +1,41 @@
1
+ # u-ref-card-group
2
+
3
+ ```ts
4
+ import '@iyulab/chat-components/dist/components/references/URefCardGroup.js';
5
+ ```
6
+
7
+ **Tag:** `u-ref-card-group`
8
+
9
+ Groups multiple `u-ref-card` elements into a paginated slider. Previous/next navigation and a page indicator appear automatically when there are 2 or more cards.
10
+
11
+ Used automatically by `u-marked-block` when processing citation data.
12
+
13
+ ```html
14
+ <u-ref-card-group>
15
+ <u-ref-card type="web" url="https://example.com/1" title="First Source"></u-ref-card>
16
+ <u-ref-card type="web" url="https://example.com/2" title="Second Source"></u-ref-card>
17
+ <u-ref-card type="document" title="Internal Doc"></u-ref-card>
18
+ </u-ref-card-group>
19
+ ```
20
+
21
+ ```ts
22
+ const group = document.querySelector('u-ref-card-group');
23
+
24
+ // Navigate to a specific card
25
+ group.switch(1); // go to second card
26
+ group.switch(-1); // wraps to last card
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Slots
32
+
33
+ | Name | Description |
34
+ |------|-------------|
35
+ | *(default)* | `u-ref-card` elements |
36
+
37
+ ## Methods
38
+
39
+ | Method | Description |
40
+ |--------|-------------|
41
+ | `switch(index)` | Navigate to the card at `index`. Wraps around on out-of-bounds values |