@osrd-project/ui-charts 0.0.79 → 0.0.82

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 (70) hide show
  1. package/dist/chronogram/components/Chronogram.d.ts +3 -0
  2. package/dist/chronogram/index.d.ts +4 -0
  3. package/dist/chronogram/lib/context.d.ts +6 -0
  4. package/dist/chronogram/lib/types.d.ts +21 -0
  5. package/dist/common/consts.d.ts +5 -0
  6. package/dist/common/context.d.ts +2 -0
  7. package/dist/{spaceTimeChart/utils → common/helpers}/colors.d.ts +1 -1
  8. package/dist/common/helpers/time.d.ts +31 -0
  9. package/dist/common/helpers/utils.d.ts +8 -0
  10. package/dist/common/hooks/useCanvas.d.ts +16 -0
  11. package/dist/{spaceTimeChart → common}/hooks/useSize.d.ts +0 -1
  12. package/dist/common/index.d.ts +5 -0
  13. package/dist/common/types.d.ts +104 -0
  14. package/dist/index.d.ts +2 -0
  15. package/dist/index.esm.js +1895 -1445
  16. package/dist/index.esm.js.map +1 -1
  17. package/dist/manchette/assets/sampleData.d.ts +2 -0
  18. package/dist/manchette/components/Manchette.d.ts +6 -1
  19. package/dist/manchette/components/ManchetteWithSpaceTimeChart.d.ts +3 -3
  20. package/dist/manchette/components/Waypoint.d.ts +2 -1
  21. package/dist/manchette/hooks/useManchetteWithSpaceTimeChart.d.ts +3 -36
  22. package/dist/manchette/hooks/useSyncManchette.d.ts +94 -0
  23. package/dist/manchette/index.d.ts +1 -2
  24. package/dist/manchette/types.d.ts +13 -0
  25. package/dist/spaceTimeChart/components/ConflictLayer.d.ts +1 -1
  26. package/dist/spaceTimeChart/components/ConflictTooltip.d.ts +1 -1
  27. package/dist/spaceTimeChart/components/PathLayer.d.ts +2 -1
  28. package/dist/spaceTimeChart/components/Quadrilateral.d.ts +2 -1
  29. package/dist/spaceTimeChart/components/Tooltip.d.ts +1 -1
  30. package/dist/spaceTimeChart/hooks/useMouseInteractions.d.ts +36 -3
  31. package/dist/spaceTimeChart/index.d.ts +2 -5
  32. package/dist/spaceTimeChart/lib/consts.d.ts +0 -3
  33. package/dist/spaceTimeChart/lib/context.d.ts +3 -6
  34. package/dist/spaceTimeChart/lib/types.d.ts +4 -91
  35. package/dist/spaceTimeChart/utils/canvas.d.ts +2 -37
  36. package/dist/spaceTimeChart/utils/events.d.ts +1 -1
  37. package/dist/spaceTimeChart/utils/geometry.d.ts +1 -1
  38. package/dist/spaceTimeChart/utils/scales.d.ts +2 -3
  39. package/dist/spaceTimeChart/utils/snapping.d.ts +1 -1
  40. package/dist/spaceTimeChart/utils/vectors.d.ts +1 -1
  41. package/dist/speedSpaceChart/components/SpeedSpaceChart.d.ts +21 -2
  42. package/dist/speedSpaceChart/components/common/DetailsBox.d.ts +5 -2
  43. package/dist/speedSpaceChart/components/common/SettingsPanel.d.ts +2 -1
  44. package/dist/speedSpaceChart/components/const.d.ts +22 -6
  45. package/dist/speedSpaceChart/components/helpers/drawElements/reticle.d.ts +2 -1
  46. package/dist/speedSpaceChart/components/layers/ReticleLayer.d.ts +3 -1
  47. package/dist/speedSpaceChart/components/utils.d.ts +7 -3
  48. package/dist/speedSpaceChart/index.d.ts +2 -1
  49. package/dist/speedSpaceChart/types.d.ts +40 -0
  50. package/dist/theme.css +468 -243
  51. package/dist/theme.css.map +1 -1
  52. package/dist/trackOccupancyDiagram/components/TrackOccupancyCanvas.d.ts +1 -1
  53. package/dist/trackOccupancyDiagram/components/TrackOccupancyManchette.d.ts +1 -1
  54. package/dist/trackOccupancyDiagram/components/TrackOccupancyStandalone.d.ts +1 -1
  55. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZones.d.ts +8 -2
  56. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZonesTexts.d.ts +1 -1
  57. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawTracks.d.ts +1 -1
  58. package/dist/trackOccupancyDiagram/components/layers/OccupancyZonesLayer.d.ts +2 -2
  59. package/dist/trackOccupancyDiagram/components/layers/TracksLayer.d.ts +1 -1
  60. package/dist/trackOccupancyDiagram/components/utils.d.ts +1 -1
  61. package/dist/trackOccupancyDiagram/index.d.ts +2 -2
  62. package/dist/trackOccupancyDiagram/{components → lib}/types.d.ts +2 -1
  63. package/package.json +6 -6
  64. package/dist/manchette/hooks/usePaths.d.ts +0 -11
  65. package/dist/spaceTimeChart/hooks/useCanvas.d.ts +0 -19
  66. /package/dist/{spaceTimeChart/utils → common/helpers}/png.d.ts +0 -0
  67. /package/dist/{spaceTimeChart → common}/hooks/useDevicePixelRatio.d.ts +0 -0
  68. /package/dist/{spaceTimeChart/components → common/layers}/TimeCaptions.d.ts +0 -0
  69. /package/dist/{spaceTimeChart/components → common/layers}/TimeGraduations.d.ts +0 -0
  70. /package/dist/trackOccupancyDiagram/{components → lib}/consts.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { OccupancyZone, Track } from './types';
2
+ import type { OccupancyZone, Track } from '../lib/types';
3
3
  declare const TrackOccupancyCanvas: ({ position, tracks, occupancyZones, selectedTrainId, onClose, topPadding, hideBorders, }: {
4
4
  position: number;
5
5
  tracks: Track[];
@@ -1,5 +1,5 @@
1
1
  import React, { type PropsWithChildren } from 'react';
2
- import type { Track } from './types';
2
+ import type { Track } from '../lib/types';
3
3
  declare const TrackOccupancyManchette: ({ tracks, children }: PropsWithChildren<{
4
4
  tracks: Track[];
5
5
  }>) => React.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { OccupancyZone, Track } from './types';
2
+ import type { OccupancyZone, Track } from '../lib/types';
3
3
  declare const TrackOccupancyStandalone: ({ tracks, occupancyZones, selectedTrainId, onSelectedTrainIdChange, height, }: {
4
4
  tracks: Track[];
5
5
  occupancyZones: OccupancyZone[];
@@ -1,5 +1,5 @@
1
- import { type SpaceTimeChartContextType } from '../../../../spaceTimeChart';
2
- import type { OccupancyZone } from '../../types';
1
+ import type { SpaceTimeChartContextType } from '../../../../spaceTimeChart';
2
+ import type { OccupancyZone } from '../../../lib/types';
3
3
  export declare const drawRemainingTrainsBox: (ctx: CanvasRenderingContext2D, { getTimePixel, getSpacePixel }: SpaceTimeChartContextType, { time, position, yOffset, remainingTrainsNb, }: {
4
4
  time: number;
5
5
  position: number;
@@ -12,3 +12,9 @@ export declare const drawOccupationZone: (ctx: CanvasRenderingContext2D, stcCont
12
12
  position: number;
13
13
  isSelected?: boolean;
14
14
  }) => void;
15
+ export declare const drawZoneTrailingText: (ctx: CanvasRenderingContext2D, { getTimePixel, getSpacePixel }: SpaceTimeChartContextType, { zone, position, yOffset, trailingText, }: {
16
+ zone: OccupancyZone;
17
+ position: number;
18
+ yOffset: number;
19
+ trailingText: string;
20
+ }) => void;
@@ -1,4 +1,4 @@
1
- import type { OccupancyZone } from '../../types';
1
+ import type { OccupancyZone } from '../../../lib/types';
2
2
  export declare const drawOccupancyZonesTexts: ({ ctx, zone, arrivalTimePixel, departureTimePixel, yPosition, isThroughTrain, isSelected, }: {
3
3
  ctx: CanvasRenderingContext2D;
4
4
  zone: OccupancyZone;
@@ -1,5 +1,5 @@
1
1
  import type { SpaceTimeChartContextType } from '../../../../spaceTimeChart';
2
- import { type Track } from '../../types';
2
+ import { type Track } from '../../../lib/types';
3
3
  export declare const drawTracks: (ctx: CanvasRenderingContext2D, stcContext: SpaceTimeChartContextType, { position, tracks, drawBorders, topPadding, }: {
4
4
  position: number;
5
5
  tracks: Track[];
@@ -1,5 +1,5 @@
1
- import { type PickingElement } from '../../../spaceTimeChart';
2
- import type { OccupancyZone, OccupancyZonePickingElement, Track } from '../types';
1
+ import type { PickingElement } from '../../../common/types';
2
+ import type { OccupancyZone, OccupancyZonePickingElement, Track } from '../../lib/types';
3
3
  export declare function isOccupancyPickingElement(element: PickingElement): element is OccupancyZonePickingElement;
4
4
  declare const OccupancyZonesLayer: ({ tracks, occupancyZones, position, topPadding, selectedTrainId, }: {
5
5
  tracks: Track[];
@@ -1,4 +1,4 @@
1
- import type { Track } from '../types';
1
+ import type { Track } from '../../lib/types';
2
2
  declare const TracksLayer: ({ tracks, position, topPadding, drawBorders, }: {
3
3
  tracks: Track[];
4
4
  position: number;
@@ -1,4 +1,4 @@
1
- import { type TickPattern } from './types';
1
+ import { type TickPattern } from '../lib/types';
2
2
  type DrawTextType = {
3
3
  ctx: CanvasRenderingContext2D;
4
4
  text: string;
@@ -1,6 +1,6 @@
1
1
  import './styles/main.css';
2
- export * from './components/types';
3
- export * from './components/consts';
2
+ export * from './lib/types';
3
+ export * from './lib/consts';
4
4
  export { isOccupancyPickingElement } from './components/layers/OccupancyZonesLayer';
5
5
  export { default as TrackOccupancyCanvas } from './components/TrackOccupancyCanvas';
6
6
  export { default as TrackOccupancyManchette } from './components/TrackOccupancyManchette';
@@ -1,5 +1,5 @@
1
1
  import { type TICKS_PATTERN } from './consts';
2
- import { type PickingElement } from '../../spaceTimeChart';
2
+ import type { PickingElement } from '../../common/types';
3
3
  export type Track = {
4
4
  id: string;
5
5
  name?: string;
@@ -17,6 +17,7 @@ export type OccupancyZone = {
17
17
  endTime: number;
18
18
  startDirection?: 'up' | 'down';
19
19
  endDirection?: 'up' | 'down';
20
+ trailingText?: string;
20
21
  };
21
22
  export type OccupancyZonePickingElement = PickingElement & {
22
23
  type: 'occupancyZone';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osrd-project/ui-charts",
3
- "version": "0.0.79",
3
+ "version": "0.0.82",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "bugs": "https://github.com/OpenRailAssociation/osrd/issues",
6
6
  "repository": {
@@ -42,15 +42,15 @@
42
42
  "tailwindcss": ">=4.1"
43
43
  },
44
44
  "dependencies": {
45
- "@osrd-project/ui-core": "0.0.79",
46
- "@osrd-project/ui-icons": "0.0.79",
47
- "chroma-js": "^3.1.1",
45
+ "@osrd-project/ui-core": "0.0.82",
46
+ "@osrd-project/ui-icons": "0.0.82",
47
+ "chroma-js": "^3.2.0",
48
48
  "d3-selection": "^3.0.0",
49
49
  "d3-zoom": "^3.0.0",
50
- "lodash": "^4.17.21"
50
+ "lodash": "^4.17.23"
51
51
  },
52
52
  "devDependencies": {
53
- "@types/chroma-js": "^3.1.0",
53
+ "@types/chroma-js": "^3.1.2",
54
54
  "@types/d3-selection": "^3.0.11",
55
55
  "@types/d3-zoom": "^3.0.0",
56
56
  "@types/file-saver": "^2.0.7",
@@ -1,11 +0,0 @@
1
- import { type ProjectPathTrainResult } from '../types';
2
- declare const usePaths: (projectPathTrainResult: ProjectPathTrainResult[]) => {
3
- id: string;
4
- label: string;
5
- points: {
6
- time: number;
7
- position: number;
8
- }[];
9
- color: string;
10
- }[];
11
- export default usePaths;
@@ -1,19 +0,0 @@
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;