@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.cjs CHANGED
@@ -214,6 +214,71 @@
214
214
  "spruce1-lod1": "asset://spruce1-lod1.glb",
215
215
  "spruce1-lod2": "asset://spruce1-lod2.glb"
216
216
  }
217
+ },
218
+ featuresets: {
219
+ experimental: true,
220
+ type: "featuresets",
221
+ doc: "Defines sets of features for querying, interaction, and feature state manipulation.",
222
+ example: {
223
+ poi: {
224
+ selectors: [
225
+ {
226
+ layer: "poi",
227
+ properties: {
228
+ type: [
229
+ "get",
230
+ "type"
231
+ ],
232
+ name: [
233
+ "get",
234
+ "name"
235
+ ],
236
+ brand: "ABC"
237
+ }
238
+ }
239
+ ]
240
+ }
241
+ }
242
+ }
243
+ };
244
+ var featuresets = {
245
+ experimental: true,
246
+ "*": {
247
+ type: "featureset",
248
+ 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."
249
+ }
250
+ };
251
+ var featureset = {
252
+ experimental: true,
253
+ selectors: {
254
+ type: "array",
255
+ value: "selector",
256
+ doc: "A collection of categorized selectors."
257
+ }
258
+ };
259
+ var selector = {
260
+ experimental: true,
261
+ layer: {
262
+ type: "string",
263
+ doc: "The ID of a layer that exists in the current style.",
264
+ required: true
265
+ },
266
+ properties: {
267
+ type: "selectorProperty",
268
+ required: false,
269
+ 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."
270
+ },
271
+ featureNamespace: {
272
+ type: "string",
273
+ required: false,
274
+ 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."
275
+ }
276
+ };
277
+ var selectorProperty = {
278
+ experimental: true,
279
+ "*": {
280
+ type: "*",
281
+ 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."
217
282
  }
218
283
  };
219
284
  var model = {
@@ -383,9 +448,6 @@
383
448
  "default": false,
384
449
  doc: "Enable/Disable shadow casting for this light",
385
450
  transition: false,
386
- expression: {
387
- interpolated: false
388
- },
389
451
  "property-type": "data-constant",
390
452
  "sdk-support": {
391
453
  "basic functionality": {
@@ -471,7 +533,7 @@
471
533
  doc: "The position of the light source is aligned to the rotation of the map."
472
534
  },
473
535
  viewport: {
474
- doc: "The position of the light source is aligned to the rotation of the viewport."
536
+ 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."
475
537
  }
476
538
  },
477
539
  "property-type": "data-constant",
@@ -5240,6 +5302,30 @@
5240
5302
  ]
5241
5303
  },
5242
5304
  "property-type": "data-constant"
5305
+ },
5306
+ "fill-z-offset": {
5307
+ type: "number",
5308
+ 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.",
5309
+ "default": 0,
5310
+ minimum: 0,
5311
+ transition: true,
5312
+ experimental: true,
5313
+ "sdk-support": {
5314
+ "basic functionality": {
5315
+ js: "3.7.0"
5316
+ },
5317
+ "data-driven styling": {
5318
+ js: "3.7.0"
5319
+ }
5320
+ },
5321
+ expression: {
5322
+ interpolated: true,
5323
+ parameters: [
5324
+ "zoom",
5325
+ "feature"
5326
+ ]
5327
+ },
5328
+ "property-type": "data-driven"
5243
5329
  }
5244
5330
  };
5245
5331
  var paint_line = {
@@ -6974,6 +7060,62 @@
6974
7060
  interpolated: false
6975
7061
  },
6976
7062
  "property-type": "data-constant"
7063
+ },
7064
+ "symbol-z-offset": {
7065
+ type: "number",
7066
+ doc: "Specifies an uniform elevation from the ground, in meters.",
7067
+ "default": 0,
7068
+ minimum: 0,
7069
+ transition: true,
7070
+ experimental: true,
7071
+ "sdk-support": {
7072
+ "basic functionality": {
7073
+ js: "3.7.0",
7074
+ android: "11.7.0",
7075
+ ios: "11.7.0"
7076
+ },
7077
+ "data-driven styling": {
7078
+ js: "3.7.0",
7079
+ android: "11.7.0",
7080
+ ios: "11.7.0"
7081
+ }
7082
+ },
7083
+ expression: {
7084
+ interpolated: true,
7085
+ parameters: [
7086
+ "zoom",
7087
+ "feature"
7088
+ ]
7089
+ },
7090
+ "property-type": "data-driven"
7091
+ },
7092
+ "symbol-elevation-reference": {
7093
+ type: "enum",
7094
+ doc: "Selects the base of symbol-elevation.",
7095
+ values: {
7096
+ sea: {
7097
+ doc: "Elevate symbols relative to the sea level."
7098
+ },
7099
+ ground: {
7100
+ doc: "Elevate symbols relative to the ground's height below them."
7101
+ }
7102
+ },
7103
+ "default": "ground",
7104
+ experimental: true,
7105
+ "sdk-support": {
7106
+ "basic functionality": {
7107
+ js: "3.7.0",
7108
+ android: "11.7.0",
7109
+ ios: "11.7.0"
7110
+ }
7111
+ },
7112
+ expression: {
7113
+ interpolated: false,
7114
+ parameters: [
7115
+ "zoom"
7116
+ ]
7117
+ },
7118
+ "property-type": "data-constant"
6977
7119
  }
6978
7120
  };
6979
7121
  var paint_raster = {
@@ -8246,6 +8388,10 @@
8246
8388
  var v8 = {
8247
8389
  $version: $version,
8248
8390
  $root: $root,
8391
+ featuresets: featuresets,
8392
+ featureset: featureset,
8393
+ selector: selector,
8394
+ selectorProperty: selectorProperty,
8249
8395
  model: model,
8250
8396
  "import": {
8251
8397
  id: {
@@ -8374,7 +8520,6 @@
8374
8520
  "fill-extrusion-edge-radius": {
8375
8521
  type: "number",
8376
8522
  experimental: true,
8377
- "private": true,
8378
8523
  "default": 0,
8379
8524
  minimum: 0,
8380
8525
  maximum: 1,
@@ -8748,7 +8893,6 @@
8748
8893
  "fill-extrusion-ambient-occlusion-intensity": {
8749
8894
  "property-type": "data-constant",
8750
8895
  type: "number",
8751
- "private": true,
8752
8896
  "default": 0,
8753
8897
  minimum: 0,
8754
8898
  maximum: 1,
@@ -8771,7 +8915,6 @@
8771
8915
  "fill-extrusion-ambient-occlusion-radius": {
8772
8916
  "property-type": "data-constant",
8773
8917
  type: "number",
8774
- "private": true,
8775
8918
  "default": 3,
8776
8919
  minimum: 0,
8777
8920
  expression: {
@@ -8960,7 +9103,7 @@
8960
9103
  experimental: true,
8961
9104
  units: "meters",
8962
9105
  "default": 0,
8963
- doc: "The extent of the flood light effect on the ground beneath the extruded buildings in meters.",
9106
+ 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.",
8964
9107
  requires: [
8965
9108
  "lights"
8966
9109
  ],
@@ -9107,14 +9250,19 @@
9107
9250
  "default": 0,
9108
9251
  minimum: 0,
9109
9252
  transition: true,
9253
+ experimental: true,
9110
9254
  units: "meters",
9111
9255
  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.",
9112
9256
  "sdk-support": {
9113
9257
  "basic functionality": {
9114
- js: "3.7.0"
9258
+ js: "3.7.0",
9259
+ android: "11.7.0",
9260
+ ios: "11.7.0"
9115
9261
  },
9116
9262
  "data-driven styling": {
9117
- js: "3.7.0"
9263
+ js: "3.7.0",
9264
+ android: "11.7.0",
9265
+ ios: "11.7.0"
9118
9266
  }
9119
9267
  },
9120
9268
  expression: {
@@ -9128,27 +9276,16 @@
9128
9276
  },
9129
9277
  "property-type": "data-driven"
9130
9278
  },
9131
- "fill-extrusion-line-alignment": {
9132
- type: "enum",
9133
- values: {
9134
- inside: {
9135
- doc: "Aligns the wall inside of the outline."
9136
- },
9137
- outside: {
9138
- doc: "Aligns the wall outside of the outline."
9139
- },
9140
- center: {
9141
- doc: "Aligns the wall relative to the center of the outline."
9142
- }
9143
- },
9144
- "default": "center",
9145
- 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.",
9146
- requires: [
9147
- "fill-extrusion-line-width"
9148
- ],
9279
+ "fill-extrusion-cast-shadows": {
9280
+ type: "boolean",
9281
+ "default": true,
9282
+ doc: "Enable/Disable shadow casting for this layer",
9283
+ transition: false,
9149
9284
  "sdk-support": {
9150
9285
  "basic functionality": {
9151
- js: "3.7.0"
9286
+ js: "3.7.0",
9287
+ android: "11.8.0",
9288
+ ios: "11.8.0"
9152
9289
  }
9153
9290
  },
9154
9291
  "property-type": "data-constant"
@@ -11440,19 +11577,19 @@
11440
11577
  nextTokenMayBeObject = false;
11441
11578
  let scale = null;
11442
11579
  if (arg['font-scale']) {
11443
- scale = context.parse(arg['font-scale'], 1, NumberType);
11580
+ scale = context.parseObjectValue(arg['font-scale'], i, 'font-scale', NumberType);
11444
11581
  if (!scale)
11445
11582
  return null;
11446
11583
  }
11447
11584
  let font = null;
11448
11585
  if (arg['text-font']) {
11449
- font = context.parse(arg['text-font'], 1, array$1(StringType));
11586
+ font = context.parseObjectValue(arg['text-font'], i, 'text-font', array$1(StringType));
11450
11587
  if (!font)
11451
11588
  return null;
11452
11589
  }
11453
11590
  let textColor = null;
11454
11591
  if (arg['text-color']) {
11455
- textColor = context.parse(arg['text-color'], 1, ColorType);
11592
+ textColor = context.parseObjectValue(arg['text-color'], i, 'text-color', ColorType);
11456
11593
  if (!textColor)
11457
11594
  return null;
11458
11595
  }
@@ -11461,7 +11598,7 @@
11461
11598
  lastExpression.font = font;
11462
11599
  lastExpression.textColor = textColor;
11463
11600
  } else {
11464
- const content = context.parse(args[i], 1, ValueType);
11601
+ const content = context.parse(args[i], i, ValueType);
11465
11602
  if (!content)
11466
11603
  return null;
11467
11604
  const kind = content.type.kind;
@@ -11922,15 +12059,15 @@
11922
12059
  const options = args[1];
11923
12060
  if (typeof options !== 'object' || Array.isArray(options))
11924
12061
  return context.error(`Collator options argument must be an object.`);
11925
- const caseSensitive = context.parse(options['case-sensitive'] === void 0 ? false : options['case-sensitive'], 1, BooleanType);
12062
+ const caseSensitive = options['case-sensitive'] === void 0 ? context.parse(false, 1, BooleanType) : context.parseObjectValue(options['case-sensitive'], 1, 'case-sensitive', BooleanType);
11926
12063
  if (!caseSensitive)
11927
12064
  return null;
11928
- const diacriticSensitive = context.parse(options['diacritic-sensitive'] === void 0 ? false : options['diacritic-sensitive'], 1, BooleanType);
12065
+ const diacriticSensitive = options['diacritic-sensitive'] === void 0 ? context.parse(false, 1, BooleanType) : context.parseObjectValue(options['diacritic-sensitive'], 1, 'diacritic-sensitive', BooleanType);
11929
12066
  if (!diacriticSensitive)
11930
12067
  return null;
11931
12068
  let locale = null;
11932
12069
  if (options['locale']) {
11933
- locale = context.parse(options['locale'], 1, StringType);
12070
+ locale = context.parseObjectValue(options['locale'], 1, 'locale', StringType);
11934
12071
  if (!locale)
11935
12072
  return null;
11936
12073
  }
@@ -12776,295 +12913,6 @@
12776
12913
  return deg;
12777
12914
  }
12778
12915
 
12779
- /**
12780
- * A standalone point geometry with useful accessor, comparison, and
12781
- * modification methods.
12782
- *
12783
- * @class Point
12784
- * @param {Number} x the x-coordinate. this could be longitude or screen
12785
- * pixels, or any other sort of unit.
12786
- * @param {Number} y the y-coordinate. this could be latitude or screen
12787
- * pixels, or any other sort of unit.
12788
- * @example
12789
- * var point = new Point(-77, 38);
12790
- */
12791
- function Point(x, y) {
12792
- this.x = x;
12793
- this.y = y;
12794
- }
12795
- Point.prototype = {
12796
- /**
12797
- * Clone this point, returning a new point that can be modified
12798
- * without affecting the old one.
12799
- * @return {Point} the clone
12800
- */
12801
- clone: function () {
12802
- return new Point(this.x, this.y);
12803
- },
12804
- /**
12805
- * Add this point's x & y coordinates to another point,
12806
- * yielding a new point.
12807
- * @param {Point} p the other point
12808
- * @return {Point} output point
12809
- */
12810
- add: function (p) {
12811
- return this.clone()._add(p);
12812
- },
12813
- /**
12814
- * Subtract this point's x & y coordinates to from point,
12815
- * yielding a new point.
12816
- * @param {Point} p the other point
12817
- * @return {Point} output point
12818
- */
12819
- sub: function (p) {
12820
- return this.clone()._sub(p);
12821
- },
12822
- /**
12823
- * Multiply this point's x & y coordinates by point,
12824
- * yielding a new point.
12825
- * @param {Point} p the other point
12826
- * @return {Point} output point
12827
- */
12828
- multByPoint: function (p) {
12829
- return this.clone()._multByPoint(p);
12830
- },
12831
- /**
12832
- * Divide this point's x & y coordinates by point,
12833
- * yielding a new point.
12834
- * @param {Point} p the other point
12835
- * @return {Point} output point
12836
- */
12837
- divByPoint: function (p) {
12838
- return this.clone()._divByPoint(p);
12839
- },
12840
- /**
12841
- * Multiply this point's x & y coordinates by a factor,
12842
- * yielding a new point.
12843
- * @param {Point} k factor
12844
- * @return {Point} output point
12845
- */
12846
- mult: function (k) {
12847
- return this.clone()._mult(k);
12848
- },
12849
- /**
12850
- * Divide this point's x & y coordinates by a factor,
12851
- * yielding a new point.
12852
- * @param {Point} k factor
12853
- * @return {Point} output point
12854
- */
12855
- div: function (k) {
12856
- return this.clone()._div(k);
12857
- },
12858
- /**
12859
- * Rotate this point around the 0, 0 origin by an angle a,
12860
- * given in radians
12861
- * @param {Number} a angle to rotate around, in radians
12862
- * @return {Point} output point
12863
- */
12864
- rotate: function (a) {
12865
- return this.clone()._rotate(a);
12866
- },
12867
- /**
12868
- * Rotate this point around p point by an angle a,
12869
- * given in radians
12870
- * @param {Number} a angle to rotate around, in radians
12871
- * @param {Point} p Point to rotate around
12872
- * @return {Point} output point
12873
- */
12874
- rotateAround: function (a, p) {
12875
- return this.clone()._rotateAround(a, p);
12876
- },
12877
- /**
12878
- * Multiply this point by a 4x1 transformation matrix
12879
- * @param {Array<Number>} m transformation matrix
12880
- * @return {Point} output point
12881
- */
12882
- matMult: function (m) {
12883
- return this.clone()._matMult(m);
12884
- },
12885
- /**
12886
- * Calculate this point but as a unit vector from 0, 0, meaning
12887
- * that the distance from the resulting point to the 0, 0
12888
- * coordinate will be equal to 1 and the angle from the resulting
12889
- * point to the 0, 0 coordinate will be the same as before.
12890
- * @return {Point} unit vector point
12891
- */
12892
- unit: function () {
12893
- return this.clone()._unit();
12894
- },
12895
- /**
12896
- * Compute a perpendicular point, where the new y coordinate
12897
- * is the old x coordinate and the new x coordinate is the old y
12898
- * coordinate multiplied by -1
12899
- * @return {Point} perpendicular point
12900
- */
12901
- perp: function () {
12902
- return this.clone()._perp();
12903
- },
12904
- /**
12905
- * Return a version of this point with the x & y coordinates
12906
- * rounded to integers.
12907
- * @return {Point} rounded point
12908
- */
12909
- round: function () {
12910
- return this.clone()._round();
12911
- },
12912
- /**
12913
- * Return the magitude of this point: this is the Euclidean
12914
- * distance from the 0, 0 coordinate to this point's x and y
12915
- * coordinates.
12916
- * @return {Number} magnitude
12917
- */
12918
- mag: function () {
12919
- return Math.sqrt(this.x * this.x + this.y * this.y);
12920
- },
12921
- /**
12922
- * Judge whether this point is equal to another point, returning
12923
- * true or false.
12924
- * @param {Point} other the other point
12925
- * @return {boolean} whether the points are equal
12926
- */
12927
- equals: function (other) {
12928
- return this.x === other.x && this.y === other.y;
12929
- },
12930
- /**
12931
- * Calculate the distance from this point to another point
12932
- * @param {Point} p the other point
12933
- * @return {Number} distance
12934
- */
12935
- dist: function (p) {
12936
- return Math.sqrt(this.distSqr(p));
12937
- },
12938
- /**
12939
- * Calculate the distance from this point to another point,
12940
- * without the square root step. Useful if you're comparing
12941
- * relative distances.
12942
- * @param {Point} p the other point
12943
- * @return {Number} distance
12944
- */
12945
- distSqr: function (p) {
12946
- var dx = p.x - this.x, dy = p.y - this.y;
12947
- return dx * dx + dy * dy;
12948
- },
12949
- /**
12950
- * Get the angle from the 0, 0 coordinate to this point, in radians
12951
- * coordinates.
12952
- * @return {Number} angle
12953
- */
12954
- angle: function () {
12955
- return Math.atan2(this.y, this.x);
12956
- },
12957
- /**
12958
- * Get the angle from this point to another point, in radians
12959
- * @param {Point} b the other point
12960
- * @return {Number} angle
12961
- */
12962
- angleTo: function (b) {
12963
- return Math.atan2(this.y - b.y, this.x - b.x);
12964
- },
12965
- /**
12966
- * Get the angle between this point and another point, in radians
12967
- * @param {Point} b the other point
12968
- * @return {Number} angle
12969
- */
12970
- angleWith: function (b) {
12971
- return this.angleWithSep(b.x, b.y);
12972
- },
12973
- /*
12974
- * Find the angle of the two vectors, solving the formula for
12975
- * the cross product a x b = |a||b|sin(θ) for θ.
12976
- * @param {Number} x the x-coordinate
12977
- * @param {Number} y the y-coordinate
12978
- * @return {Number} the angle in radians
12979
- */
12980
- angleWithSep: function (x, y) {
12981
- return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
12982
- },
12983
- _matMult: function (m) {
12984
- var x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
12985
- this.x = x;
12986
- this.y = y;
12987
- return this;
12988
- },
12989
- _add: function (p) {
12990
- this.x += p.x;
12991
- this.y += p.y;
12992
- return this;
12993
- },
12994
- _sub: function (p) {
12995
- this.x -= p.x;
12996
- this.y -= p.y;
12997
- return this;
12998
- },
12999
- _mult: function (k) {
13000
- this.x *= k;
13001
- this.y *= k;
13002
- return this;
13003
- },
13004
- _div: function (k) {
13005
- this.x /= k;
13006
- this.y /= k;
13007
- return this;
13008
- },
13009
- _multByPoint: function (p) {
13010
- this.x *= p.x;
13011
- this.y *= p.y;
13012
- return this;
13013
- },
13014
- _divByPoint: function (p) {
13015
- this.x /= p.x;
13016
- this.y /= p.y;
13017
- return this;
13018
- },
13019
- _unit: function () {
13020
- this._div(this.mag());
13021
- return this;
13022
- },
13023
- _perp: function () {
13024
- var y = this.y;
13025
- this.y = this.x;
13026
- this.x = -y;
13027
- return this;
13028
- },
13029
- _rotate: function (angle) {
13030
- var cos = Math.cos(angle), sin = Math.sin(angle), x = cos * this.x - sin * this.y, y = sin * this.x + cos * this.y;
13031
- this.x = x;
13032
- this.y = y;
13033
- return this;
13034
- },
13035
- _rotateAround: function (angle, p) {
13036
- 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);
13037
- this.x = x;
13038
- this.y = y;
13039
- return this;
13040
- },
13041
- _round: function () {
13042
- this.x = Math.round(this.x);
13043
- this.y = Math.round(this.y);
13044
- return this;
13045
- }
13046
- };
13047
- /**
13048
- * Construct a point from an array if necessary, otherwise if the input
13049
- * is already a Point, or an unknown type, return it unchanged
13050
- * @param {Array<Number>|Point|*} a any kind of input value
13051
- * @return {Point} constructed point, or passed-through value.
13052
- * @example
13053
- * // this
13054
- * var point = Point.convert([0, 1]);
13055
- * // is equivalent to
13056
- * var point = new Point(0, 1);
13057
- */
13058
- Point.convert = function (a) {
13059
- if (a instanceof Point) {
13060
- return a;
13061
- }
13062
- if (Array.isArray(a)) {
13063
- return new Point(a[0], a[1]);
13064
- }
13065
- return a;
13066
- };
13067
-
13068
12916
  class TinyQueue {
13069
12917
  constructor(data = [], compare = (a, b) => a < b ? -1 : a > b ? 1 : 0) {
13070
12918
  this.data = data;
@@ -13955,7 +13803,12 @@
13955
13803
  constructor(registry, path = [], expectedType, scope = new Scope(), errors = [], _scope, options) {
13956
13804
  this.registry = registry;
13957
13805
  this.path = path;
13958
- this.key = path.map(part => `[${ part }]`).join('');
13806
+ this.key = path.map(part => {
13807
+ if (typeof part === 'string') {
13808
+ return `['${ part }']`;
13809
+ }
13810
+ return `[${ part }]`;
13811
+ }).join('');
13959
13812
  this.scope = scope;
13960
13813
  this.errors = errors;
13961
13814
  this.expectedType = expectedType;
@@ -13971,10 +13824,21 @@
13971
13824
  */
13972
13825
  parse(expr, index, expectedType, bindings, options = {}) {
13973
13826
  if (index || expectedType) {
13974
- return this.concat(index, expectedType, bindings)._parse(expr, options);
13827
+ return this.concat(index, null, expectedType, bindings)._parse(expr, options);
13975
13828
  }
13976
13829
  return this._parse(expr, options);
13977
13830
  }
13831
+ /**
13832
+ * @param expr the JSON expression to parse
13833
+ * @param index the optional argument index if parent object being is an argument of another expression
13834
+ * @param key key of parent object being parsed
13835
+ * @param options
13836
+ * @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.
13837
+ * @private
13838
+ */
13839
+ parseObjectValue(expr, index, key, expectedType, bindings, options = {}) {
13840
+ return this.concat(index, key, expectedType, bindings)._parse(expr, options);
13841
+ }
13978
13842
  _parse(expr, options) {
13979
13843
  if (expr === null || typeof expr === 'string' || typeof expr === 'boolean' || typeof expr === 'number') {
13980
13844
  expr = [
@@ -14042,8 +13906,9 @@
14042
13906
  * parsing, is copied by reference rather than cloned.
14043
13907
  * @private
14044
13908
  */
14045
- concat(index, expectedType, bindings) {
14046
- const path = typeof index === 'number' ? this.path.concat(index) : this.path;
13909
+ concat(index, key, expectedType, bindings) {
13910
+ let path = typeof index === 'number' ? this.path.concat(index) : this.path;
13911
+ path = typeof key === 'string' ? path.concat(key) : path;
14047
13912
  const scope = bindings ? this.scope.concat(bindings) : this.scope;
14048
13913
  return new ParsingContext(this.registry, path, expectedType || null, scope, this.errors, this._scope, this.options);
14049
13914
  }
@@ -15258,31 +15123,31 @@
15258
15123
  return context.error(`NumberFormat options argument must be an object.`);
15259
15124
  let locale = null;
15260
15125
  if (options['locale']) {
15261
- locale = context.parse(options['locale'], 1, StringType);
15126
+ locale = context.parseObjectValue(options['locale'], 2, 'locale', StringType);
15262
15127
  if (!locale)
15263
15128
  return null;
15264
15129
  }
15265
15130
  let currency = null;
15266
15131
  if (options['currency']) {
15267
- currency = context.parse(options['currency'], 1, StringType);
15132
+ currency = context.parseObjectValue(options['currency'], 2, 'currency', StringType);
15268
15133
  if (!currency)
15269
15134
  return null;
15270
15135
  }
15271
15136
  let unit = null;
15272
15137
  if (options['unit']) {
15273
- unit = context.parse(options['unit'], 1, StringType);
15138
+ unit = context.parseObjectValue(options['unit'], 2, 'unit', StringType);
15274
15139
  if (!unit)
15275
15140
  return null;
15276
15141
  }
15277
15142
  let minFractionDigits = null;
15278
15143
  if (options['min-fraction-digits']) {
15279
- minFractionDigits = context.parse(options['min-fraction-digits'], 1, NumberType);
15144
+ minFractionDigits = context.parseObjectValue(options['min-fraction-digits'], 2, 'min-fraction-digits', NumberType);
15280
15145
  if (!minFractionDigits)
15281
15146
  return null;
15282
15147
  }
15283
15148
  let maxFractionDigits = null;
15284
15149
  if (options['max-fraction-digits']) {
15285
- maxFractionDigits = context.parse(options['max-fraction-digits'], 1, NumberType);
15150
+ maxFractionDigits = context.parseObjectValue(options['max-fraction-digits'], 2, 'max-fraction-digits', NumberType);
15286
15151
  if (!maxFractionDigits)
15287
15152
  return null;
15288
15153
  }
@@ -16874,7 +16739,7 @@
16874
16739
  return true;
16875
16740
  }
16876
16741
  }
16877
- function createFilter(filter, layerType = 'fill') {
16742
+ function createFilter(filter, scope = '', options = null, layerType = 'fill') {
16878
16743
  if (filter === null || filter === void 0) {
16879
16744
  return {
16880
16745
  filter: () => true,
@@ -16899,7 +16764,7 @@ ${ JSON.stringify(filterExp, null, 2) }
16899
16764
  `);
16900
16765
  }
16901
16766
  const filterSpec = v8[`filter_${ layerType }`];
16902
- const compiledStaticFilter = createExpression(staticFilter, filterSpec);
16767
+ const compiledStaticFilter = createExpression(staticFilter, filterSpec, scope, options);
16903
16768
  let filterFunc = null;
16904
16769
  if (compiledStaticFilter.result === 'error') {
16905
16770
  throw new Error(compiledStaticFilter.value.map(err => `${ err.key }: ${ err.message }`).join(', '));
@@ -16909,7 +16774,7 @@ ${ JSON.stringify(filterExp, null, 2) }
16909
16774
  let dynamicFilterFunc = null;
16910
16775
  let needFeature = null;
16911
16776
  if (staticFilter !== filterExp) {
16912
- const compiledDynamicFilter = createExpression(filterExp, filterSpec);
16777
+ const compiledDynamicFilter = createExpression(filterExp, filterSpec, scope, options);
16913
16778
  if (compiledDynamicFilter.result === 'error') {
16914
16779
  throw new Error(compiledDynamicFilter.value.map(err => `${ err.key }: ${ err.message }`).join(', '));
16915
16780
  } else {
@@ -18486,15 +18351,19 @@ ${ JSON.stringify(filterExp, null, 2) }
18486
18351
  case '<':
18487
18352
  case '<=':
18488
18353
  case '>':
18354
+ // @ts-expect-error - falls through
18489
18355
  case '>=':
18490
18356
  if (value.length >= 2 && unbundle(value[1]) === '$type') {
18491
18357
  errors.push(new ValidationError(key, value, `"$type" cannot be use with operator "${ value[0] }"`));
18492
18358
  }
18359
+ /* falls through */
18493
18360
  case '==':
18361
+ // @ts-expect-error - falls through
18494
18362
  case '!=':
18495
18363
  if (value.length !== 3) {
18496
18364
  errors.push(new ValidationError(key, value, `filter array for operator "${ value[0] }" must have 3 elements`));
18497
18365
  }
18366
+ /* falls through */
18498
18367
  case 'in':
18499
18368
  case '!in':
18500
18369
  if (value.length >= 2) {