@rolder/kit 3.0.0-alpha.8 → 3.0.0-alpha.80

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 (297) hide show
  1. package/dist/ai/index.d.ts +2 -0
  2. package/dist/ai/index.js +2 -0
  3. package/dist/ai/ui/chat/Empty.d.ts +1 -0
  4. package/dist/ai/ui/chat/Empty.js +21 -0
  5. package/dist/ai/ui/chat/File.d.ts +3 -0
  6. package/dist/ai/ui/chat/File.js +43 -0
  7. package/dist/ai/ui/chat/FileIcon.d.ts +3 -0
  8. package/dist/ai/ui/chat/FileIcon.js +43 -0
  9. package/dist/ai/ui/chat/Loader.d.ts +2 -0
  10. package/dist/ai/ui/chat/Loader.js +13 -0
  11. package/dist/ai/ui/chat/Message.d.ts +3 -0
  12. package/dist/ai/ui/chat/Message.js +23 -0
  13. package/dist/ai/ui/chat/Messages.d.ts +2 -0
  14. package/dist/ai/ui/chat/Messages.js +27 -0
  15. package/dist/ai/ui/chat/Root.d.ts +49 -0
  16. package/dist/ai/ui/chat/Root.js +18 -0
  17. package/dist/ai/ui/chat/chatInput/File.d.ts +2 -0
  18. package/dist/ai/ui/chat/chatInput/File.js +71 -0
  19. package/dist/ai/ui/chat/chatInput/FileIcon.d.ts +3 -0
  20. package/dist/ai/ui/chat/chatInput/FileIcon.js +43 -0
  21. package/dist/ai/ui/chat/chatInput/Footer.d.ts +2 -0
  22. package/dist/ai/ui/chat/chatInput/Footer.js +8 -0
  23. package/dist/ai/ui/chat/chatInput/Root.d.ts +9 -0
  24. package/dist/ai/ui/chat/chatInput/Root.js +24 -0
  25. package/dist/ai/ui/chat/chatInput/Submit.d.ts +2 -0
  26. package/dist/ai/ui/chat/chatInput/Submit.js +23 -0
  27. package/dist/ai/ui/chat/chatInput/Textarea.d.ts +2 -0
  28. package/dist/ai/ui/chat/chatInput/Textarea.js +34 -0
  29. package/dist/ai/ui/chat/chatInput/index.d.ts +7 -0
  30. package/dist/ai/ui/chat/chatInput/index.js +13 -0
  31. package/dist/ai/ui/chat/chatInput/store/file.d.ts +8 -0
  32. package/dist/ai/ui/chat/chatInput/store/file.js +32 -0
  33. package/dist/ai/ui/chat/chatInput/store/fileErrorNotificaton.d.ts +2 -0
  34. package/dist/ai/ui/chat/chatInput/store/fileErrorNotificaton.js +21 -0
  35. package/dist/ai/ui/chat/chatInput/store/index.d.ts +2 -0
  36. package/dist/ai/ui/chat/chatInput/store/index.js +2 -0
  37. package/dist/ai/ui/chat/chatInput/store/input.d.ts +13 -0
  38. package/dist/ai/ui/chat/chatInput/store/input.js +81 -0
  39. package/dist/ai/ui/chat/chatInput/store/parseFile.d.ts +2 -0
  40. package/dist/ai/ui/chat/chatInput/store/parseFile.js +23 -0
  41. package/dist/ai/ui/chat/index.d.ts +13 -0
  42. package/dist/ai/ui/chat/index.js +15 -0
  43. package/dist/ai/ui/chat/store/index.d.ts +5 -0
  44. package/dist/ai/ui/chat/store/index.js +5 -0
  45. package/dist/ai/ui/chat/store/messageIds.d.ts +8 -0
  46. package/dist/ai/ui/chat/store/messageIds.js +41 -0
  47. package/dist/ai/ui/chat/store/messagesMap.d.ts +5 -0
  48. package/dist/ai/ui/chat/store/messagesMap.js +15 -0
  49. package/dist/ai/ui/chat/store/send.d.ts +14 -0
  50. package/dist/ai/ui/chat/store/send.js +16 -0
  51. package/dist/ai/ui/chat/store/states.d.ts +11 -0
  52. package/dist/ai/ui/chat/store/states.js +17 -0
  53. package/dist/ai/ui/chat/store/useInitChat.d.ts +3 -0
  54. package/dist/ai/ui/chat/store/useInitChat.js +40 -0
  55. package/dist/ai/ui/index.d.ts +1 -0
  56. package/dist/ai/ui/index.js +1 -0
  57. package/dist/ai/utils/convertFileUIPartBlobToDataURL.d.ts +5 -0
  58. package/dist/ai/utils/convertFileUIPartBlobToDataURL.js +21 -0
  59. package/dist/ai/utils/index.d.ts +2 -0
  60. package/dist/ai/utils/index.js +2 -0
  61. package/dist/ai/utils/parseAiMessagePart.d.ts +2 -0
  62. package/dist/ai/utils/parseAiMessagePart.js +12 -0
  63. package/dist/app/AppDefaults.d.ts +3 -0
  64. package/dist/app/AppDefaults.js +27 -0
  65. package/dist/app/DefaultApp.d.ts +6 -0
  66. package/dist/app/DefaultApp.js +43 -0
  67. package/dist/app/cookieColorSchemeManager.d.ts +6 -0
  68. package/dist/app/cookieColorSchemeManager.js +46 -0
  69. package/dist/app/defaultRequestMiddlewares.d.ts +4 -0
  70. package/dist/app/defaultRequestMiddlewares.js +24 -0
  71. package/dist/app/defaultTheme.d.ts +141 -0
  72. package/dist/app/defaultTheme.js +24 -0
  73. package/dist/app/index.d.ts +4 -0
  74. package/dist/app/index.js +4 -0
  75. package/dist/hooks/index.d.ts +2 -0
  76. package/dist/hooks/index.js +2 -0
  77. package/dist/hooks/useMutation.d.ts +4 -0
  78. package/dist/hooks/useMutation.js +8 -0
  79. package/dist/hooks/useMutationWithInvalidate.d.ts +4 -0
  80. package/dist/hooks/useMutationWithInvalidate.js +16 -0
  81. package/dist/index.d.ts +5 -0
  82. package/dist/index.js +5 -0
  83. package/{src → dist}/styles.css +14 -29
  84. package/dist/tanstackFunctions/cookie/getCookie.d.ts +3 -0
  85. package/dist/tanstackFunctions/cookie/getCookie.js +8 -0
  86. package/dist/tanstackFunctions/cookie/index.d.ts +3 -0
  87. package/dist/tanstackFunctions/cookie/index.js +4 -0
  88. package/dist/tanstackFunctions/cookie/setCookie.d.ts +10 -0
  89. package/dist/tanstackFunctions/cookie/setCookie.js +19 -0
  90. package/dist/tanstackFunctions/cookie/setCookies.d.ts +14 -0
  91. package/dist/tanstackFunctions/cookie/setCookies.js +13 -0
  92. package/dist/tanstackFunctions/index.d.ts +3 -0
  93. package/dist/tanstackFunctions/index.js +3 -0
  94. package/dist/tanstackFunctions/s3/getS3Client.d.ts +2 -0
  95. package/dist/tanstackFunctions/s3/getS3Client.js +18 -0
  96. package/dist/tanstackFunctions/s3/getSignedFileUrlFn.d.ts +4 -0
  97. package/dist/tanstackFunctions/s3/getSignedFileUrlFn.js +21 -0
  98. package/dist/tanstackFunctions/s3/index.d.ts +2 -0
  99. package/dist/tanstackFunctions/s3/index.js +2 -0
  100. package/dist/tanstackFunctions/s3/uploadRequest.d.ts +3 -0
  101. package/dist/tanstackFunctions/s3/uploadRequest.js +21 -0
  102. package/dist/tanstackFunctions/surreal/connection.d.ts +9 -0
  103. package/dist/tanstackFunctions/surreal/connection.js +49 -0
  104. package/dist/tanstackFunctions/surreal/deafaultCrud.d.ts +2 -0
  105. package/dist/tanstackFunctions/surreal/deafaultCrud.js +18 -0
  106. package/dist/tanstackFunctions/surreal/deserialize.d.ts +17 -0
  107. package/dist/tanstackFunctions/surreal/deserialize.js +46 -0
  108. package/dist/tanstackFunctions/surreal/encryption.d.ts +6 -0
  109. package/dist/tanstackFunctions/surreal/encryption.js +30 -0
  110. package/dist/tanstackFunctions/surreal/index.d.ts +4 -0
  111. package/dist/tanstackFunctions/surreal/index.js +4 -0
  112. package/dist/ui/AnimatedChevron.d.ts +6 -0
  113. package/dist/ui/AnimatedChevron.js +13 -0
  114. package/dist/ui/JsonInput.d.ts +2 -0
  115. package/dist/ui/JsonInput.js +45 -0
  116. package/dist/ui/RouterLink.d.ts +16 -0
  117. package/dist/ui/RouterLink.js +36 -0
  118. package/dist/ui/editor/Content.d.ts +3 -0
  119. package/dist/ui/editor/Content.js +13 -0
  120. package/dist/ui/editor/Root.d.ts +8 -0
  121. package/dist/ui/editor/Root.js +55 -0
  122. package/dist/ui/editor/Toolbar.d.ts +5 -0
  123. package/dist/ui/editor/Toolbar.js +138 -0
  124. package/dist/ui/editor/index.d.ts +11 -0
  125. package/dist/ui/editor/index.js +10 -0
  126. package/dist/ui/editor/store.d.ts +6 -0
  127. package/dist/ui/editor/store.js +10 -0
  128. package/dist/ui/error/DefaultError.d.ts +2 -0
  129. package/dist/ui/error/DefaultError.js +62 -0
  130. package/dist/ui/error/DefaultNotFound.d.ts +1 -0
  131. package/dist/ui/error/DefaultNotFound.js +37 -0
  132. package/dist/ui/error/Forbidden.d.ts +1 -0
  133. package/dist/ui/error/Forbidden.js +32 -0
  134. package/dist/ui/error/defaultErrorNotification.d.ts +1 -0
  135. package/dist/ui/error/defaultErrorNotification.js +8 -0
  136. package/dist/ui/error/index.js +5 -0
  137. package/dist/ui/form/blurOnError.d.ts +4 -0
  138. package/dist/ui/form/blurOnError.js +11 -0
  139. package/dist/ui/form/buttons/CancelButton.d.ts +5 -0
  140. package/dist/ui/form/buttons/CancelButton.js +22 -0
  141. package/dist/ui/form/buttons/SubmitButton.d.ts +5 -0
  142. package/dist/ui/form/buttons/SubmitButton.js +22 -0
  143. package/dist/ui/form/buttons/SubscribeActionIcon.d.ts +4 -0
  144. package/dist/ui/form/buttons/SubscribeActionIcon.js +15 -0
  145. package/dist/ui/form/buttons/SubscribeButton.d.ts +5 -0
  146. package/dist/ui/form/buttons/SubscribeButton.js +16 -0
  147. package/dist/ui/form/buttons/index.js +4 -0
  148. package/dist/ui/form/context.d.ts +83 -0
  149. package/dist/ui/form/context.js +26 -0
  150. package/dist/ui/form/fields/JsonField.d.ts +2 -0
  151. package/dist/ui/form/fields/JsonField.js +13 -0
  152. package/dist/ui/form/fields/MultiSelectField.d.ts +2 -0
  153. package/dist/ui/form/fields/MultiSelectField.js +15 -0
  154. package/dist/ui/form/fields/NumberField.d.ts +2 -0
  155. package/dist/ui/form/fields/NumberField.js +15 -0
  156. package/dist/ui/form/fields/PassowrdField.d.ts +2 -0
  157. package/dist/ui/form/fields/PassowrdField.js +18 -0
  158. package/dist/ui/form/fields/SelectField.d.ts +2 -0
  159. package/dist/ui/form/fields/SelectField.js +15 -0
  160. package/dist/ui/form/fields/SwitchField.d.ts +2 -0
  161. package/dist/ui/form/fields/SwitchField.js +15 -0
  162. package/dist/ui/form/fields/TextField.d.ts +2 -0
  163. package/dist/ui/form/fields/TextField.js +15 -0
  164. package/dist/ui/form/fields/TextPassowrdField.d.ts +2 -0
  165. package/dist/ui/form/fields/TextPassowrdField.js +29 -0
  166. package/dist/ui/form/fields/TextareaField.d.ts +2 -0
  167. package/dist/ui/form/fields/TextareaField.js +15 -0
  168. package/dist/ui/form/fields/index.js +9 -0
  169. package/dist/ui/form/fieldsSchema.d.ts +12 -0
  170. package/dist/ui/form/fieldsSchema.js +13 -0
  171. package/dist/ui/form/index.js +4 -0
  172. package/dist/ui/hoverPaper/HoverPaper.d.ts +6 -0
  173. package/dist/ui/hoverPaper/HoverPaper.js +15 -0
  174. package/dist/ui/hoverPaper/index.js +3 -0
  175. package/dist/ui/hoverPaper/usePaperHover.d.ts +4 -0
  176. package/dist/ui/hoverPaper/usePaperHover.js +9 -0
  177. package/dist/ui/index.d.ts +9 -0
  178. package/dist/ui/index.js +9 -0
  179. package/dist/ui/saveInput/JsonInput.d.ts +6 -0
  180. package/dist/ui/saveInput/JsonInput.js +34 -0
  181. package/dist/ui/saveInput/NumberInput.d.ts +6 -0
  182. package/dist/ui/saveInput/NumberInput.js +27 -0
  183. package/dist/ui/saveInput/SaveInput.d.ts +36 -0
  184. package/dist/ui/saveInput/SaveInput.js +15 -0
  185. package/dist/ui/saveInput/Select.d.ts +6 -0
  186. package/dist/ui/saveInput/Select.js +27 -0
  187. package/dist/ui/saveInput/Switch.d.ts +6 -0
  188. package/dist/ui/saveInput/Switch.js +30 -0
  189. package/dist/ui/saveInput/TextInput.d.ts +6 -0
  190. package/dist/ui/saveInput/TextInput.js +26 -0
  191. package/dist/ui/saveInput/Textarea.d.ts +6 -0
  192. package/dist/ui/saveInput/Textarea.js +26 -0
  193. package/dist/ui/saveInput/index.js +2 -0
  194. package/dist/ui/scrollArea/Root.d.ts +7 -0
  195. package/dist/ui/scrollArea/Root.js +42 -0
  196. package/dist/ui/scrollArea/ScrollButton.d.ts +10 -0
  197. package/dist/ui/scrollArea/ScrollButton.js +30 -0
  198. package/dist/ui/scrollArea/index.d.ts +6 -0
  199. package/dist/ui/scrollArea/index.js +7 -0
  200. package/dist/ui/scrollArea/methods.d.ts +4 -0
  201. package/dist/ui/scrollArea/methods.js +32 -0
  202. package/dist/ui/scrollArea/store.d.ts +12 -0
  203. package/dist/ui/scrollArea/store.js +25 -0
  204. package/package.json +40 -28
  205. package/rslib.config.ts +0 -21
  206. package/src/ai/ui/conversation/ConversationContext.ts +0 -21
  207. package/src/ai/ui/conversation/ConversationProvider.tsx +0 -21
  208. package/src/ai/ui/conversation/Empty.tsx +0 -15
  209. package/src/ai/ui/conversation/File.tsx +0 -40
  210. package/src/ai/ui/conversation/FileIcon.tsx +0 -143
  211. package/src/ai/ui/conversation/Loader.tsx +0 -8
  212. package/src/ai/ui/conversation/Message.tsx +0 -34
  213. package/src/ai/ui/conversation/Root.tsx +0 -24
  214. package/src/ai/ui/conversation/index.ts +0 -16
  215. package/src/ai/ui/conversation/types.ts +0 -8
  216. package/src/ai/ui/conversation/useChatMessage.ts +0 -13
  217. package/src/ai/ui/promptInput/File.tsx +0 -98
  218. package/src/ai/ui/promptInput/FileIcon.tsx +0 -149
  219. package/src/ai/ui/promptInput/Footer.tsx +0 -5
  220. package/src/ai/ui/promptInput/PromptInputContext.ts +0 -24
  221. package/src/ai/ui/promptInput/PromptInputProvider.tsx +0 -54
  222. package/src/ai/ui/promptInput/Root.tsx +0 -29
  223. package/src/ai/ui/promptInput/Submit.tsx +0 -39
  224. package/src/ai/ui/promptInput/Textarea.tsx +0 -39
  225. package/src/ai/ui/promptInput/index.ts +0 -15
  226. package/src/ai/ui/promptInput/types.ts +0 -9
  227. package/src/ai/utils/convertFileUIPartBlobToDataURL.ts +0 -29
  228. package/src/ai/utils/parseAiMessagePart.ts +0 -19
  229. package/src/app/AppDefaults.tsx +0 -21
  230. package/src/app/DefaultApp.tsx +0 -50
  231. package/src/app/cookieColorSchemeManager.ts +0 -70
  232. package/src/app/defaultRequestMiddlewares.ts +0 -22
  233. package/src/app/defaultTheme.ts +0 -22
  234. package/src/functions/getCookie.ts +0 -36
  235. package/src/functions/setCookie.ts +0 -29
  236. package/src/functions/setCookies.ts +0 -24
  237. package/src/hooks/useMutation.ts +0 -14
  238. package/src/hooks/useMutationWithInvalidate.ts +0 -23
  239. package/src/index.ts +0 -66
  240. package/src/surreal/connection.ts +0 -72
  241. package/src/surreal/deafaultCrud.ts +0 -25
  242. package/src/surreal/deserialize.ts +0 -144
  243. package/src/surreal/encryption.ts +0 -51
  244. package/src/ui/AnimatedChevron.tsx +0 -32
  245. package/src/ui/JsonInput.tsx +0 -52
  246. package/src/ui/RouterLink.tsx +0 -78
  247. package/src/ui/editor/Content.tsx +0 -11
  248. package/src/ui/editor/Provider.tsx +0 -96
  249. package/src/ui/editor/Root.tsx +0 -25
  250. package/src/ui/editor/Toolbar.tsx +0 -92
  251. package/src/ui/editor/index.ts +0 -13
  252. package/src/ui/editor/types.ts +0 -7
  253. package/src/ui/error/DefaultError.tsx +0 -60
  254. package/src/ui/error/DefaultNotFound.tsx +0 -19
  255. package/src/ui/error/Forbidden.tsx +0 -18
  256. package/src/ui/error/defaultErrorNotification.ts +0 -9
  257. package/src/ui/form/blurOnError.ts +0 -21
  258. package/src/ui/form/buttons/CancelButton.tsx +0 -42
  259. package/src/ui/form/buttons/SubmitButton.tsx +0 -43
  260. package/src/ui/form/buttons/SubscribeActionIcon.tsx +0 -18
  261. package/src/ui/form/buttons/SubscribeButton.tsx +0 -17
  262. package/src/ui/form/context.ts +0 -45
  263. package/src/ui/form/fields/JsonField.tsx +0 -16
  264. package/src/ui/form/fields/MultiSelectField.tsx +0 -17
  265. package/src/ui/form/fields/NumberField.tsx +0 -17
  266. package/src/ui/form/fields/PassowrdField.tsx +0 -20
  267. package/src/ui/form/fields/SelectField.tsx +0 -17
  268. package/src/ui/form/fields/SwitchField.tsx +0 -17
  269. package/src/ui/form/fields/TextField.tsx +0 -17
  270. package/src/ui/form/fields/TextPassowrdField.tsx +0 -51
  271. package/src/ui/form/fields/TextareaField.tsx +0 -17
  272. package/src/ui/form/fieldsSchema.ts +0 -24
  273. package/src/ui/hoverPaper/HoverPaper.tsx +0 -17
  274. package/src/ui/hoverPaper/usePaperHover.ts +0 -9
  275. package/src/ui/saveInput/JsonInput.tsx +0 -40
  276. package/src/ui/saveInput/NumberInput.tsx +0 -40
  277. package/src/ui/saveInput/SaveInput.tsx +0 -15
  278. package/src/ui/saveInput/Select.tsx +0 -41
  279. package/src/ui/saveInput/Switch.tsx +0 -46
  280. package/src/ui/saveInput/TextInput.tsx +0 -40
  281. package/src/ui/saveInput/Textarea.tsx +0 -40
  282. package/src/ui/scrollArea/ARCH.md +0 -204
  283. package/src/ui/scrollArea/README.md +0 -369
  284. package/src/ui/scrollArea/ScrollArea.tsx +0 -93
  285. package/src/ui/scrollArea/ScrollAreaButton.tsx +0 -56
  286. package/src/ui/scrollArea/ScrollAreaContent.tsx +0 -36
  287. package/src/ui/scrollArea/context.tsx +0 -43
  288. package/src/ui/scrollArea/index.ts +0 -10
  289. package/src/ui/scrollArea/types.ts +0 -77
  290. package/src/ui/scrollArea/useScrollArea.ts +0 -227
  291. package/tsconfig.json +0 -14
  292. /package/{src/ui/error/index.ts → dist/ui/error/index.d.ts} +0 -0
  293. /package/{src/ui/form/buttons/index.ts → dist/ui/form/buttons/index.d.ts} +0 -0
  294. /package/{src/ui/form/fields/index.ts → dist/ui/form/fields/index.d.ts} +0 -0
  295. /package/{src/ui/form/index.ts → dist/ui/form/index.d.ts} +0 -0
  296. /package/{src/ui/hoverPaper/index.ts → dist/ui/hoverPaper/index.d.ts} +0 -0
  297. /package/{src/ui/saveInput/index.ts → dist/ui/saveInput/index.d.ts} +0 -0
@@ -0,0 +1,2 @@
1
+ export * from './ui';
2
+ export * from './utils';
@@ -0,0 +1,2 @@
1
+ export * from "./ui/index.js";
2
+ export * from "./utils/index.js";
@@ -0,0 +1 @@
1
+ export declare const Empty: () => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,21 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Stack, Text } from "@mantine/core";
3
+ import { useIsEmpty } from "./store/index.js";
4
+ const Empty = ()=>{
5
+ const isEmpty = useIsEmpty();
6
+ return isEmpty ? /*#__PURE__*/ jsxs(Stack, {
7
+ align: "center",
8
+ gap: 0,
9
+ children: [
10
+ /*#__PURE__*/ jsx(Text, {
11
+ children: "Нет сообщений"
12
+ }),
13
+ /*#__PURE__*/ jsx(Text, {
14
+ size: "sm",
15
+ c: "dimmed",
16
+ children: "Начните общение, чтобы увидеть сообщения здесь"
17
+ })
18
+ ]
19
+ }) : null;
20
+ };
21
+ export { Empty };
@@ -0,0 +1,3 @@
1
+ export declare const File: ({ messageId }: {
2
+ messageId: string;
3
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,43 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Image, Paper } from "@mantine/core";
3
+ import { FileIcon } from "./FileIcon.js";
4
+ import { useChatMessagePart } from "./store/index.js";
5
+ const File = ({ messageId })=>{
6
+ const part = useChatMessagePart(messageId, 'file');
7
+ const textFileType = messageId.split('-')[1];
8
+ const FileComponent = ()=>{
9
+ switch(textFileType){
10
+ case 'excel':
11
+ return /*#__PURE__*/ jsx(FileIcon, {
12
+ mimeType: "excel"
13
+ });
14
+ case 'word':
15
+ return /*#__PURE__*/ jsx(FileIcon, {
16
+ mimeType: "word"
17
+ });
18
+ case 'powerpoint':
19
+ return /*#__PURE__*/ jsx(FileIcon, {
20
+ mimeType: "powerpoint"
21
+ });
22
+ }
23
+ if (!part) return null;
24
+ if (part.mediaType.includes('image/')) return /*#__PURE__*/ jsx(Image, {
25
+ radius: "md",
26
+ h: 128,
27
+ src: part.url,
28
+ alt: "Image Preview"
29
+ });
30
+ return /*#__PURE__*/ jsx(FileIcon, {
31
+ mimeType: part.mediaType
32
+ });
33
+ };
34
+ return textFileType || part ? /*#__PURE__*/ jsx(Paper, {
35
+ radius: "md",
36
+ px: "md",
37
+ py: "sm",
38
+ ml: "auto",
39
+ bg: "var(--mantine-color-default-hover)",
40
+ children: /*#__PURE__*/ jsx(FileComponent, {})
41
+ }) : null;
42
+ };
43
+ export { File };
@@ -0,0 +1,3 @@
1
+ export declare const FileIcon: ({ mimeType }: {
2
+ mimeType: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { IconFile, IconFileTypeDoc, IconFileTypePdf, IconFileTypePpt, IconFileTypeXls, IconPhoto } from "@tabler/icons-react";
3
+ const FileIcon = ({ mimeType })=>{
4
+ switch(true){
5
+ case mimeType.includes('image/'):
6
+ return /*#__PURE__*/ jsx(IconPhoto, {
7
+ size: 36,
8
+ stroke: 1.5,
9
+ color: "var(--mantine-color-text)"
10
+ });
11
+ case mimeType.includes('application/pdf'):
12
+ return /*#__PURE__*/ jsx(IconFileTypePdf, {
13
+ size: 36,
14
+ stroke: 1.5,
15
+ color: "var(--mantine-color-text)"
16
+ });
17
+ case 'word' === mimeType:
18
+ return /*#__PURE__*/ jsx(IconFileTypeDoc, {
19
+ size: 36,
20
+ stroke: 1.5,
21
+ color: "var(--mantine-color-text)"
22
+ });
23
+ case 'excel' === mimeType:
24
+ return /*#__PURE__*/ jsx(IconFileTypeXls, {
25
+ size: 36,
26
+ stroke: 1.5,
27
+ color: "var(--mantine-color-text)"
28
+ });
29
+ case 'powerpoint' === mimeType:
30
+ return /*#__PURE__*/ jsx(IconFileTypePpt, {
31
+ size: 36,
32
+ stroke: 1.5,
33
+ color: "var(--mantine-color-text)"
34
+ });
35
+ default:
36
+ return /*#__PURE__*/ jsx(IconFile, {
37
+ size: 36,
38
+ stroke: 1.5,
39
+ color: "var(--mantine-color-text)"
40
+ });
41
+ }
42
+ };
43
+ export { FileIcon };
@@ -0,0 +1,2 @@
1
+ import { type LoaderProps } from '@mantine/core';
2
+ export declare const Loader: (props: LoaderProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,13 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Loader } from "@mantine/core";
3
+ import { useIsLoading, useIsStreaming } from "./store/index.js";
4
+ const Loader_Loader = (props)=>{
5
+ const isLoading = useIsLoading();
6
+ const isStreaming = useIsStreaming();
7
+ return isLoading && !isStreaming ? /*#__PURE__*/ jsx(Loader, {
8
+ size: 28,
9
+ type: "dots",
10
+ ...props
11
+ }) : null;
12
+ };
13
+ export { Loader_Loader as Loader };
@@ -0,0 +1,3 @@
1
+ export declare const Message: import("react").MemoExoticComponent<({ messageId }: {
2
+ messageId: string;
3
+ }) => import("react/jsx-runtime").JSX.Element | null>;
@@ -0,0 +1,23 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Paper } from "@mantine/core";
3
+ import { memo } from "react";
4
+ import { Streamdown } from "streamdown";
5
+ import { getIsStreaming, useChatMessage, useChatMessagePart } from "./store/index.js";
6
+ const Message = /*#__PURE__*/ memo(({ messageId })=>{
7
+ const message = useChatMessage(messageId);
8
+ const part = useChatMessagePart(messageId, 'text');
9
+ return part?.text ? /*#__PURE__*/ jsx(Paper, {
10
+ radius: "md",
11
+ px: "md",
12
+ py: "sm",
13
+ maw: "80%",
14
+ ml: 'user' === message.role ? 'auto' : void 0,
15
+ bg: 'user' === message.role ? 'var(--mantine-color-default-hover)' : 'var(--mantine-primary-color-light)',
16
+ fz: "sm",
17
+ children: /*#__PURE__*/ jsx(Streamdown, {
18
+ isAnimating: getIsStreaming() && 'assistant' === message.role,
19
+ children: part?.text
20
+ })
21
+ }) : null;
22
+ });
23
+ export { Message };
@@ -0,0 +1,2 @@
1
+ import type { ChatRootProps } from './Root';
2
+ export declare const Messages: ({ children, height, radius, padding, scrollAreaProps, withScrollButton, stackProps, ...props }: Omit<ChatRootProps, "chatOptions">) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Paper, Stack } from "@mantine/core";
3
+ import { ScrollArea } from "../../../ui/index.js";
4
+ import { useChatMessageIds } from "./store/index.js";
5
+ const Messages = ({ children, height, radius = 'md', padding = 'md', scrollAreaProps, withScrollButton = true, stackProps, ...props })=>{
6
+ const messageIds = useChatMessageIds();
7
+ return /*#__PURE__*/ jsx(Paper, {
8
+ withBorder: true,
9
+ radius: radius,
10
+ ...props,
11
+ children: /*#__PURE__*/ jsxs(ScrollArea.Root, {
12
+ autoScroll: true,
13
+ height: height,
14
+ radius: radius,
15
+ ...scrollAreaProps,
16
+ children: [
17
+ /*#__PURE__*/ jsx(Stack, {
18
+ p: padding,
19
+ ...stackProps,
20
+ children: 'function' == typeof children ? children(messageIds) : null
21
+ }),
22
+ withScrollButton && /*#__PURE__*/ jsx(ScrollArea.ScrollButton, {})
23
+ ]
24
+ })
25
+ });
26
+ };
27
+ export { Messages };
@@ -0,0 +1,49 @@
1
+ import type { UseChatOptions } from '@ai-sdk/react';
2
+ import type { MantineRadius, MantineSpacing, PaperProps, ScrollAreaProps, StackProps } from '@mantine/core';
3
+ import type { ChatInit, UIMessage } from 'ai';
4
+ import type { ReactNode } from 'react';
5
+ export interface ChatRootProps extends PaperProps {
6
+ children: (messageIds: string[]) => ReactNode;
7
+ height: string;
8
+ radius?: MantineRadius;
9
+ padding?: MantineSpacing;
10
+ scrollAreaProps?: Omit<ScrollAreaProps, 'children' | 'h'>;
11
+ withScrollButton?: boolean;
12
+ stackProps?: Omit<StackProps, 'p'>;
13
+ chatOptions?: UseChatOptions<UIMessage> & ChatInit<UIMessage>;
14
+ }
15
+ /**
16
+ * Корневой компонент чата
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * import { Chat } from '@rolder/kit';
21
+ *
22
+ * const MyChat = () => {
23
+ * return (
24
+ * <Chat.Root h="calc(100vh - 202px)">
25
+ * {(messageIds) => (
26
+ * <>
27
+ * {messageIds.map((messageId) => (
28
+ * <Chat.Message key={messageId} messageId={messageId} />
29
+ * ))}
30
+ *
31
+ * <Chat.Empty />
32
+ * <Chat.Loader />
33
+ * </>
34
+ * )}
35
+ * </Chat.Root>
36
+ * );
37
+ * }
38
+ * ```
39
+ *
40
+ * @param children - Render-функция, принимающая массив ID сообщений
41
+ * @param height - Высота компонента (обязательный параметр)
42
+ * @param radius - Радиус скругления углов компонента
43
+ * @param padding - Отступы внутри компонента
44
+ * @param chatOptions - Опции для инициализации чата (API endpoint, начальные сообщения и т.д.)
45
+ * @param scrollAreaProps - Пропсы для ScrollArea
46
+ * @param withScrollButton - Показывать кнопку прокрутки (по умолчанию true)
47
+ * @param stackProps - Пропсы для Stack контейнера
48
+ */
49
+ export declare const Root: ({ chatOptions, ...props }: ChatRootProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Messages } from "./Messages.js";
3
+ import { useInitChat } from "./store/index.js";
4
+ const ChatInitializer = ({ chatOptions })=>{
5
+ useInitChat(chatOptions);
6
+ return null;
7
+ };
8
+ const Root = ({ chatOptions, ...props })=>/*#__PURE__*/ jsxs(Fragment, {
9
+ children: [
10
+ /*#__PURE__*/ jsx(ChatInitializer, {
11
+ chatOptions: chatOptions
12
+ }),
13
+ /*#__PURE__*/ jsx(Messages, {
14
+ ...props
15
+ })
16
+ ]
17
+ });
18
+ export { Root };
@@ -0,0 +1,2 @@
1
+ import { type FileButtonProps } from '@mantine/core';
2
+ export declare const File: (props: Omit<FileButtonProps, "onChange" | "children">) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,71 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { ActionIcon, FileButton, Tooltip } from "@mantine/core";
3
+ import { IconPaperclip, IconTrash } from "@tabler/icons-react";
4
+ import { useRef } from "react";
5
+ import { useIsLoading } from "../store/index.js";
6
+ import { FileIcon } from "./FileIcon.js";
7
+ import { getAccept, setFile, useFile, useIsUploading } from "./store/index.js";
8
+ const File = (props)=>{
9
+ const resetRef = useRef(null);
10
+ const isLoading = useIsLoading();
11
+ const isUploading = useIsUploading();
12
+ const file = useFile();
13
+ return /*#__PURE__*/ jsx(FileButton, {
14
+ resetRef: resetRef,
15
+ onChange: async (file)=>{
16
+ if (file) setFile(file);
17
+ },
18
+ accept: getAccept(),
19
+ disabled: isLoading || isUploading,
20
+ ...props,
21
+ children: (props)=>/*#__PURE__*/ jsxs(ActionIcon.Group, {
22
+ children: [
23
+ /*#__PURE__*/ jsx(ActionIcon, {
24
+ size: "lg",
25
+ variant: "default",
26
+ disabled: isLoading,
27
+ loading: isUploading,
28
+ classNames: {
29
+ root: 'rolder-chat-input-file-action-action'
30
+ },
31
+ ...props,
32
+ children: /*#__PURE__*/ jsx(IconPaperclip, {
33
+ size: 24,
34
+ stroke: 1.5
35
+ })
36
+ }),
37
+ file && /*#__PURE__*/ jsxs(Fragment, {
38
+ children: [
39
+ /*#__PURE__*/ jsx(Tooltip, {
40
+ label: file.name,
41
+ openDelay: 500,
42
+ children: /*#__PURE__*/ jsx(ActionIcon.GroupSection, {
43
+ variant: "default",
44
+ size: "lg",
45
+ children: /*#__PURE__*/ jsx(FileIcon, {
46
+ mimeType: file.type
47
+ })
48
+ })
49
+ }),
50
+ /*#__PURE__*/ jsx(ActionIcon, {
51
+ size: "lg",
52
+ variant: "default",
53
+ classNames: {
54
+ root: 'rolder-chat-input-file-action-action'
55
+ },
56
+ onClick: ()=>{
57
+ resetRef.current?.();
58
+ setFile(void 0);
59
+ },
60
+ children: /*#__PURE__*/ jsx(IconTrash, {
61
+ size: 24,
62
+ stroke: 1.5
63
+ })
64
+ })
65
+ ]
66
+ })
67
+ ]
68
+ })
69
+ });
70
+ };
71
+ export { File };
@@ -0,0 +1,3 @@
1
+ export declare const FileIcon: ({ mimeType }: {
2
+ mimeType: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { IconFile, IconFileTypeDoc, IconFileTypePdf, IconFileTypePpt, IconFileTypeXls, IconPhoto } from "@tabler/icons-react";
3
+ const FileIcon = ({ mimeType })=>{
4
+ switch(true){
5
+ case mimeType.includes('image/'):
6
+ return /*#__PURE__*/ jsx(IconPhoto, {
7
+ size: 24,
8
+ stroke: 1.5,
9
+ color: "var(--mantine-color-dimmed)"
10
+ });
11
+ case mimeType.includes('application/pdf'):
12
+ return /*#__PURE__*/ jsx(IconFileTypePdf, {
13
+ size: 24,
14
+ stroke: 1.5,
15
+ color: "var(--mantine-color-dimmed)"
16
+ });
17
+ case mimeType.includes('application/vnd.openxmlformats-officedocument.wordprocessingml.document'):
18
+ return /*#__PURE__*/ jsx(IconFileTypeDoc, {
19
+ size: 24,
20
+ stroke: 1.5,
21
+ color: "var(--mantine-color-dimmed)"
22
+ });
23
+ case mimeType.includes('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'):
24
+ return /*#__PURE__*/ jsx(IconFileTypeXls, {
25
+ size: 24,
26
+ stroke: 1.5,
27
+ color: "var(--mantine-color-dimmed)"
28
+ });
29
+ case mimeType.includes('application/vnd.openxmlformats-officedocument.presentationml.presentation'):
30
+ return /*#__PURE__*/ jsx(IconFileTypePpt, {
31
+ size: 24,
32
+ stroke: 1.5,
33
+ color: "var(--mantine-color-dimmed)"
34
+ });
35
+ default:
36
+ return /*#__PURE__*/ jsx(IconFile, {
37
+ size: 24,
38
+ stroke: 1.5,
39
+ color: "var(--mantine-color-dimmed)"
40
+ });
41
+ }
42
+ };
43
+ export { FileIcon };
@@ -0,0 +1,2 @@
1
+ import { type GroupProps } from '@mantine/core';
2
+ export declare const Footer: (props: GroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Group } from "@mantine/core";
3
+ const Footer = (props)=>/*#__PURE__*/ jsx(Group, {
4
+ justify: "space-between",
5
+ p: "xs",
6
+ ...props
7
+ });
8
+ export { Footer };
@@ -0,0 +1,9 @@
1
+ import { type PaperProps } from '@mantine/core';
2
+ import { type Accept, type OnSubmitProps } from './store';
3
+ export interface ChatInputRootProps extends PaperProps {
4
+ children?: React.ReactNode;
5
+ onSubmit?: (props: OnSubmitProps) => void;
6
+ isUploading?: boolean;
7
+ accept?: Accept;
8
+ }
9
+ export declare const Root: ({ children, className, onSubmit, isUploading, accept, ...props }: ChatInputRootProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Paper } from "@mantine/core";
3
+ import clsx from "clsx";
4
+ import { useEffect } from "react";
5
+ import { setAccept, setIsUploading, setOnSubmit } from "./store/index.js";
6
+ const Root = ({ children, className, onSubmit, isUploading, accept, ...props })=>{
7
+ useEffect(()=>{
8
+ if (onSubmit) setOnSubmit(onSubmit);
9
+ setIsUploading(isUploading || false);
10
+ if (accept) setAccept(accept);
11
+ }, [
12
+ onSubmit,
13
+ isUploading,
14
+ accept
15
+ ]);
16
+ return /*#__PURE__*/ jsx(Paper, {
17
+ radius: "md",
18
+ withBorder: true,
19
+ className: clsx('rolder-chat-input-root', className),
20
+ ...props,
21
+ children: children
22
+ });
23
+ };
24
+ export { Root };
@@ -0,0 +1,2 @@
1
+ import { type ActionIconProps } from '@mantine/core';
2
+ export declare const Submit: ({ children, ...props }: ActionIconProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { ActionIcon } from "@mantine/core";
3
+ import { IconArrowBigUp } from "@tabler/icons-react";
4
+ import { useIsLoading } from "../store/index.js";
5
+ import { onSubmit, useIsUploading } from "./store/index.js";
6
+ const Submit = ({ children, ...props })=>{
7
+ const Icon = /*#__PURE__*/ jsx(IconArrowBigUp, {
8
+ strokeWidth: 1.5
9
+ });
10
+ const isLoading = useIsLoading();
11
+ const isUploading = useIsUploading();
12
+ return /*#__PURE__*/ jsx(ActionIcon, {
13
+ "aria-label": "Submit",
14
+ variant: "light",
15
+ size: "lg",
16
+ onClick: onSubmit,
17
+ disabled: isUploading,
18
+ loading: isLoading,
19
+ ...props,
20
+ children: children ?? Icon
21
+ });
22
+ };
23
+ export { Submit };
@@ -0,0 +1,2 @@
1
+ import { type TextareaProps } from '@mantine/core';
2
+ export declare const Textarea: (props: TextareaProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Textarea } from "@mantine/core";
3
+ import { useIsLoading } from "../store/index.js";
4
+ import { getIsComposing, onSubmit, setIsComposing, setText, useIsUploading, useText } from "./store/index.js";
5
+ const Textarea_Textarea = (props)=>{
6
+ const text = useText();
7
+ const isLoading = useIsLoading();
8
+ const isUploading = useIsUploading();
9
+ const handleKeyDown = (e)=>{
10
+ if ('Enter' === e.key) {
11
+ if (getIsComposing() || e.nativeEvent.isComposing) return;
12
+ if (e.shiftKey) return;
13
+ e.preventDefault();
14
+ onSubmit();
15
+ }
16
+ };
17
+ return /*#__PURE__*/ jsx(Textarea, {
18
+ w: "100%",
19
+ size: "md",
20
+ rows: 3,
21
+ classNames: {
22
+ input: 'rolder-chat-input-textarea'
23
+ },
24
+ placeholder: "Напишите сообщение",
25
+ onCompositionEnd: ()=>setIsComposing(false),
26
+ onCompositionStart: ()=>setIsComposing(true),
27
+ onKeyDown: handleKeyDown,
28
+ value: text,
29
+ onChange: (e)=>setText(e.target.value),
30
+ disabled: isLoading || isUploading,
31
+ ...props
32
+ });
33
+ };
34
+ export { Textarea_Textarea as Textarea };
@@ -0,0 +1,7 @@
1
+ export declare const ChatInput: {
2
+ Root: ({ children, className, onSubmit, isUploading, accept, ...props }: import("./Root").ChatInputRootProps) => import("react/jsx-runtime").JSX.Element;
3
+ Textarea: (props: import("@mantine/core").TextareaProps) => import("react/jsx-runtime").JSX.Element;
4
+ Footer: (props: import("@mantine/core").GroupProps) => import("react/jsx-runtime").JSX.Element;
5
+ Submit: ({ children, ...props }: import("@mantine/core").ActionIconProps) => import("react/jsx-runtime").JSX.Element;
6
+ File: (props: Omit<import("@mantine/core").FileButtonProps, "onChange" | "children">) => import("react/jsx-runtime").JSX.Element;
7
+ };
@@ -0,0 +1,13 @@
1
+ import { File } from "./File.js";
2
+ import { Footer } from "./Footer.js";
3
+ import { Root } from "./Root.js";
4
+ import { Submit } from "./Submit.js";
5
+ import { Textarea } from "./Textarea.js";
6
+ const ChatInput = {
7
+ Root: Root,
8
+ Textarea: Textarea,
9
+ Footer: Footer,
10
+ Submit: Submit,
11
+ File: File
12
+ };
13
+ export { ChatInput };
@@ -0,0 +1,8 @@
1
+ export declare const getFile: () => File | undefined;
2
+ export declare const useFile: () => File | undefined;
3
+ export declare const setFile: (file: File | undefined) => void;
4
+ export declare const useIsUploading: () => boolean;
5
+ export declare const setIsUploading: (isUploading: boolean) => void;
6
+ export type Accept = ('text' | 'image' | 'pdf' | 'word' | 'excel')[];
7
+ export declare const getAccept: () => string;
8
+ export declare const setAccept: (accept: Accept) => void;
@@ -0,0 +1,32 @@
1
+ import { useStore } from "@nanostores/react";
2
+ import { atom } from "nanostores";
3
+ const $file = atom();
4
+ const getFile = ()=>$file.get();
5
+ const useFile = ()=>useStore($file);
6
+ const setFile = (file)=>$file.set(file);
7
+ const $isUploading = atom(false);
8
+ const useIsUploading = ()=>useStore($isUploading);
9
+ const setIsUploading = (isUploading)=>$isUploading.set(isUploading);
10
+ const $accept = atom([
11
+ 'text',
12
+ 'image',
13
+ 'pdf'
14
+ ]);
15
+ const getAccept = ()=>$accept.get().map((type)=>{
16
+ switch(type){
17
+ case 'text':
18
+ return 'text/plain';
19
+ case 'image':
20
+ return 'image/*';
21
+ case 'pdf':
22
+ return 'application/pdf';
23
+ case 'excel':
24
+ return 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
25
+ case 'word':
26
+ return 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
27
+ default:
28
+ return type;
29
+ }
30
+ }).join(',');
31
+ const setAccept = (accept)=>$accept.set(accept);
32
+ export { getAccept, getFile, setAccept, setFile, setIsUploading, useFile, useIsUploading };
@@ -0,0 +1,2 @@
1
+ import type { ClientUploadError } from '@better-upload/client';
2
+ export declare const fileErrorNotificaton: (error: ClientUploadError) => void;
@@ -0,0 +1,21 @@
1
+ import { notifications } from "@mantine/notifications";
2
+ const serverErrorCodes = {
3
+ unknown: 'Неизвестная ошибка',
4
+ invalid_request: 'Неверный запрос',
5
+ aborted: 'Загрузка прервана',
6
+ rejected: 'Файл отклонен',
7
+ s3_upload: 'Ошибка при загрузке на S3',
8
+ no_files: 'Нет файлов для загрузки',
9
+ file_too_large: 'Один или несколько файлов слишком большие',
10
+ invalid_file_type: 'Один или несколько файлов неверного типа',
11
+ too_many_files: 'Слишком много файлов'
12
+ };
13
+ const fileErrorNotificaton = (error)=>{
14
+ notifications.show({
15
+ title: serverErrorCodes[error.type],
16
+ message: error.message,
17
+ color: 'red',
18
+ autoClose: 5000
19
+ });
20
+ };
21
+ export { fileErrorNotificaton };
@@ -0,0 +1,2 @@
1
+ export * from './file';
2
+ export * from './input';
@@ -0,0 +1,2 @@
1
+ export * from "./file.js";
2
+ export * from "./input.js";
@@ -0,0 +1,13 @@
1
+ import type { FileUIPart } from 'ai';
2
+ export declare const getText: () => string;
3
+ export declare const useText: () => string;
4
+ export declare const setText: (text: string) => void;
5
+ export declare const getIsComposing: () => boolean;
6
+ export declare const setIsComposing: (isComposing: boolean) => void;
7
+ export interface OnSubmitProps {
8
+ text: string;
9
+ file?: FileUIPart;
10
+ }
11
+ export declare const getOnSubmit: () => ((props: OnSubmitProps) => void) | undefined;
12
+ export declare const setOnSubmit: (onSubmit: (props: OnSubmitProps) => void) => void;
13
+ export declare const onSubmit: () => Promise<void>;