@zendir/ui 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/README.md +640 -631
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/index.js +17 -221
- package/dist/react/3d/CesiumCaptureSource.d.ts +0 -1
- package/dist/react/3d/CesiumCaptureSource.js +364 -283
- package/dist/react/3d/CesiumCaptureSource.js.map +1 -1
- package/dist/react/3d/ZenSpace3D.d.ts +2 -3
- package/dist/react/3d/ZenSpace3D.js +1681 -1237
- package/dist/react/3d/ZenSpace3D.js.map +1 -1
- package/dist/react/3d/ZenSpace3DCesium.d.ts +0 -1
- package/dist/react/3d/ZenSpace3DCesium.js +513 -560
- package/dist/react/3d/ZenSpace3DCesium.js.map +1 -1
- package/dist/react/3d/ZenSpace3DShaders.js +61 -66
- package/dist/react/3d/ZenSpace3DShaders.js.map +1 -1
- package/dist/react/3d/ZenSpace3DTypes.d.ts +19 -20
- package/dist/react/3d/ZenSpace3DUtils.d.ts +0 -1
- package/dist/react/3d/ZenSpace3DUtils.js +37 -24
- package/dist/react/3d/ZenSpace3DUtils.js.map +1 -1
- package/dist/react/3d/capturePngAnalysis.js +42 -36
- package/dist/react/3d/capturePngAnalysis.js.map +1 -1
- package/dist/react/3d/index.d.ts +3 -3
- package/dist/react/3d/index.js +5 -53
- package/dist/react/3d/threeLoader.d.ts +1 -1
- package/dist/react/3d/threeLoader.js +23 -18
- package/dist/react/3d/threeLoader.js.map +1 -1
- package/dist/react/astro/ClassificationBanner.d.ts +2 -3
- package/dist/react/astro/ClassificationBanner.js +95 -79
- package/dist/react/astro/ClassificationBanner.js.map +1 -1
- package/dist/react/astro/GlobalStatusBar.d.ts +0 -1
- package/dist/react/astro/GlobalStatusBar.js +157 -163
- package/dist/react/astro/GlobalStatusBar.js.map +1 -1
- package/dist/react/astro/MissionClock.d.ts +7 -8
- package/dist/react/astro/MissionClock.js +377 -400
- package/dist/react/astro/MissionClock.js.map +1 -1
- package/dist/react/astro/MonitoringIcon.d.ts +1 -2
- package/dist/react/astro/MonitoringIcon.js +422 -358
- package/dist/react/astro/MonitoringIcon.js.map +1 -1
- package/dist/react/astro/Notification.d.ts +1 -2
- package/dist/react/astro/Notification.js +229 -126
- package/dist/react/astro/Notification.js.map +1 -1
- package/dist/react/astro/Progress.d.ts +0 -1
- package/dist/react/astro/Progress.js +199 -141
- package/dist/react/astro/Progress.js.map +1 -1
- package/dist/react/astro/SimulationControls.d.ts +3 -4
- package/dist/react/astro/SimulationControls.js +596 -650
- package/dist/react/astro/SimulationControls.js.map +1 -1
- package/dist/react/astro/StatusIndicator.d.ts +0 -1
- package/dist/react/astro/StatusIndicator.js +236 -170
- package/dist/react/astro/StatusIndicator.js.map +1 -1
- package/dist/react/astro/UnifiedTimeline.d.ts +9 -10
- package/dist/react/astro/UnifiedTimeline.js +2345 -2392
- package/dist/react/astro/UnifiedTimeline.js.map +1 -1
- package/dist/react/astro/index.d.ts +5 -5
- package/dist/react/astro/index.js +1 -25
- package/dist/react/cards/AccessCard.d.ts +0 -1
- package/dist/react/cards/AccessCard.js +471 -405
- package/dist/react/cards/AccessCard.js.map +1 -1
- package/dist/react/cards/OrbitCard.d.ts +0 -1
- package/dist/react/cards/OrbitCard.js +487 -364
- package/dist/react/cards/OrbitCard.js.map +1 -1
- package/dist/react/cards/SpacecraftCard.d.ts +0 -1
- package/dist/react/cards/SpacecraftCard.js +813 -925
- package/dist/react/cards/SpacecraftCard.js.map +1 -1
- package/dist/react/cards/TelemetryCard.d.ts +0 -1
- package/dist/react/cards/TelemetryCard.js +1055 -732
- package/dist/react/cards/TelemetryCard.js.map +1 -1
- package/dist/react/cards/TelemetryStreamCard.d.ts +0 -1
- package/dist/react/cards/TelemetryStreamCard.js +323 -297
- package/dist/react/cards/TelemetryStreamCard.js.map +1 -1
- package/dist/react/cards/index.d.ts +1 -1
- package/dist/react/cards/index.js +1 -8
- package/dist/react/charts/GroundTrackMap.d.ts +6 -7
- package/dist/react/charts/GroundTrackMap.js +1377 -1256
- package/dist/react/charts/GroundTrackMap.js.map +1 -1
- package/dist/react/charts/GroundTrackMapLeaflet.d.ts +1 -2
- package/dist/react/charts/GroundTrackMapLeaflet.js +1065 -987
- package/dist/react/charts/GroundTrackMapLeaflet.js.map +1 -1
- package/dist/react/charts/groundTrackMapLeafletTiles.js +34 -25
- package/dist/react/charts/groundTrackMapLeafletTiles.js.map +1 -1
- package/dist/react/charts/groundTrackMapLeafletUtils.js +70 -61
- package/dist/react/charts/groundTrackMapLeafletUtils.js.map +1 -1
- package/dist/react/charts/index.d.ts +1 -1
- package/dist/react/charts/index.js +7 -100
- package/dist/react/charts/unified/AstroChart.d.ts +1 -2
- package/dist/react/charts/unified/AstroChart.js +1331 -1411
- package/dist/react/charts/unified/AstroChart.js.map +1 -1
- package/dist/react/charts/unified/PowerOverviewChart.d.ts +3 -3
- package/dist/react/charts/unified/PowerOverviewChart.js +495 -478
- package/dist/react/charts/unified/PowerOverviewChart.js.map +1 -1
- package/dist/react/charts/unified/domain.d.ts +12 -13
- package/dist/react/charts/unified/domain.js +3999 -3145
- package/dist/react/charts/unified/domain.js.map +1 -1
- package/dist/react/charts/unified/generators.d.ts +3 -4
- package/dist/react/charts/unified/generators.js +561 -498
- package/dist/react/charts/unified/generators.js.map +1 -1
- package/dist/react/charts/unified/index.d.ts +1 -1
- package/dist/react/charts/unified/presets.d.ts +14 -15
- package/dist/react/charts/unified/presets.js +857 -994
- package/dist/react/charts/unified/presets.js.map +1 -1
- package/dist/react/charts/unified/sync.d.ts +2 -3
- package/dist/react/charts/unified/sync.js +229 -195
- package/dist/react/charts/unified/sync.js.map +1 -1
- package/dist/react/charts/unified/theme.d.ts +11 -12
- package/dist/react/charts/unified/theme.js +606 -642
- package/dist/react/charts/unified/theme.js.map +1 -1
- package/dist/react/charts/unified/types.d.ts +32 -33
- package/dist/react/charts/unified/useChartStream.d.ts +1 -2
- package/dist/react/charts/unified/useChartStream.js +203 -216
- package/dist/react/charts/unified/useChartStream.js.map +1 -1
- package/dist/react/chatgpt/AppCard.d.ts +1 -2
- package/dist/react/chatgpt/index.d.ts +7 -7
- package/dist/react/chatgpt/index.js +160 -139
- package/dist/react/chatgpt/index.js.map +1 -1
- package/dist/react/context/CategoryContext.d.ts +0 -1
- package/dist/react/context/CategoryContext.js +78 -29
- package/dist/react/context/CategoryContext.js.map +1 -1
- package/dist/react/context/DisplaySettingsContext.d.ts +1 -2
- package/dist/react/context/DisplaySettingsContext.js +205 -156
- package/dist/react/context/DisplaySettingsContext.js.map +1 -1
- package/dist/react/context/SpatialSelectionContext.d.ts +0 -1
- package/dist/react/context/SpatialSelectionContext.js +36 -7
- package/dist/react/context/SpatialSelectionContext.js.map +1 -1
- package/dist/react/core/data/DataTable.d.ts +3 -4
- package/dist/react/core/data/DataTable.js +473 -440
- package/dist/react/core/data/DataTable.js.map +1 -1
- package/dist/react/core/data/DataValue.d.ts +4 -5
- package/dist/react/core/data/DataValue.js +605 -538
- package/dist/react/core/data/DataValue.js.map +1 -1
- package/dist/react/core/data/propertyConfig.d.ts +1 -2
- package/dist/react/core/data/propertyConfig.js +446 -382
- package/dist/react/core/data/propertyConfig.js.map +1 -1
- package/dist/react/core/display/AstroIcon.d.ts +4 -5
- package/dist/react/core/display/AstroIcon.js +339 -429
- package/dist/react/core/display/AstroIcon.js.map +1 -1
- package/dist/react/core/display/Badge.d.ts +2 -3
- package/dist/react/core/display/Badge.js +131 -131
- package/dist/react/core/display/Badge.js.map +1 -1
- package/dist/react/core/display/CardHeader.d.ts +0 -1
- package/dist/react/core/display/CardHeader.js +398 -311
- package/dist/react/core/display/CardHeader.js.map +1 -1
- package/dist/react/core/display/Container.d.ts +2 -3
- package/dist/react/core/display/Container.js +640 -668
- package/dist/react/core/display/Container.js.map +1 -1
- package/dist/react/core/display/CopyButton.d.ts +1 -2
- package/dist/react/core/display/CopyButton.js +158 -101
- package/dist/react/core/display/CopyButton.js.map +1 -1
- package/dist/react/core/display/GlassCard.d.ts +3 -4
- package/dist/react/core/display/GlassCard.js +416 -369
- package/dist/react/core/display/GlassCard.js.map +1 -1
- package/dist/react/core/display/HeaderIconWithStatus.d.ts +0 -1
- package/dist/react/core/display/HeaderIconWithStatus.js +152 -152
- package/dist/react/core/display/HeaderIconWithStatus.js.map +1 -1
- package/dist/react/core/display/Icon.d.ts +2 -3
- package/dist/react/core/display/Icon.js +172 -143
- package/dist/react/core/display/Icon.js.map +1 -1
- package/dist/react/core/display/Typography.d.ts +24 -25
- package/dist/react/core/display/Typography.js +360 -178
- package/dist/react/core/display/Typography.js.map +1 -1
- package/dist/react/core/feedback/ConfirmDialog.d.ts +1 -2
- package/dist/react/core/feedback/ConfirmDialog.js +343 -304
- package/dist/react/core/feedback/ConfirmDialog.js.map +1 -1
- package/dist/react/core/feedback/Dialog.d.ts +2 -3
- package/dist/react/core/feedback/Dialog.js +189 -197
- package/dist/react/core/feedback/Dialog.js.map +1 -1
- package/dist/react/core/feedback/Toast.d.ts +2 -3
- package/dist/react/core/feedback/Toast.js +346 -207
- package/dist/react/core/feedback/Toast.js.map +1 -1
- package/dist/react/core/index.d.ts +26 -26
- package/dist/react/core/index.js +7 -119
- package/dist/react/core/inputs/Button.d.ts +2 -3
- package/dist/react/core/inputs/Button.js +281 -304
- package/dist/react/core/inputs/Button.js.map +1 -1
- package/dist/react/core/inputs/Checkbox.d.ts +2 -3
- package/dist/react/core/inputs/Checkbox.js +139 -127
- package/dist/react/core/inputs/Checkbox.js.map +1 -1
- package/dist/react/core/inputs/Input.d.ts +3 -4
- package/dist/react/core/inputs/Input.js +277 -285
- package/dist/react/core/inputs/Input.js.map +1 -1
- package/dist/react/core/inputs/LimitsBar.d.ts +1 -2
- package/dist/react/core/inputs/LimitsBar.js +271 -196
- package/dist/react/core/inputs/LimitsBar.js.map +1 -1
- package/dist/react/core/inputs/NumberInput.d.ts +2 -3
- package/dist/react/core/inputs/NumberInput.js +531 -503
- package/dist/react/core/inputs/NumberInput.js.map +1 -1
- package/dist/react/core/inputs/PinInput.d.ts +2 -3
- package/dist/react/core/inputs/PinInput.js +224 -207
- package/dist/react/core/inputs/PinInput.js.map +1 -1
- package/dist/react/core/inputs/Select.d.ts +1 -2
- package/dist/react/core/inputs/Select.js +298 -299
- package/dist/react/core/inputs/Select.js.map +1 -1
- package/dist/react/core/inputs/Toggle.d.ts +2 -3
- package/dist/react/core/inputs/Toggle.js +142 -148
- package/dist/react/core/inputs/Toggle.js.map +1 -1
- package/dist/react/core/layout/Box.d.ts +3 -4
- package/dist/react/core/layout/Box.js +118 -122
- package/dist/react/core/layout/Box.js.map +1 -1
- package/dist/react/core/layout/Center.d.ts +0 -1
- package/dist/react/core/layout/Center.js +45 -32
- package/dist/react/core/layout/Center.js.map +1 -1
- package/dist/react/core/layout/Divider.d.ts +1 -2
- package/dist/react/core/layout/Divider.js +112 -106
- package/dist/react/core/layout/Divider.js.map +1 -1
- package/dist/react/core/layout/Flex.d.ts +4 -5
- package/dist/react/core/layout/Flex.js +120 -124
- package/dist/react/core/layout/Flex.js.map +1 -1
- package/dist/react/core/layout/Grid.d.ts +5 -6
- package/dist/react/core/layout/Grid.js +131 -138
- package/dist/react/core/layout/Grid.js.map +1 -1
- package/dist/react/core/layout/Spacer.d.ts +0 -1
- package/dist/react/core/layout/Spacer.js +36 -29
- package/dist/react/core/layout/Spacer.js.map +1 -1
- package/dist/react/core/layout/Stack.d.ts +4 -5
- package/dist/react/core/layout/Stack.js +127 -70
- package/dist/react/core/layout/Stack.js.map +1 -1
- package/dist/react/core/layout/responsive.d.ts +1 -2
- package/dist/react/core/layout/responsive.js +25 -19
- package/dist/react/core/layout/responsive.js.map +1 -1
- package/dist/react/core/layout/useBreakpoint.d.ts +1 -1
- package/dist/react/core/layout/useBreakpoint.js +119 -66
- package/dist/react/core/layout/useBreakpoint.js.map +1 -1
- package/dist/react/core/navigation/AppBar.d.ts +1 -2
- package/dist/react/core/navigation/AppBar.js +827 -805
- package/dist/react/core/navigation/AppBar.js.map +1 -1
- package/dist/react/core/navigation/Pagination.d.ts +2 -3
- package/dist/react/core/navigation/Pagination.js +207 -187
- package/dist/react/core/navigation/Pagination.js.map +1 -1
- package/dist/react/core/navigation/SideNav.d.ts +11 -5
- package/dist/react/core/navigation/SideNav.js +857 -602
- package/dist/react/core/navigation/SideNav.js.map +1 -1
- package/dist/react/core/navigation/Tabs.d.ts +0 -1
- package/dist/react/core/navigation/Tabs.js +113 -119
- package/dist/react/core/navigation/Tabs.js.map +1 -1
- package/dist/react/core/overlays/Popover.d.ts +2 -3
- package/dist/react/core/overlays/Popover.js +303 -282
- package/dist/react/core/overlays/Popover.js.map +1 -1
- package/dist/react/core/overlays/SidePanel.d.ts +1 -2
- package/dist/react/core/overlays/SidePanel.js +217 -212
- package/dist/react/core/overlays/SidePanel.js.map +1 -1
- package/dist/react/core/overlays/Tooltip.d.ts +1 -2
- package/dist/react/core/overlays/Tooltip.js +170 -176
- package/dist/react/core/overlays/Tooltip.js.map +1 -1
- package/dist/react/core/widgets/ActivityPlanner.d.ts +0 -1
- package/dist/react/core/widgets/ActivityPlanner.js +855 -517
- package/dist/react/core/widgets/ActivityPlanner.js.map +1 -1
- package/dist/react/core/widgets/Capture.d.ts +2 -3
- package/dist/react/core/widgets/Capture.js +965 -779
- package/dist/react/core/widgets/Capture.js.map +1 -1
- package/dist/react/core/widgets/ChatPanel.d.ts +16 -17
- package/dist/react/core/widgets/ChatPanel.js +1734 -1034
- package/dist/react/core/widgets/ChatPanel.js.map +1 -1
- package/dist/react/core/widgets/ColorPickerPanel.d.ts +0 -1
- package/dist/react/core/widgets/ColorPickerPanel.js +298 -287
- package/dist/react/core/widgets/ColorPickerPanel.js.map +1 -1
- package/dist/react/core/widgets/CommandBuilder.d.ts +2 -3
- package/dist/react/core/widgets/CommandBuilder.js +624 -516
- package/dist/react/core/widgets/CommandBuilder.js.map +1 -1
- package/dist/react/core/widgets/ConnectionForm.d.ts +2 -3
- package/dist/react/core/widgets/ConnectionForm.js +528 -492
- package/dist/react/core/widgets/ConnectionForm.js.map +1 -1
- package/dist/react/core/widgets/FileExplorer.d.ts +3 -4
- package/dist/react/core/widgets/FileExplorer.js +617 -505
- package/dist/react/core/widgets/FileExplorer.js.map +1 -1
- package/dist/react/core/widgets/HexViewer.d.ts +2 -3
- package/dist/react/core/widgets/HexViewer.js +1353 -1091
- package/dist/react/core/widgets/HexViewer.js.map +1 -1
- package/dist/react/core/widgets/ImageFrame.d.ts +1 -2
- package/dist/react/core/widgets/ImageFrame.js +230 -193
- package/dist/react/core/widgets/ImageFrame.js.map +1 -1
- package/dist/react/core/widgets/ImageGallery.d.ts +2 -1
- package/dist/react/core/widgets/ImageGallery.js +380 -314
- package/dist/react/core/widgets/ImageGallery.js.map +1 -1
- package/dist/react/core/widgets/ImagePanel.d.ts +0 -1
- package/dist/react/core/widgets/ImagePanel.js +110 -101
- package/dist/react/core/widgets/ImagePanel.js.map +1 -1
- package/dist/react/core/widgets/LogViewer.d.ts +2 -3
- package/dist/react/core/widgets/LogViewer.js +711 -607
- package/dist/react/core/widgets/LogViewer.js.map +1 -1
- package/dist/react/core/widgets/MessageStream.d.ts +3 -4
- package/dist/react/core/widgets/MessageStream.js +514 -444
- package/dist/react/core/widgets/MessageStream.js.map +1 -1
- package/dist/react/core/widgets/MissionCalendar.d.ts +3 -4
- package/dist/react/core/widgets/MissionCalendar.js +1488 -1020
- package/dist/react/core/widgets/MissionCalendar.js.map +1 -1
- package/dist/react/core/widgets/PacketViewer.d.ts +2 -3
- package/dist/react/core/widgets/PacketViewer.js +550 -421
- package/dist/react/core/widgets/PacketViewer.js.map +1 -1
- package/dist/react/core/widgets/capture-placeholder.png.js +6 -5
- package/dist/react/core/widgets/capture-placeholder.png.js.map +1 -1
- package/dist/react/hooks/index.d.ts +5 -5
- package/dist/react/hooks/useAccessWindows.d.ts +0 -1
- package/dist/react/hooks/useCompactMode.d.ts +1 -1
- package/dist/react/hooks/useCompactMode.js +104 -58
- package/dist/react/hooks/useCompactMode.js.map +1 -1
- package/dist/react/hooks/useGroundTrackHistory.d.ts +0 -1
- package/dist/react/hooks/useSimulationScene.d.ts +1 -2
- package/dist/react/hooks/useSimulationScene.js +481 -374
- package/dist/react/hooks/useSimulationScene.js.map +1 -1
- package/dist/react/index.d.ts +3 -3
- package/dist/react/panels/LayerControlPanel.d.ts +1 -2
- package/dist/react/panels/LayerControlPanel.js +223 -180
- package/dist/react/panels/LayerControlPanel.js.map +1 -1
- package/dist/react/panels/ObjectInventoryPanel.d.ts +2 -3
- package/dist/react/panels/ObjectInventoryPanel.js +315 -250
- package/dist/react/panels/ObjectInventoryPanel.js.map +1 -1
- package/dist/react/panels/index.d.ts +1 -1
- package/dist/react/panels/index.js +1 -6
- package/dist/react/shared/ErrorBoundary.d.ts +1 -2
- package/dist/react/shared/ErrorBoundary.js +170 -139
- package/dist/react/shared/ErrorBoundary.js.map +1 -1
- package/dist/react/shared/Skeleton.d.ts +1 -2
- package/dist/react/shared/Skeleton.js +300 -301
- package/dist/react/shared/Skeleton.js.map +1 -1
- package/dist/react/theme/ThemeProvider.d.ts +2 -321
- package/dist/react/theme/ThemeProvider.js +312 -939
- package/dist/react/theme/ThemeProvider.js.map +1 -1
- package/dist/react/theme/cardAccent.d.ts +1 -2
- package/dist/react/theme/cardAccent.js +196 -126
- package/dist/react/theme/cardAccent.js.map +1 -1
- package/dist/react/theme/config.d.ts +0 -1
- package/dist/react/theme/config.js +47 -25
- package/dist/react/theme/config.js.map +1 -1
- package/dist/react/theme/index.d.ts +2 -2
- package/dist/react/theme/index.js +1 -16
- package/dist/react/theme/types.d.ts +332 -0
- package/dist/react/theme/types.js +39 -0
- package/dist/react/theme/types.js.map +1 -0
- package/dist/react/types.d.ts +8 -8
- package/dist/react/types.js +147 -47
- package/dist/react/types.js.map +1 -1
- package/dist/react/utils/categoryPalette.d.ts +0 -1
- package/dist/react/utils/categoryPalette.js +91 -102
- package/dist/react/utils/categoryPalette.js.map +1 -1
- package/dist/react/utils/index.d.ts +5 -5
- package/dist/react/utils/index.js +457 -371
- package/dist/react/utils/index.js.map +1 -1
- package/dist/react/visualizations/EclipseTimerCard.d.ts +0 -1
- package/dist/react/visualizations/LinkBudgetCard.d.ts +0 -1
- package/dist/react/visualizations/NavBallCard.d.ts +0 -1
- package/dist/react/visualizations/PropulsionCard.d.ts +1 -2
- package/dist/react/visualizations/SensorFootprintCard.d.ts +1 -2
- package/dist/react/visualizations/ThermalHeatmapCard.d.ts +0 -1
- package/dist/react/visualizations/index.d.ts +3 -3
- package/dist/react.d.ts +2 -1
- package/dist/react.js +17 -221
- package/dist/shaders/atmosphere.frag.js +6 -5
- package/dist/shaders/atmosphere.frag.js.map +1 -1
- package/dist/shaders/atmosphere.vert.js +6 -5
- package/dist/shaders/atmosphere.vert.js.map +1 -1
- package/dist/shaders/stars.frag.js +6 -5
- package/dist/shaders/stars.frag.js.map +1 -1
- package/dist/shaders/stars.vert.js +6 -5
- package/dist/shaders/stars.vert.js.map +1 -1
- package/dist/style.css +217 -194
- package/dist/tokens/core.d.ts +159 -0
- package/dist/tokens/core.js +144 -0
- package/dist/tokens/core.js.map +1 -0
- package/dist/tokens/css-vars.d.ts +213 -2
- package/dist/tokens/css-vars.js +590 -227
- package/dist/tokens/css-vars.js.map +1 -1
- package/dist/tokens/index.d.ts +31 -228
- package/dist/tokens/index.js +281 -366
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/palettes/astro.d.ts +129 -0
- package/dist/tokens/palettes/astro.js +112 -0
- package/dist/tokens/palettes/astro.js.map +1 -0
- package/dist/tokens/palettes/index.d.ts +288 -0
- package/dist/tokens/palettes/index.js +35 -0
- package/dist/tokens/palettes/index.js.map +1 -0
- package/dist/tokens/palettes/tailwind.d.ts +324 -0
- package/dist/tokens/palettes/tailwind.js +201 -0
- package/dist/tokens/palettes/tailwind.js.map +1 -0
- package/dist/tokens/palettes/zendir.d.ts +126 -0
- package/dist/tokens/palettes/zendir.js +92 -0
- package/dist/tokens/palettes/zendir.js.map +1 -0
- package/dist/tokens/themes.d.ts +30 -0
- package/dist/tokens/themes.js +704 -0
- package/dist/tokens/themes.js.map +1 -0
- package/dist/tokens/tokens.css +419 -41
- package/dist/types/index.d.ts +2 -2
- package/package.json +310 -313
- package/dist/index.js.map +0 -1
- package/dist/react/3d/index.js.map +0 -1
- package/dist/react/astro/index.js.map +0 -1
- package/dist/react/cards/index.js.map +0 -1
- package/dist/react/charts/index.js.map +0 -1
- package/dist/react/core/index.js.map +0 -1
- package/dist/react/panels/index.js.map +0 -1
- package/dist/react/theme/astro-tokens.d.ts +0 -153
- package/dist/react/theme/index.js.map +0 -1
- package/dist/react.js.map +0 -1
|
@@ -1,219 +1,253 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
//#region src/react/charts/unified/sync.ts
|
|
3
|
+
/**
|
|
4
|
+
* @zendir/ui - Chart Synchronization Utilities
|
|
5
|
+
*
|
|
6
|
+
* Enables crosshair, tooltip, and zoom synchronization across multiple charts.
|
|
7
|
+
* Useful for dashboard views with related time-series data.
|
|
8
|
+
*/
|
|
9
|
+
var syncGroups = /* @__PURE__ */ new Map();
|
|
10
|
+
/**
|
|
11
|
+
* Create or get a sync group
|
|
12
|
+
*/
|
|
3
13
|
function getOrCreateGroup(groupId, options = {}) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
let group = syncGroups.get(groupId);
|
|
15
|
+
if (!group) {
|
|
16
|
+
group = {
|
|
17
|
+
id: groupId,
|
|
18
|
+
charts: /* @__PURE__ */ new Set(),
|
|
19
|
+
options: {
|
|
20
|
+
tooltip: true,
|
|
21
|
+
crosshair: true,
|
|
22
|
+
zoom: true,
|
|
23
|
+
legend: true,
|
|
24
|
+
...options
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
syncGroups.set(groupId, group);
|
|
28
|
+
}
|
|
29
|
+
return group;
|
|
20
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Register a chart with a sync group
|
|
33
|
+
*/
|
|
21
34
|
function registerChart(groupId, chart) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
};
|
|
35
|
+
const group = getOrCreateGroup(groupId);
|
|
36
|
+
group.charts.add(chart);
|
|
37
|
+
const handlers = setupSyncHandlers(chart, group);
|
|
38
|
+
return () => {
|
|
39
|
+
handlers.forEach((cleanup) => cleanup());
|
|
40
|
+
group.charts.delete(chart);
|
|
41
|
+
if (group.charts.size === 0) syncGroups.delete(groupId);
|
|
42
|
+
};
|
|
32
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Setup synchronization event handlers
|
|
46
|
+
*/
|
|
33
47
|
function setupSyncHandlers(sourceChart, group) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
} catch (e) {
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
sourceChart.on("legendselectchanged", handleLegendSelect);
|
|
113
|
-
cleanups.push(() => sourceChart.off("legendselectchanged", handleLegendSelect));
|
|
114
|
-
}
|
|
115
|
-
return cleanups;
|
|
48
|
+
const cleanups = [];
|
|
49
|
+
if (group.options.tooltip || group.options.crosshair) {
|
|
50
|
+
const handleAxisPointer = (params) => {
|
|
51
|
+
const p = params;
|
|
52
|
+
group.charts.forEach((chart) => {
|
|
53
|
+
if (chart === sourceChart) return;
|
|
54
|
+
try {
|
|
55
|
+
if (p.axesInfo && p.axesInfo.length > 0) {
|
|
56
|
+
const axisInfo = p.axesInfo[0];
|
|
57
|
+
chart.dispatchAction({
|
|
58
|
+
type: "showTip",
|
|
59
|
+
x: axisInfo.value,
|
|
60
|
+
seriesIndex: 0
|
|
61
|
+
});
|
|
62
|
+
} else if (p.dataIndex !== void 0) chart.dispatchAction({
|
|
63
|
+
type: "showTip",
|
|
64
|
+
seriesIndex: p.seriesIndex || 0,
|
|
65
|
+
dataIndex: p.dataIndex
|
|
66
|
+
});
|
|
67
|
+
} catch (e) {}
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const handleMouseOut = () => {
|
|
71
|
+
group.charts.forEach((chart) => {
|
|
72
|
+
if (chart === sourceChart) return;
|
|
73
|
+
try {
|
|
74
|
+
chart.dispatchAction({ type: "hideTip" });
|
|
75
|
+
} catch (e) {}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
sourceChart.on("updateAxisPointer", handleAxisPointer);
|
|
79
|
+
sourceChart.getZr().on("mouseout", handleMouseOut);
|
|
80
|
+
cleanups.push(() => {
|
|
81
|
+
sourceChart.off("updateAxisPointer", handleAxisPointer);
|
|
82
|
+
sourceChart.getZr()?.off("mouseout", handleMouseOut);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (group.options.zoom) {
|
|
86
|
+
const handleDataZoom = (params) => {
|
|
87
|
+
const p = params;
|
|
88
|
+
const start = p.batch?.[0]?.start ?? p.start;
|
|
89
|
+
const end = p.batch?.[0]?.end ?? p.end;
|
|
90
|
+
if (start === void 0 || end === void 0) return;
|
|
91
|
+
group.charts.forEach((chart) => {
|
|
92
|
+
if (chart === sourceChart) return;
|
|
93
|
+
try {
|
|
94
|
+
chart.dispatchAction({
|
|
95
|
+
type: "dataZoom",
|
|
96
|
+
start,
|
|
97
|
+
end
|
|
98
|
+
});
|
|
99
|
+
} catch (e) {}
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
sourceChart.on("datazoom", handleDataZoom);
|
|
103
|
+
cleanups.push(() => sourceChart.off("datazoom", handleDataZoom));
|
|
104
|
+
}
|
|
105
|
+
if (group.options.legend) {
|
|
106
|
+
const handleLegendSelect = (params) => {
|
|
107
|
+
const p = params;
|
|
108
|
+
group.charts.forEach((chart) => {
|
|
109
|
+
if (chart === sourceChart) return;
|
|
110
|
+
try {
|
|
111
|
+
chart.dispatchAction({
|
|
112
|
+
type: "legendToggleSelect",
|
|
113
|
+
name: p.name
|
|
114
|
+
});
|
|
115
|
+
} catch (e) {}
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
sourceChart.on("legendselectchanged", handleLegendSelect);
|
|
119
|
+
cleanups.push(() => sourceChart.off("legendselectchanged", handleLegendSelect));
|
|
120
|
+
}
|
|
121
|
+
return cleanups;
|
|
116
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Hook to synchronize a chart with other charts in the same group
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```tsx
|
|
128
|
+
* const chartRef = useRef<AstroChartHandle>(null);
|
|
129
|
+
* useChartSync(chartRef, { groupId: 'dashboard-charts' });
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
117
132
|
function useChartSync(chartRef, options) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
const { groupId, enabled = true, ..._syncOptions } = options;
|
|
134
|
+
const cleanupRef = useRef(null);
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
if (!enabled) return;
|
|
137
|
+
const chart = chartRef.current?.getChart();
|
|
138
|
+
if (!chart) return;
|
|
139
|
+
cleanupRef.current = registerChart(groupId, chart);
|
|
140
|
+
return () => {
|
|
141
|
+
cleanupRef.current?.();
|
|
142
|
+
cleanupRef.current = null;
|
|
143
|
+
};
|
|
144
|
+
}, [
|
|
145
|
+
chartRef,
|
|
146
|
+
groupId,
|
|
147
|
+
enabled
|
|
148
|
+
]);
|
|
132
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Dispatch action to all charts in a group
|
|
152
|
+
*/
|
|
133
153
|
function dispatchToGroup(groupId, action) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
});
|
|
154
|
+
const group = syncGroups.get(groupId);
|
|
155
|
+
if (!group) return;
|
|
156
|
+
group.charts.forEach((chart) => {
|
|
157
|
+
try {
|
|
158
|
+
chart.dispatchAction(action);
|
|
159
|
+
} catch (e) {}
|
|
160
|
+
});
|
|
142
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Sync zoom range across all charts in a group
|
|
164
|
+
*/
|
|
143
165
|
function syncZoomRange(groupId, start, end) {
|
|
144
|
-
|
|
166
|
+
dispatchToGroup(groupId, {
|
|
167
|
+
type: "dataZoom",
|
|
168
|
+
start,
|
|
169
|
+
end
|
|
170
|
+
});
|
|
145
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Reset zoom for all charts in a group
|
|
174
|
+
*/
|
|
146
175
|
function resetGroupZoom(groupId) {
|
|
147
|
-
|
|
176
|
+
dispatchToGroup(groupId, {
|
|
177
|
+
type: "dataZoom",
|
|
178
|
+
start: 0,
|
|
179
|
+
end: 100
|
|
180
|
+
});
|
|
148
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Show tooltip at specific data index for all charts
|
|
184
|
+
*/
|
|
149
185
|
function showGroupTooltip(groupId, seriesIndex, dataIndex) {
|
|
150
|
-
|
|
186
|
+
dispatchToGroup(groupId, {
|
|
187
|
+
type: "showTip",
|
|
188
|
+
seriesIndex,
|
|
189
|
+
dataIndex
|
|
190
|
+
});
|
|
151
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Hide tooltip for all charts in a group
|
|
194
|
+
*/
|
|
152
195
|
function hideGroupTooltip(groupId) {
|
|
153
|
-
|
|
196
|
+
dispatchToGroup(groupId, { type: "hideTip" });
|
|
154
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Get all chart instances in a group
|
|
200
|
+
*/
|
|
155
201
|
function getGroupCharts(groupId) {
|
|
156
|
-
|
|
157
|
-
|
|
202
|
+
const group = syncGroups.get(groupId);
|
|
203
|
+
return group ? Array.from(group.charts) : [];
|
|
158
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Export all charts in a group as images
|
|
207
|
+
*/
|
|
159
208
|
function exportGroupAsImages(groupId, options = {}) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
});
|
|
209
|
+
const { type = "png", pixelRatio = 2, fileName: _fileName = "chart" } = options;
|
|
210
|
+
return getGroupCharts(groupId).map((chart, _index) => {
|
|
211
|
+
return chart.getDataURL({
|
|
212
|
+
type,
|
|
213
|
+
pixelRatio,
|
|
214
|
+
backgroundColor: "transparent"
|
|
215
|
+
});
|
|
216
|
+
});
|
|
169
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Export all charts in a group as a combined CSV
|
|
220
|
+
*/
|
|
170
221
|
function exportGroupAsCSV(groupId, options = {}) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
} else {
|
|
199
|
-
row.push("");
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
rows.push(row);
|
|
203
|
-
}
|
|
204
|
-
rows.push([]);
|
|
205
|
-
});
|
|
206
|
-
return rows.map((row) => row.join(",")).join("\n");
|
|
222
|
+
const { includeHeaders = true } = options;
|
|
223
|
+
const charts = getGroupCharts(groupId);
|
|
224
|
+
const rows = [];
|
|
225
|
+
charts.forEach((chart, chartIndex) => {
|
|
226
|
+
const series = chart.getOption().series;
|
|
227
|
+
if (!series || series.length === 0) return;
|
|
228
|
+
if (includeHeaders) {
|
|
229
|
+
rows.push([`Chart ${chartIndex + 1}`]);
|
|
230
|
+
rows.push(["Index", ...series.map((s) => s.name || `Series ${chartIndex}`)]);
|
|
231
|
+
}
|
|
232
|
+
const maxLen = Math.max(...series.map((s) => s.data?.length || 0));
|
|
233
|
+
for (let i = 0; i < maxLen; i++) {
|
|
234
|
+
const row = [i.toString()];
|
|
235
|
+
series.forEach((s) => {
|
|
236
|
+
const value = s.data?.[i];
|
|
237
|
+
if (typeof value === "number") row.push(value.toString());
|
|
238
|
+
else if (Array.isArray(value)) row.push(value[1]?.toString() || "");
|
|
239
|
+
else if (value && typeof value === "object") {
|
|
240
|
+
const v = value;
|
|
241
|
+
row.push((v.value ?? v.y)?.toString() || "");
|
|
242
|
+
} else row.push("");
|
|
243
|
+
});
|
|
244
|
+
rows.push(row);
|
|
245
|
+
}
|
|
246
|
+
rows.push([]);
|
|
247
|
+
});
|
|
248
|
+
return rows.map((row) => row.join(",")).join("\n");
|
|
207
249
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
getGroupCharts,
|
|
213
|
-
hideGroupTooltip,
|
|
214
|
-
resetGroupZoom,
|
|
215
|
-
showGroupTooltip,
|
|
216
|
-
syncZoomRange,
|
|
217
|
-
useChartSync
|
|
218
|
-
};
|
|
219
|
-
//# sourceMappingURL=sync.js.map
|
|
250
|
+
//#endregion
|
|
251
|
+
export { dispatchToGroup, exportGroupAsCSV, exportGroupAsImages, getGroupCharts, hideGroupTooltip, resetGroupZoom, showGroupTooltip, syncZoomRange, useChartSync };
|
|
252
|
+
|
|
253
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sources":["../../../../src/react/charts/unified/sync.ts"],"sourcesContent":["/**\n * @zendir/ui - Chart Synchronization Utilities\n * \n * Enables crosshair, tooltip, and zoom synchronization across multiple charts.\n * Useful for dashboard views with related time-series data.\n */\n\nimport { useEffect, useRef } from 'react';\nimport type { ECharts } from 'echarts';\nimport type { AstroChartHandle } from './AstroChart';\n\n// =============================================================================\n// Sync Group Manager\n// =============================================================================\n\ninterface SyncGroup {\n id: string;\n charts: Set<ECharts>;\n options: SyncGroupOptions;\n}\n\ninterface SyncGroupOptions {\n /** Sync tooltip position */\n tooltip?: boolean;\n /** Sync crosshair */\n crosshair?: boolean;\n /** Sync zoom/pan */\n zoom?: boolean;\n /** Sync legend selection */\n legend?: boolean;\n}\n\n// Global registry of sync groups\nconst syncGroups = new Map<string, SyncGroup>();\n\n/**\n * Create or get a sync group\n */\nfunction getOrCreateGroup(groupId: string, options: SyncGroupOptions = {}): SyncGroup {\n let group = syncGroups.get(groupId);\n if (!group) {\n group = {\n id: groupId,\n charts: new Set(),\n options: {\n tooltip: true,\n crosshair: true,\n zoom: true,\n legend: true,\n ...options,\n },\n };\n syncGroups.set(groupId, group);\n }\n return group;\n}\n\n/**\n * Register a chart with a sync group\n */\nfunction registerChart(groupId: string, chart: ECharts): () => void {\n const group = getOrCreateGroup(groupId);\n group.charts.add(chart);\n\n // Setup event handlers\n const handlers = setupSyncHandlers(chart, group);\n\n // Return cleanup function\n return () => {\n handlers.forEach(cleanup => cleanup());\n group.charts.delete(chart);\n if (group.charts.size === 0) {\n syncGroups.delete(groupId);\n }\n };\n}\n\n/**\n * Setup synchronization event handlers\n */\nfunction setupSyncHandlers(sourceChart: ECharts, group: SyncGroup): (() => void)[] {\n const cleanups: (() => void)[] = [];\n\n // Tooltip/Crosshair sync\n if (group.options.tooltip || group.options.crosshair) {\n const handleAxisPointer = (params: unknown) => {\n const p = params as { \n axesInfo?: { axisDim: string; value: unknown }[];\n seriesIndex?: number;\n dataIndex?: number;\n };\n \n group.charts.forEach(chart => {\n if (chart === sourceChart) return;\n\n try {\n if (p.axesInfo && p.axesInfo.length > 0) {\n const axisInfo = p.axesInfo[0];\n chart.dispatchAction({\n type: 'showTip',\n x: axisInfo.value as number,\n seriesIndex: 0,\n });\n } else if (p.dataIndex !== undefined) {\n chart.dispatchAction({\n type: 'showTip',\n seriesIndex: p.seriesIndex || 0,\n dataIndex: p.dataIndex,\n });\n }\n } catch (e) {\n // Ignore errors from disposed charts\n }\n });\n };\n\n const handleMouseOut = () => {\n group.charts.forEach(chart => {\n if (chart === sourceChart) return;\n try {\n chart.dispatchAction({ type: 'hideTip' });\n } catch (e) {\n // Ignore\n }\n });\n };\n\n sourceChart.on('updateAxisPointer', handleAxisPointer);\n sourceChart.getZr().on('mouseout', handleMouseOut);\n\n cleanups.push(() => {\n sourceChart.off('updateAxisPointer', handleAxisPointer);\n sourceChart.getZr()?.off('mouseout', handleMouseOut);\n });\n }\n\n // Zoom sync\n if (group.options.zoom) {\n const handleDataZoom = (params: unknown) => {\n const p = params as { \n batch?: { start: number; end: number }[];\n start?: number;\n end?: number;\n };\n \n const start = p.batch?.[0]?.start ?? p.start;\n const end = p.batch?.[0]?.end ?? p.end;\n\n if (start === undefined || end === undefined) return;\n\n group.charts.forEach(chart => {\n if (chart === sourceChart) return;\n try {\n chart.dispatchAction({\n type: 'dataZoom',\n start,\n end,\n });\n } catch (e) {\n // Ignore\n }\n });\n };\n\n sourceChart.on('datazoom', handleDataZoom);\n cleanups.push(() => sourceChart.off('datazoom', handleDataZoom));\n }\n\n // Legend sync\n if (group.options.legend) {\n const handleLegendSelect = (params: unknown) => {\n const p = params as { name: string; selected: Record<string, boolean> };\n \n group.charts.forEach(chart => {\n if (chart === sourceChart) return;\n try {\n chart.dispatchAction({\n type: 'legendToggleSelect',\n name: p.name,\n });\n } catch (e) {\n // Ignore\n }\n });\n };\n\n sourceChart.on('legendselectchanged', handleLegendSelect);\n cleanups.push(() => sourceChart.off('legendselectchanged', handleLegendSelect));\n }\n\n return cleanups;\n}\n\n// =============================================================================\n// React Hook\n// =============================================================================\n\nexport interface UseChartSyncOptions extends SyncGroupOptions {\n /** Sync group ID */\n groupId: string;\n /** Whether sync is enabled */\n enabled?: boolean;\n}\n\n/**\n * Hook to synchronize a chart with other charts in the same group\n * \n * @example\n * ```tsx\n * const chartRef = useRef<AstroChartHandle>(null);\n * useChartSync(chartRef, { groupId: 'dashboard-charts' });\n * ```\n */\nexport function useChartSync(\n chartRef: React.RefObject<AstroChartHandle>,\n options: UseChartSyncOptions\n): void {\n const { groupId, enabled = true, ..._syncOptions } = options;\n const cleanupRef = useRef<(() => void) | null>(null);\n\n useEffect(() => {\n if (!enabled) return;\n\n // Get chart instance\n const chart = chartRef.current?.getChart() as ECharts | undefined;\n if (!chart) return;\n\n // Register with group\n cleanupRef.current = registerChart(groupId, chart);\n\n return () => {\n cleanupRef.current?.();\n cleanupRef.current = null;\n };\n }, [chartRef, groupId, enabled]);\n}\n\n// =============================================================================\n// Programmatic API\n// =============================================================================\n\n/**\n * Dispatch action to all charts in a group\n */\nexport function dispatchToGroup(\n groupId: string, \n action: Parameters<ECharts['dispatchAction']>[0]\n): void {\n const group = syncGroups.get(groupId);\n if (!group) return;\n\n group.charts.forEach(chart => {\n try {\n chart.dispatchAction(action);\n } catch (e) {\n // Ignore disposed charts\n }\n });\n}\n\n/**\n * Sync zoom range across all charts in a group\n */\nexport function syncZoomRange(\n groupId: string,\n start: number,\n end: number\n): void {\n dispatchToGroup(groupId, { type: 'dataZoom', start, end });\n}\n\n/**\n * Reset zoom for all charts in a group\n */\nexport function resetGroupZoom(groupId: string): void {\n dispatchToGroup(groupId, { type: 'dataZoom', start: 0, end: 100 });\n}\n\n/**\n * Show tooltip at specific data index for all charts\n */\nexport function showGroupTooltip(\n groupId: string,\n seriesIndex: number,\n dataIndex: number\n): void {\n dispatchToGroup(groupId, { type: 'showTip', seriesIndex, dataIndex });\n}\n\n/**\n * Hide tooltip for all charts in a group\n */\nexport function hideGroupTooltip(groupId: string): void {\n dispatchToGroup(groupId, { type: 'hideTip' });\n}\n\n/**\n * Get all chart instances in a group\n */\nexport function getGroupCharts(groupId: string): ECharts[] {\n const group = syncGroups.get(groupId);\n return group ? Array.from(group.charts) : [];\n}\n\n// =============================================================================\n// Export Utilities\n// =============================================================================\n\n/**\n * Export all charts in a group as images\n */\nexport function exportGroupAsImages(\n groupId: string,\n options: {\n type?: 'png' | 'svg';\n pixelRatio?: number;\n fileName?: string;\n } = {}\n): string[] {\n const { type = 'png', pixelRatio = 2, fileName: _fileName = 'chart' } = options;\n const charts = getGroupCharts(groupId);\n \n return charts.map((chart, _index) => {\n return chart.getDataURL({\n type,\n pixelRatio,\n backgroundColor: 'transparent',\n });\n });\n}\n\n/**\n * Export all charts in a group as a combined CSV\n */\nexport function exportGroupAsCSV(\n groupId: string,\n options: {\n fileName?: string;\n includeHeaders?: boolean;\n } = {}\n): string {\n const { includeHeaders = true } = options;\n const charts = getGroupCharts(groupId);\n const rows: string[][] = [];\n\n charts.forEach((chart, chartIndex) => {\n const option = chart.getOption();\n const series = option.series as Array<{ name: string; data: unknown[] }>;\n \n if (!series || series.length === 0) return;\n\n // Add chart header\n if (includeHeaders) {\n rows.push([`Chart ${chartIndex + 1}`]);\n rows.push(['Index', ...series.map(s => s.name || `Series ${chartIndex}`)]);\n }\n\n // Find max data length\n const maxLen = Math.max(...series.map(s => s.data?.length || 0));\n\n // Add data rows\n for (let i = 0; i < maxLen; i++) {\n const row = [i.toString()];\n series.forEach(s => {\n const value = s.data?.[i];\n if (typeof value === 'number') {\n row.push(value.toString());\n } else if (Array.isArray(value)) {\n row.push(value[1]?.toString() || '');\n } else if (value && typeof value === 'object') {\n const v = value as { value?: number; y?: number };\n row.push((v.value ?? v.y)?.toString() || '');\n } else {\n row.push('');\n }\n });\n rows.push(row);\n }\n\n rows.push([]); // Empty row between charts\n });\n\n return rows.map(row => row.join(',')).join('\\n');\n}\n"],"names":["_a"],"mappings":";AAiCA,MAAM,iCAAiB,IAAA;AAKvB,SAAS,iBAAiB,SAAiB,UAA4B,IAAe;AACpF,MAAI,QAAQ,WAAW,IAAI,OAAO;AAClC,MAAI,CAAC,OAAO;AACV,YAAQ;AAAA,MACN,IAAI;AAAA,MACJ,4BAAY,IAAA;AAAA,MACZ,SAAS;AAAA,QACP,SAAS;AAAA,QACT,WAAW;AAAA,QACX,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,GAAG;AAAA,MAAA;AAAA,IACL;AAEF,eAAW,IAAI,SAAS,KAAK;AAAA,EAC/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AAI,CAAA,QAAO,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI;AACjD;"}
|
|
1
|
+
{"version":3,"file":"sync.js","names":[],"sources":["../../../../src/react/charts/unified/sync.ts"],"sourcesContent":["/**\n * @zendir/ui - Chart Synchronization Utilities\n *\n * Enables crosshair, tooltip, and zoom synchronization across multiple charts.\n * Useful for dashboard views with related time-series data.\n */\n\nimport { useEffect, useRef } from \"react\";\nimport type { ECharts } from \"echarts\";\nimport type { AstroChartHandle } from \"./AstroChart\";\n\n// =============================================================================\n// Sync Group Manager\n// =============================================================================\n\ninterface SyncGroup {\n id: string;\n charts: Set<ECharts>;\n options: SyncGroupOptions;\n}\n\ninterface SyncGroupOptions {\n /** Sync tooltip position */\n tooltip?: boolean;\n /** Sync crosshair */\n crosshair?: boolean;\n /** Sync zoom/pan */\n zoom?: boolean;\n /** Sync legend selection */\n legend?: boolean;\n}\n\n// Global registry of sync groups\nconst syncGroups = new Map<string, SyncGroup>();\n\n/**\n * Create or get a sync group\n */\nfunction getOrCreateGroup(\n groupId: string,\n options: SyncGroupOptions = {},\n): SyncGroup {\n let group = syncGroups.get(groupId);\n if (!group) {\n group = {\n id: groupId,\n charts: new Set(),\n options: {\n tooltip: true,\n crosshair: true,\n zoom: true,\n legend: true,\n ...options,\n },\n };\n syncGroups.set(groupId, group);\n }\n return group;\n}\n\n/**\n * Register a chart with a sync group\n */\nfunction registerChart(groupId: string, chart: ECharts): () => void {\n const group = getOrCreateGroup(groupId);\n group.charts.add(chart);\n\n // Setup event handlers\n const handlers = setupSyncHandlers(chart, group);\n\n // Return cleanup function\n return () => {\n handlers.forEach((cleanup) => cleanup());\n group.charts.delete(chart);\n if (group.charts.size === 0) {\n syncGroups.delete(groupId);\n }\n };\n}\n\n/**\n * Setup synchronization event handlers\n */\nfunction setupSyncHandlers(\n sourceChart: ECharts,\n group: SyncGroup,\n): (() => void)[] {\n const cleanups: (() => void)[] = [];\n\n // Tooltip/Crosshair sync\n if (group.options.tooltip || group.options.crosshair) {\n const handleAxisPointer = (params: unknown) => {\n const p = params as {\n axesInfo?: { axisDim: string; value: unknown }[];\n seriesIndex?: number;\n dataIndex?: number;\n };\n\n group.charts.forEach((chart) => {\n if (chart === sourceChart) return;\n\n try {\n if (p.axesInfo && p.axesInfo.length > 0) {\n const axisInfo = p.axesInfo[0];\n chart.dispatchAction({\n type: \"showTip\",\n x: axisInfo.value as number,\n seriesIndex: 0,\n });\n } else if (p.dataIndex !== undefined) {\n chart.dispatchAction({\n type: \"showTip\",\n seriesIndex: p.seriesIndex || 0,\n dataIndex: p.dataIndex,\n });\n }\n } catch (e) {\n // Ignore errors from disposed charts\n }\n });\n };\n\n const handleMouseOut = () => {\n group.charts.forEach((chart) => {\n if (chart === sourceChart) return;\n try {\n chart.dispatchAction({ type: \"hideTip\" });\n } catch (e) {\n // Ignore\n }\n });\n };\n\n sourceChart.on(\"updateAxisPointer\", handleAxisPointer);\n sourceChart.getZr().on(\"mouseout\", handleMouseOut);\n\n cleanups.push(() => {\n sourceChart.off(\"updateAxisPointer\", handleAxisPointer);\n sourceChart.getZr()?.off(\"mouseout\", handleMouseOut);\n });\n }\n\n // Zoom sync\n if (group.options.zoom) {\n const handleDataZoom = (params: unknown) => {\n const p = params as {\n batch?: { start: number; end: number }[];\n start?: number;\n end?: number;\n };\n\n const start = p.batch?.[0]?.start ?? p.start;\n const end = p.batch?.[0]?.end ?? p.end;\n\n if (start === undefined || end === undefined) return;\n\n group.charts.forEach((chart) => {\n if (chart === sourceChart) return;\n try {\n chart.dispatchAction({\n type: \"dataZoom\",\n start,\n end,\n });\n } catch (e) {\n // Ignore\n }\n });\n };\n\n sourceChart.on(\"datazoom\", handleDataZoom);\n cleanups.push(() => sourceChart.off(\"datazoom\", handleDataZoom));\n }\n\n // Legend sync\n if (group.options.legend) {\n const handleLegendSelect = (params: unknown) => {\n const p = params as { name: string; selected: Record<string, boolean> };\n\n group.charts.forEach((chart) => {\n if (chart === sourceChart) return;\n try {\n chart.dispatchAction({\n type: \"legendToggleSelect\",\n name: p.name,\n });\n } catch (e) {\n // Ignore\n }\n });\n };\n\n sourceChart.on(\"legendselectchanged\", handleLegendSelect);\n cleanups.push(() =>\n sourceChart.off(\"legendselectchanged\", handleLegendSelect),\n );\n }\n\n return cleanups;\n}\n\n// =============================================================================\n// React Hook\n// =============================================================================\n\nexport interface UseChartSyncOptions extends SyncGroupOptions {\n /** Sync group ID */\n groupId: string;\n /** Whether sync is enabled */\n enabled?: boolean;\n}\n\n/**\n * Hook to synchronize a chart with other charts in the same group\n *\n * @example\n * ```tsx\n * const chartRef = useRef<AstroChartHandle>(null);\n * useChartSync(chartRef, { groupId: 'dashboard-charts' });\n * ```\n */\nexport function useChartSync(\n chartRef: React.RefObject<AstroChartHandle>,\n options: UseChartSyncOptions,\n): void {\n const { groupId, enabled = true, ..._syncOptions } = options;\n const cleanupRef = useRef<(() => void) | null>(null);\n\n useEffect(() => {\n if (!enabled) return;\n\n // Get chart instance\n const chart = chartRef.current?.getChart() as ECharts | undefined;\n if (!chart) return;\n\n // Register with group\n cleanupRef.current = registerChart(groupId, chart);\n\n return () => {\n cleanupRef.current?.();\n cleanupRef.current = null;\n };\n }, [chartRef, groupId, enabled]);\n}\n\n// =============================================================================\n// Programmatic API\n// =============================================================================\n\n/**\n * Dispatch action to all charts in a group\n */\nexport function dispatchToGroup(\n groupId: string,\n action: Parameters<ECharts[\"dispatchAction\"]>[0],\n): void {\n const group = syncGroups.get(groupId);\n if (!group) return;\n\n group.charts.forEach((chart) => {\n try {\n chart.dispatchAction(action);\n } catch (e) {\n // Ignore disposed charts\n }\n });\n}\n\n/**\n * Sync zoom range across all charts in a group\n */\nexport function syncZoomRange(\n groupId: string,\n start: number,\n end: number,\n): void {\n dispatchToGroup(groupId, { type: \"dataZoom\", start, end });\n}\n\n/**\n * Reset zoom for all charts in a group\n */\nexport function resetGroupZoom(groupId: string): void {\n dispatchToGroup(groupId, { type: \"dataZoom\", start: 0, end: 100 });\n}\n\n/**\n * Show tooltip at specific data index for all charts\n */\nexport function showGroupTooltip(\n groupId: string,\n seriesIndex: number,\n dataIndex: number,\n): void {\n dispatchToGroup(groupId, { type: \"showTip\", seriesIndex, dataIndex });\n}\n\n/**\n * Hide tooltip for all charts in a group\n */\nexport function hideGroupTooltip(groupId: string): void {\n dispatchToGroup(groupId, { type: \"hideTip\" });\n}\n\n/**\n * Get all chart instances in a group\n */\nexport function getGroupCharts(groupId: string): ECharts[] {\n const group = syncGroups.get(groupId);\n return group ? Array.from(group.charts) : [];\n}\n\n// =============================================================================\n// Export Utilities\n// =============================================================================\n\n/**\n * Export all charts in a group as images\n */\nexport function exportGroupAsImages(\n groupId: string,\n options: {\n type?: \"png\" | \"svg\";\n pixelRatio?: number;\n fileName?: string;\n } = {},\n): string[] {\n const {\n type = \"png\",\n pixelRatio = 2,\n fileName: _fileName = \"chart\",\n } = options;\n const charts = getGroupCharts(groupId);\n\n return charts.map((chart, _index) => {\n return chart.getDataURL({\n type,\n pixelRatio,\n backgroundColor: \"transparent\",\n });\n });\n}\n\n/**\n * Export all charts in a group as a combined CSV\n */\nexport function exportGroupAsCSV(\n groupId: string,\n options: {\n fileName?: string;\n includeHeaders?: boolean;\n } = {},\n): string {\n const { includeHeaders = true } = options;\n const charts = getGroupCharts(groupId);\n const rows: string[][] = [];\n\n charts.forEach((chart, chartIndex) => {\n const option = chart.getOption();\n const series = option.series as Array<{ name: string; data: unknown[] }>;\n\n if (!series || series.length === 0) return;\n\n // Add chart header\n if (includeHeaders) {\n rows.push([`Chart ${chartIndex + 1}`]);\n rows.push([\n \"Index\",\n ...series.map((s) => s.name || `Series ${chartIndex}`),\n ]);\n }\n\n // Find max data length\n const maxLen = Math.max(...series.map((s) => s.data?.length || 0));\n\n // Add data rows\n for (let i = 0; i < maxLen; i++) {\n const row = [i.toString()];\n series.forEach((s) => {\n const value = s.data?.[i];\n if (typeof value === \"number\") {\n row.push(value.toString());\n } else if (Array.isArray(value)) {\n row.push(value[1]?.toString() || \"\");\n } else if (value && typeof value === \"object\") {\n const v = value as { value?: number; y?: number };\n row.push((v.value ?? v.y)?.toString() || \"\");\n } else {\n row.push(\"\");\n }\n });\n rows.push(row);\n }\n\n rows.push([]); // Empty row between charts\n });\n\n return rows.map((row) => row.join(\",\")).join(\"\\n\");\n}\n"],"mappings":";;;;;;;;AAiCA,IAAM,6BAAa,IAAI,IAAuB;;;;AAK9C,SAAS,iBACP,SACA,UAA4B,CAAC,GAClB;CACX,IAAI,QAAQ,WAAW,IAAI,OAAO;CAClC,IAAI,CAAC,OAAO;EACV,QAAQ;GACN,IAAI;GACJ,wBAAQ,IAAI,IAAI;GAChB,SAAS;IACP,SAAS;IACT,WAAW;IACX,MAAM;IACN,QAAQ;IACR,GAAG;GACL;EACF;EACA,WAAW,IAAI,SAAS,KAAK;CAC/B;CACA,OAAO;AACT;;;;AAKA,SAAS,cAAc,SAAiB,OAA4B;CAClE,MAAM,QAAQ,iBAAiB,OAAO;CACtC,MAAM,OAAO,IAAI,KAAK;CAGtB,MAAM,WAAW,kBAAkB,OAAO,KAAK;CAG/C,aAAa;EACX,SAAS,SAAS,YAAY,QAAQ,CAAC;EACvC,MAAM,OAAO,OAAO,KAAK;EACzB,IAAI,MAAM,OAAO,SAAS,GACxB,WAAW,OAAO,OAAO;CAE7B;AACF;;;;AAKA,SAAS,kBACP,aACA,OACgB;CAChB,MAAM,WAA2B,CAAC;CAGlC,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,WAAW;EACpD,MAAM,qBAAqB,WAAoB;GAC7C,MAAM,IAAI;GAMV,MAAM,OAAO,SAAS,UAAU;IAC9B,IAAI,UAAU,aAAa;IAE3B,IAAI;KACF,IAAI,EAAE,YAAY,EAAE,SAAS,SAAS,GAAG;MACvC,MAAM,WAAW,EAAE,SAAS;MAC5B,MAAM,eAAe;OACnB,MAAM;OACN,GAAG,SAAS;OACZ,aAAa;MACf,CAAC;KACH,OAAO,IAAI,EAAE,cAAc,KAAA,GACzB,MAAM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,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI;AACnD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ThemeTokens, ThemeMode, ThemeVariant } from '../../theme';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Zendir Brand Colors (from Brand Guide v2026)
|
|
5
4
|
* Core: Electric (#3E3CFF), Purple (#9D70FF), Prussian Blue (#1B2DA0)
|
|
@@ -76,22 +75,22 @@ export declare const ASTRO_DATA_VIZ_COLORS: {
|
|
|
76
75
|
*
|
|
77
76
|
* NOTE: Status colors (green, yellow, red) reserved for status indication only
|
|
78
77
|
*/
|
|
79
|
-
mixed: ("#3E3CFF" | "#9D70FF" | "#6B69FF" | "#B48DFF" | "#3548C0" | "#9997FF" | "#C9A8FF" | "#
|
|
78
|
+
mixed: ("#3E3CFF" | "#1B2DA0" | "#9D70FF" | "#6B69FF" | "#B48DFF" | "#3548C0" | "#9997FF" | "#C9A8FF" | "#3230CC" | "#7E5ACC" | "#4A5FD6")[];
|
|
80
79
|
/**
|
|
81
80
|
* Zendir Brand palette - Full brand spectrum
|
|
82
81
|
* Complete set of Zendir brand colors for maximum brand expression
|
|
83
82
|
*/
|
|
84
|
-
zendir: ("#3E3CFF" | "#9D70FF" | "#6B69FF" | "#B48DFF" | "#3548C0" | "#9997FF" | "#C9A8FF"
|
|
83
|
+
zendir: ("#3E3CFF" | "#1B2DA0" | "#9D70FF" | "#6B69FF" | "#B48DFF" | "#3548C0" | "#9997FF" | "#C9A8FF")[];
|
|
85
84
|
/**
|
|
86
85
|
* Extended Zendir palette - All shades for complex visualizations
|
|
87
86
|
* Includes dark and light variants for maximum differentiation
|
|
88
87
|
*/
|
|
89
|
-
zendirExtended: ("#3E3CFF" | "#9D70FF" | "#6B69FF" | "#B48DFF" | "#3548C0" | "#9997FF" | "#C9A8FF" | "#
|
|
88
|
+
zendirExtended: ("#3E3CFF" | "#1B2DA0" | "#9D70FF" | "#6B69FF" | "#B48DFF" | "#3548C0" | "#9997FF" | "#C9A8FF" | "#3230CC" | "#7E5ACC" | "#142380")[];
|
|
90
89
|
/**
|
|
91
90
|
* Cool palette - Blues and purples
|
|
92
91
|
* Professional Zendir-branded cool tones
|
|
93
92
|
*/
|
|
94
|
-
cool: ("#3E3CFF" | "#
|
|
93
|
+
cool: ("#3E3CFF" | "#1B2DA0" | "#9D70FF" | "#6B69FF" | "#B48DFF" | "#3548C0" | "#9997FF" | "#4A5FD6")[];
|
|
95
94
|
/**
|
|
96
95
|
* Warm accent palette - For charts needing warm tones
|
|
97
96
|
* Use sparingly - not part of Zendir brand
|
|
@@ -106,12 +105,12 @@ export declare const ASTRO_DATA_VIZ_COLORS: {
|
|
|
106
105
|
* Prussian-Electric gradient palette
|
|
107
106
|
* Deep to vibrant brand progression
|
|
108
107
|
*/
|
|
109
|
-
prussianElectric: ("#3E3CFF" | "#
|
|
108
|
+
prussianElectric: ("#3E3CFF" | "#1B2DA0" | "#6B69FF" | "#3548C0" | "#3230CC" | "#142380")[];
|
|
110
109
|
/**
|
|
111
110
|
* Full Zendir spectrum gradient
|
|
112
111
|
* Prussian Blue → Electric → Purple
|
|
113
112
|
*/
|
|
114
|
-
zendirSpectrum: ("#3E3CFF" | "#
|
|
113
|
+
zendirSpectrum: ("#3E3CFF" | "#1B2DA0" | "#9D70FF" | "#6B69FF" | "#B48DFF" | "#3548C0")[];
|
|
115
114
|
/**
|
|
116
115
|
* Sequential palettes for heatmaps and gradual data
|
|
117
116
|
* Zendir brand-forward gradients
|
|
@@ -384,7 +383,7 @@ export declare function getStatusColor(value: number, thresholds: {
|
|
|
384
383
|
* const brandColor = getSeriesColor(0, ASTRO_DATA_VIZ_COLORS.zendir);
|
|
385
384
|
* ```
|
|
386
385
|
*/
|
|
387
|
-
export declare function getSeriesColor(index: number, palette?: ("#3E3CFF" | "#9D70FF" | "#6B69FF" | "#B48DFF" | "#3548C0" | "#9997FF" | "#C9A8FF" | "#
|
|
386
|
+
export declare function getSeriesColor(index: number, palette?: ("#3E3CFF" | "#1B2DA0" | "#9D70FF" | "#6B69FF" | "#B48DFF" | "#3548C0" | "#9997FF" | "#C9A8FF" | "#3230CC" | "#7E5ACC" | "#4A5FD6")[]): string;
|
|
388
387
|
/**
|
|
389
388
|
* Get Zendir brand color by role
|
|
390
389
|
* Use for consistent branding across the application
|
|
@@ -415,12 +414,12 @@ export declare function getZendirAccentColor(role: keyof typeof ZENDIR_ACCENT_CO
|
|
|
415
414
|
* const statusColors = getPaletteForDataType('status');
|
|
416
415
|
* ```
|
|
417
416
|
*/
|
|
418
|
-
export declare function getPaletteForDataType(dataType:
|
|
417
|
+
export declare function getPaletteForDataType(dataType: "categorical" | "sequential" | "diverging" | "status" | "zendir" | "zendirExtended" | "cool" | "warm" | "astro-official", useAstroTheme?: boolean): string[];
|
|
419
418
|
/**
|
|
420
419
|
* Create gradient for area charts
|
|
421
420
|
*/
|
|
422
|
-
export declare function createAreaGradient(color: string, direction?:
|
|
423
|
-
type:
|
|
421
|
+
export declare function createAreaGradient(color: string, direction?: "vertical" | "horizontal"): {
|
|
422
|
+
type: "linear";
|
|
424
423
|
x: number;
|
|
425
424
|
y: number;
|
|
426
425
|
x2: number;
|
|
@@ -433,7 +432,7 @@ export declare function createAreaGradient(color: string, direction?: 'vertical'
|
|
|
433
432
|
/**
|
|
434
433
|
* Format time for axis labels
|
|
435
434
|
*/
|
|
436
|
-
export declare function formatTimeLabel(timestamp: number, format?:
|
|
435
|
+
export declare function formatTimeLabel(timestamp: number, format?: "short" | "medium" | "long"): string;
|
|
437
436
|
/**
|
|
438
437
|
* Format number with unit suffix
|
|
439
438
|
*/
|