@rolder/kit 3.0.0-alpha.64 → 3.0.0-alpha.67

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.
@@ -1,7 +1,3 @@
1
- import { type LoaderProps } from '@mantine/core';
2
- type MessageProps = {
1
+ export declare const Message: import("react").MemoExoticComponent<({ messageId }: {
3
2
  messageId: string;
4
- loaderProps?: LoaderProps;
5
- };
6
- export declare const Message: import("react").MemoExoticComponent<({ messageId, loaderProps }: MessageProps) => import("react/jsx-runtime").JSX.Element | null>;
7
- export {};
3
+ }) => import("react/jsx-runtime").JSX.Element | null>;
@@ -1,32 +1,24 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { Paper } from "@mantine/core";
3
3
  import { memo } from "react";
4
4
  import { Streamdown } from "streamdown";
5
- import { Loader } from "./Loader.js";
6
5
  import { getIsStreaming, useChatMessage, useChatMessagePart } from "./store/index.js";
7
- const Message = /*#__PURE__*/ memo(({ messageId, loaderProps })=>{
6
+ const Message = /*#__PURE__*/ memo(({ messageId })=>{
8
7
  const message = useChatMessage(messageId);
9
8
  const part = useChatMessagePart(messageId, 'text');
10
9
  console.log(messageId);
11
- return part ? /*#__PURE__*/ jsxs(Fragment, {
12
- children: [
13
- /*#__PURE__*/ jsx(Paper, {
14
- radius: "md",
15
- px: "md",
16
- py: "sm",
17
- maw: "80%",
18
- ml: 'user' === message.role ? 'auto' : void 0,
19
- bg: 'user' === message.role ? 'var(--mantine-color-default-hover)' : 'var(--mantine-primary-color-light)',
20
- fz: "sm",
21
- children: /*#__PURE__*/ jsx(Streamdown, {
22
- isAnimating: getIsStreaming() && 'assistant' === message.role,
23
- children: part?.text
24
- })
25
- }),
26
- /*#__PURE__*/ jsx(Loader, {
27
- ...loaderProps
28
- })
29
- ]
10
+ return part ? /*#__PURE__*/ jsx(Paper, {
11
+ radius: "md",
12
+ px: "md",
13
+ py: "sm",
14
+ maw: "80%",
15
+ ml: 'user' === message.role ? 'auto' : void 0,
16
+ bg: 'user' === message.role ? 'var(--mantine-color-default-hover)' : 'var(--mantine-primary-color-light)',
17
+ fz: "sm",
18
+ children: /*#__PURE__*/ jsx(Streamdown, {
19
+ isAnimating: getIsStreaming() && 'assistant' === message.role,
20
+ children: part?.text
21
+ })
30
22
  }) : null;
31
23
  });
32
24
  export { Message };
@@ -1,7 +1,11 @@
1
1
  import { type StackProps } from '@mantine/core';
2
2
  import type { ReactNode } from 'react';
3
- type MessagesProps = Omit<StackProps, 'children'> & {
3
+ import { type ScrollAreaProps } from '../../../ui';
4
+ type MessagesProps = {
4
5
  children: (messageId: string) => ReactNode;
6
+ scrollAreaProps?: ScrollAreaProps;
7
+ withScrollButton?: boolean;
8
+ stackProps?: StackProps;
5
9
  };
6
- export declare const Messages: ({ children, ...props }: MessagesProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const Messages: ({ children, scrollAreaProps, withScrollButton, stackProps, }: MessagesProps) => import("react/jsx-runtime").JSX.Element;
7
11
  export {};
@@ -1,11 +1,21 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Stack } from "@mantine/core";
3
+ import { ScrollArea } from "../../../ui/index.js";
3
4
  import { useChatMessageIds } from "./store/index.js";
4
- const Messages = ({ children, ...props })=>{
5
+ const Messages = ({ children, scrollAreaProps, withScrollButton = true, stackProps })=>{
5
6
  const messageIds = useChatMessageIds();
6
- return /*#__PURE__*/ jsx(Stack, {
7
- ...props,
8
- children: 'function' == typeof children ? messageIds.map((messageId)=>children(messageId)) : null
7
+ return /*#__PURE__*/ jsxs(ScrollArea, {
8
+ autoScroll: true,
9
+ scrollToBottomOnInit: true,
10
+ p: "md",
11
+ ...scrollAreaProps,
12
+ children: [
13
+ /*#__PURE__*/ jsx(Stack, {
14
+ ...stackProps,
15
+ children: 'function' == typeof children ? messageIds.map((messageId)=>children(messageId)) : null
16
+ }),
17
+ withScrollButton && /*#__PURE__*/ jsx(ScrollArea.ScrollButton, {})
18
+ ]
9
19
  });
10
20
  };
11
21
  export { Messages };
@@ -1,11 +1,8 @@
1
1
  import type { UseChatOptions } from '@ai-sdk/react';
2
2
  import { type PaperProps } from '@mantine/core';
3
3
  import type { ChatInit, UIMessage } from 'ai';
4
- import { type ScrollAreaProps } from '../../../ui';
5
4
  export interface ConversationRootProps extends PaperProps {
6
5
  children?: React.ReactNode;
7
- scrollAreaProps?: ScrollAreaProps;
8
- withScrollButton?: boolean;
9
6
  chatOptions?: UseChatOptions<UIMessage> & ChatInit<UIMessage>;
10
7
  }
11
- export declare const Root: ({ children, scrollAreaProps, withScrollButton, chatOptions, ...props }: ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const Root: ({ children, chatOptions, ...props }: ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,11 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Paper } from "@mantine/core";
3
- import { ScrollArea } from "../../../ui/index.js";
4
3
  import { useInitChat } from "./store/index.js";
5
4
  const ChatInitializer = ({ chatOptions })=>{
6
5
  useInitChat(chatOptions);
7
6
  return null;
8
7
  };
9
- const Root = ({ children, scrollAreaProps, withScrollButton = true, chatOptions, ...props })=>/*#__PURE__*/ jsxs(Fragment, {
8
+ const Root = ({ children, chatOptions, ...props })=>/*#__PURE__*/ jsxs(Fragment, {
10
9
  children: [
11
10
  /*#__PURE__*/ jsx(ChatInitializer, {
12
11
  chatOptions: chatOptions
@@ -15,16 +14,7 @@ const Root = ({ children, scrollAreaProps, withScrollButton = true, chatOptions,
15
14
  withBorder: true,
16
15
  radius: "md",
17
16
  ...props,
18
- children: /*#__PURE__*/ jsxs(ScrollArea, {
19
- autoScroll: true,
20
- scrollToBottomOnInit: true,
21
- p: "md",
22
- ...scrollAreaProps,
23
- children: [
24
- children,
25
- withScrollButton && /*#__PURE__*/ jsx(ScrollArea.ScrollButton, {})
26
- ]
27
- })
17
+ children: children
28
18
  })
29
19
  ]
30
20
  });
@@ -1,16 +1,19 @@
1
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"> & {
2
+ Root: ({ children, chatOptions, ...props }: import("./Root").ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
3
+ Messages: ({ children, scrollAreaProps, withScrollButton, stackProps, }: {
4
4
  children: (messageId: string) => import("react").ReactNode;
5
+ scrollAreaProps?: import("../../..").ScrollAreaProps;
6
+ withScrollButton?: boolean;
7
+ stackProps?: import("@mantine/core").StackProps;
5
8
  }) => import("react/jsx-runtime").JSX.Element;
6
- Message: import("react").MemoExoticComponent<({ messageId, loaderProps }: {
9
+ Message: import("react").MemoExoticComponent<({ messageId }: {
7
10
  messageId: string;
8
- loaderProps?: import("@mantine/core").LoaderProps;
9
11
  }) => import("react/jsx-runtime").JSX.Element | null>;
10
12
  File: ({ messageId }: {
11
13
  messageId: string;
12
14
  }) => import("react/jsx-runtime").JSX.Element | null;
13
15
  Empty: () => import("react/jsx-runtime").JSX.Element | null;
16
+ Loader: (props: import("@mantine/core").LoaderProps) => import("react/jsx-runtime").JSX.Element | null;
14
17
  };
15
18
  export { ChatInput } from './chatInput';
16
19
  export * from './store';
@@ -1,5 +1,6 @@
1
1
  import { Empty } from "./Empty.js";
2
2
  import { File } from "./File.js";
3
+ import { Loader } from "./Loader.js";
3
4
  import { Message } from "./Message.js";
4
5
  import { Messages } from "./Messages.js";
5
6
  import { Root } from "./Root.js";
@@ -10,6 +11,7 @@ const Chat = {
10
11
  Messages: Messages,
11
12
  Message: Message,
12
13
  File: File,
13
- Empty: Empty
14
+ Empty: Empty,
15
+ Loader: Loader
14
16
  };
15
17
  export { Chat, ChatInput };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolder/kit",
3
- "version": "3.0.0-alpha.64",
3
+ "version": "3.0.0-alpha.67",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {