maplibre-gl 3.1.0 → 3.2.0-pre.2

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 (338) hide show
  1. package/README.md +7 -7
  2. package/build/generate-doc-images.ts +73 -0
  3. package/build/generate-docs.ts +100 -0
  4. package/build/generate-struct-arrays.ts +9 -12
  5. package/dist/maplibre-gl-csp-worker.js +1 -1
  6. package/dist/maplibre-gl-csp-worker.js.map +1 -1
  7. package/dist/maplibre-gl-csp.js +1 -1
  8. package/dist/maplibre-gl-csp.js.map +1 -1
  9. package/dist/maplibre-gl-dev.js +3303 -3398
  10. package/dist/maplibre-gl-dev.js.map +1 -1
  11. package/dist/maplibre-gl.d.ts +3899 -3531
  12. package/dist/maplibre-gl.js +3 -3
  13. package/dist/maplibre-gl.js.map +1 -1
  14. package/package.json +28 -25
  15. package/src/data/array_types.g.ts +14 -48
  16. package/src/data/bucket/circle_bucket.ts +11 -14
  17. package/src/data/bucket/fill_bucket.test.ts +6 -6
  18. package/src/data/bucket/fill_bucket.ts +10 -12
  19. package/src/data/bucket/fill_extrusion_bucket.ts +11 -13
  20. package/src/data/bucket/heatmap_bucket.ts +3 -6
  21. package/src/data/bucket/line_attributes.ts +1 -2
  22. package/src/data/bucket/line_attributes_ext.ts +1 -2
  23. package/src/data/bucket/line_bucket.test.ts +5 -5
  24. package/src/data/bucket/line_bucket.ts +18 -21
  25. package/src/data/bucket/pattern_attributes.ts +1 -3
  26. package/src/data/bucket/pattern_bucket_features.ts +3 -3
  27. package/src/data/bucket/symbol_bucket.test.ts +5 -5
  28. package/src/data/bucket/symbol_bucket.ts +12 -15
  29. package/src/data/bucket.ts +7 -11
  30. package/src/data/dem_data.test.ts +1 -1
  31. package/src/data/dem_data.ts +1 -1
  32. package/src/data/evaluation_feature.ts +4 -5
  33. package/src/data/extent.ts +1 -4
  34. package/src/data/feature_index.ts +14 -13
  35. package/src/data/feature_position_map.test.ts +4 -4
  36. package/src/data/feature_position_map.ts +1 -1
  37. package/src/data/index_array_type.ts +0 -1
  38. package/src/data/load_geometry.test.ts +1 -1
  39. package/src/data/load_geometry.ts +3 -4
  40. package/src/data/program_configuration.ts +6 -11
  41. package/src/data/segment.ts +9 -6
  42. package/src/geo/edge_insets.test.ts +1 -1
  43. package/src/geo/edge_insets.ts +36 -26
  44. package/src/geo/lng_lat.test.ts +1 -1
  45. package/src/geo/lng_lat.ts +61 -44
  46. package/src/geo/lng_lat_bounds.test.ts +2 -2
  47. package/src/geo/lng_lat_bounds.ts +88 -68
  48. package/src/geo/mercator_coordinate.test.ts +2 -2
  49. package/src/geo/mercator_coordinate.ts +34 -27
  50. package/src/geo/transform.test.ts +3 -3
  51. package/src/geo/transform.ts +58 -79
  52. package/src/gl/color_mode.ts +1 -3
  53. package/src/gl/context.ts +12 -11
  54. package/src/gl/cull_face_mode.ts +1 -3
  55. package/src/gl/depth_mode.ts +1 -3
  56. package/src/gl/framebuffer.ts +5 -4
  57. package/src/gl/index_buffer.ts +5 -4
  58. package/src/gl/render_pool.test.ts +2 -2
  59. package/src/gl/render_pool.ts +5 -5
  60. package/src/gl/state.test.ts +1 -1
  61. package/src/gl/stencil_mode.ts +1 -3
  62. package/src/gl/value.ts +1 -1
  63. package/src/gl/vertex_buffer.test.ts +2 -2
  64. package/src/gl/vertex_buffer.ts +8 -14
  65. package/src/index.test.ts +2 -2
  66. package/src/index.ts +121 -113
  67. package/src/render/draw_background.ts +7 -9
  68. package/src/render/draw_circle.ts +13 -15
  69. package/src/render/draw_collision_debug.ts +11 -13
  70. package/src/render/draw_custom.ts +6 -8
  71. package/src/render/draw_debug.test.ts +4 -4
  72. package/src/render/draw_debug.ts +8 -10
  73. package/src/render/draw_fill.test.ts +13 -13
  74. package/src/render/draw_fill.ts +9 -11
  75. package/src/render/draw_fill_extrusion.ts +10 -12
  76. package/src/render/draw_heatmap.ts +12 -14
  77. package/src/render/draw_hillshade.ts +10 -12
  78. package/src/render/draw_line.ts +9 -9
  79. package/src/render/draw_raster.ts +9 -11
  80. package/src/render/draw_symbol.test.ts +16 -16
  81. package/src/render/draw_symbol.ts +15 -16
  82. package/src/render/draw_terrain.ts +11 -11
  83. package/src/render/glyph_atlas.ts +10 -1
  84. package/src/render/glyph_manager.test.ts +3 -3
  85. package/src/render/glyph_manager.ts +7 -7
  86. package/src/render/image_atlas.ts +6 -3
  87. package/src/render/image_manager.ts +3 -5
  88. package/src/render/line_atlas.test.ts +1 -1
  89. package/src/render/line_atlas.ts +19 -14
  90. package/src/render/painter.ts +85 -65
  91. package/src/render/program/background_program.ts +2 -2
  92. package/src/render/program/circle_program.ts +5 -5
  93. package/src/render/program/clipping_mask_program.ts +1 -1
  94. package/src/render/program/collision_program.ts +4 -4
  95. package/src/render/program/debug_program.ts +1 -1
  96. package/src/render/program/fill_extrusion_program.ts +3 -3
  97. package/src/render/program/fill_program.ts +3 -3
  98. package/src/render/program/heatmap_program.ts +5 -5
  99. package/src/render/program/hillshade_program.ts +7 -7
  100. package/src/render/program/line_program.ts +6 -6
  101. package/src/render/program/pattern.ts +3 -3
  102. package/src/render/program/raster_program.ts +2 -2
  103. package/src/render/program/symbol_program.ts +2 -2
  104. package/src/render/program/terrain_program.ts +1 -1
  105. package/src/render/program.ts +18 -16
  106. package/src/render/render_to_texture.test.ts +15 -15
  107. package/src/render/render_to_texture.ts +10 -10
  108. package/src/render/terrain.test.ts +38 -7
  109. package/src/render/terrain.ts +103 -67
  110. package/src/render/texture.ts +5 -4
  111. package/src/render/uniform_binding.test.ts +1 -1
  112. package/src/render/uniform_binding.ts +7 -1
  113. package/src/render/update_pattern_positions_in_program.ts +5 -5
  114. package/src/render/vertex_array_object.ts +9 -8
  115. package/src/shaders/encode_attribute.ts +0 -2
  116. package/src/shaders/shaders.ts +1 -3
  117. package/src/source/canvas_source.test.ts +6 -6
  118. package/src/source/canvas_source.ts +46 -60
  119. package/src/source/geojson_source.test.ts +5 -5
  120. package/src/source/geojson_source.ts +75 -59
  121. package/src/source/geojson_source_diff.ts +39 -2
  122. package/src/source/geojson_worker_source.test.ts +3 -3
  123. package/src/source/geojson_worker_source.ts +20 -26
  124. package/src/source/geojson_wrapper.test.ts +3 -3
  125. package/src/source/geojson_wrapper.ts +2 -4
  126. package/src/source/image_source.test.ts +9 -8
  127. package/src/source/image_source.ts +49 -35
  128. package/src/source/load_tilejson.ts +2 -2
  129. package/src/source/pixels_to_tile_units.ts +2 -3
  130. package/src/source/query_features.test.ts +3 -3
  131. package/src/source/query_features.ts +50 -19
  132. package/src/source/raster_dem_tile_source.test.ts +3 -3
  133. package/src/source/raster_dem_tile_source.ts +23 -10
  134. package/src/source/raster_dem_tile_worker_source.test.ts +2 -2
  135. package/src/source/raster_dem_tile_worker_source.ts +3 -5
  136. package/src/source/raster_tile_source.test.ts +3 -3
  137. package/src/source/raster_tile_source.ts +38 -11
  138. package/src/source/rtl_text_plugin.ts +4 -1
  139. package/src/source/source.ts +67 -59
  140. package/src/source/source_cache.test.ts +7 -7
  141. package/src/source/source_cache.ts +17 -38
  142. package/src/source/source_state.ts +2 -5
  143. package/src/source/terrain_source_cache.test.ts +8 -8
  144. package/src/source/terrain_source_cache.ts +42 -27
  145. package/src/source/tile.test.ts +3 -3
  146. package/src/source/tile.ts +32 -38
  147. package/src/source/tile_bounds.ts +2 -4
  148. package/src/source/tile_cache.test.ts +2 -2
  149. package/src/source/tile_cache.ts +20 -30
  150. package/src/source/tile_id.ts +11 -2
  151. package/src/source/vector_tile_source.test.ts +3 -3
  152. package/src/source/vector_tile_source.ts +34 -24
  153. package/src/source/vector_tile_worker_source.test.ts +4 -4
  154. package/src/source/vector_tile_worker_source.ts +11 -23
  155. package/src/source/video_source.test.ts +5 -5
  156. package/src/source/video_source.ts +21 -28
  157. package/src/source/worker.ts +6 -8
  158. package/src/source/worker_source.ts +6 -8
  159. package/src/source/worker_tile.test.ts +5 -5
  160. package/src/source/worker_tile.ts +13 -16
  161. package/src/style/create_style_layer.ts +31 -26
  162. package/src/style/evaluation_parameters.ts +5 -4
  163. package/src/style/format_section_override.test.ts +2 -2
  164. package/src/style/format_section_override.ts +1 -1
  165. package/src/style/light.test.ts +2 -2
  166. package/src/style/light.ts +3 -5
  167. package/src/style/load_glyph_range.test.ts +1 -1
  168. package/src/style/load_glyph_range.ts +3 -3
  169. package/src/style/load_sprite.test.ts +1 -1
  170. package/src/style/load_sprite.ts +3 -3
  171. package/src/style/parse_glyph_pbf.ts +1 -1
  172. package/src/style/pauseable_placement.ts +7 -9
  173. package/src/style/properties.ts +4 -53
  174. package/src/style/query_utils.ts +3 -3
  175. package/src/style/style.test.ts +22 -19
  176. package/src/style/style.ts +118 -84
  177. package/src/style/style_glyph.ts +6 -0
  178. package/src/style/style_image.ts +39 -33
  179. package/src/style/style_layer/background_style_layer.ts +2 -4
  180. package/src/style/style_layer/circle_style_layer.ts +7 -6
  181. package/src/style/style_layer/custom_style_layer.ts +23 -48
  182. package/src/style/style_layer/fill_extrusion_style_layer.ts +4 -6
  183. package/src/style/style_layer/fill_style_layer.ts +5 -7
  184. package/src/style/style_layer/heatmap_style_layer.ts +8 -7
  185. package/src/style/style_layer/hillshade_style_layer.ts +2 -4
  186. package/src/style/style_layer/line_style_layer.ts +6 -8
  187. package/src/style/style_layer/overlap_mode.test.ts +3 -3
  188. package/src/style/style_layer/overlap_mode.ts +3 -0
  189. package/src/style/style_layer/raster_style_layer.ts +2 -4
  190. package/src/style/style_layer/symbol_style_layer.ts +6 -8
  191. package/src/style/style_layer/typed_style_layer.ts +7 -7
  192. package/src/style/style_layer.test.ts +5 -5
  193. package/src/style/style_layer.ts +7 -6
  194. package/src/style/style_layer_index.test.ts +1 -1
  195. package/src/style/style_layer_index.ts +3 -5
  196. package/src/style/zoom_history.ts +1 -3
  197. package/src/symbol/anchor.test.ts +1 -1
  198. package/src/symbol/anchor.ts +1 -3
  199. package/src/symbol/check_max_angle.test.ts +8 -2
  200. package/src/symbol/check_max_angle.ts +10 -13
  201. package/src/symbol/clip_line.test.ts +1 -1
  202. package/src/symbol/clip_line.ts +6 -9
  203. package/src/symbol/collision_feature.test.ts +2 -2
  204. package/src/symbol/collision_feature.ts +7 -12
  205. package/src/symbol/collision_index.test.ts +2 -2
  206. package/src/symbol/collision_index.ts +5 -11
  207. package/src/symbol/cross_tile_symbol_index.test.ts +2 -2
  208. package/src/symbol/cross_tile_symbol_index.ts +5 -7
  209. package/src/symbol/get_anchors.ts +2 -2
  210. package/src/symbol/grid_index.test.ts +1 -1
  211. package/src/symbol/grid_index.ts +4 -5
  212. package/src/symbol/merge_lines.test.ts +1 -1
  213. package/src/symbol/merge_lines.ts +1 -1
  214. package/src/symbol/opacity_state.ts +1 -3
  215. package/src/symbol/path_interpolator.test.ts +1 -1
  216. package/src/symbol/path_interpolator.ts +1 -3
  217. package/src/symbol/placement.ts +9 -9
  218. package/src/symbol/projection.ts +61 -34
  219. package/src/symbol/quads.ts +7 -11
  220. package/src/symbol/shaping.ts +1 -1
  221. package/src/symbol/symbol_layout.ts +9 -12
  222. package/src/symbol/symbol_size.ts +1 -1
  223. package/src/symbol/symbol_style_layer.test.ts +4 -4
  224. package/src/symbol/transform_text.ts +2 -2
  225. package/src/types/callback.ts +14 -14
  226. package/src/types/cancelable.ts +3 -0
  227. package/src/types/transferable.ts +3 -0
  228. package/src/ui/anchor.ts +4 -0
  229. package/src/ui/camera.test.ts +6 -6
  230. package/src/ui/camera.ts +392 -361
  231. package/src/ui/control/attribution_control.test.ts +1 -1
  232. package/src/ui/control/attribution_control.ts +34 -30
  233. package/src/ui/control/control.ts +14 -20
  234. package/src/ui/control/fullscreen_control.test.ts +1 -1
  235. package/src/ui/control/fullscreen_control.ts +21 -26
  236. package/src/ui/control/geolocate_control.test.ts +5 -5
  237. package/src/ui/control/geolocate_control.ts +181 -194
  238. package/src/ui/control/logo_control.ts +20 -16
  239. package/src/ui/control/navigation_control.test.ts +1 -1
  240. package/src/ui/control/navigation_control.ts +46 -42
  241. package/src/ui/control/scale_control.test.ts +1 -1
  242. package/src/ui/control/scale_control.ts +30 -21
  243. package/src/ui/control/terrain_control.test.ts +1 -1
  244. package/src/ui/control/terrain_control.ts +14 -18
  245. package/src/ui/default_locale.ts +1 -3
  246. package/src/ui/events.ts +570 -1281
  247. package/src/ui/handler/box_zoom.test.ts +2 -2
  248. package/src/ui/handler/box_zoom.ts +16 -11
  249. package/src/ui/handler/click_zoom.ts +11 -3
  250. package/src/ui/handler/cooperative_gestures.test.ts +3 -3
  251. package/src/ui/handler/dblclick_zoom.test.ts +1 -1
  252. package/src/ui/handler/drag_handler.ts +30 -22
  253. package/src/ui/handler/drag_move_state_manager.ts +1 -1
  254. package/src/ui/handler/drag_pan.test.ts +2 -2
  255. package/src/ui/handler/drag_rotate.test.ts +3 -3
  256. package/src/ui/handler/keyboard.test.ts +2 -2
  257. package/src/ui/handler/keyboard.ts +22 -13
  258. package/src/ui/handler/map_event.test.ts +2 -2
  259. package/src/ui/handler/map_event.ts +1 -1
  260. package/src/ui/handler/mouse.ts +1 -1
  261. package/src/ui/handler/mouse_rotate.test.ts +3 -3
  262. package/src/ui/handler/scroll_zoom.test.ts +3 -3
  263. package/src/ui/handler/scroll_zoom.ts +45 -52
  264. package/src/ui/handler/shim/dblclick_zoom.ts +12 -6
  265. package/src/ui/handler/shim/drag_pan.ts +34 -14
  266. package/src/ui/handler/shim/drag_rotate.ts +20 -12
  267. package/src/ui/handler/shim/two_fingers_touch.ts +24 -18
  268. package/src/ui/handler/tap_drag_zoom.test.ts +113 -0
  269. package/src/ui/handler/tap_drag_zoom.ts +18 -10
  270. package/src/ui/handler/tap_recognizer.ts +1 -1
  271. package/src/ui/handler/tap_zoom.ts +4 -3
  272. package/src/ui/handler/touch_pan.ts +3 -2
  273. package/src/ui/handler/transform-provider.ts +4 -6
  274. package/src/ui/handler/two_fingers_touch.test.ts +3 -3
  275. package/src/ui/handler/two_fingers_touch.ts +64 -47
  276. package/src/ui/handler_inertia.ts +4 -4
  277. package/src/ui/handler_manager.ts +86 -52
  278. package/src/ui/hash.test.ts +1 -1
  279. package/src/ui/hash.ts +21 -28
  280. package/src/ui/map/isMoving.test.ts +3 -3
  281. package/src/ui/map/isRotating.test.ts +3 -3
  282. package/src/ui/map/isZooming.test.ts +3 -3
  283. package/src/ui/map.test.ts +97 -8
  284. package/src/ui/map.ts +856 -702
  285. package/src/ui/map_events.test.ts +1 -1
  286. package/src/ui/marker.test.ts +35 -15
  287. package/src/ui/marker.ts +220 -141
  288. package/src/ui/popup.test.ts +2 -2
  289. package/src/ui/popup.ts +179 -147
  290. package/src/util/actor.test.ts +7 -7
  291. package/src/util/actor.ts +25 -22
  292. package/src/util/ajax.ts +37 -17
  293. package/src/util/browser.test.ts +1 -1
  294. package/src/util/browser.ts +2 -6
  295. package/src/util/classify_rings.test.ts +1 -1
  296. package/src/util/classify_rings.ts +1 -1
  297. package/src/util/color_ramp.ts +0 -2
  298. package/src/util/config.ts +6 -3
  299. package/src/util/debug.ts +0 -2
  300. package/src/util/dictionary_coder.ts +1 -4
  301. package/src/util/dispatcher.test.ts +3 -3
  302. package/src/util/dispatcher.ts +4 -9
  303. package/src/util/dom.ts +1 -1
  304. package/src/util/evented.ts +23 -18
  305. package/src/util/find_pole_of_inaccessibility.test.ts +1 -1
  306. package/src/util/find_pole_of_inaccessibility.ts +4 -5
  307. package/src/util/global_worker_pool.ts +2 -3
  308. package/src/util/image.ts +10 -4
  309. package/src/util/image_request.test.ts +3 -3
  310. package/src/util/image_request.ts +15 -14
  311. package/src/util/is_char_in_unicode_block.ts +1 -3
  312. package/src/util/offscreen_canvas_supported.ts +1 -1
  313. package/src/util/performance.ts +1 -2
  314. package/src/util/request_manager.ts +4 -0
  315. package/src/util/resolve_tokens.test.ts +1 -1
  316. package/src/util/resolve_tokens.ts +3 -6
  317. package/src/util/script_detection.ts +1 -4
  318. package/src/util/smart_wrap.ts +3 -5
  319. package/src/util/struct_array.ts +18 -14
  320. package/src/util/style.ts +2 -2
  321. package/src/util/task_queue.test.ts +1 -1
  322. package/src/util/task_queue.ts +1 -3
  323. package/src/util/test/mock_webgl.ts +6 -0
  324. package/src/util/test/util.ts +2 -2
  325. package/src/util/throttle.test.ts +1 -1
  326. package/src/util/throttle.ts +1 -2
  327. package/src/util/throttled_invoker.ts +1 -5
  328. package/src/util/transferable_grid_index.test.ts +1 -1
  329. package/src/util/transferable_grid_index.ts +1 -3
  330. package/src/util/util.test.ts +1 -14
  331. package/src/util/util.ts +44 -107
  332. package/src/util/vectortile_to_geojson.ts +13 -3
  333. package/src/util/verticalize_punctuation.ts +1 -1
  334. package/src/util/web_worker.ts +2 -2
  335. package/src/util/web_worker_transfer.ts +11 -8
  336. package/src/util/webp_supported.ts +2 -4
  337. package/src/util/worker_pool.test.ts +1 -1
  338. package/src/util/worker_pool.ts +4 -5
@@ -1,33 +1,33 @@
1
1
  import {Event, ErrorEvent, Evented} from '../util/evented';
2
- import StyleLayer from './style_layer';
3
- import createStyleLayer from './create_style_layer';
4
- import loadSprite from './load_sprite';
5
- import ImageManager from '../render/image_manager';
6
- import GlyphManager from '../render/glyph_manager';
7
- import Light from './light';
8
- import LineAtlas from '../render/line_atlas';
2
+ import {StyleLayer} from './style_layer';
3
+ import {createStyleLayer} from './create_style_layer';
4
+ import {loadSprite} from './load_sprite';
5
+ import {ImageManager} from '../render/image_manager';
6
+ import {GlyphManager} from '../render/glyph_manager';
7
+ import {Light} from './light';
8
+ import {LineAtlas} from '../render/line_atlas';
9
9
  import {pick, clone, extend, deepEqual, filterObject, mapObject} from '../util/util';
10
10
  import {coerceSpriteToArray} from '../util/style';
11
11
  import {getJSON, getReferrer, makeRequest} from '../util/ajax';
12
12
  import {ResourceType} from '../util/request_manager';
13
- import browser from '../util/browser';
14
- import Dispatcher from '../util/dispatcher';
13
+ import {browser} from '../util/browser';
14
+ import {Dispatcher} from '../util/dispatcher';
15
15
  import {validateStyle, emitValidationErrors as _emitValidationErrors} from './validate_style';
16
16
  import {getSourceType, setSourceType, Source} from '../source/source';
17
17
  import type {SourceClass} from '../source/source';
18
- import {queryRenderedFeatures, queryRenderedSymbols, querySourceFeatures} from '../source/query_features';
19
- import SourceCache from '../source/source_cache';
20
- import GeoJSONSource from '../source/geojson_source';
18
+ import {QueryRenderedFeaturesOptions, QuerySourceFeatureOptions, queryRenderedFeatures, queryRenderedSymbols, querySourceFeatures} from '../source/query_features';
19
+ import {SourceCache} from '../source/source_cache';
20
+ import {GeoJSONSource} from '../source/geojson_source';
21
21
  import {latest as styleSpec, derefLayers as deref, emptyStyle, diff as diffStyles, operations as diffOperations} from '@maplibre/maplibre-gl-style-spec';
22
- import getWorkerPool from '../util/global_worker_pool';
22
+ import {getGlobalWorkerPool} from '../util/global_worker_pool';
23
23
  import {
24
24
  registerForPluginStateChange,
25
25
  evented as rtlTextPluginEvented,
26
26
  triggerPluginCompletionEvent
27
27
  } from '../source/rtl_text_plugin';
28
- import PauseablePlacement from './pauseable_placement';
29
- import ZoomHistory from './zoom_history';
30
- import CrossTileSymbolIndex from '../symbol/cross_tile_symbol_index';
28
+ import {PauseablePlacement} from './pauseable_placement';
29
+ import {ZoomHistory} from './zoom_history';
30
+ import {CrossTileSymbolIndex} from '../symbol/cross_tile_symbol_index';
31
31
  import {validateCustomStyleLayer} from './style_layer/custom_style_layer';
32
32
  import type {MapGeoJSONFeature} from '../util/vectortile_to_geojson';
33
33
 
@@ -40,12 +40,12 @@ const emitValidationErrors = (evented: Evented, errors?: ReadonlyArray<{
40
40
  }> | null) =>
41
41
  _emitValidationErrors(evented, errors && errors.filter(error => error.identifier !== 'source.canvas'));
42
42
 
43
- import type Map from '../ui/map';
44
- import type Transform from '../geo/transform';
43
+ import type {Map} from '../ui/map';
44
+ import type {Transform} from '../geo/transform';
45
45
  import type {StyleImage} from './style_image';
46
46
  import type {StyleGlyph} from './style_glyph';
47
47
  import type {Callback} from '../types/callback';
48
- import type EvaluationParameters from './evaluation_parameters';
48
+ import type {EvaluationParameters} from './evaluation_parameters';
49
49
  import type {Placement} from '../symbol/placement';
50
50
  import type {Cancelable} from '../types/cancelable';
51
51
  import type {RequestParameters, ResponseCallback} from '../util/ajax';
@@ -85,19 +85,49 @@ const ignoredDiffOperations = pick(diffOperations, [
85
85
  ]);
86
86
 
87
87
  const empty = emptyStyle() as StyleSpecification;
88
-
88
+ /**
89
+ * A feature identifier that is bound to a source
90
+ */
89
91
  export type FeatureIdentifier = {
92
+ /**
93
+ * Unique id of the feature.
94
+ */
90
95
  id?: string | number | undefined;
96
+ /**
97
+ * The id of the vector or GeoJSON source for the feature.
98
+ */
91
99
  source: string;
100
+ /**
101
+ * *For vector tile sources, `sourceLayer` is required.*
102
+ */
92
103
  sourceLayer?: string | undefined;
93
104
  };
94
105
 
106
+ /**
107
+ * The options object related to the {@link Map}'s style related methods
108
+ */
95
109
  export type StyleOptions = {
110
+ /**
111
+ * If false, style validation will be skipped. Useful in production environment.
112
+ */
96
113
  validate?: boolean;
114
+ /**
115
+ * Defines a CSS
116
+ * font-family for locally overriding generation of glyphs in the 'CJK Unified Ideographs', 'Hiragana', 'Katakana' and 'Hangul Syllables' ranges.
117
+ * In these ranges, font settings from the map's style will be ignored, except for font-weight keywords (light/regular/medium/bold).
118
+ * Set to `false`, to enable font settings from the map's style for these glyph ranges.
119
+ * Forces a full update.
120
+ */
97
121
  localIdeographFontFamily?: string;
98
122
  };
99
123
 
124
+ /**
125
+ * Supporting type to add validation to another style related type
126
+ */
100
127
  export type StyleSetterOptions = {
128
+ /**
129
+ * Whether to check if the filter conforms to the MapLibre Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.
130
+ */
101
131
  validate?: boolean;
102
132
  };
103
133
 
@@ -108,12 +138,12 @@ export type StyleSetterOptions = {
108
138
  * when a desired style is a certain combination of previous and incoming style
109
139
  * when an incoming style requires modification based on external state
110
140
  *
111
- * @typedef {Function} TransformStyleFunction
112
- * @param {StyleSpecification | undefined} previousStyle The current style.
113
- * @param {StyleSpecification} nextStyle The next style.
114
- * @returns {boolean} resulting style that will to be applied to the map
141
+ * @param previousStyle - The current style.
142
+ * @param nextStyle - The next style.
143
+ * @returns resulting style that will to be applied to the map
115
144
  *
116
145
  * @example
146
+ * ```ts
117
147
  * map.setStyle('https://demotiles.maplibre.org/style.json', {
118
148
  * transformStyle: (previousStyle, nextStyle) => ({
119
149
  * ...nextStyle,
@@ -141,18 +171,30 @@ export type StyleSetterOptions = {
141
171
  * ]
142
172
  * })
143
173
  * });
174
+ * ```
144
175
  */
145
176
  export type TransformStyleFunction = (previous: StyleSpecification | undefined, next: StyleSpecification) => StyleSpecification;
146
177
 
178
+ /**
179
+ * The options object related to the {@link Map}'s style related methods
180
+ */
147
181
  export type StyleSwapOptions = {
182
+ /**
183
+ * If false, force a 'full' update, removing the current style
184
+ * and building the given one instead of attempting a diff-based update.
185
+ */
148
186
  diff?: boolean;
187
+ /**
188
+ * TransformStyleFunction is a convenience function
189
+ * that allows to modify a style after it is fetched but before it is committed to the map state. Refer to {@link TransformStyleFunction}.
190
+ */
149
191
  transformStyle?: TransformStyleFunction;
150
192
  }
151
193
 
152
194
  /**
153
- * @private
195
+ * The Style base class
154
196
  */
155
- class Style extends Evented {
197
+ export class Style extends Evented {
156
198
  map: Map;
157
199
  stylesheet: StyleSpecification;
158
200
  dispatcher: Dispatcher;
@@ -188,16 +230,13 @@ class Style extends Evented {
188
230
  placement: Placement;
189
231
  z: number;
190
232
 
191
- // exposed to allow stubbing by unit tests
192
- static getSourceType: typeof getSourceType;
193
- static setSourceType: typeof setSourceType;
194
233
  static registerForPluginStateChange: typeof registerForPluginStateChange;
195
234
 
196
235
  constructor(map: Map, options: StyleOptions = {}) {
197
236
  super();
198
237
 
199
238
  this.map = map;
200
- this.dispatcher = new Dispatcher(getWorkerPool(), this, map._getMapId());
239
+ this.dispatcher = new Dispatcher(getGlobalWorkerPool(), this, map._getMapId());
201
240
  this.imageManager = new ImageManager();
202
241
  this.imageManager.setEventedParent(this);
203
242
  this.glyphManager = new GlyphManager(map._requestManager, options.localIdeographFontFamily);
@@ -453,8 +492,8 @@ class Style extends Evented {
453
492
 
454
493
  /**
455
494
  * take an array of string IDs, and based on this._layers, generate an array of LayerSpecification
456
- * @param ids an array of string IDs, for which serialized layers will be generated. If omitted, all serialized layers will be returned
457
- * @returns {Array<LayerSpecification>} generated result
495
+ * @param ids - an array of string IDs, for which serialized layers will be generated. If omitted, all serialized layers will be returned
496
+ * @returns generated result
458
497
  */
459
498
  private _serializeByIds(ids?: Array<string>): Array<LayerSpecification> {
460
499
 
@@ -524,7 +563,6 @@ class Style extends Evented {
524
563
 
525
564
  /**
526
565
  * Apply queued style updates in a batch and recalculate zoom-dependent paint properties.
527
- * @private
528
566
  */
529
567
  update(parameters: EvaluationParameters) {
530
568
  if (!this._loaded) {
@@ -645,8 +683,7 @@ class Style extends Evented {
645
683
  * May throw an Error ('Unimplemented: METHOD') if the mapbox-gl-style-spec
646
684
  * diff algorithm produces an operation that is not supported.
647
685
  *
648
- * @returns {boolean} true if any changes were made; false otherwise
649
- * @private
686
+ * @returns true if any changes were made; false otherwise
650
687
  */
651
688
  setState(nextState: StyleSpecification, options: StyleSwapOptions = {}) {
652
689
  this._checkLoaded();
@@ -752,11 +789,11 @@ class Style extends Evented {
752
789
 
753
790
  /**
754
791
  * Remove a source from this stylesheet, given its id.
755
- * @param {string} id id of the source to remove
756
- * @throws {Error} if no source is found with the given ID
757
- * @returns {Map} The {@link Map} object.
792
+ * @param id - id of the source to remove
793
+ * @throws if no source is found with the given ID
794
+ * @returns `this`.
758
795
  */
759
- removeSource(id: string) {
796
+ removeSource(id: string): this {
760
797
  this._checkLoaded();
761
798
 
762
799
  if (this.sourceCaches[id] === undefined) {
@@ -779,8 +816,8 @@ class Style extends Evented {
779
816
 
780
817
  /**
781
818
  * Set the data of a GeoJSON source, given its id.
782
- * @param {string} id id of the source
783
- * @param {GeoJSON|string} data GeoJSON source
819
+ * @param id - id of the source
820
+ * @param data - GeoJSON source
784
821
  */
785
822
  setGeoJSONSourceData(id: string, data: GeoJSON.GeoJSON | string) {
786
823
  this._checkLoaded();
@@ -794,9 +831,9 @@ class Style extends Evented {
794
831
  }
795
832
 
796
833
  /**
797
- * Get a source by id.
798
- * @param {string} id id of the desired source
799
- * @returns {Source | undefined} source
834
+ * Get a source by ID.
835
+ * @param id - ID of the desired source
836
+ * @returns source
800
837
  */
801
838
  getSource(id: string): Source | undefined {
802
839
  return this.sourceCaches[id] && this.sourceCaches[id].getSource();
@@ -805,12 +842,12 @@ class Style extends Evented {
805
842
  /**
806
843
  * Add a layer to the map style. The layer will be inserted before the layer with
807
844
  * ID `before`, or appended if `before` is omitted.
808
- * @param {Object | CustomLayerInterface} layerObject The style layer to add.
809
- * @param {string} [before] ID of an existing layer to insert before
810
- * @param {Object} options Style setter options.
811
- * @returns {Map} The {@link Map} object.
845
+ * @param layerObject - The style layer to add.
846
+ * @param before - ID of an existing layer to insert before
847
+ * @param options - Style setter options.
848
+ * @returns `this`.
812
849
  */
813
- addLayer(layerObject: LayerSpecification | CustomLayerInterface, before?: string, options: StyleSetterOptions = {}) {
850
+ addLayer(layerObject: LayerSpecification | CustomLayerInterface, before?: string, options: StyleSetterOptions = {}): this {
814
851
  this._checkLoaded();
815
852
 
816
853
  const id = layerObject.id;
@@ -882,8 +919,8 @@ class Style extends Evented {
882
919
  /**
883
920
  * Moves a layer to a different z-position. The layer will be inserted before the layer with
884
921
  * ID `before`, or appended if `before` is omitted.
885
- * @param {string} id ID of the layer to move
886
- * @param {string} [before] ID of an existing layer to insert before
922
+ * @param id - ID of the layer to move
923
+ * @param before - ID of an existing layer to insert before
887
924
  */
888
925
  moveLayer(id: string, before?: string) {
889
926
  this._checkLoaded();
@@ -917,8 +954,8 @@ class Style extends Evented {
917
954
  *
918
955
  * If no such layer exists, an `error` event is fired.
919
956
  *
920
- * @param {string} id id of the layer to remove
921
- * @fires error
957
+ * @param id - id of the layer to remove
958
+ * @event `error` - Fired if the layer does not exist
922
959
  */
923
960
  removeLayer(id: string) {
924
961
  this._checkLoaded();
@@ -953,8 +990,8 @@ class Style extends Evented {
953
990
  /**
954
991
  * Return the style layer object with the given `id`.
955
992
  *
956
- * @param {string} id - id of the desired layer
957
- * @returns {?Object} a layer, if one with the given `id` exists
993
+ * @param id - id of the desired layer
994
+ * @returns a layer, if one with the given `id` exists
958
995
  */
959
996
  getLayer(id: string): StyleLayer {
960
997
  return this._layers[id];
@@ -963,8 +1000,8 @@ class Style extends Evented {
963
1000
  /**
964
1001
  * checks if a specific layer is present within the style.
965
1002
  *
966
- * @param {string} id - id of the desired layer
967
- * @returns {boolean} a boolean specifying if the given layer is present
1003
+ * @param id - the id of the desired layer
1004
+ * @returns a boolean specifying if the given layer is present
968
1005
  */
969
1006
  hasLayer(id: string): boolean {
970
1007
  return id in this._layers;
@@ -1019,10 +1056,10 @@ class Style extends Evented {
1019
1056
 
1020
1057
  /**
1021
1058
  * Get a layer's filter object
1022
- * @param {string} layer the layer to inspect
1023
- * @returns {*} the layer's filter, if any
1059
+ * @param layer - the layer to inspect
1060
+ * @returns the layer's filter, if any
1024
1061
  */
1025
- getFilter(layer: string) {
1062
+ getFilter(layer: string): FilterSpecification | void {
1026
1063
  return clone(this.getLayer(layer).filter);
1027
1064
  }
1028
1065
 
@@ -1043,9 +1080,9 @@ class Style extends Evented {
1043
1080
 
1044
1081
  /**
1045
1082
  * Get a layout property's value from a given layer
1046
- * @param {string} layerId the layer to inspect
1047
- * @param {string} name the name of the layout property
1048
- * @returns {*} the property value
1083
+ * @param layerId - the layer to inspect
1084
+ * @param name - the name of the layout property
1085
+ * @returns the property value
1049
1086
  */
1050
1087
  getLayoutProperty(layerId: string, name: string) {
1051
1088
  const layer = this.getLayer(layerId);
@@ -1160,6 +1197,11 @@ class Style extends Evented {
1160
1197
  }
1161
1198
 
1162
1199
  serialize(): StyleSpecification {
1200
+ // We return undefined before we're loaded, following the pattern of Map.getStyle() before
1201
+ // the Style object is initialized.
1202
+ // Internally, Style._validate() calls Style.serialize() but callers are responsible for
1203
+ // calling Style._checkLoaded() first if their validation requires the style to be loaded.
1204
+ if (!this._loaded) return;
1163
1205
 
1164
1206
  const sources = mapObject(this.sourceCaches, (source) => source.serialize());
1165
1207
  const layers = this._serializeByIds(this._order);
@@ -1266,7 +1308,7 @@ class Style extends Evented {
1266
1308
  return features;
1267
1309
  }
1268
1310
 
1269
- queryRenderedFeatures(queryGeometry: any, params: any, transform: Transform) {
1311
+ queryRenderedFeatures(queryGeometry: any, params: QueryRenderedFeaturesOptions, transform: Transform) {
1270
1312
  if (params && params.filter) {
1271
1313
  this._validate(validateStyle.filter, 'queryRenderedFeatures.filter', params.filter, null, params);
1272
1314
  }
@@ -1328,11 +1370,7 @@ class Style extends Evented {
1328
1370
 
1329
1371
  querySourceFeatures(
1330
1372
  sourceID: string,
1331
- params?: {
1332
- sourceLayer?: string;
1333
- filter?: FilterSpecification;
1334
- validate?: boolean;
1335
- }
1373
+ params?: QuerySourceFeatureOptions
1336
1374
  ) {
1337
1375
  if (params && params.filter) {
1338
1376
  this._validate(validateStyle.filter, 'querySourceFeatures.filter', params.filter, null, params);
@@ -1342,11 +1380,11 @@ class Style extends Evented {
1342
1380
  }
1343
1381
 
1344
1382
  addSourceType(name: string, SourceType: SourceClass, callback: Callback<void>) {
1345
- if (Style.getSourceType(name)) {
1383
+ if (getSourceType(name)) {
1346
1384
  return callback(new Error(`A source type called "${name}" already exists.`));
1347
1385
  }
1348
1386
 
1349
- Style.setSourceType(name, SourceType);
1387
+ setSourceType(name, SourceType);
1350
1388
 
1351
1389
  if (!SourceType.workerSourceURL) {
1352
1390
  return callback(null, null);
@@ -1594,10 +1632,10 @@ class Style extends Evented {
1594
1632
  /**
1595
1633
  * Add a sprite.
1596
1634
  *
1597
- * @param {string} id id of the desired sprite
1598
- * @param {string} url url to load the desired sprite from
1599
- * @param {StyleSetterOptions} [options] style setter options
1600
- * @param [completion] completion handler
1635
+ * @param id - The id of the desired sprite
1636
+ * @param url - The url to load the desired sprite from
1637
+ * @param options - The style setter options
1638
+ * @param completion - The completion handler
1601
1639
  */
1602
1640
  addSprite(id: string, url: string, options: StyleSetterOptions = {}, completion?: (err: Error) => void) {
1603
1641
  this._checkLoaded();
@@ -1618,7 +1656,7 @@ class Style extends Evented {
1618
1656
  * Remove a sprite by its id. When the last sprite is removed, the whole `this.stylesheet.sprite` object becomes
1619
1657
  * `undefined`. This falsy `undefined` value later prevents attempts to load the sprite when it's absent.
1620
1658
  *
1621
- * @param id the id of the sprite to remove
1659
+ * @param id - the id of the sprite to remove
1622
1660
  */
1623
1661
  removeSprite(id: string) {
1624
1662
  this._checkLoaded();
@@ -1650,7 +1688,7 @@ class Style extends Evented {
1650
1688
  /**
1651
1689
  * Get the current sprite value.
1652
1690
  *
1653
- * @returns {Array} empty array when no sprite is set; id-url pairs otherwise
1691
+ * @returns empty array when no sprite is set; id-url pairs otherwise
1654
1692
  */
1655
1693
  getSprite() {
1656
1694
  return coerceSpriteToArray(this.stylesheet.sprite);
@@ -1659,9 +1697,9 @@ class Style extends Evented {
1659
1697
  /**
1660
1698
  * Set a new value for the style's sprite.
1661
1699
  *
1662
- * @param {SpriteSpecification} sprite new sprite value
1663
- * @param {StyleSetterOptions} [options] style setter options
1664
- * @param [completion] completion handler
1700
+ * @param sprite - new sprite value
1701
+ * @param options - style setter options
1702
+ * @param completion - the completion handler
1665
1703
  */
1666
1704
  setSprite(sprite: SpriteSpecification, options: StyleSetterOptions = {}, completion?: (err: Error) => void) {
1667
1705
  this._checkLoaded();
@@ -1683,8 +1721,4 @@ class Style extends Evented {
1683
1721
  }
1684
1722
  }
1685
1723
 
1686
- Style.getSourceType = getSourceType;
1687
- Style.setSourceType = setSourceType;
1688
1724
  Style.registerForPluginStateChange = registerForPluginStateChange;
1689
-
1690
- export default Style;
@@ -1,5 +1,8 @@
1
1
  import type {AlphaImage} from '../util/image';
2
2
 
3
+ /**
4
+ * The glyph's metrices
5
+ */
3
6
  export type GlyphMetrics = {
4
7
  width: number;
5
8
  height: number;
@@ -8,6 +11,9 @@ export type GlyphMetrics = {
8
11
  advance: number;
9
12
  };
10
13
 
14
+ /**
15
+ * A style glyph type
16
+ */
11
17
  export type StyleGlyph = {
12
18
  id: number;
13
19
  bitmap: AlphaImage;
@@ -1,7 +1,10 @@
1
1
  import {RGBAImage} from '../util/image';
2
2
 
3
- import type Map from '../ui/map';
3
+ import type {Map} from '../ui/map';
4
4
 
5
+ /**
6
+ * The sprite data
7
+ */
5
8
  export type SpriteOnDemandStyleImage = {
6
9
  width: number;
7
10
  height: number;
@@ -10,6 +13,9 @@ export type SpriteOnDemandStyleImage = {
10
13
  context: CanvasRenderingContext2D;
11
14
  };
12
15
 
16
+ /**
17
+ * The style's image metadata
18
+ */
13
19
  export type StyleImageData = {
14
20
  data: RGBAImage;
15
21
  version?: number;
@@ -18,14 +24,35 @@ export type StyleImageData = {
18
24
  spriteData?: SpriteOnDemandStyleImage;
19
25
  };
20
26
 
27
+ /**
28
+ * The style's image metadata
29
+ */
21
30
  export type StyleImageMetadata = {
31
+ /**
32
+ * The ratio of pixels in the image to physical pixels on the screen
33
+ */
22
34
  pixelRatio: number;
35
+ /**
36
+ * Whether the image should be interpreted as an SDF image
37
+ */
23
38
  sdf: boolean;
39
+ /**
40
+ * If `icon-text-fit` is used in a layer with this image, this option defines the part(s) of the image that can be stretched horizontally.
41
+ */
24
42
  stretchX?: Array<[number, number]>;
43
+ /**
44
+ * If `icon-text-fit` is used in a layer with this image, this option defines the part(s) of the image that can be stretched vertically.
45
+ */
25
46
  stretchY?: Array<[number, number]>;
47
+ /**
48
+ * If `icon-text-fit` is used in a layer with this image, this option defines the part of the image that can be covered by the content in `text-field`.
49
+ */
26
50
  content?: [number, number, number, number];
27
51
  };
28
52
 
53
+ /**
54
+ * the style's image, including data and metedata
55
+ */
29
56
  export type StyleImage = StyleImageData & StyleImageMetadata;
30
57
 
31
58
  /**
@@ -37,11 +64,11 @@ export type StyleImage = StyleImageData & StyleImageMetadata;
37
64
  * {@link StyleImageInterface#render} method. The method is called every frame and
38
65
  * can be used to update the image.
39
66
  *
40
- * @interface StyleImageInterface
41
- * @see [Add an animated icon to the map.](https://maplibre.org/maplibre-gl-js-docs/example/add-image-animated/)
67
+ * @see [Add an animated icon to the map.](https://maplibre.org/maplibre-gl-js/docs/examples/add-image-animated/)
42
68
  *
43
69
  * @example
44
- * var flashingSquare = {
70
+ * ```ts
71
+ * let flashingSquare = {
45
72
  * width: 64,
46
73
  * height: 64,
47
74
  * data: new Uint8Array(64 * 64 * 4),
@@ -55,16 +82,16 @@ export type StyleImage = StyleImageData & StyleImageMetadata;
55
82
  * this.map.triggerRepaint();
56
83
  *
57
84
  * // alternate between black and white based on the time
58
- * var value = Math.round(Date.now() / 1000) % 2 === 0 ? 255 : 0;
85
+ * let value = Math.round(Date.now() / 1000) % 2 === 0 ? 255 : 0;
59
86
  *
60
87
  * // check if image needs to be changed
61
88
  * if (value !== this.previousValue) {
62
89
  * this.previousValue = value;
63
90
  *
64
- * var bytesPerPixel = 4;
65
- * for (var x = 0; x < this.width; x++) {
66
- * for (var y = 0; y < this.height; y++) {
67
- * var offset = (y * this.width + x) * bytesPerPixel;
91
+ * let bytesPerPixel = 4;
92
+ * for (let x = 0; x < this.width; x++) {
93
+ * for (let y = 0; y < this.height; y++) {
94
+ * let offset = (y * this.width + x) * bytesPerPixel;
68
95
  * this.data[offset + 0] = value;
69
96
  * this.data[offset + 1] = value;
70
97
  * this.data[offset + 2] = value;
@@ -79,20 +106,12 @@ export type StyleImage = StyleImageData & StyleImageMetadata;
79
106
  * }
80
107
  *
81
108
  * map.addImage('flashing_square', flashingSquare);
109
+ * ```
82
110
  */
83
111
 
84
112
  export interface StyleImageInterface {
85
- /**
86
- * @property {number} width
87
- */
88
113
  width: number;
89
- /**
90
- * @property {number} height
91
- */
92
114
  height: number;
93
- /**
94
- * @property {Uint8Array | Uint8ClampedArray} data
95
- */
96
115
  data: Uint8Array | Uint8ClampedArray;
97
116
  /**
98
117
  * This method is called once before every frame where the icon will be used.
@@ -104,31 +123,18 @@ export interface StyleImageInterface {
104
123
  * If updates are infrequent it maybe easier to use {@link Map#updateImage} to update
105
124
  * the image instead of implementing this method.
106
125
  *
107
- * @function
108
- * @memberof StyleImageInterface
109
- * @instance
110
- * @name render
111
- * @return {boolean} `true` if this method updated the image. `false` if the image was not changed.
126
+ * @returns `true` if this method updated the image. `false` if the image was not changed.
112
127
  */
113
128
  render?: () => boolean;
114
129
  /**
115
130
  * Optional method called when the layer has been added to the Map with {@link Map#addImage}.
116
131
  *
117
- * @function
118
- * @memberof StyleImageInterface
119
- * @instance
120
- * @name onAdd
121
- * @param {Map} map The Map this custom layer was just added to.
132
+ * @param map - The Map this custom layer was just added to.
122
133
  */
123
134
  onAdd?: (map: Map, id: string) => void;
124
135
  /**
125
136
  * Optional method called when the icon is removed from the map with {@link Map#removeImage}.
126
137
  * This gives the image a chance to clean up resources and event listeners.
127
- *
128
- * @function
129
- * @memberof StyleImageInterface
130
- * @instance
131
- * @name onRemove
132
138
  */
133
139
  onRemove?: () => void;
134
140
  }
@@ -1,4 +1,4 @@
1
- import StyleLayer from '../style_layer';
1
+ import {StyleLayer} from '../style_layer';
2
2
 
3
3
  import properties, {BackgroundPaintPropsPossiblyEvaluated} from './background_style_layer_properties.g';
4
4
  import {Transitionable, Transitioning, PossiblyEvaluated} from '../properties';
@@ -6,7 +6,7 @@ import {Transitionable, Transitioning, PossiblyEvaluated} from '../properties';
6
6
  import type {BackgroundPaintProps} from './background_style_layer_properties.g';
7
7
  import type {LayerSpecification} from '@maplibre/maplibre-gl-style-spec';
8
8
 
9
- class BackgroundStyleLayer extends StyleLayer {
9
+ export class BackgroundStyleLayer extends StyleLayer {
10
10
  _transitionablePaint: Transitionable<BackgroundPaintProps>;
11
11
  _transitioningPaint: Transitioning<BackgroundPaintProps>;
12
12
  paint: PossiblyEvaluated<BackgroundPaintProps, BackgroundPaintPropsPossiblyEvaluated>;
@@ -15,5 +15,3 @@ class BackgroundStyleLayer extends StyleLayer {
15
15
  super(layer, properties);
16
16
  }
17
17
  }
18
-
19
- export default BackgroundStyleLayer;
@@ -1,6 +1,6 @@
1
- import StyleLayer from '../style_layer';
1
+ import {StyleLayer} from '../style_layer';
2
2
 
3
- import CircleBucket from '../../data/bucket/circle_bucket';
3
+ import {CircleBucket} from '../../data/bucket/circle_bucket';
4
4
  import {polygonIntersectsBufferedPoint} from '../../util/intersection_tests';
5
5
  import {getMaximumPaintValue, translateDistance, translate} from '../query_utils';
6
6
  import properties, {CircleLayoutPropsPossiblyEvaluated, CirclePaintPropsPossiblyEvaluated} from './circle_style_layer_properties.g';
@@ -8,12 +8,15 @@ import {Transitionable, Transitioning, Layout, PossiblyEvaluated} from '../prope
8
8
  import {mat4, vec4} from 'gl-matrix';
9
9
  import Point from '@mapbox/point-geometry';
10
10
  import type {FeatureState, LayerSpecification} from '@maplibre/maplibre-gl-style-spec';
11
- import type Transform from '../../geo/transform';
11
+ import type {Transform} from '../../geo/transform';
12
12
  import type {Bucket, BucketParameters} from '../../data/bucket';
13
13
  import type {CircleLayoutProps, CirclePaintProps} from './circle_style_layer_properties.g';
14
14
  import type {VectorTileFeature} from '@mapbox/vector-tile';
15
15
 
16
- class CircleStyleLayer extends StyleLayer {
16
+ /**
17
+ * A style layer that defines a circle
18
+ */
19
+ export class CircleStyleLayer extends StyleLayer {
17
20
  _unevaluatedLayout: Layout<CircleLayoutProps>;
18
21
  layout: PossiblyEvaluated<CircleLayoutProps, CircleLayoutPropsPossiblyEvaluated>;
19
22
 
@@ -93,5 +96,3 @@ function projectQueryGeometry(queryGeometry: Array<Point>, pixelPosMatrix: mat4)
93
96
  return projectPoint(p, pixelPosMatrix);
94
97
  });
95
98
  }
96
-
97
- export default CircleStyleLayer;