@mapbox/mapbox-gl-style-spec 14.14.0-beta.2 → 14.15.0-alpha.ffa987fef46

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.
Files changed (44) hide show
  1. package/composite.ts +5 -8
  2. package/dist/index.cjs +53 -27
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.ts +48 -24
  5. package/dist/index.es.js +53 -27
  6. package/dist/index.es.js.map +1 -1
  7. package/expression/compound_expression.ts +1 -1
  8. package/expression/definitions/config.ts +1 -1
  9. package/expression/definitions/distance.ts +2 -3
  10. package/expression/definitions/image.ts +1 -1
  11. package/expression/definitions/index.ts +4 -20
  12. package/expression/definitions/interpolate.ts +6 -9
  13. package/expression/definitions/within.ts +14 -15
  14. package/expression/evaluation_context.ts +3 -1
  15. package/expression/index.ts +18 -11
  16. package/expression/parsing_context.ts +7 -3
  17. package/group_by_layout.ts +3 -6
  18. package/migrate.ts +6 -8
  19. package/package.json +1 -1
  20. package/read_style.ts +1 -2
  21. package/reference/v8.json +26 -0
  22. package/types.ts +35 -13
  23. package/util/geometry_util.ts +1 -2
  24. package/validate/validate.ts +5 -6
  25. package/validate/validate_array.ts +2 -2
  26. package/validate/validate_enum.ts +2 -2
  27. package/validate/validate_expression.ts +1 -2
  28. package/validate/validate_filter.ts +3 -4
  29. package/validate/validate_fog.ts +2 -5
  30. package/validate/validate_function.ts +6 -10
  31. package/validate/validate_iconset.ts +1 -2
  32. package/validate/validate_layer.ts +1 -2
  33. package/validate/validate_light.ts +1 -4
  34. package/validate/validate_lights.ts +1 -7
  35. package/validate/validate_model.ts +1 -4
  36. package/validate/validate_projection.ts +1 -2
  37. package/validate/validate_property.ts +3 -7
  38. package/validate/validate_rain.ts +1 -4
  39. package/validate/validate_snow.ts +1 -4
  40. package/validate/validate_source.ts +2 -3
  41. package/validate/validate_terrain.ts +1 -5
  42. package/validate_mapbox_api_supported.ts +2 -4
  43. package/validate_style.ts +1 -2
  44. 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;
@@ -904,6 +896,7 @@ type SymbolLayerSpecification = {
904
896
  number
905
897
  ]>;
906
898
  "icon-image"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>;
899
+ "icon-image-use-theme"?: PropertyValueSpecification<string>;
907
900
  "icon-rotate"?: DataDrivenPropertyValueSpecification<number>;
908
901
  "icon-padding"?: PropertyValueSpecification<number>;
909
902
  "icon-keep-upright"?: PropertyValueSpecification<boolean>;
@@ -1000,6 +993,7 @@ type SymbolLayerSpecification = {
1000
993
  "symbol-z-offset"?: DataDrivenPropertyValueSpecification<number>;
1001
994
  "symbol-z-offset-transition"?: TransitionSpecification;
1002
995
  };
996
+ "appearances"?: Array<AppearanceSpecification>;
1003
997
  };
1004
998
  type CircleLayerSpecification = {
1005
999
  "id": string;
@@ -1047,6 +1041,7 @@ type CircleLayerSpecification = {
1047
1041
  "circle-emissive-strength"?: PropertyValueSpecification<number>;
1048
1042
  "circle-emissive-strength-transition"?: TransitionSpecification;
1049
1043
  };
1044
+ "appearances"?: Array<AppearanceSpecification>;
1050
1045
  };
1051
1046
  type HeatmapLayerSpecification = {
1052
1047
  "id": string;
@@ -1072,6 +1067,7 @@ type HeatmapLayerSpecification = {
1072
1067
  "heatmap-opacity"?: PropertyValueSpecification<number>;
1073
1068
  "heatmap-opacity-transition"?: TransitionSpecification;
1074
1069
  };
1070
+ "appearances"?: Array<AppearanceSpecification>;
1075
1071
  };
1076
1072
  type FillExtrusionLayerSpecification = {
1077
1073
  "id": string;
@@ -1181,6 +1177,7 @@ type FillExtrusionLayerSpecification = {
1181
1177
  "fill-extrusion-line-width-transition"?: TransitionSpecification;
1182
1178
  "fill-extrusion-cast-shadows"?: boolean;
1183
1179
  };
1180
+ "appearances"?: Array<AppearanceSpecification>;
1184
1181
  };
1185
1182
  type BuildingLayerSpecification = {
1186
1183
  "id": string;
@@ -1274,6 +1271,7 @@ type BuildingLayerSpecification = {
1274
1271
  "building-facade-emissive-chance"?: PropertyValueSpecification<number>;
1275
1272
  "building-cutoff-fade-range"?: ExpressionSpecification;
1276
1273
  };
1274
+ "appearances"?: Array<AppearanceSpecification>;
1277
1275
  };
1278
1276
  type RasterLayerSpecification = {
1279
1277
  "id": string;
@@ -1329,6 +1327,7 @@ type RasterLayerSpecification = {
1329
1327
  "raster-elevation"?: PropertyValueSpecification<number>;
1330
1328
  "raster-elevation-transition"?: TransitionSpecification;
1331
1329
  };
1330
+ "appearances"?: Array<AppearanceSpecification>;
1332
1331
  };
1333
1332
  type RasterParticleLayerSpecification = {
1334
1333
  "id": string;
@@ -1357,6 +1356,7 @@ type RasterParticleLayerSpecification = {
1357
1356
  "raster-particle-elevation"?: PropertyValueSpecification<number>;
1358
1357
  "raster-particle-elevation-transition"?: TransitionSpecification;
1359
1358
  };
1359
+ "appearances"?: Array<AppearanceSpecification>;
1360
1360
  };
1361
1361
  type HillshadeLayerSpecification = {
1362
1362
  "id": string;
@@ -1388,6 +1388,7 @@ type HillshadeLayerSpecification = {
1388
1388
  "hillshade-emissive-strength"?: PropertyValueSpecification<number>;
1389
1389
  "hillshade-emissive-strength-transition"?: TransitionSpecification;
1390
1390
  };
1391
+ "appearances"?: Array<AppearanceSpecification>;
1391
1392
  };
1392
1393
  type ModelLayerSpecification = {
1393
1394
  "id": string;
@@ -1453,6 +1454,7 @@ type ModelLayerSpecification = {
1453
1454
  number
1454
1455
  ]>;
1455
1456
  };
1457
+ "appearances"?: Array<AppearanceSpecification>;
1456
1458
  };
1457
1459
  type BackgroundLayerSpecification = {
1458
1460
  "id": string;
@@ -1481,6 +1483,7 @@ type BackgroundLayerSpecification = {
1481
1483
  "background-emissive-strength"?: PropertyValueSpecification<number>;
1482
1484
  "background-emissive-strength-transition"?: TransitionSpecification;
1483
1485
  };
1486
+ "appearances"?: Array<AppearanceSpecification>;
1484
1487
  };
1485
1488
  type SkyLayerSpecification = {
1486
1489
  "id": string;
@@ -1516,6 +1519,7 @@ type SkyLayerSpecification = {
1516
1519
  "sky-opacity"?: PropertyValueSpecification<number>;
1517
1520
  "sky-opacity-transition"?: TransitionSpecification;
1518
1521
  };
1522
+ "appearances"?: Array<AppearanceSpecification>;
1519
1523
  };
1520
1524
  type SlotLayerSpecification = {
1521
1525
  "id": string;
@@ -1527,6 +1531,7 @@ type SlotLayerSpecification = {
1527
1531
  "minzoom"?: never;
1528
1532
  "maxzoom"?: never;
1529
1533
  "filter"?: never;
1534
+ "appearances"?: Array<AppearanceSpecification>;
1530
1535
  "layout"?: never;
1531
1536
  "paint"?: never;
1532
1537
  };
@@ -1544,9 +1549,27 @@ type ClipLayerSpecification = {
1544
1549
  "clip-layer-types"?: ExpressionSpecification;
1545
1550
  "clip-layer-scope"?: ExpressionSpecification;
1546
1551
  };
1552
+ "appearances"?: Array<AppearanceSpecification>;
1547
1553
  "paint"?: never;
1548
1554
  };
1549
1555
  type LayerSpecification = FillLayerSpecification | LineLayerSpecification | SymbolLayerSpecification | CircleLayerSpecification | HeatmapLayerSpecification | FillExtrusionLayerSpecification | BuildingLayerSpecification | RasterLayerSpecification | RasterParticleLayerSpecification | HillshadeLayerSpecification | ModelLayerSpecification | BackgroundLayerSpecification | SkyLayerSpecification | SlotLayerSpecification | ClipLayerSpecification;
1556
+ /**
1557
+ * Migrate a Mapbox GL Style to the latest version.
1558
+ *
1559
+ * @private
1560
+ * @alias migrate
1561
+ * @param {object} style a Mapbox GL Style
1562
+ * @returns {Object} a migrated style
1563
+ * @example
1564
+ * var fs = require('fs');
1565
+ * var migrate = require('mapbox-gl-style-spec').migrate;
1566
+ * var style = fs.readFileSync('./style.json', 'utf8');
1567
+ * fs.writeFileSync('./style.json', JSON.stringify(migrate(style)));
1568
+ */
1569
+ declare function _default$1(style: {
1570
+ version: 7;
1571
+ } | StyleSpecification): StyleSpecification;
1572
+ declare function _default$2(style: StyleSpecification): StyleSpecification;
1550
1573
  /**
1551
1574
  * Given an array of layers, some of which may contain `ref` properties
1552
1575
  * whose value is the `id` of another property, return a new array where
@@ -1901,10 +1924,11 @@ declare class EvaluationContext {
1901
1924
  featureDistanceData: FeatureDistanceData | null | undefined;
1902
1925
  scope: string | null | undefined;
1903
1926
  options: ConfigOptions | null | undefined;
1927
+ iconImageUseTheme: string | null | undefined;
1904
1928
  _parseColorCache: {
1905
1929
  [_: string]: Color | null | undefined;
1906
1930
  };
1907
- constructor(scope?: string | null, options?: ConfigOptions | null);
1931
+ constructor(scope?: string | null, options?: ConfigOptions | null, iconImageUseTheme?: string);
1908
1932
  id(): string | number | null;
1909
1933
  geometryType(): null | string;
1910
1934
  geometry(): Array<Array<Point>> | null | undefined;
@@ -1972,12 +1996,12 @@ declare class StyleExpression {
1972
1996
  [_: string]: unknown;
1973
1997
  };
1974
1998
  configDependencies: Set<string>;
1975
- constructor(expression: Expression, propertySpec?: StylePropertySpecification, scope?: string, options?: ConfigOptions);
1999
+ constructor(expression: Expression, propertySpec?: StylePropertySpecification, scope?: string, options?: ConfigOptions, iconImageUseTheme?: string);
1976
2000
  evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, featureTileCoord?: Point, featureDistanceData?: FeatureDistanceData): any;
1977
- evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, featureTileCoord?: Point, featureDistanceData?: FeatureDistanceData): any;
2001
+ evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, featureTileCoord?: Point, featureDistanceData?: FeatureDistanceData, iconImageUseTheme?: string): any;
1978
2002
  }
1979
2003
  declare function isExpression(expression: unknown): boolean;
1980
- declare function createExpression(expression: unknown, propertySpec?: StylePropertySpecification | null, scope?: string | null, options?: ConfigOptions | null): Result<StyleExpression, Array<ParsingError$1>>;
2004
+ declare function createExpression(expression: unknown, propertySpec?: StylePropertySpecification | null, scope?: string | null, options?: ConfigOptions | null, iconImageUseTheme?: string | null): Result<StyleExpression, Array<ParsingError$1>>;
1981
2005
  declare class ZoomConstantExpression<Kind extends EvaluationKind> {
1982
2006
  kind: Kind;
1983
2007
  isStateDependent: boolean;
@@ -1987,7 +2011,7 @@ declare class ZoomConstantExpression<Kind extends EvaluationKind> {
1987
2011
  isLineProgressConstant: boolean | null | undefined;
1988
2012
  constructor(kind: Kind, expression: StyleExpression, isLightConstant?: boolean | null, isLineProgressConstant?: boolean | null);
1989
2013
  evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection): any;
1990
- evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection): any;
2014
+ evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, iconImageUseTheme?: string): any;
1991
2015
  }
1992
2016
  declare class ZoomDependentExpression<Kind extends EvaluationKind> {
1993
2017
  kind: Kind;
@@ -2006,7 +2030,7 @@ declare class ZoomDependentExpression<Kind extends EvaluationKind> {
2006
2030
  type ConstantExpression = {
2007
2031
  kind: "constant";
2008
2032
  configDependencies: Set<string>;
2009
- readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[]) => any;
2033
+ readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, iconImageUseTheme?: string) => any;
2010
2034
  };
2011
2035
  type SourceExpression = {
2012
2036
  kind: "source";
@@ -2031,13 +2055,13 @@ interface CompositeExpression {
2031
2055
  isLightConstant: boolean | null | undefined;
2032
2056
  isLineProgressConstant: boolean | null | undefined;
2033
2057
  configDependencies: Set<string>;
2034
- readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection) => any;
2058
+ readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, iconImageUseTheme?: string) => any;
2035
2059
  readonly interpolationFactor: (input: number, lower: number, upper: number) => number;
2036
2060
  zoomStops: Array<number>;
2037
2061
  interpolationType: InterpolationType | null | undefined;
2038
2062
  }
2039
2063
  type StylePropertyExpression = ConstantExpression | SourceExpression | CameraExpression | CompositeExpression;
2040
- declare function createPropertyExpression(expression: any, propertySpec: StylePropertySpecification, scope?: string | null, options?: ConfigOptions | null): Result<StylePropertyExpression, Array<ParsingError$1>>;
2064
+ declare function createPropertyExpression(expression: any, propertySpec: StylePropertySpecification, scope?: string | null, options?: ConfigOptions | null, iconImageUseTheme?: string | null): Result<StylePropertyExpression, Array<ParsingError$1>>;
2041
2065
  declare class StylePropertyFunction<T> {
2042
2066
  _parameters: PropertyValueSpecification<T>;
2043
2067
  _specification: StylePropertySpecification;
@@ -2055,7 +2079,7 @@ declare class StylePropertyFunction<T> {
2055
2079
  _specification: StylePropertySpecification;
2056
2080
  };
2057
2081
  }
2058
- declare function normalizePropertyExpression<T>(value: PropertyValueSpecification<T>, specification: StylePropertySpecification, scope?: string | null, options?: ConfigOptions | null): StylePropertyExpression;
2082
+ declare function normalizePropertyExpression<T>(value: PropertyValueSpecification<T>, specification: StylePropertySpecification, scope?: string | null, options?: ConfigOptions | null, iconImageUseTheme?: string | null): StylePropertyExpression;
2059
2083
  /**
2060
2084
  * Convert the given legacy filter to (the JSON representation of) an
2061
2085
  * equivalent expression
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,8 @@ 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,
2869
+ "use-theme": true,
2844
2870
  "sdk-support": {
2845
2871
  "basic functionality": {
2846
2872
  js: "0.10.0",
@@ -2868,6 +2894,7 @@ var layout_symbol = {
2868
2894
  period: 360,
2869
2895
  units: "degrees",
2870
2896
  doc: "Rotates the icon clockwise.",
2897
+ appearance: true,
2871
2898
  requires: [
2872
2899
  "icon-image"
2873
2900
  ],
@@ -2956,6 +2983,7 @@ var layout_symbol = {
2956
2983
  0
2957
2984
  ],
2958
2985
  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.",
2986
+ appearance: true,
2959
2987
  requires: [
2960
2988
  "icon-image"
2961
2989
  ],
@@ -10182,6 +10210,7 @@ var v8 = {
10182
10210
  source_image: source_image,
10183
10211
  source_model: source_model,
10184
10212
  layer: layer,
10213
+ appearance: appearance,
10185
10214
  layout: layout,
10186
10215
  layout_background: layout_background,
10187
10216
  layout_sky: layout_sky,
@@ -14010,7 +14039,7 @@ const geometryTypes = [
14010
14039
  'Polygon'
14011
14040
  ];
14012
14041
  class EvaluationContext {
14013
- constructor(scope, options) {
14042
+ constructor(scope, options, iconImageUseTheme) {
14014
14043
  this.globals = null;
14015
14044
  this.feature = null;
14016
14045
  this.featureState = null;
@@ -14022,6 +14051,7 @@ class EvaluationContext {
14022
14051
  this.featureDistanceData = null;
14023
14052
  this.scope = scope;
14024
14053
  this.options = options;
14054
+ this.iconImageUseTheme = iconImageUseTheme;
14025
14055
  }
14026
14056
  id() {
14027
14057
  return this.feature && this.feature.id !== void 0 ? this.feature.id : null;
@@ -14110,7 +14140,7 @@ class CompoundExpression {
14110
14140
  continue;
14111
14141
  overloadParams.push(params);
14112
14142
  overloadIndex++;
14113
- signatureContext = new ParsingContext(context.registry, context.path, null, context.scope, void 0, context._scope, context.options);
14143
+ signatureContext = new ParsingContext(context.registry, context.path, null, context.scope, void 0, context._scope, context.options, context.iconImageUseTheme);
14114
14144
  const parsedArgs = [];
14115
14145
  let argParseFailed = false;
14116
14146
  for (let i = 1; i < args.length; i++) {
@@ -16246,7 +16276,7 @@ class Var {
16246
16276
  }
16247
16277
 
16248
16278
  class ParsingContext {
16249
- constructor(registry, path = [], expectedType, scope = new Scope(), errors = [], _scope, options) {
16279
+ constructor(registry, path = [], expectedType, scope = new Scope(), errors = [], _scope, options, iconImageUseTheme) {
16250
16280
  this.registry = registry;
16251
16281
  this.path = path;
16252
16282
  this.key = path.map(part => {
@@ -16260,6 +16290,7 @@ class ParsingContext {
16260
16290
  this.expectedType = expectedType;
16261
16291
  this._scope = _scope;
16262
16292
  this.options = options;
16293
+ this.iconImageUseTheme = iconImageUseTheme;
16263
16294
  }
16264
16295
  /**
16265
16296
  * @param expr the JSON expression to parse
@@ -16322,7 +16353,7 @@ class ParsingContext {
16322
16353
  }
16323
16354
  }
16324
16355
  if (!(parsed instanceof Literal) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {
16325
- const ec = new EvaluationContext(this._scope, this.options);
16356
+ const ec = new EvaluationContext(this._scope, this.options, this.iconImageUseTheme);
16326
16357
  try {
16327
16358
  parsed = new Literal(parsed.type, parsed.evaluate(ec));
16328
16359
  } catch (e) {
@@ -16356,7 +16387,7 @@ class ParsingContext {
16356
16387
  let path = typeof index === 'number' ? this.path.concat(index) : this.path;
16357
16388
  path = typeof key === 'string' ? path.concat(key) : path;
16358
16389
  const scope = bindings ? this.scope.concat(bindings) : this.scope;
16359
- return new ParsingContext(this.registry, path, expectedType || null, scope, this.errors, this._scope, this.options);
16390
+ return new ParsingContext(this.registry, path, expectedType || null, scope, this.errors, this._scope, this.options, this.iconImageUseTheme);
16360
16391
  }
16361
16392
  /**
16362
16393
  * Push a parsing (or type checking) error into the `this.errors`
@@ -18000,7 +18031,6 @@ CompoundExpression.register(expressions, {
18000
18031
  overloads: [
18001
18032
  [
18002
18033
  [StringType],
18003
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
18004
18034
  (ctx, [key]) => get(key.evaluate(ctx), ctx.properties())
18005
18035
  ],
18006
18036
  [
@@ -18016,7 +18046,6 @@ CompoundExpression.register(expressions, {
18016
18046
  'feature-state': [
18017
18047
  ValueType,
18018
18048
  [StringType],
18019
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
18020
18049
  (ctx, [key]) => get(key.evaluate(ctx), ctx.featureState || {})
18021
18050
  ],
18022
18051
  'properties': [
@@ -18742,10 +18771,10 @@ function interpolationFactor(input, base, lowerValue, upperValue) {
18742
18771
  }
18743
18772
 
18744
18773
  class StyleExpression {
18745
- constructor(expression, propertySpec, scope, options) {
18774
+ constructor(expression, propertySpec, scope, options, iconImageUseTheme) {
18746
18775
  this.expression = expression;
18747
18776
  this._warningHistory = {};
18748
- this._evaluator = new EvaluationContext(scope, options);
18777
+ this._evaluator = new EvaluationContext(scope, options, iconImageUseTheme);
18749
18778
  this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
18750
18779
  this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
18751
18780
  this.configDependencies = getConfigDependencies(expression);
@@ -18761,7 +18790,7 @@ class StyleExpression {
18761
18790
  this._evaluator.featureDistanceData = featureDistanceData || null;
18762
18791
  return this.expression.evaluate(this._evaluator);
18763
18792
  }
18764
- evaluate(globals, feature, featureState, canonical, availableImages, formattedSection, featureTileCoord, featureDistanceData) {
18793
+ evaluate(globals, feature, featureState, canonical, availableImages, formattedSection, featureTileCoord, featureDistanceData, iconImageUseTheme) {
18765
18794
  this._evaluator.globals = globals;
18766
18795
  this._evaluator.feature = feature || null;
18767
18796
  this._evaluator.featureState = featureState || null;
@@ -18770,6 +18799,7 @@ class StyleExpression {
18770
18799
  this._evaluator.formattedSection = formattedSection || null;
18771
18800
  this._evaluator.featureTileCoord = featureTileCoord || null;
18772
18801
  this._evaluator.featureDistanceData = featureDistanceData || null;
18802
+ this._evaluator.iconImageUseTheme = iconImageUseTheme || null;
18773
18803
  try {
18774
18804
  const val = this.expression.evaluate(this._evaluator);
18775
18805
  if (val === null || val === void 0 || typeof val === 'number' && val !== val) {
@@ -18793,13 +18823,13 @@ class StyleExpression {
18793
18823
  function isExpression(expression) {
18794
18824
  return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in expressions;
18795
18825
  }
18796
- function createExpression(expression, propertySpec, scope, options) {
18797
- const parser = new ParsingContext(expressions, [], propertySpec ? getExpectedType(propertySpec) : void 0, void 0, void 0, scope, options);
18826
+ function createExpression(expression, propertySpec, scope, options, iconImageUseTheme) {
18827
+ const parser = new ParsingContext(expressions, [], propertySpec ? getExpectedType(propertySpec) : void 0, void 0, void 0, scope, options, iconImageUseTheme);
18798
18828
  const parsed = parser.parse(expression, void 0, void 0, void 0, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : void 0);
18799
18829
  if (!parsed) {
18800
18830
  return error(parser.errors);
18801
18831
  }
18802
- return success(new StyleExpression(parsed, propertySpec, scope, options));
18832
+ return success(new StyleExpression(parsed, propertySpec, scope, options, iconImageUseTheme));
18803
18833
  }
18804
18834
  class ZoomConstantExpression {
18805
18835
  constructor(kind, expression, isLightConstant, isLineProgressConstant) {
@@ -18813,8 +18843,8 @@ class ZoomConstantExpression {
18813
18843
  evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {
18814
18844
  return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);
18815
18845
  }
18816
- evaluate(globals, feature, featureState, canonical, availableImages, formattedSection) {
18817
- return this._styleExpression.evaluate(globals, feature, featureState, canonical, availableImages, formattedSection);
18846
+ evaluate(globals, feature, featureState, canonical, availableImages, formattedSection, iconImageUseTheme) {
18847
+ return this._styleExpression.evaluate(globals, feature, featureState, canonical, availableImages, formattedSection, void 0, void 0, iconImageUseTheme);
18818
18848
  }
18819
18849
  }
18820
18850
  class ZoomDependentExpression {
@@ -18842,8 +18872,8 @@ class ZoomDependentExpression {
18842
18872
  }
18843
18873
  }
18844
18874
  }
18845
- function createPropertyExpression(expression, propertySpec, scope, options) {
18846
- expression = createExpression(expression, propertySpec, scope, options);
18875
+ function createPropertyExpression(expression, propertySpec, scope, options, iconImageUseTheme) {
18876
+ expression = createExpression(expression, propertySpec, scope, options, iconImageUseTheme);
18847
18877
  if (expression.result === 'error') {
18848
18878
  return expression;
18849
18879
  }
@@ -18899,11 +18929,11 @@ class StylePropertyFunction {
18899
18929
  };
18900
18930
  }
18901
18931
  }
18902
- function normalizePropertyExpression(value, specification, scope, options) {
18932
+ function normalizePropertyExpression(value, specification, scope, options, iconImageUseTheme) {
18903
18933
  if (isFunction(value)) {
18904
18934
  return new StylePropertyFunction(value, specification);
18905
18935
  } else if (isExpression(value) || Array.isArray(value) && value.length > 0) {
18906
- const expression = createPropertyExpression(value, specification, scope, options);
18936
+ const expression = createPropertyExpression(value, specification, scope, options, iconImageUseTheme);
18907
18937
  if (expression.result === 'error') {
18908
18938
  throw new Error(expression.value.map(err => `${ err.key }: ${ err.message }`).join(', '));
18909
18939
  }
@@ -19802,11 +19832,11 @@ function migrate (style) {
19802
19832
  migrated = true;
19803
19833
  }
19804
19834
  if (style.version === 8) {
19805
- migrated = migrateToExpressions(style);
19835
+ style = migrateToExpressions(style);
19806
19836
  migrated = true;
19807
19837
  }
19808
19838
  if (!migrated) {
19809
- throw new Error('cannot migrate from', style.version);
19839
+ throw new Error(`Cannot migrate from ${ style.version }`);
19810
19840
  }
19811
19841
  return style;
19812
19842
  }
@@ -21090,7 +21120,7 @@ function validateProperty(options, propertyType) {
21090
21120
  if (!layerSpec)
21091
21121
  return [];
21092
21122
  const useThemeMatch = propertyKey.match(/^(.*)-use-theme$/);
21093
- if (propertyType === 'paint' && useThemeMatch && layerSpec[useThemeMatch[1]]) {
21123
+ if (useThemeMatch && layerSpec[useThemeMatch[1]]) {
21094
21124
  if (isExpression(value)) {
21095
21125
  const errors2 = [];
21096
21126
  return errors2.concat(validate({
@@ -21109,7 +21139,6 @@ function validateProperty(options, propertyType) {
21109
21139
  },
21110
21140
  style,
21111
21141
  styleSpec,
21112
- // @ts-expect-error - TS2353 - Object literal may only specify known properties, and 'expressionContext' does not exist in type 'ValidationOptions'.
21113
21142
  expressionContext: 'property',
21114
21143
  propertyType,
21115
21144
  propertyKey
@@ -21168,7 +21197,6 @@ Use an identity property function instead: ${ example }.`)];
21168
21197
  valueSpec,
21169
21198
  style,
21170
21199
  styleSpec,
21171
- // @ts-expect-error - TS2353 - Object literal may only specify known properties, and 'expressionContext' does not exist in type 'ValidationOptions'.
21172
21200
  expressionContext: 'property',
21173
21201
  propertyType,
21174
21202
  propertyKey
@@ -21821,9 +21849,7 @@ function validateIconset(options) {
21821
21849
  }
21822
21850
 
21823
21851
  const VALIDATORS = {
21824
- '*'() {
21825
- return [];
21826
- },
21852
+ '*': () => [],
21827
21853
  'array': validateArray,
21828
21854
  'boolean': validateBoolean,
21829
21855
  'number': validateNumber,