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

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 (106) hide show
  1. package/README.md +5 -3
  2. package/build/generate-style-code.ts +4 -0
  3. package/build/generate-style-spec.ts +16 -14
  4. package/build/rollup_plugins.ts +2 -4
  5. package/dist/maplibre-gl-csp-worker.js +1 -1
  6. package/dist/maplibre-gl-csp.js +1 -1
  7. package/dist/maplibre-gl-dev.js +4434 -792
  8. package/dist/maplibre-gl.css +1 -1
  9. package/dist/maplibre-gl.d.ts +488 -348
  10. package/dist/maplibre-gl.js +4 -4
  11. package/dist/style-spec/index.d.ts +85 -81
  12. package/package.json +76 -73
  13. package/src/css/maplibre-gl.css +5 -0
  14. package/src/data/bucket/symbol_bucket.test.ts +1 -1
  15. package/src/data/bucket/symbol_bucket.ts +2 -0
  16. package/src/geo/transform.test.ts +12 -0
  17. package/src/geo/transform.ts +5 -7
  18. package/src/gl/render_pool.test.ts +2 -2
  19. package/src/gl/state.test.ts +1 -1
  20. package/src/gl/vertex_buffer.test.ts +3 -3
  21. package/src/render/draw_fill.test.ts +137 -0
  22. package/src/render/draw_fill.ts +8 -11
  23. package/src/render/draw_fill_extrusion.ts +7 -9
  24. package/src/render/draw_symbol.test.ts +66 -2
  25. package/src/render/draw_symbol.ts +2 -1
  26. package/src/render/glyph_manager.ts +5 -0
  27. package/src/render/image_manager.ts +2 -2
  28. package/src/render/render_to_texture.test.ts +1 -1
  29. package/src/render/terrain.test.ts +4 -4
  30. package/src/render/update_pattern_positions_in_program.ts +46 -0
  31. package/src/source/image_source.test.ts +26 -0
  32. package/src/source/image_source.ts +19 -2
  33. package/src/source/raster_dem_tile_worker_source.ts +1 -1
  34. package/src/source/terrain_source_cache.test.ts +1 -1
  35. package/src/source/vector_tile_source.test.ts +1 -1
  36. package/src/source/worker_tile.ts +1 -1
  37. package/src/style/load_sprite.test.ts +206 -0
  38. package/src/style/load_sprite.ts +59 -32
  39. package/src/style/style.test.ts +157 -0
  40. package/src/style/style.ts +192 -11
  41. package/src/style/validate_style.ts +2 -0
  42. package/src/style-spec/CHANGELOG.md +4 -0
  43. package/src/style-spec/README.md +0 -8
  44. package/src/style-spec/bin/{gl-style-format → gl-style-format.js} +7 -7
  45. package/src/style-spec/bin/gl-style-migrate.js +18 -0
  46. package/src/style-spec/bin/gl-style-validate.js +45 -0
  47. package/src/style-spec/expression/expression.test.ts +1 -1
  48. package/src/style-spec/feature_filter/feature_filter.test.ts +6 -0
  49. package/src/style-spec/migrate.test.ts +1 -1
  50. package/src/style-spec/package.json +4 -5
  51. package/src/style-spec/reference/v8.json +5 -5
  52. package/src/style-spec/style-spec.test.ts +2 -1
  53. package/src/style-spec/style-spec.ts +0 -2
  54. package/src/style-spec/types.g.ts +17 -15
  55. package/src/style-spec/validate/validate.ts +4 -1
  56. package/src/style-spec/validate/validate_array.ts +3 -3
  57. package/src/style-spec/validate/validate_function.ts +8 -3
  58. package/src/style-spec/validate/validate_layer.ts +5 -2
  59. package/src/style-spec/validate/validate_light.ts +4 -4
  60. package/src/style-spec/validate/validate_object.ts +3 -2
  61. package/src/style-spec/validate/validate_padding.test.ts +20 -19
  62. package/src/style-spec/validate/validate_padding.ts +2 -2
  63. package/src/style-spec/validate/validate_property.ts +3 -3
  64. package/src/style-spec/validate/validate_source.ts +9 -1
  65. package/src/style-spec/validate/validate_sprite.test.ts +75 -0
  66. package/src/style-spec/validate/validate_sprite.ts +55 -0
  67. package/src/style-spec/validate/validate_terrain.test.ts +7 -6
  68. package/src/style-spec/validate/validate_terrain.ts +4 -4
  69. package/src/style-spec/validate_style.min.ts +24 -10
  70. package/src/style-spec/visit.ts +1 -1
  71. package/src/symbol/cross_tile_symbol_index.test.ts +23 -1
  72. package/src/symbol/cross_tile_symbol_index.ts +98 -45
  73. package/src/symbol/placement.ts +9 -2
  74. package/src/ui/control/attribution_control.ts +2 -2
  75. package/src/ui/control/navigation_control.test.ts +240 -0
  76. package/src/ui/control/navigation_control.ts +55 -23
  77. package/src/ui/handler/drag_handler.ts +166 -0
  78. package/src/ui/handler/drag_move_state_manager.ts +115 -0
  79. package/src/ui/handler/mouse.ts +70 -154
  80. package/src/ui/handler/mouse_handler_interface.test.ts +118 -0
  81. package/src/ui/handler/mouse_rotate.test.ts +1 -1
  82. package/src/ui/handler/one_finger_touch_drag.ts +45 -0
  83. package/src/ui/handler/one_finger_touch_drag_handler_interface.test.ts +84 -0
  84. package/src/ui/handler/scroll_zoom.test.ts +24 -0
  85. package/src/ui/handler/scroll_zoom.ts +15 -5
  86. package/src/ui/handler/shim/drag_rotate.ts +1 -1
  87. package/src/ui/handler/shim/{touch_zoom_rotate.ts → two_fingers_touch.ts} +6 -6
  88. package/src/ui/handler/{touch_zoom_rotate.test.ts → two_fingers_touch.test.ts} +7 -7
  89. package/src/ui/handler/{touch_zoom_rotate.ts → two_fingers_touch.ts} +10 -10
  90. package/src/ui/handler_manager.ts +64 -46
  91. package/src/ui/map.test.ts +71 -7
  92. package/src/ui/map.ts +142 -46
  93. package/src/util/ajax.ts +1 -28
  94. package/src/util/browser.ts +2 -1
  95. package/src/util/dom.ts +2 -2
  96. package/src/util/style.test.ts +19 -0
  97. package/src/util/style.ts +12 -0
  98. package/src/util/test/util.ts +18 -0
  99. package/src/util/util.ts +47 -2
  100. package/src/util/web_worker_transfer.ts +3 -3
  101. package/build/generate-debug-index-file.ts +0 -19
  102. package/src/style-spec/bin/gl-style-composite +0 -9
  103. package/src/style-spec/bin/gl-style-migrate +0 -9
  104. package/src/style-spec/bin/gl-style-validate +0 -42
  105. package/src/style-spec/composite.test.ts +0 -107
  106. package/src/style-spec/composite.ts +0 -51
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
 
@@ -29,6 +29,8 @@ function nativeType(property) {
29
29
  return 'Color';
30
30
  case 'padding':
31
31
  return 'Padding';
32
+ case 'sprite':
33
+ return 'Sprite';
32
34
  case 'formatted':
33
35
  return 'Formatted';
34
36
  case 'resolvedImage':
@@ -91,6 +93,8 @@ function runtimeType(property) {
91
93
  return 'ColorType';
92
94
  case 'padding':
93
95
  return 'PaddingType';
96
+ case 'sprite':
97
+ return 'SpriteType';
94
98
  case 'formatted':
95
99
  return 'FormattedType';
96
100
  case 'Image':
@@ -122,6 +122,8 @@ export type ColorSpecification = string;
122
122
 
123
123
  export type PaddingSpecification = number | number[];
124
124
 
125
+ export type SpriteSpecification = string | {id: string; url: string}[];
126
+
125
127
  export type FormattedSpecification = string;
126
128
 
127
129
  export type ResolvedImageSpecification = string;
@@ -130,19 +132,19 @@ export type PromoteIdSpecification = {[_: string]: string} | string;
130
132
 
131
133
  export type ExpressionInputType = string | number | boolean;
132
134
 
133
- export type CollatorExpressionSpecification =
135
+ export type CollatorExpressionSpecification =
134
136
  ['collator', {
135
- 'case-sensitive'?: boolean | ExpressionSpecification,
136
- 'diacritic-sensitive'?: boolean | ExpressionSpecification,
137
+ 'case-sensitive'?: boolean | ExpressionSpecification,
138
+ 'diacritic-sensitive'?: boolean | ExpressionSpecification,
137
139
  locale?: string | ExpressionSpecification}
138
140
  ]; // collator
139
141
 
140
142
  export type InterpolationSpecification =
141
- | ['linear']
142
- | ['exponential', number | ExpressionSpecification]
143
+ | ['linear']
144
+ | ['exponential', number | ExpressionSpecification]
143
145
  | ['cubic-bezier', number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification]
144
146
 
145
- export type ExpressionSpecification =
147
+ export type ExpressionSpecification =
146
148
  // types
147
149
  | ['array', unknown | ExpressionSpecification] // array
148
150
  | ['array', ExpressionInputType | ExpressionSpecification, unknown | ExpressionSpecification] // array
@@ -174,7 +176,7 @@ export type ExpressionSpecification =
174
176
  | ['in', ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification]
175
177
  | ['index-of', ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification] // number
176
178
  | ['length', string | ExpressionSpecification]
177
- | ['slice', string | ExpressionSpecification, number | ExpressionSpecification]
179
+ | ['slice', string | ExpressionSpecification, number | ExpressionSpecification, (number | ExpressionSpecification)?]
178
180
  // Decision
179
181
  | ['!', boolean | ExpressionSpecification] // boolean
180
182
  | ['!=', ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, CollatorExpressionSpecification?] // boolean
@@ -185,20 +187,20 @@ export type ExpressionSpecification =
185
187
  | ['>=', ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, CollatorExpressionSpecification?] // boolean
186
188
  | ['all', ...(boolean | ExpressionSpecification)[]] // boolean
187
189
  | ['any', ...(boolean | ExpressionSpecification)[]] // boolean
188
- | ['case', boolean | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
190
+ | ['case', boolean | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
189
191
  ...(boolean | ExpressionInputType | ExpressionSpecification)[], ExpressionInputType | ExpressionSpecification]
190
192
  | ['coalesce', ...(ExpressionInputType | ExpressionSpecification)[]] // at least two inputs required
191
- | ['match', ExpressionInputType | ExpressionSpecification,
192
- ExpressionInputType | ExpressionInputType[], ExpressionInputType | ExpressionSpecification,
193
+ | ['match', ExpressionInputType | ExpressionSpecification,
194
+ ExpressionInputType | ExpressionInputType[], ExpressionInputType | ExpressionSpecification,
193
195
  ...(ExpressionInputType | ExpressionInputType[] | ExpressionSpecification)[], // repeated as above
194
196
  ExpressionInputType | ExpressionSpecification]
195
197
  | ['within', unknown | ExpressionSpecification]
196
198
  // Ramps, scales, curves
197
- | ['interpolate', InterpolationSpecification, number | ExpressionSpecification,
198
- ...(number | number[] | ColorSpecification)[]] // alternating number and number | number[] | ColorSpecification
199
- | ['interpolate-hcl', InterpolationSpecification, number | ExpressionSpecification,
199
+ | ['interpolate', InterpolationSpecification, number | ExpressionSpecification,
200
+ ...(number | number[] | ColorSpecification | ExpressionSpecification)[]] // alternating number and number | number[] | ColorSpecification
201
+ | ['interpolate-hcl', InterpolationSpecification, number | ExpressionSpecification,
200
202
  ...(number | ColorSpecification)[]] // alternating number and ColorSpecificaton
201
- | ['interpolate-lab', InterpolationSpecification, number | ExpressionSpecification,
203
+ | ['interpolate-lab', InterpolationSpecification, number | ExpressionSpecification,
202
204
  ...(number | ColorSpecification)[]] // alternating number and ColorSpecification
203
205
  | ['step', number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
204
206
  ...(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({