@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,22 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file index.ts
|
|
7
|
+
* @input SVGIcon module
|
|
8
|
+
* @output Re-exports all SVG icon system components, types, utilities, and starter icons
|
|
9
|
+
* @position Entry point for the lab SVG icon system
|
|
10
|
+
*/
|
|
11
|
+
export { SVGIcon } from "./SVGIcon.js";
|
|
12
|
+
export { variations, opticalSize } from "./variations.stylex.js";
|
|
13
|
+
export { iconVars } from "./tokens.stylex.js";
|
|
14
|
+
export { xIcon, checkIcon, bellIcon, homeIcon, settingsIcon, calendarIcon, menuIcon, heartIcon, eyeIcon, starIcon, folderIcon, shieldIcon, searchIcon, mailIcon, lockIcon, starterIcons } from "./icons.js";
|
|
15
|
+
|
|
16
|
+
// XIF spec types
|
|
17
|
+
|
|
18
|
+
// XIF example icons
|
|
19
|
+
export { xifCheck, xifHome, xifFile, xifShield, xifBell, xifStar, xifBellOverride, xifExamples } from "./xif-examples.js";
|
|
20
|
+
|
|
21
|
+
// Path transforms
|
|
22
|
+
export { roundCorners, addCurvature, adjustTension, applyPersonality } from "./pathTransforms.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Round corners at L→L junctions by inserting quadratic bezier curves.
|
|
3
|
+
*
|
|
4
|
+
* @param d - SVG path d-string
|
|
5
|
+
* @param cornerRounding - 0-1 percentile. 0 = sharp (no change). 1 = max rounding.
|
|
6
|
+
* @returns Modified d-string with rounded corners
|
|
7
|
+
*/
|
|
8
|
+
export declare function roundCorners(d: string, cornerRounding: number): string;
|
|
9
|
+
/**
|
|
10
|
+
* Bow straight line segments by replacing L with Q.
|
|
11
|
+
*
|
|
12
|
+
* @param d - SVG path d-string
|
|
13
|
+
* @param curvature - 0-1 percentile. 0 = straight. 1 = max bow.
|
|
14
|
+
* @returns Modified d-string with curved segments
|
|
15
|
+
*/
|
|
16
|
+
export declare function addCurvature(d: string, curvature: number): string;
|
|
17
|
+
/**
|
|
18
|
+
* Adjust tension on existing bezier curves.
|
|
19
|
+
*
|
|
20
|
+
* @param d - SVG path d-string
|
|
21
|
+
* @param tension - 0-1. 0 = loose (curves balloon). 0.5 = unchanged. 1 = tight.
|
|
22
|
+
* @returns Modified d-string
|
|
23
|
+
*/
|
|
24
|
+
export declare function adjustTension(d: string, tension: number): string;
|
|
25
|
+
export interface PathPersonality {
|
|
26
|
+
cornerRounding?: number;
|
|
27
|
+
segmentCurvature?: number;
|
|
28
|
+
tension?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Apply all personality transforms to a path d-string.
|
|
32
|
+
* Order: corner rounding → segment curvature → tension.
|
|
33
|
+
*/
|
|
34
|
+
export declare function applyPersonality(d: string, personality: PathPersonality): string;
|
|
35
|
+
//# sourceMappingURL=pathTransforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathTransforms.d.ts","sourceRoot":"","sources":["../../src/SVGIcon/pathTransforms.ts"],"names":[],"mappings":"AAoQA;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAkJtE;AAMD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAsDjE;AAMD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAuDhE;AAMD,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,eAAe,GAC3B,MAAM,CAeR"}
|
|
@@ -0,0 +1,644 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file pathTransforms.ts
|
|
5
|
+
* @description SVG path manipulation utilities for XIF personality axes.
|
|
6
|
+
*
|
|
7
|
+
* Implements corner rounding, segment curvature, and tension adjustments
|
|
8
|
+
* as relative (percentile) transforms on parsed SVG path data.
|
|
9
|
+
*
|
|
10
|
+
* All transforms preserve the artist's hierarchy — sharp corners shift
|
|
11
|
+
* more than gentle ones, straight lines shift more than existing curves.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// =============================================================================
|
|
15
|
+
// Path Parser (minimal, handles M/L/H/V/C/Q/A/Z)
|
|
16
|
+
// =============================================================================
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Parse an SVG path d-string into an array of absolute commands.
|
|
20
|
+
* Normalizes H/V → L for uniform processing.
|
|
21
|
+
*/
|
|
22
|
+
function parsePath(d) {
|
|
23
|
+
const commands = [];
|
|
24
|
+
// Match command letter + all following numbers (including negatives and decimals)
|
|
25
|
+
const re = /([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g;
|
|
26
|
+
let match;
|
|
27
|
+
let cx = 0,
|
|
28
|
+
cy = 0; // current position
|
|
29
|
+
let sx = 0,
|
|
30
|
+
sy = 0; // subpath start
|
|
31
|
+
|
|
32
|
+
while ((match = re.exec(d)) !== null) {
|
|
33
|
+
const cmd = match[1];
|
|
34
|
+
const args = (match[2].match(/-?[\d.]+(?:e[+-]?\d+)?/gi) || []).map(Number);
|
|
35
|
+
switch (cmd) {
|
|
36
|
+
case 'M':
|
|
37
|
+
cx = args[0];
|
|
38
|
+
cy = args[1];
|
|
39
|
+
sx = cx;
|
|
40
|
+
sy = cy;
|
|
41
|
+
commands.push({
|
|
42
|
+
type: 'M',
|
|
43
|
+
x: cx,
|
|
44
|
+
y: cy
|
|
45
|
+
});
|
|
46
|
+
// Implicit L for additional coordinate pairs
|
|
47
|
+
for (let i = 2; i < args.length; i += 2) {
|
|
48
|
+
cx = args[i];
|
|
49
|
+
cy = args[i + 1];
|
|
50
|
+
commands.push({
|
|
51
|
+
type: 'L',
|
|
52
|
+
x: cx,
|
|
53
|
+
y: cy
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
break;
|
|
57
|
+
case 'm':
|
|
58
|
+
cx += args[0];
|
|
59
|
+
cy += args[1];
|
|
60
|
+
sx = cx;
|
|
61
|
+
sy = cy;
|
|
62
|
+
commands.push({
|
|
63
|
+
type: 'M',
|
|
64
|
+
x: cx,
|
|
65
|
+
y: cy
|
|
66
|
+
});
|
|
67
|
+
for (let i = 2; i < args.length; i += 2) {
|
|
68
|
+
cx += args[i];
|
|
69
|
+
cy += args[i + 1];
|
|
70
|
+
commands.push({
|
|
71
|
+
type: 'L',
|
|
72
|
+
x: cx,
|
|
73
|
+
y: cy
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
case 'L':
|
|
78
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
79
|
+
cx = args[i];
|
|
80
|
+
cy = args[i + 1];
|
|
81
|
+
commands.push({
|
|
82
|
+
type: 'L',
|
|
83
|
+
x: cx,
|
|
84
|
+
y: cy
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case 'l':
|
|
89
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
90
|
+
cx += args[i];
|
|
91
|
+
cy += args[i + 1];
|
|
92
|
+
commands.push({
|
|
93
|
+
type: 'L',
|
|
94
|
+
x: cx,
|
|
95
|
+
y: cy
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
case 'H':
|
|
100
|
+
for (let i = 0; i < args.length; i++) {
|
|
101
|
+
cx = args[i];
|
|
102
|
+
commands.push({
|
|
103
|
+
type: 'L',
|
|
104
|
+
x: cx,
|
|
105
|
+
y: cy
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
case 'h':
|
|
110
|
+
for (let i = 0; i < args.length; i++) {
|
|
111
|
+
cx += args[i];
|
|
112
|
+
commands.push({
|
|
113
|
+
type: 'L',
|
|
114
|
+
x: cx,
|
|
115
|
+
y: cy
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
case 'V':
|
|
120
|
+
for (let i = 0; i < args.length; i++) {
|
|
121
|
+
cy = args[i];
|
|
122
|
+
commands.push({
|
|
123
|
+
type: 'L',
|
|
124
|
+
x: cx,
|
|
125
|
+
y: cy
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
129
|
+
case 'v':
|
|
130
|
+
for (let i = 0; i < args.length; i++) {
|
|
131
|
+
cy += args[i];
|
|
132
|
+
commands.push({
|
|
133
|
+
type: 'L',
|
|
134
|
+
x: cx,
|
|
135
|
+
y: cy
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
case 'C':
|
|
140
|
+
for (let i = 0; i < args.length; i += 6) {
|
|
141
|
+
commands.push({
|
|
142
|
+
type: 'C',
|
|
143
|
+
x1: args[i],
|
|
144
|
+
y1: args[i + 1],
|
|
145
|
+
x2: args[i + 2],
|
|
146
|
+
y2: args[i + 3],
|
|
147
|
+
x: args[i + 4],
|
|
148
|
+
y: args[i + 5]
|
|
149
|
+
});
|
|
150
|
+
cx = args[i + 4];
|
|
151
|
+
cy = args[i + 5];
|
|
152
|
+
}
|
|
153
|
+
break;
|
|
154
|
+
case 'c':
|
|
155
|
+
for (let i = 0; i < args.length; i += 6) {
|
|
156
|
+
commands.push({
|
|
157
|
+
type: 'C',
|
|
158
|
+
x1: cx + args[i],
|
|
159
|
+
y1: cy + args[i + 1],
|
|
160
|
+
x2: cx + args[i + 2],
|
|
161
|
+
y2: cy + args[i + 3],
|
|
162
|
+
x: cx + args[i + 4],
|
|
163
|
+
y: cy + args[i + 5]
|
|
164
|
+
});
|
|
165
|
+
cx += args[i + 4];
|
|
166
|
+
cy += args[i + 5];
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
case 'Q':
|
|
170
|
+
for (let i = 0; i < args.length; i += 4) {
|
|
171
|
+
commands.push({
|
|
172
|
+
type: 'Q',
|
|
173
|
+
cx: args[i],
|
|
174
|
+
cy: args[i + 1],
|
|
175
|
+
x: args[i + 2],
|
|
176
|
+
y: args[i + 3]
|
|
177
|
+
});
|
|
178
|
+
cx = args[i + 2];
|
|
179
|
+
cy = args[i + 3];
|
|
180
|
+
}
|
|
181
|
+
break;
|
|
182
|
+
case 'q':
|
|
183
|
+
for (let i = 0; i < args.length; i += 4) {
|
|
184
|
+
commands.push({
|
|
185
|
+
type: 'Q',
|
|
186
|
+
cx: cx + args[i],
|
|
187
|
+
cy: cy + args[i + 1],
|
|
188
|
+
x: cx + args[i + 2],
|
|
189
|
+
y: cy + args[i + 3]
|
|
190
|
+
});
|
|
191
|
+
cx += args[i + 2];
|
|
192
|
+
cy += args[i + 3];
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
case 'A':
|
|
196
|
+
case 'a':
|
|
197
|
+
{
|
|
198
|
+
const rel = cmd === 'a';
|
|
199
|
+
for (let i = 0; i < args.length; i += 7) {
|
|
200
|
+
const nx = rel ? cx + args[i + 5] : args[i + 5];
|
|
201
|
+
const ny = rel ? cy + args[i + 6] : args[i + 6];
|
|
202
|
+
commands.push({
|
|
203
|
+
type: 'A',
|
|
204
|
+
rx: args[i],
|
|
205
|
+
ry: args[i + 1],
|
|
206
|
+
rotation: args[i + 2],
|
|
207
|
+
large: args[i + 3],
|
|
208
|
+
sweep: args[i + 4],
|
|
209
|
+
x: nx,
|
|
210
|
+
y: ny
|
|
211
|
+
});
|
|
212
|
+
cx = nx;
|
|
213
|
+
cy = ny;
|
|
214
|
+
}
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
case 'S':
|
|
218
|
+
case 's':
|
|
219
|
+
// Smooth cubic — convert to C (simplified: treat as C with reflected control point)
|
|
220
|
+
// For our purposes, pass through as-is since we mainly transform L→L corners
|
|
221
|
+
break;
|
|
222
|
+
case 'T':
|
|
223
|
+
case 't':
|
|
224
|
+
// Smooth quadratic — similar, pass through
|
|
225
|
+
break;
|
|
226
|
+
case 'Z':
|
|
227
|
+
case 'z':
|
|
228
|
+
commands.push({
|
|
229
|
+
type: 'Z'
|
|
230
|
+
});
|
|
231
|
+
cx = sx;
|
|
232
|
+
cy = sy;
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return commands;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// =============================================================================
|
|
240
|
+
// Utilities
|
|
241
|
+
// =============================================================================
|
|
242
|
+
|
|
243
|
+
function dist(a, b) {
|
|
244
|
+
return Math.sqrt((b.x - a.x) ** 2 + (b.y - a.y) ** 2);
|
|
245
|
+
}
|
|
246
|
+
function lerp(a, b, t) {
|
|
247
|
+
return {
|
|
248
|
+
x: a.x + (b.x - a.x) * t,
|
|
249
|
+
y: a.y + (b.y - a.y) * t
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function angleBetween(v1, v2) {
|
|
253
|
+
const dot = v1.x * v2.x + v1.y * v2.y;
|
|
254
|
+
const mag1 = Math.sqrt(v1.x ** 2 + v1.y ** 2);
|
|
255
|
+
const mag2 = Math.sqrt(v2.x ** 2 + v2.y ** 2);
|
|
256
|
+
if (mag1 === 0 || mag2 === 0) {
|
|
257
|
+
return Math.PI;
|
|
258
|
+
}
|
|
259
|
+
return Math.acos(Math.max(-1, Math.min(1, dot / (mag1 * mag2))));
|
|
260
|
+
}
|
|
261
|
+
function getEndpoint(cmd) {
|
|
262
|
+
if (cmd.type === 'Z') {
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
x: cmd.x,
|
|
267
|
+
y: cmd.y
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// =============================================================================
|
|
272
|
+
// Corner Rounding
|
|
273
|
+
// =============================================================================
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Round corners at L→L junctions by inserting quadratic bezier curves.
|
|
277
|
+
*
|
|
278
|
+
* @param d - SVG path d-string
|
|
279
|
+
* @param cornerRounding - 0-1 percentile. 0 = sharp (no change). 1 = max rounding.
|
|
280
|
+
* @returns Modified d-string with rounded corners
|
|
281
|
+
*/
|
|
282
|
+
export function roundCorners(d, cornerRounding) {
|
|
283
|
+
if (cornerRounding <= 0) {
|
|
284
|
+
return d;
|
|
285
|
+
}
|
|
286
|
+
cornerRounding = Math.min(1, cornerRounding);
|
|
287
|
+
const cmds = parsePath(d);
|
|
288
|
+
const result = [];
|
|
289
|
+
|
|
290
|
+
// Pre-pass: find the last L before each Z to handle closed path corners
|
|
291
|
+
// We need to round: last-L → Z → M (the closing corner)
|
|
292
|
+
// and also: M → first-L (the opening corner, if preceded by Z-closed path)
|
|
293
|
+
|
|
294
|
+
for (let i = 0; i < cmds.length; i++) {
|
|
295
|
+
const prev = i > 0 ? cmds[i - 1] : null;
|
|
296
|
+
const curr = cmds[i];
|
|
297
|
+
const next = i < cmds.length - 1 ? cmds[i + 1] : null;
|
|
298
|
+
|
|
299
|
+
// Handle Z: insert rounding for the closing corner
|
|
300
|
+
// The corner is: last point → subpath start (M) → first L after M
|
|
301
|
+
if (curr.type === 'Z' && prev && (prev.type === 'L' || prev.type === 'Q')) {
|
|
302
|
+
// Find the M that started this subpath
|
|
303
|
+
let mIdx = i - 1;
|
|
304
|
+
while (mIdx >= 0 && cmds[mIdx].type !== 'M') {
|
|
305
|
+
mIdx--;
|
|
306
|
+
}
|
|
307
|
+
if (mIdx >= 0) {
|
|
308
|
+
const mCmd = cmds[mIdx];
|
|
309
|
+
const mPt = getEndpoint(mCmd);
|
|
310
|
+
const prevPt = getEndpoint(prev);
|
|
311
|
+
if (!mPt || !prevPt) {
|
|
312
|
+
result.push(curr);
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
// Find the first L after M
|
|
316
|
+
let firstL = mIdx + 1;
|
|
317
|
+
while (firstL < cmds.length && cmds[firstL].type !== 'L') {
|
|
318
|
+
firstL++;
|
|
319
|
+
}
|
|
320
|
+
if (firstL < cmds.length) {
|
|
321
|
+
const firstLPt = getEndpoint(cmds[firstL]);
|
|
322
|
+
if (!firstLPt) {
|
|
323
|
+
result.push(curr);
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
const d1 = dist(prevPt, mPt);
|
|
327
|
+
const d2 = dist(mPt, firstLPt);
|
|
328
|
+
const maxR = Math.min(d1, d2) / 2;
|
|
329
|
+
const v1 = {
|
|
330
|
+
x: prevPt.x - mPt.x,
|
|
331
|
+
y: prevPt.y - mPt.y
|
|
332
|
+
};
|
|
333
|
+
const v2 = {
|
|
334
|
+
x: firstLPt.x - mPt.x,
|
|
335
|
+
y: firstLPt.y - mPt.y
|
|
336
|
+
};
|
|
337
|
+
const ang = angleBetween(v1, v2);
|
|
338
|
+
const sharp = 1 - ang / Math.PI;
|
|
339
|
+
const r = maxR * cornerRounding * sharp * 0.85;
|
|
340
|
+
if (r >= 0.1) {
|
|
341
|
+
const t1 = r / d1;
|
|
342
|
+
const t2 = r / d2;
|
|
343
|
+
const pb1 = lerp(mPt, prevPt, t1);
|
|
344
|
+
const pb2 = lerp(mPt, firstLPt, t2);
|
|
345
|
+
|
|
346
|
+
// Insert L to pull-back, Q through M, then Z
|
|
347
|
+
result.push({
|
|
348
|
+
type: 'L',
|
|
349
|
+
x: pb1.x,
|
|
350
|
+
y: pb1.y
|
|
351
|
+
});
|
|
352
|
+
result.push({
|
|
353
|
+
type: 'Q',
|
|
354
|
+
cx: mPt.x,
|
|
355
|
+
cy: mPt.y,
|
|
356
|
+
x: pb2.x,
|
|
357
|
+
y: pb2.y
|
|
358
|
+
});
|
|
359
|
+
result.push({
|
|
360
|
+
type: 'Z'
|
|
361
|
+
});
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
result.push(curr);
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Only round L commands that have L or M before and L or Z after
|
|
371
|
+
if (curr.type === 'L' && prev && (prev.type === 'L' || prev.type === 'M' || prev.type === 'Q') && next && (next.type === 'L' || next.type === 'Z')) {
|
|
372
|
+
const prevPt = getEndpoint(prev);
|
|
373
|
+
if (!prevPt) {
|
|
374
|
+
result.push(curr);
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
const cornerPt = {
|
|
378
|
+
x: curr.x,
|
|
379
|
+
y: curr.y
|
|
380
|
+
};
|
|
381
|
+
let nextPt;
|
|
382
|
+
if (next.type === 'Z') {
|
|
383
|
+
const mCmd = cmds.find(c => c.type === 'M');
|
|
384
|
+
nextPt = mCmd ? getEndpoint(mCmd) : null;
|
|
385
|
+
} else {
|
|
386
|
+
nextPt = getEndpoint(next);
|
|
387
|
+
}
|
|
388
|
+
if (!nextPt) {
|
|
389
|
+
result.push(curr);
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
const d1 = dist(prevPt, cornerPt);
|
|
393
|
+
const d2 = dist(cornerPt, nextPt);
|
|
394
|
+
const maxRadius = Math.min(d1, d2) / 2;
|
|
395
|
+
|
|
396
|
+
// Compute angle to determine sharpness
|
|
397
|
+
const v1 = {
|
|
398
|
+
x: prevPt.x - cornerPt.x,
|
|
399
|
+
y: prevPt.y - cornerPt.y
|
|
400
|
+
};
|
|
401
|
+
const v2 = {
|
|
402
|
+
x: nextPt.x - cornerPt.x,
|
|
403
|
+
y: nextPt.y - cornerPt.y
|
|
404
|
+
};
|
|
405
|
+
const angle = angleBetween(v1, v2);
|
|
406
|
+
|
|
407
|
+
// Proportional rounding: sharper corners round MORE, gentle corners round LESS.
|
|
408
|
+
//
|
|
409
|
+
// Sharpness = 1 - (angle / π). Range: 0 (flat/180°) to 1 (fully acute/0°).
|
|
410
|
+
// Linear scaling with sharpness — at cornerRounding=1, a 90° corner
|
|
411
|
+
// uses 50% of maxRadius. Gentler corners get proportionally less.
|
|
412
|
+
// The 0.85 multiplier prevents full radius (which would make very
|
|
413
|
+
// short segments disappear) while still being visually bold.
|
|
414
|
+
const sharpness = 1 - angle / Math.PI;
|
|
415
|
+
const radius = maxRadius * cornerRounding * sharpness * 0.85;
|
|
416
|
+
if (radius < 0.1) {
|
|
417
|
+
// Too small to round, keep original
|
|
418
|
+
result.push(curr);
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// Pull back from corner along each segment
|
|
423
|
+
const t1 = radius / d1;
|
|
424
|
+
const t2 = radius / d2;
|
|
425
|
+
const pullBack1 = lerp(cornerPt, prevPt, t1);
|
|
426
|
+
const pullBack2 = lerp(cornerPt, nextPt, t2);
|
|
427
|
+
|
|
428
|
+
// L to the pull-back point, then Q through the corner to the other pull-back
|
|
429
|
+
result.push({
|
|
430
|
+
type: 'L',
|
|
431
|
+
x: pullBack1.x,
|
|
432
|
+
y: pullBack1.y
|
|
433
|
+
});
|
|
434
|
+
result.push({
|
|
435
|
+
type: 'Q',
|
|
436
|
+
cx: cornerPt.x,
|
|
437
|
+
cy: cornerPt.y,
|
|
438
|
+
x: pullBack2.x,
|
|
439
|
+
y: pullBack2.y
|
|
440
|
+
});
|
|
441
|
+
} else {
|
|
442
|
+
result.push(curr);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
return serializePath(result);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// =============================================================================
|
|
449
|
+
// Segment Curvature
|
|
450
|
+
// =============================================================================
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Bow straight line segments by replacing L with Q.
|
|
454
|
+
*
|
|
455
|
+
* @param d - SVG path d-string
|
|
456
|
+
* @param curvature - 0-1 percentile. 0 = straight. 1 = max bow.
|
|
457
|
+
* @returns Modified d-string with curved segments
|
|
458
|
+
*/
|
|
459
|
+
export function addCurvature(d, curvature) {
|
|
460
|
+
if (curvature <= 0) {
|
|
461
|
+
return d;
|
|
462
|
+
}
|
|
463
|
+
curvature = Math.min(1, curvature);
|
|
464
|
+
const cmds = parsePath(d);
|
|
465
|
+
const result = [];
|
|
466
|
+
for (let i = 0; i < cmds.length; i++) {
|
|
467
|
+
const prev = i > 0 ? cmds[i - 1] : null;
|
|
468
|
+
const curr = cmds[i];
|
|
469
|
+
if (curr.type === 'L' && prev) {
|
|
470
|
+
const prevPt = getEndpoint(prev);
|
|
471
|
+
if (!prevPt) {
|
|
472
|
+
result.push(curr);
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
const endPt = {
|
|
476
|
+
x: curr.x,
|
|
477
|
+
y: curr.y
|
|
478
|
+
};
|
|
479
|
+
const segLen = dist(prevPt, endPt);
|
|
480
|
+
|
|
481
|
+
// Only bow segments longer than a threshold
|
|
482
|
+
if (segLen < 2) {
|
|
483
|
+
result.push(curr);
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// Midpoint
|
|
488
|
+
const mid = lerp(prevPt, endPt, 0.5);
|
|
489
|
+
|
|
490
|
+
// Perpendicular direction
|
|
491
|
+
const dx = endPt.x - prevPt.x;
|
|
492
|
+
const dy = endPt.y - prevPt.y;
|
|
493
|
+
const perpX = -dy / segLen;
|
|
494
|
+
const perpY = dx / segLen;
|
|
495
|
+
|
|
496
|
+
// Offset = segment length × curvature × scale factor
|
|
497
|
+
const offset = segLen * curvature * 0.25;
|
|
498
|
+
|
|
499
|
+
// Control point offset perpendicular to the line
|
|
500
|
+
const cp = {
|
|
501
|
+
x: mid.x + perpX * offset,
|
|
502
|
+
y: mid.y + perpY * offset
|
|
503
|
+
};
|
|
504
|
+
result.push({
|
|
505
|
+
type: 'Q',
|
|
506
|
+
cx: cp.x,
|
|
507
|
+
cy: cp.y,
|
|
508
|
+
x: endPt.x,
|
|
509
|
+
y: endPt.y
|
|
510
|
+
});
|
|
511
|
+
} else {
|
|
512
|
+
result.push(curr);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
return serializePath(result);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// =============================================================================
|
|
519
|
+
// Tension
|
|
520
|
+
// =============================================================================
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Adjust tension on existing bezier curves.
|
|
524
|
+
*
|
|
525
|
+
* @param d - SVG path d-string
|
|
526
|
+
* @param tension - 0-1. 0 = loose (curves balloon). 0.5 = unchanged. 1 = tight.
|
|
527
|
+
* @returns Modified d-string
|
|
528
|
+
*/
|
|
529
|
+
export function adjustTension(d, tension) {
|
|
530
|
+
if (tension === 0.5) {
|
|
531
|
+
return d;
|
|
532
|
+
}
|
|
533
|
+
const cmds = parsePath(d);
|
|
534
|
+
const result = [];
|
|
535
|
+
// Scale factor: tension 0 → 1.5 (looser), tension 0.5 → 1.0, tension 1 → 0.5 (tighter)
|
|
536
|
+
const scale = 1.5 - tension;
|
|
537
|
+
for (let i = 0; i < cmds.length; i++) {
|
|
538
|
+
const prev = i > 0 ? cmds[i - 1] : null;
|
|
539
|
+
const curr = cmds[i];
|
|
540
|
+
if (curr.type === 'C' && prev) {
|
|
541
|
+
const start = getEndpoint(prev) || {
|
|
542
|
+
x: 0,
|
|
543
|
+
y: 0
|
|
544
|
+
};
|
|
545
|
+
const end = {
|
|
546
|
+
x: curr.x,
|
|
547
|
+
y: curr.y
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
// Scale control points relative to their anchor
|
|
551
|
+
const cp1 = {
|
|
552
|
+
x: start.x + (curr.x1 - start.x) * scale,
|
|
553
|
+
y: start.y + (curr.y1 - start.y) * scale
|
|
554
|
+
};
|
|
555
|
+
const cp2 = {
|
|
556
|
+
x: end.x + (curr.x2 - end.x) * scale,
|
|
557
|
+
y: end.y + (curr.y2 - end.y) * scale
|
|
558
|
+
};
|
|
559
|
+
result.push({
|
|
560
|
+
type: 'C',
|
|
561
|
+
x1: cp1.x,
|
|
562
|
+
y1: cp1.y,
|
|
563
|
+
x2: cp2.x,
|
|
564
|
+
y2: cp2.y,
|
|
565
|
+
x: end.x,
|
|
566
|
+
y: end.y
|
|
567
|
+
});
|
|
568
|
+
} else if (curr.type === 'Q' && prev) {
|
|
569
|
+
const start = getEndpoint(prev) || {
|
|
570
|
+
x: 0,
|
|
571
|
+
y: 0
|
|
572
|
+
};
|
|
573
|
+
const end = {
|
|
574
|
+
x: curr.x,
|
|
575
|
+
y: curr.y
|
|
576
|
+
};
|
|
577
|
+
const mid = lerp(start, end, 0.5);
|
|
578
|
+
|
|
579
|
+
// Scale control point relative to the midpoint of the chord
|
|
580
|
+
const cp = {
|
|
581
|
+
x: mid.x + (curr.cx - mid.x) * scale,
|
|
582
|
+
y: mid.y + (curr.cy - mid.y) * scale
|
|
583
|
+
};
|
|
584
|
+
result.push({
|
|
585
|
+
type: 'Q',
|
|
586
|
+
cx: cp.x,
|
|
587
|
+
cy: cp.y,
|
|
588
|
+
x: end.x,
|
|
589
|
+
y: end.y
|
|
590
|
+
});
|
|
591
|
+
} else {
|
|
592
|
+
result.push(curr);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return serializePath(result);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// =============================================================================
|
|
599
|
+
// Combined Transform
|
|
600
|
+
// =============================================================================
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Apply all personality transforms to a path d-string.
|
|
604
|
+
* Order: corner rounding → segment curvature → tension.
|
|
605
|
+
*/
|
|
606
|
+
export function applyPersonality(d, personality) {
|
|
607
|
+
let result = d;
|
|
608
|
+
if (personality.cornerRounding != null && personality.cornerRounding > 0) {
|
|
609
|
+
result = roundCorners(result, personality.cornerRounding);
|
|
610
|
+
}
|
|
611
|
+
if (personality.segmentCurvature != null && personality.segmentCurvature > 0) {
|
|
612
|
+
result = addCurvature(result, personality.segmentCurvature);
|
|
613
|
+
}
|
|
614
|
+
if (personality.tension != null && personality.tension !== 0.5) {
|
|
615
|
+
result = adjustTension(result, personality.tension);
|
|
616
|
+
}
|
|
617
|
+
return result;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
// =============================================================================
|
|
621
|
+
// Serializer
|
|
622
|
+
// =============================================================================
|
|
623
|
+
|
|
624
|
+
function n(v) {
|
|
625
|
+
return Number(v.toFixed(3)).toString();
|
|
626
|
+
}
|
|
627
|
+
function serializePath(cmds) {
|
|
628
|
+
return cmds.map(cmd => {
|
|
629
|
+
switch (cmd.type) {
|
|
630
|
+
case 'M':
|
|
631
|
+
return `M${n(cmd.x)} ${n(cmd.y)}`;
|
|
632
|
+
case 'L':
|
|
633
|
+
return `L${n(cmd.x)} ${n(cmd.y)}`;
|
|
634
|
+
case 'C':
|
|
635
|
+
return `C${n(cmd.x1)} ${n(cmd.y1)} ${n(cmd.x2)} ${n(cmd.y2)} ${n(cmd.x)} ${n(cmd.y)}`;
|
|
636
|
+
case 'Q':
|
|
637
|
+
return `Q${n(cmd.cx)} ${n(cmd.cy)} ${n(cmd.x)} ${n(cmd.y)}`;
|
|
638
|
+
case 'A':
|
|
639
|
+
return `A${n(cmd.rx)} ${n(cmd.ry)} ${n(cmd.rotation)} ${cmd.large} ${cmd.sweep} ${n(cmd.x)} ${n(cmd.y)}`;
|
|
640
|
+
case 'Z':
|
|
641
|
+
return 'Z';
|
|
642
|
+
}
|
|
643
|
+
}).join(' ');
|
|
644
|
+
}
|