@mapbox/mapbox-gl-style-spec 14.31.0-rc.1 → 14.32.0-rc.1

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.es.js CHANGED
@@ -42,14 +42,14 @@ var $root = {
42
42
  "default": 0,
43
43
  period: 360,
44
44
  units: "degrees",
45
- 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).",
45
+ 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).",
46
46
  example: 29
47
47
  },
48
48
  pitch: {
49
49
  type: "number",
50
50
  "default": 0,
51
51
  units: "degrees",
52
- 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).",
52
+ 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).",
53
53
  example: 50
54
54
  },
55
55
  light: {
@@ -1869,9 +1869,9 @@ var layout_model = {
1869
1869
  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.",
1870
1870
  "sdk-support": {
1871
1871
  "basic functionality": {
1872
- js: "0.10.0",
1873
- android: "2.0.1",
1874
- ios: "2.0.0"
1872
+ js: "3.18.0",
1873
+ android: "11.20.0",
1874
+ ios: "11.18.0"
1875
1875
  }
1876
1876
  },
1877
1877
  "property-type": "data-constant"
@@ -2258,6 +2258,7 @@ var layout_building = {
2258
2258
  maximum: 20,
2259
2259
  "default": 3.1,
2260
2260
  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).",
2261
+ units: "meters",
2261
2262
  "private": true,
2262
2263
  "property-type": "data-driven",
2263
2264
  "sdk-support": {
@@ -2425,7 +2426,7 @@ var layout_building = {
2425
2426
  units: "meters",
2426
2427
  "default": 0,
2427
2428
  minimum: 0,
2428
- doc: "The extent of the flood light effect on the walls of the buildings in meters.",
2429
+ doc: "The extent of the flood light effect on the walls of the buildings.",
2429
2430
  requires: [
2430
2431
  "lights"
2431
2432
  ],
@@ -2456,7 +2457,7 @@ var layout_building = {
2456
2457
  "private": true,
2457
2458
  units: "meters",
2458
2459
  "default": 0,
2459
- doc: "The extent of the flood light effect on the ground beneath the buildings in meters.",
2460
+ doc: "The extent of the flood light effect on the ground beneath the buildings.",
2460
2461
  requires: [
2461
2462
  "lights"
2462
2463
  ],
@@ -2485,7 +2486,6 @@ var layout_building = {
2485
2486
  "property-type": "data-driven",
2486
2487
  type: "boolean",
2487
2488
  "private": true,
2488
- units: "meters",
2489
2489
  "default": false,
2490
2490
  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.",
2491
2491
  transition: true,
@@ -2666,8 +2666,9 @@ var layout_line = {
2666
2666
  },
2667
2667
  "line-z-offset": {
2668
2668
  type: "number",
2669
- doc: "Vertical offset from ground, in meters. Not supported for globe projection at the moment.",
2669
+ doc: "Vertical offset from ground. Not supported for globe projection at the moment.",
2670
2670
  "default": 0,
2671
+ units: "meters",
2671
2672
  requires: [
2672
2673
  "line-elevation-reference"
2673
2674
  ],
@@ -5957,7 +5958,8 @@ var fog = {
5957
5958
  ],
5958
5959
  relaxZoomRestriction: true
5959
5960
  },
5960
- 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.",
5961
+ 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.",
5962
+ units: "meters",
5961
5963
  "sdk-support": {
5962
5964
  "basic functionality": {
5963
5965
  js: "3.0.0",
@@ -7098,7 +7100,7 @@ var paint_fill = {
7098
7100
  ]
7099
7101
  },
7100
7102
  requires: [
7101
- "line-pattern"
7103
+ "fill-pattern"
7102
7104
  ],
7103
7105
  "sdk-support": {
7104
7106
  "basic functionality": {
@@ -7137,7 +7139,8 @@ var paint_fill = {
7137
7139
  },
7138
7140
  "fill-z-offset": {
7139
7141
  type: "number",
7140
- 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.",
7142
+ 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.",
7143
+ units: "meters",
7141
7144
  "default": 0,
7142
7145
  minimum: 0,
7143
7146
  transition: true,
@@ -7302,7 +7305,8 @@ var paint_building = {
7302
7305
  ]
7303
7306
  },
7304
7307
  transition: true,
7305
- doc: "The extent of the ambient occlusion effect on the ground beneath the procedural buildings in meters.",
7308
+ doc: "The extent of the ambient occlusion effect on the ground beneath the procedural buildings.",
7309
+ units: "meters",
7306
7310
  "sdk-support": {
7307
7311
  "basic functionality": {
7308
7312
  js: "3.16.0",
@@ -7808,7 +7812,7 @@ var paint_line = {
7808
7812
  minimum: 0,
7809
7813
  transition: true,
7810
7814
  units: "pixels",
7811
- doc: "Blur applied to the line, in pixels.",
7815
+ doc: "Blur applied to the line.",
7812
7816
  "sdk-support": {
7813
7817
  "basic functionality": {
7814
7818
  js: "0.10.0",
@@ -8116,6 +8120,7 @@ var paint_line = {
8116
8120
  "default": 0,
8117
8121
  minimum: 0,
8118
8122
  transition: true,
8123
+ units: "pixels",
8119
8124
  "sdk-support": {
8120
8125
  "basic functionality": {
8121
8126
  js: "3.0.0",
@@ -8286,7 +8291,7 @@ var paint_line = {
8286
8291
  "default": 0,
8287
8292
  minimum: 0,
8288
8293
  units: "meters",
8289
- doc: "Depth offset along the camera, in meters. When set to a non-zero value, applied cutout opacity is 0.",
8294
+ doc: "Depth offset along the camera. When set to a non-zero value, applied cutout opacity is 0.",
8290
8295
  experimental: true,
8291
8296
  "private": true,
8292
8297
  transition: true,
@@ -8656,7 +8661,7 @@ var paint_heatmap = {
8656
8661
  minimum: 1,
8657
8662
  transition: true,
8658
8663
  units: "pixels",
8659
- 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.",
8664
+ 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.",
8660
8665
  "sdk-support": {
8661
8666
  "basic functionality": {
8662
8667
  js: "0.41.0",
@@ -9493,7 +9498,8 @@ var paint_symbol = {
9493
9498
  },
9494
9499
  "symbol-z-offset": {
9495
9500
  type: "number",
9496
- doc: "Specifies an uniform elevation from the ground, in meters.",
9501
+ doc: "Specifies an uniform elevation from the ground.",
9502
+ units: "meters",
9497
9503
  "default": 0,
9498
9504
  minimum: 0,
9499
9505
  transition: true,
@@ -9929,10 +9935,11 @@ var paint_raster = {
9929
9935
  },
9930
9936
  "raster-elevation": {
9931
9937
  type: "number",
9932
- doc: "Defines an uniform elevation from the base specified in raster-elevation-reference, in meters.",
9938
+ doc: "Defines an uniform elevation from the base specified in raster-elevation-reference.",
9933
9939
  "default": 0,
9934
9940
  minimum: 0,
9935
9941
  transition: true,
9942
+ units: "meters",
9936
9943
  experimental: true,
9937
9944
  "sdk-support": {
9938
9945
  "basic functionality": {
@@ -9983,6 +9990,7 @@ var paint_hillshade = {
9983
9990
  minimum: 0,
9984
9991
  maximum: 359,
9985
9992
  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.",
9993
+ units: "degrees",
9986
9994
  transition: false,
9987
9995
  "sdk-support": {
9988
9996
  "basic functionality": {
@@ -10398,7 +10406,8 @@ var paint_sky = {
10398
10406
  minimum: 0,
10399
10407
  maximum: 180,
10400
10408
  transition: false,
10401
- 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`.",
10409
+ 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`.",
10410
+ units: "degrees",
10402
10411
  "sdk-support": {
10403
10412
  "basic functionality": {
10404
10413
  js: "2.0.0",
@@ -10646,7 +10655,8 @@ var paint_model = {
10646
10655
  }
10647
10656
  },
10648
10657
  transition: true,
10649
- doc: "The translation of the model in meters in form of [longitudal, latitudal, altitude] offsets."
10658
+ units: "meters",
10659
+ doc: "The translation of the model in form of [longitudal, latitudal, altitude] offsets."
10650
10660
  },
10651
10661
  "model-color": {
10652
10662
  type: "color",
@@ -11179,7 +11189,8 @@ var v8 = {
11179
11189
  "default": 0,
11180
11190
  minimum: 0,
11181
11191
  maximum: 1,
11182
- doc: "Radius of a fill extrusion edge in meters. If not zero, rounds extrusion edges for a smoother appearance.",
11192
+ doc: "Radius of a fill extrusion edge. If not zero, rounds extrusion edges for a smoother appearance.",
11193
+ units: "meters",
11183
11194
  "sdk-support": {
11184
11195
  "basic functionality": {
11185
11196
  js: "3.0.0",
@@ -11520,7 +11531,7 @@ var v8 = {
11520
11531
  ]
11521
11532
  },
11522
11533
  requires: [
11523
- "line-pattern"
11534
+ "fill-extrusion-pattern"
11524
11535
  ],
11525
11536
  "sdk-support": {
11526
11537
  "basic functionality": {
@@ -11747,7 +11758,8 @@ var v8 = {
11747
11758
  ]
11748
11759
  },
11749
11760
  transition: true,
11750
- doc: "The extent of the ambient occlusion effect on the ground beneath the extruded buildings in meters.",
11761
+ doc: "The extent of the ambient occlusion effect on the ground beneath the extruded buildings.",
11762
+ units: "meters",
11751
11763
  requires: [
11752
11764
  "lights"
11753
11765
  ],
@@ -11845,7 +11857,7 @@ var v8 = {
11845
11857
  units: "meters",
11846
11858
  "default": 0,
11847
11859
  minimum: 0,
11848
- doc: "The extent of the flood light effect on the walls of the extruded buildings in meters.",
11860
+ doc: "The extent of the flood light effect on the walls of the extruded buildings.",
11849
11861
  requires: [
11850
11862
  "lights"
11851
11863
  ],
@@ -11876,7 +11888,7 @@ var v8 = {
11876
11888
  experimental: true,
11877
11889
  units: "meters",
11878
11890
  "default": 0,
11879
- 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.",
11891
+ 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.",
11880
11892
  requires: [
11881
11893
  "lights"
11882
11894
  ],
@@ -12244,10 +12256,11 @@ var v8 = {
12244
12256
  },
12245
12257
  "raster-particle-elevation": {
12246
12258
  type: "number",
12247
- doc: "Defines an uniform elevation from sea level, in meters.",
12259
+ doc: "Defines an uniform elevation from sea level.",
12248
12260
  "default": 0,
12249
12261
  minimum: 0,
12250
12262
  transition: true,
12263
+ units: "meters",
12251
12264
  "sdk-support": {
12252
12265
  "basic functionality": {
12253
12266
  js: "3.7.0",
@@ -12405,11 +12418,11 @@ function sortKeysBy(obj, reference2) {
12405
12418
  return result;
12406
12419
  }
12407
12420
  function format(style, space = 2) {
12408
- style = sortKeysBy(style, v8.$root);
12409
- if (style.layers) {
12410
- style.layers = style.layers.map((layer) => sortKeysBy(layer, v8.layer));
12421
+ const sorted = sortKeysBy(style, v8.$root);
12422
+ if (sorted.layers) {
12423
+ sorted.layers = sorted.layers.map((layer) => sortKeysBy(layer, v8.layer));
12411
12424
  }
12412
- return stringify(style, { indent: space });
12425
+ return stringify(sorted, { indent: space });
12413
12426
  }
12414
12427
 
12415
12428
  function getPropertyReference(propertyName) {
@@ -12662,34 +12675,15 @@ function toString$1(type) {
12662
12675
  return type.kind;
12663
12676
  }
12664
12677
  }
12665
- const valueMemberTypes = [
12666
- NullType,
12667
- NumberType,
12668
- StringType,
12669
- BooleanType,
12670
- ColorType,
12671
- FormattedType,
12672
- ObjectType,
12673
- array$1(ValueType),
12674
- ResolvedImageType
12675
- ];
12676
12678
  function checkSubtype(expected, t) {
12677
- if (t.kind === "error") {
12678
- return null;
12679
- } else if (expected.kind === "array") {
12680
- if (t.kind === "array" && (t.N === 0 && t.itemType.kind === "value" || !checkSubtype(expected.itemType, t.itemType)) && (typeof expected.N !== "number" || expected.N === t.N)) {
12681
- return null;
12682
- }
12683
- } else if (expected.kind === t.kind) {
12684
- return null;
12685
- } else if (expected.kind === "value") {
12686
- for (const memberType of valueMemberTypes) {
12687
- if (!checkSubtype(memberType, t)) {
12688
- return null;
12689
- }
12690
- }
12679
+ return isSubtype(expected, t) ? null : `Expected ${toString$1(expected)} but found ${toString$1(t)} instead.`;
12680
+ }
12681
+ function isSubtype(expected, t) {
12682
+ if (t.kind === "error") return true;
12683
+ if (expected.kind === "array") {
12684
+ return t.kind === "array" && (t.N === 0 && t.itemType.kind === "value" || isSubtype(expected.itemType, t.itemType)) && (typeof expected.N !== "number" || expected.N === t.N);
12691
12685
  }
12692
- return `Expected ${toString$1(expected)} but found ${toString$1(t)} instead.`;
12686
+ return expected.kind === t.kind || expected.kind === "value" && t.kind !== "collator";
12693
12687
  }
12694
12688
  function isValidType(provided, allowedTypes) {
12695
12689
  return allowedTypes.some((t) => t.kind === provided.kind);
@@ -15208,6 +15202,21 @@ function isGlobalPropertyConstantSet(e, properties) {
15208
15202
  function isGlobalPropertyConstant(e, properties) {
15209
15203
  return isGlobalPropertyConstantSet(e, new Set(properties));
15210
15204
  }
15205
+ const GlobalDependency = { Zoom: 1, Light: 2, LineProgress: 4 };
15206
+ const globalDependencyFlags = {
15207
+ "zoom": GlobalDependency.Zoom,
15208
+ "pitch": GlobalDependency.Zoom,
15209
+ "distance-from-center": GlobalDependency.Zoom,
15210
+ "measure-light": GlobalDependency.Light,
15211
+ "line-progress": GlobalDependency.LineProgress
15212
+ };
15213
+ function getGlobalDependencies(e) {
15214
+ let flags = e instanceof CompoundExpression ? globalDependencyFlags[e.name] || 0 : 0;
15215
+ e.eachChild((arg) => {
15216
+ flags |= getGlobalDependencies(arg);
15217
+ });
15218
+ return flags;
15219
+ }
15211
15220
 
15212
15221
  const RE = 6378.137;
15213
15222
  const FE = 1 / 298.257223563;
@@ -15890,7 +15899,7 @@ class ParsingContext {
15890
15899
  * @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.
15891
15900
  * @private
15892
15901
  */
15893
- parse(expr, index, expectedType, bindings, options = {}) {
15902
+ parse(expr, index, expectedType, bindings, options) {
15894
15903
  if (index || expectedType) {
15895
15904
  const prevExpectedType = this.expectedType;
15896
15905
  const prevScope = this.scope;
@@ -15914,7 +15923,7 @@ class ParsingContext {
15914
15923
  * @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.
15915
15924
  * @private
15916
15925
  */
15917
- parseObjectValue(expr, index, key, expectedType, bindings, options = {}) {
15926
+ parseObjectValue(expr, index, key, expectedType, bindings, options) {
15918
15927
  const prevExpectedType = this.expectedType;
15919
15928
  const prevScope = this.scope;
15920
15929
  if (bindings) this.scope = this.scope.concat(bindings);
@@ -15928,41 +15937,34 @@ class ParsingContext {
15928
15937
  this.scope = prevScope;
15929
15938
  return result;
15930
15939
  }
15931
- _parse(expr, options) {
15932
- if (expr === null || typeof expr === "string" || typeof expr === "boolean" || typeof expr === "number") {
15933
- expr = ["literal", expr];
15940
+ // Applies `expectedType` to a freshly parsed expression, wrapping it in an inferred assertion
15941
+ // or coercion where that is what the expected type calls for. Returns null if the type is wrong.
15942
+ _annotateToExpectedType(parsed, options) {
15943
+ const expected = this.expectedType;
15944
+ if (!expected) return parsed;
15945
+ const actual = parsed.type;
15946
+ if ((expected.kind === "string" || expected.kind === "number" || expected.kind === "boolean" || expected.kind === "object" || expected.kind === "array") && actual.kind === "value") {
15947
+ return annotate(parsed, expected, options?.typeAnnotation || "assert");
15948
+ } else if ((expected.kind === "color" || expected.kind === "formatted" || expected.kind === "resolvedImage") && (actual.kind === "value" || actual.kind === "string")) {
15949
+ return annotate(parsed, expected, options?.typeAnnotation || "coerce");
15950
+ } else if (this.checkSubtype(expected, actual)) {
15951
+ return null;
15934
15952
  }
15935
- if (Array.isArray(expr)) {
15953
+ return parsed;
15954
+ }
15955
+ _parse(expr, options) {
15956
+ const scalarType = expr === null ? NullType : typeof expr === "string" ? StringType : typeof expr === "boolean" ? BooleanType : typeof expr === "number" ? NumberType : null;
15957
+ let result;
15958
+ if (scalarType) {
15959
+ result = new Literal(scalarType, expr);
15960
+ } else if (Array.isArray(expr)) {
15936
15961
  if (expr.length === 0) {
15937
15962
  return this.error(`Expected an array with at least one element. If you wanted a literal array, use ["literal", []].`);
15938
15963
  }
15939
- const Expr = typeof expr[0] === "string" && Object.hasOwn(this.registry, expr[0]) ? this.registry[expr[0]] : void 0;
15940
- if (Expr) {
15941
- let parsed = Expr.parse(expr, this);
15942
- if (!parsed) return null;
15943
- if (this.expectedType) {
15944
- const expected = this.expectedType;
15945
- const actual = parsed.type;
15946
- if ((expected.kind === "string" || expected.kind === "number" || expected.kind === "boolean" || expected.kind === "object" || expected.kind === "array") && actual.kind === "value") {
15947
- parsed = annotate(parsed, expected, options.typeAnnotation || "assert");
15948
- } else if ((expected.kind === "color" || expected.kind === "formatted" || expected.kind === "resolvedImage") && (actual.kind === "value" || actual.kind === "string")) {
15949
- parsed = annotate(parsed, expected, options.typeAnnotation || "coerce");
15950
- } else if (this.checkSubtype(expected, actual)) {
15951
- return null;
15952
- }
15953
- }
15954
- if (!(parsed instanceof Literal) && parsed.type.kind !== "resolvedImage" && isConstant(parsed)) {
15955
- const ec = new EvaluationContext(this._scope, this.options, this.iconImageUseTheme);
15956
- try {
15957
- parsed = new Literal(parsed.type, parsed.evaluate(ec));
15958
- } catch (e) {
15959
- this.error(e.message);
15960
- return null;
15961
- }
15962
- }
15963
- return parsed;
15964
- }
15965
- return Coercion.parse(["to-array", expr], this);
15964
+ const Expr = this.registry[expr[0]];
15965
+ if (!Expr) return Coercion.parse(["to-array", expr], this);
15966
+ result = Expr.parse(expr, this);
15967
+ if (!result) return null;
15966
15968
  } else if (typeof expr === "undefined") {
15967
15969
  return this.error(`'undefined' value invalid. Use null instead.`);
15968
15970
  } else if (typeof expr === "object") {
@@ -15970,6 +15972,18 @@ class ParsingContext {
15970
15972
  } else {
15971
15973
  return this.error(`Expected an array, but found ${typeof expr} instead.`);
15972
15974
  }
15975
+ let parsed = this._annotateToExpectedType(result, options);
15976
+ if (!parsed) return null;
15977
+ if (!(parsed instanceof Literal) && parsed.type.kind !== "resolvedImage" && isConstant(parsed)) {
15978
+ const ec = new EvaluationContext(this._scope, this.options, this.iconImageUseTheme);
15979
+ try {
15980
+ parsed = new Literal(parsed.type, parsed.evaluate(ec));
15981
+ } catch (e) {
15982
+ this.error(e.message);
15983
+ return null;
15984
+ }
15985
+ }
15986
+ return parsed;
15973
15987
  }
15974
15988
  /**
15975
15989
  * Returns a copy of this context suitable for parsing the subexpression at
@@ -16001,10 +16015,12 @@ class ParsingContext {
16001
16015
  * overload signatures without polluting the parent errors list.
16002
16016
  * @private
16003
16017
  */
16018
+ // `path` is shared rather than copied: argument parsing pushes and pops it in balance, and
16019
+ // `error` snapshots `key` into the message eagerly, so the fork never observes a stale path.
16004
16020
  _forkForSignature() {
16005
16021
  return new ParsingContext(
16006
16022
  this.registry,
16007
- this.path.slice(),
16023
+ this.path,
16008
16024
  null,
16009
16025
  this.scope,
16010
16026
  [],
@@ -17228,7 +17244,7 @@ function mulberry32(a) {
17228
17244
  };
17229
17245
  }
17230
17246
 
17231
- const expressions = {
17247
+ const expressions = Object.assign(/* @__PURE__ */ Object.create(null), {
17232
17248
  // special forms
17233
17249
  "==": Equals,
17234
17250
  "!=": NotEquals,
@@ -17266,7 +17282,7 @@ const expressions = {
17266
17282
  "within": Within,
17267
17283
  "distance": Distance,
17268
17284
  "config": Config
17269
- };
17285
+ });
17270
17286
  function rgba(ctx, [r, g, b, a]) {
17271
17287
  r = r.evaluate(ctx);
17272
17288
  g = g.evaluate(ctx);
@@ -17939,28 +17955,22 @@ CompoundExpression.register(expressions, {
17939
17955
  ]
17940
17956
  });
17941
17957
 
17942
- function getConfigDependencies(e) {
17958
+ const NO_CONFIG_DEPENDENCIES = /* @__PURE__ */ new Set();
17959
+ function collect(e, deps) {
17943
17960
  if (e instanceof Config) {
17944
- const singleConfig = /* @__PURE__ */ new Set([e.key]);
17945
- return singleConfig;
17961
+ if (deps.configDependencies === NO_CONFIG_DEPENDENCIES) deps.configDependencies = /* @__PURE__ */ new Set();
17962
+ deps.configDependencies.add(e.key);
17963
+ return;
17946
17964
  }
17947
- let result = /* @__PURE__ */ new Set();
17965
+ if (e instanceof CompoundExpression && e.name === "is-active-floor") deps.isIndoorDependent = true;
17948
17966
  e.eachChild((arg) => {
17949
- result = /* @__PURE__ */ new Set([...result, ...getConfigDependencies(arg)]);
17967
+ collect(arg, deps);
17950
17968
  });
17951
- return result;
17952
17969
  }
17953
- function isIndoorDependent(e) {
17954
- if (e instanceof CompoundExpression && e.name === "is-active-floor") {
17955
- return true;
17956
- }
17957
- let result = false;
17958
- e.eachChild((arg) => {
17959
- if (!result && isIndoorDependent(arg)) {
17960
- result = true;
17961
- }
17962
- });
17963
- return result;
17970
+ function getExpressionDependencies(e) {
17971
+ const deps = { configDependencies: NO_CONFIG_DEPENDENCIES, isIndoorDependent: false };
17972
+ collect(e, deps);
17973
+ return deps;
17964
17974
  }
17965
17975
 
17966
17976
  function success(value) {
@@ -17997,7 +18007,8 @@ function isFunction(value) {
17997
18007
  function identityFunction(x) {
17998
18008
  return x;
17999
18009
  }
18000
- function createFunction(parameters, propertySpec) {
18010
+ function createFunction(input, propertySpec) {
18011
+ let parameters = input;
18001
18012
  const isColor = propertySpec.type === "color";
18002
18013
  const zoomAndFeatureDependent = parameters.stops && typeof parameters.stops[0][0] === "object";
18003
18014
  const featureDependent = zoomAndFeatureDependent || parameters.property !== void 0;
@@ -18046,13 +18057,9 @@ function createFunction(parameters, propertySpec) {
18046
18057
  const zoom = stop[0].zoom;
18047
18058
  if (featureFunctions[zoom] === void 0) {
18048
18059
  featureFunctions[zoom] = {
18049
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
18050
18060
  zoom,
18051
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
18052
18061
  type: parameters.type,
18053
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
18054
18062
  property: parameters.property,
18055
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
18056
18063
  default: parameters.default,
18057
18064
  stops: []
18058
18065
  };
@@ -18069,29 +18076,21 @@ function createFunction(parameters, propertySpec) {
18069
18076
  kind: "composite",
18070
18077
  interpolationType,
18071
18078
  interpolationFactor: Interpolate.interpolationFactor.bind(void 0, interpolationType),
18072
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
18073
18079
  zoomStops: featureFunctionStops.map((s) => s[0]),
18074
18080
  evaluate({ zoom }, properties) {
18075
18081
  return evaluateExponentialFunction({
18076
18082
  stops: featureFunctionStops,
18077
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
18078
18083
  base: parameters.base
18079
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
18080
18084
  }, propertySpec, zoom).evaluate(zoom, properties);
18081
18085
  }
18082
18086
  };
18083
18087
  } else if (zoomDependent) {
18084
- const interpolationType = type === "exponential" ? (
18085
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
18086
- { name: "exponential", base: parameters.base !== void 0 ? parameters.base : 1 }
18087
- ) : null;
18088
+ const interpolationType = type === "exponential" ? { name: "exponential", base: parameters.base !== void 0 ? parameters.base : 1 } : null;
18088
18089
  return {
18089
18090
  kind: "camera",
18090
18091
  interpolationType,
18091
18092
  interpolationFactor: Interpolate.interpolationFactor.bind(void 0, interpolationType),
18092
- // 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
18093
18093
  zoomStops: parameters.stops.map((s) => s[0]),
18094
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
18095
18094
  evaluate: ({ zoom }) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)
18096
18095
  };
18097
18096
  } else {
@@ -18118,31 +18117,26 @@ function evaluateCategoricalFunction(parameters, propertySpec, input, hashedStop
18118
18117
  }
18119
18118
  function evaluateIntervalFunction(parameters, propertySpec, input) {
18120
18119
  if (!isNumber(input)) return coalesce$1(parameters.default, propertySpec.default);
18121
- const n = parameters.stops.length;
18122
- if (n === 1) return parameters.stops[0][1];
18123
- if (input <= parameters.stops[0][0]) return parameters.stops[0][1];
18124
- if (input >= parameters.stops[n - 1][0]) return parameters.stops[n - 1][1];
18125
- const index = findStopLessThanOrEqualTo(parameters.stops.map((stop) => stop[0]), input);
18126
- return parameters.stops[index][1];
18120
+ const stops = parameters.stops;
18121
+ const n = stops.length;
18122
+ if (n === 1) return stops[0][1];
18123
+ if (input <= stops[0][0]) return stops[0][1];
18124
+ if (input >= stops[n - 1][0]) return stops[n - 1][1];
18125
+ const index = findStopLessThanOrEqualTo(stops.map((stop) => stop[0]), input);
18126
+ return stops[index][1];
18127
18127
  }
18128
18128
  function evaluateExponentialFunction(parameters, propertySpec, input) {
18129
18129
  const base = parameters.base !== void 0 ? parameters.base : 1;
18130
18130
  if (!isNumber(input)) return coalesce$1(parameters.default, propertySpec.default);
18131
- const n = parameters.stops.length;
18132
- if (n === 1) return parameters.stops[0][1];
18133
- if (input <= parameters.stops[0][0]) return parameters.stops[0][1];
18134
- if (input >= parameters.stops[n - 1][0]) return parameters.stops[n - 1][1];
18135
- const index = findStopLessThanOrEqualTo(parameters.stops.map((stop) => stop[0]), input);
18136
- const t = interpolationFactor(
18137
- input,
18138
- base,
18139
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
18140
- parameters.stops[index][0],
18141
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
18142
- parameters.stops[index + 1][0]
18143
- );
18144
- const outputLower = parameters.stops[index][1];
18145
- const outputUpper = parameters.stops[index + 1][1];
18131
+ const stops = parameters.stops;
18132
+ const n = stops.length;
18133
+ if (n === 1) return stops[0][1];
18134
+ if (input <= stops[0][0]) return stops[0][1];
18135
+ if (input >= stops[n - 1][0]) return stops[n - 1][1];
18136
+ const index = findStopLessThanOrEqualTo(stops.map((stop) => stop[0]), input);
18137
+ const t = interpolationFactor(input, base, stops[index][0], stops[index + 1][0]);
18138
+ const outputLower = stops[index][1];
18139
+ const outputUpper = stops[index + 1][1];
18146
18140
  let interp = interpolate[propertySpec.type] || identityFunction;
18147
18141
  if (parameters.colorSpace && parameters.colorSpace !== "rgb") {
18148
18142
  const colorspace = colorSpaces[parameters.colorSpace];
@@ -18196,8 +18190,9 @@ class StyleExpression {
18196
18190
  this._evaluator = new EvaluationContext(scope, options, iconImageUseTheme);
18197
18191
  this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
18198
18192
  this._enumValues = propertySpec && propertySpec.type === "enum" ? propertySpec.values : null;
18199
- this.configDependencies = getConfigDependencies(expression);
18200
- this.isIndoorDependent = isIndoorDependent(expression);
18193
+ const dependencies = getExpressionDependencies(expression);
18194
+ this.configDependencies = dependencies.configDependencies;
18195
+ this.isIndoorDependent = dependencies.isIndoorDependent;
18201
18196
  }
18202
18197
  evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection, featureTileCoord, featureDistanceData) {
18203
18198
  const evaluator = this._evaluator;
@@ -18269,8 +18264,8 @@ class ZoomConstantExpression {
18269
18264
  this.isLightConstant = isLightConstant;
18270
18265
  this.isLineProgressConstant = isLineProgressConstant;
18271
18266
  this.isStateDependent = kind !== "constant" && !isStateConstant(expression.expression);
18272
- this.configDependencies = getConfigDependencies(expression.expression);
18273
- this.isIndoorDependent = isIndoorDependent(expression.expression);
18267
+ this.configDependencies = expression.configDependencies;
18268
+ this.isIndoorDependent = expression.isIndoorDependent;
18274
18269
  }
18275
18270
  evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {
18276
18271
  return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);
@@ -18285,10 +18280,10 @@ class ZoomDependentExpression {
18285
18280
  this.zoomStops = zoomStops;
18286
18281
  this._styleExpression = expression;
18287
18282
  this.isStateDependent = kind !== "camera" && !isStateConstant(expression.expression);
18288
- this.isIndoorDependent = isIndoorDependent(expression.expression);
18283
+ this.isIndoorDependent = expression.isIndoorDependent;
18289
18284
  this.isLightConstant = isLightConstant;
18290
18285
  this.isLineProgressConstant = isLineProgressConstant;
18291
- this.configDependencies = getConfigDependencies(expression.expression);
18286
+ this.configDependencies = expression.configDependencies;
18292
18287
  this.interpolationType = interpolationType;
18293
18288
  }
18294
18289
  evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {
@@ -18306,24 +18301,25 @@ class ZoomDependentExpression {
18306
18301
  }
18307
18302
  }
18308
18303
  function createPropertyExpression(expression, propertySpec, scope, options, iconImageUseTheme) {
18309
- expression = createExpression(expression, propertySpec, scope, options, iconImageUseTheme);
18310
- if (expression.result === "error") {
18311
- return expression;
18304
+ const styleExpression = createExpression(expression, propertySpec, scope, options, iconImageUseTheme);
18305
+ if (styleExpression.result === "error") {
18306
+ return styleExpression;
18312
18307
  }
18313
- const parsed = expression.value.expression;
18308
+ const parsed = styleExpression.value.expression;
18314
18309
  const isFeatureConstant$1 = isFeatureConstant(parsed);
18315
18310
  if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {
18316
18311
  return error([new ParsingError$1("", "data expressions not supported")]);
18317
18312
  }
18318
- const isZoomConstant = isGlobalPropertyConstant(parsed, ["zoom", "pitch", "distance-from-center"]);
18313
+ const globalDependencies = getGlobalDependencies(parsed);
18314
+ const isZoomConstant = (globalDependencies & GlobalDependency.Zoom) === 0;
18319
18315
  if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
18320
18316
  return error([new ParsingError$1("", "zoom expressions not supported")]);
18321
18317
  }
18322
- const isLightConstant = isGlobalPropertyConstant(parsed, ["measure-light"]);
18318
+ const isLightConstant = (globalDependencies & GlobalDependency.Light) === 0;
18323
18319
  if (!isLightConstant && !supportsLightExpression(propertySpec)) {
18324
18320
  return error([new ParsingError$1("", "measure-light expression not supported")]);
18325
18321
  }
18326
- const isLineProgressConstant = isGlobalPropertyConstant(parsed, ["line-progress"]);
18322
+ const isLineProgressConstant = (globalDependencies & GlobalDependency.LineProgress) === 0;
18327
18323
  if (!isLineProgressConstant && !supportsLineProgressExpression(propertySpec)) {
18328
18324
  return error([new ParsingError$1("", "line-progress expression not supported")]);
18329
18325
  }
@@ -18337,22 +18333,10 @@ function createPropertyExpression(expression, propertySpec, scope, options, icon
18337
18333
  return error([new ParsingError$1("", '"interpolate" expressions cannot be used with this property')]);
18338
18334
  }
18339
18335
  if (!zoomCurve) {
18340
- return success(isFeatureConstant$1 && isLineProgressConstant ? (
18341
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
18342
- new ZoomConstantExpression("constant", expression.value, isLightConstant, isLineProgressConstant)
18343
- ) : (
18344
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
18345
- new ZoomConstantExpression("source", expression.value, isLightConstant, isLineProgressConstant)
18346
- ));
18336
+ return success(isFeatureConstant$1 && isLineProgressConstant ? new ZoomConstantExpression("constant", styleExpression.value, isLightConstant, isLineProgressConstant) : new ZoomConstantExpression("source", styleExpression.value, isLightConstant, isLineProgressConstant));
18347
18337
  }
18348
18338
  const interpolationType = zoomCurve instanceof Interpolate ? zoomCurve.interpolation : void 0;
18349
- return success(isFeatureConstant$1 && isLineProgressConstant ? (
18350
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
18351
- new ZoomDependentExpression("camera", expression.value, zoomCurve.labels, interpolationType, isLightConstant, isLineProgressConstant)
18352
- ) : (
18353
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
18354
- new ZoomDependentExpression("composite", expression.value, zoomCurve.labels, interpolationType, isLightConstant, isLineProgressConstant)
18355
- ));
18339
+ 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));
18356
18340
  }
18357
18341
  class StylePropertyFunction {
18358
18342
  constructor(parameters, specification) {
@@ -18793,6 +18777,7 @@ function collapseDynamicBooleanExpressions(expression) {
18793
18777
  }
18794
18778
  }
18795
18779
  function unionDynamicBranches(filter) {
18780
+ if (!Array.isArray(filter)) return;
18796
18781
  let isBranchingDynamically = false;
18797
18782
  const branches = [];
18798
18783
  if (filter[0] === "case") {
@@ -20024,32 +20009,32 @@ function disallowedFilterParameters(e, options) {
20024
20009
  return errors;
20025
20010
  }
20026
20011
  const FEATURE_OPERATORS = /* @__PURE__ */ new Set(["get", "has", "properties", "geometry-type", "id"]);
20027
- const APPEARANCES_DISALLOWED_PARAMETERS = /* @__PURE__ */ new Set([
20028
- "zoom",
20029
- "pitch",
20030
- "distance-from-center",
20031
- "feature",
20032
- "feature-state",
20033
- "measure-light",
20034
- "heatmap-density",
20035
- "line-progress",
20036
- "raster-value",
20037
- "raster-particle-speed",
20038
- "sky-radial-progress"
20039
- ]);
20040
20012
  function checkDisallowedAppearancesParameters(e, options) {
20013
+ const disallowedParameters = /* @__PURE__ */ new Set([
20014
+ "zoom",
20015
+ "pitch",
20016
+ "distance-from-center",
20017
+ "feature",
20018
+ "feature-state",
20019
+ "measure-light",
20020
+ "heatmap-density",
20021
+ "line-progress",
20022
+ "raster-value",
20023
+ "raster-particle-speed",
20024
+ "sky-radial-progress"
20025
+ ]);
20041
20026
  if (options.valueSpec && options.valueSpec.expression) {
20042
20027
  for (const param of options.valueSpec.expression.parameters) {
20043
- APPEARANCES_DISALLOWED_PARAMETERS.delete(param);
20028
+ disallowedParameters.delete(param);
20044
20029
  }
20045
20030
  }
20046
- if (APPEARANCES_DISALLOWED_PARAMETERS.size === 0) {
20031
+ if (disallowedParameters.size === 0) {
20047
20032
  return [];
20048
20033
  }
20049
20034
  const errors = [];
20050
20035
  if (e instanceof CompoundExpression) {
20051
20036
  const param = FEATURE_OPERATORS.has(e.name) ? "feature" : e.name;
20052
- if (APPEARANCES_DISALLOWED_PARAMETERS.has(param)) {
20037
+ if (disallowedParameters.has(param)) {
20053
20038
  return [new ValidationError(options.key, options.value, `["${e.name}"] is not an allowed parameter`)];
20054
20039
  }
20055
20040
  }
@@ -20341,7 +20326,7 @@ function validateCondition(options) {
20341
20326
  errors.push(...validateExpression({
20342
20327
  key: options.key,
20343
20328
  value: condition,
20344
- valueSpec: v8["appearance"]["condition"],
20329
+ valueSpec: options.styleSpec["appearance"]["condition"],
20345
20330
  expressionContext: "appearance"
20346
20331
  }));
20347
20332
  return errors;