@nexface/chat 0.1.1-alpha.8 → 0.1.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.
Files changed (84) hide show
  1. package/dist/THIRD_PARTY_LICENSES.txt +44 -0
  2. package/dist/assistant-attachments.d.ts +31 -0
  3. package/dist/assistant-attachments.js +158 -0
  4. package/dist/assistant-attachments.js.map +1 -0
  5. package/dist/assistant-components.d.ts +19 -0
  6. package/dist/assistant-components.js +41 -0
  7. package/dist/assistant-components.js.map +1 -0
  8. package/dist/assistant-runtime.d.ts +24 -0
  9. package/dist/assistant-runtime.js +104 -0
  10. package/dist/assistant-runtime.js.map +1 -0
  11. package/dist/attachments.d.ts +3 -1
  12. package/dist/attachments.js +13 -0
  13. package/dist/attachments.js.map +1 -1
  14. package/dist/client.d.ts +2 -1
  15. package/dist/client.js +35 -4
  16. package/dist/client.js.map +1 -1
  17. package/dist/default-chat.d.ts +2 -1
  18. package/dist/default-chat.js +72 -110
  19. package/dist/default-chat.js.map +1 -1
  20. package/dist/protocol-messages.js +1 -1
  21. package/dist/protocol-messages.js.map +1 -1
  22. package/dist/protocol-response.d.ts +32 -0
  23. package/dist/protocol-response.js +62 -0
  24. package/dist/protocol-response.js.map +1 -0
  25. package/dist/react.d.ts +4 -3
  26. package/dist/react.js +58 -7
  27. package/dist/react.js.map +1 -1
  28. package/dist/storage.js +4 -2
  29. package/dist/storage.js.map +1 -1
  30. package/dist/styles.css +2340 -95
  31. package/dist/tool-result.d.ts +1 -0
  32. package/dist/tool-result.js +12 -0
  33. package/dist/tool-result.js.map +1 -0
  34. package/dist/types.d.ts +35 -0
  35. package/dist/types.js.map +1 -1
  36. package/dist/ui/attachment.aui.d.ts +7 -0
  37. package/dist/ui/attachment.aui.js +93 -0
  38. package/dist/ui/attachment.aui.js.map +1 -0
  39. package/dist/ui/avatar.d.ts +11 -0
  40. package/dist/ui/avatar.js +24 -0
  41. package/dist/ui/avatar.js.map +1 -0
  42. package/dist/ui/button.d.ts +13 -0
  43. package/dist/ui/button.js +38 -0
  44. package/dist/ui/button.js.map +1 -0
  45. package/dist/ui/dialog.d.ts +17 -0
  46. package/dist/ui/dialog.js +60 -0
  47. package/dist/ui/dialog.js.map +1 -0
  48. package/dist/ui/dropdown-menu.d.ts +25 -0
  49. package/dist/ui/dropdown-menu.js +60 -0
  50. package/dist/ui/dropdown-menu.js.map +1 -0
  51. package/dist/ui/input.d.ts +3 -0
  52. package/dist/ui/input.js +9 -0
  53. package/dist/ui/input.js.map +1 -0
  54. package/dist/ui/markdown-text.d.ts +7 -0
  55. package/dist/ui/markdown-text.js +73 -0
  56. package/dist/ui/markdown-text.js.map +1 -0
  57. package/dist/ui/skeleton.d.ts +2 -0
  58. package/dist/ui/skeleton.js +8 -0
  59. package/dist/ui/skeleton.js.map +1 -0
  60. package/dist/ui/surface.d.ts +5 -0
  61. package/dist/ui/surface.js +58 -0
  62. package/dist/ui/surface.js.map +1 -0
  63. package/dist/ui/thread-list.aui.d.ts +9 -0
  64. package/dist/ui/thread-list.aui.js +19 -0
  65. package/dist/ui/thread-list.aui.js.map +1 -0
  66. package/dist/ui/thread.aui.d.ts +29 -0
  67. package/dist/ui/thread.aui.js +26 -0
  68. package/dist/ui/thread.aui.js.map +1 -0
  69. package/dist/ui/tooltip-icon-button.d.ts +7 -0
  70. package/dist/ui/tooltip-icon-button.js +12 -0
  71. package/dist/ui/tooltip-icon-button.js.map +1 -0
  72. package/dist/ui/tooltip.d.ts +7 -0
  73. package/dist/ui/tooltip.js +23 -0
  74. package/dist/ui/tooltip.js.map +1 -0
  75. package/dist/ui/use-attachment-src.d.ts +1 -0
  76. package/dist/ui/use-attachment-src.js +28 -0
  77. package/dist/ui/use-attachment-src.js.map +1 -0
  78. package/dist/ui/use-copy-to-clipboard.d.ts +7 -0
  79. package/dist/ui/use-copy-to-clipboard.js +16 -0
  80. package/dist/ui/use-copy-to-clipboard.js.map +1 -0
  81. package/dist/ui/utils.d.ts +2 -0
  82. package/dist/ui/utils.js +8 -0
  83. package/dist/ui/utils.js.map +1 -0
  84. package/package.json +11 -5
@@ -0,0 +1,7 @@
1
+ import { unstable_memoizeMarkdownComponents as memoizeMarkdownComponents } from "@assistant-ui/react-markdown";
2
+ import type { TextMessagePartProps } from "@assistant-ui/react";
3
+ type MarkdownTextProps = Partial<TextMessagePartProps> & {
4
+ components?: Parameters<typeof memoizeMarkdownComponents>[0];
5
+ };
6
+ export declare const MarkdownText: import("react").NamedExoticComponent<MarkdownTextProps>;
7
+ export {};
@@ -0,0 +1,73 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { MarkdownTextPrimitive, unstable_memoizeMarkdownComponents as memoizeMarkdownComponents, useIsMarkdownCodeBlock, } from "@assistant-ui/react-markdown";
4
+ import remarkGfm from "remark-gfm";
5
+ import { memo, useMemo, useRef } from "react";
6
+ import { CheckIcon, CopyIcon } from "lucide-react";
7
+ import { TooltipIconButton } from "./tooltip-icon-button.js";
8
+ import { useCopyToClipboard } from "./use-copy-to-clipboard.js";
9
+ import { cn } from "./utils.js";
10
+ const useShallowStable = (value) => {
11
+ const ref = useRef(value);
12
+ if (value !== ref.current) {
13
+ const prev = ref.current;
14
+ const stable = value !== undefined &&
15
+ prev !== undefined &&
16
+ Object.keys(prev).length === Object.keys(value).length &&
17
+ Object.keys(value).every((key) => prev[key] === value[key]);
18
+ if (!stable)
19
+ ref.current = value;
20
+ }
21
+ return ref.current;
22
+ };
23
+ const MarkdownTextImpl = ({ components }) => {
24
+ const stableComponents = useShallowStable(components);
25
+ const markdownComponents = useMemo(() => {
26
+ if (!stableComponents)
27
+ return defaultComponents;
28
+ return {
29
+ ...defaultComponents,
30
+ ...memoizeMarkdownComponents(stableComponents),
31
+ };
32
+ }, [stableComponents]);
33
+ return (_jsx(MarkdownTextPrimitive, { remarkPlugins: [remarkGfm], skipHtml: true, className: cn("aui-md"), components: markdownComponents, defer: true }));
34
+ };
35
+ export const MarkdownText = memo(MarkdownTextImpl);
36
+ const CodeHeader = ({ language, code }) => {
37
+ const { isCopied, copyToClipboard } = useCopyToClipboard();
38
+ const onCopy = () => {
39
+ if (!code || isCopied)
40
+ return;
41
+ copyToClipboard(code);
42
+ };
43
+ return (_jsxs("div", { className: cn("aui-code-header-root border-border/50 bg-muted/50 mt-3 flex items-center justify-between rounded-t-xl border border-b-0 px-3.5 py-1.5 text-xs"), children: [_jsx("span", { className: cn("aui-code-header-language text-muted-foreground font-medium lowercase"), children: language }), _jsxs(TooltipIconButton, { tooltip: "Copy", onClick: onCopy, children: [!isCopied && (_jsx(CopyIcon, { className: cn("animate-in zoom-in-75 fade-in duration-150") })), isCopied && (_jsx(CheckIcon, { className: cn("animate-in zoom-in-50 fade-in duration-200 ease-out") }))] })] }));
44
+ };
45
+ const defaultComponents = memoizeMarkdownComponents({
46
+ h1: ({ className, ...props }) => (_jsx("h1", { className: cn("aui-md-h1 mt-5 mb-2 scroll-m-20 text-xl font-semibold first:mt-0 last:mb-0", className), ...props })),
47
+ h2: ({ className, ...props }) => (_jsx("h2", { className: cn("aui-md-h2 mt-5 mb-2 scroll-m-20 text-lg font-semibold first:mt-0 last:mb-0", className), ...props })),
48
+ h3: ({ className, ...props }) => (_jsx("h3", { className: cn("aui-md-h3 mt-4 mb-1.5 scroll-m-20 text-base font-semibold first:mt-0 last:mb-0", className), ...props })),
49
+ h4: ({ className, ...props }) => (_jsx("h4", { className: cn("aui-md-h4 mt-3.5 mb-1 scroll-m-20 text-base font-medium first:mt-0 last:mb-0", className), ...props })),
50
+ h5: ({ className, ...props }) => (_jsx("h5", { className: cn("aui-md-h5 mt-3 mb-1 text-sm font-semibold first:mt-0 last:mb-0", className), ...props })),
51
+ h6: ({ className, ...props }) => (_jsx("h6", { className: cn("aui-md-h6 mt-3 mb-1 text-sm font-medium first:mt-0 last:mb-0", className), ...props })),
52
+ p: ({ className, ...props }) => (_jsx("p", { className: cn("aui-md-p my-3 leading-relaxed first:mt-0 last:mb-0", className), ...props })),
53
+ a: ({ className, ...props }) => (_jsx("a", { className: cn("aui-md-a text-primary hover:text-primary/80 underline underline-offset-2", className), ...props })),
54
+ blockquote: ({ className, ...props }) => (_jsx("blockquote", { className: cn("aui-md-blockquote border-muted-foreground/30 text-muted-foreground my-3 border-s-2 ps-4", className), ...props })),
55
+ ul: ({ className, ...props }) => (_jsx("ul", { className: cn("aui-md-ul marker:text-muted-foreground my-3 ms-5 list-disc [&>li]:mt-1", className), ...props })),
56
+ ol: ({ className, ...props }) => (_jsx("ol", { className: cn("aui-md-ol marker:text-muted-foreground my-3 ms-5 list-decimal [&>li]:mt-1", className), ...props })),
57
+ hr: ({ className, ...props }) => (_jsx("hr", { className: cn("aui-md-hr border-muted-foreground/20 my-3", className), ...props })),
58
+ table: ({ className, ...props }) => (_jsx("div", { className: cn("aui-md-table-wrapper my-3 overflow-x-auto"), children: _jsx("table", { className: cn("aui-md-table w-full border-separate border-spacing-0", className), ...props }) })),
59
+ th: ({ className, ...props }) => (_jsx("th", { className: cn("aui-md-th bg-muted px-3 py-1.5 text-start font-medium first:rounded-ss-lg last:rounded-se-lg [[align=center]]:text-center [[align=right]]:text-right", className), ...props })),
60
+ td: ({ className, ...props }) => (_jsx("td", { className: cn("aui-md-td border-muted-foreground/20 border-s border-b px-3 py-1.5 text-start last:border-e [[align=center]]:text-center [[align=right]]:text-right", className), ...props })),
61
+ tr: ({ className, ...props }) => (_jsx("tr", { className: cn("aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-es-lg [&:last-child>td:last-child]:rounded-ee-lg", className), ...props })),
62
+ li: ({ className, ...props }) => (_jsx("li", { className: cn("aui-md-li leading-relaxed", className), ...props })),
63
+ strong: ({ className, ...props }) => (_jsx("strong", { className: cn("aui-md-strong font-semibold", className), ...props })),
64
+ sup: ({ className, ...props }) => (_jsx("sup", { className: cn("aui-md-sup [&>a]:text-xs [&>a]:no-underline", className), ...props })),
65
+ pre: ({ className, ...props }) => (_jsx("pre", { className: cn("aui-md-pre border-border/50 bg-muted/30 overflow-x-auto rounded-t-none rounded-b-xl border border-t-0 p-3.5 text-[13px] leading-relaxed", className), ...props })),
66
+ code: function Code({ className, ...props }) {
67
+ const isCodeBlock = useIsMarkdownCodeBlock();
68
+ return (_jsx("code", { className: cn(!isCodeBlock &&
69
+ "aui-md-inline-code bg-muted rounded-md px-1.5 py-0.5 font-mono text-[0.85em]", className), ...props }));
70
+ },
71
+ CodeHeader,
72
+ });
73
+ //# sourceMappingURL=markdown-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-text.js","sourceRoot":"","sources":["../../src/ui/markdown-text.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAwB,qBAAqB,EAAE,kCAAkC,IAAI,yBAAyB,EAAE,sBAAsB,GAAG,MAAM,8BAA8B,CAAC;AACrL,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAW,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAIhC,MAAM,gBAAgB,GAAG,CAAgD,KAAQ,EAAK,EAAE;IACtF,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,KAAK,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC;QACzB,MAAM,MAAM,GAAG,KAAK,KAAK,SAAS;YAChC,IAAI,KAAK,SAAS;YAClB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC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,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,cAAK,SAAS,EAAE,EAAE,CAAC,yIAAyI,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC;IAC1N,IAAI,EAAE,SAAS,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE;QACzC,MAAM,WAAW,GAAG,sBAAsB,EAAE,CAAC;QAC7C,OAAO,CAAC,eAAM,SAAS,EAAE,EAAE,CAAC,CAAC,WAAW;gBACpC,8EAA8E,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;IAChH,CAAC;IACD,UAAU;CACX,CAAC,CAAC","sourcesContent":["\"use client\";\nimport { type CodeHeaderProps, MarkdownTextPrimitive, unstable_memoizeMarkdownComponents as memoizeMarkdownComponents, useIsMarkdownCodeBlock, } from \"@assistant-ui/react-markdown\";\nimport remarkGfm from \"remark-gfm\";\nimport { type FC, memo, useMemo, useRef } from \"react\";\nimport type { TextMessagePartProps } from \"@assistant-ui/react\";\nimport { CheckIcon, CopyIcon } from \"lucide-react\";\nimport { TooltipIconButton } from \"./tooltip-icon-button.js\";\nimport { useCopyToClipboard } from \"./use-copy-to-clipboard.js\";\nimport { cn } from \"./utils.js\";\ntype MarkdownTextProps = Partial<TextMessagePartProps> & {\n components?: Parameters<typeof memoizeMarkdownComponents>[0];\n};\nconst useShallowStable = <T extends Record<string, unknown> | undefined>(value: T): T => {\n const ref = useRef(value);\n if (value !== ref.current) {\n const prev = ref.current;\n const stable = value !== undefined &&\n prev !== undefined &&\n Object.keys(prev).length === Object.keys(value).length &&\n Object.keys(value).every((key) => prev[key] === value[key]);\n if (!stable)\n ref.current = value;\n }\n return ref.current;\n};\nconst MarkdownTextImpl: FC<MarkdownTextProps> = ({ components }) => {\n const stableComponents = useShallowStable(components);\n const markdownComponents = useMemo(() => {\n if (!stableComponents)\n return defaultComponents;\n return {\n ...defaultComponents,\n ...memoizeMarkdownComponents(stableComponents),\n };\n }, [stableComponents]);\n return (<MarkdownTextPrimitive remarkPlugins={[remarkGfm]} skipHtml className={cn(\"aui-md\")} components={markdownComponents} defer/>);\n};\nexport const MarkdownText = memo(MarkdownTextImpl);\nconst CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {\n const { isCopied, copyToClipboard } = useCopyToClipboard();\n const onCopy = () => {\n if (!code || isCopied)\n return;\n copyToClipboard(code);\n };\n return (<div className={cn(\"aui-code-header-root border-border/50 bg-muted/50 mt-3 flex items-center justify-between rounded-t-xl border border-b-0 px-3.5 py-1.5 text-xs\")}>\n <span className={cn(\"aui-code-header-language text-muted-foreground font-medium lowercase\")}>\n {language}\n </span>\n <TooltipIconButton tooltip=\"Copy\" onClick={onCopy}>\n {!isCopied && (<CopyIcon className={cn(\"animate-in zoom-in-75 fade-in duration-150\")}/>)}\n {isCopied && (<CheckIcon className={cn(\"animate-in zoom-in-50 fade-in duration-200 ease-out\")}/>)}\n </TooltipIconButton>\n </div>);\n};\nconst defaultComponents = memoizeMarkdownComponents({\n h1: ({ className, ...props }) => (<h1 className={cn(\"aui-md-h1 mt-5 mb-2 scroll-m-20 text-xl font-semibold first:mt-0 last:mb-0\", className)} {...props}/>),\n h2: ({ className, ...props }) => (<h2 className={cn(\"aui-md-h2 mt-5 mb-2 scroll-m-20 text-lg font-semibold first:mt-0 last:mb-0\", className)} {...props}/>),\n h3: ({ className, ...props }) => (<h3 className={cn(\"aui-md-h3 mt-4 mb-1.5 scroll-m-20 text-base font-semibold first:mt-0 last:mb-0\", className)} {...props}/>),\n h4: ({ className, ...props }) => (<h4 className={cn(\"aui-md-h4 mt-3.5 mb-1 scroll-m-20 text-base font-medium first:mt-0 last:mb-0\", className)} {...props}/>),\n h5: ({ className, ...props }) => (<h5 className={cn(\"aui-md-h5 mt-3 mb-1 text-sm font-semibold first:mt-0 last:mb-0\", className)} {...props}/>),\n h6: ({ className, ...props }) => (<h6 className={cn(\"aui-md-h6 mt-3 mb-1 text-sm font-medium first:mt-0 last:mb-0\", className)} {...props}/>),\n p: ({ className, ...props }) => (<p className={cn(\"aui-md-p my-3 leading-relaxed first:mt-0 last:mb-0\", className)} {...props}/>),\n a: ({ className, ...props }) => (<a className={cn(\"aui-md-a text-primary hover:text-primary/80 underline underline-offset-2\", className)} {...props}/>),\n blockquote: ({ className, ...props }) => (<blockquote className={cn(\"aui-md-blockquote border-muted-foreground/30 text-muted-foreground my-3 border-s-2 ps-4\", className)} {...props}/>),\n ul: ({ className, ...props }) => (<ul className={cn(\"aui-md-ul marker:text-muted-foreground my-3 ms-5 list-disc [&>li]:mt-1\", className)} {...props}/>),\n ol: ({ className, ...props }) => (<ol className={cn(\"aui-md-ol marker:text-muted-foreground my-3 ms-5 list-decimal [&>li]:mt-1\", className)} {...props}/>),\n hr: ({ className, ...props }) => (<hr className={cn(\"aui-md-hr border-muted-foreground/20 my-3\", className)} {...props}/>),\n table: ({ className, ...props }) => (<div className={cn(\"aui-md-table-wrapper my-3 overflow-x-auto\")}>\n <table className={cn(\"aui-md-table w-full border-separate border-spacing-0\", className)} {...props}/>\n </div>),\n th: ({ className, ...props }) => (<th className={cn(\"aui-md-th bg-muted px-3 py-1.5 text-start font-medium first:rounded-ss-lg last:rounded-se-lg [[align=center]]:text-center [[align=right]]:text-right\", className)} {...props}/>),\n td: ({ className, ...props }) => (<td className={cn(\"aui-md-td border-muted-foreground/20 border-s border-b px-3 py-1.5 text-start last:border-e [[align=center]]:text-center [[align=right]]:text-right\", className)} {...props}/>),\n tr: ({ className, ...props }) => (<tr className={cn(\"aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-es-lg [&:last-child>td:last-child]:rounded-ee-lg\", className)} {...props}/>),\n li: ({ className, ...props }) => (<li className={cn(\"aui-md-li leading-relaxed\", className)} {...props}/>),\n strong: ({ className, ...props }) => (<strong className={cn(\"aui-md-strong font-semibold\", className)} {...props}/>),\n sup: ({ className, ...props }) => (<sup className={cn(\"aui-md-sup [&>a]:text-xs [&>a]:no-underline\", className)} {...props}/>),\n pre: ({ className, ...props }) => (<pre className={cn(\"aui-md-pre border-border/50 bg-muted/30 overflow-x-auto rounded-t-none rounded-b-xl border border-t-0 p-3.5 text-[13px] leading-relaxed\", className)} {...props}/>),\n code: function Code({ className, ...props }) {\n const isCodeBlock = useIsMarkdownCodeBlock();\n return (<code className={cn(!isCodeBlock &&\n \"aui-md-inline-code bg-muted rounded-md px-1.5 py-0.5 font-mono text-[0.85em]\", className)} {...props}/>);\n },\n CodeHeader,\n});\n"]}
@@ -0,0 +1,2 @@
1
+ declare function Skeleton({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
2
+ export { Skeleton };
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { cn } from "./utils.js";
4
+ function Skeleton({ className, ...props }) {
5
+ return (_jsx("div", { "data-slot": "skeleton", className: cn("animate-pulse rounded-md bg-accent", className), ...props }));
6
+ }
7
+ export { Skeleton };
8
+ //# sourceMappingURL=skeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skeleton.js","sourceRoot":"","sources":["../../src/ui/skeleton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,SAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA+B;IACpE,OAAO,CAAC,2BAAe,UAAU,EAAC,SAAS,EAAE,EAAE,CAAC,oCAAoC,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AAClH,CAAC;AACD,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["\"use client\";\nimport { cn } from \"./utils.js\";\nfunction Skeleton({ className, ...props }: React.ComponentProps<\"div\">) {\n return (<div data-slot=\"skeleton\" className={cn(\"animate-pulse rounded-md bg-accent\", className)} {...props}/>);\n}\nexport { Skeleton };\n"]}
@@ -0,0 +1,5 @@
1
+ import { type ComponentProps } from "react";
2
+ export declare function ChatSurface({ children, className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
3
+ export declare function useDialogContainer(): HTMLElement | null;
4
+ export declare function usePortalContainer(): HTMLElement | null;
5
+ export declare function PortalThemeSync(): null;
@@ -0,0 +1,58 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { createContext, useContext, useLayoutEffect, useRef, useState } from "react";
4
+ const PortalContext = createContext({ container: null, acquire: () => () => { } });
5
+ const tokens = ["background", "foreground", "primary", "primary-foreground", "primary-hover", "muted", "muted-foreground", "border"];
6
+ const DialogContainerContext = createContext(null);
7
+ export function ChatSurface({ children, className, ...props }) {
8
+ const root = useRef(null);
9
+ const [dialogContainer, setDialogContainer] = useState(null);
10
+ const [container, setContainer] = useState(null);
11
+ const [active, setActive] = useState(0);
12
+ const acquire = useRef(() => { setActive((n) => n + 1); return () => setActive((n) => Math.max(0, n - 1)); }).current;
13
+ useLayoutEffect(() => {
14
+ const node = document.createElement("div");
15
+ node.className = "nexface-ui nexface-chat-portals";
16
+ node.dataset.nexfaceIgnore = "";
17
+ document.body.append(node);
18
+ setContainer(node);
19
+ return () => { node.remove(); };
20
+ }, []);
21
+ useLayoutEffect(() => {
22
+ const element = root.current;
23
+ if (!element || !container)
24
+ return;
25
+ const sync = () => {
26
+ const style = getComputedStyle(element);
27
+ for (const token of tokens)
28
+ container.style.setProperty(`--nxf-${token}`, style.getPropertyValue(`--nxf-${token}`));
29
+ container.style.font = style.font;
30
+ container.style.direction = style.direction;
31
+ container.style.colorScheme = style.colorScheme;
32
+ container.classList.toggle("nexface-dark", Boolean(element.closest(".dark, .nexface-dark")));
33
+ };
34
+ sync();
35
+ if (!active)
36
+ return;
37
+ // Observe only theme attributes while a portal is mounted, never page input.
38
+ const observer = new MutationObserver(sync);
39
+ for (let node = element; node; node = node.parentElement)
40
+ observer.observe(node, { attributes: true, attributeFilter: ["class", "style", "dir", "data-theme"] });
41
+ const media = window.matchMedia?.("(prefers-color-scheme: dark)");
42
+ media?.addEventListener("change", sync);
43
+ return () => { observer.disconnect(); media?.removeEventListener("change", sync); };
44
+ }, [container, active, props.style, className]);
45
+ return _jsx(PortalContext.Provider, { value: { container, acquire }, children: _jsx(DialogContainerContext.Provider, { value: dialogContainer, children: _jsxs("div", { ref: root, className: `nexface-ui ${className ?? ""}`, ...props, children: [children, _jsx("div", { ref: setDialogContainer, className: "nexface-chat__dialogs" })] }) }) });
46
+ }
47
+ export function useDialogContainer() {
48
+ return useContext(DialogContainerContext);
49
+ }
50
+ export function usePortalContainer() {
51
+ return useContext(PortalContext).container;
52
+ }
53
+ export function PortalThemeSync() {
54
+ const { acquire } = useContext(PortalContext);
55
+ useLayoutEffect(acquire, [acquire]);
56
+ return null;
57
+ }
58
+ //# sourceMappingURL=surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/ui/surface.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAuB,MAAM,OAAO,CAAC;AAC1G,MAAM,aAAa,GAAG,aAAa,CAGhC,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;AAClD,MAAM,MAAM,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,oBAAoB,EAAE,eAAe,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AACrI,MAAM,sBAAsB,GAAG,aAAa,CAAqB,IAAI,CAAC,CAAC;AACvE,MAAM,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyB;IAClF,MAAM,IAAI,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC1C,MAAM,CAAC,eAAe,EAA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C,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,YAAE,KAAC,sBAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YAAE,eAAK,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,SAAS,IAAI,EAAE,EAAE,KAAM,KAAK,aAAG,QAAQ,EAAC,cAAK,GAAG,EAAE,kBAAkB,EAAE,SAAS,EAAC,uBAAuB,GAAG,IAAM,GAAkC,GAAyB,CAAC;AAC9U,CAAC;AACD,MAAM,UAAU,kBAAkB;IAChC,OAAO,UAAU,CAAC,sBAAsB,CAAC,CAAC;AAC5C,CAAC;AACD,MAAM,UAAU,kBAAkB;IAChC,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC;AAC7C,CAAC;AACD,MAAM,UAAU,eAAe;IAC7B,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAC9C,eAAe,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["\"use client\";\nimport { createContext, useContext, useLayoutEffect, useRef, useState, type ComponentProps } from \"react\";\nconst PortalContext = createContext<{\n container: HTMLElement | null;\n acquire(): () => void;\n}>({ container: null, acquire: () => () => { } });\nconst tokens = [\"background\", \"foreground\", \"primary\", \"primary-foreground\", \"primary-hover\", \"muted\", \"muted-foreground\", \"border\"];\nconst DialogContainerContext = createContext<HTMLElement | null>(null);\nexport function ChatSurface({ children, className, ...props }: ComponentProps<\"div\">) {\n const root = useRef<HTMLDivElement>(null);\n const [dialogContainer, setDialogContainer] = useState<HTMLDivElement | null>(null);\n const [container, setContainer] = useState<HTMLDivElement | null>(null);\n const [active, setActive] = useState(0);\n const acquire = useRef(() => { setActive((n) => n + 1); return () => setActive((n) => Math.max(0, n - 1)); }).current;\n useLayoutEffect(() => {\n const node = document.createElement(\"div\");\n node.className = \"nexface-ui nexface-chat-portals\";\n node.dataset.nexfaceIgnore = \"\";\n document.body.append(node);\n setContainer(node);\n return () => { node.remove(); };\n }, []);\n useLayoutEffect(() => {\n const element = root.current;\n if (!element || !container)\n return;\n const sync = () => {\n const style = getComputedStyle(element);\n for (const token of tokens)\n container.style.setProperty(`--nxf-${token}`, style.getPropertyValue(`--nxf-${token}`));\n container.style.font = style.font;\n container.style.direction = style.direction;\n container.style.colorScheme = style.colorScheme;\n container.classList.toggle(\"nexface-dark\", Boolean(element.closest(\".dark, .nexface-dark\")));\n };\n sync();\n if (!active)\n return;\n // Observe only theme attributes while a portal is mounted, never page input.\n const observer = new MutationObserver(sync);\n for (let node: HTMLElement | null = element; node; node = node.parentElement)\n observer.observe(node, { attributes: true, attributeFilter: [\"class\", \"style\", \"dir\", \"data-theme\"] });\n const media = window.matchMedia?.(\"(prefers-color-scheme: dark)\");\n media?.addEventListener(\"change\", sync);\n return () => { observer.disconnect(); media?.removeEventListener(\"change\", sync); };\n }, [container, active, props.style, className]);\n return <PortalContext.Provider value={{ container, acquire }}><DialogContainerContext.Provider value={dialogContainer}><div ref={root} className={`nexface-ui ${className ?? \"\"}`} {...props}>{children}<div ref={setDialogContainer} className=\"nexface-chat__dialogs\" /></div></DialogContainerContext.Provider></PortalContext.Provider>;\n}\nexport function useDialogContainer() {\n return useContext(DialogContainerContext);\n}\nexport function usePortalContainer() {\n return useContext(PortalContext).container;\n}\nexport function PortalThemeSync() {\n const { acquire } = useContext(PortalContext);\n useLayoutEffect(acquire, [acquire]);\n return null;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { ComponentProps, ReactNode } from "react";
2
+ import { ThreadListPrimitive } from "@assistant-ui/react";
3
+ import { Button } from "./button.js";
4
+ export declare function ThreadListRoot({ className, ...props }: ComponentProps<typeof ThreadListPrimitive.Root>): import("react").JSX.Element;
5
+ export declare function ThreadListNew(props: ComponentProps<typeof Button>): import("react").JSX.Element;
6
+ export declare function ThreadListItem({ disabled, menu }: {
7
+ disabled: boolean;
8
+ menu: ReactNode;
9
+ }): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ThreadListItemPrimitive, ThreadListPrimitive, useAuiState } from "@assistant-ui/react";
4
+ import { Loader2Icon, MoreHorizontalIcon, PlusIcon } from "lucide-react";
5
+ import { Button } from "./button.js";
6
+ import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent } from "./dropdown-menu.js";
7
+ import { cn } from "./utils.js";
8
+ export function ThreadListRoot({ className, ...props }) {
9
+ return _jsx(ThreadListPrimitive.Root, { "data-slot": "aui_thread-list-root", className: cn("flex flex-col gap-0.5", className), ...props });
10
+ }
11
+ export function ThreadListNew(props) {
12
+ return _jsx(ThreadListPrimitive.New, { asChild: true, children: _jsxs(Button, { variant: "ghost", "data-slot": "aui_thread-list-new", className: cn("hover:bg-muted data-active:bg-muted h-8 justify-start gap-2 rounded-md px-2.5 text-sm font-normal"), ...props, children: [_jsx(PlusIcon, { className: cn("size-4 shrink-0") }), "\u65B0\u5EFA\u4F1A\u8BDD"] }) });
13
+ }
14
+ export function ThreadListItem({ disabled, menu }) {
15
+ const isRunning = useAuiState((s) => s.threadListItem.isRunning);
16
+ const title = useAuiState((s) => s.threadListItem.title);
17
+ return _jsxs(ThreadListItemPrimitive.Root, { "data-slot": "aui_thread-list-item", className: cn("group hover:bg-muted focus-visible:bg-muted data-active:bg-muted has-focus-visible:bg-muted has-data-[state=open]:bg-muted relative flex h-8 items-center rounded-md transition-colors focus-visible:outline-none"), children: [_jsxs(ThreadListItemPrimitive.Trigger, { disabled: disabled, "data-slot": "aui_thread-list-item-trigger", className: cn("focus-visible:ring-ring/50 flex h-full min-w-0 flex-1 items-center rounded-md px-2.5 text-start text-sm outline-none pe-9 focus-visible:ring-1 disabled:opacity-50"), children: [isRunning && _jsx(Loader2Icon, { "aria-hidden": true, className: cn("text-muted-foreground me-1.5 size-3.5 shrink-0 animate-spin") }), _jsx("span", { className: cn("min-w-0 flex-1 truncate"), children: _jsx(ThreadListItemPrimitive.Title, { fallback: "\u65B0\u4F1A\u8BDD" }) })] }), _jsxs(DropdownMenu, { modal: false, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": `管理 ${title}`, className: cn("data-[state=open]:bg-accent absolute end-1.5 top-1/2 size-6 -translate-y-1/2 p-0"), children: _jsx(MoreHorizontalIcon, { className: cn("size-3.5") }) }) }), _jsx(DropdownMenuContent, { side: "right", align: "start", sideOffset: 6, children: menu })] })] });
18
+ }
19
+ //# sourceMappingURL=thread-list.aui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thread-list.aui.js","sourceRoot":"","sources":["../../src/ui/thread-list.aui.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,MAAM,UAAU,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAmD;IACrG,OAAO,KAAC,mBAAmB,CAAC,IAAI,iBAAW,sBAAsB,EAAC,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC;AACpI,CAAC;AACD,MAAM,UAAU,aAAa,CAAC,KAAoC;IAChE,OAAO,KAAC,mBAAmB,CAAC,GAAG,IAAC,OAAO,kBAAC,MAAC,MAAM,IAAC,OAAO,EAAC,OAAO,eAAW,qBAAqB,EAAC,SAAS,EAAE,EAAE,C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AAI,GAAuB,IAC7E,IACe,CAAC;AACjC,CAAC","sourcesContent":["\"use client\";\n// Official ThreadList composition; Nexface owns the management actions and confirmations.\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { ThreadListItemPrimitive, ThreadListPrimitive, useAuiState } from \"@assistant-ui/react\";\nimport { Loader2Icon, MoreHorizontalIcon, PlusIcon } from \"lucide-react\";\nimport { Button } from \"./button.js\";\nimport { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent } from \"./dropdown-menu.js\";\nimport { cn } from \"./utils.js\";\nexport function ThreadListRoot({ className, ...props }: ComponentProps<typeof ThreadListPrimitive.Root>) {\n return <ThreadListPrimitive.Root data-slot=\"aui_thread-list-root\" className={cn(\"flex flex-col gap-0.5\", className)} {...props}/>;\n}\nexport function ThreadListNew(props: ComponentProps<typeof Button>) {\n return <ThreadListPrimitive.New asChild><Button variant=\"ghost\" data-slot=\"aui_thread-list-new\" className={cn(\"hover:bg-muted data-active:bg-muted h-8 justify-start gap-2 rounded-md px-2.5 text-sm font-normal\")} {...props}><PlusIcon className={cn(\"size-4 shrink-0\")}/>新建会话</Button></ThreadListPrimitive.New>;\n}\nexport function ThreadListItem({ disabled, menu }: {\n disabled: boolean;\n menu: ReactNode;\n}) {\n const isRunning = useAuiState((s) => s.threadListItem.isRunning);\n const title = useAuiState((s) => s.threadListItem.title);\n return <ThreadListItemPrimitive.Root data-slot=\"aui_thread-list-item\" className={cn(\"group hover:bg-muted focus-visible:bg-muted data-active:bg-muted has-focus-visible:bg-muted has-data-[state=open]:bg-muted relative flex h-8 items-center rounded-md transition-colors focus-visible:outline-none\")}>\n <ThreadListItemPrimitive.Trigger disabled={disabled} data-slot=\"aui_thread-list-item-trigger\" className={cn(\"focus-visible:ring-ring/50 flex h-full min-w-0 flex-1 items-center rounded-md px-2.5 text-start text-sm outline-none pe-9 focus-visible:ring-1 disabled:opacity-50\")}>\n {isRunning && <Loader2Icon aria-hidden className={cn(\"text-muted-foreground me-1.5 size-3.5 shrink-0 animate-spin\")}/>}\n <span className={cn(\"min-w-0 flex-1 truncate\")}><ThreadListItemPrimitive.Title fallback=\"新会话\"/></span>\n </ThreadListItemPrimitive.Trigger>\n <DropdownMenu modal={false}><DropdownMenuTrigger asChild><Button variant=\"ghost\" size=\"icon\" aria-label={`管理 ${title}`} className={cn(\"data-[state=open]:bg-accent absolute end-1.5 top-1/2 size-6 -translate-y-1/2 p-0\")}><MoreHorizontalIcon className={cn(\"size-3.5\")}/></Button></DropdownMenuTrigger>\n <DropdownMenuContent side=\"right\" align=\"start\" sideOffset={6}>{menu}</DropdownMenuContent>\n </DropdownMenu>\n </ThreadListItemPrimitive.Root>;\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import type { ComponentProps, ReactNode } from "react";
2
+ import { ComposerPrimitive } from "@assistant-ui/react";
3
+ export declare function Thread({ children, welcome, composer, footer, empty }: {
4
+ children: ReactNode;
5
+ welcome: ReactNode;
6
+ composer: ReactNode;
7
+ footer: ReactNode;
8
+ empty: boolean;
9
+ }): import("react").JSX.Element;
10
+ export declare function ThreadWelcome({ title, description, suggestions }: {
11
+ title: string;
12
+ description?: string | undefined;
13
+ suggestions: ReactNode;
14
+ }): import("react").JSX.Element;
15
+ export declare function ThreadSuggestion({ children, className, ...props }: ComponentProps<"button">): import("react").JSX.Element;
16
+ export declare function UserMessage({ children, attachments, actions }: {
17
+ children: ReactNode;
18
+ attachments: ReactNode;
19
+ actions: ReactNode;
20
+ }): import("react").JSX.Element;
21
+ export declare function AssistantMessage({ children }: {
22
+ children: ReactNode;
23
+ }): import("react").JSX.Element;
24
+ export declare function Composer({ children, input, actions, ...props }: ComponentProps<typeof ComposerPrimitive.Root> & {
25
+ input: ReactNode;
26
+ actions: ReactNode;
27
+ }): import("react").JSX.Element;
28
+ export declare const composerInputClass = "aui-composer-input caret-primary placeholder:text-muted-foreground/60 max-h-48 min-h-10 w-full resize-none bg-transparent px-2.5 py-1 text-base leading-6 outline-none";
29
+ export declare const editComposerClass = "aui-edit-composer-root border-foreground/10 focus-within:border-foreground/25 ms-auto flex w-full max-w-[85%] cursor-text flex-col rounded-(--nxf-composer-radius) border bg-(--nxf-composer-bg) transition-[border-color]";
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ComposerPrimitive, ThreadPrimitive } from "@assistant-ui/react";
4
+ import { cn } from "./utils.js";
5
+ import { Button } from "./button.js";
6
+ export function Thread({ children, welcome, composer, footer, empty }) {
7
+ return _jsx(ThreadPrimitive.Root, { className: cn("aui-root aui-thread-root bg-background @container flex h-full min-h-0 min-w-0 flex-1 flex-col"), style: { "--nxf-thread-max-width": "44rem", "--nxf-composer-bg": "color-mix(in oklab, var(--nxf-muted) 30%, transparent)", "--nxf-composer-radius": "1rem", "--nxf-composer-padding": "8px" }, children: _jsx(ThreadPrimitive.Viewport, { "data-slot": "aui_thread-viewport", role: "log", "aria-live": "polite", className: cn("relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth"), children: _jsxs("div", { className: cn("mx-auto flex w-full max-w-(--nxf-thread-max-width) flex-1 flex-col px-4 pt-4", empty && "justify-center"), children: [empty && welcome, _jsx("div", { "data-slot": "aui_message-group", className: cn("mb-14 flex flex-col gap-y-6 empty:hidden"), children: children }), _jsxs(ThreadPrimitive.ViewportFooter, { className: cn("aui-thread-viewport-footer bg-background flex flex-col gap-4 overflow-visible pb-4 md:pb-6", !empty && "sticky bottom-0 mt-auto rounded-t-(--nxf-composer-radius)"), children: [footer, composer] })] }) }) });
8
+ }
9
+ export function ThreadWelcome({ title, description, suggestions }) {
10
+ return _jsxs("div", { className: cn("aui-thread-welcome-root mb-6 flex flex-col px-2"), children: [_jsx("p", { className: cn("aui-thread-welcome-message-inner text-2xl font-medium tracking-tight"), children: title }), description && _jsx("p", { className: cn("text-muted-foreground mt-2 text-sm"), children: description }), _jsx("div", { className: cn("aui-thread-welcome-suggestions mt-4 flex w-full flex-wrap gap-2"), children: suggestions })] });
11
+ }
12
+ export function ThreadSuggestion({ children, className, ...props }) {
13
+ return _jsx(Button, { type: "button", variant: "outline", size: "sm", className: cn("aui-thread-welcome-suggestion h-auto min-h-7 max-w-full shrink rounded-full border-border/50 px-2.5 py-1 text-start text-xs leading-4 font-normal whitespace-normal shadow-none dark:border-border/50", className), ...props, children: _jsx("span", { className: cn("min-w-0 wrap-break-word"), children: children }) });
14
+ }
15
+ export function UserMessage({ children, attachments, actions }) {
16
+ return _jsxs("div", { "data-slot": "aui_user-message-root", "data-role": "user", className: cn("grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] content-start gap-y-2 px-2 [&:where(>*)]:col-start-2"), children: [attachments, _jsxs("div", { className: cn("aui-user-message-content-wrapper relative col-start-2 min-w-0"), children: [_jsx("div", { className: cn("aui-user-message-content peer bg-muted text-foreground rounded-(--nxf-composer-radius) px-4 py-2 wrap-break-word empty:hidden"), children: children }), _jsx("div", { className: cn("aui-user-action-bar-wrapper absolute start-0 top-1/2 -translate-x-full -translate-y-1/2 pe-2 peer-empty:hidden rtl:translate-x-full"), children: actions })] })] });
17
+ }
18
+ export function AssistantMessage({ children }) {
19
+ return _jsx("div", { "data-slot": "aui_assistant-message-root", "data-role": "assistant", children: _jsx("div", { "data-slot": "aui_assistant-message-content", className: cn("text-foreground px-2 leading-relaxed wrap-break-word"), children: children }) });
20
+ }
21
+ export function Composer({ children, input, actions, ...props }) {
22
+ return _jsx(ComposerPrimitive.Root, { className: cn("aui-composer-root relative flex w-full flex-col"), ...props, children: _jsxs("div", { "data-slot": "aui_composer-shell", className: cn("border-foreground/10 focus-within:border-foreground/25 flex w-full cursor-text flex-col gap-2 rounded-(--nxf-composer-radius) border bg-(--nxf-composer-bg) p-(--nxf-composer-padding) transition-[border-color]"), children: [children, input, _jsx("div", { className: cn("aui-composer-action-wrapper relative flex items-center justify-between"), children: actions })] }) });
23
+ }
24
+ export const composerInputClass = "aui-composer-input caret-primary placeholder:text-muted-foreground/60 max-h-48 min-h-10 w-full resize-none bg-transparent px-2.5 py-1 text-base leading-6 outline-none";
25
+ export const editComposerClass = "aui-edit-composer-root border-foreground/10 focus-within:border-foreground/25 ms-auto flex w-full max-w-[85%] cursor-text flex-col rounded-(--nxf-composer-radius) border bg-(--nxf-composer-bg) transition-[border-color]";
26
+ //# sourceMappingURL=thread.aui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thread.aui.js","sourceRoot":"","sources":["../../src/ui/thread.aui.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,MAAM,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAMlE;IACC,OAAO,KAAC,eAAe,CAAC,IAAI,IAAC,SAAS,EAAE,EAAE,CAAC,+FAA+F,CAAC,EAAE,KAAK,EAAE,EAAE,wBAAwB,EAAE,OAAO,EAAE,mBAAmB,EAAE,wDAAwD,EAAE,uBAAuB,EAAE,MAAM,EAAE,wBAAwB,EAAE,KAAK,EAAmB,YAC3V,KAAC,eAAe,CAAC,QAAQ,iBAAW,qBAAqB,EAAC,IAAI,EAAC,KAAK,eAAW,QAAQ,EAAC,SAAS,EAAE,EAAE,CAAC,+EAA+E,CAAC,YACrL,eAAK,SAAS,EAAE,EAAE,CAAC,8EAA8E,EAAE,KAAK,IAAI,gBAAgB,CAAC,aAC3H,KAAK,IAAI,OAAO,EACjB,2BAAe,mBAAmB,EAAC,SAAS,EAAE,EAAE,CAAC,0CAA0C,CAAC,YAAG,QAAQ,GAAO,EAC9G,MAAC,eAAe,CAAC,cAAc,IAAC,SAAS,EAAE,EAAE,CAAC,4FAA4F,EAAE,CAAC,KAAK,IAAI,2DAA2D,CAAC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AAe,4BAA4B,eAAW,WAAW,YACxE,2BAAe,+BAA+B,EAAC,SAAS,EAAE,EAAE,CAAC,sDAAsD,CAAC,YAAG,QAAQ,GAAO,GACjI,CAAC;AACR,CAAC;AACD,MAAM,UAAU,QAAQ,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,EAG5D;IACC,OAAO,KAAC,iBAAiB,CAAC,IAAI,IAAC,SAAS,EAAE,EAAE,CAAC,iDAAiD,CAAC,KAAM,KAAK,YAC1G,4BAAe,oBAAoB,EAAC,SAAS,EAAE,EAAE,CAAC,kNAAkN,CAAC,aACnQ,QAAQ,EAAE,KAAK,EAAC,cAAK,SAAS,EAAE,EAAE,CAAC,wEAAwE,CAAC,YAAG,OAAO,GAAO,IACzH,GACkB,CAAC;AAC3B,CAAC;AACD,MAAM,CAAC,MAAM,kBAAkB,GAAG,wKAAwK,CAAC;AAC3M,MAAM,CAAC,MAAM,iBAAiB,GAAG,4NAA4N,CAAC","sourcesContent":["\"use client\";\n// Adapted from the pinned official Thread: Nexface supplies business actions and slots.\nimport type { ComponentProps, CSSProperties, ReactNode } from \"react\";\nimport { ComposerPrimitive, ThreadPrimitive } from \"@assistant-ui/react\";\nimport { cn } from \"./utils.js\";\nimport { Button } from \"./button.js\";\nexport function Thread({ children, welcome, composer, footer, empty }: {\n children: ReactNode;\n welcome: ReactNode;\n composer: ReactNode;\n footer: ReactNode;\n empty: boolean;\n}) {\n return <ThreadPrimitive.Root className={cn(\"aui-root aui-thread-root bg-background @container flex h-full min-h-0 min-w-0 flex-1 flex-col\")} style={{ \"--nxf-thread-max-width\": \"44rem\", \"--nxf-composer-bg\": \"color-mix(in oklab, var(--nxf-muted) 30%, transparent)\", \"--nxf-composer-radius\": \"1rem\", \"--nxf-composer-padding\": \"8px\" } as CSSProperties}>\n <ThreadPrimitive.Viewport data-slot=\"aui_thread-viewport\" role=\"log\" aria-live=\"polite\" className={cn(\"relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth\")}>\n <div className={cn(\"mx-auto flex w-full max-w-(--nxf-thread-max-width) flex-1 flex-col px-4 pt-4\", empty && \"justify-center\")}>\n {empty && welcome}\n <div data-slot=\"aui_message-group\" className={cn(\"mb-14 flex flex-col gap-y-6 empty:hidden\")}>{children}</div>\n <ThreadPrimitive.ViewportFooter className={cn(\"aui-thread-viewport-footer bg-background flex flex-col gap-4 overflow-visible pb-4 md:pb-6\", !empty && \"sticky bottom-0 mt-auto rounded-t-(--nxf-composer-radius)\")}>\n {footer}{composer}\n </ThreadPrimitive.ViewportFooter>\n </div>\n </ThreadPrimitive.Viewport>\n </ThreadPrimitive.Root>;\n}\nexport function ThreadWelcome({ title, description, suggestions }: {\n title: string;\n description?: string | undefined;\n suggestions: ReactNode;\n}) {\n return <div className={cn(\"aui-thread-welcome-root mb-6 flex flex-col px-2\")}>\n <p className={cn(\"aui-thread-welcome-message-inner text-2xl font-medium tracking-tight\")}>{title}</p>\n {description && <p className={cn(\"text-muted-foreground mt-2 text-sm\")}>{description}</p>}\n <div className={cn(\"aui-thread-welcome-suggestions mt-4 flex w-full flex-wrap gap-2\")}>{suggestions}</div>\n </div>;\n}\nexport function ThreadSuggestion({ children, className, ...props }: ComponentProps<\"button\">) {\n return <Button type=\"button\" variant=\"outline\" size=\"sm\" className={cn(\"aui-thread-welcome-suggestion h-auto min-h-7 max-w-full shrink rounded-full border-border/50 px-2.5 py-1 text-start text-xs leading-4 font-normal whitespace-normal shadow-none dark:border-border/50\", className)} {...props}>\n <span className={cn(\"min-w-0 wrap-break-word\")}>{children}</span>\n </Button>;\n}\nexport function UserMessage({ children, attachments, actions }: {\n children: ReactNode;\n attachments: ReactNode;\n actions: ReactNode;\n}) {\n return <div data-slot=\"aui_user-message-root\" data-role=\"user\" className={cn(\"grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] content-start gap-y-2 px-2 [&:where(>*)]:col-start-2\")}>\n {attachments}\n <div className={cn(\"aui-user-message-content-wrapper relative col-start-2 min-w-0\")}>\n <div className={cn(\"aui-user-message-content peer bg-muted text-foreground rounded-(--nxf-composer-radius) px-4 py-2 wrap-break-word empty:hidden\")}>{children}</div>\n <div className={cn(\"aui-user-action-bar-wrapper absolute start-0 top-1/2 -translate-x-full -translate-y-1/2 pe-2 peer-empty:hidden rtl:translate-x-full\")}>{actions}</div>\n </div>\n </div>;\n}\nexport function AssistantMessage({ children }: {\n children: ReactNode;\n}) {\n return <div data-slot=\"aui_assistant-message-root\" data-role=\"assistant\">\n <div data-slot=\"aui_assistant-message-content\" className={cn(\"text-foreground px-2 leading-relaxed wrap-break-word\")}>{children}</div>\n </div>;\n}\nexport function Composer({ children, input, actions, ...props }: ComponentProps<typeof ComposerPrimitive.Root> & {\n input: ReactNode;\n actions: ReactNode;\n}) {\n return <ComposerPrimitive.Root className={cn(\"aui-composer-root relative flex w-full flex-col\")} {...props}>\n <div data-slot=\"aui_composer-shell\" className={cn(\"border-foreground/10 focus-within:border-foreground/25 flex w-full cursor-text flex-col gap-2 rounded-(--nxf-composer-radius) border bg-(--nxf-composer-bg) p-(--nxf-composer-padding) transition-[border-color]\")}>\n {children}{input}<div className={cn(\"aui-composer-action-wrapper relative flex items-center justify-between\")}>{actions}</div>\n </div>\n </ComposerPrimitive.Root>;\n}\nexport const composerInputClass = \"aui-composer-input caret-primary placeholder:text-muted-foreground/60 max-h-48 min-h-10 w-full resize-none bg-transparent px-2.5 py-1 text-base leading-6 outline-none\";\nexport const editComposerClass = \"aui-edit-composer-root border-foreground/10 focus-within:border-foreground/25 ms-auto flex w-full max-w-[85%] cursor-text flex-col rounded-(--nxf-composer-radius) border bg-(--nxf-composer-bg) transition-[border-color]\";\n"]}
@@ -0,0 +1,7 @@
1
+ import { type ComponentPropsWithRef } from "react";
2
+ import { Button } from "./button.js";
3
+ export type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {
4
+ tooltip: string;
5
+ side?: "top" | "bottom" | "left" | "right";
6
+ };
7
+ export declare const TooltipIconButton: import("react").ForwardRefExoticComponent<Omit<TooltipIconButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { forwardRef } from "react";
4
+ import { Slot } from "radix-ui";
5
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "./tooltip.js";
6
+ import { Button } from "./button.js";
7
+ import { cn } from "./utils.js";
8
+ export const TooltipIconButton = forwardRef(({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
9
+ return (_jsx(TooltipProvider, { delayDuration: 0, children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "icon", ...rest, className: cn("aui-button-icon size-6 p-1 active:scale-90", className), ref: ref, children: [_jsx(Slot.Slottable, { children: children }), _jsx("span", { className: cn("aui-sr-only sr-only"), children: tooltip })] }) }), _jsx(TooltipContent, { side: side, children: tooltip })] }) }));
10
+ });
11
+ TooltipIconButton.displayName = "TooltipIconButton";
12
+ //# sourceMappingURL=tooltip-icon-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip-icon-button.js","sourceRoot":"","sources":["../../src/ui/tooltip-icon-button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAA8B,UAAU,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,GAAG,MAAM,cAAc,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAKhC,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAA4C,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;IACzJ,OAAO,CAAC,KAAC,eAAe,IAAC,aAAa,EAAE,CAAC,YACxC,MAAC,OAAO,eACP,KAAC,cAAc,IAAC,OAAO,kBACtB,MAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,4CAA4C,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,aAC7H,KAAC,IAAI,CAAC,SAAS,cAAE,QAAQ,GAAkB,EAC3C,eAAM,SAAS,EAAE,EAAE,CAAC,qBAAqB,CAAC,YAAG,OAAO,GAAQ,IACpD,GACO,EACjB,KAAC,cAAc,IAAC,IAAI,EAAE,IAAI,YAAG,OAAO,GAAkB,IAC7C,GACO,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AACH,iBAAiB,CAAC,WAAW,GAAG,mBAAmB,CAAC","sourcesContent":["\"use client\";\nimport { type ComponentPropsWithRef, forwardRef } from \"react\";\nimport { Slot } from \"radix-ui\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from \"./tooltip.js\";\nimport { Button } from \"./button.js\";\nimport { cn } from \"./utils.js\";\nexport type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {\n tooltip: string;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n};\nexport const TooltipIconButton = forwardRef<HTMLButtonElement, TooltipIconButtonProps>(({ children, tooltip, side = \"bottom\", className, ...rest }, ref) => {\n return (<TooltipProvider delayDuration={0}>\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\" {...rest} className={cn(\"aui-button-icon size-6 p-1 active:scale-90\", className)} ref={ref}>\n <Slot.Slottable>{children}</Slot.Slottable>\n <span className={cn(\"aui-sr-only sr-only\")}>{tooltip}</span>\n </Button>\n </TooltipTrigger>\n <TooltipContent side={side}>{tooltip}</TooltipContent>\n </Tooltip>\n </TooltipProvider>);\n});\nTooltipIconButton.displayName = \"TooltipIconButton\";\n"]}
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import { Tooltip as TooltipPrimitive } from "radix-ui";
3
+ declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): React.JSX.Element;
4
+ declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): React.JSX.Element;
5
+ declare const TooltipTrigger: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
6
+ declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): React.JSX.Element | null;
7
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { usePortalContainer, PortalThemeSync } from "./surface.js";
4
+ import * as React from "react";
5
+ import { cn } from "./utils.js";
6
+ import { Tooltip as TooltipPrimitive } from "radix-ui";
7
+ function TooltipProvider({ delayDuration = 0, ...props }) {
8
+ return (_jsx(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delayDuration: delayDuration, ...props }));
9
+ }
10
+ function Tooltip({ ...props }) {
11
+ return _jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
12
+ }
13
+ const TooltipTrigger = React.forwardRef(function TooltipTrigger({ ...props }, ref) {
14
+ return _jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ref: ref, ...props });
15
+ });
16
+ function TooltipContent({ className, sideOffset = 0, children, ...props }) {
17
+ const container = usePortalContainer();
18
+ if (!container)
19
+ return null;
20
+ return (_jsx(TooltipPrimitive.Portal, { container: container, children: _jsxs(TooltipPrimitive.Content, { "data-slot": "tooltip-content", sideOffset: sideOffset, className: cn("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", className), ...props, children: [_jsx(PortalThemeSync, {}), children, _jsx(TooltipPrimitive.Arrow, { className: cn("z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground") })] }) }));
21
+ }
22
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
23
+ //# sourceMappingURL=tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../src/ui/tooltip.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACvD,SAAS,eAAe,CAAC,EAAE,aAAa,GAAG,CAAC,EAAE,GAAG,KAAK,EAA0D;IAC9G,OAAO,CAAC,KAAC,gBAAgB,CAAC,QAAQ,iBAAW,kBAAkB,EAAC,aAAa,EAAE,aAAa,KAAM,KAAK,GAAG,CAAC,CAAC;AAC9G,CAAC;AACD,SAAS,OAAO,CAAC,EAAE,GAAG,KAAK,EAAsD;IAC/E,OAAO,KAAC,gBAAgB,CAAC,IAAI,iBAAW,SAAS,KAAK,KAAK,GAAG,CAAC;AACjE,CAAC;AACD,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAAqF,SAAS,cAAc,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IACnK,OAAO,KAAC,gBAAgB,CAAC,OAAO,iBAAW,iBAAiB,EAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAG,CAAC;AACtF,CAAC,CAAC,CAAC;AACH,SAAS,cAAc,CAAC,EAAE,SAAS,EAAE,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAyD;IAC9H,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;IACvC,IAAI,CAAC,SAAS;QACZ,OAAO,IAAI,CAAC;IACd,OAAO,CAAC,KAAC,gBAAgB,CAAC,MAAM,IAAC,SAAS,EAAE,SAAS,YACpD,MAAC,gBAAgB,CAAC,OAAO,iBAAW,iBAAiB,EAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC,maAAma,EAAE,SAAS,CAAC,KAAM,KAAK,aACrhB,KAAC,eAAe,KAAG,EAAC,QAAQ,EAC5B,KAAC,gBAAgB,CAAC,KAAK,IAAC,SAAS,EAAE,EAAE,CAAC,oGAAoG,CAAC,GAAG,IACpH,GACF,CAAC,CAAC;AAC9B,CAAC;AACD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC","sourcesContent":["\"use client\";\nimport { usePortalContainer, PortalThemeSync } from \"./surface.js\";\nimport * as React from \"react\";\nimport { cn } from \"./utils.js\";\nimport { Tooltip as TooltipPrimitive } from \"radix-ui\";\nfunction TooltipProvider({ delayDuration = 0, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {\n return (<TooltipPrimitive.Provider data-slot=\"tooltip-provider\" delayDuration={delayDuration} {...props}/>);\n}\nfunction Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>) {\n return <TooltipPrimitive.Root data-slot=\"tooltip\" {...props}/>;\n}\nconst TooltipTrigger = React.forwardRef<HTMLButtonElement, React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>>(function TooltipTrigger({ ...props }, ref) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" ref={ref} {...props}/>;\n});\nfunction TooltipContent({ className, sideOffset = 0, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>) {\n const container = usePortalContainer();\n if (!container)\n return null;\n return (<TooltipPrimitive.Portal container={container}>\n <TooltipPrimitive.Content data-slot=\"tooltip-content\" sideOffset={sideOffset} className={cn(\"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95\", className)} {...props}>\n <PortalThemeSync />{children}\n <TooltipPrimitive.Arrow className={cn(\"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground\")}/>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>);\n}\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n"]}
@@ -0,0 +1 @@
1
+ export declare const useAttachmentSrc: () => string | undefined;
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { useEffect, useState } from "react";
3
+ import { useAuiState } from "@assistant-ui/react";
4
+ const useFileSrc = (file) => {
5
+ const [entry, setEntry] = useState(undefined);
6
+ useEffect(() => {
7
+ // The object URL is a browser resource whose lifetime has to straddle
8
+ // commit, so allocation, revocation, and clearing the entry that names a
9
+ // revoked URL all belong to the effect.
10
+ if (!file) {
11
+ // eslint-disable-next-line react-hooks/set-state-in-effect
12
+ setEntry(undefined);
13
+ return;
14
+ }
15
+ const objectUrl = URL.createObjectURL(file);
16
+ setEntry({ file, url: objectUrl });
17
+ return () => {
18
+ URL.revokeObjectURL(objectUrl);
19
+ };
20
+ }, [file]);
21
+ return entry !== undefined && entry.file === file ? entry.url : undefined;
22
+ };
23
+ export const useAttachmentSrc = () => {
24
+ const file = useAuiState((s) => s.attachment.type === "image" ? s.attachment.file : undefined);
25
+ const src = useAuiState((s) => s.attachment.content?.find((part) => part.type === "image")?.image);
26
+ return useFileSrc(file) ?? src;
27
+ };
28
+ //# sourceMappingURL=use-attachment-src.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-attachment-src.js","sourceRoot":"","sources":["../../src/ui/use-attachment-src.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,MAAM,UAAU,GAAG,CAAC,IAAsB,EAAE,EAAE;IAC5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAGnB,SAAS,CAAC,CAAC;IAC1B,SAAS,CAAC,GAAG,EAAE;QACb,sEAAsE;QACtE,yEAAyE;QACzE,wCAAwC;QACxC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,2DAA2D;YAC3D,QAAQ,CAAC,SAAS,CAAC,CAAC;YACpB,OAAO;QACT,CAAC;QACD,MAAM,SAAS,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAC5C,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QACnC,OAAO,GAAG,EAAE;YACV,GAAG,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACX,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5E,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC/F,MAAM,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;IACnG,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;AACjC,CAAC,CAAC","sourcesContent":["\"use client\";\nimport { useEffect, useState } from \"react\";\nimport { useAuiState } from \"@assistant-ui/react\";\nconst useFileSrc = (file: File | undefined) => {\n const [entry, setEntry] = useState<{\n file: File;\n url: string;\n } | undefined>(undefined);\n useEffect(() => {\n // The object URL is a browser resource whose lifetime has to straddle\n // commit, so allocation, revocation, and clearing the entry that names a\n // revoked URL all belong to the effect.\n if (!file) {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setEntry(undefined);\n return;\n }\n const objectUrl = URL.createObjectURL(file);\n setEntry({ file, url: objectUrl });\n return () => {\n URL.revokeObjectURL(objectUrl);\n };\n }, [file]);\n return entry !== undefined && entry.file === file ? entry.url : undefined;\n};\nexport const useAttachmentSrc = () => {\n const file = useAuiState((s) => s.attachment.type === \"image\" ? s.attachment.file : undefined);\n const src = useAuiState((s) => s.attachment.content?.find((part) => part.type === \"image\")?.image);\n return useFileSrc(file) ?? src;\n};\n"]}
@@ -0,0 +1,7 @@
1
+ export type UseCopyToClipboardOptions = {
2
+ copiedDuration?: number;
3
+ };
4
+ export declare const useCopyToClipboard: ({ copiedDuration, }?: UseCopyToClipboardOptions) => {
5
+ isCopied: boolean;
6
+ copyToClipboard: (value: string) => void;
7
+ };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { useState } from "react";
3
+ export const useCopyToClipboard = ({ copiedDuration = 3000, } = {}) => {
4
+ const [isCopied, setIsCopied] = useState(false);
5
+ const copyToClipboard = (value) => {
6
+ if (!value || typeof navigator === "undefined" || !navigator.clipboard) {
7
+ return;
8
+ }
9
+ navigator.clipboard.writeText(value).then(() => {
10
+ setIsCopied(true);
11
+ setTimeout(() => setIsCopied(false), copiedDuration);
12
+ }, () => { });
13
+ };
14
+ return { isCopied, copyToClipboard };
15
+ };
16
+ //# sourceMappingURL=use-copy-to-clipboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-copy-to-clipboard.js","sourceRoot":"","sources":["../../src/ui/use-copy-to-clipboard.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIjC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAE,cAAc,GAAG,IAAI,MAAiC,EAAE,EAAE,EAAE;IAC/F,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACzD,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,EAAE;QACxC,IAAI,CAAC,KAAK,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;YACvE,OAAO;QACT,CAAC;QACD,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YAC7C,WAAW,CAAC,IAAI,CAAC,CAAC;YAClB,UAAU,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC,CAAC;QACvD,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAChB,CAAC,CAAC;IACF,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;AACvC,CAAC,CAAC","sourcesContent":["\"use client\";\nimport { useState } from \"react\";\nexport type UseCopyToClipboardOptions = {\n copiedDuration?: number;\n};\nexport const useCopyToClipboard = ({ copiedDuration = 3000, }: UseCopyToClipboardOptions = {}) => {\n const [isCopied, setIsCopied] = useState<boolean>(false);\n const copyToClipboard = (value: string) => {\n if (!value || typeof navigator === \"undefined\" || !navigator.clipboard) {\n return;\n }\n navigator.clipboard.writeText(value).then(() => {\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), copiedDuration);\n }, () => { });\n };\n return { isCopied, copyToClipboard };\n};\n"]}
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,8 @@
1
+ import { clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+ // Keep upstream recipes readable; namespace classes at the component boundary.
4
+ export function cn(...inputs) {
5
+ const raw = clsx(inputs).split(/\s+/).map((token) => token.replace(/^nxf-/, "")).join(" ");
6
+ return twMerge(raw).split(/\s+/).filter(Boolean).map((token) => /^(aui-|nexface-)/.test(token) ? token : `nxf-${token}`).join(" ");
7
+ }
8
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/ui/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,+EAA+E;AAC/E,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACxC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3F,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrI,CAAC","sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n// Keep upstream recipes readable; namespace classes at the component boundary.\nexport function cn(...inputs: ClassValue[]) {\n const raw = clsx(inputs).split(/\\s+/).map((token) => token.replace(/^nxf-/, \"\")).join(\" \");\n return twMerge(raw).split(/\\s+/).filter(Boolean).map((token) => /^(aui-|nexface-)/.test(token) ? token : `nxf-${token}`).join(\" \");\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexface/chat",
3
- "version": "0.1.1-alpha.8",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22.19.0"
@@ -14,14 +14,20 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@ag-ui/core": "0.0.59",
17
- "@nexface/agent": "0.1.1-alpha.8",
17
+ "@assistant-ui/react": "0.15.21",
18
+ "@assistant-ui/react-markdown": "0.14.16",
19
+ "@nexface/agent": "0.1.1",
18
20
  "@phosphor-icons/react": "^2.1.10",
21
+ "class-variance-authority": "0.7.1",
22
+ "clsx": "2.1.1",
19
23
  "fast-json-patch": "3.1.1",
20
- "react-markdown": "10.1.0",
21
- "remark-gfm": "4.0.1"
24
+ "lucide-react": "0.506.0",
25
+ "radix-ui": "1.6.7",
26
+ "remark-gfm": "4.0.1",
27
+ "tailwind-merge": "3.6.0"
22
28
  },
23
29
  "peerDependencies": {
24
- "@nexface/tools": "0.1.1-alpha.8",
30
+ "@nexface/tools": "0.1.1",
25
31
  "react": ">=18",
26
32
  "react-dom": ">=18"
27
33
  },