@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.
Files changed (45) hide show
  1. package/dist/index.cjs +280 -327
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.ts +65 -29
  4. package/dist/index.es.js +280 -327
  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 +231 -20
  31. package/rollup.config.js +1 -2
  32. package/style-spec.ts +2 -3
  33. package/types.ts +72 -40
  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",
@@ -1446,6 +1508,25 @@
1446
1508
  },
1447
1509
  "property-type": "data-constant",
1448
1510
  experimental: true
1511
+ },
1512
+ "clip-layer-scope": {
1513
+ type: "array",
1514
+ value: "string",
1515
+ "default": [
1516
+ ],
1517
+ 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",
1518
+ "sdk-support": {
1519
+ "basic functionality": {
1520
+ js: "3.6.0",
1521
+ android: "11.7.0",
1522
+ ios: "11.7.0"
1523
+ }
1524
+ },
1525
+ expression: {
1526
+ interpolated: false
1527
+ },
1528
+ "property-type": "data-constant",
1529
+ experimental: true
1449
1530
  }
1450
1531
  };
1451
1532
  var layout_fill = {
@@ -5221,6 +5302,30 @@
5221
5302
  ]
5222
5303
  },
5223
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"
5224
5329
  }
5225
5330
  };
5226
5331
  var paint_line = {
@@ -5769,7 +5874,6 @@
5769
5874
  "default": 0,
5770
5875
  minimum: 0,
5771
5876
  maximum: 1,
5772
- experimental: true,
5773
5877
  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.",
5774
5878
  "sdk-support": {
5775
5879
  "basic functionality": {
@@ -6311,11 +6415,11 @@
6311
6415
  "property-type": "data-driven"
6312
6416
  },
6313
6417
  "icon-occlusion-opacity": {
6314
- doc: "The opacity at which the icon will be drawn in case of being depth occluded. Not supported on globe zoom levels. Absent value means behavior prior to this property introduction.",
6418
+ doc: "The opacity at which the icon will be drawn in case of being depth occluded. Absent value means full occlusion against terrain only.",
6315
6419
  type: "number",
6316
6420
  minimum: 0,
6317
6421
  maximum: 1,
6318
- "default": 1,
6422
+ "default": 0,
6319
6423
  transition: true,
6320
6424
  requires: [
6321
6425
  "icon-image"
@@ -6661,10 +6765,10 @@
6661
6765
  },
6662
6766
  "text-occlusion-opacity": {
6663
6767
  type: "number",
6664
- doc: "The opacity at which the text will be drawn in case of being depth occluded. Not supported on globe zoom levels. Absent value means behavior prior to this property introduction.",
6768
+ doc: "The opacity at which the text will be drawn in case of being depth occluded. Absent value means full occlusion against terrain only.",
6665
6769
  minimum: 0,
6666
6770
  maximum: 1,
6667
- "default": 1,
6771
+ "default": 0,
6668
6772
  transition: true,
6669
6773
  requires: [
6670
6774
  "text-field"
@@ -6956,6 +7060,62 @@
6956
7060
  interpolated: false
6957
7061
  },
6958
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"
6959
7119
  }
6960
7120
  };
6961
7121
  var paint_raster = {
@@ -8008,9 +8168,6 @@
8008
8168
  "default": true,
8009
8169
  doc: "Enable/Disable shadow casting for this layer",
8010
8170
  transition: false,
8011
- expression: {
8012
- interpolated: false
8013
- },
8014
8171
  "sdk-support": {
8015
8172
  "basic functionality": {
8016
8173
  js: "3.0.0",
@@ -8025,9 +8182,6 @@
8025
8182
  "default": true,
8026
8183
  doc: "Enable/Disable shadow receiving for this layer",
8027
8184
  transition: false,
8028
- expression: {
8029
- interpolated: false
8030
- },
8031
8185
  "sdk-support": {
8032
8186
  "basic functionality": {
8033
8187
  js: "3.0.0",
@@ -8234,6 +8388,10 @@
8234
8388
  var v8 = {
8235
8389
  $version: $version,
8236
8390
  $root: $root,
8391
+ featuresets: featuresets,
8392
+ featureset: featureset,
8393
+ selector: selector,
8394
+ selectorProperty: selectorProperty,
8237
8395
  model: model,
8238
8396
  "import": {
8239
8397
  id: {
@@ -8362,7 +8520,6 @@
8362
8520
  "fill-extrusion-edge-radius": {
8363
8521
  type: "number",
8364
8522
  experimental: true,
8365
- "private": true,
8366
8523
  "default": 0,
8367
8524
  minimum: 0,
8368
8525
  maximum: 1,
@@ -8736,7 +8893,6 @@
8736
8893
  "fill-extrusion-ambient-occlusion-intensity": {
8737
8894
  "property-type": "data-constant",
8738
8895
  type: "number",
8739
- "private": true,
8740
8896
  "default": 0,
8741
8897
  minimum: 0,
8742
8898
  maximum: 1,
@@ -8759,7 +8915,6 @@
8759
8915
  "fill-extrusion-ambient-occlusion-radius": {
8760
8916
  "property-type": "data-constant",
8761
8917
  type: "number",
8762
- "private": true,
8763
8918
  "default": 3,
8764
8919
  minimum: 0,
8765
8920
  expression: {
@@ -8948,7 +9103,7 @@
8948
9103
  experimental: true,
8949
9104
  units: "meters",
8950
9105
  "default": 0,
8951
- 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.",
8952
9107
  requires: [
8953
9108
  "lights"
8954
9109
  ],
@@ -9089,6 +9244,51 @@
9089
9244
  ]
9090
9245
  },
9091
9246
  "property-type": "data-constant"
9247
+ },
9248
+ "fill-extrusion-line-width": {
9249
+ type: "number",
9250
+ "default": 0,
9251
+ minimum: 0,
9252
+ transition: true,
9253
+ experimental: true,
9254
+ units: "meters",
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.",
9256
+ "sdk-support": {
9257
+ "basic functionality": {
9258
+ js: "3.7.0",
9259
+ android: "11.7.0",
9260
+ ios: "11.7.0"
9261
+ },
9262
+ "data-driven styling": {
9263
+ js: "3.7.0",
9264
+ android: "11.7.0",
9265
+ ios: "11.7.0"
9266
+ }
9267
+ },
9268
+ expression: {
9269
+ interpolated: true,
9270
+ parameters: [
9271
+ "zoom",
9272
+ "feature",
9273
+ "feature-state",
9274
+ "measure-light"
9275
+ ]
9276
+ },
9277
+ "property-type": "data-driven"
9278
+ },
9279
+ "fill-extrusion-cast-shadows": {
9280
+ type: "boolean",
9281
+ "default": true,
9282
+ doc: "Enable/Disable shadow casting for this layer",
9283
+ transition: false,
9284
+ "sdk-support": {
9285
+ "basic functionality": {
9286
+ js: "3.7.0",
9287
+ android: "11.8.0",
9288
+ ios: "11.8.0"
9289
+ }
9290
+ },
9291
+ "property-type": "data-constant"
9092
9292
  }
9093
9293
  },
9094
9294
  paint_line: paint_line,
@@ -9222,6 +9422,27 @@
9222
9422
  }
9223
9423
  },
9224
9424
  "property-type": "data-constant"
9425
+ },
9426
+ "raster-particle-elevation": {
9427
+ type: "number",
9428
+ doc: "Specifies an uniform elevation from the ground, in meters.",
9429
+ "default": 0,
9430
+ minimum: 0,
9431
+ transition: true,
9432
+ "sdk-support": {
9433
+ "basic functionality": {
9434
+ js: "3.7.0",
9435
+ android: "11.7.0",
9436
+ ios: "11.7.0"
9437
+ }
9438
+ },
9439
+ expression: {
9440
+ interpolated: true,
9441
+ parameters: [
9442
+ "zoom"
9443
+ ]
9444
+ },
9445
+ "property-type": "data-constant"
9225
9446
  }
9226
9447
  },
9227
9448
  paint_hillshade: paint_hillshade,
@@ -11356,19 +11577,19 @@
11356
11577
  nextTokenMayBeObject = false;
11357
11578
  let scale = null;
11358
11579
  if (arg['font-scale']) {
11359
- scale = context.parse(arg['font-scale'], 1, NumberType);
11580
+ scale = context.parseObjectValue(arg['font-scale'], i, 'font-scale', NumberType);
11360
11581
  if (!scale)
11361
11582
  return null;
11362
11583
  }
11363
11584
  let font = null;
11364
11585
  if (arg['text-font']) {
11365
- font = context.parse(arg['text-font'], 1, array$1(StringType));
11586
+ font = context.parseObjectValue(arg['text-font'], i, 'text-font', array$1(StringType));
11366
11587
  if (!font)
11367
11588
  return null;
11368
11589
  }
11369
11590
  let textColor = null;
11370
11591
  if (arg['text-color']) {
11371
- textColor = context.parse(arg['text-color'], 1, ColorType);
11592
+ textColor = context.parseObjectValue(arg['text-color'], i, 'text-color', ColorType);
11372
11593
  if (!textColor)
11373
11594
  return null;
11374
11595
  }
@@ -11377,7 +11598,7 @@
11377
11598
  lastExpression.font = font;
11378
11599
  lastExpression.textColor = textColor;
11379
11600
  } else {
11380
- const content = context.parse(args[i], 1, ValueType);
11601
+ const content = context.parse(args[i], i, ValueType);
11381
11602
  if (!content)
11382
11603
  return null;
11383
11604
  const kind = content.type.kind;
@@ -11838,15 +12059,15 @@
11838
12059
  const options = args[1];
11839
12060
  if (typeof options !== 'object' || Array.isArray(options))
11840
12061
  return context.error(`Collator options argument must be an object.`);
11841
- 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);
11842
12063
  if (!caseSensitive)
11843
12064
  return null;
11844
- 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);
11845
12066
  if (!diacriticSensitive)
11846
12067
  return null;
11847
12068
  let locale = null;
11848
12069
  if (options['locale']) {
11849
- locale = context.parse(options['locale'], 1, StringType);
12070
+ locale = context.parseObjectValue(options['locale'], 1, 'locale', StringType);
11850
12071
  if (!locale)
11851
12072
  return null;
11852
12073
  }
@@ -12692,295 +12913,6 @@
12692
12913
  return deg;
12693
12914
  }
12694
12915
 
12695
- /**
12696
- * A standalone point geometry with useful accessor, comparison, and
12697
- * modification methods.
12698
- *
12699
- * @class Point
12700
- * @param {Number} x the x-coordinate. this could be longitude or screen
12701
- * pixels, or any other sort of unit.
12702
- * @param {Number} y the y-coordinate. this could be latitude or screen
12703
- * pixels, or any other sort of unit.
12704
- * @example
12705
- * var point = new Point(-77, 38);
12706
- */
12707
- function Point(x, y) {
12708
- this.x = x;
12709
- this.y = y;
12710
- }
12711
- Point.prototype = {
12712
- /**
12713
- * Clone this point, returning a new point that can be modified
12714
- * without affecting the old one.
12715
- * @return {Point} the clone
12716
- */
12717
- clone: function () {
12718
- return new Point(this.x, this.y);
12719
- },
12720
- /**
12721
- * Add this point's x & y coordinates to another point,
12722
- * yielding a new point.
12723
- * @param {Point} p the other point
12724
- * @return {Point} output point
12725
- */
12726
- add: function (p) {
12727
- return this.clone()._add(p);
12728
- },
12729
- /**
12730
- * Subtract this point's x & y coordinates to from point,
12731
- * yielding a new point.
12732
- * @param {Point} p the other point
12733
- * @return {Point} output point
12734
- */
12735
- sub: function (p) {
12736
- return this.clone()._sub(p);
12737
- },
12738
- /**
12739
- * Multiply this point's x & y coordinates by point,
12740
- * yielding a new point.
12741
- * @param {Point} p the other point
12742
- * @return {Point} output point
12743
- */
12744
- multByPoint: function (p) {
12745
- return this.clone()._multByPoint(p);
12746
- },
12747
- /**
12748
- * Divide this point's x & y coordinates by point,
12749
- * yielding a new point.
12750
- * @param {Point} p the other point
12751
- * @return {Point} output point
12752
- */
12753
- divByPoint: function (p) {
12754
- return this.clone()._divByPoint(p);
12755
- },
12756
- /**
12757
- * Multiply this point's x & y coordinates by a factor,
12758
- * yielding a new point.
12759
- * @param {Point} k factor
12760
- * @return {Point} output point
12761
- */
12762
- mult: function (k) {
12763
- return this.clone()._mult(k);
12764
- },
12765
- /**
12766
- * Divide this point's x & y coordinates by a factor,
12767
- * yielding a new point.
12768
- * @param {Point} k factor
12769
- * @return {Point} output point
12770
- */
12771
- div: function (k) {
12772
- return this.clone()._div(k);
12773
- },
12774
- /**
12775
- * Rotate this point around the 0, 0 origin by an angle a,
12776
- * given in radians
12777
- * @param {Number} a angle to rotate around, in radians
12778
- * @return {Point} output point
12779
- */
12780
- rotate: function (a) {
12781
- return this.clone()._rotate(a);
12782
- },
12783
- /**
12784
- * Rotate this point around p point by an angle a,
12785
- * given in radians
12786
- * @param {Number} a angle to rotate around, in radians
12787
- * @param {Point} p Point to rotate around
12788
- * @return {Point} output point
12789
- */
12790
- rotateAround: function (a, p) {
12791
- return this.clone()._rotateAround(a, p);
12792
- },
12793
- /**
12794
- * Multiply this point by a 4x1 transformation matrix
12795
- * @param {Array<Number>} m transformation matrix
12796
- * @return {Point} output point
12797
- */
12798
- matMult: function (m) {
12799
- return this.clone()._matMult(m);
12800
- },
12801
- /**
12802
- * Calculate this point but as a unit vector from 0, 0, meaning
12803
- * that the distance from the resulting point to the 0, 0
12804
- * coordinate will be equal to 1 and the angle from the resulting
12805
- * point to the 0, 0 coordinate will be the same as before.
12806
- * @return {Point} unit vector point
12807
- */
12808
- unit: function () {
12809
- return this.clone()._unit();
12810
- },
12811
- /**
12812
- * Compute a perpendicular point, where the new y coordinate
12813
- * is the old x coordinate and the new x coordinate is the old y
12814
- * coordinate multiplied by -1
12815
- * @return {Point} perpendicular point
12816
- */
12817
- perp: function () {
12818
- return this.clone()._perp();
12819
- },
12820
- /**
12821
- * Return a version of this point with the x & y coordinates
12822
- * rounded to integers.
12823
- * @return {Point} rounded point
12824
- */
12825
- round: function () {
12826
- return this.clone()._round();
12827
- },
12828
- /**
12829
- * Return the magitude of this point: this is the Euclidean
12830
- * distance from the 0, 0 coordinate to this point's x and y
12831
- * coordinates.
12832
- * @return {Number} magnitude
12833
- */
12834
- mag: function () {
12835
- return Math.sqrt(this.x * this.x + this.y * this.y);
12836
- },
12837
- /**
12838
- * Judge whether this point is equal to another point, returning
12839
- * true or false.
12840
- * @param {Point} other the other point
12841
- * @return {boolean} whether the points are equal
12842
- */
12843
- equals: function (other) {
12844
- return this.x === other.x && this.y === other.y;
12845
- },
12846
- /**
12847
- * Calculate the distance from this point to another point
12848
- * @param {Point} p the other point
12849
- * @return {Number} distance
12850
- */
12851
- dist: function (p) {
12852
- return Math.sqrt(this.distSqr(p));
12853
- },
12854
- /**
12855
- * Calculate the distance from this point to another point,
12856
- * without the square root step. Useful if you're comparing
12857
- * relative distances.
12858
- * @param {Point} p the other point
12859
- * @return {Number} distance
12860
- */
12861
- distSqr: function (p) {
12862
- var dx = p.x - this.x, dy = p.y - this.y;
12863
- return dx * dx + dy * dy;
12864
- },
12865
- /**
12866
- * Get the angle from the 0, 0 coordinate to this point, in radians
12867
- * coordinates.
12868
- * @return {Number} angle
12869
- */
12870
- angle: function () {
12871
- return Math.atan2(this.y, this.x);
12872
- },
12873
- /**
12874
- * Get the angle from this point to another point, in radians
12875
- * @param {Point} b the other point
12876
- * @return {Number} angle
12877
- */
12878
- angleTo: function (b) {
12879
- return Math.atan2(this.y - b.y, this.x - b.x);
12880
- },
12881
- /**
12882
- * Get the angle between this point and another point, in radians
12883
- * @param {Point} b the other point
12884
- * @return {Number} angle
12885
- */
12886
- angleWith: function (b) {
12887
- return this.angleWithSep(b.x, b.y);
12888
- },
12889
- /*
12890
- * Find the angle of the two vectors, solving the formula for
12891
- * the cross product a x b = |a||b|sin(θ) for θ.
12892
- * @param {Number} x the x-coordinate
12893
- * @param {Number} y the y-coordinate
12894
- * @return {Number} the angle in radians
12895
- */
12896
- angleWithSep: function (x, y) {
12897
- return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
12898
- },
12899
- _matMult: function (m) {
12900
- var x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
12901
- this.x = x;
12902
- this.y = y;
12903
- return this;
12904
- },
12905
- _add: function (p) {
12906
- this.x += p.x;
12907
- this.y += p.y;
12908
- return this;
12909
- },
12910
- _sub: function (p) {
12911
- this.x -= p.x;
12912
- this.y -= p.y;
12913
- return this;
12914
- },
12915
- _mult: function (k) {
12916
- this.x *= k;
12917
- this.y *= k;
12918
- return this;
12919
- },
12920
- _div: function (k) {
12921
- this.x /= k;
12922
- this.y /= k;
12923
- return this;
12924
- },
12925
- _multByPoint: function (p) {
12926
- this.x *= p.x;
12927
- this.y *= p.y;
12928
- return this;
12929
- },
12930
- _divByPoint: function (p) {
12931
- this.x /= p.x;
12932
- this.y /= p.y;
12933
- return this;
12934
- },
12935
- _unit: function () {
12936
- this._div(this.mag());
12937
- return this;
12938
- },
12939
- _perp: function () {
12940
- var y = this.y;
12941
- this.y = this.x;
12942
- this.x = -y;
12943
- return this;
12944
- },
12945
- _rotate: function (angle) {
12946
- var cos = Math.cos(angle), sin = Math.sin(angle), x = cos * this.x - sin * this.y, y = sin * this.x + cos * this.y;
12947
- this.x = x;
12948
- this.y = y;
12949
- return this;
12950
- },
12951
- _rotateAround: function (angle, p) {
12952
- 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);
12953
- this.x = x;
12954
- this.y = y;
12955
- return this;
12956
- },
12957
- _round: function () {
12958
- this.x = Math.round(this.x);
12959
- this.y = Math.round(this.y);
12960
- return this;
12961
- }
12962
- };
12963
- /**
12964
- * Construct a point from an array if necessary, otherwise if the input
12965
- * is already a Point, or an unknown type, return it unchanged
12966
- * @param {Array<Number>|Point|*} a any kind of input value
12967
- * @return {Point} constructed point, or passed-through value.
12968
- * @example
12969
- * // this
12970
- * var point = Point.convert([0, 1]);
12971
- * // is equivalent to
12972
- * var point = new Point(0, 1);
12973
- */
12974
- Point.convert = function (a) {
12975
- if (a instanceof Point) {
12976
- return a;
12977
- }
12978
- if (Array.isArray(a)) {
12979
- return new Point(a[0], a[1]);
12980
- }
12981
- return a;
12982
- };
12983
-
12984
12916
  class TinyQueue {
12985
12917
  constructor(data = [], compare = (a, b) => a < b ? -1 : a > b ? 1 : 0) {
12986
12918
  this.data = data;
@@ -13871,7 +13803,12 @@
13871
13803
  constructor(registry, path = [], expectedType, scope = new Scope(), errors = [], _scope, options) {
13872
13804
  this.registry = registry;
13873
13805
  this.path = path;
13874
- 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('');
13875
13812
  this.scope = scope;
13876
13813
  this.errors = errors;
13877
13814
  this.expectedType = expectedType;
@@ -13887,10 +13824,21 @@
13887
13824
  */
13888
13825
  parse(expr, index, expectedType, bindings, options = {}) {
13889
13826
  if (index || expectedType) {
13890
- return this.concat(index, expectedType, bindings)._parse(expr, options);
13827
+ return this.concat(index, null, expectedType, bindings)._parse(expr, options);
13891
13828
  }
13892
13829
  return this._parse(expr, options);
13893
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
+ }
13894
13842
  _parse(expr, options) {
13895
13843
  if (expr === null || typeof expr === 'string' || typeof expr === 'boolean' || typeof expr === 'number') {
13896
13844
  expr = [
@@ -13958,8 +13906,9 @@
13958
13906
  * parsing, is copied by reference rather than cloned.
13959
13907
  * @private
13960
13908
  */
13961
- concat(index, expectedType, bindings) {
13962
- 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;
13963
13912
  const scope = bindings ? this.scope.concat(bindings) : this.scope;
13964
13913
  return new ParsingContext(this.registry, path, expectedType || null, scope, this.errors, this._scope, this.options);
13965
13914
  }
@@ -15174,31 +15123,31 @@
15174
15123
  return context.error(`NumberFormat options argument must be an object.`);
15175
15124
  let locale = null;
15176
15125
  if (options['locale']) {
15177
- locale = context.parse(options['locale'], 1, StringType);
15126
+ locale = context.parseObjectValue(options['locale'], 2, 'locale', StringType);
15178
15127
  if (!locale)
15179
15128
  return null;
15180
15129
  }
15181
15130
  let currency = null;
15182
15131
  if (options['currency']) {
15183
- currency = context.parse(options['currency'], 1, StringType);
15132
+ currency = context.parseObjectValue(options['currency'], 2, 'currency', StringType);
15184
15133
  if (!currency)
15185
15134
  return null;
15186
15135
  }
15187
15136
  let unit = null;
15188
15137
  if (options['unit']) {
15189
- unit = context.parse(options['unit'], 1, StringType);
15138
+ unit = context.parseObjectValue(options['unit'], 2, 'unit', StringType);
15190
15139
  if (!unit)
15191
15140
  return null;
15192
15141
  }
15193
15142
  let minFractionDigits = null;
15194
15143
  if (options['min-fraction-digits']) {
15195
- minFractionDigits = context.parse(options['min-fraction-digits'], 1, NumberType);
15144
+ minFractionDigits = context.parseObjectValue(options['min-fraction-digits'], 2, 'min-fraction-digits', NumberType);
15196
15145
  if (!minFractionDigits)
15197
15146
  return null;
15198
15147
  }
15199
15148
  let maxFractionDigits = null;
15200
15149
  if (options['max-fraction-digits']) {
15201
- maxFractionDigits = context.parse(options['max-fraction-digits'], 1, NumberType);
15150
+ maxFractionDigits = context.parseObjectValue(options['max-fraction-digits'], 2, 'max-fraction-digits', NumberType);
15202
15151
  if (!maxFractionDigits)
15203
15152
  return null;
15204
15153
  }
@@ -16790,7 +16739,7 @@
16790
16739
  return true;
16791
16740
  }
16792
16741
  }
16793
- function createFilter(filter, layerType = 'fill') {
16742
+ function createFilter(filter, scope = '', options = null, layerType = 'fill') {
16794
16743
  if (filter === null || filter === void 0) {
16795
16744
  return {
16796
16745
  filter: () => true,
@@ -16815,7 +16764,7 @@ ${ JSON.stringify(filterExp, null, 2) }
16815
16764
  `);
16816
16765
  }
16817
16766
  const filterSpec = v8[`filter_${ layerType }`];
16818
- const compiledStaticFilter = createExpression(staticFilter, filterSpec);
16767
+ const compiledStaticFilter = createExpression(staticFilter, filterSpec, scope, options);
16819
16768
  let filterFunc = null;
16820
16769
  if (compiledStaticFilter.result === 'error') {
16821
16770
  throw new Error(compiledStaticFilter.value.map(err => `${ err.key }: ${ err.message }`).join(', '));
@@ -16825,7 +16774,7 @@ ${ JSON.stringify(filterExp, null, 2) }
16825
16774
  let dynamicFilterFunc = null;
16826
16775
  let needFeature = null;
16827
16776
  if (staticFilter !== filterExp) {
16828
- const compiledDynamicFilter = createExpression(filterExp, filterSpec);
16777
+ const compiledDynamicFilter = createExpression(filterExp, filterSpec, scope, options);
16829
16778
  if (compiledDynamicFilter.result === 'error') {
16830
16779
  throw new Error(compiledDynamicFilter.value.map(err => `${ err.key }: ${ err.message }`).join(', '));
16831
16780
  } else {
@@ -18402,15 +18351,19 @@ ${ JSON.stringify(filterExp, null, 2) }
18402
18351
  case '<':
18403
18352
  case '<=':
18404
18353
  case '>':
18354
+ // @ts-expect-error - falls through
18405
18355
  case '>=':
18406
18356
  if (value.length >= 2 && unbundle(value[1]) === '$type') {
18407
18357
  errors.push(new ValidationError(key, value, `"$type" cannot be use with operator "${ value[0] }"`));
18408
18358
  }
18359
+ /* falls through */
18409
18360
  case '==':
18361
+ // @ts-expect-error - falls through
18410
18362
  case '!=':
18411
18363
  if (value.length !== 3) {
18412
18364
  errors.push(new ValidationError(key, value, `filter array for operator "${ value[0] }" must have 3 elements`));
18413
18365
  }
18366
+ /* falls through */
18414
18367
  case 'in':
18415
18368
  case '!in':
18416
18369
  if (value.length >= 2) {