@langchain/macaw-components 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +27 -0
- package/dist/_chunks/ErrorState-CmPX01HV.js +13361 -0
- package/dist/_chunks/ErrorState-CmPX01HV.js.map +1 -0
- package/dist/_chunks/LoadingIndicator-DgtU9aqD.js +80 -0
- package/dist/_chunks/LoadingIndicator-DgtU9aqD.js.map +1 -0
- package/dist/base.css +305 -0
- package/dist/catalog.json +1675 -0
- package/dist/components/Avatar/Avatar.d.ts +28 -0
- package/dist/components/Avatar/Avatar.js +47 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Badge/Badge.d.ts +25 -0
- package/dist/components/Badge/Badge.js +82 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Banner/Banner.d.ts +15 -0
- package/dist/components/Banner/Banner.js +102 -0
- package/dist/components/Banner/Banner.js.map +1 -0
- package/dist/components/Banner/index.d.ts +2 -0
- package/dist/components/Banner/index.js +2 -0
- package/dist/components/BarChart/AnimatedBar.d.ts +20 -0
- package/dist/components/BarChart/AnimatedBar.js +65 -0
- package/dist/components/BarChart/AnimatedBar.js.map +1 -0
- package/dist/components/BarChart/BarChart.d.ts +25 -0
- package/dist/components/BarChart/BarChart.js +248 -0
- package/dist/components/BarChart/BarChart.js.map +1 -0
- package/dist/components/BarChart/BarChart.types.d.ts +239 -0
- package/dist/components/BarChart/BarChart.types.js +0 -0
- package/dist/components/BarChart/BarChart.utils.d.ts +51 -0
- package/dist/components/BarChart/BarChart.utils.js +215 -0
- package/dist/components/BarChart/BarChart.utils.js.map +1 -0
- package/dist/components/BarChart/BarChartAxes.d.ts +22 -0
- package/dist/components/BarChart/BarChartAxes.js +144 -0
- package/dist/components/BarChart/BarChartAxes.js.map +1 -0
- package/dist/components/BarChart/BarChartGuides.d.ts +22 -0
- package/dist/components/BarChart/BarChartGuides.js +83 -0
- package/dist/components/BarChart/BarChartGuides.js.map +1 -0
- package/dist/components/BarChart/BarChartPlot.d.ts +40 -0
- package/dist/components/BarChart/BarChartPlot.js +262 -0
- package/dist/components/BarChart/BarChartPlot.js.map +1 -0
- package/dist/components/BarChart/constants.d.ts +21 -0
- package/dist/components/BarChart/constants.js +26 -0
- package/dist/components/BarChart/constants.js.map +1 -0
- package/dist/components/BarChart/index.d.ts +3 -0
- package/dist/components/BarChart/index.js +3 -0
- package/dist/components/Button/Button.d.ts +36 -0
- package/dist/components/Button/Button.js +99 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/constants.d.ts +26 -0
- package/dist/components/Button/constants.js +31 -0
- package/dist/components/Button/constants.js.map +1 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +30 -0
- package/dist/components/ButtonGroup/ButtonGroup.js +26 -0
- package/dist/components/ButtonGroup/ButtonGroup.js.map +1 -0
- package/dist/components/ButtonGroup/index.d.ts +2 -0
- package/dist/components/ButtonGroup/index.js +2 -0
- package/dist/components/Card/Card.d.ts +10 -0
- package/dist/components/Card/Card.js +23 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Card/index.d.ts +2 -0
- package/dist/components/Card/index.js +2 -0
- package/dist/components/ChartCard/ChartCard.d.ts +53 -0
- package/dist/components/ChartCard/ChartCard.js +172 -0
- package/dist/components/ChartCard/ChartCard.js.map +1 -0
- package/dist/components/ChartCard/ChartCardSkeleton.d.ts +7 -0
- package/dist/components/ChartCard/ChartCardSkeleton.js +61 -0
- package/dist/components/ChartCard/ChartCardSkeleton.js.map +1 -0
- package/dist/components/ChartCard/index.d.ts +4 -0
- package/dist/components/ChartCard/index.js +3 -0
- package/dist/components/ChartLegend/ChartLegend.d.ts +19 -0
- package/dist/components/ChartLegend/ChartLegend.js +195 -0
- package/dist/components/ChartLegend/ChartLegend.js.map +1 -0
- package/dist/components/ChartLegend/ChartLegendItemRenderer.d.ts +14 -0
- package/dist/components/ChartLegend/ChartLegendItemRenderer.js +90 -0
- package/dist/components/ChartLegend/ChartLegendItemRenderer.js.map +1 -0
- package/dist/components/ChartLegend/index.d.ts +3 -0
- package/dist/components/ChartLegend/index.js +3 -0
- package/dist/components/ChartLegend/useChartLegendActiveItem.d.ts +7 -0
- package/dist/components/ChartLegend/useChartLegendActiveItem.js +35 -0
- package/dist/components/ChartLegend/useChartLegendActiveItem.js.map +1 -0
- package/dist/components/ChartLegend/utils.d.ts +20 -0
- package/dist/components/ChartLegend/utils.js +33 -0
- package/dist/components/ChartLegend/utils.js.map +1 -0
- package/dist/components/ChartTooltip/ChartTooltip.d.ts +23 -0
- package/dist/components/ChartTooltip/ChartTooltip.js +83 -0
- package/dist/components/ChartTooltip/ChartTooltip.js.map +1 -0
- package/dist/components/ChartTooltip/index.d.ts +2 -0
- package/dist/components/ChartTooltip/index.js +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +58 -0
- package/dist/components/Checkbox/Checkbox.js +50 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Checkbox/constants.d.ts +28 -0
- package/dist/components/Checkbox/constants.js +57 -0
- package/dist/components/Checkbox/constants.js.map +1 -0
- package/dist/components/Checkbox/getCheckedState.d.ts +6 -0
- package/dist/components/Checkbox/getCheckedState.js +14 -0
- package/dist/components/Checkbox/getCheckedState.js.map +1 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/Checkbox/index.js +3 -0
- package/dist/components/CircularProgress/CircularProgress.d.ts +54 -0
- package/dist/components/CircularProgress/CircularProgress.js +85 -0
- package/dist/components/CircularProgress/CircularProgress.js.map +1 -0
- package/dist/components/CircularProgress/index.d.ts +2 -0
- package/dist/components/CircularProgress/index.js +2 -0
- package/dist/components/Code/Code.utils.d.ts +24 -0
- package/dist/components/Code/Code.utils.js +160 -0
- package/dist/components/Code/Code.utils.js.map +1 -0
- package/dist/components/Code/CodeLite.d.ts +19 -0
- package/dist/components/Code/CodeLite.js +146 -0
- package/dist/components/Code/CodeLite.js.map +1 -0
- package/dist/components/Code/CodeLite.utils.d.ts +24 -0
- package/dist/components/Code/CodeLite.utils.js +273 -0
- package/dist/components/Code/CodeLite.utils.js.map +1 -0
- package/dist/components/Code/ImageReplacerExtension.d.ts +9 -0
- package/dist/components/Code/ImageReplacerExtension.js +227 -0
- package/dist/components/Code/ImageReplacerExtension.js.map +1 -0
- package/dist/components/Code/JsonHighlighterExtension.d.ts +4 -0
- package/dist/components/Code/JsonHighlighterExtension.js +172 -0
- package/dist/components/Code/JsonHighlighterExtension.js.map +1 -0
- package/dist/components/Code/constants.d.ts +6 -0
- package/dist/components/Code/constants.js +11 -0
- package/dist/components/Code/constants.js.map +1 -0
- package/dist/components/Code/index.d.ts +30 -0
- package/dist/components/Code/index.js +140 -0
- package/dist/components/Code/index.js.map +1 -0
- package/dist/components/Code/languages/json.d.ts +1 -0
- package/dist/components/Code/languages/json.js +7 -0
- package/dist/components/Code/languages/json.js.map +1 -0
- package/dist/components/Code/languages/languages.d.ts +7 -0
- package/dist/components/Code/languages/languages.js +12 -0
- package/dist/components/Code/languages/languages.js.map +1 -0
- package/dist/components/Code/languages/python.d.ts +1 -0
- package/dist/components/Code/languages/python.js +7 -0
- package/dist/components/Code/languages/python.js.map +1 -0
- package/dist/components/Code/languages/shell.d.ts +7 -0
- package/dist/components/Code/languages/shell.js +241 -0
- package/dist/components/Code/languages/shell.js.map +1 -0
- package/dist/components/Code/languages/typescript.d.ts +1 -0
- package/dist/components/Code/languages/typescript.js +7 -0
- package/dist/components/Code/languages/typescript.js.map +1 -0
- package/dist/components/Code/languages/yaml.d.ts +2 -0
- package/dist/components/Code/languages/yaml.js +44 -0
- package/dist/components/Code/languages/yaml.js.map +1 -0
- package/dist/components/Code/types.d.ts +8 -0
- package/dist/components/Code/types.js +0 -0
- package/dist/components/Code/utils.d.ts +4 -0
- package/dist/components/Code/utils.js +27 -0
- package/dist/components/Code/utils.js.map +1 -0
- package/dist/components/Command/Command.d.ts +78 -0
- package/dist/components/Command/Command.js +78 -0
- package/dist/components/Command/Command.js.map +1 -0
- package/dist/components/Command/CommandMenu.d.ts +65 -0
- package/dist/components/Command/CommandMenu.js +101 -0
- package/dist/components/Command/CommandMenu.js.map +1 -0
- package/dist/components/Command/index.d.ts +4 -0
- package/dist/components/Command/index.js +3 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +9 -0
- package/dist/components/ContextMenu/ContextMenu.js +43 -0
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -0
- package/dist/components/ContextMenu/index.d.ts +1 -0
- package/dist/components/ContextMenu/index.js +2 -0
- package/dist/components/CopyButton/CopyButton.d.ts +24 -0
- package/dist/components/CopyButton/CopyButton.js +121 -0
- package/dist/components/CopyButton/CopyButton.js.map +1 -0
- package/dist/components/CopyButton/copyToClipboard.d.ts +1 -0
- package/dist/components/CopyButton/copyToClipboard.js +29 -0
- package/dist/components/CopyButton/copyToClipboard.js.map +1 -0
- package/dist/components/CopyButton/index.d.ts +4 -0
- package/dist/components/CopyButton/index.js +4 -0
- package/dist/components/CopyButton/useCopy.d.ts +10 -0
- package/dist/components/CopyButton/useCopy.js +46 -0
- package/dist/components/CopyButton/useCopy.js.map +1 -0
- package/dist/components/Dialog/index.d.ts +49 -0
- package/dist/components/Dialog/index.js +130 -0
- package/dist/components/Dialog/index.js.map +1 -0
- package/dist/components/Divider/Divider.d.ts +9 -0
- package/dist/components/Divider/Divider.js +27 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Divider/index.d.ts +2 -0
- package/dist/components/Divider/index.js +2 -0
- package/dist/components/DonutChart/DonutChart.d.ts +101 -0
- package/dist/components/DonutChart/DonutChart.js +197 -0
- package/dist/components/DonutChart/DonutChart.js.map +1 -0
- package/dist/components/DonutChart/DonutChart.utils.d.ts +38 -0
- package/dist/components/DonutChart/DonutChart.utils.js +93 -0
- package/dist/components/DonutChart/DonutChart.utils.js.map +1 -0
- package/dist/components/DonutChart/constants.d.ts +7 -0
- package/dist/components/DonutChart/constants.js +12 -0
- package/dist/components/DonutChart/constants.js.map +1 -0
- package/dist/components/DonutChart/index.d.ts +4 -0
- package/dist/components/DonutChart/index.js +4 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +24 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +149 -0
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -0
- package/dist/components/DropdownMenu/index.d.ts +1 -0
- package/dist/components/DropdownMenu/index.js +2 -0
- package/dist/components/EmptyState/EmptyState.d.ts +26 -0
- package/dist/components/EmptyState/EmptyState.js +85 -0
- package/dist/components/EmptyState/EmptyState.js.map +1 -0
- package/dist/components/EmptyState/index.d.ts +2 -0
- package/dist/components/EmptyState/index.js +2 -0
- package/dist/components/ErrorBoundary.d.ts +35 -0
- package/dist/components/ErrorBoundary.js +41 -0
- package/dist/components/ErrorBoundary.js.map +1 -0
- package/dist/components/ErrorMessage/ErrorMessage.d.ts +17 -0
- package/dist/components/ErrorMessage/ErrorMessage.js +146 -0
- package/dist/components/ErrorMessage/ErrorMessage.js.map +1 -0
- package/dist/components/ErrorMessage/index.d.ts +2 -0
- package/dist/components/ErrorMessage/index.js +2 -0
- package/dist/components/ErrorState/ErrorState.d.ts +23 -0
- package/dist/components/ErrorState/ErrorState.js +2 -0
- package/dist/components/ErrorState/index.d.ts +2 -0
- package/dist/components/ErrorState/index.js +2 -0
- package/dist/components/GroupedTabs/GroupedTabs.d.ts +31 -0
- package/dist/components/GroupedTabs/GroupedTabs.js +92 -0
- package/dist/components/GroupedTabs/GroupedTabs.js.map +1 -0
- package/dist/components/GroupedTabs/index.d.ts +2 -0
- package/dist/components/GroupedTabs/index.js +2 -0
- package/dist/components/HoverCard.d.ts +4 -0
- package/dist/components/HoverCard.js +34 -0
- package/dist/components/HoverCard.js.map +1 -0
- package/dist/components/Icon/Icon.d.ts +25 -0
- package/dist/components/Icon/Icon.js +57 -0
- package/dist/components/Icon/Icon.js.map +1 -0
- package/dist/components/Icon/index.d.ts +2 -0
- package/dist/components/Icon/index.js +2 -0
- package/dist/components/IconButton/IconButton.d.ts +35 -0
- package/dist/components/IconButton/IconButton.js +73 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/IconButton/index.d.ts +2 -0
- package/dist/components/IconButton/index.js +2 -0
- package/dist/components/Input/Input.d.ts +72 -0
- package/dist/components/Input/Input.js +221 -0
- package/dist/components/Input/Input.js.map +1 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Input/inputStyles.d.ts +28 -0
- package/dist/components/Input/inputStyles.js +45 -0
- package/dist/components/Input/inputStyles.js.map +1 -0
- package/dist/components/Kbd/Kbd.d.ts +15 -0
- package/dist/components/Kbd/Kbd.js +30 -0
- package/dist/components/Kbd/Kbd.js.map +1 -0
- package/dist/components/Kbd/index.d.ts +2 -0
- package/dist/components/Kbd/index.js +2 -0
- package/dist/components/LineChart/LineChart.d.ts +8 -0
- package/dist/components/LineChart/LineChart.js +194 -0
- package/dist/components/LineChart/LineChart.js.map +1 -0
- package/dist/components/LineChart/LineChart.types.d.ts +138 -0
- package/dist/components/LineChart/LineChart.types.js +0 -0
- package/dist/components/LineChart/LineChart.utils.d.ts +29 -0
- package/dist/components/LineChart/LineChart.utils.js +123 -0
- package/dist/components/LineChart/LineChart.utils.js.map +1 -0
- package/dist/components/LineChart/LineChartPlot.d.ts +43 -0
- package/dist/components/LineChart/LineChartPlot.js +306 -0
- package/dist/components/LineChart/LineChartPlot.js.map +1 -0
- package/dist/components/LineChart/constants.d.ts +3 -0
- package/dist/components/LineChart/constants.js +8 -0
- package/dist/components/LineChart/constants.js.map +1 -0
- package/dist/components/LineChart/index.d.ts +2 -0
- package/dist/components/LineChart/index.js +2 -0
- package/dist/components/LinearProgress/LinearProgress.d.ts +16 -0
- package/dist/components/LinearProgress/LinearProgress.js +42 -0
- package/dist/components/LinearProgress/LinearProgress.js.map +1 -0
- package/dist/components/LinearProgress/index.d.ts +2 -0
- package/dist/components/LinearProgress/index.js +2 -0
- package/dist/components/Link/Link.d.ts +30 -0
- package/dist/components/Link/Link.js +51 -0
- package/dist/components/Link/Link.js.map +1 -0
- package/dist/components/Link/index.d.ts +2 -0
- package/dist/components/Link/index.js +2 -0
- package/dist/components/Logo/index.d.ts +17 -0
- package/dist/components/Logo/index.js +705 -0
- package/dist/components/Logo/index.js.map +1 -0
- package/dist/components/MetricChart/MetricChart.d.ts +9 -0
- package/dist/components/MetricChart/MetricChart.js +42 -0
- package/dist/components/MetricChart/MetricChart.js.map +1 -0
- package/dist/components/MetricChart/formatters.d.ts +18 -0
- package/dist/components/MetricChart/formatters.js +34 -0
- package/dist/components/MetricChart/formatters.js.map +1 -0
- package/dist/components/MetricChart/index.d.ts +4 -0
- package/dist/components/MetricChart/index.js +3 -0
- package/dist/components/Pane/Pane.d.ts +29 -0
- package/dist/components/Pane/Pane.js +171 -0
- package/dist/components/Pane/Pane.js.map +1 -0
- package/dist/components/Pane/Pane.utils.d.ts +10 -0
- package/dist/components/Pane/Pane.utils.js +7 -0
- package/dist/components/Pane/Pane.utils.js.map +1 -0
- package/dist/components/Pane/index.d.ts +3 -0
- package/dist/components/Pane/index.js +3 -0
- package/dist/components/PlainTextEditor/hooks/useResizeTextEditor.d.ts +9 -0
- package/dist/components/PlainTextEditor/hooks/useResizeTextEditor.js +76 -0
- package/dist/components/PlainTextEditor/hooks/useResizeTextEditor.js.map +1 -0
- package/dist/components/PlainTextEditor/index.d.ts +18 -0
- package/dist/components/PlainTextEditor/index.js +71 -0
- package/dist/components/PlainTextEditor/index.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +13 -0
- package/dist/components/Popover/Popover.js +48 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/Popover/constants.d.ts +1 -0
- package/dist/components/Popover/constants.js +6 -0
- package/dist/components/Popover/constants.js.map +1 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/Popover/index.js +2 -0
- package/dist/components/PortalSlot.d.ts +11 -0
- package/dist/components/PortalSlot.js +41 -0
- package/dist/components/PortalSlot.js.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +38 -0
- package/dist/components/ProgressBar/ProgressBar.js +82 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/components/ProgressBar/index.d.ts +2 -0
- package/dist/components/ProgressBar/index.js +2 -0
- package/dist/components/RadioButton/RadioButton.d.ts +62 -0
- package/dist/components/RadioButton/RadioButton.js +38 -0
- package/dist/components/RadioButton/RadioButton.js.map +1 -0
- package/dist/components/RadioButton/constants.d.ts +30 -0
- package/dist/components/RadioButton/constants.js +55 -0
- package/dist/components/RadioButton/constants.js.map +1 -0
- package/dist/components/RadioButton/index.d.ts +2 -0
- package/dist/components/RadioButton/index.js +2 -0
- package/dist/components/RadioCard/RadioCard.d.ts +26 -0
- package/dist/components/RadioCard/RadioCard.js +43 -0
- package/dist/components/RadioCard/RadioCard.js.map +1 -0
- package/dist/components/RadioCard/index.d.ts +2 -0
- package/dist/components/RadioCard/index.js +2 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +5 -0
- package/dist/components/RadioGroup/RadioGroup.js +17 -0
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/components/RadioGroup/RadioGroupItem.d.ts +5 -0
- package/dist/components/RadioGroup/RadioGroupItem.js +22 -0
- package/dist/components/RadioGroup/RadioGroupItem.js.map +1 -0
- package/dist/components/RadioGroup/index.d.ts +4 -0
- package/dist/components/RadioGroup/index.js +3 -0
- package/dist/components/Select/Select.d.ts +84 -0
- package/dist/components/Select/Select.js +120 -0
- package/dist/components/Select/Select.js.map +1 -0
- package/dist/components/Select/SelectPrimitive.d.ts +17 -0
- package/dist/components/Select/SelectPrimitive.js +126 -0
- package/dist/components/Select/SelectPrimitive.js.map +1 -0
- package/dist/components/Select/index.d.ts +4 -0
- package/dist/components/Select/index.js +3 -0
- package/dist/components/Skeleton/Skeleton.d.ts +13 -0
- package/dist/components/Skeleton/Skeleton.js +25 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Skeleton/index.js +2 -0
- package/dist/components/Slider/Slider.d.ts +33 -0
- package/dist/components/Slider/Slider.js +64 -0
- package/dist/components/Slider/Slider.js.map +1 -0
- package/dist/components/Slider/index.d.ts +2 -0
- package/dist/components/Slider/index.js +2 -0
- package/dist/components/SparkLineChart/SparkLineChart.d.ts +14 -0
- package/dist/components/SparkLineChart/SparkLineChart.js +112 -0
- package/dist/components/SparkLineChart/SparkLineChart.js.map +1 -0
- package/dist/components/SparkLineChart/index.d.ts +2 -0
- package/dist/components/SparkLineChart/index.js +2 -0
- package/dist/components/Spinner/Spinner.d.ts +12 -0
- package/dist/components/Spinner/Spinner.js +33 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Spinner/index.js +2 -0
- package/dist/components/SplitViewPane/SplitViewPane.d.ts +41 -0
- package/dist/components/SplitViewPane/SplitViewPane.js +314 -0
- package/dist/components/SplitViewPane/SplitViewPane.js.map +1 -0
- package/dist/components/SplitViewPane/SplitViewPaneHeader.d.ts +22 -0
- package/dist/components/SplitViewPane/SplitViewPaneHeader.js +105 -0
- package/dist/components/SplitViewPane/SplitViewPaneHeader.js.map +1 -0
- package/dist/components/SplitViewPane/index.d.ts +2 -0
- package/dist/components/SplitViewPane/index.js +3 -0
- package/dist/components/SplitViewPane/openPaneRegistry.d.ts +2 -0
- package/dist/components/SplitViewPane/openPaneRegistry.js +49 -0
- package/dist/components/SplitViewPane/openPaneRegistry.js.map +1 -0
- package/dist/components/Switch/Switch.d.ts +35 -0
- package/dist/components/Switch/Switch.js +65 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Tabs/index.d.ts +27 -0
- package/dist/components/Tabs/index.js +45 -0
- package/dist/components/Tabs/index.js.map +1 -0
- package/dist/components/Text/Text.d.ts +13 -0
- package/dist/components/Text/Text.js +58 -0
- package/dist/components/Text/Text.js.map +1 -0
- package/dist/components/Text/index.d.ts +2 -0
- package/dist/components/Text/index.js +2 -0
- package/dist/components/TextVirtualizer.d.ts +8 -0
- package/dist/components/TextVirtualizer.js +53 -0
- package/dist/components/TextVirtualizer.js.map +1 -0
- package/dist/components/TextWithLinks.d.ts +6 -0
- package/dist/components/TextWithLinks.js +61 -0
- package/dist/components/TextWithLinks.js.map +1 -0
- package/dist/components/Textarea/Textarea.d.ts +47 -0
- package/dist/components/Textarea/Textarea.js +150 -0
- package/dist/components/Textarea/Textarea.js.map +1 -0
- package/dist/components/Textarea/index.d.ts +2 -0
- package/dist/components/Textarea/index.js +2 -0
- package/dist/components/ThinkingState/LoadingIndicator.d.ts +19 -0
- package/dist/components/ThinkingState/LoadingIndicator.js +2 -0
- package/dist/components/ThinkingState/NOTICE +25 -0
- package/dist/components/ThinkingState/ThinkingState.d.ts +21 -0
- package/dist/components/ThinkingState/ThinkingState.js +42 -0
- package/dist/components/ThinkingState/ThinkingState.js.map +1 -0
- package/dist/components/ThinkingState/ThinkingStateTimer.d.ts +9 -0
- package/dist/components/ThinkingState/ThinkingStateTimer.js +43 -0
- package/dist/components/ThinkingState/ThinkingStateTimer.js.map +1 -0
- package/dist/components/ThinkingState/index.d.ts +4 -0
- package/dist/components/ThinkingState/index.js +3 -0
- package/dist/components/Toast/ToastContext.d.ts +5 -0
- package/dist/components/Toast/ToastContext.js +9 -0
- package/dist/components/Toast/ToastContext.js.map +1 -0
- package/dist/components/Toast/index.d.ts +13 -0
- package/dist/components/Toast/index.js +166 -0
- package/dist/components/Toast/index.js.map +1 -0
- package/dist/components/Toast/useToast.d.ts +3 -0
- package/dist/components/Toast/useToast.js +11 -0
- package/dist/components/Toast/useToast.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +19 -0
- package/dist/components/Tooltip/Tooltip.js +57 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/components/Tooltip/index.js +3 -0
- package/dist/components/TopList/TopList.d.ts +3 -0
- package/dist/components/TopList/TopList.js +186 -0
- package/dist/components/TopList/TopList.js.map +1 -0
- package/dist/components/TopList/TopList.types.d.ts +34 -0
- package/dist/components/TopList/TopList.types.js +0 -0
- package/dist/components/TopList/TopList.utils.d.ts +3 -0
- package/dist/components/TopList/TopList.utils.js +16 -0
- package/dist/components/TopList/TopList.utils.js.map +1 -0
- package/dist/components/TopList/index.d.ts +2 -0
- package/dist/components/TopList/index.js +2 -0
- package/dist/components/Typeahead/Typeahead.d.ts +5 -0
- package/dist/components/Typeahead/Typeahead.js +305 -0
- package/dist/components/Typeahead/Typeahead.js.map +1 -0
- package/dist/components/Typeahead/Typeahead.types.d.ts +99 -0
- package/dist/components/Typeahead/Typeahead.types.js +0 -0
- package/dist/components/Typeahead/Typeahead.utils.d.ts +25 -0
- package/dist/components/Typeahead/Typeahead.utils.js +73 -0
- package/dist/components/Typeahead/Typeahead.utils.js.map +1 -0
- package/dist/components/Typeahead/TypeaheadParts.d.ts +25 -0
- package/dist/components/Typeahead/TypeaheadParts.js +109 -0
- package/dist/components/Typeahead/TypeaheadParts.js.map +1 -0
- package/dist/components/Typeahead/TypeaheadView.d.ts +81 -0
- package/dist/components/Typeahead/TypeaheadView.js +228 -0
- package/dist/components/Typeahead/TypeaheadView.js.map +1 -0
- package/dist/components/Typeahead/index.d.ts +2 -0
- package/dist/components/Typeahead/index.js +2 -0
- package/dist/components/Typeahead/useTypeaheadDomSync.d.ts +15 -0
- package/dist/components/Typeahead/useTypeaheadDomSync.js +43 -0
- package/dist/components/Typeahead/useTypeaheadDomSync.js.map +1 -0
- package/dist/components/Typeahead/useTypeaheadUncontrolledInput.d.ts +11 -0
- package/dist/components/Typeahead/useTypeaheadUncontrolledInput.js +32 -0
- package/dist/components/Typeahead/useTypeaheadUncontrolledInput.js.map +1 -0
- package/dist/components/UnsavedChangesDialog.d.ts +14 -0
- package/dist/components/UnsavedChangesDialog.js +67 -0
- package/dist/components/UnsavedChangesDialog.js.map +1 -0
- package/dist/components/index.d.ts +58 -0
- package/dist/components/index.js +35 -0
- package/dist/components.css +102 -0
- package/dist/contexts/ErrorReporterContext.d.ts +6 -0
- package/dist/contexts/ErrorReporterContext.js +7 -0
- package/dist/contexts/ErrorReporterContext.js.map +1 -0
- package/dist/hooks/AppThemeProvider.d.ts +8 -0
- package/dist/hooks/AppThemeProvider.js +52 -0
- package/dist/hooks/AppThemeProvider.js.map +1 -0
- package/dist/hooks/useColorScheme.d.ts +20 -0
- package/dist/hooks/useColorScheme.js +50 -0
- package/dist/hooks/useColorScheme.js.map +1 -0
- package/dist/icons/LongTailPhosphorIcons.d.ts +51 -0
- package/dist/icons/LongTailPhosphorIcons.js +102 -0
- package/dist/icons/LongTailPhosphorIcons.js.map +1 -0
- package/dist/icons/PaddedPhosphorIcons.d.ts +17 -0
- package/dist/icons/PaddedPhosphorIcons.js +55 -0
- package/dist/icons/PaddedPhosphorIcons.js.map +1 -0
- package/dist/icons/WeightedPhosphorIcons.d.ts +45 -0
- package/dist/icons/WeightedPhosphorIcons.js +96 -0
- package/dist/icons/WeightedPhosphorIcons.js.map +1 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +36 -0
- package/dist/styles.css +10 -0
- package/dist/utilities.css +2 -0
- package/dist/utils/VirtuosoCustomScrollParentContext/index.d.ts +7 -0
- package/dist/utils/VirtuosoCustomScrollParentContext/index.js +15 -0
- package/dist/utils/VirtuosoCustomScrollParentContext/index.js.map +1 -0
- package/dist/utils/VirtuosoCustomScrollParentContext/useScrollParent.d.ts +4 -0
- package/dist/utils/VirtuosoCustomScrollParentContext/useScrollParent.js +10 -0
- package/dist/utils/VirtuosoCustomScrollParentContext/useScrollParent.js.map +1 -0
- package/dist/utils/ZIndexContext.d.ts +5 -0
- package/dist/utils/ZIndexContext.js +13 -0
- package/dist/utils/ZIndexContext.js.map +1 -0
- package/dist/utils/animation.d.ts +37 -0
- package/dist/utils/animation.js +42 -0
- package/dist/utils/animation.js.map +1 -0
- package/dist/utils/chartAxisLayout.d.ts +6 -0
- package/dist/utils/chartAxisLayout.js +8 -0
- package/dist/utils/chartAxisLayout.js.map +1 -0
- package/dist/utils/chartColors.d.ts +38 -0
- package/dist/utils/chartColors.js +78 -0
- package/dist/utils/chartColors.js.map +1 -0
- package/dist/utils/chartConstants.d.ts +10 -0
- package/dist/utils/chartConstants.js +15 -0
- package/dist/utils/chartConstants.js.map +1 -0
- package/dist/utils/chartValues.d.ts +2 -0
- package/dist/utils/chartValues.js +36 -0
- package/dist/utils/chartValues.js.map +1 -0
- package/dist/utils/clamp.d.ts +2 -0
- package/dist/utils/clamp.js +7 -0
- package/dist/utils/clamp.js.map +1 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +191 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/componentSizes.d.ts +104 -0
- package/dist/utils/componentSizes.js +104 -0
- package/dist/utils/componentSizes.js.map +1 -0
- package/dist/utils/controlIconSizes.d.ts +10 -0
- package/dist/utils/controlIconSizes.js +32 -0
- package/dist/utils/controlIconSizes.js.map +1 -0
- package/dist/utils/csp-nonce.d.ts +11 -0
- package/dist/utils/csp-nonce.js +17 -0
- package/dist/utils/csp-nonce.js.map +1 -0
- package/dist/utils/get-closest-scroll-parent.d.ts +1 -0
- package/dist/utils/get-closest-scroll-parent.js +16 -0
- package/dist/utils/get-closest-scroll-parent.js.map +1 -0
- package/dist/utils/get-color-by-string.d.ts +1 -0
- package/dist/utils/get-color-by-string.js +10 -0
- package/dist/utils/get-color-by-string.js.map +1 -0
- package/dist/utils/getYAxisLeftMargin.d.ts +10 -0
- package/dist/utils/getYAxisLeftMargin.js +20 -0
- package/dist/utils/getYAxisLeftMargin.js.map +1 -0
- package/dist/utils/icon-types.d.ts +8 -0
- package/dist/utils/icon-types.js +0 -0
- package/dist/utils/lazy-codemirror-loader.d.ts +70 -0
- package/dist/utils/lazy-codemirror-loader.js +79 -0
- package/dist/utils/lazy-codemirror-loader.js.map +1 -0
- package/dist/utils/merge-refs.d.ts +2 -0
- package/dist/utils/merge-refs.js +13 -0
- package/dist/utils/merge-refs.js.map +1 -0
- package/dist/utils/parseTextLinks.d.ts +7 -0
- package/dist/utils/parseTextLinks.js +46 -0
- package/dist/utils/parseTextLinks.js.map +1 -0
- package/dist/utils/prettify-error-payload.d.ts +7 -0
- package/dist/utils/prettify-error-payload.js +188 -0
- package/dist/utils/prettify-error-payload.js.map +1 -0
- package/dist/utils/spacing.d.ts +30 -0
- package/dist/utils/spacing.js +34 -0
- package/dist/utils/spacing.js.map +1 -0
- package/dist/utils/useCodeMirror.d.ts +7 -0
- package/dist/utils/useCodeMirror.js +28 -0
- package/dist/utils/useCodeMirror.js.map +1 -0
- package/dist/utils/useZIndex.d.ts +52 -0
- package/dist/utils/useZIndex.js +62 -0
- package/dist/utils/useZIndex.js.map +1 -0
- package/dist/utils/zIndices.d.ts +42 -0
- package/dist/utils/zIndices.js +46 -0
- package/dist/utils/zIndices.js.map +1 -0
- package/docs/DESIGN.md +134 -0
- package/docs/STYLES.md +568 -0
- package/package.json +619 -0
- package/tailwind.preset.cjs +738 -0
- package/tailwind.preset.d.cts +5 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
//#region packages/components/src/utils/prettify-error-payload.ts
|
|
2
|
+
var MAX_INPUT_LENGTH = 5e4;
|
|
3
|
+
var MAX_UNESCAPE_PASSES = 6;
|
|
4
|
+
var OPEN_BRACKETS = /* @__PURE__ */ new Set([
|
|
5
|
+
"{",
|
|
6
|
+
"[",
|
|
7
|
+
"("
|
|
8
|
+
]);
|
|
9
|
+
var CLOSE_BRACKETS = /* @__PURE__ */ new Set([
|
|
10
|
+
"}",
|
|
11
|
+
"]",
|
|
12
|
+
")"
|
|
13
|
+
]);
|
|
14
|
+
var STRUCTURAL = /["'{[(]/;
|
|
15
|
+
var ESCAPE_REPLACEMENTS = {
|
|
16
|
+
n: "\n",
|
|
17
|
+
r: "\r",
|
|
18
|
+
t: " ",
|
|
19
|
+
"\\": "\\",
|
|
20
|
+
"'": "'",
|
|
21
|
+
"\"": "\""
|
|
22
|
+
};
|
|
23
|
+
var TRACEBACK_HEADER = "Traceback (most recent call last):";
|
|
24
|
+
var ESCAPED_NEWLINE = /\\n/g;
|
|
25
|
+
var isWhitespace = (ch) => ch === " " || ch === " " || ch === "\n" || ch === "\r";
|
|
26
|
+
/**
|
|
27
|
+
* Reads the quoted literal starting at `i`, returning it verbatim (delimiters
|
|
28
|
+
* and backslash escapes included) and the index just past the closing quote.
|
|
29
|
+
* An unterminated literal reads to end-of-input; characters are never dropped.
|
|
30
|
+
*/
|
|
31
|
+
var readStringLiteral = (input, i) => {
|
|
32
|
+
const quote = input[i];
|
|
33
|
+
let literal = quote;
|
|
34
|
+
let j = i + 1;
|
|
35
|
+
while (j < input.length) {
|
|
36
|
+
const ch = input[j];
|
|
37
|
+
if (ch === "\\") {
|
|
38
|
+
literal += ch + (input[j + 1] ?? "");
|
|
39
|
+
j += 2;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
literal += ch;
|
|
43
|
+
j += 1;
|
|
44
|
+
if (ch === quote) break;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
literal,
|
|
48
|
+
next: j
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Maps each opening-bracket index to whether it should expand onto multiple
|
|
53
|
+
* lines. A bracket expands only when its contents contain a string literal or
|
|
54
|
+
* a nested bracket, so casual prose parentheses ("failed (status 500)") stay
|
|
55
|
+
* inline.
|
|
56
|
+
*/
|
|
57
|
+
var computeExpandMap = (input) => {
|
|
58
|
+
const expand = /* @__PURE__ */ new Map();
|
|
59
|
+
const stack = [];
|
|
60
|
+
let i = 0;
|
|
61
|
+
while (i < input.length) {
|
|
62
|
+
const ch = input[i];
|
|
63
|
+
if (ch === "\"" || ch === "'") {
|
|
64
|
+
if (stack.length > 0) stack[stack.length - 1].hasSignal = true;
|
|
65
|
+
i = readStringLiteral(input, i).next;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (OPEN_BRACKETS.has(ch)) {
|
|
69
|
+
if (stack.length > 0) stack[stack.length - 1].hasSignal = true;
|
|
70
|
+
stack.push({
|
|
71
|
+
index: i,
|
|
72
|
+
hasSignal: false
|
|
73
|
+
});
|
|
74
|
+
i += 1;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (CLOSE_BRACKETS.has(ch)) {
|
|
78
|
+
const frame = stack.pop();
|
|
79
|
+
if (frame !== void 0) expand.set(frame.index, frame.hasSignal);
|
|
80
|
+
i += 1;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
i += 1;
|
|
84
|
+
}
|
|
85
|
+
return expand;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Decodes `\n`, `\r`, `\t`, `\\`, `\'`, and `\"` so escaped payloads render
|
|
89
|
+
* readably, repeating while the result still looks structured. Unknown escapes
|
|
90
|
+
* (e.g. `\x41`) are left intact.
|
|
91
|
+
*
|
|
92
|
+
* `preserveQuote` leaves that one quote escaped, so unwrapping a literal's body
|
|
93
|
+
* cannot produce a doubled delimiter (`''hi''` instead of `'hi'`).
|
|
94
|
+
*/
|
|
95
|
+
var decodeEscapedBody = (text, preserveQuote) => {
|
|
96
|
+
let prev = text;
|
|
97
|
+
for (let pass = 0; pass < MAX_UNESCAPE_PASSES; pass += 1) {
|
|
98
|
+
const next = prev.replace(/\\(.)/g, (match, ch) => ch === preserveQuote ? match : ESCAPE_REPLACEMENTS[ch] ?? match);
|
|
99
|
+
if (next === prev) break;
|
|
100
|
+
prev = next;
|
|
101
|
+
if (!STRUCTURAL.test(prev)) break;
|
|
102
|
+
}
|
|
103
|
+
return prev;
|
|
104
|
+
};
|
|
105
|
+
var decodeStringLiteral = (literal) => {
|
|
106
|
+
if (!literal.includes("\\")) return literal;
|
|
107
|
+
const quote = literal[0];
|
|
108
|
+
const hasClosingQuote = literal.length > 1 && literal.endsWith(quote);
|
|
109
|
+
const bodyEnd = hasClosingQuote ? literal.length - 1 : literal.length;
|
|
110
|
+
return quote + decodeEscapedBody(literal.slice(1, bodyEnd), quote) + (hasClosingQuote ? quote : "");
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* True when an entire multi-line traceback arrived as one escaped line, rather
|
|
114
|
+
* than as structured data that merely contains escaped newlines in its own
|
|
115
|
+
* string values (those go through the per-literal decode below).
|
|
116
|
+
*/
|
|
117
|
+
var looksFullyEscaped = (input) => {
|
|
118
|
+
if (input.includes("\n")) return false;
|
|
119
|
+
if (!input.includes(TRACEBACK_HEADER)) return false;
|
|
120
|
+
const matches = input.match(ESCAPED_NEWLINE);
|
|
121
|
+
return matches != null && matches.length >= 2;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Re-indents data structures embedded in an error string so dense single-line
|
|
125
|
+
* dumps (Python `repr()`, JSON, stringified dicts) become readable, decoding
|
|
126
|
+
* backslash escapes inside string literals along the way. Plain prose and
|
|
127
|
+
* inputs with nothing structural are returned unchanged.
|
|
128
|
+
*/
|
|
129
|
+
var prettifyErrorPayload = (input, indentUnit = " ") => {
|
|
130
|
+
if (input.length > MAX_INPUT_LENGTH) return input;
|
|
131
|
+
if (looksFullyEscaped(input)) {
|
|
132
|
+
const decoded = decodeEscapedBody(input);
|
|
133
|
+
if (decoded !== input) return decoded;
|
|
134
|
+
}
|
|
135
|
+
if (!STRUCTURAL.test(input)) return input;
|
|
136
|
+
const expand = computeExpandMap(input);
|
|
137
|
+
if (expand.size === 0) return input;
|
|
138
|
+
let out = "";
|
|
139
|
+
let depth = 0;
|
|
140
|
+
let i = 0;
|
|
141
|
+
const expanded = [];
|
|
142
|
+
const newline = () => {
|
|
143
|
+
let end = out.length;
|
|
144
|
+
while (end > 0 && (out[end - 1] === " " || out[end - 1] === " ")) end -= 1;
|
|
145
|
+
out = out.slice(0, end) + "\n" + indentUnit.repeat(depth);
|
|
146
|
+
};
|
|
147
|
+
const skipWhitespace = () => {
|
|
148
|
+
while (i < input.length && isWhitespace(input[i])) i += 1;
|
|
149
|
+
};
|
|
150
|
+
while (i < input.length) {
|
|
151
|
+
const ch = input[i];
|
|
152
|
+
if (ch === "\"" || ch === "'") {
|
|
153
|
+
const { literal, next } = readStringLiteral(input, i);
|
|
154
|
+
out += decodeStringLiteral(literal);
|
|
155
|
+
i = next;
|
|
156
|
+
} else if (OPEN_BRACKETS.has(ch)) {
|
|
157
|
+
const doExpand = expand.get(i) ?? false;
|
|
158
|
+
expanded.push(doExpand);
|
|
159
|
+
out += ch;
|
|
160
|
+
i += 1;
|
|
161
|
+
if (doExpand) {
|
|
162
|
+
depth += 1;
|
|
163
|
+
newline();
|
|
164
|
+
skipWhitespace();
|
|
165
|
+
}
|
|
166
|
+
} else if (CLOSE_BRACKETS.has(ch)) {
|
|
167
|
+
if (expanded.pop() ?? false) {
|
|
168
|
+
depth -= 1;
|
|
169
|
+
newline();
|
|
170
|
+
}
|
|
171
|
+
out += ch;
|
|
172
|
+
i += 1;
|
|
173
|
+
} else if (ch === "," && (expanded[expanded.length - 1] ?? false)) {
|
|
174
|
+
out += ch;
|
|
175
|
+
i += 1;
|
|
176
|
+
newline();
|
|
177
|
+
skipWhitespace();
|
|
178
|
+
} else {
|
|
179
|
+
out += ch;
|
|
180
|
+
i += 1;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return out;
|
|
184
|
+
};
|
|
185
|
+
//#endregion
|
|
186
|
+
export { prettifyErrorPayload };
|
|
187
|
+
|
|
188
|
+
//# sourceMappingURL=prettify-error-payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prettify-error-payload.js","names":[],"sources":["../../src/utils/prettify-error-payload.ts"],"sourcesContent":["// Above this size we skip formatting to avoid event-loop stalls.\nconst MAX_INPUT_LENGTH = 50_000;\n\n// Error payloads are often re-`repr()`'d a few times.\nconst MAX_UNESCAPE_PASSES = 6;\n\nconst OPEN_BRACKETS = new Set(['{', '[', '(']);\nconst CLOSE_BRACKETS = new Set(['}', ']', ')']);\nconst STRUCTURAL = /[\"'{[(]/;\n\nconst ESCAPE_REPLACEMENTS: Record<string, string> = {\n n: '\\n',\n r: '\\r',\n t: '\\t',\n '\\\\': '\\\\',\n \"'\": \"'\",\n '\"': '\"',\n};\n\n// CPython opens every formatted traceback with this exact line.\nconst TRACEBACK_HEADER = 'Traceback (most recent call last):';\nconst ESCAPED_NEWLINE = /\\\\n/g;\n\nconst isWhitespace = (ch: string): boolean =>\n ch === ' ' || ch === '\\t' || ch === '\\n' || ch === '\\r';\n\n/**\n * Reads the quoted literal starting at `i`, returning it verbatim (delimiters\n * and backslash escapes included) and the index just past the closing quote.\n * An unterminated literal reads to end-of-input; characters are never dropped.\n */\nconst readStringLiteral = (\n input: string,\n i: number\n): { literal: string; next: number } => {\n const quote = input[i];\n let literal = quote;\n let j = i + 1;\n while (j < input.length) {\n const ch = input[j];\n if (ch === '\\\\') {\n literal += ch + (input[j + 1] ?? '');\n j += 2;\n continue;\n }\n literal += ch;\n j += 1;\n if (ch === quote) break;\n }\n return { literal, next: j };\n};\n\n/**\n * Maps each opening-bracket index to whether it should expand onto multiple\n * lines. A bracket expands only when its contents contain a string literal or\n * a nested bracket, so casual prose parentheses (\"failed (status 500)\") stay\n * inline.\n */\nconst computeExpandMap = (input: string): Map<number, boolean> => {\n const expand = new Map<number, boolean>();\n const stack: { index: number; hasSignal: boolean }[] = [];\n let i = 0;\n while (i < input.length) {\n const ch = input[i];\n if (ch === '\"' || ch === \"'\") {\n if (stack.length > 0) stack[stack.length - 1].hasSignal = true;\n i = readStringLiteral(input, i).next;\n continue;\n }\n if (OPEN_BRACKETS.has(ch)) {\n if (stack.length > 0) stack[stack.length - 1].hasSignal = true;\n stack.push({ index: i, hasSignal: false });\n i += 1;\n continue;\n }\n if (CLOSE_BRACKETS.has(ch)) {\n const frame = stack.pop();\n if (frame !== undefined) expand.set(frame.index, frame.hasSignal);\n i += 1;\n continue;\n }\n i += 1;\n }\n return expand;\n};\n\n/**\n * Decodes `\\n`, `\\r`, `\\t`, `\\\\`, `\\'`, and `\\\"` so escaped payloads render\n * readably, repeating while the result still looks structured. Unknown escapes\n * (e.g. `\\x41`) are left intact.\n *\n * `preserveQuote` leaves that one quote escaped, so unwrapping a literal's body\n * cannot produce a doubled delimiter (`''hi''` instead of `'hi'`).\n */\nconst decodeEscapedBody = (text: string, preserveQuote?: string): string => {\n let prev = text;\n for (let pass = 0; pass < MAX_UNESCAPE_PASSES; pass += 1) {\n const next = prev.replace(/\\\\(.)/g, (match, ch: string) =>\n ch === preserveQuote ? match : (ESCAPE_REPLACEMENTS[ch] ?? match)\n );\n if (next === prev) break;\n prev = next;\n if (!STRUCTURAL.test(prev)) break;\n }\n return prev;\n};\n\nconst decodeStringLiteral = (literal: string): string => {\n if (!literal.includes('\\\\')) return literal;\n const quote = literal[0];\n const hasClosingQuote = literal.length > 1 && literal.endsWith(quote);\n const bodyEnd = hasClosingQuote ? literal.length - 1 : literal.length;\n const body = literal.slice(1, bodyEnd);\n return (\n quote + decodeEscapedBody(body, quote) + (hasClosingQuote ? quote : '')\n );\n};\n\n/**\n * True when an entire multi-line traceback arrived as one escaped line, rather\n * than as structured data that merely contains escaped newlines in its own\n * string values (those go through the per-literal decode below).\n */\nconst looksFullyEscaped = (input: string): boolean => {\n if (input.includes('\\n')) return false;\n if (!input.includes(TRACEBACK_HEADER)) return false;\n const matches = input.match(ESCAPED_NEWLINE);\n return matches != null && matches.length >= 2;\n};\n\n/**\n * Re-indents data structures embedded in an error string so dense single-line\n * dumps (Python `repr()`, JSON, stringified dicts) become readable, decoding\n * backslash escapes inside string literals along the way. Plain prose and\n * inputs with nothing structural are returned unchanged.\n */\nexport const prettifyErrorPayload = (\n input: string,\n indentUnit = ' '\n): string => {\n if (input.length > MAX_INPUT_LENGTH) return input;\n\n if (looksFullyEscaped(input)) {\n // Decoding restores the traceback's own line breaks.\n const decoded = decodeEscapedBody(input);\n if (decoded !== input) return decoded;\n }\n\n if (!STRUCTURAL.test(input)) return input;\n\n const expand = computeExpandMap(input);\n if (expand.size === 0) return input;\n\n let out = '';\n let depth = 0;\n let i = 0;\n const expanded: boolean[] = [];\n\n const newline = () => {\n // Drop the trailing whitespace run only, to stay O(1) amortized.\n let end = out.length;\n while (end > 0 && (out[end - 1] === ' ' || out[end - 1] === '\\t')) end -= 1;\n out = out.slice(0, end) + '\\n' + indentUnit.repeat(depth);\n };\n\n const skipWhitespace = () => {\n while (i < input.length && isWhitespace(input[i])) i += 1;\n };\n\n while (i < input.length) {\n const ch = input[i];\n\n if (ch === '\"' || ch === \"'\") {\n const { literal, next } = readStringLiteral(input, i);\n out += decodeStringLiteral(literal);\n i = next;\n } else if (OPEN_BRACKETS.has(ch)) {\n const doExpand = expand.get(i) ?? false;\n expanded.push(doExpand);\n out += ch;\n i += 1;\n if (doExpand) {\n depth += 1;\n newline();\n skipWhitespace();\n }\n } else if (CLOSE_BRACKETS.has(ch)) {\n if (expanded.pop() ?? false) {\n depth -= 1;\n newline();\n }\n out += ch;\n i += 1;\n } else if (ch === ',' && (expanded[expanded.length - 1] ?? false)) {\n out += ch;\n i += 1;\n newline();\n skipWhitespace();\n } else {\n out += ch;\n i += 1;\n }\n }\n\n return out;\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 4-point spacing scale (`space-1` … `space-9`).
|
|
3
|
+
*
|
|
4
|
+
* For guidelines on how to use, refer to Storybook:
|
|
5
|
+
* https://langsmith-design-system.vercel.app/?path=/story/foundations-spacing--scale-and-guidelines
|
|
6
|
+
*
|
|
7
|
+
* The scale is surfaced as additive Tailwind utilities via
|
|
8
|
+
* `tailwind.preset.cjs`, so it is used through the property prefix:
|
|
9
|
+
* `gap-space-4`, `px-space-6`, `mt-space-2`, etc.
|
|
10
|
+
* The px mapping mirrors Radix
|
|
11
|
+
* Themes spacing (https://www.radix-ui.com/themes/docs/theme/spacing).
|
|
12
|
+
*
|
|
13
|
+
* This module is the single source of truth. Keep it in sync with
|
|
14
|
+
* `tailwind.preset.cjs` (theme.extend.spacing `space-*` keys).
|
|
15
|
+
*/
|
|
16
|
+
/** Step → pixel value. The step is an ordinal index, not the px value. */
|
|
17
|
+
export declare const SPACE_SCALE_PX: {
|
|
18
|
+
readonly 1: 4;
|
|
19
|
+
readonly 2: 8;
|
|
20
|
+
readonly 3: 12;
|
|
21
|
+
readonly 4: 16;
|
|
22
|
+
readonly 5: 24;
|
|
23
|
+
readonly 6: 32;
|
|
24
|
+
readonly 7: 40;
|
|
25
|
+
readonly 8: 48;
|
|
26
|
+
readonly 9: 64;
|
|
27
|
+
};
|
|
28
|
+
export type SpaceStep = keyof typeof SPACE_SCALE_PX;
|
|
29
|
+
/** Ordered list of steps, e.g. for rendering the scale. */
|
|
30
|
+
export declare const SPACE_STEPS: (1 | 2 | 3 | 4 | 5 | 6 | 8 | 7 | 9)[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region packages/components/src/utils/spacing.ts
|
|
2
|
+
/**
|
|
3
|
+
* 4-point spacing scale (`space-1` … `space-9`).
|
|
4
|
+
*
|
|
5
|
+
* For guidelines on how to use, refer to Storybook:
|
|
6
|
+
* https://langsmith-design-system.vercel.app/?path=/story/foundations-spacing--scale-and-guidelines
|
|
7
|
+
*
|
|
8
|
+
* The scale is surfaced as additive Tailwind utilities via
|
|
9
|
+
* `tailwind.preset.cjs`, so it is used through the property prefix:
|
|
10
|
+
* `gap-space-4`, `px-space-6`, `mt-space-2`, etc.
|
|
11
|
+
* The px mapping mirrors Radix
|
|
12
|
+
* Themes spacing (https://www.radix-ui.com/themes/docs/theme/spacing).
|
|
13
|
+
*
|
|
14
|
+
* This module is the single source of truth. Keep it in sync with
|
|
15
|
+
* `tailwind.preset.cjs` (theme.extend.spacing `space-*` keys).
|
|
16
|
+
*/
|
|
17
|
+
/** Step → pixel value. The step is an ordinal index, not the px value. */
|
|
18
|
+
var SPACE_SCALE_PX = {
|
|
19
|
+
1: 4,
|
|
20
|
+
2: 8,
|
|
21
|
+
3: 12,
|
|
22
|
+
4: 16,
|
|
23
|
+
5: 24,
|
|
24
|
+
6: 32,
|
|
25
|
+
7: 40,
|
|
26
|
+
8: 48,
|
|
27
|
+
9: 64
|
|
28
|
+
};
|
|
29
|
+
/** Ordered list of steps, e.g. for rendering the scale. */
|
|
30
|
+
var SPACE_STEPS = Object.keys(SPACE_SCALE_PX).map((step) => Number(step));
|
|
31
|
+
//#endregion
|
|
32
|
+
export { SPACE_SCALE_PX, SPACE_STEPS };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=spacing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spacing.js","names":[],"sources":["../../src/utils/spacing.ts"],"sourcesContent":["/**\n * 4-point spacing scale (`space-1` … `space-9`).\n *\n * For guidelines on how to use, refer to Storybook:\n * https://langsmith-design-system.vercel.app/?path=/story/foundations-spacing--scale-and-guidelines\n *\n * The scale is surfaced as additive Tailwind utilities via\n * `tailwind.preset.cjs`, so it is used through the property prefix:\n * `gap-space-4`, `px-space-6`, `mt-space-2`, etc.\n * The px mapping mirrors Radix\n * Themes spacing (https://www.radix-ui.com/themes/docs/theme/spacing).\n *\n * This module is the single source of truth. Keep it in sync with\n * `tailwind.preset.cjs` (theme.extend.spacing `space-*` keys).\n */\n\n/** Step → pixel value. The step is an ordinal index, not the px value. */\nexport const SPACE_SCALE_PX = {\n 1: 4,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 24,\n 6: 32,\n 7: 40,\n 8: 48,\n 9: 64,\n} as const;\n\nexport type SpaceStep = keyof typeof SPACE_SCALE_PX;\n\n/** Ordered list of steps, e.g. for rendering the scale. */\nexport const SPACE_STEPS = Object.keys(SPACE_SCALE_PX).map(\n (step) => Number(step) as SpaceStep\n);\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,IAAa,iBAAiB;CAC5B,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;AACL;;AAKA,IAAa,cAAc,OAAO,KAAK,cAAc,CAAC,CAAC,KACpD,SAAS,OAAO,IAAI,CACvB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CMBundle } from './lazy-codemirror-loader.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the CodeMirror bundle once loaded, or null if still loading.
|
|
4
|
+
* Initializes synchronously from cache if CM was already loaded (no flicker
|
|
5
|
+
* on subsequent mounts after the first load).
|
|
6
|
+
*/
|
|
7
|
+
export declare function useCodeMirror(): CMBundle | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getCodeMirror, loadCodeMirror } from "./lazy-codemirror-loader.js";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
//#region packages/components/src/utils/useCodeMirror.ts
|
|
4
|
+
/**
|
|
5
|
+
* Returns the CodeMirror bundle once loaded, or null if still loading.
|
|
6
|
+
* Initializes synchronously from cache if CM was already loaded (no flicker
|
|
7
|
+
* on subsequent mounts after the first load).
|
|
8
|
+
*/
|
|
9
|
+
function useCodeMirror() {
|
|
10
|
+
const [cm, setCm] = useState(() => getCodeMirror());
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (cm) return;
|
|
13
|
+
let cancelled = false;
|
|
14
|
+
loadCodeMirror().then((loaded) => {
|
|
15
|
+
if (!cancelled) setCm(loaded);
|
|
16
|
+
}).catch((err) => {
|
|
17
|
+
if (!cancelled) console.error("Failed to load CodeMirror:", err);
|
|
18
|
+
});
|
|
19
|
+
return () => {
|
|
20
|
+
cancelled = true;
|
|
21
|
+
};
|
|
22
|
+
}, [cm]);
|
|
23
|
+
return cm;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { useCodeMirror };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=useCodeMirror.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCodeMirror.js","names":[],"sources":["../../src/utils/useCodeMirror.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport {\n type CMBundle,\n getCodeMirror,\n loadCodeMirror,\n} from './lazy-codemirror-loader';\n\n/**\n * Returns the CodeMirror bundle once loaded, or null if still loading.\n * Initializes synchronously from cache if CM was already loaded (no flicker\n * on subsequent mounts after the first load).\n */\nexport function useCodeMirror(): CMBundle | null {\n const [cm, setCm] = useState<CMBundle | null>(() => getCodeMirror());\n\n useEffect(() => {\n if (cm) return;\n\n let cancelled = false;\n\n loadCodeMirror()\n .then((loaded) => {\n if (!cancelled) setCm(loaded);\n })\n .catch((err) => {\n if (!cancelled) {\n console.error('Failed to load CodeMirror:', err);\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [cm]);\n\n return cm;\n}\n"],"mappings":";;;;;;;;AAaA,SAAgB,gBAAiC;CAC/C,MAAM,CAAC,IAAI,SAAS,eAAgC,cAAc,CAAC;CAEnE,gBAAgB;EACd,IAAI,IAAI;EAER,IAAI,YAAY;EAEhB,eAAe,CAAC,CACb,MAAM,WAAW;GAChB,IAAI,CAAC,WAAW,MAAM,MAAM;EAC9B,CAAC,CAAC,CACD,OAAO,QAAQ;GACd,IAAI,CAAC,WACH,QAAQ,MAAM,8BAA8B,GAAG;EAEnD,CAAC;EAEH,aAAa;GACX,YAAY;EACd;CACF,GAAG,CAAC,EAAE,CAAC;CAEP,OAAO;AACT"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks the z-index of the nearest portal-rendered ancestor (pane, dialog,
|
|
3
|
+
* popover, etc.). Defaults to zIndices.content (0) when there is no ancestor.
|
|
4
|
+
*
|
|
5
|
+
* Consumers should never read this context directly. Use useZIndex() instead.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ZIndexContext: import("react").Context<number>;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the z-index a portal-rendered overlay should use so that it always
|
|
10
|
+
* stacks above its nearest ancestor overlay, regardless of nesting depth.
|
|
11
|
+
*
|
|
12
|
+
* Portal-rendered elements (popovers, dropdowns, dialogs) escape the DOM tree
|
|
13
|
+
* and render at the document body, so their z-index competes globally. Without
|
|
14
|
+
* coordination a dropdown inside a modal can render behind it if the dropdown's
|
|
15
|
+
* default z-index is lower than the modal's.
|
|
16
|
+
*
|
|
17
|
+
* useZIndex solves this with Math.max(defaultZIndex, contextZIndex + 1):
|
|
18
|
+
* - At the root (no ancestor): uses defaultZIndex, the semantic floor that
|
|
19
|
+
* guarantees the overlay beats all page layout (e.g. popover always >= 1300).
|
|
20
|
+
* - Inside an ancestor overlay: ignores defaultZIndex and uses contextZIndex + 1
|
|
21
|
+
* instead, ensuring it always renders ab ove the parent regardless of the
|
|
22
|
+
* parent's absolute value.
|
|
23
|
+
*
|
|
24
|
+
* After calling useZIndex, the component must:
|
|
25
|
+
* 1. Apply the returned value as style={{ zIndex }} on the portaled element.
|
|
26
|
+
* 2. Wrap its children in <ZIndexProvider value={zIndex}> so that any further
|
|
27
|
+
* nested overlays can repeat the same calculation relative to this layer.
|
|
28
|
+
*
|
|
29
|
+
* Note: Tooltips do NOT use useZIndex — they have no semantic floor and always
|
|
30
|
+
* render at contextZIndex + 1 directly, since they only need to appear above
|
|
31
|
+
* whatever triggered them.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* function MyPopover({ children }) {
|
|
36
|
+
* const zIndex = useZIndex(zIndices.popover);
|
|
37
|
+
* return (
|
|
38
|
+
* <Portal>
|
|
39
|
+
* <Content style={{ zIndex }}>
|
|
40
|
+
* <ZIndexProvider value={zIndex}>
|
|
41
|
+
* {children}
|
|
42
|
+
* </ZIndexProvider>
|
|
43
|
+
* </Content>
|
|
44
|
+
* </Portal>
|
|
45
|
+
* );
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @param defaultZIndex - The semantic floor for this overlay type (e.g. zIndices.popover).
|
|
50
|
+
* @returns The z-index to apply — either the floor or contextZIndex + 1, whichever is higher.
|
|
51
|
+
*/
|
|
52
|
+
export declare function useZIndex(defaultZIndex: number): number;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import zIndices from "./zIndices.js";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
//#region packages/components/src/utils/useZIndex.ts
|
|
4
|
+
/**
|
|
5
|
+
* Tracks the z-index of the nearest portal-rendered ancestor (pane, dialog,
|
|
6
|
+
* popover, etc.). Defaults to zIndices.content (0) when there is no ancestor.
|
|
7
|
+
*
|
|
8
|
+
* Consumers should never read this context directly. Use useZIndex() instead.
|
|
9
|
+
*/
|
|
10
|
+
var ZIndexContext = createContext(zIndices.content);
|
|
11
|
+
/**
|
|
12
|
+
* Returns the z-index a portal-rendered overlay should use so that it always
|
|
13
|
+
* stacks above its nearest ancestor overlay, regardless of nesting depth.
|
|
14
|
+
*
|
|
15
|
+
* Portal-rendered elements (popovers, dropdowns, dialogs) escape the DOM tree
|
|
16
|
+
* and render at the document body, so their z-index competes globally. Without
|
|
17
|
+
* coordination a dropdown inside a modal can render behind it if the dropdown's
|
|
18
|
+
* default z-index is lower than the modal's.
|
|
19
|
+
*
|
|
20
|
+
* useZIndex solves this with Math.max(defaultZIndex, contextZIndex + 1):
|
|
21
|
+
* - At the root (no ancestor): uses defaultZIndex, the semantic floor that
|
|
22
|
+
* guarantees the overlay beats all page layout (e.g. popover always >= 1300).
|
|
23
|
+
* - Inside an ancestor overlay: ignores defaultZIndex and uses contextZIndex + 1
|
|
24
|
+
* instead, ensuring it always renders ab ove the parent regardless of the
|
|
25
|
+
* parent's absolute value.
|
|
26
|
+
*
|
|
27
|
+
* After calling useZIndex, the component must:
|
|
28
|
+
* 1. Apply the returned value as style={{ zIndex }} on the portaled element.
|
|
29
|
+
* 2. Wrap its children in <ZIndexProvider value={zIndex}> so that any further
|
|
30
|
+
* nested overlays can repeat the same calculation relative to this layer.
|
|
31
|
+
*
|
|
32
|
+
* Note: Tooltips do NOT use useZIndex — they have no semantic floor and always
|
|
33
|
+
* render at contextZIndex + 1 directly, since they only need to appear above
|
|
34
|
+
* whatever triggered them.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* function MyPopover({ children }) {
|
|
39
|
+
* const zIndex = useZIndex(zIndices.popover);
|
|
40
|
+
* return (
|
|
41
|
+
* <Portal>
|
|
42
|
+
* <Content style={{ zIndex }}>
|
|
43
|
+
* <ZIndexProvider value={zIndex}>
|
|
44
|
+
* {children}
|
|
45
|
+
* </ZIndexProvider>
|
|
46
|
+
* </Content>
|
|
47
|
+
* </Portal>
|
|
48
|
+
* );
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @param defaultZIndex - The semantic floor for this overlay type (e.g. zIndices.popover).
|
|
53
|
+
* @returns The z-index to apply — either the floor or contextZIndex + 1, whichever is higher.
|
|
54
|
+
*/
|
|
55
|
+
function useZIndex(defaultZIndex) {
|
|
56
|
+
const contextZIndex = useContext(ZIndexContext);
|
|
57
|
+
return Math.max(defaultZIndex, contextZIndex + 1);
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { ZIndexContext, useZIndex };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=useZIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useZIndex.js","names":[],"sources":["../../src/utils/useZIndex.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nimport zIndices from './zIndices';\n\n/**\n * Tracks the z-index of the nearest portal-rendered ancestor (pane, dialog,\n * popover, etc.). Defaults to zIndices.content (0) when there is no ancestor.\n *\n * Consumers should never read this context directly. Use useZIndex() instead.\n */\nexport const ZIndexContext = createContext<number>(zIndices.content);\n\n/**\n * Returns the z-index a portal-rendered overlay should use so that it always\n * stacks above its nearest ancestor overlay, regardless of nesting depth.\n *\n * Portal-rendered elements (popovers, dropdowns, dialogs) escape the DOM tree\n * and render at the document body, so their z-index competes globally. Without\n * coordination a dropdown inside a modal can render behind it if the dropdown's\n * default z-index is lower than the modal's.\n *\n * useZIndex solves this with Math.max(defaultZIndex, contextZIndex + 1):\n * - At the root (no ancestor): uses defaultZIndex, the semantic floor that\n * guarantees the overlay beats all page layout (e.g. popover always >= 1300).\n * - Inside an ancestor overlay: ignores defaultZIndex and uses contextZIndex + 1\n * instead, ensuring it always renders ab ove the parent regardless of the\n * parent's absolute value.\n *\n * After calling useZIndex, the component must:\n * 1. Apply the returned value as style={{ zIndex }} on the portaled element.\n * 2. Wrap its children in <ZIndexProvider value={zIndex}> so that any further\n * nested overlays can repeat the same calculation relative to this layer.\n *\n * Note: Tooltips do NOT use useZIndex — they have no semantic floor and always\n * render at contextZIndex + 1 directly, since they only need to appear above\n * whatever triggered them.\n *\n * @example\n * ```tsx\n * function MyPopover({ children }) {\n * const zIndex = useZIndex(zIndices.popover);\n * return (\n * <Portal>\n * <Content style={{ zIndex }}>\n * <ZIndexProvider value={zIndex}>\n * {children}\n * </ZIndexProvider>\n * </Content>\n * </Portal>\n * );\n * }\n * ```\n *\n * @param defaultZIndex - The semantic floor for this overlay type (e.g. zIndices.popover).\n * @returns The z-index to apply — either the floor or contextZIndex + 1, whichever is higher.\n */\nexport function useZIndex(defaultZIndex: number): number {\n const contextZIndex = useContext(ZIndexContext);\n return Math.max(defaultZIndex, contextZIndex + 1);\n}\n"],"mappings":";;;;;;;;;AAUA,IAAa,gBAAgB,cAAsB,SAAS,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CnE,SAAgB,UAAU,eAA+B;CACvD,MAAM,gBAAgB,WAAW,aAAa;CAC9C,OAAO,KAAK,IAAI,eAAe,gBAAgB,CAAC;AAClD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized z-index values for the application.
|
|
3
|
+
*
|
|
4
|
+
* This file defines all z-index values used throughout the app to ensure
|
|
5
|
+
* proper stacking order and avoid conflicts.
|
|
6
|
+
*
|
|
7
|
+
* Z-index layers (from lowest to highest):
|
|
8
|
+
* - Content (0): Natural CSS baseline — regular content, sticky headers
|
|
9
|
+
* - Navigation (1): Resize handles, floating bars
|
|
10
|
+
* - Layout (2): Sidebar, overlays
|
|
11
|
+
* - Grid interaction (4-5): Drag/resize overlays, sticky page headers
|
|
12
|
+
* - Pane (500): Side panes
|
|
13
|
+
* - Popover (1000+): Popovers, dropdowns — large intentional jump to guarantee
|
|
14
|
+
* portal-rendered overlays always beat any page layout complexity
|
|
15
|
+
* - Modal (2000+): Modal dialogs
|
|
16
|
+
* - Toast (9999): System toasts
|
|
17
|
+
*
|
|
18
|
+
* Note: Tooltips do NOT have a fixed z-index here. They always render at
|
|
19
|
+
* contextZIndex + 1 (relative to their parent caller) via ZIndexContext,
|
|
20
|
+
* so they naturally stack above whichever layer triggered them.
|
|
21
|
+
*/
|
|
22
|
+
declare const zIndices: {
|
|
23
|
+
readonly content: 0;
|
|
24
|
+
readonly stickyHeader: 1;
|
|
25
|
+
readonly tableStickyCell: 1;
|
|
26
|
+
readonly tableStickyHeader: 3;
|
|
27
|
+
readonly paneHeader: 4;
|
|
28
|
+
readonly dragOverlay: 4;
|
|
29
|
+
readonly dashboardHeader: 5;
|
|
30
|
+
readonly floatingBar: 2;
|
|
31
|
+
readonly resizeHandle: 2;
|
|
32
|
+
readonly sidebar: 5;
|
|
33
|
+
readonly tooltip: 6;
|
|
34
|
+
readonly selectionActionBar: 12;
|
|
35
|
+
readonly pane: 500;
|
|
36
|
+
readonly popover: 1300;
|
|
37
|
+
readonly devToolPanel: 2500;
|
|
38
|
+
readonly dialogOverlay: 2999;
|
|
39
|
+
readonly dialogContent: 3000;
|
|
40
|
+
readonly toast: 9999;
|
|
41
|
+
};
|
|
42
|
+
export default zIndices;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region packages/components/src/utils/zIndices.ts
|
|
2
|
+
/**
|
|
3
|
+
* Centralized z-index values for the application.
|
|
4
|
+
*
|
|
5
|
+
* This file defines all z-index values used throughout the app to ensure
|
|
6
|
+
* proper stacking order and avoid conflicts.
|
|
7
|
+
*
|
|
8
|
+
* Z-index layers (from lowest to highest):
|
|
9
|
+
* - Content (0): Natural CSS baseline — regular content, sticky headers
|
|
10
|
+
* - Navigation (1): Resize handles, floating bars
|
|
11
|
+
* - Layout (2): Sidebar, overlays
|
|
12
|
+
* - Grid interaction (4-5): Drag/resize overlays, sticky page headers
|
|
13
|
+
* - Pane (500): Side panes
|
|
14
|
+
* - Popover (1000+): Popovers, dropdowns — large intentional jump to guarantee
|
|
15
|
+
* portal-rendered overlays always beat any page layout complexity
|
|
16
|
+
* - Modal (2000+): Modal dialogs
|
|
17
|
+
* - Toast (9999): System toasts
|
|
18
|
+
*
|
|
19
|
+
* Note: Tooltips do NOT have a fixed z-index here. They always render at
|
|
20
|
+
* contextZIndex + 1 (relative to their parent caller) via ZIndexContext,
|
|
21
|
+
* so they naturally stack above whichever layer triggered them.
|
|
22
|
+
*/
|
|
23
|
+
var zIndices = {
|
|
24
|
+
content: 0,
|
|
25
|
+
stickyHeader: 1,
|
|
26
|
+
tableStickyCell: 1,
|
|
27
|
+
tableStickyHeader: 3,
|
|
28
|
+
paneHeader: 4,
|
|
29
|
+
dragOverlay: 4,
|
|
30
|
+
dashboardHeader: 5,
|
|
31
|
+
floatingBar: 2,
|
|
32
|
+
resizeHandle: 2,
|
|
33
|
+
sidebar: 5,
|
|
34
|
+
tooltip: 6,
|
|
35
|
+
selectionActionBar: 12,
|
|
36
|
+
pane: 500,
|
|
37
|
+
popover: 1300,
|
|
38
|
+
devToolPanel: 2500,
|
|
39
|
+
dialogOverlay: 2999,
|
|
40
|
+
dialogContent: 3e3,
|
|
41
|
+
toast: 9999
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { zIndices as default };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=zIndices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zIndices.js","names":[],"sources":["../../src/utils/zIndices.ts"],"sourcesContent":["/**\n * Centralized z-index values for the application.\n *\n * This file defines all z-index values used throughout the app to ensure\n * proper stacking order and avoid conflicts.\n *\n * Z-index layers (from lowest to highest):\n * - Content (0): Natural CSS baseline — regular content, sticky headers\n * - Navigation (1): Resize handles, floating bars\n * - Layout (2): Sidebar, overlays\n * - Grid interaction (4-5): Drag/resize overlays, sticky page headers\n * - Pane (500): Side panes\n * - Popover (1000+): Popovers, dropdowns — large intentional jump to guarantee\n * portal-rendered overlays always beat any page layout complexity\n * - Modal (2000+): Modal dialogs\n * - Toast (9999): System toasts\n *\n * Note: Tooltips do NOT have a fixed z-index here. They always render at\n * contextZIndex + 1 (relative to their parent caller) via ZIndexContext,\n * so they naturally stack above whichever layer triggered them.\n */\n\nconst zIndices = {\n // Content layer\n content: 0,\n stickyHeader: 1,\n tableStickyCell: 1, // Sticky table columns — above non-sticky cells (auto)\n tableStickyHeader: 3, // Sticky table header — above rows and sticky columns\n paneHeader: 4, // Above a scrolled table's sticky header\n dragOverlay: 4, // Grid drag/resize overlays — above sticky table headers (3)\n dashboardHeader: 5, // Sticky page header — above drag overlays, below tooltips\n floatingBar: 2,\n resizeHandle: 2, // Higher than sticky header to ensure it's always interactive\n\n // Layout layer (this is arbitrarily 5 to give a few layers above the content layer)\n sidebar: 5,\n\n tooltip: 6,\n\n selectionActionBar: 12, // Selection bars — above page headers and their tooltips\n\n // Pane layer\n pane: 500,\n\n // Popover layer — large jump ensures portal overlays always beat page layout\n popover: 1300,\n\n // Dev tool panels (e.g. Eppo control panel) — above popovers/Polly, below dialogs\n devToolPanel: 2500,\n\n dialogOverlay: 2999,\n dialogContent: 3000,\n\n // System toasts — above dialogs, but bounded so nested items(e.g., button labels) can overlay\n toast: 9999,\n} as const;\n\nexport default zIndices;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAM,WAAW;CAEf,SAAS;CACT,cAAc;CACd,iBAAiB;CACjB,mBAAmB;CACnB,YAAY;CACZ,aAAa;CACb,iBAAiB;CACjB,aAAa;CACb,cAAc;CAGd,SAAS;CAET,SAAS;CAET,oBAAoB;CAGpB,MAAM;CAGN,SAAS;CAGT,cAAc;CAEd,eAAe;CACf,eAAe;CAGf,OAAO;AACT"}
|