@tomtom-org/maps-sdk 0.54.0 → 0.56.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.
@@ -1,5 +1,14 @@
1
- import { BackgroundLayerSpecification, CircleLayerSpecification, DataDrivenPropertyValueSpecification, ExpressionSpecification, GeoJSONSource, GeoJSONSourceSpecification, LayerSpecification, LineLayerSpecification, LngLat, Map, MapGeoJSONFeature, MapOptions, Source, SourceSpecification, StyleImageInterface, StyleImageMetadata, StyleSpecification, SymbolLayerSpecification } from "maplibre-gl";
2
- import { Anything, AreaAnalyticsMetricKey, AreaAnalyticsMetrics, BBox, ChargingSpeed, ChargingStop, CommonPlaceProps, DelayMagnitude, DisplayUnits, GetPositionEntryPointOption, GlobalConfig, Instruction, Language, POICategory, Place, Places, PolygonFeature, PolygonFeatures, Route, RouteProps, Routes, SectionProps, TrafficAreaAnalytics, TrafficIncident, TrafficIncidentBaseProperties, TrafficIncidentCategory, TrafficIncidentDetails, TrafficIncidentTimeValidity, TrafficSectionProps, Waypoint, WaypointLike, Waypoints } from "@tomtom-org/maps-sdk/core";
1
+ import { BackgroundLayerSpecification, CircleLayerSpecification, DataDrivenPropertyValueSpecification, ExpressionFilterSpecification, ExpressionSpecification, GeoJSONSource, GeoJSONSourceSpecification, LayerSpecification, LineLayerSpecification, LngLat, Map, MapGeoJSONFeature, MapOptions, Source, SourceSpecification, StyleImageInterface, StyleImageMetadata, StyleSpecification, SymbolLayerSpecification } from "maplibre-gl";
2
+ import { Anything, AreaAnalyticsMetricKey, AreaAnalyticsMetrics, BBox, ChargingSpeed, ChargingStop, ChargingStopProps, CommonPlaceProps, CountrySectionProps, DelayMagnitude, DisplayUnits, GetPositionEntryPointOption, GlobalConfig, Instruction, Language, POICategory, Place, Places, PolygonFeature, PolygonFeatures, Route, RouteProps, Routes, SectionProps, SectionType, TrafficAreaAnalytics, TrafficIncident, TrafficIncidentBaseProperties, TrafficIncidentCategory, TrafficIncidentDetails, TrafficIncidentTimeValidity, TrafficSectionProps, Waypoint, WaypointLike, Waypoints } from "@tomtom-org/maps-sdk/core";
3
+ //#region src/shared/types/style.d.ts
4
+ /**
5
+ * Indicator of a light or dark theme.
6
+ * * Can be used to classify a map style as light or dark, or to apply light or dark configurations to map modules if they support it.
7
+ *
8
+ * @group Map Style
9
+ */
10
+ type LightDark = 'light' | 'dark';
11
+ //#endregion
3
12
  //#region src/init/types/mapEventsConfig.d.ts
4
13
  /**
5
14
  * Configuration options for map user event handling.
@@ -192,15 +201,6 @@ type MapEventsConfig = EventHandlerCursorConfig & {
192
201
  longHoverDelayOnStillMapMS?: number;
193
202
  };
194
203
  //#endregion
195
- //#region src/shared/types/style.d.ts
196
- /**
197
- * Indicator of a light or dark theme.
198
- * * Can be used to classify a map style as light or dark, or to apply light or dark configurations to map modules if they support it.
199
- *
200
- * @group Map Style
201
- */
202
- type LightDark = 'light' | 'dark';
203
- //#endregion
204
204
  //#region src/init/types/mapInit.d.ts
205
205
  /**
206
206
  * Array of all available standard style identifiers.
@@ -342,9 +342,35 @@ export type StandardStyle = {
342
342
  version?: string;
343
343
  };
344
344
  /**
345
- * Configuration for a custom map style.
345
+ * Where a custom style comes from: a URL to fetch it from, or the specification itself. Exactly one.
346
+ *
347
+ * @example
348
+ * ```typescript
349
+ * const fromUrl: CustomStyleSource = { url: 'https://example.com/my-custom-style.json' };
350
+ *
351
+ * const fromJson: CustomStyleSource = {
352
+ * json: { version: 8, sources: { ... }, layers: [ ... ] },
353
+ * };
354
+ * ```
346
355
  *
347
- * Allows using your own map style either via URL or direct JSON specification.
356
+ * @group Map Style
357
+ */
358
+ export type CustomStyleSource = {
359
+ /**
360
+ * URL to a MapLibre/Mapbox style JSON, without an API key — the SDK adds the configured one.
361
+ */
362
+ url: string;
363
+ json?: never;
364
+ } | {
365
+ /**
366
+ * The complete style, as a
367
+ * [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/) object.
368
+ */
369
+ json: StyleSpecification;
370
+ url?: never;
371
+ };
372
+ /**
373
+ * Configuration for a custom map style.
348
374
  *
349
375
  * @remarks
350
376
  * Use custom styles for:
@@ -371,41 +397,7 @@ export type StandardStyle = {
371
397
  *
372
398
  * @group Map Style
373
399
  */
374
- export type CustomStyle = {
375
- /**
376
- * URL to a MapLibre/Mapbox style JSON.
377
- *
378
- * The URL should not include the API key - it will be automatically added.
379
- * Mutually exclusive with the `json` property.
380
- *
381
- * @example
382
- * ```typescript
383
- * url: 'https://api.tomtom.com/style/1/style/my-custom-style'
384
- * ```
385
- */
386
- url?: string;
387
- /**
388
- * Direct style specification as JSON.
389
- *
390
- * Provide the complete MapLibre Style Specification object.
391
- * Mutually exclusive with the `url` property.
392
- *
393
- * @see [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/)
394
- *
395
- * @example
396
- * ```typescript
397
- * json: {
398
- * version: 8,
399
- * sources: {
400
- * 'my-source': { type: 'vector', url: '...' }
401
- * },
402
- * layers: [
403
- * { id: 'background', type: 'background', paint: { 'background-color': '#f0f0f0' } }
404
- * ]
405
- * }
406
- * ```
407
- */
408
- json?: StyleSpecification;
400
+ export type CustomStyle = CustomStyleSource & {
409
401
  /**
410
402
  * Whether the style draws a light or a dark map.
411
403
  *
@@ -601,6 +593,20 @@ export type TomTomMapParams = Partial<GlobalConfig> & {
601
593
  */
602
594
  export type InternalTomTomMapParams = GlobalConfig & TomTomMapParams;
603
595
  //#endregion
596
+ //#region src/init/styleInputBuilder.d.ts
597
+ /**
598
+ * The version of the TomTom Orbis map styles the SDK loads when {@link StandardStyle.version} is not
599
+ * given. Everything in the SDK that relies on the structure of a standard style — the base-map
600
+ * layer groups, the styling knobs — is curated and verified against this version, so a bump here is
601
+ * a bump of those tables too.
602
+ *
603
+ * Exported so the tooling that curates against it — the style-fixture refresh script — reads the
604
+ * same value, rather than restating it.
605
+ *
606
+ * @ignore
607
+ */
608
+ export declare const DEFAULT_STYLE_VERSION = "0.6.0-0";
609
+ //#endregion
604
610
  //#region src/TomTomMap.d.ts
605
611
  /**
606
612
  * Handler interface for responding to map style changes.
@@ -668,6 +674,15 @@ export type StyleChangeHandler = {
668
674
  * @returns void or a Promise that resolves when reinitialization is complete
669
675
  */
670
676
  onStyleChanged?: (context: StyleChangeContext) => void | Promise<void>;
677
+ /**
678
+ * Where this handler runs relative to the others: lower values run first, equal values run in
679
+ * registration order. Defaults to `0`, which is also what the SDK's data and visibility modules
680
+ * use; the SDK's {@link StylingModule} runs at `100` so semantic styling always lands on top of
681
+ * whatever the modules restored.
682
+ *
683
+ * @default 0
684
+ */
685
+ priority?: number;
671
686
  };
672
687
  /**
673
688
  * What a {@link StyleChangeHandler} is told about the style switch it is reacting to.
@@ -3612,6 +3627,61 @@ export declare class CombinedEvents<T, CFG, TShown = never, WHERE_SCOPE = never>
3612
3627
  off(type: EventType | 'config-change' | 'shown-features'): void;
3613
3628
  }
3614
3629
  //#endregion
3630
+ //#region src/shared/layers/layerFilterComposer.d.ts
3631
+ /**
3632
+ * A rewrite of the filter a style gave one of its layers: the whole filter in, the whole filter out.
3633
+ * @ignore
3634
+ */
3635
+ export type LayerFilterTransform = (filter: unknown) => unknown;
3636
+ /**
3637
+ * The single owner of a style layer's `filter`.
3638
+ *
3639
+ * Several modules narrow the same layer: {@link POIsModule.filterCategories} adds a category clause
3640
+ * to the POI layer, and the styling knob `pois.zoomShift` rewrites the density term inside that same
3641
+ * layer's filter. Each rebuilding the filter from its own snapshot of the style means whichever
3642
+ * writes last drops the other's work, with nothing to show that it happened.
3643
+ *
3644
+ * So no module writes a style layer's filter itself. Each registers what it wants under a key of its
3645
+ * own, and the composer writes the one filter that carries all of it: the filter the style shipped,
3646
+ * run through every **transform**, then narrowed by every **clause**.
3647
+ *
3648
+ * The snapshot and the contributions belong to the style they were taken from, so both are dropped
3649
+ * when a new style arrives; every module re-registers what it still wants as it restores itself.
3650
+ *
3651
+ * @ignore
3652
+ */
3653
+ export declare class LayerFilterComposer {
3654
+ private readonly mapLibreMap;
3655
+ private readonly byLayer;
3656
+ private constructor();
3657
+ /**
3658
+ * The composer of this map, created on first use. One per map: it is the shared state the
3659
+ * contributors write through.
3660
+ */
3661
+ static for(tomtomMap: TomTomMap): LayerFilterComposer;
3662
+ /**
3663
+ * Registers a rewrite of the filter the style gave this layer, replacing the one this
3664
+ * contributor registered before. Pass `undefined` to withdraw it and leave the filter to
3665
+ * the other contributors.
3666
+ *
3667
+ * @param layerId - The style layer whose filter is rewritten.
3668
+ * @param contributor - A key unique to the contributor, e.g. `'styling.zoomShift'`.
3669
+ * @param transform - Receives the style's own filter, returns the filter to use instead.
3670
+ */
3671
+ setTransform(layerId: string, contributor: string, transform: LayerFilterTransform | undefined): void;
3672
+ /**
3673
+ * Registers a clause that narrows this layer further, `and`-ed with the style's own filter and
3674
+ * with every other contributor's clause. Pass `undefined` to withdraw it.
3675
+ *
3676
+ * @param layerId - The style layer to narrow.
3677
+ * @param contributor - A key unique to the contributor, e.g. `'pois.categories'`.
3678
+ * @param clause - The clause to add, in expression syntax.
3679
+ */
3680
+ setClause(layerId: string, contributor: string, clause: ExpressionFilterSpecification | undefined): void;
3681
+ private contribute;
3682
+ private apply;
3683
+ }
3684
+ //#endregion
3615
3685
  //#region src/shared/AbstractMapModule.d.ts
3616
3686
  /**
3617
3687
  * How a module builds user events over some of its sources.
@@ -3707,6 +3777,17 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
3707
3777
  * @ignore
3708
3778
  */
3709
3779
  protected readonly instanceIndex: number;
3780
+ /**
3781
+ * The map's single owner of a **style** layer's `filter`. Several modules narrow the same style
3782
+ * layer, so none of them calls `setFilter` on one directly: the composer is what keeps one from
3783
+ * dropping another's work, and what holds the filter the style itself shipped. A module may
3784
+ * still set the filter of a layer it added and owns alone.
3785
+ *
3786
+ * Assigned in this constructor, which already runs `_initSourcesWithLayers` and `applyConfig`,
3787
+ * so a subclass field would be assigned too late for either to use it.
3788
+ * @ignore
3789
+ */
3790
+ protected readonly filterComposer: LayerFilterComposer;
3710
3791
  /**
3711
3792
  * Per-concrete-class instance counter. WeakMap-keyed so unloaded classes can be GC'd.
3712
3793
  * @ignore
@@ -3725,6 +3806,14 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
3725
3806
  * @param config Optional configuration to initialize directly as soon as the map is ready.
3726
3807
  */
3727
3808
  protected constructor(tomtomMap: TomTomMap, config?: CFG);
3809
+ /**
3810
+ * Where this module restores itself in the style-change sequence (see
3811
+ * {@link StyleChangeHandler.priority}). Data and visibility modules keep the default; a module
3812
+ * whose work must land on top of theirs returns a higher value.
3813
+ * @protected
3814
+ * @ignore
3815
+ */
3816
+ protected styleChangePriority(): number;
3728
3817
  /**
3729
3818
  * Initializes the sources with layers of this module.
3730
3819
  * @param config The optional configuration for the module.
@@ -3996,6 +4085,108 @@ export declare abstract class AbstractDataOwnedMapModule<SOURCES_WITH_LAYERS ext
3996
4085
  */
3997
4086
  export declare abstract class AbstractStyleOwnedMapModule<SOURCES_WITH_LAYERS extends StyleSourcesWithLayers, CFG extends MapModuleCommonConfig | undefined = undefined> extends AbstractMapModule<SOURCES_WITH_LAYERS, CFG> {}
3998
4087
  //#endregion
4088
+ //#region src/shared/knobs.d.ts
4089
+ /**
4090
+ * The kind of value a display knob takes.
4091
+ *
4092
+ * @remarks
4093
+ * One vocabulary for every knob catalogue in the SDK — map styling and any module that describes
4094
+ * its display as knobs draw from the same set, so an agent that learned one catalogue can read the
4095
+ * other.
4096
+ *
4097
+ * - `toggle`: `true`/`false`, e.g. whether an overlay is drawn.
4098
+ * - `factor`: a multiplier over what the style already does (`1` = unchanged).
4099
+ * - `number`: an absolute number with a range.
4100
+ * - `color`: a CSS colour string.
4101
+ * - `enum`: one of the knob's `options`.
4102
+ * - `colors`: a list of colours, each a CSS colour string or one of the knob's `options` — names
4103
+ * the module resolves to colours, such as styling knob ids. An empty list is the knob's default.
4104
+ * @group Shared
4105
+ */
4106
+ export type KnobKind = 'toggle' | 'factor' | 'number' | 'color' | 'enum' | 'colors';
4107
+ /**
4108
+ * Inclusive bounds for a `factor` or `number` knob. `step` is what a slider would use; some ranges
4109
+ * (e.g. opacity 0–1) have no natural step and omit it.
4110
+ *
4111
+ * @group Shared
4112
+ */
4113
+ export type KnobRange = {
4114
+ min: number;
4115
+ max: number;
4116
+ step?: number;
4117
+ };
4118
+ /**
4119
+ * A single, machine-readable description of one display knob.
4120
+ *
4121
+ * @remarks
4122
+ * The point of describing knobs as data is that a caller — increasingly a coding agent rather than
4123
+ * a person reading docs — can ask what a module actually exposes instead of guessing layer ids from
4124
+ * training data. Three things follow from having it:
4125
+ *
4126
+ * - **ground before generating** — write against what the module exposes, not what you remember;
4127
+ * - **validate** — ranges and allowed values arrive as data, so a bad value is caught before it
4128
+ * is rendered;
4129
+ * - **report and diff** — the paired settings object is plain and serializable, so a display change
4130
+ * is reviewable in a pull request.
4131
+ *
4132
+ * A visual editor cannot do any of those: it cannot be read, diffed, or put in a pull request.
4133
+ *
4134
+ * Modules narrow this shape with their own descriptor type — e.g. `StylingKnobDescriptor` requires
4135
+ * `available` and `appliesTo`, while a module whose knobs are always applicable omits them.
4136
+ *
4137
+ * @group Shared
4138
+ */
4139
+ export type KnobDescriptor<T = unknown> = {
4140
+ /**
4141
+ * Stable, dotted identifier, e.g. `labels.sizeFactor`. Treat these as public API: they are what
4142
+ * a caller stores, diffs and passes back.
4143
+ */
4144
+ id: string;
4145
+ /** What kind of value the knob takes. */
4146
+ kind: KnobKind;
4147
+ /** One-line description of what turning this knob does. */
4148
+ description: string;
4149
+ /** The value in force when nothing has been configured. */
4150
+ default: T;
4151
+ /** The value in force now. */
4152
+ current: T;
4153
+ /** Whether {@link KnobDescriptor.current} came from configuration rather than the default. */
4154
+ overridden: boolean;
4155
+ /** Inclusive bounds, for `factor` and `number` knobs. */
4156
+ range?: KnobRange;
4157
+ /** The allowed values, for `enum` knobs; the names accepted besides CSS colours, for `colors` knobs. */
4158
+ options?: readonly string[];
4159
+ /**
4160
+ * Whether the knob has anything to work on in the loaded style. Omitted by modules whose knobs
4161
+ * are always applicable; set to `false` by modules where a knob can be present in the catalogue
4162
+ * but do nothing on the current style.
4163
+ */
4164
+ available?: boolean;
4165
+ /**
4166
+ * Which styles or contexts the knob works in. A string rather than a fixed union so each
4167
+ * module can choose its own vocabulary — styling uses `'any-style' | 'tomtom-styles'`.
4168
+ */
4169
+ appliesTo?: string;
4170
+ };
4171
+ /**
4172
+ * Builds one knob descriptor, working out `overridden` from whether a configured value was given.
4173
+ * Pass `available` / `appliesTo` / `range` / `options` through `extra` when the module uses them.
4174
+ * @ignore
4175
+ */
4176
+ export declare const knob: <T, ID extends string, KIND extends KnobKind, Extra extends object = Record<string, never>>(id: ID, kind: KIND, description: string, defaultValue: T, configured: T | undefined, extra?: Extra) => KnobDescriptor<T> & {
4177
+ id: ID;
4178
+ kind: KIND;
4179
+ } & Extra;
4180
+ /**
4181
+ * Reduces a knob catalogue to a plain, serializable object of the values in force.
4182
+ *
4183
+ * @remarks
4184
+ * Only knobs whose value was configured are included, so the result is a diff against the defaults
4185
+ * rather than a dump of everything — which is what makes it reviewable.
4186
+ * @ignore
4187
+ */
4188
+ export declare const knobSettings: (knobs: KnobDescriptor[]) => Record<string, unknown>;
4189
+ //#endregion
3999
4190
  //#region src/shared/layers/commonLayerProps.d.ts
4000
4191
  /**
4001
4192
  * Bold font face used in the TomTom map style.
@@ -6533,7 +6724,7 @@ export type MapStylePOICategory = keyof typeof mapDisplayPoiCategoryMappings;
6533
6724
  /**
6534
6725
  * @ignore
6535
6726
  */
6536
- export declare const toBaseMapPOICategory: (category: POICategory) => string;
6727
+ export declare const toBaseMapPOICategory: (category: POICategory) => string | undefined;
6537
6728
  /**
6538
6729
  * The deduplicated set of base-map POI categories — the right-hand side of
6539
6730
  * {@link completeMapDisplayPoiCategoryMappings}. Each value names the
@@ -7300,7 +7491,7 @@ type PlaceConnectionsConfig = {
7300
7491
  *
7301
7492
  * @group Places
7302
7493
  */
7303
- type PlacesModuleConfig = MapModuleCommonConfig & {
7494
+ type PlacesModuleConfig<P extends CommonPlaceProps = CommonPlaceProps> = MapModuleCommonConfig & {
7304
7495
  /**
7305
7496
  * Base style for all places.
7306
7497
  *
@@ -7383,10 +7574,26 @@ type PlacesModuleConfig = MapModuleCommonConfig & {
7383
7574
  * }
7384
7575
  * ```
7385
7576
  */
7386
- extraFeatureProps?: {
7387
- [key: string]: ((place: Place) => any) | any;
7388
- };
7577
+ extraFeatureProps?: Record<string, ExtraFeatureProp<P>>;
7578
+ };
7579
+ /**
7580
+ * A value a GeoJSON feature property can hold.
7581
+ *
7582
+ * @group Places
7583
+ */
7584
+ type FeaturePropValue = string | number | boolean | null | undefined | FeaturePropValue[] | {
7585
+ [key: string]: FeaturePropValue;
7389
7586
  };
7587
+ /**
7588
+ * An entry of {@link PlacesModuleConfig.extraFeatureProps}: a fixed value written onto every place
7589
+ * feature, or a function computing one per place.
7590
+ *
7591
+ * @typeParam P - The place properties the callbacks receive. Name it on the config
7592
+ * (`PlacesModuleConfig<MyPlaceProps>`) to have callbacks typed for the places you show.
7593
+ *
7594
+ * @group Places
7595
+ */
7596
+ type ExtraFeatureProp<P extends CommonPlaceProps = CommonPlaceProps> = FeaturePropValue | ((place: Place<P>) => FeaturePropValue);
7390
7597
  //#endregion
7391
7598
  //#region src/places/utils/prepareConnectionsForDisplay.d.ts
7392
7599
  /**
@@ -7455,89 +7662,6 @@ export type PlacesEvents = CombinedEvents<MapGeoJSONFeature, PlacesModuleConfig,
7455
7662
  /** The lines and labels connecting places to their parent, when connections are shown. */
7456
7663
  connections: UserEvents<MapGeoJSONFeature>;
7457
7664
  };
7458
- /**
7459
- * Map module for displaying and managing place markers.
7460
- *
7461
- * The PlacesModule provides functionality to display location markers (pins) on the map
7462
- * for points of interest, search results, or custom locations. It supports various marker
7463
- * styles, custom icons, text labels, and interactive events.
7464
- *
7465
- * @remarks
7466
- * **Features:**
7467
- * - Multiple marker styles (pin, circle-icon, base-map POI-like)
7468
- * - Custom icons per POI category
7469
- * - Text labels with styling options
7470
- * - Data-driven styling via MapLibre expressions
7471
- * - Interactive events (click, hover, etc.)
7472
- * - Support for custom feature properties
7473
- * - EV charging station availability display (opt-in)
7474
- *
7475
- * **Marker Styles:**
7476
- * - `pin`: Traditional teardrop-shaped map pins
7477
- * - `circle-icon`: Simple circular markers (previously named `circle`)
7478
- * - `base-map`: Mimics the map's built-in POI layer styling (combines `main`, `selected`, and `micro` layers). For micro-only rendering, hide the `main` layer via `layers.main.layout.visibility = 'none'`.
7479
- *
7480
- * **EV Charging Station Availability:**
7481
- * When displaying EV charging stations with availability data from
7482
- * {@link getPlacesWithEVAvailability}, the module can:
7483
- * - Show available/total charging points (e.g., "3/10")
7484
- * - Color-code availability (green = good, orange = limited, red = none/low)
7485
- * - Display as formatted text within the station's label
7486
- *
7487
- * This feature is disabled by default. To enable it, set `evAvailability.enabled` to `true`
7488
- * in the configuration.
7489
- *
7490
- * **Common Use Cases:**
7491
- * - Search result visualization
7492
- * - Custom location markers
7493
- * - Store locators
7494
- * - EV charging station maps with real-time availability
7495
- * - Delivery/pickup points
7496
- * - Saved locations display
7497
- *
7498
- * @example
7499
- * ```typescript
7500
- * // Create places module with pin markers
7501
- * const placesModule = await PlacesModule.create(map, {
7502
- * icon: {
7503
- * categoryIcons: []
7504
- * },
7505
- * text: {
7506
- * field: (place) => place.properties.poi?.name || 'Unknown'
7507
- * },
7508
- * theme: 'pin'
7509
- * });
7510
- *
7511
- * // Display places from search
7512
- * await placesModule.show(searchResults);
7513
- *
7514
- * // EV Charging Stations - Opt-in to availability display
7515
- * const evStations = await PlacesModule.create(map, {
7516
- * evAvailability: { enabled: true }
7517
- * });
7518
- * const results = await search({ poiCategories: ['ELECTRIC_VEHICLE_STATION'] });
7519
- * evStations.show(await getPlacesWithEVAvailability(results)); // Shows availability
7520
- *
7521
- * // Granular control: Enable for searched stations only, background stations without
7522
- * const bgStations = await PlacesModule.create(map); // EV availability disabled
7523
- * const searched = await PlacesModule.create(map, {
7524
- * evAvailability: { enabled: true }
7525
- * });
7526
- *
7527
- * // Handle clicks
7528
- * placesModule.events.on('click', (feature) => {
7529
- * console.log('Clicked:', feature.properties);
7530
- * });
7531
- *
7532
- * placesModule.events.on('hover', (feature) => {
7533
- * showTooltip(feature.properties.poi?.name);
7534
- * });
7535
- * ```
7536
- *
7537
- * @see [Places Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/places)
7538
- *
7539
- * @group Places
7540
- */
7541
7665
  export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourcesAndLayers, PlacesModuleConfig> {
7542
7666
  private layerSpecs;
7543
7667
  private connectionLayerSpecs;
@@ -7560,7 +7684,7 @@ export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourc
7560
7684
  * @param config The module optional configuration
7561
7685
  * @returns {Promise} Returns a promise with a new instance of this module
7562
7686
  */
7563
- static create(tomtomMap: TomTomMap, config?: PlacesModuleConfig): Promise<PlacesModule>;
7687
+ static create<P extends CommonPlaceProps = CommonPlaceProps>(tomtomMap: TomTomMap, config?: PlacesModuleConfig<P>): Promise<PlacesModule>;
7564
7688
  private constructor();
7565
7689
  /**
7566
7690
  * @ignore
@@ -7671,9 +7795,7 @@ export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourc
7671
7795
  * });
7672
7796
  * ```
7673
7797
  */
7674
- applyExtraFeatureProps(extraFeatureProps: {
7675
- [key: string]: any;
7676
- }): void;
7798
+ applyExtraFeatureProps<P extends CommonPlaceProps = CommonPlaceProps>(extraFeatureProps: NonNullable<PlacesModuleConfig<P>['extraFeatureProps']>): void;
7677
7799
  private updateLayersAndData;
7678
7800
  private rebuildSourcesAndLayers;
7679
7801
  private updateConnectionLayersAndData;
@@ -8312,7 +8434,6 @@ type PoIsSourcesAndLayers = {
8312
8434
  */
8313
8435
  export declare class POIsModule extends AbstractStyleOwnedMapModule<PoIsSourcesAndLayers, POIsModuleConfig> {
8314
8436
  private categoriesFilter?;
8315
- private originalFilter?;
8316
8437
  /**
8317
8438
  * Retrieves a POIsModule instance for the given map.
8318
8439
  *
@@ -8504,93 +8625,368 @@ export declare class POIsModule extends AbstractStyleOwnedMapModule<PoIsSourcesA
8504
8625
  get events(): CombinedEvents<POIsModuleFeature, POIsModuleConfig, never>;
8505
8626
  }
8506
8627
  //#endregion
8507
- //#region src/routing/types/routeModuleConfig.d.ts
8628
+ //#region src/routing/layers/sectionRegistry.d.ts
8629
+ type UndrawnSectionType = 'country' | 'lanes' | 'leg' | 'roadShields' | 'toll';
8508
8630
  /**
8509
- * Detailed configuration for the visual appearance of route layers on the map with the MapLibre specification.
8631
+ * A section type the module draws, and therefore one the caller can configure.
8510
8632
  *
8511
8633
  * @remarks
8512
- * Provides fine-grained control over all route visualization layers, including
8513
- * main route lines, waypoints, route sections (ferry, tunnel, toll roads, etc.),
8514
- * turn-by-turn guidance instructions, and route summaries.
8634
+ * Every section type the API can return, less the ones nothing draws. Derived from the core
8635
+ * {@link SectionType} vocabulary, and {@link SECTION_REGISTRY} is keyed by it, so a section type
8636
+ * added to core has to be registered there or named undrawn above before this package compiles.
8515
8637
  *
8516
- * All fields are optional. When a field is not provided, the default styling will be used.
8638
+ * @group Routing
8639
+ */
8640
+ type DrawnSectionType = Exclude<SectionType, UndrawnSectionType>;
8641
+ /**
8642
+ * The section types whose layers are generated from {@link SECTION_REGISTRY}.
8643
+ *
8644
+ * @remarks
8645
+ * Plain line overlays over the route, one registration each. The remaining drawn types
8646
+ * ({@link bespokeSectionTypes}) carry type-specific icons or data-driven colours, so they keep
8647
+ * hand-written layers — but they take the same {@link SectionDisplayConfig} knobs.
8517
8648
  *
8518
8649
  * @group Routing
8519
8650
  */
8520
- type RouteLayersConfig = {
8521
- /**
8522
- * Main route line layer specifications.
8523
- *
8524
- * @remarks
8525
- * Defines the visual styling for the primary route path displayed on the map.
8526
- * Can include both line and symbol layers for enhanced visualization.
8527
- */
8528
- mainLines?: {
8529
- /**
8530
- * Styling for the primary, selected route line.
8531
- *
8532
- * @remarks
8533
- * Controls the visual appearance of the active route's line (color, width, dash pattern, etc.).
8534
- */
8535
- routeLine?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
8536
- /**
8537
- * Styling for the outline (stroke) around the primary route line.
8538
- *
8539
- * @remarks
8540
- * Typically used to create contrast between the route and map background.
8541
- */
8542
- routeOutline?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
8543
- /**
8544
- * Styling for the deselected (inactive) route line.
8545
- *
8546
- * @remarks
8547
- * Used when multiple routes are shown and some are visually de-emphasized.
8548
- */
8549
- routeDeselectedLine?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
8550
- /**
8551
- * Styling for the outline around the deselected route line.
8552
- *
8553
- * @remarks
8554
- * Matches `routeDeselectedLine` but provides an outer stroke for visibility.
8555
- */
8556
- routeDeselectedOutline?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
8557
- /**
8558
- * Symbol layer that renders directional arrows along the main route.
8559
- *
8560
- * @remarks
8561
- * Arrows can help indicate travel direction along routes with complex geometry.
8562
- */
8563
- routeLineArrows?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
8564
- } & HasAdditionalLayersConfig;
8565
- /**
8566
- * Waypoint layer specifications.
8567
- *
8568
- * @remarks
8569
- * Controls the appearance of waypoint icons (origin, destination, and intermediate stops)
8570
- * and their labels along the route.
8571
- */
8572
- waypoints?: {
8573
- /**
8574
- * Symbol layer for waypoint icons (origin, destination, stops).
8575
- *
8576
- * @remarks
8577
- * Customize icons, sizes, and placement for waypoints using this layer.
8578
- */
8579
- routeWaypointSymbol?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
8580
- /**
8581
- * Symbol layer for waypoint labels displayed next to waypoint icons.
8582
- *
8583
- * @remarks
8584
- * Controls label text, font, and offset for waypoint annotations.
8585
- */
8586
- routeWaypointLabel?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
8587
- } & HasAdditionalLayersConfig;
8588
- /**
8589
- * Electric vehicle charging station section layers.
8590
- *
8591
- * @remarks
8592
- * Marks charging stop locations along routes calculated for electric vehicles.
8593
- *
8651
+ export declare const generatedSectionTypes: readonly ["carpool", "carTrain", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "speedLimit", "tollVignette", "unpaved", "urban"];
8652
+ /**
8653
+ * The drawn section types whose layers are hand-written rather than generated.
8654
+ *
8655
+ * @group Routing
8656
+ */
8657
+ export declare const bespokeSectionTypes: readonly ["ferry", "tollRoad", "traffic", "tunnel", "vehicleRestricted"];
8658
+ /**
8659
+ * A section type whose layers are generated from the registry.
8660
+ * @group Routing
8661
+ */
8662
+ type GeneratedSectionType = (typeof generatedSectionTypes)[number];
8663
+ /**
8664
+ * A drawn section type with hand-written layers.
8665
+ * @group Routing
8666
+ */
8667
+ type BespokeSectionType = (typeof bespokeSectionTypes)[number];
8668
+ /**
8669
+ * Every drawn section type, generated ones first.
8670
+ * @group Routing
8671
+ */
8672
+ export declare const drawnSectionTypes: readonly ["carpool", "carTrain", "importantRoadStretch", "lowEmissionZone", "motorway", "pedestrian", "speedLimit", "tollVignette", "unpaved", "urban", "ferry", "tollRoad", "traffic", "tunnel", "vehicleRestricted"];
8673
+ /**
8674
+ * How a section's line relates to the route line it marks — both where it sits in the layer order
8675
+ * and how wide it is drawn, since neither reads as intended without the other.
8676
+ *
8677
+ * @remarks
8678
+ * - `halo`: beneath the route's own lines and wider than its outline, so the section shows as a
8679
+ * band hugging the route on both sides. The route keeps its own colour.
8680
+ * - `inline`: above the route line at the route's own width, so the route itself appears in the
8681
+ * section's colour along that stretch. This is how `tunnel` and `ferry` draw.
8682
+ *
8683
+ * Every section defaults to whichever of the two it has always been drawn as.
8684
+ *
8685
+ * @group Routing
8686
+ */
8687
+ type SectionDrawStyle = 'halo' | 'inline';
8688
+ /**
8689
+ * The line pattern of a section.
8690
+ * @group Routing
8691
+ */
8692
+ type SectionLinePattern = 'solid' | 'dashed' | 'dotted';
8693
+ /**
8694
+ * One of the uniform knobs {@link SectionDisplayConfig} offers.
8695
+ * @group Routing
8696
+ */
8697
+ type SectionKnobName = 'visible' | 'color' | 'opacity' | 'width' | 'style' | 'pattern' | 'icon' | 'sign';
8698
+ /**
8699
+ * The key one section type's source, events scope and `getShown()` entry are filed under.
8700
+ *
8701
+ * @remarks
8702
+ * `routing.events[sectionSourceKey('lowEmissionZone')]` and
8703
+ * `routing.getShown()[sectionSourceKey('tunnel')]` both reach the section named by the type.
8704
+ *
8705
+ * @group Routing
8706
+ */
8707
+ type SectionSourceKey<T extends DrawnSectionType = DrawnSectionType> = (typeof SECTION_REGISTRY)[T]['sourceKey'];
8708
+ /**
8709
+ * What every drawn section type is, and which knobs it answers to.
8710
+ *
8711
+ * @remarks
8712
+ * The single table the section tier is built from: the layer specs, the per-type sources, the
8713
+ * visibility rules and the knob catalogue all read it, so none of them can drift from the others.
8714
+ * @ignore
8715
+ */
8716
+ declare const SECTION_REGISTRY: {
8717
+ readonly carpool: {
8718
+ readonly sourceKey: "carpoolSections";
8719
+ readonly visible: false;
8720
+ readonly style: "halo";
8721
+ readonly pattern: "solid";
8722
+ readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
8723
+ };
8724
+ readonly carTrain: {
8725
+ readonly sourceKey: "carTrainSections";
8726
+ readonly visible: true;
8727
+ readonly style: "halo";
8728
+ readonly pattern: "dashed";
8729
+ readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
8730
+ };
8731
+ readonly importantRoadStretch: {
8732
+ readonly sourceKey: "importantRoadStretchSections";
8733
+ readonly visible: false;
8734
+ readonly style: "halo";
8735
+ readonly pattern: "solid";
8736
+ readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
8737
+ };
8738
+ readonly lowEmissionZone: {
8739
+ readonly sourceKey: "lowEmissionZoneSections";
8740
+ readonly visible: true;
8741
+ readonly style: "halo";
8742
+ readonly pattern: "solid";
8743
+ readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
8744
+ };
8745
+ readonly motorway: {
8746
+ readonly sourceKey: "motorwaySections";
8747
+ readonly visible: false;
8748
+ readonly style: "halo";
8749
+ readonly pattern: "solid";
8750
+ readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
8751
+ };
8752
+ readonly pedestrian: {
8753
+ readonly sourceKey: "pedestrianSections";
8754
+ readonly visible: false;
8755
+ readonly style: "halo";
8756
+ readonly pattern: "dashed";
8757
+ readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
8758
+ };
8759
+ readonly speedLimit: {
8760
+ readonly sourceKey: "speedLimitSections";
8761
+ readonly visible: true;
8762
+ readonly knobs: readonly ["visible", "sign"];
8763
+ };
8764
+ readonly tollVignette: {
8765
+ readonly sourceKey: "tollVignetteSections";
8766
+ readonly visible: true;
8767
+ readonly style: "halo";
8768
+ readonly pattern: "dashed";
8769
+ readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
8770
+ };
8771
+ readonly unpaved: {
8772
+ readonly sourceKey: "unpavedSections";
8773
+ readonly visible: false;
8774
+ readonly style: "halo";
8775
+ readonly pattern: "dashed";
8776
+ readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
8777
+ };
8778
+ readonly urban: {
8779
+ readonly sourceKey: "urbanSections";
8780
+ readonly visible: false;
8781
+ readonly style: "halo";
8782
+ readonly pattern: "solid";
8783
+ readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
8784
+ };
8785
+ readonly ferry: {
8786
+ readonly sourceKey: "ferries";
8787
+ readonly visible: true;
8788
+ readonly style: "inline";
8789
+ readonly pattern: "solid";
8790
+ readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
8791
+ };
8792
+ readonly tollRoad: {
8793
+ readonly sourceKey: "tollRoads";
8794
+ readonly visible: true;
8795
+ readonly style: "halo";
8796
+ readonly pattern: "solid";
8797
+ readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
8798
+ };
8799
+ readonly traffic: {
8800
+ readonly sourceKey: "incidents";
8801
+ readonly visible: true;
8802
+ readonly style: "inline";
8803
+ readonly pattern: "solid";
8804
+ readonly knobs: readonly ["visible", "opacity", "width", "style"];
8805
+ };
8806
+ readonly tunnel: {
8807
+ readonly sourceKey: "tunnels";
8808
+ readonly visible: true;
8809
+ readonly style: "inline";
8810
+ readonly pattern: "solid";
8811
+ readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
8812
+ };
8813
+ readonly vehicleRestricted: {
8814
+ readonly sourceKey: "vehicleRestricted";
8815
+ readonly visible: true;
8816
+ readonly style: "inline";
8817
+ readonly pattern: "dotted";
8818
+ readonly knobs: readonly ["visible", "color", "opacity", "width", "style", "pattern", "icon"];
8819
+ };
8820
+ };
8821
+ /**
8822
+ * The knobs one section type answers to.
8823
+ *
8824
+ * @remarks
8825
+ * Read off {@link SECTION_REGISTRY}, so `sections.traffic.color` is a compile error rather than a
8826
+ * setting that draws nothing: `traffic` colours its line by `magnitudeOfDelay`.
8827
+ *
8828
+ * @group Routing
8829
+ */
8830
+ type SectionKnobOf<T extends DrawnSectionType = DrawnSectionType> = (typeof SECTION_REGISTRY)[T]['knobs'][number];
8831
+ /**
8832
+ * Whether the given type answers to the given knob.
8833
+ *
8834
+ * @remarks
8835
+ * What a panel of section controls asks to decide which controls to render — the type system says
8836
+ * the same thing through {@link SectionKnobOf}, but only a value can be looped over.
8837
+ *
8838
+ * @example
8839
+ * ```typescript
8840
+ * for (const knobName of ['color', 'opacity', 'pattern'] as const) {
8841
+ * if (sectionSupportsKnob(type, knobName)) renderControl(type, knobName);
8842
+ * }
8843
+ * ```
8844
+ *
8845
+ * @group Routing
8846
+ */
8847
+ export declare const sectionSupportsKnob: (type: DrawnSectionType, knobName: SectionKnobName) => boolean;
8848
+ /**
8849
+ * Whether the given type draws itself when `sections` says nothing about it.
8850
+ *
8851
+ * @remarks
8852
+ * The answer a panel of section controls needs to show which switches start on. Asking the map
8853
+ * instead cannot answer it: a type draws no layer for a route carrying none of its sections, so an
8854
+ * absent layer reads the same as a type switched off.
8855
+ *
8856
+ * @example
8857
+ * ```typescript
8858
+ * const [drawn, optIn] = partition(drawnSectionTypes, sectionDrawsByDefault);
8859
+ * ```
8860
+ *
8861
+ * @group Routing
8862
+ */
8863
+ export declare const sectionDrawsByDefault: (type: DrawnSectionType) => boolean;
8864
+ /**
8865
+ * The key the given section type's source, events scope and `getShown()` entry are filed under.
8866
+ *
8867
+ * @example
8868
+ * ```typescript
8869
+ * routing.events[sectionSourceKey('lowEmissionZone')].on('click', (section) => { … });
8870
+ * const tunnels = routing.getShown()[sectionSourceKey('tunnel')];
8871
+ * ```
8872
+ *
8873
+ * @group Routing
8874
+ */
8875
+ export declare const sectionSourceKey: <T extends DrawnSectionType>(type: T) => SectionSourceKey<T>;
8876
+ //#endregion
8877
+ //#region src/routing/types/routeModuleConfig.d.ts
8878
+ /**
8879
+ * The MapLibre layer id of a generated section's line layer.
8880
+ *
8881
+ * @remarks
8882
+ * Derived from the section type, so `motorway` is drawn by `routeSectionMotorwayLine`.
8883
+ * @group Routing
8884
+ */
8885
+ type SectionLineLayerName<T extends GeneratedSectionType = GeneratedSectionType> = `routeSection${Capitalize<T>}Line`;
8886
+ /**
8887
+ * The MapLibre layer id of a section's icon layer.
8888
+ *
8889
+ * @remarks
8890
+ * Added to a generated section as soon as `sections.<type>.icon` asks for one, so `motorway` draws
8891
+ * its icon through `routeSectionMotorwaySymbol`.
8892
+ * @group Routing
8893
+ */
8894
+ type SectionSymbolLayerName<T extends GeneratedSectionType = GeneratedSectionType> = `routeSection${Capitalize<T>}Symbol`;
8895
+ /**
8896
+ * The MapLibre layer id drawing the signs of one generated section type.
8897
+ *
8898
+ * @remarks
8899
+ * Present for the types that post their own value on a sign, so `speedLimit` draws its signs
8900
+ * through `routeSectionSpeedLimitSign`.
8901
+ * @group Routing
8902
+ */
8903
+ type SectionSignLayerName<T extends GeneratedSectionType = GeneratedSectionType> = `routeSection${Capitalize<T>}Sign`;
8904
+ /**
8905
+ * Detailed configuration for the visual appearance of route layers on the map with the MapLibre specification.
8906
+ *
8907
+ * @remarks
8908
+ * Provides fine-grained control over all route visualization layers, including
8909
+ * main route lines, waypoints, route sections (ferry, tunnel, toll roads, etc.),
8910
+ * turn-by-turn guidance instructions, and route summaries.
8911
+ *
8912
+ * All fields are optional. When a field is not provided, the default styling will be used.
8913
+ *
8914
+ * @group Routing
8915
+ */
8916
+ type RouteLayersConfig = {
8917
+ /**
8918
+ * Main route line layer specifications.
8919
+ *
8920
+ * @remarks
8921
+ * Defines the visual styling for the primary route path displayed on the map.
8922
+ * Can include both line and symbol layers for enhanced visualization.
8923
+ */
8924
+ mainLines?: {
8925
+ /**
8926
+ * Styling for the primary, selected route line.
8927
+ *
8928
+ * @remarks
8929
+ * Controls the visual appearance of the active route's line (color, width, dash pattern, etc.).
8930
+ */
8931
+ routeLine?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
8932
+ /**
8933
+ * Styling for the outline (stroke) around the primary route line.
8934
+ *
8935
+ * @remarks
8936
+ * Typically used to create contrast between the route and map background.
8937
+ */
8938
+ routeOutline?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
8939
+ /**
8940
+ * Styling for the deselected (inactive) route line.
8941
+ *
8942
+ * @remarks
8943
+ * Used when multiple routes are shown and some are visually de-emphasized.
8944
+ */
8945
+ routeDeselectedLine?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
8946
+ /**
8947
+ * Styling for the outline around the deselected route line.
8948
+ *
8949
+ * @remarks
8950
+ * Matches `routeDeselectedLine` but provides an outer stroke for visibility.
8951
+ */
8952
+ routeDeselectedOutline?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
8953
+ /**
8954
+ * Symbol layer that renders directional arrows along the main route.
8955
+ *
8956
+ * @remarks
8957
+ * Arrows can help indicate travel direction along routes with complex geometry.
8958
+ */
8959
+ routeLineArrows?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
8960
+ } & HasAdditionalLayersConfig;
8961
+ /**
8962
+ * Waypoint layer specifications.
8963
+ *
8964
+ * @remarks
8965
+ * Controls the appearance of waypoint icons (origin, destination, and intermediate stops)
8966
+ * and their labels along the route.
8967
+ */
8968
+ waypoints?: {
8969
+ /**
8970
+ * Symbol layer for waypoint icons (origin, destination, stops).
8971
+ *
8972
+ * @remarks
8973
+ * Customize icons, sizes, and placement for waypoints using this layer.
8974
+ */
8975
+ routeWaypointSymbol?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
8976
+ /**
8977
+ * Symbol layer for waypoint labels displayed next to waypoint icons.
8978
+ *
8979
+ * @remarks
8980
+ * Controls label text, font, and offset for waypoint annotations.
8981
+ */
8982
+ routeWaypointLabel?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
8983
+ } & HasAdditionalLayersConfig;
8984
+ /**
8985
+ * Electric vehicle charging station section layers.
8986
+ *
8987
+ * @remarks
8988
+ * Marks charging stop locations along routes calculated for electric vehicles.
8989
+ *
8594
8990
  * Charging stops are individual points which are originally extracted from leg sections.
8595
8991
  */
8596
8992
  chargingStops?: {
@@ -8603,15 +8999,18 @@ type RouteLayersConfig = {
8603
8999
  routeChargingStopSymbol?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
8604
9000
  } & HasAdditionalLayersConfig;
8605
9001
  /**
8606
- * Layer specifications for specialized route sections.
9002
+ * Layer specifications for route sections, keyed by section type.
8607
9003
  *
8608
9004
  * @remarks
8609
- * Each section is a subset of the route path.
9005
+ * Each section is a subset of the route path, and every type the module draws has an entry
9006
+ * here — the same vocabulary as the semantic `sections` config, one tier down. This is the
9007
+ * escape hatch: use it when the knobs on `sections` are not enough and you need full MapLibre
9008
+ * control over the layers a section is drawn with.
8610
9009
  *
8611
- * Different types of road sections along the route can be styled individually
8612
- * to highlight specific characteristics or conditions.
9010
+ * The generated types carry a line layer, and an icon layer once `sections.<type>.icon` asks
9011
+ * for one. The remaining five draw themselves with the hand-written layers documented below.
8613
9012
  */
8614
- sections?: {
9013
+ sections?: { [T in GeneratedSectionType]?: { [K in SectionLineLayerName<T>]?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>; } & { [K in SectionSymbolLayerName<T>]?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>; } & { [K in SectionSignLayerName<T>]?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>; } & HasAdditionalLayersConfig; } & {
8615
9014
  /**
8616
9015
  * Ferry crossing section layers.
8617
9016
  *
@@ -8640,7 +9039,7 @@ type RouteLayersConfig = {
8640
9039
  * @remarks
8641
9040
  * Highlights route segments affected by traffic incidents or disruptions.
8642
9041
  */
8643
- incident?: {
9042
+ traffic?: {
8644
9043
  /**
8645
9044
  * Symbol layer used to mark the start of a jam on the route.
8646
9045
  *
@@ -8784,6 +9183,18 @@ type RouteLayersConfig = {
8784
9183
  */
8785
9184
  routeSummaryBubbleSymbol?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
8786
9185
  } & HasAdditionalLayersConfig;
9186
+ /**
9187
+ * Border crossing layers.
9188
+ *
9189
+ * @remarks
9190
+ * Anything {@link CountryCrossingConfig} cannot express about the plaque or its label.
9191
+ */
9192
+ countryCrossings?: {
9193
+ /**
9194
+ * Symbol layer writing each crossing's label on its plaque.
9195
+ */
9196
+ routeCountryCrossing?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
9197
+ } & HasAdditionalLayersConfig;
8787
9198
  };
8788
9199
  /**
8789
9200
  * Mapping of charging stop speeds to sprite image IDs.
@@ -9017,89 +9428,391 @@ type RouteTheme = {
9017
9428
  waypointSize?: RouteWaypointSize;
9018
9429
  };
9019
9430
  /**
9020
- * Configuration options for the routing module.
9431
+ * The icon drawn on a route section.
9021
9432
  *
9022
9433
  * @remarks
9023
- * Provides customization options for route visualization and behavior,
9024
- * including display units, waypoint handling, and layer styling.
9434
+ * Backed by a symbol layer over the section's own source: the generated section types get one
9435
+ * added, and the types that already draw an icon (`ferry`, `tollRoad`) have theirs replaced.
9025
9436
  *
9026
9437
  * @group Routing
9027
9438
  */
9028
- type RoutingModuleConfig = MapModuleCommonConfig & {
9439
+ type SectionIconConfig = {
9029
9440
  /**
9030
- * Units for displaying distances in route summaries and instructions.
9441
+ * The id of an image in the loaded style's sprite, e.g. `poi-toll_plaza`. An id the sprite does
9442
+ * not carry draws nothing.
9443
+ */
9444
+ image: string;
9445
+ /**
9446
+ * Where the icon sits on the section.
9031
9447
  *
9032
9448
  * @remarks
9033
- * Overrides the global configuration setting for display units.
9034
- * Affects distance values shown in route summaries and turn-by-turn instructions.
9035
- *
9036
- * Available options:
9037
- * - `metric` - Kilometers and meters
9038
- * - `imperial` - Miles and feet
9449
+ * - `center`: one icon at the middle of each section.
9450
+ * - `along`: icons repeated along the section.
9039
9451
  *
9040
- * @defaultValue `"metric"`
9452
+ * @defaultValue `"center"`
9041
9453
  */
9042
- displayUnits?: DisplayUnits;
9454
+ placement?: 'center' | 'along';
9043
9455
  /**
9044
- * Main styling configuration for the route visualization.
9456
+ * Icon scale, where `1` is the sprite image's own size.
9045
9457
  *
9046
- * @remarks
9047
- * * Provides high-level styling options that affect the overall appearance of the route,
9048
- * such as the primary color used for route lines and waypoints.
9049
- * * Can be overwritten by more specific layer styling configurations.
9458
+ * @defaultValue 1
9050
9459
  */
9051
- theme?: RouteTheme;
9460
+ size?: number;
9461
+ };
9462
+ type SectionKnobs = {
9052
9463
  /**
9053
- * Configuration for the waypoints source and layers to display them on the map.
9464
+ * Whether the section is drawn at all.
9054
9465
  *
9055
9466
  * @remarks
9056
- * Controls how waypoint source data and/or layer configs are processed to rendering them the map.
9467
+ * The default is per type, on one rule: a type draws itself when its stretches are sparse
9468
+ * along a route and consequential for the driver. `carTrain`, `ferry`, `lowEmissionZone`,
9469
+ * `tollRoad`, `tollVignette`, `traffic`, `tunnel` and `vehicleRestricted` do, until switched
9470
+ * off here, and so does `speedLimit`, which posts a sign per section rather than banding the
9471
+ * route. The rest wait to be asked — `motorway`, `urban` and `country` each run nearly a
9472
+ * route's whole length, so a band drawn for them buries the route line.
9057
9473
  */
9058
- waypoints?: WaypointsConfig;
9474
+ visible?: boolean;
9059
9475
  /**
9060
- * Configuration for the charging stops source and layers to display them on the map.
9061
- *
9062
- * @remarks
9063
- * Controls how charging stops source data and/or layer configs are processed to rendering them the map.
9476
+ * Line colour, as any CSS colour string. Each section type has its own default; on a type
9477
+ * drawn with more than one line, this sets the principal one and the rest are derived from it.
9064
9478
  */
9065
- chargingStops?: ChargingStopsConfig;
9479
+ color?: string;
9066
9480
  /**
9067
- * Configuration for the route summary bubbles displayed on the map.
9068
- *
9069
- * @remarks
9070
- * Summary bubbles show key route information (distance, duration, traffic delay)
9071
- * as visual overlays positioned along the route.
9481
+ * Line opacity, 0 to 1. Sections default to partial opacity so the route line stays readable
9482
+ * underneath.
9072
9483
  */
9073
- summaryBubbles?: {
9074
- /**
9075
- * Controls the visibility of route summary bubbles on the map.
9076
- *
9077
- * @defaultValue true
9078
- */
9079
- visible?: boolean;
9080
- };
9484
+ opacity?: number;
9081
9485
  /**
9082
- * Custom layer styling configuration.
9083
- *
9084
- * @remarks
9085
- * * Overrides the default layer styling with custom specifications.
9086
- * * You must provide complete layer specifications for any layers you wish to customize.
9087
- * * You can still reuse the default configurations if you want incremental changes. See: defaultRoutingLayers.
9088
- * * Any layer not specified will continue to use its default styling.
9089
- * * Use this only if you need fine MapLibre control on how some parts of the route are displayed.
9486
+ * Line width preset. Defaults to the route's own width.
9090
9487
  */
9091
- layers?: RouteLayersConfig;
9092
- };
9093
- //#endregion
9094
- //#region src/routing/layers/routingLayers.d.ts
9488
+ width?: RouteWidth;
9489
+ /**
9490
+ * Whether the section bands the route (`halo`) or stands in for the route line along its own
9491
+ * stretch (`inline`). This decides both where the section's line sits in the layer order and
9492
+ * how wide it is drawn. Each type defaults to the one it has always been drawn as.
9493
+ */
9494
+ style?: SectionDrawStyle;
9495
+ /**
9496
+ * Line pattern. Each type has its own default — the ones that mark a legal rather than a
9497
+ * physical property of the road are dashed, and `vehicleRestricted` is dotted.
9498
+ */
9499
+ pattern?: SectionLinePattern;
9500
+ /**
9501
+ * An icon drawn on the section. None of the generated types draws one by default.
9502
+ */
9503
+ icon?: SectionIconConfig;
9504
+ /**
9505
+ * The sign a section posts its own value on, for the one type whose information is a number
9506
+ * rather than a stretch: `speedLimit`.
9507
+ */
9508
+ sign?: SectionSignConfig;
9509
+ };
9510
+ /**
9511
+ * The unit a speed limit sign reads in.
9512
+ *
9513
+ * @group Routing
9514
+ */
9515
+ type SectionSignUnit = 'km/h' | 'mph';
9516
+ /**
9517
+ * Where a section's signs are posted along the stretch they belong to.
9518
+ *
9519
+ * @remarks
9520
+ * - `atChange`, the default — one sign where the value changes, and none after it, which is where
9521
+ * the road posts its own. Sections of a sign-posting type tile the route end to end and no two
9522
+ * consecutive ones carry the same value, so every section boundary is a change.
9523
+ * - `along` — the sign repeated down the stretch at a fixed screen spacing, so a reader zoomed into
9524
+ * the middle of a long one still sees the value in force. A stretch too short on screen to fit a
9525
+ * sign draws none.
9526
+ *
9527
+ * A stretch can run 50 km, so under `atChange` a reader zoomed in past its start sees no sign until
9528
+ * the next change — as on the road itself.
9529
+ *
9530
+ * @group Routing
9531
+ */
9532
+ type SectionSignPlacement = 'atChange' | 'along';
9533
+ /**
9534
+ * What a section's signs give way to when two symbols want the same spot.
9535
+ *
9536
+ * @remarks
9537
+ * MapLibre resolves symbol collisions from the topmost layer down, so the layer underneath is the
9538
+ * one that gives way.
9539
+ *
9540
+ * - `belowMapLabels` — the signs give way to everything, the base map's own labels included, so a
9541
+ * sign never lands on a street or place name, at the cost of showing fewer in a city. Cheap under
9542
+ * `along` placement, where the dropped sign is posted again further down the stretch.
9543
+ * - `belowRouteIcons` — the signs give way to the route's own icons, each of which says something
9544
+ * the road cannot, but take precedence over the base map's labels.
9545
+ * - `aboveRouteIcons` — the signs give way to nothing, for a map whose subject is the limits.
9546
+ *
9547
+ * @group Routing
9548
+ */
9549
+ type SectionSignPriority = 'belowMapLabels' | 'belowRouteIcons' | 'aboveRouteIcons';
9550
+ /**
9551
+ * The sign a section type posts its own value on.
9552
+ *
9553
+ * @remarks
9554
+ * `speedLimit` is the one type that takes this, and a sign is the whole of what it draws — there
9555
+ * is no line along the stretch, because a line would mark every stretch that carries a limit
9556
+ * without ever saying what the limit is. {@link SectionDisplayConfig.visible} switches the signs
9557
+ * themselves.
9558
+ *
9559
+ * The sign follows the road rather than the reader. Where the route also carries `country`
9560
+ * sections, each sign takes the face, the unit and the numeral colour of the country its stretch
9561
+ * runs through: the white disc most of Europe posts on, the yellow one Sweden, Finland and Iceland
9562
+ * use, the `SPEED LIMIT` plaque of the United States, and Japan's blue numerals. A country with no
9563
+ * entry posts the white disc in km/h.
9564
+ *
9565
+ * Where mph is posted the number is converted and rounded to the step signs come in. Without
9566
+ * `country` sections the display units decide the face and the unit, and an explicit {@link unit}
9567
+ * overrides both.
9568
+ *
9569
+ * A sign stands where the limit changes; {@link placement} repeats it down the stretch instead.
9570
+ * Signs scale with the zoom, as the ferry and toll-road icons do; {@link minzoom} decides how early
9571
+ * they appear at all.
9572
+ *
9573
+ * @group Routing
9574
+ */
9575
+ type SectionSignConfig = {
9576
+ /**
9577
+ * Where the signs are posted along the stretch.
9578
+ *
9579
+ * @defaultValue `'atChange'`, which is where the road posts its own.
9580
+ */
9581
+ placement?: SectionSignPlacement;
9582
+ /**
9583
+ * The lowest zoom the signs are drawn at.
9584
+ *
9585
+ * @defaultValue 10, where a sign is about a stretch of road a reader can see. Further out the
9586
+ * stretches fall in the same few pixels and the surviving signs are an arbitrary sample.
9587
+ */
9588
+ minzoom?: number;
9589
+ /**
9590
+ * What a sign gives way to when another symbol wants the same spot.
9591
+ *
9592
+ * @defaultValue follows {@link placement}: `'belowRouteIcons'` under `atChange`, where the sign
9593
+ * is the only one posting that change; `'belowMapLabels'` under `along`, where the next repeat
9594
+ * posts it again.
9595
+ */
9596
+ priority?: SectionSignPriority;
9597
+ /**
9598
+ * The unit every sign reads in, whatever the road posts.
9599
+ *
9600
+ * @remarks
9601
+ * Left out, each sign follows its own country, or the display units where the route carries no
9602
+ * `country` sections.
9603
+ */
9604
+ unit?: SectionSignUnit;
9605
+ };
9606
+ /**
9607
+ * How a border crossing's plaque is turned on the map.
9608
+ *
9609
+ * - `viewport` — level with the screen, however the map is rotated.
9610
+ * - `route` — turned to the route's bearing where it crosses, so the plaque runs along the road. It
9611
+ * is kept upright, so the label never reads upside down.
9612
+ *
9613
+ * @group Routing
9614
+ */
9615
+ type CountryCrossingAlignment = 'viewport' | 'route';
9616
+ /**
9617
+ * Appearance of the border crossings along a route.
9618
+ *
9619
+ * @remarks
9620
+ * A crossing is the seam between two consecutive `country` sections, so it is a point rather than a
9621
+ * stretch, and takes knobs of its own instead of a place in the section catalogue. Each is a plaque
9622
+ * naming both countries by their ISO 3166-1 alpha-2 codes in the direction of travel, `'ES → FR'`.
9623
+ *
9624
+ * The plaque follows the map's light/dark theme unless {@link color} or {@link textColor} says
9625
+ * otherwise, so it stays legible across a style change without being reconfigured.
9626
+ *
9627
+ * @example
9628
+ * ```typescript
9629
+ * const routes = await calculateRoute({ locations, sectionTypes: ['country'] });
9630
+ * await routing.showRoutes(routes);
9631
+ * ```
9632
+ *
9633
+ * @group Routing
9634
+ */
9635
+ type CountryCrossingConfig = {
9636
+ /**
9637
+ * Whether the crossings are drawn.
9638
+ *
9639
+ * @defaultValue `true`
9640
+ */
9641
+ visible?: boolean;
9642
+ /**
9643
+ * The lowest zoom a crossing is drawn at.
9644
+ *
9645
+ * @defaultValue 4, low enough for a continental route to show its borders while framed whole.
9646
+ */
9647
+ minzoom?: number;
9648
+ /**
9649
+ * The plaque colour behind the label.
9650
+ *
9651
+ * @defaultValue the SDK's near-black `'#1A2024'` on a light map, and the near-white `'#F1F3F5'`
9652
+ * on a dark one.
9653
+ */
9654
+ color?: string;
9655
+ /**
9656
+ * The label colour.
9657
+ *
9658
+ * @defaultValue whichever of the SDK's near-black and near-white reads on the plaque, so
9659
+ * setting {@link color} alone stays legible.
9660
+ */
9661
+ textColor?: string;
9662
+ /**
9663
+ * How the plaque is turned on the map.
9664
+ *
9665
+ * @defaultValue `'viewport'`
9666
+ */
9667
+ alignment?: CountryCrossingAlignment;
9668
+ };
9669
+ /**
9670
+ * Appearance of one route section type.
9671
+ *
9672
+ * @remarks
9673
+ * The semantic tier for sections: enough to draw, recolour, resize or mute any section type the
9674
+ * module draws, without writing a MapLibre layer spec — see {@link DrawnSectionType} for the
9675
+ * types, and `layers.sections` for anything these knobs cannot express.
9676
+ *
9677
+ * Which knobs a type takes is part of its type. `traffic` colours its line by `magnitudeOfDelay`
9678
+ * and takes its icons from the incident data, so `sections.traffic.color` does not compile rather
9679
+ * than compiling and drawing nothing. {@link sectionSupportsKnob} answers the same question at
9680
+ * runtime, for a UI that builds its controls from the type.
9681
+ *
9682
+ * @example
9683
+ * ```typescript
9684
+ * const config: RoutingModuleConfig = {
9685
+ * sections: {
9686
+ * // Opt in to two of the sections nothing draws by default:
9687
+ * urban: { visible: true },
9688
+ * lowEmissionZone: { visible: true, color: '#1B7A43', opacity: 0.8 },
9689
+ * // Restyle two that are drawn already:
9690
+ * tunnel: { color: '#402060', style: 'halo' },
9691
+ * tollRoad: { icon: { image: 'poi-toll_plaza', placement: 'along' } },
9692
+ * // And drop one:
9693
+ * traffic: { visible: false },
9694
+ * },
9695
+ * };
9696
+ * ```
9697
+ *
9698
+ * @group Routing
9699
+ */
9700
+ type SectionDisplayConfig<T extends DrawnSectionType = DrawnSectionType> = Pick<SectionKnobs, SectionKnobOf<T>>;
9701
+ /**
9702
+ * Appearance of every route section type, keyed by type.
9703
+ *
9704
+ * @group Routing
9705
+ */
9706
+ type SectionsDisplayConfig = { [T in DrawnSectionType]?: SectionDisplayConfig<T>; };
9707
+ /**
9708
+ * Configuration options for the routing module.
9709
+ *
9710
+ * @remarks
9711
+ * Provides customization options for route visualization and behavior,
9712
+ * including display units, waypoint handling, and layer styling.
9713
+ *
9714
+ * @group Routing
9715
+ */
9716
+ type RoutingModuleConfig = MapModuleCommonConfig & {
9717
+ /**
9718
+ * Units for displaying distances in route summaries and instructions.
9719
+ *
9720
+ * @remarks
9721
+ * Overrides the global configuration setting for display units.
9722
+ * Affects distance values shown in route summaries and turn-by-turn instructions.
9723
+ *
9724
+ * Available options:
9725
+ * - `metric` - Kilometers and meters
9726
+ * - `imperial` - Miles and feet
9727
+ *
9728
+ * @defaultValue `"metric"`
9729
+ */
9730
+ displayUnits?: DisplayUnits;
9731
+ /**
9732
+ * Main styling configuration for the route visualization.
9733
+ *
9734
+ * @remarks
9735
+ * * Provides high-level styling options that affect the overall appearance of the route,
9736
+ * such as the primary color used for route lines and waypoints.
9737
+ * * Can be overwritten by more specific layer styling configurations.
9738
+ */
9739
+ theme?: RouteTheme;
9740
+ /**
9741
+ * Configuration for the waypoints source and layers to display them on the map.
9742
+ *
9743
+ * @remarks
9744
+ * Controls how waypoint source data and/or layer configs are processed to rendering them the map.
9745
+ */
9746
+ waypoints?: WaypointsConfig;
9747
+ /**
9748
+ * Configuration for the charging stops source and layers to display them on the map.
9749
+ *
9750
+ * @remarks
9751
+ * Controls how charging stops source data and/or layer configs are processed to rendering them the map.
9752
+ */
9753
+ chargingStops?: ChargingStopsConfig;
9754
+ /**
9755
+ * Configuration for the route summary bubbles displayed on the map.
9756
+ *
9757
+ * @remarks
9758
+ * Summary bubbles show key route information (distance, duration, traffic delay)
9759
+ * as visual overlays positioned along the route.
9760
+ */
9761
+ summaryBubbles?: {
9762
+ /**
9763
+ * Controls the visibility of route summary bubbles on the map.
9764
+ *
9765
+ * @defaultValue true
9766
+ */
9767
+ visible?: boolean;
9768
+ };
9769
+ /**
9770
+ * Appearance of the border crossings along the route.
9771
+ *
9772
+ * @remarks
9773
+ * Read off the route's `country` sections, so a route carrying none draws none.
9774
+ */
9775
+ countryCrossings?: CountryCrossingConfig;
9776
+ /**
9777
+ * Appearance of the route sections, keyed by section type.
9778
+ *
9779
+ * @remarks
9780
+ * Covers every section type the module draws, on the same knobs: draw it or not, its colour,
9781
+ * opacity, width, whether it bands the route or stands in for its line, its line pattern and
9782
+ * its icon.
9783
+ *
9784
+ * The types whose stretches are sparse and consequential draw themselves — `carTrain`,
9785
+ * `ferry`, `lowEmissionZone`, `tollRoad`, `tollVignette`, `traffic`, `tunnel` and
9786
+ * `vehicleRestricted` — and switch off with `{ visible: false }`. The rest switch on with
9787
+ * `{ visible: true }`: a type covering most of a route buries the route line.
9788
+ *
9789
+ * `layers.sections` takes full MapLibre layer specs for the same types, for anything these
9790
+ * knobs cannot express.
9791
+ */
9792
+ sections?: SectionsDisplayConfig;
9793
+ /**
9794
+ * Custom layer styling configuration.
9795
+ *
9796
+ * @remarks
9797
+ * * Overrides the default layer styling with custom specifications.
9798
+ * * You must provide complete layer specifications for any layers you wish to customize.
9799
+ * * You can still reuse the default configurations if you want incremental changes. See: defaultRoutingLayers.
9800
+ * * Any layer not specified will continue to use its default styling.
9801
+ * * Use this only if you need fine MapLibre control on how some parts of the route are displayed.
9802
+ */
9803
+ layers?: RouteLayersConfig;
9804
+ };
9805
+ //#endregion
9806
+ //#region src/routing/layers/routingLayers.d.ts
9095
9807
  /**
9096
9808
  * Generates the routing layers configuration for route visualization on the map.
9097
9809
  * @param config - Optional routing module configuration to customize layer properties.
9098
9810
  * @param layerIDPrefix - Optional prefix to add to layer IDs for supporting multiple instances.
9099
9811
  * @param instanceIndex - Optional instance index for image ID suffixes.
9812
+ * @param lightDark - The map style's light/dark theme, which the country crossing plaque colours follow.
9100
9813
  * @ignore
9101
9814
  */
9102
- export declare const buildRoutingLayers: (config?: RoutingModuleConfig, layerIDPrefix?: string, instanceIndex?: number) => Required<RouteLayersConfig>;
9815
+ export declare const buildRoutingLayers: (config?: RoutingModuleConfig, layerIDPrefix?: string, instanceIndex?: number, lightDark?: LightDark) => Required<RouteLayersConfig>;
9103
9816
  /**
9104
9817
  * Default routing layers configuration. Calls routingLayers with no parameters.
9105
9818
  *
@@ -9196,10 +9909,14 @@ export declare const getLineOutlineWidth: (size?: RouteWidth) => ExpressionSpeci
9196
9909
  */
9197
9910
  export declare const getWaypointIconSize: (size?: RouteWaypointSize) => ExpressionSpecification;
9198
9911
  /**
9199
- * Returns the toll road outline width expression for the given size preset.
9912
+ * Returns the width expression of a section halo for the given size preset.
9913
+ *
9914
+ * @remarks
9915
+ * Wider than {@link getLineOutlineWidth} at every zoom, which is what makes a section drawn
9916
+ * beneath the route show as a band around it rather than disappear under the route's own outline.
9200
9917
  * @ignore
9201
9918
  */
9202
- export declare const getTollRoadOutlineWidth: (size?: RouteWidth) => ExpressionSpecification;
9919
+ export declare const getSectionHaloWidth: (size?: RouteWidth) => ExpressionSpecification;
9203
9920
  /**
9204
9921
  * Returns the instruction line width expression for the given size preset.
9205
9922
  * @ignore
@@ -9513,68 +10230,194 @@ type DisplayRouteSummary = Feature<Point, DisplayRouteSummaryProps>;
9513
10230
  * @group Routing
9514
10231
  */
9515
10232
  type DisplayRouteSummaries = FeatureCollection<Point, DisplayRouteSummaryProps>;
9516
- //#endregion
9517
- //#region src/routing/types/routeSections.d.ts
9518
10233
  /**
9519
- * Display-ready section properties combining base section data with route context.
9520
- *
9521
- * Extends section information with routing module display properties, allowing
9522
- * sections to be rendered with proper styling and route association.
9523
- *
9524
- * @remarks
9525
- * Used for rendering special route segments like ferry crossings, tolls, tunnels, etc.
9526
- *
9527
- * @example
9528
- * ```typescript
9529
- * const sectionProps: DisplaySectionProps = {
9530
- * ...sectionData,
9531
- * routeIndex: 0,
9532
- * routeState: 'selected'
9533
- * };
9534
- * ```
10234
+ * Display-ready props of one border crossing.
9535
10235
  *
9536
10236
  * @group Routing
9537
10237
  */
9538
- type DisplaySectionProps = SectionProps & DisplayRouteRelatedProps;
10238
+ type DisplayCountryCrossingProps = DisplayRouteRelatedProps & {
10239
+ /** ISO 3166-1 alpha-2 code of the country the route leaves. */
10240
+ fromCountryCode: string;
10241
+ /** ISO 3166-1 alpha-2 code of the country the route enters. */
10242
+ toCountryCode: string;
10243
+ /** The label the plaque is stretched around — `'ES → FR'`. */
10244
+ label: string;
10245
+ /**
10246
+ * Bearing of the route where it crosses, in degrees clockwise from north.
10247
+ *
10248
+ * @remarks
10249
+ * What `alignment: 'route'` turns the plaque by. Present whatever the alignment, so switching
10250
+ * it is a restyle rather than a re-derive.
10251
+ */
10252
+ bearing: number;
10253
+ /**
10254
+ * `startPointIndex` of the `country` section the route leaves, which identifies that section
10255
+ * on {@link RouteProps.sections} even when the route enters the same country twice.
10256
+ */
10257
+ fromSectionStartPointIndex: number;
10258
+ /** `startPointIndex` of the `country` section the route enters. */
10259
+ toSectionStartPointIndex: number;
10260
+ };
9539
10261
  /**
9540
- * GeoJSON feature representing a route section of a certain type.
9541
- *
9542
- * Represents a specific segment of a route with special characteristics
9543
- * (e.g., ferry, toll road, tunnel, traffic incident, EV charging stop).
10262
+ * GeoJSON feature of one border crossing, placed where the route enters the second country.
9544
10263
  *
9545
- * @typeParam S - The section properties type, defaults to DisplaySectionProps
10264
+ * @group Routing
10265
+ */
10266
+ type DisplayCountryCrossing = Feature<Point, DisplayCountryCrossingProps>;
10267
+ /**
10268
+ * A border crossing as an event hands it over: the drawn feature, plus the two `country` sections
10269
+ * it joins.
9546
10270
  *
9547
10271
  * @remarks
9548
- * **Common Section Types:**
9549
- * - Ferry crossings
9550
- * - Toll roads
9551
- * - Tunnels
9552
- * - Traffic incidents
9553
- * - Vehicle restrictions
9554
- * - EV charging stops
9555
- *
9556
- * Each section has a start and end point along the route, represented as
9557
- * a LineString geometry.
10272
+ * The sections are looked up on the route the crossing belongs to, so they are the same objects
10273
+ * `route.properties.sections.country` holds rather than copies. They are absent only when the route
10274
+ * that carried them is no longer shown.
9558
10275
  *
9559
- * @example
9560
- * ```typescript
9561
- * // Ferry section
9562
- * const ferrySection: RouteSection = {
9563
- * type: 'Feature',
9564
- * geometry: {
9565
- * type: 'LineString',
9566
- * coordinates: [[4.9, 52.3], [4.95, 52.35]]
9567
- * },
9568
- * properties: {
9569
- * sectionType: 'ferry',
9570
- * routeIndex: 0,
9571
- * routeState: 'selected'
9572
- * }
9573
- * };
10276
+ * @group Routing
10277
+ */
10278
+ type CountryCrossingFeature = Feature<Point, DisplayCountryCrossingProps & {
10279
+ /** The `country` section the route leaves. */
10280
+ fromSection?: CountrySectionProps;
10281
+ /** The `country` section the route enters. */
10282
+ toSection?: CountrySectionProps;
10283
+ }>;
10284
+ /**
10285
+ * GeoJSON feature collection of the border crossings along the shown routes.
9574
10286
  *
9575
- * // Toll road section
9576
- * const tollSection: RouteSection = {
9577
- * type: 'Feature',
10287
+ * @group Routing
10288
+ */
10289
+ type DisplayCountryCrossings = FeatureCollection<Point, DisplayCountryCrossingProps>;
10290
+ //#endregion
10291
+ //#region src/routing/types/guidance.d.ts
10292
+ /**
10293
+ * @ignore
10294
+ */
10295
+ type DisplayInstructionArrowProps = {
10296
+ lastPointBearingDegrees: number;
10297
+ };
10298
+ /**
10299
+ * @ignore
10300
+ */
10301
+ type DisplayInstructionArrows = FeatureCollection<Point, Instruction & DisplayInstructionArrowProps & DisplayRouteRelatedProps>;
10302
+ /**
10303
+ * @ignore
10304
+ */
10305
+ type DisplayInstruction = Feature<LineString, Instruction & DisplayRouteRelatedProps>;
10306
+ /**
10307
+ * @ignore
10308
+ */
10309
+ type DisplayInstructions = FeatureCollection<LineString, Instruction & DisplayRouteRelatedProps>;
10310
+ //#endregion
10311
+ //#region src/routing/util/displayChargingStops.d.ts
10312
+ type DisplayChargingStopProps = PlaceDisplayProps & ChargingStopProps & DisplayRouteRelatedProps & {
10313
+ chargingDuration: string;
10314
+ chargingPower: string;
10315
+ stopDuration?: string;
10316
+ };
10317
+ /**
10318
+ * The charging stops as displayed on the map, carrying the route state and index so a selection
10319
+ * change can restyle them in place.
10320
+ * @ignore
10321
+ */
10322
+ type DisplayChargingStops = FeatureCollection<Point, DisplayChargingStopProps>;
10323
+ //#endregion
10324
+ //#region src/routing/types/planningWaypoint.d.ts
10325
+ /**
10326
+ * Waypoint or placeholder for route planning.
10327
+ *
10328
+ * Represents a point along a route, which can be a full waypoint with position
10329
+ * and properties, or `null` for placeholder positions (e.g., unset waypoints in
10330
+ * a multi-stop route planner UI).
10331
+ *
10332
+ * @remarks
10333
+ * **Use Cases:**
10334
+ * - Route planning interfaces with add/remove waypoint functionality
10335
+ * - Multi-stop delivery route optimization
10336
+ * - Placeholder slots in waypoint arrays
10337
+ * - Optional intermediate stops
10338
+ *
10339
+ * **Waypoint Types:**
10340
+ * - `WaypointLike`: Full waypoint with coordinates and optional properties
10341
+ * - `null`: Placeholder for unset or removed waypoints
10342
+ *
10343
+ * @example
10344
+ * ```typescript
10345
+ * // Array of waypoints with some unset
10346
+ * const waypoints: PlanningWaypoint[] = [
10347
+ * { type: 'Feature', geometry: { type: 'Point', coordinates: [4.9, 52.3] } },
10348
+ * null, // Empty slot for user to add waypoint
10349
+ * { type: 'Feature', geometry: { type: 'Point', coordinates: [4.5, 51.9] } }
10350
+ * ];
10351
+ *
10352
+ * // Filter out null waypoints before routing
10353
+ * const validWaypoints = waypoints.filter(w => w !== null);
10354
+ * ```
10355
+ *
10356
+ * @group Routing
10357
+ */
10358
+ type PlanningWaypoint = WaypointLike | null;
10359
+ //#endregion
10360
+ //#region src/routing/types/routeSections.d.ts
10361
+ /**
10362
+ * Display-ready section properties combining base section data with route context.
10363
+ *
10364
+ * Extends section information with routing module display properties, allowing
10365
+ * sections to be rendered with proper styling and route association.
10366
+ *
10367
+ * @remarks
10368
+ * Used for rendering special route segments like ferry crossings, tolls, tunnels, etc.
10369
+ *
10370
+ * @example
10371
+ * ```typescript
10372
+ * const sectionProps: DisplaySectionProps = {
10373
+ * ...sectionData,
10374
+ * routeIndex: 0,
10375
+ * routeState: 'selected'
10376
+ * };
10377
+ * ```
10378
+ *
10379
+ * @group Routing
10380
+ */
10381
+ type DisplaySectionProps = SectionProps & DisplayRouteRelatedProps;
10382
+ /**
10383
+ * GeoJSON feature representing a route section of a certain type.
10384
+ *
10385
+ * Represents a specific segment of a route with special characteristics
10386
+ * (e.g., ferry, toll road, tunnel, traffic incident, EV charging stop).
10387
+ *
10388
+ * @typeParam S - The section properties type, defaults to DisplaySectionProps
10389
+ *
10390
+ * @remarks
10391
+ * **Common Section Types:**
10392
+ * - Ferry crossings
10393
+ * - Toll roads
10394
+ * - Tunnels
10395
+ * - Traffic incidents
10396
+ * - Vehicle restrictions
10397
+ * - EV charging stops
10398
+ *
10399
+ * Each section has a start and end point along the route, represented as
10400
+ * a LineString geometry.
10401
+ *
10402
+ * @example
10403
+ * ```typescript
10404
+ * // Ferry section
10405
+ * const ferrySection: RouteSection = {
10406
+ * type: 'Feature',
10407
+ * geometry: {
10408
+ * type: 'LineString',
10409
+ * coordinates: [[4.9, 52.3], [4.95, 52.35]]
10410
+ * },
10411
+ * properties: {
10412
+ * sectionType: 'ferry',
10413
+ * routeIndex: 0,
10414
+ * routeState: 'selected'
10415
+ * }
10416
+ * };
10417
+ *
10418
+ * // Toll road section
10419
+ * const tollSection: RouteSection = {
10420
+ * type: 'Feature',
9578
10421
  * geometry: {
9579
10422
  * type: 'LineString',
9580
10423
  * coordinates: [[5.1, 52.4], [5.2, 52.5]]
@@ -9677,62 +10520,6 @@ type DisplayTrafficSectionProps = DisplaySectionProps & TrafficSectionProps & {
9677
10520
  title?: string;
9678
10521
  };
9679
10522
  //#endregion
9680
- //#region src/routing/types/guidance.d.ts
9681
- /**
9682
- * @ignore
9683
- */
9684
- type DisplayInstructionArrowProps = {
9685
- lastPointBearingDegrees: number;
9686
- };
9687
- /**
9688
- * @ignore
9689
- */
9690
- type DisplayInstructionArrows = FeatureCollection<Point, Instruction & DisplayInstructionArrowProps & DisplayRouteRelatedProps>;
9691
- /**
9692
- * @ignore
9693
- */
9694
- type DisplayInstruction = Feature<LineString, Instruction & DisplayRouteRelatedProps>;
9695
- /**
9696
- * @ignore
9697
- */
9698
- type DisplayInstructions = FeatureCollection<LineString, Instruction & DisplayRouteRelatedProps>;
9699
- //#endregion
9700
- //#region src/routing/types/planningWaypoint.d.ts
9701
- /**
9702
- * Waypoint or placeholder for route planning.
9703
- *
9704
- * Represents a point along a route, which can be a full waypoint with position
9705
- * and properties, or `null` for placeholder positions (e.g., unset waypoints in
9706
- * a multi-stop route planner UI).
9707
- *
9708
- * @remarks
9709
- * **Use Cases:**
9710
- * - Route planning interfaces with add/remove waypoint functionality
9711
- * - Multi-stop delivery route optimization
9712
- * - Placeholder slots in waypoint arrays
9713
- * - Optional intermediate stops
9714
- *
9715
- * **Waypoint Types:**
9716
- * - `WaypointLike`: Full waypoint with coordinates and optional properties
9717
- * - `null`: Placeholder for unset or removed waypoints
9718
- *
9719
- * @example
9720
- * ```typescript
9721
- * // Array of waypoints with some unset
9722
- * const waypoints: PlanningWaypoint[] = [
9723
- * { type: 'Feature', geometry: { type: 'Point', coordinates: [4.9, 52.3] } },
9724
- * null, // Empty slot for user to add waypoint
9725
- * { type: 'Feature', geometry: { type: 'Point', coordinates: [4.5, 51.9] } }
9726
- * ];
9727
- *
9728
- * // Filter out null waypoints before routing
9729
- * const validWaypoints = waypoints.filter(w => w !== null);
9730
- * ```
9731
- *
9732
- * @group Routing
9733
- */
9734
- type PlanningWaypoint = WaypointLike | null;
9735
- //#endregion
9736
10523
  //#region src/routing/types/waypointDisplayProps.d.ts
9737
10524
  /**
9738
10525
  * @group Routing
@@ -9870,18 +10657,19 @@ export declare const STOP_DISPLAY_INDEX = "stopDisplayIndex";
9870
10657
  /**
9871
10658
  * @ignore
9872
10659
  */
9873
- type RoutingSourcesWithLayers = {
10660
+ type RoutingSourcesWithLayers = { [K in SectionSourceKey<GeneratedSectionType>]: GeoJSONSourceWithLayers<RouteSections>; } & {
9874
10661
  mainLines: GeoJSONSourceWithLayers<Routes<DisplayRouteProps>>;
9875
10662
  waypoints: GeoJSONSourceWithLayers<Waypoints<WaypointDisplayProps>>;
9876
10663
  vehicleRestricted: GeoJSONSourceWithLayers<RouteSections>;
9877
10664
  incidents: GeoJSONSourceWithLayers<RouteSections<DisplayTrafficSectionProps>>;
9878
10665
  ferries: GeoJSONSourceWithLayers<RouteSections>;
9879
- chargingStops: GeoJSONSourceWithLayers<Waypoints>;
10666
+ chargingStops: GeoJSONSourceWithLayers<DisplayChargingStops>;
9880
10667
  tollRoads: GeoJSONSourceWithLayers<RouteSections>;
9881
10668
  tunnels: GeoJSONSourceWithLayers<RouteSections>;
9882
10669
  instructionLines: GeoJSONSourceWithLayers<DisplayInstructions>;
9883
10670
  instructionArrows: GeoJSONSourceWithLayers<DisplayInstructionArrows>;
9884
10671
  summaryBubbles: GeoJSONSourceWithLayers<DisplayRouteSummaries>;
10672
+ countryCrossings: GeoJSONSourceWithLayers<DisplayCountryCrossings>;
9885
10673
  };
9886
10674
  //#endregion
9887
10675
  //#region src/routing/types/showOptions.d.ts
@@ -9953,7 +10741,7 @@ export type RoutingShownFeatures = {
9953
10741
  *
9954
10742
  * @group Routing
9955
10743
  */
9956
- export type RoutingEvents = CombinedEvents<MapGeoJSONFeature, RoutingModuleConfig, RoutingShownFeatures> & {
10744
+ export type RoutingEvents = CombinedEvents<MapGeoJSONFeature, RoutingModuleConfig, RoutingShownFeatures> & { [K in SectionSourceKey<GeneratedSectionType>]: UserEvents<RouteSection>; } & {
9957
10745
  /** The route lines themselves. */
9958
10746
  mainLines: UserEvents<Route<DisplayRouteProps>>;
9959
10747
  /** Origin, destination and intermediate stops. */
@@ -9962,6 +10750,8 @@ export type RoutingEvents = CombinedEvents<MapGeoJSONFeature, RoutingModuleConfi
9962
10750
  chargingStops: UserEvents<RouteSection>;
9963
10751
  /** The summary bubbles shown against each alternative. */
9964
10752
  summaryBubbles: UserEvents<DisplayRouteSummary>;
10753
+ /** The border crossings along the route, each carrying the two `country` sections it joins. */
10754
+ countryCrossings: UserEvents<CountryCrossingFeature>;
9965
10755
  /** Traffic incidents on the route. */
9966
10756
  incidents: UserEvents<RouteSection<DisplayTrafficSectionProps>>;
9967
10757
  /** Sections the vehicle is restricted from. */
@@ -9992,300 +10782,1179 @@ export type RoutingEvents = CombinedEvents<MapGeoJSONFeature, RoutingModuleConfi
9992
10782
  * - Distance and duration information
9993
10783
  * - Support for multiple routes simultaneously
9994
10784
  *
9995
- * **Common Use Cases:**
9996
- * - Turn-by-turn navigation displays
9997
- * - Route planning and comparison
9998
- * - Multi-stop route optimization
9999
- * - Interactive route editing
10000
- * - Fleet management route visualization
10785
+ * **Common Use Cases:**
10786
+ * - Turn-by-turn navigation displays
10787
+ * - Route planning and comparison
10788
+ * - Multi-stop route optimization
10789
+ * - Interactive route editing
10790
+ * - Fleet management route visualization
10791
+ *
10792
+ * @example
10793
+ * ```typescript
10794
+ * // Create the module
10795
+ * const routingModule = await RoutingModule.create(map, {
10796
+ * displayUnits: {
10797
+ * distance: { type: 'metric' }
10798
+ * }
10799
+ * });
10800
+ *
10801
+ * // Calculate and display a route
10802
+ * const result = await calculateRoute({
10803
+ * key: 'your-api-key',
10804
+ * locations: [
10805
+ * [4.9041, 52.3676], // Amsterdam
10806
+ * [4.4777, 51.9244] // Rotterdam
10807
+ * ],
10808
+ * routeOptions: {
10809
+ * travelMode: 'car',
10810
+ * routeType: 'fastest'
10811
+ * }
10812
+ * });
10813
+ *
10814
+ * await routingModule.showRoutes(result);
10815
+ * ```
10816
+ *
10817
+ * @see [Routing Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/routing)
10818
+ *
10819
+ * @group Routing
10820
+ */
10821
+ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSourcesWithLayers, RoutingModuleConfig> {
10822
+ private layersSpecs;
10823
+ private layerIDPrefix;
10824
+ private readonly shownFeaturesHandlers;
10825
+ /**
10826
+ * Make sure the map is ready before create an instance of the module and any other interaction with the map
10827
+ * @param tomtomMap The TomTomMap instance.
10828
+ * @param config The module optional configuration
10829
+ * @returns {Promise} Returns a promise with a new instance of this module
10830
+ *
10831
+ * @remarks
10832
+ * **Instances:**
10833
+ * `RoutingModule` owns the sources, layers and images it adds, all suffixed per instance. Every
10834
+ * call therefore returns a **new, independent** instance, and stacking several of them on one
10835
+ * map is a supported thing to do.
10836
+ *
10837
+ * **Configuration Options:**
10838
+ * - `displayUnits`: Distance units (metric/imperial)
10839
+ * - `waypointsSource`: Waypoint entry point options
10840
+ * - `layers`: Complete layer styling configuration
10841
+ *
10842
+ * **Default Styling:**
10843
+ * If no custom layers are provided, uses {@link defaultRoutingLayers}.
10844
+ *
10845
+ * @example
10846
+ * Default initialization:
10847
+ * ```typescript
10848
+ * const routingModule = await RoutingModule.create(map);
10849
+ * ```
10850
+ *
10851
+ * @example
10852
+ * With custom configuration:
10853
+ * ```typescript
10854
+ * const routingModule = await RoutingModule.create(map, {
10855
+ * displayUnits: 'imperial',
10856
+ * waypointsSource: {
10857
+ * entryPoints: 'main-when-available'
10858
+ * }
10859
+ * });
10860
+ * ```
10861
+ */
10862
+ static create(tomtomMap: TomTomMap, config?: RoutingModuleConfig): Promise<RoutingModule>;
10863
+ private constructor();
10864
+ private createSourcesWithLayers;
10865
+ /**
10866
+ * @ignore
10867
+ */
10868
+ protected _initSourcesWithLayers(config?: RoutingModuleConfig, restore?: boolean): RoutingSourcesWithLayers;
10869
+ /**
10870
+ * @ignore
10871
+ */
10872
+ protected _applyConfig(config?: RoutingModuleConfig): RoutingModuleConfig;
10873
+ /**
10874
+ * Shows the speed limit sections, each carrying the sign that posts it.
10875
+ *
10876
+ * @remarks
10877
+ * `speedLimit` is the one type drawn from its own number rather than its extent, so the number,
10878
+ * the face and the numeral colour are derived here and ride on the feature. That makes the unit
10879
+ * in force an input to the data rather than to the paint, which is why a change to it re-runs
10880
+ * this instead of restyling the layer in place.
10881
+ */
10882
+ private showSpeedLimitSections;
10883
+ /** The colours the crossings draw with, which follow the map's theme unless configured. */
10884
+ private crossingColors;
10885
+ /**
10886
+ * What {@link applyCountryCrossingConfig} last painted the crossings with.
10887
+ *
10888
+ * @remarks
10889
+ * Tracked here rather than re-derived from `this.config`, because the theme is an input the
10890
+ * config cannot see: a style change moves the resolved colours while the config says the same
10891
+ * thing. Cleared when the sources are rebuilt, so a restored style repaints from scratch.
10892
+ */
10893
+ private appliedCrossingColors;
10894
+ /**
10895
+ * Brings the border crossings in line with a changed configuration.
10896
+ *
10897
+ * @remarks
10898
+ * The source is gated on `visible`, as the summary bubbles' is, so switching them back on
10899
+ * re-derives the features: a layer spec cannot put back data the source does not hold.
10900
+ *
10901
+ * Both colours are applied here rather than left to the layer spec: the plaque is an image, so
10902
+ * a new colour has to replace it, and the label's colour follows the map theme, which the spec
10903
+ * that built the layer cannot know about after a style change.
10904
+ */
10905
+ private applyCountryCrossingConfig;
10906
+ /**
10907
+ * Re-derives the posted signs when the unit they read in changed.
10908
+ *
10909
+ * @remarks
10910
+ * No paint property can restate a number, so `sign.unit` and `displayUnits` are the two knobs
10911
+ * that have to reach the features rather than the layers — the summary bubbles are re-shown for
10912
+ * the same reason. Runs before the visibility pass, so the re-shown source goes through it.
10913
+ */
10914
+ private reshowSpeedLimitSigns;
10915
+ /**
10916
+ * Applies the `sections.<type>.visible` knob to every section type.
10917
+ *
10918
+ * @remarks
10919
+ * Every other source here follows one rule — its layers are visible whenever it holds features
10920
+ * — and for sections that rule is not enough. Almost every route has urban stretches, a tunnel
10921
+ * or a country crossing somewhere along it, so "has features" would draw all sixteen types the
10922
+ * moment a route is shown, whatever the caller asked for. This runs right after anything that
10923
+ * shows features and after any config change, in the same tick, so nothing renders in between.
10924
+ */
10925
+ private applySectionVisibility;
10926
+ /** The id of the layer posting this type's signs, for a type that posts them. */
10927
+ private signLayerID;
10928
+ /**
10929
+ * Settles which icons a section's signs give way to.
10930
+ *
10931
+ * @remarks
10932
+ * MapLibre resolves symbol collisions from the topmost layer down, so this is a matter of where
10933
+ * the sign layer sits — and it cannot be a `beforeID`, because the layers a sign yields to are
10934
+ * added when the features that need them are shown: a route with no waypoints shown has no
10935
+ * waypoint layer to anchor to, and an anchor that is not on the map costs the sign layer
10936
+ * itself. So the stacking is settled here instead, after each show and each config change.
10937
+ */
10938
+ private applySignPriority;
10939
+ /**
10940
+ * The layer a section's signs are moved under, for what they are configured to give way to.
10941
+ *
10942
+ * @remarks
10943
+ * `aboveRouteIcons` anchors to nothing, which puts the layer on top. The other two differ only
10944
+ * in where the search starts: under the base map's labels for `belowMapLabels`, and at them for
10945
+ * `belowRouteIcons`, since a section's own icon layer is pinned below the labels and a sign
10946
+ * sent under that would give way to every place name on the way.
10947
+ */
10948
+ private signAnchorLayerID;
10949
+ /** @ignore */
10950
+ protected discardShownData(): void;
10951
+ /**
10952
+ * @ignore
10953
+ */
10954
+ protected restoreDataAndConfigImpl(): void;
10955
+ private addImageIfNotExisting;
10956
+ /**
10957
+ * Displays the given routes on the map.
10958
+ *
10959
+ * @param routes - Route data from Routing API or custom routes.
10960
+ * @param options - Optional configuration for route selection and display.
10961
+ * @param options.selectedIndex - Index of the route to display as selected (default: 0).
10962
+ *
10963
+ * @remarks
10964
+ * **Waypoints are NOT shown by this method.**
10965
+ * Route lines are drawn but start/stop/destination markers are not. To display waypoint
10966
+ * markers, call {@link showWaypoints} separately. Alternatively, use
10967
+ * {@link PlacesModule} to display waypoints as fully customizable place markers.
10968
+ *
10969
+ * **Behavior:**
10970
+ * - Replaces any previously shown routes
10971
+ * - Shows all route-related features: lines, sections, summaries, guidance
10972
+ * - First route is selected by default (appears more prominent)
10973
+ *
10974
+ * **Route Features:**
10975
+ * - Main route lines (selected and deselected styles)
10976
+ * - Traffic sections with delays
10977
+ * - Ferry, tunnel, and charged-road (`tollRoad`) sections
10978
+ * - EV charging stations (for EV routes)
10979
+ * - Turn-by-turn instruction lines and arrows
10980
+ * - Summary bubbles with distance/time/traffic info
10981
+ *
10982
+ * @example
10983
+ * Show a route (no waypoint markers):
10984
+ * ```typescript
10985
+ * await routing.showRoutes(response.routes);
10986
+ * // Waypoint markers are NOT shown — call showWaypoints() to add them
10987
+ * ```
10988
+ *
10989
+ * @example
10990
+ * Show routes and waypoint markers:
10991
+ * ```typescript
10992
+ * const locations = [[4.9, 52.4], [4.5, 51.9]];
10993
+ * const response = await calculateRoute({ locations });
10994
+ * await routing.showRoutes(response.routes);
10995
+ * await routing.showWaypoints(locations); // Show start/destination markers separately
10996
+ * ```
10997
+ *
10998
+ * @example
10999
+ * Show multiple routes with specific selection:
11000
+ * ```typescript
11001
+ * await routing.showRoutes(response.routes, { selectedIndex: 1 });
11002
+ * ```
11003
+ */
11004
+ showRoutes(routes: Route | Routes, options?: ShowRoutesOptions): Promise<void>;
11005
+ /**
11006
+ * Clears any previously shown routes from the map.
11007
+ *
11008
+ * @remarks
11009
+ * - Clears all route-related layers (lines, sections, guidance, summaries)
11010
+ * - Does NOT clear waypoints (use {@link clearWaypoints})
11011
+ * - Module remains initialized and ready for new routes
11012
+ *
11013
+ * @example
11014
+ * ```typescript
11015
+ * await routing.clearRoutes();
11016
+ * ```
11017
+ */
11018
+ clearRoutes(): Promise<void>;
11019
+ /**
11020
+ * Changes which route appears as selected.
11021
+ *
11022
+ * @param index - Zero-based index of the route to select.
11023
+ *
11024
+ * @remarks
11025
+ * **Visual Changes:**
11026
+ * - Selected route appears more prominent (thicker, brighter)
11027
+ * - Previously selected route becomes deselected style
11028
+ * - Updates all route-related features (sections, guidance)
11029
+ *
11030
+ * **Requirements:**
11031
+ * - Route must already be displayed via {@link showRoutes}
11032
+ * - Index must be within range of displayed routes
11033
+ *
11034
+ * @example
11035
+ * ```typescript
11036
+ * // Show multiple routes
11037
+ * await routingModule.showRoutes(routes);
11038
+ *
11039
+ * // User clicks alternative route
11040
+ * await routingModule.selectRoute(1);
11041
+ *
11042
+ * // Switch back to first route
11043
+ * await routingModule.selectRoute(0);
11044
+ * ```
11045
+ */
11046
+ selectRoute(index: number): Promise<void>;
11047
+ /**
11048
+ * Displays waypoint markers (start, stop, and destination pins) on the map.
11049
+ *
11050
+ * @param waypoints - An array of planning waypoints or a `Waypoints` FeatureCollection.
11051
+ *
11052
+ * @remarks
11053
+ * Waypoint markers are **not** shown by {@link showRoutes} — this method must be called
11054
+ * separately to display them. For more control over marker appearance and behavior,
11055
+ * consider using {@link PlacesModule} to render waypoints as place markers instead.
11056
+ *
11057
+ * @example
11058
+ * Show routes and then waypoints:
11059
+ * ```typescript
11060
+ * const locations = [[4.9041, 52.3676], [4.4777, 51.9244]];
11061
+ * const response = await calculateRoute({ locations });
11062
+ * await routingModule.showRoutes(response.routes);
11063
+ * await routingModule.showWaypoints(locations); // Must be called separately
11064
+ * ```
11065
+ */
11066
+ showWaypoints(waypoints: PlanningWaypoint[] | Waypoints): Promise<void>;
11067
+ /**
11068
+ * Clears any previously shown waypoints from the map.
11069
+ * If nothing was shown before, nothing happens.
11070
+ */
11071
+ clearWaypoints(): Promise<void>;
11072
+ /**
11073
+ * Returns the currently shown routes and waypoints.
11074
+ *
11075
+ * @returns An object containing all currently displayed routing data.
11076
+ *
11077
+ * @remarks
11078
+ * Returns the exact data that was passed to the `showRoutes()` and `showWaypoints()` methods.
11079
+ *
11080
+ * **Returned Data:**
11081
+ * - `mainLines`: Main route lines (selected and alternative)
11082
+ * - `waypoints`: Route waypoints (start, stops, finish)
11083
+ * - `incidents`: Traffic incidents on routes
11084
+ * - `ferries`: Ferry sections
11085
+ * - `chargingStops`: EV charging stations
11086
+ * - `tollRoads`: Sections that cost money to drive — the `tollRoad` section type
11087
+ * - `tunnels`: Tunnel sections
11088
+ * - `vehicleRestricted`: Vehicle-restricted sections
11089
+ * - `instructionLines`: Turn-by-turn instruction lines
11090
+ * - `instructionArrows`: Instruction arrow markers
11091
+ * - `summaryBubbles`: Route summary popups
11092
+ * - `countryCrossings`: Border crossings along the route
11093
+ *
11094
+ * @example
11095
+ * ```typescript
11096
+ * const shown = routingModule.getShown();
11097
+ * console.log(`Showing ${shown.mainLines.features.length} routes`);
11098
+ * console.log(`Showing ${shown.waypoints.features.length} waypoints`);
11099
+ * console.log(`Showing ${shown.chargingStops.features.length} charging stops`);
11100
+ * ```
11101
+ *
11102
+ * @example
11103
+ * Check if any routes are displayed:
11104
+ * ```typescript
11105
+ * const shown = routingModule.getShown();
11106
+ * if (shown.mainLines.features.length > 0) {
11107
+ * console.log('Routes are displayed');
11108
+ * } else {
11109
+ * console.log('No routes displayed');
11110
+ * }
11111
+ * ```
11112
+ */
11113
+ getShown(): {
11114
+ tunnels: RouteSections;
11115
+ vehicleRestricted: RouteSections;
11116
+ instructionLines: DisplayInstructions;
11117
+ instructionArrows: DisplayInstructionArrows;
11118
+ summaryBubbles: DisplayRouteSummaries;
11119
+ countryCrossings: DisplayCountryCrossings;
11120
+ carpoolSections: RouteSections | undefined;
11121
+ carTrainSections: RouteSections | undefined;
11122
+ importantRoadStretchSections: RouteSections | undefined;
11123
+ lowEmissionZoneSections: RouteSections | undefined;
11124
+ motorwaySections: RouteSections | undefined;
11125
+ pedestrianSections: RouteSections | undefined;
11126
+ speedLimitSections: RouteSections | undefined;
11127
+ tollVignetteSections: RouteSections | undefined;
11128
+ unpavedSections: RouteSections | undefined;
11129
+ urbanSections: RouteSections | undefined;
11130
+ mainLines: Routes<DisplayRouteProps>;
11131
+ waypoints: Waypoints<WaypointDisplayProps>;
11132
+ incidents: RouteSections<DisplayTrafficSectionProps>;
11133
+ ferries: RouteSections;
11134
+ chargingStops: DisplayChargingStops;
11135
+ tollRoads: RouteSections;
11136
+ };
11137
+ /**
11138
+ * Unified events interface for the routing module.
11139
+ *
11140
+ * `events` itself covers every route feature and the module's lifecycle events; the named
11141
+ * scopes below cover one part of a route each, and every one of them can be narrowed further
11142
+ * with `where()`.
11143
+ *
11144
+ * ```typescript
11145
+ * routing.events.mainLines.on('click', (route) => { ... });
11146
+ * routing.events.waypoints.on('hover', (waypoint) => { ... });
11147
+ *
11148
+ * // Only the long tunnels, with their own hover cursor:
11149
+ * routing.events.tunnels
11150
+ * .where((section) => section.properties.lengthInMeters > 500, { cursorOnHover: 'help' })
11151
+ * .on('click', showTunnel);
11152
+ *
11153
+ * const unsub = routing.events.on('config-change', (config) => { ... });
11154
+ * routing.events.on('shown-features', (features) => {
11155
+ * if ('routes' in features) { ... }
11156
+ * });
11157
+ * unsub();
11158
+ * ```
11159
+ */
11160
+ get events(): RoutingEvents;
11161
+ /**
11162
+ * Returns the map style layer under which route lines are rendered.
11163
+ * * Useful if you want to render extra layers just above the route ones but not on top of everything else.
11164
+ * * It might differ depending on the loaded style/version.
11165
+ */
11166
+ getLayerToRenderLinesUnder(): string;
11167
+ }
11168
+ //#endregion
11169
+ //#region src/shared/layers/layerSelector.d.ts
11170
+ /**
11171
+ * Picks style layers by the taxonomy TomTom ships with the style rather than by their (unstable)
11172
+ * ids: `metadata.group` first, then optional narrowing by layer type, source layer and
11173
+ * case-insensitive id fragments. Every constraint given must hold.
11174
+ *
11175
+ * This is the one matching rule behind the base-map layer groups and the styling knobs, so a
11176
+ * curated map is a small data table rather than code, and a style-version bump is checked by
11177
+ * running the same tables against the new style.
11178
+ *
11179
+ * @ignore
11180
+ */
11181
+ type LayerSelector = {
11182
+ /** Values of `metadata.group` the layer may carry. Omit to accept any group. */
11183
+ metadataGroups?: string[];
11184
+ /** Layer types the layer may have. */
11185
+ layerTypes?: LayerSpecification['type'][];
11186
+ /** Sources the layer must draw from. */
11187
+ sources?: string[];
11188
+ /**
11189
+ * Source types (`vector`, `raster`, `geojson`…) the layer's source may have. Needs the style's
11190
+ * sources to be passed along when matching; without them this constraint cannot hold.
11191
+ */
11192
+ sourceTypes?: string[];
11193
+ /** Source layers (vector tile layers) the layer must draw from. */
11194
+ sourceLayers?: string[];
11195
+ /** The layer id must contain at least one of these fragments (case-insensitive). */
11196
+ idIncludes?: string[];
11197
+ /** The layer id must contain none of these fragments (case-insensitive). */
11198
+ idExcludes?: string[];
11199
+ };
11200
+ //#endregion
11201
+ //#region src/styling/mapColorCatalogue.d.ts
11202
+ /**
11203
+ * The ten semantic map colours — TomTom Map Maker's *Foundations* palette, under its own names and
11204
+ * in its own order. One name drives every layer and shade the style derives from it.
11205
+ *
11206
+ * | Name | Map Maker | Reaches |
11207
+ * |---|---|---|
11208
+ * | `land` | Land (base) | Map background and other bare-land features, influences admin borders/labels. Also used to derive all map colours if undefined. |
11209
+ * | `water` | Water | Waterbodies, waterways and other water features. Also influences glaciers, water labels and ferry lines. |
11210
+ * | `vegetation` | Vegetation | Forests and other land cover such as grass and shrubland. Also influences earth cover vegetation at smaller scales. |
11211
+ * | `park` | Park & Recreation | City parks and sport/recreation grounds. Also influences National Parks and other protected areas at smaller scales. |
11212
+ * | `artificial` | Artificial | Built-up-areas and man-made features such as landuse grounds and buildings. Also influences railways. |
11213
+ * | `roadMajor` | Major Road | Most important road classes, from motorways & trunks to primary roads. Also influences outline and tunnel colours. |
11214
+ * | `road` | Road | Less important road classes, from secondary/tertiary to streets and service roads. Also influences tunnel colours. |
11215
+ * | `roadOutline` | Road Outline | Road outlines for secondary/tertiary roads and minor classes. Also influences road labels and all other outline colours. |
11216
+ * | `label` | Label | Labels for capitals and other populated places/admin areas. Also influences border styling and all other label colours. |
11217
+ * | `labelOutline` | Label Outline | Outlines for populated places and admin area labels. Also influences border outlines and all other label halos. |
11218
+ *
11219
+ * @group Map Styling
11220
+ */
11221
+ type MapColorName = 'land' | 'water' | 'vegetation' | 'park' | 'artificial' | 'roadMajor' | 'road' | 'roadOutline' | 'label' | 'labelOutline';
11222
+ /**
11223
+ * A partial set of map colours for {@link StylingModule.setMapColors}: any subset of the ten,
11224
+ * each a CSS colour string.
11225
+ *
11226
+ * @example
11227
+ * ```typescript
11228
+ * styling.setMapColors({ land: '#f3f5f7', water: '#accbe2', roadMajor: '#a1b8ce', label: '#364659' });
11229
+ * ```
11230
+ *
11231
+ * @group Map Styling
11232
+ */
11233
+ type MapColors = Partial<Record<MapColorName, string>>;
11234
+ /**
11235
+ * Every paint property the styling knobs write a colour to. Listed once as values, since
11236
+ * `StylingModule` needs the set at runtime to pick MapLibre's paint setter over its layout one.
11237
+ * @ignore
11238
+ */
11239
+ declare const paintColorProperties: readonly ["fill-color", "fill-outline-color", "line-color", "text-color", "text-halo-color", "fill-extrusion-color", "background-color"];
11240
+ /** @ignore */
11241
+ type PaintColorProperty = (typeof paintColorProperties)[number];
11242
+ /**
11243
+ * The ten map colour names, in Map Maker's Foundations order.
11244
+ *
11245
+ * @group Map Styling
11246
+ */
11247
+ export declare const mapColorNames: MapColorName[];
11248
+ //#endregion
11249
+ //#region src/styling/presets.d.ts
11250
+ /**
11251
+ * The styling presets the SDK ships: named bundles of knob settings for common intents. Each is data
11252
+ * over the knob catalogue, so a preset is exactly as durable as the knobs it sets, and an app can
11253
+ * start from one and adjust.
11254
+ * @ignore
11255
+ */
11256
+ declare const stylingPresets: {
11257
+ readonly 'data-viz': {
11258
+ readonly name: "Data visualisation";
11259
+ readonly description: "A quiet base for your own data on top: fewer labels and markers, thinner roads, no badges competing with the overlay.";
11260
+ readonly settings: {
11261
+ readonly 'labels.sizeFactor': 0.9;
11262
+ readonly 'symbols.sizeFactor': 0.9;
11263
+ readonly 'roads.widthFactor': 0.8;
11264
+ readonly 'roads.exitNumbers': false;
11265
+ readonly 'roads.shields': false;
11266
+ readonly 'roads.arrows': false;
11267
+ readonly 'pois.microMarkers': false;
11268
+ readonly 'pois.minZoom': 14;
11269
+ readonly 'buildings.3d': false;
11270
+ };
11271
+ };
11272
+ readonly 'night-driving': {
11273
+ readonly name: "Night driving";
11274
+ readonly description: "Bigger labels and shields, wider roads and traffic tubes, POIs out of the way until close up.";
11275
+ readonly settings: {
11276
+ readonly 'labels.sizeFactor': 1.2;
11277
+ readonly 'symbols.sizeFactor': 1.2;
11278
+ readonly 'roads.widthFactor': 1.2;
11279
+ readonly 'roads.exitNumbers': true;
11280
+ readonly 'roads.shields': true;
11281
+ readonly 'roads.arrows': true;
11282
+ readonly 'pois.minZoom': 13;
11283
+ readonly 'pois.microMarkers': false;
11284
+ readonly 'traffic.flow.widthFactor': 1.3;
11285
+ readonly 'buildings.3d': false;
11286
+ };
11287
+ };
11288
+ readonly minimal: {
11289
+ readonly name: "Minimal";
11290
+ readonly description: "The bare map: land, water, roads and the main place names. Everything decorative off.";
11291
+ readonly settings: {
11292
+ readonly 'labels.sizeFactor': 0.9;
11293
+ readonly 'roads.exitNumbers': false;
11294
+ readonly 'roads.shields': false;
11295
+ readonly 'roads.arrows': false;
11296
+ readonly 'roads.restricted': false;
11297
+ readonly 'roads.underConstruction': false;
11298
+ readonly 'buildings.footprints': false;
11299
+ readonly 'buildings.3d': false;
11300
+ readonly 'pois.microMarkers': false;
11301
+ readonly 'pois.minZoom': 16;
11302
+ };
11303
+ };
11304
+ readonly globe: {
11305
+ readonly name: "Globe";
11306
+ readonly description: "A globe with an atmosphere for the zoomed-out view; flattens to Mercator as you zoom in.";
11307
+ readonly settings: {
11308
+ readonly 'view.projection': "globe";
11309
+ readonly 'view.sky': true;
11310
+ };
11311
+ };
11312
+ readonly terrain: {
11313
+ readonly name: "Terrain";
11314
+ readonly description: "3D terrain with a sky for tilted views. Needs the hillshade style part and a pitched camera.";
11315
+ readonly settings: {
11316
+ readonly 'view.terrain': true;
11317
+ readonly 'view.terrainExaggeration': 1.2;
11318
+ readonly 'view.sky': true;
11319
+ };
11320
+ };
11321
+ };
11322
+ /**
11323
+ * The id of a styling preset, as accepted by {@link StylingModule.applyPreset}.
11324
+ *
11325
+ * @group Map Styling
11326
+ */
11327
+ type StylingPresetId = keyof typeof stylingPresets;
11328
+ /**
11329
+ * Every styling preset id, in catalogue order.
11330
+ *
11331
+ * @group Map Styling
11332
+ */
11333
+ export declare const stylingPresetIds: StylingPresetId[];
11334
+ //#endregion
11335
+ //#region src/styling/types/stylingTypes.d.ts
11336
+ /**
11337
+ * What kind of value a styling knob takes — a subset of the shared {@link KnobKind} vocabulary.
11338
+ *
11339
+ * - `factor`: a multiplier over what the style already does (`1` = unchanged), e.g. label size.
11340
+ * - `number`: an absolute number with a range, e.g. a minimum zoom.
11341
+ * - `toggle`: `true`/`false`, e.g. whether exit numbers are shown.
11342
+ * - `color`: a CSS colour string (`#rrggbb`, `hsl(…)`, `rgb(…)`, a named colour).
11343
+ * - `enum`: one of the knob's `options`, e.g. the projection.
11344
+ *
11345
+ * @group Map Styling
11346
+ */
11347
+ export declare const stylingKnobKinds: readonly ["factor", "number", "toggle", "color", "enum"];
11348
+ /**
11349
+ * @group Map Styling
11350
+ */
11351
+ type StylingKnobKind = (typeof stylingKnobKinds)[number];
11352
+ /**
11353
+ * Which styles a knob works on.
11354
+ *
11355
+ * - `any-style`: every style, including a custom one of your own.
11356
+ * - `tomtom-styles`: the TomTom styles this SDK version is verified against. On any other style the
11357
+ * knob reports itself unavailable instead of doing nothing silently.
11358
+ *
11359
+ * @group Map Styling
11360
+ */
11361
+ export declare const stylingKnobAppliesTo: readonly ["any-style", "tomtom-styles"];
11362
+ /**
11363
+ * @group Map Styling
11364
+ */
11365
+ type StylingKnobAppliesTo = (typeof stylingKnobAppliesTo)[number];
11366
+ /**
11367
+ * A value a styling knob can hold; which one depends on the knob's {@link StylingKnobKind}.
11368
+ *
11369
+ * @group Map Styling
11370
+ */
11371
+ type StylingKnobValue = number | boolean | string;
11372
+ /**
11373
+ * The valid range of a numeric knob, in the units of the knob (`factor` knobs are unitless).
11374
+ * Styling always ships a slider `step`; the shared {@link KnobRange} leaves it optional.
11375
+ *
11376
+ * @group Map Styling
11377
+ */
11378
+ type StylingKnobRange = KnobRange & {
11379
+ step: number;
11380
+ };
11381
+ /**
11382
+ * One entry of the styling catalogue returned by {@link StylingModule.describe}: everything a UI or
11383
+ * an agent needs to offer the knob, validate a value for it and show its state.
11384
+ *
11385
+ * @remarks
11386
+ * Narrows the shared {@link KnobDescriptor}: styling ids and value types are known, `range.step` is
11387
+ * always given, and `available` / `appliesTo` are required — every styling knob answers both.
11388
+ *
11389
+ * @group Map Styling
11390
+ */
11391
+ type StylingKnobDescriptor = KnobDescriptor & {
11392
+ /** The knob's id, as accepted by {@link StylingModule.set}. */
11393
+ id: StylingKnobId;
11394
+ kind: StylingKnobKind;
11395
+ /**
11396
+ * The value the loaded style ships with. `undefined` when the style defines it as a data-driven
11397
+ * expression that no single value stands for; `reset` still restores it exactly.
11398
+ */
11399
+ default: StylingKnobValue | undefined;
11400
+ /** The value in effect right now: the override if there is one, otherwise the default. */
11401
+ current: StylingKnobValue | undefined;
11402
+ /** The range of valid values, for `factor` and `number` knobs. */
11403
+ range?: StylingKnobRange;
11404
+ /** The valid values, for `enum` knobs. */
11405
+ options?: readonly string[];
11406
+ /**
11407
+ * Whether the knob has anything to work on in the loaded style. `false` means setting it would
11408
+ * do nothing, and the SDK also warns once in the console when that happens. Check this before
11409
+ * offering the knob in a UI or to an agent. Map-level knobs are always available bar
11410
+ * `view.terrain`, which needs the style to carry an elevation source.
11411
+ */
11412
+ available: boolean;
11413
+ /** Which styles the knob works on; see {@link stylingKnobAppliesTo}. */
11414
+ appliesTo: StylingKnobAppliesTo;
11415
+ };
11416
+ /**
11417
+ * The machine-readable styling catalogue: what can be styled on the loaded style, with defaults,
11418
+ * ranges and current values. Additive across SDK minor versions; knob ids are public API.
11419
+ *
11420
+ * @group Map Styling
11421
+ */
11422
+ type StylingCatalogue = {
11423
+ knobs: StylingKnobDescriptor[];
11424
+ /** The presets {@link StylingModule.applyPreset} accepts, with the settings each one applies. */
11425
+ presets: StylingPresetDescriptor[];
11426
+ };
11427
+ /**
11428
+ * A named bundle of knob settings — TomTom's cartographic opinions, in code. Apply one with
11429
+ * {@link StylingModule.applyPreset}.
11430
+ *
11431
+ * @group Map Styling
11432
+ */
11433
+ type StylingPresetDescriptor = {
11434
+ id: StylingPresetId;
11435
+ name: string;
11436
+ /** One line on the use case the preset serves. */
11437
+ description: string;
11438
+ /** The knob values the preset applies; the same shape {@link StylingModule.applyConfig} takes. */
11439
+ settings: StylingSettings;
11440
+ };
11441
+ /**
11442
+ * A serializable set of styling knob values — what {@link StylingModule.getConfig} returns and
11443
+ * {@link StylingModule.applyConfig} accepts. Persist it, put it in a pull request, or ship it as a
11444
+ * preset: re-applying it on a later SDK version keeps working for as long as the knob ids do.
11445
+ *
11446
+ * @example
11447
+ * ```typescript
11448
+ * const settings: StylingSettings = {
11449
+ * 'labels.sizeFactor': 1.2,
11450
+ * 'roads.exitNumbers': false,
11451
+ * 'traffic.flow.slowColor': '#f59e0b',
11452
+ * };
11453
+ * styling.applyConfig(settings);
11454
+ * ```
11455
+ *
11456
+ * @group Map Styling
11457
+ */
11458
+ type StylingSettings = MapModuleCommonConfig & { [K in StylingKnobId]?: StylingKnobValueOf<K>; };
11459
+ //#endregion
11460
+ //#region src/styling/knobCatalogue.d.ts
11461
+ /** @ignore */
11462
+ type ScalableProperty = 'text-size' | 'icon-size' | 'line-width';
11463
+ /** @ignore */
11464
+ type ColorProperty = Extract<PaintColorProperty, 'line-color' | 'text-color' | 'text-halo-color'>;
11465
+ /**
11466
+ * How a knob reaches the style. A knob may use several (e.g. text and icon size together).
11467
+ * @ignore
11468
+ */
11469
+ type KnobMechanism =
11470
+ /** M1 — multiplies the property's own value on every matched layer (works on any style). */
11471
+ {
11472
+ type: 'scale';
11473
+ property: ScalableProperty;
11474
+ layers: LayerSelector[];
11475
+ } |
11476
+ /** M2 — shows/hides the matched layers. */
11477
+ {
11478
+ type: 'visibility';
11479
+ layers: LayerSelector[];
11480
+ } |
11481
+ /**
11482
+ * M2 — sets a colour literal on the matched layers; `shades` are layers whose colour the style
11483
+ * derived from it (an outline, a tunnel variant) and that are re-derived by the same HSL offset.
11484
+ */
11485
+ {
11486
+ type: 'color';
11487
+ property: ColorProperty;
11488
+ layers: LayerSelector[];
11489
+ shades?: LayerSelector[];
11490
+ } |
11491
+ /** Sets the minimum zoom of the matched layers. */
11492
+ {
11493
+ type: 'minZoom';
11494
+ layers: LayerSelector[];
11495
+ } |
11496
+ /** Shifts the `["-", ["zoom"], offset]` density term inside the matched layers' filters. */
11497
+ {
11498
+ type: 'zoomOffset';
11499
+ layers: LayerSelector[];
11500
+ } |
11501
+ /** Map-level: the projection the whole map is drawn in. */
11502
+ {
11503
+ type: 'projection';
11504
+ } |
11505
+ /** Map-level: the sky/atmosphere (its colours come from the sibling colour knobs). */
11506
+ {
11507
+ type: 'sky';
11508
+ } |
11509
+ /** Map-level: 3D terrain from the style's raster-dem source (exaggeration from the sibling knob). */
11510
+ {
11511
+ type: 'terrain';
11512
+ } |
11513
+ /** Map-level: the colour behind the map canvas, which a globe leaves visible around the planet. */
11514
+ {
11515
+ type: 'space';
11516
+ } |
11517
+ /**
11518
+ * One of the ten semantic map colours: re-derives every literal it governs from the new colour,
11519
+ * keeping each one's HSL offset from the style's own base (the anchor).
11520
+ */
11521
+ {
11522
+ type: 'mapColor';
11523
+ color: MapColorName;
11524
+ };
11525
+ /** @ignore */
11526
+ type KnobDefinition = {
11527
+ kind: StylingKnobKind;
11528
+ description: string;
11529
+ range?: StylingKnobRange;
11530
+ /** The valid values of an `enum` knob. */
11531
+ options?: readonly string[];
11532
+ appliesTo: StylingKnobAppliesTo;
11533
+ mechanisms: KnobMechanism[];
11534
+ };
11535
+ type KnobDefinitionOf<KIND extends StylingKnobKind> = KnobDefinition & {
11536
+ kind: KIND;
11537
+ };
11538
+ /**
11539
+ * The styling knob catalogue: what the SDK can restyle on a TomTom standard style, and how.
11540
+ *
11541
+ * Ids are public API — additive only. Ranges follow TomTom Map Maker's validated grammar (factors
11542
+ * 0.5–1.5 in 0.1 steps) so a value that looks right in the designer's tool looks right here.
11543
+ * @ignore
11544
+ */
11545
+ declare const knobDefinitions: {
11546
+ readonly 'labels.sizeFactor': KnobDefinitionOf<"factor">;
11547
+ readonly 'symbols.sizeFactor': KnobDefinitionOf<"factor">;
11548
+ readonly 'roads.widthFactor': KnobDefinitionOf<"factor">;
11549
+ readonly 'pois.sizeFactor': KnobDefinitionOf<"factor">;
11550
+ readonly 'pois.minZoom': {
11551
+ readonly kind: "number";
11552
+ readonly description: "Zoom level from which base-map POIs appear (the style default is 6).";
11553
+ readonly range: {
11554
+ readonly min: 3;
11555
+ readonly max: 18;
11556
+ readonly step: 1;
11557
+ };
11558
+ readonly appliesTo: "tomtom-styles";
11559
+ readonly mechanisms: [{
11560
+ readonly type: "minZoom";
11561
+ readonly layers: [{
11562
+ readonly idExcludes: ["micro"];
11563
+ readonly metadataGroups?: string[];
11564
+ readonly layerTypes?: import("maplibre-gl").LayerSpecification["type"][];
11565
+ readonly sources?: string[];
11566
+ readonly sourceTypes?: string[];
11567
+ readonly sourceLayers?: string[];
11568
+ readonly idIncludes?: string[];
11569
+ }];
11570
+ }];
11571
+ };
11572
+ readonly 'pois.zoomShift': {
11573
+ readonly kind: "number";
11574
+ readonly description: "Shifts the zoom at which each POI appears: positive = later and sparser, negative = earlier and denser.";
11575
+ readonly range: {
11576
+ readonly min: -3;
11577
+ readonly max: 3;
11578
+ readonly step: 1;
11579
+ };
11580
+ readonly appliesTo: "tomtom-styles";
11581
+ readonly mechanisms: [{
11582
+ readonly type: "zoomOffset";
11583
+ readonly layers: [LayerSelector];
11584
+ }];
11585
+ };
11586
+ readonly 'pois.labelColor': KnobDefinitionOf<"color">;
11587
+ readonly 'pois.labelOutlineColor': KnobDefinitionOf<"color">;
11588
+ readonly 'pois.microMarkers': KnobDefinitionOf<"toggle">;
11589
+ readonly 'roads.exitNumbers': KnobDefinitionOf<"toggle">;
11590
+ readonly 'roads.shields': KnobDefinitionOf<"toggle">;
11591
+ readonly 'roads.arrows': KnobDefinitionOf<"toggle">;
11592
+ readonly 'roads.restricted': KnobDefinitionOf<"toggle">;
11593
+ readonly 'roads.underConstruction': KnobDefinitionOf<"toggle">;
11594
+ readonly 'buildings.footprints': KnobDefinitionOf<"toggle">;
11595
+ readonly 'buildings.3d': KnobDefinitionOf<"toggle">;
11596
+ readonly 'traffic.flow.freeColor': KnobDefinitionOf<"color">;
11597
+ readonly 'traffic.flow.slowColor': KnobDefinitionOf<"color">;
11598
+ readonly 'traffic.flow.queueingColor': KnobDefinitionOf<"color">;
11599
+ readonly 'traffic.flow.stationaryColor': KnobDefinitionOf<"color">;
11600
+ readonly 'traffic.flow.closedColor': KnobDefinitionOf<"color">;
11601
+ readonly 'traffic.flow.widthFactor': KnobDefinitionOf<"factor">;
11602
+ readonly 'traffic.incidents.minorColor': KnobDefinitionOf<"color">;
11603
+ readonly 'traffic.incidents.moderateColor': KnobDefinitionOf<"color">;
11604
+ readonly 'traffic.incidents.majorColor': KnobDefinitionOf<"color">;
11605
+ readonly 'traffic.incidents.closedColor': KnobDefinitionOf<"color">;
11606
+ readonly 'traffic.incidents.widthFactor': KnobDefinitionOf<"factor">;
11607
+ readonly 'colors.land': KnobDefinitionOf<"color">;
11608
+ readonly 'colors.water': KnobDefinitionOf<"color">;
11609
+ readonly 'colors.vegetation': KnobDefinitionOf<"color">;
11610
+ readonly 'colors.park': KnobDefinitionOf<"color">;
11611
+ readonly 'colors.artificial': KnobDefinitionOf<"color">;
11612
+ readonly 'colors.roadMajor': KnobDefinitionOf<"color">;
11613
+ readonly 'colors.road': KnobDefinitionOf<"color">;
11614
+ readonly 'colors.roadOutline': KnobDefinitionOf<"color">;
11615
+ readonly 'colors.label': KnobDefinitionOf<"color">;
11616
+ readonly 'colors.labelOutline': KnobDefinitionOf<"color">;
11617
+ readonly 'view.projection': {
11618
+ readonly kind: "enum";
11619
+ readonly description: "How the map is drawn: flat Mercator or a globe. The globe flattens to Mercator between zoom 11 and 12 by design.";
11620
+ readonly options: readonly ["mercator", "globe"];
11621
+ readonly appliesTo: "any-style";
11622
+ readonly mechanisms: [{
11623
+ readonly type: "projection";
11624
+ }];
11625
+ };
11626
+ readonly 'view.sky': {
11627
+ readonly kind: "toggle";
11628
+ readonly description: "A sky with atmosphere behind the globe and above a tilted flat map. Without it MapLibre draws a fully transparent sky, so a globe arrives with no atmosphere.";
11629
+ readonly appliesTo: "any-style";
11630
+ readonly mechanisms: [{
11631
+ readonly type: "sky";
11632
+ }];
11633
+ };
11634
+ readonly 'view.skyColor': {
11635
+ readonly kind: "color";
11636
+ readonly description: "Colour of the sky (and of the atmosphere halo around the globe). Defaults to a daylit blue on a light style and a night blue on a dark one.";
11637
+ readonly appliesTo: "any-style";
11638
+ readonly mechanisms: [{
11639
+ readonly type: "sky";
11640
+ }];
11641
+ };
11642
+ readonly 'view.horizonColor': {
11643
+ readonly kind: "color";
11644
+ readonly description: "Colour of the sky at the horizon. Defaults with the style theme, so a dark map gets a dim horizon rather than a white one.";
11645
+ readonly appliesTo: "any-style";
11646
+ readonly mechanisms: [{
11647
+ readonly type: "sky";
11648
+ }];
11649
+ };
11650
+ readonly 'view.spaceColor': {
11651
+ readonly kind: "color";
11652
+ readonly description: "Colour behind the map, which a globe leaves visible around the planet. The map canvas is transparent, so without this the page background shows through. Defaults with the style theme: white on a light style, near-black on a dark one.";
11653
+ readonly appliesTo: "any-style";
11654
+ readonly mechanisms: [{
11655
+ readonly type: "space";
11656
+ }];
11657
+ };
11658
+ readonly 'view.terrain': {
11659
+ readonly kind: "toggle";
11660
+ readonly description: "3D terrain from the style's elevation source (the hillshade style part). Needs a tilted camera to show; MapLibre's terrain fog starts at pitch 60, which is also its default maxPitch.";
11661
+ readonly appliesTo: "any-style";
11662
+ readonly mechanisms: [{
11663
+ readonly type: "terrain";
11664
+ }];
11665
+ };
11666
+ readonly 'view.terrainExaggeration': {
11667
+ readonly kind: "number";
11668
+ readonly description: "Vertical exaggeration of the 3D terrain (1 = true elevation).";
11669
+ readonly range: {
11670
+ readonly min: 0.5;
11671
+ readonly max: 3;
11672
+ readonly step: 0.1;
11673
+ };
11674
+ readonly appliesTo: "any-style";
11675
+ readonly mechanisms: [{
11676
+ readonly type: "terrain";
11677
+ }];
11678
+ };
11679
+ };
11680
+ /**
11681
+ * The id of a styling knob — see {@link StylingModule.describe} for what each one does.
11682
+ *
11683
+ * @group Map Styling
11684
+ */
11685
+ type StylingKnobId = keyof typeof knobDefinitions;
11686
+ /**
11687
+ * Every styling knob id, in catalogue order.
11688
+ *
11689
+ * @group Map Styling
11690
+ */
11691
+ export declare const stylingKnobIds: StylingKnobId[];
11692
+ /**
11693
+ * The id of a styling knob that holds a colour — every colour the styling module can name, and so
11694
+ * resolve against whichever style is loaded.
11695
+ *
11696
+ * @group Map Styling
11697
+ */
11698
+ type StylingColorKnobId = { [ID in StylingKnobId]: (typeof knobDefinitions)[ID]['kind'] extends 'color' ? ID : never; }[StylingKnobId];
11699
+ /**
11700
+ * Every colour knob id, in catalogue order.
11701
+ *
11702
+ * @group Map Styling
11703
+ */
11704
+ export declare const stylingColorKnobIds: StylingColorKnobId[];
11705
+ type ValueOfKind<KIND extends StylingKnobKind> = KIND extends 'toggle' ? boolean : KIND extends 'color' | 'enum' ? string : number;
11706
+ /**
11707
+ * The value type a given styling knob takes.
11708
+ *
11709
+ * @group Map Styling
11710
+ */
11711
+ type StylingKnobValueOf<ID extends StylingKnobId> = ValueOfKind<(typeof knobDefinitions)[ID]['kind']>;
11712
+ //#endregion
11713
+ //#region src/styling/StylingModule.d.ts
11714
+ /**
11715
+ * Event surface of {@link StylingModule}: it owns no map features, so only the lifecycle half is
11716
+ * live — `config-change` fires with the full {@link StylingSettings} after every knob change.
11717
+ *
11718
+ * @group Map Styling
11719
+ */
11720
+ export type StylingEvents = CombinedEvents<MapGeoJSONFeature, StylingSettings, never>;
11721
+ /**
11722
+ * Semantic styling of the base map, traffic and POIs — the tier between hiding a layer group and
11723
+ * hand-editing MapLibre layers.
11724
+ *
11725
+ * Every adjustable thing is a **knob** with a stable id, a kind, a range and a default read from the
11726
+ * loaded style. {@link describe} returns that catalogue as data, so a UI or an AI agent can build
11727
+ * controls, validate values and diff state without knowing anything about the style's layers.
11728
+ *
11729
+ * @remarks
11730
+ * **Which styles a knob works on** is `appliesTo` in the catalogue. `any-style` knobs (sizes,
11731
+ * widths) wrap whatever the style already does — `text-size: E` becomes `["*", 1.3, E]` — so they
11732
+ * work on a custom style too. `tomtom-styles` knobs (toggles, colours) reach their layers through
11733
+ * the TomTom styles this SDK version is verified against; on any other style they report
11734
+ * `available: false`, warn once and do nothing rather than failing silently.
11735
+ *
11736
+ * **Style changes.** Settings are re-applied after every `setStyle` that carries state over, on top of
11737
+ * whatever the other modules restored, and dropped on a clean switch (`resetState: true`).
11738
+ *
11739
+ * **Interplay with other modules.** Toggles set layer visibility, as {@link BaseMapModule} and
11740
+ * {@link POIsModule} do for whole groups; the later call wins. `pois.zoomShift` rewrites the POI
11741
+ * layer filters, which {@link POIsModule.filterCategories} also narrows: the two compose, so either
11742
+ * can be set at any time and neither drops the other.
10001
11743
  *
10002
11744
  * @example
10003
11745
  * ```typescript
10004
- * // Create the module
10005
- * const routingModule = await RoutingModule.create(map, {
10006
- * displayUnits: {
10007
- * distance: { type: 'metric' }
10008
- * }
10009
- * });
11746
+ * import { StylingModule } from '@tomtom-org/maps-sdk/map';
10010
11747
  *
10011
- * // Calculate and display a route
10012
- * const result = await calculateRoute({
10013
- * key: 'your-api-key',
10014
- * locations: [
10015
- * [4.9041, 52.3676], // Amsterdam
10016
- * [4.4777, 51.9244] // Rotterdam
10017
- * ],
10018
- * routeOptions: {
10019
- * travelMode: 'car',
10020
- * routeType: 'fastest'
10021
- * }
10022
- * });
11748
+ * const styling = await StylingModule.get(map);
11749
+ * styling.set('labels.sizeFactor', 1.2);
11750
+ * styling.set('roads.exitNumbers', false);
11751
+ * styling.set('traffic.flow.slowColor', '#f59e0b');
10023
11752
  *
10024
- * await routingModule.showRoutes(result);
11753
+ * // Everything a control panel or an agent needs, as data:
11754
+ * for (const knob of styling.describe().knobs) {
11755
+ * console.log(knob.id, knob.kind, knob.range, knob.current);
11756
+ * }
11757
+ *
11758
+ * // Serializable, diffable, re-applicable:
11759
+ * const saved = styling.getConfig();
11760
+ * styling.resetConfig();
11761
+ * styling.applyConfig(saved);
10025
11762
  * ```
10026
11763
  *
10027
- * @see [Routing Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/routing)
11764
+ * @see [Map Styling Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/styling)
10028
11765
  *
10029
- * @group Routing
11766
+ * @group Map Styling
10030
11767
  */
10031
- export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSourcesWithLayers, RoutingModuleConfig> {
10032
- private layersSpecs;
10033
- private layerIDPrefix;
10034
- private readonly shownFeaturesHandlers;
11768
+ export declare class StylingModule extends AbstractStyleOwnedMapModule<Record<string, never>, StylingSettings> {
11769
+ private originalValues;
11770
+ private mapLevelState;
11771
+ private styleSources;
11772
+ private resolved;
11773
+ private scaleKnobsByTarget;
11774
+ private mapColorTargetsByKey;
11775
+ private mapColorTargetsByKnob;
11776
+ private mapColorAnchors;
11777
+ private warned;
11778
+ private reindexed;
11779
+ private originalSpaceColor;
10035
11780
  /**
10036
- * Make sure the map is ready before create an instance of the module and any other interaction with the map
10037
- * @param tomtomMap The TomTomMap instance.
10038
- * @param config The module optional configuration
10039
- * @returns {Promise} Returns a promise with a new instance of this module
10040
- *
10041
- * @remarks
10042
- * **Instances:**
10043
- * `RoutingModule` owns the sources, layers and images it adds, all suffixed per instance. Every
10044
- * call therefore returns a **new, independent** instance, and stacking several of them on one
10045
- * map is a supported thing to do.
10046
- *
10047
- * **Configuration Options:**
10048
- * - `displayUnits`: Distance units (metric/imperial)
10049
- * - `waypointsSource`: Waypoint entry point options
10050
- * - `layers`: Complete layer styling configuration
11781
+ * Retrieves the styling module of the given map, creating it on first use.
10051
11782
  *
10052
- * **Default Styling:**
10053
- * If no custom layers are provided, uses {@link defaultRoutingLayers}.
11783
+ * @param map - The TomTomMap instance to style.
11784
+ * @param settings - Optional knob values to apply right away, e.g. restored from storage.
11785
+ * @returns A promise that resolves once the map style is loaded and the settings are applied.
10054
11786
  *
10055
- * @example
10056
- * Default initialization:
10057
- * ```typescript
10058
- * const routingModule = await RoutingModule.create(map);
10059
- * ```
11787
+ * @remarks
11788
+ * **Instances:** the module styles the sources and layers the map style already provides, so
11789
+ * every map has exactly one — a second `get()` returns the same instance, with the given
11790
+ * settings applied on top of what it already holds.
10060
11791
  *
10061
11792
  * @example
10062
- * With custom configuration:
10063
11793
  * ```typescript
10064
- * const routingModule = await RoutingModule.create(map, {
10065
- * displayUnits: 'imperial',
10066
- * waypointsSource: {
10067
- * entryPoints: 'main-when-available'
10068
- * }
10069
- * });
11794
+ * const styling = await StylingModule.get(map, { 'labels.sizeFactor': 1.2 });
10070
11795
  * ```
10071
11796
  */
10072
- static create(tomtomMap: TomTomMap, config?: RoutingModuleConfig): Promise<RoutingModule>;
11797
+ static get(map: TomTomMap, settings?: StylingSettings): Promise<StylingModule>;
10073
11798
  private constructor();
10074
- private createSourcesWithLayers;
10075
11799
  /**
10076
11800
  * @ignore
10077
11801
  */
10078
- protected _initSourcesWithLayers(config?: RoutingModuleConfig, restore?: boolean): RoutingSourcesWithLayers;
11802
+ protected styleChangePriority(): number;
10079
11803
  /**
10080
11804
  * @ignore
10081
11805
  */
10082
- protected _applyConfig(config?: RoutingModuleConfig): RoutingModuleConfig;
10083
- /** @ignore */
10084
- protected discardShownData(): void;
11806
+ protected _initSourcesWithLayers(): Record<string, never>;
10085
11807
  /**
10086
11808
  * @ignore
10087
11809
  */
10088
- protected restoreDataAndConfigImpl(): void;
10089
- private addImageIfNotExisting;
11810
+ protected _applyConfig(settings: StylingSettings | undefined): StylingSettings | undefined;
10090
11811
  /**
10091
- * Displays the given routes on the map.
10092
- *
10093
- * @param routes - Route data from Routing API or custom routes.
10094
- * @param options - Optional configuration for route selection and display.
10095
- * @param options.selectedIndex - Index of the route to display as selected (default: 0).
11812
+ * The styling catalogue for the loaded style: every knob with its kind, range, default, current
11813
+ * value and how many layers it reaches.
10096
11814
  *
10097
11815
  * @remarks
10098
- * **Waypoints are NOT shown by this method.**
10099
- * Route lines are drawn but start/stop/destination markers are not. To display waypoint
10100
- * markers, call {@link showWaypoints} separately. Alternatively, use
10101
- * {@link PlacesModule} to display waypoints as fully customizable place markers.
10102
- *
10103
- * **Behavior:**
10104
- * - Replaces any previously shown routes
10105
- * - Shows all route-related features: lines, sections, summaries, guidance
10106
- * - First route is selected by default (appears more prominent)
10107
- *
10108
- * **Route Features:**
10109
- * - Main route lines (selected and deselected styles)
10110
- * - Traffic sections with delays
10111
- * - Ferry, tunnel, and charged-road (`tollRoad`) sections
10112
- * - EV charging stations (for EV routes)
10113
- * - Turn-by-turn instruction lines and arrows
10114
- * - Summary bubbles with distance/time/traffic info
11816
+ * Meant to be consumed as data — build a control panel from it, hand it to an agent, or diff two
11817
+ * calls. Knob ids and the shape of the entries are public API and change additively only.
10115
11818
  *
10116
11819
  * @example
10117
- * Show a route (no waypoint markers):
10118
11820
  * ```typescript
10119
- * await routing.showRoutes(response.routes);
10120
- * // Waypoint markers are NOT shown — call showWaypoints() to add them
11821
+ * const { knobs } = styling.describe();
11822
+ * const sliders = knobs.filter((knob) => knob.kind === 'factor' && knob.available);
10121
11823
  * ```
11824
+ */
11825
+ describe(): StylingCatalogue;
11826
+ /**
11827
+ * Applies a preset: a named bundle of knob settings the SDK ships for a common intent
11828
+ * (`data-viz`, `night-driving`, `minimal`, `globe`, `terrain`). See `describe().presets` for
11829
+ * what each one sets.
10122
11830
  *
10123
- * @example
10124
- * Show routes and waypoint markers:
10125
- * ```typescript
10126
- * const locations = [[4.9, 52.4], [4.5, 51.9]];
10127
- * const response = await calculateRoute({ locations });
10128
- * await routing.showRoutes(response.routes);
10129
- * await routing.showWaypoints(locations); // Show start/destination markers separately
10130
- * ```
11831
+ * @param id - The preset to apply.
11832
+ * @param options - `merge: true` lays the preset over the current settings instead of replacing
11833
+ * them (the default), so knobs the preset does not mention keep their values.
11834
+ * @throws `Error` for an unknown preset id.
10131
11835
  *
10132
11836
  * @example
10133
- * Show multiple routes with specific selection:
10134
11837
  * ```typescript
10135
- * await routing.showRoutes(response.routes, { selectedIndex: 1 });
11838
+ * styling.applyPreset('data-viz');
11839
+ * styling.set('labels.sizeFactor', 1.1); // then adjust
11840
+ *
11841
+ * styling.applyPreset('globe', { merge: true }); // keep the rest, switch to a globe with a sky
10136
11842
  * ```
10137
11843
  */
10138
- showRoutes(routes: Route | Routes, options?: ShowRoutesOptions): Promise<void>;
11844
+ applyPreset(id: StylingPresetId, options?: {
11845
+ merge?: boolean;
11846
+ }): void;
10139
11847
  /**
10140
- * Clears any previously shown routes from the map.
11848
+ * The value a knob currently has: the override if one is set, otherwise the style's own default.
10141
11849
  *
10142
- * @remarks
10143
- * - Clears all route-related layers (lines, sections, guidance, summaries)
10144
- * - Does NOT clear waypoints (use {@link clearWaypoints})
10145
- * - Module remains initialized and ready for new routes
11850
+ * @param id - The knob to read.
11851
+ * @returns The current value, or `undefined` when the style defines it as a data-driven
11852
+ * expression that no single value stands for.
10146
11853
  *
10147
11854
  * @example
10148
11855
  * ```typescript
10149
- * await routing.clearRoutes();
11856
+ * styling.get('labels.sizeFactor'); // 1 until set
10150
11857
  * ```
10151
11858
  */
10152
- clearRoutes(): Promise<void>;
11859
+ get<ID extends StylingKnobId>(id: ID): StylingKnobValueOf<ID> | undefined;
10153
11860
  /**
10154
- * Changes which route appears as selected.
10155
- *
10156
- * @param index - Zero-based index of the route to select.
11861
+ * Sets one knob. The value is validated against the knob's kind and range before anything is
11862
+ * touched, and applied to every layer the knob reaches.
10157
11863
  *
10158
- * @remarks
10159
- * **Visual Changes:**
10160
- * - Selected route appears more prominent (thicker, brighter)
10161
- * - Previously selected route becomes deselected style
10162
- * - Updates all route-related features (sections, guidance)
10163
- *
10164
- * **Requirements:**
10165
- * - Route must already be displayed via {@link showRoutes}
10166
- * - Index must be within range of displayed routes
11864
+ * @param id - The knob to set; see {@link describe} for the catalogue.
11865
+ * @param value - A number for `factor`/`number` knobs (within `range`), a boolean for `toggle`
11866
+ * knobs, a CSS colour string for `color` knobs.
11867
+ * @throws `RangeError` when the value is not valid for the knob; `Error` for an unknown id.
10167
11868
  *
10168
11869
  * @example
10169
11870
  * ```typescript
10170
- * // Show multiple routes
10171
- * await routingModule.showRoutes(routes);
10172
- *
10173
- * // User clicks alternative route
10174
- * await routingModule.selectRoute(1);
10175
- *
10176
- * // Switch back to first route
10177
- * await routingModule.selectRoute(0);
11871
+ * styling.set('roads.widthFactor', 1.3);
11872
+ * styling.set('buildings.3d', true);
11873
+ * styling.set('traffic.flow.stationaryColor', 'hsl(0, 100%, 40%)');
10178
11874
  * ```
10179
11875
  */
10180
- selectRoute(index: number): Promise<void>;
11876
+ set<ID extends StylingKnobId>(id: ID, value: StylingKnobValueOf<ID>): void;
10181
11877
  /**
10182
- * Displays waypoint markers (start, stop, and destination pins) on the map.
10183
- *
10184
- * @param waypoints - An array of planning waypoints or a `Waypoints` FeatureCollection.
11878
+ * Restores the style's own values for one knob, or for all of them.
10185
11879
  *
10186
- * @remarks
10187
- * Waypoint markers are **not** shown by {@link showRoutes} — this method must be called
10188
- * separately to display them. For more control over marker appearance and behavior,
10189
- * consider using {@link PlacesModule} to render waypoints as place markers instead.
11880
+ * @param id - The knob to reset; omit to reset every knob (same as {@link resetConfig}).
10190
11881
  *
10191
11882
  * @example
10192
- * Show routes and then waypoints:
10193
11883
  * ```typescript
10194
- * const locations = [[4.9041, 52.3676], [4.4777, 51.9244]];
10195
- * const response = await calculateRoute({ locations });
10196
- * await routingModule.showRoutes(response.routes);
10197
- * await routingModule.showWaypoints(locations); // Must be called separately
11884
+ * styling.reset('labels.sizeFactor');
11885
+ * styling.reset(); // back to the style as shipped
10198
11886
  * ```
10199
11887
  */
10200
- showWaypoints(waypoints: PlanningWaypoint[] | Waypoints): Promise<void>;
10201
- /**
10202
- * Clears any previously shown waypoints from the map.
10203
- * If nothing was shown before, nothing happens.
10204
- */
10205
- clearWaypoints(): Promise<void>;
11888
+ reset(id?: StylingKnobId): void;
10206
11889
  /**
10207
- * Returns the currently shown routes and waypoints.
10208
- *
10209
- * @returns An object containing all currently displayed routing data.
11890
+ * Recolours the whole base map with up to ten semantic colours in one call — Map Maker's
11891
+ * Foundations palette, each listed with what it reaches under {@link MapColorName}. Partial
11892
+ * objects are fine; colours not given stay as they are.
10210
11893
  *
10211
11894
  * @remarks
10212
- * Returns the exact data that was passed to the `showRoutes()` and `showWaypoints()` methods.
11895
+ * Each colour re-derives every shade the style built from it — a trunk variant, an outline, a
11896
+ * tunnel — at the style's own HSL offset, so those relationships survive the recolour. The ten
11897
+ * are also the `colors.*` knobs, so `describe()`, `reset` and settings persistence apply.
10213
11898
  *
10214
- * **Returned Data:**
10215
- * - `mainLines`: Main route lines (selected and alternative)
10216
- * - `waypoints`: Route waypoints (start, stops, finish)
10217
- * - `incidents`: Traffic incidents on routes
10218
- * - `ferries`: Ferry sections
10219
- * - `chargingStops`: EV charging stations
10220
- * - `tollRoads`: Sections that cost money to drive — the `tollRoad` section type
10221
- * - `tunnels`: Tunnel sections
10222
- * - `vehicleRestricted`: Vehicle-restricted sections
10223
- * - `instructionLines`: Turn-by-turn instruction lines
10224
- * - `instructionArrows`: Instruction arrow markers
10225
- * - `summaryBubbles`: Route summary popups
11899
+ * Those offsets come off the loaded style, which makes a palette a recolour and not an
11900
+ * inversion: dark land over `standardLight` pushes the derived shades to the ends of their
11901
+ * range, so switch to `standardDark` first.
10226
11902
  *
10227
- * @example
10228
- * ```typescript
10229
- * const shown = routingModule.getShown();
10230
- * console.log(`Showing ${shown.mainLines.features.length} routes`);
10231
- * console.log(`Showing ${shown.waypoints.features.length} waypoints`);
10232
- * console.log(`Showing ${shown.chargingStops.features.length} charging stops`);
10233
- * ```
11903
+ * @param colors - The colours to set, as CSS colour strings.
11904
+ * @throws `RangeError` for a value that is not a colour; `Error` for an unknown colour name.
10234
11905
  *
10235
11906
  * @example
10236
- * Check if any routes are displayed:
10237
11907
  * ```typescript
10238
- * const shown = routingModule.getShown();
10239
- * if (shown.mainLines.features.length > 0) {
10240
- * console.log('Routes are displayed');
10241
- * } else {
10242
- * console.log('No routes displayed');
10243
- * }
11908
+ * styling.setMapColors({ land: '#f3f5f7', water: '#accbe2', roadMajor: '#a1b8ce', label: '#364659' });
11909
+ * styling.reset('colors.roadMajor'); // one colour back to the style
10244
11910
  * ```
10245
11911
  */
10246
- getShown(): {
10247
- mainLines: Routes<DisplayRouteProps>;
10248
- waypoints: Waypoints<WaypointDisplayProps>;
10249
- incidents: RouteSections<DisplayTrafficSectionProps>;
10250
- ferries: RouteSections;
10251
- chargingStops: Waypoints;
10252
- tollRoads: RouteSections;
10253
- tunnels: RouteSections;
10254
- vehicleRestricted: RouteSections;
10255
- instructionLines: DisplayInstructions;
10256
- instructionArrows: DisplayInstructionArrows;
10257
- summaryBubbles: DisplayRouteSummaries;
10258
- };
11912
+ setMapColors(colors: MapColors): void;
10259
11913
  /**
10260
- * Unified events interface for the routing module.
11914
+ * The style as currently rendered — the loaded style with every knob applied — as a MapLibre
11915
+ * style specification, to save, diff, serve yourself, or load back as a custom style.
10261
11916
  *
10262
- * `events` itself covers every route feature and the module's lifecycle events; the named
10263
- * scopes below cover one part of a route each, and every one of them can be narrowed further
10264
- * with `where()`.
11917
+ * @remarks
11918
+ * It includes whatever the SDK's data modules (places, routes) have on the map, and its tile
11919
+ * URLs carry the API key the map was created with: strip or rotate it before publishing.
11920
+ */
11921
+ exportStyle(): StyleSpecification;
11922
+ /**
11923
+ * Lifecycle events of this module. The module owns no map features, so there are no user
11924
+ * interaction events; `config-change` fires with the full settings after every knob change.
10265
11925
  *
11926
+ * @example
10266
11927
  * ```typescript
10267
- * routing.events.mainLines.on('click', (route) => { ... });
10268
- * routing.events.waypoints.on('hover', (waypoint) => { ... });
10269
- *
10270
- * // Only the long tunnels, with their own hover cursor:
10271
- * routing.events.tunnels
10272
- * .where((section) => section.properties.lengthInMeters > 500, { cursorOnHover: 'help' })
10273
- * .on('click', showTunnel);
10274
- *
10275
- * const unsub = routing.events.on('config-change', (config) => { ... });
10276
- * routing.events.on('shown-features', (features) => {
10277
- * if ('routes' in features) { ... }
10278
- * });
10279
- * unsub();
11928
+ * styling.events.on('config-change', (settings) => localStorage.setItem('styling', JSON.stringify(settings)));
10280
11929
  * ```
10281
11930
  */
10282
- get events(): RoutingEvents;
10283
- /**
10284
- * Returns the map style layer under which route lines are rendered.
10285
- * * Useful if you want to render extra layers just above the route ones but not on top of everything else.
10286
- * * It might differ depending on the loaded style/version.
10287
- */
10288
- getLayerToRenderLinesUnder(): string;
11931
+ get events(): StylingEvents;
11932
+ private indexStyle;
11933
+ private resolveMechanism;
11934
+ private capture;
11935
+ private originalValueOf;
11936
+ private resolveMapColor;
11937
+ private demSourceId;
11938
+ private refreshKnob;
11939
+ private refreshMechanism;
11940
+ private refreshSpace;
11941
+ private defaultSpaceColor;
11942
+ private refreshMapColorProperty;
11943
+ private refreshProjection;
11944
+ private refreshSky;
11945
+ private refreshTerrain;
11946
+ private refreshVisibility;
11947
+ private refreshMinZoom;
11948
+ private refreshZoomOffset;
11949
+ private refreshScaledProperty;
11950
+ private refreshColor;
11951
+ private setProperty;
11952
+ private describeKnob;
11953
+ private defaultOf;
11954
+ private mapLevelDefaultOf;
11955
+ private assertKnob;
11956
+ private validate;
11957
+ private warnOnce;
10289
11958
  }
10290
11959
  //#endregion
10291
11960
  //#region src/traffic/types/trafficAreaAnalyticsConfig.d.ts
@@ -10565,6 +12234,17 @@ type AreaAnalyticsRegionPolygonConfig = {
10565
12234
  */
10566
12235
  inverted?: boolean;
10567
12236
  };
12237
+ /**
12238
+ * The green / amber / red every metric's default colour stops and the `trafficLight` colour theme
12239
+ * are drawn from.
12240
+ *
12241
+ * @ignore
12242
+ */
12243
+ declare const TRAFFIC_LIGHT_COLORS: {
12244
+ readonly good: "#2dc653";
12245
+ readonly moderate: "#f5a623";
12246
+ readonly bad: "#e03030";
12247
+ };
10568
12248
  /**
10569
12249
  * Default values for all {@link TrafficAreaAnalyticsConfig} options.
10570
12250
  *
@@ -10585,10 +12265,16 @@ declare const AREA_ANALYTICS_DEFAULTS: {
10585
12265
  congestionLevel: {
10586
12266
  color: {
10587
12267
  valueType: "raw";
10588
- stops: {
12268
+ stops: ({
12269
+ value: number;
12270
+ color: "#2dc653";
12271
+ } | {
10589
12272
  value: number;
10590
- color: string;
10591
- }[];
12273
+ color: "#f5a623";
12274
+ } | {
12275
+ value: number;
12276
+ color: "#e03030";
12277
+ })[];
10592
12278
  };
10593
12279
  height: {
10594
12280
  maxHeightMeters: number;
@@ -10599,10 +12285,16 @@ declare const AREA_ANALYTICS_DEFAULTS: {
10599
12285
  speed: {
10600
12286
  color: {
10601
12287
  valueType: "relativeToPredefinedRangePCT";
10602
- stops: {
12288
+ stops: ({
12289
+ value: number;
12290
+ color: "#e03030";
12291
+ } | {
10603
12292
  value: number;
10604
- color: string;
10605
- }[];
12293
+ color: "#f5a623";
12294
+ } | {
12295
+ value: number;
12296
+ color: "#2dc653";
12297
+ })[];
10606
12298
  };
10607
12299
  height: {
10608
12300
  maxHeightMeters: number;
@@ -10613,10 +12305,16 @@ declare const AREA_ANALYTICS_DEFAULTS: {
10613
12305
  travelTime: {
10614
12306
  color: {
10615
12307
  valueType: "relativeToPredefinedRangePCT";
10616
- stops: {
12308
+ stops: ({
12309
+ value: number;
12310
+ color: "#2dc653";
12311
+ } | {
10617
12312
  value: number;
10618
- color: string;
10619
- }[];
12313
+ color: "#f5a623";
12314
+ } | {
12315
+ value: number;
12316
+ color: "#e03030";
12317
+ })[];
10620
12318
  };
10621
12319
  height: {
10622
12320
  maxHeightMeters: number;
@@ -10627,10 +12325,16 @@ declare const AREA_ANALYTICS_DEFAULTS: {
10627
12325
  freeFlowSpeed: {
10628
12326
  color: {
10629
12327
  valueType: "relativeToPredefinedRangePCT";
10630
- stops: {
12328
+ stops: ({
12329
+ value: number;
12330
+ color: "#e03030";
12331
+ } | {
10631
12332
  value: number;
10632
- color: string;
10633
- }[];
12333
+ color: "#f5a623";
12334
+ } | {
12335
+ value: number;
12336
+ color: "#2dc653";
12337
+ })[];
10634
12338
  };
10635
12339
  height: {
10636
12340
  maxHeightMeters: number;
@@ -10641,10 +12345,16 @@ declare const AREA_ANALYTICS_DEFAULTS: {
10641
12345
  networkLength: {
10642
12346
  color: {
10643
12347
  valueType: "relativeToActualRangePCT";
10644
- stops: {
12348
+ stops: ({
12349
+ value: number;
12350
+ color: "#2dc653";
12351
+ } | {
10645
12352
  value: number;
10646
- color: string;
10647
- }[];
12353
+ color: "#f5a623";
12354
+ } | {
12355
+ value: number;
12356
+ color: "#e03030";
12357
+ })[];
10648
12358
  };
10649
12359
  height: {
10650
12360
  maxHeightMeters: number;
@@ -11370,7 +13080,6 @@ type TrafficFlowSourcesWithLayers = {
11370
13080
  * @group Traffic Flow
11371
13081
  */
11372
13082
  export declare class TrafficFlowModule extends AbstractStyleOwnedMapModule<TrafficFlowSourcesWithLayers, FlowConfig> {
11373
- private originalFilters;
11374
13083
  /**
11375
13084
  * Retrieves a TrafficFlowModule instance for the given map.
11376
13085
  *
@@ -12124,7 +13833,6 @@ type TrafficIncidentsSourcesWithLayers = {
12124
13833
  * @group Traffic Incidents
12125
13834
  */
12126
13835
  export declare class TrafficIncidentsModule extends AbstractStyleOwnedMapModule<TrafficIncidentsSourcesWithLayers, IncidentsConfig> {
12127
- private originalFilters;
12128
13836
  /**
12129
13837
  * Retrieves a TrafficIncidentsModule instance for the given map.
12130
13838
  *
@@ -12368,6 +14076,20 @@ export declare class TrafficIncidentsModule extends AbstractStyleOwnedMapModule<
12368
14076
  get events(): CombinedEvents<TrafficIncidentsModuleFeature, IncidentsConfig, never>;
12369
14077
  }
12370
14078
  //#endregion
14079
+ //#region src/utils/colorUtils.d.ts
14080
+ /**
14081
+ * Red, green, blue and alpha of a colour, each 0–1.
14082
+ * @ignore
14083
+ */
14084
+ type RGBAColor = [number, number, number, number];
14085
+ /**
14086
+ * Parses any CSS colour a map style writes — `#rgb`, `#rrggbb(aa)`, `rgb()`/`rgba()` in numbers or
14087
+ * percentages, `hsl()`/`hsla()`, `transparent` and the named colours — or `undefined` for a string
14088
+ * that is not one.
14089
+ * @ignore
14090
+ */
14091
+ export declare const parseCssColor: (cssColor: string) => RGBAColor | undefined;
14092
+ //#endregion
12371
14093
  //#region src/utils/types/paddedBounds.d.ts
12372
14094
  /**
12373
14095
  * Options for calculating map center.
@@ -12448,4 +14170,4 @@ export declare const calculatePaddedCenter: (options: CalculateMapCenterOptions)
12448
14170
  */
12449
14171
  export declare const calculateFittingBBox: (options: CalculateFittingBBoxOptions) => BBox | null;
12450
14172
  //#endregion
12451
- export type { AREA_ANALYTICS_DEFAULTS, AreaAnalyticsBeforeLayerConfig, AreaAnalyticsColorStop, AreaAnalyticsColorStopsConfig, AreaAnalyticsColorTheme, AreaAnalyticsDisplayMode, AreaAnalyticsHeightConfig, AreaAnalyticsMetricConfig, AreaAnalyticsMetricFilter, AreaAnalyticsRegionPolygonConfig, AreaAnalyticsValueType, AvailabilityLevel, BeforeLayerConfig, ByIdOrIndex, CSSCursor, ChargingSpeedIconMapping, ChargingStopIconConfig, ChargingStopIconMapping, ChargingStopTextConfig, ChargingStopsConfig, CleanEventStateOptions, CleanEventStatesOptions, ClickEventType, CustomImage, DefaultPlaceIconConfig, DisplayRouteProps, DisplayRouteRelatedProps, DisplayRouteSummaries, DisplayRouteSummary, DisplayRouteSummaryProps, EVAvailabilityConfig, EventHandlerConfig, EventHandlerCursorConfig, EventType, FilterShowMode, FilterablePOICategory, GeoJSONSourcesWithLayers, HasAdditionalLayersConfig, HasBeforeID, HillshadeModuleConfig, HoverEventType, IncidentFocusStyle, LayerSpecFilter, LayerSpecTemplate, LayerSpecWithSource, LightDark, MapEventsConfig, MapFont, MapModuleCommonConfig, MapStyleLayerID, POIsModuleConfig, POIsModuleFeature, PlaceConnectionDisplay, PlaceConnectionLayerName, PlaceConnectionsConfig, PlaceConnectionsLayersConfig, PlaceIconConfig, PlaceLayerName, PlaceLayersConfig, PlaceTextConfig, PlacesModuleConfig, PlacesTheme, PlanningWaypoint, PutEventStateOptions, RouteLayersConfig, RouteStateProps, RouteTheme, RouteWaypointSize, RouteWidth, RoutingModuleConfig, SVGIconStyleOptions, SourceWithLayerIDs, SourceWithLayers, SourcesWithLayers, StyleSourcesWithLayers, SupportsEvents, SymbolLayerSpecWithoutSource, ToBeAddedLayerSpec, ToBeAddedLayerSpecTemplate, ToBeAddedLayerSpecWithoutSource, TrafficAreaAnalyticsConfig, TrafficIncidentOverlayConfig, UserEventHandler, ValuesFilter, WaypointsConfig };
14173
+ export type { AREA_ANALYTICS_DEFAULTS, AreaAnalyticsBeforeLayerConfig, AreaAnalyticsColorStop, AreaAnalyticsColorStopsConfig, AreaAnalyticsColorTheme, AreaAnalyticsDisplayMode, AreaAnalyticsHeightConfig, AreaAnalyticsMetricConfig, AreaAnalyticsMetricFilter, AreaAnalyticsRegionPolygonConfig, AreaAnalyticsValueType, AvailabilityLevel, BeforeLayerConfig, BespokeSectionType, ByIdOrIndex, CSSCursor, ChargingSpeedIconMapping, ChargingStopIconConfig, ChargingStopIconMapping, ChargingStopTextConfig, ChargingStopsConfig, CleanEventStateOptions, CleanEventStatesOptions, ClickEventType, CountryCrossingAlignment, CountryCrossingConfig, CountryCrossingFeature, CustomImage, DefaultPlaceIconConfig, DisplayCountryCrossing, DisplayCountryCrossingProps, DisplayCountryCrossings, DisplayRouteProps, DisplayRouteRelatedProps, DisplayRouteSummaries, DisplayRouteSummary, DisplayRouteSummaryProps, DrawnSectionType, EVAvailabilityConfig, EventHandlerConfig, EventHandlerCursorConfig, EventType, ExtraFeatureProp, FeaturePropValue, FilterShowMode, FilterablePOICategory, GeneratedSectionType, GeoJSONSourcesWithLayers, HasAdditionalLayersConfig, HasBeforeID, HillshadeModuleConfig, HoverEventType, IncidentFocusStyle, LayerSpecFilter, LayerSpecTemplate, LayerSpecWithSource, LightDark, MapColorName, MapColors, MapEventsConfig, MapFont, MapModuleCommonConfig, MapStyleLayerID, POIsModuleConfig, POIsModuleFeature, PlaceConnectionDisplay, PlaceConnectionLayerName, PlaceConnectionsConfig, PlaceConnectionsLayersConfig, PlaceIconConfig, PlaceLayerName, PlaceLayersConfig, PlaceTextConfig, PlacesModuleConfig, PlacesTheme, PlanningWaypoint, PutEventStateOptions, RGBAColor, RouteLayersConfig, RouteStateProps, RouteTheme, RouteWaypointSize, RouteWidth, RoutingModuleConfig, SVGIconStyleOptions, SectionDisplayConfig, SectionDrawStyle, SectionIconConfig, SectionKnobName, SectionKnobOf, SectionLineLayerName, SectionLinePattern, SectionSignConfig, SectionSignLayerName, SectionSignPlacement, SectionSignPriority, SectionSignUnit, SectionSourceKey, SectionSymbolLayerName, SectionsDisplayConfig, SourceWithLayerIDs, SourceWithLayers, SourcesWithLayers, StyleSourcesWithLayers, StylingCatalogue, StylingColorKnobId, StylingKnobAppliesTo, StylingKnobDescriptor, StylingKnobId, StylingKnobKind, StylingKnobRange, StylingKnobValue, StylingKnobValueOf, StylingPresetDescriptor, StylingPresetId, StylingSettings, SupportsEvents, SymbolLayerSpecWithoutSource, TRAFFIC_LIGHT_COLORS, ToBeAddedLayerSpec, ToBeAddedLayerSpecTemplate, ToBeAddedLayerSpecWithoutSource, TrafficAreaAnalyticsConfig, TrafficIncidentOverlayConfig, UserEventHandler, ValuesFilter, WaypointsConfig };