@mapbox/mapbox-gl-style-spec 14.31.0 → 14.32.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/dist/index.cjs CHANGED
@@ -48,14 +48,14 @@
48
48
  "default": 0,
49
49
  period: 360,
50
50
  units: "degrees",
51
- doc: "Default bearing, in degrees. The bearing is the compass direction that is \"up\"; for example, a bearing of 90° orients the map so that east is up. This value will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
51
+ doc: "Default bearing. The bearing is the compass direction that is \"up\"; for example, a bearing of 90° orients the map so that east is up. This value will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
52
52
  example: 29
53
53
  },
54
54
  pitch: {
55
55
  type: "number",
56
56
  "default": 0,
57
57
  units: "degrees",
58
- doc: "Default pitch, in degrees. Zero is perpendicular to the surface, for a look straight down at the map, while a greater value like 60 looks ahead towards the horizon. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
58
+ doc: "Default pitch. Zero is perpendicular to the surface, for a look straight down at the map, while a greater value like 60 looks ahead towards the horizon. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
59
59
  example: 50
60
60
  },
61
61
  light: {
@@ -1470,6 +1470,28 @@
1470
1470
  value: "string",
1471
1471
  doc: "An array of one or more tile source URLs, as in the TileJSON spec. Requires `batched-model` source type."
1472
1472
  },
1473
+ bounds: {
1474
+ type: "array",
1475
+ value: "number",
1476
+ length: 4,
1477
+ "default": [
1478
+ -180,
1479
+ -85.051129,
1480
+ 180,
1481
+ 85.051129
1482
+ ],
1483
+ doc: "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL. Requires `batched-model` source type."
1484
+ },
1485
+ extra_bounds: {
1486
+ type: "array",
1487
+ value: {
1488
+ type: "array",
1489
+ value: "number",
1490
+ length: 4,
1491
+ doc: "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`."
1492
+ },
1493
+ doc: "An array of additional discrete geographic regions where tiles are available. When used alongside the `bounds` property, these regions act as an additional filter - Mapbox GL will only request tiles that are both within the `bounds` and any of the regions defined in `extra_bounds`. When used independently (without `bounds`), Mapbox GL will request tiles that fall within any of the regions in `extra_bounds`. This allows for more fine-grained control over tile requests, particularly when dealing with sparse data coverage. Requires `batched-model` source type."
1494
+ },
1473
1495
  models: {
1474
1496
  type: "modelSourceModels",
1475
1497
  doc: "Defines properties of 3D models in collection. Requires `model` source type."
@@ -1875,9 +1897,9 @@
1875
1897
  doc: "If true, the models will be reduced in density based on the zoom level. This is useful for large datasets that may be slow to render.",
1876
1898
  "sdk-support": {
1877
1899
  "basic functionality": {
1878
- js: "0.10.0",
1879
- android: "2.0.1",
1880
- ios: "2.0.0"
1900
+ js: "3.18.0",
1901
+ android: "11.20.0",
1902
+ ios: "11.18.0"
1881
1903
  }
1882
1904
  },
1883
1905
  "property-type": "data-constant"
@@ -2264,6 +2286,7 @@
2264
2286
  maximum: 20,
2265
2287
  "default": 3.1,
2266
2288
  doc: "Width of a floor. Think of this as measure how wide each unit should be. This effectively determines the number of units per each floor. Note that this does not affect the ground level facades (i.e. number of windows).",
2289
+ units: "meters",
2267
2290
  "private": true,
2268
2291
  "property-type": "data-driven",
2269
2292
  "sdk-support": {
@@ -2431,7 +2454,7 @@
2431
2454
  units: "meters",
2432
2455
  "default": 0,
2433
2456
  minimum: 0,
2434
- doc: "The extent of the flood light effect on the walls of the buildings in meters.",
2457
+ doc: "The extent of the flood light effect on the walls of the buildings.",
2435
2458
  requires: [
2436
2459
  "lights"
2437
2460
  ],
@@ -2462,7 +2485,7 @@
2462
2485
  "private": true,
2463
2486
  units: "meters",
2464
2487
  "default": 0,
2465
- doc: "The extent of the flood light effect on the ground beneath the buildings in meters.",
2488
+ doc: "The extent of the flood light effect on the ground beneath the buildings.",
2466
2489
  requires: [
2467
2490
  "lights"
2468
2491
  ],
@@ -2491,7 +2514,6 @@
2491
2514
  "property-type": "data-driven",
2492
2515
  type: "boolean",
2493
2516
  "private": true,
2494
- units: "meters",
2495
2517
  "default": false,
2496
2518
  doc: "Flips the orientation of the roofs for the buildings. This only affects simple geometries. Namely buildings whose footprints form a quadrilateral. By default (false), the roof ridge takes the direction of the longer edge of the quadrilateral.",
2497
2519
  transition: true,
@@ -2672,8 +2694,9 @@
2672
2694
  },
2673
2695
  "line-z-offset": {
2674
2696
  type: "number",
2675
- doc: "Vertical offset from ground, in meters. Not supported for globe projection at the moment.",
2697
+ doc: "Vertical offset from ground. Not supported for globe projection at the moment.",
2676
2698
  "default": 0,
2699
+ units: "meters",
2677
2700
  requires: [
2678
2701
  "line-elevation-reference"
2679
2702
  ],
@@ -5963,7 +5986,8 @@
5963
5986
  ],
5964
5987
  relaxZoomRestriction: true
5965
5988
  },
5966
- doc: "An array of two number values, specifying the vertical range, measured in meters, over which the fog should gradually fade out. When both parameters are set to zero, the fog will be rendered without any vertical constraints.",
5989
+ doc: "An array of two number values, specifying the vertical range over which the fog should gradually fade out. When both parameters are set to zero, the fog will be rendered without any vertical constraints.",
5990
+ units: "meters",
5967
5991
  "sdk-support": {
5968
5992
  "basic functionality": {
5969
5993
  js: "3.0.0",
@@ -7104,7 +7128,7 @@
7104
7128
  ]
7105
7129
  },
7106
7130
  requires: [
7107
- "line-pattern"
7131
+ "fill-pattern"
7108
7132
  ],
7109
7133
  "sdk-support": {
7110
7134
  "basic functionality": {
@@ -7143,7 +7167,8 @@
7143
7167
  },
7144
7168
  "fill-z-offset": {
7145
7169
  type: "number",
7146
- doc: "Specifies an uniform elevation in meters. Note: If the value is zero, the layer will be rendered on the ground. Non-zero values will elevate the layer from the sea level, which can cause it to be rendered below the terrain.",
7170
+ doc: "Specifies an uniform elevation. Note: If the value is zero, the layer will be rendered on the ground. Non-zero values will elevate the layer from the sea level, which can cause it to be rendered below the terrain.",
7171
+ units: "meters",
7147
7172
  "default": 0,
7148
7173
  minimum: 0,
7149
7174
  transition: true,
@@ -7308,7 +7333,8 @@
7308
7333
  ]
7309
7334
  },
7310
7335
  transition: true,
7311
- doc: "The extent of the ambient occlusion effect on the ground beneath the procedural buildings in meters.",
7336
+ doc: "The extent of the ambient occlusion effect on the ground beneath the procedural buildings.",
7337
+ units: "meters",
7312
7338
  "sdk-support": {
7313
7339
  "basic functionality": {
7314
7340
  js: "3.16.0",
@@ -7814,7 +7840,7 @@
7814
7840
  minimum: 0,
7815
7841
  transition: true,
7816
7842
  units: "pixels",
7817
- doc: "Blur applied to the line, in pixels.",
7843
+ doc: "Blur applied to the line.",
7818
7844
  "sdk-support": {
7819
7845
  "basic functionality": {
7820
7846
  js: "0.10.0",
@@ -8122,6 +8148,7 @@
8122
8148
  "default": 0,
8123
8149
  minimum: 0,
8124
8150
  transition: true,
8151
+ units: "pixels",
8125
8152
  "sdk-support": {
8126
8153
  "basic functionality": {
8127
8154
  js: "3.0.0",
@@ -8292,7 +8319,7 @@
8292
8319
  "default": 0,
8293
8320
  minimum: 0,
8294
8321
  units: "meters",
8295
- doc: "Depth offset along the camera, in meters. When set to a non-zero value, applied cutout opacity is 0.",
8322
+ doc: "Depth offset along the camera. When set to a non-zero value, applied cutout opacity is 0.",
8296
8323
  experimental: true,
8297
8324
  "private": true,
8298
8325
  transition: true,
@@ -8662,7 +8689,7 @@
8662
8689
  minimum: 1,
8663
8690
  transition: true,
8664
8691
  units: "pixels",
8665
- doc: "Radius of influence of one heatmap point in pixels. Increasing the value makes the heatmap smoother, but less detailed. `queryRenderedFeatures` on heatmap layers will return points within this radius.",
8692
+ doc: "Radius of influence of one heatmap point. Increasing the value makes the heatmap smoother, but less detailed. `queryRenderedFeatures` on heatmap layers will return points within this radius.",
8666
8693
  "sdk-support": {
8667
8694
  "basic functionality": {
8668
8695
  js: "0.41.0",
@@ -9499,7 +9526,8 @@
9499
9526
  },
9500
9527
  "symbol-z-offset": {
9501
9528
  type: "number",
9502
- doc: "Specifies an uniform elevation from the ground, in meters.",
9529
+ doc: "Specifies an uniform elevation from the ground.",
9530
+ units: "meters",
9503
9531
  "default": 0,
9504
9532
  minimum: 0,
9505
9533
  transition: true,
@@ -9935,10 +9963,11 @@
9935
9963
  },
9936
9964
  "raster-elevation": {
9937
9965
  type: "number",
9938
- doc: "Defines an uniform elevation from the base specified in raster-elevation-reference, in meters.",
9966
+ doc: "Defines an uniform elevation from the base specified in raster-elevation-reference.",
9939
9967
  "default": 0,
9940
9968
  minimum: 0,
9941
9969
  transition: true,
9970
+ units: "meters",
9942
9971
  experimental: true,
9943
9972
  "sdk-support": {
9944
9973
  "basic functionality": {
@@ -9989,6 +10018,7 @@
9989
10018
  minimum: 0,
9990
10019
  maximum: 359,
9991
10020
  doc: "The direction of the light source used to generate the hillshading with 0 as the top of the viewport if `hillshade-illumination-anchor` is set to `viewport` and due north if `hillshade-illumination-anchor` is set to `map` and no 3d lights enabled. If `hillshade-illumination-anchor` is set to `map` and 3d lights enabled, the direction from 3d lights is used instead.",
10021
+ units: "degrees",
9992
10022
  transition: false,
9993
10023
  "sdk-support": {
9994
10024
  "basic functionality": {
@@ -10404,7 +10434,8 @@
10404
10434
  minimum: 0,
10405
10435
  maximum: 180,
10406
10436
  transition: false,
10407
- doc: "The angular distance (measured in degrees) from `sky-gradient-center` up to which the gradient extends. A value of 180 causes the gradient to wrap around to the opposite direction from `sky-gradient-center`.",
10437
+ doc: "The angular distance from `sky-gradient-center` up to which the gradient extends. A value of 180 causes the gradient to wrap around to the opposite direction from `sky-gradient-center`.",
10438
+ units: "degrees",
10408
10439
  "sdk-support": {
10409
10440
  "basic functionality": {
10410
10441
  js: "2.0.0",
@@ -10652,7 +10683,8 @@
10652
10683
  }
10653
10684
  },
10654
10685
  transition: true,
10655
- doc: "The translation of the model in meters in form of [longitudal, latitudal, altitude] offsets."
10686
+ units: "meters",
10687
+ doc: "The translation of the model in form of [longitudal, latitudal, altitude] offsets."
10656
10688
  },
10657
10689
  "model-color": {
10658
10690
  type: "color",
@@ -11185,7 +11217,8 @@
11185
11217
  "default": 0,
11186
11218
  minimum: 0,
11187
11219
  maximum: 1,
11188
- doc: "Radius of a fill extrusion edge in meters. If not zero, rounds extrusion edges for a smoother appearance.",
11220
+ doc: "Radius of a fill extrusion edge. If not zero, rounds extrusion edges for a smoother appearance.",
11221
+ units: "meters",
11189
11222
  "sdk-support": {
11190
11223
  "basic functionality": {
11191
11224
  js: "3.0.0",
@@ -11526,7 +11559,7 @@
11526
11559
  ]
11527
11560
  },
11528
11561
  requires: [
11529
- "line-pattern"
11562
+ "fill-extrusion-pattern"
11530
11563
  ],
11531
11564
  "sdk-support": {
11532
11565
  "basic functionality": {
@@ -11753,7 +11786,8 @@
11753
11786
  ]
11754
11787
  },
11755
11788
  transition: true,
11756
- doc: "The extent of the ambient occlusion effect on the ground beneath the extruded buildings in meters.",
11789
+ doc: "The extent of the ambient occlusion effect on the ground beneath the extruded buildings.",
11790
+ units: "meters",
11757
11791
  requires: [
11758
11792
  "lights"
11759
11793
  ],
@@ -11851,7 +11885,7 @@
11851
11885
  units: "meters",
11852
11886
  "default": 0,
11853
11887
  minimum: 0,
11854
- doc: "The extent of the flood light effect on the walls of the extruded buildings in meters.",
11888
+ doc: "The extent of the flood light effect on the walls of the extruded buildings.",
11855
11889
  requires: [
11856
11890
  "lights"
11857
11891
  ],
@@ -11882,7 +11916,7 @@
11882
11916
  experimental: true,
11883
11917
  units: "meters",
11884
11918
  "default": 0,
11885
- doc: "The extent of the flood light effect on the ground beneath the extruded buildings in meters. Note: this experimental property is evaluated once per tile, during tile initialization. Changing the property value could trigger tile reload. The `feature-state` styling is deprecated and will get removed soon.",
11919
+ doc: "The extent of the flood light effect on the ground beneath the extruded buildings. Note: this experimental property is evaluated once per tile, during tile initialization. Changing the property value could trigger tile reload. The `feature-state` styling is deprecated and will get removed soon.",
11886
11920
  requires: [
11887
11921
  "lights"
11888
11922
  ],
@@ -12250,10 +12284,11 @@
12250
12284
  },
12251
12285
  "raster-particle-elevation": {
12252
12286
  type: "number",
12253
- doc: "Defines an uniform elevation from sea level, in meters.",
12287
+ doc: "Defines an uniform elevation from sea level.",
12254
12288
  "default": 0,
12255
12289
  minimum: 0,
12256
12290
  transition: true,
12291
+ units: "meters",
12257
12292
  "sdk-support": {
12258
12293
  "basic functionality": {
12259
12294
  js: "3.7.0",
@@ -12411,11 +12446,11 @@
12411
12446
  return result;
12412
12447
  }
12413
12448
  function format(style, space = 2) {
12414
- style = sortKeysBy(style, v8.$root);
12415
- if (style.layers) {
12416
- style.layers = style.layers.map((layer) => sortKeysBy(layer, v8.layer));
12449
+ const sorted = sortKeysBy(style, v8.$root);
12450
+ if (sorted.layers) {
12451
+ sorted.layers = sorted.layers.map((layer) => sortKeysBy(layer, v8.layer));
12417
12452
  }
12418
- return stringify(style, { indent: space });
12453
+ return stringify(sorted, { indent: space });
12419
12454
  }
12420
12455
 
12421
12456
  function getPropertyReference(propertyName) {
@@ -12668,34 +12703,15 @@
12668
12703
  return type.kind;
12669
12704
  }
12670
12705
  }
12671
- const valueMemberTypes = [
12672
- NullType,
12673
- NumberType,
12674
- StringType,
12675
- BooleanType,
12676
- ColorType,
12677
- FormattedType,
12678
- ObjectType,
12679
- array$1(ValueType),
12680
- ResolvedImageType
12681
- ];
12682
12706
  function checkSubtype(expected, t) {
12683
- if (t.kind === "error") {
12684
- return null;
12685
- } else if (expected.kind === "array") {
12686
- if (t.kind === "array" && (t.N === 0 && t.itemType.kind === "value" || !checkSubtype(expected.itemType, t.itemType)) && (typeof expected.N !== "number" || expected.N === t.N)) {
12687
- return null;
12688
- }
12689
- } else if (expected.kind === t.kind) {
12690
- return null;
12691
- } else if (expected.kind === "value") {
12692
- for (const memberType of valueMemberTypes) {
12693
- if (!checkSubtype(memberType, t)) {
12694
- return null;
12695
- }
12696
- }
12707
+ return isSubtype(expected, t) ? null : `Expected ${toString$1(expected)} but found ${toString$1(t)} instead.`;
12708
+ }
12709
+ function isSubtype(expected, t) {
12710
+ if (t.kind === "error") return true;
12711
+ if (expected.kind === "array") {
12712
+ return t.kind === "array" && (t.N === 0 && t.itemType.kind === "value" || isSubtype(expected.itemType, t.itemType)) && (typeof expected.N !== "number" || expected.N === t.N);
12697
12713
  }
12698
- return `Expected ${toString$1(expected)} but found ${toString$1(t)} instead.`;
12714
+ return expected.kind === t.kind || expected.kind === "value" && t.kind !== "collator";
12699
12715
  }
12700
12716
  function isValidType(provided, allowedTypes) {
12701
12717
  return allowedTypes.some((t) => t.kind === provided.kind);
@@ -15214,6 +15230,21 @@
15214
15230
  function isGlobalPropertyConstant(e, properties) {
15215
15231
  return isGlobalPropertyConstantSet(e, new Set(properties));
15216
15232
  }
15233
+ const GlobalDependency = { Zoom: 1, Light: 2, LineProgress: 4 };
15234
+ const globalDependencyFlags = {
15235
+ "zoom": GlobalDependency.Zoom,
15236
+ "pitch": GlobalDependency.Zoom,
15237
+ "distance-from-center": GlobalDependency.Zoom,
15238
+ "measure-light": GlobalDependency.Light,
15239
+ "line-progress": GlobalDependency.LineProgress
15240
+ };
15241
+ function getGlobalDependencies(e) {
15242
+ let flags = e instanceof CompoundExpression ? globalDependencyFlags[e.name] || 0 : 0;
15243
+ e.eachChild((arg) => {
15244
+ flags |= getGlobalDependencies(arg);
15245
+ });
15246
+ return flags;
15247
+ }
15217
15248
 
15218
15249
  const RE = 6378.137;
15219
15250
  const FE = 1 / 298.257223563;
@@ -15896,7 +15927,7 @@
15896
15927
  * @param options.omitTypeAnnotations set true to omit inferred type annotations. Caller beware: with this option set, the parsed expression's type will NOT satisfy `expectedType` if it would normally be wrapped in an inferred annotation.
15897
15928
  * @private
15898
15929
  */
15899
- parse(expr, index, expectedType, bindings, options = {}) {
15930
+ parse(expr, index, expectedType, bindings, options) {
15900
15931
  if (index || expectedType) {
15901
15932
  const prevExpectedType = this.expectedType;
15902
15933
  const prevScope = this.scope;
@@ -15920,7 +15951,7 @@
15920
15951
  * @param options.omitTypeAnnotations set true to omit inferred type annotations. Caller beware: with this option set, the parsed expression's type will NOT satisfy `expectedType` if it would normally be wrapped in an inferred annotation.
15921
15952
  * @private
15922
15953
  */
15923
- parseObjectValue(expr, index, key, expectedType, bindings, options = {}) {
15954
+ parseObjectValue(expr, index, key, expectedType, bindings, options) {
15924
15955
  const prevExpectedType = this.expectedType;
15925
15956
  const prevScope = this.scope;
15926
15957
  if (bindings) this.scope = this.scope.concat(bindings);
@@ -15934,41 +15965,34 @@
15934
15965
  this.scope = prevScope;
15935
15966
  return result;
15936
15967
  }
15937
- _parse(expr, options) {
15938
- if (expr === null || typeof expr === "string" || typeof expr === "boolean" || typeof expr === "number") {
15939
- expr = ["literal", expr];
15968
+ // Applies `expectedType` to a freshly parsed expression, wrapping it in an inferred assertion
15969
+ // or coercion where that is what the expected type calls for. Returns null if the type is wrong.
15970
+ _annotateToExpectedType(parsed, options) {
15971
+ const expected = this.expectedType;
15972
+ if (!expected) return parsed;
15973
+ const actual = parsed.type;
15974
+ if ((expected.kind === "string" || expected.kind === "number" || expected.kind === "boolean" || expected.kind === "object" || expected.kind === "array") && actual.kind === "value") {
15975
+ return annotate(parsed, expected, options?.typeAnnotation || "assert");
15976
+ } else if ((expected.kind === "color" || expected.kind === "formatted" || expected.kind === "resolvedImage") && (actual.kind === "value" || actual.kind === "string")) {
15977
+ return annotate(parsed, expected, options?.typeAnnotation || "coerce");
15978
+ } else if (this.checkSubtype(expected, actual)) {
15979
+ return null;
15940
15980
  }
15941
- if (Array.isArray(expr)) {
15981
+ return parsed;
15982
+ }
15983
+ _parse(expr, options) {
15984
+ const scalarType = expr === null ? NullType : typeof expr === "string" ? StringType : typeof expr === "boolean" ? BooleanType : typeof expr === "number" ? NumberType : null;
15985
+ let result;
15986
+ if (scalarType) {
15987
+ result = new Literal(scalarType, expr);
15988
+ } else if (Array.isArray(expr)) {
15942
15989
  if (expr.length === 0) {
15943
15990
  return this.error(`Expected an array with at least one element. If you wanted a literal array, use ["literal", []].`);
15944
15991
  }
15945
- const Expr = typeof expr[0] === "string" && Object.hasOwn(this.registry, expr[0]) ? this.registry[expr[0]] : void 0;
15946
- if (Expr) {
15947
- let parsed = Expr.parse(expr, this);
15948
- if (!parsed) return null;
15949
- if (this.expectedType) {
15950
- const expected = this.expectedType;
15951
- const actual = parsed.type;
15952
- if ((expected.kind === "string" || expected.kind === "number" || expected.kind === "boolean" || expected.kind === "object" || expected.kind === "array") && actual.kind === "value") {
15953
- parsed = annotate(parsed, expected, options.typeAnnotation || "assert");
15954
- } else if ((expected.kind === "color" || expected.kind === "formatted" || expected.kind === "resolvedImage") && (actual.kind === "value" || actual.kind === "string")) {
15955
- parsed = annotate(parsed, expected, options.typeAnnotation || "coerce");
15956
- } else if (this.checkSubtype(expected, actual)) {
15957
- return null;
15958
- }
15959
- }
15960
- if (!(parsed instanceof Literal) && parsed.type.kind !== "resolvedImage" && isConstant(parsed)) {
15961
- const ec = new EvaluationContext(this._scope, this.options, this.iconImageUseTheme);
15962
- try {
15963
- parsed = new Literal(parsed.type, parsed.evaluate(ec));
15964
- } catch (e) {
15965
- this.error(e.message);
15966
- return null;
15967
- }
15968
- }
15969
- return parsed;
15970
- }
15971
- return Coercion.parse(["to-array", expr], this);
15992
+ const Expr = this.registry[expr[0]];
15993
+ if (!Expr) return Coercion.parse(["to-array", expr], this);
15994
+ result = Expr.parse(expr, this);
15995
+ if (!result) return null;
15972
15996
  } else if (typeof expr === "undefined") {
15973
15997
  return this.error(`'undefined' value invalid. Use null instead.`);
15974
15998
  } else if (typeof expr === "object") {
@@ -15976,6 +16000,18 @@
15976
16000
  } else {
15977
16001
  return this.error(`Expected an array, but found ${typeof expr} instead.`);
15978
16002
  }
16003
+ let parsed = this._annotateToExpectedType(result, options);
16004
+ if (!parsed) return null;
16005
+ if (!(parsed instanceof Literal) && parsed.type.kind !== "resolvedImage" && isConstant(parsed)) {
16006
+ const ec = new EvaluationContext(this._scope, this.options, this.iconImageUseTheme);
16007
+ try {
16008
+ parsed = new Literal(parsed.type, parsed.evaluate(ec));
16009
+ } catch (e) {
16010
+ this.error(e.message);
16011
+ return null;
16012
+ }
16013
+ }
16014
+ return parsed;
15979
16015
  }
15980
16016
  /**
15981
16017
  * Returns a copy of this context suitable for parsing the subexpression at
@@ -16007,10 +16043,12 @@
16007
16043
  * overload signatures without polluting the parent errors list.
16008
16044
  * @private
16009
16045
  */
16046
+ // `path` is shared rather than copied: argument parsing pushes and pops it in balance, and
16047
+ // `error` snapshots `key` into the message eagerly, so the fork never observes a stale path.
16010
16048
  _forkForSignature() {
16011
16049
  return new ParsingContext(
16012
16050
  this.registry,
16013
- this.path.slice(),
16051
+ this.path,
16014
16052
  null,
16015
16053
  this.scope,
16016
16054
  [],
@@ -17234,7 +17272,7 @@
17234
17272
  };
17235
17273
  }
17236
17274
 
17237
- const expressions = {
17275
+ const expressions = Object.assign(/* @__PURE__ */ Object.create(null), {
17238
17276
  // special forms
17239
17277
  "==": Equals,
17240
17278
  "!=": NotEquals,
@@ -17272,7 +17310,7 @@
17272
17310
  "within": Within,
17273
17311
  "distance": Distance,
17274
17312
  "config": Config
17275
- };
17313
+ });
17276
17314
  function rgba(ctx, [r, g, b, a]) {
17277
17315
  r = r.evaluate(ctx);
17278
17316
  g = g.evaluate(ctx);
@@ -17945,28 +17983,22 @@
17945
17983
  ]
17946
17984
  });
17947
17985
 
17948
- function getConfigDependencies(e) {
17986
+ const NO_CONFIG_DEPENDENCIES = /* @__PURE__ */ new Set();
17987
+ function collect(e, deps) {
17949
17988
  if (e instanceof Config) {
17950
- const singleConfig = /* @__PURE__ */ new Set([e.key]);
17951
- return singleConfig;
17989
+ if (deps.configDependencies === NO_CONFIG_DEPENDENCIES) deps.configDependencies = /* @__PURE__ */ new Set();
17990
+ deps.configDependencies.add(e.key);
17991
+ return;
17952
17992
  }
17953
- let result = /* @__PURE__ */ new Set();
17993
+ if (e instanceof CompoundExpression && e.name === "is-active-floor") deps.isIndoorDependent = true;
17954
17994
  e.eachChild((arg) => {
17955
- result = /* @__PURE__ */ new Set([...result, ...getConfigDependencies(arg)]);
17995
+ collect(arg, deps);
17956
17996
  });
17957
- return result;
17958
17997
  }
17959
- function isIndoorDependent(e) {
17960
- if (e instanceof CompoundExpression && e.name === "is-active-floor") {
17961
- return true;
17962
- }
17963
- let result = false;
17964
- e.eachChild((arg) => {
17965
- if (!result && isIndoorDependent(arg)) {
17966
- result = true;
17967
- }
17968
- });
17969
- return result;
17998
+ function getExpressionDependencies(e) {
17999
+ const deps = { configDependencies: NO_CONFIG_DEPENDENCIES, isIndoorDependent: false };
18000
+ collect(e, deps);
18001
+ return deps;
17970
18002
  }
17971
18003
 
17972
18004
  function success(value) {
@@ -18003,7 +18035,8 @@
18003
18035
  function identityFunction(x) {
18004
18036
  return x;
18005
18037
  }
18006
- function createFunction(parameters, propertySpec) {
18038
+ function createFunction(input, propertySpec) {
18039
+ let parameters = input;
18007
18040
  const isColor = propertySpec.type === "color";
18008
18041
  const zoomAndFeatureDependent = parameters.stops && typeof parameters.stops[0][0] === "object";
18009
18042
  const featureDependent = zoomAndFeatureDependent || parameters.property !== void 0;
@@ -18052,13 +18085,9 @@
18052
18085
  const zoom = stop[0].zoom;
18053
18086
  if (featureFunctions[zoom] === void 0) {
18054
18087
  featureFunctions[zoom] = {
18055
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
18056
18088
  zoom,
18057
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
18058
18089
  type: parameters.type,
18059
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
18060
18090
  property: parameters.property,
18061
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
18062
18091
  default: parameters.default,
18063
18092
  stops: []
18064
18093
  };
@@ -18075,29 +18104,21 @@
18075
18104
  kind: "composite",
18076
18105
  interpolationType,
18077
18106
  interpolationFactor: Interpolate.interpolationFactor.bind(void 0, interpolationType),
18078
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
18079
18107
  zoomStops: featureFunctionStops.map((s) => s[0]),
18080
18108
  evaluate({ zoom }, properties) {
18081
18109
  return evaluateExponentialFunction({
18082
18110
  stops: featureFunctionStops,
18083
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
18084
18111
  base: parameters.base
18085
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
18086
18112
  }, propertySpec, zoom).evaluate(zoom, properties);
18087
18113
  }
18088
18114
  };
18089
18115
  } else if (zoomDependent) {
18090
- const interpolationType = type === "exponential" ? (
18091
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
18092
- { name: "exponential", base: parameters.base !== void 0 ? parameters.base : 1 }
18093
- ) : null;
18116
+ const interpolationType = type === "exponential" ? { name: "exponential", base: parameters.base !== void 0 ? parameters.base : 1 } : null;
18094
18117
  return {
18095
18118
  kind: "camera",
18096
18119
  interpolationType,
18097
18120
  interpolationFactor: Interpolate.interpolationFactor.bind(void 0, interpolationType),
18098
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
18099
18121
  zoomStops: parameters.stops.map((s) => s[0]),
18100
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
18101
18122
  evaluate: ({ zoom }) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
18102
18123
  };
18103
18124
  } else {
@@ -18124,31 +18145,26 @@
18124
18145
  }
18125
18146
  function evaluateIntervalFunction(parameters, propertySpec, input) {
18126
18147
  if (!isNumber(input)) return coalesce$1(parameters.default, propertySpec.default);
18127
- const n = parameters.stops.length;
18128
- if (n === 1) return parameters.stops[0][1];
18129
- if (input <= parameters.stops[0][0]) return parameters.stops[0][1];
18130
- if (input >= parameters.stops[n - 1][0]) return parameters.stops[n - 1][1];
18131
- const index = findStopLessThanOrEqualTo(parameters.stops.map((stop) => stop[0]), input);
18132
- return parameters.stops[index][1];
18148
+ const stops = parameters.stops;
18149
+ const n = stops.length;
18150
+ if (n === 1) return stops[0][1];
18151
+ if (input <= stops[0][0]) return stops[0][1];
18152
+ if (input >= stops[n - 1][0]) return stops[n - 1][1];
18153
+ const index = findStopLessThanOrEqualTo(stops.map((stop) => stop[0]), input);
18154
+ return stops[index][1];
18133
18155
  }
18134
18156
  function evaluateExponentialFunction(parameters, propertySpec, input) {
18135
18157
  const base = parameters.base !== void 0 ? parameters.base : 1;
18136
18158
  if (!isNumber(input)) return coalesce$1(parameters.default, propertySpec.default);
18137
- const n = parameters.stops.length;
18138
- if (n === 1) return parameters.stops[0][1];
18139
- if (input <= parameters.stops[0][0]) return parameters.stops[0][1];
18140
- if (input >= parameters.stops[n - 1][0]) return parameters.stops[n - 1][1];
18141
- const index = findStopLessThanOrEqualTo(parameters.stops.map((stop) => stop[0]), input);
18142
- const t = interpolationFactor(
18143
- input,
18144
- base,
18145
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
18146
- parameters.stops[index][0],
18147
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
18148
- parameters.stops[index + 1][0]
18149
- );
18150
- const outputLower = parameters.stops[index][1];
18151
- const outputUpper = parameters.stops[index + 1][1];
18159
+ const stops = parameters.stops;
18160
+ const n = stops.length;
18161
+ if (n === 1) return stops[0][1];
18162
+ if (input <= stops[0][0]) return stops[0][1];
18163
+ if (input >= stops[n - 1][0]) return stops[n - 1][1];
18164
+ const index = findStopLessThanOrEqualTo(stops.map((stop) => stop[0]), input);
18165
+ const t = interpolationFactor(input, base, stops[index][0], stops[index + 1][0]);
18166
+ const outputLower = stops[index][1];
18167
+ const outputUpper = stops[index + 1][1];
18152
18168
  let interp = interpolate[propertySpec.type] || identityFunction;
18153
18169
  if (parameters.colorSpace && parameters.colorSpace !== "rgb") {
18154
18170
  const colorspace = colorSpaces[parameters.colorSpace];
@@ -18202,8 +18218,9 @@
18202
18218
  this._evaluator = new EvaluationContext(scope, options, iconImageUseTheme);
18203
18219
  this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
18204
18220
  this._enumValues = propertySpec && propertySpec.type === "enum" ? propertySpec.values : null;
18205
- this.configDependencies = getConfigDependencies(expression);
18206
- this.isIndoorDependent = isIndoorDependent(expression);
18221
+ const dependencies = getExpressionDependencies(expression);
18222
+ this.configDependencies = dependencies.configDependencies;
18223
+ this.isIndoorDependent = dependencies.isIndoorDependent;
18207
18224
  }
18208
18225
  evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection, featureTileCoord, featureDistanceData) {
18209
18226
  const evaluator = this._evaluator;
@@ -18275,8 +18292,8 @@
18275
18292
  this.isLightConstant = isLightConstant;
18276
18293
  this.isLineProgressConstant = isLineProgressConstant;
18277
18294
  this.isStateDependent = kind !== "constant" && !isStateConstant(expression.expression);
18278
- this.configDependencies = getConfigDependencies(expression.expression);
18279
- this.isIndoorDependent = isIndoorDependent(expression.expression);
18295
+ this.configDependencies = expression.configDependencies;
18296
+ this.isIndoorDependent = expression.isIndoorDependent;
18280
18297
  }
18281
18298
  evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {
18282
18299
  return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);
@@ -18291,10 +18308,10 @@
18291
18308
  this.zoomStops = zoomStops;
18292
18309
  this._styleExpression = expression;
18293
18310
  this.isStateDependent = kind !== "camera" && !isStateConstant(expression.expression);
18294
- this.isIndoorDependent = isIndoorDependent(expression.expression);
18311
+ this.isIndoorDependent = expression.isIndoorDependent;
18295
18312
  this.isLightConstant = isLightConstant;
18296
18313
  this.isLineProgressConstant = isLineProgressConstant;
18297
- this.configDependencies = getConfigDependencies(expression.expression);
18314
+ this.configDependencies = expression.configDependencies;
18298
18315
  this.interpolationType = interpolationType;
18299
18316
  }
18300
18317
  evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {
@@ -18312,24 +18329,25 @@
18312
18329
  }
18313
18330
  }
18314
18331
  function createPropertyExpression(expression, propertySpec, scope, options, iconImageUseTheme) {
18315
- expression = createExpression(expression, propertySpec, scope, options, iconImageUseTheme);
18316
- if (expression.result === "error") {
18317
- return expression;
18332
+ const styleExpression = createExpression(expression, propertySpec, scope, options, iconImageUseTheme);
18333
+ if (styleExpression.result === "error") {
18334
+ return styleExpression;
18318
18335
  }
18319
- const parsed = expression.value.expression;
18336
+ const parsed = styleExpression.value.expression;
18320
18337
  const isFeatureConstant$1 = isFeatureConstant(parsed);
18321
18338
  if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
18322
18339
  return error([new ParsingError$1("", "data expressions not supported")]);
18323
18340
  }
18324
- const isZoomConstant = isGlobalPropertyConstant(parsed, ["zoom", "pitch", "distance-from-center"]);
18341
+ const globalDependencies = getGlobalDependencies(parsed);
18342
+ const isZoomConstant = (globalDependencies & GlobalDependency.Zoom) === 0;
18325
18343
  if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
18326
18344
  return error([new ParsingError$1("", "zoom expressions not supported")]);
18327
18345
  }
18328
- const isLightConstant = isGlobalPropertyConstant(parsed, ["measure-light"]);
18346
+ const isLightConstant = (globalDependencies & GlobalDependency.Light) === 0;
18329
18347
  if (!isLightConstant && !supportsLightExpression(propertySpec)) {
18330
18348
  return error([new ParsingError$1("", "measure-light expression not supported")]);
18331
18349
  }
18332
- const isLineProgressConstant = isGlobalPropertyConstant(parsed, ["line-progress"]);
18350
+ const isLineProgressConstant = (globalDependencies & GlobalDependency.LineProgress) === 0;
18333
18351
  if (!isLineProgressConstant && !supportsLineProgressExpression(propertySpec)) {
18334
18352
  return error([new ParsingError$1("", "line-progress expression not supported")]);
18335
18353
  }
@@ -18343,22 +18361,10 @@
18343
18361
  return error([new ParsingError$1("", '"interpolate" expressions cannot be used with this property')]);
18344
18362
  }
18345
18363
  if (!zoomCurve) {
18346
- return success(isFeatureConstant$1 && isLineProgressConstant ? (
18347
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
18348
- new ZoomConstantExpression("constant", expression.value, isLightConstant, isLineProgressConstant)
18349
- ) : (
18350
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
18351
- new ZoomConstantExpression("source", expression.value, isLightConstant, isLineProgressConstant)
18352
- ));
18364
+ return success(isFeatureConstant$1 && isLineProgressConstant ? new ZoomConstantExpression("constant", styleExpression.value, isLightConstant, isLineProgressConstant) : new ZoomConstantExpression("source", styleExpression.value, isLightConstant, isLineProgressConstant));
18353
18365
  }
18354
18366
  const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : void 0;
18355
- return success(isFeatureConstant$1 && isLineProgressConstant ? (
18356
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
18357
- new ZoomDependentExpression("camera", expression.value, zoomCurve.labels, interpolationType, isLightConstant, isLineProgressConstant)
18358
- ) : (
18359
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
18360
- new ZoomDependentExpression("composite", expression.value, zoomCurve.labels, interpolationType, isLightConstant, isLineProgressConstant)
18361
- ));
18367
+ return success(isFeatureConstant$1 && isLineProgressConstant ? new ZoomDependentExpression("camera", styleExpression.value, zoomCurve.labels, interpolationType, isLightConstant, isLineProgressConstant) : new ZoomDependentExpression("composite", styleExpression.value, zoomCurve.labels, interpolationType, isLightConstant, isLineProgressConstant));
18362
18368
  }
18363
18369
  class StylePropertyFunction {
18364
18370
  constructor(parameters, specification) {
@@ -18799,6 +18805,7 @@ ${JSON.stringify(filterExp, null, 2)}
18799
18805
  }
18800
18806
  }
18801
18807
  function unionDynamicBranches(filter) {
18808
+ if (!Array.isArray(filter)) return;
18802
18809
  let isBranchingDynamically = false;
18803
18810
  const branches = [];
18804
18811
  if (filter[0] === "case") {
@@ -20030,32 +20037,32 @@ ${JSON.stringify(filterExp, null, 2)}
20030
20037
  return errors;
20031
20038
  }
20032
20039
  const FEATURE_OPERATORS = /* @__PURE__ */ new Set(["get", "has", "properties", "geometry-type", "id"]);
20033
- const APPEARANCES_DISALLOWED_PARAMETERS = /* @__PURE__ */ new Set([
20034
- "zoom",
20035
- "pitch",
20036
- "distance-from-center",
20037
- "feature",
20038
- "feature-state",
20039
- "measure-light",
20040
- "heatmap-density",
20041
- "line-progress",
20042
- "raster-value",
20043
- "raster-particle-speed",
20044
- "sky-radial-progress"
20045
- ]);
20046
20040
  function checkDisallowedAppearancesParameters(e, options) {
20041
+ const disallowedParameters = /* @__PURE__ */ new Set([
20042
+ "zoom",
20043
+ "pitch",
20044
+ "distance-from-center",
20045
+ "feature",
20046
+ "feature-state",
20047
+ "measure-light",
20048
+ "heatmap-density",
20049
+ "line-progress",
20050
+ "raster-value",
20051
+ "raster-particle-speed",
20052
+ "sky-radial-progress"
20053
+ ]);
20047
20054
  if (options.valueSpec && options.valueSpec.expression) {
20048
20055
  for (const param of options.valueSpec.expression.parameters) {
20049
- APPEARANCES_DISALLOWED_PARAMETERS.delete(param);
20056
+ disallowedParameters.delete(param);
20050
20057
  }
20051
20058
  }
20052
- if (APPEARANCES_DISALLOWED_PARAMETERS.size === 0) {
20059
+ if (disallowedParameters.size === 0) {
20053
20060
  return [];
20054
20061
  }
20055
20062
  const errors = [];
20056
20063
  if (e instanceof CompoundExpression) {
20057
20064
  const param = FEATURE_OPERATORS.has(e.name) ? "feature" : e.name;
20058
- if (APPEARANCES_DISALLOWED_PARAMETERS.has(param)) {
20065
+ if (disallowedParameters.has(param)) {
20059
20066
  return [new ValidationError(options.key, options.value, `["${e.name}"] is not an allowed parameter`)];
20060
20067
  }
20061
20068
  }
@@ -20347,7 +20354,7 @@ Use an identity property function instead: ${example}.`
20347
20354
  errors.push(...validateExpression({
20348
20355
  key: options.key,
20349
20356
  value: condition,
20350
- valueSpec: v8["appearance"]["condition"],
20357
+ valueSpec: options.styleSpec["appearance"]["condition"],
20351
20358
  expressionContext: "appearance"
20352
20359
  }));
20353
20360
  return errors;