@mapbox/mapbox-gl-style-spec 14.16.0-beta.1 → 14.16.0-beta.3

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
@@ -441,14 +441,17 @@ type ImportSpecification = {
441
441
  "color-theme"?: ColorThemeSpecification | null | undefined;
442
442
  };
443
443
  type IndoorSpecification = {
444
+ [_: string]: IndoorSourceSpecification;
445
+ };
446
+ type IndoorSourceSpecification = {
444
447
  /**
445
448
  * @experimental This property is experimental and subject to change in future versions.
446
449
  */
447
- "floorplanFeaturesetId"?: ExpressionSpecification;
450
+ "sourceId"?: string;
448
451
  /**
449
452
  * @experimental This property is experimental and subject to change in future versions.
450
453
  */
451
- "buildingFeaturesetId"?: ExpressionSpecification;
454
+ "sourceLayers"?: Array<string>;
452
455
  };
453
456
  type ConfigSpecification = {
454
457
  [_: string]: unknown;
@@ -2061,6 +2064,7 @@ interface GlobalProperties {
2061
2064
  accumulated?: Value;
2062
2065
  brightness?: number;
2063
2066
  worldview?: string;
2067
+ activeFloors?: Set<string>;
2064
2068
  }
2065
2069
  declare class StyleExpression {
2066
2070
  expression: Expression;
@@ -2073,6 +2077,7 @@ declare class StyleExpression {
2073
2077
  [_: string]: unknown;
2074
2078
  };
2075
2079
  configDependencies: Set<string>;
2080
+ isIndoorDependent: boolean;
2076
2081
  constructor(expression: Expression, propertySpec?: StylePropertySpecification, scope?: string, options?: ConfigOptions, iconImageUseTheme?: string);
2077
2082
  evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, featureTileCoord?: Point, featureDistanceData?: FeatureDistanceData): any;
2078
2083
  evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, featureTileCoord?: Point, featureDistanceData?: FeatureDistanceData, iconImageUseTheme?: string): any;
@@ -2083,6 +2088,7 @@ declare class ZoomConstantExpression<Kind extends EvaluationKind> {
2083
2088
  kind: Kind;
2084
2089
  isStateDependent: boolean;
2085
2090
  configDependencies: Set<string>;
2091
+ isIndoorDependent: boolean;
2086
2092
  _styleExpression: StyleExpression;
2087
2093
  isLightConstant: boolean | null | undefined;
2088
2094
  isLineProgressConstant: boolean | null | undefined;
@@ -2094,6 +2100,7 @@ declare class ZoomDependentExpression<Kind extends EvaluationKind> {
2094
2100
  kind: Kind;
2095
2101
  zoomStops: Array<number>;
2096
2102
  isStateDependent: boolean;
2103
+ isIndoorDependent: boolean;
2097
2104
  isLightConstant: boolean | null | undefined;
2098
2105
  isLineProgressConstant: boolean | null | undefined;
2099
2106
  configDependencies: Set<string>;
@@ -2107,11 +2114,13 @@ declare class ZoomDependentExpression<Kind extends EvaluationKind> {
2107
2114
  type ConstantExpression = {
2108
2115
  kind: "constant";
2109
2116
  configDependencies: Set<string>;
2117
+ isIndoorDependent: boolean;
2110
2118
  readonly evaluate: <T = unknown>(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, iconImageUseTheme?: string) => T;
2111
2119
  };
2112
2120
  type SourceExpression = {
2113
2121
  kind: "source";
2114
2122
  isStateDependent: boolean;
2123
+ isIndoorDependent: boolean;
2115
2124
  isLightConstant: boolean | null | undefined;
2116
2125
  isLineProgressConstant: boolean | null | undefined;
2117
2126
  configDependencies: Set<string>;
@@ -2120,6 +2129,7 @@ type SourceExpression = {
2120
2129
  type CameraExpression = {
2121
2130
  kind: "camera";
2122
2131
  isStateDependent: boolean;
2132
+ isIndoorDependent: boolean;
2123
2133
  configDependencies: Set<string>;
2124
2134
  readonly evaluate: <T = unknown>(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[]) => T;
2125
2135
  readonly interpolationFactor: (input: number, lower: number, upper: number) => number;
@@ -2129,6 +2139,7 @@ type CameraExpression = {
2129
2139
  interface CompositeExpression {
2130
2140
  kind: "composite";
2131
2141
  isStateDependent: boolean;
2142
+ isIndoorDependent: boolean;
2132
2143
  isLightConstant: boolean | null | undefined;
2133
2144
  isLineProgressConstant: boolean | null | undefined;
2134
2145
  configDependencies: Set<string>;
package/dist/index.es.js CHANGED
@@ -127,6 +127,7 @@ var $root = {
127
127
  },
128
128
  indoor: {
129
129
  type: "indoor",
130
+ "private": true,
130
131
  experimental: true,
131
132
  doc: "Controls the behaviour of indoor features."
132
133
  },
@@ -5599,6 +5600,19 @@ var expression_name = {
5599
5600
  }
5600
5601
  }
5601
5602
  },
5603
+ "is-active-floor": {
5604
+ doc: "Experimental. Returns `true` if the input floor id belongs to one of the active indoor floors, `false` otherwise. In case of array of strings, returns `true` if any of the input floor ids belongs to one of the active indoor floors, `false` otherwise. Only supported in filters.",
5605
+ group: "Indoor",
5606
+ experimental: true,
5607
+ "private": true,
5608
+ "sdk-support": {
5609
+ "basic functionality": {
5610
+ js: "3.16.0",
5611
+ android: "11.16.0",
5612
+ ios: "11.16.0"
5613
+ }
5614
+ }
5615
+ },
5602
5616
  random: {
5603
5617
  doc: "Returns a random value in the specified range (first two input numbers) based on a supplied seed (third input). The seed can be an expression or a constant number or string value.",
5604
5618
  group: "Math",
@@ -6458,26 +6472,29 @@ var colorTheme = {
6458
6472
  }
6459
6473
  }
6460
6474
  };
6461
- var indoor = {
6462
- floorplanFeaturesetId: {
6475
+ var indoor_source = {
6476
+ sourceId: {
6463
6477
  type: "string",
6464
- doc: "An ID of a featureset to be used to query indoor floorplans.",
6478
+ doc: "Source ID of a source to be used to retrieve indoor data.",
6465
6479
  experimental: true,
6480
+ "private": true,
6466
6481
  transition: false,
6467
- "property-type": "data-constant",
6468
- expression: {
6469
- interpolated: false
6470
- }
6482
+ "property-type": "data-constant"
6471
6483
  },
6472
- buildingFeaturesetId: {
6473
- type: "string",
6474
- doc: "An ID of a featureset to be used to add interactivity for building selection.",
6484
+ sourceLayers: {
6485
+ type: "array",
6486
+ value: "string",
6487
+ doc: "An array of source layers to be used to retrieve indoor data.",
6475
6488
  experimental: true,
6489
+ "private": true,
6476
6490
  transition: false,
6477
- "property-type": "data-constant",
6478
- expression: {
6479
- interpolated: false
6480
- }
6491
+ "property-type": "data-constant"
6492
+ }
6493
+ };
6494
+ var indoor = {
6495
+ "*": {
6496
+ type: "indoor_source",
6497
+ doc: "Specification of an indoor source - sourceId and sourceLayer required for vector source, for GeoJSON sourceLayers should be omitted."
6481
6498
  }
6482
6499
  };
6483
6500
  var light = {
@@ -10895,6 +10912,7 @@ var v8 = {
10895
10912
  rain: rain,
10896
10913
  camera: camera,
10897
10914
  colorTheme: colorTheme,
10915
+ indoor_source: indoor_source,
10898
10916
  indoor: indoor,
10899
10917
  light: light,
10900
10918
  projection: projection,
@@ -16581,23 +16599,6 @@ function isStateConstant(e) {
16581
16599
  });
16582
16600
  return result;
16583
16601
  }
16584
- function getConfigDependencies(e) {
16585
- if (e instanceof Config) {
16586
- const singleConfig = /* @__PURE__ */
16587
- new Set([e.key]);
16588
- return singleConfig;
16589
- }
16590
- let result = /* @__PURE__ */
16591
- new Set();
16592
- e.eachChild(arg => {
16593
- result = /* @__PURE__ */
16594
- new Set([
16595
- ...result,
16596
- ...getConfigDependencies(arg)
16597
- ]);
16598
- });
16599
- return result;
16600
- }
16601
16602
  function isGlobalPropertyConstant(e, properties) {
16602
16603
  if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {
16603
16604
  return false;
@@ -18576,6 +18577,21 @@ CompoundExpression.register(expressions, {
18576
18577
  [],
18577
18578
  ctx => ctx.globals.worldview || ''
18578
18579
  ],
18580
+ 'is-active-floor': [
18581
+ BooleanType,
18582
+ varargs(StringType),
18583
+ (ctx, args) => {
18584
+ const hasActiveFloors = ctx.globals.activeFloors && ctx.globals.activeFloors.size > 0;
18585
+ if (!hasActiveFloors) {
18586
+ return false;
18587
+ }
18588
+ const floorIds = ctx.globals.activeFloors;
18589
+ return args.some(arg => {
18590
+ const value = arg.evaluate(ctx);
18591
+ return floorIds.has(value);
18592
+ });
18593
+ }
18594
+ ],
18579
18595
  'id': [
18580
18596
  ValueType,
18581
18597
  [],
@@ -19069,6 +19085,36 @@ CompoundExpression.register(expressions, {
19069
19085
  ]
19070
19086
  });
19071
19087
 
19088
+ function getConfigDependencies(e) {
19089
+ if (e instanceof Config) {
19090
+ const singleConfig = /* @__PURE__ */
19091
+ new Set([e.key]);
19092
+ return singleConfig;
19093
+ }
19094
+ let result = /* @__PURE__ */
19095
+ new Set();
19096
+ e.eachChild(arg => {
19097
+ result = /* @__PURE__ */
19098
+ new Set([
19099
+ ...result,
19100
+ ...getConfigDependencies(arg)
19101
+ ]);
19102
+ });
19103
+ return result;
19104
+ }
19105
+ function isIndoorDependent(e) {
19106
+ if (e instanceof CompoundExpression && e.name === 'is-active-floor') {
19107
+ return true;
19108
+ }
19109
+ let result = false;
19110
+ e.eachChild(arg => {
19111
+ if (!result && isIndoorDependent(arg)) {
19112
+ result = true;
19113
+ }
19114
+ });
19115
+ return result;
19116
+ }
19117
+
19072
19118
  function success(value) {
19073
19119
  return {
19074
19120
  result: 'success',
@@ -19322,6 +19368,7 @@ class StyleExpression {
19322
19368
  this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
19323
19369
  this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
19324
19370
  this.configDependencies = getConfigDependencies(expression);
19371
+ this.isIndoorDependent = isIndoorDependent(expression);
19325
19372
  }
19326
19373
  evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection, featureTileCoord, featureDistanceData) {
19327
19374
  this._evaluator.globals = globals;
@@ -19383,6 +19430,7 @@ class ZoomConstantExpression {
19383
19430
  this.isLineProgressConstant = isLineProgressConstant;
19384
19431
  this.isStateDependent = kind !== 'constant' && !isStateConstant(expression.expression);
19385
19432
  this.configDependencies = getConfigDependencies(expression.expression);
19433
+ this.isIndoorDependent = isIndoorDependent(expression.expression);
19386
19434
  }
19387
19435
  evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {
19388
19436
  return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);
@@ -19397,6 +19445,7 @@ class ZoomDependentExpression {
19397
19445
  this.zoomStops = zoomStops;
19398
19446
  this._styleExpression = expression;
19399
19447
  this.isStateDependent = kind !== 'camera' && !isStateConstant(expression.expression);
19448
+ this.isIndoorDependent = isIndoorDependent(expression.expression);
19400
19449
  this.isLightConstant = isLightConstant;
19401
19450
  this.isLineProgressConstant = isLineProgressConstant;
19402
19451
  this.configDependencies = getConfigDependencies(expression.expression);
@@ -19495,6 +19544,7 @@ function normalizePropertyExpression(value, specification, scope, options, iconI
19495
19544
  kind: 'constant',
19496
19545
  configDependencies: /* @__PURE__ */
19497
19546
  new Set(),
19547
+ isIndoorDependent: false,
19498
19548
  evaluate: () => constant
19499
19549
  };
19500
19550
  }
@@ -21593,14 +21643,12 @@ function validateNonExpressionFilter(options) {
21593
21643
  case '<':
21594
21644
  case '<=':
21595
21645
  case '>':
21596
- // @ts-expect-error - falls through
21597
21646
  case '>=':
21598
21647
  if (value.length >= 2 && unbundle(value[1]) === '$type') {
21599
21648
  errors.push(new ValidationError(key, value, `"$type" cannot be use with operator "${ value[0] }"`));
21600
21649
  }
21601
21650
  /* falls through */
21602
21651
  case '==':
21603
- // @ts-expect-error - falls through
21604
21652
  case '!=':
21605
21653
  if (value.length !== 3) {
21606
21654
  errors.push(new ValidationError(key, value, `filter array for operator "${ value[0] }" must have 3 elements`));
@@ -21662,16 +21710,16 @@ function validateProperty(options, propertyType) {
21662
21710
  return [];
21663
21711
  const useThemeMatch = propertyKey.match(/^(.*)-use-theme$/);
21664
21712
  if (useThemeMatch && layerSpec[useThemeMatch[1]]) {
21665
- if (isExpression(value)) {
21713
+ if (isExpression(deepUnbundle(value))) {
21666
21714
  const errors2 = [];
21667
21715
  return errors2.concat(validate({
21668
- key: options.key,
21716
+ key,
21669
21717
  value,
21670
21718
  valueSpec: {
21671
- 'type': 'string',
21672
- 'expression': {
21673
- 'interpolated': false,
21674
- 'parameters': [
21719
+ type: 'string',
21720
+ expression: {
21721
+ interpolated: false,
21722
+ parameters: [
21675
21723
  'zoom',
21676
21724
  'feature'
21677
21725
  ]
@@ -21736,7 +21784,6 @@ Use an identity property function instead: ${ example }.`)];
21736
21784
  return errors.concat(validate({
21737
21785
  key: options.key,
21738
21786
  value,
21739
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
21740
21787
  valueSpec,
21741
21788
  style,
21742
21789
  styleSpec,
@@ -21768,7 +21815,7 @@ function validateAppearance(options) {
21768
21815
  }, options2))
21769
21816
  }
21770
21817
  });
21771
- if (name !== 'hidden' && !condition) {
21818
+ if (name !== 'hidden' && condition === void 0) {
21772
21819
  errors.push(new ValidationError(options.key, 'name', `Appearance with name different than "hidden" must have a condition`));
21773
21820
  }
21774
21821
  return errors;
@@ -21792,7 +21839,6 @@ function validateProperties(options) {
21792
21839
  layer,
21793
21840
  layerType,
21794
21841
  value: properties[propertyKey],
21795
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
21796
21842
  valueSpec: propertyType === 'paint' ? paintProperties[propertyKey] : layoutProperties[propertyKey]
21797
21843
  });
21798
21844
  errors.push(...validateProperty(propertyValidationOptions, propertyType));