@osrd-project/ui-charts 0.0.82 → 0.0.83
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/chronogram/components/Chronogram.d.ts +1 -1
- package/dist/chronogram/components/ChronogramCanvas.d.ts +3 -0
- package/dist/chronogram/components/ChronogramManchette.d.ts +9 -0
- package/dist/chronogram/components/OccupancyBlocksLayer.d.ts +1 -0
- package/dist/chronogram/hooks/useChronogram.d.ts +35 -0
- package/dist/chronogram/index.d.ts +6 -1
- package/dist/chronogram/lib/const.d.ts +5 -0
- package/dist/chronogram/lib/types.d.ts +15 -6
- package/dist/chronogram/utils/format.d.ts +1 -0
- package/dist/common/helpers/colors.d.ts +8 -3
- package/dist/{spaceTimeChart → common}/hooks/useMouseInteractions.d.ts +1 -1
- package/dist/{spaceTimeChart → common}/hooks/useMouseTracking.d.ts +1 -1
- package/dist/common/types.d.ts +1 -1
- package/dist/index.esm.js +828 -529
- package/dist/index.esm.js.map +1 -1
- package/dist/manchette/components/ManchetteWithSpaceTimeChart.d.ts +1 -1
- package/dist/spaceTimeChart/lib/context.d.ts +1 -1
- package/dist/speedSpaceChart/components/utils.d.ts +1 -1
- package/dist/theme.css +963 -279
- package/dist/theme.css.map +1 -1
- package/dist/trackOccupancyDiagram/lib/types.d.ts +1 -1
- package/package.json +8 -7
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ChronogramProps } from '../lib/types';
|
|
3
|
-
export declare const Chronogram: (
|
|
3
|
+
export declare const Chronogram: ({ levelCrossingData, timeOrigin, height, }: ChronogramProps) => React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ChronogramManchetteProps = {
|
|
3
|
+
levelCrossingsNames: string[];
|
|
4
|
+
height: number;
|
|
5
|
+
width?: number;
|
|
6
|
+
onDelete: (name: string) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const ChronogramManchette: ({ levelCrossingsNames, height, width, onDelete, }: ChronogramManchetteProps) => React.JSX.Element;
|
|
9
|
+
export default ChronogramManchette;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const OccupancyBlocksLayer: () => null;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Point } from '../../common/types';
|
|
2
|
+
export type UseChronogramProps = {
|
|
3
|
+
itemCount: number;
|
|
4
|
+
chronogramManchetteRef: React.RefObject<HTMLDivElement | null>;
|
|
5
|
+
chronogramChartRef: React.RefObject<HTMLDivElement | null>;
|
|
6
|
+
chronogramHeight: number;
|
|
7
|
+
};
|
|
8
|
+
export type ChronogramState = {
|
|
9
|
+
height: number;
|
|
10
|
+
xOffset: number;
|
|
11
|
+
yOffset: number;
|
|
12
|
+
panning: {
|
|
13
|
+
initialOffset: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
17
|
+
} | null;
|
|
18
|
+
xZoom: number;
|
|
19
|
+
};
|
|
20
|
+
declare const useChronogram: ({ itemCount, chronogramManchetteRef, chronogramChartRef, chronogramHeight, }: UseChronogramProps) => {
|
|
21
|
+
handleVerticalScroll: () => void;
|
|
22
|
+
handleXZoom: (newXZoom: number, xPosition?: number) => void;
|
|
23
|
+
handleXZoomOnWheelEvent: (wheelEvent: WheelEvent, newXZoom: number, xPosition: number) => void;
|
|
24
|
+
height: number;
|
|
25
|
+
onPan: (payload: {
|
|
26
|
+
initialPosition: Point;
|
|
27
|
+
position: Point;
|
|
28
|
+
isPanning: boolean;
|
|
29
|
+
}) => void;
|
|
30
|
+
setHeight: (newHeight: number) => void;
|
|
31
|
+
xOffset: number;
|
|
32
|
+
xZoom: number;
|
|
33
|
+
yOffset: number;
|
|
34
|
+
};
|
|
35
|
+
export default useChronogram;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import '../spaceTimeChart/styles/main.css';
|
|
2
|
+
import './styles/main.css';
|
|
2
3
|
export * from './components/Chronogram';
|
|
3
|
-
export
|
|
4
|
+
export * from './components/ChronogramCanvas';
|
|
5
|
+
export * from './components/ChronogramManchette';
|
|
6
|
+
export * from './components/OccupancyBlocksLayer';
|
|
7
|
+
export * from './hooks/useChronogram';
|
|
8
|
+
export type { ChronogramProps, ChronogramContextType, LevelCrossingData, LevelCrossingOccupancies, } from './lib/types';
|
|
4
9
|
export { ChronogramContext } from './lib/context';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const CHRONOGRAM_HEADER_HEIGHT = 33;
|
|
2
|
+
export declare const CHRONOGRAM_BOTTOM_PADDING = 40;
|
|
3
|
+
export declare const INITIAL_CHRONOGRAM_HEIGHT = 600;
|
|
4
|
+
export declare const LEVEL_CROSSING_ITEM_HEIGHT = 48;
|
|
5
|
+
export declare const CHRONOGRAM_SLIDER_WIDTH = 122;
|
|
@@ -1,21 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { TimeChartContextType } from '../../common/types';
|
|
1
|
+
import type { ChartEventHandlers, TimeChartContextType } from '../../common/types';
|
|
3
2
|
import type { SpaceTimeChartTheme } from '../../spaceTimeChart';
|
|
4
3
|
export type OccupancyBlock = {
|
|
5
4
|
startTime: number;
|
|
6
5
|
endTime: number;
|
|
6
|
+
trainNames: string[];
|
|
7
7
|
};
|
|
8
8
|
export type LevelCrossingOccupancies = OccupancyBlock[][];
|
|
9
|
+
export type LevelCrossingData = {
|
|
10
|
+
name: string;
|
|
11
|
+
occupancies: LevelCrossingOccupancies;
|
|
12
|
+
};
|
|
9
13
|
export type ChronogramContextType = TimeChartContextType & {
|
|
10
|
-
levelCrossingsNames: string[];
|
|
11
14
|
levelCrossingsOccupancies: LevelCrossingOccupancies[];
|
|
12
15
|
};
|
|
13
|
-
export type
|
|
14
|
-
levelCrossingsNames: string[];
|
|
16
|
+
export type ChronogramCanvasProps = {
|
|
15
17
|
levelCrossingsOccupancies: LevelCrossingOccupancies[];
|
|
18
|
+
/** The time origin (i.e. the time value for the most left point) */
|
|
16
19
|
timeOrigin: number;
|
|
20
|
+
/** The timescale (in ms/px) */
|
|
17
21
|
timeScale: number;
|
|
18
22
|
xOffset?: number;
|
|
19
23
|
yOffset?: number;
|
|
20
24
|
theme?: Partial<SpaceTimeChartTheme>;
|
|
21
|
-
} &
|
|
25
|
+
} & ChartEventHandlers<ChronogramContextType>;
|
|
26
|
+
export type ChronogramProps = {
|
|
27
|
+
levelCrossingData: LevelCrossingData[];
|
|
28
|
+
timeOrigin: number;
|
|
29
|
+
height?: number;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatDuration(start: number, end: number): string;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { RGBAColor } from '../types';
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const BLACK_ALPHA_25 = "
|
|
4
|
-
export declare const
|
|
2
|
+
export declare const BLACK_100 = "rgb(0, 0, 0)";
|
|
3
|
+
export declare const BLACK_ALPHA_25 = "rgba(0, 0, 0, 0.25)";
|
|
4
|
+
export declare const GREY_90 = "rgb(31, 27, 23)";
|
|
5
|
+
export declare const GREY_50 = "rgb(121, 118, 113)";
|
|
6
|
+
export declare const GREY_30 = "rgb(182, 178, 175)";
|
|
7
|
+
export declare const RED_100 = "rgb(221, 34, 34)";
|
|
8
|
+
export declare const WHITE_100 = "rgb(255, 255, 255)";
|
|
9
|
+
export declare const WHITE_ALPHA_75 = "rgba(255, 255, 255, 0.75)";
|
|
5
10
|
/**
|
|
6
11
|
* This function returns a unique hex color corresponding to the given index. The colors are
|
|
7
12
|
* generated as #000001, #000002 ... #0000ff, #000100 etc.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HoveredItem, Point } from '../../common/types';
|
|
2
|
-
import { type DataPoint, type Handler, type MouseContextType, type PointToData } from '
|
|
2
|
+
import { type DataPoint, type Handler, type MouseContextType, type PointToData } from '../../spaceTimeChart/lib/types';
|
|
3
3
|
type Handlers<T> = {
|
|
4
4
|
onPan?: Handler<{
|
|
5
5
|
isPanning: boolean;
|
package/dist/common/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type HTMLProps } from 'react';
|
|
2
2
|
import { type SpaceTimeChartTheme } from '../spaceTimeChart';
|
|
3
|
-
import type { LAYERS, PICKING_LAYERS } from './consts';
|
|
4
3
|
import type { DataPoint, Handler, PointToData, DataToPoint } from '../spaceTimeChart/lib/types';
|
|
4
|
+
import type { LAYERS, PICKING_LAYERS } from './consts';
|
|
5
5
|
export type BaseChartContextType = {
|
|
6
6
|
fingerprint: string;
|
|
7
7
|
pickingElements: PickingElement[];
|