@nexface/chat 0.1.14 → 0.1.15-alpha.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 (128) hide show
  1. package/dist/assistant-attachments.js +17 -60
  2. package/dist/assistant-attachments.js.map +1 -0
  3. package/dist/assistant-components.d.ts +3 -3
  4. package/dist/assistant-components.js +29 -77
  5. package/dist/assistant-components.js.map +1 -0
  6. package/dist/assistant-runtime.d.ts +1 -1
  7. package/dist/assistant-runtime.js +43 -100
  8. package/dist/assistant-runtime.js.map +1 -0
  9. package/dist/attachments.js +15 -36
  10. package/dist/attachments.js.map +1 -0
  11. package/dist/client.js +73 -312
  12. package/dist/client.js.map +1 -0
  13. package/dist/config.js +5 -4
  14. package/dist/config.js.map +1 -0
  15. package/dist/default-chat.d.ts +1 -1
  16. package/dist/default-chat.js +728 -2102
  17. package/dist/default-chat.js.map +7 -0
  18. package/dist/errors.js +18 -55
  19. package/dist/errors.js.map +1 -0
  20. package/dist/index.js +1 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/messages.js +1 -0
  23. package/dist/messages.js.map +1 -0
  24. package/dist/page-confirmation.js +4 -3
  25. package/dist/page-confirmation.js.map +1 -0
  26. package/dist/protocol-messages.js +66 -290
  27. package/dist/protocol-messages.js.map +1 -0
  28. package/dist/protocol-response.js +18 -38
  29. package/dist/protocol-response.js.map +1 -0
  30. package/dist/react.js +50 -146
  31. package/dist/react.js.map +1 -0
  32. package/dist/shared/errors.d.ts +1 -1
  33. package/dist/shared/errors.js +1 -0
  34. package/dist/shared/errors.js.map +1 -0
  35. package/dist/shared/runtime-controller.d.ts +0 -1
  36. package/dist/shared/runtime-controller.js +1 -0
  37. package/dist/shared/runtime-controller.js.map +1 -0
  38. package/dist/shared/runtime-execution.js +1 -0
  39. package/dist/shared/runtime-execution.js.map +1 -0
  40. package/dist/shared/schema.js +19 -45
  41. package/dist/shared/schema.js.map +1 -0
  42. package/dist/storage.js +53 -130
  43. package/dist/storage.js.map +1 -0
  44. package/dist/styles.css +20 -99
  45. package/dist/tool-result.js +3 -7
  46. package/dist/tool-result.js.map +1 -0
  47. package/dist/types.js +1 -0
  48. package/dist/types.js.map +1 -0
  49. package/dist/ui/attachment.aui.d.ts +1 -1
  50. package/dist/ui/attachment.aui.js +20 -16
  51. package/dist/ui/attachment.aui.js.map +1 -0
  52. package/dist/ui/avatar.js +1 -0
  53. package/dist/ui/avatar.js.map +1 -0
  54. package/dist/ui/button.js +1 -0
  55. package/dist/ui/button.js.map +1 -0
  56. package/dist/ui/code-block.js +3 -2
  57. package/dist/ui/code-block.js.map +1 -0
  58. package/dist/ui/collapsible.js +3 -2
  59. package/dist/ui/collapsible.js.map +1 -0
  60. package/dist/ui/composer-voice.js +2 -3
  61. package/dist/ui/composer-voice.js.map +1 -0
  62. package/dist/ui/dialog.d.ts +1 -1
  63. package/dist/ui/dialog.js +4 -9
  64. package/dist/ui/dialog.js.map +1 -0
  65. package/dist/ui/dropdown-menu.js +3 -2
  66. package/dist/ui/dropdown-menu.js.map +1 -0
  67. package/dist/ui/home-demo/action-bar.js +1 -0
  68. package/dist/ui/home-demo/action-bar.js.map +1 -0
  69. package/dist/ui/home-demo/composer.js +4 -7
  70. package/dist/ui/home-demo/composer.js.map +1 -0
  71. package/dist/ui/home-demo/greeting.d.ts +1 -1
  72. package/dist/ui/home-demo/greeting.js +2 -1
  73. package/dist/ui/home-demo/greeting.js.map +1 -0
  74. package/dist/ui/home-demo/messages.d.ts +1 -1
  75. package/dist/ui/home-demo/messages.js +5 -4
  76. package/dist/ui/home-demo/messages.js.map +1 -0
  77. package/dist/ui/home-demo/styles.js +1 -0
  78. package/dist/ui/home-demo/styles.js.map +1 -0
  79. package/dist/ui/home-demo/suggestions.d.ts +1 -1
  80. package/dist/ui/home-demo/suggestions.js +3 -5
  81. package/dist/ui/home-demo/suggestions.js.map +1 -0
  82. package/dist/ui/home-demo/surfaces.js +2 -3
  83. package/dist/ui/home-demo/surfaces.js.map +1 -0
  84. package/dist/ui/home-demo/thread.d.ts +1 -1
  85. package/dist/ui/home-demo/thread.js +2 -1
  86. package/dist/ui/home-demo/thread.js.map +1 -0
  87. package/dist/ui/home-demo/trace-line.d.ts +1 -1
  88. package/dist/ui/home-demo/trace-line.js +3 -2
  89. package/dist/ui/home-demo/trace-line.js.map +1 -0
  90. package/dist/ui/home-demo/trace.d.ts +1 -1
  91. package/dist/ui/home-demo/trace.js +9 -28
  92. package/dist/ui/home-demo/trace.js.map +1 -0
  93. package/dist/ui/home-demo/type.js +1 -0
  94. package/dist/ui/home-demo/type.js.map +1 -0
  95. package/dist/ui/input.js +1 -0
  96. package/dist/ui/input.js.map +1 -0
  97. package/dist/ui/markdown-text.js +3 -2
  98. package/dist/ui/markdown-text.js.map +1 -0
  99. package/dist/ui/reasoning.aui.js +3 -2
  100. package/dist/ui/reasoning.aui.js.map +1 -0
  101. package/dist/ui/reasoning.d.ts +1 -1
  102. package/dist/ui/reasoning.js +9 -6
  103. package/dist/ui/reasoning.js.map +1 -0
  104. package/dist/ui/surface.js +8 -27
  105. package/dist/ui/surface.js.map +1 -0
  106. package/dist/ui/thread-list.aui.d.ts +2 -2
  107. package/dist/ui/thread-list.aui.js +12 -18
  108. package/dist/ui/thread-list.aui.js.map +1 -0
  109. package/dist/ui/tool-group.aui.js +3 -2
  110. package/dist/ui/tool-group.aui.js.map +1 -0
  111. package/dist/ui/tooltip-icon-button.js +2 -1
  112. package/dist/ui/tooltip-icon-button.js.map +1 -0
  113. package/dist/ui/tooltip.js +1 -0
  114. package/dist/ui/tooltip.js.map +1 -0
  115. package/dist/ui/use-attachment-src.js +2 -1
  116. package/dist/ui/use-attachment-src.js.map +1 -0
  117. package/dist/ui/use-copy-to-clipboard.d.ts +1 -1
  118. package/dist/ui/use-copy-to-clipboard.js +2 -1
  119. package/dist/ui/use-copy-to-clipboard.js.map +1 -0
  120. package/dist/ui/utils.js +3 -9
  121. package/dist/ui/utils.js.map +1 -0
  122. package/dist/use-next-message.js +4 -7
  123. package/dist/use-next-message.js.map +1 -0
  124. package/dist/voice/types.js +1 -0
  125. package/dist/voice/types.js.map +1 -0
  126. package/dist/voice/use-voice.js +13 -35
  127. package/dist/voice/use-voice.js.map +1 -0
  128. package/package.json +4 -8
package/dist/styles.css CHANGED
@@ -2989,49 +2989,14 @@
2989
2989
  }
2990
2990
  }
2991
2991
  /* Nexface layout and business content only; general UI is compiled from the pinned official homepage Demo. */
2992
- .nexface-chat {
2993
- box-sizing: border-box;
2994
- position: relative;
2995
- min-width: 0;
2996
- isolation: isolate;
2997
- border: 1px solid var(--nxf-border);
2998
- border-radius: 16px;
2999
- background: var(--nxf-background);
3000
- }
3001
- .nexface-chat[data-layout="floating"] {
3002
- position: fixed;
3003
- right: 24px;
3004
- bottom: 24px;
3005
- z-index: 10000;
3006
- }
3007
- .nexface-chat[data-layout="floating"][data-side="left"] {
3008
- left: 24px;
3009
- right: auto;
3010
- }
3011
- .nexface-chat[data-layout="floating"]:not([data-fullscreen]) .nexface-chat__panel {
3012
- width: min(546px, calc(100vw - 32px));
3013
- height: min(760px, calc(100dvh - 48px));
3014
- }
3015
- .nexface-chat[data-layout="docked"] {
3016
- position: fixed;
3017
- inset: 0 0 0 auto;
3018
- width: min(var(--nexface-chat-panel-width), 100vw);
3019
- z-index: 1000;
3020
- }
3021
- .nexface-chat[data-layout="docked"][data-side="left"] {
3022
- inset: 0 auto 0 0;
3023
- }
3024
- .nexface-chat[data-layout="inline"] {
3025
- width: 100%;
3026
- height: 100%;
3027
- }
3028
- .nexface-chat[data-fullscreen][data-layout][data-side] {
3029
- position: fixed;
3030
- inset: 0;
3031
- width: 100vw;
3032
- height: 100dvh;
3033
- z-index: 10001;
3034
- }
2992
+ .nexface-chat { box-sizing: border-box; position: relative; min-width: 0; isolation: isolate; border: 1px solid var(--nxf-border); border-radius: 16px; background: var(--nxf-background); }
2993
+ .nexface-chat[data-layout="floating"] { position: fixed; right: 24px; bottom: 24px; z-index: 10000; }
2994
+ .nexface-chat[data-layout="floating"][data-side="left"] { left: 24px; right: auto; }
2995
+ .nexface-chat[data-layout="floating"]:not([data-fullscreen]) .nexface-chat__panel { width: min(546px, calc(100vw - 32px)); height: min(760px, calc(100dvh - 48px)); }
2996
+ .nexface-chat[data-layout="docked"] { position: fixed; inset: 0 0 0 auto; width: min(var(--nexface-chat-panel-width), 100vw); z-index: 1000; }
2997
+ .nexface-chat[data-layout="docked"][data-side="left"] { inset: 0 auto 0 0; }
2998
+ .nexface-chat[data-layout="inline"] { width: 100%; height: 100%; }
2999
+ .nexface-chat[data-fullscreen][data-layout][data-side] { position: fixed; inset: 0; width: 100vw; height: 100dvh; z-index: 10001; }
3035
3000
  /* Internal token bridge shared by the Chat surface and its instance portal. */
3036
3001
  .nexface-ui {
3037
3002
  --nxf-background: var(--nexface-chat-background, #fff);
@@ -3043,60 +3008,16 @@
3043
3008
  --nxf-primary-hover: var(--nexface-chat-accent-hover, #3f3f46);
3044
3009
  --nxf-primary-foreground: var(--nexface-chat-on-accent, #fff);
3045
3010
  color: var(--nxf-foreground);
3046
- font-family: var(
3047
- --nexface-chat-font-family,
3048
- "Nexface Public Sans",
3049
- ui-sans-serif,
3050
- system-ui,
3051
- sans-serif
3052
- );
3053
- }
3054
- .nexface-chat-portals {
3055
- position: fixed;
3056
- inset: 0;
3057
- z-index: 10010;
3058
- pointer-events: none;
3059
- }
3060
- .nexface-chat-portals > * {
3061
- pointer-events: auto;
3062
- }
3063
- .nexface-chat__dialogs {
3064
- position: absolute;
3065
- inset: 0;
3066
- z-index: 80;
3067
- pointer-events: none;
3068
- border-radius: inherit;
3069
- }
3070
- .nexface-chat__dialog-layer {
3071
- position: absolute;
3072
- inset: 0;
3073
- display: grid;
3074
- place-items: center;
3075
- padding: 16px;
3076
- overflow: auto;
3077
- background: #00000030;
3078
- pointer-events: auto;
3079
- border-radius: inherit;
3080
- outline: none;
3081
- }
3082
- .nexface-chat__dialog-layer > div {
3083
- max-height: 100%;
3084
- }
3085
- .nexface-ui [data-slot="tooltip-content"] {
3086
- z-index: 70;
3087
- }
3088
- .nexface-ui [data-slot="button"][data-variant="default"]:hover:not(:disabled) {
3089
- background-color: var(--nxf-primary-hover);
3090
- }
3011
+ font-family: var(--nexface-chat-font-family, "Nexface Public Sans", ui-sans-serif, system-ui, sans-serif);
3012
+ }
3013
+ .nexface-chat-portals { position: fixed; inset: 0; z-index: 10010; pointer-events: none; }
3014
+ .nexface-chat-portals > * { pointer-events: auto; }
3015
+ .nexface-chat__dialogs { position: absolute; inset: 0; z-index: 80; pointer-events: none; border-radius: inherit; }
3016
+ .nexface-chat__dialog-layer { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; overflow: auto; background: #00000030; pointer-events: auto; border-radius: inherit; outline: none; }
3017
+ .nexface-chat__dialog-layer > div { max-height: 100%; }
3018
+ .nexface-ui [data-slot="tooltip-content"] { z-index: 70; }
3019
+ .nexface-ui [data-slot="button"][data-variant="default"]:hover:not(:disabled) { background-color: var(--nxf-primary-hover); }
3091
3020
 
3092
- .nexface-chat__session-sidebar {
3093
- width: var(--nexface-session-sidebar-width, 240px);
3094
- }
3095
- .nexface-chat__session-sidebar[data-layout="overlay"] {
3096
- left: 0;
3097
- max-width: 85%;
3098
- }
3099
- .nexface-chat__session-sidebar[data-layout="outside"] {
3100
- right: 100%;
3101
- border-radius: 16px 0 0 16px;
3102
- }
3021
+ .nexface-chat__session-sidebar { width: var(--nexface-session-sidebar-width, 240px); }
3022
+ .nexface-chat__session-sidebar[data-layout="overlay"] { left: 0; max-width: 85%; }
3023
+ .nexface-chat__session-sidebar[data-layout="outside"] { right: 100%; border-radius: 16px 0 0 16px; }
@@ -3,14 +3,10 @@ export function getToolResultError(content) {
3
3
  const error = JSON.parse(content)?.error;
4
4
  if (typeof error === "string")
5
5
  return error;
6
- if (error &&
7
- typeof error === "object" &&
8
- "message" in error &&
9
- typeof error.message === "string")
6
+ if (error && typeof error === "object" && "message" in error && typeof error.message === "string")
10
7
  return error.message;
11
8
  }
12
- catch {
13
- /* Tool results may contain plain text. */
14
- }
9
+ catch { /* Tool results may contain plain text. */ }
15
10
  return undefined;
16
11
  }
12
+ //# sourceMappingURL=tool-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-result.js","sourceRoot":"","sources":["../src/tool-result.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,IAAI,CAAC;QACH,MAAM,KAAK,GAAY,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC;QAClD,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC,OAAO,CAAC;IAC1H,CAAC;IAAC,MAAM,CAAC,CAAC,0CAA0C,CAAC,CAAC;IACtD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["export function getToolResultError(content: string): string | undefined {\n try {\n const error: unknown = JSON.parse(content)?.error;\n if (typeof error === \"string\") return error;\n if (error && typeof error === \"object\" && \"message\" in error && typeof error.message === \"string\") return error.message;\n } catch { /* Tool results may contain plain text. */ }\n return undefined;\n}\n"]}
package/dist/types.js CHANGED
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AgentRunResult } from \"@nexface/agent\";\nimport type { CSSProperties } from \"react\";\nimport type { ChatDictation } from \"./voice/types.js\";\nexport type ChatRunResult = Extract<AgentRunResult, { outcome: { type: \"success\" } }>;\n\nexport interface ChatSuggestion {\n readonly label: string;\n readonly prompt: string;\n}\n\nexport interface ChatProps {\n dictation?: false | ChatDictation | undefined;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n sessionSidebar?: boolean | { layout?: \"overlay\" | \"outside\" };\n showToolDetails?: boolean;\n onFullscreenChange?: (fullscreen: boolean) => void;\n avatar?: string;\n welcomeDescription?: string;\n side?: \"left\" | \"right\";\n className?: string;\n style?: CSSProperties;\n attachments?: false | ChatAttachmentOptions;\n title?: string;\n welcomeMessage?: string;\n placeholder?: string;\n layout?: \"floating\" | \"docked\" | \"inline\";\n suggestions?: readonly ChatSuggestion[];\n suggestNextMessage?: (input: {\n sessionId: string;\n messages: readonly { role: \"user\" | \"assistant\"; parts: readonly { type: \"text\"; text: string }[] }[];\n signal: AbortSignal;\n }) => string | undefined | Promise<string | undefined>;\n onRunResult?: (result: ChatRunResult) => void;\n}\n\nexport interface ChatAttachmentOptions {\n accept?: string;\n maxCount?: number;\n maxSizeBytes?: number;\n adapter?: {\n add(input: { id: string; file: File; signal: AbortSignal }): Promise<{ data?: unknown; preview?: string }>;\n send(input: { id: string; file: File; data?: unknown; signal: AbortSignal }): Promise<{\n content: readonly ({ type: \"text\"; text: string } | { type: \"image\"; source: { type: \"data\"; value: string; mimeType: string } })[];\n }>;\n remove?(input: { id: string; file: File; data?: unknown }): void | Promise<void>;\n };\n}\n\nexport type { AgentModelConfig, AgentModelInfo } from \"@nexface/agent\";\n"]}
@@ -1,5 +1,5 @@
1
1
  import { type PropsWithChildren, type FC } from "react";
2
- export declare function AttachmentUI({ preview, children, }: PropsWithChildren<{
2
+ export declare function AttachmentUI({ preview, children }: PropsWithChildren<{
3
3
  preview?: string | undefined;
4
4
  }>): import("react").JSX.Element;
5
5
  export declare const UserMessageAttachments: FC;
@@ -1,19 +1,16 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState, isValidElement, createContext, useContext, } from "react";
4
- import { XIcon, PlusIcon, FileText, Loader2Icon, AlertCircleIcon } from "lucide-react";
4
+ import { XIcon, PlusIcon, FileText, Loader2Icon, AlertCircleIcon, } from "lucide-react";
5
5
  import { AttachmentPrimitive, ComposerPrimitive, MessagePrimitive, useAuiState, useAui, } from "@assistant-ui/react";
6
- import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
7
- import { Dialog, DialogTitle, DialogContent, DialogTrigger } from "./dialog.js";
8
- import { Avatar, AvatarFallback } from "./avatar.js";
6
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "./tooltip.js";
7
+ import { Dialog, DialogTitle, DialogContent, DialogTrigger, } from "./dialog.js";
8
+ import { Avatar, AvatarFallback, } from "./avatar.js";
9
9
  import { TooltipIconButton } from "./tooltip-icon-button.js";
10
10
  import { useAttachmentSrc } from "./use-attachment-src.js";
11
11
  import { cn } from "./utils.js";
12
12
  const PreviewContext = createContext(undefined);
13
- const usePreview = () => {
14
- const fallback = useAttachmentSrc();
15
- return useContext(PreviewContext) ?? fallback;
16
- };
13
+ const usePreview = () => { const fallback = useAttachmentSrc(); return useContext(PreviewContext) ?? fallback; };
17
14
  const AttachmentPreview = ({ src }) => {
18
15
  const [isLoaded, setIsLoaded] = useState(false);
19
16
  return (_jsx("img", { src: src, alt: "\u9644\u4EF6\u9884\u89C8", className: cn("block h-auto max-h-[80vh] w-auto max-w-full rounded-sm object-contain transition-opacity duration-300 motion-reduce:transition-none", isLoaded
@@ -24,15 +21,15 @@ const AttachmentPreviewDialog = ({ children }) => {
24
21
  const src = usePreview();
25
22
  if (!src)
26
23
  return _jsx(_Fragment, { children: children });
27
- return (_jsxs(Dialog, { children: [_jsx(DialogTrigger, { className: cn("aui-attachment-preview-trigger cursor-zoom-in"), asChild: true, children: isValidElement(children) ? children : _jsx("button", { type: "button", children: children }) }), _jsxs(DialogContent, { className: cn("aui-attachment-preview-dialog-content [&>button]:bg-foreground/60 [&>button]:hover:bg-foreground/80 [&_svg]:text-background p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0!"), children: [_jsx(DialogTitle, { className: cn("aui-sr-only sr-only"), children: "\u56FE\u7247\u9644\u4EF6\u9884\u89C8" }), _jsx("div", { className: cn("aui-attachment-preview bg-background relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden rounded-sm"), children: _jsx(AttachmentPreview, { src: src }) })] })] }));
24
+ return (_jsxs(Dialog, { children: [_jsx(DialogTrigger, { className: cn("aui-attachment-preview-trigger cursor-zoom-in"), asChild: true, children: isValidElement(children) ? (children) : (_jsx("button", { type: "button", children: children })) }), _jsxs(DialogContent, { className: cn("aui-attachment-preview-dialog-content [&>button]:bg-foreground/60 [&>button]:hover:bg-foreground/80 [&_svg]:text-background p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0!"), children: [_jsx(DialogTitle, { className: cn("aui-sr-only sr-only"), children: "\u56FE\u7247\u9644\u4EF6\u9884\u89C8" }), _jsx("div", { className: cn("aui-attachment-preview bg-background relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden rounded-sm"), children: _jsx(AttachmentPreview, { src: src }) })] })] }));
28
25
  };
29
26
  const AttachmentThumb = () => {
30
27
  const src = usePreview();
31
28
  const name = useAuiState((s) => s.attachment.name);
32
- return (_jsx(Avatar, { className: cn("aui-attachment-tile-avatar h-full w-full rounded-none"), children: src ? (_jsx("img", { src: src, alt: name, className: cn("aui-attachment-tile-image h-full w-full rounded-none object-cover") })) : (_jsx(AvatarFallback, { children: _jsx(FileText, { className: cn("aui-attachment-tile-fallback-icon text-muted-foreground/80 size-6 stroke-[1.5]") }) })) }));
29
+ return _jsx(Avatar, { className: cn("aui-attachment-tile-avatar h-full w-full rounded-none"), children: src ? _jsx("img", { src: src, alt: name, className: cn("aui-attachment-tile-image h-full w-full rounded-none object-cover") }) : _jsx(AvatarFallback, { children: _jsx(FileText, { className: cn("aui-attachment-tile-fallback-icon text-muted-foreground/80 size-6 stroke-[1.5]") }) }) });
33
30
  };
34
- export function AttachmentUI({ preview, children, }) {
35
- return (_jsx(PreviewContext.Provider, { value: preview, children: _jsx(AttachmentContent, { children: children }) }));
31
+ export function AttachmentUI({ preview, children }) {
32
+ return _jsx(PreviewContext.Provider, { value: preview, children: _jsx(AttachmentContent, { children: children }) });
36
33
  }
37
34
  const AttachmentContent = ({ children }) => {
38
35
  const aui = useAui();
@@ -53,15 +50,21 @@ const AttachmentContent = ({ children }) => {
53
50
  });
54
51
  const uploadState = useAuiState((s) => s.attachment.status.type === "running"
55
52
  ? "uploading"
56
- : s.attachment.status.type === "incomplete" && s.attachment.status.reason === "error"
53
+ : s.attachment.status.type === "incomplete" &&
54
+ s.attachment.status.reason === "error"
57
55
  ? "error"
58
56
  : undefined);
59
57
  const isUploading = uploadState === "uploading";
60
58
  const isError = uploadState === "error";
61
- const errorMessage = useAuiState((s) => s.attachment.status.type === "incomplete" && s.attachment.status.reason === "error"
59
+ const errorMessage = useAuiState((s) => s.attachment.status.type === "incomplete" &&
60
+ s.attachment.status.reason === "error"
62
61
  ? (s.attachment.status.message ?? "附件处理失败")
63
62
  : undefined);
64
- return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsxs(AttachmentPrimitive.Root, { className: cn("aui-attachment-root relative", isComposer && "animate-in fade-in-0 zoom-in-95 duration-200 motion-reduce:animate-none", isImage && !isComposer && "aui-attachment-root-message only:*:first:size-24"), children: [_jsx(AttachmentPreviewDialog, { children: _jsx(TooltipTrigger, { asChild: true, children: _jsxs("div", { className: cn("aui-attachment-tile bg-muted hover:after:bg-foreground/10 focus-visible:ring-ring/50 relative size-14 cursor-pointer overflow-hidden rounded-[calc(var(--nxf-composer-radius,1rem)-var(--nxf-composer-padding,8px))] transition-transform outline-none after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-1 after:ring-black/10 after:transition-colors after:ring-inset focus-visible:ring-1 active:scale-[0.96] motion-reduce:transition-none dark:after:ring-white/10", isError && "after:ring-destructive/60 dark:after:ring-destructive/60"), role: "button", tabIndex: 0, onKeyDown: (e) => {
63
+ return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsxs(AttachmentPrimitive.Root, { className: cn("aui-attachment-root relative", isComposer &&
64
+ "animate-in fade-in-0 zoom-in-95 duration-200 motion-reduce:animate-none", isImage &&
65
+ !isComposer &&
66
+ "aui-attachment-root-message only:*:first:size-24"), children: [_jsx(AttachmentPreviewDialog, { children: _jsx(TooltipTrigger, { asChild: true, children: _jsxs("div", { className: cn("aui-attachment-tile bg-muted hover:after:bg-foreground/10 focus-visible:ring-ring/50 relative size-14 cursor-pointer overflow-hidden rounded-[calc(var(--nxf-composer-radius,1rem)-var(--nxf-composer-padding,8px))] transition-transform outline-none after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-1 after:ring-black/10 after:transition-colors after:ring-inset focus-visible:ring-1 active:scale-[0.96] motion-reduce:transition-none dark:after:ring-white/10", isError &&
67
+ "after:ring-destructive/60 dark:after:ring-destructive/60"), role: "button", tabIndex: 0, onKeyDown: (e) => {
65
68
  if (e.key === "Enter") {
66
69
  e.preventDefault();
67
70
  e.currentTarget.click();
@@ -72,7 +75,7 @@ const AttachmentContent = ({ children }) => {
72
75
  }, onKeyUp: (e) => {
73
76
  if (e.key === " ")
74
77
  e.currentTarget.click();
75
- }, "aria-label": `${typeLabel}附件${isError ? ",处理失败" : isUploading ? ",正在处理" : ""}`, children: [_jsx(AttachmentThumb, {}), isUploading && (_jsx("div", { "aria-hidden": "true", className: cn("aui-attachment-tile-uploading bg-background/60 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"), children: _jsx(Loader2Icon, { className: cn("text-muted-foreground size-4 animate-spin") }) })), isError && (_jsx("div", { "aria-hidden": "true", className: cn("aui-attachment-tile-error bg-background/70 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"), children: _jsx(AlertCircleIcon, { className: cn("text-destructive size-4") }) }))] }) }) }), isComposer && _jsx(AttachmentRemove, {}), children] }), _jsxs(TooltipContent, { side: "top", children: [_jsx(AttachmentPrimitive.Name, {}), errorMessage && _jsx("p", { className: cn("aui-attachment-error-message"), children: errorMessage })] })] }) }));
78
+ }, "aria-label": `${typeLabel}附件${isError ? ",处理失败" : isUploading ? ",正在处理" : ""}`, children: [_jsx(AttachmentThumb, {}), isUploading && (_jsx("div", { "aria-hidden": "true", className: cn("aui-attachment-tile-uploading bg-background/60 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"), children: _jsx(Loader2Icon, { className: cn("text-muted-foreground size-4 animate-spin") }) })), isError && (_jsx("div", { "aria-hidden": "true", className: cn("aui-attachment-tile-error bg-background/70 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"), children: _jsx(AlertCircleIcon, { className: cn("text-destructive size-4") }) }))] }) }) }), isComposer && _jsx(AttachmentRemove, {}), children] }), _jsxs(TooltipContent, { side: "top", children: [_jsx(AttachmentPrimitive.Name, {}), errorMessage && (_jsx("p", { className: cn("aui-attachment-error-message"), children: errorMessage }))] })] }) }));
76
79
  };
77
80
  const AttachmentRemove = () => {
78
81
  const name = useAuiState((s) => s.attachment.name);
@@ -87,3 +90,4 @@ export const ComposerAttachments = () => {
87
90
  export const ComposerAddAttachment = () => {
88
91
  return (_jsx(ComposerPrimitive.AddAttachment, { asChild: true, children: _jsx(TooltipIconButton, { tooltip: "\u6DFB\u52A0\u9644\u4EF6", side: "bottom", variant: "ghost", size: "icon", className: cn("aui-composer-add-attachment text-muted-foreground hover:text-foreground hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30 size-7 rounded-full active:scale-[0.96] motion-reduce:transition-none"), "aria-label": "\u6DFB\u52A0\u9644\u4EF6", children: _jsx(PlusIcon, { className: cn("aui-attachment-add-icon size-4") }) }) }));
89
92
  };
93
+ //# sourceMappingURL=attachment.aui.js.map
@@ -0,0 +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,KAAK,YAC1S,KAAC,KAAK,IAAC,SAAS,EAAE,EAAE,CAAC,gDAAgD,CAAC,GAAG,GACtD,GACQ,CAAC,CAAC;AACjC,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAO,GAAG,EAAE;IAC7C,OAAO,CAAC,cAAK,SAAS,EAAE,EAAE,CAAC,+GAA+G,CAAC,YAC1I,KAAC,gBAAgB,CAAC,WAAW,cAC3B,GAAG,EAAE,CAAC,KAAC,YAAY,KAAG,GACO,GAC1B,CAAC,CAAC;AACV,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,mBAAmB,GAAO,GAAG,EAAE;IAC1C,OAAO,CAAC,cAAK,SAAS,EAAE,EAAE,CAAC,+FAA+F,CAAC,YAC1H,KAAC,iBAAiB,CAAC,WAAW,cAC5B,GAAG,EAAE,CAAC,KAAC,YAAY,KAAG,GACQ,GAC3B,CAAC,CAAC;AACV,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAO,GAAG,EAAE;IAC5C,OAAO,CAAC,KAAC,iBAAiB,CAAC,aAAa,IAAC,OAAO,kBAC/C,KAAC,iBAAiB,IAAC,OAAO,EAAC,0BAAM,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAE,EAAE,CAAC,8OAA8O,CAAC,gBAAa,0BAAM,YAC3V,KAAC,QAAQ,IAAC,SAAS,EAAE,EAAE,CAAC,gCAAgC,CAAC,GAAG,GACzC,GACa,CAAC,CAAC;AACtC,CAAC,CAAC","sourcesContent":["\"use client\";\nimport { type PropsWithChildren, useState, type FC, isValidElement, createContext, useContext, } from \"react\";\nimport { XIcon, PlusIcon, FileText, Loader2Icon, AlertCircleIcon, } from \"lucide-react\";\nimport { AttachmentPrimitive, ComposerPrimitive, MessagePrimitive, useAuiState, useAui, } from \"@assistant-ui/react\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from \"./tooltip.js\";\nimport { Dialog, DialogTitle, DialogContent, DialogTrigger, } from \"./dialog.js\";\nimport { Avatar, AvatarFallback, } from \"./avatar.js\";\nimport { TooltipIconButton } from \"./tooltip-icon-button.js\";\nimport { useAttachmentSrc } from \"./use-attachment-src.js\";\nimport { cn } from \"./utils.js\";\nconst PreviewContext = createContext<string | undefined>(undefined);\nconst usePreview = () => { const fallback = useAttachmentSrc(); return useContext(PreviewContext) ?? fallback; };\ntype AttachmentPreviewProps = {\n src: string;\n};\nconst AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {\n const [isLoaded, setIsLoaded] = useState(false);\n return (<img src={src} alt=\"附件预览\" className={cn(\"block h-auto max-h-[80vh] w-auto max-w-full rounded-sm object-contain transition-opacity duration-300 motion-reduce:transition-none\", isLoaded\n ? \"aui-attachment-preview-image-loaded opacity-100\"\n : \"aui-attachment-preview-image-loading opacity-0\")} onLoad={() => setIsLoaded(true)}/>);\n};\nconst AttachmentPreviewDialog: FC<PropsWithChildren<unknown>> = ({ children }) => {\n const src = usePreview();\n if (!src)\n return <>{children}</>;\n return (<Dialog>\n <DialogTrigger className={cn(\"aui-attachment-preview-trigger cursor-zoom-in\")} asChild>\n {isValidElement(children) ? (children) : (<button type=\"button\">{children}</button>)}\n </DialogTrigger>\n <DialogContent className={cn(\"aui-attachment-preview-dialog-content [&>button]:bg-foreground/60 [&>button]:hover:bg-foreground/80 [&_svg]:text-background p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0!\")}>\n <DialogTitle className={cn(\"aui-sr-only sr-only\")}>\n 图片附件预览\n </DialogTitle>\n <div className={cn(\"aui-attachment-preview bg-background relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden rounded-sm\")}>\n <AttachmentPreview src={src}/>\n </div>\n </DialogContent>\n </Dialog>);\n};\nconst AttachmentThumb: FC = () => {\n const src = usePreview();\n const name = useAuiState((s) => s.attachment.name);\n return <Avatar className={cn(\"aui-attachment-tile-avatar h-full w-full rounded-none\")}>\n {src ? <img src={src} alt={name} className={cn(\"aui-attachment-tile-image h-full w-full rounded-none object-cover\")}/> : <AvatarFallback><FileText className={cn(\"aui-attachment-tile-fallback-icon text-muted-foreground/80 size-6 stroke-[1.5]\")}/></AvatarFallback>}\n </Avatar>;\n};\nexport function AttachmentUI({ preview, children }: PropsWithChildren<{\n preview?: string | undefined;\n}>) {\n return <PreviewContext.Provider value={preview}><AttachmentContent>{children}</AttachmentContent></PreviewContext.Provider>;\n}\nconst AttachmentContent: FC<PropsWithChildren<unknown>> = ({ children }) => {\n const aui = useAui();\n const isComposer = aui.attachment.source !== \"message\";\n const isImage = useAuiState((s) => s.attachment.type === \"image\");\n const typeLabel = useAuiState((s) => {\n const type = s.attachment.type;\n switch (type) {\n case \"image\":\n return \"图片\";\n case \"document\":\n return \"文档\";\n case \"file\":\n return \"文件\";\n default:\n return type;\n }\n });\n const uploadState = useAuiState((s) => s.attachment.status.type === \"running\"\n ? \"uploading\"\n : s.attachment.status.type === \"incomplete\" &&\n s.attachment.status.reason === \"error\"\n ? \"error\"\n : undefined);\n const isUploading = uploadState === \"uploading\";\n const isError = uploadState === \"error\";\n const errorMessage = useAuiState((s) => s.attachment.status.type === \"incomplete\" &&\n s.attachment.status.reason === \"error\"\n ? (s.attachment.status.message ?? \"附件处理失败\")\n : undefined);\n return (<TooltipProvider>\n <Tooltip>\n <AttachmentPrimitive.Root className={cn(\"aui-attachment-root relative\", isComposer &&\n \"animate-in fade-in-0 zoom-in-95 duration-200 motion-reduce:animate-none\", isImage &&\n !isComposer &&\n \"aui-attachment-root-message only:*:first:size-24\")}>\n <AttachmentPreviewDialog>\n <TooltipTrigger asChild>\n <div className={cn(\"aui-attachment-tile bg-muted hover:after:bg-foreground/10 focus-visible:ring-ring/50 relative size-14 cursor-pointer overflow-hidden rounded-[calc(var(--nxf-composer-radius,1rem)-var(--nxf-composer-padding,8px))] transition-transform outline-none after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-1 after:ring-black/10 after:transition-colors after:ring-inset focus-visible:ring-1 active:scale-[0.96] motion-reduce:transition-none dark:after:ring-white/10\", isError &&\n \"after:ring-destructive/60 dark:after:ring-destructive/60\")} role=\"button\" tabIndex={0} onKeyDown={(e) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n e.currentTarget.click();\n }\n else if (e.key === \" \") {\n e.preventDefault();\n }\n }} onKeyUp={(e) => {\n if (e.key === \" \")\n e.currentTarget.click();\n }} aria-label={`${typeLabel}附件${isError ? \",处理失败\" : isUploading ? \",正在处理\" : \"\"}`}>\n <AttachmentThumb />\n {isUploading && (<div aria-hidden=\"true\" className={cn(\"aui-attachment-tile-uploading bg-background/60 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none\")}>\n <Loader2Icon className={cn(\"text-muted-foreground size-4 animate-spin\")}/>\n </div>)}\n {isError && (<div aria-hidden=\"true\" className={cn(\"aui-attachment-tile-error bg-background/70 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none\")}>\n <AlertCircleIcon className={cn(\"text-destructive size-4\")}/>\n </div>)}\n </div>\n </TooltipTrigger>\n </AttachmentPreviewDialog>\n {isComposer && <AttachmentRemove />}\n {children}\n </AttachmentPrimitive.Root>\n <TooltipContent side=\"top\">\n <AttachmentPrimitive.Name />\n {errorMessage && (<p className={cn(\"aui-attachment-error-message\")}>{errorMessage}</p>)}\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>);\n};\nconst AttachmentRemove: FC = () => {\n const name = useAuiState((s) => s.attachment.name);\n return (<AttachmentPrimitive.Remove asChild>\n <TooltipIconButton tooltip=\"移除附件\" aria-label={`移除 ${name}`} className={cn(\"aui-attachment-tile-remove absolute end-1 top-1 size-5 rounded-full bg-black/50! text-white after:absolute after:-inset-1.5 hover:bg-black/70! hover:text-white! active:scale-[0.96] motion-reduce:transition-none\")} side=\"top\">\n <XIcon className={cn(\"aui-attachment-remove-icon size-3 stroke-[2.5]\")}/>\n </TooltipIconButton>\n </AttachmentPrimitive.Remove>);\n};\nexport const UserMessageAttachments: FC = () => {\n return (<div className={cn(\"aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2\")}>\n <MessagePrimitive.Attachments>\n {() => <AttachmentUI />}\n </MessagePrimitive.Attachments>\n </div>);\n};\nexport const ComposerAttachments: FC = () => {\n return (<div className={cn(\"aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden\")}>\n <ComposerPrimitive.Attachments>\n {() => <AttachmentUI />}\n </ComposerPrimitive.Attachments>\n </div>);\n};\nexport const ComposerAddAttachment: FC = () => {\n return (<ComposerPrimitive.AddAttachment asChild>\n <TooltipIconButton tooltip=\"添加附件\" side=\"bottom\" variant=\"ghost\" size=\"icon\" className={cn(\"aui-composer-add-attachment text-muted-foreground hover:text-foreground hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30 size-7 rounded-full active:scale-[0.96] motion-reduce:transition-none\")} aria-label=\"添加附件\">\n <PlusIcon className={cn(\"aui-attachment-add-icon size-4\")}/>\n </TooltipIconButton>\n </ComposerPrimitive.AddAttachment>);\n};\n"]}
package/dist/ui/avatar.js CHANGED
@@ -12,3 +12,4 @@ function AvatarFallback({ className, ...props }) {
12
12
  return (_jsx(AvatarPrimitive.Fallback, { "data-slot": "avatar-fallback", className: cn("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs", className), ...props }));
13
13
  }
14
14
  export { Avatar, AvatarImage, AvatarFallback };
15
+ //# sourceMappingURL=avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../src/ui/avatar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AACrD,SAAS,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,GAAG,SAAS,EAAE,GAAG,KAAK,EAEtD;IACC,OAAO,CAAC,KAAC,eAAe,CAAC,IAAI,iBAAW,QAAQ,eAAY,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,kIAAkI,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AAChP,CAAC;AACD,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAsD;IAC9F,OAAO,CAAC,KAAC,eAAe,CAAC,KAAK,iBAAW,cAAc,EAAC,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AAC7H,CAAC;AACD,SAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyD;IACpG,OAAO,CAAC,KAAC,eAAe,CAAC,QAAQ,iBAAW,iBAAiB,EAAC,SAAS,EAAE,EAAE,CAAC,oIAAoI,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AAC9O,CAAC;AACD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC","sourcesContent":["\"use client\";\nimport * as React from \"react\";\nimport { cn } from \"./utils.js\";\nimport { Avatar as AvatarPrimitive } from \"radix-ui\";\nfunction Avatar({ className, size = \"default\", ...props }: React.ComponentProps<typeof AvatarPrimitive.Root> & {\n size?: \"default\" | \"sm\" | \"lg\";\n}) {\n return (<AvatarPrimitive.Root data-slot=\"avatar\" data-size={size} className={cn(\"group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6\", className)} {...props}/>);\n}\nfunction AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>) {\n return (<AvatarPrimitive.Image data-slot=\"avatar-image\" className={cn(\"aspect-square size-full\", className)} {...props}/>);\n}\nfunction AvatarFallback({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {\n return (<AvatarPrimitive.Fallback data-slot=\"avatar-fallback\" className={cn(\"flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs\", className)} {...props}/>);\n}\nexport { Avatar, AvatarImage, AvatarFallback };\n"]}
package/dist/ui/button.js CHANGED
@@ -35,3 +35,4 @@ const Button = React.forwardRef(function Button({ className, variant = "default"
35
35
  return (_jsx(Comp, { ref: ref, "data-slot": "button", "data-variant": variant, "data-size": size, className: cn(buttonVariants({ variant, size, className })), ...props }));
36
36
  });
37
37
  export { Button, buttonVariants };
38
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/ui/button.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,MAAM,cAAc,GAAG,GAAG,CAAC,6bAA6b,EAAE;IACxd,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE,wDAAwD;YACjE,WAAW,EAAE,mJAAmJ;YAChK,OAAO,EAAE,qJAAqJ;YAC9J,SAAS,EAAE,8DAA8D;YACzE,KAAK,EAAE,sEAAsE;YAC7E,IAAI,EAAE,iDAAiD;SACxD;QACD,IAAI,EAAE;YACJ,OAAO,EAAE,+BAA+B;YACxC,EAAE,EAAE,0FAA0F;YAC9F,EAAE,EAAE,+CAA+C;YACnD,EAAE,EAAE,sCAAsC;YAC1C,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,wDAAwD;YACnE,SAAS,EAAE,QAAQ;YACnB,SAAS,EAAE,SAAS;SACrB;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;KAChB;CACF,CAAC,CAAC;AACH,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAE5B,SAAS,MAAM,CAAC,EAAE,SAAS,EAAE,OAAO,GAAG,SAAS,EAAE,IAAI,GAAG,SAAS,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IACrG,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC5C,OAAO,CAAC,KAAC,IAAI,IAAC,GAAG,EAAE,GAAG,eAAY,QAAQ,kBAAe,OAAO,eAAa,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AAChK,CAAC,CAAC,CAAC;AACH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC","sourcesContent":["\"use client\";\nimport * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"./utils.js\";\nimport { Slot } from \"radix-ui\";\nconst buttonVariants = cva(\"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\", {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive: \"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40\",\n outline: \"border border-border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 px-4 py-2 has-[>svg]:px-3\",\n xs: \"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3\",\n sm: \"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5\",\n lg: \"h-10 rounded-md px-6 has-[>svg]:px-4\",\n icon: \"size-9\",\n \"icon-xs\": \"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3\",\n \"icon-sm\": \"size-8\",\n \"icon-lg\": \"size-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n});\nconst Button = React.forwardRef<HTMLButtonElement, React.ComponentPropsWithoutRef<\"button\"> & VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n}>(function Button({ className, variant = \"default\", size = \"default\", asChild = false, ...props }, ref) {\n const Comp = asChild ? Slot.Root : \"button\";\n return (<Comp ref={ref} data-slot=\"button\" data-variant={variant} data-size={size} className={cn(buttonVariants({ variant, size, className }))} {...props}/>);\n});\nexport { Button, buttonVariants };\n"]}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect, useRef, useState } from "react";
3
+ import { useEffect, useRef, useState, } from "react";
4
4
  import { CheckIcon, CopyIcon } from "lucide-react";
5
5
  import { cn } from "./utils.js";
6
6
  function CopyButton({ getText, onCopied, className, }) {
@@ -30,7 +30,7 @@ function CopyButton({ getText, onCopied, className, }) {
30
30
  setCopied(true);
31
31
  clearTimeout(copyTimer.current);
32
32
  copyTimer.current = setTimeout(() => setCopied(false), 1500);
33
- }, className: cn("text-muted-foreground hover:text-foreground grid size-6 shrink-0 place-items-center rounded-sm transition-colors", className), children: copied ? _jsx(CheckIcon, { className: cn("size-3.5") }) : _jsx(CopyIcon, { className: cn("size-3.5") }) }));
33
+ }, className: cn("text-muted-foreground hover:text-foreground grid size-6 shrink-0 place-items-center rounded-sm transition-colors", className), children: copied ? (_jsx(CheckIcon, { className: cn("size-3.5") })) : (_jsx(CopyIcon, { className: cn("size-3.5") })) }));
34
34
  }
35
35
  /**
36
36
  * Chrome for highlighted code: a hairline field panel with an optional title
@@ -46,3 +46,4 @@ export function CodeBlock({ title, viewportClassName, copyText, onCopied, lineNu
46
46
  return (_jsxs("figure", { className: cn("not-prose not-fumadocs-codeblock border-foreground/10 bg-foreground/[0.025] dark:bg-foreground/[0.04] group/code relative my-6 flex min-w-0 flex-col overflow-hidden rounded-sm border", className), ...props, children: [title ? (_jsxs("figcaption", { className: cn("border-foreground/10 flex h-9 shrink-0 items-center justify-between gap-2 border-b py-0 ps-3.5 pe-2"), children: [_jsx("span", { className: cn("text-muted-foreground min-w-0 truncate font-mono text-[11px] font-medium tracking-wide"), children: title }), _jsx(CopyButton, { getText: getText, onCopied: onCopied })] })) : (_jsx(CopyButton, { getText: getText, onCopied: onCopied, className: cn("bg-background/80 absolute top-2 right-2 z-10 opacity-0 backdrop-blur-sm transition-opacity group-hover/code:opacity-100 focus-visible:opacity-100 [@media(pointer:coarse)]:opacity-100") })), _jsx("div", { ref: viewportRef, role: "region", "aria-label": "\u4EE3\u7801", tabIndex: 0, className: cn("focus-visible:outline-foreground/20 min-w-0 overflow-x-auto py-3.5 font-mono text-[12.5px] leading-relaxed [font-variant-ligatures:none] focus-visible:outline-1 focus-visible:-outline-offset-1", "[&_code]:bg-transparent! [&_pre]:w-max [&_pre]:min-w-full [&_pre]:bg-transparent! [&_pre]:px-3.5", "[&_.line]:inline-block [&_.line]:min-h-[1lh] [&_.line]:w-full", "[&_code_span]:[color:var(--shiki-light,inherit)]", "dark:[&_code_span]:[color:var(--shiki-dark)]!", "[&_.highlighted]:bg-blue-500/8 [&_.highlighted]:shadow-[inset_2px_0_0_#3b82f6] dark:[&_.highlighted]:bg-blue-500/15", "[&_pre[data-line-numbers]]:[counter-reset:line]", "[&_pre[data-line-numbers]_.line]:relative [&_pre[data-line-numbers]_.line]:pl-8 [&_pre[data-line-numbers]_.line]:[counter-increment:line]", "[&_pre[data-line-numbers]_.line]:before:text-muted-foreground/40 [&_pre[data-line-numbers]_.line]:before:absolute [&_pre[data-line-numbers]_.line]:before:left-0 [&_pre[data-line-numbers]_.line]:before:w-5 [&_pre[data-line-numbers]_.line]:before:text-right [&_pre[data-line-numbers]_.line]:before:tabular-nums [&_pre[data-line-numbers]_.line]:before:[content:counter(line)]", lineNumbers &&
47
47
  "[&_.line]:before:text-muted-foreground/40 [counter-reset:line] [&_.line]:relative [&_.line]:pl-8 [&_.line]:[counter-increment:line] [&_.line]:before:absolute [&_.line]:before:left-0 [&_.line]:before:w-5 [&_.line]:before:text-right [&_.line]:before:tabular-nums [&_.line]:before:[content:counter(line)]", viewportClassName), children: children })] }));
48
48
  }
49
+ //# sourceMappingURL=code-block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-block.js","sourceRoot":"","sources":["../../src/ui/code-block.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,SAAS,EACT,MAAM,EACN,QAAQ,GAGT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAkBhC,SAAS,UAAU,CAAC,EAClB,OAAO,EACP,QAAQ,EACR,SAAS,GAKV;IACC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,MAAM,CACtB,SAAS,CACV,CAAC;IACF,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAEhC,SAAS,CAAC,GAAG,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AW,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,GAAG,EAAE,CACnB,QAAQ,IAAI,WAAW,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,WAAW,IAAI,EAAE,CAAC;IAE3E,OAAO,CACL,kBACE,SAAS,EAAE,EAAE,CACX,wLAAwL,EACxL,SAAS,CACV,KACG,KAAK,aAER,KAAK,CAAC,CAAC,CAAC,CACP,sBAAY,SAAS,EAAE,EAAE,CAAC,qGAAqG,CAAC,aAC9H,eAAM,SAAS,EAAE,EAAE,CAAC,wFAAwF,CAAC,YAC1G,KAAK,GACD,EACP,KAAC,UAAU,IAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAI,IACzC,CACd,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,EAAE,CAAC,wLAAwL,CAAC,GACvM,CACH,EACD,cACE,GAAG,EAAE,WAAW,EAChB,IAAI,EAAC,QAAQ,gBACF,cAAI,EACf,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,EAAE,CACX,kMAAkM,EAClM,kGAAkG,EAClG,+DAA+D,EAC/D,kDAAkD,EAClD,+CAA+C,EAC/C,qHAAqH,EACrH,iDAAiD,EACjD,2IAA2I,EAC3I,sXAAsX,EACtX,WAAW;oBACT,+SAA+S,EACjT,iBAAiB,CAClB,YAEA,QAAQ,GACL,IACC,CACV,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport {\n useEffect,\n useRef,\n useState,\n type ComponentProps,\n type ReactNode,\n} from \"react\";\nimport { CheckIcon, CopyIcon } from \"lucide-react\";\nimport { cn } from \"./utils.js\";\n\nexport interface CodeBlockProps extends Omit<\n ComponentProps<\"figure\">,\n \"title\"\n> {\n /** Label in the header, usually the file name. */\n title?: ReactNode;\n /** Classes for the scrollable code region, e.g. a max height. */\n viewportClassName?: string;\n /** Text for the copy button; defaults to the rendered code's text. */\n copyText?: string;\n /** Called after the copy button writes the clipboard. */\n onCopied?: () => void;\n /** Numbers the lines when the `pre` does not carry `data-line-numbers` itself. */\n lineNumbers?: boolean;\n}\n\nfunction CopyButton({\n getText,\n onCopied,\n className,\n}: {\n getText: () => string;\n onCopied?: (() => void) | undefined;\n className?: string;\n}) {\n const [copied, setCopied] = useState(false);\n const copyTimer = useRef<ReturnType<typeof setTimeout> | undefined>(\n undefined,\n );\n const unmounted = useRef(false);\n\n useEffect(() => {\n unmounted.current = false;\n return () => {\n unmounted.current = true;\n clearTimeout(copyTimer.current);\n setCopied(false);\n };\n }, []);\n\n return (\n <button\n type=\"button\"\n aria-label=\"复制代码\"\n onClick={async () => {\n try {\n await navigator.clipboard.writeText(getText());\n } catch {\n return;\n }\n onCopied?.();\n // The write can settle after the button is gone, and a confirmation\n // started then would outlive the cleanup that was meant to cancel it.\n if (unmounted.current) return;\n setCopied(true);\n clearTimeout(copyTimer.current);\n copyTimer.current = setTimeout(() => setCopied(false), 1500);\n }}\n className={cn(\n \"text-muted-foreground hover:text-foreground grid size-6 shrink-0 place-items-center rounded-sm transition-colors\",\n className,\n )}\n >\n {copied ? (\n <CheckIcon className={cn(\"size-3.5\")} />\n ) : (\n <CopyIcon className={cn(\"size-3.5\")} />\n )}\n </button>\n );\n}\n\n/**\n * Chrome for highlighted code: a hairline field panel with an optional title\n * header and a copy button. Children carry the `pre` element; tokens read\n * shiki's inline colors or `--shiki-light`, and in dark mode fall back to\n * `--shiki-dark`. Lines render as blocks on a `w-max` surface so\n * highlighted rows paint past the scroll fold, and `data-line-numbers` on the\n * `pre` (or the `lineNumbers` prop) turns on a CSS counter gutter.\n */\nexport function CodeBlock({\n title,\n viewportClassName,\n copyText,\n onCopied,\n lineNumbers,\n className,\n children,\n ...props\n}: CodeBlockProps) {\n const viewportRef = useRef<HTMLDivElement>(null);\n const getText = () =>\n copyText ?? viewportRef.current?.querySelector(\"pre\")?.textContent ?? \"\";\n\n return (\n <figure\n className={cn(\n \"not-prose not-fumadocs-codeblock border-foreground/10 bg-foreground/[0.025] dark:bg-foreground/[0.04] group/code relative my-6 flex min-w-0 flex-col overflow-hidden rounded-sm border\",\n className,\n )}\n {...props}\n >\n {title ? (\n <figcaption className={cn(\"border-foreground/10 flex h-9 shrink-0 items-center justify-between gap-2 border-b py-0 ps-3.5 pe-2\")}>\n <span className={cn(\"text-muted-foreground min-w-0 truncate font-mono text-[11px] font-medium tracking-wide\")}>\n {title}\n </span>\n <CopyButton getText={getText} onCopied={onCopied} />\n </figcaption>\n ) : (\n <CopyButton\n getText={getText}\n onCopied={onCopied}\n className={cn(\"bg-background/80 absolute top-2 right-2 z-10 opacity-0 backdrop-blur-sm transition-opacity group-hover/code:opacity-100 focus-visible:opacity-100 [@media(pointer:coarse)]:opacity-100\")}\n />\n )}\n <div\n ref={viewportRef}\n role=\"region\"\n aria-label=\"代码\"\n tabIndex={0}\n className={cn(\n \"focus-visible:outline-foreground/20 min-w-0 overflow-x-auto py-3.5 font-mono text-[12.5px] leading-relaxed [font-variant-ligatures:none] focus-visible:outline-1 focus-visible:-outline-offset-1\",\n \"[&_code]:bg-transparent! [&_pre]:w-max [&_pre]:min-w-full [&_pre]:bg-transparent! [&_pre]:px-3.5\",\n \"[&_.line]:inline-block [&_.line]:min-h-[1lh] [&_.line]:w-full\",\n \"[&_code_span]:[color:var(--shiki-light,inherit)]\",\n \"dark:[&_code_span]:[color:var(--shiki-dark)]!\",\n \"[&_.highlighted]:bg-blue-500/8 [&_.highlighted]:shadow-[inset_2px_0_0_#3b82f6] dark:[&_.highlighted]:bg-blue-500/15\",\n \"[&_pre[data-line-numbers]]:[counter-reset:line]\",\n \"[&_pre[data-line-numbers]_.line]:relative [&_pre[data-line-numbers]_.line]:pl-8 [&_pre[data-line-numbers]_.line]:[counter-increment:line]\",\n \"[&_pre[data-line-numbers]_.line]:before:text-muted-foreground/40 [&_pre[data-line-numbers]_.line]:before:absolute [&_pre[data-line-numbers]_.line]:before:left-0 [&_pre[data-line-numbers]_.line]:before:w-5 [&_pre[data-line-numbers]_.line]:before:text-right [&_pre[data-line-numbers]_.line]:before:tabular-nums [&_pre[data-line-numbers]_.line]:before:[content:counter(line)]\",\n lineNumbers &&\n \"[&_.line]:before:text-muted-foreground/40 [counter-reset:line] [&_.line]:relative [&_.line]:pl-8 [&_.line]:[counter-increment:line] [&_.line]:before:absolute [&_.line]:before:left-0 [&_.line]:before:w-5 [&_.line]:before:text-right [&_.line]:before:tabular-nums [&_.line]:before:[content:counter(line)]\",\n viewportClassName,\n )}\n >\n {children}\n </div>\n </figure>\n );\n}\n"]}
@@ -6,9 +6,10 @@ const Collapsible = forwardRef(function Collapsible(props, ref) {
6
6
  return _jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible", ref: ref, ...props });
7
7
  });
8
8
  const CollapsibleTrigger = forwardRef(function CollapsibleTrigger(props, ref) {
9
- return _jsx(CollapsiblePrimitive.Trigger, { "data-slot": "collapsible-trigger", ref: ref, ...props });
9
+ return (_jsx(CollapsiblePrimitive.Trigger, { "data-slot": "collapsible-trigger", ref: ref, ...props }));
10
10
  });
11
11
  const CollapsibleContent = forwardRef(function CollapsibleContent(props, ref) {
12
- return _jsx(CollapsiblePrimitive.Content, { "data-slot": "collapsible-content", ref: ref, ...props });
12
+ return (_jsx(CollapsiblePrimitive.Content, { "data-slot": "collapsible-content", ref: ref, ...props }));
13
13
  });
14
14
  export { Collapsible, CollapsibleTrigger, CollapsibleContent };
15
+ //# sourceMappingURL=collapsible.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collapsible.js","sourceRoot":"","sources":["../../src/ui/collapsible.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,UAAU,EAAiC,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE/D,MAAM,WAAW,GAAG,UAAU,CAA6E,SAAS,WAAW,CAAC,KAAK,EAAE,GAAG;IACxI,OAAO,KAAC,oBAAoB,CAAC,IAAI,iBAAW,aAAa,EAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CAAC;AACpF,CAAC,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,UAAU,CAAmF,SAAS,kBAAkB,CAAC,KAAK,EAAE,GAAG;IAC5J,OAAO,CACL,KAAC,oBAAoB,CAAC,OAAO,iBAAW,qBAAqB,EAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CACtF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,UAAU,CAAgF,SAAS,kBAAkB,CAAC,KAAK,EAAE,GAAG;IACzJ,OAAO,CACL,KAAC,oBAAoB,CAAC,OAAO,iBAAW,qBAAqB,EAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CACtF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["\"use client\";\n\nimport { forwardRef, type ComponentPropsWithoutRef } from \"react\";\nimport { Collapsible as CollapsiblePrimitive } from \"radix-ui\";\n\nconst Collapsible = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>>(function Collapsible(props, ref) {\n return <CollapsiblePrimitive.Root data-slot=\"collapsible\" ref={ref} {...props} />;\n});\n\nconst CollapsibleTrigger = forwardRef<HTMLButtonElement, ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Trigger>>(function CollapsibleTrigger(props, ref) {\n return (\n <CollapsiblePrimitive.Trigger data-slot=\"collapsible-trigger\" ref={ref} {...props} />\n );\n});\n\nconst CollapsibleContent = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Content>>(function CollapsibleContent(props, ref) {\n return (\n <CollapsiblePrimitive.Content data-slot=\"collapsible-content\" ref={ref} {...props} />\n );\n});\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n"]}
@@ -13,7 +13,6 @@ export function ComposerVoice({ recording }) {
13
13
  const timer = setInterval(() => setTick((value) => value + 1), 100);
14
14
  return () => clearInterval(timer);
15
15
  }, [recording]);
16
- return (_jsx("div", { "data-slot": "composer-voice", "data-recording": recording || undefined, className: cn("flex h-7 min-w-0 flex-1 items-center overflow-hidden px-2"), children: _jsx("div", { className: cn("flex h-6 w-full items-center justify-between overflow-hidden"), "aria-hidden": true, children: Array.from({ length: barCount }, (_, index) => (_jsx("span", { className: cn("w-0.5 shrink-0 rounded-full transition-[height,background-color] duration-150 motion-reduce:transition-none", recording ? "bg-foreground/50" : "bg-foreground/25"), style: {
17
- height: recording ? 5 + Math.abs(Math.sin(index * 1.35 + tick * 0.55)) * 13 : 3,
18
- } }, index))) }) }));
16
+ return _jsx("div", { "data-slot": "composer-voice", "data-recording": recording || undefined, className: cn("flex h-7 min-w-0 flex-1 items-center overflow-hidden px-2"), children: _jsx("div", { className: cn("flex h-6 w-full items-center justify-between overflow-hidden"), "aria-hidden": true, children: Array.from({ length: barCount }, (_, index) => _jsx("span", { className: cn("w-0.5 shrink-0 rounded-full transition-[height,background-color] duration-150 motion-reduce:transition-none", recording ? "bg-foreground/50" : "bg-foreground/25"), style: { height: recording ? 5 + Math.abs(Math.sin(index * 1.35 + tick * 0.55)) * 13 : 3 } }, index)) }) });
19
17
  }
18
+ //# sourceMappingURL=composer-voice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composer-voice.js","sourceRoot":"","sources":["../../src/ui/composer-voice.tsx"],"names":[],"mappings":";AAAA,+FAA+F;AAC/F,iKAAiK;AACjK,kFAAkF;AAClF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC,MAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB,MAAM,UAAU,aAAa,CAAC,EAAE,SAAS,EAA0B;IACjE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,SAAS;YAAE,OAAO;QACvB,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACpE,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAChB,OAAO,2BAAe,gBAAgB,oBAAiB,SAAS,IAAI,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,2DAA2D,CAAC,YACvJ,cAAK,SAAS,EAAE,EAAE,CAAC,8DAA8D,CAAC,iCAC/E,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,eAC9C,SAAS,EAAE,EAAE,CAAC,6GAA6G,EAAE,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,kBAAkB,CAAC,EACjL,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAFjC,KAAK,CAEgC,CAAC,GAC7F,GACF,CAAC;AACT,CAAC","sourcesContent":["// Adapted from assistant-ui Elements ComposerVoice (18f03fec45d406b0285ccc4165f6db143ba87c7d).\n// https://github.com/assistant-ui/assistant-ui/blob/18f03fec45d406b0285ccc4165f6db143ba87c7d/packages/ui/src/components/react/assistant-ui/elements/composer.tsx\n// Keep the upstream illustrative waveform without exposing microphone-level APIs.\nimport { useEffect, useState } from \"react\";\nimport { cn } from \"./utils.js\";\n\nconst barCount = 64;\n\nexport function ComposerVoice({ recording }: { recording: boolean }) {\n const [tick, setTick] = useState(0);\n useEffect(() => {\n if (!recording) return;\n const timer = setInterval(() => setTick((value) => value + 1), 100);\n return () => clearInterval(timer);\n }, [recording]);\n return <div data-slot=\"composer-voice\" data-recording={recording || undefined} className={cn(\"flex h-7 min-w-0 flex-1 items-center overflow-hidden px-2\")}>\n <div className={cn(\"flex h-6 w-full items-center justify-between overflow-hidden\")} aria-hidden>\n {Array.from({ length: barCount }, (_, index) => <span key={index}\n className={cn(\"w-0.5 shrink-0 rounded-full transition-[height,background-color] duration-150 motion-reduce:transition-none\", recording ? \"bg-foreground/50\" : \"bg-foreground/25\")}\n style={{ height: recording ? 5 + Math.abs(Math.sin(index * 1.35 + tick * 0.55)) * 13 : 3 }} />)}\n </div>\n </div>;\n}\n"]}
@@ -11,4 +11,4 @@ declare function DialogFooter({ className, showCloseButton, children, ...props }
11
11
  }): React.JSX.Element;
12
12
  declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): React.JSX.Element;
13
13
  declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): React.JSX.Element;
14
- export { Dialog, DialogContent, DialogDescription, DialogFooter, DialogPortal, DialogTitle, DialogTrigger, };
14
+ export { Dialog, DialogContent, DialogDescription, DialogFooter, DialogPortal, DialogTitle, DialogTrigger };
package/dist/ui/dialog.js CHANGED
@@ -23,14 +23,8 @@ function DialogBackgroundGuard() {
23
23
  React.useLayoutEffect(() => {
24
24
  const siblings = Array.from(container?.parentElement?.children ?? []).filter((node) => node instanceof HTMLElement && node !== container);
25
25
  const previous = siblings.map((node) => node.inert);
26
- siblings.forEach((node) => {
27
- node.inert = true;
28
- });
29
- return () => {
30
- siblings.forEach((node, index) => {
31
- node.inert = previous[index];
32
- });
33
- };
26
+ siblings.forEach((node) => { node.inert = true; });
27
+ return () => { siblings.forEach((node, index) => { node.inert = previous[index]; }); };
34
28
  }, [container]);
35
29
  return null;
36
30
  }
@@ -53,4 +47,5 @@ function DialogTitle({ className, ...props }) {
53
47
  function DialogDescription({ className, ...props }) {
54
48
  return (_jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", className: cn("text-sm text-muted-foreground", className), ...props }));
55
49
  }
56
- export { Dialog, DialogContent, DialogDescription, DialogFooter, DialogPortal, DialogTitle, DialogTrigger, };
50
+ export { Dialog, DialogContent, DialogDescription, DialogFooter, DialogPortal, DialogTitle, DialogTrigger };
51
+ //# sourceMappingURL=dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/ui/dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,SAAS,MAAM,CAAC,EAAE,GAAG,KAAK,EAAqD;IAC7E,OAAO,KAAC,eAAe,CAAC,IAAI,iBAAW,QAAQ,KAAK,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC;AAC7E,CAAC;AACD,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAoF,SAAS,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IAChK,OAAO,KAAC,eAAe,CAAC,OAAO,iBAAW,gBAAgB,EAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAG,CAAC;AACpF,CAAC,CAAC,CAAC;AACH,SAAS,YAAY,CAAC,EAAE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AW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAsD;IAC9F,OAAO,CAAC,KAAC,eAAe,CAAC,KAAK,iBAAW,cAAc,EAAC,SAAS,EAAE,EAAE,CAAC,oCAAoC,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AACxI,CAAC;AACD,SAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA4D;IAC1G,OAAO,CAAC,KAAC,eAAe,CAAC,WAAW,iBAAW,oBAAoB,EAAC,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AAC/I,CAAC;AACD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC","sourcesContent":["\"use client\";\nimport { useDialogContainer } from \"./surface.js\";\nimport * as React from \"react\";\nimport { cn } from \"./utils.js\";\nimport { XIcon } from \"lucide-react\";\nimport { Dialog as DialogPrimitive } from \"radix-ui\";\nimport { Button } from \"./button.js\";\nfunction Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} modal={false}/>;\n}\nconst DialogTrigger = React.forwardRef<HTMLButtonElement, React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>>(function DialogTrigger({ ...props }, ref) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" ref={ref} {...props}/>;\n});\nfunction DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n const container = useDialogContainer();\n if (!container)\n return null;\n return <DialogPrimitive.Portal container={container} data-slot=\"dialog-portal\" {...props}/>;\n}\nfunction DialogBackgroundGuard() {\n const container = useDialogContainer();\n React.useLayoutEffect(() => {\n const siblings = Array.from(container?.parentElement?.children ?? []).filter((node): node is HTMLElement => node instanceof HTMLElement && node !== container);\n const previous = siblings.map((node) => node.inert);\n siblings.forEach((node) => { node.inert = true; });\n return () => { siblings.forEach((node, index) => { node.inert = previous[index]!; }); };\n }, [container]);\n return null;\n}\nfunction DialogContent({ className, children, showCloseButton = true, onEscapeKeyDown, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n}) {\n const content = React.useRef<HTMLDivElement>(null);\n return (<DialogPortal data-slot=\"dialog-portal\">\n <DialogPrimitive.Content ref={content} data-slot=\"dialog-content\" className=\"nexface-chat__dialog-layer\" onInteractOutside={(event) => event.preventDefault()} onEscapeKeyDown={(event) => {\n if (!(event.target instanceof Node) || !content.current?.contains(event.target)) {\n event.preventDefault();\n return;\n }\n onEscapeKeyDown?.(event);\n }} {...props}>\n <DialogBackgroundGuard />\n <div className={cn(\"relative grid w-full min-h-0 max-w-lg gap-4 overflow-y-auto rounded-lg border-0 bg-background p-6 shadow-lg outline-none\", className)}>\n {children}\n {showCloseButton && (<DialogPrimitive.Close data-slot=\"dialog-close\" className={cn(\"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\")}>\n <XIcon />\n <span className={cn(\"sr-only\")}>Close</span>\n </DialogPrimitive.Close>)}\n </div>\n </DialogPrimitive.Content>\n </DialogPortal>);\n}\nfunction DialogFooter({ className, showCloseButton = false, children, ...props }: React.ComponentProps<\"div\"> & {\n showCloseButton?: boolean;\n}) {\n return (<div data-slot=\"dialog-footer\" className={cn(\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\", className)} {...props}>\n {children}\n {showCloseButton && (<DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>)}\n </div>);\n}\nfunction DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (<DialogPrimitive.Title data-slot=\"dialog-title\" className={cn(\"text-lg leading-none font-semibold\", className)} {...props}/>);\n}\nfunction DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (<DialogPrimitive.Description data-slot=\"dialog-description\" className={cn(\"text-sm text-muted-foreground\", className)} {...props}/>);\n}\nexport { Dialog, DialogContent, DialogDescription, DialogFooter, DialogPortal, DialogTitle, DialogTrigger };\n"]}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { menuContentClass, menuItemClass } from "./home-demo/styles.js";
3
- ("use client");
3
+ "use client";
4
4
  import { usePortalContainer, PortalThemeSync } from "./surface.js";
5
5
  import * as React from "react";
6
6
  import { cn } from "./utils.js";
@@ -9,7 +9,7 @@ function DropdownMenu({ ...props }) {
9
9
  return _jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
10
10
  }
11
11
  const DropdownMenuTrigger = React.forwardRef(function DropdownMenuTrigger({ ...props }, ref) {
12
- return _jsx(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ref: ref, ...props });
12
+ return (_jsx(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ref: ref, ...props }));
13
13
  });
14
14
  function DropdownMenuContent({ children, className, sideOffset = 4, ...props }) {
15
15
  const container = usePortalContainer();
@@ -21,3 +21,4 @@ function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
21
21
  return (_jsx(DropdownMenuPrimitive.Item, { "data-slot": "dropdown-menu-item", "data-inset": inset, "data-variant": variant, className: cn(menuItemClass, "data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[variant=destructive]:text-destructive", className), ...props }));
22
22
  }
23
23
  export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem };
24
+ //# sourceMappingURL=dropdown-menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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AS,gBAAgB,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS,EAAE,GAAG,KAAK,EAG1E;IACC,OAAO,CAAC,KAAC,qBAAqB,CAAC,IAAI,iBAAW,oBAAoB,gBAAa,KAAK,kBAAgB,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,4GAA4G,EAAE,SAAS,CAAC,KAAM,KAAK,GAAG,CAAC,CAAC;AACpR,CAAC;AACD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { menuContentClass, menuItemClass } from \"./home-demo/styles.js\";\n\"use client\";\nimport { usePortalContainer, PortalThemeSync } from \"./surface.js\";\nimport * as React from \"react\";\nimport { cn } from \"./utils.js\";\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\";\nfunction DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props}/>;\n}\nconst DropdownMenuTrigger = React.forwardRef<HTMLButtonElement, React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Trigger>>(function DropdownMenuTrigger({ ...props }, ref) {\n return (<DropdownMenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" ref={ref} {...props}/>);\n});\nfunction DropdownMenuContent({ children, className, sideOffset = 4, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {\n const container = usePortalContainer();\n if (!container)\n return null;\n return (<DropdownMenuPrimitive.Portal container={container}>\n <DropdownMenuPrimitive.Content data-slot=\"dropdown-menu-content\" sideOffset={sideOffset} className={cn(menuContentClass, className)} {...props}><PortalThemeSync />{children}</DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>);\n}\nfunction DropdownMenuItem({ className, inset, variant = \"default\", ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n variant?: \"default\" | \"destructive\";\n}) {\n return (<DropdownMenuPrimitive.Item data-slot=\"dropdown-menu-item\" data-inset={inset} data-variant={variant} className={cn(menuItemClass, \"data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[variant=destructive]:text-destructive\", className)} {...props}/>);\n}\nexport { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem };\n"]}
@@ -7,3 +7,4 @@ import { actionButtonClass } from "./styles.js";
7
7
  export function AssistantActionBar() {
8
8
  return (_jsx(ActionBarPrimitive.Root, { autohide: "never", className: cn("flex items-center gap-1.5"), children: _jsxs(ActionBarPrimitive.Copy, { "aria-label": "\u590D\u5236\u56DE\u590D", className: cn(actionButtonClass), children: [_jsx(AuiIf, { condition: (s) => s.message.isCopied, children: _jsx(CheckIcon, { className: cn("size-4") }) }), _jsx(AuiIf, { condition: (s) => !s.message.isCopied, children: _jsx(CopyIcon, { className: cn("size-4") }) })] }) }));
9
9
  }
10
+ //# sourceMappingURL=action-bar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-bar.js","sourceRoot":"","sources":["../../../src/ui/home-demo/action-bar.tsx"],"names":[],"mappings":";AAAA,oGAAoG;AACpG,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,MAAM,UAAU,kBAAkB;IAEhC,OAAO,CACL,KAAC,kBAAkB,CAAC,IAAI,IACtB,QAAQ,EAAC,OAAO,EAChB,SAAS,EAAE,EAAE,CAAC,2BAA2B,CAAC,YAE1C,MAAC,kBAAkB,CAAC,IAAI,kBACX,0BAAM,EACjB,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,aAEhC,KAAC,KAAK,IAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,YACzC,KAAC,SAAS,IAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAK,GACjC,EACR,KAAC,KAAK,IAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,YAC1C,KAAC,QAAQ,IAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAK,GAChC,IACgB,GACF,CAC3B,CAAC;AACJ,CAAC","sourcesContent":["// Adapted from the pinned official homepage Demo; see vendor/assistant-ui/home-demo/ADAPTATIONS.md.\nimport { cn } from \"../utils.js\";\nimport { ActionBarPrimitive, AuiIf } from \"@assistant-ui/react\";\nimport { CheckIcon, CopyIcon } from \"lucide-react\";\nimport { actionButtonClass } from \"./styles.js\";\nexport function AssistantActionBar() {\n\n return (\n <ActionBarPrimitive.Root\n autohide=\"never\"\n className={cn(\"flex items-center gap-1.5\")}\n >\n <ActionBarPrimitive.Copy\n aria-label=\"复制回复\"\n className={cn(actionButtonClass)}\n >\n <AuiIf condition={(s) => s.message.isCopied}>\n <CheckIcon className={cn(\"size-4\")} />\n </AuiIf>\n <AuiIf condition={(s) => !s.message.isCopied}>\n <CopyIcon className={cn(\"size-4\")} />\n </AuiIf>\n </ActionBarPrimitive.Copy>\n </ActionBarPrimitive.Root>\n );\n}\n"]}
@@ -2,14 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ComposerPrimitive, MessagePrimitive } from "@assistant-ui/react";
3
3
  import { cn } from "../utils.js";
4
4
  export function Composer({ children, inputProps, actions, ...props }) {
5
- return (_jsx(ComposerPrimitive.Root, { className: cn("relative w-full"), ...props, children: _jsx(ComposerPrimitive.AttachmentDropzone, { asChild: true, disabled: inputProps.disabled, onDropCapture: (event) => {
6
- if (inputProps.disabled)
7
- event.preventDefault();
8
- }, onDragOverCapture: (event) => {
9
- if (inputProps.disabled)
10
- event.preventDefault();
11
- }, children: _jsxs("div", { "data-slot": "aui_composer-shell", className: cn("border-foreground/10 bg-muted/30 focus-within:border-foreground/25 data-[dragging=true]:border-foreground/40 rounded-thread flex flex-col border transition-colors data-[dragging=true]:border-dashed"), children: [_jsx("div", { className: cn("has-[.aui-attachment-root]:px-3 has-[.aui-attachment-root]:pt-3"), children: children }), _jsx(ComposerPrimitive.Input, { asChild: true, ...inputProps, children: _jsx("textarea", { "data-composer-input": true, rows: 1, className: cn("placeholder:text-muted-foreground field-sizing-content block max-h-48 w-full resize-none bg-transparent px-4 pt-3 pb-2 text-base leading-6 focus:outline-none") }) }), _jsx("div", { className: cn("flex items-center justify-between gap-2 px-2 pb-2"), children: actions })] }) }) }));
5
+ return (_jsx(ComposerPrimitive.Root, { className: cn("relative w-full"), ...props, children: _jsx(ComposerPrimitive.AttachmentDropzone, { asChild: true, disabled: inputProps.disabled, onDropCapture: (event) => { if (inputProps.disabled)
6
+ event.preventDefault(); }, onDragOverCapture: (event) => { if (inputProps.disabled)
7
+ event.preventDefault(); }, children: _jsxs("div", { "data-slot": "aui_composer-shell", className: cn("border-foreground/10 bg-muted/30 focus-within:border-foreground/25 data-[dragging=true]:border-foreground/40 rounded-thread flex flex-col border transition-colors data-[dragging=true]:border-dashed"), children: [_jsx("div", { className: cn("has-[.aui-attachment-root]:px-3 has-[.aui-attachment-root]:pt-3"), children: children }), _jsx(ComposerPrimitive.Input, { asChild: true, ...inputProps, children: _jsx("textarea", { "data-composer-input": true, rows: 1, className: cn("placeholder:text-muted-foreground field-sizing-content block max-h-48 w-full resize-none bg-transparent px-4 pt-3 pb-2 text-base leading-6 focus:outline-none") }) }), _jsx("div", { className: cn("flex items-center justify-between gap-2 px-2 pb-2"), children: actions })] }) }) }));
12
8
  }
13
9
  export function EditComposer({ children, inputProps, cancelProps, sendProps, ...props }) {
14
10
  return (_jsx(MessagePrimitive.Root, { "data-role": "user", "data-slot": "aui_edit-composer-wrapper", className: cn("mx-auto flex w-full max-w-(--nxf-thread-max-width) flex-col items-end"), children: _jsxs(ComposerPrimitive.Root, { className: cn("border-foreground/10 bg-muted/30 focus-within:border-foreground/25 rounded-thread flex w-full max-w-[85%] flex-col border transition-colors"), ...props, children: [_jsx(ComposerPrimitive.Input, { asChild: true, ...inputProps, children: _jsx("textarea", { autoFocus: true, rows: 1, className: cn("field-sizing-content max-h-48 min-h-12 w-full resize-none bg-transparent px-4 pt-3.5 pb-1 text-[15px] leading-6 focus:outline-none") }) }), children, _jsxs("div", { className: cn("flex items-center justify-end gap-1.5 px-2.5 pb-2.5"), children: [_jsx(ComposerPrimitive.Cancel, { asChild: true, children: _jsx("button", { type: "button", ...cancelProps, className: cn("text-muted-foreground hover:text-foreground rounded-control h-8 px-3 text-[13px] transition-colors"), children: "\u53D6\u6D88" }) }), _jsx(ComposerPrimitive.Send, { asChild: true, children: _jsx("button", { type: "button", ...sendProps, className: cn("bg-primary text-primary-foreground rounded-control h-8 px-3 text-[13px] font-medium transition-opacity disabled:opacity-40"), children: "\u4FDD\u5B58\u5E76\u91CD\u65B0\u53D1\u9001" }) })] })] }) }));
15
11
  }
12
+ //# sourceMappingURL=composer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composer.js","sourceRoot":"","sources":["../../../src/ui/home-demo/composer.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,MAAM,UAAU,QAAQ,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,KAAK,EAEjE;IACC,OAAO,CACL,KAAC,iBAAiB,CAAC,IAAI,IAAC,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAO,KAAK,YAClE,KAAC,iBAAiB,CAAC,kBAAkB,IAAC,OAAO,QAAC,QAAQ,EAAE,UAAU,CAAC,QAAQ,EACzE,aAAa,EAAE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,KACT,WAAW,EACf,SAAS,EAAE,EAAE,CAAC,oGAAoG,CAAC,6BAG5G,GACgB,EAC3B,KAAC,iBAAiB,CAAC,IAAI,IAAC,OAAO,kBAC7B,iBACE,IAAI,EAAC,QAAQ,KACT,SAAS,EACb,SAAS,EAAE,EAAE,CAAC,4HAA4H,CAAC,2DAGpI,GACc,IACrB,IACiB,GACH,CACzB,CAAC;AACJ,CAAC","sourcesContent":["// Adapted from the pinned official homepage Demo; see vendor/assistant-ui/home-demo/ADAPTATIONS.md.\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { ComposerPrimitive, MessagePrimitive } from \"@assistant-ui/react\";\nimport { cn } from \"../utils.js\";\nexport function Composer({ children, inputProps, actions, ...props }: ComponentProps<typeof ComposerPrimitive.Root> & {\n inputProps: ComponentProps<typeof ComposerPrimitive.Input>; actions: ReactNode;\n}) {\n return (\n <ComposerPrimitive.Root className={cn(\"relative w-full\")} {...props}>\n <ComposerPrimitive.AttachmentDropzone asChild disabled={inputProps.disabled}\n onDropCapture={(event) => { if (inputProps.disabled) event.preventDefault(); }}\n onDragOverCapture={(event) => { if (inputProps.disabled) event.preventDefault(); }}>\n <div data-slot=\"aui_composer-shell\" className={cn(\"border-foreground/10 bg-muted/30 focus-within:border-foreground/25 data-[dragging=true]:border-foreground/40 rounded-thread flex flex-col border transition-colors data-[dragging=true]:border-dashed\")} >\n <div className={cn(\"has-[.aui-attachment-root]:px-3 has-[.aui-attachment-root]:pt-3\")} >{children}</div>\n <ComposerPrimitive.Input asChild {...inputProps}>\n <textarea data-composer-input rows={1} className={cn(\"placeholder:text-muted-foreground field-sizing-content block max-h-48 w-full resize-none bg-transparent px-4 pt-3 pb-2 text-base leading-6 focus:outline-none\")} />\n </ComposerPrimitive.Input>\n <div className={cn(\"flex items-center justify-between gap-2 px-2 pb-2\")} >{actions}</div>\n </div>\n </ComposerPrimitive.AttachmentDropzone>\n </ComposerPrimitive.Root>\n );\n}\n\nexport function EditComposer({ children, inputProps, cancelProps, sendProps, ...props }: ComponentProps<typeof ComposerPrimitive.Root> & {\n inputProps: ComponentProps<typeof ComposerPrimitive.Input>;\n cancelProps: ComponentProps<\"button\">; sendProps: ComponentProps<\"button\">;\n}) {\n return (\n <MessagePrimitive.Root\n data-role=\"user\" data-slot=\"aui_edit-composer-wrapper\"\n className={cn(\"mx-auto flex w-full max-w-(--nxf-thread-max-width) flex-col items-end\")}\n >\n <ComposerPrimitive.Root className={cn(\"border-foreground/10 bg-muted/30 focus-within:border-foreground/25 rounded-thread flex w-full max-w-[85%] flex-col border transition-colors\")} {...props}>\n <ComposerPrimitive.Input asChild {...inputProps}>\n <textarea\n autoFocus\n\n rows={1}\n className={cn(\"field-sizing-content max-h-48 min-h-12 w-full resize-none bg-transparent px-4 pt-3.5 pb-1 text-[15px] leading-6 focus:outline-none\")}\n />\n </ComposerPrimitive.Input>\n {children}\n <div className={cn(\"flex items-center justify-end gap-1.5 px-2.5 pb-2.5\")} >\n <ComposerPrimitive.Cancel asChild>\n <button\n type=\"button\"\n {...cancelProps}\n className={cn(\"text-muted-foreground hover:text-foreground rounded-control h-8 px-3 text-[13px] transition-colors\")}\n >\n 取消\n </button>\n </ComposerPrimitive.Cancel>\n <ComposerPrimitive.Send asChild>\n <button\n type=\"button\"\n {...sendProps}\n className={cn(\"bg-primary text-primary-foreground rounded-control h-8 px-3 text-[13px] font-medium transition-opacity disabled:opacity-40\")}\n >\n 保存并重新发送\n </button>\n </ComposerPrimitive.Send>\n </div>\n </ComposerPrimitive.Root>\n </MessagePrimitive.Root>\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- export declare function Greeting({ title, description, }: {
1
+ export declare function Greeting({ title, description }: {
2
2
  title: string;
3
3
  description?: string | undefined;
4
4
  }): import("react").JSX.Element;
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // Adapted from the pinned official homepage Demo; see vendor/assistant-ui/home-demo/ADAPTATIONS.md.
3
3
  import { cn } from "../utils.js";
4
4
  import { typeSection, typeDeck } from "./type.js";
5
- export function Greeting({ title, description, }) {
5
+ export function Greeting({ title, description }) {
6
6
  return (_jsxs("div", { className: cn("animate-in fade-in slide-in-from-bottom-1 mx-auto mb-8 flex w-full max-w-(--nxf-thread-max-width) flex-col items-center text-center duration-200"), children: [_jsx("p", { className: cn(typeSection), children: title }), description ? _jsx("p", { className: cn(typeDeck), children: description }) : null] }));
7
7
  }
8
+ //# sourceMappingURL=greeting.js.map