@rolder/kit 3.0.0-alpha.63 → 3.0.0-alpha.66

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(Loader, {
14
- ...loaderProps
15
- }),
16
- /*#__PURE__*/ jsx(Paper, {
17
- radius: "md",
18
- px: "md",
19
- py: "sm",
20
- maw: "80%",
21
- ml: 'user' === message.role ? 'auto' : void 0,
22
- bg: 'user' === message.role ? 'var(--mantine-color-default-hover)' : 'var(--mantine-primary-color-light)',
23
- fz: "sm",
24
- children: /*#__PURE__*/ jsx(Streamdown, {
25
- isAnimating: getIsStreaming() && 'assistant' === message.role,
26
- children: part?.text
27
- })
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, 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,16 +1,19 @@
1
1
  export declare const Chat: {
2
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"> & {
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.63",
3
+ "version": "3.0.0-alpha.66",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {