@osrd-project/ui-charts 0.0.70 → 0.0.71
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.
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/manchette/components/ManchetteWithSpaceTimeChart.d.ts +1 -2
- package/dist/manchette/hooks/useManchetteWithSpaceTimeChart.d.ts +2 -4
- package/dist/manchette/hooks/usePaths.d.ts +2 -4
- package/dist/manchette/types.d.ts +1 -1
- package/dist/spaceTimeChart/components/TimeCaptions.d.ts +1 -3
- package/dist/spaceTimeChart/lib/consts.d.ts +17 -0
- package/dist/spaceTimeChart/lib/types.d.ts +15 -7
- package/dist/spaceTimeChart/utils/canvas.d.ts +12 -9
- package/dist/spaceTimeChart/utils/scales.d.ts +1 -1
- package/package.json +4 -4
|
@@ -5,7 +5,6 @@ import { type ProjectPathTrainResult, type Waypoint } from '../types';
|
|
|
5
5
|
export type ManchetteWithSpaceTimeChartProps = {
|
|
6
6
|
waypoints: Waypoint[];
|
|
7
7
|
projectPathTrainResult: ProjectPathTrainResult[];
|
|
8
|
-
selectedTrain?: number;
|
|
9
8
|
height?: number;
|
|
10
9
|
children?: React.ReactNode;
|
|
11
10
|
header?: React.ReactNode;
|
|
@@ -18,5 +17,5 @@ export type ManchetteWithSpaceTimeChartProps = {
|
|
|
18
17
|
* This only covers basic usage. For more advanced control over the manchette
|
|
19
18
|
* and space time chart, the useManchetteWithSpaceTimeChart() hook can be used.
|
|
20
19
|
*/
|
|
21
|
-
declare const ManchetteWithSpaceTimeChart: ({ waypoints, projectPathTrainResult,
|
|
20
|
+
declare const ManchetteWithSpaceTimeChart: ({ waypoints, projectPathTrainResult, height, children, header, manchetteProps: additionalManchetteProps, spaceTimeChartProps: additionalSpaceTimeChartProps, }: ManchetteWithSpaceTimeChartProps) => React.JSX.Element;
|
|
22
21
|
export default ManchetteWithSpaceTimeChart;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { SpaceTimeChartProps } from '../../spaceTimeChart';
|
|
2
2
|
import type { ProjectPathTrainResult, Waypoint } from '../types';
|
|
3
|
-
declare const useManchetteWithSpaceTimeChart: ({ waypoints, projectPathTrainResult, manchetteWithSpaceTimeChartRef,
|
|
3
|
+
declare const useManchetteWithSpaceTimeChart: ({ waypoints, projectPathTrainResult, manchetteWithSpaceTimeChartRef, height, spaceTimeChartRef, defaultTimeOrigin, defaultSpaceOrigin, }: {
|
|
4
4
|
waypoints: Waypoint[];
|
|
5
5
|
projectPathTrainResult: ProjectPathTrainResult[];
|
|
6
6
|
manchetteWithSpaceTimeChartRef: React.RefObject<HTMLDivElement>;
|
|
7
|
-
selectedTrain?: number;
|
|
8
7
|
height?: number;
|
|
9
8
|
spaceTimeChartRef?: React.RefObject<HTMLDivElement>;
|
|
10
9
|
defaultTimeOrigin?: number;
|
|
@@ -46,12 +45,11 @@ declare const useManchetteWithSpaceTimeChart: ({ waypoints, projectPathTrainResu
|
|
|
46
45
|
paths: {
|
|
47
46
|
id: string;
|
|
48
47
|
label: string;
|
|
49
|
-
color: string;
|
|
50
|
-
level: import("../../spaceTimeChart").PathLevel;
|
|
51
48
|
points: {
|
|
52
49
|
time: number;
|
|
53
50
|
position: number;
|
|
54
51
|
}[];
|
|
52
|
+
color: string;
|
|
55
53
|
}[];
|
|
56
54
|
xOffset: number;
|
|
57
55
|
yOffset: number;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { type PathLevel } from '../../spaceTimeChart';
|
|
2
1
|
import { type ProjectPathTrainResult } from '../types';
|
|
3
|
-
declare const usePaths: (projectPathTrainResult: ProjectPathTrainResult[]
|
|
2
|
+
declare const usePaths: (projectPathTrainResult: ProjectPathTrainResult[]) => {
|
|
4
3
|
id: string;
|
|
5
4
|
label: string;
|
|
6
|
-
color: string;
|
|
7
|
-
level: PathLevel;
|
|
8
5
|
points: {
|
|
9
6
|
time: number;
|
|
10
7
|
position: number;
|
|
11
8
|
}[];
|
|
9
|
+
color: string;
|
|
12
10
|
}[];
|
|
13
11
|
export default usePaths;
|
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
import { type SpaceTimeChartTheme } from './types';
|
|
2
|
+
export declare const BLACK = "#000000";
|
|
3
|
+
export declare const BLUE = "#2170B9";
|
|
4
|
+
export declare const GREY_10 = "#EDEDED";
|
|
5
|
+
export declare const GREY_30 = "#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 SECOND = 1000;
|
|
2
18
|
export declare const MINUTE: number;
|
|
19
|
+
export declare const HOUR: number;
|
|
3
20
|
export declare const DEFAULT_THEME: SpaceTimeChartTheme;
|
|
@@ -106,6 +106,14 @@ export type LineStyle = {
|
|
|
106
106
|
opacity?: number;
|
|
107
107
|
dashArray?: number[];
|
|
108
108
|
};
|
|
109
|
+
export type CaptionStyle = {
|
|
110
|
+
color: string;
|
|
111
|
+
font: string;
|
|
112
|
+
fontWeight?: string;
|
|
113
|
+
fontSize?: string;
|
|
114
|
+
topOffset?: number;
|
|
115
|
+
textAlign?: CanvasTextAlign;
|
|
116
|
+
};
|
|
109
117
|
export type SpaceTimeChartTheme = {
|
|
110
118
|
background: string;
|
|
111
119
|
breakpoints: number[];
|
|
@@ -116,15 +124,12 @@ export type SpaceTimeChartTheme = {
|
|
|
116
124
|
};
|
|
117
125
|
spaceGraduationsStyles: Record<number, LineStyle>;
|
|
118
126
|
timeCaptionsPriorities: number[][];
|
|
119
|
-
timeCaptionsStyles: Record<number,
|
|
120
|
-
|
|
121
|
-
font: string;
|
|
122
|
-
fontWeight?: string;
|
|
123
|
-
fontSize?: string;
|
|
124
|
-
topOffset?: number;
|
|
125
|
-
}>;
|
|
127
|
+
timeCaptionsStyles: Record<number, CaptionStyle>;
|
|
128
|
+
timeCaptionsSize: number;
|
|
126
129
|
timeGraduationsPriorities: number[][];
|
|
127
130
|
timeGraduationsStyles: Record<number, LineStyle>;
|
|
131
|
+
dateCaptionsStyle: CaptionStyle;
|
|
132
|
+
dateCaptionsSize: number;
|
|
128
133
|
};
|
|
129
134
|
export type SpaceTimeChartProps = {
|
|
130
135
|
children?: ReactNode[];
|
|
@@ -139,6 +144,7 @@ export type SpaceTimeChartProps = {
|
|
|
139
144
|
enableSnapping?: boolean;
|
|
140
145
|
hideGrid?: boolean;
|
|
141
146
|
hidePathsLabels?: boolean;
|
|
147
|
+
hideDates?: boolean;
|
|
142
148
|
showTicks?: boolean;
|
|
143
149
|
theme?: Partial<SpaceTimeChartTheme>;
|
|
144
150
|
onPan?: Handler<{
|
|
@@ -202,8 +208,10 @@ export type SpaceTimeChartContextType = {
|
|
|
202
208
|
tracks?: Track[];
|
|
203
209
|
occupancyZones?: OccupancyZone[];
|
|
204
210
|
theme: SpaceTimeChartTheme;
|
|
211
|
+
captionSize: number;
|
|
205
212
|
enableSnapping: boolean;
|
|
206
213
|
hideGrid: boolean;
|
|
207
214
|
hidePathsLabels: boolean;
|
|
215
|
+
hideDates: boolean;
|
|
208
216
|
showTicks: boolean;
|
|
209
217
|
};
|
|
@@ -26,17 +26,19 @@ export declare function drawPathOutExtremity(ctx: CanvasRenderingContext2D, time
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function drawPathExtremity(ctx: CanvasRenderingContext2D, timePixel: number, spacePixel: number, swapAxis: boolean, extremityType: 'from' | 'to', pathDirection: Direction, pathEnd: PathEnd): void;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
29
|
* @param minT number timestamp
|
|
31
30
|
* @param maxT number timestamp
|
|
32
31
|
* @param timeRanges time frames (24h, 12h, 6h, …)
|
|
33
32
|
* @param gridlinesLevels width of the lines for each time frame
|
|
34
33
|
* @param formatter function to format de values inside the output object
|
|
35
|
-
* @returns Record<number, number>
|
|
36
34
|
* Keys are times in ms
|
|
37
35
|
* Values are the highest level on each time
|
|
38
36
|
*/
|
|
39
|
-
export declare function computeVisibleTimeMarkers<T
|
|
37
|
+
export declare function computeVisibleTimeMarkers<T extends object = {
|
|
38
|
+
level: number;
|
|
39
|
+
}>(minT: number, maxT: number, timeRanges: number[], gridlinesLevels: number[], formatter?: (level: number, i: number) => T): (T & {
|
|
40
|
+
time: number;
|
|
41
|
+
})[];
|
|
40
42
|
/**
|
|
41
43
|
* To get crisp horizontal or vertical lines on a canvas, we must draw them as thin as possible, in
|
|
42
44
|
* terms of actual pixels on screen.
|
|
@@ -54,10 +56,11 @@ export type CanvasRect = {
|
|
|
54
56
|
spaceStart: number;
|
|
55
57
|
spaceEnd: number;
|
|
56
58
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
/**
|
|
60
|
+
* You most likely need to wrap this function call with ctx.save ctx.restore
|
|
61
|
+
* as it modifies ctx current transformation matrix
|
|
62
|
+
*/
|
|
63
|
+
export declare function fillRect(ctx: CanvasRenderingContext2D, { timeStart, timeEnd, spaceStart, spaceEnd }: CanvasRect, { getPoint }: SpaceTimeChartContextType): {
|
|
64
|
+
width: number;
|
|
65
|
+
height: number;
|
|
63
66
|
};
|
|
@@ -29,7 +29,7 @@ export declare function getNormalizedScaleAtPixel(y: number, tree: NormalizedSca
|
|
|
29
29
|
export declare function getTimeToPixel(timeOrigin: number, pixelOffset: number, timeScale: number): TimeToPixel;
|
|
30
30
|
export declare function getPixelToTime(timeOrigin: number, pixelOffset: number, timeScale: number): PixelToTime;
|
|
31
31
|
export declare function getSpaceToPixel(pixelOffset: number, binaryTree: NormalizedScaleTree): SpaceToPixel;
|
|
32
|
-
export declare function getPixelToSpace(
|
|
32
|
+
export declare function getPixelToSpace(pixelOffset: number, binaryTree: NormalizedScaleTree): PixelToSpace;
|
|
33
33
|
export declare function getPointToData(getTime: PixelToTime, getSpace: PixelToSpace, timeAxis: Axis, spaceAxis: Axis): PointToData;
|
|
34
34
|
export declare function getDataToPoint(getTimePixel: TimeToPixel, getSpacePixel: SpaceToPixel, timeAxis: Axis, spaceAxis: Axis): DataToPoint;
|
|
35
35
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osrd-project/ui-charts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.71",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
5
|
"bugs": "https://github.com/osrd-project/osrd-ui/issues",
|
|
6
6
|
"repository": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"tailwindcss": ">=3.4"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@osrd-project/ui-core": "^0.0.
|
|
46
|
-
"@osrd-project/ui-icons": "^0.0.
|
|
45
|
+
"@osrd-project/ui-core": "^0.0.71",
|
|
46
|
+
"@osrd-project/ui-icons": "^0.0.71",
|
|
47
47
|
"chroma-js": "^3.1.1",
|
|
48
48
|
"d3-selection": "^3.0.0",
|
|
49
49
|
"d3-zoom": "^3.0.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"@types/file-saver": "^2.0.7",
|
|
57
57
|
"file-saver": "^2.0.5"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "5b43698d50f450ce7a6f37fdd978ced8ffb379ef"
|
|
60
60
|
}
|