@wzh-/ai-chat-example 1.0.0
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/.vscode/extensions.json +3 -0
- package/.vscode/settings.json +6 -0
- package/README.md +5 -0
- package/auto-imports.d.ts +73 -0
- package/components.d.ts +312 -0
- package/components.json +21 -0
- package/index.html +13 -0
- package/package.json +60 -0
- package/public/vite.svg +1 -0
- package/src/App.vue +68 -0
- package/src/components/ChatConversation/ChatConversation.vue +97 -0
- package/src/components/ChatConversation/index.ts +1 -0
- package/src/components/ChatPromptInputProvider/ChatPromptInputProvider.vue +47 -0
- package/src/components/ChatPromptInputProvider/index.ts +1 -0
- package/src/components/ai-elements/artifact/Artifact.vue +23 -0
- package/src/components/ai-elements/artifact/ArtifactAction.vue +72 -0
- package/src/components/ai-elements/artifact/ArtifactActions.vue +19 -0
- package/src/components/ai-elements/artifact/ArtifactClose.vue +39 -0
- package/src/components/ai-elements/artifact/ArtifactContent.vue +20 -0
- package/src/components/ai-elements/artifact/ArtifactDescription.vue +20 -0
- package/src/components/ai-elements/artifact/ArtifactHeader.vue +23 -0
- package/src/components/ai-elements/artifact/ArtifactTitle.vue +20 -0
- package/src/components/ai-elements/artifact/index.ts +8 -0
- package/src/components/ai-elements/canvas/Canvas.vue +37 -0
- package/src/components/ai-elements/canvas/index.ts +1 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThought.vue +41 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThoughtContent.vue +32 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThoughtHeader.vue +43 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThoughtImage.vue +25 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThoughtSearchResult.vue +24 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThoughtSearchResults.vue +17 -0
- package/src/components/ai-elements/chain-of-thought/ChainOfThoughtStep.vue +54 -0
- package/src/components/ai-elements/chain-of-thought/context.ts +22 -0
- package/src/components/ai-elements/chain-of-thought/index.ts +7 -0
- package/src/components/ai-elements/checkpoint/Checkpoint.vue +19 -0
- package/src/components/ai-elements/checkpoint/CheckpointIcon.vue +19 -0
- package/src/components/ai-elements/checkpoint/CheckpointTrigger.vue +46 -0
- package/src/components/ai-elements/checkpoint/index.ts +3 -0
- package/src/components/ai-elements/code-block/CodeBlock.vue +84 -0
- package/src/components/ai-elements/code-block/CodeBlockCopyButton.vue +84 -0
- package/src/components/ai-elements/code-block/context.ts +7 -0
- package/src/components/ai-elements/code-block/index.ts +2 -0
- package/src/components/ai-elements/code-block/utils.ts +46 -0
- package/src/components/ai-elements/confirmation/Confirmation.vue +30 -0
- package/src/components/ai-elements/confirmation/ConfirmationAccepted.vue +18 -0
- package/src/components/ai-elements/confirmation/ConfirmationAction.vue +9 -0
- package/src/components/ai-elements/confirmation/ConfirmationActions.vue +23 -0
- package/src/components/ai-elements/confirmation/ConfirmationRejected.vue +18 -0
- package/src/components/ai-elements/confirmation/ConfirmationRequest.vue +11 -0
- package/src/components/ai-elements/confirmation/ConfirmationTitle.vue +18 -0
- package/src/components/ai-elements/confirmation/context.ts +46 -0
- package/src/components/ai-elements/confirmation/index.ts +7 -0
- package/src/components/ai-elements/connection/Connection.vue +36 -0
- package/src/components/ai-elements/connection/index.ts +1 -0
- package/src/components/ai-elements/context/Context.vue +29 -0
- package/src/components/ai-elements/context/ContextCacheUsage.vue +45 -0
- package/src/components/ai-elements/context/ContextContent.vue +20 -0
- package/src/components/ai-elements/context/ContextContentBody.vue +14 -0
- package/src/components/ai-elements/context/ContextContentFooter.vue +49 -0
- package/src/components/ai-elements/context/ContextContentHeader.vue +49 -0
- package/src/components/ai-elements/context/ContextIcon.vue +62 -0
- package/src/components/ai-elements/context/ContextInputUsage.vue +46 -0
- package/src/components/ai-elements/context/ContextOutputUsage.vue +45 -0
- package/src/components/ai-elements/context/ContextReasoningUsage.vue +48 -0
- package/src/components/ai-elements/context/ContextTrigger.vue +32 -0
- package/src/components/ai-elements/context/TokensWithCost.vue +25 -0
- package/src/components/ai-elements/context/context.ts +23 -0
- package/src/components/ai-elements/context/index.ts +12 -0
- package/src/components/ai-elements/controls/Controls.vue +25 -0
- package/src/components/ai-elements/controls/index.ts +1 -0
- package/src/components/ai-elements/conversation/Conversation.vue +37 -0
- package/src/components/ai-elements/conversation/ConversationContent.vue +21 -0
- package/src/components/ai-elements/conversation/ConversationEmptyState.vue +40 -0
- package/src/components/ai-elements/conversation/ConversationScrollButton.vue +34 -0
- package/src/components/ai-elements/conversation/index.ts +4 -0
- package/src/components/ai-elements/edge/Animated.vue +91 -0
- package/src/components/ai-elements/edge/Temporary.vue +28 -0
- package/src/components/ai-elements/edge/index.ts +2 -0
- package/src/components/ai-elements/image/Image.vue +29 -0
- package/src/components/ai-elements/image/index.ts +1 -0
- package/src/components/ai-elements/inline-citation/InlineCitation.vue +14 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCard.vue +17 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCardBody.vue +15 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCardTrigger.vue +35 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarousel.vue +15 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarouselContent.vue +9 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarouselHeader.vue +16 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarouselIndex.vue +46 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarouselItem.vue +15 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarouselNext.vue +23 -0
- package/src/components/ai-elements/inline-citation/InlineCitationCarouselPrev.vue +23 -0
- package/src/components/ai-elements/inline-citation/InlineCitationQuote.vue +16 -0
- package/src/components/ai-elements/inline-citation/InlineCitationSource.vue +26 -0
- package/src/components/ai-elements/inline-citation/InlineCitationText.vue +14 -0
- package/src/components/ai-elements/inline-citation/index.ts +14 -0
- package/src/components/ai-elements/loader/Loader.vue +23 -0
- package/src/components/ai-elements/loader/LoaderIcon.vue +38 -0
- package/src/components/ai-elements/loader/index.ts +2 -0
- package/src/components/ai-elements/message/Message.vue +27 -0
- package/src/components/ai-elements/message/MessageAction.vue +45 -0
- package/src/components/ai-elements/message/MessageActions.vue +19 -0
- package/src/components/ai-elements/message/MessageAttachment.vue +87 -0
- package/src/components/ai-elements/message/MessageAttachments.vue +25 -0
- package/src/components/ai-elements/message/MessageAvatar.vue +22 -0
- package/src/components/ai-elements/message/MessageBranch.vue +66 -0
- package/src/components/ai-elements/message/MessageBranchContent.vue +51 -0
- package/src/components/ai-elements/message/MessageBranchNext.vue +23 -0
- package/src/components/ai-elements/message/MessageBranchPage.vue +28 -0
- package/src/components/ai-elements/message/MessageBranchPrevious.vue +23 -0
- package/src/components/ai-elements/message/MessageBranchSelector.vue +23 -0
- package/src/components/ai-elements/message/MessageContent.vue +26 -0
- package/src/components/ai-elements/message/MessageResponse.vue +42 -0
- package/src/components/ai-elements/message/MessageToolbar.vue +24 -0
- package/src/components/ai-elements/message/context.ts +22 -0
- package/src/components/ai-elements/message/index.ts +15 -0
- package/src/components/ai-elements/model-selector/ModelSelector.vue +9 -0
- package/src/components/ai-elements/model-selector/ModelSelectorContent.vue +29 -0
- package/src/components/ai-elements/model-selector/ModelSelectorDialog.vue +9 -0
- package/src/components/ai-elements/model-selector/ModelSelectorEmpty.vue +9 -0
- package/src/components/ai-elements/model-selector/ModelSelectorGroup.vue +9 -0
- package/src/components/ai-elements/model-selector/ModelSelectorInput.vue +18 -0
- package/src/components/ai-elements/model-selector/ModelSelectorItem.vue +10 -0
- package/src/components/ai-elements/model-selector/ModelSelectorList.vue +9 -0
- package/src/components/ai-elements/model-selector/ModelSelectorLogo.vue +22 -0
- package/src/components/ai-elements/model-selector/ModelSelectorLogoGroup.vue +24 -0
- package/src/components/ai-elements/model-selector/ModelSelectorName.vue +19 -0
- package/src/components/ai-elements/model-selector/ModelSelectorSeparator.vue +7 -0
- package/src/components/ai-elements/model-selector/ModelSelectorShortcut.vue +9 -0
- package/src/components/ai-elements/model-selector/ModelSelectorTrigger.vue +9 -0
- package/src/components/ai-elements/model-selector/index.ts +14 -0
- package/src/components/ai-elements/node/Node.vue +31 -0
- package/src/components/ai-elements/node/NodeAction.vue +9 -0
- package/src/components/ai-elements/node/NodeContent.vue +15 -0
- package/src/components/ai-elements/node/NodeDescription.vue +9 -0
- package/src/components/ai-elements/node/NodeFooter.vue +15 -0
- package/src/components/ai-elements/node/NodeHeader.vue +15 -0
- package/src/components/ai-elements/node/NodeTitle.vue +9 -0
- package/src/components/ai-elements/node/index.ts +7 -0
- package/src/components/ai-elements/open-in-chat/OpenIn.vue +20 -0
- package/src/components/ai-elements/open-in-chat/OpenInContent.vue +25 -0
- package/src/components/ai-elements/open-in-chat/OpenInItemLink.vue +30 -0
- package/src/components/ai-elements/open-in-chat/OpenInTrigger.vue +16 -0
- package/src/components/ai-elements/open-in-chat/context.ts +20 -0
- package/src/components/ai-elements/open-in-chat/index.ts +9 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/ChatGPT.vue +13 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/Claude.vue +15 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/Cursor.vue +13 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/Github.vue +8 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/Scira.vue +58 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/V0.vue +15 -0
- package/src/components/ai-elements/open-in-chat/providers/icons/index.ts +6 -0
- package/src/components/ai-elements/open-in-chat/providers/index.ts +69 -0
- package/src/components/ai-elements/open-in-chat/providers/items/OpenInChatGPT.vue +18 -0
- package/src/components/ai-elements/open-in-chat/providers/items/OpenInClaude.vue +18 -0
- package/src/components/ai-elements/open-in-chat/providers/items/OpenInCursor.vue +18 -0
- package/src/components/ai-elements/open-in-chat/providers/items/OpenInScira.vue +18 -0
- package/src/components/ai-elements/open-in-chat/providers/items/OpenInT3.vue +18 -0
- package/src/components/ai-elements/open-in-chat/providers/items/OpenInv0.vue +18 -0
- package/src/components/ai-elements/panel/Panel.vue +28 -0
- package/src/components/ai-elements/panel/index.ts +1 -0
- package/src/components/ai-elements/plan/Plan.vue +32 -0
- package/src/components/ai-elements/plan/PlanAction.vue +9 -0
- package/src/components/ai-elements/plan/PlanContent.vue +12 -0
- package/src/components/ai-elements/plan/PlanDescription.vue +25 -0
- package/src/components/ai-elements/plan/PlanFooter.vue +9 -0
- package/src/components/ai-elements/plan/PlanHeader.vue +18 -0
- package/src/components/ai-elements/plan/PlanTitle.vue +16 -0
- package/src/components/ai-elements/plan/PlanTrigger.vue +25 -0
- package/src/components/ai-elements/plan/context.ts +20 -0
- package/src/components/ai-elements/plan/index.ts +8 -0
- package/src/components/ai-elements/prompt-input/PromptInput.vue +116 -0
- package/src/components/ai-elements/prompt-input/PromptInputActionAddAttachments.vue +22 -0
- package/src/components/ai-elements/prompt-input/PromptInputActionMenu.vue +15 -0
- package/src/components/ai-elements/prompt-input/PromptInputActionMenuContent.vue +21 -0
- package/src/components/ai-elements/prompt-input/PromptInputActionMenuItem.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputActionMenuTrigger.vue +22 -0
- package/src/components/ai-elements/prompt-input/PromptInputAttachment.vue +94 -0
- package/src/components/ai-elements/prompt-input/PromptInputAttachments.vue +22 -0
- package/src/components/ai-elements/prompt-input/PromptInputBody.vue +12 -0
- package/src/components/ai-elements/prompt-input/PromptInputButton.vue +56 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommand.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommandEmpty.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommandGroup.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommandInput.vue +17 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommandItem.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommandList.vue +17 -0
- package/src/components/ai-elements/prompt-input/PromptInputCommandSeparator.vue +16 -0
- package/src/components/ai-elements/prompt-input/PromptInputFooter.vue +23 -0
- package/src/components/ai-elements/prompt-input/PromptInputHeader.vue +23 -0
- package/src/components/ai-elements/prompt-input/PromptInputHoverCard.vue +23 -0
- package/src/components/ai-elements/prompt-input/PromptInputHoverCardContent.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputHoverCardTrigger.vue +15 -0
- package/src/components/ai-elements/prompt-input/PromptInputProvider.vue +32 -0
- package/src/components/ai-elements/prompt-input/PromptInputSelect.vue +15 -0
- package/src/components/ai-elements/prompt-input/PromptInputSelectContent.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputSelectItem.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputSelectTrigger.vue +26 -0
- package/src/components/ai-elements/prompt-input/PromptInputSelectValue.vue +19 -0
- package/src/components/ai-elements/prompt-input/PromptInputSpeechButton.vue +137 -0
- package/src/components/ai-elements/prompt-input/PromptInputSubmit.vue +60 -0
- package/src/components/ai-elements/prompt-input/PromptInputTab.vue +16 -0
- package/src/components/ai-elements/prompt-input/PromptInputTabBody.vue +16 -0
- package/src/components/ai-elements/prompt-input/PromptInputTabItem.vue +16 -0
- package/src/components/ai-elements/prompt-input/PromptInputTabLabel.vue +16 -0
- package/src/components/ai-elements/prompt-input/PromptInputTabsList.vue +16 -0
- package/src/components/ai-elements/prompt-input/PromptInputTextarea.vue +78 -0
- package/src/components/ai-elements/prompt-input/PromptInputTools.vue +12 -0
- package/src/components/ai-elements/prompt-input/context.ts +223 -0
- package/src/components/ai-elements/prompt-input/index.ts +39 -0
- package/src/components/ai-elements/prompt-input/types.ts +28 -0
- package/src/components/ai-elements/queue/Queue.vue +21 -0
- package/src/components/ai-elements/queue/QueueItem.vue +21 -0
- package/src/components/ai-elements/queue/QueueItemAction.vue +25 -0
- package/src/components/ai-elements/queue/QueueItemActions.vue +14 -0
- package/src/components/ai-elements/queue/QueueItemAttachment.vue +14 -0
- package/src/components/ai-elements/queue/QueueItemContent.vue +32 -0
- package/src/components/ai-elements/queue/QueueItemDescription.vue +32 -0
- package/src/components/ai-elements/queue/QueueItemFile.vue +25 -0
- package/src/components/ai-elements/queue/QueueItemImage.vue +18 -0
- package/src/components/ai-elements/queue/QueueItemIndicator.vue +30 -0
- package/src/components/ai-elements/queue/QueueList.vue +22 -0
- package/src/components/ai-elements/queue/QueueSection.vue +26 -0
- package/src/components/ai-elements/queue/QueueSectionContent.vue +15 -0
- package/src/components/ai-elements/queue/QueueSectionLabel.vue +26 -0
- package/src/components/ai-elements/queue/QueueSectionTrigger.vue +25 -0
- package/src/components/ai-elements/queue/index.ts +15 -0
- package/src/components/ai-elements/reasoning/Reasoning.vue +94 -0
- package/src/components/ai-elements/reasoning/ReasoningContent.vue +41 -0
- package/src/components/ai-elements/reasoning/ReasoningTrigger.vue +61 -0
- package/src/components/ai-elements/reasoning/context.ts +19 -0
- package/src/components/ai-elements/reasoning/index.ts +3 -0
- package/src/components/ai-elements/shimmer/Shimmer.vue +69 -0
- package/src/components/ai-elements/shimmer/index.ts +1 -0
- package/src/components/ai-elements/sources/Source.vue +26 -0
- package/src/components/ai-elements/sources/Sources.vue +17 -0
- package/src/components/ai-elements/sources/SourcesContent.vue +23 -0
- package/src/components/ai-elements/sources/SourcesTrigger.vue +24 -0
- package/src/components/ai-elements/sources/index.ts +4 -0
- package/src/components/ai-elements/suggestion/Suggestion.vue +38 -0
- package/src/components/ai-elements/suggestion/Suggestions.vue +20 -0
- package/src/components/ai-elements/suggestion/index.ts +2 -0
- package/src/components/ai-elements/task/Task.vue +32 -0
- package/src/components/ai-elements/task/TaskContent.vue +27 -0
- package/src/components/ai-elements/task/TaskItem.vue +16 -0
- package/src/components/ai-elements/task/TaskItemFile.vue +18 -0
- package/src/components/ai-elements/task/TaskTrigger.vue +33 -0
- package/src/components/ai-elements/task/index.ts +5 -0
- package/src/components/ai-elements/tool/Tool.vue +18 -0
- package/src/components/ai-elements/tool/ToolContent.vue +23 -0
- package/src/components/ai-elements/tool/ToolHeader.vue +38 -0
- package/src/components/ai-elements/tool/ToolInput.vue +32 -0
- package/src/components/ai-elements/tool/ToolOutput.vue +69 -0
- package/src/components/ai-elements/tool/ToolStatusBadge.vue +63 -0
- package/src/components/ai-elements/tool/index.ts +5 -0
- package/src/components/ai-elements/toolbar/Toolbar.vue +32 -0
- package/src/components/ai-elements/toolbar/index.ts +1 -0
- package/src/components/ai-elements/web-preview/WebPreview.vue +60 -0
- package/src/components/ai-elements/web-preview/WebPreviewBody.vue +34 -0
- package/src/components/ai-elements/web-preview/WebPreviewConsole.vue +92 -0
- package/src/components/ai-elements/web-preview/WebPreviewNavigation.vue +21 -0
- package/src/components/ai-elements/web-preview/WebPreviewNavigationButton.vue +45 -0
- package/src/components/ai-elements/web-preview/WebPreviewUrl.vue +43 -0
- package/src/components/ai-elements/web-preview/context.ts +25 -0
- package/src/components/ai-elements/web-preview/index.ts +7 -0
- package/src/components/ui/alert/Alert.vue +21 -0
- package/src/components/ui/alert/AlertDescription.vue +17 -0
- package/src/components/ui/alert/AlertTitle.vue +17 -0
- package/src/components/ui/alert/index.ts +24 -0
- package/src/components/ui/avatar/Avatar.vue +18 -0
- package/src/components/ui/avatar/AvatarFallback.vue +21 -0
- package/src/components/ui/avatar/AvatarImage.vue +16 -0
- package/src/components/ui/avatar/index.ts +3 -0
- package/src/components/ui/badge/Badge.vue +26 -0
- package/src/components/ui/badge/index.ts +26 -0
- package/src/components/ui/button/Button.vue +29 -0
- package/src/components/ui/button/index.ts +38 -0
- package/src/components/ui/button-group/ButtonGroup.vue +22 -0
- package/src/components/ui/button-group/ButtonGroupSeparator.vue +24 -0
- package/src/components/ui/button-group/ButtonGroupText.vue +29 -0
- package/src/components/ui/button-group/index.ts +25 -0
- package/src/components/ui/card/Card.vue +22 -0
- package/src/components/ui/card/CardAction.vue +17 -0
- package/src/components/ui/card/CardContent.vue +17 -0
- package/src/components/ui/card/CardDescription.vue +17 -0
- package/src/components/ui/card/CardFooter.vue +17 -0
- package/src/components/ui/card/CardHeader.vue +17 -0
- package/src/components/ui/card/CardTitle.vue +17 -0
- package/src/components/ui/card/index.ts +7 -0
- package/src/components/ui/carousel/Carousel.vue +53 -0
- package/src/components/ui/carousel/CarouselContent.vue +33 -0
- package/src/components/ui/carousel/CarouselItem.vue +24 -0
- package/src/components/ui/carousel/CarouselNext.vue +41 -0
- package/src/components/ui/carousel/CarouselPrevious.vue +41 -0
- package/src/components/ui/carousel/index.ts +10 -0
- package/src/components/ui/carousel/interface.ts +26 -0
- package/src/components/ui/carousel/useCarousel.ts +56 -0
- package/src/components/ui/collapsible/Collapsible.vue +19 -0
- package/src/components/ui/collapsible/CollapsibleContent.vue +15 -0
- package/src/components/ui/collapsible/CollapsibleTrigger.vue +15 -0
- package/src/components/ui/collapsible/index.ts +3 -0
- package/src/components/ui/command/Command.vue +87 -0
- package/src/components/ui/command/CommandDialog.vue +31 -0
- package/src/components/ui/command/CommandEmpty.vue +27 -0
- package/src/components/ui/command/CommandGroup.vue +45 -0
- package/src/components/ui/command/CommandInput.vue +39 -0
- package/src/components/ui/command/CommandItem.vue +76 -0
- package/src/components/ui/command/CommandList.vue +25 -0
- package/src/components/ui/command/CommandSeparator.vue +21 -0
- package/src/components/ui/command/CommandShortcut.vue +17 -0
- package/src/components/ui/command/index.ts +25 -0
- package/src/components/ui/dialog/Dialog.vue +19 -0
- package/src/components/ui/dialog/DialogClose.vue +15 -0
- package/src/components/ui/dialog/DialogContent.vue +53 -0
- package/src/components/ui/dialog/DialogDescription.vue +23 -0
- package/src/components/ui/dialog/DialogFooter.vue +15 -0
- package/src/components/ui/dialog/DialogHeader.vue +17 -0
- package/src/components/ui/dialog/DialogOverlay.vue +21 -0
- package/src/components/ui/dialog/DialogScrollContent.vue +59 -0
- package/src/components/ui/dialog/DialogTitle.vue +23 -0
- package/src/components/ui/dialog/DialogTrigger.vue +15 -0
- package/src/components/ui/dialog/index.ts +10 -0
- package/src/components/ui/dropdown-menu/DropdownMenu.vue +19 -0
- package/src/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +39 -0
- package/src/components/ui/dropdown-menu/DropdownMenuContent.vue +39 -0
- package/src/components/ui/dropdown-menu/DropdownMenuGroup.vue +15 -0
- package/src/components/ui/dropdown-menu/DropdownMenuItem.vue +31 -0
- package/src/components/ui/dropdown-menu/DropdownMenuLabel.vue +23 -0
- package/src/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue +21 -0
- package/src/components/ui/dropdown-menu/DropdownMenuRadioItem.vue +40 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSeparator.vue +23 -0
- package/src/components/ui/dropdown-menu/DropdownMenuShortcut.vue +17 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSub.vue +18 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSubContent.vue +27 -0
- package/src/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +30 -0
- package/src/components/ui/dropdown-menu/DropdownMenuTrigger.vue +17 -0
- package/src/components/ui/dropdown-menu/index.ts +16 -0
- package/src/components/ui/hover-card/HoverCard.vue +19 -0
- package/src/components/ui/hover-card/HoverCardContent.vue +43 -0
- package/src/components/ui/hover-card/HoverCardTrigger.vue +15 -0
- package/src/components/ui/hover-card/index.ts +3 -0
- package/src/components/ui/input/Input.vue +33 -0
- package/src/components/ui/input/index.ts +1 -0
- package/src/components/ui/input-group/InputGroup.vue +37 -0
- package/src/components/ui/input-group/InputGroupAddon.vue +36 -0
- package/src/components/ui/input-group/InputGroupButton.vue +21 -0
- package/src/components/ui/input-group/InputGroupInput.vue +19 -0
- package/src/components/ui/input-group/InputGroupText.vue +19 -0
- package/src/components/ui/input-group/InputGroupTextarea.vue +19 -0
- package/src/components/ui/input-group/index.ts +59 -0
- package/src/components/ui/progress/Progress.vue +38 -0
- package/src/components/ui/progress/index.ts +1 -0
- package/src/components/ui/scroll-area/ScrollArea.vue +33 -0
- package/src/components/ui/scroll-area/ScrollBar.vue +32 -0
- package/src/components/ui/scroll-area/index.ts +2 -0
- package/src/components/ui/select/Select.vue +19 -0
- package/src/components/ui/select/SelectContent.vue +51 -0
- package/src/components/ui/select/SelectGroup.vue +15 -0
- package/src/components/ui/select/SelectItem.vue +44 -0
- package/src/components/ui/select/SelectItemText.vue +15 -0
- package/src/components/ui/select/SelectLabel.vue +17 -0
- package/src/components/ui/select/SelectScrollDownButton.vue +26 -0
- package/src/components/ui/select/SelectScrollUpButton.vue +26 -0
- package/src/components/ui/select/SelectSeparator.vue +19 -0
- package/src/components/ui/select/SelectTrigger.vue +33 -0
- package/src/components/ui/select/SelectValue.vue +15 -0
- package/src/components/ui/select/index.ts +11 -0
- package/src/components/ui/separator/Separator.vue +29 -0
- package/src/components/ui/separator/index.ts +1 -0
- package/src/components/ui/textarea/Textarea.vue +28 -0
- package/src/components/ui/textarea/index.ts +1 -0
- package/src/components/ui/tooltip/Tooltip.vue +19 -0
- package/src/components/ui/tooltip/TooltipContent.vue +34 -0
- package/src/components/ui/tooltip/TooltipProvider.vue +14 -0
- package/src/components/ui/tooltip/TooltipTrigger.vue +15 -0
- package/src/components/ui/tooltip/index.ts +4 -0
- package/src/composables/useChat.ts +46 -0
- package/src/index.ts +3 -0
- package/src/lib/utils.ts +7 -0
- package/src/main.ts +5 -0
- package/src/request/index.ts +41 -0
- package/src/style.css +120 -0
- package/tsconfig.app.json +25 -0
- package/tsconfig.json +13 -0
- package/tsconfig.node.json +26 -0
- package/vite.config.ts +26 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Task } from './Task.vue'
|
|
2
|
+
export { default as TaskContent } from './TaskContent.vue'
|
|
3
|
+
export { default as TaskItem } from './TaskItem.vue'
|
|
4
|
+
export { default as TaskItemFile } from './TaskItemFile.vue'
|
|
5
|
+
export { default as TaskTrigger } from './TaskTrigger.vue'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { Collapsible } from '@/components/ui/collapsible'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<Collapsible
|
|
13
|
+
:class="cn('not-prose mb-4 w-full rounded-md border', props.class)"
|
|
14
|
+
v-bind="$attrs"
|
|
15
|
+
>
|
|
16
|
+
<slot />
|
|
17
|
+
</Collapsible>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { CollapsibleContent } from '@/components/ui/collapsible'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
class?: HTMLAttributes['class']
|
|
8
|
+
}>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<CollapsibleContent
|
|
13
|
+
:class="
|
|
14
|
+
cn(
|
|
15
|
+
'data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in',
|
|
16
|
+
props.class,
|
|
17
|
+
)
|
|
18
|
+
"
|
|
19
|
+
v-bind="$attrs"
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</CollapsibleContent>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ToolUIPart } from 'ai'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { CollapsibleTrigger } from '@/components/ui/collapsible'
|
|
5
|
+
import { cn } from '@/lib/utils'
|
|
6
|
+
import { ChevronDownIcon, WrenchIcon } from 'lucide-vue-next'
|
|
7
|
+
import StatusBadge from './ToolStatusBadge.vue'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
title?: string
|
|
11
|
+
type: ToolUIPart['type']
|
|
12
|
+
state: ToolUIPart['state']
|
|
13
|
+
class?: HTMLAttributes['class']
|
|
14
|
+
}>()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<CollapsibleTrigger
|
|
19
|
+
:class="
|
|
20
|
+
cn(
|
|
21
|
+
'flex w-full items-center justify-between gap-4 p-3',
|
|
22
|
+
props.class,
|
|
23
|
+
)
|
|
24
|
+
"
|
|
25
|
+
v-bind="$attrs"
|
|
26
|
+
>
|
|
27
|
+
<div class="flex items-center gap-2">
|
|
28
|
+
<WrenchIcon class="size-4 text-muted-foreground" />
|
|
29
|
+
<span class="font-medium text-sm">
|
|
30
|
+
{{ props.title ?? props.type.split('-').slice(1).join(' ') }}
|
|
31
|
+
</span>
|
|
32
|
+
<StatusBadge :state="props.state" />
|
|
33
|
+
</div>
|
|
34
|
+
<ChevronDownIcon
|
|
35
|
+
class="size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"
|
|
36
|
+
/>
|
|
37
|
+
</CollapsibleTrigger>
|
|
38
|
+
</template>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ToolUIPart } from 'ai'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
import { computed } from 'vue'
|
|
6
|
+
import { CodeBlock } from '../code-block'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
input: ToolUIPart['input']
|
|
10
|
+
class?: HTMLAttributes['class']
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
const formattedInput = computed(() => {
|
|
14
|
+
return JSON.stringify(props.input, null, 2)
|
|
15
|
+
})
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<div
|
|
20
|
+
:class="cn('space-y-2 overflow-hidden p-4', props.class)"
|
|
21
|
+
v-bind="$attrs"
|
|
22
|
+
>
|
|
23
|
+
<h4
|
|
24
|
+
class="font-medium text-muted-foreground text-xs uppercase tracking-wide"
|
|
25
|
+
>
|
|
26
|
+
Parameters
|
|
27
|
+
</h4>
|
|
28
|
+
<div class="rounded-md bg-muted/50">
|
|
29
|
+
<CodeBlock :code="formattedInput" language="json" />
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ToolUIPart } from 'ai'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
import { computed } from 'vue'
|
|
6
|
+
import { CodeBlock } from '../code-block'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
output: ToolUIPart['output']
|
|
10
|
+
errorText: ToolUIPart['errorText']
|
|
11
|
+
class?: HTMLAttributes['class']
|
|
12
|
+
}>()
|
|
13
|
+
|
|
14
|
+
const showOutput = computed(() => props.output || props.errorText)
|
|
15
|
+
|
|
16
|
+
const isObjectOutput = computed(
|
|
17
|
+
() => typeof props.output === 'object' && props.output !== null,
|
|
18
|
+
)
|
|
19
|
+
const isStringOutput = computed(() => typeof props.output === 'string')
|
|
20
|
+
|
|
21
|
+
const formattedOutput = computed(() => {
|
|
22
|
+
if (isObjectOutput.value) {
|
|
23
|
+
return JSON.stringify(props.output, null, 2)
|
|
24
|
+
}
|
|
25
|
+
return props.output as string
|
|
26
|
+
})
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<div
|
|
31
|
+
v-if="showOutput"
|
|
32
|
+
:class="cn('space-y-2 p-4', props.class)"
|
|
33
|
+
v-bind="$attrs"
|
|
34
|
+
>
|
|
35
|
+
<h4
|
|
36
|
+
class="font-medium text-muted-foreground text-xs uppercase tracking-wide"
|
|
37
|
+
>
|
|
38
|
+
{{ props.errorText ? "Error" : "Result" }}
|
|
39
|
+
</h4>
|
|
40
|
+
<div
|
|
41
|
+
:class="
|
|
42
|
+
cn(
|
|
43
|
+
'overflow-x-auto rounded-md text-xs [&_table]:w-full',
|
|
44
|
+
props.errorText
|
|
45
|
+
? 'bg-destructive/10 text-destructive'
|
|
46
|
+
: 'bg-muted/50 text-foreground',
|
|
47
|
+
)
|
|
48
|
+
"
|
|
49
|
+
>
|
|
50
|
+
<div v-if="errorText" class="p-3">
|
|
51
|
+
{{ props.errorText }}
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<CodeBlock
|
|
55
|
+
v-else-if="isObjectOutput"
|
|
56
|
+
:code="formattedOutput"
|
|
57
|
+
language="json"
|
|
58
|
+
/>
|
|
59
|
+
<CodeBlock
|
|
60
|
+
v-else-if="isStringOutput"
|
|
61
|
+
:code="formattedOutput"
|
|
62
|
+
language="json"
|
|
63
|
+
/>
|
|
64
|
+
<div v-else class="p-3">
|
|
65
|
+
{{ props.output }}
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<!-- StatusBadge.vue -->
|
|
2
|
+
<script setup lang="ts">
|
|
3
|
+
import type { ToolUIPart } from 'ai'
|
|
4
|
+
import type { Component } from 'vue'
|
|
5
|
+
import { Badge } from '@/components/ui/badge'
|
|
6
|
+
import {
|
|
7
|
+
CheckCircleIcon,
|
|
8
|
+
CircleIcon,
|
|
9
|
+
ClockIcon,
|
|
10
|
+
XCircleIcon,
|
|
11
|
+
} from 'lucide-vue-next'
|
|
12
|
+
import { computed } from 'vue'
|
|
13
|
+
|
|
14
|
+
const props = defineProps<{
|
|
15
|
+
state: ToolUIPart['state']
|
|
16
|
+
}>()
|
|
17
|
+
|
|
18
|
+
const label = computed(() => {
|
|
19
|
+
const labels: Record<ToolUIPart['state'], string> = {
|
|
20
|
+
'input-streaming': 'Pending',
|
|
21
|
+
'input-available': 'Running',
|
|
22
|
+
'approval-requested': 'Awaiting Approval',
|
|
23
|
+
'approval-responded': 'Responded',
|
|
24
|
+
'output-available': 'Completed',
|
|
25
|
+
'output-error': 'Error',
|
|
26
|
+
'output-denied': 'Denied',
|
|
27
|
+
}
|
|
28
|
+
return labels[props.state]
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const icon = computed<Component>(() => {
|
|
32
|
+
const icons: Record<ToolUIPart['state'], Component> = {
|
|
33
|
+
'input-streaming': CircleIcon,
|
|
34
|
+
'input-available': ClockIcon,
|
|
35
|
+
'approval-requested': ClockIcon,
|
|
36
|
+
'approval-responded': CheckCircleIcon,
|
|
37
|
+
'output-available': CheckCircleIcon,
|
|
38
|
+
'output-error': XCircleIcon,
|
|
39
|
+
'output-denied': XCircleIcon,
|
|
40
|
+
}
|
|
41
|
+
return icons[props.state]
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const iconClass = computed(() => {
|
|
45
|
+
const classes: Record<string, boolean> = {
|
|
46
|
+
'size-4': true,
|
|
47
|
+
'animate-pulse': props.state === 'input-available',
|
|
48
|
+
'text-yellow-600': props.state === 'approval-requested',
|
|
49
|
+
'text-blue-600': props.state === 'approval-responded',
|
|
50
|
+
'text-green-600': props.state === 'output-available',
|
|
51
|
+
'text-red-600': props.state === 'output-error',
|
|
52
|
+
'text-orange-600': props.state === 'output-denied',
|
|
53
|
+
}
|
|
54
|
+
return classes
|
|
55
|
+
})
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<template>
|
|
59
|
+
<Badge class="gap-1.5 rounded-full text-xs" variant="secondary">
|
|
60
|
+
<component :is="icon" :class="iconClass" />
|
|
61
|
+
<span>{{ label }}</span>
|
|
62
|
+
</Badge>
|
|
63
|
+
</template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Tool } from './Tool.vue'
|
|
2
|
+
export { default as ToolContent } from './ToolContent.vue'
|
|
3
|
+
export { default as ToolHeader } from './ToolHeader.vue'
|
|
4
|
+
export { default as ToolInput } from './ToolInput.vue'
|
|
5
|
+
export { default as ToolOutput } from './ToolOutput.vue'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { Position } from '@vue-flow/core'
|
|
5
|
+
import { NodeToolbar } from '@vue-flow/node-toolbar'
|
|
6
|
+
import { reactiveOmit } from '@vueuse/core'
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(
|
|
9
|
+
defineProps<{
|
|
10
|
+
class?: HTMLAttributes['class']
|
|
11
|
+
position?: Position
|
|
12
|
+
}>(),
|
|
13
|
+
{
|
|
14
|
+
position: Position.Bottom,
|
|
15
|
+
},
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
const delegatedProps = reactiveOmit(props, 'class')
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<NodeToolbar
|
|
23
|
+
data-slot="toolbar"
|
|
24
|
+
v-bind="delegatedProps"
|
|
25
|
+
:class="cn(
|
|
26
|
+
'flex items-center gap-1 rounded-sm border bg-background p-1.5',
|
|
27
|
+
props.class,
|
|
28
|
+
)"
|
|
29
|
+
>
|
|
30
|
+
<slot />
|
|
31
|
+
</NodeToolbar>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Toolbar } from './Toolbar.vue'
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { computed, ref } from 'vue'
|
|
5
|
+
import {
|
|
6
|
+
provideWebPreviewContext,
|
|
7
|
+
} from './context'
|
|
8
|
+
|
|
9
|
+
interface Props extends /* @vue-ignore */ HTMLAttributes {
|
|
10
|
+
class?: HTMLAttributes['class']
|
|
11
|
+
defaultUrl?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
+
defaultUrl: '',
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const emit = defineEmits<{
|
|
19
|
+
(e: 'update:url', value: string): void
|
|
20
|
+
(e: 'urlChange', value: string): void
|
|
21
|
+
(e: 'update:consoleOpen', value: boolean): void
|
|
22
|
+
(e: 'consoleOpenChange', value: boolean): void
|
|
23
|
+
}>()
|
|
24
|
+
|
|
25
|
+
const url = ref(props.defaultUrl)
|
|
26
|
+
const consoleOpen = ref(false)
|
|
27
|
+
|
|
28
|
+
function setUrl(value: string) {
|
|
29
|
+
url.value = value
|
|
30
|
+
emit('update:url', value)
|
|
31
|
+
emit('urlChange', value)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function setConsoleOpen(value: boolean) {
|
|
35
|
+
consoleOpen.value = value
|
|
36
|
+
emit('update:consoleOpen', value)
|
|
37
|
+
emit('consoleOpenChange', value)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
provideWebPreviewContext({
|
|
41
|
+
url,
|
|
42
|
+
setUrl,
|
|
43
|
+
consoleOpen,
|
|
44
|
+
setConsoleOpen,
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const vBind = computed(() => {
|
|
48
|
+
const { class: _, ...rest } = props
|
|
49
|
+
return {
|
|
50
|
+
class: cn('flex size-full flex-col rounded-lg border bg-card', props.class),
|
|
51
|
+
...rest,
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<template>
|
|
57
|
+
<div v-bind="vBind">
|
|
58
|
+
<slot />
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { IframeHTMLAttributes, VNodeChild } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
import { useWebPreviewContext } from './context'
|
|
6
|
+
|
|
7
|
+
interface Props extends /* @vue-ignore */ IframeHTMLAttributes {
|
|
8
|
+
class?: IframeHTMLAttributes['class']
|
|
9
|
+
src?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const props = defineProps<Props>()
|
|
13
|
+
|
|
14
|
+
defineSlots<{
|
|
15
|
+
loading: () => VNodeChild
|
|
16
|
+
}>()
|
|
17
|
+
|
|
18
|
+
const { url } = useWebPreviewContext()
|
|
19
|
+
|
|
20
|
+
const frameSrc = computed(() => (props.src ?? url.value) || undefined)
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div class="flex-1">
|
|
25
|
+
<iframe
|
|
26
|
+
:class="cn('size-full', props.class)"
|
|
27
|
+
sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-presentation"
|
|
28
|
+
:src="frameSrc"
|
|
29
|
+
title="Preview"
|
|
30
|
+
v-bind="$attrs"
|
|
31
|
+
/>
|
|
32
|
+
<slot name="loading" />
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { Button } from '@/components/ui/button'
|
|
4
|
+
import {
|
|
5
|
+
Collapsible,
|
|
6
|
+
CollapsibleContent,
|
|
7
|
+
CollapsibleTrigger,
|
|
8
|
+
} from '@/components/ui/collapsible'
|
|
9
|
+
import { cn } from '@/lib/utils'
|
|
10
|
+
import { ChevronDownIcon } from 'lucide-vue-next'
|
|
11
|
+
import { computed } from 'vue'
|
|
12
|
+
import { useWebPreviewContext } from './context'
|
|
13
|
+
|
|
14
|
+
type LogLevel = 'log' | 'warn' | 'error'
|
|
15
|
+
|
|
16
|
+
interface ConsoleLog {
|
|
17
|
+
level: LogLevel
|
|
18
|
+
message: string
|
|
19
|
+
timestamp: Date
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface Props {
|
|
23
|
+
class?: HTMLAttributes['class']
|
|
24
|
+
logs?: ConsoleLog[]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
28
|
+
logs: () => [],
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const context = useWebPreviewContext()
|
|
32
|
+
|
|
33
|
+
const isConsoleOpen = computed(() => context.consoleOpen.value)
|
|
34
|
+
|
|
35
|
+
function levelClass(level: LogLevel) {
|
|
36
|
+
if (level === 'error')
|
|
37
|
+
return 'text-destructive'
|
|
38
|
+
if (level === 'warn')
|
|
39
|
+
return 'text-yellow-600'
|
|
40
|
+
return 'text-foreground'
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<Collapsible
|
|
46
|
+
:class="cn('border-t bg-muted/50 font-mono text-sm', props.class)"
|
|
47
|
+
:open="isConsoleOpen"
|
|
48
|
+
v-bind="$attrs"
|
|
49
|
+
@update:open="context.setConsoleOpen"
|
|
50
|
+
>
|
|
51
|
+
<CollapsibleTrigger as-child>
|
|
52
|
+
<Button
|
|
53
|
+
class="flex w-full items-center justify-between p-4 text-left font-medium hover:bg-muted/50"
|
|
54
|
+
type="button"
|
|
55
|
+
variant="ghost"
|
|
56
|
+
>
|
|
57
|
+
Console
|
|
58
|
+
<ChevronDownIcon
|
|
59
|
+
:class="
|
|
60
|
+
cn(
|
|
61
|
+
'h-4 w-4 transition-transform duration-200',
|
|
62
|
+
isConsoleOpen ? 'rotate-180' : 'rotate-0',
|
|
63
|
+
)
|
|
64
|
+
"
|
|
65
|
+
/>
|
|
66
|
+
</Button>
|
|
67
|
+
</CollapsibleTrigger>
|
|
68
|
+
<CollapsibleContent
|
|
69
|
+
class="px-4 pb-4 data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in"
|
|
70
|
+
>
|
|
71
|
+
<div class="max-h-48 space-y-1 overflow-y-auto">
|
|
72
|
+
<p v-if="!props.logs.length" class="text-muted-foreground">
|
|
73
|
+
No console output
|
|
74
|
+
</p>
|
|
75
|
+
<template v-else>
|
|
76
|
+
<div
|
|
77
|
+
v-for="(log, index) in props.logs"
|
|
78
|
+
:key="`${log.timestamp.getTime?.() ?? index}-${index}`"
|
|
79
|
+
:class="cn('text-xs', levelClass(log.level))"
|
|
80
|
+
>
|
|
81
|
+
<span class="text-muted-foreground">
|
|
82
|
+
{{ log.timestamp.toLocaleTimeString() }}
|
|
83
|
+
</span>
|
|
84
|
+
{{ ' ' }}
|
|
85
|
+
{{ log.message }}
|
|
86
|
+
</div>
|
|
87
|
+
</template>
|
|
88
|
+
<slot />
|
|
89
|
+
</div>
|
|
90
|
+
</CollapsibleContent>
|
|
91
|
+
</Collapsible>
|
|
92
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
interface Props extends /* @vue-ignore */ HTMLAttributes {
|
|
6
|
+
class?: HTMLAttributes['class']
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const props = defineProps<Props>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div
|
|
14
|
+
v-bind="{
|
|
15
|
+
...props,
|
|
16
|
+
class: cn('flex items-center gap-1 border-b p-2', props.class),
|
|
17
|
+
}"
|
|
18
|
+
>
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ButtonVariants } from '@/components/ui/button'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { Button } from '@/components/ui/button'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
Tooltip,
|
|
8
|
+
TooltipContent,
|
|
9
|
+
TooltipProvider,
|
|
10
|
+
TooltipTrigger,
|
|
11
|
+
} from '@/components/ui/tooltip'
|
|
12
|
+
|
|
13
|
+
interface Props extends /* @vue-ignore */ HTMLAttributes {
|
|
14
|
+
size?: ButtonVariants['size']
|
|
15
|
+
variant?: ButtonVariants['variant']
|
|
16
|
+
tooltip?: string
|
|
17
|
+
disabled?: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
21
|
+
tooltip: '',
|
|
22
|
+
disabled: false,
|
|
23
|
+
size: 'sm',
|
|
24
|
+
variant: 'ghost',
|
|
25
|
+
})
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<TooltipProvider>
|
|
30
|
+
<Tooltip>
|
|
31
|
+
<TooltipTrigger as-child>
|
|
32
|
+
<Button
|
|
33
|
+
class="h-8 w-8 p-0 hover:text-foreground"
|
|
34
|
+
type="button"
|
|
35
|
+
v-bind="{ ...props, ...$attrs }"
|
|
36
|
+
>
|
|
37
|
+
<slot />
|
|
38
|
+
</Button>
|
|
39
|
+
</TooltipTrigger>
|
|
40
|
+
<TooltipContent v-if="props.tooltip">
|
|
41
|
+
<p>{{ props.tooltip }}</p>
|
|
42
|
+
</TooltipContent>
|
|
43
|
+
</Tooltip>
|
|
44
|
+
</TooltipProvider>
|
|
45
|
+
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { Input } from '@/components/ui/input'
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
import { ref, watch } from 'vue'
|
|
6
|
+
import { useWebPreviewContext } from './context'
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
class?: HTMLAttributes['class']
|
|
10
|
+
placeholder?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
14
|
+
placeholder: 'Enter URL...',
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const context = useWebPreviewContext()
|
|
18
|
+
|
|
19
|
+
const inputValue = ref(context.url.value)
|
|
20
|
+
|
|
21
|
+
watch(
|
|
22
|
+
() => context.url.value,
|
|
23
|
+
(value) => {
|
|
24
|
+
inputValue.value = value
|
|
25
|
+
},
|
|
26
|
+
{ immediate: true },
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
function handleKeydown() {
|
|
30
|
+
context.setUrl(inputValue.value)
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<Input
|
|
36
|
+
v-model="inputValue"
|
|
37
|
+
data-testid="web-preview-url-input"
|
|
38
|
+
:class="cn('h-8 flex-1 text-sm', props.class)"
|
|
39
|
+
:placeholder="props.placeholder"
|
|
40
|
+
v-bind="$attrs"
|
|
41
|
+
@keydown.enter="handleKeydown"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { InjectionKey, Ref } from 'vue'
|
|
2
|
+
import { inject, provide } from 'vue'
|
|
3
|
+
|
|
4
|
+
export interface WebPreviewContextValue {
|
|
5
|
+
url: Ref<string>
|
|
6
|
+
setUrl: (url: string) => void
|
|
7
|
+
consoleOpen: Ref<boolean>
|
|
8
|
+
setConsoleOpen: (open: boolean) => void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const WebPreviewContextKey: InjectionKey<WebPreviewContextValue> = Symbol('WebPreviewContext')
|
|
12
|
+
|
|
13
|
+
export function provideWebPreviewContext(value: WebPreviewContextValue) {
|
|
14
|
+
provide(WebPreviewContextKey, value)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function useWebPreviewContext() {
|
|
18
|
+
const context = inject(WebPreviewContextKey, null)
|
|
19
|
+
|
|
20
|
+
if (!context) {
|
|
21
|
+
throw new Error('WebPreview components must be used within WebPreview')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return context
|
|
25
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { provideWebPreviewContext, useWebPreviewContext } from './context'
|
|
2
|
+
export { default as WebPreview } from './WebPreview.vue'
|
|
3
|
+
export { default as WebPreviewBody } from './WebPreviewBody.vue'
|
|
4
|
+
export { default as WebPreviewConsole } from './WebPreviewConsole.vue'
|
|
5
|
+
export { default as WebPreviewNavigation } from './WebPreviewNavigation.vue'
|
|
6
|
+
export { default as WebPreviewNavigationButton } from './WebPreviewNavigationButton.vue'
|
|
7
|
+
export { default as WebPreviewUrl } from './WebPreviewUrl.vue'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "vue"
|
|
3
|
+
import type { AlertVariants } from "."
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
import { alertVariants } from "."
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
class?: HTMLAttributes["class"]
|
|
9
|
+
variant?: AlertVariants["variant"]
|
|
10
|
+
}>()
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div
|
|
15
|
+
data-slot="alert"
|
|
16
|
+
:class="cn(alertVariants({ variant }), props.class)"
|
|
17
|
+
role="alert"
|
|
18
|
+
>
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "vue"
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
class?: HTMLAttributes["class"]
|
|
7
|
+
}>()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div
|
|
12
|
+
data-slot="alert-description"
|
|
13
|
+
:class="cn('text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed', props.class)"
|
|
14
|
+
>
|
|
15
|
+
<slot />
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|