@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
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import type { InteractiveWaypoint } from '../types';
3
- export type ManchetteProps = {
4
- contents: (InteractiveWaypoint | React.ReactNode)[];
5
- activeWaypointId?: string;
6
- activeWaypointRef?: React.RefObject<HTMLDivElement | null>;
7
- zoomYIn: () => void;
8
- zoomYOut: () => void;
9
- resetZoom: () => void;
10
- height?: number;
11
- width?: number;
12
- yZoom?: number;
13
- children?: React.ReactNode;
14
- isProportional?: boolean;
15
- testIdPrefix?: string;
16
- toggleMode: () => void;
17
- hidePositions?: boolean;
18
- translations?: {
19
- linearMode: string;
20
- };
21
- };
22
- declare const Manchette: ({ zoomYIn, zoomYOut, resetZoom, yZoom, contents, activeWaypointId, activeWaypointRef, isProportional, toggleMode, children, height, width, hidePositions, translations, }: ManchetteProps) => React.JSX.Element;
23
- export default Manchette;
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import { type SpaceTimeChartProps } from '../../spaceTimeChart';
3
- import { type SplitPoint } from '../hooks/useManchetteWithSpaceTimeChart';
4
- import type { ChartPath, Waypoint } from '../types';
5
- import { type ManchetteProps } from './Manchette';
6
- export type ManchetteWithSpaceTimeChartProps = {
7
- waypoints: Waypoint[];
8
- paths: ChartPath[];
9
- height?: number;
10
- children?: React.ReactNode;
11
- header?: React.ReactNode;
12
- manchetteProps?: ManchetteProps;
13
- spaceTimeChartProps?: SpaceTimeChartProps;
14
- splitPoints?: SplitPoint[];
15
- };
16
- /**
17
- * A simple component to display a manchette and a space time chart.
18
- *
19
- * This only covers basic usage. For more advanced control over the manchette
20
- * and space time chart, the useManchetteWithSpaceTimeChart() hook can be used.
21
- */
22
- declare const ManchetteWithSpaceTimeChart: ({ waypoints, paths, height, children, header, manchetteProps: additionalManchetteProps, spaceTimeChartProps: additionalSpaceTimeChartProps, splitPoints, }: ManchetteWithSpaceTimeChartProps) => React.JSX.Element;
23
- export default ManchetteWithSpaceTimeChart;
@@ -1,14 +0,0 @@
1
- import React, { type ReactNode } from 'react';
2
- import { type InteractiveWaypoint } from '../types';
3
- type WaypointProps = {
4
- waypoint: Omit<InteractiveWaypoint, 'name'> & {
5
- name?: ReactNode;
6
- };
7
- waypointRef?: React.RefObject<HTMLDivElement | null>;
8
- isActive: boolean;
9
- isMenuActive?: boolean;
10
- testIdPrefix?: string;
11
- hidePositions?: boolean;
12
- };
13
- declare const Waypoint: ({ waypoint: { name, secondaryCode, id, position, onClick, styles }, waypointRef, isActive, isMenuActive, testIdPrefix, hidePositions, }: WaypointProps) => React.JSX.Element;
14
- export default Waypoint;
@@ -1,15 +0,0 @@
1
- export declare const INITIAL_OP_LIST_HEIGHT = 521;
2
- export declare const BASE_WAYPOINT_HEIGHT = 32;
3
- export declare const INITIAL_SPACE_TIME_CHART_HEIGHT: number;
4
- export declare const MIN_ZOOM_MS_PER_PX = 600000;
5
- export declare const MAX_ZOOM_MS_PER_PX = 625;
6
- export declare const DEFAULT_ZOOM_MS_PER_PX = 7500;
7
- export declare const MIN_ZOOM_X = 0;
8
- export declare const MAX_ZOOM_X = 100;
9
- export declare const MIN_ZOOM_Y = 1;
10
- export declare const MAX_ZOOM_Y = 10.5;
11
- export declare const ZOOM_Y_DELTA = 0.5;
12
- export declare const MAX_ZOOM_MANCHETTE_HEIGHT_MILLIMETER = 500000;
13
- export declare const FOOTER_HEIGHT = 40;
14
- export declare const WAYPOINT_LINE_HEIGHT = 16;
15
- export declare const PATH_COLOR_DEFAULT = "#8A714B";
@@ -1,49 +0,0 @@
1
- import React, { type ReactNode } from 'react';
2
- import { type SpaceTimeChartProps } from '../../spaceTimeChart';
3
- import type { ManchetteProps } from '../components/Manchette';
4
- import type { Waypoint } from '../types';
5
- import { type SyncManchetteState } from './useSyncManchette';
6
- export type SplitPoint = {
7
- /** helper identify nodes for this split point in the React tree */
8
- id: string;
9
- /** position of this split point, in mm from start */
10
- position: number;
11
- /** size of this split point, in pixels on screen */
12
- size: number;
13
- /** a React node to render the split point, space/time chart side */
14
- spaceTimeChartNode?: ReactNode;
15
- /** a React node to render the split point, manchette side */
16
- manchetteNode?: ReactNode;
17
- };
18
- export type ManchetteWithSpaceTimeChartOptions = {
19
- displayTimeCaptions: boolean;
20
- enableTimePan: boolean;
21
- enableSpacePan: boolean;
22
- enableTimeZoom: boolean;
23
- };
24
- export declare const DEFAULT_MANCHETTE_WITH_SPACE_TIME_CHART_OPTIONS: ManchetteWithSpaceTimeChartOptions;
25
- declare const useManchetteWithSpaceTimeChart: ({ waypoints, manchetteWithSpaceTimeChartRef, height, spaceTimeChartRef, defaultTimeOrigin, defaultSpaceOrigin, defaultXOffset, verticalPadding, splitPoints, options, }: {
26
- waypoints: Waypoint[];
27
- manchetteWithSpaceTimeChartRef: React.RefObject<HTMLDivElement | null>;
28
- height?: number;
29
- spaceTimeChartRef?: React.RefObject<HTMLDivElement | null>;
30
- defaultTimeOrigin?: number;
31
- defaultSpaceOrigin?: number;
32
- defaultXOffset?: number;
33
- verticalPadding?: number;
34
- splitPoints?: SplitPoint[];
35
- options?: Partial<ManchetteWithSpaceTimeChartOptions>;
36
- }) => {
37
- manchetteProps: ManchetteProps;
38
- spaceTimeChartProps: SpaceTimeChartProps;
39
- handleScroll: (e: React.UIEvent<HTMLDivElement>) => void;
40
- handleXZoom: (newXZoom: number, xPosition?: number) => void;
41
- xZoom: number;
42
- toggleZoomMode: () => void;
43
- zoomMode: boolean;
44
- rect: SyncManchetteState["rect"];
45
- timeScale: number;
46
- spaceScale: number;
47
- setTimeOrigin: (v: number) => void;
48
- };
49
- export default useManchetteWithSpaceTimeChart;
@@ -1,94 +0,0 @@
1
- import type { SpaceTimeChartProps } from '../../spaceTimeChart';
2
- export type SyncManchetteState = {
3
- xZoom: number;
4
- yZoom: number;
5
- timeOrigin: number;
6
- spaceOrigin: number;
7
- /** current x PIXEL offset from x origin */
8
- xOffset: number;
9
- /** current y PIXEL offset from y origin (the current y-scroll of the view. always updates) */
10
- yOffset: number;
11
- /** only update after a zoom. used to update back the view scroll value */
12
- scrollTo: number | null;
13
- panning: {
14
- initialOffset: {
15
- x: number;
16
- y: number;
17
- };
18
- } | null;
19
- zoomMode: boolean;
20
- rect: {
21
- timeStart: Date;
22
- timeEnd: Date;
23
- spaceStart: number;
24
- spaceEnd: number;
25
- } | null;
26
- pixelRect: {
27
- xStart: number;
28
- xEnd: number;
29
- yStart: number;
30
- yEnd: number;
31
- } | null;
32
- };
33
- /**
34
- * This hook can be used to synchronize a manchette and a diagram which has a
35
- * time scale for X.
36
- *
37
- * It provides offsets on both axis and functions to handle some
38
- * classic behaviors such as zoom, pan and scroll.
39
- */
40
- declare const useSyncManchette: ({ manchetteWithSpaceTimeChartRef, diagramRef, initialState, maxYZoom, enableTimeZoom, }: {
41
- manchetteWithSpaceTimeChartRef: React.RefObject<HTMLDivElement | null>;
42
- maxYZoom: number;
43
- diagramRef?: React.RefObject<HTMLDivElement | null>;
44
- height?: number;
45
- initialState?: {
46
- timeOrigin?: number;
47
- spaceOrigin?: number;
48
- xOffset?: number;
49
- };
50
- enableTimeZoom?: boolean;
51
- }) => {
52
- state: SyncManchetteState;
53
- setState: import("react").Dispatch<import("react").SetStateAction<SyncManchetteState>>;
54
- handleScrollInManchette: (e: React.UIEvent<HTMLDivElement>) => void;
55
- handleXZoom: (newXZoom: number, xPosition?: number) => void;
56
- handleXZoomOnWheelEvent: (wheelEvent: WheelEvent, newXZoom: number, xPosition: number) => void;
57
- yZoomHelpers: {
58
- zoomYIn: () => void;
59
- zoomYOut: () => void;
60
- resetZoom: () => void;
61
- };
62
- basicOnPan: (payload: Parameters<NonNullable<SpaceTimeChartProps["onPan"]>>[0], prev: SyncManchetteState) => {
63
- xZoom: number;
64
- yZoom: number;
65
- timeOrigin: number;
66
- spaceOrigin: number;
67
- /** current x PIXEL offset from x origin */
68
- xOffset: number;
69
- /** current y PIXEL offset from y origin (the current y-scroll of the view. always updates) */
70
- yOffset: number;
71
- /** only update after a zoom. used to update back the view scroll value */
72
- scrollTo: number | null;
73
- panning: {
74
- initialOffset: {
75
- x: number;
76
- y: number;
77
- };
78
- } | null;
79
- zoomMode: boolean;
80
- rect: {
81
- timeStart: Date;
82
- timeEnd: Date;
83
- spaceStart: number;
84
- spaceEnd: number;
85
- } | null;
86
- pixelRect: {
87
- xStart: number;
88
- xEnd: number;
89
- yStart: number;
90
- yEnd: number;
91
- } | null;
92
- };
93
- };
94
- export default useSyncManchette;
@@ -1,11 +0,0 @@
1
- import '@osrd-project/ui-core/dist/theme.css';
2
- import './styles/main.css';
3
- import './consts';
4
- export { default as WaypointComponent } from './components/Waypoint';
5
- export { default as Manchette, type ManchetteProps } from './components/Manchette';
6
- export { default as ManchetteWithSpaceTimeChart, type ManchetteWithSpaceTimeChartProps, } from './components/ManchetteWithSpaceTimeChart';
7
- export { DEFAULT_ZOOM_MS_PER_PX, BASE_WAYPOINT_HEIGHT } from './consts';
8
- export { default as useManchetteWithSpaceTimeChart, type SplitPoint, } from './hooks/useManchetteWithSpaceTimeChart';
9
- export type { Waypoint, ProjectPathTrainResult, InteractiveWaypoint, ChartPath } from './types';
10
- export { positionMmToKm, positionKmToMm } from './utils';
11
- export { timeScaleToZoomValue, isInteractiveWaypoint } from './utils/helpers';
@@ -1,34 +0,0 @@
1
- import { type CSSProperties } from 'react';
2
- export type Waypoint = {
3
- id: string;
4
- position: number;
5
- name?: string;
6
- secondaryCode?: string;
7
- weight?: number;
8
- };
9
- export type InteractiveWaypoint = Waypoint & {
10
- styles?: CSSProperties;
11
- onClick?: (waypointId: string) => void;
12
- };
13
- export type ProjectPathTrainResult = {
14
- id: string;
15
- name: string;
16
- spaceTimeCurves: {
17
- positions: number[];
18
- times: number[];
19
- }[];
20
- departureTime: Date;
21
- };
22
- export type ChartPoint = {
23
- time: number;
24
- position: number;
25
- };
26
- export type ChartPath = {
27
- id: string;
28
- label: string;
29
- color: string;
30
- points: {
31
- time: number;
32
- position: number;
33
- }[];
34
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,44 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import type { InteractiveWaypoint, Waypoint } from '../types';
3
- export declare const zoomValueToTimeScale: (slider: number) => number;
4
- export declare const timeScaleToZoomValue: (timeScale: number) => number;
5
- /**
6
- * min zoom is computed with manchette px height between first and last waypoint.
7
- * max zoom just the canvas drawing height (without the x-axis scale section)
8
- */
9
- export declare const getExtremaScales: (drawingHeightWithoutTopPadding: number, drawingHeightWithoutBothPadding: number, pathLengthMillimeter: number) => {
10
- minZoomMillimeterPerPx: number;
11
- maxZoomMillimeterPerPx: number;
12
- };
13
- export declare const zoomValueToSpaceScale: (minZoomMillimeterPerPx: number, maxZoomMillimeterPerPx: number, slider: number) => number;
14
- export declare const spaceScaleToZoomValue: (minZoomMillimeterPerPx: number, maxZoomMillimeterPerPx: number, spaceScale: number) => number;
15
- /** Zoom on X axis and center on the mouse position */
16
- export declare const zoomX: (currentZoom: number, currentOffset: number, newZoom: number, position: number) => {
17
- xZoom: number;
18
- xOffset: number;
19
- };
20
- type WaypointsOptions = {
21
- isProportional: boolean;
22
- yZoom: number;
23
- height: number;
24
- };
25
- export declare const filterVisibleElements: (elements: Waypoint[], totalDistance: number, heightWithoutFinalWaypoint: number, minSpace: number) => Waypoint[];
26
- export declare const selectWaypointsToDisplay: (waypoints: Waypoint[], { height, isProportional, yZoom }: WaypointsOptions) => Waypoint[];
27
- /**
28
- * 2 modes for space scales
29
- * km (isProportional): { coefficient: gives a scale in meter/pixel }
30
- * linear: { size: height in pixel } (each point distributed evenly along the height of manchette.)
31
- */
32
- export declare const getScales: (waypoints: Waypoint[], { isProportional, yZoom, height }: WaypointsOptions, minZoomMillimeterPerPx: number, maxZoomMillimeterPerPx: number) => ({
33
- coefficient: number;
34
- size?: undefined;
35
- from: number;
36
- to: number;
37
- } | {
38
- size: number;
39
- coefficient?: undefined;
40
- from: number;
41
- to: number;
42
- })[];
43
- export declare const isInteractiveWaypoint: (item: InteractiveWaypoint | ReactNode) => item is InteractiveWaypoint;
44
- export {};
@@ -1,13 +0,0 @@
1
- export declare const getHeightWithoutLastWaypoint: (height: number) => number;
2
- export declare const positionMmToKm: (position: number) => number;
3
- export declare const positionKmToMm: (position: number) => number;
4
- export declare const msToS: (time: number) => number;
5
- export declare const calcTotalDistance: (ops: {
6
- position: number;
7
- }[]) => number;
8
- type Point = {
9
- x: number;
10
- y: number;
11
- };
12
- export declare function getDistance(a: Point, b: Point): Point;
13
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,16 +0,0 @@
1
- import type { PickingElement } from '../../common/types';
2
- export type Conflict = {
3
- timeStart: number;
4
- timeEnd: number;
5
- spaceStart: number;
6
- spaceEnd: number;
7
- };
8
- export type ConflictPickingElement = PickingElement & {
9
- type: 'conflict';
10
- conflictIndex: number;
11
- };
12
- export declare function isConflictPickingElement(element: PickingElement): element is ConflictPickingElement;
13
- export type ConflictLayerProps = {
14
- conflicts: Conflict[];
15
- };
16
- export declare const ConflictLayer: ({ conflicts }: ConflictLayerProps) => null;
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { Point } from '../../common/types';
3
- export type ConflictTooltipProps = {
4
- position: Point;
5
- time: number;
6
- spaceStart: number;
7
- spaceEnd: number;
8
- timeStart: number;
9
- timeEnd: number;
10
- type: string;
11
- trains: string[];
12
- };
13
- export declare const ConflictTooltip: ({ position, time, spaceStart, spaceEnd, timeStart, timeEnd, type, trains, }: ConflictTooltipProps) => React.JSX.Element;
@@ -1,12 +0,0 @@
1
- export type OccupancyBlock = {
2
- timeStart: number;
3
- timeEnd: number;
4
- spaceStart: number;
5
- spaceEnd: number;
6
- color: string;
7
- blinking?: boolean;
8
- };
9
- export type OccupancyBlockLayerProps = {
10
- occupancyBlocks: OccupancyBlock[];
11
- };
12
- export declare const OccupancyBlockLayer: ({ occupancyBlocks }: OccupancyBlockLayerProps) => null;
@@ -1,37 +0,0 @@
1
- import type { PickingElement, Point } from '../../common/types';
2
- import { type PathData } from '../lib/types';
3
- export type PointPickingElement = PickingElement & {
4
- type: 'point';
5
- pathId: string;
6
- point: Point;
7
- };
8
- export type SegmentPickingElement = PickingElement & {
9
- type: 'segment';
10
- pathId: string;
11
- from: Point;
12
- to: Point;
13
- };
14
- export declare function isPointPickingElement(element: PickingElement): element is PointPickingElement;
15
- export declare function isSegmentPickingElement(element: PickingElement): element is SegmentPickingElement;
16
- export type PathLevel = 1 | 2 | 3 | 4;
17
- export declare const DEFAULT_LEVEL: PathLevel;
18
- export type PathLayerProps = {
19
- path: PathData;
20
- color: string;
21
- pickingTolerance?: number;
22
- level?: PathLevel;
23
- border?: {
24
- offset: number;
25
- color: string;
26
- width?: number;
27
- backgroundColor?: string;
28
- };
29
- };
30
- /**
31
- * This component handles drawing a Path inside a SpaceTimeChart. It renders:
32
- * - The path itself
33
- * - The pauses
34
- * - The "picking" shape (to handle interactions)
35
- */
36
- export declare const PathLayer: ({ path, color, level, pickingTolerance, border, }: PathLayerProps) => null;
37
- export default PathLayer;
@@ -1,8 +0,0 @@
1
- import { type CanvasRect } from '../utils/canvas';
2
- export type PatternRectProps = CanvasRect & {
3
- imageElement: HTMLImageElement;
4
- };
5
- /**
6
- * draws a repeating pattern in the space time chart
7
- */
8
- export declare const PatternRect: ({ imageElement, ...rect }: PatternRectProps) => null;
@@ -1,26 +0,0 @@
1
- import type { PickingElement } from '../../common/types';
2
- import type { DataPoint } from '../lib/types';
3
- export type QuadrilaterPickingElement = PickingElement & {
4
- type: 'quadrilateral';
5
- id: string;
6
- };
7
- export declare function isQuadrilaterPickingElement(element: PickingElement): element is QuadrilaterPickingElement;
8
- export type QuadrilateralProps = {
9
- id: string;
10
- vertices: [DataPoint, DataPoint, DataPoint, DataPoint];
11
- style: {
12
- backgroundColor: string;
13
- borderColor: string;
14
- borderWidth: number;
15
- };
16
- };
17
- /**
18
- * Draws a quadrilateral in the space time chart
19
- * Position correspond to each point of the quadrilateral
20
- *
21
- * vertices[0] ________ vertices[1]
22
- * / /
23
- * vertices[3] /________/ vertices[2]
24
- *
25
- */
26
- export declare const Quadrilateral: ({ id, vertices, style }: QuadrilateralProps) => null;
@@ -1,2 +0,0 @@
1
- declare const SpaceGraduations: () => null;
2
- export default SpaceGraduations;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { type SpaceTimeChartProps } from '../lib/types';
3
- export declare const SpaceTimeChart: (props: SpaceTimeChartProps) => React.JSX.Element;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import type { Point } from '../../common/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,19 +0,0 @@
1
- import React from 'react';
2
- export type WorkSchedule = {
3
- type: 'TRACK' | 'CATENARY';
4
- timeStart: Date;
5
- timeEnd: Date;
6
- spaceRanges: [number, number][];
7
- };
8
- type WorkScheduleLayerProps = {
9
- workSchedules: WorkSchedule[];
10
- imageUrl: string;
11
- };
12
- /**
13
- * Displays the workschedule projection on the Space time chart.
14
- * A workschedule has a start time and an end time.
15
- * It can contain several portions of a track occupied during this period.
16
- * Each portion is represented by a rectangle region
17
- */
18
- export declare const WorkScheduleLayer: ({ workSchedules, imageUrl }: WorkScheduleLayerProps) => React.JSX.Element[] | null;
19
- export {};
@@ -1,2 +0,0 @@
1
- import { type CanvasRect } from '../utils/canvas';
2
- export declare const ZoomRect: (rect: CanvasRect) => null;
@@ -1,4 +0,0 @@
1
- declare module '*.svg' {
2
- const content: string;
3
- export default content;
4
- }
@@ -1,17 +0,0 @@
1
- import './styles/main.css';
2
- export * from './components/SpaceTimeChart';
3
- export * from './components/PathLayer';
4
- export * from './components/ConflictLayer';
5
- export * from './components/ConflictTooltip';
6
- export * from './components/Tooltip';
7
- export * from './components/OccupancyBlockLayer';
8
- export * from './components/WorkScheduleLayer';
9
- export * from './components/PatternRect';
10
- export * from './components/Quadrilateral';
11
- export * from './components/ZoomRect';
12
- export { DEFAULT_THEME } from './lib/consts';
13
- export { MouseContext, SpaceTimeChartContext, SpaceTimeChartCanvasContext } from './lib/context';
14
- export type { SpaceTimeChartProps, SpaceScale, OperationalPoint, SpaceTimeChartTheme, PathData, DataPoint, SpaceTimeChartContextType, } from './lib/types';
15
- export { isPathOnScreen } from './utils/geometry';
16
- export { getSpaceAtTime } from './utils/scales';
17
- export { computeRectZoomOffsets } from './utils/scales';
@@ -1,17 +0,0 @@
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 = "#B6B3AF";
6
- export declare const GREY_50 = "#797671";
7
- export declare const WHITE = "#FFFFFF";
8
- export declare const WHITE_75 = "#FFFFFFC0";
9
- export declare const AMBIANT_A10 = "#EFF3F5";
10
- export declare const ERROR_30 = "#FF6868";
11
- export declare const ERROR_60 = "#D91C1C";
12
- export declare const OCCUPANCY_FREE = "#CAEDDB";
13
- export declare const OCCUPANCY_SEMAPHORE = "#FFD4D8";
14
- export declare const OCCUPANCY_WARNING = "#FFEABF";
15
- export declare const FONT_SIZE = 10;
16
- export declare const FONT = "IBM Plex Sans, sans-serif";
17
- export declare const DEFAULT_THEME: SpaceTimeChartTheme;
@@ -1,13 +0,0 @@
1
- import type { CanvasContextType } from '../../common/types';
2
- import type { MouseContextType, SpaceTimeChartContextType } from './types';
3
- /**
4
- * This context exports everything necessary to draw the chart.
5
- * It is updated anytime the scales are updated.
6
- */
7
- export declare const SpaceTimeChartContext: import("react").Context<SpaceTimeChartContextType>;
8
- export declare const SpaceTimeChartCanvasContext: import("react").Context<CanvasContextType<SpaceTimeChartContextType>>;
9
- /**
10
- * This context exports everything necessary to draw the chart.
11
- * It is updated anytime the scales are updated or the mouse moves.
12
- */
13
- export declare const MouseContext: import("react").Context<MouseContextType>;
@@ -1,2 +0,0 @@
1
- import { type SpaceTimeChartTheme } from './types';
2
- export declare function validateTheme({ breakpoints, timeRanges, timeCaptionsStyles, timeCaptionsPriorities, timeGraduationsStyles, timeGraduationsPriorities, }: SpaceTimeChartTheme): void;