maplibre-gl 3.2.1 → 3.3.0

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 (88) hide show
  1. package/build/generate-struct-arrays.ts +6 -3
  2. package/build/generate-style-code.ts +7 -8
  3. package/dist/maplibre-gl-csp-worker.js +1 -1
  4. package/dist/maplibre-gl-csp-worker.js.map +1 -1
  5. package/dist/maplibre-gl-csp.js +1 -1
  6. package/dist/maplibre-gl-csp.js.map +1 -1
  7. package/dist/maplibre-gl-dev.js +565 -243
  8. package/dist/maplibre-gl-dev.js.map +1 -1
  9. package/dist/maplibre-gl.d.ts +111 -57
  10. package/dist/maplibre-gl.js +4 -4
  11. package/dist/maplibre-gl.js.map +1 -1
  12. package/package.json +20 -20
  13. package/src/data/array_types.g.ts +110 -24
  14. package/src/data/bucket/circle_bucket.ts +1 -0
  15. package/src/data/bucket/line_bucket.ts +1 -0
  16. package/src/data/bucket/symbol_attributes.ts +7 -1
  17. package/src/data/bucket/symbol_bucket.ts +5 -1
  18. package/src/data/feature_index.ts +1 -0
  19. package/src/data/program_configuration.ts +1 -0
  20. package/src/data/segment.ts +2 -0
  21. package/src/geo/transform.ts +1 -0
  22. package/src/gl/context.ts +1 -0
  23. package/src/gl/framebuffer.ts +1 -0
  24. package/src/gl/index_buffer.ts +1 -0
  25. package/src/gl/render_pool.ts +2 -1
  26. package/src/gl/vertex_buffer.ts +1 -0
  27. package/src/render/draw_symbol.ts +8 -9
  28. package/src/render/image_atlas.ts +1 -0
  29. package/src/render/line_atlas.ts +1 -0
  30. package/src/render/painter.ts +1 -0
  31. package/src/render/program.ts +1 -0
  32. package/src/render/render_to_texture.ts +31 -14
  33. package/src/render/terrain.ts +3 -0
  34. package/src/render/texture.ts +1 -0
  35. package/src/render/uniform_binding.ts +2 -0
  36. package/src/render/vertex_array_object.ts +1 -0
  37. package/src/shaders/symbol_sdf.fragment.glsl +9 -3
  38. package/src/shaders/symbol_sdf.fragment.glsl.g.ts +1 -1
  39. package/src/source/canvas_source.ts +1 -3
  40. package/src/source/geojson_source.ts +1 -3
  41. package/src/source/image_source.ts +2 -4
  42. package/src/source/source_cache.ts +1 -0
  43. package/src/source/source_state.ts +1 -0
  44. package/src/source/terrain_source_cache.ts +1 -0
  45. package/src/source/tile.ts +1 -0
  46. package/src/source/tile_cache.ts +1 -1
  47. package/src/source/tile_id.ts +1 -0
  48. package/src/source/vector_tile_worker_source.test.ts +79 -0
  49. package/src/source/vector_tile_worker_source.ts +26 -1
  50. package/src/source/worker_source.ts +1 -0
  51. package/src/style/evaluation_parameters.ts +1 -0
  52. package/src/style/properties.ts +18 -0
  53. package/src/style/style.ts +1 -0
  54. package/src/style/style_glyph.ts +1 -0
  55. package/src/style/style_layer/background_style_layer_properties.g.ts +1 -6
  56. package/src/style/style_layer/circle_style_layer_properties.g.ts +1 -6
  57. package/src/style/style_layer/fill_extrusion_style_layer_properties.g.ts +1 -6
  58. package/src/style/style_layer/fill_style_layer_properties.g.ts +1 -6
  59. package/src/style/style_layer/heatmap_style_layer_properties.g.ts +1 -6
  60. package/src/style/style_layer/hillshade_style_layer_properties.g.ts +1 -6
  61. package/src/style/style_layer/line_style_layer_properties.g.ts +1 -6
  62. package/src/style/style_layer/raster_style_layer_properties.g.ts +1 -6
  63. package/src/style/style_layer/symbol_style_layer_properties.g.ts +4 -6
  64. package/src/style/style_layer/variable_text_anchor.test.ts +117 -0
  65. package/src/style/style_layer/variable_text_anchor.ts +163 -0
  66. package/src/symbol/collision_index.ts +1 -0
  67. package/src/symbol/grid_index.ts +1 -0
  68. package/src/symbol/placement.ts +52 -40
  69. package/src/symbol/symbol_layout.ts +42 -116
  70. package/src/ui/camera.ts +8 -8
  71. package/src/ui/handler/box_zoom.ts +1 -3
  72. package/src/ui/handler/click_zoom.ts +1 -3
  73. package/src/ui/handler/keyboard.ts +1 -3
  74. package/src/ui/handler/scroll_zoom.ts +1 -3
  75. package/src/ui/handler/shim/dblclick_zoom.ts +1 -3
  76. package/src/ui/handler/shim/drag_pan.ts +1 -3
  77. package/src/ui/handler/shim/drag_rotate.ts +1 -3
  78. package/src/ui/handler/shim/two_fingers_touch.ts +1 -3
  79. package/src/ui/handler/transform-provider.ts +1 -0
  80. package/src/ui/handler/two_fingers_touch.ts +1 -3
  81. package/src/ui/map.ts +7 -6
  82. package/src/util/ajax.test.ts +33 -0
  83. package/src/util/ajax.ts +5 -0
  84. package/src/util/image.ts +1 -0
  85. package/src/util/image_request.ts +2 -2
  86. package/src/util/performance.ts +1 -2
  87. package/src/util/struct_array.ts +5 -1
  88. package/src/util/test/mock_fetch.ts +51 -0
@@ -1,4 +1,4 @@
1
- /* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v3.2.1/LICENSE.txt */
1
+ /* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v3.3.0/LICENSE.txt */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -1031,6 +1031,7 @@ function makeFetchRequest(requestParameters, callback) {
1031
1031
  body: requestParameters.body,
1032
1032
  credentials: requestParameters.credentials,
1033
1033
  headers: requestParameters.headers,
1034
+ cache: requestParameters.cache,
1034
1035
  referrer: getReferrer(),
1035
1036
  signal: controller.signal
1036
1037
  });
@@ -2548,6 +2549,25 @@ var layout_symbol = {
2548
2549
  },
2549
2550
  "property-type": "data-constant"
2550
2551
  },
2552
+ "text-variable-anchor-offset": {
2553
+ type: "variableAnchorOffsetCollection",
2554
+ requires: [
2555
+ "text-field",
2556
+ {
2557
+ "symbol-placement": [
2558
+ "point"
2559
+ ]
2560
+ }
2561
+ ],
2562
+ expression: {
2563
+ interpolated: true,
2564
+ parameters: [
2565
+ "zoom",
2566
+ "feature"
2567
+ ]
2568
+ },
2569
+ "property-type": "data-driven"
2570
+ },
2551
2571
  "text-anchor": {
2552
2572
  type: "enum",
2553
2573
  values: {
@@ -4867,6 +4887,7 @@ const CollatorType = { kind: 'collator' };
4867
4887
  const FormattedType = { kind: 'formatted' };
4868
4888
  const PaddingType = { kind: 'padding' };
4869
4889
  const ResolvedImageType = { kind: 'resolvedImage' };
4890
+ const VariableAnchorOffsetCollectionType = { kind: 'variableAnchorOffsetCollection' };
4870
4891
  function array$1(itemType, N) {
4871
4892
  return {
4872
4893
  kind: 'array',
@@ -4895,7 +4916,8 @@ const valueMemberTypes = [
4895
4916
  ObjectType,
4896
4917
  array$1(ValueType),
4897
4918
  PaddingType,
4898
- ResolvedImageType
4919
+ ResolvedImageType,
4920
+ VariableAnchorOffsetCollectionType
4899
4921
  ];
4900
4922
  /**
4901
4923
  * Returns null if `t` is a subtype of `expected`; otherwise returns an
@@ -5591,6 +5613,44 @@ class Padding {
5591
5613
  }
5592
5614
  }
5593
5615
 
5616
+ /** Set of valid anchor positions, as a set for validation */
5617
+ const anchors = new Set(['center', 'left', 'right', 'top', 'bottom', 'top-left', 'top-right', 'bottom-left', 'bottom-right']);
5618
+ /**
5619
+ * Utility class to assist managing values for text-variable-anchor-offset property. Create instances from
5620
+ * bare arrays using the static method `VariableAnchorOffsetCollection.parse`.
5621
+ * @private
5622
+ */
5623
+ class VariableAnchorOffsetCollection {
5624
+ constructor(values) {
5625
+ this.values = values.slice();
5626
+ }
5627
+ static parse(input) {
5628
+ if (input instanceof VariableAnchorOffsetCollection) {
5629
+ return input;
5630
+ }
5631
+ if (!Array.isArray(input) ||
5632
+ input.length < 1 ||
5633
+ input.length % 2 !== 0) {
5634
+ return undefined;
5635
+ }
5636
+ for (let i = 0; i < input.length; i += 2) {
5637
+ // Elements in even positions should be anchor positions; Elements in odd positions should be offset values
5638
+ const anchorValue = input[i];
5639
+ const offsetValue = input[i + 1];
5640
+ if (typeof anchorValue !== 'string' || !anchors.has(anchorValue)) {
5641
+ return undefined;
5642
+ }
5643
+ if (!Array.isArray(offsetValue) || offsetValue.length !== 2 || typeof offsetValue[0] !== 'number' || typeof offsetValue[1] !== 'number') {
5644
+ return undefined;
5645
+ }
5646
+ }
5647
+ return new VariableAnchorOffsetCollection(input);
5648
+ }
5649
+ toString() {
5650
+ return JSON.stringify(this.values);
5651
+ }
5652
+ }
5653
+
5594
5654
  class ResolvedImage {
5595
5655
  constructor(options) {
5596
5656
  this.name = options.name;
@@ -5619,31 +5679,16 @@ function validateRGBA(r, g, b, a) {
5619
5679
  return null;
5620
5680
  }
5621
5681
  function isValue(mixed) {
5622
- if (mixed === null) {
5623
- return true;
5624
- }
5625
- else if (typeof mixed === 'string') {
5626
- return true;
5627
- }
5628
- else if (typeof mixed === 'boolean') {
5629
- return true;
5630
- }
5631
- else if (typeof mixed === 'number') {
5632
- return true;
5633
- }
5634
- else if (mixed instanceof Color) {
5635
- return true;
5636
- }
5637
- else if (mixed instanceof Collator) {
5638
- return true;
5639
- }
5640
- else if (mixed instanceof Formatted) {
5641
- return true;
5642
- }
5643
- else if (mixed instanceof Padding) {
5644
- return true;
5645
- }
5646
- else if (mixed instanceof ResolvedImage) {
5682
+ if (mixed === null ||
5683
+ typeof mixed === 'string' ||
5684
+ typeof mixed === 'boolean' ||
5685
+ typeof mixed === 'number' ||
5686
+ mixed instanceof Color ||
5687
+ mixed instanceof Collator ||
5688
+ mixed instanceof Formatted ||
5689
+ mixed instanceof Padding ||
5690
+ mixed instanceof VariableAnchorOffsetCollection ||
5691
+ mixed instanceof ResolvedImage) {
5647
5692
  return true;
5648
5693
  }
5649
5694
  else if (Array.isArray(mixed)) {
@@ -5691,6 +5736,9 @@ function typeOf(value) {
5691
5736
  else if (value instanceof Padding) {
5692
5737
  return PaddingType;
5693
5738
  }
5739
+ else if (value instanceof VariableAnchorOffsetCollection) {
5740
+ return VariableAnchorOffsetCollectionType;
5741
+ }
5694
5742
  else if (value instanceof ResolvedImage) {
5695
5743
  return ResolvedImageType;
5696
5744
  }
@@ -5724,7 +5772,7 @@ function toString(value) {
5724
5772
  else if (type === 'string' || type === 'number' || type === 'boolean') {
5725
5773
  return String(value);
5726
5774
  }
5727
- else if (value instanceof Color || value instanceof Formatted || value instanceof Padding || value instanceof ResolvedImage) {
5775
+ else if (value instanceof Color || value instanceof Formatted || value instanceof Padding || value instanceof VariableAnchorOffsetCollection || value instanceof ResolvedImage) {
5728
5776
  return value.toString();
5729
5777
  }
5730
5778
  else {
@@ -5888,71 +5936,80 @@ class Coercion {
5888
5936
  return new Coercion(type, parsed);
5889
5937
  }
5890
5938
  evaluate(ctx) {
5891
- if (this.type.kind === 'boolean') {
5892
- return Boolean(this.args[0].evaluate(ctx));
5893
- }
5894
- else if (this.type.kind === 'color') {
5895
- let input;
5896
- let error;
5897
- for (const arg of this.args) {
5898
- input = arg.evaluate(ctx);
5899
- error = null;
5900
- if (input instanceof Color) {
5901
- return input;
5902
- }
5903
- else if (typeof input === 'string') {
5904
- const c = ctx.parseColor(input);
5905
- if (c)
5906
- return c;
5907
- }
5908
- else if (Array.isArray(input)) {
5909
- if (input.length < 3 || input.length > 4) {
5910
- error = `Invalid rbga value ${JSON.stringify(input)}: expected an array containing either three or four numeric values.`;
5939
+ switch (this.type.kind) {
5940
+ case 'boolean':
5941
+ return Boolean(this.args[0].evaluate(ctx));
5942
+ case 'color': {
5943
+ let input;
5944
+ let error;
5945
+ for (const arg of this.args) {
5946
+ input = arg.evaluate(ctx);
5947
+ error = null;
5948
+ if (input instanceof Color) {
5949
+ return input;
5911
5950
  }
5912
- else {
5913
- error = validateRGBA(input[0], input[1], input[2], input[3]);
5951
+ else if (typeof input === 'string') {
5952
+ const c = ctx.parseColor(input);
5953
+ if (c)
5954
+ return c;
5914
5955
  }
5915
- if (!error) {
5916
- return new Color(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
5956
+ else if (Array.isArray(input)) {
5957
+ if (input.length < 3 || input.length > 4) {
5958
+ error = `Invalid rbga value ${JSON.stringify(input)}: expected an array containing either three or four numeric values.`;
5959
+ }
5960
+ else {
5961
+ error = validateRGBA(input[0], input[1], input[2], input[3]);
5962
+ }
5963
+ if (!error) {
5964
+ return new Color(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);
5965
+ }
5917
5966
  }
5918
5967
  }
5968
+ throw new RuntimeError(error || `Could not parse color from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`);
5919
5969
  }
5920
- throw new RuntimeError(error || `Could not parse color from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`);
5921
- }
5922
- else if (this.type.kind === 'padding') {
5923
- let input;
5924
- for (const arg of this.args) {
5925
- input = arg.evaluate(ctx);
5926
- const pad = Padding.parse(input);
5927
- if (pad) {
5928
- return pad;
5970
+ case 'padding': {
5971
+ let input;
5972
+ for (const arg of this.args) {
5973
+ input = arg.evaluate(ctx);
5974
+ const pad = Padding.parse(input);
5975
+ if (pad) {
5976
+ return pad;
5977
+ }
5929
5978
  }
5979
+ throw new RuntimeError(`Could not parse padding from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`);
5930
5980
  }
5931
- throw new RuntimeError(`Could not parse padding from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`);
5932
- }
5933
- else if (this.type.kind === 'number') {
5934
- let value = null;
5935
- for (const arg of this.args) {
5936
- value = arg.evaluate(ctx);
5937
- if (value === null)
5938
- return 0;
5939
- const num = Number(value);
5940
- if (isNaN(num))
5941
- continue;
5942
- return num;
5981
+ case 'variableAnchorOffsetCollection': {
5982
+ let input;
5983
+ for (const arg of this.args) {
5984
+ input = arg.evaluate(ctx);
5985
+ const coll = VariableAnchorOffsetCollection.parse(input);
5986
+ if (coll) {
5987
+ return coll;
5988
+ }
5989
+ }
5990
+ throw new RuntimeError(`Could not parse variableAnchorOffsetCollection from value '${typeof input === 'string' ? input : JSON.stringify(input)}'`);
5943
5991
  }
5944
- throw new RuntimeError(`Could not convert ${JSON.stringify(value)} to number.`);
5945
- }
5946
- else if (this.type.kind === 'formatted') {
5947
- // There is no explicit 'to-formatted' but this coercion can be implicitly
5948
- // created by properties that expect the 'formatted' type.
5949
- return Formatted.fromString(toString(this.args[0].evaluate(ctx)));
5950
- }
5951
- else if (this.type.kind === 'resolvedImage') {
5952
- return ResolvedImage.fromString(toString(this.args[0].evaluate(ctx)));
5953
- }
5954
- else {
5955
- return toString(this.args[0].evaluate(ctx));
5992
+ case 'number': {
5993
+ let value = null;
5994
+ for (const arg of this.args) {
5995
+ value = arg.evaluate(ctx);
5996
+ if (value === null)
5997
+ return 0;
5998
+ const num = Number(value);
5999
+ if (isNaN(num))
6000
+ continue;
6001
+ return num;
6002
+ }
6003
+ throw new RuntimeError(`Could not convert ${JSON.stringify(value)} to number.`);
6004
+ }
6005
+ case 'formatted':
6006
+ // There is no explicit 'to-formatted' but this coercion can be implicitly
6007
+ // created by properties that expect the 'formatted' type.
6008
+ return Formatted.fromString(toString(this.args[0].evaluate(ctx)));
6009
+ case 'resolvedImage':
6010
+ return ResolvedImage.fromString(toString(this.args[0].evaluate(ctx)));
6011
+ default:
6012
+ return toString(this.args[0].evaluate(ctx));
5956
6013
  }
5957
6014
  }
5958
6015
  eachChild(fn) {
@@ -6074,6 +6131,9 @@ class ParsingContext {
6074
6131
  else if (expected.kind === 'padding' && (actual.kind === 'value' || actual.kind === 'number' || actual.kind === 'array')) {
6075
6132
  parsed = annotate(parsed, expected, options.typeAnnotation || 'coerce');
6076
6133
  }
6134
+ else if (expected.kind === 'variableAnchorOffsetCollection' && (actual.kind === 'value' || actual.kind === 'array')) {
6135
+ parsed = annotate(parsed, expected, options.typeAnnotation || 'coerce');
6136
+ }
6077
6137
  else if (this.checkSubtype(expected, actual)) {
6078
6138
  return null;
6079
6139
  }
@@ -6844,6 +6904,7 @@ const interpolateFactory = (interpolationType) => {
6844
6904
  case 'color': return color;
6845
6905
  case 'array': return array;
6846
6906
  case 'padding': return padding;
6907
+ case 'variableAnchorOffsetCollection': return variableAnchorOffsetCollection;
6847
6908
  }
6848
6909
  };
6849
6910
  function number(from, to, t) {
@@ -6905,11 +6966,32 @@ function array(from, to, t) {
6905
6966
  function padding(from, to, t) {
6906
6967
  return new Padding(array(from.values, to.values, t));
6907
6968
  }
6969
+ function variableAnchorOffsetCollection(from, to, t) {
6970
+ const fromValues = from.values;
6971
+ const toValues = to.values;
6972
+ if (fromValues.length !== toValues.length) {
6973
+ throw new RuntimeError(`Cannot interpolate values of different length. from: ${from.toString()}, to: ${to.toString()}`);
6974
+ }
6975
+ const output = [];
6976
+ for (let i = 0; i < fromValues.length; i += 2) {
6977
+ // Anchor entries must match
6978
+ if (fromValues[i] !== toValues[i]) {
6979
+ throw new RuntimeError(`Cannot interpolate values containing mismatched anchors. from[${i}]: ${fromValues[i]}, to[${i}]: ${toValues[i]}`);
6980
+ }
6981
+ output.push(fromValues[i]);
6982
+ // Interpolate the offset values for each anchor
6983
+ const [fx, fy] = fromValues[i + 1];
6984
+ const [tx, ty] = toValues[i + 1];
6985
+ output.push([number(fx, tx, t), number(fy, ty, t)]);
6986
+ }
6987
+ return new VariableAnchorOffsetCollection(output);
6988
+ }
6908
6989
  const interpolate = {
6909
6990
  number,
6910
6991
  color,
6911
6992
  array,
6912
6993
  padding,
6994
+ variableAnchorOffsetCollection
6913
6995
  };
6914
6996
 
6915
6997
  class Interpolate {
@@ -7008,6 +7090,7 @@ class Interpolate {
7008
7090
  if (!verifyType(outputType, NumberType) &&
7009
7091
  !verifyType(outputType, ColorType) &&
7010
7092
  !verifyType(outputType, PaddingType) &&
7093
+ !verifyType(outputType, VariableAnchorOffsetCollectionType) &&
7011
7094
  !verifyType(outputType, array$1(NumberType))) {
7012
7095
  return context.error(`Type ${toString$1(outputType)} is not interpolatable.`);
7013
7096
  }
@@ -8867,6 +8950,9 @@ function normalizePropertyExpression(value, specification) {
8867
8950
  else if (specification.type === 'padding' && (typeof value === 'number' || Array.isArray(value))) {
8868
8951
  constant = Padding.parse(value);
8869
8952
  }
8953
+ else if (specification.type === 'variableAnchorOffsetCollection' && Array.isArray(value)) {
8954
+ constant = VariableAnchorOffsetCollection.parse(value);
8955
+ }
8870
8956
  return {
8871
8957
  kind: 'constant',
8872
8958
  evaluate: () => constant
@@ -8920,7 +9006,8 @@ function getExpectedType(spec) {
8920
9006
  boolean: BooleanType,
8921
9007
  formatted: FormattedType,
8922
9008
  padding: PaddingType,
8923
- resolvedImage: ResolvedImageType
9009
+ resolvedImage: ResolvedImageType,
9010
+ variableAnchorOffsetCollection: VariableAnchorOffsetCollectionType
8924
9011
  };
8925
9012
  if (spec.type === 'array') {
8926
9013
  return array$1(types[spec.value] || ValueType, spec.length);
@@ -8940,6 +9027,9 @@ function getDefaultValue(spec) {
8940
9027
  else if (spec.type === 'padding') {
8941
9028
  return Padding.parse(spec.default) || null;
8942
9029
  }
9030
+ else if (spec.type === 'variableAnchorOffsetCollection') {
9031
+ return VariableAnchorOffsetCollection.parse(spec.default) || null;
9032
+ }
8943
9033
  else if (spec.default === undefined) {
8944
9034
  return null;
8945
9035
  }
@@ -10609,6 +10699,38 @@ function validatePadding(options) {
10609
10699
  }
10610
10700
  }
10611
10701
 
10702
+ function validateVariableAnchorOffsetCollection(options) {
10703
+ const key = options.key;
10704
+ const value = options.value;
10705
+ const type = getType(value);
10706
+ const styleSpec = options.styleSpec;
10707
+ if (type !== 'array' || value.length < 1 || value.length % 2 !== 0) {
10708
+ return [new ValidationError(key, value, 'variableAnchorOffsetCollection requires a non-empty array of even length')];
10709
+ }
10710
+ let errors = [];
10711
+ for (let i = 0; i < value.length; i += 2) {
10712
+ // Elements in even positions should be values from text-anchor enum
10713
+ errors = errors.concat(validateEnum({
10714
+ key: `${key}[${i}]`,
10715
+ value: value[i],
10716
+ valueSpec: styleSpec['layout_symbol']['text-anchor']
10717
+ }));
10718
+ // Elements in odd positions should be points (2-element numeric arrays)
10719
+ errors = errors.concat(validateArray({
10720
+ key: `${key}[${i + 1}]`,
10721
+ value: value[i + 1],
10722
+ valueSpec: {
10723
+ length: 2,
10724
+ value: 'number'
10725
+ },
10726
+ validateSpec: options.validateSpec,
10727
+ style: options.style,
10728
+ styleSpec
10729
+ }));
10730
+ }
10731
+ return errors;
10732
+ }
10733
+
10612
10734
  function validateSprite(options) {
10613
10735
  let errors = [];
10614
10736
  const sprite = options.value;
@@ -10671,6 +10793,7 @@ const VALIDATORS = {
10671
10793
  'formatted': validateFormatted,
10672
10794
  'resolvedImage': validateImage,
10673
10795
  'padding': validatePadding,
10796
+ 'variableAnchorOffsetCollection': validateVariableAnchorOffsetCollection,
10674
10797
  'sprite': validateSprite,
10675
10798
  };
10676
10799
  // Main recursive validation function. Tracks:
@@ -11999,6 +12122,7 @@ const lazyLoadRTLTextPlugin = function () {
11999
12122
  };
12000
12123
 
12001
12124
  /**
12125
+ * @internal
12002
12126
  * A parameter that can be evaluated to a value
12003
12127
  */
12004
12128
  class EvaluationParameters {
@@ -12040,6 +12164,7 @@ class EvaluationParameters {
12040
12164
  }
12041
12165
 
12042
12166
  /**
12167
+ * @internal
12043
12168
  * `PropertyValue` represents the value part of a property key-value unit. It's used to represent both
12044
12169
  * paint and layout property values, and regardless of whether or not their property supports data-driven
12045
12170
  * expressions.
@@ -12070,6 +12195,7 @@ class PropertyValue {
12070
12195
  }
12071
12196
  }
12072
12197
  /**
12198
+ * @internal
12073
12199
  * Paint properties are _transitionable_: they can change in a fluid manner, interpolating or cross-fading between
12074
12200
  * old and new value. The duration of the transition, and the delay before it begins, is configurable.
12075
12201
  *
@@ -12092,6 +12218,7 @@ class TransitionablePropertyValue {
12092
12218
  }
12093
12219
  }
12094
12220
  /**
12221
+ * @internal
12095
12222
  * `Transitionable` stores a map of all (property name, `TransitionablePropertyValue`) pairs for paint properties of a
12096
12223
  * given layer type. It can calculate the `TransitioningPropertyValue`s for all of them at once, producing a
12097
12224
  * `Transitioning` instance for the same set of properties.
@@ -12151,6 +12278,7 @@ class Transitionable {
12151
12278
  }
12152
12279
  }
12153
12280
  /**
12281
+ * @internal
12154
12282
  * `TransitioningPropertyValue` implements the first of two intermediate steps in the evaluation chain of a paint
12155
12283
  * property value. In this step, transitions between old and new values are handled: as long as the transition is in
12156
12284
  * progress, `TransitioningPropertyValue` maintains a reference to the prior value, and interpolates between it and
@@ -12199,6 +12327,7 @@ class TransitioningPropertyValue {
12199
12327
  }
12200
12328
  }
12201
12329
  /**
12330
+ * @internal
12202
12331
  * `Transitioning` stores a map of all (property name, `TransitioningPropertyValue`) pairs for paint properties of a
12203
12332
  * given layer type. It can calculate the possibly-evaluated values for all of them at once, producing a
12204
12333
  * `PossiblyEvaluated` instance for the same set of properties.
@@ -12239,6 +12368,9 @@ class Layout {
12239
12368
  this._properties = properties;
12240
12369
  this._values = Object.create(properties.defaultPropertyValues);
12241
12370
  }
12371
+ hasValue(name) {
12372
+ return this._values[name].value !== undefined;
12373
+ }
12242
12374
  getValue(name) {
12243
12375
  return clone$9(this._values[name].value);
12244
12376
  }
@@ -12264,6 +12396,7 @@ class Layout {
12264
12396
  }
12265
12397
  }
12266
12398
  /**
12399
+ * @internal
12267
12400
  * `PossiblyEvaluatedPropertyValue` is used for data-driven paint and layout property values. It holds a
12268
12401
  * `PossiblyEvaluatedValue` and the `GlobalProperties` that were used to generate it. You're not allowed to supply
12269
12402
  * a different set of `GlobalProperties` when performing the final evaluation because they would be ignored in the
@@ -12291,6 +12424,7 @@ class PossiblyEvaluatedPropertyValue {
12291
12424
  }
12292
12425
  }
12293
12426
  /**
12427
+ * @internal
12294
12428
  * `PossiblyEvaluated` stores a map of all (property name, `R`) pairs for paint or layout properties of a
12295
12429
  * given layer type.
12296
12430
  */
@@ -12304,6 +12438,7 @@ class PossiblyEvaluated {
12304
12438
  }
12305
12439
  }
12306
12440
  /**
12441
+ * @internal
12307
12442
  * An implementation of `Property` for properties that do not permit data-driven (source or composite) expressions.
12308
12443
  * This restriction allows us to declare statically that the result of possibly evaluating this kind of property
12309
12444
  * is in fact always the scalar type `T`, and can be used without further evaluating the value on a per-feature basis.
@@ -12329,6 +12464,7 @@ class DataConstantProperty {
12329
12464
  }
12330
12465
  }
12331
12466
  /**
12467
+ * @internal
12332
12468
  * An implementation of `Property` for properties that permit data-driven (source or composite) expressions.
12333
12469
  * The result of possibly evaluating this kind of property is `PossiblyEvaluatedPropertyValue<T>`; obtaining
12334
12470
  * a scalar value `T` requires further evaluation on a per-feature basis.
@@ -12381,6 +12517,7 @@ class DataDrivenProperty {
12381
12517
  }
12382
12518
  }
12383
12519
  /**
12520
+ * @internal
12384
12521
  * An implementation of `Property` for data driven `line-pattern` which are transitioned by cross-fading
12385
12522
  * rather than interpolation.
12386
12523
  */
@@ -12426,6 +12563,7 @@ class CrossFadedDataDrivenProperty extends DataDrivenProperty {
12426
12563
  }
12427
12564
  }
12428
12565
  /**
12566
+ * @internal
12429
12567
  * An implementation of `Property` for `*-pattern` and `line-dasharray`, which are transitioned by cross-fading
12430
12568
  * rather than interpolation.
12431
12569
  */
@@ -12454,6 +12592,7 @@ class CrossFadedProperty {
12454
12592
  }
12455
12593
  }
12456
12594
  /**
12595
+ * @internal
12457
12596
  * An implementation of `Property` for `heatmap-color` and `line-gradient`. Interpolation is a no-op, and
12458
12597
  * evaluation returns a boolean value in order to indicate its presence, but the real
12459
12598
  * evaluation happens in StyleLayer classes.
@@ -12468,6 +12607,7 @@ class ColorRampProperty {
12468
12607
  interpolate() { return false; }
12469
12608
  }
12470
12609
  /**
12610
+ * @internal
12471
12611
  * `Properties` holds objects containing default values for the layout or paint property set of a given
12472
12612
  * layer type. These objects are immutable, and they are used as the prototypes for the `_values` members of
12473
12613
  * `Transitionable`, `Transitioning`, `Layout`, and `PossiblyEvaluated`. This allows these classes to avoid
@@ -12695,6 +12835,7 @@ class StyleLayer extends Evented {
12695
12835
 
12696
12836
  // Note: all "sizes" are measured in bytes
12697
12837
  /**
12838
+ * @internal
12698
12839
  * A view type size
12699
12840
  */
12700
12841
  const viewTypes = {
@@ -12706,7 +12847,7 @@ const viewTypes = {
12706
12847
  'Uint32': Uint32Array,
12707
12848
  'Float32': Float32Array
12708
12849
  };
12709
- /** */
12850
+ /** @internal */
12710
12851
  class Struct {
12711
12852
  /**
12712
12853
  * @param structArray - The StructArray the struct is stored in
@@ -12723,6 +12864,7 @@ class Struct {
12723
12864
  const DEFAULT_CAPACITY = 128;
12724
12865
  const RESIZE_MULTIPLIER = 5;
12725
12866
  /**
12867
+ * @internal
12726
12868
  * `StructArray` provides an abstraction over `ArrayBuffer` and `TypedArray`
12727
12869
  * making it behave like an array of typed structs.
12728
12870
  *
@@ -12857,6 +12999,7 @@ function align$1(offset, size) {
12857
12999
 
12858
13000
  // This file is generated. Edit build/generate-struct-arrays.ts, then run `npm run codegen`.
12859
13001
  /**
13002
+ * @internal
12860
13003
  * Implementation of the StructArray layout:
12861
13004
  * [0]: Int16[2]
12862
13005
  *
@@ -12881,6 +13024,7 @@ class StructArrayLayout2i4 extends StructArray {
12881
13024
  StructArrayLayout2i4.prototype.bytesPerElement = 4;
12882
13025
  register('StructArrayLayout2i4', StructArrayLayout2i4);
12883
13026
  /**
13027
+ * @internal
12884
13028
  * Implementation of the StructArray layout:
12885
13029
  * [0]: Int16[3]
12886
13030
  *
@@ -12906,6 +13050,7 @@ class StructArrayLayout3i6 extends StructArray {
12906
13050
  StructArrayLayout3i6.prototype.bytesPerElement = 6;
12907
13051
  register('StructArrayLayout3i6', StructArrayLayout3i6);
12908
13052
  /**
13053
+ * @internal
12909
13054
  * Implementation of the StructArray layout:
12910
13055
  * [0]: Int16[4]
12911
13056
  *
@@ -12932,6 +13077,7 @@ class StructArrayLayout4i8 extends StructArray {
12932
13077
  StructArrayLayout4i8.prototype.bytesPerElement = 8;
12933
13078
  register('StructArrayLayout4i8', StructArrayLayout4i8);
12934
13079
  /**
13080
+ * @internal
12935
13081
  * Implementation of the StructArray layout:
12936
13082
  * [0]: Int16[2]
12937
13083
  * [4]: Int16[4]
@@ -12961,6 +13107,7 @@ class StructArrayLayout2i4i12 extends StructArray {
12961
13107
  StructArrayLayout2i4i12.prototype.bytesPerElement = 12;
12962
13108
  register('StructArrayLayout2i4i12', StructArrayLayout2i4i12);
12963
13109
  /**
13110
+ * @internal
12964
13111
  * Implementation of the StructArray layout:
12965
13112
  * [0]: Int16[2]
12966
13113
  * [4]: Uint8[4]
@@ -12991,6 +13138,7 @@ class StructArrayLayout2i4ub8 extends StructArray {
12991
13138
  StructArrayLayout2i4ub8.prototype.bytesPerElement = 8;
12992
13139
  register('StructArrayLayout2i4ub8', StructArrayLayout2i4ub8);
12993
13140
  /**
13141
+ * @internal
12994
13142
  * Implementation of the StructArray layout:
12995
13143
  * [0]: Float32[2]
12996
13144
  *
@@ -13015,6 +13163,7 @@ class StructArrayLayout2f8 extends StructArray {
13015
13163
  StructArrayLayout2f8.prototype.bytesPerElement = 8;
13016
13164
  register('StructArrayLayout2f8', StructArrayLayout2f8);
13017
13165
  /**
13166
+ * @internal
13018
13167
  * Implementation of the StructArray layout:
13019
13168
  * [0]: Uint16[10]
13020
13169
  *
@@ -13047,6 +13196,7 @@ class StructArrayLayout10ui20 extends StructArray {
13047
13196
  StructArrayLayout10ui20.prototype.bytesPerElement = 20;
13048
13197
  register('StructArrayLayout10ui20', StructArrayLayout10ui20);
13049
13198
  /**
13199
+ * @internal
13050
13200
  * Implementation of the StructArray layout:
13051
13201
  * [0]: Int16[4]
13052
13202
  * [8]: Uint16[4]
@@ -13084,6 +13234,7 @@ class StructArrayLayout4i4ui4i24 extends StructArray {
13084
13234
  StructArrayLayout4i4ui4i24.prototype.bytesPerElement = 24;
13085
13235
  register('StructArrayLayout4i4ui4i24', StructArrayLayout4i4ui4i24);
13086
13236
  /**
13237
+ * @internal
13087
13238
  * Implementation of the StructArray layout:
13088
13239
  * [0]: Float32[3]
13089
13240
  *
@@ -13109,6 +13260,7 @@ class StructArrayLayout3f12 extends StructArray {
13109
13260
  StructArrayLayout3f12.prototype.bytesPerElement = 12;
13110
13261
  register('StructArrayLayout3f12', StructArrayLayout3f12);
13111
13262
  /**
13263
+ * @internal
13112
13264
  * Implementation of the StructArray layout:
13113
13265
  * [0]: Uint32[1]
13114
13266
  *
@@ -13132,6 +13284,7 @@ class StructArrayLayout1ul4 extends StructArray {
13132
13284
  StructArrayLayout1ul4.prototype.bytesPerElement = 4;
13133
13285
  register('StructArrayLayout1ul4', StructArrayLayout1ul4);
13134
13286
  /**
13287
+ * @internal
13135
13288
  * Implementation of the StructArray layout:
13136
13289
  * [0]: Int16[6]
13137
13290
  * [12]: Uint32[1]
@@ -13168,6 +13321,7 @@ class StructArrayLayout6i1ul2ui20 extends StructArray {
13168
13321
  StructArrayLayout6i1ul2ui20.prototype.bytesPerElement = 20;
13169
13322
  register('StructArrayLayout6i1ul2ui20', StructArrayLayout6i1ul2ui20);
13170
13323
  /**
13324
+ * @internal
13171
13325
  * Implementation of the StructArray layout:
13172
13326
  * [0]: Int16[2]
13173
13327
  * [4]: Int16[2]
@@ -13198,6 +13352,7 @@ class StructArrayLayout2i2i2i12 extends StructArray {
13198
13352
  StructArrayLayout2i2i2i12.prototype.bytesPerElement = 12;
13199
13353
  register('StructArrayLayout2i2i2i12', StructArrayLayout2i2i2i12);
13200
13354
  /**
13355
+ * @internal
13201
13356
  * Implementation of the StructArray layout:
13202
13357
  * [0]: Float32[2]
13203
13358
  * [8]: Float32[1]
@@ -13229,6 +13384,7 @@ class StructArrayLayout2f1f2i16 extends StructArray {
13229
13384
  StructArrayLayout2f1f2i16.prototype.bytesPerElement = 16;
13230
13385
  register('StructArrayLayout2f1f2i16', StructArrayLayout2f1f2i16);
13231
13386
  /**
13387
+ * @internal
13232
13388
  * Implementation of the StructArray layout:
13233
13389
  * [0]: Uint8[2]
13234
13390
  * [4]: Float32[2]
@@ -13257,6 +13413,7 @@ class StructArrayLayout2ub2f12 extends StructArray {
13257
13413
  StructArrayLayout2ub2f12.prototype.bytesPerElement = 12;
13258
13414
  register('StructArrayLayout2ub2f12', StructArrayLayout2ub2f12);
13259
13415
  /**
13416
+ * @internal
13260
13417
  * Implementation of the StructArray layout:
13261
13418
  * [0]: Uint16[3]
13262
13419
  *
@@ -13282,6 +13439,7 @@ class StructArrayLayout3ui6 extends StructArray {
13282
13439
  StructArrayLayout3ui6.prototype.bytesPerElement = 6;
13283
13440
  register('StructArrayLayout3ui6', StructArrayLayout3ui6);
13284
13441
  /**
13442
+ * @internal
13285
13443
  * Implementation of the StructArray layout:
13286
13444
  * [0]: Int16[2]
13287
13445
  * [4]: Uint16[2]
@@ -13333,14 +13491,16 @@ class StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48 extends StructArray {
13333
13491
  StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48.prototype.bytesPerElement = 48;
13334
13492
  register('StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48', StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48);
13335
13493
  /**
13494
+ * @internal
13336
13495
  * Implementation of the StructArray layout:
13337
13496
  * [0]: Int16[8]
13338
13497
  * [16]: Uint16[15]
13339
13498
  * [48]: Uint32[1]
13340
- * [52]: Float32[4]
13499
+ * [52]: Float32[2]
13500
+ * [60]: Uint16[2]
13341
13501
  *
13342
13502
  */
13343
- class StructArrayLayout8i15ui1ul4f68 extends StructArray {
13503
+ class StructArrayLayout8i15ui1ul2f2ui64 extends StructArray {
13344
13504
  _refreshViews() {
13345
13505
  this.uint8 = new Uint8Array(this.arrayBuffer);
13346
13506
  this.int16 = new Int16Array(this.arrayBuffer);
@@ -13354,8 +13514,8 @@ class StructArrayLayout8i15ui1ul4f68 extends StructArray {
13354
13514
  return this.emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27);
13355
13515
  }
13356
13516
  emplace(i, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) {
13357
- const o2 = i * 34;
13358
- const o4 = i * 17;
13517
+ const o2 = i * 32;
13518
+ const o4 = i * 16;
13359
13519
  this.int16[o2 + 0] = v0;
13360
13520
  this.int16[o2 + 1] = v1;
13361
13521
  this.int16[o2 + 2] = v2;
@@ -13382,14 +13542,15 @@ class StructArrayLayout8i15ui1ul4f68 extends StructArray {
13382
13542
  this.uint32[o4 + 12] = v23;
13383
13543
  this.float32[o4 + 13] = v24;
13384
13544
  this.float32[o4 + 14] = v25;
13385
- this.float32[o4 + 15] = v26;
13386
- this.float32[o4 + 16] = v27;
13545
+ this.uint16[o2 + 30] = v26;
13546
+ this.uint16[o2 + 31] = v27;
13387
13547
  return i;
13388
13548
  }
13389
13549
  }
13390
- StructArrayLayout8i15ui1ul4f68.prototype.bytesPerElement = 68;
13391
- register('StructArrayLayout8i15ui1ul4f68', StructArrayLayout8i15ui1ul4f68);
13550
+ StructArrayLayout8i15ui1ul2f2ui64.prototype.bytesPerElement = 64;
13551
+ register('StructArrayLayout8i15ui1ul2f2ui64', StructArrayLayout8i15ui1ul2f2ui64);
13392
13552
  /**
13553
+ * @internal
13393
13554
  * Implementation of the StructArray layout:
13394
13555
  * [0]: Float32[1]
13395
13556
  *
@@ -13413,6 +13574,36 @@ class StructArrayLayout1f4 extends StructArray {
13413
13574
  StructArrayLayout1f4.prototype.bytesPerElement = 4;
13414
13575
  register('StructArrayLayout1f4', StructArrayLayout1f4);
13415
13576
  /**
13577
+ * @internal
13578
+ * Implementation of the StructArray layout:
13579
+ * [0]: Uint16[1]
13580
+ * [4]: Float32[2]
13581
+ *
13582
+ */
13583
+ class StructArrayLayout1ui2f12 extends StructArray {
13584
+ _refreshViews() {
13585
+ this.uint8 = new Uint8Array(this.arrayBuffer);
13586
+ this.uint16 = new Uint16Array(this.arrayBuffer);
13587
+ this.float32 = new Float32Array(this.arrayBuffer);
13588
+ }
13589
+ emplaceBack(v0, v1, v2) {
13590
+ const i = this.length;
13591
+ this.resize(i + 1);
13592
+ return this.emplace(i, v0, v1, v2);
13593
+ }
13594
+ emplace(i, v0, v1, v2) {
13595
+ const o2 = i * 6;
13596
+ const o4 = i * 3;
13597
+ this.uint16[o2 + 0] = v0;
13598
+ this.float32[o4 + 1] = v1;
13599
+ this.float32[o4 + 2] = v2;
13600
+ return i;
13601
+ }
13602
+ }
13603
+ StructArrayLayout1ui2f12.prototype.bytesPerElement = 12;
13604
+ register('StructArrayLayout1ui2f12', StructArrayLayout1ui2f12);
13605
+ /**
13606
+ * @internal
13416
13607
  * Implementation of the StructArray layout:
13417
13608
  * [0]: Uint32[1]
13418
13609
  * [4]: Uint16[2]
@@ -13441,6 +13632,7 @@ class StructArrayLayout1ul2ui8 extends StructArray {
13441
13632
  StructArrayLayout1ul2ui8.prototype.bytesPerElement = 8;
13442
13633
  register('StructArrayLayout1ul2ui8', StructArrayLayout1ul2ui8);
13443
13634
  /**
13635
+ * @internal
13444
13636
  * Implementation of the StructArray layout:
13445
13637
  * [0]: Uint16[2]
13446
13638
  *
@@ -13465,6 +13657,7 @@ class StructArrayLayout2ui4 extends StructArray {
13465
13657
  StructArrayLayout2ui4.prototype.bytesPerElement = 4;
13466
13658
  register('StructArrayLayout2ui4', StructArrayLayout2ui4);
13467
13659
  /**
13660
+ * @internal
13468
13661
  * Implementation of the StructArray layout:
13469
13662
  * [0]: Uint16[1]
13470
13663
  *
@@ -13488,6 +13681,7 @@ class StructArrayLayout1ui2 extends StructArray {
13488
13681
  StructArrayLayout1ui2.prototype.bytesPerElement = 2;
13489
13682
  register('StructArrayLayout1ui2', StructArrayLayout1ui2);
13490
13683
  /**
13684
+ * @internal
13491
13685
  * Implementation of the StructArray layout:
13492
13686
  * [0]: Float32[4]
13493
13687
  *
@@ -13513,7 +13707,7 @@ class StructArrayLayout4f16 extends StructArray {
13513
13707
  }
13514
13708
  StructArrayLayout4f16.prototype.bytesPerElement = 16;
13515
13709
  register('StructArrayLayout4f16', StructArrayLayout4f16);
13516
- /** */
13710
+ /** @internal */
13517
13711
  class CollisionBoxStruct extends Struct {
13518
13712
  get anchorPointX() { return this._structArray.int16[this._pos2 + 0]; }
13519
13713
  get anchorPointY() { return this._structArray.int16[this._pos2 + 1]; }
@@ -13527,7 +13721,7 @@ class CollisionBoxStruct extends Struct {
13527
13721
  get anchorPoint() { return new Point$2(this.anchorPointX, this.anchorPointY); }
13528
13722
  }
13529
13723
  CollisionBoxStruct.prototype.size = 20;
13530
- /** */
13724
+ /** @internal */
13531
13725
  class CollisionBoxArray extends StructArrayLayout6i1ul2ui20 {
13532
13726
  /**
13533
13727
  * Return the CollisionBoxStruct at the given location in the array.
@@ -13538,7 +13732,7 @@ class CollisionBoxArray extends StructArrayLayout6i1ul2ui20 {
13538
13732
  }
13539
13733
  }
13540
13734
  register('CollisionBoxArray', CollisionBoxArray);
13541
- /** */
13735
+ /** @internal */
13542
13736
  class PlacedSymbolStruct extends Struct {
13543
13737
  get anchorX() { return this._structArray.int16[this._pos2 + 0]; }
13544
13738
  get anchorY() { return this._structArray.int16[this._pos2 + 1]; }
@@ -13562,7 +13756,7 @@ class PlacedSymbolStruct extends Struct {
13562
13756
  get associatedIconIndex() { return this._structArray.int16[this._pos2 + 22]; }
13563
13757
  }
13564
13758
  PlacedSymbolStruct.prototype.size = 48;
13565
- /** */
13759
+ /** @internal */
13566
13760
  class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48 {
13567
13761
  /**
13568
13762
  * Return the PlacedSymbolStruct at the given location in the array.
@@ -13573,7 +13767,7 @@ class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48 {
13573
13767
  }
13574
13768
  }
13575
13769
  register('PlacedSymbolArray', PlacedSymbolArray);
13576
- /** */
13770
+ /** @internal */
13577
13771
  class SymbolInstanceStruct extends Struct {
13578
13772
  get anchorX() { return this._structArray.int16[this._pos2 + 0]; }
13579
13773
  get anchorY() { return this._structArray.int16[this._pos2 + 1]; }
@@ -13601,13 +13795,13 @@ class SymbolInstanceStruct extends Struct {
13601
13795
  get crossTileID() { return this._structArray.uint32[this._pos4 + 12]; }
13602
13796
  set crossTileID(x) { this._structArray.uint32[this._pos4 + 12] = x; }
13603
13797
  get textBoxScale() { return this._structArray.float32[this._pos4 + 13]; }
13604
- get textOffset0() { return this._structArray.float32[this._pos4 + 14]; }
13605
- get textOffset1() { return this._structArray.float32[this._pos4 + 15]; }
13606
- get collisionCircleDiameter() { return this._structArray.float32[this._pos4 + 16]; }
13798
+ get collisionCircleDiameter() { return this._structArray.float32[this._pos4 + 14]; }
13799
+ get textAnchorOffsetStartIndex() { return this._structArray.uint16[this._pos2 + 30]; }
13800
+ get textAnchorOffsetEndIndex() { return this._structArray.uint16[this._pos2 + 31]; }
13607
13801
  }
13608
- SymbolInstanceStruct.prototype.size = 68;
13609
- /** */
13610
- class SymbolInstanceArray extends StructArrayLayout8i15ui1ul4f68 {
13802
+ SymbolInstanceStruct.prototype.size = 64;
13803
+ /** @internal */
13804
+ class SymbolInstanceArray extends StructArrayLayout8i15ui1ul2f2ui64 {
13611
13805
  /**
13612
13806
  * Return the SymbolInstanceStruct at the given location in the array.
13613
13807
  * @param index The index of the element.
@@ -13617,26 +13811,44 @@ class SymbolInstanceArray extends StructArrayLayout8i15ui1ul4f68 {
13617
13811
  }
13618
13812
  }
13619
13813
  register('SymbolInstanceArray', SymbolInstanceArray);
13620
- /** */
13814
+ /** @internal */
13621
13815
  class GlyphOffsetArray extends StructArrayLayout1f4 {
13622
13816
  getoffsetX(index) { return this.float32[index * 1 + 0]; }
13623
13817
  }
13624
13818
  register('GlyphOffsetArray', GlyphOffsetArray);
13625
- /** */
13819
+ /** @internal */
13626
13820
  class SymbolLineVertexArray extends StructArrayLayout3i6 {
13627
13821
  getx(index) { return this.int16[index * 3 + 0]; }
13628
13822
  gety(index) { return this.int16[index * 3 + 1]; }
13629
13823
  gettileUnitDistanceFromAnchor(index) { return this.int16[index * 3 + 2]; }
13630
13824
  }
13631
13825
  register('SymbolLineVertexArray', SymbolLineVertexArray);
13632
- /** */
13826
+ /** @internal */
13827
+ class TextAnchorOffsetStruct extends Struct {
13828
+ get textAnchor() { return this._structArray.uint16[this._pos2 + 0]; }
13829
+ get textOffset0() { return this._structArray.float32[this._pos4 + 1]; }
13830
+ get textOffset1() { return this._structArray.float32[this._pos4 + 2]; }
13831
+ }
13832
+ TextAnchorOffsetStruct.prototype.size = 12;
13833
+ /** @internal */
13834
+ class TextAnchorOffsetArray extends StructArrayLayout1ui2f12 {
13835
+ /**
13836
+ * Return the TextAnchorOffsetStruct at the given location in the array.
13837
+ * @param index The index of the element.
13838
+ */
13839
+ get(index) {
13840
+ return new TextAnchorOffsetStruct(this, index);
13841
+ }
13842
+ }
13843
+ register('TextAnchorOffsetArray', TextAnchorOffsetArray);
13844
+ /** @internal */
13633
13845
  class FeatureIndexStruct extends Struct {
13634
13846
  get featureIndex() { return this._structArray.uint32[this._pos4 + 0]; }
13635
13847
  get sourceLayerIndex() { return this._structArray.uint16[this._pos2 + 2]; }
13636
13848
  get bucketIndex() { return this._structArray.uint16[this._pos2 + 3]; }
13637
13849
  }
13638
13850
  FeatureIndexStruct.prototype.size = 8;
13639
- /** */
13851
+ /** @internal */
13640
13852
  class FeatureIndexArray extends StructArrayLayout1ul2ui8 {
13641
13853
  /**
13642
13854
  * Return the FeatureIndexStruct at the given location in the array.
@@ -13694,6 +13906,7 @@ const layout$6 = createLayout([
13694
13906
  const { members: members$4, size: size$4, alignment: alignment$4 } = layout$6;
13695
13907
 
13696
13908
  /**
13909
+ * @internal
13697
13910
  * Used for calculations on vector segments
13698
13911
  */
13699
13912
  class SegmentVector {
@@ -14022,6 +14235,7 @@ function swap$2(arr, i, j) {
14022
14235
  register('FeaturePositionMap', FeaturePositionMap);
14023
14236
 
14024
14237
  /**
14238
+ * @internal
14025
14239
  * A base uniform abstract class
14026
14240
  */
14027
14241
  class Uniform {
@@ -14348,6 +14562,7 @@ class CrossFadedCompositeBinder {
14348
14562
  }
14349
14563
  }
14350
14564
  /**
14565
+ * @internal
14351
14566
  * ProgramConfiguration contains the logic for binding style layer properties and tile
14352
14567
  * layer feature data into GL program uniforms and vertex attributes.
14353
14568
  *
@@ -14703,6 +14918,7 @@ function addCircleVertex(layoutVertexArray, x, y, extrudeX, extrudeY) {
14703
14918
  layoutVertexArray.emplaceBack((x * 2) + ((extrudeX + 1) / 2), (y * 2) + ((extrudeY + 1) / 2));
14704
14919
  }
14705
14920
  /**
14921
+ * @internal
14706
14922
  * Circles are represented by two triangles.
14707
14923
  *
14708
14924
  * Each corner has a pos that is the center of the circle and an extrusion
@@ -22872,6 +23088,7 @@ function copyImage(srcImg, dstImg, srcPt, dstPt, size, channels) {
22872
23088
  return dstImg;
22873
23089
  }
22874
23090
  /**
23091
+ * @internal
22875
23092
  * An image with alpha color value
22876
23093
  */
22877
23094
  class AlphaImage {
@@ -24789,6 +25006,7 @@ const LINE_DISTANCE_SCALE = 1 / 2;
24789
25006
  // The maximum line distance, in tile units, that fits in the buffer.
24790
25007
  const MAX_LINE_DISTANCE = Math.pow(2, LINE_DISTANCE_BUFFER_BITS - 1) / LINE_DISTANCE_SCALE;
24791
25008
  /**
25009
+ * @internal
24792
25010
  * Line bucket class
24793
25011
  */
24794
25012
  class LineBucket {
@@ -25388,8 +25606,9 @@ const symbolInstance = createLayout([
25388
25606
  { type: 'Uint16', name: 'useRuntimeCollisionCircles' },
25389
25607
  { type: 'Uint32', name: 'crossTileID' },
25390
25608
  { type: 'Float32', name: 'textBoxScale' },
25391
- { type: 'Float32', components: 2, name: 'textOffset' },
25392
25609
  { type: 'Float32', name: 'collisionCircleDiameter' },
25610
+ { type: 'Uint16', name: 'textAnchorOffsetStartIndex' },
25611
+ { type: 'Uint16', name: 'textAnchorOffsetEndIndex' }
25393
25612
  ]);
25394
25613
  const glyphOffset = createLayout([
25395
25614
  { type: 'Float32', name: 'offsetX' }
@@ -25399,6 +25618,10 @@ const lineVertex = createLayout([
25399
25618
  { type: 'Int16', name: 'y' },
25400
25619
  { type: 'Int16', name: 'tileUnitDistanceFromAnchor' }
25401
25620
  ]);
25621
+ const textAnchorOffset = createLayout([
25622
+ { type: 'Uint16', name: 'textAnchor' },
25623
+ { type: 'Float32', components: 2, name: 'textOffset' }
25624
+ ]);
25402
25625
 
25403
25626
  function transformTextInternal(text, layer, feature) {
25404
25627
  const transform = layer.layout.get('text-transform').evaluate(feature, {});
@@ -26492,6 +26715,7 @@ class ImagePosition {
26492
26715
  }
26493
26716
  }
26494
26717
  /**
26718
+ * @internal
26495
26719
  * A class holding all the images
26496
26720
  */
26497
26721
  class ImageAtlas {
@@ -27317,6 +27541,7 @@ class CollisionBuffers {
27317
27541
  }
27318
27542
  register('CollisionBuffers', CollisionBuffers);
27319
27543
  /**
27544
+ * @internal
27320
27545
  * Unlike other buckets, which simply implement #addFeature with type-specific
27321
27546
  * logic for (essentially) triangulating feature geometries, SymbolBucket
27322
27547
  * requires specialized behavior:
@@ -27389,6 +27614,7 @@ class SymbolBucket {
27389
27614
  this.glyphOffsetArray = new GlyphOffsetArray();
27390
27615
  this.lineVertexArray = new SymbolLineVertexArray();
27391
27616
  this.symbolInstances = new SymbolInstanceArray();
27617
+ this.textAnchorOffsets = new TextAnchorOffsetArray();
27392
27618
  }
27393
27619
  calculateGlyphDependencies(text, stack, textAlongLine, allowVerticalPlacement, doesAllowVerticalWritingMode) {
27394
27620
  for (let i = 0; i < text.length; i++) {
@@ -27866,6 +28092,7 @@ const getLayout = () => layout = layout || new Properties({
27866
28092
  "text-justify": new DataDrivenProperty(v8Spec["layout_symbol"]["text-justify"]),
27867
28093
  "text-radial-offset": new DataDrivenProperty(v8Spec["layout_symbol"]["text-radial-offset"]),
27868
28094
  "text-variable-anchor": new DataConstantProperty(v8Spec["layout_symbol"]["text-variable-anchor"]),
28095
+ "text-variable-anchor-offset": new DataDrivenProperty(v8Spec["layout_symbol"]["text-variable-anchor-offset"]),
27869
28096
  "text-anchor": new DataDrivenProperty(v8Spec["layout_symbol"]["text-anchor"]),
27870
28097
  "text-max-angle": new DataConstantProperty(v8Spec["layout_symbol"]["text-max-angle"]),
27871
28098
  "text-writing-mode": new DataConstantProperty(v8Spec["layout_symbol"]["text-writing-mode"]),
@@ -28788,6 +29015,7 @@ class CanonicalTileID {
28788
29015
  }
28789
29016
  }
28790
29017
  /**
29018
+ * @internal
28791
29019
  * An unwrapped tile identifier
28792
29020
  */
28793
29021
  class UnwrappedTileID {
@@ -29090,6 +29318,7 @@ class GeoJSONFeature {
29090
29318
  }
29091
29319
 
29092
29320
  /**
29321
+ * @internal
29093
29322
  * An in memory index class to allow fast interaction with features
29094
29323
  */
29095
29324
  class FeatureIndex {
@@ -29995,6 +30224,18 @@ function getCentroidCell(polygon) {
29995
30224
  return new Cell(x / area, y / area, 0, polygon);
29996
30225
  }
29997
30226
 
30227
+ exports.TextAnchorEnum = void 0;
30228
+ (function (TextAnchorEnum) {
30229
+ TextAnchorEnum[TextAnchorEnum["center"] = 1] = "center";
30230
+ TextAnchorEnum[TextAnchorEnum["left"] = 2] = "left";
30231
+ TextAnchorEnum[TextAnchorEnum["right"] = 3] = "right";
30232
+ TextAnchorEnum[TextAnchorEnum["top"] = 4] = "top";
30233
+ TextAnchorEnum[TextAnchorEnum["bottom"] = 5] = "bottom";
30234
+ TextAnchorEnum[TextAnchorEnum["top-left"] = 6] = "top-left";
30235
+ TextAnchorEnum[TextAnchorEnum["top-right"] = 7] = "top-right";
30236
+ TextAnchorEnum[TextAnchorEnum["bottom-left"] = 8] = "bottom-left";
30237
+ TextAnchorEnum[TextAnchorEnum["bottom-right"] = 9] = "bottom-right";
30238
+ })(exports.TextAnchorEnum || (exports.TextAnchorEnum = {}));
29998
30239
  // The radial offset is to the edge of the text box
29999
30240
  // In the horizontal direction, the edge of the text box is where glyphs start
30000
30241
  // But in the vertical direction, the glyphs appear to "start" at the baseline
@@ -30076,14 +30317,60 @@ function evaluateVariableOffset(anchor, offset) {
30076
30317
  }
30077
30318
  return (offset[1] !== INVALID_TEXT_OFFSET) ? fromTextOffset(anchor, offset[0], offset[1]) : fromRadialOffset(anchor, offset[0]);
30078
30319
  }
30320
+ // Helper to support both text-variable-anchor and text-variable-anchor-offset. Offset values converted from EMs to PXs
30321
+ function getTextVariableAnchorOffset(layer, feature, canonical) {
30322
+ var _a;
30323
+ const layout = layer.layout;
30324
+ // If style specifies text-variable-anchor-offset, just return it
30325
+ const variableAnchorOffset = (_a = layout.get('text-variable-anchor-offset')) === null || _a === void 0 ? void 0 : _a.evaluate(feature, {}, canonical);
30326
+ if (variableAnchorOffset) {
30327
+ const sourceValues = variableAnchorOffset.values;
30328
+ const destValues = [];
30329
+ // Convert offsets from EM to PX, and apply baseline shift
30330
+ for (let i = 0; i < sourceValues.length; i += 2) {
30331
+ const anchor = destValues[i] = sourceValues[i];
30332
+ const offset = sourceValues[i + 1].map(t => t * ONE_EM);
30333
+ if (anchor.startsWith('top')) {
30334
+ offset[1] -= baselineOffset;
30335
+ }
30336
+ else if (anchor.startsWith('bottom')) {
30337
+ offset[1] += baselineOffset;
30338
+ }
30339
+ destValues[i + 1] = offset;
30340
+ }
30341
+ return new VariableAnchorOffsetCollection(destValues);
30342
+ }
30343
+ // If style specifies text-variable-anchor, convert to the new format
30344
+ const variableAnchor = layout.get('text-variable-anchor');
30345
+ if (variableAnchor) {
30346
+ let textOffset;
30347
+ const unevaluatedLayout = layer._unevaluatedLayout;
30348
+ // The style spec says don't use `text-offset` and `text-radial-offset` together
30349
+ // but doesn't actually specify what happens if you use both. We go with the radial offset.
30350
+ if (unevaluatedLayout.getValue('text-radial-offset') !== undefined) {
30351
+ textOffset = [layout.get('text-radial-offset').evaluate(feature, {}, canonical) * ONE_EM, INVALID_TEXT_OFFSET];
30352
+ }
30353
+ else {
30354
+ textOffset = layout.get('text-offset').evaluate(feature, {}, canonical).map(t => t * ONE_EM);
30355
+ }
30356
+ const anchorOffsets = [];
30357
+ for (const anchor of variableAnchor) {
30358
+ anchorOffsets.push(anchor, evaluateVariableOffset(anchor, textOffset));
30359
+ }
30360
+ return new VariableAnchorOffsetCollection(anchorOffsets);
30361
+ }
30362
+ return null;
30363
+ }
30364
+
30079
30365
  function performSymbolLayout(args) {
30080
30366
  args.bucket.createArrays();
30081
30367
  const tileSize = 512 * args.bucket.overscaling;
30082
30368
  args.bucket.tilePixelRatio = EXTENT / tileSize;
30083
30369
  args.bucket.compareText = {};
30084
30370
  args.bucket.iconsNeedLinear = false;
30085
- const layout = args.bucket.layers[0].layout;
30086
- const unevaluatedLayoutValues = args.bucket.layers[0]._unevaluatedLayout._values;
30371
+ const layer = args.bucket.layers[0];
30372
+ const layout = layer.layout;
30373
+ const unevaluatedLayoutValues = layer._unevaluatedLayout._values;
30087
30374
  const sizes = {
30088
30375
  // Filled in below, if *SizeData.kind is 'composite'
30089
30376
  // compositeIconSizes: undefined,
@@ -30126,8 +30413,8 @@ function performSymbolLayout(args) {
30126
30413
  const spacing = layout.get('text-letter-spacing').evaluate(feature, {}, args.canonical) * ONE_EM;
30127
30414
  const spacingIfAllowed = allowsLetterSpacing(unformattedText) ? spacing : 0;
30128
30415
  const textAnchor = layout.get('text-anchor').evaluate(feature, {}, args.canonical);
30129
- const variableTextAnchor = layout.get('text-variable-anchor');
30130
- if (!variableTextAnchor) {
30416
+ const variableAnchorOffset = getTextVariableAnchorOffset(layer, feature, args.canonical);
30417
+ if (!variableAnchorOffset) {
30131
30418
  const radialOffset = layout.get('text-radial-offset').evaluate(feature, {}, args.canonical);
30132
30419
  // Layers with variable anchors use the `text-radial-offset` property and the [x, y] offset vector
30133
30420
  // is calculated at placement time instead of layout time
@@ -30156,13 +30443,18 @@ function performSymbolLayout(args) {
30156
30443
  }
30157
30444
  };
30158
30445
  // If this layer uses text-variable-anchor, generate shapings for all justification possibilities.
30159
- if (!textAlongLine && variableTextAnchor) {
30160
- const justifications = textJustify === 'auto' ?
30161
- variableTextAnchor.map(a => getAnchorJustification(a)) :
30162
- [textJustify];
30446
+ if (!textAlongLine && variableAnchorOffset) {
30447
+ const justifications = new Set();
30448
+ if (textJustify === 'auto') {
30449
+ for (let i = 0; i < variableAnchorOffset.values.length; i += 2) {
30450
+ justifications.add(getAnchorJustification(variableAnchorOffset.values[i]));
30451
+ }
30452
+ }
30453
+ else {
30454
+ justifications.add(textJustify);
30455
+ }
30163
30456
  let singleLine = false;
30164
- for (let i = 0; i < justifications.length; i++) {
30165
- const justification = justifications[i];
30457
+ for (const justification of justifications) {
30166
30458
  if (shapedTextOrientations.horizontal[justification])
30167
30459
  continue;
30168
30460
  if (singleLine) {
@@ -30327,6 +30619,18 @@ function addFeature(bucket, feature, shapedTextOrientations, shapedIcon, imageMa
30327
30619
  }
30328
30620
  }
30329
30621
  }
30622
+ function addTextVariableAnchorOffsets(textAnchorOffsets, variableAnchorOffset) {
30623
+ const startIndex = textAnchorOffsets.length;
30624
+ const values = variableAnchorOffset === null || variableAnchorOffset === void 0 ? void 0 : variableAnchorOffset.values;
30625
+ if ((values === null || values === void 0 ? void 0 : values.length) > 0) {
30626
+ for (let i = 0; i < values.length; i += 2) {
30627
+ const anchor = exports.TextAnchorEnum[values[i]];
30628
+ const offset = values[i + 1];
30629
+ textAnchorOffsets.emplaceBack(anchor, offset[0], offset[1]);
30630
+ }
30631
+ }
30632
+ return [startIndex, textAnchorOffsets.length];
30633
+ }
30330
30634
  function addTextVertices(bucket, anchor, shapedText, imageMap, layer, textAlongLine, feature, textOffset, lineArray, writingMode, placementTypes, placedTextSymbolIndices, placedIconIndex, sizes, canonical) {
30331
30635
  const glyphQuads = getGlyphQuads(anchor, shapedText, textOffset, layer, textAlongLine, feature, imageMap, bucket.allowVerticalPlacement);
30332
30636
  const sizeData = bucket.textSizeData;
@@ -30378,15 +30682,6 @@ function addSymbol(bucket, anchor, line, shapedTextOrientations, shapedIcon, ima
30378
30682
  let verticalPlacedIconSymbolIndex = -1;
30379
30683
  const placedTextSymbolIndices = {};
30380
30684
  let key = murmur3$1('');
30381
- let textOffset0 = 0;
30382
- let textOffset1 = 0;
30383
- if (layer._unevaluatedLayout.getValue('text-radial-offset') === undefined) {
30384
- [textOffset0, textOffset1] = layer.layout.get('text-offset').evaluate(feature, {}, canonical).map(t => t * ONE_EM);
30385
- }
30386
- else {
30387
- textOffset0 = layer.layout.get('text-radial-offset').evaluate(feature, {}, canonical) * ONE_EM;
30388
- textOffset1 = INVALID_TEXT_OFFSET;
30389
- }
30390
30685
  if (bucket.allowVerticalPlacement && shapedTextOrientations.vertical) {
30391
30686
  const textRotation = layer.layout.get('text-rotate').evaluate(feature, {}, canonical);
30392
30687
  const verticalTextRotation = textRotation + 90.0;
@@ -30487,7 +30782,9 @@ function addSymbol(bucket, anchor, line, shapedTextOrientations, shapedIcon, ima
30487
30782
  if (feature.sortKey !== undefined) {
30488
30783
  bucket.addToSortKeyRanges(bucket.symbolInstances.length, feature.sortKey);
30489
30784
  }
30490
- bucket.symbolInstances.emplaceBack(anchor.x, anchor.y, placedTextSymbolIndices.right >= 0 ? placedTextSymbolIndices.right : -1, placedTextSymbolIndices.center >= 0 ? placedTextSymbolIndices.center : -1, placedTextSymbolIndices.left >= 0 ? placedTextSymbolIndices.left : -1, placedTextSymbolIndices.vertical || -1, placedIconSymbolIndex, verticalPlacedIconSymbolIndex, key, textBoxStartIndex, textBoxEndIndex, verticalTextBoxStartIndex, verticalTextBoxEndIndex, iconBoxStartIndex, iconBoxEndIndex, verticalIconBoxStartIndex, verticalIconBoxEndIndex, featureIndex, numHorizontalGlyphVertices, numVerticalGlyphVertices, numIconVertices, numVerticalIconVertices, useRuntimeCollisionCircles, 0, textBoxScale, textOffset0, textOffset1, collisionCircleDiameter);
30785
+ const variableAnchorOffset = getTextVariableAnchorOffset(layer, feature, canonical);
30786
+ const [textAnchorOffsetStartIndex, textAnchorOffsetEndIndex] = addTextVariableAnchorOffsets(bucket.textAnchorOffsets, variableAnchorOffset);
30787
+ bucket.symbolInstances.emplaceBack(anchor.x, anchor.y, placedTextSymbolIndices.right >= 0 ? placedTextSymbolIndices.right : -1, placedTextSymbolIndices.center >= 0 ? placedTextSymbolIndices.center : -1, placedTextSymbolIndices.left >= 0 ? placedTextSymbolIndices.left : -1, placedTextSymbolIndices.vertical || -1, placedIconSymbolIndex, verticalPlacedIconSymbolIndex, key, textBoxStartIndex, textBoxEndIndex, verticalTextBoxStartIndex, verticalTextBoxEndIndex, iconBoxStartIndex, iconBoxEndIndex, verticalIconBoxStartIndex, verticalIconBoxEndIndex, featureIndex, numHorizontalGlyphVertices, numVerticalGlyphVertices, numIconVertices, numVerticalIconVertices, useRuntimeCollisionCircles, 0, textBoxScale, collisionCircleDiameter, textAnchorOffsetStartIndex, textAnchorOffsetEndIndex);
30491
30788
  }
30492
30789
  function anchorIsTooClose(bucket, text, repeatDistance, anchor) {
30493
30790
  const compareText = bucket.compareText;
@@ -30893,9 +31190,8 @@ const PerformanceUtils = {
30893
31190
  }
30894
31191
  };
30895
31192
  /**
31193
+ * @internal
30896
31194
  * Safe wrapper for the performance resource timing API in web workers with graceful degradation
30897
- *
30898
- * @hidden
30899
31195
  */
30900
31196
  class RequestPerformance {
30901
31197
  constructor(request) {
@@ -31010,7 +31306,6 @@ exports.emptyStyle = emptyStyle;
31010
31306
  exports.equals = equals$6;
31011
31307
  exports.evaluateSizeForFeature = evaluateSizeForFeature;
31012
31308
  exports.evaluateSizeForZoom = evaluateSizeForZoom;
31013
- exports.evaluateVariableOffset = evaluateVariableOffset;
31014
31309
  exports.evented = evented;
31015
31310
  exports.extend = extend;
31016
31311
  exports.filterObject = filterObject;
@@ -31404,6 +31699,7 @@ class VectorTileWorkerSource {
31404
31699
  this.layerIndex = layerIndex;
31405
31700
  this.availableImages = availableImages;
31406
31701
  this.loadVectorData = loadVectorData || loadVectorTile;
31702
+ this.fetching = {};
31407
31703
  this.loading = {};
31408
31704
  this.loaded = {};
31409
31705
  }
@@ -31442,6 +31738,7 @@ class VectorTileWorkerSource {
31442
31738
  }
31443
31739
  workerTile.vectorTile = response.vectorTile;
31444
31740
  workerTile.parse(response.vectorTile, this.layerIndex, this.availableImages, this.actor, (err, result) => {
31741
+ delete this.fetching[uid];
31445
31742
  if (err || !result)
31446
31743
  return callback(err);
31447
31744
  // Transferring a copy of rawTileData because the worker needs to retain its copy.
@@ -31449,6 +31746,8 @@ class VectorTileWorkerSource {
31449
31746
  });
31450
31747
  this.loaded = this.loaded || {};
31451
31748
  this.loaded[uid] = workerTile;
31749
+ // keep the original fetching state so that reload tile can pick it up if the original parse is cancelled by reloads' parse
31750
+ this.fetching[uid] = { rawTileData, cacheControl, resourceTiming };
31452
31751
  });
31453
31752
  }
31454
31753
  /**
@@ -31461,7 +31760,21 @@ class VectorTileWorkerSource {
31461
31760
  const workerTile = loaded[uid];
31462
31761
  workerTile.showCollisionBoxes = params.showCollisionBoxes;
31463
31762
  if (workerTile.status === 'parsing') {
31464
- workerTile.parse(workerTile.vectorTile, this.layerIndex, this.availableImages, this.actor, callback);
31763
+ workerTile.parse(workerTile.vectorTile, this.layerIndex, this.availableImages, this.actor, (err, result) => {
31764
+ if (err || !result)
31765
+ return callback(err, result);
31766
+ // if we have cancelled the original parse, make sure to pass the rawTileData from the original fetch
31767
+ let parseResult;
31768
+ if (this.fetching[uid]) {
31769
+ const { rawTileData, cacheControl, resourceTiming } = this.fetching[uid];
31770
+ delete this.fetching[uid];
31771
+ parseResult = performance.extend({ rawTileData: rawTileData.slice(0) }, result, cacheControl, resourceTiming);
31772
+ }
31773
+ else {
31774
+ parseResult = result;
31775
+ }
31776
+ callback(null, parseResult);
31777
+ });
31465
31778
  }
31466
31779
  else if (workerTile.status === 'done') {
31467
31780
  // if there was no vector tile data on the initial load, don't try and re-parse tile
@@ -33716,7 +34029,7 @@ define(['./shared'], (function (performance) { 'use strict';
33716
34029
 
33717
34030
  var name = "maplibre-gl";
33718
34031
  var description = "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library";
33719
- var version$2 = "3.2.1";
34032
+ var version$2 = "3.3.0";
33720
34033
  var main = "dist/maplibre-gl.js";
33721
34034
  var style = "dist/maplibre-gl.css";
33722
34035
  var license = "BSD-3-Clause";
@@ -33735,7 +34048,7 @@ var dependencies = {
33735
34048
  "@mapbox/unitbezier": "^0.0.1",
33736
34049
  "@mapbox/vector-tile": "^1.3.1",
33737
34050
  "@mapbox/whoots-js": "^3.1.0",
33738
- "@maplibre/maplibre-gl-style-spec": "^19.2.2",
34051
+ "@maplibre/maplibre-gl-style-spec": "^19.3.0",
33739
34052
  "@types/geojson": "^7946.0.10",
33740
34053
  "@types/mapbox__point-geometry": "^0.1.2",
33741
34054
  "@types/mapbox__vector-tile": "^1.3.0",
@@ -33769,7 +34082,7 @@ var devDependencies = {
33769
34082
  "@types/d3": "^7.4.0",
33770
34083
  "@types/diff": "^5.0.3",
33771
34084
  "@types/earcut": "^2.1.1",
33772
- "@types/eslint": "^8.44.0",
34085
+ "@types/eslint": "^8.44.2",
33773
34086
  "@types/gl": "^6.0.2",
33774
34087
  "@types/glob": "^8.1.0",
33775
34088
  "@types/jest": "^29.5.3",
@@ -33777,40 +34090,40 @@ var devDependencies = {
33777
34090
  "@types/minimist": "^1.2.2",
33778
34091
  "@types/murmurhash-js": "^1.0.4",
33779
34092
  "@types/nise": "^1.4.1",
33780
- "@types/node": "^20.4.4",
34093
+ "@types/node": "^20.4.8",
33781
34094
  "@types/offscreencanvas": "^2019.7.0",
33782
34095
  "@types/pixelmatch": "^5.2.4",
33783
34096
  "@types/pngjs": "^6.0.1",
33784
- "@types/react": "^18.2.15",
34097
+ "@types/react": "^18.2.18",
33785
34098
  "@types/react-dom": "^18.2.7",
33786
34099
  "@types/request": "^2.48.8",
33787
34100
  "@types/shuffle-seed": "^1.1.0",
33788
34101
  "@types/window-or-global": "^1.0.4",
33789
- "@typescript-eslint/eslint-plugin": "^5.61.0",
33790
- "@typescript-eslint/parser": "^5.62.0",
34102
+ "@typescript-eslint/eslint-plugin": "^6.2.1",
34103
+ "@typescript-eslint/parser": "^6.2.1",
33791
34104
  address: "^1.2.2",
33792
34105
  benchmark: "^2.1.4",
33793
34106
  canvas: "^2.11.2",
33794
34107
  cssnano: "^6.0.1",
33795
34108
  d3: "^7.8.5",
33796
34109
  "d3-queue": "^3.0.7",
33797
- "devtools-protocol": "^0.0.1170846",
34110
+ "devtools-protocol": "^0.0.1179426",
33798
34111
  diff: "^5.1.0",
33799
34112
  "dts-bundle-generator": "^8.0.1",
33800
- eslint: "^8.45.0",
34113
+ eslint: "^8.46.0",
33801
34114
  "eslint-config-mourner": "^3.0.0",
33802
34115
  "eslint-plugin-html": "^7.1.0",
33803
- "eslint-plugin-import": "^2.27.5",
34116
+ "eslint-plugin-import": "^2.28.0",
33804
34117
  "eslint-plugin-jest": "^27.2.3",
34118
+ "eslint-plugin-react": "^7.33.1",
33805
34119
  "eslint-plugin-tsdoc": "0.2.17",
33806
- "eslint-plugin-react": "^7.33.0",
33807
- expect: "^29.5.0",
34120
+ expect: "^29.6.2",
33808
34121
  gl: "^6.0.2",
33809
34122
  glob: "^10.3.3",
33810
34123
  "is-builtin-module": "^3.2.1",
33811
- jest: "^29.6.1",
34124
+ jest: "^29.6.2",
33812
34125
  "jest-canvas-mock": "^2.5.2",
33813
- "jest-environment-jsdom": "^29.6.1",
34126
+ "jest-environment-jsdom": "^29.6.2",
33814
34127
  jsdom: "^22.1.0",
33815
34128
  "json-stringify-pretty-compact": "^4.0.0",
33816
34129
  minimist: "^1.2.8",
@@ -33822,14 +34135,14 @@ var devDependencies = {
33822
34135
  "pdf-merger-js": "^4.3.0",
33823
34136
  pixelmatch: "^5.3.0",
33824
34137
  pngjs: "^7.0.0",
33825
- postcss: "^8.4.26",
34138
+ postcss: "^8.4.27",
33826
34139
  "postcss-cli": "^10.1.0",
33827
34140
  "postcss-inline-svg": "^6.0.0",
33828
34141
  "pretty-bytes": "^6.1.1",
33829
- puppeteer: "^20.9.0",
34142
+ puppeteer: "^21.0.1",
33830
34143
  react: "^18.2.0",
33831
34144
  "react-dom": "^18.2.0",
33832
- rollup: "^3.26.3",
34145
+ rollup: "^3.27.2",
33833
34146
  "rollup-plugin-sourcemaps": "^0.6.3",
33834
34147
  rw: "^1.3.3",
33835
34148
  semver: "^7.5.4",
@@ -33840,10 +34153,10 @@ var devDependencies = {
33840
34153
  "stylelint-config-standard": "^34.0.0",
33841
34154
  "ts-jest": "^29.1.1",
33842
34155
  "ts-node": "^10.9.1",
33843
- tslib: "^2.6.0",
34156
+ tslib: "^2.6.1",
33844
34157
  typedoc: "^0.24.8",
33845
- "typedoc-plugin-markdown": "^3.15.3",
33846
- "typedoc-plugin-missing-exports": "^2.0.0",
34158
+ "typedoc-plugin-markdown": "^3.15.4",
34159
+ "typedoc-plugin-missing-exports": "^2.0.1",
33847
34160
  typescript: "^5.1.6"
33848
34161
  };
33849
34162
  var overrides = {
@@ -34210,7 +34523,7 @@ var ImageRequest;
34210
34523
  if (err) {
34211
34524
  callback(err);
34212
34525
  }
34213
- else if (data instanceof HTMLImageElement || data instanceof ImageBitmap) {
34526
+ else if (data instanceof HTMLImageElement || performance.isImageBitmap(data)) {
34214
34527
  // User using addProtocol can directly return HTMLImageElement/ImageBitmap type
34215
34528
  // If HtmlImageElement is used to get image then response type will be HTMLImageElement
34216
34529
  callback(null, data);
@@ -34423,6 +34736,7 @@ function doOnceCompleted(callbackFunc, jsonsMap, imagesMap, err, expectedResultC
34423
34736
  }
34424
34737
 
34425
34738
  /**
34739
+ * @internal
34426
34740
  * A `Texture` GL related object
34427
34741
  */
34428
34742
  class Texture {
@@ -35165,6 +35479,7 @@ class Light extends performance.Evented {
35165
35479
  }
35166
35480
 
35167
35481
  /**
35482
+ * @internal
35168
35483
  * A LineAtlas lets us reuse rendered dashed lines
35169
35484
  * by writing many of them to a texture and then fetching their positions
35170
35485
  * using {@link LineAtlas#getDash}.
@@ -36219,9 +36534,7 @@ class RasterDEMTileSource extends RasterTileSource {
36219
36534
  * @see [Create and style clusters](https://maplibre.org/maplibre-gl-js/docs/examples/cluster/)
36220
36535
  */
36221
36536
  class GeoJSONSource extends performance.Evented {
36222
- /**
36223
- * @hidden
36224
- */
36537
+ /** @internal */
36225
36538
  constructor(id, options, dispatcher, eventedParent) {
36226
36539
  super();
36227
36540
  this.load = () => {
@@ -36546,9 +36859,7 @@ var rasterBoundsAttributes = performance.createLayout([
36546
36859
  * ```
36547
36860
  */
36548
36861
  class ImageSource extends performance.Evented {
36549
- /**
36550
- * @hidden
36551
- */
36862
+ /** @internal */
36552
36863
  constructor(id, options, dispatcher, eventedParent) {
36553
36864
  super();
36554
36865
  this.load = (newCoordinates, successCallback) => {
@@ -36722,7 +37033,7 @@ class ImageSource extends performance.Evented {
36722
37033
  * Given a list of coordinates, get their center as a coordinate.
36723
37034
  *
36724
37035
  * @returns centerpoint
36725
- * @hidden
37036
+ * @internal
36726
37037
  */
36727
37038
  function getCoordinatesCenterTileID(coords) {
36728
37039
  let minX = Infinity;
@@ -36943,9 +37254,7 @@ class VideoSource extends ImageSource {
36943
37254
  * ```
36944
37255
  */
36945
37256
  class CanvasSource extends ImageSource {
36946
- /**
36947
- * @hidden
36948
- */
37257
+ /** @internal */
36949
37258
  constructor(id, options, dispatcher, eventedParent) {
36950
37259
  super(id, options, dispatcher, eventedParent);
36951
37260
  this.load = () => {
@@ -37297,6 +37606,7 @@ function deserialize(input, style) {
37297
37606
 
37298
37607
  const CLOCK_SKEW_RETRY_TIMEOUT = 30000;
37299
37608
  /**
37609
+ * @internal
37300
37610
  * A tile object is the combination of a Coordinate, which defines
37301
37611
  * its place, as well as a unique ID and data tracking for its content
37302
37612
  */
@@ -37627,10 +37937,10 @@ class Tile {
37627
37937
  }
37628
37938
 
37629
37939
  /**
37940
+ * @internal
37630
37941
  * A [least-recently-used cache](http://en.wikipedia.org/wiki/Cache_algorithms)
37631
37942
  * with hash lookup made possible by keeping a list of keys in parallel to
37632
37943
  * an array of dictionary of values
37633
- *
37634
37944
  */
37635
37945
  class TileCache {
37636
37946
  /**
@@ -37808,6 +38118,7 @@ class TileCache {
37808
38118
  }
37809
38119
 
37810
38120
  /**
38121
+ * @internal
37811
38122
  * SourceFeatureState manages the state and pending changes
37812
38123
  * to features in a source, separated by source layer.
37813
38124
  * stateChanges and deletedStates batch all changes to the tile (updates and removes, respectively)
@@ -37949,6 +38260,7 @@ class SourceFeatureState {
37949
38260
  }
37950
38261
 
37951
38262
  /**
38263
+ * @internal
37952
38264
  * `SourceCache` is responsible for
37953
38265
  *
37954
38266
  * - creating an instance of `Source`
@@ -38941,6 +39253,7 @@ function overlapAllowed(overlapA, overlapB) {
38941
39253
  return allowed;
38942
39254
  }
38943
39255
  /**
39256
+ * @internal
38944
39257
  * GridIndex is a data structure for testing the intersection of
38945
39258
  * circles and rectangles in a 2d plane.
38946
39259
  * It is optimized for rapid insertion and querying.
@@ -39706,6 +40019,7 @@ function xyTransformMat4(out, a, m) {
39706
40019
  // stability, but it's expensive.
39707
40020
  const viewportPadding = 100;
39708
40021
  /**
40022
+ * @internal
39709
40023
  * A collision index used to prevent symbols from overlapping. It keep tracks of
39710
40024
  * where previous symbols have been placed and is used to check if a new
39711
40025
  * symbol overlaps with any previously added symbols.
@@ -40060,8 +40374,7 @@ function calculateVariableLayoutShift(anchor, width, height, textOffset, textBox
40060
40374
  const { horizontalAlign, verticalAlign } = performance.getAnchorAlignment(anchor);
40061
40375
  const shiftX = -(horizontalAlign - 0.5) * width;
40062
40376
  const shiftY = -(verticalAlign - 0.5) * height;
40063
- const offset = performance.evaluateVariableOffset(anchor, textOffset);
40064
- return new performance.Point(shiftX + offset[0] * textBoxScale, shiftY + offset[1] * textBoxScale);
40377
+ return new performance.Point(shiftX + textOffset[0] * textBoxScale, shiftY + textOffset[1] * textBoxScale);
40065
40378
  }
40066
40379
  function shiftVariableCollisionBox(collisionBox, shiftX, shiftY, rotateWithMap, pitchWithMap, angle) {
40067
40380
  const { x1, x2, y1, y2, anchorPointX, anchorPointY } = collisionBox;
@@ -40148,8 +40461,9 @@ class Placement {
40148
40461
  });
40149
40462
  }
40150
40463
  }
40151
- attemptAnchorPlacement(anchor, textBox, width, height, textBoxScale, rotateWithMap, pitchWithMap, textPixelRatio, posMatrix, collisionGroup, textOverlapMode, symbolInstance, bucket, orientation, iconBox, getElevation) {
40152
- const textOffset = [symbolInstance.textOffset0, symbolInstance.textOffset1];
40464
+ attemptAnchorPlacement(textAnchorOffset, textBox, width, height, textBoxScale, rotateWithMap, pitchWithMap, textPixelRatio, posMatrix, collisionGroup, textOverlapMode, symbolInstance, bucket, orientation, iconBox, getElevation) {
40465
+ const anchor = performance.TextAnchorEnum[textAnchorOffset.textAnchor];
40466
+ const textOffset = [textAnchorOffset.textOffset0, textAnchorOffset.textOffset1];
40153
40467
  const shift = calculateVariableLayoutShift(anchor, width, height, textOffset, textBoxScale);
40154
40468
  const placedGlyphBoxes = this.collisionIndex.placeCollisionBox(shiftVariableCollisionBox(textBox, shift.x, shift.y, rotateWithMap, pitchWithMap, this.transform.angle), textOverlapMode, textPixelRatio, posMatrix, collisionGroup.predicate, getElevation);
40155
40469
  if (iconBox) {
@@ -40219,6 +40533,7 @@ class Placement {
40219
40533
  const tileID = this.retainedQueryData[bucket.bucketInstanceId].tileID;
40220
40534
  const getElevation = this.terrain ? (x, y) => this.terrain.getElevation(tileID, x, y) : null;
40221
40535
  const placeSymbol = (symbolInstance, collisionArrays) => {
40536
+ var _a, _b;
40222
40537
  if (seenCrossTileIDs[symbolInstance.crossTileID])
40223
40538
  return;
40224
40539
  if (holdingForFade) {
@@ -40280,7 +40595,10 @@ class Placement {
40280
40595
  placed = placeHorizontalFn();
40281
40596
  }
40282
40597
  };
40283
- if (!layout.get('text-variable-anchor')) {
40598
+ const textAnchorOffsetStart = symbolInstance.textAnchorOffsetStartIndex;
40599
+ const textAnchorOffsetEnd = symbolInstance.textAnchorOffsetEndIndex;
40600
+ // If start+end indices match, text-variable-anchor is not in play.
40601
+ if (textAnchorOffsetEnd === textAnchorOffsetStart) {
40284
40602
  const placeBox = (collisionTextBox, orientation) => {
40285
40603
  const placedFeature = this.collisionIndex.placeCollisionBox(collisionTextBox, textOverlapMode, textPixelRatio, posMatrix, collisionGroup.predicate, getElevation);
40286
40604
  if (placedFeature && placedFeature.box && placedFeature.box.length) {
@@ -40303,36 +40621,41 @@ class Placement {
40303
40621
  updatePreviousOrientationIfNotPlaced(placed && placed.box && placed.box.length);
40304
40622
  }
40305
40623
  else {
40306
- let anchors = layout.get('text-variable-anchor');
40307
- // If this symbol was in the last placement, shift the previously used
40308
- // anchor to the front of the anchor list, only if the previous anchor
40309
- // is still in the anchor list
40310
- if (this.prevPlacement && this.prevPlacement.variableOffsets[symbolInstance.crossTileID]) {
40311
- const prevOffsets = this.prevPlacement.variableOffsets[symbolInstance.crossTileID];
40312
- if (anchors.indexOf(prevOffsets.anchor) > 0) {
40313
- anchors = anchors.filter(anchor => anchor !== prevOffsets.anchor);
40314
- anchors.unshift(prevOffsets.anchor);
40315
- }
40316
- }
40624
+ // If this symbol was in the last placement, prefer placement using same anchor, if it's still available
40625
+ let prevAnchor = performance.TextAnchorEnum[(_b = (_a = this.prevPlacement) === null || _a === void 0 ? void 0 : _a.variableOffsets[symbolInstance.crossTileID]) === null || _b === void 0 ? void 0 : _b.anchor];
40317
40626
  const placeBoxForVariableAnchors = (collisionTextBox, collisionIconBox, orientation) => {
40318
40627
  const width = collisionTextBox.x2 - collisionTextBox.x1;
40319
40628
  const height = collisionTextBox.y2 - collisionTextBox.y1;
40320
40629
  const textBoxScale = symbolInstance.textBoxScale;
40321
40630
  const variableIconBox = hasIconTextFit && (iconOverlapMode === 'never') ? collisionIconBox : null;
40322
40631
  let placedBox = { box: [], offscreen: false };
40323
- const placementAttempts = (textOverlapMode !== 'never') ? anchors.length * 2 : anchors.length;
40324
- for (let i = 0; i < placementAttempts; ++i) {
40325
- const anchor = anchors[i % anchors.length];
40326
- const overlapMode = (i >= anchors.length) ? textOverlapMode : 'never';
40327
- const result = this.attemptAnchorPlacement(anchor, collisionTextBox, width, height, textBoxScale, rotateWithMap, pitchWithMap, textPixelRatio, posMatrix, collisionGroup, overlapMode, symbolInstance, bucket, orientation, variableIconBox, getElevation);
40328
- if (result) {
40329
- placedBox = result.placedGlyphBoxes;
40330
- if (placedBox && placedBox.box && placedBox.box.length) {
40331
- placeText = true;
40332
- shift = result.shift;
40333
- break;
40632
+ let placementPasses = (textOverlapMode === 'never') ? 1 : 2;
40633
+ let overlapMode = 'never';
40634
+ if (prevAnchor) {
40635
+ placementPasses++;
40636
+ }
40637
+ for (let pass = 0; pass < placementPasses; pass++) {
40638
+ for (let i = textAnchorOffsetStart; i < textAnchorOffsetEnd; i++) {
40639
+ const textAnchorOffset = bucket.textAnchorOffsets.get(i);
40640
+ if (prevAnchor && textAnchorOffset.textAnchor !== prevAnchor) {
40641
+ continue;
40642
+ }
40643
+ const result = this.attemptAnchorPlacement(textAnchorOffset, collisionTextBox, width, height, textBoxScale, rotateWithMap, pitchWithMap, textPixelRatio, posMatrix, collisionGroup, overlapMode, symbolInstance, bucket, orientation, variableIconBox, getElevation);
40644
+ if (result) {
40645
+ placedBox = result.placedGlyphBoxes;
40646
+ if (placedBox && placedBox.box && placedBox.box.length) {
40647
+ placeText = true;
40648
+ shift = result.shift;
40649
+ return placedBox;
40650
+ }
40334
40651
  }
40335
40652
  }
40653
+ if (prevAnchor) {
40654
+ prevAnchor = null;
40655
+ }
40656
+ else {
40657
+ overlapMode = textOverlapMode;
40658
+ }
40336
40659
  }
40337
40660
  return placedBox;
40338
40661
  };
@@ -40603,11 +40926,12 @@ class Placement {
40603
40926
  bucket.iconCollisionBox.collisionVertexArray.clear();
40604
40927
  if (bucket.hasTextCollisionBoxData())
40605
40928
  bucket.textCollisionBox.collisionVertexArray.clear();
40606
- const layout = bucket.layers[0].layout;
40929
+ const layer = bucket.layers[0];
40930
+ const layout = layer.layout;
40607
40931
  const duplicateOpacityState = new JointOpacityState(null, 0, false, false, true);
40608
40932
  const textAllowOverlap = layout.get('text-allow-overlap');
40609
40933
  const iconAllowOverlap = layout.get('icon-allow-overlap');
40610
- const variablePlacement = layout.get('text-variable-anchor');
40934
+ const hasVariablePlacement = layer._unevaluatedLayout.hasValue('text-variable-anchor') || layer._unevaluatedLayout.hasValue('text-variable-anchor-offset');
40611
40935
  const rotateWithMap = layout.get('text-rotation-alignment') === 'map';
40612
40936
  const pitchWithMap = layout.get('text-pitch-alignment') === 'map';
40613
40937
  const hasIconTextFit = layout.get('icon-text-fit') !== 'none';
@@ -40701,7 +41025,7 @@ class Placement {
40701
41025
  let shift = new performance.Point(0, 0);
40702
41026
  if (collisionArrays.textBox || collisionArrays.verticalTextBox) {
40703
41027
  let used = true;
40704
- if (variablePlacement) {
41028
+ if (hasVariablePlacement) {
40705
41029
  const variableOffset = this.variableOffsets[crossTileID];
40706
41030
  if (variableOffset) {
40707
41031
  // This will show either the currently placed position or the last
@@ -41497,6 +41821,7 @@ class Style extends performance.Evented {
41497
41821
  }
41498
41822
  }
41499
41823
  /**
41824
+ * @internal
41500
41825
  * Apply queued style updates in a batch and recalculate zoom-dependent paint properties.
41501
41826
  */
41502
41827
  update(parameters) {
@@ -42598,7 +42923,7 @@ var symbolIconFrag = 'uniform sampler2D u_texture;varying vec2 v_tex;varying flo
42598
42923
  var symbolIconVert = 'const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}';
42599
42924
 
42600
42925
  // This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.
42601
- var symbolSDFFrag = '#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}';
42926
+ var symbolSDFFrag = '#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}';
42602
42927
 
42603
42928
  // This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.
42604
42929
  var symbolSDFVert = 'const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}';
@@ -42755,6 +43080,7 @@ uniform ${precision} ${type} u_${name};
42755
43080
  }
42756
43081
 
42757
43082
  /**
43083
+ * @internal
42758
43084
  * A vertex array object used to pass data to the webgl code
42759
43085
  */
42760
43086
  class VertexArrayObject {
@@ -42915,6 +43241,7 @@ function getTokenizedAttributesAndUniforms(array) {
42915
43241
  return result;
42916
43242
  }
42917
43243
  /**
43244
+ * @internal
42918
43245
  * A webgl program to execute in the GPU space
42919
43246
  */
42920
43247
  class Program {
@@ -43648,6 +43975,7 @@ const programUniforms = {
43648
43975
  };
43649
43976
 
43650
43977
  /**
43978
+ * @internal
43651
43979
  * an index buffer class
43652
43980
  */
43653
43981
  class IndexBuffer {
@@ -43701,6 +44029,7 @@ const AttributeType = {
43701
44029
  Float32: 'FLOAT'
43702
44030
  };
43703
44031
  /**
44032
+ * @internal
43704
44033
  * The `VertexBuffer` class turns a `StructArray` into a WebGL buffer. Each member of the StructArray's
43705
44034
  * Struct type is converted to a WebGL attribute.
43706
44035
  */
@@ -44279,6 +44608,7 @@ class DepthStencilAttachment extends FramebufferAttachment {
44279
44608
  }
44280
44609
 
44281
44610
  /**
44611
+ * @internal
44282
44612
  * A framebuffer holder object
44283
44613
  */
44284
44614
  class Framebuffer {
@@ -44329,6 +44659,7 @@ ColorMode.unblended = new ColorMode(ColorMode.Replace, performance.Color.transpa
44329
44659
  ColorMode.alphaBlended = new ColorMode([ONE, ONE_MINUS_SRC_ALPHA], performance.Color.transparent, [true, true, true, true]);
44330
44660
 
44331
44661
  /**
44662
+ * @internal
44332
44663
  * A webgl wrapper class to allow injection, mocking and abstaction
44333
44664
  */
44334
44665
  class Context {
@@ -44697,10 +45028,10 @@ function drawSymbols(painter, sourceCache, layer, coords, variableOffsets) {
44697
45028
  // Disable the stencil test so that labels aren't clipped to tile boundaries.
44698
45029
  const stencilMode = StencilMode.disabled;
44699
45030
  const colorMode = painter.colorModeForRenderPass();
44700
- const variablePlacement = layer.layout.get('text-variable-anchor');
45031
+ const hasVariablePlacement = layer._unevaluatedLayout.hasValue('text-variable-anchor') || layer._unevaluatedLayout.hasValue('text-variable-anchor-offset');
44701
45032
  //Compute variable-offsets before painting since icons and text data positioning
44702
45033
  //depend on each other in this case.
44703
- if (variablePlacement) {
45034
+ if (hasVariablePlacement) {
44704
45035
  updateVariableAnchors(coords, painter, layer, sourceCache, layer.layout.get('text-rotation-alignment'), layer.layout.get('text-pitch-alignment'), variableOffsets);
44705
45036
  }
44706
45037
  if (layer.paint.get('icon-opacity').constantOr(1) !== 0) {
@@ -44718,8 +45049,7 @@ function calculateVariableRenderShift(anchor, width, height, textOffset, textBox
44718
45049
  const { horizontalAlign, verticalAlign } = performance.getAnchorAlignment(anchor);
44719
45050
  const shiftX = -(horizontalAlign - 0.5) * width;
44720
45051
  const shiftY = -(verticalAlign - 0.5) * height;
44721
- const variableOffset = performance.evaluateVariableOffset(anchor, textOffset);
44722
- return new performance.Point((shiftX / textBoxScale + variableOffset[0]) * renderTextSize, (shiftY / textBoxScale + variableOffset[1]) * renderTextSize);
45052
+ return new performance.Point((shiftX / textBoxScale + textOffset[0]) * renderTextSize, (shiftY / textBoxScale + textOffset[1]) * renderTextSize);
44723
45053
  }
44724
45054
  function updateVariableAnchors(coords, painter, layer, sourceCache, rotationAlignment, pitchAlignment, variableOffsets) {
44725
45055
  const tr = painter.transform;
@@ -44835,7 +45165,7 @@ function drawLayerSymbols(painter, sourceCache, layer, coords, isText, translate
44835
45165
  const hasSortKey = !layer.layout.get('symbol-sort-key').isConstant();
44836
45166
  let sortFeaturesByKey = false;
44837
45167
  const depthMode = painter.depthModeForSublayer(0, DepthMode.ReadOnly);
44838
- const variablePlacement = layer.layout.get('text-variable-anchor');
45168
+ const hasVariablePlacement = layer._unevaluatedLayout.hasValue('text-variable-anchor') || layer._unevaluatedLayout.hasValue('text-variable-anchor-offset');
44839
45169
  const tileRenderState = [];
44840
45170
  for (const coord of coords) {
44841
45171
  const tile = sourceCache.getTile(coord);
@@ -44880,7 +45210,7 @@ function drawLayerSymbols(painter, sourceCache, layer, coords, isText, translate
44880
45210
  const s = pixelsToTileUnits(tile, 1, painter.transform.zoom);
44881
45211
  const labelPlaneMatrix = getLabelPlaneMatrix(coord.posMatrix, pitchWithMap, rotateWithMap, painter.transform, s);
44882
45212
  const glCoordMatrix = getGlCoordMatrix(coord.posMatrix, pitchWithMap, rotateWithMap, painter.transform, s);
44883
- const hasVariableAnchors = variablePlacement && bucket.hasTextData();
45213
+ const hasVariableAnchors = hasVariablePlacement && bucket.hasTextData();
44884
45214
  const updateTextFitIcon = layer.layout.get('icon-text-fit') !== 'none' &&
44885
45215
  hasVariableAnchors &&
44886
45216
  bucket.hasIconData();
@@ -44889,7 +45219,7 @@ function drawLayerSymbols(painter, sourceCache, layer, coords, isText, translate
44889
45219
  const rotateToLine = layer.layout.get('text-rotation-alignment') === 'map';
44890
45220
  updateLineLabels(bucket, coord.posMatrix, painter, isText, labelPlaneMatrix, glCoordMatrix, pitchWithMap, keepUpright, rotateToLine, getElevation);
44891
45221
  }
44892
- const matrix = painter.translatePosMatrix(coord.posMatrix, tile, translate, translateAnchor), uLabelPlaneMatrix = (alongLine || (isText && variablePlacement) || updateTextFitIcon) ? identityMat4 : labelPlaneMatrix, uglCoordMatrix = painter.translatePosMatrix(glCoordMatrix, tile, translate, translateAnchor, true);
45222
+ const matrix = painter.translatePosMatrix(coord.posMatrix, tile, translate, translateAnchor), uLabelPlaneMatrix = (alongLine || (isText && hasVariablePlacement) || updateTextFitIcon) ? identityMat4 : labelPlaneMatrix, uglCoordMatrix = painter.translatePosMatrix(glCoordMatrix, tile, translate, translateAnchor, true);
44893
45223
  const hasHalo = isSDF && layer.paint.get(isText ? 'text-halo-width' : 'icon-halo-width').constantOr(1) !== 0;
44894
45224
  let uniformValues;
44895
45225
  if (isSDF) {
@@ -45801,6 +46131,7 @@ function drawTerrain(painter, terrain, tiles) {
45801
46131
  }
45802
46132
 
45803
46133
  /**
46134
+ * @internal
45804
46135
  * Initialize a new painter object.
45805
46136
  */
45806
46137
  class Painter {
@@ -46440,6 +46771,7 @@ class EdgeInsets {
46440
46771
  }
46441
46772
 
46442
46773
  /**
46774
+ * @internal
46443
46775
  * A single transform, generally used for a single tile to be
46444
46776
  * scaled, rotated, and zoomed.
46445
46777
  */
@@ -47680,6 +48012,7 @@ class BlockableMapEventHandler {
47680
48012
  }
47681
48013
 
47682
48014
  /**
48015
+ * @internal
47683
48016
  * Shared utilities for the Handler classes to access the correct camera state.
47684
48017
  * If Camera.transformCameraUpdate is specified, the "desired state" of camera may differ from the state used for rendering.
47685
48018
  * The handlers need the "desired state" to track accumulated changes.
@@ -47715,9 +48048,7 @@ class TransformProvider {
47715
48048
  * @group Handlers
47716
48049
  */
47717
48050
  class BoxZoomHandler {
47718
- /**
47719
- * @hidden
47720
- */
48051
+ /** @internal */
47721
48052
  constructor(map, options) {
47722
48053
  this._map = map;
47723
48054
  this._tr = new TransformProvider(map);
@@ -48314,9 +48645,7 @@ class TouchPanHandler {
48314
48645
  * @group Handlers
48315
48646
  */
48316
48647
  class TwoFingersTouchHandler {
48317
- /**
48318
- * @hidden
48319
- */
48648
+ /** @internal */
48320
48649
  constructor() {
48321
48650
  this.reset();
48322
48651
  }
@@ -48590,9 +48919,7 @@ const defaultOptions$5 = {
48590
48919
  * @group Handlers
48591
48920
  */
48592
48921
  class KeyboardHandler {
48593
- /**
48594
- * @hidden
48595
- */
48922
+ /** @internal */
48596
48923
  constructor(map) {
48597
48924
  this._tr = new TransformProvider(map);
48598
48925
  const stepOptions = defaultOptions$5;
@@ -48770,9 +49097,7 @@ const maxScalePerFrame = 2;
48770
49097
  * @group Handlers
48771
49098
  */
48772
49099
  class ScrollZoomHandler {
48773
- /**
48774
- * @hidden
48775
- */
49100
+ /** @internal */
48776
49101
  constructor(map, triggerRenderFrame) {
48777
49102
  this._onTimeout = (initialEvent) => {
48778
49103
  this._type = 'wheel';
@@ -49036,9 +49361,7 @@ class ScrollZoomHandler {
49036
49361
  * @group Handlers
49037
49362
  */
49038
49363
  class DoubleClickZoomHandler {
49039
- /**
49040
- * @hidden
49041
- */
49364
+ /** @internal */
49042
49365
  constructor(clickZoom, TapZoom) {
49043
49366
  this._clickZoom = clickZoom;
49044
49367
  this._tapZoom = TapZoom;
@@ -49090,9 +49413,7 @@ class DoubleClickZoomHandler {
49090
49413
  * It is used by other handlers
49091
49414
  */
49092
49415
  class ClickZoomHandler {
49093
- /**
49094
- * @hidden
49095
- */
49416
+ /** @internal */
49096
49417
  constructor(map) {
49097
49418
  this._tr = new TransformProvider(map);
49098
49419
  this.reset();
@@ -49219,9 +49540,7 @@ class TapDragZoomHandler {
49219
49540
  * @group Handlers
49220
49541
  */
49221
49542
  class DragPanHandler {
49222
- /**
49223
- * @hidden
49224
- */
49543
+ /** @internal */
49225
49544
  constructor(el, mousePan, touchPan) {
49226
49545
  this._el = el;
49227
49546
  this._mousePan = mousePan;
@@ -49286,9 +49605,7 @@ class DragPanHandler {
49286
49605
  * @group Handlers
49287
49606
  */
49288
49607
  class DragRotateHandler {
49289
- /**
49290
- * @hidden
49291
- */
49608
+ /** @internal */
49292
49609
  constructor(options, mouseRotate, mousePitch) {
49293
49610
  this._pitchWithRotate = options.pitchWithRotate;
49294
49611
  this._mouseRotate = mouseRotate;
@@ -49347,9 +49664,7 @@ class DragRotateHandler {
49347
49664
  * @group Handlers
49348
49665
  */
49349
49666
  class TwoFingersTouchZoomRotateHandler {
49350
- /**
49351
- * @hidden
49352
- */
49667
+ /** @internal */
49353
49668
  constructor(el, touchZoom, touchRotate, tapDragZoom) {
49354
49669
  this._el = el;
49355
49670
  this._touchZoom = touchZoom;
@@ -50183,6 +50498,7 @@ class Camera extends performance.Evented {
50183
50498
  return this._cameraForBoxAndBearing(bounds.getNorthWest(), bounds.getSouthEast(), bearing, options);
50184
50499
  }
50185
50500
  /**
50501
+ * @internal
50186
50502
  * Calculate the center of these two points in the viewport and use
50187
50503
  * the highest zoom level up to and including `Map#getMaxZoom()` that fits
50188
50504
  * the points in the viewport at the specified bearing.
@@ -50192,7 +50508,6 @@ class Camera extends performance.Evented {
50192
50508
  * @param options - the camera options
50193
50509
  * @returns If map is able to fit to provided bounds, returns `center`, `zoom`, and `bearing`.
50194
50510
  * If map is unable to fit, method will warn and return undefined.
50195
- * @hidden
50196
50511
  * @example
50197
50512
  * ```ts
50198
50513
  * let p0 = [-79, 43];
@@ -50549,11 +50864,11 @@ class Camera extends performance.Evented {
50549
50864
  this.transform.recalculateZoom(this.terrain);
50550
50865
  }
50551
50866
  /**
50867
+ * @internal
50552
50868
  * Called when the camera is about to be manipulated.
50553
50869
  * If `transformCameraUpdate` is specified, a copy of the current transform is created to track the accumulated changes.
50554
50870
  * This underlying transform represents the "desired state" proposed by input handlers / animations / UI controls.
50555
50871
  * It may differ from the state used for rendering (`this.transform`).
50556
- * @hidden
50557
50872
  * @returns Transform to apply changes to
50558
50873
  */
50559
50874
  _getTransformForUpdate() {
@@ -50565,8 +50880,8 @@ class Camera extends performance.Evented {
50565
50880
  return this._requestedCameraState;
50566
50881
  }
50567
50882
  /**
50883
+ * @internal
50568
50884
  * Called after the camera is done being manipulated.
50569
- * @hidden
50570
50885
  * @param tr - the requested camera end state
50571
50886
  * Call `transformCameraUpdate` if present, and then apply the "approved" changes.
50572
50887
  */
@@ -51169,6 +51484,7 @@ var pos3dAttributes = performance.createLayout([
51169
51484
  ]);
51170
51485
 
51171
51486
  /**
51487
+ * @internal
51172
51488
  * This class is a helper for the Terrain-class, it:
51173
51489
  * - loads raster-dem tiles
51174
51490
  * - manages all renderToTexture tiles.
@@ -51327,6 +51643,7 @@ class TerrainSourceCache extends performance.Evented {
51327
51643
  }
51328
51644
 
51329
51645
  /**
51646
+ * @internal
51330
51647
  * This is the main class which handles most of the 3D Terrain logic. It has the following topics:
51331
51648
  * 1) loads raster-dem tiles via the internal sourceCache this.sourceCache
51332
51649
  * 2) creates a depth-framebuffer, which is used to calculate the visibility of coordinates
@@ -51653,7 +51970,8 @@ class Terrain {
51653
51970
  }
51654
51971
 
51655
51972
  /**
51656
- * RenderPool a resource pool for textures and framebuffers
51973
+ * @internal
51974
+ * `RenderPool` is a resource pool for textures and framebuffers
51657
51975
  */
51658
51976
  class RenderPool {
51659
51977
  constructor(_context, _size, _tileSize) {
@@ -51717,7 +52035,9 @@ class RenderPool {
51717
52035
  }
51718
52036
  }
51719
52037
 
51720
- // lookup table which layers should rendered to texture
52038
+ /**
52039
+ * lookup table which layers should rendered to texture
52040
+ */
51721
52041
  const LAYERS = {
51722
52042
  background: true,
51723
52043
  fill: true,
@@ -51726,7 +52046,8 @@ const LAYERS = {
51726
52046
  hillshade: true
51727
52047
  };
51728
52048
  /**
51729
- * RenderToTexture
52049
+ * @internal
52050
+ * A helper class to help define what should be rendered to texture and how
51730
52051
  */
51731
52052
  class RenderToTexture {
51732
52053
  constructor(painter, terrain) {
@@ -52091,9 +52412,9 @@ let Map$1 = class Map extends Camera {
52091
52412
  });
52092
52413
  }
52093
52414
  /**
52415
+ * @internal
52094
52416
  * Returns a unique number for this map instance which is used for the MapLoadEvent
52095
52417
  * to make sure we only fire one event per instantiated map object.
52096
- * @hidden
52097
52418
  * @returns the uniq map ID
52098
52419
  */
52099
52420
  _getMapId() {
@@ -52241,9 +52562,9 @@ let Map$1 = class Map extends Camera {
52241
52562
  return this;
52242
52563
  }
52243
52564
  /**
52565
+ * @internal
52244
52566
  * Return the map's pixel ratio eventually scaled down to respect maxCanvasSize.
52245
52567
  * Internally you should use this and not getPixelRatio().
52246
- * @hidden
52247
52568
  */
52248
52569
  _getClampedPixelRatio(width, height) {
52249
52570
  const { 0: maxCanvasWidth, 1: maxCanvasHeight } = this._maxCanvasSize;
@@ -54068,9 +54389,9 @@ let Map$1 = class Map extends Camera {
54068
54389
  return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded();
54069
54390
  }
54070
54391
  /**
54392
+ * @internal
54071
54393
  * Update this map's style and sources, and re-render the map.
54072
54394
  *
54073
- * @hidden
54074
54395
  * @param updateStyle - mark the map's style for reprocessing as
54075
54396
  * well as its sources
54076
54397
  * @returns `this`
@@ -54084,9 +54405,10 @@ let Map$1 = class Map extends Camera {
54084
54405
  return this;
54085
54406
  }
54086
54407
  /**
54408
+ * @internal
54087
54409
  * Request that the given callback be executed during the next render
54088
54410
  * frame. Schedule a render frame if one is not already scheduled.
54089
- * @hidden
54411
+ *
54090
54412
  * @returns An id that can be used to cancel the callback
54091
54413
  */
54092
54414
  _requestRenderFrame(callback) {
@@ -54097,6 +54419,7 @@ let Map$1 = class Map extends Camera {
54097
54419
  this._renderTaskQueue.remove(id);
54098
54420
  }
54099
54421
  /**
54422
+ * @internal
54100
54423
  * Call when a (re-)render of the map is required:
54101
54424
  * - The style has changed (`setPaintProperty()`, etc.)
54102
54425
  * - Source data has changed (e.g. tiles have finished loading)
@@ -54104,7 +54427,6 @@ let Map$1 = class Map extends Camera {
54104
54427
  * - A transition is in progress
54105
54428
  *
54106
54429
  * @param paintStartTimeStamp - The time when the animation frame began executing.
54107
- * @hidden
54108
54430
  *
54109
54431
  * @returns `this`
54110
54432
  */