@zendir/ui 0.5.0 → 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 +20 -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 -571
- 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 +5 -6
- package/dist/react/core/navigation/SideNav.js +855 -629
- 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,307 +1,388 @@
|
|
|
1
|
-
import { DEG_TO_RAD,
|
|
1
|
+
import { DEG_TO_RAD, EARTH_RADIUS_KM, RAD_TO_DEG } from "./ZenSpace3DUtils.js";
|
|
2
|
+
//#region src/react/3d/CesiumCaptureSource.ts
|
|
3
|
+
/** Lazy import avoids circular deps; returns bundled placeholder PNG on capture failure */
|
|
2
4
|
async function loadPlaceholderFallback() {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
const { loadCapturePlaceholderImage } = await import("../core/widgets/Capture.js");
|
|
6
|
+
return loadCapturePlaceholderImage();
|
|
5
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Convert ECEF meters (Unreal / game-engine format) to SDK's ECI-like km format.
|
|
10
|
+
*
|
|
11
|
+
* ECEF (Earth-Centered Earth-Fixed): X→0°N 0°E, Y→0°N 90°E, Z→North Pole (meters)
|
|
12
|
+
* SDK (ECI-like): X/Z→equatorial plane, Y→North Pole (km)
|
|
13
|
+
*
|
|
14
|
+
* Axis mapping: SDK.x = ECEF.x / 1000
|
|
15
|
+
* SDK.y = ECEF.z / 1000 (ECEF Z=north → SDK Y=north)
|
|
16
|
+
* SDK.z = ECEF.y / 1000
|
|
17
|
+
*
|
|
18
|
+
* Export this so callers (e.g. MQTT handlers) can normalize at the boundary
|
|
19
|
+
* before passing positions to CaptureArgs.
|
|
20
|
+
*/
|
|
6
21
|
function ecefMetersToSdkPosition(ecef) {
|
|
7
|
-
|
|
8
|
-
|
|
22
|
+
const [ex, ey, ez] = ecef;
|
|
23
|
+
return [
|
|
24
|
+
ex / 1e3,
|
|
25
|
+
ez / 1e3,
|
|
26
|
+
ey / 1e3
|
|
27
|
+
];
|
|
9
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Convert world-frame Euler XYZ rotation + ECEF position to Cesium HPR (degrees).
|
|
31
|
+
*
|
|
32
|
+
* The game engine sends the camera's absolute orientation as Euler 1-2-3
|
|
33
|
+
* (XYZ intrinsic, right-handed, X=right Y=forward Z=up) in the ECEF world frame.
|
|
34
|
+
* Cesium's heading/pitch/roll are relative to the local ENU (East-North-Up) frame
|
|
35
|
+
* at the camera's geographic position, so we must:
|
|
36
|
+
*
|
|
37
|
+
* 1. Build the rotation matrix R from Euler XYZ (camera axes in ECEF)
|
|
38
|
+
* 2. Extract the camera's forward (+Y) and up (+Z) vectors in ECEF
|
|
39
|
+
* 3. Compute the ECEF→ENU rotation matrix at the camera's lat/lon
|
|
40
|
+
* 4. Transform forward/up into the ENU frame
|
|
41
|
+
* 5. Extract heading, pitch, roll from those ENU vectors
|
|
42
|
+
*
|
|
43
|
+
* @param ecefPos Camera position in ECEF meters [x, y, z]
|
|
44
|
+
* @param eulerDeg Euler XYZ rotation in degrees [rx, ry, rz]
|
|
45
|
+
* @returns [heading, pitch, roll] in degrees (Cesium convention)
|
|
46
|
+
*/
|
|
10
47
|
function ecefEulerXyzToHpr(ecefPos, eulerDeg) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return [heading, pitch, roll];
|
|
48
|
+
const [px, py, pz] = ecefPos;
|
|
49
|
+
const rHoriz = Math.sqrt(px * px + py * py);
|
|
50
|
+
const lat = Math.atan2(pz, rHoriz);
|
|
51
|
+
const lon = Math.atan2(py, px);
|
|
52
|
+
const slat = Math.sin(lat), clat = Math.cos(lat);
|
|
53
|
+
const slon = Math.sin(lon), clon = Math.cos(lon);
|
|
54
|
+
const rx = eulerDeg[0] * DEG_TO_RAD;
|
|
55
|
+
const ry = eulerDeg[1] * DEG_TO_RAD;
|
|
56
|
+
const rz = eulerDeg[2] * DEG_TO_RAD;
|
|
57
|
+
const cx = Math.cos(rx), sx = Math.sin(rx);
|
|
58
|
+
const cy = Math.cos(ry), sy = Math.sin(ry);
|
|
59
|
+
const cz = Math.cos(rz), sz = Math.sin(rz);
|
|
60
|
+
const fX = sx * sy * cz - cx * sz;
|
|
61
|
+
const fY = sx * sy * sz + cx * cz;
|
|
62
|
+
const fZ = sx * cy;
|
|
63
|
+
const uX = cx * sy * cz + sx * sz;
|
|
64
|
+
const uY = cx * sy * sz - sx * cz;
|
|
65
|
+
const uZ = cx * cy;
|
|
66
|
+
const fE = -slon * fX + clon * fY;
|
|
67
|
+
const fN = -slat * clon * fX - slat * slon * fY + clat * fZ;
|
|
68
|
+
const fU = clat * clon * fX + clat * slon * fY + slat * fZ;
|
|
69
|
+
const uE = -slon * uX + clon * uY;
|
|
70
|
+
const uN = -slat * clon * uX - slat * slon * uY + clat * uZ;
|
|
71
|
+
const uU = clat * clon * uX + clat * slon * uY + slat * uZ;
|
|
72
|
+
const horizLen = Math.sqrt(fE * fE + fN * fN);
|
|
73
|
+
const heading = Math.atan2(fE, fN) * RAD_TO_DEG;
|
|
74
|
+
const pitch = Math.atan2(fU, horizLen) * RAD_TO_DEG;
|
|
75
|
+
if (horizLen < 1e-9) return [
|
|
76
|
+
heading,
|
|
77
|
+
pitch,
|
|
78
|
+
Math.atan2(uE, uN) * RAD_TO_DEG
|
|
79
|
+
];
|
|
80
|
+
const drLen = Math.sqrt(fN * fN + fE * fE);
|
|
81
|
+
const drE = fN / drLen;
|
|
82
|
+
const drN = -fE / drLen;
|
|
83
|
+
const fLen = Math.sqrt(fE * fE + fN * fN + fU * fU);
|
|
84
|
+
const fnE = fE / fLen, fnN = fN / fLen, fnU = fU / fLen;
|
|
85
|
+
const duE = drN * fnU;
|
|
86
|
+
const duN = -drE * fnU;
|
|
87
|
+
const duU = drE * fnN - drN * fnE;
|
|
88
|
+
return [
|
|
89
|
+
heading,
|
|
90
|
+
pitch,
|
|
91
|
+
Math.atan2(uE * drE + uN * drN, uE * duE + uN * duN + uU * duU) * RAD_TO_DEG
|
|
92
|
+
];
|
|
57
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Convert local-frame Euler XYZ intrinsic rotation (right-handed, degrees)
|
|
96
|
+
* to Cesium heading/pitch/roll (degrees).
|
|
97
|
+
*
|
|
98
|
+
* Use this when the rotation is already relative to a local frame aligned with
|
|
99
|
+
* ENU (e.g. manual test inputs). For world-frame ECEF rotations from Unreal,
|
|
100
|
+
* use `ecefEulerXyzToHpr` instead — it accounts for the ENU frame at the
|
|
101
|
+
* camera's geographic position.
|
|
102
|
+
*
|
|
103
|
+
* Euler XYZ: rotation[0] around X, [1] around Y, [2] around Z.
|
|
104
|
+
* Decomposed into Cesium HPR via the rotation matrix R = Rz·Ry·Rx.
|
|
105
|
+
*/
|
|
58
106
|
function eulerXyzToHpr(eulerDeg) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
107
|
+
const rx = eulerDeg[0] * DEG_TO_RAD;
|
|
108
|
+
const ry = eulerDeg[1] * DEG_TO_RAD;
|
|
109
|
+
const rz = eulerDeg[2] * DEG_TO_RAD;
|
|
110
|
+
const cx = Math.cos(rx), sx = Math.sin(rx);
|
|
111
|
+
const cy = Math.cos(ry), sy = Math.sin(ry);
|
|
112
|
+
const cz = Math.cos(rz), sz = Math.sin(rz);
|
|
113
|
+
const R02 = cx * sy * cz + sx * sz;
|
|
114
|
+
const R00 = cy * cz;
|
|
115
|
+
const R01 = sx * sy * cz - cx * sz;
|
|
116
|
+
const R12 = cx * sy * sz - sx * cz;
|
|
117
|
+
const R22 = cx * cy;
|
|
118
|
+
return [
|
|
119
|
+
Math.atan2(R01, R00) * RAD_TO_DEG,
|
|
120
|
+
Math.asin(Math.max(-1, Math.min(1, -R02))) * RAD_TO_DEG,
|
|
121
|
+
Math.atan2(-R12, R22) * RAD_TO_DEG
|
|
122
|
+
];
|
|
74
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Convert CaptureArgs position [x, y, z] (km from Earth center, ECI-like)
|
|
126
|
+
* to Cesium Cartesian3 (WGS84 meters).
|
|
127
|
+
*
|
|
128
|
+
* The Y axis points to the North Pole, X/Z define the equatorial plane
|
|
129
|
+
* (matching the ZenSpace3D rendering convention after scale correction).
|
|
130
|
+
*
|
|
131
|
+
* Callers sending ECEF meter coordinates (e.g. Unreal Engine) should convert
|
|
132
|
+
* with `ecefMetersToSdkPosition()` before passing to CaptureArgs.
|
|
133
|
+
*/
|
|
75
134
|
function positionToCartesian3(Cesium, position) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const altKm = r - EARTH_RADIUS_KM;
|
|
84
|
-
return Cesium.Cartesian3.fromDegrees(lon, lat, altKm * 1e3);
|
|
135
|
+
const [x, y, z] = position;
|
|
136
|
+
const r = Math.sqrt(x * x + y * y + z * z);
|
|
137
|
+
if (r < 1) return Cesium.Cartesian3.fromDegrees(0, 0, 4e5);
|
|
138
|
+
const lat = 90 - Math.acos(Math.min(1, Math.max(-1, y / r))) * RAD_TO_DEG;
|
|
139
|
+
const lon = Math.atan2(z, -x) * RAD_TO_DEG - 180;
|
|
140
|
+
const altKm = r - EARTH_RADIUS_KM;
|
|
141
|
+
return Cesium.Cartesian3.fromDegrees(lon, lat, altKm * 1e3);
|
|
85
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Compute the optical field of view from physical sensor parameters.
|
|
145
|
+
*
|
|
146
|
+
* Real satellite cameras derive FOV from:
|
|
147
|
+
* FOV = 2 × atan( (sensor_size / 2) / focal_length )
|
|
148
|
+
* where sensor_size = resolution × pixel_pitch (mm).
|
|
149
|
+
*
|
|
150
|
+
* Returns the FOV in degrees, or null if the parameters are insufficient
|
|
151
|
+
* (zero focal_length, zero pixel_pitch, or zero resolution).
|
|
152
|
+
*/
|
|
86
153
|
function computeOpticalFov(focalLengthMm, pixelPitchMm, resolutionPx) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
154
|
+
if (focalLengthMm <= 0 || pixelPitchMm <= 0 || resolutionPx <= 0) return null;
|
|
155
|
+
const sensorSizeMm = resolutionPx * pixelPitchMm;
|
|
156
|
+
return 2 * Math.atan(sensorSizeMm / (2 * focalLengthMm)) * RAD_TO_DEG;
|
|
90
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Apply grayscale filter to canvas pixel data in-place.
|
|
160
|
+
* Uses luminance weights (ITU-R BT.709).
|
|
161
|
+
*/
|
|
91
162
|
function applyGrayscale(ctx, width, height) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
163
|
+
const imageData = ctx.getImageData(0, 0, width, height);
|
|
164
|
+
const data = imageData.data;
|
|
165
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
166
|
+
const lum = .2126 * data[i] + .7152 * data[i + 1] + .0722 * data[i + 2];
|
|
167
|
+
data[i] = data[i + 1] = data[i + 2] = lum;
|
|
168
|
+
}
|
|
169
|
+
ctx.putImageData(imageData, 0, 0);
|
|
99
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Estimate the nadir subject distance in meters from the camera position.
|
|
173
|
+
*
|
|
174
|
+
* The SDK position is in ECI-like coordinates (km). Camera altitude above
|
|
175
|
+
* the Earth surface gives the approximate distance to the ground plane
|
|
176
|
+
* directly below (nadir). For oblique views the actual distance is larger,
|
|
177
|
+
* but nadir is the dominant case for satellite imagery.
|
|
178
|
+
*/
|
|
100
179
|
function estimateSubjectDistanceM(position) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return altKm * 1e3;
|
|
180
|
+
const [x, y, z] = position;
|
|
181
|
+
const rKm = Math.sqrt(x * x + y * y + z * z);
|
|
182
|
+
return Math.max(0, rKm - EARTH_RADIUS_KM) * 1e3;
|
|
105
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Compute depth-of-field blur radius in CSS pixels using the thin lens model.
|
|
186
|
+
*
|
|
187
|
+
* Thin lens circle of confusion (CoC) diameter:
|
|
188
|
+
* c = |f²/N × (S - D) / (D × (S - f))|
|
|
189
|
+
*
|
|
190
|
+
* where:
|
|
191
|
+
* f = focal length (mm)
|
|
192
|
+
* N = f-number (aperture)
|
|
193
|
+
* S = focusing distance (mm) — the plane in sharp focus
|
|
194
|
+
* D = subject distance (mm) — actual distance to the scene
|
|
195
|
+
*
|
|
196
|
+
* The CoC diameter is converted to pixels via pixel_pitch, then halved to
|
|
197
|
+
* get a blur radius. The result is clamped by the sensor's maximum
|
|
198
|
+
* acceptable CoC (args.coc) to model physical diffraction limits.
|
|
199
|
+
*
|
|
200
|
+
* Returns 0 when the scene is in acceptable focus (blur < 0.5px).
|
|
201
|
+
* Exported for unit testing.
|
|
202
|
+
*/
|
|
106
203
|
function computeDofBlurPx(args, subjectDistanceM) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const radiusPx = cocDiameterMm / ppMm / 2;
|
|
118
|
-
if (radiusPx < 0.5) return 0;
|
|
119
|
-
return Math.min(radiusPx, args.resolution / 4);
|
|
204
|
+
const fMm = args.focal_length;
|
|
205
|
+
const N = args.aperture;
|
|
206
|
+
const sMm = args.focusing_distance * 1e3;
|
|
207
|
+
const dMm = subjectDistanceM * 1e3;
|
|
208
|
+
const ppMm = args.pixel_pitch;
|
|
209
|
+
if (N <= 0 || fMm <= 0 || dMm <= 0 || ppMm <= 0 || sMm <= fMm) return 0;
|
|
210
|
+
if (Math.abs(sMm - dMm) < 1) return 0;
|
|
211
|
+
const radiusPx = Math.abs(fMm * fMm / N * (sMm - dMm) / (dMm * (sMm - fMm))) / ppMm / 2;
|
|
212
|
+
if (radiusPx < .5) return 0;
|
|
213
|
+
return Math.min(radiusPx, args.resolution / 4);
|
|
120
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Apply Gaussian depth-of-field blur to a 2D canvas context.
|
|
217
|
+
* Uses the native CSS `filter: blur()` for GPU-accelerated performance.
|
|
218
|
+
*
|
|
219
|
+
* The blur is applied by:
|
|
220
|
+
* 1. Drawing the current canvas content onto a temp canvas with blur filter
|
|
221
|
+
* 2. Copying the blurred result back
|
|
222
|
+
*
|
|
223
|
+
* This simulates the optical defocus that occurs when the subject distance
|
|
224
|
+
* doesn't match the focusing distance — exactly what happens when a
|
|
225
|
+
* satellite camera's focus plane is set incorrectly.
|
|
226
|
+
*/
|
|
121
227
|
function applyDofBlur(ctx, width, height, radiusPx) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
228
|
+
const tmp = document.createElement("canvas");
|
|
229
|
+
tmp.width = width;
|
|
230
|
+
tmp.height = height;
|
|
231
|
+
const tmpCtx = tmp.getContext("2d");
|
|
232
|
+
tmpCtx.filter = `blur(${radiusPx}px)`;
|
|
233
|
+
tmpCtx.drawImage(ctx.canvas, 0, 0);
|
|
234
|
+
ctx.clearRect(0, 0, width, height);
|
|
235
|
+
ctx.drawImage(tmp, 0, 0);
|
|
130
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Convert a data-URL string to a Uint8Array of the underlying binary data.
|
|
239
|
+
*/
|
|
131
240
|
function dataUrlToBytes(dataUrl) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
return bytes;
|
|
241
|
+
const base64 = dataUrl.split(",")[1];
|
|
242
|
+
const binaryStr = atob(base64);
|
|
243
|
+
const bytes = new Uint8Array(binaryStr.length);
|
|
244
|
+
for (let i = 0; i < binaryStr.length; i++) bytes[i] = binaryStr.charCodeAt(i);
|
|
245
|
+
return bytes;
|
|
139
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Creates a reusable CesiumJS capture source backed by a hidden viewer.
|
|
249
|
+
*
|
|
250
|
+
* The viewer is initialized once with `preserveDrawingBuffer: true` so
|
|
251
|
+
* canvas pixels survive after `scene.render()`. All Cesium UI widgets
|
|
252
|
+
* are disabled. The container is positioned off-screen (1x1 px) and
|
|
253
|
+
* resized to the requested resolution on each capture.
|
|
254
|
+
*
|
|
255
|
+
* @param options - Configuration for the hidden viewer
|
|
256
|
+
* @returns Handle with `capture(args)`, `destroy()`, and `ready` flag
|
|
257
|
+
*/
|
|
140
258
|
async function createCesiumCaptureSource(options = {}) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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
|
-
applyDofBlur(ctx, offscreen.width, offscreen.height, dofBlurRadius);
|
|
267
|
-
if (false) ;
|
|
268
|
-
}
|
|
269
|
-
if (args.monochromatic) {
|
|
270
|
-
applyGrayscale(ctx, offscreen.width, offscreen.height);
|
|
271
|
-
}
|
|
272
|
-
const dataUrl2 = jpegQuality !== void 0 ? offscreen.toDataURL(fmt, jpegQuality) : offscreen.toDataURL(fmt);
|
|
273
|
-
return dataUrlToBytes(dataUrl2);
|
|
274
|
-
}
|
|
275
|
-
const dataUrl = jpegQuality !== void 0 ? canvas.toDataURL(fmt, jpegQuality) : canvas.toDataURL(fmt);
|
|
276
|
-
return dataUrlToBytes(dataUrl);
|
|
277
|
-
} catch (err) {
|
|
278
|
-
return loadPlaceholderFallback();
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
const destroy = () => {
|
|
282
|
-
if (destroyed) return;
|
|
283
|
-
destroyed = true;
|
|
284
|
-
try {
|
|
285
|
-
viewer.destroy();
|
|
286
|
-
} catch {
|
|
287
|
-
}
|
|
288
|
-
if (ownsContainer && container && container.parentNode) {
|
|
289
|
-
container.parentNode.removeChild(container);
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
return {
|
|
293
|
-
capture,
|
|
294
|
-
destroy,
|
|
295
|
-
get ready() {
|
|
296
|
-
return !destroyed;
|
|
297
|
-
}
|
|
298
|
-
};
|
|
259
|
+
const Cesium = await import("cesium");
|
|
260
|
+
if (options.accessToken) Cesium.Ion.defaultAccessToken = options.accessToken;
|
|
261
|
+
let container = options.container ?? null;
|
|
262
|
+
let ownsContainer = false;
|
|
263
|
+
if (!container) {
|
|
264
|
+
container = document.createElement("div");
|
|
265
|
+
container.style.cssText = "position:fixed;left:0;top:0;width:1px;height:1px;overflow:hidden;clip-path:inset(100%);pointer-events:none;z-index:-1;";
|
|
266
|
+
document.body.appendChild(container);
|
|
267
|
+
ownsContainer = true;
|
|
268
|
+
}
|
|
269
|
+
const viewer = new Cesium.Viewer(container, {
|
|
270
|
+
baseLayerPicker: false,
|
|
271
|
+
fullscreenButton: false,
|
|
272
|
+
vrButton: false,
|
|
273
|
+
geocoder: false,
|
|
274
|
+
homeButton: false,
|
|
275
|
+
sceneModePicker: false,
|
|
276
|
+
timeline: false,
|
|
277
|
+
navigationHelpButton: false,
|
|
278
|
+
animation: false,
|
|
279
|
+
scene3DOnly: true,
|
|
280
|
+
useDefaultRenderLoop: false,
|
|
281
|
+
requestRenderMode: true,
|
|
282
|
+
contextOptions: { webgl: { preserveDrawingBuffer: true } }
|
|
283
|
+
});
|
|
284
|
+
viewer.scene.globe.enableLighting = false;
|
|
285
|
+
viewer.scene.backgroundColor = Cesium.Color.BLACK;
|
|
286
|
+
viewer.scene.skyBox = void 0;
|
|
287
|
+
viewer.scene.moon = void 0;
|
|
288
|
+
if (options.useOpenStreetMapImagery !== false) {
|
|
289
|
+
viewer.imageryLayers.removeAll();
|
|
290
|
+
const tileUrl = options.imageryUrl || "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}";
|
|
291
|
+
viewer.imageryLayers.addImageryProvider(new Cesium.UrlTemplateImageryProvider({
|
|
292
|
+
url: tileUrl,
|
|
293
|
+
credit: "© Esri, Maxar, Earthstar Geographics",
|
|
294
|
+
maximumLevel: 19
|
|
295
|
+
}));
|
|
296
|
+
}
|
|
297
|
+
if (options.terrain && options.accessToken) try {
|
|
298
|
+
viewer.scene.terrainProvider = await Cesium.CesiumTerrainProvider.fromIonAssetId(1);
|
|
299
|
+
} catch {}
|
|
300
|
+
let destroyed = false;
|
|
301
|
+
const capture = async (args) => {
|
|
302
|
+
if (destroyed) return /* @__PURE__ */ new Uint8Array(0);
|
|
303
|
+
try {
|
|
304
|
+
const res = args.sample ? Math.max(64, Math.round(args.resolution / 2)) : args.resolution;
|
|
305
|
+
container.style.width = `${res}px`;
|
|
306
|
+
container.style.height = `${res}px`;
|
|
307
|
+
container.clientWidth;
|
|
308
|
+
viewer.resize();
|
|
309
|
+
await new Promise((r) => requestAnimationFrame(() => r()));
|
|
310
|
+
await new Promise((r) => requestAnimationFrame(() => r()));
|
|
311
|
+
viewer.resize();
|
|
312
|
+
const cameraPosition = positionToCartesian3(Cesium, args.position);
|
|
313
|
+
const [heading, pitch, roll] = args.rotation;
|
|
314
|
+
viewer.camera.setView({
|
|
315
|
+
destination: cameraPosition,
|
|
316
|
+
orientation: {
|
|
317
|
+
heading: Cesium.Math.toRadians(heading),
|
|
318
|
+
pitch: Cesium.Math.toRadians(pitch),
|
|
319
|
+
roll: Cesium.Math.toRadians(roll)
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
const opticalFov = computeOpticalFov(args.focal_length, args.pixel_pitch, args.resolution);
|
|
323
|
+
let effectiveFov = args.fov;
|
|
324
|
+
if (effectiveFov <= 0 || effectiveFov >= 180) {
|
|
325
|
+
if (opticalFov !== null && opticalFov > 0 && opticalFov < 180) effectiveFov = opticalFov;
|
|
326
|
+
}
|
|
327
|
+
if (effectiveFov > 0 && effectiveFov < 180) viewer.camera.frustum.fov = effectiveFov * DEG_TO_RAD;
|
|
328
|
+
const maxWaitMs = options.tileLoadTimeoutMs ?? 1e4;
|
|
329
|
+
const pollIntervalMs = 200;
|
|
330
|
+
const startMs = performance.now();
|
|
331
|
+
const deadline = startMs + maxWaitMs;
|
|
332
|
+
viewer.scene.requestRender();
|
|
333
|
+
viewer.scene.forceRender();
|
|
334
|
+
let tileWaitLoops = 0;
|
|
335
|
+
while (!viewer.scene.globe.tilesLoaded && performance.now() < deadline) {
|
|
336
|
+
tileWaitLoops++;
|
|
337
|
+
options.onTileLoadProgress?.(performance.now() - startMs);
|
|
338
|
+
await new Promise((r) => setTimeout(r, pollIntervalMs));
|
|
339
|
+
viewer.scene.requestRender();
|
|
340
|
+
viewer.scene.forceRender();
|
|
341
|
+
}
|
|
342
|
+
viewer.scene.requestRender();
|
|
343
|
+
viewer.scene.forceRender();
|
|
344
|
+
await new Promise((r) => requestAnimationFrame(() => r()));
|
|
345
|
+
viewer.scene.requestRender();
|
|
346
|
+
viewer.scene.forceRender();
|
|
347
|
+
await new Promise((r) => requestAnimationFrame(() => r()));
|
|
348
|
+
viewer.scene.forceRender();
|
|
349
|
+
const canvas = viewer.scene.canvas;
|
|
350
|
+
const fmt = args.format === "jpeg" ? "image/jpeg" : "image/png";
|
|
351
|
+
const jpegQuality = args.format === "jpeg" ? args.jpeg_quality ?? .92 : void 0;
|
|
352
|
+
let dofBlurRadius = 0;
|
|
353
|
+
if (args.focusing_distance > 0 && args.aperture > 0) dofBlurRadius = computeDofBlurPx(args, estimateSubjectDistanceM(args.position));
|
|
354
|
+
if (dofBlurRadius > 0 || args.monochromatic) {
|
|
355
|
+
const offscreen = document.createElement("canvas");
|
|
356
|
+
offscreen.width = canvas.width;
|
|
357
|
+
offscreen.height = canvas.height;
|
|
358
|
+
const ctx = offscreen.getContext("2d");
|
|
359
|
+
ctx.drawImage(canvas, 0, 0);
|
|
360
|
+
if (dofBlurRadius > 0) applyDofBlur(ctx, offscreen.width, offscreen.height, dofBlurRadius);
|
|
361
|
+
if (args.monochromatic) applyGrayscale(ctx, offscreen.width, offscreen.height);
|
|
362
|
+
return dataUrlToBytes(jpegQuality !== void 0 ? offscreen.toDataURL(fmt, jpegQuality) : offscreen.toDataURL(fmt));
|
|
363
|
+
}
|
|
364
|
+
return dataUrlToBytes(jpegQuality !== void 0 ? canvas.toDataURL(fmt, jpegQuality) : canvas.toDataURL(fmt));
|
|
365
|
+
} catch (err) {
|
|
366
|
+
return loadPlaceholderFallback();
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
const destroy = () => {
|
|
370
|
+
if (destroyed) return;
|
|
371
|
+
destroyed = true;
|
|
372
|
+
try {
|
|
373
|
+
viewer.destroy();
|
|
374
|
+
} catch {}
|
|
375
|
+
if (ownsContainer && container && container.parentNode) container.parentNode.removeChild(container);
|
|
376
|
+
};
|
|
377
|
+
return {
|
|
378
|
+
capture,
|
|
379
|
+
destroy,
|
|
380
|
+
get ready() {
|
|
381
|
+
return !destroyed;
|
|
382
|
+
}
|
|
383
|
+
};
|
|
299
384
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
ecefMetersToSdkPosition,
|
|
305
|
-
eulerXyzToHpr
|
|
306
|
-
};
|
|
307
|
-
//# sourceMappingURL=CesiumCaptureSource.js.map
|
|
385
|
+
//#endregion
|
|
386
|
+
export { computeDofBlurPx, createCesiumCaptureSource, ecefEulerXyzToHpr, ecefMetersToSdkPosition, eulerXyzToHpr };
|
|
387
|
+
|
|
388
|
+
//# sourceMappingURL=CesiumCaptureSource.js.map
|