@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,725 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from "vue"
|
|
3
|
+
import type { CSSProperties, HTMLAttributes } from "vue"
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
export type GaugeType = "gauge" | "meter"
|
|
7
|
+
export type GaugeSize = "sm" | "default" | "lg"
|
|
8
|
+
export type GaugeValue = number | string | null | undefined
|
|
9
|
+
|
|
10
|
+
export interface GaugeSegment {
|
|
11
|
+
color?: string
|
|
12
|
+
label?: string
|
|
13
|
+
max?: number
|
|
14
|
+
min?: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface GaugeValueFormatterContext {
|
|
18
|
+
markerValue?: number | null
|
|
19
|
+
max: number
|
|
20
|
+
min: number
|
|
21
|
+
percent: number
|
|
22
|
+
type: GaugeType
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type GaugeValueFormatter = (
|
|
26
|
+
value: number,
|
|
27
|
+
context?: GaugeValueFormatterContext,
|
|
28
|
+
) => number | string
|
|
29
|
+
|
|
30
|
+
interface GaugeProps {
|
|
31
|
+
class?: HTMLAttributes["class"]
|
|
32
|
+
color?: string
|
|
33
|
+
description?: string
|
|
34
|
+
emptyLabel?: string
|
|
35
|
+
framed?: boolean
|
|
36
|
+
label?: string
|
|
37
|
+
markerColor?: string
|
|
38
|
+
markerLabel?: string
|
|
39
|
+
markerValue?: GaugeValue
|
|
40
|
+
max?: number
|
|
41
|
+
maxLabel?: string
|
|
42
|
+
min?: number
|
|
43
|
+
minLabel?: string
|
|
44
|
+
segments?: GaugeSegment[]
|
|
45
|
+
showLabels?: boolean
|
|
46
|
+
showMarker?: boolean
|
|
47
|
+
showNeedle?: boolean
|
|
48
|
+
showValue?: boolean
|
|
49
|
+
size?: GaugeSize
|
|
50
|
+
summary?: string
|
|
51
|
+
title?: string
|
|
52
|
+
trackColor?: string
|
|
53
|
+
type?: GaugeType
|
|
54
|
+
unit?: string
|
|
55
|
+
value?: GaugeValue
|
|
56
|
+
valueFormatter?: GaugeValueFormatter
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface NormalizedGaugeSegment {
|
|
60
|
+
color: string
|
|
61
|
+
label?: string
|
|
62
|
+
max: number
|
|
63
|
+
min: number
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface RadialPoint {
|
|
67
|
+
x: number
|
|
68
|
+
y: number
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const props = withDefaults(defineProps<GaugeProps>(), {
|
|
72
|
+
color: "oklch(0.3 0.11 255)",
|
|
73
|
+
emptyLabel: "No gauge value.",
|
|
74
|
+
framed: true,
|
|
75
|
+
markerColor: "oklch(0.58 0 0)",
|
|
76
|
+
max: 100,
|
|
77
|
+
min: 0,
|
|
78
|
+
showLabels: true,
|
|
79
|
+
showMarker: true,
|
|
80
|
+
showNeedle: false,
|
|
81
|
+
showValue: true,
|
|
82
|
+
size: "default",
|
|
83
|
+
trackColor: "oklch(0.88 0 0)",
|
|
84
|
+
type: "gauge",
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
const gaugeCenter = {
|
|
88
|
+
x: 130,
|
|
89
|
+
y: 128,
|
|
90
|
+
}
|
|
91
|
+
const gaugeRadius = 100
|
|
92
|
+
const radialViewBox = "0 0 286 162"
|
|
93
|
+
|
|
94
|
+
const numberFormatter = computed(() =>
|
|
95
|
+
new Intl.NumberFormat(undefined, {
|
|
96
|
+
maximumFractionDigits: 2,
|
|
97
|
+
}),
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
const sizeClasses = computed(() => {
|
|
101
|
+
if (props.size === "sm") {
|
|
102
|
+
return {
|
|
103
|
+
body: "gap-3 p-3",
|
|
104
|
+
description: "text-xs",
|
|
105
|
+
header: "gap-2 px-3 py-2.5",
|
|
106
|
+
labelClass: "text-[11px]",
|
|
107
|
+
markerFontSize: 11,
|
|
108
|
+
meter: "h-2",
|
|
109
|
+
radial: "max-w-[15rem]",
|
|
110
|
+
scaleFontSize: 12,
|
|
111
|
+
strokeWidth: 18,
|
|
112
|
+
summary: "text-xs",
|
|
113
|
+
title: "text-xs",
|
|
114
|
+
valueFontSize: 28,
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (props.size === "lg") {
|
|
119
|
+
return {
|
|
120
|
+
body: "gap-5 p-5",
|
|
121
|
+
description: "text-sm",
|
|
122
|
+
header: "gap-3 px-5 py-4",
|
|
123
|
+
labelClass: "text-sm",
|
|
124
|
+
markerFontSize: 13,
|
|
125
|
+
meter: "h-3",
|
|
126
|
+
radial: "max-w-[22rem]",
|
|
127
|
+
scaleFontSize: 13,
|
|
128
|
+
strokeWidth: 24,
|
|
129
|
+
summary: "text-sm",
|
|
130
|
+
title: "text-sm",
|
|
131
|
+
valueFontSize: 40,
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
body: "gap-4 p-4",
|
|
137
|
+
description: "text-sm",
|
|
138
|
+
header: "gap-2.5 px-4 py-3",
|
|
139
|
+
labelClass: "text-xs",
|
|
140
|
+
markerFontSize: 12,
|
|
141
|
+
meter: "h-2.5",
|
|
142
|
+
radial: "max-w-[18rem]",
|
|
143
|
+
scaleFontSize: 12,
|
|
144
|
+
strokeWidth: 22,
|
|
145
|
+
summary: "text-xs",
|
|
146
|
+
title: "text-[13px]",
|
|
147
|
+
valueFontSize: 34,
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
const rootClass = computed(() =>
|
|
152
|
+
cn(
|
|
153
|
+
"text-card-foreground",
|
|
154
|
+
props.framed
|
|
155
|
+
? "overflow-hidden rounded-lg border bg-card shadow-xs"
|
|
156
|
+
: "w-full",
|
|
157
|
+
props.class,
|
|
158
|
+
),
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
const hasHeader = computed(() =>
|
|
162
|
+
Boolean(props.title || props.description || props.summary),
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
const domain = computed(() => {
|
|
166
|
+
let min = normalizeBoundary(props.min, 0)
|
|
167
|
+
let max = normalizeBoundary(props.max, 100)
|
|
168
|
+
|
|
169
|
+
if (min > max) {
|
|
170
|
+
const nextMin = max
|
|
171
|
+
max = min
|
|
172
|
+
min = nextMin
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (min === max) {
|
|
176
|
+
max = min + 1
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
max,
|
|
181
|
+
min,
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
const numericValue = computed(() => toFiniteNumber(props.value))
|
|
186
|
+
const numericMarkerValue = computed(() => toFiniteNumber(props.markerValue))
|
|
187
|
+
|
|
188
|
+
const clampedValue = computed(() => {
|
|
189
|
+
const value = numericValue.value
|
|
190
|
+
const { max, min } = domain.value
|
|
191
|
+
|
|
192
|
+
if (value === null) return null
|
|
193
|
+
|
|
194
|
+
return Math.min(max, Math.max(min, value))
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
const clampedMarkerValue = computed(() => {
|
|
198
|
+
const value = numericMarkerValue.value
|
|
199
|
+
const { max, min } = domain.value
|
|
200
|
+
|
|
201
|
+
if (value === null) return null
|
|
202
|
+
|
|
203
|
+
return Math.min(max, Math.max(min, value))
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
const percent = computed(() => {
|
|
207
|
+
const value = clampedValue.value
|
|
208
|
+
|
|
209
|
+
if (value === null) return 0
|
|
210
|
+
|
|
211
|
+
return valueToPercent(value)
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
const markerPercent = computed(() => {
|
|
215
|
+
const value = clampedMarkerValue.value
|
|
216
|
+
|
|
217
|
+
if (value === null) return null
|
|
218
|
+
|
|
219
|
+
return valueToPercent(value)
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
const normalizedSegments = computed<NormalizedGaugeSegment[]>(() => {
|
|
223
|
+
const segments = props.segments ?? []
|
|
224
|
+
const { max, min } = domain.value
|
|
225
|
+
const colors = [
|
|
226
|
+
"oklch(0.63 0.16 150)",
|
|
227
|
+
"oklch(0.74 0.17 80)",
|
|
228
|
+
"oklch(0.62 0.2 28)",
|
|
229
|
+
]
|
|
230
|
+
|
|
231
|
+
return segments
|
|
232
|
+
.map((segment, index) => {
|
|
233
|
+
const rawMin = segment.min ?? (index === 0
|
|
234
|
+
? min
|
|
235
|
+
: segments[index - 1]?.max ?? min)
|
|
236
|
+
const rawMax = segment.max ?? max
|
|
237
|
+
const segmentMin = Math.min(max, Math.max(min, rawMin))
|
|
238
|
+
const segmentMax = Math.min(max, Math.max(min, rawMax))
|
|
239
|
+
const normalizedMin = Math.min(segmentMin, segmentMax)
|
|
240
|
+
const normalizedMax = Math.max(segmentMin, segmentMax)
|
|
241
|
+
|
|
242
|
+
return {
|
|
243
|
+
color: segment.color ?? colors[index % colors.length] ?? props.color,
|
|
244
|
+
label: segment.label,
|
|
245
|
+
max: normalizedMax,
|
|
246
|
+
min: normalizedMin,
|
|
247
|
+
}
|
|
248
|
+
})
|
|
249
|
+
.filter((segment) => segment.max > segment.min)
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
const activeColor = computed(() => {
|
|
253
|
+
const value = clampedValue.value
|
|
254
|
+
|
|
255
|
+
if (value !== null) {
|
|
256
|
+
const segment = normalizedSegments.value.find((item) =>
|
|
257
|
+
value >= item.min && value <= item.max,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
if (segment) return segment.color
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return props.color
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
const formattedValue = computed(() => {
|
|
267
|
+
const value = clampedValue.value
|
|
268
|
+
|
|
269
|
+
if (value === null) return ""
|
|
270
|
+
|
|
271
|
+
return formatGaugeValue(value)
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
const minLabel = computed(() =>
|
|
275
|
+
props.minLabel ?? formatGaugeValue(domain.value.min),
|
|
276
|
+
)
|
|
277
|
+
const maxLabel = computed(() =>
|
|
278
|
+
props.maxLabel ?? formatGaugeValue(domain.value.max),
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
const markerLabel = computed(() => {
|
|
282
|
+
const value = clampedMarkerValue.value
|
|
283
|
+
|
|
284
|
+
if (value === null) return ""
|
|
285
|
+
|
|
286
|
+
return props.markerLabel ?? formatGaugeValue(value)
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
const gaugeTrackPath = computed(() => buildArcPath(0, 1))
|
|
290
|
+
const gaugeValuePath = computed(() => buildArcPath(0, percent.value))
|
|
291
|
+
|
|
292
|
+
const radialMarker = computed(() => {
|
|
293
|
+
if (!props.showMarker || markerPercent.value === null) return null
|
|
294
|
+
|
|
295
|
+
const marker = markerPercent.value
|
|
296
|
+
const strokeOffset = sizeClasses.value.strokeWidth / 2
|
|
297
|
+
const inner = radialPoint(marker, gaugeRadius - strokeOffset - 5)
|
|
298
|
+
const outer = radialPoint(marker, gaugeRadius + strokeOffset + 9)
|
|
299
|
+
const label = radialPoint(marker, gaugeRadius + strokeOffset + 31)
|
|
300
|
+
const labelX = clampCoordinate(label.x, 20, 266)
|
|
301
|
+
const labelY = clampCoordinate(label.y, 16, 136)
|
|
302
|
+
|
|
303
|
+
return {
|
|
304
|
+
anchor: "middle",
|
|
305
|
+
labelX,
|
|
306
|
+
labelY,
|
|
307
|
+
x1: inner.x,
|
|
308
|
+
x2: outer.x,
|
|
309
|
+
y1: inner.y,
|
|
310
|
+
y2: outer.y,
|
|
311
|
+
}
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
const needle = computed(() => {
|
|
315
|
+
const point = radialPoint(percent.value, gaugeRadius - 30)
|
|
316
|
+
|
|
317
|
+
return {
|
|
318
|
+
x1: gaugeCenter.x,
|
|
319
|
+
x2: point.x,
|
|
320
|
+
y1: gaugeCenter.y,
|
|
321
|
+
y2: point.y,
|
|
322
|
+
}
|
|
323
|
+
})
|
|
324
|
+
|
|
325
|
+
const meterFillStyle = computed<CSSProperties>(() => ({
|
|
326
|
+
backgroundColor: activeColor.value,
|
|
327
|
+
width: `${roundPercent(percent.value)}%`,
|
|
328
|
+
}))
|
|
329
|
+
|
|
330
|
+
const meterTrackStyle = computed<CSSProperties>(() => ({
|
|
331
|
+
backgroundColor: props.trackColor,
|
|
332
|
+
}))
|
|
333
|
+
|
|
334
|
+
const meterMarkerStyle = computed<CSSProperties>(() => ({
|
|
335
|
+
backgroundColor: props.markerColor,
|
|
336
|
+
left: markerPercent.value === null ? "0%" : `${roundPercent(markerPercent.value)}%`,
|
|
337
|
+
}))
|
|
338
|
+
|
|
339
|
+
const valueTextStyle = computed<CSSProperties>(() => ({
|
|
340
|
+
fontSize: `${sizeClasses.value.valueFontSize}px`,
|
|
341
|
+
fontWeight: "400",
|
|
342
|
+
letterSpacing: "0",
|
|
343
|
+
}))
|
|
344
|
+
|
|
345
|
+
const labelTextStyle = computed<CSSProperties>(() => ({
|
|
346
|
+
fontSize: `${sizeClasses.value.scaleFontSize + 4}px`,
|
|
347
|
+
letterSpacing: "0",
|
|
348
|
+
}))
|
|
349
|
+
|
|
350
|
+
const scaleTextStyle = computed<CSSProperties>(() => ({
|
|
351
|
+
fontSize: `${sizeClasses.value.scaleFontSize}px`,
|
|
352
|
+
letterSpacing: "0",
|
|
353
|
+
}))
|
|
354
|
+
|
|
355
|
+
const scaleLabelPosition = computed(() => ({
|
|
356
|
+
maxX: roundCoordinate(radialPoint(1, gaugeRadius).x),
|
|
357
|
+
minX: roundCoordinate(radialPoint(0, gaugeRadius).x),
|
|
358
|
+
y: 150,
|
|
359
|
+
}))
|
|
360
|
+
|
|
361
|
+
const markerTextStyle = computed<CSSProperties>(() => ({
|
|
362
|
+
fontSize: `${sizeClasses.value.markerFontSize}px`,
|
|
363
|
+
fontWeight: "600",
|
|
364
|
+
letterSpacing: "0",
|
|
365
|
+
}))
|
|
366
|
+
|
|
367
|
+
const ariaValueText = computed(() =>
|
|
368
|
+
formattedValue.value || props.emptyLabel,
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
function normalizeBoundary(value: number | undefined, fallback: number) {
|
|
372
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function toFiniteNumber(value: unknown) {
|
|
376
|
+
if (typeof value === "number") {
|
|
377
|
+
return Number.isFinite(value) ? value : null
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
381
|
+
const parsed = Number(value)
|
|
382
|
+
|
|
383
|
+
return Number.isFinite(parsed) ? parsed : null
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
return null
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
function valueToPercent(value: number) {
|
|
390
|
+
const { max, min } = domain.value
|
|
391
|
+
|
|
392
|
+
return Math.min(1, Math.max(0, (value - min) / (max - min)))
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function formatGaugeValue(value: number) {
|
|
396
|
+
const valuePercent = valueToPercent(value)
|
|
397
|
+
const formatted = props.valueFormatter?.(value, {
|
|
398
|
+
markerValue: clampedMarkerValue.value,
|
|
399
|
+
max: domain.value.max,
|
|
400
|
+
min: domain.value.min,
|
|
401
|
+
percent: valuePercent,
|
|
402
|
+
type: props.type,
|
|
403
|
+
})
|
|
404
|
+
|
|
405
|
+
return formatted === undefined
|
|
406
|
+
? `${numberFormatter.value.format(value)}${props.unit ?? ""}`
|
|
407
|
+
: String(formatted)
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function buildArcPath(startPercent: number, endPercent: number) {
|
|
411
|
+
const start = Math.min(1, Math.max(0, startPercent))
|
|
412
|
+
const end = Math.min(1, Math.max(0, endPercent))
|
|
413
|
+
|
|
414
|
+
if (end <= start) return ""
|
|
415
|
+
|
|
416
|
+
const startPoint = radialPoint(start, gaugeRadius)
|
|
417
|
+
const endPoint = radialPoint(end, gaugeRadius)
|
|
418
|
+
|
|
419
|
+
return [
|
|
420
|
+
`M ${roundCoordinate(startPoint.x)} ${roundCoordinate(startPoint.y)}`,
|
|
421
|
+
`A ${gaugeRadius} ${gaugeRadius} 0 0 1 ${roundCoordinate(endPoint.x)} ${roundCoordinate(endPoint.y)}`,
|
|
422
|
+
].join(" ")
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function radialPoint(pointPercent: number, radius: number): RadialPoint {
|
|
426
|
+
const angle = Math.PI - (Math.PI * pointPercent)
|
|
427
|
+
|
|
428
|
+
return {
|
|
429
|
+
x: gaugeCenter.x + (Math.cos(angle) * radius),
|
|
430
|
+
y: gaugeCenter.y - (Math.sin(angle) * radius),
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function roundCoordinate(value: number) {
|
|
435
|
+
return Math.round(value * 100) / 100
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
function roundPercent(value: number) {
|
|
439
|
+
return Math.round(value * 10000) / 100
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function clampCoordinate(value: number, min: number, max: number) {
|
|
443
|
+
return Math.min(max, Math.max(min, value))
|
|
444
|
+
}
|
|
445
|
+
</script>
|
|
446
|
+
|
|
447
|
+
<template>
|
|
448
|
+
<article
|
|
449
|
+
data-slot="gauge"
|
|
450
|
+
:data-size="props.size"
|
|
451
|
+
:data-type="props.type"
|
|
452
|
+
:class="rootClass"
|
|
453
|
+
>
|
|
454
|
+
<header
|
|
455
|
+
v-if="hasHeader"
|
|
456
|
+
data-slot="gauge-header"
|
|
457
|
+
:class="cn('flex flex-wrap items-start justify-between border-b', sizeClasses.header)"
|
|
458
|
+
>
|
|
459
|
+
<div v-if="props.title || props.description" class="flex min-w-0 flex-col gap-1">
|
|
460
|
+
<h3
|
|
461
|
+
v-if="props.title"
|
|
462
|
+
data-slot="gauge-title"
|
|
463
|
+
:class="cn('truncate font-semibold leading-tight tracking-normal', sizeClasses.title)"
|
|
464
|
+
>
|
|
465
|
+
{{ props.title }}
|
|
466
|
+
</h3>
|
|
467
|
+
<p
|
|
468
|
+
v-if="props.description"
|
|
469
|
+
data-slot="gauge-description"
|
|
470
|
+
:class="cn('text-muted-foreground', sizeClasses.description)"
|
|
471
|
+
>
|
|
472
|
+
{{ props.description }}
|
|
473
|
+
</p>
|
|
474
|
+
</div>
|
|
475
|
+
|
|
476
|
+
<p
|
|
477
|
+
v-if="props.summary"
|
|
478
|
+
data-slot="gauge-summary"
|
|
479
|
+
:class="cn('shrink-0 font-medium text-muted-foreground', sizeClasses.summary)"
|
|
480
|
+
>
|
|
481
|
+
{{ props.summary }}
|
|
482
|
+
</p>
|
|
483
|
+
</header>
|
|
484
|
+
|
|
485
|
+
<div
|
|
486
|
+
data-slot="gauge-body"
|
|
487
|
+
:class="cn('flex min-w-0 flex-col', sizeClasses.body)"
|
|
488
|
+
>
|
|
489
|
+
<div
|
|
490
|
+
v-if="clampedValue !== null"
|
|
491
|
+
data-slot="gauge-visual"
|
|
492
|
+
class="min-w-0"
|
|
493
|
+
role="meter"
|
|
494
|
+
:aria-label="props.title ?? props.label ?? 'Gauge'"
|
|
495
|
+
:aria-valuemax="domain.max"
|
|
496
|
+
:aria-valuemin="domain.min"
|
|
497
|
+
:aria-valuenow="clampedValue"
|
|
498
|
+
:aria-valuetext="ariaValueText"
|
|
499
|
+
>
|
|
500
|
+
<div
|
|
501
|
+
v-if="props.type === 'gauge'"
|
|
502
|
+
data-slot="gauge-radial"
|
|
503
|
+
:class="cn('relative mx-auto w-full', sizeClasses.radial)"
|
|
504
|
+
>
|
|
505
|
+
<svg
|
|
506
|
+
data-slot="gauge-svg"
|
|
507
|
+
class="block h-auto w-full overflow-visible"
|
|
508
|
+
role="presentation"
|
|
509
|
+
:viewBox="radialViewBox"
|
|
510
|
+
>
|
|
511
|
+
<path
|
|
512
|
+
data-slot="gauge-track"
|
|
513
|
+
:d="gaugeTrackPath"
|
|
514
|
+
fill="none"
|
|
515
|
+
:stroke="props.trackColor"
|
|
516
|
+
stroke-linecap="round"
|
|
517
|
+
:stroke-width="sizeClasses.strokeWidth"
|
|
518
|
+
/>
|
|
519
|
+
|
|
520
|
+
<path
|
|
521
|
+
data-slot="gauge-value-arc"
|
|
522
|
+
:d="gaugeValuePath"
|
|
523
|
+
fill="none"
|
|
524
|
+
:stroke="activeColor"
|
|
525
|
+
stroke-linecap="round"
|
|
526
|
+
:stroke-width="sizeClasses.strokeWidth"
|
|
527
|
+
/>
|
|
528
|
+
|
|
529
|
+
<g
|
|
530
|
+
v-if="radialMarker"
|
|
531
|
+
data-slot="gauge-marker"
|
|
532
|
+
class="text-muted-foreground"
|
|
533
|
+
>
|
|
534
|
+
<line
|
|
535
|
+
data-slot="gauge-marker-line"
|
|
536
|
+
:x1="radialMarker.x1"
|
|
537
|
+
:x2="radialMarker.x2"
|
|
538
|
+
:y1="radialMarker.y1"
|
|
539
|
+
:y2="radialMarker.y2"
|
|
540
|
+
:stroke="props.markerColor"
|
|
541
|
+
stroke-linecap="square"
|
|
542
|
+
stroke-width="4"
|
|
543
|
+
/>
|
|
544
|
+
<text
|
|
545
|
+
v-if="markerLabel"
|
|
546
|
+
data-slot="gauge-marker-label"
|
|
547
|
+
class="fill-current"
|
|
548
|
+
dominant-baseline="middle"
|
|
549
|
+
:style="markerTextStyle"
|
|
550
|
+
:text-anchor="radialMarker.anchor"
|
|
551
|
+
:x="radialMarker.labelX"
|
|
552
|
+
:y="radialMarker.labelY"
|
|
553
|
+
>
|
|
554
|
+
{{ markerLabel }}
|
|
555
|
+
</text>
|
|
556
|
+
</g>
|
|
557
|
+
|
|
558
|
+
<g
|
|
559
|
+
v-if="props.showNeedle"
|
|
560
|
+
data-slot="gauge-needle"
|
|
561
|
+
>
|
|
562
|
+
<line
|
|
563
|
+
:x1="needle.x1"
|
|
564
|
+
:x2="needle.x2"
|
|
565
|
+
:y1="needle.y1"
|
|
566
|
+
:y2="needle.y2"
|
|
567
|
+
:stroke="activeColor"
|
|
568
|
+
stroke-linecap="round"
|
|
569
|
+
stroke-width="3"
|
|
570
|
+
/>
|
|
571
|
+
<circle
|
|
572
|
+
:cx="gaugeCenter.x"
|
|
573
|
+
:cy="gaugeCenter.y"
|
|
574
|
+
fill="var(--card)"
|
|
575
|
+
:stroke="activeColor"
|
|
576
|
+
stroke-width="3"
|
|
577
|
+
r="6"
|
|
578
|
+
/>
|
|
579
|
+
</g>
|
|
580
|
+
|
|
581
|
+
<text
|
|
582
|
+
v-if="props.showValue"
|
|
583
|
+
data-slot="gauge-value"
|
|
584
|
+
class="fill-current text-foreground"
|
|
585
|
+
dominant-baseline="middle"
|
|
586
|
+
text-anchor="middle"
|
|
587
|
+
:style="valueTextStyle"
|
|
588
|
+
:x="gaugeCenter.x"
|
|
589
|
+
y="90"
|
|
590
|
+
>
|
|
591
|
+
{{ formattedValue }}
|
|
592
|
+
</text>
|
|
593
|
+
<text
|
|
594
|
+
v-if="props.label"
|
|
595
|
+
data-slot="gauge-label"
|
|
596
|
+
class="fill-current text-muted-foreground"
|
|
597
|
+
dominant-baseline="middle"
|
|
598
|
+
text-anchor="middle"
|
|
599
|
+
:style="labelTextStyle"
|
|
600
|
+
:x="gaugeCenter.x"
|
|
601
|
+
y="118"
|
|
602
|
+
>
|
|
603
|
+
{{ props.label }}
|
|
604
|
+
</text>
|
|
605
|
+
|
|
606
|
+
<g
|
|
607
|
+
v-if="props.showLabels"
|
|
608
|
+
data-slot="gauge-scale"
|
|
609
|
+
class="fill-current text-muted-foreground"
|
|
610
|
+
:style="scaleTextStyle"
|
|
611
|
+
>
|
|
612
|
+
<text
|
|
613
|
+
data-slot="gauge-min-label"
|
|
614
|
+
dominant-baseline="middle"
|
|
615
|
+
text-anchor="middle"
|
|
616
|
+
:x="scaleLabelPosition.minX"
|
|
617
|
+
:y="scaleLabelPosition.y"
|
|
618
|
+
>
|
|
619
|
+
{{ minLabel }}
|
|
620
|
+
</text>
|
|
621
|
+
<text
|
|
622
|
+
data-slot="gauge-max-label"
|
|
623
|
+
dominant-baseline="middle"
|
|
624
|
+
text-anchor="middle"
|
|
625
|
+
:x="scaleLabelPosition.maxX"
|
|
626
|
+
:y="scaleLabelPosition.y"
|
|
627
|
+
>
|
|
628
|
+
{{ maxLabel }}
|
|
629
|
+
</text>
|
|
630
|
+
</g>
|
|
631
|
+
</svg>
|
|
632
|
+
</div>
|
|
633
|
+
|
|
634
|
+
<div
|
|
635
|
+
v-else
|
|
636
|
+
data-slot="gauge-meter"
|
|
637
|
+
class="flex min-w-0 flex-col gap-3"
|
|
638
|
+
>
|
|
639
|
+
<div class="flex min-w-0 items-end justify-between gap-4">
|
|
640
|
+
<div class="min-w-0">
|
|
641
|
+
<p
|
|
642
|
+
v-if="props.label"
|
|
643
|
+
data-slot="gauge-label"
|
|
644
|
+
:class="cn('truncate leading-none text-muted-foreground', sizeClasses.labelClass)"
|
|
645
|
+
>
|
|
646
|
+
{{ props.label }}
|
|
647
|
+
</p>
|
|
648
|
+
<p
|
|
649
|
+
v-if="props.showValue"
|
|
650
|
+
data-slot="gauge-value"
|
|
651
|
+
class="mt-1 font-semibold leading-none tracking-normal text-foreground"
|
|
652
|
+
>
|
|
653
|
+
{{ formattedValue }}
|
|
654
|
+
</p>
|
|
655
|
+
</div>
|
|
656
|
+
<p
|
|
657
|
+
data-slot="gauge-percent"
|
|
658
|
+
class="shrink-0 text-xs font-medium text-muted-foreground"
|
|
659
|
+
>
|
|
660
|
+
{{ Math.round(percent * 100) }}%
|
|
661
|
+
</p>
|
|
662
|
+
</div>
|
|
663
|
+
|
|
664
|
+
<div
|
|
665
|
+
data-slot="gauge-meter-track"
|
|
666
|
+
:class="cn('relative rounded-full', sizeClasses.meter)"
|
|
667
|
+
:style="meterTrackStyle"
|
|
668
|
+
>
|
|
669
|
+
<div
|
|
670
|
+
data-slot="gauge-meter-fill"
|
|
671
|
+
class="h-full rounded-full transition-[width]"
|
|
672
|
+
:style="meterFillStyle"
|
|
673
|
+
/>
|
|
674
|
+
<span
|
|
675
|
+
v-if="props.showMarker && markerPercent !== null"
|
|
676
|
+
data-slot="gauge-meter-marker"
|
|
677
|
+
class="absolute top-1/2 h-[calc(100%_+_0.5rem)] w-1 -translate-x-1/2 -translate-y-1/2 rounded-full"
|
|
678
|
+
:style="meterMarkerStyle"
|
|
679
|
+
/>
|
|
680
|
+
</div>
|
|
681
|
+
|
|
682
|
+
<div
|
|
683
|
+
v-if="props.showLabels"
|
|
684
|
+
data-slot="gauge-scale"
|
|
685
|
+
:class="cn('flex items-center justify-between text-muted-foreground', sizeClasses.labelClass)"
|
|
686
|
+
>
|
|
687
|
+
<span>{{ minLabel }}</span>
|
|
688
|
+
<span v-if="markerLabel">{{ markerLabel }}</span>
|
|
689
|
+
<span>{{ maxLabel }}</span>
|
|
690
|
+
</div>
|
|
691
|
+
</div>
|
|
692
|
+
</div>
|
|
693
|
+
|
|
694
|
+
<p
|
|
695
|
+
v-else
|
|
696
|
+
data-slot="gauge-empty"
|
|
697
|
+
:class="cn('text-muted-foreground', sizeClasses.labelClass)"
|
|
698
|
+
>
|
|
699
|
+
{{ props.emptyLabel }}
|
|
700
|
+
</p>
|
|
701
|
+
|
|
702
|
+
<div
|
|
703
|
+
v-if="normalizedSegments.length"
|
|
704
|
+
data-slot="gauge-legend"
|
|
705
|
+
:class="cn('flex flex-wrap items-center justify-end gap-2 text-muted-foreground', sizeClasses.labelClass)"
|
|
706
|
+
>
|
|
707
|
+
<span
|
|
708
|
+
v-for="segment in normalizedSegments"
|
|
709
|
+
:key="`legend-${segment.min}-${segment.max}`"
|
|
710
|
+
data-slot="gauge-legend-item"
|
|
711
|
+
class="inline-flex min-w-0 items-center gap-1.5"
|
|
712
|
+
>
|
|
713
|
+
<span
|
|
714
|
+
data-slot="gauge-legend-swatch"
|
|
715
|
+
class="size-2 shrink-0 rounded-full"
|
|
716
|
+
:style="{ backgroundColor: segment.color }"
|
|
717
|
+
/>
|
|
718
|
+
<span class="truncate">
|
|
719
|
+
{{ segment.label ?? `${numberFormatter.format(segment.min)}-${numberFormatter.format(segment.max)}` }}
|
|
720
|
+
</span>
|
|
721
|
+
</span>
|
|
722
|
+
</div>
|
|
723
|
+
</div>
|
|
724
|
+
</article>
|
|
725
|
+
</template>
|