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.
- package/LICENSE +21 -0
- package/README.md +90 -0
- package/dist/assets/RudderIcon.d.ts +23 -0
- package/dist/assets/RudderIcon.d.ts.map +1 -0
- package/dist/assets/RudderIcon.js +23 -0
- package/dist/assets/RudderIcon.js.map +1 -0
- package/dist/assets/svgSources.d.ts +18 -0
- package/dist/assets/svgSources.d.ts.map +1 -0
- package/dist/assets/svgSources.js +18 -0
- package/dist/assets/svgSources.js.map +1 -0
- package/dist/components/Joystick.d.ts +23 -0
- package/dist/components/Joystick.d.ts.map +1 -0
- package/dist/components/Joystick.js +114 -0
- package/dist/components/Joystick.js.map +1 -0
- package/dist/components/TelemetryDashboard.d.ts +31 -0
- package/dist/components/TelemetryDashboard.d.ts.map +1 -0
- package/dist/components/TelemetryDashboard.js +127 -0
- package/dist/components/TelemetryDashboard.js.map +1 -0
- package/dist/components/controls/ControlOverlay.d.ts +64 -0
- package/dist/components/controls/ControlOverlay.d.ts.map +1 -0
- package/dist/components/controls/ControlOverlay.js +88 -0
- package/dist/components/controls/ControlOverlay.js.map +1 -0
- package/dist/components/controls/ControlsDrawer.d.ts +37 -0
- package/dist/components/controls/ControlsDrawer.d.ts.map +1 -0
- package/dist/components/controls/ControlsDrawer.js +93 -0
- package/dist/components/controls/ControlsDrawer.js.map +1 -0
- package/dist/components/controls/ForceVectorsPanel.d.ts +37 -0
- package/dist/components/controls/ForceVectorsPanel.d.ts.map +1 -0
- package/dist/components/controls/ForceVectorsPanel.js +76 -0
- package/dist/components/controls/ForceVectorsPanel.js.map +1 -0
- package/dist/components/controls/InfoPopover.d.ts +34 -0
- package/dist/components/controls/InfoPopover.d.ts.map +1 -0
- package/dist/components/controls/InfoPopover.js +41 -0
- package/dist/components/controls/InfoPopover.js.map +1 -0
- package/dist/components/controls/Legend.d.ts +29 -0
- package/dist/components/controls/Legend.d.ts.map +1 -0
- package/dist/components/controls/Legend.js +74 -0
- package/dist/components/controls/Legend.js.map +1 -0
- package/dist/components/controls/MobileBottomNav.d.ts +17 -0
- package/dist/components/controls/MobileBottomNav.d.ts.map +1 -0
- package/dist/components/controls/MobileBottomNav.js +46 -0
- package/dist/components/controls/MobileBottomNav.js.map +1 -0
- package/dist/components/hud/SceneHUD.d.ts +100 -0
- package/dist/components/hud/SceneHUD.d.ts.map +1 -0
- package/dist/components/hud/SceneHUD.js +216 -0
- package/dist/components/hud/SceneHUD.js.map +1 -0
- package/dist/components/hud/telemetry/Batteries.d.ts +40 -0
- package/dist/components/hud/telemetry/Batteries.d.ts.map +1 -0
- package/dist/components/hud/telemetry/Batteries.js +137 -0
- package/dist/components/hud/telemetry/Batteries.js.map +1 -0
- package/dist/components/hud/telemetry/Compass.d.ts +2 -0
- package/dist/components/hud/telemetry/Compass.d.ts.map +1 -0
- package/dist/components/hud/telemetry/Compass.js +147 -0
- package/dist/components/hud/telemetry/Compass.js.map +1 -0
- package/dist/components/hud/telemetry/Log.d.ts +2 -0
- package/dist/components/hud/telemetry/Log.d.ts.map +1 -0
- package/dist/components/hud/telemetry/Log.js +65 -0
- package/dist/components/hud/telemetry/Log.js.map +1 -0
- package/dist/components/hud/telemetry/Map.d.ts +4 -0
- package/dist/components/hud/telemetry/Map.d.ts.map +1 -0
- package/dist/components/hud/telemetry/Map.js +293 -0
- package/dist/components/hud/telemetry/Map.js.map +1 -0
- package/dist/components/hud/telemetry/PowerRudderPanel.d.ts +2 -0
- package/dist/components/hud/telemetry/PowerRudderPanel.d.ts.map +1 -0
- package/dist/components/hud/telemetry/PowerRudderPanel.js +115 -0
- package/dist/components/hud/telemetry/PowerRudderPanel.js.map +1 -0
- package/dist/components/hud/telemetry/RadiusVisualizer.d.ts +63 -0
- package/dist/components/hud/telemetry/RadiusVisualizer.d.ts.map +1 -0
- package/dist/components/hud/telemetry/RadiusVisualizer.js +139 -0
- package/dist/components/hud/telemetry/RadiusVisualizer.js.map +1 -0
- package/dist/components/hud/telemetry/RadiusVisualizerPanel.d.ts +31 -0
- package/dist/components/hud/telemetry/RadiusVisualizerPanel.d.ts.map +1 -0
- package/dist/components/hud/telemetry/RadiusVisualizerPanel.js +37 -0
- package/dist/components/hud/telemetry/RadiusVisualizerPanel.js.map +1 -0
- package/dist/components/hud/telemetry/ShipRudderVisualizer.d.ts +43 -0
- package/dist/components/hud/telemetry/ShipRudderVisualizer.d.ts.map +1 -0
- package/dist/components/hud/telemetry/ShipRudderVisualizer.js +121 -0
- package/dist/components/hud/telemetry/ShipRudderVisualizer.js.map +1 -0
- package/dist/components/hud/telemetry/ShipRudderVisualizerPanel.d.ts +26 -0
- package/dist/components/hud/telemetry/ShipRudderVisualizerPanel.d.ts.map +1 -0
- package/dist/components/hud/telemetry/ShipRudderVisualizerPanel.js +29 -0
- package/dist/components/hud/telemetry/ShipRudderVisualizerPanel.js.map +1 -0
- package/dist/components/hud/telemetry/SignalLog.d.ts +7 -0
- package/dist/components/hud/telemetry/SignalLog.d.ts.map +1 -0
- package/dist/components/hud/telemetry/SignalLog.js +28 -0
- package/dist/components/hud/telemetry/SignalLog.js.map +1 -0
- package/dist/components/hud/telemetry/SignalStrength.d.ts +9 -0
- package/dist/components/hud/telemetry/SignalStrength.d.ts.map +1 -0
- package/dist/components/hud/telemetry/SignalStrength.js +53 -0
- package/dist/components/hud/telemetry/SignalStrength.js.map +1 -0
- package/dist/components/hud/telemetry/Speedometer.d.ts +2 -0
- package/dist/components/hud/telemetry/Speedometer.d.ts.map +1 -0
- package/dist/components/hud/telemetry/Speedometer.js +70 -0
- package/dist/components/hud/telemetry/Speedometer.js.map +1 -0
- package/dist/components/hud/telemetry/Task.d.ts +2 -0
- package/dist/components/hud/telemetry/Task.d.ts.map +1 -0
- package/dist/components/hud/telemetry/Task.js +61 -0
- package/dist/components/hud/telemetry/Task.js.map +1 -0
- package/dist/components/hud/telemetry/TaskData.d.ts +2 -0
- package/dist/components/hud/telemetry/TaskData.d.ts.map +1 -0
- package/dist/components/hud/telemetry/TaskData.js +62 -0
- package/dist/components/hud/telemetry/TaskData.js.map +1 -0
- package/dist/components/hud/telemetry/index.d.ts +40 -0
- package/dist/components/hud/telemetry/index.d.ts.map +1 -0
- package/dist/components/hud/telemetry/index.js +40 -0
- package/dist/components/hud/telemetry/index.js.map +1 -0
- package/dist/components/hud/telemetry/powerColor.d.ts +16 -0
- package/dist/components/hud/telemetry/powerColor.d.ts.map +1 -0
- package/dist/components/hud/telemetry/powerColor.js +15 -0
- package/dist/components/hud/telemetry/powerColor.js.map +1 -0
- package/dist/components/scenes/MappingScene.d.ts +19 -0
- package/dist/components/scenes/MappingScene.d.ts.map +1 -0
- package/dist/components/scenes/MappingScene.js +353 -0
- package/dist/components/scenes/MappingScene.js.map +1 -0
- package/dist/components/scenes/SceneCanvas.d.ts +96 -0
- package/dist/components/scenes/SceneCanvas.d.ts.map +1 -0
- package/dist/components/scenes/SceneCanvas.js +151 -0
- package/dist/components/scenes/SceneCanvas.js.map +1 -0
- package/dist/components/scenes/SceneRenderer.d.ts +16 -0
- package/dist/components/scenes/SceneRenderer.d.ts.map +1 -0
- package/dist/components/scenes/SceneRenderer.js +60 -0
- package/dist/components/scenes/SceneRenderer.js.map +1 -0
- package/dist/components/scenes/TelemetryScene.d.ts +6 -0
- package/dist/components/scenes/TelemetryScene.d.ts.map +1 -0
- package/dist/components/scenes/TelemetryScene.js +6 -0
- package/dist/components/scenes/TelemetryScene.js.map +1 -0
- package/dist/components/svg/CompassRose.d.ts +129 -0
- package/dist/components/svg/CompassRose.d.ts.map +1 -0
- package/dist/components/svg/CompassRose.js +221 -0
- package/dist/components/svg/CompassRose.js.map +1 -0
- package/dist/connection/config.d.ts +41 -0
- package/dist/connection/config.d.ts.map +1 -0
- package/dist/connection/config.js +44 -0
- package/dist/connection/config.js.map +1 -0
- package/dist/contexts/SceneContext.d.ts +35 -0
- package/dist/contexts/SceneContext.d.ts.map +1 -0
- package/dist/contexts/SceneContext.js +24 -0
- package/dist/contexts/SceneContext.js.map +1 -0
- package/dist/hooks/useAutoPathAnimation.d.ts +22 -0
- package/dist/hooks/useAutoPathAnimation.d.ts.map +1 -0
- package/dist/hooks/useAutoPathAnimation.js +102 -0
- package/dist/hooks/useAutoPathAnimation.js.map +1 -0
- package/dist/hooks/useLayoutConfig.d.ts +29 -0
- package/dist/hooks/useLayoutConfig.d.ts.map +1 -0
- package/dist/hooks/useLayoutConfig.js +30 -0
- package/dist/hooks/useLayoutConfig.js.map +1 -0
- package/dist/hooks/useSceneContext.d.ts +64 -0
- package/dist/hooks/useSceneContext.d.ts.map +1 -0
- package/dist/hooks/useSceneContext.js +37 -0
- package/dist/hooks/useSceneContext.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/TelemetryProvider.d.ts +27 -0
- package/dist/providers/TelemetryProvider.d.ts.map +1 -0
- package/dist/providers/TelemetryProvider.js +50 -0
- package/dist/providers/TelemetryProvider.js.map +1 -0
- package/dist/providers/TelemetryThemeProvider.d.ts +25 -0
- package/dist/providers/TelemetryThemeProvider.d.ts.map +1 -0
- package/dist/providers/TelemetryThemeProvider.js +54 -0
- package/dist/providers/TelemetryThemeProvider.js.map +1 -0
- package/dist/store/actions/connectionActions.d.ts +39 -0
- package/dist/store/actions/connectionActions.d.ts.map +1 -0
- package/dist/store/actions/connectionActions.js +162 -0
- package/dist/store/actions/connectionActions.js.map +1 -0
- package/dist/store/actions/fetchTelemetry.d.ts +51 -0
- package/dist/store/actions/fetchTelemetry.d.ts.map +1 -0
- package/dist/store/actions/fetchTelemetry.js +135 -0
- package/dist/store/actions/fetchTelemetry.js.map +1 -0
- package/dist/store/index.d.ts +23 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +22 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/slices/connectionSlice.d.ts +15 -0
- package/dist/store/slices/connectionSlice.d.ts.map +1 -0
- package/dist/store/slices/connectionSlice.js +39 -0
- package/dist/store/slices/connectionSlice.js.map +1 -0
- package/dist/store/slices/discoveredGridSlice.d.ts +168 -0
- package/dist/store/slices/discoveredGridSlice.d.ts.map +1 -0
- package/dist/store/slices/discoveredGridSlice.js +146 -0
- package/dist/store/slices/discoveredGridSlice.js.map +1 -0
- package/dist/store/slices/sceneSlice.d.ts +185 -0
- package/dist/store/slices/sceneSlice.d.ts.map +1 -0
- package/dist/store/slices/sceneSlice.js +95 -0
- package/dist/store/slices/sceneSlice.js.map +1 -0
- package/dist/store/slices/simulationSlice.d.ts +87 -0
- package/dist/store/slices/simulationSlice.d.ts.map +1 -0
- package/dist/store/slices/simulationSlice.js +55 -0
- package/dist/store/slices/simulationSlice.js.map +1 -0
- package/dist/store/slices/telemetrySlice.d.ts +10 -0
- package/dist/store/slices/telemetrySlice.d.ts.map +1 -0
- package/dist/store/slices/telemetrySlice.js +88 -0
- package/dist/store/slices/telemetrySlice.js.map +1 -0
- package/dist/store/slices/videoSlice.d.ts +12 -0
- package/dist/store/slices/videoSlice.d.ts.map +1 -0
- package/dist/store/slices/videoSlice.js +27 -0
- package/dist/store/slices/videoSlice.js.map +1 -0
- package/dist/store/slices/visualizationSlice.d.ts +152 -0
- package/dist/store/slices/visualizationSlice.d.ts.map +1 -0
- package/dist/store/slices/visualizationSlice.js +58 -0
- package/dist/store/slices/visualizationSlice.js.map +1 -0
- package/dist/store/store.d.ts +61 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +78 -0
- package/dist/store/store.js.map +1 -0
- package/dist/theme/index.d.ts +14 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +14 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/lightTheme.d.ts +151 -0
- package/dist/theme/lightTheme.d.ts.map +1 -0
- package/dist/theme/lightTheme.js +194 -0
- package/dist/theme/lightTheme.js.map +1 -0
- package/dist/theme/telemetryTheme.d.ts +90 -0
- package/dist/theme/telemetryTheme.d.ts.map +1 -0
- package/dist/theme/telemetryTheme.js +157 -0
- package/dist/theme/telemetryTheme.js.map +1 -0
- package/dist/types/detectedObjectsTypes.d.ts +18 -0
- package/dist/types/detectedObjectsTypes.d.ts.map +1 -0
- package/dist/types/detectedObjectsTypes.js +8 -0
- package/dist/types/detectedObjectsTypes.js.map +1 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +16 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/ros.d.ts +87 -0
- package/dist/types/ros.d.ts.map +1 -0
- package/dist/types/ros.js +17 -0
- package/dist/types/ros.js.map +1 -0
- package/dist/types/statusTypes.d.ts +81 -0
- package/dist/types/statusTypes.d.ts.map +1 -0
- package/dist/types/statusTypes.js +52 -0
- package/dist/types/statusTypes.js.map +1 -0
- package/dist/types/taskTypes.d.ts +65 -0
- package/dist/types/taskTypes.d.ts.map +1 -0
- package/dist/types/taskTypes.js +18 -0
- package/dist/types/taskTypes.js.map +1 -0
- package/dist/types/telemetryInterfaces.d.ts +81 -0
- package/dist/types/telemetryInterfaces.d.ts.map +1 -0
- package/dist/types/telemetryInterfaces.js +30 -0
- package/dist/types/telemetryInterfaces.js.map +1 -0
- package/dist/utils/basestation.d.ts +7 -0
- package/dist/utils/basestation.d.ts.map +1 -0
- package/dist/utils/basestation.js +49 -0
- package/dist/utils/basestation.js.map +1 -0
- package/dist/utils/batteryUtil.d.ts +8 -0
- package/dist/utils/batteryUtil.d.ts.map +1 -0
- package/dist/utils/batteryUtil.js +32 -0
- package/dist/utils/batteryUtil.js.map +1 -0
- package/dist/utils/telemetry/index.d.ts +13 -0
- package/dist/utils/telemetry/index.d.ts.map +1 -0
- package/dist/utils/telemetry/index.js +13 -0
- package/dist/utils/telemetry/index.js.map +1 -0
- package/dist/utils/telemetry/telemetryFactory.d.ts +48 -0
- package/dist/utils/telemetry/telemetryFactory.d.ts.map +1 -0
- package/dist/utils/telemetry/telemetryFactory.js +390 -0
- package/dist/utils/telemetry/telemetryFactory.js.map +1 -0
- package/package.json +91 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file discoveredGridSlice.ts
|
|
3
|
+
* @description Redux slice managing AoE-style discovery state for the global grid.
|
|
4
|
+
*
|
|
5
|
+
* Three cell states at GLOBAL_CELL_SIZE (20×20) precision:
|
|
6
|
+
* 0 UNKNOWN — never seen; global grid cell hidden behind full fog
|
|
7
|
+
* 1 VISIBLE — vessel currently nearby; obstacle shown at full brightness, no fog
|
|
8
|
+
* 2 VISITED — vessel was here; obstacle shown dimly, fog haze applied
|
|
9
|
+
*
|
|
10
|
+
* Also tracks obstacleOverrides: cells the fineGrid (local sensor scan) has confirmed
|
|
11
|
+
* as occupied, independent of what the basestation occupancyGrid knows.
|
|
12
|
+
*
|
|
13
|
+
* @author Carson Fujita
|
|
14
|
+
* @license MIT
|
|
15
|
+
*/
|
|
16
|
+
import { type PayloadAction } from '@reduxjs/toolkit';
|
|
17
|
+
export type DiscoveryCellState = 0 | 1 | 2;
|
|
18
|
+
/**
|
|
19
|
+
* @interface DiscoveredGridState
|
|
20
|
+
* @description Represents the state of the discovered grid in the Redux store.
|
|
21
|
+
* @property {DiscoveryCellState[]} cells - Flat row-major array of cell states. Index = row * gridWidth + col. Length = gridWidth * gridHeight = 400.
|
|
22
|
+
* @property {number[]} visibleIndices - Flat indices of cells currently in state 1 (VISIBLE). Used to keep demote O(N_visible) not O(400).
|
|
23
|
+
* @property {boolean[]} obstacleOverrides - Flat row-major array of cells the local sensor scan has confirmed as occupied obstacles. Permanent.
|
|
24
|
+
* @property {number} gridWidth - Width of the global grid in cells.
|
|
25
|
+
* @property {number} gridHeight - Height of the global grid in cells.
|
|
26
|
+
* @property {number} revealRadius - Reveal radius in global cell units (Chebyshev / square metric). Default 2.
|
|
27
|
+
* @remarks
|
|
28
|
+
* The discovered grid state is used to manage the visibility and discovery of cells in the global grid. It tracks which cells have been seen by the vessel, which are currently visible, and which have been confirmed as obstacles. The reveal radius determines how many cells around the vessel's position are revealed when it moves.
|
|
29
|
+
*/
|
|
30
|
+
export interface DiscoveredGridState {
|
|
31
|
+
/** Flat row-major array: index = row * gridWidth + col. Length = gridWidth * gridHeight = 400. */
|
|
32
|
+
cells: DiscoveryCellState[];
|
|
33
|
+
/** Flat indices of cells currently in state 1 (VISIBLE). Used to keep demote O(N_visible) not O(400). */
|
|
34
|
+
visibleIndices: number[];
|
|
35
|
+
/** Flat row-major array: cells the local sensor scan has confirmed as occupied obstacles. Permanent. */
|
|
36
|
+
obstacleOverrides: boolean[];
|
|
37
|
+
gridWidth: number;
|
|
38
|
+
gridHeight: number;
|
|
39
|
+
/** Reveal radius in global cell units (Chebyshev / square metric). Default 2. */
|
|
40
|
+
revealRadius: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @constant discoveredGridSlice
|
|
44
|
+
* @description Redux slice for managing the discovered grid state.
|
|
45
|
+
* @see {@link DiscoveredGridState} for the structure of the state.
|
|
46
|
+
* @remarks
|
|
47
|
+
* This slice provides actions and reducers to manage the discovery state of the global grid.
|
|
48
|
+
* It includes actions to reveal cells around a position, promote obstacles, reveal all known cells, reset discovery state,
|
|
49
|
+
* and set the reveal radius. The slice also includes selectors to access the discovered cells, grid width, obstacle overrides,
|
|
50
|
+
* and reveal radius from the Redux store.
|
|
51
|
+
*/
|
|
52
|
+
export declare const discoveredGridSlice: import("@reduxjs/toolkit").Slice<DiscoveredGridState, {
|
|
53
|
+
/**
|
|
54
|
+
* Reveal global cells within `revealRadius` of the given global cell position.
|
|
55
|
+
* Previously VISIBLE cells outside the new radius are demoted to VISITED.
|
|
56
|
+
*/
|
|
57
|
+
revealGlobalAroundPosition(state: {
|
|
58
|
+
cells: DiscoveryCellState[];
|
|
59
|
+
visibleIndices: number[];
|
|
60
|
+
obstacleOverrides: boolean[];
|
|
61
|
+
gridWidth: number;
|
|
62
|
+
gridHeight: number;
|
|
63
|
+
revealRadius: number;
|
|
64
|
+
}, action: PayloadAction<{
|
|
65
|
+
col: number;
|
|
66
|
+
row: number;
|
|
67
|
+
}>): void;
|
|
68
|
+
/**
|
|
69
|
+
* Mark global cells as having a confirmed obstacle from the fineGrid sensor scan.
|
|
70
|
+
* Permanent — survives until resetDiscovery is called.
|
|
71
|
+
*/
|
|
72
|
+
bulkPromoteObstacles(state: {
|
|
73
|
+
cells: DiscoveryCellState[];
|
|
74
|
+
visibleIndices: number[];
|
|
75
|
+
obstacleOverrides: boolean[];
|
|
76
|
+
gridWidth: number;
|
|
77
|
+
gridHeight: number;
|
|
78
|
+
revealRadius: number;
|
|
79
|
+
}, action: PayloadAction<{
|
|
80
|
+
cols: number[];
|
|
81
|
+
rows: number[];
|
|
82
|
+
}>): void;
|
|
83
|
+
/**
|
|
84
|
+
* Reveal all cells listed by basestation occupancy data (live mode).
|
|
85
|
+
* UNKNOWN cells are upgraded to VISIBLE; VISITED cells are left as-is.
|
|
86
|
+
*/
|
|
87
|
+
revealAllKnownCells(state: {
|
|
88
|
+
cells: DiscoveryCellState[];
|
|
89
|
+
visibleIndices: number[];
|
|
90
|
+
obstacleOverrides: boolean[];
|
|
91
|
+
gridWidth: number;
|
|
92
|
+
gridHeight: number;
|
|
93
|
+
revealRadius: number;
|
|
94
|
+
}, action: PayloadAction<{
|
|
95
|
+
cols: number[];
|
|
96
|
+
rows: number[];
|
|
97
|
+
}>): void;
|
|
98
|
+
/** Reset all discovery state. Call on map regeneration. */
|
|
99
|
+
resetDiscovery(state: {
|
|
100
|
+
cells: DiscoveryCellState[];
|
|
101
|
+
visibleIndices: number[];
|
|
102
|
+
obstacleOverrides: boolean[];
|
|
103
|
+
gridWidth: number;
|
|
104
|
+
gridHeight: number;
|
|
105
|
+
revealRadius: number;
|
|
106
|
+
}): void;
|
|
107
|
+
setRevealRadius(state: {
|
|
108
|
+
cells: DiscoveryCellState[];
|
|
109
|
+
visibleIndices: number[];
|
|
110
|
+
obstacleOverrides: boolean[];
|
|
111
|
+
gridWidth: number;
|
|
112
|
+
gridHeight: number;
|
|
113
|
+
revealRadius: number;
|
|
114
|
+
}, action: PayloadAction<number>): void;
|
|
115
|
+
}, "discoveredGrid", "discoveredGrid", import("@reduxjs/toolkit").SliceSelectors<DiscoveredGridState>>;
|
|
116
|
+
export declare const revealGlobalAroundPosition: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
117
|
+
col: number;
|
|
118
|
+
row: number;
|
|
119
|
+
}, "discoveredGrid/revealGlobalAroundPosition">, bulkPromoteObstacles: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
120
|
+
cols: number[];
|
|
121
|
+
rows: number[];
|
|
122
|
+
}, "discoveredGrid/bulkPromoteObstacles">, revealAllKnownCells: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
123
|
+
cols: number[];
|
|
124
|
+
rows: number[];
|
|
125
|
+
}, "discoveredGrid/revealAllKnownCells">, resetDiscovery: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"discoveredGrid/resetDiscovery">, setRevealRadius: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "discoveredGrid/setRevealRadius">;
|
|
126
|
+
type WithDiscoveredGrid = {
|
|
127
|
+
discoveredGrid: DiscoveredGridState;
|
|
128
|
+
};
|
|
129
|
+
export declare const selectDiscoveredCells: (state: WithDiscoveredGrid) => DiscoveryCellState[];
|
|
130
|
+
export declare const selectDiscoveredGridWidth: (state: WithDiscoveredGrid) => number;
|
|
131
|
+
export declare const selectObstacleOverrides: (state: WithDiscoveredGrid) => boolean[];
|
|
132
|
+
export declare const selectDiscoveryRevealRadius: (state: WithDiscoveredGrid) => number;
|
|
133
|
+
/**
|
|
134
|
+
* @function selectDiscoveryLookup
|
|
135
|
+
* @description Creates a stable lookup function to access the discovery state of individual cells.
|
|
136
|
+
* @param {DiscoveryCellState[]} cells - Flat row-major array of cell states from the Redux store.
|
|
137
|
+
* @param {number} W - Width of the global grid in cells.
|
|
138
|
+
* @returns {(col: number, row: number) => DiscoveryCellState} A function that takes column and row indices and returns the corresponding cell state.
|
|
139
|
+
* @remarks
|
|
140
|
+
* This selector uses `createSelector` to memoize the lookup function, ensuring that it only recomputes when the `cells` or `gridWidth` change. The returned function allows components to easily query the discovery state of specific cells in the global grid.
|
|
141
|
+
* @example
|
|
142
|
+
* const lookup = selectDiscoveryLookup(state.discoveredGrid.cells, state.discoveredGrid.gridWidth);
|
|
143
|
+
* const cellState = lookup(5, 10); // Get the discovery state of the cell at column 5, row 10.
|
|
144
|
+
*/
|
|
145
|
+
export declare const selectDiscoveryLookup: ((state: WithDiscoveredGrid) => (col: number, row: number) => DiscoveryCellState) & {
|
|
146
|
+
clearCache: () => void;
|
|
147
|
+
resultsCount: () => number;
|
|
148
|
+
resetResultsCount: () => void;
|
|
149
|
+
} & {
|
|
150
|
+
resultFunc: (resultFuncArgs_0: DiscoveryCellState[], resultFuncArgs_1: number) => (col: number, row: number) => DiscoveryCellState;
|
|
151
|
+
memoizedResultFunc: ((resultFuncArgs_0: DiscoveryCellState[], resultFuncArgs_1: number) => (col: number, row: number) => DiscoveryCellState) & {
|
|
152
|
+
clearCache: () => void;
|
|
153
|
+
resultsCount: () => number;
|
|
154
|
+
resetResultsCount: () => void;
|
|
155
|
+
};
|
|
156
|
+
lastResult: () => (col: number, row: number) => DiscoveryCellState;
|
|
157
|
+
dependencies: [(state: WithDiscoveredGrid) => DiscoveryCellState[], (state: WithDiscoveredGrid) => number];
|
|
158
|
+
recomputations: () => number;
|
|
159
|
+
resetRecomputations: () => void;
|
|
160
|
+
dependencyRecomputations: () => number;
|
|
161
|
+
resetDependencyRecomputations: () => void;
|
|
162
|
+
} & {
|
|
163
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
164
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
165
|
+
};
|
|
166
|
+
declare const _default: import("redux").Reducer<DiscoveredGridState>;
|
|
167
|
+
export default _default;
|
|
168
|
+
//# sourceMappingURL=discoveredGridSlice.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;sBAEJ,MAAM;eAkHe,aAAa,CAAC,MAAM,CAAC;sGAI1D,CAAC;AAEH,eAAO,MACH,0BAA0B;SAtEyC,MAAM;SAAO,MAAM;iDAuEtF,oBAAoB;UAzC0C,MAAM,EAAE;UAAQ,MAAM,EAAE;2CA0CtF,mBAAmB;UA3B0C,MAAM,EAAE;UAAQ,MAAM,EAAE;0CA4BrF,cAAc,2FACd,eAAe,+FACY,CAAC;AAGhC,KAAK,kBAAkB,GAAG;IAAE,cAAc,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAClE,eAAO,MAAM,qBAAqB,GAAU,OAAO,kBAAkB,yBAA+B,CAAC;AACrG,eAAO,MAAM,yBAAyB,GAAM,OAAO,kBAAkB,WAAmC,CAAC;AACzG,eAAO,MAAM,uBAAuB,GAAQ,OAAO,kBAAkB,cAA2C,CAAC;AACjH,eAAO,MAAM,2BAA2B,GAAI,OAAO,kBAAkB,WAAsC,CAAC;AAE5G;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,wCAGpB,MAAM,OAAO,MAAM,KAAG,kBAAkB;;;;;4FAAxC,MAAM,OAAO,MAAM,KAAG,kBAAkB;qGAAxC,MAAM,OAAO,MAAM,KAAG,kBAAkB;;;;;4BAAxC,MAAM,OAAO,MAAM,KAAG,kBAAkB;2BApBH,kBAAkB,mCAClB,kBAAkB;;;;;;;;CAqBpE,CAAC;;AAEF,wBAA2C"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file discoveredGridSlice.ts
|
|
3
|
+
* @description Redux slice managing AoE-style discovery state for the global grid.
|
|
4
|
+
*
|
|
5
|
+
* Three cell states at GLOBAL_CELL_SIZE (20×20) precision:
|
|
6
|
+
* 0 UNKNOWN — never seen; global grid cell hidden behind full fog
|
|
7
|
+
* 1 VISIBLE — vessel currently nearby; obstacle shown at full brightness, no fog
|
|
8
|
+
* 2 VISITED — vessel was here; obstacle shown dimly, fog haze applied
|
|
9
|
+
*
|
|
10
|
+
* Also tracks obstacleOverrides: cells the fineGrid (local sensor scan) has confirmed
|
|
11
|
+
* as occupied, independent of what the basestation occupancyGrid knows.
|
|
12
|
+
*
|
|
13
|
+
* @author Carson Fujita
|
|
14
|
+
* @license MIT
|
|
15
|
+
*/
|
|
16
|
+
import { createSlice, createSelector } from '@reduxjs/toolkit';
|
|
17
|
+
import { GLOBAL_GRID_SIZE } from '../../types';
|
|
18
|
+
/**
|
|
19
|
+
* @constant W
|
|
20
|
+
* @description Width of the global grid in cells. Equal to GLOBAL_GRID_SIZE.
|
|
21
|
+
*/
|
|
22
|
+
const W = GLOBAL_GRID_SIZE;
|
|
23
|
+
/**
|
|
24
|
+
* @constant H
|
|
25
|
+
* @description Height of the global grid in cells. Equal to GLOBAL_GRID_SIZE.
|
|
26
|
+
*/
|
|
27
|
+
const H = GLOBAL_GRID_SIZE;
|
|
28
|
+
/**
|
|
29
|
+
* @constant initialState
|
|
30
|
+
* @description Initial state of the discovered grid slice.
|
|
31
|
+
* @type {DiscoveredGridState}
|
|
32
|
+
* @remarks
|
|
33
|
+
* The initial state sets all cells to UNKNOWN (0), with no visible indices and no obstacle overrides. The grid width and height are set to the global grid size, and the reveal radius is initialized to 1.
|
|
34
|
+
* This state is used when the application first loads or when the discovery state is reset.
|
|
35
|
+
* @see {@link DiscoveredGridState} for the structure of the state.
|
|
36
|
+
*/
|
|
37
|
+
const initialState = {
|
|
38
|
+
cells: Array(W * H).fill(0),
|
|
39
|
+
visibleIndices: [],
|
|
40
|
+
obstacleOverrides: Array(W * H).fill(false),
|
|
41
|
+
gridWidth: W,
|
|
42
|
+
gridHeight: H,
|
|
43
|
+
revealRadius: 1,
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* @constant discoveredGridSlice
|
|
47
|
+
* @description Redux slice for managing the discovered grid state.
|
|
48
|
+
* @see {@link DiscoveredGridState} for the structure of the state.
|
|
49
|
+
* @remarks
|
|
50
|
+
* This slice provides actions and reducers to manage the discovery state of the global grid.
|
|
51
|
+
* It includes actions to reveal cells around a position, promote obstacles, reveal all known cells, reset discovery state,
|
|
52
|
+
* and set the reveal radius. The slice also includes selectors to access the discovered cells, grid width, obstacle overrides,
|
|
53
|
+
* and reveal radius from the Redux store.
|
|
54
|
+
*/
|
|
55
|
+
export const discoveredGridSlice = createSlice({
|
|
56
|
+
name: 'discoveredGrid',
|
|
57
|
+
initialState,
|
|
58
|
+
reducers: {
|
|
59
|
+
/**
|
|
60
|
+
* Reveal global cells within `revealRadius` of the given global cell position.
|
|
61
|
+
* Previously VISIBLE cells outside the new radius are demoted to VISITED.
|
|
62
|
+
*/
|
|
63
|
+
revealGlobalAroundPosition(state, action) {
|
|
64
|
+
const { col, row } = action.payload;
|
|
65
|
+
const r = state.revealRadius;
|
|
66
|
+
const W = state.gridWidth;
|
|
67
|
+
const H = state.gridHeight;
|
|
68
|
+
// Demote only tracked VISIBLE cells — O(N_visible) not O(400).
|
|
69
|
+
for (const idx of state.visibleIndices) {
|
|
70
|
+
if (state.cells[idx] === 1)
|
|
71
|
+
state.cells[idx] = 2;
|
|
72
|
+
}
|
|
73
|
+
// Promote cells in reveal square to VISIBLE and track for next demote.
|
|
74
|
+
const newVisible = [];
|
|
75
|
+
for (let dr = -r; dr <= r; dr++) {
|
|
76
|
+
for (let dc = -r; dc <= r; dc++) {
|
|
77
|
+
const nr = row + dr;
|
|
78
|
+
const nc = col + dc;
|
|
79
|
+
if (nr < 0 || nr >= H || nc < 0 || nc >= W)
|
|
80
|
+
continue;
|
|
81
|
+
const idx = nr * W + nc;
|
|
82
|
+
state.cells[idx] = 1;
|
|
83
|
+
newVisible.push(idx);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
state.visibleIndices = newVisible;
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* Mark global cells as having a confirmed obstacle from the fineGrid sensor scan.
|
|
90
|
+
* Permanent — survives until resetDiscovery is called.
|
|
91
|
+
*/
|
|
92
|
+
bulkPromoteObstacles(state, action) {
|
|
93
|
+
const { cols, rows } = action.payload;
|
|
94
|
+
const W = state.gridWidth;
|
|
95
|
+
for (let i = 0; i < cols.length; i++) {
|
|
96
|
+
const idx = rows[i] * W + cols[i];
|
|
97
|
+
if (idx >= 0 && idx < state.obstacleOverrides.length) {
|
|
98
|
+
state.obstacleOverrides[idx] = true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Reveal all cells listed by basestation occupancy data (live mode).
|
|
104
|
+
* UNKNOWN cells are upgraded to VISIBLE; VISITED cells are left as-is.
|
|
105
|
+
*/
|
|
106
|
+
revealAllKnownCells(state, action) {
|
|
107
|
+
const { cols, rows } = action.payload;
|
|
108
|
+
const W = state.gridWidth;
|
|
109
|
+
for (let i = 0; i < cols.length; i++) {
|
|
110
|
+
const idx = rows[i] * W + cols[i];
|
|
111
|
+
if (idx >= 0 && idx < state.cells.length && state.cells[idx] === 0) {
|
|
112
|
+
state.cells[idx] = 1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
/** Reset all discovery state. Call on map regeneration. */
|
|
117
|
+
resetDiscovery(state) {
|
|
118
|
+
state.cells = Array(state.gridWidth * state.gridHeight).fill(0);
|
|
119
|
+
state.visibleIndices = [];
|
|
120
|
+
state.obstacleOverrides = Array(state.gridWidth * state.gridHeight).fill(false);
|
|
121
|
+
},
|
|
122
|
+
setRevealRadius(state, action) {
|
|
123
|
+
state.revealRadius = Math.max(1, Math.min(action.payload, 5));
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
export const { revealGlobalAroundPosition, bulkPromoteObstacles, revealAllKnownCells, resetDiscovery, setRevealRadius, } = discoveredGridSlice.actions;
|
|
128
|
+
export const selectDiscoveredCells = (state) => state.discoveredGrid.cells;
|
|
129
|
+
export const selectDiscoveredGridWidth = (state) => state.discoveredGrid.gridWidth;
|
|
130
|
+
export const selectObstacleOverrides = (state) => state.discoveredGrid.obstacleOverrides;
|
|
131
|
+
export const selectDiscoveryRevealRadius = (state) => state.discoveredGrid.revealRadius;
|
|
132
|
+
/**
|
|
133
|
+
* @function selectDiscoveryLookup
|
|
134
|
+
* @description Creates a stable lookup function to access the discovery state of individual cells.
|
|
135
|
+
* @param {DiscoveryCellState[]} cells - Flat row-major array of cell states from the Redux store.
|
|
136
|
+
* @param {number} W - Width of the global grid in cells.
|
|
137
|
+
* @returns {(col: number, row: number) => DiscoveryCellState} A function that takes column and row indices and returns the corresponding cell state.
|
|
138
|
+
* @remarks
|
|
139
|
+
* This selector uses `createSelector` to memoize the lookup function, ensuring that it only recomputes when the `cells` or `gridWidth` change. The returned function allows components to easily query the discovery state of specific cells in the global grid.
|
|
140
|
+
* @example
|
|
141
|
+
* const lookup = selectDiscoveryLookup(state.discoveredGrid.cells, state.discoveredGrid.gridWidth);
|
|
142
|
+
* const cellState = lookup(5, 10); // Get the discovery state of the cell at column 5, row 10.
|
|
143
|
+
*/
|
|
144
|
+
export const selectDiscoveryLookup = createSelector([selectDiscoveredCells, selectDiscoveredGridWidth], (cells, W) => (col, row) => (cells[row * W + col] ?? 0));
|
|
145
|
+
export default discoveredGridSlice.reducer;
|
|
146
|
+
//# sourceMappingURL=discoveredGridSlice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoveredGridSlice.js","sourceRoot":"","sources":["../../../src/store/slices/discoveredGridSlice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA6B/C;;;GAGG;AACH,MAAM,CAAC,GAAG,gBAAgB,CAAC;AAE3B;;;GAGG;AACH,MAAM,CAAC,GAAG,gBAAgB,CAAC;AAE3B;;;;;;;;GAQG;AACH,MAAM,YAAY,GAAwB;IACtC,KAAK,EAAE,KAAK,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AO,CAAC,KAAyB,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC;AACjH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,KAAyB,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC;AAE5G;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAC/C,CAAC,qBAAqB,EAAE,yBAAyB,CAAC,EAClD,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CACT,CAAC,GAAW,EAAE,GAAW,EAAsB,EAAE,CAC7C,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAuB,CAC5D,CAAC;AAEF,eAAe,mBAAmB,CAAC,OAAO,CAAC"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file sceneSlice.ts
|
|
3
|
+
* @description Redux slice for the scene registry and event log. Tracks the active
|
|
4
|
+
* visualizer scene (mapping vs forces), registered scene descriptors, and a capped
|
|
5
|
+
* log of recent scene events (objective reached, map regenerated, etc.).
|
|
6
|
+
*
|
|
7
|
+
* @author Carson Fujita
|
|
8
|
+
* @license MIT
|
|
9
|
+
*/
|
|
10
|
+
import { type PayloadAction } from '@reduxjs/toolkit';
|
|
11
|
+
export type SceneId = 'mapping' | 'forces';
|
|
12
|
+
/**
|
|
13
|
+
* @type SceneEventType
|
|
14
|
+
* @description Enumerates the types of scene events that can be logged in the Redux store.
|
|
15
|
+
* @remarks
|
|
16
|
+
* The scene event types include:
|
|
17
|
+
* - 'OBJECTIVE_REACHED': An objective has been reached in the scene.
|
|
18
|
+
* - 'SCENE_CHANGED': The active scene has changed.
|
|
19
|
+
* - 'ENTITY_SPAWNED': A new entity has been spawned in the scene.
|
|
20
|
+
* - 'ENTITY_REMOVED': An entity has been removed from the scene.
|
|
21
|
+
* - 'MAP_REGENERATED': The map has been regenerated.
|
|
22
|
+
* - 'CONNECTION_CHANGED': The connection status has changed.
|
|
23
|
+
* - 'FOG_RESET': The fog of war has been reset.
|
|
24
|
+
*/
|
|
25
|
+
export type SceneEventType = 'OBJECTIVE_REACHED' | 'SCENE_CHANGED' | 'ENTITY_SPAWNED' | 'ENTITY_REMOVED' | 'MAP_REGENERATED' | 'CONNECTION_CHANGED' | 'FOG_RESET';
|
|
26
|
+
/**
|
|
27
|
+
* @interface SceneEvent
|
|
28
|
+
* @description Represents an event that occurs within a scene, to be logged in the Redux store.
|
|
29
|
+
* @property {string} id - A unique identifier for the event, generated using `crypto.randomUUID()`.
|
|
30
|
+
* @property {SceneEventType} type - The type of the event, as defined in {@link SceneEventType}.
|
|
31
|
+
* @property {SceneId} sceneId - The identifier of the scene where the event occurred.
|
|
32
|
+
* @property {number} timestamp - The timestamp of when the event occurred, in milliseconds since the Unix epoch.
|
|
33
|
+
* @property {Record<string, unknown>} [payload] - An optional payload containing additional data relevant to the event.
|
|
34
|
+
* @remarks
|
|
35
|
+
* Scene events are used to track significant occurrences within a scene, such as changes in objectives, entity states, or map regeneration. The events are stored in a capped log to provide a history of recent activity without consuming excessive memory.
|
|
36
|
+
*/
|
|
37
|
+
export interface SceneEvent {
|
|
38
|
+
id: string;
|
|
39
|
+
type: SceneEventType;
|
|
40
|
+
sceneId: SceneId;
|
|
41
|
+
timestamp: number;
|
|
42
|
+
payload?: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @interface SceneDescriptor
|
|
46
|
+
* @description Describes a visualizer scene, including its identifier, display name, and tab index.
|
|
47
|
+
* @property {SceneId} id - The unique identifier for the scene (e.g., 'mapping', 'forces').
|
|
48
|
+
* @property {string} displayName - The human-readable name of the scene, used in the UI.
|
|
49
|
+
* @property {number} tabIndex - The legacy numeric index for the MUI Tabs value prop, used for tab navigation.
|
|
50
|
+
* @remarks
|
|
51
|
+
* Scene descriptors are registered in the Redux store to allow dynamic management of available scenes.
|
|
52
|
+
* Each descriptor provides essential information for rendering and navigating between scenes in the visualizer.
|
|
53
|
+
*/
|
|
54
|
+
export interface SceneDescriptor {
|
|
55
|
+
id: SceneId;
|
|
56
|
+
displayName: string;
|
|
57
|
+
/** Legacy numeric index for MUI Tabs value prop. */
|
|
58
|
+
tabIndex: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @interface SceneState
|
|
62
|
+
* @description Represents the state of the scene slice in the Redux store.
|
|
63
|
+
* @property {SceneDescriptor[]} registeredScenes - An array of registered scene descriptors.
|
|
64
|
+
* @property {SceneId} activeSceneId - The identifier of the currently active scene.
|
|
65
|
+
* @property {SceneEvent[]} recentEvents - A capped log of recent scene events, ordered by timestamp.
|
|
66
|
+
* @remarks
|
|
67
|
+
* The scene state is used to manage the available scenes in the visualizer, track which scene is currently active,
|
|
68
|
+
* and maintain a history of significant events that have occurred within the scenes. The recent events log is capped to
|
|
69
|
+
* prevent unbounded growth in memory usage.
|
|
70
|
+
*/
|
|
71
|
+
export interface SceneState {
|
|
72
|
+
registeredScenes: SceneDescriptor[];
|
|
73
|
+
activeSceneId: SceneId;
|
|
74
|
+
recentEvents: SceneEvent[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @constant sceneSlice
|
|
78
|
+
* @description Redux slice for managing the scene registry and event log.
|
|
79
|
+
* @see {@link SceneState} for the structure of the state.
|
|
80
|
+
* @remarks
|
|
81
|
+
* This slice provides actions and reducers to manage the registered scenes, active scene, and recent events in the visualizer.
|
|
82
|
+
* It includes actions to register new scenes, set the active scene, dispatch scene events, and clear the event log.
|
|
83
|
+
* The slice also includes selectors to access the active scene, registered scenes, recent events, and the active tab index for UI navigation.
|
|
84
|
+
*/
|
|
85
|
+
export declare const sceneSlice: import("@reduxjs/toolkit").Slice<SceneState, {
|
|
86
|
+
registerScene(state: {
|
|
87
|
+
registeredScenes: {
|
|
88
|
+
id: SceneId;
|
|
89
|
+
displayName: string;
|
|
90
|
+
tabIndex: number;
|
|
91
|
+
}[];
|
|
92
|
+
activeSceneId: SceneId;
|
|
93
|
+
recentEvents: {
|
|
94
|
+
id: string;
|
|
95
|
+
type: SceneEventType;
|
|
96
|
+
sceneId: SceneId;
|
|
97
|
+
timestamp: number;
|
|
98
|
+
payload?: {
|
|
99
|
+
[x: string]: unknown;
|
|
100
|
+
} | undefined;
|
|
101
|
+
}[];
|
|
102
|
+
}, action: PayloadAction<SceneDescriptor>): void;
|
|
103
|
+
setActiveScene(state: {
|
|
104
|
+
registeredScenes: {
|
|
105
|
+
id: SceneId;
|
|
106
|
+
displayName: string;
|
|
107
|
+
tabIndex: number;
|
|
108
|
+
}[];
|
|
109
|
+
activeSceneId: SceneId;
|
|
110
|
+
recentEvents: {
|
|
111
|
+
id: string;
|
|
112
|
+
type: SceneEventType;
|
|
113
|
+
sceneId: SceneId;
|
|
114
|
+
timestamp: number;
|
|
115
|
+
payload?: {
|
|
116
|
+
[x: string]: unknown;
|
|
117
|
+
} | undefined;
|
|
118
|
+
}[];
|
|
119
|
+
}, action: PayloadAction<SceneId>): void;
|
|
120
|
+
dispatchSceneEvent(state: {
|
|
121
|
+
registeredScenes: {
|
|
122
|
+
id: SceneId;
|
|
123
|
+
displayName: string;
|
|
124
|
+
tabIndex: number;
|
|
125
|
+
}[];
|
|
126
|
+
activeSceneId: SceneId;
|
|
127
|
+
recentEvents: {
|
|
128
|
+
id: string;
|
|
129
|
+
type: SceneEventType;
|
|
130
|
+
sceneId: SceneId;
|
|
131
|
+
timestamp: number;
|
|
132
|
+
payload?: {
|
|
133
|
+
[x: string]: unknown;
|
|
134
|
+
} | undefined;
|
|
135
|
+
}[];
|
|
136
|
+
}, action: PayloadAction<Omit<SceneEvent, "id" | "timestamp">>): void;
|
|
137
|
+
clearSceneEvents(state: {
|
|
138
|
+
registeredScenes: {
|
|
139
|
+
id: SceneId;
|
|
140
|
+
displayName: string;
|
|
141
|
+
tabIndex: number;
|
|
142
|
+
}[];
|
|
143
|
+
activeSceneId: SceneId;
|
|
144
|
+
recentEvents: {
|
|
145
|
+
id: string;
|
|
146
|
+
type: SceneEventType;
|
|
147
|
+
sceneId: SceneId;
|
|
148
|
+
timestamp: number;
|
|
149
|
+
payload?: {
|
|
150
|
+
[x: string]: unknown;
|
|
151
|
+
} | undefined;
|
|
152
|
+
}[];
|
|
153
|
+
}): void;
|
|
154
|
+
}, "scene", "scene", import("@reduxjs/toolkit").SliceSelectors<SceneState>>;
|
|
155
|
+
export declare const registerScene: import("@reduxjs/toolkit").ActionCreatorWithPayload<SceneDescriptor, "scene/registerScene">, setActiveScene: import("@reduxjs/toolkit").ActionCreatorWithPayload<SceneId, "scene/setActiveScene">, dispatchSceneEvent: import("@reduxjs/toolkit").ActionCreatorWithPayload<Omit<SceneEvent, "id" | "timestamp">, "scene/dispatchSceneEvent">, clearSceneEvents: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"scene/clearSceneEvents">;
|
|
156
|
+
type WithScene = {
|
|
157
|
+
scene: SceneState;
|
|
158
|
+
};
|
|
159
|
+
export declare const selectActiveScene: (state: WithScene) => SceneId;
|
|
160
|
+
export declare const selectRegisteredScenes: (state: WithScene) => SceneDescriptor[];
|
|
161
|
+
export declare const selectRecentEvents: (state: WithScene) => SceneEvent[];
|
|
162
|
+
export declare const selectActiveTabIndex: ((state: WithScene) => number) & {
|
|
163
|
+
clearCache: () => void;
|
|
164
|
+
resultsCount: () => number;
|
|
165
|
+
resetResultsCount: () => void;
|
|
166
|
+
} & {
|
|
167
|
+
resultFunc: (resultFuncArgs_0: SceneDescriptor[], resultFuncArgs_1: SceneId) => number;
|
|
168
|
+
memoizedResultFunc: ((resultFuncArgs_0: SceneDescriptor[], resultFuncArgs_1: SceneId) => number) & {
|
|
169
|
+
clearCache: () => void;
|
|
170
|
+
resultsCount: () => number;
|
|
171
|
+
resetResultsCount: () => void;
|
|
172
|
+
};
|
|
173
|
+
lastResult: () => number;
|
|
174
|
+
dependencies: [(state: WithScene) => SceneDescriptor[], (state: WithScene) => SceneId];
|
|
175
|
+
recomputations: () => number;
|
|
176
|
+
resetRecomputations: () => void;
|
|
177
|
+
dependencyRecomputations: () => number;
|
|
178
|
+
resetDependencyRecomputations: () => void;
|
|
179
|
+
} & {
|
|
180
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
181
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
182
|
+
};
|
|
183
|
+
declare const _default: import("redux").Reducer<SceneState>;
|
|
184
|
+
export default _default;
|
|
185
|
+
//# sourceMappingURL=sceneSlice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sceneSlice.d.ts","sourceRoot":"","sources":["../../../src/store/slices/sceneSlice.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAA+B,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEnF,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,GACpB,mBAAmB,GACnB,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,oBAAoB,GACpB,WAAW,CAAC;AAElB;;;;;;;;;;GAUG;AACH,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,UAAU;IACvB,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,aAAa,EAAE,OAAO,CAAC;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event log. Tracks the active
|
|
4
|
+
* visualizer scene (mapping vs forces), registered scene descriptors, and a capped
|
|
5
|
+
* log of recent scene events (objective reached, map regenerated, etc.).
|
|
6
|
+
*
|
|
7
|
+
* @author Carson Fujita
|
|
8
|
+
* @license MIT
|
|
9
|
+
*/
|
|
10
|
+
import { createSlice, createSelector } from '@reduxjs/toolkit';
|
|
11
|
+
/**
|
|
12
|
+
* @constant INITIAL_SCENES
|
|
13
|
+
* @description The initial set of registered scenes in the Redux store.
|
|
14
|
+
* @type {SceneDescriptor[]}
|
|
15
|
+
* @remarks
|
|
16
|
+
* This constant defines the default scenes available in the visualizer upon application startup.
|
|
17
|
+
* It includes the 'mapping' scene for coordinate mapping and the 'forces' scene for force simulation.
|
|
18
|
+
*/
|
|
19
|
+
const INITIAL_SCENES = [
|
|
20
|
+
{ id: 'mapping', displayName: 'Coordinate Mapping', tabIndex: 0 },
|
|
21
|
+
{ id: 'forces', displayName: 'Force Simulation', tabIndex: 1 },
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* @constant initialState
|
|
25
|
+
* @description The initial state of the scene slice in the Redux store.
|
|
26
|
+
* @type {SceneState}
|
|
27
|
+
* @remarks
|
|
28
|
+
* The initial state sets the registered scenes to {@link INITIAL_SCENES}, the active scene to 'mapping',
|
|
29
|
+
* and initializes an empty array for recent events. This state is used when the application first loads or when the scene state is reset.
|
|
30
|
+
*/
|
|
31
|
+
const initialState = {
|
|
32
|
+
registeredScenes: INITIAL_SCENES,
|
|
33
|
+
activeSceneId: 'mapping',
|
|
34
|
+
recentEvents: [],
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @constant MAX_EVENTS
|
|
38
|
+
* @description The maximum number of recent scene events to retain in the Redux store.
|
|
39
|
+
* @remarks
|
|
40
|
+
* This constant defines the cap for the recent events log, ensuring that only the most recent 50 events are kept.
|
|
41
|
+
* When a new event is added and the log exceeds this limit, the oldest event is removed to maintain the cap.
|
|
42
|
+
*/
|
|
43
|
+
const MAX_EVENTS = 50;
|
|
44
|
+
/**
|
|
45
|
+
* @constant sceneSlice
|
|
46
|
+
* @description Redux slice for managing the scene registry and event log.
|
|
47
|
+
* @see {@link SceneState} for the structure of the state.
|
|
48
|
+
* @remarks
|
|
49
|
+
* This slice provides actions and reducers to manage the registered scenes, active scene, and recent events in the visualizer.
|
|
50
|
+
* It includes actions to register new scenes, set the active scene, dispatch scene events, and clear the event log.
|
|
51
|
+
* The slice also includes selectors to access the active scene, registered scenes, recent events, and the active tab index for UI navigation.
|
|
52
|
+
*/
|
|
53
|
+
export const sceneSlice = createSlice({
|
|
54
|
+
name: 'scene',
|
|
55
|
+
initialState,
|
|
56
|
+
reducers: {
|
|
57
|
+
registerScene(state, action) {
|
|
58
|
+
const exists = state.registeredScenes.some(s => s.id === action.payload.id);
|
|
59
|
+
if (!exists)
|
|
60
|
+
state.registeredScenes.push(action.payload);
|
|
61
|
+
},
|
|
62
|
+
setActiveScene(state, action) {
|
|
63
|
+
if (state.activeSceneId !== action.payload) {
|
|
64
|
+
state.activeSceneId = action.payload;
|
|
65
|
+
state.recentEvents.push({
|
|
66
|
+
id: crypto.randomUUID(),
|
|
67
|
+
type: 'SCENE_CHANGED',
|
|
68
|
+
sceneId: action.payload,
|
|
69
|
+
timestamp: Date.now(),
|
|
70
|
+
});
|
|
71
|
+
if (state.recentEvents.length > MAX_EVENTS)
|
|
72
|
+
state.recentEvents.shift();
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
dispatchSceneEvent(state, action) {
|
|
76
|
+
state.recentEvents.push({
|
|
77
|
+
...action.payload,
|
|
78
|
+
id: crypto.randomUUID(),
|
|
79
|
+
timestamp: Date.now(),
|
|
80
|
+
});
|
|
81
|
+
if (state.recentEvents.length > MAX_EVENTS)
|
|
82
|
+
state.recentEvents.shift();
|
|
83
|
+
},
|
|
84
|
+
clearSceneEvents(state) {
|
|
85
|
+
state.recentEvents = [];
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
export const { registerScene, setActiveScene, dispatchSceneEvent, clearSceneEvents } = sceneSlice.actions;
|
|
90
|
+
export const selectActiveScene = (state) => state.scene.activeSceneId;
|
|
91
|
+
export const selectRegisteredScenes = (state) => state.scene.registeredScenes;
|
|
92
|
+
export const selectRecentEvents = (state) => state.scene.recentEvents;
|
|
93
|
+
export const selectActiveTabIndex = createSelector([selectRegisteredScenes, selectActiveScene], (scenes, activeId) => scenes.find(s => s.id === activeId)?.tabIndex ?? 0);
|
|
94
|
+
export default sceneSlice.reducer;
|
|
95
|
+
//# sourceMappingURL=sceneSlice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sceneSlice.js","sourceRoot":"","sources":["../../../src/store/slices/sceneSlice.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAC;AA+EnF;;;;;;;GAOG;AACH,MAAM,cAAc,GAAsB;IACtC,EAAE,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,CAAC,EAAE;IACjE,EAAE,EAAE,EAAE,QAAQ,EAAG,WAAW,EAAE,kBAAkB,EAAI,QAAQ,EAAE,CAAC,EAAE;CACpE,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,YAAY,GAAe;IAC7B,gBAAgB,EAAE,cAAc;IAChC,aAAa,EAAE,SAAS;IACxB,YAAY,EAAE,EAAE;CACnB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;IAClC,IAAI,EAAE,OAAO;IACb,YAAY;IACZ,QAAQ,EAAE;QACN,aAAa,CAAC,KAAK,EAAE,MAAsC;YACvD,MAAM,MAAM,GAAG,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAA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