@rolder/kit 3.0.0-alpha.86 → 3.0.0-alpha.88

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.
@@ -68,11 +68,11 @@ ${fileContent}
68
68
  } catch (error) {
69
69
  fileErrorNotificaton(error);
70
70
  }
71
- if (onSubmit) onSubmit({
71
+ if (onSubmit && text.trim()) onSubmit({
72
72
  text,
73
73
  file: fileUIPart
74
74
  });
75
- sendMessage({
75
+ if (text.trim()) sendMessage({
76
76
  text,
77
77
  file: fileUIPart
78
78
  });
@@ -1,11 +1,13 @@
1
1
  export declare const Chat: {
2
2
  Root: ({ chatOptions, ...props }: import("./Root").ChatRootProps) => import("react/jsx-runtime").JSX.Element;
3
- Message: <TMessage extends import("ai").UIMessage>(props: import("./Message").MessageProps<TMessage>) => React.JSX.Element;
3
+ Message: <TMessage extends import("ai").UIMessage>(props: import("./messages").MessageProps<TMessage>) => React.JSX.Element;
4
4
  TextPart: import("react").MemoExoticComponent<({ part, role }: import("./parts").TextPartProps) => import("react/jsx-runtime").JSX.Element>;
5
5
  ToolPart: <TPart extends import("ai").ToolUIPart = {
6
6
  type: `tool-${string}`;
7
7
  } & import("ai").UIToolInvocation<import("ai").UITool>>(props: import("./parts").ToolPartProps<TPart>) => import("react").ReactNode;
8
- FilePart: ({ part, messageId }: import("./parts/File").FilePartProps) => import("react/jsx-runtime").JSX.Element | null;
8
+ 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
+ FilePart: import("react").MemoExoticComponent<({ part, messageId }: import("./parts/File").FilePartProps) => import("react/jsx-runtime").JSX.Element | null>;
10
+ PartPaper: ({ children, chatRole, ...props }: import("./parts").PartPaperProps) => import("react/jsx-runtime").JSX.Element;
9
11
  };
10
12
  export { ChatInput } from './chatInput';
11
13
  export * from './store';
@@ -1,6 +1,7 @@
1
- import { Message } from "./Message.js";
2
- import { TextPart, ToolPart } from "./parts/index.js";
1
+ import { Message } from "./messages/index.js";
2
+ import { PartPaper, TextPart, ToolPart } from "./parts/index.js";
3
3
  import { FilePart } from "./parts/File.js";
4
+ import { ToolExecution } from "./parts/ToolExecution.js";
4
5
  import { Root } from "./Root.js";
5
6
  import { ChatInput } from "./chatInput/index.js";
6
7
  export * from "./store/index.js";
@@ -9,6 +10,8 @@ const Chat = {
9
10
  Message: Message,
10
11
  TextPart: TextPart,
11
12
  ToolPart: ToolPart,
12
- FilePart: FilePart
13
+ ToolExecution: ToolExecution,
14
+ FilePart: FilePart,
15
+ PartPaper: PartPaper
13
16
  };
14
17
  export { Chat, ChatInput };
@@ -1,10 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Stack } from "@mantine/core";
3
3
  import { memo } from "react";
4
- import { useChatMessage } from "./store/index.js";
4
+ import { useChatMessage } from "../store/index.js";
5
5
  const Message = /*#__PURE__*/ memo(({ children, messageId, ...props })=>{
6
6
  const message = useChatMessage(messageId);
7
- console.log('Message render');
8
7
  return /*#__PURE__*/ jsx(Stack, {
9
8
  ...props,
10
9
  children: 'function' == typeof children ? children({
@@ -6,7 +6,6 @@ import { Empty } from "./Empty.js";
6
6
  import { Loader } from "./Loader.js";
7
7
  const Messages = ({ children, height, radius = 'md', padding = 'md', scrollAreaProps, withScrollButton = true, stackProps, emptyComponent, loaderComponent, ...props })=>{
8
8
  const messageIds = useChatMessageIds();
9
- console.log('Messages render');
10
9
  return /*#__PURE__*/ jsx(Paper, {
11
10
  withBorder: true,
12
11
  radius: radius,
@@ -1 +1,2 @@
1
+ export * from './Message';
1
2
  export * from './Messages';
@@ -1 +1,2 @@
1
+ export * from "./Message.js";
1
2
  export * from "./Messages.js";
@@ -3,4 +3,4 @@ export interface FilePartProps<TPart extends FileUIPart = FileUIPart> {
3
3
  part: TPart;
4
4
  messageId: string;
5
5
  }
6
- export declare const FilePart: ({ part, messageId }: FilePartProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ export declare const FilePart: import("react").MemoExoticComponent<({ part, messageId }: FilePartProps) => import("react/jsx-runtime").JSX.Element | null>;
@@ -1,7 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Image, Paper } from "@mantine/core";
3
+ import { memo } from "react";
3
4
  import { FileIcon } from "./FileIcon.js";
4
- const FilePart = ({ part, messageId })=>{
5
+ const FilePart = /*#__PURE__*/ memo(({ part, messageId })=>{
5
6
  const textFileType = messageId.split('-')[1];
6
7
  const FileComponent = ()=>{
7
8
  switch(textFileType){
@@ -37,5 +38,5 @@ const FilePart = ({ part, messageId })=>{
37
38
  bg: "var(--mantine-color-default-hover)",
38
39
  children: /*#__PURE__*/ jsx(FileComponent, {})
39
40
  }) : null;
40
- };
41
+ });
41
42
  export { FilePart };
@@ -0,0 +1,8 @@
1
+ import { type PaperProps } from '@mantine/core';
2
+ import type { UIMessage } from 'ai';
3
+ import type { ReactNode } from 'react';
4
+ export interface PartPaperProps extends PaperProps {
5
+ children: ReactNode;
6
+ chatRole: UIMessage['role'];
7
+ }
8
+ export declare const PartPaper: ({ children, chatRole, ...props }: PartPaperProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Paper } from "@mantine/core";
3
+ const PartPaper = ({ children, chatRole, ...props })=>/*#__PURE__*/ jsx(Paper, {
4
+ radius: "md",
5
+ px: "md",
6
+ py: "sm",
7
+ maw: "80%",
8
+ ml: 'user' === chatRole ? 'auto' : void 0,
9
+ bg: 'user' === chatRole ? 'var(--mantine-color-default-hover)' : 'var(--mantine-primary-color-light)',
10
+ fz: "sm",
11
+ ...props,
12
+ children: children
13
+ });
14
+ export { PartPaper };
@@ -1,21 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { Paper } from "@mantine/core";
3
2
  import { memo } from "react";
4
3
  import { Streamdown } from "streamdown";
5
- const TextPart = /*#__PURE__*/ memo(({ part, role })=>{
6
- console.log('TextPart render', part.text?.length);
7
- return /*#__PURE__*/ jsx(Paper, {
8
- radius: "md",
9
- px: "md",
10
- py: "sm",
11
- maw: "80%",
12
- ml: 'user' === role ? 'auto' : void 0,
13
- bg: 'user' === role ? 'var(--mantine-color-default-hover)' : 'var(--mantine-primary-color-light)',
14
- fz: "sm",
4
+ import { PartPaper } from "./PartPaper.js";
5
+ const TextPart = /*#__PURE__*/ memo(({ part, role })=>/*#__PURE__*/ jsx(PartPaper, {
6
+ chatRole: role,
15
7
  children: /*#__PURE__*/ jsx(Streamdown, {
16
8
  isAnimating: 'streaming' === part.state,
17
9
  children: part?.text
18
10
  })
19
- });
20
- });
11
+ }));
21
12
  export { TextPart };
@@ -0,0 +1,7 @@
1
+ import type { ToolUIPart } from 'ai';
2
+ import type { ReactNode } from 'react';
3
+ export interface ToolExecutionProps {
4
+ part: ToolUIPart;
5
+ onError?: (error: string) => ReactNode;
6
+ }
7
+ export declare const ToolExecution: ({ part, onError }: ToolExecutionProps) => 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;
@@ -0,0 +1,54 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Group, Loader, Text } from "@mantine/core";
3
+ import { IconCheck } from "@tabler/icons-react";
4
+ const ToolExecution = ({ part, onError })=>{
5
+ switch(part.state){
6
+ case 'input-available':
7
+ return /*#__PURE__*/ jsxs(Group, {
8
+ gap: "xs",
9
+ children: [
10
+ /*#__PURE__*/ jsx(Loader, {
11
+ size: 28,
12
+ type: "dots"
13
+ }),
14
+ /*#__PURE__*/ jsxs(Text, {
15
+ size: "sm",
16
+ children: [
17
+ 'Запускаю "',
18
+ part.title,
19
+ '"...'
20
+ ]
21
+ })
22
+ ]
23
+ });
24
+ case 'output-available':
25
+ return /*#__PURE__*/ jsxs(Group, {
26
+ gap: "xs",
27
+ children: [
28
+ /*#__PURE__*/ jsx(IconCheck, {
29
+ size: 28,
30
+ color: "green"
31
+ }),
32
+ /*#__PURE__*/ jsxs(Text, {
33
+ size: "sm",
34
+ children: [
35
+ '"',
36
+ part.title,
37
+ '" выполнен'
38
+ ]
39
+ })
40
+ ]
41
+ });
42
+ case 'output-error':
43
+ return onError ? onError(part.errorText) : /*#__PURE__*/ jsxs(Text, {
44
+ c: "red",
45
+ children: [
46
+ "Ошибка: ",
47
+ part.errorText
48
+ ]
49
+ });
50
+ default:
51
+ return null;
52
+ }
53
+ };
54
+ export { ToolExecution };
@@ -2,7 +2,6 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Loader, Text } from "@mantine/core";
3
3
  import { memo } from "react";
4
4
  const ToolPart = /*#__PURE__*/ memo(({ children, part, loader, onError })=>{
5
- console.log('ToolPart render', part.state);
6
5
  switch(part.state){
7
6
  case 'input-available':
8
7
  return loader || /*#__PURE__*/ jsx(Loader, {
@@ -1,2 +1,3 @@
1
+ export * from './PartPaper';
1
2
  export * from './TextPart';
2
3
  export * from './ToolPart';
@@ -1,2 +1,3 @@
1
+ export * from "./PartPaper.js";
1
2
  export * from "./TextPart.js";
2
3
  export * from "./ToolPart.js";
@@ -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 = ({ className, upIcon, downIcon })=>{
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,79 +1,79 @@
1
1
  {
2
- "name": "@rolder/kit",
3
- "version": "3.0.0-alpha.86",
4
- "type": "module",
5
- "exports": {
6
- ".": {
7
- "types": "./dist/index.d.ts",
8
- "import": "./dist/index.js"
9
- },
10
- "./styles.css": "./dist/styles.css"
11
- },
12
- "sideEffects": false,
13
- "files": [
14
- "dist"
15
- ],
16
- "scripts": {
17
- "build": "rslib build",
18
- "dev": "rslib build --watch",
19
- "prepublishOnly": "bun run build",
20
- "check": "biome check --write && tsgo --noEmit"
21
- },
22
- "devDependencies": {
23
- "@rsbuild/plugin-react": "^1.4.3",
24
- "@rslib/core": "^0.19.3",
25
- "@types/bun": "^1.3.6",
26
- "@types/js-cookie": "^3.0.6",
27
- "@types/omgopass": "^3.2.3",
28
- "@types/react": "^19.2.9",
29
- "@typescript/native-preview": "^7.0.0-dev.20260122.3",
30
- "typescript": "6.0.0-dev.20260122"
31
- },
32
- "peerDependencies": {
33
- "@ai-sdk/react": "^3.0.47",
34
- "@better-upload/client": "^3.0.12",
35
- "@better-upload/server": "^3.0.12",
36
- "@codemirror/lang-json": "^6.0.2",
37
- "@codemirror/lint": "^6.9.2",
38
- "@mantine/core": "^8.3.13",
39
- "@mantine/hooks": "^8.3.13",
40
- "@mantine/notifications": "^8.3.13",
41
- "@mantine/tiptap": "^8.3.13",
42
- "@nanostores/react": "^1.0.0",
43
- "@tanstack/react-form": "^1.27.7",
44
- "@tanstack/react-query": "^5.90.19",
45
- "@tanstack/react-router": "^1.154.7",
46
- "@tanstack/react-router-ssr-query": "^1.154.7",
47
- "@tanstack/react-start": "^1.154.7",
48
- "@tiptap/extension-highlight": "^3.16.0",
49
- "@tiptap/extension-placeholder": "^3.16.0",
50
- "@tiptap/extension-table": "^3.16.0",
51
- "@tiptap/extension-task-item": "^3.16.0",
52
- "@tiptap/extension-task-list": "^3.16.0",
53
- "@tiptap/extension-text-align": "^3.16.0",
54
- "@tiptap/react": "^3.16.0",
55
- "@tiptap/starter-kit": "^3.16.0",
56
- "@uiw/codemirror-theme-vscode": "^4.25.4",
57
- "@uiw/react-codemirror": "^4.25.4",
58
- "ai": "^6.0.45",
59
- "clsx": "^2.1.1",
60
- "js-cookie": "^3.0.5",
61
- "mammoth": "^1.11.0",
62
- "nanoid": "^5.1.6",
63
- "nanostores": "^1.1.0",
64
- "omgopass": "^3.2.1",
65
- "react": "^19.2.3",
66
- "react-dom": "^19.2.3",
67
- "streamdown": "^2.1.0",
68
- "surrealdb": "2.0.0-alpha.16",
69
- "xlsx": "^0.18.5",
70
- "zod": "^4.3.5"
71
- },
72
- "trustedDependencies": [
73
- "core-js",
74
- "esbuild"
75
- ],
76
- "dependencies": {
77
- "@tabler/icons-react": "^3.36.1"
78
- }
2
+ "name": "@rolder/kit",
3
+ "version": "3.0.0-alpha.88",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ },
10
+ "./styles.css": "./dist/styles.css"
11
+ },
12
+ "sideEffects": false,
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "build": "rslib build",
18
+ "dev": "rslib build --watch",
19
+ "prepublishOnly": "bun run build",
20
+ "check": "biome check --write && tsgo --noEmit"
21
+ },
22
+ "devDependencies": {
23
+ "@rsbuild/plugin-react": "^1.4.3",
24
+ "@rslib/core": "^0.19.3",
25
+ "@types/bun": "^1.3.6",
26
+ "@types/js-cookie": "^3.0.6",
27
+ "@types/omgopass": "^3.2.3",
28
+ "@types/react": "^19.2.9",
29
+ "@typescript/native-preview": "^7.0.0-dev.20260122.3",
30
+ "typescript": "6.0.0-dev.20260122"
31
+ },
32
+ "peerDependencies": {
33
+ "@ai-sdk/react": "^3.0.47",
34
+ "@better-upload/client": "^3.0.12",
35
+ "@better-upload/server": "^3.0.12",
36
+ "@codemirror/lang-json": "^6.0.2",
37
+ "@codemirror/lint": "^6.9.2",
38
+ "@mantine/core": "^8.3.13",
39
+ "@mantine/hooks": "^8.3.13",
40
+ "@mantine/notifications": "^8.3.13",
41
+ "@mantine/tiptap": "^8.3.13",
42
+ "@nanostores/react": "^1.0.0",
43
+ "@tanstack/react-form": "^1.27.7",
44
+ "@tanstack/react-query": "^5.90.19",
45
+ "@tanstack/react-router": "^1.154.7",
46
+ "@tanstack/react-router-ssr-query": "^1.154.7",
47
+ "@tanstack/react-start": "^1.154.7",
48
+ "@tiptap/extension-highlight": "^3.16.0",
49
+ "@tiptap/extension-placeholder": "^3.16.0",
50
+ "@tiptap/extension-table": "^3.16.0",
51
+ "@tiptap/extension-task-item": "^3.16.0",
52
+ "@tiptap/extension-task-list": "^3.16.0",
53
+ "@tiptap/extension-text-align": "^3.16.0",
54
+ "@tiptap/react": "^3.16.0",
55
+ "@tiptap/starter-kit": "^3.16.0",
56
+ "@uiw/codemirror-theme-vscode": "^4.25.4",
57
+ "@uiw/react-codemirror": "^4.25.4",
58
+ "ai": "^6.0.45",
59
+ "clsx": "^2.1.1",
60
+ "js-cookie": "^3.0.5",
61
+ "mammoth": "^1.11.0",
62
+ "nanoid": "^5.1.6",
63
+ "nanostores": "^1.1.0",
64
+ "omgopass": "^3.2.1",
65
+ "react": "^19.2.3",
66
+ "react-dom": "^19.2.3",
67
+ "streamdown": "^2.1.0",
68
+ "surrealdb": "2.0.0-alpha.16",
69
+ "xlsx": "^0.18.5",
70
+ "zod": "^4.3.5"
71
+ },
72
+ "trustedDependencies": [
73
+ "core-js",
74
+ "esbuild"
75
+ ],
76
+ "dependencies": {
77
+ "@tabler/icons-react": "^3.36.1"
78
+ }
79
79
  }