maplibre-gl 2.1.1 → 2.1.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 (305) hide show
  1. package/build/{banner.js → banner.ts} +1 -1
  2. package/build/generate-query-test-fixtures.ts +123 -0
  3. package/build/generate-shaders.ts +35 -0
  4. package/build/generate-struct-arrays.ts +7 -7
  5. package/build/generate-style-code.ts +8 -8
  6. package/build/generate-style-spec.ts +5 -4
  7. package/build/generate-typings.ts +16 -0
  8. package/build/readme.md +8 -18
  9. package/build/release-notes.js +9 -13
  10. package/build/{rollup_plugin_minify_style_spec.js → rollup_plugin_minify_style_spec.ts} +4 -3
  11. package/build/{rollup_plugins.js → rollup_plugins.ts} +11 -26
  12. package/dist/maplibre-gl-dev.js +522 -226
  13. package/dist/maplibre-gl.css +1 -1
  14. package/dist/maplibre-gl.d.ts +1536 -1010
  15. package/dist/maplibre-gl.js +3 -3
  16. package/dist/maplibre-gl.js.map +1 -1
  17. package/package.json +40 -61
  18. package/src/data/{array_types.ts → array_types.g.ts} +0 -0
  19. package/src/data/bucket/circle_bucket.ts +1 -1
  20. package/src/data/bucket/fill_bucket.test.ts +1 -1
  21. package/src/data/bucket/fill_bucket.ts +4 -4
  22. package/src/data/bucket/fill_extrusion_bucket.ts +1 -1
  23. package/src/data/bucket/line_bucket.test.ts +1 -1
  24. package/src/data/bucket/line_bucket.ts +6 -6
  25. package/src/data/bucket/symbol_bucket.test.ts +16 -16
  26. package/src/data/bucket/symbol_bucket.ts +53 -53
  27. package/src/data/bucket.ts +43 -43
  28. package/src/data/dem_data.ts +12 -12
  29. package/src/data/evaluation_feature.ts +10 -10
  30. package/src/data/feature_index.ts +37 -37
  31. package/src/data/feature_position_map.ts +5 -5
  32. package/src/data/index_array_type.ts +1 -1
  33. package/src/data/load_geometry.test.ts +1 -1
  34. package/src/data/program_configuration.ts +46 -46
  35. package/src/data/segment.ts +14 -14
  36. package/src/geo/edge_insets.ts +2 -2
  37. package/src/geo/lng_lat.ts +4 -4
  38. package/src/geo/lng_lat_bounds.ts +35 -35
  39. package/src/geo/mercator_coordinate.ts +5 -5
  40. package/src/geo/transform.test.ts +1 -1
  41. package/src/geo/transform.ts +14 -14
  42. package/src/gl/context.ts +3 -3
  43. package/src/gl/types.ts +19 -19
  44. package/src/gl/value.ts +6 -6
  45. package/src/gl/vertex_buffer.test.ts +1 -1
  46. package/src/index.ts +24 -9
  47. package/src/render/draw_circle.ts +8 -8
  48. package/src/render/draw_collision_debug.ts +5 -5
  49. package/src/render/draw_line.ts +4 -4
  50. package/src/render/draw_symbol.ts +21 -21
  51. package/src/render/glyph_atlas.ts +12 -12
  52. package/src/render/glyph_manager.test.ts +10 -21
  53. package/src/render/glyph_manager.ts +33 -32
  54. package/src/render/image_manager.ts +4 -4
  55. package/src/render/painter.ts +11 -11
  56. package/src/render/program/background_program.ts +29 -29
  57. package/src/render/program/circle_program.ts +10 -10
  58. package/src/render/program/clipping_mask_program.ts +1 -1
  59. package/src/render/program/collision_program.ts +9 -9
  60. package/src/render/program/debug_program.ts +4 -4
  61. package/src/render/program/fill_extrusion_program.ts +31 -31
  62. package/src/render/program/fill_program.ts +29 -29
  63. package/src/render/program/heatmap_program.ts +12 -12
  64. package/src/render/program/hillshade_program.ts +12 -12
  65. package/src/render/program/line_program.ts +38 -38
  66. package/src/render/program/pattern.ts +28 -28
  67. package/src/render/program/raster_program.ts +21 -21
  68. package/src/render/program/symbol_program.ts +96 -96
  69. package/src/render/program.ts +25 -25
  70. package/src/render/texture.ts +9 -9
  71. package/src/render/uniform_binding.ts +1 -1
  72. package/src/render/vertex_array_object.ts +13 -13
  73. package/src/shaders/_prelude.fragment.glsl.g.ts +2 -0
  74. package/src/shaders/_prelude.vertex.glsl.g.ts +2 -0
  75. package/src/shaders/background.fragment.glsl.g.ts +2 -0
  76. package/src/shaders/background.vertex.glsl.g.ts +2 -0
  77. package/src/shaders/background_pattern.fragment.glsl.g.ts +2 -0
  78. package/src/shaders/background_pattern.vertex.glsl.g.ts +2 -0
  79. package/src/shaders/circle.fragment.glsl.g.ts +2 -0
  80. package/src/shaders/circle.vertex.glsl.g.ts +2 -0
  81. package/src/shaders/clipping_mask.fragment.glsl.g.ts +2 -0
  82. package/src/shaders/clipping_mask.vertex.glsl.g.ts +2 -0
  83. package/src/shaders/collision_box.fragment.glsl.g.ts +2 -0
  84. package/src/shaders/collision_box.vertex.glsl.g.ts +2 -0
  85. package/src/shaders/collision_circle.fragment.glsl.g.ts +2 -0
  86. package/src/shaders/collision_circle.vertex.glsl.g.ts +2 -0
  87. package/src/shaders/debug.fragment.glsl.g.ts +2 -0
  88. package/src/shaders/debug.vertex.glsl.g.ts +2 -0
  89. package/src/shaders/fill.fragment.glsl.g.ts +2 -0
  90. package/src/shaders/fill.vertex.glsl.g.ts +2 -0
  91. package/src/shaders/fill_extrusion.fragment.glsl.g.ts +2 -0
  92. package/src/shaders/fill_extrusion.vertex.glsl.g.ts +2 -0
  93. package/src/shaders/fill_extrusion_pattern.fragment.glsl.g.ts +2 -0
  94. package/src/shaders/fill_extrusion_pattern.vertex.glsl.g.ts +2 -0
  95. package/src/shaders/fill_outline.fragment.glsl.g.ts +2 -0
  96. package/src/shaders/fill_outline.vertex.glsl.g.ts +2 -0
  97. package/src/shaders/fill_outline_pattern.fragment.glsl.g.ts +2 -0
  98. package/src/shaders/fill_outline_pattern.vertex.glsl.g.ts +2 -0
  99. package/src/shaders/fill_pattern.fragment.glsl.g.ts +2 -0
  100. package/src/shaders/fill_pattern.vertex.glsl.g.ts +2 -0
  101. package/src/shaders/heatmap.fragment.glsl.g.ts +2 -0
  102. package/src/shaders/heatmap.vertex.glsl.g.ts +2 -0
  103. package/src/shaders/heatmap_texture.fragment.glsl.g.ts +2 -0
  104. package/src/shaders/heatmap_texture.vertex.glsl.g.ts +2 -0
  105. package/src/shaders/hillshade.fragment.glsl.g.ts +2 -0
  106. package/src/shaders/hillshade.vertex.glsl.g.ts +2 -0
  107. package/src/shaders/hillshade_prepare.fragment.glsl.g.ts +2 -0
  108. package/src/shaders/hillshade_prepare.vertex.glsl.g.ts +2 -0
  109. package/src/shaders/line.fragment.glsl.g.ts +2 -0
  110. package/src/shaders/line.vertex.glsl.g.ts +2 -0
  111. package/src/shaders/line_gradient.fragment.glsl.g.ts +2 -0
  112. package/src/shaders/line_gradient.vertex.glsl.g.ts +2 -0
  113. package/src/shaders/line_pattern.fragment.glsl.g.ts +2 -0
  114. package/src/shaders/line_pattern.vertex.glsl.g.ts +2 -0
  115. package/src/shaders/line_sdf.fragment.glsl.g.ts +2 -0
  116. package/src/shaders/line_sdf.vertex.glsl.g.ts +2 -0
  117. package/src/shaders/raster.fragment.glsl.g.ts +2 -0
  118. package/src/shaders/raster.vertex.glsl.g.ts +2 -0
  119. package/src/shaders/shaders.ts +52 -55
  120. package/src/shaders/symbol_icon.fragment.glsl.g.ts +2 -0
  121. package/src/shaders/symbol_icon.vertex.glsl.g.ts +2 -0
  122. package/src/shaders/symbol_sdf.fragment.glsl.g.ts +2 -0
  123. package/src/shaders/symbol_sdf.vertex.glsl.g.ts +2 -0
  124. package/src/shaders/symbol_text_and_icon.fragment.glsl.g.ts +2 -0
  125. package/src/shaders/symbol_text_and_icon.vertex.glsl.g.ts +2 -0
  126. package/src/source/canvas_source.test.ts +11 -12
  127. package/src/source/canvas_source.ts +4 -4
  128. package/src/source/geojson_worker_source.ts +23 -23
  129. package/src/source/geojson_wrapper.ts +8 -8
  130. package/src/source/image_source.test.ts +2 -2
  131. package/src/source/image_source.ts +6 -6
  132. package/src/source/pixels_to_tile_units.ts +6 -6
  133. package/src/source/query_features.ts +20 -20
  134. package/src/source/raster_dem_tile_source.test.ts +2 -2
  135. package/src/source/raster_tile_source.test.ts +2 -2
  136. package/src/source/rtl_text_plugin.ts +10 -10
  137. package/src/source/source.ts +29 -29
  138. package/src/source/source_cache.test.ts +32 -0
  139. package/src/source/source_cache.ts +7 -5
  140. package/src/source/source_state.ts +1 -1
  141. package/src/source/tile.test.ts +3 -3
  142. package/src/source/tile.ts +15 -15
  143. package/src/source/tile_cache.ts +6 -6
  144. package/src/source/tile_id.test.ts +0 -1
  145. package/src/source/vector_tile_source.test.ts +3 -3
  146. package/src/source/vector_tile_source.ts +1 -1
  147. package/src/source/vector_tile_worker_source.test.ts +4 -4
  148. package/src/source/vector_tile_worker_source.ts +5 -5
  149. package/src/source/worker.test.ts +1 -1
  150. package/src/source/worker.ts +22 -22
  151. package/src/source/worker_source.ts +56 -56
  152. package/src/source/worker_tile.ts +4 -4
  153. package/src/style/evaluation_parameters.ts +3 -3
  154. package/src/style/format_section_override.test.ts +1 -1
  155. package/src/style/light.ts +10 -10
  156. package/src/style/load_glyph_range.test.ts +3 -3
  157. package/src/style/load_glyph_range.ts +6 -6
  158. package/src/style/load_sprite.ts +4 -4
  159. package/src/style/pauseable_placement.ts +1 -1
  160. package/src/style/properties.ts +69 -69
  161. package/src/style/query_utils.ts +7 -7
  162. package/src/style/style.test.ts +2 -2
  163. package/src/style/style.ts +29 -29
  164. package/src/style/style_glyph.ts +8 -8
  165. package/src/style/style_image.ts +58 -58
  166. package/src/style/style_layer/background_style_layer.ts +2 -2
  167. package/src/style/style_layer/{background_style_layer_properties.ts → background_style_layer_properties.g.ts} +0 -0
  168. package/src/style/style_layer/circle_style_layer.ts +10 -10
  169. package/src/style/style_layer/{circle_style_layer_properties.ts → circle_style_layer_properties.g.ts} +0 -0
  170. package/src/style/style_layer/custom_style_layer.ts +17 -17
  171. package/src/style/style_layer/fill_extrusion_style_layer.ts +10 -10
  172. package/src/style/style_layer/{fill_extrusion_style_layer_properties.ts → fill_extrusion_style_layer_properties.g.ts} +0 -0
  173. package/src/style/style_layer/fill_style_layer.ts +9 -9
  174. package/src/style/style_layer/{fill_style_layer_properties.ts → fill_style_layer_properties.g.ts} +0 -0
  175. package/src/style/style_layer/heatmap_style_layer.ts +2 -2
  176. package/src/style/style_layer/{heatmap_style_layer_properties.ts → heatmap_style_layer_properties.g.ts} +0 -0
  177. package/src/style/style_layer/hillshade_style_layer.ts +2 -2
  178. package/src/style/style_layer/{hillshade_style_layer_properties.ts → hillshade_style_layer_properties.g.ts} +0 -0
  179. package/src/style/style_layer/line_style_layer.ts +9 -9
  180. package/src/style/style_layer/{line_style_layer_properties.ts → line_style_layer_properties.g.ts} +0 -0
  181. package/src/style/style_layer/raster_style_layer.ts +2 -2
  182. package/src/style/style_layer/{raster_style_layer_properties.ts → raster_style_layer_properties.g.ts} +0 -0
  183. package/src/style/style_layer/symbol_style_layer.ts +7 -7
  184. package/src/style/style_layer/{symbol_style_layer_properties.ts → symbol_style_layer_properties.g.ts} +0 -0
  185. package/src/style/style_layer.ts +10 -10
  186. package/src/style/style_layer_index.ts +3 -3
  187. package/src/style/validate_style.ts +15 -15
  188. package/src/style-spec/error/validation_error.ts +1 -1
  189. package/src/style-spec/expression/compound_expression.ts +3 -3
  190. package/src/style-spec/expression/definitions/format.ts +11 -11
  191. package/src/style-spec/expression/definitions/interpolate.ts +5 -5
  192. package/src/style-spec/expression/definitions/match.ts +2 -2
  193. package/src/style-spec/expression/definitions/number_format.ts +11 -11
  194. package/src/style-spec/expression/expression.ts +8 -8
  195. package/src/style-spec/expression/index.ts +97 -97
  196. package/src/style-spec/expression/parsing_context.ts +11 -11
  197. package/src/style-spec/expression/types/collator.ts +9 -9
  198. package/src/style-spec/expression/types/resolved_image.ts +2 -2
  199. package/src/style-spec/expression/types.ts +14 -14
  200. package/src/style-spec/expression/values.ts +1 -1
  201. package/src/style-spec/feature_filter/index.ts +66 -66
  202. package/src/style-spec/function/convert.ts +3 -3
  203. package/src/style-spec/style-spec.ts +44 -44
  204. package/src/style-spec/util/color_spaces.ts +8 -8
  205. package/src/style-spec/util/result.ts +4 -4
  206. package/src/style-spec/validate/validate_filter.ts +58 -58
  207. package/src/style-spec/validate/validate_source.ts +63 -63
  208. package/src/style-spec/visit.ts +11 -11
  209. package/src/symbol/collision_feature.test.ts +1 -1
  210. package/src/symbol/collision_feature.ts +10 -10
  211. package/src/symbol/collision_index.ts +26 -26
  212. package/src/symbol/cross_tile_symbol_index.ts +17 -17
  213. package/src/symbol/get_anchors.ts +16 -16
  214. package/src/symbol/grid_index.ts +7 -7
  215. package/src/symbol/placement.ts +72 -72
  216. package/src/symbol/projection.ts +30 -30
  217. package/src/symbol/quads.ts +30 -30
  218. package/src/symbol/shaping.ts +160 -160
  219. package/src/symbol/symbol_layout.ts +119 -119
  220. package/src/symbol/symbol_size.ts +29 -29
  221. package/src/symbol/symbol_style_layer.test.ts +1 -1
  222. package/src/types/cancelable.ts +1 -1
  223. package/src/types/tilejson.ts +13 -13
  224. package/src/ui/anchor.ts +1 -1
  225. package/src/ui/camera.test.ts +5 -5
  226. package/src/ui/camera.ts +18 -18
  227. package/src/ui/control/attribution_control.test.ts +51 -16
  228. package/src/ui/control/attribution_control.ts +35 -16
  229. package/src/ui/control/control.ts +40 -40
  230. package/src/ui/control/fullscreen_control.ts +1 -1
  231. package/src/ui/control/geolocate_control.test.ts +1 -1
  232. package/src/ui/control/geolocate_control.ts +102 -102
  233. package/src/ui/control/logo_control.test.ts +4 -4
  234. package/src/ui/control/navigation_control.ts +3 -3
  235. package/src/ui/control/scale_control.test.ts +2 -2
  236. package/src/ui/control/scale_control.ts +5 -5
  237. package/src/ui/events.ts +289 -200
  238. package/src/ui/handler/box_zoom.test.ts +1 -1
  239. package/src/ui/handler/box_zoom.ts +1 -1
  240. package/src/ui/handler/dblclick_zoom.test.ts +1 -1
  241. package/src/ui/handler/drag_pan.test.ts +1 -1
  242. package/src/ui/handler/drag_rotate.test.ts +1 -1
  243. package/src/ui/handler/keyboard.test.ts +1 -1
  244. package/src/ui/handler/keyboard.ts +51 -51
  245. package/src/ui/handler/map_event.test.ts +1 -1
  246. package/src/ui/handler/map_event.ts +1 -1
  247. package/src/ui/handler/mouse.ts +1 -1
  248. package/src/ui/handler/mouse_rotate.test.ts +1 -1
  249. package/src/ui/handler/scroll_zoom.test.ts +1 -1
  250. package/src/ui/handler/scroll_zoom.ts +9 -9
  251. package/src/ui/handler/shim/drag_pan.ts +4 -4
  252. package/src/ui/handler/shim/drag_rotate.ts +1 -1
  253. package/src/ui/handler/shim/touch_zoom_rotate.ts +1 -1
  254. package/src/ui/handler/tap_recognizer.ts +4 -4
  255. package/src/ui/handler/touch_pan.ts +2 -2
  256. package/src/ui/handler/touch_zoom_rotate.test.ts +1 -1
  257. package/src/ui/handler/touch_zoom_rotate.ts +1 -1
  258. package/src/ui/handler_inertia.ts +6 -6
  259. package/src/ui/handler_manager.ts +44 -44
  260. package/src/ui/map/isMoving.test.ts +1 -1
  261. package/src/ui/map/isRotating.test.ts +1 -1
  262. package/src/ui/map/isZooming.test.ts +1 -1
  263. package/src/ui/map.test.ts +10 -4
  264. package/src/ui/map.ts +106 -101
  265. package/src/ui/map_events.test.ts +1 -1
  266. package/src/ui/marker.test.ts +12 -12
  267. package/src/ui/marker.ts +37 -37
  268. package/src/ui/popup.test.ts +7 -7
  269. package/src/ui/popup.ts +9 -9
  270. package/src/util/actor.test.ts +41 -10
  271. package/src/util/actor.ts +8 -8
  272. package/src/util/ajax.test.ts +29 -21
  273. package/src/util/ajax.ts +51 -30
  274. package/src/util/browser.ts +1 -1
  275. package/src/util/classify_rings.test.ts +1 -1
  276. package/src/util/color_ramp.ts +5 -5
  277. package/src/util/config.ts +2 -2
  278. package/src/util/dispatcher.ts +1 -1
  279. package/src/util/dom.ts +2 -2
  280. package/src/util/evented.ts +1 -1
  281. package/src/util/find_pole_of_inaccessibility.ts +3 -3
  282. package/src/util/image.ts +5 -5
  283. package/src/util/performance.ts +7 -7
  284. package/src/util/request_manager.ts +4 -4
  285. package/src/util/resolve_tokens.ts +4 -4
  286. package/src/util/struct_array.test.ts +1 -1
  287. package/src/util/struct_array.ts +15 -15
  288. package/src/util/task_queue.ts +3 -3
  289. package/src/util/tile_request_cache.ts +3 -3
  290. package/src/util/transferable_grid_index.ts +4 -4
  291. package/src/util/util.ts +8 -8
  292. package/src/util/web_worker.ts +4 -68
  293. package/src/util/web_worker_transfer.test.ts +3 -0
  294. package/src/util/web_worker_transfer.ts +21 -17
  295. package/src/util/worker_pool.ts +1 -1
  296. package/build/.eslintrc +0 -21
  297. package/build/glsl_to_js.js +0 -12
  298. package/build/post-ts-build.js +0 -43
  299. package/build/release-notes.md.ejs +0 -8
  300. package/build/test/build-tape.js +0 -17
  301. package/build/web_worker_replacement.js +0 -5
  302. package/dist/package.json +0 -1
  303. package/src/style-spec/validate_spec.test.ts +0 -29
  304. package/src/symbol/shaping.test.ts +0 -392
  305. package/src/types/glsl.d.ts +0 -4
package/src/ui/map.ts CHANGED
@@ -59,49 +59,49 @@ import type {ControlPosition, IControl} from './control/control';
59
59
  /* eslint-enable no-use-before-define */
60
60
 
61
61
  export type MapOptions = {
62
- hash?: boolean | string;
63
- interactive?: boolean;
64
- container: HTMLElement | string;
65
- bearingSnap?: number;
66
- attributionControl?: boolean;
67
- customAttribution?: string | Array<string>;
68
- logoPosition?: ControlPosition;
69
- failIfMajorPerformanceCaveat?: boolean;
70
- preserveDrawingBuffer?: boolean;
71
- antialias?: boolean;
72
- refreshExpiredTiles?: boolean;
73
- maxBounds?: LngLatBoundsLike;
74
- scrollZoom?: boolean;
75
- minZoom?: number | null;
76
- maxZoom?: number | null;
77
- minPitch?: number | null;
78
- maxPitch?: number | null;
79
- boxZoom?: boolean;
80
- dragRotate?: boolean;
81
- dragPan?: DragPanOptions | boolean;
82
- keyboard?: boolean;
83
- doubleClickZoom?: boolean;
84
- touchZoomRotate?: boolean;
85
- touchPitch?: boolean;
86
- trackResize?: boolean;
87
- center?: LngLatLike;
88
- zoom?: number;
89
- bearing?: number;
90
- pitch?: number;
91
- renderWorldCopies?: boolean;
92
- maxTileCacheSize?: number;
93
- transformRequest?: RequestTransformFunction;
94
- locale?: any;
95
- fadeDuration?: number;
96
- crossSourceCollisions?: boolean;
97
- collectResourceTiming?: boolean;
98
- clickTolerance?: number;
99
- bounds?: LngLatBoundsLike;
100
- fitBoundsOptions?: Object;
101
- localIdeographFontFamily?: string;
102
- style: StyleSpecification | string;
103
- pitchWithRotate?: boolean;
104
- pixelRatio?: number;
62
+ hash?: boolean | string;
63
+ interactive?: boolean;
64
+ container: HTMLElement | string;
65
+ bearingSnap?: number;
66
+ attributionControl?: boolean;
67
+ customAttribution?: string | Array<string>;
68
+ logoPosition?: ControlPosition;
69
+ failIfMajorPerformanceCaveat?: boolean;
70
+ preserveDrawingBuffer?: boolean;
71
+ antialias?: boolean;
72
+ refreshExpiredTiles?: boolean;
73
+ maxBounds?: LngLatBoundsLike;
74
+ scrollZoom?: boolean;
75
+ minZoom?: number | null;
76
+ maxZoom?: number | null;
77
+ minPitch?: number | null;
78
+ maxPitch?: number | null;
79
+ boxZoom?: boolean;
80
+ dragRotate?: boolean;
81
+ dragPan?: DragPanOptions | boolean;
82
+ keyboard?: boolean;
83
+ doubleClickZoom?: boolean;
84
+ touchZoomRotate?: boolean;
85
+ touchPitch?: boolean;
86
+ trackResize?: boolean;
87
+ center?: LngLatLike;
88
+ zoom?: number;
89
+ bearing?: number;
90
+ pitch?: number;
91
+ renderWorldCopies?: boolean;
92
+ maxTileCacheSize?: number;
93
+ transformRequest?: RequestTransformFunction;
94
+ locale?: any;
95
+ fadeDuration?: number;
96
+ crossSourceCollisions?: boolean;
97
+ collectResourceTiming?: boolean;
98
+ clickTolerance?: number;
99
+ bounds?: LngLatBoundsLike;
100
+ fitBoundsOptions?: Object;
101
+ localIdeographFontFamily?: string;
102
+ style: StyleSpecification | string;
103
+ pitchWithRotate?: boolean;
104
+ pixelRatio?: number;
105
105
  };
106
106
 
107
107
  // See article here: https://medium.com/terria/typescript-transforming-optional-properties-to-required-properties-that-may-be-undefined-7482cb4e1585
@@ -212,19 +212,19 @@ const defaultOptions = {
212
212
  * @param {boolean} [options.doubleClickZoom=true] If `true`, the "double click to zoom" interaction is enabled (see {@link DoubleClickZoomHandler}).
213
213
  * @param {boolean|Object} [options.touchZoomRotate=true] If `true`, the "pinch to rotate and zoom" interaction is enabled. An `Object` value is passed as options to {@link TouchZoomRotateHandler#enable}.
214
214
  * @param {boolean|Object} [options.touchPitch=true] If `true`, the "drag to pitch" interaction is enabled. An `Object` value is passed as options to {@link TouchPitchHandler#enable}.
215
- * @param {boolean} [options.trackResize=true] If `true`, the map will automatically resize when the browser window resizes.
215
+ * @param {boolean} [options.trackResize=true] If `true`, the map will automatically resize when the browser window resizes.
216
216
  * @param {LngLatLike} [options.center=[0, 0]] The initial geographical centerpoint of the map. If `center` is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `[0, 0]` Note: MapLibre GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match GeoJSON.
217
217
  * @param {number} [options.zoom=0] The initial zoom level of the map. If `zoom` is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.
218
218
  * @param {number} [options.bearing=0] The initial bearing (rotation) of the map, measured in degrees counter-clockwise from north. If `bearing` is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`.
219
219
  * @param {number} [options.pitch=0] The initial pitch (tilt) of the map, measured in degrees away from the plane of the screen (0-85). If `pitch` is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to `0`. Values greater than 60 degrees are experimental and may result in rendering issues. If you encounter any, please raise an issue with details in the MapLibre project.
220
220
  * @param {LngLatBoundsLike} [options.bounds] The initial bounds of the map. If `bounds` is specified, it overrides `center` and `zoom` constructor options.
221
221
  * @param {Object} [options.fitBoundsOptions] A {@link Map#fitBounds} options object to use _only_ when fitting the initial `bounds` provided above.
222
- * @param {boolean} [options.renderWorldCopies=true] If `true`, multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to `false`:
222
+ * @param {boolean} [options.renderWorldCopies=true] If `true`, multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to `false`:
223
223
  * - When the map is zoomed out far enough that a single representation of the world does not fill the map's entire
224
224
  * container, there will be blank space beyond 180 and -180 degrees longitude.
225
225
  * - Features that cross 180 and -180 degrees longitude will be cut in two (with one portion on the right edge of the
226
226
  * map and the other on the left edge of the map) at every zoom level.
227
- * @param {number} [options.maxTileCacheSize=null] The maximum number of tiles stored in the tile cache for a given source. If omitted, the cache will be dynamically sized based on the current viewport.
227
+ * @param {number} [options.maxTileCacheSize=null] The maximum number of tiles stored in the tile cache for a given source. If omitted, the cache will be dynamically sized based on the current viewport.
228
228
  * @param {string} [options.localIdeographFontFamily='sans-serif'] Defines a CSS
229
229
  * font-family for locally overriding generation of glyphs in the 'CJK Unified Ideographs', 'Hiragana', 'Katakana' and 'Hangul Syllables' ranges.
230
230
  * In these ranges, font settings from the map's style will be ignored, except for font-weight keywords (light/regular/medium/bold).
@@ -476,6 +476,9 @@ class Map extends Camera {
476
476
  this.on('dataloading', (event: MapDataEvent) => {
477
477
  this.fire(new Event(`${event.dataType}dataloading`, event));
478
478
  });
479
+ this.on('dataabort', (event: MapDataEvent) => {
480
+ this.fire(new Event('sourcedataabort', event));
481
+ });
479
482
  }
480
483
 
481
484
  /*
@@ -1018,6 +1021,8 @@ class Map extends Camera {
1018
1021
  * | [`styledataloading`](#map.event:styledataloading) | |
1019
1022
  * | [`sourcedataloading`](#map.event:sourcedataloading) | |
1020
1023
  * | [`styleimagemissing`](#map.event:styleimagemissing) | |
1024
+ * | [`dataabort`](#map.event:dataabort) | |
1025
+ * | [`sourcedataabort`](#map.event:sourcedataabort) | |
1021
1026
  *
1022
1027
  * @param {string | Listener} layerIdOrListener The ID of a style layer or a listener if no ID is provided. Event will only be triggered if its location
1023
1028
  * is within a visible feature in this layer. The event will have a `features` property containing
@@ -1338,9 +1343,9 @@ class Map extends Camera {
1338
1343
  *
1339
1344
  */
1340
1345
  querySourceFeatures(sourceId: string, parameters?: {
1341
- sourceLayer: string;
1342
- filter: Array<any>;
1343
- validate?: boolean;
1346
+ sourceLayer: string;
1347
+ filter: Array<any>;
1348
+ validate?: boolean;
1344
1349
  } | null) {
1345
1350
  return this.style.querySourceFeatures(sourceId, parameters);
1346
1351
  }
@@ -1372,7 +1377,7 @@ class Map extends Camera {
1372
1377
  *
1373
1378
  */
1374
1379
  setStyle(style: StyleSpecification | string | null, options?: {
1375
- diff?: boolean;
1380
+ diff?: boolean;
1376
1381
  } & StyleOptions) {
1377
1382
  options = extend({}, {localIdeographFontFamily: this._localIdeographFontFamily}, options);
1378
1383
 
@@ -1388,10 +1393,10 @@ class Map extends Camera {
1388
1393
  /**
1389
1394
  * Updates the requestManager's transform request with a new function
1390
1395
  *
1391
- * @param transformRequest A callback run before the Map makes a request for an external URL. The callback can be used to modify the url, set headers, or set the credentials property for cross-origin requests.
1396
+ * @param transformRequest A callback run before the Map makes a request for an external URL. The callback can be used to modify the url, set headers, or set the credentials property for cross-origin requests.
1392
1397
  * Expected to return an object with a `url` property and optionally `headers` and `credentials` properties
1393
1398
  *
1394
- * @returns {Map} `this`
1399
+ * @returns {Map} `this`
1395
1400
  *
1396
1401
  * @example
1397
1402
  * map.setTransformRequest((url: string, resourceType: string) => {});
@@ -1411,7 +1416,7 @@ class Map extends Camera {
1411
1416
  }
1412
1417
 
1413
1418
  _updateStyle(style: StyleSpecification | string | null, options?: {
1414
- diff?: boolean;
1419
+ diff?: boolean;
1415
1420
  } & StyleOptions) {
1416
1421
  if (this.style) {
1417
1422
  this.style.setEventedParent(null);
@@ -1445,7 +1450,7 @@ class Map extends Camera {
1445
1450
  }
1446
1451
 
1447
1452
  _diffStyle(style: StyleSpecification | string, options?: {
1448
- diff?: boolean;
1453
+ diff?: boolean;
1449
1454
  } & StyleOptions) {
1450
1455
  if (typeof style === 'string') {
1451
1456
  const url = style;
@@ -1463,7 +1468,7 @@ class Map extends Camera {
1463
1468
  }
1464
1469
 
1465
1470
  _updateDiff(style: StyleSpecification, options?: {
1466
- diff?: boolean;
1471
+ diff?: boolean;
1467
1472
  } & StyleOptions) {
1468
1473
  try {
1469
1474
  if (this.style.setState(style)) {
@@ -1648,9 +1653,9 @@ class Map extends Camera {
1648
1653
  * @param options Options object.
1649
1654
  * @param options.pixelRatio The ratio of pixels in the image to physical pixels on the screen
1650
1655
  * @param options.sdf Whether the image should be interpreted as an SDF image
1651
- * @param options.content `[x1, y1, x2, y2]` 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`.
1652
- * @param options.stretchX `[[x1, x2], ...]` 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.
1653
- * @param options.stretchY `[[y1, y2], ...]` 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.
1656
+ * @param options.content `[x1, y1, x2, y2]` 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`.
1657
+ * @param options.stretchX `[[x1, x2], ...]` 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.
1658
+ * @param options.stretchY `[[y1, y2], ...]` 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.
1654
1659
  *
1655
1660
  * @example
1656
1661
  * // If the style's sprite does not already contain an image with ID 'cat',
@@ -1679,18 +1684,18 @@ class Map extends Camera {
1679
1684
  * @see Use `ImageData`: [Add a generated icon to the map](https://maplibre.org/maplibre-gl-js-docs/example/add-image-generated/)
1680
1685
  */
1681
1686
  addImage(id: string,
1682
- image: HTMLImageElement | ImageBitmap | ImageData | {
1683
- width: number;
1684
- height: number;
1685
- data: Uint8Array | Uint8ClampedArray;
1686
- } | StyleImageInterface,
1687
- {
1688
- pixelRatio = 1,
1689
- sdf = false,
1690
- stretchX,
1691
- stretchY,
1692
- content
1693
- }: Partial<StyleImageMetadata> = {}) {
1687
+ image: HTMLImageElement | ImageBitmap | ImageData | {
1688
+ width: number;
1689
+ height: number;
1690
+ data: Uint8Array | Uint8ClampedArray;
1691
+ } | StyleImageInterface,
1692
+ {
1693
+ pixelRatio = 1,
1694
+ sdf = false,
1695
+ stretchX,
1696
+ stretchY,
1697
+ content
1698
+ }: Partial<StyleImageMetadata> = {}) {
1694
1699
  this._lazyInitEmptyStyle();
1695
1700
  const version = 0;
1696
1701
 
@@ -1742,9 +1747,9 @@ class Map extends Camera {
1742
1747
  */
1743
1748
  updateImage(id: string,
1744
1749
  image: HTMLImageElement | ImageBitmap | ImageData | {
1745
- width: number;
1746
- height: number;
1747
- data: Uint8Array | Uint8ClampedArray;
1750
+ width: number;
1751
+ height: number;
1752
+ data: Uint8Array | Uint8ClampedArray;
1748
1753
  } | StyleImageInterface) {
1749
1754
 
1750
1755
  const existingImage = this.style.getImage(id);
@@ -1781,7 +1786,7 @@ class Map extends Camera {
1781
1786
  *
1782
1787
  * @param id The ID of the image.
1783
1788
  *
1784
- * @returns {boolean} A Boolean indicating whether the image exists.
1789
+ * @returns {boolean} A Boolean indicating whether the image exists.
1785
1790
  * @example
1786
1791
  * // Check if an image with the ID 'cat' exists in
1787
1792
  * // the style's sprite.
@@ -1834,16 +1839,16 @@ class Map extends Camera {
1834
1839
  }
1835
1840
 
1836
1841
  /**
1837
- * Returns an Array of strings containing the IDs of all images currently available in the map.
1838
- * This includes both images from the style's original sprite
1839
- * and any images that have been added at runtime using {@link Map#addImage}.
1840
- *
1841
- * @returns {Array<string>} An Array of strings containing the names of all sprites/images currently available in the map.
1842
- *
1843
- * @example
1844
- * var allImages = map.listImages();
1845
- *
1846
- */
1842
+ * Returns an Array of strings containing the IDs of all images currently available in the map.
1843
+ * This includes both images from the style's original sprite
1844
+ * and any images that have been added at runtime using {@link Map#addImage}.
1845
+ *
1846
+ * @returns {Array<string>} An Array of strings containing the names of all sprites/images currently available in the map.
1847
+ *
1848
+ * @example
1849
+ * var allImages = map.listImages();
1850
+ *
1851
+ */
1847
1852
  listImages() {
1848
1853
  return this.style.listImages();
1849
1854
  }
@@ -2207,9 +2212,9 @@ class Map extends Camera {
2207
2212
  * @see [Create a hover effect](https://maplibre.org/maplibre-gl-js-docs/example/hover-styles/)
2208
2213
  */
2209
2214
  setFeatureState(feature: {
2210
- source: string;
2211
- sourceLayer?: string;
2212
- id: string | number;
2215
+ source: string;
2216
+ sourceLayer?: string;
2217
+ id: string | number;
2213
2218
  }, state: any) {
2214
2219
  this.style.setFeatureState(feature, state);
2215
2220
  return this._update();
@@ -2261,11 +2266,11 @@ class Map extends Camera {
2261
2266
  * }, 'hover');
2262
2267
  * });
2263
2268
  *
2264
- */
2269
+ */
2265
2270
  removeFeatureState(target: {
2266
- source: string;
2267
- sourceLayer?: string;
2268
- id?: string | number;
2271
+ source: string;
2272
+ sourceLayer?: string;
2273
+ id?: string | number;
2269
2274
  }, key?: string) {
2270
2275
  this.style.removeFeatureState(target, key);
2271
2276
  return this._update();
@@ -2301,11 +2306,11 @@ class Map extends Camera {
2301
2306
  *
2302
2307
  */
2303
2308
  getFeatureState(
2304
- feature: {
2305
- source: string;
2306
- sourceLayer?: string;
2307
- id: string | number;
2308
- }
2309
+ feature: {
2310
+ source: string;
2311
+ sourceLayer?: string;
2312
+ id: string | number;
2313
+ }
2309
2314
  ): any {
2310
2315
  return this.style.getFeatureState(feature);
2311
2316
  }
@@ -2634,11 +2639,11 @@ class Map extends Camera {
2634
2639
  }
2635
2640
 
2636
2641
  /**
2637
- * Force a synchronous redraw of the map.
2638
- * @example
2639
- * map.redraw();
2640
- * @returns {Map} `this`
2641
- */
2642
+ * Force a synchronous redraw of the map.
2643
+ * @example
2644
+ * map.redraw();
2645
+ * @returns {Map} `this`
2646
+ */
2642
2647
  redraw(): Map {
2643
2648
  if (this.style) {
2644
2649
  // cancel the scheduled update
@@ -1,4 +1,4 @@
1
- import simulate, {window} from '../../test/util/simulate_interaction';
1
+ import simulate, {window} from '../../test/unit/lib/simulate_interaction';
2
2
  import StyleLayer from '../style/style_layer';
3
3
  import {createMap, setPerformance, setWebGlContext} from '../util/test/util';
4
4
  import {MapLayerEventType} from './events';
@@ -3,7 +3,7 @@ import Marker from './marker';
3
3
  import Popup from './popup';
4
4
  import LngLat from '../geo/lng_lat';
5
5
  import Point from '@mapbox/point-geometry';
6
- import simulate from '../../test/util/simulate_interaction';
6
+ import simulate from '../../test/unit/lib/simulate_interaction';
7
7
 
8
8
  function createMap(options = {}) {
9
9
  const container = window.document.createElement('div');
@@ -46,16 +46,16 @@ describe('marker', () => {
46
46
 
47
47
  // initial dimensions of svg element
48
48
  expect(
49
- defaultMarker.getElement().children[0].getAttribute('height').includes('41')
49
+ defaultMarker.getElement().children[0].getAttribute('height').includes('41')
50
50
  ).toBeTruthy();
51
51
  expect(defaultMarker.getElement().children[0].getAttribute('width').includes('27')).toBeTruthy();
52
52
 
53
53
  // (41 * 0.8) = 32.8, (27 * 0.8) = 21.6
54
54
  expect(
55
- smallerMarker.getElement().children[0].getAttribute('height').includes('32.8')
55
+ smallerMarker.getElement().children[0].getAttribute('height').includes('32.8')
56
56
  ).toBeTruthy();
57
57
  expect(
58
- smallerMarker.getElement().children[0].getAttribute('width').includes('21.6')
58
+ smallerMarker.getElement().children[0].getAttribute('width').includes('21.6')
59
59
  ).toBeTruthy();
60
60
 
61
61
  // (41 * 2) = 82, (27 * 2) = 54
@@ -287,49 +287,49 @@ describe('marker', () => {
287
287
 
288
288
  // marker should default to above since it has enough space
289
289
  expect(
290
- marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-bottom')
290
+ marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-bottom')
291
291
  ).toBeTruthy();
292
292
 
293
293
  // move marker to the top forcing the popup to below
294
294
  marker.setLngLat(map.unproject([mapHeight / 2, markerTop]));
295
295
  expect(
296
- marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-top')
296
+ marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-top')
297
297
  ).toBeTruthy();
298
298
 
299
299
  // move marker to the right forcing the popup to the left
300
300
  marker.setLngLat(map.unproject([mapHeight - markerRight, mapHeight / 2]));
301
301
  expect(
302
- marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-right')
302
+ marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-right')
303
303
  ).toBeTruthy();
304
304
 
305
305
  // move marker to the left forcing the popup to the right
306
306
  marker.setLngLat(map.unproject([markerRight, mapHeight / 2]));
307
307
  expect(
308
- marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-left')
308
+ marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-left')
309
309
  ).toBeTruthy();
310
310
 
311
311
  // move marker to the top left forcing the popup to the bottom right
312
312
  marker.setLngLat(map.unproject([markerRight, markerTop]));
313
313
  expect(
314
- marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-top-left')
314
+ marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-top-left')
315
315
  ).toBeTruthy();
316
316
 
317
317
  // move marker to the top right forcing the popup to the bottom left
318
318
  marker.setLngLat(map.unproject([mapHeight - markerRight, markerTop]));
319
319
  expect(
320
- marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-top-right')
320
+ marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-top-right')
321
321
  ).toBeTruthy();
322
322
 
323
323
  // move marker to the bottom left forcing the popup to the top right
324
324
  marker.setLngLat(map.unproject([markerRight, mapHeight]));
325
325
  expect(
326
- marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-bottom-left')
326
+ marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-bottom-left')
327
327
  ).toBeTruthy();
328
328
 
329
329
  // move marker to the bottom right forcing the popup to the top left
330
330
  marker.setLngLat(map.unproject([mapHeight - markerRight, mapHeight]));
331
331
  expect(
332
- marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-bottom-right')
332
+ marker.getPopup()._container.classList.contains('maplibregl-popup-anchor-bottom-right')
333
333
  ).toBeTruthy();
334
334
 
335
335
  });
package/src/ui/marker.ts CHANGED
@@ -13,16 +13,16 @@ import type {MapMouseEvent, MapTouchEvent} from './events';
13
13
  import type {PointLike} from './camera';
14
14
 
15
15
  type MarkerOptions = {
16
- element?: HTMLElement;
17
- offset?: PointLike;
18
- anchor?: PositionAnchor;
19
- color?: string;
20
- scale?: number;
21
- draggable?: boolean;
22
- clickTolerance?: number;
23
- rotation?: number;
24
- rotationAlignment?: string;
25
- pitchAlignment?: string;
16
+ element?: HTMLElement;
17
+ offset?: PointLike;
18
+ anchor?: PositionAnchor;
19
+ color?: string;
20
+ scale?: number;
21
+ draggable?: boolean;
22
+ clickTolerance?: number;
23
+ rotation?: number;
24
+ rotationAlignment?: string;
25
+ pitchAlignment?: string;
26
26
  };
27
27
 
28
28
  /**
@@ -289,29 +289,29 @@ export default class Marker extends Evented {
289
289
  * the marker on screen.
290
290
  *
291
291
  * @returns {LngLat} A {@link LngLat} describing the marker's location.
292
- * @example
293
- * // Store the marker's longitude and latitude coordinates in a variable
294
- * var lngLat = marker.getLngLat();
295
- * // Print the marker's longitude and latitude values in the console
296
- * console.log('Longitude: ' + lngLat.lng + ', Latitude: ' + lngLat.lat )
297
- * @see [Create a draggable Marker](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-marker/)
298
- */
292
+ * @example
293
+ * // Store the marker's longitude and latitude coordinates in a variable
294
+ * var lngLat = marker.getLngLat();
295
+ * // Print the marker's longitude and latitude values in the console
296
+ * console.log('Longitude: ' + lngLat.lng + ', Latitude: ' + lngLat.lat )
297
+ * @see [Create a draggable Marker](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-marker/)
298
+ */
299
299
  getLngLat() {
300
300
  return this._lngLat;
301
301
  }
302
302
 
303
303
  /**
304
- * Set the marker's geographical position and move it.
305
- * @param {LngLat} lnglat A {@link LngLat} describing where the marker should be located.
306
- * @returns {Marker} `this`
307
- * @example
308
- * // Create a new marker, set the longitude and latitude, and add it to the map
309
- * new maplibregl.Marker()
310
- * .setLngLat([-65.017, -16.457])
311
- * .addTo(map);
312
- * @see [Add custom icons with Markers](https://maplibre.org/maplibre-gl-js-docs/example/custom-marker-icons/)
313
- * @see [Create a draggable Marker](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-marker/)
314
- */
304
+ * Set the marker's geographical position and move it.
305
+ * @param {LngLat} lnglat A {@link LngLat} describing where the marker should be located.
306
+ * @returns {Marker} `this`
307
+ * @example
308
+ * // Create a new marker, set the longitude and latitude, and add it to the map
309
+ * new maplibregl.Marker()
310
+ * .setLngLat([-65.017, -16.457])
311
+ * .addTo(map);
312
+ * @see [Add custom icons with Markers](https://maplibre.org/maplibre-gl-js-docs/example/custom-marker-icons/)
313
+ * @see [Create a draggable Marker](https://maplibre.org/maplibre-gl-js-docs/example/drag-a-marker/)
314
+ */
315
315
  setLngLat(lnglat: LngLatLike) {
316
316
  this._lngLat = LngLat.convert(lnglat);
317
317
  this._pos = null;
@@ -437,7 +437,7 @@ export default class Marker extends Evented {
437
437
  }
438
438
 
439
439
  _update(e?: {
440
- type: 'move' | 'moveend';
440
+ type: 'move' | 'moveend';
441
441
  }) {
442
442
  if (!this._map) return;
443
443
 
@@ -545,14 +545,14 @@ export default class Marker extends Evented {
545
545
  // only fire dragend if it was preceded by at least one drag event
546
546
  if (this._state === 'active') {
547
547
  /**
548
- * Fired when the marker is finished being dragged
549
- *
550
- * @event dragend
551
- * @memberof Marker
552
- * @instance
553
- * @type {Object}
554
- * @property {Marker} marker object that was dragged
555
- */
548
+ * Fired when the marker is finished being dragged
549
+ *
550
+ * @event dragend
551
+ * @memberof Marker
552
+ * @instance
553
+ * @type {Object}
554
+ * @property {Marker} marker object that was dragged
555
+ */
556
556
  this.fire(new Event('dragend'));
557
557
  }
558
558
 
@@ -2,7 +2,7 @@ import {createMap as globalCreateMap, setPerformance, setWebGlContext} from '../
2
2
  import Popup, {Offset} from './popup';
3
3
  import LngLat from '../geo/lng_lat';
4
4
  import Point from '@mapbox/point-geometry';
5
- import simulate from '../../test/util/simulate_interaction';
5
+ import simulate from '../../test/unit/lib/simulate_interaction';
6
6
  import {PositionAnchor} from './anchor';
7
7
 
8
8
  const containerWidth = 512;
@@ -91,7 +91,7 @@ describe('popup', () => {
91
91
  .addTo(map);
92
92
 
93
93
  expect(
94
- popup.getElement().querySelectorAll('.maplibregl-popup-close-button')
94
+ popup.getElement().querySelectorAll('.maplibregl-popup-close-button')
95
95
  ).toHaveLength(0);
96
96
  });
97
97
 
@@ -561,7 +561,7 @@ describe('popup', () => {
561
561
  .addTo(map);
562
562
 
563
563
  expect(
564
- popup._container.classList.value
564
+ popup._container.classList.value
565
565
  ).toContain('maplibregl-popup-track-pointer');
566
566
  });
567
567
 
@@ -574,7 +574,7 @@ describe('popup', () => {
574
574
  popup.setText('Test');
575
575
 
576
576
  expect(
577
- popup._container.classList.value
577
+ popup._container.classList.value
578
578
  ).toContain('maplibregl-popup-track-pointer');
579
579
  });
580
580
 
@@ -587,7 +587,7 @@ describe('popup', () => {
587
587
  popup.trackPointer();
588
588
 
589
589
  expect(
590
- popup._container.classList.value
590
+ popup._container.classList.value
591
591
  ).toContain('maplibregl-popup-track-pointer');
592
592
  });
593
593
 
@@ -601,7 +601,7 @@ describe('popup', () => {
601
601
 
602
602
  expect(popup._pos).toEqual(map.project([0, 0]));
603
603
  expect(
604
- popup._container.classList.value
604
+ popup._container.classList.value
605
605
  ).not.toContain('maplibregl-popup-track-pointer');
606
606
  });
607
607
 
@@ -613,7 +613,7 @@ describe('popup', () => {
613
613
  .addTo(map);
614
614
 
615
615
  expect(
616
- popup._container.classList.value
616
+ popup._container.classList.value
617
617
  ).not.toContain('maplibregl-popup-track-pointer');
618
618
  });
619
619
 
package/src/ui/popup.ts CHANGED
@@ -21,18 +21,18 @@ const defaultOptions = {
21
21
  };
22
22
 
23
23
  export type Offset = number | PointLike | {
24
- [_ in PositionAnchor]: PointLike;
24
+ [_ in PositionAnchor]: PointLike;
25
25
  };
26
26
 
27
27
  export type PopupOptions = {
28
- closeButton?: boolean;
29
- closeOnClick?: boolean;
30
- closeOnMove?: boolean;
31
- focusAfterOpen?: boolean;
32
- anchor?: PositionAnchor;
33
- offset?: Offset;
34
- className?: string;
35
- maxWidth?: string;
28
+ closeButton?: boolean;
29
+ closeOnClick?: boolean;
30
+ closeOnMove?: boolean;
31
+ focusAfterOpen?: boolean;
32
+ anchor?: PositionAnchor;
33
+ offset?: Offset;
34
+ className?: string;
35
+ maxWidth?: string;
36
36
  };
37
37
 
38
38
  const focusQuerySelector = [