@tetrascience-npm/tetrascience-react-ui 0.7.0-beta.108.1 → 0.7.0-beta.129.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/README.md +7 -3
- package/dist/components/ai/chain-of-thought.cjs +1 -1
- package/dist/components/ai/chain-of-thought.cjs.map +1 -1
- package/dist/components/ai/chain-of-thought.js +1 -1
- package/dist/components/ai/chain-of-thought.js.map +1 -1
- package/dist/components/ai/confirmation.cjs +1 -1
- package/dist/components/ai/confirmation.cjs.map +1 -1
- package/dist/components/ai/confirmation.js +1 -1
- package/dist/components/ai/confirmation.js.map +1 -1
- package/dist/components/ai/context.cjs +1 -1
- package/dist/components/ai/context.cjs.map +1 -1
- package/dist/components/ai/context.js +36 -35
- package/dist/components/ai/context.js.map +1 -1
- package/dist/components/ai/message.cjs +1 -1
- package/dist/components/ai/message.cjs.map +1 -1
- package/dist/components/ai/message.js +68 -68
- package/dist/components/ai/message.js.map +1 -1
- package/dist/components/ai/prompt-input.cjs +1 -1
- package/dist/components/ai/prompt-input.cjs.map +1 -1
- package/dist/components/ai/prompt-input.js +4 -2
- package/dist/components/ai/prompt-input.js.map +1 -1
- package/dist/components/ai/queue.cjs +1 -1
- package/dist/components/ai/queue.cjs.map +1 -1
- package/dist/components/ai/queue.js +9 -9
- package/dist/components/ai/queue.js.map +1 -1
- package/dist/components/ai/reasoning.cjs +1 -1
- package/dist/components/ai/reasoning.cjs.map +1 -1
- package/dist/components/ai/reasoning.js +67 -67
- package/dist/components/ai/reasoning.js.map +1 -1
- package/dist/components/ai/stream-status.cjs +1 -1
- package/dist/components/ai/stream-status.cjs.map +1 -1
- package/dist/components/ai/stream-status.js +41 -39
- package/dist/components/ai/stream-status.js.map +1 -1
- package/dist/components/ai/streamdown-code-plugin.cjs +2 -0
- package/dist/components/ai/streamdown-code-plugin.cjs.map +1 -0
- package/dist/components/ai/streamdown-code-plugin.js +42 -0
- package/dist/components/ai/streamdown-code-plugin.js.map +1 -0
- package/dist/components/ai/streamdown-plugins.cjs +2 -0
- package/dist/components/ai/streamdown-plugins.cjs.map +1 -0
- package/dist/components/ai/streamdown-plugins.js +14 -0
- package/dist/components/ai/streamdown-plugins.js.map +1 -0
- package/dist/components/ai/task.cjs +1 -1
- package/dist/components/ai/task.cjs.map +1 -1
- package/dist/components/ai/task.js +18 -11
- package/dist/components/ai/task.js.map +1 -1
- package/dist/components/ai/tool.cjs +1 -1
- package/dist/components/ai/tool.cjs.map +1 -1
- package/dist/components/ai/tool.js +51 -55
- package/dist/components/ai/tool.js.map +1 -1
- package/dist/components/ai/use-streamdown-plugins.cjs +2 -0
- package/dist/components/ai/use-streamdown-plugins.cjs.map +1 -0
- package/dist/components/ai/use-streamdown-plugins.js +25 -0
- package/dist/components/ai/use-streamdown-plugins.js.map +1 -0
- package/dist/components/charts/AreaPlot/AreaPlot.cjs +2 -0
- package/dist/components/charts/AreaPlot/AreaPlot.cjs.map +1 -0
- package/dist/components/charts/AreaPlot/AreaPlot.js +270 -0
- package/dist/components/charts/AreaPlot/AreaPlot.js.map +1 -0
- package/dist/components/charts/BarChart/BarChart.cjs +2 -0
- package/dist/components/charts/BarChart/BarChart.cjs.map +1 -0
- package/dist/components/charts/BarChart/BarChart.js +219 -0
- package/dist/components/charts/BarChart/BarChart.js.map +1 -0
- package/dist/components/charts/BoxPlot/BoxPlot.cjs +2 -0
- package/dist/components/charts/BoxPlot/BoxPlot.cjs.map +1 -0
- package/dist/components/charts/{Boxplot/Boxplot.js → BoxPlot/BoxPlot.js} +78 -79
- package/dist/components/charts/BoxPlot/BoxPlot.js.map +1 -0
- package/dist/components/charts/ChartTooltip/ChartTooltip.cjs +1 -1
- package/dist/components/charts/ChartTooltip/ChartTooltip.cjs.map +1 -1
- package/dist/components/charts/ChartTooltip/ChartTooltip.js +22 -22
- package/dist/components/charts/ChartTooltip/ChartTooltip.js.map +1 -1
- package/dist/components/charts/Chromatogram/Chromatogram.cjs +1 -1
- package/dist/components/charts/Chromatogram/Chromatogram.cjs.map +1 -1
- package/dist/components/charts/Chromatogram/Chromatogram.js +232 -170
- package/dist/components/charts/Chromatogram/Chromatogram.js.map +1 -1
- package/dist/components/charts/Chromatogram/annotations.cjs +2 -0
- package/dist/components/charts/Chromatogram/annotations.cjs.map +1 -0
- package/dist/components/charts/Chromatogram/annotations.js +137 -0
- package/dist/components/charts/Chromatogram/annotations.js.map +1 -0
- package/dist/components/charts/Chromatogram/boundaryMarkers.cjs.map +1 -0
- package/dist/components/charts/Chromatogram/boundaryMarkers.js.map +1 -0
- package/dist/components/charts/Chromatogram/constants.cjs.map +1 -0
- package/dist/components/charts/Chromatogram/constants.js.map +1 -0
- package/dist/components/charts/Chromatogram/dataProcessing.cjs.map +1 -0
- package/dist/components/charts/Chromatogram/dataProcessing.js.map +1 -0
- package/dist/components/charts/Chromatogram/peakDetection.cjs.map +1 -0
- package/dist/components/charts/Chromatogram/peakDetection.js.map +1 -0
- package/dist/components/charts/Chromatogram/plotBuilder.cjs +2 -0
- package/dist/components/charts/Chromatogram/plotBuilder.cjs.map +1 -0
- package/dist/components/charts/Chromatogram/plotBuilder.js +216 -0
- package/dist/components/charts/Chromatogram/plotBuilder.js.map +1 -0
- package/dist/components/charts/Chromatogram/regionOverlays.cjs.map +1 -0
- package/dist/components/charts/Chromatogram/regionOverlays.js.map +1 -0
- package/dist/components/charts/Electropherogram/Electropherogram.cjs +2 -0
- package/dist/components/charts/Electropherogram/Electropherogram.cjs.map +1 -0
- package/dist/components/charts/Electropherogram/Electropherogram.js +180 -0
- package/dist/components/charts/Electropherogram/Electropherogram.js.map +1 -0
- package/dist/components/charts/Histogram/Histogram.cjs +1 -1
- package/dist/components/charts/Histogram/Histogram.cjs.map +1 -1
- package/dist/components/charts/Histogram/Histogram.js +107 -108
- package/dist/components/charts/Histogram/Histogram.js.map +1 -1
- package/dist/components/charts/LinePlot/LinePlot.cjs +2 -0
- package/dist/components/charts/LinePlot/LinePlot.cjs.map +1 -0
- package/dist/components/charts/LinePlot/LinePlot.js +224 -0
- package/dist/components/charts/LinePlot/LinePlot.js.map +1 -0
- package/dist/components/charts/PieChart/PieChart.cjs +1 -1
- package/dist/components/charts/PieChart/PieChart.cjs.map +1 -1
- package/dist/components/charts/PieChart/PieChart.js +62 -61
- package/dist/components/charts/PieChart/PieChart.js.map +1 -1
- package/dist/components/charts/PlateMap/PlateMap.cjs +1 -1
- package/dist/components/charts/PlateMap/PlateMap.cjs.map +1 -1
- package/dist/components/charts/PlateMap/PlateMap.js +246 -242
- package/dist/components/charts/PlateMap/PlateMap.js.map +1 -1
- package/dist/components/charts/ScatterPlot/ScatterPlot.cjs +2 -0
- package/dist/components/charts/ScatterPlot/ScatterPlot.cjs.map +1 -0
- package/dist/components/charts/ScatterPlot/ScatterPlot.js +252 -0
- package/dist/components/charts/ScatterPlot/ScatterPlot.js.map +1 -0
- package/dist/components/charts/ScatterPlotInteractive/ScatterPlotInteractive.cjs +2 -0
- package/dist/components/charts/ScatterPlotInteractive/ScatterPlotInteractive.cjs.map +1 -0
- package/dist/components/charts/ScatterPlotInteractive/ScatterPlotInteractive.js +215 -0
- package/dist/components/charts/ScatterPlotInteractive/ScatterPlotInteractive.js.map +1 -0
- package/dist/components/charts/ScatterPlotInteractive/constants.cjs +2 -0
- package/dist/components/charts/ScatterPlotInteractive/constants.cjs.map +1 -0
- package/dist/components/charts/ScatterPlotInteractive/constants.js +38 -0
- package/dist/components/charts/ScatterPlotInteractive/constants.js.map +1 -0
- package/dist/components/charts/ScatterPlotInteractive/utils.cjs +2 -0
- package/dist/components/charts/ScatterPlotInteractive/utils.cjs.map +1 -0
- package/dist/components/charts/ScatterPlotInteractive/utils.js +261 -0
- package/dist/components/charts/ScatterPlotInteractive/utils.js.map +1 -0
- package/dist/components/charts/StackedChromatogram/StackedChromatogram.cjs +2 -0
- package/dist/components/charts/StackedChromatogram/StackedChromatogram.cjs.map +1 -0
- package/dist/components/charts/StackedChromatogram/StackedChromatogram.js +40 -0
- package/dist/components/charts/StackedChromatogram/StackedChromatogram.js.map +1 -0
- package/dist/components/charts/StackedChromatogram/transforms.cjs.map +1 -0
- package/dist/components/charts/StackedChromatogram/transforms.js.map +1 -0
- package/dist/components/charts/plotly-loader.cjs +2 -0
- package/dist/components/charts/plotly-loader.cjs.map +1 -0
- package/dist/components/charts/plotly-loader.js +22 -0
- package/dist/components/charts/plotly-loader.js.map +1 -0
- package/dist/components/composed/AssistantLayout/AssistantLayout.cjs +2 -0
- package/dist/components/composed/AssistantLayout/AssistantLayout.cjs.map +1 -0
- package/dist/components/composed/AssistantLayout/AssistantLayout.js +142 -0
- package/dist/components/composed/AssistantLayout/AssistantLayout.js.map +1 -0
- package/dist/components/composed/AssistantLayout/dockLayout.cjs +2 -0
- package/dist/components/composed/AssistantLayout/dockLayout.cjs.map +1 -0
- package/dist/components/composed/AssistantLayout/dockLayout.js +10 -0
- package/dist/components/composed/AssistantLayout/dockLayout.js.map +1 -0
- package/dist/components/composed/Chat/Chat.cjs +1 -1
- package/dist/components/composed/Chat/Chat.cjs.map +1 -1
- package/dist/components/composed/Chat/Chat.js +23 -23
- package/dist/components/composed/Chat/Chat.js.map +1 -1
- package/dist/components/composed/ConfirmDialog/ConfirmDialog.cjs +1 -1
- package/dist/components/composed/ConfirmDialog/ConfirmDialog.cjs.map +1 -1
- package/dist/components/composed/ConfirmDialog/ConfirmDialog.js +33 -29
- package/dist/components/composed/ConfirmDialog/ConfirmDialog.js.map +1 -1
- package/dist/components/composed/DataAppShell/CollapseButton.cjs +2 -0
- package/dist/components/composed/DataAppShell/CollapseButton.cjs.map +1 -0
- package/dist/components/composed/DataAppShell/CollapseButton.js +42 -0
- package/dist/components/composed/DataAppShell/CollapseButton.js.map +1 -0
- package/dist/components/composed/DataAppShell/DataAppShell.cjs +1 -1
- package/dist/components/composed/DataAppShell/DataAppShell.cjs.map +1 -1
- package/dist/components/composed/DataAppShell/DataAppShell.js +349 -313
- package/dist/components/composed/DataAppShell/DataAppShell.js.map +1 -1
- package/dist/components/composed/DataAppShell/PrimaryNav.cjs +2 -0
- package/dist/components/composed/DataAppShell/PrimaryNav.cjs.map +1 -0
- package/dist/components/composed/DataAppShell/PrimaryNav.js +268 -0
- package/dist/components/composed/DataAppShell/PrimaryNav.js.map +1 -0
- package/dist/components/composed/DataAppShell/RightPanel.cjs +2 -0
- package/dist/components/composed/DataAppShell/RightPanel.cjs.map +1 -0
- package/dist/components/composed/DataAppShell/RightPanel.js +282 -0
- package/dist/components/composed/DataAppShell/RightPanel.js.map +1 -0
- package/dist/components/composed/DataAppShell/SecondaryNav.cjs +2 -0
- package/dist/components/composed/DataAppShell/SecondaryNav.cjs.map +1 -0
- package/dist/components/composed/DataAppShell/SecondaryNav.js +364 -0
- package/dist/components/composed/DataAppShell/SecondaryNav.js.map +1 -0
- package/dist/components/composed/DataAppShell/ShellContext.cjs +2 -0
- package/dist/components/composed/DataAppShell/ShellContext.cjs.map +1 -0
- package/dist/components/composed/DataAppShell/ShellContext.js +23 -0
- package/dist/components/composed/DataAppShell/ShellContext.js.map +1 -0
- package/dist/components/composed/MoleculeStructure/MoleculeStructure.cjs +2 -0
- package/dist/components/composed/MoleculeStructure/MoleculeStructure.cjs.map +1 -0
- package/dist/components/composed/MoleculeStructure/MoleculeStructure.js +87 -0
- package/dist/components/composed/MoleculeStructure/MoleculeStructure.js.map +1 -0
- package/dist/components/composed/MoleculeStructure/rdkit-loader.cjs +2 -0
- package/dist/components/composed/MoleculeStructure/rdkit-loader.cjs.map +1 -0
- package/dist/components/composed/MoleculeStructure/rdkit-loader.js +89 -0
- package/dist/components/composed/MoleculeStructure/rdkit-loader.js.map +1 -0
- package/dist/components/composed/MoleculeStructure/use-rdkit.cjs +2 -0
- package/dist/components/composed/MoleculeStructure/use-rdkit.cjs.map +1 -0
- package/dist/components/composed/MoleculeStructure/use-rdkit.js +19 -0
- package/dist/components/composed/MoleculeStructure/use-rdkit.js.map +1 -0
- package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.js +17 -17
- package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapActionsMenu.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapActionsMenu.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapActionsMenu.js +33 -33
- package/dist/components/composed/PlateMapEditor/PlateMapActionsMenu.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.js +7 -7
- package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlatePaintGrid.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/PlatePaintGrid.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlatePaintGrid.js +1 -1
- package/dist/components/composed/PlateMapEditor/PlatePaintGrid.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/WellLegend.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/WellLegend.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/WellLegend.js +24 -12
- package/dist/components/composed/PlateMapEditor/WellLegend.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/WellManifestTable.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/WellManifestTable.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/WellManifestTable.js +1 -1
- package/dist/components/composed/PlateMapEditor/WellManifestTable.js.map +1 -1
- package/dist/components/composed/TdpSearch/components/DefaultFilters.cjs +1 -1
- package/dist/components/composed/TdpSearch/components/DefaultFilters.cjs.map +1 -1
- package/dist/components/composed/TdpSearch/components/DefaultFilters.js +3 -3
- package/dist/components/composed/TdpSearch/components/DefaultFilters.js.map +1 -1
- package/dist/components/composed/TopBar/TopBar.cjs +2 -0
- package/dist/components/composed/TopBar/TopBar.cjs.map +1 -0
- package/dist/components/composed/TopBar/TopBar.js +56 -0
- package/dist/components/composed/TopBar/TopBar.js.map +1 -0
- package/dist/components/composed/UserMenu/UserMenu.cjs +2 -0
- package/dist/components/composed/UserMenu/UserMenu.cjs.map +1 -0
- package/dist/components/composed/UserMenu/UserMenu.js +99 -0
- package/dist/components/composed/UserMenu/UserMenu.js.map +1 -0
- package/dist/components/composed/tdp-link.cjs +1 -1
- package/dist/components/composed/tdp-link.cjs.map +1 -1
- package/dist/components/composed/tdp-link.js +5 -5
- package/dist/components/composed/tdp-link.js.map +1 -1
- package/dist/components/ui/alert.cjs +1 -1
- package/dist/components/ui/alert.cjs.map +1 -1
- package/dist/components/ui/alert.js +12 -12
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/badge.cjs +1 -1
- package/dist/components/ui/badge.cjs.map +1 -1
- package/dist/components/ui/badge.js +14 -14
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/banner.cjs +1 -1
- package/dist/components/ui/banner.cjs.map +1 -1
- package/dist/components/ui/banner.js +17 -17
- package/dist/components/ui/banner.js.map +1 -1
- package/dist/components/ui/button.cjs +1 -1
- package/dist/components/ui/button.cjs.map +1 -1
- package/dist/components/ui/button.js +16 -16
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.cjs +1 -1
- package/dist/components/ui/calendar.cjs.map +1 -1
- package/dist/components/ui/calendar.js +3 -3
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/code-block.cjs +3 -3
- package/dist/components/ui/code-block.cjs.map +1 -1
- package/dist/components/ui/code-block.js +136 -118
- package/dist/components/ui/code-block.js.map +1 -1
- package/dist/components/ui/code-editor.cjs +1 -1
- package/dist/components/ui/code-editor.cjs.map +1 -1
- package/dist/components/ui/code-editor.js +14 -12
- package/dist/components/ui/code-editor.js.map +1 -1
- package/dist/components/ui/combobox.cjs +1 -1
- package/dist/components/ui/combobox.cjs.map +1 -1
- package/dist/components/ui/combobox.js +33 -29
- package/dist/components/ui/combobox.js.map +1 -1
- package/dist/components/ui/command.cjs +1 -1
- package/dist/components/ui/command.cjs.map +1 -1
- package/dist/components/ui/command.js +81 -77
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/context-menu.cjs +1 -1
- package/dist/components/ui/context-menu.cjs.map +1 -1
- package/dist/components/ui/context-menu.js +13 -13
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/data-table/data-table-column-toggle.cjs +1 -1
- package/dist/components/ui/data-table/data-table-column-toggle.cjs.map +1 -1
- package/dist/components/ui/data-table/data-table-column-toggle.js +70 -62
- package/dist/components/ui/data-table/data-table-column-toggle.js.map +1 -1
- package/dist/components/ui/data-table/data-table-filter.cjs +1 -1
- package/dist/components/ui/data-table/data-table-filter.cjs.map +1 -1
- package/dist/components/ui/data-table/data-table-filter.js +24 -23
- package/dist/components/ui/data-table/data-table-filter.js.map +1 -1
- package/dist/components/ui/data-table/data-table-group.cjs +1 -1
- package/dist/components/ui/data-table/data-table-group.cjs.map +1 -1
- package/dist/components/ui/data-table/data-table-group.js +17 -16
- package/dist/components/ui/data-table/data-table-group.js.map +1 -1
- package/dist/components/ui/data-table/data-table-pagination.cjs +1 -1
- package/dist/components/ui/data-table/data-table-pagination.cjs.map +1 -1
- package/dist/components/ui/data-table/data-table-pagination.js +15 -15
- package/dist/components/ui/data-table/data-table-pagination.js.map +1 -1
- package/dist/components/ui/data-table/data-table.cjs +1 -1
- package/dist/components/ui/data-table/data-table.cjs.map +1 -1
- package/dist/components/ui/data-table/data-table.js +191 -190
- package/dist/components/ui/data-table/data-table.js.map +1 -1
- package/dist/components/ui/dialog.cjs +1 -1
- package/dist/components/ui/dialog.cjs.map +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/dropdown-menu.cjs +1 -1
- package/dist/components/ui/dropdown-menu.cjs.map +1 -1
- package/dist/components/ui/dropdown-menu.js +12 -4
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/hover-card.cjs +1 -1
- package/dist/components/ui/hover-card.cjs.map +1 -1
- package/dist/components/ui/hover-card.js +3 -3
- package/dist/components/ui/hover-card.js.map +1 -1
- package/dist/components/ui/item.cjs +1 -1
- package/dist/components/ui/item.cjs.map +1 -1
- package/dist/components/ui/item.js +44 -36
- package/dist/components/ui/item.js.map +1 -1
- package/dist/components/ui/menubar.cjs +1 -1
- package/dist/components/ui/menubar.cjs.map +1 -1
- package/dist/components/ui/menubar.js +2 -2
- package/dist/components/ui/menubar.js.map +1 -1
- package/dist/components/ui/navigation-menu.cjs +1 -1
- package/dist/components/ui/navigation-menu.cjs.map +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/navigation-menu.js.map +1 -1
- package/dist/components/ui/popover.cjs +1 -1
- package/dist/components/ui/popover.cjs.map +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/scroll-area.cjs +1 -1
- package/dist/components/ui/scroll-area.cjs.map +1 -1
- package/dist/components/ui/scroll-area.js +1 -0
- package/dist/components/ui/scroll-area.js.map +1 -1
- package/dist/components/ui/select.cjs +1 -1
- package/dist/components/ui/select.cjs.map +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/sheet.cjs +1 -1
- package/dist/components/ui/sheet.cjs.map +1 -1
- package/dist/components/ui/sheet.js +5 -5
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/sidebar.cjs +1 -1
- package/dist/components/ui/sidebar.cjs.map +1 -1
- package/dist/components/ui/sidebar.js +2 -2
- package/dist/components/ui/sidebar.js.map +1 -1
- package/dist/components/ui/slider.cjs +1 -1
- package/dist/components/ui/slider.cjs.map +1 -1
- package/dist/components/ui/slider.js +10 -9
- package/dist/components/ui/slider.js.map +1 -1
- package/dist/components/ui/sonner.cjs +1 -1
- package/dist/components/ui/sonner.cjs.map +1 -1
- package/dist/components/ui/sonner.js +25 -10
- package/dist/components/ui/sonner.js.map +1 -1
- package/dist/components/ui/table.cjs +1 -1
- package/dist/components/ui/table.cjs.map +1 -1
- package/dist/components/ui/table.js +1 -0
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.cjs +1 -1
- package/dist/components/ui/tabs.cjs.map +1 -1
- package/dist/components/ui/tabs.js +18 -18
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/tetra-molecule-icon.cjs +2 -0
- package/dist/components/ui/tetra-molecule-icon.cjs.map +1 -0
- package/dist/components/ui/tetra-molecule-icon.js +49 -0
- package/dist/components/ui/tetra-molecule-icon.js.map +1 -0
- package/dist/components/ui/toggle-group.cjs +1 -1
- package/dist/components/ui/toggle-group.cjs.map +1 -1
- package/dist/components/ui/toggle-group.js +35 -31
- package/dist/components/ui/toggle-group.js.map +1 -1
- package/dist/hooks/use-plotly-theme.cjs +1 -1
- package/dist/hooks/use-plotly-theme.cjs.map +1 -1
- package/dist/hooks/use-plotly-theme.js +4 -3
- package/dist/hooks/use-plotly-theme.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1073 -136
- package/dist/index.js +698 -647
- package/dist/index.js.map +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/lib/shiki.cjs +2 -0
- package/dist/lib/shiki.cjs.map +1 -0
- package/dist/lib/shiki.js +72 -0
- package/dist/lib/shiki.js.map +1 -0
- package/package.json +23 -12
- package/dist/components/charts/AreaGraph/AreaGraph.cjs +0 -2
- package/dist/components/charts/AreaGraph/AreaGraph.cjs.map +0 -1
- package/dist/components/charts/AreaGraph/AreaGraph.js +0 -271
- package/dist/components/charts/AreaGraph/AreaGraph.js.map +0 -1
- package/dist/components/charts/BarGraph/BarGraph.cjs +0 -2
- package/dist/components/charts/BarGraph/BarGraph.cjs.map +0 -1
- package/dist/components/charts/BarGraph/BarGraph.js +0 -220
- package/dist/components/charts/BarGraph/BarGraph.js.map +0 -1
- package/dist/components/charts/Boxplot/Boxplot.cjs +0 -2
- package/dist/components/charts/Boxplot/Boxplot.cjs.map +0 -1
- package/dist/components/charts/Boxplot/Boxplot.js.map +0 -1
- package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs +0 -2
- package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs.map +0 -1
- package/dist/components/charts/ChromatogramChart/ChromatogramChart.js +0 -241
- package/dist/components/charts/ChromatogramChart/ChromatogramChart.js.map +0 -1
- package/dist/components/charts/ChromatogramChart/annotations.cjs +0 -2
- package/dist/components/charts/ChromatogramChart/annotations.cjs.map +0 -1
- package/dist/components/charts/ChromatogramChart/annotations.js +0 -136
- package/dist/components/charts/ChromatogramChart/annotations.js.map +0 -1
- package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs.map +0 -1
- package/dist/components/charts/ChromatogramChart/boundaryMarkers.js.map +0 -1
- package/dist/components/charts/ChromatogramChart/constants.cjs.map +0 -1
- package/dist/components/charts/ChromatogramChart/constants.js.map +0 -1
- package/dist/components/charts/ChromatogramChart/dataProcessing.cjs.map +0 -1
- package/dist/components/charts/ChromatogramChart/dataProcessing.js.map +0 -1
- package/dist/components/charts/ChromatogramChart/peakDetection.cjs.map +0 -1
- package/dist/components/charts/ChromatogramChart/peakDetection.js.map +0 -1
- package/dist/components/charts/ChromatogramChart/plotBuilder.cjs +0 -2
- package/dist/components/charts/ChromatogramChart/plotBuilder.cjs.map +0 -1
- package/dist/components/charts/ChromatogramChart/plotBuilder.js +0 -207
- package/dist/components/charts/ChromatogramChart/plotBuilder.js.map +0 -1
- package/dist/components/charts/ChromatogramChart/regionOverlays.cjs.map +0 -1
- package/dist/components/charts/ChromatogramChart/regionOverlays.js.map +0 -1
- package/dist/components/charts/DotPlot/DotPlot.cjs +0 -2
- package/dist/components/charts/DotPlot/DotPlot.cjs.map +0 -1
- package/dist/components/charts/DotPlot/DotPlot.js +0 -208
- package/dist/components/charts/DotPlot/DotPlot.js.map +0 -1
- package/dist/components/charts/Heatmap/Heatmap.cjs +0 -2
- package/dist/components/charts/Heatmap/Heatmap.cjs.map +0 -1
- package/dist/components/charts/Heatmap/Heatmap.js +0 -67
- package/dist/components/charts/Heatmap/Heatmap.js.map +0 -1
- package/dist/components/charts/LineGraph/LineGraph.cjs +0 -2
- package/dist/components/charts/LineGraph/LineGraph.cjs.map +0 -1
- package/dist/components/charts/LineGraph/LineGraph.js +0 -225
- package/dist/components/charts/LineGraph/LineGraph.js.map +0 -1
- package/dist/components/charts/ScatterGraph/ScatterGraph.cjs +0 -2
- package/dist/components/charts/ScatterGraph/ScatterGraph.cjs.map +0 -1
- package/dist/components/charts/ScatterGraph/ScatterGraph.js +0 -234
- package/dist/components/charts/ScatterGraph/ScatterGraph.js.map +0 -1
- package/dist/components/charts/StackedChromatogramChart/StackedChromatogramChart.cjs +0 -2
- package/dist/components/charts/StackedChromatogramChart/StackedChromatogramChart.cjs.map +0 -1
- package/dist/components/charts/StackedChromatogramChart/StackedChromatogramChart.js +0 -40
- package/dist/components/charts/StackedChromatogramChart/StackedChromatogramChart.js.map +0 -1
- package/dist/components/charts/StackedChromatogramChart/transforms.cjs.map +0 -1
- package/dist/components/charts/StackedChromatogramChart/transforms.js.map +0 -1
- /package/dist/components/charts/{ChromatogramChart → Chromatogram}/boundaryMarkers.cjs +0 -0
- /package/dist/components/charts/{ChromatogramChart → Chromatogram}/boundaryMarkers.js +0 -0
- /package/dist/components/charts/{ChromatogramChart → Chromatogram}/constants.cjs +0 -0
- /package/dist/components/charts/{ChromatogramChart → Chromatogram}/constants.js +0 -0
- /package/dist/components/charts/{ChromatogramChart → Chromatogram}/dataProcessing.cjs +0 -0
- /package/dist/components/charts/{ChromatogramChart → Chromatogram}/dataProcessing.js +0 -0
- /package/dist/components/charts/{ChromatogramChart → Chromatogram}/peakDetection.cjs +0 -0
- /package/dist/components/charts/{ChromatogramChart → Chromatogram}/peakDetection.js +0 -0
- /package/dist/components/charts/{ChromatogramChart → Chromatogram}/regionOverlays.cjs +0 -0
- /package/dist/components/charts/{ChromatogramChart → Chromatogram}/regionOverlays.js +0 -0
- /package/dist/components/charts/{StackedChromatogramChart → StackedChromatogram}/transforms.cjs +0 -0
- /package/dist/components/charts/{StackedChromatogramChart → StackedChromatogram}/transforms.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"peakDetection.js","sources":["../../../../src/components/charts/ChromatogramChart/peakDetection.ts"],"sourcesContent":["/**\n * Peak detection algorithms for ChromatogramChart\n */\n\nimport type { PeakAnnotation, PeakDetectionOptions } from \"./types\";\n\n/**\n * Calculate prominence of a peak (how much it stands out from neighbors)\n */\nexport function calculateProminence(\n y: number[],\n peakIndex: number,\n searchWindow: number\n): number {\n let leftMin = y[peakIndex];\n let rightMin = y[peakIndex];\n\n for (let j = peakIndex - 1; j >= Math.max(0, peakIndex - searchWindow); j--) {\n leftMin = Math.min(leftMin, y[j]);\n }\n for (\n let j = peakIndex + 1;\n j < Math.min(y.length, peakIndex + searchWindow);\n j++\n ) {\n rightMin = Math.min(rightMin, y[j]);\n }\n\n return y[peakIndex] - Math.max(leftMin, rightMin);\n}\n\n/**\n * Find peak boundary indices by walking outward from peak\n */\nexport function findPeakBoundaries(\n y: number[],\n peakIndex: number\n): { startIndex: number; endIndex: number } {\n let startIndex = peakIndex;\n let endIndex = peakIndex;\n\n // Walk left to find start\n for (let j = peakIndex - 1; j >= 0; j--) {\n if (y[j] <= y[j + 1]) {\n startIndex = j;\n } else {\n break;\n }\n }\n\n // Walk right to find end\n for (let j = peakIndex + 1; j < y.length; j++) {\n if (y[j] <= y[j - 1]) {\n endIndex = j;\n } else {\n break;\n }\n }\n\n return { startIndex, endIndex };\n}\n\n/**\n * Calculate peak area using trapezoidal integration\n */\nexport function calculatePeakArea(\n x: number[],\n y: number[],\n startIndex: number,\n endIndex: number\n): number {\n const baselineY = Math.min(y[startIndex], y[endIndex]);\n let area = 0;\n\n for (let j = startIndex; j < endIndex; j++) {\n const h = x[j + 1] - x[j];\n const y1 = y[j] - baselineY;\n const y2 = y[j + 1] - baselineY;\n area += ((y1 + y2) * h) / 2;\n }\n\n return area;\n}\n\n/**\n * Calculate width at half maximum of a peak\n */\nexport function calculateWidthAtHalfMax(\n x: number[],\n y: number[],\n peakIndex: number,\n startIndex: number,\n endIndex: number\n): number {\n const baselineY = Math.min(y[startIndex], y[endIndex]);\n const halfMax = (y[peakIndex] + baselineY) / 2;\n let leftHalf = peakIndex;\n let rightHalf = peakIndex;\n\n for (let j = peakIndex; j >= startIndex; j--) {\n if (y[j] < halfMax) {\n leftHalf = j;\n break;\n }\n }\n for (let j = peakIndex; j <= endIndex; j++) {\n if (y[j] < halfMax) {\n rightHalf = j;\n break;\n }\n }\n\n return x[rightHalf] - x[leftHalf];\n}\n\n/**\n * Filter peaks by minimum distance, keeping more intense peaks\n */\nexport function filterPeaksByDistance(\n peaks: PeakAnnotation[],\n minDistance: number\n): PeakAnnotation[] {\n const filtered: PeakAnnotation[] = [];\n\n for (const peak of peaks) {\n const tooClose = filtered.some(\n (p) => Math.abs((p._computed?.index ?? 0) - (peak._computed?.index ?? 0)) < minDistance\n );\n if (!tooClose) {\n filtered.push(peak);\n } else if (\n filtered.length > 0 &&\n peak.y > filtered[filtered.length - 1].y\n ) {\n filtered.pop();\n filtered.push(peak);\n }\n }\n\n return filtered.sort((a, b) => a.x - b.x);\n}\n\n/**\n * Detect peaks in signal data using derivative analysis.\n *\n * Default parameters are tuned for typical HPLC chromatograms:\n * - minHeight (0.05 = 5%): Filters noise while detecting small peaks\n * - minDistance (5 points): Prevents detecting noise as multiple peaks\n * - prominence (0.02 = 2%): Ensures peaks stand out from baseline/shoulders\n */\nexport function detectPeaks(\n x: number[],\n y: number[],\n options: PeakDetectionOptions = {}\n): PeakAnnotation[] {\n const {\n minHeight = 0.05,\n minDistance = 5,\n prominence = 0.02,\n relativeThreshold = true,\n } = options;\n\n if (y.length < 3) return [];\n\n const maxY = Math.max(...y);\n const threshold = relativeThreshold ? minHeight * maxY : minHeight;\n const prominenceThreshold = relativeThreshold ? prominence * maxY : prominence;\n const searchWindow = minDistance * 3;\n\n const peaks: PeakAnnotation[] = [];\n\n // Find local maxima\n for (let i = 1; i < y.length - 1; i++) {\n const isLocalMax =\n y[i] > y[i - 1] && y[i] > y[i + 1] && y[i] >= threshold;\n if (!isLocalMax) continue;\n\n const peakProminence = calculateProminence(y, i, searchWindow);\n if (peakProminence < prominenceThreshold) continue;\n\n const { startIndex, endIndex } = findPeakBoundaries(y, i);\n const area = calculatePeakArea(x, y, startIndex, endIndex);\n const widthAtHalfMax = calculateWidthAtHalfMax(\n x,\n y,\n i,\n startIndex,\n endIndex\n );\n\n peaks.push({\n x: x[i],\n y: y[i],\n _computed: {\n area,\n index: i,\n startIndex,\n endIndex,\n widthAtHalfMax,\n },\n });\n }\n\n return filterPeaksByDistance(peaks, minDistance);\n}\n\n"],"names":["calculateProminence","y","peakIndex","searchWindow","leftMin","rightMin","j","findPeakBoundaries","startIndex","endIndex","calculatePeakArea","x","baselineY","area","h","y1","y2","calculateWidthAtHalfMax","halfMax","leftHalf","rightHalf","filterPeaksByDistance","peaks","minDistance","filtered","peak","p","a","b","detectPeaks","options","minHeight","prominence","relativeThreshold","maxY","threshold","prominenceThreshold","i","widthAtHalfMax"],"mappings":"AASO,SAASA,EACdC,GACAC,GACAC,GACQ;AACR,MAAIC,IAAUH,EAAEC,CAAS,GACrBG,IAAWJ,EAAEC,CAAS;AAE1B,WAASI,IAAIJ,IAAY,GAAGI,KAAK,KAAK,IAAI,GAAGJ,IAAYC,CAAY,GAAGG;AACtE,IAAAF,IAAU,KAAK,IAAIA,GAASH,EAAEK,CAAC,CAAC;AAElC,WACMA,IAAIJ,IAAY,GACpBI,IAAI,KAAK,IAAIL,EAAE,QAAQC,IAAYC,C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,EAAqB;AAE1C,UAAM,EAAE,YAAA5B,GAAY,UAAAC,EAAA,IAAaF,EAAmBN,GAAGoC,CAAC,GAClDxB,IAAOH,EAAkBC,GAAGV,GAAGO,GAAYC,CAAQ,GACnD6B,IAAiBrB;AAAA,MACrBN;AAAA,MACAV;AAAA,MACAoC;AAAA,MACA7B;AAAA,MACAC;AAAA,IAAA;AAGF,IAAAa,EAAM,KAAK;AAAA,MACT,GAAGX,EAAE0B,CAAC;AAAA,MACN,GAAGpC,EAAEoC,CAAC;AAAA,MACN,WAAW;AAAA,QACT,MAAAxB;AAAA,QACA,OAAOwB;AAAA,QACP,YAAA7B;AAAA,QACA,UAAAC;AAAA,QACA,gBAAA6B;AAAA,MAAA;AAAA,IACF,CACD;AAAA,EACH;AAEA,SAAOjB,EAAsBC,GAAOC,CAAW;AACjD;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("plotly.js-dist"),g=require("../../../utils/colors.cjs"),k=require("./boundaryMarkers.cjs"),l=require("./constants.cjs"),x=require("./dataProcessing.cjs"),y=require("./regionOverlays.cjs");function C(n){const{processedSeries:r,processedAnnotations:a,allDetectedPeaks:u,allPeaksForInteraction:s,showMarkers:d,markerSize:p,xAxisTitle:A,yAxisTitle:i,boundaryMarkers:h}=n,T=r.map((t,c)=>{const e=t.color||g.CHART_COLORS[c%g.CHART_COLORS.length],f=x.buildHoverExtraContent(t.name,t.metadata),o={x:t.x,y:t.y,type:"scatter",mode:d?"lines+markers":"lines",name:t.name,line:{color:e,width:l.CHROMATOGRAM_TRACE.BASE_LINE_WIDTH},hovertemplate:`%{x:.2f} ${A}<br>%{y:.2f} ${i}<extra>${f}</extra>`};return d&&(o.marker={size:p,color:e}),o});if(h!=="none"){const t=x.collectPeaksWithBoundaryData(u,a,r);t.length>0&&T.push(...k.createBoundaryMarkerTraces(t))}if(a.forEach(t=>{t.regionOverlay&&r[0]&&T.push(...y.createRegionOverlayTraces([t],0,r[0]))}),u.forEach(({peaks:t,seriesIndex:c})=>{t.some(e=>e.regionOverlay)&&r[c]&&T.push(...y.createRegionOverlayTraces(t,c,r[c]))}),s.length>0){const t=s.some(e=>e.peak.hoverText),c={x:s.map(e=>e.peak.x),y:s.map(e=>e.peak.y),type:"scatter",mode:"markers",marker:{size:14,opacity:0},showlegend:!1,name:"",customdata:s.map(e=>({id:e.peak.id,peak:e.peak,seriesIndex:e.seriesIndex,seriesName:e.seriesName,isAutoDetected:e.isAutoDetected})),...t?{hovertemplate:s.map(e=>e.peak.hoverText?`${e.peak.hoverText}<extra></extra>`:"<extra></extra>")}:{hovertemplate:"<extra></extra>"}};T.push(c)}return T}function M(n){const{title:r,titleFontSize:a,titleTopMargin:u,width:s,height:d,xAxisTitle:p,yAxisTitle:A,xRange:i,yRange:h,showLegend:T,seriesCount:t,showGridX:c,showGridY:e,showCrosshairs:f,theme:o,peakAnnotations:O}=n;return{title:r?{text:r,font:{size:a,family:"Inter, sans-serif",color:o.textColor}}:void 0,width:s,height:d,margin:{l:l.CHROMATOGRAM_LAYOUT.MARGIN_LEFT,r:l.CHROMATOGRAM_LAYOUT.MARGIN_RIGHT,b:l.CHROMATOGRAM_LAYOUT.MARGIN_BOTTOM,t:r?u??l.CHROMATOGRAM_LAYOUT.MARGIN_TOP_WITH_TITLE:l.CHROMATOGRAM_LAYOUT.MARGIN_TOP_NO_TITLE,pad:l.CHROMATOGRAM_LAYOUT.MARGIN_PAD},paper_bgcolor:o.paperBg,plot_bgcolor:o.plotBg,font:{family:"Inter, sans-serif"},hovermode:f?"x":"x unified",dragmode:"zoom",xaxis:{title:{text:p,font:{size:14,color:o.textSecondary,family:"Inter, sans-serif"},standoff:15},showgrid:c,gridcolor:o.gridColor,linecolor:o.lineColor,linewidth:1,range:i,autorange:!i,zeroline:!1,tickfont:{size:12,color:o.textColor,family:"Inter, sans-serif"},showspikes:f,spikemode:"across",spikesnap:"cursor",spikecolor:o.spikeColor,spikethickness:1,spikedash:"dot"},yaxis:{title:{text:A,font:{size:14,color:o.textSecondary,family:"Inter, sans-serif"},standoff:10},showgrid:e,gridcolor:o.gridColor,linecolor:o.lineColor,linewidth:1,range:h,autorange:!h,zeroline:!1,tickfont:{size:12,color:o.textColor,family:"Inter, sans-serif"},showspikes:f,spikemode:"across",spikesnap:"cursor",spikecolor:o.spikeColor,spikethickness:1,spikedash:"dot"},legend:{x:.5,y:-.15,xanchor:"center",yanchor:"top",orientation:"h",font:{size:12,color:o.textColor,family:"Inter, sans-serif"}},showlegend:T&&t>1,annotations:O}}function R(n){const{showExportButton:r,width:a,height:u}=n;return{responsive:!0,displayModeBar:!0,displaylogo:!1,modeBarButtonsToRemove:["lasso2d","select2d",...r?[]:["toImage"]],...r&&{toImageButtonOptions:{format:"png",filename:"chromatogram",width:a,height:u}}}}function _(n,r,a,u,s){return d=>{const p=d.points[0];if(p&&p.curveNumber<r){const i=p.curveNumber;a.current!==i&&(a.current!==null&&m.restyle(n,{"line.width":l.CHROMATOGRAM_TRACE.BASE_LINE_WIDTH},[a.current]),m.restyle(n,{"line.width":l.CHROMATOGRAM_TRACE.BASE_LINE_WIDTH*s},[i]),a.current=i)}const A=d.points.find(i=>i.customdata!=null);A&&u.current?.(A.customdata)}}function I(n,r,a){return()=>{a.current?.(null),r.current!==null&&(m.restyle(n,{"line.width":l.CHROMATOGRAM_TRACE.BASE_LINE_WIDTH},[r.current]),r.current=null)}}exports.buildConfig=R;exports.buildLayout=M;exports.buildTraceData=C;exports.createHoverHandler=_;exports.createUnhoverHandler=I;
|
|
2
|
-
//# sourceMappingURL=plotBuilder.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plotBuilder.cjs","sources":["../../../../src/components/charts/ChromatogramChart/plotBuilder.ts"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\n\nimport { CHART_COLORS } from \"../../../utils/colors\";\n\nimport { createBoundaryMarkerTraces } from \"./boundaryMarkers\";\nimport { CHROMATOGRAM_LAYOUT, CHROMATOGRAM_TRACE } from \"./constants\";\nimport { buildHoverExtraContent, collectPeaksWithBoundaryData } from \"./dataProcessing\";\nimport { createRegionOverlayTraces } from \"./regionOverlays\";\n\nimport type { ChromatogramSeries, PeakAnnotation, BoundaryMarkerStyle, PeakSelectEvent } from \"./types\";\nimport type { PlotlyThemeColors } from \"@/hooks/use-plotly-theme\";\n\ntype PeakForInteraction = {\n peak: PeakAnnotation & { id: string };\n seriesIndex: number;\n seriesName: string;\n isAutoDetected: boolean;\n};\n\ntype BuildTraceDataParams = {\n processedSeries: ChromatogramSeries[];\n processedAnnotations: PeakAnnotation[];\n allDetectedPeaks: { peaks: PeakAnnotation[]; seriesIndex: number }[];\n allPeaksForInteraction: PeakForInteraction[];\n showMarkers: boolean;\n markerSize: number;\n xAxisTitle: string;\n yAxisTitle: string;\n boundaryMarkers: BoundaryMarkerStyle;\n};\n\ntype BuildLayoutParams = {\n title?: string;\n titleFontSize: number;\n titleTopMargin?: number;\n width: number;\n height: number;\n xAxisTitle: string;\n yAxisTitle: string;\n xRange?: [number, number];\n yRange?: [number, number];\n showLegend: boolean;\n seriesCount: number;\n showGridX: boolean;\n showGridY: boolean;\n showCrosshairs: boolean;\n theme: PlotlyThemeColors;\n peakAnnotations: Partial<Plotly.Annotations>[];\n};\n\ntype BuildConfigParams = {\n showExportButton: boolean;\n width: number;\n height: number;\n};\n\nexport type { PeakForInteraction, BuildTraceDataParams, BuildLayoutParams, BuildConfigParams };\n\nexport function buildTraceData(params: BuildTraceDataParams): Plotly.Data[] {\n const {\n processedSeries,\n processedAnnotations,\n allDetectedPeaks,\n allPeaksForInteraction,\n showMarkers,\n markerSize,\n xAxisTitle,\n yAxisTitle,\n boundaryMarkers,\n } = params;\n\n const plotData: Plotly.Data[] = processedSeries.map((s, index) => {\n const traceColor = s.color || CHART_COLORS[index % CHART_COLORS.length];\n const extraContent = buildHoverExtraContent(s.name, s.metadata);\n\n const trace: Plotly.Data = {\n x: s.x,\n y: s.y,\n type: \"scatter\" as const,\n mode: showMarkers ? (\"lines+markers\" as const) : (\"lines\" as const),\n name: s.name,\n line: {\n color: traceColor,\n width: CHROMATOGRAM_TRACE.BASE_LINE_WIDTH,\n },\n hovertemplate: `%{x:.2f} ${xAxisTitle}<br>%{y:.2f} ${yAxisTitle}<extra>${extraContent}</extra>`,\n };\n if (showMarkers) {\n trace.marker = { size: markerSize, color: traceColor };\n }\n return trace;\n });\n\n if (boundaryMarkers !== \"none\") {\n const peaksWithData = collectPeaksWithBoundaryData(\n allDetectedPeaks,\n processedAnnotations,\n processedSeries\n );\n if (peaksWithData.length > 0) {\n plotData.push(...createBoundaryMarkerTraces(peaksWithData));\n }\n }\n\n processedAnnotations.forEach((ann) => {\n if (ann.regionOverlay && processedSeries[0]) {\n plotData.push(...createRegionOverlayTraces([ann], 0, processedSeries[0]));\n }\n });\n allDetectedPeaks.forEach(({ peaks, seriesIndex }) => {\n if (peaks.some((p) => p.regionOverlay) && processedSeries[seriesIndex]) {\n plotData.push(...createRegionOverlayTraces(peaks, seriesIndex, processedSeries[seriesIndex]));\n }\n });\n\n if (allPeaksForInteraction.length > 0) {\n const anyHoverText = allPeaksForInteraction.some((p) => p.peak.hoverText);\n const hitAreaTrace: Plotly.Data = {\n x: allPeaksForInteraction.map((p) => p.peak.x),\n y: allPeaksForInteraction.map((p) => p.peak.y),\n type: \"scatter\" as const,\n mode: \"markers\" as const,\n marker: { size: 14, opacity: 0 },\n showlegend: false,\n name: \"\",\n customdata: allPeaksForInteraction.map((p) => ({\n id: p.peak.id,\n peak: p.peak,\n seriesIndex: p.seriesIndex,\n seriesName: p.seriesName,\n isAutoDetected: p.isAutoDetected,\n })) as unknown as Plotly.Datum[],\n ...(anyHoverText\n ? {\n hovertemplate: allPeaksForInteraction.map((p) =>\n p.peak.hoverText ? `${p.peak.hoverText}<extra></extra>` : \"<extra></extra>\"\n ),\n }\n : { hovertemplate: \"<extra></extra>\" }),\n };\n plotData.push(hitAreaTrace);\n }\n\n return plotData;\n}\n\nexport function buildLayout(params: BuildLayoutParams): Partial<Plotly.Layout> {\n const {\n title,\n titleFontSize,\n titleTopMargin,\n width,\n height,\n xAxisTitle,\n yAxisTitle,\n xRange,\n yRange,\n showLegend,\n seriesCount,\n showGridX,\n showGridY,\n showCrosshairs,\n theme,\n peakAnnotations,\n } = params;\n\n return {\n title: title\n ? {\n text: title,\n font: { size: titleFontSize, family: \"Inter, sans-serif\", color: theme.textColor },\n }\n : undefined,\n width,\n height,\n margin: {\n l: CHROMATOGRAM_LAYOUT.MARGIN_LEFT,\n r: CHROMATOGRAM_LAYOUT.MARGIN_RIGHT,\n b: CHROMATOGRAM_LAYOUT.MARGIN_BOTTOM,\n t: title\n ? (titleTopMargin ?? CHROMATOGRAM_LAYOUT.MARGIN_TOP_WITH_TITLE)\n : CHROMATOGRAM_LAYOUT.MARGIN_TOP_NO_TITLE,\n pad: CHROMATOGRAM_LAYOUT.MARGIN_PAD,\n },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n font: { family: \"Inter, sans-serif\" },\n hovermode: showCrosshairs ? (\"x\" as const) : (\"x unified\" as const),\n dragmode: \"zoom\" as const,\n xaxis: {\n title: {\n text: xAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 15,\n },\n showgrid: showGridX,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: xRange,\n autorange: !xRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n yaxis: {\n title: {\n text: yAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 10,\n },\n showgrid: showGridY,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: yRange,\n autorange: !yRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n legend: {\n x: 0.5,\n y: -0.15,\n xanchor: \"center\" as const,\n yanchor: \"top\" as const,\n orientation: \"h\" as const,\n font: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n },\n showlegend: showLegend && seriesCount > 1,\n annotations: peakAnnotations,\n };\n}\n\nexport function buildConfig(params: BuildConfigParams): Partial<Plotly.Config> {\n const { showExportButton, width, height } = params;\n return {\n responsive: true,\n displayModeBar: true,\n displaylogo: false,\n modeBarButtonsToRemove: [\n \"lasso2d\",\n \"select2d\",\n ...(showExportButton ? [] : ([\"toImage\"] as Plotly.ModeBarDefaultButtons[])),\n ] as Plotly.ModeBarDefaultButtons[],\n ...(showExportButton && {\n toImageButtonOptions: {\n format: \"png\",\n filename: \"chromatogram\",\n width,\n height,\n },\n }),\n };\n}\n\ntype MutableRef<T> = { current: T };\n\nexport function createHoverHandler(\n domElement: HTMLElement,\n processedSeriesLength: number,\n thickenedSeriesRef: MutableRef<number | null>,\n onPeakHoverRef: MutableRef<((event: PeakSelectEvent | null) => void) | undefined>,\n hoverLineWidthMultiplier: number\n): (eventData: Plotly.PlotHoverEvent) => void {\n return (eventData) => {\n const pt = eventData.points[0];\n if (pt && pt.curveNumber < processedSeriesLength) {\n const targetIdx = pt.curveNumber;\n if (thickenedSeriesRef.current !== targetIdx) {\n if (thickenedSeriesRef.current !== null) {\n Plotly.restyle(domElement, { \"line.width\": CHROMATOGRAM_TRACE.BASE_LINE_WIDTH } as Plotly.Data, [thickenedSeriesRef.current]);\n }\n Plotly.restyle(domElement, { \"line.width\": CHROMATOGRAM_TRACE.BASE_LINE_WIDTH * hoverLineWidthMultiplier } as Plotly.Data, [targetIdx]);\n thickenedSeriesRef.current = targetIdx;\n }\n }\n const peakPoint = eventData.points.find((p) => p.customdata != null);\n if (peakPoint) {\n onPeakHoverRef.current?.(peakPoint.customdata as unknown as PeakSelectEvent);\n }\n };\n}\n\nexport function createUnhoverHandler(\n domElement: HTMLElement,\n thickenedSeriesRef: MutableRef<number | null>,\n onPeakHoverRef: MutableRef<((event: PeakSelectEvent | null) => void) | undefined>\n): () => void {\n return () => {\n onPeakHoverRef.current?.(null);\n if (thickenedSeriesRef.current !== null) {\n Plotly.restyle(domElement, { \"line.width\": CHROMATOGRAM_TRACE.BASE_LINE_WIDTH } as Plotly.Data, [thickenedSeriesRef.current]);\n thickenedSeriesRef.current = null;\n }\n };\n}\n"],"names":["buildTraceData","params","processedSeries","processedAnnotations","allDetectedPeaks","allPeaksForInteraction","showMarkers","markerSize","xAxisTitle","yAxisTitle","boundaryMarkers","plotData","s","index","traceColor","CHART_COLORS","extraContent","buildHoverExtraContent","trace","CHROMATOGRAM_TRACE","peaksWithData","collectPeaksWithBoundaryData","createBoundaryMarkerTraces","ann","createRegionOverlayTraces","peaks","seriesIndex","p","anyHoverText","hitAreaTrace","buildLayout","title","titleFontSize","titleTopMargin","width","height","xRange","yRange","showLegend","seriesCount","showGridX","showGridY","showCrosshairs","theme","peakAnnotations","CHROMATOGRAM_LAYOUT","buildConfig","showExportButton","createHoverHandler","domElement","processedSeriesLength","thickenedSeriesRef","onPeakHoverRef","hoverLineWidthMultiplier","eventData","pt","targetIdx","Plotly","peakPoint","createUnhoverHandler"],"mappings":"6RA0DO,SAASA,EAAeC,EAA6C,CAC1E,KAAM,CACJ,gBAAAC,EACA,qBAAAC,EACA,iBAAAC,EACA,uBAAAC,EACA,YAAAC,EACA,WAAAC,EACA,WAAAC,EACA,WAAAC,EAAA,gBACAC,CAAA,EACET,EAEEU,EAA0BT,EAAgB,IAAI,CAACU,EAAGC,IAAU,CAChE,MAAMC,EAAaF,EAAE,OAASG,EAAAA,aAAaF,EAAQE,EAAAA,aA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C,GAAMA,EAAG,YAAcL,EAAuB,CAChD,MAAMM,EAAYD,EAAG,YACjBJ,EAAmB,UAAYK,IAC7BL,EAAmB,UAAY,MACjCM,EAAO,QAAQR,EAAY,CAAE,aAAc9B,qBAAmB,iBAAkC,CAACgC,EAAmB,OAAO,CAAC,EAE9HM,EAAO,QAAQR,EAAY,CAAE,aAAc9B,qBAAmB,gBAAkBkC,CAAA,EAA2C,CAACG,CAAS,CAAC,EACtIL,EAAmB,QAAUK,EAEjC,CACA,MAAME,EAAYJ,EAAU,OAAO,KAAM3B,GAAMA,EAAE,YAAc,IAAI,EAC/D+B,GACFN,EAAe,UAAUM,EAAU,UAAwC,CAE/E,CACF,CAEO,SAASC,EACdV,EACAE,EACAC,EACY,CACZ,MAAO,IAAM,CACXA,EAAe,UAAU,IAAI,EACzBD,EAAmB,UAAY,OACjCM,EAAO,QAAQR,EAAY,CAAE,aAAc9B,qBAAmB,iBAAkC,CAACgC,EAAmB,OAAO,CAAC,EAC5HA,EAAmB,QAAU,KAEjC,CACF"}
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import y from "plotly.js-dist";
|
|
2
|
-
import { CHART_COLORS as k } from "../../../utils/colors.js";
|
|
3
|
-
import { createBoundaryMarkerTraces as A } from "./boundaryMarkers.js";
|
|
4
|
-
import { CHROMATOGRAM_TRACE as g, CHROMATOGRAM_LAYOUT as f } from "./constants.js";
|
|
5
|
-
import { buildHoverExtraContent as _, collectPeaksWithBoundaryData as C } from "./dataProcessing.js";
|
|
6
|
-
import { createRegionOverlayTraces as T } from "./regionOverlays.js";
|
|
7
|
-
function B(i) {
|
|
8
|
-
const {
|
|
9
|
-
processedSeries: t,
|
|
10
|
-
processedAnnotations: a,
|
|
11
|
-
allDetectedPeaks: c,
|
|
12
|
-
allPeaksForInteraction: n,
|
|
13
|
-
showMarkers: p,
|
|
14
|
-
markerSize: m,
|
|
15
|
-
xAxisTitle: u,
|
|
16
|
-
yAxisTitle: s,
|
|
17
|
-
boundaryMarkers: x
|
|
18
|
-
} = i, d = t.map((o, l) => {
|
|
19
|
-
const e = o.color || k[l % k.length], h = _(o.name, o.metadata), r = {
|
|
20
|
-
x: o.x,
|
|
21
|
-
y: o.y,
|
|
22
|
-
type: "scatter",
|
|
23
|
-
mode: p ? "lines+markers" : "lines",
|
|
24
|
-
name: o.name,
|
|
25
|
-
line: {
|
|
26
|
-
color: e,
|
|
27
|
-
width: g.BASE_LINE_WIDTH
|
|
28
|
-
},
|
|
29
|
-
hovertemplate: `%{x:.2f} ${u}<br>%{y:.2f} ${s}<extra>${h}</extra>`
|
|
30
|
-
};
|
|
31
|
-
return p && (r.marker = { size: m, color: e }), r;
|
|
32
|
-
});
|
|
33
|
-
if (x !== "none") {
|
|
34
|
-
const o = C(
|
|
35
|
-
c,
|
|
36
|
-
a,
|
|
37
|
-
t
|
|
38
|
-
);
|
|
39
|
-
o.length > 0 && d.push(...A(o));
|
|
40
|
-
}
|
|
41
|
-
if (a.forEach((o) => {
|
|
42
|
-
o.regionOverlay && t[0] && d.push(...T([o], 0, t[0]));
|
|
43
|
-
}), c.forEach(({ peaks: o, seriesIndex: l }) => {
|
|
44
|
-
o.some((e) => e.regionOverlay) && t[l] && d.push(...T(o, l, t[l]));
|
|
45
|
-
}), n.length > 0) {
|
|
46
|
-
const o = n.some((e) => e.peak.hoverText), l = {
|
|
47
|
-
x: n.map((e) => e.peak.x),
|
|
48
|
-
y: n.map((e) => e.peak.y),
|
|
49
|
-
type: "scatter",
|
|
50
|
-
mode: "markers",
|
|
51
|
-
marker: { size: 14, opacity: 0 },
|
|
52
|
-
showlegend: !1,
|
|
53
|
-
name: "",
|
|
54
|
-
customdata: n.map((e) => ({
|
|
55
|
-
id: e.peak.id,
|
|
56
|
-
peak: e.peak,
|
|
57
|
-
seriesIndex: e.seriesIndex,
|
|
58
|
-
seriesName: e.seriesName,
|
|
59
|
-
isAutoDetected: e.isAutoDetected
|
|
60
|
-
})),
|
|
61
|
-
...o ? {
|
|
62
|
-
hovertemplate: n.map(
|
|
63
|
-
(e) => e.peak.hoverText ? `${e.peak.hoverText}<extra></extra>` : "<extra></extra>"
|
|
64
|
-
)
|
|
65
|
-
} : { hovertemplate: "<extra></extra>" }
|
|
66
|
-
};
|
|
67
|
-
d.push(l);
|
|
68
|
-
}
|
|
69
|
-
return d;
|
|
70
|
-
}
|
|
71
|
-
function H(i) {
|
|
72
|
-
const {
|
|
73
|
-
title: t,
|
|
74
|
-
titleFontSize: a,
|
|
75
|
-
titleTopMargin: c,
|
|
76
|
-
width: n,
|
|
77
|
-
height: p,
|
|
78
|
-
xAxisTitle: m,
|
|
79
|
-
yAxisTitle: u,
|
|
80
|
-
xRange: s,
|
|
81
|
-
yRange: x,
|
|
82
|
-
showLegend: d,
|
|
83
|
-
seriesCount: o,
|
|
84
|
-
showGridX: l,
|
|
85
|
-
showGridY: e,
|
|
86
|
-
showCrosshairs: h,
|
|
87
|
-
theme: r,
|
|
88
|
-
peakAnnotations: I
|
|
89
|
-
} = i;
|
|
90
|
-
return {
|
|
91
|
-
title: t ? {
|
|
92
|
-
text: t,
|
|
93
|
-
font: { size: a, family: "Inter, sans-serif", color: r.textColor }
|
|
94
|
-
} : void 0,
|
|
95
|
-
width: n,
|
|
96
|
-
height: p,
|
|
97
|
-
margin: {
|
|
98
|
-
l: f.MARGIN_LEFT,
|
|
99
|
-
r: f.MARGIN_RIGHT,
|
|
100
|
-
b: f.MARGIN_BOTTOM,
|
|
101
|
-
t: t ? c ?? f.MARGIN_TOP_WITH_TITLE : f.MARGIN_TOP_NO_TITLE,
|
|
102
|
-
pad: f.MARGIN_PAD
|
|
103
|
-
},
|
|
104
|
-
paper_bgcolor: r.paperBg,
|
|
105
|
-
plot_bgcolor: r.plotBg,
|
|
106
|
-
font: { family: "Inter, sans-serif" },
|
|
107
|
-
hovermode: h ? "x" : "x unified",
|
|
108
|
-
dragmode: "zoom",
|
|
109
|
-
xaxis: {
|
|
110
|
-
title: {
|
|
111
|
-
text: m,
|
|
112
|
-
font: { size: 14, color: r.textSecondary, family: "Inter, sans-serif" },
|
|
113
|
-
standoff: 15
|
|
114
|
-
},
|
|
115
|
-
showgrid: l,
|
|
116
|
-
gridcolor: r.gridColor,
|
|
117
|
-
linecolor: r.lineColor,
|
|
118
|
-
linewidth: 1,
|
|
119
|
-
range: s,
|
|
120
|
-
autorange: !s,
|
|
121
|
-
zeroline: !1,
|
|
122
|
-
tickfont: { size: 12, color: r.textColor, family: "Inter, sans-serif" },
|
|
123
|
-
showspikes: h,
|
|
124
|
-
spikemode: "across",
|
|
125
|
-
spikesnap: "cursor",
|
|
126
|
-
spikecolor: r.spikeColor,
|
|
127
|
-
spikethickness: 1,
|
|
128
|
-
spikedash: "dot"
|
|
129
|
-
},
|
|
130
|
-
yaxis: {
|
|
131
|
-
title: {
|
|
132
|
-
text: u,
|
|
133
|
-
font: { size: 14, color: r.textSecondary, family: "Inter, sans-serif" },
|
|
134
|
-
standoff: 10
|
|
135
|
-
},
|
|
136
|
-
showgrid: e,
|
|
137
|
-
gridcolor: r.gridColor,
|
|
138
|
-
linecolor: r.lineColor,
|
|
139
|
-
linewidth: 1,
|
|
140
|
-
range: x,
|
|
141
|
-
autorange: !x,
|
|
142
|
-
zeroline: !1,
|
|
143
|
-
tickfont: { size: 12, color: r.textColor, family: "Inter, sans-serif" },
|
|
144
|
-
showspikes: h,
|
|
145
|
-
spikemode: "across",
|
|
146
|
-
spikesnap: "cursor",
|
|
147
|
-
spikecolor: r.spikeColor,
|
|
148
|
-
spikethickness: 1,
|
|
149
|
-
spikedash: "dot"
|
|
150
|
-
},
|
|
151
|
-
legend: {
|
|
152
|
-
x: 0.5,
|
|
153
|
-
y: -0.15,
|
|
154
|
-
xanchor: "center",
|
|
155
|
-
yanchor: "top",
|
|
156
|
-
orientation: "h",
|
|
157
|
-
font: { size: 12, color: r.textColor, family: "Inter, sans-serif" }
|
|
158
|
-
},
|
|
159
|
-
showlegend: d && o > 1,
|
|
160
|
-
annotations: I
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function z(i) {
|
|
164
|
-
const { showExportButton: t, width: a, height: c } = i;
|
|
165
|
-
return {
|
|
166
|
-
responsive: !0,
|
|
167
|
-
displayModeBar: !0,
|
|
168
|
-
displaylogo: !1,
|
|
169
|
-
modeBarButtonsToRemove: [
|
|
170
|
-
"lasso2d",
|
|
171
|
-
"select2d",
|
|
172
|
-
...t ? [] : ["toImage"]
|
|
173
|
-
],
|
|
174
|
-
...t && {
|
|
175
|
-
toImageButtonOptions: {
|
|
176
|
-
format: "png",
|
|
177
|
-
filename: "chromatogram",
|
|
178
|
-
width: a,
|
|
179
|
-
height: c
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
function R(i, t, a, c, n) {
|
|
185
|
-
return (p) => {
|
|
186
|
-
const m = p.points[0];
|
|
187
|
-
if (m && m.curveNumber < t) {
|
|
188
|
-
const s = m.curveNumber;
|
|
189
|
-
a.current !== s && (a.current !== null && y.restyle(i, { "line.width": g.BASE_LINE_WIDTH }, [a.current]), y.restyle(i, { "line.width": g.BASE_LINE_WIDTH * n }, [s]), a.current = s);
|
|
190
|
-
}
|
|
191
|
-
const u = p.points.find((s) => s.customdata != null);
|
|
192
|
-
u && c.current?.(u.customdata);
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
function b(i, t, a) {
|
|
196
|
-
return () => {
|
|
197
|
-
a.current?.(null), t.current !== null && (y.restyle(i, { "line.width": g.BASE_LINE_WIDTH }, [t.current]), t.current = null);
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
export {
|
|
201
|
-
z as buildConfig,
|
|
202
|
-
H as buildLayout,
|
|
203
|
-
B as buildTraceData,
|
|
204
|
-
R as createHoverHandler,
|
|
205
|
-
b as createUnhoverHandler
|
|
206
|
-
};
|
|
207
|
-
//# sourceMappingURL=plotBuilder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plotBuilder.js","sources":["../../../../src/components/charts/ChromatogramChart/plotBuilder.ts"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\n\nimport { CHART_COLORS } from \"../../../utils/colors\";\n\nimport { createBoundaryMarkerTraces } from \"./boundaryMarkers\";\nimport { CHROMATOGRAM_LAYOUT, CHROMATOGRAM_TRACE } from \"./constants\";\nimport { buildHoverExtraContent, collectPeaksWithBoundaryData } from \"./dataProcessing\";\nimport { createRegionOverlayTraces } from \"./regionOverlays\";\n\nimport type { ChromatogramSeries, PeakAnnotation, BoundaryMarkerStyle, PeakSelectEvent } from \"./types\";\nimport type { PlotlyThemeColors } from \"@/hooks/use-plotly-theme\";\n\ntype PeakForInteraction = {\n peak: PeakAnnotation & { id: string };\n seriesIndex: number;\n seriesName: string;\n isAutoDetected: boolean;\n};\n\ntype BuildTraceDataParams = {\n processedSeries: ChromatogramSeries[];\n processedAnnotations: PeakAnnotation[];\n allDetectedPeaks: { peaks: PeakAnnotation[]; seriesIndex: number }[];\n allPeaksForInteraction: PeakForInteraction[];\n showMarkers: boolean;\n markerSize: number;\n xAxisTitle: string;\n yAxisTitle: string;\n boundaryMarkers: BoundaryMarkerStyle;\n};\n\ntype BuildLayoutParams = {\n title?: string;\n titleFontSize: number;\n titleTopMargin?: number;\n width: number;\n height: number;\n xAxisTitle: string;\n yAxisTitle: string;\n xRange?: [number, number];\n yRange?: [number, number];\n showLegend: boolean;\n seriesCount: number;\n showGridX: boolean;\n showGridY: boolean;\n showCrosshairs: boolean;\n theme: PlotlyThemeColors;\n peakAnnotations: Partial<Plotly.Annotations>[];\n};\n\ntype BuildConfigParams = {\n showExportButton: boolean;\n width: number;\n height: number;\n};\n\nexport type { PeakForInteraction, BuildTraceDataParams, BuildLayoutParams, BuildConfigParams };\n\nexport function buildTraceData(params: BuildTraceDataParams): Plotly.Data[] {\n const {\n processedSeries,\n processedAnnotations,\n allDetectedPeaks,\n allPeaksForInteraction,\n showMarkers,\n markerSize,\n xAxisTitle,\n yAxisTitle,\n boundaryMarkers,\n } = params;\n\n const plotData: Plotly.Data[] = processedSeries.map((s, index) => {\n const traceColor = s.color || CHART_COLORS[index % CHART_COLORS.length];\n const extraContent = buildHoverExtraContent(s.name, s.metadata);\n\n const trace: Plotly.Data = {\n x: s.x,\n y: s.y,\n type: \"scatter\" as const,\n mode: showMarkers ? (\"lines+markers\" as const) : (\"lines\" as const),\n name: s.name,\n line: {\n color: traceColor,\n width: CHROMATOGRAM_TRACE.BASE_LINE_WIDTH,\n },\n hovertemplate: `%{x:.2f} ${xAxisTitle}<br>%{y:.2f} ${yAxisTitle}<extra>${extraContent}</extra>`,\n };\n if (showMarkers) {\n trace.marker = { size: markerSize, color: traceColor };\n }\n return trace;\n });\n\n if (boundaryMarkers !== \"none\") {\n const peaksWithData = collectPeaksWithBoundaryData(\n allDetectedPeaks,\n processedAnnotations,\n processedSeries\n );\n if (peaksWithData.length > 0) {\n plotData.push(...createBoundaryMarkerTraces(peaksWithData));\n }\n }\n\n processedAnnotations.forEach((ann) => {\n if (ann.regionOverlay && processedSeries[0]) {\n plotData.push(...createRegionOverlayTraces([ann], 0, processedSeries[0]));\n }\n });\n allDetectedPeaks.forEach(({ peaks, seriesIndex }) => {\n if (peaks.some((p) => p.regionOverlay) && processedSeries[seriesIndex]) {\n plotData.push(...createRegionOverlayTraces(peaks, seriesIndex, processedSeries[seriesIndex]));\n }\n });\n\n if (allPeaksForInteraction.length > 0) {\n const anyHoverText = allPeaksForInteraction.some((p) => p.peak.hoverText);\n const hitAreaTrace: Plotly.Data = {\n x: allPeaksForInteraction.map((p) => p.peak.x),\n y: allPeaksForInteraction.map((p) => p.peak.y),\n type: \"scatter\" as const,\n mode: \"markers\" as const,\n marker: { size: 14, opacity: 0 },\n showlegend: false,\n name: \"\",\n customdata: allPeaksForInteraction.map((p) => ({\n id: p.peak.id,\n peak: p.peak,\n seriesIndex: p.seriesIndex,\n seriesName: p.seriesName,\n isAutoDetected: p.isAutoDetected,\n })) as unknown as Plotly.Datum[],\n ...(anyHoverText\n ? {\n hovertemplate: allPeaksForInteraction.map((p) =>\n p.peak.hoverText ? `${p.peak.hoverText}<extra></extra>` : \"<extra></extra>\"\n ),\n }\n : { hovertemplate: \"<extra></extra>\" }),\n };\n plotData.push(hitAreaTrace);\n }\n\n return plotData;\n}\n\nexport function buildLayout(params: BuildLayoutParams): Partial<Plotly.Layout> {\n const {\n title,\n titleFontSize,\n titleTopMargin,\n width,\n height,\n xAxisTitle,\n yAxisTitle,\n xRange,\n yRange,\n showLegend,\n seriesCount,\n showGridX,\n showGridY,\n showCrosshairs,\n theme,\n peakAnnotations,\n } = params;\n\n return {\n title: title\n ? {\n text: title,\n font: { size: titleFontSize, family: \"Inter, sans-serif\", color: theme.textColor },\n }\n : undefined,\n width,\n height,\n margin: {\n l: CHROMATOGRAM_LAYOUT.MARGIN_LEFT,\n r: CHROMATOGRAM_LAYOUT.MARGIN_RIGHT,\n b: CHROMATOGRAM_LAYOUT.MARGIN_BOTTOM,\n t: title\n ? (titleTopMargin ?? CHROMATOGRAM_LAYOUT.MARGIN_TOP_WITH_TITLE)\n : CHROMATOGRAM_LAYOUT.MARGIN_TOP_NO_TITLE,\n pad: CHROMATOGRAM_LAYOUT.MARGIN_PAD,\n },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n font: { family: \"Inter, sans-serif\" },\n hovermode: showCrosshairs ? (\"x\" as const) : (\"x unified\" as const),\n dragmode: \"zoom\" as const,\n xaxis: {\n title: {\n text: xAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 15,\n },\n showgrid: showGridX,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: xRange,\n autorange: !xRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n yaxis: {\n title: {\n text: yAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 10,\n },\n showgrid: showGridY,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: yRange,\n autorange: !yRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n legend: {\n x: 0.5,\n y: -0.15,\n xanchor: \"center\" as const,\n yanchor: \"top\" as const,\n orientation: \"h\" as const,\n font: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n },\n showlegend: showLegend && seriesCount > 1,\n annotations: peakAnnotations,\n };\n}\n\nexport function buildConfig(params: BuildConfigParams): Partial<Plotly.Config> {\n const { showExportButton, width, height } = params;\n return {\n responsive: true,\n displayModeBar: true,\n displaylogo: false,\n modeBarButtonsToRemove: [\n \"lasso2d\",\n \"select2d\",\n ...(showExportButton ? [] : ([\"toImage\"] as Plotly.ModeBarDefaultButtons[])),\n ] as Plotly.ModeBarDefaultButtons[],\n ...(showExportButton && {\n toImageButtonOptions: {\n format: \"png\",\n filename: \"chromatogram\",\n width,\n height,\n },\n }),\n };\n}\n\ntype MutableRef<T> = { current: T };\n\nexport function createHoverHandler(\n domElement: HTMLElement,\n processedSeriesLength: number,\n thickenedSeriesRef: MutableRef<number | null>,\n onPeakHoverRef: MutableRef<((event: PeakSelectEvent | null) => void) | undefined>,\n hoverLineWidthMultiplier: number\n): (eventData: Plotly.PlotHoverEvent) => void {\n return (eventData) => {\n const pt = eventData.points[0];\n if (pt && pt.curveNumber < processedSeriesLength) {\n const targetIdx = pt.curveNumber;\n if (thickenedSeriesRef.current !== targetIdx) {\n if (thickenedSeriesRef.current !== null) {\n Plotly.restyle(domElement, { \"line.width\": CHROMATOGRAM_TRACE.BASE_LINE_WIDTH } as Plotly.Data, [thickenedSeriesRef.current]);\n }\n Plotly.restyle(domElement, { \"line.width\": CHROMATOGRAM_TRACE.BASE_LINE_WIDTH * hoverLineWidthMultiplier } as Plotly.Data, [targetIdx]);\n thickenedSeriesRef.current = targetIdx;\n }\n }\n const peakPoint = eventData.points.find((p) => p.customdata != null);\n if (peakPoint) {\n onPeakHoverRef.current?.(peakPoint.customdata as unknown as PeakSelectEvent);\n }\n };\n}\n\nexport function createUnhoverHandler(\n domElement: HTMLElement,\n thickenedSeriesRef: MutableRef<number | null>,\n onPeakHoverRef: MutableRef<((event: PeakSelectEvent | null) => void) | undefined>\n): () => void {\n return () => {\n onPeakHoverRef.current?.(null);\n if (thickenedSeriesRef.current !== null) {\n Plotly.restyle(domElement, { \"line.width\": CHROMATOGRAM_TRACE.BASE_LINE_WIDTH } as Plotly.Data, [thickenedSeriesRef.current]);\n thickenedSeriesRef.current = null;\n }\n };\n}\n"],"names":["buildTraceData","params","processedSeries","processedAnnotations","allDetectedPeaks","allPeaksForInteraction","showMarkers","markerSize","xAxisTitle","yAxisTitle","boundaryMarkers","plotData","s","index","traceColor","CHART_COLORS","extraContent","buildHoverExtraContent","trace","CHROMATOGRAM_TRACE","peaksWithData","collectPeaksWithBoundaryData","createBoundaryMarkerTraces","ann","createRegionOverlayTraces","peaks","seriesIndex","p","anyHoverText","hitAreaTrace","buildLayout","title","titleFontSize","titleTopMargin","width","height","xRange","yRange","showLegend","seriesCount","showGridX","showGridY","showCrosshairs","theme","peakAnnotations","CHROMATOGRAM_LAYOUT","buildConfig","showExportButton","createHoverHandler","domElement","processedSeriesLength","thickenedSeriesRef","onPeakHoverRef","hoverLineWidthMultiplier","eventData","pt","targetIdx","Plotly","peakPoint","createUnhoverHandler"],"mappings":";;;;;;AA0DO,SAASA,EAAeC,GAA6C;AAC1E,QAAM;AAAA,IACJ,iBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,w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,EAAmB,OAAO,CAAC,GAE9HM,EAAO,QAAQR,GAAY,EAAE,cAAc9B,EAAmB,kBAAkBkC,EAAA,GAA2C,CAACG,CAAS,CAAC,GACtIL,EAAmB,UAAUK;AAAA,IAEjC;AACA,UAAME,IAAYJ,EAAU,OAAO,KAAK,CAAC3B,MAAMA,EAAE,cAAc,IAAI;AACnE,IAAI+B,KACFN,EAAe,UAAUM,EAAU,UAAwC;AAAA,EAE/E;AACF;AAEO,SAASC,EACdV,GACAE,GACAC,GACY;AACZ,SAAO,MAAM;AACX,IAAAA,EAAe,UAAU,IAAI,GACzBD,EAAmB,YAAY,SACjCM,EAAO,QAAQR,GAAY,EAAE,cAAc9B,EAAmB,mBAAkC,CAACgC,EAAmB,OAAO,CAAC,GAC5HA,EAAmB,UAAU;AAAA,EAEjC;AACF;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"regionOverlays.cjs","sources":["../../../../src/components/charts/ChromatogramChart/regionOverlays.ts"],"sourcesContent":["import { CHART_COLORS } from \"../../../utils/colors\";\n\nimport type { PeakAnnotation, ChromatogramSeries } from \"./types\";\nimport type Plotly from \"plotly.js-dist\";\n\nconst DEFAULT_REGION_OVERLAY_WIDTH = 3.5;\n\n/**\n * Build one scatter trace per peak that has regionOverlay:true, slicing the\n * underlying series data between the peak's startIndex and endIndex.\n * Traces are pushed BEFORE the invisible hit-area trace so peak click/hover\n * still resolves to the hit-area marker, not the overlay.\n */\nexport function createRegionOverlayTraces(\n peaks: PeakAnnotation[],\n seriesIndex: number,\n series: ChromatogramSeries\n): Plotly.Data[] {\n const seriesColor = series.color ?? CHART_COLORS[seriesIndex % CHART_COLORS.length];\n const traces: Plotly.Data[] = [];\n\n for (const peak of peaks) {\n if (!peak.regionOverlay) continue;\n const startIdx = peak._computed?.startIndex;\n const endIdx = peak._computed?.endIndex;\n if (startIdx === undefined || endIdx === undefined) continue;\n\n const color = peak.color ?? seriesColor;\n const lineWidth = peak.regionOverlayWidth ?? DEFAULT_REGION_OVERLAY_WIDTH;\n const hoverProps = peak.hoverText\n ? { hovertemplate: `${peak.hoverText}<extra></extra>` }\n : { hoverinfo: \"skip\" as const };\n\n traces.push({\n x: series.x.slice(startIdx, endIdx + 1),\n y: series.y.slice(startIdx, endIdx + 1),\n type: \"scatter\" as const,\n mode: \"lines\" as const,\n line: { color, width: lineWidth },\n showlegend: false,\n name: \"\",\n ...hoverProps,\n });\n }\n\n return traces;\n}\n"],"names":["DEFAULT_REGION_OVERLAY_WIDTH","createRegionOverlayTraces","peaks","seriesIndex","series","seriesColor","CHART_COLORS","traces","peak","startIdx","endIdx","color","lineWidth","hoverProps"],"mappings":"6HAKMA,EAA+B,IAQ9B,SAASC,EACdC,EACAC,EACAC,EACe,CACf,MAAMC,EAAcD,EAAO,OAASE,EAAAA,aAAaH,EAAcG,EAAAA,aAAa,MAAM,EAC5EC,EAAwB,CAAA,EAE9B,UAAWC,KAAQN,EAAO,CACxB,GAAI,CAACM,EAAK,cAAe,SACzB,MAAMC,EAAWD,EAAK,WAAW,WAC3BE,EAASF,EAAK,WAAW,SAC/B,GAAIC,IAAa,QAAaC,IAAW,OAAW,SAEpD,MAAMC,EAAQH,EAAK,OAASH,EACtBO,EAAYJ,EAAK,oBAAsBR,EACvCa,EAAaL,EAAK,UACpB,CAAE,cAAe,GAAGA,EAAK,SAAS,iBAAA,EAClC,CAAE,UAAW,MAAA,EAEjBD,EAAO,KAAK,CACV,EAAGH,EAAO,EAAE,MAAMK,EAAUC,EAAS,CAAC,EACtC,EAAGN,EAAO,EAAE,MAAMK,EAAUC,EAAS,CAAC,EACtC,KAAM,UACN,KAAM,QACN,KAAM,CAAE,MAAAC,EAAO,MAAOC,CAAA,EACtB,WAAY,GACZ,KAAM,GACN,GAAGC,CAAA,CACJ,CACH,CAEA,OAAON,CACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"regionOverlays.js","sources":["../../../../src/components/charts/ChromatogramChart/regionOverlays.ts"],"sourcesContent":["import { CHART_COLORS } from \"../../../utils/colors\";\n\nimport type { PeakAnnotation, ChromatogramSeries } from \"./types\";\nimport type Plotly from \"plotly.js-dist\";\n\nconst DEFAULT_REGION_OVERLAY_WIDTH = 3.5;\n\n/**\n * Build one scatter trace per peak that has regionOverlay:true, slicing the\n * underlying series data between the peak's startIndex and endIndex.\n * Traces are pushed BEFORE the invisible hit-area trace so peak click/hover\n * still resolves to the hit-area marker, not the overlay.\n */\nexport function createRegionOverlayTraces(\n peaks: PeakAnnotation[],\n seriesIndex: number,\n series: ChromatogramSeries\n): Plotly.Data[] {\n const seriesColor = series.color ?? CHART_COLORS[seriesIndex % CHART_COLORS.length];\n const traces: Plotly.Data[] = [];\n\n for (const peak of peaks) {\n if (!peak.regionOverlay) continue;\n const startIdx = peak._computed?.startIndex;\n const endIdx = peak._computed?.endIndex;\n if (startIdx === undefined || endIdx === undefined) continue;\n\n const color = peak.color ?? seriesColor;\n const lineWidth = peak.regionOverlayWidth ?? DEFAULT_REGION_OVERLAY_WIDTH;\n const hoverProps = peak.hoverText\n ? { hovertemplate: `${peak.hoverText}<extra></extra>` }\n : { hoverinfo: \"skip\" as const };\n\n traces.push({\n x: series.x.slice(startIdx, endIdx + 1),\n y: series.y.slice(startIdx, endIdx + 1),\n type: \"scatter\" as const,\n mode: \"lines\" as const,\n line: { color, width: lineWidth },\n showlegend: false,\n name: \"\",\n ...hoverProps,\n });\n }\n\n return traces;\n}\n"],"names":["DEFAULT_REGION_OVERLAY_WIDTH","createRegionOverlayTraces","peaks","seriesIndex","series","seriesColor","CHART_COLORS","traces","peak","startIdx","endIdx","color","lineWidth","hoverProps"],"mappings":";AAKA,MAAMA,IAA+B;AAQ9B,SAASC,EACdC,GACAC,GACAC,GACe;AACf,QAAMC,IAAcD,EAAO,SAASE,EAAaH,IAAcG,EAAa,MAAM,GAC5EC,IAAwB,CAAA;AAE9B,aAAWC,KAAQN,GAAO;AACxB,QAAI,CAACM,EAAK,cAAe;AACzB,UAAMC,IAAWD,EAAK,WAAW,YAC3BE,IAASF,EAAK,WAAW;AAC/B,QAAIC,MAAa,UAAaC,MAAW,OAAW;AAEpD,UAAMC,IAAQH,EAAK,SAASH,GACtBO,IAAYJ,EAAK,sBAAsBR,GACvCa,IAAaL,EAAK,YACpB,EAAE,eAAe,GAAGA,EAAK,SAAS,kBAAA,IAClC,EAAE,WAAW,OAAA;AAEjB,IAAAD,EAAO,KAAK;AAAA,MACV,GAAGH,EAAO,EAAE,MAAMK,GAAUC,IAAS,CAAC;AAAA,MACtC,GAAGN,EAAO,EAAE,MAAMK,GAAUC,IAAS,CAAC;AAAA,MACtC,MAAM;AAAA,MACN,MAAM;AAAA,MACN,MAAM,EAAE,OAAAC,GAAO,OAAOC,EAAA;AAAA,MACtB,YAAY;AAAA,MACZ,MAAM;AAAA,MACN,GAAGC;AAAA,IAAA,CACJ;AAAA,EACH;AAEA,SAAON;AACT;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react/jsx-runtime"),x=require("plotly.js-dist"),o=require("react"),D=require("../ChartTooltip/ChartTooltip.cjs"),H=require("../../../hooks/use-element-size.cjs"),L=require("../../../hooks/use-plotly-theme.cjs"),T=require("../../../lib/utils.cjs"),W=require("../../../utils/colors.cjs"),_=({dataSeries:i,width:s,height:b,title:z="Dot Plot",xTitle:h,yTitle:d,variant:C="default",markerSize:g=8})=>{const l=o.useRef(null),t=L.usePlotlyTheme(),{bindTooltip:R,tooltipElement:S}=D.useChartTooltip({xLabel:h,yLabel:d}),[j,v]=H.useElementSize(),r=s??v.width,n=b??v.height,q=r>0&&n>0,A=s===void 0,B=b===void 0,c=o.useRef({width:r,height:n});c.current={width:r,height:n};const m=o.useRef(!1),u=o.useRef({width:0,height:0}),M=o.useMemo(()=>Array.isArray(i)?i:[i],[i]),a=W.CHART_COLORS,y=o.useMemo(()=>["circle","square","diamond","triangle-up","triangle-down","star"],[]),P=o.useMemo(()=>M.map((e,f)=>C==="default"?{...e,color:e.color||a[0],symbol:"circle",size:e.size||g}:{...e,color:e.color||a[f%a.length],symbol:e.symbol||y[f%y.length],size:e.size||g}),[M,C,g,a,y]),p=t.gridColor,k=o.useMemo(()=>P.map(e=>({type:"scatter",x:e.x,y:e.y,mode:"markers",name:e.name,marker:{color:e.color,size:e.size,symbol:e.symbol,line:{color:t.paperBg,width:1}},hoverinfo:"none"})),[P,t]),w=o.useMemo(()=>({tickcolor:t.tickColor,ticklen:12,tickwidth:1,ticks:"outside",tickfont:{size:16,color:t.textColor,family:"Inter, sans-serif",weight:400},linecolor:t.lineColor,linewidth:1,position:0,zeroline:!1}),[t]),E=o.useMemo(()=>({text:z,x:.5,y:.95,xanchor:"center",yanchor:"top",font:{size:32,weight:600,family:"Inter, sans-serif",color:t.textColor,lineheight:1.2,standoff:30}}),[z,t]);return o.useEffect(()=>{if(!l.current||!q)return;const e={width:c.current.width,height:c.current.height,font:{family:"Inter, sans-serif"},title:E,margin:{l:80,r:40,b:96,t:80,pad:0},showlegend:!0,legend:{x:.5,y:0,xanchor:"center",yanchor:"bottom",yref:"container",orientation:"h",font:{size:13,color:t.legendColor,family:"Inter, sans-serif",weight:500,lineheight:18}},xaxis:{title:{text:h,font:{size:16,color:t.textSecondary,family:"Inter, sans-serif",weight:400},standoff:15},gridcolor:p,automargin:!0,...w},yaxis:{title:{text:d,font:{size:16,color:t.textSecondary,family:"Inter, sans-serif",weight:400},standoff:15},gridcolor:p,automargin:!0,...w},paper_bgcolor:t.paperBg,plot_bgcolor:t.plotBg},f={responsive:!1,displayModeBar:!1,displaylogo:!1};x.newPlot(l.current,k,e,f),R(l.current);const I=l.current;return m.current=!0,u.current={...c.current},()=>{I&&(x.purge(I),m.current=!1)}},[q,h,d,k,E,w,p,t,R]),o.useEffect(()=>{const e=l.current;!e||!m.current||r<=0||n<=0||u.current.width===r&&u.current.height===n||(u.current={width:r,height:n},x.relayout(e,{width:r,height:n}).catch(()=>{}))},[r,n]),O.jsxs("div",{ref:j,className:T.cn("dotplot-container relative",A&&"w-full",B&&"h-full"),style:s===void 0?void 0:{width:s},children:[O.jsx("div",{ref:l,style:{width:"100%",height:"100%",margin:"0"}}),S]})};exports.DotPlot=_;
|
|
2
|
-
//# sourceMappingURL=DotPlot.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DotPlot.cjs","sources":["../../../../src/components/charts/DotPlot/DotPlot.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport React, { useEffect, useRef, useMemo } from \"react\";\n\nimport { useChartTooltip } from \"../ChartTooltip\";\n\nimport { useElementSize } from \"@/hooks/use-element-size\";\nimport { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\nimport { cn } from \"@/lib/utils\";\nimport { CHART_COLORS } from \"@/utils/colors\";\n\ntype MarkerSymbol =\n | \"circle\"\n | \"square\"\n | \"diamond\"\n | \"triangle-up\"\n | \"triangle-down\"\n | \"star\";\n\ninterface DotPlotDataSeries {\n x: number[];\n y: number[];\n name: string;\n color?: string;\n symbol?: MarkerSymbol;\n size?: number;\n}\n\ntype DotPlotVariant = \"default\" | \"stacked\";\n\ntype DotPlotProps = {\n dataSeries: DotPlotDataSeries | DotPlotDataSeries[];\n /**\n * Fixed width in pixels. When omitted, the chart fills its container and\n * tracks the container's width via a `ResizeObserver`.\n */\n width?: number;\n /**\n * Fixed height in pixels. When omitted, the chart fills its container and\n * tracks the container's height via a `ResizeObserver`.\n */\n height?: number;\n title?: string;\n xTitle?: string;\n yTitle?: string;\n variant?: DotPlotVariant;\n markerSize?: number;\n};\n\nconst DotPlot: React.FC<DotPlotProps> = ({\n dataSeries,\n width,\n height,\n title = \"Dot Plot\",\n xTitle,\n yTitle,\n variant = \"default\",\n markerSize = 8,\n}) => {\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\n const { bindTooltip, tooltipElement } = useChartTooltip({ xLabel: xTitle, yLabel: yTitle });\n\n // Omitted width/height → fill the container and track its measured size;\n // explicit pixel values override. See AreaGraph for the reference pattern.\n const [containerRef, measured] = useElementSize<HTMLDivElement>();\n const resolvedWidth = width ?? measured.width;\n const resolvedHeight = height ?? measured.height;\n const hasSize = resolvedWidth > 0 && resolvedHeight > 0;\n // Fill is per-dimension: omit width to fill the container width, omit height\n // to fill its height (so e.g. a fixed width with a container-driven height works).\n const fillWidth = width === undefined;\n const fillHeight = height === undefined;\n const sizeRef = useRef({ width: resolvedWidth, height: resolvedHeight });\n sizeRef.current = { width: resolvedWidth, height: resolvedHeight };\n const plotInitedRef = useRef(false);\n // Size last applied to the plot, so the resize effect can skip a redundant\n // relayout right after newPlot already drew at that size.\n const appliedSizeRef = useRef({ width: 0, height: 0 });\n const seriesArray = useMemo(\n () => (Array.isArray(dataSeries) ? dataSeries : [dataSeries]),\n [dataSeries],\n );\n\n const defaultColors = CHART_COLORS;\n\n const defaultSymbols: MarkerSymbol[] = useMemo(\n () => [\n \"circle\",\n \"square\",\n \"diamond\",\n \"triangle-up\",\n \"triangle-down\",\n \"star\",\n ],\n [],\n );\n\n const seriesWithColors = useMemo(() => {\n return seriesArray.map((series, index) => {\n if (variant === \"default\") {\n // Default variant: all circles, use first color or series color\n return {\n ...series,\n color: series.color || defaultColors[0],\n symbol: \"circle\" as MarkerSymbol,\n size: series.size || markerSize,\n };\n } else {\n // Stacked variant: different symbols and colors for each series\n return {\n ...series,\n color: series.color || defaultColors[index % defaultColors.length],\n symbol:\n series.symbol || defaultSymbols[index % defaultSymbols.length],\n size: series.size || markerSize,\n };\n }\n });\n }, [seriesArray, variant, markerSize, defaultColors, defaultSymbols]);\n\n const gridColor = theme.gridColor;\n\n const plotData = useMemo(\n () =>\n seriesWithColors.map((series) => ({\n type: \"scatter\" as const,\n x: series.x,\n y: series.y,\n mode: \"markers\" as const,\n name: series.name,\n marker: {\n color: series.color,\n size: series.size,\n symbol: series.symbol,\n line: {\n color: theme.paperBg,\n width: 1,\n },\n },\n hoverinfo: \"none\" as const,\n })),\n [seriesWithColors, theme],\n );\n\n const tickOptions = useMemo(\n () => ({\n tickcolor: theme.tickColor,\n ticklen: 12,\n tickwidth: 1,\n ticks: \"outside\" as const,\n tickfont: {\n size: 16,\n color: theme.textColor,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n linecolor: theme.lineColor,\n linewidth: 1,\n position: 0,\n zeroline: false,\n }),\n [theme],\n );\n\n const titleOptions = useMemo(\n () => ({\n text: title,\n x: 0.5,\n y: 0.95,\n xanchor: \"center\" as const,\n yanchor: \"top\" as const,\n font: {\n size: 32,\n weight: 600,\n family: \"Inter, sans-serif\",\n color: theme.textColor,\n lineheight: 1.2,\n standoff: 30,\n },\n }),\n [title, theme],\n );\n\n useEffect(() => {\n if (!plotRef.current || !hasSize) return;\n\n const layout = {\n width: sizeRef.current.width,\n height: sizeRef.current.height,\n font: {\n family: \"Inter, sans-serif\",\n },\n title: titleOptions,\n // Bottom margin reserves room for tick labels, the x-axis title, and the\n // container-anchored bottom legend stacked beneath them.\n margin: { l: 80, r: 40, b: 96, t: 80, pad: 0 },\n showlegend: true,\n legend: {\n // Anchor to the bottom of the container (not the plot area) so the\n // legend always clears the x-axis tick labels + title — a paper-relative\n // fractional offset collapses into the ticks at small heights (SW-2157).\n x: 0.5,\n y: 0,\n xanchor: \"center\" as const,\n yanchor: \"bottom\" as const,\n yref: \"container\" as const,\n orientation: \"h\" as const,\n font: {\n size: 13,\n color: theme.legendColor,\n family: \"Inter, sans-serif\",\n weight: 500,\n lineheight: 18,\n },\n },\n xaxis: {\n title: {\n text: xTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 15,\n },\n gridcolor: gridColor,\n // Reserve space for tick labels + the axis title so the bottom legend\n // can't overlap them at small sizes (SW-2157).\n automargin: true,\n ...tickOptions,\n },\n yaxis: {\n title: {\n text: yTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 15,\n },\n gridcolor: gridColor,\n automargin: true,\n ...tickOptions,\n },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n };\n\n const config = {\n // Sizing is driven from the measured container; disable Plotly's own\n // window-resize responsiveness (it can't see container resizes).\n responsive: false,\n displayModeBar: false,\n displaylogo: false,\n };\n\n Plotly.newPlot(plotRef.current, plotData, layout, config);\n bindTooltip(plotRef.current);\n\n // Capture ref value for cleanup\n const plotElement = plotRef.current;\n plotInitedRef.current = true;\n appliedSizeRef.current = { ...sizeRef.current };\n\n return () => {\n if (plotElement) {\n Plotly.purge(plotElement);\n plotInitedRef.current = false;\n }\n };\n }, [hasSize, xTitle, yTitle, plotData, titleOptions, tickOptions, gridColor, theme, bindTooltip]);\n\n // Resize in place when the measured/overridden size changes — cheaper than\n // recreating the plot, and it preserves tooltip/event bindings.\n useEffect(() => {\n const plotElement = plotRef.current;\n if (!plotElement || !plotInitedRef.current || resolvedWidth <= 0 || resolvedHeight <= 0) {\n return;\n }\n // newPlot already drew at the current size; skip the redundant relayout\n // (it would queue an automargin redraw that can reject if we unmount first).\n if (\n appliedSizeRef.current.width === resolvedWidth &&\n appliedSizeRef.current.height === resolvedHeight\n ) {\n return;\n }\n appliedSizeRef.current = { width: resolvedWidth, height: resolvedHeight };\n // Swallow rejections from a relayout that races an unmount/purge.\n void Plotly.relayout(plotElement, { width: resolvedWidth, height: resolvedHeight }).catch(\n () => {},\n );\n }, [resolvedWidth, resolvedHeight]);\n\n return (\n <div\n ref={containerRef}\n className={cn(\"dotplot-container relative\", fillWidth && \"w-full\", fillHeight && \"h-full\")}\n style={width === undefined ? undefined : { width }}\n >\n <div\n ref={plotRef}\n style={{\n width: \"100%\",\n height: \"100%\",\n margin: \"0\",\n }}\n />\n {tooltipElement}\n </div>\n );\n};\n\nexport { DotPlot };\nexport type { DotPlotDataSeries, DotPlotProps, DotPlotVariant, MarkerSymbol };\n"],"names":["DotPlot","dataSeries","width","height","title","xTitle","yTitle","variant","markerSize","plotRef","useRef","theme","usePlotlyTheme","bindTooltip","tooltipElement","useChartTooltip","containerRef","measured","useElementSize","resolvedWidth","resolvedHeight","hasSize","fillWidth","fillHeight","sizeRef","plotInitedRef","appliedSizeRef","seriesArray","useMemo","defaultColors","CHART_COLORS","defaultSymbols","seriesWithColors","series","index","gridColor","plotData","tickOptions","titleOptions","useEffect","layout","config","Plotly","plotElement","jsxs","cn","jsx"],"mappings":"+XAgDMA,EAAkC,CAAC,CACvC,WAAAC,EACA,MAAAC,EACA,OAAAC,EACA,MAAAC,EAAQ,WACR,OAAAC,EACA,OAAAC,EACA,QAAAC,EAAU,UACV,WAAAC,EAAa,CACf,IAAM,CACJ,MAAMC,EAAUC,EAAAA,OAAuB,IAAI,EACrCC,EAAQC,EAAAA,eAAA,EACR,CAAE,YAAAC,EAAa,eAAAC,CAAA,EAAmBC,EAAAA,gBAAgB,CAAE,OAAQV,EAAQ,OAAQC,EAAQ,EAIpF,CAACU,EAAcC,CAAQ,EAAIC,iBAAA,EAC3BC,EAAgBjB,GAASe,EAAS,MAClCG,EAAiBjB,GAAUc,EAAS,OACpCI,EAAUF,EAAgB,GAAKC,EAAiB,EAGhDE,EAAYpB,IAAU,OACtBqB,EAAapB,IAAW,OACxBqB,EAAUd,EAAAA,OAAO,CAAE,MAAOS,EAAe,OAAQC,EAAgB,EACvEI,EAAQ,QAAU,CAAE,MAAOL,EAAe,OAAQC,CAAA,EAClD,MAAMK,EAAgBf,EAAAA,OAAO,EAAK,EAG5BgB,EAAiBhB,EAAAA,OAAO,CAAE,MAAO,EAAG,OAAQ,EAAG,EAC/CiB,EAAcC,EAAAA,QAClB,IAAO,MAAM,QAAQ3B,CAAU,EAAIA,EAAa,CAACA,CAAU,EAC3D,CAACA,CAAU,CAAA,EAGP4B,EAAgBC,EAAAA,aAEhBC,EAAiCH,EAAAA,QACrC,IAAM,CACJ,SACA,SACA,UACA,cACA,gBACA,MAAA,EAEF,CAAA,CAA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C,EAIhG0B,EAAAA,UAAU,IAAM,CACd,MAAMI,EAAclC,EAAQ,QACxB,CAACkC,GAAe,CAAClB,EAAc,SAAWN,GAAiB,GAAKC,GAAkB,GAMpFM,EAAe,QAAQ,QAAUP,GACjCO,EAAe,QAAQ,SAAWN,IAIpCM,EAAe,QAAU,CAAE,MAAOP,EAAe,OAAQC,CAAA,EAEpDsB,EAAO,SAASC,EAAa,CAAE,MAAOxB,EAAe,OAAQC,CAAA,CAAgB,EAAE,MAClF,IAAM,CAAC,CAAA,EAEX,EAAG,CAACD,EAAeC,CAAc,CAAC,EAGhCwB,EAAAA,KAAC,MAAA,CACC,IAAK5B,EACL,UAAW6B,EAAAA,GAAG,6BAA8BvB,GAAa,SAAUC,GAAc,QAAQ,EACzF,MAAOrB,IAAU,OAAY,OAAY,CAAE,MAAAA,CAAA,EAE3C,SAAA,CAAA4C,EAAAA,IAAC,MAAA,CACC,IAAKrC,EACL,MAAO,CACL,MAAO,OACP,OAAQ,OACR,OAAQ,GAAA,CACV,CAAA,EAEDK,CAAA,CAAA,CAAA,CAGP"}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { jsxs as j, jsx as M } from "react/jsx-runtime";
|
|
2
|
-
import z from "plotly.js-dist";
|
|
3
|
-
import { useRef as u, useMemo as i, useEffect as D } from "react";
|
|
4
|
-
import { useChartTooltip as S } from "../ChartTooltip/ChartTooltip.js";
|
|
5
|
-
import { useElementSize as q } from "../../../hooks/use-element-size.js";
|
|
6
|
-
import { usePlotlyTheme as N } from "../../../hooks/use-plotly-theme.js";
|
|
7
|
-
import { cn as F } from "../../../lib/utils.js";
|
|
8
|
-
import { CHART_COLORS as G } from "../../../utils/colors.js";
|
|
9
|
-
const Z = ({
|
|
10
|
-
dataSeries: l,
|
|
11
|
-
width: c,
|
|
12
|
-
height: b,
|
|
13
|
-
title: C = "Dot Plot",
|
|
14
|
-
xTitle: d,
|
|
15
|
-
yTitle: m,
|
|
16
|
-
variant: v = "default",
|
|
17
|
-
markerSize: g = 8
|
|
18
|
-
}) => {
|
|
19
|
-
const n = u(null), o = N(), { bindTooltip: R, tooltipElement: H } = S({ xLabel: d, yLabel: m }), [L, k] = q(), e = c ?? k.width, r = b ?? k.height, I = e > 0 && r > 0, W = c === void 0, _ = b === void 0, s = u({ width: e, height: r });
|
|
20
|
-
s.current = { width: e, height: r };
|
|
21
|
-
const p = u(!1), a = u({ width: 0, height: 0 }), E = i(
|
|
22
|
-
() => Array.isArray(l) ? l : [l],
|
|
23
|
-
[l]
|
|
24
|
-
), f = G, y = i(
|
|
25
|
-
() => [
|
|
26
|
-
"circle",
|
|
27
|
-
"square",
|
|
28
|
-
"diamond",
|
|
29
|
-
"triangle-up",
|
|
30
|
-
"triangle-down",
|
|
31
|
-
"star"
|
|
32
|
-
],
|
|
33
|
-
[]
|
|
34
|
-
), P = i(() => E.map((t, h) => v === "default" ? {
|
|
35
|
-
...t,
|
|
36
|
-
color: t.color || f[0],
|
|
37
|
-
symbol: "circle",
|
|
38
|
-
size: t.size || g
|
|
39
|
-
} : {
|
|
40
|
-
...t,
|
|
41
|
-
color: t.color || f[h % f.length],
|
|
42
|
-
symbol: t.symbol || y[h % y.length],
|
|
43
|
-
size: t.size || g
|
|
44
|
-
}), [E, v, g, f, y]), w = o.gridColor, A = i(
|
|
45
|
-
() => P.map((t) => ({
|
|
46
|
-
type: "scatter",
|
|
47
|
-
x: t.x,
|
|
48
|
-
y: t.y,
|
|
49
|
-
mode: "markers",
|
|
50
|
-
name: t.name,
|
|
51
|
-
marker: {
|
|
52
|
-
color: t.color,
|
|
53
|
-
size: t.size,
|
|
54
|
-
symbol: t.symbol,
|
|
55
|
-
line: {
|
|
56
|
-
color: o.paperBg,
|
|
57
|
-
width: 1
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
hoverinfo: "none"
|
|
61
|
-
})),
|
|
62
|
-
[P, o]
|
|
63
|
-
), x = i(
|
|
64
|
-
() => ({
|
|
65
|
-
tickcolor: o.tickColor,
|
|
66
|
-
ticklen: 12,
|
|
67
|
-
tickwidth: 1,
|
|
68
|
-
ticks: "outside",
|
|
69
|
-
tickfont: {
|
|
70
|
-
size: 16,
|
|
71
|
-
color: o.textColor,
|
|
72
|
-
family: "Inter, sans-serif",
|
|
73
|
-
weight: 400
|
|
74
|
-
},
|
|
75
|
-
linecolor: o.lineColor,
|
|
76
|
-
linewidth: 1,
|
|
77
|
-
position: 0,
|
|
78
|
-
zeroline: !1
|
|
79
|
-
}),
|
|
80
|
-
[o]
|
|
81
|
-
), B = i(
|
|
82
|
-
() => ({
|
|
83
|
-
text: C,
|
|
84
|
-
x: 0.5,
|
|
85
|
-
y: 0.95,
|
|
86
|
-
xanchor: "center",
|
|
87
|
-
yanchor: "top",
|
|
88
|
-
font: {
|
|
89
|
-
size: 32,
|
|
90
|
-
weight: 600,
|
|
91
|
-
family: "Inter, sans-serif",
|
|
92
|
-
color: o.textColor,
|
|
93
|
-
lineheight: 1.2,
|
|
94
|
-
standoff: 30
|
|
95
|
-
}
|
|
96
|
-
}),
|
|
97
|
-
[C, o]
|
|
98
|
-
);
|
|
99
|
-
return D(() => {
|
|
100
|
-
if (!n.current || !I) return;
|
|
101
|
-
const t = {
|
|
102
|
-
width: s.current.width,
|
|
103
|
-
height: s.current.height,
|
|
104
|
-
font: {
|
|
105
|
-
family: "Inter, sans-serif"
|
|
106
|
-
},
|
|
107
|
-
title: B,
|
|
108
|
-
// Bottom margin reserves room for tick labels, the x-axis title, and the
|
|
109
|
-
// container-anchored bottom legend stacked beneath them.
|
|
110
|
-
margin: { l: 80, r: 40, b: 96, t: 80, pad: 0 },
|
|
111
|
-
showlegend: !0,
|
|
112
|
-
legend: {
|
|
113
|
-
// Anchor to the bottom of the container (not the plot area) so the
|
|
114
|
-
// legend always clears the x-axis tick labels + title — a paper-relative
|
|
115
|
-
// fractional offset collapses into the ticks at small heights (SW-2157).
|
|
116
|
-
x: 0.5,
|
|
117
|
-
y: 0,
|
|
118
|
-
xanchor: "center",
|
|
119
|
-
yanchor: "bottom",
|
|
120
|
-
yref: "container",
|
|
121
|
-
orientation: "h",
|
|
122
|
-
font: {
|
|
123
|
-
size: 13,
|
|
124
|
-
color: o.legendColor,
|
|
125
|
-
family: "Inter, sans-serif",
|
|
126
|
-
weight: 500,
|
|
127
|
-
lineheight: 18
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
xaxis: {
|
|
131
|
-
title: {
|
|
132
|
-
text: d,
|
|
133
|
-
font: {
|
|
134
|
-
size: 16,
|
|
135
|
-
color: o.textSecondary,
|
|
136
|
-
family: "Inter, sans-serif",
|
|
137
|
-
weight: 400
|
|
138
|
-
},
|
|
139
|
-
standoff: 15
|
|
140
|
-
},
|
|
141
|
-
gridcolor: w,
|
|
142
|
-
// Reserve space for tick labels + the axis title so the bottom legend
|
|
143
|
-
// can't overlap them at small sizes (SW-2157).
|
|
144
|
-
automargin: !0,
|
|
145
|
-
...x
|
|
146
|
-
},
|
|
147
|
-
yaxis: {
|
|
148
|
-
title: {
|
|
149
|
-
text: m,
|
|
150
|
-
font: {
|
|
151
|
-
size: 16,
|
|
152
|
-
color: o.textSecondary,
|
|
153
|
-
family: "Inter, sans-serif",
|
|
154
|
-
weight: 400
|
|
155
|
-
},
|
|
156
|
-
standoff: 15
|
|
157
|
-
},
|
|
158
|
-
gridcolor: w,
|
|
159
|
-
automargin: !0,
|
|
160
|
-
...x
|
|
161
|
-
},
|
|
162
|
-
paper_bgcolor: o.paperBg,
|
|
163
|
-
plot_bgcolor: o.plotBg
|
|
164
|
-
}, h = {
|
|
165
|
-
// Sizing is driven from the measured container; disable Plotly's own
|
|
166
|
-
// window-resize responsiveness (it can't see container resizes).
|
|
167
|
-
responsive: !1,
|
|
168
|
-
displayModeBar: !1,
|
|
169
|
-
displaylogo: !1
|
|
170
|
-
};
|
|
171
|
-
z.newPlot(n.current, A, t, h), R(n.current);
|
|
172
|
-
const O = n.current;
|
|
173
|
-
return p.current = !0, a.current = { ...s.current }, () => {
|
|
174
|
-
O && (z.purge(O), p.current = !1);
|
|
175
|
-
};
|
|
176
|
-
}, [I, d, m, A, B, x, w, o, R]), D(() => {
|
|
177
|
-
const t = n.current;
|
|
178
|
-
!t || !p.current || e <= 0 || r <= 0 || a.current.width === e && a.current.height === r || (a.current = { width: e, height: r }, z.relayout(t, { width: e, height: r }).catch(
|
|
179
|
-
() => {
|
|
180
|
-
}
|
|
181
|
-
));
|
|
182
|
-
}, [e, r]), /* @__PURE__ */ j(
|
|
183
|
-
"div",
|
|
184
|
-
{
|
|
185
|
-
ref: L,
|
|
186
|
-
className: F("dotplot-container relative", W && "w-full", _ && "h-full"),
|
|
187
|
-
style: c === void 0 ? void 0 : { width: c },
|
|
188
|
-
children: [
|
|
189
|
-
/* @__PURE__ */ M(
|
|
190
|
-
"div",
|
|
191
|
-
{
|
|
192
|
-
ref: n,
|
|
193
|
-
style: {
|
|
194
|
-
width: "100%",
|
|
195
|
-
height: "100%",
|
|
196
|
-
margin: "0"
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
),
|
|
200
|
-
H
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
);
|
|
204
|
-
};
|
|
205
|
-
export {
|
|
206
|
-
Z as DotPlot
|
|
207
|
-
};
|
|
208
|
-
//# sourceMappingURL=DotPlot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DotPlot.js","sources":["../../../../src/components/charts/DotPlot/DotPlot.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport React, { useEffect, useRef, useMemo } from \"react\";\n\nimport { useChartTooltip } from \"../ChartTooltip\";\n\nimport { useElementSize } from \"@/hooks/use-element-size\";\nimport { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\nimport { cn } from \"@/lib/utils\";\nimport { CHART_COLORS } from \"@/utils/colors\";\n\ntype MarkerSymbol =\n | \"circle\"\n | \"square\"\n | \"diamond\"\n | \"triangle-up\"\n | \"triangle-down\"\n | \"star\";\n\ninterface DotPlotDataSeries {\n x: number[];\n y: number[];\n name: string;\n color?: string;\n symbol?: MarkerSymbol;\n size?: number;\n}\n\ntype DotPlotVariant = \"default\" | \"stacked\";\n\ntype DotPlotProps = {\n dataSeries: DotPlotDataSeries | DotPlotDataSeries[];\n /**\n * Fixed width in pixels. When omitted, the chart fills its container and\n * tracks the container's width via a `ResizeObserver`.\n */\n width?: number;\n /**\n * Fixed height in pixels. When omitted, the chart fills its container and\n * tracks the container's height via a `ResizeObserver`.\n */\n height?: number;\n title?: string;\n xTitle?: string;\n yTitle?: string;\n variant?: DotPlotVariant;\n markerSize?: number;\n};\n\nconst DotPlot: React.FC<DotPlotProps> = ({\n dataSeries,\n width,\n height,\n title = \"Dot Plot\",\n xTitle,\n yTitle,\n variant = \"default\",\n markerSize = 8,\n}) => {\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\n const { bindTooltip, tooltipElement } = useChartTooltip({ xLabel: xTitle, yLabel: yTitle });\n\n // Omitted width/height → fill the container and track its measured size;\n // explicit pixel values override. See AreaGraph for the reference pattern.\n const [containerRef, measured] = useElementSize<HTMLDivElement>();\n const resolvedWidth = width ?? measured.width;\n const resolvedHeight = height ?? measured.height;\n const hasSize = resolvedWidth > 0 && resolvedHeight > 0;\n // Fill is per-dimension: omit width to fill the container width, omit height\n // to fill its height (so e.g. a fixed width with a container-driven height works).\n const fillWidth = width === undefined;\n const fillHeight = height === undefined;\n const sizeRef = useRef({ width: resolvedWidth, height: resolvedHeight });\n sizeRef.current = { width: resolvedWidth, height: resolvedHeight };\n const plotInitedRef = useRef(false);\n // Size last applied to the plot, so the resize effect can skip a redundant\n // relayout right after newPlot already drew at that size.\n const appliedSizeRef = useRef({ width: 0, height: 0 });\n const seriesArray = useMemo(\n () => (Array.isArray(dataSeries) ? dataSeries : [dataSeries]),\n [dataSeries],\n );\n\n const defaultColors = CHART_COLORS;\n\n const defaultSymbols: MarkerSymbol[] = useMemo(\n () => [\n \"circle\",\n \"square\",\n \"diamond\",\n \"triangle-up\",\n \"triangle-down\",\n \"star\",\n ],\n [],\n );\n\n const seriesWithColors = useMemo(() => {\n return seriesArray.map((series, index) => {\n if (variant === \"default\") {\n // Default variant: all circles, use first color or series color\n return {\n ...series,\n color: series.color || defaultColors[0],\n symbol: \"circle\" as MarkerSymbol,\n size: series.size || markerSize,\n };\n } else {\n // Stacked variant: different symbols and colors for each series\n return {\n ...series,\n color: series.color || defaultColors[index % defaultColors.length],\n symbol:\n series.symbol || defaultSymbols[index % defaultSymbols.length],\n size: series.size || markerSize,\n };\n }\n });\n }, [seriesArray, variant, markerSize, defaultColors, defaultSymbols]);\n\n const gridColor = theme.gridColor;\n\n const plotData = useMemo(\n () =>\n seriesWithColors.map((series) => ({\n type: \"scatter\" as const,\n x: series.x,\n y: series.y,\n mode: \"markers\" as const,\n name: series.name,\n marker: {\n color: series.color,\n size: series.size,\n symbol: series.symbol,\n line: {\n color: theme.paperBg,\n width: 1,\n },\n },\n hoverinfo: \"none\" as const,\n })),\n [seriesWithColors, theme],\n );\n\n const tickOptions = useMemo(\n () => ({\n tickcolor: theme.tickColor,\n ticklen: 12,\n tickwidth: 1,\n ticks: \"outside\" as const,\n tickfont: {\n size: 16,\n color: theme.textColor,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n linecolor: theme.lineColor,\n linewidth: 1,\n position: 0,\n zeroline: false,\n }),\n [theme],\n );\n\n const titleOptions = useMemo(\n () => ({\n text: title,\n x: 0.5,\n y: 0.95,\n xanchor: \"center\" as const,\n yanchor: \"top\" as const,\n font: {\n size: 32,\n weight: 600,\n family: \"Inter, sans-serif\",\n color: theme.textColor,\n lineheight: 1.2,\n standoff: 30,\n },\n }),\n [title, theme],\n );\n\n useEffect(() => {\n if (!plotRef.current || !hasSize) return;\n\n const layout = {\n width: sizeRef.current.width,\n height: sizeRef.current.height,\n font: {\n family: \"Inter, sans-serif\",\n },\n title: titleOptions,\n // Bottom margin reserves room for tick labels, the x-axis title, and the\n // container-anchored bottom legend stacked beneath them.\n margin: { l: 80, r: 40, b: 96, t: 80, pad: 0 },\n showlegend: true,\n legend: {\n // Anchor to the bottom of the container (not the plot area) so the\n // legend always clears the x-axis tick labels + title — a paper-relative\n // fractional offset collapses into the ticks at small heights (SW-2157).\n x: 0.5,\n y: 0,\n xanchor: \"center\" as const,\n yanchor: \"bottom\" as const,\n yref: \"container\" as const,\n orientation: \"h\" as const,\n font: {\n size: 13,\n color: theme.legendColor,\n family: \"Inter, sans-serif\",\n weight: 500,\n lineheight: 18,\n },\n },\n xaxis: {\n title: {\n text: xTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 15,\n },\n gridcolor: gridColor,\n // Reserve space for tick labels + the axis title so the bottom legend\n // can't overlap them at small sizes (SW-2157).\n automargin: true,\n ...tickOptions,\n },\n yaxis: {\n title: {\n text: yTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 15,\n },\n gridcolor: gridColor,\n automargin: true,\n ...tickOptions,\n },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n };\n\n const config = {\n // Sizing is driven from the measured container; disable Plotly's own\n // window-resize responsiveness (it can't see container resizes).\n responsive: false,\n displayModeBar: false,\n displaylogo: false,\n };\n\n Plotly.newPlot(plotRef.current, plotData, layout, config);\n bindTooltip(plotRef.current);\n\n // Capture ref value for cleanup\n const plotElement = plotRef.current;\n plotInitedRef.current = true;\n appliedSizeRef.current = { ...sizeRef.current };\n\n return () => {\n if (plotElement) {\n Plotly.purge(plotElement);\n plotInitedRef.current = false;\n }\n };\n }, [hasSize, xTitle, yTitle, plotData, titleOptions, tickOptions, gridColor, theme, bindTooltip]);\n\n // Resize in place when the measured/overridden size changes — cheaper than\n // recreating the plot, and it preserves tooltip/event bindings.\n useEffect(() => {\n const plotElement = plotRef.current;\n if (!plotElement || !plotInitedRef.current || resolvedWidth <= 0 || resolvedHeight <= 0) {\n return;\n }\n // newPlot already drew at the current size; skip the redundant relayout\n // (it would queue an automargin redraw that can reject if we unmount first).\n if (\n appliedSizeRef.current.width === resolvedWidth &&\n appliedSizeRef.current.height === resolvedHeight\n ) {\n return;\n }\n appliedSizeRef.current = { width: resolvedWidth, height: resolvedHeight };\n // Swallow rejections from a relayout that races an unmount/purge.\n void Plotly.relayout(plotElement, { width: resolvedWidth, height: resolvedHeight }).catch(\n () => {},\n );\n }, [resolvedWidth, resolvedHeight]);\n\n return (\n <div\n ref={containerRef}\n className={cn(\"dotplot-container relative\", fillWidth && \"w-full\", fillHeight && \"h-full\")}\n style={width === undefined ? undefined : { width }}\n >\n <div\n ref={plotRef}\n style={{\n width: \"100%\",\n height: \"100%\",\n margin: \"0\",\n }}\n />\n {tooltipElement}\n </div>\n );\n};\n\nexport { DotPlot };\nexport type { DotPlotDataSeries, DotPlotProps, DotPlotVariant, MarkerSymbol };\n"],"names":["DotPlot","dataSeries","width","height","title","xTitle","yTitle","variant","markerSize","plotRef","useRef","theme","usePlotlyTheme","bindTooltip","tooltipElement","useChartTooltip","containerRef","measured","useElementSize","resolvedWidth","resolvedHeight","hasSize","fillWidth","fillHeight","sizeRef","plotInitedRef","appliedSizeRef","seriesArray","useMemo","defaultColors","CHART_COLORS","defaultSymbols","seriesWithColors","series","index","gridColor","plotData","tickOptions","titleOptions","useEffect","layout","config","Plotly","plotElement","jsxs","cn","jsx"],"mappings":";;;;;;;;AAgDA,MAAMA,IAAkC,CAAC;AAAA,EACvC,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,YAAAC,IAAa;AACf,MAAM;AACJ,QAAMC,IAAUC,EAAuB,IAAI,GACrCC,IAAQC,EAAA,GACR,EAAE,aAAAC,GAAa,gBAAAC,EAAA,IAAmBC,EAAgB,EAA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,WAAAgB,EAAc,UAAU,IACxBC,EAAe,UAAU,EAAE,GAAGF,EAAQ,QAAA,GAE/B,MAAM;AACX,MAAImB,MACFD,EAAO,MAAMC,CAAW,GACxBlB,EAAc,UAAU;AAAA,IAE5B;AAAA,EACF,GAAG,CAACJ,GAAShB,GAAQC,GAAQ8B,GAAUE,GAAcD,GAAaF,GAAWxB,GAAOE,CAAW,CAAC,GAIhG0B,EAAU,MAAM;AACd,UAAMI,IAAclC,EAAQ;AAC5B,IAAI,CAACkC,KAAe,CAAClB,EAAc,WAAWN,KAAiB,KAAKC,KAAkB,KAMpFM,EAAe,QAAQ,UAAUP,KACjCO,EAAe,QAAQ,WAAWN,MAIpCM,EAAe,UAAU,EAAE,OAAOP,GAAe,QAAQC,EAAA,GAEpDsB,EAAO,SAASC,GAAa,EAAE,OAAOxB,GAAe,QAAQC,EAAA,CAAgB,EAAE;AAAA,MAClF,MAAM;AAAA,MAAC;AAAA,IAAA;AAAA,EAEX,GAAG,CAACD,GAAeC,CAAc,CAAC,GAGhC,gBAAAwB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK5B;AAAA,MACL,WAAW6B,EAAG,8BAA8BvB,KAAa,UAAUC,KAAc,QAAQ;AAAA,MACzF,OAAOrB,MAAU,SAAY,SAAY,EAAE,OAAAA,EAAA;AAAA,MAE3C,UAAA;AAAA,QAAA,gBAAA4C;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAKrC;AAAA,YACL,OAAO;AAAA,cACL,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,QAAQ;AAAA,YAAA;AAAA,UACV;AAAA,QAAA;AAAA,QAEDK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),H=require("react"),V=require("../PlateMap/PlateMap.cjs");function $(e){if(!e||e.length===0)return[];const n=Math.max(...e.map(t=>t.length));return e.map(t=>{if(t.length===n)return t;const l=[...t];for(;l.length<n;)l.push(0);return l})}const x=({data:e,xLabels:n,yLabels:t,title:l,xTitle:u,yTitle:s,colorscale:i,width:g=800,height:h=600,showScale:m=!0,precision:p=0,zmin:f,zmax:M,valueUnit:w=""})=>{const o=e?$(e):void 0,S=o?.length??t?.length??16,R=o?.[0]?.length??n?.length??24,v=H.useMemo(()=>{if(!o)return;const C="ABCDEFGHIJKLMNOPQRSTUVWXYZ",c=[];for(let r=0;r<o.length;r++)for(let a=0;a<o[r].length;a++){const D=t?.[r]?.toString()??C[r]??`R${r+1}`,P=n?.[a]?.toString()??String(a+1),j=`${D}${P}`;c.push({wellId:j,values:{Value:o[r][a]}})}return c},[o,n,t]),d=i;return q.jsx(V.PlateMap,{data:v,plateFormat:"custom",rows:S,columns:R,title:l,xTitle:u,yTitle:s,xLabels:n,yLabels:t,colorScale:d,valueMin:f,valueMax:M,showColorBar:m,width:g,height:h,layerConfigs:[{id:"Value",valueUnit:w}],precision:p})};exports.Heatmap=x;
|
|
2
|
-
//# sourceMappingURL=Heatmap.cjs.map
|