@mapbox/mapbox-gl-style-spec 14.15.0-beta.2 → 14.16.0-beta.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.
Files changed (76) hide show
  1. package/deref.ts +3 -0
  2. package/diff.ts +63 -0
  3. package/dist/index.cjs +741 -54
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.ts +205 -40
  6. package/dist/index.es.js +741 -54
  7. package/dist/index.es.js.map +1 -1
  8. package/expression/compound_expression.ts +4 -0
  9. package/expression/definitions/assertion.ts +7 -0
  10. package/expression/definitions/case.ts +2 -1
  11. package/expression/definitions/coalesce.ts +4 -0
  12. package/expression/definitions/coercion.ts +12 -0
  13. package/expression/definitions/collator.ts +8 -5
  14. package/expression/definitions/comparison.ts +12 -5
  15. package/expression/definitions/config.ts +12 -0
  16. package/expression/definitions/distance.ts +13 -2
  17. package/expression/definitions/format.ts +10 -0
  18. package/expression/definitions/image.ts +3 -0
  19. package/expression/definitions/in.ts +5 -0
  20. package/expression/definitions/index.ts +62 -10
  21. package/expression/definitions/index_of.ts +6 -0
  22. package/expression/definitions/interpolate.ts +5 -1
  23. package/expression/definitions/length.ts +2 -0
  24. package/expression/definitions/let.ts +1 -0
  25. package/expression/definitions/match.ts +5 -0
  26. package/expression/definitions/number_format.ts +7 -0
  27. package/expression/definitions/slice.ts +4 -0
  28. package/expression/definitions/within.ts +1 -0
  29. package/expression/index.ts +28 -19
  30. package/expression/parsing_context.ts +2 -0
  31. package/expression/types/image_variant.ts +3 -0
  32. package/expression/types.ts +1 -2
  33. package/expression/values.ts +1 -0
  34. package/feature_filter/convert.ts +9 -1
  35. package/feature_filter/index.ts +41 -1
  36. package/format.ts +5 -0
  37. package/function/convert.ts +5 -0
  38. package/function/index.ts +79 -25
  39. package/group_by_layout.ts +4 -5
  40. package/migrate/v8.ts +42 -3
  41. package/migrate/v9.ts +5 -0
  42. package/migrate.ts +1 -0
  43. package/package.json +1 -1
  44. package/read_style.ts +2 -0
  45. package/reference/v8.json +463 -18
  46. package/rollup.config.js +1 -0
  47. package/style-spec.ts +187 -74
  48. package/test.js +4 -0
  49. package/types.ts +74 -5
  50. package/util/geometry_util.ts +4 -0
  51. package/validate/validate.ts +3 -8
  52. package/validate/validate_appearance.ts +101 -0
  53. package/validate/validate_array.ts +6 -4
  54. package/validate/validate_enum.ts +2 -7
  55. package/validate/validate_expression.ts +48 -3
  56. package/validate/validate_filter.ts +5 -3
  57. package/validate/validate_fog.ts +6 -0
  58. package/validate/validate_function.ts +2 -0
  59. package/validate/validate_iconset.ts +1 -0
  60. package/validate/validate_import.ts +2 -2
  61. package/validate/validate_layer.ts +37 -4
  62. package/validate/validate_light.ts +6 -0
  63. package/validate/validate_lights.ts +9 -0
  64. package/validate/validate_model.ts +1 -2
  65. package/validate/validate_number.ts +4 -4
  66. package/validate/validate_object.ts +7 -0
  67. package/validate/validate_projection.ts +2 -0
  68. package/validate/validate_property.ts +15 -4
  69. package/validate/validate_rain.ts +5 -0
  70. package/validate/validate_snow.ts +5 -0
  71. package/validate/validate_source.ts +13 -3
  72. package/validate/validate_style.ts +1 -0
  73. package/validate/validate_terrain.ts +6 -0
  74. package/validate_mapbox_api_supported.ts +1 -0
  75. package/visit.ts +2 -0
  76. package/util/extend.ts +0 -9
package/dist/index.d.ts CHANGED
@@ -217,6 +217,45 @@ type SourcesSpecification = {
217
217
  type ModelsSpecification = {
218
218
  [_: string]: ModelSpecification;
219
219
  };
220
+ type ModelNodeOverrideSpecification = {
221
+ "orientation"?: [
222
+ number,
223
+ number,
224
+ number
225
+ ];
226
+ };
227
+ type ModelNodeOverridesSpecification = {
228
+ [_: string]: ModelNodeOverrideSpecification;
229
+ };
230
+ type ModelMaterialOverrideSpecification = {
231
+ "model-color"?: ColorSpecification;
232
+ "model-color-mix-intensity"?: number;
233
+ "model-opacity"?: number;
234
+ "model-emissive-strength"?: number;
235
+ };
236
+ type ModelMaterialOverridesSpecification = {
237
+ [_: string]: ModelMaterialOverrideSpecification;
238
+ };
239
+ type ModelSourceModelsSpecification = {
240
+ [_: string]: ModelSourceModelSpecification;
241
+ };
242
+ type ModelSourceModelSpecification = {
243
+ "uri": string;
244
+ "position"?: [
245
+ number,
246
+ number
247
+ ];
248
+ "orientation"?: [
249
+ number,
250
+ number,
251
+ number
252
+ ];
253
+ "nodeOverrides"?: ModelNodeOverridesSpecification;
254
+ "materialOverrides"?: ModelMaterialOverridesSpecification;
255
+ "nodeOverrideNames"?: Array<string>;
256
+ "materialOverrideNames"?: Array<string>;
257
+ "featureProperties"?: unknown;
258
+ };
220
259
  type IconsetsSpecification = {
221
260
  [_: string]: IconsetSpecification;
222
261
  };
@@ -465,7 +504,7 @@ type SelectorPropertySpecification = {
465
504
  [_: string]: unknown;
466
505
  };
467
506
  type AppearanceSpecification = {
468
- "condition"?: ExpressionSpecification;
507
+ "condition"?: DataDrivenPropertyValueSpecification<boolean>;
469
508
  "name"?: string;
470
509
  "properties"?: unknown;
471
510
  };
@@ -645,6 +684,7 @@ type ModelSourceSpecification = {
645
684
  "maxzoom"?: number;
646
685
  "minzoom"?: number;
647
686
  "tiles"?: Array<string>;
687
+ "models"?: ModelSourceModelsSpecification;
648
688
  };
649
689
  type SourceSpecification = VectorSourceSpecification | RasterSourceSpecification | RasterDEMSourceSpecification | RasterArraySourceSpecification | GeoJSONSourceSpecification | VideoSourceSpecification | ImageSourceSpecification | ModelSourceSpecification;
650
690
  type IconsetSpecification = {
@@ -1199,6 +1239,10 @@ type BuildingLayerSpecification = {
1199
1239
  * @experimental This property is experimental and subject to change in future versions.
1200
1240
  */
1201
1241
  "building-facade-floors"?: DataDrivenPropertyValueSpecification<number>;
1242
+ /**
1243
+ * @experimental This property is experimental and subject to change in future versions.
1244
+ */
1245
+ "building-facade-unit-width"?: DataDrivenPropertyValueSpecification<number>;
1202
1246
  /**
1203
1247
  * @experimental This property is experimental and subject to change in future versions.
1204
1248
  */
@@ -1220,6 +1264,21 @@ type BuildingLayerSpecification = {
1220
1264
  */
1221
1265
  "building-base"?: DataDrivenPropertyValueSpecification<number>;
1222
1266
  "building-base-transition"?: TransitionSpecification;
1267
+ /**
1268
+ * @experimental This property is experimental and subject to change in future versions.
1269
+ */
1270
+ "building-flood-light-wall-radius"?: DataDrivenPropertyValueSpecification<number>;
1271
+ "building-flood-light-wall-radius-transition"?: TransitionSpecification;
1272
+ /**
1273
+ * @experimental This property is experimental and subject to change in future versions.
1274
+ */
1275
+ "building-flood-light-ground-radius"?: DataDrivenPropertyValueSpecification<number>;
1276
+ "building-flood-light-ground-radius-transition"?: TransitionSpecification;
1277
+ /**
1278
+ * @experimental This property is experimental and subject to change in future versions.
1279
+ */
1280
+ "building-flip-roof-orientation"?: DataDrivenPropertyValueSpecification<boolean>;
1281
+ "building-flip-roof-orientation-transition"?: TransitionSpecification;
1223
1282
  };
1224
1283
  "paint"?: {
1225
1284
  /**
@@ -1270,6 +1329,22 @@ type BuildingLayerSpecification = {
1270
1329
  */
1271
1330
  "building-facade-emissive-chance"?: PropertyValueSpecification<number>;
1272
1331
  "building-cutoff-fade-range"?: ExpressionSpecification;
1332
+ /**
1333
+ * @experimental This property is experimental and subject to change in future versions.
1334
+ */
1335
+ "building-flood-light-color"?: PropertyValueSpecification<ColorSpecification>;
1336
+ "building-flood-light-color-transition"?: TransitionSpecification;
1337
+ "building-flood-light-color-use-theme"?: PropertyValueSpecification<string>;
1338
+ /**
1339
+ * @experimental This property is experimental and subject to change in future versions.
1340
+ */
1341
+ "building-flood-light-intensity"?: PropertyValueSpecification<number>;
1342
+ "building-flood-light-intensity-transition"?: TransitionSpecification;
1343
+ /**
1344
+ * @experimental This property is experimental and subject to change in future versions.
1345
+ */
1346
+ "building-flood-light-ground-attenuation"?: PropertyValueSpecification<number>;
1347
+ "building-flood-light-ground-attenuation-transition"?: TransitionSpecification;
1273
1348
  };
1274
1349
  "appearances"?: Array<AppearanceSpecification>;
1275
1350
  };
@@ -1453,6 +1528,10 @@ type ModelLayerSpecification = {
1453
1528
  number,
1454
1529
  number
1455
1530
  ]>;
1531
+ /**
1532
+ * @experimental This property is experimental and subject to change in future versions.
1533
+ */
1534
+ "model-elevation-reference"?: "sea" | "ground" | "hd-road-markup" | ExpressionSpecification;
1456
1535
  };
1457
1536
  "appearances"?: Array<AppearanceSpecification>;
1458
1537
  };
@@ -2028,7 +2107,7 @@ declare class ZoomDependentExpression<Kind extends EvaluationKind> {
2028
2107
  type ConstantExpression = {
2029
2108
  kind: "constant";
2030
2109
  configDependencies: Set<string>;
2031
- readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, iconImageUseTheme?: string) => any;
2110
+ readonly evaluate: <T = unknown>(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, iconImageUseTheme?: string) => T;
2032
2111
  };
2033
2112
  type SourceExpression = {
2034
2113
  kind: "source";
@@ -2036,13 +2115,13 @@ type SourceExpression = {
2036
2115
  isLightConstant: boolean | null | undefined;
2037
2116
  isLineProgressConstant: boolean | null | undefined;
2038
2117
  configDependencies: Set<string>;
2039
- readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection) => any;
2118
+ readonly evaluate: <T = unknown>(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection) => T;
2040
2119
  };
2041
2120
  type CameraExpression = {
2042
2121
  kind: "camera";
2043
2122
  isStateDependent: boolean;
2044
2123
  configDependencies: Set<string>;
2045
- readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[]) => any;
2124
+ readonly evaluate: <T = unknown>(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[]) => T;
2046
2125
  readonly interpolationFactor: (input: number, lower: number, upper: number) => number;
2047
2126
  zoomStops: Array<number>;
2048
2127
  interpolationType: InterpolationType | null | undefined;
@@ -2053,7 +2132,7 @@ interface CompositeExpression {
2053
2132
  isLightConstant: boolean | null | undefined;
2054
2133
  isLineProgressConstant: boolean | null | undefined;
2055
2134
  configDependencies: Set<string>;
2056
- readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, iconImageUseTheme?: string) => any;
2135
+ readonly evaluate: <T = unknown>(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, iconImageUseTheme?: string) => T;
2057
2136
  readonly interpolationFactor: (input: number, lower: number, upper: number) => number;
2058
2137
  zoomStops: Array<number>;
2059
2138
  interpolationType: InterpolationType | null | undefined;
@@ -2064,7 +2143,7 @@ declare class StylePropertyFunction<T> {
2064
2143
  _parameters: PropertyValueSpecification<T>;
2065
2144
  _specification: StylePropertySpecification;
2066
2145
  kind: EvaluationKind;
2067
- evaluate: (globals: GlobalProperties, feature?: Feature) => any;
2146
+ evaluate: <T = unknown>(globals: GlobalProperties, feature?: Feature) => T;
2068
2147
  interpolationFactor: (input: number, lower: number, upper: number) => number | null | undefined;
2069
2148
  zoomStops: Array<number> | null | undefined;
2070
2149
  constructor(parameters: PropertyValueSpecification<T>, specification: StylePropertySpecification);
@@ -2169,78 +2248,164 @@ type MapboxStyleSpecification = StyleSpecification & {
2169
2248
  */
2170
2249
  export function validateMapboxApiSupported(style: MapboxStyleSpecification, styleSpec?: StyleReference): ValidationErrors;
2171
2250
  type ExpressionType = "data-driven" | "color-ramp" | "data-constant" | "constant";
2172
- type ExpressionParameters = Array<"zoom" | "feature" | "feature-state" | "heatmap-density" | "line-progress" | "raster-value" | "sky-radial-progress" | "pitch" | "distance-from-center" | "measure-light" | "raster-particle-speed">;
2251
+ type ExpressionParameter = "zoom" | "pitch" | "feature" | "raster-value" | "feature-state" | "line-progress" | "measure-light" | "heatmap-density" | "sky-radial-progress" | "distance-from-center" | "raster-particle-speed";
2173
2252
  type ExpressionSpecification$1 = {
2174
2253
  interpolated: boolean;
2175
- parameters?: ExpressionParameters;
2254
+ parameters?: ExpressionParameter[];
2176
2255
  relaxZoomRestriction?: boolean;
2177
2256
  };
2178
- export type StylePropertySpecification = {
2179
- type: "number";
2257
+ export type ArrayPropertySpecification = {
2258
+ type: "array";
2180
2259
  "property-type": ExpressionType;
2260
+ value: "enum";
2181
2261
  expression?: ExpressionSpecification$1;
2182
2262
  transition?: boolean;
2183
- default?: number;
2184
- tokens: never;
2263
+ default?: string[];
2264
+ length?: number;
2265
+ values?: {
2266
+ [_: string]: unknown;
2267
+ };
2268
+ experimental?: boolean;
2269
+ private?: boolean;
2270
+ requires?: unknown;
2271
+ appearance?: boolean;
2272
+ tokens?: never;
2273
+ minimum?: never;
2274
+ maximum?: never;
2185
2275
  } | {
2186
- type: "string";
2276
+ type: "array";
2187
2277
  "property-type": ExpressionType;
2278
+ value: "number";
2188
2279
  expression?: ExpressionSpecification$1;
2189
2280
  transition?: boolean;
2190
- default?: string;
2191
- tokens?: boolean;
2281
+ default?: number[];
2282
+ minimum?: number;
2283
+ maximum?: number;
2284
+ length?: number;
2285
+ period?: number;
2286
+ units?: string;
2287
+ experimental?: boolean;
2288
+ private?: boolean;
2289
+ requires?: unknown;
2290
+ appearance?: boolean;
2291
+ tokens?: never;
2292
+ values?: never;
2192
2293
  } | {
2294
+ type: "array";
2295
+ "property-type": ExpressionType;
2296
+ value: "string";
2297
+ expression?: ExpressionSpecification$1;
2298
+ transition?: boolean;
2299
+ default?: string[];
2300
+ length?: number;
2301
+ experimental?: boolean;
2302
+ private?: boolean;
2303
+ requires?: unknown;
2304
+ appearance?: boolean;
2305
+ tokens?: never;
2306
+ minimum?: never;
2307
+ maximum?: never;
2308
+ values?: never;
2309
+ };
2310
+ export type BooleanPropertySpecification = {
2193
2311
  type: "boolean";
2194
2312
  "property-type": ExpressionType;
2195
2313
  expression?: ExpressionSpecification$1;
2196
2314
  transition?: boolean;
2197
- overridable?: boolean;
2198
2315
  default?: boolean;
2316
+ overridable?: boolean;
2317
+ experimental?: boolean;
2318
+ private?: boolean;
2319
+ requires?: unknown;
2320
+ appearance?: boolean;
2199
2321
  tokens?: never;
2200
- } | {
2201
- type: "enum";
2322
+ };
2323
+ export type ColorPropertySpecification = {
2324
+ type: "color";
2202
2325
  "property-type": ExpressionType;
2203
2326
  expression?: ExpressionSpecification$1;
2204
- values: {
2205
- [_: string]: unknown;
2206
- };
2207
2327
  transition?: boolean;
2208
2328
  default?: string;
2209
- tokens: never;
2210
- } | {
2211
- type: "color";
2329
+ "use-theme"?: boolean;
2330
+ overridable?: boolean;
2331
+ experimental?: boolean;
2332
+ private?: boolean;
2333
+ requires?: unknown;
2334
+ appearance?: boolean;
2335
+ tokens?: never;
2336
+ };
2337
+ export type EnumPropertySpecification = {
2338
+ type: "enum";
2212
2339
  "property-type": ExpressionType;
2213
2340
  expression?: ExpressionSpecification$1;
2214
2341
  transition?: boolean;
2215
2342
  default?: string;
2216
- tokens: never;
2217
- overridable: boolean;
2218
- } | {
2219
- type: "array";
2220
- value: "number";
2343
+ values?: {
2344
+ [_: string]: unknown;
2345
+ };
2346
+ experimental?: boolean;
2347
+ private?: boolean;
2348
+ requires?: unknown;
2349
+ appearance?: boolean;
2350
+ tokens?: never;
2351
+ };
2352
+ export type FormattedPropertySpecification = {
2353
+ type: "formatted";
2221
2354
  "property-type": ExpressionType;
2222
2355
  expression?: ExpressionSpecification$1;
2223
- length?: number;
2224
2356
  transition?: boolean;
2225
- default?: Array<number>;
2226
- tokens: never;
2227
- } | {
2228
- type: "array";
2229
- value: "string";
2357
+ default?: string;
2358
+ tokens?: boolean;
2359
+ experimental?: boolean;
2360
+ private?: boolean;
2361
+ requires?: unknown;
2362
+ appearance?: boolean;
2363
+ };
2364
+ export type NumberPropertySpecification = {
2365
+ type: "number";
2230
2366
  "property-type": ExpressionType;
2231
2367
  expression?: ExpressionSpecification$1;
2232
- length?: number;
2233
2368
  transition?: boolean;
2234
- default?: Array<string>;
2235
- tokens: never;
2236
- } | {
2369
+ default?: number;
2370
+ minimum?: number;
2371
+ maximum?: number;
2372
+ period?: number;
2373
+ units?: string;
2374
+ experimental?: boolean;
2375
+ private?: boolean;
2376
+ requires?: unknown;
2377
+ appearance?: boolean;
2378
+ tokens?: never;
2379
+ };
2380
+ export type ResolvedImagePropertySpecification = {
2237
2381
  type: "resolvedImage";
2238
2382
  "property-type": ExpressionType;
2239
2383
  expression?: ExpressionSpecification$1;
2240
2384
  transition?: boolean;
2241
2385
  default?: string;
2242
- tokens: never;
2386
+ tokens?: boolean;
2387
+ "use-theme"?: boolean;
2388
+ experimental?: boolean;
2389
+ private?: boolean;
2390
+ requires?: unknown;
2391
+ appearance?: boolean;
2243
2392
  };
2393
+ export type StringPropertySpecification = {
2394
+ type: "string";
2395
+ "property-type": ExpressionType;
2396
+ expression?: ExpressionSpecification$1;
2397
+ transition?: boolean;
2398
+ default?: string;
2399
+ tokens?: boolean;
2400
+ experimental?: boolean;
2401
+ private?: boolean;
2402
+ requires?: unknown;
2403
+ appearance?: boolean;
2404
+ };
2405
+ /**
2406
+ * A style property specification is used to describe a value of some style property reference in the v8.json
2407
+ */
2408
+ export type StylePropertySpecification = ArrayPropertySpecification | BooleanPropertySpecification | ColorPropertySpecification | EnumPropertySpecification | FormattedPropertySpecification | NumberPropertySpecification | ResolvedImagePropertySpecification | StringPropertySpecification;
2244
2409
  export declare const expression: {
2245
2410
  StyleExpression: typeof StyleExpression;
2246
2411
  isExpression: typeof isExpression;