@assistant-ui/react 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +41 -15
- package/dist/index.d.ts +41 -15
- package/dist/index.js +291 -259
- package/dist/index.mjs +279 -247
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
@@ -1,13 +1,8 @@
|
|
1
|
-
import { UseChatHelpers } from 'ai/react';
|
2
1
|
import * as react from 'react';
|
3
2
|
import { FC, PropsWithChildren } from 'react';
|
3
|
+
import { TextareaAutosizeProps } from 'react-textarea-autosize';
|
4
4
|
import { Message } from 'ai';
|
5
|
-
|
6
|
-
type ThreadProviderProps = {
|
7
|
-
chat: UseChatHelpers;
|
8
|
-
children: React.ReactNode;
|
9
|
-
};
|
10
|
-
declare const ThreadProvider: FC<ThreadProviderProps>;
|
5
|
+
import { UseChatHelpers } from 'ai/react';
|
11
6
|
|
12
7
|
declare const ThreadRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
13
8
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
@@ -39,13 +34,16 @@ declare const ThreadViewport: react.ForwardRefExoticComponent<Pick<Omit<react.De
|
|
39
34
|
|
40
35
|
type ThreadMessagesProps = {
|
41
36
|
components: {
|
42
|
-
Message: React.ComponentType
|
37
|
+
Message: React.ComponentType;
|
38
|
+
} | {
|
39
|
+
UserMessage: React.ComponentType;
|
40
|
+
AssistantMessage: React.ComponentType;
|
43
41
|
};
|
44
42
|
};
|
45
43
|
declare const ThreadMessages: FC<ThreadMessagesProps>;
|
46
44
|
|
47
45
|
declare namespace index$5 {
|
48
|
-
export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages,
|
46
|
+
export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages, ThreadRoot as Root, ThreadViewport as Viewport };
|
49
47
|
}
|
50
48
|
|
51
49
|
declare const ComposerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & {
|
@@ -54,7 +52,7 @@ declare const ComposerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.Deta
|
|
54
52
|
asChild?: boolean;
|
55
53
|
}, "key" | "asChild" | keyof react.FormHTMLAttributes<HTMLFormElement>> & react.RefAttributes<HTMLFormElement>>;
|
56
54
|
|
57
|
-
declare const ComposerInput: react.ForwardRefExoticComponent<
|
55
|
+
declare const ComposerInput: react.ForwardRefExoticComponent<TextareaAutosizeProps & {
|
58
56
|
asChild?: boolean;
|
59
57
|
} & react.RefAttributes<HTMLTextAreaElement>>;
|
60
58
|
|
@@ -101,7 +99,7 @@ declare const MessageIf: FC<MessageIfProps>;
|
|
101
99
|
|
102
100
|
declare const MessageContent: FC;
|
103
101
|
|
104
|
-
declare const MessageEditableContent: react.ForwardRefExoticComponent<
|
102
|
+
declare const MessageEditableContent: react.ForwardRefExoticComponent<TextareaAutosizeProps & react.RefAttributes<HTMLTextAreaElement>>;
|
105
103
|
|
106
104
|
declare namespace index$3 {
|
107
105
|
export { MessageContent as Content, MessageEditableContent as EditableContent, MessageIf as If, MessageProvider as Provider, MessageRoot as Root };
|
@@ -127,7 +125,9 @@ declare const BranchPickerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.
|
|
127
125
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
128
126
|
} & {
|
129
127
|
asChild?: boolean;
|
130
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> &
|
128
|
+
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
129
|
+
hideWhenSingleBranch?: boolean;
|
130
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
131
131
|
|
132
132
|
declare namespace index$2 {
|
133
133
|
export { BranchPickerCount as Count, BranchPickerNext as Next, BranchPickerNumber as Number, BranchPickerPrevious as Previous, BranchPickerRoot as Root };
|
@@ -137,7 +137,9 @@ declare const ActionBarRoot: react.ForwardRefExoticComponent<Pick<Omit<react.Det
|
|
137
137
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
138
138
|
} & {
|
139
139
|
asChild?: boolean;
|
140
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> &
|
140
|
+
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
141
|
+
hideWhenEditing?: boolean;
|
142
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
141
143
|
|
142
144
|
type ActionBarCopyProps = {
|
143
145
|
copiedDuration?: number;
|
@@ -168,7 +170,9 @@ declare const EditBarRoot: react.ForwardRefExoticComponent<Pick<Omit<react.Detai
|
|
168
170
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
169
171
|
} & {
|
170
172
|
asChild?: boolean;
|
171
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> &
|
173
|
+
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
174
|
+
hideWhenNotEditing?: boolean;
|
175
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
172
176
|
|
173
177
|
declare const EditBarSave: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
174
178
|
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
@@ -186,6 +190,12 @@ declare namespace index {
|
|
186
190
|
export { EditBarCancel as Cancel, EditBarRoot as Root, EditBarSave as Save };
|
187
191
|
}
|
188
192
|
|
193
|
+
type ThreadProviderProps = {
|
194
|
+
chat: UseChatHelpers;
|
195
|
+
children: React.ReactNode;
|
196
|
+
};
|
197
|
+
declare const VercelAIThreadProvider: FC<ThreadProviderProps>;
|
198
|
+
|
189
199
|
type BranchState = {
|
190
200
|
branchId: number;
|
191
201
|
branchCount: number;
|
@@ -209,4 +219,20 @@ type MessageStore = {
|
|
209
219
|
};
|
210
220
|
declare const useMessageContext: <Selection>(consumerName: string, selector: (s: MessageStore) => Selection) => Selection;
|
211
221
|
|
212
|
-
|
222
|
+
declare const useCopyMessage: ({ copiedDuration }: {
|
223
|
+
copiedDuration?: number | undefined;
|
224
|
+
}) => () => void;
|
225
|
+
|
226
|
+
declare const useReloadMessage: () => (() => Promise<void>) | null;
|
227
|
+
|
228
|
+
declare const useBeginMessageEdit: () => (() => void) | null;
|
229
|
+
|
230
|
+
declare const useCancelMessageEdit: () => (() => void) | null;
|
231
|
+
|
232
|
+
declare const useSaveMessageEdit: () => (() => void) | null;
|
233
|
+
|
234
|
+
declare const useGoToNextBranch: () => (() => void) | null;
|
235
|
+
|
236
|
+
declare const useGoToPreviousBranch: () => (() => void) | null;
|
237
|
+
|
238
|
+
export { index$1 as ActionBarPrimitive, index$2 as BranchPickerPrimitive, index$4 as ComposerPrimitive, index as EditBarPrimitive, index$3 as MessagePrimitive, index$5 as ThreadPrimitive, VercelAIThreadProvider, useMessageContext as unstable_useMessageContext, useBeginMessageEdit, useCancelMessageEdit, useCopyMessage, useGoToNextBranch, useGoToPreviousBranch, useReloadMessage, useSaveMessageEdit };
|
package/dist/index.d.ts
CHANGED
@@ -1,13 +1,8 @@
|
|
1
|
-
import { UseChatHelpers } from 'ai/react';
|
2
1
|
import * as react from 'react';
|
3
2
|
import { FC, PropsWithChildren } from 'react';
|
3
|
+
import { TextareaAutosizeProps } from 'react-textarea-autosize';
|
4
4
|
import { Message } from 'ai';
|
5
|
-
|
6
|
-
type ThreadProviderProps = {
|
7
|
-
chat: UseChatHelpers;
|
8
|
-
children: React.ReactNode;
|
9
|
-
};
|
10
|
-
declare const ThreadProvider: FC<ThreadProviderProps>;
|
5
|
+
import { UseChatHelpers } from 'ai/react';
|
11
6
|
|
12
7
|
declare const ThreadRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
13
8
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
@@ -39,13 +34,16 @@ declare const ThreadViewport: react.ForwardRefExoticComponent<Pick<Omit<react.De
|
|
39
34
|
|
40
35
|
type ThreadMessagesProps = {
|
41
36
|
components: {
|
42
|
-
Message: React.ComponentType
|
37
|
+
Message: React.ComponentType;
|
38
|
+
} | {
|
39
|
+
UserMessage: React.ComponentType;
|
40
|
+
AssistantMessage: React.ComponentType;
|
43
41
|
};
|
44
42
|
};
|
45
43
|
declare const ThreadMessages: FC<ThreadMessagesProps>;
|
46
44
|
|
47
45
|
declare namespace index$5 {
|
48
|
-
export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages,
|
46
|
+
export { ThreadEmpty as Empty, ThreadIf as If, ThreadMessages as Messages, ThreadRoot as Root, ThreadViewport as Viewport };
|
49
47
|
}
|
50
48
|
|
51
49
|
declare const ComposerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & {
|
@@ -54,7 +52,7 @@ declare const ComposerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.Deta
|
|
54
52
|
asChild?: boolean;
|
55
53
|
}, "key" | "asChild" | keyof react.FormHTMLAttributes<HTMLFormElement>> & react.RefAttributes<HTMLFormElement>>;
|
56
54
|
|
57
|
-
declare const ComposerInput: react.ForwardRefExoticComponent<
|
55
|
+
declare const ComposerInput: react.ForwardRefExoticComponent<TextareaAutosizeProps & {
|
58
56
|
asChild?: boolean;
|
59
57
|
} & react.RefAttributes<HTMLTextAreaElement>>;
|
60
58
|
|
@@ -101,7 +99,7 @@ declare const MessageIf: FC<MessageIfProps>;
|
|
101
99
|
|
102
100
|
declare const MessageContent: FC;
|
103
101
|
|
104
|
-
declare const MessageEditableContent: react.ForwardRefExoticComponent<
|
102
|
+
declare const MessageEditableContent: react.ForwardRefExoticComponent<TextareaAutosizeProps & react.RefAttributes<HTMLTextAreaElement>>;
|
105
103
|
|
106
104
|
declare namespace index$3 {
|
107
105
|
export { MessageContent as Content, MessageEditableContent as EditableContent, MessageIf as If, MessageProvider as Provider, MessageRoot as Root };
|
@@ -127,7 +125,9 @@ declare const BranchPickerRoot: react.ForwardRefExoticComponent<Pick<Omit<react.
|
|
127
125
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
128
126
|
} & {
|
129
127
|
asChild?: boolean;
|
130
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> &
|
128
|
+
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
129
|
+
hideWhenSingleBranch?: boolean;
|
130
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
131
131
|
|
132
132
|
declare namespace index$2 {
|
133
133
|
export { BranchPickerCount as Count, BranchPickerNext as Next, BranchPickerNumber as Number, BranchPickerPrevious as Previous, BranchPickerRoot as Root };
|
@@ -137,7 +137,9 @@ declare const ActionBarRoot: react.ForwardRefExoticComponent<Pick<Omit<react.Det
|
|
137
137
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
138
138
|
} & {
|
139
139
|
asChild?: boolean;
|
140
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> &
|
140
|
+
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
141
|
+
hideWhenEditing?: boolean;
|
142
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
141
143
|
|
142
144
|
type ActionBarCopyProps = {
|
143
145
|
copiedDuration?: number;
|
@@ -168,7 +170,9 @@ declare const EditBarRoot: react.ForwardRefExoticComponent<Pick<Omit<react.Detai
|
|
168
170
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
169
171
|
} & {
|
170
172
|
asChild?: boolean;
|
171
|
-
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> &
|
173
|
+
}, "key" | keyof react.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
174
|
+
hideWhenNotEditing?: boolean;
|
175
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
172
176
|
|
173
177
|
declare const EditBarSave: react.ForwardRefExoticComponent<Pick<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
174
178
|
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
@@ -186,6 +190,12 @@ declare namespace index {
|
|
186
190
|
export { EditBarCancel as Cancel, EditBarRoot as Root, EditBarSave as Save };
|
187
191
|
}
|
188
192
|
|
193
|
+
type ThreadProviderProps = {
|
194
|
+
chat: UseChatHelpers;
|
195
|
+
children: React.ReactNode;
|
196
|
+
};
|
197
|
+
declare const VercelAIThreadProvider: FC<ThreadProviderProps>;
|
198
|
+
|
189
199
|
type BranchState = {
|
190
200
|
branchId: number;
|
191
201
|
branchCount: number;
|
@@ -209,4 +219,20 @@ type MessageStore = {
|
|
209
219
|
};
|
210
220
|
declare const useMessageContext: <Selection>(consumerName: string, selector: (s: MessageStore) => Selection) => Selection;
|
211
221
|
|
212
|
-
|
222
|
+
declare const useCopyMessage: ({ copiedDuration }: {
|
223
|
+
copiedDuration?: number | undefined;
|
224
|
+
}) => () => void;
|
225
|
+
|
226
|
+
declare const useReloadMessage: () => (() => Promise<void>) | null;
|
227
|
+
|
228
|
+
declare const useBeginMessageEdit: () => (() => void) | null;
|
229
|
+
|
230
|
+
declare const useCancelMessageEdit: () => (() => void) | null;
|
231
|
+
|
232
|
+
declare const useSaveMessageEdit: () => (() => void) | null;
|
233
|
+
|
234
|
+
declare const useGoToNextBranch: () => (() => void) | null;
|
235
|
+
|
236
|
+
declare const useGoToPreviousBranch: () => (() => void) | null;
|
237
|
+
|
238
|
+
export { index$1 as ActionBarPrimitive, index$2 as BranchPickerPrimitive, index$4 as ComposerPrimitive, index as EditBarPrimitive, index$3 as MessagePrimitive, index$5 as ThreadPrimitive, VercelAIThreadProvider, useMessageContext as unstable_useMessageContext, useBeginMessageEdit, useCancelMessageEdit, useCopyMessage, useGoToNextBranch, useGoToPreviousBranch, useReloadMessage, useSaveMessageEdit };
|