@mapbox/mapbox-gl-style-spec 13.25.0 → 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",
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
@@ -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
  },
@@ -4655,6 +4671,51 @@
4655
4671
  ]
4656
4672
  },
4657
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
+ }
4658
4719
  }
4659
4720
  },
4660
4721
  "paint_line": {
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