@mapbox/mapbox-gl-style-spec 14.0.0-rc.2 → 14.1.0-beta.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/diff.js CHANGED
@@ -38,6 +38,11 @@ export const operations: {[_: string]: string} = {
38
38
  */
39
39
  setLayoutProperty: 'setLayoutProperty',
40
40
 
41
+ /*
42
+ * { command: 'setSlot', args: ['layerId', slot] }
43
+ */
44
+ setSlot: 'setSlot',
45
+
41
46
  /*
42
47
  * { command: 'setFilter', args: ['layerId', filter] }
43
48
  */
@@ -151,7 +156,12 @@ export const operations: {[_: string]: string} = {
151
156
  /*
152
157
  * { command: 'setImportData', args: [importId, stylesheet] }
153
158
  */
154
- setImportData: 'setImportData'
159
+ setImportData: 'setImportData',
160
+
161
+ /*
162
+ * { command: 'setImportConfig', args: [importId, config] }
163
+ */
164
+ setImportConfig: 'setImportConfig'
155
165
  };
156
166
 
157
167
  function addSource(sourceId: string, after: Sources, commands: Array<Command>) {
@@ -324,6 +334,9 @@ function diffLayers(before: Array<LayerSpecification>, after: Array<LayerSpecifi
324
334
  // layout, paint, filter, minzoom, maxzoom
325
335
  diffLayerPropertyChanges(beforeLayer.layout, afterLayer.layout, commands, layerId, null, operations.setLayoutProperty);
326
336
  diffLayerPropertyChanges(beforeLayer.paint, afterLayer.paint, commands, layerId, null, operations.setPaintProperty);
337
+ if (!isEqual(beforeLayer.slot, afterLayer.slot)) {
338
+ commands.push({command: operations.setSlot, args: [layerId, afterLayer.slot]});
339
+ }
327
340
  if (!isEqual(beforeLayer.filter, afterLayer.filter)) {
328
341
  commands.push({command: operations.setFilter, args: [layerId, afterLayer.filter]});
329
342
  }
@@ -335,7 +348,7 @@ function diffLayers(before: Array<LayerSpecification>, after: Array<LayerSpecifi
335
348
  for (prop in beforeLayer) {
336
349
  if (!beforeLayer.hasOwnProperty(prop)) continue;
337
350
  if (prop === 'layout' || prop === 'paint' || prop === 'filter' ||
338
- prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom') continue;
351
+ prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom' || prop === 'slot') continue;
339
352
  if (prop.indexOf('paint.') === 0) {
340
353
  diffLayerPropertyChanges(beforeLayer[prop], afterLayer[prop], commands, layerId, prop.slice(6), operations.setPaintProperty);
341
354
  } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {
@@ -345,7 +358,7 @@ function diffLayers(before: Array<LayerSpecification>, after: Array<LayerSpecifi
345
358
  for (prop in afterLayer) {
346
359
  if (!afterLayer.hasOwnProperty(prop) || beforeLayer.hasOwnProperty(prop)) continue;
347
360
  if (prop === 'layout' || prop === 'paint' || prop === 'filter' ||
348
- prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom') continue;
361
+ prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom' || prop === 'slot') continue;
349
362
  if (prop.indexOf('paint.') === 0) {
350
363
  diffLayerPropertyChanges(beforeLayer[prop], afterLayer[prop], commands, layerId, prop.slice(6), operations.setPaintProperty);
351
364
  } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {
@@ -411,6 +424,10 @@ export function diffImports(before: Array<ImportSpecification> = [], after: Arra
411
424
  const beforeImport = beforeIndex[afterImport.id];
412
425
  if (!beforeImport || isEqual(beforeImport, afterImport)) continue;
413
426
 
427
+ if (!isEqual(beforeImport.config, afterImport.config)) {
428
+ commands.push({command: operations.setImportConfig, args: [afterImport.id, afterImport.config]});
429
+ }
430
+
414
431
  if (!isEqual(beforeImport.url, afterImport.url)) {
415
432
  commands.push({command: operations.setImportUrl, args: [afterImport.id, afterImport.url]});
416
433
  }
@@ -445,7 +462,7 @@ export function diffImports(before: Array<ImportSpecification> = [], after: Arra
445
462
  export default function diffStyles(before: StyleSpecification, after: StyleSpecification): Array<Command> {
446
463
  if (!before) return [{command: operations.setStyle, args: [after]}];
447
464
 
448
- let commands = [];
465
+ let commands: Array<Command> = [];
449
466
 
450
467
  try {
451
468
  // Handle changes to top-level properties
@@ -470,6 +487,10 @@ export default function diffStyles(before: StyleSpecification, after: StyleSpeci
470
487
  if (!isEqual(before.glyphs, after.glyphs)) {
471
488
  commands.push({command: operations.setGlyphs, args: [after.glyphs]});
472
489
  }
490
+ // Handle changes to `imports` before other mergable top-level properties
491
+ if (!isEqual(before.imports, after.imports)) {
492
+ diffImports(before.imports, after.imports, commands);
493
+ }
473
494
  if (!isEqual(before.transition, after.transition)) {
474
495
  commands.push({command: operations.setTransition, args: [after.transition]});
475
496
  }
@@ -533,9 +554,6 @@ export default function diffStyles(before: StyleSpecification, after: StyleSpeci
533
554
 
534
555
  // Handle changes to `layers`
535
556
  diffLayers(beforeLayers, after.layers, commands);
536
-
537
- // Handle changes to `imports`
538
- diffImports(before.imports, after.imports, commands);
539
557
  } catch (e) {
540
558
  // fall back to setStyle
541
559
  console.warn('Unable to compute style diff:', e);
package/dist/index.cjs CHANGED
@@ -95,7 +95,15 @@
95
95
  "shadow-intensity": 0.2
96
96
  }
97
97
  }
98
- ]
98
+ ],
99
+ "sdk-support": {
100
+ "basic functionality": {
101
+ js: "3.0.0",
102
+ android: "11.0.0",
103
+ ios: "11.0.0",
104
+ macos: "11.0.0"
105
+ }
106
+ }
99
107
  },
100
108
  terrain: {
101
109
  type: "terrain",
@@ -562,6 +570,7 @@
562
570
  "source_vector",
563
571
  "source_raster",
564
572
  "source_raster_dem",
573
+ "source_raster_array",
565
574
  "source_geojson",
566
575
  "source_video",
567
576
  "source_image",
@@ -808,6 +817,67 @@
808
817
  doc: "Other keys to configure the data source."
809
818
  }
810
819
  };
820
+ var source_raster_array = {
821
+ type: {
822
+ required: true,
823
+ type: "enum",
824
+ values: {
825
+ "raster-array": {
826
+ doc: "A raster array source"
827
+ }
828
+ },
829
+ doc: "The type of the source."
830
+ },
831
+ url: {
832
+ type: "string",
833
+ doc: "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`."
834
+ },
835
+ tiles: {
836
+ type: "array",
837
+ value: "string",
838
+ doc: "An array of one or more tile source URLs, as in the TileJSON spec."
839
+ },
840
+ bounds: {
841
+ type: "array",
842
+ value: "number",
843
+ length: 4,
844
+ "default": [
845
+ -180,
846
+ -85.051129,
847
+ 180,
848
+ 85.051129
849
+ ],
850
+ doc: "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL."
851
+ },
852
+ minzoom: {
853
+ type: "number",
854
+ "default": 0,
855
+ doc: "Minimum zoom level for which tiles are available, as in the TileJSON spec."
856
+ },
857
+ maxzoom: {
858
+ type: "number",
859
+ "default": 22,
860
+ doc: "Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."
861
+ },
862
+ tileSize: {
863
+ type: "number",
864
+ "default": 512,
865
+ units: "pixels",
866
+ doc: "The minimum visual size to display tiles for this layer. Only configurable for raster layers."
867
+ },
868
+ attribution: {
869
+ type: "string",
870
+ doc: "Contains an attribution to be displayed when the map is shown to a user."
871
+ },
872
+ rasterLayers: {
873
+ type: "*",
874
+ doc: "Contains the description of the raster data layers and the bands contained within the tiles."
875
+ },
876
+ "*": {
877
+ type: "*",
878
+ doc: "Other keys to configure the data source."
879
+ }
880
+ };
811
881
  var source_geojson = {
812
882
  type: {
813
883
  required: true,
@@ -1784,7 +1854,7 @@
1784
1854
  "symbol-z-elevate": {
1785
1855
  type: "boolean",
1786
1856
  "default": false,
1787
- doc: "Position symbol on buildings (both fill extrusions and models) roof tops. In order to have minimal impact on performance, this is supported only when `fill-extrusion-height` is not zoom-dependent and not edited after initial bucket creation. For fading in buildings when zooming in, fill-extrusion-vertical-scale should be used and symbols would raise with building roofs. Symbols are sorted by elevation, except in case when `viewport-y` sorting or `symbol-sort-key` are applied.",
1857
+ doc: "Position symbol on buildings (both fill extrusions and models) rooftops. In order to have minimal impact on performance, this is supported only when `fill-extrusion-height` is not zoom-dependent and remains unchanged. For fading in buildings when zooming in, fill-extrusion-vertical-scale should be used and symbols would raise with building rooftops. Symbols are sorted by elevation, except in cases when `viewport-y` sorting or `symbol-sort-key` are applied.",
1788
1858
  "sdk-support": {
1789
1859
  "basic functionality": {
1790
1860
  js: "3.0.0",
@@ -7055,6 +7125,66 @@
7055
7125
  ]
7056
7126
  },
7057
7127
  "property-type": "data-constant"
7128
+ },
7129
+ "raster-emissive-strength": {
7130
+ type: "number",
7131
+ "default": 0,
7132
+ minimum: 0,
7133
+ transition: true,
7134
+ units: "intensity",
7135
+ doc: "Controls the intensity of light emitted on the source features.",
7136
+ requires: [
7137
+ "lights"
7138
+ ],
7139
+ "sdk-support": {
7140
+ "basic functionality": {
7141
+ js: "3.0.0",
7142
+ android: "11.0.0",
7143
+ ios: "11.0.0"
7144
+ }
7145
+ },
7146
+ expression: {
7147
+ interpolated: true,
7148
+ parameters: [
7149
+ "zoom",
7150
+ "measure-light"
7151
+ ]
7152
+ },
7153
+ "property-type": "data-constant"
7154
+ },
7155
+ "raster-array-band": {
7156
+ type: "string",
7157
+ required: false,
7158
+ "property-type": "data-constant",
7159
+ transition: false,
7160
+ doc: "Displayed band of raster array source layer",
7161
+ example: "band-name",
7162
+ "sdk-support": {
7163
+ "basic functionality": {
7164
+ js: "3.1.0",
7165
+ android: "11.1.0",
7166
+ ios: "11.1.0"
7167
+ }
7168
+ }
7169
+ },
7170
+ "raster-elevation": {
7171
+ type: "number",
7172
+ doc: "Specifies an uniform elevation from the ground, in meters. Only supported with image sources.",
7173
+ "default": 0,
7174
+ minimum: 0,
7175
+ transition: true,
7176
+ "sdk-support": {
7177
+ "basic functionality": {
7178
+ js: "3.1.0"
7179
+ }
7180
+ },
7181
+ expression: {
7182
+ interpolated: true,
7183
+ parameters: [
7184
+ "zoom"
7185
+ ]
7186
+ },
7187
+ "property-type": "data-constant"
7058
7188
  }
7059
7189
  };
7060
7190
  var paint_hillshade = {
@@ -7204,7 +7334,10 @@
7204
7334
  minimum: 0,
7205
7335
  transition: true,
7206
7336
  units: "intensity",
7207
- doc: "Controls the intensity of light emitted on the source features. This property works only with 3D light, i.e. when `lights` root property is defined.",
7337
+ doc: "Controls the intensity of light emitted on the source features.",
7338
+ requires: [
7339
+ "lights"
7340
+ ],
7208
7341
  "sdk-support": {
7209
7342
  "basic functionality": {
7210
7343
  js: "3.0.0",
@@ -8015,7 +8148,7 @@
8015
8148
  }
8016
8149
  },
8017
8150
  directional: {
8018
- doc: "A light that has a direction and is located at infinite, so its rays are parallel. Simulates the sun light and it can cast shadows",
8151
+ doc: "A light that has a direction and is located at infinite distance, so its rays are parallel. It simulates the sun light and can cast shadows.",
8019
8152
  "sdk-support": {
8020
8153
  "basic functionality": {
8021
8154
  js: "3.0.0",
@@ -8025,7 +8158,7 @@
8025
8158
  }
8026
8159
  },
8027
8160
  flat: {
8028
- doc: "A global directional light source which is only applied on 3D layers and hillshade layers. Using this type disables other light sources.",
8161
+ doc: "A global directional light source which is only applied on 3D and hillshade layers. Using this type disables other light sources.",
8029
8162
  "sdk-support": {
8030
8163
  "basic functionality": {
8031
8164
  js: "3.0.0",
@@ -8046,6 +8179,7 @@
8046
8179
  source_vector: source_vector,
8047
8180
  source_raster: source_raster,
8048
8181
  source_raster_dem: source_raster_dem,
8182
+ source_raster_array: source_raster_array,
8049
8183
  source_geojson: source_geojson,
8050
8184
  source_video: source_video,
8051
8185
  source_image: source_image,
@@ -8486,7 +8620,7 @@
8486
8620
  ]
8487
8621
  },
8488
8622
  transition: true,
8489
- doc: "Shades area near ground and concave angles between walls where the radius defines only vertical impact. Default value 3.0 corresponds to height of one floor and brings the most plausible results for buildings. This property works only with legacy light. When 3D light is enabled `fill-extrusion-ambient-occlusion-wall-radius` and `fill-extrusion-ambient-occlusion-ground-radius` are used instead.",
8623
+ doc: "Shades area near ground and concave angles between walls where the radius defines only vertical impact. Default value 3.0 corresponds to height of one floor and brings the most plausible results for buildings. This property works only with legacy light. When 3D lights are enabled `fill-extrusion-ambient-occlusion-wall-radius` and `fill-extrusion-ambient-occlusion-ground-radius` are used instead.",
8490
8624
  requires: [
8491
8625
  "fill-extrusion-edge-radius",
8492
8626
  {
@@ -8798,6 +8932,32 @@
8798
8932
  }
8799
8933
  },
8800
8934
  "property-type": "data-constant"
8935
+ },
8936
+ "fill-extrusion-emissive-strength": {
8937
+ type: "number",
8938
+ "default": 0,
8939
+ minimum: 0,
8940
+ transition: true,
8941
+ units: "intensity",
8942
+ doc: "Controls the intensity of light emitted on the source features.",
8943
+ requires: [
8944
+ "lights"
8945
+ ],
8946
+ "sdk-support": {
8947
+ "basic functionality": {
8948
+ js: "3.0.0",
8949
+ android: "11.0.0",
8950
+ ios: "11.0.0"
8951
+ }
8952
+ },
8953
+ expression: {
8954
+ interpolated: true,
8955
+ parameters: [
8956
+ "zoom",
8957
+ "measure-light"
8958
+ ]
8959
+ },
8960
+ "property-type": "data-constant"
8801
8961
  }
8802
8962
  },
8803
8963
  paint_line: paint_line,
@@ -18624,6 +18784,10 @@ ${ JSON.stringify(filterExp, null, 2) }
18624
18784
  * { command: 'setLayoutProperty', args: ['layerId', 'prop', value] }
18625
18785
  */
18626
18786
  setLayoutProperty: 'setLayoutProperty',
18787
+ /*
18788
+ * { command: 'setSlot', args: ['layerId', slot] }
18789
+ */
18790
+ setSlot: 'setSlot',
18627
18791
  /*
18628
18792
  * { command: 'setFilter', args: ['layerId', filter] }
18629
18793
  */
@@ -18715,7 +18879,11 @@ ${ JSON.stringify(filterExp, null, 2) }
18715
18879
  /*
18716
18880
  * { command: 'setImportData', args: [importId, stylesheet] }
18717
18881
  */
18718
- setImportData: 'setImportData'
18882
+ setImportData: 'setImportData',
18883
+ /*
18884
+ * { command: 'setImportConfig', args: [importId, config] }
18885
+ */
18886
+ setImportConfig: 'setImportConfig'
18719
18887
  };
18720
18888
  function addSource(sourceId, after, commands) {
18721
18889
  commands.push({
@@ -18920,6 +19088,15 @@ ${ JSON.stringify(filterExp, null, 2) }
18920
19088
  // layout, paint, filter, minzoom, maxzoom
18921
19089
  diffLayerPropertyChanges(beforeLayer.layout, afterLayer.layout, commands, layerId, null, operations.setLayoutProperty);
18922
19090
  diffLayerPropertyChanges(beforeLayer.paint, afterLayer.paint, commands, layerId, null, operations.setPaintProperty);
19091
+ if (!deepEqual(beforeLayer.slot, afterLayer.slot)) {
19092
+ commands.push({
19093
+ command: operations.setSlot,
19094
+ args: [
19095
+ layerId,
19096
+ afterLayer.slot
19097
+ ]
19098
+ });
19099
+ }
18923
19100
  if (!deepEqual(beforeLayer.filter, afterLayer.filter)) {
18924
19101
  commands.push({
18925
19102
  command: operations.setFilter,
@@ -18943,7 +19120,7 @@ ${ JSON.stringify(filterExp, null, 2) }
18943
19120
  for (prop in beforeLayer) {
18944
19121
  if (!beforeLayer.hasOwnProperty(prop))
18945
19122
  continue;
18946
- if (prop === 'layout' || prop === 'paint' || prop === 'filter' || prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom')
19123
+ if (prop === 'layout' || prop === 'paint' || prop === 'filter' || prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom' || prop === 'slot')
18947
19124
  continue;
18948
19125
  if (prop.indexOf('paint.') === 0) {
18949
19126
  diffLayerPropertyChanges(beforeLayer[prop], afterLayer[prop], commands, layerId, prop.slice(6), operations.setPaintProperty);
@@ -18961,7 +19138,7 @@ ${ JSON.stringify(filterExp, null, 2) }
18961
19138
  for (prop in afterLayer) {
18962
19139
  if (!afterLayer.hasOwnProperty(prop) || beforeLayer.hasOwnProperty(prop))
18963
19140
  continue;
18964
- if (prop === 'layout' || prop === 'paint' || prop === 'filter' || prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom')
19141
+ if (prop === 'layout' || prop === 'paint' || prop === 'filter' || prop === 'metadata' || prop === 'minzoom' || prop === 'maxzoom' || prop === 'slot')
18965
19142
  continue;
18966
19143
  if (prop.indexOf('paint.') === 0) {
18967
19144
  diffLayerPropertyChanges(beforeLayer[prop], afterLayer[prop], commands, layerId, prop.slice(6), operations.setPaintProperty);
@@ -19037,6 +19214,15 @@ ${ JSON.stringify(filterExp, null, 2) }
19037
19214
  const beforeImport = beforeIndex[afterImport.id];
19038
19215
  if (!beforeImport || deepEqual(beforeImport, afterImport))
19039
19216
  continue;
19217
+ if (!deepEqual(beforeImport.config, afterImport.config)) {
19218
+ commands.push({
19219
+ command: operations.setImportConfig,
19220
+ args: [
19221
+ afterImport.id,
19222
+ afterImport.config
19223
+ ]
19224
+ });
19225
+ }
19040
19226
  if (!deepEqual(beforeImport.url, afterImport.url)) {
19041
19227
  commands.push({
19042
19228
  command: operations.setImportUrl,
@@ -19128,6 +19314,10 @@ ${ JSON.stringify(filterExp, null, 2) }
19128
19314
  args: [after.glyphs]
19129
19315
  });
19130
19316
  }
19317
+ // Handle changes to `imports` before other mergable top-level properties
19318
+ if (!deepEqual(before.imports, after.imports)) {
19319
+ diffImports(before.imports, after.imports, commands);
19320
+ }
19131
19321
  if (!deepEqual(before.transition, after.transition)) {
19132
19322
  commands.push({
19133
19323
  command: operations.setTransition,
@@ -19211,8 +19401,6 @@ ${ JSON.stringify(filterExp, null, 2) }
19211
19401
  }
19212
19402
  // Handle changes to `layers`
19213
19403
  diffLayers(beforeLayers, after.layers, commands);
19214
- // Handle changes to `imports`
19215
- diffImports(before.imports, after.imports, commands);
19216
19404
  } catch (e) {
19217
19405
  // fall back to setStyle
19218
19406
  console.warn('Unable to compute style diff:', e);