@mapbox/mapbox-gl-style-spec 13.19.1 → 13.20.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/dist/index.es.js CHANGED
@@ -60,6 +60,10 @@ var $root = {
60
60
  type: "terrain",
61
61
  doc: "A global modifier that elevates layers and markers based on a DEM data source."
62
62
  },
63
+ fog: {
64
+ type: "fog",
65
+ doc: "A global effect that fades layers and markers based on their distance to the camera. The fog can be used to approximate the effect of atmosphere on distant objects and enhance the depth perception of the map when used with terrain or 3D features."
66
+ },
63
67
  sources: {
64
68
  required: true,
65
69
  type: "sources",
@@ -859,15 +863,19 @@ var layout_line = {
859
863
  android: "2.0.1",
860
864
  ios: "2.0.0",
861
865
  macos: "0.1.0"
866
+ },
867
+ "data-driven styling": {
868
+ js: "2.3.0"
862
869
  }
863
870
  },
864
871
  expression: {
865
872
  interpolated: false,
866
873
  parameters: [
867
- "zoom"
874
+ "zoom",
875
+ "feature"
868
876
  ]
869
877
  },
870
- "property-type": "data-constant"
878
+ "property-type": "data-driven"
871
879
  },
872
880
  "line-join": {
873
881
  type: "enum",
@@ -1837,15 +1845,19 @@ var layout_symbol = {
1837
1845
  android: "2.0.1",
1838
1846
  ios: "2.0.0",
1839
1847
  macos: "0.1.0"
1848
+ },
1849
+ "data-driven styling": {
1850
+ js: "2.3.0"
1840
1851
  }
1841
1852
  },
1842
1853
  expression: {
1843
1854
  interpolated: true,
1844
1855
  parameters: [
1845
- "zoom"
1856
+ "zoom",
1857
+ "feature"
1846
1858
  ]
1847
1859
  },
1848
- "property-type": "data-constant"
1860
+ "property-type": "data-driven"
1849
1861
  },
1850
1862
  "text-letter-spacing": {
1851
1863
  type: "number",
@@ -2646,7 +2658,7 @@ var expression_name = {
2646
2658
  }
2647
2659
  },
2648
2660
  match: {
2649
- doc: "Selects the output whose label value matches the input value, or the fallback value if no match is found. The input can be any expression (e.g. `[\"get\", \"building_type\"]`). Each label must be either:\n - a single literal value; or\n - an array of literal values, whose values must be all strings or all numbers (e.g. `[100, 101]` or `[\"c\", \"b\"]`). The input matches if any of the values in the array matches, similar to the `\"in\"` operator.\nEach label must be unique. If the input type does not match the type of the labels, the result will be the fallback value.",
2661
+ doc: "Selects the output for which the label value matches the input value, or the fallback value if no match is found. The input can be any expression (for example, `[\"get\", \"building_type\"]`). Each label must be unique, and must be either:\n - a single literal value; or\n - an array of literal values, the values of which must be all strings or all numbers (for example `[100, 101]` or `[\"c\", \"b\"]`).\n\nThe input matches if any of the values in the array matches using strict equality, similar to the `\"in\"` operator.\nIf the input type does not match the type of the labels, the result will be the fallback value.",
2650
2662
  group: "Decision",
2651
2663
  "sdk-support": {
2652
2664
  "basic functionality": {
@@ -3586,6 +3598,75 @@ var expression_name = {
3586
3598
  }
3587
3599
  }
3588
3600
  };
3601
+ var fog = {
3602
+ range: {
3603
+ type: "array",
3604
+ "default": [
3605
+ 0.5,
3606
+ 10
3607
+ ],
3608
+ minimum: -20,
3609
+ maximum: 20,
3610
+ length: 2,
3611
+ value: "number",
3612
+ "property-type": "data-constant",
3613
+ transition: true,
3614
+ expression: {
3615
+ interpolated: true,
3616
+ parameters: [
3617
+ "zoom"
3618
+ ]
3619
+ },
3620
+ doc: "The start and end distance range in which fog fades from fully transparent to fully opaque. The distance to the point at the center of the map is defined as zero, so that negative range values are closer to the camera, and positive values are farther away.",
3621
+ example: [
3622
+ 0.5,
3623
+ 10
3624
+ ],
3625
+ "sdk-support": {
3626
+ "basic functionality": {
3627
+ js: "2.3.0"
3628
+ }
3629
+ }
3630
+ },
3631
+ color: {
3632
+ type: "color",
3633
+ "property-type": "data-constant",
3634
+ "default": "#ffffff",
3635
+ expression: {
3636
+ interpolated: true,
3637
+ parameters: [
3638
+ "zoom"
3639
+ ]
3640
+ },
3641
+ transition: true,
3642
+ doc: "The color of the fog. Using opacity is recommended only for smoothly transitioning fog on/off as anything less than 100% opacity results in more tiles loaded and drawn.",
3643
+ "sdk-support": {
3644
+ "basic functionality": {
3645
+ js: "2.3.0"
3646
+ }
3647
+ }
3648
+ },
3649
+ "horizon-blend": {
3650
+ type: "number",
3651
+ "property-type": "data-constant",
3652
+ "default": 0.1,
3653
+ minimum: 0,
3654
+ maximum: 1,
3655
+ expression: {
3656
+ interpolated: true,
3657
+ parameters: [
3658
+ "zoom"
3659
+ ]
3660
+ },
3661
+ transition: true,
3662
+ doc: "Horizon blend applies a smooth fade from the color of the fog to the color of the sky. A value of zero leaves a sharp transition from fog to sky. Increasing the value blends the color of fog into increasingly high angles of the sky.",
3663
+ "sdk-support": {
3664
+ "basic functionality": {
3665
+ js: "2.3.0"
3666
+ }
3667
+ }
3668
+ }
3669
+ };
3589
3670
  var light = {
3590
3671
  anchor: {
3591
3672
  type: "enum",
@@ -4213,15 +4294,17 @@ var paint_line = {
4213
4294
  macos: "0.1.0"
4214
4295
  },
4215
4296
  "data-driven styling": {
4297
+ js: "2.3.0"
4216
4298
  }
4217
4299
  },
4218
4300
  expression: {
4219
4301
  interpolated: false,
4220
4302
  parameters: [
4221
- "zoom"
4303
+ "zoom",
4304
+ "feature"
4222
4305
  ]
4223
4306
  },
4224
- "property-type": "cross-faded"
4307
+ "property-type": "cross-faded-data-driven"
4225
4308
  },
4226
4309
  "line-pattern": {
4227
4310
  type: "resolvedImage",
@@ -5995,6 +6078,7 @@ var v8 = {
5995
6078
  function_stop: function_stop,
5996
6079
  expression: expression,
5997
6080
  expression_name: expression_name,
6081
+ fog: fog,
5998
6082
  light: light,
5999
6083
  terrain: terrain,
6000
6084
  paint: paint,
@@ -12800,7 +12884,8 @@ const operations = {
12800
12884
  setGlyphs: 'setGlyphs',
12801
12885
  setTransition: 'setTransition',
12802
12886
  setLight: 'setLight',
12803
- setTerrain: 'setTerrain'
12887
+ setTerrain: 'setTerrain',
12888
+ setFog: 'setFog'
12804
12889
  };
12805
12890
  function addSource(sourceId, after, commands) {
12806
12891
  commands.push({
@@ -13101,6 +13186,12 @@ function diffStyles(before, after) {
13101
13186
  args: [after.light]
13102
13187
  });
13103
13188
  }
13189
+ if (!deepEqual(before.fog, after.fog)) {
13190
+ commands.push({
13191
+ command: operations.setFog,
13192
+ args: [after.fog]
13193
+ });
13194
+ }
13104
13195
  const sourcesRemoved = {};
13105
13196
  const removeOrAddSourceCommands = [];
13106
13197
  diffSources(before.sources, after.sources, removeOrAddSourceCommands, sourcesRemoved);
@@ -14040,6 +14131,44 @@ function validateTerrain(options) {
14040
14131
  return errors;
14041
14132
  }
14042
14133
 
14134
+ function validateFog(options) {
14135
+ const fog = options.value;
14136
+ const style = options.style;
14137
+ const styleSpec = options.styleSpec;
14138
+ const fogSpec = styleSpec.fog;
14139
+ let errors = [];
14140
+ const rootType = getType(fog);
14141
+ if (fog === undefined) {
14142
+ return errors;
14143
+ } else if (rootType !== 'object') {
14144
+ errors = errors.concat([new ValidationError('fog', fog, `object expected, ${ rootType } found`)]);
14145
+ return errors;
14146
+ }
14147
+ for (const key in fog) {
14148
+ const transitionMatch = key.match(/^(.*)-transition$/);
14149
+ if (transitionMatch && fogSpec[transitionMatch[1]] && fogSpec[transitionMatch[1]].transition) {
14150
+ errors = errors.concat(validate({
14151
+ key,
14152
+ value: fog[key],
14153
+ valueSpec: styleSpec.transition,
14154
+ style,
14155
+ styleSpec
14156
+ }));
14157
+ } else if (fogSpec[key]) {
14158
+ errors = errors.concat(validate({
14159
+ key,
14160
+ value: fog[key],
14161
+ valueSpec: fogSpec[key],
14162
+ style,
14163
+ styleSpec
14164
+ }));
14165
+ } else {
14166
+ errors = errors.concat([new ValidationError(key, fog[key], `unknown property "${ key }"`)]);
14167
+ }
14168
+ }
14169
+ return errors;
14170
+ }
14171
+
14043
14172
  function validateFormatted(options) {
14044
14173
  if (validateString(options).length === 0) {
14045
14174
  return [];
@@ -14071,6 +14200,7 @@ const VALIDATORS = {
14071
14200
  'source': validateSource,
14072
14201
  'light': validateLight,
14073
14202
  'terrain': validateTerrain,
14203
+ 'fog': validateFog,
14074
14204
  'string': validateString,
14075
14205
  'formatted': validateFormatted,
14076
14206
  'resolvedImage': validateImage
@@ -14134,6 +14264,7 @@ function validateStyleMin(style, styleSpec = v8) {
14134
14264
  validateStyleMin.source = wrapCleanErrors(validateSource);
14135
14265
  validateStyleMin.light = wrapCleanErrors(validateLight);
14136
14266
  validateStyleMin.terrain = wrapCleanErrors(validateTerrain);
14267
+ validateStyleMin.fog = wrapCleanErrors(validateFog);
14137
14268
  validateStyleMin.layer = wrapCleanErrors(validateLayer);
14138
14269
  validateStyleMin.filter = wrapCleanErrors(validateFilter);
14139
14270
  validateStyleMin.paintProperty = wrapCleanErrors(validatePaintProperty);
@@ -14854,6 +14985,11 @@ function getAllowedKeyErrors(obj, keys, path) {
14854
14985
  });
14855
14986
  return errors;
14856
14987
  }
14988
+ const acceptedSourceTypes = new Set([
14989
+ 'vector',
14990
+ 'raster',
14991
+ 'raster-dem'
14992
+ ]);
14857
14993
  function getSourceErrors(source, i) {
14858
14994
  const errors = [];
14859
14995
  const sourceKeys = [
@@ -14862,9 +14998,12 @@ function getSourceErrors(source, i) {
14862
14998
  'tileSize'
14863
14999
  ];
14864
15000
  errors.push(...getAllowedKeyErrors(source, sourceKeys, 'source'));
15001
+ if (!acceptedSourceTypes.has(String(source.type))) {
15002
+ errors.push(new ValidationError(`sources[${ i }].type`, source.type, `Expected one of [${ Array.from(acceptedSourceTypes).join(', ') }]`));
15003
+ }
14865
15004
  const sourceUrlPattern = /^mapbox:\/\/([^/]*)$/;
14866
- if (!isValid(source.url, sourceUrlPattern)) {
14867
- errors.push(new ValidationError(`sources[${ i }]`, source.url, 'Source url must be a valid Mapbox tileset url'));
15005
+ if (!source.url || !isValid(source.url, sourceUrlPattern)) {
15006
+ errors.push(new ValidationError(`sources[${ i }].url`, source.url, 'Expected a valid Mapbox tileset url'));
14868
15007
  }
14869
15008
  return errors;
14870
15009
  }