@mapbox/mapbox-gl-style-spec 13.25.0-beta.1 → 13.26.0

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.
@@ -28,8 +28,9 @@ declare class Intl$NumberFormat {
28
28
  }
29
29
 
30
30
  type NumberFormatOptions = {
31
- style?: 'decimal' | 'currency' | 'percent';
31
+ style?: 'decimal' | 'currency' | 'percent' | 'unit';
32
32
  currency?: null | string;
33
+ unit?: null | string;
33
34
  minimumFractionDigits?: null | string;
34
35
  maximumFractionDigits?: null | string;
35
36
  };
@@ -39,18 +40,21 @@ export default class NumberFormat implements Expression {
39
40
  number: Expression;
40
41
  locale: Expression | null; // BCP 47 language tag
41
42
  currency: Expression | null; // ISO 4217 currency code, required if style=currency
43
+ unit: Expression | null; // Simple units sanctioned for use in ECMAScript, required if style=unit. https://tc39.es/proposal-unified-intl-numberformat/section6/locales-currencies-tz_proposed_out.html#sec-issanctionedsimpleunitidentifier
42
44
  minFractionDigits: Expression | null; // Default 0
43
45
  maxFractionDigits: Expression | null; // Default 3
44
46
 
45
47
  constructor(number: Expression,
46
48
  locale: Expression | null,
47
49
  currency: Expression | null,
50
+ unit: Expression | null,
48
51
  minFractionDigits: Expression | null,
49
52
  maxFractionDigits: Expression | null) {
50
53
  this.type = StringType;
51
54
  this.number = number;
52
55
  this.locale = locale;
53
56
  this.currency = currency;
57
+ this.unit = unit;
54
58
  this.minFractionDigits = minFractionDigits;
55
59
  this.maxFractionDigits = maxFractionDigits;
56
60
  }
@@ -78,6 +82,12 @@ export default class NumberFormat implements Expression {
78
82
  if (!currency) return null;
79
83
  }
80
84
 
85
+ let unit = null;
86
+ if (options['unit']) {
87
+ unit = context.parse(options['unit'], 1, StringType);
88
+ if (!unit) return null;
89
+ }
90
+
81
91
  let minFractionDigits = null;
82
92
  if (options['min-fraction-digits']) {
83
93
  minFractionDigits = context.parse(options['min-fraction-digits'], 1, NumberType);
@@ -90,14 +100,18 @@ export default class NumberFormat implements Expression {
90
100
  if (!maxFractionDigits) return null;
91
101
  }
92
102
 
93
- return new NumberFormat(number, locale, currency, minFractionDigits, maxFractionDigits);
103
+ return new NumberFormat(number, locale, currency, unit, minFractionDigits, maxFractionDigits);
94
104
  }
95
105
 
96
106
  evaluate(ctx: EvaluationContext): string {
97
107
  return new Intl.NumberFormat(this.locale ? this.locale.evaluate(ctx) : [],
98
108
  {
99
- style: this.currency ? "currency" : "decimal",
109
+ style:
110
+ (this.currency && "currency") ||
111
+ (this.unit && "unit") ||
112
+ "decimal",
100
113
  currency: this.currency ? this.currency.evaluate(ctx) : undefined,
114
+ unit: this.unit ? this.unit.evaluate(ctx) : undefined,
101
115
  minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(ctx) : undefined,
102
116
  maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(ctx) : undefined,
103
117
  }).format(this.number.evaluate(ctx));
@@ -111,6 +125,9 @@ export default class NumberFormat implements Expression {
111
125
  if (this.currency) {
112
126
  fn(this.currency);
113
127
  }
128
+ if (this.unit) {
129
+ fn(this.unit);
130
+ }
114
131
  if (this.minFractionDigits) {
115
132
  fn(this.minFractionDigits);
116
133
  }
@@ -131,6 +148,9 @@ export default class NumberFormat implements Expression {
131
148
  if (this.currency) {
132
149
  options['currency'] = this.currency.serialize();
133
150
  }
151
+ if (this.unit) {
152
+ options['unit'] = this.unit.serialize();
153
+ }
134
154
  if (this.minFractionDigits) {
135
155
  options['min-fraction-digits'] = this.minFractionDigits.serialize();
136
156
  }
@@ -35,7 +35,7 @@ class EvaluationContext {
35
35
  }
36
36
 
37
37
  id(): number | null {
38
- return this.feature && 'id' in this.feature && this.feature.id ? this.feature.id : null;
38
+ return this.feature && this.feature.id !== undefined ? this.feature.id : null;
39
39
  }
40
40
 
41
41
  geometryType(): null | string {
@@ -77,6 +77,7 @@ declare module "gl-matrix" {
77
77
  create(): Float32Array,
78
78
 
79
79
  fromScaling<T: Mat4>(T, Vec3): T,
80
+ fromTranslation<T: Mat4>(T, Vec3): T,
80
81
  fromQuat<T: Mat4>(T, Quat): T,
81
82
  ortho<T: Mat4>(T, number, number, number, number, number, number): T,
82
83
  perspective<T: Mat4>(T, number, number, number, number): T,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mapbox/mapbox-gl-style-spec",
3
3
  "description": "a specification for mapbox gl styles",
4
- "version": "13.25.0-beta.1",
4
+ "version": "13.26.0",
5
5
  "author": "Mapbox",
6
6
  "keywords": [
7
7
  "mapbox",
@@ -45,7 +45,7 @@
45
45
  "@mapbox/unitbezier": "^0.0.0",
46
46
  "csscolorparser": "~1.0.2",
47
47
  "json-stringify-pretty-compact": "^2.0.0",
48
- "minimist": "^1.2.5",
48
+ "minimist": "^1.2.6",
49
49
  "rw": "^1.3.3",
50
50
  "sort-object": "^0.3.2"
51
51
  },
package/reference/v8.json CHANGED
@@ -96,7 +96,7 @@
96
96
  },
97
97
  "projection": {
98
98
  "type": "projection",
99
- "doc": "The projection the map should be rendered in. Supported projections are Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Mercator, Natural Earth, Globe, and Winkel Tripel. Terrain, fog, sky and CustomLayerInterface are not supported for projections other than mercator.",
99
+ "doc": "The projection the map should be rendered in. Supported projections are Mercator, Globe, Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Natural Earth, and Winkel Tripel. Terrain, sky and fog are supported by only Mercator and globe. CustomLayerInterface is not supported outside of Mercator.",
100
100
  "example": {
101
101
  "name": "albers",
102
102
  "center": [-154, 50],
@@ -877,6 +877,20 @@
877
877
  }
878
878
  },
879
879
  "property-type": "constant"
880
+ },
881
+ "fill-extrusion-edge-radius": {
882
+ "type": "number",
883
+ "private": true,
884
+ "default": 0,
885
+ "minimum": 0,
886
+ "maximum": 1,
887
+ "doc": "Radius of a fill extrusion edge in meters. If not zero, rounds extrusion edges for a smoother appearance.",
888
+ "sdk-support": {
889
+ "basic functionality": {
890
+ "js": "v2.10.0"
891
+ }
892
+ },
893
+ "property-type": "constant"
880
894
  }
881
895
  },
882
896
  "layout_line": {
@@ -3046,7 +3060,7 @@
3046
3060
  }
3047
3061
  },
3048
3062
  "number-format": {
3049
- "doc": "Converts the input number into a string representation using the providing formatting rules. If set, the `locale` argument specifies the locale to use, as a BCP 47 language tag. If set, the `currency` argument specifies an ISO 4217 code to use for currency-style formatting. If set, the `min-fraction-digits` and `max-fraction-digits` arguments specify the minimum and maximum number of fractional digits to include.",
3063
+ "doc": "Converts the input number into a string representation using the providing formatting rules. If set, the `locale` argument specifies the locale to use, as a BCP 47 language tag. If set, the `currency` argument specifies an ISO 4217 code to use for currency-style formatting. If set, the `unit` argument specifies a [simple ECMAScript unit](https://tc39.es/proposal-unified-intl-numberformat/section6/locales-currencies-tz_proposed_out.html#sec-issanctionedsimpleunitidentifier) to use for unit-style formatting. If set, the `min-fraction-digits` and `max-fraction-digits` arguments specify the minimum and maximum number of fractional digits to include.",
3050
3064
  "group": "Types",
3051
3065
  "sdk-support": {
3052
3066
  "basic functionality": {
@@ -3736,7 +3750,9 @@
3736
3750
  "sdk-support": {
3737
3751
  "basic functionality": {
3738
3752
  "js": "0.45.0",
3739
- "android": "6.6.0"
3753
+ "android": "6.6.0",
3754
+ "ios": "4.1.0",
3755
+ "macos": "0.8.0"
3740
3756
  }
3741
3757
  }
3742
3758
  },
@@ -4118,6 +4134,8 @@
4118
4134
  "length": 2,
4119
4135
  "value": "number",
4120
4136
  "property-type": "data-constant",
4137
+ "minimum": [-180, -90],
4138
+ "maximum": [180, 90],
4121
4139
  "transition": false,
4122
4140
  "doc": "The reference longitude and latitude of the projection. `center` takes the form of [lng, lat]. This property is only configurable for conic projections (Albers and Lambert Conformal Conic). All other projections are centered on [0, 0].",
4123
4141
  "example": [
@@ -4143,6 +4161,8 @@
4143
4161
  "length": 2,
4144
4162
  "value": "number",
4145
4163
  "property-type": "data-constant",
4164
+ "minimum": [-90, -90],
4165
+ "maximum": [90, 90],
4146
4166
  "transition": false,
4147
4167
  "doc": "The standard parallels of the projection, denoting the desired latitude range with minimal distortion. `parallels` takes the form of [lat0, lat1]. This property is only configurable for conic projections (Albers and Lambert Conformal Conic).",
4148
4168
  "example": [
@@ -4651,6 +4671,51 @@
4651
4671
  ]
4652
4672
  },
4653
4673
  "property-type": "data-constant"
4674
+ },
4675
+ "fill-extrusion-ambient-occlusion-intensity": {
4676
+ "property-type": "data-constant",
4677
+ "type": "number",
4678
+ "private": true,
4679
+ "default": 0.0,
4680
+ "minimum": 0,
4681
+ "maximum": 1,
4682
+ "expression": {
4683
+ "interpolated": true,
4684
+ "parameters": [
4685
+ "zoom"
4686
+ ]
4687
+ },
4688
+ "transition": true,
4689
+ "doc": "Controls the intensity of ambient occlusion (AO) shading. Current AO implementation is a low-cost best-effort approach that shades area near ground and concave angles between walls. Default value 0.0 disables ambient occlusion and values around 0.3 provide the most plausible results for buildings.",
4690
+ "sdk-support": {
4691
+ "basic functionality": {
4692
+ "js": "2.10.0",
4693
+ "android": "10.7.0",
4694
+ "ios": "10.7.0"
4695
+ }
4696
+ }
4697
+ },
4698
+ "fill-extrusion-ambient-occlusion-radius": {
4699
+ "property-type": "data-constant",
4700
+ "type": "number",
4701
+ "private": true,
4702
+ "default": 3.0,
4703
+ "minimum": 0,
4704
+ "expression": {
4705
+ "interpolated": true,
4706
+ "parameters": [
4707
+ "zoom"
4708
+ ]
4709
+ },
4710
+ "transition": true,
4711
+ "doc": "The radius of ambient occlusion (AO) shading, in meters. Current AO implementation is a low-cost best-effort approach that shades area near ground and concave angles between walls where the radius defines only vertical impact. Default value 3.0 corresponds to hight of one floor and brings the most plausible results for buildings.",
4712
+ "sdk-support": {
4713
+ "basic functionality": {
4714
+ "js": "2.10.0",
4715
+ "android": "10.7.0",
4716
+ "ios": "10.7.0"
4717
+ }
4718
+ }
4654
4719
  }
4655
4720
  },
4656
4721
  "paint_line": {
@@ -4994,12 +5059,13 @@
4994
5059
  "line-trim-offset": {
4995
5060
  "type": "array",
4996
5061
  "value": "number",
4997
- "doc": "The line part between [trim-start, trim-end] will be marked as transparent to make a route vanishing effect. The line trim-off offset is based on the whole line gradient range [0.0, 1.0]. If either 'trim-start' or 'trim-end' offset is out of valid range, the default range will be set.",
5062
+ "doc": "The line part between [trim-start, trim-end] will be marked as transparent to make a route vanishing effect. The line trim-off offset is based on the whole line range [0.0, 1.0].",
4998
5063
  "length": 2,
4999
5064
  "default": [0.0, 0.0],
5065
+ "minimum": [0.0, 0.0],
5066
+ "maximum": [1.0, 1.0],
5000
5067
  "transition": false,
5001
5068
  "requires": [
5002
- "line-gradient",
5003
5069
  {
5004
5070
  "source": "geojson",
5005
5071
  "has": {
@@ -5009,7 +5075,7 @@
5009
5075
  ],
5010
5076
  "sdk-support": {
5011
5077
  "basic functionality": {
5012
- "js": "2.3.0",
5078
+ "js": "2.9.0",
5013
5079
  "android": "10.5.0",
5014
5080
  "ios": "10.5.0",
5015
5081
  "macos": "10.5.0"
package/types.js CHANGED
@@ -367,7 +367,8 @@ export type FillExtrusionLayerSpecification = {|
367
367
  "maxzoom"?: number,
368
368
  "filter"?: FilterSpecification,
369
369
  "layout"?: {|
370
- "visibility"?: "visible" | "none"
370
+ "visibility"?: "visible" | "none",
371
+ "fill-extrusion-edge-radius"?: number
371
372
  |},
372
373
  "paint"?: {|
373
374
  "fill-extrusion-opacity"?: PropertyValueSpecification<number>,
@@ -377,7 +378,9 @@ export type FillExtrusionLayerSpecification = {|
377
378
  "fill-extrusion-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>,
378
379
  "fill-extrusion-height"?: DataDrivenPropertyValueSpecification<number>,
379
380
  "fill-extrusion-base"?: DataDrivenPropertyValueSpecification<number>,
380
- "fill-extrusion-vertical-gradient"?: PropertyValueSpecification<boolean>
381
+ "fill-extrusion-vertical-gradient"?: PropertyValueSpecification<boolean>,
382
+ "fill-extrusion-ambient-occlusion-intensity"?: PropertyValueSpecification<number>,
383
+ "fill-extrusion-ambient-occlusion-radius"?: PropertyValueSpecification<number>
381
384
  |}
382
385
  |}
383
386
 
@@ -79,11 +79,9 @@ export default function validateLayer(options: Options): Array<ValidationError>
79
79
  errors.push(new ValidationError(key, layer, `layer "${layer.id}" must specify a "source-layer"`));
80
80
  } else if (sourceType === 'raster-dem' && type !== 'hillshade') {
81
81
  errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \'hillshade\'.'));
82
- } else if (type === 'line' && layer.paint && layer.paint['line-gradient'] &&
82
+ } else if (type === 'line' && layer.paint && (layer.paint['line-gradient'] || layer.paint['line-trim-offset']) &&
83
83
  (sourceType !== 'geojson' || !source.lineMetrics)) {
84
84
  errors.push(new ValidationError(key, layer, `layer "${layer.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
85
- } else if (type === 'line' && layer.paint && layer.paint['line-trim-offset'] && !layer.paint['line-gradient']) {
86
- errors.push(new ValidationError(key, layer, `layer "${layer.id}" specifies a line-trim-offset, which requires line-gradient enabled.`));
87
85
  }
88
86
  }
89
87
  }