@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/CHANGELOG.md +2 -0
- package/dist/index.cjs +88 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +13 -2
- package/dist/index.es.js +88 -42
- package/dist/index.es.js.map +1 -1
- package/expression/definitions/index.ts +13 -0
- package/expression/expression_dependencies.ts +33 -0
- package/expression/index.ts +16 -5
- package/expression/is_constant.ts +1 -14
- package/package.json +3 -2
- package/reference/v8.json +31 -14
- package/types.ts +6 -2
- package/validate/validate_appearance.ts +5 -7
- package/validate/validate_expression.ts +1 -1
- package/validate/validate_filter.ts +0 -2
- package/validate/validate_layer.ts +3 -2
- package/validate/validate_property.ts +11 -20
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -133,6 +133,7 @@
|
|
|
133
133
|
},
|
|
134
134
|
indoor: {
|
|
135
135
|
type: "indoor",
|
|
136
|
+
"private": true,
|
|
136
137
|
experimental: true,
|
|
137
138
|
doc: "Controls the behaviour of indoor features."
|
|
138
139
|
},
|
|
@@ -5605,6 +5606,19 @@
|
|
|
5605
5606
|
}
|
|
5606
5607
|
}
|
|
5607
5608
|
},
|
|
5609
|
+
"is-active-floor": {
|
|
5610
|
+
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.",
|
|
5611
|
+
group: "Indoor",
|
|
5612
|
+
experimental: true,
|
|
5613
|
+
"private": true,
|
|
5614
|
+
"sdk-support": {
|
|
5615
|
+
"basic functionality": {
|
|
5616
|
+
js: "3.16.0",
|
|
5617
|
+
android: "11.16.0",
|
|
5618
|
+
ios: "11.16.0"
|
|
5619
|
+
}
|
|
5620
|
+
}
|
|
5621
|
+
},
|
|
5608
5622
|
random: {
|
|
5609
5623
|
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.",
|
|
5610
5624
|
group: "Math",
|
|
@@ -6464,26 +6478,29 @@
|
|
|
6464
6478
|
}
|
|
6465
6479
|
}
|
|
6466
6480
|
};
|
|
6467
|
-
var
|
|
6468
|
-
|
|
6481
|
+
var indoor_source = {
|
|
6482
|
+
sourceId: {
|
|
6469
6483
|
type: "string",
|
|
6470
|
-
doc: "
|
|
6484
|
+
doc: "Source ID of a source to be used to retrieve indoor data.",
|
|
6471
6485
|
experimental: true,
|
|
6486
|
+
"private": true,
|
|
6472
6487
|
transition: false,
|
|
6473
|
-
"property-type": "data-constant"
|
|
6474
|
-
expression: {
|
|
6475
|
-
interpolated: false
|
|
6476
|
-
}
|
|
6488
|
+
"property-type": "data-constant"
|
|
6477
6489
|
},
|
|
6478
|
-
|
|
6479
|
-
type: "
|
|
6480
|
-
|
|
6490
|
+
sourceLayers: {
|
|
6491
|
+
type: "array",
|
|
6492
|
+
value: "string",
|
|
6493
|
+
doc: "An array of source layers to be used to retrieve indoor data.",
|
|
6481
6494
|
experimental: true,
|
|
6495
|
+
"private": true,
|
|
6482
6496
|
transition: false,
|
|
6483
|
-
"property-type": "data-constant"
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6497
|
+
"property-type": "data-constant"
|
|
6498
|
+
}
|
|
6499
|
+
};
|
|
6500
|
+
var indoor = {
|
|
6501
|
+
"*": {
|
|
6502
|
+
type: "indoor_source",
|
|
6503
|
+
doc: "Specification of an indoor source - sourceId and sourceLayer required for vector source, for GeoJSON sourceLayers should be omitted."
|
|
6487
6504
|
}
|
|
6488
6505
|
};
|
|
6489
6506
|
var light = {
|
|
@@ -10901,6 +10918,7 @@
|
|
|
10901
10918
|
rain: rain,
|
|
10902
10919
|
camera: camera,
|
|
10903
10920
|
colorTheme: colorTheme,
|
|
10921
|
+
indoor_source: indoor_source,
|
|
10904
10922
|
indoor: indoor,
|
|
10905
10923
|
light: light,
|
|
10906
10924
|
projection: projection,
|
|
@@ -16587,23 +16605,6 @@
|
|
|
16587
16605
|
});
|
|
16588
16606
|
return result;
|
|
16589
16607
|
}
|
|
16590
|
-
function getConfigDependencies(e) {
|
|
16591
|
-
if (e instanceof Config) {
|
|
16592
|
-
const singleConfig = /* @__PURE__ */
|
|
16593
|
-
new Set([e.key]);
|
|
16594
|
-
return singleConfig;
|
|
16595
|
-
}
|
|
16596
|
-
let result = /* @__PURE__ */
|
|
16597
|
-
new Set();
|
|
16598
|
-
e.eachChild(arg => {
|
|
16599
|
-
result = /* @__PURE__ */
|
|
16600
|
-
new Set([
|
|
16601
|
-
...result,
|
|
16602
|
-
...getConfigDependencies(arg)
|
|
16603
|
-
]);
|
|
16604
|
-
});
|
|
16605
|
-
return result;
|
|
16606
|
-
}
|
|
16607
16608
|
function isGlobalPropertyConstant(e, properties) {
|
|
16608
16609
|
if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) {
|
|
16609
16610
|
return false;
|
|
@@ -18582,6 +18583,21 @@
|
|
|
18582
18583
|
[],
|
|
18583
18584
|
ctx => ctx.globals.worldview || ''
|
|
18584
18585
|
],
|
|
18586
|
+
'is-active-floor': [
|
|
18587
|
+
BooleanType,
|
|
18588
|
+
varargs(StringType),
|
|
18589
|
+
(ctx, args) => {
|
|
18590
|
+
const hasActiveFloors = ctx.globals.activeFloors && ctx.globals.activeFloors.size > 0;
|
|
18591
|
+
if (!hasActiveFloors) {
|
|
18592
|
+
return false;
|
|
18593
|
+
}
|
|
18594
|
+
const floorIds = ctx.globals.activeFloors;
|
|
18595
|
+
return args.some(arg => {
|
|
18596
|
+
const value = arg.evaluate(ctx);
|
|
18597
|
+
return floorIds.has(value);
|
|
18598
|
+
});
|
|
18599
|
+
}
|
|
18600
|
+
],
|
|
18585
18601
|
'id': [
|
|
18586
18602
|
ValueType,
|
|
18587
18603
|
[],
|
|
@@ -19075,6 +19091,36 @@
|
|
|
19075
19091
|
]
|
|
19076
19092
|
});
|
|
19077
19093
|
|
|
19094
|
+
function getConfigDependencies(e) {
|
|
19095
|
+
if (e instanceof Config) {
|
|
19096
|
+
const singleConfig = /* @__PURE__ */
|
|
19097
|
+
new Set([e.key]);
|
|
19098
|
+
return singleConfig;
|
|
19099
|
+
}
|
|
19100
|
+
let result = /* @__PURE__ */
|
|
19101
|
+
new Set();
|
|
19102
|
+
e.eachChild(arg => {
|
|
19103
|
+
result = /* @__PURE__ */
|
|
19104
|
+
new Set([
|
|
19105
|
+
...result,
|
|
19106
|
+
...getConfigDependencies(arg)
|
|
19107
|
+
]);
|
|
19108
|
+
});
|
|
19109
|
+
return result;
|
|
19110
|
+
}
|
|
19111
|
+
function isIndoorDependent(e) {
|
|
19112
|
+
if (e instanceof CompoundExpression && e.name === 'is-active-floor') {
|
|
19113
|
+
return true;
|
|
19114
|
+
}
|
|
19115
|
+
let result = false;
|
|
19116
|
+
e.eachChild(arg => {
|
|
19117
|
+
if (!result && isIndoorDependent(arg)) {
|
|
19118
|
+
result = true;
|
|
19119
|
+
}
|
|
19120
|
+
});
|
|
19121
|
+
return result;
|
|
19122
|
+
}
|
|
19123
|
+
|
|
19078
19124
|
function success(value) {
|
|
19079
19125
|
return {
|
|
19080
19126
|
result: 'success',
|
|
@@ -19328,6 +19374,7 @@
|
|
|
19328
19374
|
this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;
|
|
19329
19375
|
this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;
|
|
19330
19376
|
this.configDependencies = getConfigDependencies(expression);
|
|
19377
|
+
this.isIndoorDependent = isIndoorDependent(expression);
|
|
19331
19378
|
}
|
|
19332
19379
|
evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection, featureTileCoord, featureDistanceData) {
|
|
19333
19380
|
this._evaluator.globals = globals;
|
|
@@ -19389,6 +19436,7 @@
|
|
|
19389
19436
|
this.isLineProgressConstant = isLineProgressConstant;
|
|
19390
19437
|
this.isStateDependent = kind !== 'constant' && !isStateConstant(expression.expression);
|
|
19391
19438
|
this.configDependencies = getConfigDependencies(expression.expression);
|
|
19439
|
+
this.isIndoorDependent = isIndoorDependent(expression.expression);
|
|
19392
19440
|
}
|
|
19393
19441
|
evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {
|
|
19394
19442
|
return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);
|
|
@@ -19403,6 +19451,7 @@
|
|
|
19403
19451
|
this.zoomStops = zoomStops;
|
|
19404
19452
|
this._styleExpression = expression;
|
|
19405
19453
|
this.isStateDependent = kind !== 'camera' && !isStateConstant(expression.expression);
|
|
19454
|
+
this.isIndoorDependent = isIndoorDependent(expression.expression);
|
|
19406
19455
|
this.isLightConstant = isLightConstant;
|
|
19407
19456
|
this.isLineProgressConstant = isLineProgressConstant;
|
|
19408
19457
|
this.configDependencies = getConfigDependencies(expression.expression);
|
|
@@ -19501,6 +19550,7 @@
|
|
|
19501
19550
|
kind: 'constant',
|
|
19502
19551
|
configDependencies: /* @__PURE__ */
|
|
19503
19552
|
new Set(),
|
|
19553
|
+
isIndoorDependent: false,
|
|
19504
19554
|
evaluate: () => constant
|
|
19505
19555
|
};
|
|
19506
19556
|
}
|
|
@@ -21599,14 +21649,12 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
21599
21649
|
case '<':
|
|
21600
21650
|
case '<=':
|
|
21601
21651
|
case '>':
|
|
21602
|
-
// @ts-expect-error - falls through
|
|
21603
21652
|
case '>=':
|
|
21604
21653
|
if (value.length >= 2 && unbundle(value[1]) === '$type') {
|
|
21605
21654
|
errors.push(new ValidationError(key, value, `"$type" cannot be use with operator "${ value[0] }"`));
|
|
21606
21655
|
}
|
|
21607
21656
|
/* falls through */
|
|
21608
21657
|
case '==':
|
|
21609
|
-
// @ts-expect-error - falls through
|
|
21610
21658
|
case '!=':
|
|
21611
21659
|
if (value.length !== 3) {
|
|
21612
21660
|
errors.push(new ValidationError(key, value, `filter array for operator "${ value[0] }" must have 3 elements`));
|
|
@@ -21668,16 +21716,16 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
21668
21716
|
return [];
|
|
21669
21717
|
const useThemeMatch = propertyKey.match(/^(.*)-use-theme$/);
|
|
21670
21718
|
if (useThemeMatch && layerSpec[useThemeMatch[1]]) {
|
|
21671
|
-
if (isExpression(value)) {
|
|
21719
|
+
if (isExpression(deepUnbundle(value))) {
|
|
21672
21720
|
const errors2 = [];
|
|
21673
21721
|
return errors2.concat(validate({
|
|
21674
|
-
key
|
|
21722
|
+
key,
|
|
21675
21723
|
value,
|
|
21676
21724
|
valueSpec: {
|
|
21677
|
-
|
|
21678
|
-
|
|
21679
|
-
|
|
21680
|
-
|
|
21725
|
+
type: 'string',
|
|
21726
|
+
expression: {
|
|
21727
|
+
interpolated: false,
|
|
21728
|
+
parameters: [
|
|
21681
21729
|
'zoom',
|
|
21682
21730
|
'feature'
|
|
21683
21731
|
]
|
|
@@ -21742,7 +21790,6 @@ Use an identity property function instead: ${ example }.`)];
|
|
|
21742
21790
|
return errors.concat(validate({
|
|
21743
21791
|
key: options.key,
|
|
21744
21792
|
value,
|
|
21745
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
21746
21793
|
valueSpec,
|
|
21747
21794
|
style,
|
|
21748
21795
|
styleSpec,
|
|
@@ -21774,7 +21821,7 @@ Use an identity property function instead: ${ example }.`)];
|
|
|
21774
21821
|
}, options2))
|
|
21775
21822
|
}
|
|
21776
21823
|
});
|
|
21777
|
-
if (name !== 'hidden' &&
|
|
21824
|
+
if (name !== 'hidden' && condition === void 0) {
|
|
21778
21825
|
errors.push(new ValidationError(options.key, 'name', `Appearance with name different than "hidden" must have a condition`));
|
|
21779
21826
|
}
|
|
21780
21827
|
return errors;
|
|
@@ -21798,7 +21845,6 @@ Use an identity property function instead: ${ example }.`)];
|
|
|
21798
21845
|
layer,
|
|
21799
21846
|
layerType,
|
|
21800
21847
|
value: properties[propertyKey],
|
|
21801
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
21802
21848
|
valueSpec: propertyType === 'paint' ? paintProperties[propertyKey] : layoutProperties[propertyKey]
|
|
21803
21849
|
});
|
|
21804
21850
|
errors.push(...validateProperty(propertyValidationOptions, propertyType));
|