@osrd-project/ui-charts 0.0.80 → 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.
Files changed (78) hide show
  1. package/dist/chronogram/components/Chronogram.d.ts +3 -0
  2. package/dist/chronogram/components/ChronogramCanvas.d.ts +3 -0
  3. package/dist/chronogram/components/ChronogramManchette.d.ts +9 -0
  4. package/dist/chronogram/components/OccupancyBlocksLayer.d.ts +1 -0
  5. package/dist/chronogram/hooks/useChronogram.d.ts +35 -0
  6. package/dist/chronogram/index.d.ts +9 -0
  7. package/dist/chronogram/lib/const.d.ts +5 -0
  8. package/dist/chronogram/lib/context.d.ts +6 -0
  9. package/dist/chronogram/lib/types.d.ts +30 -0
  10. package/dist/chronogram/utils/format.d.ts +1 -0
  11. package/dist/common/consts.d.ts +5 -0
  12. package/dist/common/context.d.ts +2 -0
  13. package/dist/{spaceTimeChart/utils → common/helpers}/colors.d.ts +9 -4
  14. package/dist/common/helpers/time.d.ts +31 -0
  15. package/dist/common/helpers/utils.d.ts +8 -0
  16. package/dist/common/hooks/useCanvas.d.ts +16 -0
  17. package/dist/common/hooks/useMouseInteractions.d.ts +41 -0
  18. package/dist/{spaceTimeChart → common}/hooks/useMouseTracking.d.ts +1 -1
  19. package/dist/{spaceTimeChart → common}/hooks/useSize.d.ts +0 -1
  20. package/dist/common/index.d.ts +5 -0
  21. package/dist/common/types.d.ts +104 -0
  22. package/dist/index.d.ts +2 -0
  23. package/dist/index.esm.js +2281 -1531
  24. package/dist/index.esm.js.map +1 -1
  25. package/dist/manchette/assets/sampleData.d.ts +2 -0
  26. package/dist/manchette/components/Manchette.d.ts +6 -1
  27. package/dist/manchette/components/ManchetteWithSpaceTimeChart.d.ts +4 -4
  28. package/dist/manchette/components/Waypoint.d.ts +2 -1
  29. package/dist/manchette/hooks/useManchetteWithSpaceTimeChart.d.ts +3 -36
  30. package/dist/manchette/hooks/useSyncManchette.d.ts +94 -0
  31. package/dist/manchette/index.d.ts +1 -2
  32. package/dist/manchette/types.d.ts +13 -0
  33. package/dist/spaceTimeChart/components/ConflictLayer.d.ts +1 -1
  34. package/dist/spaceTimeChart/components/ConflictTooltip.d.ts +1 -1
  35. package/dist/spaceTimeChart/components/PathLayer.d.ts +2 -1
  36. package/dist/spaceTimeChart/components/Quadrilateral.d.ts +2 -1
  37. package/dist/spaceTimeChart/components/Tooltip.d.ts +1 -1
  38. package/dist/spaceTimeChart/index.d.ts +2 -5
  39. package/dist/spaceTimeChart/lib/consts.d.ts +0 -3
  40. package/dist/spaceTimeChart/lib/context.d.ts +3 -6
  41. package/dist/spaceTimeChart/lib/types.d.ts +4 -91
  42. package/dist/spaceTimeChart/utils/canvas.d.ts +2 -37
  43. package/dist/spaceTimeChart/utils/events.d.ts +1 -1
  44. package/dist/spaceTimeChart/utils/geometry.d.ts +1 -1
  45. package/dist/spaceTimeChart/utils/scales.d.ts +2 -3
  46. package/dist/spaceTimeChart/utils/snapping.d.ts +1 -1
  47. package/dist/spaceTimeChart/utils/vectors.d.ts +1 -1
  48. package/dist/speedSpaceChart/components/SpeedSpaceChart.d.ts +21 -2
  49. package/dist/speedSpaceChart/components/common/DetailsBox.d.ts +5 -2
  50. package/dist/speedSpaceChart/components/common/SettingsPanel.d.ts +2 -1
  51. package/dist/speedSpaceChart/components/const.d.ts +22 -6
  52. package/dist/speedSpaceChart/components/helpers/drawElements/reticle.d.ts +2 -1
  53. package/dist/speedSpaceChart/components/layers/ReticleLayer.d.ts +3 -1
  54. package/dist/speedSpaceChart/components/utils.d.ts +7 -3
  55. package/dist/speedSpaceChart/index.d.ts +2 -1
  56. package/dist/speedSpaceChart/types.d.ts +40 -0
  57. package/dist/theme.css +1382 -483
  58. package/dist/theme.css.map +1 -1
  59. package/dist/trackOccupancyDiagram/components/TrackOccupancyCanvas.d.ts +1 -1
  60. package/dist/trackOccupancyDiagram/components/TrackOccupancyManchette.d.ts +1 -1
  61. package/dist/trackOccupancyDiagram/components/TrackOccupancyStandalone.d.ts +1 -1
  62. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZones.d.ts +8 -2
  63. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawOccupancyZonesTexts.d.ts +1 -1
  64. package/dist/trackOccupancyDiagram/components/helpers/drawElements/drawTracks.d.ts +1 -1
  65. package/dist/trackOccupancyDiagram/components/layers/OccupancyZonesLayer.d.ts +2 -2
  66. package/dist/trackOccupancyDiagram/components/layers/TracksLayer.d.ts +1 -1
  67. package/dist/trackOccupancyDiagram/components/utils.d.ts +1 -1
  68. package/dist/trackOccupancyDiagram/index.d.ts +2 -2
  69. package/dist/trackOccupancyDiagram/{components → lib}/types.d.ts +2 -1
  70. package/package.json +10 -9
  71. package/dist/manchette/hooks/usePaths.d.ts +0 -11
  72. package/dist/spaceTimeChart/hooks/useCanvas.d.ts +0 -19
  73. package/dist/spaceTimeChart/hooks/useMouseInteractions.d.ts +0 -8
  74. /package/dist/{spaceTimeChart/utils → common/helpers}/png.d.ts +0 -0
  75. /package/dist/{spaceTimeChart → common}/hooks/useDevicePixelRatio.d.ts +0 -0
  76. /package/dist/{spaceTimeChart/components → common/layers}/TimeCaptions.d.ts +0 -0
  77. /package/dist/{spaceTimeChart/components → common/layers}/TimeGraduations.d.ts +0 -0
  78. /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
+ import type { PickingElement } from '../../common/types';
1
2
  import { type TICKS_PATTERN } from './consts';
2
- import { type PickingElement } from '../../spaceTimeChart';
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.80",
3
+ "version": "0.0.83",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "bugs": "https://github.com/OpenRailAssociation/osrd/issues",
6
6
  "repository": {
@@ -32,8 +32,8 @@
32
32
  "watch": "rollup -c -w",
33
33
  "test": "vitest run",
34
34
  "prepublishOnly": "npm run clean && npm run build",
35
- "lint": "eslint src --max-warnings 0 && prettier '**/*.{css,json}' --check --ignore-path ../.prettierignore",
36
- "lint:fix": "eslint src --fix && prettier '**/*.{css,json}' --write --ignore-path ../.prettierignore"
35
+ "lint": "eslint src --max-warnings 0 && oxfmt . --check",
36
+ "lint:fix": "eslint src --fix && oxfmt . --write"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "classnames": ">=2.5",
@@ -42,18 +42,19 @@
42
42
  "tailwindcss": ">=4.1"
43
43
  },
44
44
  "dependencies": {
45
- "@osrd-project/ui-core": "0.0.80",
46
- "@osrd-project/ui-icons": "0.0.80",
47
- "chroma-js": "^3.1.1",
45
+ "@osrd-project/ui-core": "0.0.83",
46
+ "@osrd-project/ui-icons": "0.0.83",
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.18.1"
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",
57
- "file-saver": "^2.0.5"
57
+ "file-saver": "^2.0.5",
58
+ "vitest": "^4.1.5"
58
59
  }
59
60
  }
@@ -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;
@@ -1,8 +0,0 @@
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 {};