@stadiamaps/ferrostar-webcomponents 0.38.0 → 0.40.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/dist/ferrostar-core.d.ts +36 -0
- package/dist/ferrostar-core.d.ts.map +1 -0
- package/dist/ferrostar-map.d.ts +70 -33
- package/dist/ferrostar-map.d.ts.map +1 -1
- package/dist/ferrostar-webcomponents.js +748 -605
- package/dist/ferrostar-webcomponents.js.map +1 -1
- package/dist/ferrostar-webcomponents.umd.cjs +34 -33
- package/dist/ferrostar-webcomponents.umd.cjs.map +1 -1
- package/dist/main.d.ts +3 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/replay-controller.d.ts +19 -0
- package/dist/replay-controller.d.ts.map +1 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ReactiveElement, PropertyValues } from 'lit';
|
|
2
|
+
import { SerializableNavState, NavigationController, RouteAdapter, TripState } from '@stadiamaps/ferrostar';
|
|
3
|
+
import { StateProvider } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* A core navigation component that handles navigation logic without UI.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FerrostarCore extends ReactiveElement implements StateProvider {
|
|
8
|
+
valhallaEndpointUrl: string;
|
|
9
|
+
profile: string;
|
|
10
|
+
httpClient?: Function;
|
|
11
|
+
locationProvider: any;
|
|
12
|
+
options: object;
|
|
13
|
+
protected _navState: SerializableNavState | null;
|
|
14
|
+
onNavigationStart?: () => void;
|
|
15
|
+
onNavigationStop?: () => void;
|
|
16
|
+
onTripStateChange?: (newState: TripState | null) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Enables voice guidance via the web speech synthesis API.
|
|
19
|
+
* Defaults to false.
|
|
20
|
+
*/
|
|
21
|
+
useVoiceGuidance: boolean;
|
|
22
|
+
shouldRecord: boolean;
|
|
23
|
+
routeAdapter: RouteAdapter | null;
|
|
24
|
+
navigationController: NavigationController | null;
|
|
25
|
+
lastSpokenUtteranceId: string | null;
|
|
26
|
+
constructor();
|
|
27
|
+
updated(changedProperties: PropertyValues<this>): void;
|
|
28
|
+
getRoutes(initialLocation: any, waypoints: any): Promise<any>;
|
|
29
|
+
startNavigation(route: any, config: any): void;
|
|
30
|
+
private saveRecording;
|
|
31
|
+
stopNavigation(): Promise<void>;
|
|
32
|
+
provideState(tripState: TripState): void;
|
|
33
|
+
private navStateUpdate;
|
|
34
|
+
private onLocationUpdated;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=ferrostar-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ferrostar-core.d.ts","sourceRoot":"","sources":["../src/ferrostar-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAEtD,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,SAAS,EACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC;;GAEG;AACH,qBACa,aAAc,SAAQ,eAAgB,YAAW,aAAa;IAEzE,mBAAmB,EAAE,MAAM,CAAM;IAGjC,OAAO,EAAE,MAAM,CAAM;IAGrB,UAAU,CAAC,EAAE,QAAQ,CAAS;IAI9B,gBAAgB,EAAG,GAAG,CAAC;IAIvB,OAAO,EAAE,MAAM,CAAM;IAGrB,SAAS,CAAC,SAAS,EAAE,oBAAoB,GAAG,IAAI,CAAQ;IAGxD,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAG/B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAG9B,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IAEzD;;;OAGG;IAEH,gBAAgB,EAAE,OAAO,CAAS;IAGlC,YAAY,EAAE,OAAO,CAAS;IAE9B,YAAY,EAAE,YAAY,GAAG,IAAI,CAAQ;IACzC,oBAAoB,EAAE,oBAAoB,GAAG,IAAI,CAAQ;IACzD,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAQ;;IAW5C,OAAO,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC;IAOzC,SAAS,CAAC,eAAe,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG;IAoCpD,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG;IA4BvC,OAAO,CAAC,aAAa;IAaf,cAAc;IAWpB,YAAY,CAAC,SAAS,EAAE,SAAS;IAUjC,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,iBAAiB;CAoC1B"}
|
package/dist/ferrostar-map.d.ts
CHANGED
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
-
import { default as maplibregl, GeolocateControl
|
|
3
|
-
import {
|
|
2
|
+
import { default as maplibregl, GeolocateControl } from 'maplibre-gl';
|
|
3
|
+
import { TripState } from '@stadiamaps/ferrostar';
|
|
4
|
+
import { StateProvider as StateProvider } from './types';
|
|
4
5
|
/**
|
|
5
|
-
* A MapLibre-based map component
|
|
6
|
+
* A MapLibre-based map component.
|
|
6
7
|
*/
|
|
7
8
|
export declare class FerrostarMap extends LitElement {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The MapLibre map instance.
|
|
11
|
+
*
|
|
12
|
+
* You have to explicitly set this value when initializing
|
|
13
|
+
* the web component to provide your own map instance.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
map: maplibregl.Map;
|
|
17
|
+
stateProvider: StateProvider | null;
|
|
17
18
|
/**
|
|
18
19
|
* Styles to load which will apply inside the component
|
|
19
20
|
*/
|
|
20
|
-
customStyles?: object
|
|
21
|
+
customStyles?: object;
|
|
22
|
+
tripState: TripState | null;
|
|
23
|
+
route: any;
|
|
24
|
+
/**
|
|
25
|
+
* Determines whether the navigation user interface is displayed.
|
|
26
|
+
*/
|
|
27
|
+
showNavigationUI: boolean;
|
|
21
28
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
29
|
+
* Should the user marker be shown on the map.
|
|
30
|
+
* This is optional and defaults to false.
|
|
24
31
|
*/
|
|
25
|
-
|
|
32
|
+
showUserMarker: boolean;
|
|
26
33
|
/**
|
|
27
34
|
* Automatically geolocates the user on map load.
|
|
28
35
|
*
|
|
@@ -37,29 +44,59 @@ export declare class FerrostarMap extends LitElement {
|
|
|
37
44
|
* Set this to false if you want to disable the geolocation control or bring your own.
|
|
38
45
|
*/
|
|
39
46
|
addGeolocateControl: boolean;
|
|
40
|
-
routeAdapter: RouteAdapter | null;
|
|
41
47
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
* A callback function that is invoked when navigation is stopped.
|
|
49
|
+
* Optional: This function can be provided by the StateProvider.
|
|
50
|
+
*/
|
|
51
|
+
onStopNavigation?: () => void;
|
|
52
|
+
/**
|
|
53
|
+
* The geolocate control instance.
|
|
47
54
|
*/
|
|
48
|
-
map: maplibregl.Map;
|
|
49
55
|
geolocateControl: GeolocateControl | null;
|
|
50
|
-
|
|
51
|
-
simulatedLocationMarker: maplibregl.Marker | null;
|
|
52
|
-
lastSpokenUtteranceId: string | null;
|
|
56
|
+
private userLocationMarker;
|
|
53
57
|
static styles: import('lit').CSSResult[];
|
|
54
58
|
constructor();
|
|
55
|
-
updated(changedProperties: PropertyValues<this>): void;
|
|
56
59
|
firstUpdated(): void;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
private
|
|
60
|
+
updated(changedProperties: PropertyValues<this>): void;
|
|
61
|
+
linkWith(stateProvider: StateProvider, showUserMarker?: boolean): void;
|
|
62
|
+
/**
|
|
63
|
+
* Renders the current tripState on the map.
|
|
64
|
+
*/
|
|
65
|
+
private renderTripState;
|
|
66
|
+
/**
|
|
67
|
+
* Renders a route on the map.
|
|
68
|
+
* If a route already exists, it clears the previous route before rendering a new one.
|
|
69
|
+
* This method adds two layers to the map: the primary route layer and a border layer.
|
|
70
|
+
*/
|
|
71
|
+
private renderRoute;
|
|
72
|
+
/**
|
|
73
|
+
* Renders or updates the user's location marker on the map. If a marker already exists, its position is updated.
|
|
74
|
+
* Otherwise, a new marker is created and added to the map.
|
|
75
|
+
*/
|
|
76
|
+
private renderUserLocationMarker;
|
|
77
|
+
/**
|
|
78
|
+
* Updates the camera position and orientation on the map based on the navState.
|
|
79
|
+
* Adjusts the center of the map to the user's current location and sets the bearing
|
|
80
|
+
* based on the user's course over ground, if available.
|
|
81
|
+
*/
|
|
82
|
+
private updateCamera;
|
|
83
|
+
/**
|
|
84
|
+
* Clears the route layers and source from the map if they exist.
|
|
85
|
+
*/
|
|
86
|
+
private clearRoute;
|
|
87
|
+
/**
|
|
88
|
+
* Removes the user's location marker from the map if it exists and clears the reference.
|
|
89
|
+
*/
|
|
90
|
+
private clearUserLocationMarker;
|
|
91
|
+
/**
|
|
92
|
+
* Clears the current navigation state, including route, user location marker, and navigation-related data.
|
|
93
|
+
*/
|
|
94
|
+
clearNavigation(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Handles the logic for stopping the navigation process. It clears the navigation state,
|
|
97
|
+
* resets the simulation flag, and invokes the optional onStopNavigation callback if provided.
|
|
98
|
+
*/
|
|
99
|
+
private handleStopNavigation;
|
|
63
100
|
render(): import('lit-html').TemplateResult<1>;
|
|
64
101
|
}
|
|
65
102
|
//# sourceMappingURL=ferrostar-map.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ferrostar-map.d.ts","sourceRoot":"","sources":["../src/ferrostar-map.ts"],"names":[],"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