@astryxdesign/lab 0.0.0-bootstrap.0 → 0.1.2-canary.04e71b2
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/CHANGELOG.md +67 -0
- package/LICENSE +21 -0
- package/README.md +47 -1
- package/dist/Chart/Chart.d.ts +77 -0
- package/dist/Chart/Chart.d.ts.map +1 -0
- package/dist/Chart/Chart.js +247 -0
- package/dist/Chart/ChartArea.d.ts +28 -0
- package/dist/Chart/ChartArea.d.ts.map +1 -0
- package/dist/Chart/ChartArea.js +71 -0
- package/dist/Chart/ChartAxis.d.ts +27 -0
- package/dist/Chart/ChartAxis.d.ts.map +1 -0
- package/dist/Chart/ChartAxis.js +147 -0
- package/dist/Chart/ChartBar.d.ts +19 -0
- package/dist/Chart/ChartBar.d.ts.map +1 -0
- package/dist/Chart/ChartBar.js +61 -0
- package/dist/Chart/ChartBrush.d.ts +59 -0
- package/dist/Chart/ChartBrush.d.ts.map +1 -0
- package/dist/Chart/ChartBrush.js +197 -0
- package/dist/Chart/ChartCandlestick.d.ts +50 -0
- package/dist/Chart/ChartCandlestick.d.ts.map +1 -0
- package/dist/Chart/ChartCandlestick.js +138 -0
- package/dist/Chart/ChartContext.d.ts +5 -0
- package/dist/Chart/ChartContext.d.ts.map +1 -0
- package/dist/Chart/ChartContext.js +20 -0
- package/dist/Chart/ChartDot.d.ts +18 -0
- package/dist/Chart/ChartDot.d.ts.map +1 -0
- package/dist/Chart/ChartDot.js +43 -0
- package/dist/Chart/ChartDotGL.d.ts +16 -0
- package/dist/Chart/ChartDotGL.d.ts.map +1 -0
- package/dist/Chart/ChartDotGL.js +135 -0
- package/dist/Chart/ChartDotGLInteractive.d.ts +41 -0
- package/dist/Chart/ChartDotGLInteractive.d.ts.map +1 -0
- package/dist/Chart/ChartDotGLInteractive.js +446 -0
- package/dist/Chart/ChartErrorBar.d.ts +23 -0
- package/dist/Chart/ChartErrorBar.d.ts.map +1 -0
- package/dist/Chart/ChartErrorBar.js +68 -0
- package/dist/Chart/ChartGrid.d.ts +17 -0
- package/dist/Chart/ChartGrid.d.ts.map +1 -0
- package/dist/Chart/ChartGrid.js +67 -0
- package/dist/Chart/ChartHeatmapGL.d.ts +10 -0
- package/dist/Chart/ChartHeatmapGL.d.ts.map +1 -0
- package/dist/Chart/ChartHeatmapGL.js +171 -0
- package/dist/Chart/ChartLegend.d.ts +60 -0
- package/dist/Chart/ChartLegend.d.ts.map +1 -0
- package/dist/Chart/ChartLegend.js +161 -0
- package/dist/Chart/ChartLine.d.ts +23 -0
- package/dist/Chart/ChartLine.d.ts.map +1 -0
- package/dist/Chart/ChartLine.js +64 -0
- package/dist/Chart/ChartReferenceLine.d.ts +11 -0
- package/dist/Chart/ChartReferenceLine.d.ts.map +1 -0
- package/dist/Chart/ChartReferenceLine.js +109 -0
- package/dist/Chart/ChartSelect.d.ts +9 -0
- package/dist/Chart/ChartSelect.d.ts.map +1 -0
- package/dist/Chart/ChartSelect.js +90 -0
- package/dist/Chart/ChartStreamGL.d.ts +17 -0
- package/dist/Chart/ChartStreamGL.d.ts.map +1 -0
- package/dist/Chart/ChartStreamGL.js +157 -0
- package/dist/Chart/ChartTooltip.d.ts +85 -0
- package/dist/Chart/ChartTooltip.d.ts.map +1 -0
- package/dist/Chart/ChartTooltip.js +335 -0
- package/dist/Chart/ChartZoom.d.ts +23 -0
- package/dist/Chart/ChartZoom.d.ts.map +1 -0
- package/dist/Chart/ChartZoom.js +314 -0
- package/dist/Chart/formatters.d.ts +33 -0
- package/dist/Chart/formatters.d.ts.map +1 -0
- package/dist/Chart/formatters.js +101 -0
- package/dist/Chart/getChartColors.d.ts +56 -0
- package/dist/Chart/getChartColors.d.ts.map +1 -0
- package/dist/Chart/getChartColors.js +150 -0
- package/dist/Chart/index.d.ts +29 -0
- package/dist/Chart/index.d.ts.map +1 -0
- package/dist/Chart/index.js +29 -0
- package/dist/Chart/m4.d.ts +36 -0
- package/dist/Chart/m4.d.ts.map +1 -0
- package/dist/Chart/m4.js +106 -0
- package/dist/Chart/types.d.ts +55 -0
- package/dist/Chart/types.d.ts.map +1 -0
- package/dist/Chart/types.js +1 -0
- package/dist/Chart/useChartColors.d.ts +16 -0
- package/dist/Chart/useChartColors.d.ts.map +1 -0
- package/dist/Chart/useChartColors.js +30 -0
- package/dist/Chart/useChartRange.d.ts +50 -0
- package/dist/Chart/useChartRange.d.ts.map +1 -0
- package/dist/Chart/useChartRange.js +90 -0
- package/dist/Chart/utils.d.ts +15 -0
- package/dist/Chart/utils.d.ts.map +1 -0
- package/dist/Chart/utils.js +24 -0
- package/dist/Chart/webgl.d.ts +62 -0
- package/dist/Chart/webgl.d.ts.map +1 -0
- package/dist/Chart/webgl.js +169 -0
- package/dist/ChartV2/Chart.d.ts +32 -0
- package/dist/ChartV2/Chart.d.ts.map +1 -0
- package/dist/ChartV2/Chart.js +281 -0
- package/dist/ChartV2/ChartAxis.d.ts +36 -0
- package/dist/ChartV2/ChartAxis.d.ts.map +1 -0
- package/dist/ChartV2/ChartAxis.js +161 -0
- package/dist/ChartV2/ChartGrid.d.ts +20 -0
- package/dist/ChartV2/ChartGrid.d.ts.map +1 -0
- package/dist/ChartV2/ChartGrid.js +76 -0
- package/dist/ChartV2/ChartLegend.d.ts +14 -0
- package/dist/ChartV2/ChartLegend.d.ts.map +1 -0
- package/dist/ChartV2/ChartLegend.js +54 -0
- package/dist/ChartV2/ChartSwatch.d.ts +36 -0
- package/dist/ChartV2/ChartSwatch.d.ts.map +1 -0
- package/dist/ChartV2/ChartSwatch.js +82 -0
- package/dist/ChartV2/ChartTooltip.d.ts +46 -0
- package/dist/ChartV2/ChartTooltip.d.ts.map +1 -0
- package/dist/ChartV2/ChartTooltip.js +267 -0
- package/dist/ChartV2/ChartV2Context.d.ts +4 -0
- package/dist/ChartV2/ChartV2Context.d.ts.map +1 -0
- package/dist/ChartV2/ChartV2Context.js +12 -0
- package/dist/ChartV2/index.d.ts +13 -0
- package/dist/ChartV2/index.d.ts.map +1 -0
- package/dist/ChartV2/index.js +10 -0
- package/dist/ChartV2/layout.d.ts +25 -0
- package/dist/ChartV2/layout.d.ts.map +1 -0
- package/dist/ChartV2/layout.js +195 -0
- package/dist/ChartV2/legend.d.ts +18 -0
- package/dist/ChartV2/legend.d.ts.map +1 -0
- package/dist/ChartV2/legend.js +24 -0
- package/dist/ChartV2/marks/area.d.ts +19 -0
- package/dist/ChartV2/marks/area.d.ts.map +1 -0
- package/dist/ChartV2/marks/area.js +109 -0
- package/dist/ChartV2/marks/band.d.ts +9 -0
- package/dist/ChartV2/marks/band.d.ts.map +1 -0
- package/dist/ChartV2/marks/band.js +59 -0
- package/dist/ChartV2/marks/bar.d.ts +17 -0
- package/dist/ChartV2/marks/bar.d.ts.map +1 -0
- package/dist/ChartV2/marks/bar.js +120 -0
- package/dist/ChartV2/marks/candlestick.d.ts +15 -0
- package/dist/ChartV2/marks/candlestick.d.ts.map +1 -0
- package/dist/ChartV2/marks/candlestick.js +83 -0
- package/dist/ChartV2/marks/dot.d.ts +15 -0
- package/dist/ChartV2/marks/dot.d.ts.map +1 -0
- package/dist/ChartV2/marks/dot.js +65 -0
- package/dist/ChartV2/marks/dotGL.d.ts +16 -0
- package/dist/ChartV2/marks/dotGL.d.ts.map +1 -0
- package/dist/ChartV2/marks/dotGL.js +178 -0
- package/dist/ChartV2/marks/dotGLInteractive.d.ts +30 -0
- package/dist/ChartV2/marks/dotGLInteractive.d.ts.map +1 -0
- package/dist/ChartV2/marks/dotGLInteractive.js +464 -0
- package/dist/ChartV2/marks/errorBar.d.ts +27 -0
- package/dist/ChartV2/marks/errorBar.d.ts.map +1 -0
- package/dist/ChartV2/marks/errorBar.js +87 -0
- package/dist/ChartV2/marks/heatmapGL.d.ts +23 -0
- package/dist/ChartV2/marks/heatmapGL.d.ts.map +1 -0
- package/dist/ChartV2/marks/heatmapGL.js +242 -0
- package/dist/ChartV2/marks/index.d.ts +13 -0
- package/dist/ChartV2/marks/index.d.ts.map +1 -0
- package/dist/ChartV2/marks/index.js +14 -0
- package/dist/ChartV2/marks/line.d.ts +18 -0
- package/dist/ChartV2/marks/line.d.ts.map +1 -0
- package/dist/ChartV2/marks/line.js +76 -0
- package/dist/ChartV2/marks/referenceLine.d.ts +35 -0
- package/dist/ChartV2/marks/referenceLine.d.ts.map +1 -0
- package/dist/ChartV2/marks/referenceLine.js +186 -0
- package/dist/ChartV2/marks/streamGL.d.ts +36 -0
- package/dist/ChartV2/marks/streamGL.d.ts.map +1 -0
- package/dist/ChartV2/marks/streamGL.js +204 -0
- package/dist/ChartV2/tooltip.d.ts +38 -0
- package/dist/ChartV2/tooltip.d.ts.map +1 -0
- package/dist/ChartV2/tooltip.js +54 -0
- package/dist/ChartV2/types.d.ts +115 -0
- package/dist/ChartV2/types.d.ts.map +1 -0
- package/dist/ChartV2/types.js +35 -0
- package/dist/ChatReasoning/ChatReasoning.d.ts +51 -0
- package/dist/ChatReasoning/ChatReasoning.d.ts.map +1 -0
- package/dist/ChatReasoning/ChatReasoning.js +236 -0
- package/dist/CircularProgress/CircularProgress.d.ts +101 -0
- package/dist/CircularProgress/CircularProgress.d.ts.map +1 -0
- package/dist/CircularProgress/CircularProgress.js +263 -0
- package/dist/CircularProgress/index.d.ts +6 -0
- package/dist/CircularProgress/index.d.ts.map +1 -0
- package/dist/CircularProgress/index.js +8 -0
- package/dist/CodeBlock/index.d.ts +8 -0
- package/dist/CodeBlock/index.d.ts.map +1 -0
- package/dist/CodeBlock/index.js +9 -0
- package/dist/CodeEditor/CodeEditor.d.ts +46 -0
- package/dist/CodeEditor/CodeEditor.d.ts.map +1 -0
- package/dist/CodeEditor/CodeEditor.js +396 -0
- package/dist/CodeEditor/index.d.ts +6 -0
- package/dist/CodeEditor/index.d.ts.map +1 -0
- package/dist/CodeEditor/index.js +7 -0
- package/dist/Radial/RadialArea.d.ts +25 -0
- package/dist/Radial/RadialArea.d.ts.map +1 -0
- package/dist/Radial/RadialArea.js +91 -0
- package/dist/Radial/RadialAxis.d.ts +14 -0
- package/dist/Radial/RadialAxis.d.ts.map +1 -0
- package/dist/Radial/RadialAxis.js +55 -0
- package/dist/Radial/RadialChart.d.ts +70 -0
- package/dist/Radial/RadialChart.d.ts.map +1 -0
- package/dist/Radial/RadialChart.js +174 -0
- package/dist/Radial/RadialContext.d.ts +5 -0
- package/dist/Radial/RadialContext.d.ts.map +1 -0
- package/dist/Radial/RadialContext.js +19 -0
- package/dist/Radial/RadialGrid.d.ts +14 -0
- package/dist/Radial/RadialGrid.d.ts.map +1 -0
- package/dist/Radial/RadialGrid.js +70 -0
- package/dist/Radial/RadialSlice.d.ts +23 -0
- package/dist/Radial/RadialSlice.d.ts.map +1 -0
- package/dist/Radial/RadialSlice.js +85 -0
- package/dist/Radial/RadialTooltip.d.ts +44 -0
- package/dist/Radial/RadialTooltip.d.ts.map +1 -0
- package/dist/Radial/RadialTooltip.js +284 -0
- package/dist/Radial/index.d.ts +9 -0
- package/dist/Radial/index.d.ts.map +1 -0
- package/dist/Radial/index.js +9 -0
- package/dist/Radial/types.d.ts +39 -0
- package/dist/Radial/types.d.ts.map +1 -0
- package/dist/Radial/types.js +1 -0
- package/dist/SVGIcon/SVGIcon.d.ts +87 -0
- package/dist/SVGIcon/SVGIcon.d.ts.map +1 -0
- package/dist/SVGIcon/SVGIcon.js +299 -0
- package/dist/SVGIcon/icons.d.ts +49 -0
- package/dist/SVGIcon/icons.d.ts.map +1 -0
- package/dist/SVGIcon/icons.js +326 -0
- package/dist/SVGIcon/index.d.ts +15 -0
- package/dist/SVGIcon/index.d.ts.map +1 -0
- package/dist/SVGIcon/index.js +22 -0
- package/dist/SVGIcon/pathTransforms.d.ts +35 -0
- package/dist/SVGIcon/pathTransforms.d.ts.map +1 -0
- package/dist/SVGIcon/pathTransforms.js +644 -0
- package/dist/SVGIcon/tokens.stylex.d.ts +37 -0
- package/dist/SVGIcon/tokens.stylex.d.ts.map +1 -0
- package/dist/SVGIcon/tokens.stylex.js +40 -0
- package/dist/SVGIcon/variations.stylex.d.ts +44 -0
- package/dist/SVGIcon/variations.stylex.d.ts.map +1 -0
- package/dist/SVGIcon/variations.stylex.js +119 -0
- package/dist/SVGIcon/xif-examples.d.ts +22 -0
- package/dist/SVGIcon/xif-examples.d.ts.map +1 -0
- package/dist/SVGIcon/xif-examples.js +202 -0
- package/dist/SVGIcon/xif-types.d.ts +129 -0
- package/dist/SVGIcon/xif-types.d.ts.map +1 -0
- package/dist/SVGIcon/xif-types.js +1 -0
- package/dist/Sankey/SankeyChart.d.ts +72 -0
- package/dist/Sankey/SankeyChart.d.ts.map +1 -0
- package/dist/Sankey/SankeyChart.js +162 -0
- package/dist/Sankey/SankeyContext.d.ts +5 -0
- package/dist/Sankey/SankeyContext.d.ts.map +1 -0
- package/dist/Sankey/SankeyContext.js +20 -0
- package/dist/Sankey/SankeyGrid.d.ts +20 -0
- package/dist/Sankey/SankeyGrid.d.ts.map +1 -0
- package/dist/Sankey/SankeyGrid.js +53 -0
- package/dist/Sankey/SankeyLabel.d.ts +11 -0
- package/dist/Sankey/SankeyLabel.d.ts.map +1 -0
- package/dist/Sankey/SankeyLabel.js +179 -0
- package/dist/Sankey/SankeyLink.d.ts +29 -0
- package/dist/Sankey/SankeyLink.d.ts.map +1 -0
- package/dist/Sankey/SankeyLink.js +139 -0
- package/dist/Sankey/SankeyNode.d.ts +15 -0
- package/dist/Sankey/SankeyNode.d.ts.map +1 -0
- package/dist/Sankey/SankeyNode.js +56 -0
- package/dist/Sankey/index.d.ts +8 -0
- package/dist/Sankey/index.d.ts.map +1 -0
- package/dist/Sankey/index.js +8 -0
- package/dist/Sankey/layout.d.ts +26 -0
- package/dist/Sankey/layout.d.ts.map +1 -0
- package/dist/Sankey/layout.js +157 -0
- package/dist/Sankey/types.d.ts +84 -0
- package/dist/Sankey/types.d.ts.map +1 -0
- package/dist/Sankey/types.js +1 -0
- package/dist/Schedule/CalendarEvent.d.ts +36 -0
- package/dist/Schedule/CalendarEvent.d.ts.map +1 -0
- package/dist/Schedule/CalendarEvent.js +35 -0
- package/dist/Schedule/DayView.d.ts +8 -0
- package/dist/Schedule/DayView.d.ts.map +1 -0
- package/dist/Schedule/DayView.js +105 -0
- package/dist/Schedule/ListView.d.ts +6 -0
- package/dist/Schedule/ListView.d.ts.map +1 -0
- package/dist/Schedule/ListView.js +171 -0
- package/dist/Schedule/MonthlyView.d.ts +6 -0
- package/dist/Schedule/MonthlyView.d.ts.map +1 -0
- package/dist/Schedule/MonthlyView.js +270 -0
- package/dist/Schedule/Schedule.d.ts +22 -0
- package/dist/Schedule/Schedule.d.ts.map +1 -0
- package/dist/Schedule/Schedule.js +185 -0
- package/dist/Schedule/TimeGridView.d.ts +12 -0
- package/dist/Schedule/TimeGridView.d.ts.map +1 -0
- package/dist/Schedule/TimeGridView.js +364 -0
- package/dist/Schedule/WeeklyView.d.ts +9 -0
- package/dist/Schedule/WeeklyView.d.ts.map +1 -0
- package/dist/Schedule/WeeklyView.js +112 -0
- package/dist/Schedule/context.d.ts +20 -0
- package/dist/Schedule/context.d.ts.map +1 -0
- package/dist/Schedule/context.js +19 -0
- package/dist/Schedule/dateMath.d.ts +21 -0
- package/dist/Schedule/dateMath.d.ts.map +1 -0
- package/dist/Schedule/dateMath.js +63 -0
- package/dist/Schedule/index.d.ts +19 -0
- package/dist/Schedule/index.d.ts.map +1 -0
- package/dist/Schedule/index.js +17 -0
- package/dist/Schedule/plugins/PaginationPlugin.d.ts +7 -0
- package/dist/Schedule/plugins/PaginationPlugin.d.ts.map +1 -0
- package/dist/Schedule/plugins/PaginationPlugin.js +81 -0
- package/dist/Schedule/plugins/ViewSelectorPlugin.d.ts +11 -0
- package/dist/Schedule/plugins/ViewSelectorPlugin.d.ts.map +1 -0
- package/dist/Schedule/plugins/ViewSelectorPlugin.js +78 -0
- package/dist/Schedule/plugins/index.d.ts +5 -0
- package/dist/Schedule/plugins/index.d.ts.map +1 -0
- package/dist/Schedule/plugins/index.js +14 -0
- package/dist/Schedule/shared.d.ts +923 -0
- package/dist/Schedule/shared.d.ts.map +1 -0
- package/dist/Schedule/shared.js +1325 -0
- package/dist/Schedule/types.d.ts +51 -0
- package/dist/Schedule/types.d.ts.map +1 -0
- package/dist/Schedule/types.js +1 -0
- package/dist/Schedule/useCurrentTime.d.ts +3 -0
- package/dist/Schedule/useCurrentTime.d.ts.map +1 -0
- package/dist/Schedule/useCurrentTime.js +43 -0
- package/dist/Schedule/zonedDateTime.d.ts +20 -0
- package/dist/Schedule/zonedDateTime.d.ts.map +1 -0
- package/dist/Schedule/zonedDateTime.js +31 -0
- package/dist/Stepper/Step.d.ts +120 -0
- package/dist/Stepper/Step.d.ts.map +1 -0
- package/dist/Stepper/Step.js +573 -0
- package/dist/Stepper/StepStatus.d.ts +24 -0
- package/dist/Stepper/StepStatus.d.ts.map +1 -0
- package/dist/Stepper/StepStatus.js +1 -0
- package/dist/Stepper/Stepper.d.ts +77 -0
- package/dist/Stepper/Stepper.d.ts.map +1 -0
- package/dist/Stepper/Stepper.js +104 -0
- package/dist/Stepper/StepperContext.d.ts +12 -0
- package/dist/Stepper/StepperContext.d.ts.map +1 -0
- package/dist/Stepper/StepperContext.js +24 -0
- package/dist/Stepper/index.d.ts +8 -0
- package/dist/Stepper/index.d.ts.map +1 -0
- package/dist/Stepper/index.js +7 -0
- package/dist/ThreeD/ThreeDAxis.d.ts +6 -0
- package/dist/ThreeD/ThreeDAxis.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDAxis.js +75 -0
- package/dist/ThreeD/ThreeDBar.d.ts +7 -0
- package/dist/ThreeD/ThreeDBar.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDBar.js +98 -0
- package/dist/ThreeD/ThreeDChart.d.ts +24 -0
- package/dist/ThreeD/ThreeDChart.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDChart.js +202 -0
- package/dist/ThreeD/ThreeDContext.d.ts +5 -0
- package/dist/ThreeD/ThreeDContext.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDContext.js +19 -0
- package/dist/ThreeD/ThreeDGrid.d.ts +5 -0
- package/dist/ThreeD/ThreeDGrid.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDGrid.js +55 -0
- package/dist/ThreeD/ThreeDScatter.d.ts +7 -0
- package/dist/ThreeD/ThreeDScatter.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDScatter.js +57 -0
- package/dist/ThreeD/ThreeDScatterGL.d.ts +7 -0
- package/dist/ThreeD/ThreeDScatterGL.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDScatterGL.js +243 -0
- package/dist/ThreeD/ThreeDSurface.d.ts +15 -0
- package/dist/ThreeD/ThreeDSurface.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDSurface.js +97 -0
- package/dist/ThreeD/index.d.ts +10 -0
- package/dist/ThreeD/index.d.ts.map +1 -0
- package/dist/ThreeD/index.js +10 -0
- package/dist/ThreeD/types.d.ts +57 -0
- package/dist/ThreeD/types.d.ts.map +1 -0
- package/dist/ThreeD/types.js +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/lab.css +423 -0
- package/package.json +69 -4
- package/src/Chart/Chart.tsx +312 -0
- package/src/Chart/ChartArea.doc.mjs +16 -0
- package/src/Chart/ChartArea.tsx +91 -0
- package/src/Chart/ChartAxis.tsx +186 -0
- package/src/Chart/ChartBar.doc.mjs +16 -0
- package/src/Chart/ChartBar.tsx +71 -0
- package/src/Chart/ChartBrush.tsx +237 -0
- package/src/Chart/ChartCandlestick.doc.mjs +16 -0
- package/src/Chart/ChartCandlestick.tsx +186 -0
- package/src/Chart/ChartContext.ts +23 -0
- package/src/Chart/ChartDot.doc.mjs +16 -0
- package/src/Chart/ChartDot.tsx +44 -0
- package/src/Chart/ChartDotGL.doc.mjs +16 -0
- package/src/Chart/ChartDotGL.tsx +151 -0
- package/src/Chart/ChartDotGLInteractive.doc.mjs +16 -0
- package/src/Chart/ChartDotGLInteractive.tsx +519 -0
- package/src/Chart/ChartErrorBar.tsx +84 -0
- package/src/Chart/ChartGrid.tsx +86 -0
- package/src/Chart/ChartHeatmapGL.doc.mjs +16 -0
- package/src/Chart/ChartHeatmapGL.tsx +219 -0
- package/src/Chart/ChartLegend.tsx +181 -0
- package/src/Chart/ChartLine.doc.mjs +16 -0
- package/src/Chart/ChartLine.tsx +70 -0
- package/src/Chart/ChartReferenceLine.tsx +76 -0
- package/src/Chart/ChartSelect.tsx +111 -0
- package/src/Chart/ChartStreamGL.doc.mjs +16 -0
- package/src/Chart/ChartStreamGL.tsx +189 -0
- package/src/Chart/ChartTooltip.tsx +451 -0
- package/src/Chart/ChartZoom.tsx +400 -0
- package/src/Chart/formatters.ts +95 -0
- package/src/Chart/getChartColors.ts +249 -0
- package/src/Chart/index.ts +90 -0
- package/src/Chart/m4.test.ts +66 -0
- package/src/Chart/m4.ts +128 -0
- package/src/Chart/types.ts +64 -0
- package/src/Chart/useChartColors.ts +34 -0
- package/src/Chart/useChartRange.test.ts +101 -0
- package/src/Chart/useChartRange.ts +146 -0
- package/src/Chart/utils.ts +31 -0
- package/src/Chart/webgl.ts +192 -0
- package/src/ChartV2/Chart.tsx +348 -0
- package/src/ChartV2/ChartAxis.tsx +209 -0
- package/src/ChartV2/ChartGrid.tsx +99 -0
- package/src/ChartV2/ChartLegend.tsx +69 -0
- package/src/ChartV2/ChartSwatch.doc.mjs +17 -0
- package/src/ChartV2/ChartSwatch.tsx +86 -0
- package/src/ChartV2/ChartTooltip.tsx +382 -0
- package/src/ChartV2/ChartV2.doc.mjs +16 -0
- package/src/ChartV2/ChartV2Context.ts +15 -0
- package/src/ChartV2/index.ts +62 -0
- package/src/ChartV2/layout.ts +223 -0
- package/src/ChartV2/legend.ts +32 -0
- package/src/ChartV2/marks/area.tsx +122 -0
- package/src/ChartV2/marks/band.tsx +70 -0
- package/src/ChartV2/marks/bar.tsx +159 -0
- package/src/ChartV2/marks/candlestick.tsx +106 -0
- package/src/ChartV2/marks/dot.tsx +64 -0
- package/src/ChartV2/marks/dotGL.tsx +202 -0
- package/src/ChartV2/marks/dotGLInteractive.tsx +546 -0
- package/src/ChartV2/marks/errorBar.tsx +89 -0
- package/src/ChartV2/marks/heatmapGL.tsx +299 -0
- package/src/ChartV2/marks/index.ts +14 -0
- package/src/ChartV2/marks/line.tsx +94 -0
- package/src/ChartV2/marks/referenceLine.tsx +224 -0
- package/src/ChartV2/marks/streamGL.tsx +251 -0
- package/src/ChartV2/tooltip.ts +70 -0
- package/src/ChartV2/types.ts +129 -0
- package/src/ChatReasoning/ChatReasoning.doc.mjs +16 -0
- package/src/ChatReasoning/ChatReasoning.test.tsx +56 -0
- package/src/ChatReasoning/ChatReasoning.tsx +322 -0
- package/src/CircularProgress/CircularProgress.doc.mjs +174 -0
- package/src/CircularProgress/CircularProgress.test.tsx +157 -0
- package/src/CircularProgress/CircularProgress.tsx +373 -0
- package/src/CircularProgress/index.ts +15 -0
- package/src/CodeBlock/index.ts +10 -0
- package/src/CodeEditor/CodeEditor.doc.mjs +16 -0
- package/src/CodeEditor/CodeEditor.tsx +466 -0
- package/src/CodeEditor/index.ts +8 -0
- package/src/Radial/RadialArea.tsx +103 -0
- package/src/Radial/RadialAxis.tsx +60 -0
- package/src/Radial/RadialChart.doc.mjs +16 -0
- package/src/Radial/RadialChart.tsx +219 -0
- package/src/Radial/RadialContext.ts +22 -0
- package/src/Radial/RadialGrid.tsx +81 -0
- package/src/Radial/RadialSlice.tsx +130 -0
- package/src/Radial/RadialTooltip.tsx +347 -0
- package/src/Radial/index.ts +14 -0
- package/src/Radial/types.ts +46 -0
- package/src/SVGIcon/SVGIcon.doc.mjs +16 -0
- package/src/SVGIcon/SVGIcon.tsx +406 -0
- package/src/SVGIcon/icons.ts +283 -0
- package/src/SVGIcon/index.ts +73 -0
- package/src/SVGIcon/pathTransforms.ts +612 -0
- package/src/SVGIcon/tokens.stylex.ts +53 -0
- package/src/SVGIcon/variations.stylex.ts +122 -0
- package/src/SVGIcon/xif-examples.ts +191 -0
- package/src/SVGIcon/xif-types.ts +181 -0
- package/src/Sankey/SankeyChart.doc.mjs +16 -0
- package/src/Sankey/SankeyChart.tsx +220 -0
- package/src/Sankey/SankeyContext.ts +23 -0
- package/src/Sankey/SankeyGrid.tsx +69 -0
- package/src/Sankey/SankeyLabel.tsx +234 -0
- package/src/Sankey/SankeyLink.tsx +167 -0
- package/src/Sankey/SankeyNode.tsx +66 -0
- package/src/Sankey/index.ts +22 -0
- package/src/Sankey/layout.ts +219 -0
- package/src/Sankey/types.ts +93 -0
- package/src/Schedule/CalendarEvent.ts +74 -0
- package/src/Schedule/DayView.tsx +112 -0
- package/src/Schedule/ListView.tsx +236 -0
- package/src/Schedule/MonthlyView.tsx +401 -0
- package/src/Schedule/Schedule.doc.mjs +16 -0
- package/src/Schedule/Schedule.test.tsx +405 -0
- package/src/Schedule/Schedule.tsx +307 -0
- package/src/Schedule/TimeGridView.tsx +589 -0
- package/src/Schedule/WeeklyView.tsx +130 -0
- package/src/Schedule/context.tsx +49 -0
- package/src/Schedule/dateMath.ts +112 -0
- package/src/Schedule/index.ts +61 -0
- package/src/Schedule/plugins/PaginationPlugin.tsx +98 -0
- package/src/Schedule/plugins/ViewSelectorPlugin.tsx +128 -0
- package/src/Schedule/plugins/index.tsx +20 -0
- package/src/Schedule/shared.tsx +1304 -0
- package/src/Schedule/types.ts +86 -0
- package/src/Schedule/useCurrentTime.ts +50 -0
- package/src/Schedule/zonedDateTime.ts +71 -0
- package/src/Stepper/Step.doc.mjs +17 -0
- package/src/Stepper/Step.tsx +756 -0
- package/src/Stepper/StepStatus.ts +26 -0
- package/src/Stepper/Stepper.doc.mjs +265 -0
- package/src/Stepper/Stepper.test.tsx +281 -0
- package/src/Stepper/Stepper.tsx +157 -0
- package/src/Stepper/StepperContext.ts +43 -0
- package/src/Stepper/index.ts +14 -0
- package/src/ThreeD/3DBar.doc.mjs +16 -0
- package/src/ThreeD/3DChart.doc.mjs +16 -0
- package/src/ThreeD/3DScatter.doc.mjs +16 -0
- package/src/ThreeD/3DScatterGL.doc.mjs +16 -0
- package/src/ThreeD/3DSurface.doc.mjs +16 -0
- package/src/ThreeD/ThreeDAxis.tsx +86 -0
- package/src/ThreeD/ThreeDBar.tsx +130 -0
- package/src/ThreeD/ThreeDChart.tsx +262 -0
- package/src/ThreeD/ThreeDContext.ts +22 -0
- package/src/ThreeD/ThreeDGrid.tsx +68 -0
- package/src/ThreeD/ThreeDScatter.tsx +63 -0
- package/src/ThreeD/ThreeDScatterGL.tsx +270 -0
- package/src/ThreeD/ThreeDSurface.tsx +142 -0
- package/src/ThreeD/index.ts +11 -0
- package/src/ThreeD/projection.test.ts +132 -0
- package/src/ThreeD/types.ts +62 -0
- package/src/index.ts +250 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file ChartDotGLInteractive.tsx
|
|
5
|
+
* @output WebGL scatter with GPU color-picking for O(1) nearest-point hover detection
|
|
6
|
+
* @position Child of Chart; renders to two canvases — one visible, one offscreen pick buffer
|
|
7
|
+
*
|
|
8
|
+
* Technique: Each point is assigned a unique color encoding its index.
|
|
9
|
+
* On hover, we readPixels from the offscreen framebuffer at the cursor position
|
|
10
|
+
* and decode the index. No JS iteration over data points — hover is O(1).
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { useRef, useEffect, useCallback, useState, useMemo } from 'react';
|
|
14
|
+
import { useChart } from "./ChartContext.js";
|
|
15
|
+
import { xPixel } from "./utils.js";
|
|
16
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
function hexToGL(hex) {
|
|
18
|
+
const n = parseInt(hex.replace('#', ''), 16);
|
|
19
|
+
return [(n >> 16) / 255, (n >> 8 & 0xff) / 255, (n & 0xff) / 255];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Encode a point index as an RGB color (supports up to 16.7M points) */
|
|
23
|
+
function indexToColor(i) {
|
|
24
|
+
// Add 1 so index 0 isn't black (which is our clear color)
|
|
25
|
+
const id = i + 1;
|
|
26
|
+
return [(id >> 16 & 0xff) / 255, (id >> 8 & 0xff) / 255, (id & 0xff) / 255];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Decode an RGB pixel back to a point index. Returns -1 for background. */
|
|
30
|
+
function colorToIndex(r, g, b) {
|
|
31
|
+
if (r === 0 && g === 0 && b === 0) {
|
|
32
|
+
return -1;
|
|
33
|
+
}
|
|
34
|
+
return (r << 16 | g << 8 | b) - 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Visible pass — normal rendering
|
|
38
|
+
const VERT_VIS = `
|
|
39
|
+
attribute vec2 a_position;
|
|
40
|
+
uniform vec2 u_resolution;
|
|
41
|
+
uniform float u_size;
|
|
42
|
+
void main() {
|
|
43
|
+
vec2 clip = (a_position / u_resolution) * 2.0 - 1.0;
|
|
44
|
+
gl_Position = vec4(clip.x, -clip.y, 0.0, 1.0);
|
|
45
|
+
gl_PointSize = u_size;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
const FRAG_VIS = `
|
|
49
|
+
precision mediump float;
|
|
50
|
+
uniform vec3 u_color;
|
|
51
|
+
uniform float u_opacity;
|
|
52
|
+
void main() {
|
|
53
|
+
vec2 coord = gl_PointCoord - vec2(0.5);
|
|
54
|
+
if (dot(coord, coord) > 0.25) discard;
|
|
55
|
+
gl_FragColor = vec4(u_color, u_opacity);
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
// Pick pass — encode index as color
|
|
60
|
+
const VERT_PICK = `
|
|
61
|
+
attribute vec2 a_position;
|
|
62
|
+
attribute vec3 a_pickColor;
|
|
63
|
+
uniform vec2 u_resolution;
|
|
64
|
+
uniform float u_size;
|
|
65
|
+
varying vec3 v_pickColor;
|
|
66
|
+
void main() {
|
|
67
|
+
vec2 clip = (a_position / u_resolution) * 2.0 - 1.0;
|
|
68
|
+
gl_Position = vec4(clip.x, -clip.y, 0.0, 1.0);
|
|
69
|
+
gl_PointSize = u_size + 4.0; // slightly larger hit area
|
|
70
|
+
v_pickColor = a_pickColor;
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
const FRAG_PICK = `
|
|
74
|
+
precision mediump float;
|
|
75
|
+
varying vec3 v_pickColor;
|
|
76
|
+
void main() {
|
|
77
|
+
vec2 coord = gl_PointCoord - vec2(0.5);
|
|
78
|
+
if (dot(coord, coord) > 0.25) discard;
|
|
79
|
+
gl_FragColor = vec4(v_pickColor, 1.0);
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
82
|
+
function compileShader(gl, type, src) {
|
|
83
|
+
const s = gl.createShader(type);
|
|
84
|
+
if (!s) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
gl.shaderSource(s, src);
|
|
88
|
+
gl.compileShader(s);
|
|
89
|
+
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS)) {
|
|
90
|
+
gl.deleteShader(s);
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return s;
|
|
94
|
+
}
|
|
95
|
+
function linkProgram(gl, vert, frag) {
|
|
96
|
+
const vs = compileShader(gl, gl.VERTEX_SHADER, vert);
|
|
97
|
+
const fs = compileShader(gl, gl.FRAGMENT_SHADER, frag);
|
|
98
|
+
if (!vs || !fs) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
const p = gl.createProgram();
|
|
102
|
+
if (!p) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
gl.attachShader(p, vs);
|
|
106
|
+
gl.attachShader(p, fs);
|
|
107
|
+
gl.linkProgram(p);
|
|
108
|
+
if (!gl.getProgramParameter(p, gl.LINK_STATUS)) {
|
|
109
|
+
gl.deleteProgram(p);
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
return p;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* WebGL scatter with built-in GPU hover detection.
|
|
117
|
+
* Uses color-picking on an offscreen framebuffer — readPixels at cursor
|
|
118
|
+
* gives the hovered point index in O(1), no matter how many points.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```
|
|
122
|
+
* <ChartDotGLInteractive
|
|
123
|
+
* dataKey="value"
|
|
124
|
+
* color={useChartColors().categorical(1)[0]}
|
|
125
|
+
* renderTooltip={(d, i) => <span>Point {i}: {d.value}</span>}
|
|
126
|
+
* />
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export function ChartDotGLInteractive({
|
|
130
|
+
dataKey,
|
|
131
|
+
color,
|
|
132
|
+
size = 6,
|
|
133
|
+
opacity = 0.8,
|
|
134
|
+
renderTooltip
|
|
135
|
+
}) {
|
|
136
|
+
const {
|
|
137
|
+
data,
|
|
138
|
+
xKey,
|
|
139
|
+
xScale,
|
|
140
|
+
yScale,
|
|
141
|
+
width,
|
|
142
|
+
height
|
|
143
|
+
} = useChart();
|
|
144
|
+
const visCanvasRef = useRef(null);
|
|
145
|
+
const pickCanvasRef = useRef(null);
|
|
146
|
+
const [hoverIndex, setHoverIndex] = useState(-1);
|
|
147
|
+
const [mousePos, setMousePos] = useState(null);
|
|
148
|
+
|
|
149
|
+
// Refs for WebGL state
|
|
150
|
+
const visGLRef = useRef(null);
|
|
151
|
+
const pickGLRef = useRef(null);
|
|
152
|
+
|
|
153
|
+
// Compute positions
|
|
154
|
+
const positions = useMemo(() => {
|
|
155
|
+
const pos = [];
|
|
156
|
+
for (const d of data) {
|
|
157
|
+
const x = xPixel(d, xKey, xScale);
|
|
158
|
+
const yVal = typeof d[dataKey] === 'number' ? d[dataKey] : 0;
|
|
159
|
+
pos.push(x, yScale(yVal));
|
|
160
|
+
}
|
|
161
|
+
return new Float32Array(pos);
|
|
162
|
+
}, [data, xKey, dataKey, xScale, yScale]);
|
|
163
|
+
|
|
164
|
+
// Pick colors — one unique color per point
|
|
165
|
+
const pickColors = useMemo(() => {
|
|
166
|
+
const colors = [];
|
|
167
|
+
for (let i = 0; i < data.length; i++) {
|
|
168
|
+
const [r, g, b] = indexToColor(i);
|
|
169
|
+
colors.push(r, g, b);
|
|
170
|
+
}
|
|
171
|
+
return new Float32Array(colors);
|
|
172
|
+
}, [data.length]);
|
|
173
|
+
|
|
174
|
+
// Render both passes
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
if (width <= 0 || height <= 0) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const dpr = window.devicePixelRatio || 1;
|
|
180
|
+
|
|
181
|
+
// --- Visible canvas ---
|
|
182
|
+
const visCanvas = visCanvasRef.current;
|
|
183
|
+
if (visCanvas) {
|
|
184
|
+
visCanvas.width = width * dpr;
|
|
185
|
+
visCanvas.height = height * dpr;
|
|
186
|
+
if (!visGLRef.current) {
|
|
187
|
+
const gl = visCanvas.getContext('webgl', {
|
|
188
|
+
alpha: true,
|
|
189
|
+
premultipliedAlpha: false,
|
|
190
|
+
antialias: true
|
|
191
|
+
});
|
|
192
|
+
const prog = gl ? linkProgram(gl, VERT_VIS, FRAG_VIS) : null;
|
|
193
|
+
if (gl && prog) {
|
|
194
|
+
visGLRef.current = {
|
|
195
|
+
gl,
|
|
196
|
+
prog
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const vis = visGLRef.current;
|
|
201
|
+
if (vis) {
|
|
202
|
+
const {
|
|
203
|
+
gl,
|
|
204
|
+
prog
|
|
205
|
+
} = vis;
|
|
206
|
+
gl.viewport(0, 0, visCanvas.width, visCanvas.height);
|
|
207
|
+
gl.clearColor(0, 0, 0, 0);
|
|
208
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
209
|
+
gl.enable(gl.BLEND);
|
|
210
|
+
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
211
|
+
gl.useProgram(prog);
|
|
212
|
+
const buf = gl.createBuffer();
|
|
213
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buf);
|
|
214
|
+
gl.bufferData(gl.ARRAY_BUFFER, positions, gl.STATIC_DRAW);
|
|
215
|
+
const aPos = gl.getAttribLocation(prog, 'a_position');
|
|
216
|
+
gl.enableVertexAttribArray(aPos);
|
|
217
|
+
gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 0, 0);
|
|
218
|
+
const [r, g, b] = hexToGL(color);
|
|
219
|
+
// Logical pixels — positions from xPixel/yScale are logical
|
|
220
|
+
gl.uniform2f(gl.getUniformLocation(prog, 'u_resolution'), width, height);
|
|
221
|
+
gl.uniform3f(gl.getUniformLocation(prog, 'u_color'), r, g, b);
|
|
222
|
+
gl.uniform1f(gl.getUniformLocation(prog, 'u_size'), size * dpr);
|
|
223
|
+
gl.uniform1f(gl.getUniformLocation(prog, 'u_opacity'), opacity);
|
|
224
|
+
gl.drawArrays(gl.POINTS, 0, positions.length / 2);
|
|
225
|
+
gl.deleteBuffer(buf);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// --- Pick canvas (offscreen) ---
|
|
230
|
+
const pickCanvas = pickCanvasRef.current;
|
|
231
|
+
if (pickCanvas) {
|
|
232
|
+
pickCanvas.width = width * dpr;
|
|
233
|
+
pickCanvas.height = height * dpr;
|
|
234
|
+
if (!pickGLRef.current) {
|
|
235
|
+
const gl = pickCanvas.getContext('webgl', {
|
|
236
|
+
alpha: false,
|
|
237
|
+
premultipliedAlpha: false,
|
|
238
|
+
antialias: false,
|
|
239
|
+
// no AA for clean color IDs
|
|
240
|
+
preserveDrawingBuffer: true
|
|
241
|
+
});
|
|
242
|
+
if (gl) {
|
|
243
|
+
const prog = linkProgram(gl, VERT_PICK, FRAG_PICK);
|
|
244
|
+
const fb = gl.createFramebuffer();
|
|
245
|
+
const tex = gl.createTexture();
|
|
246
|
+
if (prog && fb && tex) {
|
|
247
|
+
// Set up framebuffer with texture
|
|
248
|
+
gl.bindTexture(gl.TEXTURE_2D, tex);
|
|
249
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, pickCanvas.width, pickCanvas.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
250
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
251
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
252
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
|
|
253
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0);
|
|
254
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
255
|
+
pickGLRef.current = {
|
|
256
|
+
gl,
|
|
257
|
+
prog,
|
|
258
|
+
fb,
|
|
259
|
+
tex
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const pick = pickGLRef.current;
|
|
265
|
+
if (pick) {
|
|
266
|
+
const {
|
|
267
|
+
gl,
|
|
268
|
+
prog,
|
|
269
|
+
fb,
|
|
270
|
+
tex
|
|
271
|
+
} = pick;
|
|
272
|
+
|
|
273
|
+
// Resize texture if needed
|
|
274
|
+
gl.bindTexture(gl.TEXTURE_2D, tex);
|
|
275
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, pickCanvas.width, pickCanvas.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
276
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
|
|
277
|
+
gl.viewport(0, 0, pickCanvas.width, pickCanvas.height);
|
|
278
|
+
gl.clearColor(0, 0, 0, 1);
|
|
279
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
280
|
+
gl.disable(gl.BLEND); // no blending for pick IDs
|
|
281
|
+
gl.useProgram(prog);
|
|
282
|
+
|
|
283
|
+
// Positions
|
|
284
|
+
const posBuf = gl.createBuffer();
|
|
285
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, posBuf);
|
|
286
|
+
gl.bufferData(gl.ARRAY_BUFFER, positions, gl.STATIC_DRAW);
|
|
287
|
+
const aPos = gl.getAttribLocation(prog, 'a_position');
|
|
288
|
+
gl.enableVertexAttribArray(aPos);
|
|
289
|
+
gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 0, 0);
|
|
290
|
+
|
|
291
|
+
// Pick colors
|
|
292
|
+
const colBuf = gl.createBuffer();
|
|
293
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, colBuf);
|
|
294
|
+
gl.bufferData(gl.ARRAY_BUFFER, pickColors, gl.STATIC_DRAW);
|
|
295
|
+
const aCol = gl.getAttribLocation(prog, 'a_pickColor');
|
|
296
|
+
gl.enableVertexAttribArray(aCol);
|
|
297
|
+
gl.vertexAttribPointer(aCol, 3, gl.FLOAT, false, 0, 0);
|
|
298
|
+
gl.uniform2f(gl.getUniformLocation(prog, 'u_resolution'), width, height);
|
|
299
|
+
gl.uniform1f(gl.getUniformLocation(prog, 'u_size'), (size + 4) * dpr);
|
|
300
|
+
gl.drawArrays(gl.POINTS, 0, positions.length / 2);
|
|
301
|
+
gl.deleteBuffer(posBuf);
|
|
302
|
+
gl.deleteBuffer(colBuf);
|
|
303
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}, [width, height, positions, pickColors, color, size, opacity]);
|
|
307
|
+
|
|
308
|
+
// Mouse handler — read pick buffer
|
|
309
|
+
const handleMouseMove = useCallback(e => {
|
|
310
|
+
const pick = pickGLRef.current;
|
|
311
|
+
if (!pick) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const svg = e.currentTarget.ownerSVGElement;
|
|
315
|
+
if (!svg) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
const pt = svg.createSVGPoint();
|
|
319
|
+
pt.x = e.clientX;
|
|
320
|
+
pt.y = e.clientY;
|
|
321
|
+
const local = pt.matrixTransform(e.currentTarget.getScreenCTM()?.inverse());
|
|
322
|
+
const dpr = window.devicePixelRatio || 1;
|
|
323
|
+
const px = Math.floor(local.x * dpr);
|
|
324
|
+
const py = Math.floor(local.y * dpr);
|
|
325
|
+
const {
|
|
326
|
+
gl,
|
|
327
|
+
fb
|
|
328
|
+
} = pick;
|
|
329
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
|
|
330
|
+
const pixel = new Uint8Array(4);
|
|
331
|
+
gl.readPixels(px, gl.canvas.height - py, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
|
|
332
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
333
|
+
const idx = colorToIndex(pixel[0], pixel[1], pixel[2]);
|
|
334
|
+
setHoverIndex(idx);
|
|
335
|
+
setMousePos(idx >= 0 ? {
|
|
336
|
+
x: local.x,
|
|
337
|
+
y: local.y
|
|
338
|
+
} : null);
|
|
339
|
+
}, []);
|
|
340
|
+
const handleMouseLeave = useCallback(() => {
|
|
341
|
+
setHoverIndex(-1);
|
|
342
|
+
setMousePos(null);
|
|
343
|
+
}, []);
|
|
344
|
+
const datum = hoverIndex >= 0 && hoverIndex < data.length ? data[hoverIndex] : null;
|
|
345
|
+
const defaultTooltip = (d, i) => /*#__PURE__*/_jsxs("div", {
|
|
346
|
+
style: {
|
|
347
|
+
display: 'flex',
|
|
348
|
+
flexDirection: 'column',
|
|
349
|
+
gap: 2,
|
|
350
|
+
fontSize: 12
|
|
351
|
+
},
|
|
352
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
353
|
+
style: {
|
|
354
|
+
fontWeight: 600,
|
|
355
|
+
color: 'var(--color-text-primary)'
|
|
356
|
+
},
|
|
357
|
+
children: ["Point ", i]
|
|
358
|
+
}), Object.entries(d).map(([k, v]) => /*#__PURE__*/_jsxs("div", {
|
|
359
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
360
|
+
style: {
|
|
361
|
+
color: 'var(--color-text-secondary)'
|
|
362
|
+
},
|
|
363
|
+
children: [k, ":"]
|
|
364
|
+
}), ' ', /*#__PURE__*/_jsx("span", {
|
|
365
|
+
style: {
|
|
366
|
+
fontWeight: 500
|
|
367
|
+
},
|
|
368
|
+
children: String(v)
|
|
369
|
+
})]
|
|
370
|
+
}, k))]
|
|
371
|
+
});
|
|
372
|
+
if (width <= 0 || height <= 0) {
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
return /*#__PURE__*/_jsxs("g", {
|
|
376
|
+
children: [/*#__PURE__*/_jsx("foreignObject", {
|
|
377
|
+
x: 0,
|
|
378
|
+
y: 0,
|
|
379
|
+
width: width,
|
|
380
|
+
height: height,
|
|
381
|
+
style: {
|
|
382
|
+
overflow: 'hidden'
|
|
383
|
+
},
|
|
384
|
+
children: /*#__PURE__*/_jsx("canvas", {
|
|
385
|
+
ref: visCanvasRef,
|
|
386
|
+
style: {
|
|
387
|
+
width,
|
|
388
|
+
height,
|
|
389
|
+
pointerEvents: 'none'
|
|
390
|
+
}
|
|
391
|
+
})
|
|
392
|
+
}), /*#__PURE__*/_jsx("foreignObject", {
|
|
393
|
+
x: 0,
|
|
394
|
+
y: 0,
|
|
395
|
+
width: 0,
|
|
396
|
+
height: 0,
|
|
397
|
+
style: {
|
|
398
|
+
overflow: 'hidden'
|
|
399
|
+
},
|
|
400
|
+
children: /*#__PURE__*/_jsx("canvas", {
|
|
401
|
+
ref: pickCanvasRef,
|
|
402
|
+
style: {
|
|
403
|
+
display: 'none'
|
|
404
|
+
}
|
|
405
|
+
})
|
|
406
|
+
}), /*#__PURE__*/_jsx("rect", {
|
|
407
|
+
x: 0,
|
|
408
|
+
y: 0,
|
|
409
|
+
width: width,
|
|
410
|
+
height: height,
|
|
411
|
+
fill: "transparent",
|
|
412
|
+
onMouseMove: handleMouseMove,
|
|
413
|
+
onMouseLeave: handleMouseLeave
|
|
414
|
+
}), datum && hoverIndex >= 0 && /*#__PURE__*/_jsx("circle", {
|
|
415
|
+
cx: positions[hoverIndex * 2],
|
|
416
|
+
cy: positions[hoverIndex * 2 + 1],
|
|
417
|
+
r: size / 2 + 3,
|
|
418
|
+
fill: "none",
|
|
419
|
+
stroke: color,
|
|
420
|
+
strokeWidth: 2,
|
|
421
|
+
strokeOpacity: 0.8,
|
|
422
|
+
pointerEvents: "none"
|
|
423
|
+
}), datum && mousePos && /*#__PURE__*/_jsx("foreignObject", {
|
|
424
|
+
x: mousePos.x + 12,
|
|
425
|
+
y: Math.max(0, mousePos.y - 40),
|
|
426
|
+
width: 200,
|
|
427
|
+
height: 120,
|
|
428
|
+
pointerEvents: "none",
|
|
429
|
+
style: {
|
|
430
|
+
overflow: 'visible'
|
|
431
|
+
},
|
|
432
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
433
|
+
style: {
|
|
434
|
+
background: 'var(--color-background-popover)',
|
|
435
|
+
border: '1px solid var(--color-border)',
|
|
436
|
+
borderRadius: 8,
|
|
437
|
+
padding: '8px 12px',
|
|
438
|
+
boxShadow: 'var(--shadow-med)',
|
|
439
|
+
whiteSpace: 'nowrap',
|
|
440
|
+
width: 'fit-content'
|
|
441
|
+
},
|
|
442
|
+
children: renderTooltip ? renderTooltip(datum, hoverIndex) : defaultTooltip(datum, hoverIndex)
|
|
443
|
+
})
|
|
444
|
+
})]
|
|
445
|
+
});
|
|
446
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface ChartErrorBarProps {
|
|
2
|
+
/** Data key for the upper bound */
|
|
3
|
+
yUpper: string;
|
|
4
|
+
/** Data key for the lower bound */
|
|
5
|
+
yLower: string;
|
|
6
|
+
/** Stroke color */
|
|
7
|
+
color?: string;
|
|
8
|
+
/** Stroke width */
|
|
9
|
+
strokeWidth?: number;
|
|
10
|
+
/** Width of the whisker caps in pixels */
|
|
11
|
+
capWidth?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Error bars with whisker caps. Pair with ChartBar or ChartDot.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```
|
|
18
|
+
* <ChartBar dataKey="mean" color={colors[0]} />
|
|
19
|
+
* <ChartErrorBar yUpper="upper95" yLower="lower95" />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function ChartErrorBar({ yUpper, yLower, color, strokeWidth, capWidth, }: ChartErrorBarProps): import("react").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=ChartErrorBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartErrorBar.d.ts","sourceRoot":"","sources":["../../src/Chart/ChartErrorBar.tsx"],"names":[],"mappings":"AAWA,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,MAAM,EACN,KAAmC,EACnC,WAAiB,EACjB,QAAY,GACb,EAAE,kBAAkB,+BA4CpB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file ChartErrorBar.tsx
|
|
5
|
+
* @output Renders error bars (whiskers) at each data point
|
|
6
|
+
* @position Child of Chart; reads scales from context
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useChart } from "./ChartContext.js";
|
|
10
|
+
import { xPixel } from "./utils.js";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
/**
|
|
13
|
+
* Error bars with whisker caps. Pair with ChartBar or ChartDot.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```
|
|
17
|
+
* <ChartBar dataKey="mean" color={colors[0]} />
|
|
18
|
+
* <ChartErrorBar yUpper="upper95" yLower="lower95" />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export function ChartErrorBar({
|
|
22
|
+
yUpper,
|
|
23
|
+
yLower,
|
|
24
|
+
color = 'var(--color-text-primary)',
|
|
25
|
+
strokeWidth = 1.5,
|
|
26
|
+
capWidth = 8
|
|
27
|
+
}) {
|
|
28
|
+
const {
|
|
29
|
+
data,
|
|
30
|
+
xKey,
|
|
31
|
+
xScale,
|
|
32
|
+
yScale
|
|
33
|
+
} = useChart();
|
|
34
|
+
return /*#__PURE__*/_jsx("g", {
|
|
35
|
+
children: data.map((d, i) => {
|
|
36
|
+
const x = xPixel(d, xKey, xScale);
|
|
37
|
+
const upper = typeof d[yUpper] === 'number' ? d[yUpper] : 0;
|
|
38
|
+
const lower = typeof d[yLower] === 'number' ? d[yLower] : 0;
|
|
39
|
+
const yTop = yScale(upper);
|
|
40
|
+
const yBot = yScale(lower);
|
|
41
|
+
const half = capWidth / 2;
|
|
42
|
+
return /*#__PURE__*/_jsxs("g", {
|
|
43
|
+
children: [/*#__PURE__*/_jsx("line", {
|
|
44
|
+
x1: x,
|
|
45
|
+
x2: x,
|
|
46
|
+
y1: yTop,
|
|
47
|
+
y2: yBot,
|
|
48
|
+
stroke: color,
|
|
49
|
+
strokeWidth: strokeWidth
|
|
50
|
+
}), /*#__PURE__*/_jsx("line", {
|
|
51
|
+
x1: x - half,
|
|
52
|
+
x2: x + half,
|
|
53
|
+
y1: yTop,
|
|
54
|
+
y2: yTop,
|
|
55
|
+
stroke: color,
|
|
56
|
+
strokeWidth: strokeWidth
|
|
57
|
+
}), /*#__PURE__*/_jsx("line", {
|
|
58
|
+
x1: x - half,
|
|
59
|
+
x2: x + half,
|
|
60
|
+
y1: yBot,
|
|
61
|
+
y2: yBot,
|
|
62
|
+
stroke: color,
|
|
63
|
+
strokeWidth: strokeWidth
|
|
64
|
+
})]
|
|
65
|
+
}, i);
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ChartGridProps {
|
|
2
|
+
/** Show horizontal grid lines (default: true) */
|
|
3
|
+
horizontal?: boolean;
|
|
4
|
+
/** Show vertical grid lines */
|
|
5
|
+
vertical?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Grid lines behind chart marks.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```
|
|
12
|
+
* <ChartGrid horizontal />
|
|
13
|
+
* <ChartGrid horizontal vertical />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function ChartGrid({ horizontal, vertical, }: ChartGridProps): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=ChartGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartGrid.d.ts","sourceRoot":"","sources":["../../src/Chart/ChartGrid.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,cAAc;IAC7B,iDAAiD;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,EACxB,UAAiB,EACjB,QAAgB,GACjB,EAAE,cAAc,+BAqDhB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file ChartGrid.tsx
|
|
5
|
+
* @output Renders horizontal and/or vertical grid lines
|
|
6
|
+
* @position Child of Chart; reads scales from context
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useMemo } from 'react';
|
|
10
|
+
import { useChart } from "./ChartContext.js";
|
|
11
|
+
import { isBandScale } from "./utils.js";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
/**
|
|
14
|
+
* Grid lines behind chart marks.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```
|
|
18
|
+
* <ChartGrid horizontal />
|
|
19
|
+
* <ChartGrid horizontal vertical />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function ChartGrid({
|
|
23
|
+
horizontal = true,
|
|
24
|
+
vertical = false
|
|
25
|
+
}) {
|
|
26
|
+
const {
|
|
27
|
+
width,
|
|
28
|
+
height,
|
|
29
|
+
xScale,
|
|
30
|
+
yScale
|
|
31
|
+
} = useChart();
|
|
32
|
+
const hLines = useMemo(() => {
|
|
33
|
+
if (!horizontal) {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
return yScale.ticks(5).map(tick => yScale(tick));
|
|
37
|
+
}, [horizontal, yScale]);
|
|
38
|
+
const vLines = useMemo(() => {
|
|
39
|
+
if (!vertical) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
if (isBandScale(xScale)) {
|
|
43
|
+
return xScale.domain().map(d => (xScale(d) ?? 0) + xScale.bandwidth() / 2);
|
|
44
|
+
}
|
|
45
|
+
const linear = xScale;
|
|
46
|
+
return linear.ticks(5).map(d => linear(d));
|
|
47
|
+
}, [vertical, xScale]);
|
|
48
|
+
return /*#__PURE__*/_jsxs("g", {
|
|
49
|
+
children: [hLines.map(y => /*#__PURE__*/_jsx("line", {
|
|
50
|
+
x1: 0,
|
|
51
|
+
x2: width,
|
|
52
|
+
y1: y,
|
|
53
|
+
y2: y,
|
|
54
|
+
stroke: "var(--color-border)",
|
|
55
|
+
strokeOpacity: 0.5,
|
|
56
|
+
strokeDasharray: "4 4"
|
|
57
|
+
}, `h-${y}`)), vLines.map(x => /*#__PURE__*/_jsx("line", {
|
|
58
|
+
x1: x,
|
|
59
|
+
x2: x,
|
|
60
|
+
y1: 0,
|
|
61
|
+
y2: height,
|
|
62
|
+
stroke: "var(--color-border)",
|
|
63
|
+
strokeOpacity: 0.5,
|
|
64
|
+
strokeDasharray: "4 4"
|
|
65
|
+
}, `v-${x}`))]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ChartHeatmapGLProps {
|
|
2
|
+
xKey: string;
|
|
3
|
+
yKey: string;
|
|
4
|
+
valueKey: string;
|
|
5
|
+
colorRange: string[];
|
|
6
|
+
domain?: [number, number];
|
|
7
|
+
cellGap?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function ChartHeatmapGL({ xKey, yKey, valueKey, colorRange, domain: domainProp, cellGap, }: ChartHeatmapGLProps): import("react").JSX.Element | null;
|
|
10
|
+
//# sourceMappingURL=ChartHeatmapGL.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartHeatmapGL.d.ts","sourceRoot":"","sources":["../../src/Chart/ChartHeatmapGL.tsx"],"names":[],"mappings":"AAqBA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAyCD,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,MAAM,EAAE,UAAU,EAClB,OAAW,GACZ,EAAE,mBAAmB,sCA8IrB"}
|