@anvia/react-ui 1.0.0-rc.9 → 1.0.1
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 +44 -37
- package/dist/attachment/index.d.ts +2 -2
- package/dist/attachment/index.js +4 -4
- package/dist/chat/index.d.ts +4 -4
- package/dist/chat/index.js +10 -9
- package/dist/{chunk-OINUOCTO.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-JBKSJG5W.js → chunk-CRXNFZRW.js} +45 -80
- package/dist/chunk-CRXNFZRW.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-XAQA3JIG.js → chunk-HWJIMLHC.js} +41 -70
- package/dist/chunk-HWJIMLHC.js.map +1 -0
- package/dist/{chunk-BU4ZPDHQ.js → chunk-MISX4WUT.js} +10 -15
- package/dist/chunk-MISX4WUT.js.map +1 -0
- package/dist/{chunk-PSU4V23X.js → chunk-OQE6SHZE.js} +16 -30
- package/dist/chunk-OQE6SHZE.js.map +1 -0
- package/dist/{chunk-E5UNQCGM.js → chunk-S4XLE2RN.js} +6 -12
- package/dist/chunk-S4XLE2RN.js.map +1 -0
- package/dist/{chunk-F76H3VMN.js → chunk-SOG2GVE4.js} +45 -15
- package/dist/chunk-SOG2GVE4.js.map +1 -0
- package/dist/{chunk-ZPNAX4SA.js → chunk-UCBAG42A.js} +9 -21
- package/dist/chunk-UCBAG42A.js.map +1 -0
- package/dist/{chunk-EWIHRMU6.js → chunk-XC7K4XYM.js} +21 -28
- package/dist/chunk-XC7K4XYM.js.map +1 -0
- package/dist/completion/index.d.ts +2 -2
- package/dist/completion/index.js +4 -4
- package/dist/human-input/index.d.ts +2 -2
- package/dist/human-input/index.js +4 -4
- package/dist/image/index.d.ts +2 -2
- package/dist/image/index.js +4 -4
- package/dist/index.d.ts +11 -11
- package/dist/index.js +58 -63
- package/dist/index.js.map +1 -1
- package/dist/message/index.d.ts +2 -2
- package/dist/message/index.js +7 -6
- package/dist/selection-toolbar/index.d.ts +2 -2
- package/dist/selection-toolbar/index.js +5 -4
- package/dist/shared.d.ts +1 -1
- 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 +18 -20
- package/dist/chunk-BU4ZPDHQ.js.map +0 -1
- package/dist/chunk-E5UNQCGM.js.map +0 -1
- package/dist/chunk-EWIHRMU6.js.map +0 -1
- package/dist/chunk-F76H3VMN.js.map +0 -1
- package/dist/chunk-JBKSJG5W.js.map +0 -1
- package/dist/chunk-OINUOCTO.js.map +0 -1
- package/dist/chunk-PSU4V23X.js.map +0 -1
- package/dist/chunk-ULGJLLZE.js.map +0 -1
- package/dist/chunk-XAQA3JIG.js.map +0 -1
- package/dist/chunk-ZPNAX4SA.js.map +0 -1
- package/dist/stream/styles.css +0 -17
- package/dist/styles.css +0 -130
package/dist/index.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
SelectionToolbarPrimitive
|
|
3
|
+
} from "./chunk-UCBAG42A.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
5
|
+
ThreadListItemPrimitive,
|
|
6
|
+
ThreadListPrimitive
|
|
7
|
+
} from "./chunk-647LAYRV.js";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./chunk-
|
|
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-XC7K4XYM.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
|
StreamMarkdown
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-F6AKBUO3.js";
|
|
27
28
|
import {
|
|
28
|
-
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
AttachmentPrimitive
|
|
30
|
+
} from "./chunk-MISX4WUT.js";
|
|
30
31
|
import "./chunk-CKA4CE26.js";
|
|
31
32
|
import {
|
|
32
33
|
renderPrimitive
|
|
@@ -51,60 +52,54 @@ import {
|
|
|
51
52
|
useThread,
|
|
52
53
|
useThreadList,
|
|
53
54
|
useThreadListItem
|
|
54
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-SOG2GVE4.js";
|
|
55
56
|
|
|
56
57
|
// src/context-meter.tsx
|
|
57
58
|
import { forwardRef } from "react";
|
|
58
59
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
|
|
69
|
-
"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",
|
|
70
74
|
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
"aria-valuemin": 0,
|
|
84
|
-
"aria-valuenow": roundedPercent,
|
|
85
|
-
"data-anvia-context-meter": "",
|
|
86
|
-
"data-display": display,
|
|
87
|
-
role: props.role ?? "progressbar"
|
|
88
|
-
},
|
|
89
|
-
ref
|
|
90
|
-
);
|
|
91
|
-
});
|
|
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
|
+
);
|
|
92
87
|
export {
|
|
93
|
-
|
|
88
|
+
AttachmentPrimitive,
|
|
94
89
|
ChatProvider,
|
|
95
|
-
|
|
90
|
+
CompletionPrimitive,
|
|
96
91
|
CompletionProvider,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
ComposerPrimitive,
|
|
93
|
+
ContextMeterPrimitive,
|
|
94
|
+
HumanInputPrimitive,
|
|
95
|
+
ImagePrimitive,
|
|
96
|
+
MessagePrimitive,
|
|
97
|
+
SelectionToolbarPrimitive,
|
|
103
98
|
StreamMarkdown,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
ThreadListItem,
|
|
99
|
+
ThreadListItemPrimitive,
|
|
100
|
+
ThreadListPrimitive,
|
|
107
101
|
ThreadListProvider,
|
|
102
|
+
ThreadPrimitive,
|
|
108
103
|
useApproval,
|
|
109
104
|
useAttachment,
|
|
110
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
|
@@ -23,7 +23,7 @@ type MessageEntityProps = HTMLAttributes<HTMLSpanElement> & {
|
|
|
23
23
|
entity: ComposerEntity;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
declare const
|
|
26
|
+
declare const MessagePrimitive: {
|
|
27
27
|
readonly Root: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"article">, "children"> & {
|
|
28
28
|
children?: react.ReactNode | ((message: _anvia_client.UIMessage) => react.ReactNode);
|
|
29
29
|
} & react.RefAttributes<HTMLElement>>;
|
|
@@ -102,4 +102,4 @@ declare const Message: {
|
|
|
102
102
|
} & react.RefAttributes<HTMLButtonElement>>;
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
export {
|
|
105
|
+
export { type MessageAttachmentPart, type MessageEntityProps, type MessagePartsFilter, MessagePrimitive, type MessageStreamOptions, type MessageToolPart, type MessageToolRenderWhen };
|
package/dist/message/index.js
CHANGED
|
@@ -1,17 +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";
|
|
6
7
|
import "../chunk-CKA4CE26.js";
|
|
7
8
|
import "../chunk-T3ZFZ3NP.js";
|
|
8
9
|
import {
|
|
9
10
|
useChatContext,
|
|
10
11
|
useMessage,
|
|
11
12
|
useMessagePart
|
|
12
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-SOG2GVE4.js";
|
|
13
14
|
export {
|
|
14
|
-
|
|
15
|
+
MessagePrimitive,
|
|
15
16
|
useChatContext,
|
|
16
17
|
useMessage,
|
|
17
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
|
@@ -6,7 +6,7 @@ export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionProm
|
|
|
6
6
|
export { I as ImageContextValue, u as useImage } from './image-VZv6Ddsn.js';
|
|
7
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
12
|
import '@anvia/client';
|
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.
|
|
3
|
+
"version": "1.0.1",
|
|
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,30 +63,29 @@
|
|
|
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.30.
|
|
73
|
-
"@tiptap/extension-document": "^3.30.
|
|
74
|
-
"@tiptap/extension-hard-break": "^3.30.
|
|
75
|
-
"@tiptap/extension-mention": "^3.30.
|
|
76
|
-
"@tiptap/extension-paragraph": "^3.30.
|
|
77
|
-
"@tiptap/extension-placeholder": "^3.30.
|
|
78
|
-
"@tiptap/extension-text": "^3.30.
|
|
79
|
-
"@tiptap/pm": "^3.30.
|
|
80
|
-
"@tiptap/react": "^3.30.
|
|
81
|
-
"@tiptap/suggestion": "^3.30.
|
|
82
|
-
"marked": "^18.0.
|
|
70
|
+
"@tiptap/core": "^3.30.2",
|
|
71
|
+
"@tiptap/extension-document": "^3.30.2",
|
|
72
|
+
"@tiptap/extension-hard-break": "^3.30.2",
|
|
73
|
+
"@tiptap/extension-mention": "^3.30.2",
|
|
74
|
+
"@tiptap/extension-paragraph": "^3.30.2",
|
|
75
|
+
"@tiptap/extension-placeholder": "^3.30.2",
|
|
76
|
+
"@tiptap/extension-text": "^3.30.2",
|
|
77
|
+
"@tiptap/pm": "^3.30.2",
|
|
78
|
+
"@tiptap/react": "^3.30.2",
|
|
79
|
+
"@tiptap/suggestion": "^3.30.2",
|
|
80
|
+
"marked": "^18.0.10",
|
|
83
81
|
"react-markdown": "^10.1.0",
|
|
84
82
|
"remark-gfm": "^4.0.1"
|
|
85
83
|
},
|
|
86
84
|
"peerDependencies": {
|
|
87
85
|
"react": ">=18",
|
|
88
86
|
"react-dom": ">=18",
|
|
89
|
-
"@anvia/client": "1.0.
|
|
90
|
-
"@anvia/react": "1.0.
|
|
87
|
+
"@anvia/client": "1.0.1",
|
|
88
|
+
"@anvia/react": "1.0.1"
|
|
91
89
|
},
|
|
92
90
|
"devDependencies": {
|
|
93
91
|
"@testing-library/react": "^16.3.2",
|
|
@@ -101,11 +99,11 @@
|
|
|
101
99
|
"tsup": "^8.5.0",
|
|
102
100
|
"typescript": "^5.9.3",
|
|
103
101
|
"vitest": "^4.0.8",
|
|
104
|
-
"@anvia/client": "1.0.
|
|
105
|
-
"@anvia/react": "1.0.
|
|
102
|
+
"@anvia/client": "1.0.1",
|
|
103
|
+
"@anvia/react": "1.0.1"
|
|
106
104
|
},
|
|
107
105
|
"scripts": {
|
|
108
|
-
"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",
|
|
109
107
|
"coverage": "vitest run --coverage",
|
|
110
108
|
"test": "vitest run",
|
|
111
109
|
"typecheck": "tsc --noEmit"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/attachment/parts.tsx","../src/attachment/index.ts"],"sourcesContent":["import type { UIAttachment } from \"@anvia/client\";\nimport { forwardRef, type MouseEvent, type ReactNode, useCallback } from \"react\";\n\nimport { useAttachment } from \"../contexts\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\ntype AttachmentChildren = ReactNode | ((attachment: UIAttachment) => ReactNode);\n\ntype AttachmentRootProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: AttachmentChildren;\n};\n\nconst AttachmentRoot = forwardRef<HTMLDivElement, AttachmentRootProps>(function AttachmentRoot(\n { children, ...props },\n ref,\n) {\n const { attachment, remove } = useAttachment();\n const renderedChildren =\n typeof children === \"function\" ? children(attachment) : (children ?? defaultAttachment(remove));\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren,\n \"data-anvia-attachment\": \"\",\n \"data-type\": attachment.type,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\nconst AttachmentName = forwardRef<HTMLSpanElement, PrimitiveProps<\"span\">>(\n function AttachmentName(props, ref) {\n const { attachment } = useAttachment();\n\n return renderPrimitive(\n \"span\",\n {\n ...props,\n children: props.children ?? attachmentLabel(attachment),\n \"data-anvia-attachment-name\": \"\",\n } as PrimitiveProps<\"span\">,\n ref,\n );\n },\n);\n\nconst AttachmentPreview = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function AttachmentPreview(props, ref) {\n const { attachment } = useAttachment();\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: props.children ?? defaultPreview(attachment),\n \"data-anvia-attachment-preview\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\nconst AttachmentRemove = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function AttachmentRemove({ onClick, ...props }, ref) {\n const { remove } = useAttachment();\n const disabled = props.disabled ?? remove === undefined;\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n remove?.();\n },\n [disabled, onClick, remove],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Remove\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-attachment-remove\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nfunction defaultAttachment(remove: (() => void) | undefined): ReactNode {\n return (\n <>\n <AttachmentPreview />\n <AttachmentName />\n {remove === undefined ? null : <AttachmentRemove />}\n </>\n );\n}\n\nfunction defaultPreview(attachment: UIAttachment): ReactNode {\n if (isImageAttachment(attachment)) {\n const source = attachment.url ?? attachmentDataUrl(attachment);\n if (source !== undefined) {\n return (\n <img alt={attachment.name ?? \"Attachment\"} data-anvia-attachment-image=\"\" src={source} />\n );\n }\n }\n\n if (attachment.url !== undefined) {\n return (\n <a data-anvia-attachment-link=\"\" href={attachment.url}>\n {attachmentLabel(attachment)}\n </a>\n );\n }\n\n return <span data-anvia-attachment-kind=\"\">{attachment.mediaType ?? attachment.type}</span>;\n}\n\nfunction attachmentLabel(attachment: UIAttachment): string {\n return attachment.name ?? attachment.mediaType ?? attachment.type;\n}\n\nfunction isImageAttachment(attachment: UIAttachment): boolean {\n return attachment.type === \"image\" || attachment.mediaType?.startsWith(\"image/\") === true;\n}\n\nfunction attachmentDataUrl(attachment: UIAttachment): string | undefined {\n if (attachment.data === undefined || attachment.mediaType === undefined) {\n return undefined;\n }\n return `data:${attachment.mediaType};base64,${attachment.data}`;\n}\n\nexport { AttachmentName, AttachmentPreview, AttachmentRemove, AttachmentRoot };\n","import { AttachmentName, AttachmentPreview, AttachmentRemove, AttachmentRoot } from \"./parts\";\n\nexport const Attachment = {\n Root: AttachmentRoot,\n Name: AttachmentName,\n Preview: AttachmentPreview,\n Remove: AttachmentRemove,\n} as const;\n\nexport type { AttachmentContextValue } from \"../contexts\";\nexport { useAttachment } from \"../contexts\";\n"],"mappings":";;;;;;;;AACA,SAAS,YAA6C,mBAAmB;AAiGrE,mBACE,KADF;AAtFJ,IAAM,iBAAiB,WAAgD,SAASA,gBAC9E,EAAE,UAAU,GAAG,MAAM,GACrB,KACA;AACA,QAAM,EAAE,YAAY,OAAO,IAAI,cAAc;AAC7C,QAAM,mBACJ,OAAO,aAAa,aAAa,SAAS,UAAU,IAAK,YAAY,kBAAkB,MAAM;AAE/F,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,UAAU;AAAA,MACV,yBAAyB;AAAA,MACzB,aAAa,WAAW;AAAA,IAC1B;AAAA,IACA;AAAA,EACF;AACF,CAAC;AAED,IAAM,iBAAiB;AAAA,EACrB,SAASC,gBAAe,OAAO,KAAK;AAClC,UAAM,EAAE,WAAW,IAAI,cAAc;AAErC,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,GAAG;AAAA,QACH,UAAU,MAAM,YAAY,gB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AAW,QAAQ,cAAc,+BAA4B,IAAG,KAAK,QAAQ;AAAA,IAE3F;AAAA,EACF;AAEA,MAAI,WAAW,QAAQ,QAAW;AAChC,WACE,oBAAC,OAAE,8BAA2B,IAAG,MAAM,WAAW,KAC/C,0BAAgB,UAAU,GAC7B;AAAA,EAEJ;AAEA,SAAO,oBAAC,UAAK,8BAA2B,IAAI,qBAAW,aAAa,WAAW,MAAK;AACtF;AAEA,SAAS,gBAAgB,YAAkC;AACzD,SAAO,WAAW,QAAQ,WAAW,aAAa,WAAW;AAC/D;AAEA,SAAS,kBAAkB,YAAmC;AAC5D,SAAO,WAAW,SAAS,WAAW,WAAW,WAAW,WAAW,QAAQ,MAAM;AACvF;AAEA,SAAS,kBAAkB,YAA8C;AACvE,MAAI,WAAW,SAAS,UAAa,WAAW,cAAc,QAAW;AACvE,WAAO;AAAA,EACT;AACA,SAAO,QAAQ,WAAW,SAAS,WAAW,WAAW,IAAI;AAC/D;;;AC1IO,IAAM,aAAa;AAAA,EACxB,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,EACT,QAAQ;AACV;","names":["AttachmentRoot","AttachmentName","AttachmentPreview","AttachmentRemove"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/completion/form.tsx","../src/completion/root.tsx","../src/completion/index.ts"],"sourcesContent":["import {\n type ChangeEvent,\n type FormEvent,\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n useCallback,\n useMemo,\n} from \"react\";\n\nimport {\n type CompletionInputContextValue,\n InternalCompletionInputProvider,\n useCompletionContext,\n useCompletionInput,\n} from \"../contexts\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\nconst CompletionForm = forwardRef<HTMLFormElement, PrimitiveProps<\"form\">>(function CompletionForm(\n { onSubmit, ...props },\n ref,\n) {\n const completion = useCompletionContext();\n const active = completion.status === \"submitted\" || completion.status === \"streaming\";\n const canSubmit = completion.input.trim().length > 0 && !active;\n const canStop = active;\n\n const submit = useCallback(async () => {\n if (!canSubmit) {\n return;\n }\n await completion.submit();\n }, [canSubmit, completion]);\n\n const value = useMemo<CompletionInputContextValue>(\n () => ({\n input: completion.input,\n setInput: completion.setInput,\n submit,\n stop: completion.stop,\n status: completion.status,\n canSubmit,\n canStop,\n }),\n [\n canStop,\n canSubmit,\n completion.input,\n completion.setInput,\n completion.status,\n completion.stop,\n submit,\n ],\n );\n\n const handleSubmit = useCallback(\n (event: FormEvent<HTMLFormElement>) => {\n (onSubmit as ((event: FormEvent<HTMLFormElement>) => void) | undefined)?.(event);\n if (event.defaultPrevented) {\n return;\n }\n event.preventDefault();\n void submit();\n },\n [onSubmit, submit],\n );\n\n return (\n <InternalCompletionInputProvider value={value}>\n {renderPrimitive(\n \"form\",\n {\n ...props,\n onSubmit: handleSubmit,\n \"data-anvia-completion-form\": \"\",\n \"data-state\": completion.status,\n } as PrimitiveProps<\"form\">,\n ref,\n )}\n </InternalCompletionInputProvider>\n );\n});\n\nconst CompletionInput = forwardRef<HTMLTextAreaElement, PrimitiveProps<\"textarea\">>(\n function CompletionInput({ onChange, onKeyDown, ...props }, ref) {\n const input = useCompletionInput();\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLTextAreaElement>) => {\n onChange?.(event);\n if (!event.defaultPrevented) {\n input.setInput(event.currentTarget.value);\n }\n },\n [input, onChange],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLTextAreaElement>) => {\n onKeyDown?.(event);\n if (\n event.defaultPrevented ||\n event.key !== \"Enter\" ||\n event.shiftKey ||\n event.nativeEvent.isComposing\n ) {\n return;\n }\n event.preventDefault();\n void input.submit();\n },\n [input, onKeyDown],\n );\n\n return renderPrimitive(\n \"textarea\",\n {\n ...props,\n \"aria-label\": props[\"aria-label\"] ?? \"Prompt\",\n disabled: props.disabled ?? (input.status === \"submitted\" || input.status === \"streaming\"),\n onChange: handleChange,\n onKeyDown: handleKeyDown,\n value: input.input,\n \"data-anvia-completion-input\": \"\",\n } as PrimitiveProps<\"textarea\">,\n ref,\n );\n },\n);\n\nconst CompletionSubmit = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function CompletionSubmit(props, ref) {\n const input = useCompletionInput();\n const disabled = props.disabled ?? !input.canSubmit;\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Complete\",\n disabled,\n type: props.type ?? \"submit\",\n \"data-anvia-completion-submit\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nconst CompletionStop = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function CompletionStop({ onClick, ...props }, ref) {\n const input = useCompletionInput();\n const disabled = props.disabled ?? !input.canStop;\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n input.stop();\n },\n [disabled, input, onClick],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Stop\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-completion-stop\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nexport { CompletionForm, CompletionInput, CompletionStop, CompletionSubmit };\n","import { forwardRef, type ReactNode } from \"react\";\n\nimport { useCompletionContext } from \"../contexts\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\ntype CompletionOutputChildren = ReactNode | ((completion: string) => ReactNode);\n\nconst CompletionRoot = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function CompletionRoot(props, ref) {\n const completion = useCompletionContext();\n return renderPrimitive(\n \"div\",\n {\n ...props,\n \"data-anvia-completion\": \"\",\n \"data-state\": completion.status,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype CompletionOutputProps = PrimitiveProps<\"div\"> & {\n children?: CompletionOutputChildren;\n};\n\nconst CompletionOutput = forwardRef<HTMLDivElement, CompletionOutputProps>(\n function CompletionOutput({ children, ...props }, ref) {\n const completion = useCompletionContext();\n const renderedChildren =\n typeof children === \"function\" ? children(completion.completion) : children;\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren ?? completion.completion,\n \"data-anvia-completion-output\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\nexport { CompletionOutput, CompletionRoot };\n","import { CompletionForm, CompletionInput, CompletionStop, CompletionSubmit } from \"./form\";\nimport { CompletionOutput, CompletionRoot } from \"./root\";\n\nexport const Completion = {\n Root: CompletionRoot,\n Output: CompletionOutput,\n Form: CompletionForm,\n Input: CompletionInput,\n Submit: CompletionSubmit,\n Stop: CompletionStop,\n} as const;\n\nexport type {\n CompletionController,\n CompletionInputContextValue,\n CompletionProviderProps,\n} from \"../contexts\";\nexport { CompletionProvider, useCompletionContext, useCompletionInput } from \"../contexts\";\n"],"mappings":";;;;;;;;;;AAAA;AAAA,EAGE;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AA4DH;AAlDJ,IAAM,iBAAiB,WAAoD,SAASA,gBAClF,EAAE,UAAU,GAAG,MAAM,GACrB,KACA;AACA,QAAM,aAAa,qBAAqB;AACxC,QAAM,SAAS,WAAW,WAAW,eAAe,WAAW,WAAW;AAC1E,QAAM,YAAY,WAAW,MAAM,KAAK,EAAE,SAAS,KAAK,CAAC;AACzD,QAAM,UAAU;AAEhB,QAAM,SAAS,YAAY,YAAY;AACrC,QAAI,CAAC,WAAW;AACd;AAAA,IACF;AACA,UAAM,WAAW,OAAO;AAAA,EAC1B,GAAG,CAAC,WAAW,UAAU,CAAC;AAE1B,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,OAAO,WAAW;AAAA,MAClB,UAAU,WAAW;AAAA,MACrB;AAAA,MACA,MAAM,WAAW;AAAA,MACjB,QAAQ,WAAW;AAAA,MACnB;AAAA,MACA;AAAA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AAAA,QACH,yBAAyB;AAAA,QACzB,cAAc,WAAW;AAAA,MAC3B;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAMA,IAAM,mBAAmBD;AAAA,EACvB,SAASE,kBAAiB,EAAE,UAAU,GAAG,MAAM,GAAG,KAAK;AACrD,UAAM,aAAa,qBAAqB;AACxC,UAAM,mBACJ,OAAO,aAAa,aAAa,SAAS,WAAW,UAAU,IAAI;AAErE,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,GAAG;AAAA,QACH,UAAU,oBAAoB,WAAW;AAAA,QACzC,gCAAgC;AAAA,MAClC;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;;;ACvCO,IAAM,aAAa;AAAA,EACxB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACR;","names":["CompletionForm","CompletionInput","CompletionSubmit","CompletionStop","forwardRef","forwardRef","CompletionRoot","CompletionOutput"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/image/parts.tsx","../src/image/index.ts"],"sourcesContent":["import type { UIAttachment } from \"@anvia/client\";\nimport {\n forwardRef,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport {\n type ImageContextValue,\n InternalImageProvider,\n useImage,\n useOptionalAttachment,\n} from \"../contexts\";\nimport { composeRefs, type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\ntype ImageRootChildren = ReactNode | ((image: ImageContextValue) => ReactNode);\ntype ImageRenderWhen = \"image\" | \"always\";\n\ntype ImageRootProps = Omit<PrimitiveProps<\"figure\">, \"children\"> & {\n attachment?: UIAttachment;\n children?: ImageRootChildren;\n renderWhen?: ImageRenderWhen;\n};\n\nconst ImageRoot = forwardRef<HTMLElement, ImageRootProps>(function ImageRoot(\n { attachment: attachmentProp, children, renderWhen = \"image\", ...props },\n ref,\n) {\n const attachmentContext = useOptionalAttachment();\n const attachment = attachmentProp ?? attachmentContext?.attachment;\n const [zoomOpen, setZoomOpen] = useState(false);\n\n if (attachment === undefined) {\n throw new Error(\"Image.Root requires an attachment prop or Attachment context.\");\n }\n\n const src = imageSource(attachment);\n const isImage = isImageAttachment(attachment);\n const value = useMemo<ImageContextValue>(() => {\n const context: ImageContextValue = {\n attachment,\n isImage,\n zoomOpen,\n setZoomOpen,\n };\n if (src !== undefined) context.src = src;\n if (attachment.name !== undefined) context.name = attachment.name;\n if (attachment.mediaType !== undefined) context.mediaType = attachment.mediaType;\n return context;\n }, [attachment, attachment.mediaType, attachment.name, isImage, src, zoomOpen]);\n if (!isImage && renderWhen !== \"always\") {\n return null;\n }\n\n const renderedChildren = typeof children === \"function\" ? children(value) : children;\n\n return (\n <InternalImageProvider value={value}>\n {renderPrimitive(\n \"figure\",\n {\n ...props,\n children: renderedChildren ?? (\n <>\n <ImagePreview />\n <ImageName />\n </>\n ),\n \"data-anvia-image\": \"\",\n \"data-state\": src === undefined ? \"unavailable\" : \"ready\",\n \"data-type\": attachment.type,\n } as PrimitiveProps<\"figure\">,\n ref,\n )}\n </InternalImageProvider>\n );\n});\n\ntype ImagePreviewProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n alt?: string;\n errorFallback?: ReactNode;\n loadingFallback?: ReactNode;\n};\n\nconst ImagePreview = forwardRef<HTMLDivElement, ImagePreviewProps>(function ImagePreview(\n { alt, errorFallback, loadingFallback, ...props },\n ref,\n) {\n const image = useImage();\n const [state, setState] = useState<\"loading\" | \"ready\" | \"error\">(\n image.src === undefined ? \"error\" : \"loading\",\n );\n\n useEffect(() => {\n setState(image.src === undefined ? \"error\" : \"loading\");\n }, [image.src]);\n\n const fallback =\n state === \"loading\"\n ? (loadingFallback ?? \"Loading image\")\n : state === \"error\"\n ? (errorFallback ?? \"Image unavailable\")\n : null;\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children:\n image.src === undefined ? (\n fallback\n ) : (\n <>\n {state === \"ready\" ? null : <span data-anvia-image-fallback=\"\">{fallback}</span>}\n <img\n alt={alt ?? image.name ?? \"Image\"}\n data-anvia-image-img=\"\"\n hidden={state !== \"ready\"}\n onError={() => setState(\"error\")}\n onLoad={() => setState(\"ready\")}\n src={image.src}\n />\n </>\n ),\n \"data-anvia-image-preview\": \"\",\n \"data-state\": state,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\nconst ImageName = forwardRef<HTMLElement, PrimitiveProps<\"figcaption\">>(\n function ImageName(props, ref) {\n const image = useImage();\n\n return renderPrimitive(\n \"figcaption\",\n {\n ...props,\n children: props.children ?? image.name ?? image.mediaType ?? image.attachment.type,\n \"data-anvia-image-name\": \"\",\n } as PrimitiveProps<\"figcaption\">,\n ref,\n );\n },\n);\n\nconst ImageActions = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function ImageActions(props, ref) {\n return renderPrimitive(\n \"div\",\n {\n ...props,\n \"data-anvia-image-actions\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype ImageActionState = \"idle\" | \"done\" | \"error\";\n\nconst ImageCopy = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(function ImageCopy(\n { onClick, ...props },\n ref,\n) {\n const image = useImage();\n const [copyState, setCopyState] = useState<ImageActionState>(\"idle\");\n const disabled = props.disabled ?? image.src === undefined;\n\n const handleClick = useCallback(\n async (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled || image.src === undefined) {\n return;\n }\n try {\n await copyImage(image);\n setCopyState(\"done\");\n } catch {\n setCopyState(\"error\");\n }\n },\n [disabled, image, onClick],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Copy image\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-image-copy\": \"\",\n \"data-state\": copyState,\n } as PrimitiveProps<\"button\">,\n ref,\n );\n});\n\ntype ImageDownloadProps = PrimitiveProps<\"button\"> & {\n filename?: string;\n};\n\nconst ImageDownload = forwardRef<HTMLButtonElement, ImageDownloadProps>(function ImageDownload(\n { filename, onClick, ...props },\n ref,\n) {\n const image = useImage();\n const disabled = props.disabled ?? image.src === undefined;\n\n const handleClick = useCallback(\n async (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled || image.src === undefined) {\n return;\n }\n try {\n await downloadImage(image, filename);\n } catch {\n return;\n }\n },\n [disabled, filename, image, onClick],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Download\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-image-download\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n});\n\nconst ImageZoomTrigger = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function ImageZoomTrigger({ onClick, ...props }, ref) {\n const image = useImage();\n const disabled = props.disabled ?? image.src === undefined;\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n image.setZoomOpen(true);\n },\n [disabled, image, onClick],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Open image\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-image-zoom-trigger\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\ntype ImageZoomOverlayProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n container?: Element | DocumentFragment;\n};\n\nconst ImageZoomOverlay = forwardRef<HTMLDivElement, ImageZoomOverlayProps>(\n function ImageZoomOverlay({ container, onClick, onKeyDown, ...props }, ref) {\n const image = useImage();\n const portalContainer = container ?? globalThis.document?.body;\n const overlayRef = useRef<HTMLDivElement | null>(null);\n const composedRef = useMemo(() => composeRefs(overlayRef, ref), [ref]);\n\n useEffect(() => {\n if (!image.zoomOpen) {\n return;\n }\n const document = globalThis.document;\n if (document === undefined) {\n return;\n }\n const handleKeyDown = (event: globalThis.KeyboardEvent) => {\n if (event.key === \"Escape\") {\n image.setZoomOpen(false);\n }\n };\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [image.setZoomOpen, image.zoomOpen]);\n\n useEffect(() => {\n if (!image.zoomOpen) {\n return;\n }\n const activeElement = globalThis.document?.activeElement;\n const previousFocus = activeElement instanceof HTMLElement ? activeElement : undefined;\n focusOverlay(overlayRef.current);\n return () => {\n if (previousFocus?.isConnected === true) {\n previousFocus.focus();\n }\n };\n }, [image.zoomOpen]);\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n if (!event.defaultPrevented) {\n image.setZoomOpen(false);\n }\n },\n [image, onClick],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) {\n return;\n }\n if (event.key === \"Escape\") {\n image.setZoomOpen(false);\n return;\n }\n if (event.key === \"Tab\") {\n trapOverlayFocus(event, overlayRef.current);\n }\n },\n [image, onKeyDown],\n );\n\n if (!image.zoomOpen || image.src === undefined || portalContainer === undefined) {\n return null;\n }\n\n const overlay = renderPrimitive(\n \"div\",\n {\n ...props,\n children: <img alt={image.name ?? \"Image\"} data-anvia-image-zoom-img=\"\" src={image.src} />,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n \"aria-modal\": props[\"aria-modal\"] ?? true,\n role: props.role ?? \"dialog\",\n tabIndex: props.tabIndex ?? -1,\n \"data-anvia-image-zoom-overlay\": \"\",\n } as PrimitiveProps<\"div\">,\n composedRef,\n );\n\n return createPortal(overlay, portalContainer);\n },\n);\n\nfunction isImageAttachment(attachment: UIAttachment): boolean {\n return attachment.type === \"image\" || attachment.mediaType?.startsWith(\"image/\") === true;\n}\n\nfunction imageSource(attachment: UIAttachment): string | undefined {\n if (!isImageAttachment(attachment)) {\n return attachment.url;\n }\n if (attachment.url !== undefined) {\n return attachment.url;\n }\n if (attachment.data !== undefined && attachment.mediaType !== undefined) {\n return `data:${attachment.mediaType};base64,${attachment.data}`;\n }\n return undefined;\n}\n\nasync function copyImage(image: ImageContextValue): Promise<void> {\n if (image.src === undefined) {\n throw new Error(\"Image source is unavailable.\");\n }\n const clipboard = globalThis.navigator?.clipboard as\n | (Clipboard & { write?: (items: ClipboardItem[]) => Promise<void> })\n | undefined;\n const ClipboardItemConstructor = globalThis.ClipboardItem;\n if (clipboard?.write === undefined || ClipboardItemConstructor === undefined) {\n throw new Error(\"Clipboard image copy is unavailable.\");\n }\n const blob = await imageBlob(image);\n await clipboard.write([new ClipboardItemConstructor({ [blob.type]: blob })]);\n}\n\nasync function imageBlob(image: ImageContextValue): Promise<Blob> {\n if (image.attachment.data !== undefined) {\n return base64ToBlob(\n image.attachment.data,\n image.attachment.mediaType ?? image.mediaType ?? \"image/png\",\n );\n }\n if (image.src === undefined || globalThis.fetch === undefined) {\n throw new Error(\"Image source is unavailable.\");\n }\n const response = await fetch(image.src);\n return response.blob();\n}\n\nfunction base64ToBlob(data: string, mediaType: string): Blob {\n const binary = globalThis.atob(data);\n const bytes = new Uint8Array(binary.length);\n for (let index = 0; index < binary.length; index += 1) {\n bytes[index] = binary.charCodeAt(index);\n }\n return new Blob([bytes], { type: mediaType });\n}\n\nasync function downloadImage(\n image: ImageContextValue,\n filename: string | undefined,\n): Promise<void> {\n const document = globalThis.document;\n const url = globalThis.URL;\n if (image.src === undefined || document === undefined || url?.createObjectURL === undefined) {\n return;\n }\n const blobUrl = url.createObjectURL(await imageBlob(image));\n const link = document.createElement(\"a\");\n try {\n link.href = blobUrl;\n link.download = filename ?? image.name ?? defaultImageFilename(image);\n link.rel = \"noopener\";\n document.body.append(link);\n link.click();\n } finally {\n link.remove();\n url.revokeObjectURL(blobUrl);\n }\n}\n\nfunction defaultImageFilename(image: ImageContextValue): string {\n const extension = image.mediaType?.split(\"/\")[1]?.split(\";\")[0] ?? \"png\";\n return `image.${extension}`;\n}\n\nfunction focusOverlay(overlay: HTMLDivElement | null): void {\n if (overlay === null) {\n return;\n }\n const [firstFocusable] = focusableElements(overlay);\n (firstFocusable ?? overlay).focus();\n}\n\nfunction trapOverlayFocus(\n event: KeyboardEvent<HTMLDivElement>,\n overlay: HTMLDivElement | null,\n): void {\n if (overlay === null) {\n return;\n }\n const focusable = focusableElements(overlay);\n if (focusable.length === 0) {\n event.preventDefault();\n overlay.focus();\n return;\n }\n\n const firstFocusable = focusable[0];\n const lastFocusable = focusable[focusable.length - 1];\n const activeElement = globalThis.document?.activeElement;\n if (event.shiftKey && activeElement === firstFocusable) {\n event.preventDefault();\n lastFocusable?.focus();\n return;\n }\n if (!event.shiftKey && activeElement === lastFocusable) {\n event.preventDefault();\n firstFocusable?.focus();\n return;\n }\n if (activeElement instanceof Node && !overlay.contains(activeElement)) {\n event.preventDefault();\n (event.shiftKey ? lastFocusable : firstFocusable)?.focus();\n }\n}\n\nfunction focusableElements(container: HTMLElement): HTMLElement[] {\n return Array.from(\n container.querySelectorAll<HTMLElement>(\n [\n \"a[href]\",\n \"button:not(:disabled)\",\n \"input:not(:disabled)\",\n \"select:not(:disabled)\",\n \"textarea:not(:disabled)\",\n \"[tabindex]\",\n ].join(\",\"),\n ),\n ).filter((element) => element.tabIndex >= 0 && element.getAttribute(\"aria-hidden\") !== \"true\");\n}\n\nexport {\n ImageActions,\n ImageCopy,\n ImageDownload,\n ImageName,\n ImagePreview,\n ImageRoot,\n ImageZoomOverlay,\n ImageZoomTrigger,\n};\n","import {\n ImageActions,\n ImageCopy,\n ImageDownload,\n ImageName,\n ImagePreview,\n ImageRoot,\n ImageZoomOverlay,\n ImageZoomTrigger,\n} from \"./parts\";\n\nexport const Image = {\n Root: ImageRoot,\n Preview: ImagePreview,\n Name: ImageName,\n Actions: ImageActions,\n Copy: ImageCopy,\n Download: ImageDownload,\n ZoomTrigger: ImageZoomTrigger,\n ZoomOverlay: ImageZoomOverlay,\n} as const;\n\nexport type { ImageContextValue } from \"../contexts\";\nexport { useImage } from \"../contexts\";\n"],"mappings":";;;;;;;;;;;AACA;AAAA,EACE;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AA0DjB,mBACE,KADF;AAvCZ,IAAM,YAAY,WAAwC,SAASA,WACjE,EAAE,YAAY,gBAAgB,UAAU,aAAa,SAAS,GAAG,MAAM,GACvE,KACA;AACA,QAAM,oBAAoB,sBAAsB;AAChD,QAAM,aAAa,kBAAkB,mBAAmB;AACxD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAE9C,MAAI,eAAe,QAAW;AAC5B,UAAM,IAAI,MAAM,+DAA+D;AAAA,EACjF;AAEA,QAAM,MAAM,YAAY,UAAU;AAClC,QAAM,UAAU,kBAAkB,UAAU;AAC5C,QAAM,QAAQ,QAA2B,MAAM;AAC7C,UAAM,UAA6B;AAAA,MACjC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,QAAI,QAAQ,OAAW,SAAQ,MAAM;AACrC,QAAI,WAAW,SAAS,OAAW,SAAQ,OAAO,WAAW;AAC7D,QAAI,WAAW,cAAc,OAAW,SAAQ,YAAY,WAAW;AACvE,WAAO;AAAA,EACT,GAAG,CAAC,YAAY,WAAW,WAAW,WAAW,MAAM,SAAS,KAAK,QAAQ,CAAC;AAC9E,MAAI,CAAC,WAAW,eAAe,UAAU;AACvC,WAAO;AAAA,EACT;AAEA,QAAM,mBAAmB,OAAO,aAAa,aAAa,SAAS,KAAK,IAAI;AAE5E,SACE,oBAAC,yBAAsB,OACpB;AAAA,IACC;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,UAAU,oBACR,i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ImageActions","ImageCopy","ImageDownload","ImageZoomTrigger","ImageZoomOverlay","handleKeyDown"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/attachment.tsx","../src/contexts/chat.tsx","../src/contexts/completion.tsx","../src/contexts/completion-input.tsx","../src/contexts/composer.tsx","../src/contexts/human-input.tsx","../src/contexts/image.tsx","../src/contexts/message.tsx","../src/contexts/selection-toolbar.tsx","../src/contexts/thread.tsx","../src/contexts/thread-list.tsx"],"sourcesContent":["import type { UIAttachment } from \"@anvia/client\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type AttachmentContextValue = {\n attachment: UIAttachment;\n remove?(): void;\n};\n\nconst AttachmentContext = createContext<AttachmentContextValue | undefined>(undefined);\n\nexport function InternalAttachmentProvider({\n value,\n children,\n}: {\n value: AttachmentContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(AttachmentContext.Provider, { value }, children);\n}\n\nexport function useAttachment(): AttachmentContextValue {\n const value = useContext(AttachmentContext);\n if (value === undefined) {\n throw new Error(\"Attachment primitives must be used inside Attachment.Root.\");\n }\n return value;\n}\n\nexport function useOptionalAttachment(): AttachmentContextValue | undefined {\n return useContext(AttachmentContext);\n}\n","import type {\n ClientDataMap,\n ClientMetadata,\n ClientStreamRequest,\n ClientTransport,\n} from \"@anvia/client\";\nimport type {\n AgentToolApprovalRequest,\n AgentToolQuestionRequest,\n} from \"@anvia/core/agent/interactions\";\nimport type { UseChatResult } from \"@anvia/react\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type ChatController<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n> = UseChatResult<ClientTransport<ClientStreamRequest, Data, Metadata>>;\n\nexport type ChatProviderProps<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n> = {\n controller: ChatController<Metadata, Data>;\n children?: ReactNode;\n};\n\nconst ChatContext = createContext<ChatController | undefined>(undefined);\n\nexport function ChatProvider<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n>({ controller, children }: ChatProviderProps<Metadata, Data>): ReactElement {\n return createElement(\n ChatContext.Provider,\n { value: controller as unknown as ChatController },\n children,\n );\n}\n\nexport function useChatContext<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n>(): ChatController<Metadata, Data> {\n const value = useContext(ChatContext);\n if (value === undefined) {\n throw new Error(\"Anvia chat primitives must be used inside ChatProvider.\");\n }\n return value as unknown as ChatController<Metadata, Data>;\n}\n\nexport function useHumanInput() {\n const interactions = useChatContext().interactions;\n const approvals = interactions.all.filter(\n (item): item is typeof item & { request: AgentToolApprovalRequest } =>\n item.request.type === \"tool-approval\",\n );\n const questions = interactions.all.filter(\n (item): item is typeof item & { request: AgentToolQuestionRequest } =>\n item.request.type === \"tool-question\",\n );\n return {\n approvals: {\n all: approvals,\n pending: approvals.filter((item) => item.status === \"pending\"),\n },\n questions: {\n all: questions,\n pending: questions.filter((item) => item.status === \"pending\"),\n },\n };\n}\n","import type { ClientDataMap, ClientMetadata } from \"@anvia/client\";\nimport type { UseCompletionResult } from \"@anvia/react\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type CompletionController<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n> = UseCompletionResult<Metadata, Data>;\n\nexport type CompletionProviderProps<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n> = {\n controller: CompletionController<Metadata, Data>;\n children?: ReactNode;\n};\n\nconst CompletionContext = createContext<CompletionController | undefined>(undefined);\n\nexport function CompletionProvider<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n>({ controller, children }: CompletionProviderProps<Metadata, Data>): ReactElement {\n return createElement(\n CompletionContext.Provider,\n { value: controller as unknown as CompletionController },\n children,\n );\n}\n\nexport function useCompletionContext<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n>(): CompletionController<Metadata, Data> {\n const value = useContext(CompletionContext);\n if (value === undefined) {\n throw new Error(\"Anvia completion primitives must be used inside CompletionProvider.\");\n }\n return value as unknown as CompletionController<Metadata, Data>;\n}\n","import { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nimport type { CompletionController } from \"./completion\";\n\nexport type CompletionInputContextValue = {\n input: string;\n setInput(input: string): void;\n submit(): Promise<void>;\n stop(): void;\n status: CompletionController[\"status\"];\n canSubmit: boolean;\n canStop: boolean;\n};\n\nconst CompletionInputContext = createContext<CompletionInputContextValue | undefined>(undefined);\n\nexport function InternalCompletionInputProvider({\n value,\n children,\n}: {\n value: CompletionInputContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(CompletionInputContext.Provider, { value }, children);\n}\n\nexport function useCompletionInput(): CompletionInputContextValue {\n const value = useContext(CompletionInputContext);\n if (value === undefined) {\n throw new Error(\"Completion input primitives must be used inside Completion.Form.\");\n }\n return value;\n}\n","import type { ClientMetadata, CreateUIAttachment, UIAttachment } from \"@anvia/client\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\nimport type { ChatController } from \"./chat\";\n\nexport type ComposerEntityData =\n | string\n | number\n | boolean\n | null\n | readonly ComposerEntityData[]\n | { [key: string]: ComposerEntityData };\n\nexport type ComposerAttachmentInput = File | CreateUIAttachment;\nexport type ComposerAttachmentsUpdate =\n | UIAttachment[]\n | ((attachments: UIAttachment[]) => UIAttachment[]);\nexport type ComposerEntitiesUpdate =\n | ComposerEntity[]\n | ((entities: ComposerEntity[]) => ComposerEntity[]);\nexport type ComposerQuote = {\n text: string;\n messageId: string;\n};\nexport type ComposerTriggerItem = {\n id: string;\n label: string;\n text?: string | undefined;\n detail?: ReactNode | undefined;\n data?: ComposerEntityData | undefined;\n disabled?: boolean | undefined;\n};\nexport type ComposerTriggerItemsArgs = {\n trigger: ComposerTriggerDefinition;\n query: string;\n input: string;\n entities: ComposerEntity[];\n signal: AbortSignal;\n};\nexport type ComposerTriggerItems =\n | ComposerTriggerItem[]\n | ((args: ComposerTriggerItemsArgs) => ComposerTriggerItem[] | Promise<ComposerTriggerItem[]>);\nexport type ComposerTriggerDefinition = {\n id: string;\n char: string;\n items: ComposerTriggerItems;\n minQueryLength?: number | undefined;\n allowedPrefixes?: string[] | null | undefined;\n startOfLine?: boolean | undefined;\n allowSpaces?: boolean | undefined;\n};\nexport type ComposerEntity = {\n id: string;\n triggerId: string;\n trigger: string;\n label: string;\n text: string;\n range: {\n from: number;\n to: number;\n };\n data?: ComposerEntityData | undefined;\n};\ntype ComposerMessageEntity = ClientMetadata & {\n id: string;\n triggerId: string;\n trigger: string;\n label: string;\n text: string;\n range: ClientMetadata & {\n from: number;\n to: number;\n };\n data?: ComposerEntityData | undefined;\n};\nexport type ComposerMessageMetadata = ClientMetadata & {\n composer: ClientMetadata & {\n entities: readonly ComposerMessageEntity[];\n };\n};\nexport type ComposerTriggerState = {\n trigger: ComposerTriggerDefinition;\n query: string;\n items: ComposerTriggerItem[];\n loading: boolean;\n selectedIndex: number;\n rect?: {\n top: number;\n right: number;\n bottom: number;\n left: number;\n width: number;\n height: number;\n };\n selectItem(item: ComposerTriggerItem): void;\n setSelectedIndex(index: number): void;\n};\nexport type ComposerTriggerStateUpdate =\n | ComposerTriggerState\n | undefined\n | ((state: ComposerTriggerState | undefined) => ComposerTriggerState | undefined);\n\nexport type ComposerContextValue = {\n input: string;\n setInput(input: string): void;\n attachments: UIAttachment[];\n setAttachments(update: ComposerAttachmentsUpdate): void;\n addAttachment(attachment: ComposerAttachmentInput): Promise<void>;\n removeAttachment(id: string): void;\n clearAttachments(): void;\n entities: ComposerEntity[];\n setEntities(update: ComposerEntitiesUpdate): void;\n quote?: ComposerQuote | undefined;\n setQuote(quote: ComposerQuote | undefined): void;\n clearQuote(): void;\n triggers: ComposerTriggerDefinition[];\n activeTrigger?: ComposerTriggerState | undefined;\n setActiveTrigger(update: ComposerTriggerStateUpdate): void;\n submit(): Promise<void>;\n stop(): void;\n status: ChatController[\"status\"];\n canSubmit: boolean;\n canStop: boolean;\n};\n\nconst ComposerContext = createContext<ComposerContextValue | undefined>(undefined);\n\nexport function InternalComposerProvider({\n value,\n children,\n}: {\n value: ComposerContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ComposerContext.Provider, { value }, children);\n}\n\nexport function useComposer(): ComposerContextValue {\n const value = useContext(ComposerContext);\n if (value === undefined) {\n throw new Error(\"Composer primitives must be used inside Composer.Root.\");\n }\n return value;\n}\n","import type { ClientInteraction } from \"@anvia/client\";\nimport type {\n AgentQuestionAnswer,\n AgentQuestionPrompt,\n AgentToolApprovalRequest,\n AgentToolQuestionRequest,\n} from \"@anvia/core/agent/interactions\";\nimport {\n createContext,\n createElement,\n type ReactElement,\n type ReactNode,\n useContext,\n useMemo,\n useState,\n} from \"react\";\n\nexport type ApprovalContextValue = {\n approval: ApprovalInteraction;\n reason: string;\n setReason(reason: string): void;\n};\n\nexport type QuestionContextValue = {\n question: QuestionInteraction;\n answers: Record<string, AgentQuestionAnswer>;\n setAnswer(prompt: AgentQuestionPrompt, answer: AgentQuestionAnswer): void;\n};\n\nexport type QuestionPromptContextValue = {\n prompt: AgentQuestionPrompt;\n};\n\nexport type ApprovalInteraction = ClientInteraction & { request: AgentToolApprovalRequest };\nexport type QuestionInteraction = ClientInteraction & { request: AgentToolQuestionRequest };\n\nconst ApprovalContext = createContext<ApprovalContextValue | undefined>(undefined);\nconst QuestionContext = createContext<QuestionContextValue | undefined>(undefined);\nconst QuestionPromptContext = createContext<QuestionPromptContextValue | undefined>(undefined);\n\nexport function InternalApprovalProvider({\n approval,\n children,\n}: {\n approval: ApprovalInteraction;\n children?: ReactNode;\n}): ReactElement {\n const [reason, setReason] = useState(\"\");\n const value = useMemo<ApprovalContextValue>(\n () => ({ approval, reason, setReason }),\n [approval, reason],\n );\n\n return createElement(ApprovalContext.Provider, { value }, children);\n}\n\nexport function InternalQuestionProvider({\n value,\n children,\n}: {\n value: QuestionContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(QuestionContext.Provider, { value }, children);\n}\n\nexport function InternalQuestionPromptProvider({\n prompt,\n children,\n}: {\n prompt: AgentQuestionPrompt;\n children?: ReactNode;\n}): ReactElement {\n return createElement(QuestionPromptContext.Provider, { value: { prompt } }, children);\n}\n\nexport function useApproval(): ApprovalContextValue {\n const value = useContext(ApprovalContext);\n if (value === undefined) {\n throw new Error(\"Approval primitives must be used inside HumanInput.Approval.\");\n }\n return value;\n}\n\nexport function useQuestion(): QuestionContextValue {\n const value = useContext(QuestionContext);\n if (value === undefined) {\n throw new Error(\"Question primitives must be used inside HumanInput.Question.\");\n }\n return value;\n}\n\nexport function useQuestionPrompt(): QuestionPromptContextValue {\n const value = useContext(QuestionPromptContext);\n if (value === undefined) {\n throw new Error(\"Question choice primitives must be used inside HumanInput.QuestionPrompt.\");\n }\n return value;\n}\n","import type { UIAttachment } from \"@anvia/client\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type ImageContextValue = {\n attachment: UIAttachment;\n src?: string;\n name?: string;\n mediaType?: string;\n isImage: boolean;\n zoomOpen: boolean;\n setZoomOpen(open: boolean): void;\n};\n\nconst ImageContext = createContext<ImageContextValue | undefined>(undefined);\n\nexport function InternalImageProvider({\n value,\n children,\n}: {\n value: ImageContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ImageContext.Provider, { value }, children);\n}\n\nexport function useImage(): ImageContextValue {\n const value = useContext(ImageContext);\n if (value === undefined) {\n throw new Error(\"Image primitives must be used inside Image.Root.\");\n }\n return value;\n}\n","import type { UIMessage, UIMessagePart } from \"@anvia/client\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type MessageContextValue = {\n message: UIMessage;\n};\n\nexport type MessagePartContextValue = {\n isLive: boolean;\n part: UIMessagePart;\n streamControlled: boolean;\n};\n\nconst MessageContext = createContext<MessageContextValue | undefined>(undefined);\nconst MessagePartContext = createContext<MessagePartContextValue | undefined>(undefined);\n\nexport function InternalMessageProvider({\n message,\n children,\n}: {\n message: UIMessage;\n children?: ReactNode;\n}): ReactElement {\n return createElement(MessageContext.Provider, { value: { message } }, children);\n}\n\nexport function InternalMessagePartProvider({\n part,\n isLive = false,\n streamControlled = false,\n children,\n}: {\n part: UIMessagePart;\n isLive?: boolean;\n streamControlled?: boolean;\n children?: ReactNode;\n}): ReactElement {\n return createElement(\n MessagePartContext.Provider,\n { value: { isLive, part, streamControlled } },\n children,\n );\n}\n\nexport function useMessage(): MessageContextValue {\n const value = useContext(MessageContext);\n if (value === undefined) {\n throw new Error(\"Message primitives must be used inside Message.Root or Thread.Messages.\");\n }\n return value;\n}\n\nexport function useMessagePart(): MessagePartContextValue {\n const value = useContext(MessagePartContext);\n if (value === undefined) {\n throw new Error(\"Message part primitives must be used inside Message.Parts or Message.Part.\");\n }\n return value;\n}\n\nexport function useOptionalMessagePart(): MessagePartContextValue | undefined {\n return useContext(MessagePartContext);\n}\n","import { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type SelectionToolbarSelection = {\n text: string;\n messageId: string;\n rect: DOMRect;\n};\n\nexport type SelectionToolbarContextValue = {\n selection?: SelectionToolbarSelection;\n quote(): void;\n copy(): Promise<void>;\n clear(): void;\n};\n\nconst SelectionToolbarContext = createContext<SelectionToolbarContextValue | undefined>(undefined);\n\nexport function InternalSelectionToolbarProvider({\n value,\n children,\n}: {\n value: SelectionToolbarContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(SelectionToolbarContext.Provider, { value }, children);\n}\n\nexport function useSelectionToolbar(): SelectionToolbarContextValue {\n const value = useContext(SelectionToolbarContext);\n if (value === undefined) {\n throw new Error(\"SelectionToolbar primitives must be used inside SelectionToolbar.Root.\");\n }\n return value;\n}\n","import {\n createContext,\n createElement,\n type MutableRefObject,\n type ReactElement,\n type ReactNode,\n useContext,\n} from \"react\";\n\nexport type ThreadContextValue = {\n viewportRef: MutableRefObject<HTMLElement | null>;\n atBottom: boolean;\n setAtBottom(atBottom: boolean): void;\n scrollToBottom(behavior?: ScrollBehavior): void;\n};\n\nconst ThreadContext = createContext<ThreadContextValue | undefined>(undefined);\n\nexport function InternalThreadProvider({\n value,\n children,\n}: {\n value: ThreadContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ThreadContext.Provider, { value }, children);\n}\n\nexport function useThread(): ThreadContextValue {\n const value = useContext(ThreadContext);\n if (value === undefined) {\n throw new Error(\"Thread primitives must be used inside Thread.Root.\");\n }\n return value;\n}\n","import { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type ThreadListRecord = {\n id: string;\n title?: string;\n createdAt?: string | Date;\n updatedAt?: string | Date;\n archived?: boolean;\n metadata?: unknown;\n};\n\nexport type ThreadListController = {\n threads: ThreadListRecord[];\n activeThreadId?: string;\n status?: \"idle\" | \"loading\" | \"error\";\n error?: unknown;\n createThread(): Promise<void> | void;\n switchThread(threadId: string): Promise<void> | void;\n archiveThread?(threadId: string): Promise<void> | void;\n unarchiveThread?(threadId: string): Promise<void> | void;\n deleteThread?(threadId: string): Promise<void> | void;\n};\n\nexport type ThreadListItemContextValue = {\n thread: ThreadListRecord;\n active: boolean;\n};\n\nexport type ThreadListProviderProps = {\n controller: ThreadListController;\n children?: ReactNode;\n};\n\nconst ThreadListContext = createContext<ThreadListController | undefined>(undefined);\nconst ThreadListItemContext = createContext<ThreadListItemContextValue | undefined>(undefined);\n\nexport function ThreadListProvider({\n controller,\n children,\n}: ThreadListProviderProps): ReactElement {\n return createElement(ThreadListContext.Provider, { value: controller }, children);\n}\n\nexport function InternalThreadListItemProvider({\n value,\n children,\n}: {\n value: ThreadListItemContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ThreadListItemContext.Provider, { value }, children);\n}\n\nexport function useThreadList(): ThreadListController {\n const value = useContext(ThreadListContext);\n if (value === undefined) {\n throw new Error(\"ThreadList primitives must be used inside ThreadListProvider.\");\n }\n return value;\n}\n\nexport function useThreadListItem(): ThreadListItemContextValue {\n const value = useContext(ThreadListItemContext);\n if (value === undefined) {\n throw new Error(\"ThreadListItem primitives must be used inside ThreadList.Items.\");\n }\n return value;\n}\n"],"mappings":";AACA,SAAS,eAAe,eAAkD,kBAAkB;AAO5F,IAAM,oBAAoB,cAAkD,MAAS;AAE9E,SAAS,2BAA2B;AAAA,EACzC;AAAA,EACA;AACF,GAGiB;AACf,SAAO,cAAc,kBAAkB,UAAU,EAAE,MAAM,GAAG,QAAQ;AACtE;AAEO,SAAS,gBAAwC;AACtD,QAAM,QAAQ,WAAW,iBAAiB;AAC1C,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,4DAA4D;AAAA,EAC9E;AACA,SAAO;AACT;AAEO,SAAS,wBAA4D;AAC1E,SAAO,WAAW,iBAAiB;AACrC;;;ACnBA,SAAS,iBAAAA,gBAAe,iBAAAC,gBAAkD,cAAAC,mBAAkB;AAe5F,IAAM,cAAcF,eAA0C,MAAS;AAEhE,SAAS,aAGd,EAAE,YAAY,SAAS,GAAoD;AAC3E,SAAOC;AAAA,IACL,YAAY;AAAA,IACZ,EAAE,OAAO,WAAwC;AAAA,IACjD;AAAA,EACF;AACF;AAEO,SAAS,iBAGoB;AAClC,QAAM,QAAQC,YAAW,WAAW;AACpC,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AACA,SAAO;AACT;AAEO,SAAS,gBAAgB;AAC9B,QAAM,eAAe,eAAe,EAAE;AACtC,QAAM,YAAY,aAAa,IAAI;AAAA,IACjC,CAAC,SACC,KAAK,QAAQ,SAAS;AAAA,EAC1B;AACA,QAAM,YAAY,aAAa,IAAI;AAAA,IACjC,CAAC,SACC,KAAK,QAAQ,SAAS;AAAA,EAC1B;AACA,SAAO;AAAA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AAQA,aAAW,qBAAqB;AAC9C,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,iEAAiE;AAAA,EACnF;AACA,SAAO;AACT;","names":["createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext"]}
|