@anvia/react-ui 0.2.0
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/LICENSE +21 -0
- package/README.md +48 -0
- package/dist/attachment/index.d.ts +21 -0
- package/dist/attachment/index.js +12 -0
- package/dist/attachment/index.js.map +1 -0
- package/dist/attachment-BP597fV3.d.ts +9 -0
- package/dist/chat/index.d.ts +106 -0
- package/dist/chat/index.js +22 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat-B3kucz1w.d.ts +13 -0
- package/dist/chunk-7AS6R7BB.js +230 -0
- package/dist/chunk-7AS6R7BB.js.map +1 -0
- package/dist/chunk-AOZN3SWB.js +529 -0
- package/dist/chunk-AOZN3SWB.js.map +1 -0
- package/dist/chunk-AXZB6JSE.js +813 -0
- package/dist/chunk-AXZB6JSE.js.map +1 -0
- package/dist/chunk-LSHD67YK.js +200 -0
- package/dist/chunk-LSHD67YK.js.map +1 -0
- package/dist/chunk-RRINF6FN.js +125 -0
- package/dist/chunk-RRINF6FN.js.map +1 -0
- package/dist/chunk-T3ZFZ3NP.js +30 -0
- package/dist/chunk-T3ZFZ3NP.js.map +1 -0
- package/dist/chunk-WK33ER4Q.js +411 -0
- package/dist/chunk-WK33ER4Q.js.map +1 -0
- package/dist/completion/index.d.ts +28 -0
- package/dist/completion/index.js +16 -0
- package/dist/completion/index.js.map +1 -0
- package/dist/completion-input-WjK6kUyG.d.ts +23 -0
- package/dist/human-input/index.d.ts +76 -0
- package/dist/human-input/index.js +20 -0
- package/dist/human-input/index.js.map +1 -0
- package/dist/human-input-CydeYm_7.d.ts +20 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/message/index.d.ts +87 -0
- package/dist/message/index.js +17 -0
- package/dist/message/index.js.map +1 -0
- package/dist/message-Beb4ZLNU.d.ts +12 -0
- package/dist/render-CRKWam2v.d.ts +8 -0
- package/dist/shared.d.ts +9 -0
- package/dist/shared.js +33 -0
- package/dist/shared.js.map +1 -0
- package/dist/styles.css +47 -0
- package/dist/thread-CluT3m5k.d.ts +31 -0
- package/package.json +82 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ToolApproval, ToolQuestion, ToolQuestionAnswer, ToolQuestionPrompt } from '@anvia/react';
|
|
2
|
+
|
|
3
|
+
type ApprovalContextValue = {
|
|
4
|
+
approval: ToolApproval;
|
|
5
|
+
reason: string;
|
|
6
|
+
setReason(reason: string): void;
|
|
7
|
+
};
|
|
8
|
+
type QuestionContextValue = {
|
|
9
|
+
question: ToolQuestion;
|
|
10
|
+
answers: Record<string, ToolQuestionAnswer>;
|
|
11
|
+
setAnswer(prompt: ToolQuestionPrompt, answer: ToolQuestionAnswer): void;
|
|
12
|
+
};
|
|
13
|
+
type QuestionPromptContextValue = {
|
|
14
|
+
prompt: ToolQuestionPrompt;
|
|
15
|
+
};
|
|
16
|
+
declare function useApproval(): ApprovalContextValue;
|
|
17
|
+
declare function useQuestion(): QuestionContextValue;
|
|
18
|
+
declare function useQuestionPrompt(): QuestionPromptContextValue;
|
|
19
|
+
|
|
20
|
+
export { type ApprovalContextValue as A, type QuestionContextValue as Q, type QuestionPromptContextValue as a, useQuestion as b, useQuestionPrompt as c, useApproval as u };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { Attachment } from './attachment/index.js';
|
|
2
|
+
export { A as AttachmentContextValue, u as useAttachment } from './attachment-BP597fV3.js';
|
|
3
|
+
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-B3kucz1w.js';
|
|
4
|
+
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-WjK6kUyG.js';
|
|
5
|
+
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, T as ThreadContextValue, u as useComposer, c as useThread } from './thread-CluT3m5k.js';
|
|
6
|
+
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-CydeYm_7.js';
|
|
7
|
+
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-Beb4ZLNU.js';
|
|
8
|
+
export { Composer, ComposerSubmitMessage, ComposerSubmitMessageArgs, Thread } from './chat/index.js';
|
|
9
|
+
export { Completion } from './completion/index.js';
|
|
10
|
+
export { HumanInput } from './human-input/index.js';
|
|
11
|
+
export { Message, MessageAttachmentPart, MessagePartsFilter, MessageToolPart, MessageToolRenderWhen } from './message/index.js';
|
|
12
|
+
export { P as PrimitiveProps, a as PrimitiveRef } from './render-CRKWam2v.js';
|
|
13
|
+
import '@anvia/react';
|
|
14
|
+
import 'react';
|
|
15
|
+
import 'react-markdown';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Composer,
|
|
3
|
+
Thread
|
|
4
|
+
} from "./chunk-AXZB6JSE.js";
|
|
5
|
+
import {
|
|
6
|
+
Completion
|
|
7
|
+
} from "./chunk-LSHD67YK.js";
|
|
8
|
+
import {
|
|
9
|
+
HumanInput
|
|
10
|
+
} from "./chunk-WK33ER4Q.js";
|
|
11
|
+
import {
|
|
12
|
+
Message
|
|
13
|
+
} from "./chunk-AOZN3SWB.js";
|
|
14
|
+
import {
|
|
15
|
+
Attachment
|
|
16
|
+
} from "./chunk-RRINF6FN.js";
|
|
17
|
+
import "./chunk-T3ZFZ3NP.js";
|
|
18
|
+
import {
|
|
19
|
+
ChatProvider,
|
|
20
|
+
CompletionProvider,
|
|
21
|
+
useApproval,
|
|
22
|
+
useAttachment,
|
|
23
|
+
useChatContext,
|
|
24
|
+
useCompletionContext,
|
|
25
|
+
useCompletionInput,
|
|
26
|
+
useComposer,
|
|
27
|
+
useHumanInput,
|
|
28
|
+
useMessage,
|
|
29
|
+
useMessagePart,
|
|
30
|
+
useQuestion,
|
|
31
|
+
useQuestionPrompt,
|
|
32
|
+
useThread
|
|
33
|
+
} from "./chunk-7AS6R7BB.js";
|
|
34
|
+
export {
|
|
35
|
+
Attachment,
|
|
36
|
+
ChatProvider,
|
|
37
|
+
Completion,
|
|
38
|
+
CompletionProvider,
|
|
39
|
+
Composer,
|
|
40
|
+
HumanInput,
|
|
41
|
+
Message,
|
|
42
|
+
Thread,
|
|
43
|
+
useApproval,
|
|
44
|
+
useAttachment,
|
|
45
|
+
useChatContext,
|
|
46
|
+
useCompletionContext,
|
|
47
|
+
useCompletionInput,
|
|
48
|
+
useComposer,
|
|
49
|
+
useHumanInput,
|
|
50
|
+
useMessage,
|
|
51
|
+
useMessagePart,
|
|
52
|
+
useQuestion,
|
|
53
|
+
useQuestionPrompt,
|
|
54
|
+
useThread
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as react_markdown from 'react-markdown';
|
|
2
|
+
import * as _anvia_react from '@anvia/react';
|
|
3
|
+
import { UIMessagePart } from '@anvia/react';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
export { u as useChatContext } from '../chat-B3kucz1w.js';
|
|
6
|
+
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from '../message-Beb4ZLNU.js';
|
|
7
|
+
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
8
|
+
|
|
9
|
+
type MessagePartsFilter = (part: UIMessagePart) => boolean;
|
|
10
|
+
type MessageToolPart = Extract<UIMessagePart, {
|
|
11
|
+
type: "tool";
|
|
12
|
+
}>;
|
|
13
|
+
type MessageToolRenderWhen = "always" | "pending" | "settled";
|
|
14
|
+
type MessageAttachmentPart = Extract<UIMessagePart, {
|
|
15
|
+
type: "attachment";
|
|
16
|
+
}>;
|
|
17
|
+
|
|
18
|
+
declare const Message: {
|
|
19
|
+
readonly Root: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"article">, "children"> & {
|
|
20
|
+
children?: react.ReactNode | ((message: _anvia_react.UIMessage) => react.ReactNode);
|
|
21
|
+
} & react.RefAttributes<HTMLElement>>;
|
|
22
|
+
readonly Content: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
23
|
+
asChild?: boolean;
|
|
24
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
readonly Parts: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
26
|
+
children?: react.ReactNode | ((part: _anvia_react.UIMessagePart) => react.ReactNode);
|
|
27
|
+
filter?: MessagePartsFilter;
|
|
28
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
29
|
+
readonly Part: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
30
|
+
children?: react.ReactNode | ((part: _anvia_react.UIMessagePart) => react.ReactNode);
|
|
31
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
readonly Text: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "asChild"> & {
|
|
33
|
+
asChild?: boolean;
|
|
34
|
+
} & react.RefAttributes<HTMLSpanElement>>;
|
|
35
|
+
readonly Markdown: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
36
|
+
children?: string;
|
|
37
|
+
components?: react_markdown.Components;
|
|
38
|
+
remarkPlugins?: react_markdown.Options["remarkPlugins"];
|
|
39
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
40
|
+
readonly CodeBlock: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"pre">, "children"> & {
|
|
41
|
+
children?: react.ReactNode;
|
|
42
|
+
code?: string;
|
|
43
|
+
language?: string;
|
|
44
|
+
} & react.RefAttributes<HTMLPreElement>>;
|
|
45
|
+
readonly Reasoning: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>, "ref">, "asChild"> & {
|
|
46
|
+
asChild?: boolean;
|
|
47
|
+
} & react.RefAttributes<HTMLDetailsElement>>;
|
|
48
|
+
readonly Tool: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
49
|
+
children?: react.ReactNode | ((part: MessageToolPart) => react.ReactNode);
|
|
50
|
+
renderWhen?: MessageToolRenderWhen;
|
|
51
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
52
|
+
readonly ToolName: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "asChild"> & {
|
|
53
|
+
asChild?: boolean;
|
|
54
|
+
} & react.RefAttributes<HTMLSpanElement>>;
|
|
55
|
+
readonly ToolInput: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLPreElement>, HTMLPreElement>, "ref">, "asChild"> & {
|
|
56
|
+
asChild?: boolean;
|
|
57
|
+
} & react.RefAttributes<HTMLPreElement>>;
|
|
58
|
+
readonly ToolOutput: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLPreElement>, HTMLPreElement>, "ref">, "asChild"> & {
|
|
59
|
+
asChild?: boolean;
|
|
60
|
+
} & react.RefAttributes<HTMLPreElement>>;
|
|
61
|
+
readonly ToolError: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
62
|
+
asChild?: boolean;
|
|
63
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
64
|
+
readonly ToolStatus: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "asChild"> & {
|
|
65
|
+
asChild?: boolean;
|
|
66
|
+
} & react.RefAttributes<HTMLSpanElement>>;
|
|
67
|
+
readonly Attachment: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
68
|
+
children?: react.ReactNode | ((attachment: _anvia_react.UIAttachment) => react.ReactNode);
|
|
69
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
70
|
+
readonly Data: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLPreElement>, HTMLPreElement>, "ref">, "asChild"> & {
|
|
71
|
+
asChild?: boolean;
|
|
72
|
+
} & react.RefAttributes<HTMLPreElement>>;
|
|
73
|
+
readonly Error: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
74
|
+
asChild?: boolean;
|
|
75
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
76
|
+
readonly Actions: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
77
|
+
asChild?: boolean;
|
|
78
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
79
|
+
readonly Copy: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
|
|
80
|
+
asChild?: boolean;
|
|
81
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
82
|
+
readonly Regenerate: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
|
|
83
|
+
asChild?: boolean;
|
|
84
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export { Message, type MessageAttachmentPart, type MessagePartsFilter, type MessageToolPart, type MessageToolRenderWhen };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Message
|
|
3
|
+
} from "../chunk-AOZN3SWB.js";
|
|
4
|
+
import "../chunk-RRINF6FN.js";
|
|
5
|
+
import "../chunk-T3ZFZ3NP.js";
|
|
6
|
+
import {
|
|
7
|
+
useChatContext,
|
|
8
|
+
useMessage,
|
|
9
|
+
useMessagePart
|
|
10
|
+
} from "../chunk-7AS6R7BB.js";
|
|
11
|
+
export {
|
|
12
|
+
Message,
|
|
13
|
+
useChatContext,
|
|
14
|
+
useMessage,
|
|
15
|
+
useMessagePart
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UIMessage, UIMessagePart } from '@anvia/react';
|
|
2
|
+
|
|
3
|
+
type MessageContextValue = {
|
|
4
|
+
message: UIMessage;
|
|
5
|
+
};
|
|
6
|
+
type MessagePartContextValue = {
|
|
7
|
+
part: UIMessagePart;
|
|
8
|
+
};
|
|
9
|
+
declare function useMessage(): MessageContextValue;
|
|
10
|
+
declare function useMessagePart(): MessagePartContextValue;
|
|
11
|
+
|
|
12
|
+
export { type MessageContextValue as M, type MessagePartContextValue as a, useMessagePart as b, useMessage as u };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ElementType, ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react';
|
|
2
|
+
|
|
3
|
+
type PrimitiveProps<TElement extends ElementType = "div"> = Omit<ComponentPropsWithoutRef<TElement>, "asChild"> & {
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
};
|
|
6
|
+
type PrimitiveRef<TElement extends ElementType> = ComponentPropsWithRef<TElement>["ref"];
|
|
7
|
+
|
|
8
|
+
export type { PrimitiveProps as P, PrimitiveRef as a };
|
package/dist/shared.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { A as AttachmentContextValue, u as useAttachment } from './attachment-BP597fV3.js';
|
|
2
|
+
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-B3kucz1w.js';
|
|
3
|
+
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-WjK6kUyG.js';
|
|
4
|
+
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, T as ThreadContextValue, u as useComposer, c as useThread } from './thread-CluT3m5k.js';
|
|
5
|
+
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-CydeYm_7.js';
|
|
6
|
+
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-Beb4ZLNU.js';
|
|
7
|
+
export { P as PrimitiveProps, a as PrimitiveRef } from './render-CRKWam2v.js';
|
|
8
|
+
import '@anvia/react';
|
|
9
|
+
import 'react';
|
package/dist/shared.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChatProvider,
|
|
3
|
+
CompletionProvider,
|
|
4
|
+
useApproval,
|
|
5
|
+
useAttachment,
|
|
6
|
+
useChatContext,
|
|
7
|
+
useCompletionContext,
|
|
8
|
+
useCompletionInput,
|
|
9
|
+
useComposer,
|
|
10
|
+
useHumanInput,
|
|
11
|
+
useMessage,
|
|
12
|
+
useMessagePart,
|
|
13
|
+
useQuestion,
|
|
14
|
+
useQuestionPrompt,
|
|
15
|
+
useThread
|
|
16
|
+
} from "./chunk-7AS6R7BB.js";
|
|
17
|
+
export {
|
|
18
|
+
ChatProvider,
|
|
19
|
+
CompletionProvider,
|
|
20
|
+
useApproval,
|
|
21
|
+
useAttachment,
|
|
22
|
+
useChatContext,
|
|
23
|
+
useCompletionContext,
|
|
24
|
+
useCompletionInput,
|
|
25
|
+
useComposer,
|
|
26
|
+
useHumanInput,
|
|
27
|
+
useMessage,
|
|
28
|
+
useMessagePart,
|
|
29
|
+
useQuestion,
|
|
30
|
+
useQuestionPrompt,
|
|
31
|
+
useThread
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[data-anvia-thread-viewport] {
|
|
2
|
+
overflow: auto;
|
|
3
|
+
min-height: 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
[data-anvia-reasoning] pre,
|
|
7
|
+
[data-anvia-code-block],
|
|
8
|
+
[data-anvia-tool-input],
|
|
9
|
+
[data-anvia-tool-output],
|
|
10
|
+
[data-anvia-data],
|
|
11
|
+
[data-anvia-approval-args],
|
|
12
|
+
[data-anvia-question-args] {
|
|
13
|
+
overflow: auto;
|
|
14
|
+
max-width: 100%;
|
|
15
|
+
white-space: pre-wrap;
|
|
16
|
+
word-break: break-word;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
[data-anvia-composer-input],
|
|
20
|
+
[data-anvia-completion-input],
|
|
21
|
+
[data-anvia-approval-reason],
|
|
22
|
+
[data-anvia-question-text-answer] {
|
|
23
|
+
min-height: 2.75rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[data-anvia-composer-input] {
|
|
27
|
+
min-width: 0;
|
|
28
|
+
overflow-y: hidden;
|
|
29
|
+
resize: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[data-anvia-completion-input],
|
|
33
|
+
[data-anvia-approval-reason],
|
|
34
|
+
[data-anvia-question-text-answer] {
|
|
35
|
+
resize: vertical;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[data-anvia-attachment-preview] img {
|
|
39
|
+
display: block;
|
|
40
|
+
max-width: 8rem;
|
|
41
|
+
max-height: 8rem;
|
|
42
|
+
object-fit: contain;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[data-state="disabled"] {
|
|
46
|
+
opacity: 0.55;
|
|
47
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CreateUIAttachment, UIAttachment } from '@anvia/react';
|
|
2
|
+
import { C as ChatController } from './chat-B3kucz1w.js';
|
|
3
|
+
import { MutableRefObject } from 'react';
|
|
4
|
+
|
|
5
|
+
type ComposerAttachmentInput = File | CreateUIAttachment;
|
|
6
|
+
type ComposerAttachmentsUpdate = UIAttachment[] | ((attachments: UIAttachment[]) => UIAttachment[]);
|
|
7
|
+
type ComposerContextValue = {
|
|
8
|
+
input: string;
|
|
9
|
+
setInput(input: string): void;
|
|
10
|
+
attachments: UIAttachment[];
|
|
11
|
+
setAttachments(update: ComposerAttachmentsUpdate): void;
|
|
12
|
+
addAttachment(attachment: ComposerAttachmentInput): Promise<void>;
|
|
13
|
+
removeAttachment(id: string): void;
|
|
14
|
+
clearAttachments(): void;
|
|
15
|
+
submit(): Promise<void>;
|
|
16
|
+
stop(): void;
|
|
17
|
+
status: ChatController["status"];
|
|
18
|
+
canSubmit: boolean;
|
|
19
|
+
canStop: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare function useComposer(): ComposerContextValue;
|
|
22
|
+
|
|
23
|
+
type ThreadContextValue = {
|
|
24
|
+
viewportRef: MutableRefObject<HTMLElement | null>;
|
|
25
|
+
atBottom: boolean;
|
|
26
|
+
setAtBottom(atBottom: boolean): void;
|
|
27
|
+
scrollToBottom(behavior?: ScrollBehavior): void;
|
|
28
|
+
};
|
|
29
|
+
declare function useThread(): ThreadContextValue;
|
|
30
|
+
|
|
31
|
+
export { type ComposerAttachmentInput as C, type ThreadContextValue as T, type ComposerAttachmentsUpdate as a, type ComposerContextValue as b, useThread as c, useComposer as u };
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@anvia/react-ui",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Composable React UI primitives for Anvia chat and completion experiences.",
|
|
5
|
+
"author": "anvia",
|
|
6
|
+
"maintainer": "Indra Zulfi",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/anvia-hq/anvia",
|
|
11
|
+
"directory": "packages/react-ui"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./attachment": {
|
|
28
|
+
"types": "./dist/attachment/index.d.ts",
|
|
29
|
+
"import": "./dist/attachment/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./chat": {
|
|
32
|
+
"types": "./dist/chat/index.d.ts",
|
|
33
|
+
"import": "./dist/chat/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./completion": {
|
|
36
|
+
"types": "./dist/completion/index.d.ts",
|
|
37
|
+
"import": "./dist/completion/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./human-input": {
|
|
40
|
+
"types": "./dist/human-input/index.d.ts",
|
|
41
|
+
"import": "./dist/human-input/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./message": {
|
|
44
|
+
"types": "./dist/message/index.d.ts",
|
|
45
|
+
"import": "./dist/message/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./shared": {
|
|
48
|
+
"types": "./dist/shared.d.ts",
|
|
49
|
+
"import": "./dist/shared.js"
|
|
50
|
+
},
|
|
51
|
+
"./styles.css": "./dist/styles.css"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@radix-ui/react-slot": "^1.3.0",
|
|
55
|
+
"react-markdown": "^10.1.0",
|
|
56
|
+
"remark-gfm": "^4.0.1"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"@anvia/react": ">=0.7.8 <1.0.0",
|
|
60
|
+
"react": ">=18"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@testing-library/react": "^16.3.2",
|
|
64
|
+
"@types/node": "^24.9.1",
|
|
65
|
+
"@types/react": "^19.2.14",
|
|
66
|
+
"@types/react-dom": "^19.2.3",
|
|
67
|
+
"@vitest/coverage-v8": "4.1.5",
|
|
68
|
+
"happy-dom": "20.9.0",
|
|
69
|
+
"react": "19.2.6",
|
|
70
|
+
"react-dom": "19.2.6",
|
|
71
|
+
"tsup": "^8.5.0",
|
|
72
|
+
"typescript": "^5.9.3",
|
|
73
|
+
"vitest": "^4.0.8",
|
|
74
|
+
"@anvia/react": "0.7.9"
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "tsup src/index.ts src/attachment/index.ts src/chat/index.ts src/completion/index.ts src/human-input/index.ts src/message/index.ts src/shared.ts --format esm --dts --sourcemap --clean --external react && cp src/styles.css dist/styles.css",
|
|
78
|
+
"coverage": "vitest run --coverage",
|
|
79
|
+
"test": "vitest run",
|
|
80
|
+
"typecheck": "tsc --noEmit"
|
|
81
|
+
}
|
|
82
|
+
}
|