@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,41 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { WithClassAsProps } from "./interface"
|
|
3
|
+
import type { ButtonVariants } from '@/components/ui/button'
|
|
4
|
+
import { ArrowLeft } from "lucide-vue-next"
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
import { Button } from '@/components/ui/button'
|
|
7
|
+
import { useCarousel } from "./useCarousel"
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<{
|
|
10
|
+
variant?: ButtonVariants["variant"]
|
|
11
|
+
size?: ButtonVariants["size"]
|
|
12
|
+
}
|
|
13
|
+
& WithClassAsProps>(), {
|
|
14
|
+
variant: "outline",
|
|
15
|
+
size: "icon",
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const { orientation, canScrollPrev, scrollPrev } = useCarousel()
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<Button
|
|
23
|
+
data-slot="carousel-previous"
|
|
24
|
+
:disabled="!canScrollPrev"
|
|
25
|
+
:class="cn(
|
|
26
|
+
'absolute size-8 rounded-full',
|
|
27
|
+
orientation === 'horizontal'
|
|
28
|
+
? 'top-1/2 -left-12 -translate-y-1/2'
|
|
29
|
+
: '-top-12 left-1/2 -translate-x-1/2 rotate-90',
|
|
30
|
+
props.class,
|
|
31
|
+
)"
|
|
32
|
+
:variant="variant"
|
|
33
|
+
:size="size"
|
|
34
|
+
@click="scrollPrev"
|
|
35
|
+
>
|
|
36
|
+
<slot>
|
|
37
|
+
<ArrowLeft />
|
|
38
|
+
<span class="sr-only">Previous Slide</span>
|
|
39
|
+
</slot>
|
|
40
|
+
</Button>
|
|
41
|
+
</template>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as Carousel } from "./Carousel.vue"
|
|
2
|
+
export { default as CarouselContent } from "./CarouselContent.vue"
|
|
3
|
+
export { default as CarouselItem } from "./CarouselItem.vue"
|
|
4
|
+
export { default as CarouselNext } from "./CarouselNext.vue"
|
|
5
|
+
export { default as CarouselPrevious } from "./CarouselPrevious.vue"
|
|
6
|
+
export type {
|
|
7
|
+
UnwrapRefCarouselApi as CarouselApi,
|
|
8
|
+
} from "./interface"
|
|
9
|
+
|
|
10
|
+
export { useCarousel } from "./useCarousel"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type useEmblaCarousel from "embla-carousel-vue"
|
|
2
|
+
import type {
|
|
3
|
+
EmblaCarouselVueType,
|
|
4
|
+
} from "embla-carousel-vue"
|
|
5
|
+
import type { HTMLAttributes, UnwrapRef } from "vue"
|
|
6
|
+
|
|
7
|
+
type CarouselApi = EmblaCarouselVueType[1]
|
|
8
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
|
|
9
|
+
type CarouselOptions = UseCarouselParameters[0]
|
|
10
|
+
type CarouselPlugin = UseCarouselParameters[1]
|
|
11
|
+
|
|
12
|
+
export type UnwrapRefCarouselApi = UnwrapRef<CarouselApi>
|
|
13
|
+
|
|
14
|
+
export interface CarouselProps {
|
|
15
|
+
opts?: CarouselOptions
|
|
16
|
+
plugins?: CarouselPlugin
|
|
17
|
+
orientation?: "horizontal" | "vertical"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface CarouselEmits {
|
|
21
|
+
(e: "init-api", payload: UnwrapRefCarouselApi): void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface WithClassAsProps {
|
|
25
|
+
class?: HTMLAttributes["class"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { UnwrapRefCarouselApi as CarouselApi, CarouselEmits, CarouselProps } from "./interface"
|
|
2
|
+
import { createInjectionState } from "@vueuse/core"
|
|
3
|
+
import emblaCarouselVue from "embla-carousel-vue"
|
|
4
|
+
import { onMounted, ref } from "vue"
|
|
5
|
+
|
|
6
|
+
const [useProvideCarousel, useInjectCarousel] = createInjectionState(
|
|
7
|
+
({
|
|
8
|
+
opts,
|
|
9
|
+
orientation,
|
|
10
|
+
plugins,
|
|
11
|
+
}: CarouselProps, emits: CarouselEmits) => {
|
|
12
|
+
const [emblaNode, emblaApi] = emblaCarouselVue({
|
|
13
|
+
...opts,
|
|
14
|
+
axis: orientation === "horizontal" ? "x" : "y",
|
|
15
|
+
}, plugins)
|
|
16
|
+
|
|
17
|
+
function scrollPrev() {
|
|
18
|
+
emblaApi.value?.scrollPrev()
|
|
19
|
+
}
|
|
20
|
+
function scrollNext() {
|
|
21
|
+
emblaApi.value?.scrollNext()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const canScrollNext = ref(false)
|
|
25
|
+
const canScrollPrev = ref(false)
|
|
26
|
+
|
|
27
|
+
function onSelect(api: CarouselApi) {
|
|
28
|
+
canScrollNext.value = api?.canScrollNext() || false
|
|
29
|
+
canScrollPrev.value = api?.canScrollPrev() || false
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
onMounted(() => {
|
|
33
|
+
if (!emblaApi.value)
|
|
34
|
+
return
|
|
35
|
+
|
|
36
|
+
emblaApi.value?.on("init", onSelect)
|
|
37
|
+
emblaApi.value?.on("reInit", onSelect)
|
|
38
|
+
emblaApi.value?.on("select", onSelect)
|
|
39
|
+
|
|
40
|
+
emits("init-api", emblaApi.value)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
return { carouselRef: emblaNode, carouselApi: emblaApi, canScrollPrev, canScrollNext, scrollPrev, scrollNext, orientation }
|
|
44
|
+
},
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
function useCarousel() {
|
|
48
|
+
const carouselState = useInjectCarousel()
|
|
49
|
+
|
|
50
|
+
if (!carouselState)
|
|
51
|
+
throw new Error("useCarousel must be used within a <Carousel />")
|
|
52
|
+
|
|
53
|
+
return carouselState
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { useCarousel, useProvideCarousel }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CollapsibleRootEmits, CollapsibleRootProps } from "reka-ui"
|
|
3
|
+
import { CollapsibleRoot, useForwardPropsEmits } from "reka-ui"
|
|
4
|
+
|
|
5
|
+
const props = defineProps<CollapsibleRootProps>()
|
|
6
|
+
const emits = defineEmits<CollapsibleRootEmits>()
|
|
7
|
+
|
|
8
|
+
const forwarded = useForwardPropsEmits(props, emits)
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<CollapsibleRoot
|
|
13
|
+
v-slot="slotProps"
|
|
14
|
+
data-slot="collapsible"
|
|
15
|
+
v-bind="forwarded"
|
|
16
|
+
>
|
|
17
|
+
<slot v-bind="slotProps" />
|
|
18
|
+
</CollapsibleRoot>
|
|
19
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CollapsibleContentProps } from "reka-ui"
|
|
3
|
+
import { CollapsibleContent } from "reka-ui"
|
|
4
|
+
|
|
5
|
+
const props = defineProps<CollapsibleContentProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<CollapsibleContent
|
|
10
|
+
data-slot="collapsible-content"
|
|
11
|
+
v-bind="props"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</CollapsibleContent>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CollapsibleTriggerProps } from "reka-ui"
|
|
3
|
+
import { CollapsibleTrigger } from "reka-ui"
|
|
4
|
+
|
|
5
|
+
const props = defineProps<CollapsibleTriggerProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<CollapsibleTrigger
|
|
10
|
+
data-slot="collapsible-trigger"
|
|
11
|
+
v-bind="props"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</CollapsibleTrigger>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ListboxRootEmits, ListboxRootProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
+
import { ListboxRoot, useFilter, useForwardPropsEmits } from "reka-ui"
|
|
6
|
+
import { reactive, ref, watch } from "vue"
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import { provideCommandContext } from "."
|
|
9
|
+
|
|
10
|
+
const props = withDefaults(defineProps<ListboxRootProps & { class?: HTMLAttributes["class"] }>(), {
|
|
11
|
+
modelValue: "",
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const emits = defineEmits<ListboxRootEmits>()
|
|
15
|
+
|
|
16
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
17
|
+
|
|
18
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
19
|
+
|
|
20
|
+
const allItems = ref<Map<string, string>>(new Map())
|
|
21
|
+
const allGroups = ref<Map<string, Set<string>>>(new Map())
|
|
22
|
+
|
|
23
|
+
const { contains } = useFilter({ sensitivity: "base" })
|
|
24
|
+
const filterState = reactive({
|
|
25
|
+
search: "",
|
|
26
|
+
filtered: {
|
|
27
|
+
/** The count of all visible items. */
|
|
28
|
+
count: 0,
|
|
29
|
+
/** Map from visible item id to its search score. */
|
|
30
|
+
items: new Map() as Map<string, number>,
|
|
31
|
+
/** Set of groups with at least one visible item. */
|
|
32
|
+
groups: new Set() as Set<string>,
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
function filterItems() {
|
|
37
|
+
if (!filterState.search) {
|
|
38
|
+
filterState.filtered.count = allItems.value.size
|
|
39
|
+
// Do nothing, each item will know to show itself because search is empty
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Reset the groups
|
|
44
|
+
filterState.filtered.groups = new Set()
|
|
45
|
+
let itemCount = 0
|
|
46
|
+
|
|
47
|
+
// Check which items should be included
|
|
48
|
+
for (const [id, value] of allItems.value) {
|
|
49
|
+
const score = contains(value, filterState.search)
|
|
50
|
+
filterState.filtered.items.set(id, score ? 1 : 0)
|
|
51
|
+
if (score)
|
|
52
|
+
itemCount++
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Check which groups have at least 1 item shown
|
|
56
|
+
for (const [groupId, group] of allGroups.value) {
|
|
57
|
+
for (const itemId of group) {
|
|
58
|
+
if (filterState.filtered.items.get(itemId)! > 0) {
|
|
59
|
+
filterState.filtered.groups.add(groupId)
|
|
60
|
+
break
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
filterState.filtered.count = itemCount
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
watch(() => filterState.search, () => {
|
|
69
|
+
filterItems()
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
provideCommandContext({
|
|
73
|
+
allItems,
|
|
74
|
+
allGroups,
|
|
75
|
+
filterState,
|
|
76
|
+
})
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<template>
|
|
80
|
+
<ListboxRoot
|
|
81
|
+
data-slot="command"
|
|
82
|
+
v-bind="forwarded"
|
|
83
|
+
:class="cn('bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md', props.class)"
|
|
84
|
+
>
|
|
85
|
+
<slot />
|
|
86
|
+
</ListboxRoot>
|
|
87
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DialogRootEmits, DialogRootProps } from "reka-ui"
|
|
3
|
+
import { useForwardPropsEmits } from "reka-ui"
|
|
4
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
|
5
|
+
import Command from "./Command.vue"
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(defineProps<DialogRootProps & {
|
|
8
|
+
title?: string
|
|
9
|
+
description?: string
|
|
10
|
+
}>(), {
|
|
11
|
+
title: "Command Palette",
|
|
12
|
+
description: "Search for a command to run...",
|
|
13
|
+
})
|
|
14
|
+
const emits = defineEmits<DialogRootEmits>()
|
|
15
|
+
|
|
16
|
+
const forwarded = useForwardPropsEmits(props, emits)
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<Dialog v-slot="slotProps" v-bind="forwarded">
|
|
21
|
+
<DialogContent class="overflow-hidden p-0 ">
|
|
22
|
+
<DialogHeader class="sr-only">
|
|
23
|
+
<DialogTitle>{{ title }}</DialogTitle>
|
|
24
|
+
<DialogDescription>{{ description }}</DialogDescription>
|
|
25
|
+
</DialogHeader>
|
|
26
|
+
<Command>
|
|
27
|
+
<slot v-bind="slotProps" />
|
|
28
|
+
</Command>
|
|
29
|
+
</DialogContent>
|
|
30
|
+
</Dialog>
|
|
31
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PrimitiveProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
+
import { Primitive } from "reka-ui"
|
|
6
|
+
import { computed } from "vue"
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import { useCommand } from "."
|
|
9
|
+
|
|
10
|
+
const props = defineProps<PrimitiveProps & { class?: HTMLAttributes["class"] }>()
|
|
11
|
+
|
|
12
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
13
|
+
|
|
14
|
+
const { filterState } = useCommand()
|
|
15
|
+
const isRender = computed(() => !!filterState.search && filterState.filtered.count === 0,
|
|
16
|
+
)
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<Primitive
|
|
21
|
+
v-if="isRender"
|
|
22
|
+
data-slot="command-empty"
|
|
23
|
+
v-bind="delegatedProps" :class="cn('py-6 text-center text-sm', props.class)"
|
|
24
|
+
>
|
|
25
|
+
<slot />
|
|
26
|
+
</Primitive>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ListboxGroupProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
+
import { ListboxGroup, ListboxGroupLabel, useId } from "reka-ui"
|
|
6
|
+
import { computed, onMounted, onUnmounted } from "vue"
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import { provideCommandGroupContext, useCommand } from "."
|
|
9
|
+
|
|
10
|
+
const props = defineProps<ListboxGroupProps & {
|
|
11
|
+
class?: HTMLAttributes["class"]
|
|
12
|
+
heading?: string
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
16
|
+
|
|
17
|
+
const { allGroups, filterState } = useCommand()
|
|
18
|
+
const id = useId()
|
|
19
|
+
|
|
20
|
+
const isRender = computed(() => !filterState.search ? true : filterState.filtered.groups.has(id))
|
|
21
|
+
|
|
22
|
+
provideCommandGroupContext({ id })
|
|
23
|
+
onMounted(() => {
|
|
24
|
+
if (!allGroups.value.has(id))
|
|
25
|
+
allGroups.value.set(id, new Set())
|
|
26
|
+
})
|
|
27
|
+
onUnmounted(() => {
|
|
28
|
+
allGroups.value.delete(id)
|
|
29
|
+
})
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<ListboxGroup
|
|
34
|
+
v-bind="delegatedProps"
|
|
35
|
+
:id="id"
|
|
36
|
+
data-slot="command-group"
|
|
37
|
+
:class="cn('text-foreground overflow-hidden p-1', props.class)"
|
|
38
|
+
:hidden="isRender ? undefined : true"
|
|
39
|
+
>
|
|
40
|
+
<ListboxGroupLabel v-if="heading" data-slot="command-group-heading" class="px-2 py-1.5 text-xs font-medium text-muted-foreground">
|
|
41
|
+
{{ heading }}
|
|
42
|
+
</ListboxGroupLabel>
|
|
43
|
+
<slot />
|
|
44
|
+
</ListboxGroup>
|
|
45
|
+
</template>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ListboxFilterProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
+
import { Search } from "lucide-vue-next"
|
|
6
|
+
import { ListboxFilter, useForwardProps } from "reka-ui"
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import { useCommand } from "."
|
|
9
|
+
|
|
10
|
+
defineOptions({
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const props = defineProps<ListboxFilterProps & {
|
|
15
|
+
class?: HTMLAttributes["class"]
|
|
16
|
+
}>()
|
|
17
|
+
|
|
18
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
19
|
+
|
|
20
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
21
|
+
|
|
22
|
+
const { filterState } = useCommand()
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div
|
|
27
|
+
data-slot="command-input-wrapper"
|
|
28
|
+
class="flex h-9 items-center gap-2 border-b px-3"
|
|
29
|
+
>
|
|
30
|
+
<Search class="size-4 shrink-0 opacity-50" />
|
|
31
|
+
<ListboxFilter
|
|
32
|
+
v-bind="{ ...forwardedProps, ...$attrs }"
|
|
33
|
+
v-model="filterState.search"
|
|
34
|
+
data-slot="command-input"
|
|
35
|
+
auto-focus
|
|
36
|
+
:class="cn('placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50', props.class)"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ListboxItemEmits, ListboxItemProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { reactiveOmit, useCurrentElement } from "@vueuse/core"
|
|
5
|
+
import { ListboxItem, useForwardPropsEmits, useId } from "reka-ui"
|
|
6
|
+
import { computed, onMounted, onUnmounted, ref } from "vue"
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import { useCommand, useCommandGroup } from "."
|
|
9
|
+
|
|
10
|
+
const props = defineProps<ListboxItemProps & { class?: HTMLAttributes["class"] }>()
|
|
11
|
+
const emits = defineEmits<ListboxItemEmits>()
|
|
12
|
+
|
|
13
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
14
|
+
|
|
15
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
16
|
+
|
|
17
|
+
const id = useId()
|
|
18
|
+
const { filterState, allItems, allGroups } = useCommand()
|
|
19
|
+
const groupContext = useCommandGroup()
|
|
20
|
+
|
|
21
|
+
const isRender = computed(() => {
|
|
22
|
+
if (!filterState.search) {
|
|
23
|
+
return true
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const filteredCurrentItem = filterState.filtered.items.get(id)
|
|
27
|
+
// If the filtered items is undefined means not in the all times map yet
|
|
28
|
+
// Do the first render to add into the map
|
|
29
|
+
if (filteredCurrentItem === undefined) {
|
|
30
|
+
return true
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Check with filter
|
|
34
|
+
return filteredCurrentItem > 0
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const itemRef = ref()
|
|
39
|
+
const currentElement = useCurrentElement(itemRef)
|
|
40
|
+
onMounted(() => {
|
|
41
|
+
if (!(currentElement.value instanceof HTMLElement))
|
|
42
|
+
return
|
|
43
|
+
|
|
44
|
+
// textValue to perform filter
|
|
45
|
+
allItems.value.set(id, currentElement.value.textContent ?? (props.value?.toString() ?? ""))
|
|
46
|
+
|
|
47
|
+
const groupId = groupContext?.id
|
|
48
|
+
if (groupId) {
|
|
49
|
+
if (!allGroups.value.has(groupId)) {
|
|
50
|
+
allGroups.value.set(groupId, new Set([id]))
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
allGroups.value.get(groupId)?.add(id)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
onUnmounted(() => {
|
|
58
|
+
allItems.value.delete(id)
|
|
59
|
+
})
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<template>
|
|
63
|
+
<ListboxItem
|
|
64
|
+
v-if="isRender"
|
|
65
|
+
v-bind="forwarded"
|
|
66
|
+
:id="id"
|
|
67
|
+
ref="itemRef"
|
|
68
|
+
data-slot="command-item"
|
|
69
|
+
:class="cn('data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground [&_svg:not([class*=\'text-\'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4', props.class)"
|
|
70
|
+
@select="() => {
|
|
71
|
+
filterState.search = ''
|
|
72
|
+
}"
|
|
73
|
+
>
|
|
74
|
+
<slot />
|
|
75
|
+
</ListboxItem>
|
|
76
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ListboxContentProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
+
import { ListboxContent, useForwardProps } from "reka-ui"
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
const props = defineProps<ListboxContentProps & { class?: HTMLAttributes["class"] }>()
|
|
9
|
+
|
|
10
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
11
|
+
|
|
12
|
+
const forwarded = useForwardProps(delegatedProps)
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<ListboxContent
|
|
17
|
+
data-slot="command-list"
|
|
18
|
+
v-bind="forwarded"
|
|
19
|
+
:class="cn('max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto', props.class)"
|
|
20
|
+
>
|
|
21
|
+
<div role="presentation">
|
|
22
|
+
<slot />
|
|
23
|
+
</div>
|
|
24
|
+
</ListboxContent>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SeparatorProps } from "reka-ui"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import { reactiveOmit } from "@vueuse/core"
|
|
5
|
+
import { Separator } from "reka-ui"
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
const props = defineProps<SeparatorProps & { class?: HTMLAttributes["class"] }>()
|
|
9
|
+
|
|
10
|
+
const delegatedProps = reactiveOmit(props, "class")
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<Separator
|
|
15
|
+
data-slot="command-separator"
|
|
16
|
+
v-bind="delegatedProps"
|
|
17
|
+
:class="cn('bg-border -mx-1 h-px', props.class)"
|
|
18
|
+
>
|
|
19
|
+
<slot />
|
|
20
|
+
</Separator>
|
|
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
|
+
<span
|
|
12
|
+
data-slot="command-shortcut"
|
|
13
|
+
:class="cn('text-muted-foreground ml-auto text-xs tracking-widest', props.class)"
|
|
14
|
+
>
|
|
15
|
+
<slot />
|
|
16
|
+
</span>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Ref } from "vue"
|
|
2
|
+
import { createContext } from "reka-ui"
|
|
3
|
+
|
|
4
|
+
export { default as Command } from "./Command.vue"
|
|
5
|
+
export { default as CommandDialog } from "./CommandDialog.vue"
|
|
6
|
+
export { default as CommandEmpty } from "./CommandEmpty.vue"
|
|
7
|
+
export { default as CommandGroup } from "./CommandGroup.vue"
|
|
8
|
+
export { default as CommandInput } from "./CommandInput.vue"
|
|
9
|
+
export { default as CommandItem } from "./CommandItem.vue"
|
|
10
|
+
export { default as CommandList } from "./CommandList.vue"
|
|
11
|
+
export { default as CommandSeparator } from "./CommandSeparator.vue"
|
|
12
|
+
export { default as CommandShortcut } from "./CommandShortcut.vue"
|
|
13
|
+
|
|
14
|
+
export const [useCommand, provideCommandContext] = createContext<{
|
|
15
|
+
allItems: Ref<Map<string, string>>
|
|
16
|
+
allGroups: Ref<Map<string, Set<string>>>
|
|
17
|
+
filterState: {
|
|
18
|
+
search: string
|
|
19
|
+
filtered: { count: number, items: Map<string, number>, groups: Set<string> }
|
|
20
|
+
}
|
|
21
|
+
}>("Command")
|
|
22
|
+
|
|
23
|
+
export const [useCommandGroup, provideCommandGroupContext] = createContext<{
|
|
24
|
+
id?: string
|
|
25
|
+
}>("CommandGroup")
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DialogRootEmits, DialogRootProps } from "reka-ui"
|
|
3
|
+
import { DialogRoot, useForwardPropsEmits } from "reka-ui"
|
|
4
|
+
|
|
5
|
+
const props = defineProps<DialogRootProps>()
|
|
6
|
+
const emits = defineEmits<DialogRootEmits>()
|
|
7
|
+
|
|
8
|
+
const forwarded = useForwardPropsEmits(props, emits)
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<DialogRoot
|
|
13
|
+
v-slot="slotProps"
|
|
14
|
+
data-slot="dialog"
|
|
15
|
+
v-bind="forwarded"
|
|
16
|
+
>
|
|
17
|
+
<slot v-bind="slotProps" />
|
|
18
|
+
</DialogRoot>
|
|
19
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { DialogCloseProps } from "reka-ui"
|
|
3
|
+
import { DialogClose } from "reka-ui"
|
|
4
|
+
|
|
5
|
+
const props = defineProps<DialogCloseProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<DialogClose
|
|
10
|
+
data-slot="dialog-close"
|
|
11
|
+
v-bind="props"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</DialogClose>
|
|
15
|
+
</template>
|