maplibre-gl 3.3.0 → 3.3.1

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.
@@ -5488,6 +5488,13 @@ export type StyleSwapOptions = {
5488
5488
  */
5489
5489
  transformStyle?: TransformStyleFunction;
5490
5490
  };
5491
+ /**
5492
+ * Specifies a layer to be added to a {@link Style}. In addition to a standard {@link LayerSpecification}
5493
+ * or a {@link CustomLayerInterface}, a {@link LayerSpecification} with an embedded {@link SourceSpecification} can also be provided.
5494
+ */
5495
+ export type AddLayerObject = LayerSpecification | (Omit<LayerSpecification, "source"> & {
5496
+ source: SourceSpecification;
5497
+ }) | CustomLayerInterface;
5491
5498
  export declare class Style extends Evented {
5492
5499
  map: Map;
5493
5500
  stylesheet: StyleSpecification;
@@ -5614,7 +5621,7 @@ export declare class Style extends Evented {
5614
5621
  * @param options - Style setter options.
5615
5622
  * @returns `this`.
5616
5623
  */
5617
- addLayer(layerObject: LayerSpecification | CustomLayerInterface, before?: string, options?: StyleSetterOptions): this;
5624
+ addLayer(layerObject: AddLayerObject, before?: string, options?: StyleSetterOptions): this;
5618
5625
  /**
5619
5626
  * Moves a layer to a different z-position. The layer will be inserted before the layer with
5620
5627
  * ID `before`, or appended if `before` is omitted.
@@ -5637,7 +5644,7 @@ export declare class Style extends Evented {
5637
5644
  * @param id - id of the desired layer
5638
5645
  * @returns a layer, if one with the given `id` exists
5639
5646
  */
5640
- getLayer(id: string): StyleLayer;
5647
+ getLayer(id: string): StyleLayer | undefined;
5641
5648
  /**
5642
5649
  * checks if a specific layer is present within the style.
5643
5650
  *
@@ -9317,7 +9324,7 @@ export declare class Map extends Camera {
9317
9324
  * map.setTerrain({ source: 'terrain' });
9318
9325
  * ```
9319
9326
  */
9320
- setTerrain(options: TerrainSpecification): this;
9327
+ setTerrain(options: TerrainSpecification | null): this;
9321
9328
  /**
9322
9329
  * Get the terrain-options if terrain is loaded
9323
9330
  * @returns the TerrainSpecification passed to setTerrain
@@ -9326,7 +9333,7 @@ export declare class Map extends Camera {
9326
9333
  * map.getTerrain(); // { source: 'terrain' };
9327
9334
  * ```
9328
9335
  */
9329
- getTerrain(): TerrainSpecification;
9336
+ getTerrain(): TerrainSpecification | null;
9330
9337
  /**
9331
9338
  * Returns a Boolean indicating whether all tiles in the viewport from all sources on
9332
9339
  * the style are loaded.
@@ -9538,7 +9545,7 @@ export declare class Map extends Camera {
9538
9545
  *
9539
9546
  * @param layer - The layer to add,
9540
9547
  * conforming to either the MapLibre Style Specification's [layer definition](https://maplibre.org/maplibre-style-spec/layers) or,
9541
- * less commonly, the {@link CustomLayerInterface} specification.
9548
+ * less commonly, the {@link CustomLayerInterface} specification. Can also be a layer definition with an embedded source definition.
9542
9549
  * The MapLibre Style Specification's layer definition is appropriate for most layers.
9543
9550
  *
9544
9551
  * @param beforeId - The ID of an existing layer to insert the new layer before,
@@ -9610,9 +9617,7 @@ export declare class Map extends Camera {
9610
9617
  * @see [Add a vector tile source](https://maplibre.org/maplibre-gl-js/docs/examples/vector-source/)
9611
9618
  * @see [Add a WMS source](https://maplibre.org/maplibre-gl-js/docs/examples/wms/)
9612
9619
  */
9613
- addLayer(layer: (LayerSpecification & {
9614
- source?: string | SourceSpecification;
9615
- }) | CustomLayerInterface, beforeId?: string): this;
9620
+ addLayer(layer: AddLayerObject, beforeId?: string): this;
9616
9621
  /**
9617
9622
  * Moves a layer to a different z-position.
9618
9623
  *
@@ -9656,7 +9661,7 @@ export declare class Map extends Camera {
9656
9661
  * @see [Filter symbols by toggling a list](https://maplibre.org/maplibre-gl-js/docs/examples/filter-markers/)
9657
9662
  * @see [Filter symbols by text input](https://maplibre.org/maplibre-gl-js/docs/examples/filter-markers-by-input/)
9658
9663
  */
9659
- getLayer(id: string): StyleLayer;
9664
+ getLayer(id: string): StyleLayer | undefined;
9660
9665
  /**
9661
9666
  * Sets the zoom extent for the specified style layer. The zoom extent includes the
9662
9667
  * [minimum zoom level](https://maplibre.org/maplibre-style-spec/layers/#minzoom)