@tomtom-org/maps-sdk 0.52.0 → 0.53.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
  *
@@ -2484,25 +2634,6 @@ type SVGIconStyleOptions = {
2484
2634
  outlineOpacity?: number;
2485
2635
  };
2486
2636
  //#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
2637
  //#region src/shared/types/mapModule.d.ts
2507
2638
  /**
2508
2639
  * Contains configuration options common to all map modules.
@@ -2516,15 +2647,6 @@ type MapModuleCommonConfig = {
2516
2647
  events?: EventHandlerConfig;
2517
2648
  };
2518
2649
  //#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
2650
  //#region src/shared/eventScope.d.ts
2529
2651
  /**
2530
2652
  * What `where()` accepts: a predicate over the feature type this surface exposes, or — where the
@@ -3461,10 +3583,6 @@ type EventScopeOptions<T, WHERE_SCOPE> = {
3461
3583
  /** Resolves a module-specific scope object, such as BaseMapModule's `{ layerGroups }`. */
3462
3584
  scopeResolver?: (scope: WHERE_SCOPE) => ResolvedEventScope;
3463
3585
  };
3464
- /**
3465
- * Whether a map module is based on a map style or on added GeoJSON data.
3466
- */
3467
- type MapModuleSource = 'style' | 'geojson';
3468
3586
  /**
3469
3587
  * Base class for all Maps SDK map modules.
3470
3588
  *
@@ -3477,22 +3595,23 @@ type MapModuleSource = 'style' | 'geojson';
3477
3595
  * The class manages the module's sources, layers, and configuration, automatically
3478
3596
  * handling map style changes by restoring the module's state when needed.
3479
3597
  *
3480
- * The `sourceType` a module passes up says who owns the sources and layers it controls, and
3481
- * therefore how its instances behave:
3598
+ * No module extends this class directly. Each one extends the subclass that says who owns the
3599
+ * sources and layers it controls, and therefore how its instances behave:
3482
3600
  *
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?)`.
3601
+ * - {@link AbstractDataOwnedMapModule} — the module adds and owns its own sources, layers and
3602
+ * images, suffixed per instance. Multi-instance, built with `create(map, config?)`.
3603
+ * - {@link AbstractStyleOwnedMapModule} — the module controls sources and layers the map style
3604
+ * already provides, under fixed global IDs. A shared controller, obtained with
3605
+ * `get(map, config?)`.
3487
3606
  *
3488
3607
  * @typeParam SOURCES_WITH_LAYERS - The type defining the sources and layers used by this module
3489
3608
  * @typeParam CFG - The configuration type for this module, or undefined if no configuration is needed. When defined, must extend MapModuleCommonConfig.
3490
3609
  *
3491
3610
  * @example
3492
3611
  * ```typescript
3493
- * class CustomModule extends AbstractMapModule<MySourcesWithLayers, MyConfig> {
3612
+ * class CustomModule extends AbstractDataOwnedMapModule<MySourcesWithLayers, MyConfig> {
3494
3613
  * constructor(tomtomMap: TomTomMap, config?: MyConfig) {
3495
- * super('geojson', tomtomMap, config);
3614
+ * super(tomtomMap, config);
3496
3615
  * }
3497
3616
  * // Implement abstract methods...
3498
3617
  * }
@@ -3501,7 +3620,6 @@ type MapModuleSource = 'style' | 'geojson';
3501
3620
  * @group Shared
3502
3621
  */
3503
3622
  export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends SourcesWithLayers, CFG extends MapModuleCommonConfig | undefined = undefined> {
3504
- private readonly sourceType;
3505
3623
  /**
3506
3624
  * @ignore
3507
3625
  */
@@ -3542,6 +3660,10 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
3542
3660
  * has its own counter without per-subclass boilerplate. Use as a suffix on
3543
3661
  * auto-generated source and layer IDs to keep them stable across style changes and
3544
3662
  * unique across module instances.
3663
+ *
3664
+ * Only the data-owned modules need it, because the style-owned ones work under fixed global
3665
+ * IDs. It is assigned here all the same: this constructor already runs
3666
+ * `_initSourcesWithLayers`, which reads it, so a subclass field would be assigned too late.
3545
3667
  * @ignore
3546
3668
  */
3547
3669
  protected readonly instanceIndex: number;
@@ -3560,10 +3682,9 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
3560
3682
  * Builds this module based on a given Maps SDK map.
3561
3683
  * @param tomtomMap The map. It may or may not be initialized at this stage,
3562
3684
  * 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
3685
  * @param config Optional configuration to initialize directly as soon as the map is ready.
3565
3686
  */
3566
- protected constructor(sourceType: MapModuleSource, tomtomMap: TomTomMap, config?: CFG);
3687
+ protected constructor(tomtomMap: TomTomMap, config?: CFG);
3567
3688
  /**
3568
3689
  * Initializes the sources with layers of this module.
3569
3690
  * @param config The optional configuration for the module.
@@ -3650,6 +3771,19 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
3650
3771
  */
3651
3772
  resetConfig(): void;
3652
3773
  private restoreDataAndConfig;
3774
+ private resetOnNewStyle;
3775
+ /**
3776
+ * Forgets whatever this module remembers beyond its configuration, so that a clean style
3777
+ * switch does not bring it back. The sources are rebuilt empty right after, so there is
3778
+ * nothing to clear on the map.
3779
+ *
3780
+ * A data-owned module always remembers something, so {@link AbstractDataOwnedMapModule} makes
3781
+ * this abstract. A style-owned module overrides it only when it keeps state of its own, such
3782
+ * as raw layer edits.
3783
+ * @protected
3784
+ * @ignore
3785
+ */
3786
+ protected discardShownData(): void;
3653
3787
  /**
3654
3788
  * implementation needed to restore the module state (data and config applied to the module).
3655
3789
  * to be used to restore module state after map style change
@@ -3770,7 +3904,174 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
3770
3904
  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
3905
  }
3772
3906
  //#endregion
3907
+ //#region src/shared/AbstractDataOwnedMapModule.d.ts
3908
+ /**
3909
+ * Base class for the map modules that add and own their own GeoJSON sources, layers and images:
3910
+ * places, routes, geometries, the traffic overlays and bring-your-own-data.
3911
+ *
3912
+ * @remarks
3913
+ * The module owns the data it draws. Its generated IDs therefore carry a per-instance suffix
3914
+ * (see `instanceIndex`), and the module is safely multi-instance: every `create(map, config?)`
3915
+ * call returns another module with its own sources and layers.
3916
+ *
3917
+ * Owning the data brings the duty this class states: a clean style switch must forget the data
3918
+ * the module remembers having shown, through {@link discardShownData}.
3919
+ *
3920
+ * @typeParam SOURCES_WITH_LAYERS - The GeoJSON sources, with their layers, this module owns
3921
+ * @typeParam CFG - The configuration type for this module, or undefined if no configuration is needed
3922
+ *
3923
+ * @group Shared
3924
+ */
3925
+ export declare abstract class AbstractDataOwnedMapModule<SOURCES_WITH_LAYERS extends GeoJSONSourcesWithLayers, CFG extends MapModuleCommonConfig | undefined = undefined> extends AbstractMapModule<SOURCES_WITH_LAYERS, CFG> {
3926
+ /**
3927
+ * Owning the data it draws, such a module always remembers something a clean style switch must
3928
+ * forget, so the inherited no-op becomes a duty here. A module that remembers nothing
3929
+ * implements this as a no-op, and says why.
3930
+ * @protected
3931
+ * @ignore
3932
+ */
3933
+ protected abstract discardShownData(): void;
3934
+ }
3935
+ //#endregion
3936
+ //#region src/shared/AbstractStyleOwnedMapModule.d.ts
3937
+ /**
3938
+ * Base class for the map modules that control sources and layers the loaded map style already
3939
+ * provides, under fixed global IDs: the base map, POIs, the traffic tiles and hillshade.
3940
+ *
3941
+ * @remarks
3942
+ * The style owns the data, so such a module adds no sources of its own and shows nothing by
3943
+ * itself. It changes how the parts the style provides are drawn, filtered and made visible.
3944
+ * The SDK memoizes one instance per map, obtained with `get(map, config?)`, so every handle on it
3945
+ * sees the same state.
3946
+ *
3947
+ * Because those sources and layers arrive with the style, they are in place as soon as the new
3948
+ * style is loaded, and the module re-binds to them in the same tick. That is what the base class
3949
+ * already does, so this class adds no behaviour: it names the kind, and it narrows the sources a
3950
+ * module of this kind can hold.
3951
+ *
3952
+ * @typeParam SOURCES_WITH_LAYERS - The style sources, with their layers, this module controls
3953
+ * @typeParam CFG - The configuration type for this module, or undefined if no configuration is needed
3954
+ *
3955
+ * @group Shared
3956
+ */
3957
+ export declare abstract class AbstractStyleOwnedMapModule<SOURCES_WITH_LAYERS extends StyleSourcesWithLayers, CFG extends MapModuleCommonConfig | undefined = undefined> extends AbstractMapModule<SOURCES_WITH_LAYERS, CFG> {}
3958
+ //#endregion
3773
3959
  //#region src/shared/layers/commonLayerProps.d.ts
3960
+ /**
3961
+ * Bold font face used in the TomTom map style.
3962
+ *
3963
+ * @remarks
3964
+ * This is the primary bold font used for prominent labels and headings in the map.
3965
+ * Use this constant when creating custom layers to maintain visual consistency with the map style.
3966
+ *
3967
+ * @example
3968
+ * ```typescript
3969
+ * import { MAP_BOLD_FONT } from '@tomtom-org/maps-sdk/map';
3970
+ *
3971
+ * const textLayer = {
3972
+ * type: 'symbol',
3973
+ * layout: {
3974
+ * 'text-font': [MAP_BOLD_FONT],
3975
+ * 'text-field': ['get', 'name']
3976
+ * }
3977
+ * };
3978
+ * ```
3979
+ *
3980
+ * @group Map Style
3981
+ */
3982
+ export declare const MAP_BOLD_FONT = "Noto-Bold";
3983
+ /**
3984
+ * Regular font face used in the TomTom map style.
3985
+ *
3986
+ * @remarks
3987
+ * This is the standard font used for most text labels on the map.
3988
+ * Use this constant when creating custom layers to maintain visual consistency with the map style.
3989
+ *
3990
+ * @example
3991
+ * ```typescript
3992
+ * import { MAP_REGULAR_FONT } from '@tomtom-org/maps-sdk/map';
3993
+ *
3994
+ * const textLayer = {
3995
+ * type: 'symbol',
3996
+ * layout: {
3997
+ * 'text-font': [MAP_REGULAR_FONT],
3998
+ * 'text-field': ['get', 'description']
3999
+ * }
4000
+ * };
4001
+ * ```
4002
+ *
4003
+ * @group Map Style
4004
+ */
4005
+ export declare const MAP_REGULAR_FONT = "Noto-Regular";
4006
+ /**
4007
+ * Medium weight font face used in the TomTom map style.
4008
+ *
4009
+ * @remarks
4010
+ * This font provides a middle ground between regular and bold weights.
4011
+ * Use this constant when creating custom layers to maintain visual consistency with the map style.
4012
+ *
4013
+ * @example
4014
+ * ```typescript
4015
+ * import { MAP_MEDIUM_FONT } from '@tomtom-org/maps-sdk/map';
4016
+ *
4017
+ * const textLayer = {
4018
+ * type: 'symbol',
4019
+ * layout: {
4020
+ * 'text-font': [MAP_MEDIUM_FONT],
4021
+ * 'text-field': ['get', 'title']
4022
+ * }
4023
+ * };
4024
+ * ```
4025
+ *
4026
+ * @group Map Style
4027
+ */
4028
+ export declare const MAP_MEDIUM_FONT = "Noto-Medium";
4029
+ /**
4030
+ * Italic font face used in the TomTom map style.
4031
+ *
4032
+ * @remarks
4033
+ * This is the italic variant used for emphasized or secondary text labels.
4034
+ * Use this constant when creating custom layers to maintain visual consistency with the map style.
4035
+ *
4036
+ * @example
4037
+ * ```typescript
4038
+ * import { MAP_ITALIC_FONT } from '@tomtom-org/maps-sdk/map';
4039
+ *
4040
+ * const textLayer = {
4041
+ * type: 'symbol',
4042
+ * layout: {
4043
+ * 'text-font': [MAP_ITALIC_FONT],
4044
+ * 'text-field': ['get', 'subtitle']
4045
+ * }
4046
+ * };
4047
+ * ```
4048
+ *
4049
+ * @group Map Style
4050
+ */
4051
+ export declare const MAP_ITALIC_FONT = "NotoSans-MediumItalic";
4052
+ /**
4053
+ * Default text size expression used in the TomTom map style.
4054
+ *
4055
+ * @remarks
4056
+ * This MapLibre expression defines zoom-dependent text sizing that scales from 12px at zoom 10
4057
+ * to 14px at zoom 16. Use this for consistent text sizing across zoom levels.
4058
+ *
4059
+ * @example
4060
+ * ```typescript
4061
+ * import { DEFAULT_TEXT_SIZE } from '@tomtom-org/maps-sdk/map';
4062
+ *
4063
+ * const textLayer = {
4064
+ * type: 'symbol',
4065
+ * layout: {
4066
+ * 'text-size': DEFAULT_TEXT_SIZE,
4067
+ * 'text-field': ['get', 'name']
4068
+ * }
4069
+ * };
4070
+ * ```
4071
+ *
4072
+ * @group Map Style
4073
+ */
4074
+ export declare const DEFAULT_TEXT_SIZE: ExpressionSpecification;
3774
4075
  /**
3775
4076
  * Array of all available font faces in the TomTom map style.
3776
4077
  *
@@ -3798,7 +4099,7 @@ export declare abstract class AbstractMapModule<SOURCES_WITH_LAYERS extends Sour
3798
4099
  *
3799
4100
  * @group Map Style
3800
4101
  */
3801
- declare const mapFonts: readonly ["Noto-Regular", "NotoSans-MediumItalic", "Noto-Bold", "Noto-Medium"];
4102
+ export declare const mapFonts: readonly ["Noto-Regular", "NotoSans-MediumItalic", "Noto-Bold", "Noto-Medium"];
3802
4103
  /**
3803
4104
  * Type representing valid font faces available in the TomTom map style.
3804
4105
  *
@@ -4251,11 +4552,11 @@ export type BaseMapEvents = CombinedEvents<MapGeoJSONFeature, BaseMapModuleConfi
4251
4552
  * ```
4252
4553
  *
4253
4554
  * @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)
4555
+ * @see [Map Styles Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/styles)
4255
4556
  *
4256
4557
  * @group Base Map
4257
4558
  */
4258
- export declare class BaseMapModule extends AbstractMapModule<BaseSourceAndLayers, BaseMapModuleConfig> {
4559
+ export declare class BaseMapModule extends AbstractStyleOwnedMapModule<BaseSourceAndLayers, BaseMapModuleConfig> {
4259
4560
  private layersByGroup?;
4260
4561
  /**
4261
4562
  * Asynchronously retrieves a BaseMapModule instance for the given map.
@@ -4723,7 +5024,7 @@ export type CustomGeoJSONEvents<TSources extends Record<string, FeatureCollectio
4723
5024
  *
4724
5025
  * @group Custom
4725
5026
  */
4726
- export declare class CustomGeoJSONModule<TSources extends Record<string, FeatureCollection> = Record<string, FeatureCollection>> extends AbstractMapModule<CustomGeoJSONSourcesWithLayers<TSources>, CustomGeoJSONModuleConfig<TSources>> {
5027
+ export declare class CustomGeoJSONModule<TSources extends Record<string, FeatureCollection> = Record<string, FeatureCollection>> extends AbstractDataOwnedMapModule<CustomGeoJSONSourcesWithLayers<TSources>, CustomGeoJSONModuleConfig<TSources>> {
4727
5028
  private resolvedSourceIDs;
4728
5029
  private resolvedLayerSpecs;
4729
5030
  private lastShown;
@@ -4754,6 +5055,10 @@ export declare class CustomGeoJSONModule<TSources extends Record<string, Feature
4754
5055
  protected _applyConfig(config: CustomGeoJSONModuleConfig<TSources> | undefined): CustomGeoJSONModuleConfig<TSources> | undefined;
4755
5056
  private updateLayersForExistingSources;
4756
5057
  private applyVisibility;
5058
+ /**
5059
+ * @ignore
5060
+ */
5061
+ protected discardShownData(): void;
4757
5062
  /**
4758
5063
  * @ignore
4759
5064
  */
@@ -4834,6 +5139,13 @@ export declare const colorPalettes: {
4834
5139
  };
4835
5140
  export type ColorPaletteOptions = keyof typeof colorPalettes;
4836
5141
  export declare const colorPaletteIDs: ColorPaletteOptions[];
5142
+ /**
5143
+ * Adapts a fill palette for the active map theme. Light themes pass through unchanged; for dark
5144
+ * themes each colour is nudged toward a mid, saturated tone — pale ramps are deepened so they read
5145
+ * against the dark base map, near-black ramps are lifted so they don't vanish.
5146
+ * @ignore
5147
+ */
5148
+ export declare const adaptPaletteForTheme: (colors: string[], lightDark: LightDark) => string[];
4837
5149
  //#endregion
4838
5150
  //#region src/geometry/types/geometryTheme.d.ts
4839
5151
  /**
@@ -4883,6 +5195,10 @@ export type GeometryFillConfig = {
4883
5195
  * Fill color: a hex string (`'#FF5733'`), a palette name (`'blues'`, see {@link colorPaletteIDs}), or a MapLibre expression
4884
5196
  * for data-driven styling (e.g. `['get', 'color']`).
4885
5197
  *
5198
+ * @remarks
5199
+ * When unset the default is theme-adaptive: `'#0A3653'` on light map styles, `'#5FA8D8'` on dark.
5200
+ * Custom styles are treated as light — pass a colour explicitly on a dark custom style.
5201
+ *
4886
5202
  * @default '#0A3653'
4887
5203
  */
4888
5204
  color?: ColorPaletteOptions | DataDrivenPropertyValueSpecification<string>;
@@ -4972,6 +5288,9 @@ export type GeometryLineConfig = {
4972
5288
  /**
4973
5289
  * Border/outline color: a hex string or a MapLibre expression (e.g. `['get', 'borderColor']`).
4974
5290
  *
5291
+ * @remarks
5292
+ * When unset the default is theme-adaptive: `'#0A3653'` on light map styles, `'#5FA8D8'` on dark.
5293
+ *
4975
5294
  * @default '#0A3653'
4976
5295
  */
4977
5296
  color?: DataDrivenPropertyValueSpecification<string>;
@@ -5064,6 +5383,9 @@ export type GeometryLineLabelConfig = {
5064
5383
  /**
5065
5384
  * Color of the border label text.
5066
5385
  *
5386
+ * @remarks
5387
+ * When unset the default is theme-adaptive: `'#333333'` on light map styles, `'#FFFFFF'` on dark.
5388
+ *
5067
5389
  * @default '#333333'
5068
5390
  *
5069
5391
  * @example
@@ -5078,6 +5400,9 @@ export type GeometryLineLabelConfig = {
5078
5400
  *
5079
5401
  * The halo improves legibility against complex or dark backgrounds.
5080
5402
  *
5403
+ * @remarks
5404
+ * When unset the default is theme-adaptive: `'#FFFFFF'` on light map styles, `'#333333'` on dark.
5405
+ *
5081
5406
  * @default '#FFFFFF'
5082
5407
  *
5083
5408
  * @example
@@ -5430,7 +5755,7 @@ export type GeometriesEvents = CombinedEvents<MapGeoJSONFeature, GeometriesModul
5430
5755
  *
5431
5756
  * @group Geometries
5432
5757
  */
5433
- export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesWithLayers, GeometriesModuleConfig> {
5758
+ export declare class GeometriesModule extends AbstractDataOwnedMapModule<GeometrySourcesWithLayers, GeometriesModuleConfig> {
5434
5759
  private titleLayerSpecs;
5435
5760
  private geometryFillLayerSpecs;
5436
5761
  private geometryOutlineLayerSpecs;
@@ -5501,6 +5826,14 @@ export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesW
5501
5826
  */
5502
5827
  static create(tomtomMap: TomTomMap, config?: GeometriesModuleConfig): Promise<GeometriesModule>;
5503
5828
  private constructor();
5829
+ /** Current light/dark map theme, re-read on every layer/data build so style switches repaint. */
5830
+ private get lightDark();
5831
+ /**
5832
+ * Default fill / plain-outline colour a feature falls back to when it carries no `color`.
5833
+ * Resolved from the active theme; once the styling module ships this also reads the map's
5834
+ * published accent (`mapAccentColor(this.tomtomMap) ?? …`).
5835
+ */
5836
+ private get defaultColor();
5504
5837
  /**
5505
5838
  * @ignore
5506
5839
  */
@@ -5571,6 +5904,10 @@ export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesW
5571
5904
  */
5572
5905
  applyTextConfig(textConfig: GeometryTextConfig): void;
5573
5906
  private updateLayerAndData;
5907
+ /**
5908
+ * @ignore
5909
+ */
5910
+ protected discardShownData(): void;
5574
5911
  /**
5575
5912
  * @ignore
5576
5913
  */
@@ -5974,7 +6311,7 @@ type HillshadeSourcesWithLayers = {
5974
6311
  *
5975
6312
  * @group Hillshade
5976
6313
  */
5977
- export declare class HillshadeModule extends AbstractMapModule<HillshadeSourcesWithLayers, HillshadeModuleConfig> {
6314
+ export declare class HillshadeModule extends AbstractStyleOwnedMapModule<HillshadeSourcesWithLayers, HillshadeModuleConfig> {
5978
6315
  /**
5979
6316
  * Retrieves a HillshadeModule instance for the given map.
5980
6317
  *
@@ -7161,7 +7498,7 @@ export type PlacesEvents = CombinedEvents<MapGeoJSONFeature, PlacesModuleConfig,
7161
7498
  *
7162
7499
  * @group Places
7163
7500
  */
7164
- export declare class PlacesModule extends AbstractMapModule<PlacesSourcesAndLayers, PlacesModuleConfig> {
7501
+ export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourcesAndLayers, PlacesModuleConfig> {
7165
7502
  private layerSpecs;
7166
7503
  private connectionLayerSpecs;
7167
7504
  private currentClusterMode;
@@ -7197,6 +7534,10 @@ export declare class PlacesModule extends AbstractMapModule<PlacesSourcesAndLaye
7197
7534
  * @ignore
7198
7535
  */
7199
7536
  protected _applyConfig(config: PlacesModuleConfig | undefined): PlacesModuleConfig | undefined;
7537
+ /**
7538
+ * @ignore
7539
+ */
7540
+ protected discardShownData(): void;
7200
7541
  /**
7201
7542
  * @ignore
7202
7543
  */
@@ -7929,7 +8270,7 @@ type PoIsSourcesAndLayers = {
7929
8270
  *
7930
8271
  * @group POIs
7931
8272
  */
7932
- export declare class POIsModule extends AbstractMapModule<PoIsSourcesAndLayers, POIsModuleConfig> {
8273
+ export declare class POIsModule extends AbstractStyleOwnedMapModule<PoIsSourcesAndLayers, POIsModuleConfig> {
7933
8274
  private categoriesFilter?;
7934
8275
  private originalFilter?;
7935
8276
  /**
@@ -9459,6 +9800,20 @@ export type WaypointDisplayProps = PlaceDisplayProps & {
9459
9800
  * ```
9460
9801
  */
9461
9802
  stopDisplayIndex?: number;
9803
+ /**
9804
+ * How long the route waits at this waypoint, formatted for display.
9805
+ *
9806
+ * @remarks
9807
+ * Taken from {@link WaypointProps.pauseDurationSeconds} and rendered on the stop's label by
9808
+ * default (e.g. `30 min`). Absent when the waypoint carries no wait. Charging-stop pins carry
9809
+ * the same property, so both kinds of pin say how long you are there in the same words.
9810
+ *
9811
+ * @example
9812
+ * ```typescript
9813
+ * stopDuration: '30 min'
9814
+ * ```
9815
+ */
9816
+ stopDuration?: string;
9462
9817
  };
9463
9818
  /**
9464
9819
  * @ignore
@@ -9627,7 +9982,7 @@ export type RoutingEvents = CombinedEvents<MapGeoJSONFeature, RoutingModuleConfi
9627
9982
  *
9628
9983
  * @group Routing
9629
9984
  */
9630
- export declare class RoutingModule extends AbstractMapModule<RoutingSourcesWithLayers, RoutingModuleConfig> {
9985
+ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSourcesWithLayers, RoutingModuleConfig> {
9631
9986
  private layersSpecs;
9632
9987
  private layerIDPrefix;
9633
9988
  private readonly shownFeaturesHandlers;
@@ -9679,6 +10034,8 @@ export declare class RoutingModule extends AbstractMapModule<RoutingSourcesWithL
9679
10034
  * @ignore
9680
10035
  */
9681
10036
  protected _applyConfig(config?: RoutingModuleConfig): RoutingModuleConfig;
10037
+ /** @ignore */
10038
+ protected discardShownData(): void;
9682
10039
  /**
9683
10040
  * @ignore
9684
10041
  */
@@ -10124,9 +10481,13 @@ type AreaAnalyticsBeforeLayerConfig = {
10124
10481
  */
10125
10482
  type AreaAnalyticsRegionPolygonConfig = {
10126
10483
  /**
10127
- * Color used for both the fill and outline of the region boundary.
10484
+ * CSS colour used for both the fill and outline of the region boundary.
10485
+ *
10486
+ * When omitted, a theme-adaptive default is used. Known standard styles are classified as
10487
+ * light or dark; a custom style is treated as light, so set `color` explicitly if a custom
10488
+ * style is dark.
10128
10489
  *
10129
- * @defaultValue '#000000'
10490
+ * @defaultValue Black (`#000000`) on light styles, white (`#FFFFFF`) on dark styles
10130
10491
  */
10131
10492
  color?: string;
10132
10493
  /**
@@ -10246,9 +10607,11 @@ declare const AREA_ANALYTICS_DEFAULTS: {
10246
10607
  };
10247
10608
  };
10248
10609
  };
10249
- /** @see {@link AreaAnalyticsRegionPolygonConfig} */
10610
+ /**
10611
+ * @see {@link AreaAnalyticsRegionPolygonConfig}
10612
+ * `color` is omitted — the layer builders apply a theme-adaptive default.
10613
+ */
10250
10614
  regionPolygon: {
10251
- color: string;
10252
10615
  fillOpacity: number;
10253
10616
  outlineOpacity: number;
10254
10617
  outlineWidth: number;
@@ -10398,7 +10761,7 @@ type AreaAnalyticsSourcesWithLayers = {
10398
10761
  *
10399
10762
  * @group Traffic Area Analytics
10400
10763
  */
10401
- export declare class TrafficAreaAnalyticsModule extends AbstractMapModule<AreaAnalyticsSourcesWithLayers, TrafficAreaAnalyticsConfig> {
10764
+ export declare class TrafficAreaAnalyticsModule extends AbstractDataOwnedMapModule<AreaAnalyticsSourcesWithLayers, TrafficAreaAnalyticsConfig> {
10402
10765
  private heatmapLayerSpec;
10403
10766
  private hexFillLayerSpec;
10404
10767
  private hexExtrusionLayerSpec;
@@ -10451,6 +10814,8 @@ export declare class TrafficAreaAnalyticsModule extends AbstractMapModule<AreaAn
10451
10814
  /** @ignore */
10452
10815
  protected _applyConfig(config: TrafficAreaAnalyticsConfig | undefined): TrafficAreaAnalyticsConfig | undefined;
10453
10816
  /** @ignore */
10817
+ protected discardShownData(): void;
10818
+ /** @ignore */
10454
10819
  protected restoreDataAndConfigImpl(): void;
10455
10820
  /**
10456
10821
  * Displays area analytics data on the map.
@@ -10612,6 +10977,7 @@ export declare class TrafficAreaAnalyticsModule extends AbstractMapModule<AreaAn
10612
10977
  get events(): CombinedEvents<AreaAnalyticsTileFeature, TrafficAreaAnalyticsConfig, TrafficAreaAnalytics>;
10613
10978
  private get mode();
10614
10979
  private get activeMetric();
10980
+ private get lightDark();
10615
10981
  private applyModeVisibility;
10616
10982
  private hideAllDataLayers;
10617
10983
  private addHighlightLayersToMap;
@@ -10957,7 +11323,7 @@ type TrafficFlowSourcesWithLayers = {
10957
11323
  *
10958
11324
  * @group Traffic Flow
10959
11325
  */
10960
- export declare class TrafficFlowModule extends AbstractMapModule<TrafficFlowSourcesWithLayers, FlowConfig> {
11326
+ export declare class TrafficFlowModule extends AbstractStyleOwnedMapModule<TrafficFlowSourcesWithLayers, FlowConfig> {
10961
11327
  private originalFilters;
10962
11328
  /**
10963
11329
  * Retrieves a TrafficFlowModule instance for the given map.
@@ -11159,7 +11525,9 @@ export declare class TrafficFlowModule extends AbstractMapModule<TrafficFlowSour
11159
11525
  */
11160
11526
  type IncidentFocusStyle = {
11161
11527
  /**
11162
- * Colour of the outline painted beneath the focused stripe. Defaults to `#000`.
11528
+ * Colour of the outline painted beneath the focused stripe.
11529
+ *
11530
+ * @defaultValue `#000` on light map styles, `#FFF` on dark styles
11163
11531
  */
11164
11532
  outlineColor?: string;
11165
11533
  /**
@@ -11191,8 +11559,8 @@ type TrafficIncidentOverlayConfig = MapModuleCommonConfig & {
11191
11559
  /**
11192
11560
  * Visual treatment for {@link TrafficIncidentOverlayModule.setFocus}.
11193
11561
  *
11194
- * - Omit (or `undefined`) — use the SDK default treatment: a black outline
11195
- * beneath the focused stripe and a `1.6×` width pop.
11562
+ * - Omit (or `undefined`) — use the SDK default treatment: an outline beneath
11563
+ * the focused stripe (black on light map styles, white on dark) and a `1.6×` width pop.
11196
11564
  * - `false` — disable the visual treatment. `setFocus(ids)` still writes
11197
11565
  * MapLibre `feature-state.focused`, so callers can drive their own
11198
11566
  * styling (extra layers, sidebar overlays, …) off that state.
@@ -11230,8 +11598,9 @@ type Sources = {
11230
11598
  * ## Focus
11231
11599
  *
11232
11600
  * {@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
11601
+ * incident. The default visual treatment widens the focused subset and paints an
11602
+ * outline beneath it (black on light map styles, white on dark); unfocused incidents
11603
+ * are unchanged. Override or disable the visual
11235
11604
  * treatment via the `focus` config — `focus: false` keeps `setFocus` writing feature-state
11236
11605
  * but emits no halo layer and no width pop, leaving callers free to drive their own
11237
11606
  * styling off `feature-state.focused`.
@@ -11298,7 +11667,7 @@ type Sources = {
11298
11667
  *
11299
11668
  * @group Traffic
11300
11669
  */
11301
- export declare class TrafficIncidentOverlayModule extends AbstractMapModule<Sources, TrafficIncidentOverlayConfig> {
11670
+ export declare class TrafficIncidentOverlayModule extends AbstractDataOwnedMapModule<Sources, TrafficIncidentOverlayConfig> {
11302
11671
  private lastResult;
11303
11672
  private lastFeatureIds;
11304
11673
  private lastFocusIds;
@@ -11322,6 +11691,8 @@ export declare class TrafficIncidentOverlayModule extends AbstractMapModule<Sour
11322
11691
  protected _applyConfig(config: TrafficIncidentOverlayConfig | undefined): TrafficIncidentOverlayConfig | undefined;
11323
11692
  private applyBeforeLayer;
11324
11693
  /** @ignore */
11694
+ protected discardShownData(): void;
11695
+ /** @ignore */
11325
11696
  protected restoreDataAndConfigImpl(): void;
11326
11697
  /**
11327
11698
  * Render the service result. Replaces any previously shown snapshot.
@@ -11360,7 +11731,7 @@ export declare class TrafficIncidentOverlayModule extends AbstractMapModule<Sour
11360
11731
  * Mark a subset of currently-rendered incidents as "focused" via MapLibre
11361
11732
  * feature-state. `null` clears the state. Paint expressions in
11362
11733
  * `incidentDetailsLayers.ts` read `['feature-state', 'focused']` and pop the
11363
- * focused subset (wider stripe + black outline). Unfocused features are
11734
+ * focused subset (wider stripe + a theme-aware outline). Unfocused features are
11364
11735
  * unchanged — the focus treatment adds emphasis, it does not dim the rest.
11365
11736
  *
11366
11737
  * No effect if called before `show()`.
@@ -11706,7 +12077,7 @@ type TrafficIncidentsSourcesWithLayers = {
11706
12077
  *
11707
12078
  * @group Traffic Incidents
11708
12079
  */
11709
- export declare class TrafficIncidentsModule extends AbstractMapModule<TrafficIncidentsSourcesWithLayers, IncidentsConfig> {
12080
+ export declare class TrafficIncidentsModule extends AbstractStyleOwnedMapModule<TrafficIncidentsSourcesWithLayers, IncidentsConfig> {
11710
12081
  private originalFilters;
11711
12082
  /**
11712
12083
  * Retrieves a TrafficIncidentsModule instance for the given map.
@@ -12031,4 +12402,4 @@ export declare const calculatePaddedCenter: (options: CalculateMapCenterOptions)
12031
12402
  */
12032
12403
  export declare const calculateFittingBBox: (options: CalculateFittingBBoxOptions) => BBox | null;
12033
12404
  //#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 };
12405
+ 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 };