maplibre-gl 3.0.0-pre.3 → 3.0.0-pre.5

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 (344) hide show
  1. package/README.md +18 -13
  2. package/build/banner.ts +2 -3
  3. package/build/generate-dist-package.js +21 -0
  4. package/build/generate-shaders.ts +11 -11
  5. package/build/generate-struct-arrays.ts +1 -1
  6. package/build/generate-style-code.ts +22 -21
  7. package/build/generate-typings.ts +2 -10
  8. package/build/readme.md +1 -1
  9. package/build/rollup/bundle_prelude.js +21 -0
  10. package/build/rollup/maplibregl.js +47 -0
  11. package/build/rollup_plugins.ts +2 -3
  12. package/dist/maplibre-gl-csp-worker.js +1 -1
  13. package/dist/maplibre-gl-csp-worker.js.map +1 -1
  14. package/dist/maplibre-gl-csp.js +1 -1
  15. package/dist/maplibre-gl-csp.js.map +1 -1
  16. package/dist/maplibre-gl-dev.js +10107 -8961
  17. package/dist/maplibre-gl-dev.js.map +1 -0
  18. package/dist/maplibre-gl.css +1 -1
  19. package/dist/maplibre-gl.d.ts +513 -1524
  20. package/dist/maplibre-gl.js +4 -4
  21. package/dist/maplibre-gl.js.map +1 -1
  22. package/dist/package.json +1 -1
  23. package/package.json +75 -75
  24. package/src/css/maplibre-gl.css +7 -5
  25. package/src/data/bucket/fill_bucket.test.ts +1 -1
  26. package/src/data/bucket/line_bucket.test.ts +1 -1
  27. package/src/data/bucket/symbol_bucket.ts +5 -6
  28. package/src/data/feature_index.ts +3 -5
  29. package/src/data/load_geometry.ts +1 -1
  30. package/src/data/program_configuration.ts +6 -7
  31. package/src/geo/edge_insets.ts +5 -5
  32. package/src/geo/lng_lat.test.ts +0 -10
  33. package/src/geo/lng_lat.ts +2 -21
  34. package/src/geo/lng_lat_bounds.test.ts +17 -0
  35. package/src/geo/lng_lat_bounds.ts +44 -10
  36. package/src/geo/mercator_coordinate.ts +2 -1
  37. package/src/geo/transform.test.ts +9 -0
  38. package/src/geo/transform.ts +6 -6
  39. package/src/gl/color_mode.ts +1 -1
  40. package/src/gl/context.ts +11 -11
  41. package/src/gl/framebuffer.ts +5 -3
  42. package/src/gl/render_pool.ts +2 -2
  43. package/src/gl/state.test.ts +1 -1
  44. package/src/gl/value.ts +14 -1
  45. package/src/gl/vertex_buffer.ts +1 -1
  46. package/src/index.test.ts +113 -0
  47. package/src/index.ts +12 -28
  48. package/src/render/draw_collision_debug.ts +1 -1
  49. package/src/render/draw_debug.test.ts +1 -1
  50. package/src/render/draw_debug.ts +1 -3
  51. package/src/render/draw_fill.test.ts +1 -1
  52. package/src/render/draw_fill.ts +1 -1
  53. package/src/render/draw_heatmap.ts +2 -2
  54. package/src/render/draw_hillshade.ts +1 -1
  55. package/src/render/draw_symbol.test.ts +1 -1
  56. package/src/render/draw_symbol.ts +3 -1
  57. package/src/render/draw_terrain.ts +1 -1
  58. package/src/render/image_manager.ts +36 -12
  59. package/src/render/painter.ts +6 -18
  60. package/src/render/program/background_program.ts +1 -2
  61. package/src/render/program/debug_program.ts +1 -1
  62. package/src/render/program/pattern.ts +1 -1
  63. package/src/render/program.ts +1 -1
  64. package/src/render/render_to_texture.test.ts +1 -1
  65. package/src/render/render_to_texture.ts +4 -3
  66. package/src/render/terrain.test.ts +1 -1
  67. package/src/render/terrain.ts +9 -9
  68. package/src/render/uniform_binding.ts +1 -1
  69. package/src/render/update_pattern_positions_in_program.ts +2 -2
  70. package/src/source/canvas_source.ts +1 -1
  71. package/src/source/geojson_source.test.ts +21 -1
  72. package/src/source/geojson_source.ts +63 -5
  73. package/src/source/geojson_worker_source.test.ts +1 -1
  74. package/src/source/geojson_worker_source.ts +1 -1
  75. package/src/source/image_source.ts +12 -11
  76. package/src/source/load_tilejson.ts +3 -2
  77. package/src/source/query_features.ts +1 -1
  78. package/src/source/raster_dem_tile_source.ts +4 -3
  79. package/src/source/raster_tile_source.ts +5 -7
  80. package/src/source/rtl_text_plugin.ts +2 -1
  81. package/src/source/source.ts +2 -2
  82. package/src/source/source_cache.test.ts +80 -2
  83. package/src/source/source_cache.ts +7 -4
  84. package/src/source/source_state.ts +1 -1
  85. package/src/source/terrain_source_cache.test.ts +4 -5
  86. package/src/source/tile.ts +2 -2
  87. package/src/source/tile_id.ts +5 -4
  88. package/src/source/vector_tile_source.test.ts +1 -1
  89. package/src/source/vector_tile_source.ts +3 -6
  90. package/src/source/vector_tile_worker_source.test.ts +0 -9
  91. package/src/source/video_source.ts +5 -4
  92. package/src/source/worker.test.ts +1 -1
  93. package/src/source/worker.ts +1 -6
  94. package/src/source/worker_source.ts +1 -1
  95. package/src/source/worker_tile.ts +1 -1
  96. package/src/style/create_style_layer.ts +1 -1
  97. package/src/style/evaluation_parameters.ts +1 -1
  98. package/src/style/format_section_override.test.ts +1 -3
  99. package/src/style/format_section_override.ts +2 -5
  100. package/src/style/light.test.ts +1 -3
  101. package/src/style/light.ts +5 -9
  102. package/src/style/load_glyph_range.ts +2 -1
  103. package/src/style/load_sprite.test.ts +8 -5
  104. package/src/style/load_sprite.ts +63 -64
  105. package/src/style/pauseable_placement.ts +1 -2
  106. package/src/style/properties.ts +22 -28
  107. package/src/style/style.test.ts +202 -13
  108. package/src/style/style.ts +121 -59
  109. package/src/style/style_image.ts +10 -1
  110. package/src/style/style_layer/background_style_layer.ts +1 -1
  111. package/src/style/style_layer/background_style_layer_properties.g.ts +6 -6
  112. package/src/style/style_layer/circle_style_layer.ts +1 -2
  113. package/src/style/style_layer/circle_style_layer_properties.g.ts +6 -6
  114. package/src/style/style_layer/custom_style_layer.ts +1 -1
  115. package/src/style/style_layer/fill_extrusion_style_layer.ts +1 -2
  116. package/src/style/style_layer/fill_extrusion_style_layer_properties.g.ts +6 -6
  117. package/src/style/style_layer/fill_style_layer.ts +1 -2
  118. package/src/style/style_layer/fill_style_layer_properties.g.ts +6 -6
  119. package/src/style/style_layer/heatmap_style_layer.ts +1 -1
  120. package/src/style/style_layer/heatmap_style_layer_properties.g.ts +6 -6
  121. package/src/style/style_layer/hillshade_style_layer.ts +1 -1
  122. package/src/style/style_layer/hillshade_style_layer_properties.g.ts +6 -6
  123. package/src/style/style_layer/line_style_layer.ts +2 -3
  124. package/src/style/style_layer/line_style_layer_properties.g.ts +6 -6
  125. package/src/style/style_layer/overlap_mode.test.ts +57 -0
  126. package/src/style/style_layer/overlap_mode.ts +22 -0
  127. package/src/style/style_layer/raster_style_layer.ts +1 -1
  128. package/src/style/style_layer/raster_style_layer_properties.g.ts +6 -6
  129. package/src/style/style_layer/symbol_style_layer.ts +7 -29
  130. package/src/style/style_layer/symbol_style_layer_properties.g.ts +9 -9
  131. package/src/style/style_layer.test.ts +1 -2
  132. package/src/style/style_layer.ts +4 -8
  133. package/src/style/style_layer_index.ts +2 -3
  134. package/src/style/validate_style.ts +2 -2
  135. package/src/symbol/collision_index.ts +2 -2
  136. package/src/symbol/get_anchors.ts +5 -5
  137. package/src/symbol/grid_index.ts +1 -1
  138. package/src/symbol/placement.ts +4 -9
  139. package/src/symbol/projection.test.ts +139 -1
  140. package/src/symbol/projection.ts +231 -47
  141. package/src/symbol/quads.ts +1 -1
  142. package/src/symbol/shaping.ts +1 -1
  143. package/src/symbol/symbol_layout.ts +1 -5
  144. package/src/symbol/symbol_size.ts +7 -6
  145. package/src/symbol/symbol_style_layer.test.ts +1 -48
  146. package/src/symbol/transform_text.ts +2 -2
  147. package/src/ui/camera.test.ts +44 -0
  148. package/src/ui/camera.ts +60 -40
  149. package/src/ui/control/attribution_control.test.ts +2 -4
  150. package/src/ui/control/fullscreen_control.test.ts +83 -3
  151. package/src/ui/control/fullscreen_control.ts +38 -2
  152. package/src/ui/control/geolocate_control.test.ts +92 -26
  153. package/src/ui/control/geolocate_control.ts +10 -23
  154. package/src/ui/control/logo_control.test.ts +2 -3
  155. package/src/ui/control/navigation_control.test.ts +2 -4
  156. package/src/ui/control/scale_control.test.ts +2 -3
  157. package/src/ui/control/terrain_control.test.ts +2 -4
  158. package/src/ui/control/terrain_control.ts +1 -1
  159. package/src/ui/events.ts +25 -23
  160. package/src/ui/handler/box_zoom.test.ts +2 -4
  161. package/src/ui/handler/cooperative_gestures.test.ts +103 -15
  162. package/src/ui/handler/dblclick_zoom.test.ts +2 -4
  163. package/src/ui/handler/drag_pan.test.ts +2 -4
  164. package/src/ui/handler/drag_rotate.test.ts +2 -4
  165. package/src/ui/handler/keyboard.test.ts +2 -4
  166. package/src/ui/handler/map_event.test.ts +2 -4
  167. package/src/ui/handler/mouse_handler_interface.test.ts +0 -7
  168. package/src/ui/handler/mouse_rotate.test.ts +4 -6
  169. package/src/ui/handler/one_finger_touch_drag_handler_interface.test.ts +0 -7
  170. package/src/ui/handler/scroll_zoom.test.ts +2 -4
  171. package/src/ui/handler/scroll_zoom.ts +4 -4
  172. package/src/ui/handler/two_fingers_touch.test.ts +2 -4
  173. package/src/ui/handler_manager.ts +1 -1
  174. package/src/ui/hash.test.ts +2 -3
  175. package/src/ui/map/isMoving.test.ts +2 -4
  176. package/src/ui/map/isRotating.test.ts +2 -4
  177. package/src/ui/map/isZooming.test.ts +2 -4
  178. package/src/ui/map/requestRenderFrame.test.ts +2 -4
  179. package/src/ui/map.test.ts +292 -20
  180. package/src/ui/map.ts +200 -120
  181. package/src/ui/map_events.test.ts +18 -4
  182. package/src/ui/marker.test.ts +2 -3
  183. package/src/ui/marker.ts +2 -2
  184. package/src/ui/popup.test.ts +2 -3
  185. package/src/ui/popup.ts +19 -19
  186. package/src/util/ajax.test.ts +1 -129
  187. package/src/util/ajax.ts +7 -145
  188. package/src/util/browser.ts +7 -2
  189. package/src/util/color_ramp.test.ts +1 -2
  190. package/src/util/color_ramp.ts +1 -1
  191. package/src/util/config.ts +8 -1
  192. package/src/util/dispatcher.test.ts +35 -12
  193. package/src/util/dispatcher.ts +7 -7
  194. package/src/util/evented.ts +2 -2
  195. package/src/util/geolocation_support.test.ts +55 -0
  196. package/src/util/geolocation_support.ts +24 -0
  197. package/src/util/image_request.test.ts +486 -0
  198. package/src/util/image_request.ts +225 -0
  199. package/src/util/performance.ts +14 -8
  200. package/src/util/primitives.ts +1 -1
  201. package/src/util/request_manager.ts +16 -5
  202. package/src/util/struct_array.ts +1 -1
  203. package/src/util/style.test.ts +17 -2
  204. package/src/util/style.ts +19 -3
  205. package/src/util/test/util.ts +19 -1
  206. package/src/util/util.test.ts +53 -1
  207. package/src/util/util.ts +58 -3
  208. package/src/util/vectortile_to_geojson.ts +7 -2
  209. package/src/util/web_worker.ts +2 -2
  210. package/src/util/web_worker_transfer.ts +3 -5
  211. package/build/generate-query-test-fixtures.ts +0 -124
  212. package/build/generate-style-spec.ts +0 -325
  213. package/build/rollup_plugin_minify_style_spec.ts +0 -25
  214. package/dist/style-spec/index.d.ts +0 -1772
  215. package/postinstall.js +0 -1
  216. package/src/style-spec/.eslintrc +0 -5
  217. package/src/style-spec/CHANGELOG.md +0 -521
  218. package/src/style-spec/README.md +0 -50
  219. package/src/style-spec/bin/gl-style-format.js +0 -22
  220. package/src/style-spec/bin/gl-style-migrate.js +0 -18
  221. package/src/style-spec/bin/gl-style-validate.js +0 -45
  222. package/src/style-spec/declass.test.ts +0 -118
  223. package/src/style-spec/declass.ts +0 -42
  224. package/src/style-spec/deref.test.ts +0 -47
  225. package/src/style-spec/deref.ts +0 -52
  226. package/src/style-spec/diff.test.ts +0 -413
  227. package/src/style-spec/diff.ts +0 -393
  228. package/src/style-spec/dist/.gitkeep +0 -0
  229. package/src/style-spec/empty.test.ts +0 -14
  230. package/src/style-spec/empty.ts +0 -30
  231. package/src/style-spec/error/parsing_error.ts +0 -14
  232. package/src/style-spec/error/validation_error.ts +0 -18
  233. package/src/style-spec/expression/compound_expression.ts +0 -157
  234. package/src/style-spec/expression/definitions/assertion.ts +0 -108
  235. package/src/style-spec/expression/definitions/at.ts +0 -64
  236. package/src/style-spec/expression/definitions/case.ts +0 -76
  237. package/src/style-spec/expression/definitions/coalesce.ts +0 -83
  238. package/src/style-spec/expression/definitions/coercion.ts +0 -124
  239. package/src/style-spec/expression/definitions/collator.ts +0 -66
  240. package/src/style-spec/expression/definitions/comparison.ts +0 -176
  241. package/src/style-spec/expression/definitions/format.ts +0 -131
  242. package/src/style-spec/expression/definitions/image.ts +0 -46
  243. package/src/style-spec/expression/definitions/in.ts +0 -75
  244. package/src/style-spec/expression/definitions/index.ts +0 -564
  245. package/src/style-spec/expression/definitions/index_of.ts +0 -88
  246. package/src/style-spec/expression/definitions/interpolate.ts +0 -246
  247. package/src/style-spec/expression/definitions/length.ts +0 -53
  248. package/src/style-spec/expression/definitions/let.ts +0 -61
  249. package/src/style-spec/expression/definitions/literal.ts +0 -53
  250. package/src/style-spec/expression/definitions/match.ts +0 -118
  251. package/src/style-spec/expression/definitions/number_format.ts +0 -115
  252. package/src/style-spec/expression/definitions/slice.ts +0 -84
  253. package/src/style-spec/expression/definitions/step.ts +0 -107
  254. package/src/style-spec/expression/definitions/var.ts +0 -40
  255. package/src/style-spec/expression/definitions/within.ts +0 -334
  256. package/src/style-spec/expression/evaluation_context.ts +0 -57
  257. package/src/style-spec/expression/expression.test.ts +0 -64
  258. package/src/style-spec/expression/expression.ts +0 -25
  259. package/src/style-spec/expression/index.ts +0 -470
  260. package/src/style-spec/expression/is_constant.ts +0 -57
  261. package/src/style-spec/expression/parsing_context.ts +0 -240
  262. package/src/style-spec/expression/parsing_error.ts +0 -11
  263. package/src/style-spec/expression/runtime_error.ts +0 -15
  264. package/src/style-spec/expression/scope.ts +0 -34
  265. package/src/style-spec/expression/stops.test.ts +0 -23
  266. package/src/style-spec/expression/stops.ts +0 -37
  267. package/src/style-spec/expression/types/collator.ts +0 -51
  268. package/src/style-spec/expression/types/formatted.ts +0 -49
  269. package/src/style-spec/expression/types/resolved_image.ts +0 -23
  270. package/src/style-spec/expression/types.ts +0 -140
  271. package/src/style-spec/expression/values.ts +0 -126
  272. package/src/style-spec/feature_filter/README.md +0 -55
  273. package/src/style-spec/feature_filter/convert.ts +0 -206
  274. package/src/style-spec/feature_filter/feature_filter.test.ts +0 -709
  275. package/src/style-spec/feature_filter/index.ts +0 -183
  276. package/src/style-spec/format.test.ts +0 -30
  277. package/src/style-spec/format.ts +0 -51
  278. package/src/style-spec/function/convert.ts +0 -266
  279. package/src/style-spec/function/index.test.ts +0 -1104
  280. package/src/style-spec/function/index.ts +0 -274
  281. package/src/style-spec/group_by_layout.test.ts +0 -64
  282. package/src/style-spec/group_by_layout.ts +0 -75
  283. package/src/style-spec/migrate/expressions.ts +0 -34
  284. package/src/style-spec/migrate/v8.test.ts +0 -507
  285. package/src/style-spec/migrate/v8.ts +0 -204
  286. package/src/style-spec/migrate/v9.test.ts +0 -76
  287. package/src/style-spec/migrate/v9.ts +0 -27
  288. package/src/style-spec/migrate.test.ts +0 -112
  289. package/src/style-spec/migrate.ts +0 -37
  290. package/src/style-spec/package.json +0 -40
  291. package/src/style-spec/read_style.ts +0 -15
  292. package/src/style-spec/reference/latest.ts +0 -3
  293. package/src/style-spec/reference/v8.json +0 -6021
  294. package/src/style-spec/style-spec.test.ts +0 -203
  295. package/src/style-spec/style-spec.ts +0 -124
  296. package/src/style-spec/types.g.ts +0 -572
  297. package/src/style-spec/util/color.test.ts +0 -18
  298. package/src/style-spec/util/color.ts +0 -93
  299. package/src/style-spec/util/color_spaces.test.ts +0 -28
  300. package/src/style-spec/util/color_spaces.ts +0 -137
  301. package/src/style-spec/util/deep_equal.ts +0 -26
  302. package/src/style-spec/util/extend.ts +0 -8
  303. package/src/style-spec/util/get_type.ts +0 -15
  304. package/src/style-spec/util/interpolate.test.ts +0 -21
  305. package/src/style-spec/util/interpolate.ts +0 -32
  306. package/src/style-spec/util/padding.test.ts +0 -27
  307. package/src/style-spec/util/padding.ts +0 -64
  308. package/src/style-spec/util/properties.ts +0 -13
  309. package/src/style-spec/util/ref_properties.ts +0 -3
  310. package/src/style-spec/util/result.ts +0 -21
  311. package/src/style-spec/util/unbundle_jsonlint.ts +0 -22
  312. package/src/style-spec/validate/latest.ts +0 -11
  313. package/src/style-spec/validate/validate.ts +0 -82
  314. package/src/style-spec/validate/validate_array.ts +0 -52
  315. package/src/style-spec/validate/validate_boolean.ts +0 -15
  316. package/src/style-spec/validate/validate_color.ts +0 -20
  317. package/src/style-spec/validate/validate_constants.ts +0 -13
  318. package/src/style-spec/validate/validate_enum.ts +0 -21
  319. package/src/style-spec/validate/validate_expression.ts +0 -42
  320. package/src/style-spec/validate/validate_filter.ts +0 -117
  321. package/src/style-spec/validate/validate_formatted.ts +0 -10
  322. package/src/style-spec/validate/validate_function.ts +0 -212
  323. package/src/style-spec/validate/validate_glyphs_url.ts +0 -21
  324. package/src/style-spec/validate/validate_image.ts +0 -10
  325. package/src/style-spec/validate/validate_layer.ts +0 -137
  326. package/src/style-spec/validate/validate_layout_property.ts +0 -6
  327. package/src/style-spec/validate/validate_light.ts +0 -47
  328. package/src/style-spec/validate/validate_number.ts +0 -29
  329. package/src/style-spec/validate/validate_object.ts +0 -62
  330. package/src/style-spec/validate/validate_padding.test.ts +0 -83
  331. package/src/style-spec/validate/validate_padding.ts +0 -36
  332. package/src/style-spec/validate/validate_paint_property.ts +0 -6
  333. package/src/style-spec/validate/validate_property.ts +0 -64
  334. package/src/style-spec/validate/validate_source.ts +0 -119
  335. package/src/style-spec/validate/validate_sprite.test.ts +0 -75
  336. package/src/style-spec/validate/validate_sprite.ts +0 -55
  337. package/src/style-spec/validate/validate_string.ts +0 -15
  338. package/src/style-spec/validate/validate_terrain.test.ts +0 -44
  339. package/src/style-spec/validate/validate_terrain.ts +0 -41
  340. package/src/style-spec/validate_style.min.ts +0 -95
  341. package/src/style-spec/validate_style.ts +0 -41
  342. package/src/style-spec/visit.ts +0 -82
  343. package/src/util/tile_request_cache.test.ts +0 -101
  344. package/src/util/tile_request_cache.ts +0 -169
package/README.md CHANGED
@@ -8,9 +8,6 @@ It originated as an open-source fork of [mapbox-gl-js](https://github.com/mapbox
8
8
 
9
9
  [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg?style=flat)](LICENSE.txt)[![Version](https://img.shields.io/npm/v/maplibre-gl?style=flat)](https://www.npmjs.com/package/maplibre-gl)[![CI](https://github.com/maplibre/maplibre-gl-js/actions/workflows/ci.yml/badge.svg)](https://github.com/maplibre/maplibre-gl-js/actions/workflows/ci.yml)[![PRs](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](https://opensource.org/licenses/BSD-3-Clause)
10
10
 
11
- **Call for Bounties💰** If you have ideas for new features in MapLibre, you can now nominate them for the MapLibre Bounty Program at https://maplibre.org/news/2022-10-16-call-for-bounties/
12
- <br />
13
-
14
11
  ## Getting Started
15
12
 
16
13
  Include the JavaScript and CSS files in the `<head>` of your HTML file.
@@ -46,9 +43,9 @@ Check out the features through [examples](https://maplibre.org/maplibre-gl-js-do
46
43
 
47
44
  | Showcases | |
48
45
  | ---- | ---- |
49
- |![Display a map](https://maplibre.org/maplibre-gl-js-docs/assets/simple-map-800-22a3f5b6410f543ab214e14f68fb42ec.png) |![Third party vector tile source](https://maplibre.org/maplibre-gl-js-docs/assets/third-party-800-e047007bba338f6ec7d6cd47abfed279.png) |
50
- |![Animate a series of images](https://maplibre.org/maplibre-gl-js-docs/assets/animate-images-800-497358611dbe047f300faeb9465aad5f.png) |![Create a heatmap layer](https://maplibre.org/maplibre-gl-js-docs/assets/heatmap-layer-800-05c0f97ddb6b1a10e84b5064564e86ff.png) |
51
- |![3D buildings](https://maplibre.org/maplibre-gl-js-docs/assets/3d-buildings-800-bd7885f07050dbbfee7a9bb800ff5ce8.png) |![Visualize population density](https://maplibre.org/maplibre-gl-js-docs/assets/visualize-population-density-800-6c65712d9ea94eb6d2bd3348a82b9bdf.png) |
46
+ |![Display a map](https://maplibre.org/maplibre-gl-js-docs/assets/simple-map-800-1427cd84c8c693ead996f81b06e467bb.png) |![Third party vector tile source](https://maplibre.org/maplibre-gl-js-docs/assets/third-party-800-72a3092888152ba26920ec0ba5aeacd0.png) |
47
+ |![Animate a series of images](https://maplibre.org/maplibre-gl-js-docs/assets/animate-images-800-522ec4f83d7988b2d6f23a0c1d5eb924.png) |![Create a heatmap layer](https://maplibre.org/maplibre-gl-js-docs/assets/heatmap-layer-800-a23e44d9c1238315f191187c5c628719.png) |
48
+ |![3D buildings](https://maplibre.org/maplibre-gl-js-docs/assets/3d-buildings-800-18cda57800c107d1dee5f269bf7a12f2.png) |![Visualize population density](https://maplibre.org/maplibre-gl-js-docs/assets/visualize-population-density-800-dc0290780f7b2842031bdf1b9347981a.png) |
52
49
 
53
50
  <br />
54
51
 
@@ -67,11 +64,11 @@ The overall migration happens by uninstalling `mapbox-gl` and installing `maplib
67
64
 
68
65
  #### Compatibility branch
69
66
 
70
- Maplibre v1 is completely backward compatible with Mapbox v1. This compatibility branch (named 1.x) is tagged v1 on npm, and its current verison is 1.15.3.
67
+ Maplibre v1 is completely backward compatible with Mapbox v1. This compatibility branch (named 1.x) is tagged v1 on npm, and its current version is 1.15.3.
71
68
 
72
69
  #### CDN Links
73
70
 
74
- > MapLibre GL JS is distributed via [unpkg.com](https://unpkg.com). For more informations please see [MapLibre GL is on unpkg.com](./docs/README-unpkg.md#maplibre-gl-on-unpkgcom).
71
+ > MapLibre GL JS is distributed via [unpkg.com](https://unpkg.com). For more information, please see [MapLibre GL is on unpkg.com](./docs/README-unpkg.md#maplibre-gl-on-unpkgcom).
75
72
 
76
73
  ```diff
77
74
  - <script src="https://api.mapbox.com/mapbox-gl-js/v#.#.#/mapbox-gl.js"></script>
@@ -113,6 +110,14 @@ If you depend on a free software alternative to `mapbox-gl-js`, please consider
113
110
 
114
111
  > **MapLibre GL** is developed following [Semantic Versioning (2.0.0)](https://semver.org/spec/v2.0.0.html).
115
112
 
113
+ ### Bounties
114
+
115
+ We offer Bounties for some tasks in the MapLibre GL JS repo. Read more about the Bounties in our step-by-step guide:
116
+
117
+ https://maplibre.org/roadmap/step-by-step-bounties-guide/
118
+
119
+ And find all currently published Bounties in MapLibre GL JS [here](https://github.com/maplibre/maplibre-gl-js/issues?q=is%3Aissue+is%3Aopen+label%3A%22%F0%9F%92%B0+bounty+L%22%2C%22%F0%9F%92%B0+bounty+S%22%2C%22%F0%9F%92%B0+bounty+M%22%2C%22%F0%9F%92%B0+bounty+XL%22%2C%22%F0%9F%92%B0+bounty+XXL%22+).
120
+
116
121
  <br />
117
122
 
118
123
  ## Sponsors
@@ -123,16 +128,16 @@ Read more about the MapLibre Sponsorship Program at [https://maplibre.org/sponso
123
128
 
124
129
  Platinum:
125
130
 
126
- <img src="https://maplibre.org/img/aws-logo.svg" alt="Logo AWS" width="25%"/>
127
-
131
+ <a href="https://aws.com"><img src="https://maplibre.org/img/aws-logo.svg" alt="Logo AWS" width="25%"/></a>
128
132
 
129
133
  Silver:
130
134
 
131
- <img src="https://maplibre.org/img/meta-logo.svg" alt="Logo Meta" width="50%"/>
135
+ <a href="https://meta.com"><img src="https://maplibre.org/img/meta-logo.svg" alt="Logo Meta" width="25%"/></a>
136
+
137
+ <a href="https://www.mierune.co.jp/?lang=en"><img src="https://maplibre.org/img/mierune-logo.svg" alt="Logo MIERUNE" width="25%"/></a>
132
138
 
133
- Stone:
139
+ <a href="https://komoot.com/"><img src="https://maplibre.org/img/komoot-logo.svg" alt="Logo komoot" width="25%"/></a>
134
140
 
135
- [MIERUNE Inc.](https://www.mierune.co.jp/?lang=en)
136
141
 
137
142
  Backers and Supporters:
138
143
 
package/build/banner.ts CHANGED
@@ -1,4 +1,3 @@
1
- import fs from 'fs';
1
+ import packageJSON from '../package.json' assert {type: 'json'};
2
2
 
3
- const version = JSON.parse(fs.readFileSync('package.json').toString()).version;
4
- export default `/* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v${version}/LICENSE.txt */`;
3
+ export default `/* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v${packageJSON.version}/LICENSE.txt */`;
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+ /// js files in this project are esm.
3
+ /// This package.json ensures that node imports from outside see them as such
4
+ // https://nodejs.org/api/packages.html#type
5
+
6
+ import { writeFile, mkdir } from "node:fs/promises"
7
+
8
+ async function ensureDist() {
9
+ const dist = new URL("../dist/", import.meta.url);
10
+ await mkdir(dist, { recursive: true })
11
+ return dist
12
+ }
13
+
14
+ await writeFile(
15
+ new URL("package.json", await ensureDist()),
16
+ JSON.stringify({
17
+ name: "@maplibre/distfiles",
18
+ type: "commonjs",
19
+ deprecated: "Please install maplibre-gl from parent directory instead",
20
+ })
21
+ )
@@ -1,5 +1,6 @@
1
1
  import fs from 'fs';
2
- import glob from 'glob';
2
+ import {globSync} from 'glob';
3
+ import path from 'path';
3
4
 
4
5
  console.log('Generating shaders');
5
6
 
@@ -11,22 +12,21 @@ console.log('Generating shaders');
11
12
  * It will also create a simple package.json file to allow importing this package in webpack
12
13
  */
13
14
 
14
- glob('./src/shaders/*.glsl', null, (_err, files) => {
15
- for (const file of files) {
16
- const code = fs.readFileSync(file, 'utf8');
17
- const content = glslToTs(code);
18
- const fileName = `./src/shaders/${file.split('/').splice(-1)}.g.ts`;
19
- fs.writeFileSync(fileName, content);
20
- }
21
- console.log(`Finished converting ${files.length} glsl files`);
22
- });
15
+ const files = globSync('./src/shaders/*.glsl');
16
+ for (const file of files) {
17
+ const code = fs.readFileSync(file, 'utf8');
18
+ const content = glslToTs(code);
19
+ const fileName = path.join('.', 'src', 'shaders', `${file.split(path.sep).splice(-1)}.g.ts`);
20
+ fs.writeFileSync(fileName, content);
21
+ }
22
+ console.log(`Finished converting ${files.length} glsl files`);
23
23
 
24
24
  function glslToTs(code: string): string {
25
25
  code = code
26
26
  .trim() // strip whitespace at the start/end
27
27
  .replace(/\s*\/\/[^\n]*\n/g, '\n') // strip double-slash comments
28
28
  .replace(/\n+/g, '\n') // collapse multi line breaks
29
- .replace(/\n\s+/g, '\n') // strip identation
29
+ .replace(/\n\s+/g, '\n') // strip indentation
30
30
  .replace(/\s?([+-\/*=,])\s?/g, '$1') // strip whitespace around operators
31
31
  .replace(/([;\(\),\{\}])\n(?=[^#])/g, '$1'); // strip more line breaks
32
32
 
@@ -6,7 +6,7 @@
6
6
  * - Particular, named StructArray subclasses, when fancy struct accessors are needed (e.g. CollisionBoxArray)
7
7
  */
8
8
 
9
- 'use strict'; // eslint-disable-line strict
9
+ 'use strict';
10
10
 
11
11
  import * as fs from 'fs';
12
12
  import * as util from '../src/util/util';
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as fs from 'fs';
4
4
 
5
- import spec from '../src/style-spec/reference/v8.json' assert {type: 'json'};
5
+ import {v8} from '@maplibre/maplibre-gl-style-spec';
6
6
 
7
7
  function camelCase(str: string): string {
8
8
  return str.replace(/-(.)/g, (_, x) => {
@@ -137,20 +137,20 @@ function propertyValue(property, type) {
137
137
  }
138
138
  }
139
139
 
140
- const layers = Object.keys(spec.layer.type.values).map((type) => {
141
- const layoutProperties = Object.keys(spec[`layout_${type}`]).reduce((memo, name) => {
140
+ const layers = Object.keys(v8.layer.type.values).map((type) => {
141
+ const layoutProperties = Object.keys(v8[`layout_${type}`]).reduce((memo, name) => {
142
142
  if (name !== 'visibility') {
143
- spec[`layout_${type}`][name].name = name;
144
- spec[`layout_${type}`][name].layerType = type;
145
- memo.push(spec[`layout_${type}`][name]);
143
+ v8[`layout_${type}`][name].name = name;
144
+ v8[`layout_${type}`][name].layerType = type;
145
+ memo.push(v8[`layout_${type}`][name]);
146
146
  }
147
147
  return memo;
148
148
  }, []);
149
149
 
150
- const paintProperties = Object.keys(spec[`paint_${type}`]).reduce((memo, name) => {
151
- spec[`paint_${type}`][name].name = name;
152
- spec[`paint_${type}`][name].layerType = type;
153
- memo.push(spec[`paint_${type}`][name]);
150
+ const paintProperties = Object.keys(v8[`paint_${type}`]).reduce((memo, name) => {
151
+ v8[`paint_${type}`][name].name = name;
152
+ v8[`paint_${type}`][name].layerType = type;
153
+ memo.push(v8[`paint_${type}`][name]);
154
154
  return memo;
155
155
  }, []);
156
156
 
@@ -169,7 +169,7 @@ function emitlayerProperties(locals) {
169
169
  `// This file is generated. Edit build/generate-style-code.ts, then run 'npm run codegen'.
170
170
  /* eslint-disable */
171
171
 
172
- import styleSpec from '../../style-spec/reference/latest';
172
+ import {latest as styleSpec} from '@maplibre/maplibre-gl-style-spec';
173
173
 
174
174
  import {
175
175
  Properties,
@@ -182,22 +182,23 @@ import {
182
182
  CrossFaded
183
183
  } from '../properties';
184
184
 
185
- import type Color from '../../style-spec/util/color';
186
- import type Padding from '../../style-spec/util/padding';
185
+ import type {Color} from '@maplibre/maplibre-gl-style-spec';
186
+ import type {Padding} from '@maplibre/maplibre-gl-style-spec';
187
187
 
188
- import type Formatted from '../../style-spec/expression/types/formatted';
188
+ import type {Formatted} from '@maplibre/maplibre-gl-style-spec';
189
189
 
190
- import type ResolvedImage from '../../style-spec/expression/types/resolved_image';
191
- import {StylePropertySpecification} from '../../style-spec/style-spec';
190
+ import type {ResolvedImage} from '@maplibre/maplibre-gl-style-spec';
191
+ import {StylePropertySpecification} from '@maplibre/maplibre-gl-style-spec';
192
192
  `);
193
193
 
194
194
  const overridables = paintProperties.filter(p => p.overridable);
195
195
  if (overridables.length) {
196
- output.push(
197
- `import {
198
- ${overridables.reduce((imports, prop) => { imports.push(runtimeType(prop)); return imports; }, []).join(',\n ')}
199
- } from '../../style-spec/expression/types';
200
- `);
196
+ const overridesArray = `import {
197
+ ${overridables.reduce((imports, prop) => { imports.push(runtimeType(prop)); return imports; }, []).join(',\n ')}
198
+ } from '@maplibre/maplibre-gl-style-spec';
199
+ `;
200
+ console.log(overridesArray);
201
+ output.push(overridesArray);
201
202
  }
202
203
 
203
204
  if (layoutProperties.length) {
@@ -7,20 +7,12 @@ if (!fs.existsSync('dist')) {
7
7
  }
8
8
 
9
9
  console.log('Starting bundling types');
10
- let outputFile = './dist/maplibre-gl.d.ts';
10
+ const outputFile = './dist/maplibre-gl.d.ts';
11
11
  childProcess.execSync(`dts-bundle-generator --umd-module-name=maplibregl -o ${outputFile} ./src/index.ts`);
12
12
  let types = fs.readFileSync(outputFile, 'utf8');
13
13
  // Classes are not exported but should be since this is exported as UMD - fixing...
14
14
  types = types.replace(/declare class/g, 'export declare class');
15
15
  fs.writeFileSync(outputFile, types);
16
16
 
17
- console.log('Finifhed bundling types for maplibre-gl starting style-spec');
17
+ console.log('Finifhed bundling types for maplibre-gl ');
18
18
 
19
- const outputPath = './dist/style-spec';
20
- if (!fs.existsSync(outputPath)) {
21
- fs.mkdirSync(outputPath);
22
- }
23
- outputFile = `${outputPath}/index.d.ts`;
24
- childProcess.execSync(`dts-bundle-generator -o ${outputFile} ./src/style-spec/style-spec.ts`);
25
-
26
- console.log('Finished bundling types');
package/build/readme.md CHANGED
@@ -35,7 +35,7 @@ This file is used by CI to make sure the bundle size is kept constant
35
35
  <hr>
36
36
 
37
37
  ### `npm run codegen`
38
- The `codegen` command runs the following three scripts, to update the corresponding code files based on the `v8.json` style source, and other data files. Contributers should run this command manually when the underlying style data is modified. The generated code files are then commited to the repo.
38
+ The `codegen` command runs the following three scripts, to update the corresponding code files based on the `v8.json` style source, and other data files. Contributors should run this command manually when the underlying style data is modified. The generated code files are then committed to the repo.
39
39
  #### generate-struct-arrays.ts
40
40
  Generates `data/array_types.ts`, which consists of:
41
41
  - `StructArrayLayout_*` subclasses, one for each underlying memory layout
@@ -0,0 +1,21 @@
1
+ /* eslint-disable */
2
+
3
+ var shared, worker, maplibregl;
4
+ // define gets called three times: one for each chunk. we rely on the order
5
+ // they're imported to know which is which
6
+ function define(_, chunk) {
7
+ if (!shared) {
8
+ shared = chunk;
9
+ } else if (!worker) {
10
+ worker = chunk;
11
+ } else {
12
+ var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'
13
+
14
+ var sharedChunk = {};
15
+ shared(sharedChunk);
16
+ maplibregl = chunk(sharedChunk);
17
+ if (typeof window !== 'undefined') {
18
+ maplibregl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,47 @@
1
+ //
2
+ // Our custom intro provides a specialized "define()" function, called by the
3
+ // AMD modules below, that sets up the worker blob URL and then executes the
4
+ // main module, storing its exported value as 'maplibregl'
5
+
6
+ // The three "chunks" imported here are produced by a first Rollup pass,
7
+ // which outputs them as AMD modules.
8
+
9
+ // Shared dependencies, i.e.:
10
+ /*
11
+ define(['exports'], function (exports) {
12
+ // Code for all common dependencies
13
+ // Each module's exports are attached attached to 'exports' (with
14
+ // names rewritten to avoid collisions, etc.)
15
+ })
16
+ */
17
+ import '../../staging/maplibregl/shared';
18
+
19
+ // Worker and its unique dependencies, i.e.:
20
+ /*
21
+ define(['./shared.js'], function (__shared__js) {
22
+ // Code for worker script and its unique dependencies.
23
+ // Expects the output of 'shared' module to be passed in as an argument,
24
+ // since all references to common deps look like, e.g.,
25
+ // __shared__js.shapeText().
26
+ });
27
+ */
28
+ // When this wrapper function is passed to our custom define() above,
29
+ // it gets stringified, together with the shared wrapper (using
30
+ // Function.toString()), and the resulting string of code is made into a
31
+ // Blob URL that gets used by the main module to create the web workers.
32
+ import '../../staging/maplibregl/worker';
33
+
34
+ // Main module and its unique dependencies
35
+ /*
36
+ define(['./shared.js'], function (__shared__js) {
37
+ // Code for main GL JS module and its unique dependencies.
38
+ // Expects the output of 'shared' module to be passed in as an argument,
39
+ // since all references to common deps look like, e.g.,
40
+ // __shared__js.shapeText().
41
+ //
42
+ // Returns the actual maplibregl (i.e. src/index.js)
43
+ });
44
+ */
45
+ import '../../staging/maplibregl/index';
46
+
47
+ export default maplibregl;
@@ -4,7 +4,6 @@ import resolve from '@rollup/plugin-node-resolve';
4
4
  import replace from '@rollup/plugin-replace';
5
5
  import commonjs from '@rollup/plugin-commonjs';
6
6
  import terser from '@rollup/plugin-terser';
7
- import minifyStyleSpec from './rollup_plugin_minify_style_spec';
8
7
  import strip from '@rollup/plugin-strip';
9
8
  import {Plugin} from 'rollup';
10
9
  import json from '@rollup/plugin-json';
@@ -18,7 +17,6 @@ export const nodeResolve = resolve({
18
17
  });
19
18
 
20
19
  export const plugins = (production: boolean): Plugin[] => [
21
- minifyStyleSpec(),
22
20
  json(),
23
21
  // https://github.com/zaach/jison/issues/351
24
22
  replace({
@@ -38,7 +36,8 @@ export const plugins = (production: boolean): Plugin[] => [
38
36
  // eslint-disable-next-line camelcase
39
37
  pure_getters: true,
40
38
  passes: 3
41
- }
39
+ },
40
+ sourceMap: true
42
41
  }),
43
42
  nodeResolve,
44
43
  typescript(),