@ingissa/navcore-simulator 1.0.3 → 1.0.4

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 (48) hide show
  1. package/README.md +18 -10
  2. package/dist/index-i9TY71RY.d.mts +494 -0
  3. package/dist/index-i9TY71RY.d.ts +494 -0
  4. package/dist/index.d.mts +1 -0
  5. package/dist/index.d.ts +1 -28
  6. package/dist/index.js +937 -29
  7. package/dist/index.mjs +929 -0
  8. package/dist/node.d.mts +1 -0
  9. package/dist/node.d.ts +1 -26
  10. package/dist/node.js +937 -25
  11. package/dist/node.mjs +929 -0
  12. package/dist/react-native.d.mts +82 -0
  13. package/dist/react-native.d.ts +82 -0
  14. package/dist/react-native.js +1370 -0
  15. package/dist/react-native.mjs +1360 -0
  16. package/package.json +15 -5
  17. package/dist/core/NoiseEngine.d.ts +0 -46
  18. package/dist/core/NoiseEngine.d.ts.map +0 -1
  19. package/dist/core/NoiseEngine.js +0 -106
  20. package/dist/core/RouteWalker.d.ts +0 -75
  21. package/dist/core/RouteWalker.d.ts.map +0 -1
  22. package/dist/core/RouteWalker.js +0 -177
  23. package/dist/core/SimulatorEngine.d.ts +0 -53
  24. package/dist/core/SimulatorEngine.d.ts.map +0 -1
  25. package/dist/core/SimulatorEngine.js +0 -283
  26. package/dist/core/types.d.ts +0 -129
  27. package/dist/core/types.d.ts.map +0 -1
  28. package/dist/core/types.js +0 -7
  29. package/dist/fleet/FleetSimulator.d.ts +0 -60
  30. package/dist/fleet/FleetSimulator.d.ts.map +0 -1
  31. package/dist/fleet/FleetSimulator.js +0 -114
  32. package/dist/index.d.ts.map +0 -1
  33. package/dist/node.d.ts.map +0 -1
  34. package/dist/react-native/SimulatorControls.d.ts +0 -35
  35. package/dist/react-native/SimulatorControls.d.ts.map +0 -1
  36. package/dist/react-native/SimulatorControls.js +0 -254
  37. package/dist/react-native/useSimulator.d.ts +0 -55
  38. package/dist/react-native/useSimulator.d.ts.map +0 -1
  39. package/dist/react-native/useSimulator.js +0 -97
  40. package/dist/replay/GpxParser.d.ts +0 -40
  41. package/dist/replay/GpxParser.d.ts.map +0 -1
  42. package/dist/replay/GpxParser.js +0 -95
  43. package/dist/replay/SessionRecorder.d.ts +0 -37
  44. package/dist/replay/SessionRecorder.d.ts.map +0 -1
  45. package/dist/replay/SessionRecorder.js +0 -120
  46. package/dist/scenarios/ScenarioInjector.d.ts +0 -55
  47. package/dist/scenarios/ScenarioInjector.d.ts.map +0 -1
  48. package/dist/scenarios/ScenarioInjector.js +0 -150
@@ -0,0 +1,82 @@
1
+ import { h as SimSession, C as Coordinate, i as SimulatorConfig, S as Scenario, g as SimPosition } from './index-i9TY71RY.mjs';
2
+ export { E as EngineState, a as ExportFormat, F as FleetReport, b as FleetSimulator, G as GpxParseResult, c as GpxParser, N as NoiseEngine, d as NoiseProfile, R as RouteWalker, e as ScenarioInjector, f as SessionRecorder, j as SimulatorEngine, V as VehicleProfile, W as WalkerPosition } from './index-i9TY71RY.mjs';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+
5
+ /**
6
+ * useSimulator — React Native hook wrapping SimulatorEngine.
7
+ *
8
+ * Drop-in replacement for useGpsSimulator.
9
+ * All engine logic lives in SimulatorEngine — this hook is purely a thin
10
+ * React adapter with no business logic of its own.
11
+ *
12
+ * BEFORE (current Go4Exams code):
13
+ * const simGps = useGpsSimulator(route, isNavigating, speedMultiplier)
14
+ *
15
+ * AFTER:
16
+ * const { position, controls, session, isRecording } = useSimulator({
17
+ * routeGeometry: route,
18
+ * active: isNavigating,
19
+ * config: { speedKmh: 50, noiseProfile: NoiseEngine.STANDARD },
20
+ * })
21
+ */
22
+
23
+ interface UseSimulatorOptions {
24
+ /** Route geometry to simulate along */
25
+ routeGeometry: Coordinate[] | null;
26
+ /** Whether the simulation should be active */
27
+ active: boolean;
28
+ /** Engine configuration (all fields optional) */
29
+ config?: Partial<Omit<SimulatorConfig, 'routeGeometry' | 'onPositionUpdate' | 'onRouteComplete'>>;
30
+ /** Pre-registered scenarios */
31
+ scenarios?: Scenario[];
32
+ /** Called when a scenario fires */
33
+ onScenarioFired?: (scenario: Scenario) => void;
34
+ /** Called when the route simulation finishes */
35
+ onRouteComplete?: () => void;
36
+ }
37
+ interface SimulatorControls$1 {
38
+ pause: () => void;
39
+ resume: () => void;
40
+ seek: (geometryIndex: number) => void;
41
+ setSpeed: (multiplier: 1 | 2 | 4 | 8) => void;
42
+ }
43
+ interface SessionControls {
44
+ start: (sessionId?: string) => void;
45
+ stop: () => SimSession | null;
46
+ }
47
+ interface UseSimulatorResult {
48
+ /** Current simulated position — null when inactive */
49
+ position: SimPosition | null;
50
+ /** Playback controls */
51
+ controls: SimulatorControls$1;
52
+ /** Recording controls */
53
+ session: SessionControls;
54
+ /** Whether a recording is in progress */
55
+ isRecording: boolean;
56
+ }
57
+ declare function useSimulator(options: UseSimulatorOptions): UseSimulatorResult;
58
+
59
+ interface ScenarioLogEntry {
60
+ ts: number;
61
+ name: string;
62
+ type: string;
63
+ }
64
+ interface SimulatorControlsProps {
65
+ simulator: SimulatorControls$1;
66
+ session?: SessionControls;
67
+ style?: 'minimal' | 'full' | 'floating';
68
+ showScenarioLog?: boolean;
69
+ showSessionRecorder?: boolean;
70
+ scenarioLog?: ScenarioLogEntry[];
71
+ /** Current speed multiplier (controlled externally) */
72
+ currentSpeed?: 1 | 2 | 4 | 8;
73
+ /** Current engine state */
74
+ engineState?: 'idle' | 'running' | 'paused' | 'complete';
75
+ isRecording?: boolean;
76
+ onExportSession?: (session: SimSession) => void;
77
+ /** Additional style for the root container */
78
+ containerStyle?: object;
79
+ }
80
+ declare function SimulatorControls({ simulator, session, style, showScenarioLog, showSessionRecorder, scenarioLog, currentSpeed, engineState, isRecording, onExportSession, containerStyle, }: SimulatorControlsProps): react_jsx_runtime.JSX.Element;
81
+
82
+ export { Scenario, type ScenarioLogEntry, SimPosition, SimSession, SimulatorConfig, SimulatorControls, useSimulator };
@@ -0,0 +1,82 @@
1
+ import { h as SimSession, C as Coordinate, i as SimulatorConfig, S as Scenario, g as SimPosition } from './index-i9TY71RY.js';
2
+ export { E as EngineState, a as ExportFormat, F as FleetReport, b as FleetSimulator, G as GpxParseResult, c as GpxParser, N as NoiseEngine, d as NoiseProfile, R as RouteWalker, e as ScenarioInjector, f as SessionRecorder, j as SimulatorEngine, V as VehicleProfile, W as WalkerPosition } from './index-i9TY71RY.js';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+
5
+ /**
6
+ * useSimulator — React Native hook wrapping SimulatorEngine.
7
+ *
8
+ * Drop-in replacement for useGpsSimulator.
9
+ * All engine logic lives in SimulatorEngine — this hook is purely a thin
10
+ * React adapter with no business logic of its own.
11
+ *
12
+ * BEFORE (current Go4Exams code):
13
+ * const simGps = useGpsSimulator(route, isNavigating, speedMultiplier)
14
+ *
15
+ * AFTER:
16
+ * const { position, controls, session, isRecording } = useSimulator({
17
+ * routeGeometry: route,
18
+ * active: isNavigating,
19
+ * config: { speedKmh: 50, noiseProfile: NoiseEngine.STANDARD },
20
+ * })
21
+ */
22
+
23
+ interface UseSimulatorOptions {
24
+ /** Route geometry to simulate along */
25
+ routeGeometry: Coordinate[] | null;
26
+ /** Whether the simulation should be active */
27
+ active: boolean;
28
+ /** Engine configuration (all fields optional) */
29
+ config?: Partial<Omit<SimulatorConfig, 'routeGeometry' | 'onPositionUpdate' | 'onRouteComplete'>>;
30
+ /** Pre-registered scenarios */
31
+ scenarios?: Scenario[];
32
+ /** Called when a scenario fires */
33
+ onScenarioFired?: (scenario: Scenario) => void;
34
+ /** Called when the route simulation finishes */
35
+ onRouteComplete?: () => void;
36
+ }
37
+ interface SimulatorControls$1 {
38
+ pause: () => void;
39
+ resume: () => void;
40
+ seek: (geometryIndex: number) => void;
41
+ setSpeed: (multiplier: 1 | 2 | 4 | 8) => void;
42
+ }
43
+ interface SessionControls {
44
+ start: (sessionId?: string) => void;
45
+ stop: () => SimSession | null;
46
+ }
47
+ interface UseSimulatorResult {
48
+ /** Current simulated position — null when inactive */
49
+ position: SimPosition | null;
50
+ /** Playback controls */
51
+ controls: SimulatorControls$1;
52
+ /** Recording controls */
53
+ session: SessionControls;
54
+ /** Whether a recording is in progress */
55
+ isRecording: boolean;
56
+ }
57
+ declare function useSimulator(options: UseSimulatorOptions): UseSimulatorResult;
58
+
59
+ interface ScenarioLogEntry {
60
+ ts: number;
61
+ name: string;
62
+ type: string;
63
+ }
64
+ interface SimulatorControlsProps {
65
+ simulator: SimulatorControls$1;
66
+ session?: SessionControls;
67
+ style?: 'minimal' | 'full' | 'floating';
68
+ showScenarioLog?: boolean;
69
+ showSessionRecorder?: boolean;
70
+ scenarioLog?: ScenarioLogEntry[];
71
+ /** Current speed multiplier (controlled externally) */
72
+ currentSpeed?: 1 | 2 | 4 | 8;
73
+ /** Current engine state */
74
+ engineState?: 'idle' | 'running' | 'paused' | 'complete';
75
+ isRecording?: boolean;
76
+ onExportSession?: (session: SimSession) => void;
77
+ /** Additional style for the root container */
78
+ containerStyle?: object;
79
+ }
80
+ declare function SimulatorControls({ simulator, session, style, showScenarioLog, showSessionRecorder, scenarioLog, currentSpeed, engineState, isRecording, onExportSession, containerStyle, }: SimulatorControlsProps): react_jsx_runtime.JSX.Element;
81
+
82
+ export { Scenario, type ScenarioLogEntry, SimPosition, SimSession, SimulatorConfig, SimulatorControls, useSimulator };