@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
@@ -0,0 +1,209 @@
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
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iyulab/chat-components",
3
3
  "description": "llm chat components for building chat interfaces",
4
- "version": "0.4.0",
4
+ "version": "0.5.0",
5
5
  "author": "iyulab",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -31,34 +31,50 @@
31
31
  "types": "./dist/index.d.ts",
32
32
  "import": "./dist/index.js"
33
33
  },
34
- "./dist/*": {
35
- "types": "./dist/*.d.ts",
36
- "import": "./dist/*"
37
- }
34
+ "./dist/*": "./dist/*",
35
+ "./react": "./dist/react/index.js",
36
+ "./react/*": "./dist/react/*"
38
37
  },
39
38
  "scripts": {
40
39
  "test": "vite",
41
40
  "build": "eslint && vite build"
42
41
  },
43
42
  "dependencies": {
44
- "@iyulab/components": "^0.4.0",
45
- "chart.js": "^4.5.1",
43
+ "@iyulab/components": "^1.0.1",
46
44
  "highlight.js": "^11.11.1",
45
+ "html2canvas": "^1.4.1",
47
46
  "lit": "^3.3.2",
48
- "marked": "^17.0.3",
47
+ "marked": "^17.0.5",
49
48
  "marked-katex-extension": "^5.1.7"
50
49
  },
50
+ "peerDependencies": {
51
+ "@lit/react": ">=1.0.8",
52
+ "chart.js": ">=4.5.1",
53
+ "react": ">=18.0.0"
54
+ },
55
+ "peerDependenciesMeta": {
56
+ "@lit/react": {
57
+ "optional": true
58
+ },
59
+ "chart.js": {
60
+ "optional": true
61
+ },
62
+ "react": {
63
+ "optional": true
64
+ }
65
+ },
51
66
  "devDependencies": {
52
- "@eslint/js": "^9.39.3",
53
- "@lit/react": "^1.0.8",
54
- "@types/node": "^25.3.2",
55
- "eslint": "^9.39.3",
67
+ "@eslint/js": "^9.39.4",
68
+ "@types/node": "^25.5.0",
69
+ "chart.js": "^4.5.1",
70
+ "eslint": "^9.39.4",
56
71
  "eslint-plugin-lit": "^2.2.1",
57
- "globals": "^17.3.0",
58
- "openai": "^6.25.0",
72
+ "glob": "^13.0.6",
73
+ "globals": "^17.4.0",
74
+ "openai": "^6.33.0",
59
75
  "typescript": "^5.9.3",
60
- "typescript-eslint": "^8.56.1",
61
- "vite": "^7.3.1",
76
+ "typescript-eslint": "^8.57.2",
77
+ "vite": "^8.0.3",
62
78
  "vite-plugin-dts": "^4.5.4"
63
79
  }
64
80
  }
@@ -1,3 +0,0 @@
1
- const template = "## Interactive Actions\n\nYou can guide the user with interactive actions by appending `action-json` fenced code blocks at the end of your response.\nThe user will see these as interactive UI elements and can click them to continue the conversation.\n\n**Output format (the fence language must be `action-json`):**\n```action-json\n{\n \"type\": \"action-type-here\",\n \"properties\" : {\n \"key\": \"value\"\n }\n}\n```\n\n**Rules — follow these STRICTLY. Violation means the feature will not work:**\n1. ALWAYS wrap the block in triple backticks with the language identifier `action-json` exactly — never use `json`, plain text, or any other identifier.\n2. `type` must be one of the exact strings listed below. Do not invent new types.\n3. Place ALL action blocks at the very end of your response, after all prose content.\n4. Output valid JSON only — no comments, no trailing commas, no markdown inside the block.\n5. Only include actions when they genuinely help the user continue the conversation.\n6. Do NOT describe or explain the action block in surrounding text (e.g. do not write \"Here are some suggested questions:\"). Just output the block.\n\n**Available actions:**\n{{ACTION_LIST}}\n\n---\n\n{{ACTION_DOCS}}\n";
2
-
3
- export { template as default };
@@ -1,3 +0,0 @@
1
- const template = "## Renderable Widgets\n\nYou can render interactive visual widgets inside your response.\nWhen a widget would make your answer clearer or more useful, output a `widget-json` fenced code block.\n\n**Output format (the fence language must be `widget-json`):**\n```widget-json\n{\n \"tag\": \"exact-widget-tag-here\",\n \"properties\": {\n \"key\": \"value\"\n }\n}\n```\n\n**Rules — follow these strictly:**\n1. The fenced block language identifier must be `widget-json`, not `json` or anything else.\n2. `tag` must be one of the exact strings listed below. Never invent a tag.\n3. Include every property listed under `required`. Omit optional properties only if not needed.\n4. For schema-less `object` fields (e.g., Chart.js `data` / `options`), output a complete, realistic configuration using your knowledge.\n5. Output valid JSON — no comments, no trailing commas.\n\n**Available widgets:**\n{{WIDGET_LIST}}\n\n---\n\n{{WIDGET_DOCS}}\n";
2
-
3
- export { template as default };
@@ -1,58 +0,0 @@
1
- import { nothing, html } from 'lit';
2
- import { property } from 'lit/decorators.js';
3
- import { repeat } from 'lit/directives/repeat.js';
4
- import { UElement } from '@iyulab/components/dist/components/UElement.js';
5
- import { UButton } from '@iyulab/components/dist/components/button/UButton.component.js';
6
- import { styles } from './UQuestionAction.styles.js';
7
-
8
- var __defProp = Object.defineProperty;
9
- var __decorateClass = (decorators, target, key, kind) => {
10
- var result = void 0 ;
11
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
12
- if (decorator = decorators[i])
13
- result = (decorator(target, key, result) ) || result;
14
- if (result) __defProp(target, key, result);
15
- return result;
16
- };
17
- class UQuestionAction extends UElement {
18
- constructor() {
19
- super(...arguments);
20
- this.choices = [];
21
- }
22
- static {
23
- this.styles = [super.styles, styles];
24
- }
25
- static {
26
- this.dependencies = {
27
- "u-button": UButton
28
- };
29
- }
30
- render() {
31
- if (!this.choices || this.choices.length === 0) {
32
- return nothing;
33
- }
34
- return html`
35
- <p class="question" ?hidden=${!this.question}>${this.question}</p>
36
- <div class="choices">
37
- ${repeat(this.choices, (value, index) => html`
38
- <u-button @click=${() => this.handleChoiceClick(index)}>
39
- ${value}
40
- </u-button>
41
- `)}
42
- </div>
43
- `;
44
- }
45
- handleChoiceClick(index) {
46
- const value = this.choices[index];
47
- if (!value) return;
48
- this.emit("u-submit", { value });
49
- }
50
- }
51
- __decorateClass([
52
- property({ type: String })
53
- ], UQuestionAction.prototype, "question");
54
- __decorateClass([
55
- property({ type: Array })
56
- ], UQuestionAction.prototype, "choices");
57
-
58
- export { UQuestionAction };
@@ -1,7 +0,0 @@
1
- import { UQuestionAction } from './UQuestionAction.component.js';
2
- declare global {
3
- interface HTMLElementTagNameMap {
4
- "u-question-action": UQuestionAction;
5
- }
6
- }
7
- export { UQuestionAction };
@@ -1,5 +0,0 @@
1
- import { UQuestionAction } from './UQuestionAction.component.js';
2
-
3
- UQuestionAction.define("u-question-action");
4
-
5
- export { UQuestionAction };
@@ -1,25 +0,0 @@
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
- static dependencies: Record<string, typeof UElement>;
9
- /** 클립보드 복사 상태를 나타내는 플래그입니다. */
10
- isCopied: boolean;
11
- /** 코드 블록이 로딩 중인지 여부를 나타냅니다. */
12
- loading: boolean;
13
- /** 코드 블록의 헤더를 숨길지 여부를 지정합니다. */
14
- headless: boolean;
15
- /** 코드 언어를 지정합니다. */
16
- lang: string;
17
- /** 표시할 코드 내용입니다. */
18
- value?: string;
19
- render(): import('lit-html').TemplateResult<1>;
20
- /**
21
- * slot에 할당된 코드를 value로 설정합니다.
22
- * 이 기능을 통해 HTML 내에 직접 코드를 작성할 수 있습니다.
23
- */
24
- private handleSlotChange;
25
- }
@@ -1,88 +0,0 @@
1
- import { html } from 'lit';
2
- import { state, property } from 'lit/decorators.js';
3
- import { unsafeHTML } from 'lit/directives/unsafe-html.js';
4
- import hljs from 'highlight.js';
5
- import { UElement } from '@iyulab/components/dist/components/UElement.js';
6
- import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
7
- import { USpinner } from '@iyulab/components/dist/components/spinner/USpinner.component.js';
8
- import { UCopyButton } from '../buttons/UCopyButton.component.js';
9
- import { styles } from './UCodeBlock.styles.js';
10
-
11
- var __defProp = Object.defineProperty;
12
- var __decorateClass = (decorators, target, key, kind) => {
13
- var result = void 0 ;
14
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
15
- if (decorator = decorators[i])
16
- result = (decorator(target, key, result) ) || result;
17
- if (result) __defProp(target, key, result);
18
- return result;
19
- };
20
- class UCodeBlock extends UElement {
21
- constructor() {
22
- super(...arguments);
23
- this.isCopied = false;
24
- this.loading = false;
25
- this.headless = false;
26
- this.lang = "plaintext";
27
- /**
28
- * slot에 할당된 코드를 value로 설정합니다.
29
- * 이 기능을 통해 HTML 내에 직접 코드를 작성할 수 있습니다.
30
- */
31
- this.handleSlotChange = (e) => {
32
- const slot = e.target;
33
- const nodes = slot.assignedNodes({ flatten: true });
34
- this.value = nodes.map((node) => node.textContent).join("\n\n");
35
- };
36
- }
37
- static {
38
- this.styles = [super.styles, styles];
39
- }
40
- static {
41
- this.dependencies = {
42
- "u-icon": UIcon,
43
- "u-spinner": USpinner,
44
- "u-copy-button": UCopyButton
45
- };
46
- }
47
- render() {
48
- const lang = hljs.getLanguage(this.lang) ? this.lang : "plaintext";
49
- const value = this.value || "";
50
- return html`
51
- <div class="header" ?hidden=${this.headless}>
52
- <span class="status">
53
- ${this.loading ? html`<u-spinner></u-spinner>` : html`<u-icon lib="internal" name="code-slash"></u-icon>`}
54
- </span>
55
- <span class="lang">
56
- ${lang}
57
- </span>
58
- <div style="flex: 1"></div>
59
- <u-copy-button
60
- .value=${value}
61
- ></u-copy-button>
62
- </div>
63
-
64
- <pre class="hljs">${unsafeHTML(hljs.highlight(value, {
65
- language: lang
66
- }).value)}</pre>
67
-
68
- <slot hidden @slotchange=${this.handleSlotChange}></slot>
69
- `;
70
- }
71
- }
72
- __decorateClass([
73
- state()
74
- ], UCodeBlock.prototype, "isCopied");
75
- __decorateClass([
76
- property({ type: Boolean, reflect: true })
77
- ], UCodeBlock.prototype, "loading");
78
- __decorateClass([
79
- property({ type: Boolean, reflect: true })
80
- ], UCodeBlock.prototype, "headless");
81
- __decorateClass([
82
- property({ type: String, reflect: true })
83
- ], UCodeBlock.prototype, "lang");
84
- __decorateClass([
85
- property({ type: String })
86
- ], UCodeBlock.prototype, "value");
87
-
88
- export { UCodeBlock };
@@ -1,22 +0,0 @@
1
- import { UElement } from '@iyulab/components/dist/components/UElement.js';
2
- import { FileItem } from '../../types/BlockItem.js';
3
- /**
4
- * 여러 파일을 그리드 형태로 표시하는 블록 컴포넌트입니다.
5
- */
6
- export declare class UFilesBlock extends UElement {
7
- static styles: import('lit').CSSResultGroup[];
8
- static dependencies: Record<string, typeof UElement>;
9
- /** 파일 목록 */
10
- files: FileItem[];
11
- /** 삭제 버튼 표시 여부 */
12
- removable: boolean;
13
- render(): unknown;
14
- private handleDownloadClick;
15
- private handleRemoveClick;
16
- /** MIME 타입 → Bootstrap Icon 이름 */
17
- private resolveIcon;
18
- /** 파일명 또는 MIME 타입에서 확장자를 추출합니다. */
19
- private resolveExt;
20
- /** bytes → 읽기 좋은 크기 문자열 */
21
- private formatSize;
22
- }