@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.
Files changed (391) hide show
  1. package/CHANGELOG.md +20 -0
  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 +312 -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 +217 -194
  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 +419 -41
  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,307 +1,388 @@
1
- import { DEG_TO_RAD, RAD_TO_DEG, EARTH_RADIUS_KM } from "./ZenSpace3DUtils.js";
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
- const { loadCapturePlaceholderImage } = await import("../core/widgets/Capture.js");
4
- return loadCapturePlaceholderImage();
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
- const [ex, ey, ez] = ecef;
8
- return [ex / 1e3, ez / 1e3, ey / 1e3];
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
- const [px, py, pz] = ecefPos;
12
- const rHoriz = Math.sqrt(px * px + py * py);
13
- const lat = Math.atan2(pz, rHoriz);
14
- const lon = Math.atan2(py, px);
15
- const slat = Math.sin(lat), clat = Math.cos(lat);
16
- const slon = Math.sin(lon), clon = Math.cos(lon);
17
- const rx = eulerDeg[0] * DEG_TO_RAD;
18
- const ry = eulerDeg[1] * DEG_TO_RAD;
19
- const rz = eulerDeg[2] * DEG_TO_RAD;
20
- const cx = Math.cos(rx), sx = Math.sin(rx);
21
- const cy = Math.cos(ry), sy = Math.sin(ry);
22
- const cz = Math.cos(rz), sz = Math.sin(rz);
23
- const fX = sx * sy * cz - cx * sz;
24
- const fY = sx * sy * sz + cx * cz;
25
- const fZ = sx * cy;
26
- const uX = cx * sy * cz + sx * sz;
27
- const uY = cx * sy * sz - sx * cz;
28
- const uZ = cx * cy;
29
- const fE = -slon * fX + clon * fY;
30
- const fN = -slat * clon * fX - slat * slon * fY + clat * fZ;
31
- const fU = clat * clon * fX + clat * slon * fY + slat * fZ;
32
- const uE = -slon * uX + clon * uY;
33
- const uN = -slat * clon * uX - slat * slon * uY + clat * uZ;
34
- const uU = clat * clon * uX + clat * slon * uY + slat * uZ;
35
- const horizLen = Math.sqrt(fE * fE + fN * fN);
36
- const heading = Math.atan2(fE, fN) * RAD_TO_DEG;
37
- const pitch = Math.atan2(fU, horizLen) * RAD_TO_DEG;
38
- if (horizLen < 1e-9) {
39
- const roll2 = Math.atan2(uE, uN) * RAD_TO_DEG;
40
- return [heading, pitch, roll2];
41
- }
42
- const drLen = Math.sqrt(fN * fN + fE * fE);
43
- const drE = fN / drLen;
44
- const drN = -fE / drLen;
45
- const fLen = Math.sqrt(fE * fE + fN * fN + fU * fU);
46
- const fnE = fE / fLen, fnN = fN / fLen, fnU = fU / fLen;
47
- const duE = drN * fnU;
48
- const duN = -drE * fnU;
49
- const duU = drE * fnN - drN * fnE;
50
- const roll = Math.atan2(
51
- uE * drE + uN * drN,
52
- // up · default_right (drU=0)
53
- uE * duE + uN * duN + uU * duU
54
- // up · default_up
55
- ) * RAD_TO_DEG;
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
- const rx = eulerDeg[0] * DEG_TO_RAD;
60
- const ry = eulerDeg[1] * DEG_TO_RAD;
61
- const rz = eulerDeg[2] * DEG_TO_RAD;
62
- const cx = Math.cos(rx), sx = Math.sin(rx);
63
- const cy = Math.cos(ry), sy = Math.sin(ry);
64
- const cz = Math.cos(rz), sz = Math.sin(rz);
65
- const R02 = cx * sy * cz + sx * sz;
66
- const R00 = cy * cz;
67
- const R01 = sx * sy * cz - cx * sz;
68
- const R12 = cx * sy * sz - sx * cz;
69
- const R22 = cx * cy;
70
- const heading = Math.atan2(R01, R00) * RAD_TO_DEG;
71
- const pitch = Math.asin(Math.max(-1, Math.min(1, -R02))) * RAD_TO_DEG;
72
- const roll = Math.atan2(-R12, R22) * RAD_TO_DEG;
73
- return [heading, pitch, roll];
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
- const [x, y, z] = position;
77
- const r = Math.sqrt(x * x + y * y + z * z);
78
- if (r < 1) {
79
- return Cesium.Cartesian3.fromDegrees(0, 0, 4e5);
80
- }
81
- const lat = 90 - Math.acos(Math.min(1, Math.max(-1, y / r))) * RAD_TO_DEG;
82
- const lon = Math.atan2(z, -x) * RAD_TO_DEG - 180;
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
- if (focalLengthMm <= 0 || pixelPitchMm <= 0 || resolutionPx <= 0) return null;
88
- const sensorSizeMm = resolutionPx * pixelPitchMm;
89
- return 2 * Math.atan(sensorSizeMm / (2 * focalLengthMm)) * RAD_TO_DEG;
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
- const imageData = ctx.getImageData(0, 0, width, height);
93
- const data = imageData.data;
94
- for (let i = 0; i < data.length; i += 4) {
95
- const lum = 0.2126 * data[i] + 0.7152 * data[i + 1] + 0.0722 * data[i + 2];
96
- data[i] = data[i + 1] = data[i + 2] = lum;
97
- }
98
- ctx.putImageData(imageData, 0, 0);
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
- const [x, y, z] = position;
102
- const rKm = Math.sqrt(x * x + y * y + z * z);
103
- const altKm = Math.max(0, rKm - EARTH_RADIUS_KM);
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
- const fMm = args.focal_length;
108
- const N = args.aperture;
109
- const sMm = args.focusing_distance * 1e3;
110
- const dMm = subjectDistanceM * 1e3;
111
- const ppMm = args.pixel_pitch;
112
- if (N <= 0 || fMm <= 0 || dMm <= 0 || ppMm <= 0 || sMm <= fMm) return 0;
113
- if (Math.abs(sMm - dMm) < 1) return 0;
114
- const cocDiameterMm = Math.abs(
115
- fMm * fMm / N * (sMm - dMm) / (dMm * (sMm - fMm))
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
- const tmp = document.createElement("canvas");
123
- tmp.width = width;
124
- tmp.height = height;
125
- const tmpCtx = tmp.getContext("2d");
126
- tmpCtx.filter = `blur(${radiusPx}px)`;
127
- tmpCtx.drawImage(ctx.canvas, 0, 0);
128
- ctx.clearRect(0, 0, width, height);
129
- ctx.drawImage(tmp, 0, 0);
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
- const base64 = dataUrl.split(",")[1];
133
- const binaryStr = atob(base64);
134
- const bytes = new Uint8Array(binaryStr.length);
135
- for (let i = 0; i < binaryStr.length; i++) {
136
- bytes[i] = binaryStr.charCodeAt(i);
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
- const Cesium = await import("cesium");
142
- if (options.accessToken) {
143
- Cesium.Ion.defaultAccessToken = options.accessToken;
144
- }
145
- let container = options.container ?? null;
146
- let ownsContainer = false;
147
- if (!container) {
148
- container = document.createElement("div");
149
- 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;";
150
- document.body.appendChild(container);
151
- ownsContainer = true;
152
- }
153
- const viewer = new Cesium.Viewer(container, {
154
- baseLayerPicker: false,
155
- fullscreenButton: false,
156
- vrButton: false,
157
- geocoder: false,
158
- homeButton: false,
159
- sceneModePicker: false,
160
- timeline: false,
161
- navigationHelpButton: false,
162
- animation: false,
163
- scene3DOnly: true,
164
- // Only render when we explicitly call scene.render()
165
- useDefaultRenderLoop: false,
166
- requestRenderMode: true,
167
- contextOptions: {
168
- webgl: { preserveDrawingBuffer: true }
169
- }
170
- });
171
- viewer.scene.globe.enableLighting = false;
172
- viewer.scene.backgroundColor = Cesium.Color.BLACK;
173
- viewer.scene.skyBox = void 0;
174
- viewer.scene.moon = void 0;
175
- const useOsm = options.useOpenStreetMapImagery !== false;
176
- if (useOsm) {
177
- viewer.imageryLayers.removeAll();
178
- const tileUrl = options.imageryUrl || "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}";
179
- viewer.imageryLayers.addImageryProvider(
180
- new Cesium.UrlTemplateImageryProvider({
181
- url: tileUrl,
182
- credit: Esri, Maxar, Earthstar Geographics",
183
- maximumLevel: 19
184
- })
185
- );
186
- }
187
- if (options.terrain && options.accessToken) {
188
- try {
189
- viewer.scene.terrainProvider = await Cesium.CesiumTerrainProvider.fromIonAssetId(1);
190
- } catch {
191
- }
192
- }
193
- let destroyed = false;
194
- const capture = async (args) => {
195
- var _a;
196
- if (destroyed) return new Uint8Array(0);
197
- try {
198
- const res = args.sample ? Math.max(64, Math.round(args.resolution / 2)) : args.resolution;
199
- container.style.width = `${res}px`;
200
- container.style.height = `${res}px`;
201
- void container.clientWidth;
202
- viewer.resize();
203
- await new Promise((r) => requestAnimationFrame(() => r()));
204
- await new Promise((r) => requestAnimationFrame(() => r()));
205
- viewer.resize();
206
- const cameraPosition = positionToCartesian3(Cesium, args.position);
207
- const [heading, pitch, roll] = args.rotation;
208
- viewer.camera.setView({
209
- destination: cameraPosition,
210
- orientation: {
211
- heading: Cesium.Math.toRadians(heading),
212
- pitch: Cesium.Math.toRadians(pitch),
213
- roll: Cesium.Math.toRadians(roll)
214
- }
215
- });
216
- const opticalFov = computeOpticalFov(args.focal_length, args.pixel_pitch, args.resolution);
217
- let effectiveFov = args.fov;
218
- if (effectiveFov <= 0 || effectiveFov >= 180) {
219
- if (opticalFov !== null && opticalFov > 0 && opticalFov < 180) {
220
- effectiveFov = opticalFov;
221
- if (false) ;
222
- }
223
- } else if (false) ;
224
- if (effectiveFov > 0 && effectiveFov < 180) {
225
- viewer.camera.frustum.fov = effectiveFov * DEG_TO_RAD;
226
- }
227
- const maxWaitMs = options.tileLoadTimeoutMs ?? 1e4;
228
- const pollIntervalMs = 200;
229
- const startMs = performance.now();
230
- const deadline = startMs + maxWaitMs;
231
- viewer.scene.requestRender();
232
- viewer.scene.forceRender();
233
- let tileWaitLoops = 0;
234
- while (!viewer.scene.globe.tilesLoaded && performance.now() < deadline) {
235
- tileWaitLoops++;
236
- (_a = options.onTileLoadProgress) == null ? void 0 : _a.call(options, performance.now() - startMs);
237
- await new Promise((r) => setTimeout(r, pollIntervalMs));
238
- viewer.scene.requestRender();
239
- viewer.scene.forceRender();
240
- }
241
- viewer.scene.requestRender();
242
- viewer.scene.forceRender();
243
- await new Promise((r) => requestAnimationFrame(() => r()));
244
- viewer.scene.requestRender();
245
- viewer.scene.forceRender();
246
- await new Promise((r) => requestAnimationFrame(() => r()));
247
- viewer.scene.forceRender();
248
- const canvas = viewer.scene.canvas;
249
- if (false) ;
250
- if (false) ;
251
- const fmt = args.format === "jpeg" ? "image/jpeg" : "image/png";
252
- const jpegQuality = args.format === "jpeg" ? args.jpeg_quality ?? 0.92 : void 0;
253
- let dofBlurRadius = 0;
254
- if (args.focusing_distance > 0 && args.aperture > 0) {
255
- const subjectDist = estimateSubjectDistanceM(args.position);
256
- dofBlurRadius = computeDofBlurPx(args, subjectDist);
257
- }
258
- const needsOffscreen = dofBlurRadius > 0 || args.monochromatic;
259
- if (needsOffscreen) {
260
- const offscreen = document.createElement("canvas");
261
- offscreen.width = canvas.width;
262
- offscreen.height = canvas.height;
263
- const ctx = offscreen.getContext("2d");
264
- ctx.drawImage(canvas, 0, 0);
265
- if (dofBlurRadius > 0) {
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
- export {
301
- computeDofBlurPx,
302
- createCesiumCaptureSource,
303
- ecefEulerXyzToHpr,
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