@crafter/rn-ai-elements 0.0.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 (344) hide show
  1. package/lib/commonjs/chatbot/AIImage.js +126 -0
  2. package/lib/commonjs/chatbot/AIImage.js.map +1 -0
  3. package/lib/commonjs/chatbot/Attachments.js +317 -0
  4. package/lib/commonjs/chatbot/Attachments.js.map +1 -0
  5. package/lib/commonjs/chatbot/ChatErrorBoundary.js +201 -0
  6. package/lib/commonjs/chatbot/ChatErrorBoundary.js.map +1 -0
  7. package/lib/commonjs/chatbot/ChatMessageItem.js +169 -0
  8. package/lib/commonjs/chatbot/ChatMessageItem.js.map +1 -0
  9. package/lib/commonjs/chatbot/Conversation.js +415 -0
  10. package/lib/commonjs/chatbot/Conversation.js.map +1 -0
  11. package/lib/commonjs/chatbot/ConversationScrollButton.js +131 -0
  12. package/lib/commonjs/chatbot/ConversationScrollButton.js.map +1 -0
  13. package/lib/commonjs/chatbot/Message.js +203 -0
  14. package/lib/commonjs/chatbot/Message.js.map +1 -0
  15. package/lib/commonjs/chatbot/PromptInput.js +352 -0
  16. package/lib/commonjs/chatbot/PromptInput.js.map +1 -0
  17. package/lib/commonjs/chatbot/Reasoning.js +184 -0
  18. package/lib/commonjs/chatbot/Reasoning.js.map +1 -0
  19. package/lib/commonjs/chatbot/Shimmer.js +116 -0
  20. package/lib/commonjs/chatbot/Shimmer.js.map +1 -0
  21. package/lib/commonjs/chatbot/Sources.js +212 -0
  22. package/lib/commonjs/chatbot/Sources.js.map +1 -0
  23. package/lib/commonjs/chatbot/Suggestion.js +99 -0
  24. package/lib/commonjs/chatbot/Suggestion.js.map +1 -0
  25. package/lib/commonjs/chatbot/Tool.js +307 -0
  26. package/lib/commonjs/chatbot/Tool.js.map +1 -0
  27. package/lib/commonjs/chatbot/adapters/uiMessageAdapter.js +141 -0
  28. package/lib/commonjs/chatbot/adapters/uiMessageAdapter.js.map +1 -0
  29. package/lib/commonjs/chatbot/index.js +140 -0
  30. package/lib/commonjs/chatbot/index.js.map +1 -0
  31. package/lib/commonjs/chatbot/types.js +6 -0
  32. package/lib/commonjs/chatbot/types.js.map +1 -0
  33. package/lib/commonjs/hooks/index.js +34 -0
  34. package/lib/commonjs/hooks/index.js.map +1 -0
  35. package/lib/commonjs/hooks/useAutoScroll.js +39 -0
  36. package/lib/commonjs/hooks/useAutoScroll.js.map +1 -0
  37. package/lib/commonjs/hooks/useClipboard.js +44 -0
  38. package/lib/commonjs/hooks/useClipboard.js.map +1 -0
  39. package/lib/commonjs/hooks/useCollapsible.js +35 -0
  40. package/lib/commonjs/hooks/useCollapsible.js.map +1 -0
  41. package/lib/commonjs/hooks/useStickToBottom.js +68 -0
  42. package/lib/commonjs/hooks/useStickToBottom.js.map +1 -0
  43. package/lib/commonjs/index.js +257 -0
  44. package/lib/commonjs/index.js.map +1 -0
  45. package/lib/commonjs/package.json +1 -0
  46. package/lib/commonjs/primitives/Badge.js +119 -0
  47. package/lib/commonjs/primitives/Badge.js.map +1 -0
  48. package/lib/commonjs/primitives/Button.js +185 -0
  49. package/lib/commonjs/primitives/Button.js.map +1 -0
  50. package/lib/commonjs/primitives/Card.js +166 -0
  51. package/lib/commonjs/primitives/Card.js.map +1 -0
  52. package/lib/commonjs/primitives/Collapsible.js +137 -0
  53. package/lib/commonjs/primitives/Collapsible.js.map +1 -0
  54. package/lib/commonjs/primitives/ScrollArea.js +40 -0
  55. package/lib/commonjs/primitives/ScrollArea.js.map +1 -0
  56. package/lib/commonjs/primitives/index.js +83 -0
  57. package/lib/commonjs/primitives/index.js.map +1 -0
  58. package/lib/commonjs/streaming/StreamingMarkdown.js +252 -0
  59. package/lib/commonjs/streaming/StreamingMarkdown.js.map +1 -0
  60. package/lib/commonjs/streaming/index.js +13 -0
  61. package/lib/commonjs/streaming/index.js.map +1 -0
  62. package/lib/commonjs/streaming/parser.js +482 -0
  63. package/lib/commonjs/streaming/parser.js.map +1 -0
  64. package/lib/commonjs/streaming/renderers/BlockquoteRenderer.js +35 -0
  65. package/lib/commonjs/streaming/renderers/BlockquoteRenderer.js.map +1 -0
  66. package/lib/commonjs/streaming/renderers/CodeRenderer.js +128 -0
  67. package/lib/commonjs/streaming/renderers/CodeRenderer.js.map +1 -0
  68. package/lib/commonjs/streaming/renderers/HeadingRenderer.js +61 -0
  69. package/lib/commonjs/streaming/renderers/HeadingRenderer.js.map +1 -0
  70. package/lib/commonjs/streaming/renderers/ImageRenderer.js +53 -0
  71. package/lib/commonjs/streaming/renderers/ImageRenderer.js.map +1 -0
  72. package/lib/commonjs/streaming/renderers/LinkRenderer.js +49 -0
  73. package/lib/commonjs/streaming/renderers/LinkRenderer.js.map +1 -0
  74. package/lib/commonjs/streaming/renderers/ListRenderer.js +63 -0
  75. package/lib/commonjs/streaming/renderers/ListRenderer.js.map +1 -0
  76. package/lib/commonjs/streaming/renderers/TableRenderer.js +77 -0
  77. package/lib/commonjs/streaming/renderers/TableRenderer.js.map +1 -0
  78. package/lib/commonjs/streaming/renderers/TextRenderer.js +41 -0
  79. package/lib/commonjs/streaming/renderers/TextRenderer.js.map +1 -0
  80. package/lib/commonjs/streaming/renderers/index.js +76 -0
  81. package/lib/commonjs/streaming/renderers/index.js.map +1 -0
  82. package/lib/commonjs/streaming/renderers/renderInlineChildren.js +112 -0
  83. package/lib/commonjs/streaming/renderers/renderInlineChildren.js.map +1 -0
  84. package/lib/commonjs/streaming/renderers/renderNode.js +81 -0
  85. package/lib/commonjs/streaming/renderers/renderNode.js.map +1 -0
  86. package/lib/commonjs/theme/ThemeProvider.js +68 -0
  87. package/lib/commonjs/theme/ThemeProvider.js.map +1 -0
  88. package/lib/commonjs/theme/defaultTheme.js +96 -0
  89. package/lib/commonjs/theme/defaultTheme.js.map +1 -0
  90. package/lib/commonjs/theme/index.js +32 -0
  91. package/lib/commonjs/theme/index.js.map +1 -0
  92. package/lib/commonjs/theme/tokens.js +2 -0
  93. package/lib/commonjs/theme/tokens.js.map +1 -0
  94. package/lib/commonjs/types.d.js +2 -0
  95. package/lib/commonjs/types.d.js.map +1 -0
  96. package/lib/commonjs/voice/index.js +13 -0
  97. package/lib/commonjs/voice/index.js.map +1 -0
  98. package/lib/commonjs/voice/useSpeechRecognition.js +172 -0
  99. package/lib/commonjs/voice/useSpeechRecognition.js.map +1 -0
  100. package/lib/module/chatbot/AIImage.js +121 -0
  101. package/lib/module/chatbot/AIImage.js.map +1 -0
  102. package/lib/module/chatbot/Attachments.js +312 -0
  103. package/lib/module/chatbot/Attachments.js.map +1 -0
  104. package/lib/module/chatbot/ChatErrorBoundary.js +196 -0
  105. package/lib/module/chatbot/ChatErrorBoundary.js.map +1 -0
  106. package/lib/module/chatbot/ChatMessageItem.js +164 -0
  107. package/lib/module/chatbot/ChatMessageItem.js.map +1 -0
  108. package/lib/module/chatbot/Conversation.js +412 -0
  109. package/lib/module/chatbot/Conversation.js.map +1 -0
  110. package/lib/module/chatbot/ConversationScrollButton.js +126 -0
  111. package/lib/module/chatbot/ConversationScrollButton.js.map +1 -0
  112. package/lib/module/chatbot/Message.js +198 -0
  113. package/lib/module/chatbot/Message.js.map +1 -0
  114. package/lib/module/chatbot/PromptInput.js +347 -0
  115. package/lib/module/chatbot/PromptInput.js.map +1 -0
  116. package/lib/module/chatbot/Reasoning.js +179 -0
  117. package/lib/module/chatbot/Reasoning.js.map +1 -0
  118. package/lib/module/chatbot/Shimmer.js +111 -0
  119. package/lib/module/chatbot/Shimmer.js.map +1 -0
  120. package/lib/module/chatbot/Sources.js +207 -0
  121. package/lib/module/chatbot/Sources.js.map +1 -0
  122. package/lib/module/chatbot/Suggestion.js +94 -0
  123. package/lib/module/chatbot/Suggestion.js.map +1 -0
  124. package/lib/module/chatbot/Tool.js +303 -0
  125. package/lib/module/chatbot/Tool.js.map +1 -0
  126. package/lib/module/chatbot/adapters/uiMessageAdapter.js +137 -0
  127. package/lib/module/chatbot/adapters/uiMessageAdapter.js.map +1 -0
  128. package/lib/module/chatbot/index.js +39 -0
  129. package/lib/module/chatbot/index.js.map +1 -0
  130. package/lib/module/chatbot/types.js +4 -0
  131. package/lib/module/chatbot/types.js.map +1 -0
  132. package/lib/module/hooks/index.js +7 -0
  133. package/lib/module/hooks/index.js.map +1 -0
  134. package/lib/module/hooks/useAutoScroll.js +35 -0
  135. package/lib/module/hooks/useAutoScroll.js.map +1 -0
  136. package/lib/module/hooks/useClipboard.js +40 -0
  137. package/lib/module/hooks/useClipboard.js.map +1 -0
  138. package/lib/module/hooks/useCollapsible.js +31 -0
  139. package/lib/module/hooks/useCollapsible.js.map +1 -0
  140. package/lib/module/hooks/useStickToBottom.js +64 -0
  141. package/lib/module/hooks/useStickToBottom.js.map +1 -0
  142. package/lib/module/index.js +19 -0
  143. package/lib/module/index.js.map +1 -0
  144. package/lib/module/package.json +1 -0
  145. package/lib/module/primitives/Badge.js +114 -0
  146. package/lib/module/primitives/Badge.js.map +1 -0
  147. package/lib/module/primitives/Button.js +180 -0
  148. package/lib/module/primitives/Button.js.map +1 -0
  149. package/lib/module/primitives/Card.js +156 -0
  150. package/lib/module/primitives/Card.js.map +1 -0
  151. package/lib/module/primitives/Collapsible.js +130 -0
  152. package/lib/module/primitives/Collapsible.js.map +1 -0
  153. package/lib/module/primitives/ScrollArea.js +35 -0
  154. package/lib/module/primitives/ScrollArea.js.map +1 -0
  155. package/lib/module/primitives/index.js +8 -0
  156. package/lib/module/primitives/index.js.map +1 -0
  157. package/lib/module/streaming/StreamingMarkdown.js +246 -0
  158. package/lib/module/streaming/StreamingMarkdown.js.map +1 -0
  159. package/lib/module/streaming/index.js +4 -0
  160. package/lib/module/streaming/index.js.map +1 -0
  161. package/lib/module/streaming/parser.js +477 -0
  162. package/lib/module/streaming/parser.js.map +1 -0
  163. package/lib/module/streaming/renderers/BlockquoteRenderer.js +30 -0
  164. package/lib/module/streaming/renderers/BlockquoteRenderer.js.map +1 -0
  165. package/lib/module/streaming/renderers/CodeRenderer.js +123 -0
  166. package/lib/module/streaming/renderers/CodeRenderer.js.map +1 -0
  167. package/lib/module/streaming/renderers/HeadingRenderer.js +56 -0
  168. package/lib/module/streaming/renderers/HeadingRenderer.js.map +1 -0
  169. package/lib/module/streaming/renderers/ImageRenderer.js +48 -0
  170. package/lib/module/streaming/renderers/ImageRenderer.js.map +1 -0
  171. package/lib/module/streaming/renderers/LinkRenderer.js +44 -0
  172. package/lib/module/streaming/renderers/LinkRenderer.js.map +1 -0
  173. package/lib/module/streaming/renderers/ListRenderer.js +58 -0
  174. package/lib/module/streaming/renderers/ListRenderer.js.map +1 -0
  175. package/lib/module/streaming/renderers/TableRenderer.js +72 -0
  176. package/lib/module/streaming/renderers/TableRenderer.js.map +1 -0
  177. package/lib/module/streaming/renderers/TextRenderer.js +36 -0
  178. package/lib/module/streaming/renderers/TextRenderer.js.map +1 -0
  179. package/lib/module/streaming/renderers/index.js +13 -0
  180. package/lib/module/streaming/renderers/index.js.map +1 -0
  181. package/lib/module/streaming/renderers/renderInlineChildren.js +107 -0
  182. package/lib/module/streaming/renderers/renderInlineChildren.js.map +1 -0
  183. package/lib/module/streaming/renderers/renderNode.js +78 -0
  184. package/lib/module/streaming/renderers/renderNode.js.map +1 -0
  185. package/lib/module/theme/ThemeProvider.js +62 -0
  186. package/lib/module/theme/ThemeProvider.js.map +1 -0
  187. package/lib/module/theme/defaultTheme.js +92 -0
  188. package/lib/module/theme/defaultTheme.js.map +1 -0
  189. package/lib/module/theme/index.js +5 -0
  190. package/lib/module/theme/index.js.map +1 -0
  191. package/lib/module/theme/tokens.js +2 -0
  192. package/lib/module/theme/tokens.js.map +1 -0
  193. package/lib/module/types.d.js +2 -0
  194. package/lib/module/types.d.js.map +1 -0
  195. package/lib/module/voice/index.js +14 -0
  196. package/lib/module/voice/index.js.map +1 -0
  197. package/lib/module/voice/useSpeechRecognition.js +169 -0
  198. package/lib/module/voice/useSpeechRecognition.js.map +1 -0
  199. package/lib/typescript/src/chatbot/AIImage.d.ts +24 -0
  200. package/lib/typescript/src/chatbot/AIImage.d.ts.map +1 -0
  201. package/lib/typescript/src/chatbot/Attachments.d.ts +20 -0
  202. package/lib/typescript/src/chatbot/Attachments.d.ts.map +1 -0
  203. package/lib/typescript/src/chatbot/ChatErrorBoundary.d.ts +57 -0
  204. package/lib/typescript/src/chatbot/ChatErrorBoundary.d.ts.map +1 -0
  205. package/lib/typescript/src/chatbot/ChatMessageItem.d.ts +45 -0
  206. package/lib/typescript/src/chatbot/ChatMessageItem.d.ts.map +1 -0
  207. package/lib/typescript/src/chatbot/Conversation.d.ts +94 -0
  208. package/lib/typescript/src/chatbot/Conversation.d.ts.map +1 -0
  209. package/lib/typescript/src/chatbot/ConversationScrollButton.d.ts +62 -0
  210. package/lib/typescript/src/chatbot/ConversationScrollButton.d.ts.map +1 -0
  211. package/lib/typescript/src/chatbot/Message.d.ts +39 -0
  212. package/lib/typescript/src/chatbot/Message.d.ts.map +1 -0
  213. package/lib/typescript/src/chatbot/PromptInput.d.ts +93 -0
  214. package/lib/typescript/src/chatbot/PromptInput.d.ts.map +1 -0
  215. package/lib/typescript/src/chatbot/Reasoning.d.ts +14 -0
  216. package/lib/typescript/src/chatbot/Reasoning.d.ts.map +1 -0
  217. package/lib/typescript/src/chatbot/Shimmer.d.ts +13 -0
  218. package/lib/typescript/src/chatbot/Shimmer.d.ts.map +1 -0
  219. package/lib/typescript/src/chatbot/Sources.d.ts +17 -0
  220. package/lib/typescript/src/chatbot/Sources.d.ts.map +1 -0
  221. package/lib/typescript/src/chatbot/Suggestion.d.ts +15 -0
  222. package/lib/typescript/src/chatbot/Suggestion.d.ts.map +1 -0
  223. package/lib/typescript/src/chatbot/Tool.d.ts +30 -0
  224. package/lib/typescript/src/chatbot/Tool.d.ts.map +1 -0
  225. package/lib/typescript/src/chatbot/adapters/uiMessageAdapter.d.ts +24 -0
  226. package/lib/typescript/src/chatbot/adapters/uiMessageAdapter.d.ts.map +1 -0
  227. package/lib/typescript/src/chatbot/index.d.ts +29 -0
  228. package/lib/typescript/src/chatbot/index.d.ts.map +1 -0
  229. package/lib/typescript/src/chatbot/types.d.ts +49 -0
  230. package/lib/typescript/src/chatbot/types.d.ts.map +1 -0
  231. package/lib/typescript/src/hooks/index.d.ts +9 -0
  232. package/lib/typescript/src/hooks/index.d.ts.map +1 -0
  233. package/lib/typescript/src/hooks/useAutoScroll.d.ts +23 -0
  234. package/lib/typescript/src/hooks/useAutoScroll.d.ts.map +1 -0
  235. package/lib/typescript/src/hooks/useClipboard.d.ts +22 -0
  236. package/lib/typescript/src/hooks/useClipboard.d.ts.map +1 -0
  237. package/lib/typescript/src/hooks/useCollapsible.d.ts +28 -0
  238. package/lib/typescript/src/hooks/useCollapsible.d.ts.map +1 -0
  239. package/lib/typescript/src/hooks/useStickToBottom.d.ts +39 -0
  240. package/lib/typescript/src/hooks/useStickToBottom.d.ts.map +1 -0
  241. package/lib/typescript/src/index.d.ts +11 -0
  242. package/lib/typescript/src/index.d.ts.map +1 -0
  243. package/lib/typescript/src/primitives/Badge.d.ts +10 -0
  244. package/lib/typescript/src/primitives/Badge.d.ts.map +1 -0
  245. package/lib/typescript/src/primitives/Button.d.ts +16 -0
  246. package/lib/typescript/src/primitives/Button.d.ts.map +1 -0
  247. package/lib/typescript/src/primitives/Card.d.ts +33 -0
  248. package/lib/typescript/src/primitives/Card.d.ts.map +1 -0
  249. package/lib/typescript/src/primitives/Collapsible.d.ts +20 -0
  250. package/lib/typescript/src/primitives/Collapsible.d.ts.map +1 -0
  251. package/lib/typescript/src/primitives/ScrollArea.d.ts +10 -0
  252. package/lib/typescript/src/primitives/ScrollArea.d.ts.map +1 -0
  253. package/lib/typescript/src/primitives/index.d.ts +11 -0
  254. package/lib/typescript/src/primitives/index.d.ts.map +1 -0
  255. package/lib/typescript/src/streaming/StreamingMarkdown.d.ts +47 -0
  256. package/lib/typescript/src/streaming/StreamingMarkdown.d.ts.map +1 -0
  257. package/lib/typescript/src/streaming/index.d.ts +3 -0
  258. package/lib/typescript/src/streaming/index.d.ts.map +1 -0
  259. package/lib/typescript/src/streaming/parser.d.ts +41 -0
  260. package/lib/typescript/src/streaming/parser.d.ts.map +1 -0
  261. package/lib/typescript/src/streaming/renderers/BlockquoteRenderer.d.ts +7 -0
  262. package/lib/typescript/src/streaming/renderers/BlockquoteRenderer.d.ts.map +1 -0
  263. package/lib/typescript/src/streaming/renderers/CodeRenderer.d.ts +7 -0
  264. package/lib/typescript/src/streaming/renderers/CodeRenderer.d.ts.map +1 -0
  265. package/lib/typescript/src/streaming/renderers/HeadingRenderer.d.ts +7 -0
  266. package/lib/typescript/src/streaming/renderers/HeadingRenderer.d.ts.map +1 -0
  267. package/lib/typescript/src/streaming/renderers/ImageRenderer.d.ts +7 -0
  268. package/lib/typescript/src/streaming/renderers/ImageRenderer.d.ts.map +1 -0
  269. package/lib/typescript/src/streaming/renderers/LinkRenderer.d.ts +7 -0
  270. package/lib/typescript/src/streaming/renderers/LinkRenderer.d.ts.map +1 -0
  271. package/lib/typescript/src/streaming/renderers/ListRenderer.d.ts +7 -0
  272. package/lib/typescript/src/streaming/renderers/ListRenderer.d.ts.map +1 -0
  273. package/lib/typescript/src/streaming/renderers/TableRenderer.d.ts +7 -0
  274. package/lib/typescript/src/streaming/renderers/TableRenderer.d.ts.map +1 -0
  275. package/lib/typescript/src/streaming/renderers/TextRenderer.d.ts +7 -0
  276. package/lib/typescript/src/streaming/renderers/TextRenderer.d.ts.map +1 -0
  277. package/lib/typescript/src/streaming/renderers/index.d.ts +19 -0
  278. package/lib/typescript/src/streaming/renderers/index.d.ts.map +1 -0
  279. package/lib/typescript/src/streaming/renderers/renderInlineChildren.d.ts +12 -0
  280. package/lib/typescript/src/streaming/renderers/renderInlineChildren.d.ts.map +1 -0
  281. package/lib/typescript/src/streaming/renderers/renderNode.d.ts +8 -0
  282. package/lib/typescript/src/streaming/renderers/renderNode.d.ts.map +1 -0
  283. package/lib/typescript/src/theme/ThemeProvider.d.ts +14 -0
  284. package/lib/typescript/src/theme/ThemeProvider.d.ts.map +1 -0
  285. package/lib/typescript/src/theme/defaultTheme.d.ts +4 -0
  286. package/lib/typescript/src/theme/defaultTheme.d.ts.map +1 -0
  287. package/lib/typescript/src/theme/index.d.ts +5 -0
  288. package/lib/typescript/src/theme/index.d.ts.map +1 -0
  289. package/lib/typescript/src/theme/tokens.d.ts +66 -0
  290. package/lib/typescript/src/theme/tokens.d.ts.map +1 -0
  291. package/lib/typescript/src/voice/index.d.ts +3 -0
  292. package/lib/typescript/src/voice/index.d.ts.map +1 -0
  293. package/lib/typescript/src/voice/useSpeechRecognition.d.ts +77 -0
  294. package/lib/typescript/src/voice/useSpeechRecognition.d.ts.map +1 -0
  295. package/package.json +132 -0
  296. package/src/chatbot/AIImage.tsx +166 -0
  297. package/src/chatbot/Attachments.tsx +382 -0
  298. package/src/chatbot/ChatErrorBoundary.tsx +230 -0
  299. package/src/chatbot/ChatMessageItem.tsx +195 -0
  300. package/src/chatbot/Conversation.tsx +537 -0
  301. package/src/chatbot/ConversationScrollButton.tsx +149 -0
  302. package/src/chatbot/Message.tsx +266 -0
  303. package/src/chatbot/PromptInput.tsx +532 -0
  304. package/src/chatbot/Reasoning.tsx +198 -0
  305. package/src/chatbot/Shimmer.tsx +146 -0
  306. package/src/chatbot/Sources.tsx +263 -0
  307. package/src/chatbot/Suggestion.tsx +123 -0
  308. package/src/chatbot/Tool.tsx +340 -0
  309. package/src/chatbot/adapters/uiMessageAdapter.ts +177 -0
  310. package/src/chatbot/index.ts +97 -0
  311. package/src/chatbot/types.ts +66 -0
  312. package/src/hooks/index.ts +17 -0
  313. package/src/hooks/useAutoScroll.ts +43 -0
  314. package/src/hooks/useClipboard.ts +46 -0
  315. package/src/hooks/useCollapsible.ts +42 -0
  316. package/src/hooks/useStickToBottom.ts +82 -0
  317. package/src/index.ts +139 -0
  318. package/src/primitives/Badge.tsx +119 -0
  319. package/src/primitives/Button.tsx +213 -0
  320. package/src/primitives/Card.tsx +221 -0
  321. package/src/primitives/Collapsible.tsx +168 -0
  322. package/src/primitives/ScrollArea.tsx +53 -0
  323. package/src/primitives/index.ts +36 -0
  324. package/src/streaming/StreamingMarkdown.tsx +282 -0
  325. package/src/streaming/index.ts +2 -0
  326. package/src/streaming/parser.ts +506 -0
  327. package/src/streaming/renderers/BlockquoteRenderer.tsx +42 -0
  328. package/src/streaming/renderers/CodeRenderer.tsx +158 -0
  329. package/src/streaming/renderers/HeadingRenderer.tsx +64 -0
  330. package/src/streaming/renderers/ImageRenderer.tsx +62 -0
  331. package/src/streaming/renderers/LinkRenderer.tsx +53 -0
  332. package/src/streaming/renderers/ListRenderer.tsx +65 -0
  333. package/src/streaming/renderers/TableRenderer.tsx +103 -0
  334. package/src/streaming/renderers/TextRenderer.tsx +39 -0
  335. package/src/streaming/renderers/index.ts +26 -0
  336. package/src/streaming/renderers/renderInlineChildren.tsx +115 -0
  337. package/src/streaming/renderers/renderNode.tsx +72 -0
  338. package/src/theme/ThemeProvider.tsx +77 -0
  339. package/src/theme/defaultTheme.ts +93 -0
  340. package/src/theme/index.ts +4 -0
  341. package/src/theme/tokens.ts +69 -0
  342. package/src/types.d.ts +71 -0
  343. package/src/voice/index.ts +15 -0
  344. package/src/voice/useSpeechRecognition.ts +230 -0
@@ -0,0 +1,352 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PromptInput = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _lucideReactNative = require("lucide-react-native");
10
+ var _reactNativeKeyboardController = require("react-native-keyboard-controller");
11
+ var _expoGlassEffect = require("expo-glass-effect");
12
+ var _theme = require("../theme");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
15
+ // ---------------------------------------------------------------------------
16
+ // Types
17
+ // ---------------------------------------------------------------------------
18
+
19
+ /**
20
+ * Lifecycle status of the chat the PromptInput is attached to. Drives the
21
+ * shape of the right-side action button.
22
+ *
23
+ * - `'ready'` — idle. Right action shows mic (empty) or send (has text).
24
+ * - `'submitted'` — request just sent, awaiting first token. Right action
25
+ * shows a spinner.
26
+ * - `'streaming'` — assistant is generating. Right action shows a Stop
27
+ * button (calls `onStop` when pressed).
28
+ * - `'error'` — request failed. Right action shows an error icon; tap
29
+ * re-submits.
30
+ *
31
+ * Inspired by Vercel ai-elements `PromptInputSubmit.status`.
32
+ */
33
+
34
+ /** Imperative handle exposed via ref. */
35
+
36
+ // ---------------------------------------------------------------------------
37
+ // Constants
38
+ // ---------------------------------------------------------------------------
39
+
40
+ const DEFAULT_MIN_HEIGHT = 36;
41
+ const DEFAULT_MAX_HEIGHT = 100;
42
+ const CIRCLE_BUTTON_SIZE = 36;
43
+ const ICON_SIZE = 18;
44
+ const isIOS = _reactNative.Platform.OS === 'ios';
45
+
46
+ // ---------------------------------------------------------------------------
47
+ // CircleButton — lucide icon inside a native iOS glass circle.
48
+ // Uses `expo-glass-effect`'s GlassView, which renders a real
49
+ // UIVisualEffectView on iOS (liquid glass on iOS 26+) and degrades to a
50
+ // plain View on Android/web.
51
+ // ---------------------------------------------------------------------------
52
+
53
+ function CircleButton({
54
+ icon,
55
+ onPress,
56
+ isDisabled = false,
57
+ tintColor,
58
+ dark,
59
+ fallbackBackground,
60
+ accessibilityLabel
61
+ }) {
62
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_expoGlassEffect.GlassView, {
63
+ glassEffectStyle: isIOS ? 'regular' : 'none',
64
+ tintColor: tintColor,
65
+ isInteractive: true,
66
+ colorScheme: dark ? 'dark' : 'light',
67
+ style: [styles.circleButton,
68
+ // On non-iOS GlassView is just a plain View, so paint the bg
69
+ // ourselves to keep the visible circle.
70
+ !isIOS && {
71
+ backgroundColor: fallbackBackground
72
+ }],
73
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
74
+ onPress: onPress,
75
+ disabled: isDisabled,
76
+ accessibilityLabel: accessibilityLabel,
77
+ accessibilityRole: "button",
78
+ accessibilityState: {
79
+ disabled: isDisabled
80
+ },
81
+ style: ({
82
+ pressed
83
+ }) => [styles.circleButtonInner, {
84
+ opacity: pressed ? 0.6 : isDisabled ? 0.5 : 1
85
+ }],
86
+ children: icon
87
+ })
88
+ });
89
+ }
90
+ CircleButton.displayName = 'PromptInput.CircleButton';
91
+
92
+ // ---------------------------------------------------------------------------
93
+ // Component
94
+ // ---------------------------------------------------------------------------
95
+
96
+ /**
97
+ * The sticky bottom input bar for a chat. Owns its own expanding-textarea
98
+ * height state so keystrokes don't re-render the parent screen. Moves with
99
+ * the keyboard via `KeyboardStickyView` from `react-native-keyboard-controller`.
100
+ *
101
+ * The right-side action is computed from `status`:
102
+ * - `'submitted'` → spinner
103
+ * - `'streaming'` → Stop button (calls `onStop`)
104
+ * - `'error'` → error icon (tap re-submits)
105
+ * - otherwise → Mic (empty input) or Send (has input)
106
+ *
107
+ * @example
108
+ * ```tsx
109
+ * <PromptInput
110
+ * value={input}
111
+ * onChangeText={setInput}
112
+ * onSubmit={sendMessage}
113
+ * onStop={stop}
114
+ * status={isStreaming ? 'streaming' : 'ready'}
115
+ * bottomInset={insets.bottom}
116
+ * suggestions={messages.length === 0 ? <Suggestions /> : null}
117
+ * />
118
+ * ```
119
+ */
120
+ const PromptInputImpl = /*#__PURE__*/(0, _react.forwardRef)(function PromptInput({
121
+ value,
122
+ onChangeText,
123
+ onSubmit,
124
+ onStop,
125
+ status = 'ready',
126
+ disabled = false,
127
+ placeholder = 'Ask me anything...',
128
+ minHeight = DEFAULT_MIN_HEIGHT,
129
+ maxHeight = DEFAULT_MAX_HEIGHT,
130
+ bottomInset = 0,
131
+ suggestions,
132
+ leftAction,
133
+ onLeftActionPress,
134
+ rightAction,
135
+ isListening = false,
136
+ onMicPress,
137
+ keyboardAppearance,
138
+ style,
139
+ ...viewProps
140
+ }, ref) {
141
+ const theme = (0, _theme.useAIElementsTheme)();
142
+ const textInputRef = (0, _react.useRef)(null);
143
+ const [inputHeight, setInputHeight] = (0, _react.useState)(minHeight);
144
+
145
+ // Default the iOS keyboard to match the current theme. An explicit prop
146
+ // from the caller still wins.
147
+ const effectiveKeyboardAppearance = keyboardAppearance ?? (theme.dark ? 'dark' : 'light');
148
+ const hasText = value.trim().length > 0;
149
+ const canSubmit = hasText && !disabled && status === 'ready';
150
+ (0, _react.useImperativeHandle)(ref, () => ({
151
+ focus: () => textInputRef.current?.focus(),
152
+ blur: () => textInputRef.current?.blur(),
153
+ clear: () => {
154
+ onChangeText('');
155
+ setInputHeight(minHeight);
156
+ },
157
+ isFocused: () => textInputRef.current?.isFocused() ?? false
158
+ }), [onChangeText, minHeight]);
159
+ const handleContentSizeChange = (0, _react.useCallback)(e => {
160
+ const next = Math.min(Math.max(e.nativeEvent.contentSize.height, minHeight), maxHeight);
161
+ setInputHeight(next);
162
+ }, [minHeight, maxHeight]);
163
+ const handleSubmit = (0, _react.useCallback)(() => {
164
+ if (!canSubmit) return;
165
+ onSubmit();
166
+ setInputHeight(minHeight);
167
+ }, [canSubmit, onSubmit, minHeight]);
168
+
169
+ // --- Defaults -----------------------------------------------------------
170
+ // CircleButton wraps a lucide icon inside a real native iOS glass effect
171
+ // (UIVisualEffectView / liquid glass on iOS 26+). On Android/web it
172
+ // degrades to a flat themed circle so behavior is preserved.
173
+
174
+ const defaultLeftAction = /*#__PURE__*/(0, _jsxRuntime.jsx)(CircleButton, {
175
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.Plus, {
176
+ size: ICON_SIZE,
177
+ color: theme.colors.foreground
178
+ }),
179
+ onPress: onLeftActionPress,
180
+ dark: theme.dark,
181
+ fallbackBackground: theme.colors.secondary,
182
+ accessibilityLabel: "More options"
183
+ });
184
+
185
+ // The right-side action is a function of `status` first, then text content.
186
+ const defaultRightAction = (() => {
187
+ if (status === 'streaming') {
188
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(CircleButton, {
189
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.Square, {
190
+ size: 14,
191
+ color: theme.colors.background,
192
+ fill: theme.colors.background
193
+ }),
194
+ onPress: onStop,
195
+ tintColor: theme.colors.foreground,
196
+ dark: theme.dark,
197
+ fallbackBackground: theme.colors.foreground,
198
+ accessibilityLabel: "Stop generating"
199
+ });
200
+ }
201
+ if (status === 'submitted') {
202
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(CircleButton, {
203
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
204
+ size: "small",
205
+ color: theme.colors.foreground
206
+ }),
207
+ isDisabled: true,
208
+ dark: theme.dark,
209
+ fallbackBackground: theme.colors.secondary,
210
+ accessibilityLabel: "Sending"
211
+ });
212
+ }
213
+ if (status === 'error') {
214
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(CircleButton, {
215
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.AlertCircle, {
216
+ size: ICON_SIZE,
217
+ color: theme.colors.destructive
218
+ }),
219
+ onPress: hasText && !disabled ? handleSubmit : undefined,
220
+ dark: theme.dark,
221
+ fallbackBackground: theme.colors.secondary,
222
+ accessibilityLabel: "Send failed \u2014 tap to retry"
223
+ });
224
+ }
225
+
226
+ // status === 'ready' — original mic/send behavior.
227
+ if (hasText) {
228
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(CircleButton, {
229
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.ArrowUp, {
230
+ size: ICON_SIZE,
231
+ color: canSubmit ? theme.colors.background : theme.colors.mutedForeground
232
+ }),
233
+ onPress: canSubmit ? handleSubmit : undefined,
234
+ isDisabled: !canSubmit
235
+ // Tint the glass with the foreground color so the active send
236
+ // button reads as prominent against the muted plus/mic siblings.
237
+ ,
238
+ tintColor: canSubmit ? theme.colors.foreground : undefined,
239
+ dark: theme.dark,
240
+ fallbackBackground: canSubmit ? theme.colors.foreground : theme.colors.secondary,
241
+ accessibilityLabel: "Send message"
242
+ });
243
+ }
244
+
245
+ // Empty input + not streaming → Mic (voice input).
246
+ // While listening, tint the glass with `destructive` and flip the
247
+ // icon color so the recording state is unmissable.
248
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(CircleButton, {
249
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.Mic, {
250
+ size: ICON_SIZE,
251
+ color: isListening ? theme.colors.destructiveForeground : theme.colors.foreground
252
+ }),
253
+ onPress: onMicPress,
254
+ tintColor: isListening ? theme.colors.destructive : undefined,
255
+ dark: theme.dark,
256
+ fallbackBackground: isListening ? theme.colors.destructive : theme.colors.secondary,
257
+ accessibilityLabel: isListening ? 'Stop voice input' : 'Start voice input'
258
+ });
259
+ })();
260
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeKeyboardController.KeyboardStickyView, {
261
+ offset: {
262
+ opened: bottomInset,
263
+ closed: 0
264
+ },
265
+ children: [suggestions, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
266
+ ...viewProps,
267
+ style: [styles.row, {
268
+ paddingHorizontal: theme.spacing.md,
269
+ paddingBottom: bottomInset + theme.spacing.sm
270
+ }, style],
271
+ children: [leftAction ?? defaultLeftAction, /*#__PURE__*/(0, _jsxRuntime.jsx)(_expoGlassEffect.GlassView, {
272
+ glassEffectStyle: isIOS ? 'regular' : 'none',
273
+ isInteractive: true,
274
+ colorScheme: theme.dark ? 'dark' : 'light',
275
+ style: [styles.inputPill,
276
+ // On iOS, the glass provides its own subtle edge — no border.
277
+ // On Android/web fall back to the original tinted pill.
278
+ isIOS ? null : {
279
+ backgroundColor: theme.colors.secondary,
280
+ borderWidth: 1,
281
+ borderColor: theme.dark ? 'transparent' : theme.colors.border
282
+ }],
283
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
284
+ ref: textInputRef,
285
+ value: value,
286
+ onChangeText: onChangeText,
287
+ placeholder: placeholder,
288
+ placeholderTextColor: theme.colors.mutedForeground,
289
+ multiline: true,
290
+ editable: !disabled,
291
+ keyboardAppearance: effectiveKeyboardAppearance,
292
+ onContentSizeChange: handleContentSizeChange,
293
+ onSubmitEditing: handleSubmit,
294
+ blurOnSubmit: false,
295
+ accessibilityLabel: "Message input",
296
+ style: [styles.textInput, {
297
+ height: inputHeight,
298
+ maxHeight,
299
+ color: theme.colors.foreground,
300
+ fontSize: theme.typography.fontSize.md,
301
+ fontFamily: theme.typography.fontFamily
302
+ }]
303
+ })
304
+ }), rightAction ?? defaultRightAction]
305
+ })]
306
+ });
307
+ });
308
+ PromptInputImpl.displayName = 'PromptInput';
309
+ const PromptInput = exports.PromptInput = PromptInputImpl;
310
+
311
+ // ---------------------------------------------------------------------------
312
+ // Styles — static so they're not reallocated per render
313
+ // ---------------------------------------------------------------------------
314
+
315
+ const styles = _reactNative.StyleSheet.create({
316
+ row: {
317
+ flexDirection: 'row',
318
+ alignItems: 'flex-end',
319
+ gap: 8
320
+ },
321
+ circleButton: {
322
+ width: CIRCLE_BUTTON_SIZE,
323
+ height: CIRCLE_BUTTON_SIZE,
324
+ borderRadius: CIRCLE_BUTTON_SIZE / 2,
325
+ // Clip the GlassView blur to the rounded shape on iOS, and the
326
+ // background fill on other platforms.
327
+ overflow: 'hidden',
328
+ alignItems: 'center',
329
+ justifyContent: 'center'
330
+ },
331
+ circleButtonInner: {
332
+ width: '100%',
333
+ height: '100%',
334
+ alignItems: 'center',
335
+ justifyContent: 'center'
336
+ },
337
+ inputPill: {
338
+ flex: 1,
339
+ borderRadius: 20,
340
+ paddingHorizontal: 14,
341
+ // Clip the GlassView blur (and the non-iOS background) to the rounded
342
+ // pill shape.
343
+ overflow: 'hidden'
344
+ },
345
+ textInput: {
346
+ textAlignVertical: 'top',
347
+ paddingTop: _reactNative.Platform.OS === 'ios' ? 8 : 6,
348
+ paddingBottom: _reactNative.Platform.OS === 'ios' ? 8 : 6,
349
+ paddingHorizontal: 0
350
+ }
351
+ });
352
+ //# sourceMappingURL=PromptInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_lucideReactNative","_reactNativeKeyboardController","_expoGlassEffect","_theme","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DEFAULT_MIN_HEIGHT","DEFAULT_MAX_HEIGHT","CIRCLE_BUTTON_SIZE","ICON_SIZE","isIOS","Platform","OS","CircleButton","icon","onPress","isDisabled","tintColor","dark","fallbackBackground","accessibilityLabel","jsx","GlassView","glassEffectStyle","isInteractive","colorScheme","style","styles","circleButton","backgroundColor","children","Pressable","disabled","accessibilityRole","accessibilityState","pressed","circleButtonInner","opacity","displayName","PromptInputImpl","forwardRef","PromptInput","value","onChangeText","onSubmit","onStop","status","placeholder","minHeight","maxHeight","bottomInset","suggestions","leftAction","onLeftActionPress","rightAction","isListening","onMicPress","keyboardAppearance","viewProps","ref","theme","useAIElementsTheme","textInputRef","useRef","inputHeight","setInputHeight","useState","effectiveKeyboardAppearance","hasText","trim","length","canSubmit","useImperativeHandle","focus","current","blur","clear","isFocused","handleContentSizeChange","useCallback","next","Math","min","max","nativeEvent","contentSize","height","handleSubmit","defaultLeftAction","Plus","size","color","colors","foreground","secondary","defaultRightAction","Square","background","fill","ActivityIndicator","AlertCircle","destructive","undefined","ArrowUp","mutedForeground","Mic","destructiveForeground","jsxs","KeyboardStickyView","offset","opened","closed","View","row","paddingHorizontal","spacing","md","paddingBottom","sm","inputPill","borderWidth","borderColor","border","TextInput","placeholderTextColor","multiline","editable","onContentSizeChange","onSubmitEditing","blurOnSubmit","textInput","fontSize","typography","fontFamily","exports","StyleSheet","create","flexDirection","alignItems","gap","width","borderRadius","overflow","justifyContent","flex","textAlignVertical","paddingTop"],"sourceRoot":"../../../src","sources":["chatbot/PromptInput.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAQA,IAAAC,YAAA,GAAAD,OAAA;AAYA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,8BAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA8C,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAD,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAQ,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAA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Ae,CAACD,WAAW,GAAG,aAAa;AAEpC,MAAMG,WAAW,GAAA6F,OAAA,CAAA7F,WAAA,GAAGF,eAAe;;AAE1C;AACA;AACA;;AAEA,MAAMZ,MAAM,GAAG4G,uBAAU,CAACC,MAAM,CAAC;EAC/BvB,GAAG,EAAE;IACHwB,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,UAAU;IACtBC,GAAG,EAAE;EACP,CAAC;EACD/G,YAAY,EAAE;IACZgH,KAAK,EAAEpI,kBAAkB;IACzB8E,MAAM,EAAE9E,kBAAkB;IAC1BqI,YAAY,EAAErI,kBAAkB,GAAG,CAAC;IACpC;IACA;IACAsI,QAAQ,EAAE,QAAQ;IAClBJ,UAAU,EAAE,QAAQ;IACpBK,cAAc,EAAE;EAClB,CAAC;EACD3G,iBAAiB,EAAE;IACjBwG,KAAK,EAAE,MAAM;IACbtD,MAAM,EAAE,MAAM;IACdoD,UAAU,EAAE,QAAQ;IACpBK,cAAc,EAAE;EAClB,CAAC;EACDxB,SAAS,EAAE;IACTyB,IAAI,EAAE,CAAC;IACPH,YAAY,EAAE,EAAE;IAChB3B,iBAAiB,EAAE,EAAE;IACrB;IACA;IACA4B,QAAQ,EAAE;EACZ,CAAC;EACDZ,SAAS,EAAE;IACTe,iBAAiB,EAAE,KAAK;IACxBC,UAAU,EAAEvI,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAG,CAAC,GAAG,CAAC;IACzCyG,aAAa,EAAE1G,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAG,CAAC,GAAG,CAAC;IAC5CsG,iBAAiB,EAAE;EACrB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Reasoning = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _lucideReactNative = require("lucide-react-native");
10
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
11
+ var _theme = require("../theme");
12
+ var _hooks = require("../hooks");
13
+ var _primitives = require("../primitives");
14
+ var _StreamingMarkdown = require("../streaming/StreamingMarkdown");
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
17
+ // ---------------------------------------------------------------------------
18
+ // Types
19
+ // ---------------------------------------------------------------------------
20
+
21
+ // ---------------------------------------------------------------------------
22
+ // Constants — match the Vercel ai-elements reference
23
+ // ---------------------------------------------------------------------------
24
+
25
+ const MS_IN_S = 1000;
26
+ const SHIMMER_DURATION_MS = 1200;
27
+
28
+ // ---------------------------------------------------------------------------
29
+ // Pulsing "Thinking..." text — mirrors the <Shimmer> the web reference uses
30
+ // ---------------------------------------------------------------------------
31
+
32
+ function ThinkingShimmer({
33
+ style
34
+ }) {
35
+ const opacity = (0, _reactNativeReanimated.useSharedValue)(1);
36
+ (0, _react.useEffect)(() => {
37
+ opacity.value = (0, _reactNativeReanimated.withRepeat)((0, _reactNativeReanimated.withTiming)(0.4, {
38
+ duration: SHIMMER_DURATION_MS
39
+ }), -1, true);
40
+ }, [opacity]);
41
+ const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
42
+ opacity: opacity.value
43
+ }));
44
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.Text, {
45
+ style: [style, animatedStyle],
46
+ children: "Thinking..."
47
+ });
48
+ }
49
+
50
+ // ---------------------------------------------------------------------------
51
+ // Component
52
+ // ---------------------------------------------------------------------------
53
+
54
+ function ReasoningComponent({
55
+ content,
56
+ isStreaming = false,
57
+ defaultOpen = false,
58
+ title,
59
+ style
60
+ }) {
61
+ const theme = (0, _theme.useAIElementsTheme)();
62
+
63
+ // The component starts collapsed (and stays collapsed) by default. The
64
+ // user must tap the trigger to expand. Pass `defaultOpen` to override.
65
+ const {
66
+ isOpen,
67
+ toggle
68
+ } = (0, _hooks.useCollapsible)({
69
+ defaultOpen
70
+ });
71
+
72
+ // --- duration tracking --------------------------------------------------
73
+ const startTimeRef = (0, _react.useRef)(null);
74
+ const [duration, setDuration] = (0, _react.useState)(undefined);
75
+ (0, _react.useEffect)(() => {
76
+ if (isStreaming) {
77
+ if (startTimeRef.current === null) {
78
+ startTimeRef.current = Date.now();
79
+ }
80
+ } else if (startTimeRef.current !== null) {
81
+ setDuration(Math.ceil((Date.now() - startTimeRef.current) / MS_IN_S));
82
+ startTimeRef.current = null;
83
+ }
84
+ }, [isStreaming]);
85
+ const handleOpenChange = (0, _react.useCallback)(next => {
86
+ if (next !== isOpen) {
87
+ toggle();
88
+ }
89
+ }, [isOpen, toggle]);
90
+
91
+ // --- styles -------------------------------------------------------------
92
+ const triggerTextStyle = {
93
+ color: theme.colors.mutedForeground,
94
+ fontSize: theme.typography.fontSize.sm,
95
+ fontWeight: theme.typography.fontWeight.medium,
96
+ fontFamily: theme.typography.fontFamily
97
+ };
98
+
99
+ // --- trigger label ------------------------------------------------------
100
+ const renderTriggerLabel = () => {
101
+ if (title) {
102
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
103
+ style: triggerTextStyle,
104
+ children: title
105
+ });
106
+ }
107
+ if (isStreaming || duration === 0) {
108
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(ThinkingShimmer, {
109
+ style: triggerTextStyle
110
+ });
111
+ }
112
+ if (duration === undefined) {
113
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
114
+ style: triggerTextStyle,
115
+ children: "Thought for a few seconds"
116
+ });
117
+ }
118
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
119
+ style: triggerTextStyle,
120
+ children: ["Thought for ", duration, " seconds"]
121
+ });
122
+ };
123
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Collapsible, {
124
+ open: isOpen,
125
+ onOpenChange: handleOpenChange,
126
+ style: style,
127
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.CollapsibleTrigger, {
128
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
129
+ style: [styles.trigger, {
130
+ gap: theme.spacing.sm,
131
+ paddingVertical: theme.spacing.xs
132
+ }],
133
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.Brain, {
134
+ size: 16,
135
+ color: theme.colors.mutedForeground
136
+ }), renderTriggerLabel(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.ChevronDown, {
137
+ size: 14,
138
+ color: theme.colors.mutedForeground,
139
+ style: {
140
+ transform: [{
141
+ rotate: isOpen ? '180deg' : '0deg'
142
+ }],
143
+ marginLeft: 4
144
+ }
145
+ })]
146
+ })
147
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.CollapsibleContent, {
148
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
149
+ style: [styles.content, {
150
+ paddingHorizontal: theme.spacing.md,
151
+ paddingVertical: theme.spacing.sm,
152
+ borderLeftColor: theme.colors.border
153
+ }],
154
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StreamingMarkdown.StreamingMarkdown, {
155
+ content: content,
156
+ isStreaming: isStreaming
157
+ })
158
+ })
159
+ })]
160
+ });
161
+ }
162
+
163
+ // ---------------------------------------------------------------------------
164
+ // Styles
165
+ // ---------------------------------------------------------------------------
166
+
167
+ const styles = _reactNative.StyleSheet.create({
168
+ trigger: {
169
+ flexDirection: 'row',
170
+ alignItems: 'center'
171
+ },
172
+ content: {
173
+ borderLeftWidth: 2,
174
+ marginLeft: 8,
175
+ marginTop: 4
176
+ }
177
+ });
178
+
179
+ // ---------------------------------------------------------------------------
180
+ // Export
181
+ // ---------------------------------------------------------------------------
182
+
183
+ const Reasoning = exports.Reasoning = /*#__PURE__*/(0, _react.memo)(ReasoningComponent);
184
+ //# sourceMappingURL=Reasoning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_lucideReactNative","_reactNativeReanimated","_theme","_hooks","_primitives","_StreamingMarkdown","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","MS_IN_S","SHIMMER_DURATION_MS","ThinkingShimmer","style","opacity","useSharedValue","useEffect","value","withRepeat","withTiming","duration","animatedStyle","useAnimatedStyle","jsx","Text","children","ReasoningComponent","content","isStreaming","defaultOpen","title","theme","useAIElementsTheme","isOpen","toggle","useCollapsible","startTimeRef","useRef","setDuration","useState","undefined","current","Date","now","Math","ceil","handleOpenChange","useCallback","next","triggerTextStyle","color","colors","mutedForeground","fontSize","typography","sm","fontWeight","medium","fontFamily","renderTriggerLabel","jsxs","Collapsible","open","onOpenChange","CollapsibleTrigger","View","styles","trigger","gap","spacing","paddingVertical","xs","Brain","size","ChevronDown","transform","rotate","marginLeft","CollapsibleContent","paddingHorizontal","md","borderLeftColor","border","StreamingMarkdown","StyleSheet","create","flexDirection","alignItems","borderLeftWidth","marginTop","Reasoning","exports","memo"],"sourceRoot":"../../../src","sources":["chatbot/Reasoning.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAMA,IAAA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