@iyulab/chat-components 0.4.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 (237) hide show
  1. package/CHANGELOG.md +124 -21
  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 +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 +32 -2
  50. package/dist/components/prompt/UPrompt.js +118 -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 +7 -0
  79. package/dist/events/StopEvent.d.ts +7 -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 +32 -16
  146. package/dist/assets/action-prompt.md.js +0 -3
  147. package/dist/assets/widget-prompt.md.js +0 -3
  148. package/dist/components/actions/UQuestionAction.component.js +0 -58
  149. package/dist/components/actions/UQuestionAction.d.ts +0 -7
  150. package/dist/components/actions/UQuestionAction.js +0 -5
  151. package/dist/components/blocks/UCodeBlock.component.d.ts +0 -25
  152. package/dist/components/blocks/UCodeBlock.component.js +0 -88
  153. package/dist/components/blocks/UFilesBlock.component.d.ts +0 -22
  154. package/dist/components/blocks/UFilesBlock.component.js +0 -192
  155. package/dist/components/blocks/UFilesBlock.d.ts +0 -7
  156. package/dist/components/blocks/UFilesBlock.js +0 -5
  157. package/dist/components/blocks/UJsonBlock.component.d.ts +0 -45
  158. package/dist/components/blocks/UJsonBlock.component.js +0 -140
  159. package/dist/components/blocks/UMarkedBlock.component.d.ts +0 -40
  160. package/dist/components/blocks/UMarkedBlock.component.js +0 -159
  161. package/dist/components/blocks/URefBlock.component.d.ts +0 -17
  162. package/dist/components/blocks/URefBlock.component.js +0 -73
  163. package/dist/components/blocks/UTableBlock.component.d.ts +0 -49
  164. package/dist/components/blocks/UTableBlock.component.js +0 -228
  165. package/dist/components/blocks/UTextBlock.component.d.ts +0 -37
  166. package/dist/components/blocks/UTextBlock.component.js +0 -123
  167. package/dist/components/blocks/UThinkBlock.component.d.ts +0 -23
  168. package/dist/components/blocks/UThinkBlock.component.js +0 -90
  169. package/dist/components/blocks/UToolBlock.component.d.ts +0 -20
  170. package/dist/components/blocks/UToolBlock.component.js +0 -80
  171. package/dist/components/buttons/UAttachButton.component.d.ts +0 -22
  172. package/dist/components/buttons/UAttachButton.component.js +0 -89
  173. package/dist/components/buttons/UCopyButton.component.d.ts +0 -20
  174. package/dist/components/buttons/UCopyButton.component.js +0 -81
  175. package/dist/components/buttons/UReportButton.component.d.ts +0 -9
  176. package/dist/components/buttons/UReportButton.component.js +0 -36
  177. package/dist/components/buttons/UReportButton.d.ts +0 -7
  178. package/dist/components/buttons/UReportButton.js +0 -5
  179. package/dist/components/buttons/UReportButton.styles.js +0 -14
  180. package/dist/components/buttons/URetryButton.component.d.ts +0 -11
  181. package/dist/components/buttons/URetryButton.component.js +0 -53
  182. package/dist/components/buttons/URetryButton.d.ts +0 -7
  183. package/dist/components/buttons/URetryButton.js +0 -5
  184. package/dist/components/buttons/URetryButton.styles.js +0 -26
  185. package/dist/components/buttons/UShareButton.component.d.ts +0 -9
  186. package/dist/components/buttons/UShareButton.component.js +0 -36
  187. package/dist/components/buttons/UShareButton.d.ts +0 -7
  188. package/dist/components/buttons/UShareButton.js +0 -5
  189. package/dist/components/buttons/UShareButton.styles.js +0 -14
  190. package/dist/components/buttons/UVoteButton.component.d.ts +0 -15
  191. package/dist/components/buttons/UVoteButton.component.js +0 -73
  192. package/dist/components/message/UMessage.component.d.ts +0 -19
  193. package/dist/components/message/UMessage.component.js +0 -56
  194. package/dist/components/prompt/UPrompt.component.d.ts +0 -25
  195. package/dist/components/prompt/UPrompt.component.js +0 -113
  196. package/dist/components/references/URefCard.component.d.ts +0 -27
  197. package/dist/components/references/URefCard.component.js +0 -109
  198. package/dist/components/references/URefCardGroup.component.d.ts +0 -26
  199. package/dist/components/references/URefCardGroup.component.js +0 -88
  200. package/dist/components/references/URefTag.component.d.ts +0 -13
  201. package/dist/components/references/URefTag.component.js +0 -54
  202. package/dist/components/widgets/UChartWidget.component.js +0 -180
  203. package/dist/components/widgets/UChartWidget.d.ts +0 -7
  204. package/dist/components/widgets/UChartWidget.js +0 -5
  205. package/dist/components/widgets/UImagesWidget.component.js +0 -164
  206. package/dist/components/widgets/UImagesWidget.d.ts +0 -7
  207. package/dist/components/widgets/UImagesWidget.js +0 -5
  208. package/dist/components/widgets/UMapWidget.component.js +0 -65
  209. package/dist/components/widgets/UMapWidget.d.ts +0 -7
  210. package/dist/components/widgets/UMapWidget.js +0 -5
  211. package/dist/components/widgets/UMapWidget.styles.d.ts +0 -1
  212. package/dist/components/widgets/UVideoWidget.component.js +0 -106
  213. package/dist/components/widgets/UVideoWidget.d.ts +0 -7
  214. package/dist/components/widgets/UVideoWidget.js +0 -5
  215. package/dist/components/widgets/UVideoWidget.styles.d.ts +0 -1
  216. package/dist/components/widgets/UWidget.component.js +0 -140
  217. package/dist/components/widgets/UWidget.d.ts +0 -7
  218. package/dist/components/widgets/UWidget.js +0 -5
  219. package/dist/components/widgets/UWidget.styles.d.ts +0 -1
  220. package/dist/events/UCancelEvent.d.ts +0 -6
  221. package/dist/events/USubmitEvent.d.ts +0 -6
  222. package/dist/types/Actions.d.ts +0 -24
  223. package/dist/types/Actions.js +0 -34
  224. package/dist/types/Widgets.js +0 -115
  225. package/dist/utilities/ActionPromptBuilder.d.ts +0 -40
  226. package/dist/utilities/ActionPromptBuilder.js +0 -93
  227. package/dist/utilities/WidgetPromptBuilder.d.ts +0 -28
  228. package/dist/utilities/WidgetPromptBuilder.js +0 -87
  229. package/dist/utilities/converters.d.ts +0 -9
  230. package/dist/utilities/converters.js +0 -19
  231. /package/dist/components/{actions/UQuestionAction.styles.d.ts → blocks/UFileBlock.styles.d.ts} +0 -0
  232. /package/dist/components/{blocks/UFilesBlock.styles.d.ts → intents/UQuestionIntent.styles.d.ts} +0 -0
  233. /package/dist/components/{buttons/UReportButton.styles.d.ts → views/UChartView.styles.d.ts} +0 -0
  234. /package/dist/components/{buttons/URetryButton.styles.d.ts → views/UImagesView.styles.d.ts} +0 -0
  235. /package/dist/components/{buttons/UShareButton.styles.d.ts → views/UMapView.styles.d.ts} +0 -0
  236. /package/dist/components/{widgets/UChartWidget.styles.d.ts → views/UVideoView.styles.d.ts} +0 -0
  237. /package/dist/components/{widgets/UImagesWidget.styles.d.ts → views/UView.styles.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,45 +1,148 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0 (2026-04-01)
4
+
5
+ ### Breaking Changes
6
+
7
+ #### Full rename: Widget → View, Action → Intent
8
+ - **Widget System → View System**: All widget components renamed to views
9
+ - `UImagesWidget` → `UImagesView`
10
+ - `UVideoWidget` → `UVideoView`
11
+ - `UMapWidget` → `UMapView`
12
+ - `UChartWidget` → `UChartView`
13
+ - `UWidget` → `UView`
14
+ - `types/Widgets.ts` → `types/Views.ts` (`WidgetDefinition`, `PresetWidget` → `ViewDefinition`, `PresetView`)
15
+ - `WidgetPromptBuilder` → `ViewPromptBuilder`
16
+ - **Action System → Intent System**
17
+ - `UQuestionAction` → `UQuestionIntent`
18
+ - `types/Actions.ts` → `types/Intents.ts` (`ActionDefinition` → `IntentDefinition`)
19
+ - `ActionPromptBuilder` → `IntentPromptBuilder`
20
+
21
+ #### Event type renames
22
+ - `UCancelEvent` → `StopEvent`
23
+ - `USubmitEvent` → `SendEvent`
24
+ - Importing the old names will cause compile errors
25
+
26
+ #### Block rename
27
+ - `UFilesBlock` → `UFileBlock` (plural → singular)
28
+ - `FilesBlockItem` + `FileItem` → `FileBlockItem` (simplified structure)
29
+ - `FileUploadStatus` type removed — replaced by `status?: "idle" | "uploading" | "error"` field
30
+
31
+ #### Removed components
32
+ - `UReportButton`, `URetryButton`, `UShareButton` removed
33
+
34
+ #### `UToolBlock` property rename
35
+ - `heading` → `title`
36
+
37
+ #### `package.json` exports change
38
+ - `./dist/*` mapping simplified to a direct `./src/*` mapping
39
+ - `chart.js` moved from `dependencies` to optional `peerDependencies`
40
+
41
+ ### Added
42
+
43
+ #### New events
44
+ - `AttachEvent` (`attach`) — file attach event (`detail.files: File[]`)
45
+ - `ChoiceEvent` (`choice`) — choice selection event (`detail.value: string`)
46
+
47
+ #### DOM Agent utilities (`src/utilities/dom-agent/`) — Experimental
48
+ A utility suite enabling LLMs to autonomously interact with web pages (currently disabled in the main index export)
49
+ - `DOMScanner` — scans the DOM and extracts interactive elements (includes Shadow DOM, supports filter strategies)
50
+ - `DOMController` — executes LLM commands (`click`, `input`, `select`, `scroll`, etc.) against the live DOM
51
+ - `DOMAgent` — orchestrates Scanner and Controller into an automation agent (event-driven, execution history)
52
+ - `DOMPromptBuilder` — builds LLM prompts and formats multimodal messages (Anthropic / OpenAI)
53
+
54
+ #### React bindings
55
+ - Added `./react` package export entry point
56
+ - `@lit/react` and `react` added as optional peerDependencies
57
+
58
+ #### html2canvas dependency
59
+ - Added `html2canvas` for screenshot capture support
60
+
61
+ #### Type improvements
62
+ - `ThinkingBlockItem`: added `loading?: boolean` field
63
+ - `ToolBlockItem`: added `loading?: boolean` field
64
+
65
+ #### Skills documentation
66
+ - `skills/iyulab-chat-components/` — full component reference and utility docs added
67
+
68
+ ### Changed
69
+
70
+ #### Component file structure consolidation
71
+ - Split `.component.ts` + `.ts` pattern → merged into a single `.ts` file per component
72
+ - Component registration switched to `@customElement()` decorator
73
+
74
+ #### Bug fix
75
+ - `UTableBlock`: fixed inline markdown (**bold**, `` `code` ``, `<br>`, etc.) inside table cells rendering as raw text (now uses `Parser.parseInline()`)
76
+
77
+ #### `UThinkBlock` improvements
78
+ - Added `auto-scroll` attribute — automatically scrolls to bottom when `value` changes
79
+ - Added public `scrollToBottom()` method
80
+ - Auto-scroll is now interrupted by wheel or touch input
81
+
82
+ #### Dependency updates
83
+ - `@iyulab/components`: `^0.4.0` → `^1.0.1`
84
+ - `marked`: `^17.0.3` → `^17.0.5`
85
+ - `vite`: `^7.3.1` → `^8.0.3`
86
+ - `openai` (dev): `^6.25.0` → `^6.33.0`
87
+
88
+ #### Documentation overhaul
89
+ - `README.md` fully rewritten with detailed API documentation
90
+ - New `docs/` pages: architecture, block system, events, intent system, view system
91
+ - Old `docs/components/` files removed
92
+
93
+ ### Removed
94
+ - `UReportButton`, `URetryButton`, `UShareButton`
95
+ - `UCancelEvent`, `USubmitEvent` (→ `StopEvent`, `SendEvent`)
96
+ - `UQuestionAction` (→ `UQuestionIntent`)
97
+ - `UWidget`, `UImagesWidget`, `UVideoWidget`, `UMapWidget`, `UChartWidget` (→ View equivalents)
98
+ - `ActionPromptBuilder`, `WidgetPromptBuilder` (→ `IntentPromptBuilder`, `ViewPromptBuilder`)
99
+ - `types/Actions.ts`, `types/Widgets.ts` (→ `types/Intents.ts`, `types/Views.ts`)
100
+ - `utilities/converters.ts` (moved to `@iyulab/components`)
101
+ - `TODO.md`
102
+ - All `.component.ts` split files
103
+
104
+ ---
105
+
3
106
  ## 0.4.0 (2026-03-03)
4
107
 
5
108
  ### Breaking Changes
6
- - `UMessage`의 `items` prop이 제거됨 — slot 방식으로 블록 컴포넌트를 직접 삽입해야 함
7
- - `UMessage`의 `BaseElement` 의존성이 `UElement`로 변경됨
109
+ - `UMessage`: `items` prop removed — block components must now be inserted directly via slots
110
+ - `UMessage`: base class changed from `BaseElement` to `UElement`
8
111
 
9
112
  ### Added
10
113
 
11
114
  #### Widget System
12
- - `UWidget` - 위젯 컨테이너 컴포넌트 (widget-json 블록 기반 동적 렌더링)
13
- - `UImagesWidget` - 이미지 갤러리 위젯 (스크롤 가능한 이미지 목록 표시)
14
- - `UVideoWidget` - 비디오 임베드 위젯 (YouTube, Vimeo, 직접 URL 지원)
15
- - `UMapWidget` - OpenStreetMap 기반 지도 위젯 (위경도 좌표 및 마커 표시)
16
- - `UChartWidget` - Chart.js 기반 차트 위젯 (bar, line, pie, doughnut 등 8가지 타입, PNG/JSON 다운로드, 전체화면, 다크모드 테마 자동 감지)
115
+ - `UWidget` — widget container component (dynamic rendering from `widget-json` blocks)
116
+ - `UImagesWidget` — scrollable image gallery widget
117
+ - `UVideoWidget` — video embed widget (YouTube, Vimeo, and direct URL support)
118
+ - `UMapWidget` — OpenStreetMap-based map widget (lat/lng coordinates and marker display)
119
+ - `UChartWidget` — Chart.js chart widget (8 types: bar, line, pie, doughnut, etc.; PNG/JSON download, fullscreen, auto dark-mode theme detection)
17
120
 
18
121
  #### Action System
19
- - `UQuestionAction` - 클릭 가능한 선택지를 제공하는 질문 액션 컴포넌트 (action-json 블록 기반)
122
+ - `UQuestionAction` — clickable question choices component (rendered from `action-json` block)
20
123
 
21
124
  #### New Block Types
22
- - `UFilesBlock` - 파일 첨부 목록 표시 블록 (파일명, 크기, MIME 타입, 다운로드 URL 지원, 삭제 버튼 옵션)
23
- - `UTableBlock` - 테이블 표시 블록
125
+ - `UFilesBlock` — file attachment list block (filename, size, MIME type, download URL, optional delete button)
126
+ - `UTableBlock` — table display block
24
127
 
25
128
  #### New Types
26
- - `JsonSchema` - LLM용 JSON Schema 타입 (`BooleanJsonSchema`, `StringJsonSchema`, `NumberJsonSchema`, `ArrayJsonSchema`, `ObjectJsonSchema`)
27
- - `ActionDefinition`, `ActionSchema`, `PresetAction` - 액션 정의 및 프리셋 타입
28
- - `WidgetDefinition`, `PresetWidget` - 위젯 정의 및 프리셋 타입 (`Images`, `Video`, `Map`, `Chart`)
29
- - `FilesBlockItem`, `FileItem` - 파일 블록 타입
30
- - `MessageFit` - 메시지 너비 설정 타입 (`full` | `auto`)
129
+ - `JsonSchema` — JSON Schema types for LLM use (`BooleanJsonSchema`, `StringJsonSchema`, `NumberJsonSchema`, `ArrayJsonSchema`, `ObjectJsonSchema`)
130
+ - `ActionDefinition`, `ActionSchema`, `PresetAction` — action definition and preset types
131
+ - `WidgetDefinition`, `PresetWidget` — widget definition and preset types (`Images`, `Video`, `Map`, `Chart`)
132
+ - `FilesBlockItem`, `FileItem` — file block types
133
+ - `MessageFit` — message width setting type (`full` | `auto`)
31
134
 
32
135
  #### New Utilities
33
- - `ActionPromptBuilder` - LLM 액션 프롬프트 자동 생성 유틸리티
34
- - `WidgetPromptBuilder` - LLM 위젯 프롬프트 자동 생성 유틸리티
136
+ - `ActionPromptBuilder` — utility for auto-generating LLM action prompts
137
+ - `WidgetPromptBuilder` — utility for auto-generating LLM widget prompts
35
138
 
36
139
  ### Changed
37
- - `UMessage`: `BaseElement` → `UElement` 로 변경, `items` prop 제거 및 slot 기반 렌더링으로 전환, `fit` 속성(`MessageFit`) 추가
38
- - `UMarkedBlock`: 마크다운 렌더링 로직 전면 개선
39
- - `UPrompt`: 스타일 개선
140
+ - `UMessage`: migrated from `BaseElement` to `UElement`, removed `items` prop in favour of slot-based rendering, added `fit` attribute (`MessageFit`)
141
+ - `UMarkedBlock`: markdown rendering logic fully reworked
142
+ - `UPrompt`: style improvements
40
143
 
41
144
  ### Removed
42
- - `UDotLoader` 컴포넌트 제거
145
+ - `UDotLoader` component removed
43
146
 
44
147
  ---
45
148
 
package/README.md CHANGED
@@ -1,6 +1,11 @@
1
- # @iyulab/chat-components
1
+ # @iyulab/chat-components
2
2
 
3
- LLM 채팅 인터페이스를 위한 웹 컴포넌트 라이브러리
3
+ Web component library for building LLM chat interfaces — works in any framework or vanilla HTML.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@iyulab/chat-components)](https://www.npmjs.com/package/@iyulab/chat-components)
6
+ [![license](https://img.shields.io/npm/l/@iyulab/chat-components)](./LICENSE)
7
+
8
+ ---
4
9
 
5
10
  ## Installation
6
11
 
@@ -8,29 +13,141 @@ LLM 채팅 인터페이스를 위한 웹 컴포넌트 라이브러리
8
13
  npm install @iyulab/chat-components
9
14
  ```
10
15
 
11
- ## Usage
16
+ ---
17
+
18
+ ## Quick Start
12
19
 
13
- ```typescript
20
+ ```ts
14
21
  import '@iyulab/chat-components';
15
22
  ```
16
23
 
24
+ ```html
25
+ <u-message>
26
+ <u-marked-block value="# Hello&#10;&#10;This is **markdown**."></u-marked-block>
27
+ </u-message>
28
+
29
+ <u-prompt placeholder="Type a message...">
30
+ <u-attach-button slot="left-actions" multiple>Attach</u-attach-button>
31
+ </u-prompt>
32
+ ```
33
+
34
+ ```ts
35
+ const prompt = document.querySelector('u-prompt');
36
+
37
+ prompt.addEventListener('send', () => {
38
+ console.log('value:', prompt.value);
39
+ console.log('files:', prompt.files);
40
+ });
41
+ ```
42
+
43
+ > For a complete setup guide, see **[docs/getting-started.md](./docs/getting-started.md)**.
44
+
45
+ ---
46
+
47
+ ## Skills Usage
48
+
49
+ Skills for LLM coding agents (Claude Code, GitHub Copilot, Cursor, etc.).
50
+
51
+ ```bash
52
+ # Install from GitHub
53
+ npx skills add iyulab/node-chat-components
54
+
55
+ # Reference locally after package install
56
+ npx skills add ./node_modules/@iyulab/chat-components
57
+ ```
58
+
59
+ ---
60
+
17
61
  ## Components
18
62
 
19
- - `u-message` - 메시지 컴포넌트
20
- - `u-code-block` - 코드 블록
21
- - `u-marked-block` - 마크다운 렌더링
22
- - `u-text-block` - 텍스트 블록
23
- - `u-think-block` - 추론 과정 표시
24
- - `u-tool-block` - 도구 호출 표시
25
- - `u-attach-button` - 파일 첨부
26
- - `u-copy-button` - 복사 버튼
27
- - `u-send-button` - 전송 버튼
28
- - `u-think-button` - 추론 레벨 설정
63
+ ### Message & Input
64
+
65
+ | Tag | Description |
66
+ |-----|-------------|
67
+ | `u-message` | Chat message wrapper. Slot-based block layout, loading animation, bubble/default styles |
68
+ | `u-prompt` | Chat input. Auto-resize textarea, file attachment preview, integrated send/stop button |
69
+
70
+ ### Content Blocks
71
+
72
+ | Tag | Description |
73
+ |-----|-------------|
74
+ | `u-marked-block` | Markdown renderer — KaTeX, code highlighting, citation injection, view-json/intent-json handling |
75
+ | `u-code-block` | Syntax-highlighted code block (Highlight.js) with language label and copy button |
76
+ | `u-text-block` | Plain text display or editable textarea |
77
+ | `u-think-block` | LLM reasoning block — collapse/expand, auto-scroll |
78
+ | `u-tool-block` | Tool call input/output display — collapse/expand |
79
+ | `u-file-block` | File card — type icon, upload status, download, remove |
80
+ | `u-ref-block` | Reference source group — collapse/expand, card grid |
81
+ | `u-json-block` | Collapsible JSON tree |
82
+ | `u-table-block` | Table — column sort, search, CSV/XLS download |
83
+
84
+ ### Action Buttons
85
+
86
+ | Tag | Description |
87
+ |-----|-------------|
88
+ | `u-copy-button` | Copies text to clipboard; icon confirms copy |
89
+ | `u-vote-button` | Thumbs-up / thumbs-down vote pair |
90
+ | `u-attach-button` | Opens file picker; fires `attach` event |
91
+
92
+ ---
93
+
94
+ ## Intent & View Systems
95
+
96
+ ```ts
97
+ import { IntentPromptBuilder, ViewPromptBuilder, PresetIntent, PresetView } from '@iyulab/chat-components';
98
+
99
+ // Build system prompt instructions
100
+ const intentInstructions = IntentPromptBuilder.instance.use(PresetIntent.Questions).build();
101
+ const viewInstructions = ViewPromptBuilder.instance.use(PresetView.All).build();
102
+
103
+ const systemPrompt = `You are a helpful assistant.\n\n${intentInstructions}\n\n${viewInstructions}`;
104
+
105
+ // Parse LLM response
106
+ const [intents, cleanText] = IntentPromptBuilder.instance.parse(llmResponse);
107
+ markedBlock.value = cleanText; // view-json blocks inside are rendered automatically
108
+
109
+ for (const intent of intents) {
110
+ if (intent.type === 'question') {
111
+ const el = document.createElement('u-question-intent') as any;
112
+ el.question = intent.properties?.question;
113
+ el.choices = intent.properties?.choices ?? [];
114
+ el.addEventListener('choice', (e: any) => { prompt.value = e.detail.value; prompt.submit(); });
115
+ msg.appendChild(el);
116
+ }
117
+ }
118
+ ```
119
+
120
+ > - Intent system details: **[docs/intent-system.md](./docs/intent-system.md)**
121
+ > - View system details: **[docs/view-system.md](./docs/view-system.md)**
122
+
123
+ ---
124
+
125
+ ## Events
126
+
127
+ | Event | Source | Detail | Description |
128
+ |-------|--------|--------|-------------|
129
+ | `send` | `u-prompt` | — | Send button clicked or Enter pressed |
130
+ | `stop` | `u-prompt` | — | Stop button clicked while loading |
131
+ | `attach` | `u-attach-button` | `{ files: File[] }` | File selection completed |
132
+ | `choice` | `u-question-intent` | `{ value: string }` | Choice button clicked |
133
+ | `change` | `u-vote-button` | — | Vote state changed |
134
+ | `remove` | `u-file-block` | — | Remove button clicked |
135
+
136
+ ---
29
137
 
30
138
  ## Documentation
31
139
 
32
- 자세한 사용법은 [docs](./docs/README.md)를 참고하세요.
140
+ | File | Description |
141
+ |------|-------------|
142
+ | [docs/getting-started.md](./docs/getting-started.md) | Installation, basic chat UI, streaming, history rendering |
143
+ | [docs/architecture.md](./docs/architecture.md) | Package structure, class hierarchy, rendering pipeline |
144
+ | [docs/block-system.md](./docs/block-system.md) | Block components and `BlockItem` types in depth |
145
+ | [docs/intent-system.md](./docs/intent-system.md) | Intent system setup and custom intents |
146
+ | [docs/view-system.md](./docs/view-system.md) | View system setup and custom views |
147
+ | [docs/events.md](./docs/events.md) | Full event reference |
148
+
149
+ ---
33
150
 
34
151
  ## License
35
152
 
36
- MIT
153
+ MIT © iyulab
@@ -0,0 +1,9 @@
1
+ //#region \0@oxc-project+runtime@0.122.0/helpers/decorate.js
2
+ function __decorate(decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ }
8
+ //#endregion
9
+ export { __decorate };
@@ -0,0 +1,6 @@
1
+ //#region \0@oxc-project+runtime@0.122.0/helpers/decorateMetadata.js
2
+ function __decorateMetadata(k, v) {
3
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4
+ }
5
+ //#endregion
6
+ export { __decorateMetadata };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/intent-prompt.md.1907474e
2
+ var intent_prompt_md_default = "## Interactive Intents\n\nYou can guide the user with interactive intents by appending `intent-json` fenced code blocks at the end of your response. These intents can suggest follow-up questions, offer buttons to click, or provide other interactive elements that help the user continue the conversation.\n\n**Output format (the fence language must be `intent-json`):**\n```intent-json\n{\n \"type\": \"intent-type-here\",\n \"properties\" : {\n \"key\": \"value\"\n }\n}\n```\n\n**Rules — follow these STRICTLY. Violation means the feature will not work:**\n1. The fenced block language identifier must be `intent-json`, not `json` or anything else.\n2. `type` must be one of the exact strings listed below. Do not invent new types.\n3. place ALL intent blocks at the very end of your response, after all prose content.\n4. Output valid JSON only — no comments, no trailing commas, etc.\n\n---\n\n{{INTENT_DOCS}}\n";
3
+ //#endregion
4
+ export { intent_prompt_md_default as default };
@@ -0,0 +1,4 @@
1
+ //#region \0glob-assets_raw/view-prompt.md.e0dbcffe
2
+ var view_prompt_md_default = "## Renderable Views\n\nYou can render interactive visual views inside your response.\nWhen a view would make your answer clearer or more useful, output a `view-json` fenced code block.\n\n**Output format (the fence language must be `view-json`):**\n```view-json\n{\n \"tag\": \"view-tag-here\",\n \"properties\": {\n \"key\": \"value\"\n }\n}\n```\n\n**Rules — follow these strictly:**\n1. The fenced block language identifier must be `view-json`, not `json` or anything else.\n2. `tag` must be one of the exact strings listed below. Never invent a tag.\n3. Output valid JSON — no comments, no trailing commas.\n\n---\n\n{{VIEW_DOCS}}\n";
3
+ //#endregion
4
+ export { view_prompt_md_default as default };
@@ -1,7 +1,29 @@
1
- import { UCodeBlock } from './UCodeBlock.component.js';
1
+ import { UElement } from '@iyulab/components/dist/components/UElement.js';
2
+ /**
3
+ * 코드 블록을 렌더링하는 컴포넌트입니다.
4
+ * 언어와 코드를 받아 syntax highlighting을 적용합니다.
5
+ */
6
+ export declare class UCodeBlock extends UElement {
7
+ static styles: import('lit').CSSResultGroup[];
8
+ /** 코드 블록이 로딩 중인지 여부를 나타냅니다. */
9
+ loading: boolean;
10
+ /** 코드 블록의 헤더를 숨길지 여부를 지정합니다. */
11
+ headless: boolean;
12
+ /** 코드 언어를 지정합니다. */
13
+ lang: string;
14
+ /** 표시할 코드 내용입니다. */
15
+ value?: string;
16
+ /** 클립보드 복사 상태를 나타내는 플래그입니다. */
17
+ isCopied: boolean;
18
+ render(): import('lit-html').TemplateResult<1>;
19
+ /**
20
+ * slot에 할당된 코드를 value로 설정합니다.
21
+ * 이 기능을 통해 HTML 내에 직접 코드를 작성할 수 있습니다.
22
+ */
23
+ private handleSlotChange;
24
+ }
2
25
  declare global {
3
26
  interface HTMLElementTagNameMap {
4
27
  "u-code-block": UCodeBlock;
5
28
  }
6
29
  }
7
- export { UCodeBlock };
@@ -1,5 +1,68 @@
1
- import { UCodeBlock } from './UCodeBlock.component.js';
1
+ import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js";
2
+ import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js";
3
+ import "../buttons/UCopyButton.js";
4
+ import { styles } from "./UCodeBlock.styles.js";
5
+ import { html } from "lit";
6
+ import { customElement, property, state } from "lit/decorators.js";
7
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
8
+ import hljs from "highlight.js";
9
+ import "@iyulab/components/dist/components/icon/UIcon.js";
10
+ import "@iyulab/components/dist/components/spinner/USpinner.js";
11
+ import { UElement } from "@iyulab/components/dist/components/UElement.js";
12
+ //#region src/components/blocks/UCodeBlock.ts
13
+ var UCodeBlock = class UCodeBlock extends UElement {
14
+ constructor(..._args) {
15
+ super(..._args);
16
+ this.loading = false;
17
+ this.headless = false;
18
+ this.lang = "plaintext";
19
+ this.isCopied = false;
20
+ this.handleSlotChange = (e) => {
21
+ this.value = e.target.assignedNodes({ flatten: true }).map((node) => node.textContent).join("\n\n");
22
+ };
23
+ }
24
+ static {
25
+ this.styles = [super.styles, styles];
26
+ }
27
+ render() {
28
+ const lang = hljs.getLanguage(this.lang) ? this.lang : "plaintext";
29
+ const value = this.value || "";
30
+ return html`
31
+ <div class="header" ?hidden=${this.headless}>
32
+ <span class="status">
33
+ ${this.loading ? html`<u-spinner></u-spinner>` : html`<u-icon lib="bootstrap" name="code-slash"></u-icon>`}
34
+ </span>
35
+ <span class="lang">
36
+ ${lang}
37
+ </span>
38
+ <div style="flex: 1"></div>
39
+ <u-copy-button
40
+ .value=${value}
41
+ ></u-copy-button>
42
+ </div>
2
43
 
3
- UCodeBlock.define("u-code-block");
44
+ <pre class="hljs">${unsafeHTML(hljs.highlight(value, { language: lang }).value)}</pre>
4
45
 
46
+ <div hidden aria-hidden="true">
47
+ <slot @slotchange=${this.handleSlotChange}></slot>
48
+ </div>
49
+ `;
50
+ }
51
+ };
52
+ __decorate([property({
53
+ type: Boolean,
54
+ reflect: true
55
+ }), __decorateMetadata("design:type", Boolean)], UCodeBlock.prototype, "loading", void 0);
56
+ __decorate([property({
57
+ type: Boolean,
58
+ reflect: true
59
+ }), __decorateMetadata("design:type", Boolean)], UCodeBlock.prototype, "headless", void 0);
60
+ __decorate([property({
61
+ type: String,
62
+ reflect: true
63
+ }), __decorateMetadata("design:type", String)], UCodeBlock.prototype, "lang", void 0);
64
+ __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UCodeBlock.prototype, "value", void 0);
65
+ __decorate([state(), __decorateMetadata("design:type", Boolean)], UCodeBlock.prototype, "isCopied", void 0);
66
+ UCodeBlock = __decorate([customElement("u-code-block")], UCodeBlock);
67
+ //#endregion
5
68
  export { UCodeBlock };
@@ -1,6 +1,6 @@
1
- import { css } from 'lit';
2
-
3
- const styles = css`
1
+ import { css } from "lit";
2
+ //#region src/components/blocks/UCodeBlock.styles.ts
3
+ var styles = css`
4
4
  :host {
5
5
  --hljs-text-color: #24292e;
6
6
  --hljs-background-color: #ffffff;
@@ -178,5 +178,5 @@ const styles = css`
178
178
  color: currentColor;
179
179
  }
180
180
  `;
181
-
181
+ //#endregion
182
182
  export { styles };
@@ -0,0 +1,33 @@
1
+ import { UElement } from '@iyulab/components/dist/components/UElement.js';
2
+ /**
3
+ * 단일 파일을 표시하는 블록 컴포넌트입니다.
4
+ */
5
+ export declare class UFileBlock extends UElement {
6
+ static styles: import('lit').CSSResultGroup[];
7
+ /** 삭제 버튼 표시 */
8
+ removable: boolean;
9
+ /** 파일 상태 */
10
+ status?: 'idle' | 'uploading' | 'error';
11
+ /** 파일 이름 */
12
+ name?: string;
13
+ /** MIME 타입 */
14
+ type?: string;
15
+ /** 파일 크기 (bytes) */
16
+ size?: number;
17
+ /** 다운로드 URL */
18
+ url?: string;
19
+ render(): import('lit-html').TemplateResult<1>;
20
+ private handleDownloadClick;
21
+ private handleRemoveClick;
22
+ /** MIME 타입 → Bootstrap Icon 이름 */
23
+ private resolveIcon;
24
+ /** 파일명 또는 MIME 타입에서 확장자를 추출합니다. */
25
+ private resolveExt;
26
+ /** bytes → 읽기 좋은 크기 문자열 */
27
+ private formatSize;
28
+ }
29
+ declare global {
30
+ interface HTMLElementTagNameMap {
31
+ "u-file-block": UFileBlock;
32
+ }
33
+ }