@osrd-project/ui-charts 0.0.68

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 (132) hide show
  1. package/README.md +63 -0
  2. package/dist/index.d.ts +5 -0
  3. package/dist/index.esm.js +2 -0
  4. package/dist/index.esm.js.map +1 -0
  5. package/dist/manchette/components/Manchette.d.ts +16 -0
  6. package/dist/manchette/components/ManchetteWithSpaceTimeChart.d.ts +22 -0
  7. package/dist/manchette/components/Waypoint.d.ts +10 -0
  8. package/dist/manchette/components/WaypointList.d.ts +9 -0
  9. package/dist/manchette/consts.d.ts +15 -0
  10. package/dist/manchette/hooks/useManchetteWithSpaceTimeChart.d.ts +66 -0
  11. package/dist/manchette/hooks/usePaths.d.ts +13 -0
  12. package/dist/manchette/index.d.ts +9 -0
  13. package/dist/manchette/types.d.ts +26 -0
  14. package/dist/manchette/utils/__tests__/helpers.spec.d.ts +1 -0
  15. package/dist/manchette/utils/helpers.d.ts +31 -0
  16. package/dist/manchette/utils/index.d.ts +12 -0
  17. package/dist/spaceTimeChart/__tests__/canvas.spec.d.ts +1 -0
  18. package/dist/spaceTimeChart/__tests__/geometry.spec.d.ts +1 -0
  19. package/dist/spaceTimeChart/__tests__/paths.spec.d.ts +1 -0
  20. package/dist/spaceTimeChart/__tests__/scales.spec.d.ts +1 -0
  21. package/dist/spaceTimeChart/__tests__/snapping.spec.d.ts +1 -0
  22. package/dist/spaceTimeChart/components/ConflictLayer.d.ts +16 -0
  23. package/dist/spaceTimeChart/components/ConflictTooltip.d.ts +13 -0
  24. package/dist/spaceTimeChart/components/OccupancyBlockLayer.d.ts +11 -0
  25. package/dist/spaceTimeChart/components/PathLayer.d.ts +36 -0
  26. package/dist/spaceTimeChart/components/PatternRect.d.ts +8 -0
  27. package/dist/spaceTimeChart/components/SpaceGraduations.d.ts +2 -0
  28. package/dist/spaceTimeChart/components/SpaceTimeChart.d.ts +3 -0
  29. package/dist/spaceTimeChart/components/TimeCaptions.d.ts +3 -0
  30. package/dist/spaceTimeChart/components/TimeGraduations.d.ts +2 -0
  31. package/dist/spaceTimeChart/components/WorkScheduleLayer.d.ts +14 -0
  32. package/dist/spaceTimeChart/components/ZoomRect.d.ts +2 -0
  33. package/dist/spaceTimeChart/config.d.ts +4 -0
  34. package/dist/spaceTimeChart/hooks/useCanvas.d.ts +19 -0
  35. package/dist/spaceTimeChart/hooks/useDevicePixelRatio.d.ts +1 -0
  36. package/dist/spaceTimeChart/hooks/useMouseInteractions.d.ts +8 -0
  37. package/dist/spaceTimeChart/hooks/useMouseTracking.d.ts +6 -0
  38. package/dist/spaceTimeChart/hooks/useSize.d.ts +8 -0
  39. package/dist/spaceTimeChart/index.d.ts +9 -0
  40. package/dist/spaceTimeChart/lib/consts.d.ts +20 -0
  41. package/dist/spaceTimeChart/lib/context.d.ts +16 -0
  42. package/dist/spaceTimeChart/lib/theme.d.ts +2 -0
  43. package/dist/spaceTimeChart/lib/types.d.ts +209 -0
  44. package/dist/spaceTimeChart/stories/additional-data.stories.d.ts +20 -0
  45. package/dist/spaceTimeChart/stories/base-rendering.stories.d.ts +28 -0
  46. package/dist/spaceTimeChart/stories/custom-styles.stories.d.ts +24 -0
  47. package/dist/spaceTimeChart/stories/horizontal-zoom.stories.d.ts +31 -0
  48. package/dist/spaceTimeChart/stories/layers.stories.d.ts +9 -0
  49. package/dist/spaceTimeChart/stories/lib/components.d.ts +15 -0
  50. package/dist/spaceTimeChart/stories/lib/paths.d.ts +16 -0
  51. package/dist/spaceTimeChart/stories/lib/utils.d.ts +22 -0
  52. package/dist/spaceTimeChart/stories/measuring.stories.d.ts +20 -0
  53. package/dist/spaceTimeChart/stories/options.stories.d.ts +27 -0
  54. package/dist/spaceTimeChart/stories/paths-interactions.stories.d.ts +24 -0
  55. package/dist/spaceTimeChart/stories/performances.stories.d.ts +25 -0
  56. package/dist/spaceTimeChart/stories/rectangle-zoom.stories.d.ts +40 -0
  57. package/dist/spaceTimeChart/stories/scroll-navigation.stories.d.ts +19 -0
  58. package/dist/spaceTimeChart/stories/split.stories.d.ts +21 -0
  59. package/dist/spaceTimeChart/stories/stage-interactions.stories.d.ts +25 -0
  60. package/dist/spaceTimeChart/stories/work-schedules.stories.d.ts +31 -0
  61. package/dist/spaceTimeChart/types.d.ts +6 -0
  62. package/dist/spaceTimeChart/utils/__tests__/canvas.spec.d.ts +1 -0
  63. package/dist/spaceTimeChart/utils/canvas.d.ts +55 -0
  64. package/dist/spaceTimeChart/utils/colors.d.ts +13 -0
  65. package/dist/spaceTimeChart/utils/events.d.ts +12 -0
  66. package/dist/spaceTimeChart/utils/geometry.d.ts +13 -0
  67. package/dist/spaceTimeChart/utils/paths.d.ts +16 -0
  68. package/dist/spaceTimeChart/utils/png.d.ts +5 -0
  69. package/dist/spaceTimeChart/utils/scales.d.ts +45 -0
  70. package/dist/spaceTimeChart/utils/snapping.d.ts +10 -0
  71. package/dist/spaceTimeChart/utils/vectors.d.ts +2 -0
  72. package/dist/speedSpaceChart/__tests__/utils.spec.d.ts +1 -0
  73. package/dist/speedSpaceChart/components/SpeedSpaceChart.d.ts +31 -0
  74. package/dist/speedSpaceChart/components/common/DetailsBox.d.ts +19 -0
  75. package/dist/speedSpaceChart/components/common/InteractionButtons.d.ts +9 -0
  76. package/dist/speedSpaceChart/components/common/SettingsPanel.d.ts +13 -0
  77. package/dist/speedSpaceChart/components/common/Tooltip.d.ts +9 -0
  78. package/dist/speedSpaceChart/components/const.d.ts +53 -0
  79. package/dist/speedSpaceChart/components/helpers/drawElements/axisY.d.ts +2 -0
  80. package/dist/speedSpaceChart/components/helpers/drawElements/curve.d.ts +2 -0
  81. package/dist/speedSpaceChart/components/helpers/drawElements/declivity.d.ts +2 -0
  82. package/dist/speedSpaceChart/components/helpers/drawElements/electricalProfile.d.ts +2 -0
  83. package/dist/speedSpaceChart/components/helpers/drawElements/powerRestrictions.d.ts +2 -0
  84. package/dist/speedSpaceChart/components/helpers/drawElements/reticle.d.ts +13 -0
  85. package/dist/speedSpaceChart/components/helpers/drawElements/speedLimitTags.d.ts +3 -0
  86. package/dist/speedSpaceChart/components/helpers/drawElements/speedLimits.d.ts +2 -0
  87. package/dist/speedSpaceChart/components/helpers/drawElements/steps.d.ts +2 -0
  88. package/dist/speedSpaceChart/components/helpers/drawElements/tickX.d.ts +2 -0
  89. package/dist/speedSpaceChart/components/helpers/drawElements/tickYRight.d.ts +2 -0
  90. package/dist/speedSpaceChart/components/helpers/frontFrame.d.ts +2 -0
  91. package/dist/speedSpaceChart/components/helpers/layersManager.d.ts +4 -0
  92. package/dist/speedSpaceChart/components/hooks.d.ts +11 -0
  93. package/dist/speedSpaceChart/components/layers/CurveLayer.d.ts +9 -0
  94. package/dist/speedSpaceChart/components/layers/DeclivityLayer.d.ts +9 -0
  95. package/dist/speedSpaceChart/components/layers/ElectricalProfileLayer.d.ts +9 -0
  96. package/dist/speedSpaceChart/components/layers/FrontInteractivityLayer.d.ts +10 -0
  97. package/dist/speedSpaceChart/components/layers/PowerRestrictionsLayer.d.ts +9 -0
  98. package/dist/speedSpaceChart/components/layers/ReticleLayer.d.ts +10 -0
  99. package/dist/speedSpaceChart/components/layers/SpeedLimitTagsLayer.d.ts +9 -0
  100. package/dist/speedSpaceChart/components/layers/SpeedLimitsLayer.d.ts +9 -0
  101. package/dist/speedSpaceChart/components/layers/StepsLayer.d.ts +9 -0
  102. package/dist/speedSpaceChart/components/layers/TickLayerX.d.ts +9 -0
  103. package/dist/speedSpaceChart/components/layers/TickLayerY.d.ts +9 -0
  104. package/dist/speedSpaceChart/components/layers/TickLayerYRight.d.ts +9 -0
  105. package/dist/speedSpaceChart/components/layers/index.d.ts +12 -0
  106. package/dist/speedSpaceChart/components/utils.d.ts +115 -0
  107. package/dist/speedSpaceChart/index.d.ts +3 -0
  108. package/dist/speedSpaceChart/stories/SpeedSpaceChart.stories.d.ts +8 -0
  109. package/dist/speedSpaceChart/stories/assets/const.d.ts +70 -0
  110. package/dist/speedSpaceChart/stories/assets/path_properties_PMP_LM.d.ts +2 -0
  111. package/dist/speedSpaceChart/stories/assets/power_restrictions_PMP_LM.d.ts +7 -0
  112. package/dist/speedSpaceChart/stories/assets/simulation_PMP_LM.d.ts +2 -0
  113. package/dist/speedSpaceChart/stories/assets/speed_limit_tags_PMP_LM.d.ts +9 -0
  114. package/dist/speedSpaceChart/stories/utils.d.ts +5 -0
  115. package/dist/speedSpaceChart/types/chartTypes.d.ts +114 -0
  116. package/dist/speedSpaceChart/types/simulationTypes.d.ts +47 -0
  117. package/dist/theme.css +6490 -0
  118. package/dist/theme.css.map +1 -0
  119. package/dist/trackOccupancyDiagram/__tests__/utils.spec.d.ts +1 -0
  120. package/dist/trackOccupancyDiagram/components/TrackOccupancyCanvas.d.ts +4 -0
  121. package/dist/trackOccupancyDiagram/components/TrackOccupancyManchette.d.ts +4 -0
  122. package/dist/trackOccupancyDiagram/components/consts.d.ts +30 -0
  123. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZones.d.ts +15 -0
  124. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZonesTexts.d.ts +10 -0
  125. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawTrack.d.ts +11 -0
  126. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawTracks.d.ts +16 -0
  127. package/dist/trackOccupancyDiagram/components/layers/OccupancyZonesLayer.d.ts +11 -0
  128. package/dist/trackOccupancyDiagram/components/layers/TracksLayer.d.ts +5 -0
  129. package/dist/trackOccupancyDiagram/components/types.d.ts +33 -0
  130. package/dist/trackOccupancyDiagram/components/utils.d.ts +24 -0
  131. package/dist/trackOccupancyDiagram/index.d.ts +3 -0
  132. package/package.json +60 -0
@@ -0,0 +1,55 @@
1
+ import type { SpaceTimeChartContextType, Direction, PathEnd, Point, RGBAColor, RGBColor } from '../lib/types';
2
+ /**
3
+ * This function draws a thick lines from "from" to "to" on the given ImageData, with no
4
+ * antialiasing. This is very useful to handle picking, since it is not possible to disable
5
+ * antialiasing with the native JavaScript canvas APIs.
6
+ */
7
+ export declare function drawAliasedLine(imageData: ImageData, from: Point, to: Point, [r, g, b]: RGBColor | RGBAColor, thickness: number, drawOnBottom: boolean, number?: number): void;
8
+ export declare function getAliasedDiscShape(radius: number): Uint8Array;
9
+ /**
10
+ * This function draws an aliased disc, using a shape computed by getDiscShape.
11
+ */
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;
14
+ export declare function drawPathStopExtremity(ctx: CanvasRenderingContext2D, timePixel: number, spacePixel: number, swapAxis: boolean): void;
15
+ export declare function drawPathOutExtremity(ctx: CanvasRenderingContext2D, timePixel: number, spacePixel: number, swapAxis: boolean, extremityType: 'from' | 'to', pathDirection: Direction): void;
16
+ /**
17
+ * This function draws a path extremity.
18
+ */
19
+ export declare function drawPathExtremity(ctx: CanvasRenderingContext2D, timePixel: number, spacePixel: number, swapAxis: boolean, extremityType: 'from' | 'to', pathDirection: Direction, pathEnd: PathEnd): void;
20
+ /**
21
+ *
22
+ * @param minT number timestamp
23
+ * @param maxT number timestamp
24
+ * @param timeRanges time frames (24h, 12h, 6h, …)
25
+ * @param gridlinesLevels width of the lines for each time frame
26
+ * @param formatter function to format de values inside the output object
27
+ * @returns Record<number, number>
28
+ * Keys are times in ms
29
+ * Values are the highest level on each time
30
+ */
31
+ export declare function computeVisibleTimeMarkers<T>(minT: number, maxT: number, timeRanges: number[], gridlinesLevels: number[], formatter?: (level: number, i: number) => T): Record<number, T>;
32
+ /**
33
+ * To get crisp horizontal or vertical lines on a canvas, we must draw them as thin as possible, in
34
+ * terms of actual pixels on screen.
35
+ * The best way for this is:
36
+ * - To center lines 1, 3, 5... pixels wide in the middle of a pixel
37
+ * - To center lines 2, 4, 6... pixels wide between two pixels
38
+ * @param rawCoordinate Any input coordinate to fix
39
+ * @param lineWidth The width of the line to draw
40
+ * @param devicePixelRatio
41
+ */
42
+ export declare function getCrispLineCoordinate(rawCoordinate: number, lineWidth: number, devicePixelRatio?: number): number;
43
+ export type CanvasRect = {
44
+ timeStart: Date;
45
+ timeEnd: Date;
46
+ spaceStart: number;
47
+ spaceEnd: number;
48
+ };
49
+ export declare function fillRect(ctx: CanvasRenderingContext2D, rect: CanvasRect, spaceTimeContext: SpaceTimeChartContextType): {
50
+ areaTimeSize?: undefined;
51
+ areaSpaceSize?: undefined;
52
+ } | {
53
+ areaTimeSize: number;
54
+ areaSpaceSize: number;
55
+ };
@@ -0,0 +1,13 @@
1
+ import { type RGBAColor } from '../lib/types';
2
+ /**
3
+ * This function returns a unique hex color corresponding to the given index. The colors are
4
+ * generated as #000001, #000002 ... #0000ff, #000100 etc.
5
+ * These colors aim at representing the given indices on the picking layer.
6
+ */
7
+ export declare function indexToColor(index: number): string;
8
+ /**
9
+ * This function returns the index corresponding to the given color.
10
+ */
11
+ export declare function colorToIndex(color: string): number;
12
+ export declare function rgbToHex(r: number, g: number, b: number): string;
13
+ export declare function hexToRgb(color: string): RGBAColor;
@@ -0,0 +1,12 @@
1
+ import { type Point } from '../lib/types';
2
+ /**
3
+ * This function takes a MouseEvent and an HTMLElement, and returns the position of the mouse,
4
+ * relatively to the DOM element. This allows for instance dragging an element that is on the given
5
+ * DOM element while the events are bound to the document or the body.
6
+ */
7
+ export declare function getEventPosition(e: MouseEvent, dom: HTMLElement): Point;
8
+ /**
9
+ * This function returns a delta value for a given WheelEvent. It can be very useful, since the
10
+ * given `deltaY` and `detail` attributes are not normalized.
11
+ */
12
+ export declare function getEventWheelDelta(e: WheelEvent): number;
@@ -0,0 +1,13 @@
1
+ import { type Point } from '../lib/types';
2
+ /**
3
+ * This function helps to find if two segments do intersect.
4
+ */
5
+ export declare function intersectsSegments(s1From: Point, s1To: Point, s2From: Point, s2To: Point): boolean;
6
+ /**
7
+ * This functions helps to find if a segment intersects with a stage of width x height pixels.
8
+ */
9
+ export declare function isSegmentOnScreen(width: number, height: number, from: Point, to: Point): boolean;
10
+ /**
11
+ * This functions helps to find if a path intersects with a stage of width x height pixels.
12
+ */
13
+ export declare function isPathOnScreen(width: number, height: number, points: Point[]): boolean;
@@ -0,0 +1,16 @@
1
+ import type { Direction, PathData, SpaceToPixel } from '../lib/types';
2
+ /**
3
+ * This function takes a path, a point index and looks forward in the points order for the first
4
+ * position variation. It then returns "forward" or "backward" according to that variation.
5
+ *
6
+ * If it does not find any variation for some reason, it returns "still" instead.
7
+ *
8
+ * Finally, if `reversed` is true, then, it searches points in the other direction.
9
+ */
10
+ export declare function getPathDirection({ points }: PathData, index: number, reversed?: boolean): Direction;
11
+ /**
12
+ * This function takes a SpaceToPixel function and a position, and checks if the function returns
13
+ * the same pixel for the position, starting from both sides. It then returns one or two pixel
14
+ * positions accordingly.
15
+ */
16
+ export declare function getSpacePixels(getSpacePixel: SpaceToPixel, position: number): [number] | [number, number];
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This function captures a list of canvas layers into a PNG image, and returns a blob with the
3
+ * PNG data if possible.
4
+ */
5
+ export default function getPNGBlob(canvases: Record<string, HTMLCanvasElement>, layers: readonly string[], backgroundColor?: string): Promise<Blob>;
@@ -0,0 +1,45 @@
1
+ import { type NormalizedScaleTree, type NormalizedScale, type SpaceScale, type SpaceToPixel, type TimeToPixel, type PixelToTime, type PixelToSpace, type PointToData, type DataToPoint, type Axis, type PathData } from '../lib/types';
2
+ /**
3
+ * This function helps to index a sequence of consecutive scales into a binary tree, to make it
4
+ * faster to find which scale contains any given position.
5
+ *
6
+ * The optional `skipSiblingReferences` option allows getting a serializable tree, for testing
7
+ * purpose.
8
+ */
9
+ export declare function spaceScalesToBinaryTree(spaceOrigin: number, spaceScales: SpaceScale[], skipSiblingReferences?: boolean): NormalizedScaleTree;
10
+ /**
11
+ * This function takes a NormalizedScaleTree and a position, and returns the leaf node from the
12
+ * tree that contains that position.
13
+ *
14
+ * Also, if the position is lower than the tree's min (tree.from), then the first leaf is returned
15
+ * and if it is higher than the max (tree.to), the last leaf is returned.
16
+ *
17
+ * Finally, if pickLast is truthy, then it returns the last leaf node that contains that position
18
+ * instead of the first one. It is very important when there are flat sections.
19
+ */
20
+ export declare function getNormalizedScaleAtPosition(position: number, tree: NormalizedScaleTree, pickLast?: boolean): NormalizedScale;
21
+ /**
22
+ * This function takes a NormalizedScaleTree and a pixel position, and returns the leaf node from
23
+ * the tree that contains that pixel.
24
+ *
25
+ * Also, if the position is lower than the tree's min pixel (tree.pixelFrom), then the first leaf
26
+ * is returned and if it is higher than the max pixel (tree.pixelTo), the last leaf is returned.
27
+ */
28
+ export declare function getNormalizedScaleAtPixel(y: number, tree: NormalizedScaleTree): NormalizedScale;
29
+ export declare function getTimeToPixel(timeOrigin: number, pixelOffset: number, timeScale: number): TimeToPixel;
30
+ export declare function getPixelToTime(timeOrigin: number, pixelOffset: number, timeScale: number): PixelToTime;
31
+ export declare function getSpaceToPixel(pixelOffset: number, binaryTree: NormalizedScaleTree): SpaceToPixel;
32
+ export declare function getPixelToSpace(spaceOrigin: number, pixelOffset: number, binaryTree: NormalizedScaleTree): PixelToSpace;
33
+ export declare function getPointToData(getTime: PixelToTime, getSpace: PixelToSpace, timeAxis: Axis, spaceAxis: Axis): PointToData;
34
+ export declare function getDataToPoint(getTimePixel: TimeToPixel, getSpacePixel: SpaceToPixel, timeAxis: Axis, spaceAxis: Axis): DataToPoint;
35
+ /**
36
+ * This function takes a path and a time, a returns the position of the train at the given time, or
37
+ * the position at the closest time to the path existence.
38
+ */
39
+ export declare function getSpaceAtTime(path: PathData, time: number): number;
40
+ /**
41
+ * This function helps to find where to "break" a straight line that crosses separations between
42
+ * different time scales. It takes two positions (in the "space" space), and returns an array of
43
+ * positions between these the two input positions (the array can be empty).
44
+ */
45
+ export declare function getSpaceBreakpoints(from: number, to: number, tree: NormalizedScaleTree): number[];
@@ -0,0 +1,10 @@
1
+ import { type HoveredItem, type Point } from '../lib/types';
2
+ /**
3
+ * This function takes a point and a segment, and returns the point of the segment that is the
4
+ * closest to the input point.
5
+ */
6
+ export declare function getClosestPointOnSegment(point: Point, segmentFrom: Point, segmentTo: Point): Point;
7
+ /**
8
+ * This function helps to handle snapping with a SpaceTimeChat instance.
9
+ */
10
+ export declare function snapPosition(mousePosition: Point, hoveredItem: HoveredItem | null): Point;
@@ -0,0 +1,2 @@
1
+ import { type Point } from '../lib/types';
2
+ export declare function getDiff(a: Point, b: Point): Point;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import type { Data } from '../types/chartTypes';
3
+ export type SpeedSpaceChartProps = {
4
+ width: number;
5
+ height: number;
6
+ backgroundColor: string;
7
+ setHeight: React.Dispatch<React.SetStateAction<number>>;
8
+ data: Data;
9
+ translations?: {
10
+ detailsBoxDisplay: {
11
+ reticleInfos: string;
12
+ energySource: string;
13
+ tractionStatus: string;
14
+ declivities: string;
15
+ electricalProfiles: string;
16
+ powerRestrictions: string;
17
+ };
18
+ layersDisplay: {
19
+ context: string;
20
+ steps: string;
21
+ declivities: string;
22
+ speedLimits: string;
23
+ temporarySpeedLimits: string;
24
+ electricalProfiles: string;
25
+ powerRestrictions: string;
26
+ speedLimitTags: string;
27
+ };
28
+ };
29
+ };
30
+ declare const SpeedSpaceChart: ({ width, height, backgroundColor, data, setHeight, translations, }: SpeedSpaceChartProps) => React.JSX.Element;
31
+ export default SpeedSpaceChart;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type DetailsBoxProps = {
4
+ width: number;
5
+ height: number;
6
+ store: Store;
7
+ curveX: number;
8
+ curveY: number;
9
+ speedText: string;
10
+ ecoSpeedText: string;
11
+ effortText: string;
12
+ electricalModeText: string;
13
+ electricalProfileText: string;
14
+ powerRestrictionText: string;
15
+ previousGradientText: number;
16
+ modeText: string;
17
+ };
18
+ declare const DetailsBox: ({ width, height, store, curveX, curveY, speedText, ecoSpeedText, effortText, electricalModeText, electricalProfileText, powerRestrictionText, previousGradientText, modeText, }: DetailsBoxProps) => React.JSX.Element;
19
+ export default DetailsBox;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type InteractionButtonsProps = {
4
+ reset: () => void;
5
+ openSettingsPanel: () => void;
6
+ store: Store;
7
+ };
8
+ declare const InteractionButtons: ({ reset, openSettingsPanel, store }: InteractionButtonsProps) => React.JSX.Element;
9
+ export default InteractionButtons;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ import type { SpeedSpaceChartProps } from '../SpeedSpaceChart';
4
+ type SettingsPanelProps = {
5
+ globalHeight: number;
6
+ color: string;
7
+ store: Store;
8
+ setStore: React.Dispatch<React.SetStateAction<Store>>;
9
+ setIsMouseHoveringSettingsPanel: React.Dispatch<React.SetStateAction<boolean>>;
10
+ translations?: SpeedSpaceChartProps['translations'];
11
+ };
12
+ declare const SettingsPanel: ({ globalHeight, color, store, setStore, setIsMouseHoveringSettingsPanel, translations, }: SettingsPanelProps) => React.JSX.Element;
13
+ export default SettingsPanel;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ type TooltipProps = {
3
+ cursorX: number;
4
+ cursorY: number;
5
+ height: number;
6
+ text: string;
7
+ };
8
+ declare const Tooltip: ({ cursorX, cursorY, height, text }: TooltipProps) => React.JSX.Element;
9
+ export default Tooltip;
@@ -0,0 +1,53 @@
1
+ import chroma from 'chroma-js';
2
+ import { type ColorDictionary, type Store } from '../types/chartTypes';
3
+ export declare const SLOPE_FILL_COLOR = "#CFDDCE";
4
+ export declare const RIGHT_TICK_HEIGHT_OFFSET = 2;
5
+ export declare const TICK_TITLE_MARGINS: {
6
+ Y_LEFT_VERTICAL: number;
7
+ Y_LEFT_HORIZONTAL: number;
8
+ Y_RIGHT_VERTICAL: number;
9
+ Y_RIGHT_HORIZONTAL: number;
10
+ };
11
+ export declare const MARGINS: {
12
+ MARGIN_LEFT: number;
13
+ MARGIN_RIGHT: number;
14
+ MARGIN_TOP: number;
15
+ MARGIN_BOTTOM: number;
16
+ CURVE_MARGIN_TOP: number;
17
+ CURVE_MARGIN_SIDES: number;
18
+ ELECTRICAL_PROFILES_MARGIN_TOP: number;
19
+ RIGHT_TICK_MARGINS: number;
20
+ OFFSET_RIGHT_AXIS: number;
21
+ };
22
+ export declare const CURSOR_SNAP_DISTANCE = 6;
23
+ export declare const LINEAR_LAYERS_HEIGHTS: {
24
+ ELECTRICAL_PROFILES_HEIGHT: number;
25
+ POWER_RESTRICTIONS_HEIGHT: number;
26
+ SPEED_LIMIT_TAGS_HEIGHT: number;
27
+ };
28
+ export declare const LINEAR_LAYERS_HEIGHTS_BY_NAME: {
29
+ electricalProfiles: number;
30
+ powerRestrictions: number;
31
+ speedLimitTags: number;
32
+ };
33
+ export declare const LINEAR_LAYER_SEPARATOR_HEIGHT = 1;
34
+ export declare const LINEAR_LAYERS_BACKGROUND_COLOR: {
35
+ FIRST: string;
36
+ SECOND: string;
37
+ THIRD: string;
38
+ };
39
+ export declare const FRONT_INTERACTIVITY_LAYER_ID = "#front-interactivity-layer";
40
+ export declare const DETAILS_BOX_SELECTION: Array<keyof Store['detailsBoxDisplay']>;
41
+ export declare const LAYERS_SELECTION: Array<keyof Store['layersDisplay']>;
42
+ export declare const BLACK: chroma.Color;
43
+ export declare const ERROR_30: chroma.Color;
44
+ export declare const ERROR_60: chroma.Color;
45
+ export declare const GREY_50: chroma.Color;
46
+ export declare const GREY_80: chroma.Color;
47
+ export declare const LIGHT_BLUE: chroma.Color;
48
+ export declare const WARNING_30: chroma.Color;
49
+ export declare const WHITE: chroma.Color;
50
+ /**
51
+ * COLOR_DICTIONARY maps specific colors to their corresponding secondary colors used for speed limit tags.
52
+ */
53
+ export declare const COLOR_DICTIONARY: ColorDictionary;
@@ -0,0 +1,2 @@
1
+ import type { DrawFunctionParams } from '../../../types/chartTypes';
2
+ export declare const drawAxisY: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -0,0 +1,2 @@
1
+ import type { DrawFunctionParams } from '../../../types/chartTypes';
2
+ export declare const drawCurve: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -0,0 +1,2 @@
1
+ import type { DrawFunctionParams } from '../../../types/chartTypes';
2
+ export declare const drawDeclivity: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -0,0 +1,2 @@
1
+ import type { DrawFunctionParams } from '../../../types/chartTypes';
2
+ export declare const drawElectricalProfile: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -0,0 +1,2 @@
1
+ import type { DrawFunctionParams } from '../../../types/chartTypes';
2
+ export declare const drawPowerRestrictions: ({ ctx, width, height: marginTop, store, }: DrawFunctionParams) => void;
@@ -0,0 +1,13 @@
1
+ import type { DrawFunctionParams } from '../../../types/chartTypes';
2
+ export declare const drawCursor: ({ ctx, width, height, store }: DrawFunctionParams) => {
3
+ curveX: number;
4
+ curveY: number;
5
+ speedText: string;
6
+ ecoSpeedText: string;
7
+ effortText: string;
8
+ electricalModeText: string;
9
+ electricalProfileText: string;
10
+ powerRestrictionText: string;
11
+ previousGradientText: number;
12
+ modeText: string;
13
+ } | undefined;
@@ -0,0 +1,3 @@
1
+ import type { DrawFunctionParams, SpeedLimitTagsLayerDrawFunctionParams, tooltipInfos } from '../../../types/chartTypes';
2
+ export declare const drawSpeedLimitTags: ({ ctx, width, height: marginTop, store, images, }: SpeedLimitTagsLayerDrawFunctionParams) => void;
3
+ export declare const computeTooltip: ({ width, height: marginTop, store, }: DrawFunctionParams) => tooltipInfos | null;
@@ -0,0 +1,2 @@
1
+ import type { DrawFunctionParams } from '../../../types/chartTypes';
2
+ export declare const drawSpeedLimits: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -0,0 +1,2 @@
1
+ import type { DrawFunctionParams } from '../../../types/chartTypes';
2
+ export declare const drawSteps: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -0,0 +1,2 @@
1
+ import type { DrawFunctionParams } from '../../../types/chartTypes';
2
+ export declare const drawTickX: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -0,0 +1,2 @@
1
+ import type { DrawFunctionParams } from '../../../types/chartTypes';
2
+ export declare const drawTickYRight: ({ ctx, width, height, store }: DrawFunctionParams) => void;
@@ -0,0 +1,2 @@
1
+ import type { DrawFunctionParams } from '../../types/chartTypes';
2
+ export declare const drawFrame: ({ ctx, width, height, store, setStore }: DrawFunctionParams) => void;
@@ -0,0 +1,4 @@
1
+ import * as d3zoom from 'd3-zoom';
2
+ import type { Store } from '../../types/chartTypes';
3
+ export declare const resetZoom: () => void;
4
+ export declare const zoom: (setStore: React.Dispatch<React.SetStateAction<Store>>) => d3zoom.ZoomBehavior<Element, unknown>;
@@ -0,0 +1,11 @@
1
+ import type { DrawFunctionParams, Store } from '../types/chartTypes';
2
+ type DrawFunction = (params: DrawFunctionParams) => void;
3
+ type UseCanvasParams = {
4
+ width: number;
5
+ height: number;
6
+ store: Store;
7
+ setStore?: React.Dispatch<React.SetStateAction<Store>>;
8
+ };
9
+ type UseCanvas = (draw: DrawFunction, params: UseCanvasParams) => React.RefObject<HTMLCanvasElement>;
10
+ export declare const useCanvas: UseCanvas;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type CurveLayerProps = {
4
+ width: number;
5
+ height: number;
6
+ store: Store;
7
+ };
8
+ declare const CurveLayer: ({ width, height, store }: CurveLayerProps) => React.JSX.Element;
9
+ export default CurveLayer;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type DeclivityLayerProps = {
4
+ width: number;
5
+ height: number;
6
+ store: Store;
7
+ };
8
+ declare const DeclivityLayer: ({ width, height, store }: DeclivityLayerProps) => React.JSX.Element;
9
+ export default DeclivityLayer;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type ElectricalProfileLayerProps = {
4
+ width: number;
5
+ height: number;
6
+ store: Store;
7
+ };
8
+ declare const ElectricalProfileLayer: ({ width, height, store }: ElectricalProfileLayerProps) => React.JSX.Element;
9
+ export default ElectricalProfileLayer;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type FrontInteractivityLayerProps = {
4
+ width: number;
5
+ height: number;
6
+ store: Store;
7
+ setStore: React.Dispatch<React.SetStateAction<Store>>;
8
+ };
9
+ declare const FrontInteractivityLayer: ({ width, height, store, setStore, }: FrontInteractivityLayerProps) => React.JSX.Element;
10
+ export default FrontInteractivityLayer;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type PowerRestrictionsLayerProps = {
4
+ width: number;
5
+ marginTop: number;
6
+ store: Store;
7
+ };
8
+ declare const PowerRestrictionsLayer: ({ width, marginTop, store }: PowerRestrictionsLayerProps) => React.JSX.Element;
9
+ export default PowerRestrictionsLayer;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type ReticleLayerProps = {
4
+ width: number;
5
+ height: number;
6
+ heightOffset: number;
7
+ store: Store;
8
+ };
9
+ declare const ReticleLayer: ({ width, height, heightOffset, store }: ReticleLayerProps) => React.JSX.Element;
10
+ export default ReticleLayer;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type SpeedLimitTagsLayerProps = {
4
+ width: number;
5
+ marginTop: number;
6
+ store: Store;
7
+ };
8
+ declare const SpeedLimitTagsLayer: ({ width, marginTop, store }: SpeedLimitTagsLayerProps) => React.JSX.Element;
9
+ export default SpeedLimitTagsLayer;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type SpeedLimitsLayerProps = {
4
+ width: number;
5
+ height: number;
6
+ store: Store;
7
+ };
8
+ declare const SpeedLimitsLayer: ({ width, height, store }: SpeedLimitsLayerProps) => React.JSX.Element;
9
+ export default SpeedLimitsLayer;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type StepsLayerProps = {
4
+ width: number;
5
+ height: number;
6
+ store: Store;
7
+ };
8
+ declare const StepsLayer: ({ width, height, store }: StepsLayerProps) => React.JSX.Element;
9
+ export default StepsLayer;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type TickLayerXProps = {
4
+ width: number;
5
+ height: number;
6
+ store: Store;
7
+ };
8
+ declare const TickLayerX: ({ width, height, store }: TickLayerXProps) => React.JSX.Element;
9
+ export default TickLayerX;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type TickLayerYProps = {
4
+ width: number;
5
+ height: number;
6
+ store: Store;
7
+ };
8
+ declare const AxisLayerY: ({ width, height, store }: TickLayerYProps) => React.JSX.Element;
9
+ export default AxisLayerY;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Store } from '../../types/chartTypes';
3
+ type TickLayerYRightProps = {
4
+ width: number;
5
+ height: number;
6
+ store: Store;
7
+ };
8
+ declare const TickLayerYRight: ({ width, height, store }: TickLayerYRightProps) => React.JSX.Element;
9
+ export default TickLayerYRight;
@@ -0,0 +1,12 @@
1
+ export { default as StepsLayer } from './StepsLayer';
2
+ export { default as SpeedLimitsLayer } from './SpeedLimitsLayer';
3
+ export { default as CurveLayer } from './CurveLayer';
4
+ export { default as DeclivityLayer } from './DeclivityLayer';
5
+ export { default as ElectricalProfileLayer } from './ElectricalProfileLayer';
6
+ export { default as FrontInteractivityLayer } from './FrontInteractivityLayer';
7
+ export { default as PowerRestrictionsLayer } from './PowerRestrictionsLayer';
8
+ export { default as ReticleLayer } from './ReticleLayer';
9
+ export { default as SpeedLimitTagsLayer } from './SpeedLimitTagsLayer';
10
+ export { default as TickLayerX } from './TickLayerX';
11
+ export { default as AxisLayerY } from './TickLayerY';
12
+ export { default as TickLayerYRight } from './TickLayerYRight';