@osrd-project/ui-charts 0.0.83 → 0.0.85

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 (128) hide show
  1. package/dist/index.d.ts +1055 -7
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +7148 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/theme.css +1065 -3725
  6. package/package.json +17 -16
  7. package/dist/chronogram/components/Chronogram.d.ts +0 -3
  8. package/dist/chronogram/components/ChronogramCanvas.d.ts +0 -3
  9. package/dist/chronogram/components/ChronogramManchette.d.ts +0 -9
  10. package/dist/chronogram/components/OccupancyBlocksLayer.d.ts +0 -1
  11. package/dist/chronogram/hooks/useChronogram.d.ts +0 -35
  12. package/dist/chronogram/index.d.ts +0 -9
  13. package/dist/chronogram/lib/const.d.ts +0 -5
  14. package/dist/chronogram/lib/context.d.ts +0 -6
  15. package/dist/chronogram/lib/types.d.ts +0 -30
  16. package/dist/chronogram/utils/format.d.ts +0 -1
  17. package/dist/common/consts.d.ts +0 -5
  18. package/dist/common/context.d.ts +0 -2
  19. package/dist/common/helpers/colors.d.ts +0 -21
  20. package/dist/common/helpers/png.d.ts +0 -5
  21. package/dist/common/helpers/time.d.ts +0 -31
  22. package/dist/common/helpers/utils.d.ts +0 -8
  23. package/dist/common/hooks/useCanvas.d.ts +0 -16
  24. package/dist/common/hooks/useDevicePixelRatio.d.ts +0 -1
  25. package/dist/common/hooks/useMouseInteractions.d.ts +0 -41
  26. package/dist/common/hooks/useMouseTracking.d.ts +0 -6
  27. package/dist/common/hooks/useSize.d.ts +0 -7
  28. package/dist/common/index.d.ts +0 -5
  29. package/dist/common/layers/TimeCaptions.d.ts +0 -1
  30. package/dist/common/layers/TimeGraduations.d.ts +0 -2
  31. package/dist/common/types.d.ts +0 -104
  32. package/dist/index.esm.js +0 -6391
  33. package/dist/index.esm.js.map +0 -1
  34. package/dist/manchette/assets/sampleData.d.ts +0 -2
  35. package/dist/manchette/components/Manchette.d.ts +0 -23
  36. package/dist/manchette/components/ManchetteWithSpaceTimeChart.d.ts +0 -23
  37. package/dist/manchette/components/Waypoint.d.ts +0 -14
  38. package/dist/manchette/consts.d.ts +0 -15
  39. package/dist/manchette/hooks/useManchetteWithSpaceTimeChart.d.ts +0 -49
  40. package/dist/manchette/hooks/useSyncManchette.d.ts +0 -94
  41. package/dist/manchette/index.d.ts +0 -11
  42. package/dist/manchette/types.d.ts +0 -34
  43. package/dist/manchette/utils/__tests__/helpers.spec.d.ts +0 -1
  44. package/dist/manchette/utils/helpers.d.ts +0 -44
  45. package/dist/manchette/utils/index.d.ts +0 -13
  46. package/dist/spaceTimeChart/__tests__/canvas.spec.d.ts +0 -1
  47. package/dist/spaceTimeChart/__tests__/geometry.spec.d.ts +0 -1
  48. package/dist/spaceTimeChart/__tests__/paths.spec.d.ts +0 -1
  49. package/dist/spaceTimeChart/__tests__/scales.spec.d.ts +0 -1
  50. package/dist/spaceTimeChart/__tests__/snapping.spec.d.ts +0 -1
  51. package/dist/spaceTimeChart/components/ConflictLayer.d.ts +0 -16
  52. package/dist/spaceTimeChart/components/ConflictTooltip.d.ts +0 -13
  53. package/dist/spaceTimeChart/components/OccupancyBlockLayer.d.ts +0 -12
  54. package/dist/spaceTimeChart/components/PathLayer.d.ts +0 -37
  55. package/dist/spaceTimeChart/components/PatternRect.d.ts +0 -8
  56. package/dist/spaceTimeChart/components/Quadrilateral.d.ts +0 -26
  57. package/dist/spaceTimeChart/components/SpaceGraduations.d.ts +0 -2
  58. package/dist/spaceTimeChart/components/SpaceTimeChart.d.ts +0 -3
  59. package/dist/spaceTimeChart/components/Tooltip.d.ts +0 -7
  60. package/dist/spaceTimeChart/components/WorkScheduleLayer.d.ts +0 -19
  61. package/dist/spaceTimeChart/components/ZoomRect.d.ts +0 -2
  62. package/dist/spaceTimeChart/config.d.ts +0 -4
  63. package/dist/spaceTimeChart/index.d.ts +0 -17
  64. package/dist/spaceTimeChart/lib/consts.d.ts +0 -17
  65. package/dist/spaceTimeChart/lib/context.d.ts +0 -13
  66. package/dist/spaceTimeChart/lib/theme.d.ts +0 -2
  67. package/dist/spaceTimeChart/lib/types.d.ts +0 -129
  68. package/dist/spaceTimeChart/utils/__tests__/canvas.spec.d.ts +0 -1
  69. package/dist/spaceTimeChart/utils/__tests__/scales.spec.d.ts +0 -1
  70. package/dist/spaceTimeChart/utils/canvas.d.ts +0 -43
  71. package/dist/spaceTimeChart/utils/events.d.ts +0 -12
  72. package/dist/spaceTimeChart/utils/geometry.d.ts +0 -13
  73. package/dist/spaceTimeChart/utils/paths.d.ts +0 -16
  74. package/dist/spaceTimeChart/utils/scales.d.ts +0 -73
  75. package/dist/spaceTimeChart/utils/snapping.d.ts +0 -10
  76. package/dist/spaceTimeChart/utils/vectors.d.ts +0 -2
  77. package/dist/speedSpaceChart/__tests__/utils.spec.d.ts +0 -1
  78. package/dist/speedSpaceChart/components/SpeedSpaceChart.d.ts +0 -50
  79. package/dist/speedSpaceChart/components/common/DetailsBox.d.ts +0 -22
  80. package/dist/speedSpaceChart/components/common/InteractionButtons.d.ts +0 -10
  81. package/dist/speedSpaceChart/components/common/SettingsPanel.d.ts +0 -15
  82. package/dist/speedSpaceChart/components/common/Tooltip.d.ts +0 -9
  83. package/dist/speedSpaceChart/components/const.d.ts +0 -74
  84. package/dist/speedSpaceChart/components/helpers/drawElements/axisY.d.ts +0 -2
  85. package/dist/speedSpaceChart/components/helpers/drawElements/curve.d.ts +0 -2
  86. package/dist/speedSpaceChart/components/helpers/drawElements/declivity.d.ts +0 -2
  87. package/dist/speedSpaceChart/components/helpers/drawElements/electricalProfile.d.ts +0 -2
  88. package/dist/speedSpaceChart/components/helpers/drawElements/powerRestrictions.d.ts +0 -2
  89. package/dist/speedSpaceChart/components/helpers/drawElements/reticle.d.ts +0 -14
  90. package/dist/speedSpaceChart/components/helpers/drawElements/speedLimitTags.d.ts +0 -3
  91. package/dist/speedSpaceChart/components/helpers/drawElements/speedLimits.d.ts +0 -2
  92. package/dist/speedSpaceChart/components/helpers/drawElements/steps.d.ts +0 -2
  93. package/dist/speedSpaceChart/components/helpers/drawElements/tickX.d.ts +0 -2
  94. package/dist/speedSpaceChart/components/helpers/drawElements/tickYRight.d.ts +0 -2
  95. package/dist/speedSpaceChart/components/helpers/frontFrame.d.ts +0 -2
  96. package/dist/speedSpaceChart/components/helpers/layersManager.d.ts +0 -5
  97. package/dist/speedSpaceChart/components/hooks.d.ts +0 -11
  98. package/dist/speedSpaceChart/components/layers/CurveLayer.d.ts +0 -9
  99. package/dist/speedSpaceChart/components/layers/DeclivityLayer.d.ts +0 -9
  100. package/dist/speedSpaceChart/components/layers/ElectricalProfileLayer.d.ts +0 -9
  101. package/dist/speedSpaceChart/components/layers/FrontInteractivityLayer.d.ts +0 -10
  102. package/dist/speedSpaceChart/components/layers/PowerRestrictionsLayer.d.ts +0 -9
  103. package/dist/speedSpaceChart/components/layers/ReticleLayer.d.ts +0 -11
  104. package/dist/speedSpaceChart/components/layers/SpeedLimitTagsLayer.d.ts +0 -9
  105. package/dist/speedSpaceChart/components/layers/SpeedLimitsLayer.d.ts +0 -9
  106. package/dist/speedSpaceChart/components/layers/StepsLayer.d.ts +0 -9
  107. package/dist/speedSpaceChart/components/layers/TickLayerX.d.ts +0 -9
  108. package/dist/speedSpaceChart/components/layers/TickLayerY.d.ts +0 -9
  109. package/dist/speedSpaceChart/components/layers/TickLayerYRight.d.ts +0 -9
  110. package/dist/speedSpaceChart/components/layers/index.d.ts +0 -12
  111. package/dist/speedSpaceChart/components/utils.d.ts +0 -112
  112. package/dist/speedSpaceChart/index.d.ts +0 -5
  113. package/dist/speedSpaceChart/types.d.ts +0 -155
  114. package/dist/theme.css.map +0 -1
  115. package/dist/trackOccupancyDiagram/__tests__/utils.spec.d.ts +0 -1
  116. package/dist/trackOccupancyDiagram/components/TrackOccupancyCanvas.d.ts +0 -12
  117. package/dist/trackOccupancyDiagram/components/TrackOccupancyManchette.d.ts +0 -6
  118. package/dist/trackOccupancyDiagram/components/TrackOccupancyStandalone.d.ts +0 -10
  119. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZones.d.ts +0 -20
  120. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZonesTexts.d.ts +0 -10
  121. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawTrack.d.ts +0 -11
  122. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawTracks.d.ts +0 -8
  123. package/dist/trackOccupancyDiagram/components/layers/OccupancyZonesLayer.d.ts +0 -11
  124. package/dist/trackOccupancyDiagram/components/layers/TracksLayer.d.ts +0 -8
  125. package/dist/trackOccupancyDiagram/components/utils.d.ts +0 -24
  126. package/dist/trackOccupancyDiagram/index.d.ts +0 -7
  127. package/dist/trackOccupancyDiagram/lib/consts.d.ts +0 -32
  128. package/dist/trackOccupancyDiagram/lib/types.d.ts +0 -26
package/dist/index.d.ts CHANGED
@@ -1,7 +1,1055 @@
1
- import '@osrd-project/ui-core/dist/theme.css';
2
- export * from './chronogram';
3
- export * from './common';
4
- export * from './spaceTimeChart';
5
- export * from './manchette';
6
- export * from './speedSpaceChart';
7
- export * from './trackOccupancyDiagram';
1
+ import "@osrd-project/ui-core/dist/theme.css";
2
+ import React$1, { CSSProperties, HTMLProps, PropsWithChildren, ReactNode } from "react";
3
+ type SpaceScale = {
4
+ to: number;
5
+ } & ({
6
+ coefficient: number;
7
+ } | {
8
+ size: number;
9
+ });
10
+ type BinaryTreeNode<T> = T | {
11
+ limit: number;
12
+ from: number;
13
+ to: number;
14
+ pixelFrom: number;
15
+ pixelTo: number;
16
+ pixelLimit: number;
17
+ left: BinaryTreeNode<T>;
18
+ right: BinaryTreeNode<T>;
19
+ };
20
+ type NormalizedScale = {
21
+ coefficient: number;
22
+ from: number;
23
+ to: number;
24
+ pixelFrom: number;
25
+ pixelTo: number;
26
+ previous?: NormalizedScale;
27
+ next?: NormalizedScale;
28
+ };
29
+ type NormalizedScaleTree = BinaryTreeNode<NormalizedScale>;
30
+ type PathEnd = 'stop' | 'out';
31
+ type PathData = {
32
+ id: string;
33
+ label: string;
34
+ points: DataPoint[];
35
+ fromEnd?: PathEnd;
36
+ toEnd?: PathEnd;
37
+ };
38
+ type OperationalPoint = {
39
+ id: string;
40
+ position: number;
41
+ label?: string;
42
+ importanceLevel?: number;
43
+ };
44
+ type SpaceToPixel = (position: number, fromEnd?: boolean) => number;
45
+ type PixelToSpace = (y: number) => number;
46
+ type DataToPoint = (data: DataPoint) => Point;
47
+ type SpaceTimeChartTheme = BaseChartStyles & TimeChartStyles & SpaceChartStyles;
48
+ type SpaceTimeChartProps = {
49
+ children?: ReactNode | ReactNode[];
50
+ additionalChildren?: ReactNode | ReactNode[];
51
+ operationalPoints: OperationalPoint[];
52
+ spaceOrigin: number;
53
+ spaceScales: SpaceScale[];
54
+ timeOrigin: number;
55
+ timeScale: number;
56
+ xOffset?: number;
57
+ yOffset?: number;
58
+ swapAxis?: boolean;
59
+ enableSnapping?: boolean;
60
+ hideTimeCaptions?: boolean;
61
+ hideGrid?: boolean;
62
+ hidePathsLabels?: boolean;
63
+ hideDates?: boolean;
64
+ showTicks?: boolean;
65
+ /**
66
+ * When set, the time axis renders hours as signed integers relative to time
67
+ * origin 0 (…, -2, -1, 0, 1, 2, …) instead of localized clock times, and
68
+ * date captions are hidden. The value is the length (in ms) of one hourly
69
+ * timetable pattern iteration, so downstream layers (markers, pattern bars)
70
+ * can reuse it. Meant for repeating patterns (e.g. hourly timetables).
71
+ */
72
+ hourlyTimetableDuration?: number;
73
+ theme?: Partial<SpaceTimeChartTheme>;
74
+ } & ChartEventHandlers<SpaceTimeChartContextType>;
75
+ type SpaceTimeChartContextType = TimeChartContextType & {
76
+ timeAxis: Axis;
77
+ spaceAxis: Axis;
78
+ spaceOrigin: number;
79
+ spaceScaleTree: NormalizedScaleTree;
80
+ flatSteps: Set<number>;
81
+ getSpacePixel: SpaceToPixel;
82
+ getSpace: PixelToSpace;
83
+ operationalPoints: OperationalPoint[];
84
+ captionSize: number;
85
+ };
86
+ declare const PICKING_LAYERS: readonly ["paths", "overlay"];
87
+ declare const LAYERS: readonly ["background", "graduations", "paths", "overlay", "captions"];
88
+ type BaseChartContextType = {
89
+ fingerprint: string;
90
+ theme: {
91
+ background: string;
92
+ };
93
+ };
94
+ type Point = {
95
+ x: number;
96
+ y: number;
97
+ };
98
+ type Axis = 'x' | 'y';
99
+ type PickingLayerType = (typeof PICKING_LAYERS)[number];
100
+ type LayerType = (typeof LAYERS)[number];
101
+ type CurveOutline = {
102
+ /** Offset compared to the curve */
103
+ offset: number;
104
+ /** Color of the outline */
105
+ color: string;
106
+ /** Thickness of the outline */
107
+ width?: number;
108
+ /** Opacity of the outline, e.g. the TOD halo. */
109
+ opacity?: number;
110
+ /** Won't be used most of the time, color will be used */
111
+ backgroundColor?: string;
112
+ };
113
+ /**
114
+ * Visual style of a curve, computed by the shared curve-style helper
115
+ * and used by STD (PathLayer) and TOD (OccupancyBlockLayer).
116
+ *
117
+ * TODO: reuse this type in PathLayerProps when integrating drag and drop in STD/TOD.
118
+ */
119
+ type CurveStyle = {
120
+ color: string;
121
+ opacity: number;
122
+ level?: PathLevel;
123
+ outline?: CurveOutline;
124
+ /** TOD occupancy bar height in px. */
125
+ thickness?: number;
126
+ /** Border drawn around the TOD occupancy bar. */
127
+ border?: {
128
+ color: string;
129
+ width: number;
130
+ };
131
+ /** Segments drawn on the curve stops. */
132
+ stop?: {
133
+ /** Thickness in px (defaults to 4). */
134
+ thickness?: number;
135
+ /** Opacity (defaults to 0.2). */
136
+ opacity?: number;
137
+ /** Halo color (defaults to the curve color). */
138
+ color?: string;
139
+ };
140
+ label?: {
141
+ background?: {
142
+ color: string;
143
+ opacity?: number;
144
+ border?: string;
145
+ };
146
+ color?: string;
147
+ fontWeight?: number;
148
+ opacity?: number;
149
+ };
150
+ };
151
+ type PickingElement = {
152
+ type: string;
153
+ };
154
+ type HoveredItem = {
155
+ layer: PickingLayerType;
156
+ element: PickingElement;
157
+ };
158
+ type DrawingFunction<T> = (canvasContext: CanvasRenderingContext2D, context: T) => void;
159
+ type PickingDrawingFunction<T> = (imageData: ImageData, context: T & {
160
+ registerPickingElement: (element: PickingElement) => number;
161
+ }, scalingRatio: number) => void;
162
+ type DrawingFunctionHandler<T> = (arg: {
163
+ type: 'picking';
164
+ layer: PickingLayerType;
165
+ fn: PickingDrawingFunction<T>;
166
+ } | {
167
+ type: 'rendering';
168
+ layer: LayerType;
169
+ fn: DrawingFunction<T>;
170
+ }) => void;
171
+ type CanvasContextType<T> = {
172
+ register: DrawingFunctionHandler<T>;
173
+ unregister: DrawingFunctionHandler<T>;
174
+ captureCanvases: () => Promise<Blob>;
175
+ };
176
+ type TimeToPixel = (time: number) => number;
177
+ type PixelToTime = (x: number) => number;
178
+ type BaseTimeChartContextType = BaseChartContextType & {
179
+ width: number;
180
+ height: number;
181
+ timePixelOffset: number;
182
+ timeOrigin: number;
183
+ timeScale: number;
184
+ yPixelOffset: number;
185
+ getTimePixel: TimeToPixel;
186
+ getTime: PixelToTime;
187
+ getPoint: DataToPoint;
188
+ getData: PointToData;
189
+ theme: BaseChartStyles & TimeChartStyles & SpaceChartStyles;
190
+ };
191
+ type ChartOptions = {
192
+ captionSize?: number;
193
+ enableSnapping?: boolean;
194
+ hideDates?: boolean;
195
+ hideGrid?: boolean;
196
+ hidePathsLabels?: boolean;
197
+ hideTimeCaptions?: boolean;
198
+ showTicks?: boolean;
199
+ swapAxis?: boolean;
200
+ /**
201
+ * When set, the time axis renders hours as signed integers relative to time
202
+ * origin 0 (…, -2, -1, 0, 1, 2, …) instead of localized clock times, and
203
+ * date captions are hidden. The value is the length (in ms) of one hourly
204
+ * timetable pattern iteration, so downstream layers (markers, pattern bars)
205
+ * can reuse it. Meant for repeating patterns (e.g. hourly timetables).
206
+ */
207
+ hourlyTimetableDuration?: number;
208
+ };
209
+ type TimeChartContextType = BaseTimeChartContextType & ChartOptions;
210
+ type ChartEventHandlers<T> = {
211
+ onPan?: Handler<{
212
+ isPanning: boolean;
213
+ initialPosition: Point;
214
+ position: Point;
215
+ initialData: DataPoint;
216
+ data: DataPoint;
217
+ context: T;
218
+ }>;
219
+ onZoom?: Handler<{
220
+ delta: number;
221
+ position: Point;
222
+ event: WheelEvent;
223
+ context: T;
224
+ }>;
225
+ onClick?: Handler<{
226
+ position: Point;
227
+ data: DataPoint;
228
+ event: MouseEvent;
229
+ hoveredItem: HoveredItem | null;
230
+ context: T;
231
+ }>;
232
+ onMouseMove?: Handler<{
233
+ position: Point;
234
+ data: DataPoint;
235
+ isHover: boolean;
236
+ hoveredItem: HoveredItem | null;
237
+ context: T;
238
+ }>;
239
+ onHoveredChildUpdate?: Handler<{
240
+ item: HoveredItem | null;
241
+ context: T;
242
+ }>;
243
+ } & Omit<HTMLProps<HTMLDivElement>, 'onClick' | 'onMouseMove'>;
244
+ type MouseContextType = MouseState & {
245
+ data: DataPoint;
246
+ hoveredItem: HoveredItem | null;
247
+ };
248
+ type MouseState = {
249
+ down?: {
250
+ ctrl?: boolean;
251
+ shift?: boolean;
252
+ };
253
+ position: Point;
254
+ isHover: boolean;
255
+ };
256
+ type CaptionStyle = {
257
+ color: string;
258
+ font: string;
259
+ fontWeight?: string;
260
+ fontSize?: string;
261
+ topOffset?: number;
262
+ textAlign?: CanvasTextAlign;
263
+ };
264
+ type LineStyle = {
265
+ width: number;
266
+ color: string;
267
+ opacity?: number;
268
+ dashArray?: number[];
269
+ };
270
+ type BaseChartStyles = {
271
+ background: string;
272
+ pathsStyles: {
273
+ fontSize: number;
274
+ fontFamily: string;
275
+ };
276
+ };
277
+ type TimeChartStyles = {
278
+ breakpoints: number[];
279
+ dateCaptionsStyle: CaptionStyle;
280
+ dateCaptionsSize: number;
281
+ timeCaptionsPriorities: number[][];
282
+ timeCaptionsStyles: Record<number, CaptionStyle>;
283
+ timeCaptionsSize: number;
284
+ timeGraduationsPriorities: number[][];
285
+ timeGraduationsStyles: Record<number, LineStyle>;
286
+ timeRanges: number[];
287
+ };
288
+ type SpaceChartStyles = {
289
+ spaceGraduationsStyles: Record<number, LineStyle>;
290
+ };
291
+ type PathLevel = 1 | 2 | 3 | 4 | 5;
292
+ type DataPoint = {
293
+ time: number;
294
+ position: number;
295
+ };
296
+ type Handler<P extends object> = (payload: P) => void;
297
+ type PointToData = (point: Point) => DataPoint;
298
+ type OccupancyBlock$1 = {
299
+ startTime: number;
300
+ endTime: number;
301
+ trainNames: string[];
302
+ };
303
+ type LevelCrossingOccupancies = OccupancyBlock$1[][];
304
+ type LevelCrossingData = {
305
+ name: string;
306
+ occupancies: LevelCrossingOccupancies;
307
+ };
308
+ type ChronogramContextType = TimeChartContextType & {
309
+ levelCrossingsOccupancies: LevelCrossingOccupancies[];
310
+ };
311
+ type ChronogramCanvasProps = {
312
+ levelCrossingsOccupancies: LevelCrossingOccupancies[];
313
+ /** The time origin (i.e. the time value for the most left point) */
314
+ timeOrigin: number;
315
+ /** The timescale (in ms/px) */
316
+ timeScale: number;
317
+ xOffset?: number;
318
+ yOffset?: number;
319
+ } & ChartEventHandlers<ChronogramContextType>;
320
+ type ChronogramProps = {
321
+ levelCrossingData: LevelCrossingData[];
322
+ timeOrigin: number;
323
+ height?: number;
324
+ };
325
+ export declare const Chronogram: ({ levelCrossingData, timeOrigin, height }: ChronogramProps) => React$1.JSX.Element;
326
+ export declare const ChronogramCanvas: (props: ChronogramCanvasProps) => React$1.JSX.Element;
327
+ export type ChronogramManchetteProps = {
328
+ levelCrossingsNames: string[];
329
+ height: number;
330
+ width?: number;
331
+ onDelete: (name: string) => void;
332
+ };
333
+ export declare const OccupancyBlocksLayer: () => null;
334
+ export type UseChronogramProps = {
335
+ itemCount: number;
336
+ chronogramManchetteRef: React.RefObject<HTMLDivElement | null>;
337
+ chronogramChartRef: React.RefObject<HTMLDivElement | null>;
338
+ chronogramHeight: number;
339
+ };
340
+ export type ChronogramState = {
341
+ height: number;
342
+ xOffset: number;
343
+ yOffset: number;
344
+ panning: {
345
+ initialOffset: {
346
+ x: number;
347
+ y: number;
348
+ };
349
+ } | null;
350
+ xZoom: number;
351
+ };
352
+ /**
353
+ * This context exports everything necessary to draw the chart.
354
+ * It is updated anytime the scales are updated.
355
+ */
356
+ export declare const ChronogramContext: import("react").Context<ChronogramContextType>;
357
+ export declare const TOP_CAPTION_HEIGHT = 24;
358
+ export declare const TimeCaptions: () => null;
359
+ declare const TimeGraduations: () => null;
360
+ /**
361
+ * This hook helps to bind a picking function to a layer in a Chart.
362
+ */
363
+ export declare function usePicking<T>(contextKey: React.Context<CanvasContextType<T>>, layer: PickingLayerType, fn: PickingDrawingFunction<T>): void;
364
+ /**
365
+ * This hook helps to bind a drawing function to a layer in a chart.
366
+ */
367
+ export declare function useDraw<T>(contextKey: React.Context<CanvasContextType<T>>, layer: LayerType, fn: DrawingFunction<T>): void;
368
+ declare const useHoveredPickingElement: <T extends PickingElement>(isElement: (element: PickingElement) => element is T) => {
369
+ hoveredElement: T | undefined;
370
+ handleHoveredChildUpdate: ({ item }: {
371
+ item: HoveredItem | null;
372
+ }) => void;
373
+ };
374
+ /**
375
+ * To get crisp horizontal or vertical lines on a canvas, we must draw them as thin as possible, in
376
+ * terms of actual pixels on screen.
377
+ * The best way for this is:
378
+ * - To center lines 1, 3, 5... pixels wide in the middle of a pixel (0.5, 1.5, 2.5...)
379
+ * - To center lines 2, 4, 6... pixels wide between two pixels (0, 1, 2, 3...)
380
+ * Also, for HiDPi screens:
381
+ * - To center lines of "integer thicknesses" between two screen pixels (0, 0.5, 1, 1.5, 2...)
382
+ * - To center lines with `n + 0.5` thicknesses in the middle of a screen pixel (0.25, 0.75, 1.25, 1.75...)
383
+ * @param rawCoordinate Any input coordinate to fix
384
+ * @param lineWidth The width of the line to draw
385
+ * @param devicePixelRatio
386
+ */
387
+ export declare function getCrispLineCoordinate(rawCoordinate: number, lineWidth: number, devicePixelRatio?: number): number;
388
+ export declare const timeScaleToZoomValue: (timeScale: number) => number;
389
+ /**
390
+ * This context exports everything necessary to draw the chart.
391
+ * It is updated anytime the scales are updated or the mouse moves.
392
+ */
393
+ export declare const MouseContext: import("react").Context<MouseContextType>;
394
+ export declare const SpaceTimeChart: (props: SpaceTimeChartProps) => React$1.JSX.Element;
395
+ export type PointPickingElement = PickingElement & {
396
+ type: 'point';
397
+ pathId: string;
398
+ point: Point;
399
+ };
400
+ export type SegmentPickingElement = PickingElement & {
401
+ type: 'segment';
402
+ pathId: string;
403
+ from: Point;
404
+ to: Point;
405
+ };
406
+ export declare function isPointPickingElement(element: PickingElement): element is PointPickingElement;
407
+ export declare function isSegmentPickingElement(element: PickingElement): element is SegmentPickingElement;
408
+ export declare const DEFAULT_LEVEL: PathLevel;
409
+ export type PathLayerProps = {
410
+ path: PathData;
411
+ color: string;
412
+ pickingTolerance?: number;
413
+ level?: PathLevel;
414
+ opacity?: number;
415
+ border?: CurveStyle['outline'];
416
+ label?: CurveStyle['label'];
417
+ stop?: CurveStyle['stop'];
418
+ };
419
+ /**
420
+ * This component handles drawing a Path inside a SpaceTimeChart. It renders:
421
+ * - The path itself
422
+ * - The stops
423
+ * - The "picking" shape (to handle interactions)
424
+ */
425
+ export declare const PathLayer: ({ path, color, level, pickingTolerance, opacity, border, label, stop }: PathLayerProps) => null;
426
+ export type Conflict = {
427
+ timeStart: number;
428
+ timeEnd: number;
429
+ spaceStart: number;
430
+ spaceEnd: number;
431
+ };
432
+ export declare const getConflictRect: (conflict: Conflict, getTimePixel: (time: number) => number, getSpacePixel: (space: number) => number) => {
433
+ x: number;
434
+ y: number;
435
+ width: number;
436
+ height: number;
437
+ };
438
+ export type ConflictPickingElement = PickingElement & {
439
+ type: 'conflict';
440
+ conflictIndex: number;
441
+ };
442
+ export declare function isConflictPickingElement(element: PickingElement): element is ConflictPickingElement;
443
+ export type ConflictLayerProps = {
444
+ conflicts: Conflict[];
445
+ };
446
+ export declare const ConflictLayer: ({ conflicts }: ConflictLayerProps) => null;
447
+ export type ConflictTooltipProps = {
448
+ position: Point;
449
+ time: number;
450
+ spaceStart: number;
451
+ spaceEnd: number;
452
+ timeStart: number;
453
+ timeEnd: number;
454
+ type: string;
455
+ trains: string[];
456
+ };
457
+ export declare const ConflictTooltip: ({ position, time, spaceStart, spaceEnd, timeStart, timeEnd, type, trains }: ConflictTooltipProps) => React$1.JSX.Element;
458
+ export type TooltipProps = {
459
+ position: Point;
460
+ children: React$1.ReactNode;
461
+ };
462
+ export declare const Tooltip: ({ position, children }: TooltipProps) => React$1.JSX.Element;
463
+ export type OccupancyBlock = {
464
+ timeStart: number;
465
+ timeEnd: number;
466
+ spaceStart: number;
467
+ spaceEnd: number;
468
+ color: string;
469
+ blinking?: boolean;
470
+ };
471
+ export type OccupancyBlockLayerProps = {
472
+ occupancyBlocks: OccupancyBlock[];
473
+ };
474
+ export declare const OccupancyBlockLayer: ({ occupancyBlocks }: OccupancyBlockLayerProps) => null;
475
+ export type WorkSchedule = {
476
+ type: 'TRACK' | 'CATENARY';
477
+ timeStart: Date;
478
+ timeEnd: Date;
479
+ spaceRanges: [number, number][];
480
+ };
481
+ type WorkScheduleLayerProps = {
482
+ workSchedules: WorkSchedule[];
483
+ imageUrl: string;
484
+ };
485
+ /**
486
+ * Displays the workschedule projection on the Space time chart.
487
+ * A workschedule has a start time and an end time.
488
+ * It can contain several portions of a track occupied during this period.
489
+ * Each portion is represented by a rectangle region
490
+ */
491
+ export declare const WorkScheduleLayer: ({ workSchedules, imageUrl }: WorkScheduleLayerProps) => React$1.JSX.Element[] | null;
492
+ type CanvasRect = {
493
+ timeStart: Date;
494
+ timeEnd: Date;
495
+ spaceStart: number;
496
+ spaceEnd: number;
497
+ };
498
+ export type PatternRectProps = CanvasRect & {
499
+ imageElement: HTMLImageElement;
500
+ };
501
+ /**
502
+ * draws a repeating pattern in the space time chart
503
+ */
504
+ export declare const PatternRect: ({ imageElement, ...rect }: PatternRectProps) => null;
505
+ export type QuadrilaterPickingElement = PickingElement & {
506
+ type: 'quadrilateral';
507
+ id: string;
508
+ };
509
+ export declare function isQuadrilaterPickingElement(element: PickingElement): element is QuadrilaterPickingElement;
510
+ export type QuadrilateralProps = {
511
+ id: string;
512
+ vertices: [DataPoint, DataPoint, DataPoint, DataPoint];
513
+ style: {
514
+ backgroundColor: string;
515
+ borderColor: string;
516
+ borderWidth: number;
517
+ };
518
+ };
519
+ /**
520
+ * Draws a quadrilateral in the space time chart
521
+ * Position correspond to each point of the quadrilateral
522
+ *
523
+ * vertices[0] ________ vertices[1]
524
+ * / /
525
+ * vertices[3] /________/ vertices[2]
526
+ *
527
+ */
528
+ export declare const Quadrilateral: ({ id, vertices, style }: QuadrilateralProps) => null;
529
+ export declare const ZoomRect: (rect: CanvasRect) => null;
530
+ export type PeriodicMarkerProps = {
531
+ /** Length (in ms) of the interval. */
532
+ duration: number;
533
+ /** Start of the interval in ms. Defaults to `0`. */
534
+ origin?: number;
535
+ };
536
+ /** Renders pin marker at every interval boundary visible in the viewport. */
537
+ export declare const PeriodicMarker: ({ duration, origin }: PeriodicMarkerProps) => null;
538
+ export type TrainInfoBarColors = {
539
+ /** Color shade 10, used as the bar background. */
540
+ surface: string;
541
+ /** Color shade 70, used as the bar border. */
542
+ strong: string;
543
+ };
544
+ export type TrainInfoBarProps = {
545
+ /** Length (in ms) of the train's time window. */
546
+ duration: number;
547
+ /** Start of the first time window in ms. Defaults to `0`. */
548
+ origin?: number;
549
+ /** Name of the selected train. */
550
+ name: string;
551
+ /** Formatted label of the interval duration (e.g. `2h 00min`). */
552
+ intervalLabel: string;
553
+ colors: TrainInfoBarColors;
554
+ };
555
+ /** Renders one info bar per visible interval of the selected train. */
556
+ export declare const TrainInfoBar: ({ duration, origin, name, intervalLabel, colors }: TrainInfoBarProps) => null;
557
+ export declare const DEFAULT_THEME: SpaceTimeChartTheme;
558
+ /**
559
+ * This context exports everything necessary to draw the chart.
560
+ * It is updated anytime the scales are updated.
561
+ */
562
+ export declare const SpaceTimeChartContext: import("react").Context<SpaceTimeChartContextType>;
563
+ export declare const SpaceTimeChartCanvasContext: import("react").Context<CanvasContextType<SpaceTimeChartContextType>>;
564
+ /**
565
+ * This functions helps to find if a path intersects with a stage of width x height pixels.
566
+ */
567
+ export declare function isPathOnScreen(width: number, height: number, points: Point[]): boolean;
568
+ /**
569
+ * This function takes a path and a time, a returns the position of the train at the given time, or
570
+ * the position at the closest time to the path existence.
571
+ */
572
+ export declare function getSpaceAtTime(path: PathData, time: number): number;
573
+ /**
574
+ * in most cases, after the rectangle zoom, the screen will be centered
575
+ * on the center of the rectangle the user drew.
576
+ * In case we reach max zoom, not to break this expectation we need a different offset calculation
577
+ */
578
+ export declare function computeRectZoomOffsets({ rect, timeOrigin, spaceOrigin, newTimeScale, newSpaceScale, swapAxes, chartWidth, chartHeight }: {
579
+ rect: {
580
+ timeStart: Date;
581
+ timeEnd: Date;
582
+ spaceStart: number;
583
+ spaceEnd: number;
584
+ };
585
+ timeOrigin: number;
586
+ spaceOrigin: number;
587
+ newTimeScale: number;
588
+ newSpaceScale: number;
589
+ swapAxes: boolean;
590
+ chartWidth: number;
591
+ chartHeight: number;
592
+ }): {
593
+ xOffset: number;
594
+ yOffset: number;
595
+ };
596
+ export declare const BASE_WAYPOINT_HEIGHT = 32;
597
+ export declare const DEFAULT_ZOOM_MS_PER_PX = 7500;
598
+ type Waypoint = {
599
+ id: string;
600
+ position: number;
601
+ name?: string;
602
+ secondaryCode?: string | null;
603
+ secondaryName?: string | null;
604
+ weight?: number;
605
+ };
606
+ type InteractiveWaypoint = Waypoint & {
607
+ styles?: CSSProperties;
608
+ onClick?: (waypointId: string) => void;
609
+ };
610
+ type ProjectPathTrainResult = {
611
+ id: string;
612
+ name: string;
613
+ spaceTimeCurves: {
614
+ positions: number[];
615
+ times: number[];
616
+ }[];
617
+ departureTime: Date;
618
+ };
619
+ type ChartPath = {
620
+ id: string;
621
+ label: string;
622
+ color: string;
623
+ points: {
624
+ time: number;
625
+ position: number;
626
+ }[];
627
+ };
628
+ type WaypointProps = {
629
+ waypoint: Omit<InteractiveWaypoint, 'name'> & {
630
+ name?: ReactNode;
631
+ };
632
+ waypointRef?: React$1.RefObject<HTMLDivElement | null>;
633
+ isActive: boolean;
634
+ isMenuActive?: boolean;
635
+ testIdPrefix?: string;
636
+ hidePositions?: boolean;
637
+ };
638
+ declare const Waypoint$1: ({ waypoint: { name, secondaryCode, secondaryName, id, position, onClick, styles }, waypointRef, isActive, isMenuActive, testIdPrefix, hidePositions }: WaypointProps) => React$1.JSX.Element;
639
+ type ManchetteProps = {
640
+ contents: (InteractiveWaypoint | React$1.ReactNode)[];
641
+ activeWaypointId?: string;
642
+ activeWaypointRef?: React$1.RefObject<HTMLDivElement | null>;
643
+ zoomYIn: () => void;
644
+ zoomYOut: () => void;
645
+ resetZoom: () => void;
646
+ height?: number;
647
+ width?: number;
648
+ yZoom?: number;
649
+ children?: React$1.ReactNode;
650
+ isProportional?: boolean;
651
+ testIdPrefix?: string;
652
+ toggleMode: () => void;
653
+ hidePositions?: boolean;
654
+ translations?: {
655
+ linearMode: string;
656
+ };
657
+ };
658
+ declare const Manchette: ({ zoomYIn, zoomYOut, resetZoom, yZoom, contents, activeWaypointId, activeWaypointRef, isProportional, toggleMode, children, height, width, hidePositions, translations }: ManchetteProps) => React$1.JSX.Element;
659
+ type SyncManchetteState = {
660
+ xZoom: number;
661
+ yZoom: number;
662
+ timeOrigin: number;
663
+ spaceOrigin: number;
664
+ /** current x PIXEL offset from x origin */
665
+ xOffset: number;
666
+ /** current y PIXEL offset from y origin (the current y-scroll of the view. always updates) */
667
+ yOffset: number;
668
+ /** only update after a zoom. used to update back the view scroll value */
669
+ scrollTo: number | null;
670
+ panning: {
671
+ initialOffset: {
672
+ x: number;
673
+ y: number;
674
+ };
675
+ } | null;
676
+ zoomMode: boolean;
677
+ rect: {
678
+ timeStart: Date;
679
+ timeEnd: Date;
680
+ spaceStart: number;
681
+ spaceEnd: number;
682
+ } | null;
683
+ pixelRect: {
684
+ xStart: number;
685
+ xEnd: number;
686
+ yStart: number;
687
+ yEnd: number;
688
+ } | null;
689
+ };
690
+ type SplitPoint = {
691
+ /** helper identify nodes for this split point in the React tree */
692
+ id: string;
693
+ /** position of this split point, in mm from start */
694
+ position: number;
695
+ /** size of this split point, in pixels on screen */
696
+ size: number;
697
+ /** a React node to render the split point, space/time chart side */
698
+ spaceTimeChartNode?: ReactNode;
699
+ /** a React node to render the split point, manchette side */
700
+ manchetteNode?: ReactNode;
701
+ };
702
+ type ManchetteWithSpaceTimeChartOptions = {
703
+ displayTimeCaptions: boolean;
704
+ enableTimePan: boolean;
705
+ enableSpacePan: boolean;
706
+ enableTimeZoom: boolean;
707
+ };
708
+ declare const useManchetteWithSpaceTimeChart: ({ waypoints, manchetteWithSpaceTimeChartRef, height, spaceTimeChartRef, defaultTimeOrigin, defaultSpaceOrigin, defaultXOffset, verticalPadding, splitPoints, options }: {
709
+ waypoints: Waypoint[];
710
+ manchetteWithSpaceTimeChartRef: React$1.RefObject<HTMLDivElement | null>;
711
+ height?: number;
712
+ spaceTimeChartRef?: React$1.RefObject<HTMLDivElement | null>;
713
+ defaultTimeOrigin?: number;
714
+ defaultSpaceOrigin?: number;
715
+ defaultXOffset?: number;
716
+ verticalPadding?: number;
717
+ splitPoints?: SplitPoint[];
718
+ options?: Partial<ManchetteWithSpaceTimeChartOptions>;
719
+ }) => {
720
+ manchetteProps: ManchetteProps;
721
+ spaceTimeChartProps: SpaceTimeChartProps;
722
+ handleScroll: (e: React$1.UIEvent<HTMLDivElement>) => void;
723
+ handleXZoom: (newXZoom: number, xPosition?: number) => void;
724
+ xZoom: number;
725
+ toggleZoomMode: () => void;
726
+ zoomMode: boolean;
727
+ rect: SyncManchetteState["rect"];
728
+ timeScale: number;
729
+ spaceScale: number;
730
+ setTimeOrigin: (v: number) => void;
731
+ pan: (args: {
732
+ dx?: number;
733
+ dy?: number;
734
+ }) => void;
735
+ };
736
+ type ManchetteWithSpaceTimeChartProps = {
737
+ waypoints: Waypoint[];
738
+ paths: ChartPath[];
739
+ height?: number;
740
+ children?: React$1.ReactNode;
741
+ header?: React$1.ReactNode;
742
+ manchetteProps?: ManchetteProps;
743
+ spaceTimeChartProps?: SpaceTimeChartProps;
744
+ splitPoints?: SplitPoint[];
745
+ };
746
+ /**
747
+ * A simple component to display a manchette and a space time chart.
748
+ *
749
+ * This only covers basic usage. For more advanced control over the manchette
750
+ * and space time chart, the useManchetteWithSpaceTimeChart() hook can be used.
751
+ */
752
+ declare const ManchetteWithSpaceTimeChart: ({ waypoints, paths, height, children, header, manchetteProps: additionalManchetteProps, spaceTimeChartProps: additionalSpaceTimeChartProps, splitPoints }: ManchetteWithSpaceTimeChartProps) => React$1.JSX.Element;
753
+ export declare const positionMmToKm: (position: number) => number;
754
+ export declare const positionKmToMm: (position: number) => number;
755
+ export declare const isInteractiveWaypoint: (item: InteractiveWaypoint | ReactNode) => item is InteractiveWaypoint;
756
+ type ElectricalProfileValues = {
757
+ electricalProfile: string;
758
+ color?: string;
759
+ heightLevel?: number;
760
+ handled?: boolean;
761
+ };
762
+ type PowerRestrictionValues = {
763
+ powerRestriction: string;
764
+ handled: boolean;
765
+ };
766
+ type SpeedLimitTagValues = {
767
+ tag: string;
768
+ color: string;
769
+ };
770
+ type ElectrificationValues = {
771
+ type: 'electrification' | 'neutral_section' | 'non_electrified';
772
+ voltage?: '1500V' | '25000V';
773
+ lowerPantograph?: boolean;
774
+ };
775
+ type LayerData<T> = {
776
+ position: {
777
+ start: number;
778
+ end?: number;
779
+ };
780
+ value: T;
781
+ };
782
+ type OperationalPoints = {
783
+ name: string;
784
+ weight?: number;
785
+ };
786
+ type ValuesAlongPath<T> = {
787
+ boundaries: number[];
788
+ values: T[];
789
+ };
790
+ type DriverAction = 'TRACTING' | 'BRAKING' | 'COASTING';
791
+ type SpeedLimit = {
792
+ speed: number;
793
+ isTemporary: boolean;
794
+ };
795
+ type Data = {
796
+ speeds: LayerData<number>[];
797
+ ecoSpeeds: LayerData<number>[];
798
+ etcsBrakingCurves?: EtcsBrakingCurves;
799
+ stops: LayerData<OperationalPoints>[];
800
+ electrifications: LayerData<ElectrificationValues>[];
801
+ slopes: LayerData<number>[];
802
+ driverActions: ValuesAlongPath<DriverAction>;
803
+ mrsp?: ValuesAlongPath<SpeedLimit>;
804
+ electricalProfiles?: LayerData<ElectricalProfileValues>[];
805
+ powerRestrictions?: LayerData<PowerRestrictionValues>[];
806
+ speedLimitTags?: LayerData<SpeedLimitTagValues>[];
807
+ trainLength: number;
808
+ };
809
+ type Store = Data & {
810
+ ratioX: number;
811
+ leftOffset: number;
812
+ cursor: {
813
+ x: number | null;
814
+ y: number | null;
815
+ };
816
+ detailsBoxDisplay: {
817
+ energySource: boolean;
818
+ tractionStatus: boolean;
819
+ declivities: boolean;
820
+ etcs: boolean;
821
+ electricalProfiles: boolean;
822
+ powerRestrictions: boolean;
823
+ };
824
+ layersDisplay: {
825
+ steps: boolean;
826
+ declivities: boolean;
827
+ speedLimits: boolean;
828
+ electricalProfiles: boolean;
829
+ powerRestrictions: boolean;
830
+ speedLimitTags: boolean;
831
+ };
832
+ etcsLayersDisplay: EtcsLayersDisplay;
833
+ isSettingsPanelOpened: boolean;
834
+ };
835
+ type EtcsBrakingCurve = { [key in EtcsBrakingCurveType]: LayerData<number>[]; };
836
+ type EtcsBrakingCurves = { [key in EtcsBrakingType]: EtcsBrakingCurve[]; };
837
+ export declare enum EtcsBrakingType {
838
+ SLOWDOWN = "transition",
839
+ STOP = "stop",
840
+ SPACING = "spacing",
841
+ ROUTING = "routing"
842
+ }
843
+ export declare enum EtcsBrakingCurveType {
844
+ IND = "IND",
845
+ PS = "PS",
846
+ GUI = "GUI"
847
+ }
848
+ type EtcsLayersDisplay = {
849
+ etcsBrakingTypes: {
850
+ stopsAndTransitions: boolean;
851
+ spacing: boolean;
852
+ routing: boolean;
853
+ };
854
+ etcsBrakingCurveTypes: {
855
+ indication: boolean;
856
+ permittedSpeed: boolean;
857
+ guidance: boolean;
858
+ };
859
+ };
860
+ type SpeedSpaceChartProps = {
861
+ width: number;
862
+ height: number;
863
+ backgroundColor: string;
864
+ setHeight: React$1.Dispatch<React$1.SetStateAction<number>>;
865
+ fetchEtcsBrakingCurves?: () => Promise<void>;
866
+ etcsBrakingCurves?: EtcsBrakingCurves;
867
+ initialLayersDisplay?: Partial<Store['layersDisplay']>;
868
+ data: Data;
869
+ translations?: {
870
+ detailsBoxDisplay: {
871
+ reticleInfos: string;
872
+ energySource: string;
873
+ tractionStatus: string;
874
+ declivities: string;
875
+ etcs: string;
876
+ electricalProfiles: string;
877
+ powerRestrictions: string;
878
+ };
879
+ layersDisplay: {
880
+ context: string;
881
+ steps: string;
882
+ declivities: string;
883
+ speedLimits: string;
884
+ temporarySpeedLimits: string;
885
+ electricalProfiles: string;
886
+ powerRestrictions: string;
887
+ speedLimitTags: string;
888
+ };
889
+ etcsLayersDisplay: {
890
+ title: string;
891
+ etcsBrakingTypes: {
892
+ stop: string;
893
+ transition: string;
894
+ stopsAndTransitions: string;
895
+ signals: string;
896
+ spacing: string;
897
+ routing: string;
898
+ };
899
+ etcsBrakingCurveTypes: {
900
+ indication: string;
901
+ permittedSpeed: string;
902
+ guidance: string;
903
+ };
904
+ };
905
+ driverActions: {
906
+ BRAKING: string;
907
+ COASTING: string;
908
+ TRACTING: string;
909
+ };
910
+ };
911
+ };
912
+ declare const SpeedSpaceChart: ({ width, height, backgroundColor, data, setHeight, translations, fetchEtcsBrakingCurves, etcsBrakingCurves, initialLayersDisplay }: SpeedSpaceChartProps) => React$1.JSX.Element;
913
+ export declare const TRACK_HEIGHT_CONTAINER = 100;
914
+ export declare const CANVAS_PADDING = 10;
915
+ export declare const OCCUPANCY_ZONE_Y_START: number;
916
+ export declare const OCCUPANCY_ZONE_HEIGHT = 3;
917
+ /** White line drawn on the edges of an occupancy bar, to separate it from the ones next to it. */
918
+ export declare const OCCUPANCY_SEPARATOR_WIDTH = 0.5;
919
+ export declare const MINUTES_TEXT_OFFSET = 8.5;
920
+ export declare const STATION_TEXT_OFFSET = 5;
921
+ export declare const TICKS_PATTERN: {
922
+ MINUTE: number[];
923
+ FIVE_MINUTES: number[];
924
+ QUARTER_HOUR: number[];
925
+ HALF_HOUR: number[];
926
+ HOUR: number[];
927
+ };
928
+ export declare const TICKS_PRIORITIES: number[][];
929
+ export type Track = {
930
+ id: string;
931
+ name?: string;
932
+ line?: string;
933
+ /** Prevents highlighting and dropping on this track */
934
+ disabled?: boolean;
935
+ };
936
+ export type OccupancyZone = {
937
+ pathId: string;
938
+ trackId: string;
939
+ trainName: string;
940
+ originStation?: string;
941
+ destinationStation?: string;
942
+ startTime: number;
943
+ endTime: number;
944
+ startDirection?: 'up' | 'down';
945
+ endDirection?: 'up' | 'down';
946
+ trailingText?: string;
947
+ curveStyle: CurveStyle;
948
+ connectorStyle?: {
949
+ width?: number;
950
+ color?: string;
951
+ };
952
+ };
953
+ export type OccupancyZonePickingElement = PickingElement & {
954
+ type: 'occupancyZone';
955
+ pathId: string;
956
+ };
957
+ /**
958
+ * Shades of the color of the train departing after the linking, from the lightest to the darkest.
959
+ * Which one is used where depends on the state of the linking being drawn.
960
+ */
961
+ export type LinkingColors = {
962
+ /** Line under the dashes, when the linking is hovered */
963
+ surface: string;
964
+ /** Capsule outline, and line under the dashes at rest */
965
+ soft: string;
966
+ /** Capsule border, and dashes at rest */
967
+ base: string;
968
+ /** Dashes, when the linking is hovered */
969
+ strong: string;
970
+ };
971
+ export type Linking = {
972
+ id: string;
973
+ trackId: string;
974
+ colors: LinkingColors;
975
+ startTime: number;
976
+ endTime: number;
977
+ suggested?: boolean;
978
+ hover?: boolean;
979
+ };
980
+ export type BrokenLinking = {
981
+ id: string;
982
+ trackId: string;
983
+ direction: 'forward' | 'backward';
984
+ time: number;
985
+ name: string;
986
+ hover?: boolean;
987
+ };
988
+ export type LinkingPickingElement = PickingElement & {
989
+ type: 'linking';
990
+ linkingId: string;
991
+ };
992
+ export type BrokenLinkingPickingElement = PickingElement & {
993
+ type: 'brokenLinking';
994
+ brokenLinkingId: string;
995
+ direction: BrokenLinking['direction'];
996
+ };
997
+ export type TickPattern = keyof typeof TICKS_PATTERN;
998
+ export declare function isBrokenLinkingPickingElement(element: PickingElement): element is BrokenLinkingPickingElement;
999
+ export declare function isLinkingPickingElement(element: PickingElement): element is LinkingPickingElement;
1000
+ export declare function isOccupancyPickingElement(element: PickingElement): element is OccupancyZonePickingElement;
1001
+ declare const TrackOccupancyCanvas: ({ top: explicitTop, height: explicitHeight, tracks, occupancyZones, draggingOccupancyZones, linkings, brokenLinkings, deleteIconUrl, onClose, onDragOver, topPadding, hideBorders }: {
1002
+ top?: number;
1003
+ height?: number;
1004
+ tracks: Track[];
1005
+ occupancyZones: OccupancyZone[];
1006
+ draggingOccupancyZones?: OccupancyZone[];
1007
+ linkings?: Linking[];
1008
+ brokenLinkings?: BrokenLinking[];
1009
+ deleteIconUrl?: string;
1010
+ onClose?: () => void;
1011
+ onDragOver?: (trackId: string | undefined) => void;
1012
+ topPadding?: number;
1013
+ hideBorders?: boolean;
1014
+ }) => React$1.JSX.Element;
1015
+ declare const TrackOccupancyManchette: ({ tracks, activeTrackId, children }: PropsWithChildren<{
1016
+ tracks: Track[];
1017
+ activeTrackId?: string;
1018
+ }>) => React$1.JSX.Element;
1019
+ declare const TrackOccupancyStandalone: ({ tracks, occupancyZones, draggingOccupancyZones, linkings, brokenLinkings, deleteIconUrl, onDeleteBrokenLinking, selectedPathId, onSelectedPathIdChange, onHoveredChildUpdate, onDragOver, height }: {
1020
+ tracks: Track[];
1021
+ occupancyZones: OccupancyZone[];
1022
+ draggingOccupancyZones?: OccupancyZone[];
1023
+ linkings?: Linking[];
1024
+ brokenLinkings?: BrokenLinking[];
1025
+ deleteIconUrl?: string;
1026
+ onDeleteBrokenLinking?: (brokenLinkingId: string) => void;
1027
+ selectedPathId?: string;
1028
+ onSelectedPathIdChange?: (selectedPathId?: string) => void;
1029
+ onHoveredChildUpdate?: ChartEventHandlers<TimeChartContextType>["onHoveredChildUpdate"];
1030
+ onDragOver?: (trackId: string | undefined) => void;
1031
+ height?: number;
1032
+ }) => React$1.JSX.Element;
1033
+ type UseEdgePanParams = {
1034
+ enableY?: boolean;
1035
+ hideTimeCaptions?: boolean;
1036
+ themeTimeCaptionsSize: number | undefined;
1037
+ pan: (pos: {
1038
+ dy: number;
1039
+ }) => void;
1040
+ };
1041
+ /**
1042
+ * Pan when the mouse approaches the edge of the chart. Useful for navigating
1043
+ * the chart during drag-and-drop operations.
1044
+ */
1045
+ declare const useEdgePan: ({ enableY, hideTimeCaptions, themeTimeCaptionsSize, pan }: UseEdgePanParams) => {
1046
+ onMouseMove: Handler<{
1047
+ position: Point;
1048
+ data: DataPoint;
1049
+ isHover: boolean;
1050
+ hoveredItem: HoveredItem | null;
1051
+ context: TimeChartContextType;
1052
+ }>;
1053
+ };
1054
+ export { type ChartPath, type ChronogramContextType, type ChronogramProps, type CurveOutline, type CurveStyle, type DataPoint, type DrawingFunction, type ElectricalProfileValues, type ElectrificationValues, type EtcsBrakingCurve, type EtcsBrakingCurves, type HoveredItem, type InteractiveWaypoint, type LayerData, type LevelCrossingData, type LevelCrossingOccupancies, Manchette, type ManchetteProps, ManchetteWithSpaceTimeChart, type ManchetteWithSpaceTimeChartProps, type OperationalPoint, type PathData, type PathLevel, type PickingDrawingFunction, type PickingElement, type Point, type PowerRestrictionValues, type ProjectPathTrainResult, type SpaceScale, type SpaceTimeChartContextType, type SpaceTimeChartProps, type SpaceTimeChartTheme, type SpeedLimitTagValues, SpeedSpaceChart, type Data as SpeedSpaceChartData, type SpeedSpaceChartProps, type SplitPoint, TimeGraduations, TrackOccupancyCanvas, TrackOccupancyManchette, TrackOccupancyStandalone, type Waypoint, Waypoint$1 as WaypointComponent, useEdgePan, useHoveredPickingElement, useManchetteWithSpaceTimeChart };
1055
+ //# sourceMappingURL=index.d.ts.map