@tomtom-org/maps-sdk 0.30.1 → 0.31.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/CHANGELOG.md +21 -0
- package/README.md +4 -3
- package/core/dist/core.cjs.js +19 -1
- package/core/dist/core.cjs.js.map +1 -1
- package/core/dist/core.cjs.min.js +1 -1
- package/core/dist/core.cjs.min.js.map +1 -1
- package/core/dist/core.es.js +1 -1
- package/core/dist/core.es.js.map +1 -1
- package/core/dist/index.d.ts +22 -7
- package/core/package.json +0 -8
- package/map/dist/THIRD_PARTY.txt +132 -5
- package/map/dist/index.d.ts +246 -147
- package/map/dist/map.cjs.js +261 -150
- package/map/dist/map.cjs.js.map +1 -1
- package/map/dist/map.cjs.min.js +1 -1
- package/map/dist/map.cjs.min.js.map +1 -1
- package/map/dist/map.es.js +1 -1
- package/map/dist/map.es.js.map +1 -1
- package/map/package.json +0 -8
- package/package.json +3 -13
- package/services/dist/index.d.ts +119 -106
- package/services/dist/services.cjs.js +51 -1
- package/services/dist/services.cjs.js.map +1 -1
- package/services/dist/services.cjs.min.js +1 -1
- package/services/dist/services.cjs.min.js.map +1 -1
- package/services/dist/services.es.js +1 -1
- package/services/dist/services.es.js.map +1 -1
- package/services/package.json +0 -8
- package/sdk-examples-collage.png +0 -0
- package/tomtom-logo-big.svg +0 -6
package/map/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { BackgroundLayerSpecification } from 'maplibre-gl';
|
|
|
3
3
|
import { BBox } from 'geojson';
|
|
4
4
|
import { ChargingSpeed } from '../../../../core';
|
|
5
5
|
import { ChargingStop } from '../../../../core';
|
|
6
|
+
import { CircleLayerSpecification } from 'maplibre-gl';
|
|
6
7
|
import { CommonPlaceProps } from '../../../../core';
|
|
7
8
|
import { DataDrivenPropertyValueSpecification } from 'maplibre-gl';
|
|
8
9
|
import { DelayMagnitude } from '../../../../core';
|
|
@@ -951,6 +952,31 @@ export declare const buildPlaceTitle: (place: Place_2) => string;
|
|
|
951
952
|
*/
|
|
952
953
|
export declare const buildRoutingLayers: (config?: RoutingModuleConfig) => Required<RouteLayersConfig>;
|
|
953
954
|
|
|
955
|
+
/**
|
|
956
|
+
* Parameters to identify a feature by its ID or index in a given features array.
|
|
957
|
+
* @group User Events
|
|
958
|
+
*/
|
|
959
|
+
export declare type ByIdOrIndex = {
|
|
960
|
+
/**
|
|
961
|
+
* The unique identifier of the feature.
|
|
962
|
+
*
|
|
963
|
+
* @remarks
|
|
964
|
+
* This ID corresponds to the `id` property of the feature being targeted.
|
|
965
|
+
* Cannot be used together with `index`.
|
|
966
|
+
*/
|
|
967
|
+
id: string;
|
|
968
|
+
} | {
|
|
969
|
+
/**
|
|
970
|
+
* The index of the feature in the feature array.
|
|
971
|
+
*
|
|
972
|
+
* @remarks
|
|
973
|
+
* Zero-based index referring to the position in the features array
|
|
974
|
+
* that was passed to the module's show method.
|
|
975
|
+
* Cannot be used together with `id`.
|
|
976
|
+
*/
|
|
977
|
+
index: number;
|
|
978
|
+
};
|
|
979
|
+
|
|
954
980
|
/**
|
|
955
981
|
* Mapping of charging stop speeds to sprite image IDs.
|
|
956
982
|
* @group Routing
|
|
@@ -1058,7 +1084,7 @@ export declare type ChargingStopTextConfig = {
|
|
|
1058
1084
|
*
|
|
1059
1085
|
* @see https://maplibre.org/maplibre-style-spec/types/#formatted
|
|
1060
1086
|
*/
|
|
1061
|
-
title?:
|
|
1087
|
+
title?: DataDrivenPropertyValueSpecification<string>;
|
|
1062
1088
|
};
|
|
1063
1089
|
|
|
1064
1090
|
/**
|
|
@@ -1084,15 +1110,7 @@ export declare type ChargingStopTextConfig = {
|
|
|
1084
1110
|
*
|
|
1085
1111
|
* @group User Events
|
|
1086
1112
|
*/
|
|
1087
|
-
export declare type CleanEventStateOptions = {
|
|
1088
|
-
/**
|
|
1089
|
-
* The index of the feature in the feature array.
|
|
1090
|
-
*
|
|
1091
|
-
* @remarks
|
|
1092
|
-
* Zero-based index referring to the position in the features array
|
|
1093
|
-
* that was passed to the module's show method.
|
|
1094
|
-
*/
|
|
1095
|
-
index: number;
|
|
1113
|
+
export declare type CleanEventStateOptions = ByIdOrIndex & {
|
|
1096
1114
|
/**
|
|
1097
1115
|
* Whether to show the feature after cleaning the event state.
|
|
1098
1116
|
*
|
|
@@ -1822,30 +1840,22 @@ declare type DisplaySectionProps = SectionProps & DisplayRouteRelatedProps;
|
|
|
1822
1840
|
* };
|
|
1823
1841
|
* ```
|
|
1824
1842
|
*
|
|
1825
|
-
* @group Routing
|
|
1826
1843
|
* @ignore
|
|
1827
1844
|
*/
|
|
1828
1845
|
declare type DisplayTrafficSectionProps = DisplaySectionProps & TrafficSectionProps & {
|
|
1829
1846
|
/**
|
|
1830
|
-
* Icon ID for
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
*
|
|
1835
|
-
*
|
|
1836
|
-
* @example
|
|
1837
|
-
* ```typescript
|
|
1838
|
-
* iconID: 'traffic-jam'
|
|
1839
|
-
* iconID: 'accident'
|
|
1840
|
-
* iconID: 'road-closure'
|
|
1841
|
-
* ```
|
|
1847
|
+
* Icon ID for jam category, if any.
|
|
1848
|
+
*/
|
|
1849
|
+
jamIconID?: string;
|
|
1850
|
+
/**
|
|
1851
|
+
* Icon ID for the main cause of the incident, if any (roadworks, weather-related, accident...).
|
|
1842
1852
|
*/
|
|
1843
|
-
|
|
1853
|
+
causeIconID?: string;
|
|
1844
1854
|
/**
|
|
1845
1855
|
* Title for the traffic section.
|
|
1846
1856
|
*
|
|
1847
1857
|
* @remarks
|
|
1848
|
-
* By default consists of the incident delay if any, but can be
|
|
1858
|
+
* By default, consists of the incident delay if any, but can be
|
|
1849
1859
|
* customized to provide more detailed information.
|
|
1850
1860
|
*
|
|
1851
1861
|
* @example
|
|
@@ -2334,6 +2344,7 @@ export declare class GeoJSONSourceWithLayers<T extends FeatureCollection = Featu
|
|
|
2334
2344
|
constructor(map: Map_2, sourceId: string, layerSpecs: ToBeAddedLayerSpecWithoutSource[], addLayersToMap?: boolean);
|
|
2335
2345
|
show(featureCollection: T): void;
|
|
2336
2346
|
clear(): void;
|
|
2347
|
+
private findFeature;
|
|
2337
2348
|
putEventState(options: PutEventStateOptions): void;
|
|
2338
2349
|
cleanEventState(options: CleanEventStateOptions): void;
|
|
2339
2350
|
cleanEventStates(options?: CleanEventStatesOptions): void;
|
|
@@ -3039,10 +3050,9 @@ export declare type GeometryTextConfig = {
|
|
|
3039
3050
|
/**
|
|
3040
3051
|
* Gets the map style sprite image ID to display on the map for the give place.
|
|
3041
3052
|
* @param place The place to display.
|
|
3042
|
-
* @param map
|
|
3043
3053
|
* @param config
|
|
3044
3054
|
*/
|
|
3045
|
-
export declare const getIconIDForPlace: (place: Place_2, config?: PlacesModuleConfig
|
|
3055
|
+
export declare const getIconIDForPlace: (place: Place_2, config?: PlacesModuleConfig) => string;
|
|
3046
3056
|
|
|
3047
3057
|
/**
|
|
3048
3058
|
* Maps a Place category to the poi layer one, so the latter's style can apply it.
|
|
@@ -3057,6 +3067,11 @@ export declare const getPOILayerCategoryForPlace: (place: Place_2) => string | u
|
|
|
3057
3067
|
*/
|
|
3058
3068
|
export declare const getStyleCategories: (categories: FilterablePOICategory[]) => string[];
|
|
3059
3069
|
|
|
3070
|
+
/**
|
|
3071
|
+
* Configuration for adding custom layers to a map module based on its controlled source data.
|
|
3072
|
+
*
|
|
3073
|
+
* @group Shared
|
|
3074
|
+
*/
|
|
3060
3075
|
export declare type HasAdditionalLayersConfig = {
|
|
3061
3076
|
/**
|
|
3062
3077
|
* Additional custom layers to be added alongside the predefined ones.
|
|
@@ -3065,11 +3080,11 @@ export declare type HasAdditionalLayersConfig = {
|
|
|
3065
3080
|
* Allows for further customization by specifying extra layers that
|
|
3066
3081
|
* complement the standard route visualization layers.
|
|
3067
3082
|
*
|
|
3068
|
-
* Use these if you want to add extra visuals to a specific
|
|
3083
|
+
* Use these if you want to add extra visuals to a specific module part, be it lines, symbols, or any MapLibre supported layer.
|
|
3069
3084
|
*
|
|
3070
3085
|
* You can define 'beforeID' in the additional layers to place them under predefined ones (or other of your additional layers).
|
|
3071
3086
|
*/
|
|
3072
|
-
additional?: Record<string, ToBeAddedLayerSpecTemplate<LineLayerSpecification |
|
|
3087
|
+
additional?: Record<string, ToBeAddedLayerSpecTemplate<SymbolLayerSpecification | LineLayerSpecification | CircleLayerSpecification>>;
|
|
3073
3088
|
};
|
|
3074
3089
|
|
|
3075
3090
|
/**
|
|
@@ -3306,31 +3321,6 @@ declare type HillshadeSourcesWithLayers = {
|
|
|
3306
3321
|
*/
|
|
3307
3322
|
export declare type HoverEventType = 'hover' | 'long-hover';
|
|
3308
3323
|
|
|
3309
|
-
/**
|
|
3310
|
-
* Icon style options for displaying places on the map.
|
|
3311
|
-
*
|
|
3312
|
-
* @remarks
|
|
3313
|
-
* **Available Styles:**
|
|
3314
|
-
* - `pin`: Traditional map pin markers (teardrop shape)
|
|
3315
|
-
* - `circle`: Simple circular markers
|
|
3316
|
-
* - `poi-like`: Mimics the map's built-in POI layer style with category icons
|
|
3317
|
-
*
|
|
3318
|
-
* @example
|
|
3319
|
-
* ```typescript
|
|
3320
|
-
* // Use pin markers
|
|
3321
|
-
* const iconStyle: IconStyle = 'pin';
|
|
3322
|
-
*
|
|
3323
|
-
* // Use circles for minimal design
|
|
3324
|
-
* const iconStyle: IconStyle = 'circle';
|
|
3325
|
-
*
|
|
3326
|
-
* // Match map POI style
|
|
3327
|
-
* const iconStyle: IconStyle = 'poi-like';
|
|
3328
|
-
* ```
|
|
3329
|
-
*
|
|
3330
|
-
* @group Places
|
|
3331
|
-
*/
|
|
3332
|
-
export declare type IconStyle = 'pin' | 'circle' | 'poi-like';
|
|
3333
|
-
|
|
3334
3324
|
/**
|
|
3335
3325
|
* Available traffic incident category identifiers.
|
|
3336
3326
|
*
|
|
@@ -4052,7 +4042,7 @@ export declare type PlaceDisplayProps = {
|
|
|
4052
4042
|
*/
|
|
4053
4043
|
iconID: string;
|
|
4054
4044
|
/**
|
|
4055
|
-
* Map-style-compatible display category, mostly applicable for
|
|
4045
|
+
* Map-style-compatible display category, mostly applicable for base-map places.
|
|
4056
4046
|
*
|
|
4057
4047
|
* @remarks
|
|
4058
4048
|
* Used to match the place with a POI category in the map style, enabling
|
|
@@ -4065,7 +4055,7 @@ export declare type PlaceDisplayProps = {
|
|
|
4065
4055
|
* - PARKING_GARAGE
|
|
4066
4056
|
* - SHOPPING
|
|
4067
4057
|
*
|
|
4068
|
-
* Optional - only needed when using
|
|
4058
|
+
* Optional - only needed when using base-map styling or category-based filtering.
|
|
4069
4059
|
*
|
|
4070
4060
|
* @example
|
|
4071
4061
|
* ```typescript
|
|
@@ -4081,18 +4071,12 @@ export declare type PlaceDisplayProps = {
|
|
|
4081
4071
|
/**
|
|
4082
4072
|
* Configuration for place marker icons.
|
|
4083
4073
|
*
|
|
4084
|
-
* Controls the visual appearance of place markers including
|
|
4074
|
+
* Controls the visual appearance of place markers including custom icons.
|
|
4085
4075
|
*
|
|
4086
4076
|
* @example
|
|
4087
4077
|
* ```typescript
|
|
4088
|
-
* // Use pin style
|
|
4089
|
-
* const iconConfig: PlaceIconConfig = {
|
|
4090
|
-
* iconStyle: 'pin'
|
|
4091
|
-
* };
|
|
4092
|
-
*
|
|
4093
4078
|
* // Custom icons for specific categories
|
|
4094
4079
|
* const iconConfig: PlaceIconConfig = {
|
|
4095
|
-
* iconStyle: 'poi-like',
|
|
4096
4080
|
* customIcons: [
|
|
4097
4081
|
* { category: 'RESTAURANT', image: '/icons/food.png', pixelRatio: 2 },
|
|
4098
4082
|
* { category: 'HOTEL_MOTEL', image: '/icons/hotel.png', pixelRatio: 2 }
|
|
@@ -4103,12 +4087,6 @@ export declare type PlaceDisplayProps = {
|
|
|
4103
4087
|
* @group Places
|
|
4104
4088
|
*/
|
|
4105
4089
|
export declare type PlaceIconConfig = {
|
|
4106
|
-
/**
|
|
4107
|
-
* Base icon style for all places.
|
|
4108
|
-
*
|
|
4109
|
-
* @default 'pin'
|
|
4110
|
-
*/
|
|
4111
|
-
iconStyle?: IconStyle;
|
|
4112
4090
|
/**
|
|
4113
4091
|
* Array of custom icons for specific place categories.
|
|
4114
4092
|
*
|
|
@@ -4118,6 +4096,72 @@ export declare type PlaceIconConfig = {
|
|
|
4118
4096
|
customIcons?: CustomImage<MapStylePOICategory>[];
|
|
4119
4097
|
};
|
|
4120
4098
|
|
|
4099
|
+
/**
|
|
4100
|
+
* @group Places
|
|
4101
|
+
*/
|
|
4102
|
+
export declare type PlaceLayerName = keyof PlaceLayersConfig;
|
|
4103
|
+
|
|
4104
|
+
/**
|
|
4105
|
+
* Configuration for custom place layer styling with MapLibre specifications.
|
|
4106
|
+
*
|
|
4107
|
+
* @remarks
|
|
4108
|
+
* Provides fine-grained control over place marker layers, allowing customization
|
|
4109
|
+
* of both the main place markers and highlighted/selected place markers.
|
|
4110
|
+
*
|
|
4111
|
+
* The layer IDs are derived from the PlacesModule instance prefix plus the key suffix:
|
|
4112
|
+
* - `main`: The primary layer for displaying all places
|
|
4113
|
+
* - `selected`: The layer for displaying highlighted/clicked places (rendered on top)
|
|
4114
|
+
*
|
|
4115
|
+
* All fields are optional. When a field is not provided, the default styling will be used.
|
|
4116
|
+
*
|
|
4117
|
+
* @example
|
|
4118
|
+
* ```typescript
|
|
4119
|
+
* const config: PlacesModuleConfig = {
|
|
4120
|
+
* layers: {
|
|
4121
|
+
* main: {
|
|
4122
|
+
* layout: {
|
|
4123
|
+
* 'icon-size': 1.2,
|
|
4124
|
+
* 'text-size': 14
|
|
4125
|
+
* },
|
|
4126
|
+
* paint: {
|
|
4127
|
+
* 'text-color': '#333'
|
|
4128
|
+
* }
|
|
4129
|
+
* },
|
|
4130
|
+
* selected: {
|
|
4131
|
+
* layout: {
|
|
4132
|
+
* 'icon-size': 1.5,
|
|
4133
|
+
* 'text-allow-overlap': true
|
|
4134
|
+
* },
|
|
4135
|
+
* paint: {
|
|
4136
|
+
* 'text-color': '#3f9cd9'
|
|
4137
|
+
* }
|
|
4138
|
+
* }
|
|
4139
|
+
* }
|
|
4140
|
+
* };
|
|
4141
|
+
* ```
|
|
4142
|
+
*
|
|
4143
|
+
* @group Places
|
|
4144
|
+
*/
|
|
4145
|
+
export declare type PlaceLayersConfig = {
|
|
4146
|
+
/**
|
|
4147
|
+
* Main place marker layer specification.
|
|
4148
|
+
*
|
|
4149
|
+
* @remarks
|
|
4150
|
+
* Controls the visual appearance of all place markers on the map.
|
|
4151
|
+
* This layer renders places that are not in a highlighted/selected state.
|
|
4152
|
+
*/
|
|
4153
|
+
main?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
|
|
4154
|
+
/**
|
|
4155
|
+
* Selected/highlighted place marker layer specification.
|
|
4156
|
+
*
|
|
4157
|
+
* @remarks
|
|
4158
|
+
* Controls the visual appearance of places when they are highlighted or selected
|
|
4159
|
+
* (e.g., on hover or click events). This layer is rendered on top of the main layer
|
|
4160
|
+
* to ensure selected places are always visible.
|
|
4161
|
+
*/
|
|
4162
|
+
selected?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
|
|
4163
|
+
} & HasAdditionalLayersConfig;
|
|
4164
|
+
|
|
4121
4165
|
/**
|
|
4122
4166
|
* Source identifier prefix for places (geocoding results) features.
|
|
4123
4167
|
*
|
|
@@ -4148,7 +4192,7 @@ export declare const PLACES_SOURCE_PREFIX_ID = "places";
|
|
|
4148
4192
|
* **Marker Styles:**
|
|
4149
4193
|
* - `pin`: Traditional teardrop-shaped map pins
|
|
4150
4194
|
* - `circle`: Simple circular markers
|
|
4151
|
-
* - `
|
|
4195
|
+
* - `base-map`: Mimics built-in POI layer styling
|
|
4152
4196
|
*
|
|
4153
4197
|
* **Common Use Cases:**
|
|
4154
4198
|
* - Search result visualization
|
|
@@ -4161,16 +4205,17 @@ export declare const PLACES_SOURCE_PREFIX_ID = "places";
|
|
|
4161
4205
|
* ```typescript
|
|
4162
4206
|
* // Create places module with pin markers
|
|
4163
4207
|
* const places = await PlacesModule.get(map, {
|
|
4164
|
-
*
|
|
4165
|
-
*
|
|
4208
|
+
* icon: {
|
|
4209
|
+
* customIcons: []
|
|
4166
4210
|
* },
|
|
4167
|
-
*
|
|
4168
|
-
*
|
|
4169
|
-
* }
|
|
4211
|
+
* text: {
|
|
4212
|
+
* field: (place) => place.properties.poi?.name || 'Unknown'
|
|
4213
|
+
* },
|
|
4214
|
+
* theme: 'pin'
|
|
4170
4215
|
* });
|
|
4171
4216
|
*
|
|
4172
4217
|
* // Display places from search
|
|
4173
|
-
* await places.
|
|
4218
|
+
* await places.show(searchResults);
|
|
4174
4219
|
*
|
|
4175
4220
|
* // Handle clicks
|
|
4176
4221
|
* places.events.on('click', (feature) => {
|
|
@@ -4209,6 +4254,7 @@ export declare class PlacesModule extends AbstractMapModule<PlacesSourcesAndLaye
|
|
|
4209
4254
|
* @ignore
|
|
4210
4255
|
*/
|
|
4211
4256
|
protected _initSourcesWithLayers(config?: PlacesModuleConfig, restore?: boolean): PlacesSourcesAndLayers;
|
|
4257
|
+
private buildLayerSpecs;
|
|
4212
4258
|
/**
|
|
4213
4259
|
* @ignore
|
|
4214
4260
|
*/
|
|
@@ -4217,6 +4263,33 @@ export declare class PlacesModule extends AbstractMapModule<PlacesSourcesAndLaye
|
|
|
4217
4263
|
* @ignore
|
|
4218
4264
|
*/
|
|
4219
4265
|
protected restoreDataAndConfigImpl(): void;
|
|
4266
|
+
/**
|
|
4267
|
+
* Updates the visual theme for displayed places.
|
|
4268
|
+
*
|
|
4269
|
+
* @param theme - The theme style to apply to place markers.
|
|
4270
|
+
*
|
|
4271
|
+
* @remarks
|
|
4272
|
+
* **Available Themes:**
|
|
4273
|
+
* - `pin`: Traditional teardrop-shaped map pins
|
|
4274
|
+
* - `circle`: Simple circular markers
|
|
4275
|
+
* - `base-map`: Mimics the map's built-in POI layer style with category icons
|
|
4276
|
+
*
|
|
4277
|
+
* Changes apply immediately to all currently shown places. Other configuration
|
|
4278
|
+
* properties (icon config, text config) remain unchanged.
|
|
4279
|
+
*
|
|
4280
|
+
* @example
|
|
4281
|
+
* ```typescript
|
|
4282
|
+
* // Switch to pin markers
|
|
4283
|
+
* places.applyTheme('pin');
|
|
4284
|
+
*
|
|
4285
|
+
* // Use simple circles
|
|
4286
|
+
* places.applyTheme('circle');
|
|
4287
|
+
*
|
|
4288
|
+
* // Match map's POI style (ideal to blend in)
|
|
4289
|
+
* places.applyTheme('base-map');
|
|
4290
|
+
* ```
|
|
4291
|
+
*/
|
|
4292
|
+
applyTheme(theme: PlacesTheme): void;
|
|
4220
4293
|
/**
|
|
4221
4294
|
* Updates the icon configuration for displayed places.
|
|
4222
4295
|
*
|
|
@@ -4230,13 +4303,8 @@ export declare class PlacesModule extends AbstractMapModule<PlacesSourcesAndLaye
|
|
|
4230
4303
|
* @example
|
|
4231
4304
|
* ```typescript
|
|
4232
4305
|
* places.applyIconConfig({
|
|
4233
|
-
* iconStyle: 'circle'
|
|
4234
|
-
* });
|
|
4235
|
-
*
|
|
4236
|
-
* // Add custom icons
|
|
4237
|
-
* places.applyIconConfig({
|
|
4238
4306
|
* customIcons: [
|
|
4239
|
-
* { category: 'RESTAURANT', image: '/icons/food.png' }
|
|
4307
|
+
* { category: 'RESTAURANT', id: 'restaurant-icon', image: '/icons/food.png' }
|
|
4240
4308
|
* ]
|
|
4241
4309
|
* });
|
|
4242
4310
|
* ```
|
|
@@ -4254,18 +4322,19 @@ export declare class PlacesModule extends AbstractMapModule<PlacesSourcesAndLaye
|
|
|
4254
4322
|
* ```typescript
|
|
4255
4323
|
* // Use function
|
|
4256
4324
|
* places.applyTextConfig({
|
|
4257
|
-
*
|
|
4325
|
+
* field: (place) => place.properties.poi?.name || 'Unknown'
|
|
4258
4326
|
* });
|
|
4259
4327
|
*
|
|
4260
4328
|
* // Use MapLibre expression
|
|
4261
4329
|
* places.applyTextConfig({
|
|
4262
|
-
*
|
|
4263
|
-
*
|
|
4264
|
-
*
|
|
4330
|
+
* field: ['get', 'title'],
|
|
4331
|
+
* size: 14,
|
|
4332
|
+
* color: '#333'
|
|
4265
4333
|
* });
|
|
4266
4334
|
* ```
|
|
4267
4335
|
*/
|
|
4268
4336
|
applyTextConfig(textConfig: PlaceTextConfig): void;
|
|
4337
|
+
private applyConfigPart;
|
|
4269
4338
|
/**
|
|
4270
4339
|
* Applies additional feature properties to displayed places.
|
|
4271
4340
|
*
|
|
@@ -4410,29 +4479,29 @@ export declare class PlacesModule extends AbstractMapModule<PlacesSourcesAndLaye
|
|
|
4410
4479
|
* ```typescript
|
|
4411
4480
|
* // Basic configuration
|
|
4412
4481
|
* const config: PlacesModuleConfig = {
|
|
4413
|
-
*
|
|
4414
|
-
*
|
|
4482
|
+
* icon: {
|
|
4483
|
+
* style: 'pin'
|
|
4415
4484
|
* },
|
|
4416
|
-
*
|
|
4417
|
-
*
|
|
4418
|
-
*
|
|
4485
|
+
* text: {
|
|
4486
|
+
* field: (place) => place.properties.poi?.name || 'Unknown',
|
|
4487
|
+
* size: 12
|
|
4419
4488
|
* }
|
|
4420
4489
|
* };
|
|
4421
4490
|
*
|
|
4422
4491
|
* // Advanced configuration with custom properties
|
|
4423
4492
|
* const config: PlacesModuleConfig = {
|
|
4424
|
-
*
|
|
4425
|
-
*
|
|
4493
|
+
* icon: {
|
|
4494
|
+
* style: 'base-map',
|
|
4426
4495
|
* customIcons: [
|
|
4427
4496
|
* { category: 'RESTAURANT', image: '/icons/restaurant.png' }
|
|
4428
4497
|
* ]
|
|
4429
4498
|
* },
|
|
4430
|
-
*
|
|
4431
|
-
*
|
|
4432
|
-
*
|
|
4433
|
-
*
|
|
4434
|
-
*
|
|
4435
|
-
*
|
|
4499
|
+
* text: {
|
|
4500
|
+
* field: ['get', 'title'],
|
|
4501
|
+
* size: 14,
|
|
4502
|
+
* color: '#333',
|
|
4503
|
+
* haloColor: '#fff',
|
|
4504
|
+
* haloWidth: 2
|
|
4436
4505
|
* },
|
|
4437
4506
|
* extraFeatureProps: {
|
|
4438
4507
|
* category: (place) => place.properties.poi?.categories?.[0],
|
|
@@ -4444,18 +4513,38 @@ export declare class PlacesModule extends AbstractMapModule<PlacesSourcesAndLaye
|
|
|
4444
4513
|
* @group Places
|
|
4445
4514
|
*/
|
|
4446
4515
|
export declare type PlacesModuleConfig = {
|
|
4516
|
+
/**
|
|
4517
|
+
* Base style for all places.
|
|
4518
|
+
*
|
|
4519
|
+
* @remarks
|
|
4520
|
+
* Can be overwritten by more advanced icon configurations.
|
|
4521
|
+
*
|
|
4522
|
+
* @default 'pin'
|
|
4523
|
+
*/
|
|
4524
|
+
theme?: PlacesTheme;
|
|
4447
4525
|
/**
|
|
4448
4526
|
* Icon appearance configuration.
|
|
4449
4527
|
*
|
|
4450
4528
|
* Controls marker style and custom icons for different place categories.
|
|
4451
4529
|
*/
|
|
4452
|
-
|
|
4530
|
+
icon?: PlaceIconConfig;
|
|
4453
4531
|
/**
|
|
4454
4532
|
* Text label configuration.
|
|
4455
4533
|
*
|
|
4456
4534
|
* Controls label content, styling, and positioning.
|
|
4457
4535
|
*/
|
|
4458
|
-
|
|
4536
|
+
text?: PlaceTextConfig;
|
|
4537
|
+
/**
|
|
4538
|
+
* Custom layer styling configuration.
|
|
4539
|
+
*
|
|
4540
|
+
* @remarks
|
|
4541
|
+
* * Overrides the default layer styling with custom specifications.
|
|
4542
|
+
* * You must provide complete layer specifications for any layers you wish to customize.
|
|
4543
|
+
* * You can still reuse the default configurations if you want incremental changes. See: buildPlacesLayerSpecs.
|
|
4544
|
+
* * Any layer not specified will continue to use its default styling.
|
|
4545
|
+
* * Use this only if you need fine MapLibre control on how places are displayed.
|
|
4546
|
+
*/
|
|
4547
|
+
layers?: PlaceLayersConfig;
|
|
4459
4548
|
/**
|
|
4460
4549
|
* Additional properties to compute for each place feature.
|
|
4461
4550
|
*
|
|
@@ -4499,6 +4588,19 @@ declare type PlacesSourcesAndLayers = {
|
|
|
4499
4588
|
places: GeoJSONSourceWithLayers<Places<DisplayPlaceProps>>;
|
|
4500
4589
|
};
|
|
4501
4590
|
|
|
4591
|
+
/**
|
|
4592
|
+
* Icon style options for displaying places on the map.
|
|
4593
|
+
*
|
|
4594
|
+
* @remarks
|
|
4595
|
+
* **Available Styles:**
|
|
4596
|
+
* - `pin`: Traditional map pin markers (teardrop shape)
|
|
4597
|
+
* - `circle`: Simple circular markers
|
|
4598
|
+
* - `base-map`: Mimics the map's built-in POI layer style with category icons
|
|
4599
|
+
*
|
|
4600
|
+
* @group Places
|
|
4601
|
+
*/
|
|
4602
|
+
export declare type PlacesTheme = 'pin' | 'circle' | 'base-map';
|
|
4603
|
+
|
|
4502
4604
|
/**
|
|
4503
4605
|
* Configuration for place text labels.
|
|
4504
4606
|
*
|
|
@@ -4513,16 +4615,16 @@ declare type PlacesSourcesAndLayers = {
|
|
|
4513
4615
|
* ```typescript
|
|
4514
4616
|
* // Simple text from place name
|
|
4515
4617
|
* const textConfig: PlaceTextConfig = {
|
|
4516
|
-
*
|
|
4618
|
+
* field: (place) => place.properties.poi?.name || place.properties.address.freeformAddress
|
|
4517
4619
|
* };
|
|
4518
4620
|
*
|
|
4519
4621
|
* // Using MapLibre expression with styling
|
|
4520
4622
|
* const textConfig: PlaceTextConfig = {
|
|
4521
|
-
*
|
|
4522
|
-
*
|
|
4523
|
-
*
|
|
4524
|
-
*
|
|
4525
|
-
*
|
|
4623
|
+
* field: ['get', 'title'],
|
|
4624
|
+
* size: 14,
|
|
4625
|
+
* color: '#333',
|
|
4626
|
+
* haloColor: '#fff',
|
|
4627
|
+
* haloWidth: 2
|
|
4526
4628
|
* };
|
|
4527
4629
|
* ```
|
|
4528
4630
|
*
|
|
@@ -4532,24 +4634,24 @@ export declare type PlaceTextConfig = {
|
|
|
4532
4634
|
/**
|
|
4533
4635
|
* Text content for the label.
|
|
4534
4636
|
*
|
|
4535
|
-
* Can be a function that extracts text from the place properties,
|
|
4536
|
-
* or a MapLibre expression for data-driven content.
|
|
4637
|
+
* Can be a function that extracts text from the place properties (data-based),
|
|
4638
|
+
* or a MapLibre expression for data-driven content (data-driven layer-based).
|
|
4537
4639
|
*
|
|
4538
4640
|
* @example
|
|
4539
4641
|
* ```typescript
|
|
4540
4642
|
* // Function
|
|
4541
|
-
*
|
|
4643
|
+
* title: (place) => place.properties.poi?.name || 'Unknown'
|
|
4542
4644
|
*
|
|
4543
4645
|
* // MapLibre expression
|
|
4544
|
-
*
|
|
4646
|
+
* title: ['get', 'title']
|
|
4545
4647
|
*
|
|
4546
4648
|
* // Conditional expression
|
|
4547
|
-
*
|
|
4649
|
+
* title: ['case', ['has', 'name'], ['get', 'name'], ['get', 'address']]
|
|
4548
4650
|
* ```
|
|
4549
4651
|
*
|
|
4550
4652
|
* @see https://maplibre.org/maplibre-style-spec/types/#formatted
|
|
4551
4653
|
*/
|
|
4552
|
-
|
|
4654
|
+
title?: ((place: Place) => string) | DataDrivenPropertyValueSpecification<string>;
|
|
4553
4655
|
/**
|
|
4554
4656
|
* Font size in pixels.
|
|
4555
4657
|
*
|
|
@@ -4557,13 +4659,13 @@ export declare type PlaceTextConfig = {
|
|
|
4557
4659
|
*
|
|
4558
4660
|
* @example
|
|
4559
4661
|
* ```typescript
|
|
4560
|
-
*
|
|
4662
|
+
* size: 14
|
|
4561
4663
|
*
|
|
4562
4664
|
* // Data-driven size based on importance
|
|
4563
|
-
*
|
|
4665
|
+
* size: ['interpolate', ['linear'], ['get', 'priority'], 1, 16, 10, 10]
|
|
4564
4666
|
* ```
|
|
4565
4667
|
*/
|
|
4566
|
-
|
|
4668
|
+
size?: DataDrivenPropertyValueSpecification<number>;
|
|
4567
4669
|
/**
|
|
4568
4670
|
* Text color.
|
|
4569
4671
|
*
|
|
@@ -4571,22 +4673,22 @@ export declare type PlaceTextConfig = {
|
|
|
4571
4673
|
*
|
|
4572
4674
|
* @example
|
|
4573
4675
|
* ```typescript
|
|
4574
|
-
*
|
|
4676
|
+
* color: '#333333'
|
|
4575
4677
|
*
|
|
4576
4678
|
* // Category-based colors
|
|
4577
|
-
*
|
|
4679
|
+
* color: ['match', ['get', 'category'], 'RESTAURANT', '#D32F2F', '#1976D2']
|
|
4578
4680
|
* ```
|
|
4579
4681
|
*/
|
|
4580
|
-
|
|
4682
|
+
color?: DataDrivenPropertyValueSpecification<string>;
|
|
4581
4683
|
/**
|
|
4582
4684
|
* Font face(s) to use for the text.
|
|
4583
4685
|
*
|
|
4584
4686
|
* @example
|
|
4585
4687
|
* ```typescript
|
|
4586
|
-
*
|
|
4688
|
+
* font: ['Open Sans Bold', 'Arial Unicode MS Bold']
|
|
4587
4689
|
* ```
|
|
4588
4690
|
*/
|
|
4589
|
-
|
|
4691
|
+
font?: DataDrivenPropertyValueSpecification<Array<MapFont>>;
|
|
4590
4692
|
/**
|
|
4591
4693
|
* Text halo (outline) color for better readability.
|
|
4592
4694
|
*
|
|
@@ -4594,10 +4696,10 @@ export declare type PlaceTextConfig = {
|
|
|
4594
4696
|
*
|
|
4595
4697
|
* @example
|
|
4596
4698
|
* ```typescript
|
|
4597
|
-
*
|
|
4699
|
+
* haloColor: '#fff'
|
|
4598
4700
|
* ```
|
|
4599
4701
|
*/
|
|
4600
|
-
|
|
4702
|
+
haloColor?: DataDrivenPropertyValueSpecification<string>;
|
|
4601
4703
|
/**
|
|
4602
4704
|
* Text halo (outline) width in pixels.
|
|
4603
4705
|
*
|
|
@@ -4605,10 +4707,10 @@ export declare type PlaceTextConfig = {
|
|
|
4605
4707
|
*
|
|
4606
4708
|
* @example
|
|
4607
4709
|
* ```typescript
|
|
4608
|
-
*
|
|
4710
|
+
* haloWidth: 2 // Thicker outline for better contrast
|
|
4609
4711
|
* ```
|
|
4610
4712
|
*/
|
|
4611
|
-
|
|
4713
|
+
haloWidth?: DataDrivenPropertyValueSpecification<number>;
|
|
4612
4714
|
/**
|
|
4613
4715
|
* Text offset from the icon in ems [x, y].
|
|
4614
4716
|
*
|
|
@@ -4618,12 +4720,12 @@ export declare type PlaceTextConfig = {
|
|
|
4618
4720
|
*
|
|
4619
4721
|
* @example
|
|
4620
4722
|
* ```typescript
|
|
4621
|
-
*
|
|
4723
|
+
* offset: [0, 1.5] // Position text below icon
|
|
4622
4724
|
*
|
|
4623
|
-
*
|
|
4725
|
+
* offset: [1, 0] // Position text to the right
|
|
4624
4726
|
* ```
|
|
4625
4727
|
*/
|
|
4626
|
-
|
|
4728
|
+
offset?: DataDrivenPropertyValueSpecification<[number, number]>;
|
|
4627
4729
|
};
|
|
4628
4730
|
|
|
4629
4731
|
/**
|
|
@@ -5269,15 +5371,7 @@ export declare const preparePlacesForDisplay: (placesInput: Place_2 | Place_2[]
|
|
|
5269
5371
|
*
|
|
5270
5372
|
* @group User Events
|
|
5271
5373
|
*/
|
|
5272
|
-
export declare type PutEventStateOptions = {
|
|
5273
|
-
/**
|
|
5274
|
-
* The index of the feature in the feature array.
|
|
5275
|
-
*
|
|
5276
|
-
* @remarks
|
|
5277
|
-
* Zero-based index referring to the position in the features array
|
|
5278
|
-
* that was passed to the module's show method.
|
|
5279
|
-
*/
|
|
5280
|
-
index: number;
|
|
5374
|
+
export declare type PutEventStateOptions = ByIdOrIndex & {
|
|
5281
5375
|
/**
|
|
5282
5376
|
* The event state to set.
|
|
5283
5377
|
*
|
|
@@ -5509,12 +5603,19 @@ export declare type RouteLayersConfig = {
|
|
|
5509
5603
|
*/
|
|
5510
5604
|
incident?: {
|
|
5511
5605
|
/**
|
|
5512
|
-
* Symbol layer used to mark the
|
|
5606
|
+
* Symbol layer used to mark the start of a jam on the route.
|
|
5513
5607
|
*
|
|
5514
5608
|
* @remarks
|
|
5515
|
-
*
|
|
5609
|
+
* Focuses on displaying jams with delays.
|
|
5516
5610
|
*/
|
|
5517
|
-
|
|
5611
|
+
routeIncidentJamSymbol?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
|
|
5612
|
+
/**
|
|
5613
|
+
* Symbol layer used to mark the cause of the start of an incident on the route.
|
|
5614
|
+
*
|
|
5615
|
+
* @remarks
|
|
5616
|
+
* Can display icons for accidents, roadworks, weather, or other incidents.
|
|
5617
|
+
*/
|
|
5618
|
+
routeIncidentCauseSymbol?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
|
|
5518
5619
|
/**
|
|
5519
5620
|
* Line layer used to draw the incident's background/highlight.
|
|
5520
5621
|
*
|
|
@@ -5529,13 +5630,6 @@ export declare type RouteLayersConfig = {
|
|
|
5529
5630
|
* Useful for indicating partial closures or advisory segments.
|
|
5530
5631
|
*/
|
|
5531
5632
|
routeIncidentDashedLine?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
|
|
5532
|
-
/**
|
|
5533
|
-
* Line layer used to apply pattern-based styling for incident segments.
|
|
5534
|
-
*
|
|
5535
|
-
* @remarks
|
|
5536
|
-
* Allows use of image patterns or custom line patterns for emphasis.
|
|
5537
|
-
*/
|
|
5538
|
-
routeIncidentPatternLine?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
|
|
5539
5633
|
} & HasAdditionalLayersConfig;
|
|
5540
5634
|
/**
|
|
5541
5635
|
* Toll road section layers.
|
|
@@ -6986,6 +7080,11 @@ export declare class TomTomMap {
|
|
|
6986
7080
|
* @see [User Events Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/user-events)
|
|
6987
7081
|
*/
|
|
6988
7082
|
constructor(mapLibreOptions: MapLibreOptions, mapParams?: Partial<TomTomMapParams>);
|
|
7083
|
+
private loadRTLTextPlugin;
|
|
7084
|
+
/**
|
|
7085
|
+
* Dynamically loads the MapLibre CSS stylesheet from CDN.
|
|
7086
|
+
*/
|
|
7087
|
+
private ensureMapLibreCSSLoaded;
|
|
6989
7088
|
/**
|
|
6990
7089
|
* Changes the map style dynamically without reloading the entire map.
|
|
6991
7090
|
*
|