@rolder/kit 3.0.0-alpha.4 → 3.0.0-alpha.41

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 (134) hide show
  1. package/dist/ai/index.d.ts +2 -0
  2. package/dist/ai/index.js +2 -0
  3. package/dist/ai/ui/{conversation → chat}/Empty.js +5 -4
  4. package/dist/ai/ui/chat/File.d.ts +3 -0
  5. package/dist/ai/ui/{conversation → chat}/File.js +10 -8
  6. package/dist/ai/ui/chat/FileIcon.js +43 -0
  7. package/dist/ai/ui/{conversation → chat}/Loader.js +4 -3
  8. package/dist/ai/ui/chat/Message.d.ts +3 -0
  9. package/dist/ai/ui/chat/Message.js +28 -0
  10. package/dist/ai/ui/chat/Messages.d.ts +2 -0
  11. package/dist/ai/ui/chat/Messages.js +9 -0
  12. package/dist/ai/ui/chat/Root.d.ts +8 -0
  13. package/dist/ai/ui/chat/Root.js +22 -0
  14. package/dist/ai/ui/chat/chatInput/File.js +72 -0
  15. package/dist/ai/ui/chat/chatInput/FileIcon.js +43 -0
  16. package/dist/ai/ui/{promptInput → chat/chatInput}/Footer.js +4 -1
  17. package/dist/ai/ui/chat/chatInput/Root.d.ts +9 -0
  18. package/dist/ai/ui/chat/chatInput/Root.js +25 -0
  19. package/dist/ai/ui/chat/chatInput/Submit.js +24 -0
  20. package/dist/ai/ui/{promptInput → chat/chatInput}/Textarea.js +9 -7
  21. package/dist/ai/ui/{promptInput → chat/chatInput}/index.d.ts +2 -3
  22. package/dist/ai/ui/{promptInput → chat/chatInput}/index.js +2 -2
  23. package/dist/ai/ui/chat/chatInput/store/file.d.ts +8 -0
  24. package/dist/ai/ui/chat/chatInput/store/file.js +32 -0
  25. package/dist/ai/ui/chat/chatInput/store/fileErrorNotificaton.d.ts +2 -0
  26. package/dist/ai/ui/chat/chatInput/store/fileErrorNotificaton.js +21 -0
  27. package/dist/ai/ui/chat/chatInput/store/index.d.ts +2 -0
  28. package/dist/ai/ui/chat/chatInput/store/index.js +2 -0
  29. package/dist/ai/ui/chat/chatInput/store/input.d.ts +13 -0
  30. package/dist/ai/ui/chat/chatInput/store/input.js +85 -0
  31. package/dist/ai/ui/chat/chatInput/store/parseFile.d.ts +2 -0
  32. package/dist/ai/ui/chat/chatInput/store/parseFile.js +23 -0
  33. package/dist/ai/ui/chat/index.d.ts +14 -0
  34. package/dist/ai/ui/{conversation → chat}/index.js +6 -3
  35. package/dist/ai/ui/chat/store/index.d.ts +2 -0
  36. package/dist/ai/ui/chat/store/index.js +2 -0
  37. package/dist/ai/ui/chat/store/messages.d.ts +18 -0
  38. package/dist/ai/ui/chat/store/messages.js +89 -0
  39. package/dist/ai/ui/chat/store/states.d.ts +11 -0
  40. package/dist/ai/ui/chat/store/states.js +17 -0
  41. package/dist/ai/ui/index.d.ts +1 -0
  42. package/dist/ai/ui/index.js +1 -0
  43. package/dist/ai/utils/index.d.ts +2 -0
  44. package/dist/ai/utils/index.js +2 -0
  45. package/dist/app/AppDefaults.js +1 -1
  46. package/dist/app/DefaultApp.js +1 -1
  47. package/dist/app/cookieColorSchemeManager.js +1 -1
  48. package/dist/app/defaultTheme.d.ts +1 -1
  49. package/dist/app/index.d.ts +4 -0
  50. package/dist/app/index.js +4 -0
  51. package/dist/hooks/index.d.ts +2 -0
  52. package/dist/hooks/index.js +2 -0
  53. package/dist/index.d.ts +4 -16
  54. package/dist/index.js +4 -17
  55. package/dist/styles.css +3 -3
  56. package/dist/tanstackFunctions/cookie/index.d.ts +3 -0
  57. package/dist/tanstackFunctions/cookie/index.js +4 -0
  58. package/dist/tanstackFunctions/index.d.ts +2 -0
  59. package/dist/tanstackFunctions/index.js +2 -0
  60. package/dist/tanstackFunctions/s3/getS3Client.d.ts +2 -0
  61. package/dist/tanstackFunctions/s3/getS3Client.js +18 -0
  62. package/dist/tanstackFunctions/s3/getSignedFileUrlFn.d.ts +4 -0
  63. package/dist/tanstackFunctions/s3/getSignedFileUrlFn.js +21 -0
  64. package/dist/tanstackFunctions/s3/index.d.ts +2 -0
  65. package/dist/tanstackFunctions/s3/index.js +2 -0
  66. package/dist/tanstackFunctions/s3/uploadRequest.d.ts +3 -0
  67. package/dist/tanstackFunctions/s3/uploadRequest.js +21 -0
  68. package/dist/ui/AnimatedChevron.d.ts +2 -2
  69. package/dist/ui/AnimatedChevron.js +7 -25
  70. package/dist/ui/JsonInput.js +1 -1
  71. package/dist/ui/editor/Toolbar.js +4 -22
  72. package/dist/ui/error/index.d.ts +4 -4
  73. package/dist/ui/error/index.js +5 -4
  74. package/dist/ui/form/buttons/CancelButton.js +4 -26
  75. package/dist/ui/form/buttons/SubmitButton.js +4 -29
  76. package/dist/ui/form/fields/TextPassowrdField.js +4 -26
  77. package/dist/ui/form/index.d.ts +2 -2
  78. package/dist/ui/form/index.js +3 -3
  79. package/dist/ui/hoverPaper/index.d.ts +2 -2
  80. package/dist/ui/hoverPaper/index.js +3 -2
  81. package/dist/ui/scrollArea/ScrollArea.d.ts +1 -1
  82. package/dist/ui/scrollArea/ScrollAreaButton.d.ts +1 -1
  83. package/dist/ui/scrollArea/ScrollAreaButton.js +7 -28
  84. package/package.json +40 -28
  85. package/dist/ai/ui/conversation/ConversationContext.d.ts +0 -7
  86. package/dist/ai/ui/conversation/ConversationContext.js +0 -8
  87. package/dist/ai/ui/conversation/ConversationProvider.d.ts +0 -2
  88. package/dist/ai/ui/conversation/ConversationProvider.js +0 -14
  89. package/dist/ai/ui/conversation/File.d.ts +0 -4
  90. package/dist/ai/ui/conversation/FileIcon.js +0 -225
  91. package/dist/ai/ui/conversation/Message.d.ts +0 -4
  92. package/dist/ai/ui/conversation/Message.js +0 -25
  93. package/dist/ai/ui/conversation/Root.d.ts +0 -2
  94. package/dist/ai/ui/conversation/Root.js +0 -26
  95. package/dist/ai/ui/conversation/index.d.ts +0 -13
  96. package/dist/ai/ui/conversation/types.d.ts +0 -7
  97. package/dist/ai/ui/conversation/types.js +0 -0
  98. package/dist/ai/ui/conversation/useChatMessage.d.ts +0 -2
  99. package/dist/ai/ui/conversation/useChatMessage.js +0 -12
  100. package/dist/ai/ui/promptInput/File.js +0 -117
  101. package/dist/ai/ui/promptInput/FileIcon.js +0 -225
  102. package/dist/ai/ui/promptInput/PromptInputContext.d.ts +0 -12
  103. package/dist/ai/ui/promptInput/PromptInputContext.js +0 -8
  104. package/dist/ai/ui/promptInput/PromptInputProvider.d.ts +0 -2
  105. package/dist/ai/ui/promptInput/PromptInputProvider.js +0 -50
  106. package/dist/ai/ui/promptInput/Root.d.ts +0 -3
  107. package/dist/ai/ui/promptInput/Root.js +0 -17
  108. package/dist/ai/ui/promptInput/Submit.js +0 -40
  109. package/dist/ai/ui/promptInput/types.d.ts +0 -11
  110. package/dist/ai/ui/promptInput/types.js +0 -0
  111. package/dist/surreal/connection.d.ts +0 -9
  112. package/dist/surreal/connection.js +0 -49
  113. package/dist/surreal/deafaultCrud.d.ts +0 -2
  114. package/dist/surreal/deafaultCrud.js +0 -18
  115. package/dist/surreal/deserialize.d.ts +0 -17
  116. package/dist/surreal/deserialize.js +0 -46
  117. package/dist/surreal/encryption.d.ts +0 -6
  118. package/dist/surreal/encryption.js +0 -30
  119. package/dist/ui/editor/styles.module.js +0 -7
  120. package/dist/ui/editor/styles_module.css +0 -16
  121. /package/dist/ai/ui/{conversation → chat}/Empty.d.ts +0 -0
  122. /package/dist/ai/ui/{conversation → chat}/FileIcon.d.ts +0 -0
  123. /package/dist/ai/ui/{conversation → chat}/Loader.d.ts +0 -0
  124. /package/dist/ai/ui/{promptInput → chat/chatInput}/File.d.ts +0 -0
  125. /package/dist/ai/ui/{promptInput → chat/chatInput}/FileIcon.d.ts +0 -0
  126. /package/dist/ai/ui/{promptInput → chat/chatInput}/Footer.d.ts +0 -0
  127. /package/dist/ai/ui/{promptInput → chat/chatInput}/Submit.d.ts +0 -0
  128. /package/dist/ai/ui/{promptInput → chat/chatInput}/Textarea.d.ts +0 -0
  129. /package/dist/{functions → tanstackFunctions/cookie}/getCookie.d.ts +0 -0
  130. /package/dist/{functions → tanstackFunctions/cookie}/getCookie.js +0 -0
  131. /package/dist/{functions → tanstackFunctions/cookie}/setCookie.d.ts +0 -0
  132. /package/dist/{functions → tanstackFunctions/cookie}/setCookie.js +0 -0
  133. /package/dist/{functions → tanstackFunctions/cookie}/setCookies.d.ts +0 -0
  134. /package/dist/{functions → tanstackFunctions/cookie}/setCookies.js +0 -0
@@ -0,0 +1,2 @@
1
+ export declare const parseExcel: (file: File) => Promise<string>;
2
+ export declare const parseWord: (file: File) => Promise<string>;
@@ -0,0 +1,23 @@
1
+ import mammoth from "mammoth";
2
+ import { read, utils } from "xlsx";
3
+ const parseExcel = async (file)=>{
4
+ const buffer = await file.arrayBuffer();
5
+ const workbook = read(buffer, {
6
+ type: 'array',
7
+ cellDates: true
8
+ });
9
+ const sheetName = workbook.SheetNames[0];
10
+ const worksheet = workbook.Sheets[sheetName];
11
+ const jsonData = utils.sheet_to_json(worksheet, {
12
+ dateNF: 'yyyy-mm-dd'
13
+ });
14
+ return JSON.stringify(jsonData, null, 2);
15
+ };
16
+ const parseWord = async (file)=>{
17
+ const arrayBuffer = await file.arrayBuffer();
18
+ const { value } = await mammoth.convertToHtml({
19
+ arrayBuffer
20
+ });
21
+ return value;
22
+ };
23
+ export { parseExcel, parseWord };
@@ -0,0 +1,14 @@
1
+ export declare const Chat: {
2
+ Root: ({ children, scrollAreaProps, withScrollButton, ...props }: import("./Root").ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
3
+ Messages: ({ children, ...props }: import("@mantine/core").StackProps) => import("react/jsx-runtime").JSX.Element;
4
+ Message: import("react").MemoExoticComponent<({ messageId }: {
5
+ messageId: string;
6
+ }) => import("react/jsx-runtime").JSX.Element | null>;
7
+ File: ({ messageId }: {
8
+ messageId: string;
9
+ }) => import("react/jsx-runtime").JSX.Element | null;
10
+ Loader: (props: import("@mantine/core").LoaderProps) => import("react/jsx-runtime").JSX.Element | null;
11
+ Empty: () => import("react/jsx-runtime").JSX.Element | null;
12
+ };
13
+ export { ChatInput } from './chatInput';
14
+ export * from './store';
@@ -2,13 +2,16 @@ import { Empty } from "./Empty.js";
2
2
  import { File } from "./File.js";
3
3
  import { Loader } from "./Loader.js";
4
4
  import { Message } from "./Message.js";
5
+ import { Messages } from "./Messages.js";
5
6
  import { Root } from "./Root.js";
6
- import { useChatMessage } from "./useChatMessage.js";
7
- const Conversation = {
7
+ import { ChatInput } from "./chatInput/index.js";
8
+ export * from "./store/index.js";
9
+ const Chat = {
8
10
  Root: Root,
11
+ Messages: Messages,
9
12
  Message: Message,
10
13
  File: File,
11
14
  Loader: Loader,
12
15
  Empty: Empty
13
16
  };
14
- export { Conversation, useChatMessage };
17
+ export { Chat, ChatInput };
@@ -0,0 +1,2 @@
1
+ export * from './messages';
2
+ export * from './states';
@@ -0,0 +1,2 @@
1
+ export * from "./messages.js";
2
+ export * from "./states.js";
@@ -0,0 +1,18 @@
1
+ import { type UseChatOptions } from '@ai-sdk/react';
2
+ import type { ChatInit, FileUIPart, UIDataTypes, UIMessage, UIMessagePart, UITools } from 'ai';
3
+ export declare const $chatMessageIds: import("nanostores").PreinitializedWritableAtom<string[]> & object;
4
+ export declare const $chatMessages: import("nanostores").PreinitializedMapStore<Record<string, UIMessage<unknown, UIDataTypes, UITools>>> & object;
5
+ export declare const getChatMessage: (messageId: string) => UIMessage<unknown, UIDataTypes, UITools>;
6
+ export declare const addChatMessage: (newMessage: UIMessage) => void;
7
+ export declare const getChatMessages: <T extends UIMessage>() => T[];
8
+ export declare const setChatMessages: <T extends UIMessage>(messages: T[]) => void;
9
+ export declare const getIsEmpty: () => boolean;
10
+ export declare const useIsEmpty: () => boolean;
11
+ export declare const useChatMessageIds: <T extends UIMessage>(props?: UseChatOptions<T> & ChatInit<T>) => string[];
12
+ export declare const useChatMessage: <T extends UIMessage>(messageId: string) => T;
13
+ export declare const useChatMessagePart: <M extends UIMessage, T extends UIMessagePart<UIDataTypes, UITools>>(messageId: string, type?: T["type"]) => T | undefined;
14
+ export type SendMessage = ({ text, file }: {
15
+ text: string;
16
+ file?: FileUIPart;
17
+ }, data?: Record<string, unknown>) => Promise<void>;
18
+ export declare const sendMessage: SendMessage;
@@ -0,0 +1,89 @@
1
+ import { useChat } from "@ai-sdk/react";
2
+ import { notifications } from "@mantine/notifications";
3
+ import { useStore } from "@nanostores/react";
4
+ import { atom, computed, map } from "nanostores";
5
+ import { useEffect } from "react";
6
+ import { setChatError, setChatStatus } from "./states.js";
7
+ const $chatMessageIds = atom([]);
8
+ const $chatMessages = map({});
9
+ const getChatMessage = (messageId)=>$chatMessages.get()[messageId];
10
+ const addChatMessage = (newMessage)=>{
11
+ $chatMessageIds.set([
12
+ ...$chatMessageIds.get(),
13
+ newMessage.id
14
+ ]);
15
+ $chatMessages.set({
16
+ ...$chatMessages.get(),
17
+ [newMessage.id]: newMessage
18
+ });
19
+ };
20
+ const getChatMessages = ()=>$chatMessageIds.get().map((id)=>$chatMessages.get()[id]);
21
+ const setChatMessages = (messages)=>{
22
+ $chatMessageIds.set(messages.map((msg)=>msg.id));
23
+ const messagesMap = {};
24
+ for (const msg of messages)messagesMap[msg.id] = msg;
25
+ $chatMessages.set(messagesMap);
26
+ };
27
+ const $isEmpty = computed($chatMessageIds, (messages)=>0 === messages.length);
28
+ const getIsEmpty = ()=>$isEmpty.get();
29
+ const useIsEmpty = ()=>useStore($isEmpty);
30
+ const useChatMessageIds = (props)=>{
31
+ const { messages, status, error, sendMessage } = useChat({
32
+ onError: (e)=>{
33
+ notifications.show({
34
+ title: 'Ошибка сервера ИИ',
35
+ message: e.message,
36
+ color: 'red',
37
+ autoClose: false
38
+ });
39
+ },
40
+ ...props
41
+ });
42
+ useEffect(()=>{
43
+ setChatStatus(status);
44
+ }, [
45
+ status
46
+ ]);
47
+ useEffect(()=>{
48
+ setChatError(error?.message);
49
+ }, [
50
+ error?.message
51
+ ]);
52
+ useEffect(()=>{
53
+ setChatSendMessage(sendMessage);
54
+ }, [
55
+ sendMessage
56
+ ]);
57
+ useEffect(()=>{
58
+ setChatMessages(messages);
59
+ }, [
60
+ messages
61
+ ]);
62
+ return useStore($chatMessageIds);
63
+ };
64
+ const useChatMessage = (messageId)=>useStore($chatMessages, {
65
+ keys: [
66
+ messageId
67
+ ]
68
+ })[messageId];
69
+ const useChatMessagePart = (messageId, type)=>{
70
+ const message = useChatMessage(messageId);
71
+ console.log(messageId, message);
72
+ const part = message?.parts?.find((i)=>i.type === type);
73
+ return part;
74
+ };
75
+ const $chatSendMessage = atom();
76
+ const getChatSendMessage = ()=>$chatSendMessage.get();
77
+ const setChatSendMessage = (sendMessage)=>$chatSendMessage.set(sendMessage);
78
+ const messages_sendMessage = async ({ text, file }, data)=>{
79
+ const files = file ? [
80
+ file
81
+ ] : [];
82
+ await getChatSendMessage()?.({
83
+ text,
84
+ files
85
+ }, {
86
+ body: data
87
+ });
88
+ };
89
+ export { $chatMessageIds, $chatMessages, addChatMessage, getChatMessage, getChatMessages, getIsEmpty, messages_sendMessage as sendMessage, setChatMessages, useChatMessage, useChatMessageIds, useChatMessagePart, useIsEmpty };
@@ -0,0 +1,11 @@
1
+ import type { ChatStatus } from 'ai';
2
+ export declare const getChatStatus: () => ChatStatus;
3
+ export declare const setChatStatus: (status: ChatStatus) => void;
4
+ export declare const useChatStatus: () => ChatStatus;
5
+ export declare const getIsLoading: () => boolean;
6
+ export declare const useIsLoading: () => boolean;
7
+ export declare const getIsStreaming: () => boolean;
8
+ export declare const useIsStreaming: () => boolean;
9
+ export declare const getChatError: () => string | undefined;
10
+ export declare const setChatError: (error: string | undefined) => void;
11
+ export declare const useChatError: () => string | undefined;
@@ -0,0 +1,17 @@
1
+ import { useStore } from "@nanostores/react";
2
+ import { atom, computed } from "nanostores";
3
+ const $chatStatus = atom('ready');
4
+ const getChatStatus = ()=>$chatStatus.get();
5
+ const setChatStatus = (status)=>$chatStatus.set(status);
6
+ const useChatStatus = ()=>useStore($chatStatus);
7
+ const $isLoading = computed($chatStatus, (status)=>'ready' !== status);
8
+ const getIsLoading = ()=>$isLoading.get();
9
+ const useIsLoading = ()=>useStore($isLoading);
10
+ const $isStreaming = computed($chatStatus, (status)=>'streaming' === status);
11
+ const getIsStreaming = ()=>$isStreaming.get();
12
+ const useIsStreaming = ()=>useStore($isStreaming);
13
+ const $chatError = atom();
14
+ const getChatError = ()=>$chatError.get();
15
+ const setChatError = (error)=>$chatError.set(error);
16
+ const useChatError = ()=>useStore($chatError);
17
+ export { getChatError, getChatStatus, getIsLoading, getIsStreaming, setChatError, setChatStatus, useChatError, useChatStatus, useIsLoading, useIsStreaming };
@@ -0,0 +1 @@
1
+ export * from './chat';
@@ -0,0 +1 @@
1
+ export * from "./chat/index.js";
@@ -0,0 +1,2 @@
1
+ export * from './convertFileUIPartBlobToDataURL';
2
+ export * from './parseAiMessagePart';
@@ -0,0 +1,2 @@
1
+ export * from "./convertFileUIPartBlobToDataURL.js";
2
+ export * from "./parseAiMessagePart.js";
@@ -1,6 +1,6 @@
1
1
  import { useComputedColorScheme } from "@mantine/core";
2
2
  import { useEffect } from "react";
3
- import { setCookies } from "../functions/setCookies.js";
3
+ import { setCookies } from "../tanstackFunctions/index.js";
4
4
  const AppDefaults = ({ saveColorScheme })=>{
5
5
  const colorScheme = useComputedColorScheme();
6
6
  useEffect(()=>{
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { ColorSchemeScript, MantineProvider } from "@mantine/core";
3
3
  import { HeadContent, Scripts } from "@tanstack/react-router";
4
- import { getCookie } from "../functions/getCookie.js";
4
+ import { getCookie } from "../tanstackFunctions/index.js";
5
5
  import { AppDefaults } from "./AppDefaults.js";
6
6
  import { cookieColorSchemeManager } from "./cookieColorSchemeManager.js";
7
7
  import { defaultTheme } from "./defaultTheme.js";
@@ -1,6 +1,6 @@
1
1
  import { isMantineColorScheme } from "@mantine/core";
2
2
  import { atom } from "nanostores";
3
- import { setCookie } from "../functions/setCookie.js";
3
+ import { setCookie } from "../tanstackFunctions/index.js";
4
4
  const $colorScheme = atom();
5
5
  let unsubscribeSystemTheme;
6
6
  const cookieColorSchemeManager = ({ key = 'colorScheme' } = {})=>({
@@ -6,9 +6,9 @@ export declare const defaultTheme: {
6
6
  black?: string | undefined;
7
7
  colors?: {
8
8
  [x: string & {}]: import("@mantine/core").MantineColorsTuple | undefined;
9
+ red?: import("@mantine/core").MantineColorsTuple | undefined;
9
10
  dark?: import("@mantine/core").MantineColorsTuple | undefined;
10
11
  gray?: import("@mantine/core").MantineColorsTuple | undefined;
11
- red?: import("@mantine/core").MantineColorsTuple | undefined;
12
12
  pink?: import("@mantine/core").MantineColorsTuple | undefined;
13
13
  grape?: import("@mantine/core").MantineColorsTuple | undefined;
14
14
  violet?: import("@mantine/core").MantineColorsTuple | undefined;
@@ -0,0 +1,4 @@
1
+ export * from './AppDefaults';
2
+ export * from './DefaultApp';
3
+ export * from './defaultRequestMiddlewares';
4
+ export * from './defaultTheme';
@@ -0,0 +1,4 @@
1
+ export * from "./AppDefaults.js";
2
+ export * from "./DefaultApp.js";
3
+ export * from "./defaultRequestMiddlewares.js";
4
+ export * from "./defaultTheme.js";
@@ -0,0 +1,2 @@
1
+ export * from './useMutation';
2
+ export * from './useMutationWithInvalidate';
@@ -0,0 +1,2 @@
1
+ export * from "./useMutation.js";
2
+ export * from "./useMutationWithInvalidate.js";
package/dist/index.d.ts CHANGED
@@ -1,17 +1,5 @@
1
- export { Conversation, type ConversationProps, useChatMessage, } from './ai/ui/conversation';
2
- export { type Accept, PromptInput, type PromptInputProps, } from './ai/ui/promptInput';
3
- export { convertFileUIPartBlobToDataURL } from './ai/utils/convertFileUIPartBlobToDataURL';
4
- export { parseAiMessagePart } from './ai/utils/parseAiMessagePart';
5
- export { DefaultApp } from './app/DefaultApp';
6
- export { defaultRequestMiddlewares } from './app/defaultRequestMiddlewares';
7
- export { defaultTheme } from './app/defaultTheme';
8
- export { getCookie } from './functions/getCookie';
9
- export { setCookie } from './functions/setCookie';
10
- export { setCookies } from './functions/setCookies';
11
- export { useMutation } from './hooks/useMutation';
12
- export { useMutationWithInvalidate } from './hooks/useMutationWithInvalidate';
13
- export { getDB } from './surreal/connection';
14
- export { surrealDeleteFn, surrealUnsubscribeFn } from './surreal/deafaultCrud';
15
- export { deserialize } from './surreal/deserialize';
16
- export { encryptionFn } from './surreal/encryption';
1
+ export * from './ai';
2
+ export * from './app';
3
+ export * from './hooks';
4
+ export * from './tanstackFunctions';
17
5
  export * from './ui';
package/dist/index.js CHANGED
@@ -1,18 +1,5 @@
1
- import { Conversation, useChatMessage } from "./ai/ui/conversation/index.js";
2
- import { PromptInput } from "./ai/ui/promptInput/index.js";
3
- import { convertFileUIPartBlobToDataURL } from "./ai/utils/convertFileUIPartBlobToDataURL.js";
4
- import { parseAiMessagePart } from "./ai/utils/parseAiMessagePart.js";
5
- import { DefaultApp } from "./app/DefaultApp.js";
6
- import { defaultRequestMiddlewares } from "./app/defaultRequestMiddlewares.js";
7
- import { defaultTheme } from "./app/defaultTheme.js";
8
- import { getCookie } from "./functions/getCookie.js";
9
- import { setCookie } from "./functions/setCookie.js";
10
- import { setCookies } from "./functions/setCookies.js";
11
- import { useMutation } from "./hooks/useMutation.js";
12
- import { useMutationWithInvalidate } from "./hooks/useMutationWithInvalidate.js";
13
- import { getDB } from "./surreal/connection.js";
14
- import { surrealDeleteFn, surrealUnsubscribeFn } from "./surreal/deafaultCrud.js";
15
- import { deserialize } from "./surreal/deserialize.js";
16
- import { encryptionFn } from "./surreal/encryption.js";
1
+ export * from "./ai/index.js";
2
+ export * from "./app/index.js";
3
+ export * from "./hooks/index.js";
4
+ export * from "./tanstackFunctions/index.js";
17
5
  export * from "./ui/index.js";
18
- export { Conversation, DefaultApp, PromptInput, convertFileUIPartBlobToDataURL, defaultRequestMiddlewares, defaultTheme, deserialize, encryptionFn, getCookie, getDB, parseAiMessagePart, setCookie, setCookies, surrealDeleteFn, surrealUnsubscribeFn, useChatMessage, useMutation, useMutationWithInvalidate };
package/dist/styles.css CHANGED
@@ -1,4 +1,4 @@
1
- .rolder-prompt-input-root {
1
+ .rolder-chat-input-root {
2
2
  background-color: light-dark(var(--mantine-color-white), var(--mantine-color-dark-6));
3
3
 
4
4
  &:focus-within {
@@ -8,13 +8,13 @@
8
8
  }
9
9
  }
10
10
 
11
- .rolder-prompt-input-textarea {
11
+ .rolder-chat-input-textarea {
12
12
  border: 0;
13
13
  border-radius: 8px;
14
14
  overflow: hidden;
15
15
  }
16
16
 
17
- .rolder-prompt-input-file-action-action {
17
+ .rolder-chat-input-file-action-action {
18
18
  color: light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-1));
19
19
 
20
20
  &[data-disabled] {
@@ -0,0 +1,3 @@
1
+ export { getCookie } from './getCookie';
2
+ export { setCookie } from './setCookie';
3
+ export { setCookies } from './setCookies';
@@ -0,0 +1,4 @@
1
+ import { getCookie } from "./getCookie.js";
2
+ import { setCookie } from "./setCookie.js";
3
+ import { setCookies } from "./setCookies.js";
4
+ export { getCookie, setCookie, setCookies };
@@ -0,0 +1,2 @@
1
+ export * from './cookie';
2
+ export * from './s3';
@@ -0,0 +1,2 @@
1
+ export * from "./cookie/index.js";
2
+ export * from "./s3/index.js";
@@ -0,0 +1,2 @@
1
+ import { custom } from '@better-upload/server/clients';
2
+ export declare const getS3Client: () => ReturnType<typeof custom>;
@@ -0,0 +1,18 @@
1
+ import { custom } from "@better-upload/server/clients";
2
+ const getS3Client = ()=>{
3
+ const host = process.env.S3_HOST;
4
+ if (!host) throw new Error('S3_HOST environment variable is not set');
5
+ const region = process.env.S3_REGION;
6
+ if (!region) throw new Error('S3_REGION environment variable is not set');
7
+ const accessKeyId = process.env.S3_ACCESS_KEY_ID;
8
+ if (!accessKeyId) throw new Error('S3_ACCESS_KEY_ID environment variable is not set');
9
+ const accessKeySecret = process.env.S3_ACCESS_KEY_SECRET;
10
+ if (!accessKeySecret) throw new Error('S3_ACCESS_KEY_SECRET environment variable is not set');
11
+ return custom({
12
+ host,
13
+ region,
14
+ accessKeyId,
15
+ secretAccessKey: accessKeySecret
16
+ });
17
+ };
18
+ export { getS3Client };
@@ -0,0 +1,4 @@
1
+ import z from 'zod/v4';
2
+ export declare const getSignedFileUrlFn: import("@tanstack/start-client-core").RequiredFetcher<undefined, z.ZodObject<{
3
+ s3Key: z.ZodString;
4
+ }, z.core.$strip>, Promise<string>>;
@@ -0,0 +1,21 @@
1
+ import { presignGetObject } from "@better-upload/server/helpers";
2
+ import { createServerFn } from "@tanstack/react-start";
3
+ import v4 from "zod/v4";
4
+ import { getS3Client } from "./getS3Client.js";
5
+ const Schema = v4.object({
6
+ s3Key: v4.string()
7
+ });
8
+ const getSignedFileUrlFn = createServerFn({
9
+ method: 'POST'
10
+ }).inputValidator(Schema).handler(async ({ data: { s3Key } })=>{
11
+ const bucket = process.env.S3_BUCKET_NAME;
12
+ if (!bucket) throw new Error('S3_BUCKET_NAME environment variable is not set');
13
+ const s3 = getS3Client();
14
+ const url = await presignGetObject(s3, {
15
+ bucket,
16
+ key: s3Key,
17
+ expiresIn: 300
18
+ });
19
+ return url;
20
+ });
21
+ export { getSignedFileUrlFn };
@@ -0,0 +1,2 @@
1
+ export * from './getSignedFileUrlFn';
2
+ export * from './uploadRequest';
@@ -0,0 +1,2 @@
1
+ export * from "./getSignedFileUrlFn.js";
2
+ export * from "./uploadRequest.js";
@@ -0,0 +1,3 @@
1
+ export declare const uploadRequest: ({ request }: {
2
+ request: Request;
3
+ }) => Promise<Response>;
@@ -0,0 +1,21 @@
1
+ import { handleRequest, route } from "@better-upload/server";
2
+ import { createServerOnlyFn } from "@tanstack/react-start";
3
+ import { getS3Client } from "./getS3Client.js";
4
+ const getRouter = createServerOnlyFn(()=>{
5
+ const bucket = process.env.BUCKET_NAME;
6
+ if (!bucket) throw new Error('BUCKET_NAME environment variable is not set');
7
+ const s3 = getS3Client();
8
+ const router = {
9
+ client: s3,
10
+ bucketName: bucket,
11
+ routes: {
12
+ upload: route({
13
+ multipleFiles: false,
14
+ maxFileSize: 52428800
15
+ })
16
+ }
17
+ };
18
+ return router;
19
+ });
20
+ const uploadRequest = async ({ request })=>handleRequest(request, getRouter());
21
+ export { uploadRequest };
@@ -1,5 +1,5 @@
1
- import type { SVGProps } from 'react';
2
- interface Props extends SVGProps<SVGSVGElement> {
1
+ import { type IconProps } from '@tabler/icons-react';
2
+ interface Props extends IconProps {
3
3
  expanded?: boolean;
4
4
  }
5
5
  export declare const AnimatedChevron: ({ expanded, style, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
@@ -1,31 +1,13 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- const AnimatedChevron = ({ expanded, style, ...props })=>/*#__PURE__*/ jsxs("svg", {
3
- xmlns: "http://www.w3.org/2000/svg",
4
- width: "24",
5
- height: "24",
6
- viewBox: "0 0 24 24",
7
- fill: "none",
8
- stroke: "currentColor",
9
- strokeWidth: "1.5",
10
- strokeLinecap: "round",
11
- strokeLinejoin: "round",
12
- role: "img",
13
- "aria-label": "Chevron",
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { IconChevronDown } from "@tabler/icons-react";
3
+ const AnimatedChevron = ({ expanded, style, ...props })=>/*#__PURE__*/ jsx(IconChevronDown, {
4
+ strokeWidth: 1.5,
5
+ "data-expanded": expanded,
14
6
  style: {
15
7
  transition: 'transform 0.2s ease-in-out',
16
- transform: expanded ? 'rotate(-180deg)' : 'rotate(0deg)',
8
+ transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)',
17
9
  ...style
18
10
  },
19
- ...props,
20
- children: [
21
- /*#__PURE__*/ jsx("path", {
22
- stroke: "none",
23
- d: "M0 0h24v24H0z",
24
- fill: "none"
25
- }),
26
- /*#__PURE__*/ jsx("path", {
27
- d: "M6 9l6 6l6 -6"
28
- })
29
- ]
11
+ ...props
30
12
  });
31
13
  export { AnimatedChevron };
@@ -5,7 +5,7 @@ import { linter } from "@codemirror/lint";
5
5
  import { keymap } from "@codemirror/view";
6
6
  import { vscodeDark, vscodeLight } from "@uiw/codemirror-theme-vscode";
7
7
  import react_codemirror from "@uiw/react-codemirror";
8
- import { getCookie } from "../functions/getCookie.js";
8
+ import { getCookie } from "../tanstackFunctions/index.js";
9
9
  const formatJson = (view)=>{
10
10
  try {
11
11
  const text = view.state.doc.toString();
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Loader } from "@mantine/core";
3
3
  import { RichTextEditor } from "@mantine/tiptap";
4
+ import { IconCheck } from "@tabler/icons-react";
4
5
  import { useEditor } from "./Provider.js";
5
6
  const Toolbar = ({ saving, children })=>{
6
7
  const { editor, disabledToolbar } = useEditor();
@@ -124,28 +125,9 @@ const Toolbar = ({ saving, children })=>{
124
125
  },
125
126
  children: saving ? /*#__PURE__*/ jsx(Loader, {
126
127
  size: 14
127
- }) : /*#__PURE__*/ jsxs("svg", {
128
- xmlns: "http://www.w3.org/2000/svg",
129
- width: "16",
130
- height: "16",
131
- viewBox: "0 0 16 16",
132
- fill: "none",
133
- stroke: "currentColor",
134
- strokeWidth: "1.5",
135
- strokeLinecap: "round",
136
- strokeLinejoin: "round",
137
- role: "img",
138
- "aria-label": "Saved",
139
- children: [
140
- /*#__PURE__*/ jsx("path", {
141
- stroke: "none",
142
- d: "M0 0h24v24H0z",
143
- fill: "none"
144
- }),
145
- /*#__PURE__*/ jsx("path", {
146
- d: "M5 12l5 5l10 -10"
147
- })
148
- ]
128
+ }) : /*#__PURE__*/ jsx(IconCheck, {
129
+ stroke: 1.5,
130
+ size: 16
149
131
  })
150
132
  })
151
133
  ]
@@ -1,4 +1,4 @@
1
- export * from './DefaultError';
2
- export * from './DefaultNotFound';
3
- export * from './defaultErrorNotification';
4
- export * from './Forbidden';
1
+ export { DefaultError } from './DefaultError';
2
+ export { DefaultNotFound } from './DefaultNotFound';
3
+ export { defaultErrorNotification } from './defaultErrorNotification';
4
+ export { Forbidden } from './Forbidden';
@@ -1,4 +1,5 @@
1
- export * from "./DefaultError.js";
2
- export * from "./DefaultNotFound.js";
3
- export * from "./defaultErrorNotification.js";
4
- export * from "./Forbidden.js";
1
+ import { DefaultError } from "./DefaultError.js";
2
+ import { DefaultNotFound } from "./DefaultNotFound.js";
3
+ import { defaultErrorNotification } from "./defaultErrorNotification.js";
4
+ import { Forbidden } from "./Forbidden.js";
5
+ export { DefaultError, DefaultNotFound, Forbidden, defaultErrorNotification };
@@ -1,5 +1,6 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { Button } from "@mantine/core";
3
+ import { IconCancel } from "@tabler/icons-react";
3
4
  import { useFormContext } from "../context.js";
4
5
  const CancelButton = (props)=>{
5
6
  const form = useFormContext();
@@ -9,31 +10,8 @@ const CancelButton = (props)=>{
9
10
  type: "reset",
10
11
  size: "xs",
11
12
  variant: "light",
12
- leftSection: /*#__PURE__*/ jsxs("svg", {
13
- xmlns: "http://www.w3.org/2000/svg",
14
- width: "16",
15
- height: "16",
16
- viewBox: "0 0 16 16",
17
- fill: "none",
18
- stroke: "currentColor",
19
- strokeWidth: "2",
20
- strokeLinecap: "round",
21
- strokeLinejoin: "round",
22
- role: "img",
23
- "aria-label": "Cancel",
24
- children: [
25
- /*#__PURE__*/ jsx("path", {
26
- stroke: "none",
27
- d: "M0 0h24v24H0z",
28
- fill: "none"
29
- }),
30
- /*#__PURE__*/ jsx("path", {
31
- d: "M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"
32
- }),
33
- /*#__PURE__*/ jsx("path", {
34
- d: "M18.364 5.636l-12.728 12.728"
35
- })
36
- ]
13
+ leftSection: /*#__PURE__*/ jsx(IconCancel, {
14
+ size: 16
37
15
  }),
38
16
  disabled: isSubmitting,
39
17
  ...props,