@mapbox/mapbox-gl-style-spec 14.6.0 → 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.
Files changed (45) hide show
  1. package/dist/index.cjs +206 -337
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.ts +54 -27
  4. package/dist/index.es.js +206 -337
  5. package/dist/index.es.js.map +1 -1
  6. package/expression/compound_expression.ts +1 -2
  7. package/expression/definitions/assertion.ts +1 -2
  8. package/expression/definitions/at.ts +0 -1
  9. package/expression/definitions/case.ts +0 -1
  10. package/expression/definitions/coalesce.ts +1 -2
  11. package/expression/definitions/coercion.ts +1 -2
  12. package/expression/definitions/collator.ts +7 -5
  13. package/expression/definitions/distance.ts +1 -1
  14. package/expression/definitions/format.ts +4 -4
  15. package/expression/definitions/index.ts +0 -1
  16. package/expression/definitions/interpolate.ts +1 -2
  17. package/expression/definitions/length.ts +1 -2
  18. package/expression/definitions/match.ts +0 -1
  19. package/expression/definitions/number_format.ts +5 -5
  20. package/expression/definitions/step.ts +0 -1
  21. package/expression/definitions/within.ts +3 -3
  22. package/expression/expression.ts +4 -4
  23. package/expression/index.ts +3 -6
  24. package/expression/is_constant.ts +1 -0
  25. package/expression/parsing_context.ts +28 -5
  26. package/expression/values.ts +1 -2
  27. package/feature_filter/index.ts +6 -5
  28. package/group_by_layout.ts +2 -2
  29. package/package.json +1 -1
  30. package/reference/v8.json +158 -30
  31. package/rollup.config.js +1 -2
  32. package/style-spec.ts +2 -3
  33. package/types.ts +57 -35
  34. package/union-to-intersection.ts +4 -0
  35. package/util/color.ts +1 -0
  36. package/util/color_spaces.ts +0 -1
  37. package/util/deep_equal.ts +1 -1
  38. package/util/geometry_util.ts +1 -2
  39. package/validate/validate.ts +2 -3
  40. package/validate/validate_expression.ts +0 -1
  41. package/validate/validate_function.ts +1 -1
  42. package/validate/validate_property.ts +2 -3
  43. package/validate/validate_style.ts +1 -2
  44. package/validate_style.min.ts +0 -1
  45. 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",
@@ -5234,6 +5296,30 @@ var paint_fill = {
5234
5296
  ]
5235
5297
  },
5236
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"
5237
5323
  }
5238
5324
  };
5239
5325
  var paint_line = {
@@ -6968,6 +7054,62 @@ var paint_symbol = {
6968
7054
  interpolated: false
6969
7055
  },
6970
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"
6971
7113
  }
6972
7114
  };
6973
7115
  var paint_raster = {
@@ -8240,6 +8382,10 @@ var promoteId = {
8240
8382
  var v8 = {
8241
8383
  $version: $version,
8242
8384
  $root: $root,
8385
+ featuresets: featuresets,
8386
+ featureset: featureset,
8387
+ selector: selector,
8388
+ selectorProperty: selectorProperty,
8243
8389
  model: model,
8244
8390
  "import": {
8245
8391
  id: {
@@ -8368,7 +8514,6 @@ var v8 = {
8368
8514
  "fill-extrusion-edge-radius": {
8369
8515
  type: "number",
8370
8516
  experimental: true,
8371
- "private": true,
8372
8517
  "default": 0,
8373
8518
  minimum: 0,
8374
8519
  maximum: 1,
@@ -8742,7 +8887,6 @@ var v8 = {
8742
8887
  "fill-extrusion-ambient-occlusion-intensity": {
8743
8888
  "property-type": "data-constant",
8744
8889
  type: "number",
8745
- "private": true,
8746
8890
  "default": 0,
8747
8891
  minimum: 0,
8748
8892
  maximum: 1,
@@ -8765,7 +8909,6 @@ var v8 = {
8765
8909
  "fill-extrusion-ambient-occlusion-radius": {
8766
8910
  "property-type": "data-constant",
8767
8911
  type: "number",
8768
- "private": true,
8769
8912
  "default": 3,
8770
8913
  minimum: 0,
8771
8914
  expression: {
@@ -8954,7 +9097,7 @@ var v8 = {
8954
9097
  experimental: true,
8955
9098
  units: "meters",
8956
9099
  "default": 0,
8957
- 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.",
8958
9101
  requires: [
8959
9102
  "lights"
8960
9103
  ],
@@ -9101,14 +9244,19 @@ var v8 = {
9101
9244
  "default": 0,
9102
9245
  minimum: 0,
9103
9246
  transition: true,
9247
+ experimental: true,
9104
9248
  units: "meters",
9105
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.",
9106
9250
  "sdk-support": {
9107
9251
  "basic functionality": {
9108
- js: "3.7.0"
9252
+ js: "3.7.0",
9253
+ android: "11.7.0",
9254
+ ios: "11.7.0"
9109
9255
  },
9110
9256
  "data-driven styling": {
9111
- js: "3.7.0"
9257
+ js: "3.7.0",
9258
+ android: "11.7.0",
9259
+ ios: "11.7.0"
9112
9260
  }
9113
9261
  },
9114
9262
  expression: {
@@ -9122,27 +9270,16 @@ var v8 = {
9122
9270
  },
9123
9271
  "property-type": "data-driven"
9124
9272
  },
9125
- "fill-extrusion-line-alignment": {
9126
- type: "enum",
9127
- values: {
9128
- inside: {
9129
- doc: "Aligns the wall inside of the outline."
9130
- },
9131
- outside: {
9132
- doc: "Aligns the wall outside of the outline."
9133
- },
9134
- center: {
9135
- doc: "Aligns the wall relative to the center of the outline."
9136
- }
9137
- },
9138
- "default": "center",
9139
- doc: "Specifies the alignment for offset of the walls relative to the outlines of the geometry. For open-ended line string geometries the positioning is considered based on the ordering of the points, where inside is in clockwise order and outside is counter-clockwise. This property only has an effect if a non-zero fill-extrusion-line-width is used. Center alignment is automatically used for non-closed lines.",
9140
- requires: [
9141
- "fill-extrusion-line-width"
9142
- ],
9273
+ "fill-extrusion-cast-shadows": {
9274
+ type: "boolean",
9275
+ "default": true,
9276
+ doc: "Enable/Disable shadow casting for this layer",
9277
+ transition: false,
9143
9278
  "sdk-support": {
9144
9279
  "basic functionality": {
9145
- js: "3.7.0"
9280
+ js: "3.7.0",
9281
+ android: "11.8.0",
9282
+ ios: "11.8.0"
9146
9283
  }
9147
9284
  },
9148
9285
  "property-type": "data-constant"
@@ -11434,19 +11571,19 @@ class FormatExpression {
11434
11571
  nextTokenMayBeObject = false;
11435
11572
  let scale = null;
11436
11573
  if (arg['font-scale']) {
11437
- scale = context.parse(arg['font-scale'], 1, NumberType);
11574
+ scale = context.parseObjectValue(arg['font-scale'], i, 'font-scale', NumberType);
11438
11575
  if (!scale)
11439
11576
  return null;
11440
11577
  }
11441
11578
  let font = null;
11442
11579
  if (arg['text-font']) {
11443
- font = context.parse(arg['text-font'], 1, array$1(StringType));
11580
+ font = context.parseObjectValue(arg['text-font'], i, 'text-font', array$1(StringType));
11444
11581
  if (!font)
11445
11582
  return null;
11446
11583
  }
11447
11584
  let textColor = null;
11448
11585
  if (arg['text-color']) {
11449
- textColor = context.parse(arg['text-color'], 1, ColorType);
11586
+ textColor = context.parseObjectValue(arg['text-color'], i, 'text-color', ColorType);
11450
11587
  if (!textColor)
11451
11588
  return null;
11452
11589
  }
@@ -11455,7 +11592,7 @@ class FormatExpression {
11455
11592
  lastExpression.font = font;
11456
11593
  lastExpression.textColor = textColor;
11457
11594
  } else {
11458
- const content = context.parse(args[i], 1, ValueType);
11595
+ const content = context.parse(args[i], i, ValueType);
11459
11596
  if (!content)
11460
11597
  return null;
11461
11598
  const kind = content.type.kind;
@@ -11916,15 +12053,15 @@ class CollatorExpression {
11916
12053
  const options = args[1];
11917
12054
  if (typeof options !== 'object' || Array.isArray(options))
11918
12055
  return context.error(`Collator options argument must be an object.`);
11919
- const caseSensitive = context.parse(options['case-sensitive'] === void 0 ? false : options['case-sensitive'], 1, BooleanType);
12056
+ const caseSensitive = options['case-sensitive'] === void 0 ? context.parse(false, 1, BooleanType) : context.parseObjectValue(options['case-sensitive'], 1, 'case-sensitive', BooleanType);
11920
12057
  if (!caseSensitive)
11921
12058
  return null;
11922
- const diacriticSensitive = context.parse(options['diacritic-sensitive'] === void 0 ? false : options['diacritic-sensitive'], 1, BooleanType);
12059
+ const diacriticSensitive = options['diacritic-sensitive'] === void 0 ? context.parse(false, 1, BooleanType) : context.parseObjectValue(options['diacritic-sensitive'], 1, 'diacritic-sensitive', BooleanType);
11923
12060
  if (!diacriticSensitive)
11924
12061
  return null;
11925
12062
  let locale = null;
11926
12063
  if (options['locale']) {
11927
- locale = context.parse(options['locale'], 1, StringType);
12064
+ locale = context.parseObjectValue(options['locale'], 1, 'locale', StringType);
11928
12065
  if (!locale)
11929
12066
  return null;
11930
12067
  }
@@ -12770,295 +12907,6 @@ function wrap(deg) {
12770
12907
  return deg;
12771
12908
  }
12772
12909
 
12773
- /**
12774
- * A standalone point geometry with useful accessor, comparison, and
12775
- * modification methods.
12776
- *
12777
- * @class Point
12778
- * @param {Number} x the x-coordinate. this could be longitude or screen
12779
- * pixels, or any other sort of unit.
12780
- * @param {Number} y the y-coordinate. this could be latitude or screen
12781
- * pixels, or any other sort of unit.
12782
- * @example
12783
- * var point = new Point(-77, 38);
12784
- */
12785
- function Point(x, y) {
12786
- this.x = x;
12787
- this.y = y;
12788
- }
12789
- Point.prototype = {
12790
- /**
12791
- * Clone this point, returning a new point that can be modified
12792
- * without affecting the old one.
12793
- * @return {Point} the clone
12794
- */
12795
- clone: function () {
12796
- return new Point(this.x, this.y);
12797
- },
12798
- /**
12799
- * Add this point's x & y coordinates to another point,
12800
- * yielding a new point.
12801
- * @param {Point} p the other point
12802
- * @return {Point} output point
12803
- */
12804
- add: function (p) {
12805
- return this.clone()._add(p);
12806
- },
12807
- /**
12808
- * Subtract this point's x & y coordinates to from point,
12809
- * yielding a new point.
12810
- * @param {Point} p the other point
12811
- * @return {Point} output point
12812
- */
12813
- sub: function (p) {
12814
- return this.clone()._sub(p);
12815
- },
12816
- /**
12817
- * Multiply this point's x & y coordinates by point,
12818
- * yielding a new point.
12819
- * @param {Point} p the other point
12820
- * @return {Point} output point
12821
- */
12822
- multByPoint: function (p) {
12823
- return this.clone()._multByPoint(p);
12824
- },
12825
- /**
12826
- * Divide this point's x & y coordinates by point,
12827
- * yielding a new point.
12828
- * @param {Point} p the other point
12829
- * @return {Point} output point
12830
- */
12831
- divByPoint: function (p) {
12832
- return this.clone()._divByPoint(p);
12833
- },
12834
- /**
12835
- * Multiply this point's x & y coordinates by a factor,
12836
- * yielding a new point.
12837
- * @param {Point} k factor
12838
- * @return {Point} output point
12839
- */
12840
- mult: function (k) {
12841
- return this.clone()._mult(k);
12842
- },
12843
- /**
12844
- * Divide this point's x & y coordinates by a factor,
12845
- * yielding a new point.
12846
- * @param {Point} k factor
12847
- * @return {Point} output point
12848
- */
12849
- div: function (k) {
12850
- return this.clone()._div(k);
12851
- },
12852
- /**
12853
- * Rotate this point around the 0, 0 origin by an angle a,
12854
- * given in radians
12855
- * @param {Number} a angle to rotate around, in radians
12856
- * @return {Point} output point
12857
- */
12858
- rotate: function (a) {
12859
- return this.clone()._rotate(a);
12860
- },
12861
- /**
12862
- * Rotate this point around p point by an angle a,
12863
- * given in radians
12864
- * @param {Number} a angle to rotate around, in radians
12865
- * @param {Point} p Point to rotate around
12866
- * @return {Point} output point
12867
- */
12868
- rotateAround: function (a, p) {
12869
- return this.clone()._rotateAround(a, p);
12870
- },
12871
- /**
12872
- * Multiply this point by a 4x1 transformation matrix
12873
- * @param {Array<Number>} m transformation matrix
12874
- * @return {Point} output point
12875
- */
12876
- matMult: function (m) {
12877
- return this.clone()._matMult(m);
12878
- },
12879
- /**
12880
- * Calculate this point but as a unit vector from 0, 0, meaning
12881
- * that the distance from the resulting point to the 0, 0
12882
- * coordinate will be equal to 1 and the angle from the resulting
12883
- * point to the 0, 0 coordinate will be the same as before.
12884
- * @return {Point} unit vector point
12885
- */
12886
- unit: function () {
12887
- return this.clone()._unit();
12888
- },
12889
- /**
12890
- * Compute a perpendicular point, where the new y coordinate
12891
- * is the old x coordinate and the new x coordinate is the old y
12892
- * coordinate multiplied by -1
12893
- * @return {Point} perpendicular point
12894
- */
12895
- perp: function () {
12896
- return this.clone()._perp();
12897
- },
12898
- /**
12899
- * Return a version of this point with the x & y coordinates
12900
- * rounded to integers.
12901
- * @return {Point} rounded point
12902
- */
12903
- round: function () {
12904
- return this.clone()._round();
12905
- },
12906
- /**
12907
- * Return the magitude of this point: this is the Euclidean
12908
- * distance from the 0, 0 coordinate to this point's x and y
12909
- * coordinates.
12910
- * @return {Number} magnitude
12911
- */
12912
- mag: function () {
12913
- return Math.sqrt(this.x * this.x + this.y * this.y);
12914
- },
12915
- /**
12916
- * Judge whether this point is equal to another point, returning
12917
- * true or false.
12918
- * @param {Point} other the other point
12919
- * @return {boolean} whether the points are equal
12920
- */
12921
- equals: function (other) {
12922
- return this.x === other.x && this.y === other.y;
12923
- },
12924
- /**
12925
- * Calculate the distance from this point to another point
12926
- * @param {Point} p the other point
12927
- * @return {Number} distance
12928
- */
12929
- dist: function (p) {
12930
- return Math.sqrt(this.distSqr(p));
12931
- },
12932
- /**
12933
- * Calculate the distance from this point to another point,
12934
- * without the square root step. Useful if you're comparing
12935
- * relative distances.
12936
- * @param {Point} p the other point
12937
- * @return {Number} distance
12938
- */
12939
- distSqr: function (p) {
12940
- var dx = p.x - this.x, dy = p.y - this.y;
12941
- return dx * dx + dy * dy;
12942
- },
12943
- /**
12944
- * Get the angle from the 0, 0 coordinate to this point, in radians
12945
- * coordinates.
12946
- * @return {Number} angle
12947
- */
12948
- angle: function () {
12949
- return Math.atan2(this.y, this.x);
12950
- },
12951
- /**
12952
- * Get the angle from this point to another point, in radians
12953
- * @param {Point} b the other point
12954
- * @return {Number} angle
12955
- */
12956
- angleTo: function (b) {
12957
- return Math.atan2(this.y - b.y, this.x - b.x);
12958
- },
12959
- /**
12960
- * Get the angle between this point and another point, in radians
12961
- * @param {Point} b the other point
12962
- * @return {Number} angle
12963
- */
12964
- angleWith: function (b) {
12965
- return this.angleWithSep(b.x, b.y);
12966
- },
12967
- /*
12968
- * Find the angle of the two vectors, solving the formula for
12969
- * the cross product a x b = |a||b|sin(θ) for θ.
12970
- * @param {Number} x the x-coordinate
12971
- * @param {Number} y the y-coordinate
12972
- * @return {Number} the angle in radians
12973
- */
12974
- angleWithSep: function (x, y) {
12975
- return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
12976
- },
12977
- _matMult: function (m) {
12978
- var x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
12979
- this.x = x;
12980
- this.y = y;
12981
- return this;
12982
- },
12983
- _add: function (p) {
12984
- this.x += p.x;
12985
- this.y += p.y;
12986
- return this;
12987
- },
12988
- _sub: function (p) {
12989
- this.x -= p.x;
12990
- this.y -= p.y;
12991
- return this;
12992
- },
12993
- _mult: function (k) {
12994
- this.x *= k;
12995
- this.y *= k;
12996
- return this;
12997
- },
12998
- _div: function (k) {
12999
- this.x /= k;
13000
- this.y /= k;
13001
- return this;
13002
- },
13003
- _multByPoint: function (p) {
13004
- this.x *= p.x;
13005
- this.y *= p.y;
13006
- return this;
13007
- },
13008
- _divByPoint: function (p) {
13009
- this.x /= p.x;
13010
- this.y /= p.y;
13011
- return this;
13012
- },
13013
- _unit: function () {
13014
- this._div(this.mag());
13015
- return this;
13016
- },
13017
- _perp: function () {
13018
- var y = this.y;
13019
- this.y = this.x;
13020
- this.x = -y;
13021
- return this;
13022
- },
13023
- _rotate: function (angle) {
13024
- var cos = Math.cos(angle), sin = Math.sin(angle), x = cos * this.x - sin * this.y, y = sin * this.x + cos * this.y;
13025
- this.x = x;
13026
- this.y = y;
13027
- return this;
13028
- },
13029
- _rotateAround: function (angle, p) {
13030
- 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);
13031
- this.x = x;
13032
- this.y = y;
13033
- return this;
13034
- },
13035
- _round: function () {
13036
- this.x = Math.round(this.x);
13037
- this.y = Math.round(this.y);
13038
- return this;
13039
- }
13040
- };
13041
- /**
13042
- * Construct a point from an array if necessary, otherwise if the input
13043
- * is already a Point, or an unknown type, return it unchanged
13044
- * @param {Array<Number>|Point|*} a any kind of input value
13045
- * @return {Point} constructed point, or passed-through value.
13046
- * @example
13047
- * // this
13048
- * var point = Point.convert([0, 1]);
13049
- * // is equivalent to
13050
- * var point = new Point(0, 1);
13051
- */
13052
- Point.convert = function (a) {
13053
- if (a instanceof Point) {
13054
- return a;
13055
- }
13056
- if (Array.isArray(a)) {
13057
- return new Point(a[0], a[1]);
13058
- }
13059
- return a;
13060
- };
13061
-
13062
12910
  class TinyQueue {
13063
12911
  constructor(data = [], compare = (a, b) => a < b ? -1 : a > b ? 1 : 0) {
13064
12912
  this.data = data;
@@ -13949,7 +13797,12 @@ class ParsingContext {
13949
13797
  constructor(registry, path = [], expectedType, scope = new Scope(), errors = [], _scope, options) {
13950
13798
  this.registry = registry;
13951
13799
  this.path = path;
13952
- this.key = path.map(part => `[${ part }]`).join('');
13800
+ this.key = path.map(part => {
13801
+ if (typeof part === 'string') {
13802
+ return `['${ part }']`;
13803
+ }
13804
+ return `[${ part }]`;
13805
+ }).join('');
13953
13806
  this.scope = scope;
13954
13807
  this.errors = errors;
13955
13808
  this.expectedType = expectedType;
@@ -13965,10 +13818,21 @@ class ParsingContext {
13965
13818
  */
13966
13819
  parse(expr, index, expectedType, bindings, options = {}) {
13967
13820
  if (index || expectedType) {
13968
- return this.concat(index, expectedType, bindings)._parse(expr, options);
13821
+ return this.concat(index, null, expectedType, bindings)._parse(expr, options);
13969
13822
  }
13970
13823
  return this._parse(expr, options);
13971
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
+ }
13972
13836
  _parse(expr, options) {
13973
13837
  if (expr === null || typeof expr === 'string' || typeof expr === 'boolean' || typeof expr === 'number') {
13974
13838
  expr = [
@@ -14036,8 +13900,9 @@ class ParsingContext {
14036
13900
  * parsing, is copied by reference rather than cloned.
14037
13901
  * @private
14038
13902
  */
14039
- concat(index, expectedType, bindings) {
14040
- const path = typeof index === 'number' ? this.path.concat(index) : this.path;
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;
14041
13906
  const scope = bindings ? this.scope.concat(bindings) : this.scope;
14042
13907
  return new ParsingContext(this.registry, path, expectedType || null, scope, this.errors, this._scope, this.options);
14043
13908
  }
@@ -15252,31 +15117,31 @@ class NumberFormat {
15252
15117
  return context.error(`NumberFormat options argument must be an object.`);
15253
15118
  let locale = null;
15254
15119
  if (options['locale']) {
15255
- locale = context.parse(options['locale'], 1, StringType);
15120
+ locale = context.parseObjectValue(options['locale'], 2, 'locale', StringType);
15256
15121
  if (!locale)
15257
15122
  return null;
15258
15123
  }
15259
15124
  let currency = null;
15260
15125
  if (options['currency']) {
15261
- currency = context.parse(options['currency'], 1, StringType);
15126
+ currency = context.parseObjectValue(options['currency'], 2, 'currency', StringType);
15262
15127
  if (!currency)
15263
15128
  return null;
15264
15129
  }
15265
15130
  let unit = null;
15266
15131
  if (options['unit']) {
15267
- unit = context.parse(options['unit'], 1, StringType);
15132
+ unit = context.parseObjectValue(options['unit'], 2, 'unit', StringType);
15268
15133
  if (!unit)
15269
15134
  return null;
15270
15135
  }
15271
15136
  let minFractionDigits = null;
15272
15137
  if (options['min-fraction-digits']) {
15273
- minFractionDigits = context.parse(options['min-fraction-digits'], 1, NumberType);
15138
+ minFractionDigits = context.parseObjectValue(options['min-fraction-digits'], 2, 'min-fraction-digits', NumberType);
15274
15139
  if (!minFractionDigits)
15275
15140
  return null;
15276
15141
  }
15277
15142
  let maxFractionDigits = null;
15278
15143
  if (options['max-fraction-digits']) {
15279
- maxFractionDigits = context.parse(options['max-fraction-digits'], 1, NumberType);
15144
+ maxFractionDigits = context.parseObjectValue(options['max-fraction-digits'], 2, 'max-fraction-digits', NumberType);
15280
15145
  if (!maxFractionDigits)
15281
15146
  return null;
15282
15147
  }
@@ -16868,7 +16733,7 @@ function isExpressionFilter(filter) {
16868
16733
  return true;
16869
16734
  }
16870
16735
  }
16871
- function createFilter(filter, layerType = 'fill') {
16736
+ function createFilter(filter, scope = '', options = null, layerType = 'fill') {
16872
16737
  if (filter === null || filter === void 0) {
16873
16738
  return {
16874
16739
  filter: () => true,
@@ -16893,7 +16758,7 @@ ${ JSON.stringify(filterExp, null, 2) }
16893
16758
  `);
16894
16759
  }
16895
16760
  const filterSpec = v8[`filter_${ layerType }`];
16896
- const compiledStaticFilter = createExpression(staticFilter, filterSpec);
16761
+ const compiledStaticFilter = createExpression(staticFilter, filterSpec, scope, options);
16897
16762
  let filterFunc = null;
16898
16763
  if (compiledStaticFilter.result === 'error') {
16899
16764
  throw new Error(compiledStaticFilter.value.map(err => `${ err.key }: ${ err.message }`).join(', '));
@@ -16903,7 +16768,7 @@ ${ JSON.stringify(filterExp, null, 2) }
16903
16768
  let dynamicFilterFunc = null;
16904
16769
  let needFeature = null;
16905
16770
  if (staticFilter !== filterExp) {
16906
- const compiledDynamicFilter = createExpression(filterExp, filterSpec);
16771
+ const compiledDynamicFilter = createExpression(filterExp, filterSpec, scope, options);
16907
16772
  if (compiledDynamicFilter.result === 'error') {
16908
16773
  throw new Error(compiledDynamicFilter.value.map(err => `${ err.key }: ${ err.message }`).join(', '));
16909
16774
  } else {
@@ -18480,15 +18345,19 @@ function validateNonExpressionFilter(options) {
18480
18345
  case '<':
18481
18346
  case '<=':
18482
18347
  case '>':
18348
+ // @ts-expect-error - falls through
18483
18349
  case '>=':
18484
18350
  if (value.length >= 2 && unbundle(value[1]) === '$type') {
18485
18351
  errors.push(new ValidationError(key, value, `"$type" cannot be use with operator "${ value[0] }"`));
18486
18352
  }
18353
+ /* falls through */
18487
18354
  case '==':
18355
+ // @ts-expect-error - falls through
18488
18356
  case '!=':
18489
18357
  if (value.length !== 3) {
18490
18358
  errors.push(new ValidationError(key, value, `filter array for operator "${ value[0] }" must have 3 elements`));
18491
18359
  }
18360
+ /* falls through */
18492
18361
  case 'in':
18493
18362
  case '!in':
18494
18363
  if (value.length >= 2) {