@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.
- package/CHANGELOG.md +10 -1
- package/dist/index.cjs +109 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +109 -13
- package/dist/index.es.js.map +1 -1
- package/expression/definitions/number_format.js +23 -3
- package/expression/evaluation_context.js +1 -1
- package/flow-typed/gl-matrix.js +1 -0
- package/package.json +2 -2
- package/reference/v8.json +72 -6
- package/types.js +5 -2
- package/validate/validate_layer.js +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
## 13.
|
|
1
|
+
## 13.26.0
|
|
2
|
+
|
|
3
|
+
### Features ✨
|
|
4
|
+
|
|
5
|
+
* Add unit option to number-format expression ([#11839](https://github.com/mapbox/mapbox-gl-js/pull/11839)) (h/t [varna](https://github.com/varna))
|
|
6
|
+
|
|
7
|
+
## Bug fixes 🐞
|
|
8
|
+
* Fix a bug where `id` expression didn't correctly handle a value of 0 ([#12000](https://github.com/mapbox/mapbox-gl-js/pull/12000))
|
|
9
|
+
|
|
10
|
+
## 13.25.0
|
|
2
11
|
|
|
3
12
|
### Features ✨
|
|
4
13
|
|
package/dist/index.cjs
CHANGED
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
},
|
|
102
102
|
projection: {
|
|
103
103
|
type: "projection",
|
|
104
|
-
doc: "The projection the map should be rendered in. Supported projections are Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic,
|
|
104
|
+
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.",
|
|
105
105
|
example: {
|
|
106
106
|
name: "albers",
|
|
107
107
|
center: [
|
|
@@ -2977,7 +2977,7 @@
|
|
|
2977
2977
|
}
|
|
2978
2978
|
},
|
|
2979
2979
|
"number-format": {
|
|
2980
|
-
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.",
|
|
2980
|
+
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.",
|
|
2981
2981
|
group: "Types",
|
|
2982
2982
|
"sdk-support": {
|
|
2983
2983
|
"basic functionality": {
|
|
@@ -3667,7 +3667,9 @@
|
|
|
3667
3667
|
"sdk-support": {
|
|
3668
3668
|
"basic functionality": {
|
|
3669
3669
|
js: "0.45.0",
|
|
3670
|
-
android: "6.6.0"
|
|
3670
|
+
android: "6.6.0",
|
|
3671
|
+
ios: "4.1.0",
|
|
3672
|
+
macos: "0.8.0"
|
|
3671
3673
|
}
|
|
3672
3674
|
}
|
|
3673
3675
|
},
|
|
@@ -4045,6 +4047,14 @@
|
|
|
4045
4047
|
length: 2,
|
|
4046
4048
|
value: "number",
|
|
4047
4049
|
"property-type": "data-constant",
|
|
4050
|
+
minimum: [
|
|
4051
|
+
-180,
|
|
4052
|
+
-90
|
|
4053
|
+
],
|
|
4054
|
+
maximum: [
|
|
4055
|
+
180,
|
|
4056
|
+
90
|
|
4057
|
+
],
|
|
4048
4058
|
transition: false,
|
|
4049
4059
|
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].",
|
|
4050
4060
|
example: [
|
|
@@ -4070,6 +4080,14 @@
|
|
|
4070
4080
|
length: 2,
|
|
4071
4081
|
value: "number",
|
|
4072
4082
|
"property-type": "data-constant",
|
|
4083
|
+
minimum: [
|
|
4084
|
+
-90,
|
|
4085
|
+
-90
|
|
4086
|
+
],
|
|
4087
|
+
maximum: [
|
|
4088
|
+
90,
|
|
4089
|
+
90
|
|
4090
|
+
],
|
|
4073
4091
|
transition: false,
|
|
4074
4092
|
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).",
|
|
4075
4093
|
example: [
|
|
@@ -4692,15 +4710,22 @@
|
|
|
4692
4710
|
"line-trim-offset": {
|
|
4693
4711
|
type: "array",
|
|
4694
4712
|
value: "number",
|
|
4695
|
-
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
|
|
4713
|
+
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].",
|
|
4696
4714
|
length: 2,
|
|
4697
4715
|
"default": [
|
|
4698
4716
|
0,
|
|
4699
4717
|
0
|
|
4700
4718
|
],
|
|
4719
|
+
minimum: [
|
|
4720
|
+
0,
|
|
4721
|
+
0
|
|
4722
|
+
],
|
|
4723
|
+
maximum: [
|
|
4724
|
+
1,
|
|
4725
|
+
1
|
|
4726
|
+
],
|
|
4701
4727
|
transition: false,
|
|
4702
4728
|
requires: [
|
|
4703
|
-
"line-gradient",
|
|
4704
4729
|
{
|
|
4705
4730
|
source: "geojson",
|
|
4706
4731
|
has: {
|
|
@@ -4710,7 +4735,7 @@
|
|
|
4710
4735
|
],
|
|
4711
4736
|
"sdk-support": {
|
|
4712
4737
|
"basic functionality": {
|
|
4713
|
-
js: "2.
|
|
4738
|
+
js: "2.9.0",
|
|
4714
4739
|
android: "10.5.0",
|
|
4715
4740
|
ios: "10.5.0",
|
|
4716
4741
|
macos: "10.5.0"
|
|
@@ -6371,6 +6396,20 @@
|
|
|
6371
6396
|
}
|
|
6372
6397
|
},
|
|
6373
6398
|
"property-type": "constant"
|
|
6399
|
+
},
|
|
6400
|
+
"fill-extrusion-edge-radius": {
|
|
6401
|
+
type: "number",
|
|
6402
|
+
"private": true,
|
|
6403
|
+
"default": 0,
|
|
6404
|
+
minimum: 0,
|
|
6405
|
+
maximum: 1,
|
|
6406
|
+
doc: "Radius of a fill extrusion edge in meters. If not zero, rounds extrusion edges for a smoother appearance.",
|
|
6407
|
+
"sdk-support": {
|
|
6408
|
+
"basic functionality": {
|
|
6409
|
+
js: "v2.10.0"
|
|
6410
|
+
}
|
|
6411
|
+
},
|
|
6412
|
+
"property-type": "constant"
|
|
6374
6413
|
}
|
|
6375
6414
|
},
|
|
6376
6415
|
layout_line: layout_line,
|
|
@@ -6698,6 +6737,51 @@
|
|
|
6698
6737
|
]
|
|
6699
6738
|
},
|
|
6700
6739
|
"property-type": "data-constant"
|
|
6740
|
+
},
|
|
6741
|
+
"fill-extrusion-ambient-occlusion-intensity": {
|
|
6742
|
+
"property-type": "data-constant",
|
|
6743
|
+
type: "number",
|
|
6744
|
+
"private": true,
|
|
6745
|
+
"default": 0,
|
|
6746
|
+
minimum: 0,
|
|
6747
|
+
maximum: 1,
|
|
6748
|
+
expression: {
|
|
6749
|
+
interpolated: true,
|
|
6750
|
+
parameters: [
|
|
6751
|
+
"zoom"
|
|
6752
|
+
]
|
|
6753
|
+
},
|
|
6754
|
+
transition: true,
|
|
6755
|
+
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.",
|
|
6756
|
+
"sdk-support": {
|
|
6757
|
+
"basic functionality": {
|
|
6758
|
+
js: "2.10.0",
|
|
6759
|
+
android: "10.7.0",
|
|
6760
|
+
ios: "10.7.0"
|
|
6761
|
+
}
|
|
6762
|
+
}
|
|
6763
|
+
},
|
|
6764
|
+
"fill-extrusion-ambient-occlusion-radius": {
|
|
6765
|
+
"property-type": "data-constant",
|
|
6766
|
+
type: "number",
|
|
6767
|
+
"private": true,
|
|
6768
|
+
"default": 3,
|
|
6769
|
+
minimum: 0,
|
|
6770
|
+
expression: {
|
|
6771
|
+
interpolated: true,
|
|
6772
|
+
parameters: [
|
|
6773
|
+
"zoom"
|
|
6774
|
+
]
|
|
6775
|
+
},
|
|
6776
|
+
transition: true,
|
|
6777
|
+
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.",
|
|
6778
|
+
"sdk-support": {
|
|
6779
|
+
"basic functionality": {
|
|
6780
|
+
js: "2.10.0",
|
|
6781
|
+
android: "10.7.0",
|
|
6782
|
+
ios: "10.7.0"
|
|
6783
|
+
}
|
|
6784
|
+
}
|
|
6701
6785
|
}
|
|
6702
6786
|
},
|
|
6703
6787
|
paint_line: paint_line,
|
|
@@ -9446,7 +9530,7 @@
|
|
|
9446
9530
|
this.featureDistanceData = null;
|
|
9447
9531
|
}
|
|
9448
9532
|
id() {
|
|
9449
|
-
return this.feature &&
|
|
9533
|
+
return this.feature && this.feature.id !== undefined ? this.feature.id : null;
|
|
9450
9534
|
}
|
|
9451
9535
|
geometryType() {
|
|
9452
9536
|
return this.feature ? typeof this.feature.type === 'number' ? geometryTypes[this.feature.type] : this.feature.type : null;
|
|
@@ -11380,11 +11464,12 @@
|
|
|
11380
11464
|
const GreaterThanOrEqual = makeComparison('>=', gteq, gteqCollate);
|
|
11381
11465
|
|
|
11382
11466
|
class NumberFormat {
|
|
11383
|
-
constructor(number, locale, currency, minFractionDigits, maxFractionDigits) {
|
|
11467
|
+
constructor(number, locale, currency, unit, minFractionDigits, maxFractionDigits) {
|
|
11384
11468
|
this.type = StringType;
|
|
11385
11469
|
this.number = number;
|
|
11386
11470
|
this.locale = locale;
|
|
11387
11471
|
this.currency = currency;
|
|
11472
|
+
this.unit = unit;
|
|
11388
11473
|
this.minFractionDigits = minFractionDigits;
|
|
11389
11474
|
this.maxFractionDigits = maxFractionDigits;
|
|
11390
11475
|
}
|
|
@@ -11409,6 +11494,12 @@
|
|
|
11409
11494
|
if (!currency)
|
|
11410
11495
|
return null;
|
|
11411
11496
|
}
|
|
11497
|
+
let unit = null;
|
|
11498
|
+
if (options['unit']) {
|
|
11499
|
+
unit = context.parse(options['unit'], 1, StringType);
|
|
11500
|
+
if (!unit)
|
|
11501
|
+
return null;
|
|
11502
|
+
}
|
|
11412
11503
|
let minFractionDigits = null;
|
|
11413
11504
|
if (options['min-fraction-digits']) {
|
|
11414
11505
|
minFractionDigits = context.parse(options['min-fraction-digits'], 1, NumberType);
|
|
@@ -11421,12 +11512,13 @@
|
|
|
11421
11512
|
if (!maxFractionDigits)
|
|
11422
11513
|
return null;
|
|
11423
11514
|
}
|
|
11424
|
-
return new NumberFormat(number, locale, currency, minFractionDigits, maxFractionDigits);
|
|
11515
|
+
return new NumberFormat(number, locale, currency, unit, minFractionDigits, maxFractionDigits);
|
|
11425
11516
|
}
|
|
11426
11517
|
evaluate(ctx) {
|
|
11427
11518
|
return new Intl.NumberFormat(this.locale ? this.locale.evaluate(ctx) : [], {
|
|
11428
|
-
style: this.currency
|
|
11519
|
+
style: this.currency && 'currency' || this.unit && 'unit' || 'decimal',
|
|
11429
11520
|
currency: this.currency ? this.currency.evaluate(ctx) : undefined,
|
|
11521
|
+
unit: this.unit ? this.unit.evaluate(ctx) : undefined,
|
|
11430
11522
|
minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(ctx) : undefined,
|
|
11431
11523
|
maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(ctx) : undefined
|
|
11432
11524
|
}).format(this.number.evaluate(ctx));
|
|
@@ -11439,6 +11531,9 @@
|
|
|
11439
11531
|
if (this.currency) {
|
|
11440
11532
|
fn(this.currency);
|
|
11441
11533
|
}
|
|
11534
|
+
if (this.unit) {
|
|
11535
|
+
fn(this.unit);
|
|
11536
|
+
}
|
|
11442
11537
|
if (this.minFractionDigits) {
|
|
11443
11538
|
fn(this.minFractionDigits);
|
|
11444
11539
|
}
|
|
@@ -11457,6 +11552,9 @@
|
|
|
11457
11552
|
if (this.currency) {
|
|
11458
11553
|
options['currency'] = this.currency.serialize();
|
|
11459
11554
|
}
|
|
11555
|
+
if (this.unit) {
|
|
11556
|
+
options['unit'] = this.unit.serialize();
|
|
11557
|
+
}
|
|
11460
11558
|
if (this.minFractionDigits) {
|
|
11461
11559
|
options['min-fraction-digits'] = this.minFractionDigits.serialize();
|
|
11462
11560
|
}
|
|
@@ -14481,10 +14579,8 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
14481
14579
|
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" must specify a "source-layer"`));
|
|
14482
14580
|
} else if (sourceType === 'raster-dem' && type !== 'hillshade') {
|
|
14483
14581
|
errors.push(new ValidationError(key, layer.source, 'raster-dem source can only be used with layer type \'hillshade\'.'));
|
|
14484
|
-
} else if (type === 'line' && layer.paint && layer.paint['line-gradient'] && (sourceType !== 'geojson' || !source.lineMetrics)) {
|
|
14582
|
+
} else if (type === 'line' && layer.paint && (layer.paint['line-gradient'] || layer.paint['line-trim-offset']) && (sourceType !== 'geojson' || !source.lineMetrics)) {
|
|
14485
14583
|
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
|
|
14486
|
-
} else if (type === 'line' && layer.paint && layer.paint['line-trim-offset'] && !layer.paint['line-gradient']) {
|
|
14487
|
-
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-trim-offset, which requires line-gradient enabled.`));
|
|
14488
14584
|
}
|
|
14489
14585
|
}
|
|
14490
14586
|
}
|