@assistant-ui/react 0.1.9 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -1,22 +1,77 @@
1
1
  import * as react from 'react';
2
2
  import { FC, ReactNode, PropsWithChildren, ComponentType, ComponentPropsWithoutRef } from 'react';
3
3
  import { TextareaAutosizeProps } from 'react-textarea-autosize';
4
- import { T as TextContentPartComponent, I as ImageContentPartComponent, U as UIContentPartComponent, a as ToolCallContentPartComponent, b as ToolCallContentPartProps, c as ThreadState, d as ThreadActionsState, e as Unsubscribe, M as ModelConfigProvider, f as ThreadMessage, g as ModelConfig, A as AssistantContentPart, h as AppendMessage } from './ThreadActions-DqqhRbf1.js';
5
- export { l as AppendContentPart, i as AssistantMessage, m as TextContentPart, k as UserContentPart, j as UserMessage } from './ThreadActions-DqqhRbf1.js';
4
+ import { T as TextContentPartComponent, I as ImageContentPartComponent, U as UIContentPartComponent, a as ToolCallContentPartComponent, b as ToolCallContentPartProps, c as ThreadState, d as ThreadActionsState, e as Unsubscribe, M as ModelConfigProvider, f as ThreadMessage, g as ModelConfig, A as AssistantContentPart, h as AppendMessage } from './ThreadActions-BLcKtagX.js';
5
+ export { l as AppendContentPart, i as AssistantMessage, m as TextContentPart, k as UserContentPart, j as UserMessage } from './ThreadActions-BLcKtagX.js';
6
6
  import { Primitive } from '@radix-ui/react-primitive';
7
7
  import 'zod';
8
8
 
9
- declare const useCopyMessage: ({ copiedDuration }: {
10
- copiedDuration?: number | undefined;
11
- }) => (() => void) | null;
9
+ type UseActionBarCopyProps = {
10
+ copiedDuration?: number;
11
+ };
12
+ declare const useActionBarCopy: ({ copiedDuration, }?: UseActionBarCopyProps) => (() => void) | null;
13
+
14
+ declare const useActionBarEdit: () => (() => void) | null;
15
+
16
+ declare const useActionBarReload: () => (() => void) | null;
17
+
18
+ declare const useBranchPickerCount: () => number;
19
+
20
+ declare const useBranchPickerNext: () => (() => void) | null;
21
+
22
+ declare const useBranchPickerNumber: () => number;
23
+
24
+ declare const useBranchPickerPrevious: () => (() => void) | null;
25
+
26
+ declare const useComposerCancel: () => (() => void) | null;
27
+
28
+ type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
29
+ [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
30
+ }[Keys];
31
+
32
+ type ComposerIfFilters = {
33
+ editing: boolean | undefined;
34
+ };
35
+ type UseComposerIfProps = RequireAtLeastOne<ComposerIfFilters>;
36
+ declare const useComposerIf: (props: UseComposerIfProps) => boolean;
12
37
 
13
- declare const useReloadMessage: () => (() => void) | null;
38
+ declare const useComposerSend: () => (() => void) | null;
14
39
 
15
- declare const useBeginMessageEdit: () => (() => void) | null;
40
+ declare const useContentPartDisplay: () => react.ReactNode;
41
+
42
+ declare const useContentPartImage: () => string;
43
+
44
+ declare const useContentPartInProgressIndicator: () => react.ReactNode;
45
+
46
+ declare const useContentPartText: () => string;
47
+
48
+ type MessageIfFilters = {
49
+ user: boolean | undefined;
50
+ assistant: boolean | undefined;
51
+ hasBranches: boolean | undefined;
52
+ copied: boolean | undefined;
53
+ lastOrHover: boolean | undefined;
54
+ };
55
+ type UseMessageIfProps = RequireAtLeastOne<MessageIfFilters>;
56
+ declare const useMessageIf: (props: UseMessageIfProps) => boolean;
57
+
58
+ declare const useThreadEmpty: () => boolean;
59
+
60
+ type ThreadIfFilters = {
61
+ empty: boolean | undefined;
62
+ running: boolean | undefined;
63
+ };
64
+ type UseThreadIfProps = RequireAtLeastOne<ThreadIfFilters>;
65
+ declare const useThreadIf: (props: UseThreadIfProps) => boolean;
16
66
 
17
- declare const useGoToNextBranch: () => (() => void) | null;
67
+ declare const useThreadScrollToBottom: () => (() => void) | null;
18
68
 
19
- declare const useGoToPreviousBranch: () => (() => void) | null;
69
+ type UseApplyThreadSuggestionProps = {
70
+ prompt: string;
71
+ method: "replace";
72
+ autoSend?: boolean;
73
+ };
74
+ declare const useThreadSuggestion: ({ prompt, autoSend, }: UseApplyThreadSuggestionProps) => (() => void) | null;
20
75
 
21
76
  declare const ThreadRoot: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
22
77
  ref?: ((instance: HTMLDivElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLDivElement> | null | undefined;
@@ -29,24 +84,18 @@ type ThreadEmptyProps = {
29
84
  };
30
85
  declare const ThreadEmpty: FC<ThreadEmptyProps>;
31
86
 
32
- type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
33
- [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
34
- }[Keys];
87
+ type ThreadIfProps = PropsWithChildren<UseThreadIfProps>;
88
+ declare const ThreadIf: FC<ThreadIfProps>;
35
89
 
36
- type ThreadIfFilters = {
37
- empty: boolean | undefined;
38
- running: boolean | undefined;
90
+ type UseThreadViewportAutoScrollProps = {
91
+ autoScroll?: boolean | undefined;
39
92
  };
40
- type ThreadIfProps = PropsWithChildren<RequireAtLeastOne<ThreadIfFilters>>;
41
- declare const ThreadIf: FC<ThreadIfProps>;
42
93
 
43
94
  declare const ThreadViewport: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
44
95
  ref?: ((instance: HTMLDivElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLDivElement> | null | undefined;
45
96
  } & {
46
97
  asChild?: boolean;
47
- }, "ref"> & {
48
- autoScroll?: boolean;
49
- } & react.RefAttributes<HTMLDivElement>>;
98
+ }, "ref"> & UseThreadViewportAutoScrollProps & react.RefAttributes<HTMLDivElement>>;
50
99
 
51
100
  type ThreadMessagesProps = {
52
101
  components: {
@@ -105,10 +154,7 @@ declare const ComposerCancel: react.ForwardRefExoticComponent<Omit<Omit<react.De
105
154
  asChild?: boolean;
106
155
  }, "ref"> & react.RefAttributes<HTMLButtonElement>>;
107
156
 
108
- type ComposerIfFilters = {
109
- editing: boolean | undefined;
110
- };
111
- type ComposerIfProps = PropsWithChildren<RequireAtLeastOne<ComposerIfFilters>>;
157
+ type ComposerIfProps = PropsWithChildren<UseComposerIfProps>;
112
158
  declare const ComposerIf: FC<ComposerIfProps>;
113
159
 
114
160
  declare namespace index$4 {
@@ -121,16 +167,7 @@ declare const MessageRoot: react.ForwardRefExoticComponent<Omit<Omit<react.Detai
121
167
  asChild?: boolean;
122
168
  }, "ref"> & react.RefAttributes<HTMLDivElement>>;
123
169
 
124
- type MessageIfFilters = {
125
- user: boolean | undefined;
126
- assistant: boolean | undefined;
127
- hasBranches: boolean | undefined;
128
- copied: boolean | undefined;
129
- lastOrHover: boolean | undefined;
130
- };
131
- type MessageIfProps = RequireAtLeastOne<MessageIfFilters> & {
132
- children: ReactNode;
133
- };
170
+ type MessageIfProps = PropsWithChildren<UseMessageIfProps>;
134
171
  declare const MessageIf: FC<MessageIfProps>;
135
172
 
136
173
  type MessageContentProps = {
@@ -184,24 +221,24 @@ declare namespace index$2 {
184
221
  export { BranchPickerCount as Count, BranchPickerNext as Next, BranchPickerNumber as Number, BranchPickerPrevious as Previous, BranchPickerRoot as Root };
185
222
  }
186
223
 
224
+ type UseActionBarFloatStatusProps = {
225
+ hideWhenRunning?: boolean | undefined;
226
+ autohide?: "always" | "not-last" | "never" | undefined;
227
+ autohideFloat?: "always" | "single-branch" | "never" | undefined;
228
+ };
187
229
  declare const ActionBarRoot: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
188
230
  ref?: ((instance: HTMLDivElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLDivElement> | null | undefined;
189
231
  } & {
190
232
  asChild?: boolean;
191
- }, "ref"> & {
192
- hideWhenRunning?: boolean;
193
- autohide?: "always" | "not-last" | "never";
194
- autohideFloat?: "always" | "single-branch" | "never";
195
- } & react.RefAttributes<HTMLDivElement>>;
233
+ }, "ref"> & UseActionBarFloatStatusProps & react.RefAttributes<HTMLDivElement>>;
196
234
 
197
- type ActionBarCopyProps = {
198
- copiedDuration?: number;
199
- };
200
235
  declare const ActionBarCopy: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
201
236
  ref?: ((instance: HTMLButtonElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLButtonElement> | null | undefined;
202
237
  } & {
203
238
  asChild?: boolean;
204
- }, "ref"> & ActionBarCopyProps & react.RefAttributes<HTMLButtonElement>>;
239
+ }, "ref"> & {
240
+ copiedDuration?: number;
241
+ } & react.RefAttributes<HTMLButtonElement>>;
205
242
 
206
243
  declare const ActionBarReload: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
207
244
  ref?: ((instance: HTMLButtonElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLButtonElement> | null | undefined;
@@ -317,4 +354,4 @@ declare namespace internal {
317
354
  export { internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider };
318
355
  }
319
356
 
320
- export { index$1 as ActionBarPrimitive, AppendMessage, AssistantContentPart, type AssistantRuntime, AssistantRuntimeProvider, index$2 as BranchPickerPrimitive, type ChatModelAdapter, type ChatModelRunOptions, index$4 as ComposerPrimitive, index as ContentPartPrimitive, internal as INTERNAL, index$3 as MessagePrimitive, type ReactThreadRuntime, ThreadMessage, index$5 as ThreadPrimitive, type ThreadRuntime, Unsubscribe, useBeginMessageEdit, useCopyMessage, useGoToNextBranch, useGoToPreviousBranch, useLocalRuntime, useReloadMessage };
357
+ export { index$1 as ActionBarPrimitive, AppendMessage, AssistantContentPart, type AssistantRuntime, AssistantRuntimeProvider, index$2 as BranchPickerPrimitive, type ChatModelAdapter, type ChatModelRunOptions, index$4 as ComposerPrimitive, index as ContentPartPrimitive, internal as INTERNAL, index$3 as MessagePrimitive, type ReactThreadRuntime, ThreadMessage, index$5 as ThreadPrimitive, type ThreadRuntime, Unsubscribe, useActionBarCopy, useActionBarEdit, useActionBarReload, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerCancel, useComposerIf, useComposerSend, useContentPartDisplay, useContentPartImage, useContentPartInProgressIndicator, useContentPartText, useLocalRuntime, useMessageIf, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };