@flowtomic/ui 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Componente de mensagem com branches e attachments
|
|
5
5
|
*/
|
|
6
6
|
import type { FileUIPart, UIMessage } from "ai";
|
|
7
|
-
import hardenReactMarkdown from "harden-react-markdown";
|
|
8
7
|
import type { ComponentProps, HTMLAttributes } from "react";
|
|
9
8
|
import * as React from "react";
|
|
10
9
|
import { type Options } from "react-markdown";
|
|
@@ -50,17 +49,17 @@ export declare const MessageBranchPage: React.ForwardRefExoticComponent<MessageB
|
|
|
50
49
|
export type MessageResponseProps = HTMLAttributes<HTMLDivElement> & {
|
|
51
50
|
options?: Options;
|
|
52
51
|
children: Options["children"];
|
|
53
|
-
allowedImagePrefixes?:
|
|
54
|
-
allowedLinkPrefixes?:
|
|
55
|
-
defaultOrigin?:
|
|
52
|
+
allowedImagePrefixes?: string[];
|
|
53
|
+
allowedLinkPrefixes?: string[];
|
|
54
|
+
defaultOrigin?: string;
|
|
56
55
|
parseIncompleteMarkdown?: boolean;
|
|
57
56
|
};
|
|
58
57
|
export declare const MessageResponse: React.NamedExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
59
58
|
options?: Options;
|
|
60
59
|
children: Options["children"];
|
|
61
|
-
allowedImagePrefixes?:
|
|
62
|
-
allowedLinkPrefixes?:
|
|
63
|
-
defaultOrigin?:
|
|
60
|
+
allowedImagePrefixes?: string[];
|
|
61
|
+
allowedLinkPrefixes?: string[];
|
|
62
|
+
defaultOrigin?: string;
|
|
64
63
|
parseIncompleteMarkdown?: boolean;
|
|
65
64
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
66
65
|
export type MessageAttachmentProps = HTMLAttributes<HTMLDivElement> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/data-display/message/message.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/data-display/message/message.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAGhD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAgB,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAsB,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAK7D,OAAO,EACL,MAAM,EAKP,MAAM,oBAAoB,CAAC;AAI5B,OAAO,0BAA0B,CAAC;AAWlC,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC1D,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,OAAO;UAHZ,SAAS,CAAC,MAAM,CAAC;wCAexB,CAAC;AAGF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEjE,eAAO,MAAM,cAAc,4FAe1B,CAAC;AAGF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAExD,eAAO,MAAM,cAAc,6JAM1B,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,aAAa,2GAwBzB,CAAC;AAwBF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,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M;8BACI,OAAO;wCAiDlC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACpE,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,iBAAiB;UALtB,UAAU;gBACJ,MAAM;eACP,MAAM,IAAI;wCA2EtB,CAAC;AAGF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE5D,eAAO,MAAM,kBAAkB,6JAgB9B,CAAC;AAGF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAExD,eAAO,MAAM,cAAc,6JAU1B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import * as _hardenReactMarkdown from "harden-react-markdown";
|
|
3
3
|
import { ChevronLeftIcon, ChevronRightIcon, PaperclipIcon, XIcon } from "lucide-react";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { createContext, isValidElement, memo, useContext, useEffect, useState } from "react";
|
|
@@ -12,6 +12,12 @@ import { CodeBlock, CodeBlockCopyButton } from "@/components/atoms/code/code-blo
|
|
|
12
12
|
import { ButtonGroup, ButtonGroupText } from "@/components/molecules/forms/button-group";
|
|
13
13
|
import { cn } from "@/lib/utils";
|
|
14
14
|
import "katex/dist/katex.min.css";
|
|
15
|
+
// Mantenha interop para diferentes ambientes (bundlers/runtimes)
|
|
16
|
+
const hardenReactMarkdown = (typeof _hardenReactMarkdown === "function"
|
|
17
|
+
? _hardenReactMarkdown
|
|
18
|
+
: typeof _hardenReactMarkdown.default === "function"
|
|
19
|
+
? _hardenReactMarkdown.default
|
|
20
|
+
: _hardenReactMarkdown);
|
|
15
21
|
export const Message = React.forwardRef(({ className, from, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("group flex w-full max-w-[80%] gap-2", from === "user" ? "is-user ml-auto justify-end" : "is-assistant", className), ...props })));
|
|
16
22
|
Message.displayName = "Message";
|
|
17
23
|
export const MessageContent = React.forwardRef(({ children, className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("is-user:dark flex w-fit flex-col gap-2 overflow-hidden text-sm", "group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground", "group-[.is-assistant]:text-foreground", className), ...props, children: children })));
|
|
@@ -289,7 +295,7 @@ export const MessageAttachment = React.forwardRef(({ data, className, onRemove,
|
|
|
289
295
|
return (_jsx("div", { ref: ref, className: cn("group relative size-24 overflow-hidden rounded-lg", className), ...props, children: isImage ? (_jsxs(_Fragment, { children: [_jsx("img", { alt: filename || "attachment", className: "size-full object-cover", height: 100, src: data.url, width: 100 }), onRemove && (_jsxs(Button, { "aria-label": "Remove attachment", className: "absolute top-2 right-2 size-6 rounded-full bg-background/80 p-0 opacity-0 backdrop-blur-sm transition-opacity hover:bg-background group-hover:opacity-100 [&>svg]:size-3", onClick: (e) => {
|
|
290
296
|
e.stopPropagation();
|
|
291
297
|
onRemove();
|
|
292
|
-
}, type: "button", variant: "ghost", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Remove" })] }))] })) : (_jsxs(_Fragment, { children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("div", { className: "flex size-full shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground", children: _jsx(PaperclipIcon, { className: "size-4" }) }) }), _jsx(TooltipContent, { children: _jsx("p", { children: attachmentLabel }) })] }), onRemove && (_jsxs(Button, { "aria-label": "Remove attachment", className: "size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 [&>svg]:size-3", onClick: (e) => {
|
|
298
|
+
}, type: "button", variant: "ghost", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Remove" })] }))] })) : (_jsxs(_Fragment, { children: [_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("div", { className: "flex size-full shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground", children: _jsx(PaperclipIcon, { className: "size-4" }) }) }), _jsx(TooltipContent, { children: _jsx("p", { children: attachmentLabel }) })] }) }), onRemove && (_jsxs(Button, { "aria-label": "Remove attachment", className: "size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 [&>svg]:size-3", onClick: (e) => {
|
|
293
299
|
e.stopPropagation();
|
|
294
300
|
onRemove();
|
|
295
301
|
}, type: "button", variant: "ghost", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Remove" })] }))] })) }));
|