@tomtom-org/maps-sdk 0.55.1 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { BackgroundLayerSpecification, CircleLayerSpecification, DataDrivenPropertyValueSpecification, ExpressionFilterSpecification, ExpressionSpecification, GeoJSONSource, GeoJSONSourceSpecification, LayerSpecification, LineLayerSpecification, LngLat, Map, MapGeoJSONFeature, MapOptions, Source, SourceSpecification, StyleImageInterface, StyleImageMetadata, StyleSpecification, SymbolLayerSpecification } from "maplibre-gl";
2
- import { Anything, AreaAnalyticsMetricKey, AreaAnalyticsMetrics, BBox, ChargingSpeed, ChargingStop, ChargingStopProps, CommonPlaceProps, DelayMagnitude, DisplayUnits, GetPositionEntryPointOption, GlobalConfig, Instruction, Language, POICategory, Place, Places, PolygonFeature, PolygonFeatures, Route, RouteProps, Routes, SectionProps, SectionType, TrafficAreaAnalytics, TrafficIncident, TrafficIncidentBaseProperties, TrafficIncidentCategory, TrafficIncidentDetails, TrafficIncidentTimeValidity, TrafficSectionProps, Waypoint, WaypointLike, Waypoints } from "@tomtom-org/maps-sdk/core";
2
+ import { Anything, AreaAnalyticsMetricKey, AreaAnalyticsMetrics, BBox, ChargingSpeed, ChargingStop, ChargingStopProps, CommonPlaceProps, CountrySectionProps, DelayMagnitude, DisplayUnits, GetPositionEntryPointOption, GlobalConfig, Instruction, Language, POICategory, Place, Places, PolygonFeature, PolygonFeatures, Route, RouteProps, Routes, SectionProps, SectionType, TrafficAreaAnalytics, TrafficIncident, TrafficIncidentBaseProperties, TrafficIncidentCategory, TrafficIncidentDetails, TrafficIncidentTimeValidity, TrafficSectionProps, Waypoint, WaypointLike, Waypoints } from "@tomtom-org/maps-sdk/core";
3
3
  //#region src/shared/types/style.d.ts
4
4
  /**
5
5
  * Indicator of a light or dark theme.
@@ -342,9 +342,35 @@ export type StandardStyle = {
342
342
  version?: string;
343
343
  };
344
344
  /**
345
- * Configuration for a custom map style.
345
+ * Where a custom style comes from: a URL to fetch it from, or the specification itself. Exactly one.
346
+ *
347
+ * @example
348
+ * ```typescript
349
+ * const fromUrl: CustomStyleSource = { url: 'https://example.com/my-custom-style.json' };
350
+ *
351
+ * const fromJson: CustomStyleSource = {
352
+ * json: { version: 8, sources: { ... }, layers: [ ... ] },
353
+ * };
354
+ * ```
346
355
  *
347
- * Allows using your own map style either via URL or direct JSON specification.
356
+ * @group Map Style
357
+ */
358
+ export type CustomStyleSource = {
359
+ /**
360
+ * URL to a MapLibre/Mapbox style JSON, without an API key — the SDK adds the configured one.
361
+ */
362
+ url: string;
363
+ json?: never;
364
+ } | {
365
+ /**
366
+ * The complete style, as a
367
+ * [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/) object.
368
+ */
369
+ json: StyleSpecification;
370
+ url?: never;
371
+ };
372
+ /**
373
+ * Configuration for a custom map style.
348
374
  *
349
375
  * @remarks
350
376
  * Use custom styles for:
@@ -371,41 +397,7 @@ export type StandardStyle = {
371
397
  *
372
398
  * @group Map Style
373
399
  */
374
- export type CustomStyle = {
375
- /**
376
- * URL to a MapLibre/Mapbox style JSON.
377
- *
378
- * The URL should not include the API key - it will be automatically added.
379
- * Mutually exclusive with the `json` property.
380
- *
381
- * @example
382
- * ```typescript
383
- * url: 'https://api.tomtom.com/style/1/style/my-custom-style'
384
- * ```
385
- */
386
- url?: string;
387
- /**
388
- * Direct style specification as JSON.
389
- *
390
- * Provide the complete MapLibre Style Specification object.
391
- * Mutually exclusive with the `url` property.
392
- *
393
- * @see [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/)
394
- *
395
- * @example
396
- * ```typescript
397
- * json: {
398
- * version: 8,
399
- * sources: {
400
- * 'my-source': { type: 'vector', url: '...' }
401
- * },
402
- * layers: [
403
- * { id: 'background', type: 'background', paint: { 'background-color': '#f0f0f0' } }
404
- * ]
405
- * }
406
- * ```
407
- */
408
- json?: StyleSpecification;
400
+ export type CustomStyle = CustomStyleSource & {
409
401
  /**
410
402
  * Whether the style draws a light or a dark map.
411
403
  *
@@ -4107,9 +4099,11 @@ export declare abstract class AbstractStyleOwnedMapModule<SOURCES_WITH_LAYERS ex
4107
4099
  * - `number`: an absolute number with a range.
4108
4100
  * - `color`: a CSS colour string.
4109
4101
  * - `enum`: one of the knob's `options`.
4102
+ * - `colors`: a list of colours, each a CSS colour string or one of the knob's `options` — names
4103
+ * the module resolves to colours, such as styling knob ids. An empty list is the knob's default.
4110
4104
  * @group Shared
4111
4105
  */
4112
- export type KnobKind = 'toggle' | 'factor' | 'number' | 'color' | 'enum';
4106
+ export type KnobKind = 'toggle' | 'factor' | 'number' | 'color' | 'enum' | 'colors';
4113
4107
  /**
4114
4108
  * Inclusive bounds for a `factor` or `number` knob. `step` is what a slider would use; some ranges
4115
4109
  * (e.g. opacity 0–1) have no natural step and omit it.
@@ -4160,7 +4154,7 @@ export type KnobDescriptor<T = unknown> = {
4160
4154
  overridden: boolean;
4161
4155
  /** Inclusive bounds, for `factor` and `number` knobs. */
4162
4156
  range?: KnobRange;
4163
- /** The allowed values, for `enum` knobs. */
4157
+ /** The allowed values, for `enum` knobs; the names accepted besides CSS colours, for `colors` knobs. */
4164
4158
  options?: readonly string[];
4165
4159
  /**
4166
4160
  * Whether the knob has anything to work on in the loaded style. Omitted by modules whose knobs
@@ -7497,7 +7491,7 @@ type PlaceConnectionsConfig = {
7497
7491
  *
7498
7492
  * @group Places
7499
7493
  */
7500
- type PlacesModuleConfig = MapModuleCommonConfig & {
7494
+ type PlacesModuleConfig<P extends CommonPlaceProps = CommonPlaceProps> = MapModuleCommonConfig & {
7501
7495
  /**
7502
7496
  * Base style for all places.
7503
7497
  *
@@ -7580,10 +7574,26 @@ type PlacesModuleConfig = MapModuleCommonConfig & {
7580
7574
  * }
7581
7575
  * ```
7582
7576
  */
7583
- extraFeatureProps?: {
7584
- [key: string]: ((place: Place) => any) | any;
7585
- };
7577
+ extraFeatureProps?: Record<string, ExtraFeatureProp<P>>;
7578
+ };
7579
+ /**
7580
+ * A value a GeoJSON feature property can hold.
7581
+ *
7582
+ * @group Places
7583
+ */
7584
+ type FeaturePropValue = string | number | boolean | null | undefined | FeaturePropValue[] | {
7585
+ [key: string]: FeaturePropValue;
7586
7586
  };
7587
+ /**
7588
+ * An entry of {@link PlacesModuleConfig.extraFeatureProps}: a fixed value written onto every place
7589
+ * feature, or a function computing one per place.
7590
+ *
7591
+ * @typeParam P - The place properties the callbacks receive. Name it on the config
7592
+ * (`PlacesModuleConfig<MyPlaceProps>`) to have callbacks typed for the places you show.
7593
+ *
7594
+ * @group Places
7595
+ */
7596
+ type ExtraFeatureProp<P extends CommonPlaceProps = CommonPlaceProps> = FeaturePropValue | ((place: Place<P>) => FeaturePropValue);
7587
7597
  //#endregion
7588
7598
  //#region src/places/utils/prepareConnectionsForDisplay.d.ts
7589
7599
  /**
@@ -7652,89 +7662,6 @@ export type PlacesEvents = CombinedEvents<MapGeoJSONFeature, PlacesModuleConfig,
7652
7662
  /** The lines and labels connecting places to their parent, when connections are shown. */
7653
7663
  connections: UserEvents<MapGeoJSONFeature>;
7654
7664
  };
7655
- /**
7656
- * Map module for displaying and managing place markers.
7657
- *
7658
- * The PlacesModule provides functionality to display location markers (pins) on the map
7659
- * for points of interest, search results, or custom locations. It supports various marker
7660
- * styles, custom icons, text labels, and interactive events.
7661
- *
7662
- * @remarks
7663
- * **Features:**
7664
- * - Multiple marker styles (pin, circle-icon, base-map POI-like)
7665
- * - Custom icons per POI category
7666
- * - Text labels with styling options
7667
- * - Data-driven styling via MapLibre expressions
7668
- * - Interactive events (click, hover, etc.)
7669
- * - Support for custom feature properties
7670
- * - EV charging station availability display (opt-in)
7671
- *
7672
- * **Marker Styles:**
7673
- * - `pin`: Traditional teardrop-shaped map pins
7674
- * - `circle-icon`: Simple circular markers (previously named `circle`)
7675
- * - `base-map`: Mimics the map's built-in POI layer styling (combines `main`, `selected`, and `micro` layers). For micro-only rendering, hide the `main` layer via `layers.main.layout.visibility = 'none'`.
7676
- *
7677
- * **EV Charging Station Availability:**
7678
- * When displaying EV charging stations with availability data from
7679
- * {@link getPlacesWithEVAvailability}, the module can:
7680
- * - Show available/total charging points (e.g., "3/10")
7681
- * - Color-code availability (green = good, orange = limited, red = none/low)
7682
- * - Display as formatted text within the station's label
7683
- *
7684
- * This feature is disabled by default. To enable it, set `evAvailability.enabled` to `true`
7685
- * in the configuration.
7686
- *
7687
- * **Common Use Cases:**
7688
- * - Search result visualization
7689
- * - Custom location markers
7690
- * - Store locators
7691
- * - EV charging station maps with real-time availability
7692
- * - Delivery/pickup points
7693
- * - Saved locations display
7694
- *
7695
- * @example
7696
- * ```typescript
7697
- * // Create places module with pin markers
7698
- * const placesModule = await PlacesModule.create(map, {
7699
- * icon: {
7700
- * categoryIcons: []
7701
- * },
7702
- * text: {
7703
- * field: (place) => place.properties.poi?.name || 'Unknown'
7704
- * },
7705
- * theme: 'pin'
7706
- * });
7707
- *
7708
- * // Display places from search
7709
- * await placesModule.show(searchResults);
7710
- *
7711
- * // EV Charging Stations - Opt-in to availability display
7712
- * const evStations = await PlacesModule.create(map, {
7713
- * evAvailability: { enabled: true }
7714
- * });
7715
- * const results = await search({ poiCategories: ['ELECTRIC_VEHICLE_STATION'] });
7716
- * evStations.show(await getPlacesWithEVAvailability(results)); // Shows availability
7717
- *
7718
- * // Granular control: Enable for searched stations only, background stations without
7719
- * const bgStations = await PlacesModule.create(map); // EV availability disabled
7720
- * const searched = await PlacesModule.create(map, {
7721
- * evAvailability: { enabled: true }
7722
- * });
7723
- *
7724
- * // Handle clicks
7725
- * placesModule.events.on('click', (feature) => {
7726
- * console.log('Clicked:', feature.properties);
7727
- * });
7728
- *
7729
- * placesModule.events.on('hover', (feature) => {
7730
- * showTooltip(feature.properties.poi?.name);
7731
- * });
7732
- * ```
7733
- *
7734
- * @see [Places Guide](https://docs.tomtom.com/maps-sdk-js/guides/map/places)
7735
- *
7736
- * @group Places
7737
- */
7738
7665
  export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourcesAndLayers, PlacesModuleConfig> {
7739
7666
  private layerSpecs;
7740
7667
  private connectionLayerSpecs;
@@ -7757,7 +7684,7 @@ export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourc
7757
7684
  * @param config The module optional configuration
7758
7685
  * @returns {Promise} Returns a promise with a new instance of this module
7759
7686
  */
7760
- static create(tomtomMap: TomTomMap, config?: PlacesModuleConfig): Promise<PlacesModule>;
7687
+ static create<P extends CommonPlaceProps = CommonPlaceProps>(tomtomMap: TomTomMap, config?: PlacesModuleConfig<P>): Promise<PlacesModule>;
7761
7688
  private constructor();
7762
7689
  /**
7763
7690
  * @ignore
@@ -7868,9 +7795,7 @@ export declare class PlacesModule extends AbstractDataOwnedMapModule<PlacesSourc
7868
7795
  * });
7869
7796
  * ```
7870
7797
  */
7871
- applyExtraFeatureProps(extraFeatureProps: {
7872
- [key: string]: any;
7873
- }): void;
7798
+ applyExtraFeatureProps<P extends CommonPlaceProps = CommonPlaceProps>(extraFeatureProps: NonNullable<PlacesModuleConfig<P>['extraFeatureProps']>): void;
7874
7799
  private updateLayersAndData;
7875
7800
  private rebuildSourcesAndLayers;
7876
7801
  private updateConnectionLayersAndData;
@@ -9258,6 +9183,18 @@ type RouteLayersConfig = {
9258
9183
  */
9259
9184
  routeSummaryBubbleSymbol?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
9260
9185
  } & HasAdditionalLayersConfig;
9186
+ /**
9187
+ * Border crossing layers.
9188
+ *
9189
+ * @remarks
9190
+ * Anything {@link CountryCrossingConfig} cannot express about the plaque or its label.
9191
+ */
9192
+ countryCrossings?: {
9193
+ /**
9194
+ * Symbol layer writing each crossing's label on its plaque.
9195
+ */
9196
+ routeCountryCrossing?: Partial<ToBeAddedLayerSpecTemplate<SymbolLayerSpecification>>;
9197
+ } & HasAdditionalLayersConfig;
9261
9198
  };
9262
9199
  /**
9263
9200
  * Mapping of charging stop speeds to sprite image IDs.
@@ -9512,9 +9449,6 @@ type SectionIconConfig = {
9512
9449
  * - `center`: one icon at the middle of each section.
9513
9450
  * - `along`: icons repeated along the section.
9514
9451
  *
9515
- * A section is a stretch of line, so there is no placement at its start: MapLibre places
9516
- * symbols on a line either once at its centre or repeatedly along it.
9517
- *
9518
9452
  * @defaultValue `"center"`
9519
9453
  */
9520
9454
  placement?: 'center' | 'along';
@@ -9579,6 +9513,23 @@ type SectionKnobs = {
9579
9513
  * @group Routing
9580
9514
  */
9581
9515
  type SectionSignUnit = 'km/h' | 'mph';
9516
+ /**
9517
+ * Where a section's signs are posted along the stretch they belong to.
9518
+ *
9519
+ * @remarks
9520
+ * - `atChange`, the default — one sign where the value changes, and none after it, which is where
9521
+ * the road posts its own. Sections of a sign-posting type tile the route end to end and no two
9522
+ * consecutive ones carry the same value, so every section boundary is a change.
9523
+ * - `along` — the sign repeated down the stretch at a fixed screen spacing, so a reader zoomed into
9524
+ * the middle of a long one still sees the value in force. A stretch too short on screen to fit a
9525
+ * sign draws none.
9526
+ *
9527
+ * A stretch can run 50 km, so under `atChange` a reader zoomed in past its start sees no sign until
9528
+ * the next change — as on the road itself.
9529
+ *
9530
+ * @group Routing
9531
+ */
9532
+ type SectionSignPlacement = 'atChange' | 'along';
9582
9533
  /**
9583
9534
  * What a section's signs give way to when two symbols want the same spot.
9584
9535
  *
@@ -9587,9 +9538,8 @@ type SectionSignUnit = 'km/h' | 'mph';
9587
9538
  * one that gives way.
9588
9539
  *
9589
9540
  * - `belowMapLabels` — the signs give way to everything, the base map's own labels included, so a
9590
- * sign never lands on a street or place name. Sparse maps, and the price of a tidy one: in a city
9591
- * the labels take most of the room. Affordable because a sign repeats along its stretch, so one
9592
- * dropped where a label sits reappears further along.
9541
+ * sign never lands on a street or place name, at the cost of showing fewer in a city. Cheap under
9542
+ * `along` placement, where the dropped sign is posted again further down the stretch.
9593
9543
  * - `belowRouteIcons` — the signs give way to the route's own icons, each of which says something
9594
9544
  * the road cannot, but take precedence over the base map's labels.
9595
9545
  * - `aboveRouteIcons` — the signs give way to nothing, for a map whose subject is the limits.
@@ -9616,24 +9566,32 @@ type SectionSignPriority = 'belowMapLabels' | 'belowRouteIcons' | 'aboveRouteIco
9616
9566
  * `country` sections the display units decide the face and the unit, and an explicit {@link unit}
9617
9567
  * overrides both.
9618
9568
  *
9569
+ * A sign stands where the limit changes; {@link placement} repeats it down the stretch instead.
9619
9570
  * Signs scale with the zoom, as the ferry and toll-road icons do; {@link minzoom} decides how early
9620
9571
  * they appear at all.
9621
9572
  *
9622
9573
  * @group Routing
9623
9574
  */
9624
9575
  type SectionSignConfig = {
9576
+ /**
9577
+ * Where the signs are posted along the stretch.
9578
+ *
9579
+ * @defaultValue `'atChange'`, which is where the road posts its own.
9580
+ */
9581
+ placement?: SectionSignPlacement;
9625
9582
  /**
9626
9583
  * The lowest zoom the signs are drawn at.
9627
9584
  *
9628
- * @defaultValue 9, the zoom at which a sign is about a stretch of road a reader can see. Over
9629
- * a whole country the stretches fall in the same few pixels, so the few signs that survive the
9630
- * collision are an arbitrary sample rather than the limits of the drive.
9585
+ * @defaultValue 10, where a sign is about a stretch of road a reader can see. Further out the
9586
+ * stretches fall in the same few pixels and the surviving signs are an arbitrary sample.
9631
9587
  */
9632
9588
  minzoom?: number;
9633
9589
  /**
9634
- * Whether a sign gives way to the other icons the route draws, or takes precedence over them.
9590
+ * What a sign gives way to when another symbol wants the same spot.
9635
9591
  *
9636
- * @defaultValue `'belowRouteIcons'`
9592
+ * @defaultValue follows {@link placement}: `'belowRouteIcons'` under `atChange`, where the sign
9593
+ * is the only one posting that change; `'belowMapLabels'` under `along`, where the next repeat
9594
+ * posts it again.
9637
9595
  */
9638
9596
  priority?: SectionSignPriority;
9639
9597
  /**
@@ -9645,6 +9603,69 @@ type SectionSignConfig = {
9645
9603
  */
9646
9604
  unit?: SectionSignUnit;
9647
9605
  };
9606
+ /**
9607
+ * How a border crossing's plaque is turned on the map.
9608
+ *
9609
+ * - `viewport` — level with the screen, however the map is rotated.
9610
+ * - `route` — turned to the route's bearing where it crosses, so the plaque runs along the road. It
9611
+ * is kept upright, so the label never reads upside down.
9612
+ *
9613
+ * @group Routing
9614
+ */
9615
+ type CountryCrossingAlignment = 'viewport' | 'route';
9616
+ /**
9617
+ * Appearance of the border crossings along a route.
9618
+ *
9619
+ * @remarks
9620
+ * A crossing is the seam between two consecutive `country` sections, so it is a point rather than a
9621
+ * stretch, and takes knobs of its own instead of a place in the section catalogue. Each is a plaque
9622
+ * naming both countries by their ISO 3166-1 alpha-2 codes in the direction of travel, `'ES → FR'`.
9623
+ *
9624
+ * The plaque follows the map's light/dark theme unless {@link color} or {@link textColor} says
9625
+ * otherwise, so it stays legible across a style change without being reconfigured.
9626
+ *
9627
+ * @example
9628
+ * ```typescript
9629
+ * const routes = await calculateRoute({ locations, sectionTypes: ['country'] });
9630
+ * await routing.showRoutes(routes);
9631
+ * ```
9632
+ *
9633
+ * @group Routing
9634
+ */
9635
+ type CountryCrossingConfig = {
9636
+ /**
9637
+ * Whether the crossings are drawn.
9638
+ *
9639
+ * @defaultValue `true`
9640
+ */
9641
+ visible?: boolean;
9642
+ /**
9643
+ * The lowest zoom a crossing is drawn at.
9644
+ *
9645
+ * @defaultValue 4, low enough for a continental route to show its borders while framed whole.
9646
+ */
9647
+ minzoom?: number;
9648
+ /**
9649
+ * The plaque colour behind the label.
9650
+ *
9651
+ * @defaultValue the SDK's near-black `'#1A2024'` on a light map, and the near-white `'#F1F3F5'`
9652
+ * on a dark one.
9653
+ */
9654
+ color?: string;
9655
+ /**
9656
+ * The label colour.
9657
+ *
9658
+ * @defaultValue whichever of the SDK's near-black and near-white reads on the plaque, so
9659
+ * setting {@link color} alone stays legible.
9660
+ */
9661
+ textColor?: string;
9662
+ /**
9663
+ * How the plaque is turned on the map.
9664
+ *
9665
+ * @defaultValue `'viewport'`
9666
+ */
9667
+ alignment?: CountryCrossingAlignment;
9668
+ };
9648
9669
  /**
9649
9670
  * Appearance of one route section type.
9650
9671
  *
@@ -9745,6 +9766,13 @@ type RoutingModuleConfig = MapModuleCommonConfig & {
9745
9766
  */
9746
9767
  visible?: boolean;
9747
9768
  };
9769
+ /**
9770
+ * Appearance of the border crossings along the route.
9771
+ *
9772
+ * @remarks
9773
+ * Read off the route's `country` sections, so a route carrying none draws none.
9774
+ */
9775
+ countryCrossings?: CountryCrossingConfig;
9748
9776
  /**
9749
9777
  * Appearance of the route sections, keyed by section type.
9750
9778
  *
@@ -9781,9 +9809,10 @@ type RoutingModuleConfig = MapModuleCommonConfig & {
9781
9809
  * @param config - Optional routing module configuration to customize layer properties.
9782
9810
  * @param layerIDPrefix - Optional prefix to add to layer IDs for supporting multiple instances.
9783
9811
  * @param instanceIndex - Optional instance index for image ID suffixes.
9812
+ * @param lightDark - The map style's light/dark theme, which the country crossing plaque colours follow.
9784
9813
  * @ignore
9785
9814
  */
9786
- export declare const buildRoutingLayers: (config?: RoutingModuleConfig, layerIDPrefix?: string, instanceIndex?: number) => Required<RouteLayersConfig>;
9815
+ export declare const buildRoutingLayers: (config?: RoutingModuleConfig, layerIDPrefix?: string, instanceIndex?: number, lightDark?: LightDark) => Required<RouteLayersConfig>;
9787
9816
  /**
9788
9817
  * Default routing layers configuration. Calls routingLayers with no parameters.
9789
9818
  *
@@ -10201,6 +10230,63 @@ type DisplayRouteSummary = Feature<Point, DisplayRouteSummaryProps>;
10201
10230
  * @group Routing
10202
10231
  */
10203
10232
  type DisplayRouteSummaries = FeatureCollection<Point, DisplayRouteSummaryProps>;
10233
+ /**
10234
+ * Display-ready props of one border crossing.
10235
+ *
10236
+ * @group Routing
10237
+ */
10238
+ type DisplayCountryCrossingProps = DisplayRouteRelatedProps & {
10239
+ /** ISO 3166-1 alpha-2 code of the country the route leaves. */
10240
+ fromCountryCode: string;
10241
+ /** ISO 3166-1 alpha-2 code of the country the route enters. */
10242
+ toCountryCode: string;
10243
+ /** The label the plaque is stretched around — `'ES → FR'`. */
10244
+ label: string;
10245
+ /**
10246
+ * Bearing of the route where it crosses, in degrees clockwise from north.
10247
+ *
10248
+ * @remarks
10249
+ * What `alignment: 'route'` turns the plaque by. Present whatever the alignment, so switching
10250
+ * it is a restyle rather than a re-derive.
10251
+ */
10252
+ bearing: number;
10253
+ /**
10254
+ * `startPointIndex` of the `country` section the route leaves, which identifies that section
10255
+ * on {@link RouteProps.sections} even when the route enters the same country twice.
10256
+ */
10257
+ fromSectionStartPointIndex: number;
10258
+ /** `startPointIndex` of the `country` section the route enters. */
10259
+ toSectionStartPointIndex: number;
10260
+ };
10261
+ /**
10262
+ * GeoJSON feature of one border crossing, placed where the route enters the second country.
10263
+ *
10264
+ * @group Routing
10265
+ */
10266
+ type DisplayCountryCrossing = Feature<Point, DisplayCountryCrossingProps>;
10267
+ /**
10268
+ * A border crossing as an event hands it over: the drawn feature, plus the two `country` sections
10269
+ * it joins.
10270
+ *
10271
+ * @remarks
10272
+ * The sections are looked up on the route the crossing belongs to, so they are the same objects
10273
+ * `route.properties.sections.country` holds rather than copies. They are absent only when the route
10274
+ * that carried them is no longer shown.
10275
+ *
10276
+ * @group Routing
10277
+ */
10278
+ type CountryCrossingFeature = Feature<Point, DisplayCountryCrossingProps & {
10279
+ /** The `country` section the route leaves. */
10280
+ fromSection?: CountrySectionProps;
10281
+ /** The `country` section the route enters. */
10282
+ toSection?: CountrySectionProps;
10283
+ }>;
10284
+ /**
10285
+ * GeoJSON feature collection of the border crossings along the shown routes.
10286
+ *
10287
+ * @group Routing
10288
+ */
10289
+ type DisplayCountryCrossings = FeatureCollection<Point, DisplayCountryCrossingProps>;
10204
10290
  //#endregion
10205
10291
  //#region src/routing/types/guidance.d.ts
10206
10292
  /**
@@ -10583,6 +10669,7 @@ type RoutingSourcesWithLayers = { [K in SectionSourceKey<GeneratedSectionType>]:
10583
10669
  instructionLines: GeoJSONSourceWithLayers<DisplayInstructions>;
10584
10670
  instructionArrows: GeoJSONSourceWithLayers<DisplayInstructionArrows>;
10585
10671
  summaryBubbles: GeoJSONSourceWithLayers<DisplayRouteSummaries>;
10672
+ countryCrossings: GeoJSONSourceWithLayers<DisplayCountryCrossings>;
10586
10673
  };
10587
10674
  //#endregion
10588
10675
  //#region src/routing/types/showOptions.d.ts
@@ -10663,6 +10750,8 @@ export type RoutingEvents = CombinedEvents<MapGeoJSONFeature, RoutingModuleConfi
10663
10750
  chargingStops: UserEvents<RouteSection>;
10664
10751
  /** The summary bubbles shown against each alternative. */
10665
10752
  summaryBubbles: UserEvents<DisplayRouteSummary>;
10753
+ /** The border crossings along the route, each carrying the two `country` sections it joins. */
10754
+ countryCrossings: UserEvents<CountryCrossingFeature>;
10666
10755
  /** Traffic incidents on the route. */
10667
10756
  incidents: UserEvents<RouteSection<DisplayTrafficSectionProps>>;
10668
10757
  /** Sections the vehicle is restricted from. */
@@ -10791,6 +10880,29 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
10791
10880
  * this instead of restyling the layer in place.
10792
10881
  */
10793
10882
  private showSpeedLimitSections;
10883
+ /** The colours the crossings draw with, which follow the map's theme unless configured. */
10884
+ private crossingColors;
10885
+ /**
10886
+ * What {@link applyCountryCrossingConfig} last painted the crossings with.
10887
+ *
10888
+ * @remarks
10889
+ * Tracked here rather than re-derived from `this.config`, because the theme is an input the
10890
+ * config cannot see: a style change moves the resolved colours while the config says the same
10891
+ * thing. Cleared when the sources are rebuilt, so a restored style repaints from scratch.
10892
+ */
10893
+ private appliedCrossingColors;
10894
+ /**
10895
+ * Brings the border crossings in line with a changed configuration.
10896
+ *
10897
+ * @remarks
10898
+ * The source is gated on `visible`, as the summary bubbles' is, so switching them back on
10899
+ * re-derives the features: a layer spec cannot put back data the source does not hold.
10900
+ *
10901
+ * Both colours are applied here rather than left to the layer spec: the plaque is an image, so
10902
+ * a new colour has to replace it, and the label's colour follows the map theme, which the spec
10903
+ * that built the layer cannot know about after a style change.
10904
+ */
10905
+ private applyCountryCrossingConfig;
10794
10906
  /**
10795
10907
  * Re-derives the posted signs when the unit they read in changed.
10796
10908
  *
@@ -10977,6 +11089,7 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
10977
11089
  * - `instructionLines`: Turn-by-turn instruction lines
10978
11090
  * - `instructionArrows`: Instruction arrow markers
10979
11091
  * - `summaryBubbles`: Route summary popups
11092
+ * - `countryCrossings`: Border crossings along the route
10980
11093
  *
10981
11094
  * @example
10982
11095
  * ```typescript
@@ -11003,6 +11116,7 @@ export declare class RoutingModule extends AbstractDataOwnedMapModule<RoutingSou
11003
11116
  instructionLines: DisplayInstructions;
11004
11117
  instructionArrows: DisplayInstructionArrows;
11005
11118
  summaryBubbles: DisplayRouteSummaries;
11119
+ countryCrossings: DisplayCountryCrossings;
11006
11120
  carpoolSections: RouteSections | undefined;
11007
11121
  carTrainSections: RouteSections | undefined;
11008
11122
  importantRoadStretchSections: RouteSections | undefined;
@@ -11084,6 +11198,140 @@ type LayerSelector = {
11084
11198
  idExcludes?: string[];
11085
11199
  };
11086
11200
  //#endregion
11201
+ //#region src/styling/mapColorCatalogue.d.ts
11202
+ /**
11203
+ * The ten semantic map colours — TomTom Map Maker's *Foundations* palette, under its own names and
11204
+ * in its own order. One name drives every layer and shade the style derives from it.
11205
+ *
11206
+ * | Name | Map Maker | Reaches |
11207
+ * |---|---|---|
11208
+ * | `land` | Land (base) | Map background and other bare-land features, influences admin borders/labels. Also used to derive all map colours if undefined. |
11209
+ * | `water` | Water | Waterbodies, waterways and other water features. Also influences glaciers, water labels and ferry lines. |
11210
+ * | `vegetation` | Vegetation | Forests and other land cover such as grass and shrubland. Also influences earth cover vegetation at smaller scales. |
11211
+ * | `park` | Park & Recreation | City parks and sport/recreation grounds. Also influences National Parks and other protected areas at smaller scales. |
11212
+ * | `artificial` | Artificial | Built-up-areas and man-made features such as landuse grounds and buildings. Also influences railways. |
11213
+ * | `roadMajor` | Major Road | Most important road classes, from motorways & trunks to primary roads. Also influences outline and tunnel colours. |
11214
+ * | `road` | Road | Less important road classes, from secondary/tertiary to streets and service roads. Also influences tunnel colours. |
11215
+ * | `roadOutline` | Road Outline | Road outlines for secondary/tertiary roads and minor classes. Also influences road labels and all other outline colours. |
11216
+ * | `label` | Label | Labels for capitals and other populated places/admin areas. Also influences border styling and all other label colours. |
11217
+ * | `labelOutline` | Label Outline | Outlines for populated places and admin area labels. Also influences border outlines and all other label halos. |
11218
+ *
11219
+ * @group Map Styling
11220
+ */
11221
+ type MapColorName = 'land' | 'water' | 'vegetation' | 'park' | 'artificial' | 'roadMajor' | 'road' | 'roadOutline' | 'label' | 'labelOutline';
11222
+ /**
11223
+ * A partial set of map colours for {@link StylingModule.setMapColors}: any subset of the ten,
11224
+ * each a CSS colour string.
11225
+ *
11226
+ * @example
11227
+ * ```typescript
11228
+ * styling.setMapColors({ land: '#f3f5f7', water: '#accbe2', roadMajor: '#a1b8ce', label: '#364659' });
11229
+ * ```
11230
+ *
11231
+ * @group Map Styling
11232
+ */
11233
+ type MapColors = Partial<Record<MapColorName, string>>;
11234
+ /**
11235
+ * Every paint property the styling knobs write a colour to. Listed once as values, since
11236
+ * `StylingModule` needs the set at runtime to pick MapLibre's paint setter over its layout one.
11237
+ * @ignore
11238
+ */
11239
+ declare const paintColorProperties: readonly ["fill-color", "fill-outline-color", "line-color", "text-color", "text-halo-color", "fill-extrusion-color", "background-color"];
11240
+ /** @ignore */
11241
+ type PaintColorProperty = (typeof paintColorProperties)[number];
11242
+ /**
11243
+ * The ten map colour names, in Map Maker's Foundations order.
11244
+ *
11245
+ * @group Map Styling
11246
+ */
11247
+ export declare const mapColorNames: MapColorName[];
11248
+ //#endregion
11249
+ //#region src/styling/presets.d.ts
11250
+ /**
11251
+ * The styling presets the SDK ships: named bundles of knob settings for common intents. Each is data
11252
+ * over the knob catalogue, so a preset is exactly as durable as the knobs it sets, and an app can
11253
+ * start from one and adjust.
11254
+ * @ignore
11255
+ */
11256
+ declare const stylingPresets: {
11257
+ readonly 'data-viz': {
11258
+ readonly name: "Data visualisation";
11259
+ readonly description: "A quiet base for your own data on top: fewer labels and markers, thinner roads, no badges competing with the overlay.";
11260
+ readonly settings: {
11261
+ readonly 'labels.sizeFactor': 0.9;
11262
+ readonly 'symbols.sizeFactor': 0.9;
11263
+ readonly 'roads.widthFactor': 0.8;
11264
+ readonly 'roads.exitNumbers': false;
11265
+ readonly 'roads.shields': false;
11266
+ readonly 'roads.arrows': false;
11267
+ readonly 'pois.microMarkers': false;
11268
+ readonly 'pois.minZoom': 14;
11269
+ readonly 'buildings.3d': false;
11270
+ };
11271
+ };
11272
+ readonly 'night-driving': {
11273
+ readonly name: "Night driving";
11274
+ readonly description: "Bigger labels and shields, wider roads and traffic tubes, POIs out of the way until close up.";
11275
+ readonly settings: {
11276
+ readonly 'labels.sizeFactor': 1.2;
11277
+ readonly 'symbols.sizeFactor': 1.2;
11278
+ readonly 'roads.widthFactor': 1.2;
11279
+ readonly 'roads.exitNumbers': true;
11280
+ readonly 'roads.shields': true;
11281
+ readonly 'roads.arrows': true;
11282
+ readonly 'pois.minZoom': 13;
11283
+ readonly 'pois.microMarkers': false;
11284
+ readonly 'traffic.flow.widthFactor': 1.3;
11285
+ readonly 'buildings.3d': false;
11286
+ };
11287
+ };
11288
+ readonly minimal: {
11289
+ readonly name: "Minimal";
11290
+ readonly description: "The bare map: land, water, roads and the main place names. Everything decorative off.";
11291
+ readonly settings: {
11292
+ readonly 'labels.sizeFactor': 0.9;
11293
+ readonly 'roads.exitNumbers': false;
11294
+ readonly 'roads.shields': false;
11295
+ readonly 'roads.arrows': false;
11296
+ readonly 'roads.restricted': false;
11297
+ readonly 'roads.underConstruction': false;
11298
+ readonly 'buildings.footprints': false;
11299
+ readonly 'buildings.3d': false;
11300
+ readonly 'pois.microMarkers': false;
11301
+ readonly 'pois.minZoom': 16;
11302
+ };
11303
+ };
11304
+ readonly globe: {
11305
+ readonly name: "Globe";
11306
+ readonly description: "A globe with an atmosphere for the zoomed-out view; flattens to Mercator as you zoom in.";
11307
+ readonly settings: {
11308
+ readonly 'view.projection': "globe";
11309
+ readonly 'view.sky': true;
11310
+ };
11311
+ };
11312
+ readonly terrain: {
11313
+ readonly name: "Terrain";
11314
+ readonly description: "3D terrain with a sky for tilted views. Needs the hillshade style part and a pitched camera.";
11315
+ readonly settings: {
11316
+ readonly 'view.terrain': true;
11317
+ readonly 'view.terrainExaggeration': 1.2;
11318
+ readonly 'view.sky': true;
11319
+ };
11320
+ };
11321
+ };
11322
+ /**
11323
+ * The id of a styling preset, as accepted by {@link StylingModule.applyPreset}.
11324
+ *
11325
+ * @group Map Styling
11326
+ */
11327
+ type StylingPresetId = keyof typeof stylingPresets;
11328
+ /**
11329
+ * Every styling preset id, in catalogue order.
11330
+ *
11331
+ * @group Map Styling
11332
+ */
11333
+ export declare const stylingPresetIds: StylingPresetId[];
11334
+ //#endregion
11087
11335
  //#region src/styling/types/stylingTypes.d.ts
11088
11336
  /**
11089
11337
  * What kind of value a styling knob takes — a subset of the shared {@link KnobKind} vocabulary.
@@ -11092,10 +11340,11 @@ type LayerSelector = {
11092
11340
  * - `number`: an absolute number with a range, e.g. a minimum zoom.
11093
11341
  * - `toggle`: `true`/`false`, e.g. whether exit numbers are shown.
11094
11342
  * - `color`: a CSS colour string (`#rrggbb`, `hsl(…)`, `rgb(…)`, a named colour).
11343
+ * - `enum`: one of the knob's `options`, e.g. the projection.
11095
11344
  *
11096
11345
  * @group Map Styling
11097
11346
  */
11098
- export declare const stylingKnobKinds: readonly ["factor", "number", "toggle", "color"];
11347
+ export declare const stylingKnobKinds: readonly ["factor", "number", "toggle", "color", "enum"];
11099
11348
  /**
11100
11349
  * @group Map Styling
11101
11350
  */
@@ -11152,10 +11401,13 @@ type StylingKnobDescriptor = KnobDescriptor & {
11152
11401
  current: StylingKnobValue | undefined;
11153
11402
  /** The range of valid values, for `factor` and `number` knobs. */
11154
11403
  range?: StylingKnobRange;
11404
+ /** The valid values, for `enum` knobs. */
11405
+ options?: readonly string[];
11155
11406
  /**
11156
11407
  * Whether the knob has anything to work on in the loaded style. `false` means setting it would
11157
- * do nothing — the SDK also warns once in the console when that happens. Check this before
11158
- * offering the knob in a UI or to an agent.
11408
+ * do nothing, and the SDK also warns once in the console when that happens. Check this before
11409
+ * offering the knob in a UI or to an agent. Map-level knobs are always available bar
11410
+ * `view.terrain`, which needs the style to carry an elevation source.
11159
11411
  */
11160
11412
  available: boolean;
11161
11413
  /** Which styles the knob works on; see {@link stylingKnobAppliesTo}. */
@@ -11169,6 +11421,22 @@ type StylingKnobDescriptor = KnobDescriptor & {
11169
11421
  */
11170
11422
  type StylingCatalogue = {
11171
11423
  knobs: StylingKnobDescriptor[];
11424
+ /** The presets {@link StylingModule.applyPreset} accepts, with the settings each one applies. */
11425
+ presets: StylingPresetDescriptor[];
11426
+ };
11427
+ /**
11428
+ * A named bundle of knob settings — TomTom's cartographic opinions, in code. Apply one with
11429
+ * {@link StylingModule.applyPreset}.
11430
+ *
11431
+ * @group Map Styling
11432
+ */
11433
+ type StylingPresetDescriptor = {
11434
+ id: StylingPresetId;
11435
+ name: string;
11436
+ /** One line on the use case the preset serves. */
11437
+ description: string;
11438
+ /** The knob values the preset applies; the same shape {@link StylingModule.applyConfig} takes. */
11439
+ settings: StylingSettings;
11172
11440
  };
11173
11441
  /**
11174
11442
  * A serializable set of styling knob values — what {@link StylingModule.getConfig} returns and
@@ -11193,7 +11461,7 @@ type StylingSettings = MapModuleCommonConfig & { [K in StylingKnobId]?: StylingK
11193
11461
  /** @ignore */
11194
11462
  type ScalableProperty = 'text-size' | 'icon-size' | 'line-width';
11195
11463
  /** @ignore */
11196
- type ColorProperty = 'line-color' | 'text-color' | 'text-halo-color';
11464
+ type ColorProperty = Extract<PaintColorProperty, 'line-color' | 'text-color' | 'text-halo-color'>;
11197
11465
  /**
11198
11466
  * How a knob reaches the style. A knob may use several (e.g. text and icon size together).
11199
11467
  * @ignore
@@ -11229,15 +11497,44 @@ type KnobMechanism =
11229
11497
  {
11230
11498
  type: 'zoomOffset';
11231
11499
  layers: LayerSelector[];
11500
+ } |
11501
+ /** Map-level: the projection the whole map is drawn in. */
11502
+ {
11503
+ type: 'projection';
11504
+ } |
11505
+ /** Map-level: the sky/atmosphere (its colours come from the sibling colour knobs). */
11506
+ {
11507
+ type: 'sky';
11508
+ } |
11509
+ /** Map-level: 3D terrain from the style's raster-dem source (exaggeration from the sibling knob). */
11510
+ {
11511
+ type: 'terrain';
11512
+ } |
11513
+ /** Map-level: the colour behind the map canvas, which a globe leaves visible around the planet. */
11514
+ {
11515
+ type: 'space';
11516
+ } |
11517
+ /**
11518
+ * One of the ten semantic map colours: re-derives every literal it governs from the new colour,
11519
+ * keeping each one's HSL offset from the style's own base (the anchor).
11520
+ */
11521
+ {
11522
+ type: 'mapColor';
11523
+ color: MapColorName;
11232
11524
  };
11233
11525
  /** @ignore */
11234
11526
  type KnobDefinition = {
11235
11527
  kind: StylingKnobKind;
11236
11528
  description: string;
11237
11529
  range?: StylingKnobRange;
11530
+ /** The valid values of an `enum` knob. */
11531
+ options?: readonly string[];
11238
11532
  appliesTo: StylingKnobAppliesTo;
11239
11533
  mechanisms: KnobMechanism[];
11240
11534
  };
11535
+ type KnobDefinitionOf<KIND extends StylingKnobKind> = KnobDefinition & {
11536
+ kind: KIND;
11537
+ };
11241
11538
  /**
11242
11539
  * The styling knob catalogue: what the SDK can restyle on a TomTom standard style, and how.
11243
11540
  *
@@ -11246,10 +11543,10 @@ type KnobDefinition = {
11246
11543
  * @ignore
11247
11544
  */
11248
11545
  declare const knobDefinitions: {
11249
- readonly 'labels.sizeFactor': KnobDefinition;
11250
- readonly 'symbols.sizeFactor': KnobDefinition;
11251
- readonly 'roads.widthFactor': KnobDefinition;
11252
- readonly 'pois.sizeFactor': KnobDefinition;
11546
+ readonly 'labels.sizeFactor': KnobDefinitionOf<"factor">;
11547
+ readonly 'symbols.sizeFactor': KnobDefinitionOf<"factor">;
11548
+ readonly 'roads.widthFactor': KnobDefinitionOf<"factor">;
11549
+ readonly 'pois.sizeFactor': KnobDefinitionOf<"factor">;
11253
11550
  readonly 'pois.minZoom': {
11254
11551
  readonly kind: "number";
11255
11552
  readonly description: "Zoom level from which base-map POIs appear (the style default is 6).";
@@ -11286,27 +11583,99 @@ declare const knobDefinitions: {
11286
11583
  readonly layers: [LayerSelector];
11287
11584
  }];
11288
11585
  };
11289
- readonly 'pois.labelColor': KnobDefinition;
11290
- readonly 'pois.labelOutlineColor': KnobDefinition;
11291
- readonly 'pois.microMarkers': KnobDefinition;
11292
- readonly 'roads.exitNumbers': KnobDefinition;
11293
- readonly 'roads.shields': KnobDefinition;
11294
- readonly 'roads.arrows': KnobDefinition;
11295
- readonly 'roads.restricted': KnobDefinition;
11296
- readonly 'roads.underConstruction': KnobDefinition;
11297
- readonly 'buildings.footprints': KnobDefinition;
11298
- readonly 'buildings.3d': KnobDefinition;
11299
- readonly 'traffic.flow.freeColor': KnobDefinition;
11300
- readonly 'traffic.flow.slowColor': KnobDefinition;
11301
- readonly 'traffic.flow.queueingColor': KnobDefinition;
11302
- readonly 'traffic.flow.stationaryColor': KnobDefinition;
11303
- readonly 'traffic.flow.closedColor': KnobDefinition;
11304
- readonly 'traffic.flow.widthFactor': KnobDefinition;
11305
- readonly 'traffic.incidents.minorColor': KnobDefinition;
11306
- readonly 'traffic.incidents.moderateColor': KnobDefinition;
11307
- readonly 'traffic.incidents.majorColor': KnobDefinition;
11308
- readonly 'traffic.incidents.closedColor': KnobDefinition;
11309
- readonly 'traffic.incidents.widthFactor': KnobDefinition;
11586
+ readonly 'pois.labelColor': KnobDefinitionOf<"color">;
11587
+ readonly 'pois.labelOutlineColor': KnobDefinitionOf<"color">;
11588
+ readonly 'pois.microMarkers': KnobDefinitionOf<"toggle">;
11589
+ readonly 'roads.exitNumbers': KnobDefinitionOf<"toggle">;
11590
+ readonly 'roads.shields': KnobDefinitionOf<"toggle">;
11591
+ readonly 'roads.arrows': KnobDefinitionOf<"toggle">;
11592
+ readonly 'roads.restricted': KnobDefinitionOf<"toggle">;
11593
+ readonly 'roads.underConstruction': KnobDefinitionOf<"toggle">;
11594
+ readonly 'buildings.footprints': KnobDefinitionOf<"toggle">;
11595
+ readonly 'buildings.3d': KnobDefinitionOf<"toggle">;
11596
+ readonly 'traffic.flow.freeColor': KnobDefinitionOf<"color">;
11597
+ readonly 'traffic.flow.slowColor': KnobDefinitionOf<"color">;
11598
+ readonly 'traffic.flow.queueingColor': KnobDefinitionOf<"color">;
11599
+ readonly 'traffic.flow.stationaryColor': KnobDefinitionOf<"color">;
11600
+ readonly 'traffic.flow.closedColor': KnobDefinitionOf<"color">;
11601
+ readonly 'traffic.flow.widthFactor': KnobDefinitionOf<"factor">;
11602
+ readonly 'traffic.incidents.minorColor': KnobDefinitionOf<"color">;
11603
+ readonly 'traffic.incidents.moderateColor': KnobDefinitionOf<"color">;
11604
+ readonly 'traffic.incidents.majorColor': KnobDefinitionOf<"color">;
11605
+ readonly 'traffic.incidents.closedColor': KnobDefinitionOf<"color">;
11606
+ readonly 'traffic.incidents.widthFactor': KnobDefinitionOf<"factor">;
11607
+ readonly 'colors.land': KnobDefinitionOf<"color">;
11608
+ readonly 'colors.water': KnobDefinitionOf<"color">;
11609
+ readonly 'colors.vegetation': KnobDefinitionOf<"color">;
11610
+ readonly 'colors.park': KnobDefinitionOf<"color">;
11611
+ readonly 'colors.artificial': KnobDefinitionOf<"color">;
11612
+ readonly 'colors.roadMajor': KnobDefinitionOf<"color">;
11613
+ readonly 'colors.road': KnobDefinitionOf<"color">;
11614
+ readonly 'colors.roadOutline': KnobDefinitionOf<"color">;
11615
+ readonly 'colors.label': KnobDefinitionOf<"color">;
11616
+ readonly 'colors.labelOutline': KnobDefinitionOf<"color">;
11617
+ readonly 'view.projection': {
11618
+ readonly kind: "enum";
11619
+ readonly description: "How the map is drawn: flat Mercator or a globe. The globe flattens to Mercator between zoom 11 and 12 by design.";
11620
+ readonly options: readonly ["mercator", "globe"];
11621
+ readonly appliesTo: "any-style";
11622
+ readonly mechanisms: [{
11623
+ readonly type: "projection";
11624
+ }];
11625
+ };
11626
+ readonly 'view.sky': {
11627
+ readonly kind: "toggle";
11628
+ readonly description: "A sky with atmosphere behind the globe and above a tilted flat map. Without it MapLibre draws a fully transparent sky, so a globe arrives with no atmosphere.";
11629
+ readonly appliesTo: "any-style";
11630
+ readonly mechanisms: [{
11631
+ readonly type: "sky";
11632
+ }];
11633
+ };
11634
+ readonly 'view.skyColor': {
11635
+ readonly kind: "color";
11636
+ readonly description: "Colour of the sky (and of the atmosphere halo around the globe). Defaults to a daylit blue on a light style and a night blue on a dark one.";
11637
+ readonly appliesTo: "any-style";
11638
+ readonly mechanisms: [{
11639
+ readonly type: "sky";
11640
+ }];
11641
+ };
11642
+ readonly 'view.horizonColor': {
11643
+ readonly kind: "color";
11644
+ readonly description: "Colour of the sky at the horizon. Defaults with the style theme, so a dark map gets a dim horizon rather than a white one.";
11645
+ readonly appliesTo: "any-style";
11646
+ readonly mechanisms: [{
11647
+ readonly type: "sky";
11648
+ }];
11649
+ };
11650
+ readonly 'view.spaceColor': {
11651
+ readonly kind: "color";
11652
+ readonly description: "Colour behind the map, which a globe leaves visible around the planet. The map canvas is transparent, so without this the page background shows through. Defaults with the style theme: white on a light style, near-black on a dark one.";
11653
+ readonly appliesTo: "any-style";
11654
+ readonly mechanisms: [{
11655
+ readonly type: "space";
11656
+ }];
11657
+ };
11658
+ readonly 'view.terrain': {
11659
+ readonly kind: "toggle";
11660
+ readonly description: "3D terrain from the style's elevation source (the hillshade style part). Needs a tilted camera to show; MapLibre's terrain fog starts at pitch 60, which is also its default maxPitch.";
11661
+ readonly appliesTo: "any-style";
11662
+ readonly mechanisms: [{
11663
+ readonly type: "terrain";
11664
+ }];
11665
+ };
11666
+ readonly 'view.terrainExaggeration': {
11667
+ readonly kind: "number";
11668
+ readonly description: "Vertical exaggeration of the 3D terrain (1 = true elevation).";
11669
+ readonly range: {
11670
+ readonly min: 0.5;
11671
+ readonly max: 3;
11672
+ readonly step: 0.1;
11673
+ };
11674
+ readonly appliesTo: "any-style";
11675
+ readonly mechanisms: [{
11676
+ readonly type: "terrain";
11677
+ }];
11678
+ };
11310
11679
  };
11311
11680
  /**
11312
11681
  * The id of a styling knob — see {@link StylingModule.describe} for what each one does.
@@ -11320,7 +11689,20 @@ type StylingKnobId = keyof typeof knobDefinitions;
11320
11689
  * @group Map Styling
11321
11690
  */
11322
11691
  export declare const stylingKnobIds: StylingKnobId[];
11323
- type ValueOfKind<KIND extends StylingKnobKind> = KIND extends 'toggle' ? boolean : KIND extends 'color' ? string : number;
11692
+ /**
11693
+ * The id of a styling knob that holds a colour — every colour the styling module can name, and so
11694
+ * resolve against whichever style is loaded.
11695
+ *
11696
+ * @group Map Styling
11697
+ */
11698
+ type StylingColorKnobId = { [ID in StylingKnobId]: (typeof knobDefinitions)[ID]['kind'] extends 'color' ? ID : never; }[StylingKnobId];
11699
+ /**
11700
+ * Every colour knob id, in catalogue order.
11701
+ *
11702
+ * @group Map Styling
11703
+ */
11704
+ export declare const stylingColorKnobIds: StylingColorKnobId[];
11705
+ type ValueOfKind<KIND extends StylingKnobKind> = KIND extends 'toggle' ? boolean : KIND extends 'color' | 'enum' ? string : number;
11324
11706
  /**
11325
11707
  * The value type a given styling knob takes.
11326
11708
  *
@@ -11385,10 +11767,16 @@ export type StylingEvents = CombinedEvents<MapGeoJSONFeature, StylingSettings, n
11385
11767
  */
11386
11768
  export declare class StylingModule extends AbstractStyleOwnedMapModule<Record<string, never>, StylingSettings> {
11387
11769
  private originalValues;
11770
+ private mapLevelState;
11388
11771
  private styleSources;
11389
11772
  private resolved;
11390
11773
  private scaleKnobsByTarget;
11774
+ private mapColorTargetsByKey;
11775
+ private mapColorTargetsByKnob;
11776
+ private mapColorAnchors;
11391
11777
  private warned;
11778
+ private reindexed;
11779
+ private originalSpaceColor;
11392
11780
  /**
11393
11781
  * Retrieves the styling module of the given map, creating it on first use.
11394
11782
  *
@@ -11435,6 +11823,27 @@ export declare class StylingModule extends AbstractStyleOwnedMapModule<Record<st
11435
11823
  * ```
11436
11824
  */
11437
11825
  describe(): StylingCatalogue;
11826
+ /**
11827
+ * Applies a preset: a named bundle of knob settings the SDK ships for a common intent
11828
+ * (`data-viz`, `night-driving`, `minimal`, `globe`, `terrain`). See `describe().presets` for
11829
+ * what each one sets.
11830
+ *
11831
+ * @param id - The preset to apply.
11832
+ * @param options - `merge: true` lays the preset over the current settings instead of replacing
11833
+ * them (the default), so knobs the preset does not mention keep their values.
11834
+ * @throws `Error` for an unknown preset id.
11835
+ *
11836
+ * @example
11837
+ * ```typescript
11838
+ * styling.applyPreset('data-viz');
11839
+ * styling.set('labels.sizeFactor', 1.1); // then adjust
11840
+ *
11841
+ * styling.applyPreset('globe', { merge: true }); // keep the rest, switch to a globe with a sky
11842
+ * ```
11843
+ */
11844
+ applyPreset(id: StylingPresetId, options?: {
11845
+ merge?: boolean;
11846
+ }): void;
11438
11847
  /**
11439
11848
  * The value a knob currently has: the override if one is set, otherwise the style's own default.
11440
11849
  *
@@ -11477,6 +11886,39 @@ export declare class StylingModule extends AbstractStyleOwnedMapModule<Record<st
11477
11886
  * ```
11478
11887
  */
11479
11888
  reset(id?: StylingKnobId): void;
11889
+ /**
11890
+ * Recolours the whole base map with up to ten semantic colours in one call — Map Maker's
11891
+ * Foundations palette, each listed with what it reaches under {@link MapColorName}. Partial
11892
+ * objects are fine; colours not given stay as they are.
11893
+ *
11894
+ * @remarks
11895
+ * Each colour re-derives every shade the style built from it — a trunk variant, an outline, a
11896
+ * tunnel — at the style's own HSL offset, so those relationships survive the recolour. The ten
11897
+ * are also the `colors.*` knobs, so `describe()`, `reset` and settings persistence apply.
11898
+ *
11899
+ * Those offsets come off the loaded style, which makes a palette a recolour and not an
11900
+ * inversion: dark land over `standardLight` pushes the derived shades to the ends of their
11901
+ * range, so switch to `standardDark` first.
11902
+ *
11903
+ * @param colors - The colours to set, as CSS colour strings.
11904
+ * @throws `RangeError` for a value that is not a colour; `Error` for an unknown colour name.
11905
+ *
11906
+ * @example
11907
+ * ```typescript
11908
+ * styling.setMapColors({ land: '#f3f5f7', water: '#accbe2', roadMajor: '#a1b8ce', label: '#364659' });
11909
+ * styling.reset('colors.roadMajor'); // one colour back to the style
11910
+ * ```
11911
+ */
11912
+ setMapColors(colors: MapColors): void;
11913
+ /**
11914
+ * The style as currently rendered — the loaded style with every knob applied — as a MapLibre
11915
+ * style specification, to save, diff, serve yourself, or load back as a custom style.
11916
+ *
11917
+ * @remarks
11918
+ * It includes whatever the SDK's data modules (places, routes) have on the map, and its tile
11919
+ * URLs carry the API key the map was created with: strip or rotate it before publishing.
11920
+ */
11921
+ exportStyle(): StyleSpecification;
11480
11922
  /**
11481
11923
  * Lifecycle events of this module. The module owns no map features, so there are no user
11482
11924
  * interaction events; `config-change` fires with the full settings after every knob change.
@@ -11491,8 +11933,16 @@ export declare class StylingModule extends AbstractStyleOwnedMapModule<Record<st
11491
11933
  private resolveMechanism;
11492
11934
  private capture;
11493
11935
  private originalValueOf;
11936
+ private resolveMapColor;
11937
+ private demSourceId;
11494
11938
  private refreshKnob;
11495
11939
  private refreshMechanism;
11940
+ private refreshSpace;
11941
+ private defaultSpaceColor;
11942
+ private refreshMapColorProperty;
11943
+ private refreshProjection;
11944
+ private refreshSky;
11945
+ private refreshTerrain;
11496
11946
  private refreshVisibility;
11497
11947
  private refreshMinZoom;
11498
11948
  private refreshZoomOffset;
@@ -11501,6 +11951,7 @@ export declare class StylingModule extends AbstractStyleOwnedMapModule<Record<st
11501
11951
  private setProperty;
11502
11952
  private describeKnob;
11503
11953
  private defaultOf;
11954
+ private mapLevelDefaultOf;
11504
11955
  private assertKnob;
11505
11956
  private validate;
11506
11957
  private warnOnce;
@@ -11783,6 +12234,17 @@ type AreaAnalyticsRegionPolygonConfig = {
11783
12234
  */
11784
12235
  inverted?: boolean;
11785
12236
  };
12237
+ /**
12238
+ * The green / amber / red every metric's default colour stops and the `trafficLight` colour theme
12239
+ * are drawn from.
12240
+ *
12241
+ * @ignore
12242
+ */
12243
+ declare const TRAFFIC_LIGHT_COLORS: {
12244
+ readonly good: "#2dc653";
12245
+ readonly moderate: "#f5a623";
12246
+ readonly bad: "#e03030";
12247
+ };
11786
12248
  /**
11787
12249
  * Default values for all {@link TrafficAreaAnalyticsConfig} options.
11788
12250
  *
@@ -11803,10 +12265,16 @@ declare const AREA_ANALYTICS_DEFAULTS: {
11803
12265
  congestionLevel: {
11804
12266
  color: {
11805
12267
  valueType: "raw";
11806
- stops: {
12268
+ stops: ({
12269
+ value: number;
12270
+ color: "#2dc653";
12271
+ } | {
11807
12272
  value: number;
11808
- color: string;
11809
- }[];
12273
+ color: "#f5a623";
12274
+ } | {
12275
+ value: number;
12276
+ color: "#e03030";
12277
+ })[];
11810
12278
  };
11811
12279
  height: {
11812
12280
  maxHeightMeters: number;
@@ -11817,10 +12285,16 @@ declare const AREA_ANALYTICS_DEFAULTS: {
11817
12285
  speed: {
11818
12286
  color: {
11819
12287
  valueType: "relativeToPredefinedRangePCT";
11820
- stops: {
12288
+ stops: ({
12289
+ value: number;
12290
+ color: "#e03030";
12291
+ } | {
11821
12292
  value: number;
11822
- color: string;
11823
- }[];
12293
+ color: "#f5a623";
12294
+ } | {
12295
+ value: number;
12296
+ color: "#2dc653";
12297
+ })[];
11824
12298
  };
11825
12299
  height: {
11826
12300
  maxHeightMeters: number;
@@ -11831,10 +12305,16 @@ declare const AREA_ANALYTICS_DEFAULTS: {
11831
12305
  travelTime: {
11832
12306
  color: {
11833
12307
  valueType: "relativeToPredefinedRangePCT";
11834
- stops: {
12308
+ stops: ({
12309
+ value: number;
12310
+ color: "#2dc653";
12311
+ } | {
12312
+ value: number;
12313
+ color: "#f5a623";
12314
+ } | {
11835
12315
  value: number;
11836
- color: string;
11837
- }[];
12316
+ color: "#e03030";
12317
+ })[];
11838
12318
  };
11839
12319
  height: {
11840
12320
  maxHeightMeters: number;
@@ -11845,10 +12325,16 @@ declare const AREA_ANALYTICS_DEFAULTS: {
11845
12325
  freeFlowSpeed: {
11846
12326
  color: {
11847
12327
  valueType: "relativeToPredefinedRangePCT";
11848
- stops: {
12328
+ stops: ({
12329
+ value: number;
12330
+ color: "#e03030";
12331
+ } | {
12332
+ value: number;
12333
+ color: "#f5a623";
12334
+ } | {
11849
12335
  value: number;
11850
- color: string;
11851
- }[];
12336
+ color: "#2dc653";
12337
+ })[];
11852
12338
  };
11853
12339
  height: {
11854
12340
  maxHeightMeters: number;
@@ -11859,10 +12345,16 @@ declare const AREA_ANALYTICS_DEFAULTS: {
11859
12345
  networkLength: {
11860
12346
  color: {
11861
12347
  valueType: "relativeToActualRangePCT";
11862
- stops: {
12348
+ stops: ({
11863
12349
  value: number;
11864
- color: string;
11865
- }[];
12350
+ color: "#2dc653";
12351
+ } | {
12352
+ value: number;
12353
+ color: "#f5a623";
12354
+ } | {
12355
+ value: number;
12356
+ color: "#e03030";
12357
+ })[];
11866
12358
  };
11867
12359
  height: {
11868
12360
  maxHeightMeters: number;
@@ -13584,6 +14076,20 @@ export declare class TrafficIncidentsModule extends AbstractStyleOwnedMapModule<
13584
14076
  get events(): CombinedEvents<TrafficIncidentsModuleFeature, IncidentsConfig, never>;
13585
14077
  }
13586
14078
  //#endregion
14079
+ //#region src/utils/colorUtils.d.ts
14080
+ /**
14081
+ * Red, green, blue and alpha of a colour, each 0–1.
14082
+ * @ignore
14083
+ */
14084
+ type RGBAColor = [number, number, number, number];
14085
+ /**
14086
+ * Parses any CSS colour a map style writes — `#rgb`, `#rrggbb(aa)`, `rgb()`/`rgba()` in numbers or
14087
+ * percentages, `hsl()`/`hsla()`, `transparent` and the named colours — or `undefined` for a string
14088
+ * that is not one.
14089
+ * @ignore
14090
+ */
14091
+ export declare const parseCssColor: (cssColor: string) => RGBAColor | undefined;
14092
+ //#endregion
13587
14093
  //#region src/utils/types/paddedBounds.d.ts
13588
14094
  /**
13589
14095
  * Options for calculating map center.
@@ -13664,4 +14170,4 @@ export declare const calculatePaddedCenter: (options: CalculateMapCenterOptions)
13664
14170
  */
13665
14171
  export declare const calculateFittingBBox: (options: CalculateFittingBBoxOptions) => BBox | null;
13666
14172
  //#endregion
13667
- export type { AREA_ANALYTICS_DEFAULTS, AreaAnalyticsBeforeLayerConfig, AreaAnalyticsColorStop, AreaAnalyticsColorStopsConfig, AreaAnalyticsColorTheme, AreaAnalyticsDisplayMode, AreaAnalyticsHeightConfig, AreaAnalyticsMetricConfig, AreaAnalyticsMetricFilter, AreaAnalyticsRegionPolygonConfig, AreaAnalyticsValueType, AvailabilityLevel, BeforeLayerConfig, BespokeSectionType, ByIdOrIndex, CSSCursor, ChargingSpeedIconMapping, ChargingStopIconConfig, ChargingStopIconMapping, ChargingStopTextConfig, ChargingStopsConfig, CleanEventStateOptions, CleanEventStatesOptions, ClickEventType, CustomImage, DefaultPlaceIconConfig, DisplayRouteProps, DisplayRouteRelatedProps, DisplayRouteSummaries, DisplayRouteSummary, DisplayRouteSummaryProps, DrawnSectionType, EVAvailabilityConfig, EventHandlerConfig, EventHandlerCursorConfig, EventType, FilterShowMode, FilterablePOICategory, GeneratedSectionType, 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, SectionDisplayConfig, SectionDrawStyle, SectionIconConfig, SectionKnobName, SectionKnobOf, SectionLineLayerName, SectionLinePattern, SectionSignConfig, SectionSignLayerName, SectionSignPriority, SectionSignUnit, SectionSourceKey, SectionSymbolLayerName, SectionsDisplayConfig, SourceWithLayerIDs, SourceWithLayers, SourcesWithLayers, StyleSourcesWithLayers, StylingCatalogue, StylingKnobAppliesTo, StylingKnobDescriptor, StylingKnobId, StylingKnobKind, StylingKnobRange, StylingKnobValue, StylingKnobValueOf, StylingSettings, SupportsEvents, SymbolLayerSpecWithoutSource, ToBeAddedLayerSpec, ToBeAddedLayerSpecTemplate, ToBeAddedLayerSpecWithoutSource, TrafficAreaAnalyticsConfig, TrafficIncidentOverlayConfig, UserEventHandler, ValuesFilter, WaypointsConfig };
14173
+ export type { AREA_ANALYTICS_DEFAULTS, AreaAnalyticsBeforeLayerConfig, AreaAnalyticsColorStop, AreaAnalyticsColorStopsConfig, AreaAnalyticsColorTheme, AreaAnalyticsDisplayMode, AreaAnalyticsHeightConfig, AreaAnalyticsMetricConfig, AreaAnalyticsMetricFilter, AreaAnalyticsRegionPolygonConfig, AreaAnalyticsValueType, AvailabilityLevel, BeforeLayerConfig, BespokeSectionType, ByIdOrIndex, CSSCursor, ChargingSpeedIconMapping, ChargingStopIconConfig, ChargingStopIconMapping, ChargingStopTextConfig, ChargingStopsConfig, CleanEventStateOptions, CleanEventStatesOptions, ClickEventType, CountryCrossingAlignment, CountryCrossingConfig, CountryCrossingFeature, CustomImage, DefaultPlaceIconConfig, DisplayCountryCrossing, DisplayCountryCrossingProps, DisplayCountryCrossings, DisplayRouteProps, DisplayRouteRelatedProps, DisplayRouteSummaries, DisplayRouteSummary, DisplayRouteSummaryProps, DrawnSectionType, EVAvailabilityConfig, EventHandlerConfig, EventHandlerCursorConfig, EventType, ExtraFeatureProp, FeaturePropValue, FilterShowMode, FilterablePOICategory, GeneratedSectionType, GeoJSONSourcesWithLayers, HasAdditionalLayersConfig, HasBeforeID, HillshadeModuleConfig, HoverEventType, IncidentFocusStyle, LayerSpecFilter, LayerSpecTemplate, LayerSpecWithSource, LightDark, MapColorName, MapColors, MapEventsConfig, MapFont, MapModuleCommonConfig, MapStyleLayerID, POIsModuleConfig, POIsModuleFeature, PlaceConnectionDisplay, PlaceConnectionLayerName, PlaceConnectionsConfig, PlaceConnectionsLayersConfig, PlaceIconConfig, PlaceLayerName, PlaceLayersConfig, PlaceTextConfig, PlacesModuleConfig, PlacesTheme, PlanningWaypoint, PutEventStateOptions, RGBAColor, RouteLayersConfig, RouteStateProps, RouteTheme, RouteWaypointSize, RouteWidth, RoutingModuleConfig, SVGIconStyleOptions, SectionDisplayConfig, SectionDrawStyle, SectionIconConfig, SectionKnobName, SectionKnobOf, SectionLineLayerName, SectionLinePattern, SectionSignConfig, SectionSignLayerName, SectionSignPlacement, SectionSignPriority, SectionSignUnit, SectionSourceKey, SectionSymbolLayerName, SectionsDisplayConfig, SourceWithLayerIDs, SourceWithLayers, SourcesWithLayers, StyleSourcesWithLayers, StylingCatalogue, StylingColorKnobId, StylingKnobAppliesTo, StylingKnobDescriptor, StylingKnobId, StylingKnobKind, StylingKnobRange, StylingKnobValue, StylingKnobValueOf, StylingPresetDescriptor, StylingPresetId, StylingSettings, SupportsEvents, SymbolLayerSpecWithoutSource, TRAFFIC_LIGHT_COLORS, ToBeAddedLayerSpec, ToBeAddedLayerSpecTemplate, ToBeAddedLayerSpecWithoutSource, TrafficAreaAnalyticsConfig, TrafficIncidentOverlayConfig, UserEventHandler, ValuesFilter, WaypointsConfig };