@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,423 +1,509 @@
|
|
|
1
|
+
import { CategoryPalette } from "./categoryPalette.js";
|
|
2
|
+
//#region src/react/utils/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* @zendir/ui - Enterprise Utility Functions
|
|
5
|
+
*
|
|
6
|
+
* Shared utilities for null-safety, formatting, and defensive coding.
|
|
7
|
+
* These utilities ensure components never crash due to undefined data.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Safely access a value with a fallback for null/undefined
|
|
11
|
+
* @example withNullSafety(data?.temperature, 0) // Returns 0 if undefined
|
|
12
|
+
*/
|
|
1
13
|
function withNullSafety(value, fallback) {
|
|
2
|
-
|
|
14
|
+
return value ?? fallback;
|
|
3
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Safely format a number, returning '--' if undefined
|
|
18
|
+
* @example safeNumber(data?.value, 2) // "123.45" or "--"
|
|
19
|
+
*/
|
|
4
20
|
function safeNumber(value, decimals = 2, fallback = "--") {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
return value.toFixed(decimals);
|
|
21
|
+
if (value === null || value === void 0 || !Number.isFinite(value)) return fallback;
|
|
22
|
+
return value.toFixed(decimals);
|
|
9
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Check if value is a valid finite number
|
|
26
|
+
*/
|
|
10
27
|
function isValidNumber(value) {
|
|
11
|
-
|
|
28
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
12
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Format a number with locale-aware formatting and optional unit
|
|
32
|
+
* @example formatNumber(1234567, { notation: 'compact' }) // "1.2M"
|
|
33
|
+
*/
|
|
13
34
|
function formatNumber(value, options = {}) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} catch {
|
|
33
|
-
return value.toFixed(decimals);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
35
|
+
if (value === null || value === void 0 || !Number.isFinite(value)) return "--";
|
|
36
|
+
const { decimals = 2, locale = "en-US", notation = "standard", unit, signDisplay = "auto" } = options;
|
|
37
|
+
try {
|
|
38
|
+
const formatted = new Intl.NumberFormat(locale, {
|
|
39
|
+
notation,
|
|
40
|
+
minimumFractionDigits: notation === "compact" ? 0 : decimals,
|
|
41
|
+
maximumFractionDigits: decimals,
|
|
42
|
+
signDisplay
|
|
43
|
+
}).format(value);
|
|
44
|
+
return unit ? `${formatted} ${unit}` : formatted;
|
|
45
|
+
} catch {
|
|
46
|
+
return value.toFixed(decimals);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Format a number with tabular (monospace) digits for alignment
|
|
51
|
+
* Uses font-feature-settings: 'tnum' 1
|
|
52
|
+
*/
|
|
36
53
|
function formatTabular(value, decimals = 2) {
|
|
37
|
-
|
|
54
|
+
return safeNumber(value, decimals);
|
|
38
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Format temperature with unit conversion
|
|
58
|
+
* @example formatTemperature(25) // "25.0°C"
|
|
59
|
+
* @example formatTemperature(25, 'fahrenheit') // "77.0°F"
|
|
60
|
+
*/
|
|
39
61
|
function formatTemperature(celsius, unit = "celsius", decimals = 1) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
62
|
+
if (celsius === null || celsius === void 0 || !Number.isFinite(celsius)) return "--°C";
|
|
63
|
+
switch (unit) {
|
|
64
|
+
case "fahrenheit": return `${(celsius * 9 / 5 + 32).toFixed(decimals)}°F`;
|
|
65
|
+
case "kelvin": return `${(celsius + 273.15).toFixed(decimals)}K`;
|
|
66
|
+
default: return `${celsius.toFixed(decimals)}°C`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Format data rate with automatic unit scaling
|
|
71
|
+
* @example formatDataRate(1500000) // "1.50 Mbps"
|
|
72
|
+
*/
|
|
52
73
|
function formatDataRate(bitsPerSecond) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
74
|
+
if (bitsPerSecond === null || bitsPerSecond === void 0 || !Number.isFinite(bitsPerSecond)) return "-- bps";
|
|
75
|
+
const units = [
|
|
76
|
+
"bps",
|
|
77
|
+
"Kbps",
|
|
78
|
+
"Mbps",
|
|
79
|
+
"Gbps",
|
|
80
|
+
"Tbps"
|
|
81
|
+
];
|
|
82
|
+
let unitIndex = 0;
|
|
83
|
+
let value = bitsPerSecond;
|
|
84
|
+
while (value >= 1e3 && unitIndex < units.length - 1) {
|
|
85
|
+
value /= 1e3;
|
|
86
|
+
unitIndex++;
|
|
87
|
+
}
|
|
88
|
+
return `${value.toFixed(2)} ${units[unitIndex]}`;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Format distance with automatic unit scaling
|
|
92
|
+
* @example formatDistance(1500) // "1.50 km"
|
|
93
|
+
*/
|
|
65
94
|
function formatDistance(meters) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return `${meters.toFixed(1)} m`;
|
|
77
|
-
}
|
|
95
|
+
if (meters === null || meters === void 0 || !Number.isFinite(meters)) return "-- m";
|
|
96
|
+
if (meters >= 1e6) return `${(meters / 1e6).toFixed(2)} Mm`;
|
|
97
|
+
else if (meters >= 1e3) return `${(meters / 1e3).toFixed(2)} km`;
|
|
98
|
+
else if (meters < 1) return `${(meters * 100).toFixed(1)} cm`;
|
|
99
|
+
return `${meters.toFixed(1)} m`;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Format altitude (always in km for space ops)
|
|
103
|
+
* @example formatAltitude(418.2) // "418.2 km"
|
|
104
|
+
*/
|
|
78
105
|
function formatAltitude(km) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
return `${km.toFixed(1)} km`;
|
|
106
|
+
if (km === null || km === void 0 || !Number.isFinite(km)) return "-- km";
|
|
107
|
+
return `${km.toFixed(1)} km`;
|
|
83
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Format velocity
|
|
111
|
+
* @example formatVelocity(7.66) // "7.66 km/s"
|
|
112
|
+
*/
|
|
84
113
|
function formatVelocity(kmPerSec) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
114
|
+
if (kmPerSec === null || kmPerSec === void 0 || !Number.isFinite(kmPerSec)) return "-- km/s";
|
|
115
|
+
return `${kmPerSec.toFixed(2)} km/s`;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Format percentage with bounds checking
|
|
119
|
+
* @example formatPercentage(0.856) // "85.6%"
|
|
120
|
+
* @example formatPercentage(85.6, false) // "85.6%" (already percentage)
|
|
121
|
+
*/
|
|
90
122
|
function formatPercentage(value, isDecimal = false, decimals = 1) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
const percentage = isDecimal ? value * 100 : value;
|
|
95
|
-
return `${percentage.toFixed(decimals)}%`;
|
|
123
|
+
if (value === null || value === void 0 || !Number.isFinite(value)) return "--%";
|
|
124
|
+
return `${(isDecimal ? value * 100 : value).toFixed(decimals)}%`;
|
|
96
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Format power (watts) with auto-scaling
|
|
128
|
+
* @example formatPower(1500) // "1.50 kW"
|
|
129
|
+
*/
|
|
97
130
|
function formatPower(watts) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return `${watts.toFixed(1)} W`;
|
|
109
|
-
}
|
|
131
|
+
if (watts === null || watts === void 0 || !Number.isFinite(watts)) return "-- W";
|
|
132
|
+
if (Math.abs(watts) >= 1e6) return `${(watts / 1e6).toFixed(2)} MW`;
|
|
133
|
+
else if (Math.abs(watts) >= 1e3) return `${(watts / 1e3).toFixed(2)} kW`;
|
|
134
|
+
else if (Math.abs(watts) < 1) return `${(watts * 1e3).toFixed(1)} mW`;
|
|
135
|
+
return `${watts.toFixed(1)} W`;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Format frequency (Hz) with auto-scaling
|
|
139
|
+
* @example formatFrequency(2400000000) // "2.40 GHz"
|
|
140
|
+
*/
|
|
110
141
|
function formatFrequency(hz) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return `${hz.toFixed(0)} Hz`;
|
|
122
|
-
}
|
|
142
|
+
if (hz === null || hz === void 0 || !Number.isFinite(hz)) return "-- Hz";
|
|
143
|
+
if (hz >= 1e9) return `${(hz / 1e9).toFixed(2)} GHz`;
|
|
144
|
+
else if (hz >= 1e6) return `${(hz / 1e6).toFixed(2)} MHz`;
|
|
145
|
+
else if (hz >= 1e3) return `${(hz / 1e3).toFixed(2)} kHz`;
|
|
146
|
+
return `${hz.toFixed(0)} Hz`;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Format duration in human-readable form
|
|
150
|
+
* @example formatDuration(3661) // "1h 1m 1s"
|
|
151
|
+
*/
|
|
123
152
|
function formatDuration(seconds) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const mins = Math.floor(absSeconds % 3600 / 60);
|
|
138
|
-
return `${sign}${hours}h ${mins}m`;
|
|
139
|
-
} else {
|
|
140
|
-
const days = Math.floor(absSeconds / 86400);
|
|
141
|
-
const hours = Math.floor(absSeconds % 86400 / 3600);
|
|
142
|
-
return `${sign}${days}d ${hours}h`;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
153
|
+
if (seconds === null || seconds === void 0 || !Number.isFinite(seconds)) return "--:--";
|
|
154
|
+
const absSeconds = Math.abs(seconds);
|
|
155
|
+
const sign = seconds < 0 ? "-" : "";
|
|
156
|
+
if (absSeconds < 60) return `${sign}${absSeconds.toFixed(0)}s`;
|
|
157
|
+
else if (absSeconds < 3600) return `${sign}${Math.floor(absSeconds / 60)}m ${Math.floor(absSeconds % 60)}s`;
|
|
158
|
+
else if (absSeconds < 86400) return `${sign}${Math.floor(absSeconds / 3600)}h ${Math.floor(absSeconds % 3600 / 60)}m`;
|
|
159
|
+
else return `${sign}${Math.floor(absSeconds / 86400)}d ${Math.floor(absSeconds % 86400 / 3600)}h`;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Format countdown timer (supports negative values for past events)
|
|
163
|
+
* @example formatCountdown(125) // "T-02:05"
|
|
164
|
+
* @example formatCountdown(-60) // "T+01:00"
|
|
165
|
+
*/
|
|
145
166
|
function formatCountdown(seconds) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
167
|
+
if (seconds === null || seconds === void 0 || !Number.isFinite(seconds)) return "T--:--";
|
|
168
|
+
const prefix = seconds >= 0 ? "T-" : "T+";
|
|
169
|
+
const absSeconds = Math.abs(seconds);
|
|
170
|
+
if (absSeconds >= 3600) {
|
|
171
|
+
const hours = Math.floor(absSeconds / 3600);
|
|
172
|
+
const mins = Math.floor(absSeconds % 3600 / 60);
|
|
173
|
+
const secs = Math.floor(absSeconds % 60);
|
|
174
|
+
return `${prefix}${hours}:${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
|
|
175
|
+
}
|
|
176
|
+
const mins = Math.floor(absSeconds / 60);
|
|
177
|
+
const secs = Math.floor(absSeconds % 60);
|
|
178
|
+
return `${prefix}${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Format UTC timestamp
|
|
182
|
+
* @example formatUTC(new Date()) // "2026-01-27 14:30:00Z"
|
|
183
|
+
*/
|
|
161
184
|
function formatUTC(date) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
185
|
+
if (!date) return "--:--:-- UTC";
|
|
186
|
+
try {
|
|
187
|
+
const d = typeof date === "string" ? new Date(date) : date;
|
|
188
|
+
if (isNaN(d.getTime())) return "--:--:-- UTC";
|
|
189
|
+
return d.toISOString().replace("T", " ").slice(0, 19) + "Z";
|
|
190
|
+
} catch {
|
|
191
|
+
return "--:--:-- UTC";
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Format time only (HH:MM:SS)
|
|
196
|
+
* @example formatTime(new Date()) // "14:30:00"
|
|
197
|
+
*/
|
|
171
198
|
function formatTime(date, includeSeconds = true) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
199
|
+
if (!date) return includeSeconds ? "--:--:--" : "--:--";
|
|
200
|
+
try {
|
|
201
|
+
const d = typeof date === "string" ? new Date(date) : date;
|
|
202
|
+
if (isNaN(d.getTime())) return includeSeconds ? "--:--:--" : "--:--";
|
|
203
|
+
const hours = d.getUTCHours().toString().padStart(2, "0");
|
|
204
|
+
const mins = d.getUTCMinutes().toString().padStart(2, "0");
|
|
205
|
+
const secs = d.getUTCSeconds().toString().padStart(2, "0");
|
|
206
|
+
return includeSeconds ? `${hours}:${mins}:${secs}` : `${hours}:${mins}`;
|
|
207
|
+
} catch {
|
|
208
|
+
return includeSeconds ? "--:--:--" : "--:--";
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Format latitude/longitude
|
|
213
|
+
* @example formatCoordinate(32.4, 'lat') // "32.40° N"
|
|
214
|
+
* @example formatCoordinate(-117.2, 'lon') // "117.20° W"
|
|
215
|
+
*/
|
|
184
216
|
function formatCoordinate(value, type) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
217
|
+
if (value === null || value === void 0 || !Number.isFinite(value)) return "--°";
|
|
218
|
+
const absValue = Math.abs(value);
|
|
219
|
+
let direction;
|
|
220
|
+
if (type === "lat") direction = value >= 0 ? "N" : "S";
|
|
221
|
+
else direction = value >= 0 ? "E" : "W";
|
|
222
|
+
return `${absValue.toFixed(2)}° ${direction}`;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Format lat/lon pair
|
|
226
|
+
* @example formatLatLon(32.4, -117.2) // "32.40° N, 117.20° W"
|
|
227
|
+
*/
|
|
197
228
|
function formatLatLon(lat, lon) {
|
|
198
|
-
|
|
229
|
+
return `${formatCoordinate(lat, "lat")}, ${formatCoordinate(lon, "lon")}`;
|
|
199
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Format angle in degrees
|
|
233
|
+
* @example formatDegrees(45.5) // "45.5°"
|
|
234
|
+
*/
|
|
200
235
|
function formatDegrees(value, decimals = 1) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
return `${value.toFixed(decimals)}°`;
|
|
236
|
+
if (value === null || value === void 0 || !Number.isFinite(value)) return "--°";
|
|
237
|
+
return `${value.toFixed(decimals)}°`;
|
|
205
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* Format decibels
|
|
241
|
+
* @example formatDecibels(3.5) // "3.5 dB"
|
|
242
|
+
*/
|
|
206
243
|
function formatDecibels(value, decimals = 1) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
return `${value.toFixed(decimals)} dB`;
|
|
244
|
+
if (value === null || value === void 0 || !Number.isFinite(value)) return "-- dB";
|
|
245
|
+
return `${value.toFixed(decimals)} dB`;
|
|
211
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Clamp a value between min and max
|
|
249
|
+
* @example clamp(150, 0, 100) // 100
|
|
250
|
+
*/
|
|
212
251
|
function clamp(value, min, max) {
|
|
213
|
-
|
|
252
|
+
return Math.min(Math.max(value, min), max);
|
|
214
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* Linear interpolation
|
|
256
|
+
* @example lerp(0, 100, 0.5) // 50
|
|
257
|
+
*/
|
|
215
258
|
function lerp(start, end, t) {
|
|
216
|
-
|
|
259
|
+
return start + (end - start) * clamp(t, 0, 1);
|
|
217
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Map a value from one range to another
|
|
263
|
+
* @example mapRange(50, 0, 100, 0, 1) // 0.5
|
|
264
|
+
*/
|
|
218
265
|
function mapRange(value, inMin, inMax, outMin, outMax) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
266
|
+
return lerp(outMin, outMax, (value - inMin) / (inMax - inMin));
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Astro UX Design System status colors
|
|
270
|
+
* These match the official Astro status semantics
|
|
271
|
+
*/
|
|
272
|
+
var STATUS_COLORS = {
|
|
273
|
+
off: "#a4abb6",
|
|
274
|
+
standby: "#2dccff",
|
|
275
|
+
normal: "#56f000",
|
|
276
|
+
caution: "#fce83a",
|
|
277
|
+
serious: "#ffb302",
|
|
278
|
+
critical: "#ff3838"
|
|
229
279
|
};
|
|
280
|
+
/**
|
|
281
|
+
* Get status color from level
|
|
282
|
+
* @example getStatusColor('normal') // '#56f000'
|
|
283
|
+
*/
|
|
230
284
|
function getStatusColor(status) {
|
|
231
|
-
|
|
285
|
+
return STATUS_COLORS[status ?? "off"];
|
|
232
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Derive status for battery specifically (low is bad)
|
|
289
|
+
* @example deriveBatteryStatus(25) // 'caution'
|
|
290
|
+
*/
|
|
233
291
|
function deriveBatteryStatus(level) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
292
|
+
if (level === void 0 || level === null) return "off";
|
|
293
|
+
if (level <= 10) return "critical";
|
|
294
|
+
if (level <= 20) return "serious";
|
|
295
|
+
if (level <= 30) return "caution";
|
|
296
|
+
return "normal";
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Determine status level from a value and thresholds
|
|
300
|
+
* @example getStatusFromValue(85, { critical: 20, serious: 40, caution: 60, normal: 80 }) // 'normal'
|
|
301
|
+
*/
|
|
240
302
|
function getStatusFromValue(value, thresholds, higherIsBetter = true) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
"failure": "critical",
|
|
307
|
-
"emergency": "critical",
|
|
308
|
-
"fault": "critical",
|
|
309
|
-
"alarm": "critical"
|
|
303
|
+
if (value === null || value === void 0 || !Number.isFinite(value)) return "off";
|
|
304
|
+
const { critical = 10, serious = 25, caution = 50, normal = 75 } = thresholds;
|
|
305
|
+
if (higherIsBetter) {
|
|
306
|
+
if (value <= critical) return "critical";
|
|
307
|
+
if (value <= serious) return "serious";
|
|
308
|
+
if (value <= caution) return "caution";
|
|
309
|
+
if (value <= normal) return "standby";
|
|
310
|
+
return "normal";
|
|
311
|
+
} else {
|
|
312
|
+
if (value >= critical) return "critical";
|
|
313
|
+
if (value >= serious) return "serious";
|
|
314
|
+
if (value >= caution) return "caution";
|
|
315
|
+
if (value >= normal) return "standby";
|
|
316
|
+
return "normal";
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Domain status terms that map to UI StatusLevel
|
|
321
|
+
* This handles common backend/sensor terminology
|
|
322
|
+
*/
|
|
323
|
+
var STATUS_MAPPING = {
|
|
324
|
+
off: "off",
|
|
325
|
+
disabled: "off",
|
|
326
|
+
inactive: "off",
|
|
327
|
+
offline: "off",
|
|
328
|
+
unknown: "off",
|
|
329
|
+
null: "off",
|
|
330
|
+
none: "off",
|
|
331
|
+
standby: "standby",
|
|
332
|
+
idle: "standby",
|
|
333
|
+
waiting: "standby",
|
|
334
|
+
ready: "standby",
|
|
335
|
+
pending: "standby",
|
|
336
|
+
queued: "standby",
|
|
337
|
+
normal: "normal",
|
|
338
|
+
nominal: "normal",
|
|
339
|
+
healthy: "normal",
|
|
340
|
+
ok: "normal",
|
|
341
|
+
good: "normal",
|
|
342
|
+
success: "normal",
|
|
343
|
+
operational: "normal",
|
|
344
|
+
active: "normal",
|
|
345
|
+
online: "normal",
|
|
346
|
+
connected: "normal",
|
|
347
|
+
stable: "normal",
|
|
348
|
+
transmitting: "normal",
|
|
349
|
+
receiving: "normal",
|
|
350
|
+
caution: "caution",
|
|
351
|
+
warning: "caution",
|
|
352
|
+
degraded: "caution",
|
|
353
|
+
elevated: "caution",
|
|
354
|
+
alert: "caution",
|
|
355
|
+
attention: "caution",
|
|
356
|
+
limited: "caution",
|
|
357
|
+
serious: "serious",
|
|
358
|
+
unstable: "serious",
|
|
359
|
+
danger: "serious",
|
|
360
|
+
severe: "serious",
|
|
361
|
+
critical: "critical",
|
|
362
|
+
error: "critical",
|
|
363
|
+
failed: "critical",
|
|
364
|
+
failure: "critical",
|
|
365
|
+
emergency: "critical",
|
|
366
|
+
fault: "critical",
|
|
367
|
+
alarm: "critical"
|
|
310
368
|
};
|
|
369
|
+
/**
|
|
370
|
+
* Normalize any status string to the 6-level StatusLevel system
|
|
371
|
+
*
|
|
372
|
+
* @param status - Any status string from domain/backend
|
|
373
|
+
* @param defaultStatus - Fallback if status is not recognized (default: 'off')
|
|
374
|
+
* @returns StatusLevel
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```typescript
|
|
378
|
+
* normalizeStatus('degraded') // 'caution'
|
|
379
|
+
* normalizeStatus('nominal') // 'normal'
|
|
380
|
+
* normalizeStatus('transmitting') // 'normal'
|
|
381
|
+
* normalizeStatus('warning') // 'caution'
|
|
382
|
+
* normalizeStatus('error') // 'critical'
|
|
383
|
+
* normalizeStatus(undefined) // 'off'
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
311
386
|
function normalizeStatus(status, defaultStatus = "off") {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
return STATUS_MAPPING[normalized] ?? defaultStatus;
|
|
387
|
+
if (!status) return defaultStatus;
|
|
388
|
+
return STATUS_MAPPING[status.toLowerCase().trim()] ?? defaultStatus;
|
|
315
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* Check if a string is a valid StatusLevel
|
|
392
|
+
*/
|
|
316
393
|
function isStatusLevel(value) {
|
|
317
|
-
|
|
318
|
-
|
|
394
|
+
return [
|
|
395
|
+
"off",
|
|
396
|
+
"standby",
|
|
397
|
+
"normal",
|
|
398
|
+
"caution",
|
|
399
|
+
"serious",
|
|
400
|
+
"critical"
|
|
401
|
+
].includes(value);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Get the severity order of a status (higher = more severe)
|
|
405
|
+
* Useful for sorting or finding worst status
|
|
406
|
+
*/
|
|
319
407
|
function getStatusSeverity(status) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
408
|
+
return {
|
|
409
|
+
off: 0,
|
|
410
|
+
standby: 1,
|
|
411
|
+
normal: 2,
|
|
412
|
+
caution: 3,
|
|
413
|
+
serious: 4,
|
|
414
|
+
critical: 5
|
|
415
|
+
}[status];
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Get the worst (most severe) status from an array
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* ```typescript
|
|
422
|
+
* getWorstStatus(['normal', 'caution', 'normal']) // 'caution'
|
|
423
|
+
* getWorstStatus(['normal', 'critical', 'caution']) // 'critical'
|
|
424
|
+
* ```
|
|
425
|
+
*/
|
|
330
426
|
function getWorstStatus(statuses) {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
427
|
+
if (statuses.length === 0) return "off";
|
|
428
|
+
return statuses.reduce((worst, current) => getStatusSeverity(current) > getStatusSeverity(worst) ? current : worst);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Safely add alpha to any CSS color string.
|
|
432
|
+
* Handles hex (#RRGGBB → #RRGGBBAA), rgb(), and rgba() formats.
|
|
433
|
+
*
|
|
434
|
+
* Avoids the common bug of appending a hex alpha string to an rgba() color,
|
|
435
|
+
* which produces invalid CSS (e.g. "rgba(15, 20, 35, 0.85)80").
|
|
436
|
+
*
|
|
437
|
+
* @param color - CSS color string (hex, rgb, or rgba)
|
|
438
|
+
* @param alpha - Alpha value 0–1
|
|
439
|
+
* @returns Valid CSS color string with alpha applied
|
|
440
|
+
*
|
|
441
|
+
* @example
|
|
442
|
+
* addAlpha('#1b2d3e', 0.5) // '#1b2d3e80'
|
|
443
|
+
* addAlpha('rgba(15, 20, 35, 0.85)', 0.5) // 'rgba(15, 20, 35, 0.5)'
|
|
444
|
+
* addAlpha('rgb(15, 20, 35)', 0.031) // 'rgba(15, 20, 35, 0.031)'
|
|
445
|
+
*/
|
|
336
446
|
function addAlpha(color, alpha) {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
return color;
|
|
350
|
-
}
|
|
447
|
+
if (!color) return color;
|
|
448
|
+
const a = Math.max(0, Math.min(1, alpha));
|
|
449
|
+
if (color.startsWith("rgba(")) return color.replace(/,\s*[\d.]+\)\s*$/, `, ${a})`);
|
|
450
|
+
if (color.startsWith("rgb(")) return color.replace(/^rgb\(/, "rgba(").replace(/\)\s*$/, `, ${a})`);
|
|
451
|
+
if (color.startsWith("#")) return `${color}${Math.round(a * 255).toString(16).padStart(2, "0")}`;
|
|
452
|
+
return color;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Merge class names, filtering out falsy values
|
|
456
|
+
* @example classNames('base', isActive && 'active', className) // "base active custom"
|
|
457
|
+
*/
|
|
351
458
|
function classNames(...classes) {
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
459
|
+
return classes.filter(Boolean).join(" ");
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Generate CSS for tabular numbers (monospace digits)
|
|
463
|
+
*/
|
|
464
|
+
var tabularNumsStyle = {
|
|
465
|
+
fontVariantNumeric: "tabular-nums",
|
|
466
|
+
fontFeatureSettings: "\"tnum\" 1"
|
|
357
467
|
};
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
468
|
+
/**
|
|
469
|
+
* CSS transition presets
|
|
470
|
+
*/
|
|
471
|
+
var transitions = {
|
|
472
|
+
fast: "all 150ms ease-out",
|
|
473
|
+
normal: "all 250ms ease-out",
|
|
474
|
+
slow: "all 400ms ease-out",
|
|
475
|
+
spring: "all 300ms cubic-bezier(0.34, 1.56, 0.64, 1)"
|
|
363
476
|
};
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
477
|
+
/**
|
|
478
|
+
* Focus ring styles for accessibility
|
|
479
|
+
*/
|
|
480
|
+
var focusRingStyle = {
|
|
481
|
+
outline: "2px solid #4dc3ff",
|
|
482
|
+
outlineOffset: "2px"
|
|
367
483
|
};
|
|
484
|
+
/**
|
|
485
|
+
* Compute a WCAG AA safe version of an accent color for use as foreground text
|
|
486
|
+
* on dark backgrounds. If the accent already passes 4.5:1 contrast on typical
|
|
487
|
+
* dark surfaces (L ≈ 0.01), returns it unchanged. Otherwise lightens toward
|
|
488
|
+
* white until the minimum contrast is met.
|
|
489
|
+
*
|
|
490
|
+
* @example safeAccentText('#8b5cf6') // '#a885f8' — lightened to pass 4.5:1
|
|
491
|
+
*/
|
|
368
492
|
function safeAccentText(accent) {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
export {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
clamp,
|
|
387
|
-
classNames,
|
|
388
|
-
deriveBatteryStatus,
|
|
389
|
-
focusRingStyle,
|
|
390
|
-
formatAltitude,
|
|
391
|
-
formatCoordinate,
|
|
392
|
-
formatCountdown,
|
|
393
|
-
formatDataRate,
|
|
394
|
-
formatDecibels,
|
|
395
|
-
formatDegrees,
|
|
396
|
-
formatDistance,
|
|
397
|
-
formatDuration,
|
|
398
|
-
formatFrequency,
|
|
399
|
-
formatLatLon,
|
|
400
|
-
formatNumber,
|
|
401
|
-
formatPercentage,
|
|
402
|
-
formatPower,
|
|
403
|
-
formatTabular,
|
|
404
|
-
formatTemperature,
|
|
405
|
-
formatTime,
|
|
406
|
-
formatUTC,
|
|
407
|
-
formatVelocity,
|
|
408
|
-
getStatusColor,
|
|
409
|
-
getStatusFromValue,
|
|
410
|
-
getStatusSeverity,
|
|
411
|
-
getWorstStatus,
|
|
412
|
-
isStatusLevel,
|
|
413
|
-
isValidNumber,
|
|
414
|
-
lerp,
|
|
415
|
-
mapRange,
|
|
416
|
-
normalizeStatus,
|
|
417
|
-
safeAccentText,
|
|
418
|
-
safeNumber,
|
|
419
|
-
tabularNumsStyle,
|
|
420
|
-
transitions,
|
|
421
|
-
withNullSafety
|
|
422
|
-
};
|
|
423
|
-
//# sourceMappingURL=index.js.map
|
|
493
|
+
const hex = accent.replace("#", "");
|
|
494
|
+
if (hex.length < 6) return accent;
|
|
495
|
+
const r = parseInt(hex.slice(0, 2), 16) / 255;
|
|
496
|
+
const g = parseInt(hex.slice(2, 4), 16) / 255;
|
|
497
|
+
const b = parseInt(hex.slice(4, 6), 16) / 255;
|
|
498
|
+
const toLinear = (c) => c <= .03928 ? c / 12.92 : Math.pow((c + .055) / 1.055, 2.4);
|
|
499
|
+
if (.2126 * toLinear(r) + .7152 * toLinear(g) + .0722 * toLinear(b) >= .22) return accent;
|
|
500
|
+
const mix = .25;
|
|
501
|
+
const lr = Math.min(255, Math.round((r + (1 - r) * mix) * 255));
|
|
502
|
+
const lg = Math.min(255, Math.round((g + (1 - g) * mix) * 255));
|
|
503
|
+
const lb = Math.min(255, Math.round((b + (1 - b) * mix) * 255));
|
|
504
|
+
return `#${lr.toString(16).padStart(2, "0")}${lg.toString(16).padStart(2, "0")}${lb.toString(16).padStart(2, "0")}`;
|
|
505
|
+
}
|
|
506
|
+
//#endregion
|
|
507
|
+
export { CategoryPalette, STATUS_COLORS, addAlpha, clamp, classNames, deriveBatteryStatus, focusRingStyle, formatAltitude, formatCoordinate, formatCountdown, formatDataRate, formatDecibels, formatDegrees, formatDistance, formatDuration, formatFrequency, formatLatLon, formatNumber, formatPercentage, formatPower, formatTabular, formatTemperature, formatTime, formatUTC, formatVelocity, getStatusColor, getStatusFromValue, getStatusSeverity, getWorstStatus, isStatusLevel, isValidNumber, lerp, mapRange, normalizeStatus, safeAccentText, safeNumber, tabularNumsStyle, transitions, withNullSafety };
|
|
508
|
+
|
|
509
|
+
//# sourceMappingURL=index.js.map
|