@rolder/kit 3.0.0-alpha.26 → 3.0.0-alpha.28
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/Empty.js +1 -0
- package/dist/ai/ui/chat/File.js +2 -0
- package/dist/ai/ui/chat/Loader.js +1 -0
- package/dist/ai/ui/chat/Message.d.ts +1 -1
- package/dist/ai/ui/chat/Message.js +3 -2
- package/dist/ai/ui/chat/Messages.js +1 -0
- package/dist/ai/ui/chat/Root.js +4 -1
- package/dist/ai/ui/chat/chatInput/File.js +6 -4
- package/dist/ai/ui/chat/chatInput/Footer.js +4 -1
- package/dist/ai/ui/chat/chatInput/Root.d.ts +3 -4
- package/dist/ai/ui/chat/chatInput/Root.js +5 -6
- package/dist/ai/ui/chat/chatInput/Submit.js +5 -3
- package/dist/ai/ui/chat/chatInput/Textarea.js +5 -3
- package/dist/ai/ui/chat/chatInput/index.d.ts +1 -1
- package/dist/ai/ui/chat/chatInput/store.d.ts +0 -2
- package/dist/ai/ui/chat/chatInput/store.js +1 -4
- package/dist/ai/ui/chat/index.d.ts +2 -2
- package/dist/ai/ui/chat/store/messages.d.ts +1 -1
- package/dist/app/defaultTheme.d.ts +8 -8
- package/package.json +2 -2
package/dist/ai/ui/chat/Empty.js
CHANGED
package/dist/ai/ui/chat/File.js
CHANGED
|
@@ -5,6 +5,7 @@ import { useChatMessagePart } from "./store/index.js";
|
|
|
5
5
|
const File = ({ messageId })=>{
|
|
6
6
|
const part = useChatMessagePart(messageId, 'file');
|
|
7
7
|
const textFileType = messageId.split('-')[1];
|
|
8
|
+
console.log('File render');
|
|
8
9
|
const FileComponent = ()=>{
|
|
9
10
|
switch(textFileType){
|
|
10
11
|
case 'excel':
|
|
@@ -20,6 +21,7 @@ const File = ({ messageId })=>{
|
|
|
20
21
|
mimeType: "powerpoint"
|
|
21
22
|
});
|
|
22
23
|
}
|
|
24
|
+
if (!part) return null;
|
|
23
25
|
if (part.mediaType.includes('image/')) return /*#__PURE__*/ jsx(Image, {
|
|
24
26
|
radius: "md",
|
|
25
27
|
h: 128,
|
|
@@ -3,6 +3,7 @@ import { Loader } from "@mantine/core";
|
|
|
3
3
|
import { useIsLoading } from "./store/index.js";
|
|
4
4
|
const Loader_Loader = (props)=>{
|
|
5
5
|
const isLoading = useIsLoading();
|
|
6
|
+
console.log('Loader render');
|
|
6
7
|
return isLoading ? /*#__PURE__*/ jsx(Loader, {
|
|
7
8
|
size: 28,
|
|
8
9
|
type: "dots",
|
|
@@ -6,7 +6,8 @@ const Message = ({ messageId })=>{
|
|
|
6
6
|
const message = useChatMessage(messageId);
|
|
7
7
|
const part = useChatMessagePart(messageId, 'text');
|
|
8
8
|
const isStreaming = useIsStreaming();
|
|
9
|
-
|
|
9
|
+
console.log('Message render');
|
|
10
|
+
return part ? /*#__PURE__*/ jsx(Paper, {
|
|
10
11
|
radius: "md",
|
|
11
12
|
px: "md",
|
|
12
13
|
py: "sm",
|
|
@@ -18,6 +19,6 @@ const Message = ({ messageId })=>{
|
|
|
18
19
|
isAnimating: isStreaming && 'assistant' === message.role,
|
|
19
20
|
children: part?.text
|
|
20
21
|
})
|
|
21
|
-
});
|
|
22
|
+
}) : null;
|
|
22
23
|
};
|
|
23
24
|
export { Message };
|
|
@@ -3,6 +3,7 @@ import { Stack } from "@mantine/core";
|
|
|
3
3
|
import { useChatMessageIds } from "./store/index.js";
|
|
4
4
|
const Messages = ({ children, ...props })=>{
|
|
5
5
|
const messageIds = useChatMessageIds();
|
|
6
|
+
console.log('Messages render');
|
|
6
7
|
return messageIds.map((messageId)=>/*#__PURE__*/ jsx(Stack, {
|
|
7
8
|
...props,
|
|
8
9
|
children: children
|
package/dist/ai/ui/chat/Root.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Paper } from "@mantine/core";
|
|
3
3
|
import { ScrollArea } from "../../../ui/index.js";
|
|
4
|
-
const Root = ({ children, scrollAreaProps, withScrollButton = true, ...props })
|
|
4
|
+
const Root = ({ children, scrollAreaProps, withScrollButton = true, ...props })=>{
|
|
5
|
+
console.log('Root render');
|
|
6
|
+
return /*#__PURE__*/ jsx(Paper, {
|
|
5
7
|
withBorder: true,
|
|
6
8
|
radius: "md",
|
|
7
9
|
...props,
|
|
@@ -16,4 +18,5 @@ const Root = ({ children, scrollAreaProps, withScrollButton = true, ...props })=
|
|
|
16
18
|
]
|
|
17
19
|
})
|
|
18
20
|
});
|
|
21
|
+
};
|
|
19
22
|
export { Root };
|
|
@@ -2,27 +2,29 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { ActionIcon, FileButton, Tooltip } from "@mantine/core";
|
|
3
3
|
import { IconPaperclip, IconTrash } from "@tabler/icons-react";
|
|
4
4
|
import { useRef } from "react";
|
|
5
|
+
import { useIsLoading } from "../store/index.js";
|
|
5
6
|
import { FileIcon } from "./FileIcon.js";
|
|
6
|
-
import { getAccept, setFile, useFile,
|
|
7
|
+
import { getAccept, setFile, useFile, useIsUploading } from "./store.js";
|
|
7
8
|
const File = (props)=>{
|
|
8
9
|
const resetRef = useRef(null);
|
|
9
|
-
const
|
|
10
|
+
const isLoading = useIsLoading();
|
|
10
11
|
const isUploading = useIsUploading();
|
|
11
12
|
const file = useFile();
|
|
13
|
+
console.log('Input File render');
|
|
12
14
|
return /*#__PURE__*/ jsx(FileButton, {
|
|
13
15
|
resetRef: resetRef,
|
|
14
16
|
onChange: async (file)=>{
|
|
15
17
|
if (file) setFile(file);
|
|
16
18
|
},
|
|
17
19
|
accept: getAccept(),
|
|
18
|
-
disabled:
|
|
20
|
+
disabled: isLoading || isUploading,
|
|
19
21
|
...props,
|
|
20
22
|
children: (props)=>/*#__PURE__*/ jsxs(ActionIcon.Group, {
|
|
21
23
|
children: [
|
|
22
24
|
/*#__PURE__*/ jsx(ActionIcon, {
|
|
23
25
|
size: "lg",
|
|
24
26
|
variant: "default",
|
|
25
|
-
disabled:
|
|
27
|
+
disabled: isLoading,
|
|
26
28
|
loading: isUploading,
|
|
27
29
|
classNames: {
|
|
28
30
|
root: 'rolder-chat-input-file-action-action'
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Group } from "@mantine/core";
|
|
3
|
-
const Footer = (props)
|
|
3
|
+
const Footer = (props)=>{
|
|
4
|
+
console.log('Input Footer render');
|
|
5
|
+
return /*#__PURE__*/ jsx(Group, {
|
|
4
6
|
justify: "space-between",
|
|
5
7
|
p: "xs",
|
|
6
8
|
...props
|
|
7
9
|
});
|
|
10
|
+
};
|
|
8
11
|
export { Footer };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type PaperProps } from '@mantine/core';
|
|
2
2
|
import { type Accept } from './store';
|
|
3
3
|
export interface ChatInputRootProps extends PaperProps {
|
|
4
|
-
onSubmit
|
|
5
|
-
|
|
6
|
-
isUploading: boolean;
|
|
4
|
+
onSubmit?: () => void;
|
|
5
|
+
isUploading?: boolean;
|
|
7
6
|
accept?: Accept;
|
|
8
7
|
}
|
|
9
|
-
export declare const Root: ({ className, onSubmit,
|
|
8
|
+
export declare const Root: ({ className, onSubmit, isUploading, accept, ...props }: ChatInputRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,19 +2,18 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Paper } from "@mantine/core";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { useEffect } from "react";
|
|
5
|
-
import { setAccept,
|
|
6
|
-
const Root = ({ className, onSubmit,
|
|
5
|
+
import { setAccept, setIsUploading, setOnSubmit } from "./store.js";
|
|
6
|
+
const Root = ({ className, onSubmit, isUploading, accept, ...props })=>{
|
|
7
7
|
useEffect(()=>{
|
|
8
|
-
setOnSubmit(onSubmit);
|
|
9
|
-
|
|
10
|
-
setIsUploading(isUploading);
|
|
8
|
+
if (onSubmit) setOnSubmit(onSubmit);
|
|
9
|
+
setIsUploading(isUploading || false);
|
|
11
10
|
if (accept) setAccept(accept);
|
|
12
11
|
}, [
|
|
13
12
|
onSubmit,
|
|
14
|
-
isSubmitting,
|
|
15
13
|
isUploading,
|
|
16
14
|
accept
|
|
17
15
|
]);
|
|
16
|
+
console.log('Input root render');
|
|
18
17
|
return /*#__PURE__*/ jsx(Paper, {
|
|
19
18
|
radius: "md",
|
|
20
19
|
withBorder: true,
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ActionIcon } from "@mantine/core";
|
|
3
3
|
import { IconArrowBigUp } from "@tabler/icons-react";
|
|
4
|
-
import {
|
|
4
|
+
import { useIsLoading } from "../store/index.js";
|
|
5
|
+
import { getOnSubmit, useIsUploading } from "./store.js";
|
|
5
6
|
const Submit = ({ children, ...props })=>{
|
|
6
7
|
const Icon = /*#__PURE__*/ jsx(IconArrowBigUp, {
|
|
7
8
|
strokeWidth: 1.5
|
|
8
9
|
});
|
|
9
|
-
const
|
|
10
|
+
const isLoading = useIsLoading();
|
|
10
11
|
const isUploading = useIsUploading();
|
|
12
|
+
console.log('Input submit render');
|
|
11
13
|
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
12
14
|
"aria-label": "Submit",
|
|
13
15
|
variant: "light",
|
|
14
16
|
size: "lg",
|
|
15
17
|
onClick: getOnSubmit(),
|
|
16
18
|
disabled: isUploading,
|
|
17
|
-
loading:
|
|
19
|
+
loading: isLoading,
|
|
18
20
|
...props,
|
|
19
21
|
children: children ?? Icon
|
|
20
22
|
});
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Textarea } from "@mantine/core";
|
|
3
|
-
import {
|
|
3
|
+
import { useIsLoading } from "../store/index.js";
|
|
4
|
+
import { getIsComposing, getOnSubmit, setIsComposing, setText, useIsUploading, useText } from "./store.js";
|
|
4
5
|
const Textarea_Textarea = (props)=>{
|
|
5
6
|
const text = useText();
|
|
6
|
-
const
|
|
7
|
+
const isLoading = useIsLoading();
|
|
7
8
|
const isUploading = useIsUploading();
|
|
9
|
+
console.log('Input textarea render');
|
|
8
10
|
const handleKeyDown = (e)=>{
|
|
9
11
|
if ('Enter' === e.key) {
|
|
10
12
|
if (getIsComposing() || e.nativeEvent.isComposing) return;
|
|
@@ -26,7 +28,7 @@ const Textarea_Textarea = (props)=>{
|
|
|
26
28
|
onKeyDown: handleKeyDown,
|
|
27
29
|
value: text,
|
|
28
30
|
onChange: (e)=>setText(e.target.value),
|
|
29
|
-
disabled:
|
|
31
|
+
disabled: isLoading || isUploading,
|
|
30
32
|
...props
|
|
31
33
|
});
|
|
32
34
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const Input: {
|
|
2
|
-
Root: ({ className, onSubmit,
|
|
2
|
+
Root: ({ className, onSubmit, isUploading, accept, ...props }: import("./Root").ChatInputRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
Textarea: (props: import("@mantine/core").TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
Footer: (props: import("@mantine/core").GroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
Submit: ({ children, ...props }: import("@mantine/core").ActionIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,8 +2,6 @@ export declare const setText: (text: string) => void;
|
|
|
2
2
|
export declare const useText: () => string;
|
|
3
3
|
export declare const getIsComposing: () => boolean;
|
|
4
4
|
export declare const setIsComposing: (isComposing: boolean) => void;
|
|
5
|
-
export declare const useIsSubmitting: () => boolean;
|
|
6
|
-
export declare const setIsSubmitting: (isSubmitting: boolean) => void;
|
|
7
5
|
export declare const useIsUploading: () => boolean;
|
|
8
6
|
export declare const setIsUploading: (isUploading: boolean) => void;
|
|
9
7
|
export declare const useFile: () => File | null;
|
|
@@ -6,9 +6,6 @@ const useText = ()=>useStore($text);
|
|
|
6
6
|
const $isComposing = atom(false);
|
|
7
7
|
const getIsComposing = ()=>$isComposing.get();
|
|
8
8
|
const setIsComposing = (isComposing)=>$isComposing.set(isComposing);
|
|
9
|
-
const $isSubmitting = atom(false);
|
|
10
|
-
const useIsSubmitting = ()=>useStore($isSubmitting);
|
|
11
|
-
const setIsSubmitting = (isSubmitting)=>$isSubmitting.set(isSubmitting);
|
|
12
9
|
const $isUploading = atom(false);
|
|
13
10
|
const useIsUploading = ()=>useStore($isUploading);
|
|
14
11
|
const setIsUploading = (isUploading)=>$isUploading.set(isUploading);
|
|
@@ -40,4 +37,4 @@ const getAccept = ()=>$accept.get().map((type)=>{
|
|
|
40
37
|
}
|
|
41
38
|
}).join(',');
|
|
42
39
|
const setAccept = (accept)=>$accept.set(accept);
|
|
43
|
-
export { getAccept, getIsComposing, getOnSubmit, setAccept, setFile, setIsComposing,
|
|
40
|
+
export { getAccept, getIsComposing, getOnSubmit, setAccept, setFile, setIsComposing, setIsUploading, setOnSubmit, setText, useFile, useIsUploading, useText };
|
|
@@ -3,14 +3,14 @@ export declare const Chat: {
|
|
|
3
3
|
Messages: ({ children, ...props }: import("@mantine/core").StackProps) => import("react/jsx-runtime").JSX.Element[];
|
|
4
4
|
Message: ({ messageId }: {
|
|
5
5
|
messageId: string;
|
|
6
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
7
|
File: ({ messageId }: {
|
|
8
8
|
messageId: string;
|
|
9
9
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
10
|
Loader: (props: import("@mantine/core").LoaderProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
11
11
|
Empty: () => import("react/jsx-runtime").JSX.Element | null;
|
|
12
12
|
Input: {
|
|
13
|
-
Root: ({ className, onSubmit,
|
|
13
|
+
Root: ({ className, onSubmit, isUploading, accept, ...props }: import("./chatInput/Root").ChatInputRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
Textarea: (props: import("@mantine/core").TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
Footer: (props: import("@mantine/core").GroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
Submit: ({ children, ...props }: import("@mantine/core").ActionIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,7 +7,7 @@ export declare const getChatMessages: <T extends UIMessage>() => T[];
|
|
|
7
7
|
export declare const setChatMessages: <T extends UIMessage>(messages: T[]) => void;
|
|
8
8
|
export declare const useChatMessageIds: <T extends UIMessage>(props?: UseChatOptions<T> & ChatInit<T>) => string[];
|
|
9
9
|
export declare const useChatMessage: <T extends UIMessage>(messageId: string) => T;
|
|
10
|
-
export declare const useChatMessagePart: <M extends UIMessage, T extends UIMessagePart<UIDataTypes, UITools>>(messageId: string, type?: T["type"]) => T;
|
|
10
|
+
export declare const useChatMessagePart: <M extends UIMessage, T extends UIMessagePart<UIDataTypes, UITools>>(messageId: string, type?: T["type"]) => T | undefined;
|
|
11
11
|
export type SendMessage = ({ text, file }: {
|
|
12
12
|
text: string;
|
|
13
13
|
file?: FileUIPart;
|
|
@@ -6,20 +6,20 @@ 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
|
+
dark?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
11
|
+
gray?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
12
|
+
pink?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
13
|
+
grape?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
14
|
+
violet?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
15
|
+
indigo?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
9
16
|
blue?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
10
17
|
cyan?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
11
|
-
gray?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
12
18
|
green?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
13
|
-
indigo?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
14
19
|
lime?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
20
|
+
yellow?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
15
21
|
orange?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
16
|
-
pink?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
17
|
-
red?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
18
22
|
teal?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
19
|
-
violet?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
20
|
-
yellow?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
21
|
-
dark?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
22
|
-
grape?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
23
23
|
} | undefined;
|
|
24
24
|
primaryShade?: import("@mantine/core").MantineColorShade | {
|
|
25
25
|
light?: import("@mantine/core").MantineColorShade | undefined;
|
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.28",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "rslib build",
|
|
18
18
|
"dev": "rslib build --watch",
|
|
19
|
-
"
|
|
19
|
+
"prepublishOnly": "bun run build",
|
|
20
20
|
"check": "biome check --write && tsgo --noEmit"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|