@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,10 @@
1
+ import React from 'react';
2
+ import { type InteractiveWaypoint } from '../types';
3
+ type WaypointProps = {
4
+ waypoint: InteractiveWaypoint;
5
+ nameRef?: React.RefObject<HTMLDivElement>;
6
+ isActive: boolean;
7
+ isMenuActive?: boolean;
8
+ };
9
+ declare const Waypoint: ({ waypoint: { name, secondaryCode, id, position, onClick }, nameRef, isActive, isMenuActive, }: WaypointProps) => React.JSX.Element;
10
+ export default Waypoint;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { InteractiveWaypoint } from '../types';
3
+ type WaypointListProps = {
4
+ contents: (InteractiveWaypoint | React.ReactNode)[];
5
+ activeWaypointId?: string;
6
+ activeWaypointRef?: React.RefObject<HTMLDivElement>;
7
+ };
8
+ declare const WaypointList: ({ contents, activeWaypointId, activeWaypointRef }: WaypointListProps) => React.JSX.Element;
9
+ export default WaypointList;
@@ -0,0 +1,15 @@
1
+ export declare const INITIAL_OP_LIST_HEIGHT = 521;
2
+ export declare const BASE_WAYPOINT_HEIGHT = 32;
3
+ export declare const INITIAL_WAYPOINT_LIST_HEIGHT = 521;
4
+ export declare const INITIAL_SPACE_TIME_CHART_HEIGHT: number;
5
+ export declare const MIN_ZOOM_MS_PER_PX = 600000;
6
+ export declare const MAX_ZOOM_MS_PER_PX = 625;
7
+ export declare const DEFAULT_ZOOM_MS_PER_PX = 7500;
8
+ export declare const MIN_ZOOM_X = 0;
9
+ export declare const MAX_ZOOM_X = 100;
10
+ export declare const MIN_ZOOM_Y = 1;
11
+ export declare const MAX_ZOOM_Y = 10.5;
12
+ export declare const ZOOM_Y_DELTA = 0.5;
13
+ export declare const FOOTER_HEIGHT = 40;
14
+ export declare const WAYPOINT_LINE_HEIGHT = 16;
15
+ export declare const PATH_COLOR_DEFAULT = "#8A714B";
@@ -0,0 +1,66 @@
1
+ import type { SpaceTimeChartProps } from '../../spaceTimeChart';
2
+ import type { ProjectPathTrainResult, Waypoint } from '../types';
3
+ declare const useManchettesWithSpaceTimeChart: (waypoints: Waypoint[], projectPathTrainResult: ProjectPathTrainResult[], manchetteWithSpaceTimeChartContainer: React.RefObject<HTMLDivElement>, selectedTrain?: number, height?: number, spaceTimeChartRef?: React.RefObject<HTMLDivElement>) => {
4
+ manchetteProps: {
5
+ contents: import("../types").InteractiveWaypoint[];
6
+ zoomYIn: () => void;
7
+ zoomYOut: () => void;
8
+ resetZoom: () => void;
9
+ toggleMode: () => void;
10
+ yZoom: number;
11
+ isProportional: boolean;
12
+ yOffset: number;
13
+ };
14
+ spaceTimeChartProps: {
15
+ operationalPoints: {
16
+ id: string;
17
+ label: string;
18
+ position: number;
19
+ importanceLevel: number;
20
+ }[];
21
+ spaceScales: {
22
+ from: number;
23
+ to: number;
24
+ size: number;
25
+ }[] | ({
26
+ coefficient: number;
27
+ size?: undefined;
28
+ from: number;
29
+ to: number;
30
+ } | {
31
+ size: number;
32
+ coefficient?: undefined;
33
+ from: number;
34
+ to: number;
35
+ })[];
36
+ timeScale: number;
37
+ paths: {
38
+ id: string;
39
+ label: string;
40
+ color: string;
41
+ level: import("../../spaceTimeChart").PathLevel;
42
+ points: {
43
+ time: number;
44
+ position: number;
45
+ }[];
46
+ }[];
47
+ xOffset: number;
48
+ yOffset: number;
49
+ onZoom: ({ delta, position }: Parameters<NonNullable<SpaceTimeChartProps["onZoom"]>>[0]) => void;
50
+ onPan: (payload: {
51
+ initialPosition: {
52
+ x: number;
53
+ y: number;
54
+ };
55
+ position: {
56
+ x: number;
57
+ y: number;
58
+ };
59
+ isPanning: boolean;
60
+ }) => void;
61
+ };
62
+ handleScroll: () => void;
63
+ handleXZoom: (newXZoom: number, xPosition?: number) => void;
64
+ xZoom: number;
65
+ };
66
+ export default useManchettesWithSpaceTimeChart;
@@ -0,0 +1,13 @@
1
+ import { type PathLevel } from '../../spaceTimeChart';
2
+ import { type ProjectPathTrainResult } from '../types';
3
+ declare const usePaths: (projectPathTrainResult: ProjectPathTrainResult[], selectedTrain?: number) => {
4
+ id: string;
5
+ label: string;
6
+ color: string;
7
+ level: PathLevel;
8
+ points: {
9
+ time: number;
10
+ position: number;
11
+ }[];
12
+ }[];
13
+ export default usePaths;
@@ -0,0 +1,9 @@
1
+ import '@osrd-project/ui-core/dist/theme.css';
2
+ import './styles/main.css';
3
+ import './consts';
4
+ export { default as Manchette, type ManchetteProps } from './components/Manchette';
5
+ export { default as ManchetteWithSpaceTimeChart } from './components/ManchetteWithSpaceTimeChart';
6
+ export { DEFAULT_ZOOM_MS_PER_PX } from './consts';
7
+ export { default as useManchetteWithSpaceTimeChart } from './hooks/useManchetteWithSpaceTimeChart';
8
+ export type { WaypointMenuData, Waypoint, ProjectPathTrainResult, InteractiveWaypoint, } from './types';
9
+ export { timeScaleToZoomValue } from './utils/helpers';
@@ -0,0 +1,26 @@
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 WaypointMenuData = {
14
+ menu: React.ReactNode;
15
+ activeWaypointId?: string;
16
+ manchetteWrapperRef: React.RefObject<HTMLDivElement>;
17
+ };
18
+ export type ProjectPathTrainResult = {
19
+ id: number;
20
+ name: string;
21
+ spaceTimeCurves: {
22
+ positions: number[];
23
+ times: number[];
24
+ }[];
25
+ departureTime: Date;
26
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import type { InteractiveWaypoint, Waypoint } from '../types';
2
+ type WaypointsOptions = {
3
+ isProportional: boolean;
4
+ yZoom: number;
5
+ height: number;
6
+ };
7
+ export declare const filterVisibleElements: (elements: Waypoint[], totalDistance: number, heightWithoutFinalWaypoint: number, minSpace: number) => Waypoint[];
8
+ export declare const computeWaypointsToDisplay: (waypoints: Waypoint[], { height, isProportional, yZoom }: WaypointsOptions) => InteractiveWaypoint[];
9
+ export declare const getScales: (waypoints: Waypoint[], { height, isProportional, yZoom }: WaypointsOptions) => {
10
+ from: number;
11
+ to: number;
12
+ size: number;
13
+ }[] | ({
14
+ coefficient: number;
15
+ size?: undefined;
16
+ from: number;
17
+ to: number;
18
+ } | {
19
+ size: number;
20
+ coefficient?: undefined;
21
+ from: number;
22
+ to: number;
23
+ })[];
24
+ export declare const zoomValueToTimeScale: (slider: number) => number;
25
+ export declare const timeScaleToZoomValue: (timeScale: number) => number;
26
+ /** Zoom on X axis and center on the mouse position */
27
+ export declare const zoomX: (currentZoom: number, currentOffset: number, newZoom: number, position: number) => {
28
+ xZoom: number;
29
+ xOffset: number;
30
+ };
31
+ export {};
@@ -0,0 +1,12 @@
1
+ export declare const getHeightWithoutLastWaypoint: (height: number) => number;
2
+ export declare const positionMmToKm: (position: number) => number;
3
+ export declare const msToS: (time: number) => number;
4
+ export declare const calcTotalDistance: <T extends {
5
+ position: number;
6
+ }>(ops: T[]) => number;
7
+ type Point = {
8
+ x: number;
9
+ y: number;
10
+ };
11
+ export declare function getDistance(a: Point, b: Point): Point;
12
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { PickingElement } from '../lib/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;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { Point } from '../lib/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;
@@ -0,0 +1,11 @@
1
+ export type OccupancyBlock = {
2
+ timeStart: number;
3
+ timeEnd: number;
4
+ spaceStart: number;
5
+ spaceEnd: number;
6
+ color: string;
7
+ };
8
+ export type OccupancyBlockLayerProps = {
9
+ occupancyBlocks: OccupancyBlock[];
10
+ };
11
+ export declare const OccupancyBlockLayer: ({ occupancyBlocks }: OccupancyBlockLayerProps) => null;
@@ -0,0 +1,36 @@
1
+ import { type PathData, type PickingElement, type Point } from '../lib/types';
2
+ export type PointPickingElement = PickingElement & {
3
+ type: 'point';
4
+ pathId: string;
5
+ point: Point;
6
+ };
7
+ export type SegmentPickingElement = PickingElement & {
8
+ type: 'segment';
9
+ pathId: string;
10
+ from: Point;
11
+ to: Point;
12
+ };
13
+ export declare function isPointPickingElement(element: PickingElement): element is PointPickingElement;
14
+ export declare function isSegmentPickingElement(element: PickingElement): element is SegmentPickingElement;
15
+ export type PathLevel = 1 | 2 | 3 | 4;
16
+ export declare const DEFAULT_LEVEL: PathLevel;
17
+ export type PathLayerProps = {
18
+ path: PathData;
19
+ color: string;
20
+ pickingTolerance?: number;
21
+ level?: PathLevel;
22
+ border?: {
23
+ offset: number;
24
+ color: string;
25
+ width?: number;
26
+ backgroundColor?: string;
27
+ };
28
+ };
29
+ /**
30
+ * This component handles drawing a Path inside a SpaceTimeChart. It renders:
31
+ * - The path itself
32
+ * - The pauses
33
+ * - The "picking" shape (to handle interactions)
34
+ */
35
+ export declare const PathLayer: ({ path, color, level, pickingTolerance, border, }: PathLayerProps) => null;
36
+ export default PathLayer;
@@ -0,0 +1,8 @@
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;
@@ -0,0 +1,2 @@
1
+ declare const SpaceGraduations: () => null;
2
+ export default SpaceGraduations;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { type SpaceTimeChartProps } from '../lib/types';
3
+ export declare const SpaceTimeChart: (props: SpaceTimeChartProps) => React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare const CAPTION_SIZE = 33;
2
+ declare const TimeCaptions: () => null;
3
+ export default TimeCaptions;
@@ -0,0 +1,2 @@
1
+ declare const TimeGraduations: () => null;
2
+ export default TimeGraduations;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { type WorkSchedule } from '../types';
3
+ type WorkScheduleLayerProps = {
4
+ workSchedules: WorkSchedule[];
5
+ imageUrl: string;
6
+ };
7
+ /**
8
+ * Displays the workschedule projection on the Space time chart.
9
+ * A workschedule has a start time and an end time.
10
+ * It can contain several portions of a track occupied during this period.
11
+ * Each portion is represented by a rectangle region
12
+ */
13
+ export declare const WorkScheduleLayer: ({ workSchedules, imageUrl }: WorkScheduleLayerProps) => React.JSX.Element[] | null;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ import { type CanvasRect } from '../utils/canvas';
2
+ export declare const ZoomRect: (rect: CanvasRect) => null;
@@ -0,0 +1,4 @@
1
+ declare module '*.svg' {
2
+ const content: string;
3
+ export default content;
4
+ }
@@ -0,0 +1,19 @@
1
+ import { type CanvasContextType, type DrawingFunction, type HoveredItem, type LayerType, type PickingDrawingFunction, type PickingLayerType, type Point, type SpaceTimeChartContextType } from '../lib/types';
2
+ /**
3
+ * This hook handles the internal canvas drawing logic of the SpaceTimeChart component.
4
+ * It is an internal hook, and should only be used inside SpaceTimeChart.
5
+ */
6
+ export declare function useCanvas(dom: HTMLElement | null, inputStcContext: SpaceTimeChartContextType, position?: Point): {
7
+ canvasContext: CanvasContextType;
8
+ hoveredItem: HoveredItem | null;
9
+ };
10
+ /**
11
+ * This hook helps to bind a picking function to a layer in the SpaceTimeChart.
12
+ * It is public and can be used outside SpaceTimeChart.
13
+ */
14
+ export declare function usePicking(layer: PickingLayerType, fn: PickingDrawingFunction): void;
15
+ /**
16
+ * This hook helps to bind a drawing function to a layer in the SpaceTimeChart.
17
+ * It is public and can be used outside SpaceTimeChart.
18
+ */
19
+ export declare function useDraw(layer: LayerType, fn: DrawingFunction): void;
@@ -0,0 +1 @@
1
+ export declare function useDevicePixelRatio(): number;
@@ -0,0 +1,8 @@
1
+ import { type MouseContextType, type SpaceTimeChartContextType, type SpaceTimeChartProps } from '../lib/types';
2
+ type Handlers = Pick<SpaceTimeChartProps, 'onPan' | 'onMouseMove' | 'onClick' | 'onZoom'>;
3
+ /**
4
+ * This hook handles SpaceTimeChart mouse interactions.
5
+ * It is an internal hook, and should only be used inside SpaceTimeChart.
6
+ */
7
+ export declare function useMouseInteractions(dom: HTMLElement | null, { position, hoveredItem, down, isHover }: MouseContextType, handlers: Handlers, context: SpaceTimeChartContextType): void;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ import { type MouseState } from '../lib/types';
2
+ /**
3
+ * This hook handles SpaceTimeChart mouse tracking.
4
+ * It is an internal hook, and should only be used inside SpaceTimeChart.
5
+ */
6
+ export declare function useMouseTracking(dom: HTMLElement | null): MouseState;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This hook takes a DOM element reference as input, and returns always updated width and height.
3
+ * It is an internal hook, and should only be used inside SpaceTimeChart.
4
+ */
5
+ export declare function useSize(dom?: HTMLElement | null): {
6
+ width: number;
7
+ height: number;
8
+ };
@@ -0,0 +1,9 @@
1
+ import './styles/main.css';
2
+ export type { HoveredItem, SpaceTimeChartProps, SpaceScale, OperationalPoint, SpaceTimeChartTheme, Point, DataPoint, SpaceTimeChartContextType, } from './lib/types';
3
+ export * from './components/SpaceTimeChart';
4
+ export * from './components/PathLayer';
5
+ export * from './components/ConflictLayer';
6
+ export * from './components/ConflictTooltip';
7
+ export * from './components/OccupancyBlockLayer';
8
+ export * from './components/WorkScheduleLayer';
9
+ export * from './components/PatternRect';
@@ -0,0 +1,20 @@
1
+ import { type SpaceTimeChartTheme } from './types';
2
+ export declare const BLACK = "#000000";
3
+ export declare const BLUE = "#2170B9";
4
+ export declare const GREY_10 = "#EDEDED";
5
+ export declare const GREY_30 = "#B6B2AF";
6
+ export declare const GREY_50 = "#797671";
7
+ export declare const WHITE_75 = "#FFFFFFC0";
8
+ export declare const AMBIANT_A10 = "#EFF3F5";
9
+ export declare const ERROR_30 = "#FF6868";
10
+ export declare const ERROR_60 = "#D91C1C";
11
+ export declare const OCCUPANCY_FREE = "#CAEDDB";
12
+ export declare const OCCUPANCY_SEMAPHORE = "#FFD4D8";
13
+ export declare const OCCUPANCY_WARNING = "#FFEABF";
14
+ export declare const FONT_SIZE = 10;
15
+ export declare const FONT = "IBM Plex Sans";
16
+ export declare const SECOND = 1000;
17
+ export declare const MINUTE: number;
18
+ export declare const HOUR: number;
19
+ export declare const KILOMETER = 1000;
20
+ export declare const DEFAULT_THEME: SpaceTimeChartTheme;
@@ -0,0 +1,16 @@
1
+ import { type CanvasContextType, type MouseContextType, type SpaceTimeChartContextType } from './types';
2
+ /**
3
+ * This context exports everything necessary to draw the chart.
4
+ * It is updated anytime the scales are updated.
5
+ */
6
+ export declare const SpaceTimeChartContext: import("react").Context<SpaceTimeChartContextType>;
7
+ /**
8
+ * This context only contains necessary helpers to (un)register drawing functions.
9
+ * It is basically never updated.
10
+ */
11
+ export declare const CanvasContext: import("react").Context<CanvasContextType>;
12
+ /**
13
+ * This context exports everything necessary to draw the chart.
14
+ * It is updated anytime the scales are updated or the mouse moves.
15
+ */
16
+ export declare const MouseContext: import("react").Context<MouseContextType>;
@@ -0,0 +1,2 @@
1
+ import { type SpaceTimeChartTheme } from './types';
2
+ export declare function validateTheme({ breakpoints, timeRanges, timeCaptionsStyles, timeCaptionsPriorities, timeGraduationsStyles, timeGraduationsPriorities, }: SpaceTimeChartTheme): void;