@mapbox/mapbox-gl-style-spec 14.0.0-beta.2 → 14.0.0-beta.4

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  import isEqual from './util/deep_equal.js';
4
4
 
5
- import type {StyleSpecification, SourceSpecification, LayerSpecification} from './types.js';
5
+ import type {StyleSpecification, ImportSpecification, SourceSpecification, LayerSpecification} from './types.js';
6
6
 
7
7
  type Sources = { [string]: SourceSpecification };
8
8
 
@@ -131,7 +131,17 @@ export const operations: {[_: string]: string} = {
131
131
  /*
132
132
  * { command: 'setProjection', args: [projectionProperties] }
133
133
  */
134
- setProjection: 'setProjection'
134
+ setProjection: 'setProjection',
135
+
136
+ /*
137
+ * { command: 'addImport', args: [importProperties] }
138
+ */
139
+ addImport: 'addImport',
140
+
141
+ /*
142
+ * { command: 'removeImport', args: [importId] }
143
+ */
144
+ removeImport: 'removeImport'
135
145
  };
136
146
 
137
147
  function addSource(sourceId: string, after: Sources, commands: Array<Command>) {
@@ -335,6 +345,17 @@ function diffLayers(before: Array<LayerSpecification>, after: Array<LayerSpecifi
335
345
  }
336
346
  }
337
347
 
348
+ function diffImports(before: Array<ImportSpecification> = [], after: Array<ImportSpecification> = [], commands: Array<Command>) {
349
+ // no diff for the imports, must remove then add
350
+ for (const beforeImport of before) {
351
+ commands.push({command: operations.removeImport, args: [beforeImport.id]});
352
+ }
353
+
354
+ for (const afterImport of after) {
355
+ commands.push({command: operations.addImport, args: [afterImport]});
356
+ }
357
+ }
358
+
338
359
  /**
339
360
  * Diff two stylesheet
340
361
  *
@@ -445,6 +466,8 @@ export default function diffStyles(before: StyleSpecification, after: StyleSpeci
445
466
  // Handle changes to `layers`
446
467
  diffLayers(beforeLayers, after.layers, commands);
447
468
 
469
+ // Handle changes to `imports`
470
+ diffImports(before.imports, after.imports, commands);
448
471
  } catch (e) {
449
472
  // fall back to setStyle
450
473
  console.warn('Unable to compute style diff:', e);
package/dist/index.cjs CHANGED
@@ -32,7 +32,7 @@
32
32
  center: {
33
33
  type: "array",
34
34
  value: "number",
35
- doc: "Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
35
+ doc: "Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
36
36
  example: [
37
37
  -73.9749,
38
38
  40.7736
@@ -40,7 +40,7 @@
40
40
  },
41
41
  zoom: {
42
42
  type: "number",
43
- doc: "Default zoom level. The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
43
+ doc: "Default zoom level. The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
44
44
  example: 12.5
45
45
  },
46
46
  bearing: {
@@ -883,13 +883,13 @@
883
883
  doc: "The data type of the image source."
884
884
  },
885
885
  url: {
886
- required: true,
886
+ required: false,
887
887
  type: "string",
888
- doc: "URL that points to an image."
888
+ doc: "URL that points to an image. If the URL is not specified, the image is expected to be loaded directly during runtime."
889
889
  },
890
890
  coordinates: {
891
891
  required: true,
892
- doc: "Corners of image specified in longitude, latitude pairs.",
892
+ doc: "Corners of image specified in longitude, latitude pairs. Note: When using globe projection, the image will be centered at the North or South Pole in the respective hemisphere if the average latitude value exceeds 85 degrees or falls below -85 degrees.",
893
893
  type: "array",
894
894
  length: 4,
895
895
  value: {
@@ -1111,7 +1111,7 @@
1111
1111
  },
1112
1112
  filter: {
1113
1113
  type: "filter",
1114
- doc: "An expression specifying conditions on source features. Only features that match the filter are displayed. Zoom expressions in filters are only evaluated at integer zoom levels. The `[\"feature-state\", ...]` expression is not supported in filter expressions. The `[\"pitch\"]` and `[\"distance-from-center\"]` expressions are supported only for filter expressions on the symbol layer."
1114
+ doc: "An expression specifying conditions on source features. Only features that match the filter are displayed. Zoom expressions in filters are only evaluated at integer zoom levels. The `[\"feature-state\", ...]` expression is not supported in filter expressions. The `[\"pitch\"]` and `[\"distance-from-center\"]` expressions are supported only for filter expressions on the symbol layer."
1115
1115
  },
1116
1116
  layout: {
1117
1117
  type: "layout",
@@ -1680,7 +1680,7 @@
1680
1680
  },
1681
1681
  "symbol-sort-key": {
1682
1682
  type: "number",
1683
- doc: "Sorts features in ascending order based on this value. Features with lower sort keys are drawn and placed first. When `icon-allow-overlap` or `text-allow-overlap` is `false`, features with a lower sort key will have priority during placement. When `icon-allow-overlap` or `text-allow-overlap` is set to `true`, features with a higher sort key will overlap over features with a lower sort key.",
1683
+ doc: "Sorts features in ascending order based on this value. Features with lower sort keys are drawn and placed first. When `icon-allow-overlap` or `text-allow-overlap` is `false`, features with a lower sort key will have priority during placement. When `icon-allow-overlap` or `text-allow-overlap` is set to `true`, features with a higher sort key will overlap over features with a lower sort key.",
1684
1684
  "sdk-support": {
1685
1685
  "basic functionality": {
1686
1686
  js: "0.53.0",
@@ -1735,6 +1735,37 @@
1735
1735
  },
1736
1736
  "property-type": "data-constant"
1737
1737
  },
1738
+ "symbol-z-elevate": {
1739
+ type: "boolean",
1740
+ "default": false,
1741
+ 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.",
1742
+ "sdk-support": {
1743
+ "basic functionality": {
1744
+ js: "3.0.0",
1745
+ android: "11.0.0",
1746
+ ios: "11.0.0"
1747
+ }
1748
+ },
1749
+ requires: [
1750
+ {
1751
+ "symbol-placement": [
1752
+ "point"
1753
+ ]
1754
+ },
1755
+ {
1756
+ "symbol-z-order": [
1757
+ "auto"
1758
+ ]
1759
+ }
1760
+ ],
1761
+ expression: {
1762
+ interpolated: false,
1763
+ parameters: [
1764
+ "zoom"
1765
+ ]
1766
+ },
1767
+ "property-type": "data-constant"
1768
+ },
1738
1769
  "icon-allow-overlap": {
1739
1770
  type: "boolean",
1740
1771
  "default": false,
@@ -3293,7 +3324,7 @@
3293
3324
  }
3294
3325
  },
3295
3326
  array: {
3296
- doc: "Asserts that the input is an array (optionally with a specific item type and length). If, when the input expression is evaluated, it is not of the asserted type, then this assertion will cause the whole expression to be aborted.",
3327
+ doc: "Asserts that the input is an array (optionally with a specific item type and length). If, when the input expression is evaluated, it is not of the asserted type, then this assertion will cause the whole expression to be aborted.",
3297
3328
  group: "Types",
3298
3329
  "sdk-support": {
3299
3330
  "basic functionality": {
@@ -3739,7 +3770,7 @@
3739
3770
  }
3740
3771
  },
3741
3772
  properties: {
3742
- doc: "Returns the feature properties object. Note that in some cases, it may be more efficient to use `[\"get\", \"property_name\"]` directly.",
3773
+ doc: "Returns the feature properties object. Note that in some cases, it may be more efficient to use `[\"get\", \"property_name\"]` directly.",
3743
3774
  group: "Feature data",
3744
3775
  "sdk-support": {
3745
3776
  "basic functionality": {
@@ -3786,7 +3817,7 @@
3786
3817
  }
3787
3818
  },
3788
3819
  zoom: {
3789
- doc: "Returns the current zoom level. Note that in style layout and paint properties, [\"zoom\"] may only appear as the input to a top-level \"step\" or \"interpolate\" expression.",
3820
+ doc: "Returns the current zoom level. Note that in style layout and paint properties, [\"zoom\"] may only appear as the input to a top-level \"step\" or \"interpolate\" expression.",
3790
3821
  group: "Camera",
3791
3822
  "sdk-support": {
3792
3823
  "basic functionality": {
@@ -4576,6 +4607,34 @@
4576
4607
  ios: "10.6.0"
4577
4608
  }
4578
4609
  }
4610
+ },
4611
+ "vertical-range": {
4612
+ type: "array",
4613
+ "default": [
4614
+ 0,
4615
+ 0
4616
+ ],
4617
+ minimum: 0,
4618
+ length: 2,
4619
+ value: "number",
4620
+ "property-type": "data-constant",
4621
+ transition: true,
4622
+ expression: {
4623
+ interpolated: true,
4624
+ parameters: [
4625
+ "zoom",
4626
+ "measure-light"
4627
+ ],
4628
+ relaxZoomRestriction: true
4629
+ },
4630
+ doc: "An array of two number values, specifying the vertical range, measured in meters, over which the fog should gradually fade out. When both parameters are set to zero, the fog will be rendered without any vertical constraints.",
4631
+ "sdk-support": {
4632
+ "basic functionality": {
4633
+ js: "3.0.0",
4634
+ android: "11.0.0",
4635
+ ios: "11.0.0"
4636
+ }
4637
+ }
4579
4638
  }
4580
4639
  };
4581
4640
  var camera = {
@@ -5091,7 +5150,7 @@
5091
5150
  minimum: 0,
5092
5151
  transition: true,
5093
5152
  units: "intensity",
5094
- doc: "Emission strength",
5153
+ 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.",
5095
5154
  "sdk-support": {
5096
5155
  "basic functionality": {
5097
5156
  js: "3.0.0",
@@ -5423,7 +5482,28 @@
5423
5482
  },
5424
5483
  "line-gradient": {
5425
5484
  type: "color",
5426
- doc: "Defines a gradient with which to color a line feature. Can only be used with GeoJSON sources that specify `\"lineMetrics\": true`.",
5485
+ doc: "A gradient used to color a line feature at various distances along its length. Defined using a `step` or `interpolate` expression which outputs a color for each corresponding `line-progress` input value. `line-progress` is a percentage of the line feature's total length as measured on the webmercator projected coordinate plane (a `number` between `0` and `1`). Can only be used with GeoJSON sources that specify `\"lineMetrics\": true`.",
5486
+ example: [
5487
+ "interpolate",
5488
+ [
5489
+ "linear"
5490
+ ],
5491
+ [
5492
+ "line-progress"
5493
+ ],
5494
+ 0,
5495
+ "blue",
5496
+ 0.1,
5497
+ "royalblue",
5498
+ 0.3,
5499
+ "cyan",
5500
+ 0.5,
5501
+ "lime",
5502
+ 0.7,
5503
+ "yellow",
5504
+ 1,
5505
+ "red"
5506
+ ],
5427
5507
  transition: false,
5428
5508
  requires: [
5429
5509
  {
@@ -5496,7 +5576,7 @@
5496
5576
  minimum: 0,
5497
5577
  transition: true,
5498
5578
  units: "intensity",
5499
- doc: "Emission strength",
5579
+ 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.",
5500
5580
  "sdk-support": {
5501
5581
  "basic functionality": {
5502
5582
  js: "3.0.0",
@@ -5910,7 +5990,7 @@
5910
5990
  minimum: 0,
5911
5991
  transition: true,
5912
5992
  units: "intensity",
5913
- doc: "Emission strength",
5993
+ 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.",
5914
5994
  "sdk-support": {
5915
5995
  "basic functionality": {
5916
5996
  js: "3.0.0",
@@ -6037,7 +6117,7 @@
6037
6117
  1,
6038
6118
  "red"
6039
6119
  ],
6040
- doc: "Defines the color of each pixel based on its density value in a heatmap. Should be an expression that uses `[\"heatmap-density\"]` as input.",
6120
+ doc: "Defines the color of each pixel based on its density value in a heatmap. Should be an expression that uses `[\"heatmap-density\"]` as input.",
6041
6121
  transition: false,
6042
6122
  "sdk-support": {
6043
6123
  "basic functionality": {
@@ -6123,7 +6203,7 @@
6123
6203
  minimum: 0,
6124
6204
  transition: true,
6125
6205
  units: "intensity",
6126
- doc: "Emission strength",
6206
+ 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.",
6127
6207
  "sdk-support": {
6128
6208
  "basic functionality": {
6129
6209
  js: "3.0.0",
@@ -6151,7 +6231,7 @@
6151
6231
  minimum: 0,
6152
6232
  transition: true,
6153
6233
  units: "intensity",
6154
- doc: "Emission strength",
6234
+ 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.",
6155
6235
  "sdk-support": {
6156
6236
  "basic functionality": {
6157
6237
  js: "3.0.0",
@@ -6662,7 +6742,7 @@
6662
6742
  },
6663
6743
  "raster-color": {
6664
6744
  type: "color",
6665
- doc: "Defines a color map by which to colorize a raster layer, parameterized by the `[\"raster-value\"]` expression and evaluated at 1024 uniformly spaced steps over the range specified by `raster-color-range`.",
6745
+ doc: "Defines a color map by which to colorize a raster layer, parameterized by the `[\"raster-value\"]` expression and evaluated at 256 uniformly spaced steps over the range specified by `raster-color-range`.",
6666
6746
  transition: false,
6667
6747
  "sdk-support": {
6668
6748
  "basic functionality": {
@@ -6693,6 +6773,9 @@
6693
6773
  value: "number",
6694
6774
  "property-type": "data-constant",
6695
6775
  transition: true,
6776
+ requires: [
6777
+ "raster-color"
6778
+ ],
6696
6779
  expression: {
6697
6780
  interpolated: true,
6698
6781
  parameters: [
@@ -6724,6 +6807,9 @@
6724
6807
  value: "number",
6725
6808
  "property-type": "data-constant",
6726
6809
  transition: true,
6810
+ requires: [
6811
+ "raster-color"
6812
+ ],
6727
6813
  expression: {
6728
6814
  interpolated: true,
6729
6815
  parameters: [
@@ -7001,7 +7087,8 @@
7001
7087
  expression: {
7002
7088
  interpolated: true,
7003
7089
  parameters: [
7004
- "zoom"
7090
+ "zoom",
7091
+ "measure-light"
7005
7092
  ]
7006
7093
  },
7007
7094
  "property-type": "data-constant"
@@ -7022,7 +7109,8 @@
7022
7109
  expression: {
7023
7110
  interpolated: true,
7024
7111
  parameters: [
7025
- "zoom"
7112
+ "zoom",
7113
+ "measure-light"
7026
7114
  ]
7027
7115
  },
7028
7116
  "property-type": "data-constant"
@@ -7043,7 +7131,31 @@
7043
7131
  expression: {
7044
7132
  interpolated: true,
7045
7133
  parameters: [
7046
- "zoom"
7134
+ "zoom",
7135
+ "measure-light"
7136
+ ]
7137
+ },
7138
+ "property-type": "data-constant"
7139
+ },
7140
+ "hillshade-emissive-strength": {
7141
+ type: "number",
7142
+ "default": 0,
7143
+ minimum: 0,
7144
+ transition: true,
7145
+ units: "intensity",
7146
+ 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.",
7147
+ "sdk-support": {
7148
+ "basic functionality": {
7149
+ js: "3.0.0",
7150
+ android: "11.0.0",
7151
+ ios: "11.0.0"
7152
+ }
7153
+ },
7154
+ expression: {
7155
+ interpolated: true,
7156
+ parameters: [
7157
+ "zoom",
7158
+ "measure-light"
7047
7159
  ]
7048
7160
  },
7049
7161
  "property-type": "data-constant"
@@ -7125,7 +7237,7 @@
7125
7237
  minimum: 0,
7126
7238
  transition: true,
7127
7239
  units: "intensity",
7128
- doc: "Emission strength",
7240
+ 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.",
7129
7241
  "sdk-support": {
7130
7242
  "basic functionality": {
7131
7243
  js: "3.0.0",
@@ -7740,6 +7852,25 @@
7740
7852
  }
7741
7853
  },
7742
7854
  transition: true
7855
+ },
7856
+ "model-cutoff-fade-range": {
7857
+ type: "number",
7858
+ "default": 0,
7859
+ minimum: 0,
7860
+ maximum: 1,
7861
+ doc: "This parameter defines the range for the fade-out effect before an automatic content cutoff on pitched map views. The automatic cutoff range is calculated according to the minimum required zoom level of the source and layer. The fade range is expressed in relation to the height of the map view. A value of 1.0 indicates that the content is faded to the same extent as the map's height in pixels, while a value close to zero represents a sharp cutoff. When the value is set to 0.0, the cutoff is completely disabled. Note: The property has no effect on the map if terrain is enabled.",
7862
+ transition: false,
7863
+ expression: {
7864
+ interpolated: false
7865
+ },
7866
+ "sdk-support": {
7867
+ "basic functionality": {
7868
+ js: "3.0.0",
7869
+ android: "11.0.0",
7870
+ ios: "11.0.0"
7871
+ }
7872
+ },
7873
+ "property-type": "data-constant"
7743
7874
  }
7744
7875
  };
7745
7876
  var transition = {
@@ -8186,8 +8317,7 @@
8186
8317
  parameters: [
8187
8318
  "zoom",
8188
8319
  "feature",
8189
- "feature-state",
8190
- "measure-light"
8320
+ "feature-state"
8191
8321
  ]
8192
8322
  },
8193
8323
  "property-type": "data-driven"
@@ -8221,8 +8351,7 @@
8221
8351
  parameters: [
8222
8352
  "zoom",
8223
8353
  "feature",
8224
- "feature-state",
8225
- "measure-light"
8354
+ "feature-state"
8226
8355
  ]
8227
8356
  },
8228
8357
  "property-type": "data-driven"
@@ -8528,6 +8657,25 @@
8528
8657
  "zoom"
8529
8658
  ]
8530
8659
  }
8660
+ },
8661
+ "fill-extrusion-cutoff-fade-range": {
8662
+ type: "number",
8663
+ "default": 0,
8664
+ minimum: 0,
8665
+ maximum: 1,
8666
+ doc: "This parameter defines the range for the fade-out effect before an automatic content cutoff on pitched map views. The automatic cutoff range is calculated according to the minimum required zoom level of the source and layer. The fade range is expressed in relation to the height of the map view. A value of 1.0 indicates that the content is faded to the same extent as the map's height in pixels, while a value close to zero represents a sharp cutoff. When the value is set to 0.0, the cutoff is completely disabled. Note: The property has no effect on the map if terrain is enabled.",
8667
+ transition: false,
8668
+ expression: {
8669
+ interpolated: false
8670
+ },
8671
+ "sdk-support": {
8672
+ "basic functionality": {
8673
+ js: "3.0.0",
8674
+ android: "11.0.0",
8675
+ ios: "11.0.0"
8676
+ }
8677
+ },
8678
+ "property-type": "data-constant"
8531
8679
  }
8532
8680
  },
8533
8681
  paint_line: paint_line,
@@ -18429,7 +18577,15 @@ ${ JSON.stringify(filterExp, null, 2) }
18429
18577
  /*
18430
18578
  * { command: 'setProjection', args: [projectionProperties] }
18431
18579
  */
18432
- setProjection: 'setProjection'
18580
+ setProjection: 'setProjection',
18581
+ /*
18582
+ * { command: 'addImport', args: [importProperties] }
18583
+ */
18584
+ addImport: 'addImport',
18585
+ /*
18586
+ * { command: 'removeImport', args: [importId] }
18587
+ */
18588
+ removeImport: 'removeImport'
18433
18589
  };
18434
18590
  function addSource(sourceId, after, commands) {
18435
18591
  commands.push({
@@ -18692,6 +18848,21 @@ ${ JSON.stringify(filterExp, null, 2) }
18692
18848
  }
18693
18849
  }
18694
18850
  }
18851
+ function diffImports(before = [], after = [], commands) {
18852
+ // no diff for the imports, must remove then add
18853
+ for (const beforeImport of before) {
18854
+ commands.push({
18855
+ command: operations.removeImport,
18856
+ args: [beforeImport.id]
18857
+ });
18858
+ }
18859
+ for (const afterImport of after) {
18860
+ commands.push({
18861
+ command: operations.addImport,
18862
+ args: [afterImport]
18863
+ });
18864
+ }
18865
+ }
18695
18866
  /**
18696
18867
  * Diff two stylesheet
18697
18868
  *
@@ -18844,6 +19015,8 @@ ${ JSON.stringify(filterExp, null, 2) }
18844
19015
  }
18845
19016
  // Handle changes to `layers`
18846
19017
  diffLayers(beforeLayers, after.layers, commands);
19018
+ // Handle changes to `imports`
19019
+ diffImports(before.imports, after.imports, commands);
18847
19020
  } catch (e) {
18848
19021
  // fall back to setStyle
18849
19022
  console.warn('Unable to compute style diff:', e);