@tomtom-org/maps-sdk 0.52.0 → 0.54.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,4 +1,4 @@
1
- import { BackgroundLayerSpecification, CircleLayerSpecification, DataDrivenPropertyValueSpecification, ExpressionFilterSpecification, ExpressionSpecification, GeoJSONSource, GeoJSONSourceSpecification, LayerSpecification, LegacyFilterSpecification, LineLayerSpecification, LngLat, Map, MapGeoJSONFeature, MapOptions, Source, SourceSpecification, StyleImageInterface, StyleImageMetadata, StyleSpecification, SymbolLayerSpecification } from "maplibre-gl";
1
+ import { BackgroundLayerSpecification, CircleLayerSpecification, DataDrivenPropertyValueSpecification, ExpressionSpecification, GeoJSONSource, GeoJSONSourceSpecification, LayerSpecification, LineLayerSpecification, LngLat, Map, MapGeoJSONFeature, MapOptions, Source, SourceSpecification, StyleImageInterface, StyleImageMetadata, StyleSpecification, SymbolLayerSpecification } from "maplibre-gl";
2
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";
3
3
  //#region src/init/types/mapEventsConfig.d.ts
4
4
  /**
@@ -192,6 +192,15 @@ type MapEventsConfig = EventHandlerCursorConfig & {
192
192
  longHoverDelayOnStillMapMS?: number;
193
193
  };
194
194
  //#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
195
204
  //#region src/init/types/mapInit.d.ts
196
205
  /**
197
206
  * Array of all available standard style identifiers.
@@ -397,6 +406,27 @@ export type CustomStyle = {
397
406
  * ```
398
407
  */
399
408
  json?: StyleSpecification;
409
+ /**
410
+ * Whether the style draws a light or a dark map.
411
+ *
412
+ * Overlays that are drawn on top of the style — places, routes, waypoint labels, the pin
413
+ * sprite — pick their colours from this, so that their text stays legible on the canvas
414
+ * underneath. {@link TomTomMap.styleLightDarkTheme} reports the value in effect.
415
+ *
416
+ * Leave it out and the SDK reads the theme off the loaded style, from the colour its
417
+ * `background` layer paints the canvas with. Set it when that guess is wrong or when you
418
+ * would rather not depend on a guess: a style whose canvas is hidden behind full-coverage
419
+ * imagery, or one whose background colour does not represent what the map ends up looking
420
+ * like.
421
+ *
422
+ * @default Read from the background colour of the loaded style, falling back to `'light'`
423
+ *
424
+ * @example
425
+ * ```typescript
426
+ * style: { type: 'custom', url: 'https://example.com/midnight.json', lightDarkTheme: 'dark' }
427
+ * ```
428
+ */
429
+ lightDarkTheme?: LightDark;
400
430
  };
401
431
  /**
402
432
  * Array of all available style modules.
@@ -618,21 +648,77 @@ export type StyleChangeHandler = {
618
648
  *
619
649
  * @remarks
620
650
  * Use this to perform cleanup or save state before the current style is removed.
621
- * This method can be synchronous or asynchronous.
651
+ * This method can be synchronous or asynchronous: the SDK awaits it before handing the new
652
+ * style to MapLibre, so nothing of the old style is torn down while it runs.
622
653
  *
654
+ * @param context - What kind of switch is happening; see {@link StyleChangeContext}.
623
655
  * @returns void or a Promise that resolves when preparation is complete
624
656
  */
625
- onStyleAboutToChange?: () => void | Promise<void>;
657
+ onStyleAboutToChange?: (context: StyleChangeContext) => void | Promise<void>;
626
658
  /**
627
659
  * Callback invoked after a new style has been fully loaded.
628
660
  *
629
661
  * @remarks
630
662
  * Use this to restore state, reinitialize layers, or perform other setup
631
- * that depends on the new style being ready. This method can be synchronous or asynchronous.
663
+ * that depends on the new style being ready. This method can be synchronous or asynchronous:
664
+ * handlers run one after the other, in registration order, and the promise returned by
665
+ * {@link TomTomMap.setStyle} resolves only once the last one has finished.
632
666
  *
667
+ * @param context - What kind of switch is happening; see {@link StyleChangeContext}.
633
668
  * @returns void or a Promise that resolves when reinitialization is complete
634
669
  */
635
- onStyleChanged?: () => void | Promise<void>;
670
+ onStyleChanged?: (context: StyleChangeContext) => void | Promise<void>;
671
+ };
672
+ /**
673
+ * What a {@link StyleChangeHandler} is told about the style switch it is reacting to.
674
+ *
675
+ * @remarks
676
+ * The SDK's own modules read `resetState` to decide between restoring themselves (data, config,
677
+ * filters) onto the new style, or re-binding to it with defaults and nothing shown. Your handlers
678
+ * get the same information, so a custom overlay can make the same choice.
679
+ *
680
+ * @example
681
+ * ```typescript
682
+ * map.addStyleChangeHandler({
683
+ * onStyleChanged: ({ resetState }) => {
684
+ * if (resetState) dropCustomLayers();
685
+ * else reattachCustomLayers();
686
+ * },
687
+ * });
688
+ * ```
689
+ *
690
+ * @group Map Style
691
+ */
692
+ export type StyleChangeContext = {
693
+ /**
694
+ * `true` for a clean switch (`setStyle(style, { resetState: true })`), `false` when the switch
695
+ * carries SDK state over (`setStyle(style)` or `setStyle(style, { resetState: false })`).
696
+ */
697
+ resetState: boolean;
698
+ };
699
+ /**
700
+ * Options accepted by {@link TomTomMap.setStyle}.
701
+ *
702
+ * @group Map Style
703
+ */
704
+ export type SetStyleOptions = {
705
+ /**
706
+ * Whether to drop the SDK state instead of carrying it over to the new style.
707
+ *
708
+ * - `false` (default): module data and configuration, filters and the style parts of the
709
+ * previous style (traffic, hillshade) are restored onto the new style.
710
+ * - `true`: a clean switch. Modules re-bind to the new style with default configuration and
711
+ * nothing shown, and only the style parts named in the new style input are loaded.
712
+ *
713
+ * The map language is not SDK state: it is re-applied in both cases, and only
714
+ * {@link TomTomMap.setLanguage} changes it.
715
+ *
716
+ * Registered {@link StyleChangeHandler}s run in both cases and receive the value in their
717
+ * {@link StyleChangeContext}.
718
+ *
719
+ * @default false
720
+ */
721
+ resetState?: boolean;
636
722
  };
637
723
  /**
638
724
  * Main TomTom Map class for displaying interactive maps in web applications.
@@ -754,7 +840,7 @@ export declare class TomTomMap {
754
840
  * });
755
841
  * ```
756
842
  *
757
- * @see {@link https://maplibre.org/maplibre-gl-js-docs/api/map/ | MapLibre Map Documentation}
843
+ * @see {@link https://maplibre.org/maplibre-gl-js/docs/API/classes/Map/ | MapLibre Map Documentation}
758
844
  */
759
845
  readonly mapLibreMap: Map;
760
846
  /**
@@ -765,8 +851,32 @@ export declare class TomTomMap {
765
851
  * @ignore
766
852
  */
767
853
  _params: InternalTomTomMapParams;
768
- styleLightDarkTheme: LightDark;
854
+ /**
855
+ * Whether the loaded style draws a light or a dark map.
856
+ *
857
+ * @remarks
858
+ * The SDK's own overlays read it to pick text and halo colours that stay legible over the
859
+ * base map, and it is the property to bind your own UI to rather than parsing the style ID.
860
+ *
861
+ * A standard style is classified from its ID. A custom style reads `'light'` until it has
862
+ * loaded — nothing about it is known before that — and is then classified from the colour its
863
+ * `background` layer paints the canvas with; a custom style with no readable background colour
864
+ * stays `'light'`. So read it inside an
865
+ * {@link TomTomMap.addStyleChangeHandler | onStyleChanged} handler, or after awaiting
866
+ * {@link setStyle}, rather than right after calling it.
867
+ *
868
+ * @example
869
+ * ```typescript
870
+ * await map.setStyle({ type: 'custom', url: 'https://example.com/my-style.json' });
871
+ * document.body.classList.toggle('dark-mode', map.styleLightDarkTheme === 'dark');
872
+ * ```
873
+ */
874
+ get styleLightDarkTheme(): LightDark;
875
+ private _styleLightDarkTheme;
769
876
  private readonly styleChangeHandlers;
877
+ private styleGivenToMapLibre;
878
+ private styleRequestSequence;
879
+ private styleLoadInFlight;
770
880
  /**
771
881
  * Constructs a new TomTom Map instance and attaches it to a DOM element.
772
882
  *
@@ -830,9 +940,9 @@ export declare class TomTomMap {
830
940
  *
831
941
  * @see {@link MapLibreOptions}
832
942
  * @see {@link TomTomMapParams}
833
- * @see {@link https://maplibre.org/maplibre-gl-js-docs/api/map/ | MapLibre Map Parameters}
943
+ * @see {@link https://maplibre.org/maplibre-gl-js/docs/API/classes/Map/ | MapLibre Map Parameters}
834
944
  * @see [Map Quickstart Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/quickstart)
835
- * @see [Map Styles Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/map-styles)
945
+ * @see [Map Styles Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/styles)
836
946
  * @see [User Interaction Events Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/user-events)
837
947
  */
838
948
  constructor(mapParams: TomTomMapParams);
@@ -845,27 +955,35 @@ export declare class TomTomMap {
845
955
  * Changes the map style dynamically without reloading the entire map.
846
956
  *
847
957
  * @param style - The new style to apply. Can be a string ID or a detailed style configuration.
848
- * @param options - Configuration options for the style change behavior.
849
- * @param options.keepState - Whether to preserve SDK-rendered items and configurations when changing styles.
850
- * When `true` (default), maintains traffic layers, routes, markers, and other SDK features.
851
- * When `false`, performs a clean style switch without preserving previous state.
958
+ * @param options - Configuration options for the style change behavior, see {@link SetStyleOptions}.
959
+ * @returns A promise that resolves once the new style is loaded and every registered
960
+ * {@link StyleChangeHandler} has finished — including the SDK modules restoring themselves.
961
+ * Awaiting it is optional; it is the moment after which the map is safe to read and draw on again.
962
+ * @throws If the style itself fails to load, leaving {@link mapReady} `false` and the map on
963
+ * the style it had. A tile or source that fails to load does not fail the switch.
852
964
  *
853
965
  * @remarks
854
- * **Behavior:**
855
- * - Temporarily sets {@link mapReady} to `false` during the transition
856
- * - Triggers all registered {@link StyleChangeHandler} callbacks
857
- * - Resets {@link mapReady} to `true` when the new style is fully loaded
858
- *
859
- * **State Preservation (keepState: true):**
966
+ * **Carried-over state (the default):**
860
967
  * - Merges style parts from the previous style with the new one
861
- * - Maintains SDK module layers (traffic, routes, POIs, etc.)
862
- * - Preserves language settings
968
+ * - Restores SDK module data and configuration (traffic, routes, POIs, etc.)
863
969
  *
864
- * **Clean Switch (keepState: false):**
865
- * - Applies the new style without merging previous configuration
866
- * - Removes all SDK module layers
970
+ * **Clean switch (resetState: true):**
971
+ * - Applies exactly the style you passed, without merging previous style parts
972
+ * - SDK modules re-bind to the new style with default configuration and nothing shown
867
973
  * - Useful for complete style resets
868
974
  *
975
+ * Both keep the map language: it is configuration, not state, and it survives every style
976
+ * change until {@link setLanguage} changes it.
977
+ *
978
+ * **Behavior:**
979
+ * - Sets {@link mapReady} to `false` for the duration of the transition
980
+ * - Awaits every `onStyleAboutToChange` handler, then hands the new style to MapLibre
981
+ * - Once the style has loaded, sets {@link mapReady} back to `true` and awaits every
982
+ * `onStyleChanged` handler in registration order
983
+ * - A `setStyle` call made while another one is still in flight supersedes it: the older
984
+ * call's style is never applied and its promise resolves as soon as that is known
985
+ * - Passing the style already loaded runs the whole lifecycle without reloading it, which is
986
+ * how `resetState: true` doubles as a reset of the SDK modules over the current style
869
987
  * @example
870
988
  * Simple style change:
871
989
  * ```typescript
@@ -874,6 +992,13 @@ export declare class TomTomMap {
874
992
  * ```
875
993
  *
876
994
  * @example
995
+ * Wait for the switch to complete before drawing on the map:
996
+ * ```typescript
997
+ * await map.setStyle('standardDark');
998
+ * // modules have restored themselves; map.mapReady is true again
999
+ * ```
1000
+ *
1001
+ * @example
877
1002
  * Style change with detailed configuration:
878
1003
  * ```typescript
879
1004
  * map.setStyle({
@@ -887,7 +1012,7 @@ export declare class TomTomMap {
887
1012
  * Clean style switch without state preservation:
888
1013
  * ```typescript
889
1014
  * // Complete reset - removes all SDK layers and modules
890
- * map.setStyle('standardDark', { keepState: false });
1015
+ * map.setStyle('standardDark', { resetState: true });
891
1016
  * ```
892
1017
  *
893
1018
  * @example
@@ -908,11 +1033,13 @@ export declare class TomTomMap {
908
1033
  * @see {@link TomTomMapParams.style} - For setting style during initialization
909
1034
  * @see {@link StyleChangeHandler} - For handling style change events
910
1035
  * @see {@link getStyle} - For retrieving the current style
911
- * @see [Map Styles Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/map-styles)
1036
+ * @see [Map Styles Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/styles)
912
1037
  */
913
- setStyle: (style: StyleInput, options?: {
914
- keepState?: boolean;
915
- }) => void;
1038
+ setStyle: (style: StyleInput, options?: SetStyleOptions) => Promise<void>;
1039
+ private applyStyle;
1040
+ private loadIntoMapLibre;
1041
+ private isSuperseded;
1042
+ private notifyHandlers;
916
1043
  /**
917
1044
  * Retrieves the current style configuration of the map.
918
1045
  *
@@ -986,7 +1113,9 @@ export declare class TomTomMap {
986
1113
  * - When using locale codes (with `-`), only the language portion is used for labels
987
1114
  *
988
1115
  * **Persistence:**
989
- * - Language setting persists across style changes (when `keepState: true`)
1116
+ * - The language persists across every style change, a clean switch
1117
+ * ({@link SetStyleOptions.resetState}) included: it is map configuration rather than SDK
1118
+ * state, and this method is the only thing that changes it
990
1119
  * - Set during initialization via {@link TomTomMapParams.language} for immediate application
991
1120
  *
992
1121
  * @example
@@ -1022,7 +1151,7 @@ export declare class TomTomMap {
1022
1151
  /**
1023
1152
  * Retrieves the current visible map area as a GeoJSON bounding box.
1024
1153
  *
1025
- * @returns A {@link https://tools.ietf.org/html/rfc7946#section-5 | GeoJSON BBox} array
1154
+ * @returns A {@link https://datatracker.ietf.org/doc/html/rfc7946#section-5 | GeoJSON BBox} array
1026
1155
  * in the format `[west, south, east, north]` representing the map's current viewport bounds.
1027
1156
  *
1028
1157
  * @remarks
@@ -1063,8 +1192,8 @@ export declare class TomTomMap {
1063
1192
  * map.mapLibreMap.fitBounds([[west, south], [east, north]]);
1064
1193
  * ```
1065
1194
  *
1066
- * @see {@link https://tools.ietf.org/html/rfc7946#section-5 | GeoJSON BBox Specification}
1067
- * @see {@link https://maplibre.org/maplibre-gl-js-docs/api/geography/#lnglatbounds | MapLibre LngLatBounds}
1195
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc7946#section-5 | GeoJSON BBox Specification}
1196
+ * @see {@link https://maplibre.org/maplibre-gl-js/docs/API/classes/LngLatBounds/ | MapLibre LngLatBounds}
1068
1197
  */
1069
1198
  getBBox(): BBox;
1070
1199
  private handleStyleData;
@@ -1092,13 +1221,16 @@ export declare class TomTomMap {
1092
1221
  *
1093
1222
  * **Multiple Handlers:**
1094
1223
  * - Multiple handlers can be registered and will all be called in registration order
1224
+ * - Async callbacks are awaited one after the other; the promise returned by {@link setStyle}
1225
+ * resolves once the last one has finished
1095
1226
  * - Each handler's errors are caught independently and logged to the console
1096
1227
  * - One failing handler won't prevent others from executing
1097
1228
  *
1098
1229
  * **Important Notes:**
1099
1230
  * - Handlers are only triggered by {@link setStyle} calls, not initial map construction
1100
- * - Only called when `keepState: true` in {@link setStyle} options
1101
- * - Handlers persist for the lifetime of the TomTomMap instance
1231
+ * - Handlers run for a clean switch as well as for one that carries state over, and receive
1232
+ * which one it is in their {@link StyleChangeContext}
1233
+ * - Handlers persist for the lifetime of the TomTomMap instance unless unsubscribed
1102
1234
  *
1103
1235
  * @example
1104
1236
  * Basic usage:
@@ -1257,8 +1389,10 @@ export declare class TomTomMap {
1257
1389
  * the corresponding reference layers in the new style, maintaining the intended visual hierarchy.
1258
1390
  *
1259
1391
  * **Important Notes:**
1260
- * - `lowestBuilding` is not available in the Satellite style
1261
- * - If a reference layer doesn't exist, custom layers will be added on top of the style
1392
+ * - `lowestRoadLine` and `lowestBuilding` are not available in the Satellite style
1393
+ * - If a reference layer doesn't exist, a module repositioning its layers puts them on top of the
1394
+ * style instead. A layer added with a `beforeID` that never appears is reported through
1395
+ * `console.error` and skipped, since a missing anchor there is usually a typo.
1262
1396
  * - Both RoutingModule and GeometriesModule default to `lowestLabel` for optimal visibility
1263
1397
  *
1264
1398
  * @see {@link GeometryBeforeLayerConfig} for GeometriesModule layer positioning options
@@ -1312,6 +1446,8 @@ export declare const mapStyleLayerIDs: {
1312
1446
  * Represents tunnel railway outlines. Use to position content below the road network,
1313
1447
  * useful for showing base layers or features that should appear beneath transportation
1314
1448
  * infrastructure.
1449
+ *
1450
+ * **Note:** Not available in the Satellite style.
1315
1451
  */
1316
1452
  readonly lowestRoadLine: "Tunnel - Railway outline";
1317
1453
  /**
@@ -1715,6 +1851,20 @@ type SourceWithLayers = StyleSourceWithLayers | GeoJSONSourceWithLayers;
1715
1851
  type SourcesWithLayers = {
1716
1852
  [name: string]: SourceWithLayers;
1717
1853
  };
1854
+ /**
1855
+ * The sources a style-owned module controls, keyed by the name the module gives them.
1856
+ * @ignore
1857
+ */
1858
+ type StyleSourcesWithLayers = {
1859
+ [name: string]: StyleSourceWithLayers;
1860
+ };
1861
+ /**
1862
+ * The sources a data-owned module adds and owns, keyed by the name the module gives them.
1863
+ * @ignore
1864
+ */
1865
+ type GeoJSONSourcesWithLayers = {
1866
+ [name: string]: GeoJSONSourceWithLayers;
1867
+ };
1718
1868
  /**
1719
1869
  * Contains the IDs of a source and its related layers.
1720
1870
  *
@@ -2455,6 +2605,46 @@ type CustomImage<I extends string = string> = {
2455
2605
  * ```
2456
2606
  */
2457
2607
  availabilityLevel?: AvailabilityLevel;
2608
+ /**
2609
+ * Horizontal offset of the icon from its anchor point, in pixels.
2610
+ *
2611
+ * @remarks
2612
+ * Positive values shift the icon right, negative values shift it left.
2613
+ * The offset is applied before `icon-size` scaling, matching the
2614
+ * MapLibre `icon-offset` convention.
2615
+ *
2616
+ * Only takes effect when `image` is also provided — an icon referencing an
2617
+ * existing sprite icon by `id` alone ignores `offsetX`/`offsetY`.
2618
+ *
2619
+ * @default 0
2620
+ *
2621
+ * @example
2622
+ * ```typescript
2623
+ * // Shift the icon 10px to the right of its coordinate
2624
+ * offsetX: 10
2625
+ * ```
2626
+ */
2627
+ offsetX?: number;
2628
+ /**
2629
+ * Vertical offset of the icon from its anchor point, in pixels.
2630
+ *
2631
+ * @remarks
2632
+ * Positive values shift the icon down, negative values shift it up.
2633
+ * The offset is applied before `icon-size` scaling, matching the
2634
+ * MapLibre `icon-offset` convention.
2635
+ *
2636
+ * Only takes effect when `image` is also provided — an icon referencing an
2637
+ * existing sprite icon by `id` alone ignores `offsetX`/`offsetY`.
2638
+ *
2639
+ * @default 0
2640
+ *
2641
+ * @example
2642
+ * ```typescript
2643
+ * // Shift the icon 10px above its coordinate
2644
+ * offsetY: -10
2645
+ * ```
2646
+ */
2647
+ offsetY?: number;
2458
2648
  };
2459
2649
  /**
2460
2650
  * Options to style SDK SVG icons with custom colors and opacity.
@@ -2484,25 +2674,6 @@ type SVGIconStyleOptions = {
2484
2674
  outlineOpacity?: number;
2485
2675
  };
2486
2676
  //#endregion
2487
- //#region src/shared/types/mapLibreUtils.d.ts
2488
- /**
2489
- * @ignore
2490
- */
2491
- type FilterSyntaxVersion = 'expression' | 'legacy';
2492
- /**
2493
- * @ignore
2494
- */
2495
- type MultiSyntaxFilter = {
2496
- /**
2497
- * Filter expression following the new expression syntax.
2498
- */
2499
- expression: ExpressionFilterSpecification;
2500
- /**
2501
- * Filter expression following the legacy syntax.
2502
- */
2503
- legacy: LegacyFilterSpecification;
2504
- };
2505
- //#endregion
2506
2677
  //#region src/shared/types/mapModule.d.ts
2507
2678
  /**
2508
2679
  * Contains configuration options common to all map modules.
@@ -2516,15 +2687,6 @@ type MapModuleCommonConfig = {
2516
2687
  events?: EventHandlerConfig;
2517
2688
  };
2518
2689
  //#endregion
2519
- //#region src/shared/types/style.d.ts
2520
- /**
2521
- * Indicator of a light or dark theme.
2522
- * * 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.
2523
- *
2524
- * @group Map Style
2525
- */
2526
- type LightDark = 'light' | 'dark';
2527
- //#endregion
2528
2690
  //#region src/shared/eventScope.d.ts
2529
2691
  /**
2530
2692
  * What `where()` accepts: a predicate over the feature type this surface exposes, or — where the
@@ -3461,10 +3623,6 @@ type EventScopeOptions<T, WHERE_SCOPE> = {
3461
3623
  /** Resolves a module-specific scope object, such as BaseMapModule's `{ layerGroups }`. */
3462
3624
  scopeResolver?: (scope: WHERE_SCOPE) => ResolvedEventScope;
3463
3625
  };
3464
- /**
3465
- * Whether a map module is based on a map style or on added GeoJSON data.
3466
- */
3467
- type MapModuleSource = 'style' | 'geojson';
3468
3626
  /**
3469
3627
  * Base class for all Maps SDK map modules.
3470
3628
  *
@@ -3477,22 +3635,23 @@ type MapModuleSource = 'style' | 'geojson';
3477
3635
  * The class manages the module's sources, layers, and configuration, automatically
3478
3636
  * handling map style changes by restoring the module's state when needed.
3479
3637
  *
3480
- * The `sourceType` a module passes up says who owns the sources and layers it controls, and
3481
- * therefore how its instances behave:
3638
+ * No module extends this class directly. Each one extends the subclass that says who owns the
3639
+ * sources and layers it controls, and therefore how its instances behave:
3482
3640
  *
3483
- * - `'geojson'` — the module adds and owns its own sources, layers and images, suffixed per
3484
- * instance. Multi-instance, built with `create(map, config?)`.
3485
- * - `'style'` — the module controls sources and layers the map style already provides, under fixed
3486
- * global IDs. A shared controller, obtained with `get(map, config?)`.
3641
+ * - {@link AbstractDataOwnedMapModule} — the module adds and owns its own sources, layers and
3642
+ * images, suffixed per instance. Multi-instance, built with `create(map, config?)`.
3643
+ * - {@link AbstractStyleOwnedMapModule} — the module controls sources and layers the map style
3644
+ * already provides, under fixed global IDs. A shared controller, obtained with
3645
+ * `get(map, config?)`.
3487
3646
  *
3488
3647
  * @typeParam SOURCES_WITH_LAYERS - The type defining the sources and layers used by this module
3489
3648
  * @typeParam CFG - The configuration type for this module, or undefined if no configuration is needed. When defined, must extend MapModuleCommonConfig.
3490
3649
  *
3491
3650
  * @example
3492
3651
  * ```typescript
3493
- * class CustomModule extends AbstractMapModule<MySourcesWithLayers, MyConfig> {
3652
+ * class CustomModule extends AbstractDataOwnedMapModule<MySourcesWithLayers, MyConfig> {
3494
3653
  * constructor(tomtomMap: TomTomMap, config?: MyConfig) {
3495
- * super('geojson', tomtomMap, config);
3654
+ * super(tomtomMap, config);
3496
3655
  * }
3497
3656
  * // Implement abstract methods...
3498
3657
  * }
@@ -3501,7 +3660,6 @@ type MapModuleSource = 'style' | 'geojson';
3501
3660
  * @group Shared
3502
3661
  */
3503
3662
  export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends SourcesWithLayers, CFG extends MapModuleCommonConfig | undefined = undefined> {
3504
- private readonly sourceType;
3505
3663
  /**
3506
3664
  * @ignore
3507
3665
  */
@@ -3542,6 +3700,10 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
3542
3700
  * has its own counter without per-subclass boilerplate. Use as a suffix on
3543
3701
  * auto-generated source and layer IDs to keep them stable across style changes and
3544
3702
  * unique across module instances.
3703
+ *
3704
+ * Only the data-owned modules need it, because the style-owned ones work under fixed global
3705
+ * IDs. It is assigned here all the same: this constructor already runs
3706
+ * `_initSourcesWithLayers`, which reads it, so a subclass field would be assigned too late.
3545
3707
  * @ignore
3546
3708
  */
3547
3709
  protected readonly instanceIndex: number;
@@ -3560,10 +3722,9 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
3560
3722
  * Builds this module based on a given Maps SDK map.
3561
3723
  * @param tomtomMap The map. It may or may not be initialized at this stage,
3562
3724
  * but the module ensures to initialize itself once it is.
3563
- * @param sourceType Whether the module is based on a map style or on added GeoJSON data.
3564
3725
  * @param config Optional configuration to initialize directly as soon as the map is ready.
3565
3726
  */
3566
- protected constructor(sourceType: MapModuleSource, tomtomMap: TomTomMap, config?: CFG);
3727
+ protected constructor(tomtomMap: TomTomMap, config?: CFG);
3567
3728
  /**
3568
3729
  * Initializes the sources with layers of this module.
3569
3730
  * @param config The optional configuration for the module.
@@ -3650,6 +3811,19 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
3650
3811
  */
3651
3812
  resetConfig(): void;
3652
3813
  private restoreDataAndConfig;
3814
+ private resetOnNewStyle;
3815
+ /**
3816
+ * Forgets whatever this module remembers beyond its configuration, so that a clean style
3817
+ * switch does not bring it back. The sources are rebuilt empty right after, so there is
3818
+ * nothing to clear on the map.
3819
+ *
3820
+ * A data-owned module always remembers something, so {@link AbstractDataOwnedMapModule} makes
3821
+ * this abstract. A style-owned module overrides it only when it keeps state of its own, such
3822
+ * as raw layer edits.
3823
+ * @protected
3824
+ * @ignore
3825
+ */
3826
+ protected discardShownData(): void;
3653
3827
  /**
3654
3828
  * implementation needed to restore the module state (data and config applied to the module).
3655
3829
  * to be used to restore module state after map style change
@@ -3770,7 +3944,174 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
3770
3944
  protected buildEvents<T, TShown, WHERE_SCOPE, NAMED_SCOPES extends object>(moduleWide: CombinedEvents<T, CFG, TShown, WHERE_SCOPE>, scopes: NAMED_SCOPES): CombinedEvents<T, CFG, TShown, WHERE_SCOPE> & NAMED_SCOPES;
3771
3945
  }
3772
3946
  //#endregion
3947
+ //#region src/shared/AbstractDataOwnedMapModule.d.ts
3948
+ /**
3949
+ * Base class for the map modules that add and own their own GeoJSON sources, layers and images:
3950
+ * places, routes, geometries, the traffic overlays and bring-your-own-data.
3951
+ *
3952
+ * @remarks
3953
+ * The module owns the data it draws. Its generated IDs therefore carry a per-instance suffix
3954
+ * (see `instanceIndex`), and the module is safely multi-instance: every `create(map, config?)`
3955
+ * call returns another module with its own sources and layers.
3956
+ *
3957
+ * Owning the data brings the duty this class states: a clean style switch must forget the data
3958
+ * the module remembers having shown, through {@link discardShownData}.
3959
+ *
3960
+ * @typeParam SOURCES_WITH_LAYERS - The GeoJSON sources, with their layers, this module owns
3961
+ * @typeParam CFG - The configuration type for this module, or undefined if no configuration is needed
3962
+ *
3963
+ * @group Shared
3964
+ */
3965
+ export declare abstract class AbstractDataOwnedMapModule<SOURCES_WITH_LAYERS extends GeoJSONSourcesWithLayers, CFG extends MapModuleCommonConfig | undefined = undefined> extends AbstractMapModule<SOURCES_WITH_LAYERS, CFG> {
3966
+ /**
3967
+ * Owning the data it draws, such a module always remembers something a clean style switch must
3968
+ * forget, so the inherited no-op becomes a duty here. A module that remembers nothing
3969
+ * implements this as a no-op, and says why.
3970
+ * @protected
3971
+ * @ignore
3972
+ */
3973
+ protected abstract discardShownData(): void;
3974
+ }
3975
+ //#endregion
3976
+ //#region src/shared/AbstractStyleOwnedMapModule.d.ts
3977
+ /**
3978
+ * Base class for the map modules that control sources and layers the loaded map style already
3979
+ * provides, under fixed global IDs: the base map, POIs, the traffic tiles and hillshade.
3980
+ *
3981
+ * @remarks
3982
+ * The style owns the data, so such a module adds no sources of its own and shows nothing by
3983
+ * itself. It changes how the parts the style provides are drawn, filtered and made visible.
3984
+ * The SDK memoizes one instance per map, obtained with `get(map, config?)`, so every handle on it
3985
+ * sees the same state.
3986
+ *
3987
+ * Because those sources and layers arrive with the style, they are in place as soon as the new
3988
+ * style is loaded, and the module re-binds to them in the same tick. That is what the base class
3989
+ * already does, so this class adds no behaviour: it names the kind, and it narrows the sources a
3990
+ * module of this kind can hold.
3991
+ *
3992
+ * @typeParam SOURCES_WITH_LAYERS - The style sources, with their layers, this module controls
3993
+ * @typeParam CFG - The configuration type for this module, or undefined if no configuration is needed
3994
+ *
3995
+ * @group Shared
3996
+ */
3997
+ export declare abstract class AbstractStyleOwnedMapModule<SOURCES_WITH_LAYERS extends StyleSourcesWithLayers, CFG extends MapModuleCommonConfig | undefined = undefined> extends AbstractMapModule<SOURCES_WITH_LAYERS, CFG> {}
3998
+ //#endregion
3773
3999
  //#region src/shared/layers/commonLayerProps.d.ts
4000
+ /**
4001
+ * Bold font face used in the TomTom map style.
4002
+ *
4003
+ * @remarks
4004
+ * This is the primary bold font used for prominent labels and headings in the map.
4005
+ * Use this constant when creating custom layers to maintain visual consistency with the map style.
4006
+ *
4007
+ * @example
4008
+ * ```typescript
4009
+ * import { MAP_BOLD_FONT } from '@tomtom-org/maps-sdk/map';
4010
+ *
4011
+ * const textLayer = {
4012
+ * type: 'symbol',
4013
+ * layout: {
4014
+ * 'text-font': [MAP_BOLD_FONT],
4015
+ * 'text-field': ['get', 'name']
4016
+ * }
4017
+ * };
4018
+ * ```
4019
+ *
4020
+ * @group Map Style
4021
+ */
4022
+ export declare const MAP_BOLD_FONT = "Noto-Bold";
4023
+ /**
4024
+ * Regular font face used in the TomTom map style.
4025
+ *
4026
+ * @remarks
4027
+ * This is the standard font used for most text labels on the map.
4028
+ * Use this constant when creating custom layers to maintain visual consistency with the map style.
4029
+ *
4030
+ * @example
4031
+ * ```typescript
4032
+ * import { MAP_REGULAR_FONT } from '@tomtom-org/maps-sdk/map';
4033
+ *
4034
+ * const textLayer = {
4035
+ * type: 'symbol',
4036
+ * layout: {
4037
+ * 'text-font': [MAP_REGULAR_FONT],
4038
+ * 'text-field': ['get', 'description']
4039
+ * }
4040
+ * };
4041
+ * ```
4042
+ *
4043
+ * @group Map Style
4044
+ */
4045
+ export declare const MAP_REGULAR_FONT = "Noto-Regular";
4046
+ /**
4047
+ * Medium weight font face used in the TomTom map style.
4048
+ *
4049
+ * @remarks
4050
+ * This font provides a middle ground between regular and bold weights.
4051
+ * Use this constant when creating custom layers to maintain visual consistency with the map style.
4052
+ *
4053
+ * @example
4054
+ * ```typescript
4055
+ * import { MAP_MEDIUM_FONT } from '@tomtom-org/maps-sdk/map';
4056
+ *
4057
+ * const textLayer = {
4058
+ * type: 'symbol',
4059
+ * layout: {
4060
+ * 'text-font': [MAP_MEDIUM_FONT],
4061
+ * 'text-field': ['get', 'title']
4062
+ * }
4063
+ * };
4064
+ * ```
4065
+ *
4066
+ * @group Map Style
4067
+ */
4068
+ export declare const MAP_MEDIUM_FONT = "Noto-Medium";
4069
+ /**
4070
+ * Italic font face used in the TomTom map style.
4071
+ *
4072
+ * @remarks
4073
+ * This is the italic variant used for emphasized or secondary text labels.
4074
+ * Use this constant when creating custom layers to maintain visual consistency with the map style.
4075
+ *
4076
+ * @example
4077
+ * ```typescript
4078
+ * import { MAP_ITALIC_FONT } from '@tomtom-org/maps-sdk/map';
4079
+ *
4080
+ * const textLayer = {
4081
+ * type: 'symbol',
4082
+ * layout: {
4083
+ * 'text-font': [MAP_ITALIC_FONT],
4084
+ * 'text-field': ['get', 'subtitle']
4085
+ * }
4086
+ * };
4087
+ * ```
4088
+ *
4089
+ * @group Map Style
4090
+ */
4091
+ export declare const MAP_ITALIC_FONT = "NotoSans-MediumItalic";
4092
+ /**
4093
+ * Default text size expression used in the TomTom map style.
4094
+ *
4095
+ * @remarks
4096
+ * This MapLibre expression defines zoom-dependent text sizing that scales from 12px at zoom 10
4097
+ * to 14px at zoom 16. Use this for consistent text sizing across zoom levels.
4098
+ *
4099
+ * @example
4100
+ * ```typescript
4101
+ * import { DEFAULT_TEXT_SIZE } from '@tomtom-org/maps-sdk/map';
4102
+ *
4103
+ * const textLayer = {
4104
+ * type: 'symbol',
4105
+ * layout: {
4106
+ * 'text-size': DEFAULT_TEXT_SIZE,
4107
+ * 'text-field': ['get', 'name']
4108
+ * }
4109
+ * };
4110
+ * ```
4111
+ *
4112
+ * @group Map Style
4113
+ */
4114
+ export declare const DEFAULT_TEXT_SIZE: ExpressionSpecification;
3774
4115
  /**
3775
4116
  * Array of all available font faces in the TomTom map style.
3776
4117
  *
@@ -3798,7 +4139,7 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
3798
4139
  *
3799
4140
  * @group Map Style
3800
4141
  */
3801
- declare const mapFonts: readonly ["Noto-Regular", "NotoSans-MediumItalic", "Noto-Bold", "Noto-Medium"];
4142
+ export declare const mapFonts: readonly ["Noto-Regular", "NotoSans-MediumItalic", "Noto-Bold", "Noto-Medium"];
3802
4143
  /**
3803
4144
  * Type representing valid font faces available in the TomTom map style.
3804
4145
  *
@@ -4251,11 +4592,11 @@ export type BaseMapEvents = CombinedEvents<MapGeoJSONFeature, BaseMapModuleConfi
4251
4592
  * ```
4252
4593
  *
4253
4594
  * @see [Base Map Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/base-map)
4254
- * @see [Map Styles Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/map-styles)
4595
+ * @see [Map Styles Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/styles)
4255
4596
  *
4256
4597
  * @group Base Map
4257
4598
  */
4258
- export declare class BaseMapModule extends AbstractMapModule<BaseSourceAndLayers, BaseMapModuleConfig> {
4599
+ export declare class BaseMapModule extends AbstractStyleOwnedMapModule<BaseSourceAndLayers, BaseMapModuleConfig> {
4259
4600
  private layersByGroup?;
4260
4601
  /**
4261
4602
  * Asynchronously retrieves a BaseMapModule instance for the given map.
@@ -4723,7 +5064,7 @@ export type CustomGeoJSONEvents<TSources extends Record<string, FeatureCollectio
4723
5064
  *
4724
5065
  * @group Custom
4725
5066
  */
4726
- export declare class CustomGeoJSONModule<TSources extends Record<string, FeatureCollection> = Record<string, FeatureCollection>> extends AbstractMapModule<CustomGeoJSONSourcesWithLayers<TSources>, CustomGeoJSONModuleConfig<TSources>> {
5067
+ export declare class CustomGeoJSONModule<TSources extends Record<string, FeatureCollection> = Record<string, FeatureCollection>> extends AbstractDataOwnedMapModule<CustomGeoJSONSourcesWithLayers<TSources>, CustomGeoJSONModuleConfig<TSources>> {
4727
5068
  private resolvedSourceIDs;
4728
5069
  private resolvedLayerSpecs;
4729
5070
  private lastShown;
@@ -4754,6 +5095,10 @@ export declare class CustomGeoJSONModule<TSources extends Record<string, Feature
4754
5095
  protected _applyConfig(config: CustomGeoJSONModuleConfig<TSources> | undefined): CustomGeoJSONModuleConfig<TSources> | undefined;
4755
5096
  private updateLayersForExistingSources;
4756
5097
  private applyVisibility;
5098
+ /**
5099
+ * @ignore
5100
+ */
5101
+ protected discardShownData(): void;
4757
5102
  /**
4758
5103
  * @ignore
4759
5104
  */
@@ -4834,6 +5179,13 @@ export declare const colorPalettes: {
4834
5179
  };
4835
5180
  export type ColorPaletteOptions = keyof typeof colorPalettes;
4836
5181
  export declare const colorPaletteIDs: ColorPaletteOptions[];
5182
+ /**
5183
+ * Adapts a fill palette for the active map theme. Light themes pass through unchanged; for dark
5184
+ * themes each colour is nudged toward a mid, saturated tone — pale ramps are deepened so they read
5185
+ * against the dark base map, near-black ramps are lifted so they don't vanish.
5186
+ * @ignore
5187
+ */
5188
+ export declare const adaptPaletteForTheme: (colors: string[], lightDark: LightDark) => string[];
4837
5189
  //#endregion
4838
5190
  //#region src/geometry/types/geometryTheme.d.ts
4839
5191
  /**
@@ -4883,6 +5235,10 @@ export type GeometryFillConfig = {
4883
5235
  * Fill color: a hex string (`'#FF5733'`), a palette name (`'blues'`, see {@link colorPaletteIDs}), or a MapLibre expression
4884
5236
  * for data-driven styling (e.g. `['get', 'color']`).
4885
5237
  *
5238
+ * @remarks
5239
+ * When unset the default is theme-adaptive: `'#0A3653'` on light map styles, `'#5FA8D8'` on dark.
5240
+ * Custom styles are treated as light — pass a colour explicitly on a dark custom style.
5241
+ *
4886
5242
  * @default '#0A3653'
4887
5243
  */
4888
5244
  color?: ColorPaletteOptions | DataDrivenPropertyValueSpecification<string>;
@@ -4972,6 +5328,9 @@ export type GeometryLineConfig = {
4972
5328
  /**
4973
5329
  * Border/outline color: a hex string or a MapLibre expression (e.g. `['get', 'borderColor']`).
4974
5330
  *
5331
+ * @remarks
5332
+ * When unset the default is theme-adaptive: `'#0A3653'` on light map styles, `'#5FA8D8'` on dark.
5333
+ *
4975
5334
  * @default '#0A3653'
4976
5335
  */
4977
5336
  color?: DataDrivenPropertyValueSpecification<string>;
@@ -5064,6 +5423,9 @@ export type GeometryLineLabelConfig = {
5064
5423
  /**
5065
5424
  * Color of the border label text.
5066
5425
  *
5426
+ * @remarks
5427
+ * When unset the default is theme-adaptive: `'#333333'` on light map styles, `'#FFFFFF'` on dark.
5428
+ *
5067
5429
  * @default '#333333'
5068
5430
  *
5069
5431
  * @example
@@ -5078,6 +5440,9 @@ export type GeometryLineLabelConfig = {
5078
5440
  *
5079
5441
  * The halo improves legibility against complex or dark backgrounds.
5080
5442
  *
5443
+ * @remarks
5444
+ * When unset the default is theme-adaptive: `'#FFFFFF'` on light map styles, `'#333333'` on dark.
5445
+ *
5081
5446
  * @default '#FFFFFF'
5082
5447
  *
5083
5448
  * @example
@@ -5430,7 +5795,7 @@ export type GeometriesEvents = CombinedEvents<MapGeoJSONFeature, GeometriesModul
5430
5795
  *
5431
5796
  * @group Geometries
5432
5797
  */
5433
- export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesWithLayers, GeometriesModuleConfig> {
5798
+ export declare class GeometriesModule extends AbstractDataOwnedMapModule<GeometrySourcesWithLayers, GeometriesModuleConfig> {
5434
5799
  private titleLayerSpecs;
5435
5800
  private geometryFillLayerSpecs;
5436
5801
  private geometryOutlineLayerSpecs;
@@ -5501,6 +5866,14 @@ export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesW
5501
5866
  */
5502
5867
  static create(tomtomMap: TomTomMap, config?: GeometriesModuleConfig): Promise<GeometriesModule>;
5503
5868
  private constructor();
5869
+ /** Current light/dark map theme, re-read on every layer/data build so style switches repaint. */
5870
+ private get lightDark();
5871
+ /**
5872
+ * Default fill / plain-outline colour a feature falls back to when it carries no `color`.
5873
+ * Resolved from the active theme; once the styling module ships this also reads the map's
5874
+ * published accent (`mapAccentColor(this.tomtomMap) ?? …`).
5875
+ */
5876
+ private get defaultColor();
5504
5877
  /**
5505
5878
  * @ignore
5506
5879
  */
@@ -5571,6 +5944,10 @@ export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesW
5571
5944
  */
5572
5945
  applyTextConfig(textConfig: GeometryTextConfig): void;
5573
5946
  private updateLayerAndData;
5947
+ /**
5948
+ * @ignore
5949
+ */
5950
+ protected discardShownData(): void;
5574
5951
  /**
5575
5952
  * @ignore
5576
5953
  */
@@ -5974,7 +6351,7 @@ type HillshadeSourcesWithLayers = {
5974
6351
  *
5975
6352
  * @group Hillshade
5976
6353
  */
5977
- export declare class HillshadeModule extends AbstractMapModule<HillshadeSourcesWithLayers, HillshadeModuleConfig> {
6354
+ export declare class HillshadeModule extends AbstractStyleOwnedMapModule<HillshadeSourcesWithLayers, HillshadeModuleConfig> {
5978
6355
  /**
5979
6356
  * Retrieves a HillshadeModule instance for the given map.
5980
6357
  *
@@ -7161,7 +7538,7 @@ export type PlacesEvents = CombinedEvents<MapGeoJSONFeature, PlacesModuleConfig,
7161
7538
  *
7162
7539
  * @group Places
7163
7540
  */
7164
- export declare class PlacesModule extends AbstractMapModule<PlacesSourcesAndLayers, PlacesModuleConfig> {
7541
+ export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourcesAndLayers, PlacesModuleConfig> {
7165
7542
  private layerSpecs;
7166
7543
  private connectionLayerSpecs;
7167
7544
  private currentClusterMode;
@@ -7197,6 +7574,10 @@ export declare class PlacesModule extends AbstractMapModule<PlacesSourcesAndLaye
7197
7574
  * @ignore
7198
7575
  */
7199
7576
  protected _applyConfig(config: PlacesModuleConfig | undefined): PlacesModuleConfig | undefined;
7577
+ /**
7578
+ * @ignore
7579
+ */
7580
+ protected discardShownData(): void;
7200
7581
  /**
7201
7582
  * @ignore
7202
7583
  */
@@ -7929,7 +8310,7 @@ type PoIsSourcesAndLayers = {
7929
8310
  *
7930
8311
  * @group POIs
7931
8312
  */
7932
- export declare class POIsModule extends AbstractMapModule<PoIsSourcesAndLayers, POIsModuleConfig> {
8313
+ export declare class POIsModule extends AbstractStyleOwnedMapModule<PoIsSourcesAndLayers, POIsModuleConfig> {
7933
8314
  private categoriesFilter?;
7934
8315
  private originalFilter?;
7935
8316
  /**
@@ -8290,24 +8671,26 @@ type RouteLayersConfig = {
8290
8671
  routeIncidentDashedLine?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
8291
8672
  } & HasAdditionalLayersConfig;
8292
8673
  /**
8293
- * Toll road section layers.
8674
+ * Layers for the `tollRoad` section type.
8294
8675
  *
8295
8676
  * @remarks
8296
- * Identifies route segments that require toll payments.
8677
+ * Marks the stretches of the route that cost money to drive, by any charging scheme:
8678
+ * per-use tolls, motorways that need a vignette, and urban road-charge zones.
8297
8679
  */
8298
8680
  tollRoad?: {
8299
8681
  /**
8300
- * Symbol layer for marking toll booths or toll segments.
8682
+ * Symbol layer marking the charged stretches with an icon.
8301
8683
  *
8302
8684
  * @remarks
8303
- * Use for icons or markers indicating toll-related points along the route.
8685
+ * Defaults to the toll-plaza icon, which is the closest the base-map sprite offers to
8686
+ * a generic road-charge icon. Override it to distinguish the schemes yourself.
8304
8687
  */
8305
8688
  routeTollRoadSymbol?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
8306
8689
  /**
8307
- * Line layer used to outline toll road segments.
8690
+ * Line layer used to outline the charged stretches.
8308
8691
  *
8309
8692
  * @remarks
8310
- * Typically styled to visually differentiate toll segments from regular roads.
8693
+ * Typically styled to visually differentiate charged stretches from regular roads.
8311
8694
  */
8312
8695
  routeTollRoadOutline?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
8313
8696
  } & HasAdditionalLayersConfig;
@@ -8442,6 +8825,10 @@ type ChargingStopIconConfig = {
8442
8825
  * @remarks
8443
8826
  * These icons can be referenced in the `mapping` configuration to customize
8444
8827
  * the appearance of charging stop markers based on specific criteria.
8828
+ *
8829
+ * An entry's `offsetX`/`offsetY` shift that icon from the charging stop's coordinate.
8830
+ * They only take effect when the same entry also provides an `image`; an entry naming an
8831
+ * existing sprite icon by `id` alone ignores them.
8445
8832
  */
8446
8833
  customIcons?: CustomImage[];
8447
8834
  /**
@@ -9459,6 +9846,20 @@ export type WaypointDisplayProps = PlaceDisplayProps & {
9459
9846
  * ```
9460
9847
  */
9461
9848
  stopDisplayIndex?: number;
9849
+ /**
9850
+ * How long the route waits at this waypoint, formatted for display.
9851
+ *
9852
+ * @remarks
9853
+ * Taken from {@link WaypointProps.pauseDurationSeconds} and rendered on the stop's label by
9854
+ * default (e.g. `30 min`). Absent when the waypoint carries no wait. Charging-stop pins carry
9855
+ * the same property, so both kinds of pin say how long you are there in the same words.
9856
+ *
9857
+ * @example
9858
+ * ```typescript
9859
+ * stopDuration: '30 min'
9860
+ * ```
9861
+ */
9862
+ stopDuration?: string;
9462
9863
  };
9463
9864
  /**
9464
9865
  * @ignore
@@ -9627,7 +10028,7 @@ export type RoutingEvents = CombinedEvents<MapGeoJSONFeature, RoutingModuleConfi
9627
10028
  *
9628
10029
  * @group Routing
9629
10030
  */
9630
- export declare class RoutingModule extends AbstractMapModule<RoutingSourcesWithLayers, RoutingModuleConfig> {
10031
+ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSourcesWithLayers, RoutingModuleConfig> {
9631
10032
  private layersSpecs;
9632
10033
  private layerIDPrefix;
9633
10034
  private readonly shownFeaturesHandlers;
@@ -9679,6 +10080,8 @@ export declare class RoutingModule extends AbstractMapModule<RoutingSourcesWithL
9679
10080
  * @ignore
9680
10081
  */
9681
10082
  protected _applyConfig(config?: RoutingModuleConfig): RoutingModuleConfig;
10083
+ /** @ignore */
10084
+ protected discardShownData(): void;
9682
10085
  /**
9683
10086
  * @ignore
9684
10087
  */
@@ -9705,7 +10108,7 @@ export declare class RoutingModule extends AbstractMapModule<RoutingSourcesWithL
9705
10108
  * **Route Features:**
9706
10109
  * - Main route lines (selected and deselected styles)
9707
10110
  * - Traffic sections with delays
9708
- * - Ferry, tunnel, and toll sections
10111
+ * - Ferry, tunnel, and charged-road (`tollRoad`) sections
9709
10112
  * - EV charging stations (for EV routes)
9710
10113
  * - Turn-by-turn instruction lines and arrows
9711
10114
  * - Summary bubbles with distance/time/traffic info
@@ -9814,7 +10217,7 @@ export declare class RoutingModule extends AbstractMapModule<RoutingSourcesWithL
9814
10217
  * - `incidents`: Traffic incidents on routes
9815
10218
  * - `ferries`: Ferry sections
9816
10219
  * - `chargingStops`: EV charging stations
9817
- * - `tollRoads`: Toll road sections
10220
+ * - `tollRoads`: Sections that cost money to drive — the `tollRoad` section type
9818
10221
  * - `tunnels`: Tunnel sections
9819
10222
  * - `vehicleRestricted`: Vehicle-restricted sections
9820
10223
  * - `instructionLines`: Turn-by-turn instruction lines
@@ -10124,9 +10527,13 @@ type AreaAnalyticsBeforeLayerConfig = {
10124
10527
  */
10125
10528
  type AreaAnalyticsRegionPolygonConfig = {
10126
10529
  /**
10127
- * Color used for both the fill and outline of the region boundary.
10530
+ * CSS colour used for both the fill and outline of the region boundary.
10128
10531
  *
10129
- * @defaultValue '#000000'
10532
+ * When omitted, a theme-adaptive default is used. Known standard styles are classified as
10533
+ * light or dark; a custom style is treated as light, so set `color` explicitly if a custom
10534
+ * style is dark.
10535
+ *
10536
+ * @defaultValue Black (`#000000`) on light styles, white (`#FFFFFF`) on dark styles
10130
10537
  */
10131
10538
  color?: string;
10132
10539
  /**
@@ -10246,9 +10653,11 @@ declare const AREA_ANALYTICS_DEFAULTS: {
10246
10653
  };
10247
10654
  };
10248
10655
  };
10249
- /** @see {@link AreaAnalyticsRegionPolygonConfig} */
10656
+ /**
10657
+ * @see {@link AreaAnalyticsRegionPolygonConfig}
10658
+ * `color` is omitted — the layer builders apply a theme-adaptive default.
10659
+ */
10250
10660
  regionPolygon: {
10251
- color: string;
10252
10661
  fillOpacity: number;
10253
10662
  outlineOpacity: number;
10254
10663
  outlineWidth: number;
@@ -10398,7 +10807,7 @@ type AreaAnalyticsSourcesWithLayers = {
10398
10807
  *
10399
10808
  * @group Traffic Area Analytics
10400
10809
  */
10401
- export declare class TrafficAreaAnalyticsModule extends AbstractMapModule<AreaAnalyticsSourcesWithLayers, TrafficAreaAnalyticsConfig> {
10810
+ export declare class TrafficAreaAnalyticsModule extends AbstractDataOwnedMapModule<AreaAnalyticsSourcesWithLayers, TrafficAreaAnalyticsConfig> {
10402
10811
  private heatmapLayerSpec;
10403
10812
  private hexFillLayerSpec;
10404
10813
  private hexExtrusionLayerSpec;
@@ -10451,6 +10860,8 @@ export declare class TrafficAreaAnalyticsModule extends AbstractMapModule<AreaAn
10451
10860
  /** @ignore */
10452
10861
  protected _applyConfig(config: TrafficAreaAnalyticsConfig | undefined): TrafficAreaAnalyticsConfig | undefined;
10453
10862
  /** @ignore */
10863
+ protected discardShownData(): void;
10864
+ /** @ignore */
10454
10865
  protected restoreDataAndConfigImpl(): void;
10455
10866
  /**
10456
10867
  * Displays area analytics data on the map.
@@ -10612,6 +11023,7 @@ export declare class TrafficAreaAnalyticsModule extends AbstractMapModule<AreaAn
10612
11023
  get events(): CombinedEvents<AreaAnalyticsTileFeature, TrafficAreaAnalyticsConfig, TrafficAreaAnalytics>;
10613
11024
  private get mode();
10614
11025
  private get activeMetric();
11026
+ private get lightDark();
10615
11027
  private applyModeVisibility;
10616
11028
  private hideAllDataLayers;
10617
11029
  private addHighlightLayersToMap;
@@ -10957,7 +11369,7 @@ type TrafficFlowSourcesWithLayers = {
10957
11369
  *
10958
11370
  * @group Traffic Flow
10959
11371
  */
10960
- export declare class TrafficFlowModule extends AbstractMapModule<TrafficFlowSourcesWithLayers, FlowConfig> {
11372
+ export declare class TrafficFlowModule extends AbstractStyleOwnedMapModule<TrafficFlowSourcesWithLayers, FlowConfig> {
10961
11373
  private originalFilters;
10962
11374
  /**
10963
11375
  * Retrieves a TrafficFlowModule instance for the given map.
@@ -11159,7 +11571,9 @@ export declare class TrafficFlowModule extends AbstractMapModule<TrafficFlowSour
11159
11571
  */
11160
11572
  type IncidentFocusStyle = {
11161
11573
  /**
11162
- * Colour of the outline painted beneath the focused stripe. Defaults to `#000`.
11574
+ * Colour of the outline painted beneath the focused stripe.
11575
+ *
11576
+ * @defaultValue `#000` on light map styles, `#FFF` on dark styles
11163
11577
  */
11164
11578
  outlineColor?: string;
11165
11579
  /**
@@ -11191,8 +11605,8 @@ type TrafficIncidentOverlayConfig = MapModuleCommonConfig & {
11191
11605
  /**
11192
11606
  * Visual treatment for {@link TrafficIncidentOverlayModule.setFocus}.
11193
11607
  *
11194
- * - Omit (or `undefined`) — use the SDK default treatment: a black outline
11195
- * beneath the focused stripe and a `1.6×` width pop.
11608
+ * - Omit (or `undefined`) — use the SDK default treatment: an outline beneath
11609
+ * the focused stripe (black on light map styles, white on dark) and a `1.6×` width pop.
11196
11610
  * - `false` — disable the visual treatment. `setFocus(ids)` still writes
11197
11611
  * MapLibre `feature-state.focused`, so callers can drive their own
11198
11612
  * styling (extra layers, sidebar overlays, …) off that state.
@@ -11230,8 +11644,9 @@ type Sources = {
11230
11644
  * ## Focus
11231
11645
  *
11232
11646
  * {@link setFocus} writes MapLibre feature-state `focused=true|false` on each rendered
11233
- * incident. The default visual treatment widens the focused subset and paints a black
11234
- * outline beneath it; unfocused incidents are unchanged. Override or disable the visual
11647
+ * incident. The default visual treatment widens the focused subset and paints an
11648
+ * outline beneath it (black on light map styles, white on dark); unfocused incidents
11649
+ * are unchanged. Override or disable the visual
11235
11650
  * treatment via the `focus` config — `focus: false` keeps `setFocus` writing feature-state
11236
11651
  * but emits no halo layer and no width pop, leaving callers free to drive their own
11237
11652
  * styling off `feature-state.focused`.
@@ -11298,7 +11713,7 @@ type Sources = {
11298
11713
  *
11299
11714
  * @group Traffic
11300
11715
  */
11301
- export declare class TrafficIncidentOverlayModule extends AbstractMapModule<Sources, TrafficIncidentOverlayConfig> {
11716
+ export declare class TrafficIncidentOverlayModule extends AbstractDataOwnedMapModule<Sources, TrafficIncidentOverlayConfig> {
11302
11717
  private lastResult;
11303
11718
  private lastFeatureIds;
11304
11719
  private lastFocusIds;
@@ -11322,6 +11737,8 @@ export declare class TrafficIncidentOverlayModule extends AbstractMapModule<Sour
11322
11737
  protected _applyConfig(config: TrafficIncidentOverlayConfig | undefined): TrafficIncidentOverlayConfig | undefined;
11323
11738
  private applyBeforeLayer;
11324
11739
  /** @ignore */
11740
+ protected discardShownData(): void;
11741
+ /** @ignore */
11325
11742
  protected restoreDataAndConfigImpl(): void;
11326
11743
  /**
11327
11744
  * Render the service result. Replaces any previously shown snapshot.
@@ -11360,7 +11777,7 @@ export declare class TrafficIncidentOverlayModule extends AbstractMapModule<Sour
11360
11777
  * Mark a subset of currently-rendered incidents as "focused" via MapLibre
11361
11778
  * feature-state. `null` clears the state. Paint expressions in
11362
11779
  * `incidentDetailsLayers.ts` read `['feature-state', 'focused']` and pop the
11363
- * focused subset (wider stripe + black outline). Unfocused features are
11780
+ * focused subset (wider stripe + a theme-aware outline). Unfocused features are
11364
11781
  * unchanged — the focus treatment adds emphasis, it does not dim the rest.
11365
11782
  *
11366
11783
  * No effect if called before `show()`.
@@ -11706,7 +12123,7 @@ type TrafficIncidentsSourcesWithLayers = {
11706
12123
  *
11707
12124
  * @group Traffic Incidents
11708
12125
  */
11709
- export declare class TrafficIncidentsModule extends AbstractMapModule<TrafficIncidentsSourcesWithLayers, IncidentsConfig> {
12126
+ export declare class TrafficIncidentsModule extends AbstractStyleOwnedMapModule<TrafficIncidentsSourcesWithLayers, IncidentsConfig> {
11710
12127
  private originalFilters;
11711
12128
  /**
11712
12129
  * Retrieves a TrafficIncidentsModule instance for the given map.
@@ -12031,4 +12448,4 @@ export declare const calculatePaddedCenter: (options: CalculateMapCenterOptions)
12031
12448
  */
12032
12449
  export declare const calculateFittingBBox: (options: CalculateFittingBBoxOptions) => BBox | null;
12033
12450
  //#endregion
12034
- 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, FilterSyntaxVersion, FilterablePOICategory, HasAdditionalLayersConfig, HasBeforeID, HillshadeModuleConfig, HoverEventType, IncidentFocusStyle, LayerSpecFilter, LayerSpecTemplate, LayerSpecWithSource, LightDark, MapEventsConfig, MapFont, MapModuleCommonConfig, MapStyleLayerID, MultiSyntaxFilter, POIsModuleConfig, POIsModuleFeature, PlaceConnectionDisplay, PlaceConnectionLayerName, PlaceConnectionsConfig, PlaceConnectionsLayersConfig, PlaceIconConfig, PlaceLayerName, PlaceLayersConfig, PlaceTextConfig, PlacesModuleConfig, PlacesTheme, PlanningWaypoint, PutEventStateOptions, RouteLayersConfig, RouteStateProps, RouteTheme, RouteWaypointSize, RouteWidth, RoutingModuleConfig, SVGIconStyleOptions, SourceWithLayerIDs, SourceWithLayers, SourcesWithLayers, SupportsEvents, SymbolLayerSpecWithoutSource, ToBeAddedLayerSpec, ToBeAddedLayerSpecTemplate, ToBeAddedLayerSpecWithoutSource, TrafficAreaAnalyticsConfig, TrafficIncidentOverlayConfig, UserEventHandler, ValuesFilter, WaypointsConfig };
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 };