@chatsdk-dev/ui 0.0.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/atoms/accordion.d.ts +7 -0
- package/dist/atoms/accordion.d.ts.map +1 -0
- package/dist/atoms/accordion.js +18 -0
- package/dist/atoms/alert-dialog.d.ts +19 -0
- package/dist/atoms/alert-dialog.d.ts.map +1 -0
- package/dist/atoms/alert-dialog.js +42 -0
- package/dist/atoms/alert.d.ts +11 -0
- package/dist/atoms/alert.d.ts.map +1 -0
- package/dist/atoms/alert.js +27 -0
- package/dist/atoms/avatar.d.ts +12 -0
- package/dist/atoms/avatar.d.ts.map +1 -0
- package/dist/atoms/avatar.js +23 -0
- package/dist/atoms/badge.d.ts +8 -0
- package/dist/atoms/badge.d.ts.map +1 -0
- package/dist/atoms/badge.js +44 -0
- package/dist/atoms/button-group.d.ts +11 -0
- package/dist/atoms/button-group.d.ts.map +1 -0
- package/dist/atoms/button-group.js +36 -0
- package/dist/atoms/button-loader.d.ts +9 -0
- package/dist/atoms/button-loader.d.ts.map +1 -0
- package/dist/atoms/button-loader.js +10 -0
- package/dist/atoms/button.d.ts +9 -0
- package/dist/atoms/button.d.ts.map +1 -0
- package/dist/atoms/button.js +32 -0
- package/dist/atoms/card.d.ts +12 -0
- package/dist/atoms/card.d.ts.map +1 -0
- package/dist/atoms/card.js +25 -0
- package/dist/atoms/carousel.d.ts +29 -0
- package/dist/atoms/carousel.d.ts.map +1 -0
- package/dist/atoms/carousel.js +91 -0
- package/dist/atoms/collapsible.d.ts +6 -0
- package/dist/atoms/collapsible.d.ts.map +1 -0
- package/dist/atoms/collapsible.js +13 -0
- package/dist/atoms/command.d.ts +20 -0
- package/dist/atoms/command.d.ts.map +1 -0
- package/dist/atoms/command.js +35 -0
- package/dist/atoms/container.d.ts +8 -0
- package/dist/atoms/container.d.ts.map +1 -0
- package/dist/atoms/container.js +5 -0
- package/dist/atoms/dialog.d.ts +19 -0
- package/dist/atoms/dialog.d.ts.map +1 -0
- package/dist/atoms/dialog.js +38 -0
- package/dist/atoms/dots-loader.d.ts +15 -0
- package/dist/atoms/dots-loader.d.ts.map +1 -0
- package/dist/atoms/dots-loader.js +21 -0
- package/dist/atoms/drawer.d.ts +14 -0
- package/dist/atoms/drawer.d.ts.map +1 -0
- package/dist/atoms/drawer.js +35 -0
- package/dist/atoms/dropdown-menu.d.ts +26 -0
- package/dist/atoms/dropdown-menu.d.ts.map +1 -0
- package/dist/atoms/dropdown-menu.js +51 -0
- package/dist/atoms/empty.d.ts +12 -0
- package/dist/atoms/empty.d.ts.map +1 -0
- package/dist/atoms/empty.js +33 -0
- package/dist/atoms/field.d.ts +25 -0
- package/dist/atoms/field.d.ts.map +1 -0
- package/dist/atoms/field.js +68 -0
- package/dist/atoms/form.d.ts +23 -0
- package/dist/atoms/form.d.ts.map +1 -0
- package/dist/atoms/form.js +68 -0
- package/dist/atoms/header.d.ts +6 -0
- package/dist/atoms/header.d.ts.map +1 -0
- package/dist/atoms/header.js +6 -0
- package/dist/atoms/hover-card.d.ts +6 -0
- package/dist/atoms/hover-card.d.ts.map +1 -0
- package/dist/atoms/hover-card.js +14 -0
- package/dist/atoms/index.d.ts +5 -0
- package/dist/atoms/index.d.ts.map +1 -0
- package/dist/atoms/index.js +5 -0
- package/dist/atoms/input-group.d.ts +19 -0
- package/dist/atoms/input-group.d.ts.map +1 -0
- package/dist/atoms/input-group.js +57 -0
- package/dist/atoms/input.d.ts +7 -0
- package/dist/atoms/input.d.ts.map +1 -0
- package/dist/atoms/input.js +6 -0
- package/dist/atoms/label.d.ts +3 -0
- package/dist/atoms/label.d.ts.map +1 -0
- package/dist/atoms/label.js +7 -0
- package/dist/atoms/logo.d.ts +7 -0
- package/dist/atoms/logo.d.ts.map +1 -0
- package/dist/atoms/logo.js +6 -0
- package/dist/atoms/number-flow.d.ts +3 -0
- package/dist/atoms/number-flow.d.ts.map +1 -0
- package/dist/atoms/number-flow.js +6 -0
- package/dist/atoms/popover.d.ts +10 -0
- package/dist/atoms/popover.d.ts.map +1 -0
- package/dist/atoms/popover.js +23 -0
- package/dist/atoms/progress.d.ts +8 -0
- package/dist/atoms/progress.d.ts.map +1 -0
- package/dist/atoms/progress.js +20 -0
- package/dist/atoms/radio-group.d.ts +6 -0
- package/dist/atoms/radio-group.d.ts.map +1 -0
- package/dist/atoms/radio-group.js +13 -0
- package/dist/atoms/scroll-area.d.ts +5 -0
- package/dist/atoms/scroll-area.d.ts.map +1 -0
- package/dist/atoms/scroll-area.js +11 -0
- package/dist/atoms/select.d.ts +17 -0
- package/dist/atoms/select.d.ts.map +1 -0
- package/dist/atoms/select.js +34 -0
- package/dist/atoms/separator.d.ts +3 -0
- package/dist/atoms/separator.d.ts.map +1 -0
- package/dist/atoms/separator.js +7 -0
- package/dist/atoms/sheet.d.ts +15 -0
- package/dist/atoms/sheet.d.ts.map +1 -0
- package/dist/atoms/sheet.js +37 -0
- package/dist/atoms/sidebar.d.ts +65 -0
- package/dist/atoms/sidebar.d.ts.map +1 -0
- package/dist/atoms/sidebar.js +258 -0
- package/dist/atoms/skeleton.d.ts +2 -0
- package/dist/atoms/skeleton.d.ts.map +1 -0
- package/dist/atoms/skeleton.js +5 -0
- package/dist/atoms/spinner.d.ts +3 -0
- package/dist/atoms/spinner.d.ts.map +1 -0
- package/dist/atoms/spinner.js +7 -0
- package/dist/atoms/switch.d.ts +5 -0
- package/dist/atoms/switch.d.ts.map +1 -0
- package/dist/atoms/switch.js +7 -0
- package/dist/atoms/table.d.ts +13 -0
- package/dist/atoms/table.d.ts.map +1 -0
- package/dist/atoms/table.js +28 -0
- package/dist/atoms/tabs.d.ts +12 -0
- package/dist/atoms/tabs.d.ts.map +1 -0
- package/dist/atoms/tabs.js +32 -0
- package/dist/atoms/textarea.d.ts +3 -0
- package/dist/atoms/textarea.d.ts.map +1 -0
- package/dist/atoms/textarea.js +5 -0
- package/dist/atoms/toggle.d.ts +9 -0
- package/dist/atoms/toggle.d.ts.map +1 -0
- package/dist/atoms/toggle.js +26 -0
- package/dist/atoms/tooltip.d.ts +7 -0
- package/dist/atoms/tooltip.d.ts.map +1 -0
- package/dist/atoms/tooltip.js +17 -0
- package/dist/atoms/typography/h1.d.ts +10 -0
- package/dist/atoms/typography/h1.d.ts.map +1 -0
- package/dist/atoms/typography/h1.js +6 -0
- package/dist/atoms/typography/paragraph.d.ts +6 -0
- package/dist/atoms/typography/paragraph.d.ts.map +1 -0
- package/dist/atoms/typography/paragraph.js +6 -0
- package/dist/atoms/typography/text.d.ts +14 -0
- package/dist/atoms/typography/text.d.ts.map +1 -0
- package/dist/atoms/typography/text.js +41 -0
- package/dist/components/responsive-alert-dialog.d.ts +16 -0
- package/dist/components/responsive-alert-dialog.d.ts.map +1 -0
- package/dist/components/responsive-alert-dialog.js +20 -0
- package/dist/components/responsive-dialog.d.ts +11 -0
- package/dist/components/responsive-dialog.d.ts.map +1 -0
- package/dist/components/responsive-dialog.js +21 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +2 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.js +31 -0
- package/dist/index.css +1580 -39
- package/dist/molecules/actions.d.ts +10 -0
- package/dist/molecules/actions.d.ts.map +1 -0
- package/dist/molecules/actions.js +13 -0
- package/dist/molecules/agent.d.ts +27 -0
- package/dist/molecules/agent.d.ts.map +1 -0
- package/dist/molecules/agent.js +27 -0
- package/dist/molecules/ai/actions.d.ts +10 -0
- package/dist/molecules/ai/actions.d.ts.map +1 -0
- package/dist/molecules/ai/actions.js +13 -0
- package/dist/molecules/ai/agent.d.ts +27 -0
- package/dist/molecules/ai/agent.d.ts.map +1 -0
- package/dist/molecules/ai/agent.js +27 -0
- package/dist/molecules/ai/artifact.d.ts +24 -0
- package/dist/molecules/ai/artifact.d.ts.map +1 -0
- package/dist/molecules/ai/artifact.js +20 -0
- package/dist/molecules/ai/attachments.d.ts +55 -0
- package/dist/molecules/ai/attachments.d.ts.map +1 -0
- package/dist/molecules/ai/attachments.js +125 -0
- package/dist/molecules/ai/audio-player.d.ts +30 -0
- package/dist/molecules/ai/audio-player.d.ts.map +1 -0
- package/dist/molecules/ai/audio-player.js +43 -0
- package/dist/molecules/ai/canvas.d.ts +9 -0
- package/dist/molecules/ai/canvas.d.ts.map +1 -0
- package/dist/molecules/ai/canvas.js +5 -0
- package/dist/molecules/ai/chain-of-thought.d.ts +30 -0
- package/dist/molecules/ai/chain-of-thought.d.ts.map +1 -0
- package/dist/molecules/ai/chain-of-thought.js +49 -0
- package/dist/molecules/ai/checkpoint.d.ts +12 -0
- package/dist/molecules/ai/checkpoint.d.ts.map +1 -0
- package/dist/molecules/ai/checkpoint.js +10 -0
- package/dist/molecules/ai/code-block.d.ts +46 -0
- package/dist/molecules/ai/code-block.d.ts.map +1 -0
- package/dist/molecules/ai/code-block.js +216 -0
- package/dist/molecules/ai/commit.d.ts +65 -0
- package/dist/molecules/ai/commit.d.ts.map +1 -0
- package/dist/molecules/ai/commit.js +95 -0
- package/dist/molecules/ai/confirmation.d.ts +50 -0
- package/dist/molecules/ai/confirmation.d.ts.map +1 -0
- package/dist/molecules/ai/confirmation.js +61 -0
- package/dist/molecules/ai/connection.d.ts +3 -0
- package/dist/molecules/ai/connection.d.ts.map +1 -0
- package/dist/molecules/ai/connection.js +3 -0
- package/dist/molecules/ai/context.d.ts +33 -0
- package/dist/molecules/ai/context.d.ts.map +1 -0
- package/dist/molecules/ai/context.js +164 -0
- package/dist/molecules/ai/controls.d.ts +5 -0
- package/dist/molecules/ai/controls.d.ts.map +1 -0
- package/dist/molecules/ai/controls.js +5 -0
- package/dist/molecules/ai/conversation.d.ts +24 -0
- package/dist/molecules/ai/conversation.d.ts.map +1 -0
- package/dist/molecules/ai/conversation.js +41 -0
- package/dist/molecules/ai/edge.d.ts +6 -0
- package/dist/molecules/ai/edge.d.ts.map +1 -0
- package/dist/molecules/ai/edge.js +87 -0
- package/dist/molecules/ai/environment-variables.d.ts +39 -0
- package/dist/molecules/ai/environment-variables.d.ts.map +1 -0
- package/dist/molecules/ai/environment-variables.js +87 -0
- package/dist/molecules/ai/file-tree.d.ts +27 -0
- package/dist/molecules/ai/file-tree.d.ts.map +1 -0
- package/dist/molecules/ai/file-tree.js +71 -0
- package/dist/molecules/ai/image.d.ts +7 -0
- package/dist/molecules/ai/image.d.ts.map +1 -0
- package/dist/molecules/ai/image.js +3 -0
- package/dist/molecules/ai/inline-citation.d.ts +39 -0
- package/dist/molecules/ai/inline-citation.d.ts.map +1 -0
- package/dist/molecules/ai/inline-citation.js +68 -0
- package/dist/molecules/ai/jsx-preview.d.ts +30 -0
- package/dist/molecules/ai/jsx-preview.d.ts.map +1 -0
- package/dist/molecules/ai/jsx-preview.js +167 -0
- package/dist/molecules/ai/loader.d.ts +6 -0
- package/dist/molecules/ai/loader.d.ts.map +1 -0
- package/dist/molecules/ai/loader.js +4 -0
- package/dist/molecules/ai/message.d.ts +38 -0
- package/dist/molecules/ai/message.d.ts.map +1 -0
- package/dist/molecules/ai/message.js +92 -0
- package/dist/molecules/ai/mic-selector.d.ts +46 -0
- package/dist/molecules/ai/mic-selector.d.ts.map +1 -0
- package/dist/molecules/ai/mic-selector.js +184 -0
- package/dist/molecules/ai/model-selector.d.ts +36 -0
- package/dist/molecules/ai/model-selector.d.ts.map +1 -0
- package/dist/molecules/ai/model-selector.js +18 -0
- package/dist/molecules/ai/node.d.ts +22 -0
- package/dist/molecules/ai/node.d.ts.map +1 -0
- package/dist/molecules/ai/node.js +11 -0
- package/dist/molecules/ai/open-in-chat.d.ts +29 -0
- package/dist/molecules/ai/open-in-chat.d.ts.map +1 -0
- package/dist/molecules/ai/open-in-chat.js +100 -0
- package/dist/molecules/ai/package-info.d.ts +30 -0
- package/dist/molecules/ai/package-info.d.ts.map +1 -0
- package/dist/molecules/ai/package-info.js +50 -0
- package/dist/molecules/ai/panel.d.ts +6 -0
- package/dist/molecules/ai/panel.d.ts.map +1 -0
- package/dist/molecules/ai/panel.js +4 -0
- package/dist/molecules/ai/persona.d.ts +49 -0
- package/dist/molecules/ai/persona.d.ts.map +1 -0
- package/dist/molecules/ai/persona.js +189 -0
- package/dist/molecules/ai/plan.d.ts +26 -0
- package/dist/molecules/ai/plan.d.ts.map +1 -0
- package/dist/molecules/ai/plan.js +34 -0
- package/dist/molecules/ai/prompt-input.d.ts +149 -0
- package/dist/molecules/ai/prompt-input.d.ts.map +1 -0
- package/dist/molecules/ai/prompt-input.js +702 -0
- package/dist/molecules/ai/queue.d.ts +62 -0
- package/dist/molecules/ai/queue.d.ts.map +1 -0
- package/dist/molecules/ai/queue.js +28 -0
- package/dist/molecules/ai/reasoning.d.ts +27 -0
- package/dist/molecules/ai/reasoning.d.ts.map +1 -0
- package/dist/molecules/ai/reasoning.js +95 -0
- package/dist/molecules/ai/response.d.ts +6 -0
- package/dist/molecules/ai/response.d.ts.map +1 -0
- package/dist/molecules/ai/response.js +18 -0
- package/dist/molecules/ai/sandbox.d.ts +25 -0
- package/dist/molecules/ai/sandbox.d.ts.map +1 -0
- package/dist/molecules/ai/sandbox.js +15 -0
- package/dist/molecules/ai/schema-display.d.ts +56 -0
- package/dist/molecules/ai/schema-display.d.ts.map +1 -0
- package/dist/molecules/ai/schema-display.js +73 -0
- package/dist/molecules/ai/shimmer.d.ts +10 -0
- package/dist/molecules/ai/shimmer.d.ts.map +1 -0
- package/dist/molecules/ai/shimmer.js +28 -0
- package/dist/molecules/ai/snippet.d.ts +19 -0
- package/dist/molecules/ai/snippet.d.ts.map +1 -0
- package/dist/molecules/ai/snippet.js +46 -0
- package/dist/molecules/ai/sources.d.ts +13 -0
- package/dist/molecules/ai/sources.d.ts.map +1 -0
- package/dist/molecules/ai/sources.js +9 -0
- package/dist/molecules/ai/speech-input.d.ts +55 -0
- package/dist/molecules/ai/speech-input.d.ts.map +1 -0
- package/dist/molecules/ai/speech-input.js +187 -0
- package/dist/molecules/ai/stack-trace.d.ts +38 -0
- package/dist/molecules/ai/stack-trace.d.ts.map +1 -0
- package/dist/molecules/ai/stack-trace.js +194 -0
- package/dist/molecules/ai/suggestion.d.ts +11 -0
- package/dist/molecules/ai/suggestion.d.ts.map +1 -0
- package/dist/molecules/ai/suggestion.js +13 -0
- package/dist/molecules/ai/task.d.ts +15 -0
- package/dist/molecules/ai/task.d.ts.map +1 -0
- package/dist/molecules/ai/task.js +10 -0
- package/dist/molecules/ai/terminal.d.ts +28 -0
- package/dist/molecules/ai/terminal.d.ts.map +1 -0
- package/dist/molecules/ai/terminal.js +68 -0
- package/dist/molecules/ai/test-results.d.ts +59 -0
- package/dist/molecules/ai/test-results.d.ts.map +1 -0
- package/dist/molecules/ai/test-results.js +97 -0
- package/dist/molecules/ai/tool.d.ts +32 -0
- package/dist/molecules/ai/tool.d.ts.map +1 -0
- package/dist/molecules/ai/tool.js +49 -0
- package/dist/molecules/ai/toolbar.d.ts +6 -0
- package/dist/molecules/ai/toolbar.d.ts.map +1 -0
- package/dist/molecules/ai/toolbar.js +4 -0
- package/dist/molecules/ai/transcription.d.ts +17 -0
- package/dist/molecules/ai/transcription.d.ts.map +1 -0
- package/dist/molecules/ai/transcription.js +36 -0
- package/dist/molecules/ai/voice-selector.d.ts +64 -0
- package/dist/molecules/ai/voice-selector.d.ts.map +1 -0
- package/dist/molecules/ai/voice-selector.js +224 -0
- package/dist/molecules/ai/web-preview.d.ts +35 -0
- package/dist/molecules/ai/web-preview.d.ts.map +1 -0
- package/dist/molecules/ai/web-preview.js +65 -0
- package/dist/molecules/artifact.d.ts +24 -0
- package/dist/molecules/artifact.d.ts.map +1 -0
- package/dist/molecules/artifact.js +20 -0
- package/dist/molecules/attachments.d.ts +55 -0
- package/dist/molecules/attachments.d.ts.map +1 -0
- package/dist/molecules/attachments.js +125 -0
- package/dist/molecules/audio-player.d.ts +30 -0
- package/dist/molecules/audio-player.d.ts.map +1 -0
- package/dist/molecules/audio-player.js +43 -0
- package/dist/molecules/canvas.d.ts +9 -0
- package/dist/molecules/canvas.d.ts.map +1 -0
- package/dist/molecules/canvas.js +5 -0
- package/dist/molecules/chain-of-thought.d.ts +30 -0
- package/dist/molecules/chain-of-thought.d.ts.map +1 -0
- package/dist/molecules/chain-of-thought.js +49 -0
- package/dist/molecules/chat-message.d.ts +10 -0
- package/dist/molecules/chat-message.d.ts.map +1 -0
- package/dist/molecules/chat-message.js +53 -0
- package/dist/molecules/checkpoint.d.ts +12 -0
- package/dist/molecules/checkpoint.d.ts.map +1 -0
- package/dist/molecules/checkpoint.js +10 -0
- package/dist/molecules/code-block.d.ts +46 -0
- package/dist/molecules/code-block.d.ts.map +1 -0
- package/dist/molecules/code-block.js +216 -0
- package/dist/molecules/commit.d.ts +65 -0
- package/dist/molecules/commit.d.ts.map +1 -0
- package/dist/molecules/commit.js +95 -0
- package/dist/molecules/confirmation.d.ts +50 -0
- package/dist/molecules/confirmation.d.ts.map +1 -0
- package/dist/molecules/confirmation.js +61 -0
- package/dist/molecules/connection.d.ts +3 -0
- package/dist/molecules/connection.d.ts.map +1 -0
- package/dist/molecules/connection.js +3 -0
- package/dist/molecules/context.d.ts +33 -0
- package/dist/molecules/context.d.ts.map +1 -0
- package/dist/molecules/context.js +164 -0
- package/dist/molecules/controls.d.ts +5 -0
- package/dist/molecules/controls.d.ts.map +1 -0
- package/dist/molecules/controls.js +5 -0
- package/dist/molecules/conversation.d.ts +24 -0
- package/dist/molecules/conversation.d.ts.map +1 -0
- package/dist/molecules/conversation.js +41 -0
- package/dist/molecules/edge.d.ts +6 -0
- package/dist/molecules/edge.d.ts.map +1 -0
- package/dist/molecules/edge.js +87 -0
- package/dist/molecules/environment-variables.d.ts +39 -0
- package/dist/molecules/environment-variables.d.ts.map +1 -0
- package/dist/molecules/environment-variables.js +87 -0
- package/dist/molecules/file-tree.d.ts +27 -0
- package/dist/molecules/file-tree.d.ts.map +1 -0
- package/dist/molecules/file-tree.js +71 -0
- package/dist/molecules/image.d.ts +7 -0
- package/dist/molecules/image.d.ts.map +1 -0
- package/dist/molecules/image.js +3 -0
- package/dist/molecules/inline-citation.d.ts +39 -0
- package/dist/molecules/inline-citation.d.ts.map +1 -0
- package/dist/molecules/inline-citation.js +68 -0
- package/dist/molecules/jsx-preview.d.ts +30 -0
- package/dist/molecules/jsx-preview.d.ts.map +1 -0
- package/dist/molecules/jsx-preview.js +167 -0
- package/dist/molecules/loader.d.ts +6 -0
- package/dist/molecules/loader.d.ts.map +1 -0
- package/dist/molecules/loader.js +4 -0
- package/dist/molecules/message.d.ts +38 -0
- package/dist/molecules/message.d.ts.map +1 -0
- package/dist/molecules/message.js +92 -0
- package/dist/molecules/mic-selector.d.ts +46 -0
- package/dist/molecules/mic-selector.d.ts.map +1 -0
- package/dist/molecules/mic-selector.js +184 -0
- package/dist/molecules/model-selector.d.ts +36 -0
- package/dist/molecules/model-selector.d.ts.map +1 -0
- package/dist/molecules/model-selector.js +18 -0
- package/dist/molecules/node.d.ts +22 -0
- package/dist/molecules/node.d.ts.map +1 -0
- package/dist/molecules/node.js +11 -0
- package/dist/molecules/open-in-chat.d.ts +29 -0
- package/dist/molecules/open-in-chat.d.ts.map +1 -0
- package/dist/molecules/open-in-chat.js +100 -0
- package/dist/molecules/package-info.d.ts +30 -0
- package/dist/molecules/package-info.d.ts.map +1 -0
- package/dist/molecules/package-info.js +50 -0
- package/dist/molecules/panel.d.ts +6 -0
- package/dist/molecules/panel.d.ts.map +1 -0
- package/dist/molecules/panel.js +4 -0
- package/dist/molecules/persona.d.ts +49 -0
- package/dist/molecules/persona.d.ts.map +1 -0
- package/dist/molecules/persona.js +189 -0
- package/dist/molecules/plan.d.ts +26 -0
- package/dist/molecules/plan.d.ts.map +1 -0
- package/dist/molecules/plan.js +34 -0
- package/dist/molecules/prompt-input.d.ts +149 -0
- package/dist/molecules/prompt-input.d.ts.map +1 -0
- package/dist/molecules/prompt-input.js +702 -0
- package/dist/molecules/queue.d.ts +62 -0
- package/dist/molecules/queue.d.ts.map +1 -0
- package/dist/molecules/queue.js +28 -0
- package/dist/molecules/reasoning.d.ts +27 -0
- package/dist/molecules/reasoning.d.ts.map +1 -0
- package/dist/molecules/reasoning.js +95 -0
- package/dist/molecules/response.d.ts +6 -0
- package/dist/molecules/response.d.ts.map +1 -0
- package/dist/molecules/response.js +18 -0
- package/dist/molecules/responsive-alert-dialog.d.ts +16 -0
- package/dist/molecules/responsive-alert-dialog.d.ts.map +1 -0
- package/dist/molecules/responsive-alert-dialog.js +20 -0
- package/dist/molecules/responsive-dialog.d.ts +11 -0
- package/dist/molecules/responsive-dialog.d.ts.map +1 -0
- package/dist/molecules/responsive-dialog.js +21 -0
- package/dist/molecules/sandbox.d.ts +25 -0
- package/dist/molecules/sandbox.d.ts.map +1 -0
- package/dist/molecules/sandbox.js +15 -0
- package/dist/molecules/schema-display.d.ts +56 -0
- package/dist/molecules/schema-display.d.ts.map +1 -0
- package/dist/molecules/schema-display.js +73 -0
- package/dist/molecules/shimmer.d.ts +10 -0
- package/dist/molecules/shimmer.d.ts.map +1 -0
- package/dist/molecules/shimmer.js +28 -0
- package/dist/molecules/snippet.d.ts +19 -0
- package/dist/molecules/snippet.d.ts.map +1 -0
- package/dist/molecules/snippet.js +46 -0
- package/dist/molecules/sources.d.ts +13 -0
- package/dist/molecules/sources.d.ts.map +1 -0
- package/dist/molecules/sources.js +9 -0
- package/dist/molecules/speech-input.d.ts +55 -0
- package/dist/molecules/speech-input.d.ts.map +1 -0
- package/dist/molecules/speech-input.js +187 -0
- package/dist/molecules/stack-trace.d.ts +38 -0
- package/dist/molecules/stack-trace.d.ts.map +1 -0
- package/dist/molecules/stack-trace.js +194 -0
- package/dist/molecules/suggestion.d.ts +11 -0
- package/dist/molecules/suggestion.d.ts.map +1 -0
- package/dist/molecules/suggestion.js +13 -0
- package/dist/molecules/task.d.ts +15 -0
- package/dist/molecules/task.d.ts.map +1 -0
- package/dist/molecules/task.js +10 -0
- package/dist/molecules/terminal.d.ts +28 -0
- package/dist/molecules/terminal.d.ts.map +1 -0
- package/dist/molecules/terminal.js +68 -0
- package/dist/molecules/test-results.d.ts +59 -0
- package/dist/molecules/test-results.d.ts.map +1 -0
- package/dist/molecules/test-results.js +97 -0
- package/dist/molecules/tool.d.ts +32 -0
- package/dist/molecules/tool.d.ts.map +1 -0
- package/dist/molecules/tool.js +49 -0
- package/dist/molecules/toolbar.d.ts +6 -0
- package/dist/molecules/toolbar.d.ts.map +1 -0
- package/dist/molecules/toolbar.js +4 -0
- package/dist/molecules/transcription.d.ts +17 -0
- package/dist/molecules/transcription.d.ts.map +1 -0
- package/dist/molecules/transcription.js +36 -0
- package/dist/molecules/voice-selector.d.ts +64 -0
- package/dist/molecules/voice-selector.d.ts.map +1 -0
- package/dist/molecules/voice-selector.js +224 -0
- package/dist/molecules/web-preview.d.ts +35 -0
- package/dist/molecules/web-preview.d.ts.map +1 -0
- package/dist/molecules/web-preview.js +65 -0
- package/package.json +27 -8
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Avatar, AvatarFallback } from "@chatsdk-dev/ui/components/avatar";
|
|
4
|
+
import { Button } from "@chatsdk-dev/ui/components/button";
|
|
5
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@chatsdk-dev/ui/components/collapsible";
|
|
6
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
7
|
+
import { CheckIcon, CopyIcon, FileIcon, GitCommitIcon, MinusIcon, PlusIcon, } from "lucide-react";
|
|
8
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
9
|
+
export const Commit = ({ className, children, ...props }) => (_jsx(Collapsible, { className: cn("rounded-lg border bg-background", className), ...props, children: children }));
|
|
10
|
+
export const CommitHeader = ({ className, children, ...props }) => (_jsx(CollapsibleTrigger, { render: () => (_jsx("div", { className: cn("group flex cursor-pointer items-center justify-between gap-4 p-3 text-left transition-colors hover:opacity-80", className), children: children })) }));
|
|
11
|
+
export const CommitHash = ({ className, children, ...props }) => (_jsxs("span", { className: cn("font-mono text-xs", className), ...props, children: [_jsx(GitCommitIcon, { className: "mr-1 inline-block size-3" }), children] }));
|
|
12
|
+
export const CommitMessage = ({ className, children, ...props }) => (_jsx("span", { className: cn("font-medium text-sm", className), ...props, children: children }));
|
|
13
|
+
export const CommitMetadata = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex items-center gap-2 text-muted-foreground text-xs", className), ...props, children: children }));
|
|
14
|
+
export const CommitSeparator = ({ className, children, ...props }) => (_jsx("span", { className: className, ...props, children: children ?? "•" }));
|
|
15
|
+
export const CommitInfo = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex flex-1 flex-col", className), ...props, children: children }));
|
|
16
|
+
export const CommitAuthor = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex items-center", className), ...props, children: children }));
|
|
17
|
+
export const CommitAuthorAvatar = ({ initials, className, ...props }) => (_jsx(Avatar, { className: cn("size-8", className), ...props, children: _jsx(AvatarFallback, { className: "text-xs", children: initials }) }));
|
|
18
|
+
const relativeTimeFormat = new Intl.RelativeTimeFormat("en", {
|
|
19
|
+
numeric: "auto",
|
|
20
|
+
});
|
|
21
|
+
const formatRelativeDate = (date) => {
|
|
22
|
+
const days = Math.round((date.getTime() - Date.now()) / (1000 * 60 * 60 * 24));
|
|
23
|
+
return relativeTimeFormat.format(days, "day");
|
|
24
|
+
};
|
|
25
|
+
export const CommitTimestamp = ({ date, className, children, ...props }) => {
|
|
26
|
+
const [formatted, setFormatted] = useState("");
|
|
27
|
+
const updateFormatted = useCallback(() => {
|
|
28
|
+
setFormatted(formatRelativeDate(date));
|
|
29
|
+
}, [date]);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
updateFormatted();
|
|
32
|
+
}, [updateFormatted]);
|
|
33
|
+
return (_jsx("time", { className: cn("text-xs", className), dateTime: date.toISOString(), ...props, children: children ?? formatted }));
|
|
34
|
+
};
|
|
35
|
+
const handleActionsClick = (e) => e.stopPropagation();
|
|
36
|
+
const handleActionsKeyDown = (e) => e.stopPropagation();
|
|
37
|
+
export const CommitActions = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex items-center gap-1", className), onClick: handleActionsClick, onKeyDown: handleActionsKeyDown, role: "group", ...props, children: children }));
|
|
38
|
+
export const CommitCopyButton = ({ hash, onCopy, onError, timeout = 2000, children, className, ...props }) => {
|
|
39
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
40
|
+
const timeoutRef = useRef(0);
|
|
41
|
+
const copyToClipboard = useCallback(async () => {
|
|
42
|
+
if (typeof window === "undefined" || !navigator?.clipboard?.writeText) {
|
|
43
|
+
onError?.(new Error("Clipboard API not available"));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
if (!isCopied) {
|
|
48
|
+
await navigator.clipboard.writeText(hash);
|
|
49
|
+
setIsCopied(true);
|
|
50
|
+
onCopy?.();
|
|
51
|
+
timeoutRef.current = window.setTimeout(() => setIsCopied(false), timeout);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
onError?.(error);
|
|
56
|
+
}
|
|
57
|
+
}, [hash, onCopy, onError, timeout, isCopied]);
|
|
58
|
+
useEffect(() => () => {
|
|
59
|
+
window.clearTimeout(timeoutRef.current);
|
|
60
|
+
}, []);
|
|
61
|
+
const Icon = isCopied ? CheckIcon : CopyIcon;
|
|
62
|
+
return (_jsx(Button, { className: cn("size-7 shrink-0", className), onClick: copyToClipboard, size: "icon", variant: "ghost", ...props, children: children ?? _jsx(Icon, { size: 14 }) }));
|
|
63
|
+
};
|
|
64
|
+
export const CommitContent = ({ className, children, ...props }) => (_jsx(CollapsibleContent, { className: cn("border-t p-3", className), ...props, children: children }));
|
|
65
|
+
export const CommitFiles = ({ className, children, ...props }) => (_jsx("div", { className: cn("space-y-1", className), ...props, children: children }));
|
|
66
|
+
export const CommitFile = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex items-center justify-between gap-2 rounded px-2 py-1 text-sm hover:bg-muted/50", className), ...props, children: children }));
|
|
67
|
+
export const CommitFileInfo = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex min-w-0 items-center gap-2", className), ...props, children: children }));
|
|
68
|
+
const fileStatusStyles = {
|
|
69
|
+
added: "text-green-600 dark:text-green-400",
|
|
70
|
+
deleted: "text-red-600 dark:text-red-400",
|
|
71
|
+
modified: "text-yellow-600 dark:text-yellow-400",
|
|
72
|
+
renamed: "text-blue-600 dark:text-blue-400",
|
|
73
|
+
};
|
|
74
|
+
const fileStatusLabels = {
|
|
75
|
+
added: "A",
|
|
76
|
+
deleted: "D",
|
|
77
|
+
modified: "M",
|
|
78
|
+
renamed: "R",
|
|
79
|
+
};
|
|
80
|
+
export const CommitFileStatus = ({ status, className, children, ...props }) => (_jsx("span", { className: cn("font-medium font-mono text-xs", fileStatusStyles[status], className), ...props, children: children ?? fileStatusLabels[status] }));
|
|
81
|
+
export const CommitFileIcon = ({ className, ...props }) => (_jsx(FileIcon, { className: cn("size-3.5 shrink-0 text-muted-foreground", className), ...props }));
|
|
82
|
+
export const CommitFilePath = ({ className, children, ...props }) => (_jsx("span", { className: cn("truncate font-mono text-xs", className), ...props, children: children }));
|
|
83
|
+
export const CommitFileChanges = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex shrink-0 items-center gap-1 font-mono text-xs", className), ...props, children: children }));
|
|
84
|
+
export const CommitFileAdditions = ({ count, className, children, ...props }) => {
|
|
85
|
+
if (count <= 0) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
return (_jsx("span", { className: cn("text-green-600 dark:text-green-400", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx(PlusIcon, { className: "inline-block size-3" }), count] })) }));
|
|
89
|
+
};
|
|
90
|
+
export const CommitFileDeletions = ({ count, className, children, ...props }) => {
|
|
91
|
+
if (count <= 0) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return (_jsx("span", { className: cn("text-red-600 dark:text-red-400", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx(MinusIcon, { className: "inline-block size-3" }), count] })) }));
|
|
95
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Alert, AlertDescription } from "@chatsdk-dev/ui/components/alert";
|
|
2
|
+
import { Button } from "@chatsdk-dev/ui/components/button";
|
|
3
|
+
import type { ToolUIPart } from "ai";
|
|
4
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
5
|
+
type ToolUIPartApproval = {
|
|
6
|
+
id: string;
|
|
7
|
+
approved?: never;
|
|
8
|
+
reason?: never;
|
|
9
|
+
} | {
|
|
10
|
+
id: string;
|
|
11
|
+
approved: boolean;
|
|
12
|
+
reason?: string;
|
|
13
|
+
} | {
|
|
14
|
+
id: string;
|
|
15
|
+
approved: true;
|
|
16
|
+
reason?: string;
|
|
17
|
+
} | {
|
|
18
|
+
id: string;
|
|
19
|
+
approved: true;
|
|
20
|
+
reason?: string;
|
|
21
|
+
} | {
|
|
22
|
+
id: string;
|
|
23
|
+
approved: false;
|
|
24
|
+
reason?: string;
|
|
25
|
+
} | undefined;
|
|
26
|
+
export type ConfirmationProps = ComponentProps<typeof Alert> & {
|
|
27
|
+
approval?: ToolUIPartApproval;
|
|
28
|
+
state: ToolUIPart["state"];
|
|
29
|
+
};
|
|
30
|
+
export declare const Confirmation: ({ className, approval, state, ...props }: ConfirmationProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
31
|
+
export type ConfirmationTitleProps = ComponentProps<typeof AlertDescription>;
|
|
32
|
+
export declare const ConfirmationTitle: ({ className, ...props }: ConfirmationTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export interface ConfirmationRequestProps {
|
|
34
|
+
children?: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
export declare const ConfirmationRequest: ({ children }: ConfirmationRequestProps) => ReactNode;
|
|
37
|
+
export interface ConfirmationAcceptedProps {
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
}
|
|
40
|
+
export declare const ConfirmationAccepted: ({ children, }: ConfirmationAcceptedProps) => ReactNode;
|
|
41
|
+
export interface ConfirmationRejectedProps {
|
|
42
|
+
children?: ReactNode;
|
|
43
|
+
}
|
|
44
|
+
export declare const ConfirmationRejected: ({ children, }: ConfirmationRejectedProps) => ReactNode;
|
|
45
|
+
export type ConfirmationActionsProps = ComponentProps<"div">;
|
|
46
|
+
export declare const ConfirmationActions: ({ className, ...props }: ConfirmationActionsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
47
|
+
export type ConfirmationActionProps = ComponentProps<typeof Button>;
|
|
48
|
+
export declare const ConfirmationAction: (props: ConfirmationActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=confirmation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation.d.ts","sourceRoot":"","sources":["../../src/molecules/confirmation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,KAAK,kBAAkB,GACnB;IACE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB,GACD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,IAAI,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,IAAI,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD,SAAS,CAAC;AAqBd,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,KAAK,CAAC,GAAG;IAC7D,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,0CAK1B,iBAAiB,mDAYnB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE7E,eAAO,MAAM,iBAAiB,GAAI,yBAG/B,sBAAsB,4CAExB,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,GAAI,cAAc,wBAAwB,cASzE,CAAC;AAEF,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,oBAAoB,GAAI,eAElC,yBAAyB,cAc3B,CAAC;AAEF,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,oBAAoB,GAAI,eAElC,yBAAyB,cAc3B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE7D,eAAO,MAAM,mBAAmB,GAAI,yBAGjC,wBAAwB,mDAc1B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,kBAAkB,GAAI,OAAO,uBAAuB,4CAEhE,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Alert, AlertDescription } from "@chatsdk-dev/ui/components/alert";
|
|
4
|
+
import { Button } from "@chatsdk-dev/ui/components/button";
|
|
5
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
6
|
+
import { createContext, useContext, useMemo } from "react";
|
|
7
|
+
const ConfirmationContext = createContext(null);
|
|
8
|
+
const useConfirmation = () => {
|
|
9
|
+
const context = useContext(ConfirmationContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error("Confirmation components must be used within Confirmation");
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
15
|
+
export const Confirmation = ({ className, approval, state, ...props }) => {
|
|
16
|
+
const contextValue = useMemo(() => ({ approval, state }), [approval, state]);
|
|
17
|
+
if (!approval || state === "input-streaming" || state === "input-available") {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return (_jsx(ConfirmationContext.Provider, { value: contextValue, children: _jsx(Alert, { className: cn("flex flex-col gap-2", className), ...props }) }));
|
|
21
|
+
};
|
|
22
|
+
export const ConfirmationTitle = ({ className, ...props }) => (_jsx(AlertDescription, { className: cn("inline", className), ...props }));
|
|
23
|
+
export const ConfirmationRequest = ({ children }) => {
|
|
24
|
+
const { state } = useConfirmation();
|
|
25
|
+
// Only show when approval is requested
|
|
26
|
+
if (state !== "approval-requested") {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return children;
|
|
30
|
+
};
|
|
31
|
+
export const ConfirmationAccepted = ({ children, }) => {
|
|
32
|
+
const { approval, state } = useConfirmation();
|
|
33
|
+
// Only show when approved and in response states
|
|
34
|
+
if (!approval?.approved ||
|
|
35
|
+
(state !== "approval-responded" &&
|
|
36
|
+
state !== "output-denied" &&
|
|
37
|
+
state !== "output-available")) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return children;
|
|
41
|
+
};
|
|
42
|
+
export const ConfirmationRejected = ({ children, }) => {
|
|
43
|
+
const { approval, state } = useConfirmation();
|
|
44
|
+
// Only show when rejected and in response states
|
|
45
|
+
if (approval?.approved !== false ||
|
|
46
|
+
(state !== "approval-responded" &&
|
|
47
|
+
state !== "output-denied" &&
|
|
48
|
+
state !== "output-available")) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return children;
|
|
52
|
+
};
|
|
53
|
+
export const ConfirmationActions = ({ className, ...props }) => {
|
|
54
|
+
const { state } = useConfirmation();
|
|
55
|
+
// Only show when approval is requested
|
|
56
|
+
if (state !== "approval-requested") {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return (_jsx("div", { className: cn("flex items-center justify-end gap-2 self-end", className), ...props }));
|
|
60
|
+
};
|
|
61
|
+
export const ConfirmationAction = (props) => (_jsx(Button, { className: "h-8 px-3 text-sm", type: "button", ...props }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/molecules/connection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAI7D,eAAO,MAAM,UAAU,EAAE,uBAuBxB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const HALF = 0.5;
|
|
3
|
+
export const Connection = ({ fromX, fromY, toX, toY, }) => (_jsxs("g", { children: [_jsx("path", { className: "animated", d: `M${fromX},${fromY} C ${fromX + (toX - fromX) * HALF},${fromY} ${fromX + (toX - fromX) * HALF},${toY} ${toX},${toY}`, fill: "none", stroke: "var(--color-ring)", strokeWidth: 1 }), _jsx("circle", { cx: toX, cy: toY, fill: "#fff", r: 3, stroke: "var(--color-ring)", strokeWidth: 1 })] }));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Button } from "@chatsdk-dev/ui/components/button";
|
|
2
|
+
import { HoverCard, HoverCardContent } from "@chatsdk-dev/ui/components/hover-card";
|
|
3
|
+
import type { LanguageModelUsage } from "ai";
|
|
4
|
+
import type { ComponentProps } from "react";
|
|
5
|
+
type ModelId = string;
|
|
6
|
+
interface ContextSchema {
|
|
7
|
+
usedTokens: number;
|
|
8
|
+
maxTokens: number;
|
|
9
|
+
usage?: LanguageModelUsage;
|
|
10
|
+
modelId?: ModelId;
|
|
11
|
+
}
|
|
12
|
+
export type ContextProps = ComponentProps<typeof HoverCard> & ContextSchema;
|
|
13
|
+
export declare const Context: ({ usedTokens, maxTokens, usage, modelId, ...props }: ContextProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export type ContextTriggerProps = ComponentProps<typeof Button>;
|
|
15
|
+
export declare const ContextTrigger: ({ children, ...props }: ContextTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export type ContextContentProps = ComponentProps<typeof HoverCardContent>;
|
|
17
|
+
export declare const ContextContent: ({ className, ...props }: ContextContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export type ContextContentHeaderProps = ComponentProps<"div">;
|
|
19
|
+
export declare const ContextContentHeader: ({ children, className, ...props }: ContextContentHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export type ContextContentBodyProps = ComponentProps<"div">;
|
|
21
|
+
export declare const ContextContentBody: ({ children, className, ...props }: ContextContentBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export type ContextContentFooterProps = ComponentProps<"div">;
|
|
23
|
+
export declare const ContextContentFooter: ({ children, className, ...props }: ContextContentFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export type ContextInputUsageProps = ComponentProps<"div">;
|
|
25
|
+
export declare const ContextInputUsage: ({ className, children, ...props }: ContextInputUsageProps) => string | number | bigint | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
|
|
26
|
+
export type ContextOutputUsageProps = ComponentProps<"div">;
|
|
27
|
+
export declare const ContextOutputUsage: ({ className, children, ...props }: ContextOutputUsageProps) => string | number | bigint | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
|
|
28
|
+
export type ContextReasoningUsageProps = ComponentProps<"div">;
|
|
29
|
+
export declare const ContextReasoningUsage: ({ className, children, ...props }: ContextReasoningUsageProps) => string | number | bigint | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
|
|
30
|
+
export type ContextCacheUsageProps = ComponentProps<"div">;
|
|
31
|
+
export declare const ContextCacheUsage: ({ className, children, ...props }: ContextCacheUsageProps) => string | number | bigint | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/molecules/context.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EACL,SAAS,EACT,gBAAgB,EAEjB,MAAM,uCAAuC,CAAC;AAG/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,IAAI,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAU5C,KAAK,OAAO,GAAG,MAAM,CAAC;AAEtB,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAcD,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG,aAAa,CAAC;AAE5E,eAAO,MAAM,OAAO,GAAI,qDAMrB,YAAY,4CAWd,CAAC;AA2CF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAEhE,eAAO,MAAM,cAAc,GAAI,wBAAwB,mBAAmB,4CAwBzE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1E,eAAO,MAAM,cAAc,GAAI,yBAG5B,mBAAmB,4CAKrB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE9D,eAAO,MAAM,oBAAoB,GAAI,mCAIlC,yBAAyB,4CA+B3B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE5D,eAAO,MAAM,kBAAkB,GAAI,mCAIhC,uBAAuB,4CAIzB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE9D,eAAO,MAAM,oBAAoB,GAAI,mCAIlC,yBAAyB,4CAgC3B,CAAC;AAqBF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE3D,eAAO,MAAM,iBAAiB,GAAI,mCAI/B,sBAAsB,6VAgCxB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE5D,eAAO,MAAM,kBAAkB,GAAI,mCAIhC,uBAAuB,6VAgCzB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE/D,eAAO,MAAM,qBAAqB,GAAI,mCAInC,0BAA0B,6VAgC5B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE3D,eAAO,MAAM,iBAAiB,GAAI,mCAI/B,sBAAsB,6VAgCxB,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "@chatsdk-dev/ui/components/button";
|
|
4
|
+
import { HoverCard, HoverCardContent, HoverCardTrigger, } from "@chatsdk-dev/ui/components/hover-card";
|
|
5
|
+
import { Progress } from "@chatsdk-dev/ui/components/progress";
|
|
6
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
7
|
+
import { createContext, useContext, useMemo } from "react";
|
|
8
|
+
import { getUsage } from "tokenlens";
|
|
9
|
+
const PERCENT_MAX = 100;
|
|
10
|
+
const ICON_RADIUS = 10;
|
|
11
|
+
const ICON_VIEWBOX = 24;
|
|
12
|
+
const ICON_CENTER = 12;
|
|
13
|
+
const ICON_STROKE_WIDTH = 2;
|
|
14
|
+
const ContextContext = createContext(null);
|
|
15
|
+
const useContextValue = () => {
|
|
16
|
+
const context = useContext(ContextContext);
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error("Context components must be used within Context");
|
|
19
|
+
}
|
|
20
|
+
return context;
|
|
21
|
+
};
|
|
22
|
+
export const Context = ({ usedTokens, maxTokens, usage, modelId, ...props }) => {
|
|
23
|
+
const contextValue = useMemo(() => ({ maxTokens, modelId, usage, usedTokens }), [maxTokens, modelId, usage, usedTokens]);
|
|
24
|
+
return (_jsx(ContextContext.Provider, { value: contextValue, children: _jsx(HoverCard, { ...props }) }));
|
|
25
|
+
};
|
|
26
|
+
const ContextIcon = () => {
|
|
27
|
+
const { usedTokens, maxTokens } = useContextValue();
|
|
28
|
+
const circumference = 2 * Math.PI * ICON_RADIUS;
|
|
29
|
+
const usedPercent = usedTokens / maxTokens;
|
|
30
|
+
const dashOffset = circumference * (1 - usedPercent);
|
|
31
|
+
return (_jsxs("svg", { "aria-label": "Model context usage", height: "20", role: "img", style: { color: "currentcolor" }, viewBox: `0 0 ${ICON_VIEWBOX} ${ICON_VIEWBOX}`, width: "20", children: [_jsx("circle", { cx: ICON_CENTER, cy: ICON_CENTER, fill: "none", opacity: "0.25", r: ICON_RADIUS, stroke: "currentColor", strokeWidth: ICON_STROKE_WIDTH }), _jsx("circle", { cx: ICON_CENTER, cy: ICON_CENTER, fill: "none", opacity: "0.7", r: ICON_RADIUS, stroke: "currentColor", strokeDasharray: `${circumference} ${circumference}`, strokeDashoffset: dashOffset, strokeLinecap: "round", strokeWidth: ICON_STROKE_WIDTH, style: { transform: "rotate(-90deg)", transformOrigin: "center" } })] }));
|
|
32
|
+
};
|
|
33
|
+
export const ContextTrigger = ({ children, ...props }) => {
|
|
34
|
+
const { usedTokens, maxTokens } = useContextValue();
|
|
35
|
+
const usedPercent = usedTokens / maxTokens;
|
|
36
|
+
const renderedPercent = new Intl.NumberFormat("en-US", {
|
|
37
|
+
maximumFractionDigits: 1,
|
|
38
|
+
style: "percent",
|
|
39
|
+
}).format(usedPercent);
|
|
40
|
+
return (_jsx(HoverCardTrigger, { render: () => children ? (_jsx(_Fragment, { children: children })) : (_jsxs(Button, { type: "button", variant: "ghost", ...props, children: [_jsx("span", { className: "font-medium text-muted-foreground", children: renderedPercent }), _jsx(ContextIcon, {})] })) }));
|
|
41
|
+
};
|
|
42
|
+
export const ContextContent = ({ className, ...props }) => (_jsx(HoverCardContent, { className: cn("min-w-60 divide-y overflow-hidden p-0", className), ...props }));
|
|
43
|
+
export const ContextContentHeader = ({ children, className, ...props }) => {
|
|
44
|
+
const { usedTokens, maxTokens } = useContextValue();
|
|
45
|
+
const usedPercent = usedTokens / maxTokens;
|
|
46
|
+
const displayPct = new Intl.NumberFormat("en-US", {
|
|
47
|
+
maximumFractionDigits: 1,
|
|
48
|
+
style: "percent",
|
|
49
|
+
}).format(usedPercent);
|
|
50
|
+
const used = new Intl.NumberFormat("en-US", {
|
|
51
|
+
notation: "compact",
|
|
52
|
+
}).format(usedTokens);
|
|
53
|
+
const total = new Intl.NumberFormat("en-US", {
|
|
54
|
+
notation: "compact",
|
|
55
|
+
}).format(maxTokens);
|
|
56
|
+
return (_jsx("div", { className: cn("w-full space-y-2 p-3", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between gap-3 text-xs", children: [_jsx("p", { children: displayPct }), _jsxs("p", { className: "font-mono text-muted-foreground", children: [used, " / ", total] })] }), _jsx("div", { className: "space-y-2", children: _jsx(Progress, { className: "bg-muted", value: usedPercent * PERCENT_MAX }) })] })) }));
|
|
57
|
+
};
|
|
58
|
+
export const ContextContentBody = ({ children, className, ...props }) => (_jsx("div", { className: cn("w-full p-3", className), ...props, children: children }));
|
|
59
|
+
export const ContextContentFooter = ({ children, className, ...props }) => {
|
|
60
|
+
const { modelId, usage } = useContextValue();
|
|
61
|
+
const costUSD = modelId
|
|
62
|
+
? getUsage({
|
|
63
|
+
modelId,
|
|
64
|
+
usage: {
|
|
65
|
+
input: usage?.inputTokens ?? 0,
|
|
66
|
+
output: usage?.outputTokens ?? 0,
|
|
67
|
+
},
|
|
68
|
+
}).costUSD?.totalUSD
|
|
69
|
+
: undefined;
|
|
70
|
+
const totalCost = new Intl.NumberFormat("en-US", {
|
|
71
|
+
currency: "USD",
|
|
72
|
+
style: "currency",
|
|
73
|
+
}).format(costUSD ?? 0);
|
|
74
|
+
return (_jsx("div", { className: cn("flex w-full items-center justify-between gap-3 bg-secondary p-3 text-xs", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-muted-foreground", children: "Total cost" }), _jsx("span", { children: totalCost })] })) }));
|
|
75
|
+
};
|
|
76
|
+
const TokensWithCost = ({ tokens, costText, }) => (_jsxs("span", { children: [tokens === undefined
|
|
77
|
+
? "—"
|
|
78
|
+
: new Intl.NumberFormat("en-US", {
|
|
79
|
+
notation: "compact",
|
|
80
|
+
}).format(tokens), costText ? (_jsxs("span", { className: "ml-2 text-muted-foreground", children: ["\u2022 ", costText] })) : null] }));
|
|
81
|
+
export const ContextInputUsage = ({ className, children, ...props }) => {
|
|
82
|
+
const { usage, modelId } = useContextValue();
|
|
83
|
+
const inputTokens = usage?.inputTokens ?? 0;
|
|
84
|
+
if (children) {
|
|
85
|
+
return children;
|
|
86
|
+
}
|
|
87
|
+
if (!inputTokens) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const inputCost = modelId
|
|
91
|
+
? getUsage({
|
|
92
|
+
modelId,
|
|
93
|
+
usage: { input: inputTokens, output: 0 },
|
|
94
|
+
}).costUSD?.totalUSD
|
|
95
|
+
: undefined;
|
|
96
|
+
const inputCostText = new Intl.NumberFormat("en-US", {
|
|
97
|
+
currency: "USD",
|
|
98
|
+
style: "currency",
|
|
99
|
+
}).format(inputCost ?? 0);
|
|
100
|
+
return (_jsxs("div", { className: cn("flex items-center justify-between text-xs", className), ...props, children: [_jsx("span", { className: "text-muted-foreground", children: "Input" }), _jsx(TokensWithCost, { costText: inputCostText, tokens: inputTokens })] }));
|
|
101
|
+
};
|
|
102
|
+
export const ContextOutputUsage = ({ className, children, ...props }) => {
|
|
103
|
+
const { usage, modelId } = useContextValue();
|
|
104
|
+
const outputTokens = usage?.outputTokens ?? 0;
|
|
105
|
+
if (children) {
|
|
106
|
+
return children;
|
|
107
|
+
}
|
|
108
|
+
if (!outputTokens) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const outputCost = modelId
|
|
112
|
+
? getUsage({
|
|
113
|
+
modelId,
|
|
114
|
+
usage: { input: 0, output: outputTokens },
|
|
115
|
+
}).costUSD?.totalUSD
|
|
116
|
+
: undefined;
|
|
117
|
+
const outputCostText = new Intl.NumberFormat("en-US", {
|
|
118
|
+
currency: "USD",
|
|
119
|
+
style: "currency",
|
|
120
|
+
}).format(outputCost ?? 0);
|
|
121
|
+
return (_jsxs("div", { className: cn("flex items-center justify-between text-xs", className), ...props, children: [_jsx("span", { className: "text-muted-foreground", children: "Output" }), _jsx(TokensWithCost, { costText: outputCostText, tokens: outputTokens })] }));
|
|
122
|
+
};
|
|
123
|
+
export const ContextReasoningUsage = ({ className, children, ...props }) => {
|
|
124
|
+
const { usage, modelId } = useContextValue();
|
|
125
|
+
const reasoningTokens = usage?.reasoningTokens ?? 0;
|
|
126
|
+
if (children) {
|
|
127
|
+
return children;
|
|
128
|
+
}
|
|
129
|
+
if (!reasoningTokens) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
const reasoningCost = modelId
|
|
133
|
+
? getUsage({
|
|
134
|
+
modelId,
|
|
135
|
+
usage: { reasoningTokens },
|
|
136
|
+
}).costUSD?.totalUSD
|
|
137
|
+
: undefined;
|
|
138
|
+
const reasoningCostText = new Intl.NumberFormat("en-US", {
|
|
139
|
+
currency: "USD",
|
|
140
|
+
style: "currency",
|
|
141
|
+
}).format(reasoningCost ?? 0);
|
|
142
|
+
return (_jsxs("div", { className: cn("flex items-center justify-between text-xs", className), ...props, children: [_jsx("span", { className: "text-muted-foreground", children: "Reasoning" }), _jsx(TokensWithCost, { costText: reasoningCostText, tokens: reasoningTokens })] }));
|
|
143
|
+
};
|
|
144
|
+
export const ContextCacheUsage = ({ className, children, ...props }) => {
|
|
145
|
+
const { usage, modelId } = useContextValue();
|
|
146
|
+
const cacheTokens = usage?.cachedInputTokens ?? 0;
|
|
147
|
+
if (children) {
|
|
148
|
+
return children;
|
|
149
|
+
}
|
|
150
|
+
if (!cacheTokens) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
const cacheCost = modelId
|
|
154
|
+
? getUsage({
|
|
155
|
+
modelId,
|
|
156
|
+
usage: { cacheReads: cacheTokens, input: 0, output: 0 },
|
|
157
|
+
}).costUSD?.totalUSD
|
|
158
|
+
: undefined;
|
|
159
|
+
const cacheCostText = new Intl.NumberFormat("en-US", {
|
|
160
|
+
currency: "USD",
|
|
161
|
+
style: "currency",
|
|
162
|
+
}).format(cacheCost ?? 0);
|
|
163
|
+
return (_jsxs("div", { className: cn("flex items-center justify-between text-xs", className), ...props, children: [_jsx("span", { className: "text-muted-foreground", children: "Cache" }), _jsx(TokensWithCost, { costText: cacheCostText, tokens: cacheTokens })] }));
|
|
164
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Controls as ControlsPrimitive } from "@xyflow/react";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
export type ControlsProps = ComponentProps<typeof ControlsPrimitive>;
|
|
4
|
+
export declare const Controls: ({ className, ...props }: ControlsProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../src/molecules/controls.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAErE,eAAO,MAAM,QAAQ,GAAI,yBAAyB,aAAa,4CAS9D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
4
|
+
import { Controls as ControlsPrimitive } from "@xyflow/react";
|
|
5
|
+
export const Controls = ({ className, ...props }) => (_jsx(ControlsPrimitive, { className: cn("gap-px overflow-hidden rounded-md border bg-card p-1 shadow-none!", "[&>button]:rounded-md [&>button]:border-none! [&>button]:bg-transparent! [&>button]:hover:bg-secondary!", className), ...props }));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Button } from "@chatsdk-dev/ui/components/button";
|
|
2
|
+
import type { UIMessage } from "ai";
|
|
3
|
+
import type { ComponentProps } from "react";
|
|
4
|
+
import { StickToBottom } from "use-stick-to-bottom";
|
|
5
|
+
export type ConversationProps = ComponentProps<typeof StickToBottom>;
|
|
6
|
+
export declare const Conversation: ({ className, ...props }: ConversationProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export type ConversationContentProps = ComponentProps<typeof StickToBottom.Content>;
|
|
8
|
+
export declare const ConversationContent: ({ className, ...props }: ConversationContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export type ConversationEmptyStateProps = ComponentProps<"div"> & {
|
|
10
|
+
title?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export declare const ConversationEmptyState: ({ className, title, description, icon, children, ...props }: ConversationEmptyStateProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export type ConversationScrollButtonProps = ComponentProps<typeof Button>;
|
|
16
|
+
export declare const ConversationScrollButton: ({ className, ...props }: ConversationScrollButtonProps) => false | import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export type ConversationDownloadProps = Omit<ComponentProps<typeof Button>, "onClick"> & {
|
|
18
|
+
messages: UIMessage[];
|
|
19
|
+
filename?: string;
|
|
20
|
+
formatMessage?: (message: UIMessage, index: number) => string;
|
|
21
|
+
};
|
|
22
|
+
export declare const messagesToMarkdown: (messages: UIMessage[], formatMessage?: (message: UIMessage, index: number) => string) => string;
|
|
23
|
+
export declare const ConversationDownload: ({ messages, filename, formatMessage, className, children, ...props }: ConversationDownloadProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/molecules/conversation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,aAAa,EAA2B,MAAM,qBAAqB,CAAC;AAE7E,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC;AAErE,eAAO,MAAM,YAAY,GAAI,yBAAyB,iBAAiB,4CAQtE,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CACnD,OAAO,aAAa,CAAC,OAAO,CAC7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,yBAGjC,wBAAwB,4CAK1B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,6DAOpC,2BAA2B,4CAoB7B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAE1E,eAAO,MAAM,wBAAwB,GAAI,yBAGtC,6BAA6B,oDAwB/B,CAAC;AAQF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,cAAc,CAAC,OAAO,MAAM,CAAC,EAC7B,SAAS,CACV,GAAG;IACF,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAC/D,CAAC;AAQF,eAAO,MAAM,kBAAkB,GAC7B,UAAU,SAAS,EAAE,EACrB,gBAAe,CACb,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,MAAM,KACV,MAA6B,KACjC,MAAsE,CAAC;AAE1E,eAAO,MAAM,oBAAoB,GAAI,sEAOlC,yBAAyB,4CA6B3B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "@chatsdk-dev/ui/components/button";
|
|
4
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
5
|
+
import { ArrowDownIcon, DownloadIcon } from "lucide-react";
|
|
6
|
+
import { useCallback } from "react";
|
|
7
|
+
import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
|
|
8
|
+
export const Conversation = ({ className, ...props }) => (_jsx(StickToBottom, { className: cn("relative flex-1 overflow-y-hidden", className), initial: "smooth", resize: "smooth", role: "log", ...props }));
|
|
9
|
+
export const ConversationContent = ({ className, ...props }) => (_jsx(StickToBottom.Content, { className: cn("flex flex-col gap-8 p-4", className), ...props }));
|
|
10
|
+
export const ConversationEmptyState = ({ className, title = "No messages yet", description = "Start a conversation to see messages here", icon, children, ...props }) => (_jsx("div", { className: cn("flex size-full flex-col items-center justify-center gap-3 p-8 text-center", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [icon && _jsx("div", { className: "text-muted-foreground", children: icon }), _jsxs("div", { className: "space-y-1", children: [_jsx("h3", { className: "font-medium text-sm", children: title }), description && (_jsx("p", { className: "text-muted-foreground text-sm", children: description }))] })] })) }));
|
|
11
|
+
export const ConversationScrollButton = ({ className, ...props }) => {
|
|
12
|
+
const { isAtBottom, scrollToBottom } = useStickToBottomContext();
|
|
13
|
+
const handleScrollToBottom = useCallback(() => {
|
|
14
|
+
scrollToBottom();
|
|
15
|
+
}, [scrollToBottom]);
|
|
16
|
+
return (!isAtBottom && (_jsx(Button, { className: cn("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full dark:bg-background dark:hover:bg-muted", className), onClick: handleScrollToBottom, size: "icon", type: "button", variant: "outline", ...props, children: _jsx(ArrowDownIcon, { className: "size-4" }) })));
|
|
17
|
+
};
|
|
18
|
+
const getMessageText = (message) => message.parts
|
|
19
|
+
.filter((part) => part.type === "text")
|
|
20
|
+
.map((part) => part.text)
|
|
21
|
+
.join("");
|
|
22
|
+
const defaultFormatMessage = (message) => {
|
|
23
|
+
const roleLabel = message.role.charAt(0).toUpperCase() + message.role.slice(1);
|
|
24
|
+
return `**${roleLabel}:** ${getMessageText(message)}`;
|
|
25
|
+
};
|
|
26
|
+
export const messagesToMarkdown = (messages, formatMessage = defaultFormatMessage) => messages.map((msg, i) => formatMessage(msg, i)).join("\n\n");
|
|
27
|
+
export const ConversationDownload = ({ messages, filename = "conversation.md", formatMessage = defaultFormatMessage, className, children, ...props }) => {
|
|
28
|
+
const handleDownload = useCallback(() => {
|
|
29
|
+
const markdown = messagesToMarkdown(messages, formatMessage);
|
|
30
|
+
const blob = new Blob([markdown], { type: "text/markdown" });
|
|
31
|
+
const url = URL.createObjectURL(blob);
|
|
32
|
+
const link = document.createElement("a");
|
|
33
|
+
link.href = url;
|
|
34
|
+
link.download = filename;
|
|
35
|
+
document.body.append(link);
|
|
36
|
+
link.click();
|
|
37
|
+
link.remove();
|
|
38
|
+
URL.revokeObjectURL(url);
|
|
39
|
+
}, [messages, filename, formatMessage]);
|
|
40
|
+
return (_jsx(Button, { className: cn("absolute top-4 right-4 rounded-full dark:bg-background dark:hover:bg-muted", className), onClick: handleDownload, size: "icon", type: "button", variant: "outline", ...props, children: children ?? _jsx(DownloadIcon, { className: "size-4" }) }));
|
|
41
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { EdgeProps } from "@xyflow/react";
|
|
2
|
+
export declare const Edge: {
|
|
3
|
+
Animated: ({ id, source, target, markerEnd, style }: EdgeProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
Temporary: ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, }: EdgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=edge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/molecules/edge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAsB,MAAM,eAAe,CAAC;AA2InE,eAAO,MAAM,IAAI;yDAhC2C,SAAS;6FA1FlE,SAAS;CA6HX,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BaseEdge, getBezierPath, getSimpleBezierPath, Position, useInternalNode, } from "@xyflow/react";
|
|
3
|
+
const Temporary = ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, }) => {
|
|
4
|
+
const [edgePath] = getSimpleBezierPath({
|
|
5
|
+
sourcePosition,
|
|
6
|
+
sourceX,
|
|
7
|
+
sourceY,
|
|
8
|
+
targetPosition,
|
|
9
|
+
targetX,
|
|
10
|
+
targetY,
|
|
11
|
+
});
|
|
12
|
+
return (_jsx(BaseEdge, { className: "stroke-1 stroke-ring", id: id, path: edgePath, style: {
|
|
13
|
+
strokeDasharray: "5, 5",
|
|
14
|
+
} }));
|
|
15
|
+
};
|
|
16
|
+
const getHandleCoordsByPosition = (node, handlePosition) => {
|
|
17
|
+
// Choose the handle type based on position - Left is for target, Right is for source
|
|
18
|
+
const handleType = handlePosition === Position.Left ? "target" : "source";
|
|
19
|
+
const handle = node.internals.handleBounds?.[handleType]?.find((h) => h.position === handlePosition);
|
|
20
|
+
if (!handle) {
|
|
21
|
+
return [0, 0];
|
|
22
|
+
}
|
|
23
|
+
let offsetX = handle.width / 2;
|
|
24
|
+
let offsetY = handle.height / 2;
|
|
25
|
+
// this is a tiny detail to make the markerEnd of an edge visible.
|
|
26
|
+
// The handle position that gets calculated has the origin top-left, so depending which side we are using, we add a little offset
|
|
27
|
+
// when the handlePosition is Position.Right for example, we need to add an offset as big as the handle itself in order to get the correct position
|
|
28
|
+
switch (handlePosition) {
|
|
29
|
+
case Position.Left: {
|
|
30
|
+
offsetX = 0;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
case Position.Right: {
|
|
34
|
+
offsetX = handle.width;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case Position.Top: {
|
|
38
|
+
offsetY = 0;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case Position.Bottom: {
|
|
42
|
+
offsetY = handle.height;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
default: {
|
|
46
|
+
throw new Error(`Invalid handle position: ${handlePosition}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const x = node.internals.positionAbsolute.x + handle.x + offsetX;
|
|
50
|
+
const y = node.internals.positionAbsolute.y + handle.y + offsetY;
|
|
51
|
+
return [x, y];
|
|
52
|
+
};
|
|
53
|
+
const getEdgeParams = (source, target) => {
|
|
54
|
+
const sourcePos = Position.Right;
|
|
55
|
+
const [sx, sy] = getHandleCoordsByPosition(source, sourcePos);
|
|
56
|
+
const targetPos = Position.Left;
|
|
57
|
+
const [tx, ty] = getHandleCoordsByPosition(target, targetPos);
|
|
58
|
+
return {
|
|
59
|
+
sourcePos,
|
|
60
|
+
sx,
|
|
61
|
+
sy,
|
|
62
|
+
targetPos,
|
|
63
|
+
tx,
|
|
64
|
+
ty,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const Animated = ({ id, source, target, markerEnd, style }) => {
|
|
68
|
+
const sourceNode = useInternalNode(source);
|
|
69
|
+
const targetNode = useInternalNode(target);
|
|
70
|
+
if (!(sourceNode && targetNode)) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const { sx, sy, tx, ty, sourcePos, targetPos } = getEdgeParams(sourceNode, targetNode);
|
|
74
|
+
const [edgePath] = getBezierPath({
|
|
75
|
+
sourcePosition: sourcePos,
|
|
76
|
+
sourceX: sx,
|
|
77
|
+
sourceY: sy,
|
|
78
|
+
targetPosition: targetPos,
|
|
79
|
+
targetX: tx,
|
|
80
|
+
targetY: ty,
|
|
81
|
+
});
|
|
82
|
+
return (_jsxs(_Fragment, { children: [_jsx(BaseEdge, { id: id, markerEnd: markerEnd, path: edgePath, style: style }), _jsx("circle", { fill: "var(--primary)", r: "4", children: _jsx("animateMotion", { dur: "2s", path: edgePath, repeatCount: "indefinite" }) })] }));
|
|
83
|
+
};
|
|
84
|
+
export const Edge = {
|
|
85
|
+
Animated,
|
|
86
|
+
Temporary,
|
|
87
|
+
};
|