visualizer-components 0.1.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 (259) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -0
  3. package/dist/assets/RudderIcon.d.ts +23 -0
  4. package/dist/assets/RudderIcon.d.ts.map +1 -0
  5. package/dist/assets/RudderIcon.js +23 -0
  6. package/dist/assets/RudderIcon.js.map +1 -0
  7. package/dist/assets/svgSources.d.ts +18 -0
  8. package/dist/assets/svgSources.d.ts.map +1 -0
  9. package/dist/assets/svgSources.js +18 -0
  10. package/dist/assets/svgSources.js.map +1 -0
  11. package/dist/components/Joystick.d.ts +23 -0
  12. package/dist/components/Joystick.d.ts.map +1 -0
  13. package/dist/components/Joystick.js +114 -0
  14. package/dist/components/Joystick.js.map +1 -0
  15. package/dist/components/TelemetryDashboard.d.ts +31 -0
  16. package/dist/components/TelemetryDashboard.d.ts.map +1 -0
  17. package/dist/components/TelemetryDashboard.js +127 -0
  18. package/dist/components/TelemetryDashboard.js.map +1 -0
  19. package/dist/components/controls/ControlOverlay.d.ts +64 -0
  20. package/dist/components/controls/ControlOverlay.d.ts.map +1 -0
  21. package/dist/components/controls/ControlOverlay.js +88 -0
  22. package/dist/components/controls/ControlOverlay.js.map +1 -0
  23. package/dist/components/controls/ControlsDrawer.d.ts +37 -0
  24. package/dist/components/controls/ControlsDrawer.d.ts.map +1 -0
  25. package/dist/components/controls/ControlsDrawer.js +93 -0
  26. package/dist/components/controls/ControlsDrawer.js.map +1 -0
  27. package/dist/components/controls/ForceVectorsPanel.d.ts +37 -0
  28. package/dist/components/controls/ForceVectorsPanel.d.ts.map +1 -0
  29. package/dist/components/controls/ForceVectorsPanel.js +76 -0
  30. package/dist/components/controls/ForceVectorsPanel.js.map +1 -0
  31. package/dist/components/controls/InfoPopover.d.ts +34 -0
  32. package/dist/components/controls/InfoPopover.d.ts.map +1 -0
  33. package/dist/components/controls/InfoPopover.js +41 -0
  34. package/dist/components/controls/InfoPopover.js.map +1 -0
  35. package/dist/components/controls/Legend.d.ts +29 -0
  36. package/dist/components/controls/Legend.d.ts.map +1 -0
  37. package/dist/components/controls/Legend.js +74 -0
  38. package/dist/components/controls/Legend.js.map +1 -0
  39. package/dist/components/controls/MobileBottomNav.d.ts +17 -0
  40. package/dist/components/controls/MobileBottomNav.d.ts.map +1 -0
  41. package/dist/components/controls/MobileBottomNav.js +46 -0
  42. package/dist/components/controls/MobileBottomNav.js.map +1 -0
  43. package/dist/components/hud/SceneHUD.d.ts +100 -0
  44. package/dist/components/hud/SceneHUD.d.ts.map +1 -0
  45. package/dist/components/hud/SceneHUD.js +216 -0
  46. package/dist/components/hud/SceneHUD.js.map +1 -0
  47. package/dist/components/hud/telemetry/Batteries.d.ts +40 -0
  48. package/dist/components/hud/telemetry/Batteries.d.ts.map +1 -0
  49. package/dist/components/hud/telemetry/Batteries.js +137 -0
  50. package/dist/components/hud/telemetry/Batteries.js.map +1 -0
  51. package/dist/components/hud/telemetry/Compass.d.ts +2 -0
  52. package/dist/components/hud/telemetry/Compass.d.ts.map +1 -0
  53. package/dist/components/hud/telemetry/Compass.js +147 -0
  54. package/dist/components/hud/telemetry/Compass.js.map +1 -0
  55. package/dist/components/hud/telemetry/Log.d.ts +2 -0
  56. package/dist/components/hud/telemetry/Log.d.ts.map +1 -0
  57. package/dist/components/hud/telemetry/Log.js +65 -0
  58. package/dist/components/hud/telemetry/Log.js.map +1 -0
  59. package/dist/components/hud/telemetry/Map.d.ts +4 -0
  60. package/dist/components/hud/telemetry/Map.d.ts.map +1 -0
  61. package/dist/components/hud/telemetry/Map.js +293 -0
  62. package/dist/components/hud/telemetry/Map.js.map +1 -0
  63. package/dist/components/hud/telemetry/PowerRudderPanel.d.ts +2 -0
  64. package/dist/components/hud/telemetry/PowerRudderPanel.d.ts.map +1 -0
  65. package/dist/components/hud/telemetry/PowerRudderPanel.js +115 -0
  66. package/dist/components/hud/telemetry/PowerRudderPanel.js.map +1 -0
  67. package/dist/components/hud/telemetry/RadiusVisualizer.d.ts +63 -0
  68. package/dist/components/hud/telemetry/RadiusVisualizer.d.ts.map +1 -0
  69. package/dist/components/hud/telemetry/RadiusVisualizer.js +139 -0
  70. package/dist/components/hud/telemetry/RadiusVisualizer.js.map +1 -0
  71. package/dist/components/hud/telemetry/RadiusVisualizerPanel.d.ts +31 -0
  72. package/dist/components/hud/telemetry/RadiusVisualizerPanel.d.ts.map +1 -0
  73. package/dist/components/hud/telemetry/RadiusVisualizerPanel.js +37 -0
  74. package/dist/components/hud/telemetry/RadiusVisualizerPanel.js.map +1 -0
  75. package/dist/components/hud/telemetry/ShipRudderVisualizer.d.ts +43 -0
  76. package/dist/components/hud/telemetry/ShipRudderVisualizer.d.ts.map +1 -0
  77. package/dist/components/hud/telemetry/ShipRudderVisualizer.js +121 -0
  78. package/dist/components/hud/telemetry/ShipRudderVisualizer.js.map +1 -0
  79. package/dist/components/hud/telemetry/ShipRudderVisualizerPanel.d.ts +26 -0
  80. package/dist/components/hud/telemetry/ShipRudderVisualizerPanel.d.ts.map +1 -0
  81. package/dist/components/hud/telemetry/ShipRudderVisualizerPanel.js +29 -0
  82. package/dist/components/hud/telemetry/ShipRudderVisualizerPanel.js.map +1 -0
  83. package/dist/components/hud/telemetry/SignalLog.d.ts +7 -0
  84. package/dist/components/hud/telemetry/SignalLog.d.ts.map +1 -0
  85. package/dist/components/hud/telemetry/SignalLog.js +28 -0
  86. package/dist/components/hud/telemetry/SignalLog.js.map +1 -0
  87. package/dist/components/hud/telemetry/SignalStrength.d.ts +9 -0
  88. package/dist/components/hud/telemetry/SignalStrength.d.ts.map +1 -0
  89. package/dist/components/hud/telemetry/SignalStrength.js +53 -0
  90. package/dist/components/hud/telemetry/SignalStrength.js.map +1 -0
  91. package/dist/components/hud/telemetry/Speedometer.d.ts +2 -0
  92. package/dist/components/hud/telemetry/Speedometer.d.ts.map +1 -0
  93. package/dist/components/hud/telemetry/Speedometer.js +70 -0
  94. package/dist/components/hud/telemetry/Speedometer.js.map +1 -0
  95. package/dist/components/hud/telemetry/Task.d.ts +2 -0
  96. package/dist/components/hud/telemetry/Task.d.ts.map +1 -0
  97. package/dist/components/hud/telemetry/Task.js +61 -0
  98. package/dist/components/hud/telemetry/Task.js.map +1 -0
  99. package/dist/components/hud/telemetry/TaskData.d.ts +2 -0
  100. package/dist/components/hud/telemetry/TaskData.d.ts.map +1 -0
  101. package/dist/components/hud/telemetry/TaskData.js +62 -0
  102. package/dist/components/hud/telemetry/TaskData.js.map +1 -0
  103. package/dist/components/hud/telemetry/index.d.ts +40 -0
  104. package/dist/components/hud/telemetry/index.d.ts.map +1 -0
  105. package/dist/components/hud/telemetry/index.js +40 -0
  106. package/dist/components/hud/telemetry/index.js.map +1 -0
  107. package/dist/components/hud/telemetry/powerColor.d.ts +16 -0
  108. package/dist/components/hud/telemetry/powerColor.d.ts.map +1 -0
  109. package/dist/components/hud/telemetry/powerColor.js +15 -0
  110. package/dist/components/hud/telemetry/powerColor.js.map +1 -0
  111. package/dist/components/scenes/MappingScene.d.ts +19 -0
  112. package/dist/components/scenes/MappingScene.d.ts.map +1 -0
  113. package/dist/components/scenes/MappingScene.js +353 -0
  114. package/dist/components/scenes/MappingScene.js.map +1 -0
  115. package/dist/components/scenes/SceneCanvas.d.ts +96 -0
  116. package/dist/components/scenes/SceneCanvas.d.ts.map +1 -0
  117. package/dist/components/scenes/SceneCanvas.js +151 -0
  118. package/dist/components/scenes/SceneCanvas.js.map +1 -0
  119. package/dist/components/scenes/SceneRenderer.d.ts +16 -0
  120. package/dist/components/scenes/SceneRenderer.d.ts.map +1 -0
  121. package/dist/components/scenes/SceneRenderer.js +60 -0
  122. package/dist/components/scenes/SceneRenderer.js.map +1 -0
  123. package/dist/components/scenes/TelemetryScene.d.ts +6 -0
  124. package/dist/components/scenes/TelemetryScene.d.ts.map +1 -0
  125. package/dist/components/scenes/TelemetryScene.js +6 -0
  126. package/dist/components/scenes/TelemetryScene.js.map +1 -0
  127. package/dist/components/svg/CompassRose.d.ts +129 -0
  128. package/dist/components/svg/CompassRose.d.ts.map +1 -0
  129. package/dist/components/svg/CompassRose.js +221 -0
  130. package/dist/components/svg/CompassRose.js.map +1 -0
  131. package/dist/connection/config.d.ts +41 -0
  132. package/dist/connection/config.d.ts.map +1 -0
  133. package/dist/connection/config.js +44 -0
  134. package/dist/connection/config.js.map +1 -0
  135. package/dist/contexts/SceneContext.d.ts +35 -0
  136. package/dist/contexts/SceneContext.d.ts.map +1 -0
  137. package/dist/contexts/SceneContext.js +24 -0
  138. package/dist/contexts/SceneContext.js.map +1 -0
  139. package/dist/hooks/useAutoPathAnimation.d.ts +22 -0
  140. package/dist/hooks/useAutoPathAnimation.d.ts.map +1 -0
  141. package/dist/hooks/useAutoPathAnimation.js +102 -0
  142. package/dist/hooks/useAutoPathAnimation.js.map +1 -0
  143. package/dist/hooks/useLayoutConfig.d.ts +29 -0
  144. package/dist/hooks/useLayoutConfig.d.ts.map +1 -0
  145. package/dist/hooks/useLayoutConfig.js +30 -0
  146. package/dist/hooks/useLayoutConfig.js.map +1 -0
  147. package/dist/hooks/useSceneContext.d.ts +64 -0
  148. package/dist/hooks/useSceneContext.d.ts.map +1 -0
  149. package/dist/hooks/useSceneContext.js +37 -0
  150. package/dist/hooks/useSceneContext.js.map +1 -0
  151. package/dist/index.d.ts +44 -0
  152. package/dist/index.d.ts.map +1 -0
  153. package/dist/index.js +57 -0
  154. package/dist/index.js.map +1 -0
  155. package/dist/providers/TelemetryProvider.d.ts +27 -0
  156. package/dist/providers/TelemetryProvider.d.ts.map +1 -0
  157. package/dist/providers/TelemetryProvider.js +50 -0
  158. package/dist/providers/TelemetryProvider.js.map +1 -0
  159. package/dist/providers/TelemetryThemeProvider.d.ts +25 -0
  160. package/dist/providers/TelemetryThemeProvider.d.ts.map +1 -0
  161. package/dist/providers/TelemetryThemeProvider.js +54 -0
  162. package/dist/providers/TelemetryThemeProvider.js.map +1 -0
  163. package/dist/store/actions/connectionActions.d.ts +39 -0
  164. package/dist/store/actions/connectionActions.d.ts.map +1 -0
  165. package/dist/store/actions/connectionActions.js +162 -0
  166. package/dist/store/actions/connectionActions.js.map +1 -0
  167. package/dist/store/actions/fetchTelemetry.d.ts +51 -0
  168. package/dist/store/actions/fetchTelemetry.d.ts.map +1 -0
  169. package/dist/store/actions/fetchTelemetry.js +135 -0
  170. package/dist/store/actions/fetchTelemetry.js.map +1 -0
  171. package/dist/store/index.d.ts +23 -0
  172. package/dist/store/index.d.ts.map +1 -0
  173. package/dist/store/index.js +22 -0
  174. package/dist/store/index.js.map +1 -0
  175. package/dist/store/slices/connectionSlice.d.ts +15 -0
  176. package/dist/store/slices/connectionSlice.d.ts.map +1 -0
  177. package/dist/store/slices/connectionSlice.js +39 -0
  178. package/dist/store/slices/connectionSlice.js.map +1 -0
  179. package/dist/store/slices/discoveredGridSlice.d.ts +168 -0
  180. package/dist/store/slices/discoveredGridSlice.d.ts.map +1 -0
  181. package/dist/store/slices/discoveredGridSlice.js +146 -0
  182. package/dist/store/slices/discoveredGridSlice.js.map +1 -0
  183. package/dist/store/slices/sceneSlice.d.ts +185 -0
  184. package/dist/store/slices/sceneSlice.d.ts.map +1 -0
  185. package/dist/store/slices/sceneSlice.js +95 -0
  186. package/dist/store/slices/sceneSlice.js.map +1 -0
  187. package/dist/store/slices/simulationSlice.d.ts +87 -0
  188. package/dist/store/slices/simulationSlice.d.ts.map +1 -0
  189. package/dist/store/slices/simulationSlice.js +55 -0
  190. package/dist/store/slices/simulationSlice.js.map +1 -0
  191. package/dist/store/slices/telemetrySlice.d.ts +10 -0
  192. package/dist/store/slices/telemetrySlice.d.ts.map +1 -0
  193. package/dist/store/slices/telemetrySlice.js +88 -0
  194. package/dist/store/slices/telemetrySlice.js.map +1 -0
  195. package/dist/store/slices/videoSlice.d.ts +12 -0
  196. package/dist/store/slices/videoSlice.d.ts.map +1 -0
  197. package/dist/store/slices/videoSlice.js +27 -0
  198. package/dist/store/slices/videoSlice.js.map +1 -0
  199. package/dist/store/slices/visualizationSlice.d.ts +152 -0
  200. package/dist/store/slices/visualizationSlice.d.ts.map +1 -0
  201. package/dist/store/slices/visualizationSlice.js +58 -0
  202. package/dist/store/slices/visualizationSlice.js.map +1 -0
  203. package/dist/store/store.d.ts +61 -0
  204. package/dist/store/store.d.ts.map +1 -0
  205. package/dist/store/store.js +78 -0
  206. package/dist/store/store.js.map +1 -0
  207. package/dist/theme/index.d.ts +14 -0
  208. package/dist/theme/index.d.ts.map +1 -0
  209. package/dist/theme/index.js +14 -0
  210. package/dist/theme/index.js.map +1 -0
  211. package/dist/theme/lightTheme.d.ts +151 -0
  212. package/dist/theme/lightTheme.d.ts.map +1 -0
  213. package/dist/theme/lightTheme.js +194 -0
  214. package/dist/theme/lightTheme.js.map +1 -0
  215. package/dist/theme/telemetryTheme.d.ts +90 -0
  216. package/dist/theme/telemetryTheme.d.ts.map +1 -0
  217. package/dist/theme/telemetryTheme.js +157 -0
  218. package/dist/theme/telemetryTheme.js.map +1 -0
  219. package/dist/types/detectedObjectsTypes.d.ts +18 -0
  220. package/dist/types/detectedObjectsTypes.d.ts.map +1 -0
  221. package/dist/types/detectedObjectsTypes.js +8 -0
  222. package/dist/types/detectedObjectsTypes.js.map +1 -0
  223. package/dist/types/index.d.ts +16 -0
  224. package/dist/types/index.d.ts.map +1 -0
  225. package/dist/types/index.js +16 -0
  226. package/dist/types/index.js.map +1 -0
  227. package/dist/types/ros.d.ts +87 -0
  228. package/dist/types/ros.d.ts.map +1 -0
  229. package/dist/types/ros.js +17 -0
  230. package/dist/types/ros.js.map +1 -0
  231. package/dist/types/statusTypes.d.ts +81 -0
  232. package/dist/types/statusTypes.d.ts.map +1 -0
  233. package/dist/types/statusTypes.js +52 -0
  234. package/dist/types/statusTypes.js.map +1 -0
  235. package/dist/types/taskTypes.d.ts +65 -0
  236. package/dist/types/taskTypes.d.ts.map +1 -0
  237. package/dist/types/taskTypes.js +18 -0
  238. package/dist/types/taskTypes.js.map +1 -0
  239. package/dist/types/telemetryInterfaces.d.ts +81 -0
  240. package/dist/types/telemetryInterfaces.d.ts.map +1 -0
  241. package/dist/types/telemetryInterfaces.js +30 -0
  242. package/dist/types/telemetryInterfaces.js.map +1 -0
  243. package/dist/utils/basestation.d.ts +7 -0
  244. package/dist/utils/basestation.d.ts.map +1 -0
  245. package/dist/utils/basestation.js +49 -0
  246. package/dist/utils/basestation.js.map +1 -0
  247. package/dist/utils/batteryUtil.d.ts +8 -0
  248. package/dist/utils/batteryUtil.d.ts.map +1 -0
  249. package/dist/utils/batteryUtil.js +32 -0
  250. package/dist/utils/batteryUtil.js.map +1 -0
  251. package/dist/utils/telemetry/index.d.ts +13 -0
  252. package/dist/utils/telemetry/index.d.ts.map +1 -0
  253. package/dist/utils/telemetry/index.js +13 -0
  254. package/dist/utils/telemetry/index.js.map +1 -0
  255. package/dist/utils/telemetry/telemetryFactory.d.ts +48 -0
  256. package/dist/utils/telemetry/telemetryFactory.d.ts.map +1 -0
  257. package/dist/utils/telemetry/telemetryFactory.js +390 -0
  258. package/dist/utils/telemetry/telemetryFactory.js.map +1 -0
  259. package/package.json +91 -0
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * @file SceneContext.tsx
4
+ * @description Provider for the scene viewport context. Renamed from MapCanvasContext.tsx.
5
+ */
6
+ import React from 'react';
7
+ import { SceneContext } from '../hooks/useSceneContext';
8
+ /**
9
+ * @component SceneProvider
10
+ * @description Provides the {@link SceneContext} to its child components.
11
+ * @param {SceneProviderProps} props - Properties for the component.
12
+ * @returns {JSX.Element} A React element that provides the {@link SceneContext} to its children.
13
+ * @remarks
14
+ * This component should be used at a high level in the component tree to ensure that all child components that need access to the scene viewport context can do so. It takes a {@link SceneContextValue} and makes it available to all descendants via the {@link SceneContext}.
15
+ * @example
16
+ * <SceneProvider value={sceneContextValue}>
17
+ * <ChildComponent />
18
+ * </SceneProvider>
19
+ * @see {@link SceneContext} for the context definition.
20
+ */
21
+ export function SceneProvider({ value, children }) {
22
+ return _jsx(SceneContext.Provider, { value: value, children: children });
23
+ }
24
+ //# sourceMappingURL=SceneContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SceneContext.js","sourceRoot":"","sources":["../../src/contexts/SceneContext.tsx"],"names":[],"mappings":";AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAA0B,MAAM,0BAA0B,CAAC;AAgBhF;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAsB;IACjE,OAAO,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAyB,CAAC;AACnF,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @function useAutoPathAnimation
3
+ * @description Custom React hook that animates the vessel along the planned path in automatic simulation mode.
4
+ * @param {boolean} enabled - Whether the automatic path animation is enabled.
5
+ * @param {number} [speed=2.0] - The speed of the animation in cells per second. Defaults to 2.0.
6
+ * @returns {{ autoX: number, autoY: number, autoHeading: number }} The current animated position and heading of the vessel.
7
+ * @remarks
8
+ * The hook reads the planned path from the Redux store and animates the vessel along that path when enabled.
9
+ * If an error cell exists in the navigation grid (indicating an unreachable objective), the vessel remains at its current position.
10
+ * The animation loops continuously from the start of the path to the end, updating the position and heading based on elapsed time and speed.
11
+ * The heading is calculated based on the direction of movement between consecutive waypoints, with 0 degrees representing north (–Y) and 90 degrees representing east (+X).
12
+ * The hook uses requestAnimationFrame for smooth animation and cleans up the animation frame when the component unmounts or when the animation is disabled.
13
+ * @example
14
+ * const { autoX, autoY, autoHeading } = useAutoPathAnimation(true, 2.5);
15
+ * // autoX, autoY, and autoHeading can be used to position and orient the vessel in the visualizer.
16
+ */
17
+ export declare function useAutoPathAnimation(enabled: boolean, speed?: number): {
18
+ autoX: number;
19
+ autoY: number;
20
+ autoHeading: number;
21
+ };
22
+ //# sourceMappingURL=useAutoPathAnimation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAutoPathAnimation.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutoPathAnimation.ts"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,GAAE,MAAY;;;;EA6EzE"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * @file useAutoPathAnimation.ts
3
+ * @description Animates the vessel along the planned path (planning.plan) in automatic simulation mode.
4
+ * Loops from the current cell to the objective cell. If an error cell exists in the navigation grid
5
+ * (unreachable objective), the vessel stays at the current position and does not move.
6
+ */
7
+ import { useState, useEffect, useRef, useMemo, startTransition } from 'react';
8
+ import { useAppSelector } from '../store';
9
+ import { CellTypes, GLOBAL_GRID_SIZE } from '../types';
10
+ /**
11
+ * @function cellToWorld
12
+ * @description Converts a grid cell index to the global X/Y coordinate used by useAutoPathAnimation.
13
+ * @param {number} idx - The grid cell index (column or row).
14
+ * @returns {number} The corresponding world coordinate in cell units, centered at 0.
15
+ * @remarks
16
+ * The function maps the grid cell index to a world coordinate in the range of –GLOBAL_GRID_SIZE/2 to +GLOBAL_GRID_SIZE/2.
17
+ * Adding 0.5 positions the vessel at the center of the cell rather than the top-left corner.
18
+ * This ensures that the vessel is visually centered within each grid cell during animation.
19
+ * @example
20
+ * const worldX = cellToWorld(5); // Converts grid column index 5 to world X coordinate.
21
+ * const worldY = cellToWorld(3); // Converts grid row index 3 to world Y coordinate.
22
+ */
23
+ function cellToWorld(idx) {
24
+ return idx - GLOBAL_GRID_SIZE / 2 + 0.5;
25
+ }
26
+ /**
27
+ * @function useAutoPathAnimation
28
+ * @description Custom React hook that animates the vessel along the planned path in automatic simulation mode.
29
+ * @param {boolean} enabled - Whether the automatic path animation is enabled.
30
+ * @param {number} [speed=2.0] - The speed of the animation in cells per second. Defaults to 2.0.
31
+ * @returns {{ autoX: number, autoY: number, autoHeading: number }} The current animated position and heading of the vessel.
32
+ * @remarks
33
+ * The hook reads the planned path from the Redux store and animates the vessel along that path when enabled.
34
+ * If an error cell exists in the navigation grid (indicating an unreachable objective), the vessel remains at its current position.
35
+ * The animation loops continuously from the start of the path to the end, updating the position and heading based on elapsed time and speed.
36
+ * The heading is calculated based on the direction of movement between consecutive waypoints, with 0 degrees representing north (–Y) and 90 degrees representing east (+X).
37
+ * The hook uses requestAnimationFrame for smooth animation and cleans up the animation frame when the component unmounts or when the animation is disabled.
38
+ * @example
39
+ * const { autoX, autoY, autoHeading } = useAutoPathAnimation(true, 2.5);
40
+ * // autoX, autoY, and autoHeading can be used to position and orient the vessel in the visualizer.
41
+ */
42
+ export function useAutoPathAnimation(enabled, speed = 2.0) {
43
+ const plan = useAppSelector((state) => state.telemetry.planning.plan);
44
+ const navigationGrid = useAppSelector((state) => state.telemetry.map.navigationGrid);
45
+ // Stop animation when the objective is unreachable (error cell present in nav grid).
46
+ const hasError = useMemo(() => navigationGrid.some(row => row.some(cell => cell.type === CellTypes.error)), [navigationGrid]);
47
+ // Convert plan grid cells (col, row indices) to continuous world coordinates.
48
+ const waypoints = useMemo(() => plan.map(cell => ({ x: cellToWorld(cell.x), y: cellToWorld(cell.y) })), [plan]);
49
+ const startPos = {
50
+ x: waypoints[0]?.x ?? 0,
51
+ y: waypoints[0]?.y ?? 0,
52
+ heading: 0,
53
+ };
54
+ const [animState, setAnimState] = useState(startPos);
55
+ const progressRef = useRef(0);
56
+ const frameRef = useRef(0);
57
+ const lastTimeRef = useRef(null);
58
+ // Reset to start of path when plan changes (new telemetry data).
59
+ useEffect(() => {
60
+ progressRef.current = 0;
61
+ setAnimState({ x: waypoints[0]?.x ?? 0, y: waypoints[0]?.y ?? 0, heading: 0 });
62
+ }, [waypoints]);
63
+ useEffect(() => {
64
+ if (!enabled || hasError || waypoints.length < 2)
65
+ return;
66
+ const totalSteps = waypoints.length - 1;
67
+ const animate = (now) => {
68
+ if (lastTimeRef.current === null)
69
+ lastTimeRef.current = now;
70
+ const dt = (now - lastTimeRef.current) / 1000;
71
+ lastTimeRef.current = now;
72
+ progressRef.current = (progressRef.current + speed * dt) % totalSteps;
73
+ const idx = Math.floor(progressRef.current);
74
+ const t = progressRef.current - idx;
75
+ const from = waypoints[idx];
76
+ const to = waypoints[Math.min(idx + 1, totalSteps)];
77
+ const dx = to.x - from.x;
78
+ const dy = to.y - from.y;
79
+ // Heading: 0 = north (–Y), 90 = east (+X), matches app convention.
80
+ const heading = (Math.atan2(dx, -dy) * 180 / Math.PI + 360) % 360;
81
+ // Marked as a transition so this per-frame update doesn't compete on equal
82
+ // priority with more urgent work (e.g. a pending route navigation) — React can
83
+ // interrupt/deprioritize it, and only the latest position matters visually anyway.
84
+ startTransition(() => {
85
+ setAnimState({
86
+ x: from.x + dx * t,
87
+ y: from.y + dy * t,
88
+ heading,
89
+ });
90
+ });
91
+ frameRef.current = requestAnimationFrame(animate);
92
+ };
93
+ frameRef.current = requestAnimationFrame(animate);
94
+ return () => {
95
+ if (frameRef.current)
96
+ cancelAnimationFrame(frameRef.current);
97
+ lastTimeRef.current = null;
98
+ };
99
+ }, [enabled, hasError, waypoints, speed]);
100
+ return { autoX: animState.x, autoY: animState.y, autoHeading: animState.heading };
101
+ }
102
+ //# sourceMappingURL=useAutoPathAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAutoPathAnimation.js","sourceRoot":"","sources":["../../src/hooks/useAutoPathAnimation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAevD;;;;;;;;;;;;GAYG;AACH,SAAS,WAAW,CAAC,GAAW;IAC5B,OAAO,GAAG,GAAG,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
1
+ /**
2
+ * @file useLayoutConfig.ts
3
+ * @description Custom React hook that provides layout configuration values based on the device mode (desktop or mobile).
4
+ * @remarks
5
+ * This hook calculates and returns layout configuration values such as map dimensions, scale, and flow control sizes based on whether the application is in desktop mode or mobile mode. It helps maintain consistent layout and scaling across different device types.
6
+ * @param {boolean} isDesktopMode - A boolean indicating whether the application is in desktop mode.
7
+ * @returns {{
8
+ * mapWidth: number,
9
+ * mapHeight: number,
10
+ * mapScale: number,
11
+ * flowControlSize: number,
12
+ * flowCenter: number,
13
+ * flowOuterRadius: number,
14
+ * flowInnerRadius: number
15
+ * }} An object containing layout configuration values for the visualizer.
16
+ * @example
17
+ * const { mapWidth, mapHeight, mapScale } = useLayoutConfig(true);
18
+ * // mapWidth, mapHeight, and mapScale can be used to set the dimensions and scale of the visualizer.
19
+ */
20
+ export declare function useLayoutConfig(isDesktopMode: boolean): {
21
+ mapWidth: number;
22
+ mapHeight: number;
23
+ mapScale: number;
24
+ flowControlSize: number;
25
+ flowCenter: number;
26
+ flowOuterRadius: number;
27
+ flowInnerRadius: number;
28
+ };
29
+ //# sourceMappingURL=useLayoutConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLayoutConfig.d.ts","sourceRoot":"","sources":["../../src/hooks/useLayoutConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,OAAO;;;;;;;;EASrD"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @file useLayoutConfig.ts
3
+ * @description Custom React hook that provides layout configuration values based on the device mode (desktop or mobile).
4
+ * @remarks
5
+ * This hook calculates and returns layout configuration values such as map dimensions, scale, and flow control sizes based on whether the application is in desktop mode or mobile mode. It helps maintain consistent layout and scaling across different device types.
6
+ * @param {boolean} isDesktopMode - A boolean indicating whether the application is in desktop mode.
7
+ * @returns {{
8
+ * mapWidth: number,
9
+ * mapHeight: number,
10
+ * mapScale: number,
11
+ * flowControlSize: number,
12
+ * flowCenter: number,
13
+ * flowOuterRadius: number,
14
+ * flowInnerRadius: number
15
+ * }} An object containing layout configuration values for the visualizer.
16
+ * @example
17
+ * const { mapWidth, mapHeight, mapScale } = useLayoutConfig(true);
18
+ * // mapWidth, mapHeight, and mapScale can be used to set the dimensions and scale of the visualizer.
19
+ */
20
+ export function useLayoutConfig(isDesktopMode) {
21
+ const mapWidth = isDesktopMode ? 1600 : 800;
22
+ const mapHeight = isDesktopMode ? 900 : 600;
23
+ const mapScale = isDesktopMode ? 1.25 : 0.9;
24
+ const flowControlSize = isDesktopMode ? 140 : 180;
25
+ const flowCenter = flowControlSize / 2;
26
+ const flowOuterRadius = flowCenter - (isDesktopMode ? 10 : 12);
27
+ const flowInnerRadius = flowOuterRadius * 0.75;
28
+ return { mapWidth, mapHeight, mapScale, flowControlSize, flowCenter, flowOuterRadius, flowInnerRadius };
29
+ }
30
+ //# sourceMappingURL=useLayoutConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLayoutConfig.js","sourceRoot":"","sources":["../../src/hooks/useLayoutConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,eAAe,CAAC,aAAsB;IAClD,MAAM,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5C,MAAM,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5C,MAAM,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5C,MAAM,eAAe,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAClD,MAAM,UAAU,GAAG,eAAe,GAAG,CAAC,CAAC;IACvC,MAAM,eAAe,GAAG,UAAU,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,eAAe,GAAG,eAAe,GAAG,IAAI,CAAC;IAC/C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AAC5G,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @file useSceneContext.ts
3
+ * @description React context for the scene viewport: pan offset, zoom scale, follow mode,
4
+ * layout mode flags, and UI callbacks. Renamed from useMapCanvasContext.ts.
5
+ */
6
+ import React from 'react';
7
+ /**
8
+ * @interface SceneContextValue
9
+ * @description The value provided by the {@link SceneContext} React context.
10
+ * @see {@link SceneContext}
11
+ * @property {boolean} isDesktopMode - True if the application is in desktop mode, false if in mobile mode.
12
+ * @property {boolean} isFullscreen - True if the visualizer is in fullscreen mode, false otherwise.
13
+ * @property {boolean} isMobile - True if the application is in mobile mode, false otherwise.
14
+ * @property {boolean} hasJoystick - True if a joystick is available for manual control, false otherwise.
15
+ * @property {() => void} onToggleFullscreen - Callback function to toggle fullscreen mode.
16
+ * @property {() => void} onOpenControlsDrawer - Callback function to open the controls drawer.
17
+ * @property {{ x: number; y: number }} viewOffset - The current pan offset of the scene viewport.
18
+ * @property {number} userScale - The current zoom scale of the scene viewport.
19
+ * @property {() => void} resetView - Callback function to reset the view to the default position and scale.
20
+ * @property {boolean} followLocalGrid - True if the view is following the local grid, false otherwise.
21
+ * @property {() => void} onToggleFollowLocalGrid - Callback function to toggle the follow local grid mode.
22
+ */
23
+ export interface SceneContextValue {
24
+ isDesktopMode: boolean;
25
+ isFullscreen: boolean;
26
+ isMobile: boolean;
27
+ hasJoystick: boolean;
28
+ onToggleFullscreen: () => void;
29
+ onOpenControlsDrawer: () => void;
30
+ viewOffset: {
31
+ x: number;
32
+ y: number;
33
+ };
34
+ userScale: number;
35
+ resetView: () => void;
36
+ followLocalGrid: boolean;
37
+ onToggleFollowLocalGrid: () => void;
38
+ }
39
+ /**
40
+ * @constant SceneContext
41
+ * @description React context for the scene viewport, providing pan offset, zoom scale, follow mode,
42
+ * layout mode flags, and UI callbacks.
43
+ * @see {@link SceneContextValue} for the shape of the context value.
44
+ * @remarks
45
+ * This context is used to share state and callbacks related to the scene viewport across components in the visualizer. It includes information about the current layout mode (desktop or mobile), fullscreen status, joystick availability, view offset, zoom scale, and functions to toggle fullscreen mode, open the controls drawer, reset the view, and toggle follow local grid mode.
46
+ * Components that need access to these values should use the {@link useSceneContext} hook.
47
+ * @example
48
+ * const { isDesktopMode, onToggleFullscreen } = useSceneContext();
49
+ * // Use isDesktopMode to conditionally render components based on layout mode.
50
+ * // Call onToggleFullscreen to toggle fullscreen mode when a button is clicked.
51
+ */
52
+ export declare const SceneContext: React.Context<SceneContextValue | null>;
53
+ /**
54
+ * @function useSceneContext
55
+ * @description Custom React hook to access the {@link SceneContext} values.
56
+ * @see {@link SceneContext} for the context definition.
57
+ * @remarks
58
+ * This hook provides a convenient way for components to access the values and callbacks provided by the {@link SceneContext}. It ensures that the context is used within a provider and throws an error if accessed outside of a provider.
59
+ * @example
60
+ * const { viewOffset, userScale } = useSceneContext();
61
+ * // Use viewOffset and userScale to position and scale elements in the scene viewport.
62
+ */
63
+ export declare function useSceneContext(): SceneContextValue;
64
+ //# sourceMappingURL=useSceneContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSceneContext.d.ts","sourceRoot":"","sources":["../../src/hooks/useSceneContext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,iBAAiB;IAC9B,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,UAAU,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,uBAAuB,EAAE,MAAM,IAAI,CAAC;CACvC;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,yCAAsD,CAAC;AAEhF;;;;;;;;;GASG;AACH,wBAAgB,eAAe,IAAI,iBAAiB,CAInD"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @file useSceneContext.ts
3
+ * @description React context for the scene viewport: pan offset, zoom scale, follow mode,
4
+ * layout mode flags, and UI callbacks. Renamed from useMapCanvasContext.ts.
5
+ */
6
+ import React from 'react';
7
+ /**
8
+ * @constant SceneContext
9
+ * @description React context for the scene viewport, providing pan offset, zoom scale, follow mode,
10
+ * layout mode flags, and UI callbacks.
11
+ * @see {@link SceneContextValue} for the shape of the context value.
12
+ * @remarks
13
+ * This context is used to share state and callbacks related to the scene viewport across components in the visualizer. It includes information about the current layout mode (desktop or mobile), fullscreen status, joystick availability, view offset, zoom scale, and functions to toggle fullscreen mode, open the controls drawer, reset the view, and toggle follow local grid mode.
14
+ * Components that need access to these values should use the {@link useSceneContext} hook.
15
+ * @example
16
+ * const { isDesktopMode, onToggleFullscreen } = useSceneContext();
17
+ * // Use isDesktopMode to conditionally render components based on layout mode.
18
+ * // Call onToggleFullscreen to toggle fullscreen mode when a button is clicked.
19
+ */
20
+ export const SceneContext = React.createContext(null);
21
+ /**
22
+ * @function useSceneContext
23
+ * @description Custom React hook to access the {@link SceneContext} values.
24
+ * @see {@link SceneContext} for the context definition.
25
+ * @remarks
26
+ * This hook provides a convenient way for components to access the values and callbacks provided by the {@link SceneContext}. It ensures that the context is used within a provider and throws an error if accessed outside of a provider.
27
+ * @example
28
+ * const { viewOffset, userScale } = useSceneContext();
29
+ * // Use viewOffset and userScale to position and scale elements in the scene viewport.
30
+ */
31
+ export function useSceneContext() {
32
+ const ctx = React.useContext(SceneContext);
33
+ if (!ctx)
34
+ throw new Error('useSceneContext must be used inside SceneProvider');
35
+ return ctx;
36
+ }
37
+ //# sourceMappingURL=useSceneContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSceneContext.js","sourceRoot":"","sources":["../../src/hooks/useSceneContext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAgC1B;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,aAAa,CAA2B,IAAI,CAAC,CAAC;AAEhF;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe;IAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAC3C,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IAC/E,OAAO,GAAG,CAAC;AACf,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @file index.ts
3
+ * @description Main entry point for @humber-asv/visualizer.
4
+ *
5
+ * Exposes the telemetry dashboard and HUD panels, scene components, compass
6
+ * controls, providers, hooks, factory programs, connection configuration and
7
+ * all telemetry data types. The Redux store surface lives under
8
+ * `@humber-asv/visualizer/store`, the MUI themes under
9
+ * `@humber-asv/visualizer/theme`.
10
+ *
11
+ * @author Carson Fujita
12
+ * @license MIT
13
+ */
14
+ export { default as TelemetryDashboard, type TelemetryDashboardProps } from './components/TelemetryDashboard';
15
+ export * from './components/hud/telemetry';
16
+ export { TaskData } from './components/hud/telemetry';
17
+ export * as SceneHUD from './components/hud/SceneHUD';
18
+ export { default as MappingScene } from './components/scenes/MappingScene';
19
+ export { default as TelemetryScene } from './components/scenes/TelemetryScene';
20
+ export { SceneCanvas } from './components/scenes/SceneCanvas';
21
+ export { SceneRenderer } from './components/scenes/SceneRenderer';
22
+ export { CompassRose, DirectionalGrid, DirectionButtons, InteractiveCompass, type CompassRoseProps, type DirectionalGridProps, type InteractiveCompassProps, } from './components/svg/CompassRose';
23
+ export { default as Joystick, type JoyState } from './components/Joystick';
24
+ export { ControlOverlay } from './components/controls/ControlOverlay';
25
+ export { ControlsDrawer } from './components/controls/ControlsDrawer';
26
+ export { ForceVectorsPanel } from './components/controls/ForceVectorsPanel';
27
+ export { InfoPopover } from './components/controls/InfoPopover';
28
+ export { Legend } from './components/controls/Legend';
29
+ export { MobileBottomNav } from './components/controls/MobileBottomNav';
30
+ export { default as TelemetryProvider } from './providers/TelemetryProvider';
31
+ export { default as TelemetryThemeProvider } from './providers/TelemetryThemeProvider';
32
+ export { SceneProvider } from './contexts/SceneContext';
33
+ export { useLayoutConfig } from './hooks/useLayoutConfig';
34
+ export { useAutoPathAnimation } from './hooks/useAutoPathAnimation';
35
+ export { SceneContext, useSceneContext, type SceneContextValue } from './hooks/useSceneContext';
36
+ export { configureTelemetryConnection, getTelemetryConnectionConfig, resetTelemetryConnectionConfig, type TelemetryConnectionConfig, } from './connection/config';
37
+ export { isBasestationOnline } from './utils/basestation';
38
+ export { batteryIconFor } from './utils/batteryUtil';
39
+ export { telemetryFactory } from './utils/telemetry';
40
+ export { default as generateRandomState, generateMockStateUpdate, generateMockVideoUrl, } from './utils/telemetry/telemetryFactory';
41
+ export { RudderIcon } from './assets/RudderIcon';
42
+ export { boatSvgUrl, warningSvgUrl, arrowSvgUrl, connectingSvgUrl } from './assets/svgSources';
43
+ export * from './types';
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC9G,cAAc,4BAA4B,CAAC;AAI3C,OAAO,EA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hG,OAAO,EACH,4BAA4B,EAC5B,4BAA4B,EAC5B,8BAA8B,EAC9B,KAAK,yBAAyB,GACjC,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACH,OAAO,IAAI,mBAAmB,EAC9B,uBAAuB,EACvB,oBAAoB,GACvB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG/F,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @file index.ts
3
+ * @description Main entry point for @humber-asv/visualizer.
4
+ *
5
+ * Exposes the telemetry dashboard and HUD panels, scene components, compass
6
+ * controls, providers, hooks, factory programs, connection configuration and
7
+ * all telemetry data types. The Redux store surface lives under
8
+ * `@humber-asv/visualizer/store`, the MUI themes under
9
+ * `@humber-asv/visualizer/theme`.
10
+ *
11
+ * @author Carson Fujita
12
+ * @license MIT
13
+ */
14
+ // ─── Dashboard & HUD panels ──────────────────────────────────────────────────
15
+ export { default as TelemetryDashboard } from './components/TelemetryDashboard';
16
+ export * from './components/hud/telemetry';
17
+ // The TaskData panel (value) and the TaskData record type (from ./types) share a
18
+ // name — the explicit re-export resolves the star-export ambiguity in favor of
19
+ // the component; the record type stays importable as part of Status.
20
+ export { TaskData } from './components/hud/telemetry';
21
+ export * as SceneHUD from './components/hud/SceneHUD';
22
+ // ─── Scenes ──────────────────────────────────────────────────────────────────
23
+ export { default as MappingScene } from './components/scenes/MappingScene';
24
+ export { default as TelemetryScene } from './components/scenes/TelemetryScene';
25
+ export { SceneCanvas } from './components/scenes/SceneCanvas';
26
+ export { SceneRenderer } from './components/scenes/SceneRenderer';
27
+ // ─── Compass & joystick controls ─────────────────────────────────────────────
28
+ export { CompassRose, DirectionalGrid, DirectionButtons, InteractiveCompass, } from './components/svg/CompassRose';
29
+ export { default as Joystick } from './components/Joystick';
30
+ // ─── Control panels ──────────────────────────────────────────────────────────
31
+ export { ControlOverlay } from './components/controls/ControlOverlay';
32
+ export { ControlsDrawer } from './components/controls/ControlsDrawer';
33
+ export { ForceVectorsPanel } from './components/controls/ForceVectorsPanel';
34
+ export { InfoPopover } from './components/controls/InfoPopover';
35
+ export { Legend } from './components/controls/Legend';
36
+ export { MobileBottomNav } from './components/controls/MobileBottomNav';
37
+ // ─── Providers & contexts ────────────────────────────────────────────────────
38
+ export { default as TelemetryProvider } from './providers/TelemetryProvider';
39
+ export { default as TelemetryThemeProvider } from './providers/TelemetryThemeProvider';
40
+ export { SceneProvider } from './contexts/SceneContext';
41
+ // ─── Hooks ───────────────────────────────────────────────────────────────────
42
+ export { useLayoutConfig } from './hooks/useLayoutConfig';
43
+ export { useAutoPathAnimation } from './hooks/useAutoPathAnimation';
44
+ export { SceneContext, useSceneContext } from './hooks/useSceneContext';
45
+ // ─── Connection configuration ────────────────────────────────────────────────
46
+ export { configureTelemetryConnection, getTelemetryConnectionConfig, resetTelemetryConnectionConfig, } from './connection/config';
47
+ // ─── Utilities & factory programs ────────────────────────────────────────────
48
+ export { isBasestationOnline } from './utils/basestation';
49
+ export { batteryIconFor } from './utils/batteryUtil';
50
+ export { telemetryFactory } from './utils/telemetry';
51
+ export { default as generateRandomState, generateMockStateUpdate, generateMockVideoUrl, } from './utils/telemetry/telemetryFactory';
52
+ // ─── Assets ──────────────────────────────────────────────────────────────────
53
+ export { RudderIcon } from './assets/RudderIcon';
54
+ export { boatSvgUrl, warningSvgUrl, arrowSvgUrl, connectingSvgUrl } from './assets/svgSources';
55
+ // ─── Data types ──────────────────────────────────────────────────────────────
56
+ export * from './types';
57
+ //# sourceMapping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,oCAAoC,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,gFAAgF;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,eAAe,EAA0B,MAAM,yBAAyB,CAAC;AAEhG,gFAAgF;AAChF,OAAO,EACH,4BAA4B,EAC5B,4BAA4B,EAC5B,8BAA8B,GAEjC,MAAM,qBAAqB,CAAC;AAE7B,gFAAgF;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACH,OAAO,IAAI,mBAAmB,EAC9B,uBAAuB,EACvB,oBAAoB,GACvB,MAAM,oCAAoC,CAAC;AAE5C,gFAAgF;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE/F,gFAAgF;AAChF,cAAc,SAAS,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @file TelemetryProvider.tsx
3
+ *
4
+ * @description
5
+ * This file defines the TelemetryProvider component, which is responsible for providing the Redux store to the components that need access to telemetry data.
6
+ * It uses the React-Redux Provider component to wrap its children with the store, allowing any nested components to connect to the Redux store and access telemetry data as needed.
7
+ *
8
+ * @author Carson Fujita
9
+ * @license MIT
10
+ */
11
+ import React from 'react';
12
+ /**
13
+ * TelemetryProvider component that wraps its children with the Redux Provider to provide access to the telemetry store.
14
+ */
15
+ interface TelemetryProviderProps {
16
+ children: React.ReactNode;
17
+ }
18
+ /**
19
+ * The provider component for the telemetry page, which wraps its children with the Redux Provider to give them access to the telemetry store.
20
+ * @param children The child components that will have access to the telemetry store.
21
+ * These are typically the components that display telemetry data and need to connect to the Redux store to access that data.
22
+ * @returns the TelemetryProvider component that wraps its children with the Redux Provider,
23
+ * allowing them to access the telemetry store and receive updates as the telemetry data changes.
24
+ */
25
+ declare const TelemetryProvider: React.FC<TelemetryProviderProps>;
26
+ export default TelemetryProvider;
27
+ //# sourceMappingURL=TelemetryProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TelemetryProvider.d.ts","sourceRoot":"","sources":["../../src/providers/TelemetryProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAyBH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B;;GAEG;AACH,UAAU,sBAAsB;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAEvD,CAAA;AAED,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * @file TelemetryProvider.tsx
4
+ *
5
+ * @description
6
+ * This file defines the TelemetryProvider component, which is responsible for providing the Redux store to the components that need access to telemetry data.
7
+ * It uses the React-Redux Provider component to wrap its children with the store, allowing any nested components to connect to the Redux store and access telemetry data as needed.
8
+ *
9
+ * @author Carson Fujita
10
+ * @license MIT
11
+ */
12
+ /*
13
+ MIT License
14
+
15
+ Copyright (c) 2026 HumberASV
16
+ Copyright (c) 2026 Carson Fujita
17
+
18
+ Permission is hereby granted, free of charge, to any person obtaining a copy
19
+ of this software and associated documentation files (the "Software"), to deal
20
+ in the Software without restriction, including without limitation the rights
21
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22
+ copies of the Software, and to permit persons to whom the Software is
23
+ furnished to do so, subject to the following conditions:
24
+
25
+ The above copyright notice and this permission notice shall be included in all
26
+ copies or substantial portions of the Software.
27
+
28
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34
+ SOFTWARE.
35
+ */
36
+ import React from 'react';
37
+ import { Provider } from 'react-redux';
38
+ import store from '../store';
39
+ /**
40
+ * The provider component for the telemetry page, which wraps its children with the Redux Provider to give them access to the telemetry store.
41
+ * @param children The child components that will have access to the telemetry store.
42
+ * These are typically the components that display telemetry data and need to connect to the Redux store to access that data.
43
+ * @returns the TelemetryProvider component that wraps its children with the Redux Provider,
44
+ * allowing them to access the telemetry store and receive updates as the telemetry data changes.
45
+ */
46
+ const TelemetryProvider = ({ children }) => {
47
+ return _jsx(Provider, { store: store, children: children });
48
+ };
49
+ export default TelemetryProvider;
50
+ //# sourceMappingURL=TelemetryProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TelemetryProvider.js","sourceRoot":"","sources":["../../src/providers/TelemetryProvider.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;AACH;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,MAAM,UAAU,CAAC;AAS7B;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAqC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACzE,OAAO,KAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAY,CAAC;AACzD,CAAC,CAAA;AAED,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @file TelemetryThemeProvider.tsx
3
+ *
4
+ * @description
5
+ * This file defines the TelemetryThemeProvider component, which is responsible for providing a custom Material-UI theme to the telemetry-related components in the application.
6
+ * It uses the ThemeProvider component from Material-UI to wrap its children with the custom telemetry theme defined in the telemetryTheme file.
7
+ *
8
+ * @author Carson Fujita
9
+ * @license MIT
10
+ *
11
+ * @remarks
12
+ * - Specifically for telemetry-related components
13
+ */
14
+ import React from "react";
15
+ /**
16
+ * the provider component for the telemetry page,
17
+ * which wraps its children with the Material-UI ThemeProvider to give them access to the custom telemetry theme.
18
+ * @param children the child components that will have access to the custom telemetry theme.
19
+ * @returns the TelemetryThemeProvider component that wraps its children with the Material-UI ThemeProvider,
20
+ */
21
+ declare const TelemetryThemeProvider: React.FC<{
22
+ children: React.ReactNode;
23
+ }>;
24
+ export default TelemetryThemeProvider;
25
+ //# sourceMappingURL=TelemetryThemeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TelemetryThemeProvider.d.ts","sourceRoot":"","sources":["../../src/providers/TelemetryThemeProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA2BH,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B;;;;;GAKG;AACH,QAAA,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CASnE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}