@rolder/kit 3.0.0-alpha.87 → 3.0.0-alpha.89
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.
- package/dist/ai/ui/chat/Root.d.ts +7 -3
- package/dist/ai/ui/chat/index.d.ts +3 -4
- package/dist/ai/ui/chat/index.js +0 -2
- package/dist/ai/ui/chat/messages/Loader.js +2 -3
- package/dist/ai/ui/chat/messages/Message.d.ts +2 -5
- package/dist/ai/ui/chat/messages/Message.js +14 -7
- package/dist/ai/ui/chat/messages/Messages.d.ts +2 -1
- package/dist/ai/ui/chat/messages/Messages.js +5 -1
- package/dist/ai/ui/chat/parts/TextPart.d.ts +3 -3
- package/dist/ai/ui/chat/parts/TextPart.js +8 -5
- package/dist/ai/ui/chat/parts/ToolExecution.js +2 -0
- package/dist/ai/ui/chat/parts/ToolPart.d.ts +3 -2
- package/dist/ai/ui/chat/parts/ToolPart.js +6 -7
- package/dist/ai/ui/chat/store/messages.d.ts +9 -6
- package/dist/ai/ui/chat/store/messages.js +31 -36
- package/dist/ai/ui/chat/store/states.d.ts +3 -2
- package/dist/ai/ui/chat/store/states.js +8 -4
- package/dist/app/defaultTheme.d.ts +7 -7
- package/dist/ui/saveInput/SaveInput.d.ts +6 -6
- package/dist/ui/scrollArea/ScrollButton.d.ts +2 -5
- package/dist/ui/scrollArea/ScrollButton.js +2 -2
- package/package.json +7 -7
|
@@ -2,8 +2,12 @@ import type { UseChatOptions } from '@ai-sdk/react';
|
|
|
2
2
|
import type { MantineRadius, MantineSpacing, PaperProps, ScrollAreaProps, StackProps } from '@mantine/core';
|
|
3
3
|
import type { ChatInit, UIMessage } from 'ai';
|
|
4
4
|
import type { ReactNode } from 'react';
|
|
5
|
-
export interface ChatRootProps extends PaperProps {
|
|
6
|
-
children: (
|
|
5
|
+
export interface ChatRootProps<TMessage extends UIMessage> extends PaperProps {
|
|
6
|
+
children: ({ message, part, key, }: {
|
|
7
|
+
message: TMessage;
|
|
8
|
+
part: TMessage['parts'][number];
|
|
9
|
+
key: string;
|
|
10
|
+
}) => ReactNode;
|
|
7
11
|
height: string;
|
|
8
12
|
radius?: MantineRadius;
|
|
9
13
|
padding?: MantineSpacing;
|
|
@@ -48,4 +52,4 @@ export interface ChatRootProps extends PaperProps {
|
|
|
48
52
|
* @param withScrollButton - Показывать кнопку прокрутки (по умолчанию true)
|
|
49
53
|
* @param stackProps - Пропсы для Stack контейнера
|
|
50
54
|
*/
|
|
51
|
-
export declare const Root: ({ chatOptions, ...props }: ChatRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
export declare const Root: <TMessage extends UIMessage>({ chatOptions, ...props }: ChatRootProps<TMessage>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export declare const Chat: {
|
|
2
|
-
Root: ({ chatOptions, ...props }: import("./Root").ChatRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
|
|
4
|
-
TextPart: import("react").MemoExoticComponent<({ part, role }: import("./parts").TextPartProps) => import("react/jsx-runtime").JSX.Element>;
|
|
2
|
+
Root: <TMessage extends import("ai").UIMessage>({ chatOptions, ...props }: import("./Root").ChatRootProps<TMessage>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
TextPart: ({ messageId, part }: import("./parts").TextPartProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
4
|
ToolPart: <TPart extends import("ai").ToolUIPart = {
|
|
6
5
|
type: `tool-${string}`;
|
|
7
|
-
} & import("ai").UIToolInvocation<import("ai").UITool>>(
|
|
6
|
+
} & import("ai").UIToolInvocation<import("ai").UITool>>({ children, part, withLoader, loader, onError, }: import("./parts").ToolPartProps<TPart>) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
8
7
|
ToolExecution: ({ part, onError }: import("./parts/ToolExecution").ToolExecutionProps) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
9
8
|
FilePart: import("react").MemoExoticComponent<({ part, messageId }: import("./parts/File").FilePartProps) => import("react/jsx-runtime").JSX.Element | null>;
|
|
10
9
|
PartPaper: ({ children, chatRole, ...props }: import("./parts").PartPaperProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/ai/ui/chat/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Message } from "./messages/index.js";
|
|
2
1
|
import { PartPaper, TextPart, ToolPart } from "./parts/index.js";
|
|
3
2
|
import { FilePart } from "./parts/File.js";
|
|
4
3
|
import { ToolExecution } from "./parts/ToolExecution.js";
|
|
@@ -7,7 +6,6 @@ import { ChatInput } from "./chatInput/index.js";
|
|
|
7
6
|
export * from "./store/index.js";
|
|
8
7
|
const Chat = {
|
|
9
8
|
Root: Root,
|
|
10
|
-
Message: Message,
|
|
11
9
|
TextPart: TextPart,
|
|
12
10
|
ToolPart: ToolPart,
|
|
13
11
|
ToolExecution: ToolExecution,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Loader } from "@mantine/core";
|
|
3
|
-
import { useIsLoading
|
|
3
|
+
import { useIsLoading } from "../store/index.js";
|
|
4
4
|
const Loader_Loader = ({ loaderComponent, ...props })=>{
|
|
5
5
|
const isLoading = useIsLoading();
|
|
6
|
-
|
|
7
|
-
return isLoading && !isStreaming ? loaderComponent ?? /*#__PURE__*/ jsx(Loader, {
|
|
6
|
+
return isLoading ? loaderComponent ?? /*#__PURE__*/ jsx(Loader, {
|
|
8
7
|
size: 28,
|
|
9
8
|
type: "dots",
|
|
10
9
|
...props
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { type StackProps } from '@mantine/core';
|
|
2
2
|
import type { UIMessage } from 'ai';
|
|
3
|
-
import {
|
|
3
|
+
import type { ChatRootProps } from '../Root';
|
|
4
4
|
export interface MessageProps<TMessage extends UIMessage> extends Omit<StackProps, 'children'> {
|
|
5
|
-
children:
|
|
6
|
-
parts: TMessage['parts'];
|
|
7
|
-
role: TMessage['role'];
|
|
8
|
-
}) => ReactNode;
|
|
5
|
+
children: ChatRootProps<TMessage>['children'];
|
|
9
6
|
messageId: string;
|
|
10
7
|
}
|
|
11
8
|
export declare const Message: <TMessage extends UIMessage>(props: MessageProps<TMessage>) => React.JSX.Element;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Stack } from "@mantine/core";
|
|
3
|
-
import { memo } from "react";
|
|
4
|
-
import {
|
|
3
|
+
import { Fragment, memo } from "react";
|
|
4
|
+
import { getChatMessage, useMessageParts } from "../store/index.js";
|
|
5
5
|
const Message = /*#__PURE__*/ memo(({ children, messageId, ...props })=>{
|
|
6
|
-
const
|
|
6
|
+
const parts = useMessageParts(messageId);
|
|
7
|
+
const message = getChatMessage(messageId);
|
|
7
8
|
return /*#__PURE__*/ jsx(Stack, {
|
|
8
9
|
...props,
|
|
9
|
-
children: 'function' == typeof children ?
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
children: 'function' == typeof children ? parts.map((part, index)=>{
|
|
11
|
+
const key = `${messageId}-${index}`;
|
|
12
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
13
|
+
children: children({
|
|
14
|
+
message,
|
|
15
|
+
part,
|
|
16
|
+
key: `${messageId}-${index}`
|
|
17
|
+
})
|
|
18
|
+
}, key);
|
|
12
19
|
}) : null
|
|
13
20
|
});
|
|
14
|
-
});
|
|
21
|
+
}, (oldProps, newProps)=>oldProps.messageId === newProps.messageId);
|
|
15
22
|
export { Message };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import type { UIMessage } from 'ai';
|
|
1
2
|
import type { ChatRootProps } from '../Root';
|
|
2
|
-
export declare const Messages: ({ children, height, radius, padding, scrollAreaProps, withScrollButton, stackProps, emptyComponent, loaderComponent, ...props }: Omit<ChatRootProps
|
|
3
|
+
export declare const Messages: <TMessage extends UIMessage>({ children, height, radius, padding, scrollAreaProps, withScrollButton, stackProps, emptyComponent, loaderComponent, ...props }: Omit<ChatRootProps<TMessage>, "chatOptions">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,6 +4,7 @@ import { ScrollArea } from "../../../../ui/index.js";
|
|
|
4
4
|
import { useChatMessageIds } from "../store/index.js";
|
|
5
5
|
import { Empty } from "./Empty.js";
|
|
6
6
|
import { Loader } from "./Loader.js";
|
|
7
|
+
import { Message } from "./Message.js";
|
|
7
8
|
const Messages = ({ children, height, radius = 'md', padding = 'md', scrollAreaProps, withScrollButton = true, stackProps, emptyComponent, loaderComponent, ...props })=>{
|
|
8
9
|
const messageIds = useChatMessageIds();
|
|
9
10
|
return /*#__PURE__*/ jsx(Paper, {
|
|
@@ -20,7 +21,10 @@ const Messages = ({ children, height, radius = 'md', padding = 'md', scrollAreaP
|
|
|
20
21
|
p: padding,
|
|
21
22
|
...stackProps,
|
|
22
23
|
children: [
|
|
23
|
-
messageIds.length ?
|
|
24
|
+
messageIds.length ? messageIds.map((messageId)=>/*#__PURE__*/ jsx(Message, {
|
|
25
|
+
messageId: messageId,
|
|
26
|
+
children: children
|
|
27
|
+
}, messageId)) : /*#__PURE__*/ jsx(Empty, {
|
|
24
28
|
emptyComponent: emptyComponent
|
|
25
29
|
}),
|
|
26
30
|
/*#__PURE__*/ jsx(Loader, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { TextUIPart
|
|
1
|
+
import type { TextUIPart } from 'ai';
|
|
2
2
|
export interface TextPartProps {
|
|
3
|
+
messageId: string;
|
|
3
4
|
part: TextUIPart;
|
|
4
|
-
role: UIMessage['role'];
|
|
5
5
|
}
|
|
6
|
-
export declare const TextPart:
|
|
6
|
+
export declare const TextPart: ({ messageId, part }: TextPartProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from "react";
|
|
3
2
|
import { Streamdown } from "streamdown";
|
|
3
|
+
import { getChatMessage } from "../store/index.js";
|
|
4
4
|
import { PartPaper } from "./PartPaper.js";
|
|
5
|
-
const TextPart =
|
|
6
|
-
|
|
5
|
+
const TextPart = ({ messageId, part })=>{
|
|
6
|
+
const message = getChatMessage(messageId);
|
|
7
|
+
return /*#__PURE__*/ jsx(PartPaper, {
|
|
8
|
+
chatRole: message.role,
|
|
7
9
|
children: /*#__PURE__*/ jsx(Streamdown, {
|
|
8
10
|
isAnimating: 'streaming' === part.state,
|
|
9
|
-
children: part
|
|
11
|
+
children: part.text
|
|
10
12
|
})
|
|
11
|
-
})
|
|
13
|
+
});
|
|
14
|
+
};
|
|
12
15
|
export { TextPart };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Group, Loader, Text } from "@mantine/core";
|
|
3
3
|
import { IconCheck } from "@tabler/icons-react";
|
|
4
|
+
import { setIsLoading } from "../store/index.js";
|
|
4
5
|
const ToolExecution = ({ part, onError })=>{
|
|
5
6
|
switch(part.state){
|
|
6
7
|
case 'input-available':
|
|
8
|
+
setIsLoading(false);
|
|
7
9
|
return /*#__PURE__*/ jsxs(Group, {
|
|
8
10
|
gap: "xs",
|
|
9
11
|
children: [
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ToolUIPart } from 'ai';
|
|
2
|
-
import {
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
3
|
export interface ToolPartProps<TPart extends ToolUIPart = ToolUIPart> {
|
|
4
4
|
children: (toolOutput: NonNullable<TPart['output']>) => ReactNode;
|
|
5
5
|
part: TPart;
|
|
6
|
+
withLoader?: boolean;
|
|
6
7
|
loader?: ReactNode;
|
|
7
8
|
onError?: (error: string) => ReactNode;
|
|
8
9
|
}
|
|
9
|
-
export declare const ToolPart: <TPart extends ToolUIPart = ToolUIPart>(
|
|
10
|
+
export declare const ToolPart: <TPart extends ToolUIPart = ToolUIPart>({ children, part, withLoader, loader, onError, }: ToolPartProps<TPart>) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Loader, Text } from "@mantine/core";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const ToolPart = ({ children, part, withLoader, loader = /*#__PURE__*/ jsx(Loader, {
|
|
4
|
+
size: 28,
|
|
5
|
+
type: "dots"
|
|
6
|
+
}), onError })=>{
|
|
5
7
|
switch(part.state){
|
|
6
8
|
case 'input-available':
|
|
7
|
-
return
|
|
8
|
-
size: 28,
|
|
9
|
-
type: "dots"
|
|
10
|
-
});
|
|
9
|
+
return withLoader ? loader : null;
|
|
11
10
|
case 'output-available':
|
|
12
11
|
return part.output ? children(part.output) : null;
|
|
13
12
|
case 'output-error':
|
|
@@ -21,5 +20,5 @@ const ToolPart = /*#__PURE__*/ memo(({ children, part, loader, onError })=>{
|
|
|
21
20
|
default:
|
|
22
21
|
return null;
|
|
23
22
|
}
|
|
24
|
-
}
|
|
23
|
+
};
|
|
25
24
|
export { ToolPart };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { UIMessage } from 'ai';
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const getChatMessage: <TMessage extends UIMessage>(messageId: string) => TMessage | undefined;
|
|
6
|
-
export declare const useChatMessage: <TMessage extends UIMessage>(messageId: string) => TMessage;
|
|
2
|
+
export declare const getChatMessages: () => UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>[];
|
|
3
|
+
export declare const getChatMessage: <TMessage extends UIMessage>(messageId: string) => TMessage;
|
|
4
|
+
export declare const setChatMessages: (messages: UIMessage[]) => void;
|
|
7
5
|
export declare const addChatMessage: <TMessage extends UIMessage>(newMessage: TMessage) => void;
|
|
8
|
-
export declare const
|
|
6
|
+
export declare const getChatMessageIds: () => string[];
|
|
7
|
+
export declare const useChatMessageIds: () => string[];
|
|
8
|
+
export type MessagesParts = Record<string, UIMessage['parts']>;
|
|
9
|
+
export declare const getMessagesParts: () => MessagesParts;
|
|
10
|
+
export declare const setMessageParts: (messageId: string, messageParts: UIMessage["parts"]) => void;
|
|
11
|
+
export declare const useMessageParts: <TMessage extends UIMessage>(messageId: string) => TMessage["parts"];
|
|
9
12
|
export declare const getIsEmpty: () => boolean;
|
|
@@ -1,45 +1,40 @@
|
|
|
1
1
|
import { useStore } from "@nanostores/react";
|
|
2
|
-
import { atom, computed, map
|
|
2
|
+
import { atom, computed, map } from "nanostores";
|
|
3
|
+
const $chatMessages = atom([]);
|
|
4
|
+
const getChatMessages = ()=>$chatMessages.get();
|
|
5
|
+
const getChatMessage = (messageId)=>$chatMessages.get().find((msg)=>msg.id === messageId);
|
|
6
|
+
const setChatMessages = (messages)=>{
|
|
7
|
+
const newIds = messages.map((msg)=>msg.id);
|
|
8
|
+
if (getChatMessageIds().length !== newIds.length) {
|
|
9
|
+
$chatMessages.set(messages);
|
|
10
|
+
$chatMessageIds.set(newIds);
|
|
11
|
+
}
|
|
12
|
+
messages.forEach((msg)=>{
|
|
13
|
+
setMessageParts(msg.id, msg.parts);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
const addChatMessage = (newMessage)=>{
|
|
17
|
+
$chatMessages.set([
|
|
18
|
+
...getChatMessages(),
|
|
19
|
+
newMessage
|
|
20
|
+
]);
|
|
21
|
+
$chatMessageIds.set([
|
|
22
|
+
...getChatMessageIds(),
|
|
23
|
+
newMessage.id
|
|
24
|
+
]);
|
|
25
|
+
setMessageParts(newMessage.id, newMessage.parts);
|
|
26
|
+
};
|
|
3
27
|
const $chatMessageIds = atom([]);
|
|
28
|
+
const getChatMessageIds = ()=>$chatMessageIds.get();
|
|
4
29
|
const useChatMessageIds = ()=>useStore($chatMessageIds);
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const $chatMessages = map({});
|
|
10
|
-
const getChatMessage = (messageId)=>$chatMessages.get()[messageId];
|
|
11
|
-
const useChatMessage = (messageId)=>useStore($chatMessages, {
|
|
30
|
+
const $messagesParts = map({});
|
|
31
|
+
const getMessagesParts = ()=>$messagesParts.get();
|
|
32
|
+
const setMessageParts = (messageId, messageParts)=>$messagesParts.setKey(messageId, messageParts);
|
|
33
|
+
const useMessageParts = (messageId)=>useStore($messagesParts, {
|
|
12
34
|
keys: [
|
|
13
35
|
messageId
|
|
14
36
|
]
|
|
15
37
|
})[messageId];
|
|
16
|
-
const addChatMessage = (newMessage)=>{
|
|
17
|
-
$chatMessageIds.set([
|
|
18
|
-
...$chatMessageIds.get(),
|
|
19
|
-
newMessage.id
|
|
20
|
-
]);
|
|
21
|
-
$chatMessages.set({
|
|
22
|
-
...$chatMessages.get(),
|
|
23
|
-
[newMessage.id]: newMessage
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
const setChatMessages = (messages)=>{
|
|
27
|
-
const newIds = messages.map((msg)=>msg.id);
|
|
28
|
-
$chatMessageIds.set(newIds);
|
|
29
|
-
const currentMessages = $chatMessages.get();
|
|
30
|
-
const lastMessage = messages[messages.length - 1];
|
|
31
|
-
for(let i = 0; i < messages.length; i++){
|
|
32
|
-
const msg = messages[i];
|
|
33
|
-
const currentMsg = currentMessages[msg.id];
|
|
34
|
-
const isLastMessage = msg === lastMessage;
|
|
35
|
-
if (currentMsg) if (isLastMessage) $chatMessages.setKey(msg.id, msg);
|
|
36
|
-
else {
|
|
37
|
-
const isChanged = JSON.stringify(currentMsg) !== JSON.stringify(msg);
|
|
38
|
-
if (isChanged) $chatMessages.setKey(msg.id, msg);
|
|
39
|
-
}
|
|
40
|
-
else $chatMessages.setKey(msg.id, msg);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
38
|
const $isEmpty = computed($chatMessageIds, (messages)=>0 === messages.length);
|
|
44
39
|
const getIsEmpty = ()=>$isEmpty.get();
|
|
45
|
-
export {
|
|
40
|
+
export { addChatMessage, getChatMessage, getChatMessageIds, getChatMessages, getIsEmpty, getMessagesParts, setChatMessages, setMessageParts, useChatMessageIds, useMessageParts };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ChatStatus } from 'ai';
|
|
2
2
|
export declare const getChatStatus: () => ChatStatus;
|
|
3
|
-
export declare const setChatStatus: (status: ChatStatus) => void;
|
|
4
3
|
export declare const useChatStatus: () => ChatStatus;
|
|
4
|
+
export declare const setChatStatus: (status: ChatStatus) => void;
|
|
5
5
|
export declare const getIsLoading: () => boolean;
|
|
6
6
|
export declare const useIsLoading: () => boolean;
|
|
7
|
+
export declare const setIsLoading: (isLoading: boolean) => void;
|
|
7
8
|
export declare const useIsStreaming: () => boolean;
|
|
8
9
|
export declare const getChatError: () => string | undefined;
|
|
9
|
-
export declare const setChatError: (error: string | undefined) => void;
|
|
10
10
|
export declare const useChatError: () => string | undefined;
|
|
11
|
+
export declare const setChatError: (error: string | undefined) => void;
|
|
@@ -2,15 +2,19 @@ import { useStore } from "@nanostores/react";
|
|
|
2
2
|
import { atom, computed } from "nanostores";
|
|
3
3
|
const $chatStatus = atom('ready');
|
|
4
4
|
const getChatStatus = ()=>$chatStatus.get();
|
|
5
|
-
const setChatStatus = (status)=>$chatStatus.set(status);
|
|
6
5
|
const useChatStatus = ()=>useStore($chatStatus);
|
|
7
|
-
const
|
|
6
|
+
const setChatStatus = (status)=>$chatStatus.set(status);
|
|
7
|
+
const $isLoading = atom(false);
|
|
8
8
|
const getIsLoading = ()=>$isLoading.get();
|
|
9
9
|
const useIsLoading = ()=>useStore($isLoading);
|
|
10
|
+
const setIsLoading = (isLoading)=>$isLoading.set(isLoading);
|
|
11
|
+
$chatStatus.listen((status)=>{
|
|
12
|
+
'ready' === status || 'streaming' === status ? setIsLoading(false) : setIsLoading(true);
|
|
13
|
+
});
|
|
10
14
|
const $isStreaming = computed($chatStatus, (status)=>'streaming' === status);
|
|
11
15
|
const useIsStreaming = ()=>useStore($isStreaming);
|
|
12
16
|
const $chatError = atom();
|
|
13
17
|
const getChatError = ()=>$chatError.get();
|
|
14
|
-
const setChatError = (error)=>$chatError.set(error);
|
|
15
18
|
const useChatError = ()=>useStore($chatError);
|
|
16
|
-
|
|
19
|
+
const setChatError = (error)=>$chatError.set(error);
|
|
20
|
+
export { getChatError, getChatStatus, getIsLoading, setChatError, setChatStatus, setIsLoading, useChatError, useChatStatus, useIsLoading, useIsStreaming };
|
|
@@ -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;
|
|
10
9
|
dark?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
11
10
|
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;
|
|
@@ -70,9 +70,9 @@ export declare const defaultTheme: {
|
|
|
70
70
|
} | undefined;
|
|
71
71
|
radius?: {
|
|
72
72
|
[x: string & {}]: string | undefined;
|
|
73
|
+
md?: string | undefined;
|
|
73
74
|
xs?: string | undefined;
|
|
74
75
|
sm?: string | undefined;
|
|
75
|
-
md?: string | undefined;
|
|
76
76
|
lg?: string | undefined;
|
|
77
77
|
xl?: string | undefined;
|
|
78
78
|
} | undefined;
|
|
@@ -80,41 +80,41 @@ export declare const defaultTheme: {
|
|
|
80
80
|
spacing?: {
|
|
81
81
|
[x: number]: string | undefined;
|
|
82
82
|
[x: string & {}]: string | undefined;
|
|
83
|
+
md?: string | undefined;
|
|
83
84
|
xs?: string | undefined;
|
|
84
85
|
sm?: string | undefined;
|
|
85
|
-
md?: string | undefined;
|
|
86
86
|
lg?: string | undefined;
|
|
87
87
|
xl?: string | undefined;
|
|
88
88
|
} | undefined;
|
|
89
89
|
fontSizes?: {
|
|
90
90
|
[x: string & {}]: string | undefined;
|
|
91
|
+
md?: string | undefined;
|
|
91
92
|
xs?: string | undefined;
|
|
92
93
|
sm?: string | undefined;
|
|
93
|
-
md?: string | undefined;
|
|
94
94
|
lg?: string | undefined;
|
|
95
95
|
xl?: string | undefined;
|
|
96
96
|
} | undefined;
|
|
97
97
|
lineHeights?: {
|
|
98
98
|
[x: string & {}]: string | undefined;
|
|
99
|
+
md?: string | undefined;
|
|
99
100
|
xs?: string | undefined;
|
|
100
101
|
sm?: string | undefined;
|
|
101
|
-
md?: string | undefined;
|
|
102
102
|
lg?: string | undefined;
|
|
103
103
|
xl?: string | undefined;
|
|
104
104
|
} | undefined;
|
|
105
105
|
breakpoints?: {
|
|
106
106
|
[x: string & {}]: string | undefined;
|
|
107
|
+
md?: string | undefined;
|
|
107
108
|
xs?: string | undefined;
|
|
108
109
|
sm?: string | undefined;
|
|
109
|
-
md?: string | undefined;
|
|
110
110
|
lg?: string | undefined;
|
|
111
111
|
xl?: string | undefined;
|
|
112
112
|
} | undefined;
|
|
113
113
|
shadows?: {
|
|
114
114
|
[x: string & {}]: string | undefined;
|
|
115
|
+
md?: string | undefined;
|
|
115
116
|
xs?: string | undefined;
|
|
116
117
|
sm?: string | undefined;
|
|
117
|
-
md?: string | undefined;
|
|
118
118
|
lg?: string | undefined;
|
|
119
119
|
xl?: string | undefined;
|
|
120
120
|
} | undefined;
|
|
@@ -2,22 +2,22 @@ export declare const SaveInput: import("react").FC<{
|
|
|
2
2
|
initialValue?: string;
|
|
3
3
|
onChange: (value: string) => Promise<void>;
|
|
4
4
|
debounce?: number;
|
|
5
|
-
} & Omit<import("@mantine/core").TextInputProps, "
|
|
5
|
+
} & Omit<import("@mantine/core").TextInputProps, "onChange" | "value">> & {
|
|
6
6
|
TextInput: import("react").FC<{
|
|
7
7
|
initialValue?: string;
|
|
8
8
|
onChange: (value: string) => Promise<void>;
|
|
9
9
|
debounce?: number;
|
|
10
|
-
} & Omit<import("@mantine/core").TextInputProps, "
|
|
10
|
+
} & Omit<import("@mantine/core").TextInputProps, "onChange" | "value">>;
|
|
11
11
|
NumberInput: import("react").FC<{
|
|
12
12
|
initialValue: string | number;
|
|
13
13
|
onChange: (value: string | number) => Promise<void>;
|
|
14
14
|
debounce?: number;
|
|
15
|
-
} & Omit<import("@mantine/core").NumberInputProps, "
|
|
15
|
+
} & Omit<import("@mantine/core").NumberInputProps, "onChange" | "value">>;
|
|
16
16
|
Textarea: import("react").FC<{
|
|
17
17
|
initialValue: string;
|
|
18
18
|
onChange: (value: string) => Promise<void>;
|
|
19
19
|
debounce?: number;
|
|
20
|
-
} & Omit<import("@mantine/core").TextareaProps, "
|
|
20
|
+
} & Omit<import("@mantine/core").TextareaProps, "onChange" | "value">>;
|
|
21
21
|
Switch: import("react").FC<{
|
|
22
22
|
initialValue: boolean;
|
|
23
23
|
onChange: (value: boolean) => Promise<void>;
|
|
@@ -27,10 +27,10 @@ export declare const SaveInput: import("react").FC<{
|
|
|
27
27
|
initialValue: string;
|
|
28
28
|
onChange: (value: string) => Promise<void>;
|
|
29
29
|
debounce?: number;
|
|
30
|
-
} & Omit<import("@uiw/react-codemirror").ReactCodeMirrorProps, "
|
|
30
|
+
} & Omit<import("@uiw/react-codemirror").ReactCodeMirrorProps, "onChange" | "value">>;
|
|
31
31
|
Select: import("react").FC<{
|
|
32
32
|
initialValue: string | null;
|
|
33
33
|
onChange: (value: string | null) => Promise<void>;
|
|
34
34
|
debounce?: number;
|
|
35
|
-
} & Omit<import("@mantine/core").SelectProps, "
|
|
35
|
+
} & Omit<import("@mantine/core").SelectProps, "onChange" | "value">>;
|
|
36
36
|
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
+
import { type ActionIconProps } from '@mantine/core';
|
|
1
2
|
import { type ReactNode } from '@tabler/icons-react';
|
|
2
|
-
export interface ScrollButtonProps {
|
|
3
|
-
/** CSS классы для стилизации кнопки */
|
|
4
|
-
className?: string;
|
|
5
|
-
/** Иконка для прокрутки вверх (по умолчанию IconChevronUp) */
|
|
3
|
+
export interface ScrollButtonProps extends ActionIconProps {
|
|
6
4
|
upIcon?: ReactNode;
|
|
7
|
-
/** Иконка для прокрутки вниз (по умолчанию IconChevronDown) */
|
|
8
5
|
downIcon?: ReactNode;
|
|
9
6
|
}
|
|
10
7
|
export declare const ScrollButton: React.FC<ScrollButtonProps>;
|
|
@@ -3,7 +3,7 @@ import { ActionIcon } from "@mantine/core";
|
|
|
3
3
|
import { IconChevronDown, IconChevronUp } from "@tabler/icons-react";
|
|
4
4
|
import { scrollToBottom, scrollToTop } from "./methods.js";
|
|
5
5
|
import { useHasScrollableContent, useIsAboveCenter } from "./store.js";
|
|
6
|
-
const ScrollButton = ({
|
|
6
|
+
const ScrollButton = ({ upIcon, downIcon, ...props })=>{
|
|
7
7
|
const hasScrollableContent = useHasScrollableContent();
|
|
8
8
|
const isScrollingDown = useIsAboveCenter();
|
|
9
9
|
if (!hasScrollableContent) return null;
|
|
@@ -22,8 +22,8 @@ const ScrollButton = ({ className, upIcon, downIcon })=>{
|
|
|
22
22
|
right: 16,
|
|
23
23
|
variant: "light",
|
|
24
24
|
onClick: handleClick,
|
|
25
|
-
className: className,
|
|
26
25
|
"aria-label": isScrollingDown ? 'Scroll to bottom' : 'Scroll to top',
|
|
26
|
+
...props,
|
|
27
27
|
children: icon
|
|
28
28
|
});
|
|
29
29
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolder/kit",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.89",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"@types/js-cookie": "^3.0.6",
|
|
27
27
|
"@types/omgopass": "^3.2.3",
|
|
28
28
|
"@types/react": "^19.2.9",
|
|
29
|
-
"@typescript/native-preview": "^7.0.0-dev.20260122.
|
|
29
|
+
"@typescript/native-preview": "^7.0.0-dev.20260122.4",
|
|
30
30
|
"typescript": "6.0.0-dev.20260122"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@ai-sdk/react": "^3.0.
|
|
33
|
+
"@ai-sdk/react": "^3.0.50",
|
|
34
34
|
"@better-upload/client": "^3.0.12",
|
|
35
35
|
"@better-upload/server": "^3.0.12",
|
|
36
36
|
"@codemirror/lang-json": "^6.0.2",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"@nanostores/react": "^1.0.0",
|
|
43
43
|
"@tanstack/react-form": "^1.27.7",
|
|
44
44
|
"@tanstack/react-query": "^5.90.19",
|
|
45
|
-
"@tanstack/react-router": "^1.154.
|
|
46
|
-
"@tanstack/react-router-ssr-query": "^1.154.
|
|
47
|
-
"@tanstack/react-start": "^1.154.
|
|
45
|
+
"@tanstack/react-router": "^1.154.12",
|
|
46
|
+
"@tanstack/react-router-ssr-query": "^1.154.12",
|
|
47
|
+
"@tanstack/react-start": "^1.154.12",
|
|
48
48
|
"@tiptap/extension-highlight": "^3.16.0",
|
|
49
49
|
"@tiptap/extension-placeholder": "^3.16.0",
|
|
50
50
|
"@tiptap/extension-table": "^3.16.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"streamdown": "^2.1.0",
|
|
68
68
|
"surrealdb": "2.0.0-alpha.16",
|
|
69
69
|
"xlsx": "^0.18.5",
|
|
70
|
-
"zod": "^4.3.
|
|
70
|
+
"zod": "^4.3.6"
|
|
71
71
|
},
|
|
72
72
|
"trustedDependencies": [
|
|
73
73
|
"core-js",
|