@mastra/playground-ui 2.0.1-alpha.1 → 2.0.1-alpha.2

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.
@@ -11,6 +11,8 @@ export interface PollingOptions<TData, TError = Error> {
11
11
  onError?: (error: TError) => void;
12
12
  /** Function to determine if polling should continue */
13
13
  shouldContinue?: (data: TData) => boolean;
14
+ /** Restarts the polling when true */
15
+ restartPolling?: boolean;
14
16
  }
15
17
  export interface PollingResult<TData, TError> {
16
18
  /** Current polling status */
@@ -27,6 +29,8 @@ export interface PollingResult<TData, TError> {
27
29
  startPolling: () => void;
28
30
  /** Function to stop polling */
29
31
  stopPolling: () => void;
32
+ /** Refetch the data on demand with/without polling. default is false */
33
+ refetch: (withPolling?: boolean) => void;
30
34
  }
31
- export declare function usePolling<TData, TError = Error>({ fetchFn, interval, enabled, onSuccess, onError, shouldContinue, }: PollingOptions<TData, TError>): PollingResult<TData, TError>;
35
+ export declare function usePolling<TData, TError = Error>({ fetchFn, interval, enabled, onSuccess, onError, shouldContinue, restartPolling, }: PollingOptions<TData, TError>): PollingResult<TData, TError>;
32
36
  export default usePolling;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mastra/playground-ui",
3
3
  "type": "module",
4
- "version": "2.0.1-alpha.1",
4
+ "version": "2.0.1-alpha.2",
5
5
  "description": "Mastra Playground components",
6
6
  "main": "dist/index.umd.js",
7
7
  "module": "dist/index.es.js",
@@ -75,14 +75,14 @@
75
75
  "use-debounce": "^10.0.4",
76
76
  "zod": "^3.24.2",
77
77
  "zustand": "^5.0.3",
78
- "@mastra/client-js": "^0.1.9-alpha.1"
78
+ "@mastra/client-js": "^0.1.9-alpha.2"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "lucide-react": "^0.474.0",
82
82
  "react": ">=19.0.0",
83
83
  "react-dom": ">=19.0.0",
84
84
  "tailwindcss": "^3.0.0",
85
- "@mastra/core": "^0.6.1-alpha.1"
85
+ "@mastra/core": "^0.6.1-alpha.2"
86
86
  },
87
87
  "devDependencies": {
88
88
  "@types/node": "^22.13.10",
@@ -1,52 +0,0 @@
1
- import { default as React, ReactElement } from '../../node_modules/@types/react';
2
- import { Message } from './chat-message';
3
-
4
- interface ChatPropsBase {
5
- handleSubmit: (event?: {
6
- preventDefault?: () => void;
7
- }, options?: {
8
- experimental_attachments?: FileList;
9
- }) => void;
10
- messages: Array<Message>;
11
- input: string;
12
- className?: string;
13
- handleInputChange: React.ChangeEventHandler<HTMLTextAreaElement>;
14
- isGenerating: boolean;
15
- stop?: () => void;
16
- onRateResponse?: (messageId: string, rating: 'thumbs-up' | 'thumbs-down') => void;
17
- }
18
- interface ChatPropsWithoutSuggestions extends ChatPropsBase {
19
- append?: never;
20
- suggestions?: never;
21
- }
22
- interface ChatPropsWithSuggestions extends ChatPropsBase {
23
- append: (message: {
24
- role: 'user';
25
- content: string;
26
- }) => void;
27
- suggestions: string[];
28
- }
29
- type ChatProps = ChatPropsWithoutSuggestions | ChatPropsWithSuggestions;
30
- export declare function Chat({ messages, handleSubmit, input, handleInputChange, stop, isGenerating, append, suggestions, className, onRateResponse, }: ChatProps): import("react/jsx-runtime").JSX.Element;
31
- export declare namespace Chat {
32
- var displayName: string;
33
- }
34
- export declare function ChatMessages({ messages, children, }: React.PropsWithChildren<{
35
- messages: Message[];
36
- }>): import("react/jsx-runtime").JSX.Element;
37
- export declare const ChatContainer: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
38
- interface ChatFormProps {
39
- className?: string;
40
- isPending: boolean;
41
- handleSubmit: (event?: {
42
- preventDefault?: () => void;
43
- }, options?: {
44
- experimental_attachments?: FileList;
45
- }) => void;
46
- children: (props: {
47
- files: File[] | null;
48
- setFiles: React.Dispatch<React.SetStateAction<File[] | null>>;
49
- }) => ReactElement;
50
- }
51
- export declare const ChatForm: React.ForwardRefExoticComponent<ChatFormProps & React.RefAttributes<HTMLFormElement>>;
52
- export {};
@@ -1,30 +0,0 @@
1
- import { VariantProps } from 'class-variance-authority';
2
- import { default as React } from '../../node_modules/@types/react';
3
-
4
- declare const chatBubbleVariants: (props?: ({
5
- isUser?: boolean | null | undefined;
6
- isError?: boolean | null | undefined;
7
- animation?: "none" | "scale" | "slide" | "fade" | null | undefined;
8
- } & import('class-variance-authority/types').ClassProp) | undefined) => string;
9
- type Animation = VariantProps<typeof chatBubbleVariants>['animation'];
10
- interface Attachment {
11
- name?: string;
12
- contentType?: string;
13
- url: string;
14
- }
15
- export interface Message {
16
- id?: string;
17
- role?: 'user' | 'assistant';
18
- content: string;
19
- isError?: boolean;
20
- createdAt?: Date;
21
- }
22
- export interface ChatMessageProps extends Message {
23
- showTimeStamp?: boolean;
24
- animation?: Animation;
25
- actions?: React.ReactNode;
26
- className?: string;
27
- experimental_attachments?: Attachment[];
28
- }
29
- export declare const ChatMessage: React.FC<ChatMessageProps>;
30
- export {};
@@ -1,3 +0,0 @@
1
- import { ChatProps } from './types';
2
-
3
- export declare function Chat({ agentId, initialMessages, agentName, threadId, memory, buildUrl }: ChatProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +0,0 @@
1
- type CopyButtonProps = {
2
- content: string;
3
- copyMessage?: string;
4
- classname?: string;
5
- };
6
- export declare function CopyButton({ content, copyMessage, classname }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,8 +0,0 @@
1
- import { default as React } from '../../node_modules/@types/react';
2
-
3
- interface FilePreviewProps {
4
- file: File;
5
- onRemove?: () => void;
6
- }
7
- export declare const FilePreview: React.ForwardRefExoticComponent<FilePreviewProps & React.RefAttributes<HTMLDivElement>>;
8
- export {};
@@ -1,7 +0,0 @@
1
- export declare function useAutoScroll(dependencies: React.DependencyList): {
2
- containerRef: import('../../../node_modules/@types/react').RefObject<HTMLDivElement | null>;
3
- scrollToBottom: () => void;
4
- handleScroll: () => void;
5
- shouldAutoScroll: boolean;
6
- handleTouchStart: () => void;
7
- };
@@ -1,8 +0,0 @@
1
- interface UseAutosizeTextAreaProps {
2
- ref: React.RefObject<HTMLTextAreaElement>;
3
- maxHeight?: number;
4
- borderWidth?: number;
5
- dependencies: React.DependencyList;
6
- }
7
- export declare function useAutosizeTextArea({ ref, maxHeight, borderWidth, dependencies, }: UseAutosizeTextAreaProps): void;
8
- export {};
@@ -1,10 +0,0 @@
1
- type UseCopyToClipboardProps = {
2
- text: string;
3
- copyMessage?: string;
4
- };
5
- export declare function useCopyToClipboard({ text, copyMessage }: UseCopyToClipboardProps): {
6
- isCopied: boolean;
7
- handleCopy: () => void;
8
- error: string;
9
- };
10
- export {};
@@ -1,88 +0,0 @@
1
- import { default as React } from '../../node_modules/@types/react';
2
-
3
- interface MarkdownRendererProps {
4
- children?: string;
5
- }
6
- export declare function MarkdownRenderer({ children }: MarkdownRendererProps): import("react/jsx-runtime").JSX.Element;
7
- interface CodeBlockProps extends React.HTMLAttributes<HTMLPreElement> {
8
- children: React.ReactNode;
9
- className?: string;
10
- language: string;
11
- }
12
- export declare const CodeBlock: ({ children, className, language, ...restProps }: CodeBlockProps) => import("react/jsx-runtime").JSX.Element;
13
- export declare const COMPONENTS: {
14
- h1: {
15
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
16
- displayName: any;
17
- };
18
- h2: {
19
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
20
- displayName: any;
21
- };
22
- h3: {
23
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
24
- displayName: any;
25
- };
26
- h4: {
27
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
28
- displayName: any;
29
- };
30
- h5: {
31
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
32
- displayName: any;
33
- };
34
- strong: {
35
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
36
- displayName: any;
37
- };
38
- a: {
39
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
40
- displayName: any;
41
- };
42
- blockquote: {
43
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
44
- displayName: any;
45
- };
46
- code: ({ children, className, ...rest }: {
47
- children?: React.ReactNode;
48
- className?: string;
49
- }) => import("react/jsx-runtime").JSX.Element;
50
- pre: ({ children }: any) => any;
51
- ol: {
52
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
53
- displayName: any;
54
- };
55
- ul: {
56
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
57
- displayName: any;
58
- };
59
- li: {
60
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
61
- displayName: any;
62
- };
63
- table: {
64
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
65
- displayName: any;
66
- };
67
- th: {
68
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
69
- displayName: any;
70
- };
71
- td: {
72
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
73
- displayName: any;
74
- };
75
- tr: {
76
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
77
- displayName: any;
78
- };
79
- p: {
80
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
81
- displayName: any;
82
- };
83
- hr: {
84
- ({ node, ...props }: any): import("react/jsx-runtime").JSX.Element;
85
- displayName: any;
86
- };
87
- };
88
- export default MarkdownRenderer;
@@ -1,4 +0,0 @@
1
- export declare const MarkdownCodeBlock: ({ node, inline, className, children, ...props }: any) => import("react/jsx-runtime").JSX.Element;
2
- export declare const Markdown: import('../../node_modules/@types/react').MemoExoticComponent<({ children }: {
3
- children?: string;
4
- }) => import("react/jsx-runtime").JSX.Element>;
@@ -1,22 +0,0 @@
1
- import { default as React } from '../../node_modules/@types/react';
2
-
3
- interface MessageInputBaseProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
4
- value: string;
5
- submitOnEnter?: boolean;
6
- stop?: () => void;
7
- isGenerating: boolean;
8
- }
9
- interface MessageInputWithoutAttachmentProps extends MessageInputBaseProps {
10
- allowAttachments?: false;
11
- }
12
- interface MessageInputWithAttachmentsProps extends MessageInputBaseProps {
13
- allowAttachments: true;
14
- files: File[] | null;
15
- setFiles: React.Dispatch<React.SetStateAction<File[] | null>>;
16
- }
17
- type MessageInputProps = MessageInputWithoutAttachmentProps | MessageInputWithAttachmentsProps;
18
- export declare function MessageInput({ placeholder, className, onKeyDown: onKeyDownProp, submitOnEnter, stop, isGenerating, ...props }: MessageInputProps): import("react/jsx-runtime").JSX.Element;
19
- export declare namespace MessageInput {
20
- var displayName: string;
21
- }
22
- export {};
@@ -1,11 +0,0 @@
1
- import { ChatMessageProps, Message } from './chat-message';
2
-
3
- type AdditionalMessageOptions = Omit<ChatMessageProps, keyof Message>;
4
- interface MessageListProps {
5
- messages: Message[];
6
- showTimeStamps?: boolean;
7
- isTyping?: boolean;
8
- messageOptions?: AdditionalMessageOptions | ((message: Message) => AdditionalMessageOptions);
9
- }
10
- export declare function MessageList({ messages, showTimeStamps, isTyping, messageOptions }: MessageListProps): import("react/jsx-runtime").JSX.Element;
11
- export {};
@@ -1,11 +0,0 @@
1
- interface PromptSuggestionsProps {
2
- label: string;
3
- append: (message: {
4
- role: 'user';
5
- content: string;
6
- }) => void;
7
- suggestions: string[];
8
- memoryIsPresent?: boolean;
9
- }
10
- export declare function PromptSuggestions({ append, suggestions, memoryIsPresent }: PromptSuggestionsProps): import("react/jsx-runtime").JSX.Element;
11
- export {};
@@ -1 +0,0 @@
1
- export declare function highlight(code: string, language: string): Promise<import('shiki').ThemedToken[][] | null>;
@@ -1,14 +0,0 @@
1
- export interface Message {
2
- id: string;
3
- role: 'user' | 'assistant';
4
- content: string;
5
- isError?: boolean;
6
- }
7
- export interface ChatProps {
8
- agentId: string;
9
- agentName?: string;
10
- threadId?: string;
11
- initialMessages?: Message[];
12
- memory?: boolean;
13
- buildUrl?: string;
14
- }
@@ -1 +0,0 @@
1
- export declare function TypingIndicator(): import("react/jsx-runtime").JSX.Element;