@wakastellar/ui 4.0.1 → 4.1.1
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/dist/blocks/_shared/identity/InviteUserPanel.cjs.js +1 -1
- package/dist/blocks/_shared/identity/RoleSelect.cjs.js +1 -1
- package/dist/blocks/_shared/identity/SidePushLayout.cjs.js +1 -1
- package/dist/blocks/activity-timeline/index.cjs.js +1 -1
- package/dist/blocks/activity-timeline/index.es.js +1 -1
- package/dist/blocks/antivirus-dashboard/index.cjs.js +1 -1
- package/dist/blocks/antivirus-dashboard/index.es.js +1 -1
- package/dist/blocks/api-keys-manager/index.cjs.js +1 -1
- package/dist/blocks/apm-overview/index.cjs.js +1 -1
- package/dist/blocks/auth-2fa/index.cjs.js +2 -2
- package/dist/blocks/auth-2fa/index.es.js +1 -1
- package/dist/blocks/avatar-upload/index.cjs.js +1 -1
- package/dist/blocks/avatar-upload/index.es.js +13 -13
- package/dist/blocks/calendar-view/index.cjs.js +1 -1
- package/dist/blocks/calendar-view/index.es.js +1 -1
- package/dist/blocks/chat/index.cjs.js +1 -1
- package/dist/blocks/chat/index.es.js +162 -162
- package/dist/blocks/chat/widget.cjs.js +1 -1
- package/dist/blocks/chat/widget.es.js +19 -13
- package/dist/blocks/chat-interface/index.cjs.js +1 -1
- package/dist/blocks/chat-interface/index.es.js +1 -1
- package/dist/blocks/checkout-flow/index.cjs.js +1 -1
- package/dist/blocks/checkout-flow/index.es.js +1 -1
- package/dist/blocks/cicd-builder/index.cjs.js +1 -1
- package/dist/blocks/clamav-service-status/index.cjs.js +1 -1
- package/dist/blocks/cloud-cost-dashboard/index.cjs.js +1 -1
- package/dist/blocks/container-orchestrator/index.cjs.js +1 -1
- package/dist/blocks/container-orchestrator/index.es.js +2 -1
- package/dist/blocks/dashboard/index.cjs.js +1 -1
- package/dist/blocks/dashboard/index.es.js +2 -2
- package/dist/blocks/dashboard-kpi/index.cjs.js +1 -1
- package/dist/blocks/dashboard-kpi/index.es.js +1 -1
- package/dist/blocks/database-admin/index.cjs.js +1 -1
- package/dist/blocks/deployment-dashboard/index.cjs.js +1 -1
- package/dist/blocks/deployment-dashboard/index.es.js +1 -1
- package/dist/blocks/empty-states/index.cjs.js +1 -1
- package/dist/blocks/empty-states/index.es.js +1 -1
- package/dist/blocks/error-pages/index.cjs.js +1 -1
- package/dist/blocks/error-pages/index.es.js +1 -1
- package/dist/blocks/faq/index.cjs.js +1 -1
- package/dist/blocks/faq/index.es.js +1 -1
- package/dist/blocks/file-manager/index.cjs.js +1 -1
- package/dist/blocks/file-manager/index.es.js +1 -1
- package/dist/blocks/file-scan-uploader/index.cjs.js +1 -1
- package/dist/blocks/file-scan-uploader/index.es.js +2 -2
- package/dist/blocks/footer/index.cjs.js +1 -1
- package/dist/blocks/gitops-sync-status/index.cjs.js +1 -1
- package/dist/blocks/header/index.cjs.js +1 -1
- package/dist/blocks/header/index.es.js +1 -1
- package/dist/blocks/headtab/index.cjs.js +1 -1
- package/dist/blocks/i18n-editor/index.cjs.js +1 -1
- package/dist/blocks/i18n-editor/index.es.js +127 -127
- package/dist/blocks/incident-manager/index.cjs.js +1 -1
- package/dist/blocks/infrastructure-map/index.cjs.js +1 -1
- package/dist/blocks/kanban-board/index.cjs.js +1 -1
- package/dist/blocks/kanban-board/index.es.js +1 -1
- package/dist/blocks/landing/index.cjs.js +1 -1
- package/dist/blocks/landing/index.es.js +1 -1
- package/dist/blocks/language-selector/index.cjs.js +1 -1
- package/dist/blocks/layout/index.cjs.js +1 -1
- package/dist/blocks/login/index.cjs.js +1 -1
- package/dist/blocks/on-call-schedule/index.cjs.js +1 -1
- package/dist/blocks/player-profile/index.cjs.js +1 -1
- package/dist/blocks/player-profile/index.es.js +1 -1
- package/dist/blocks/pricing/index.cjs.js +1 -1
- package/dist/blocks/pricing/index.es.js +1 -1
- package/dist/blocks/profile/index.cjs.js +1 -1
- package/dist/blocks/profile/index.es.js +1 -1
- package/dist/blocks/profile-list/index.cjs.js +1 -1
- package/dist/blocks/quarantine-manager/index.cjs.js +1 -1
- package/dist/blocks/quarantine-manager/index.es.js +1 -1
- package/dist/blocks/release-notes/index.cjs.js +1 -1
- package/dist/blocks/scan-history-log/index.cjs.js +1 -1
- package/dist/blocks/scan-history-log/index.es.js +1 -1
- package/dist/blocks/scan-policy-editor/index.cjs.js +1 -1
- package/dist/blocks/scan-report-generator/index.cjs.js +1 -1
- package/dist/blocks/settings/index.cjs.js +1 -1
- package/dist/blocks/settings/index.es.js +1 -1
- package/dist/blocks/sidebar/index.cjs.js +1 -1
- package/dist/blocks/sidebar/index.es.js +1 -1
- package/dist/blocks/signature-database-manager/index.cjs.js +1 -1
- package/dist/blocks/team-form/index.cjs.js +1 -1
- package/dist/blocks/threat-alert-banner/index.cjs.js +1 -1
- package/dist/blocks/user-management/index.cjs.js +1 -1
- package/dist/blocks/waka-doc-shell/index.cjs.js +1 -1
- package/dist/blocks/wizard/index.cjs.js +1 -1
- package/dist/blocks/wizard/index.es.js +37 -37
- package/dist/charts.cjs.js +1 -1
- package/dist/charts.es.js +8 -8
- package/dist/cli/index.cjs +5 -1
- package/dist/components/DataTable/DataTable.cjs.js +1 -1
- package/dist/components/DataTable/DataTable.es.js +68 -66
- package/dist/components/DataTable/DataTableAdvanced.cjs.js +1 -1
- package/dist/components/DataTable/DataTableColumnResizer.cjs.js +1 -1
- package/dist/components/DataTable/DataTableContextMenu.cjs.js +1 -1
- package/dist/components/DataTable/DataTableEditCell.cjs.js +1 -1
- package/dist/components/DataTable/DataTableFilters.cjs.js +1 -1
- package/dist/components/DataTable/DataTableGrouping.cjs.js +1 -1
- package/dist/components/DataTable/DataTablePagination.cjs.js +1 -1
- package/dist/components/DataTable/DataTablePagination.d.ts +3 -1
- package/dist/components/DataTable/DataTablePagination.es.js +38 -27
- package/dist/components/DataTable/DataTableSelection.cjs.js +1 -1
- package/dist/components/DataTable/DataTableToolbar.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTable.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTable.es.js +5 -1
- package/dist/components/DataTable/hooks/useDataTableAdvanced.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTableEdit.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTableExport.cjs.js +2 -2
- package/dist/components/DataTable/hooks/useDataTableImport.cjs.js +2 -2
- package/dist/components/DataTable/hooks/useDataTableImport.es.js +2 -1
- package/dist/components/DataTable/hooks/useDataTableTheme.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTableVirtualization.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useTableLayout.cjs.js +1 -1
- package/dist/components/DataTable/utils.cjs.js +1 -1
- package/dist/components/accordion/index.cjs.js +1 -1
- package/dist/components/alert/index.cjs.js +1 -1
- package/dist/components/alert-dialog/index.cjs.js +1 -1
- package/dist/components/aspect-ratio/index.cjs.js +1 -1
- package/dist/components/avatar/index.cjs.js +1 -1
- package/dist/components/badge/index.cjs.js +1 -1
- package/dist/components/button/index.cjs.js +1 -1
- package/dist/components/calendar/index.cjs.js +1 -1
- package/dist/components/card/index.cjs.js +1 -1
- package/dist/components/checkbox/index.cjs.js +1 -1
- package/dist/components/code/index.cjs.js +2 -2
- package/dist/components/code/index.es.js +3 -2
- package/dist/components/collapsible/index.cjs.js +1 -1
- package/dist/components/command/index.cjs.js +1 -1
- package/dist/components/context-menu/index.cjs.js +1 -1
- package/dist/components/dialog/index.cjs.js +1 -1
- package/dist/components/dropdown-menu/index.cjs.js +1 -1
- package/dist/components/editor/blocks/index.cjs.js +1 -1
- package/dist/components/editor/blocks/index.es.js +12 -12
- package/dist/components/editor/blocks/waka-acceptance-criteria-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-ai-assist-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-api-endpoint-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-code-playground-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-comment-thread-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-diagram-block.cjs.js +3 -3
- package/dist/components/editor/blocks/waka-diagram-block.es.js +21 -40
- package/dist/components/editor/blocks/waka-embed-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-slash-menu-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-user-story-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-version-diff-block.cjs.js +1 -1
- package/dist/components/editor/waka-ai-writer.cjs.js +1 -1
- package/dist/components/editor/waka-collaborative-editor.cjs.js +1 -1
- package/dist/components/editor/waka-diff-viewer.cjs.js +1 -1
- package/dist/components/editor/waka-dnd-editor.cjs.js +1 -1
- package/dist/components/editor/waka-document-editor.cjs.js +1 -1
- package/dist/components/editor/waka-document-editor.es.js +1 -1
- package/dist/components/editor/waka-editor-elements.cjs.js +1 -1
- package/dist/components/editor/waka-editor-leaves.cjs.js +1 -1
- package/dist/components/editor/waka-editor-toolbar.cjs.js +1 -1
- package/dist/components/editor/waka-editor.cjs.js +1 -1
- package/dist/components/editor/waka-floating-toolbar.cjs.js +1 -1
- package/dist/components/editor/waka-markdown-editor.cjs.js +1 -1
- package/dist/components/editor/waka-mention-editor.cjs.js +1 -1
- package/dist/components/editor/waka-mention-editor.es.js +2 -2
- package/dist/components/editor/waka-slash-menu.cjs.js +1 -1
- package/dist/components/editor/waka-spec-editor.cjs.js +1 -1
- package/dist/components/form/index.cjs.js +1 -1
- package/dist/components/hover-card/index.cjs.js +1 -1
- package/dist/components/input/index.cjs.js +1 -1
- package/dist/components/input-otp/index.cjs.js +1 -1
- package/dist/components/input-otp/index.es.js +2 -1
- package/dist/components/label/index.cjs.js +1 -1
- package/dist/components/language-selector/index.cjs.js +1 -1
- package/dist/components/menubar/index.cjs.js +1 -1
- package/dist/components/navigation-menu/index.cjs.js +1 -1
- package/dist/components/popover/index.cjs.js +1 -1
- package/dist/components/progress/index.cjs.js +1 -1
- package/dist/components/radio-group/index.cjs.js +1 -1
- package/dist/components/resizable/index.cjs.js +1 -1
- package/dist/components/resizable/index.es.js +9 -9
- package/dist/components/scroll-area/index.cjs.js +1 -1
- package/dist/components/select/index.cjs.js +1 -1
- package/dist/components/separator/index.cjs.js +1 -1
- package/dist/components/sheet/index.cjs.js +1 -1
- package/dist/components/skeleton/index.cjs.js +1 -1
- package/dist/components/slider/index.cjs.js +1 -1
- package/dist/components/switch/index.cjs.js +1 -1
- package/dist/components/table/index.cjs.js +1 -1
- package/dist/components/tabs/index.cjs.js +1 -1
- package/dist/components/textarea/index.cjs.js +1 -1
- package/dist/components/theme-selector/index.cjs.js +1 -1
- package/dist/components/toast/index.cjs.js +1 -1
- package/dist/components/toaster/index.cjs.js +1 -1
- package/dist/components/toggle/index.cjs.js +1 -1
- package/dist/components/toggle-group/index.cjs.js +1 -1
- package/dist/components/tooltip/index.cjs.js +1 -1
- package/dist/components/typography/index.cjs.js +1 -1
- package/dist/components/waka-3d-pie-chart/index.cjs.js +1 -1
- package/dist/components/waka-3d-pie-chart/index.es.js +1 -1
- package/dist/components/waka-achievement-unlock/index.cjs.js +1 -1
- package/dist/components/waka-achievement-unlock/index.es.js +1 -1
- package/dist/components/waka-activity-feed/index.cjs.js +2 -2
- package/dist/components/waka-activity-feed/index.es.js +1 -1
- package/dist/components/waka-ad-banner/index.cjs.js +1 -1
- package/dist/components/waka-ad-banner/index.es.js +18 -15
- package/dist/components/waka-ad-fallback/index.cjs.js +1 -1
- package/dist/components/waka-ad-fallback/index.es.js +1 -1
- package/dist/components/waka-ad-inline/index.cjs.js +1 -1
- package/dist/components/waka-ad-inline/index.es.js +2 -2
- package/dist/components/waka-ad-interstitial/index.cjs.js +1 -1
- package/dist/components/waka-ad-interstitial/index.es.js +3 -3
- package/dist/components/waka-ad-placeholder/index.cjs.js +2 -2
- package/dist/components/waka-ad-placeholder/index.es.js +1 -1
- package/dist/components/waka-ad-provider/index.cjs.js +1 -1
- package/dist/components/waka-ad-provider/index.es.js +1 -1
- package/dist/components/waka-ad-sidebar/index.cjs.js +1 -1
- package/dist/components/waka-ad-sidebar/index.es.js +2 -2
- package/dist/components/waka-ad-sticky-footer/index.cjs.js +1 -1
- package/dist/components/waka-ad-sticky-footer/index.es.js +2 -2
- package/dist/components/waka-address-autocomplete/index.cjs.js +2 -2
- package/dist/components/waka-address-autocomplete/index.es.js +10 -6
- package/dist/components/waka-admincrumb/index.cjs.js +1 -1
- package/dist/components/waka-alert-panel/index.cjs.js +1 -1
- package/dist/components/waka-alert-stack/index.cjs.js +1 -1
- package/dist/components/waka-alert-stack/index.es.js +1 -1
- package/dist/components/waka-allocation-matrix/index.cjs.js +2 -2
- package/dist/components/waka-allocation-matrix/index.es.js +1 -1
- package/dist/components/waka-approval-chain/index.cjs.js +1 -1
- package/dist/components/waka-approval-chain/index.es.js +1 -1
- package/dist/components/waka-artifact-list/index.cjs.js +1 -1
- package/dist/components/waka-artifact-list/index.es.js +1 -1
- package/dist/components/waka-audit-log/index.cjs.js +2 -2
- package/dist/components/waka-audit-log/index.es.js +1 -1
- package/dist/components/waka-autocomplete/index.cjs.js +1 -1
- package/dist/components/waka-autocomplete/index.es.js +3 -2
- package/dist/components/waka-badge-showcase/index.cjs.js +1 -1
- package/dist/components/waka-barcode/index.cjs.js +1 -1
- package/dist/components/waka-barcode/index.es.js +1 -1
- package/dist/components/waka-biometric-prompt/index.cjs.js +2 -2
- package/dist/components/waka-biometric-prompt/index.es.js +1 -1
- package/dist/components/waka-bottom-sheet/index.cjs.js +1 -1
- package/dist/components/waka-bottom-sheet/index.es.js +12 -7
- package/dist/components/waka-breadcrumb/index.cjs.js +1 -1
- package/dist/components/waka-breadcrumb/index.es.js +1 -1
- package/dist/components/waka-breadcrumb-path/index.cjs.js +1 -1
- package/dist/components/waka-breadcrumb-path/index.es.js +1 -1
- package/dist/components/waka-budget-burn/index.cjs.js +2 -2
- package/dist/components/waka-budget-burn/index.es.js +3 -3
- package/dist/components/waka-build-matrix/index.cjs.js +1 -1
- package/dist/components/waka-capacity-planner/index.cjs.js +2 -2
- package/dist/components/waka-capacity-planner/index.es.js +1 -1
- package/dist/components/waka-carousel/index.cjs.js +1 -1
- package/dist/components/waka-carousel/index.es.js +2 -2
- package/dist/components/waka-cart-summary/index.cjs.js +1 -1
- package/dist/components/waka-cart-summary/index.es.js +2 -2
- package/dist/components/waka-challenge-timer/index.cjs.js +1 -1
- package/dist/components/waka-charts/WakaAreaChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaAreaChart.es.js +2 -2
- package/dist/components/waka-charts/WakaBarChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaBarChart.es.js +2 -2
- package/dist/components/waka-charts/WakaChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaChart.es.js +1 -1
- package/dist/components/waka-charts/WakaLineChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaLineChart.es.js +2 -2
- package/dist/components/waka-charts/WakaMiniChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaMiniChart.es.js +2 -2
- package/dist/components/waka-charts/WakaPieChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaPieChart.es.js +2 -2
- package/dist/components/waka-charts/WakaSparkline.cjs.js +1 -1
- package/dist/components/waka-charts/WakaSparkline.es.js +1 -1
- package/dist/components/waka-charts/dataTableHelpers.cjs.js +1 -1
- package/dist/components/waka-charts/dataTableHelpers.es.js +1 -1
- package/dist/components/waka-charts/hooks/useChartTheme.cjs.js +1 -1
- package/dist/components/waka-charts/hooks/useChartTheme.es.js +1 -1
- package/dist/components/waka-charts/hooks/useRechartsLoader.cjs.js +1 -1
- package/dist/components/waka-charts/hooks/useRechartsLoader.es.js +1 -1
- package/dist/components/waka-chat-bubble/index.cjs.js +1 -1
- package/dist/components/waka-checklist/index.cjs.js +2 -2
- package/dist/components/waka-checklist/index.es.js +1 -1
- package/dist/components/waka-checkout-stepper/index.cjs.js +1 -1
- package/dist/components/waka-checkout-stepper/index.es.js +1 -1
- package/dist/components/waka-cohort-table/index.cjs.js +2 -2
- package/dist/components/waka-cohort-table/index.es.js +1 -1
- package/dist/components/waka-color-picker/index.cjs.js +2 -2
- package/dist/components/waka-color-picker/index.es.js +1 -1
- package/dist/components/waka-combo-counter/index.cjs.js +1 -1
- package/dist/components/waka-combobox/index.cjs.js +1 -1
- package/dist/components/waka-combobox/index.es.js +3 -2
- package/dist/components/waka-command-bar/index.cjs.js +1 -1
- package/dist/components/waka-compare-period/index.cjs.js +2 -2
- package/dist/components/waka-compare-period/index.es.js +7 -5
- package/dist/components/waka-config-comparator/index.cjs.js +1 -1
- package/dist/components/waka-config-comparator/index.es.js +1 -1
- package/dist/components/waka-connection-matrix/index.cjs.js +1 -1
- package/dist/components/waka-connection-matrix/index.es.js +1 -1
- package/dist/components/waka-container-list/index.cjs.js +1 -1
- package/dist/components/waka-container-list/index.es.js +1 -1
- package/dist/components/waka-content-recommendation/index.cjs.js +1 -1
- package/dist/components/waka-content-recommendation/index.es.js +2 -2
- package/dist/components/waka-contribution-graph/index.cjs.js +1 -1
- package/dist/components/waka-contribution-graph/index.es.js +4 -4
- package/dist/components/waka-cost-breakdown/index.cjs.js +1 -1
- package/dist/components/waka-cost-breakdown/index.es.js +7 -7
- package/dist/components/waka-coupon-input/index.cjs.js +2 -2
- package/dist/components/waka-coupon-input/index.es.js +1 -1
- package/dist/components/waka-credit-activity-feed/index.cjs.js +2 -2
- package/dist/components/waka-credit-activity-feed/index.es.js +1 -1
- package/dist/components/waka-credit-alert/index.cjs.js +1 -1
- package/dist/components/waka-credit-alert/index.es.js +1 -1
- package/dist/components/waka-credit-balance/index.cjs.js +1 -1
- package/dist/components/waka-credit-balance/index.es.js +3 -3
- package/dist/components/waka-credit-breakdown/index.cjs.js +1 -1
- package/dist/components/waka-credit-breakdown/index.es.js +1 -1
- package/dist/components/waka-credit-burn-rate/index.cjs.js +1 -1
- package/dist/components/waka-credit-burn-rate/index.es.js +1 -1
- package/dist/components/waka-credit-card-input/index.cjs.js +1 -1
- package/dist/components/waka-credit-card-input/index.es.js +1 -1
- package/dist/components/waka-credit-history/index.cjs.js +1 -1
- package/dist/components/waka-credit-history/index.es.js +1 -1
- package/dist/components/waka-credit-meter/index.cjs.js +2 -2
- package/dist/components/waka-credit-meter/index.es.js +3 -3
- package/dist/components/waka-credit-pricing-pack/index.cjs.js +1 -1
- package/dist/components/waka-credit-pricing-pack/index.es.js +1 -1
- package/dist/components/waka-credit-projection/index.cjs.js +1 -1
- package/dist/components/waka-credit-projection/index.es.js +1 -1
- package/dist/components/waka-credit-quota/index.cjs.js +1 -1
- package/dist/components/waka-credit-quota/index.es.js +3 -3
- package/dist/components/waka-credit-receipt/index.cjs.js +1 -1
- package/dist/components/waka-credit-receipt/index.es.js +1 -1
- package/dist/components/waka-credit-top-up/index.cjs.js +1 -1
- package/dist/components/waka-credit-top-up/index.es.js +1 -1
- package/dist/components/waka-credit-transaction/index.cjs.js +1 -1
- package/dist/components/waka-credit-transaction/index.es.js +1 -1
- package/dist/components/waka-credit-transfer-form/index.cjs.js +1 -1
- package/dist/components/waka-credit-transfer-form/index.es.js +1 -1
- package/dist/components/waka-credit-usage-chart/index.cjs.js +1 -1
- package/dist/components/waka-credit-usage-chart/index.es.js +1 -1
- package/dist/components/waka-daily-reward/index.cjs.js +1 -1
- package/dist/components/waka-database-card/index.cjs.js +1 -1
- package/dist/components/waka-database-card/index.es.js +1 -1
- package/dist/components/waka-date-range-picker/index.cjs.js +1 -1
- package/dist/components/waka-date-range-picker/index.es.js +3 -2
- package/dist/components/waka-datetime-picker/index.cjs.js +1 -1
- package/dist/components/waka-datetime-picker/index.es.js +4 -1
- package/dist/components/waka-datetime-picker.form-integration/index.cjs.js +1 -1
- package/dist/components/waka-dependency-tree/index.cjs.js +1 -1
- package/dist/components/waka-dependency-tree/index.es.js +1 -1
- package/dist/components/waka-deployment-lane/index.cjs.js +1 -1
- package/dist/components/waka-deployment-lane/index.es.js +1 -1
- package/dist/components/waka-device-trust/index.cjs.js +2 -2
- package/dist/components/waka-device-trust/index.es.js +1 -1
- package/dist/components/waka-doc-breadcrumb/index.cjs.js +1 -1
- package/dist/components/waka-doc-callout/index.cjs.js +1 -1
- package/dist/components/waka-doc-code-block/index.cjs.js +1 -1
- package/dist/components/waka-doc-nav/index.cjs.js +1 -1
- package/dist/components/waka-doc-renderer/index.cjs.js +1 -1
- package/dist/components/waka-doc-search/index.cjs.js +1 -1
- package/dist/components/waka-doc-table/index.cjs.js +1 -1
- package/dist/components/waka-doc-toc/index.cjs.js +1 -1
- package/dist/components/waka-doc-toolbar/index.cjs.js +1 -1
- package/dist/components/waka-doc-version/index.cjs.js +1 -1
- package/dist/components/waka-dock/index.cjs.js +1 -1
- package/dist/components/waka-dock/index.es.js +2 -2
- package/dist/components/waka-drawer/index.cjs.js +1 -1
- package/dist/components/waka-drawer/index.es.js +1 -1
- package/dist/components/waka-empty-state/index.cjs.js +1 -1
- package/dist/components/waka-env-var-editor/index.cjs.js +1 -1
- package/dist/components/waka-error-shake/index.cjs.js +1 -1
- package/dist/components/waka-feature-announcement/index.cjs.js +2 -2
- package/dist/components/waka-feature-announcement/index.es.js +1 -1
- package/dist/components/waka-feature-flag-row/index.cjs.js +1 -1
- package/dist/components/waka-file-upload/index.cjs.js +1 -1
- package/dist/components/waka-file-upload/index.es.js +2 -2
- package/dist/components/waka-floating-nav/index.cjs.js +1 -1
- package/dist/components/waka-floating-nav/index.es.js +1 -1
- package/dist/components/waka-flow-diagram/index.cjs.js +1 -1
- package/dist/components/waka-funnel-chart/index.cjs.js +2 -2
- package/dist/components/waka-funnel-chart/index.es.js +1 -1
- package/dist/components/waka-glow-card/index.cjs.js +1 -1
- package/dist/components/waka-glow-card/index.es.js +3 -3
- package/dist/components/waka-goal-progress/index.cjs.js +3 -3
- package/dist/components/waka-goal-progress/index.es.js +3 -3
- package/dist/components/waka-haptic-button/index.cjs.js +1 -1
- package/dist/components/waka-health-pulse/index.cjs.js +2 -2
- package/dist/components/waka-health-pulse/index.es.js +1 -1
- package/dist/components/waka-heatmap/index.cjs.js +1 -1
- package/dist/components/waka-heatmap/index.es.js +3 -3
- package/dist/components/waka-hotspot/index.cjs.js +1 -1
- package/dist/components/waka-image/index.cjs.js +1 -1
- package/dist/components/waka-image/index.es.js +1 -1
- package/dist/components/waka-incident-timeline/index.cjs.js +1 -1
- package/dist/components/waka-incident-timeline/index.es.js +3 -2
- package/dist/components/waka-invoice-preview/index.cjs.js +1 -1
- package/dist/components/waka-invoice-preview/index.es.js +1 -1
- package/dist/components/waka-kanban/index.cjs.js +1 -1
- package/dist/components/waka-kanban/index.es.js +1 -1
- package/dist/components/waka-kpi-dashboard/index.cjs.js +1 -1
- package/dist/components/waka-kpi-dashboard/index.es.js +6 -4
- package/dist/components/waka-kubernetes-overview/index.cjs.js +1 -1
- package/dist/components/waka-kubernetes-overview/index.es.js +1 -1
- package/dist/components/waka-leaderboard/index.cjs.js +1 -1
- package/dist/components/waka-level-progress/index.cjs.js +2 -2
- package/dist/components/waka-level-progress/index.es.js +2 -2
- package/dist/components/waka-liquid-button/index.cjs.js +1 -1
- package/dist/components/waka-loading-orbit/index.cjs.js +1 -1
- package/dist/components/waka-log-viewer/index.cjs.js +1 -1
- package/dist/components/waka-loot-box/index.cjs.js +2 -2
- package/dist/components/waka-loot-box/index.es.js +1 -1
- package/dist/components/waka-magic-link/index.cjs.js +2 -2
- package/dist/components/waka-magnetic-button/index.cjs.js +1 -1
- package/dist/components/waka-mention-input/index.cjs.js +1 -1
- package/dist/components/waka-mention-input/index.es.js +52 -40
- package/dist/components/waka-metric-sparkline/index.cjs.js +1 -1
- package/dist/components/waka-metric-sparkline/index.es.js +1 -1
- package/dist/components/waka-migration-list/index.cjs.js +1 -1
- package/dist/components/waka-milestone-road/index.cjs.js +2 -2
- package/dist/components/waka-milestone-road/index.es.js +5 -5
- package/dist/components/waka-modal/index.cjs.js +1 -1
- package/dist/components/waka-modal/index.es.js +1 -1
- package/dist/components/waka-morph-button/index.cjs.js +2 -2
- package/dist/components/waka-morph-button/index.es.js +6 -2
- package/dist/components/waka-network-topology/index.cjs.js +1 -1
- package/dist/components/waka-network-topology/index.es.js +4 -2
- package/dist/components/waka-notifications/index.cjs.js +1 -1
- package/dist/components/waka-number-input/index.cjs.js +1 -1
- package/dist/components/waka-number-input/index.es.js +1 -1
- package/dist/components/waka-orbital-menu/index.cjs.js +1 -1
- package/dist/components/waka-orbital-menu/index.es.js +1 -1
- package/dist/components/waka-order-tracker/index.cjs.js +1 -1
- package/dist/components/waka-order-tracker/index.es.js +3 -2
- package/dist/components/waka-outstream-video/index.cjs.js +1 -1
- package/dist/components/waka-outstream-video/index.es.js +2 -2
- package/dist/components/waka-pagination/index.cjs.js +1 -1
- package/dist/components/waka-pagination/index.es.js +1 -1
- package/dist/components/waka-password-strength/index.cjs.js +2 -2
- package/dist/components/waka-password-strength/index.es.js +3 -3
- package/dist/components/waka-payment-method-picker/index.cjs.js +1 -1
- package/dist/components/waka-payment-method-picker/index.es.js +1 -1
- package/dist/components/waka-permission-matrix/index.cjs.js +2 -2
- package/dist/components/waka-permission-matrix/index.es.js +3 -2
- package/dist/components/waka-phone-input/index.cjs.js +1 -1
- package/dist/components/waka-phone-input/index.es.js +5 -3
- package/dist/components/waka-pipeline-view/index.cjs.js +2 -2
- package/dist/components/waka-pipeline-view/index.es.js +1 -1
- package/dist/components/waka-player-card/index.cjs.js +2 -2
- package/dist/components/waka-player-card/index.es.js +4 -4
- package/dist/components/waka-pod-card/index.cjs.js +1 -1
- package/dist/components/waka-pod-card/index.es.js +1 -1
- package/dist/components/waka-points-popup/index.cjs.js +1 -1
- package/dist/components/waka-points-popup/index.es.js +5 -1
- package/dist/components/waka-power-up/index.cjs.js +1 -1
- package/dist/components/waka-presence-indicator/index.cjs.js +2 -2
- package/dist/components/waka-presence-indicator/index.es.js +1 -1
- package/dist/components/waka-pricing-table/index.cjs.js +2 -2
- package/dist/components/waka-pricing-table/index.es.js +1 -1
- package/dist/components/waka-product-card/index.cjs.js +1 -1
- package/dist/components/waka-progress-onboarding/index.cjs.js +3 -3
- package/dist/components/waka-progress-onboarding/index.es.js +1 -1
- package/dist/components/waka-pull-to-refresh/index.cjs.js +1 -1
- package/dist/components/waka-qrcode/index.cjs.js +1 -1
- package/dist/components/waka-qrcode/index.es.js +1 -1
- package/dist/components/waka-query-explain/index.cjs.js +1 -1
- package/dist/components/waka-quest-card/index.cjs.js +2 -2
- package/dist/components/waka-quest-card/index.es.js +4 -1
- package/dist/components/waka-quota-bar/index.cjs.js +2 -2
- package/dist/components/waka-quota-bar/index.es.js +11 -4
- package/dist/components/waka-radar-score/index.cjs.js +1 -1
- package/dist/components/waka-radar-score/index.es.js +6 -6
- package/dist/components/waka-rank-badge/index.cjs.js +2 -2
- package/dist/components/waka-rank-badge/index.es.js +1 -1
- package/dist/components/waka-rating-input/index.cjs.js +2 -2
- package/dist/components/waka-rating-input/index.es.js +1 -1
- package/dist/components/waka-reaction-picker/index.cjs.js +1 -1
- package/dist/components/waka-reaction-picker/index.es.js +7 -4
- package/dist/components/waka-region-map/index.cjs.js +1 -1
- package/dist/components/waka-region-map/index.es.js +1 -1
- package/dist/components/waka-resource-gauge/index.cjs.js +2 -2
- package/dist/components/waka-resource-gauge/index.es.js +3 -3
- package/dist/components/waka-resource-pool/index.cjs.js +2 -2
- package/dist/components/waka-resource-pool/index.es.js +1 -1
- package/dist/components/waka-rich-text-editor/index.cjs.js +1 -1
- package/dist/components/waka-rich-text-editor/index.es.js +1 -1
- package/dist/components/waka-rollback-slider/index.cjs.js +2 -2
- package/dist/components/waka-rollback-slider/index.es.js +5 -3
- package/dist/components/waka-sankey-diagram/index.cjs.js +2 -2
- package/dist/components/waka-sankey-diagram/index.es.js +5 -5
- package/dist/components/waka-schedule-picker/index.cjs.js +1 -1
- package/dist/components/waka-schedule-picker/index.es.js +3 -2
- package/dist/components/waka-scratch-card/index.cjs.js +2 -2
- package/dist/components/waka-scratch-card/index.es.js +1 -1
- package/dist/components/waka-season-pass/index.cjs.js +1 -1
- package/dist/components/waka-secret-card/index.cjs.js +1 -1
- package/dist/components/waka-security-scan-result/index.cjs.js +1 -1
- package/dist/components/waka-security-score/index.cjs.js +2 -2
- package/dist/components/waka-security-score/index.es.js +5 -5
- package/dist/components/waka-segmented-control/index.cjs.js +1 -1
- package/dist/components/waka-segmented-control/index.es.js +1 -1
- package/dist/components/waka-server-rack/index.cjs.js +1 -1
- package/dist/components/waka-service-graph/index.cjs.js +1 -1
- package/dist/components/waka-session-manager/index.cjs.js +1 -1
- package/dist/components/waka-session-manager/index.es.js +3 -2
- package/dist/components/waka-signature-pad/index.cjs.js +1 -1
- package/dist/components/waka-signature-pad/index.es.js +1 -1
- package/dist/components/waka-skeleton-wave/index.cjs.js +1 -1
- package/dist/components/waka-skill-tree/index.cjs.js +2 -2
- package/dist/components/waka-skill-tree/index.es.js +32 -32
- package/dist/components/waka-sla-tracker/index.cjs.js +1 -1
- package/dist/components/waka-sla-tracker/index.es.js +1 -1
- package/dist/components/waka-slider-range/index.cjs.js +1 -1
- package/dist/components/waka-slider-range/index.es.js +3 -3
- package/dist/components/waka-spin-wheel/index.cjs.js +2 -2
- package/dist/components/waka-spin-wheel/index.es.js +6 -6
- package/dist/components/waka-spinner/index.cjs.js +1 -1
- package/dist/components/waka-sponsored-badge/index.cjs.js +1 -1
- package/dist/components/waka-sponsored-badge/index.es.js +1 -1
- package/dist/components/waka-sponsored-card/index.cjs.js +1 -1
- package/dist/components/waka-sponsored-card/index.es.js +2 -2
- package/dist/components/waka-sponsored-feed/index.cjs.js +1 -1
- package/dist/components/waka-sponsored-feed/index.es.js +2 -2
- package/dist/components/waka-spotlight/index.cjs.js +1 -1
- package/dist/components/waka-spotlight/index.es.js +2 -1
- package/dist/components/waka-stat/index.cjs.js +1 -1
- package/dist/components/waka-stat/index.es.js +1 -1
- package/dist/components/waka-stats-hexagon/index.cjs.js +1 -1
- package/dist/components/waka-stats-hexagon/index.es.js +9 -9
- package/dist/components/waka-status-matrix/index.cjs.js +1 -1
- package/dist/components/waka-status-matrix/index.es.js +1 -1
- package/dist/components/waka-stepper/index.cjs.js +1 -1
- package/dist/components/waka-stepper/index.es.js +1 -1
- package/dist/components/waka-streak-counter/index.cjs.js +1 -1
- package/dist/components/waka-success-explosion/index.cjs.js +1 -1
- package/dist/components/waka-swipe-card/index.cjs.js +1 -1
- package/dist/components/waka-swipe-card/index.es.js +2 -2
- package/dist/components/waka-tabs-morph/index.cjs.js +1 -1
- package/dist/components/waka-tabs-morph/index.es.js +1 -1
- package/dist/components/waka-tag-input/index.cjs.js +1 -1
- package/dist/components/waka-tag-input/index.es.js +3 -2
- package/dist/components/waka-team-banner/index.cjs.js +2 -2
- package/dist/components/waka-team-banner/index.es.js +1 -1
- package/dist/components/waka-terminal-output/index.cjs.js +2 -2
- package/dist/components/waka-terminal-output/index.es.js +5 -3
- package/dist/components/waka-test-report/index.cjs.js +1 -1
- package/dist/components/waka-theme-creator/index.cjs.js +1 -1
- package/dist/components/waka-theme-manager/index.cjs.js +1 -1
- package/dist/components/waka-theme-manager/index.es.js +5 -2
- package/dist/components/waka-thread-view/index.cjs.js +2 -2
- package/dist/components/waka-thread-view/index.es.js +1 -1
- package/dist/components/waka-tilt-card/index.cjs.js +1 -1
- package/dist/components/waka-tilt-card/index.es.js +8 -6
- package/dist/components/waka-time-picker/index.cjs.js +1 -1
- package/dist/components/waka-time-picker/index.es.js +10 -6
- package/dist/components/waka-timeline/index.cjs.js +1 -1
- package/dist/components/waka-timeline/index.es.js +1 -1
- package/dist/components/waka-tooltip-tour/index.cjs.js +3 -3
- package/dist/components/waka-tooltip-tour/index.es.js +53 -51
- package/dist/components/waka-tour-guide/index.cjs.js +2 -2
- package/dist/components/waka-tour-guide/index.es.js +1 -1
- package/dist/components/waka-tournament-bracket/index.cjs.js +2 -2
- package/dist/components/waka-tournament-bracket/index.es.js +1 -1
- package/dist/components/waka-trace-viewer/index.cjs.js +1 -1
- package/dist/components/waka-tree/index.cjs.js +1 -1
- package/dist/components/waka-tree/index.es.js +1 -1
- package/dist/components/waka-treemap-chart/index.cjs.js +1 -1
- package/dist/components/waka-treemap-chart/index.es.js +1 -1
- package/dist/components/waka-two-factor-setup/index.cjs.js +2 -2
- package/dist/components/waka-two-factor-setup/index.es.js +5 -4
- package/dist/components/waka-typewriter/index.cjs.js +1 -1
- package/dist/components/waka-typewriter/index.es.js +7 -2
- package/dist/components/waka-typing-indicator/index.cjs.js +2 -2
- package/dist/components/waka-typing-indicator/index.es.js +1 -1
- package/dist/components/waka-versus-card/index.cjs.js +3 -3
- package/dist/components/waka-versus-card/index.es.js +5 -4
- package/dist/components/waka-video/index.cjs.js +1 -1
- package/dist/components/waka-video/index.es.js +1 -1
- package/dist/components/waka-video-ad/index.cjs.js +1 -1
- package/dist/components/waka-video-ad/index.es.js +3 -3
- package/dist/components/waka-video-call/index.cjs.js +2 -2
- package/dist/components/waka-video-call/index.es.js +1 -1
- package/dist/components/waka-video-overlay/index.cjs.js +1 -1
- package/dist/components/waka-video-overlay/index.es.js +2 -2
- package/dist/components/waka-virtual-list/index.cjs.js +1 -1
- package/dist/components/waka-virtual-list/index.es.js +1 -1
- package/dist/components/waka-voice-message/index.cjs.js +1 -1
- package/dist/components/waka-voice-message/index.es.js +6 -5
- package/dist/components/waka-welcome-modal/index.cjs.js +2 -2
- package/dist/components/waka-welcome-modal/index.es.js +1 -1
- package/dist/components/waka-xp-bar/index.cjs.js +1 -1
- package/dist/components/waka-xp-bar/index.es.js +2 -2
- package/dist/context/admincrumb-context.cjs.js +1 -1
- package/dist/context/language-context.cjs.js +1 -1
- package/dist/context/language-context.es.js +2 -2
- package/dist/context/theme-context.cjs.js +1 -1
- package/dist/context/theme-provider.cjs.js +1 -1
- package/dist/context/theme-provider.es.js +9 -6
- package/dist/context/waka-provider.cjs.js +1 -1
- package/dist/context/waka-provider.es.js +57 -53
- package/dist/doc.cjs.js +1 -1
- package/dist/editor.cjs.js +1 -1
- package/dist/export.cjs.js +1 -1
- package/dist/hooks/use-toast.cjs.js +1 -1
- package/dist/hooks/use-translation.cjs.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +279 -278
- package/dist/lib/i18n.cjs.js +1 -1
- package/dist/lib/i18n.es.js +11 -9
- package/dist/locales/default-resources.cjs.js +1 -0
- package/dist/locales/default-resources.d.ts +155 -0
- package/dist/locales/default-resources.es.js +150 -0
- package/dist/node_modules/.pnpm/exceljs@4.4.0/node_modules/exceljs/dist/exceljs.min.cjs.js +13 -13
- package/dist/node_modules/.pnpm/exceljs@4.4.0/node_modules/exceljs/dist/exceljs.min.es.js +13 -13
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-docker.cjs.js +1 -1
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-docker.es.js +19 -19
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-markdown.cjs.js +1 -1
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-markdown.es.js +24 -25
- package/dist/node_modules/.pnpm/react-resizable-panels@4.11.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-resizable-panels/dist/react-resizable-panels.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-resizable-panels@4.11.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-resizable-panels/dist/react-resizable-panels.es.js +26 -23
- package/dist/rich-text.cjs.js +1 -1
- package/dist/ui.css +1 -1
- package/dist/utils/cn.cjs.js +1 -1
- package/dist/utils/datetime-helpers.cjs.js +1 -1
- package/dist/utils/theme-loader.cjs.js +1 -1
- package/dist/utils/tweak.cjs.js +1 -1
- package/package.json +28 -27
- package/src/components/DataTable/DataTable.tsx +2 -0
- package/src/components/DataTable/DataTablePagination.tsx +28 -8
- package/src/components/DataTable/hooks/useDataTable.ts +13 -0
- package/src/components/editor/blocks/waka-diagram-block.tsx +7 -36
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={low:{shakeIntensity:1,glowOpacity:.2,particleCount:0,pulseSpeed:`2s`,showFlames:!1,showSparks:!1,bgGlow:`rgba(251, 146, 60, 0.1)`},medium:{shakeIntensity:2,glowOpacity:.4,particleCount:4,pulseSpeed:`1.5s`,showFlames:!0,showSparks:!1,bgGlow:`rgba(251, 146, 60, 0.2)`},high:{shakeIntensity:3,glowOpacity:.6,particleCount:8,pulseSpeed:`1s`,showFlames:!0,showSparks:!0,bgGlow:`rgba(251, 146, 60, 0.3)`},extreme:{shakeIntensity:5,glowOpacity:.9,particleCount:16,pulseSpeed:`0.5s`,showFlames:!0,showSparks:!0,bgGlow:`rgba(239, 68, 68, 0.4)`}},o={sm:{container:`h-20 w-32`,comboText:`text-3xl`,multiplierBadge:`text-xs px-1.5 py-0.5`,timerHeight:`h-1`,iconSize:`h-4 w-4`,padding:`p-2`},md:{container:`h-28 w-44`,comboText:`text-5xl`,multiplierBadge:`text-sm px-2 py-1`,timerHeight:`h-1.5`,iconSize:`h-5 w-5`,padding:`p-3`},lg:{container:`h-36 w-56`,comboText:`text-6xl`,multiplierBadge:`text-base px-2.5 py-1`,timerHeight:`h-2`,iconSize:`h-6 w-6`,padding:`p-4`},xl:{container:`h-48 w-72`,comboText:`text-8xl`,multiplierBadge:`text-lg px-3 py-1.5`,timerHeight:`h-2.5`,iconSize:`h-8 w-8`,padding:`p-6`}};function s({intensity:e,active:n}){let o=a[e];if(!n||!o.showFlames)return null;let s=e===`extreme`?7:e===`high`?5:3;return(0,i.jsx)(`div`,{className:`absolute -bottom-1 left-0 right-0 flex justify-center pointer-events-none`,children:[...Array(s)].map((n,a)=>{let o=(a-Math.floor(s/2))*100/s,c=a*.08,l=.6+Math.random()*.4;return(0,i.jsx)(`div`,{className:`absolute animate-flame`,style:{left:`calc(50% + ${o}%)`,animationDelay:`${c}s`,transform:`translateX(-50%) scale(${l})`},children:(0,i.jsx)(r.Flame,{className:t.cn(`text-orange-500`,e===`extreme`&&`text-red-500`,e===`high`&&`text-orange-400`),style:{filter:`drop-shadow(0 0 ${e===`extreme`?12:8}px ${e===`extreme`?`#ef4444`:`#f97316`})`,height:e===`extreme`?28:e===`high`?24:20,width:e===`extreme`?28:e===`high`?24:20}})},a)})})}function c({intensity:e,active:n}){let o=a[e];return!n||!o.showSparks?null:(0,i.jsx)(`div`,{className:`absolute inset-0 pointer-events-none overflow-hidden`,children:[...Array(o.particleCount)].map((n,a)=>(0,i.jsx)(`div`,{className:`absolute animate-spark`,style:{left:`${10+Math.random()*80}%`,top:`${20+Math.random()*60}%`,animationDelay:`${Math.random()*2}s`,animationDuration:`${.5+Math.random()*.5}s`},children:(0,i.jsx)(r.Zap,{className:t.cn(`text-yellow-400`,e===`extreme`&&`text-yellow-300`),style:{height:8+Math.random()*8,width:8+Math.random()*8,filter:`drop-shadow(0 0 4px #fbbf24)`}})},a))})}function l({intensity:e,active:t}){return!t||e===`low`?null:(0,i.jsxs)(`div`,{className:`absolute inset-0 pointer-events-none`,children:[(0,i.jsx)(`div`,{className:`absolute inset-0 rounded-xl animate-energy-ring`,style:{background:`linear-gradient(135deg, transparent, ${e===`extreme`?`rgba(239, 68, 68, 0.3)`:`rgba(251, 146, 60, 0.2)`}, transparent)`}}),e===`extreme`&&(0,i.jsx)(`div`,{className:`absolute inset-0 rounded-xl animate-energy-ring-alt`,style:{background:`linear-gradient(225deg, transparent, rgba(239, 68, 68, 0.2), transparent)`,animationDelay:`0.5s`}})]})}function u({active:e,milestone:t}){return e?(0,i.jsxs)(`div`,{className:`absolute inset-0 pointer-events-none overflow-hidden`,children:[[...Array(20)].map((e,t)=>{let n=t/20*360,a=80+Math.random()*40;return(0,i.jsx)(`div`,{className:`absolute left-1/2 top-1/2 animate-milestone-burst`,style:{"--angle":`${n}deg`,"--distance":`${a}px`,animationDelay:`${Math.random()*.1}s`},children:(0,i.jsx)(r.Star,{className:`h-3 w-3 text-yellow-400 fill-yellow-400`,style:{filter:`drop-shadow(0 0 4px #fbbf24)`}})},t)}),(0,i.jsx)(`div`,{className:`absolute top-0 left-1/2 -translate-x-1/2 -translate-y-full animate-milestone-badge`,children:(0,i.jsxs)(`div`,{className:`bg-gradient-to-r from-yellow-400 via-orange-500 to-red-500 text-white px-4 py-2 rounded-full font-bold text-lg shadow-lg`,children:[t,` COMBO!`]})}),(0,i.jsx)(`div`,{className:`absolute inset-0 bg-white/30 animate-flash rounded-xl`})]}):null}function d({active:e}){return e?(0,i.jsxs)(`div`,{className:`absolute inset-0 pointer-events-none overflow-hidden rounded-xl`,children:[[...Array(12)].map((e,t)=>{let n=t/12*360,r=20+Math.random()*20;return(0,i.jsx)(`div`,{className:`absolute left-1/2 top-1/2 animate-shatter`,style:{"--angle":`${n}deg`,"--distance":`${100+Math.random()*50}px`,width:r,height:r,background:`linear-gradient(135deg, #ef4444, #991b1b)`,borderRadius:Math.random()>.5?`2px`:`50%`,animationDelay:`${Math.random()*.1}s`}},t)}),(0,i.jsx)(`div`,{className:`absolute inset-0 bg-red-500/40 animate-flash-red rounded-xl`})]}):null}function f({timeRemaining:e,size:n,intensity:r}){let a=o[n],s=e<30,c=e<15;return(0,i.jsx)(`div`,{className:t.cn(`w-full rounded-full bg-muted overflow-hidden`,a.timerHeight),children:(0,i.jsx)(`div`,{className:t.cn(`h-full rounded-full transition-all duration-100`,c?`bg-gradient-to-r from-red-600 to-red-400 animate-pulse-fast`:s?`bg-gradient-to-r from-orange-500 to-yellow-400`:`bg-gradient-to-r from-green-500 to-emerald-400`),style:{width:`${e}%`,boxShadow:c?`0 0 10px rgba(239, 68, 68, 0.6)`:s?`0 0 8px rgba(251, 146, 60, 0.5)`:`0 0 6px rgba(34, 197, 94, 0.4)`}})})}function p({multiplier:e,maxMultiplier:n,size:r,animated:a}){let s=o[r],c=e>=n;return(0,i.jsxs)(`div`,{className:t.cn(`absolute -top-2 -right-2 rounded-full font-bold shadow-lg`,s.multiplierBadge,c?`bg-gradient-to-r from-purple-500 via-pink-500 to-red-500 text-white animate-rainbow-pulse`:`bg-gradient-to-r from-orange-500 to-yellow-400 text-white`,a&&`animate-bounce-subtle`),style:{boxShadow:c?`0 0 20px rgba(168, 85, 247, 0.6)`:`0 0 12px rgba(251, 146, 60, 0.5)`},children:[`x`,e,c&&(0,i.jsx)(`span`,{className:`ml-1 text-yellow-300`,children:`MAX`})]})}function m({combo:e,multiplier:r=1,maxMultiplier:m=10,timeRemaining:h=100,onComboBreak:g,milestones:_=[10,25,50,100],onMilestone:v,size:y=`md`,showTimer:b=!0,showMultiplier:x=!0,intensity:S=`medium`,animated:C=!0,className:w,onPlayIncrementSound:T,onPlayMilestoneSound:E,onPlayBreakSound:D}){let[O,k]=n.useState(e),[A,j]=n.useState(!1),[M,N]=n.useState(!1),[P,F]=n.useState(0),[I,L]=n.useState(!1),R=n.useRef(e),z=n.useRef(h),B=n.useRef(new Set),V=o[y],H=a[S],U=n.useMemo(()=>S===`low`?e>=100?`extreme`:e>=50?`high`:e>=25?`medium`:`low`:S,[e,S]);return n.useEffect(()=>{let t=R.current;if(e>t&&C){j(!0),T?.();let n=e-t,r=Math.min(n,10),i=n/r,a=0,o=setInterval(()=>{a++,k(Math.round(t+i*a)),a>=r&&(clearInterval(o),k(e))},30);setTimeout(()=>j(!1),200);let s=_.find(n=>e>=n&&t<n&&!B.current.has(n));return s&&(B.current.add(s),F(s),N(!0),v?.(s),E?.(),setTimeout(()=>N(!1),1500)),()=>clearInterval(o)}else e<t?(k(e),e===0&&t>0&&(L(!0),g?.(),D?.(),B.current.clear(),setTimeout(()=>L(!1),600))):k(e);R.current=e},[e,C,_,v,g,T,E,D]),n.useEffect(()=>{let t=z.current;h===0&&t>0&&e>0&&(g?.(),D?.()),z.current=h},[h,e,g,D]),(0,i.jsxs)(`div`,{className:t.cn(`relative inline-block`,w),children:[(0,i.jsxs)(`div`,{className:t.cn(`relative flex flex-col items-center justify-center rounded-xl border-2 overflow-hidden`,V.container,V.padding,C&&A&&`animate-shake`,C&&S!==`low`&&`animate-pulse-glow`),style:{background:`radial-gradient(ellipse at center, ${H.bgGlow}, transparent)`,borderColor:S===`extreme`?`#ef4444`:S===`high`?`#f97316`:`#fbbf24`,boxShadow:`0 0 ${S===`extreme`?30:S===`high`?20:10}px ${H.bgGlow}`},children:[(0,i.jsx)(l,{intensity:U,active:C&&e>0}),(0,i.jsx)(c,{intensity:U,active:C&&e>0}),(0,i.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-widest text-muted-foreground mb-1`,children:`Combo`}),(0,i.jsx)(`div`,{className:t.cn(`font-black tabular-nums leading-none`,V.comboText,C&&`transition-transform duration-100`,A&&`scale-110`),style:{textShadow:S===`low`?`none`:`0 0 ${S===`extreme`?20:12}px ${S===`extreme`?`#ef4444`:`#f97316`}`,color:S===`extreme`?`#fef2f2`:S===`high`?`#fff7ed`:`inherit`},children:O}),b&&(0,i.jsx)(`div`,{className:`w-full mt-2`,children:(0,i.jsx)(f,{timeRemaining:h,size:y,intensity:U})}),(0,i.jsx)(s,{intensity:U,active:C&&e>0}),(0,i.jsx)(u,{active:M,milestone:P}),(0,i.jsx)(d,{active:I})]}),x&&r>1&&(0,i.jsx)(p,{multiplier:r,maxMultiplier:m,size:y,animated:C}),(0,i.jsx)(`style`,{children:`
|
|
2
2
|
@keyframes shake {
|
|
3
3
|
0%, 100% { transform: translateX(0); }
|
|
4
4
|
10% { transform: translateX(-4px) rotate(-1deg); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../badge/index.cjs.js"),r=require("../button/index.cjs.js"),i=require("../command/index.cjs.js"),a=require("../popover/index.cjs.js");let o=require("react");o=e.__toESM(o);let s=require("lucide-react"),c=require("react/jsx-runtime");function l(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function u({options:e,value:u,onChange:d,placeholder:f=`Sélectionner...`,searchPlaceholder:p=`Rechercher...`,emptyMessage:m=`Aucun résultat trouvé.`,multiple:h=!1,creatable:g=!1,onCreate:_,createLabel:v=`Créer`,onSearch:y,searchDebounce:b=300,disabled:x=!1,error:S=!1,loading:C=!1,size:w=`md`,clearable:T=!0,maxSelections:E,className:D,id:O,name:k}){let[A,j]=o.useState(!1),[M,N]=o.useState(``),[P,F]=o.useState(e),[I,L]=o.useState(!1),[R,z]=o.useState([]),B=C||I;o.useEffect(()=>{y||F(e)},[e,y]),o.useEffect(()=>{if(!y)return;let e=setTimeout(async()=>{L(!0);try{let e=await y(M);F(e)}catch(e){console.error(`Search error:`,e)}finally{L(!1)}},b);return()=>clearTimeout(e)},[M,y,b]);let V=o.useMemo(()=>[...P,...R],[P,R]),H=o.useMemo(()=>{if(y||!M)return V;let e=M.toLowerCase();return V.filter(t=>t.label.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[V,M,y]),U=o.useMemo(()=>u===void 0?[]:Array.isArray(u)?u:[u],[u]),W=o.useMemo(()=>V.filter(e=>U.some(t=>t===e.value)),[V,U]),G=e=>{if(!e.disabled)if(h){let t=U.includes(e.value),n;if(t)n=U.filter(t=>t!==e.value);else{if(E&&U.length>=E)return;n=[...U,e.value]}d?.(n.length>0?n:void 0)}else U.includes(e.value)?d?.(void 0):d?.(e.value),j(!1)},K=async()=>{if(!(!g||!M.trim())){L(!0);try{let e;e=_?await _(M.trim()):{value:M.trim(),label:M.trim()},z(t=>[...t,e]),G(e),N(``)}catch(e){console.error(`Creation error:`,e)}finally{L(!1)}}},q=e=>{e.stopPropagation(),d?.(void 0),N(``)},J=e=>{if(h){let t=U.filter(t=>t!==e);d?.(t.length>0?t:void 0)}},Y=o.useMemo(()=>{if(!g||!M.trim())return!1;let e=M.trim().toLowerCase();return!V.some(t=>t.label.toLowerCase()===e)},[g,M,V]),X=o.useMemo(()=>l(H),[H]),Z=o.useMemo(()=>W.length===0?``:h?`${W.length} sélectionné${W.length>1?`s`:``}`:W[0]?.label||``,[W,h]),Q={sm:`h-8 text-xs`,md:`h-9 text-sm`,lg:`h-10 text-base`},$={sm:`h-3 w-3`,md:`h-4 w-4`,lg:`h-5 w-5`};return(0,c.jsxs)(a.Popover,{open:A,onOpenChange:j,children:[(0,c.jsx)(a.PopoverTrigger,{asChild:!0,children:(0,c.jsxs)(r.Button,{id:O,variant:`outline`,role:`combobox`,"aria-expanded":A,disabled:x,className:t.cn(`w-full justify-between font-normal`,Q[w],!Z&&`text-muted-foreground`,S&&`border-destructive focus-visible:ring-destructive`,D),children:[(0,c.jsx)(`span`,{className:`flex-1 text-left truncate`,children:Z||f}),(0,c.jsxs)(`div`,{className:`flex items-center gap-1 ml-2`,children:[B&&(0,c.jsx)(s.Loader2,{className:t.cn($[w],`animate-spin`)}),T&&U.length>0&&!x&&(0,c.jsx)(s.X,{className:t.cn($[w],`opacity-50 hover:opacity-100`),onClick:q}),(0,c.jsx)(s.ChevronsUpDown,{className:t.cn($[w],`opacity-50`)})]})]})}),(0,c.jsx)(a.PopoverContent,{className:`w-[--radix-popover-trigger-width] p-0`,align:`start`,children:(0,c.jsxs)(i.Command,{shouldFilter:!1,children:[(0,c.jsx)(i.CommandInput,{placeholder:p,value:M,onValueChange:N}),(0,c.jsxs)(i.CommandList,{children:[B&&(0,c.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,c.jsx)(s.Loader2,{className:`h-5 w-5 animate-spin text-muted-foreground`})}),!B&&H.length===0&&!Y&&(0,c.jsx)(i.CommandEmpty,{children:m}),!B&&Array.from(X.entries()).map(([e,n],r)=>(0,c.jsxs)(o.Fragment,{children:[r>0&&(0,c.jsx)(i.CommandSeparator,{}),(0,c.jsx)(i.CommandGroup,{heading:e,children:n.map(e=>{let n=U.includes(e.value);return(0,c.jsxs)(i.CommandItem,{value:String(e.value),onSelect:()=>G(e),disabled:e.disabled||h&&!!E&&U.length>=E&&!n,className:t.cn(`flex items-center gap-2`,e.disabled&&`opacity-50`),children:[(0,c.jsx)(`div`,{className:t.cn(`flex items-center justify-center w-4 h-4 border rounded`,n?`bg-primary border-primary text-primary-foreground`:`border-muted-foreground/30`),children:n&&(0,c.jsx)(s.Check,{className:`h-3 w-3`})}),e.icon&&(0,c.jsx)(`span`,{className:`flex-shrink-0`,children:e.icon}),(0,c.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,c.jsx)(`div`,{className:`truncate`,children:e.label}),e.description&&(0,c.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:e.description})]})]},String(e.value))})})]},e||`ungrouped`)),Y&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(i.CommandSeparator,{}),(0,c.jsx)(i.CommandGroup,{children:(0,c.jsxs)(i.CommandItem,{onSelect:K,className:`flex items-center gap-2`,children:[(0,c.jsx)(s.Plus,{className:$[w]}),(0,c.jsxs)(`span`,{children:[v,` "`,M.trim(),`"`]})]})})]})]})]})}),k&&(0,c.jsx)(`input`,{type:`hidden`,name:k,value:h?U.join(`,`):String(U[0]||``)}),h&&W.length>0&&(0,c.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:W.map(e=>(0,c.jsxs)(n.Badge,{variant:`secondary`,className:`gap-1`,children:[e.icon,e.label,(0,c.jsx)(s.X,{className:`h-3 w-3 cursor-pointer hover:text-destructive`,onClick:()=>J(e.value)})]},String(e.value)))})]})}function d(e={}){let{options:t=[],initialValue:n,multiple:r=!1}=e,[i,a]=o.useState(n),[s,c]=o.useState(t);return{value:i,onChange:a,options:s,setOptions:c,clear:()=>a(void 0),addOption:e=>{c(t=>[...t,e])},removeOption:e=>{c(t=>t.filter(t=>t.value!==e)),r&&Array.isArray(i)?a(i.filter(t=>t!==e)):i===e&&a(void 0)},selectAll:()=>{r&&a(s.filter(e=>!e.disabled).map(e=>e.value))},selectNone:()=>a(r?[]:void 0),multiple:r}}exports.WakaCombobox=u,exports.default=u,exports.useCombobox=d;
|
|
@@ -26,7 +26,8 @@ function y({ options: y, value: b, onChange: x, placeholder: ie = "Sélectionner
|
|
|
26
26
|
let e = setTimeout(async () => {
|
|
27
27
|
H(!0);
|
|
28
28
|
try {
|
|
29
|
-
|
|
29
|
+
let e = await E(L);
|
|
30
|
+
B(e);
|
|
30
31
|
} catch (e) {
|
|
31
32
|
console.error("Search error:", e);
|
|
32
33
|
} finally {
|
|
@@ -230,4 +231,4 @@ function b(e = {}) {
|
|
|
230
231
|
};
|
|
231
232
|
}
|
|
232
233
|
//#endregion
|
|
233
|
-
export { y as default, b as useCombobox };
|
|
234
|
+
export { y as WakaCombobox, y as default, b as useCombobox };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../../utils/security.cjs.js");let r=require("react");r=e.__toESM(r);let i=require("lucide-react"),a=require("react/jsx-runtime");function o(e,t){if(!t)return{match:!0,score:1};let n=e.toLowerCase(),r=t.toLowerCase();if(n.includes(r))return{match:!0,score:n.indexOf(r)===0?1:.8};let i=0,a=0,o=0;for(let e=0;e<n.length&&i<r.length;e++)n[e]===r[i]?(a+=1+o*.5,o++,i++):o=0;let s=i===r.length;return{match:s,score:s?a/r.length:0}}function s(e,t){return t?e.map(e=>{let n=o(e.label,t),r=e.description?o(e.description,t):{match:!1,score:0},i=e.keywords?.some(e=>o(e,t).match)?{match:!0,score:.5}:{match:!1,score:0};return{item:e,score:Math.max(n.score,r.score*.7,i.score),matched:n.match||r.match||i.match}}).filter(e=>e.matched).sort((e,t)=>t.score-e.score).map(e=>e.item):e}function c({open:e,onOpenChange:t,items:o,placeholder:c=`Type a command or search...`,onSelect:u,emptyMessage:d=`No results found.`,recentItems:f,footer:p,shortcut:m=[`⌘`,`K`]}){let[h,g]=r.useState(``),[_,v]=r.useState(0),y=r.useRef(null),b=r.useRef(null),x=o.length>0&&`items`in o[0],S=r.useMemo(()=>x?o.flatMap(e=>e.items.map(t=>({...t,category:e.label}))):o,[o,x]),C=r.useMemo(()=>s(S,h),[S,h]),w=r.useMemo(()=>!x||h?[{label:h?`Results`:`Commands`,items:C}]:o,[o,x,C,h]),T=r.useMemo(()=>w.flatMap(e=>e.items),[w]);r.useEffect(()=>{if(!e)return;let n=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),v(e=>Math.min(e+1,T.length-1));break;case`ArrowUp`:e.preventDefault(),v(e=>Math.max(e-1,0));break;case`Enter`:e.preventDefault();let n=T[_];n&&E(n);break;case`Escape`:e.preventDefault(),t(!1);break}};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,_,T,t]),r.useEffect(()=>{e&&(g(``),v(0),setTimeout(()=>y.current?.focus(),0))},[e]),r.useEffect(()=>{(b.current?.querySelector(`[data-index="${_}"]`))?.scrollIntoView({block:`nearest`})},[_]),r.useEffect(()=>{let n=n=>{(n.metaKey||n.ctrlKey)&&n.key===`k`&&(n.preventDefault(),t(!e))};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]);let E=e=>{u?.(e),e.action?.(),e.href&&n.safeNavigate(e.href),t(!1)};if(!e)return null;let D=-1;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/50 backdrop-blur-sm animate-in fade-in-0`,onClick:()=>t(!1)}),(0,a.jsx)(`div`,{className:`fixed left-1/2 top-[20%] z-50 w-full max-w-xl -translate-x-1/2 animate-in fade-in-0 zoom-in-95 slide-in-from-top-2`,children:(0,a.jsxs)(`div`,{className:`overflow-hidden rounded-xl border bg-popover shadow-2xl`,children:[(0,a.jsxs)(`div`,{className:`flex items-center border-b px-4`,children:[(0,a.jsx)(i.Search,{className:`h-5 w-5 shrink-0 text-muted-foreground`}),(0,a.jsx)(`input`,{ref:y,type:`text`,value:h,onChange:e=>{g(e.target.value),v(0)},placeholder:c,className:`flex-1 bg-transparent py-4 px-3 text-sm outline-none placeholder:text-muted-foreground`}),(0,a.jsx)(`kbd`,{className:`hidden sm:inline-flex h-6 items-center gap-1 rounded border bg-muted px-2 text-xs text-muted-foreground`,children:`ESC`})]}),(0,a.jsxs)(`div`,{ref:b,className:`max-h-80 overflow-y-auto p-2`,children:[!h&&f&&f.length>0&&(0,a.jsxs)(`div`,{className:`mb-2`,children:[(0,a.jsx)(`div`,{className:`px-2 py-1.5 text-xs font-medium text-muted-foreground`,children:`Recent`}),f.map(e=>{D++;let t=D;return(0,a.jsx)(l,{item:e,selected:_===t,dataIndex:t,onSelect:()=>E(e),onHover:()=>v(t)},`recent-${e.id}`)})]}),w.map(e=>(0,a.jsxs)(`div`,{className:`mb-2`,children:[(0,a.jsx)(`div`,{className:`px-2 py-1.5 text-xs font-medium text-muted-foreground`,children:e.label}),e.items.length===0?(0,a.jsx)(`div`,{className:`px-2 py-8 text-center text-sm text-muted-foreground`,children:d}):e.items.map(e=>{D++;let t=D;return(0,a.jsx)(l,{item:e,selected:_===t,dataIndex:t,onSelect:()=>E(e),onHover:()=>v(t)},e.id)})]},e.label))]}),(0,a.jsx)(`div`,{className:`flex items-center justify-between border-t bg-muted/50 px-4 py-2 text-xs text-muted-foreground`,children:p||(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,a.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,a.jsx)(`kbd`,{className:`rounded border bg-background px-1.5 py-0.5`,children:`↑↓`}),`Navigate`]}),(0,a.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,a.jsx)(`kbd`,{className:`rounded border bg-background px-1.5 py-0.5`,children:`↵`}),`Select`]})]}),(0,a.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,a.jsx)(`kbd`,{className:`rounded border bg-background px-1.5 py-0.5`,children:`ESC`}),`Close`]})]})})]})})]})}function l({item:e,selected:n,dataIndex:r,onSelect:o,onHover:s}){return(0,a.jsxs)(`button`,{"data-index":r,onClick:o,onMouseEnter:s,className:t.cn(`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-sm transition-colors`,n?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:[e.icon&&(0,a.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border bg-background`,children:e.icon}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsx)(`div`,{className:`font-medium truncate`,children:e.label}),e.description&&(0,a.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:e.description})]}),e.shortcut&&(0,a.jsx)(`div`,{className:`flex items-center gap-1 shrink-0`,children:e.shortcut.map((e,t)=>(0,a.jsx)(`kbd`,{className:`rounded border bg-muted px-1.5 py-0.5 text-xs`,children:e},t))}),n&&!e.shortcut&&(0,a.jsx)(i.CornerDownLeft,{className:`h-4 w-4 shrink-0 text-muted-foreground`})]})}function u(){let[e,t]=r.useState(!1);return{open:e,onOpenChange:t,openCommandBar:()=>t(!0),closeCommandBar:()=>t(!1),toggleCommandBar:()=>t(e=>!e)}}exports.WakaCommandBar=c,exports.useCommandBar=u;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={default:{bar:`bg-primary`,barBg:`bg-primary/20`,text:`text-primary`,icon:`text-primary`},blue:{bar:`bg-blue-500`,barBg:`bg-blue-500/20`,text:`text-blue-600`,icon:`text-blue-500`},green:{bar:`bg-green-500`,barBg:`bg-green-500/20`,text:`text-green-600`,icon:`text-green-500`},purple:{bar:`bg-purple-500`,barBg:`bg-purple-500/20`,text:`text-purple-600`,icon:`text-purple-500`},orange:{bar:`bg-orange-500`,barBg:`bg-orange-500/20`,text:`text-orange-600`,icon:`text-orange-500`},red:{bar:`bg-red-500`,barBg:`bg-red-500/20`,text:`text-red-600`,icon:`text-red-500`}},o={last_week:{label:`vs Last Week`,shortLabel:`Week`},last_month:{label:`vs Last Month`,shortLabel:`Month`},last_quarter:{label:`vs Last Quarter`,shortLabel:`Quarter`},last_year:{label:`vs Last Year`,shortLabel:`Year`},custom:{label:`Custom Range`,shortLabel:`Custom`}};function s(e,t){if(t===0)return{percentage:e>0?100:0,absolute:e,direction:e>0?`up`:e<0?`down`:`neutral`};let n=e-t,r=(e-t)/Math.abs(t)*100,i=`neutral`;return r>.01?i=`up`:r<-.01&&(i=`down`),{percentage:r,absolute:n,direction:i}}function c(e){return`${e>=0?`+`:``}${e.toFixed(1)}%`}function l(e,t,n){let r=e>=0?`+`:``,i=t?t(Math.abs(e)):Math.abs(e).toLocaleString();return`${r}${e<0?`-`:``}${i}${n||``}`}function u(e){return e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function d(e,t=new Date){let n=new Date(t);n.setHours(23,59,59,999);let r,i=n,a,o;switch(e){case`last_week`:r=new Date(n),r.setDate(n.getDate()-6),r.setHours(0,0,0,0),o=new Date(r),o.setDate(o.getDate()-1),o.setHours(23,59,59,999),a=new Date(o),a.setDate(o.getDate()-6),a.setHours(0,0,0,0);break;case`last_month`:r=new Date(n),r.setDate(n.getDate()-29),r.setHours(0,0,0,0),o=new Date(r),o.setDate(o.getDate()-1),o.setHours(23,59,59,999),a=new Date(o),a.setDate(o.getDate()-29),a.setHours(0,0,0,0);break;case`last_quarter`:r=new Date(n),r.setDate(n.getDate()-89),r.setHours(0,0,0,0),o=new Date(r),o.setDate(o.getDate()-1),o.setHours(23,59,59,999),a=new Date(o),a.setDate(o.getDate()-89),a.setHours(0,0,0,0);break;case`last_year`:r=new Date(n),r.setFullYear(n.getFullYear()-1),r.setHours(0,0,0,0),o=new Date(r),o.setDate(o.getDate()-1),o.setHours(23,59,59,999),a=new Date(o),a.setFullYear(o.getFullYear()-1),a.setHours(0,0,0,0);break;default:r=new Date(n),r.setDate(n.getDate()-6),r.setHours(0,0,0,0),o=new Date(r),o.setDate(o.getDate()-1),o.setHours(23,59,59,999),a=new Date(o),a.setDate(o.getDate()-6),a.setHours(0,0,0,0)}return{current:{start:r,end:i,label:`${u(r)} - ${u(i)}`},previous:{start:a,end:o,label:`${u(a)} - ${u(o)}`}}}function f({direction:e,invert:n=!1,size:a=`md`,animated:o=!0}){let s=n?e===`down`:e===`up`,c=n?e===`up`:e===`down`,l={sm:`h-3 w-3`,md:`h-4 w-4`,lg:`h-5 w-5`},u=e===`up`?r.TrendingUp:e===`down`?r.TrendingDown:r.Minus;return(0,i.jsxs)(`div`,{className:t.cn(`flex items-center justify-center transition-transform duration-300`,s&&`text-green-600`,c&&`text-red-600`,e===`neutral`&&`text-muted-foreground`,o&&e===`up`&&`animate-trend-up`,o&&e===`down`&&`animate-trend-down`),children:[(0,i.jsx)(u,{className:l[a]}),(0,i.jsx)(`style`,{children:`
|
|
2
2
|
@keyframes trend-up {
|
|
3
3
|
0%, 100% { transform: translateY(0); }
|
|
4
4
|
50% { transform: translateY(-2px); }
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
.animate-trend-down {
|
|
14
14
|
animation: trend-down 2s ease-in-out infinite;
|
|
15
15
|
}
|
|
16
|
-
`})]})}function p({value:e,format:r,unit:a,className:o,animated:s=!0}){let[c,l]=n.useState(e),u=n.useRef(e);n.useEffect(()=>{if(!s||e===u.current){l(e),u.current=e;return}let t=u.current,n=e,r=performance.now(),i=e=>{let a=e-r,o=Math.min(a/500,1),s=1-(1-o)**3;l(t+(n-t)*s),o<1&&requestAnimationFrame(i)};requestAnimationFrame(i),u.current=e},[e,s]);let d=r?r(c):Number.isInteger(c)?c.toLocaleString():c.toLocaleString(void 0,{maximumFractionDigits:2});return(0,i.jsxs)(`span`,{className:t.cn(`tabular-nums`,o),children:[d,a&&(0,i.jsx)(`span`,{className:`text-muted-foreground ml-0.5`,children:a})]})}function m({current:e,previous:r,color:o=`default`,animated:s=!0}){let[c,l]=n.useState(!s),u=Math.max(e,r,1),d=e/u*100,f=r/u*100;n.useEffect(()=>{if(s){let e=setTimeout(()=>l(!0),100);return()=>clearTimeout(e)}},[s]);let p=a[o];return(0,i.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`span`,{className:`text-[10px] text-muted-foreground w-12`,children:`Current`}),(0,i.jsx)(`div`,{className:`flex-1 h-2 rounded-full bg-muted overflow-hidden`,children:(0,i.jsx)(`div`,{className:t.cn(`h-full rounded-full transition-all duration-700 ease-out`,p.bar),style:{width:c?`${d}%`:`0%`}})})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`span`,{className:`text-[10px] text-muted-foreground w-12`,children:`Previous`}),(0,i.jsx)(`div`,{className:`flex-1 h-2 rounded-full bg-muted overflow-hidden`,children:(0,i.jsx)(`div`,{className:t.cn(`h-full rounded-full transition-all duration-700 ease-out opacity-50`,p.bar),style:{width:c?`${f}%`:`0%`}})})]})]})}function h({selectedPreset:e,onSelect:a,currentPeriod:s,previousPeriod:c,className:l}){let[u,d]=n.useState(!1),f=n.useRef(null);return n.useEffect(()=>{function e(e){f.current&&!f.current.contains(e.target)&&d(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,i.jsxs)(`div`,{ref:f,className:t.cn(`relative`,l),children:[(0,i.jsxs)(`button`,{type:`button`,onClick:()=>d(!u),className:t.cn(`flex items-center gap-2 px-3 py-2 rounded-lg border bg-card`,`text-sm font-medium transition-colors`,`hover:bg-muted focus:outline-none focus:ring-2 focus:ring-primary/20`,u&&`ring-2 ring-primary/20`),children:[(0,i.jsx)(r.Calendar,{className:`h-4 w-4 text-muted-foreground`}),(0,i.jsx)(`span`,{children:o[e].label}),(0,i.jsx)(r.ChevronDown,{className:t.cn(`h-4 w-4 text-muted-foreground transition-transform duration-200`,u&&`rotate-180`)})]}),u&&(0,i.jsxs)(`div`,{className:t.cn(`absolute top-full right-0 mt-2 z-50 min-w-[280px]`,`rounded-lg border bg-card shadow-lg`,`animate-in fade-in-0 zoom-in-95 duration-100`),children:[(0,i.jsx)(`div`,{className:`p-3 border-b`,children:(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,i.jsxs)(`div`,{className:`flex-1 text-center`,children:[(0,i.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground mb-1`,children:`Current`}),(0,i.jsx)(`div`,{className:`font-medium`,children:s.label})]}),(0,i.jsx)(r.ArrowRight,{className:`h-4 w-4 text-muted-foreground`}),(0,i.jsxs)(`div`,{className:`flex-1 text-center`,children:[(0,i.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground mb-1`,children:`Previous`}),(0,i.jsx)(`div`,{className:`font-medium`,children:c.label})]})]})}),(0,i.jsx)(`div`,{className:`p-1`,children:[`last_week`,`last_month`,`last_quarter`,`last_year`,`custom`].map(n=>(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{a(n),d(!1)},className:t.cn(`flex items-center justify-between w-full px-3 py-2 rounded-md text-sm`,`transition-colors hover:bg-muted`,e===n&&`bg-primary/10 text-primary`),children:[(0,i.jsx)(`span`,{children:o[n].label}),e===n&&(0,i.jsx)(r.Check,{className:`h-4 w-4`})]},n))})]})]})}function g({metric:e,showComparisonBars:n,animated:r,variant:o}){let{percentage:u,absolute:d,direction:h}=s(e.value.current,e.value.previous),g=a[e.color||`default`];return o===`compact`?(0,i.jsxs)(`div`,{className:`flex items-center justify-between py-2 border-b last:border-b-0`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,i.jsx)(`div`,{className:t.cn(`h-4 w-4`,g.icon),children:e.icon}),(0,i.jsx)(`span`,{className:`text-sm font-medium`,children:e.name})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,i.jsx)(p,{value:e.value.current,format:e.format,unit:e.unit,animated:r,className:`font-semibold`}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(f,{direction:h,invert:e.invertTrend,size:`sm`,animated:r}),(0,i.jsx)(`span`,{className:t.cn(`text-xs font-medium`,(e.invertTrend?h===`down`:h===`up`)&&`text-green-600`,(e.invertTrend?h===`up`:h===`down`)&&`text-red-600`,h===`neutral`&&`text-muted-foreground`),children:c(u)})]})]})]}):o===`list`?(0,i.jsxs)(`div`,{className:`flex items-center gap-4 p-4 rounded-lg border bg-card`,children:[e.icon&&(0,i.jsx)(`div`,{className:t.cn(`rounded-lg p-2`,g.barBg),children:(0,i.jsx)(`div`,{className:t.cn(`h-5 w-5`,g.icon),children:e.icon})}),(0,i.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,i.jsx)(`span`,{className:`font-medium truncate`,children:e.name}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(f,{direction:h,invert:e.invertTrend,animated:r}),(0,i.jsx)(`span`,{className:t.cn(`text-sm font-semibold`,(e.invertTrend?h===`down`:h===`up`)&&`text-green-600`,(e.invertTrend?h===`up`:h===`down`)&&`text-red-600`,h===`neutral`&&`text-muted-foreground`),children:c(u)})]})]}),(0,i.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,i.jsx)(p,{value:e.value.current,format:e.format,unit:e.unit,animated:r,className:`text-2xl font-bold`}),(0,i.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`from`,` `,(0,i.jsx)(p,{value:e.value.previous,format:e.format,unit:e.unit,animated:r,className:`font-medium`})]})]}),n&&(0,i.jsx)(`div`,{className:`mt-3`,children:(0,i.jsx)(m,{current:e.value.current,previous:e.value.previous,color:e.color,animated:r})})]})]}):(0,i.jsxs)(`div`,{className:`p-4 rounded-lg border bg-card`,children:[(0,i.jsxs)(`div`,{className:`flex items-start justify-between mb-3`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,i.jsx)(`div`,{className:t.cn(`rounded-lg p-1.5`,g.barBg),children:(0,i.jsx)(`div`,{className:t.cn(`h-4 w-4`,g.icon),children:e.icon})}),(0,i.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:e.name})]}),(0,i.jsx)(f,{direction:h,invert:e.invertTrend,animated:r})]}),(0,i.jsx)(`div`,{className:`mb-2`,children:(0,i.jsx)(p,{value:e.value.current,format:e.format,unit:e.unit,animated:r,className:`text-2xl font-bold`})}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,i.jsx)(`span`,{className:t.cn(`font-semibold`,(e.invertTrend?h===`down`:h===`up`)&&`text-green-600`,(e.invertTrend?h===`up`:h===`down`)&&`text-red-600`,h===`neutral`&&`text-muted-foreground`),children:c(u)}),(0,i.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,l(d,e.format,e.unit),`)`]})]}),(0,i.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Previous:`,` `,(0,i.jsx)(p,{value:e.value.previous,format:e.format,unit:e.unit,animated:r,className:`font-medium`})]}),n&&(0,i.jsx)(`div`,{className:`mt-4`,children:(0,i.jsx)(m,{current:e.value.current,previous:e.value.previous,color:e.color,animated:r})})]})}function _({summary:e,metrics:n,animated:a}){let o=n.find(t=>t.id===e.bestMetricId),s=n.find(t=>t.id===e.worstMetricId);return(0,i.jsxs)(`div`,{className:`p-4 rounded-lg border bg-card`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,i.jsx)(r.BarChart3,{className:`h-5 w-5 text-muted-foreground`}),(0,i.jsx)(`span`,{className:`font-semibold`,children:`Summary`})]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 mb-4`,children:[(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-green-600 mb-1`,children:[(0,i.jsx)(r.TrendingUp,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{className:`text-xl font-bold`,children:e.improving})]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Improving`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-red-600 mb-1`,children:[(0,i.jsx)(r.TrendingDown,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{className:`text-xl font-bold`,children:e.declining})]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Declining`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-muted-foreground mb-1`,children:[(0,i.jsx)(r.Minus,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{className:`text-xl font-bold`,children:e.unchanged})]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Unchanged`})]})]}),(0,i.jsx)(`div`,{className:`p-3 rounded-lg bg-muted/50 mb-3`,children:(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Average Change`}),(0,i.jsx)(`span`,{className:t.cn(`font-bold`,e.averageChange>0&&`text-green-600`,e.averageChange<0&&`text-red-600`),children:c(e.averageChange)})]})}),(0,i.jsxs)(`div`,{className:`space-y-2`,children:[o&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Best performer`}),(0,i.jsx)(`span`,{className:`font-medium text-green-600`,children:o.name})]}),s&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Needs attention`}),(0,i.jsx)(`span`,{className:`font-medium text-red-600`,children:s.name})]})]})]})}function v({metrics:e,currentPeriod:a,previousPeriod:o,periodPreset:c=`last_week`,onPeriodChange:l,showPeriodSelector:u=!0,showComparisonBars:f=!0,showSummary:p=!0,animated:m=!0,variant:v=`grid`,columns:y=3,className:b}){let[x,S]=n.useState(c),[C,w]=n.useState(a),[T,E]=n.useState(o),D=n.useMemo(()=>{let t=0,n=0,r=0,i=0,a=-1/0,o=1/0,c,l;return e.forEach(e=>{let{percentage:u,direction:d}=s(e.value.current,e.value.previous),f=e.invertTrend?d===`up`?`down`:d===`down`?`up`:`neutral`:d;f===`up`?t++:f===`down`?n++:r++,i+=u;let p=e.invertTrend?-u:u;p>a&&(a=p,c=e.id),p<o&&(o=p,l=e.id)}),{improving:t,declining:n,unchanged:r,averageChange:e.length>0?i/e.length:0,bestMetricId:c,worstMetricId:l}},[e]);return(0,i.jsxs)(`div`,{className:t.cn(`space-y-4`,b),children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,i.jsx)(r.Calendar,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:C.label}),(0,i.jsx)(r.ArrowRight,{className:`h-3 w-3`}),(0,i.jsx)(`span`,{children:T.label})]})}),u&&(0,i.jsx)(h,{selectedPreset:x,onSelect:e=>{if(S(e),e!==`custom`){let t=d(e);w(t.current),E(t.previous),l?.(e,t.current,t.previous)}else l?.(e,C,T)},currentPeriod:C,previousPeriod:T})]}),v===`compact`?(0,i.jsx)(`div`,{className:`rounded-lg border bg-card p-4`,children:e.map(e=>(0,i.jsx)(g,{metric:e,showComparisonBars:!1,animated:m,variant:`compact`},e.id))}):v===`list`?(0,i.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,i.jsx)(g,{metric:e,showComparisonBars:f,animated:m,variant:`list`},e.id))}):(0,i.jsx)(`div`,{className:t.cn(`grid gap-4`,{2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`}[y]),children:e.map(e=>(0,i.jsx)(g,{metric:e,showComparisonBars:f,animated:m,variant:`grid`},e.id))}),p&&e.length>0&&(0,i.jsx)(_,{summary:D,metrics:e,animated:m})]})}function y(e={}){let{initialPreset:t=`last_week`,initialMetrics:r=[],referenceDate:i,autoRefreshInterval:a,onRefresh:o}=e,c=n.useMemo(()=>i??new Date,[i]),[l,u]=n.useState(t),[f,p]=n.useState(r),[m,h]=n.useState(!1),[g,_]=n.useState(null),[v,y]=n.useState(()=>d(t,c));n.useEffect(()=>{l!==`custom`&&y(d(l,c))},[l,c]),n.useEffect(()=>{if(!a||!o)return;let e=setInterval(async()=>{try{p(await o())}catch(e){_(e instanceof Error?e:Error(`Refresh failed`))}},a);return()=>clearInterval(e)},[a,o]);let b=n.useMemo(()=>{let e=0,t=0,n=0,r=0,i=-1/0,a=1/0,o,c;return f.forEach(l=>{let{percentage:u,direction:d}=s(l.value.current,l.value.previous),f=l.invertTrend?d===`up`?`down`:d===`down`?`up`:`neutral`:d;f===`up`?e++:f===`down`?t++:n++,r+=u;let p=l.invertTrend?-u:u;p>i&&(i=p,o=l.id),p<a&&(a=p,c=l.id)}),{improving:e,declining:t,unchanged:n,averageChange:f.length>0?r/f.length:0,bestMetricId:o,worstMetricId:c}},[f]),x=n.useCallback((e,t)=>{u(`custom`),y({current:e,previous:t})},[]),S=n.useCallback((e,t)=>{p(n=>n.map(n=>n.id===e?{...n,value:t}:n))},[]),C=n.useCallback(async()=>{if(o){h(!0),_(null);try{p(await o())}catch(e){_(e instanceof Error?e:Error(`Refresh failed`))}finally{h(!1)}}},[o]),w=n.useCallback(e=>{let t=f.find(t=>t.id===e);return t?s(t.value.current,t.value.previous):null},[f]);return{preset:l,currentPeriod:v.current,previousPeriod:v.previous,metrics:f,summary:b,isLoading:m,error:g,setPreset:u,setCustomPeriods:x,setMetrics:p,updateMetric:S,refresh:C,getMetricChange:w}}exports.default=v,exports.useComparePeriod=y;
|
|
16
|
+
`})]})}function p({value:e,format:r,unit:a,className:o,animated:s=!0}){let[c,l]=n.useState(e),u=n.useRef(e);n.useEffect(()=>{if(!s||e===u.current){l(e),u.current=e;return}let t=u.current,n=e,r=performance.now(),i=e=>{let a=e-r,o=Math.min(a/500,1),s=1-(1-o)**3,c=t+(n-t)*s;l(c),o<1&&requestAnimationFrame(i)};requestAnimationFrame(i),u.current=e},[e,s]);let d=r?r(c):Number.isInteger(c)?c.toLocaleString():c.toLocaleString(void 0,{maximumFractionDigits:2});return(0,i.jsxs)(`span`,{className:t.cn(`tabular-nums`,o),children:[d,a&&(0,i.jsx)(`span`,{className:`text-muted-foreground ml-0.5`,children:a})]})}function m({current:e,previous:r,color:o=`default`,animated:s=!0}){let[c,l]=n.useState(!s),u=Math.max(e,r,1),d=e/u*100,f=r/u*100;n.useEffect(()=>{if(s){let e=setTimeout(()=>l(!0),100);return()=>clearTimeout(e)}},[s]);let p=a[o];return(0,i.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`span`,{className:`text-[10px] text-muted-foreground w-12`,children:`Current`}),(0,i.jsx)(`div`,{className:`flex-1 h-2 rounded-full bg-muted overflow-hidden`,children:(0,i.jsx)(`div`,{className:t.cn(`h-full rounded-full transition-all duration-700 ease-out`,p.bar),style:{width:c?`${d}%`:`0%`}})})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`span`,{className:`text-[10px] text-muted-foreground w-12`,children:`Previous`}),(0,i.jsx)(`div`,{className:`flex-1 h-2 rounded-full bg-muted overflow-hidden`,children:(0,i.jsx)(`div`,{className:t.cn(`h-full rounded-full transition-all duration-700 ease-out opacity-50`,p.bar),style:{width:c?`${f}%`:`0%`}})})]})]})}function h({selectedPreset:e,onSelect:a,currentPeriod:s,previousPeriod:c,className:l}){let[u,d]=n.useState(!1),f=n.useRef(null);return n.useEffect(()=>{function e(e){f.current&&!f.current.contains(e.target)&&d(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,i.jsxs)(`div`,{ref:f,className:t.cn(`relative`,l),children:[(0,i.jsxs)(`button`,{type:`button`,onClick:()=>d(!u),className:t.cn(`flex items-center gap-2 px-3 py-2 rounded-lg border bg-card`,`text-sm font-medium transition-colors`,`hover:bg-muted focus:outline-none focus:ring-2 focus:ring-primary/20`,u&&`ring-2 ring-primary/20`),children:[(0,i.jsx)(r.Calendar,{className:`h-4 w-4 text-muted-foreground`}),(0,i.jsx)(`span`,{children:o[e].label}),(0,i.jsx)(r.ChevronDown,{className:t.cn(`h-4 w-4 text-muted-foreground transition-transform duration-200`,u&&`rotate-180`)})]}),u&&(0,i.jsxs)(`div`,{className:t.cn(`absolute top-full right-0 mt-2 z-50 min-w-[280px]`,`rounded-lg border bg-card shadow-lg`,`animate-in fade-in-0 zoom-in-95 duration-100`),children:[(0,i.jsx)(`div`,{className:`p-3 border-b`,children:(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,i.jsxs)(`div`,{className:`flex-1 text-center`,children:[(0,i.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground mb-1`,children:`Current`}),(0,i.jsx)(`div`,{className:`font-medium`,children:s.label})]}),(0,i.jsx)(r.ArrowRight,{className:`h-4 w-4 text-muted-foreground`}),(0,i.jsxs)(`div`,{className:`flex-1 text-center`,children:[(0,i.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground mb-1`,children:`Previous`}),(0,i.jsx)(`div`,{className:`font-medium`,children:c.label})]})]})}),(0,i.jsx)(`div`,{className:`p-1`,children:[`last_week`,`last_month`,`last_quarter`,`last_year`,`custom`].map(n=>(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{a(n),d(!1)},className:t.cn(`flex items-center justify-between w-full px-3 py-2 rounded-md text-sm`,`transition-colors hover:bg-muted`,e===n&&`bg-primary/10 text-primary`),children:[(0,i.jsx)(`span`,{children:o[n].label}),e===n&&(0,i.jsx)(r.Check,{className:`h-4 w-4`})]},n))})]})]})}function g({metric:e,showComparisonBars:n,animated:r,variant:o}){let{percentage:u,absolute:d,direction:h}=s(e.value.current,e.value.previous),g=a[e.color||`default`];return o===`compact`?(0,i.jsxs)(`div`,{className:`flex items-center justify-between py-2 border-b last:border-b-0`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,i.jsx)(`div`,{className:t.cn(`h-4 w-4`,g.icon),children:e.icon}),(0,i.jsx)(`span`,{className:`text-sm font-medium`,children:e.name})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,i.jsx)(p,{value:e.value.current,format:e.format,unit:e.unit,animated:r,className:`font-semibold`}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(f,{direction:h,invert:e.invertTrend,size:`sm`,animated:r}),(0,i.jsx)(`span`,{className:t.cn(`text-xs font-medium`,(e.invertTrend?h===`down`:h===`up`)&&`text-green-600`,(e.invertTrend?h===`up`:h===`down`)&&`text-red-600`,h===`neutral`&&`text-muted-foreground`),children:c(u)})]})]})]}):o===`list`?(0,i.jsxs)(`div`,{className:`flex items-center gap-4 p-4 rounded-lg border bg-card`,children:[e.icon&&(0,i.jsx)(`div`,{className:t.cn(`rounded-lg p-2`,g.barBg),children:(0,i.jsx)(`div`,{className:t.cn(`h-5 w-5`,g.icon),children:e.icon})}),(0,i.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,i.jsx)(`span`,{className:`font-medium truncate`,children:e.name}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(f,{direction:h,invert:e.invertTrend,animated:r}),(0,i.jsx)(`span`,{className:t.cn(`text-sm font-semibold`,(e.invertTrend?h===`down`:h===`up`)&&`text-green-600`,(e.invertTrend?h===`up`:h===`down`)&&`text-red-600`,h===`neutral`&&`text-muted-foreground`),children:c(u)})]})]}),(0,i.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,i.jsx)(p,{value:e.value.current,format:e.format,unit:e.unit,animated:r,className:`text-2xl font-bold`}),(0,i.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`from`,` `,(0,i.jsx)(p,{value:e.value.previous,format:e.format,unit:e.unit,animated:r,className:`font-medium`})]})]}),n&&(0,i.jsx)(`div`,{className:`mt-3`,children:(0,i.jsx)(m,{current:e.value.current,previous:e.value.previous,color:e.color,animated:r})})]})]}):(0,i.jsxs)(`div`,{className:`p-4 rounded-lg border bg-card`,children:[(0,i.jsxs)(`div`,{className:`flex items-start justify-between mb-3`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,i.jsx)(`div`,{className:t.cn(`rounded-lg p-1.5`,g.barBg),children:(0,i.jsx)(`div`,{className:t.cn(`h-4 w-4`,g.icon),children:e.icon})}),(0,i.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:e.name})]}),(0,i.jsx)(f,{direction:h,invert:e.invertTrend,animated:r})]}),(0,i.jsx)(`div`,{className:`mb-2`,children:(0,i.jsx)(p,{value:e.value.current,format:e.format,unit:e.unit,animated:r,className:`text-2xl font-bold`})}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,i.jsx)(`span`,{className:t.cn(`font-semibold`,(e.invertTrend?h===`down`:h===`up`)&&`text-green-600`,(e.invertTrend?h===`up`:h===`down`)&&`text-red-600`,h===`neutral`&&`text-muted-foreground`),children:c(u)}),(0,i.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,l(d,e.format,e.unit),`)`]})]}),(0,i.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Previous:`,` `,(0,i.jsx)(p,{value:e.value.previous,format:e.format,unit:e.unit,animated:r,className:`font-medium`})]}),n&&(0,i.jsx)(`div`,{className:`mt-4`,children:(0,i.jsx)(m,{current:e.value.current,previous:e.value.previous,color:e.color,animated:r})})]})}function _({summary:e,metrics:n,animated:a}){let o=n.find(t=>t.id===e.bestMetricId),s=n.find(t=>t.id===e.worstMetricId);return(0,i.jsxs)(`div`,{className:`p-4 rounded-lg border bg-card`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,i.jsx)(r.BarChart3,{className:`h-5 w-5 text-muted-foreground`}),(0,i.jsx)(`span`,{className:`font-semibold`,children:`Summary`})]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 mb-4`,children:[(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-green-600 mb-1`,children:[(0,i.jsx)(r.TrendingUp,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{className:`text-xl font-bold`,children:e.improving})]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Improving`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-red-600 mb-1`,children:[(0,i.jsx)(r.TrendingDown,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{className:`text-xl font-bold`,children:e.declining})]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Declining`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-muted-foreground mb-1`,children:[(0,i.jsx)(r.Minus,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{className:`text-xl font-bold`,children:e.unchanged})]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Unchanged`})]})]}),(0,i.jsx)(`div`,{className:`p-3 rounded-lg bg-muted/50 mb-3`,children:(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Average Change`}),(0,i.jsx)(`span`,{className:t.cn(`font-bold`,e.averageChange>0&&`text-green-600`,e.averageChange<0&&`text-red-600`),children:c(e.averageChange)})]})}),(0,i.jsxs)(`div`,{className:`space-y-2`,children:[o&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Best performer`}),(0,i.jsx)(`span`,{className:`font-medium text-green-600`,children:o.name})]}),s&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Needs attention`}),(0,i.jsx)(`span`,{className:`font-medium text-red-600`,children:s.name})]})]})]})}function v({metrics:e,currentPeriod:a,previousPeriod:o,periodPreset:c=`last_week`,onPeriodChange:l,showPeriodSelector:u=!0,showComparisonBars:f=!0,showSummary:p=!0,animated:m=!0,variant:v=`grid`,columns:y=3,className:b}){let[x,S]=n.useState(c),[C,w]=n.useState(a),[T,E]=n.useState(o),D=n.useMemo(()=>{let t=0,n=0,r=0,i=0,a=-1/0,o=1/0,c,l;return e.forEach(e=>{let{percentage:u,direction:d}=s(e.value.current,e.value.previous),f=e.invertTrend?d===`up`?`down`:d===`down`?`up`:`neutral`:d;f===`up`?t++:f===`down`?n++:r++,i+=u;let p=e.invertTrend?-u:u;p>a&&(a=p,c=e.id),p<o&&(o=p,l=e.id)}),{improving:t,declining:n,unchanged:r,averageChange:e.length>0?i/e.length:0,bestMetricId:c,worstMetricId:l}},[e]);return(0,i.jsxs)(`div`,{className:t.cn(`space-y-4`,b),children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,i.jsx)(r.Calendar,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:C.label}),(0,i.jsx)(r.ArrowRight,{className:`h-3 w-3`}),(0,i.jsx)(`span`,{children:T.label})]})}),u&&(0,i.jsx)(h,{selectedPreset:x,onSelect:e=>{if(S(e),e!==`custom`){let t=d(e);w(t.current),E(t.previous),l?.(e,t.current,t.previous)}else l?.(e,C,T)},currentPeriod:C,previousPeriod:T})]}),v===`compact`?(0,i.jsx)(`div`,{className:`rounded-lg border bg-card p-4`,children:e.map(e=>(0,i.jsx)(g,{metric:e,showComparisonBars:!1,animated:m,variant:`compact`},e.id))}):v===`list`?(0,i.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,i.jsx)(g,{metric:e,showComparisonBars:f,animated:m,variant:`list`},e.id))}):(0,i.jsx)(`div`,{className:t.cn(`grid gap-4`,{2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`}[y]),children:e.map(e=>(0,i.jsx)(g,{metric:e,showComparisonBars:f,animated:m,variant:`grid`},e.id))}),p&&e.length>0&&(0,i.jsx)(_,{summary:D,metrics:e,animated:m})]})}function y(e={}){let{initialPreset:t=`last_week`,initialMetrics:r=[],referenceDate:i,autoRefreshInterval:a,onRefresh:o}=e,c=n.useMemo(()=>i??new Date,[i]),[l,u]=n.useState(t),[f,p]=n.useState(r),[m,h]=n.useState(!1),[g,_]=n.useState(null),[v,y]=n.useState(()=>d(t,c));n.useEffect(()=>{l!==`custom`&&y(d(l,c))},[l,c]),n.useEffect(()=>{if(!a||!o)return;let e=setInterval(async()=>{try{let e=await o();p(e)}catch(e){_(e instanceof Error?e:Error(`Refresh failed`))}},a);return()=>clearInterval(e)},[a,o]);let b=n.useMemo(()=>{let e=0,t=0,n=0,r=0,i=-1/0,a=1/0,o,c;return f.forEach(l=>{let{percentage:u,direction:d}=s(l.value.current,l.value.previous),f=l.invertTrend?d===`up`?`down`:d===`down`?`up`:`neutral`:d;f===`up`?e++:f===`down`?t++:n++,r+=u;let p=l.invertTrend?-u:u;p>i&&(i=p,o=l.id),p<a&&(a=p,c=l.id)}),{improving:e,declining:t,unchanged:n,averageChange:f.length>0?r/f.length:0,bestMetricId:o,worstMetricId:c}},[f]),x=n.useCallback((e,t)=>{u(`custom`),y({current:e,previous:t})},[]),S=n.useCallback((e,t)=>{p(n=>n.map(n=>n.id===e?{...n,value:t}:n))},[]),C=n.useCallback(async()=>{if(o){h(!0),_(null);try{let e=await o();p(e)}catch(e){_(e instanceof Error?e:Error(`Refresh failed`))}finally{h(!1)}}},[o]),w=n.useCallback(e=>{let t=f.find(t=>t.id===e);return t?s(t.value.current,t.value.previous):null},[f]);return{preset:l,currentPeriod:v.current,previousPeriod:v.previous,metrics:f,summary:b,isLoading:m,error:g,setPreset:u,setCustomPeriods:x,setMetrics:p,updateMetric:S,refresh:C,getMetricChange:w}}exports.WakaComparePeriod=v,exports.default=v,exports.useComparePeriod=y;
|
|
@@ -141,8 +141,8 @@ function b({ value: n, format: r, unit: i, className: a, animated: o = !0 }) {
|
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
let e = l.current, t = n, r = performance.now(), i = (n) => {
|
|
144
|
-
let a = n - r, o = Math.min(a / 500, 1), s = 1 - (1 - o) ** 3;
|
|
145
|
-
c(
|
|
144
|
+
let a = n - r, o = Math.min(a / 500, 1), s = 1 - (1 - o) ** 3, l = e + (t - e) * s;
|
|
145
|
+
c(l), o < 1 && requestAnimationFrame(i);
|
|
146
146
|
};
|
|
147
147
|
requestAnimationFrame(i), l.current = n;
|
|
148
148
|
}, [n, o]);
|
|
@@ -615,7 +615,8 @@ function E(e = {}) {
|
|
|
615
615
|
if (!a || !o) return;
|
|
616
616
|
let e = setInterval(async () => {
|
|
617
617
|
try {
|
|
618
|
-
|
|
618
|
+
let e = await o();
|
|
619
|
+
d(e);
|
|
619
620
|
} catch (e) {
|
|
620
621
|
g(e instanceof Error ? e : /* @__PURE__ */ Error("Refresh failed"));
|
|
621
622
|
}
|
|
@@ -651,7 +652,8 @@ function E(e = {}) {
|
|
|
651
652
|
if (o) {
|
|
652
653
|
p(!0), g(null);
|
|
653
654
|
try {
|
|
654
|
-
|
|
655
|
+
let e = await o();
|
|
656
|
+
d(e);
|
|
655
657
|
} catch (e) {
|
|
656
658
|
g(e instanceof Error ? e : /* @__PURE__ */ Error("Refresh failed"));
|
|
657
659
|
} finally {
|
|
@@ -679,4 +681,4 @@ function E(e = {}) {
|
|
|
679
681
|
};
|
|
680
682
|
}
|
|
681
683
|
//#endregion
|
|
682
|
-
export { T as default, E as useComparePeriod };
|
|
684
|
+
export { T as WakaComparePeriod, T as default, E as useComparePeriod };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../badge/index.cjs.js"),r=require("../button/index.cjs.js"),i=require("../select/index.cjs.js"),a=require("../scroll-area/index.cjs.js");let o=require("react");o=e.__toESM(o);let s=require("lucide-react"),c=require("react/jsx-runtime");var l={added:{icon:s.Plus,color:`text-green-500`,bgColor:`bg-green-500/10`,label:`Added`},removed:{icon:s.Minus,color:`text-red-500`,bgColor:`bg-red-500/10`,label:`Removed`},modified:{icon:s.ArrowLeftRight,color:`text-yellow-500`,bgColor:`bg-yellow-500/10`,label:`Modified`},unchanged:{icon:s.Equal,color:`text-muted-foreground`,bgColor:``,label:`Unchanged`}};function u(e){return e===null?`null`:e===void 0?`undefined`:typeof e==`boolean`?e?`true`:`false`:typeof e==`string`?`"${e}"`:String(e)}function d({diff:e,leftEnvName:n,rightEnvName:i,onCopyLeft:a,onCopyRight:d}){let[f,p]=o.useState(!1),[m,h]=o.useState(!1),g=l[e.diffType],_=g.icon;return(0,c.jsxs)(`div`,{className:t.cn(`grid grid-cols-[minmax(150px,1fr)_minmax(200px,2fr)_minmax(200px,2fr)] gap-2 p-2 border-b items-center`,g.bgColor),children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(_,{className:t.cn(`h-4 w-4 shrink-0`,g.color)}),(0,c.jsx)(`span`,{className:`font-mono text-sm truncate`,children:e.key})]}),(0,c.jsx)(`div`,{className:`flex items-center gap-2`,children:e.leftValue===void 0?(0,c.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`Not set`}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`code`,{className:t.cn(`flex-1 text-xs bg-muted px-2 py-1 rounded truncate`,e.diffType===`removed`&&`line-through opacity-50`),children:u(e.leftValue)}),e.diffType!==`unchanged`&&d&&(0,c.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 shrink-0`,onClick:()=>{d?.(),h(!0),setTimeout(()=>h(!1),2e3)},title:`Copy to ${i}`,children:m?(0,c.jsx)(s.CheckCircle2,{className:`h-3 w-3 text-green-500`}):(0,c.jsx)(s.Copy,{className:`h-3 w-3`})})]})}),(0,c.jsx)(`div`,{className:`flex items-center gap-2`,children:e.rightValue===void 0?(0,c.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`Not set`}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`code`,{className:t.cn(`flex-1 text-xs bg-muted px-2 py-1 rounded truncate`,e.diffType===`added`&&`bg-green-500/20`),children:u(e.rightValue)}),e.diffType!==`unchanged`&&a&&(0,c.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 shrink-0`,onClick:()=>{a?.(),p(!0),setTimeout(()=>p(!1),2e3)},title:`Copy to ${n}`,children:f?(0,c.jsx)(s.CheckCircle2,{className:`h-3 w-3 text-green-500`}):(0,c.jsx)(s.Copy,{className:`h-3 w-3`})})]})})]})}function f({environments:e,leftEnvId:l,rightEnvId:u,onEnvironmentChange:f,onCopyValue:p,showDiffsOnly:m=!1,title:h=`Configuration Comparison`,className:g}){let[_,v]=o.useState(l||e[0]?.id),[y,b]=o.useState(u||e[1]?.id),[x,S]=o.useState(m),C=e.find(e=>e.id===_),w=e.find(e=>e.id===y),T=o.useMemo(()=>{if(!C||!w)return[];let e=new Map(C.values.map(e=>[e.key,e.value])),t=new Map(w.values.map(e=>[e.key,e.value])),n=new Set([...e.keys(),...t.keys()]);return Array.from(n).map(n=>{let r=e.get(n),i=t.get(n),a;return a=r===void 0?`added`:i===void 0?`removed`:r===i?`unchanged`:`modified`,{key:n,leftValue:r,rightValue:i,diffType:a}}).sort((e,t)=>{let n={removed:0,added:1,modified:2,unchanged:3},r=n[e.diffType]-n[t.diffType];return r===0?e.key.localeCompare(t.key):r})},[C,w]),E=x?T.filter(e=>e.diffType!==`unchanged`):T,D=o.useMemo(()=>T.reduce((e,t)=>(e[t.diffType]=(e[t.diffType]||0)+1,e),{}),[T]);return(0,c.jsxs)(`div`,{className:t.cn(`flex flex-col border rounded-lg bg-background`,g),children:[(0,c.jsxs)(`div`,{className:`flex items-center justify-between gap-4 p-3 border-b`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,c.jsx)(s.Settings,{className:`h-5 w-5`}),(0,c.jsx)(`h3`,{className:`font-semibold`,children:h})]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[D.modified>0&&(0,c.jsxs)(n.Badge,{className:`bg-yellow-500`,children:[D.modified,` modified`]}),D.added>0&&(0,c.jsxs)(n.Badge,{className:`bg-green-500`,children:[D.added,` added`]}),D.removed>0&&(0,c.jsxs)(n.Badge,{className:`bg-red-500`,children:[D.removed,` removed`]})]})]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-4 p-3 border-b bg-muted/30`,children:[(0,c.jsxs)(`div`,{className:`flex-1`,children:[(0,c.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Left Environment`}),(0,c.jsxs)(i.Select,{value:_,onValueChange:e=>{v(e),f?.(e,y)},children:[(0,c.jsx)(i.SelectTrigger,{children:(0,c.jsx)(i.SelectValue,{})}),(0,c.jsx)(i.SelectContent,{children:e.map(e=>(0,c.jsx)(i.SelectItem,{value:e.id,disabled:e.id===y,children:e.name},e.id))})]})]}),(0,c.jsx)(r.Button,{variant:`outline`,size:`sm`,className:`shrink-0`,onClick:()=>{let e=_;v(y),b(e),f?.(y,e)},children:(0,c.jsx)(s.ArrowLeftRight,{className:`h-4 w-4`})}),(0,c.jsxs)(`div`,{className:`flex-1`,children:[(0,c.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Right Environment`}),(0,c.jsxs)(i.Select,{value:y,onValueChange:e=>{b(e),f?.(_,e)},children:[(0,c.jsx)(i.SelectTrigger,{children:(0,c.jsx)(i.SelectValue,{})}),(0,c.jsx)(i.SelectContent,{children:e.map(e=>(0,c.jsx)(i.SelectItem,{value:e.id,disabled:e.id===_,children:e.name},e.id))})]})]})]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b`,children:[(0,c.jsx)(r.Button,{variant:x?`default`:`outline`,size:`sm`,onClick:()=>S(!x),children:`Show differences only`}),(0,c.jsxs)(`span`,{className:`text-xs text-muted-foreground ml-auto`,children:[E.length,` of `,T.length,` entries`]})]}),(0,c.jsxs)(`div`,{className:`grid grid-cols-[minmax(150px,1fr)_minmax(200px,2fr)_minmax(200px,2fr)] gap-2 px-2 py-2 border-b bg-muted/50 text-xs font-medium text-muted-foreground`,children:[(0,c.jsx)(`div`,{children:`Key`}),(0,c.jsx)(`div`,{children:C?.name||`Left`}),(0,c.jsx)(`div`,{children:w?.name||`Right`})]}),(0,c.jsx)(a.ScrollArea,{className:`flex-1 max-h-[400px]`,children:E.length===0?(0,c.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-32 text-muted-foreground`,children:[(0,c.jsx)(s.CheckCircle2,{className:`h-8 w-8 mb-2 text-green-500`}),(0,c.jsx)(`span`,{children:`No differences found`})]}):E.map(e=>(0,c.jsx)(d,{diff:e,leftEnvName:C?.name||`Left`,rightEnvName:w?.name||`Right`,onCopyLeft:()=>p?.(e.key,e.rightValue,y,_),onCopyRight:()=>p?.(e.key,e.leftValue,_,y)},e.key))})]})}var p=[{id:`production`,name:`Production`,values:[{key:`API_URL`,value:`https://api.example.com`},{key:`DEBUG`,value:!1},{key:`LOG_LEVEL`,value:`error`},{key:`MAX_CONNECTIONS`,value:100},{key:`CACHE_TTL`,value:3600},{key:`FEATURE_NEW_UI`,value:!1}]},{id:`staging`,name:`Staging`,values:[{key:`API_URL`,value:`https://staging-api.example.com`},{key:`DEBUG`,value:!0},{key:`LOG_LEVEL`,value:`debug`},{key:`MAX_CONNECTIONS`,value:50},{key:`CACHE_TTL`,value:300},{key:`FEATURE_NEW_UI`,value:!0},{key:`TEST_MODE`,value:!0}]},{id:`development`,name:`Development`,values:[{key:`API_URL`,value:`http://localhost:3000`},{key:`DEBUG`,value:!0},{key:`LOG_LEVEL`,value:`trace`},{key:`MAX_CONNECTIONS`,value:10},{key:`FEATURE_NEW_UI`,value:!0},{key:`TEST_MODE`,value:!0},{key:`HOT_RELOAD`,value:!0}]}];exports.WakaConfigComparator=f,exports.defaultConfigEnvironments=p;
|
|
@@ -94,7 +94,7 @@ function S({ diff: t, leftEnvName: r, rightEnvName: i, onCopyLeft: a, onCopyRigh
|
|
|
94
94
|
function C({ environments: f, leftEnvId: p, rightEnvId: m, onEnvironmentChange: h, onCopyValue: _, showDiffsOnly: b = !1, title: x = "Configuration Comparison", className: C }) {
|
|
95
95
|
let [w, T] = l.useState(p || f[0]?.id), [E, D] = l.useState(m || f[1]?.id), [O, k] = l.useState(b), A = f.find((e) => e.id === w), j = f.find((e) => e.id === E), M = l.useMemo(() => {
|
|
96
96
|
if (!A || !j) return [];
|
|
97
|
-
let e = new Map(A.values.map((e) => [e.key, e.value])), t = new Map(j.values.map((e) => [e.key, e.value])), n = new Set([...e.keys(), ...t.keys()]);
|
|
97
|
+
let e = new Map(A.values.map((e) => [e.key, e.value])), t = new Map(j.values.map((e) => [e.key, e.value])), n = /* @__PURE__ */ new Set([...e.keys(), ...t.keys()]);
|
|
98
98
|
return Array.from(n).map((n) => {
|
|
99
99
|
let r = e.get(n), i = t.get(n), a;
|
|
100
100
|
return a = r === void 0 ? "added" : i === void 0 ? "removed" : r === i ? "unchanged" : "modified", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`);let n=require(`react`);n=e.__toESM(n);let r=require(`lucide-react`),i=require(`react/jsx-runtime`);var a={http:{label:`HTTP`,color:`#3b82f6`},grpc:{label:`gRPC`,color:`#8b5cf6`},websocket:{label:`WebSocket`,color:`#22c55e`},database:{label:`Database`,color:`#f59e0b`},queue:{label:`Queue`,color:`#ec4899`},custom:{label:`Custom`,color:`#6b7280`}},o={blue:[`bg-blue-50 dark:bg-blue-950/30`,`bg-blue-100 dark:bg-blue-900/50`,`bg-blue-200 dark:bg-blue-800/60`,`bg-blue-300 dark:bg-blue-700/70`,`bg-blue-400 dark:bg-blue-600/80`,`bg-blue-500 dark:bg-blue-500`],green:[`bg-green-50 dark:bg-green-950/30`,`bg-green-100 dark:bg-green-900/50`,`bg-green-200 dark:bg-green-800/60`,`bg-green-300 dark:bg-green-700/70`,`bg-green-400 dark:bg-green-600/80`,`bg-green-500 dark:bg-green-500`],purple:[`bg-purple-50 dark:bg-purple-950/30`,`bg-purple-100 dark:bg-purple-900/50`,`bg-purple-200 dark:bg-purple-800/60`,`bg-purple-300 dark:bg-purple-700/70`,`bg-purple-400 dark:bg-purple-600/80`,`bg-purple-500 dark:bg-purple-500`],orange:[`bg-orange-50 dark:bg-orange-950/30`,`bg-orange-100 dark:bg-orange-900/50`,`bg-orange-200 dark:bg-orange-800/60`,`bg-orange-300 dark:bg-orange-700/70`,`bg-orange-400 dark:bg-orange-600/80`,`bg-orange-500 dark:bg-orange-500`],red:[`bg-red-50 dark:bg-red-950/30`,`bg-red-100 dark:bg-red-900/50`,`bg-red-200 dark:bg-red-800/60`,`bg-red-300 dark:bg-red-700/70`,`bg-red-400 dark:bg-red-600/80`,`bg-red-500 dark:bg-red-500`]},s={sm:{cell:`w-8 h-8`,text:`text-[9px]`,header:`text-xs`},md:{cell:`w-10 h-10`,text:`text-[10px]`,header:`text-xs`},lg:{cell:`w-12 h-12`,text:`text-xs`,header:`text-sm`}};function c(e,t){if(e===0)return 0;let n=e/t;return n<=.2?1:n<=.4?2:n<=.6?3:n<=.8?4:5}function l(e,t){let n=e.filter(e=>e.weight>0),r=n.map(e=>e.weight),i=n.map(e=>e.count||0),a=n.filter(e=>e.latency!==void 0).map(e=>e.latency),o=t*(t-1);return{totalConnections:n.length,averageWeight:r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0,maxWeight:r.length>0?Math.max(...r):0,minWeight:r.length>0?Math.min(...r):0,totalCount:i.reduce((e,t)=>e+t,0),averageLatency:a.length>0?a.reduce((e,t)=>e+t,0)/a.length:0,density:o>0?n.length/o:0}}function u({services:e,connections:t,initialFilterTypes:r,initialSortOrder:i=`name`}){let[o,s]=n.useState(e),[c,u]=n.useState(t),[d,f]=n.useState(new Set(r||Object.keys(a))),[p,m]=n.useState(i),[h,g]=n.useState(null),[_,v]=n.useState(null),y=n.useMemo(()=>{let e=new Map;return c.forEach(t=>{e.set(`${t.source}-${t.target}`,t)}),e},[c]),b=n.useMemo(()=>c.filter(e=>d.has(e.type)),[c,d]);return{services:n.useMemo(()=>{let e=[...o];switch(p){case`connections`:e.sort((e,t)=>{let n=b.filter(t=>t.source===e.id||t.target===e.id).length;return b.filter(e=>e.source===t.id||e.target===t.id).length-n});break;case`weight`:e.sort((e,t)=>{let n=b.filter(t=>t.source===e.id||t.target===e.id).reduce((e,t)=>e+t.weight,0);return b.filter(e=>e.source===t.id||e.target===t.id).reduce((e,t)=>e+t.weight,0)-n});break;default:e.sort((e,t)=>e.name.localeCompare(t.name))}return e},[o,p,b]),connections:b,connectionMap:y,statistics:n.useMemo(()=>l(b,o.length),[b,o.length]),filterTypes:d,sortOrder:p,highlightedService:h,selectedCell:_,getConnection:n.useCallback((e,t)=>{let n=y.get(`${e}-${t}`);if(n&&d.has(n.type))return n},[y,d]),getService:n.useCallback(e=>o.find(t=>t.id===e),[o]),toggleFilterType:n.useCallback(e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),setAllFilterTypes:n.useCallback(e=>{f(new Set(e))},[]),setSortOrder:m,setHighlightedService:g,setSelectedCell:v,updateConnections:n.useCallback(e=>{u(e)},[]),updateServices:n.useCallback(e=>{s(e)},[]),addConnection:n.useCallback(e=>{u(t=>[...t,e])},[]),removeConnection:n.useCallback((e,t)=>{u(n=>n.filter(n=>!(n.source===e&&n.target===t)))},[]),getRelatedConnections:n.useCallback(e=>b.filter(t=>t.source===e||t.target===e),[b])}}function d({sourceId:e,targetId:n,connection:r,maxWeight:a,colorScheme:l,cellSize:u,showCount:d,isHighlighted:f,isDimmed:p,isSelected:m,isSameService:h,onClick:g,onMouseEnter:_,onMouseLeave:v}){let y=s[u],b=o[l],x=r?c(r.weight,a):0;return h?(0,i.jsx)(`div`,{className:t.cn(y.cell,`flex items-center justify-center`,`bg-gray-100 dark:bg-gray-800/50`),children:(0,i.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full bg-gray-300 dark:bg-gray-600`})}):(0,i.jsx)(`div`,{className:t.cn(y.cell,`flex items-center justify-center cursor-pointer transition-all duration-200`,`border border-transparent`,b[x],f&&`ring-2 ring-primary ring-offset-1`,m&&`ring-2 ring-blue-500 ring-offset-2`,p&&`opacity-30`,r&&r.weight>0&&`hover:scale-110 hover:z-10`,!r&&`hover:bg-gray-100 dark:hover:bg-gray-800`),onClick:g,onMouseEnter:_,onMouseLeave:v,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&g()},"aria-label":r?`Connection from ${e} to ${n}: weight ${r.weight}`:`No connection from ${e} to ${n}`,children:d&&r&&r.count!==void 0&&r.count>0&&(0,i.jsx)(`span`,{className:t.cn(y.text,`font-medium text-gray-700 dark:text-gray-200`),children:r.count>999?`1k+`:r.count})})}function f({details:e,position:n}){let{source:o,target:s,connection:c}=e,l=a[c.type];return(0,i.jsxs)(`div`,{className:t.cn(`fixed z-50 min-w-[200px] rounded-lg border bg-popover p-3 shadow-lg`,`animate-in fade-in-0 zoom-in-95 duration-200`),style:{left:n.x,top:n.y,transform:`translate(-50%, -100%) translateY(-12px)`},children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,i.jsx)(r.Link2,{className:`h-4 w-4 text-muted-foreground`}),(0,i.jsx)(`span`,{className:`font-medium`,children:o.name}),(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`->`}),(0,i.jsx)(`span`,{className:`font-medium`,children:s.name})]}),(0,i.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Type`}),(0,i.jsx)(`span`,{className:`px-2 py-0.5 rounded text-xs font-medium`,style:{backgroundColor:`${l.color}20`,color:l.color},children:l.label})]}),(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Weight`}),(0,i.jsxs)(`span`,{className:`font-medium`,children:[c.weight,`%`]})]}),c.count!==void 0&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Requests`}),(0,i.jsx)(`span`,{className:`font-medium`,children:c.count.toLocaleString()})]}),c.latency!==void 0&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Latency`}),(0,i.jsxs)(`span`,{className:`font-medium`,children:[c.latency,`ms`]})]}),c.errorRate!==void 0&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Error Rate`}),(0,i.jsxs)(`span`,{className:t.cn(`font-medium`,c.errorRate>5?`text-red-500`:c.errorRate>1?`text-yellow-500`:`text-green-500`),children:[c.errorRate,`%`]})]})]}),(0,i.jsx)(`div`,{className:`absolute left-1/2 bottom-0 w-2.5 h-2.5 bg-popover border-r border-b transform -translate-x-1/2 translate-y-1/2 rotate-45`})]})}function p({statistics:e}){return(0,i.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 p-4 rounded-lg border bg-muted/30`,children:[(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsx)(`div`,{className:`text-2xl font-bold text-primary`,children:e.totalConnections}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Total Connections`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsx)(`div`,{className:`text-2xl font-bold`,children:e.averageWeight.toFixed(1)}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Avg Weight`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsx)(`div`,{className:`text-2xl font-bold text-green-600`,children:e.maxWeight}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Max Weight`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsx)(`div`,{className:`text-2xl font-bold`,children:e.totalCount.toLocaleString()}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Total Requests`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:`text-2xl font-bold`,children:[e.averageLatency.toFixed(1),`ms`]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Avg Latency`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:`text-2xl font-bold`,children:[(e.density*100).toFixed(1),`%`]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Density`})]})]})}function m({filterTypes:e,onToggleType:o,sortOrder:s,onSortChange:c}){let[l,u]=n.useState(!1);return(0,i.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsxs)(`button`,{onClick:()=>u(!l),className:t.cn(`flex items-center gap-2 px-3 py-1.5 rounded-md border text-sm transition-colors`,`hover:bg-accent`),children:[(0,i.jsx)(r.Filter,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:`Filter Types`}),(0,i.jsx)(r.ChevronDown,{className:t.cn(`h-4 w-4 transition-transform`,l&&`rotate-180`)})]}),l&&(0,i.jsx)(`div`,{className:`absolute top-full left-0 mt-1 z-20 min-w-[180px] rounded-md border bg-popover shadow-lg p-2`,children:Object.keys(a).map(n=>{let s=a[n],c=e.has(n);return(0,i.jsxs)(`button`,{onClick:()=>o(n),className:t.cn(`w-full flex items-center gap-2 px-2 py-1.5 rounded text-sm transition-colors`,`hover:bg-accent`,!c&&`opacity-50`),children:[(0,i.jsx)(`div`,{className:`w-3 h-3 rounded-sm`,style:{backgroundColor:s.color}}),(0,i.jsx)(`span`,{className:`flex-1 text-left`,children:s.label}),c&&(0,i.jsx)(`div`,{className:`w-4 h-4 rounded-full bg-primary flex items-center justify-center`,children:(0,i.jsx)(r.X,{className:`h-3 w-3 text-primary-foreground`})})]},n)})})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(r.ArrowUpDown,{className:`h-4 w-4 text-muted-foreground`}),(0,i.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),className:`px-2 py-1.5 rounded-md border text-sm bg-background`,children:[(0,i.jsx)(`option`,{value:`name`,children:`Sort by Name`}),(0,i.jsx)(`option`,{value:`connections`,children:`Sort by Connections`}),(0,i.jsx)(`option`,{value:`weight`,children:`Sort by Weight`})]})]})]})}function h({details:e,onClose:n}){let{source:o,target:s,connection:c}=e,l=a[c.type];return(0,i.jsxs)(`div`,{className:`rounded-lg border bg-card p-4 shadow-sm`,children:[(0,i.jsxs)(`div`,{className:`flex items-start justify-between mb-4`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(r.Info,{className:`h-5 w-5 text-primary`}),(0,i.jsx)(`h4`,{className:`font-semibold`,children:`Connection Details`})]}),(0,i.jsx)(`button`,{onClick:n,className:`p-1 rounded hover:bg-accent transition-colors`,children:(0,i.jsx)(r.X,{className:`h-4 w-4`})})]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,i.jsxs)(`div`,{className:`space-y-3`,children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Source`}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o.color&&(0,i.jsx)(`div`,{className:`w-3 h-3 rounded-full`,style:{backgroundColor:o.color}}),(0,i.jsx)(`span`,{className:`font-medium`,children:o.name}),o.category&&(0,i.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,o.category,`)`]})]})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Target`}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s.color&&(0,i.jsx)(`div`,{className:`w-3 h-3 rounded-full`,style:{backgroundColor:s.color}}),(0,i.jsx)(`span`,{className:`font-medium`,children:s.name}),s.category&&(0,i.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,s.category,`)`]})]})]})]}),(0,i.jsxs)(`div`,{className:`space-y-3`,children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Connection Type`}),(0,i.jsx)(`span`,{className:`inline-flex px-2 py-0.5 rounded text-xs font-medium`,style:{backgroundColor:`${l.color}20`,color:l.color},children:l.label})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Weight`}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`div`,{className:`flex-1 h-2 bg-muted rounded-full overflow-hidden`,children:(0,i.jsx)(`div`,{className:`h-full bg-primary rounded-full transition-all`,style:{width:`${c.weight}%`}})}),(0,i.jsxs)(`span`,{className:`text-sm font-medium`,children:[c.weight,`%`]})]})]})]})]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 mt-4 pt-4 border-t`,children:[c.count!==void 0&&(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsx)(`div`,{className:`text-lg font-bold`,children:c.count.toLocaleString()}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Requests`})]}),c.latency!==void 0&&(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:`text-lg font-bold`,children:[c.latency,`ms`]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Latency`})]}),c.errorRate!==void 0&&(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:t.cn(`text-lg font-bold`,c.errorRate>5?`text-red-500`:c.errorRate>1?`text-yellow-500`:`text-green-500`),children:[c.errorRate,`%`]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Error Rate`})]})]}),c.metadata&&Object.keys(c.metadata).length>0&&(0,i.jsxs)(`div`,{className:`mt-4 pt-4 border-t`,children:[(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground mb-2`,children:`Additional Info`}),(0,i.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:Object.entries(c.metadata).map(([e,t])=>(0,i.jsxs)(`div`,{className:`text-sm`,children:[(0,i.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,`:`]}),` `,(0,i.jsx)(`span`,{className:`font-medium`,children:t})]},e))})]})]})}function g({colorScheme:e,cellSize:n}){let r=o[e],a=s[n];return(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`span`,{className:t.cn(`text-muted-foreground`,a.header),children:`Low`}),(0,i.jsx)(`div`,{className:`flex items-center gap-0.5`,children:r.map((e,n)=>(0,i.jsx)(`div`,{className:t.cn(`w-5 h-5 rounded-sm transition-all`,e)},n))}),(0,i.jsx)(`span`,{className:t.cn(`text-muted-foreground`,a.header),children:`High`})]})}function _({services:e,connections:o,title:c,showStatistics:l=!0,showFilters:_=!0,colorScheme:v=`blue`,cellSize:y=`md`,onCellClick:b,onCellHover:x,showCounts:S=!1,sortable:C=!0,className:w}){let T=u({services:e,connections:o}),[E,D]=n.useState(null),[O,k]=n.useState(null),A=n.useMemo(()=>Math.max(...T.connections.map(e=>e.weight),1),[T.connections]),j=s[y],M=(e,t)=>{let n=T.getConnection(e,t),r=T.getService(e),i=T.getService(t);if(n&&r&&i){let a={source:r,target:i,connection:n};k(a),T.setSelectedCell({source:e,target:t}),b?.(a)}else k(null),T.setSelectedCell(null),b?.(null)},N=(e,t,n)=>{let r=T.getConnection(e,t),i=T.getService(e),a=T.getService(t);if(r&&i&&a){let t={source:i,target:a,connection:r},o=n.currentTarget.getBoundingClientRect();D({details:t,position:{x:o.left+o.width/2,y:o.top}}),T.setHighlightedService(e),x?.(t)}},P=()=>{D(null),T.setHighlightedService(null),x?.(null)};return(0,i.jsxs)(`div`,{className:t.cn(`space-y-4`,w),children:[(c||_)&&(0,i.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[c&&(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(r.Layers,{className:`h-5 w-5 text-primary`}),(0,i.jsx)(`h3`,{className:`text-lg font-semibold`,children:c})]}),_&&C&&(0,i.jsx)(m,{filterTypes:T.filterTypes,onToggleType:T.toggleFilterType,sortOrder:T.sortOrder,onSortChange:T.setSortOrder})]}),l&&(0,i.jsx)(p,{statistics:T.statistics}),(0,i.jsx)(`div`,{className:`overflow-auto`,children:(0,i.jsxs)(`div`,{className:`inline-block min-w-full`,children:[(0,i.jsxs)(`div`,{className:`flex`,children:[(0,i.jsx)(`div`,{className:t.cn(j.cell,`flex-shrink-0`)}),T.services.map(e=>(0,i.jsx)(`div`,{className:t.cn(j.cell,`flex items-end justify-center pb-1 flex-shrink-0`),children:(0,i.jsx)(`span`,{className:t.cn(j.header,`font-medium text-muted-foreground truncate transform -rotate-45 origin-bottom-left whitespace-nowrap`),style:{maxWidth:`60px`},title:e.name,children:e.name})},`col-${e.id}`))]}),T.services.map(e=>(0,i.jsxs)(`div`,{className:`flex`,children:[(0,i.jsx)(`div`,{className:t.cn(j.cell,`flex items-center justify-end pr-2 flex-shrink-0`),children:(0,i.jsx)(`span`,{className:t.cn(j.header,`font-medium text-muted-foreground truncate`),style:{maxWidth:`80px`},title:e.name,children:e.name})}),T.services.map(t=>{let n=T.getConnection(e.id,t.id),r=T.highlightedService===e.id||T.highlightedService===t.id,a=T.highlightedService!==null&&T.highlightedService!==e.id&&T.highlightedService!==t.id,o=T.selectedCell?.source===e.id&&T.selectedCell?.target===t.id;return(0,i.jsx)(d,{sourceId:e.id,targetId:t.id,connection:n,maxWeight:A,colorScheme:v,cellSize:y,showCount:S,isHighlighted:r,isDimmed:a,isSelected:o,isSameService:e.id===t.id,onClick:()=>M(e.id,t.id),onMouseEnter:n=>N(e.id,t.id,n),onMouseLeave:P},`cell-${e.id}-${t.id}`)})]},`row-${e.id}`))]})}),(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(g,{colorScheme:v,cellSize:y}),(0,i.jsx)(`div`,{className:`flex items-center gap-3`,children:Object.keys(a).map(e=>{let t=a[e];return T.filterTypes.has(e)?(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,i.jsx)(`div`,{className:`w-3 h-3 rounded-sm`,style:{backgroundColor:t.color}}),(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.label})]},e):null})})]}),O&&(0,i.jsx)(h,{details:O,onClose:()=>{k(null),T.setSelectedCell(null)}}),E&&(0,i.jsx)(f,{details:E.details,position:E.position})]})}exports.default=_,exports.useConnectionMatrix=u;
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={http:{label:`HTTP`,color:`#3b82f6`},grpc:{label:`gRPC`,color:`#8b5cf6`},websocket:{label:`WebSocket`,color:`#22c55e`},database:{label:`Database`,color:`#f59e0b`},queue:{label:`Queue`,color:`#ec4899`},custom:{label:`Custom`,color:`#6b7280`}},o={blue:[`bg-blue-50 dark:bg-blue-950/30`,`bg-blue-100 dark:bg-blue-900/50`,`bg-blue-200 dark:bg-blue-800/60`,`bg-blue-300 dark:bg-blue-700/70`,`bg-blue-400 dark:bg-blue-600/80`,`bg-blue-500 dark:bg-blue-500`],green:[`bg-green-50 dark:bg-green-950/30`,`bg-green-100 dark:bg-green-900/50`,`bg-green-200 dark:bg-green-800/60`,`bg-green-300 dark:bg-green-700/70`,`bg-green-400 dark:bg-green-600/80`,`bg-green-500 dark:bg-green-500`],purple:[`bg-purple-50 dark:bg-purple-950/30`,`bg-purple-100 dark:bg-purple-900/50`,`bg-purple-200 dark:bg-purple-800/60`,`bg-purple-300 dark:bg-purple-700/70`,`bg-purple-400 dark:bg-purple-600/80`,`bg-purple-500 dark:bg-purple-500`],orange:[`bg-orange-50 dark:bg-orange-950/30`,`bg-orange-100 dark:bg-orange-900/50`,`bg-orange-200 dark:bg-orange-800/60`,`bg-orange-300 dark:bg-orange-700/70`,`bg-orange-400 dark:bg-orange-600/80`,`bg-orange-500 dark:bg-orange-500`],red:[`bg-red-50 dark:bg-red-950/30`,`bg-red-100 dark:bg-red-900/50`,`bg-red-200 dark:bg-red-800/60`,`bg-red-300 dark:bg-red-700/70`,`bg-red-400 dark:bg-red-600/80`,`bg-red-500 dark:bg-red-500`]},s={sm:{cell:`w-8 h-8`,text:`text-[9px]`,header:`text-xs`},md:{cell:`w-10 h-10`,text:`text-[10px]`,header:`text-xs`},lg:{cell:`w-12 h-12`,text:`text-xs`,header:`text-sm`}};function c(e,t){if(e===0)return 0;let n=e/t;return n<=.2?1:n<=.4?2:n<=.6?3:n<=.8?4:5}function l(e,t){let n=e.filter(e=>e.weight>0),r=n.map(e=>e.weight),i=n.map(e=>e.count||0),a=n.filter(e=>e.latency!==void 0).map(e=>e.latency),o=t*(t-1);return{totalConnections:n.length,averageWeight:r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0,maxWeight:r.length>0?Math.max(...r):0,minWeight:r.length>0?Math.min(...r):0,totalCount:i.reduce((e,t)=>e+t,0),averageLatency:a.length>0?a.reduce((e,t)=>e+t,0)/a.length:0,density:o>0?n.length/o:0}}function u({services:e,connections:t,initialFilterTypes:r,initialSortOrder:i=`name`}){let[o,s]=n.useState(e),[c,u]=n.useState(t),[d,f]=n.useState(new Set(r||Object.keys(a))),[p,m]=n.useState(i),[h,g]=n.useState(null),[_,v]=n.useState(null),y=n.useMemo(()=>{let e=new Map;return c.forEach(t=>{e.set(`${t.source}-${t.target}`,t)}),e},[c]),b=n.useMemo(()=>c.filter(e=>d.has(e.type)),[c,d]);return{services:n.useMemo(()=>{let e=[...o];switch(p){case`connections`:e.sort((e,t)=>{let n=b.filter(t=>t.source===e.id||t.target===e.id).length;return b.filter(e=>e.source===t.id||e.target===t.id).length-n});break;case`weight`:e.sort((e,t)=>{let n=b.filter(t=>t.source===e.id||t.target===e.id).reduce((e,t)=>e+t.weight,0);return b.filter(e=>e.source===t.id||e.target===t.id).reduce((e,t)=>e+t.weight,0)-n});break;default:e.sort((e,t)=>e.name.localeCompare(t.name))}return e},[o,p,b]),connections:b,connectionMap:y,statistics:n.useMemo(()=>l(b,o.length),[b,o.length]),filterTypes:d,sortOrder:p,highlightedService:h,selectedCell:_,getConnection:n.useCallback((e,t)=>{let n=y.get(`${e}-${t}`);if(n&&d.has(n.type))return n},[y,d]),getService:n.useCallback(e=>o.find(t=>t.id===e),[o]),toggleFilterType:n.useCallback(e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),setAllFilterTypes:n.useCallback(e=>{f(new Set(e))},[]),setSortOrder:m,setHighlightedService:g,setSelectedCell:v,updateConnections:n.useCallback(e=>{u(e)},[]),updateServices:n.useCallback(e=>{s(e)},[]),addConnection:n.useCallback(e=>{u(t=>[...t,e])},[]),removeConnection:n.useCallback((e,t)=>{u(n=>n.filter(n=>!(n.source===e&&n.target===t)))},[]),getRelatedConnections:n.useCallback(e=>b.filter(t=>t.source===e||t.target===e),[b])}}function d({sourceId:e,targetId:n,connection:r,maxWeight:a,colorScheme:l,cellSize:u,showCount:d,isHighlighted:f,isDimmed:p,isSelected:m,isSameService:h,onClick:g,onMouseEnter:_,onMouseLeave:v}){let y=s[u],b=o[l],x=r?c(r.weight,a):0;return h?(0,i.jsx)(`div`,{className:t.cn(y.cell,`flex items-center justify-center`,`bg-gray-100 dark:bg-gray-800/50`),children:(0,i.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full bg-gray-300 dark:bg-gray-600`})}):(0,i.jsx)(`div`,{className:t.cn(y.cell,`flex items-center justify-center cursor-pointer transition-all duration-200`,`border border-transparent`,b[x],f&&`ring-2 ring-primary ring-offset-1`,m&&`ring-2 ring-blue-500 ring-offset-2`,p&&`opacity-30`,r&&r.weight>0&&`hover:scale-110 hover:z-10`,!r&&`hover:bg-gray-100 dark:hover:bg-gray-800`),onClick:g,onMouseEnter:_,onMouseLeave:v,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&g()},"aria-label":r?`Connection from ${e} to ${n}: weight ${r.weight}`:`No connection from ${e} to ${n}`,children:d&&r&&r.count!==void 0&&r.count>0&&(0,i.jsx)(`span`,{className:t.cn(y.text,`font-medium text-gray-700 dark:text-gray-200`),children:r.count>999?`1k+`:r.count})})}function f({details:e,position:n}){let{source:o,target:s,connection:c}=e,l=a[c.type];return(0,i.jsxs)(`div`,{className:t.cn(`fixed z-50 min-w-[200px] rounded-lg border bg-popover p-3 shadow-lg`,`animate-in fade-in-0 zoom-in-95 duration-200`),style:{left:n.x,top:n.y,transform:`translate(-50%, -100%) translateY(-12px)`},children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,i.jsx)(r.Link2,{className:`h-4 w-4 text-muted-foreground`}),(0,i.jsx)(`span`,{className:`font-medium`,children:o.name}),(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`->`}),(0,i.jsx)(`span`,{className:`font-medium`,children:s.name})]}),(0,i.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Type`}),(0,i.jsx)(`span`,{className:`px-2 py-0.5 rounded text-xs font-medium`,style:{backgroundColor:`${l.color}20`,color:l.color},children:l.label})]}),(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Weight`}),(0,i.jsxs)(`span`,{className:`font-medium`,children:[c.weight,`%`]})]}),c.count!==void 0&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Requests`}),(0,i.jsx)(`span`,{className:`font-medium`,children:c.count.toLocaleString()})]}),c.latency!==void 0&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Latency`}),(0,i.jsxs)(`span`,{className:`font-medium`,children:[c.latency,`ms`]})]}),c.errorRate!==void 0&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Error Rate`}),(0,i.jsxs)(`span`,{className:t.cn(`font-medium`,c.errorRate>5?`text-red-500`:c.errorRate>1?`text-yellow-500`:`text-green-500`),children:[c.errorRate,`%`]})]})]}),(0,i.jsx)(`div`,{className:`absolute left-1/2 bottom-0 w-2.5 h-2.5 bg-popover border-r border-b transform -translate-x-1/2 translate-y-1/2 rotate-45`})]})}function p({statistics:e}){return(0,i.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 p-4 rounded-lg border bg-muted/30`,children:[(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsx)(`div`,{className:`text-2xl font-bold text-primary`,children:e.totalConnections}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Total Connections`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsx)(`div`,{className:`text-2xl font-bold`,children:e.averageWeight.toFixed(1)}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Avg Weight`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsx)(`div`,{className:`text-2xl font-bold text-green-600`,children:e.maxWeight}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Max Weight`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsx)(`div`,{className:`text-2xl font-bold`,children:e.totalCount.toLocaleString()}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Total Requests`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:`text-2xl font-bold`,children:[e.averageLatency.toFixed(1),`ms`]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Avg Latency`})]}),(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:`text-2xl font-bold`,children:[(e.density*100).toFixed(1),`%`]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Density`})]})]})}function m({filterTypes:e,onToggleType:o,sortOrder:s,onSortChange:c}){let[l,u]=n.useState(!1);return(0,i.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsxs)(`button`,{onClick:()=>u(!l),className:t.cn(`flex items-center gap-2 px-3 py-1.5 rounded-md border text-sm transition-colors`,`hover:bg-accent`),children:[(0,i.jsx)(r.Filter,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:`Filter Types`}),(0,i.jsx)(r.ChevronDown,{className:t.cn(`h-4 w-4 transition-transform`,l&&`rotate-180`)})]}),l&&(0,i.jsx)(`div`,{className:`absolute top-full left-0 mt-1 z-20 min-w-[180px] rounded-md border bg-popover shadow-lg p-2`,children:Object.keys(a).map(n=>{let s=a[n],c=e.has(n);return(0,i.jsxs)(`button`,{onClick:()=>o(n),className:t.cn(`w-full flex items-center gap-2 px-2 py-1.5 rounded text-sm transition-colors`,`hover:bg-accent`,!c&&`opacity-50`),children:[(0,i.jsx)(`div`,{className:`w-3 h-3 rounded-sm`,style:{backgroundColor:s.color}}),(0,i.jsx)(`span`,{className:`flex-1 text-left`,children:s.label}),c&&(0,i.jsx)(`div`,{className:`w-4 h-4 rounded-full bg-primary flex items-center justify-center`,children:(0,i.jsx)(r.X,{className:`h-3 w-3 text-primary-foreground`})})]},n)})})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(r.ArrowUpDown,{className:`h-4 w-4 text-muted-foreground`}),(0,i.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),className:`px-2 py-1.5 rounded-md border text-sm bg-background`,children:[(0,i.jsx)(`option`,{value:`name`,children:`Sort by Name`}),(0,i.jsx)(`option`,{value:`connections`,children:`Sort by Connections`}),(0,i.jsx)(`option`,{value:`weight`,children:`Sort by Weight`})]})]})]})}function h({details:e,onClose:n}){let{source:o,target:s,connection:c}=e,l=a[c.type];return(0,i.jsxs)(`div`,{className:`rounded-lg border bg-card p-4 shadow-sm`,children:[(0,i.jsxs)(`div`,{className:`flex items-start justify-between mb-4`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(r.Info,{className:`h-5 w-5 text-primary`}),(0,i.jsx)(`h4`,{className:`font-semibold`,children:`Connection Details`})]}),(0,i.jsx)(`button`,{onClick:n,className:`p-1 rounded hover:bg-accent transition-colors`,children:(0,i.jsx)(r.X,{className:`h-4 w-4`})})]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,i.jsxs)(`div`,{className:`space-y-3`,children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Source`}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o.color&&(0,i.jsx)(`div`,{className:`w-3 h-3 rounded-full`,style:{backgroundColor:o.color}}),(0,i.jsx)(`span`,{className:`font-medium`,children:o.name}),o.category&&(0,i.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,o.category,`)`]})]})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Target`}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s.color&&(0,i.jsx)(`div`,{className:`w-3 h-3 rounded-full`,style:{backgroundColor:s.color}}),(0,i.jsx)(`span`,{className:`font-medium`,children:s.name}),s.category&&(0,i.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,s.category,`)`]})]})]})]}),(0,i.jsxs)(`div`,{className:`space-y-3`,children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Connection Type`}),(0,i.jsx)(`span`,{className:`inline-flex px-2 py-0.5 rounded text-xs font-medium`,style:{backgroundColor:`${l.color}20`,color:l.color},children:l.label})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Weight`}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`div`,{className:`flex-1 h-2 bg-muted rounded-full overflow-hidden`,children:(0,i.jsx)(`div`,{className:`h-full bg-primary rounded-full transition-all`,style:{width:`${c.weight}%`}})}),(0,i.jsxs)(`span`,{className:`text-sm font-medium`,children:[c.weight,`%`]})]})]})]})]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 mt-4 pt-4 border-t`,children:[c.count!==void 0&&(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsx)(`div`,{className:`text-lg font-bold`,children:c.count.toLocaleString()}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Requests`})]}),c.latency!==void 0&&(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:`text-lg font-bold`,children:[c.latency,`ms`]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Latency`})]}),c.errorRate!==void 0&&(0,i.jsxs)(`div`,{className:`text-center`,children:[(0,i.jsxs)(`div`,{className:t.cn(`text-lg font-bold`,c.errorRate>5?`text-red-500`:c.errorRate>1?`text-yellow-500`:`text-green-500`),children:[c.errorRate,`%`]}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Error Rate`})]})]}),c.metadata&&Object.keys(c.metadata).length>0&&(0,i.jsxs)(`div`,{className:`mt-4 pt-4 border-t`,children:[(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground mb-2`,children:`Additional Info`}),(0,i.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:Object.entries(c.metadata).map(([e,t])=>(0,i.jsxs)(`div`,{className:`text-sm`,children:[(0,i.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,`:`]}),` `,(0,i.jsx)(`span`,{className:`font-medium`,children:t})]},e))})]})]})}function g({colorScheme:e,cellSize:n}){let r=o[e],a=s[n];return(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`span`,{className:t.cn(`text-muted-foreground`,a.header),children:`Low`}),(0,i.jsx)(`div`,{className:`flex items-center gap-0.5`,children:r.map((e,n)=>(0,i.jsx)(`div`,{className:t.cn(`w-5 h-5 rounded-sm transition-all`,e)},n))}),(0,i.jsx)(`span`,{className:t.cn(`text-muted-foreground`,a.header),children:`High`})]})}function _({services:e,connections:o,title:c,showStatistics:l=!0,showFilters:_=!0,colorScheme:v=`blue`,cellSize:y=`md`,onCellClick:b,onCellHover:x,showCounts:S=!1,sortable:C=!0,className:w}){let T=u({services:e,connections:o}),[E,D]=n.useState(null),[O,k]=n.useState(null),A=n.useMemo(()=>Math.max(...T.connections.map(e=>e.weight),1),[T.connections]),j=s[y],M=(e,t)=>{let n=T.getConnection(e,t),r=T.getService(e),i=T.getService(t);if(n&&r&&i){let a={source:r,target:i,connection:n};k(a),T.setSelectedCell({source:e,target:t}),b?.(a)}else k(null),T.setSelectedCell(null),b?.(null)},N=(e,t,n)=>{let r=T.getConnection(e,t),i=T.getService(e),a=T.getService(t);if(r&&i&&a){let t={source:i,target:a,connection:r},o=n.currentTarget.getBoundingClientRect();D({details:t,position:{x:o.left+o.width/2,y:o.top}}),T.setHighlightedService(e),x?.(t)}},P=()=>{D(null),T.setHighlightedService(null),x?.(null)};return(0,i.jsxs)(`div`,{className:t.cn(`space-y-4`,w),children:[(c||_)&&(0,i.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[c&&(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(r.Layers,{className:`h-5 w-5 text-primary`}),(0,i.jsx)(`h3`,{className:`text-lg font-semibold`,children:c})]}),_&&C&&(0,i.jsx)(m,{filterTypes:T.filterTypes,onToggleType:T.toggleFilterType,sortOrder:T.sortOrder,onSortChange:T.setSortOrder})]}),l&&(0,i.jsx)(p,{statistics:T.statistics}),(0,i.jsx)(`div`,{className:`overflow-auto`,children:(0,i.jsxs)(`div`,{className:`inline-block min-w-full`,children:[(0,i.jsxs)(`div`,{className:`flex`,children:[(0,i.jsx)(`div`,{className:t.cn(j.cell,`flex-shrink-0`)}),T.services.map(e=>(0,i.jsx)(`div`,{className:t.cn(j.cell,`flex items-end justify-center pb-1 flex-shrink-0`),children:(0,i.jsx)(`span`,{className:t.cn(j.header,`font-medium text-muted-foreground truncate transform -rotate-45 origin-bottom-left whitespace-nowrap`),style:{maxWidth:`60px`},title:e.name,children:e.name})},`col-${e.id}`))]}),T.services.map(e=>(0,i.jsxs)(`div`,{className:`flex`,children:[(0,i.jsx)(`div`,{className:t.cn(j.cell,`flex items-center justify-end pr-2 flex-shrink-0`),children:(0,i.jsx)(`span`,{className:t.cn(j.header,`font-medium text-muted-foreground truncate`),style:{maxWidth:`80px`},title:e.name,children:e.name})}),T.services.map(t=>{let n=T.getConnection(e.id,t.id),r=T.highlightedService===e.id||T.highlightedService===t.id,a=T.highlightedService!==null&&T.highlightedService!==e.id&&T.highlightedService!==t.id,o=T.selectedCell?.source===e.id&&T.selectedCell?.target===t.id;return(0,i.jsx)(d,{sourceId:e.id,targetId:t.id,connection:n,maxWeight:A,colorScheme:v,cellSize:y,showCount:S,isHighlighted:r,isDimmed:a,isSelected:o,isSameService:e.id===t.id,onClick:()=>M(e.id,t.id),onMouseEnter:n=>N(e.id,t.id,n),onMouseLeave:P},`cell-${e.id}-${t.id}`)})]},`row-${e.id}`))]})}),(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsx)(g,{colorScheme:v,cellSize:y}),(0,i.jsx)(`div`,{className:`flex items-center gap-3`,children:Object.keys(a).map(e=>{let t=a[e];return T.filterTypes.has(e)?(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,i.jsx)(`div`,{className:`w-3 h-3 rounded-sm`,style:{backgroundColor:t.color}}),(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.label})]},e):null})})]}),O&&(0,i.jsx)(h,{details:O,onClose:()=>{k(null),T.setSelectedCell(null)}}),E&&(0,i.jsx)(f,{details:E.details,position:E.position})]})}exports.WakaConnectionMatrix=_,exports.default=_,exports.useConnectionMatrix=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../badge/index.cjs.js"),r=require("../button/index.cjs.js"),i=require("../dropdown-menu/index.cjs.js"),a=require("../input/index.cjs.js"),o=require("../progress/index.cjs.js"),s=require("../scroll-area/index.cjs.js"),c=require("../tooltip/index.cjs.js");let l=require("react");l=e.__toESM(l);let u=require("lucide-react"),d=require("react/jsx-runtime");var f={running:{icon:u.CheckCircle2,color:`text-green-500`,label:`Running`},stopped:{icon:u.XCircle,color:`text-gray-500`,label:`Stopped`},paused:{icon:u.PauseCircle,color:`text-yellow-500`,label:`Paused`},restarting:{icon:u.Loader2,color:`text-blue-500`,label:`Restarting`},exited:{icon:u.XCircle,color:`text-red-500`,label:`Exited`},created:{icon:u.Box,color:`text-gray-400`,label:`Created`}};function p(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`,`TB`],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/t**r).toFixed(2))+` `+n[r]}function m(e){if(!e)return`-`;let t=Date.now()-e.getTime(),n=Math.floor(t/(24*36e5)),r=Math.floor(t%(24*36e5)/36e5),i=Math.floor(t%36e5/6e4);return n>0?`${n}d ${r}h`:r>0?`${r}h ${i}m`:`${i}m`}function h({container:e,onStart:a,onStop:s,onRestart:l,onRemove:h,onViewLogs:g,onExec:_}){let v=f[e.status],y=v.icon,b=e.status===`running`,x=e.resources?e.resources.memory/e.resources.memoryLimit*100:0;return(0,d.jsxs)(`div`,{className:`flex items-center gap-4 px-4 py-3 border-b hover:bg-muted/30 transition-colors`,children:[(0,d.jsx)(c.TooltipProvider,{children:(0,d.jsxs)(c.Tooltip,{children:[(0,d.jsx)(c.TooltipTrigger,{children:(0,d.jsx)(y,{className:t.cn(`h-5 w-5`,v.color,e.status===`restarting`&&`animate-spin`)})}),(0,d.jsx)(c.TooltipContent,{children:v.label})]})}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(`span`,{className:`font-medium truncate`,children:e.name}),(0,d.jsx)(`code`,{className:`text-xs bg-muted px-1.5 py-0.5 rounded truncate max-w-[200px]`,children:e.id.slice(0,12)})]}),(0,d.jsx)(`div`,{className:`text-sm text-muted-foreground truncate`,children:e.image})]}),(0,d.jsx)(`div`,{className:`hidden md:block w-32`,children:e.ports&&e.ports.length>0?(0,d.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[e.ports.slice(0,2).map((e,t)=>(0,d.jsxs)(n.Badge,{variant:`outline`,className:`text-xs`,children:[e.host,`:`,e.container]},t)),e.ports.length>2&&(0,d.jsxs)(n.Badge,{variant:`outline`,className:`text-xs`,children:[`+`,e.ports.length-2]})]}):(0,d.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`-`})}),b&&e.resources&&(0,d.jsxs)(`div`,{className:`hidden lg:flex items-center gap-4 w-48`,children:[(0,d.jsx)(c.TooltipProvider,{children:(0,d.jsxs)(c.Tooltip,{children:[(0,d.jsxs)(c.TooltipTrigger,{className:`flex items-center gap-1.5`,children:[(0,d.jsx)(u.Cpu,{className:`h-4 w-4 text-muted-foreground`}),(0,d.jsxs)(`span`,{className:`text-sm w-12`,children:[e.resources.cpu.toFixed(1),`%`]})]}),(0,d.jsx)(c.TooltipContent,{children:`CPU Usage`})]})}),(0,d.jsx)(c.TooltipProvider,{children:(0,d.jsxs)(c.Tooltip,{children:[(0,d.jsxs)(c.TooltipTrigger,{className:`flex items-center gap-1.5 flex-1`,children:[(0,d.jsx)(u.HardDrive,{className:`h-4 w-4 text-muted-foreground`}),(0,d.jsx)(o.Progress,{value:x,className:`h-1.5 flex-1`})]}),(0,d.jsxs)(c.TooltipContent,{children:[`Memory: `,p(e.resources.memory),` / `,p(e.resources.memoryLimit)]})]})})]}),(0,d.jsxs)(`div`,{className:`hidden sm:flex items-center gap-1.5 w-20 text-sm text-muted-foreground`,children:[(0,d.jsx)(u.Clock,{className:`h-4 w-4`}),m(e.startedAt)]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[b?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c.TooltipProvider,{children:(0,d.jsxs)(c.Tooltip,{children:[(0,d.jsx)(c.TooltipTrigger,{asChild:!0,children:(0,d.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>s?.(e.id),children:(0,d.jsx)(u.Square,{className:`h-4 w-4`})})}),(0,d.jsx)(c.TooltipContent,{children:`Stop`})]})}),(0,d.jsx)(c.TooltipProvider,{children:(0,d.jsxs)(c.Tooltip,{children:[(0,d.jsx)(c.TooltipTrigger,{asChild:!0,children:(0,d.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>l?.(e.id),children:(0,d.jsx)(u.RotateCcw,{className:`h-4 w-4`})})}),(0,d.jsx)(c.TooltipContent,{children:`Restart`})]})})]}):(0,d.jsx)(c.TooltipProvider,{children:(0,d.jsxs)(c.Tooltip,{children:[(0,d.jsx)(c.TooltipTrigger,{asChild:!0,children:(0,d.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:()=>a?.(e.id),children:(0,d.jsx)(u.Play,{className:`h-4 w-4`})})}),(0,d.jsx)(c.TooltipContent,{children:`Start`})]})}),(0,d.jsxs)(i.DropdownMenu,{children:[(0,d.jsx)(i.DropdownMenuTrigger,{asChild:!0,children:(0,d.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,d.jsx)(u.MoreVertical,{className:`h-4 w-4`})})}),(0,d.jsxs)(i.DropdownMenuContent,{align:`end`,children:[(0,d.jsxs)(i.DropdownMenuItem,{onClick:()=>g?.(e.id),children:[(0,d.jsx)(u.FileText,{className:`h-4 w-4 mr-2`}),`View Logs`]}),b&&(0,d.jsxs)(i.DropdownMenuItem,{onClick:()=>_?.(e.id),children:[(0,d.jsx)(u.Terminal,{className:`h-4 w-4 mr-2`}),`Open Terminal`]}),(0,d.jsx)(i.DropdownMenuSeparator,{}),(0,d.jsxs)(i.DropdownMenuItem,{onClick:()=>h?.(e.id),className:`text-destructive`,children:[(0,d.jsx)(u.Trash2,{className:`h-4 w-4 mr-2`}),`Remove`]})]})]})]})]})}function g({containers:e,onStart:i,onStop:o,onRestart:c,onRemove:f,onViewLogs:p,onExec:m,onRefresh:g,isLoading:_=!1,className:v,title:y=`Containers`}){let[b,x]=l.useState(``),S=l.useMemo(()=>{if(!b)return e;let t=b.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t)||e.image.toLowerCase().includes(t)||e.id.toLowerCase().includes(t))},[e,b]),C=l.useMemo(()=>e.reduce((e,t)=>(e[t.status]=(e[t.status]||0)+1,e),{}),[e]);return(0,d.jsxs)(`div`,{className:t.cn(`flex flex-col border rounded-lg bg-background`,v),children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between gap-4 p-3 border-b`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,d.jsx)(u.Box,{className:`h-5 w-5`}),(0,d.jsx)(`h3`,{className:`font-semibold`,children:y}),(0,d.jsx)(n.Badge,{variant:`secondary`,children:e.length}),(0,d.jsxs)(`div`,{className:`hidden md:flex items-center gap-1`,children:[C.running>0&&(0,d.jsxs)(n.Badge,{className:`bg-green-500 text-xs`,children:[C.running,` running`]}),C.stopped>0&&(0,d.jsxs)(n.Badge,{variant:`secondary`,className:`text-xs`,children:[C.stopped,` stopped`]})]})]}),(0,d.jsx)(`div`,{className:`flex items-center gap-2`,children:g&&(0,d.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:g,disabled:_,children:(0,d.jsx)(u.RefreshCw,{className:t.cn(`h-4 w-4`,_&&`animate-spin`)})})})]}),(0,d.jsx)(`div`,{className:`p-2 border-b bg-muted/30`,children:(0,d.jsxs)(`div`,{className:`relative max-w-sm`,children:[(0,d.jsx)(u.Search,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,d.jsx)(a.Input,{placeholder:`Search containers...`,value:b,onChange:e=>x(e.target.value),className:`pl-8 h-8`})]})}),(0,d.jsx)(s.ScrollArea,{className:`flex-1`,children:S.length===0?(0,d.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-32 text-muted-foreground`,children:[(0,d.jsx)(u.Box,{className:`h-8 w-8 mb-2`}),(0,d.jsx)(`span`,{children:`No containers found`})]}):S.map(e=>(0,d.jsx)(h,{container:e,onStart:i,onStop:o,onRestart:c,onRemove:f,onViewLogs:p,onExec:m},e.id))})]})}var _=[{id:`abc123def456`,name:`api-server`,image:`myapp/api:v1.2.3`,status:`running`,createdAt:new Date(Date.now()-168*36e5),startedAt:new Date(Date.now()-48*36e5),ports:[{host:8080,container:80,protocol:`tcp`},{host:8443,container:443,protocol:`tcp`}],resources:{cpu:23.5,memory:256*1024*1024,memoryLimit:512*1024*1024,networkRx:1024*1024*50,networkTx:1024*1024*25}},{id:`def456ghi789`,name:`postgres-db`,image:`postgres:15-alpine`,status:`running`,createdAt:new Date(Date.now()-720*36e5),startedAt:new Date(Date.now()-360*36e5),ports:[{host:5432,container:5432,protocol:`tcp`}],resources:{cpu:5.2,memory:384*1024*1024,memoryLimit:1024*1024*1024,networkRx:1024*1024*10,networkTx:1024*1024*5}},{id:`ghi789jkl012`,name:`redis-cache`,image:`redis:7-alpine`,status:`stopped`,createdAt:new Date(Date.now()-336*36e5),exitCode:0},{id:`jkl012mno345`,name:`worker-1`,image:`myapp/worker:v1.2.3`,status:`restarting`,createdAt:new Date(Date.now()-72*36e5)}];exports.WakaContainerList=g,exports.defaultContainers=_;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../waka-ad-provider/index.cjs.js"),r=require("../waka-sponsored-badge/index.cjs.js");let i=require("react");i=e.__toESM(i);let a=require("lucide-react"),o=require("react/jsx-runtime");function s({title:e=`You May Also Like`,slotIds:s,layout:c=`grid`,columns:l=3,showArrows:u=!0,autoScroll:d=!1,autoScrollInterval:f=5,className:p,onItemClick:m}){let h=(0,i.useRef)(null),g=(0,i.useRef)(null),{config:_,isReady:v,hasConsent:y,getCustomAd:b,trackEvent:x}=n.useAdContext(),{isVisible:S}=n.useAdVisibility(h),[C,w]=(0,i.useState)(new Map),[T,E]=(0,i.useState)(!0),[D,O]=(0,i.useState)(0);(0,i.useEffect)(()=>{!v||!S||y===!1||(async()=>{E(!0);let e=new Map;await Promise.all(s.map(async t=>{try{let n=await b(t);n&&(e.set(t,n),x({type:`loaded`,slotId:t,timestamp:new Date}),n.impressionUrl&&fetch(n.impressionUrl,{mode:`no-cors`}).catch(()=>{}))}catch{}})),w(e),E(!1)})()},[v,S,y,s,b,x]),(0,i.useEffect)(()=>{S&&C.size>0&&C.forEach((e,t)=>{x({type:`viewable`,slotId:t,timestamp:new Date})})},[S,C,x]),(0,i.useEffect)(()=>{if(c!==`carousel`||!d||C.size===0)return;let e=setInterval(()=>{O(e=>(e+1)%C.size)},f*1e3);return()=>clearInterval(e)},[c,d,f,C.size]),(0,i.useEffect)(()=>{if(c!==`carousel`||!g.current)return;let e=g.current.offsetWidth/Math.min(l,C.size);g.current.scrollTo({left:D*e,behavior:`smooth`})},[D,c,l,C.size]);let k=(e,t)=>{x({type:`click`,slotId:e,timestamp:new Date}),m?.(e),t.clickUrl&&fetch(t.clickUrl,{mode:`no-cors`}).catch(()=>{}),t.targetUrl&&window.open(t.targetUrl,`_blank`,`noopener,noreferrer`)},A=()=>{O(e=>(e-1+C.size)%C.size)},j=()=>{O(e=>(e+1)%C.size)};if(C.size===0&&!T)return null;let M={2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,4:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`},N=(e,t)=>(0,o.jsxs)(`button`,{onClick:()=>k(e,t),className:`group flex-shrink-0 w-full text-left rounded-lg overflow-hidden bg-card border hover:shadow-md transition-shadow`,children:[t.imageUrl&&(0,o.jsx)(`div`,{className:`relative aspect-video bg-muted overflow-hidden`,children:(0,o.jsx)(`img`,{src:t.imageUrl,alt:``,className:`w-full h-full object-cover group-hover:scale-105 transition-transform duration-300`})}),(0,o.jsxs)(`div`,{className:`p-3`,children:[(0,o.jsx)(`h4`,{className:`font-medium text-sm line-clamp-2 mb-1 group-hover:text-primary transition-colors`,children:t.title}),(0,o.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.sponsor||`Sponsored`}),(0,o.jsx)(a.ExternalLink,{className:`h-3 w-3 text-muted-foreground`})]})]})]},e);return(0,o.jsxs)(`div`,{ref:h,className:t.cn(`relative`,p),children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,o.jsx)(`h3`,{className:`font-semibold text-lg`,children:e}),(0,o.jsx)(r.WakaSponsoredBadge,{size:`sm`,showIcon:!1})]}),c===`carousel`&&u&&C.size>l&&(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`button`,{onClick:A,className:`p-1.5 rounded-full bg-muted hover:bg-muted-foreground/20 transition-colors`,"aria-label":`Previous`,children:(0,o.jsx)(a.ChevronLeft,{className:`h-4 w-4`})}),(0,o.jsx)(`button`,{onClick:j,className:`p-1.5 rounded-full bg-muted hover:bg-muted-foreground/20 transition-colors`,"aria-label":`Next`,children:(0,o.jsx)(a.ChevronRight,{className:`h-4 w-4`})})]})]}),T?(0,o.jsx)(`div`,{className:t.cn(`grid gap-4`,M[l]),children:s.slice(0,l).map((e,t)=>(0,o.jsx)(`div`,{className:`rounded-lg border bg-muted animate-pulse aspect-[4/3]`},t))}):c===`grid`?(0,o.jsx)(`div`,{className:t.cn(`grid gap-4`,M[l]),children:Array.from(C.entries()).map(([e,t])=>N(e,t))}):c===`carousel`?(0,o.jsx)(`div`,{ref:g,className:`flex gap-4 overflow-x-auto scrollbar-hide snap-x snap-mandatory`,style:{scrollbarWidth:`none`,msOverflowStyle:`none`},children:Array.from(C.entries()).map(([e,t])=>(0,o.jsx)(`div`,{className:`snap-start`,style:{minWidth:`calc((100% - ${(l-1)*16}px) / ${l})`},children:N(e,t)},e))}):(0,o.jsx)(`div`,{className:`space-y-3`,children:Array.from(C.entries()).map(([e,t])=>(0,o.jsxs)(`button`,{onClick:()=>k(e,t),className:`group w-full flex gap-3 p-2 rounded-lg border hover:bg-accent/50 transition-colors text-left`,children:[t.imageUrl&&(0,o.jsx)(`div`,{className:`w-20 h-20 flex-shrink-0 rounded-md overflow-hidden bg-muted`,children:(0,o.jsx)(`img`,{src:t.imageUrl,alt:``,className:`w-full h-full object-cover`})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,o.jsx)(`h4`,{className:`font-medium text-sm line-clamp-2 mb-1 group-hover:text-primary transition-colors`,children:t.title}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.sponsor||`Sponsored`})]})]},e))}),c===`carousel`&&C.size>l&&(0,o.jsx)(`div`,{className:`flex justify-center gap-1.5 mt-4`,children:Array.from({length:Math.ceil(C.size/l)}).map((e,n)=>(0,o.jsx)(`button`,{onClick:()=>O(n*l),className:t.cn(`w-2 h-2 rounded-full transition-colors`,Math.floor(D/l)===n?`bg-primary`:`bg-muted-foreground/30`),"aria-label":`Go to slide ${n+1}`},n))})]})}exports.WakaContentRecommendation=s,exports.default=s;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { cn as e } from "../../utils/cn.es.js";
|
|
4
4
|
import { useAdContext as t, useAdVisibility as n } from "../waka-ad-provider/index.es.js";
|
|
5
|
-
import r from "../waka-sponsored-badge/index.es.js";
|
|
5
|
+
import { WakaSponsoredBadge as r } from "../waka-sponsored-badge/index.es.js";
|
|
6
6
|
import { useEffect as i, useRef as a, useState as o } from "react";
|
|
7
7
|
import { ChevronLeft as s, ChevronRight as c, ExternalLink as l } from "lucide-react";
|
|
8
8
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
@@ -191,4 +191,4 @@ function f({ title: f = "You May Also Like", slotIds: p, layout: m = "grid", col
|
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
//#endregion
|
|
194
|
-
export { f as default };
|
|
194
|
+
export { f as WakaContentRecommendation, f as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../../utils/local-date.cjs.js");let r=require("react");r=e.__toESM(r);let i=require("react/jsx-runtime");var a={green:[`#ebedf0`,`#9be9a8`,`#40c463`,`#30a14e`,`#216e39`],blue:[`#ebedf0`,`#9ecae9`,`#6baed6`,`#3182bd`,`#08519c`],purple:[`#ebedf0`,`#d4b9da`,`#c994c7`,`#df65b0`,`#980043`],orange:[`#ebedf0`,`#fdd49e`,`#fdbb84`,`#fc8d59`,`#d7301f`]},o=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],s=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function c(e){return new Date(e,0,1)}function l(e){return new Date(e,11,31)}var u=n.localDateKey,d=n.parseLocalDate;function f(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function p(e,t){if(e===0||t===0)return 0;let n=e/t;return n<=.25?1:n<=.5?2:n<=.75?3:4}function m(e,t){let n=0,r=0,i=0,a=!0,o=new Date;o.setHours(0,0,0,0);let s=new Date(Math.min(o.getTime(),t.getTime()));s.setHours(0,0,0,0);let c=u(s);(!e.has(c)||e.get(c)===0)&&s.setDate(s.getDate()-1);let l=new Date(s.getFullYear(),0,1);for(;s>=l;){let t=u(s);(e.get(t)||0)>0?(i++,a&&(n=i),r=Math.max(r,i)):(a=!1,i=0),s.setDate(s.getDate()-1)}return{currentStreak:n,longestStreak:r}}function h({date:e,count:t,x:n,y:r}){let a=e.toLocaleDateString(`en-US`,{weekday:`short`,month:`short`,day:`numeric`,year:`numeric`});return(0,i.jsxs)(`div`,{className:`absolute z-50 px-2 py-1 text-xs font-medium text-white bg-gray-900 rounded shadow-lg pointer-events-none whitespace-nowrap`,style:{left:n,top:r,transform:`translate(-50%, -100%)`,marginTop:-8},children:[(0,i.jsxs)(`div`,{className:`font-semibold`,children:[t,` `,t===1?`contribution`:`contributions`]}),(0,i.jsx)(`div`,{className:`text-gray-300`,children:a}),(0,i.jsx)(`div`,{className:`absolute left-1/2 bottom-0 w-2 h-2 bg-gray-900 transform -translate-x-1/2 translate-y-1/2 rotate-45`})]})}function g({date:e,count:n,color:r,size:a,gap:o,isToday:s,onClick:c,onHover:l}){return(0,i.jsx)(`div`,{className:t.cn(`rounded-sm transition-all duration-150`,c&&`cursor-pointer hover:ring-2 hover:ring-gray-400 hover:ring-offset-1`,s&&`ring-2 ring-gray-600 ring-offset-1`),style:{width:a,height:a,backgroundColor:r,marginBottom:o},onMouseEnter:t=>{let r=t.currentTarget.getBoundingClientRect(),i=t.currentTarget.closest(`.contribution-graph-container`)?.getBoundingClientRect();i&&l({date:e,count:n,x:r.left-i.left+r.width/2,y:r.top-i.top})},onMouseLeave:()=>{l(null)},onClick:()=>{c?.(e,n)},role:`gridcell`,"aria-label":`${n} contributions on ${e.toDateString()}`})}function _({colors:e}){return(0,i.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,i.jsx)(`span`,{children:`Less`}),e.map((e,t)=>(0,i.jsx)(`div`,{className:`w-3 h-3 rounded-sm`,style:{backgroundColor:e}},t)),(0,i.jsx)(`span`,{children:`More`})]})}function v({currentStreak:e,longestStreak:t}){return(0,i.jsxs)(`div`,{className:`flex gap-6 text-sm`,children:[(0,i.jsxs)(`div`,{className:`flex flex-col`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Current streak`}),(0,i.jsxs)(`span`,{className:`font-semibold text-lg`,children:[e,` `,e===1?`day`:`days`]})]}),(0,i.jsxs)(`div`,{className:`flex flex-col`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Longest streak`}),(0,i.jsxs)(`span`,{className:`font-semibold text-lg`,children:[t,` `,t===1?`day`:`days`]})]})]})}function y({contributions:e,year:n=new Date().getFullYear(),colorScheme:y=`green`,colors:b,onCellClick:x,showWeekdayLabels:S=!0,showMonthLabels:C=!0,showLegend:w=!0,showStreak:T=!1,cellSize:E=10,cellGap:D=2,className:O}){let[k,A]=r.useState(null),j=r.useMemo(()=>{let t=new Map;return e.forEach(({date:e,count:n})=>{let r=u(d(e));t.set(r,(t.get(r)||0)+n)}),t},[e]),M=r.useMemo(()=>{let e=0;return j.forEach(t=>{t>e&&(e=t)}),e},[j]),N=b||a[y]||a.green,P=r.useMemo(()=>T?m(j,l(n)):{currentStreak:0,longestStreak:0},[j,n,T]),F=r.useMemo(()=>{let e=[],t=c(n),r=l(n),i=t.getDay(),a=new Date(t);a.setDate(a.getDate()-i);let o=new Date(a),s=[];for(;o<=r||s.length>0;){let i=u(o),a=j.get(i)||0;if(o.getFullYear()===n?s.push({date:new Date(o),count:a}):o<t&&s.push({date:new Date(o),count:-1}),o.setDate(o.getDate()+1),(o.getDay()===0||o>r)&&(s.length>0&&(e.push(s),s=[]),o>r))break}return e},[n,j]),I=r.useMemo(()=>{if(!C)return[];let e=[],t=-1;return F.forEach((n,r)=>{let i=n.find(e=>e.count>=0);if(i){let n=i.date.getMonth();n!==t&&(e.push({month:s[n],weekIndex:r}),t=n)}}),e},[F,C]),L=new Date;L.setHours(0,0,0,0);let R=S?28:0,z=E+D;return(0,i.jsxs)(`div`,{className:t.cn(`flex flex-col gap-2`,O),children:[T&&(0,i.jsx)(v,{currentStreak:P.currentStreak,longestStreak:P.longestStreak}),(0,i.jsxs)(`div`,{className:`contribution-graph-container relative overflow-x-auto`,children:[C&&(0,i.jsxs)(`div`,{className:`flex text-xs text-muted-foreground mb-1`,style:{marginLeft:R},children:[I.map((e,t)=>(0,i.jsx)(`div`,{className:`absolute`,style:{left:R+e.weekIndex*z},children:e.month},t)),(0,i.jsx)(`div`,{className:`h-4`})]}),(0,i.jsxs)(`div`,{className:`flex`,children:[S&&(0,i.jsx)(`div`,{className:`flex flex-col text-xs text-muted-foreground pr-1`,style:{width:R},children:o.map((e,n)=>(0,i.jsx)(`div`,{className:t.cn(`flex items-center justify-end`,![1,3,5].includes(n)&&`invisible`),style:{height:E+D},children:e},e))}),(0,i.jsx)(`div`,{className:`flex gap-0.5`,role:`grid`,"aria-label":`Contribution graph`,children:F.map((e,t)=>(0,i.jsx)(`div`,{className:`flex flex-col`,role:`row`,children:e.map((e,t)=>{if(e.count<0)return(0,i.jsx)(`div`,{style:{width:E,height:E,marginBottom:D}},t);let n=p(e.count,M),r=N[n],a=f(e.date,L);return(0,i.jsx)(g,{date:e.date,count:e.count,color:r,size:E,gap:D,isToday:a,onClick:x,onHover:e=>A(e?{...e}:null)},t)})},t))})]}),k&&(0,i.jsx)(h,{date:k.date,count:k.count,x:k.x,y:k.y})]}),w&&(0,i.jsx)(`div`,{className:`flex justify-end mt-1`,children:(0,i.jsx)(_,{colors:N})})]})}exports.WakaContributionGraph=y,exports.default=y;
|
|
@@ -289,14 +289,14 @@ function b({ contributions: t, year: n = (/* @__PURE__ */ new Date()).getFullYea
|
|
|
289
289
|
height: D,
|
|
290
290
|
marginBottom: O
|
|
291
291
|
} }, t);
|
|
292
|
-
let n =
|
|
292
|
+
let n = m(e.count, N), r = P[n], a = p(e.date, R);
|
|
293
293
|
return /* @__PURE__ */ i(_, {
|
|
294
294
|
date: e.date,
|
|
295
295
|
count: e.count,
|
|
296
|
-
color:
|
|
296
|
+
color: r,
|
|
297
297
|
size: D,
|
|
298
298
|
gap: O,
|
|
299
|
-
isToday:
|
|
299
|
+
isToday: a,
|
|
300
300
|
onClick: S,
|
|
301
301
|
onHover: (e) => j(e ? { ...e } : null)
|
|
302
302
|
}, t);
|
|
@@ -320,4 +320,4 @@ function b({ contributions: t, year: n = (/* @__PURE__ */ new Date()).getFullYea
|
|
|
320
320
|
});
|
|
321
321
|
}
|
|
322
322
|
//#endregion
|
|
323
|
-
export { b as default };
|
|
323
|
+
export { b as WakaContributionGraph, b as default };
|