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.
- package/README.md +5 -3
- package/build/generate-style-code.ts +4 -0
- package/build/generate-style-spec.ts +16 -14
- package/build/rollup_plugins.ts +2 -4
- package/dist/maplibre-gl-csp-worker.js +1 -1
- package/dist/maplibre-gl-csp.js +1 -1
- package/dist/maplibre-gl-dev.js +4434 -792
- package/dist/maplibre-gl.css +1 -1
- package/dist/maplibre-gl.d.ts +488 -348
- package/dist/maplibre-gl.js +4 -4
- package/dist/style-spec/index.d.ts +85 -81
- package/package.json +76 -73
- package/src/css/maplibre-gl.css +5 -0
- package/src/data/bucket/symbol_bucket.test.ts +1 -1
- package/src/data/bucket/symbol_bucket.ts +2 -0
- package/src/geo/transform.test.ts +12 -0
- package/src/geo/transform.ts +5 -7
- package/src/gl/render_pool.test.ts +2 -2
- package/src/gl/state.test.ts +1 -1
- package/src/gl/vertex_buffer.test.ts +3 -3
- package/src/render/draw_fill.test.ts +137 -0
- package/src/render/draw_fill.ts +8 -11
- package/src/render/draw_fill_extrusion.ts +7 -9
- package/src/render/draw_symbol.test.ts +66 -2
- package/src/render/draw_symbol.ts +2 -1
- package/src/render/glyph_manager.ts +5 -0
- package/src/render/image_manager.ts +2 -2
- package/src/render/render_to_texture.test.ts +1 -1
- package/src/render/terrain.test.ts +4 -4
- package/src/render/update_pattern_positions_in_program.ts +46 -0
- package/src/source/image_source.test.ts +26 -0
- package/src/source/image_source.ts +19 -2
- package/src/source/raster_dem_tile_worker_source.ts +1 -1
- package/src/source/terrain_source_cache.test.ts +1 -1
- package/src/source/vector_tile_source.test.ts +1 -1
- package/src/source/worker_tile.ts +1 -1
- package/src/style/load_sprite.test.ts +206 -0
- package/src/style/load_sprite.ts +59 -32
- package/src/style/style.test.ts +157 -0
- package/src/style/style.ts +192 -11
- package/src/style/validate_style.ts +2 -0
- package/src/style-spec/CHANGELOG.md +4 -0
- package/src/style-spec/README.md +0 -8
- package/src/style-spec/bin/{gl-style-format → gl-style-format.js} +7 -7
- package/src/style-spec/bin/gl-style-migrate.js +18 -0
- package/src/style-spec/bin/gl-style-validate.js +45 -0
- package/src/style-spec/expression/expression.test.ts +1 -1
- package/src/style-spec/feature_filter/feature_filter.test.ts +6 -0
- package/src/style-spec/migrate.test.ts +1 -1
- package/src/style-spec/package.json +4 -5
- package/src/style-spec/reference/v8.json +5 -5
- package/src/style-spec/style-spec.test.ts +2 -1
- package/src/style-spec/style-spec.ts +0 -2
- package/src/style-spec/types.g.ts +17 -15
- package/src/style-spec/validate/validate.ts +4 -1
- package/src/style-spec/validate/validate_array.ts +3 -3
- package/src/style-spec/validate/validate_function.ts +8 -3
- package/src/style-spec/validate/validate_layer.ts +5 -2
- package/src/style-spec/validate/validate_light.ts +4 -4
- package/src/style-spec/validate/validate_object.ts +3 -2
- package/src/style-spec/validate/validate_padding.test.ts +20 -19
- package/src/style-spec/validate/validate_padding.ts +2 -2
- package/src/style-spec/validate/validate_property.ts +3 -3
- package/src/style-spec/validate/validate_source.ts +9 -1
- package/src/style-spec/validate/validate_sprite.test.ts +75 -0
- package/src/style-spec/validate/validate_sprite.ts +55 -0
- package/src/style-spec/validate/validate_terrain.test.ts +7 -6
- package/src/style-spec/validate/validate_terrain.ts +4 -4
- package/src/style-spec/validate_style.min.ts +24 -10
- package/src/style-spec/visit.ts +1 -1
- package/src/symbol/cross_tile_symbol_index.test.ts +23 -1
- package/src/symbol/cross_tile_symbol_index.ts +98 -45
- package/src/symbol/placement.ts +9 -2
- package/src/ui/control/attribution_control.ts +2 -2
- package/src/ui/control/navigation_control.test.ts +240 -0
- package/src/ui/control/navigation_control.ts +55 -23
- package/src/ui/handler/drag_handler.ts +166 -0
- package/src/ui/handler/drag_move_state_manager.ts +115 -0
- package/src/ui/handler/mouse.ts +70 -154
- package/src/ui/handler/mouse_handler_interface.test.ts +118 -0
- package/src/ui/handler/mouse_rotate.test.ts +1 -1
- package/src/ui/handler/one_finger_touch_drag.ts +45 -0
- package/src/ui/handler/one_finger_touch_drag_handler_interface.test.ts +84 -0
- package/src/ui/handler/scroll_zoom.test.ts +24 -0
- package/src/ui/handler/scroll_zoom.ts +15 -5
- package/src/ui/handler/shim/drag_rotate.ts +1 -1
- package/src/ui/handler/shim/{touch_zoom_rotate.ts → two_fingers_touch.ts} +6 -6
- package/src/ui/handler/{touch_zoom_rotate.test.ts → two_fingers_touch.test.ts} +7 -7
- package/src/ui/handler/{touch_zoom_rotate.ts → two_fingers_touch.ts} +10 -10
- package/src/ui/handler_manager.ts +64 -46
- package/src/ui/map.test.ts +71 -7
- package/src/ui/map.ts +142 -46
- package/src/util/ajax.ts +1 -28
- package/src/util/browser.ts +2 -1
- package/src/util/dom.ts +2 -2
- package/src/util/style.test.ts +19 -0
- package/src/util/style.ts +12 -0
- package/src/util/test/util.ts +18 -0
- package/src/util/util.ts +47 -2
- package/src/util/web_worker_transfer.ts +3 -3
- package/build/generate-debug-index-file.ts +0 -19
- package/src/style-spec/bin/gl-style-composite +0 -9
- package/src/style-spec/bin/gl-style-migrate +0 -9
- package/src/style-spec/bin/gl-style-validate +0 -42
- package/src/style-spec/composite.test.ts +0 -107
- 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
|
|
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.txt)[](https://www.npmjs.com/package/maplibre-gl)[](https://github.com/maplibre/maplibre-gl-js/actions/workflows/ci.yml)[](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://
|
|
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
|
package/build/rollup_plugins.ts
CHANGED
|
@@ -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
|
|
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
|
|
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({
|