@mappable-world/mappable-types 0.0.18 → 0.0.20

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.
@@ -104,6 +104,7 @@ type MapTheme = 'dark';
104
104
  type VectorTileSize = 'X1' | 'X4' | 'X16';
105
105
  type VectorDataSourcePriority = 'low' | 'medium' | 'high';
106
106
  type VectorObjectsCollisionPriority = 'low' | 'medium' | 'high' | 'ultra';
107
+ type VectorMapType = 'map' | 'driving' | 'transit' | 'admin';
107
108
  interface VectorTileDataSourceDescription {
108
109
  /** Default is `'vmap2'` */
109
110
  tileFormat?: 'vmap2' | 'vmap3';
@@ -143,7 +144,9 @@ interface VectorTileDataSourceDescription {
143
144
  richModelDecoderWorkerUrl?: string;
144
145
  customization?: VectorCustomization;
145
146
  theme?: MapTheme;
147
+ hdModeEnabled?: boolean;
148
+ mapType?: VectorMapType;
146
149
  /** Defines how hotspots of type should be treated: enabled/disabled or use custom hotspots instead. */
147
150
  hotspots?: Record<string, boolean | FetchHotspotsFunction | HotspotsOptions>;
148
151
  }
149
- export { VectorCustomizationTypes, VectorCustomizationElements, VectorCustomizationItem, VectorCustomization, RasterTileDataSourceDescription, FetchHotspotsFunction, VectorTileDataSourceDescription, VectorTileSize, VectorObjectsCollisionPriority, VectorDataSourcePriority, HotspotsOptions, FetchTileFunction, ComposeTileUrlFunction, Hotspot, WorldHotspot, RenderedHotspot, FetchedRasterTile, FetchedTile, FetchedCommonTile, MapTheme };
152
+ export { VectorCustomizationTypes, VectorCustomizationElements, VectorCustomizationItem, VectorCustomization, RasterTileDataSourceDescription, FetchHotspotsFunction, VectorTileDataSourceDescription, VectorTileSize, VectorObjectsCollisionPriority, VectorDataSourcePriority, VectorMapType, HotspotsOptions, FetchTileFunction, ComposeTileUrlFunction, Hotspot, WorldHotspot, RenderedHotspot, FetchedRasterTile, FetchedTile, FetchedCommonTile, MapTheme };
@@ -1,5 +1,5 @@
1
1
  import type { DrawingStyle, GenericGeometry, LngLat, HideOutsideRule } from "../../common/types";
2
- import type { DraggableProps, FeatureClickEvents } from "./types";
2
+ import type { BlockingProps, DraggableProps, FeatureClickEvents } from "./types";
3
3
  import { MMapEntity } from "../MMapEnities";
4
4
  import type { Geometry, MMapFeatureEventHandler } from "./types";
5
5
  /**
@@ -15,7 +15,7 @@ type MMapFeatureProps = {
15
15
  disableRoundCoordinates?: boolean;
16
16
  /** Hide the marker if it goes beyond the edge of the viewport */
17
17
  hideOutsideViewport?: HideOutsideRule;
18
- } & DraggableProps<MMapFeatureEventHandler> & FeatureClickEvents;
18
+ } & DraggableProps<MMapFeatureEventHandler> & BlockingProps & FeatureClickEvents;
19
19
  declare const defaultProps: Readonly<{
20
20
  source: "mappable-default-feature";
21
21
  }>;
@@ -9,17 +9,27 @@ export interface DraggableProps<Callback> {
9
9
  /** Fires on drag start */
10
10
  onDragStart?: Callback;
11
11
  /**
12
- * Maybe a function which will be called when the user drags and drops the element to a new position in the map.
13
- * The arguments to the function will be with new coordinates.
14
- * A component using with component should immediately store the new coordinates into its state and then pass
15
- * the new coordinates as the marker's props.
12
+ * May be a function that will be called when the user drags and drops an element to a new location on the map.
13
+ * The arguments to the function will include the new coordinates.
14
+ * A component that uses this component should immediately save the new coordinates in its state and then use
15
+ * the new coordinates as props for the marker.
16
16
  * */
17
17
  onDragEnd?: Callback;
18
18
  /** Fires on drag move */
19
19
  onDragMove?: Callback;
20
- /** Will block maps events on marker */
20
+ }
21
+ export interface BlockingProps {
22
+ /**
23
+ * This parameter block all map events for the element.
24
+ * The map will no longer be able to respond to any {@link DomEvents} on this element, including clicks, double-clicks and others.
25
+ */
21
26
  blockEvents?: boolean;
22
- /** Will block maps behaviors on marker */
27
+ /**
28
+ * This parameter block all map behaviors for the element.
29
+ * The element itself can be zoomed and scrolled by mouse and gestures.
30
+ * The map will no longer be able to respond to any {@link BehaviorType} on this element (except `dblClick`).
31
+ * Double clicks and other map events will be blocked by the {@link BlockingProps.blockEvents} parameter.
32
+ */
23
33
  blockBehaviors?: boolean;
24
34
  }
25
35
  export interface FeatureClickEvents {
@@ -1,5 +1,5 @@
1
1
  import type { HideOutsideRule, LngLat } from "../../common/types";
2
- import type { DraggableProps, FeatureClickEvents } from "../MMapFeature/types";
2
+ import type { BlockingProps, DraggableProps, FeatureClickEvents } from "../MMapFeature/types";
3
3
  import { MMapGroupEntity } from "../MMapEnities";
4
4
  import { overrideKeyReactify } from "../wrappers";
5
5
  /**
@@ -43,7 +43,7 @@ type MMapMarkerProps = {
43
43
  * A point will be removed from the map if its coordinates are 1000px outside the visible area of the map.
44
44
  */
45
45
  hideOutsideViewport?: HideOutsideRule;
46
- } & DraggableProps<MMapMarkerEventHandler> & FeatureClickEvents;
46
+ } & DraggableProps<MMapMarkerEventHandler> & BlockingProps & FeatureClickEvents;
47
47
  declare const defaultProps: Readonly<{
48
48
  draggable: false;
49
49
  mapFollowsOnDrag: false;
@@ -137,7 +137,7 @@ declare class MMapMarker extends MMapGroupEntity<MMapMarkerProps, DefaultProps>
137
137
  * A point will be removed from the map if its coordinates are 1000px outside the visible area of the map.
138
138
  */
139
139
  hideOutsideViewport?: HideOutsideRule | undefined;
140
- } & DraggableProps<MMapMarkerEventHandler> & FeatureClickEvents & {
140
+ } & DraggableProps<MMapMarkerEventHandler> & BlockingProps & FeatureClickEvents & {
141
141
  markerElement?: HTMLElement | undefined;
142
142
  }, {}, import("../Entities").GenericRootEntity<unknown, {}>>> | undefined;
143
143
  key?: import("react").Key | null | undefined;
@@ -1,6 +1,7 @@
1
1
  interface Apikeys {
2
2
  suggest?: string;
3
3
  router?: string;
4
+ search?: string;
4
5
  }
5
6
  export declare class Config {
6
7
  readonly description: string;
@@ -1,7 +1,8 @@
1
- import type { BaseRouteResponse, RouteFeature, RouteOptions, RawRoute } from "./interface";
1
+ import type { BaseRouteResponse, RawRoute, RouteFeature, RouteOptions } from "./interface";
2
2
  export declare class DrivingRouteResponse implements BaseRouteResponse {
3
3
  #private;
4
4
  private _options?;
5
5
  constructor(data: RawRoute, options?: RouteOptions);
6
6
  toRoute(): RouteFeature;
7
+ toSteps(): RouteFeature[];
7
8
  }
@@ -1,4 +1,4 @@
1
1
  import { Config } from "../config";
2
- import type { BaseRouteResponse, RouteOptions, RouteFeature } from "./interface";
2
+ import type { BaseRouteResponse, RouteFeature, RouteOptions, TruckParameters } from "./interface";
3
3
  export declare function route(options: RouteOptions, config?: Config | undefined): Promise<BaseRouteResponse[]>;
4
- export { RouteOptions, BaseRouteResponse, RouteFeature };
4
+ export { BaseRouteResponse, RouteFeature, RouteOptions, TruckParameters };
@@ -3,6 +3,7 @@ export interface RawStep {
3
3
  length: number;
4
4
  duration: number;
5
5
  mode: string;
6
+ feature_class?: string;
6
7
  polyline: {
7
8
  points: LngLat[];
8
9
  };
@@ -24,7 +25,11 @@ export interface RawRoute {
24
25
  export interface RouteFeature extends GenericFeature<LngLat> {
25
26
  geometry: LineStringGeometry;
26
27
  properties: {
28
+ length?: number;
29
+ duration?: number;
30
+ mode?: string;
27
31
  bounds?: LngLatBounds;
32
+ featureClass?: string;
28
33
  flags?: {
29
34
  hasTolls?: boolean;
30
35
  hasNonTransactionalTolls?: boolean;
@@ -34,14 +39,38 @@ export interface RouteFeature extends GenericFeature<LngLat> {
34
39
  export interface BaseRouteResponse {
35
40
  /** Return requested route as {@link RouteFeature RouteFeature}. */
36
41
  toRoute(): RouteFeature;
42
+ /** Returns requested route, divided into steps, as {@link RouteFeature RouteFeature}[]. */
43
+ toSteps(): RouteFeature[];
44
+ }
45
+ export interface TruckParameters {
46
+ /** Vehicle weight in tons */
47
+ weight?: number;
48
+ /** Actual vehicle axle load in tons */
49
+ axleWeight?: number;
50
+ /** Maximum allowed vehicle weight in tons */
51
+ maxWeight?: number;
52
+ /** Maximum vehicle load capacity in tons */
53
+ payload?: number;
54
+ /** Vehicle height in meters */
55
+ height?: number;
56
+ /** Vehicle width in meters */
57
+ width?: number;
58
+ /** Vehicle length in meters */
59
+ length?: number;
60
+ /** Vehicle emission standard (number from 1 to 6, for example, 1 corresponds to Euro-1 class) */
61
+ ecoClass?: number;
62
+ /** Has a truck trailer */
63
+ hasTrailer?: boolean;
37
64
  }
38
65
  export interface RouteOptions {
39
66
  /** Route points represented by {@link LngLat LngLat} coordinates. */
40
67
  points: LngLat[];
41
- /** Route type. Only 'driving' type is available at this moment. */
42
- type: 'driving';
68
+ /** Route type. */
69
+ type: 'driving' | 'truck' | 'walking' | 'transit';
43
70
  /** If specified, bounding box of the route will be returned in properties. Default is `false`. */
44
71
  bounds?: boolean;
45
72
  /** Avoid roads with tolls. Default is `false`. */
46
73
  avoidTolls?: boolean;
74
+ /** Parameters for a truck (only for `type=truck`). */
75
+ truck?: TruckParameters;
47
76
  }
@@ -0,0 +1,8 @@
1
+ import type { BaseRouteResponse, RawRoute, RouteFeature, RouteOptions } from "./interface";
2
+ export declare class TransitRouteResponse implements BaseRouteResponse {
3
+ #private;
4
+ private _options?;
5
+ constructor(data: RawRoute, options?: RouteOptions);
6
+ toRoute(): RouteFeature;
7
+ toSteps(): RouteFeature[];
8
+ }
@@ -0,0 +1,8 @@
1
+ import type { BaseRouteResponse, RawRoute, RouteFeature, RouteOptions } from "./interface";
2
+ export declare class TruckRouteResponse implements BaseRouteResponse {
3
+ #private;
4
+ private _options?;
5
+ constructor(data: RawRoute, options?: RouteOptions);
6
+ toRoute(): RouteFeature;
7
+ toSteps(): RouteFeature[];
8
+ }
@@ -1,2 +1,3 @@
1
- import type { LngLatBounds } from "../../../common/types";
1
+ import type { LngLat, LngLatBounds } from "../../../common/types";
2
2
  export declare function isFiniteBounds(bounds: LngLatBounds): boolean;
3
+ export declare function boundsFromCoordinates(coordinates: LngLat[]): LngLatBounds;
@@ -1,2 +1,4 @@
1
1
  export * from "./bounds";
2
2
  export * from "./points";
3
+ export * from "./step-to-feature";
4
+ export * from "./to-route";
@@ -0,0 +1,2 @@
1
+ import type { RawRoute, RawStep, RouteFeature, RouteOptions } from "../interface";
2
+ export declare function stepToBasicRouteFeature(step: RawStep, featureId: string, route: RawRoute["route"], options?: RouteOptions): RouteFeature;
@@ -0,0 +1,2 @@
1
+ import type { RawRoute, RouteFeature, RouteOptions } from "../interface";
2
+ export declare function toRoute(rawRoute: RawRoute, featureId: string, options?: RouteOptions): RouteFeature;
@@ -0,0 +1,8 @@
1
+ import type { BaseRouteResponse, RawRoute, RouteFeature, RouteOptions } from "./interface";
2
+ export declare class WalkingRouteResponse implements BaseRouteResponse {
3
+ #private;
4
+ private _options?;
5
+ constructor(data: RawRoute, options?: RouteOptions);
6
+ toRoute(): RouteFeature;
7
+ toSteps(): RouteFeature[];
8
+ }
@@ -3,7 +3,12 @@ import { Config } from "../config";
3
3
  export type SearchType = "businesses" | "toponyms";
4
4
  export type SearchOptions = {
5
5
  /** Request string represented by a text or {@link LngLat LngLat} point. */
6
- text: string;
6
+ text?: string;
7
+ /**
8
+ * Additional information about the object.
9
+ * The parameter value is returned in the Geosuggest response.
10
+ * To use it in a request, specify a value instead of text. */
11
+ uri?: string;
7
12
  /**
8
13
  * {@link type `type`} parameter specifies the type of
9
14
  * objects that are being searched (and the order of objects
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappable-world/mappable-types",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "Types for mappable maps library",
5
5
  "main": "",
6
6
  "types": "index.d.ts",
@@ -15,7 +15,6 @@ export type Reactify = {
15
15
  module: ReactifyModule;
16
16
  entity: ReactifyEntity;
17
17
  };
18
- export declare const moduleOverrideExport: string;
19
18
  export type CustomReactify<TEntity extends GenericEntity<unknown>, TResult> = (ctor: EntityConstructor<TEntity>, params: {
20
19
  reactify: {
21
20
  module: ReactifyModule;
@@ -40,7 +39,9 @@ export type GetReactContext<TContext extends Context<unknown>> = (context?: TCon
40
39
  export type ReactifiedModule<TModule extends BaseModule> = {
41
40
  [Property in keyof TModule]: TModule[Property] extends EntityConstructor<GenericEntity<unknown>> ? ReturnType<InternalReactifyEntity<TModule[Property]>> : TModule[Property] extends Context<any> ? ReturnType<GetReactContext<TModule[Property]>> : TModule[Property];
42
41
  };
43
- export type BaseModule = Record<string | symbol, unknown>;
42
+ export type BaseModule = Record<string | symbol, unknown> & {
43
+ __implReactifyOverride?: (reactify: Reactify) => object;
44
+ };
44
45
  export type Prettify<T> = {
45
46
  [K in keyof T]: T[K];
46
47
  } & {};