@osrd-project/ui-charts 0.0.74 → 0.0.76

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 (25) hide show
  1. package/dist/index.esm.js +584 -381
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/manchette/components/Manchette.d.ts +4 -3
  4. package/dist/manchette/components/Waypoint.d.ts +2 -2
  5. package/dist/manchette/hooks/useManchetteWithSpaceTimeChart.d.ts +11 -1
  6. package/dist/manchette/index.d.ts +3 -2
  7. package/dist/manchette/types.d.ts +0 -5
  8. package/dist/manchette/utils/helpers.d.ts +1 -5
  9. package/dist/manchette/utils/index.d.ts +3 -2
  10. package/dist/spaceTimeChart/lib/types.d.ts +4 -6
  11. package/dist/spaceTimeChart/utils/scales.d.ts +5 -0
  12. package/dist/theme.css +1678 -2653
  13. package/dist/theme.css.map +1 -1
  14. package/dist/trackOccupancyDiagram/components/TrackOccupancyCanvas.d.ts +10 -2
  15. package/dist/trackOccupancyDiagram/components/TrackOccupancyManchette.d.ts +5 -3
  16. package/dist/trackOccupancyDiagram/components/TrackOccupancyStandalone.d.ts +10 -0
  17. package/dist/trackOccupancyDiagram/components/consts.d.ts +3 -1
  18. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZones.d.ts +13 -14
  19. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZonesTexts.d.ts +2 -2
  20. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawTracks.d.ts +7 -15
  21. package/dist/trackOccupancyDiagram/components/layers/OccupancyZonesLayer.d.ts +7 -9
  22. package/dist/trackOccupancyDiagram/components/layers/TracksLayer.d.ts +6 -3
  23. package/dist/trackOccupancyDiagram/components/types.d.ts +8 -17
  24. package/dist/trackOccupancyDiagram/index.d.ts +3 -0
  25. package/package.json +8 -8
@@ -1,4 +1,12 @@
1
1
  import React from 'react';
2
- import { type TrackOccupancyCanvasProps } from './types';
3
- declare const TrackOccupancyCanvas: ({ opId, useDraw, setCanvasesRoot, selectedTrainId, setSelectedTrainId, mousePosition, }: TrackOccupancyCanvasProps) => React.JSX.Element;
2
+ import type { OccupancyZone, Track } from './types';
3
+ declare const TrackOccupancyCanvas: ({ position, tracks, occupancyZones, selectedTrainId, onClose, topPadding, hideBorders, }: {
4
+ position: number;
5
+ tracks: Track[];
6
+ occupancyZones: OccupancyZone[];
7
+ selectedTrainId?: string;
8
+ onClose?: () => void;
9
+ topPadding?: number;
10
+ hideBorders?: boolean;
11
+ }) => React.JSX.Element;
4
12
  export default TrackOccupancyCanvas;
@@ -1,4 +1,6 @@
1
- import React from 'react';
2
- import { type TrackOccupancyManchetteProps } from './types';
3
- declare const TrackOccupancyManchette: ({ tracks }: TrackOccupancyManchetteProps) => React.JSX.Element;
1
+ import React, { type PropsWithChildren } from 'react';
2
+ import type { Track } from './types';
3
+ declare const TrackOccupancyManchette: ({ tracks, children }: PropsWithChildren<{
4
+ tracks: Track[];
5
+ }>) => React.JSX.Element;
4
6
  export default TrackOccupancyManchette;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { OccupancyZone, Track } from './types';
3
+ declare const TrackOccupancyStandalone: ({ tracks, occupancyZones, selectedTrainId, onSelectedTrainIdChange, height, }: {
4
+ tracks: Track[];
5
+ occupancyZones: OccupancyZone[];
6
+ selectedTrainId?: string;
7
+ onSelectedTrainIdChange?: (selectedTrainId?: string) => void;
8
+ height?: number;
9
+ }) => React.JSX.Element;
10
+ export default TrackOccupancyStandalone;
@@ -13,7 +13,9 @@ export declare const COLORS: {
13
13
  GREY_50: string;
14
14
  GREY_60: string;
15
15
  GREY_80: string;
16
- HOUR_BACKGROUND: string;
16
+ MANCHETTE_BACKGROUND: string;
17
+ HOUR_BACKGROUND_1: string;
18
+ HOUR_BACKGROUND_2: string;
17
19
  RAIL_TICK: string;
18
20
  REMAINING_TRAINS_BACKGROUND: string;
19
21
  SELECTION_20: string;
@@ -1,15 +1,14 @@
1
- import type { OccupancyZone, Track } from '../../types';
2
- export declare const drawOccupancyZones: ({ ctx, width, height, tracks, occupancyZones, getTimePixel, selectedTrainId, setSelectedTrainId, mousePosition, }: {
3
- ctx: CanvasRenderingContext2D;
4
- width: number;
5
- height: number;
6
- tracks: Track[] | undefined;
7
- occupancyZones: OccupancyZone[] | undefined;
8
- getTimePixel: (time: number) => number;
9
- selectedTrainId: string;
10
- setSelectedTrainId: (id: string) => void;
11
- mousePosition: {
12
- x: number;
13
- y: number;
14
- };
1
+ import { type SpaceTimeChartContextType } from '../../../../spaceTimeChart';
2
+ import type { OccupancyZone } from '../../types';
3
+ export declare const drawRemainingTrainsBox: (ctx: CanvasRenderingContext2D, { getTimePixel, getSpacePixel }: SpaceTimeChartContextType, { time, position, yOffset, remainingTrainsNb, }: {
4
+ time: number;
5
+ position: number;
6
+ yOffset: number;
7
+ remainingTrainsNb: number;
8
+ }) => void;
9
+ export declare const drawOccupationZone: (ctx: CanvasRenderingContext2D, stcContext: SpaceTimeChartContextType, { zone, yOffset, position, isSelected, }: {
10
+ zone: OccupancyZone;
11
+ yOffset: number;
12
+ position: number;
13
+ isSelected?: boolean;
15
14
  }) => void;
@@ -1,10 +1,10 @@
1
1
  import type { OccupancyZone } from '../../types';
2
- export declare const drawOccupancyZonesTexts: ({ ctx, zone, arrivalTimePixel, departureTimePixel, yPosition, isThroughTrain, selectedTrainId, }: {
2
+ export declare const drawOccupancyZonesTexts: ({ ctx, zone, arrivalTimePixel, departureTimePixel, yPosition, isThroughTrain, isSelected, }: {
3
3
  ctx: CanvasRenderingContext2D;
4
4
  zone: OccupancyZone;
5
5
  arrivalTimePixel: number;
6
6
  departureTimePixel: number;
7
7
  yPosition: number;
8
8
  isThroughTrain: boolean;
9
- selectedTrainId: string;
9
+ isSelected?: boolean;
10
10
  }) => void;
@@ -1,16 +1,8 @@
1
+ import type { SpaceTimeChartContextType } from '../../../../spaceTimeChart';
1
2
  import { type Track } from '../../types';
2
- export declare function getTimeToPixel(timeOrigin: number, pixelOffset: number, timeScale: number): (time: number) => number;
3
- type DrawTracksProps = {
4
- ctx: CanvasRenderingContext2D;
5
- width: number;
6
- height: number;
7
- tracks: Track[] | undefined;
8
- timeOrigin: number;
9
- timePixelOffset: number;
10
- getTimePixel: (time: number) => number;
11
- timeRanges: number[];
12
- breakpoints: number[];
13
- timeScale: number;
14
- };
15
- export declare const drawTracks: ({ ctx, width, height, tracks, timeOrigin, timePixelOffset, getTimePixel, timeRanges, breakpoints, timeScale, }: DrawTracksProps) => void;
16
- export {};
3
+ export declare const drawTracks: (ctx: CanvasRenderingContext2D, stcContext: SpaceTimeChartContextType, { position, tracks, drawBorders, topPadding, }: {
4
+ position: number;
5
+ tracks: Track[];
6
+ drawBorders: boolean;
7
+ topPadding: number;
8
+ }) => void;
@@ -1,11 +1,9 @@
1
- import { type LayerType, type DrawingFunction } from '../../../spaceTimeChart/lib/types';
2
- declare const OccupancyZonesLayer: ({ useDraw, selectedTrainId, setSelectedTrainId, mousePosition, }: {
3
- useDraw: (layer: LayerType, fn: DrawingFunction) => void;
4
- selectedTrainId: string;
5
- setSelectedTrainId: (id: string) => void;
6
- mousePosition: {
7
- x: number;
8
- y: number;
9
- };
1
+ import type { OccupancyZone, Track } from '../types';
2
+ declare const OccupancyZonesLayer: ({ tracks, occupancyZones, position, topPadding, selectedTrainId, }: {
3
+ tracks: Track[];
4
+ occupancyZones: OccupancyZone[];
5
+ position: number;
6
+ topPadding: number;
7
+ selectedTrainId?: string;
10
8
  }) => null;
11
9
  export default OccupancyZonesLayer;
@@ -1,5 +1,8 @@
1
- import { type LayerType, type DrawingFunction } from '../../../spaceTimeChart/lib/types';
2
- declare const TracksLayer: ({ useDraw }: {
3
- useDraw: (layer: LayerType, fn: DrawingFunction) => void;
1
+ import type { Track } from '../types';
2
+ declare const TracksLayer: ({ tracks, position, topPadding, drawBorders, }: {
3
+ tracks: Track[];
4
+ position: number;
5
+ topPadding: number;
6
+ drawBorders: boolean;
4
7
  }) => null;
5
8
  export default TracksLayer;
@@ -1,33 +1,24 @@
1
1
  import { type TICKS_PATTERN } from './consts';
2
- import { type DrawingFunction, type LayerType } from '../../spaceTimeChart/lib/types';
3
2
  export type Track = {
4
3
  id: string;
5
4
  name: string;
6
5
  line: string;
7
6
  };
8
7
  export type OccupancyZone = {
9
- id: string;
8
+ trainId: string;
10
9
  trackId: string;
11
10
  arrivalTrainName: string;
12
11
  departureTrainName: string;
12
+ arrivalDirection?: 'up' | 'down';
13
+ departureDirection?: 'up' | 'down';
13
14
  color: string;
14
15
  originStation?: string;
15
16
  destinationStation?: string;
16
- arrivalTime: Date;
17
- departureTime: Date;
18
- };
19
- export type TrackOccupancyCanvasProps = {
20
- opId: string;
21
- useDraw: (layer: LayerType, fn: DrawingFunction) => void;
22
- setCanvasesRoot: (root: HTMLDivElement | null) => void;
23
- selectedTrainId: string;
24
- setSelectedTrainId: (id: string) => void;
25
- mousePosition: {
26
- x: number;
27
- y: number;
28
- };
17
+ arrivalTime: number;
18
+ departureTime: number;
29
19
  };
30
- export type TrackOccupancyManchetteProps = {
31
- tracks: Track[];
20
+ export type OccupancyZonePickingElement = {
21
+ type: 'occupancyZone';
22
+ trainId: string;
32
23
  };
33
24
  export type TickPattern = keyof typeof TICKS_PATTERN;
@@ -1,3 +1,6 @@
1
1
  import './styles/main.css';
2
+ export * from './components/types';
3
+ export * from './components/consts';
2
4
  export { default as TrackOccupancyCanvas } from './components/TrackOccupancyCanvas';
3
5
  export { default as TrackOccupancyManchette } from './components/TrackOccupancyManchette';
6
+ export { default as TrackOccupancyStandalone } from './components/TrackOccupancyStandalone';
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@osrd-project/ui-charts",
3
- "version": "0.0.74",
3
+ "version": "0.0.76",
4
4
  "license": "LGPL-3.0-or-later",
5
- "bugs": "https://github.com/osrd-project/osrd-ui/issues",
5
+ "bugs": "https://github.com/osrd-project/osrd/issues",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "https://github.com/osrd-project/osrd-ui.git",
9
- "directory": "ui-charts"
8
+ "url": "https://github.com/osrd-project/osrd.git",
9
+ "directory": "front/ui/ui-charts"
10
10
  },
11
11
  "publishConfig": {
12
12
  "access": "public"
@@ -42,8 +42,8 @@
42
42
  "tailwindcss": ">=3.4"
43
43
  },
44
44
  "dependencies": {
45
- "@osrd-project/ui-core": "^0.0.74",
46
- "@osrd-project/ui-icons": "^0.0.74",
45
+ "@osrd-project/ui-core": "^0.0.76",
46
+ "@osrd-project/ui-icons": "^0.0.76",
47
47
  "chroma-js": "^3.1.1",
48
48
  "d3-selection": "^3.0.0",
49
49
  "d3-zoom": "^3.0.0",
@@ -51,10 +51,10 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/chroma-js": "^3.1.0",
54
- "@types/d3-selection": "^3.0.0",
54
+ "@types/d3-selection": "^3.0.11",
55
55
  "@types/d3-zoom": "^3.0.0",
56
56
  "@types/file-saver": "^2.0.7",
57
57
  "file-saver": "^2.0.5"
58
58
  },
59
- "gitHead": "ef66588d9ffead71f09a97c137a899972623db14"
59
+ "gitHead": "35e01369198a1dda1d09eab9a14d5f70d04e95ec"
60
60
  }