@mapbox/mapbox-gl-style-spec 14.5.1 → 14.6.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.
package/dist/index.d.ts CHANGED
@@ -45,7 +45,7 @@ type ResolvedImageSpecification = string;
45
45
  type PromoteIdSpecification = {
46
46
  [_: string]: string;
47
47
  } | string;
48
- type FilterSpecification = [
48
+ type FilterSpecification = ExpressionSpecification | [
49
49
  "has",
50
50
  string
51
51
  ] | [
@@ -1364,7 +1364,7 @@ declare function isExpressionFilter(filter: unknown): boolean;
1364
1364
  * @param {string} layerType the type of the layer this filter will be applied to.
1365
1365
  * @returns {Function} filter-evaluating function
1366
1366
  */
1367
- declare function createFilter(filter?: FilterSpecification | ExpressionSpecification, layerType?: string): FeatureFilter;
1367
+ declare function createFilter(filter?: FilterSpecification, layerType?: string): FeatureFilter;
1368
1368
  type SerializedExpression = Array<unknown> | Array<string> | string | number | boolean | null;
1369
1369
  interface Expression {
1370
1370
  readonly type: Type;
@@ -1448,7 +1448,7 @@ interface Feature {
1448
1448
  readonly geometry?: Array<Array<Point>>;
1449
1449
  }
1450
1450
  type FeatureState = {
1451
- [_: string]: any;
1451
+ [_: string]: unknown;
1452
1452
  };
1453
1453
  interface GlobalProperties {
1454
1454
  zoom: number;
@@ -1481,7 +1481,7 @@ declare function createExpression(expression: unknown, propertySpec?: StylePrope
1481
1481
  declare class ZoomConstantExpression<Kind extends EvaluationKind> {
1482
1482
  kind: Kind;
1483
1483
  isStateDependent: boolean;
1484
- isConfigDependent: boolean;
1484
+ configDependencies: Set<string>;
1485
1485
  _styleExpression: StyleExpression;
1486
1486
  isLightConstant: boolean | null | undefined;
1487
1487
  constructor(kind: Kind, expression: StyleExpression, isLightConstant?: boolean | null);
@@ -1493,7 +1493,7 @@ declare class ZoomDependentExpression<Kind extends EvaluationKind> {
1493
1493
  zoomStops: Array<number>;
1494
1494
  isStateDependent: boolean;
1495
1495
  isLightConstant: boolean | null | undefined;
1496
- isConfigDependent: boolean;
1496
+ configDependencies: Set<string>;
1497
1497
  _styleExpression: StyleExpression;
1498
1498
  interpolationType: InterpolationType | null | undefined;
1499
1499
  constructor(kind: Kind, expression: StyleExpression, zoomStops: Array<number>, interpolationType?: InterpolationType, isLightConstant?: boolean | null);
@@ -1503,20 +1503,20 @@ declare class ZoomDependentExpression<Kind extends EvaluationKind> {
1503
1503
  }
1504
1504
  type ConstantExpression = {
1505
1505
  kind: "constant";
1506
- isConfigDependent: boolean;
1506
+ configDependencies: Set<string>;
1507
1507
  readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>) => any;
1508
1508
  };
1509
1509
  type SourceExpression = {
1510
1510
  kind: "source";
1511
1511
  isStateDependent: boolean;
1512
1512
  isLightConstant: boolean | null | undefined;
1513
- isConfigDependent: boolean;
1513
+ configDependencies: Set<string>;
1514
1514
  readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>, formattedSection?: FormattedSection) => any;
1515
1515
  };
1516
1516
  type CameraExpression = {
1517
1517
  kind: "camera";
1518
1518
  isStateDependent: boolean;
1519
- isConfigDependent: boolean;
1519
+ configDependencies: Set<string>;
1520
1520
  readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>) => any;
1521
1521
  readonly interpolationFactor: (input: number, lower: number, upper: number) => number;
1522
1522
  zoomStops: Array<number>;
@@ -1526,7 +1526,7 @@ interface CompositeExpression {
1526
1526
  kind: "composite";
1527
1527
  isStateDependent: boolean;
1528
1528
  isLightConstant: boolean | null | undefined;
1529
- isConfigDependent: boolean;
1529
+ configDependencies: Set<string>;
1530
1530
  readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>, formattedSection?: FormattedSection) => any;
1531
1531
  readonly interpolationFactor: (input: number, lower: number, upper: number) => number;
1532
1532
  zoomStops: Array<number>;
package/dist/index.es.js CHANGED
@@ -1215,13 +1215,13 @@ var layer = {
1215
1215
  },
1216
1216
  clip: {
1217
1217
  doc: "Layer that removes 3D content from map.",
1218
+ experimental: true,
1218
1219
  "sdk-support": {
1219
1220
  "basic functionality": {
1220
1221
  js: "3.5.0",
1221
- android: "11.5.0",
1222
- ios: "11.5.0"
1223
- },
1224
- experimental: true
1222
+ android: "11.6.0",
1223
+ ios: "11.6.0"
1224
+ }
1225
1225
  }
1226
1226
  }
1227
1227
  },
@@ -1431,8 +1431,8 @@ var layout_clip = {
1431
1431
  "sdk-support": {
1432
1432
  "basic functionality": {
1433
1433
  js: "3.5.0",
1434
- android: "11.5.0",
1435
- ios: "11.5.0"
1434
+ android: "11.6.0",
1435
+ ios: "11.6.0"
1436
1436
  }
1437
1437
  },
1438
1438
  expression: {
@@ -5844,7 +5844,7 @@ var paint_circle = {
5844
5844
  "circle-blur": {
5845
5845
  type: "number",
5846
5846
  "default": 0,
5847
- doc: "Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.",
5847
+ doc: "Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity. Setting a negative value renders the blur as an inner glow effect.",
5848
5848
  transition: true,
5849
5849
  "sdk-support": {
5850
5850
  "basic functionality": {
@@ -11301,7 +11301,7 @@ class Assertion {
11301
11301
  if (!error) {
11302
11302
  return value;
11303
11303
  } else if (i === this.args.length - 1) {
11304
- throw new RuntimeError(`Expected value to be of type ${ toString$1(this.type) }, but found ${ toString$1(typeOf(value)) } instead.`);
11304
+ throw new RuntimeError(`The expression ${ JSON.stringify(this.args[i].serialize()) } evaluated to ${ toString$1(typeOf(value)) } but was expected to be of type ${ toString$1(this.type) }.`);
11305
11305
  }
11306
11306
  }
11307
11307
  return null;
@@ -12976,7 +12976,7 @@ Point.convert = function (a) {
12976
12976
  };
12977
12977
 
12978
12978
  class TinyQueue {
12979
- constructor(data = [], compare = defaultCompare) {
12979
+ constructor(data = [], compare = (a, b) => a < b ? -1 : a > b ? 1 : 0) {
12980
12980
  this.data = data;
12981
12981
  this.length = this.data.length;
12982
12982
  this.compare = compare;
@@ -12987,16 +12987,14 @@ class TinyQueue {
12987
12987
  }
12988
12988
  push(item) {
12989
12989
  this.data.push(item);
12990
- this.length++;
12991
- this._up(this.length - 1);
12990
+ this._up(this.length++);
12992
12991
  }
12993
12992
  pop() {
12994
12993
  if (this.length === 0)
12995
12994
  return undefined;
12996
12995
  const top = this.data[0];
12997
12996
  const bottom = this.data.pop();
12998
- this.length--;
12999
- if (this.length > 0) {
12997
+ if (--this.length > 0) {
13000
12998
  this.data[0] = bottom;
13001
12999
  this._down(0);
13002
13000
  }
@@ -13023,24 +13021,20 @@ class TinyQueue {
13023
13021
  const halfLength = this.length >> 1;
13024
13022
  const item = data[pos];
13025
13023
  while (pos < halfLength) {
13026
- let left = (pos << 1) + 1;
13027
- let best = data[left];
13028
- const right = left + 1;
13029
- if (right < this.length && compare(data[right], best) < 0) {
13030
- left = right;
13031
- best = data[right];
13024
+ let bestChild = (pos << 1) + 1;
13025
+ // initially it is the left child
13026
+ const right = bestChild + 1;
13027
+ if (right < this.length && compare(data[right], data[bestChild]) < 0) {
13028
+ bestChild = right;
13032
13029
  }
13033
- if (compare(best, item) >= 0)
13030
+ if (compare(data[bestChild], item) >= 0)
13034
13031
  break;
13035
- data[pos] = best;
13036
- pos = left;
13032
+ data[pos] = data[bestChild];
13033
+ pos = bestChild;
13037
13034
  }
13038
13035
  data[pos] = item;
13039
13036
  }
13040
13037
  }
13041
- function defaultCompare(a, b) {
13042
- return a < b ? -1 : a > b ? 1 : 0;
13043
- }
13044
13038
 
13045
13039
  var EXTENT = 8192;
13046
13040
 
@@ -13806,15 +13800,20 @@ function isStateConstant(e) {
13806
13800
  });
13807
13801
  return result;
13808
13802
  }
13809
- function isConfigConstant(e) {
13803
+ function getConfigDependencies(e) {
13810
13804
  if (e instanceof Config) {
13811
- return false;
13805
+ const singleConfig = /* @__PURE__ */
13806
+ new Set([e.key]);
13807
+ return singleConfig;
13812
13808
  }
13813
- let result = true;
13809
+ let result = /* @__PURE__ */
13810
+ new Set();
13814
13811
  e.eachChild(arg => {
13815
- if (result && !isConfigConstant(arg)) {
13816
- result = false;
13817
- }
13812
+ result = /* @__PURE__ */
13813
+ new Set([
13814
+ ...result,
13815
+ ...getConfigDependencies(arg)
13816
+ ]);
13818
13817
  });
13819
13818
  return result;
13820
13819
  }
@@ -16242,7 +16241,7 @@ class StyleExpression {
16242
16241
  if (!this._warningHistory[e.message]) {
16243
16242
  this._warningHistory[e.message] = true;
16244
16243
  if (typeof console !== 'undefined') {
16245
- console.warn(e.message);
16244
+ console.warn(`Failed to evaluate expression "${ JSON.stringify(this.expression.serialize()) }". ${ e.message }`);
16246
16245
  }
16247
16246
  }
16248
16247
  return this._defaultValue;
@@ -16266,7 +16265,7 @@ class ZoomConstantExpression {
16266
16265
  this._styleExpression = expression;
16267
16266
  this.isLightConstant = isLightConstant;
16268
16267
  this.isStateDependent = kind !== 'constant' && !isStateConstant(expression.expression);
16269
- this.isConfigDependent = !isConfigConstant(expression.expression);
16268
+ this.configDependencies = getConfigDependencies(expression.expression);
16270
16269
  }
16271
16270
  evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {
16272
16271
  return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);
@@ -16282,7 +16281,7 @@ class ZoomDependentExpression {
16282
16281
  this._styleExpression = expression;
16283
16282
  this.isStateDependent = kind !== 'camera' && !isStateConstant(expression.expression);
16284
16283
  this.isLightConstant = isLightConstant;
16285
- this.isConfigDependent = !isConfigConstant(expression.expression);
16284
+ this.configDependencies = getConfigDependencies(expression.expression);
16286
16285
  this.interpolationType = interpolationType;
16287
16286
  }
16288
16287
  evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {
@@ -16372,7 +16371,8 @@ function normalizePropertyExpression(value, specification, scope, options) {
16372
16371
  }
16373
16372
  return {
16374
16373
  kind: 'constant',
16375
- isConfigDependent: false,
16374
+ configDependencies: /* @__PURE__ */
16375
+ new Set(),
16376
16376
  evaluate: () => constant
16377
16377
  };
16378
16378
  }
@@ -17201,8 +17201,7 @@ function convertInOp(property, values, negate = false) {
17201
17201
  negate
17202
17202
  ];
17203
17203
  }
17204
- return [negate ? 'all' : 'any'].concat(// @ts-expect-error - TS2769 - No overload matches this call.
17205
- values.map(v => [
17204
+ return [negate ? 'all' : 'any'].concat(values.map(v => [
17206
17205
  negate ? '!=' : '==',
17207
17206
  get,
17208
17207
  v