@mapbox/mapbox-gl-style-spec 14.14.0-beta.2 → 14.14.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/composite.ts +5 -8
- package/dist/index.cjs +31 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +37 -15
- package/dist/index.es.js +31 -9
- package/dist/index.es.js.map +1 -1
- package/expression/definitions/distance.ts +2 -3
- package/expression/definitions/index.ts +4 -20
- package/expression/definitions/interpolate.ts +6 -9
- package/expression/definitions/within.ts +14 -15
- package/expression/index.ts +2 -4
- package/group_by_layout.ts +3 -6
- package/migrate.ts +6 -8
- package/package.json +1 -1
- package/read_style.ts +1 -2
- package/reference/v8.json +25 -0
- package/types.ts +34 -13
- package/util/geometry_util.ts +1 -2
- package/validate/validate.ts +5 -6
- package/validate/validate_array.ts +2 -2
- package/validate/validate_enum.ts +2 -2
- package/validate/validate_expression.ts +1 -2
- package/validate/validate_filter.ts +3 -4
- package/validate/validate_fog.ts +2 -5
- package/validate/validate_function.ts +6 -10
- package/validate/validate_iconset.ts +1 -2
- package/validate/validate_layer.ts +1 -2
- package/validate/validate_light.ts +1 -4
- package/validate/validate_lights.ts +1 -7
- package/validate/validate_model.ts +1 -4
- package/validate/validate_projection.ts +1 -2
- package/validate/validate_property.ts +2 -6
- package/validate/validate_rain.ts +1 -4
- package/validate/validate_snow.ts +1 -4
- package/validate/validate_source.ts +2 -3
- package/validate/validate_terrain.ts +1 -5
- package/validate_mapbox_api_supported.ts +2 -4
- package/validate_style.ts +1 -2
- package/visit.ts +2 -4
package/dist/index.d.ts
CHANGED
|
@@ -24,21 +24,6 @@ declare const _default: StyleReference;
|
|
|
24
24
|
* fs.writeFileSync('./dest.min.json', format(style, 0));
|
|
25
25
|
*/
|
|
26
26
|
export declare function format(style: any, space?: number): string;
|
|
27
|
-
/**
|
|
28
|
-
* Migrate a Mapbox GL Style to the latest version.
|
|
29
|
-
*
|
|
30
|
-
* @private
|
|
31
|
-
* @alias migrate
|
|
32
|
-
* @param {object} style a Mapbox GL Style
|
|
33
|
-
* @returns {Object} a migrated style
|
|
34
|
-
* @example
|
|
35
|
-
* var fs = require('fs');
|
|
36
|
-
* var migrate = require('mapbox-gl-style-spec').migrate;
|
|
37
|
-
* var style = fs.readFileSync('./style.json', 'utf8');
|
|
38
|
-
* fs.writeFileSync('./style.json', JSON.stringify(migrate(style)));
|
|
39
|
-
*/
|
|
40
|
-
declare function _default$1(style: any): any;
|
|
41
|
-
declare function _default$2(style: any): any;
|
|
42
27
|
type ColorSpecification = string;
|
|
43
28
|
type FormattedSpecification = string;
|
|
44
29
|
type ResolvedImageSpecification = string;
|
|
@@ -479,6 +464,11 @@ type SelectorPropertySpecification = {
|
|
|
479
464
|
*/
|
|
480
465
|
[_: string]: unknown;
|
|
481
466
|
};
|
|
467
|
+
type AppearanceSpecification = {
|
|
468
|
+
"condition"?: ExpressionSpecification;
|
|
469
|
+
"name"?: string;
|
|
470
|
+
"properties"?: unknown;
|
|
471
|
+
};
|
|
482
472
|
type VectorSourceSpecification = {
|
|
483
473
|
"type": "vector";
|
|
484
474
|
"url"?: string;
|
|
@@ -778,6 +768,7 @@ type FillLayerSpecification = {
|
|
|
778
768
|
"fill-tunnel-structure-color-transition"?: TransitionSpecification;
|
|
779
769
|
"fill-tunnel-structure-color-use-theme"?: PropertyValueSpecification<string>;
|
|
780
770
|
};
|
|
771
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
781
772
|
};
|
|
782
773
|
type LineLayerSpecification = {
|
|
783
774
|
"id": string;
|
|
@@ -865,6 +856,7 @@ type LineLayerSpecification = {
|
|
|
865
856
|
"line-occlusion-opacity"?: PropertyValueSpecification<number>;
|
|
866
857
|
"line-occlusion-opacity-transition"?: TransitionSpecification;
|
|
867
858
|
};
|
|
859
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
868
860
|
};
|
|
869
861
|
type SymbolLayerSpecification = {
|
|
870
862
|
"id": string;
|
|
@@ -1000,6 +992,7 @@ type SymbolLayerSpecification = {
|
|
|
1000
992
|
"symbol-z-offset"?: DataDrivenPropertyValueSpecification<number>;
|
|
1001
993
|
"symbol-z-offset-transition"?: TransitionSpecification;
|
|
1002
994
|
};
|
|
995
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
1003
996
|
};
|
|
1004
997
|
type CircleLayerSpecification = {
|
|
1005
998
|
"id": string;
|
|
@@ -1047,6 +1040,7 @@ type CircleLayerSpecification = {
|
|
|
1047
1040
|
"circle-emissive-strength"?: PropertyValueSpecification<number>;
|
|
1048
1041
|
"circle-emissive-strength-transition"?: TransitionSpecification;
|
|
1049
1042
|
};
|
|
1043
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
1050
1044
|
};
|
|
1051
1045
|
type HeatmapLayerSpecification = {
|
|
1052
1046
|
"id": string;
|
|
@@ -1072,6 +1066,7 @@ type HeatmapLayerSpecification = {
|
|
|
1072
1066
|
"heatmap-opacity"?: PropertyValueSpecification<number>;
|
|
1073
1067
|
"heatmap-opacity-transition"?: TransitionSpecification;
|
|
1074
1068
|
};
|
|
1069
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
1075
1070
|
};
|
|
1076
1071
|
type FillExtrusionLayerSpecification = {
|
|
1077
1072
|
"id": string;
|
|
@@ -1181,6 +1176,7 @@ type FillExtrusionLayerSpecification = {
|
|
|
1181
1176
|
"fill-extrusion-line-width-transition"?: TransitionSpecification;
|
|
1182
1177
|
"fill-extrusion-cast-shadows"?: boolean;
|
|
1183
1178
|
};
|
|
1179
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
1184
1180
|
};
|
|
1185
1181
|
type BuildingLayerSpecification = {
|
|
1186
1182
|
"id": string;
|
|
@@ -1274,6 +1270,7 @@ type BuildingLayerSpecification = {
|
|
|
1274
1270
|
"building-facade-emissive-chance"?: PropertyValueSpecification<number>;
|
|
1275
1271
|
"building-cutoff-fade-range"?: ExpressionSpecification;
|
|
1276
1272
|
};
|
|
1273
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
1277
1274
|
};
|
|
1278
1275
|
type RasterLayerSpecification = {
|
|
1279
1276
|
"id": string;
|
|
@@ -1329,6 +1326,7 @@ type RasterLayerSpecification = {
|
|
|
1329
1326
|
"raster-elevation"?: PropertyValueSpecification<number>;
|
|
1330
1327
|
"raster-elevation-transition"?: TransitionSpecification;
|
|
1331
1328
|
};
|
|
1329
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
1332
1330
|
};
|
|
1333
1331
|
type RasterParticleLayerSpecification = {
|
|
1334
1332
|
"id": string;
|
|
@@ -1357,6 +1355,7 @@ type RasterParticleLayerSpecification = {
|
|
|
1357
1355
|
"raster-particle-elevation"?: PropertyValueSpecification<number>;
|
|
1358
1356
|
"raster-particle-elevation-transition"?: TransitionSpecification;
|
|
1359
1357
|
};
|
|
1358
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
1360
1359
|
};
|
|
1361
1360
|
type HillshadeLayerSpecification = {
|
|
1362
1361
|
"id": string;
|
|
@@ -1388,6 +1387,7 @@ type HillshadeLayerSpecification = {
|
|
|
1388
1387
|
"hillshade-emissive-strength"?: PropertyValueSpecification<number>;
|
|
1389
1388
|
"hillshade-emissive-strength-transition"?: TransitionSpecification;
|
|
1390
1389
|
};
|
|
1390
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
1391
1391
|
};
|
|
1392
1392
|
type ModelLayerSpecification = {
|
|
1393
1393
|
"id": string;
|
|
@@ -1453,6 +1453,7 @@ type ModelLayerSpecification = {
|
|
|
1453
1453
|
number
|
|
1454
1454
|
]>;
|
|
1455
1455
|
};
|
|
1456
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
1456
1457
|
};
|
|
1457
1458
|
type BackgroundLayerSpecification = {
|
|
1458
1459
|
"id": string;
|
|
@@ -1481,6 +1482,7 @@ type BackgroundLayerSpecification = {
|
|
|
1481
1482
|
"background-emissive-strength"?: PropertyValueSpecification<number>;
|
|
1482
1483
|
"background-emissive-strength-transition"?: TransitionSpecification;
|
|
1483
1484
|
};
|
|
1485
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
1484
1486
|
};
|
|
1485
1487
|
type SkyLayerSpecification = {
|
|
1486
1488
|
"id": string;
|
|
@@ -1516,6 +1518,7 @@ type SkyLayerSpecification = {
|
|
|
1516
1518
|
"sky-opacity"?: PropertyValueSpecification<number>;
|
|
1517
1519
|
"sky-opacity-transition"?: TransitionSpecification;
|
|
1518
1520
|
};
|
|
1521
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
1519
1522
|
};
|
|
1520
1523
|
type SlotLayerSpecification = {
|
|
1521
1524
|
"id": string;
|
|
@@ -1527,6 +1530,7 @@ type SlotLayerSpecification = {
|
|
|
1527
1530
|
"minzoom"?: never;
|
|
1528
1531
|
"maxzoom"?: never;
|
|
1529
1532
|
"filter"?: never;
|
|
1533
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
1530
1534
|
"layout"?: never;
|
|
1531
1535
|
"paint"?: never;
|
|
1532
1536
|
};
|
|
@@ -1544,9 +1548,27 @@ type ClipLayerSpecification = {
|
|
|
1544
1548
|
"clip-layer-types"?: ExpressionSpecification;
|
|
1545
1549
|
"clip-layer-scope"?: ExpressionSpecification;
|
|
1546
1550
|
};
|
|
1551
|
+
"appearances"?: Array<AppearanceSpecification>;
|
|
1547
1552
|
"paint"?: never;
|
|
1548
1553
|
};
|
|
1549
1554
|
type LayerSpecification = FillLayerSpecification | LineLayerSpecification | SymbolLayerSpecification | CircleLayerSpecification | HeatmapLayerSpecification | FillExtrusionLayerSpecification | BuildingLayerSpecification | RasterLayerSpecification | RasterParticleLayerSpecification | HillshadeLayerSpecification | ModelLayerSpecification | BackgroundLayerSpecification | SkyLayerSpecification | SlotLayerSpecification | ClipLayerSpecification;
|
|
1555
|
+
/**
|
|
1556
|
+
* Migrate a Mapbox GL Style to the latest version.
|
|
1557
|
+
*
|
|
1558
|
+
* @private
|
|
1559
|
+
* @alias migrate
|
|
1560
|
+
* @param {object} style a Mapbox GL Style
|
|
1561
|
+
* @returns {Object} a migrated style
|
|
1562
|
+
* @example
|
|
1563
|
+
* var fs = require('fs');
|
|
1564
|
+
* var migrate = require('mapbox-gl-style-spec').migrate;
|
|
1565
|
+
* var style = fs.readFileSync('./style.json', 'utf8');
|
|
1566
|
+
* fs.writeFileSync('./style.json', JSON.stringify(migrate(style)));
|
|
1567
|
+
*/
|
|
1568
|
+
declare function _default$1(style: {
|
|
1569
|
+
version: 7;
|
|
1570
|
+
} | StyleSpecification): StyleSpecification;
|
|
1571
|
+
declare function _default$2(style: StyleSpecification): StyleSpecification;
|
|
1550
1572
|
/**
|
|
1551
1573
|
* Given an array of layers, some of which may contain `ref` properties
|
|
1552
1574
|
* whose value is the `id` of another property, return a new array where
|
package/dist/index.es.js
CHANGED
|
@@ -1507,6 +1507,29 @@ var layer = {
|
|
|
1507
1507
|
paint: {
|
|
1508
1508
|
type: "paint",
|
|
1509
1509
|
doc: "Default paint properties for this layer."
|
|
1510
|
+
},
|
|
1511
|
+
appearances: {
|
|
1512
|
+
type: "array",
|
|
1513
|
+
value: "appearance",
|
|
1514
|
+
"supported-layer-types": [
|
|
1515
|
+
"symbol"
|
|
1516
|
+
],
|
|
1517
|
+
"private": true,
|
|
1518
|
+
doc: "Conditional styling applied to layer features based on dynamic conditions. If multiple conditions are true, only the first matching appearance will be applied. Only properties marked with 'Can be used in appearances' are supported."
|
|
1519
|
+
}
|
|
1520
|
+
};
|
|
1521
|
+
var appearance = {
|
|
1522
|
+
condition: {
|
|
1523
|
+
type: "expression",
|
|
1524
|
+
doc: "A boolean expression that determines when this appearance should be applied."
|
|
1525
|
+
},
|
|
1526
|
+
name: {
|
|
1527
|
+
type: "string",
|
|
1528
|
+
doc: "Optional name for this appearance. Non-empty names should be unique within a layer."
|
|
1529
|
+
},
|
|
1530
|
+
properties: {
|
|
1531
|
+
type: "*",
|
|
1532
|
+
doc: "Style properties to apply when the condition is met."
|
|
1510
1533
|
}
|
|
1511
1534
|
};
|
|
1512
1535
|
var layout = [
|
|
@@ -2698,6 +2721,7 @@ var layout_symbol = {
|
|
|
2698
2721
|
minimum: 0,
|
|
2699
2722
|
units: "factor of the original icon size",
|
|
2700
2723
|
doc: "Scales the original size of the icon by the provided factor. The new pixel size of the image will be the original pixel size multiplied by `icon-size`. 1 is the original size; 3 triples the size of the image.",
|
|
2724
|
+
appearance: true,
|
|
2701
2725
|
requires: [
|
|
2702
2726
|
"icon-image"
|
|
2703
2727
|
],
|
|
@@ -2841,6 +2865,7 @@ var layout_symbol = {
|
|
|
2841
2865
|
type: "resolvedImage",
|
|
2842
2866
|
doc: "Name of image in sprite to use for drawing an image background.",
|
|
2843
2867
|
tokens: true,
|
|
2868
|
+
appearance: true,
|
|
2844
2869
|
"sdk-support": {
|
|
2845
2870
|
"basic functionality": {
|
|
2846
2871
|
js: "0.10.0",
|
|
@@ -2868,6 +2893,7 @@ var layout_symbol = {
|
|
|
2868
2893
|
period: 360,
|
|
2869
2894
|
units: "degrees",
|
|
2870
2895
|
doc: "Rotates the icon clockwise.",
|
|
2896
|
+
appearance: true,
|
|
2871
2897
|
requires: [
|
|
2872
2898
|
"icon-image"
|
|
2873
2899
|
],
|
|
@@ -2956,6 +2982,7 @@ var layout_symbol = {
|
|
|
2956
2982
|
0
|
|
2957
2983
|
],
|
|
2958
2984
|
doc: "Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. Each component is multiplied by the value of `icon-size` to obtain the final offset in pixels. When combined with `icon-rotate` the offset will be as if the rotated direction was up.",
|
|
2985
|
+
appearance: true,
|
|
2959
2986
|
requires: [
|
|
2960
2987
|
"icon-image"
|
|
2961
2988
|
],
|
|
@@ -10182,6 +10209,7 @@ var v8 = {
|
|
|
10182
10209
|
source_image: source_image,
|
|
10183
10210
|
source_model: source_model,
|
|
10184
10211
|
layer: layer,
|
|
10212
|
+
appearance: appearance,
|
|
10185
10213
|
layout: layout,
|
|
10186
10214
|
layout_background: layout_background,
|
|
10187
10215
|
layout_sky: layout_sky,
|
|
@@ -18000,7 +18028,6 @@ CompoundExpression.register(expressions, {
|
|
|
18000
18028
|
overloads: [
|
|
18001
18029
|
[
|
|
18002
18030
|
[StringType],
|
|
18003
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
18004
18031
|
(ctx, [key]) => get(key.evaluate(ctx), ctx.properties())
|
|
18005
18032
|
],
|
|
18006
18033
|
[
|
|
@@ -18016,7 +18043,6 @@ CompoundExpression.register(expressions, {
|
|
|
18016
18043
|
'feature-state': [
|
|
18017
18044
|
ValueType,
|
|
18018
18045
|
[StringType],
|
|
18019
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
18020
18046
|
(ctx, [key]) => get(key.evaluate(ctx), ctx.featureState || {})
|
|
18021
18047
|
],
|
|
18022
18048
|
'properties': [
|
|
@@ -19802,11 +19828,11 @@ function migrate (style) {
|
|
|
19802
19828
|
migrated = true;
|
|
19803
19829
|
}
|
|
19804
19830
|
if (style.version === 8) {
|
|
19805
|
-
|
|
19831
|
+
style = migrateToExpressions(style);
|
|
19806
19832
|
migrated = true;
|
|
19807
19833
|
}
|
|
19808
19834
|
if (!migrated) {
|
|
19809
|
-
throw new Error(
|
|
19835
|
+
throw new Error(`Cannot migrate from ${ style.version }`);
|
|
19810
19836
|
}
|
|
19811
19837
|
return style;
|
|
19812
19838
|
}
|
|
@@ -21109,7 +21135,6 @@ function validateProperty(options, propertyType) {
|
|
|
21109
21135
|
},
|
|
21110
21136
|
style,
|
|
21111
21137
|
styleSpec,
|
|
21112
|
-
// @ts-expect-error - TS2353 - Object literal may only specify known properties, and 'expressionContext' does not exist in type 'ValidationOptions'.
|
|
21113
21138
|
expressionContext: 'property',
|
|
21114
21139
|
propertyType,
|
|
21115
21140
|
propertyKey
|
|
@@ -21168,7 +21193,6 @@ Use an identity property function instead: ${ example }.`)];
|
|
|
21168
21193
|
valueSpec,
|
|
21169
21194
|
style,
|
|
21170
21195
|
styleSpec,
|
|
21171
|
-
// @ts-expect-error - TS2353 - Object literal may only specify known properties, and 'expressionContext' does not exist in type 'ValidationOptions'.
|
|
21172
21196
|
expressionContext: 'property',
|
|
21173
21197
|
propertyType,
|
|
21174
21198
|
propertyKey
|
|
@@ -21821,9 +21845,7 @@ function validateIconset(options) {
|
|
|
21821
21845
|
}
|
|
21822
21846
|
|
|
21823
21847
|
const VALIDATORS = {
|
|
21824
|
-
'*'()
|
|
21825
|
-
return [];
|
|
21826
|
-
},
|
|
21848
|
+
'*': () => [],
|
|
21827
21849
|
'array': validateArray,
|
|
21828
21850
|
'boolean': validateBoolean,
|
|
21829
21851
|
'number': validateNumber,
|