@zendir/ui 0.5.0 → 0.6.1

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.
Files changed (391) hide show
  1. package/CHANGELOG.md +419 -386
  2. package/README.md +640 -631
  3. package/dist/_virtual/_rolldown/runtime.js +13 -0
  4. package/dist/index.js +17 -221
  5. package/dist/react/3d/CesiumCaptureSource.d.ts +0 -1
  6. package/dist/react/3d/CesiumCaptureSource.js +364 -283
  7. package/dist/react/3d/CesiumCaptureSource.js.map +1 -1
  8. package/dist/react/3d/ZenSpace3D.d.ts +2 -3
  9. package/dist/react/3d/ZenSpace3D.js +1681 -1237
  10. package/dist/react/3d/ZenSpace3D.js.map +1 -1
  11. package/dist/react/3d/ZenSpace3DCesium.d.ts +0 -1
  12. package/dist/react/3d/ZenSpace3DCesium.js +513 -560
  13. package/dist/react/3d/ZenSpace3DCesium.js.map +1 -1
  14. package/dist/react/3d/ZenSpace3DShaders.js +61 -66
  15. package/dist/react/3d/ZenSpace3DShaders.js.map +1 -1
  16. package/dist/react/3d/ZenSpace3DTypes.d.ts +19 -20
  17. package/dist/react/3d/ZenSpace3DUtils.d.ts +0 -1
  18. package/dist/react/3d/ZenSpace3DUtils.js +37 -24
  19. package/dist/react/3d/ZenSpace3DUtils.js.map +1 -1
  20. package/dist/react/3d/capturePngAnalysis.js +42 -36
  21. package/dist/react/3d/capturePngAnalysis.js.map +1 -1
  22. package/dist/react/3d/index.d.ts +3 -3
  23. package/dist/react/3d/index.js +5 -53
  24. package/dist/react/3d/threeLoader.d.ts +1 -1
  25. package/dist/react/3d/threeLoader.js +23 -18
  26. package/dist/react/3d/threeLoader.js.map +1 -1
  27. package/dist/react/astro/ClassificationBanner.d.ts +2 -3
  28. package/dist/react/astro/ClassificationBanner.js +95 -79
  29. package/dist/react/astro/ClassificationBanner.js.map +1 -1
  30. package/dist/react/astro/GlobalStatusBar.d.ts +0 -1
  31. package/dist/react/astro/GlobalStatusBar.js +157 -163
  32. package/dist/react/astro/GlobalStatusBar.js.map +1 -1
  33. package/dist/react/astro/MissionClock.d.ts +7 -8
  34. package/dist/react/astro/MissionClock.js +377 -400
  35. package/dist/react/astro/MissionClock.js.map +1 -1
  36. package/dist/react/astro/MonitoringIcon.d.ts +1 -2
  37. package/dist/react/astro/MonitoringIcon.js +422 -358
  38. package/dist/react/astro/MonitoringIcon.js.map +1 -1
  39. package/dist/react/astro/Notification.d.ts +1 -2
  40. package/dist/react/astro/Notification.js +229 -126
  41. package/dist/react/astro/Notification.js.map +1 -1
  42. package/dist/react/astro/Progress.d.ts +0 -1
  43. package/dist/react/astro/Progress.js +199 -141
  44. package/dist/react/astro/Progress.js.map +1 -1
  45. package/dist/react/astro/SimulationControls.d.ts +3 -4
  46. package/dist/react/astro/SimulationControls.js +596 -650
  47. package/dist/react/astro/SimulationControls.js.map +1 -1
  48. package/dist/react/astro/StatusIndicator.d.ts +0 -1
  49. package/dist/react/astro/StatusIndicator.js +236 -170
  50. package/dist/react/astro/StatusIndicator.js.map +1 -1
  51. package/dist/react/astro/UnifiedTimeline.d.ts +9 -10
  52. package/dist/react/astro/UnifiedTimeline.js +2345 -2392
  53. package/dist/react/astro/UnifiedTimeline.js.map +1 -1
  54. package/dist/react/astro/index.d.ts +5 -5
  55. package/dist/react/astro/index.js +1 -25
  56. package/dist/react/cards/AccessCard.d.ts +0 -1
  57. package/dist/react/cards/AccessCard.js +471 -405
  58. package/dist/react/cards/AccessCard.js.map +1 -1
  59. package/dist/react/cards/OrbitCard.d.ts +0 -1
  60. package/dist/react/cards/OrbitCard.js +487 -364
  61. package/dist/react/cards/OrbitCard.js.map +1 -1
  62. package/dist/react/cards/SpacecraftCard.d.ts +0 -1
  63. package/dist/react/cards/SpacecraftCard.js +813 -925
  64. package/dist/react/cards/SpacecraftCard.js.map +1 -1
  65. package/dist/react/cards/TelemetryCard.d.ts +0 -1
  66. package/dist/react/cards/TelemetryCard.js +1055 -732
  67. package/dist/react/cards/TelemetryCard.js.map +1 -1
  68. package/dist/react/cards/TelemetryStreamCard.d.ts +0 -1
  69. package/dist/react/cards/TelemetryStreamCard.js +323 -297
  70. package/dist/react/cards/TelemetryStreamCard.js.map +1 -1
  71. package/dist/react/cards/index.d.ts +1 -1
  72. package/dist/react/cards/index.js +1 -8
  73. package/dist/react/charts/GroundTrackMap.d.ts +6 -7
  74. package/dist/react/charts/GroundTrackMap.js +1377 -1256
  75. package/dist/react/charts/GroundTrackMap.js.map +1 -1
  76. package/dist/react/charts/GroundTrackMapLeaflet.d.ts +1 -2
  77. package/dist/react/charts/GroundTrackMapLeaflet.js +1065 -987
  78. package/dist/react/charts/GroundTrackMapLeaflet.js.map +1 -1
  79. package/dist/react/charts/groundTrackMapLeafletTiles.js +34 -25
  80. package/dist/react/charts/groundTrackMapLeafletTiles.js.map +1 -1
  81. package/dist/react/charts/groundTrackMapLeafletUtils.js +70 -61
  82. package/dist/react/charts/groundTrackMapLeafletUtils.js.map +1 -1
  83. package/dist/react/charts/index.d.ts +1 -1
  84. package/dist/react/charts/index.js +7 -100
  85. package/dist/react/charts/unified/AstroChart.d.ts +1 -2
  86. package/dist/react/charts/unified/AstroChart.js +1331 -1411
  87. package/dist/react/charts/unified/AstroChart.js.map +1 -1
  88. package/dist/react/charts/unified/PowerOverviewChart.d.ts +3 -3
  89. package/dist/react/charts/unified/PowerOverviewChart.js +495 -478
  90. package/dist/react/charts/unified/PowerOverviewChart.js.map +1 -1
  91. package/dist/react/charts/unified/domain.d.ts +12 -13
  92. package/dist/react/charts/unified/domain.js +3999 -3145
  93. package/dist/react/charts/unified/domain.js.map +1 -1
  94. package/dist/react/charts/unified/generators.d.ts +3 -4
  95. package/dist/react/charts/unified/generators.js +561 -498
  96. package/dist/react/charts/unified/generators.js.map +1 -1
  97. package/dist/react/charts/unified/index.d.ts +1 -1
  98. package/dist/react/charts/unified/presets.d.ts +14 -15
  99. package/dist/react/charts/unified/presets.js +857 -994
  100. package/dist/react/charts/unified/presets.js.map +1 -1
  101. package/dist/react/charts/unified/sync.d.ts +2 -3
  102. package/dist/react/charts/unified/sync.js +229 -195
  103. package/dist/react/charts/unified/sync.js.map +1 -1
  104. package/dist/react/charts/unified/theme.d.ts +11 -12
  105. package/dist/react/charts/unified/theme.js +606 -642
  106. package/dist/react/charts/unified/theme.js.map +1 -1
  107. package/dist/react/charts/unified/types.d.ts +32 -33
  108. package/dist/react/charts/unified/useChartStream.d.ts +1 -2
  109. package/dist/react/charts/unified/useChartStream.js +203 -216
  110. package/dist/react/charts/unified/useChartStream.js.map +1 -1
  111. package/dist/react/chatgpt/AppCard.d.ts +1 -2
  112. package/dist/react/chatgpt/index.d.ts +7 -7
  113. package/dist/react/chatgpt/index.js +160 -139
  114. package/dist/react/chatgpt/index.js.map +1 -1
  115. package/dist/react/context/CategoryContext.d.ts +0 -1
  116. package/dist/react/context/CategoryContext.js +78 -29
  117. package/dist/react/context/CategoryContext.js.map +1 -1
  118. package/dist/react/context/DisplaySettingsContext.d.ts +1 -2
  119. package/dist/react/context/DisplaySettingsContext.js +205 -156
  120. package/dist/react/context/DisplaySettingsContext.js.map +1 -1
  121. package/dist/react/context/SpatialSelectionContext.d.ts +0 -1
  122. package/dist/react/context/SpatialSelectionContext.js +36 -7
  123. package/dist/react/context/SpatialSelectionContext.js.map +1 -1
  124. package/dist/react/core/data/DataTable.d.ts +3 -4
  125. package/dist/react/core/data/DataTable.js +473 -440
  126. package/dist/react/core/data/DataTable.js.map +1 -1
  127. package/dist/react/core/data/DataValue.d.ts +4 -5
  128. package/dist/react/core/data/DataValue.js +605 -571
  129. package/dist/react/core/data/DataValue.js.map +1 -1
  130. package/dist/react/core/data/propertyConfig.d.ts +1 -2
  131. package/dist/react/core/data/propertyConfig.js +446 -382
  132. package/dist/react/core/data/propertyConfig.js.map +1 -1
  133. package/dist/react/core/display/AstroIcon.d.ts +4 -5
  134. package/dist/react/core/display/AstroIcon.js +339 -429
  135. package/dist/react/core/display/AstroIcon.js.map +1 -1
  136. package/dist/react/core/display/Badge.d.ts +2 -3
  137. package/dist/react/core/display/Badge.js +131 -131
  138. package/dist/react/core/display/Badge.js.map +1 -1
  139. package/dist/react/core/display/CardHeader.d.ts +0 -1
  140. package/dist/react/core/display/CardHeader.js +398 -311
  141. package/dist/react/core/display/CardHeader.js.map +1 -1
  142. package/dist/react/core/display/Container.d.ts +2 -3
  143. package/dist/react/core/display/Container.js +640 -668
  144. package/dist/react/core/display/Container.js.map +1 -1
  145. package/dist/react/core/display/CopyButton.d.ts +1 -2
  146. package/dist/react/core/display/CopyButton.js +158 -101
  147. package/dist/react/core/display/CopyButton.js.map +1 -1
  148. package/dist/react/core/display/GlassCard.d.ts +3 -4
  149. package/dist/react/core/display/GlassCard.js +416 -369
  150. package/dist/react/core/display/GlassCard.js.map +1 -1
  151. package/dist/react/core/display/HeaderIconWithStatus.d.ts +0 -1
  152. package/dist/react/core/display/HeaderIconWithStatus.js +152 -152
  153. package/dist/react/core/display/HeaderIconWithStatus.js.map +1 -1
  154. package/dist/react/core/display/Icon.d.ts +2 -3
  155. package/dist/react/core/display/Icon.js +172 -143
  156. package/dist/react/core/display/Icon.js.map +1 -1
  157. package/dist/react/core/display/Typography.d.ts +24 -25
  158. package/dist/react/core/display/Typography.js +360 -178
  159. package/dist/react/core/display/Typography.js.map +1 -1
  160. package/dist/react/core/feedback/ConfirmDialog.d.ts +1 -2
  161. package/dist/react/core/feedback/ConfirmDialog.js +343 -304
  162. package/dist/react/core/feedback/ConfirmDialog.js.map +1 -1
  163. package/dist/react/core/feedback/Dialog.d.ts +2 -3
  164. package/dist/react/core/feedback/Dialog.js +189 -197
  165. package/dist/react/core/feedback/Dialog.js.map +1 -1
  166. package/dist/react/core/feedback/Toast.d.ts +2 -3
  167. package/dist/react/core/feedback/Toast.js +346 -207
  168. package/dist/react/core/feedback/Toast.js.map +1 -1
  169. package/dist/react/core/index.d.ts +26 -26
  170. package/dist/react/core/index.js +7 -119
  171. package/dist/react/core/inputs/Button.d.ts +2 -3
  172. package/dist/react/core/inputs/Button.js +281 -304
  173. package/dist/react/core/inputs/Button.js.map +1 -1
  174. package/dist/react/core/inputs/Checkbox.d.ts +2 -3
  175. package/dist/react/core/inputs/Checkbox.js +139 -127
  176. package/dist/react/core/inputs/Checkbox.js.map +1 -1
  177. package/dist/react/core/inputs/Input.d.ts +3 -4
  178. package/dist/react/core/inputs/Input.js +277 -285
  179. package/dist/react/core/inputs/Input.js.map +1 -1
  180. package/dist/react/core/inputs/LimitsBar.d.ts +1 -2
  181. package/dist/react/core/inputs/LimitsBar.js +271 -196
  182. package/dist/react/core/inputs/LimitsBar.js.map +1 -1
  183. package/dist/react/core/inputs/NumberInput.d.ts +2 -3
  184. package/dist/react/core/inputs/NumberInput.js +531 -503
  185. package/dist/react/core/inputs/NumberInput.js.map +1 -1
  186. package/dist/react/core/inputs/PinInput.d.ts +2 -3
  187. package/dist/react/core/inputs/PinInput.js +224 -207
  188. package/dist/react/core/inputs/PinInput.js.map +1 -1
  189. package/dist/react/core/inputs/Select.d.ts +1 -2
  190. package/dist/react/core/inputs/Select.js +298 -299
  191. package/dist/react/core/inputs/Select.js.map +1 -1
  192. package/dist/react/core/inputs/Toggle.d.ts +2 -3
  193. package/dist/react/core/inputs/Toggle.js +142 -148
  194. package/dist/react/core/inputs/Toggle.js.map +1 -1
  195. package/dist/react/core/layout/Box.d.ts +3 -4
  196. package/dist/react/core/layout/Box.js +118 -122
  197. package/dist/react/core/layout/Box.js.map +1 -1
  198. package/dist/react/core/layout/Center.d.ts +0 -1
  199. package/dist/react/core/layout/Center.js +45 -32
  200. package/dist/react/core/layout/Center.js.map +1 -1
  201. package/dist/react/core/layout/Divider.d.ts +1 -2
  202. package/dist/react/core/layout/Divider.js +112 -106
  203. package/dist/react/core/layout/Divider.js.map +1 -1
  204. package/dist/react/core/layout/Flex.d.ts +4 -5
  205. package/dist/react/core/layout/Flex.js +120 -124
  206. package/dist/react/core/layout/Flex.js.map +1 -1
  207. package/dist/react/core/layout/Grid.d.ts +5 -6
  208. package/dist/react/core/layout/Grid.js +131 -138
  209. package/dist/react/core/layout/Grid.js.map +1 -1
  210. package/dist/react/core/layout/Spacer.d.ts +0 -1
  211. package/dist/react/core/layout/Spacer.js +36 -29
  212. package/dist/react/core/layout/Spacer.js.map +1 -1
  213. package/dist/react/core/layout/Stack.d.ts +4 -5
  214. package/dist/react/core/layout/Stack.js +127 -70
  215. package/dist/react/core/layout/Stack.js.map +1 -1
  216. package/dist/react/core/layout/responsive.d.ts +1 -2
  217. package/dist/react/core/layout/responsive.js +25 -19
  218. package/dist/react/core/layout/responsive.js.map +1 -1
  219. package/dist/react/core/layout/useBreakpoint.d.ts +1 -1
  220. package/dist/react/core/layout/useBreakpoint.js +119 -66
  221. package/dist/react/core/layout/useBreakpoint.js.map +1 -1
  222. package/dist/react/core/navigation/AppBar.d.ts +1 -2
  223. package/dist/react/core/navigation/AppBar.js +827 -805
  224. package/dist/react/core/navigation/AppBar.js.map +1 -1
  225. package/dist/react/core/navigation/Pagination.d.ts +2 -3
  226. package/dist/react/core/navigation/Pagination.js +207 -187
  227. package/dist/react/core/navigation/Pagination.js.map +1 -1
  228. package/dist/react/core/navigation/SideNav.d.ts +5 -6
  229. package/dist/react/core/navigation/SideNav.js +855 -629
  230. package/dist/react/core/navigation/SideNav.js.map +1 -1
  231. package/dist/react/core/navigation/Tabs.d.ts +0 -1
  232. package/dist/react/core/navigation/Tabs.js +113 -119
  233. package/dist/react/core/navigation/Tabs.js.map +1 -1
  234. package/dist/react/core/overlays/Popover.d.ts +2 -3
  235. package/dist/react/core/overlays/Popover.js +303 -282
  236. package/dist/react/core/overlays/Popover.js.map +1 -1
  237. package/dist/react/core/overlays/SidePanel.d.ts +1 -2
  238. package/dist/react/core/overlays/SidePanel.js +217 -212
  239. package/dist/react/core/overlays/SidePanel.js.map +1 -1
  240. package/dist/react/core/overlays/Tooltip.d.ts +1 -2
  241. package/dist/react/core/overlays/Tooltip.js +170 -176
  242. package/dist/react/core/overlays/Tooltip.js.map +1 -1
  243. package/dist/react/core/widgets/ActivityPlanner.d.ts +0 -1
  244. package/dist/react/core/widgets/ActivityPlanner.js +855 -517
  245. package/dist/react/core/widgets/ActivityPlanner.js.map +1 -1
  246. package/dist/react/core/widgets/Capture.d.ts +2 -3
  247. package/dist/react/core/widgets/Capture.js +965 -779
  248. package/dist/react/core/widgets/Capture.js.map +1 -1
  249. package/dist/react/core/widgets/ChatPanel.d.ts +16 -17
  250. package/dist/react/core/widgets/ChatPanel.js +1734 -1034
  251. package/dist/react/core/widgets/ChatPanel.js.map +1 -1
  252. package/dist/react/core/widgets/ColorPickerPanel.d.ts +0 -1
  253. package/dist/react/core/widgets/ColorPickerPanel.js +298 -287
  254. package/dist/react/core/widgets/ColorPickerPanel.js.map +1 -1
  255. package/dist/react/core/widgets/CommandBuilder.d.ts +2 -3
  256. package/dist/react/core/widgets/CommandBuilder.js +624 -516
  257. package/dist/react/core/widgets/CommandBuilder.js.map +1 -1
  258. package/dist/react/core/widgets/ConnectionForm.d.ts +2 -3
  259. package/dist/react/core/widgets/ConnectionForm.js +528 -492
  260. package/dist/react/core/widgets/ConnectionForm.js.map +1 -1
  261. package/dist/react/core/widgets/FileExplorer.d.ts +3 -4
  262. package/dist/react/core/widgets/FileExplorer.js +617 -505
  263. package/dist/react/core/widgets/FileExplorer.js.map +1 -1
  264. package/dist/react/core/widgets/HexViewer.d.ts +2 -3
  265. package/dist/react/core/widgets/HexViewer.js +1353 -1091
  266. package/dist/react/core/widgets/HexViewer.js.map +1 -1
  267. package/dist/react/core/widgets/ImageFrame.d.ts +1 -2
  268. package/dist/react/core/widgets/ImageFrame.js +230 -193
  269. package/dist/react/core/widgets/ImageFrame.js.map +1 -1
  270. package/dist/react/core/widgets/ImageGallery.d.ts +2 -1
  271. package/dist/react/core/widgets/ImageGallery.js +380 -314
  272. package/dist/react/core/widgets/ImageGallery.js.map +1 -1
  273. package/dist/react/core/widgets/ImagePanel.d.ts +0 -1
  274. package/dist/react/core/widgets/ImagePanel.js +110 -101
  275. package/dist/react/core/widgets/ImagePanel.js.map +1 -1
  276. package/dist/react/core/widgets/LogViewer.d.ts +2 -3
  277. package/dist/react/core/widgets/LogViewer.js +711 -607
  278. package/dist/react/core/widgets/LogViewer.js.map +1 -1
  279. package/dist/react/core/widgets/MessageStream.d.ts +3 -4
  280. package/dist/react/core/widgets/MessageStream.js +514 -444
  281. package/dist/react/core/widgets/MessageStream.js.map +1 -1
  282. package/dist/react/core/widgets/MissionCalendar.d.ts +3 -4
  283. package/dist/react/core/widgets/MissionCalendar.js +1488 -1020
  284. package/dist/react/core/widgets/MissionCalendar.js.map +1 -1
  285. package/dist/react/core/widgets/PacketViewer.d.ts +2 -3
  286. package/dist/react/core/widgets/PacketViewer.js +550 -421
  287. package/dist/react/core/widgets/PacketViewer.js.map +1 -1
  288. package/dist/react/core/widgets/capture-placeholder.png.js +6 -5
  289. package/dist/react/core/widgets/capture-placeholder.png.js.map +1 -1
  290. package/dist/react/hooks/index.d.ts +5 -5
  291. package/dist/react/hooks/useAccessWindows.d.ts +0 -1
  292. package/dist/react/hooks/useCompactMode.d.ts +1 -1
  293. package/dist/react/hooks/useCompactMode.js +104 -58
  294. package/dist/react/hooks/useCompactMode.js.map +1 -1
  295. package/dist/react/hooks/useGroundTrackHistory.d.ts +0 -1
  296. package/dist/react/hooks/useSimulationScene.d.ts +1 -2
  297. package/dist/react/hooks/useSimulationScene.js +481 -374
  298. package/dist/react/hooks/useSimulationScene.js.map +1 -1
  299. package/dist/react/index.d.ts +3 -3
  300. package/dist/react/panels/LayerControlPanel.d.ts +1 -2
  301. package/dist/react/panels/LayerControlPanel.js +223 -180
  302. package/dist/react/panels/LayerControlPanel.js.map +1 -1
  303. package/dist/react/panels/ObjectInventoryPanel.d.ts +2 -3
  304. package/dist/react/panels/ObjectInventoryPanel.js +315 -250
  305. package/dist/react/panels/ObjectInventoryPanel.js.map +1 -1
  306. package/dist/react/panels/index.d.ts +1 -1
  307. package/dist/react/panels/index.js +1 -6
  308. package/dist/react/shared/ErrorBoundary.d.ts +1 -2
  309. package/dist/react/shared/ErrorBoundary.js +170 -139
  310. package/dist/react/shared/ErrorBoundary.js.map +1 -1
  311. package/dist/react/shared/Skeleton.d.ts +1 -2
  312. package/dist/react/shared/Skeleton.js +300 -301
  313. package/dist/react/shared/Skeleton.js.map +1 -1
  314. package/dist/react/theme/ThemeProvider.d.ts +2 -321
  315. package/dist/react/theme/ThemeProvider.js +313 -939
  316. package/dist/react/theme/ThemeProvider.js.map +1 -1
  317. package/dist/react/theme/cardAccent.d.ts +1 -2
  318. package/dist/react/theme/cardAccent.js +196 -126
  319. package/dist/react/theme/cardAccent.js.map +1 -1
  320. package/dist/react/theme/config.d.ts +0 -1
  321. package/dist/react/theme/config.js +47 -25
  322. package/dist/react/theme/config.js.map +1 -1
  323. package/dist/react/theme/index.d.ts +2 -2
  324. package/dist/react/theme/index.js +1 -16
  325. package/dist/react/theme/types.d.ts +332 -0
  326. package/dist/react/theme/types.js +39 -0
  327. package/dist/react/theme/types.js.map +1 -0
  328. package/dist/react/types.d.ts +8 -8
  329. package/dist/react/types.js +147 -47
  330. package/dist/react/types.js.map +1 -1
  331. package/dist/react/utils/categoryPalette.d.ts +0 -1
  332. package/dist/react/utils/categoryPalette.js +91 -102
  333. package/dist/react/utils/categoryPalette.js.map +1 -1
  334. package/dist/react/utils/index.d.ts +5 -5
  335. package/dist/react/utils/index.js +457 -371
  336. package/dist/react/utils/index.js.map +1 -1
  337. package/dist/react/visualizations/EclipseTimerCard.d.ts +0 -1
  338. package/dist/react/visualizations/LinkBudgetCard.d.ts +0 -1
  339. package/dist/react/visualizations/NavBallCard.d.ts +0 -1
  340. package/dist/react/visualizations/PropulsionCard.d.ts +1 -2
  341. package/dist/react/visualizations/SensorFootprintCard.d.ts +1 -2
  342. package/dist/react/visualizations/ThermalHeatmapCard.d.ts +0 -1
  343. package/dist/react/visualizations/index.d.ts +3 -3
  344. package/dist/react.d.ts +2 -1
  345. package/dist/react.js +17 -221
  346. package/dist/shaders/atmosphere.frag.js +6 -5
  347. package/dist/shaders/atmosphere.frag.js.map +1 -1
  348. package/dist/shaders/atmosphere.vert.js +6 -5
  349. package/dist/shaders/atmosphere.vert.js.map +1 -1
  350. package/dist/shaders/stars.frag.js +6 -5
  351. package/dist/shaders/stars.frag.js.map +1 -1
  352. package/dist/shaders/stars.vert.js +6 -5
  353. package/dist/shaders/stars.vert.js.map +1 -1
  354. package/dist/style.css +26 -3
  355. package/dist/tokens/core.d.ts +159 -0
  356. package/dist/tokens/core.js +144 -0
  357. package/dist/tokens/core.js.map +1 -0
  358. package/dist/tokens/css-vars.d.ts +213 -2
  359. package/dist/tokens/css-vars.js +590 -227
  360. package/dist/tokens/css-vars.js.map +1 -1
  361. package/dist/tokens/index.d.ts +31 -228
  362. package/dist/tokens/index.js +281 -366
  363. package/dist/tokens/index.js.map +1 -1
  364. package/dist/tokens/palettes/astro.d.ts +129 -0
  365. package/dist/tokens/palettes/astro.js +112 -0
  366. package/dist/tokens/palettes/astro.js.map +1 -0
  367. package/dist/tokens/palettes/index.d.ts +288 -0
  368. package/dist/tokens/palettes/index.js +35 -0
  369. package/dist/tokens/palettes/index.js.map +1 -0
  370. package/dist/tokens/palettes/tailwind.d.ts +324 -0
  371. package/dist/tokens/palettes/tailwind.js +201 -0
  372. package/dist/tokens/palettes/tailwind.js.map +1 -0
  373. package/dist/tokens/palettes/zendir.d.ts +126 -0
  374. package/dist/tokens/palettes/zendir.js +92 -0
  375. package/dist/tokens/palettes/zendir.js.map +1 -0
  376. package/dist/tokens/themes.d.ts +30 -0
  377. package/dist/tokens/themes.js +704 -0
  378. package/dist/tokens/themes.js.map +1 -0
  379. package/dist/tokens/tokens.css +533 -155
  380. package/dist/types/index.d.ts +2 -2
  381. package/package.json +310 -313
  382. package/dist/index.js.map +0 -1
  383. package/dist/react/3d/index.js.map +0 -1
  384. package/dist/react/astro/index.js.map +0 -1
  385. package/dist/react/cards/index.js.map +0 -1
  386. package/dist/react/charts/index.js.map +0 -1
  387. package/dist/react/core/index.js.map +0 -1
  388. package/dist/react/panels/index.js.map +0 -1
  389. package/dist/react/theme/astro-tokens.d.ts +0 -153
  390. package/dist/react/theme/index.js.map +0 -1
  391. package/dist/react.js.map +0 -1
@@ -1,579 +1,532 @@
1
+ import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from "react";
1
2
  import { jsx } from "react/jsx-runtime";
2
- import { forwardRef, useRef, useEffect, useCallback, useImperativeHandle } from "react";
3
- const EARTH_RADIUS_KM = 6371;
3
+ //#region src/react/3d/ZenSpace3DCesium.tsx
4
+ /**
5
+ * @zendir/ui - ZenSpace3D Cesium Backend
6
+ *
7
+ * Cesium-based 3D Earth/orbit view. Entities are reconciled **in-place** on
8
+ * each data update (position changes only) to avoid the WebGL context churn
9
+ * that occurs when entities are removed and re-added every polling tick.
10
+ *
11
+ * Layer visibility is controlled via the `layers` prop
12
+ * (all default to "sensible" if the key is absent):
13
+ *
14
+ * layers.labels — spacecraft / GS name labels (default: false)
15
+ * layers.coverage — coverage footprint ellipses + cones (default: false)
16
+ * layers.orbits — orbit-path polylines (default: true)
17
+ *
18
+ * Coverage geometry sources (checked in order per satellite):
19
+ * 1. Explicit `satelliteCoverages[].footprintPolygon` — ground polygon from SDK
20
+ * 2. Explicit `satelliteCoverages[].halfAngle` — circular cone from half-angle
21
+ * 3. Auto-computed circular ellipse from altitude (when layers.coverage = true)
22
+ *
23
+ * Additional explicit coverage options per `SatelliteCoverage`:
24
+ * showCone — 3-D sensor cone from satellite to footprint
25
+ * showNadirLine — dashed line from satellite to sub-satellite point
26
+ */
27
+ var EARTH_RADIUS_KM = 6371;
28
+ /**
29
+ * Convert an ECI / J2000 position (km, Earth-centred) into a Cesium
30
+ * `Cartesian3`. Cesium's Cartesian3 lives in the **ECEF (Earth-Fixed)**
31
+ * frame — the same frame Cesium for Unreal exposes when its
32
+ * `CesiumGeoreference` origin is set to `TrueOrigin (0,0,0)`. We rotate
33
+ * ECI → ECEF using `Transforms.computeTemeToPseudoFixedMatrix(jd)`,
34
+ * which is GMST-based and accurate to sub-arcsec for visualisation
35
+ * (no IERS data required, fully synchronous).
36
+ *
37
+ * Returns `null` for non-finite inputs so callers can skip stale ticks
38
+ * without crashing Cesium's Cartesian primitives.
39
+ *
40
+ * @param positionKm ECI position in km (Earth-centred).
41
+ * @param julianDate Cesium JulianDate at which to evaluate Earth's rotation.
42
+ * Caller is responsible for advancing this with sim time.
43
+ */
4
44
  function eciKmToFixedCartesian3(Cesium, positionKm, julianDate) {
5
- if (!positionKm || !Number.isFinite(positionKm.x) || !Number.isFinite(positionKm.y) || !Number.isFinite(positionKm.z)) {
6
- return null;
7
- }
8
- const eciM = new Cesium.Cartesian3(
9
- positionKm.x * 1e3,
10
- positionKm.y * 1e3,
11
- positionKm.z * 1e3
12
- );
13
- const rot = Cesium.Transforms.computeTemeToPseudoFixedMatrix(julianDate);
14
- if (!rot) {
15
- return eciM;
16
- }
17
- return Cesium.Matrix3.multiplyByVector(rot, eciM, new Cesium.Cartesian3());
45
+ if (!positionKm || !Number.isFinite(positionKm.x) || !Number.isFinite(positionKm.y) || !Number.isFinite(positionKm.z)) return null;
46
+ const eciM = new Cesium.Cartesian3(positionKm.x * 1e3, positionKm.y * 1e3, positionKm.z * 1e3);
47
+ const rot = Cesium.Transforms.computeTemeToPseudoFixedMatrix(julianDate);
48
+ if (!rot) return eciM;
49
+ return Cesium.Matrix3.multiplyByVector(rot, eciM, new Cesium.Cartesian3());
18
50
  }
51
+ /**
52
+ * Sub-satellite (lat/lon) point + altitude (km) of an ECI position at a
53
+ * given epoch. Used by coverage/cone code that needs to draw on Earth's
54
+ * surface beneath the satellite.
55
+ */
19
56
  function eciKmToSubSatellite(Cesium, positionKm, julianDate) {
20
- const fixed = eciKmToFixedCartesian3(Cesium, positionKm, julianDate);
21
- if (!fixed) return null;
22
- const carto = Cesium.Cartographic.fromCartesian(fixed);
23
- if (!carto || !Number.isFinite(carto.height)) return null;
24
- return {
25
- latitude: Cesium.Math.toDegrees(carto.latitude),
26
- longitude: Cesium.Math.toDegrees(carto.longitude),
27
- altitude: carto.height / 1e3
28
- // m → km
29
- };
57
+ const fixed = eciKmToFixedCartesian3(Cesium, positionKm, julianDate);
58
+ if (!fixed) return null;
59
+ const carto = Cesium.Cartographic.fromCartesian(fixed);
60
+ if (!carto || !Number.isFinite(carto.height)) return null;
61
+ return {
62
+ latitude: Cesium.Math.toDegrees(carto.latitude),
63
+ longitude: Cesium.Math.toDegrees(carto.longitude),
64
+ altitude: carto.height / 1e3
65
+ };
30
66
  }
67
+ /**
68
+ * Circular coverage footprint radius (m) on Earth surface.
69
+ *
70
+ * Spherical geometry:
71
+ * α = arcsin(R·cos(ε) / (R+h)) — nadir angle
72
+ * λ = π/2 − ε − α — Earth central angle
73
+ * radius = R · λ — arc length on surface
74
+ */
31
75
  function autoFootprintRadiusM(altitudeKm, minElevDeg) {
32
- if (altitudeKm <= 0) return 0;
33
- const R = EARTH_RADIUS_KM;
34
- const eps = minElevDeg * Math.PI / 180;
35
- const sinAlpha = R * Math.cos(eps) / (R + altitudeKm);
36
- if (sinAlpha >= 1) return 0;
37
- const alpha = Math.asin(sinAlpha);
38
- const lambda = Math.PI / 2 - eps - alpha;
39
- return R * 1e3 * lambda;
76
+ if (altitudeKm <= 0) return 0;
77
+ const R = EARTH_RADIUS_KM;
78
+ const eps = minElevDeg * Math.PI / 180;
79
+ const sinAlpha = R * Math.cos(eps) / (R + altitudeKm);
80
+ if (sinAlpha >= 1) return 0;
81
+ const alpha = Math.asin(sinAlpha);
82
+ const lambda = Math.PI / 2 - eps - alpha;
83
+ return R * 1e3 * lambda;
40
84
  }
85
+ /** Radius (m) of the footprint circle for a sensor with the given half-angle. */
41
86
  function halfAngleFootprintRadiusM(altitudeKm, halfAngleDeg) {
42
- return altitudeKm * 1e3 * Math.tan(halfAngleDeg * Math.PI / 180);
87
+ return altitudeKm * 1e3 * Math.tan(halfAngleDeg * Math.PI / 180);
43
88
  }
44
89
  function removeFromMap(viewer, id, map) {
45
- if (map.current.has(id)) {
46
- try {
47
- viewer.entities.removeById(id);
48
- } catch (_) {
49
- }
50
- map.current.delete(id);
51
- }
90
+ if (map.current.has(id)) {
91
+ try {
92
+ viewer.entities.removeById(id);
93
+ } catch (_) {}
94
+ map.current.delete(id);
95
+ }
52
96
  }
53
97
  function makePointGraphics(Cesium, color, pixelSize = 8) {
54
- return {
55
- pixelSize,
56
- color,
57
- outlineColor: Cesium.Color.WHITE,
58
- outlineWidth: 1,
59
- scaleByDistance: new Cesium.NearFarScalar(1e6, 1.5, 5e7, 0.5),
60
- // Always render on top so satellites hidden behind Earth are still visible
61
- disableDepthTestDistance: Number.POSITIVE_INFINITY
62
- };
98
+ return {
99
+ pixelSize,
100
+ color,
101
+ outlineColor: Cesium.Color.WHITE,
102
+ outlineWidth: 1,
103
+ scaleByDistance: new Cesium.NearFarScalar(1e6, 1.5, 5e7, .5),
104
+ disableDepthTestDistance: Number.POSITIVE_INFINITY
105
+ };
63
106
  }
64
107
  function makeLabelOpts(Cesium, text, fillColor) {
65
- return {
66
- text,
67
- font: "12px monospace",
68
- fillColor: fillColor ?? Cesium.Color.WHITE,
69
- outlineColor: Cesium.Color.BLACK,
70
- outlineWidth: 2,
71
- style: Cesium.LabelStyle.FILL_AND_OUTLINE,
72
- pixelOffset: new Cesium.Cartesian2(12, 0),
73
- scaleByDistance: new Cesium.NearFarScalar(1e6, 1, 5e7, 0.3),
74
- // Fade out label when camera is very far away
75
- distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 3e7),
76
- disableDepthTestDistance: Number.POSITIVE_INFINITY
77
- };
108
+ return {
109
+ text,
110
+ font: "12px monospace",
111
+ fillColor: fillColor ?? Cesium.Color.WHITE,
112
+ outlineColor: Cesium.Color.BLACK,
113
+ outlineWidth: 2,
114
+ style: Cesium.LabelStyle.FILL_AND_OUTLINE,
115
+ pixelOffset: new Cesium.Cartesian2(12, 0),
116
+ scaleByDistance: new Cesium.NearFarScalar(1e6, 1, 5e7, .3),
117
+ distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 3e7),
118
+ disableDepthTestDistance: Number.POSITIVE_INFINITY
119
+ };
78
120
  }
121
+ /** Add or update a circular ellipse entity on the Earth surface. */
79
122
  function upsertEllipse(viewer, Cesium, id, position, radiusM, color, map) {
80
- const existing = map.current.get(id);
81
- if (existing) {
82
- existing.position = new Cesium.ConstantPositionProperty(position);
83
- existing.ellipse.semiMajorAxis = new Cesium.ConstantProperty(radiusM);
84
- existing.ellipse.semiMinorAxis = new Cesium.ConstantProperty(radiusM);
85
- } else {
86
- const entity = viewer.entities.add({
87
- id,
88
- position,
89
- ellipse: {
90
- semiMajorAxis: radiusM,
91
- semiMinorAxis: radiusM,
92
- material: color.withAlpha(0.08),
93
- outline: true,
94
- outlineColor: color.withAlpha(0.5),
95
- outlineWidth: 1,
96
- height: 0
97
- }
98
- });
99
- map.current.set(id, entity);
100
- }
123
+ const existing = map.current.get(id);
124
+ if (existing) {
125
+ existing.position = new Cesium.ConstantPositionProperty(position);
126
+ existing.ellipse.semiMajorAxis = new Cesium.ConstantProperty(radiusM);
127
+ existing.ellipse.semiMinorAxis = new Cesium.ConstantProperty(radiusM);
128
+ } else {
129
+ const entity = viewer.entities.add({
130
+ id,
131
+ position,
132
+ ellipse: {
133
+ semiMajorAxis: radiusM,
134
+ semiMinorAxis: radiusM,
135
+ material: color.withAlpha(.08),
136
+ outline: true,
137
+ outlineColor: color.withAlpha(.5),
138
+ outlineWidth: 1,
139
+ height: 0
140
+ }
141
+ });
142
+ map.current.set(id, entity);
143
+ }
101
144
  }
145
+ /**
146
+ * Render (or update in-place) the full coverage geometry for one satellite
147
+ * from an explicit `SatelliteCoverage` record supplied by the Zendir SDK.
148
+ */
102
149
  function renderExplicitCoverage(viewer, Cesium, satId, satPos3, cov, julianDate, covMap, coneMap, nadirMap) {
103
- var _a, _b;
104
- const baseColor = cov.color ? Cesium.Color.fromCssColorString(cov.color) : Cesium.Color.CYAN;
105
- const opacity = cov.opacity ?? 0.2;
106
- const resolvedPos = cov.satellitePosition ?? satPos3;
107
- const satCesPos = eciKmToFixedCartesian3(Cesium, resolvedPos, julianDate);
108
- const subSat = eciKmToSubSatellite(Cesium, resolvedPos, julianDate);
109
- const latitude = (subSat == null ? void 0 : subSat.latitude) ?? NaN;
110
- const longitude = (subSat == null ? void 0 : subSat.longitude) ?? NaN;
111
- const altitude = (subSat == null ? void 0 : subSat.altitude) ?? NaN;
112
- const nadirLat = ((_a = cov.nadirPoint) == null ? void 0 : _a.latitude) ?? latitude;
113
- const nadirLon = ((_b = cov.nadirPoint) == null ? void 0 : _b.longitude) ?? longitude;
114
- const covId = `cov-${satId}`;
115
- if (cov.showFootprint !== false && cov.footprintPolygon && cov.footprintPolygon.length >= 3) {
116
- const positions = Cesium.Cartesian3.fromDegreesArray(
117
- cov.footprintPolygon.flatMap((pt) => [pt.longitude, pt.latitude])
118
- );
119
- const existing = covMap.current.get(covId);
120
- if (existing) {
121
- existing.polygon.hierarchy = new Cesium.ConstantProperty(
122
- new Cesium.PolygonHierarchy(positions)
123
- );
124
- } else {
125
- const entity = viewer.entities.add({
126
- id: covId,
127
- polygon: {
128
- hierarchy: new Cesium.PolygonHierarchy(positions),
129
- material: baseColor.withAlpha(opacity),
130
- outline: true,
131
- outlineColor: baseColor.withAlpha(opacity * 3),
132
- height: 0,
133
- clampToGround: true
134
- }
135
- });
136
- covMap.current.set(covId, entity);
137
- }
138
- } else if (cov.showFootprint !== false && cov.halfAngle != null && Number.isFinite(altitude) && altitude > 0) {
139
- const subSatPos = Cesium.Cartesian3.fromDegrees(nadirLon, nadirLat, 0);
140
- const radius = halfAngleFootprintRadiusM(altitude, cov.halfAngle);
141
- upsertEllipse(viewer, Cesium, covId, subSatPos, radius, baseColor, covMap);
142
- } else {
143
- removeFromMap(viewer, covId, covMap);
144
- }
145
- const coneId = `cone-${satId}`;
146
- if (cov.showCone && satCesPos && Number.isFinite(altitude) && altitude > 0) {
147
- const radius = cov.halfAngle != null ? halfAngleFootprintRadiusM(altitude, cov.halfAngle) : autoFootprintRadiusM(altitude, 5);
148
- const coneLength = altitude * 1e3;
149
- const midPos = Cesium.Cartesian3.fromDegrees(nadirLon, nadirLat, coneLength / 2);
150
- const existing = coneMap.current.get(coneId);
151
- if (existing) {
152
- existing.position = new Cesium.ConstantPositionProperty(midPos);
153
- existing.cylinder.length = new Cesium.ConstantProperty(coneLength);
154
- existing.cylinder.bottomRadius = new Cesium.ConstantProperty(radius);
155
- } else {
156
- const entity = viewer.entities.add({
157
- id: coneId,
158
- position: midPos,
159
- cylinder: {
160
- length: coneLength,
161
- topRadius: 0,
162
- bottomRadius: radius,
163
- material: baseColor.withAlpha(0.06),
164
- outline: true,
165
- outlineColor: baseColor.withAlpha(0.25),
166
- numberOfVerticalLines: 12
167
- }
168
- });
169
- coneMap.current.set(coneId, entity);
170
- }
171
- } else {
172
- removeFromMap(viewer, coneId, coneMap);
173
- }
174
- const nadirId = `nadir-${satId}`;
175
- if (cov.showNadirLine && satCesPos) {
176
- const groundPos = Cesium.Cartesian3.fromDegrees(nadirLon, nadirLat, 0);
177
- const existing = nadirMap.current.get(nadirId);
178
- if (existing) {
179
- existing.polyline.positions = new Cesium.ConstantProperty([satCesPos, groundPos]);
180
- } else {
181
- const entity = viewer.entities.add({
182
- id: nadirId,
183
- polyline: {
184
- positions: [satCesPos, groundPos],
185
- width: 1,
186
- material: new Cesium.PolylineDashMaterialProperty({
187
- color: baseColor.withAlpha(0.5),
188
- dashLength: 8
189
- })
190
- }
191
- });
192
- nadirMap.current.set(nadirId, entity);
193
- }
194
- } else {
195
- removeFromMap(viewer, nadirId, nadirMap);
196
- }
150
+ const baseColor = cov.color ? Cesium.Color.fromCssColorString(cov.color) : Cesium.Color.CYAN;
151
+ const opacity = cov.opacity ?? .2;
152
+ const resolvedPos = cov.satellitePosition ?? satPos3;
153
+ const satCesPos = eciKmToFixedCartesian3(Cesium, resolvedPos, julianDate);
154
+ const subSat = eciKmToSubSatellite(Cesium, resolvedPos, julianDate);
155
+ const latitude = subSat?.latitude ?? NaN;
156
+ const longitude = subSat?.longitude ?? NaN;
157
+ const altitude = subSat?.altitude ?? NaN;
158
+ const nadirLat = cov.nadirPoint?.latitude ?? latitude;
159
+ const nadirLon = cov.nadirPoint?.longitude ?? longitude;
160
+ const covId = `cov-${satId}`;
161
+ if (cov.showFootprint !== false && cov.footprintPolygon && cov.footprintPolygon.length >= 3) {
162
+ const positions = Cesium.Cartesian3.fromDegreesArray(cov.footprintPolygon.flatMap((pt) => [pt.longitude, pt.latitude]));
163
+ const existing = covMap.current.get(covId);
164
+ if (existing) existing.polygon.hierarchy = new Cesium.ConstantProperty(new Cesium.PolygonHierarchy(positions));
165
+ else {
166
+ const entity = viewer.entities.add({
167
+ id: covId,
168
+ polygon: {
169
+ hierarchy: new Cesium.PolygonHierarchy(positions),
170
+ material: baseColor.withAlpha(opacity),
171
+ outline: true,
172
+ outlineColor: baseColor.withAlpha(opacity * 3),
173
+ height: 0,
174
+ clampToGround: true
175
+ }
176
+ });
177
+ covMap.current.set(covId, entity);
178
+ }
179
+ } else if (cov.showFootprint !== false && cov.halfAngle != null && Number.isFinite(altitude) && altitude > 0) upsertEllipse(viewer, Cesium, covId, Cesium.Cartesian3.fromDegrees(nadirLon, nadirLat, 0), halfAngleFootprintRadiusM(altitude, cov.halfAngle), baseColor, covMap);
180
+ else removeFromMap(viewer, covId, covMap);
181
+ const coneId = `cone-${satId}`;
182
+ if (cov.showCone && satCesPos && Number.isFinite(altitude) && altitude > 0) {
183
+ const radius = cov.halfAngle != null ? halfAngleFootprintRadiusM(altitude, cov.halfAngle) : autoFootprintRadiusM(altitude, 5);
184
+ const coneLength = altitude * 1e3;
185
+ const midPos = Cesium.Cartesian3.fromDegrees(nadirLon, nadirLat, coneLength / 2);
186
+ const existing = coneMap.current.get(coneId);
187
+ if (existing) {
188
+ existing.position = new Cesium.ConstantPositionProperty(midPos);
189
+ existing.cylinder.length = new Cesium.ConstantProperty(coneLength);
190
+ existing.cylinder.bottomRadius = new Cesium.ConstantProperty(radius);
191
+ } else {
192
+ const entity = viewer.entities.add({
193
+ id: coneId,
194
+ position: midPos,
195
+ cylinder: {
196
+ length: coneLength,
197
+ topRadius: 0,
198
+ bottomRadius: radius,
199
+ material: baseColor.withAlpha(.06),
200
+ outline: true,
201
+ outlineColor: baseColor.withAlpha(.25),
202
+ numberOfVerticalLines: 12
203
+ }
204
+ });
205
+ coneMap.current.set(coneId, entity);
206
+ }
207
+ } else removeFromMap(viewer, coneId, coneMap);
208
+ const nadirId = `nadir-${satId}`;
209
+ if (cov.showNadirLine && satCesPos) {
210
+ const groundPos = Cesium.Cartesian3.fromDegrees(nadirLon, nadirLat, 0);
211
+ const existing = nadirMap.current.get(nadirId);
212
+ if (existing) existing.polyline.positions = new Cesium.ConstantProperty([satCesPos, groundPos]);
213
+ else {
214
+ const entity = viewer.entities.add({
215
+ id: nadirId,
216
+ polyline: {
217
+ positions: [satCesPos, groundPos],
218
+ width: 1,
219
+ material: new Cesium.PolylineDashMaterialProperty({
220
+ color: baseColor.withAlpha(.5),
221
+ dashLength: 8
222
+ })
223
+ }
224
+ });
225
+ nadirMap.current.set(nadirId, entity);
226
+ }
227
+ } else removeFromMap(viewer, nadirId, nadirMap);
197
228
  }
198
- const ZenSpace3DCesium = forwardRef(
199
- function ZenSpace3DCesium2({
200
- satellites = [],
201
- stations = [],
202
- groundStations = [],
203
- customObjects = [],
204
- orbitPaths = [],
205
- satelliteCoverages = [],
206
- view = "earth-orbit",
207
- height = 600,
208
- callbacks,
209
- showTools = false,
210
- layers,
211
- visibility,
212
- referenceTime,
213
- cesium: Cesium
214
- }, ref) {
215
- const containerRef = useRef(null);
216
- const viewerRef = useRef(null);
217
- const callbacksRef = useRef(callbacks);
218
- useEffect(() => {
219
- callbacksRef.current = callbacks;
220
- }, [callbacks]);
221
- const satMapRef = useRef(/* @__PURE__ */ new Map());
222
- const gsMapRef = useRef(/* @__PURE__ */ new Map());
223
- const covMapRef = useRef(/* @__PURE__ */ new Map());
224
- const coneMapRef = useRef(/* @__PURE__ */ new Map());
225
- const nadirMapRef = useRef(/* @__PURE__ */ new Map());
226
- const orbitMapRef = useRef(/* @__PURE__ */ new Map());
227
- const eciPositionsRef = useRef(/* @__PURE__ */ new Map());
228
- const showLabels = (layers == null ? void 0 : layers.labels) === true;
229
- const showCoverage = (layers == null ? void 0 : layers.coverage) === true;
230
- const showOrbits = (layers == null ? void 0 : layers.orbits) !== false;
231
- const showSpacecraft = (visibility == null ? void 0 : visibility.spacecraft) !== false;
232
- const showGroundStations = (visibility == null ? void 0 : visibility.groundStations) !== false;
233
- const showCelestialBodies = (visibility == null ? void 0 : visibility.celestialBodies) !== false;
234
- const focusOn = useCallback(
235
- (objectId, options) => {
236
- const viewer = viewerRef.current;
237
- if (!viewer) return;
238
- const entity = viewer.entities.getById(objectId);
239
- if (entity) {
240
- viewer.zoomTo(entity, { duration: (options == null ? void 0 : options.animate) !== false ? 1.5 : 0 });
241
- }
242
- },
243
- []
244
- );
245
- const setView = useCallback(
246
- (mode) => {
247
- const viewer = viewerRef.current;
248
- if (!viewer) return;
249
- if (mode === "earth-orbit") {
250
- viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees(0, 0, 2e7) });
251
- } else if (mode === "solar-system") {
252
- viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees(0, 0, 5e7) });
253
- }
254
- },
255
- [Cesium]
256
- );
257
- useImperativeHandle(
258
- ref,
259
- () => ({
260
- focusOn,
261
- flyTo: focusOn,
262
- setView,
263
- setTime: () => {
264
- },
265
- setTimeScale: () => {
266
- },
267
- togglePlay: () => {
268
- },
269
- setLayerVisibility: () => {
270
- },
271
- getCameraState: () => ({}),
272
- setCameraState: () => {
273
- },
274
- exportImage: () => "",
275
- exportScene: () => new Blob(),
276
- getVisibleObjects: () => [],
277
- findObjects: () => [],
278
- addObject: () => {
279
- },
280
- removeObject: () => {
281
- },
282
- updateObject: () => {
283
- },
284
- measureDistance: () => 0
285
- }),
286
- [focusOn, setView]
287
- );
288
- useEffect(() => {
289
- if (!containerRef.current || !Cesium) return;
290
- satMapRef.current.clear();
291
- gsMapRef.current.clear();
292
- covMapRef.current.clear();
293
- coneMapRef.current.clear();
294
- nadirMapRef.current.clear();
295
- orbitMapRef.current.clear();
296
- eciPositionsRef.current.clear();
297
- const viewer = new Cesium.Viewer(containerRef.current, {
298
- baseLayerPicker: false,
299
- fullscreenButton: false,
300
- vrButton: false,
301
- geocoder: false,
302
- homeButton: !!showTools,
303
- sceneModePicker: false,
304
- timeline: false,
305
- navigationHelpButton: !!showTools,
306
- animation: false,
307
- scene3DOnly: true,
308
- useDefaultRenderLoop: true,
309
- requestRenderMode: false
310
- });
311
- viewer.scene.globe.enableLighting = true;
312
- viewer.scene.backgroundColor = Cesium.Color.BLACK;
313
- viewer.scene.renderError.addEventListener((scene, err) => {
314
- console.error("[ZenSpace3D] Cesium render error:", err);
315
- });
316
- viewer.clock.currentTime = Cesium.JulianDate.now();
317
- viewer.clock.multiplier = 1;
318
- viewer.clock.shouldAnimate = true;
319
- viewerRef.current = viewer;
320
- const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
321
- handler.setInputAction((movement) => {
322
- var _a;
323
- const picked = viewer.scene.pick(movement.position);
324
- if (Cesium.defined(picked) && picked.id && ((_a = callbacksRef.current) == null ? void 0 : _a.onSelect)) {
325
- callbacksRef.current.onSelect({
326
- id: picked.id.id,
327
- name: picked.id.name,
328
- category: "satellite",
329
- position: { x: 0, y: 0, z: 0 },
330
- visualRadius: 0
331
- });
332
- }
333
- }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
334
- handler.setInputAction((movement) => {
335
- var _a, _b, _c, _d;
336
- const picked = viewer.scene.pick(movement.endPosition);
337
- if (Cesium.defined(picked) && picked.id) {
338
- (_b = (_a = callbacksRef.current) == null ? void 0 : _a.onHover) == null ? void 0 : _b.call(_a, {
339
- id: picked.id.id,
340
- name: picked.id.name,
341
- category: "satellite",
342
- position: { x: 0, y: 0, z: 0 },
343
- visualRadius: 0
344
- });
345
- } else {
346
- (_d = (_c = callbacksRef.current) == null ? void 0 : _c.onHover) == null ? void 0 : _d.call(_c, null);
347
- }
348
- }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
349
- return () => {
350
- handler.destroy();
351
- satMapRef.current.clear();
352
- gsMapRef.current.clear();
353
- covMapRef.current.clear();
354
- coneMapRef.current.clear();
355
- nadirMapRef.current.clear();
356
- orbitMapRef.current.clear();
357
- eciPositionsRef.current.clear();
358
- viewer.destroy();
359
- viewerRef.current = null;
360
- };
361
- }, [Cesium, showTools]);
362
- useEffect(() => {
363
- const viewer = viewerRef.current;
364
- if (!viewer || !Cesium) return;
365
- const jd = referenceTime ? Cesium.JulianDate.fromDate(referenceTime) : Cesium.JulianDate.now();
366
- const seenSats = /* @__PURE__ */ new Set();
367
- const renderedSats = showSpacecraft ? [...satellites, ...stations] : [];
368
- renderedSats.forEach((obj) => {
369
- const id = obj.id;
370
- const pos3 = obj.position;
371
- if (!pos3) return;
372
- if (!Number.isFinite(pos3.x) || !Number.isFinite(pos3.y) || !Number.isFinite(pos3.z)) return;
373
- eciPositionsRef.current.set(id, pos3);
374
- seenSats.add(id);
375
- const name = obj.name ?? id;
376
- const existing = satMapRef.current.get(id);
377
- if (existing) {
378
- if (existing.label) {
379
- existing.label.show = new Cesium.ConstantProperty(showLabels);
380
- } else if (showLabels) {
381
- existing.label = new Cesium.LabelGraphics(makeLabelOpts(Cesium, name));
382
- }
383
- } else {
384
- const capturedId = id;
385
- const posProperty = new Cesium.CallbackPositionProperty(
386
- (time) => {
387
- try {
388
- const eciKm = eciPositionsRef.current.get(capturedId);
389
- if (!eciKm) return void 0;
390
- const fixed = eciKmToFixedCartesian3(Cesium, eciKm, time);
391
- if (!fixed || !Number.isFinite(fixed.x) || !Number.isFinite(fixed.y) || !Number.isFinite(fixed.z)) {
392
- return void 0;
393
- }
394
- return fixed;
395
- } catch {
396
- return void 0;
397
- }
398
- },
399
- false,
400
- // not constant — must be re-evaluated every frame
401
- Cesium.ReferenceFrame.FIXED
402
- );
403
- const entity = viewer.entities.add({
404
- id,
405
- name,
406
- position: posProperty,
407
- point: makePointGraphics(Cesium, Cesium.Color.CYAN),
408
- label: showLabels ? new Cesium.LabelGraphics(makeLabelOpts(Cesium, name)) : void 0
409
- });
410
- satMapRef.current.set(id, entity);
411
- }
412
- const explicitCov = (satelliteCoverages ?? []).find((c) => c.satelliteId === id);
413
- if (explicitCov) {
414
- renderExplicitCoverage(
415
- viewer,
416
- Cesium,
417
- id,
418
- pos3,
419
- explicitCov,
420
- jd,
421
- covMapRef,
422
- coneMapRef,
423
- nadirMapRef
424
- );
425
- } else if (showCoverage) {
426
- const subSat = eciKmToSubSatellite(Cesium, pos3, jd);
427
- if (subSat && subSat.altitude > 0) {
428
- const subSatPos = Cesium.Cartesian3.fromDegrees(subSat.longitude, subSat.latitude, 0);
429
- const radius = autoFootprintRadiusM(subSat.altitude, 5);
430
- upsertEllipse(viewer, Cesium, `cov-${id}`, subSatPos, radius, Cesium.Color.CYAN, covMapRef);
431
- }
432
- } else {
433
- removeFromMap(viewer, `cov-${id}`, covMapRef);
434
- removeFromMap(viewer, `cone-${id}`, coneMapRef);
435
- removeFromMap(viewer, `nadir-${id}`, nadirMapRef);
436
- }
437
- });
438
- satMapRef.current.forEach((_, id) => {
439
- if (!seenSats.has(id)) {
440
- eciPositionsRef.current.delete(id);
441
- removeFromMap(viewer, id, satMapRef);
442
- removeFromMap(viewer, `cov-${id}`, covMapRef);
443
- removeFromMap(viewer, `cone-${id}`, coneMapRef);
444
- removeFromMap(viewer, `nadir-${id}`, nadirMapRef);
445
- }
446
- });
447
- const seenCustom = /* @__PURE__ */ new Set();
448
- const renderedCustom = showCelestialBodies ? customObjects ?? [] : [];
449
- renderedCustom.forEach((obj) => {
450
- if (/^earth$/i.test(obj.name ?? "")) return;
451
- const id = obj.id;
452
- const cesPos = eciKmToFixedCartesian3(Cesium, obj.position, jd);
453
- if (!cesPos) return;
454
- seenCustom.add(id);
455
- const existing = satMapRef.current.get(`custom-${id}`);
456
- if (existing) {
457
- existing.position = new Cesium.ConstantPositionProperty(cesPos);
458
- if (existing.label) {
459
- existing.label.show = new Cesium.ConstantProperty(showLabels);
460
- } else if (showLabels) {
461
- existing.label = new Cesium.LabelGraphics(
462
- makeLabelOpts(Cesium, obj.name ?? id, Cesium.Color.ORANGE)
463
- );
464
- }
465
- } else {
466
- const entity = viewer.entities.add({
467
- id: `custom-${id}`,
468
- name: obj.name,
469
- position: cesPos,
470
- point: makePointGraphics(Cesium, Cesium.Color.ORANGE, 10),
471
- label: showLabels ? new Cesium.LabelGraphics(makeLabelOpts(Cesium, obj.name ?? id, Cesium.Color.ORANGE)) : void 0
472
- });
473
- satMapRef.current.set(`custom-${id}`, entity);
474
- }
475
- });
476
- satMapRef.current.forEach((_, key) => {
477
- if (key.startsWith("custom-") && !seenCustom.has(key.slice(7))) {
478
- removeFromMap(viewer, key, satMapRef);
479
- }
480
- });
481
- const seenGs = /* @__PURE__ */ new Set();
482
- const renderedGs = showGroundStations ? groundStations ?? [] : [];
483
- renderedGs.forEach((gs) => {
484
- if (!Number.isFinite(gs.longitude) || !Number.isFinite(gs.latitude)) return;
485
- seenGs.add(gs.id);
486
- const heightM = Number.isFinite(gs.elevation) ? gs.elevation : 0;
487
- const gsPos = Cesium.Cartesian3.fromDegrees(gs.longitude, gs.latitude, heightM);
488
- const name = gs.name ?? gs.id;
489
- const existing = gsMapRef.current.get(gs.id);
490
- if (existing) {
491
- existing.position = new Cesium.ConstantPositionProperty(gsPos);
492
- if (existing.label) {
493
- existing.label.show = new Cesium.ConstantProperty(showLabels);
494
- } else if (showLabels) {
495
- existing.label = new Cesium.LabelGraphics(
496
- makeLabelOpts(Cesium, name, Cesium.Color.YELLOW)
497
- );
498
- }
499
- } else {
500
- const entity = viewer.entities.add({
501
- id: gs.id,
502
- name,
503
- position: gsPos,
504
- point: makePointGraphics(Cesium, Cesium.Color.YELLOW, 6),
505
- label: showLabels ? new Cesium.LabelGraphics(makeLabelOpts(Cesium, name, Cesium.Color.YELLOW)) : void 0
506
- });
507
- gsMapRef.current.set(gs.id, entity);
508
- }
509
- });
510
- gsMapRef.current.forEach((_, id) => {
511
- if (!seenGs.has(id)) removeFromMap(viewer, id, gsMapRef);
512
- });
513
- if (showOrbits) {
514
- const seenOrbits = /* @__PURE__ */ new Set();
515
- (orbitPaths ?? []).forEach((path) => {
516
- const orbitId = `orbit-${path.objectId}`;
517
- seenOrbits.add(orbitId);
518
- const positions = path.points.map((p) => eciKmToFixedCartesian3(Cesium, p, jd)).filter((p) => p != null);
519
- if (positions.length < 2) return;
520
- const orbitColor = path.color ? Cesium.Color.fromCssColorString(path.color).withAlpha(0.65) : Cesium.Color.YELLOW.withAlpha(0.55);
521
- const existing = orbitMapRef.current.get(orbitId);
522
- if (existing) {
523
- existing.polyline.positions = new Cesium.ConstantProperty(positions);
524
- } else {
525
- const entity = viewer.entities.add({
526
- id: orbitId,
527
- name: path.objectId,
528
- polyline: {
529
- positions,
530
- width: 1.5,
531
- material: new Cesium.PolylineDashMaterialProperty({
532
- color: orbitColor,
533
- dashLength: 16
534
- })
535
- }
536
- });
537
- orbitMapRef.current.set(orbitId, entity);
538
- }
539
- });
540
- orbitMapRef.current.forEach((_, id) => {
541
- if (!seenOrbits.has(id)) removeFromMap(viewer, id, orbitMapRef);
542
- });
543
- } else {
544
- orbitMapRef.current.forEach((_, id) => removeFromMap(viewer, id, orbitMapRef));
545
- }
546
- }, [
547
- Cesium,
548
- satellites,
549
- stations,
550
- customObjects,
551
- groundStations,
552
- orbitPaths,
553
- satelliteCoverages,
554
- showLabels,
555
- showCoverage,
556
- showOrbits,
557
- showSpacecraft,
558
- showGroundStations,
559
- showCelestialBodies,
560
- referenceTime
561
- ]);
562
- useEffect(() => {
563
- setView(view);
564
- }, [view]);
565
- const h = typeof height === "number" ? `${height}px` : height;
566
- return /* @__PURE__ */ jsx(
567
- "div",
568
- {
569
- ref: containerRef,
570
- className: "zendir-zenspace3d-cesium",
571
- style: { width: "100%", height: h, minHeight: 200 }
572
- }
573
- );
574
- }
575
- );
576
- export {
577
- ZenSpace3DCesium
578
- };
579
- //# sourceMappingURL=ZenSpace3DCesium.js.map
229
+ var ZenSpace3DCesium = forwardRef(function ZenSpace3DCesium({ satellites = [], stations = [], groundStations = [], customObjects = [], orbitPaths = [], satelliteCoverages = [], view = "earth-orbit", height = 600, callbacks, showTools = false, layers, visibility, referenceTime, cesium: Cesium }, ref) {
230
+ const containerRef = useRef(null);
231
+ const viewerRef = useRef(null);
232
+ const callbacksRef = useRef(callbacks);
233
+ useEffect(() => {
234
+ callbacksRef.current = callbacks;
235
+ }, [callbacks]);
236
+ const satMapRef = useRef(/* @__PURE__ */ new Map());
237
+ const gsMapRef = useRef(/* @__PURE__ */ new Map());
238
+ const covMapRef = useRef(/* @__PURE__ */ new Map());
239
+ const coneMapRef = useRef(/* @__PURE__ */ new Map());
240
+ const nadirMapRef = useRef(/* @__PURE__ */ new Map());
241
+ const orbitMapRef = useRef(/* @__PURE__ */ new Map());
242
+ const eciPositionsRef = useRef(/* @__PURE__ */ new Map());
243
+ const showLabels = layers?.labels === true;
244
+ const showCoverage = layers?.coverage === true;
245
+ const showOrbits = layers?.orbits !== false;
246
+ const showSpacecraft = visibility?.spacecraft !== false;
247
+ const showGroundStations = visibility?.groundStations !== false;
248
+ const showCelestialBodies = visibility?.celestialBodies !== false;
249
+ const focusOn = useCallback((objectId, options) => {
250
+ const viewer = viewerRef.current;
251
+ if (!viewer) return;
252
+ const entity = viewer.entities.getById(objectId);
253
+ if (entity) viewer.zoomTo(entity, { duration: options?.animate !== false ? 1.5 : 0 });
254
+ }, []);
255
+ const setView = useCallback((mode) => {
256
+ const viewer = viewerRef.current;
257
+ if (!viewer) return;
258
+ if (mode === "earth-orbit") viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees(0, 0, 2e7) });
259
+ else if (mode === "solar-system") viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees(0, 0, 5e7) });
260
+ }, [Cesium]);
261
+ useImperativeHandle(ref, () => ({
262
+ focusOn,
263
+ flyTo: focusOn,
264
+ setView,
265
+ setTime: () => {},
266
+ setTimeScale: () => {},
267
+ togglePlay: () => {},
268
+ setLayerVisibility: () => {},
269
+ getCameraState: () => ({}),
270
+ setCameraState: () => {},
271
+ exportImage: () => "",
272
+ exportScene: () => new Blob(),
273
+ getVisibleObjects: () => [],
274
+ findObjects: () => [],
275
+ addObject: () => {},
276
+ removeObject: () => {},
277
+ updateObject: () => {},
278
+ measureDistance: () => 0
279
+ }), [focusOn, setView]);
280
+ useEffect(() => {
281
+ if (!containerRef.current || !Cesium) return;
282
+ satMapRef.current.clear();
283
+ gsMapRef.current.clear();
284
+ covMapRef.current.clear();
285
+ coneMapRef.current.clear();
286
+ nadirMapRef.current.clear();
287
+ orbitMapRef.current.clear();
288
+ eciPositionsRef.current.clear();
289
+ const viewer = new Cesium.Viewer(containerRef.current, {
290
+ baseLayerPicker: false,
291
+ fullscreenButton: false,
292
+ vrButton: false,
293
+ geocoder: false,
294
+ homeButton: !!showTools,
295
+ sceneModePicker: false,
296
+ timeline: false,
297
+ navigationHelpButton: !!showTools,
298
+ animation: false,
299
+ scene3DOnly: true,
300
+ useDefaultRenderLoop: true,
301
+ requestRenderMode: false
302
+ });
303
+ viewer.scene.globe.enableLighting = true;
304
+ viewer.scene.backgroundColor = Cesium.Color.BLACK;
305
+ viewer.scene.renderError.addEventListener((scene, err) => {
306
+ console.error("[ZenSpace3D] Cesium render error:", err);
307
+ });
308
+ viewer.clock.currentTime = Cesium.JulianDate.now();
309
+ viewer.clock.multiplier = 1;
310
+ viewer.clock.shouldAnimate = true;
311
+ viewerRef.current = viewer;
312
+ const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
313
+ handler.setInputAction((movement) => {
314
+ const picked = viewer.scene.pick(movement.position);
315
+ if (Cesium.defined(picked) && picked.id && callbacksRef.current?.onSelect) callbacksRef.current.onSelect({
316
+ id: picked.id.id,
317
+ name: picked.id.name,
318
+ category: "satellite",
319
+ position: {
320
+ x: 0,
321
+ y: 0,
322
+ z: 0
323
+ },
324
+ visualRadius: 0
325
+ });
326
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
327
+ handler.setInputAction((movement) => {
328
+ const picked = viewer.scene.pick(movement.endPosition);
329
+ if (Cesium.defined(picked) && picked.id) callbacksRef.current?.onHover?.({
330
+ id: picked.id.id,
331
+ name: picked.id.name,
332
+ category: "satellite",
333
+ position: {
334
+ x: 0,
335
+ y: 0,
336
+ z: 0
337
+ },
338
+ visualRadius: 0
339
+ });
340
+ else callbacksRef.current?.onHover?.(null);
341
+ }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
342
+ return () => {
343
+ handler.destroy();
344
+ satMapRef.current.clear();
345
+ gsMapRef.current.clear();
346
+ covMapRef.current.clear();
347
+ coneMapRef.current.clear();
348
+ nadirMapRef.current.clear();
349
+ orbitMapRef.current.clear();
350
+ eciPositionsRef.current.clear();
351
+ viewer.destroy();
352
+ viewerRef.current = null;
353
+ };
354
+ }, [Cesium, showTools]);
355
+ useEffect(() => {
356
+ const viewer = viewerRef.current;
357
+ if (!viewer || !Cesium) return;
358
+ const jd = referenceTime ? Cesium.JulianDate.fromDate(referenceTime) : Cesium.JulianDate.now();
359
+ const seenSats = /* @__PURE__ */ new Set();
360
+ (showSpacecraft ? [...satellites, ...stations] : []).forEach((obj) => {
361
+ const id = obj.id;
362
+ const pos3 = obj.position;
363
+ if (!pos3) return;
364
+ if (!Number.isFinite(pos3.x) || !Number.isFinite(pos3.y) || !Number.isFinite(pos3.z)) return;
365
+ eciPositionsRef.current.set(id, pos3);
366
+ seenSats.add(id);
367
+ const name = obj.name ?? id;
368
+ const existing = satMapRef.current.get(id);
369
+ if (existing) {
370
+ if (existing.label) existing.label.show = new Cesium.ConstantProperty(showLabels);
371
+ else if (showLabels) existing.label = new Cesium.LabelGraphics(makeLabelOpts(Cesium, name));
372
+ } else {
373
+ const capturedId = id;
374
+ const posProperty = new Cesium.CallbackPositionProperty((time) => {
375
+ try {
376
+ const eciKm = eciPositionsRef.current.get(capturedId);
377
+ if (!eciKm) return void 0;
378
+ const fixed = eciKmToFixedCartesian3(Cesium, eciKm, time);
379
+ if (!fixed || !Number.isFinite(fixed.x) || !Number.isFinite(fixed.y) || !Number.isFinite(fixed.z)) return;
380
+ return fixed;
381
+ } catch {
382
+ return;
383
+ }
384
+ }, false, Cesium.ReferenceFrame.FIXED);
385
+ const entity = viewer.entities.add({
386
+ id,
387
+ name,
388
+ position: posProperty,
389
+ point: makePointGraphics(Cesium, Cesium.Color.CYAN),
390
+ label: showLabels ? new Cesium.LabelGraphics(makeLabelOpts(Cesium, name)) : void 0
391
+ });
392
+ satMapRef.current.set(id, entity);
393
+ }
394
+ const explicitCov = (satelliteCoverages ?? []).find((c) => c.satelliteId === id);
395
+ if (explicitCov) renderExplicitCoverage(viewer, Cesium, id, pos3, explicitCov, jd, covMapRef, coneMapRef, nadirMapRef);
396
+ else if (showCoverage) {
397
+ const subSat = eciKmToSubSatellite(Cesium, pos3, jd);
398
+ if (subSat && subSat.altitude > 0) {
399
+ const subSatPos = Cesium.Cartesian3.fromDegrees(subSat.longitude, subSat.latitude, 0);
400
+ const radius = autoFootprintRadiusM(subSat.altitude, 5);
401
+ upsertEllipse(viewer, Cesium, `cov-${id}`, subSatPos, radius, Cesium.Color.CYAN, covMapRef);
402
+ }
403
+ } else {
404
+ removeFromMap(viewer, `cov-${id}`, covMapRef);
405
+ removeFromMap(viewer, `cone-${id}`, coneMapRef);
406
+ removeFromMap(viewer, `nadir-${id}`, nadirMapRef);
407
+ }
408
+ });
409
+ satMapRef.current.forEach((_, id) => {
410
+ if (!seenSats.has(id)) {
411
+ eciPositionsRef.current.delete(id);
412
+ removeFromMap(viewer, id, satMapRef);
413
+ removeFromMap(viewer, `cov-${id}`, covMapRef);
414
+ removeFromMap(viewer, `cone-${id}`, coneMapRef);
415
+ removeFromMap(viewer, `nadir-${id}`, nadirMapRef);
416
+ }
417
+ });
418
+ const seenCustom = /* @__PURE__ */ new Set();
419
+ (showCelestialBodies ? customObjects ?? [] : []).forEach((obj) => {
420
+ if (/^earth$/i.test(obj.name ?? "")) return;
421
+ const id = obj.id;
422
+ const cesPos = eciKmToFixedCartesian3(Cesium, obj.position, jd);
423
+ if (!cesPos) return;
424
+ seenCustom.add(id);
425
+ const existing = satMapRef.current.get(`custom-${id}`);
426
+ if (existing) {
427
+ existing.position = new Cesium.ConstantPositionProperty(cesPos);
428
+ if (existing.label) existing.label.show = new Cesium.ConstantProperty(showLabels);
429
+ else if (showLabels) existing.label = new Cesium.LabelGraphics(makeLabelOpts(Cesium, obj.name ?? id, Cesium.Color.ORANGE));
430
+ } else {
431
+ const entity = viewer.entities.add({
432
+ id: `custom-${id}`,
433
+ name: obj.name,
434
+ position: cesPos,
435
+ point: makePointGraphics(Cesium, Cesium.Color.ORANGE, 10),
436
+ label: showLabels ? new Cesium.LabelGraphics(makeLabelOpts(Cesium, obj.name ?? id, Cesium.Color.ORANGE)) : void 0
437
+ });
438
+ satMapRef.current.set(`custom-${id}`, entity);
439
+ }
440
+ });
441
+ satMapRef.current.forEach((_, key) => {
442
+ if (key.startsWith("custom-") && !seenCustom.has(key.slice(7))) removeFromMap(viewer, key, satMapRef);
443
+ });
444
+ const seenGs = /* @__PURE__ */ new Set();
445
+ (showGroundStations ? groundStations ?? [] : []).forEach((gs) => {
446
+ if (!Number.isFinite(gs.longitude) || !Number.isFinite(gs.latitude)) return;
447
+ seenGs.add(gs.id);
448
+ const heightM = Number.isFinite(gs.elevation) ? gs.elevation : 0;
449
+ const gsPos = Cesium.Cartesian3.fromDegrees(gs.longitude, gs.latitude, heightM);
450
+ const name = gs.name ?? gs.id;
451
+ const existing = gsMapRef.current.get(gs.id);
452
+ if (existing) {
453
+ existing.position = new Cesium.ConstantPositionProperty(gsPos);
454
+ if (existing.label) existing.label.show = new Cesium.ConstantProperty(showLabels);
455
+ else if (showLabels) existing.label = new Cesium.LabelGraphics(makeLabelOpts(Cesium, name, Cesium.Color.YELLOW));
456
+ } else {
457
+ const entity = viewer.entities.add({
458
+ id: gs.id,
459
+ name,
460
+ position: gsPos,
461
+ point: makePointGraphics(Cesium, Cesium.Color.YELLOW, 6),
462
+ label: showLabels ? new Cesium.LabelGraphics(makeLabelOpts(Cesium, name, Cesium.Color.YELLOW)) : void 0
463
+ });
464
+ gsMapRef.current.set(gs.id, entity);
465
+ }
466
+ });
467
+ gsMapRef.current.forEach((_, id) => {
468
+ if (!seenGs.has(id)) removeFromMap(viewer, id, gsMapRef);
469
+ });
470
+ if (showOrbits) {
471
+ const seenOrbits = /* @__PURE__ */ new Set();
472
+ (orbitPaths ?? []).forEach((path) => {
473
+ const orbitId = `orbit-${path.objectId}`;
474
+ seenOrbits.add(orbitId);
475
+ const positions = path.points.map((p) => eciKmToFixedCartesian3(Cesium, p, jd)).filter((p) => p != null);
476
+ if (positions.length < 2) return;
477
+ const orbitColor = path.color ? Cesium.Color.fromCssColorString(path.color).withAlpha(.65) : Cesium.Color.YELLOW.withAlpha(.55);
478
+ const existing = orbitMapRef.current.get(orbitId);
479
+ if (existing) existing.polyline.positions = new Cesium.ConstantProperty(positions);
480
+ else {
481
+ const entity = viewer.entities.add({
482
+ id: orbitId,
483
+ name: path.objectId,
484
+ polyline: {
485
+ positions,
486
+ width: 1.5,
487
+ material: new Cesium.PolylineDashMaterialProperty({
488
+ color: orbitColor,
489
+ dashLength: 16
490
+ })
491
+ }
492
+ });
493
+ orbitMapRef.current.set(orbitId, entity);
494
+ }
495
+ });
496
+ orbitMapRef.current.forEach((_, id) => {
497
+ if (!seenOrbits.has(id)) removeFromMap(viewer, id, orbitMapRef);
498
+ });
499
+ } else orbitMapRef.current.forEach((_, id) => removeFromMap(viewer, id, orbitMapRef));
500
+ }, [
501
+ Cesium,
502
+ satellites,
503
+ stations,
504
+ customObjects,
505
+ groundStations,
506
+ orbitPaths,
507
+ satelliteCoverages,
508
+ showLabels,
509
+ showCoverage,
510
+ showOrbits,
511
+ showSpacecraft,
512
+ showGroundStations,
513
+ showCelestialBodies,
514
+ referenceTime
515
+ ]);
516
+ useEffect(() => {
517
+ setView(view);
518
+ }, [view]);
519
+ return /* @__PURE__ */ jsx("div", {
520
+ ref: containerRef,
521
+ className: "zendir-zenspace3d-cesium",
522
+ style: {
523
+ width: "100%",
524
+ height: typeof height === "number" ? `${height}px` : height,
525
+ minHeight: 200
526
+ }
527
+ });
528
+ });
529
+ //#endregion
530
+ export { ZenSpace3DCesium, ZenSpace3DCesium as default };
531
+
532
+ //# sourceMappingURL=ZenSpace3DCesium.js.map