maplibre-gl 3.0.0-pre.0 → 3.0.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 (92) hide show
  1. package/README.md +5 -3
  2. package/build/generate-debug-index-file.ts +1 -0
  3. package/build/generate-struct-arrays.ts +2 -0
  4. package/build/generate-style-spec.ts +13 -13
  5. package/build/rollup_plugins.ts +2 -4
  6. package/dist/maplibre-gl-csp-worker.js +1 -1
  7. package/dist/maplibre-gl-csp.js +1 -1
  8. package/dist/maplibre-gl-dev.js +5381 -1898
  9. package/dist/maplibre-gl.css +1 -1
  10. package/dist/maplibre-gl.d.ts +2093 -1991
  11. package/dist/maplibre-gl.js +4 -4
  12. package/dist/style-spec/index.d.ts +78 -78
  13. package/package.json +76 -70
  14. package/src/css/maplibre-gl.css +14 -0
  15. package/src/data/array_types.g.ts +35 -34
  16. package/src/data/bucket/symbol_bucket.test.ts +1 -1
  17. package/src/data/bucket/symbol_bucket.ts +2 -0
  18. package/src/data/pos3d_attributes.ts +5 -0
  19. package/src/geo/transform.test.ts +12 -0
  20. package/src/geo/transform.ts +5 -7
  21. package/src/gl/render_pool.test.ts +67 -0
  22. package/src/gl/render_pool.ts +92 -0
  23. package/src/gl/state.test.ts +1 -1
  24. package/src/gl/vertex_buffer.test.ts +3 -3
  25. package/src/render/draw_fill.test.ts +137 -0
  26. package/src/render/draw_fill.ts +8 -11
  27. package/src/render/draw_fill_extrusion.ts +7 -9
  28. package/src/render/draw_symbol.test.ts +66 -2
  29. package/src/render/draw_symbol.ts +2 -1
  30. package/src/render/draw_terrain.ts +12 -38
  31. package/src/render/painter.ts +5 -4
  32. package/src/render/program/terrain_program.ts +21 -9
  33. package/src/render/render_to_texture.test.ts +141 -34
  34. package/src/render/render_to_texture.ts +86 -64
  35. package/src/render/terrain.test.ts +57 -47
  36. package/src/render/terrain.ts +53 -59
  37. package/src/render/update_pattern_positions_in_program.ts +46 -0
  38. package/src/shaders/terrain.vertex.glsl +6 -3
  39. package/src/shaders/terrain.vertex.glsl.g.ts +1 -1
  40. package/src/source/geojson_source.test.ts +39 -25
  41. package/src/source/geojson_source.ts +42 -14
  42. package/src/source/geojson_source_diff.test.ts +385 -0
  43. package/src/source/geojson_source_diff.ts +135 -0
  44. package/src/source/geojson_worker_source.test.ts +96 -0
  45. package/src/source/geojson_worker_source.ts +26 -4
  46. package/src/source/image_source.test.ts +26 -0
  47. package/src/source/image_source.ts +19 -2
  48. package/src/source/raster_dem_tile_worker_source.ts +1 -1
  49. package/src/source/source_cache.test.ts +6 -7
  50. package/src/source/terrain_source_cache.test.ts +3 -1
  51. package/src/source/terrain_source_cache.ts +13 -31
  52. package/src/source/tile.ts +4 -8
  53. package/src/source/vector_tile_source.test.ts +4 -6
  54. package/src/style/style.test.ts +20 -14
  55. package/src/style/style.ts +4 -44
  56. package/src/style-spec/expression/expression.test.ts +1 -1
  57. package/src/style-spec/feature_filter/feature_filter.test.ts +1 -0
  58. package/src/style-spec/migrate.test.ts +1 -1
  59. package/src/style-spec/reference/v8.json +2 -2
  60. package/src/style-spec/types.g.ts +13 -13
  61. package/src/style-spec/validate/validate_terrain.test.ts +1 -1
  62. package/src/style-spec/validate/validate_terrain.ts +1 -1
  63. package/src/style-spec/visit.ts +1 -1
  64. package/src/symbol/cross_tile_symbol_index.test.ts +23 -1
  65. package/src/symbol/cross_tile_symbol_index.ts +98 -45
  66. package/src/symbol/placement.ts +9 -2
  67. package/src/ui/control/attribution_control.ts +2 -2
  68. package/src/ui/control/fullscreen_control.test.ts +20 -18
  69. package/src/ui/control/fullscreen_control.ts +48 -39
  70. package/src/ui/control/geolocate_control.test.ts +87 -102
  71. package/src/ui/control/navigation_control.test.ts +240 -0
  72. package/src/ui/control/navigation_control.ts +55 -23
  73. package/src/ui/handler/drag_handler.ts +166 -0
  74. package/src/ui/handler/drag_move_state_manager.ts +115 -0
  75. package/src/ui/handler/mouse.ts +70 -154
  76. package/src/ui/handler/mouse_handler_interface.test.ts +118 -0
  77. package/src/ui/handler/mouse_rotate.test.ts +1 -1
  78. package/src/ui/handler/one_finger_touch_drag.ts +45 -0
  79. package/src/ui/handler/one_finger_touch_drag_handler_interface.test.ts +84 -0
  80. package/src/ui/handler/shim/drag_rotate.ts +1 -1
  81. package/src/ui/handler/shim/{touch_zoom_rotate.ts → two_fingers_touch.ts} +6 -6
  82. package/src/ui/handler/{touch_zoom_rotate.test.ts → two_fingers_touch.test.ts} +7 -7
  83. package/src/ui/handler/{touch_zoom_rotate.ts → two_fingers_touch.ts} +10 -10
  84. package/src/ui/handler_manager.ts +13 -10
  85. package/src/ui/map/requestRenderFrame.test.ts +8 -12
  86. package/src/ui/map.test.ts +102 -48
  87. package/src/ui/map.ts +91 -54
  88. package/src/util/browser.ts +2 -1
  89. package/src/util/evented.test.ts +10 -0
  90. package/src/util/evented.ts +5 -2
  91. package/src/util/test/util.ts +18 -0
  92. package/src/util/web_worker_transfer.ts +3 -3
package/README.md CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  # MapLibre GL JS
4
4
 
5
- **[MapLibre GL JS](https://maplibre.org/maplibre-gl-js-docs/api/)** is an open-source library for publishing maps on your websites. Fast displaying of maps is possible thanks to GPU-accelerated vector tile rendering.
5
+ **[MapLibre GL JS](https://maplibre.org/maplibre-gl-js-docs/api/)** is an open-source library for publishing maps on your websites or webview based apps. Fast displaying of maps is possible thanks to GPU-accelerated vector tile rendering.
6
6
 
7
- It originated as an open-source fork of [mapbox-gl-js](https://github.com/mapbox/mapbox-gl-js), before their switch to a non-OSS license in December 2020. The library is intended to be a drop-in replacement for the Mapbox’s version with additional functionality.
7
+ It originated as an open-source fork of [mapbox-gl-js](https://github.com/mapbox/mapbox-gl-js), before their switch to a non-OSS license in December 2020. The library's initial versions (1.x) were intended to be a drop-in replacement for the Mapbox’s OSS version (1.x) with additional functionality, but have evolved a lot since then.
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/
11
12
  <br />
12
13
 
13
14
  ## Getting Started
@@ -98,7 +99,8 @@ Use MapLibre GL JS bindings for React (https://visgl.github.io/react-map-gl/docs
98
99
 
99
100
  ### Getting Involved
100
101
 
101
- Join the #maplibre slack channel at OSMUS: get an invite at https://osmus-slack.herokuapp.com/
102
+ Join the #maplibre slack channel at OSMUS: get an invite at https://slack.openstreetmap.us/
103
+ Read the [CONTRIBUTING.md](CONTRIBUTING.md) guide in order to get familiar with how we do things around here.
102
104
 
103
105
  ### Community Leadership
104
106
 
@@ -10,6 +10,7 @@ fs.writeFileSync('test/debug-pages/index.html', `
10
10
  <html>
11
11
  <head>
12
12
  <title>Debug Pages</title>
13
+ <link rel="icon" href="about:blank">
13
14
  </head>
14
15
  <body>
15
16
  <h1>Debug Pages</h1>
@@ -14,6 +14,7 @@ import {createLayout, viewTypes} from '../src/util/struct_array';
14
14
  import type {ViewType, StructArrayLayout} from '../src/util/struct_array';
15
15
 
16
16
  import posAttributes from '../src/data/pos_attributes';
17
+ import pos3dAttributes from '../src/data/pos3d_attributes';
17
18
  import rasterBoundsAttributes from '../src/data/raster_bounds_attributes';
18
19
  import circleAttributes from '../src/data/bucket/circle_attributes';
19
20
  import fillAttributes from '../src/data/bucket/fill_attributes';
@@ -134,6 +135,7 @@ function camelize (str) {
134
135
  }
135
136
 
136
137
  createStructArrayType('pos', posAttributes);
138
+ createStructArrayType('pos3d', pos3dAttributes);
137
139
  createStructArrayType('raster_bounds', rasterBoundsAttributes);
138
140
 
139
141
  // layout vertex arrays
@@ -130,19 +130,19 @@ export type PromoteIdSpecification = {[_: string]: string} | string;
130
130
 
131
131
  export type ExpressionInputType = string | number | boolean;
132
132
 
133
- export type CollatorExpressionSpecification =
133
+ export type CollatorExpressionSpecification =
134
134
  ['collator', {
135
- 'case-sensitive'?: boolean | ExpressionSpecification,
136
- 'diacritic-sensitive'?: boolean | ExpressionSpecification,
135
+ 'case-sensitive'?: boolean | ExpressionSpecification,
136
+ 'diacritic-sensitive'?: boolean | ExpressionSpecification,
137
137
  locale?: string | ExpressionSpecification}
138
138
  ]; // collator
139
139
 
140
140
  export type InterpolationSpecification =
141
- | ['linear']
142
- | ['exponential', number | ExpressionSpecification]
141
+ | ['linear']
142
+ | ['exponential', number | ExpressionSpecification]
143
143
  | ['cubic-bezier', number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification]
144
144
 
145
- export type ExpressionSpecification =
145
+ export type ExpressionSpecification =
146
146
  // types
147
147
  | ['array', unknown | ExpressionSpecification] // array
148
148
  | ['array', ExpressionInputType | ExpressionSpecification, unknown | ExpressionSpecification] // array
@@ -185,20 +185,20 @@ export type ExpressionSpecification =
185
185
  | ['>=', ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, CollatorExpressionSpecification?] // boolean
186
186
  | ['all', ...(boolean | ExpressionSpecification)[]] // boolean
187
187
  | ['any', ...(boolean | ExpressionSpecification)[]] // boolean
188
- | ['case', boolean | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
188
+ | ['case', boolean | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
189
189
  ...(boolean | ExpressionInputType | ExpressionSpecification)[], ExpressionInputType | ExpressionSpecification]
190
190
  | ['coalesce', ...(ExpressionInputType | ExpressionSpecification)[]] // at least two inputs required
191
- | ['match', ExpressionInputType | ExpressionSpecification,
192
- ExpressionInputType | ExpressionInputType[], ExpressionInputType | ExpressionSpecification,
191
+ | ['match', ExpressionInputType | ExpressionSpecification,
192
+ ExpressionInputType | ExpressionInputType[], ExpressionInputType | ExpressionSpecification,
193
193
  ...(ExpressionInputType | ExpressionInputType[] | ExpressionSpecification)[], // repeated as above
194
194
  ExpressionInputType | ExpressionSpecification]
195
195
  | ['within', unknown | ExpressionSpecification]
196
196
  // Ramps, scales, curves
197
- | ['interpolate', InterpolationSpecification, number | ExpressionSpecification,
198
- ...(number | number[] | ColorSpecification)[]] // alternating number and number | number[] | ColorSpecification
199
- | ['interpolate-hcl', InterpolationSpecification, number | ExpressionSpecification,
197
+ | ['interpolate', InterpolationSpecification, number | ExpressionSpecification,
198
+ ...(number | number[] | ColorSpecification | ExpressionSpecification)[]] // alternating number and number | number[] | ColorSpecification
199
+ | ['interpolate-hcl', InterpolationSpecification, number | ExpressionSpecification,
200
200
  ...(number | ColorSpecification)[]] // alternating number and ColorSpecificaton
201
- | ['interpolate-lab', InterpolationSpecification, number | ExpressionSpecification,
201
+ | ['interpolate-lab', InterpolationSpecification, number | ExpressionSpecification,
202
202
  ...(number | ColorSpecification)[]] // alternating number and ColorSpecification
203
203
  | ['step', number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
204
204
  ...(number | ExpressionInputType | ExpressionSpecification)[]] // alternating number and ExpressionInputType | ExpressionSpecification
@@ -3,12 +3,11 @@ import typescript from '@rollup/plugin-typescript';
3
3
  import resolve from '@rollup/plugin-node-resolve';
4
4
  import replace from '@rollup/plugin-replace';
5
5
  import commonjs from '@rollup/plugin-commonjs';
6
- import json from '@rollup/plugin-json';
7
- import {terser} from 'rollup-plugin-terser';
6
+ import terser from '@rollup/plugin-terser';
8
7
  import minifyStyleSpec from './rollup_plugin_minify_style_spec';
9
8
  import strip from '@rollup/plugin-strip';
10
9
  import {Plugin} from 'rollup';
11
- import {importAssertionsPlugin} from 'rollup-plugin-import-assert';
10
+ import json from '@rollup/plugin-json';
12
11
 
13
12
  // Common set of plugins/transformations shared across different rollup
14
13
  // builds (main maplibre bundle, style-spec package, benchmarks bundle)
@@ -20,7 +19,6 @@ export const nodeResolve = resolve({
20
19
 
21
20
  export const plugins = (production: boolean): Plugin[] => [
22
21
  minifyStyleSpec(),
23
- importAssertionsPlugin(),
24
22
  json(),
25
23
  // https://github.com/zaach/jison/issues/351
26
24
  replace({