@anvia/react-ui 0.4.2 → 0.4.3
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 +16 -0
- package/dist/chat/index.js +2 -2
- package/dist/{chunk-RN5CA5A6.js → chunk-7L2C5UUZ.js} +2 -2
- package/dist/{chunk-FZANAMWH.js → chunk-LWH6BMAD.js} +76 -26
- package/dist/chunk-LWH6BMAD.js.map +1 -0
- package/dist/index.js +5 -5
- package/dist/message/index.d.ts +12 -0
- package/dist/message/index.js +1 -1
- package/dist/styles.css +20 -0
- package/package.json +2 -2
- package/dist/chunk-FZANAMWH.js.map +0 -1
- /package/dist/{chunk-RN5CA5A6.js.map → chunk-7L2C5UUZ.js.map} +0 -0
package/README.md
CHANGED
|
@@ -59,3 +59,19 @@ wrappers are useful for layout.
|
|
|
59
59
|
support inline `@`, `/`, `$`, or other entity chips; selected entities are submitted under
|
|
60
60
|
`metadata.composer.entities`. Use `Composer.TextareaInput` when you need the previous native
|
|
61
61
|
textarea behavior.
|
|
62
|
+
|
|
63
|
+
Streaming text animation is opt-in and display-only. Keep `useChat` as the owner of transport and
|
|
64
|
+
`UIMessage[]` state, then enable smoothing on the latest streaming assistant message:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
<Message.Markdown
|
|
68
|
+
animate
|
|
69
|
+
isStreaming={
|
|
70
|
+
chat.status === "streaming" &&
|
|
71
|
+
message.role === "assistant" &&
|
|
72
|
+
chat.messages.at(-1)?.id === message.id
|
|
73
|
+
}
|
|
74
|
+
animationMode="smooth"
|
|
75
|
+
smoothingPreset="balanced"
|
|
76
|
+
/>
|
|
77
|
+
```
|
package/dist/chat/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Message
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LWH6BMAD.js";
|
|
4
4
|
import {
|
|
5
5
|
Attachment
|
|
6
6
|
} from "./chunk-32QFNRXR.js";
|
|
@@ -1546,4 +1546,4 @@ export {
|
|
|
1546
1546
|
Composer,
|
|
1547
1547
|
Thread
|
|
1548
1548
|
};
|
|
1549
|
-
//# sourceMappingURL=chunk-
|
|
1549
|
+
//# sourceMappingURL=chunk-7L2C5UUZ.js.map
|
|
@@ -133,6 +133,9 @@ var MessageRegenerate = forwardRef(
|
|
|
133
133
|
);
|
|
134
134
|
|
|
135
135
|
// src/message/parts.tsx
|
|
136
|
+
import {
|
|
137
|
+
useSmoothStreamText
|
|
138
|
+
} from "@anvia/react";
|
|
136
139
|
import { forwardRef as forwardRef2 } from "react";
|
|
137
140
|
import ReactMarkdown from "react-markdown";
|
|
138
141
|
import remarkGfm from "remark-gfm";
|
|
@@ -164,24 +167,46 @@ var MessagePart = forwardRef2(function MessagePart2({ children, ...props }, ref)
|
|
|
164
167
|
ref
|
|
165
168
|
);
|
|
166
169
|
});
|
|
167
|
-
var MessageText = forwardRef2(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
var MessageText = forwardRef2(function MessageText2(props, ref) {
|
|
171
|
+
const { part } = useMessagePart();
|
|
172
|
+
if (part.type !== "text") {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
return /* @__PURE__ */ jsx2(MessageTextContent, { ...props, content: part.text, ref });
|
|
176
|
+
});
|
|
177
|
+
var MessageTextContent = forwardRef2(
|
|
178
|
+
function MessageTextContent2({
|
|
179
|
+
animate = false,
|
|
180
|
+
animationMode = "smooth",
|
|
181
|
+
isStreaming,
|
|
182
|
+
smoothingPreset,
|
|
183
|
+
reducedMotion,
|
|
184
|
+
content,
|
|
185
|
+
...props
|
|
186
|
+
}, ref) {
|
|
187
|
+
const animationEnabled = animate && props.children === void 0;
|
|
188
|
+
const smooth = useSmoothStreamText(content, {
|
|
189
|
+
enabled: animationEnabled,
|
|
190
|
+
mode: animationMode,
|
|
191
|
+
...isStreaming === void 0 ? {} : { isStreaming },
|
|
192
|
+
...smoothingPreset === void 0 ? {} : { preset: smoothingPreset },
|
|
193
|
+
...reducedMotion === void 0 ? {} : { reducedMotion }
|
|
194
|
+
});
|
|
195
|
+
const animationActive = animationEnabled && animationMode !== "none" && isStreaming !== false && reducedMotion !== true;
|
|
173
196
|
return renderPrimitive(
|
|
174
197
|
"span",
|
|
175
198
|
{
|
|
176
199
|
...props,
|
|
177
|
-
children: props.children ??
|
|
178
|
-
"data-anvia-text": ""
|
|
200
|
+
children: props.children ?? (animationEnabled ? smooth.text : content),
|
|
201
|
+
"data-anvia-text": "",
|
|
202
|
+
"data-anvia-stream-animation": animationEnabled ? animationMode : void 0,
|
|
203
|
+
"data-streaming": animationActive ? "" : void 0
|
|
179
204
|
},
|
|
180
205
|
ref
|
|
181
206
|
);
|
|
182
207
|
}
|
|
183
208
|
);
|
|
184
|
-
var MessageMarkdown = forwardRef2(function MessageMarkdown2({ children,
|
|
209
|
+
var MessageMarkdown = forwardRef2(function MessageMarkdown2({ children, ...props }, ref) {
|
|
185
210
|
const { message } = useMessage();
|
|
186
211
|
const partContext = useOptionalMessagePart();
|
|
187
212
|
const part = partContext?.part;
|
|
@@ -189,23 +214,48 @@ var MessageMarkdown = forwardRef2(function MessageMarkdown2({ children, componen
|
|
|
189
214
|
return null;
|
|
190
215
|
}
|
|
191
216
|
const markdown = children ?? (part?.type === "text" ? part.text : message.parts.flatMap((item) => item.type === "text" ? [item.text] : []).join("\n\n"));
|
|
192
|
-
return
|
|
193
|
-
"div",
|
|
194
|
-
{
|
|
195
|
-
...props,
|
|
196
|
-
children: /* @__PURE__ */ jsx2(
|
|
197
|
-
ReactMarkdown,
|
|
198
|
-
{
|
|
199
|
-
components: { code: defaultCodeComponent, pre: defaultPreComponent, ...components },
|
|
200
|
-
remarkPlugins: remarkPlugins ?? [remarkGfm],
|
|
201
|
-
children: markdown
|
|
202
|
-
}
|
|
203
|
-
),
|
|
204
|
-
"data-anvia-markdown": ""
|
|
205
|
-
},
|
|
206
|
-
ref
|
|
207
|
-
);
|
|
217
|
+
return /* @__PURE__ */ jsx2(MessageMarkdownContent, { ...props, markdown, ref });
|
|
208
218
|
});
|
|
219
|
+
var MessageMarkdownContent = forwardRef2(
|
|
220
|
+
function MessageMarkdownContent2({
|
|
221
|
+
animate = false,
|
|
222
|
+
animationMode = "smooth",
|
|
223
|
+
isStreaming,
|
|
224
|
+
smoothingPreset,
|
|
225
|
+
reducedMotion,
|
|
226
|
+
components,
|
|
227
|
+
remarkPlugins,
|
|
228
|
+
markdown,
|
|
229
|
+
...props
|
|
230
|
+
}, ref) {
|
|
231
|
+
const smooth = useSmoothStreamText(markdown, {
|
|
232
|
+
enabled: animate,
|
|
233
|
+
mode: animationMode,
|
|
234
|
+
...isStreaming === void 0 ? {} : { isStreaming },
|
|
235
|
+
...smoothingPreset === void 0 ? {} : { preset: smoothingPreset },
|
|
236
|
+
...reducedMotion === void 0 ? {} : { reducedMotion }
|
|
237
|
+
});
|
|
238
|
+
const animationActive = animate && animationMode !== "none" && isStreaming !== false && reducedMotion !== true;
|
|
239
|
+
return renderPrimitive(
|
|
240
|
+
"div",
|
|
241
|
+
{
|
|
242
|
+
...props,
|
|
243
|
+
children: /* @__PURE__ */ jsx2(
|
|
244
|
+
ReactMarkdown,
|
|
245
|
+
{
|
|
246
|
+
components: { code: defaultCodeComponent, pre: defaultPreComponent, ...components },
|
|
247
|
+
remarkPlugins: remarkPlugins ?? [remarkGfm],
|
|
248
|
+
children: animate ? smooth.text : markdown
|
|
249
|
+
}
|
|
250
|
+
),
|
|
251
|
+
"data-anvia-markdown": "",
|
|
252
|
+
"data-anvia-stream-animation": animate ? animationMode : void 0,
|
|
253
|
+
"data-streaming": animationActive ? "" : void 0
|
|
254
|
+
},
|
|
255
|
+
ref
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
);
|
|
209
259
|
var MessageCodeBlock = forwardRef2(
|
|
210
260
|
function MessageCodeBlock2({ children, code, language, ...props }, ref) {
|
|
211
261
|
return renderPrimitive(
|
|
@@ -527,4 +577,4 @@ var Message = {
|
|
|
527
577
|
export {
|
|
528
578
|
Message
|
|
529
579
|
};
|
|
530
|
-
//# sourceMappingURL=chunk-
|
|
580
|
+
//# sourceMappingURL=chunk-LWH6BMAD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/message/actions.tsx","../src/format/message.ts","../src/format/value.ts","../src/message/parts.tsx","../src/message/root.tsx","../src/message/index.ts"],"sourcesContent":["import { forwardRef, type MouseEvent, useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { useChatContext, useMessage } from \"../contexts\";\nimport { messageText } from \"../format\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\nconst MessageActions = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function MessageActions(props, ref) {\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: props.children ?? (\n <>\n <MessageCopy />\n <MessageRegenerate />\n </>\n ),\n \"data-anvia-message-actions\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype MessageCopyState = \"idle\" | \"copied\" | \"error\";\n\nconst MessageCopy = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(function MessageCopy(\n { onClick, ...props },\n ref,\n) {\n const { message } = useMessage();\n const [copyState, setCopyState] = useState<MessageCopyState>(\"idle\");\n const text = messageText(message);\n const previousTextRef = useRef(text);\n const disabled = props.disabled ?? text.length === 0;\n\n useEffect(() => {\n if (previousTextRef.current !== text) {\n previousTextRef.current = text;\n setCopyState(\"idle\");\n }\n }, [text]);\n\n const handleClick = useCallback(\n async (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n const writeText = navigator.clipboard?.writeText;\n if (writeText === undefined) {\n setCopyState(\"error\");\n return;\n }\n try {\n await writeText.call(navigator.clipboard, text);\n setCopyState(\"copied\");\n } catch {\n setCopyState(\"error\");\n }\n },\n [disabled, onClick, text],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Copy\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-copy\": \"\",\n \"data-state\": copyState,\n } as PrimitiveProps<\"button\">,\n ref,\n );\n});\n\nconst MessageRegenerate = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function MessageRegenerate({ onClick, ...props }, ref) {\n const chat = useChatContext();\n const { message } = useMessage();\n const latestAssistantMessage = [...chat.messages]\n .reverse()\n .find((item) => item.role === \"assistant\");\n const disabled =\n props.disabled ??\n (chat.status === \"streaming\" ||\n message.role !== \"assistant\" ||\n latestAssistantMessage?.id !== message.id);\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n void chat.regenerate();\n },\n [chat, disabled, onClick],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Regenerate\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-regenerate\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"idle\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nexport { MessageActions, MessageCopy, MessageRegenerate };\n","import type { UIMessage, UIMessagePart } from \"@anvia/react\";\n\nexport function messageText(message: UIMessage): string {\n return message.parts\n .filter((part): part is Extract<UIMessagePart, { type: \"text\" }> => part.type === \"text\")\n .map((part) => part.text)\n .join(\"\");\n}\n","export function stringifyValue(value: unknown): string {\n if (value === undefined) {\n return \"\";\n }\n if (typeof value === \"string\") {\n return value;\n }\n try {\n return JSON.stringify(value, null, 2);\n } catch {\n return String(value);\n }\n}\n","import {\n type StreamAnimationMode,\n type StreamSmoothingPreset,\n type UIAttachment,\n type UIMessagePart,\n useSmoothStreamText,\n} from \"@anvia/react\";\nimport { type ComponentPropsWithoutRef, forwardRef, type ReactNode } from \"react\";\nimport ReactMarkdown, {\n type Components,\n type Options as ReactMarkdownOptions,\n} from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\n\nimport { Attachment } from \"../attachment/index\";\nimport {\n InternalAttachmentProvider,\n InternalMessagePartProvider,\n useMessage,\n useMessagePart,\n useOptionalMessagePart,\n} from \"../contexts\";\nimport { stringifyValue } from \"../format\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\ntype MessagePartChildren = ReactNode | ((part: UIMessagePart) => ReactNode);\nexport type MessagePartsFilter = (part: UIMessagePart) => boolean;\nexport type MessageToolPart = Extract<UIMessagePart, { type: \"tool\" }>;\ntype MessageToolChildren = ReactNode | ((part: MessageToolPart) => ReactNode);\nexport type MessageToolRenderWhen = \"always\" | \"pending\" | \"settled\";\nexport type MessageAttachmentPart = Extract<UIMessagePart, { type: \"attachment\" }>;\ntype MessageAttachmentChildren = ReactNode | ((attachment: UIAttachment) => ReactNode);\n\ntype MessageStreamAnimationProps = {\n animate?: boolean;\n animationMode?: StreamAnimationMode;\n isStreaming?: boolean;\n smoothingPreset?: StreamSmoothingPreset;\n reducedMotion?: boolean;\n};\n\ntype MessagePartsProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: MessagePartChildren;\n filter?: MessagePartsFilter;\n};\n\nconst MessageParts = forwardRef<HTMLDivElement, MessagePartsProps>(function MessageParts(\n { children, filter, ...props },\n ref,\n) {\n const { message } = useMessage();\n const parts = filter === undefined ? message.parts : message.parts.filter(filter);\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: parts.map((part) => (\n <InternalMessagePartProvider key={part.id} part={part}>\n {typeof children === \"function\" ? children(part) : (children ?? <MessagePart />)}\n </InternalMessagePartProvider>\n )),\n \"data-anvia-message-parts\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\ntype MessagePartProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: MessagePartChildren;\n};\n\nconst MessagePart = forwardRef<HTMLDivElement, MessagePartProps>(function MessagePart(\n { children, ...props },\n ref,\n) {\n const { part } = useMessagePart();\n const renderedChildren =\n typeof children === \"function\" ? children(part) : (children ?? defaultPart(part));\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren,\n \"data-anvia-part\": \"\",\n \"data-part\": part.type,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\ntype MessageTextProps = PrimitiveProps<\"span\"> & MessageStreamAnimationProps;\n\nconst MessageText = forwardRef<HTMLSpanElement, MessageTextProps>(function MessageText(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"text\") {\n return null;\n }\n\n return <MessageTextContent {...props} content={part.text} ref={ref} />;\n});\n\ntype MessageTextContentProps = MessageTextProps & {\n content: string;\n};\n\nconst MessageTextContent = forwardRef<HTMLSpanElement, MessageTextContentProps>(\n function MessageTextContent(\n {\n animate = false,\n animationMode = \"smooth\",\n isStreaming,\n smoothingPreset,\n reducedMotion,\n content,\n ...props\n },\n ref,\n ) {\n const animationEnabled = animate && props.children === undefined;\n const smooth = useSmoothStreamText(content, {\n enabled: animationEnabled,\n mode: animationMode,\n ...(isStreaming === undefined ? {} : { isStreaming }),\n ...(smoothingPreset === undefined ? {} : { preset: smoothingPreset }),\n ...(reducedMotion === undefined ? {} : { reducedMotion }),\n });\n const animationActive =\n animationEnabled &&\n animationMode !== \"none\" &&\n isStreaming !== false &&\n reducedMotion !== true;\n\n return renderPrimitive(\n \"span\",\n {\n ...props,\n children: props.children ?? (animationEnabled ? smooth.text : content),\n \"data-anvia-text\": \"\",\n \"data-anvia-stream-animation\": animationEnabled ? animationMode : undefined,\n \"data-streaming\": animationActive ? \"\" : undefined,\n } as PrimitiveProps<\"span\">,\n ref,\n );\n },\n);\n\ntype MessageMarkdownProps = Omit<PrimitiveProps<\"div\">, \"children\"> &\n MessageStreamAnimationProps & {\n children?: string;\n components?: Components;\n remarkPlugins?: ReactMarkdownOptions[\"remarkPlugins\"];\n };\n\nconst MessageMarkdown = forwardRef<HTMLDivElement, MessageMarkdownProps>(function MessageMarkdown(\n { children, ...props },\n ref,\n) {\n const { message } = useMessage();\n const partContext = useOptionalMessagePart();\n const part = partContext?.part;\n if (part !== undefined && part.type !== \"text\") {\n return null;\n }\n\n const markdown =\n children ??\n (part?.type === \"text\"\n ? part.text\n : message.parts.flatMap((item) => (item.type === \"text\" ? [item.text] : [])).join(\"\\n\\n\"));\n\n return <MessageMarkdownContent {...props} markdown={markdown} ref={ref} />;\n});\n\ntype MessageMarkdownContentProps = Omit<MessageMarkdownProps, \"children\"> & {\n markdown: string;\n};\n\nconst MessageMarkdownContent = forwardRef<HTMLDivElement, MessageMarkdownContentProps>(\n function MessageMarkdownContent(\n {\n animate = false,\n animationMode = \"smooth\",\n isStreaming,\n smoothingPreset,\n reducedMotion,\n components,\n remarkPlugins,\n markdown,\n ...props\n },\n ref,\n ) {\n const smooth = useSmoothStreamText(markdown, {\n enabled: animate,\n mode: animationMode,\n ...(isStreaming === undefined ? {} : { isStreaming }),\n ...(smoothingPreset === undefined ? {} : { preset: smoothingPreset }),\n ...(reducedMotion === undefined ? {} : { reducedMotion }),\n });\n const animationActive =\n animate && animationMode !== \"none\" && isStreaming !== false && reducedMotion !== true;\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: (\n <ReactMarkdown\n components={{ code: defaultCodeComponent, pre: defaultPreComponent, ...components }}\n remarkPlugins={remarkPlugins ?? [remarkGfm]}\n >\n {animate ? smooth.text : markdown}\n </ReactMarkdown>\n ),\n \"data-anvia-markdown\": \"\",\n \"data-anvia-stream-animation\": animate ? animationMode : undefined,\n \"data-streaming\": animationActive ? \"\" : undefined,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype MessageCodeBlockProps = Omit<PrimitiveProps<\"pre\">, \"children\"> & {\n children?: ReactNode;\n code?: string;\n language?: string;\n};\n\nconst MessageCodeBlock = forwardRef<HTMLPreElement, MessageCodeBlockProps>(\n function MessageCodeBlock({ children, code, language, ...props }, ref) {\n return renderPrimitive(\n \"pre\",\n {\n ...props,\n children: children ?? (\n <code data-anvia-code=\"\" data-language={language}>\n {code ?? \"\"}\n </code>\n ),\n \"data-anvia-code-block\": \"\",\n \"data-language\": language,\n } as PrimitiveProps<\"pre\">,\n ref,\n );\n },\n);\n\nconst MessageReasoning = forwardRef<HTMLDetailsElement, PrimitiveProps<\"details\">>(\n function MessageReasoning(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"reasoning\") {\n return null;\n }\n\n return renderPrimitive(\n \"details\",\n {\n ...props,\n children: props.children ?? (\n <>\n <summary>Reasoning</summary>\n <pre>{part.text}</pre>\n </>\n ),\n \"data-anvia-reasoning\": \"\",\n } as PrimitiveProps<\"details\">,\n ref,\n );\n },\n);\n\ntype MessageToolProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: MessageToolChildren;\n renderWhen?: MessageToolRenderWhen;\n};\n\nconst MessageTool = forwardRef<HTMLDivElement, MessageToolProps>(function MessageTool(\n { children, renderWhen = \"always\", ...props },\n ref,\n) {\n const { part } = useMessagePart();\n if (part.type !== \"tool\" || !shouldRenderTool(part, renderWhen)) {\n return null;\n }\n const renderedChildren =\n typeof children === \"function\" ? children(part) : (children ?? defaultToolContent());\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren,\n \"data-anvia-tool\": \"\",\n \"data-state\": part.state,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\nconst MessageToolName = forwardRef<HTMLSpanElement, PrimitiveProps<\"span\">>(\n function MessageToolName(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"tool\") {\n return null;\n }\n\n return renderPrimitive(\n \"span\",\n {\n ...props,\n children: props.children ?? part.toolName,\n \"data-anvia-tool-name\": \"\",\n } as PrimitiveProps<\"span\">,\n ref,\n );\n },\n);\n\nconst MessageToolStatus = forwardRef<HTMLSpanElement, PrimitiveProps<\"span\">>(\n function MessageToolStatus(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"tool\") {\n return null;\n }\n\n return renderPrimitive(\n \"span\",\n {\n ...props,\n children: props.children ?? toolStateLabel(part.state),\n \"data-anvia-tool-status\": \"\",\n \"data-state\": part.state,\n } as PrimitiveProps<\"span\">,\n ref,\n );\n },\n);\n\nconst MessageToolInput = forwardRef<HTMLPreElement, PrimitiveProps<\"pre\">>(\n function MessageToolInput(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"tool\" || part.input === undefined) {\n return null;\n }\n\n return renderPrimitive(\n \"pre\",\n {\n ...props,\n children: props.children ?? stringifyValue(part.input),\n \"data-anvia-tool-input\": \"\",\n } as PrimitiveProps<\"pre\">,\n ref,\n );\n },\n);\n\nconst MessageToolOutput = forwardRef<HTMLPreElement, PrimitiveProps<\"pre\">>(\n function MessageToolOutput(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"tool\" || part.output === undefined) {\n return null;\n }\n\n return renderPrimitive(\n \"pre\",\n {\n ...props,\n children: props.children ?? stringifyValue(part.output),\n \"data-anvia-tool-output\": \"\",\n } as PrimitiveProps<\"pre\">,\n ref,\n );\n },\n);\n\nconst MessageToolError = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function MessageToolError(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"tool\" || part.error === undefined) {\n return null;\n }\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: props.children ?? part.error.message,\n \"data-anvia-tool-error\": \"\",\n role: props.role ?? \"alert\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype MessageAttachmentProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: MessageAttachmentChildren;\n};\n\nconst MessageAttachment = forwardRef<HTMLDivElement, MessageAttachmentProps>(\n function MessageAttachment({ children, ...props }, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"attachment\") {\n return null;\n }\n const renderedChildren =\n typeof children === \"function\"\n ? children(part.attachment)\n : (children ?? <Attachment.Root />);\n\n return (\n <InternalAttachmentProvider value={{ attachment: part.attachment }}>\n {renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren,\n \"data-anvia-message-attachment\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n )}\n </InternalAttachmentProvider>\n );\n },\n);\n\nconst MessageData = forwardRef<HTMLPreElement, PrimitiveProps<\"pre\">>(\n function MessageData(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"data\") {\n return null;\n }\n\n return renderPrimitive(\n \"pre\",\n {\n ...props,\n children: props.children ?? stringifyValue(part.data),\n \"data-anvia-data\": \"\",\n \"data-name\": part.name,\n } as PrimitiveProps<\"pre\">,\n ref,\n );\n },\n);\n\nconst MessageError = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function MessageError(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"error\") {\n return null;\n }\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: props.children ?? part.error.message,\n \"data-anvia-error\": \"\",\n role: props.role ?? \"alert\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\nfunction defaultPart(part: UIMessagePart): ReactNode {\n if (part.type === \"text\") {\n return <MessageText />;\n }\n if (part.type === \"reasoning\") {\n return <MessageReasoning />;\n }\n if (part.type === \"tool\") {\n return <MessageTool />;\n }\n if (part.type === \"attachment\") {\n return <MessageAttachment />;\n }\n if (part.type === \"data\") {\n return <MessageData />;\n }\n return <MessageError />;\n}\n\nfunction defaultToolContent(): ReactNode {\n return (\n <>\n <MessageToolName />\n <MessageToolStatus />\n <MessageToolInput />\n <MessageToolOutput />\n <MessageToolError />\n </>\n );\n}\n\nfunction defaultCodeComponent({\n children,\n className,\n node: _node,\n ...props\n}: ComponentPropsWithoutRef<\"code\"> & { node?: unknown }): ReactNode {\n const language = /language-(\\S+)/.exec(className ?? \"\")?.[1];\n\n return (\n <code\n className={className}\n data-anvia-code=\"\"\n data-anvia-inline-code={language === undefined ? \"\" : undefined}\n data-language={language}\n {...props}\n >\n {children}\n </code>\n );\n}\n\nfunction defaultPreComponent({\n children,\n node: _node,\n ...props\n}: ComponentPropsWithoutRef<\"pre\"> & { node?: unknown }): ReactNode {\n return <MessageCodeBlock {...props}>{children}</MessageCodeBlock>;\n}\n\nfunction shouldRenderTool(part: MessageToolPart, renderWhen: MessageToolRenderWhen): boolean {\n if (renderWhen === \"always\") {\n return true;\n }\n if (renderWhen === \"pending\") {\n return part.state === \"input-streaming\" || part.state === \"input-available\";\n }\n return part.state === \"output-available\" || part.state === \"error\";\n}\n\nfunction toolStateLabel(state: MessageToolPart[\"state\"]): string {\n if (state === \"output-available\") {\n return \"Done\";\n }\n if (state === \"error\") {\n return \"Error\";\n }\n return \"Running\";\n}\n\nexport {\n MessageAttachment,\n MessageCodeBlock,\n MessageData,\n MessageError,\n MessageMarkdown,\n MessagePart,\n MessageParts,\n MessageReasoning,\n MessageText,\n MessageTool,\n MessageToolError,\n MessageToolInput,\n MessageToolName,\n MessageToolOutput,\n MessageToolStatus,\n};\n","import type { UIMessage } from \"@anvia/react\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport { useMessage } from \"../contexts\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\ntype MessageChildren = ReactNode | ((message: UIMessage) => ReactNode);\n\ntype MessageRootProps = Omit<PrimitiveProps<\"article\">, \"children\"> & {\n children?: MessageChildren;\n};\n\nconst MessageRoot = forwardRef<HTMLElement, MessageRootProps>(function MessageRoot(\n { children, ...props },\n ref,\n) {\n const { message } = useMessage();\n const renderedChildren = typeof children === \"function\" ? children(message) : children;\n\n return renderPrimitive(\n \"article\",\n {\n ...props,\n children: renderedChildren,\n \"data-anvia-message\": \"\",\n \"data-anvia-message-id\": message.id,\n \"data-role\": message.role,\n } as PrimitiveProps<\"article\">,\n ref,\n );\n});\n\nconst MessageContent = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function MessageContent(props, ref) {\n return renderPrimitive(\n \"div\",\n {\n ...props,\n \"data-anvia-message-content\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\nexport { MessageContent, MessageRoot };\n","import { MessageActions, MessageCopy, MessageRegenerate } from \"./actions\";\nimport {\n MessageAttachment,\n MessageCodeBlock,\n MessageData,\n MessageError,\n MessageMarkdown,\n MessagePart,\n MessageParts,\n MessageReasoning,\n MessageText,\n MessageTool,\n MessageToolError,\n MessageToolInput,\n MessageToolName,\n MessageToolOutput,\n MessageToolStatus,\n} from \"./parts\";\nimport { MessageContent, MessageRoot } from \"./root\";\n\nexport const Message = {\n Root: MessageRoot,\n Content: MessageContent,\n Parts: MessageParts,\n Part: MessagePart,\n Text: MessageText,\n Markdown: MessageMarkdown,\n CodeBlock: MessageCodeBlock,\n Reasoning: MessageReasoning,\n Tool: MessageTool,\n ToolName: MessageToolName,\n ToolInput: MessageToolInput,\n ToolOutput: MessageToolOutput,\n ToolError: MessageToolError,\n ToolStatus: MessageToolStatus,\n Attachment: MessageAttachment,\n Data: MessageData,\n Error: MessageError,\n Actions: MessageActions,\n Copy: MessageCopy,\n Regenerate: MessageRegenerate,\n} as const;\n\nexport type { MessageContextValue, MessagePartContextValue } from \"../contexts\";\nexport { useChatContext, useMessage, useMessagePart } from \"../contexts\";\nexport type {\n MessageAttachmentPart,\n MessagePartsFilter,\n MessageToolPart,\n MessageToolRenderWhen,\n} from \"./parts\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,YAA6B,aAAa,WAAW,QAAQ,gBAAgB;;;ACE/E,SAAS,YAAY,SAA4B;AACtD,SAAO,QAAQ,MACZ,OAAO,CAAC,SAA2D,KAAK,SAAS,MAAM,EACvF,IAAI,CAAC,SAAS,KAAK,IAAI,EACvB,KAAK,EAAE;AACZ;;;ACPO,SAAS,eAAe,OAAwB;AACrD,MAAI,UAAU,QAAW;AACvB,WAAO;AAAA,EACT;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;AAAA,EACT;AACA,MAAI;AACF,WAAO,KAAK,UAAU,OAAO,MAAM,CAAC;AAAA,EACtC,QAAQ;A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WAAW;AAC/B,QAAM,mBAAmB,OAAO,aAAa,aAAa,SAAS,OAAO,IAAI;AAE9E,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,UAAU;AAAA,MACV,sBAAsB;AAAA,MACtB,yBAAyB,QAAQ;AAAA,MACjC,aAAa,QAAQ;AAAA,IACvB;AAAA,IACA;AAAA,EACF;AACF,CAAC;AAED,IAAM,iBAAiBD;AAAA,EACrB,SAASE,gBAAe,OAAO,KAAK;AAClC,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,GAAG;AAAA,QACH,8BAA8B;AAAA,MAChC;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;;;ACvBO,IAAM,UAAU;AAAA,EACrB,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,UAAU;AAAA,EACV,WAAW;AAAA,EACX,WAAW;AAAA,EACX,MAAM;AAAA,EACN,UAAU;AAAA,EACV,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,YAAY;AACd;","names":["MessageActions","MessageCopy","MessageRegenerate","forwardRef","Fragment","jsx","jsxs","forwardRef","MessageParts","MessagePart","MessageText","MessageTextContent","MessageMarkdown","MessageMarkdownContent","MessageCodeBlock","MessageReasoning","MessageTool","MessageToolName","MessageToolStatus","MessageToolInput","MessageToolOutput","MessageToolError","MessageAttachment","MessageData","MessageError","forwardRef","forwardRef","MessageRoot","MessageContent"]}
|
package/dist/index.js
CHANGED
|
@@ -8,19 +8,19 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
Composer,
|
|
10
10
|
Thread
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7L2C5UUZ.js";
|
|
12
12
|
import {
|
|
13
13
|
Completion
|
|
14
14
|
} from "./chunk-TOBAQM2G.js";
|
|
15
|
-
import {
|
|
16
|
-
HumanInput
|
|
17
|
-
} from "./chunk-JUNV3MUR.js";
|
|
18
15
|
import {
|
|
19
16
|
Image
|
|
20
17
|
} from "./chunk-SE7I6ZXJ.js";
|
|
18
|
+
import {
|
|
19
|
+
HumanInput
|
|
20
|
+
} from "./chunk-JUNV3MUR.js";
|
|
21
21
|
import {
|
|
22
22
|
Message
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-LWH6BMAD.js";
|
|
24
24
|
import {
|
|
25
25
|
Attachment
|
|
26
26
|
} from "./chunk-32QFNRXR.js";
|
package/dist/message/index.d.ts
CHANGED
|
@@ -31,8 +31,20 @@ declare const Message: {
|
|
|
31
31
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
32
32
|
readonly Text: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "asChild"> & {
|
|
33
33
|
asChild?: boolean;
|
|
34
|
+
} & {
|
|
35
|
+
animate?: boolean;
|
|
36
|
+
animationMode?: _anvia_react.StreamAnimationMode;
|
|
37
|
+
isStreaming?: boolean;
|
|
38
|
+
smoothingPreset?: _anvia_react.StreamSmoothingPreset;
|
|
39
|
+
reducedMotion?: boolean;
|
|
34
40
|
} & react.RefAttributes<HTMLSpanElement>>;
|
|
35
41
|
readonly Markdown: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
42
|
+
animate?: boolean;
|
|
43
|
+
animationMode?: _anvia_react.StreamAnimationMode;
|
|
44
|
+
isStreaming?: boolean;
|
|
45
|
+
smoothingPreset?: _anvia_react.StreamSmoothingPreset;
|
|
46
|
+
reducedMotion?: boolean;
|
|
47
|
+
} & {
|
|
36
48
|
children?: string;
|
|
37
49
|
components?: react_markdown.Components;
|
|
38
50
|
remarkPlugins?: react_markdown.Options["remarkPlugins"];
|
package/dist/message/index.js
CHANGED
package/dist/styles.css
CHANGED
|
@@ -87,3 +87,23 @@
|
|
|
87
87
|
[data-state="disabled"] {
|
|
88
88
|
opacity: 0.55;
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
@keyframes anvia-stream-fade-in {
|
|
92
|
+
from {
|
|
93
|
+
opacity: 0.35;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
to {
|
|
97
|
+
opacity: 1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
[data-anvia-stream-animation="fadeIn"][data-streaming] {
|
|
102
|
+
animation: anvia-stream-fade-in 180ms ease-out;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@media (prefers-reduced-motion: reduce) {
|
|
106
|
+
[data-anvia-stream-animation="fadeIn"][data-streaming] {
|
|
107
|
+
animation: none;
|
|
108
|
+
}
|
|
109
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anvia/react-ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Composable React UI primitives for Anvia chat and completion experiences.",
|
|
5
5
|
"author": "anvia",
|
|
6
6
|
"maintainer": "Indra Zulfi",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"tsup": "^8.5.0",
|
|
95
95
|
"typescript": "^5.9.3",
|
|
96
96
|
"vitest": "^4.0.8",
|
|
97
|
-
"@anvia/react": "0.8.
|
|
97
|
+
"@anvia/react": "0.8.6"
|
|
98
98
|
},
|
|
99
99
|
"scripts": {
|
|
100
100
|
"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/thread-list/index.ts --format esm --dts --sourcemap --clean --external react --external react-dom && cp src/styles.css dist/styles.css",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/message/actions.tsx","../src/format/message.ts","../src/format/value.ts","../src/message/parts.tsx","../src/message/root.tsx","../src/message/index.ts"],"sourcesContent":["import { forwardRef, type MouseEvent, useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { useChatContext, useMessage } from \"../contexts\";\nimport { messageText } from \"../format\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\nconst MessageActions = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function MessageActions(props, ref) {\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: props.children ?? (\n <>\n <MessageCopy />\n <MessageRegenerate />\n </>\n ),\n \"data-anvia-message-actions\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype MessageCopyState = \"idle\" | \"copied\" | \"error\";\n\nconst MessageCopy = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(function MessageCopy(\n { onClick, ...props },\n ref,\n) {\n const { message } = useMessage();\n const [copyState, setCopyState] = useState<MessageCopyState>(\"idle\");\n const text = messageText(message);\n const previousTextRef = useRef(text);\n const disabled = props.disabled ?? text.length === 0;\n\n useEffect(() => {\n if (previousTextRef.current !== text) {\n previousTextRef.current = text;\n setCopyState(\"idle\");\n }\n }, [text]);\n\n const handleClick = useCallback(\n async (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n const writeText = navigator.clipboard?.writeText;\n if (writeText === undefined) {\n setCopyState(\"error\");\n return;\n }\n try {\n await writeText.call(navigator.clipboard, text);\n setCopyState(\"copied\");\n } catch {\n setCopyState(\"error\");\n }\n },\n [disabled, onClick, text],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Copy\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-copy\": \"\",\n \"data-state\": copyState,\n } as PrimitiveProps<\"button\">,\n ref,\n );\n});\n\nconst MessageRegenerate = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function MessageRegenerate({ onClick, ...props }, ref) {\n const chat = useChatContext();\n const { message } = useMessage();\n const latestAssistantMessage = [...chat.messages]\n .reverse()\n .find((item) => item.role === \"assistant\");\n const disabled =\n props.disabled ??\n (chat.status === \"streaming\" ||\n message.role !== \"assistant\" ||\n latestAssistantMessage?.id !== message.id);\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n void chat.regenerate();\n },\n [chat, disabled, onClick],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Regenerate\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-anvia-regenerate\": \"\",\n \"data-state\": disabled ? \"disabled\" : \"idle\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nexport { MessageActions, MessageCopy, MessageRegenerate };\n","import type { UIMessage, UIMessagePart } from \"@anvia/react\";\n\nexport function messageText(message: UIMessage): string {\n return message.parts\n .filter((part): part is Extract<UIMessagePart, { type: \"text\" }> => part.type === \"text\")\n .map((part) => part.text)\n .join(\"\");\n}\n","export function stringifyValue(value: unknown): string {\n if (value === undefined) {\n return \"\";\n }\n if (typeof value === \"string\") {\n return value;\n }\n try {\n return JSON.stringify(value, null, 2);\n } catch {\n return String(value);\n }\n}\n","import type { UIAttachment, UIMessagePart } from \"@anvia/react\";\nimport { type ComponentPropsWithoutRef, forwardRef, type ReactNode } from \"react\";\nimport ReactMarkdown, {\n type Components,\n type Options as ReactMarkdownOptions,\n} from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\n\nimport { Attachment } from \"../attachment/index\";\nimport {\n InternalAttachmentProvider,\n InternalMessagePartProvider,\n useMessage,\n useMessagePart,\n useOptionalMessagePart,\n} from \"../contexts\";\nimport { stringifyValue } from \"../format\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\ntype MessagePartChildren = ReactNode | ((part: UIMessagePart) => ReactNode);\nexport type MessagePartsFilter = (part: UIMessagePart) => boolean;\nexport type MessageToolPart = Extract<UIMessagePart, { type: \"tool\" }>;\ntype MessageToolChildren = ReactNode | ((part: MessageToolPart) => ReactNode);\nexport type MessageToolRenderWhen = \"always\" | \"pending\" | \"settled\";\nexport type MessageAttachmentPart = Extract<UIMessagePart, { type: \"attachment\" }>;\ntype MessageAttachmentChildren = ReactNode | ((attachment: UIAttachment) => ReactNode);\n\ntype MessagePartsProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: MessagePartChildren;\n filter?: MessagePartsFilter;\n};\n\nconst MessageParts = forwardRef<HTMLDivElement, MessagePartsProps>(function MessageParts(\n { children, filter, ...props },\n ref,\n) {\n const { message } = useMessage();\n const parts = filter === undefined ? message.parts : message.parts.filter(filter);\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: parts.map((part) => (\n <InternalMessagePartProvider key={part.id} part={part}>\n {typeof children === \"function\" ? children(part) : (children ?? <MessagePart />)}\n </InternalMessagePartProvider>\n )),\n \"data-anvia-message-parts\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\ntype MessagePartProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: MessagePartChildren;\n};\n\nconst MessagePart = forwardRef<HTMLDivElement, MessagePartProps>(function MessagePart(\n { children, ...props },\n ref,\n) {\n const { part } = useMessagePart();\n const renderedChildren =\n typeof children === \"function\" ? children(part) : (children ?? defaultPart(part));\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren,\n \"data-anvia-part\": \"\",\n \"data-part\": part.type,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\nconst MessageText = forwardRef<HTMLSpanElement, PrimitiveProps<\"span\">>(\n function MessageText(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"text\") {\n return null;\n }\n\n return renderPrimitive(\n \"span\",\n {\n ...props,\n children: props.children ?? part.text,\n \"data-anvia-text\": \"\",\n } as PrimitiveProps<\"span\">,\n ref,\n );\n },\n);\n\ntype MessageMarkdownProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: string;\n components?: Components;\n remarkPlugins?: ReactMarkdownOptions[\"remarkPlugins\"];\n};\n\nconst MessageMarkdown = forwardRef<HTMLDivElement, MessageMarkdownProps>(function MessageMarkdown(\n { children, components, remarkPlugins, ...props },\n ref,\n) {\n const { message } = useMessage();\n const partContext = useOptionalMessagePart();\n const part = partContext?.part;\n if (part !== undefined && part.type !== \"text\") {\n return null;\n }\n\n const markdown =\n children ??\n (part?.type === \"text\"\n ? part.text\n : message.parts.flatMap((item) => (item.type === \"text\" ? [item.text] : [])).join(\"\\n\\n\"));\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: (\n <ReactMarkdown\n components={{ code: defaultCodeComponent, pre: defaultPreComponent, ...components }}\n remarkPlugins={remarkPlugins ?? [remarkGfm]}\n >\n {markdown}\n </ReactMarkdown>\n ),\n \"data-anvia-markdown\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\ntype MessageCodeBlockProps = Omit<PrimitiveProps<\"pre\">, \"children\"> & {\n children?: ReactNode;\n code?: string;\n language?: string;\n};\n\nconst MessageCodeBlock = forwardRef<HTMLPreElement, MessageCodeBlockProps>(\n function MessageCodeBlock({ children, code, language, ...props }, ref) {\n return renderPrimitive(\n \"pre\",\n {\n ...props,\n children: children ?? (\n <code data-anvia-code=\"\" data-language={language}>\n {code ?? \"\"}\n </code>\n ),\n \"data-anvia-code-block\": \"\",\n \"data-language\": language,\n } as PrimitiveProps<\"pre\">,\n ref,\n );\n },\n);\n\nconst MessageReasoning = forwardRef<HTMLDetailsElement, PrimitiveProps<\"details\">>(\n function MessageReasoning(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"reasoning\") {\n return null;\n }\n\n return renderPrimitive(\n \"details\",\n {\n ...props,\n children: props.children ?? (\n <>\n <summary>Reasoning</summary>\n <pre>{part.text}</pre>\n </>\n ),\n \"data-anvia-reasoning\": \"\",\n } as PrimitiveProps<\"details\">,\n ref,\n );\n },\n);\n\ntype MessageToolProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: MessageToolChildren;\n renderWhen?: MessageToolRenderWhen;\n};\n\nconst MessageTool = forwardRef<HTMLDivElement, MessageToolProps>(function MessageTool(\n { children, renderWhen = \"always\", ...props },\n ref,\n) {\n const { part } = useMessagePart();\n if (part.type !== \"tool\" || !shouldRenderTool(part, renderWhen)) {\n return null;\n }\n const renderedChildren =\n typeof children === \"function\" ? children(part) : (children ?? defaultToolContent());\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren,\n \"data-anvia-tool\": \"\",\n \"data-state\": part.state,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\nconst MessageToolName = forwardRef<HTMLSpanElement, PrimitiveProps<\"span\">>(\n function MessageToolName(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"tool\") {\n return null;\n }\n\n return renderPrimitive(\n \"span\",\n {\n ...props,\n children: props.children ?? part.toolName,\n \"data-anvia-tool-name\": \"\",\n } as PrimitiveProps<\"span\">,\n ref,\n );\n },\n);\n\nconst MessageToolStatus = forwardRef<HTMLSpanElement, PrimitiveProps<\"span\">>(\n function MessageToolStatus(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"tool\") {\n return null;\n }\n\n return renderPrimitive(\n \"span\",\n {\n ...props,\n children: props.children ?? toolStateLabel(part.state),\n \"data-anvia-tool-status\": \"\",\n \"data-state\": part.state,\n } as PrimitiveProps<\"span\">,\n ref,\n );\n },\n);\n\nconst MessageToolInput = forwardRef<HTMLPreElement, PrimitiveProps<\"pre\">>(\n function MessageToolInput(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"tool\" || part.input === undefined) {\n return null;\n }\n\n return renderPrimitive(\n \"pre\",\n {\n ...props,\n children: props.children ?? stringifyValue(part.input),\n \"data-anvia-tool-input\": \"\",\n } as PrimitiveProps<\"pre\">,\n ref,\n );\n },\n);\n\nconst MessageToolOutput = forwardRef<HTMLPreElement, PrimitiveProps<\"pre\">>(\n function MessageToolOutput(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"tool\" || part.output === undefined) {\n return null;\n }\n\n return renderPrimitive(\n \"pre\",\n {\n ...props,\n children: props.children ?? stringifyValue(part.output),\n \"data-anvia-tool-output\": \"\",\n } as PrimitiveProps<\"pre\">,\n ref,\n );\n },\n);\n\nconst MessageToolError = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function MessageToolError(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"tool\" || part.error === undefined) {\n return null;\n }\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: props.children ?? part.error.message,\n \"data-anvia-tool-error\": \"\",\n role: props.role ?? \"alert\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype MessageAttachmentProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: MessageAttachmentChildren;\n};\n\nconst MessageAttachment = forwardRef<HTMLDivElement, MessageAttachmentProps>(\n function MessageAttachment({ children, ...props }, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"attachment\") {\n return null;\n }\n const renderedChildren =\n typeof children === \"function\"\n ? children(part.attachment)\n : (children ?? <Attachment.Root />);\n\n return (\n <InternalAttachmentProvider value={{ attachment: part.attachment }}>\n {renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren,\n \"data-anvia-message-attachment\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n )}\n </InternalAttachmentProvider>\n );\n },\n);\n\nconst MessageData = forwardRef<HTMLPreElement, PrimitiveProps<\"pre\">>(\n function MessageData(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"data\") {\n return null;\n }\n\n return renderPrimitive(\n \"pre\",\n {\n ...props,\n children: props.children ?? stringifyValue(part.data),\n \"data-anvia-data\": \"\",\n \"data-name\": part.name,\n } as PrimitiveProps<\"pre\">,\n ref,\n );\n },\n);\n\nconst MessageError = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function MessageError(props, ref) {\n const { part } = useMessagePart();\n if (part.type !== \"error\") {\n return null;\n }\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: props.children ?? part.error.message,\n \"data-anvia-error\": \"\",\n role: props.role ?? \"alert\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\nfunction defaultPart(part: UIMessagePart): ReactNode {\n if (part.type === \"text\") {\n return <MessageText />;\n }\n if (part.type === \"reasoning\") {\n return <MessageReasoning />;\n }\n if (part.type === \"tool\") {\n return <MessageTool />;\n }\n if (part.type === \"attachment\") {\n return <MessageAttachment />;\n }\n if (part.type === \"data\") {\n return <MessageData />;\n }\n return <MessageError />;\n}\n\nfunction defaultToolContent(): ReactNode {\n return (\n <>\n <MessageToolName />\n <MessageToolStatus />\n <MessageToolInput />\n <MessageToolOutput />\n <MessageToolError />\n </>\n );\n}\n\nfunction defaultCodeComponent({\n children,\n className,\n node: _node,\n ...props\n}: ComponentPropsWithoutRef<\"code\"> & { node?: unknown }): ReactNode {\n const language = /language-(\\S+)/.exec(className ?? \"\")?.[1];\n\n return (\n <code\n className={className}\n data-anvia-code=\"\"\n data-anvia-inline-code={language === undefined ? \"\" : undefined}\n data-language={language}\n {...props}\n >\n {children}\n </code>\n );\n}\n\nfunction defaultPreComponent({\n children,\n node: _node,\n ...props\n}: ComponentPropsWithoutRef<\"pre\"> & { node?: unknown }): ReactNode {\n return <MessageCodeBlock {...props}>{children}</MessageCodeBlock>;\n}\n\nfunction shouldRenderTool(part: MessageToolPart, renderWhen: MessageToolRenderWhen): boolean {\n if (renderWhen === \"always\") {\n return true;\n }\n if (renderWhen === \"pending\") {\n return part.state === \"input-streaming\" || part.state === \"input-available\";\n }\n return part.state === \"output-available\" || part.state === \"error\";\n}\n\nfunction toolStateLabel(state: MessageToolPart[\"state\"]): string {\n if (state === \"output-available\") {\n return \"Done\";\n }\n if (state === \"error\") {\n return \"Error\";\n }\n return \"Running\";\n}\n\nexport {\n MessageAttachment,\n MessageCodeBlock,\n MessageData,\n MessageError,\n MessageMarkdown,\n MessagePart,\n MessageParts,\n MessageReasoning,\n MessageText,\n MessageTool,\n MessageToolError,\n MessageToolInput,\n MessageToolName,\n MessageToolOutput,\n MessageToolStatus,\n};\n","import type { UIMessage } from \"@anvia/react\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nimport { useMessage } from \"../contexts\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\ntype MessageChildren = ReactNode | ((message: UIMessage) => ReactNode);\n\ntype MessageRootProps = Omit<PrimitiveProps<\"article\">, \"children\"> & {\n children?: MessageChildren;\n};\n\nconst MessageRoot = forwardRef<HTMLElement, MessageRootProps>(function MessageRoot(\n { children, ...props },\n ref,\n) {\n const { message } = useMessage();\n const renderedChildren = typeof children === \"function\" ? children(message) : children;\n\n return renderPrimitive(\n \"article\",\n {\n ...props,\n children: renderedChildren,\n \"data-anvia-message\": \"\",\n \"data-anvia-message-id\": message.id,\n \"data-role\": message.role,\n } as PrimitiveProps<\"article\">,\n ref,\n );\n});\n\nconst MessageContent = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function MessageContent(props, ref) {\n return renderPrimitive(\n \"div\",\n {\n ...props,\n \"data-anvia-message-content\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\nexport { MessageContent, MessageRoot };\n","import { MessageActions, MessageCopy, MessageRegenerate } from \"./actions\";\nimport {\n MessageAttachment,\n MessageCodeBlock,\n MessageData,\n MessageError,\n MessageMarkdown,\n MessagePart,\n MessageParts,\n MessageReasoning,\n MessageText,\n MessageTool,\n MessageToolError,\n MessageToolInput,\n MessageToolName,\n MessageToolOutput,\n MessageToolStatus,\n} from \"./parts\";\nimport { MessageContent, MessageRoot } from \"./root\";\n\nexport const Message = {\n Root: MessageRoot,\n Content: MessageContent,\n Parts: MessageParts,\n Part: MessagePart,\n Text: MessageText,\n Markdown: MessageMarkdown,\n CodeBlock: MessageCodeBlock,\n Reasoning: MessageReasoning,\n Tool: MessageTool,\n ToolName: MessageToolName,\n ToolInput: MessageToolInput,\n ToolOutput: MessageToolOutput,\n ToolError: MessageToolError,\n ToolStatus: MessageToolStatus,\n Attachment: MessageAttachment,\n Data: MessageData,\n Error: MessageError,\n Actions: MessageActions,\n Copy: MessageCopy,\n Regenerate: MessageRegenerate,\n} as const;\n\nexport type { MessageContextValue, MessagePartContextValue } from \"../contexts\";\nexport { useChatContext, useMessage, useMessagePart } from \"../contexts\";\nexport type {\n MessageAttachmentPart,\n MessagePartsFilter,\n MessageToolPart,\n MessageToolRenderWhen,\n} from \"./parts\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,YAA6B,aAAa,WAAW,QAAQ,gBAAgB;;;ACE/E,SAAS,YAAY,SAA4B;AACtD,SAAO,QAAQ,MACZ,OAAO,CAAC,SAA2D,KAAK,SAAS,MAAM,EACvF,IAAI,CAAC,SAAS,KAAK,IAAI,EACvB,KAAK,EAAE;AACZ;;;ACPO,SAAS,eAAe,OAAwB;AACrD,MAAI,UAAU,QAAW;AACvB,WAAO;AAAA,EACT;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;AAAA,EACT;AACA,MAAI;AACF,WAAO,KAAK,UAAU,OAAO,MAAM,CAAC;AAAA,EACtC,QAAQ;AACN,WAAO,OAAO,KAAK;AAAA,EACrB;AACF;;;AFCU,mBACE,KADF;AAPV,IAAM,iBAAiB;AAAA,EACrB,SAASA,gBAAe,OAAO,KAAK;AAClC,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,GAAG;AAAA,QACH,UAAU,MAAM,YACd,iCACE;AAAA,8BAAC,eAAY;AAAA,UACb,oBAAC,qBAAkB;AAAA,WACrB;AAAA,QAEF,8BAA8B;AAAA,MAChC;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAIA,IAAM,cAAc,WAAwD,SAASC,aACnF,EAAE,SAAS,GAAG,MAAM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A,EACV,WAAW;AAAA,EACX,WAAW;AAAA,EACX,MAAM;AAAA,EACN,UAAU;AAAA,EACV,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,YAAY;AACd;","names":["MessageActions","MessageCopy","MessageRegenerate","forwardRef","Fragment","jsx","jsxs","forwardRef","MessageParts","MessagePart","MessageText","MessageMarkdown","MessageCodeBlock","MessageReasoning","MessageTool","MessageToolName","MessageToolStatus","MessageToolInput","MessageToolOutput","MessageToolError","MessageAttachment","MessageData","MessageError","forwardRef","forwardRef","MessageRoot","MessageContent"]}
|
|
File without changes
|