@tetrascience-npm/tetrascience-react-ui 0.7.0-beta.108.1 → 0.7.0-beta.128.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 +2 -2
- 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,16 +1,13 @@
|
|
|
1
1
|
import { jsx as n, jsxs as x } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { Button as g } from "../ui/button.js";
|
|
10
|
-
import { ButtonGroupText as S, ButtonGroup as E } from "../ui/button-group.js";
|
|
11
|
-
import { TooltipProvider as G, Tooltip as I, TooltipTrigger as $, TooltipContent as L } from "../ui/tooltip.js";
|
|
2
|
+
import { ChevronRightIcon as w, ChevronLeftIcon as N } from "lucide-react";
|
|
3
|
+
import { createContext as y, memo as C, useState as B, useCallback as g, useMemo as b, useEffect as T, useContext as A } from "react";
|
|
4
|
+
import { Streamdown as k } from "streamdown";
|
|
5
|
+
import { useStreamdownPlugins as z } from "./use-streamdown-plugins.js";
|
|
6
|
+
import { Button as m } from "../ui/button.js";
|
|
7
|
+
import { ButtonGroupText as P, ButtonGroup as j } from "../ui/button-group.js";
|
|
8
|
+
import { TooltipProvider as S, Tooltip as R, TooltipTrigger as E, TooltipContent as G } from "../ui/tooltip.js";
|
|
12
9
|
import { cn as c } from "../../lib/utils.js";
|
|
13
|
-
const
|
|
10
|
+
const O = ({ className: e, from: s, ...t }) => /* @__PURE__ */ n(
|
|
14
11
|
"div",
|
|
15
12
|
{
|
|
16
13
|
className: c(
|
|
@@ -20,7 +17,7 @@ const _ = ({ className: e, from: s, ...t }) => /* @__PURE__ */ n(
|
|
|
20
17
|
),
|
|
21
18
|
...t
|
|
22
19
|
}
|
|
23
|
-
),
|
|
20
|
+
), Q = ({
|
|
24
21
|
children: e,
|
|
25
22
|
className: s,
|
|
26
23
|
...t
|
|
@@ -36,11 +33,11 @@ const _ = ({ className: e, from: s, ...t }) => /* @__PURE__ */ n(
|
|
|
36
33
|
...t,
|
|
37
34
|
children: e
|
|
38
35
|
}
|
|
39
|
-
),
|
|
36
|
+
), U = ({
|
|
40
37
|
className: e,
|
|
41
38
|
children: s,
|
|
42
39
|
...t
|
|
43
|
-
}) => /* @__PURE__ */ n("div", { className: c("flex items-center gap-1", e), ...t, children: s }),
|
|
40
|
+
}) => /* @__PURE__ */ n("div", { className: c("flex items-center gap-1", e), ...t, children: s }), W = ({
|
|
44
41
|
tooltip: e,
|
|
45
42
|
children: s,
|
|
46
43
|
label: t,
|
|
@@ -48,47 +45,47 @@ const _ = ({ className: e, from: s, ...t }) => /* @__PURE__ */ n(
|
|
|
48
45
|
size: r = "icon-sm",
|
|
49
46
|
...i
|
|
50
47
|
}) => {
|
|
51
|
-
const o = /* @__PURE__ */ x(
|
|
48
|
+
const o = /* @__PURE__ */ x(m, { size: r, type: "button", variant: a, ...i, children: [
|
|
52
49
|
s,
|
|
53
50
|
/* @__PURE__ */ n("span", { className: "sr-only", children: t || e })
|
|
54
51
|
] });
|
|
55
|
-
return e ? /* @__PURE__ */ n(
|
|
56
|
-
/* @__PURE__ */ n(
|
|
57
|
-
/* @__PURE__ */ n(
|
|
52
|
+
return e ? /* @__PURE__ */ n(S, { children: /* @__PURE__ */ x(R, { children: [
|
|
53
|
+
/* @__PURE__ */ n(E, { asChild: !0, children: o }),
|
|
54
|
+
/* @__PURE__ */ n(G, { children: /* @__PURE__ */ n("p", { children: e }) })
|
|
58
55
|
] }) }) : o;
|
|
59
|
-
}, v =
|
|
56
|
+
}, v = y(
|
|
60
57
|
null
|
|
61
58
|
), u = () => {
|
|
62
|
-
const e =
|
|
59
|
+
const e = A(v);
|
|
63
60
|
if (!e)
|
|
64
61
|
throw new Error(
|
|
65
62
|
"MessageBranch components must be used within MessageBranch"
|
|
66
63
|
);
|
|
67
64
|
return e;
|
|
68
|
-
},
|
|
65
|
+
}, X = ({
|
|
69
66
|
defaultBranch: e = 0,
|
|
70
67
|
onBranchChange: s,
|
|
71
68
|
className: t,
|
|
72
69
|
...a
|
|
73
70
|
}) => {
|
|
74
|
-
const [r, i] = B(e), [o,
|
|
71
|
+
const [r, i] = B(e), [o, d] = B([]), h = g(
|
|
75
72
|
(l) => {
|
|
76
73
|
i(l), s?.(l);
|
|
77
74
|
},
|
|
78
75
|
[s]
|
|
79
|
-
), p =
|
|
76
|
+
), p = g(() => {
|
|
80
77
|
const l = r > 0 ? r - 1 : o.length - 1;
|
|
81
|
-
|
|
82
|
-
}, [r, o.length,
|
|
78
|
+
h(l);
|
|
79
|
+
}, [r, o.length, h]), f = g(() => {
|
|
83
80
|
const l = r < o.length - 1 ? r + 1 : 0;
|
|
84
|
-
|
|
85
|
-
}, [r, o.length,
|
|
81
|
+
h(l);
|
|
82
|
+
}, [r, o.length, h]), M = b(
|
|
86
83
|
() => ({
|
|
87
84
|
branches: o,
|
|
88
85
|
currentBranch: r,
|
|
89
86
|
goToNext: f,
|
|
90
87
|
goToPrevious: p,
|
|
91
|
-
setBranches:
|
|
88
|
+
setBranches: d,
|
|
92
89
|
totalBranches: o.length
|
|
93
90
|
}),
|
|
94
91
|
[o, r, f, p]
|
|
@@ -100,7 +97,7 @@ const _ = ({ className: e, from: s, ...t }) => /* @__PURE__ */ n(
|
|
|
100
97
|
...a
|
|
101
98
|
}
|
|
102
99
|
) });
|
|
103
|
-
},
|
|
100
|
+
}, Y = ({
|
|
104
101
|
children: e,
|
|
105
102
|
...s
|
|
106
103
|
}) => {
|
|
@@ -108,27 +105,27 @@ const _ = ({ className: e, from: s, ...t }) => /* @__PURE__ */ n(
|
|
|
108
105
|
() => Array.isArray(e) ? e : [e],
|
|
109
106
|
[e]
|
|
110
107
|
);
|
|
111
|
-
return
|
|
108
|
+
return T(() => {
|
|
112
109
|
r.length !== i.length && a(i);
|
|
113
|
-
}, [i, r, a]), i.map((o,
|
|
110
|
+
}, [i, r, a]), i.map((o, d) => /* @__PURE__ */ n(
|
|
114
111
|
"div",
|
|
115
112
|
{
|
|
116
113
|
className: c(
|
|
117
114
|
"grid gap-2 overflow-hidden [&>div]:pb-0",
|
|
118
|
-
|
|
115
|
+
d === t ? "block" : "hidden"
|
|
119
116
|
),
|
|
120
117
|
...s,
|
|
121
118
|
children: o
|
|
122
119
|
},
|
|
123
120
|
o.key
|
|
124
121
|
));
|
|
125
|
-
},
|
|
122
|
+
}, Z = ({
|
|
126
123
|
className: e,
|
|
127
124
|
...s
|
|
128
125
|
}) => {
|
|
129
126
|
const { totalBranches: t } = u();
|
|
130
127
|
return t <= 1 ? null : /* @__PURE__ */ n(
|
|
131
|
-
|
|
128
|
+
j,
|
|
132
129
|
{
|
|
133
130
|
className: c(
|
|
134
131
|
"[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md",
|
|
@@ -138,13 +135,13 @@ const _ = ({ className: e, from: s, ...t }) => /* @__PURE__ */ n(
|
|
|
138
135
|
...s
|
|
139
136
|
}
|
|
140
137
|
);
|
|
141
|
-
},
|
|
138
|
+
}, _ = ({
|
|
142
139
|
children: e,
|
|
143
140
|
...s
|
|
144
141
|
}) => {
|
|
145
142
|
const { goToPrevious: t, totalBranches: a } = u();
|
|
146
143
|
return /* @__PURE__ */ n(
|
|
147
|
-
|
|
144
|
+
m,
|
|
148
145
|
{
|
|
149
146
|
"aria-label": "Previous branch",
|
|
150
147
|
disabled: a <= 1,
|
|
@@ -153,16 +150,16 @@ const _ = ({ className: e, from: s, ...t }) => /* @__PURE__ */ n(
|
|
|
153
150
|
type: "button",
|
|
154
151
|
variant: "ghost",
|
|
155
152
|
...s,
|
|
156
|
-
children: e ?? /* @__PURE__ */ n(
|
|
153
|
+
children: e ?? /* @__PURE__ */ n(N, { size: 14 })
|
|
157
154
|
}
|
|
158
155
|
);
|
|
159
|
-
},
|
|
156
|
+
}, ee = ({
|
|
160
157
|
children: e,
|
|
161
158
|
...s
|
|
162
159
|
}) => {
|
|
163
160
|
const { goToNext: t, totalBranches: a } = u();
|
|
164
161
|
return /* @__PURE__ */ n(
|
|
165
|
-
|
|
162
|
+
m,
|
|
166
163
|
{
|
|
167
164
|
"aria-label": "Next branch",
|
|
168
165
|
disabled: a <= 1,
|
|
@@ -171,16 +168,16 @@ const _ = ({ className: e, from: s, ...t }) => /* @__PURE__ */ n(
|
|
|
171
168
|
type: "button",
|
|
172
169
|
variant: "ghost",
|
|
173
170
|
...s,
|
|
174
|
-
children: e ?? /* @__PURE__ */ n(
|
|
171
|
+
children: e ?? /* @__PURE__ */ n(w, { size: 14 })
|
|
175
172
|
}
|
|
176
173
|
);
|
|
177
|
-
},
|
|
174
|
+
}, se = ({
|
|
178
175
|
className: e,
|
|
179
176
|
...s
|
|
180
177
|
}) => {
|
|
181
178
|
const { currentBranch: t, totalBranches: a } = u();
|
|
182
179
|
return /* @__PURE__ */ n(
|
|
183
|
-
|
|
180
|
+
P,
|
|
184
181
|
{
|
|
185
182
|
className: c(
|
|
186
183
|
"border-none bg-transparent text-muted-foreground shadow-none",
|
|
@@ -190,22 +187,25 @@ const _ = ({ className: e, from: s, ...t }) => /* @__PURE__ */ n(
|
|
|
190
187
|
children: `${t + 1} of ${a}`
|
|
191
188
|
}
|
|
192
189
|
);
|
|
193
|
-
},
|
|
194
|
-
({ className: e, ...s }) =>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
190
|
+
}, I = C(
|
|
191
|
+
({ className: e, ...s }) => {
|
|
192
|
+
const t = z();
|
|
193
|
+
return /* @__PURE__ */ n(
|
|
194
|
+
k,
|
|
195
|
+
{
|
|
196
|
+
className: c(
|
|
197
|
+
"size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
|
198
|
+
e
|
|
199
|
+
),
|
|
200
|
+
plugins: t,
|
|
201
|
+
...s
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
},
|
|
205
205
|
(e, s) => e.children === s.children && s.isAnimating === e.isAnimating
|
|
206
206
|
);
|
|
207
|
-
|
|
208
|
-
const
|
|
207
|
+
I.displayName = "MessageResponse";
|
|
208
|
+
const te = ({
|
|
209
209
|
className: e,
|
|
210
210
|
children: s,
|
|
211
211
|
...t
|
|
@@ -221,17 +221,17 @@ const le = ({
|
|
|
221
221
|
}
|
|
222
222
|
);
|
|
223
223
|
export {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
224
|
+
O as Message,
|
|
225
|
+
W as MessageAction,
|
|
226
|
+
U as MessageActions,
|
|
227
|
+
X as MessageBranch,
|
|
228
|
+
Y as MessageBranchContent,
|
|
229
|
+
ee as MessageBranchNext,
|
|
230
|
+
se as MessageBranchPage,
|
|
231
|
+
_ as MessageBranchPrevious,
|
|
232
|
+
Z as MessageBranchSelector,
|
|
233
|
+
Q as MessageContent,
|
|
234
|
+
I as MessageResponse,
|
|
235
|
+
te as MessageToolbar
|
|
236
236
|
};
|
|
237
237
|
//# sourceMappingURL=message.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sources":["../../../src/components/ai/message.tsx"],"sourcesContent":["import { cjk } from \"@streamdown/cjk\";\nimport { code } from \"@streamdown/code\";\nimport { math } from \"@streamdown/math\";\nimport { mermaid } from \"@streamdown/mermaid\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\nimport {\n createContext,\n memo,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { Streamdown } from \"streamdown\";\n\nimport type { UIMessage } from \"ai\";\nimport type { ComponentProps, HTMLAttributes, ReactElement } from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport {\n ButtonGroup,\n ButtonGroupText,\n} from \"@/components/ui/button-group\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { cn } from \"@/lib/utils\";\n\nexport type MessageProps = HTMLAttributes<HTMLDivElement> & {\n from: UIMessage[\"role\"];\n};\n\nexport const Message = ({ className, from, ...props }: MessageProps) => (\n <div\n className={cn(\n \"group flex w-full max-w-[95%] flex-col gap-2\",\n from === \"user\" ? \"is-user ml-auto justify-end\" : \"is-assistant\",\n className\n )}\n {...props}\n />\n);\n\nexport type MessageContentProps = HTMLAttributes<HTMLDivElement>;\n\nexport const MessageContent = ({\n children,\n className,\n ...props\n}: MessageContentProps) => (\n <div\n className={cn(\n \"is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm\",\n \"group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground\",\n \"group-[.is-assistant]:text-foreground\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n);\n\nexport type MessageActionsProps = ComponentProps<\"div\">;\n\nexport const MessageActions = ({\n className,\n children,\n ...props\n}: MessageActionsProps) => (\n <div className={cn(\"flex items-center gap-1\", className)} {...props}>\n {children}\n </div>\n);\n\nexport type MessageActionProps = ComponentProps<typeof Button> & {\n tooltip?: string;\n label?: string;\n};\n\nexport const MessageAction = ({\n tooltip,\n children,\n label,\n variant = \"ghost\",\n size = \"icon-sm\",\n ...props\n}: MessageActionProps) => {\n const button = (\n <Button size={size} type=\"button\" variant={variant} {...props}>\n {children}\n <span className=\"sr-only\">{label || tooltip}</span>\n </Button>\n );\n\n if (tooltip) {\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>{button}</TooltipTrigger>\n <TooltipContent>\n <p>{tooltip}</p>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n }\n\n return button;\n};\n\ninterface MessageBranchContextType {\n currentBranch: number;\n totalBranches: number;\n goToPrevious: () => void;\n goToNext: () => void;\n branches: ReactElement[];\n setBranches: (branches: ReactElement[]) => void;\n}\n\nconst MessageBranchContext = createContext<MessageBranchContextType | null>(\n null\n);\n\nconst useMessageBranch = () => {\n const context = useContext(MessageBranchContext);\n\n if (!context) {\n throw new Error(\n \"MessageBranch components must be used within MessageBranch\"\n );\n }\n\n return context;\n};\n\nexport type MessageBranchProps = HTMLAttributes<HTMLDivElement> & {\n defaultBranch?: number;\n onBranchChange?: (branchIndex: number) => void;\n};\n\nexport const MessageBranch = ({\n defaultBranch = 0,\n onBranchChange,\n className,\n ...props\n}: MessageBranchProps) => {\n const [currentBranch, setCurrentBranch] = useState(defaultBranch);\n const [branches, setBranches] = useState<ReactElement[]>([]);\n\n const handleBranchChange = useCallback(\n (newBranch: number) => {\n setCurrentBranch(newBranch);\n onBranchChange?.(newBranch);\n },\n [onBranchChange]\n );\n\n const goToPrevious = useCallback(() => {\n const newBranch =\n currentBranch > 0 ? currentBranch - 1 : branches.length - 1;\n handleBranchChange(newBranch);\n }, [currentBranch, branches.length, handleBranchChange]);\n\n const goToNext = useCallback(() => {\n const newBranch =\n currentBranch < branches.length - 1 ? currentBranch + 1 : 0;\n handleBranchChange(newBranch);\n }, [currentBranch, branches.length, handleBranchChange]);\n\n const contextValue = useMemo<MessageBranchContextType>(\n () => ({\n branches,\n currentBranch,\n goToNext,\n goToPrevious,\n setBranches,\n totalBranches: branches.length,\n }),\n [branches, currentBranch, goToNext, goToPrevious]\n );\n\n return (\n <MessageBranchContext.Provider value={contextValue}>\n <div\n className={cn(\"grid w-full gap-2 [&>div]:pb-0\", className)}\n {...props}\n />\n </MessageBranchContext.Provider>\n );\n};\n\nexport type MessageBranchContentProps = HTMLAttributes<HTMLDivElement>;\n\nexport const MessageBranchContent = ({\n children,\n ...props\n}: MessageBranchContentProps) => {\n const { currentBranch, setBranches, branches } = useMessageBranch();\n const childrenArray = useMemo(\n () => (Array.isArray(children) ? children : [children]),\n [children]\n );\n\n // Use useEffect to update branches when they change\n useEffect(() => {\n if (branches.length !== childrenArray.length) {\n setBranches(childrenArray);\n }\n }, [childrenArray, branches, setBranches]);\n\n return childrenArray.map((branch, index) => (\n <div\n className={cn(\n \"grid gap-2 overflow-hidden [&>div]:pb-0\",\n index === currentBranch ? \"block\" : \"hidden\"\n )}\n key={branch.key}\n {...props}\n >\n {branch}\n </div>\n ));\n};\n\nexport type MessageBranchSelectorProps = ComponentProps<typeof ButtonGroup>;\n\nexport const MessageBranchSelector = ({\n className,\n ...props\n}: MessageBranchSelectorProps) => {\n const { totalBranches } = useMessageBranch();\n\n // Don't render if there's only one branch\n if (totalBranches <= 1) {\n return null;\n }\n\n return (\n <ButtonGroup\n className={cn(\n \"[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md\",\n className\n )}\n orientation=\"horizontal\"\n {...props}\n />\n );\n};\n\nexport type MessageBranchPreviousProps = ComponentProps<typeof Button>;\n\nexport const MessageBranchPrevious = ({\n children,\n ...props\n}: MessageBranchPreviousProps) => {\n const { goToPrevious, totalBranches } = useMessageBranch();\n\n return (\n <Button\n aria-label=\"Previous branch\"\n disabled={totalBranches <= 1}\n onClick={goToPrevious}\n size=\"icon-sm\"\n type=\"button\"\n variant=\"ghost\"\n {...props}\n >\n {children ?? <ChevronLeftIcon size={14} />}\n </Button>\n );\n};\n\nexport type MessageBranchNextProps = ComponentProps<typeof Button>;\n\nexport const MessageBranchNext = ({\n children,\n ...props\n}: MessageBranchNextProps) => {\n const { goToNext, totalBranches } = useMessageBranch();\n\n return (\n <Button\n aria-label=\"Next branch\"\n disabled={totalBranches <= 1}\n onClick={goToNext}\n size=\"icon-sm\"\n type=\"button\"\n variant=\"ghost\"\n {...props}\n >\n {children ?? <ChevronRightIcon size={14} />}\n </Button>\n );\n};\n\nexport type MessageBranchPageProps = HTMLAttributes<HTMLSpanElement>;\n\nexport const MessageBranchPage = ({\n className,\n ...props\n}: MessageBranchPageProps) => {\n const { currentBranch, totalBranches } = useMessageBranch();\n\n return (\n <ButtonGroupText\n className={cn(\n \"border-none bg-transparent text-muted-foreground shadow-none\",\n className\n )}\n {...props}\n >\n {`${currentBranch + 1} of ${totalBranches}`}\n </ButtonGroupText>\n );\n};\n\nexport type MessageResponseProps = ComponentProps<typeof Streamdown>;\n\nconst streamdownPlugins = { cjk, code, math, mermaid };\n\nexport const MessageResponse = memo(\n ({ className, ...props }: MessageResponseProps) => (\n <Streamdown\n className={cn(\n \"size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0\",\n className\n )}\n plugins={streamdownPlugins}\n {...props}\n />\n ),\n (prevProps, nextProps) =>\n prevProps.children === nextProps.children &&\n nextProps.isAnimating === prevProps.isAnimating\n);\n\nMessageResponse.displayName = \"MessageResponse\";\n\nexport type MessageToolbarProps = ComponentProps<\"div\">;\n\nexport const MessageToolbar = ({\n className,\n children,\n ...props\n}: MessageToolbarProps) => (\n <div\n className={cn(\n \"mt-4 flex w-full items-center justify-between gap-4\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n);\n"],"names":["Message","className","from","props","jsx","cn","MessageContent","children","MessageActions","MessageAction","tooltip","label","variant","size","button","Button","TooltipProvider","jsxs","Tooltip","TooltipTrigger","TooltipContent","MessageBranchContext","createContext","useMessageBranch","context","useContext","MessageBranch","defaultBranch","onBranchChange","currentBranch","setCurrentBranch","useState","branches","setBranches","handleBranchChange","useCallback","newBranch","goToPrevious","goToNext","contextValue","useMemo","MessageBranchContent","childrenArray","useEffect","branch","index","MessageBranchSelector","totalBranches","ButtonGroup","MessageBranchPrevious","ChevronLeftIcon","MessageBranchNext","ChevronRightIcon","MessageBranchPage","ButtonGroupText","streamdownPlugins","cjk","code","math","mermaid","MessageResponse","memo","Streamd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AAAA,IAAA;AAAA,MACC,WAAWzD;AAAA,QACT;AAAA,QACAJ;AAAA,MAAA;AAAA,MAEF,SAASsD;AAAA,MACR,GAAGpD;AAAA,IAAA;AAAA,EAAA;AAAA,EAGR,CAAC4D,GAAWC,MACVD,EAAU,aAAaC,EAAU,YACjCA,EAAU,gBAAgBD,EAAU;AACxC;AAEAH,EAAgB,cAAc;AAIvB,MAAMK,KAAiB,CAAC;AAAA,EAC7B,WAAAhE;AAAA,EACA,UAAAM;AAAA,EACA,GAAGJ;AACL,MACE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGE;AAAA,IAEH,UAAAI;AAAA,EAAA;AACH;"}
|
|
1
|
+
{"version":3,"file":"message.js","sources":["../../../src/components/ai/message.tsx"],"sourcesContent":["import { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\nimport {\n createContext,\n memo,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { Streamdown } from \"streamdown\";\n\nimport { useStreamdownPlugins } from \"./use-streamdown-plugins\";\n\nimport type { UIMessage } from \"ai\";\nimport type { ComponentProps, HTMLAttributes, ReactElement } from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport {\n ButtonGroup,\n ButtonGroupText,\n} from \"@/components/ui/button-group\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { cn } from \"@/lib/utils\";\n\nexport type MessageProps = HTMLAttributes<HTMLDivElement> & {\n from: UIMessage[\"role\"];\n};\n\nexport const Message = ({ className, from, ...props }: MessageProps) => (\n <div\n className={cn(\n \"group flex w-full max-w-[95%] flex-col gap-2\",\n from === \"user\" ? \"is-user ml-auto justify-end\" : \"is-assistant\",\n className\n )}\n {...props}\n />\n);\n\nexport type MessageContentProps = HTMLAttributes<HTMLDivElement>;\n\nexport const MessageContent = ({\n children,\n className,\n ...props\n}: MessageContentProps) => (\n <div\n className={cn(\n \"is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm\",\n \"group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground\",\n \"group-[.is-assistant]:text-foreground\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n);\n\nexport type MessageActionsProps = ComponentProps<\"div\">;\n\nexport const MessageActions = ({\n className,\n children,\n ...props\n}: MessageActionsProps) => (\n <div className={cn(\"flex items-center gap-1\", className)} {...props}>\n {children}\n </div>\n);\n\nexport type MessageActionProps = ComponentProps<typeof Button> & {\n tooltip?: string;\n label?: string;\n};\n\nexport const MessageAction = ({\n tooltip,\n children,\n label,\n variant = \"ghost\",\n size = \"icon-sm\",\n ...props\n}: MessageActionProps) => {\n const button = (\n <Button size={size} type=\"button\" variant={variant} {...props}>\n {children}\n <span className=\"sr-only\">{label || tooltip}</span>\n </Button>\n );\n\n if (tooltip) {\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>{button}</TooltipTrigger>\n <TooltipContent>\n <p>{tooltip}</p>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n }\n\n return button;\n};\n\ninterface MessageBranchContextType {\n currentBranch: number;\n totalBranches: number;\n goToPrevious: () => void;\n goToNext: () => void;\n branches: ReactElement[];\n setBranches: (branches: ReactElement[]) => void;\n}\n\nconst MessageBranchContext = createContext<MessageBranchContextType | null>(\n null\n);\n\nconst useMessageBranch = () => {\n const context = useContext(MessageBranchContext);\n\n if (!context) {\n throw new Error(\n \"MessageBranch components must be used within MessageBranch\"\n );\n }\n\n return context;\n};\n\nexport type MessageBranchProps = HTMLAttributes<HTMLDivElement> & {\n defaultBranch?: number;\n onBranchChange?: (branchIndex: number) => void;\n};\n\nexport const MessageBranch = ({\n defaultBranch = 0,\n onBranchChange,\n className,\n ...props\n}: MessageBranchProps) => {\n const [currentBranch, setCurrentBranch] = useState(defaultBranch);\n const [branches, setBranches] = useState<ReactElement[]>([]);\n\n const handleBranchChange = useCallback(\n (newBranch: number) => {\n setCurrentBranch(newBranch);\n onBranchChange?.(newBranch);\n },\n [onBranchChange]\n );\n\n const goToPrevious = useCallback(() => {\n const newBranch =\n currentBranch > 0 ? currentBranch - 1 : branches.length - 1;\n handleBranchChange(newBranch);\n }, [currentBranch, branches.length, handleBranchChange]);\n\n const goToNext = useCallback(() => {\n const newBranch =\n currentBranch < branches.length - 1 ? currentBranch + 1 : 0;\n handleBranchChange(newBranch);\n }, [currentBranch, branches.length, handleBranchChange]);\n\n const contextValue = useMemo<MessageBranchContextType>(\n () => ({\n branches,\n currentBranch,\n goToNext,\n goToPrevious,\n setBranches,\n totalBranches: branches.length,\n }),\n [branches, currentBranch, goToNext, goToPrevious]\n );\n\n return (\n <MessageBranchContext.Provider value={contextValue}>\n <div\n className={cn(\"grid w-full gap-2 [&>div]:pb-0\", className)}\n {...props}\n />\n </MessageBranchContext.Provider>\n );\n};\n\nexport type MessageBranchContentProps = HTMLAttributes<HTMLDivElement>;\n\nexport const MessageBranchContent = ({\n children,\n ...props\n}: MessageBranchContentProps) => {\n const { currentBranch, setBranches, branches } = useMessageBranch();\n const childrenArray = useMemo(\n () => (Array.isArray(children) ? children : [children]),\n [children]\n );\n\n // Use useEffect to update branches when they change\n useEffect(() => {\n if (branches.length !== childrenArray.length) {\n setBranches(childrenArray);\n }\n }, [childrenArray, branches, setBranches]);\n\n return childrenArray.map((branch, index) => (\n <div\n className={cn(\n \"grid gap-2 overflow-hidden [&>div]:pb-0\",\n index === currentBranch ? \"block\" : \"hidden\"\n )}\n key={branch.key}\n {...props}\n >\n {branch}\n </div>\n ));\n};\n\nexport type MessageBranchSelectorProps = ComponentProps<typeof ButtonGroup>;\n\nexport const MessageBranchSelector = ({\n className,\n ...props\n}: MessageBranchSelectorProps) => {\n const { totalBranches } = useMessageBranch();\n\n // Don't render if there's only one branch\n if (totalBranches <= 1) {\n return null;\n }\n\n return (\n <ButtonGroup\n className={cn(\n \"[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md\",\n className\n )}\n orientation=\"horizontal\"\n {...props}\n />\n );\n};\n\nexport type MessageBranchPreviousProps = ComponentProps<typeof Button>;\n\nexport const MessageBranchPrevious = ({\n children,\n ...props\n}: MessageBranchPreviousProps) => {\n const { goToPrevious, totalBranches } = useMessageBranch();\n\n return (\n <Button\n aria-label=\"Previous branch\"\n disabled={totalBranches <= 1}\n onClick={goToPrevious}\n size=\"icon-sm\"\n type=\"button\"\n variant=\"ghost\"\n {...props}\n >\n {children ?? <ChevronLeftIcon size={14} />}\n </Button>\n );\n};\n\nexport type MessageBranchNextProps = ComponentProps<typeof Button>;\n\nexport const MessageBranchNext = ({\n children,\n ...props\n}: MessageBranchNextProps) => {\n const { goToNext, totalBranches } = useMessageBranch();\n\n return (\n <Button\n aria-label=\"Next branch\"\n disabled={totalBranches <= 1}\n onClick={goToNext}\n size=\"icon-sm\"\n type=\"button\"\n variant=\"ghost\"\n {...props}\n >\n {children ?? <ChevronRightIcon size={14} />}\n </Button>\n );\n};\n\nexport type MessageBranchPageProps = HTMLAttributes<HTMLSpanElement>;\n\nexport const MessageBranchPage = ({\n className,\n ...props\n}: MessageBranchPageProps) => {\n const { currentBranch, totalBranches } = useMessageBranch();\n\n return (\n <ButtonGroupText\n className={cn(\n \"border-none bg-transparent text-muted-foreground shadow-none\",\n className\n )}\n {...props}\n >\n {`${currentBranch + 1} of ${totalBranches}`}\n </ButtonGroupText>\n );\n};\n\nexport type MessageResponseProps = ComponentProps<typeof Streamdown>;\n\nexport const MessageResponse = memo(\n ({ className, ...props }: MessageResponseProps) => {\n // Plugins load lazily (SW-2007): markdown streams in immediately and\n // code/math/mermaid rendering upgrades in place once the chunk arrives.\n const plugins = useStreamdownPlugins();\n\n return (\n <Streamdown\n className={cn(\n \"size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0\",\n className\n )}\n plugins={plugins}\n {...props}\n />\n );\n },\n (prevProps, nextProps) =>\n prevProps.children === nextProps.children &&\n nextProps.isAnimating === prevProps.isAnimating\n);\n\nMessageResponse.displayName = \"MessageResponse\";\n\nexport type MessageToolbarProps = ComponentProps<\"div\">;\n\nexport const MessageToolbar = ({\n className,\n children,\n ...props\n}: MessageToolbarProps) => (\n <div\n className={cn(\n \"mt-4 flex w-full items-center justify-between gap-4\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n);\n"],"names":["Message","className","from","props","jsx","cn","MessageContent","children","MessageActions","MessageAction","tooltip","label","variant","size","button","Button","TooltipProvider","jsxs","Tooltip","TooltipTrigger","TooltipContent","MessageBranchContext","createContext","useMessageBranch","context","useContext","MessageBranch","defaultBranch","onBranchChange","currentBranch","setCurrentBranch","useState","branches","setBranches","handleBranchChange","useCallback","newBranch","goToPrevious","goToNext","contextValue","useMemo","MessageBranchContent","childrenArray","useEffect","branch","index","MessageBranchSelector","totalBranches","ButtonGroup","MessageBranchPrevious","ChevronLeftIcon","MessageBranchNext","ChevronRightIcon","MessageBranchPage","ButtonGroupText","MessageResponse","memo","plugins","useStreamdownPlugins","Streamdown","prevProps","nextProps","MessageToolbar"],"mappings":";;;;;;;;;AAkCO,MAAMA,IAAU,CAAC,EAAE,WAAAC,GAAW,MAAAC,GAAM,GAAGC,QAC5C,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC;AAAA,MACT;AAAA,MACAH,MAAS,SAAS,gCAAgC;AAAA,MAClDD;AAAA,IAAA;AAAA,IAED,GAAGE;AAAA,EAAA;AACN,GAKWG,IAAiB,CAAC;AAAA,EAC7B,UAAAC;AAAA,EACA,WAAAN;AAAA,EACA,GAAGE;AACL,MACE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGE;AA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
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),M=require("lucide-react"),n=require("react"),D=require("../ui/command.cjs"),E=require("../ui/dropdown-menu.cjs"),K=require("../ui/hover-card.cjs"),O=require("../ui/input-group.cjs"),q=require("../ui/select.cjs"),pe=require("../ui/spinner.cjs"),V=require("../ui/tooltip.cjs"),l=require("../../lib/utils.cjs"),de=async e=>{try{const o=await(await fetch(e)).blob();return new Promise(s=>{const u=new FileReader;u.onloadend=()=>s(u.result),u.onerror=()=>s(null),u.readAsDataURL(o)})}catch{return null}},fe=async()=>{if(typeof navigator>"u"||!navigator.mediaDevices?.getDisplayMedia)return null;let e=null;const t=document.createElement("video");t.muted=!0,t.playsInline=!0;try{e=await navigator.mediaDevices.getDisplayMedia({audio:!1,video:!0}),t.srcObject=e,await new Promise((g,b)=>{t.onloadedmetadata=()=>g(),t.onerror=()=>b(new Error("Failed to load screen stream"))}),await t.play();const o=t.videoWidth,s=t.videoHeight;if(!o||!s)return null;const u=document.createElement("canvas");u.width=o,u.height=s;const i=u.getContext("2d");if(!i)return null;i.drawImage(t,0,0,o,s);const a=await new Promise(g=>{u.toBlob(g,"image/png")});if(!a)return null;const h=new Date().toISOString().replace(/[:.]/g,"-").replace("T","_").replace("Z","");return new File([a],`screenshot-${h}.png`,{lastModified:Date.now(),type:"image/png"})}finally{if(e)for(const o of e.getTracks())o.stop();t.pause(),t.srcObject=null}},X=n.createContext(null),Z=n.createContext(null),Ie=()=>{const e=n.useContext(X);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return e},$=()=>n.useContext(X),he=()=>{const e=n.useContext(Z);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return e},ge=()=>n.useContext(Z),Pe=({initialInput:e="",children:t})=>{const[o,s]=n.useState(e),u=n.useCallback(()=>s(""),[]),[i,a]=n.useState([]),h=n.useRef(null),g=n.useRef(()=>{}),b=n.useCallback(m=>{const v=[...m];v.length!==0&&a(A=>[...A,...v.map(k=>({filename:k.name,id:crypto.randomUUID(),mediaType:k.type,type:"file",url:URL.createObjectURL(k)}))])},[]),R=n.useCallback(m=>{a(v=>{const A=v.find(k=>k.id===m);return A?.url&&URL.revokeObjectURL(A.url),v.filter(k=>k.id!==m)})},[]),f=n.useCallback(()=>{a(m=>{for(const v of m)v.url&&URL.revokeObjectURL(v.url);return[]})},[]),P=n.useRef(i);n.useEffect(()=>{P.current=i},[i]),n.useEffect(()=>()=>{for(const m of P.current)m.url&&URL.revokeObjectURL(m.url)},[]);const S=n.useCallback(()=>{g.current?.()},[]),d=n.useMemo(()=>({add:b,clear:f,fileInputRef:h,files:i,openFileDialog:S,remove:R}),[i,b,R,f,S]),w=n.useCallback((m,v)=>{h.current=m.current,g.current=v},[]),T=n.useMemo(()=>({__registerFileInput:w,attachments:d,textInput:{clear:u,setInput:s,value:o}}),[o,u,d,w]);return r.jsx(X.Provider,{value:T,children:r.jsx(Z.Provider,{value:d,children:t})})},ee=n.createContext(null),G=()=>{const e=ge(),o=n.useContext(ee)??e;if(!o)throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return o},J=n.createContext(null),xe=()=>{const e=n.useContext(J);if(!e)throw new Error("usePromptInputReferencedSources must be used within a LocalReferencedSourcesContext.Provider");return e},Ce=({label:e="Add photos or files",...t})=>{const o=G(),s=n.useCallback(u=>{u.preventDefault(),o.openFileDialog()},[o]);return r.jsxs(E.DropdownMenuItem,{...t,onSelect:s,children:[r.jsx(M.ImageIcon,{className:"mr-2 size-4"})," ",e]})},ve=({label:e="Take screenshot",onSelect:t,...o})=>{const s=G(),u=n.useCallback(async i=>{if(t?.(i),!i.defaultPrevented)try{const a=await fe();a&&s.add([a])}catch(a){if(a instanceof DOMException&&(a.name==="NotAllowedError"||a.name==="AbortError"))return;throw a}},[t,s]);return r.jsxs(E.DropdownMenuItem,{...o,onSelect:u,children:[r.jsx(M.Monitor,{className:"mr-2 size-4"}),e]})},be=({className:e,accept:t,multiple:o,globalDrop:s,syncHiddenInput:u,maxFiles:i,maxFileSize:a,onError:h,onSubmit:g,children:b,...R})=>{const f=$(),P=!!f,S=n.useRef(null),d=n.useRef(null),[w,T]=n.useState([]),m=P?f.attachments.files:w,[v,A]=n.useState([]),k=n.useRef(m);n.useEffect(()=>{k.current=m},[m]);const ne=n.useCallback(()=>{S.current?.click()},[]),z=n.useCallback(c=>!t||t.trim()===""?!0:t.split(",").map(p=>p.trim()).filter(Boolean).some(p=>{if(p.endsWith("/*")){const C=p.slice(0,-1);return c.type.startsWith(C)}return c.type===p}),[t]),re=n.useCallback(c=>{const I=[...c],p=I.filter(y=>z(y));if(I.length&&p.length===0){h?.({code:"accept",message:"No files match the accepted types."});return}const C=y=>a?y.size<=a:!0,x=p.filter(C);if(p.length>0&&x.length===0){h?.({code:"max_file_size",message:"All files exceed the maximum size."});return}T(y=>{const j=typeof i=="number"?Math.max(0,i-y.length):void 0,L=typeof j=="number"?x.slice(0,j):x;typeof j=="number"&&x.length>j&&h?.({code:"max_files",message:"Too many files. Some were not added."});const U=[];for(const W of L)U.push({filename:W.name,id:crypto.randomUUID(),mediaType:W.type,type:"file",url:URL.createObjectURL(W)});return[...y,...U]})},[z,i,a,h]),oe=n.useCallback(c=>T(I=>{const p=I.find(C=>C.id===c);return p?.url&&URL.revokeObjectURL(p.url),I.filter(C=>C.id!==c)}),[]),se=n.useCallback(c=>{const I=[...c],p=I.filter(U=>z(U));if(I.length&&p.length===0){h?.({code:"accept",message:"No files match the accepted types."});return}const C=U=>a?U.size<=a:!0,x=p.filter(C);if(p.length>0&&x.length===0){h?.({code:"max_file_size",message:"All files exceed the maximum size."});return}const y=m.length,j=typeof i=="number"?Math.max(0,i-y):void 0,L=typeof j=="number"?x.slice(0,j):x;typeof j=="number"&&x.length>j&&h?.({code:"max_files",message:"Too many files. Some were not added."}),L.length>0&&f?.attachments.add(L)},[z,a,i,h,m.length,f]),B=n.useCallback(()=>P?f?.attachments.clear():T(c=>{for(const I of c)I.url&&URL.revokeObjectURL(I.url);return[]}),[P,f]),H=n.useCallback(()=>A([]),[]),N=P?se:re,Q=P?f.attachments.remove:oe,Y=P?f.attachments.openFileDialog:ne,F=n.useCallback(()=>{B(),H()},[B,H]);n.useEffect(()=>{P&&f.__registerFileInput(S,()=>S.current?.click())},[P,f]),n.useEffect(()=>{u&&S.current&&m.length===0&&(S.current.value="")},[m,u]);const _=n.useCallback((c,I)=>{const p=x=>{x.dataTransfer?.types?.includes("Files")&&x.preventDefault()},C=x=>{const y=x;y.dataTransfer?.types?.includes("Files")&&x.preventDefault(),y.dataTransfer?.files&&y.dataTransfer.files.length>0&&I(y.dataTransfer.files)};return c.addEventListener("dragover",p),c.addEventListener("drop",C),()=>{c.removeEventListener("dragover",p),c.removeEventListener("drop",C)}},[]);n.useEffect(()=>{const c=d.current;if(c&&!s)return _(c,N)},[N,s,_]),n.useEffect(()=>{if(s)return _(document,N)},[N,s,_]),n.useEffect(()=>()=>{if(!P)for(const c of k.current)c.url&&URL.revokeObjectURL(c.url)},[P]);const ce=n.useCallback(c=>{c.currentTarget.files&&N(c.currentTarget.files),c.currentTarget.value=""},[N]),ae=n.useMemo(()=>({add:N,clear:B,fileInputRef:S,files:m.map(c=>({...c,id:c.id})),openFileDialog:Y,remove:Q}),[m,N,Q,B,Y]),ue=n.useMemo(()=>({add:c=>{const I=Array.isArray(c)?c:[c];A(p=>[...p,...I.map(C=>({...C,id:crypto.randomUUID()}))])},clear:H,remove:c=>{A(I=>I.filter(p=>p.id!==c))},sources:v}),[v,H]),ie=n.useCallback(async c=>{c.preventDefault();const I=c.currentTarget,p=P?f.textInput.value:new FormData(I).get("message")||"";P||I.reset();try{const C=await Promise.all(m.map(async({id:y,...j})=>{if(j.url?.startsWith("blob:")){const L=await de(j.url);return{...j,url:L??j.url}}return j})),x=g({files:C,text:p},c);if(x instanceof Promise)try{await x,F(),P&&f.textInput.clear()}catch{}else F(),P&&f.textInput.clear()}catch{}},[P,f,m,g,F]),le=r.jsxs(r.Fragment,{children:[r.jsx("input",{accept:t,"aria-label":"Upload files",className:"hidden",multiple:o,onChange:ce,ref:S,title:"Upload files",type:"file"}),r.jsx("form",{className:l.cn("w-full",e),onSubmit:ie,ref:d,...R,children:r.jsx(O.InputGroup,{className:"border-border overflow-hidden has-[[data-slot=input-group-control]:focus-visible]:ring-0",children:b})})]}),me=r.jsx(J.Provider,{value:ue,children:le});return r.jsx(ee.Provider,{value:ae,children:me})},ye=({className:e,...t})=>r.jsx("div",{className:l.cn("contents",e),...t}),je=({onChange:e,onKeyDown:t,className:o,placeholder:s="What would you like to know?",...u})=>{const i=$(),a=G(),[h,g]=n.useState(!1),b=n.useCallback(d=>{if(t?.(d),!d.defaultPrevented){if(d.key==="Enter"){if(h||d.nativeEvent.isComposing||d.shiftKey)return;d.preventDefault();const{form:w}=d.currentTarget;if(w?.querySelector('button[type="submit"]')?.disabled)return;w?.requestSubmit()}if(d.key==="Backspace"&&d.currentTarget.value===""&&a.files.length>0){d.preventDefault();const w=a.files[a.files.length-1];w&&a.remove(w.id)}}},[t,h,a]),R=n.useCallback(d=>{const w=d.clipboardData?.items;if(!w)return;const T=[];for(const m of w)if(m.kind==="file"){const v=m.getAsFile();v&&T.push(v)}T.length>0&&(d.preventDefault(),a.add(T))},[a]),f=n.useCallback(()=>g(!1),[]),P=n.useCallback(()=>g(!0),[]),S=i?{onChange:d=>{i.textInput.setInput(d.currentTarget.value),e?.(d)},value:i.textInput.value}:{onChange:e};return r.jsx(O.InputGroupTextarea,{className:l.cn("field-sizing-content max-h-48 min-h-16",o),name:"message",onCompositionEnd:f,onCompositionStart:P,onKeyDown:b,onPaste:R,placeholder:s,...u,...S})},we=({className:e,...t})=>r.jsx(O.InputGroupAddon,{align:"block-end",className:l.cn("order-first flex-wrap gap-1",e),...t}),Se=({className:e,...t})=>r.jsx(O.InputGroupAddon,{align:"block-end",className:l.cn("justify-between gap-1",e),...t}),Te=({className:e,...t})=>r.jsx("div",{className:l.cn("flex min-w-0 items-center gap-1",e),...t}),te=({variant:e="ghost",className:t,size:o,tooltip:s,...u})=>{const i=o??(n.Children.count(u.children)>1?"sm":"icon-sm"),a=r.jsx(O.InputGroupButton,{className:l.cn(t),size:i,type:"button",variant:e,...u});if(!s)return a;const h=typeof s=="string"?s:s.content,g=typeof s=="string"?void 0:s.shortcut,b=typeof s=="string"?"top":s.side??"top";return r.jsxs(V.Tooltip,{children:[r.jsx(V.TooltipTrigger,{asChild:!0,children:a}),r.jsxs(V.TooltipContent,{side:b,children:[h,g&&r.jsx("span",{className:"ml-2 text-muted-foreground",children:g})]})]})},ke=e=>r.jsx(E.DropdownMenu,{...e}),Re=({className:e,children:t,tooltip:o,"aria-label":s,...u})=>{const i=s??(typeof o=="string"?o:typeof o?.content=="string"?o.content:void 0);return r.jsx(E.DropdownMenuTrigger,{asChild:!0,children:r.jsx(te,{"aria-label":i,className:e,tooltip:o,...u,children:t??r.jsx(M.PlusIcon,{className:"size-4"})})})},Ae=({className:e,...t})=>r.jsx(E.DropdownMenuContent,{align:"start",className:l.cn(e),...t}),Ne=({className:e,...t})=>r.jsx(E.DropdownMenuItem,{className:l.cn(e),...t}),De=({className:e,variant:t="default",size:o="icon-sm",status:s,onStop:u,onClick:i,children:a,...h})=>{const g=s==="submitted"||s==="streaming";let b=r.jsx(M.CornerDownLeftIcon,{className:"size-4"});s==="submitted"?b=r.jsx(pe.Spinner,{}):s==="streaming"?b=r.jsx(M.SquareIcon,{className:"size-4"}):s==="error"&&(b=r.jsx(M.XIcon,{className:"size-4"}));const R=n.useCallback(f=>{if(g&&u){f.preventDefault(),u();return}i?.(f)},[g,u,i]);return r.jsx(O.InputGroupButton,{"aria-label":g?"Stop":"Submit",className:l.cn(e),onClick:R,size:o,type:g&&u?"button":"submit",variant:t,...h,children:a??b})},Le=e=>r.jsx(q.Select,{...e}),Ue=({className:e,...t})=>r.jsx(q.SelectTrigger,{className:l.cn("border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors","hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground",e),...t}),Me=({className:e,...t})=>r.jsx(q.SelectContent,{className:l.cn(e),...t}),Ee=({className:e,...t})=>r.jsx(q.SelectItem,{className:l.cn(e),...t}),Oe=({className:e,...t})=>r.jsx(q.SelectValue,{className:l.cn(e),...t}),qe=({openDelay:e=0,closeDelay:t=0,...o})=>r.jsx(K.HoverCard,{closeDelay:t,openDelay:e,...o}),ze=e=>r.jsx(K.HoverCardTrigger,{...e}),Be=({align:e="start",...t})=>r.jsx(K.HoverCardContent,{align:e,...t}),He=({a:e,b:t,show:o,className:s})=>r.jsxs("div",{className:l.cn("relative inline-flex items-center justify-center",s),children:[r.jsx("div",{"aria-hidden":o,className:l.cn("transition-all duration-200 ease-out",o?"pointer-events-none scale-75 opacity-0":"scale-100 opacity-100"),children:e}),r.jsx("div",{"aria-hidden":!o,className:l.cn("absolute transition-all duration-200 ease-out",o?"scale-100 opacity-100":"pointer-events-none scale-75 opacity-0"),children:t})]}),_e=({className:e,...t})=>r.jsx("div",{className:l.cn(e),...t}),Ge=({className:e,...t})=>r.jsx("div",{className:l.cn(e),...t}),Fe=({className:e,children:t,...o})=>r.jsx("h3",{className:l.cn("mb-2 px-3 font-medium text-muted-foreground text-xs",e),...o,children:t}),We=({className:e,...t})=>r.jsx("div",{className:l.cn("space-y-1",e),...t}),Ve=({className:e,...t})=>r.jsx("div",{className:l.cn("flex items-center gap-2 px-3 py-2 text-xs hover:bg-accent",e),...t}),Ke=({className:e,...t})=>r.jsx(D.Command,{className:l.cn(e),...t}),Xe=({className:e,...t})=>r.jsx(D.CommandInput,{className:l.cn(e),...t}),Ze=({className:e,...t})=>r.jsx(D.CommandList,{className:l.cn(e),...t}),Je=({className:e,...t})=>r.jsx(D.CommandEmpty,{className:l.cn(e),...t}),Qe=({className:e,...t})=>r.jsx(D.CommandGroup,{className:l.cn(e),...t}),Ye=({className:e,...t})=>r.jsx(D.CommandItem,{className:l.cn(e),...t}),$e=({className:e,...t})=>r.jsx(D.CommandSeparator,{className:l.cn(e),...t});exports.LocalReferencedSourcesContext=J;exports.PromptInput=be;exports.PromptInputActionAddAttachments=Ce;exports.PromptInputActionAddScreenshot=ve;exports.PromptInputActionMenu=ke;exports.PromptInputActionMenuContent=Ae;exports.PromptInputActionMenuItem=Ne;exports.PromptInputActionMenuTrigger=Re;exports.PromptInputBody=ye;exports.PromptInputButton=te;exports.PromptInputCommand=Ke;exports.PromptInputCommandEmpty=Je;exports.PromptInputCommandGroup=Qe;exports.PromptInputCommandInput=Xe;exports.PromptInputCommandItem=Ye;exports.PromptInputCommandList=Ze;exports.PromptInputCommandSeparator=$e;exports.PromptInputFooter=Se;exports.PromptInputHeader=we;exports.PromptInputHoverCard=qe;exports.PromptInputHoverCardContent=Be;exports.PromptInputHoverCardTrigger=ze;exports.PromptInputProvider=Pe;exports.PromptInputSelect=Le;exports.PromptInputSelectContent=Me;exports.PromptInputSelectItem=Ee;exports.PromptInputSelectTrigger=Ue;exports.PromptInputSelectValue=Oe;exports.PromptInputSlotSwap=He;exports.PromptInputSubmit=De;exports.PromptInputTab=Ge;exports.PromptInputTabBody=We;exports.PromptInputTabItem=Ve;exports.PromptInputTabLabel=Fe;exports.PromptInputTabsList=_e;exports.PromptInputTextarea=je;exports.PromptInputTools=Te;exports.usePromptInputAttachments=G;exports.usePromptInputController=Ie;exports.usePromptInputReferencedSources=xe;exports.useProviderAttachments=he;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),M=require("lucide-react"),n=require("react"),D=require("../ui/command.cjs"),E=require("../ui/dropdown-menu.cjs"),K=require("../ui/hover-card.cjs"),O=require("../ui/input-group.cjs"),q=require("../ui/select.cjs"),pe=require("../ui/spinner.cjs"),V=require("../ui/tooltip.cjs"),l=require("../../lib/utils.cjs"),de=async e=>{try{const o=await(await fetch(e)).blob();return new Promise(s=>{const u=new FileReader;u.onloadend=()=>s(u.result),u.onerror=()=>s(null),u.readAsDataURL(o)})}catch{return null}},fe=async()=>{if(typeof navigator>"u"||!navigator.mediaDevices?.getDisplayMedia)return null;let e=null;const t=document.createElement("video");t.muted=!0,t.playsInline=!0;try{e=await navigator.mediaDevices.getDisplayMedia({audio:!1,video:!0}),t.srcObject=e,await new Promise((g,v)=>{t.onloadedmetadata=()=>g(),t.onerror=()=>v(new Error("Failed to load screen stream"))}),await t.play();const o=t.videoWidth,s=t.videoHeight;if(!o||!s)return null;const u=document.createElement("canvas");u.width=o,u.height=s;const i=u.getContext("2d");if(!i)return null;i.drawImage(t,0,0,o,s);const c=await new Promise(g=>{u.toBlob(g,"image/png")});if(!c)return null;const h=new Date().toISOString().replace(/[:.]/g,"-").replace("T","_").replace("Z","");return new File([c],`screenshot-${h}.png`,{lastModified:Date.now(),type:"image/png"})}finally{if(e)for(const o of e.getTracks())o.stop();t.pause(),t.srcObject=null}},X=n.createContext(null),Z=n.createContext(null),Ie=()=>{const e=n.useContext(X);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return e},$=()=>n.useContext(X),he=()=>{const e=n.useContext(Z);if(!e)throw new Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return e},ge=()=>n.useContext(Z),Pe=({initialInput:e="",children:t})=>{const[o,s]=n.useState(e),u=n.useCallback(()=>s(""),[]),[i,c]=n.useState([]),h=n.useRef(null),g=n.useRef(()=>{}),v=n.useCallback(m=>{const b=[...m];b.length!==0&&c(A=>[...A,...b.map(k=>({filename:k.name,id:crypto.randomUUID(),mediaType:k.type,type:"file",url:URL.createObjectURL(k)}))])},[]),R=n.useCallback(m=>{c(b=>{const A=b.find(k=>k.id===m);return A?.url&&URL.revokeObjectURL(A.url),b.filter(k=>k.id!==m)})},[]),f=n.useCallback(()=>{c(m=>{for(const b of m)b.url&&URL.revokeObjectURL(b.url);return[]})},[]),P=n.useRef(i);n.useEffect(()=>{P.current=i},[i]),n.useEffect(()=>()=>{for(const m of P.current)m.url&&URL.revokeObjectURL(m.url)},[]);const w=n.useCallback(()=>{g.current?.()},[]),d=n.useMemo(()=>({add:v,clear:f,fileInputRef:h,files:i,openFileDialog:w,remove:R}),[i,v,R,f,w]),S=n.useCallback((m,b)=>{h.current=m.current,g.current=b},[]),T=n.useMemo(()=>({__registerFileInput:S,attachments:d,textInput:{clear:u,setInput:s,value:o}}),[o,u,d,S]);return r.jsx(X.Provider,{value:T,children:r.jsx(Z.Provider,{value:d,children:t})})},ee=n.createContext(null),G=()=>{const e=ge(),o=n.useContext(ee)??e;if(!o)throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return o},J=n.createContext(null),xe=()=>{const e=n.useContext(J);if(!e)throw new Error("usePromptInputReferencedSources must be used within a LocalReferencedSourcesContext.Provider");return e},Ce=({label:e="Add photos or files",...t})=>{const o=G(),s=n.useCallback(u=>{u.preventDefault(),o.openFileDialog()},[o]);return r.jsxs(E.DropdownMenuItem,{...t,onSelect:s,children:[r.jsx(M.ImageIcon,{className:"mr-2 size-4"})," ",e]})},be=({label:e="Take screenshot",onSelect:t,...o})=>{const s=G(),u=n.useCallback(async i=>{if(t?.(i),!i.defaultPrevented)try{const c=await fe();c&&s.add([c])}catch(c){if(c instanceof DOMException&&(c.name==="NotAllowedError"||c.name==="AbortError"))return;throw c}},[t,s]);return r.jsxs(E.DropdownMenuItem,{...o,onSelect:u,children:[r.jsx(M.Monitor,{className:"mr-2 size-4"}),e]})},ve=({className:e,accept:t,multiple:o,globalDrop:s,syncHiddenInput:u,maxFiles:i,maxFileSize:c,onError:h,onSubmit:g,children:v,...R})=>{const f=$(),P=!!f,w=n.useRef(null),d=n.useRef(null),[S,T]=n.useState([]),m=P?f.attachments.files:S,[b,A]=n.useState([]),k=n.useRef(m);n.useEffect(()=>{k.current=m},[m]);const ne=n.useCallback(()=>{w.current?.click()},[]),z=n.useCallback(a=>!t||t.trim()===""?!0:t.split(",").map(p=>p.trim()).filter(Boolean).some(p=>{if(p.endsWith("/*")){const C=p.slice(0,-1);return a.type.startsWith(C)}return a.type===p}),[t]),re=n.useCallback(a=>{const I=[...a],p=I.filter(y=>z(y));if(I.length&&p.length===0){h?.({code:"accept",message:"No files match the accepted types."});return}const C=y=>c?y.size<=c:!0,x=p.filter(C);if(p.length>0&&x.length===0){h?.({code:"max_file_size",message:"All files exceed the maximum size."});return}T(y=>{const j=typeof i=="number"?Math.max(0,i-y.length):void 0,L=typeof j=="number"?x.slice(0,j):x;typeof j=="number"&&x.length>j&&h?.({code:"max_files",message:"Too many files. Some were not added."});const U=[];for(const W of L)U.push({filename:W.name,id:crypto.randomUUID(),mediaType:W.type,type:"file",url:URL.createObjectURL(W)});return[...y,...U]})},[z,i,c,h]),oe=n.useCallback(a=>T(I=>{const p=I.find(C=>C.id===a);return p?.url&&URL.revokeObjectURL(p.url),I.filter(C=>C.id!==a)}),[]),se=n.useCallback(a=>{const I=[...a],p=I.filter(U=>z(U));if(I.length&&p.length===0){h?.({code:"accept",message:"No files match the accepted types."});return}const C=U=>c?U.size<=c:!0,x=p.filter(C);if(p.length>0&&x.length===0){h?.({code:"max_file_size",message:"All files exceed the maximum size."});return}const y=m.length,j=typeof i=="number"?Math.max(0,i-y):void 0,L=typeof j=="number"?x.slice(0,j):x;typeof j=="number"&&x.length>j&&h?.({code:"max_files",message:"Too many files. Some were not added."}),L.length>0&&f?.attachments.add(L)},[z,c,i,h,m.length,f]),B=n.useCallback(()=>P?f?.attachments.clear():T(a=>{for(const I of a)I.url&&URL.revokeObjectURL(I.url);return[]}),[P,f]),H=n.useCallback(()=>A([]),[]),N=P?se:re,Q=P?f.attachments.remove:oe,Y=P?f.attachments.openFileDialog:ne,F=n.useCallback(()=>{B(),H()},[B,H]);n.useEffect(()=>{P&&f.__registerFileInput(w,()=>w.current?.click())},[P,f]),n.useEffect(()=>{u&&w.current&&m.length===0&&(w.current.value="")},[m,u]);const _=n.useCallback((a,I)=>{const p=x=>{x.dataTransfer?.types?.includes("Files")&&x.preventDefault()},C=x=>{const y=x;y.dataTransfer?.types?.includes("Files")&&x.preventDefault(),y.dataTransfer?.files&&y.dataTransfer.files.length>0&&I(y.dataTransfer.files)};return a.addEventListener("dragover",p),a.addEventListener("drop",C),()=>{a.removeEventListener("dragover",p),a.removeEventListener("drop",C)}},[]);n.useEffect(()=>{const a=d.current;if(a&&!s)return _(a,N)},[N,s,_]),n.useEffect(()=>{if(s)return _(document,N)},[N,s,_]),n.useEffect(()=>()=>{if(!P)for(const a of k.current)a.url&&URL.revokeObjectURL(a.url)},[P]);const ae=n.useCallback(a=>{a.currentTarget.files&&N(a.currentTarget.files),a.currentTarget.value=""},[N]),ce=n.useMemo(()=>({add:N,clear:B,fileInputRef:w,files:m.map(a=>({...a,id:a.id})),openFileDialog:Y,remove:Q}),[m,N,Q,B,Y]),ue=n.useMemo(()=>({add:a=>{const I=Array.isArray(a)?a:[a];A(p=>[...p,...I.map(C=>({...C,id:crypto.randomUUID()}))])},clear:H,remove:a=>{A(I=>I.filter(p=>p.id!==a))},sources:b}),[b,H]),ie=n.useCallback(async a=>{a.preventDefault();const I=a.currentTarget,p=P?f.textInput.value:new FormData(I).get("message")||"";P||I.reset();try{const C=await Promise.all(m.map(async({id:y,...j})=>{if(j.url?.startsWith("blob:")){const L=await de(j.url);return{...j,url:L??j.url}}return j})),x=g({files:C,text:p},a);if(x instanceof Promise)try{await x,F(),P&&f.textInput.clear()}catch{}else F(),P&&f.textInput.clear()}catch{}},[P,f,m,g,F]),le=r.jsxs(r.Fragment,{children:[r.jsx("input",{accept:t,"aria-label":"Upload files",className:"hidden",multiple:o,onChange:ae,ref:w,title:"Upload files",type:"file"}),r.jsx("form",{className:l.cn("w-full",e),onSubmit:ie,ref:d,...R,children:r.jsx(O.InputGroup,{className:"border-border overflow-hidden has-[[data-slot=input-group-control]:focus-visible]:ring-0",children:v})})]}),me=r.jsx(J.Provider,{value:ue,children:le});return r.jsx(ee.Provider,{value:ce,children:me})},ye=({className:e,...t})=>r.jsx("div",{className:l.cn("contents",e),...t}),je=({onChange:e,onKeyDown:t,className:o,placeholder:s="What would you like to know?",...u})=>{const i=$(),c=G(),[h,g]=n.useState(!1),v=n.useCallback(d=>{if(t?.(d),!d.defaultPrevented){if(d.key==="Enter"){if(h||d.nativeEvent.isComposing||d.shiftKey)return;d.preventDefault();const{form:S}=d.currentTarget;if(S?.querySelector('button[type="submit"]')?.disabled)return;S?.requestSubmit()}if(d.key==="Backspace"&&d.currentTarget.value===""&&c.files.length>0){d.preventDefault();const S=c.files[c.files.length-1];S&&c.remove(S.id)}}},[t,h,c]),R=n.useCallback(d=>{const S=d.clipboardData?.items;if(!S)return;const T=[];for(const m of S)if(m.kind==="file"){const b=m.getAsFile();b&&T.push(b)}T.length>0&&(d.preventDefault(),c.add(T))},[c]),f=n.useCallback(()=>g(!1),[]),P=n.useCallback(()=>g(!0),[]),w=i?{onChange:d=>{i.textInput.setInput(d.currentTarget.value),e?.(d)},value:i.textInput.value}:{onChange:e};return r.jsx(O.InputGroupTextarea,{className:l.cn("field-sizing-content max-h-48 min-h-16",o),name:"message",onCompositionEnd:f,onCompositionStart:P,onKeyDown:v,onPaste:R,placeholder:s,...u,...w})},Se=({className:e,...t})=>r.jsx(O.InputGroupAddon,{align:"block-end",className:l.cn("order-first flex-wrap gap-1",e),...t}),we=({className:e,...t})=>r.jsx(O.InputGroupAddon,{align:"block-end",className:l.cn("justify-between gap-1",e),...t}),Te=({className:e,...t})=>r.jsx("div",{className:l.cn("flex min-w-0 items-center gap-1",e),...t}),te=({variant:e="ghost",className:t,size:o,tooltip:s,...u})=>{const i=o??(n.Children.count(u.children)>1?"sm":"icon-sm"),c=r.jsx(O.InputGroupButton,{className:l.cn(t),size:i,type:"button",variant:e,...u});if(!s)return c;const h=typeof s=="string"?s:s.content,g=typeof s=="string"?void 0:s.shortcut,v=typeof s=="string"?"top":s.side??"top";return r.jsxs(V.Tooltip,{children:[r.jsx(V.TooltipTrigger,{asChild:!0,children:c}),r.jsxs(V.TooltipContent,{side:v,children:[h,g&&r.jsx("span",{className:"ml-2 text-background/70",children:g})]})]})},ke=e=>r.jsx(E.DropdownMenu,{modal:!1,...e}),Re=({className:e,children:t,tooltip:o,"aria-label":s,...u})=>{const i=s??(typeof o=="string"?o:typeof o?.content=="string"?o.content:void 0);return r.jsx(E.DropdownMenuTrigger,{asChild:!0,children:r.jsx(te,{"aria-label":i,className:e,tooltip:o,...u,children:t??r.jsx(M.PlusIcon,{className:"size-4"})})})},Ae=({className:e,...t})=>r.jsx(E.DropdownMenuContent,{align:"start",className:l.cn(e),...t}),Ne=({className:e,...t})=>r.jsx(E.DropdownMenuItem,{className:l.cn(e),...t}),De=({className:e,variant:t="default",size:o="icon-sm",status:s,onStop:u,onClick:i,children:c,...h})=>{const g=s==="submitted"||s==="streaming";let v=r.jsx(M.CornerDownLeftIcon,{className:"size-4"});s==="submitted"?v=r.jsx(pe.Spinner,{}):s==="streaming"?v=r.jsx(M.SquareIcon,{className:"size-4"}):s==="error"&&(v=r.jsx(M.XIcon,{className:"size-4"}));const R=n.useCallback(f=>{if(g&&u){f.preventDefault(),u();return}i?.(f)},[g,u,i]);return r.jsx(O.InputGroupButton,{"aria-label":g?"Stop":"Submit",className:l.cn(e),onClick:R,size:o,type:g&&u?"button":"submit",variant:t,...h,children:c??v})},Le=e=>r.jsx(q.Select,{...e}),Ue=({className:e,...t})=>r.jsx(q.SelectTrigger,{className:l.cn("border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors","hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground",e),...t}),Me=({className:e,...t})=>r.jsx(q.SelectContent,{className:l.cn(e),...t}),Ee=({className:e,...t})=>r.jsx(q.SelectItem,{className:l.cn(e),...t}),Oe=({className:e,...t})=>r.jsx(q.SelectValue,{className:l.cn(e),...t}),qe=({openDelay:e=0,closeDelay:t=0,...o})=>r.jsx(K.HoverCard,{closeDelay:t,openDelay:e,...o}),ze=e=>r.jsx(K.HoverCardTrigger,{...e}),Be=({align:e="start",...t})=>r.jsx(K.HoverCardContent,{align:e,...t}),He=({a:e,b:t,show:o,className:s})=>r.jsxs("div",{className:l.cn("relative inline-flex items-center justify-center",s),children:[r.jsx("div",{"aria-hidden":o,inert:o,className:l.cn("transition-all duration-200 ease-out",o?"pointer-events-none scale-75 opacity-0":"scale-100 opacity-100"),children:e}),r.jsx("div",{"aria-hidden":!o,inert:!o,className:l.cn("absolute transition-all duration-200 ease-out",o?"scale-100 opacity-100":"pointer-events-none scale-75 opacity-0"),children:t})]}),_e=({className:e,...t})=>r.jsx("div",{className:l.cn(e),...t}),Ge=({className:e,...t})=>r.jsx("div",{className:l.cn(e),...t}),Fe=({className:e,children:t,...o})=>r.jsx("h3",{className:l.cn("mb-2 px-3 font-medium text-muted-foreground text-xs",e),...o,children:t}),We=({className:e,...t})=>r.jsx("div",{className:l.cn("space-y-1",e),...t}),Ve=({className:e,...t})=>r.jsx("div",{className:l.cn("flex items-center gap-2 px-3 py-2 text-xs hover:bg-accent",e),...t}),Ke=({className:e,...t})=>r.jsx(D.Command,{className:l.cn(e),...t}),Xe=({className:e,...t})=>r.jsx(D.CommandInput,{className:l.cn(e),...t}),Ze=({className:e,...t})=>r.jsx(D.CommandList,{className:l.cn(e),...t}),Je=({className:e,...t})=>r.jsx(D.CommandEmpty,{className:l.cn(e),...t}),Qe=({className:e,...t})=>r.jsx(D.CommandGroup,{className:l.cn(e),...t}),Ye=({className:e,...t})=>r.jsx(D.CommandItem,{className:l.cn(e),...t}),$e=({className:e,...t})=>r.jsx(D.CommandSeparator,{className:l.cn(e),...t});exports.LocalReferencedSourcesContext=J;exports.PromptInput=ve;exports.PromptInputActionAddAttachments=Ce;exports.PromptInputActionAddScreenshot=be;exports.PromptInputActionMenu=ke;exports.PromptInputActionMenuContent=Ae;exports.PromptInputActionMenuItem=Ne;exports.PromptInputActionMenuTrigger=Re;exports.PromptInputBody=ye;exports.PromptInputButton=te;exports.PromptInputCommand=Ke;exports.PromptInputCommandEmpty=Je;exports.PromptInputCommandGroup=Qe;exports.PromptInputCommandInput=Xe;exports.PromptInputCommandItem=Ye;exports.PromptInputCommandList=Ze;exports.PromptInputCommandSeparator=$e;exports.PromptInputFooter=we;exports.PromptInputHeader=Se;exports.PromptInputHoverCard=qe;exports.PromptInputHoverCardContent=Be;exports.PromptInputHoverCardTrigger=ze;exports.PromptInputProvider=Pe;exports.PromptInputSelect=Le;exports.PromptInputSelectContent=Me;exports.PromptInputSelectItem=Ee;exports.PromptInputSelectTrigger=Ue;exports.PromptInputSelectValue=Oe;exports.PromptInputSlotSwap=He;exports.PromptInputSubmit=De;exports.PromptInputTab=Ge;exports.PromptInputTabBody=We;exports.PromptInputTabItem=Ve;exports.PromptInputTabLabel=Fe;exports.PromptInputTabsList=_e;exports.PromptInputTextarea=je;exports.PromptInputTools=Te;exports.usePromptInputAttachments=G;exports.usePromptInputController=Ie;exports.usePromptInputReferencedSources=xe;exports.useProviderAttachments=he;
|
|
2
2
|
//# sourceMappingURL=prompt-input.cjs.map
|