@mapbox/mapbox-gl-style-spec 14.34.0-rc.1 → 14.34.1-alpha.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapbox/mapbox-gl-style-spec",
3
- "version": "14.34.0-rc.1",
3
+ "version": "14.34.1-alpha.1",
4
4
  "description": "a specification for mapbox gl styles",
5
5
  "author": "Mapbox",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
package/reference/v8.json CHANGED
@@ -10792,6 +10792,64 @@
10792
10792
  "interpolated": false
10793
10793
  },
10794
10794
  "property-type": "data-constant"
10795
+ },
10796
+ "raster-mask": {
10797
+ "type": "string",
10798
+ "required": false,
10799
+ "experimental": true,
10800
+ "private": true,
10801
+ "doc": "The id of a `fill` layer in the same style whose polygons should clip this layer. Only the geometry is used: set `fill-opacity` to 0 to keep the layer invisible, but don't hide it with `visibility`, `minzoom` or `maxzoom`. To use a featureset from another import, see `raster-mask-import`. Elevated `fill` layers and `raster-elevation` are not supported. This layer is only drawn where the mask's data has loaded, and not at all if the mask can't be used.",
10802
+ "example": "water",
10803
+ "transition": false,
10804
+ "sdk-support": {
10805
+ "basic functionality": {
10806
+ "js": "3.34.0"
10807
+ }
10808
+ },
10809
+ "property-type": "data-constant"
10810
+ },
10811
+ "raster-mask-import": {
10812
+ "type": "string",
10813
+ "required": false,
10814
+ "experimental": true,
10815
+ "private": true,
10816
+ "doc": "The id of an import of this style. When set, `raster-mask` is the id of a featureset of that import instead of a layer id, and the mask is made of the `fill` layers the featureset selects. If the featureset can't be found, or selects no `fill` layers, this layer is not drawn.",
10817
+ "example": "basemap",
10818
+ "transition": false,
10819
+ "requires": [
10820
+ "raster-mask"
10821
+ ],
10822
+ "sdk-support": {
10823
+ "basic functionality": {
10824
+ "js": "3.34.0"
10825
+ }
10826
+ },
10827
+ "property-type": "data-constant"
10828
+ },
10829
+ "raster-mask-mode": {
10830
+ "type": "enum",
10831
+ "doc": "Whether this layer is drawn inside or outside the mask.",
10832
+ "values": {
10833
+ "clip-path-intersect": {
10834
+ "doc": "Draw only where the mask layer's geometry covers the map."
10835
+ },
10836
+ "clip-path-exclude": {
10837
+ "doc": "Draw only where the mask layer's geometry does not cover the map."
10838
+ }
10839
+ },
10840
+ "default": "clip-path-intersect",
10841
+ "experimental": true,
10842
+ "private": true,
10843
+ "transition": false,
10844
+ "requires": [
10845
+ "raster-mask"
10846
+ ],
10847
+ "sdk-support": {
10848
+ "basic functionality": {
10849
+ "js": "3.34.0"
10850
+ }
10851
+ },
10852
+ "property-type": "data-constant"
10795
10853
  }
10796
10854
  },
10797
10855
  "paint_raster-particle": {
package/types.ts CHANGED
@@ -1266,7 +1266,19 @@ export type RasterLayerSpecification = {
1266
1266
  /**
1267
1267
  * @experimental This property is experimental and subject to change in future versions.
1268
1268
  */
1269
- "raster-elevation-reference"?: "sea" | "ground" | ExpressionSpecification
1269
+ "raster-elevation-reference"?: "sea" | "ground" | ExpressionSpecification,
1270
+ /**
1271
+ * @experimental This property is experimental and subject to change in future versions.
1272
+ */
1273
+ "raster-mask"?: string,
1274
+ /**
1275
+ * @experimental This property is experimental and subject to change in future versions.
1276
+ */
1277
+ "raster-mask-import"?: string,
1278
+ /**
1279
+ * @experimental This property is experimental and subject to change in future versions.
1280
+ */
1281
+ "raster-mask-mode"?: "clip-path-intersect" | "clip-path-exclude"
1270
1282
  },
1271
1283
  "appearances"?: Array<AppearanceSpecification>
1272
1284
  };
@@ -107,6 +107,27 @@ export default function validateLayer(options: LayerValidatorOptions): Validatio
107
107
  }
108
108
  }
109
109
 
110
+ if (type === 'raster' && isObject(layer.paint)) {
111
+ const paint = layer.paint as Record<string, unknown>;
112
+ const maskId = unbundle(paint['raster-mask']);
113
+ const importId = unbundle(paint['raster-mask-import']);
114
+ if (isString(maskId) && maskId) {
115
+ if (isString(importId) && importId) {
116
+ // The featureset itself can only be checked once the import has loaded.
117
+ if (!(style.imports || []).some((i) => unbundle(i.id) === importId)) {
118
+ errors.push(new ValidationError(`${key}.paint.raster-mask-import`, paint['raster-mask-import'], `import "${importId}" not found`));
119
+ }
120
+ } else {
121
+ const maskLayer = (style.layers || []).find((l) => unbundle(l.id) === maskId);
122
+ if (!maskLayer) {
123
+ errors.push(new ValidationError(`${key}.paint.raster-mask`, paint['raster-mask'], `layer "${maskId}" not found`));
124
+ } else if (unbundle(maskLayer.type) !== 'fill') {
125
+ errors.push(new ValidationError(`${key}.paint.raster-mask`, paint['raster-mask'], `layer "${maskId}" must be a "fill" layer`));
126
+ }
127
+ }
128
+ }
129
+ }
130
+
110
131
  errors = errors.concat(validateObject({
111
132
  key,
112
133
  value: layer,