@milemaker/milemaker-js 1.0.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.
- package/LICENSE +134 -0
- package/README.md +41 -0
- package/dist/MapProvider/index.d.ts +2453 -0
- package/dist/actions/constants/actions.constants.d.ts +14 -0
- package/dist/actions/constants/index.d.ts +1 -0
- package/dist/actions/index.d.ts +10 -0
- package/dist/actions/layer/baseLayerActions.factory.d.ts +6 -0
- package/dist/actions/layer/index.d.ts +6 -0
- package/dist/actions/layer/trafficLayerActions.factory.d.ts +3 -0
- package/dist/actions/layer/types/index.d.ts +1 -0
- package/dist/actions/layer/types/layerActions.types.d.ts +62 -0
- package/dist/actions/marker/createMarkerAction.factory.d.ts +2 -0
- package/dist/actions/marker/createRouteStopMarkerAction.factory.d.ts +3 -0
- package/dist/actions/marker/createRouteStopMarkersAction.factory.d.ts +3 -0
- package/dist/actions/marker/index.d.ts +3 -0
- package/dist/actions/marker/types/index.d.ts +1 -0
- package/dist/actions/marker/types/markerActions.types.d.ts +217 -0
- package/dist/actions/popup/createPopupAction.factory.d.ts +4 -0
- package/dist/actions/popup/index.d.ts +3 -0
- package/dist/actions/popup/types/index.d.ts +1 -0
- package/dist/actions/popup/types/popupActions.types.d.ts +128 -0
- package/dist/actions/route/createRouteAction.factory.d.ts +3 -0
- package/dist/actions/route/createShapeAction.factory.d.ts +3 -0
- package/dist/actions/route/index.d.ts +3 -0
- package/dist/actions/route/types/index.d.ts +1 -0
- package/dist/actions/route/types/routeActions.types.d.ts +96 -0
- package/dist/actions/types/actions.enums.d.ts +11 -0
- package/dist/actions/types/actions.types.d.ts +60 -0
- package/dist/actions/types/index.d.ts +7 -0
- package/dist/actions/zoom/createZoomActions.factory.d.ts +3 -0
- package/dist/actions/zoom/index.d.ts +2 -0
- package/dist/actions/zoom/types/index.d.ts +1 -0
- package/dist/actions/zoom/types/zoomActions.types.d.ts +76 -0
- package/dist/constants/common.constants.d.ts +4 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/controls/constants/controls.constants.d.ts +8 -0
- package/dist/controls/constants/index.d.ts +1 -0
- package/dist/controls/createAttributionControl.factory.d.ts +4 -0
- package/dist/controls/createBaseLayerControl.factory.d.ts +3 -0
- package/dist/controls/createCurrentPositionControl.factory.d.ts +3 -0
- package/dist/controls/createTrafficLayerControl.factory.d.ts +3 -0
- package/dist/controls/createZoomControl.factory.d.ts +3 -0
- package/dist/controls/index.d.ts +5 -0
- package/dist/controls/types/controls.enums.d.ts +11 -0
- package/dist/controls/types/controls.types.d.ts +121 -0
- package/dist/controls/types/index.d.ts +2 -0
- package/dist/createMap/constants/createMap.constants.d.ts +1 -0
- package/dist/createMap/constants/index.d.ts +1 -0
- package/dist/createMap/createMap.d.ts +23 -0
- package/dist/createMap/index.d.ts +1 -0
- package/dist/createMap/types/createMap.types.d.ts +67 -0
- package/dist/createMap/types/index.d.ts +1 -0
- package/dist/helpers/decodeRoutePolylineString.helper.d.ts +7 -0
- package/dist/helpers/generateUuid.helper.d.ts +1 -0
- package/dist/helpers/getControlAbsolutePosition.helper.d.ts +6 -0
- package/dist/helpers/getDistanceBetweenLonLatLike.helper.d.ts +8 -0
- package/dist/helpers/getIsSupported.helper.d.ts +5 -0
- package/dist/helpers/getMapFlyToAnimationDuration.helper.d.ts +7 -0
- package/dist/helpers/getMapFlyToOptions.helper.d.ts +14 -0
- package/dist/helpers/getNumberOfTimeUnites.helper.d.ts +9 -0
- package/dist/helpers/htmlRender.d.ts +29 -0
- package/dist/helpers/index.d.ts +5 -0
- package/dist/helpers/injectHTMLElement.helper.d.ts +7 -0
- package/dist/helpers/parseLonLatLikeToCoordinates.helper.d.ts +7 -0
- package/dist/helpers/parseLonLatLikeToTuple.helper.d.ts +7 -0
- package/dist/helpers/replaceMatchInSvg.helper.d.ts +16 -0
- package/dist/index.cjs +3944 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +54058 -0
- package/dist/nmaps-gl-5352a2f0.js +4 -0
- package/dist/nmaps-gl-df6fcdba.cjs +1 -0
- package/dist/types/common.enums.d.ts +11 -0
- package/dist/types/common.types.d.ts +59 -0
- package/dist/types/index.d.ts +5 -0
- package/package.json +55 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MapBaseLayer } from "../../types";
|
|
2
|
+
export declare const DEFAULT_BASE_LAYER = MapBaseLayer.STREETS;
|
|
3
|
+
export declare const DEFAULT_BASE_API_URL = "https://proxy-nodejs.dev.milemaker.com/proxy";
|
|
4
|
+
export declare const DEFAULT_ROUTE_COLOR = "rgba(0, 0, 0, 0.87)";
|
|
5
|
+
export declare const MAP_FIT_INTO_BOUNDS_DEFAULT_PADDING = 100;
|
|
6
|
+
export declare const MAP_DEFAULT_POLYLINE_STROKE_WIDTH = 5;
|
|
7
|
+
export declare const MAP_DEFAULT_POLYLINE_STROKE_OPACITY = 1;
|
|
8
|
+
export declare const NMAPS_TRAFFIC_PREFIX = "traffic";
|
|
9
|
+
export declare const NMAPS_TRAFFIC_SOURCE_NAME = "ndrive-traffic";
|
|
10
|
+
export declare const NMAPS_LAYOUT_PROPERTY_VISIBILITY_KEY = "visibility";
|
|
11
|
+
export declare const NMAPSLAYOUT_PROPERTY_VISIBILITY_VALUES: {
|
|
12
|
+
visible: string;
|
|
13
|
+
none: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./actions.constants";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MapBaseLayer } from "../types";
|
|
2
|
+
import { CreateActionsFactory, MapActions } from "./types";
|
|
3
|
+
export * from "./zoom";
|
|
4
|
+
export * from "./layer";
|
|
5
|
+
export * from "./layer";
|
|
6
|
+
export * from "./marker";
|
|
7
|
+
export * from "./popup";
|
|
8
|
+
export declare const createMapActionFactory: CreateActionsFactory<MapActions, {
|
|
9
|
+
defaultBaseLayer?: MapBaseLayer;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MapBaseLayer } from "../../types";
|
|
2
|
+
import { CreateActionsFactory } from "../types";
|
|
3
|
+
import { BaseLayerActions } from "./types";
|
|
4
|
+
export declare const baseLayerActionsFactory: CreateActionsFactory<BaseLayerActions, {
|
|
5
|
+
defaultBaseLayer?: MapBaseLayer;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./layerActions.types";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { MapBaseLayer } from "../../../types";
|
|
2
|
+
/**
|
|
3
|
+
* Base layer actions
|
|
4
|
+
* @interface
|
|
5
|
+
* @group Actions
|
|
6
|
+
* @category Layers
|
|
7
|
+
*/
|
|
8
|
+
export type BaseLayerActions = {
|
|
9
|
+
/**
|
|
10
|
+
* Change current base layer
|
|
11
|
+
* @param baseLayer - Base layer to set
|
|
12
|
+
*/
|
|
13
|
+
changeBaseLayer(baseLayer: MapBaseLayer): void;
|
|
14
|
+
/**
|
|
15
|
+
* Get current base layer
|
|
16
|
+
*/
|
|
17
|
+
getCurrentBaseLayer(): MapBaseLayer;
|
|
18
|
+
/**
|
|
19
|
+
* Get is given base layer currently visible
|
|
20
|
+
*/
|
|
21
|
+
getIsVisibleBaseLayer(baseLayer: MapBaseLayer): boolean;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Traffic layer actions
|
|
25
|
+
* @interface
|
|
26
|
+
* @group Actions
|
|
27
|
+
* @category Layers
|
|
28
|
+
*/
|
|
29
|
+
export type TrafficLayerActions = {
|
|
30
|
+
/**
|
|
31
|
+
* Show traffic layer
|
|
32
|
+
*/
|
|
33
|
+
showTrafficLayer(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Hide traffic layer
|
|
36
|
+
*/
|
|
37
|
+
hideTrafficLayer(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get is traffic layer visible
|
|
40
|
+
*/
|
|
41
|
+
getIsVisibleTrafficLayer(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Toggle traffic layer visibility
|
|
44
|
+
*/
|
|
45
|
+
toggle(): void;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Map layer actions
|
|
49
|
+
* @interface
|
|
50
|
+
* @group Actions
|
|
51
|
+
* @category Layers
|
|
52
|
+
*/
|
|
53
|
+
export type MapLayerActions = {
|
|
54
|
+
/**
|
|
55
|
+
* Base layer actions
|
|
56
|
+
*/
|
|
57
|
+
baseLayerActions: BaseLayerActions;
|
|
58
|
+
/**
|
|
59
|
+
* Traffic layer actions
|
|
60
|
+
*/
|
|
61
|
+
trafficLayerActions: TrafficLayerActions;
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./markerActions.types";
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import MapProvider from "../../../MapProvider";
|
|
2
|
+
import { LonLatLike, Popup } from "../../../types";
|
|
3
|
+
import { CreatePopupOptions, MapElement } from "../../types";
|
|
4
|
+
/**
|
|
5
|
+
* Marker instance
|
|
6
|
+
* @interface
|
|
7
|
+
* @group Actions
|
|
8
|
+
* @category Marker
|
|
9
|
+
*/
|
|
10
|
+
export type Marker = {
|
|
11
|
+
/**
|
|
12
|
+
* Move marker to given coordinate
|
|
13
|
+
* @param lonLatLike - Coordinate to move marker
|
|
14
|
+
*/
|
|
15
|
+
moveMarker(lonLatLike: LonLatLike): void;
|
|
16
|
+
/**
|
|
17
|
+
* Get marker's coordinate
|
|
18
|
+
*/
|
|
19
|
+
getLonLatLike(): LonLatLike;
|
|
20
|
+
/**
|
|
21
|
+
* Get marker's element
|
|
22
|
+
*/
|
|
23
|
+
getHtmlElement(): HTMLElement | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Set marker html icon
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const element = document.createElement("div");
|
|
29
|
+
* element.innerText = "Hello World!"
|
|
30
|
+
* marker.setHtmlIconElement(() => ({htmlElement: element}));
|
|
31
|
+
* ```
|
|
32
|
+
* @param getHtmlIconElement
|
|
33
|
+
*/
|
|
34
|
+
setHtmlIconElement(
|
|
35
|
+
/**
|
|
36
|
+
* Callback function to set marker's element, with additional events
|
|
37
|
+
* @param marker - Marker's instance
|
|
38
|
+
*/
|
|
39
|
+
getHtmlIconElement: (marker: Marker) => {
|
|
40
|
+
/**
|
|
41
|
+
* Element which marker will be using
|
|
42
|
+
*/
|
|
43
|
+
htmlElement: HTMLElement;
|
|
44
|
+
/**
|
|
45
|
+
* Callback which is triggered when the marker is unmounted
|
|
46
|
+
* @event
|
|
47
|
+
*/
|
|
48
|
+
onUnmount?: () => void;
|
|
49
|
+
/**
|
|
50
|
+
* Callback which is triggered when the marker is mounted
|
|
51
|
+
* @param marker - Marker instance
|
|
52
|
+
* @event
|
|
53
|
+
*/
|
|
54
|
+
onMount?: (marker: Marker) => void;
|
|
55
|
+
}): Marker | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Marker popup
|
|
58
|
+
*/
|
|
59
|
+
popup?: Popup;
|
|
60
|
+
} & MapElement;
|
|
61
|
+
/**
|
|
62
|
+
* Multiple markers instance
|
|
63
|
+
* @interface
|
|
64
|
+
* @group Actions
|
|
65
|
+
* @category Marker
|
|
66
|
+
*/
|
|
67
|
+
export type Markers = MapElement & {
|
|
68
|
+
markers: Marker[];
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Marker's popup options
|
|
72
|
+
* @interface
|
|
73
|
+
* @group Actions
|
|
74
|
+
* @category Marker
|
|
75
|
+
*/
|
|
76
|
+
export type MarkerPopupOptions = {
|
|
77
|
+
/**
|
|
78
|
+
* Do toggle marker on click
|
|
79
|
+
*/
|
|
80
|
+
toggleOnMarkerClick?: boolean;
|
|
81
|
+
} & CreatePopupOptions;
|
|
82
|
+
/**
|
|
83
|
+
* Create marker options
|
|
84
|
+
* @interface
|
|
85
|
+
* @group Actions
|
|
86
|
+
* @category Marker
|
|
87
|
+
*/
|
|
88
|
+
export type CreateMarkerOptions = {
|
|
89
|
+
/**
|
|
90
|
+
* Do show marker when created
|
|
91
|
+
* @default true
|
|
92
|
+
*/
|
|
93
|
+
showOnMount?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Do center on click
|
|
96
|
+
*/
|
|
97
|
+
centerOnClick?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Marker's popup options
|
|
100
|
+
*/
|
|
101
|
+
popupOptions?: MarkerPopupOptions;
|
|
102
|
+
/**
|
|
103
|
+
* Function to set marker's element, with additional events
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* const element = document.createElement("div");
|
|
107
|
+
* element.innerText = "Hello World!"
|
|
108
|
+
* map.actions.createMarker({
|
|
109
|
+
* ...,
|
|
110
|
+
* getHtmlIconElement: () => ({htmlElement: element})
|
|
111
|
+
* });
|
|
112
|
+
* ```
|
|
113
|
+
* @param marker - Marker's instance
|
|
114
|
+
*/
|
|
115
|
+
getHtmlIconElement?(marker: Marker): {
|
|
116
|
+
/**
|
|
117
|
+
* Element which marker will be using
|
|
118
|
+
*/
|
|
119
|
+
htmlElement: HTMLElement;
|
|
120
|
+
/**
|
|
121
|
+
* Callback which is triggered when the marker is unmounted
|
|
122
|
+
* @event
|
|
123
|
+
*/
|
|
124
|
+
onUnmount?: () => void;
|
|
125
|
+
/**
|
|
126
|
+
* Callback which is triggered when the marker is mounted
|
|
127
|
+
* @param marker- Marker instance
|
|
128
|
+
* @event
|
|
129
|
+
*/
|
|
130
|
+
onMount?: (marker: Marker) => void;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Event triggered when clicked on marker
|
|
134
|
+
* @event
|
|
135
|
+
*/
|
|
136
|
+
onClick?(): void;
|
|
137
|
+
/**
|
|
138
|
+
* Event triggered when hovered the marker
|
|
139
|
+
* @event
|
|
140
|
+
*/
|
|
141
|
+
onHover?(): {
|
|
142
|
+
/**
|
|
143
|
+
* Event triggered when mouse left the marker
|
|
144
|
+
* @event
|
|
145
|
+
*/
|
|
146
|
+
onMouseLeave?(): void;
|
|
147
|
+
} | void;
|
|
148
|
+
} & Omit<MapProvider.MarkerOptions, "element">;
|
|
149
|
+
/**
|
|
150
|
+
* Create stop marker options with predefined icon, and color.
|
|
151
|
+
* @interface
|
|
152
|
+
* @group Actions
|
|
153
|
+
* @category Marker
|
|
154
|
+
*/
|
|
155
|
+
export type CreateStopMarkerOptions = {
|
|
156
|
+
/**
|
|
157
|
+
* Marker's color
|
|
158
|
+
*/
|
|
159
|
+
color?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Index of a stop
|
|
162
|
+
*/
|
|
163
|
+
index: number;
|
|
164
|
+
/**
|
|
165
|
+
* Count of all stops in a route
|
|
166
|
+
*/
|
|
167
|
+
length: number;
|
|
168
|
+
} & CreateMarkerOptions;
|
|
169
|
+
/**
|
|
170
|
+
* Markers popup options
|
|
171
|
+
* @interface
|
|
172
|
+
* @group Actions
|
|
173
|
+
* @category Marker
|
|
174
|
+
*/
|
|
175
|
+
export type MarkersPopupOptions = Pick<MarkerPopupOptions, "toggleOnMarkerClick" | "showOnMount" | "hideOnClickOutside">;
|
|
176
|
+
/**
|
|
177
|
+
* Create stop markers options
|
|
178
|
+
* @interface
|
|
179
|
+
* @group Actions
|
|
180
|
+
* @category Marker
|
|
181
|
+
*/
|
|
182
|
+
export type CreateStopMarkersOptions = Pick<CreateMarkerOptions, "color" | "showOnMount" | "centerOnClick"> & {
|
|
183
|
+
/**
|
|
184
|
+
* Marker's popup options
|
|
185
|
+
*/
|
|
186
|
+
popupOptions?: MarkersPopupOptions;
|
|
187
|
+
/**
|
|
188
|
+
* Callback to set every marker option individually
|
|
189
|
+
*/
|
|
190
|
+
getMarkerOptions?: (item: LonLatLike, index: number, array: LonLatLike[]) => Partial<CreateStopMarkerOptions>;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Marker actions
|
|
194
|
+
* @interface
|
|
195
|
+
* @group Actions
|
|
196
|
+
* @category Marker
|
|
197
|
+
*/
|
|
198
|
+
export type MarkerActions = {
|
|
199
|
+
/**
|
|
200
|
+
* Create marker
|
|
201
|
+
* @param lonLatLike - Marker's coordinate to create
|
|
202
|
+
* @param options - Options to set
|
|
203
|
+
*/
|
|
204
|
+
createMarker(lonLatLike: LonLatLike, options?: CreateMarkerOptions): Marker;
|
|
205
|
+
/**
|
|
206
|
+
* Create stop marker
|
|
207
|
+
* @param lonLatLike - Marker's coordinate to create
|
|
208
|
+
* @param options - Options to set
|
|
209
|
+
*/
|
|
210
|
+
createStopMarker(lonLatLike: LonLatLike, options: CreateStopMarkerOptions): Marker;
|
|
211
|
+
/**
|
|
212
|
+
* Create markers
|
|
213
|
+
* @param stops - Markers coordinates to create
|
|
214
|
+
* @param options - Options to set
|
|
215
|
+
*/
|
|
216
|
+
createStopMarkers(stops: LonLatLike[], options?: CreateStopMarkersOptions): Markers;
|
|
217
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./popupActions.types";
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import MapProvider from "../../../MapProvider";
|
|
2
|
+
import { LonLatLike } from "../../../types";
|
|
3
|
+
import { MapElement, Marker } from "../../types";
|
|
4
|
+
/**
|
|
5
|
+
* Popup instance
|
|
6
|
+
* @interface
|
|
7
|
+
* @group Actions
|
|
8
|
+
* @category Popup
|
|
9
|
+
*/
|
|
10
|
+
export type Popup = {
|
|
11
|
+
/**
|
|
12
|
+
* Move popup to given coordinate
|
|
13
|
+
* @param lonLatLike - Coordinate to move popup
|
|
14
|
+
*/
|
|
15
|
+
movePopup(lonLatLike: LonLatLike): void;
|
|
16
|
+
/**
|
|
17
|
+
* Get popup's coordinate
|
|
18
|
+
*/
|
|
19
|
+
getLonLatLike(): LonLatLike;
|
|
20
|
+
/**
|
|
21
|
+
* Get popup's element
|
|
22
|
+
*/
|
|
23
|
+
getHtmlElement(): HTMLElement | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Set popup html content
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const element = document.createElement("div");
|
|
29
|
+
* element.innerText = "Hello World!"
|
|
30
|
+
* popup.setHtmlIconElement(() => ({htmlElement: element}));
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
setHtmlContentElement(
|
|
34
|
+
/**
|
|
35
|
+
* Callback function to set popup's element, with additional events
|
|
36
|
+
* @param Popup's instance
|
|
37
|
+
*/
|
|
38
|
+
getHtmlContentElementCb: (popup: Popup) => {
|
|
39
|
+
/**
|
|
40
|
+
* Element which popup will be using as content
|
|
41
|
+
*/
|
|
42
|
+
htmlElement: HTMLElement;
|
|
43
|
+
/**
|
|
44
|
+
* Callback which is triggered when the popup is unmounted
|
|
45
|
+
* @event
|
|
46
|
+
*/
|
|
47
|
+
onUnmount?: () => void;
|
|
48
|
+
/**
|
|
49
|
+
* Callback which is triggered when the popup is mounted
|
|
50
|
+
* @param popup - Popup instance
|
|
51
|
+
* @event
|
|
52
|
+
*/
|
|
53
|
+
onMount?: (popup: Popup) => void;
|
|
54
|
+
}): Popup | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Toggle popup visibility
|
|
57
|
+
*/
|
|
58
|
+
toggle(): void;
|
|
59
|
+
} & MapElement;
|
|
60
|
+
/**
|
|
61
|
+
* Create popup options
|
|
62
|
+
* @interface
|
|
63
|
+
* @group Actions
|
|
64
|
+
* @category Popup
|
|
65
|
+
*/
|
|
66
|
+
export type CreatePopupOptions = {
|
|
67
|
+
/**
|
|
68
|
+
* If is created using {@link Marker}, will have marker instance.
|
|
69
|
+
*/
|
|
70
|
+
marker?: Marker;
|
|
71
|
+
/**
|
|
72
|
+
* Do show popup when created
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
showOnMount?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Popup y-offset from the coordinate
|
|
78
|
+
*/
|
|
79
|
+
offset?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Hide popup when clicked an outside popup element
|
|
82
|
+
*/
|
|
83
|
+
hideOnClickOutside?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Set popup html content
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const element = document.createElement("div");
|
|
89
|
+
* element.innerText = "Hello World!"
|
|
90
|
+
* map.actions.createPopup({
|
|
91
|
+
* ...,
|
|
92
|
+
* getHtmlContentElement: () => ({htmlElement: element})
|
|
93
|
+
* });
|
|
94
|
+
* ```
|
|
95
|
+
* @param popup - Popup's instance
|
|
96
|
+
*/
|
|
97
|
+
getHtmlContentElement?(popup: Popup): {
|
|
98
|
+
/**
|
|
99
|
+
* Element which popup will be using as content
|
|
100
|
+
*/
|
|
101
|
+
htmlElement: HTMLElement;
|
|
102
|
+
/**
|
|
103
|
+
* Callback which is triggered when the popup is unmounted
|
|
104
|
+
* @event
|
|
105
|
+
*/
|
|
106
|
+
onUnmount?(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Callback which is triggered when the popup is mounted
|
|
109
|
+
* @param popup - Popup instance
|
|
110
|
+
* @event
|
|
111
|
+
*/
|
|
112
|
+
onMount?(popup: Popup): void;
|
|
113
|
+
};
|
|
114
|
+
} & MapProvider.PopupOptions;
|
|
115
|
+
/**
|
|
116
|
+
* Popup actions
|
|
117
|
+
* @interface
|
|
118
|
+
* @group Actions
|
|
119
|
+
* @category Popup
|
|
120
|
+
*/
|
|
121
|
+
export type PopupActions = {
|
|
122
|
+
/**
|
|
123
|
+
* Create popup
|
|
124
|
+
* @param lonLatLike - Popup's coordinate to create
|
|
125
|
+
* @param options - Options to set
|
|
126
|
+
*/
|
|
127
|
+
createPopup(lonLatLike: LonLatLike, options?: CreatePopupOptions): Popup;
|
|
128
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./routeActions.types";
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { LonLatLike } from "../../../types";
|
|
2
|
+
import { Markers } from "../../marker/types";
|
|
3
|
+
import { CreateStopMarkersOptions, MapElement } from "../../types";
|
|
4
|
+
/**
|
|
5
|
+
* Route instance
|
|
6
|
+
* @interface
|
|
7
|
+
* @group Actions
|
|
8
|
+
* @category Route
|
|
9
|
+
*/
|
|
10
|
+
export type Route = {
|
|
11
|
+
/**
|
|
12
|
+
* Route shape instance
|
|
13
|
+
*/
|
|
14
|
+
shape: Shape;
|
|
15
|
+
/**
|
|
16
|
+
* Route markers instance
|
|
17
|
+
*/
|
|
18
|
+
markers: Markers;
|
|
19
|
+
} & MapElement;
|
|
20
|
+
/**
|
|
21
|
+
* Shape instance
|
|
22
|
+
* @interface
|
|
23
|
+
* @group Actions
|
|
24
|
+
* @category Route
|
|
25
|
+
*/
|
|
26
|
+
export type Shape = {
|
|
27
|
+
/**
|
|
28
|
+
* Get shape's LonLatLike as an array
|
|
29
|
+
*/
|
|
30
|
+
getLonLatLikes(): LonLatLike[];
|
|
31
|
+
} & MapElement;
|
|
32
|
+
/**
|
|
33
|
+
* Create shape options
|
|
34
|
+
* @interface
|
|
35
|
+
* @group Actions
|
|
36
|
+
* @category Route
|
|
37
|
+
*/
|
|
38
|
+
export type CreateShapeOptions = {
|
|
39
|
+
/**
|
|
40
|
+
* Do show shape when created
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
showOnMount?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Shape's color
|
|
46
|
+
*/
|
|
47
|
+
color?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Shape's opacity
|
|
50
|
+
*/
|
|
51
|
+
opacity?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Shape's stroke weight
|
|
54
|
+
*/
|
|
55
|
+
weight?: number;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Create route options
|
|
59
|
+
* @interface
|
|
60
|
+
* @group Actions
|
|
61
|
+
* @category Route
|
|
62
|
+
*/
|
|
63
|
+
export type CreateRouteOptions = {
|
|
64
|
+
/**
|
|
65
|
+
* Do show route when created
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
68
|
+
showOnMount?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Shape options
|
|
71
|
+
*/
|
|
72
|
+
shapeOptions?: CreateShapeOptions;
|
|
73
|
+
/**
|
|
74
|
+
* Stop markers options
|
|
75
|
+
*/
|
|
76
|
+
stopMarkersOptions?: CreateStopMarkersOptions;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Route actions
|
|
80
|
+
* @interface
|
|
81
|
+
* @group Actions
|
|
82
|
+
* @category Route
|
|
83
|
+
*/
|
|
84
|
+
export type RouteActions = {
|
|
85
|
+
/**
|
|
86
|
+
* Create route
|
|
87
|
+
*/
|
|
88
|
+
createRoute(props: {
|
|
89
|
+
shapes: string[] | LonLatLike[];
|
|
90
|
+
stops: LonLatLike[];
|
|
91
|
+
}, options?: CreateRouteOptions): Route;
|
|
92
|
+
/**
|
|
93
|
+
* Create shape
|
|
94
|
+
*/
|
|
95
|
+
createShape(shape: string[] | LonLatLike[], options?: CreateShapeOptions): Shape;
|
|
96
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import MapProvider from "../../MapProvider";
|
|
2
|
+
import { MapLayerActions } from "../layer/types";
|
|
3
|
+
import { MarkerActions } from "../marker/types";
|
|
4
|
+
import { PopupActions } from "../popup/types";
|
|
5
|
+
import { RouteActions } from "../route/types";
|
|
6
|
+
import { ZoomActions } from "../zoom/types";
|
|
7
|
+
/**
|
|
8
|
+
* Basic map element
|
|
9
|
+
* @group Common
|
|
10
|
+
* @category Abstract Instances
|
|
11
|
+
* @interface
|
|
12
|
+
*/
|
|
13
|
+
export type MapElement = {
|
|
14
|
+
/**
|
|
15
|
+
* Center map camera
|
|
16
|
+
*/
|
|
17
|
+
center(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Fit into an element bound with zooming.
|
|
20
|
+
* For coordinate items works the same as center but zooming.
|
|
21
|
+
* But for elements like shapes will fit it into screen bounds.
|
|
22
|
+
*/
|
|
23
|
+
fitIntoBounds(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Hides map element
|
|
26
|
+
*/
|
|
27
|
+
hide(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Shows map Element
|
|
30
|
+
*/
|
|
31
|
+
show(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Get is map element visible
|
|
34
|
+
*/
|
|
35
|
+
getIsVisible(): boolean;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Base action factory props
|
|
39
|
+
* @interface
|
|
40
|
+
* @ignore
|
|
41
|
+
* @group Actions
|
|
42
|
+
*/
|
|
43
|
+
type BaseActionFactoryProps = {
|
|
44
|
+
map: MapProvider.Map;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Base action factory props
|
|
48
|
+
* @interface
|
|
49
|
+
* @group Actions
|
|
50
|
+
* @typeParam {Return} Return - An actions to return
|
|
51
|
+
* @typeParam {AdditionalOptions = void} AdditionalOptions - Additional actions options
|
|
52
|
+
* @ignore
|
|
53
|
+
*/
|
|
54
|
+
export type CreateActionsFactory<Return, AdditionalOptions = void> = (options: BaseActionFactoryProps & (AdditionalOptions extends void ? unknown : AdditionalOptions)) => Return;
|
|
55
|
+
/**
|
|
56
|
+
* @interface
|
|
57
|
+
* @group Actions
|
|
58
|
+
*/
|
|
59
|
+
export type MapActions = ZoomActions & MapLayerActions & MarkerActions & PopupActions & RouteActions;
|
|
60
|
+
export {};
|