@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/composite.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
// @ts-nocheck
|
|
1
|
+
import type {StyleSpecification} from './types';
|
|
3
2
|
|
|
4
|
-
export default function (style) {
|
|
5
|
-
const styleIDs = [];
|
|
6
|
-
const sourceIDs = [];
|
|
7
|
-
const compositedSourceLayers = [];
|
|
3
|
+
export default function (style: StyleSpecification): StyleSpecification {
|
|
4
|
+
const styleIDs: string[] = [];
|
|
5
|
+
const sourceIDs: string[] = [];
|
|
6
|
+
const compositedSourceLayers: string[] = [];
|
|
8
7
|
|
|
9
8
|
for (const id in style.sources) {
|
|
10
9
|
const source = style.sources[id];
|
|
@@ -21,7 +20,6 @@ export default function (style) {
|
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
if (styleIDs.length < 2)
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
25
23
|
return style;
|
|
26
24
|
|
|
27
25
|
styleIDs.forEach((id) => {
|
|
@@ -49,6 +47,5 @@ export default function (style) {
|
|
|
49
47
|
}
|
|
50
48
|
});
|
|
51
49
|
|
|
52
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
53
50
|
return style;
|
|
54
51
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1513,6 +1513,29 @@
|
|
|
1513
1513
|
paint: {
|
|
1514
1514
|
type: "paint",
|
|
1515
1515
|
doc: "Default paint properties for this layer."
|
|
1516
|
+
},
|
|
1517
|
+
appearances: {
|
|
1518
|
+
type: "array",
|
|
1519
|
+
value: "appearance",
|
|
1520
|
+
"supported-layer-types": [
|
|
1521
|
+
"symbol"
|
|
1522
|
+
],
|
|
1523
|
+
"private": true,
|
|
1524
|
+
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."
|
|
1525
|
+
}
|
|
1526
|
+
};
|
|
1527
|
+
var appearance = {
|
|
1528
|
+
condition: {
|
|
1529
|
+
type: "expression",
|
|
1530
|
+
doc: "A boolean expression that determines when this appearance should be applied."
|
|
1531
|
+
},
|
|
1532
|
+
name: {
|
|
1533
|
+
type: "string",
|
|
1534
|
+
doc: "Optional name for this appearance. Non-empty names should be unique within a layer."
|
|
1535
|
+
},
|
|
1536
|
+
properties: {
|
|
1537
|
+
type: "*",
|
|
1538
|
+
doc: "Style properties to apply when the condition is met."
|
|
1516
1539
|
}
|
|
1517
1540
|
};
|
|
1518
1541
|
var layout = [
|
|
@@ -2704,6 +2727,7 @@
|
|
|
2704
2727
|
minimum: 0,
|
|
2705
2728
|
units: "factor of the original icon size",
|
|
2706
2729
|
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.",
|
|
2730
|
+
appearance: true,
|
|
2707
2731
|
requires: [
|
|
2708
2732
|
"icon-image"
|
|
2709
2733
|
],
|
|
@@ -2847,6 +2871,7 @@
|
|
|
2847
2871
|
type: "resolvedImage",
|
|
2848
2872
|
doc: "Name of image in sprite to use for drawing an image background.",
|
|
2849
2873
|
tokens: true,
|
|
2874
|
+
appearance: true,
|
|
2850
2875
|
"sdk-support": {
|
|
2851
2876
|
"basic functionality": {
|
|
2852
2877
|
js: "0.10.0",
|
|
@@ -2874,6 +2899,7 @@
|
|
|
2874
2899
|
period: 360,
|
|
2875
2900
|
units: "degrees",
|
|
2876
2901
|
doc: "Rotates the icon clockwise.",
|
|
2902
|
+
appearance: true,
|
|
2877
2903
|
requires: [
|
|
2878
2904
|
"icon-image"
|
|
2879
2905
|
],
|
|
@@ -2962,6 +2988,7 @@
|
|
|
2962
2988
|
0
|
|
2963
2989
|
],
|
|
2964
2990
|
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.",
|
|
2991
|
+
appearance: true,
|
|
2965
2992
|
requires: [
|
|
2966
2993
|
"icon-image"
|
|
2967
2994
|
],
|
|
@@ -10188,6 +10215,7 @@
|
|
|
10188
10215
|
source_image: source_image,
|
|
10189
10216
|
source_model: source_model,
|
|
10190
10217
|
layer: layer,
|
|
10218
|
+
appearance: appearance,
|
|
10191
10219
|
layout: layout,
|
|
10192
10220
|
layout_background: layout_background,
|
|
10193
10221
|
layout_sky: layout_sky,
|
|
@@ -18006,7 +18034,6 @@
|
|
|
18006
18034
|
overloads: [
|
|
18007
18035
|
[
|
|
18008
18036
|
[StringType],
|
|
18009
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
18010
18037
|
(ctx, [key]) => get(key.evaluate(ctx), ctx.properties())
|
|
18011
18038
|
],
|
|
18012
18039
|
[
|
|
@@ -18022,7 +18049,6 @@
|
|
|
18022
18049
|
'feature-state': [
|
|
18023
18050
|
ValueType,
|
|
18024
18051
|
[StringType],
|
|
18025
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
18026
18052
|
(ctx, [key]) => get(key.evaluate(ctx), ctx.featureState || {})
|
|
18027
18053
|
],
|
|
18028
18054
|
'properties': [
|
|
@@ -19808,11 +19834,11 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
19808
19834
|
migrated = true;
|
|
19809
19835
|
}
|
|
19810
19836
|
if (style.version === 8) {
|
|
19811
|
-
|
|
19837
|
+
style = migrateToExpressions(style);
|
|
19812
19838
|
migrated = true;
|
|
19813
19839
|
}
|
|
19814
19840
|
if (!migrated) {
|
|
19815
|
-
throw new Error(
|
|
19841
|
+
throw new Error(`Cannot migrate from ${ style.version }`);
|
|
19816
19842
|
}
|
|
19817
19843
|
return style;
|
|
19818
19844
|
}
|
|
@@ -21115,7 +21141,6 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
21115
21141
|
},
|
|
21116
21142
|
style,
|
|
21117
21143
|
styleSpec,
|
|
21118
|
-
// @ts-expect-error - TS2353 - Object literal may only specify known properties, and 'expressionContext' does not exist in type 'ValidationOptions'.
|
|
21119
21144
|
expressionContext: 'property',
|
|
21120
21145
|
propertyType,
|
|
21121
21146
|
propertyKey
|
|
@@ -21174,7 +21199,6 @@ Use an identity property function instead: ${ example }.`)];
|
|
|
21174
21199
|
valueSpec,
|
|
21175
21200
|
style,
|
|
21176
21201
|
styleSpec,
|
|
21177
|
-
// @ts-expect-error - TS2353 - Object literal may only specify known properties, and 'expressionContext' does not exist in type 'ValidationOptions'.
|
|
21178
21202
|
expressionContext: 'property',
|
|
21179
21203
|
propertyType,
|
|
21180
21204
|
propertyKey
|
|
@@ -21827,9 +21851,7 @@ Use an identity property function instead: ${ example }.`)];
|
|
|
21827
21851
|
}
|
|
21828
21852
|
|
|
21829
21853
|
const VALIDATORS = {
|
|
21830
|
-
'*'()
|
|
21831
|
-
return [];
|
|
21832
|
-
},
|
|
21854
|
+
'*': () => [],
|
|
21833
21855
|
'array': validateArray,
|
|
21834
21856
|
'boolean': validateBoolean,
|
|
21835
21857
|
'number': validateNumber,
|