@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,902 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, onBeforeUnmount, ref, watch } from "vue"
|
|
3
|
+
import type { HTMLAttributes } from "vue"
|
|
4
|
+
import {
|
|
5
|
+
forceCenter,
|
|
6
|
+
forceCollide,
|
|
7
|
+
forceLink,
|
|
8
|
+
forceManyBody,
|
|
9
|
+
forceSimulation,
|
|
10
|
+
forceX,
|
|
11
|
+
forceY,
|
|
12
|
+
type Simulation,
|
|
13
|
+
type SimulationLinkDatum,
|
|
14
|
+
type SimulationNodeDatum,
|
|
15
|
+
} from "d3-force"
|
|
16
|
+
import {
|
|
17
|
+
FocusIcon,
|
|
18
|
+
MinusIcon,
|
|
19
|
+
PlusIcon,
|
|
20
|
+
} from "@lucide/vue"
|
|
21
|
+
import { cn } from "@/lib/utils"
|
|
22
|
+
|
|
23
|
+
export type NetworkGraphSize = "sm" | "default" | "lg"
|
|
24
|
+
|
|
25
|
+
export interface NetworkGraphNode {
|
|
26
|
+
color?: string
|
|
27
|
+
fixed?: boolean
|
|
28
|
+
group?: string
|
|
29
|
+
id: string
|
|
30
|
+
label?: string
|
|
31
|
+
metadata?: Record<string, unknown>
|
|
32
|
+
size?: number
|
|
33
|
+
value?: number
|
|
34
|
+
x?: number
|
|
35
|
+
y?: number
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface NetworkGraphLink {
|
|
39
|
+
color?: string
|
|
40
|
+
id?: string
|
|
41
|
+
label?: string
|
|
42
|
+
source: string
|
|
43
|
+
target: string
|
|
44
|
+
value?: number
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface NetworkGraphSelectPayload {
|
|
48
|
+
connectedNodeIds: string[]
|
|
49
|
+
index: number
|
|
50
|
+
links: NetworkGraphLink[]
|
|
51
|
+
node: NetworkGraphNode
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface NetworkGraphProps {
|
|
55
|
+
chargeStrength?: number
|
|
56
|
+
class?: HTMLAttributes["class"]
|
|
57
|
+
collisionPadding?: number
|
|
58
|
+
description?: string
|
|
59
|
+
draggable?: boolean
|
|
60
|
+
emptyLabel?: string
|
|
61
|
+
height?: number
|
|
62
|
+
linkDistance?: number
|
|
63
|
+
links?: NetworkGraphLink[]
|
|
64
|
+
maxZoom?: number
|
|
65
|
+
minZoom?: number
|
|
66
|
+
modelValue?: string
|
|
67
|
+
nodes?: NetworkGraphNode[]
|
|
68
|
+
pannable?: boolean
|
|
69
|
+
selectable?: boolean
|
|
70
|
+
showControls?: boolean
|
|
71
|
+
showLabels?: boolean
|
|
72
|
+
size?: NetworkGraphSize
|
|
73
|
+
summary?: string
|
|
74
|
+
title?: string
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface GraphNodeDatum extends SimulationNodeDatum {
|
|
78
|
+
color: string
|
|
79
|
+
group?: string
|
|
80
|
+
id: string
|
|
81
|
+
index: number
|
|
82
|
+
label: string
|
|
83
|
+
original: NetworkGraphNode
|
|
84
|
+
radius: number
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface GraphLinkDatum extends SimulationLinkDatum<GraphNodeDatum> {
|
|
88
|
+
color?: string
|
|
89
|
+
id: string
|
|
90
|
+
label?: string
|
|
91
|
+
original: NetworkGraphLink
|
|
92
|
+
source: string | GraphNodeDatum
|
|
93
|
+
sourceId: string
|
|
94
|
+
target: string | GraphNodeDatum
|
|
95
|
+
targetId: string
|
|
96
|
+
value: number
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const props = withDefaults(defineProps<NetworkGraphProps>(), {
|
|
100
|
+
chargeStrength: -260,
|
|
101
|
+
collisionPadding: 6,
|
|
102
|
+
draggable: true,
|
|
103
|
+
emptyLabel: "No network data.",
|
|
104
|
+
linkDistance: 96,
|
|
105
|
+
maxZoom: 2.5,
|
|
106
|
+
minZoom: 0.45,
|
|
107
|
+
nodes: () => [],
|
|
108
|
+
links: () => [],
|
|
109
|
+
pannable: true,
|
|
110
|
+
selectable: true,
|
|
111
|
+
showControls: true,
|
|
112
|
+
showLabels: true,
|
|
113
|
+
size: "default",
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const emit = defineEmits<{
|
|
117
|
+
"select": [payload: NetworkGraphSelectPayload]
|
|
118
|
+
"update:modelValue": [value: string]
|
|
119
|
+
}>()
|
|
120
|
+
|
|
121
|
+
const DEFAULT_GRAPH_WIDTH = 900
|
|
122
|
+
const MIN_GRAPH_WIDTH = 320
|
|
123
|
+
const graphRef = ref<SVGSVGElement | null>(null)
|
|
124
|
+
const graphWidth = ref(DEFAULT_GRAPH_WIDTH)
|
|
125
|
+
const graphNodes = ref<GraphNodeDatum[]>([])
|
|
126
|
+
const graphLinks = ref<GraphLinkDatum[]>([])
|
|
127
|
+
const internalSelectedId = ref<string | undefined>()
|
|
128
|
+
const renderTick = ref(0)
|
|
129
|
+
const transform = ref({
|
|
130
|
+
k: 1,
|
|
131
|
+
x: 0,
|
|
132
|
+
y: 0,
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
let simulation: Simulation<GraphNodeDatum, GraphLinkDatum> | undefined
|
|
136
|
+
let resizeObserver: ResizeObserver | undefined
|
|
137
|
+
let pointerMode: "node" | "pan" | undefined
|
|
138
|
+
let activeNode: GraphNodeDatum | undefined
|
|
139
|
+
let panStart:
|
|
140
|
+
| {
|
|
141
|
+
clientX: number
|
|
142
|
+
clientY: number
|
|
143
|
+
x: number
|
|
144
|
+
y: number
|
|
145
|
+
}
|
|
146
|
+
| undefined
|
|
147
|
+
|
|
148
|
+
const defaultNodeColors = [
|
|
149
|
+
"oklch(0.58 0.19 248)",
|
|
150
|
+
"oklch(0.6 0.16 153)",
|
|
151
|
+
"oklch(0.67 0.18 69)",
|
|
152
|
+
"oklch(0.59 0.21 338)",
|
|
153
|
+
"oklch(0.62 0.18 204)",
|
|
154
|
+
"oklch(0.58 0.2 27)",
|
|
155
|
+
]
|
|
156
|
+
|
|
157
|
+
const sizeClasses = computed(() => {
|
|
158
|
+
if (props.size === "sm") {
|
|
159
|
+
return {
|
|
160
|
+
body: "p-3",
|
|
161
|
+
control: "size-7",
|
|
162
|
+
description: "text-xs",
|
|
163
|
+
empty: "min-h-56",
|
|
164
|
+
header: "gap-2 px-3 py-2.5",
|
|
165
|
+
height: 260,
|
|
166
|
+
label: "text-[10px]",
|
|
167
|
+
meta: "text-[11px]",
|
|
168
|
+
title: "text-xs",
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (props.size === "lg") {
|
|
173
|
+
return {
|
|
174
|
+
body: "p-5",
|
|
175
|
+
control: "size-8",
|
|
176
|
+
description: "text-sm",
|
|
177
|
+
empty: "min-h-[28rem]",
|
|
178
|
+
header: "gap-3 px-5 py-4",
|
|
179
|
+
height: 520,
|
|
180
|
+
label: "text-xs",
|
|
181
|
+
meta: "text-xs",
|
|
182
|
+
title: "text-sm",
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
body: "p-4",
|
|
188
|
+
control: "size-8",
|
|
189
|
+
description: "text-sm",
|
|
190
|
+
empty: "min-h-80",
|
|
191
|
+
header: "gap-2.5 px-4 py-3",
|
|
192
|
+
height: 400,
|
|
193
|
+
label: "text-[11px]",
|
|
194
|
+
meta: "text-xs",
|
|
195
|
+
title: "text-[13px]",
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
const graphHeight = computed(() =>
|
|
200
|
+
Math.max(220, Math.trunc(props.height ?? sizeClasses.value.height)),
|
|
201
|
+
)
|
|
202
|
+
const hasHeader = computed(() =>
|
|
203
|
+
Boolean(props.title || props.description || props.summary),
|
|
204
|
+
)
|
|
205
|
+
const hasRenderableData = computed(() =>
|
|
206
|
+
graphNodes.value.length > 0,
|
|
207
|
+
)
|
|
208
|
+
const selectedId = computed(() =>
|
|
209
|
+
props.modelValue ?? internalSelectedId.value,
|
|
210
|
+
)
|
|
211
|
+
const graphTransform = computed(() =>
|
|
212
|
+
`translate(${transform.value.x} ${transform.value.y}) scale(${transform.value.k})`,
|
|
213
|
+
)
|
|
214
|
+
const nodeById = computed(() => {
|
|
215
|
+
const map = new Map<string, GraphNodeDatum>()
|
|
216
|
+
|
|
217
|
+
for (const node of graphNodes.value) {
|
|
218
|
+
map.set(node.id, node)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return map
|
|
222
|
+
})
|
|
223
|
+
const connectedNodeIds = computed(() => {
|
|
224
|
+
const selected = selectedId.value
|
|
225
|
+
const ids = new Set<string>()
|
|
226
|
+
|
|
227
|
+
if (!selected) return ids
|
|
228
|
+
|
|
229
|
+
ids.add(selected)
|
|
230
|
+
|
|
231
|
+
for (const link of graphLinks.value) {
|
|
232
|
+
if (link.sourceId === selected) ids.add(link.targetId)
|
|
233
|
+
if (link.targetId === selected) ids.add(link.sourceId)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return ids
|
|
237
|
+
})
|
|
238
|
+
const selectedNode = computed(() =>
|
|
239
|
+
selectedId.value ? nodeById.value.get(selectedId.value) : undefined,
|
|
240
|
+
)
|
|
241
|
+
const selectedNodeLinks = computed(() =>
|
|
242
|
+
selectedId.value
|
|
243
|
+
? graphLinks.value.filter((link) => link.sourceId === selectedId.value || link.targetId === selectedId.value)
|
|
244
|
+
: [],
|
|
245
|
+
)
|
|
246
|
+
const formattedZoom = computed(() =>
|
|
247
|
+
`${Math.round(transform.value.k * 100)}%`,
|
|
248
|
+
)
|
|
249
|
+
const graphStats = computed(() => {
|
|
250
|
+
const nodes = graphNodes.value.length
|
|
251
|
+
const links = graphLinks.value.length
|
|
252
|
+
|
|
253
|
+
return `${nodes} nodes · ${links} links`
|
|
254
|
+
})
|
|
255
|
+
const selectedSummaryText = computed(() => {
|
|
256
|
+
if (!selectedNode.value) return graphStats.value
|
|
257
|
+
|
|
258
|
+
const connectedCount = Math.max(0, connectedNodeIds.value.size - 1)
|
|
259
|
+
const linkCount = selectedNodeLinks.value.length
|
|
260
|
+
|
|
261
|
+
return `${connectedCount} connected · ${linkCount} links`
|
|
262
|
+
})
|
|
263
|
+
watch(
|
|
264
|
+
() => [
|
|
265
|
+
props.nodes,
|
|
266
|
+
props.links,
|
|
267
|
+
props.chargeStrength,
|
|
268
|
+
props.collisionPadding,
|
|
269
|
+
props.height,
|
|
270
|
+
props.linkDistance,
|
|
271
|
+
props.size,
|
|
272
|
+
graphWidth.value,
|
|
273
|
+
],
|
|
274
|
+
() => rebuildGraph(),
|
|
275
|
+
{
|
|
276
|
+
deep: true,
|
|
277
|
+
immediate: true,
|
|
278
|
+
},
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
watch(
|
|
282
|
+
graphRef,
|
|
283
|
+
(svgElement) => {
|
|
284
|
+
resizeObserver?.disconnect()
|
|
285
|
+
resizeObserver = undefined
|
|
286
|
+
|
|
287
|
+
if (!svgElement) return
|
|
288
|
+
|
|
289
|
+
const updateGraphWidth = () => {
|
|
290
|
+
const rect = svgElement.getBoundingClientRect()
|
|
291
|
+
const nextWidth = Math.trunc(clamp(rect.width || DEFAULT_GRAPH_WIDTH, MIN_GRAPH_WIDTH, DEFAULT_GRAPH_WIDTH))
|
|
292
|
+
|
|
293
|
+
if (graphWidth.value !== nextWidth) {
|
|
294
|
+
graphWidth.value = nextWidth
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
updateGraphWidth()
|
|
299
|
+
|
|
300
|
+
if (typeof ResizeObserver === "undefined") return
|
|
301
|
+
|
|
302
|
+
resizeObserver = new ResizeObserver(updateGraphWidth)
|
|
303
|
+
resizeObserver.observe(svgElement)
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
flush: "post",
|
|
307
|
+
},
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
onBeforeUnmount(() => {
|
|
311
|
+
simulation?.stop()
|
|
312
|
+
resizeObserver?.disconnect()
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
function rebuildGraph() {
|
|
316
|
+
simulation?.stop()
|
|
317
|
+
|
|
318
|
+
const nodes = createGraphNodes()
|
|
319
|
+
const nodeIds = new Set(nodes.map((node) => node.id))
|
|
320
|
+
const links = createGraphLinks(nodeIds)
|
|
321
|
+
|
|
322
|
+
graphNodes.value = nodes
|
|
323
|
+
graphLinks.value = links
|
|
324
|
+
|
|
325
|
+
if (nodes.length === 0) return
|
|
326
|
+
|
|
327
|
+
simulation = forceSimulation<GraphNodeDatum>(nodes)
|
|
328
|
+
.force(
|
|
329
|
+
"link",
|
|
330
|
+
forceLink<GraphNodeDatum, GraphLinkDatum>(links)
|
|
331
|
+
.id((node) => node.id)
|
|
332
|
+
.distance(props.linkDistance)
|
|
333
|
+
.strength(0.45),
|
|
334
|
+
)
|
|
335
|
+
.force("charge", forceManyBody<GraphNodeDatum>().strength(props.chargeStrength))
|
|
336
|
+
.force("center", forceCenter(graphWidth.value / 2, graphHeight.value / 2))
|
|
337
|
+
.force("x", forceX<GraphNodeDatum>(graphWidth.value / 2).strength(0.045))
|
|
338
|
+
.force("y", forceY<GraphNodeDatum>(graphHeight.value / 2).strength(0.045))
|
|
339
|
+
.force(
|
|
340
|
+
"collide",
|
|
341
|
+
forceCollide<GraphNodeDatum>()
|
|
342
|
+
.radius((node) => node.radius + props.collisionPadding + (props.showLabels ? 18 : 0))
|
|
343
|
+
.strength(0.88),
|
|
344
|
+
)
|
|
345
|
+
.on("tick", () => {
|
|
346
|
+
constrainNodePositions()
|
|
347
|
+
renderTick.value += 1
|
|
348
|
+
})
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function createGraphNodes() {
|
|
352
|
+
const count = Math.max(1, props.nodes.length)
|
|
353
|
+
const radius = Math.min(graphWidth.value, graphHeight.value) * 0.34
|
|
354
|
+
|
|
355
|
+
return props.nodes.map((node, index): GraphNodeDatum => {
|
|
356
|
+
const angle = (index / count) * Math.PI * 2
|
|
357
|
+
const x = getInitialNodeX(node, angle, radius)
|
|
358
|
+
const y = getInitialNodeY(node, angle, radius)
|
|
359
|
+
const graphNode: GraphNodeDatum = {
|
|
360
|
+
...node,
|
|
361
|
+
color: getNodeColor(node, index),
|
|
362
|
+
id: node.id,
|
|
363
|
+
index,
|
|
364
|
+
label: node.label ?? node.id,
|
|
365
|
+
original: node,
|
|
366
|
+
radius: getNodeRadius(node),
|
|
367
|
+
x,
|
|
368
|
+
y,
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
if (node.fixed) {
|
|
372
|
+
graphNode.fx = x
|
|
373
|
+
graphNode.fy = y
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return graphNode
|
|
377
|
+
})
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
function getInitialNodeX(node: NetworkGraphNode, angle: number, radius: number) {
|
|
381
|
+
const x = typeof node.x === "number"
|
|
382
|
+
? node.x * (graphWidth.value / DEFAULT_GRAPH_WIDTH)
|
|
383
|
+
: (graphWidth.value / 2) + Math.cos(angle) * radius
|
|
384
|
+
|
|
385
|
+
return clampNodeX(x, getNodeRadius(node))
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function getInitialNodeY(node: NetworkGraphNode, angle: number, radius: number) {
|
|
389
|
+
const y = typeof node.y === "number"
|
|
390
|
+
? node.y
|
|
391
|
+
: (graphHeight.value / 2) + Math.sin(angle) * radius
|
|
392
|
+
|
|
393
|
+
return clampNodeY(y, getNodeRadius(node))
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function createGraphLinks(nodeIds: Set<string>) {
|
|
397
|
+
return props.links
|
|
398
|
+
.filter((link) => nodeIds.has(link.source) && nodeIds.has(link.target))
|
|
399
|
+
.map((link, index): GraphLinkDatum => ({
|
|
400
|
+
...link,
|
|
401
|
+
id: link.id ?? `${link.source}-${link.target}-${index}`,
|
|
402
|
+
original: link,
|
|
403
|
+
source: link.source,
|
|
404
|
+
sourceId: link.source,
|
|
405
|
+
target: link.target,
|
|
406
|
+
targetId: link.target,
|
|
407
|
+
value: Math.max(1, link.value ?? 1),
|
|
408
|
+
}))
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function getNodeRadius(node: NetworkGraphNode) {
|
|
412
|
+
if (typeof node.size === "number" && Number.isFinite(node.size)) {
|
|
413
|
+
return clamp(node.size, 7, 28)
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
return clamp(8 + Math.sqrt(Math.max(0, node.value ?? 1)) * 2.5, 8, 24)
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function getNodeColor(node: NetworkGraphNode, index: number) {
|
|
420
|
+
if (node.color) return node.color
|
|
421
|
+
|
|
422
|
+
const colorIndex = node.group
|
|
423
|
+
? Math.abs(hashString(node.group)) % defaultNodeColors.length
|
|
424
|
+
: index % defaultNodeColors.length
|
|
425
|
+
|
|
426
|
+
return defaultNodeColors[colorIndex] ?? defaultNodeColors[0]
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function getLinkSource(link: GraphLinkDatum) {
|
|
430
|
+
return typeof link.source === "string" ? nodeById.value.get(link.source) : link.source
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function getLinkTarget(link: GraphLinkDatum) {
|
|
434
|
+
return typeof link.target === "string" ? nodeById.value.get(link.target) : link.target
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function isSelectedNode(node: GraphNodeDatum) {
|
|
438
|
+
return selectedId.value === node.id
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function isDimmedNode(node: GraphNodeDatum) {
|
|
442
|
+
return Boolean(selectedId.value && !connectedNodeIds.value.has(node.id))
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
function isDimmedLink(link: GraphLinkDatum) {
|
|
446
|
+
return Boolean(
|
|
447
|
+
selectedId.value &&
|
|
448
|
+
link.sourceId !== selectedId.value &&
|
|
449
|
+
link.targetId !== selectedId.value,
|
|
450
|
+
)
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
function linkStrokeWidth(link: GraphLinkDatum) {
|
|
454
|
+
const width = Math.min(4, 1 + Math.sqrt(link.value) * 0.35)
|
|
455
|
+
|
|
456
|
+
if (!selectedId.value || isDimmedLink(link)) return width
|
|
457
|
+
|
|
458
|
+
return Math.min(4.5, width + 0.35)
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
function linkStroke(link: GraphLinkDatum) {
|
|
462
|
+
if (!selectedId.value || isDimmedLink(link)) {
|
|
463
|
+
return link.color ?? "var(--border)"
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
return link.color ?? "var(--foreground)"
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function linkOpacity(link: GraphLinkDatum) {
|
|
470
|
+
if (!selectedId.value) return 0.22
|
|
471
|
+
|
|
472
|
+
return isDimmedLink(link) ? 0.1 : 0.78
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
function nodeOpacity(node: GraphNodeDatum) {
|
|
476
|
+
return isDimmedNode(node) ? 0.32 : 1
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
function nodeStroke() {
|
|
480
|
+
return "var(--background)"
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
function constrainNodePositions() {
|
|
484
|
+
for (const node of graphNodes.value) {
|
|
485
|
+
node.x = clampNodeX(node.x ?? graphWidth.value / 2, node.radius)
|
|
486
|
+
node.y = clampNodeY(node.y ?? graphHeight.value / 2, node.radius)
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
function clampNodeX(value: number, radius: number) {
|
|
491
|
+
const padding = radius + 28
|
|
492
|
+
const max = Math.max(padding, graphWidth.value - padding)
|
|
493
|
+
|
|
494
|
+
return clamp(value, padding, max)
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
function clampNodeY(value: number, radius: number) {
|
|
498
|
+
const padding = radius + 34
|
|
499
|
+
const max = Math.max(padding, graphHeight.value - padding)
|
|
500
|
+
|
|
501
|
+
return clamp(value, padding, max)
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
function selectNode(node: GraphNodeDatum) {
|
|
505
|
+
if (!props.selectable) return
|
|
506
|
+
|
|
507
|
+
internalSelectedId.value = node.id
|
|
508
|
+
emit("update:modelValue", node.id)
|
|
509
|
+
emit("select", {
|
|
510
|
+
connectedNodeIds: Array.from(getConnectedIds(node.id)),
|
|
511
|
+
index: node.index,
|
|
512
|
+
links: props.links.filter((link) => link.source === node.id || link.target === node.id),
|
|
513
|
+
node: node.original,
|
|
514
|
+
})
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
function getConnectedIds(id: string) {
|
|
518
|
+
const ids = new Set<string>([id])
|
|
519
|
+
|
|
520
|
+
for (const link of graphLinks.value) {
|
|
521
|
+
if (link.sourceId === id) ids.add(link.targetId)
|
|
522
|
+
if (link.targetId === id) ids.add(link.sourceId)
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
return ids
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
function handleWheel(event: WheelEvent) {
|
|
529
|
+
const svgPoint = getSvgPoint(event)
|
|
530
|
+
const previous = transform.value
|
|
531
|
+
const nextZoom = clamp(
|
|
532
|
+
previous.k * (event.deltaY < 0 ? 1.12 : 0.88),
|
|
533
|
+
props.minZoom,
|
|
534
|
+
props.maxZoom,
|
|
535
|
+
)
|
|
536
|
+
const ratio = nextZoom / previous.k
|
|
537
|
+
|
|
538
|
+
transform.value = {
|
|
539
|
+
k: nextZoom,
|
|
540
|
+
x: svgPoint.x - (svgPoint.x - previous.x) * ratio,
|
|
541
|
+
y: svgPoint.y - (svgPoint.y - previous.y) * ratio,
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
function handleCanvasPointerDown(event: PointerEvent) {
|
|
546
|
+
if (!props.pannable || pointerMode) return
|
|
547
|
+
|
|
548
|
+
pointerMode = "pan"
|
|
549
|
+
panStart = {
|
|
550
|
+
clientX: event.clientX,
|
|
551
|
+
clientY: event.clientY,
|
|
552
|
+
x: transform.value.x,
|
|
553
|
+
y: transform.value.y,
|
|
554
|
+
}
|
|
555
|
+
graphRef.value?.setPointerCapture(event.pointerId)
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function handleNodePointerDown(event: PointerEvent, node: GraphNodeDatum) {
|
|
559
|
+
event.stopPropagation()
|
|
560
|
+
selectNode(node)
|
|
561
|
+
|
|
562
|
+
if (!props.draggable) return
|
|
563
|
+
|
|
564
|
+
pointerMode = "node"
|
|
565
|
+
activeNode = node
|
|
566
|
+
node.fx = node.x
|
|
567
|
+
node.fy = node.y
|
|
568
|
+
simulation?.alphaTarget(0.22).restart()
|
|
569
|
+
graphRef.value?.setPointerCapture(event.pointerId)
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
function handlePointerMove(event: PointerEvent) {
|
|
573
|
+
if (pointerMode === "node" && activeNode) {
|
|
574
|
+
const point = getGraphPoint(event)
|
|
575
|
+
|
|
576
|
+
activeNode.fx = clampNodeX(point.x, activeNode.radius)
|
|
577
|
+
activeNode.fy = clampNodeY(point.y, activeNode.radius)
|
|
578
|
+
renderTick.value += 1
|
|
579
|
+
return
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
if (pointerMode === "pan" && panStart) {
|
|
583
|
+
const delta = getSvgDelta(event, panStart.clientX, panStart.clientY)
|
|
584
|
+
|
|
585
|
+
transform.value = {
|
|
586
|
+
...transform.value,
|
|
587
|
+
x: panStart.x + delta.x,
|
|
588
|
+
y: panStart.y + delta.y,
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
function handlePointerUp(event: PointerEvent) {
|
|
594
|
+
if (pointerMode === "node" && activeNode) {
|
|
595
|
+
if (!activeNode.original.fixed) {
|
|
596
|
+
activeNode.fx = undefined
|
|
597
|
+
activeNode.fy = undefined
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
simulation?.alphaTarget(0)
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
pointerMode = undefined
|
|
604
|
+
activeNode = undefined
|
|
605
|
+
panStart = undefined
|
|
606
|
+
graphRef.value?.releasePointerCapture(event.pointerId)
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function zoomBy(multiplier: number) {
|
|
610
|
+
const nextZoom = clamp(transform.value.k * multiplier, props.minZoom, props.maxZoom)
|
|
611
|
+
|
|
612
|
+
transform.value = {
|
|
613
|
+
...transform.value,
|
|
614
|
+
k: nextZoom,
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
function resetView() {
|
|
619
|
+
transform.value = {
|
|
620
|
+
k: 1,
|
|
621
|
+
x: 0,
|
|
622
|
+
y: 0,
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
function getSvgPoint(event: Pick<MouseEvent, "clientX" | "clientY">) {
|
|
627
|
+
const rect = graphRef.value?.getBoundingClientRect()
|
|
628
|
+
|
|
629
|
+
if (!rect) {
|
|
630
|
+
return {
|
|
631
|
+
x: graphWidth.value / 2,
|
|
632
|
+
y: graphHeight.value / 2,
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
return {
|
|
637
|
+
x: ((event.clientX - rect.left) / rect.width) * graphWidth.value,
|
|
638
|
+
y: ((event.clientY - rect.top) / rect.height) * graphHeight.value,
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
function getGraphPoint(event: Pick<MouseEvent, "clientX" | "clientY">) {
|
|
643
|
+
const point = getSvgPoint(event)
|
|
644
|
+
|
|
645
|
+
return {
|
|
646
|
+
x: (point.x - transform.value.x) / transform.value.k,
|
|
647
|
+
y: (point.y - transform.value.y) / transform.value.k,
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
function getSvgDelta(event: Pick<MouseEvent, "clientX" | "clientY">, startX: number, startY: number) {
|
|
652
|
+
const rect = graphRef.value?.getBoundingClientRect()
|
|
653
|
+
|
|
654
|
+
if (!rect) {
|
|
655
|
+
return {
|
|
656
|
+
x: 0,
|
|
657
|
+
y: 0,
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
return {
|
|
662
|
+
x: ((event.clientX - startX) / rect.width) * graphWidth.value,
|
|
663
|
+
y: ((event.clientY - startY) / rect.height) * graphHeight.value,
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
function hashString(value: string) {
|
|
668
|
+
let hash = 0
|
|
669
|
+
|
|
670
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
671
|
+
hash = ((hash << 5) - hash) + value.charCodeAt(index)
|
|
672
|
+
hash |= 0
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
return hash
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
function clamp(value: number, min: number, max: number) {
|
|
679
|
+
return Math.min(max, Math.max(min, value))
|
|
680
|
+
}
|
|
681
|
+
</script>
|
|
682
|
+
|
|
683
|
+
<template>
|
|
684
|
+
<article
|
|
685
|
+
data-slot="network-graph"
|
|
686
|
+
:data-size="props.size"
|
|
687
|
+
:class="cn('overflow-hidden rounded-xl border bg-card text-card-foreground shadow-xs', props.class)"
|
|
688
|
+
>
|
|
689
|
+
<header
|
|
690
|
+
v-if="hasHeader"
|
|
691
|
+
data-slot="network-graph-header"
|
|
692
|
+
:class="cn('flex flex-col gap-3 border-b sm:flex-row sm:items-start sm:justify-between', sizeClasses.header)"
|
|
693
|
+
>
|
|
694
|
+
<div
|
|
695
|
+
v-if="props.title || props.description"
|
|
696
|
+
class="flex min-w-0 flex-col gap-1"
|
|
697
|
+
>
|
|
698
|
+
<h3
|
|
699
|
+
v-if="props.title"
|
|
700
|
+
data-slot="network-graph-title"
|
|
701
|
+
:class="cn('truncate font-semibold leading-tight tracking-normal', sizeClasses.title)"
|
|
702
|
+
>
|
|
703
|
+
{{ props.title }}
|
|
704
|
+
</h3>
|
|
705
|
+
<p
|
|
706
|
+
v-if="props.description"
|
|
707
|
+
data-slot="network-graph-description"
|
|
708
|
+
:class="cn('max-w-2xl text-muted-foreground', sizeClasses.description)"
|
|
709
|
+
>
|
|
710
|
+
{{ props.description }}
|
|
711
|
+
</p>
|
|
712
|
+
</div>
|
|
713
|
+
|
|
714
|
+
<div
|
|
715
|
+
v-if="props.summary || hasRenderableData"
|
|
716
|
+
data-slot="network-graph-summary"
|
|
717
|
+
:class="cn('flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 text-muted-foreground', sizeClasses.meta)"
|
|
718
|
+
>
|
|
719
|
+
<span :class="cn(props.summary && 'font-medium text-foreground')">
|
|
720
|
+
{{ props.summary ?? graphStats }}
|
|
721
|
+
</span>
|
|
722
|
+
</div>
|
|
723
|
+
</header>
|
|
724
|
+
|
|
725
|
+
<div
|
|
726
|
+
data-slot="network-graph-body"
|
|
727
|
+
:class="cn('relative min-w-0 bg-background', sizeClasses.body)"
|
|
728
|
+
:data-tick="renderTick"
|
|
729
|
+
>
|
|
730
|
+
<div
|
|
731
|
+
v-if="!hasRenderableData"
|
|
732
|
+
data-slot="network-graph-empty"
|
|
733
|
+
:class="cn('flex items-center justify-center rounded-md border border-dashed bg-muted/20 text-sm text-muted-foreground', sizeClasses.empty)"
|
|
734
|
+
>
|
|
735
|
+
{{ props.emptyLabel }}
|
|
736
|
+
</div>
|
|
737
|
+
|
|
738
|
+
<template v-else>
|
|
739
|
+
<div
|
|
740
|
+
data-slot="network-graph-surface"
|
|
741
|
+
class="relative min-w-0 overflow-hidden bg-background"
|
|
742
|
+
>
|
|
743
|
+
<div
|
|
744
|
+
v-if="props.showControls"
|
|
745
|
+
data-slot="network-graph-controls"
|
|
746
|
+
class="absolute top-3 right-3 z-10 inline-flex items-center gap-1 rounded-md bg-background/80 p-1 text-xs backdrop-blur"
|
|
747
|
+
>
|
|
748
|
+
<button
|
|
749
|
+
type="button"
|
|
750
|
+
:class="cn('inline-flex items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none', sizeClasses.control)"
|
|
751
|
+
aria-label="Zoom in"
|
|
752
|
+
title="Zoom in"
|
|
753
|
+
@click="zoomBy(1.18)"
|
|
754
|
+
>
|
|
755
|
+
<PlusIcon class="size-3.5" />
|
|
756
|
+
</button>
|
|
757
|
+
<button
|
|
758
|
+
type="button"
|
|
759
|
+
:class="cn('inline-flex items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none', sizeClasses.control)"
|
|
760
|
+
aria-label="Zoom out"
|
|
761
|
+
title="Zoom out"
|
|
762
|
+
@click="zoomBy(0.82)"
|
|
763
|
+
>
|
|
764
|
+
<MinusIcon class="size-3.5" />
|
|
765
|
+
</button>
|
|
766
|
+
<span
|
|
767
|
+
data-slot="network-graph-zoom"
|
|
768
|
+
class="hidden min-w-10 text-center font-medium tabular-nums text-muted-foreground sm:inline"
|
|
769
|
+
>
|
|
770
|
+
{{ formattedZoom }}
|
|
771
|
+
</span>
|
|
772
|
+
<button
|
|
773
|
+
type="button"
|
|
774
|
+
:class="cn('inline-flex items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none', sizeClasses.control)"
|
|
775
|
+
aria-label="Reset view"
|
|
776
|
+
title="Reset view"
|
|
777
|
+
@click="resetView"
|
|
778
|
+
>
|
|
779
|
+
<FocusIcon class="size-3.5" />
|
|
780
|
+
</button>
|
|
781
|
+
</div>
|
|
782
|
+
|
|
783
|
+
<svg
|
|
784
|
+
ref="graphRef"
|
|
785
|
+
data-slot="network-graph-canvas"
|
|
786
|
+
class="block w-full touch-none"
|
|
787
|
+
:viewBox="`0 0 ${graphWidth} ${graphHeight}`"
|
|
788
|
+
:style="{ height: `${graphHeight}px` }"
|
|
789
|
+
role="img"
|
|
790
|
+
:aria-label="props.title ?? 'Network graph'"
|
|
791
|
+
@pointerdown="handleCanvasPointerDown"
|
|
792
|
+
@pointermove="handlePointerMove"
|
|
793
|
+
@pointerup="handlePointerUp"
|
|
794
|
+
@pointercancel="handlePointerUp"
|
|
795
|
+
@wheel.prevent="handleWheel"
|
|
796
|
+
>
|
|
797
|
+
<rect
|
|
798
|
+
data-slot="network-graph-background"
|
|
799
|
+
width="100%"
|
|
800
|
+
height="100%"
|
|
801
|
+
fill="var(--background)"
|
|
802
|
+
/>
|
|
803
|
+
|
|
804
|
+
<g :transform="graphTransform">
|
|
805
|
+
<g data-slot="network-graph-links">
|
|
806
|
+
<line
|
|
807
|
+
v-for="link in graphLinks"
|
|
808
|
+
:key="link.id"
|
|
809
|
+
data-slot="network-graph-link"
|
|
810
|
+
:x1="getLinkSource(link)?.x ?? 0"
|
|
811
|
+
:y1="getLinkSource(link)?.y ?? 0"
|
|
812
|
+
:x2="getLinkTarget(link)?.x ?? 0"
|
|
813
|
+
:y2="getLinkTarget(link)?.y ?? 0"
|
|
814
|
+
:stroke="linkStroke(link)"
|
|
815
|
+
:stroke-opacity="linkOpacity(link)"
|
|
816
|
+
:stroke-width="linkStrokeWidth(link)"
|
|
817
|
+
stroke-linecap="round"
|
|
818
|
+
/>
|
|
819
|
+
</g>
|
|
820
|
+
|
|
821
|
+
<g data-slot="network-graph-nodes">
|
|
822
|
+
<g
|
|
823
|
+
v-for="node in graphNodes"
|
|
824
|
+
:key="node.id"
|
|
825
|
+
data-slot="network-graph-node"
|
|
826
|
+
:data-selected="isSelectedNode(node) ? '' : undefined"
|
|
827
|
+
:data-dimmed="isDimmedNode(node) ? '' : undefined"
|
|
828
|
+
:transform="`translate(${node.x ?? 0} ${node.y ?? 0})`"
|
|
829
|
+
class="cursor-grab outline-none transition-opacity active:cursor-grabbing"
|
|
830
|
+
:style="{ opacity: nodeOpacity(node) }"
|
|
831
|
+
role="button"
|
|
832
|
+
tabindex="0"
|
|
833
|
+
:aria-label="node.label"
|
|
834
|
+
@click="selectNode(node)"
|
|
835
|
+
@keydown.enter.prevent="selectNode(node)"
|
|
836
|
+
@keydown.space.prevent="selectNode(node)"
|
|
837
|
+
@pointerdown="handleNodePointerDown($event, node)"
|
|
838
|
+
>
|
|
839
|
+
<circle
|
|
840
|
+
data-slot="network-graph-node-circle"
|
|
841
|
+
:r="node.radius"
|
|
842
|
+
:fill="node.color"
|
|
843
|
+
:stroke="nodeStroke()"
|
|
844
|
+
stroke-width="1.5"
|
|
845
|
+
class="transition-[stroke,stroke-width]"
|
|
846
|
+
/>
|
|
847
|
+
<circle
|
|
848
|
+
v-if="isSelectedNode(node)"
|
|
849
|
+
data-slot="network-graph-node-ring"
|
|
850
|
+
:r="node.radius + 4"
|
|
851
|
+
fill="none"
|
|
852
|
+
stroke="var(--foreground)"
|
|
853
|
+
stroke-opacity="0.32"
|
|
854
|
+
stroke-width="1.5"
|
|
855
|
+
/>
|
|
856
|
+
<text
|
|
857
|
+
v-if="props.showLabels"
|
|
858
|
+
data-slot="network-graph-label"
|
|
859
|
+
:class="cn('pointer-events-none select-none fill-current text-center font-semibold text-foreground', sizeClasses.label)"
|
|
860
|
+
text-anchor="middle"
|
|
861
|
+
:y="node.radius + 16"
|
|
862
|
+
stroke="var(--background)"
|
|
863
|
+
stroke-linejoin="round"
|
|
864
|
+
stroke-width="3"
|
|
865
|
+
paint-order="stroke"
|
|
866
|
+
>
|
|
867
|
+
{{ node.label }}
|
|
868
|
+
</text>
|
|
869
|
+
</g>
|
|
870
|
+
</g>
|
|
871
|
+
</g>
|
|
872
|
+
</svg>
|
|
873
|
+
|
|
874
|
+
<div
|
|
875
|
+
data-slot="network-graph-selection"
|
|
876
|
+
:class="cn('flex min-w-0 flex-col gap-1 border-t bg-muted/20 px-3 py-2.5 sm:flex-row sm:items-center sm:justify-between', sizeClasses.meta)"
|
|
877
|
+
>
|
|
878
|
+
<span class="flex min-w-0 items-center gap-2">
|
|
879
|
+
<span
|
|
880
|
+
data-slot="network-graph-selection-dot"
|
|
881
|
+
class="size-2 shrink-0 rounded-full bg-foreground"
|
|
882
|
+
:style="{ backgroundColor: selectedNode?.color ?? 'var(--muted-foreground)' }"
|
|
883
|
+
/>
|
|
884
|
+
<span
|
|
885
|
+
data-slot="network-graph-selection-label"
|
|
886
|
+
class="min-w-0 truncate font-semibold text-foreground"
|
|
887
|
+
>
|
|
888
|
+
{{ selectedNode?.label ?? "No node selected" }}
|
|
889
|
+
</span>
|
|
890
|
+
</span>
|
|
891
|
+
<span
|
|
892
|
+
data-slot="network-graph-selection-meta"
|
|
893
|
+
class="min-w-0 text-muted-foreground"
|
|
894
|
+
>
|
|
895
|
+
{{ selectedSummaryText }}
|
|
896
|
+
</span>
|
|
897
|
+
</div>
|
|
898
|
+
</div>
|
|
899
|
+
</template>
|
|
900
|
+
</div>
|
|
901
|
+
</article>
|
|
902
|
+
</template>
|