@mapbox/mapbox-gl-style-spec 14.6.0-beta.1 → 14.7.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.cjs +280 -327
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +65 -29
- package/dist/index.es.js +280 -327
- package/dist/index.es.js.map +1 -1
- package/expression/compound_expression.ts +1 -2
- package/expression/definitions/assertion.ts +1 -2
- package/expression/definitions/at.ts +0 -1
- package/expression/definitions/case.ts +0 -1
- package/expression/definitions/coalesce.ts +1 -2
- package/expression/definitions/coercion.ts +1 -2
- package/expression/definitions/collator.ts +7 -5
- package/expression/definitions/distance.ts +1 -1
- package/expression/definitions/format.ts +4 -4
- package/expression/definitions/index.ts +0 -1
- package/expression/definitions/interpolate.ts +1 -2
- package/expression/definitions/length.ts +1 -2
- package/expression/definitions/match.ts +0 -1
- package/expression/definitions/number_format.ts +5 -5
- package/expression/definitions/step.ts +0 -1
- package/expression/definitions/within.ts +3 -3
- package/expression/expression.ts +4 -4
- package/expression/index.ts +3 -6
- package/expression/is_constant.ts +1 -0
- package/expression/parsing_context.ts +28 -5
- package/expression/values.ts +1 -2
- package/feature_filter/index.ts +6 -5
- package/group_by_layout.ts +2 -2
- package/package.json +1 -1
- package/reference/v8.json +231 -20
- package/rollup.config.js +1 -2
- package/style-spec.ts +2 -3
- package/types.ts +72 -40
- package/union-to-intersection.ts +4 -0
- package/util/color.ts +1 -0
- package/util/color_spaces.ts +0 -1
- package/util/deep_equal.ts +1 -1
- package/util/geometry_util.ts +1 -2
- package/validate/validate.ts +2 -3
- package/validate/validate_expression.ts +0 -1
- package/validate/validate_function.ts +1 -1
- package/validate/validate_property.ts +2 -3
- package/validate/validate_style.ts +1 -2
- package/validate_style.min.ts +0 -1
- package/visit.ts +2 -2
package/dist/index.es.js
CHANGED
|
@@ -208,6 +208,71 @@ var $root = {
|
|
|
208
208
|
"spruce1-lod1": "asset://spruce1-lod1.glb",
|
|
209
209
|
"spruce1-lod2": "asset://spruce1-lod2.glb"
|
|
210
210
|
}
|
|
211
|
+
},
|
|
212
|
+
featuresets: {
|
|
213
|
+
experimental: true,
|
|
214
|
+
type: "featuresets",
|
|
215
|
+
doc: "Defines sets of features for querying, interaction, and feature state manipulation.",
|
|
216
|
+
example: {
|
|
217
|
+
poi: {
|
|
218
|
+
selectors: [
|
|
219
|
+
{
|
|
220
|
+
layer: "poi",
|
|
221
|
+
properties: {
|
|
222
|
+
type: [
|
|
223
|
+
"get",
|
|
224
|
+
"type"
|
|
225
|
+
],
|
|
226
|
+
name: [
|
|
227
|
+
"get",
|
|
228
|
+
"name"
|
|
229
|
+
],
|
|
230
|
+
brand: "ABC"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
var featuresets = {
|
|
239
|
+
experimental: true,
|
|
240
|
+
"*": {
|
|
241
|
+
type: "featureset",
|
|
242
|
+
doc: "Defines a combined set of features from one or more underlying layers within the current style. Features in a style featureset can be queried, interacted with, and their states can be queried and updated."
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
var featureset = {
|
|
246
|
+
experimental: true,
|
|
247
|
+
selectors: {
|
|
248
|
+
type: "array",
|
|
249
|
+
value: "selector",
|
|
250
|
+
doc: "A collection of categorized selectors."
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
var selector = {
|
|
254
|
+
experimental: true,
|
|
255
|
+
layer: {
|
|
256
|
+
type: "string",
|
|
257
|
+
doc: "The ID of a layer that exists in the current style.",
|
|
258
|
+
required: true
|
|
259
|
+
},
|
|
260
|
+
properties: {
|
|
261
|
+
type: "selectorProperty",
|
|
262
|
+
required: false,
|
|
263
|
+
doc: "Properties accessible to the end user through queried feautures. If properties are empty, no feature properties are exposed. If undefined, all original feature properties will be accessible."
|
|
264
|
+
},
|
|
265
|
+
featureNamespace: {
|
|
266
|
+
type: "string",
|
|
267
|
+
required: false,
|
|
268
|
+
doc: "An optional field that represents the feature namespace defined by the selector within a featureset to which this feature belongs. If the underlying source is the same for multiple selectors within a featureset, the same featureNamespace should be used across those selectors."
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
var selectorProperty = {
|
|
272
|
+
experimental: true,
|
|
273
|
+
"*": {
|
|
274
|
+
type: "*",
|
|
275
|
+
doc: "The value of the property. It can be an expression that generates the returned value from the feature, or a constant value specifying the returned value."
|
|
211
276
|
}
|
|
212
277
|
};
|
|
213
278
|
var model = {
|
|
@@ -377,9 +442,6 @@ var properties_light_directional = {
|
|
|
377
442
|
"default": false,
|
|
378
443
|
doc: "Enable/Disable shadow casting for this light",
|
|
379
444
|
transition: false,
|
|
380
|
-
expression: {
|
|
381
|
-
interpolated: false
|
|
382
|
-
},
|
|
383
445
|
"property-type": "data-constant",
|
|
384
446
|
"sdk-support": {
|
|
385
447
|
"basic functionality": {
|
|
@@ -465,7 +527,7 @@ var properties_light_flat = {
|
|
|
465
527
|
doc: "The position of the light source is aligned to the rotation of the map."
|
|
466
528
|
},
|
|
467
529
|
viewport: {
|
|
468
|
-
doc: "The position of the light source is aligned to the rotation of the viewport."
|
|
530
|
+
doc: "The position of the light source is aligned to the rotation of the viewport. If terrain is enabled, performance regressions may occur in certain scenarios, particularly on lower-end hardware. Ensure that you test your target scenarios on the appropriate hardware to verify performance."
|
|
469
531
|
}
|
|
470
532
|
},
|
|
471
533
|
"property-type": "data-constant",
|
|
@@ -1440,6 +1502,25 @@ var layout_clip = {
|
|
|
1440
1502
|
},
|
|
1441
1503
|
"property-type": "data-constant",
|
|
1442
1504
|
experimental: true
|
|
1505
|
+
},
|
|
1506
|
+
"clip-layer-scope": {
|
|
1507
|
+
type: "array",
|
|
1508
|
+
value: "string",
|
|
1509
|
+
"default": [
|
|
1510
|
+
],
|
|
1511
|
+
doc: "Removes content from layers with the specified scope. By default all layers are affected. For example specifying `basemap` will only remove content from the Mapbox Standard style layers which have the same scope",
|
|
1512
|
+
"sdk-support": {
|
|
1513
|
+
"basic functionality": {
|
|
1514
|
+
js: "3.6.0",
|
|
1515
|
+
android: "11.7.0",
|
|
1516
|
+
ios: "11.7.0"
|
|
1517
|
+
}
|
|
1518
|
+
},
|
|
1519
|
+
expression: {
|
|
1520
|
+
interpolated: false
|
|
1521
|
+
},
|
|
1522
|
+
"property-type": "data-constant",
|
|
1523
|
+
experimental: true
|
|
1443
1524
|
}
|
|
1444
1525
|
};
|
|
1445
1526
|
var layout_fill = {
|
|
@@ -5215,6 +5296,30 @@ var paint_fill = {
|
|
|
5215
5296
|
]
|
|
5216
5297
|
},
|
|
5217
5298
|
"property-type": "data-constant"
|
|
5299
|
+
},
|
|
5300
|
+
"fill-z-offset": {
|
|
5301
|
+
type: "number",
|
|
5302
|
+
doc: "Specifies an uniform elevation in meters. Note: If the value is zero, the layer will be rendered on the ground. Non-zero values will elevate the layer from the sea level, which can cause it to be rendered below the terrain.",
|
|
5303
|
+
"default": 0,
|
|
5304
|
+
minimum: 0,
|
|
5305
|
+
transition: true,
|
|
5306
|
+
experimental: true,
|
|
5307
|
+
"sdk-support": {
|
|
5308
|
+
"basic functionality": {
|
|
5309
|
+
js: "3.7.0"
|
|
5310
|
+
},
|
|
5311
|
+
"data-driven styling": {
|
|
5312
|
+
js: "3.7.0"
|
|
5313
|
+
}
|
|
5314
|
+
},
|
|
5315
|
+
expression: {
|
|
5316
|
+
interpolated: true,
|
|
5317
|
+
parameters: [
|
|
5318
|
+
"zoom",
|
|
5319
|
+
"feature"
|
|
5320
|
+
]
|
|
5321
|
+
},
|
|
5322
|
+
"property-type": "data-driven"
|
|
5218
5323
|
}
|
|
5219
5324
|
};
|
|
5220
5325
|
var paint_line = {
|
|
@@ -5763,7 +5868,6 @@ var paint_line = {
|
|
|
5763
5868
|
"default": 0,
|
|
5764
5869
|
minimum: 0,
|
|
5765
5870
|
maximum: 1,
|
|
5766
|
-
experimental: true,
|
|
5767
5871
|
doc: "Opacity multiplier (multiplies line-opacity value) of the line part that is occluded by 3D objects. Value 0 hides occluded part, value 1 means the same opacity as non-occluded part. The property is not supported when `line-opacity` has data-driven styling.",
|
|
5768
5872
|
"sdk-support": {
|
|
5769
5873
|
"basic functionality": {
|
|
@@ -6305,11 +6409,11 @@ var paint_symbol = {
|
|
|
6305
6409
|
"property-type": "data-driven"
|
|
6306
6410
|
},
|
|
6307
6411
|
"icon-occlusion-opacity": {
|
|
6308
|
-
doc: "The opacity at which the icon will be drawn in case of being depth occluded.
|
|
6412
|
+
doc: "The opacity at which the icon will be drawn in case of being depth occluded. Absent value means full occlusion against terrain only.",
|
|
6309
6413
|
type: "number",
|
|
6310
6414
|
minimum: 0,
|
|
6311
6415
|
maximum: 1,
|
|
6312
|
-
"default":
|
|
6416
|
+
"default": 0,
|
|
6313
6417
|
transition: true,
|
|
6314
6418
|
requires: [
|
|
6315
6419
|
"icon-image"
|
|
@@ -6655,10 +6759,10 @@ var paint_symbol = {
|
|
|
6655
6759
|
},
|
|
6656
6760
|
"text-occlusion-opacity": {
|
|
6657
6761
|
type: "number",
|
|
6658
|
-
doc: "The opacity at which the text will be drawn in case of being depth occluded.
|
|
6762
|
+
doc: "The opacity at which the text will be drawn in case of being depth occluded. Absent value means full occlusion against terrain only.",
|
|
6659
6763
|
minimum: 0,
|
|
6660
6764
|
maximum: 1,
|
|
6661
|
-
"default":
|
|
6765
|
+
"default": 0,
|
|
6662
6766
|
transition: true,
|
|
6663
6767
|
requires: [
|
|
6664
6768
|
"text-field"
|
|
@@ -6950,6 +7054,62 @@ var paint_symbol = {
|
|
|
6950
7054
|
interpolated: false
|
|
6951
7055
|
},
|
|
6952
7056
|
"property-type": "data-constant"
|
|
7057
|
+
},
|
|
7058
|
+
"symbol-z-offset": {
|
|
7059
|
+
type: "number",
|
|
7060
|
+
doc: "Specifies an uniform elevation from the ground, in meters.",
|
|
7061
|
+
"default": 0,
|
|
7062
|
+
minimum: 0,
|
|
7063
|
+
transition: true,
|
|
7064
|
+
experimental: true,
|
|
7065
|
+
"sdk-support": {
|
|
7066
|
+
"basic functionality": {
|
|
7067
|
+
js: "3.7.0",
|
|
7068
|
+
android: "11.7.0",
|
|
7069
|
+
ios: "11.7.0"
|
|
7070
|
+
},
|
|
7071
|
+
"data-driven styling": {
|
|
7072
|
+
js: "3.7.0",
|
|
7073
|
+
android: "11.7.0",
|
|
7074
|
+
ios: "11.7.0"
|
|
7075
|
+
}
|
|
7076
|
+
},
|
|
7077
|
+
expression: {
|
|
7078
|
+
interpolated: true,
|
|
7079
|
+
parameters: [
|
|
7080
|
+
"zoom",
|
|
7081
|
+
"feature"
|
|
7082
|
+
]
|
|
7083
|
+
},
|
|
7084
|
+
"property-type": "data-driven"
|
|
7085
|
+
},
|
|
7086
|
+
"symbol-elevation-reference": {
|
|
7087
|
+
type: "enum",
|
|
7088
|
+
doc: "Selects the base of symbol-elevation.",
|
|
7089
|
+
values: {
|
|
7090
|
+
sea: {
|
|
7091
|
+
doc: "Elevate symbols relative to the sea level."
|
|
7092
|
+
},
|
|
7093
|
+
ground: {
|
|
7094
|
+
doc: "Elevate symbols relative to the ground's height below them."
|
|
7095
|
+
}
|
|
7096
|
+
},
|
|
7097
|
+
"default": "ground",
|
|
7098
|
+
experimental: true,
|
|
7099
|
+
"sdk-support": {
|
|
7100
|
+
"basic functionality": {
|
|
7101
|
+
js: "3.7.0",
|
|
7102
|
+
android: "11.7.0",
|
|
7103
|
+
ios: "11.7.0"
|
|
7104
|
+
}
|
|
7105
|
+
},
|
|
7106
|
+
expression: {
|
|
7107
|
+
interpolated: false,
|
|
7108
|
+
parameters: [
|
|
7109
|
+
"zoom"
|
|
7110
|
+
]
|
|
7111
|
+
},
|
|
7112
|
+
"property-type": "data-constant"
|
|
6953
7113
|
}
|
|
6954
7114
|
};
|
|
6955
7115
|
var paint_raster = {
|
|
@@ -8002,9 +8162,6 @@ var paint_model = {
|
|
|
8002
8162
|
"default": true,
|
|
8003
8163
|
doc: "Enable/Disable shadow casting for this layer",
|
|
8004
8164
|
transition: false,
|
|
8005
|
-
expression: {
|
|
8006
|
-
interpolated: false
|
|
8007
|
-
},
|
|
8008
8165
|
"sdk-support": {
|
|
8009
8166
|
"basic functionality": {
|
|
8010
8167
|
js: "3.0.0",
|
|
@@ -8019,9 +8176,6 @@ var paint_model = {
|
|
|
8019
8176
|
"default": true,
|
|
8020
8177
|
doc: "Enable/Disable shadow receiving for this layer",
|
|
8021
8178
|
transition: false,
|
|
8022
|
-
expression: {
|
|
8023
|
-
interpolated: false
|
|
8024
|
-
},
|
|
8025
8179
|
"sdk-support": {
|
|
8026
8180
|
"basic functionality": {
|
|
8027
8181
|
js: "3.0.0",
|
|
@@ -8228,6 +8382,10 @@ var promoteId = {
|
|
|
8228
8382
|
var v8 = {
|
|
8229
8383
|
$version: $version,
|
|
8230
8384
|
$root: $root,
|
|
8385
|
+
featuresets: featuresets,
|
|
8386
|
+
featureset: featureset,
|
|
8387
|
+
selector: selector,
|
|
8388
|
+
selectorProperty: selectorProperty,
|
|
8231
8389
|
model: model,
|
|
8232
8390
|
"import": {
|
|
8233
8391
|
id: {
|
|
@@ -8356,7 +8514,6 @@ var v8 = {
|
|
|
8356
8514
|
"fill-extrusion-edge-radius": {
|
|
8357
8515
|
type: "number",
|
|
8358
8516
|
experimental: true,
|
|
8359
|
-
"private": true,
|
|
8360
8517
|
"default": 0,
|
|
8361
8518
|
minimum: 0,
|
|
8362
8519
|
maximum: 1,
|
|
@@ -8730,7 +8887,6 @@ var v8 = {
|
|
|
8730
8887
|
"fill-extrusion-ambient-occlusion-intensity": {
|
|
8731
8888
|
"property-type": "data-constant",
|
|
8732
8889
|
type: "number",
|
|
8733
|
-
"private": true,
|
|
8734
8890
|
"default": 0,
|
|
8735
8891
|
minimum: 0,
|
|
8736
8892
|
maximum: 1,
|
|
@@ -8753,7 +8909,6 @@ var v8 = {
|
|
|
8753
8909
|
"fill-extrusion-ambient-occlusion-radius": {
|
|
8754
8910
|
"property-type": "data-constant",
|
|
8755
8911
|
type: "number",
|
|
8756
|
-
"private": true,
|
|
8757
8912
|
"default": 3,
|
|
8758
8913
|
minimum: 0,
|
|
8759
8914
|
expression: {
|
|
@@ -8942,7 +9097,7 @@ var v8 = {
|
|
|
8942
9097
|
experimental: true,
|
|
8943
9098
|
units: "meters",
|
|
8944
9099
|
"default": 0,
|
|
8945
|
-
doc: "The extent of the flood light effect on the ground beneath the extruded buildings in meters.",
|
|
9100
|
+
doc: "The extent of the flood light effect on the ground beneath the extruded buildings in meters. Note: this experimental property is evaluated once per tile, during tile initialization. Changing the property value could trigger tile reload. The `feature-state` styling is deprecated and will get removed soon.",
|
|
8946
9101
|
requires: [
|
|
8947
9102
|
"lights"
|
|
8948
9103
|
],
|
|
@@ -9083,6 +9238,51 @@ var v8 = {
|
|
|
9083
9238
|
]
|
|
9084
9239
|
},
|
|
9085
9240
|
"property-type": "data-constant"
|
|
9241
|
+
},
|
|
9242
|
+
"fill-extrusion-line-width": {
|
|
9243
|
+
type: "number",
|
|
9244
|
+
"default": 0,
|
|
9245
|
+
minimum: 0,
|
|
9246
|
+
transition: true,
|
|
9247
|
+
experimental: true,
|
|
9248
|
+
units: "meters",
|
|
9249
|
+
doc: "If a non-zero value is provided, it sets the fill-extrusion layer into wall rendering mode. The value is used to render the feature with the given width over the outlines of the geometry. Note: This property is experimental and some other fill-extrusion properties might not be supported with non-zero line width.",
|
|
9250
|
+
"sdk-support": {
|
|
9251
|
+
"basic functionality": {
|
|
9252
|
+
js: "3.7.0",
|
|
9253
|
+
android: "11.7.0",
|
|
9254
|
+
ios: "11.7.0"
|
|
9255
|
+
},
|
|
9256
|
+
"data-driven styling": {
|
|
9257
|
+
js: "3.7.0",
|
|
9258
|
+
android: "11.7.0",
|
|
9259
|
+
ios: "11.7.0"
|
|
9260
|
+
}
|
|
9261
|
+
},
|
|
9262
|
+
expression: {
|
|
9263
|
+
interpolated: true,
|
|
9264
|
+
parameters: [
|
|
9265
|
+
"zoom",
|
|
9266
|
+
"feature",
|
|
9267
|
+
"feature-state",
|
|
9268
|
+
"measure-light"
|
|
9269
|
+
]
|
|
9270
|
+
},
|
|
9271
|
+
"property-type": "data-driven"
|
|
9272
|
+
},
|
|
9273
|
+
"fill-extrusion-cast-shadows": {
|
|
9274
|
+
type: "boolean",
|
|
9275
|
+
"default": true,
|
|
9276
|
+
doc: "Enable/Disable shadow casting for this layer",
|
|
9277
|
+
transition: false,
|
|
9278
|
+
"sdk-support": {
|
|
9279
|
+
"basic functionality": {
|
|
9280
|
+
js: "3.7.0",
|
|
9281
|
+
android: "11.8.0",
|
|
9282
|
+
ios: "11.8.0"
|
|
9283
|
+
}
|
|
9284
|
+
},
|
|
9285
|
+
"property-type": "data-constant"
|
|
9086
9286
|
}
|
|
9087
9287
|
},
|
|
9088
9288
|
paint_line: paint_line,
|
|
@@ -9216,6 +9416,27 @@ var v8 = {
|
|
|
9216
9416
|
}
|
|
9217
9417
|
},
|
|
9218
9418
|
"property-type": "data-constant"
|
|
9419
|
+
},
|
|
9420
|
+
"raster-particle-elevation": {
|
|
9421
|
+
type: "number",
|
|
9422
|
+
doc: "Specifies an uniform elevation from the ground, in meters.",
|
|
9423
|
+
"default": 0,
|
|
9424
|
+
minimum: 0,
|
|
9425
|
+
transition: true,
|
|
9426
|
+
"sdk-support": {
|
|
9427
|
+
"basic functionality": {
|
|
9428
|
+
js: "3.7.0",
|
|
9429
|
+
android: "11.7.0",
|
|
9430
|
+
ios: "11.7.0"
|
|
9431
|
+
}
|
|
9432
|
+
},
|
|
9433
|
+
expression: {
|
|
9434
|
+
interpolated: true,
|
|
9435
|
+
parameters: [
|
|
9436
|
+
"zoom"
|
|
9437
|
+
]
|
|
9438
|
+
},
|
|
9439
|
+
"property-type": "data-constant"
|
|
9219
9440
|
}
|
|
9220
9441
|
},
|
|
9221
9442
|
paint_hillshade: paint_hillshade,
|
|
@@ -11350,19 +11571,19 @@ class FormatExpression {
|
|
|
11350
11571
|
nextTokenMayBeObject = false;
|
|
11351
11572
|
let scale = null;
|
|
11352
11573
|
if (arg['font-scale']) {
|
|
11353
|
-
scale = context.
|
|
11574
|
+
scale = context.parseObjectValue(arg['font-scale'], i, 'font-scale', NumberType);
|
|
11354
11575
|
if (!scale)
|
|
11355
11576
|
return null;
|
|
11356
11577
|
}
|
|
11357
11578
|
let font = null;
|
|
11358
11579
|
if (arg['text-font']) {
|
|
11359
|
-
font = context.
|
|
11580
|
+
font = context.parseObjectValue(arg['text-font'], i, 'text-font', array$1(StringType));
|
|
11360
11581
|
if (!font)
|
|
11361
11582
|
return null;
|
|
11362
11583
|
}
|
|
11363
11584
|
let textColor = null;
|
|
11364
11585
|
if (arg['text-color']) {
|
|
11365
|
-
textColor = context.
|
|
11586
|
+
textColor = context.parseObjectValue(arg['text-color'], i, 'text-color', ColorType);
|
|
11366
11587
|
if (!textColor)
|
|
11367
11588
|
return null;
|
|
11368
11589
|
}
|
|
@@ -11371,7 +11592,7 @@ class FormatExpression {
|
|
|
11371
11592
|
lastExpression.font = font;
|
|
11372
11593
|
lastExpression.textColor = textColor;
|
|
11373
11594
|
} else {
|
|
11374
|
-
const content = context.parse(args[i],
|
|
11595
|
+
const content = context.parse(args[i], i, ValueType);
|
|
11375
11596
|
if (!content)
|
|
11376
11597
|
return null;
|
|
11377
11598
|
const kind = content.type.kind;
|
|
@@ -11832,15 +12053,15 @@ class CollatorExpression {
|
|
|
11832
12053
|
const options = args[1];
|
|
11833
12054
|
if (typeof options !== 'object' || Array.isArray(options))
|
|
11834
12055
|
return context.error(`Collator options argument must be an object.`);
|
|
11835
|
-
const caseSensitive =
|
|
12056
|
+
const caseSensitive = options['case-sensitive'] === void 0 ? context.parse(false, 1, BooleanType) : context.parseObjectValue(options['case-sensitive'], 1, 'case-sensitive', BooleanType);
|
|
11836
12057
|
if (!caseSensitive)
|
|
11837
12058
|
return null;
|
|
11838
|
-
const diacriticSensitive =
|
|
12059
|
+
const diacriticSensitive = options['diacritic-sensitive'] === void 0 ? context.parse(false, 1, BooleanType) : context.parseObjectValue(options['diacritic-sensitive'], 1, 'diacritic-sensitive', BooleanType);
|
|
11839
12060
|
if (!diacriticSensitive)
|
|
11840
12061
|
return null;
|
|
11841
12062
|
let locale = null;
|
|
11842
12063
|
if (options['locale']) {
|
|
11843
|
-
locale = context.
|
|
12064
|
+
locale = context.parseObjectValue(options['locale'], 1, 'locale', StringType);
|
|
11844
12065
|
if (!locale)
|
|
11845
12066
|
return null;
|
|
11846
12067
|
}
|
|
@@ -12686,295 +12907,6 @@ function wrap(deg) {
|
|
|
12686
12907
|
return deg;
|
|
12687
12908
|
}
|
|
12688
12909
|
|
|
12689
|
-
/**
|
|
12690
|
-
* A standalone point geometry with useful accessor, comparison, and
|
|
12691
|
-
* modification methods.
|
|
12692
|
-
*
|
|
12693
|
-
* @class Point
|
|
12694
|
-
* @param {Number} x the x-coordinate. this could be longitude or screen
|
|
12695
|
-
* pixels, or any other sort of unit.
|
|
12696
|
-
* @param {Number} y the y-coordinate. this could be latitude or screen
|
|
12697
|
-
* pixels, or any other sort of unit.
|
|
12698
|
-
* @example
|
|
12699
|
-
* var point = new Point(-77, 38);
|
|
12700
|
-
*/
|
|
12701
|
-
function Point(x, y) {
|
|
12702
|
-
this.x = x;
|
|
12703
|
-
this.y = y;
|
|
12704
|
-
}
|
|
12705
|
-
Point.prototype = {
|
|
12706
|
-
/**
|
|
12707
|
-
* Clone this point, returning a new point that can be modified
|
|
12708
|
-
* without affecting the old one.
|
|
12709
|
-
* @return {Point} the clone
|
|
12710
|
-
*/
|
|
12711
|
-
clone: function () {
|
|
12712
|
-
return new Point(this.x, this.y);
|
|
12713
|
-
},
|
|
12714
|
-
/**
|
|
12715
|
-
* Add this point's x & y coordinates to another point,
|
|
12716
|
-
* yielding a new point.
|
|
12717
|
-
* @param {Point} p the other point
|
|
12718
|
-
* @return {Point} output point
|
|
12719
|
-
*/
|
|
12720
|
-
add: function (p) {
|
|
12721
|
-
return this.clone()._add(p);
|
|
12722
|
-
},
|
|
12723
|
-
/**
|
|
12724
|
-
* Subtract this point's x & y coordinates to from point,
|
|
12725
|
-
* yielding a new point.
|
|
12726
|
-
* @param {Point} p the other point
|
|
12727
|
-
* @return {Point} output point
|
|
12728
|
-
*/
|
|
12729
|
-
sub: function (p) {
|
|
12730
|
-
return this.clone()._sub(p);
|
|
12731
|
-
},
|
|
12732
|
-
/**
|
|
12733
|
-
* Multiply this point's x & y coordinates by point,
|
|
12734
|
-
* yielding a new point.
|
|
12735
|
-
* @param {Point} p the other point
|
|
12736
|
-
* @return {Point} output point
|
|
12737
|
-
*/
|
|
12738
|
-
multByPoint: function (p) {
|
|
12739
|
-
return this.clone()._multByPoint(p);
|
|
12740
|
-
},
|
|
12741
|
-
/**
|
|
12742
|
-
* Divide this point's x & y coordinates by point,
|
|
12743
|
-
* yielding a new point.
|
|
12744
|
-
* @param {Point} p the other point
|
|
12745
|
-
* @return {Point} output point
|
|
12746
|
-
*/
|
|
12747
|
-
divByPoint: function (p) {
|
|
12748
|
-
return this.clone()._divByPoint(p);
|
|
12749
|
-
},
|
|
12750
|
-
/**
|
|
12751
|
-
* Multiply this point's x & y coordinates by a factor,
|
|
12752
|
-
* yielding a new point.
|
|
12753
|
-
* @param {Point} k factor
|
|
12754
|
-
* @return {Point} output point
|
|
12755
|
-
*/
|
|
12756
|
-
mult: function (k) {
|
|
12757
|
-
return this.clone()._mult(k);
|
|
12758
|
-
},
|
|
12759
|
-
/**
|
|
12760
|
-
* Divide this point's x & y coordinates by a factor,
|
|
12761
|
-
* yielding a new point.
|
|
12762
|
-
* @param {Point} k factor
|
|
12763
|
-
* @return {Point} output point
|
|
12764
|
-
*/
|
|
12765
|
-
div: function (k) {
|
|
12766
|
-
return this.clone()._div(k);
|
|
12767
|
-
},
|
|
12768
|
-
/**
|
|
12769
|
-
* Rotate this point around the 0, 0 origin by an angle a,
|
|
12770
|
-
* given in radians
|
|
12771
|
-
* @param {Number} a angle to rotate around, in radians
|
|
12772
|
-
* @return {Point} output point
|
|
12773
|
-
*/
|
|
12774
|
-
rotate: function (a) {
|
|
12775
|
-
return this.clone()._rotate(a);
|
|
12776
|
-
},
|
|
12777
|
-
/**
|
|
12778
|
-
* Rotate this point around p point by an angle a,
|
|
12779
|
-
* given in radians
|
|
12780
|
-
* @param {Number} a angle to rotate around, in radians
|
|
12781
|
-
* @param {Point} p Point to rotate around
|
|
12782
|
-
* @return {Point} output point
|
|
12783
|
-
*/
|
|
12784
|
-
rotateAround: function (a, p) {
|
|
12785
|
-
return this.clone()._rotateAround(a, p);
|
|
12786
|
-
},
|
|
12787
|
-
/**
|
|
12788
|
-
* Multiply this point by a 4x1 transformation matrix
|
|
12789
|
-
* @param {Array<Number>} m transformation matrix
|
|
12790
|
-
* @return {Point} output point
|
|
12791
|
-
*/
|
|
12792
|
-
matMult: function (m) {
|
|
12793
|
-
return this.clone()._matMult(m);
|
|
12794
|
-
},
|
|
12795
|
-
/**
|
|
12796
|
-
* Calculate this point but as a unit vector from 0, 0, meaning
|
|
12797
|
-
* that the distance from the resulting point to the 0, 0
|
|
12798
|
-
* coordinate will be equal to 1 and the angle from the resulting
|
|
12799
|
-
* point to the 0, 0 coordinate will be the same as before.
|
|
12800
|
-
* @return {Point} unit vector point
|
|
12801
|
-
*/
|
|
12802
|
-
unit: function () {
|
|
12803
|
-
return this.clone()._unit();
|
|
12804
|
-
},
|
|
12805
|
-
/**
|
|
12806
|
-
* Compute a perpendicular point, where the new y coordinate
|
|
12807
|
-
* is the old x coordinate and the new x coordinate is the old y
|
|
12808
|
-
* coordinate multiplied by -1
|
|
12809
|
-
* @return {Point} perpendicular point
|
|
12810
|
-
*/
|
|
12811
|
-
perp: function () {
|
|
12812
|
-
return this.clone()._perp();
|
|
12813
|
-
},
|
|
12814
|
-
/**
|
|
12815
|
-
* Return a version of this point with the x & y coordinates
|
|
12816
|
-
* rounded to integers.
|
|
12817
|
-
* @return {Point} rounded point
|
|
12818
|
-
*/
|
|
12819
|
-
round: function () {
|
|
12820
|
-
return this.clone()._round();
|
|
12821
|
-
},
|
|
12822
|
-
/**
|
|
12823
|
-
* Return the magitude of this point: this is the Euclidean
|
|
12824
|
-
* distance from the 0, 0 coordinate to this point's x and y
|
|
12825
|
-
* coordinates.
|
|
12826
|
-
* @return {Number} magnitude
|
|
12827
|
-
*/
|
|
12828
|
-
mag: function () {
|
|
12829
|
-
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
12830
|
-
},
|
|
12831
|
-
/**
|
|
12832
|
-
* Judge whether this point is equal to another point, returning
|
|
12833
|
-
* true or false.
|
|
12834
|
-
* @param {Point} other the other point
|
|
12835
|
-
* @return {boolean} whether the points are equal
|
|
12836
|
-
*/
|
|
12837
|
-
equals: function (other) {
|
|
12838
|
-
return this.x === other.x && this.y === other.y;
|
|
12839
|
-
},
|
|
12840
|
-
/**
|
|
12841
|
-
* Calculate the distance from this point to another point
|
|
12842
|
-
* @param {Point} p the other point
|
|
12843
|
-
* @return {Number} distance
|
|
12844
|
-
*/
|
|
12845
|
-
dist: function (p) {
|
|
12846
|
-
return Math.sqrt(this.distSqr(p));
|
|
12847
|
-
},
|
|
12848
|
-
/**
|
|
12849
|
-
* Calculate the distance from this point to another point,
|
|
12850
|
-
* without the square root step. Useful if you're comparing
|
|
12851
|
-
* relative distances.
|
|
12852
|
-
* @param {Point} p the other point
|
|
12853
|
-
* @return {Number} distance
|
|
12854
|
-
*/
|
|
12855
|
-
distSqr: function (p) {
|
|
12856
|
-
var dx = p.x - this.x, dy = p.y - this.y;
|
|
12857
|
-
return dx * dx + dy * dy;
|
|
12858
|
-
},
|
|
12859
|
-
/**
|
|
12860
|
-
* Get the angle from the 0, 0 coordinate to this point, in radians
|
|
12861
|
-
* coordinates.
|
|
12862
|
-
* @return {Number} angle
|
|
12863
|
-
*/
|
|
12864
|
-
angle: function () {
|
|
12865
|
-
return Math.atan2(this.y, this.x);
|
|
12866
|
-
},
|
|
12867
|
-
/**
|
|
12868
|
-
* Get the angle from this point to another point, in radians
|
|
12869
|
-
* @param {Point} b the other point
|
|
12870
|
-
* @return {Number} angle
|
|
12871
|
-
*/
|
|
12872
|
-
angleTo: function (b) {
|
|
12873
|
-
return Math.atan2(this.y - b.y, this.x - b.x);
|
|
12874
|
-
},
|
|
12875
|
-
/**
|
|
12876
|
-
* Get the angle between this point and another point, in radians
|
|
12877
|
-
* @param {Point} b the other point
|
|
12878
|
-
* @return {Number} angle
|
|
12879
|
-
*/
|
|
12880
|
-
angleWith: function (b) {
|
|
12881
|
-
return this.angleWithSep(b.x, b.y);
|
|
12882
|
-
},
|
|
12883
|
-
/*
|
|
12884
|
-
* Find the angle of the two vectors, solving the formula for
|
|
12885
|
-
* the cross product a x b = |a||b|sin(θ) for θ.
|
|
12886
|
-
* @param {Number} x the x-coordinate
|
|
12887
|
-
* @param {Number} y the y-coordinate
|
|
12888
|
-
* @return {Number} the angle in radians
|
|
12889
|
-
*/
|
|
12890
|
-
angleWithSep: function (x, y) {
|
|
12891
|
-
return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
|
|
12892
|
-
},
|
|
12893
|
-
_matMult: function (m) {
|
|
12894
|
-
var x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
|
|
12895
|
-
this.x = x;
|
|
12896
|
-
this.y = y;
|
|
12897
|
-
return this;
|
|
12898
|
-
},
|
|
12899
|
-
_add: function (p) {
|
|
12900
|
-
this.x += p.x;
|
|
12901
|
-
this.y += p.y;
|
|
12902
|
-
return this;
|
|
12903
|
-
},
|
|
12904
|
-
_sub: function (p) {
|
|
12905
|
-
this.x -= p.x;
|
|
12906
|
-
this.y -= p.y;
|
|
12907
|
-
return this;
|
|
12908
|
-
},
|
|
12909
|
-
_mult: function (k) {
|
|
12910
|
-
this.x *= k;
|
|
12911
|
-
this.y *= k;
|
|
12912
|
-
return this;
|
|
12913
|
-
},
|
|
12914
|
-
_div: function (k) {
|
|
12915
|
-
this.x /= k;
|
|
12916
|
-
this.y /= k;
|
|
12917
|
-
return this;
|
|
12918
|
-
},
|
|
12919
|
-
_multByPoint: function (p) {
|
|
12920
|
-
this.x *= p.x;
|
|
12921
|
-
this.y *= p.y;
|
|
12922
|
-
return this;
|
|
12923
|
-
},
|
|
12924
|
-
_divByPoint: function (p) {
|
|
12925
|
-
this.x /= p.x;
|
|
12926
|
-
this.y /= p.y;
|
|
12927
|
-
return this;
|
|
12928
|
-
},
|
|
12929
|
-
_unit: function () {
|
|
12930
|
-
this._div(this.mag());
|
|
12931
|
-
return this;
|
|
12932
|
-
},
|
|
12933
|
-
_perp: function () {
|
|
12934
|
-
var y = this.y;
|
|
12935
|
-
this.y = this.x;
|
|
12936
|
-
this.x = -y;
|
|
12937
|
-
return this;
|
|
12938
|
-
},
|
|
12939
|
-
_rotate: function (angle) {
|
|
12940
|
-
var cos = Math.cos(angle), sin = Math.sin(angle), x = cos * this.x - sin * this.y, y = sin * this.x + cos * this.y;
|
|
12941
|
-
this.x = x;
|
|
12942
|
-
this.y = y;
|
|
12943
|
-
return this;
|
|
12944
|
-
},
|
|
12945
|
-
_rotateAround: function (angle, p) {
|
|
12946
|
-
var cos = Math.cos(angle), sin = Math.sin(angle), x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y), y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
|
|
12947
|
-
this.x = x;
|
|
12948
|
-
this.y = y;
|
|
12949
|
-
return this;
|
|
12950
|
-
},
|
|
12951
|
-
_round: function () {
|
|
12952
|
-
this.x = Math.round(this.x);
|
|
12953
|
-
this.y = Math.round(this.y);
|
|
12954
|
-
return this;
|
|
12955
|
-
}
|
|
12956
|
-
};
|
|
12957
|
-
/**
|
|
12958
|
-
* Construct a point from an array if necessary, otherwise if the input
|
|
12959
|
-
* is already a Point, or an unknown type, return it unchanged
|
|
12960
|
-
* @param {Array<Number>|Point|*} a any kind of input value
|
|
12961
|
-
* @return {Point} constructed point, or passed-through value.
|
|
12962
|
-
* @example
|
|
12963
|
-
* // this
|
|
12964
|
-
* var point = Point.convert([0, 1]);
|
|
12965
|
-
* // is equivalent to
|
|
12966
|
-
* var point = new Point(0, 1);
|
|
12967
|
-
*/
|
|
12968
|
-
Point.convert = function (a) {
|
|
12969
|
-
if (a instanceof Point) {
|
|
12970
|
-
return a;
|
|
12971
|
-
}
|
|
12972
|
-
if (Array.isArray(a)) {
|
|
12973
|
-
return new Point(a[0], a[1]);
|
|
12974
|
-
}
|
|
12975
|
-
return a;
|
|
12976
|
-
};
|
|
12977
|
-
|
|
12978
12910
|
class TinyQueue {
|
|
12979
12911
|
constructor(data = [], compare = (a, b) => a < b ? -1 : a > b ? 1 : 0) {
|
|
12980
12912
|
this.data = data;
|
|
@@ -13865,7 +13797,12 @@ class ParsingContext {
|
|
|
13865
13797
|
constructor(registry, path = [], expectedType, scope = new Scope(), errors = [], _scope, options) {
|
|
13866
13798
|
this.registry = registry;
|
|
13867
13799
|
this.path = path;
|
|
13868
|
-
this.key = path.map(part =>
|
|
13800
|
+
this.key = path.map(part => {
|
|
13801
|
+
if (typeof part === 'string') {
|
|
13802
|
+
return `['${ part }']`;
|
|
13803
|
+
}
|
|
13804
|
+
return `[${ part }]`;
|
|
13805
|
+
}).join('');
|
|
13869
13806
|
this.scope = scope;
|
|
13870
13807
|
this.errors = errors;
|
|
13871
13808
|
this.expectedType = expectedType;
|
|
@@ -13881,10 +13818,21 @@ class ParsingContext {
|
|
|
13881
13818
|
*/
|
|
13882
13819
|
parse(expr, index, expectedType, bindings, options = {}) {
|
|
13883
13820
|
if (index || expectedType) {
|
|
13884
|
-
return this.concat(index, expectedType, bindings)._parse(expr, options);
|
|
13821
|
+
return this.concat(index, null, expectedType, bindings)._parse(expr, options);
|
|
13885
13822
|
}
|
|
13886
13823
|
return this._parse(expr, options);
|
|
13887
13824
|
}
|
|
13825
|
+
/**
|
|
13826
|
+
* @param expr the JSON expression to parse
|
|
13827
|
+
* @param index the optional argument index if parent object being is an argument of another expression
|
|
13828
|
+
* @param key key of parent object being parsed
|
|
13829
|
+
* @param options
|
|
13830
|
+
* @param options.omitTypeAnnotations set true to omit inferred type annotations. Caller beware: with this option set, the parsed expression's type will NOT satisfy `expectedType` if it would normally be wrapped in an inferred annotation.
|
|
13831
|
+
* @private
|
|
13832
|
+
*/
|
|
13833
|
+
parseObjectValue(expr, index, key, expectedType, bindings, options = {}) {
|
|
13834
|
+
return this.concat(index, key, expectedType, bindings)._parse(expr, options);
|
|
13835
|
+
}
|
|
13888
13836
|
_parse(expr, options) {
|
|
13889
13837
|
if (expr === null || typeof expr === 'string' || typeof expr === 'boolean' || typeof expr === 'number') {
|
|
13890
13838
|
expr = [
|
|
@@ -13952,8 +13900,9 @@ class ParsingContext {
|
|
|
13952
13900
|
* parsing, is copied by reference rather than cloned.
|
|
13953
13901
|
* @private
|
|
13954
13902
|
*/
|
|
13955
|
-
concat(index, expectedType, bindings) {
|
|
13956
|
-
|
|
13903
|
+
concat(index, key, expectedType, bindings) {
|
|
13904
|
+
let path = typeof index === 'number' ? this.path.concat(index) : this.path;
|
|
13905
|
+
path = typeof key === 'string' ? path.concat(key) : path;
|
|
13957
13906
|
const scope = bindings ? this.scope.concat(bindings) : this.scope;
|
|
13958
13907
|
return new ParsingContext(this.registry, path, expectedType || null, scope, this.errors, this._scope, this.options);
|
|
13959
13908
|
}
|
|
@@ -15168,31 +15117,31 @@ class NumberFormat {
|
|
|
15168
15117
|
return context.error(`NumberFormat options argument must be an object.`);
|
|
15169
15118
|
let locale = null;
|
|
15170
15119
|
if (options['locale']) {
|
|
15171
|
-
locale = context.
|
|
15120
|
+
locale = context.parseObjectValue(options['locale'], 2, 'locale', StringType);
|
|
15172
15121
|
if (!locale)
|
|
15173
15122
|
return null;
|
|
15174
15123
|
}
|
|
15175
15124
|
let currency = null;
|
|
15176
15125
|
if (options['currency']) {
|
|
15177
|
-
currency = context.
|
|
15126
|
+
currency = context.parseObjectValue(options['currency'], 2, 'currency', StringType);
|
|
15178
15127
|
if (!currency)
|
|
15179
15128
|
return null;
|
|
15180
15129
|
}
|
|
15181
15130
|
let unit = null;
|
|
15182
15131
|
if (options['unit']) {
|
|
15183
|
-
unit = context.
|
|
15132
|
+
unit = context.parseObjectValue(options['unit'], 2, 'unit', StringType);
|
|
15184
15133
|
if (!unit)
|
|
15185
15134
|
return null;
|
|
15186
15135
|
}
|
|
15187
15136
|
let minFractionDigits = null;
|
|
15188
15137
|
if (options['min-fraction-digits']) {
|
|
15189
|
-
minFractionDigits = context.
|
|
15138
|
+
minFractionDigits = context.parseObjectValue(options['min-fraction-digits'], 2, 'min-fraction-digits', NumberType);
|
|
15190
15139
|
if (!minFractionDigits)
|
|
15191
15140
|
return null;
|
|
15192
15141
|
}
|
|
15193
15142
|
let maxFractionDigits = null;
|
|
15194
15143
|
if (options['max-fraction-digits']) {
|
|
15195
|
-
maxFractionDigits = context.
|
|
15144
|
+
maxFractionDigits = context.parseObjectValue(options['max-fraction-digits'], 2, 'max-fraction-digits', NumberType);
|
|
15196
15145
|
if (!maxFractionDigits)
|
|
15197
15146
|
return null;
|
|
15198
15147
|
}
|
|
@@ -16784,7 +16733,7 @@ function isExpressionFilter(filter) {
|
|
|
16784
16733
|
return true;
|
|
16785
16734
|
}
|
|
16786
16735
|
}
|
|
16787
|
-
function createFilter(filter, layerType = 'fill') {
|
|
16736
|
+
function createFilter(filter, scope = '', options = null, layerType = 'fill') {
|
|
16788
16737
|
if (filter === null || filter === void 0) {
|
|
16789
16738
|
return {
|
|
16790
16739
|
filter: () => true,
|
|
@@ -16809,7 +16758,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
16809
16758
|
`);
|
|
16810
16759
|
}
|
|
16811
16760
|
const filterSpec = v8[`filter_${ layerType }`];
|
|
16812
|
-
const compiledStaticFilter = createExpression(staticFilter, filterSpec);
|
|
16761
|
+
const compiledStaticFilter = createExpression(staticFilter, filterSpec, scope, options);
|
|
16813
16762
|
let filterFunc = null;
|
|
16814
16763
|
if (compiledStaticFilter.result === 'error') {
|
|
16815
16764
|
throw new Error(compiledStaticFilter.value.map(err => `${ err.key }: ${ err.message }`).join(', '));
|
|
@@ -16819,7 +16768,7 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
16819
16768
|
let dynamicFilterFunc = null;
|
|
16820
16769
|
let needFeature = null;
|
|
16821
16770
|
if (staticFilter !== filterExp) {
|
|
16822
|
-
const compiledDynamicFilter = createExpression(filterExp, filterSpec);
|
|
16771
|
+
const compiledDynamicFilter = createExpression(filterExp, filterSpec, scope, options);
|
|
16823
16772
|
if (compiledDynamicFilter.result === 'error') {
|
|
16824
16773
|
throw new Error(compiledDynamicFilter.value.map(err => `${ err.key }: ${ err.message }`).join(', '));
|
|
16825
16774
|
} else {
|
|
@@ -18396,15 +18345,19 @@ function validateNonExpressionFilter(options) {
|
|
|
18396
18345
|
case '<':
|
|
18397
18346
|
case '<=':
|
|
18398
18347
|
case '>':
|
|
18348
|
+
// @ts-expect-error - falls through
|
|
18399
18349
|
case '>=':
|
|
18400
18350
|
if (value.length >= 2 && unbundle(value[1]) === '$type') {
|
|
18401
18351
|
errors.push(new ValidationError(key, value, `"$type" cannot be use with operator "${ value[0] }"`));
|
|
18402
18352
|
}
|
|
18353
|
+
/* falls through */
|
|
18403
18354
|
case '==':
|
|
18355
|
+
// @ts-expect-error - falls through
|
|
18404
18356
|
case '!=':
|
|
18405
18357
|
if (value.length !== 3) {
|
|
18406
18358
|
errors.push(new ValidationError(key, value, `filter array for operator "${ value[0] }" must have 3 elements`));
|
|
18407
18359
|
}
|
|
18360
|
+
/* falls through */
|
|
18408
18361
|
case 'in':
|
|
18409
18362
|
case '!in':
|
|
18410
18363
|
if (value.length >= 2) {
|