@chatsdk-dev/ui 0.0.1 → 0.1.2
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,62 @@
|
|
|
1
|
+
import { Button } from "@chatsdk-dev/ui/atoms/button";
|
|
2
|
+
import { Collapsible, CollapsibleContent } from "@chatsdk-dev/ui/atoms/collapsible";
|
|
3
|
+
import { ScrollArea } from "@chatsdk-dev/ui/atoms/scroll-area";
|
|
4
|
+
import type { ComponentProps } from "react";
|
|
5
|
+
export interface QueueMessagePart {
|
|
6
|
+
type: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
filename?: string;
|
|
10
|
+
mediaType?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface QueueMessage {
|
|
13
|
+
id: string;
|
|
14
|
+
parts: QueueMessagePart[];
|
|
15
|
+
}
|
|
16
|
+
export interface QueueTodo {
|
|
17
|
+
id: string;
|
|
18
|
+
title: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
status?: "pending" | "completed";
|
|
21
|
+
}
|
|
22
|
+
export type QueueItemProps = ComponentProps<"li">;
|
|
23
|
+
export declare const QueueItem: ({ className, ...props }: QueueItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export type QueueItemIndicatorProps = ComponentProps<"span"> & {
|
|
25
|
+
completed?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export declare const QueueItemIndicator: ({ completed, className, ...props }: QueueItemIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export type QueueItemContentProps = ComponentProps<"span"> & {
|
|
29
|
+
completed?: boolean;
|
|
30
|
+
};
|
|
31
|
+
export declare const QueueItemContent: ({ completed, className, ...props }: QueueItemContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export type QueueItemDescriptionProps = ComponentProps<"div"> & {
|
|
33
|
+
completed?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare const QueueItemDescription: ({ completed, className, ...props }: QueueItemDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export type QueueItemActionsProps = ComponentProps<"div">;
|
|
37
|
+
export declare const QueueItemActions: ({ className, ...props }: QueueItemActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export type QueueItemActionProps = Omit<ComponentProps<typeof Button>, "variant" | "size">;
|
|
39
|
+
export declare const QueueItemAction: ({ className, ...props }: QueueItemActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export type QueueItemAttachmentProps = ComponentProps<"div">;
|
|
41
|
+
export declare const QueueItemAttachment: ({ className, ...props }: QueueItemAttachmentProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export type QueueItemImageProps = ComponentProps<"img">;
|
|
43
|
+
export declare const QueueItemImage: ({ className, ...props }: QueueItemImageProps) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export type QueueItemFileProps = ComponentProps<"span">;
|
|
45
|
+
export declare const QueueItemFile: ({ children, className, ...props }: QueueItemFileProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export type QueueListProps = ComponentProps<typeof ScrollArea>;
|
|
47
|
+
export declare const QueueList: ({ children, className, ...props }: QueueListProps) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export type QueueSectionProps = ComponentProps<typeof Collapsible>;
|
|
49
|
+
export declare const QueueSection: ({ className, defaultOpen, ...props }: QueueSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
export type QueueSectionTriggerProps = ComponentProps<"button">;
|
|
51
|
+
export declare const QueueSectionTrigger: ({ children, className, ...props }: QueueSectionTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
export type QueueSectionLabelProps = ComponentProps<"span"> & {
|
|
53
|
+
count?: number;
|
|
54
|
+
label: string;
|
|
55
|
+
icon?: React.ReactNode;
|
|
56
|
+
};
|
|
57
|
+
export declare const QueueSectionLabel: ({ count, label, icon, className, ...props }: QueueSectionLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
export type QueueSectionContentProps = ComponentProps<typeof CollapsibleContent>;
|
|
59
|
+
export declare const QueueSectionContent: ({ className, ...props }: QueueSectionContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
export type QueueProps = ComponentProps<"div">;
|
|
61
|
+
export declare const Queue: ({ className, ...props }: QueueProps) => import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/queue.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "@chatsdk-dev/ui/atoms/button";
|
|
4
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@chatsdk-dev/ui/atoms/collapsible";
|
|
5
|
+
import { ScrollArea } from "@chatsdk-dev/ui/atoms/scroll-area";
|
|
6
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
7
|
+
import { ChevronDownIcon, PaperclipIcon } from "lucide-react";
|
|
8
|
+
export const QueueItem = ({ className, ...props }) => (_jsx("li", { className: cn("group flex flex-col gap-1 rounded-md px-3 py-1 text-sm transition-colors hover:bg-muted", className), ...props }));
|
|
9
|
+
export const QueueItemIndicator = ({ completed = false, className, ...props }) => (_jsx("span", { className: cn("mt-0.5 inline-block size-2.5 rounded-full border", completed
|
|
10
|
+
? "border-muted-foreground/20 bg-muted-foreground/10"
|
|
11
|
+
: "border-muted-foreground/50", className), ...props }));
|
|
12
|
+
export const QueueItemContent = ({ completed = false, className, ...props }) => (_jsx("span", { className: cn("line-clamp-1 grow break-words", completed
|
|
13
|
+
? "text-muted-foreground/50 line-through"
|
|
14
|
+
: "text-muted-foreground", className), ...props }));
|
|
15
|
+
export const QueueItemDescription = ({ completed = false, className, ...props }) => (_jsx("div", { className: cn("ml-6 text-xs", completed
|
|
16
|
+
? "text-muted-foreground/40 line-through"
|
|
17
|
+
: "text-muted-foreground", className), ...props }));
|
|
18
|
+
export const QueueItemActions = ({ className, ...props }) => (_jsx("div", { className: cn("flex gap-1", className), ...props }));
|
|
19
|
+
export const QueueItemAction = ({ className, ...props }) => (_jsx(Button, { className: cn("size-auto rounded p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-muted-foreground/10 hover:text-foreground group-hover:opacity-100", className), size: "icon", type: "button", variant: "ghost", ...props }));
|
|
20
|
+
export const QueueItemAttachment = ({ className, ...props }) => (_jsx("div", { className: cn("mt-1 flex flex-wrap gap-2", className), ...props }));
|
|
21
|
+
export const QueueItemImage = ({ className, ...props }) => (_jsx("img", { alt: "", className: cn("h-8 w-8 rounded border object-cover", className), height: 32, width: 32, ...props }));
|
|
22
|
+
export const QueueItemFile = ({ children, className, ...props }) => (_jsxs("span", { className: cn("flex items-center gap-1 rounded border bg-muted px-2 py-1 text-xs", className), ...props, children: [_jsx(PaperclipIcon, { size: 12 }), _jsx("span", { className: "max-w-[100px] truncate", children: children })] }));
|
|
23
|
+
export const QueueList = ({ children, className, ...props }) => (_jsx(ScrollArea, { className: cn("mt-2 -mb-1", className), ...props, children: _jsx("div", { className: "max-h-40 pr-4", children: _jsx("ul", { children: children }) }) }));
|
|
24
|
+
export const QueueSection = ({ className, defaultOpen = true, ...props }) => (_jsx(Collapsible, { className: cn(className), defaultOpen: defaultOpen, ...props }));
|
|
25
|
+
export const QueueSectionTrigger = ({ children, className, ...props }) => (_jsx(CollapsibleTrigger, { render: () => (_jsx("button", { className: cn("group flex w-full items-center justify-between rounded-md bg-muted/40 px-3 py-2 text-left font-medium text-muted-foreground text-sm transition-colors hover:bg-muted", className), type: "button", ...props, children: children })) }));
|
|
26
|
+
export const QueueSectionLabel = ({ count, label, icon, className, ...props }) => (_jsxs("span", { className: cn("flex items-center gap-2", className), ...props, children: [_jsx(ChevronDownIcon, { className: "size-4 transition-transform group-data-[state=closed]:-rotate-90" }), icon, _jsxs("span", { children: [count, " ", label] })] }));
|
|
27
|
+
export const QueueSectionContent = ({ className, ...props }) => (_jsx(CollapsibleContent, { className: cn(className), ...props }));
|
|
28
|
+
export const Queue = ({ className, ...props }) => (_jsx("div", { className: cn("flex flex-col gap-2 rounded-xl border border-border bg-background px-3 pt-2 pb-2 shadow-xs", className), ...props }));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@chatsdk-dev/ui/atoms/collapsible";
|
|
2
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
3
|
+
interface ReasoningContextValue {
|
|
4
|
+
isStreaming: boolean;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
setIsOpen: (open: boolean) => void;
|
|
7
|
+
duration: number | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare const useReasoning: () => ReasoningContextValue;
|
|
10
|
+
export type ReasoningProps = ComponentProps<typeof Collapsible> & {
|
|
11
|
+
isStreaming?: boolean;
|
|
12
|
+
open?: boolean;
|
|
13
|
+
defaultOpen?: boolean;
|
|
14
|
+
onOpenChange?: (open: boolean) => void;
|
|
15
|
+
duration?: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const Reasoning: import("react").MemoExoticComponent<({ className, isStreaming, open, defaultOpen, onOpenChange, duration: durationProp, children, ...props }: ReasoningProps) => import("react/jsx-runtime").JSX.Element>;
|
|
18
|
+
export type ReasoningTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {
|
|
19
|
+
getThinkingMessage?: (isStreaming: boolean, duration?: number) => ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export declare const ReasoningTrigger: import("react").MemoExoticComponent<({ className, children, getThinkingMessage, ...props }: ReasoningTriggerProps) => import("react/jsx-runtime").JSX.Element>;
|
|
22
|
+
export type ReasoningContentProps = ComponentProps<typeof CollapsibleContent> & {
|
|
23
|
+
children: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const ReasoningContent: import("react").MemoExoticComponent<({ className, children, ...props }: ReasoningContentProps) => import("react/jsx-runtime").JSX.Element>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=reasoning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reasoning.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/reasoning.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,mCAAmC,CAAC;AAO3C,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAevD,UAAU,qBAAqB;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAID,eAAO,MAAM,YAAY,6BAMxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,WAAW,CAAC,GAAG;IAChE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAKF,eAAO,MAAM,SAAS,gJAUjB,cAAc,6CAiFlB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAChD,OAAO,kBAAkB,CAC1B,GAAG;IACF,kBAAkB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,SAAS,CAAC;CAC7E,CAAC;AAYF,eAAO,MAAM,gBAAgB,8FAMxB,qBAAqB,6CA0BzB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAChD,OAAO,kBAAkB,CAC1B,GAAG;IACF,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF,eAAO,MAAM,gBAAgB,0EACS,qBAAqB,6CAY1D,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
4
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@chatsdk-dev/ui/atoms/collapsible";
|
|
5
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
6
|
+
import { cjk } from "@streamdown/cjk";
|
|
7
|
+
import { code } from "@streamdown/code";
|
|
8
|
+
import { math } from "@streamdown/math";
|
|
9
|
+
import { mermaid } from "@streamdown/mermaid";
|
|
10
|
+
import { BrainIcon, ChevronDownIcon } from "lucide-react";
|
|
11
|
+
import { createContext, memo, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
12
|
+
import { Streamdown } from "streamdown";
|
|
13
|
+
import { Shimmer } from "./shimmer";
|
|
14
|
+
const ReasoningContext = createContext(null);
|
|
15
|
+
export const useReasoning = () => {
|
|
16
|
+
const context = useContext(ReasoningContext);
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error("Reasoning components must be used within Reasoning");
|
|
19
|
+
}
|
|
20
|
+
return context;
|
|
21
|
+
};
|
|
22
|
+
const AUTO_CLOSE_DELAY = 1000;
|
|
23
|
+
const MS_IN_S = 1000;
|
|
24
|
+
export const Reasoning = memo(({ className, isStreaming = false, open, defaultOpen, onOpenChange, duration: durationProp, children, ...props }) => {
|
|
25
|
+
const resolvedDefaultOpen = defaultOpen ?? isStreaming;
|
|
26
|
+
// Track if defaultOpen was explicitly set to false (to prevent auto-open)
|
|
27
|
+
const isExplicitlyClosed = defaultOpen === false;
|
|
28
|
+
const [isOpen, setIsOpen] = useControllableState({
|
|
29
|
+
defaultProp: resolvedDefaultOpen,
|
|
30
|
+
onChange: onOpenChange,
|
|
31
|
+
prop: open,
|
|
32
|
+
});
|
|
33
|
+
const [duration, setDuration] = useControllableState({
|
|
34
|
+
defaultProp: undefined,
|
|
35
|
+
prop: durationProp,
|
|
36
|
+
});
|
|
37
|
+
const hasEverStreamedRef = useRef(isStreaming);
|
|
38
|
+
const [hasAutoClosed, setHasAutoClosed] = useState(false);
|
|
39
|
+
const startTimeRef = useRef(null);
|
|
40
|
+
// Track when streaming starts and compute duration
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (isStreaming) {
|
|
43
|
+
hasEverStreamedRef.current = true;
|
|
44
|
+
if (startTimeRef.current === null) {
|
|
45
|
+
startTimeRef.current = Date.now();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else if (startTimeRef.current !== null) {
|
|
49
|
+
setDuration(Math.ceil((Date.now() - startTimeRef.current) / MS_IN_S));
|
|
50
|
+
startTimeRef.current = null;
|
|
51
|
+
}
|
|
52
|
+
}, [isStreaming, setDuration]);
|
|
53
|
+
// Auto-open when streaming starts (unless explicitly closed)
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (isStreaming && !isOpen && !isExplicitlyClosed) {
|
|
56
|
+
setIsOpen(true);
|
|
57
|
+
}
|
|
58
|
+
}, [isStreaming, isOpen, setIsOpen, isExplicitlyClosed]);
|
|
59
|
+
// Auto-close when streaming ends (once only, and only if it ever streamed)
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (hasEverStreamedRef.current &&
|
|
62
|
+
!isStreaming &&
|
|
63
|
+
isOpen &&
|
|
64
|
+
!hasAutoClosed) {
|
|
65
|
+
const timer = setTimeout(() => {
|
|
66
|
+
setIsOpen(false);
|
|
67
|
+
setHasAutoClosed(true);
|
|
68
|
+
}, AUTO_CLOSE_DELAY);
|
|
69
|
+
return () => clearTimeout(timer);
|
|
70
|
+
}
|
|
71
|
+
}, [isStreaming, isOpen, setIsOpen, hasAutoClosed]);
|
|
72
|
+
const handleOpenChange = useCallback((newOpen) => {
|
|
73
|
+
setIsOpen(newOpen);
|
|
74
|
+
}, [setIsOpen]);
|
|
75
|
+
const contextValue = useMemo(() => ({ duration, isOpen, isStreaming, setIsOpen }), [duration, isOpen, isStreaming, setIsOpen]);
|
|
76
|
+
return (_jsx(ReasoningContext.Provider, { value: contextValue, children: _jsx(Collapsible, { className: cn("not-prose mb-4", className), onOpenChange: handleOpenChange, open: isOpen, ...props, children: children }) }));
|
|
77
|
+
});
|
|
78
|
+
const defaultGetThinkingMessage = (isStreaming, duration) => {
|
|
79
|
+
if (isStreaming || duration === 0) {
|
|
80
|
+
return _jsx(Shimmer, { duration: 1, children: "Thinking..." });
|
|
81
|
+
}
|
|
82
|
+
if (duration === undefined) {
|
|
83
|
+
return _jsx("p", { children: "Thought for a few seconds" });
|
|
84
|
+
}
|
|
85
|
+
return _jsxs("p", { children: ["Thought for ", duration, " seconds"] });
|
|
86
|
+
};
|
|
87
|
+
export const ReasoningTrigger = memo(({ className, children, getThinkingMessage = defaultGetThinkingMessage, ...props }) => {
|
|
88
|
+
const { isStreaming, isOpen, duration } = useReasoning();
|
|
89
|
+
return (_jsx(CollapsibleTrigger, { className: cn("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx(BrainIcon, { className: "size-4" }), getThinkingMessage(isStreaming, duration), _jsx(ChevronDownIcon, { className: cn("size-4 transition-transform", isOpen ? "rotate-180" : "rotate-0") })] })) }));
|
|
90
|
+
});
|
|
91
|
+
const streamdownPlugins = { cjk, code, math, mermaid };
|
|
92
|
+
export const ReasoningContent = memo(({ className, children, ...props }) => (_jsx(CollapsibleContent, { className: cn("mt-4 text-sm", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", className), ...props, children: _jsx(Streamdown, { plugins: streamdownPlugins, children: children }) })));
|
|
93
|
+
Reasoning.displayName = "Reasoning";
|
|
94
|
+
ReasoningTrigger.displayName = "ReasoningTrigger";
|
|
95
|
+
ReasoningContent.displayName = "ReasoningContent";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
import { Streamdown } from "streamdown";
|
|
3
|
+
type ResponseProps = ComponentProps<typeof Streamdown>;
|
|
4
|
+
export declare const Response: import("react").MemoExoticComponent<({ className, ...props }: ResponseProps) => import("react/jsx-runtime").JSX.Element>;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/response.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAIxC,KAAK,aAAa,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAEvD,eAAO,MAAM,QAAQ,gEACO,aAAa,6CAsBxC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { memo } from "react";
|
|
4
|
+
import { Streamdown } from "streamdown";
|
|
5
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
6
|
+
export const Response = memo(({ className, ...props }) => (_jsx(Streamdown, { className: cn("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
|
7
|
+
// "[&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
|
8
|
+
// "[&_p]:my-2 [&_p]:leading-relaxed",
|
|
9
|
+
// "[&_h1]:mt-4 [&_h1]:mb-2 [&_h1]:text-sm [&_h1]:font-bold [&_h1:first-child]:mt-0",
|
|
10
|
+
// "[&_h2]:mt-3 [&_h2]:mb-2 [&_h2]:text-xs! [&_h2]:font-bold [&_h2:first-child]:mt-0",
|
|
11
|
+
// "[&_h3]:mt-2 [&_h3]:mb-1 [&_h3]:text-xs! [&_h3]:font-semibold [&_h3:first-child]:mt-0",
|
|
12
|
+
// "[&_h4]:mt-2 [&_h4]:mb-1 [&_h4]:text-xs! [&_h4]:font-medium [&_h4:first-child]:mt-0",
|
|
13
|
+
"[&_ul]:list-disc [&_ul]:pl-4", "[&_ol]:list-decimal [&_ol]:pl-4", "[&_li]:pl-1 [&_li]:leading-relaxed [&_li_p]:inline",
|
|
14
|
+
// "[&_table]:my-2 [&_table]:w-full [&_table]:border-collapse [&_table]:text-[12px]",
|
|
15
|
+
// "[&_th]:border-border [&_th]:border-b [&_th]:p-1.5 [&_th]:text-left [&_th]:text-[12px] [&_th]:font-semibold",
|
|
16
|
+
// "[&_td]:border-border [&_td]:border-b [&_td]:p-1.5 [&_td]:text-[12px]",
|
|
17
|
+
className), ...props })), (prevProps, nextProps) => prevProps.children === nextProps.children);
|
|
18
|
+
Response.displayName = "Response";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Collapsible, CollapsibleContent } from "@chatsdk-dev/ui/atoms/collapsible";
|
|
2
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@chatsdk-dev/ui/atoms/tabs";
|
|
3
|
+
import type { ToolUIPart } from "ai";
|
|
4
|
+
import type { ComponentProps } from "react";
|
|
5
|
+
export type SandboxRootProps = ComponentProps<typeof Collapsible>;
|
|
6
|
+
export declare const Sandbox: ({ className, ...props }: SandboxRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export interface SandboxHeaderProps {
|
|
8
|
+
title?: string;
|
|
9
|
+
state: ToolUIPart["state"];
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const SandboxHeader: ({ className, title, state, ...props }: SandboxHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export type SandboxContentProps = ComponentProps<typeof CollapsibleContent>;
|
|
14
|
+
export declare const SandboxContent: ({ className, ...props }: SandboxContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export type SandboxTabsProps = ComponentProps<typeof Tabs>;
|
|
16
|
+
export declare const SandboxTabs: ({ className, ...props }: SandboxTabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export type SandboxTabsBarProps = ComponentProps<"div">;
|
|
18
|
+
export declare const SandboxTabsBar: ({ className, ...props }: SandboxTabsBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export type SandboxTabsListProps = ComponentProps<typeof TabsList>;
|
|
20
|
+
export declare const SandboxTabsList: ({ className, ...props }: SandboxTabsListProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export type SandboxTabsTriggerProps = ComponentProps<typeof TabsTrigger>;
|
|
22
|
+
export declare const SandboxTabsTrigger: ({ className, ...props }: SandboxTabsTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export type SandboxTabContentProps = ComponentProps<typeof TabsContent>;
|
|
24
|
+
export declare const SandboxTabContent: ({ className, ...props }: SandboxTabContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/sandbox.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,kBAAkB,EAEnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,WAAW,CAAC,CAAC;AAElE,eAAO,MAAM,OAAO,GAAI,yBAAyB,gBAAgB,4CAShE,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,GAAI,uCAK3B,kBAAkB,4CAepB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE5E,eAAO,MAAM,cAAc,GAAI,yBAG5B,mBAAmB,4CAQrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC;AAE3D,eAAO,MAAM,WAAW,GAAI,yBAAyB,gBAAgB,4CAEpE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAExD,eAAO,MAAM,cAAc,GAAI,yBAG5B,mBAAmB,4CAQrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEnE,eAAO,MAAM,eAAe,GAAI,yBAG7B,oBAAoB,4CAKtB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzE,eAAO,MAAM,kBAAkB,GAAI,yBAGhC,uBAAuB,4CAQzB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,OAAO,WAAW,CAAC,CAAC;AAExE,eAAO,MAAM,iBAAiB,GAAI,yBAG/B,sBAAsB,4CAExB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@chatsdk-dev/ui/atoms/collapsible";
|
|
4
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger, } from "@chatsdk-dev/ui/atoms/tabs";
|
|
5
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
6
|
+
import { ChevronDownIcon, Code } from "lucide-react";
|
|
7
|
+
import { getStatusBadge } from "./tool";
|
|
8
|
+
export const Sandbox = ({ className, ...props }) => (_jsx(Collapsible, { className: cn("not-prose group mb-4 w-full overflow-hidden rounded-md border", className), defaultOpen: true, ...props }));
|
|
9
|
+
export const SandboxHeader = ({ className, title, state, ...props }) => (_jsxs(CollapsibleTrigger, { className: cn("flex w-full items-center justify-between gap-4 p-3", className), ...props, children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Code, { className: "size-4 text-muted-foreground" }), _jsx("span", { className: "font-medium text-sm", children: title }), getStatusBadge(state)] }), _jsx(ChevronDownIcon, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })] }));
|
|
10
|
+
export const SandboxContent = ({ className, ...props }) => (_jsx(CollapsibleContent, { className: cn("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", className), ...props }));
|
|
11
|
+
export const SandboxTabs = ({ className, ...props }) => (_jsx(Tabs, { className: cn("w-full gap-0", className), ...props }));
|
|
12
|
+
export const SandboxTabsBar = ({ className, ...props }) => (_jsx("div", { className: cn("flex w-full items-center border-border border-t border-b", className), ...props }));
|
|
13
|
+
export const SandboxTabsList = ({ className, ...props }) => (_jsx(TabsList, { className: cn("h-auto rounded-none border-0 bg-transparent p-0", className), ...props }));
|
|
14
|
+
export const SandboxTabsTrigger = ({ className, ...props }) => (_jsx(TabsTrigger, { className: cn("rounded-none border-0 border-transparent border-b-2 px-4 py-2 font-medium text-muted-foreground text-sm transition-colors data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:shadow-none", className), ...props }));
|
|
15
|
+
export const SandboxTabContent = ({ className, ...props }) => (_jsx(TabsContent, { className: cn("mt-0 text-sm", className), ...props }));
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Badge } from "@chatsdk-dev/ui/atoms/badge";
|
|
2
|
+
import { Collapsible } from "@chatsdk-dev/ui/atoms/collapsible";
|
|
3
|
+
import type { ComponentProps, HTMLAttributes } from "react";
|
|
4
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
5
|
+
interface SchemaParameter {
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
description?: string;
|
|
10
|
+
location?: "path" | "query" | "header";
|
|
11
|
+
}
|
|
12
|
+
interface SchemaProperty {
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
description?: string;
|
|
17
|
+
properties?: SchemaProperty[];
|
|
18
|
+
items?: SchemaProperty;
|
|
19
|
+
}
|
|
20
|
+
export type SchemaDisplayHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
21
|
+
export declare const SchemaDisplayHeader: ({ className, children, ...props }: SchemaDisplayHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export type SchemaDisplayMethodProps = ComponentProps<typeof Badge>;
|
|
23
|
+
export declare const SchemaDisplayMethod: ({ className, children, ...props }: SchemaDisplayMethodProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export type SchemaDisplayPathProps = HTMLAttributes<HTMLSpanElement>;
|
|
25
|
+
export declare const SchemaDisplayPath: ({ className, children, ...props }: SchemaDisplayPathProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export type SchemaDisplayDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
|
|
27
|
+
export declare const SchemaDisplayDescription: ({ className, children, ...props }: SchemaDisplayDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export type SchemaDisplayContentProps = HTMLAttributes<HTMLDivElement>;
|
|
29
|
+
export declare const SchemaDisplayContent: ({ className, children, ...props }: SchemaDisplayContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export type SchemaDisplayParameterProps = HTMLAttributes<HTMLDivElement> & SchemaParameter;
|
|
31
|
+
export declare const SchemaDisplayParameter: ({ name, type, required, description, location, className, ...props }: SchemaDisplayParameterProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export type SchemaDisplayParametersProps = ComponentProps<typeof Collapsible>;
|
|
33
|
+
export declare const SchemaDisplayParameters: ({ className, children, ...props }: SchemaDisplayParametersProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export type SchemaDisplayPropertyProps = HTMLAttributes<HTMLDivElement> & SchemaProperty & {
|
|
35
|
+
depth?: number;
|
|
36
|
+
};
|
|
37
|
+
export declare const SchemaDisplayProperty: ({ name, type, required, description, properties, items, depth, className, ...props }: SchemaDisplayPropertyProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export type SchemaDisplayRequestProps = ComponentProps<typeof Collapsible>;
|
|
39
|
+
export declare const SchemaDisplayRequest: ({ className, children, ...props }: SchemaDisplayRequestProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export type SchemaDisplayResponseProps = ComponentProps<typeof Collapsible>;
|
|
41
|
+
export declare const SchemaDisplayResponse: ({ className, children, ...props }: SchemaDisplayResponseProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export type SchemaDisplayProps = HTMLAttributes<HTMLDivElement> & {
|
|
43
|
+
method: HttpMethod;
|
|
44
|
+
path: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
parameters?: SchemaParameter[];
|
|
47
|
+
requestBody?: SchemaProperty[];
|
|
48
|
+
responseBody?: SchemaProperty[];
|
|
49
|
+
};
|
|
50
|
+
export declare const SchemaDisplay: ({ method, path, description, parameters, requestBody, responseBody, className, children, ...props }: SchemaDisplayProps) => import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
export type SchemaDisplayBodyProps = HTMLAttributes<HTMLDivElement>;
|
|
52
|
+
export declare const SchemaDisplayBody: ({ className, children, ...props }: SchemaDisplayBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
export type SchemaDisplayExampleProps = HTMLAttributes<HTMLPreElement>;
|
|
54
|
+
export declare const SchemaDisplayExample: ({ className, children, ...props }: SchemaDisplayExampleProps) => import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=schema-display.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-display.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/schema-display.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Badge } from "@chatsdk-dev/ui/atoms/badge";
|
|
4
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@chatsdk-dev/ui/atoms/collapsible";
|
|
5
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
6
|
+
import { ChevronRightIcon } from "lucide-react";
|
|
7
|
+
import { createContext, useContext, useMemo } from "react";
|
|
8
|
+
const SchemaDisplayContext = createContext({
|
|
9
|
+
method: "GET",
|
|
10
|
+
path: "",
|
|
11
|
+
});
|
|
12
|
+
const methodStyles = {
|
|
13
|
+
DELETE: "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",
|
|
14
|
+
GET: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
|
|
15
|
+
PATCH: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",
|
|
16
|
+
POST: "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",
|
|
17
|
+
PUT: "bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400",
|
|
18
|
+
};
|
|
19
|
+
export const SchemaDisplayHeader = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex items-center gap-3 border-b px-4 py-3", className), ...props, children: children }));
|
|
20
|
+
export const SchemaDisplayMethod = ({ className, children, ...props }) => {
|
|
21
|
+
const { method } = useContext(SchemaDisplayContext);
|
|
22
|
+
return (_jsx(Badge, { className: cn("font-mono text-xs", methodStyles[method], className), variant: "secondary", ...props, children: children ?? method }));
|
|
23
|
+
};
|
|
24
|
+
export const SchemaDisplayPath = ({ className, children, ...props }) => {
|
|
25
|
+
const { path } = useContext(SchemaDisplayContext);
|
|
26
|
+
// Highlight path parameters
|
|
27
|
+
const highlightedPath = path.replaceAll(/\{([^}]+)\}/g, '<span class="text-blue-600 dark:text-blue-400">{$1}</span>');
|
|
28
|
+
return (_jsx("span", { className: cn("font-mono text-sm", className),
|
|
29
|
+
// oxlint-disable-next-line eslint-plugin-react(no-danger)
|
|
30
|
+
dangerouslySetInnerHTML: { __html: children ?? highlightedPath }, ...props }));
|
|
31
|
+
};
|
|
32
|
+
export const SchemaDisplayDescription = ({ className, children, ...props }) => {
|
|
33
|
+
const { description } = useContext(SchemaDisplayContext);
|
|
34
|
+
return (_jsx("p", { className: cn("border-b px-4 py-3 text-muted-foreground text-sm", className), ...props, children: children ?? description }));
|
|
35
|
+
};
|
|
36
|
+
export const SchemaDisplayContent = ({ className, children, ...props }) => (_jsx("div", { className: cn("divide-y", className), ...props, children: children }));
|
|
37
|
+
export const SchemaDisplayParameter = ({ name, type, required, description, location, className, ...props }) => (_jsxs("div", { className: cn("px-4 py-3 pl-10", className), ...props, children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "font-mono text-sm", children: name }), _jsx(Badge, { className: "text-xs", variant: "outline", children: type }), location && (_jsx(Badge, { className: "text-xs", variant: "secondary", children: location })), required && (_jsx(Badge, { className: "bg-red-100 text-red-700 text-xs dark:bg-red-900/30 dark:text-red-400", variant: "secondary", children: "required" }))] }), description && (_jsx("p", { className: "mt-1 text-muted-foreground text-sm", children: description }))] }));
|
|
38
|
+
export const SchemaDisplayParameters = ({ className, children, ...props }) => {
|
|
39
|
+
const { parameters } = useContext(SchemaDisplayContext);
|
|
40
|
+
return (_jsxs(Collapsible, { className: cn(className), defaultOpen: true, ...props, children: [_jsxs(CollapsibleTrigger, { className: "group flex w-full items-center gap-2 px-4 py-3 text-left transition-colors hover:bg-muted/50", children: [_jsx(ChevronRightIcon, { className: "size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90" }), _jsx("span", { className: "font-medium text-sm", children: "Parameters" }), _jsx(Badge, { className: "ml-auto text-xs", variant: "secondary", children: parameters?.length })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "divide-y border-t", children: children ??
|
|
41
|
+
parameters?.map((param) => (_jsx(SchemaDisplayParameter, { ...param }, param.name))) }) })] }));
|
|
42
|
+
};
|
|
43
|
+
export const SchemaDisplayProperty = ({ name, type, required, description, properties, items, depth = 0, className, ...props }) => {
|
|
44
|
+
const hasChildren = properties || items;
|
|
45
|
+
const paddingLeft = 40 + depth * 16;
|
|
46
|
+
if (hasChildren) {
|
|
47
|
+
return (_jsxs(Collapsible, { defaultOpen: depth < 2, children: [_jsxs(CollapsibleTrigger, { className: cn("group flex w-full items-center gap-2 py-3 text-left transition-colors hover:bg-muted/50", className), style: { paddingLeft }, children: [_jsx(ChevronRightIcon, { className: "size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90" }), _jsx("span", { className: "font-mono text-sm", children: name }), _jsx(Badge, { className: "text-xs", variant: "outline", children: type }), required && (_jsx(Badge, { className: "bg-red-100 text-red-700 text-xs dark:bg-red-900/30 dark:text-red-400", variant: "secondary", children: "required" }))] }), description && (_jsx("p", { className: "pb-2 text-muted-foreground text-sm", style: { paddingLeft: paddingLeft + 24 }, children: description })), _jsx(CollapsibleContent, { children: _jsxs("div", { className: "divide-y border-t", children: [properties?.map((prop) => (_jsx(SchemaDisplayProperty, { ...prop, depth: depth + 1 }, prop.name))), items && (_jsx(SchemaDisplayProperty, { ...items, depth: depth + 1, name: `${name}[]` }))] }) })] }));
|
|
48
|
+
}
|
|
49
|
+
return (_jsxs("div", { className: cn("py-3 pr-4", className), style: { paddingLeft }, ...props, children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "size-4" }), _jsx("span", { className: "font-mono text-sm", children: name }), _jsx(Badge, { className: "text-xs", variant: "outline", children: type }), required && (_jsx(Badge, { className: "bg-red-100 text-red-700 text-xs dark:bg-red-900/30 dark:text-red-400", variant: "secondary", children: "required" }))] }), description && (_jsx("p", { className: "mt-1 pl-6 text-muted-foreground text-sm", children: description }))] }));
|
|
50
|
+
};
|
|
51
|
+
export const SchemaDisplayRequest = ({ className, children, ...props }) => {
|
|
52
|
+
const { requestBody } = useContext(SchemaDisplayContext);
|
|
53
|
+
return (_jsxs(Collapsible, { className: cn(className), defaultOpen: true, ...props, children: [_jsxs(CollapsibleTrigger, { className: "group flex w-full items-center gap-2 px-4 py-3 text-left transition-colors hover:bg-muted/50", children: [_jsx(ChevronRightIcon, { className: "size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90" }), _jsx("span", { className: "font-medium text-sm", children: "Request Body" })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "border-t", children: children ??
|
|
54
|
+
requestBody?.map((prop) => (_jsx(SchemaDisplayProperty, { ...prop, depth: 0 }, prop.name))) }) })] }));
|
|
55
|
+
};
|
|
56
|
+
export const SchemaDisplayResponse = ({ className, children, ...props }) => {
|
|
57
|
+
const { responseBody } = useContext(SchemaDisplayContext);
|
|
58
|
+
return (_jsxs(Collapsible, { className: cn(className), defaultOpen: true, ...props, children: [_jsxs(CollapsibleTrigger, { className: "group flex w-full items-center gap-2 px-4 py-3 text-left transition-colors hover:bg-muted/50", children: [_jsx(ChevronRightIcon, { className: "size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90" }), _jsx("span", { className: "font-medium text-sm", children: "Response" })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "border-t", children: children ??
|
|
59
|
+
responseBody?.map((prop) => (_jsx(SchemaDisplayProperty, { ...prop, depth: 0 }, prop.name))) }) })] }));
|
|
60
|
+
};
|
|
61
|
+
export const SchemaDisplay = ({ method, path, description, parameters, requestBody, responseBody, className, children, ...props }) => {
|
|
62
|
+
const contextValue = useMemo(() => ({
|
|
63
|
+
description,
|
|
64
|
+
method,
|
|
65
|
+
parameters,
|
|
66
|
+
path,
|
|
67
|
+
requestBody,
|
|
68
|
+
responseBody,
|
|
69
|
+
}), [description, method, parameters, path, requestBody, responseBody]);
|
|
70
|
+
return (_jsx(SchemaDisplayContext.Provider, { value: contextValue, children: _jsx("div", { className: cn("overflow-hidden rounded-lg border bg-background", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx(SchemaDisplayHeader, { children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(SchemaDisplayMethod, {}), _jsx(SchemaDisplayPath, {})] }) }), description && _jsx(SchemaDisplayDescription, {}), _jsxs(SchemaDisplayContent, { children: [parameters && parameters.length > 0 && (_jsx(SchemaDisplayParameters, {})), requestBody && requestBody.length > 0 && (_jsx(SchemaDisplayRequest, {})), responseBody && responseBody.length > 0 && (_jsx(SchemaDisplayResponse, {}))] })] })) }) }));
|
|
71
|
+
};
|
|
72
|
+
export const SchemaDisplayBody = ({ className, children, ...props }) => (_jsx("div", { className: cn("divide-y", className), ...props, children: children }));
|
|
73
|
+
export const SchemaDisplayExample = ({ className, children, ...props }) => (_jsx("pre", { className: cn("mx-4 mb-4 overflow-auto rounded-md bg-muted p-4 font-mono text-sm", className), ...props, children: children }));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ElementType } from "react";
|
|
2
|
+
export interface TextShimmerProps {
|
|
3
|
+
children: string;
|
|
4
|
+
as?: ElementType;
|
|
5
|
+
className?: string;
|
|
6
|
+
duration?: number;
|
|
7
|
+
spread?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const Shimmer: import("react").MemoExoticComponent<({ children, as: Component, className, duration, spread, }: TextShimmerProps) => import("react/jsx-runtime").JSX.Element>;
|
|
10
|
+
//# sourceMappingURL=shimmer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shimmer.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/shimmer.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAiB,WAAW,EAAO,MAAM,OAAO,CAAC;AAoB7D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,WAAW,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA6CD,eAAO,MAAM,OAAO,kGArCjB,gBAAgB,6CAqC0B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
4
|
+
import { motion } from "motion/react";
|
|
5
|
+
import { memo, useMemo } from "react";
|
|
6
|
+
// Cache motion components at module level to avoid creating during render
|
|
7
|
+
const motionComponentCache = new Map();
|
|
8
|
+
const getMotionComponent = (element) => {
|
|
9
|
+
let component = motionComponentCache.get(element);
|
|
10
|
+
if (!component) {
|
|
11
|
+
component = motion.create(element);
|
|
12
|
+
motionComponentCache.set(element, component);
|
|
13
|
+
}
|
|
14
|
+
return component;
|
|
15
|
+
};
|
|
16
|
+
const ShimmerComponent = ({ children, as: Component = "p", className, duration = 2, spread = 2, }) => {
|
|
17
|
+
const MotionComponent = getMotionComponent(Component);
|
|
18
|
+
const dynamicSpread = useMemo(() => (children?.length ?? 0) * spread, [children, spread]);
|
|
19
|
+
return (_jsx(MotionComponent, { animate: { backgroundPosition: "0% center" }, className: cn("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent", "[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]", className), initial: { backgroundPosition: "100% center" }, style: {
|
|
20
|
+
"--spread": `${dynamicSpread}px`,
|
|
21
|
+
backgroundImage: "var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))",
|
|
22
|
+
}, transition: {
|
|
23
|
+
duration,
|
|
24
|
+
ease: "linear",
|
|
25
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
26
|
+
}, children: children }));
|
|
27
|
+
};
|
|
28
|
+
export const Shimmer = memo(ShimmerComponent);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText } from "@chatsdk-dev/ui/atoms/input-group";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
export type SnippetProps = ComponentProps<typeof InputGroup> & {
|
|
4
|
+
code: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const Snippet: ({ code, className, children, ...props }: SnippetProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export type SnippetAddonProps = ComponentProps<typeof InputGroupAddon>;
|
|
8
|
+
export declare const SnippetAddon: (props: SnippetAddonProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export type SnippetTextProps = ComponentProps<typeof InputGroupText>;
|
|
10
|
+
export declare const SnippetText: ({ className, ...props }: SnippetTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export type SnippetInputProps = Omit<ComponentProps<typeof InputGroupInput>, "readOnly" | "value">;
|
|
12
|
+
export declare const SnippetInput: ({ className, ...props }: SnippetInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export type SnippetCopyButtonProps = ComponentProps<typeof InputGroupButton> & {
|
|
14
|
+
onCopy?: () => void;
|
|
15
|
+
onError?: (error: Error) => void;
|
|
16
|
+
timeout?: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const SnippetCopyButton: ({ onCopy, onError, timeout, children, className, ...props }: SnippetCopyButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=snippet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snippet.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/snippet.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,cAAc,EACf,MAAM,mCAAmC,CAAC;AAG3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAmB5C,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,GAAG;IAC7D,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,yCAKrB,YAAY,4CAUd,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,eAAe,CAAC,CAAC;AAEvE,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,4CAEpD,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,cAAc,CAAC,CAAC;AAErE,eAAO,MAAM,WAAW,GAAI,yBAAyB,gBAAgB,4CAKpE,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,cAAc,CAAC,OAAO,eAAe,CAAC,EACtC,UAAU,GAAG,OAAO,CACrB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,yBAAyB,iBAAiB,4CAWtE,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,GAAG;IAC7E,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,6DAO/B,sBAAsB,4CA+CxB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, } from "@chatsdk-dev/ui/atoms/input-group";
|
|
4
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
5
|
+
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
6
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
7
|
+
const SnippetContext = createContext({
|
|
8
|
+
code: "",
|
|
9
|
+
});
|
|
10
|
+
export const Snippet = ({ code, className, children, ...props }) => {
|
|
11
|
+
const contextValue = useMemo(() => ({ code }), [code]);
|
|
12
|
+
return (_jsx(SnippetContext.Provider, { value: contextValue, children: _jsx(InputGroup, { className: cn("font-mono", className), ...props, children: children }) }));
|
|
13
|
+
};
|
|
14
|
+
export const SnippetAddon = (props) => (_jsx(InputGroupAddon, { ...props }));
|
|
15
|
+
export const SnippetText = ({ className, ...props }) => (_jsx(InputGroupText, { className: cn("pl-2 font-normal text-muted-foreground", className), ...props }));
|
|
16
|
+
export const SnippetInput = ({ className, ...props }) => {
|
|
17
|
+
const { code } = useContext(SnippetContext);
|
|
18
|
+
return (_jsx(InputGroupInput, { className: cn("text-foreground", className), readOnly: true, value: code, ...props }));
|
|
19
|
+
};
|
|
20
|
+
export const SnippetCopyButton = ({ onCopy, onError, timeout = 2000, children, className, ...props }) => {
|
|
21
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
22
|
+
const timeoutRef = useRef(0);
|
|
23
|
+
const { code } = useContext(SnippetContext);
|
|
24
|
+
const copyToClipboard = useCallback(async () => {
|
|
25
|
+
if (typeof window === "undefined" || !navigator?.clipboard?.writeText) {
|
|
26
|
+
onError?.(new Error("Clipboard API not available"));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
if (!isCopied) {
|
|
31
|
+
await navigator.clipboard.writeText(code);
|
|
32
|
+
setIsCopied(true);
|
|
33
|
+
onCopy?.();
|
|
34
|
+
timeoutRef.current = window.setTimeout(() => setIsCopied(false), timeout);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
onError?.(error);
|
|
39
|
+
}
|
|
40
|
+
}, [code, onCopy, onError, timeout, isCopied]);
|
|
41
|
+
useEffect(() => () => {
|
|
42
|
+
window.clearTimeout(timeoutRef.current);
|
|
43
|
+
}, []);
|
|
44
|
+
const Icon = isCopied ? CheckIcon : CopyIcon;
|
|
45
|
+
return (_jsx(InputGroupButton, { "aria-label": "Copy", className: className, onClick: copyToClipboard, size: "icon-sm", title: "Copy", ...props, children: children ?? _jsx(Icon, { className: "size-3.5", size: 14 }) }));
|
|
46
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CollapsibleContent, CollapsibleTrigger } from "@chatsdk-dev/ui/atoms/collapsible";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
export type SourcesProps = ComponentProps<"div">;
|
|
4
|
+
export declare const Sources: ({ className, ...props }: SourcesProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export type SourcesTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {
|
|
6
|
+
count: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const SourcesTrigger: ({ className, count, children, ...props }: SourcesTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export type SourcesContentProps = ComponentProps<typeof CollapsibleContent>;
|
|
10
|
+
export declare const SourcesContent: ({ className, ...props }: SourcesContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export type SourceProps = ComponentProps<"a">;
|
|
12
|
+
export declare const Source: ({ href, title, children, ...props }: SourceProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/sources.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAEjD,eAAO,MAAM,OAAO,GAAI,yBAAyB,YAAY,4CAK5D,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,kBAAkB,CAAC,GAAG;IAC5E,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,0CAK5B,mBAAmB,4CAYrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE5E,eAAO,MAAM,cAAc,GAAI,yBAG5B,mBAAmB,4CASrB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;AAE9C,eAAO,MAAM,MAAM,GAAI,qCAAqC,WAAW,4CAetE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@chatsdk-dev/ui/atoms/collapsible";
|
|
4
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
5
|
+
import { BookIcon, ChevronDownIcon } from "lucide-react";
|
|
6
|
+
export const Sources = ({ className, ...props }) => (_jsx(Collapsible, { className: cn("not-prose mb-4 text-primary text-xs", className), ...props }));
|
|
7
|
+
export const SourcesTrigger = ({ className, count, children, ...props }) => (_jsx(CollapsibleTrigger, { className: cn("flex items-center gap-2", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsxs("p", { className: "font-medium", children: ["Used ", count, " sources"] }), _jsx(ChevronDownIcon, { className: "h-4 w-4" })] })) }));
|
|
8
|
+
export const SourcesContent = ({ className, ...props }) => (_jsx(CollapsibleContent, { className: cn("mt-3 flex w-fit flex-col gap-2", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", className), ...props }));
|
|
9
|
+
export const Source = ({ href, title, children, ...props }) => (_jsx("a", { className: "flex items-center gap-2", href: href, rel: "noreferrer", target: "_blank", ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx(BookIcon, { className: "h-4 w-4" }), _jsx("span", { className: "block font-medium", children: title })] })) }));
|