@slexn/codecenter-ui 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/LICENSE +34 -0
- package/README.md +148 -0
- package/components.json +20 -0
- package/dist/codecenter-ui.cjs +10 -0
- package/dist/codecenter-ui.js +17995 -0
- package/dist/components/ui/accordion/Accordion.vue.d.ts +28 -0
- package/dist/components/ui/accordion/AccordionContent.vue.d.ts +22 -0
- package/dist/components/ui/accordion/AccordionItem.vue.d.ts +24 -0
- package/dist/components/ui/accordion/AccordionTrigger.vue.d.ts +22 -0
- package/dist/components/ui/accordion/index.d.ts +4 -0
- package/dist/components/ui/alert/Alert.vue.d.ts +32 -0
- package/dist/components/ui/alert/AlertDescription.vue.d.ts +24 -0
- package/dist/components/ui/alert/AlertTitle.vue.d.ts +24 -0
- package/dist/components/ui/alert/index.d.ts +4 -0
- package/dist/components/ui/alert/variants.d.ts +5 -0
- package/dist/components/ui/button/Button.vue.d.ts +27 -0
- package/dist/components/ui/button/index.d.ts +2 -0
- package/dist/components/ui/button/variants.d.ts +6 -0
- package/dist/components/ui/button-group/ButtonGroup.vue.d.ts +25 -0
- package/dist/components/ui/button-group/index.d.ts +2 -0
- package/dist/components/ui/card/Card.vue.d.ts +21 -0
- package/dist/components/ui/card/CardContent.vue.d.ts +21 -0
- package/dist/components/ui/card/CardDescription.vue.d.ts +21 -0
- package/dist/components/ui/card/CardFooter.vue.d.ts +21 -0
- package/dist/components/ui/card/CardHeader.vue.d.ts +21 -0
- package/dist/components/ui/card/CardTitle.vue.d.ts +21 -0
- package/dist/components/ui/card/index.d.ts +6 -0
- package/dist/components/ui/chart/Chart.vue.d.ts +92 -0
- package/dist/components/ui/chart/index.d.ts +2 -0
- package/dist/components/ui/chat/Chat.vue.d.ts +190 -0
- package/dist/components/ui/chat/ChatAttachments.vue.d.ts +11 -0
- package/dist/components/ui/chat/ChatCodeBlock.vue.d.ts +16 -0
- package/dist/components/ui/chat/code-block.d.ts +27 -0
- package/dist/components/ui/chat/index.d.ts +6 -0
- package/dist/components/ui/chat/types.d.ts +15 -0
- package/dist/components/ui/checkbox/Checkbox.vue.d.ts +29 -0
- package/dist/components/ui/checkbox/index.d.ts +1 -0
- package/dist/components/ui/commit/Commit.vue.d.ts +62 -0
- package/dist/components/ui/commit/index.d.ts +2 -0
- package/dist/components/ui/contribution-graph/ContributionGraph.vue.d.ts +87 -0
- package/dist/components/ui/contribution-graph/index.d.ts +2 -0
- package/dist/components/ui/data-table/DataTable.vue.d.ts +109 -0
- package/dist/components/ui/data-table/index.d.ts +2 -0
- package/dist/components/ui/date-picker/DatePicker.vue.d.ts +37 -0
- package/dist/components/ui/date-picker/index.d.ts +2 -0
- package/dist/components/ui/dialog/Dialog.vue.d.ts +25 -0
- package/dist/components/ui/dialog/DialogClose.vue.d.ts +18 -0
- package/dist/components/ui/dialog/DialogContent.vue.d.ts +39 -0
- package/dist/components/ui/dialog/DialogDescription.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts +21 -0
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts +21 -0
- package/dist/components/ui/dialog/DialogOverlay.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogScrollContent.vue.d.ts +36 -0
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts +22 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +18 -0
- package/dist/components/ui/dialog/index.d.ts +10 -0
- package/dist/components/ui/diff/DiffTool.vue.d.ts +21 -0
- package/dist/components/ui/diff/diff-parser.d.ts +30 -0
- package/dist/components/ui/diff/diff-tool.d.ts +36 -0
- package/dist/components/ui/diff/index.d.ts +2 -0
- package/dist/components/ui/dropdown-menu/DropdownMenu.vue.d.ts +24 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.d.ts +29 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuContent.vue.d.ts +36 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuGroup.vue.d.ts +18 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuItem.vue.d.ts +26 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuLabel.vue.d.ts +23 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue.d.ts +22 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuRadioItem.vue.d.ts +27 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSeparator.vue.d.ts +7 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuShortcut.vue.d.ts +21 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSub.vue.d.ts +22 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSubContent.vue.d.ts +38 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts +23 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuTrigger.vue.d.ts +18 -0
- package/dist/components/ui/dropdown-menu/index.d.ts +15 -0
- package/dist/components/ui/gauge/Gauge.vue.d.ts +62 -0
- package/dist/components/ui/gauge/index.d.ts +2 -0
- package/dist/components/ui/git-graph/GitGraph.vue.d.ts +59 -0
- package/dist/components/ui/git-graph/index.d.ts +2 -0
- package/dist/components/ui/incident-timeline/IncidentTimeline.vue.d.ts +50 -0
- package/dist/components/ui/incident-timeline/index.d.ts +2 -0
- package/dist/components/ui/input/Input.vue.d.ts +14 -0
- package/dist/components/ui/input/InputControl.vue.d.ts +14 -0
- package/dist/components/ui/input/InputFieldGroup.vue.d.ts +21 -0
- package/dist/components/ui/input/index.d.ts +4 -0
- package/dist/components/ui/input/types.d.ts +31 -0
- package/dist/components/ui/kpi-card/KpiCard.vue.d.ts +46 -0
- package/dist/components/ui/kpi-card/index.d.ts +2 -0
- package/dist/components/ui/kpi-line-card/KpiLineCard.vue.d.ts +66 -0
- package/dist/components/ui/kpi-line-card/index.d.ts +2 -0
- package/dist/components/ui/model-selector/ModelSelector.vue.d.ts +41 -0
- package/dist/components/ui/model-selector/index.d.ts +2 -0
- package/dist/components/ui/model-selector/types.d.ts +12 -0
- package/dist/components/ui/network-graph/NetworkGraph.vue.d.ts +75 -0
- package/dist/components/ui/network-graph/index.d.ts +2 -0
- package/dist/components/ui/pagination/Pagination.vue.d.ts +29 -0
- package/dist/components/ui/pagination/PaginationContent.vue.d.ts +29 -0
- package/dist/components/ui/pagination/PaginationEllipsis.vue.d.ts +22 -0
- package/dist/components/ui/pagination/PaginationFirst.vue.d.ts +26 -0
- package/dist/components/ui/pagination/PaginationItem.vue.d.ts +28 -0
- package/dist/components/ui/pagination/PaginationLast.vue.d.ts +26 -0
- package/dist/components/ui/pagination/PaginationNext.vue.d.ts +26 -0
- package/dist/components/ui/pagination/PaginationPrevious.vue.d.ts +26 -0
- package/dist/components/ui/pagination/index.d.ts +8 -0
- package/dist/components/ui/profile/Profile.vue.d.ts +30 -0
- package/dist/components/ui/profile/ProfileGroup.vue.d.ts +37 -0
- package/dist/components/ui/profile/index.d.ts +4 -0
- package/dist/components/ui/progress/Progress.vue.d.ts +36 -0
- package/dist/components/ui/progress/index.d.ts +2 -0
- package/dist/components/ui/prompt-input/PromptInput.vue.d.ts +150 -0
- package/dist/components/ui/prompt-input/index.d.ts +2 -0
- package/dist/components/ui/prompt-input/types.d.ts +61 -0
- package/dist/components/ui/radio-group/RadioGroup.vue.d.ts +30 -0
- package/dist/components/ui/radio-group/RadioGroupItem.vue.d.ts +12 -0
- package/dist/components/ui/radio-group/RadioGroupOption.vue.d.ts +28 -0
- package/dist/components/ui/radio-group/index.d.ts +3 -0
- package/dist/components/ui/reasoning/Reasoning.vue.d.ts +40 -0
- package/dist/components/ui/reasoning/index.d.ts +2 -0
- package/dist/components/ui/reasoning/types.d.ts +26 -0
- package/dist/components/ui/select/Select.vue.d.ts +28 -0
- package/dist/components/ui/select/SelectContent.vue.d.ts +46 -0
- package/dist/components/ui/select/SelectGroup.vue.d.ts +18 -0
- package/dist/components/ui/select/SelectItem.vue.d.ts +26 -0
- package/dist/components/ui/select/SelectItemText.vue.d.ts +18 -0
- package/dist/components/ui/select/SelectLabel.vue.d.ts +22 -0
- package/dist/components/ui/select/SelectScrollDownButton.vue.d.ts +22 -0
- package/dist/components/ui/select/SelectScrollUpButton.vue.d.ts +22 -0
- package/dist/components/ui/select/SelectSeparator.vue.d.ts +7 -0
- package/dist/components/ui/select/SelectTrigger.vue.d.ts +25 -0
- package/dist/components/ui/select/SelectValue.vue.d.ts +18 -0
- package/dist/components/ui/select/index.d.ts +11 -0
- package/dist/components/ui/select/search.d.ts +18 -0
- package/dist/components/ui/separator/Separator.vue.d.ts +6 -0
- package/dist/components/ui/separator/index.d.ts +2 -0
- package/dist/components/ui/separator/types.d.ts +7 -0
- package/dist/components/ui/shimmer/Shimmer.vue.d.ts +37 -0
- package/dist/components/ui/shimmer/index.d.ts +2 -0
- package/dist/components/ui/sidebar/Sidebar.vue.d.ts +24 -0
- package/dist/components/ui/sidebar/SidebarContent.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarFooter.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarGroup.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarGroupAction.vue.d.ts +24 -0
- package/dist/components/ui/sidebar/SidebarGroupContent.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarGroupLabel.vue.d.ts +24 -0
- package/dist/components/ui/sidebar/SidebarHeader.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarInput.vue.d.ts +6 -0
- package/dist/components/ui/sidebar/SidebarInset.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenu.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenuAction.vue.d.ts +25 -0
- package/dist/components/ui/sidebar/SidebarMenuBadge.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenuButton.vue.d.ts +25 -0
- package/dist/components/ui/sidebar/SidebarMenuButtonChild.vue.d.ts +30 -0
- package/dist/components/ui/sidebar/SidebarMenuItem.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenuSub.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarMenuSubButton.vue.d.ts +27 -0
- package/dist/components/ui/sidebar/SidebarMenuSubItem.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarProvider.vue.d.ts +36 -0
- package/dist/components/ui/sidebar/SidebarRail.vue.d.ts +21 -0
- package/dist/components/ui/sidebar/SidebarSeparator.vue.d.ts +6 -0
- package/dist/components/ui/sidebar/SidebarTrigger.vue.d.ts +6 -0
- package/dist/components/ui/sidebar/context.d.ts +19 -0
- package/dist/components/ui/sidebar/index.d.ts +26 -0
- package/dist/components/ui/sidebar/types.d.ts +11 -0
- package/dist/components/ui/sidebar/variants.d.ts +6 -0
- package/dist/components/ui/skeleton/Skeleton.vue.d.ts +18 -0
- package/dist/components/ui/skeleton/index.d.ts +2 -0
- package/dist/components/ui/sonner/Sonner.vue.d.ts +5 -0
- package/dist/components/ui/sonner/index.d.ts +2 -0
- package/dist/components/ui/spinner/Spinner.vue.d.ts +11 -0
- package/dist/components/ui/spinner/index.d.ts +1 -0
- package/dist/components/ui/stepper/Stepper.vue.d.ts +38 -0
- package/dist/components/ui/stepper/StepperDescription.vue.d.ts +22 -0
- package/dist/components/ui/stepper/StepperIndicator.vue.d.ts +30 -0
- package/dist/components/ui/stepper/StepperItem.vue.d.ts +24 -0
- package/dist/components/ui/stepper/StepperSeparator.vue.d.ts +7 -0
- package/dist/components/ui/stepper/StepperTitle.vue.d.ts +22 -0
- package/dist/components/ui/stepper/StepperTrigger.vue.d.ts +22 -0
- package/dist/components/ui/stepper/index.d.ts +7 -0
- package/dist/components/ui/switch/Switch.vue.d.ts +12 -0
- package/dist/components/ui/switch/index.d.ts +1 -0
- package/dist/components/ui/table/Table.vue.d.ts +22 -0
- package/dist/components/ui/table/TableBody.vue.d.ts +21 -0
- package/dist/components/ui/table/TableCaption.vue.d.ts +21 -0
- package/dist/components/ui/table/TableCell.vue.d.ts +22 -0
- package/dist/components/ui/table/TableEmpty.vue.d.ts +24 -0
- package/dist/components/ui/table/TableFooter.vue.d.ts +21 -0
- package/dist/components/ui/table/TableHead.vue.d.ts +21 -0
- package/dist/components/ui/table/TableHeader.vue.d.ts +21 -0
- package/dist/components/ui/table/TableRow.vue.d.ts +21 -0
- package/dist/components/ui/table/index.d.ts +9 -0
- package/dist/components/ui/tabs/Tabs.vue.d.ts +28 -0
- package/dist/components/ui/tabs/TabsContent.vue.d.ts +22 -0
- package/dist/components/ui/tabs/TabsList.vue.d.ts +22 -0
- package/dist/components/ui/tabs/TabsTrigger.vue.d.ts +22 -0
- package/dist/components/ui/tabs/index.d.ts +4 -0
- package/dist/components/ui/tag/Tag.vue.d.ts +35 -0
- package/dist/components/ui/tag/index.d.ts +2 -0
- package/dist/components/ui/tag/variants.d.ts +6 -0
- package/dist/components/ui/textarea/Textarea.vue.d.ts +14 -0
- package/dist/components/ui/textarea/TextareaControl.vue.d.ts +14 -0
- package/dist/components/ui/textarea/TextareaFieldGroup.vue.d.ts +21 -0
- package/dist/components/ui/textarea/index.d.ts +4 -0
- package/dist/components/ui/textarea/types.d.ts +32 -0
- package/dist/components/ui/tool/Tool.vue.d.ts +61 -0
- package/dist/components/ui/tool/index.d.ts +2 -0
- package/dist/components/ui/tooltip/Tooltip.vue.d.ts +24 -0
- package/dist/components/ui/tooltip/TooltipContent.vue.d.ts +32 -0
- package/dist/components/ui/tooltip/TooltipProvider.vue.d.ts +20 -0
- package/dist/components/ui/tooltip/TooltipTrigger.vue.d.ts +18 -0
- package/dist/components/ui/tooltip/index.d.ts +4 -0
- package/dist/docs/component-docs.d.ts +18 -0
- package/dist/docs/markdown.d.ts +27 -0
- package/dist/index.d.ts +45 -0
- package/dist/lib/code-highlight.d.ts +11 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/styles.css +3 -0
- package/package.json +76 -0
- package/public/r/accordion.json +52 -0
- package/public/r/alert.json +51 -0
- package/public/r/button-group.json +31 -0
- package/public/r/button.json +39 -0
- package/public/r/card.json +61 -0
- package/public/r/chart.json +31 -0
- package/public/r/chat.json +186 -0
- package/public/r/checkbox.json +34 -0
- package/public/r/commit.json +32 -0
- package/public/r/contribution-graph.json +63 -0
- package/public/r/data-table.json +197 -0
- package/public/r/date-picker.json +33 -0
- package/public/r/dialog.json +88 -0
- package/public/r/diff.json +71 -0
- package/public/r/dropdown-menu.json +112 -0
- package/public/r/gauge.json +31 -0
- package/public/r/git-graph.json +32 -0
- package/public/r/incident-timeline.json +64 -0
- package/public/r/input.json +49 -0
- package/public/r/kpi-card.json +32 -0
- package/public/r/kpi-line-card.json +32 -0
- package/public/r/model-selector.json +148 -0
- package/public/r/network-graph.json +33 -0
- package/public/r/pagination.json +95 -0
- package/public/r/profile.json +37 -0
- package/public/r/progress.json +31 -0
- package/public/r/prompt-input.json +293 -0
- package/public/r/radio-group.json +45 -0
- package/public/r/reasoning.json +38 -0
- package/public/r/registry.json +2512 -0
- package/public/r/select.json +100 -0
- package/public/r/separator.json +37 -0
- package/public/r/shimmer.json +31 -0
- package/public/r/sidebar.json +221 -0
- package/public/r/skeleton.json +31 -0
- package/public/r/sonner.json +33 -0
- package/public/r/spinner.json +31 -0
- package/public/r/stepper.json +70 -0
- package/public/r/switch.json +33 -0
- package/public/r/table.json +79 -0
- package/public/r/tabs.json +51 -0
- package/public/r/tag.json +39 -0
- package/public/r/textarea.json +49 -0
- package/public/r/tool.json +32 -0
- package/public/r/tooltip.json +51 -0
- package/registry.json +2512 -0
- package/src/components/docs/MarkdownContent.vue +106 -0
- package/src/components/ui/accordion/Accordion.vue +24 -0
- package/src/components/ui/accordion/AccordionContent.vue +62 -0
- package/src/components/ui/accordion/AccordionItem.vue +23 -0
- package/src/components/ui/accordion/AccordionTrigger.vue +38 -0
- package/src/components/ui/accordion/index.ts +4 -0
- package/src/components/ui/alert/Alert.vue +40 -0
- package/src/components/ui/alert/AlertDescription.vue +24 -0
- package/src/components/ui/alert/AlertTitle.vue +24 -0
- package/src/components/ui/alert/index.ts +4 -0
- package/src/components/ui/alert/variants.ts +19 -0
- package/src/components/ui/button/Button.vue +27 -0
- package/src/components/ui/button/index.ts +2 -0
- package/src/components/ui/button/variants.ts +32 -0
- package/src/components/ui/button-group/ButtonGroup.vue +31 -0
- package/src/components/ui/button-group/index.ts +2 -0
- package/src/components/ui/card/Card.vue +17 -0
- package/src/components/ui/card/CardContent.vue +14 -0
- package/src/components/ui/card/CardDescription.vue +14 -0
- package/src/components/ui/card/CardFooter.vue +14 -0
- package/src/components/ui/card/CardHeader.vue +17 -0
- package/src/components/ui/card/CardTitle.vue +14 -0
- package/src/components/ui/card/index.ts +6 -0
- package/src/components/ui/chart/Chart.vue +1042 -0
- package/src/components/ui/chart/index.ts +13 -0
- package/src/components/ui/chat/Chat.vue +1297 -0
- package/src/components/ui/chat/ChatAttachments.vue +278 -0
- package/src/components/ui/chat/ChatCodeBlock.vue +283 -0
- package/src/components/ui/chat/code-block.ts +30 -0
- package/src/components/ui/chat/index.ts +24 -0
- package/src/components/ui/chat/types.ts +23 -0
- package/src/components/ui/checkbox/Checkbox.vue +38 -0
- package/src/components/ui/checkbox/index.ts +1 -0
- package/src/components/ui/commit/Commit.vue +423 -0
- package/src/components/ui/commit/index.ts +9 -0
- package/src/components/ui/contribution-graph/ContributionGraph.vue +719 -0
- package/src/components/ui/contribution-graph/index.ts +9 -0
- package/src/components/ui/data-table/DataTable.vue +534 -0
- package/src/components/ui/data-table/index.ts +9 -0
- package/src/components/ui/date-picker/DatePicker.vue +649 -0
- package/src/components/ui/date-picker/index.ts +7 -0
- package/src/components/ui/dialog/Dialog.vue +19 -0
- package/src/components/ui/dialog/DialogClose.vue +17 -0
- package/src/components/ui/dialog/DialogContent.vue +60 -0
- package/src/components/ui/dialog/DialogDescription.vue +23 -0
- package/src/components/ui/dialog/DialogFooter.vue +17 -0
- package/src/components/ui/dialog/DialogHeader.vue +17 -0
- package/src/components/ui/dialog/DialogOverlay.vue +23 -0
- package/src/components/ui/dialog/DialogScrollContent.vue +69 -0
- package/src/components/ui/dialog/DialogTitle.vue +23 -0
- package/src/components/ui/dialog/DialogTrigger.vue +17 -0
- package/src/components/ui/dialog/index.ts +10 -0
- package/src/components/ui/diff/DiffTool.vue +513 -0
- package/src/components/ui/diff/diff-parser.ts +423 -0
- package/src/components/ui/diff/diff-tool.ts +39 -0
- package/src/components/ui/diff/index.ts +5 -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 +31 -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/gauge/Gauge.vue +725 -0
- package/src/components/ui/gauge/index.ts +9 -0
- package/src/components/ui/git-graph/GitGraph.vue +715 -0
- package/src/components/ui/git-graph/index.ts +9 -0
- package/src/components/ui/incident-timeline/IncidentTimeline.vue +360 -0
- package/src/components/ui/incident-timeline/index.ts +7 -0
- package/src/components/ui/input/Input.vue +159 -0
- package/src/components/ui/input/InputControl.vue +135 -0
- package/src/components/ui/input/InputFieldGroup.vue +14 -0
- package/src/components/ui/input/index.ts +9 -0
- package/src/components/ui/input/types.ts +34 -0
- package/src/components/ui/kpi-card/KpiCard.vue +268 -0
- package/src/components/ui/kpi-card/index.ts +9 -0
- package/src/components/ui/kpi-line-card/KpiLineCard.vue +622 -0
- package/src/components/ui/kpi-line-card/index.ts +11 -0
- package/src/components/ui/model-selector/ModelSelector.vue +328 -0
- package/src/components/ui/model-selector/index.ts +6 -0
- package/src/components/ui/model-selector/types.ts +15 -0
- package/src/components/ui/network-graph/NetworkGraph.vue +902 -0
- package/src/components/ui/network-graph/index.ts +7 -0
- package/src/components/ui/pagination/Pagination.vue +26 -0
- package/src/components/ui/pagination/PaginationContent.vue +24 -0
- package/src/components/ui/pagination/PaginationEllipsis.vue +27 -0
- package/src/components/ui/pagination/PaginationFirst.vue +33 -0
- package/src/components/ui/pagination/PaginationItem.vue +39 -0
- package/src/components/ui/pagination/PaginationLast.vue +33 -0
- package/src/components/ui/pagination/PaginationNext.vue +33 -0
- package/src/components/ui/pagination/PaginationPrevious.vue +33 -0
- package/src/components/ui/pagination/index.ts +8 -0
- package/src/components/ui/profile/Profile.vue +226 -0
- package/src/components/ui/profile/ProfileGroup.vue +96 -0
- package/src/components/ui/profile/index.ts +8 -0
- package/src/components/ui/progress/Progress.vue +271 -0
- package/src/components/ui/progress/index.ts +9 -0
- package/src/components/ui/prompt-input/PromptInput.vue +1094 -0
- package/src/components/ui/prompt-input/index.ts +14 -0
- package/src/components/ui/prompt-input/types.ts +78 -0
- package/src/components/ui/radio-group/RadioGroup.vue +36 -0
- package/src/components/ui/radio-group/RadioGroupItem.vue +45 -0
- package/src/components/ui/radio-group/RadioGroupOption.vue +80 -0
- package/src/components/ui/radio-group/index.ts +3 -0
- package/src/components/ui/reasoning/Reasoning.vue +278 -0
- package/src/components/ui/reasoning/index.ts +8 -0
- package/src/components/ui/reasoning/types.ts +29 -0
- package/src/components/ui/select/Select.vue +19 -0
- package/src/components/ui/select/SelectContent.vue +166 -0
- package/src/components/ui/select/SelectGroup.vue +23 -0
- package/src/components/ui/select/SelectItem.vue +97 -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/select/search.ts +26 -0
- package/src/components/ui/separator/Separator.vue +30 -0
- package/src/components/ui/separator/index.ts +5 -0
- package/src/components/ui/separator/types.ts +9 -0
- package/src/components/ui/shimmer/Shimmer.vue +110 -0
- package/src/components/ui/shimmer/index.ts +5 -0
- package/src/components/ui/sidebar/Sidebar.vue +142 -0
- package/src/components/ui/sidebar/SidebarContent.vue +18 -0
- package/src/components/ui/sidebar/SidebarFooter.vue +18 -0
- package/src/components/ui/sidebar/SidebarGroup.vue +18 -0
- package/src/components/ui/sidebar/SidebarGroupAction.vue +31 -0
- package/src/components/ui/sidebar/SidebarGroupContent.vue +18 -0
- package/src/components/ui/sidebar/SidebarGroupLabel.vue +30 -0
- package/src/components/ui/sidebar/SidebarHeader.vue +18 -0
- package/src/components/ui/sidebar/SidebarInput.vue +26 -0
- package/src/components/ui/sidebar/SidebarInset.vue +23 -0
- package/src/components/ui/sidebar/SidebarMenu.vue +18 -0
- package/src/components/ui/sidebar/SidebarMenuAction.vue +34 -0
- package/src/components/ui/sidebar/SidebarMenuBadge.vue +25 -0
- package/src/components/ui/sidebar/SidebarMenuButton.vue +37 -0
- package/src/components/ui/sidebar/SidebarMenuButtonChild.vue +38 -0
- package/src/components/ui/sidebar/SidebarMenuItem.vue +18 -0
- package/src/components/ui/sidebar/SidebarMenuSub.vue +18 -0
- package/src/components/ui/sidebar/SidebarMenuSubButton.vue +36 -0
- package/src/components/ui/sidebar/SidebarMenuSubItem.vue +18 -0
- package/src/components/ui/sidebar/SidebarProvider.vue +119 -0
- package/src/components/ui/sidebar/SidebarRail.vue +35 -0
- package/src/components/ui/sidebar/SidebarSeparator.vue +18 -0
- package/src/components/ui/sidebar/SidebarTrigger.vue +28 -0
- package/src/components/ui/sidebar/context.ts +39 -0
- package/src/components/ui/sidebar/index.ts +43 -0
- package/src/components/ui/sidebar/types.ts +13 -0
- package/src/components/ui/sidebar/variants.ts +25 -0
- package/src/components/ui/skeleton/Skeleton.vue +53 -0
- package/src/components/ui/skeleton/index.ts +5 -0
- package/src/components/ui/sonner/Sonner.vue +69 -0
- package/src/components/ui/sonner/index.ts +12 -0
- package/src/components/ui/spinner/Spinner.vue +33 -0
- package/src/components/ui/spinner/index.ts +1 -0
- package/src/components/ui/stepper/Stepper.vue +29 -0
- package/src/components/ui/stepper/StepperDescription.vue +30 -0
- package/src/components/ui/stepper/StepperIndicator.vue +50 -0
- package/src/components/ui/stepper/StepperItem.vue +28 -0
- package/src/components/ui/stepper/StepperSeparator.vue +25 -0
- package/src/components/ui/stepper/StepperTitle.vue +27 -0
- package/src/components/ui/stepper/StepperTrigger.vue +27 -0
- package/src/components/ui/stepper/index.ts +7 -0
- package/src/components/ui/switch/Switch.vue +41 -0
- package/src/components/ui/switch/index.ts +1 -0
- package/src/components/ui/table/Table.vue +23 -0
- package/src/components/ui/table/TableBody.vue +17 -0
- package/src/components/ui/table/TableCaption.vue +17 -0
- package/src/components/ui/table/TableCell.vue +24 -0
- package/src/components/ui/table/TableEmpty.vue +31 -0
- package/src/components/ui/table/TableFooter.vue +17 -0
- package/src/components/ui/table/TableHead.vue +22 -0
- package/src/components/ui/table/TableHeader.vue +17 -0
- package/src/components/ui/table/TableRow.vue +22 -0
- package/src/components/ui/table/index.ts +9 -0
- package/src/components/ui/tabs/Tabs.vue +24 -0
- package/src/components/ui/tabs/TabsContent.vue +22 -0
- package/src/components/ui/tabs/TabsList.vue +27 -0
- package/src/components/ui/tabs/TabsTrigger.vue +27 -0
- package/src/components/ui/tabs/index.ts +4 -0
- package/src/components/ui/tag/Tag.vue +55 -0
- package/src/components/ui/tag/index.ts +2 -0
- package/src/components/ui/tag/variants.ts +29 -0
- package/src/components/ui/textarea/Textarea.vue +159 -0
- package/src/components/ui/textarea/TextareaControl.vue +120 -0
- package/src/components/ui/textarea/TextareaFieldGroup.vue +14 -0
- package/src/components/ui/textarea/index.ts +10 -0
- package/src/components/ui/textarea/types.ts +35 -0
- package/src/components/ui/tool/Tool.vue +304 -0
- package/src/components/ui/tool/index.ts +7 -0
- package/src/components/ui/tooltip/Tooltip.vue +19 -0
- package/src/components/ui/tooltip/TooltipContent.vue +44 -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/lib/code-highlight.ts +220 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles.css +684 -0
|
@@ -0,0 +1,719 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, onBeforeUnmount, onMounted, ref } from "vue"
|
|
3
|
+
import type { CSSProperties, HTMLAttributes } from "vue"
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
import {
|
|
6
|
+
Tooltip,
|
|
7
|
+
TooltipContent,
|
|
8
|
+
TooltipProvider,
|
|
9
|
+
TooltipTrigger,
|
|
10
|
+
} from "../tooltip"
|
|
11
|
+
|
|
12
|
+
export type ContributionGraphSize = "default" | "lg" | "sm"
|
|
13
|
+
export type ContributionGraphWeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6
|
|
14
|
+
|
|
15
|
+
export interface ContributionGraphItem {
|
|
16
|
+
count: number
|
|
17
|
+
date: Date | string
|
|
18
|
+
label?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ContributionGraphDay {
|
|
22
|
+
count: number
|
|
23
|
+
date: string
|
|
24
|
+
day: number
|
|
25
|
+
label: string
|
|
26
|
+
level: number
|
|
27
|
+
outside: boolean
|
|
28
|
+
row: number
|
|
29
|
+
weekday: number
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ContributionGraphSelectPayload extends ContributionGraphDay {
|
|
33
|
+
item?: ContributionGraphItem
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ContributionGraphYearSelectPayload {
|
|
37
|
+
endDate: string
|
|
38
|
+
startDate: string
|
|
39
|
+
year: number
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface NormalizedContributionItem extends ContributionGraphItem {
|
|
43
|
+
count: number
|
|
44
|
+
date: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface ContributionGraphProps {
|
|
48
|
+
activeLabel?: string
|
|
49
|
+
class?: HTMLAttributes["class"]
|
|
50
|
+
description?: string
|
|
51
|
+
emptyLabel?: string
|
|
52
|
+
endDate?: Date | string
|
|
53
|
+
fitWidth?: boolean
|
|
54
|
+
gridClass?: HTMLAttributes["class"]
|
|
55
|
+
items?: ContributionGraphItem[]
|
|
56
|
+
legendLabel?: string
|
|
57
|
+
lessLabel?: string
|
|
58
|
+
locale?: string
|
|
59
|
+
maxCount?: number
|
|
60
|
+
modelValue?: string
|
|
61
|
+
moreLabel?: string
|
|
62
|
+
showLegend?: boolean
|
|
63
|
+
showMonthLabels?: boolean
|
|
64
|
+
showSummary?: boolean
|
|
65
|
+
showWeekdayLabels?: boolean
|
|
66
|
+
showYearSelector?: boolean
|
|
67
|
+
size?: ContributionGraphSize
|
|
68
|
+
startDate?: Date | string
|
|
69
|
+
summary?: string
|
|
70
|
+
title?: string
|
|
71
|
+
totalLabel?: string
|
|
72
|
+
weekStart?: ContributionGraphWeekStart
|
|
73
|
+
weeks?: number
|
|
74
|
+
year?: number | string
|
|
75
|
+
yearOptions?: Array<number | string>
|
|
76
|
+
yearSelectorLabel?: string
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const props = withDefaults(defineProps<ContributionGraphProps>(), {
|
|
80
|
+
activeLabel: "active days",
|
|
81
|
+
emptyLabel: "No contributions",
|
|
82
|
+
fitWidth: true,
|
|
83
|
+
legendLabel: "Contribution intensity",
|
|
84
|
+
lessLabel: "Less",
|
|
85
|
+
moreLabel: "More",
|
|
86
|
+
showLegend: true,
|
|
87
|
+
showMonthLabels: true,
|
|
88
|
+
showSummary: true,
|
|
89
|
+
showWeekdayLabels: false,
|
|
90
|
+
showYearSelector: true,
|
|
91
|
+
size: "default",
|
|
92
|
+
totalLabel: "contributions",
|
|
93
|
+
weekStart: 0,
|
|
94
|
+
yearSelectorLabel: "Contribution years",
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
const emit = defineEmits<{
|
|
98
|
+
"select": [day: ContributionGraphSelectPayload]
|
|
99
|
+
"update:modelValue": [date: string]
|
|
100
|
+
"update:year": [year: number]
|
|
101
|
+
"year-change": [payload: ContributionGraphYearSelectPayload]
|
|
102
|
+
}>()
|
|
103
|
+
|
|
104
|
+
const dayMs = 24 * 60 * 60 * 1000
|
|
105
|
+
const graphViewport = ref<HTMLElement | null>(null)
|
|
106
|
+
const graphWidth = ref<number | null>(null)
|
|
107
|
+
const internalYear = ref<number | null>(null)
|
|
108
|
+
let resizeObserver: ResizeObserver | undefined
|
|
109
|
+
|
|
110
|
+
onMounted(() => {
|
|
111
|
+
const element = graphViewport.value
|
|
112
|
+
|
|
113
|
+
if (!element || typeof ResizeObserver === "undefined") return
|
|
114
|
+
|
|
115
|
+
graphWidth.value = element.clientWidth
|
|
116
|
+
resizeObserver = new ResizeObserver((entries) => {
|
|
117
|
+
graphWidth.value = Math.round(entries[0]?.contentRect.width ?? element.clientWidth)
|
|
118
|
+
})
|
|
119
|
+
resizeObserver.observe(element)
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
onBeforeUnmount(() => {
|
|
123
|
+
resizeObserver?.disconnect()
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const dateFormatter = computed(() =>
|
|
127
|
+
new Intl.DateTimeFormat(props.locale, {
|
|
128
|
+
day: "numeric",
|
|
129
|
+
month: "short",
|
|
130
|
+
year: "numeric",
|
|
131
|
+
}),
|
|
132
|
+
)
|
|
133
|
+
const monthFormatter = computed(() =>
|
|
134
|
+
new Intl.DateTimeFormat(props.locale, {
|
|
135
|
+
month: "short",
|
|
136
|
+
}),
|
|
137
|
+
)
|
|
138
|
+
const weekdayFormatter = computed(() =>
|
|
139
|
+
new Intl.DateTimeFormat(props.locale, {
|
|
140
|
+
weekday: "short",
|
|
141
|
+
}),
|
|
142
|
+
)
|
|
143
|
+
const numberFormatter = computed(() =>
|
|
144
|
+
new Intl.NumberFormat(props.locale, {
|
|
145
|
+
maximumFractionDigits: 0,
|
|
146
|
+
}),
|
|
147
|
+
)
|
|
148
|
+
const baseEndDate = computed(() => stripTime(parseDate(props.endDate) ?? new Date()))
|
|
149
|
+
const selectedYear = computed(() =>
|
|
150
|
+
normalizeYear(props.year) ?? internalYear.value ?? baseEndDate.value.getFullYear(),
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
const range = computed(() => {
|
|
154
|
+
if (props.showYearSelector) {
|
|
155
|
+
return getContributionYearRange(selectedYear.value)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const rawEnd = baseEndDate.value
|
|
159
|
+
const defaultStart = props.weeks
|
|
160
|
+
? addDays(rawEnd, -(Math.max(1, Math.trunc(props.weeks)) * 7) + 1)
|
|
161
|
+
: getOneYearStart(rawEnd)
|
|
162
|
+
const parsedStart = parseDate(props.startDate)
|
|
163
|
+
const rawStart = stripTime(parsedStart ?? defaultStart)
|
|
164
|
+
|
|
165
|
+
if (rawStart <= rawEnd) {
|
|
166
|
+
return {
|
|
167
|
+
end: rawEnd,
|
|
168
|
+
start: rawStart,
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return {
|
|
173
|
+
end: rawStart,
|
|
174
|
+
start: rawEnd,
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
const normalizedItems = computed(() => {
|
|
179
|
+
const items = new Map<string, NormalizedContributionItem>()
|
|
180
|
+
|
|
181
|
+
for (const item of props.items ?? []) {
|
|
182
|
+
const date = parseDate(item.date)
|
|
183
|
+
|
|
184
|
+
if (!date) continue
|
|
185
|
+
|
|
186
|
+
const key = formatLocalDate(date)
|
|
187
|
+
const existing = items.get(key)
|
|
188
|
+
const count = normalizeCount(item.count)
|
|
189
|
+
|
|
190
|
+
items.set(key, {
|
|
191
|
+
...item,
|
|
192
|
+
count: (existing?.count ?? 0) + count,
|
|
193
|
+
date: key,
|
|
194
|
+
label: item.label ?? existing?.label,
|
|
195
|
+
})
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return items
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
const maxCount = computed(() => {
|
|
202
|
+
if (props.maxCount !== undefined) return Math.max(normalizeCount(props.maxCount), 0)
|
|
203
|
+
|
|
204
|
+
return Math.max(
|
|
205
|
+
0,
|
|
206
|
+
...Array.from(normalizedItems.value.values(), (item) => item.count),
|
|
207
|
+
)
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
const days = computed<ContributionGraphDay[]>(() => {
|
|
211
|
+
const totalDays = differenceInDays(range.value.start, range.value.end) + 1
|
|
212
|
+
|
|
213
|
+
return Array.from({ length: totalDays }, (_, index) => {
|
|
214
|
+
const date = addDays(range.value.start, index)
|
|
215
|
+
const key = formatLocalDate(date)
|
|
216
|
+
const item = normalizedItems.value.get(key)
|
|
217
|
+
const count = item?.count ?? 0
|
|
218
|
+
const level = getContributionLevel(count)
|
|
219
|
+
|
|
220
|
+
return {
|
|
221
|
+
count,
|
|
222
|
+
date: key,
|
|
223
|
+
day: date.getDate(),
|
|
224
|
+
label: item?.label ?? formatCellLabel(date, count),
|
|
225
|
+
level,
|
|
226
|
+
outside: false,
|
|
227
|
+
row: getWeekdayRow(date, props.weekStart),
|
|
228
|
+
weekday: date.getDay(),
|
|
229
|
+
}
|
|
230
|
+
})
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
const calendarWeeks = computed(() => {
|
|
234
|
+
const grouped: ContributionGraphDay[][] = []
|
|
235
|
+
const weekMap = new Map<string, ContributionGraphDay[]>()
|
|
236
|
+
|
|
237
|
+
for (const day of days.value) {
|
|
238
|
+
const date = parseDate(day.date)
|
|
239
|
+
|
|
240
|
+
if (!date) continue
|
|
241
|
+
|
|
242
|
+
const key = formatLocalDate(startOfWeek(date, props.weekStart))
|
|
243
|
+
let week = weekMap.get(key)
|
|
244
|
+
|
|
245
|
+
if (!week) {
|
|
246
|
+
week = []
|
|
247
|
+
weekMap.set(key, week)
|
|
248
|
+
grouped.push(week)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
week.push(day)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return grouped
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
const weekCount = computed(() => calendarWeeks.value.length)
|
|
258
|
+
const totalCount = computed(() =>
|
|
259
|
+
days.value.reduce((total, day) => total + day.count, 0),
|
|
260
|
+
)
|
|
261
|
+
const activeDays = computed(() =>
|
|
262
|
+
days.value.filter((day) => day.count > 0).length,
|
|
263
|
+
)
|
|
264
|
+
const availableYears = computed(() => {
|
|
265
|
+
const configuredYears = props.yearOptions
|
|
266
|
+
?.map((year) => normalizeYear(year))
|
|
267
|
+
.filter((year): year is number => year !== null)
|
|
268
|
+
|
|
269
|
+
if (configuredYears?.length) {
|
|
270
|
+
const years = new Set(configuredYears)
|
|
271
|
+
years.add(selectedYear.value)
|
|
272
|
+
|
|
273
|
+
return Array.from(years).sort((a, b) => b - a)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const years = new Set<number>([
|
|
277
|
+
baseEndDate.value.getFullYear(),
|
|
278
|
+
selectedYear.value,
|
|
279
|
+
])
|
|
280
|
+
|
|
281
|
+
for (const item of normalizedItems.value.values()) {
|
|
282
|
+
const year = normalizeYear(item.date.slice(0, 4))
|
|
283
|
+
|
|
284
|
+
if (year !== null) years.add(year)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return Array.from(years).sort((a, b) => b - a)
|
|
288
|
+
})
|
|
289
|
+
const hasYearSelector = computed(() =>
|
|
290
|
+
props.showYearSelector && availableYears.value.length > 0,
|
|
291
|
+
)
|
|
292
|
+
const formattedSummary = computed(() => {
|
|
293
|
+
if (props.summary) return props.summary
|
|
294
|
+
|
|
295
|
+
return `${numberFormatter.value.format(totalCount.value)} ${props.totalLabel} · ${numberFormatter.value.format(activeDays.value)} ${props.activeLabel}`
|
|
296
|
+
})
|
|
297
|
+
const hasHeader = computed(() =>
|
|
298
|
+
Boolean(props.title || props.description || props.showSummary),
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
const monthLabelInterval = computed(() => {
|
|
302
|
+
if (!props.fitWidth || graphWidth.value === null) return 1
|
|
303
|
+
if (graphWidth.value < 360) return 4
|
|
304
|
+
if (graphWidth.value < 520) return 3
|
|
305
|
+
if (graphWidth.value < 680) return 2
|
|
306
|
+
|
|
307
|
+
return 1
|
|
308
|
+
})
|
|
309
|
+
|
|
310
|
+
const monthLabels = computed(() => {
|
|
311
|
+
const labels: Array<{ column: number, key: string, label: string }> = []
|
|
312
|
+
let lastKey = ""
|
|
313
|
+
|
|
314
|
+
calendarWeeks.value.forEach((week, index) => {
|
|
315
|
+
const firstMonthDay =
|
|
316
|
+
week.find((day) => !day.outside && parseDate(day.date)?.getDate() === 1) ??
|
|
317
|
+
(index === 0 ? week.find((day) => !day.outside) : undefined)
|
|
318
|
+
|
|
319
|
+
if (!firstMonthDay) return
|
|
320
|
+
|
|
321
|
+
const date = parseDate(firstMonthDay.date)
|
|
322
|
+
|
|
323
|
+
if (!date) return
|
|
324
|
+
|
|
325
|
+
const key = `${date.getFullYear()}-${date.getMonth()}`
|
|
326
|
+
|
|
327
|
+
if (key === lastKey) return
|
|
328
|
+
|
|
329
|
+
labels.push({
|
|
330
|
+
column: index + 1,
|
|
331
|
+
key,
|
|
332
|
+
label: monthFormatter.value.format(date),
|
|
333
|
+
})
|
|
334
|
+
lastKey = key
|
|
335
|
+
})
|
|
336
|
+
|
|
337
|
+
return labels.map((label, index) => ({
|
|
338
|
+
...label,
|
|
339
|
+
align: index === labels.length - 1 ? "end" : "start",
|
|
340
|
+
span: (labels[index + 1]?.column ?? weekCount.value + 1) - label.column,
|
|
341
|
+
visible:
|
|
342
|
+
monthLabelInterval.value <= 1 ||
|
|
343
|
+
labels.length <= 6 ||
|
|
344
|
+
index === 0 ||
|
|
345
|
+
index === labels.length - 1 ||
|
|
346
|
+
index % monthLabelInterval.value === 0,
|
|
347
|
+
}))
|
|
348
|
+
})
|
|
349
|
+
|
|
350
|
+
const weekdayLabels = computed(() =>
|
|
351
|
+
Array.from({ length: 7 }, (_, index) => {
|
|
352
|
+
const weekday = (props.weekStart + index) % 7
|
|
353
|
+
const labelDate = new Date(2024, 0, 7 + weekday)
|
|
354
|
+
const shouldShow = weekday === 1 || weekday === 3 || weekday === 5
|
|
355
|
+
|
|
356
|
+
return {
|
|
357
|
+
key: weekday,
|
|
358
|
+
label: shouldShow ? weekdayFormatter.value.format(labelDate) : "",
|
|
359
|
+
}
|
|
360
|
+
}),
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
const graphStyle = computed<CSSProperties>(() => ({
|
|
364
|
+
gridTemplateColumns: props.fitWidth
|
|
365
|
+
? `repeat(${weekCount.value}, minmax(0, 1fr))`
|
|
366
|
+
: `repeat(${weekCount.value}, var(--contribution-graph-cell-size))`,
|
|
367
|
+
}))
|
|
368
|
+
|
|
369
|
+
const rootStyle = computed<CSSProperties>(() => ({
|
|
370
|
+
"--contribution-graph-cell-size": getCellSize(props.size),
|
|
371
|
+
"--contribution-graph-gap": props.fitWidth ? "0.125rem" : "0.25rem",
|
|
372
|
+
} as CSSProperties))
|
|
373
|
+
|
|
374
|
+
function normalizeCount(value: number) {
|
|
375
|
+
if (!Number.isFinite(value)) return 0
|
|
376
|
+
|
|
377
|
+
return Math.max(0, Math.round(value))
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
function normalizeYear(value?: number | string | null) {
|
|
381
|
+
const year = typeof value === "string" ? Number(value) : value
|
|
382
|
+
|
|
383
|
+
if (typeof year !== "number" || !Number.isFinite(year)) return null
|
|
384
|
+
|
|
385
|
+
return Math.trunc(year)
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function getContributionLevel(count: number) {
|
|
389
|
+
if (count <= 0 || maxCount.value <= 0) return 0
|
|
390
|
+
|
|
391
|
+
return Math.max(1, Math.min(4, Math.ceil((count / maxCount.value) * 4)))
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function getCellSize(size: ContributionGraphSize) {
|
|
395
|
+
if (size === "sm") return "0.625rem"
|
|
396
|
+
if (size === "lg") return "0.875rem"
|
|
397
|
+
|
|
398
|
+
return "0.75rem"
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function getOneYearStart(endDate: Date) {
|
|
402
|
+
const start = new Date(endDate)
|
|
403
|
+
start.setFullYear(start.getFullYear() - 1)
|
|
404
|
+
|
|
405
|
+
return addDays(start, 1)
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function getContributionYearRange(year: number) {
|
|
409
|
+
const end = year === baseEndDate.value.getFullYear()
|
|
410
|
+
? baseEndDate.value
|
|
411
|
+
: new Date(year, 11, 31)
|
|
412
|
+
|
|
413
|
+
return {
|
|
414
|
+
end,
|
|
415
|
+
start: getOneYearStart(end),
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function parseDate(value?: Date | string | null) {
|
|
420
|
+
if (!value) return null
|
|
421
|
+
|
|
422
|
+
if (value instanceof Date) {
|
|
423
|
+
if (Number.isNaN(value.getTime())) return null
|
|
424
|
+
|
|
425
|
+
return stripTime(value)
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
const match = value.match(/^(\d{4})-(\d{2})-(\d{2})/)
|
|
429
|
+
|
|
430
|
+
if (!match) return null
|
|
431
|
+
|
|
432
|
+
const [, year, month, day] = match
|
|
433
|
+
const date = new Date(Number(year), Number(month) - 1, Number(day))
|
|
434
|
+
|
|
435
|
+
if (Number.isNaN(date.getTime())) return null
|
|
436
|
+
|
|
437
|
+
return stripTime(date)
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function stripTime(date: Date) {
|
|
441
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate())
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
function addDays(date: Date, amount: number) {
|
|
445
|
+
const nextDate = new Date(date)
|
|
446
|
+
nextDate.setDate(nextDate.getDate() + amount)
|
|
447
|
+
|
|
448
|
+
return nextDate
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function startOfWeek(date: Date, weekStart: ContributionGraphWeekStart) {
|
|
452
|
+
const day = date.getDay()
|
|
453
|
+
const diff = (day - weekStart + 7) % 7
|
|
454
|
+
|
|
455
|
+
return addDays(date, -diff)
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function getWeekdayRow(date: Date, weekStart: ContributionGraphWeekStart) {
|
|
459
|
+
return ((date.getDay() - weekStart + 7) % 7) + 1
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
function differenceInDays(start: Date, end: Date) {
|
|
463
|
+
return Math.round((stripTime(end).getTime() - stripTime(start).getTime()) / dayMs)
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
function isDateInRange(date: Date, start: Date, end: Date) {
|
|
467
|
+
return date >= start && date <= end
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function formatLocalDate(date: Date) {
|
|
471
|
+
const year = date.getFullYear()
|
|
472
|
+
const month = String(date.getMonth() + 1).padStart(2, "0")
|
|
473
|
+
const day = String(date.getDate()).padStart(2, "0")
|
|
474
|
+
|
|
475
|
+
return `${year}-${month}-${day}`
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function formatCellLabel(date: Date, count: number) {
|
|
479
|
+
const formattedDate = dateFormatter.value.format(date)
|
|
480
|
+
|
|
481
|
+
if (count <= 0) return `${props.emptyLabel} on ${formattedDate}`
|
|
482
|
+
|
|
483
|
+
return `${numberFormatter.value.format(count)} ${props.totalLabel} on ${formattedDate}`
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function handleSelect(day: ContributionGraphDay) {
|
|
487
|
+
if (day.outside) return
|
|
488
|
+
|
|
489
|
+
const item = normalizedItems.value.get(day.date)
|
|
490
|
+
|
|
491
|
+
emit("update:modelValue", day.date)
|
|
492
|
+
emit("select", {
|
|
493
|
+
...day,
|
|
494
|
+
item,
|
|
495
|
+
})
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function handleYearSelect(year: number) {
|
|
499
|
+
if (year === selectedYear.value) return
|
|
500
|
+
|
|
501
|
+
internalYear.value = year
|
|
502
|
+
|
|
503
|
+
const nextRange = getContributionYearRange(year)
|
|
504
|
+
const selectedDate = parseDate(props.modelValue)
|
|
505
|
+
|
|
506
|
+
emit("update:year", year)
|
|
507
|
+
emit("year-change", {
|
|
508
|
+
endDate: formatLocalDate(nextRange.end),
|
|
509
|
+
startDate: formatLocalDate(nextRange.start),
|
|
510
|
+
year,
|
|
511
|
+
})
|
|
512
|
+
|
|
513
|
+
if (!selectedDate || !isDateInRange(selectedDate, nextRange.start, nextRange.end)) {
|
|
514
|
+
emit("update:modelValue", formatLocalDate(nextRange.end))
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
</script>
|
|
518
|
+
|
|
519
|
+
<template>
|
|
520
|
+
<div
|
|
521
|
+
data-slot="contribution-graph"
|
|
522
|
+
:class="cn('flex min-w-0 flex-col gap-4 text-sm', props.class)"
|
|
523
|
+
:style="rootStyle"
|
|
524
|
+
>
|
|
525
|
+
<div
|
|
526
|
+
v-if="hasHeader"
|
|
527
|
+
data-slot="contribution-graph-header"
|
|
528
|
+
class="flex flex-wrap items-end justify-between gap-3"
|
|
529
|
+
>
|
|
530
|
+
<div v-if="props.title || props.description" class="flex min-w-0 flex-col gap-1">
|
|
531
|
+
<h3
|
|
532
|
+
v-if="props.title"
|
|
533
|
+
data-slot="contribution-graph-title"
|
|
534
|
+
class="truncate text-base font-semibold leading-none"
|
|
535
|
+
>
|
|
536
|
+
{{ props.title }}
|
|
537
|
+
</h3>
|
|
538
|
+
<p
|
|
539
|
+
v-if="props.description"
|
|
540
|
+
data-slot="contribution-graph-description"
|
|
541
|
+
class="text-sm text-muted-foreground"
|
|
542
|
+
>
|
|
543
|
+
{{ props.description }}
|
|
544
|
+
</p>
|
|
545
|
+
</div>
|
|
546
|
+
|
|
547
|
+
<p
|
|
548
|
+
v-if="props.showSummary"
|
|
549
|
+
data-slot="contribution-graph-summary"
|
|
550
|
+
class="shrink-0 text-sm font-medium text-muted-foreground"
|
|
551
|
+
>
|
|
552
|
+
{{ formattedSummary }}
|
|
553
|
+
</p>
|
|
554
|
+
</div>
|
|
555
|
+
|
|
556
|
+
<div
|
|
557
|
+
data-slot="contribution-graph-body"
|
|
558
|
+
:class="cn('flex min-w-0 flex-col gap-4', hasYearSelector && 'md:grid md:grid-cols-[minmax(0,1fr)_4.5rem] md:items-start')"
|
|
559
|
+
>
|
|
560
|
+
<div data-slot="contribution-graph-main" class="flex min-w-0 flex-col gap-4">
|
|
561
|
+
<TooltipProvider>
|
|
562
|
+
<div
|
|
563
|
+
data-slot="contribution-graph-scroll"
|
|
564
|
+
ref="graphViewport"
|
|
565
|
+
:class="cn('min-w-0 pb-1', props.fitWidth ? 'overflow-visible' : 'overflow-x-auto')"
|
|
566
|
+
>
|
|
567
|
+
<div
|
|
568
|
+
data-slot="contribution-graph-layout"
|
|
569
|
+
:class="
|
|
570
|
+
cn(
|
|
571
|
+
'gap-x-2 gap-y-1',
|
|
572
|
+
props.fitWidth ? 'grid w-full min-w-0' : 'inline-grid min-w-max',
|
|
573
|
+
props.showWeekdayLabels ? 'grid-cols-[2rem_minmax(0,1fr)]' : 'grid-cols-1',
|
|
574
|
+
props.gridClass,
|
|
575
|
+
)
|
|
576
|
+
"
|
|
577
|
+
>
|
|
578
|
+
<div
|
|
579
|
+
v-if="props.showWeekdayLabels && props.showMonthLabels"
|
|
580
|
+
aria-hidden="true"
|
|
581
|
+
/>
|
|
582
|
+
|
|
583
|
+
<div
|
|
584
|
+
v-if="props.showMonthLabels"
|
|
585
|
+
data-slot="contribution-graph-months"
|
|
586
|
+
class="grid min-h-4 gap-[var(--contribution-graph-gap)] overflow-visible text-xs text-muted-foreground"
|
|
587
|
+
:style="graphStyle"
|
|
588
|
+
>
|
|
589
|
+
<span
|
|
590
|
+
v-for="month in monthLabels"
|
|
591
|
+
:key="month.key"
|
|
592
|
+
v-show="month.visible"
|
|
593
|
+
class="whitespace-nowrap leading-none"
|
|
594
|
+
:style="{
|
|
595
|
+
gridColumn: `${month.column} / span ${month.span}`,
|
|
596
|
+
justifySelf: month.align,
|
|
597
|
+
}"
|
|
598
|
+
>
|
|
599
|
+
{{ month.label }}
|
|
600
|
+
</span>
|
|
601
|
+
</div>
|
|
602
|
+
|
|
603
|
+
<div
|
|
604
|
+
v-if="props.showWeekdayLabels"
|
|
605
|
+
data-slot="contribution-graph-weekdays"
|
|
606
|
+
class="grid grid-rows-7 gap-1 py-px text-right text-xs leading-none text-muted-foreground"
|
|
607
|
+
>
|
|
608
|
+
<span
|
|
609
|
+
v-for="weekday in weekdayLabels"
|
|
610
|
+
:key="weekday.key"
|
|
611
|
+
class="flex h-[var(--contribution-graph-cell-size)] items-center justify-end"
|
|
612
|
+
>
|
|
613
|
+
{{ weekday.label }}
|
|
614
|
+
</span>
|
|
615
|
+
</div>
|
|
616
|
+
|
|
617
|
+
<div
|
|
618
|
+
data-slot="contribution-graph-grid"
|
|
619
|
+
:class="
|
|
620
|
+
cn(
|
|
621
|
+
'grid gap-[var(--contribution-graph-gap)]',
|
|
622
|
+
props.fitWidth ? 'w-full min-w-0' : 'min-w-max',
|
|
623
|
+
)
|
|
624
|
+
"
|
|
625
|
+
role="grid"
|
|
626
|
+
:aria-label="props.title ?? 'Contribution graph'"
|
|
627
|
+
:style="graphStyle"
|
|
628
|
+
>
|
|
629
|
+
<div
|
|
630
|
+
v-for="(week, weekIndex) in calendarWeeks"
|
|
631
|
+
:key="weekIndex"
|
|
632
|
+
data-slot="contribution-graph-week"
|
|
633
|
+
class="grid min-w-0 grid-rows-7 gap-[var(--contribution-graph-gap)]"
|
|
634
|
+
role="row"
|
|
635
|
+
>
|
|
636
|
+
<template
|
|
637
|
+
v-for="contributionDay in week"
|
|
638
|
+
:key="contributionDay.date"
|
|
639
|
+
>
|
|
640
|
+
<Tooltip>
|
|
641
|
+
<TooltipTrigger as-child>
|
|
642
|
+
<button
|
|
643
|
+
data-slot="contribution-graph-cell"
|
|
644
|
+
type="button"
|
|
645
|
+
role="gridcell"
|
|
646
|
+
:aria-label="contributionDay.label"
|
|
647
|
+
:aria-selected="props.modelValue === contributionDay.date"
|
|
648
|
+
:data-level="contributionDay.level"
|
|
649
|
+
:data-outside="contributionDay.outside ? '' : undefined"
|
|
650
|
+
:disabled="contributionDay.outside"
|
|
651
|
+
:style="{ gridRow: contributionDay.row }"
|
|
652
|
+
:class="
|
|
653
|
+
cn(
|
|
654
|
+
'border border-border/60 bg-[var(--contribution-graph-level-0)] outline-none transition-[background-color,border-color,box-shadow,opacity,transform] hover:border-foreground/30 hover:ring-2 hover:ring-ring/30 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none data-[outside]:opacity-30 data-[level=1]:bg-[var(--contribution-graph-level-1)] data-[level=2]:bg-[var(--contribution-graph-level-2)] data-[level=3]:bg-[var(--contribution-graph-level-3)] data-[level=4]:bg-[var(--contribution-graph-level-4)] aria-selected:border-foreground aria-selected:ring-2 aria-selected:ring-ring/40',
|
|
655
|
+
props.fitWidth
|
|
656
|
+
? 'aspect-square w-full min-w-0 rounded-[2px]'
|
|
657
|
+
: 'size-[var(--contribution-graph-cell-size)] rounded-[3px]',
|
|
658
|
+
contributionDay.count > 0 && 'hover:-translate-y-px',
|
|
659
|
+
)
|
|
660
|
+
"
|
|
661
|
+
@click="handleSelect(contributionDay)"
|
|
662
|
+
/>
|
|
663
|
+
</TooltipTrigger>
|
|
664
|
+
<TooltipContent>
|
|
665
|
+
{{ contributionDay.label }}
|
|
666
|
+
</TooltipContent>
|
|
667
|
+
</Tooltip>
|
|
668
|
+
</template>
|
|
669
|
+
</div>
|
|
670
|
+
</div>
|
|
671
|
+
</div>
|
|
672
|
+
</div>
|
|
673
|
+
</TooltipProvider>
|
|
674
|
+
|
|
675
|
+
<div
|
|
676
|
+
v-if="props.showLegend"
|
|
677
|
+
data-slot="contribution-graph-legend"
|
|
678
|
+
class="flex flex-wrap items-center justify-end gap-2 text-xs text-muted-foreground"
|
|
679
|
+
:aria-label="props.legendLabel"
|
|
680
|
+
>
|
|
681
|
+
<span>{{ props.lessLabel }}</span>
|
|
682
|
+
<span
|
|
683
|
+
v-for="level in [0, 1, 2, 3, 4]"
|
|
684
|
+
:key="level"
|
|
685
|
+
data-slot="contribution-graph-legend-cell"
|
|
686
|
+
:data-level="level"
|
|
687
|
+
class="size-[var(--contribution-graph-cell-size)] rounded-[3px] border border-border/60 bg-[var(--contribution-graph-level-0)] data-[level=1]:bg-[var(--contribution-graph-level-1)] data-[level=2]:bg-[var(--contribution-graph-level-2)] data-[level=3]:bg-[var(--contribution-graph-level-3)] data-[level=4]:bg-[var(--contribution-graph-level-4)]"
|
|
688
|
+
/>
|
|
689
|
+
<span>{{ props.moreLabel }}</span>
|
|
690
|
+
</div>
|
|
691
|
+
</div>
|
|
692
|
+
|
|
693
|
+
<nav
|
|
694
|
+
v-if="hasYearSelector"
|
|
695
|
+
data-slot="contribution-graph-years"
|
|
696
|
+
class="order-first flex min-w-0 gap-1 overflow-x-auto pb-1 md:order-none md:flex-col md:overflow-visible md:pb-0"
|
|
697
|
+
:aria-label="props.yearSelectorLabel"
|
|
698
|
+
>
|
|
699
|
+
<button
|
|
700
|
+
v-for="year in availableYears"
|
|
701
|
+
:key="year"
|
|
702
|
+
data-slot="contribution-graph-year"
|
|
703
|
+
type="button"
|
|
704
|
+
:aria-current="year === selectedYear ? 'date' : undefined"
|
|
705
|
+
:aria-pressed="year === selectedYear"
|
|
706
|
+
:data-state="year === selectedYear ? 'active' : 'inactive'"
|
|
707
|
+
:class="
|
|
708
|
+
cn(
|
|
709
|
+
'inline-flex h-8 shrink-0 items-center justify-center rounded-md px-3 text-sm font-medium outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground md:w-full',
|
|
710
|
+
)
|
|
711
|
+
"
|
|
712
|
+
@click="handleYearSelect(year)"
|
|
713
|
+
>
|
|
714
|
+
{{ year }}
|
|
715
|
+
</button>
|
|
716
|
+
</nav>
|
|
717
|
+
</div>
|
|
718
|
+
</div>
|
|
719
|
+
</template>
|