@assistant-ui/react-native 0.1.2 → 0.1.4
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.
- package/dist/context/AssistantContext.d.ts +1 -7
- package/dist/context/AssistantContext.d.ts.map +1 -1
- package/dist/context/AssistantContext.js +1 -15
- package/dist/context/AssistantContext.js.map +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/providers/RuntimeAdapterProvider.d.ts +1 -15
- package/dist/context/providers/RuntimeAdapterProvider.d.ts.map +1 -1
- package/dist/context/providers/RuntimeAdapterProvider.js +1 -13
- package/dist/context/providers/RuntimeAdapterProvider.js.map +1 -1
- package/dist/index.d.ts +12 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -16
- package/dist/index.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.js +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.js +1 -1
- package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
- package/dist/primitives/actionBar/index.d.ts +5 -5
- package/dist/primitives/actionBar/index.d.ts.map +1 -1
- package/dist/primitives/actionBar/index.js +5 -5
- package/dist/primitives/actionBar/index.js.map +1 -1
- package/dist/primitives/attachment/index.d.ts +4 -4
- package/dist/primitives/attachment/index.d.ts.map +1 -1
- package/dist/primitives/attachment/index.js +4 -4
- package/dist/primitives/attachment/index.js.map +1 -1
- package/dist/primitives/branchPicker/index.d.ts +4 -4
- package/dist/primitives/branchPicker/index.d.ts.map +1 -1
- package/dist/primitives/branchPicker/index.js +4 -4
- package/dist/primitives/branchPicker/index.js.map +1 -1
- package/dist/primitives/chainOfThought/index.d.ts +3 -3
- package/dist/primitives/chainOfThought/index.d.ts.map +1 -1
- package/dist/primitives/chainOfThought/index.js +3 -3
- package/dist/primitives/chainOfThought/index.js.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.d.ts +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js +4 -6
- package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
- package/dist/primitives/composer/ComposerCancel.js +3 -3
- package/dist/primitives/composer/ComposerCancel.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.d.ts +10 -2
- package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +36 -4
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerSend.js +3 -3
- package/dist/primitives/composer/ComposerSend.js.map +1 -1
- package/dist/primitives/composer/EditComposerCancel.js +1 -1
- package/dist/primitives/composer/EditComposerCancel.js.map +1 -1
- package/dist/primitives/composer/EditComposerSend.js +1 -1
- package/dist/primitives/composer/EditComposerSend.js.map +1 -1
- package/dist/primitives/composer/index.d.ts +10 -10
- package/dist/primitives/composer/index.d.ts.map +1 -1
- package/dist/primitives/composer/index.js +10 -10
- package/dist/primitives/composer/index.js.map +1 -1
- package/dist/primitives/message/index.d.ts +5 -5
- package/dist/primitives/message/index.d.ts.map +1 -1
- package/dist/primitives/message/index.js +5 -5
- package/dist/primitives/message/index.js.map +1 -1
- package/dist/primitives/suggestion/index.d.ts +3 -3
- package/dist/primitives/suggestion/index.d.ts.map +1 -1
- package/dist/primitives/suggestion/index.js +3 -3
- package/dist/primitives/suggestion/index.js.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.js +1 -1
- package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
- package/dist/primitives/thread/ThreadMessages.d.ts +23 -6
- package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +56 -15
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread/index.d.ts +7 -7
- package/dist/primitives/thread/index.d.ts.map +1 -1
- package/dist/primitives/thread/index.js +7 -7
- package/dist/primitives/thread/index.js.map +1 -1
- package/dist/primitives/threadList/index.d.ts +3 -3
- package/dist/primitives/threadList/index.d.ts.map +1 -1
- package/dist/primitives/threadList/index.js +3 -3
- package/dist/primitives/threadList/index.js.map +1 -1
- package/dist/primitives/threadListItem/index.d.ts +6 -6
- package/dist/primitives/threadListItem/index.d.ts.map +1 -1
- package/dist/primitives/threadListItem/index.js +6 -6
- package/dist/primitives/threadListItem/index.js.map +1 -1
- package/dist/runtimes/RemoteThreadListHookInstanceManager.d.ts +1 -95
- package/dist/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
- package/dist/runtimes/RemoteThreadListHookInstanceManager.js +1 -109
- package/dist/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
- package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +1 -112
- package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
- package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.js +1 -439
- package/dist/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
- package/dist/runtimes/useLocalRuntime.d.ts +1 -17
- package/dist/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/runtimes/useLocalRuntime.js +1 -61
- package/dist/runtimes/useLocalRuntime.js.map +1 -1
- package/dist/runtimes/useRemoteThreadListRuntime.d.ts +1 -3
- package/dist/runtimes/useRemoteThreadListRuntime.d.ts.map +1 -1
- package/dist/runtimes/useRemoteThreadListRuntime.js +1 -46
- package/dist/runtimes/useRemoteThreadListRuntime.js.map +1 -1
- package/package.json +3 -3
- package/src/context/AssistantContext.tsx +4 -31
- package/src/context/index.ts +4 -1
- package/src/context/providers/RuntimeAdapterProvider.tsx +5 -42
- package/src/index.ts +12 -39
- package/src/primitives/actionBar/ActionBarCopy.tsx +1 -1
- package/src/primitives/actionBar/ActionBarEdit.tsx +1 -1
- package/src/primitives/actionBar/ActionBarFeedbackNegative.tsx +1 -1
- package/src/primitives/actionBar/ActionBarFeedbackPositive.tsx +1 -1
- package/src/primitives/actionBar/ActionBarReload.tsx +1 -1
- package/src/primitives/actionBar/index.ts +16 -7
- package/src/primitives/attachment/index.ts +14 -5
- package/src/primitives/branchPicker/index.ts +8 -8
- package/src/primitives/chainOfThought/index.ts +5 -5
- package/src/primitives/composer/ComposerAddAttachment.tsx +4 -6
- package/src/primitives/composer/ComposerCancel.tsx +3 -3
- package/src/primitives/composer/ComposerInput.tsx +75 -5
- package/src/primitives/composer/ComposerSend.tsx +3 -3
- package/src/primitives/composer/EditComposerCancel.tsx +1 -1
- package/src/primitives/composer/EditComposerSend.tsx +1 -1
- package/src/primitives/composer/index.ts +27 -15
- package/src/primitives/message/index.ts +13 -7
- package/src/primitives/suggestion/index.ts +6 -6
- package/src/primitives/thread/ThreadEmpty.tsx +1 -1
- package/src/primitives/thread/ThreadMessages.tsx +103 -29
- package/src/primitives/thread/index.ts +17 -11
- package/src/primitives/threadList/index.ts +12 -3
- package/src/primitives/threadListItem/index.ts +11 -11
- package/src/runtimes/RemoteThreadListHookInstanceManager.tsx +1 -180
- package/src/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +1 -538
- package/src/runtimes/useLocalRuntime.ts +4 -105
- package/src/runtimes/useRemoteThreadListRuntime.ts +1 -80
- package/dist/adapters/LocalStorageThreadListAdapter.d.ts +0 -15
- package/dist/adapters/LocalStorageThreadListAdapter.d.ts.map +0 -1
- package/dist/adapters/LocalStorageThreadListAdapter.js +0 -154
- package/dist/adapters/LocalStorageThreadListAdapter.js.map +0 -1
- package/dist/adapters/TitleGenerationAdapter.d.ts +0 -6
- package/dist/adapters/TitleGenerationAdapter.d.ts.map +0 -1
- package/dist/adapters/TitleGenerationAdapter.js +0 -15
- package/dist/adapters/TitleGenerationAdapter.js.map +0 -1
- package/dist/adapters/index.d.ts +0 -3
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/index.js +0 -3
- package/dist/adapters/index.js.map +0 -1
- package/dist/primitive-hooks/index.d.ts +0 -15
- package/dist/primitive-hooks/index.d.ts.map +0 -1
- package/dist/primitive-hooks/index.js +0 -15
- package/dist/primitive-hooks/index.js.map +0 -1
- package/dist/primitive-hooks/useActionBarCopy.d.ts +0 -10
- package/dist/primitive-hooks/useActionBarCopy.d.ts.map +0 -1
- package/dist/primitive-hooks/useActionBarCopy.js +0 -26
- package/dist/primitive-hooks/useActionBarCopy.js.map +0 -1
- package/dist/primitive-hooks/useActionBarEdit.d.ts +0 -5
- package/dist/primitive-hooks/useActionBarEdit.d.ts.map +0 -1
- package/dist/primitive-hooks/useActionBarEdit.js +0 -11
- package/dist/primitive-hooks/useActionBarEdit.js.map +0 -1
- package/dist/primitive-hooks/useActionBarFeedback.d.ts +0 -9
- package/dist/primitive-hooks/useActionBarFeedback.d.ts.map +0 -1
- package/dist/primitive-hooks/useActionBarFeedback.js +0 -19
- package/dist/primitive-hooks/useActionBarFeedback.js.map +0 -1
- package/dist/primitive-hooks/useActionBarReload.d.ts +0 -5
- package/dist/primitive-hooks/useActionBarReload.d.ts.map +0 -1
- package/dist/primitive-hooks/useActionBarReload.js +0 -13
- package/dist/primitive-hooks/useActionBarReload.js.map +0 -1
- package/dist/primitive-hooks/useComposerAddAttachment.d.ts +0 -5
- package/dist/primitive-hooks/useComposerAddAttachment.d.ts.map +0 -1
- package/dist/primitive-hooks/useComposerAddAttachment.js +0 -10
- package/dist/primitive-hooks/useComposerAddAttachment.js.map +0 -1
- package/dist/primitive-hooks/useComposerCancel.d.ts +0 -5
- package/dist/primitive-hooks/useComposerCancel.d.ts.map +0 -1
- package/dist/primitive-hooks/useComposerCancel.js +0 -11
- package/dist/primitive-hooks/useComposerCancel.js.map +0 -1
- package/dist/primitive-hooks/useComposerSend.d.ts +0 -5
- package/dist/primitive-hooks/useComposerSend.d.ts.map +0 -1
- package/dist/primitive-hooks/useComposerSend.js +0 -11
- package/dist/primitive-hooks/useComposerSend.js.map +0 -1
- package/dist/primitive-hooks/useEditComposerCancel.d.ts +0 -4
- package/dist/primitive-hooks/useEditComposerCancel.d.ts.map +0 -1
- package/dist/primitive-hooks/useEditComposerCancel.js +0 -10
- package/dist/primitive-hooks/useEditComposerCancel.js.map +0 -1
- package/dist/primitive-hooks/useEditComposerSend.d.ts +0 -5
- package/dist/primitive-hooks/useEditComposerSend.d.ts.map +0 -1
- package/dist/primitive-hooks/useEditComposerSend.js +0 -11
- package/dist/primitive-hooks/useEditComposerSend.js.map +0 -1
- package/dist/primitive-hooks/useMessageBranching.d.ts +0 -7
- package/dist/primitive-hooks/useMessageBranching.d.ts.map +0 -1
- package/dist/primitive-hooks/useMessageBranching.js +0 -15
- package/dist/primitive-hooks/useMessageBranching.js.map +0 -1
- package/dist/primitive-hooks/useMessageReload.d.ts +0 -5
- package/dist/primitive-hooks/useMessageReload.d.ts.map +0 -1
- package/dist/primitive-hooks/useMessageReload.js +0 -11
- package/dist/primitive-hooks/useMessageReload.js.map +0 -1
- package/dist/primitive-hooks/useThreadIsEmpty.d.ts +0 -2
- package/dist/primitive-hooks/useThreadIsEmpty.d.ts.map +0 -1
- package/dist/primitive-hooks/useThreadIsEmpty.js +0 -5
- package/dist/primitive-hooks/useThreadIsEmpty.js.map +0 -1
- package/dist/primitive-hooks/useThreadIsRunning.d.ts +0 -2
- package/dist/primitive-hooks/useThreadIsRunning.d.ts.map +0 -1
- package/dist/primitive-hooks/useThreadIsRunning.js +0 -5
- package/dist/primitive-hooks/useThreadIsRunning.js.map +0 -1
- package/dist/primitive-hooks/useThreadMessages.d.ts +0 -3
- package/dist/primitive-hooks/useThreadMessages.d.ts.map +0 -1
- package/dist/primitive-hooks/useThreadMessages.js +0 -5
- package/dist/primitive-hooks/useThreadMessages.js.map +0 -1
- package/src/adapters/LocalStorageThreadListAdapter.tsx +0 -227
- package/src/adapters/TitleGenerationAdapter.ts +0 -20
- package/src/adapters/index.ts +0 -5
- package/src/primitive-hooks/index.ts +0 -20
- package/src/primitive-hooks/useActionBarCopy.ts +0 -38
- package/src/primitive-hooks/useActionBarEdit.ts +0 -13
- package/src/primitive-hooks/useActionBarFeedback.ts +0 -28
- package/src/primitive-hooks/useActionBarReload.ts +0 -18
- package/src/primitive-hooks/useComposerAddAttachment.ts +0 -16
- package/src/primitive-hooks/useComposerCancel.ts +0 -13
- package/src/primitive-hooks/useComposerSend.ts +0 -13
- package/src/primitive-hooks/useEditComposerCancel.ts +0 -12
- package/src/primitive-hooks/useEditComposerSend.ts +0 -13
- package/src/primitive-hooks/useMessageBranching.ts +0 -18
- package/src/primitive-hooks/useMessageReload.ts +0 -13
- package/src/primitive-hooks/useThreadIsEmpty.ts +0 -5
- package/src/primitive-hooks/useThreadIsRunning.ts +0 -5
- package/src/primitive-hooks/useThreadMessages.ts +0 -6
|
@@ -1,31 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const useAssistantRuntime = (): AssistantRuntime => {
|
|
7
|
-
const aui = useAui();
|
|
8
|
-
const runtime = aui.threads().__internal_getAssistantRuntime?.();
|
|
9
|
-
if (!runtime) {
|
|
10
|
-
throw new Error(
|
|
11
|
-
"useAssistantRuntime must be used within an AssistantProvider",
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
return runtime;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const AssistantProvider = memo(
|
|
18
|
-
({
|
|
19
|
-
runtime,
|
|
20
|
-
children,
|
|
21
|
-
}: {
|
|
22
|
-
runtime: AssistantRuntime;
|
|
23
|
-
children: ReactNode;
|
|
24
|
-
}) => {
|
|
25
|
-
return (
|
|
26
|
-
<AssistantProviderBase runtime={runtime}>
|
|
27
|
-
{children}
|
|
28
|
-
</AssistantProviderBase>
|
|
29
|
-
);
|
|
30
|
-
},
|
|
31
|
-
);
|
|
1
|
+
export {
|
|
2
|
+
AssistantRuntimeProvider,
|
|
3
|
+
useAssistantRuntime,
|
|
4
|
+
} from "@assistant-ui/core/react";
|
package/src/context/index.ts
CHANGED
|
@@ -1,42 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "@assistant-ui/core";
|
|
7
|
-
|
|
8
|
-
export type RuntimeAdapters = {
|
|
9
|
-
modelContext?: ModelContextProvider | undefined;
|
|
10
|
-
history?: ThreadHistoryAdapter | undefined;
|
|
11
|
-
attachments?: AttachmentAdapter | undefined;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const RuntimeAdaptersContext = createContext<RuntimeAdapters | null>(null);
|
|
15
|
-
|
|
16
|
-
export namespace RuntimeAdapterProvider {
|
|
17
|
-
export type Props = {
|
|
18
|
-
adapters: RuntimeAdapters;
|
|
19
|
-
children: ReactNode;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const RuntimeAdapterProvider: FC<RuntimeAdapterProvider.Props> = ({
|
|
24
|
-
adapters,
|
|
25
|
-
children,
|
|
26
|
-
}) => {
|
|
27
|
-
const context = useContext(RuntimeAdaptersContext);
|
|
28
|
-
return (
|
|
29
|
-
<RuntimeAdaptersContext.Provider
|
|
30
|
-
value={{
|
|
31
|
-
...context,
|
|
32
|
-
...adapters,
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
{children}
|
|
36
|
-
</RuntimeAdaptersContext.Provider>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const useRuntimeAdapters = () => {
|
|
41
|
-
return useContext(RuntimeAdaptersContext);
|
|
42
|
-
};
|
|
1
|
+
export {
|
|
2
|
+
RuntimeAdapterProvider,
|
|
3
|
+
useRuntimeAdapters,
|
|
4
|
+
type RuntimeAdapters,
|
|
5
|
+
} from "@assistant-ui/core/react";
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="@assistant-ui/core/react" />
|
|
2
2
|
|
|
3
3
|
// Re-export core types
|
|
4
4
|
export type {
|
|
@@ -92,27 +92,7 @@ export {
|
|
|
92
92
|
} from "@assistant-ui/store";
|
|
93
93
|
|
|
94
94
|
// Context providers and hooks
|
|
95
|
-
export {
|
|
96
|
-
|
|
97
|
-
// Primitive hooks
|
|
98
|
-
export {
|
|
99
|
-
useThreadMessages,
|
|
100
|
-
useThreadIsRunning,
|
|
101
|
-
useThreadIsEmpty,
|
|
102
|
-
useComposerSend,
|
|
103
|
-
useComposerCancel,
|
|
104
|
-
useMessageReload,
|
|
105
|
-
useMessageBranching,
|
|
106
|
-
useActionBarCopy,
|
|
107
|
-
type UseActionBarCopyOptions,
|
|
108
|
-
useActionBarEdit,
|
|
109
|
-
useActionBarReload,
|
|
110
|
-
useActionBarFeedbackPositive,
|
|
111
|
-
useActionBarFeedbackNegative,
|
|
112
|
-
useEditComposerSend,
|
|
113
|
-
useEditComposerCancel,
|
|
114
|
-
useComposerAddAttachment,
|
|
115
|
-
} from "./primitive-hooks";
|
|
95
|
+
export { AssistantRuntimeProvider, useAssistantRuntime } from "./context";
|
|
116
96
|
|
|
117
97
|
// Runtime
|
|
118
98
|
export {
|
|
@@ -122,16 +102,16 @@ export {
|
|
|
122
102
|
} from "./runtimes";
|
|
123
103
|
|
|
124
104
|
// Primitives
|
|
125
|
-
export * from "./primitives/thread";
|
|
126
|
-
export * from "./primitives/composer";
|
|
127
|
-
export * from "./primitives/message";
|
|
128
|
-
export * from "./primitives/threadList";
|
|
129
|
-
export * from "./primitives/actionBar";
|
|
130
|
-
export * from "./primitives/branchPicker";
|
|
131
|
-
export * from "./primitives/attachment";
|
|
132
|
-
export * from "./primitives/threadListItem";
|
|
133
|
-
export * from "./primitives/chainOfThought";
|
|
134
|
-
export * from "./primitives/suggestion";
|
|
105
|
+
export * as ThreadPrimitive from "./primitives/thread";
|
|
106
|
+
export * as ComposerPrimitive from "./primitives/composer";
|
|
107
|
+
export * as MessagePrimitive from "./primitives/message";
|
|
108
|
+
export * as ThreadListPrimitive from "./primitives/threadList";
|
|
109
|
+
export * as ActionBarPrimitive from "./primitives/actionBar";
|
|
110
|
+
export * as BranchPickerPrimitive from "./primitives/branchPicker";
|
|
111
|
+
export * as AttachmentPrimitive from "./primitives/attachment";
|
|
112
|
+
export * as ThreadListItemPrimitive from "./primitives/threadListItem";
|
|
113
|
+
export * as ChainOfThoughtPrimitive from "./primitives/chainOfThought";
|
|
114
|
+
export * as SuggestionPrimitive from "./primitives/suggestion";
|
|
135
115
|
|
|
136
116
|
// Re-export shared providers from core/react
|
|
137
117
|
export {
|
|
@@ -148,10 +128,3 @@ export {
|
|
|
148
128
|
export * from "./model-context";
|
|
149
129
|
export * from "./client";
|
|
150
130
|
export * from "./types";
|
|
151
|
-
|
|
152
|
-
// Adapters
|
|
153
|
-
export {
|
|
154
|
-
type TitleGenerationAdapter,
|
|
155
|
-
createSimpleTitleAdapter,
|
|
156
|
-
createLocalStorageAdapter,
|
|
157
|
-
} from "./adapters";
|
|
@@ -3,7 +3,7 @@ import { Pressable, type PressableProps } from "react-native";
|
|
|
3
3
|
import {
|
|
4
4
|
useActionBarCopy,
|
|
5
5
|
type UseActionBarCopyOptions,
|
|
6
|
-
} from "
|
|
6
|
+
} from "@assistant-ui/core/react";
|
|
7
7
|
|
|
8
8
|
export type ActionBarCopyProps = Omit<PressableProps, "onPress" | "children"> &
|
|
9
9
|
UseActionBarCopyOptions & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { Pressable, type PressableProps } from "react-native";
|
|
3
|
-
import { useActionBarEdit } from "
|
|
3
|
+
import { useActionBarEdit } from "@assistant-ui/core/react";
|
|
4
4
|
|
|
5
5
|
export type ActionBarEditProps = Omit<PressableProps, "onPress"> & {
|
|
6
6
|
children: ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { Pressable, type PressableProps } from "react-native";
|
|
3
|
-
import { useActionBarFeedbackNegative } from "
|
|
3
|
+
import { useActionBarFeedbackNegative } from "@assistant-ui/core/react";
|
|
4
4
|
|
|
5
5
|
export type ActionBarFeedbackNegativeProps = Omit<
|
|
6
6
|
PressableProps,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { Pressable, type PressableProps } from "react-native";
|
|
3
|
-
import { useActionBarFeedbackPositive } from "
|
|
3
|
+
import { useActionBarFeedbackPositive } from "@assistant-ui/core/react";
|
|
4
4
|
|
|
5
5
|
export type ActionBarFeedbackPositiveProps = Omit<
|
|
6
6
|
PressableProps,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { Pressable, type PressableProps } from "react-native";
|
|
3
|
-
import { useActionBarReload } from "
|
|
3
|
+
import { useActionBarReload } from "@assistant-ui/core/react";
|
|
4
4
|
|
|
5
5
|
export type ActionBarReloadProps = Omit<PressableProps, "onPress"> & {
|
|
6
6
|
children: ReactNode;
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
export { ActionBarCopy, type ActionBarCopyProps } from "./ActionBarCopy";
|
|
2
|
-
export { ActionBarEdit, type ActionBarEditProps } from "./ActionBarEdit";
|
|
3
|
-
export { ActionBarReload, type ActionBarReloadProps } from "./ActionBarReload";
|
|
4
1
|
export {
|
|
5
|
-
|
|
6
|
-
type
|
|
2
|
+
ActionBarCopy as Copy,
|
|
3
|
+
type ActionBarCopyProps as CopyProps,
|
|
4
|
+
} from "./ActionBarCopy";
|
|
5
|
+
export {
|
|
6
|
+
ActionBarEdit as Edit,
|
|
7
|
+
type ActionBarEditProps as EditProps,
|
|
8
|
+
} from "./ActionBarEdit";
|
|
9
|
+
export {
|
|
10
|
+
ActionBarReload as Reload,
|
|
11
|
+
type ActionBarReloadProps as ReloadProps,
|
|
12
|
+
} from "./ActionBarReload";
|
|
13
|
+
export {
|
|
14
|
+
ActionBarFeedbackPositive as FeedbackPositive,
|
|
15
|
+
type ActionBarFeedbackPositiveProps as FeedbackPositiveProps,
|
|
7
16
|
} from "./ActionBarFeedbackPositive";
|
|
8
17
|
export {
|
|
9
|
-
ActionBarFeedbackNegative,
|
|
10
|
-
type ActionBarFeedbackNegativeProps,
|
|
18
|
+
ActionBarFeedbackNegative as FeedbackNegative,
|
|
19
|
+
type ActionBarFeedbackNegativeProps as FeedbackNegativeProps,
|
|
11
20
|
} from "./ActionBarFeedbackNegative";
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
export { AttachmentRoot, type AttachmentRootProps } from "./AttachmentRoot";
|
|
2
|
-
export { AttachmentName, type AttachmentNameProps } from "./AttachmentName";
|
|
3
|
-
export { AttachmentThumb, type AttachmentThumbProps } from "./AttachmentThumb";
|
|
4
1
|
export {
|
|
5
|
-
|
|
6
|
-
type
|
|
2
|
+
AttachmentRoot as Root,
|
|
3
|
+
type AttachmentRootProps as RootProps,
|
|
4
|
+
} from "./AttachmentRoot";
|
|
5
|
+
export {
|
|
6
|
+
AttachmentName as Name,
|
|
7
|
+
type AttachmentNameProps as NameProps,
|
|
8
|
+
} from "./AttachmentName";
|
|
9
|
+
export {
|
|
10
|
+
AttachmentThumb as Thumb,
|
|
11
|
+
type AttachmentThumbProps as ThumbProps,
|
|
12
|
+
} from "./AttachmentThumb";
|
|
13
|
+
export {
|
|
14
|
+
AttachmentRemove as Remove,
|
|
15
|
+
type AttachmentRemoveProps as RemoveProps,
|
|
7
16
|
} from "./AttachmentRemove";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export {
|
|
2
|
-
BranchPickerPrevious,
|
|
3
|
-
type BranchPickerPreviousProps,
|
|
2
|
+
BranchPickerPrevious as Previous,
|
|
3
|
+
type BranchPickerPreviousProps as PreviousProps,
|
|
4
4
|
} from "./BranchPickerPrevious";
|
|
5
5
|
export {
|
|
6
|
-
BranchPickerNext,
|
|
7
|
-
type BranchPickerNextProps,
|
|
6
|
+
BranchPickerNext as Next,
|
|
7
|
+
type BranchPickerNextProps as NextProps,
|
|
8
8
|
} from "./BranchPickerNext";
|
|
9
9
|
export {
|
|
10
|
-
BranchPickerNumber,
|
|
11
|
-
type BranchPickerNumberProps,
|
|
10
|
+
BranchPickerNumber as Number,
|
|
11
|
+
type BranchPickerNumberProps as NumberProps,
|
|
12
12
|
} from "./BranchPickerNumber";
|
|
13
13
|
export {
|
|
14
|
-
BranchPickerCount,
|
|
15
|
-
type BranchPickerCountProps,
|
|
14
|
+
BranchPickerCount as Count,
|
|
15
|
+
type BranchPickerCountProps as CountProps,
|
|
16
16
|
} from "./BranchPickerCount";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export {
|
|
2
|
-
ChainOfThoughtRoot,
|
|
3
|
-
type ChainOfThoughtRootProps,
|
|
2
|
+
ChainOfThoughtRoot as Root,
|
|
3
|
+
type ChainOfThoughtRootProps as RootProps,
|
|
4
4
|
} from "./ChainOfThoughtRoot";
|
|
5
5
|
export {
|
|
6
|
-
ChainOfThoughtAccordionTrigger,
|
|
7
|
-
type ChainOfThoughtAccordionTriggerProps,
|
|
6
|
+
ChainOfThoughtAccordionTrigger as AccordionTrigger,
|
|
7
|
+
type ChainOfThoughtAccordionTriggerProps as AccordionTriggerProps,
|
|
8
8
|
} from "./ChainOfThoughtAccordionTrigger";
|
|
9
|
-
export { ChainOfThoughtPrimitiveParts } from "@assistant-ui/core/react";
|
|
9
|
+
export { ChainOfThoughtPrimitiveParts as Parts } from "@assistant-ui/core/react";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { Pressable, type PressableProps } from "react-native";
|
|
3
|
-
import { useComposerAddAttachment } from "
|
|
4
|
-
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
+
import { useComposerAddAttachment } from "@assistant-ui/core/react";
|
|
5
4
|
|
|
6
5
|
export type ComposerAddAttachmentProps = Omit<PressableProps, "onPress"> & {
|
|
7
6
|
children: ReactNode;
|
|
@@ -11,7 +10,7 @@ export type ComposerAddAttachmentProps = Omit<PressableProps, "onPress"> & {
|
|
|
11
10
|
* A button that triggers the attachment adding flow.
|
|
12
11
|
*
|
|
13
12
|
* Note: The actual file picker implementation is platform-specific.
|
|
14
|
-
* This component calls `useComposerAddAttachment()` from
|
|
13
|
+
* This component calls `useComposerAddAttachment()` from `@assistant-ui/core/react`.
|
|
15
14
|
* You must handle the file selection in your own component using the returned `addAttachment` callback.
|
|
16
15
|
*/
|
|
17
16
|
export const ComposerAddAttachment = ({
|
|
@@ -19,11 +18,10 @@ export const ComposerAddAttachment = ({
|
|
|
19
18
|
disabled: disabledProp,
|
|
20
19
|
...pressableProps
|
|
21
20
|
}: ComposerAddAttachmentProps) => {
|
|
22
|
-
const
|
|
23
|
-
const { addAttachment: _addAttachment } = useComposerAddAttachment();
|
|
21
|
+
const { disabled } = useComposerAddAttachment();
|
|
24
22
|
|
|
25
23
|
return (
|
|
26
|
-
<Pressable disabled={disabledProp ??
|
|
24
|
+
<Pressable disabled={disabledProp ?? disabled} {...pressableProps}>
|
|
27
25
|
{children}
|
|
28
26
|
</Pressable>
|
|
29
27
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { Pressable, type PressableProps } from "react-native";
|
|
3
|
-
import { useComposerCancel } from "
|
|
3
|
+
import { useComposerCancel } from "@assistant-ui/core/react";
|
|
4
4
|
|
|
5
5
|
export type ComposerCancelProps = Omit<PressableProps, "onPress"> & {
|
|
6
6
|
children: ReactNode;
|
|
@@ -11,12 +11,12 @@ export const ComposerCancel = ({
|
|
|
11
11
|
disabled,
|
|
12
12
|
...pressableProps
|
|
13
13
|
}: ComposerCancelProps) => {
|
|
14
|
-
const { cancel,
|
|
14
|
+
const { cancel, disabled: hookDisabled } = useComposerCancel();
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<Pressable
|
|
18
18
|
onPress={cancel}
|
|
19
|
-
disabled={disabled ??
|
|
19
|
+
disabled={disabled ?? hookDisabled}
|
|
20
20
|
{...pressableProps}
|
|
21
21
|
>
|
|
22
22
|
{children}
|
|
@@ -1,12 +1,48 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import {
|
|
1
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Platform,
|
|
4
|
+
TextInput,
|
|
5
|
+
type NativeSyntheticEvent,
|
|
6
|
+
type TextInputKeyPressEventData,
|
|
7
|
+
type TextInputProps,
|
|
8
|
+
} from "react-native";
|
|
3
9
|
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
4
10
|
|
|
5
|
-
export type ComposerInputProps = Omit<
|
|
11
|
+
export type ComposerInputProps = Omit<
|
|
12
|
+
TextInputProps,
|
|
13
|
+
"value" | "onChangeText"
|
|
14
|
+
> & {
|
|
15
|
+
/**
|
|
16
|
+
* Controls how the Enter key submits messages (web only).
|
|
17
|
+
* - "enter": Plain Enter submits (Shift+Enter for newline)
|
|
18
|
+
* - "none": Enter inserts newline (no keyboard submission)
|
|
19
|
+
* @default "enter"
|
|
20
|
+
*/
|
|
21
|
+
submitMode?: "enter" | "none";
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const adjustWebTextareaHeight = (ref: React.RefObject<TextInput | null>) => {
|
|
25
|
+
if (Platform.OS !== "web") return;
|
|
26
|
+
// On web, the TextInput ref IS the DOM element
|
|
27
|
+
const el = ref.current as unknown as HTMLTextAreaElement | null;
|
|
28
|
+
if (!el) return;
|
|
29
|
+
// Ensure rows=1 so scrollHeight reflects actual content
|
|
30
|
+
if (el.rows !== 1) el.rows = 1;
|
|
31
|
+
el.style.overflow = "hidden";
|
|
32
|
+
el.style.height = "auto";
|
|
33
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
34
|
+
};
|
|
6
35
|
|
|
7
|
-
export const ComposerInput = (
|
|
36
|
+
export const ComposerInput = ({
|
|
37
|
+
submitMode = "enter",
|
|
38
|
+
onKeyPress: onKeyPressProp,
|
|
39
|
+
numberOfLines,
|
|
40
|
+
style,
|
|
41
|
+
...props
|
|
42
|
+
}: ComposerInputProps) => {
|
|
8
43
|
const aui = useAui();
|
|
9
44
|
const text = useAuiState((s) => s.composer.text);
|
|
45
|
+
const inputRef = useRef<TextInput>(null);
|
|
10
46
|
|
|
11
47
|
const onChangeText = useCallback(
|
|
12
48
|
(value: string) => {
|
|
@@ -15,5 +51,39 @@ export const ComposerInput = (props: ComposerInputProps) => {
|
|
|
15
51
|
[aui],
|
|
16
52
|
);
|
|
17
53
|
|
|
18
|
-
|
|
54
|
+
// Auto-resize textarea on web when text changes
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
void text; // trigger re-run when text changes
|
|
57
|
+
adjustWebTextareaHeight(inputRef);
|
|
58
|
+
}, [text]);
|
|
59
|
+
|
|
60
|
+
const onKeyPress = useCallback(
|
|
61
|
+
(e: NativeSyntheticEvent<TextInputKeyPressEventData>) => {
|
|
62
|
+
onKeyPressProp?.(e);
|
|
63
|
+
|
|
64
|
+
if (Platform.OS !== "web") return;
|
|
65
|
+
if (submitMode !== "enter") return;
|
|
66
|
+
|
|
67
|
+
const nativeEvent = e.nativeEvent as TextInputKeyPressEventData & {
|
|
68
|
+
shiftKey?: boolean;
|
|
69
|
+
};
|
|
70
|
+
if (nativeEvent.key === "Enter" && !nativeEvent.shiftKey) {
|
|
71
|
+
(e as unknown as Event).preventDefault?.();
|
|
72
|
+
aui.composer().send();
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
[aui, submitMode, onKeyPressProp],
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<TextInput
|
|
80
|
+
ref={inputRef}
|
|
81
|
+
value={text}
|
|
82
|
+
onChangeText={onChangeText}
|
|
83
|
+
onKeyPress={onKeyPress}
|
|
84
|
+
numberOfLines={numberOfLines ?? (Platform.OS === "web" ? 1 : undefined)}
|
|
85
|
+
style={style}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
19
89
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { Pressable, type PressableProps } from "react-native";
|
|
3
|
-
import { useComposerSend } from "
|
|
3
|
+
import { useComposerSend } from "@assistant-ui/core/react";
|
|
4
4
|
|
|
5
5
|
export type ComposerSendProps = Omit<PressableProps, "onPress"> & {
|
|
6
6
|
children: ReactNode;
|
|
@@ -11,12 +11,12 @@ export const ComposerSend = ({
|
|
|
11
11
|
disabled,
|
|
12
12
|
...pressableProps
|
|
13
13
|
}: ComposerSendProps) => {
|
|
14
|
-
const { send,
|
|
14
|
+
const { send, disabled: hookDisabled } = useComposerSend();
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<Pressable
|
|
18
18
|
onPress={send}
|
|
19
|
-
disabled={disabled ??
|
|
19
|
+
disabled={disabled ?? hookDisabled}
|
|
20
20
|
{...pressableProps}
|
|
21
21
|
>
|
|
22
22
|
{children}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { Pressable, type PressableProps } from "react-native";
|
|
3
|
-
import { useEditComposerCancel } from "
|
|
3
|
+
import { useEditComposerCancel } from "@assistant-ui/core/react";
|
|
4
4
|
|
|
5
5
|
export type EditComposerCancelProps = Omit<PressableProps, "onPress"> & {
|
|
6
6
|
children: ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { Pressable, type PressableProps } from "react-native";
|
|
3
|
-
import { useEditComposerSend } from "
|
|
3
|
+
import { useEditComposerSend } from "@assistant-ui/core/react";
|
|
4
4
|
|
|
5
5
|
export type EditComposerSendProps = Omit<PressableProps, "onPress"> & {
|
|
6
6
|
children: ReactNode;
|
|
@@ -1,25 +1,37 @@
|
|
|
1
|
-
export { ComposerRoot, type ComposerRootProps } from "./ComposerRoot";
|
|
2
1
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
ComposerRoot as Root,
|
|
3
|
+
type ComposerRootProps as RootProps,
|
|
4
|
+
} from "./ComposerRoot";
|
|
5
|
+
export {
|
|
6
|
+
ComposerAttachments as Attachments,
|
|
7
|
+
ComposerAttachmentByIndex as AttachmentByIndex,
|
|
5
8
|
} from "./ComposerAttachments";
|
|
6
|
-
export { ComposerInput, type ComposerInputProps } from "./ComposerInput";
|
|
7
|
-
export { ComposerSend, type ComposerSendProps } from "./ComposerSend";
|
|
8
|
-
export { ComposerCancel, type ComposerCancelProps } from "./ComposerCancel";
|
|
9
9
|
export {
|
|
10
|
-
|
|
11
|
-
type
|
|
10
|
+
ComposerInput as Input,
|
|
11
|
+
type ComposerInputProps as InputProps,
|
|
12
|
+
} from "./ComposerInput";
|
|
13
|
+
export {
|
|
14
|
+
ComposerSend as Send,
|
|
15
|
+
type ComposerSendProps as SendProps,
|
|
16
|
+
} from "./ComposerSend";
|
|
17
|
+
export {
|
|
18
|
+
ComposerCancel as Cancel,
|
|
19
|
+
type ComposerCancelProps as CancelProps,
|
|
20
|
+
} from "./ComposerCancel";
|
|
21
|
+
export {
|
|
22
|
+
ComposerAddAttachment as AddAttachment,
|
|
23
|
+
type ComposerAddAttachmentProps as AddAttachmentProps,
|
|
12
24
|
} from "./ComposerAddAttachment";
|
|
13
|
-
export { ComposerIf } from "./ComposerIf";
|
|
25
|
+
export { ComposerIf as If } from "./ComposerIf";
|
|
14
26
|
export {
|
|
15
|
-
EditComposerInput,
|
|
16
|
-
type EditComposerInputProps,
|
|
27
|
+
EditComposerInput as EditInput,
|
|
28
|
+
type EditComposerInputProps as EditInputProps,
|
|
17
29
|
} from "./EditComposerInput";
|
|
18
30
|
export {
|
|
19
|
-
EditComposerSend,
|
|
20
|
-
type EditComposerSendProps,
|
|
31
|
+
EditComposerSend as EditSend,
|
|
32
|
+
type EditComposerSendProps as EditSendProps,
|
|
21
33
|
} from "./EditComposerSend";
|
|
22
34
|
export {
|
|
23
|
-
EditComposerCancel,
|
|
24
|
-
type EditComposerCancelProps,
|
|
35
|
+
EditComposerCancel as EditCancel,
|
|
36
|
+
type EditComposerCancelProps as EditCancelProps,
|
|
25
37
|
} from "./EditComposerCancel";
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
export { MessageRoot, type MessageRootProps } from "./MessageRoot";
|
|
2
|
-
export { MessageContent, type MessageContentProps } from "./MessageContent";
|
|
3
1
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
MessageRoot as Root,
|
|
3
|
+
type MessageRootProps as RootProps,
|
|
4
|
+
} from "./MessageRoot";
|
|
5
|
+
export {
|
|
6
|
+
MessageContent as Content,
|
|
7
|
+
type MessageContentProps as ContentProps,
|
|
8
|
+
} from "./MessageContent";
|
|
9
|
+
export {
|
|
10
|
+
MessagePrimitiveParts as Parts,
|
|
11
|
+
MessagePrimitivePartByIndex as PartByIndex,
|
|
6
12
|
} from "./MessageParts";
|
|
7
|
-
export { MessageIf, type MessageIfProps } from "./MessageIf";
|
|
13
|
+
export { MessageIf as If, type MessageIfProps as IfProps } from "./MessageIf";
|
|
8
14
|
export {
|
|
9
|
-
MessageAttachments,
|
|
10
|
-
MessageAttachmentByIndex,
|
|
15
|
+
MessageAttachments as Attachments,
|
|
16
|
+
MessageAttachmentByIndex as AttachmentByIndex,
|
|
11
17
|
} from "./MessageAttachments";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export {
|
|
2
|
-
SuggestionTitle,
|
|
3
|
-
type SuggestionTitleProps,
|
|
2
|
+
SuggestionTitle as Title,
|
|
3
|
+
type SuggestionTitleProps as TitleProps,
|
|
4
4
|
} from "./SuggestionTitle";
|
|
5
5
|
export {
|
|
6
|
-
SuggestionDescription,
|
|
7
|
-
type SuggestionDescriptionProps,
|
|
6
|
+
SuggestionDescription as Description,
|
|
7
|
+
type SuggestionDescriptionProps as DescriptionProps,
|
|
8
8
|
} from "./SuggestionDescription";
|
|
9
9
|
export {
|
|
10
|
-
SuggestionTrigger,
|
|
11
|
-
type SuggestionTriggerProps,
|
|
10
|
+
SuggestionTrigger as Trigger,
|
|
11
|
+
type SuggestionTriggerProps as TriggerProps,
|
|
12
12
|
} from "./SuggestionTrigger";
|