@osrd-project/ui-charts 0.0.68 → 0.0.70

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 (75) hide show
  1. package/dist/index.esm.js +1 -1
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/manchette/consts.d.ts +1 -0
  4. package/dist/manchette/hooks/useManchetteWithSpaceTimeChart.d.ts +31 -13
  5. package/dist/manchette/utils/helpers.d.ts +24 -9
  6. package/dist/spaceTimeChart/components/Quadrilateral.d.ts +19 -0
  7. package/dist/spaceTimeChart/components/Tooltip.d.ts +7 -0
  8. package/dist/spaceTimeChart/components/WorkScheduleLayer.d.ts +6 -1
  9. package/dist/spaceTimeChart/index.d.ts +10 -1
  10. package/dist/spaceTimeChart/lib/consts.d.ts +0 -17
  11. package/dist/spaceTimeChart/lib/types.d.ts +1 -1
  12. package/dist/spaceTimeChart/utils/canvas.d.ts +11 -3
  13. package/dist/speedSpaceChart/components/SpeedSpaceChart.d.ts +1 -1
  14. package/dist/speedSpaceChart/components/common/DetailsBox.d.ts +1 -1
  15. package/dist/speedSpaceChart/components/common/InteractionButtons.d.ts +1 -1
  16. package/dist/speedSpaceChart/components/common/SettingsPanel.d.ts +1 -1
  17. package/dist/speedSpaceChart/components/const.d.ts +1 -1
  18. package/dist/speedSpaceChart/components/helpers/drawElements/axisY.d.ts +1 -1
  19. package/dist/speedSpaceChart/components/helpers/drawElements/curve.d.ts +1 -1
  20. package/dist/speedSpaceChart/components/helpers/drawElements/declivity.d.ts +1 -1
  21. package/dist/speedSpaceChart/components/helpers/drawElements/electricalProfile.d.ts +1 -1
  22. package/dist/speedSpaceChart/components/helpers/drawElements/powerRestrictions.d.ts +1 -1
  23. package/dist/speedSpaceChart/components/helpers/drawElements/reticle.d.ts +1 -1
  24. package/dist/speedSpaceChart/components/helpers/drawElements/speedLimitTags.d.ts +1 -1
  25. package/dist/speedSpaceChart/components/helpers/drawElements/speedLimits.d.ts +1 -1
  26. package/dist/speedSpaceChart/components/helpers/drawElements/steps.d.ts +1 -1
  27. package/dist/speedSpaceChart/components/helpers/drawElements/tickX.d.ts +1 -1
  28. package/dist/speedSpaceChart/components/helpers/drawElements/tickYRight.d.ts +1 -1
  29. package/dist/speedSpaceChart/components/helpers/frontFrame.d.ts +1 -1
  30. package/dist/speedSpaceChart/components/helpers/layersManager.d.ts +1 -1
  31. package/dist/speedSpaceChart/components/hooks.d.ts +1 -1
  32. package/dist/speedSpaceChart/components/layers/CurveLayer.d.ts +1 -1
  33. package/dist/speedSpaceChart/components/layers/DeclivityLayer.d.ts +1 -1
  34. package/dist/speedSpaceChart/components/layers/ElectricalProfileLayer.d.ts +1 -1
  35. package/dist/speedSpaceChart/components/layers/FrontInteractivityLayer.d.ts +1 -1
  36. package/dist/speedSpaceChart/components/layers/PowerRestrictionsLayer.d.ts +1 -1
  37. package/dist/speedSpaceChart/components/layers/ReticleLayer.d.ts +1 -1
  38. package/dist/speedSpaceChart/components/layers/SpeedLimitTagsLayer.d.ts +1 -1
  39. package/dist/speedSpaceChart/components/layers/SpeedLimitsLayer.d.ts +1 -1
  40. package/dist/speedSpaceChart/components/layers/StepsLayer.d.ts +1 -1
  41. package/dist/speedSpaceChart/components/layers/TickLayerX.d.ts +1 -1
  42. package/dist/speedSpaceChart/components/layers/TickLayerY.d.ts +1 -1
  43. package/dist/speedSpaceChart/components/layers/TickLayerYRight.d.ts +1 -1
  44. package/dist/speedSpaceChart/components/utils.d.ts +8 -2
  45. package/dist/speedSpaceChart/index.d.ts +2 -1
  46. package/dist/speedSpaceChart/{types/chartTypes.d.ts → types.d.ts} +5 -4
  47. package/dist/theme.css +0 -108
  48. package/dist/theme.css.map +1 -1
  49. package/package.json +4 -4
  50. package/dist/spaceTimeChart/stories/additional-data.stories.d.ts +0 -20
  51. package/dist/spaceTimeChart/stories/base-rendering.stories.d.ts +0 -28
  52. package/dist/spaceTimeChart/stories/custom-styles.stories.d.ts +0 -24
  53. package/dist/spaceTimeChart/stories/horizontal-zoom.stories.d.ts +0 -31
  54. package/dist/spaceTimeChart/stories/layers.stories.d.ts +0 -9
  55. package/dist/spaceTimeChart/stories/lib/components.d.ts +0 -15
  56. package/dist/spaceTimeChart/stories/lib/paths.d.ts +0 -16
  57. package/dist/spaceTimeChart/stories/lib/utils.d.ts +0 -22
  58. package/dist/spaceTimeChart/stories/measuring.stories.d.ts +0 -20
  59. package/dist/spaceTimeChart/stories/options.stories.d.ts +0 -27
  60. package/dist/spaceTimeChart/stories/paths-interactions.stories.d.ts +0 -24
  61. package/dist/spaceTimeChart/stories/performances.stories.d.ts +0 -25
  62. package/dist/spaceTimeChart/stories/rectangle-zoom.stories.d.ts +0 -40
  63. package/dist/spaceTimeChart/stories/scroll-navigation.stories.d.ts +0 -19
  64. package/dist/spaceTimeChart/stories/split.stories.d.ts +0 -21
  65. package/dist/spaceTimeChart/stories/stage-interactions.stories.d.ts +0 -25
  66. package/dist/spaceTimeChart/stories/work-schedules.stories.d.ts +0 -31
  67. package/dist/spaceTimeChart/types.d.ts +0 -6
  68. package/dist/speedSpaceChart/stories/SpeedSpaceChart.stories.d.ts +0 -8
  69. package/dist/speedSpaceChart/stories/assets/const.d.ts +0 -70
  70. package/dist/speedSpaceChart/stories/assets/path_properties_PMP_LM.d.ts +0 -2
  71. package/dist/speedSpaceChart/stories/assets/power_restrictions_PMP_LM.d.ts +0 -7
  72. package/dist/speedSpaceChart/stories/assets/simulation_PMP_LM.d.ts +0 -2
  73. package/dist/speedSpaceChart/stories/assets/speed_limit_tags_PMP_LM.d.ts +0 -9
  74. package/dist/speedSpaceChart/stories/utils.d.ts +0 -5
  75. package/dist/speedSpaceChart/types/simulationTypes.d.ts +0 -47
@@ -10,6 +10,7 @@ export declare const MAX_ZOOM_X = 100;
10
10
  export declare const MIN_ZOOM_Y = 1;
11
11
  export declare const MAX_ZOOM_Y = 10.5;
12
12
  export declare const ZOOM_Y_DELTA = 0.5;
13
+ export declare const MAX_ZOOM_MANCHETTE_HEIGHT_MILLIMETER = 500000;
13
14
  export declare const FOOTER_HEIGHT = 40;
14
15
  export declare const WAYPOINT_LINE_HEIGHT = 16;
15
16
  export declare const PATH_COLOR_DEFAULT = "#8A714B";
@@ -1,6 +1,15 @@
1
1
  import type { SpaceTimeChartProps } from '../../spaceTimeChart';
2
2
  import type { ProjectPathTrainResult, Waypoint } from '../types';
3
- declare const useManchettesWithSpaceTimeChart: (waypoints: Waypoint[], projectPathTrainResult: ProjectPathTrainResult[], manchetteWithSpaceTimeChartContainer: React.RefObject<HTMLDivElement>, selectedTrain?: number, height?: number, spaceTimeChartRef?: React.RefObject<HTMLDivElement>) => {
3
+ declare const useManchetteWithSpaceTimeChart: ({ waypoints, projectPathTrainResult, manchetteWithSpaceTimeChartRef, selectedTrain, height, spaceTimeChartRef, defaultTimeOrigin, defaultSpaceOrigin, }: {
4
+ waypoints: Waypoint[];
5
+ projectPathTrainResult: ProjectPathTrainResult[];
6
+ manchetteWithSpaceTimeChartRef: React.RefObject<HTMLDivElement>;
7
+ selectedTrain?: number;
8
+ height?: number;
9
+ spaceTimeChartRef?: React.RefObject<HTMLDivElement>;
10
+ defaultTimeOrigin?: number;
11
+ defaultSpaceOrigin?: number;
12
+ }) => {
4
13
  manchetteProps: {
5
14
  contents: import("../types").InteractiveWaypoint[];
6
15
  zoomYIn: () => void;
@@ -46,21 +55,30 @@ declare const useManchettesWithSpaceTimeChart: (waypoints: Waypoint[], projectPa
46
55
  }[];
47
56
  xOffset: number;
48
57
  yOffset: number;
58
+ timeOrigin: number;
59
+ spaceOrigin: number;
60
+ rect: {
61
+ timeStart: Date;
62
+ timeEnd: Date;
63
+ spaceStart: number;
64
+ spaceEnd: number;
65
+ } | null;
49
66
  onZoom: ({ delta, position }: Parameters<NonNullable<SpaceTimeChartProps["onZoom"]>>[0]) => void;
50
- onPan: (payload: {
51
- initialPosition: {
52
- x: number;
53
- y: number;
54
- };
55
- position: {
56
- x: number;
57
- y: number;
58
- };
59
- isPanning: boolean;
60
- }) => void;
67
+ onPan: (payload: Parameters<NonNullable<SpaceTimeChartProps["onPan"]>>[0]) => void;
61
68
  };
62
69
  handleScroll: () => void;
63
70
  handleXZoom: (newXZoom: number, xPosition?: number) => void;
64
71
  xZoom: number;
72
+ toggleZoomMode: () => void;
73
+ zoomMode: boolean;
74
+ rect: {
75
+ timeStart: Date;
76
+ timeEnd: Date;
77
+ spaceStart: number;
78
+ spaceEnd: number;
79
+ } | null;
80
+ timeScale: number;
81
+ spaceScale: number;
82
+ setTimeOrigin: (newTimeOrigin: number) => void;
65
83
  };
66
- export default useManchettesWithSpaceTimeChart;
84
+ export default useManchetteWithSpaceTimeChart;
@@ -1,12 +1,34 @@
1
1
  import type { InteractiveWaypoint, Waypoint } from '../types';
2
+ export declare const zoomValueToTimeScale: (slider: number) => number;
3
+ export declare const timeScaleToZoomValue: (timeScale: number) => number;
4
+ /**
5
+ * min zoom is computed with manchette px height between first and last waypoint.
6
+ * max zoom just the canvas drawing height (without the x-axis scale section)
7
+ */
8
+ export declare const getExtremaScales: (drawingHeightWithoutTopPadding: number, drawingHeightWithoutBothPadding: number, pathLengthMillimeter: number) => {
9
+ minZoomMillimeterPerPx: number;
10
+ maxZoomMillimeterPerPx: number;
11
+ };
12
+ export declare const zoomValueToSpaceScale: (minZoomMillimeterPerPx: number, maxZoomMillimeterPerPx: number, slider: number) => number;
13
+ export declare const spaceScaleToZoomValue: (minZoomMillimeterPerPx: number, maxZoomMillimeterPerPx: number, spaceScale: number) => number;
14
+ /** Zoom on X axis and center on the mouse position */
15
+ export declare const zoomX: (currentZoom: number, currentOffset: number, newZoom: number, position: number) => {
16
+ xZoom: number;
17
+ xOffset: number;
18
+ };
2
19
  type WaypointsOptions = {
3
20
  isProportional: boolean;
4
21
  yZoom: number;
5
22
  height: number;
6
23
  };
7
24
  export declare const filterVisibleElements: (elements: Waypoint[], totalDistance: number, heightWithoutFinalWaypoint: number, minSpace: number) => Waypoint[];
8
- export declare const computeWaypointsToDisplay: (waypoints: Waypoint[], { height, isProportional, yZoom }: WaypointsOptions) => InteractiveWaypoint[];
9
- export declare const getScales: (waypoints: Waypoint[], { height, isProportional, yZoom }: WaypointsOptions) => {
25
+ export declare const computeWaypointsToDisplay: (waypoints: Waypoint[], { height, isProportional, yZoom }: WaypointsOptions, minZoomMillimeterPerPx: number, maxZoomMillimeterPerPx: number) => InteractiveWaypoint[];
26
+ /**
27
+ * 2 modes for space scales
28
+ * km (isProportional): { coefficient: gives a scale in meter/pixel }
29
+ * linear: { size: height in pixel } (each point distributed evenly along the height of manchette.)
30
+ */
31
+ export declare const getScales: (waypoints: Waypoint[], { isProportional, yZoom }: WaypointsOptions, minZoomMillimeterPerPx: number, maxZoomMillimeterPerPx: number) => {
10
32
  from: number;
11
33
  to: number;
12
34
  size: number;
@@ -21,11 +43,4 @@ export declare const getScales: (waypoints: Waypoint[], { height, isProportional
21
43
  from: number;
22
44
  to: number;
23
45
  })[];
24
- export declare const zoomValueToTimeScale: (slider: number) => number;
25
- export declare const timeScaleToZoomValue: (timeScale: number) => number;
26
- /** Zoom on X axis and center on the mouse position */
27
- export declare const zoomX: (currentZoom: number, currentOffset: number, newZoom: number, position: number) => {
28
- xZoom: number;
29
- xOffset: number;
30
- };
31
46
  export {};
@@ -0,0 +1,19 @@
1
+ import { type DataPoint } from '../lib/types';
2
+ export type QuadrilateralProps = {
3
+ vertices: [DataPoint, DataPoint, DataPoint, DataPoint];
4
+ style: {
5
+ backgroundColor: string;
6
+ borderColor: string;
7
+ borderWidth: number;
8
+ };
9
+ };
10
+ /**
11
+ * Draws a quadrilateral in the space time chart
12
+ * Position correspond to each point of the quadrilateral
13
+ *
14
+ * vertices[0] ________ vertices[1]
15
+ * / /
16
+ * vertices[3] /________/ vertices[2]
17
+ *
18
+ */
19
+ export declare const Quadrilateral: ({ vertices, style }: QuadrilateralProps) => null;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { Point } from '../lib/types';
3
+ export type TooltipProps = {
4
+ position: Point;
5
+ children: React.ReactNode;
6
+ };
7
+ export declare const Tooltip: ({ position, children }: TooltipProps) => React.JSX.Element;
@@ -1,5 +1,10 @@
1
1
  import React from 'react';
2
- import { type WorkSchedule } from '../types';
2
+ export type WorkSchedule = {
3
+ type: 'TRACK' | 'CATENARY';
4
+ timeStart: Date;
5
+ timeEnd: Date;
6
+ spaceRanges: [number, number][];
7
+ };
3
8
  type WorkScheduleLayerProps = {
4
9
  workSchedules: WorkSchedule[];
5
10
  imageUrl: string;
@@ -1,9 +1,18 @@
1
1
  import './styles/main.css';
2
- export type { HoveredItem, SpaceTimeChartProps, SpaceScale, OperationalPoint, SpaceTimeChartTheme, Point, DataPoint, SpaceTimeChartContextType, } from './lib/types';
3
2
  export * from './components/SpaceTimeChart';
4
3
  export * from './components/PathLayer';
5
4
  export * from './components/ConflictLayer';
6
5
  export * from './components/ConflictTooltip';
6
+ export * from './components/Tooltip';
7
7
  export * from './components/OccupancyBlockLayer';
8
8
  export * from './components/WorkScheduleLayer';
9
9
  export * from './components/PatternRect';
10
+ export * from './components/Quadrilateral';
11
+ export * from './components/ZoomRect';
12
+ export * from './components/TimeCaptions';
13
+ export { usePicking, useDraw } from './hooks/useCanvas';
14
+ export { DEFAULT_THEME } from './lib/consts';
15
+ export { CanvasContext, MouseContext, SpaceTimeChartContext } from './lib/context';
16
+ export type { HoveredItem, SpaceTimeChartProps, SpaceScale, OperationalPoint, SpaceTimeChartTheme, PathData, Point, DataPoint, SpaceTimeChartContextType, DrawingFunction, PickingDrawingFunction, PickingElement, } from './lib/types';
17
+ export { isPathOnScreen } from './utils/geometry';
18
+ export { getSpaceAtTime } from './utils/scales';
@@ -1,20 +1,3 @@
1
1
  import { type SpaceTimeChartTheme } from './types';
2
- export declare const BLACK = "#000000";
3
- export declare const BLUE = "#2170B9";
4
- export declare const GREY_10 = "#EDEDED";
5
- export declare const GREY_30 = "#B6B2AF";
6
- export declare const GREY_50 = "#797671";
7
- export declare const WHITE_75 = "#FFFFFFC0";
8
- export declare const AMBIANT_A10 = "#EFF3F5";
9
- export declare const ERROR_30 = "#FF6868";
10
- export declare const ERROR_60 = "#D91C1C";
11
- export declare const OCCUPANCY_FREE = "#CAEDDB";
12
- export declare const OCCUPANCY_SEMAPHORE = "#FFD4D8";
13
- export declare const OCCUPANCY_WARNING = "#FFEABF";
14
- export declare const FONT_SIZE = 10;
15
- export declare const FONT = "IBM Plex Sans";
16
- export declare const SECOND = 1000;
17
2
  export declare const MINUTE: number;
18
- export declare const HOUR: number;
19
- export declare const KILOMETER = 1000;
20
3
  export declare const DEFAULT_THEME: SpaceTimeChartTheme;
@@ -73,7 +73,7 @@ export type HoveredItem = {
73
73
  element: PickingElement;
74
74
  };
75
75
  export type DrawingFunction = (canvasContext: CanvasRenderingContext2D, stcContext: SpaceTimeChartContextType) => void;
76
- export type PickingDrawingFunction = (imageData: ImageData, stcContext: SpaceTimeChartContextType) => void;
76
+ export type PickingDrawingFunction = (imageData: ImageData, stcContext: SpaceTimeChartContextType, scalingRatio: number) => void;
77
77
  export type DrawingFunctionHandler = (arg: {
78
78
  type: 'picking';
79
79
  layer: PickingLayerType;
@@ -1,16 +1,24 @@
1
1
  import type { SpaceTimeChartContextType, Direction, PathEnd, Point, RGBAColor, RGBColor } from '../lib/types';
2
+ /**
3
+ * This function returns the picking layers scaling ratio. We basically take the min of the screen
4
+ * pixels and the "HTML pixels", and divide it by two.
5
+ *
6
+ * This allows having a smaller picking stage to fill (so it's faster), while keeping a "good enough
7
+ * precision".
8
+ */
9
+ export declare function getPickingScalingRatio(): number;
2
10
  /**
3
11
  * This function draws a thick lines from "from" to "to" on the given ImageData, with no
4
12
  * antialiasing. This is very useful to handle picking, since it is not possible to disable
5
13
  * antialiasing with the native JavaScript canvas APIs.
6
14
  */
7
- export declare function drawAliasedLine(imageData: ImageData, from: Point, to: Point, [r, g, b]: RGBColor | RGBAColor, thickness: number, drawOnBottom: boolean, number?: number): void;
15
+ export declare function drawAliasedLine(imageData: ImageData, { x: fromX, y: fromY }: Point, { x: toX, y: toY }: Point, [r, g, b]: RGBColor | RGBAColor, thickness: number, drawOnBottom: boolean, scalingRatio?: number): void;
8
16
  export declare function getAliasedDiscShape(radius: number): Uint8Array;
9
17
  /**
10
18
  * This function draws an aliased disc, using a shape computed by getDiscShape.
11
19
  */
12
- export declare function drawAliasedDisc(imageData: ImageData, { x: centerX, y: centerY }: Point, radius: number, [r, g, b]: RGBColor | RGBAColor, drawOnBottom: boolean): void;
13
- export declare function drawAliasedRect(imageData: ImageData, { x, y }: Point, width: number, height: number, [r, g, b]: RGBColor | RGBAColor): void;
20
+ export declare function drawAliasedDisc(imageData: ImageData, { x: centerX, y: centerY }: Point, radius: number, [r, g, b]: RGBColor | RGBAColor, drawOnBottom: boolean, scalingRatio?: number): void;
21
+ export declare function drawAliasedRect(imageData: ImageData, { x, y }: Point, width: number, height: number, [r, g, b]: RGBColor | RGBAColor, scalingRatio?: number): void;
14
22
  export declare function drawPathStopExtremity(ctx: CanvasRenderingContext2D, timePixel: number, spacePixel: number, swapAxis: boolean): void;
15
23
  export declare function drawPathOutExtremity(ctx: CanvasRenderingContext2D, timePixel: number, spacePixel: number, swapAxis: boolean, extremityType: 'from' | 'to', pathDirection: Direction): void;
16
24
  /**
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Data } from '../types/chartTypes';
2
+ import type { Data } from '../types';
3
3
  export type SpeedSpaceChartProps = {
4
4
  width: number;
5
5
  height: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type DetailsBoxProps = {
4
4
  width: number;
5
5
  height: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type InteractionButtonsProps = {
4
4
  reset: () => void;
5
5
  openSettingsPanel: () => void;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  import type { SpeedSpaceChartProps } from '../SpeedSpaceChart';
4
4
  type SettingsPanelProps = {
5
5
  globalHeight: number;
@@ -1,5 +1,5 @@
1
1
  import chroma from 'chroma-js';
2
- import { type ColorDictionary, type Store } from '../types/chartTypes';
2
+ import { type ColorDictionary, type Store } from '../types';
3
3
  export declare const SLOPE_FILL_COLOR = "#CFDDCE";
4
4
  export declare const RIGHT_TICK_HEIGHT_OFFSET = 2;
5
5
  export declare const TICK_TITLE_MARGINS: {
@@ -1,2 +1,2 @@
1
- import type { DrawFunctionParams } from '../../../types/chartTypes';
1
+ import type { DrawFunctionParams } from '../../../types';
2
2
  export declare const drawAxisY: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -1,2 +1,2 @@
1
- import type { DrawFunctionParams } from '../../../types/chartTypes';
1
+ import type { DrawFunctionParams } from '../../../types';
2
2
  export declare const drawCurve: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -1,2 +1,2 @@
1
- import type { DrawFunctionParams } from '../../../types/chartTypes';
1
+ import type { DrawFunctionParams } from '../../../types';
2
2
  export declare const drawDeclivity: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -1,2 +1,2 @@
1
- import type { DrawFunctionParams } from '../../../types/chartTypes';
1
+ import type { DrawFunctionParams } from '../../../types';
2
2
  export declare const drawElectricalProfile: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -1,2 +1,2 @@
1
- import type { DrawFunctionParams } from '../../../types/chartTypes';
1
+ import type { DrawFunctionParams } from '../../../types';
2
2
  export declare const drawPowerRestrictions: ({ ctx, width, height: marginTop, store, }: DrawFunctionParams) => void;
@@ -1,4 +1,4 @@
1
- import type { DrawFunctionParams } from '../../../types/chartTypes';
1
+ import type { DrawFunctionParams } from '../../../types';
2
2
  export declare const drawCursor: ({ ctx, width, height, store }: DrawFunctionParams) => {
3
3
  curveX: number;
4
4
  curveY: number;
@@ -1,3 +1,3 @@
1
- import type { DrawFunctionParams, SpeedLimitTagsLayerDrawFunctionParams, tooltipInfos } from '../../../types/chartTypes';
1
+ import type { DrawFunctionParams, SpeedLimitTagsLayerDrawFunctionParams, tooltipInfos } from '../../../types';
2
2
  export declare const drawSpeedLimitTags: ({ ctx, width, height: marginTop, store, images, }: SpeedLimitTagsLayerDrawFunctionParams) => void;
3
3
  export declare const computeTooltip: ({ width, height: marginTop, store, }: DrawFunctionParams) => tooltipInfos | null;
@@ -1,2 +1,2 @@
1
- import type { DrawFunctionParams } from '../../../types/chartTypes';
1
+ import type { DrawFunctionParams } from '../../../types';
2
2
  export declare const drawSpeedLimits: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -1,2 +1,2 @@
1
- import type { DrawFunctionParams } from '../../../types/chartTypes';
1
+ import type { DrawFunctionParams } from '../../../types';
2
2
  export declare const drawSteps: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -1,2 +1,2 @@
1
- import type { DrawFunctionParams } from '../../../types/chartTypes';
1
+ import type { DrawFunctionParams } from '../../../types';
2
2
  export declare const drawTickX: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -1,2 +1,2 @@
1
- import type { DrawFunctionParams } from '../../../types/chartTypes';
1
+ import type { DrawFunctionParams } from '../../../types';
2
2
  export declare const drawTickYRight: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -1,2 +1,2 @@
1
- import type { DrawFunctionParams } from '../../types/chartTypes';
1
+ import type { DrawFunctionParams } from '../../types';
2
2
  export declare const drawFrame: ({ ctx, width, height, store, setStore }: DrawFunctionParams) => void;
@@ -1,4 +1,4 @@
1
1
  import * as d3zoom from 'd3-zoom';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  export declare const resetZoom: () => void;
4
4
  export declare const zoom: (setStore: React.Dispatch<React.SetStateAction<Store>>) => d3zoom.ZoomBehavior<Element, unknown>;
@@ -1,4 +1,4 @@
1
- import type { DrawFunctionParams, Store } from '../types/chartTypes';
1
+ import type { DrawFunctionParams, Store } from '../types';
2
2
  type DrawFunction = (params: DrawFunctionParams) => void;
3
3
  type UseCanvasParams = {
4
4
  width: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type CurveLayerProps = {
4
4
  width: number;
5
5
  height: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type DeclivityLayerProps = {
4
4
  width: number;
5
5
  height: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type ElectricalProfileLayerProps = {
4
4
  width: number;
5
5
  height: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type FrontInteractivityLayerProps = {
4
4
  width: number;
5
5
  height: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type PowerRestrictionsLayerProps = {
4
4
  width: number;
5
5
  marginTop: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type ReticleLayerProps = {
4
4
  width: number;
5
5
  height: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type SpeedLimitTagsLayerProps = {
4
4
  width: number;
5
5
  marginTop: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type SpeedLimitsLayerProps = {
4
4
  width: number;
5
5
  height: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type StepsLayerProps = {
4
4
  width: number;
5
5
  height: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type TickLayerXProps = {
4
4
  width: number;
5
5
  height: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type TickLayerYProps = {
4
4
  width: number;
5
5
  height: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { Store } from '../../types/chartTypes';
2
+ import type { Store } from '../../types';
3
3
  type TickLayerYRightProps = {
4
4
  width: number;
5
5
  height: number;
@@ -1,5 +1,5 @@
1
1
  import { MARGINS, type LAYERS_SELECTION } from './const';
2
- import type { LayerData, OperationalPoints, Store } from '../types/chartTypes';
2
+ import type { LayerData, OperationalPoints, Store } from '../types';
3
3
  type SlopesValues = {
4
4
  minGradient: number;
5
5
  maxGradient: number;
@@ -74,7 +74,13 @@ export declare const drawLinearLayerBackground: (ctx: CanvasRenderingContext2D,
74
74
  * Return wether a layer should be active or not.
75
75
  * Depending on the available data, some layers should be disabled.
76
76
  */
77
- export declare const isLayerActive: (store: Store, selection: (typeof LAYERS_SELECTION)[number]) => true | import("../types/chartTypes").ValuesAlongPath<import("../types/chartTypes").SpeedLimit> | LayerData<import("../types/chartTypes").ElectricalPofilelValues>[] | LayerData<import("../types/chartTypes").PowerRestrictionValues>[] | LayerData<import("../types/chartTypes").SpeedLimitTagValues>[] | undefined;
77
+ export declare const isLayerActive: (store: Store, selection: (typeof LAYERS_SELECTION)[number]) => true | {
78
+ boundaries: number[];
79
+ values: {
80
+ speed: number;
81
+ isTemporary: boolean;
82
+ }[];
83
+ } | LayerData<import("../types").ElectricalProfileValues>[] | LayerData<import("../types").PowerRestrictionValues>[] | LayerData<import("../types").SpeedLimitTagValues>[] | undefined;
78
84
  /**
79
85
  * Given a store including a list of slopes, return the position and value of min and max slopes
80
86
  * @param store
@@ -1,3 +1,4 @@
1
1
  import '@osrd-project/ui-core/dist/theme.css';
2
2
  import './styles/main.css';
3
- export { default as SpeedSpaceChart } from './components/SpeedSpaceChart';
3
+ export { default as SpeedSpaceChart, type SpeedSpaceChartProps, } from './components/SpeedSpaceChart';
4
+ export type { LayerData, PowerRestrictionValues, ElectricalProfileValues, ElectrificationValues, SpeedLimitTagValues, Data as SpeedSpaceChartData, } from './types';
@@ -1,4 +1,4 @@
1
- export type ElectricalPofilelValues = {
1
+ export type ElectricalProfileValues = {
2
2
  electricalProfile: string;
3
3
  color?: string;
4
4
  heightLevel?: number;
@@ -28,11 +28,11 @@ export type OperationalPoints = {
28
28
  name: string;
29
29
  weight?: number;
30
30
  };
31
- export type ValuesAlongPath<T> = {
31
+ type ValuesAlongPath<T> = {
32
32
  boundaries: number[];
33
33
  values: T[];
34
34
  };
35
- export type SpeedLimit = {
35
+ type SpeedLimit = {
36
36
  speed: number;
37
37
  isTemporary: boolean;
38
38
  };
@@ -43,7 +43,7 @@ export type Data = {
43
43
  electrifications: LayerData<ElectrificationValues>[];
44
44
  slopes: LayerData<number>[];
45
45
  mrsp?: ValuesAlongPath<SpeedLimit>;
46
- electricalProfiles?: LayerData<ElectricalPofilelValues>[];
46
+ electricalProfiles?: LayerData<ElectricalProfileValues>[];
47
47
  powerRestrictions?: LayerData<PowerRestrictionValues>[];
48
48
  speedLimitTags?: LayerData<SpeedLimitTagValues>[];
49
49
  trainLength: number;
@@ -112,3 +112,4 @@ export type tooltipInfos = {
112
112
  export type ColorDictionary = {
113
113
  [key: string]: string;
114
114
  };
115
+ export {};