@rolder/kit 3.0.0-alpha.6 → 3.0.0-alpha.61

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 +4 -4
  4. package/dist/ai/ui/chat/File.d.ts +3 -0
  5. package/dist/ai/ui/{conversation → chat}/File.js +9 -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 +27 -0
  10. package/dist/ai/ui/chat/Messages.d.ts +7 -0
  11. package/dist/ai/ui/chat/Messages.js +11 -0
  12. package/dist/ai/ui/chat/Root.d.ts +11 -0
  13. package/dist/ai/ui/chat/Root.js +31 -0
  14. package/dist/ai/ui/chat/chatInput/File.js +71 -0
  15. package/dist/ai/ui/chat/chatInput/FileIcon.js +43 -0
  16. package/dist/ai/ui/chat/chatInput/Root.d.ts +9 -0
  17. package/dist/ai/ui/chat/chatInput/Root.js +24 -0
  18. package/dist/ai/ui/chat/chatInput/Submit.js +23 -0
  19. package/dist/ai/ui/{promptInput → chat/chatInput}/Textarea.js +8 -7
  20. package/dist/ai/ui/{promptInput → chat/chatInput}/index.d.ts +2 -3
  21. package/dist/ai/ui/{promptInput → chat/chatInput}/index.js +2 -2
  22. package/dist/ai/ui/chat/chatInput/store/file.d.ts +8 -0
  23. package/dist/ai/ui/chat/chatInput/store/file.js +32 -0
  24. package/dist/ai/ui/chat/chatInput/store/fileErrorNotificaton.d.ts +2 -0
  25. package/dist/ai/ui/chat/chatInput/store/fileErrorNotificaton.js +21 -0
  26. package/dist/ai/ui/chat/chatInput/store/index.d.ts +2 -0
  27. package/dist/ai/ui/chat/chatInput/store/index.js +2 -0
  28. package/dist/ai/ui/chat/chatInput/store/input.d.ts +13 -0
  29. package/dist/ai/ui/chat/chatInput/store/input.js +81 -0
  30. package/dist/ai/ui/chat/chatInput/store/parseFile.d.ts +2 -0
  31. package/dist/ai/ui/chat/chatInput/store/parseFile.js +23 -0
  32. package/dist/ai/ui/chat/index.d.ts +16 -0
  33. package/dist/ai/ui/{conversation → chat}/index.js +6 -3
  34. package/dist/ai/ui/chat/store/index.d.ts +5 -0
  35. package/dist/ai/ui/chat/store/index.js +5 -0
  36. package/dist/ai/ui/chat/store/messageIds.d.ts +8 -0
  37. package/dist/ai/ui/chat/store/messageIds.js +41 -0
  38. package/dist/ai/ui/chat/store/messagesMap.d.ts +5 -0
  39. package/dist/ai/ui/chat/store/messagesMap.js +15 -0
  40. package/dist/ai/ui/chat/store/send.d.ts +14 -0
  41. package/dist/ai/ui/chat/store/send.js +16 -0
  42. package/dist/ai/ui/chat/store/states.d.ts +11 -0
  43. package/dist/ai/ui/chat/store/states.js +17 -0
  44. package/dist/ai/ui/chat/store/useInitChat.d.ts +3 -0
  45. package/dist/ai/ui/chat/store/useInitChat.js +40 -0
  46. package/dist/ai/ui/index.d.ts +1 -0
  47. package/dist/ai/ui/index.js +1 -0
  48. package/dist/ai/utils/index.d.ts +2 -0
  49. package/dist/ai/utils/index.js +2 -0
  50. package/dist/app/AppDefaults.js +1 -1
  51. package/dist/app/DefaultApp.js +1 -1
  52. package/dist/app/cookieColorSchemeManager.js +1 -1
  53. package/dist/app/defaultTheme.d.ts +1 -1
  54. package/dist/app/index.d.ts +4 -0
  55. package/dist/app/index.js +4 -0
  56. package/dist/hooks/index.d.ts +2 -0
  57. package/dist/hooks/index.js +2 -0
  58. package/dist/index.d.ts +5 -26
  59. package/dist/index.js +5 -26
  60. package/dist/styles.css +3 -3
  61. package/dist/tanstackFunctions/cookie/index.d.ts +3 -0
  62. package/dist/tanstackFunctions/cookie/index.js +4 -0
  63. package/dist/tanstackFunctions/index.d.ts +2 -0
  64. package/dist/tanstackFunctions/index.js +2 -0
  65. package/dist/tanstackFunctions/s3/getS3Client.d.ts +2 -0
  66. package/dist/tanstackFunctions/s3/getS3Client.js +18 -0
  67. package/dist/tanstackFunctions/s3/getSignedFileUrlFn.d.ts +4 -0
  68. package/dist/tanstackFunctions/s3/getSignedFileUrlFn.js +21 -0
  69. package/dist/tanstackFunctions/s3/index.d.ts +2 -0
  70. package/dist/tanstackFunctions/s3/index.js +2 -0
  71. package/dist/tanstackFunctions/s3/uploadRequest.d.ts +3 -0
  72. package/dist/tanstackFunctions/s3/uploadRequest.js +21 -0
  73. package/dist/ui/AnimatedChevron.d.ts +2 -2
  74. package/dist/ui/AnimatedChevron.js +7 -25
  75. package/dist/ui/JsonInput.js +1 -1
  76. package/dist/ui/editor/Toolbar.js +4 -22
  77. package/dist/ui/form/buttons/CancelButton.js +4 -26
  78. package/dist/ui/form/buttons/SubmitButton.js +4 -29
  79. package/dist/ui/form/fields/TextPassowrdField.js +4 -26
  80. package/dist/ui/index.d.ts +9 -0
  81. package/dist/ui/index.js +9 -0
  82. package/dist/ui/scrollArea/ScrollArea.d.ts +1 -1
  83. package/dist/ui/scrollArea/ScrollAreaButton.d.ts +1 -1
  84. package/dist/ui/scrollArea/ScrollAreaButton.js +7 -28
  85. package/package.json +38 -26
  86. package/dist/ai/ui/conversation/ConversationContext.d.ts +0 -7
  87. package/dist/ai/ui/conversation/ConversationContext.js +0 -8
  88. package/dist/ai/ui/conversation/ConversationProvider.d.ts +0 -2
  89. package/dist/ai/ui/conversation/ConversationProvider.js +0 -14
  90. package/dist/ai/ui/conversation/File.d.ts +0 -4
  91. package/dist/ai/ui/conversation/FileIcon.js +0 -225
  92. package/dist/ai/ui/conversation/Message.d.ts +0 -4
  93. package/dist/ai/ui/conversation/Message.js +0 -25
  94. package/dist/ai/ui/conversation/Root.d.ts +0 -2
  95. package/dist/ai/ui/conversation/Root.js +0 -26
  96. package/dist/ai/ui/conversation/index.d.ts +0 -13
  97. package/dist/ai/ui/conversation/types.d.ts +0 -7
  98. package/dist/ai/ui/conversation/types.js +0 -0
  99. package/dist/ai/ui/conversation/useChatMessage.d.ts +0 -2
  100. package/dist/ai/ui/conversation/useChatMessage.js +0 -12
  101. package/dist/ai/ui/promptInput/File.js +0 -117
  102. package/dist/ai/ui/promptInput/FileIcon.js +0 -225
  103. package/dist/ai/ui/promptInput/PromptInputContext.d.ts +0 -12
  104. package/dist/ai/ui/promptInput/PromptInputContext.js +0 -8
  105. package/dist/ai/ui/promptInput/PromptInputProvider.d.ts +0 -2
  106. package/dist/ai/ui/promptInput/PromptInputProvider.js +0 -50
  107. package/dist/ai/ui/promptInput/Root.d.ts +0 -3
  108. package/dist/ai/ui/promptInput/Root.js +0 -17
  109. package/dist/ai/ui/promptInput/Submit.js +0 -40
  110. package/dist/ai/ui/promptInput/types.d.ts +0 -11
  111. package/dist/ai/ui/promptInput/types.js +0 -0
  112. package/dist/surreal/connection.d.ts +0 -9
  113. package/dist/surreal/connection.js +0 -49
  114. package/dist/surreal/deafaultCrud.d.ts +0 -2
  115. package/dist/surreal/deafaultCrud.js +0 -18
  116. package/dist/surreal/deserialize.d.ts +0 -17
  117. package/dist/surreal/deserialize.js +0 -46
  118. package/dist/surreal/encryption.d.ts +0 -6
  119. package/dist/surreal/encryption.js +0 -30
  120. /package/dist/ai/ui/{conversation → chat}/Empty.d.ts +0 -0
  121. /package/dist/ai/ui/{conversation → chat}/FileIcon.d.ts +0 -0
  122. /package/dist/ai/ui/{conversation → chat}/Loader.d.ts +0 -0
  123. /package/dist/ai/ui/{promptInput → chat/chatInput}/File.d.ts +0 -0
  124. /package/dist/ai/ui/{promptInput → chat/chatInput}/FileIcon.d.ts +0 -0
  125. /package/dist/ai/ui/{promptInput → chat/chatInput}/Footer.d.ts +0 -0
  126. /package/dist/ai/ui/{promptInput → chat/chatInput}/Footer.js +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,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,16 @@
1
+ export declare const Chat: {
2
+ Root: ({ children, scrollAreaProps, withScrollButton, chatOptions, ...props }: import("./Root").ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
3
+ Messages: ({ children, ...props }: Omit<import("@mantine/core").StackProps, "children"> & {
4
+ children: (messageId: string) => import("react").ReactNode;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ Message: import("react").MemoExoticComponent<({ messageId }: {
7
+ messageId: string;
8
+ }) => import("react/jsx-runtime").JSX.Element>;
9
+ File: ({ messageId }: {
10
+ messageId: string;
11
+ }) => import("react/jsx-runtime").JSX.Element | null;
12
+ Loader: (props: import("@mantine/core").LoaderProps) => import("react/jsx-runtime").JSX.Element | null;
13
+ Empty: () => import("react/jsx-runtime").JSX.Element | null;
14
+ };
15
+ export { ChatInput } from './chatInput';
16
+ 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,5 @@
1
+ export * from './messageIds';
2
+ export * from './messagesMap';
3
+ export * from './send';
4
+ export * from './states';
5
+ export * from './useInitChat';
@@ -0,0 +1,5 @@
1
+ export * from "./messageIds.js";
2
+ export * from "./messagesMap.js";
3
+ export * from "./send.js";
4
+ export * from "./states.js";
5
+ export * from "./useInitChat.js";
@@ -0,0 +1,8 @@
1
+ import type { UIMessage } from 'ai';
2
+ export declare const $chatMessageIds: import("nanostores").PreinitializedWritableAtom<string[]> & object;
3
+ export declare const getChatMessages: <T extends UIMessage>() => T[];
4
+ export declare const useChatMessageIds: () => string[];
5
+ export declare const addChatMessage: (newMessage: UIMessage) => void;
6
+ export declare const setChatMessages: <T extends UIMessage>(messages: T[]) => void;
7
+ export declare const getIsEmpty: () => boolean;
8
+ export declare const useIsEmpty: () => boolean;
@@ -0,0 +1,41 @@
1
+ import { useStore } from "@nanostores/react";
2
+ import { atom, computed, onSet } from "nanostores";
3
+ import { $chatMessages } from "./messagesMap.js";
4
+ const $chatMessageIds = atom([]);
5
+ const getChatMessages = ()=>$chatMessageIds.get().map((id)=>$chatMessages.get()[id]);
6
+ const useChatMessageIds = ()=>useStore($chatMessageIds);
7
+ onSet($chatMessageIds, ({ newValue, abort })=>{
8
+ const currentValue = $chatMessageIds.get();
9
+ if (currentValue.length === newValue.length && currentValue.every((id, index)=>id === newValue[index])) abort();
10
+ });
11
+ const addChatMessage = (newMessage)=>{
12
+ $chatMessageIds.set([
13
+ ...$chatMessageIds.get(),
14
+ newMessage.id
15
+ ]);
16
+ $chatMessages.set({
17
+ ...$chatMessages.get(),
18
+ [newMessage.id]: newMessage
19
+ });
20
+ };
21
+ const setChatMessages = (messages)=>{
22
+ const newIds = messages.map((msg)=>msg.id);
23
+ $chatMessageIds.set(newIds);
24
+ const currentMessages = $chatMessages.get();
25
+ const lastMessage = messages[messages.length - 1];
26
+ for(let i = 0; i < messages.length; i++){
27
+ const msg = messages[i];
28
+ const currentMsg = currentMessages[msg.id];
29
+ const isLastMessage = msg === lastMessage;
30
+ if (currentMsg) if (isLastMessage) $chatMessages.setKey(msg.id, msg);
31
+ else {
32
+ const isChanged = JSON.stringify(currentMsg) !== JSON.stringify(msg);
33
+ if (isChanged) $chatMessages.setKey(msg.id, msg);
34
+ }
35
+ else $chatMessages.setKey(msg.id, msg);
36
+ }
37
+ };
38
+ const $isEmpty = computed($chatMessageIds, (messages)=>0 === messages.length);
39
+ const getIsEmpty = ()=>$isEmpty.get();
40
+ const useIsEmpty = ()=>useStore($isEmpty);
41
+ export { $chatMessageIds, addChatMessage, getChatMessages, getIsEmpty, setChatMessages, useChatMessageIds, useIsEmpty };
@@ -0,0 +1,5 @@
1
+ import type { UIDataTypes, UIMessage, UIMessagePart, UITools } from 'ai';
2
+ export declare const $chatMessages: import("nanostores").PreinitializedMapStore<Record<string, UIMessage<unknown, UIDataTypes, UITools>>> & object;
3
+ export declare const getChatMessage: (messageId: string) => UIMessage<unknown, UIDataTypes, UITools>;
4
+ export declare const useChatMessage: <T extends UIMessage>(messageId: string) => T;
5
+ export declare const useChatMessagePart: <M extends UIMessage, T extends UIMessagePart<UIDataTypes, UITools>>(messageId: string, type?: T["type"]) => T | undefined;
@@ -0,0 +1,15 @@
1
+ import { useStore } from "@nanostores/react";
2
+ import { map } from "nanostores";
3
+ const $chatMessages = map({});
4
+ const getChatMessage = (messageId)=>$chatMessages.get()[messageId];
5
+ const useChatMessage = (messageId)=>useStore($chatMessages, {
6
+ keys: [
7
+ messageId
8
+ ]
9
+ })[messageId];
10
+ const useChatMessagePart = (messageId, type)=>{
11
+ const message = useChatMessage(messageId);
12
+ const part = message?.parts?.find((i)=>i.type === type);
13
+ return part;
14
+ };
15
+ export { $chatMessages, getChatMessage, useChatMessage, useChatMessagePart };
@@ -0,0 +1,14 @@
1
+ import type { FileUIPart } from 'ai';
2
+ export type SendMessage = ({ text, file }: {
3
+ text: string;
4
+ file?: FileUIPart;
5
+ }, data?: Record<string, unknown>) => Promise<void>;
6
+ type SendSdkMessage = ({ text, files }: {
7
+ text: string;
8
+ files?: FileUIPart[];
9
+ }, { body }: {
10
+ body?: Record<string, unknown>;
11
+ }) => Promise<void>;
12
+ export declare const setChatSendMessage: (sendMessage: SendSdkMessage) => void;
13
+ export declare const sendMessage: SendMessage;
14
+ export {};
@@ -0,0 +1,16 @@
1
+ import { atom } from "nanostores";
2
+ const $chatSendMessage = atom();
3
+ const getChatSendMessage = ()=>$chatSendMessage.get();
4
+ const setChatSendMessage = (sendMessage)=>$chatSendMessage.set(sendMessage);
5
+ const send_sendMessage = async ({ text, file }, data)=>{
6
+ const files = file ? [
7
+ file
8
+ ] : [];
9
+ await getChatSendMessage()?.({
10
+ text,
11
+ files
12
+ }, {
13
+ body: data
14
+ });
15
+ };
16
+ export { send_sendMessage as sendMessage, setChatSendMessage };
@@ -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,3 @@
1
+ import { type UseChatOptions } from '@ai-sdk/react';
2
+ import type { ChatInit, UIMessage } from 'ai';
3
+ export declare const useInitChat: <T extends UIMessage>(props?: UseChatOptions<T> & ChatInit<T>) => void;
@@ -0,0 +1,40 @@
1
+ import { useChat } from "@ai-sdk/react";
2
+ import { notifications } from "@mantine/notifications";
3
+ import { useEffect } from "react";
4
+ import { setChatMessages } from "./messageIds.js";
5
+ import { setChatSendMessage } from "./send.js";
6
+ import { setChatError, setChatStatus } from "./states.js";
7
+ const useInitChat = (props)=>{
8
+ const { messages, status, error, sendMessage } = useChat({
9
+ onError: (e)=>{
10
+ notifications.show({
11
+ title: 'Ошибка сервера ИИ',
12
+ message: e.message,
13
+ color: 'red',
14
+ autoClose: false
15
+ });
16
+ },
17
+ ...props
18
+ });
19
+ useEffect(()=>{
20
+ setChatStatus(status);
21
+ }, [
22
+ status
23
+ ]);
24
+ useEffect(()=>{
25
+ setChatError(error?.message);
26
+ }, [
27
+ error?.message
28
+ ]);
29
+ useEffect(()=>{
30
+ setChatSendMessage(sendMessage);
31
+ }, [
32
+ sendMessage
33
+ ]);
34
+ useEffect(()=>{
35
+ setChatMessages(messages);
36
+ }, [
37
+ messages
38
+ ]);
39
+ };
40
+ export { useInitChat };
@@ -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,26 +1,5 @@
1
- /** biome-ignore-all assist/source/organizeImports: <> */
2
- export { Conversation, type ConversationProps, useChatMessage, } from './ai/ui/conversation';
3
- export { type Accept, PromptInput, type PromptInputProps, } from './ai/ui/promptInput';
4
- export { convertFileUIPartBlobToDataURL } from './ai/utils/convertFileUIPartBlobToDataURL';
5
- export { parseAiMessagePart } from './ai/utils/parseAiMessagePart';
6
- export { DefaultApp } from './app/DefaultApp';
7
- export { defaultRequestMiddlewares } from './app/defaultRequestMiddlewares';
8
- export { defaultTheme } from './app/defaultTheme';
9
- export { getCookie } from './functions/getCookie';
10
- export { setCookie } from './functions/setCookie';
11
- export { setCookies } from './functions/setCookies';
12
- export { useMutation } from './hooks/useMutation';
13
- export { useMutationWithInvalidate } from './hooks/useMutationWithInvalidate';
14
- export { getDB } from './surreal/connection';
15
- export { surrealDeleteFn, surrealUnsubscribeFn } from './surreal/deafaultCrud';
16
- export { deserialize } from './surreal/deserialize';
17
- export { encryptionFn } from './surreal/encryption';
18
- export { Editor, useEditor } from './ui/editor';
19
- export { DefaultError, DefaultNotFound, defaultErrorNotification, Forbidden, } from './ui/error';
20
- export { AnimatedChevron } from './ui/AnimatedChevron';
21
- export { useAppForm, useFieldContext, withForm, blurOnError, fieldsSchema, } from './ui/form';
22
- export { HoverPaper, usePaperHover } from './ui/hoverPaper';
23
- export { JsonInput } from './ui/JsonInput';
24
- export { RouterLink } from './ui/RouterLink';
25
- export { SaveInput } from './ui/saveInput';
26
- export { ScrollArea, useScrollArea, type ScrollAreaContextValue, type ScrollAreaHook, type ScrollAreaProps, type ScrollAreaState, type ScrollButtonProps, type ScrollPosition, } from './ui/scrollArea';
1
+ export * from './ai';
2
+ export * from './app';
3
+ export * from './hooks';
4
+ export * from './tanstackFunctions';
5
+ export * from './ui';
package/dist/index.js CHANGED
@@ -1,26 +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";
17
- import { Editor, useEditor } from "./ui/editor/index.js";
18
- import { DefaultError, DefaultNotFound, Forbidden, defaultErrorNotification } from "./ui/error/index.js";
19
- import { AnimatedChevron } from "./ui/AnimatedChevron.js";
20
- import { blurOnError, fieldsSchema, useAppForm, useFieldContext, withForm } from "./ui/form/index.js";
21
- import { HoverPaper, usePaperHover } from "./ui/hoverPaper/index.js";
22
- import { JsonInput } from "./ui/JsonInput.js";
23
- import { RouterLink } from "./ui/RouterLink.js";
24
- import { SaveInput } from "./ui/saveInput/index.js";
25
- import { ScrollArea, useScrollArea } from "./ui/scrollArea/index.js";
26
- export { AnimatedChevron, Conversation, DefaultApp, DefaultError, DefaultNotFound, Editor, Forbidden, HoverPaper, JsonInput, PromptInput, RouterLink, SaveInput, ScrollArea, blurOnError, convertFileUIPartBlobToDataURL, defaultErrorNotification, defaultRequestMiddlewares, defaultTheme, deserialize, encryptionFn, fieldsSchema, getCookie, getDB, parseAiMessagePart, setCookie, setCookies, surrealDeleteFn, surrealUnsubscribeFn, useAppForm, useChatMessage, useEditor, useFieldContext, useMutation, useMutationWithInvalidate, usePaperHover, useScrollArea, withForm };
1
+ export * from "./ai/index.js";
2
+ export * from "./app/index.js";
3
+ export * from "./hooks/index.js";
4
+ export * from "./tanstackFunctions/index.js";
5
+ export * from "./ui/index.js";
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();