@tracktor/map 1.3.1 → 1.4.0

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.
@@ -10,5 +10,32 @@ interface FitBoundsProps {
10
10
  animationKey?: unknown;
11
11
  openPopup?: boolean;
12
12
  }
13
+ /**
14
+ * FitBounds Component
15
+ * -------------------
16
+ * Automatically adjusts the map viewport to fit visible markers or GeoJSON features.
17
+ *
18
+ * Workflow:
19
+ * 1. Collects coordinates from valid markers and/or GeoJSON features.
20
+ * 2. Computes bounding box (`LngLatBounds`) for all visible points.
21
+ * 3. Applies `map.fitBounds()` or `map.flyTo()` depending on the data (single vs multiple points).
22
+ * 4. Reacts to changes via `animationKey` — prevents redundant animations on repeated renders.
23
+ *
24
+ * Props:
25
+ * - `markers`: array of marker objects (`{ id, lat, lng }`) to fit into view.
26
+ * - `features`: GeoJSON data (Feature, FeatureCollection, or array of Features).
27
+ * - `padding`: padding (px) around fitted bounds (default: 50).
28
+ * - `duration`: animation duration in ms (default: 1000).
29
+ * - `disableAnimation`: disables map animations when true.
30
+ * - `fitBounds`: whether bounds fitting is enabled.
31
+ * - `animationKey`: dependency key to control when to re-run fitting logic.
32
+ * - `openPopup`: if true, temporarily skips bounds updates to avoid interfering with popups.
33
+ *
34
+ * Dependencies:
35
+ * - `react-map-gl` for Mapbox context.
36
+ * - `mapbox-gl` for geometry calculations and view transitions.
37
+ * - `isValidMarker` from local types — filters out invalid marker objects.
38
+ * - `@tracktor/react-utils` helpers for type-safe checks.
39
+ */
13
40
  declare const FitBounds: ({ markers, features, padding, duration, disableAnimation, fitBounds, animationKey, openPopup, }: FitBoundsProps) => null;
14
41
  export default FitBounds;
@@ -1,10 +1,33 @@
1
- import { ItineraryLineStyle } from '../../types/MarkerMapProps.ts';
1
+ import { Engine, ItineraryLineStyle, Profile } from '../../types/MarkerMapProps.ts';
2
2
  type ItineraryProps = {
3
3
  from?: [number, number];
4
4
  to?: [number, number];
5
- profile?: "driving" | "walking" | "cycling";
6
- routeService?: "OSRM" | "Mapbox";
5
+ profile?: Profile;
6
+ engine?: Engine;
7
7
  itineraryLineStyle?: Partial<ItineraryLineStyle>;
8
8
  };
9
- declare const Itinerary: ({ profile, routeService, to, from, itineraryLineStyle }: ItineraryProps) => import("react/jsx-runtime").JSX.Element | null;
9
+ /**
10
+ * Itinerary Component
11
+ * -------------------
12
+ * Renders a route line between two geographical points on a Mapbox map.
13
+ *
14
+ * Workflow:
15
+ * 1. Fetches the route geometry between `from` and `to` coordinates.
16
+ * 2. Uses either OSRM or Mapbox routing services depending on the `routeService` prop.
17
+ * 3. Displays the resulting route as a line layer via `react-map-gl`.
18
+ *
19
+ * Props:
20
+ * - `from`: starting point [lng, lat].
21
+ * - `to`: destination point [lng, lat].
22
+ * - `profile`: routing mode ("driving", "walking", or "cycling").
23
+ * - `routeService`: which routing engine to use ("OSRM" or "Mapbox").
24
+ * - `itineraryLineStyle`: optional line style overrides (color, opacity, width).
25
+ *
26
+ * Dependencies:
27
+ * - `OSRMRoute`: returns a GeoJSON LineString from OSRM.
28
+ * - `mapboxRoute`: returns a GeoJSON LineString from Mapbox Directions API.
29
+ * - `react-map-gl`: used for rendering the map layers.
30
+ *
31
+ */
32
+ declare const Itinerary: ({ profile, engine, to, from, itineraryLineStyle }: ItineraryProps) => import("react/jsx-runtime").JSX.Element | null;
10
33
  export default Itinerary;
@@ -1,4 +1,4 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { MarkerMapProps } from '../../types/MarkerMapProps';
3
- declare const _default: import('react').MemoExoticComponent<({ containerStyle, square, loading, height, width, center, zoom, popupMaxWidth, openPopup, openPopupOnHover, markers, fitBounds, fitBoundsPadding, fitBoundDuration, fitBoundsAnimationKey, disableAnimation, mapStyle, onMapClick, baseMapView, cooperativeGestures, doubleClickZoom, projection, theme, features, from, to, profile, itineraryLineStyle, routeService, findNearestMarker, onNearestFound, }: MarkerMapProps) => ReactElement>;
3
+ declare const _default: import('react').MemoExoticComponent<({ containerStyle, square, loading, height, width, center, zoom, popupMaxWidth, openPopup, openPopupOnHover, markers, fitBounds, fitBoundsPadding, fitBoundDuration, fitBoundsAnimationKey, disableAnimation, mapStyle: baseMapStyle, onMapClick, baseMapView, cooperativeGestures, doubleClickZoom, projection, theme: themeOverride, features, from, to, profile, itineraryLineStyle, engine, findNearestMarker, onNearestFound, }: MarkerMapProps) => ReactElement>;
4
4
  export default _default;
@@ -4,5 +4,5 @@ export interface NearestResult {
4
4
  point: [number, number];
5
5
  distance: number;
6
6
  }
7
- declare const _default: import('react').MemoExoticComponent<({ origin, maxDistanceMeters, destinations, onNearestFound }: FindNearestMarkerParams) => import("react/jsx-runtime").JSX.Element | null>;
7
+ declare const _default: import('react').MemoExoticComponent<({ origin, maxDistanceMeters, destinations, onNearestFound, profile, engine, }: FindNearestMarkerParams) => import("react/jsx-runtime").JSX.Element | null>;
8
8
  export default _default;