@tomtom-org/maps-sdk 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/core/dist/core.es.js +1 -1
- package/core/dist/core.es.js.map +1 -1
- package/core/dist/index.d.ts +32 -0
- package/map/dist/index.d.ts +134 -152
- package/map/dist/map.es.js +1 -1
- package/map/dist/map.es.js.map +1 -1
- package/package.json +4 -2
- package/services/dist/services.es.js +1 -1
- package/services/dist/services.es.js.map +1 -1
package/core/dist/index.d.ts
CHANGED
|
@@ -1771,6 +1771,14 @@ export declare type CurrentType = (typeof currentTypes)[number];
|
|
|
1771
1771
|
*/
|
|
1772
1772
|
export declare const currentTypes: readonly ["AC1", "AC3", "DC"];
|
|
1773
1773
|
|
|
1774
|
+
/**
|
|
1775
|
+
* Default base URL for TomTom APIs. A `commonBaseURL` other than this signals a
|
|
1776
|
+
* proxy or custom backend.
|
|
1777
|
+
*
|
|
1778
|
+
* @group Configuration
|
|
1779
|
+
*/
|
|
1780
|
+
export declare const DEFAULT_COMMON_BASE_URL = "https://api.tomtom.com";
|
|
1781
|
+
|
|
1774
1782
|
/**
|
|
1775
1783
|
* Default global configuration values.
|
|
1776
1784
|
*
|
|
@@ -3126,6 +3134,30 @@ export declare type Instruction = {
|
|
|
3126
3134
|
*/
|
|
3127
3135
|
export declare const isBBoxWithArea: (bbox: OptionalBBox) => boolean;
|
|
3128
3136
|
|
|
3137
|
+
/**
|
|
3138
|
+
* Whether the SDK is configured for a Demo-BFF-style proxy — no `apiKey` (the
|
|
3139
|
+
* proxy injects the real key server-side from a cookie-gated session) plus a
|
|
3140
|
+
* non-default `commonBaseURL`.
|
|
3141
|
+
*
|
|
3142
|
+
* In this mode SDK requests attach `credentials: 'include'` so the proxy's
|
|
3143
|
+
* session cookie travels with them. In all other cases — direct TomTom usage
|
|
3144
|
+
* and customer-owned `customServiceBaseURL` integrations — credentials stay at
|
|
3145
|
+
* the browser default, so we don't break consumers whose backend responds with
|
|
3146
|
+
* `Access-Control-Allow-Origin: *` (the browser rejects credentialed responses
|
|
3147
|
+
* against a wildcard origin). A customer using `customServiceBaseURL` keeps a
|
|
3148
|
+
* real `apiKey`, so this stays false for them.
|
|
3149
|
+
*
|
|
3150
|
+
* The `apiKey` test is a falsy check (not `=== ''`) on purpose: a proxy build
|
|
3151
|
+
* may overwrite the bootstrap's `apiKey: ''` with `apiKey: undefined` (e.g.
|
|
3152
|
+
* `put({ apiKey: process.env.API_KEY_EXAMPLES })` when that env var is unset).
|
|
3153
|
+
* Both empty string and undefined mean "no key, the proxy injects it" — matching
|
|
3154
|
+
* how the URL builders decide whether to append `key=` (`if (apiKey)`).
|
|
3155
|
+
*
|
|
3156
|
+
* @param config - Config to inspect; defaults to the global {@link TomTomConfig}.
|
|
3157
|
+
* @group Configuration
|
|
3158
|
+
*/
|
|
3159
|
+
export declare const isProxyCredentialsMode: (config?: Partial<Pick<GlobalConfig, "apiKey" | "commonBaseURL">>) => boolean;
|
|
3160
|
+
|
|
3129
3161
|
/**
|
|
3130
3162
|
* Type of landmarks that can be used in instructions.
|
|
3131
3163
|
* @group Route
|
package/map/dist/index.d.ts
CHANGED
|
@@ -3461,14 +3461,8 @@ export declare class GeoJSONSourceWithLayers<T extends FeatureCollection = Featu
|
|
|
3461
3461
|
* Custom styling:
|
|
3462
3462
|
* ```typescript
|
|
3463
3463
|
* const geometriesModule = await GeometriesModule.get(map, {
|
|
3464
|
-
*
|
|
3465
|
-
*
|
|
3466
|
-
* fillOpacity: 0.3
|
|
3467
|
-
* },
|
|
3468
|
-
* lineConfig: {
|
|
3469
|
-
* lineColor: '#C70039',
|
|
3470
|
-
* lineWidth: 3
|
|
3471
|
-
* },
|
|
3464
|
+
* fill: { color: '#FF5733', opacity: 0.3 },
|
|
3465
|
+
* line: { color: '#C70039', width: 3 },
|
|
3472
3466
|
* textConfig: {
|
|
3473
3467
|
* textField: ['get', 'name']
|
|
3474
3468
|
* }
|
|
@@ -3535,10 +3529,10 @@ export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesW
|
|
|
3535
3529
|
*
|
|
3536
3530
|
* @remarks
|
|
3537
3531
|
* **Configuration Options:**
|
|
3538
|
-
* - `
|
|
3539
|
-
* - `
|
|
3532
|
+
* - `fill`: Fill color, opacity, and optional fill-layer positioning
|
|
3533
|
+
* - `line`: Border/outline styling and optional border-layer positioning
|
|
3540
3534
|
* - `textConfig`: Label display configuration
|
|
3541
|
-
* - `beforeLayerConfig`: Layer ordering
|
|
3535
|
+
* - `beforeLayerConfig`: Layer ordering — a single target, or `{ all, fill, line }` to split them
|
|
3542
3536
|
*
|
|
3543
3537
|
* **Multiple Instances:**
|
|
3544
3538
|
* You can create multiple GeometriesModule instances on the same map,
|
|
@@ -3554,15 +3548,8 @@ export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesW
|
|
|
3554
3548
|
* With custom styling:
|
|
3555
3549
|
* ```typescript
|
|
3556
3550
|
* const geometriesModule = await GeometriesModule.get(map, {
|
|
3557
|
-
*
|
|
3558
|
-
*
|
|
3559
|
-
* fillOpacity: 0.25
|
|
3560
|
-
* },
|
|
3561
|
-
* lineConfig: {
|
|
3562
|
-
* lineColor: 'darkblue',
|
|
3563
|
-
* lineWidth: 2,
|
|
3564
|
-
* lineOpacity: 0.8
|
|
3565
|
-
* },
|
|
3551
|
+
* fill: { color: 'blue', opacity: 0.25 },
|
|
3552
|
+
* line: { color: 'darkblue', width: 2, opacity: 0.8 },
|
|
3566
3553
|
* textConfig: {
|
|
3567
3554
|
* textField: ['get', 'title']
|
|
3568
3555
|
* },
|
|
@@ -3574,9 +3561,9 @@ export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesW
|
|
|
3574
3561
|
* Data-driven styling:
|
|
3575
3562
|
* ```typescript
|
|
3576
3563
|
* const geometriesModule = await GeometriesModule.get(map, {
|
|
3577
|
-
*
|
|
3564
|
+
* fill: {
|
|
3578
3565
|
* // Color based on feature properties
|
|
3579
|
-
*
|
|
3566
|
+
* color: [
|
|
3580
3567
|
* 'match',
|
|
3581
3568
|
* ['get', 'type'],
|
|
3582
3569
|
* 'residential', '#FFEB3B',
|
|
@@ -3584,7 +3571,7 @@ export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesW
|
|
|
3584
3571
|
* 'industrial', '#9E9E9E',
|
|
3585
3572
|
* '#E0E0E0' // default
|
|
3586
3573
|
* ],
|
|
3587
|
-
*
|
|
3574
|
+
* opacity: 0.4
|
|
3588
3575
|
* }
|
|
3589
3576
|
* });
|
|
3590
3577
|
* ```
|
|
@@ -3599,35 +3586,37 @@ export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesW
|
|
|
3599
3586
|
* @ignore
|
|
3600
3587
|
*/
|
|
3601
3588
|
protected _applyConfig(config: GeometriesModuleConfig | undefined): GeometriesModuleConfig | undefined;
|
|
3602
|
-
|
|
3589
|
+
/** Resolve a positioning target to the map-style layer id the geometry layers should sit before. */
|
|
3590
|
+
private resolveBeforeID;
|
|
3591
|
+
private moveLayersBefore;
|
|
3592
|
+
private get fillLayerIDs();
|
|
3593
|
+
private get lineLayerIDs();
|
|
3603
3594
|
/**
|
|
3604
3595
|
* Positions the geometry layers relative to other map layers.
|
|
3605
3596
|
*
|
|
3606
|
-
* @param layerConfig - Layer positioning
|
|
3607
|
-
*
|
|
3597
|
+
* @param layerConfig - Layer positioning. A single {@link BeforeLayerConfig} (`'top'` or a layer
|
|
3598
|
+
* id) moves all geometry layers together; the object form (`{ all?, fill?, line? }`) positions the
|
|
3599
|
+
* fill and border independently.
|
|
3608
3600
|
*
|
|
3609
3601
|
* @remarks
|
|
3610
|
-
*
|
|
3611
|
-
*
|
|
3612
|
-
* - Ensure geometries appear above/below specific features
|
|
3613
|
-
* - Control visual hierarchy of multiple data layers
|
|
3602
|
+
* A per-layer `beforeLayerConfig` set inside the `fill` / `line` config sections takes precedence
|
|
3603
|
+
* over the value passed here.
|
|
3614
3604
|
*
|
|
3615
|
-
* **Available Layer IDs:**
|
|
3616
|
-
* Use predefined layer IDs from `mapStyleLayerIDs` or custom layer IDs.
|
|
3605
|
+
* **Available Layer IDs:** predefined ids from `mapStyleLayerIDs`, or a custom layer id.
|
|
3617
3606
|
*
|
|
3618
3607
|
* @example
|
|
3619
3608
|
* ```typescript
|
|
3620
3609
|
* import { mapStyleLayerIDs } from '@tomtom-international/maps-sdk-js/map';
|
|
3621
3610
|
*
|
|
3622
|
-
* // Place below labels
|
|
3611
|
+
* // Place all geometry layers below labels
|
|
3623
3612
|
* geometries.moveBeforeLayer(mapStyleLayerIDs.lowestLabel);
|
|
3624
3613
|
*
|
|
3625
|
-
* //
|
|
3626
|
-
* geometries.moveBeforeLayer('top');
|
|
3614
|
+
* // Fill below the road network, border on top
|
|
3615
|
+
* geometries.moveBeforeLayer({ fill: 'lowestRoadLine', line: 'top' });
|
|
3627
3616
|
* ```
|
|
3628
3617
|
*/
|
|
3629
3618
|
moveBeforeLayer(layerConfig: GeometryBeforeLayerConfig): void;
|
|
3630
|
-
private
|
|
3619
|
+
private applyBeforeLayerConfig;
|
|
3631
3620
|
/**
|
|
3632
3621
|
* Updates the text/label configuration for displayed geometries.
|
|
3633
3622
|
*
|
|
@@ -3818,26 +3807,14 @@ export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesW
|
|
|
3818
3807
|
* ```typescript
|
|
3819
3808
|
* // Basic styling
|
|
3820
3809
|
* const config: GeometriesModuleConfig = {
|
|
3821
|
-
*
|
|
3822
|
-
*
|
|
3823
|
-
* fillOpacity: 0.3
|
|
3824
|
-
* },
|
|
3825
|
-
* lineConfig: {
|
|
3826
|
-
* lineColor: '#C70039',
|
|
3827
|
-
* lineWidth: 2
|
|
3828
|
-
* }
|
|
3810
|
+
* fill: { color: '#FF5733', opacity: 0.3 },
|
|
3811
|
+
* line: { color: '#C70039', width: 2 },
|
|
3829
3812
|
* };
|
|
3830
3813
|
*
|
|
3831
3814
|
* // With labels and positioning
|
|
3832
3815
|
* const advancedConfig: GeometriesModuleConfig = {
|
|
3833
|
-
*
|
|
3834
|
-
*
|
|
3835
|
-
* fillOpacity: 0.25
|
|
3836
|
-
* },
|
|
3837
|
-
* lineConfig: {
|
|
3838
|
-
* lineColor: 'darkblue',
|
|
3839
|
-
* lineWidth: 3
|
|
3840
|
-
* },
|
|
3816
|
+
* fill: { color: 'blue', opacity: 0.25 },
|
|
3817
|
+
* line: { color: 'darkblue', width: 3 },
|
|
3841
3818
|
* textConfig: {
|
|
3842
3819
|
* textField: ['get', 'name']
|
|
3843
3820
|
* },
|
|
@@ -3846,13 +3823,12 @@ export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesW
|
|
|
3846
3823
|
*
|
|
3847
3824
|
* // Data-driven styling
|
|
3848
3825
|
* const dynamicConfig: GeometriesModuleConfig = {
|
|
3849
|
-
*
|
|
3850
|
-
*
|
|
3851
|
-
*
|
|
3826
|
+
* fill: {
|
|
3827
|
+
* color: ['match', ['get', 'category'], 'park', '#4CAF50', 'water', '#2196F3', '#9E9E9E'],
|
|
3828
|
+
* opacity: 0.4
|
|
3852
3829
|
* },
|
|
3853
|
-
*
|
|
3854
|
-
*
|
|
3855
|
-
* lineWidth: ['case', ['get', 'highlighted'], 4, 2]
|
|
3830
|
+
* line: {
|
|
3831
|
+
* color: '#000000', width: ['case', ['get', 'highlighted'], 4, 2],
|
|
3856
3832
|
* },
|
|
3857
3833
|
* textConfig: {
|
|
3858
3834
|
* textField: ['concat', ['get', 'name'], '\n', ['get', 'area'], ' km²']
|
|
@@ -3864,11 +3840,11 @@ export declare class GeometriesModule extends AbstractMapModule<GeometrySourcesW
|
|
|
3864
3840
|
*/
|
|
3865
3841
|
export declare type GeometriesModuleConfig = MapModuleCommonConfig & {
|
|
3866
3842
|
/**
|
|
3867
|
-
* Fill color and
|
|
3843
|
+
* Fill color, opacity, and (optional) fill-layer positioning.
|
|
3868
3844
|
*
|
|
3869
3845
|
* Controls the interior color and transparency of polygon geometries.
|
|
3870
3846
|
*/
|
|
3871
|
-
|
|
3847
|
+
fill?: GeometryFillConfig;
|
|
3872
3848
|
/**
|
|
3873
3849
|
* Text label configuration.
|
|
3874
3850
|
*
|
|
@@ -3876,11 +3852,11 @@ export declare type GeometriesModuleConfig = MapModuleCommonConfig & {
|
|
|
3876
3852
|
*/
|
|
3877
3853
|
textConfig?: GeometryTextConfig;
|
|
3878
3854
|
/**
|
|
3879
|
-
* Border/outline configuration.
|
|
3855
|
+
* Border/outline configuration, and (optional) border-layer positioning.
|
|
3880
3856
|
*
|
|
3881
3857
|
* Controls the outline appearance of polygon geometries.
|
|
3882
3858
|
*/
|
|
3883
|
-
|
|
3859
|
+
line?: GeometryLineConfig;
|
|
3884
3860
|
/**
|
|
3885
3861
|
* Layer positioning configuration.
|
|
3886
3862
|
*
|
|
@@ -3921,7 +3897,7 @@ export declare type GeometriesModuleConfig = MapModuleCommonConfig & {
|
|
|
3921
3897
|
* // Show the "rest of the world" outside a country
|
|
3922
3898
|
* const module = await GeometriesModule.get(map, {
|
|
3923
3899
|
* theme: 'inverted',
|
|
3924
|
-
*
|
|
3900
|
+
* fill: { color: 'black', opacity: 0.5 }
|
|
3925
3901
|
* });
|
|
3926
3902
|
* module.show(countryGeometry);
|
|
3927
3903
|
* ```
|
|
@@ -3937,7 +3913,7 @@ export declare type GeometriesModuleConfig = MapModuleCommonConfig & {
|
|
|
3937
3913
|
* @remarks
|
|
3938
3914
|
* Used internally by {@link reachableRangeGeometryConfig} to generate budget
|
|
3939
3915
|
* labels (e.g. `'30 min'`) from feature properties. For most use cases,
|
|
3940
|
-
* the standard config fields (`
|
|
3916
|
+
* the standard config fields (`fill`, `textConfig`, `theme`) suffice.
|
|
3941
3917
|
*
|
|
3942
3918
|
* @example
|
|
3943
3919
|
* ```typescript
|
|
@@ -3965,113 +3941,110 @@ export declare type GeometriesModuleConfig = MapModuleCommonConfig & {
|
|
|
3965
3941
|
* Use this to ensure geometries appear above or below other map features like
|
|
3966
3942
|
* labels, roads, or other data layers.
|
|
3967
3943
|
*
|
|
3944
|
+
* @remarks
|
|
3945
|
+
* A single {@link BeforeLayerConfig} (`'top'` or a layer id) positions **all** geometry layers
|
|
3946
|
+
* together. The object form positions the fill and border independently — `all` is the fallback
|
|
3947
|
+
* for any target it doesn't name.
|
|
3948
|
+
*
|
|
3968
3949
|
* @example
|
|
3969
3950
|
* ```typescript
|
|
3970
|
-
* // Place
|
|
3951
|
+
* // Place all geometry layers on top
|
|
3971
3952
|
* const beforeLayer: GeometryBeforeLayerConfig = 'top';
|
|
3972
3953
|
*
|
|
3973
|
-
* // Place below labels
|
|
3954
|
+
* // Place all below labels
|
|
3974
3955
|
* const beforeLayer: GeometryBeforeLayerConfig = 'lowestLabel';
|
|
3956
|
+
*
|
|
3957
|
+
* // Fill below the road network, border on top
|
|
3958
|
+
* const beforeLayer: GeometryBeforeLayerConfig = { fill: 'lowestRoadLine', line: 'top' };
|
|
3975
3959
|
* ```
|
|
3976
3960
|
*
|
|
3977
3961
|
* @group Geometries
|
|
3978
3962
|
*/
|
|
3979
|
-
export declare type GeometryBeforeLayerConfig = BeforeLayerConfig;
|
|
3963
|
+
export declare type GeometryBeforeLayerConfig = BeforeLayerConfig | GeometryBeforeLayerTargets;
|
|
3980
3964
|
|
|
3981
3965
|
/**
|
|
3982
|
-
*
|
|
3966
|
+
* Per-layer positioning targets for the object form of {@link GeometryBeforeLayerConfig}.
|
|
3983
3967
|
*
|
|
3984
|
-
*
|
|
3968
|
+
* `fill` and `line` position their respective layers; `all` is the fallback applied to any
|
|
3969
|
+
* target not explicitly set. A per-layer `beforeLayerConfig` inside {@link GeometryFillConfig}
|
|
3970
|
+
* or {@link GeometryLineConfig} wins over the value here.
|
|
3971
|
+
*
|
|
3972
|
+
* @group Geometries
|
|
3973
|
+
*/
|
|
3974
|
+
export declare type GeometryBeforeLayerTargets = {
|
|
3975
|
+
/** Fallback position for any layer not named by `fill` / `line`. */
|
|
3976
|
+
all?: BeforeLayerConfig;
|
|
3977
|
+
/** Position for the fill layer. */
|
|
3978
|
+
fill?: BeforeLayerConfig;
|
|
3979
|
+
/** Position for the border/outline layer (and its line labels). */
|
|
3980
|
+
line?: BeforeLayerConfig;
|
|
3981
|
+
};
|
|
3982
|
+
|
|
3983
|
+
/**
|
|
3984
|
+
* Fill configuration for geometry styling — the interior color, opacity, and (optionally) where the
|
|
3985
|
+
* fill layer sits in the map's layer stack.
|
|
3985
3986
|
*
|
|
3986
3987
|
* @example
|
|
3987
3988
|
* ```typescript
|
|
3988
3989
|
* // Solid color with opacity
|
|
3989
|
-
* const
|
|
3990
|
-
* fillColor: '#FF5733',
|
|
3991
|
-
* fillOpacity: 0.3
|
|
3992
|
-
* };
|
|
3990
|
+
* const fill: GeometryFillConfig = { color: '#FF5733', opacity: 0.3 };
|
|
3993
3991
|
*
|
|
3994
|
-
* //
|
|
3995
|
-
* const
|
|
3996
|
-
* fillColor: 'red', // Color palette name
|
|
3997
|
-
* fillOpacity: 0.25
|
|
3998
|
-
* };
|
|
3992
|
+
* // Palette name
|
|
3993
|
+
* const fill: GeometryFillConfig = { color: 'red', opacity: 0.25 };
|
|
3999
3994
|
*
|
|
4000
3995
|
* // Data-driven color based on properties
|
|
4001
|
-
* const
|
|
4002
|
-
*
|
|
4003
|
-
*
|
|
3996
|
+
* const fill: GeometryFillConfig = {
|
|
3997
|
+
* color: ['match', ['get', 'type'], 'residential', '#FFEB3B', 'commercial', '#2196F3', '#E0E0E0'],
|
|
3998
|
+
* opacity: 0.4,
|
|
4004
3999
|
* };
|
|
4005
4000
|
* ```
|
|
4006
4001
|
*
|
|
4007
4002
|
* @group Geometries
|
|
4008
4003
|
*/
|
|
4009
|
-
export declare type
|
|
4004
|
+
export declare type GeometryFillConfig = {
|
|
4010
4005
|
/**
|
|
4011
|
-
* Fill color
|
|
4012
|
-
*
|
|
4013
|
-
* @remarks
|
|
4014
|
-
* Can be:
|
|
4015
|
-
* - Hex color string (e.g., `'#FF5733'`)
|
|
4016
|
-
* - Color palette name (e.g., `'red'`, `'blue'`)
|
|
4017
|
-
* - MapLibre expression for data-driven styling
|
|
4006
|
+
* Fill color: a hex string (`'#FF5733'`), a palette name (`'red'`), or a MapLibre expression
|
|
4007
|
+
* for data-driven styling (e.g. `['get', 'color']`).
|
|
4018
4008
|
*
|
|
4019
4009
|
* @default '#0A3653'
|
|
4020
|
-
*
|
|
4021
|
-
* @example
|
|
4022
|
-
* ```typescript
|
|
4023
|
-
* // Hex color
|
|
4024
|
-
* fillColor: '#FF5733'
|
|
4025
|
-
*
|
|
4026
|
-
* // Palette name
|
|
4027
|
-
* fillColor: 'red'
|
|
4028
|
-
*
|
|
4029
|
-
* // MapLibre expression
|
|
4030
|
-
* fillColor: ['get', 'color']
|
|
4031
|
-
*
|
|
4032
|
-
* // Conditional coloring
|
|
4033
|
-
* fillColor: ['case', ['>', ['get', 'area'], 10000], '#FF0000', '#00FF00']
|
|
4034
|
-
* ```
|
|
4035
4010
|
*/
|
|
4036
|
-
|
|
4011
|
+
color?: ColorPaletteOptions | DataDrivenPropertyValueSpecification<string>;
|
|
4037
4012
|
/**
|
|
4038
|
-
*
|
|
4039
|
-
*
|
|
4040
|
-
* @remarks
|
|
4041
|
-
* Value between 0 (fully transparent) and 1 (fully opaque).
|
|
4013
|
+
* Fill opacity, 0 (transparent) to 1 (opaque). Also accepts a MapLibre expression.
|
|
4042
4014
|
*
|
|
4043
4015
|
* @default 0.15
|
|
4016
|
+
*/
|
|
4017
|
+
opacity?: DataDrivenPropertyValueSpecification<number>;
|
|
4018
|
+
/**
|
|
4019
|
+
* Layer positioning for the **fill** layer only.
|
|
4044
4020
|
*
|
|
4045
|
-
* @
|
|
4046
|
-
*
|
|
4047
|
-
*
|
|
4048
|
-
*
|
|
4049
|
-
* // Data-driven opacity
|
|
4050
|
-
* fillOpacity: ['interpolate', ['linear'], ['get', 'importance'], 1, 0.8, 10, 0.3]
|
|
4051
|
-
* ```
|
|
4021
|
+
* @remarks
|
|
4022
|
+
* Overrides the top-level {@link GeometriesModuleConfig.beforeLayerConfig} for the fill.
|
|
4023
|
+
* Use this to sink the fill below the road network while the border stays above, e.g.
|
|
4024
|
+
* `fill: { beforeLayerConfig: 'lowestRoadLine' }`, `line: { beforeLayerConfig: 'top' }`.
|
|
4052
4025
|
*/
|
|
4053
|
-
|
|
4026
|
+
beforeLayerConfig?: BeforeLayerConfig;
|
|
4054
4027
|
};
|
|
4055
4028
|
|
|
4056
4029
|
/**
|
|
4057
|
-
* Line/border configuration for geometries
|
|
4030
|
+
* Line/border configuration for geometries — the outline color, opacity, width, an escape hatch for
|
|
4031
|
+
* any other line property, and (optionally) where the border layer sits in the map's layer stack.
|
|
4058
4032
|
*
|
|
4059
|
-
*
|
|
4033
|
+
* @remarks
|
|
4034
|
+
* The curated `color` / `opacity` / `width` fields cover the common cases; the {@link
|
|
4035
|
+
* GeometryLineConfig.layer | `layer`} escape hatch accepts a partial MapLibre `LineLayerSpecification`
|
|
4036
|
+
* for anything else (`line-gap-width`, `line-cap`, `line-join`, …). The curated fields take precedence
|
|
4037
|
+
* over the same `paint` property set via `layer`.
|
|
4060
4038
|
*
|
|
4061
4039
|
* @example
|
|
4062
4040
|
* ```typescript
|
|
4063
|
-
* //
|
|
4064
|
-
* const
|
|
4065
|
-
* lineColor: '#333333',
|
|
4066
|
-
* lineWidth: 2,
|
|
4067
|
-
* lineOpacity: 0.8
|
|
4068
|
-
* };
|
|
4041
|
+
* // Curated fields
|
|
4042
|
+
* const line: GeometryLineConfig = { color: '#333333', width: 2, opacity: 0.8 };
|
|
4069
4043
|
*
|
|
4070
4044
|
* // Data-driven border
|
|
4071
|
-
* const
|
|
4072
|
-
*
|
|
4073
|
-
*
|
|
4074
|
-
* lineOpacity: 1
|
|
4045
|
+
* const line: GeometryLineConfig = {
|
|
4046
|
+
* color: ['get', 'borderColor'],
|
|
4047
|
+
* width: ['case', ['get', 'selected'], 4, 2],
|
|
4075
4048
|
* };
|
|
4076
4049
|
* ```
|
|
4077
4050
|
*
|
|
@@ -4079,45 +4052,54 @@ export declare type GeometryColorConfig = {
|
|
|
4079
4052
|
*/
|
|
4080
4053
|
export declare type GeometryLineConfig = {
|
|
4081
4054
|
/**
|
|
4082
|
-
*
|
|
4055
|
+
* Border/outline color: a hex string or a MapLibre expression (e.g. `['get', 'borderColor']`).
|
|
4083
4056
|
*
|
|
4084
4057
|
* @default '#0A3653'
|
|
4058
|
+
*/
|
|
4059
|
+
color?: DataDrivenPropertyValueSpecification<string>;
|
|
4060
|
+
/**
|
|
4061
|
+
* Border opacity, 0 (transparent) to 1 (opaque). Also accepts a MapLibre expression.
|
|
4085
4062
|
*
|
|
4086
|
-
* @
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
*
|
|
4063
|
+
* @default 1
|
|
4064
|
+
*/
|
|
4065
|
+
opacity?: DataDrivenPropertyValueSpecification<number>;
|
|
4066
|
+
/**
|
|
4067
|
+
* Border width in pixels. Also accepts a MapLibre expression
|
|
4068
|
+
* (e.g. `['case', ['get', 'selected'], 4, 2]`).
|
|
4069
|
+
*
|
|
4070
|
+
* @default 2
|
|
4091
4071
|
*/
|
|
4092
|
-
|
|
4072
|
+
width?: DataDrivenPropertyValueSpecification<number>;
|
|
4093
4073
|
/**
|
|
4094
|
-
*
|
|
4074
|
+
* Escape hatch for full control over the border (outline) line layer.
|
|
4095
4075
|
*
|
|
4096
4076
|
* @remarks
|
|
4097
|
-
*
|
|
4077
|
+
* Accepts a partial MapLibre `LineLayerSpecification` (without `id`/`source`) that is merged
|
|
4078
|
+
* onto the outline layer: top-level fields first, then `layout` and `paint` are merged per
|
|
4079
|
+
* property so base defaults survive. Use this to set any line property the curated fields above
|
|
4080
|
+
* don't cover (e.g. `line-gap-width`, `line-cap`, `line-join`, `line-pattern`).
|
|
4098
4081
|
*
|
|
4099
|
-
*
|
|
4082
|
+
* The curated fields (`color`, `opacity`, `width`) **take precedence** over the same `paint`
|
|
4083
|
+
* properties set here.
|
|
4100
4084
|
*
|
|
4101
4085
|
* @example
|
|
4102
4086
|
* ```typescript
|
|
4103
|
-
*
|
|
4087
|
+
* line: {
|
|
4088
|
+
* color: '#00A65E',
|
|
4089
|
+
* layer: { paint: { 'line-gap-width': 3 }, layout: { 'line-cap': 'round' } },
|
|
4090
|
+
* }
|
|
4104
4091
|
* ```
|
|
4105
4092
|
*/
|
|
4106
|
-
|
|
4093
|
+
layer?: Partial<ToBeAddedLayerSpecTemplate<LineLayerSpecification>>;
|
|
4107
4094
|
/**
|
|
4108
|
-
*
|
|
4095
|
+
* Layer positioning for the **border/outline** layer only.
|
|
4109
4096
|
*
|
|
4110
|
-
* @
|
|
4111
|
-
*
|
|
4112
|
-
* @
|
|
4113
|
-
*
|
|
4114
|
-
* lineWidth: 3
|
|
4115
|
-
*
|
|
4116
|
-
* // Highlight selected geometries
|
|
4117
|
-
* lineWidth: ['case', ['get', 'selected'], 4, 2]
|
|
4118
|
-
* ```
|
|
4097
|
+
* @remarks
|
|
4098
|
+
* Overrides the top-level {@link GeometriesModuleConfig.beforeLayerConfig} for the border.
|
|
4099
|
+
* Pair with {@link GeometryFillConfig.beforeLayerConfig} to split the fill and border across
|
|
4100
|
+
* the layer stack (e.g. fill below roads, border on top).
|
|
4119
4101
|
*/
|
|
4120
|
-
|
|
4102
|
+
beforeLayerConfig?: BeforeLayerConfig;
|
|
4121
4103
|
};
|
|
4122
4104
|
|
|
4123
4105
|
/**
|