@anvia/react-ui 1.2.2 → 1.3.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/dist/attachment/index.d.ts +3 -21
- package/dist/attachment/index.js +3 -12
- package/dist/attachment-DsKTPumt.js +89 -0
- package/dist/attachment-DsKTPumt.js.map +1 -0
- package/dist/chat/index.d.ts +3 -144
- package/dist/chat/index.js +3 -25
- package/dist/chat-CAnvUEAv.js +1210 -0
- package/dist/chat-CAnvUEAv.js.map +1 -0
- package/dist/completion/index.d.ts +3 -29
- package/dist/completion/index.js +3 -16
- package/dist/completion-DDTKoZRJ.js +124 -0
- package/dist/completion-DDTKoZRJ.js.map +1 -0
- package/dist/connection-DeNq8wHS.js +203 -0
- package/dist/connection-DeNq8wHS.js.map +1 -0
- package/dist/contexts-B4ijG24z.js +212 -0
- package/dist/contexts-B4ijG24z.js.map +1 -0
- package/dist/elements-D4vmkkF8.js +19 -0
- package/dist/elements-D4vmkkF8.js.map +1 -0
- package/dist/graph-explorer/index.d.ts +54 -73
- package/dist/graph-explorer/index.d.ts.map +1 -0
- package/dist/graph-explorer/index.js +181 -248
- package/dist/graph-explorer/index.js.map +1 -1
- package/dist/human-input/index.d.ts +3 -78
- package/dist/human-input/index.js +3 -21
- package/dist/human-input-CsCbZomZ.js +314 -0
- package/dist/human-input-CsCbZomZ.js.map +1 -0
- package/dist/image/index.d.ts +3 -40
- package/dist/image/index.js +3 -12
- package/dist/image-D_7vaQCR.js +302 -0
- package/dist/image-D_7vaQCR.js.map +1 -0
- package/dist/index-B1Qs2Cjv.d.ts +145 -0
- package/dist/index-B1Qs2Cjv.d.ts.map +1 -0
- package/dist/index-BCBVcl0D.d.ts +277 -0
- package/dist/index-BCBVcl0D.d.ts.map +1 -0
- package/dist/index-CE22tsua.d.ts +20 -0
- package/dist/index-CE22tsua.d.ts.map +1 -0
- package/dist/index-CGqtpc6b.d.ts +25 -0
- package/dist/index-CGqtpc6b.d.ts.map +1 -0
- package/dist/index-DqdyM0Jm.d.ts +7 -0
- package/dist/index-DqdyM0Jm.d.ts.map +1 -0
- package/dist/index-Mw3ltwSG.d.ts +318 -0
- package/dist/index-Mw3ltwSG.d.ts.map +1 -0
- package/dist/index.d.ts +7 -40
- package/dist/index.js +34 -118
- package/dist/index.js.map +1 -1
- package/dist/message/index.d.ts +3 -105
- package/dist/message/index.js +3 -20
- package/dist/message-Dn3wW6yy.js +783 -0
- package/dist/message-Dn3wW6yy.js.map +1 -0
- package/dist/primitives-xfE7zfwJ.js +15 -0
- package/dist/primitives-xfE7zfwJ.js.map +1 -0
- package/dist/refs-Djj9rSvB.js +10 -0
- package/dist/refs-Djj9rSvB.js.map +1 -0
- package/dist/sandbox-desktop/index.d.ts +100 -104
- package/dist/sandbox-desktop/index.d.ts.map +1 -0
- package/dist/sandbox-desktop/index.js +344 -342
- package/dist/sandbox-desktop/index.js.map +1 -1
- package/dist/sandbox-terminal/index.d.ts +52 -56
- package/dist/sandbox-terminal/index.d.ts.map +1 -0
- package/dist/sandbox-terminal/index.js +217 -208
- package/dist/sandbox-terminal/index.js.map +1 -1
- package/dist/selection-toolbar/index.d.ts +3 -21
- package/dist/selection-toolbar/index.js +3 -13
- package/dist/selection-toolbar-CIkOoM-7.js +171 -0
- package/dist/selection-toolbar-CIkOoM-7.js.map +1 -0
- package/dist/shared-BSYElFU2.d.ts +2 -0
- package/dist/shared.d.ts +4 -14
- package/dist/shared.js +1 -43
- package/dist/stream/index.d.ts +2 -22
- package/dist/stream/index.js +1 -8
- package/dist/stream-CAO0x8_1.js +298 -0
- package/dist/stream-CAO0x8_1.js.map +1 -0
- package/dist/thread-list/index.d.ts +3 -47
- package/dist/thread-list/index.js +3 -18
- package/dist/thread-list-xJbGXFrE.js +228 -0
- package/dist/thread-list-xJbGXFrE.js.map +1 -0
- package/dist/ticket-CoJHBpdF.d.ts +32 -0
- package/dist/ticket-CoJHBpdF.d.ts.map +1 -0
- package/dist/value-BGGrx72L.js +13 -0
- package/dist/value-BGGrx72L.js.map +1 -0
- package/package.json +22 -22
- package/dist/attachment/index.js.map +0 -1
- package/dist/attachment-mbjsroli.d.ts +0 -9
- package/dist/chat/index.js.map +0 -1
- package/dist/chat-PSj1Fo4W.d.ts +0 -88
- package/dist/chunk-22EZJUPM.js +0 -120
- package/dist/chunk-22EZJUPM.js.map +0 -1
- package/dist/chunk-5FZKTDZR.js +0 -201
- package/dist/chunk-5FZKTDZR.js.map +0 -1
- package/dist/chunk-6XOJFLX4.js +0 -22
- package/dist/chunk-6XOJFLX4.js.map +0 -1
- package/dist/chunk-CKA4CE26.js +0 -25
- package/dist/chunk-CKA4CE26.js.map +0 -1
- package/dist/chunk-DLBNFBXQ.js +0 -425
- package/dist/chunk-DLBNFBXQ.js.map +0 -1
- package/dist/chunk-E73S3SOF.js +0 -404
- package/dist/chunk-E73S3SOF.js.map +0 -1
- package/dist/chunk-F6AKBUO3.js +0 -380
- package/dist/chunk-F6AKBUO3.js.map +0 -1
- package/dist/chunk-HGOPGZNQ.js +0 -195
- package/dist/chunk-HGOPGZNQ.js.map +0 -1
- package/dist/chunk-KHB5CHAU.js +0 -220
- package/dist/chunk-KHB5CHAU.js.map +0 -1
- package/dist/chunk-LHABOAOP.js +0 -316
- package/dist/chunk-LHABOAOP.js.map +0 -1
- package/dist/chunk-N5XQU36W.js +0 -410
- package/dist/chunk-N5XQU36W.js.map +0 -1
- package/dist/chunk-T3ZFZ3NP.js +0 -30
- package/dist/chunk-T3ZFZ3NP.js.map +0 -1
- package/dist/chunk-W2AHKMRS.js +0 -1092
- package/dist/chunk-W2AHKMRS.js.map +0 -1
- package/dist/chunk-Y2KAMPVJ.js +0 -1582
- package/dist/chunk-Y2KAMPVJ.js.map +0 -1
- package/dist/completion/index.js.map +0 -1
- package/dist/completion-input-DHlwrhxB.d.ts +0 -24
- package/dist/composer-6iCSIq6L.d.ts +0 -111
- package/dist/human-input/index.js.map +0 -1
- package/dist/human-input-CkLrZ8IC.d.ts +0 -27
- package/dist/image/index.js.map +0 -1
- package/dist/image-VZv6Ddsn.d.ts +0 -14
- package/dist/message/index.js.map +0 -1
- package/dist/message-CNRnZQwU.d.ts +0 -14
- package/dist/render-CRKWam2v.d.ts +0 -8
- package/dist/selection-toolbar/index.js.map +0 -1
- package/dist/selection-toolbar-Cwjbuv5S.d.ts +0 -14
- package/dist/shared.js.map +0 -1
- package/dist/stream/index.js.map +0 -1
- package/dist/thread-Bz6-1zaJ.d.ts +0 -12
- package/dist/thread-list/index.js.map +0 -1
- package/dist/thread-list-On8db4XL.d.ts +0 -34
- package/dist/ticket-pexI1zIa.d.ts +0 -33
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
export {
|
|
4
|
-
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
5
|
-
|
|
6
|
-
declare const AttachmentPrimitive: {
|
|
7
|
-
readonly Root: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
8
|
-
children?: react.ReactNode | ((attachment: _anvia_client.UIAttachment) => react.ReactNode);
|
|
9
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
10
|
-
readonly Name: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "asChild"> & {
|
|
11
|
-
asChild?: boolean;
|
|
12
|
-
} & react.RefAttributes<HTMLSpanElement>>;
|
|
13
|
-
readonly Preview: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
14
|
-
asChild?: boolean;
|
|
15
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
16
|
-
readonly Remove: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
|
|
17
|
-
asChild?: boolean;
|
|
18
|
-
} & react.RefAttributes<HTMLButtonElement>>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export { AttachmentPrimitive };
|
|
1
|
+
import { ct as useAttachment, st as AttachmentContextValue } from "../index-Mw3ltwSG.js";
|
|
2
|
+
import { t as AttachmentPrimitive } from "../index-BCBVcl0D.js";
|
|
3
|
+
export { type AttachmentContextValue, AttachmentPrimitive, useAttachment };
|
package/dist/attachment/index.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import "../chunk-T3ZFZ3NP.js";
|
|
5
|
-
import {
|
|
6
|
-
useAttachment
|
|
7
|
-
} from "../chunk-E73S3SOF.js";
|
|
8
|
-
export {
|
|
9
|
-
AttachmentPrimitive,
|
|
10
|
-
useAttachment
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { z as useAttachment } from "../contexts-B4ijG24z.js";
|
|
2
|
+
import { t as AttachmentPrimitive } from "../attachment-DsKTPumt.js";
|
|
3
|
+
export { AttachmentPrimitive, useAttachment };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z as useAttachment } from "./contexts-B4ijG24z.js";
|
|
2
|
+
import { t as renderPrimitive } from "./primitives-xfE7zfwJ.js";
|
|
3
|
+
import { forwardRef, useCallback } from "react";
|
|
4
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/attachment/parts.tsx
|
|
6
|
+
const AttachmentRoot = forwardRef(function AttachmentRoot({ children, ...props }, ref) {
|
|
7
|
+
const { attachment, remove } = useAttachment();
|
|
8
|
+
const renderedChildren = typeof children === "function" ? children(attachment) : children ?? defaultAttachment(remove);
|
|
9
|
+
return renderPrimitive("div", {
|
|
10
|
+
...props,
|
|
11
|
+
children: renderedChildren
|
|
12
|
+
}, ref);
|
|
13
|
+
});
|
|
14
|
+
const AttachmentName = forwardRef(function AttachmentName(props, ref) {
|
|
15
|
+
const { attachment } = useAttachment();
|
|
16
|
+
return renderPrimitive("span", {
|
|
17
|
+
...props,
|
|
18
|
+
children: props.children ?? attachmentLabel(attachment)
|
|
19
|
+
}, ref);
|
|
20
|
+
});
|
|
21
|
+
const AttachmentPreview = forwardRef(function AttachmentPreview(props, ref) {
|
|
22
|
+
const { attachment } = useAttachment();
|
|
23
|
+
return renderPrimitive("div", {
|
|
24
|
+
...props,
|
|
25
|
+
children: props.children ?? defaultPreview(attachment)
|
|
26
|
+
}, ref);
|
|
27
|
+
});
|
|
28
|
+
const AttachmentRemove = forwardRef(function AttachmentRemove({ onClick, ...props }, ref) {
|
|
29
|
+
const { remove } = useAttachment();
|
|
30
|
+
const disabled = props.disabled ?? remove === void 0;
|
|
31
|
+
const handleClick = useCallback((event) => {
|
|
32
|
+
onClick?.(event);
|
|
33
|
+
if (event.defaultPrevented || disabled) return;
|
|
34
|
+
remove?.();
|
|
35
|
+
}, [
|
|
36
|
+
disabled,
|
|
37
|
+
onClick,
|
|
38
|
+
remove
|
|
39
|
+
]);
|
|
40
|
+
return renderPrimitive("button", {
|
|
41
|
+
...props,
|
|
42
|
+
children: props.children ?? "Remove",
|
|
43
|
+
disabled,
|
|
44
|
+
onClick: handleClick,
|
|
45
|
+
type: props.type ?? "button",
|
|
46
|
+
"data-state": disabled ? "disabled" : "enabled"
|
|
47
|
+
}, ref);
|
|
48
|
+
});
|
|
49
|
+
function defaultAttachment(remove) {
|
|
50
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
51
|
+
/* @__PURE__ */ jsx(AttachmentPreview, {}),
|
|
52
|
+
/* @__PURE__ */ jsx(AttachmentName, {}),
|
|
53
|
+
remove === void 0 ? null : /* @__PURE__ */ jsx(AttachmentRemove, {})
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
function defaultPreview(attachment) {
|
|
57
|
+
if (isImageAttachment(attachment)) {
|
|
58
|
+
const source = attachment.url ?? attachmentDataUrl(attachment);
|
|
59
|
+
if (source !== void 0) return /* @__PURE__ */ jsx("img", {
|
|
60
|
+
alt: attachment.name ?? "Attachment",
|
|
61
|
+
src: source
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (attachment.url !== void 0) return /* @__PURE__ */ jsx("a", {
|
|
65
|
+
href: attachment.url,
|
|
66
|
+
children: attachmentLabel(attachment)
|
|
67
|
+
});
|
|
68
|
+
return /* @__PURE__ */ jsx("span", { children: attachment.mediaType ?? attachment.type });
|
|
69
|
+
}
|
|
70
|
+
function attachmentLabel(attachment) {
|
|
71
|
+
return attachment.name ?? attachment.mediaType ?? attachment.type;
|
|
72
|
+
}
|
|
73
|
+
function isImageAttachment(attachment) {
|
|
74
|
+
return attachment.type === "image" || attachment.mediaType?.startsWith("image/") === true;
|
|
75
|
+
}
|
|
76
|
+
function attachmentDataUrl(attachment) {
|
|
77
|
+
if (attachment.data === void 0 || attachment.mediaType === void 0) return;
|
|
78
|
+
return `data:${attachment.mediaType};base64,${attachment.data}`;
|
|
79
|
+
}
|
|
80
|
+
// src/attachment/index.ts
|
|
81
|
+
const AttachmentPrimitive = {
|
|
82
|
+
Root: AttachmentRoot,
|
|
83
|
+
Name: AttachmentName,
|
|
84
|
+
Preview: AttachmentPreview,
|
|
85
|
+
Remove: AttachmentRemove
|
|
86
|
+
};
|
|
87
|
+
export { AttachmentPrimitive as t };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=attachment-DsKTPumt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment-DsKTPumt.js","names":[],"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 } 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 } 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 } 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-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 <img alt={attachment.name ?? \"Attachment\"} src={source} />;\n }\n }\n\n if (attachment.url !== undefined) {\n return <a href={attachment.url}>{attachmentLabel(attachment)}</a>;\n }\n\n return <span>{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 AttachmentPrimitive = {\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":";;;;;AAYA,MAAM,iBAAiB,WAAgD,SAAS,eAC9E,EAAE,UAAU,GAAG,SACf,KACA;CACA,MAAM,EAAE,YAAY,WAAW,cAAc;CAC7C,MAAM,mBACJ,OAAO,aAAa,aAAa,SAAS,UAAU,IAAK,YAAY,kBAAkB,MAAM;CAE/F,OAAO,gBACL,OACA;EACE,GAAG;EACH,UAAU;CACZ,GACA,GACF;AACF,CAAC;AAED,MAAM,iBAAiB,WACrB,SAAS,eAAe,OAAO,KAAK;CAClC,MAAM,EAAE,eAAe,cAAc;CAErC,OAAO,gBACL,QACA;EACE,GAAG;EACH,UAAU,MAAM,YAAY,gBAAgB,UAAU;CACxD,GACA,GACF;AACF,CACF;AAEA,MAAM,oBAAoB,WACxB,SAAS,kBAAkB,OAAO,KAAK;CACrC,MAAM,EAAE,eAAe,cAAc;CAErC,OAAO,gBACL,OACA;EACE,GAAG;EACH,UAAU,MAAM,YAAY,eAAe,UAAU;CACvD,GACA,GACF;AACF,CACF;AAEA,MAAM,mBAAmB,WACvB,SAAS,iBAAiB,EAAE,SAAS,GAAG,SAAS,KAAK;CACpD,MAAM,EAAE,WAAW,cAAc;CACjC,MAAM,WAAW,MAAM,YAAY,WAAW,KAAA;CAE9C,MAAM,cAAc,aACjB,UAAyC;EACxC,UAAU,KAAK;EACf,IAAI,MAAM,oBAAoB,UAC5B;EAEF,SAAS;CACX,GACA;EAAC;EAAU;EAAS;CAAM,CAC5B;CAEA,OAAO,gBACL,UACA;EACE,GAAG;EACH,UAAU,MAAM,YAAY;EAC5B;EACA,SAAS;EACT,MAAM,MAAM,QAAQ;EACpB,cAAc,WAAW,aAAa;CACxC,GACA,GACF;AACF,CACF;AAEA,SAAS,kBAAkB,QAA6C;CACtE,OACE,qBAAA,YAAA,EAAA,UAAA;EACE,oBAAC,mBAAD,CAAoB,CAAA;EACpB,oBAAC,gBAAD,CAAiB,CAAA;EAChB,WAAW,KAAA,IAAY,OAAO,oBAAC,kBAAD,CAAmB,CAAA;CAClD,EAAA,CAAA;AAEN;AAEA,SAAS,eAAe,YAAqC;CAC3D,IAAI,kBAAkB,UAAU,GAAG;EACjC,MAAM,SAAS,WAAW,OAAO,kBAAkB,UAAU;EAC7D,IAAI,WAAW,KAAA,GACb,OAAO,oBAAC,OAAD;GAAK,KAAK,WAAW,QAAQ;GAAc,KAAK;EAAS,CAAA;CAEpE;CAEA,IAAI,WAAW,QAAQ,KAAA,GACrB,OAAO,oBAAC,KAAD;EAAG,MAAM,WAAW;EAAM,UAAA,gBAAgB,UAAU;CAAK,CAAA;CAGlE,OAAO,oBAAC,QAAD,EAAA,UAAO,WAAW,aAAa,WAAW,KAAW,CAAA;AAC9D;AAEA,SAAS,gBAAgB,YAAkC;CACzD,OAAO,WAAW,QAAQ,WAAW,aAAa,WAAW;AAC/D;AAEA,SAAS,kBAAkB,YAAmC;CAC5D,OAAO,WAAW,SAAS,WAAW,WAAW,WAAW,WAAW,QAAQ,MAAM;AACvF;AAEA,SAAS,kBAAkB,YAA8C;CACvE,IAAI,WAAW,SAAS,KAAA,KAAa,WAAW,cAAc,KAAA,GAC5D;CAEF,OAAO,QAAQ,WAAW,UAAU,UAAU,WAAW;AAC3D;;AC/HA,MAAa,sBAAsB;CACjC,MAAM;CACN,MAAM;CACN,SAAS;CACT,QAAQ;AACV"}
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -1,144 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, e as ComposerEntityData, f as ComposerMessageMetadata, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, m as ComposerTriggerStateUpdate, u as useComposer } from '../composer-6iCSIq6L.js';
|
|
5
|
-
export { T as ThreadContextValue, u as useThread } from '../thread-Bz6-1zaJ.js';
|
|
6
|
-
import * as react from 'react';
|
|
7
|
-
import { ReactNode } from 'react';
|
|
8
|
-
import { UIAttachment, ClientDataMap, ClientMetadata, UIMessage } from '@anvia/client';
|
|
9
|
-
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
10
|
-
import { UseChatStatus, ChatSuggestion } from '@anvia/react';
|
|
11
|
-
|
|
12
|
-
type ComposerSubmitMessageArgs<TData extends ClientDataMap = ClientDataMap> = {
|
|
13
|
-
input: string;
|
|
14
|
-
attachments: UIAttachment[];
|
|
15
|
-
entities: ComposerEntity[];
|
|
16
|
-
chat: ChatController<ClientMetadata, TData>;
|
|
17
|
-
quote?: ComposerQuote | undefined;
|
|
18
|
-
clear(): void;
|
|
19
|
-
};
|
|
20
|
-
type ComposerSubmitMessage<TData extends ClientDataMap = ClientDataMap> = (args: ComposerSubmitMessageArgs<TData>) => Promise<void> | void;
|
|
21
|
-
type ComposerTriggerMenuChildren = ReactNode | ((trigger: ComposerTriggerState) => ReactNode);
|
|
22
|
-
type ComposerTriggerItemChildren = ReactNode | ((item: ComposerTriggerItem, trigger: ComposerTriggerState) => ReactNode);
|
|
23
|
-
type ComposerAttachmentsChildren = ReactNode | ((attachment: UIAttachment) => ReactNode);
|
|
24
|
-
declare const ComposerPrimitive: {
|
|
25
|
-
readonly Root: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref">, "asChild"> & {
|
|
26
|
-
asChild?: boolean;
|
|
27
|
-
} & {
|
|
28
|
-
attachments?: UIAttachment[];
|
|
29
|
-
defaultAttachments?: UIAttachment[];
|
|
30
|
-
defaultEntities?: ComposerEntity[];
|
|
31
|
-
defaultInput?: string;
|
|
32
|
-
defaultQuote?: ComposerQuote | undefined;
|
|
33
|
-
entities?: ComposerEntity[];
|
|
34
|
-
input?: string;
|
|
35
|
-
onAttachmentsChange?: (attachments: UIAttachment[]) => void;
|
|
36
|
-
onEntitiesChange?: (entities: ComposerEntity[]) => void;
|
|
37
|
-
onInputChange?: (input: string) => void;
|
|
38
|
-
onQuoteChange?: (quote: ComposerQuote | undefined) => void;
|
|
39
|
-
quote?: ComposerQuote | undefined;
|
|
40
|
-
submitMessage?: ComposerSubmitMessage;
|
|
41
|
-
triggers?: ComposerTriggerDefinition[];
|
|
42
|
-
} & react.RefAttributes<HTMLFormElement>>;
|
|
43
|
-
readonly Quote: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"blockquote">, "children"> & {
|
|
44
|
-
children?: ReactNode | ((quote: ComposerQuote) => ReactNode);
|
|
45
|
-
} & react.RefAttributes<HTMLQuoteElement>>;
|
|
46
|
-
readonly ClearQuote: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
|
|
47
|
-
asChild?: boolean;
|
|
48
|
-
} & react.RefAttributes<HTMLButtonElement>>;
|
|
49
|
-
readonly Input: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
50
|
-
asChild?: boolean;
|
|
51
|
-
} & {
|
|
52
|
-
autoResize?: boolean;
|
|
53
|
-
disabled?: boolean | undefined;
|
|
54
|
-
maxRows?: number;
|
|
55
|
-
minRows?: number;
|
|
56
|
-
placeholder?: string | undefined;
|
|
57
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
58
|
-
readonly TextareaInput: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref">, "asChild"> & {
|
|
59
|
-
asChild?: boolean;
|
|
60
|
-
} & {
|
|
61
|
-
autoResize?: boolean;
|
|
62
|
-
maxRows?: number;
|
|
63
|
-
minRows?: number;
|
|
64
|
-
} & react.RefAttributes<HTMLTextAreaElement>>;
|
|
65
|
-
readonly TriggerMenu: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
66
|
-
children?: ComposerTriggerMenuChildren;
|
|
67
|
-
keepMounted?: boolean;
|
|
68
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
69
|
-
readonly TriggerItem: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"button">, "children"> & {
|
|
70
|
-
children?: ComposerTriggerItemChildren;
|
|
71
|
-
index?: number | undefined;
|
|
72
|
-
item?: ComposerTriggerItem | undefined;
|
|
73
|
-
} & react.RefAttributes<HTMLButtonElement>>;
|
|
74
|
-
readonly Attachments: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
75
|
-
children?: ComposerAttachmentsChildren;
|
|
76
|
-
keepMounted?: boolean;
|
|
77
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
78
|
-
readonly AddAttachment: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
|
|
79
|
-
asChild?: boolean;
|
|
80
|
-
} & {
|
|
81
|
-
accept?: string;
|
|
82
|
-
multiple?: boolean;
|
|
83
|
-
} & react.RefAttributes<HTMLButtonElement>>;
|
|
84
|
-
readonly AttachmentInput: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "asChild"> & {
|
|
85
|
-
asChild?: boolean;
|
|
86
|
-
} & react.RefAttributes<HTMLInputElement>>;
|
|
87
|
-
readonly AttachmentDropzone: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
88
|
-
asChild?: boolean;
|
|
89
|
-
} & {
|
|
90
|
-
disabled?: boolean;
|
|
91
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
92
|
-
readonly Submit: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
|
|
93
|
-
asChild?: boolean;
|
|
94
|
-
} & react.RefAttributes<HTMLButtonElement>>;
|
|
95
|
-
readonly Stop: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
|
|
96
|
-
asChild?: boolean;
|
|
97
|
-
} & react.RefAttributes<HTMLButtonElement>>;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
type ThreadMessagesChildren = ReactNode | ((message: UIMessage) => ReactNode);
|
|
101
|
-
type ThreadSuggestionChildren = ReactNode | ((suggestion: ChatSuggestion) => ReactNode);
|
|
102
|
-
declare const ThreadPrimitive: {
|
|
103
|
-
readonly Root: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
104
|
-
asChild?: boolean;
|
|
105
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
106
|
-
readonly Viewport: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
107
|
-
asChild?: boolean;
|
|
108
|
-
} & {
|
|
109
|
-
autoScroll?: boolean;
|
|
110
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
111
|
-
readonly ViewportFooter: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
112
|
-
asChild?: boolean;
|
|
113
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
114
|
-
readonly Messages: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
115
|
-
children?: ThreadMessagesChildren;
|
|
116
|
-
keepMounted?: boolean;
|
|
117
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
118
|
-
readonly Empty: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
119
|
-
asChild?: boolean;
|
|
120
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
121
|
-
readonly Status: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
122
|
-
children?: ReactNode | ((status: UseChatStatus) => ReactNode);
|
|
123
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
124
|
-
readonly Loading: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
125
|
-
asChild?: boolean;
|
|
126
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
127
|
-
readonly Error: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
128
|
-
children?: ReactNode | ((error: unknown) => ReactNode);
|
|
129
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
130
|
-
readonly Suggestions: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
131
|
-
children?: ThreadSuggestionChildren;
|
|
132
|
-
keepMounted?: boolean;
|
|
133
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
134
|
-
readonly Suggestion: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"button">, "children"> & {
|
|
135
|
-
children?: ReactNode;
|
|
136
|
-
prompt?: string;
|
|
137
|
-
suggestion?: ChatSuggestion;
|
|
138
|
-
} & react.RefAttributes<HTMLButtonElement>>;
|
|
139
|
-
readonly ScrollToBottom: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
|
|
140
|
-
asChild?: boolean;
|
|
141
|
-
} & react.RefAttributes<HTMLButtonElement>>;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
export { ChatController, ComposerEntity, ComposerPrimitive, ComposerQuote, type ComposerSubmitMessage, type ComposerSubmitMessageArgs, ComposerTriggerDefinition, ComposerTriggerItem, ComposerTriggerState, ThreadPrimitive };
|
|
1
|
+
import { A as ComposerEntitiesUpdate, B as ComposerTriggerStateUpdate, D as ComposerAttachmentInput, F as ComposerTriggerDefinition, I as ComposerTriggerItem, L as ComposerTriggerItems, M as ComposerEntityData, N as ComposerMessageMetadata, O as ComposerAttachmentsUpdate, P as ComposerQuote, R as ComposerTriggerItemsArgs, V as useComposer, at as useChatContext, c as ThreadContextValue, it as ChatProviderProps, j as ComposerEntity, k as ComposerContextValue, l as useThread, nt as ChatController, rt as ChatProvider, z as ComposerTriggerState } from "../index-Mw3ltwSG.js";
|
|
2
|
+
import { a as ComposerSubmitMessageArgs, i as ComposerSubmitMessage, n as ComposerInputEntity, r as ComposerPrimitive, t as ThreadPrimitive } from "../index-B1Qs2Cjv.js";
|
|
3
|
+
export { type ChatController, ChatProvider, type ChatProviderProps, type ComposerAttachmentInput, type ComposerAttachmentsUpdate, type ComposerContextValue, type ComposerEntitiesUpdate, type ComposerEntity, type ComposerEntityData, type ComposerInputEntity, type ComposerMessageMetadata, ComposerPrimitive, type ComposerQuote, type ComposerSubmitMessage, type ComposerSubmitMessageArgs, type ComposerTriggerDefinition, type ComposerTriggerItem, type ComposerTriggerItems, type ComposerTriggerItemsArgs, type ComposerTriggerState, type ComposerTriggerStateUpdate, type ThreadContextValue, ThreadPrimitive, useChatContext, useComposer, useThread };
|
package/dist/chat/index.js
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "../chunk-Y2KAMPVJ.js";
|
|
5
|
-
import "../chunk-W2AHKMRS.js";
|
|
6
|
-
import "../chunk-6XOJFLX4.js";
|
|
7
|
-
import "../chunk-F6AKBUO3.js";
|
|
8
|
-
import "../chunk-22EZJUPM.js";
|
|
9
|
-
import "../chunk-CKA4CE26.js";
|
|
10
|
-
import "../chunk-T3ZFZ3NP.js";
|
|
11
|
-
import {
|
|
12
|
-
ChatProvider,
|
|
13
|
-
useChatContext,
|
|
14
|
-
useComposer,
|
|
15
|
-
useThread
|
|
16
|
-
} from "../chunk-E73S3SOF.js";
|
|
17
|
-
export {
|
|
18
|
-
ChatProvider,
|
|
19
|
-
ComposerPrimitive,
|
|
20
|
-
ThreadPrimitive,
|
|
21
|
-
useChatContext,
|
|
22
|
-
useComposer,
|
|
23
|
-
useThread
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { F as ChatProvider, I as useChatContext, T as useComposer, c as useThread } from "../contexts-B4ijG24z.js";
|
|
2
|
+
import { n as ComposerPrimitive, t as ThreadPrimitive } from "../chat-CAnvUEAv.js";
|
|
3
|
+
export { ChatProvider, ComposerPrimitive, ThreadPrimitive, useChatContext, useComposer, useThread };
|