@anvia/react-ui 1.0.0-rc.1 → 1.0.0-rc.11
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/README.md +52 -39
- package/dist/attachment/index.d.ts +5 -5
- package/dist/attachment/index.js +4 -4
- package/dist/{attachment-BP597fV3.d.ts → attachment-mbjsroli.d.ts} +1 -1
- package/dist/chat/index.d.ts +13 -12
- package/dist/chat/index.js +11 -9
- package/dist/chat-tfA570mg.d.ts +86 -0
- package/dist/{chunk-7RMRM7W3.js → chunk-647LAYRV.js} +90 -65
- package/dist/chunk-647LAYRV.js.map +1 -0
- package/dist/chunk-6XOJFLX4.js +22 -0
- package/dist/chunk-6XOJFLX4.js.map +1 -0
- package/dist/chunk-CKA4CE26.js +25 -0
- package/dist/chunk-CKA4CE26.js.map +1 -0
- package/dist/{chunk-JWZDNM5D.js → chunk-CRXNFZRW.js} +145 -125
- package/dist/chunk-CRXNFZRW.js.map +1 -0
- package/dist/{chunk-7HR34SOF.js → chunk-CVXLQCDI.js} +13 -21
- package/dist/chunk-CVXLQCDI.js.map +1 -0
- package/dist/{chunk-ULGJLLZE.js → chunk-F6AKBUO3.js} +12 -12
- package/dist/chunk-F6AKBUO3.js.map +1 -0
- package/dist/{chunk-FABSIZZ7.js → chunk-HWJIMLHC.js} +97 -90
- package/dist/chunk-HWJIMLHC.js.map +1 -0
- package/dist/{chunk-SBYUKODG.js → chunk-MISX4WUT.js} +10 -15
- package/dist/chunk-MISX4WUT.js.map +1 -0
- package/dist/{chunk-R3NA6BWW.js → chunk-OQE6SHZE.js} +54 -56
- package/dist/chunk-OQE6SHZE.js.map +1 -0
- package/dist/{chunk-VEYJNQVW.js → chunk-S4XLE2RN.js} +11 -16
- package/dist/chunk-S4XLE2RN.js.map +1 -0
- package/dist/{chunk-43U2XQP2.js → chunk-SOG2GVE4.js} +69 -25
- package/dist/chunk-SOG2GVE4.js.map +1 -0
- package/dist/{chunk-56CV6S76.js → chunk-UCBAG42A.js} +9 -21
- package/dist/chunk-UCBAG42A.js.map +1 -0
- package/dist/completion/index.d.ts +4 -3
- package/dist/completion/index.js +4 -4
- package/dist/completion-input-DHlwrhxB.d.ts +24 -0
- package/dist/{composer-CzsbDFPt.d.ts → composer-CigccTLT.d.ts} +19 -7
- package/dist/human-input/index.d.ts +10 -8
- package/dist/human-input/index.js +5 -4
- package/dist/human-input-D7jgYsfM.d.ts +27 -0
- package/dist/image/index.d.ts +6 -6
- package/dist/image/index.js +4 -4
- package/dist/{image-DanUxcl2.d.ts → image-VZv6Ddsn.d.ts} +1 -1
- package/dist/index.d.ts +19 -18
- package/dist/index.js +60 -64
- package/dist/index.js.map +1 -1
- package/dist/message/index.d.ts +12 -11
- package/dist/message/index.js +8 -6
- package/dist/{message-CkEnKhAn.d.ts → message-CNRnZQwU.d.ts} +1 -1
- package/dist/selection-toolbar/index.d.ts +2 -2
- package/dist/selection-toolbar/index.js +5 -4
- package/dist/shared.d.ts +9 -8
- package/dist/shared.js +1 -1
- package/dist/stream/index.d.ts +2 -0
- package/dist/stream/index.js +1 -1
- package/dist/{thread-uEm8hH0s.d.ts → thread-Bz6-1zaJ.d.ts} +1 -0
- package/dist/thread-list/index.d.ts +3 -3
- package/dist/thread-list/index.js +6 -6
- package/package.json +17 -17
- package/dist/chat-B3kucz1w.d.ts +0 -13
- package/dist/chunk-43U2XQP2.js.map +0 -1
- package/dist/chunk-56CV6S76.js.map +0 -1
- package/dist/chunk-7HR34SOF.js.map +0 -1
- package/dist/chunk-7RMRM7W3.js.map +0 -1
- package/dist/chunk-FABSIZZ7.js.map +0 -1
- package/dist/chunk-JWZDNM5D.js.map +0 -1
- package/dist/chunk-R3NA6BWW.js.map +0 -1
- package/dist/chunk-SBYUKODG.js.map +0 -1
- package/dist/chunk-ULGJLLZE.js.map +0 -1
- package/dist/chunk-VEYJNQVW.js.map +0 -1
- package/dist/completion-input-WjK6kUyG.d.ts +0 -23
- package/dist/human-input-CydeYm_7.d.ts +0 -20
- package/dist/stream/styles.css +0 -17
- package/dist/styles.css +0 -130
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { A as AttachmentContextValue, u as useAttachment } from './attachment-
|
|
3
|
-
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-
|
|
4
|
-
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-
|
|
5
|
-
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-
|
|
6
|
-
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-
|
|
7
|
-
export { I as ImageContextValue, u as useImage } from './image-
|
|
8
|
-
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-
|
|
1
|
+
export { AttachmentPrimitive } from './attachment/index.js';
|
|
2
|
+
export { A as AttachmentContextValue, u as useAttachment } from './attachment-mbjsroli.js';
|
|
3
|
+
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-tfA570mg.js';
|
|
4
|
+
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-DHlwrhxB.js';
|
|
5
|
+
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-CigccTLT.js';
|
|
6
|
+
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-D7jgYsfM.js';
|
|
7
|
+
export { I as ImageContextValue, u as useImage } from './image-VZv6Ddsn.js';
|
|
8
|
+
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-CNRnZQwU.js';
|
|
9
9
|
export { S as SelectionToolbarContextValue, a as SelectionToolbarSelection, u as useSelectionToolbar } from './selection-toolbar-Cwjbuv5S.js';
|
|
10
|
-
export { T as ThreadContextValue, u as useThread } from './thread-
|
|
10
|
+
export { T as ThreadContextValue, u as useThread } from './thread-Bz6-1zaJ.js';
|
|
11
11
|
export { T as ThreadListController, a as ThreadListItemContextValue, b as ThreadListProvider, c as ThreadListProviderProps, d as ThreadListRecord, u as useThreadList, e as useThreadListItem } from './thread-list-On8db4XL.js';
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
12
|
+
export { ComposerPrimitive, ComposerSubmitMessage, ComposerSubmitMessageArgs, ThreadPrimitive } from './chat/index.js';
|
|
13
|
+
export { CompletionPrimitive } from './completion/index.js';
|
|
14
14
|
import * as react from 'react';
|
|
15
15
|
import { ReactNode } from 'react';
|
|
16
16
|
import { UseChatResult } from '@anvia/react';
|
|
17
17
|
import { P as PrimitiveProps } from './render-CRKWam2v.js';
|
|
18
18
|
export { a as PrimitiveRef } from './render-CRKWam2v.js';
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
19
|
+
export { HumanInputPrimitive } from './human-input/index.js';
|
|
20
|
+
export { ImagePrimitive } from './image/index.js';
|
|
21
|
+
export { MessageAttachmentPart, MessageEntityProps, MessagePartsFilter, MessagePrimitive, MessageStreamOptions, MessageToolPart, MessageToolRenderWhen } from './message/index.js';
|
|
22
|
+
export { SelectionToolbarPrimitive } from './selection-toolbar/index.js';
|
|
23
23
|
export { StreamMarkdown, StreamMarkdownProps } from './stream/index.js';
|
|
24
|
-
export {
|
|
24
|
+
export { ThreadListItemPrimitive, ThreadListPrimitive } from './thread-list/index.js';
|
|
25
|
+
import '@anvia/client';
|
|
25
26
|
import 'react-markdown';
|
|
26
27
|
|
|
27
28
|
type ContextUsage = NonNullable<UseChatResult["contextUsage"]>;
|
|
@@ -30,10 +31,10 @@ type ContextMeterProps = Omit<PrimitiveProps<"div">, "children"> & {
|
|
|
30
31
|
display?: "remaining" | "used";
|
|
31
32
|
children?: ReactNode | ((usage: ContextUsage) => ReactNode);
|
|
32
33
|
};
|
|
33
|
-
declare const
|
|
34
|
+
declare const ContextMeterPrimitive: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
34
35
|
usage?: ContextUsage;
|
|
35
36
|
display?: "remaining" | "used";
|
|
36
37
|
children?: ReactNode | ((usage: ContextUsage) => ReactNode);
|
|
37
38
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
38
39
|
|
|
39
|
-
export {
|
|
40
|
+
export { ContextMeterPrimitive, type ContextMeterProps, PrimitiveProps };
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./chunk-7RMRM7W3.js";
|
|
2
|
+
SelectionToolbarPrimitive
|
|
3
|
+
} from "./chunk-UCBAG42A.js";
|
|
5
4
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "./chunk-
|
|
5
|
+
ThreadListItemPrimitive,
|
|
6
|
+
ThreadListPrimitive
|
|
7
|
+
} from "./chunk-647LAYRV.js";
|
|
9
8
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
ComposerPrimitive,
|
|
10
|
+
ThreadPrimitive
|
|
11
|
+
} from "./chunk-HWJIMLHC.js";
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
} from "./chunk-
|
|
13
|
+
CompletionPrimitive
|
|
14
|
+
} from "./chunk-S4XLE2RN.js";
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
HumanInputPrimitive
|
|
17
|
+
} from "./chunk-OQE6SHZE.js";
|
|
18
18
|
import {
|
|
19
|
-
|
|
20
|
-
} from "./chunk-
|
|
19
|
+
ImagePrimitive
|
|
20
|
+
} from "./chunk-CVXLQCDI.js";
|
|
21
21
|
import {
|
|
22
|
-
|
|
23
|
-
} from "./chunk-
|
|
22
|
+
MessagePrimitive
|
|
23
|
+
} from "./chunk-CRXNFZRW.js";
|
|
24
|
+
import "./chunk-6XOJFLX4.js";
|
|
24
25
|
import {
|
|
25
|
-
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
StreamMarkdown
|
|
27
|
+
} from "./chunk-F6AKBUO3.js";
|
|
27
28
|
import {
|
|
28
|
-
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
AttachmentPrimitive
|
|
30
|
+
} from "./chunk-MISX4WUT.js";
|
|
31
|
+
import "./chunk-CKA4CE26.js";
|
|
30
32
|
import {
|
|
31
33
|
renderPrimitive
|
|
32
34
|
} from "./chunk-T3ZFZ3NP.js";
|
|
@@ -50,60 +52,54 @@ import {
|
|
|
50
52
|
useThread,
|
|
51
53
|
useThreadList,
|
|
52
54
|
useThreadListItem
|
|
53
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-SOG2GVE4.js";
|
|
54
56
|
|
|
55
57
|
// src/context-meter.tsx
|
|
56
58
|
import { forwardRef } from "react";
|
|
57
59
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
68
|
-
"span",
|
|
60
|
+
var ContextMeterPrimitive = forwardRef(
|
|
61
|
+
function ContextMeter({ usage, display = "remaining", children, ...props }, ref) {
|
|
62
|
+
if (usage === void 0) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const percent = display === "remaining" ? usage.remainingPercent : usage.usedPercent;
|
|
66
|
+
const roundedPercent = Math.round(percent);
|
|
67
|
+
const label = `${roundedPercent}% context ${display === "remaining" ? "left" : "used"}`;
|
|
68
|
+
const content = typeof children === "function" ? children(usage) : children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
+
/* @__PURE__ */ jsx("span", { children: label }),
|
|
70
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { style: { width: `${Math.min(100, Math.max(0, percent))}%` } }) })
|
|
71
|
+
] });
|
|
72
|
+
return renderPrimitive(
|
|
73
|
+
"div",
|
|
69
74
|
{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"aria-valuemin": 0,
|
|
83
|
-
"aria-valuenow": roundedPercent,
|
|
84
|
-
"data-anvia-context-meter": "",
|
|
85
|
-
"data-display": display,
|
|
86
|
-
role: props.role ?? "progressbar"
|
|
87
|
-
},
|
|
88
|
-
ref
|
|
89
|
-
);
|
|
90
|
-
});
|
|
75
|
+
...props,
|
|
76
|
+
children: content,
|
|
77
|
+
"aria-label": props["aria-label"] ?? label,
|
|
78
|
+
"aria-valuemax": 100,
|
|
79
|
+
"aria-valuemin": 0,
|
|
80
|
+
"aria-valuenow": roundedPercent,
|
|
81
|
+
role: props.role ?? "progressbar"
|
|
82
|
+
},
|
|
83
|
+
ref
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
);
|
|
91
87
|
export {
|
|
92
|
-
|
|
88
|
+
AttachmentPrimitive,
|
|
93
89
|
ChatProvider,
|
|
94
|
-
|
|
90
|
+
CompletionPrimitive,
|
|
95
91
|
CompletionProvider,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
ComposerPrimitive,
|
|
93
|
+
ContextMeterPrimitive,
|
|
94
|
+
HumanInputPrimitive,
|
|
95
|
+
ImagePrimitive,
|
|
96
|
+
MessagePrimitive,
|
|
97
|
+
SelectionToolbarPrimitive,
|
|
102
98
|
StreamMarkdown,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
ThreadListItem,
|
|
99
|
+
ThreadListItemPrimitive,
|
|
100
|
+
ThreadListPrimitive,
|
|
106
101
|
ThreadListProvider,
|
|
102
|
+
ThreadPrimitive,
|
|
107
103
|
useApproval,
|
|
108
104
|
useAttachment,
|
|
109
105
|
useChatContext,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/context-meter.tsx"],"sourcesContent":["import type { UseChatResult } from \"@anvia/react\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport { type PrimitiveProps, renderPrimitive } from \"./primitives\";\n\ntype ContextUsage = NonNullable<UseChatResult[\"contextUsage\"]>;\n\nexport type ContextMeterProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n usage?: ContextUsage;\n display?: \"remaining\" | \"used\";\n children?: ReactNode | ((usage: ContextUsage) => ReactNode);\n};\n\nexport const
|
|
1
|
+
{"version":3,"sources":["../src/context-meter.tsx"],"sourcesContent":["import type { UseChatResult } from \"@anvia/react\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport { type PrimitiveProps, renderPrimitive } from \"./primitives\";\n\ntype ContextUsage = NonNullable<UseChatResult[\"contextUsage\"]>;\n\nexport type ContextMeterProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n usage?: ContextUsage;\n display?: \"remaining\" | \"used\";\n children?: ReactNode | ((usage: ContextUsage) => ReactNode);\n};\n\nexport const ContextMeterPrimitive = forwardRef<HTMLDivElement, ContextMeterProps>(\n function ContextMeter({ usage, display = \"remaining\", children, ...props }, ref) {\n if (usage === undefined) {\n return null;\n }\n\n const percent = display === \"remaining\" ? usage.remainingPercent : usage.usedPercent;\n const roundedPercent = Math.round(percent);\n const label = `${roundedPercent}% context ${display === \"remaining\" ? \"left\" : \"used\"}`;\n const content =\n typeof children === \"function\"\n ? children(usage)\n : (children ?? (\n <>\n <span>{label}</span>\n <span aria-hidden=\"true\">\n <span style={{ width: `${Math.min(100, Math.max(0, percent))}%` }} />\n </span>\n </>\n ));\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: content,\n \"aria-label\": props[\"aria-label\"] ?? label,\n \"aria-valuemax\": 100,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": roundedPercent,\n role: props.role ?? \"progressbar\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,kBAAkC;AAyB/B,mBACE,KADF;AAbL,IAAM,wBAAwB;AAAA,EACnC,SAAS,aAAa,EAAE,OAAO,UAAU,aAAa,UAAU,GAAG,MAAM,GAAG,KAAK;AAC/E,QAAI,UAAU,QAAW;AACvB,aAAO;AAAA,IACT;AAEA,UAAM,UAAU,YAAY,cAAc,MAAM,mBAAmB,MAAM;AACzE,UAAM,iBAAiB,KAAK,MAAM,OAAO;AACzC,UAAM,QAAQ,GAAG,cAAc,aAAa,YAAY,cAAc,SAAS,MAAM;AACrF,UAAM,UACJ,OAAO,aAAa,aAChB,SAAS,KAAK,IACb,YACC,iCACE;AAAA,0BAAC,UAAM,iBAAM;AAAA,MACb,oBAAC,UAAK,eAAY,QAChB,8BAAC,UAAK,OAAO,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,CAAC,IAAI,GAAG,GACrE;AAAA,OACF;AAGR,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,GAAG;AAAA,QACH,UAAU;AAAA,QACV,cAAc,MAAM,YAAY,KAAK;AAAA,QACrC,iBAAiB;AAAA,QACjB,iBAAiB;AAAA,QACjB,iBAAiB;AAAA,QACjB,MAAM,MAAM,QAAQ;AAAA,MACtB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
package/dist/message/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as react_markdown from 'react-markdown';
|
|
2
|
-
import * as
|
|
3
|
-
import { UIMessagePart
|
|
2
|
+
import * as _anvia_client from '@anvia/client';
|
|
3
|
+
import { UIMessagePart } from '@anvia/client';
|
|
4
|
+
import { StreamSmoothingLifecycle } from '@anvia/react';
|
|
4
5
|
import * as react from 'react';
|
|
5
6
|
import { HTMLAttributes } from 'react';
|
|
6
|
-
export { u as useChatContext } from '../chat-
|
|
7
|
-
import { d as ComposerEntity } from '../composer-
|
|
8
|
-
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from '../message-
|
|
7
|
+
export { u as useChatContext } from '../chat-tfA570mg.js';
|
|
8
|
+
import { d as ComposerEntity } from '../composer-CigccTLT.js';
|
|
9
|
+
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from '../message-CNRnZQwU.js';
|
|
9
10
|
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
10
11
|
|
|
11
12
|
type MessagePartsFilter = (part: UIMessagePart) => boolean;
|
|
@@ -22,21 +23,21 @@ type MessageEntityProps = HTMLAttributes<HTMLSpanElement> & {
|
|
|
22
23
|
entity: ComposerEntity;
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
declare const
|
|
26
|
+
declare const MessagePrimitive: {
|
|
26
27
|
readonly Root: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"article">, "children"> & {
|
|
27
|
-
children?: react.ReactNode | ((message:
|
|
28
|
+
children?: react.ReactNode | ((message: _anvia_client.UIMessage) => react.ReactNode);
|
|
28
29
|
} & react.RefAttributes<HTMLElement>>;
|
|
29
30
|
readonly Content: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
30
31
|
asChild?: boolean;
|
|
31
32
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
32
33
|
readonly Parts: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
33
|
-
children?: react.ReactNode | ((part:
|
|
34
|
+
children?: react.ReactNode | ((part: _anvia_client.UIMessagePart) => react.ReactNode);
|
|
34
35
|
filter?: MessagePartsFilter;
|
|
35
36
|
} & {
|
|
36
37
|
stream?: MessageStreamOptions;
|
|
37
38
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
38
39
|
readonly Part: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
39
|
-
children?: react.ReactNode | ((part:
|
|
40
|
+
children?: react.ReactNode | ((part: _anvia_client.UIMessagePart) => react.ReactNode);
|
|
40
41
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
41
42
|
readonly Text: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "asChild"> & {
|
|
42
43
|
asChild?: boolean;
|
|
@@ -82,7 +83,7 @@ declare const Message: {
|
|
|
82
83
|
asChild?: boolean;
|
|
83
84
|
} & react.RefAttributes<HTMLSpanElement>>;
|
|
84
85
|
readonly Attachment: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
85
|
-
children?: react.ReactNode | ((attachment:
|
|
86
|
+
children?: react.ReactNode | ((attachment: _anvia_client.UIAttachment) => react.ReactNode);
|
|
86
87
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
87
88
|
readonly Data: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLPreElement>, HTMLPreElement>, "ref">, "asChild"> & {
|
|
88
89
|
asChild?: boolean;
|
|
@@ -101,4 +102,4 @@ declare const Message: {
|
|
|
101
102
|
} & react.RefAttributes<HTMLButtonElement>>;
|
|
102
103
|
};
|
|
103
104
|
|
|
104
|
-
export {
|
|
105
|
+
export { type MessageAttachmentPart, type MessageEntityProps, type MessagePartsFilter, MessagePrimitive, type MessageStreamOptions, type MessageToolPart, type MessageToolRenderWhen };
|
package/dist/message/index.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
2
|
+
MessagePrimitive
|
|
3
|
+
} from "../chunk-CRXNFZRW.js";
|
|
4
|
+
import "../chunk-6XOJFLX4.js";
|
|
5
|
+
import "../chunk-F6AKBUO3.js";
|
|
6
|
+
import "../chunk-MISX4WUT.js";
|
|
7
|
+
import "../chunk-CKA4CE26.js";
|
|
6
8
|
import "../chunk-T3ZFZ3NP.js";
|
|
7
9
|
import {
|
|
8
10
|
useChatContext,
|
|
9
11
|
useMessage,
|
|
10
12
|
useMessagePart
|
|
11
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-SOG2GVE4.js";
|
|
12
14
|
export {
|
|
13
|
-
|
|
15
|
+
MessagePrimitive,
|
|
14
16
|
useChatContext,
|
|
15
17
|
useMessage,
|
|
16
18
|
useMessagePart
|
|
@@ -3,7 +3,7 @@ import { a as SelectionToolbarSelection } from '../selection-toolbar-Cwjbuv5S.js
|
|
|
3
3
|
export { S as SelectionToolbarContextValue, u as useSelectionToolbar } from '../selection-toolbar-Cwjbuv5S.js';
|
|
4
4
|
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
5
5
|
|
|
6
|
-
declare const
|
|
6
|
+
declare const SelectionToolbarPrimitive: {
|
|
7
7
|
readonly Root: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
8
8
|
children?: react.ReactNode;
|
|
9
9
|
container?: Element | DocumentFragment;
|
|
@@ -18,4 +18,4 @@ declare const SelectionToolbar: {
|
|
|
18
18
|
} & react.RefAttributes<HTMLButtonElement>>;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export {
|
|
21
|
+
export { SelectionToolbarPrimitive, SelectionToolbarSelection };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
2
|
+
SelectionToolbarPrimitive
|
|
3
|
+
} from "../chunk-UCBAG42A.js";
|
|
4
|
+
import "../chunk-6XOJFLX4.js";
|
|
4
5
|
import "../chunk-T3ZFZ3NP.js";
|
|
5
6
|
import {
|
|
6
7
|
useSelectionToolbar
|
|
7
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-SOG2GVE4.js";
|
|
8
9
|
export {
|
|
9
|
-
|
|
10
|
+
SelectionToolbarPrimitive,
|
|
10
11
|
useSelectionToolbar
|
|
11
12
|
};
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
export { A as AttachmentContextValue, u as useAttachment } from './attachment-
|
|
2
|
-
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-
|
|
3
|
-
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-
|
|
4
|
-
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-
|
|
5
|
-
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-
|
|
6
|
-
export { I as ImageContextValue, u as useImage } from './image-
|
|
7
|
-
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-
|
|
1
|
+
export { A as AttachmentContextValue, u as useAttachment } from './attachment-mbjsroli.js';
|
|
2
|
+
export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-tfA570mg.js';
|
|
3
|
+
export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-DHlwrhxB.js';
|
|
4
|
+
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-CigccTLT.js';
|
|
5
|
+
export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-D7jgYsfM.js';
|
|
6
|
+
export { I as ImageContextValue, u as useImage } from './image-VZv6Ddsn.js';
|
|
7
|
+
export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-CNRnZQwU.js';
|
|
8
8
|
export { S as SelectionToolbarContextValue, a as SelectionToolbarSelection, u as useSelectionToolbar } from './selection-toolbar-Cwjbuv5S.js';
|
|
9
|
-
export { T as ThreadContextValue, u as useThread } from './thread-
|
|
9
|
+
export { T as ThreadContextValue, u as useThread } from './thread-Bz6-1zaJ.js';
|
|
10
10
|
export { T as ThreadListController, a as ThreadListItemContextValue, b as ThreadListProvider, c as ThreadListProviderProps, d as ThreadListRecord, u as useThreadList, e as useThreadListItem } from './thread-list-On8db4XL.js';
|
|
11
11
|
export { P as PrimitiveProps, a as PrimitiveRef } from './render-CRKWam2v.js';
|
|
12
|
+
import '@anvia/client';
|
|
12
13
|
import '@anvia/react';
|
|
13
14
|
import 'react';
|
package/dist/shared.js
CHANGED
package/dist/stream/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Components, Options } from 'react-markdown';
|
|
|
3
3
|
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
4
4
|
|
|
5
5
|
type StreamMarkdownProps = Omit<PrimitiveProps<"div">, "children"> & {
|
|
6
|
+
"data-state"?: string | undefined;
|
|
6
7
|
components?: Components;
|
|
7
8
|
content: string;
|
|
8
9
|
live?: boolean;
|
|
@@ -10,6 +11,7 @@ type StreamMarkdownProps = Omit<PrimitiveProps<"div">, "children"> & {
|
|
|
10
11
|
remarkRehypeOptions?: Options["remarkRehypeOptions"];
|
|
11
12
|
};
|
|
12
13
|
declare const StreamMarkdown: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
14
|
+
"data-state"?: string | undefined;
|
|
13
15
|
components?: Components;
|
|
14
16
|
content: string;
|
|
15
17
|
live?: boolean;
|
package/dist/stream/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { MutableRefObject } from 'react';
|
|
|
2
2
|
|
|
3
3
|
type ThreadContextValue = {
|
|
4
4
|
viewportRef: MutableRefObject<HTMLElement | null>;
|
|
5
|
+
messagesRef: MutableRefObject<HTMLElement | null>;
|
|
5
6
|
atBottom: boolean;
|
|
6
7
|
setAtBottom(atBottom: boolean): void;
|
|
7
8
|
scrollToBottom(behavior?: ScrollBehavior): void;
|
|
@@ -3,7 +3,7 @@ import { d as ThreadListRecord } from '../thread-list-On8db4XL.js';
|
|
|
3
3
|
export { T as ThreadListController, a as ThreadListItemContextValue, b as ThreadListProvider, c as ThreadListProviderProps, u as useThreadList, e as useThreadListItem } from '../thread-list-On8db4XL.js';
|
|
4
4
|
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
5
5
|
|
|
6
|
-
declare const
|
|
6
|
+
declare const ThreadListPrimitive: {
|
|
7
7
|
readonly Root: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
8
8
|
asChild?: boolean;
|
|
9
9
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
@@ -21,7 +21,7 @@ declare const ThreadList: {
|
|
|
21
21
|
archived?: boolean;
|
|
22
22
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
23
23
|
};
|
|
24
|
-
declare const
|
|
24
|
+
declare const ThreadListItemPrimitive: {
|
|
25
25
|
readonly Root: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
26
26
|
asChild?: boolean;
|
|
27
27
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
@@ -44,4 +44,4 @@ declare const ThreadListItem: {
|
|
|
44
44
|
} & react.RefAttributes<HTMLButtonElement>>;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
export {
|
|
47
|
+
export { ThreadListItemPrimitive, ThreadListPrimitive, ThreadListRecord };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "../chunk-
|
|
2
|
+
ThreadListItemPrimitive,
|
|
3
|
+
ThreadListPrimitive
|
|
4
|
+
} from "../chunk-647LAYRV.js";
|
|
5
5
|
import "../chunk-T3ZFZ3NP.js";
|
|
6
6
|
import {
|
|
7
7
|
ThreadListProvider,
|
|
8
8
|
useThreadList,
|
|
9
9
|
useThreadListItem
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-SOG2GVE4.js";
|
|
11
11
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
ThreadListItemPrimitive,
|
|
13
|
+
ThreadListPrimitive,
|
|
14
14
|
ThreadListProvider,
|
|
15
15
|
useThreadList,
|
|
16
16
|
useThreadListItem
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anvia/react-ui",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.11",
|
|
4
4
|
"description": "Composable React UI primitives for Anvia chat and completion experiences.",
|
|
5
5
|
"author": "anvia",
|
|
6
6
|
"maintainer": "Indra Zulfi",
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"types": "./dist/stream/index.d.ts",
|
|
57
57
|
"import": "./dist/stream/index.js"
|
|
58
58
|
},
|
|
59
|
-
"./stream/styles.css": "./dist/stream/styles.css",
|
|
60
59
|
"./shared": {
|
|
61
60
|
"types": "./dist/shared.d.ts",
|
|
62
61
|
"import": "./dist/shared.js"
|
|
@@ -64,21 +63,20 @@
|
|
|
64
63
|
"./thread-list": {
|
|
65
64
|
"types": "./dist/thread-list/index.d.ts",
|
|
66
65
|
"import": "./dist/thread-list/index.js"
|
|
67
|
-
}
|
|
68
|
-
"./styles.css": "./dist/styles.css"
|
|
66
|
+
}
|
|
69
67
|
},
|
|
70
68
|
"dependencies": {
|
|
71
69
|
"@radix-ui/react-slot": "^1.3.3",
|
|
72
|
-
"@tiptap/core": "^3.
|
|
73
|
-
"@tiptap/extension-document": "^3.
|
|
74
|
-
"@tiptap/extension-hard-break": "^3.
|
|
75
|
-
"@tiptap/extension-mention": "^3.
|
|
76
|
-
"@tiptap/extension-paragraph": "^3.
|
|
77
|
-
"@tiptap/extension-placeholder": "^3.
|
|
78
|
-
"@tiptap/extension-text": "^3.
|
|
79
|
-
"@tiptap/pm": "^3.
|
|
80
|
-
"@tiptap/react": "^3.
|
|
81
|
-
"@tiptap/suggestion": "^3.
|
|
70
|
+
"@tiptap/core": "^3.30.1",
|
|
71
|
+
"@tiptap/extension-document": "^3.30.1",
|
|
72
|
+
"@tiptap/extension-hard-break": "^3.30.1",
|
|
73
|
+
"@tiptap/extension-mention": "^3.30.1",
|
|
74
|
+
"@tiptap/extension-paragraph": "^3.30.1",
|
|
75
|
+
"@tiptap/extension-placeholder": "^3.30.1",
|
|
76
|
+
"@tiptap/extension-text": "^3.30.1",
|
|
77
|
+
"@tiptap/pm": "^3.30.1",
|
|
78
|
+
"@tiptap/react": "^3.30.1",
|
|
79
|
+
"@tiptap/suggestion": "^3.30.1",
|
|
82
80
|
"marked": "^18.0.9",
|
|
83
81
|
"react-markdown": "^10.1.0",
|
|
84
82
|
"remark-gfm": "^4.0.1"
|
|
@@ -86,7 +84,8 @@
|
|
|
86
84
|
"peerDependencies": {
|
|
87
85
|
"react": ">=18",
|
|
88
86
|
"react-dom": ">=18",
|
|
89
|
-
"@anvia/
|
|
87
|
+
"@anvia/client": "1.0.0-rc.11",
|
|
88
|
+
"@anvia/react": "1.0.0-rc.11"
|
|
90
89
|
},
|
|
91
90
|
"devDependencies": {
|
|
92
91
|
"@testing-library/react": "^16.3.2",
|
|
@@ -100,10 +99,11 @@
|
|
|
100
99
|
"tsup": "^8.5.0",
|
|
101
100
|
"typescript": "^5.9.3",
|
|
102
101
|
"vitest": "^4.0.8",
|
|
103
|
-
"@anvia/
|
|
102
|
+
"@anvia/client": "1.0.0-rc.11",
|
|
103
|
+
"@anvia/react": "1.0.0-rc.11"
|
|
104
104
|
},
|
|
105
105
|
"scripts": {
|
|
106
|
-
"build": "tsup src/index.ts src/attachment/index.ts src/chat/index.ts src/completion/index.ts src/human-input/index.ts src/image/index.ts src/message/index.ts src/selection-toolbar/index.ts src/shared.ts src/stream/index.ts src/thread-list/index.ts --format esm --dts --sourcemap --clean --external react --external react-dom
|
|
106
|
+
"build": "tsup src/index.ts src/attachment/index.ts src/chat/index.ts src/completion/index.ts src/human-input/index.ts src/image/index.ts src/message/index.ts src/selection-toolbar/index.ts src/shared.ts src/stream/index.ts src/thread-list/index.ts --format esm --dts --sourcemap --clean --external react --external react-dom",
|
|
107
107
|
"coverage": "vitest run --coverage",
|
|
108
108
|
"test": "vitest run",
|
|
109
109
|
"typecheck": "tsc --noEmit"
|
package/dist/chat-B3kucz1w.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { UseChatResult } from '@anvia/react';
|
|
2
|
-
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
|
|
4
|
-
type ChatController<TEvent = unknown> = UseChatResult<TEvent>;
|
|
5
|
-
type ChatProviderProps<TEvent = unknown> = {
|
|
6
|
-
controller: ChatController<TEvent>;
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
};
|
|
9
|
-
declare function ChatProvider<TEvent = unknown>({ controller, children, }: ChatProviderProps<TEvent>): ReactElement;
|
|
10
|
-
declare function useChatContext<TEvent = unknown>(): ChatController<TEvent>;
|
|
11
|
-
declare function useHumanInput(): ChatController["humanInput"];
|
|
12
|
-
|
|
13
|
-
export { type ChatController as C, ChatProvider as a, type ChatProviderProps as b, useHumanInput as c, useChatContext as u };
|