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.
- package/README.md +18 -13
- package/build/banner.ts +2 -3
- package/build/generate-dist-package.js +21 -0
- package/build/generate-shaders.ts +11 -11
- package/build/generate-struct-arrays.ts +1 -1
- package/build/generate-style-code.ts +22 -21
- package/build/generate-typings.ts +2 -10
- package/build/readme.md +1 -1
- package/build/rollup/bundle_prelude.js +21 -0
- package/build/rollup/maplibregl.js +47 -0
- package/build/rollup_plugins.ts +2 -3
- package/dist/maplibre-gl-csp-worker.js +1 -1
- package/dist/maplibre-gl-csp-worker.js.map +1 -1
- package/dist/maplibre-gl-csp.js +1 -1
- package/dist/maplibre-gl-csp.js.map +1 -1
- package/dist/maplibre-gl-dev.js +10107 -8961
- package/dist/maplibre-gl-dev.js.map +1 -0
- package/dist/maplibre-gl.css +1 -1
- package/dist/maplibre-gl.d.ts +513 -1524
- package/dist/maplibre-gl.js +4 -4
- package/dist/maplibre-gl.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +75 -75
- package/src/css/maplibre-gl.css +7 -5
- package/src/data/bucket/fill_bucket.test.ts +1 -1
- package/src/data/bucket/line_bucket.test.ts +1 -1
- package/src/data/bucket/symbol_bucket.ts +5 -6
- package/src/data/feature_index.ts +3 -5
- package/src/data/load_geometry.ts +1 -1
- package/src/data/program_configuration.ts +6 -7
- package/src/geo/edge_insets.ts +5 -5
- package/src/geo/lng_lat.test.ts +0 -10
- package/src/geo/lng_lat.ts +2 -21
- package/src/geo/lng_lat_bounds.test.ts +17 -0
- package/src/geo/lng_lat_bounds.ts +44 -10
- package/src/geo/mercator_coordinate.ts +2 -1
- package/src/geo/transform.test.ts +9 -0
- package/src/geo/transform.ts +6 -6
- package/src/gl/color_mode.ts +1 -1
- package/src/gl/context.ts +11 -11
- package/src/gl/framebuffer.ts +5 -3
- package/src/gl/render_pool.ts +2 -2
- package/src/gl/state.test.ts +1 -1
- package/src/gl/value.ts +14 -1
- package/src/gl/vertex_buffer.ts +1 -1
- package/src/index.test.ts +113 -0
- package/src/index.ts +12 -28
- package/src/render/draw_collision_debug.ts +1 -1
- package/src/render/draw_debug.test.ts +1 -1
- package/src/render/draw_debug.ts +1 -3
- package/src/render/draw_fill.test.ts +1 -1
- package/src/render/draw_fill.ts +1 -1
- package/src/render/draw_heatmap.ts +2 -2
- package/src/render/draw_hillshade.ts +1 -1
- package/src/render/draw_symbol.test.ts +1 -1
- package/src/render/draw_symbol.ts +3 -1
- package/src/render/draw_terrain.ts +1 -1
- package/src/render/image_manager.ts +36 -12
- package/src/render/painter.ts +6 -18
- package/src/render/program/background_program.ts +1 -2
- package/src/render/program/debug_program.ts +1 -1
- package/src/render/program/pattern.ts +1 -1
- package/src/render/program.ts +1 -1
- package/src/render/render_to_texture.test.ts +1 -1
- package/src/render/render_to_texture.ts +4 -3
- package/src/render/terrain.test.ts +1 -1
- package/src/render/terrain.ts +9 -9
- package/src/render/uniform_binding.ts +1 -1
- package/src/render/update_pattern_positions_in_program.ts +2 -2
- package/src/source/canvas_source.ts +1 -1
- package/src/source/geojson_source.test.ts +21 -1
- package/src/source/geojson_source.ts +63 -5
- package/src/source/geojson_worker_source.test.ts +1 -1
- package/src/source/geojson_worker_source.ts +1 -1
- package/src/source/image_source.ts +12 -11
- package/src/source/load_tilejson.ts +3 -2
- package/src/source/query_features.ts +1 -1
- package/src/source/raster_dem_tile_source.ts +4 -3
- package/src/source/raster_tile_source.ts +5 -7
- package/src/source/rtl_text_plugin.ts +2 -1
- package/src/source/source.ts +2 -2
- package/src/source/source_cache.test.ts +80 -2
- package/src/source/source_cache.ts +7 -4
- package/src/source/source_state.ts +1 -1
- package/src/source/terrain_source_cache.test.ts +4 -5
- package/src/source/tile.ts +2 -2
- package/src/source/tile_id.ts +5 -4
- package/src/source/vector_tile_source.test.ts +1 -1
- package/src/source/vector_tile_source.ts +3 -6
- package/src/source/vector_tile_worker_source.test.ts +0 -9
- package/src/source/video_source.ts +5 -4
- package/src/source/worker.test.ts +1 -1
- package/src/source/worker.ts +1 -6
- package/src/source/worker_source.ts +1 -1
- package/src/source/worker_tile.ts +1 -1
- package/src/style/create_style_layer.ts +1 -1
- package/src/style/evaluation_parameters.ts +1 -1
- package/src/style/format_section_override.test.ts +1 -3
- package/src/style/format_section_override.ts +2 -5
- package/src/style/light.test.ts +1 -3
- package/src/style/light.ts +5 -9
- package/src/style/load_glyph_range.ts +2 -1
- package/src/style/load_sprite.test.ts +8 -5
- package/src/style/load_sprite.ts +63 -64
- package/src/style/pauseable_placement.ts +1 -2
- package/src/style/properties.ts +22 -28
- package/src/style/style.test.ts +202 -13
- package/src/style/style.ts +121 -59
- package/src/style/style_image.ts +10 -1
- package/src/style/style_layer/background_style_layer.ts +1 -1
- package/src/style/style_layer/background_style_layer_properties.g.ts +6 -6
- package/src/style/style_layer/circle_style_layer.ts +1 -2
- package/src/style/style_layer/circle_style_layer_properties.g.ts +6 -6
- package/src/style/style_layer/custom_style_layer.ts +1 -1
- package/src/style/style_layer/fill_extrusion_style_layer.ts +1 -2
- package/src/style/style_layer/fill_extrusion_style_layer_properties.g.ts +6 -6
- package/src/style/style_layer/fill_style_layer.ts +1 -2
- package/src/style/style_layer/fill_style_layer_properties.g.ts +6 -6
- package/src/style/style_layer/heatmap_style_layer.ts +1 -1
- package/src/style/style_layer/heatmap_style_layer_properties.g.ts +6 -6
- package/src/style/style_layer/hillshade_style_layer.ts +1 -1
- package/src/style/style_layer/hillshade_style_layer_properties.g.ts +6 -6
- package/src/style/style_layer/line_style_layer.ts +2 -3
- package/src/style/style_layer/line_style_layer_properties.g.ts +6 -6
- package/src/style/style_layer/overlap_mode.test.ts +57 -0
- package/src/style/style_layer/overlap_mode.ts +22 -0
- package/src/style/style_layer/raster_style_layer.ts +1 -1
- package/src/style/style_layer/raster_style_layer_properties.g.ts +6 -6
- package/src/style/style_layer/symbol_style_layer.ts +7 -29
- package/src/style/style_layer/symbol_style_layer_properties.g.ts +9 -9
- package/src/style/style_layer.test.ts +1 -2
- package/src/style/style_layer.ts +4 -8
- package/src/style/style_layer_index.ts +2 -3
- package/src/style/validate_style.ts +2 -2
- package/src/symbol/collision_index.ts +2 -2
- package/src/symbol/get_anchors.ts +5 -5
- package/src/symbol/grid_index.ts +1 -1
- package/src/symbol/placement.ts +4 -9
- package/src/symbol/projection.test.ts +139 -1
- package/src/symbol/projection.ts +231 -47
- package/src/symbol/quads.ts +1 -1
- package/src/symbol/shaping.ts +1 -1
- package/src/symbol/symbol_layout.ts +1 -5
- package/src/symbol/symbol_size.ts +7 -6
- package/src/symbol/symbol_style_layer.test.ts +1 -48
- package/src/symbol/transform_text.ts +2 -2
- package/src/ui/camera.test.ts +44 -0
- package/src/ui/camera.ts +60 -40
- package/src/ui/control/attribution_control.test.ts +2 -4
- package/src/ui/control/fullscreen_control.test.ts +83 -3
- package/src/ui/control/fullscreen_control.ts +38 -2
- package/src/ui/control/geolocate_control.test.ts +92 -26
- package/src/ui/control/geolocate_control.ts +10 -23
- package/src/ui/control/logo_control.test.ts +2 -3
- package/src/ui/control/navigation_control.test.ts +2 -4
- package/src/ui/control/scale_control.test.ts +2 -3
- package/src/ui/control/terrain_control.test.ts +2 -4
- package/src/ui/control/terrain_control.ts +1 -1
- package/src/ui/events.ts +25 -23
- package/src/ui/handler/box_zoom.test.ts +2 -4
- package/src/ui/handler/cooperative_gestures.test.ts +103 -15
- package/src/ui/handler/dblclick_zoom.test.ts +2 -4
- package/src/ui/handler/drag_pan.test.ts +2 -4
- package/src/ui/handler/drag_rotate.test.ts +2 -4
- package/src/ui/handler/keyboard.test.ts +2 -4
- package/src/ui/handler/map_event.test.ts +2 -4
- package/src/ui/handler/mouse_handler_interface.test.ts +0 -7
- package/src/ui/handler/mouse_rotate.test.ts +4 -6
- package/src/ui/handler/one_finger_touch_drag_handler_interface.test.ts +0 -7
- package/src/ui/handler/scroll_zoom.test.ts +2 -4
- package/src/ui/handler/scroll_zoom.ts +4 -4
- package/src/ui/handler/two_fingers_touch.test.ts +2 -4
- package/src/ui/handler_manager.ts +1 -1
- package/src/ui/hash.test.ts +2 -3
- package/src/ui/map/isMoving.test.ts +2 -4
- package/src/ui/map/isRotating.test.ts +2 -4
- package/src/ui/map/isZooming.test.ts +2 -4
- package/src/ui/map/requestRenderFrame.test.ts +2 -4
- package/src/ui/map.test.ts +292 -20
- package/src/ui/map.ts +200 -120
- package/src/ui/map_events.test.ts +18 -4
- package/src/ui/marker.test.ts +2 -3
- package/src/ui/marker.ts +2 -2
- package/src/ui/popup.test.ts +2 -3
- package/src/ui/popup.ts +19 -19
- package/src/util/ajax.test.ts +1 -129
- package/src/util/ajax.ts +7 -145
- package/src/util/browser.ts +7 -2
- package/src/util/color_ramp.test.ts +1 -2
- package/src/util/color_ramp.ts +1 -1
- package/src/util/config.ts +8 -1
- package/src/util/dispatcher.test.ts +35 -12
- package/src/util/dispatcher.ts +7 -7
- package/src/util/evented.ts +2 -2
- package/src/util/geolocation_support.test.ts +55 -0
- package/src/util/geolocation_support.ts +24 -0
- package/src/util/image_request.test.ts +486 -0
- package/src/util/image_request.ts +225 -0
- package/src/util/performance.ts +14 -8
- package/src/util/primitives.ts +1 -1
- package/src/util/request_manager.ts +16 -5
- package/src/util/struct_array.ts +1 -1
- package/src/util/style.test.ts +17 -2
- package/src/util/style.ts +19 -3
- package/src/util/test/util.ts +19 -1
- package/src/util/util.test.ts +53 -1
- package/src/util/util.ts +58 -3
- package/src/util/vectortile_to_geojson.ts +7 -2
- package/src/util/web_worker.ts +2 -2
- package/src/util/web_worker_transfer.ts +3 -5
- package/build/generate-query-test-fixtures.ts +0 -124
- package/build/generate-style-spec.ts +0 -325
- package/build/rollup_plugin_minify_style_spec.ts +0 -25
- package/dist/style-spec/index.d.ts +0 -1772
- package/postinstall.js +0 -1
- package/src/style-spec/.eslintrc +0 -5
- package/src/style-spec/CHANGELOG.md +0 -521
- package/src/style-spec/README.md +0 -50
- package/src/style-spec/bin/gl-style-format.js +0 -22
- package/src/style-spec/bin/gl-style-migrate.js +0 -18
- package/src/style-spec/bin/gl-style-validate.js +0 -45
- package/src/style-spec/declass.test.ts +0 -118
- package/src/style-spec/declass.ts +0 -42
- package/src/style-spec/deref.test.ts +0 -47
- package/src/style-spec/deref.ts +0 -52
- package/src/style-spec/diff.test.ts +0 -413
- package/src/style-spec/diff.ts +0 -393
- package/src/style-spec/dist/.gitkeep +0 -0
- package/src/style-spec/empty.test.ts +0 -14
- package/src/style-spec/empty.ts +0 -30
- package/src/style-spec/error/parsing_error.ts +0 -14
- package/src/style-spec/error/validation_error.ts +0 -18
- package/src/style-spec/expression/compound_expression.ts +0 -157
- package/src/style-spec/expression/definitions/assertion.ts +0 -108
- package/src/style-spec/expression/definitions/at.ts +0 -64
- package/src/style-spec/expression/definitions/case.ts +0 -76
- package/src/style-spec/expression/definitions/coalesce.ts +0 -83
- package/src/style-spec/expression/definitions/coercion.ts +0 -124
- package/src/style-spec/expression/definitions/collator.ts +0 -66
- package/src/style-spec/expression/definitions/comparison.ts +0 -176
- package/src/style-spec/expression/definitions/format.ts +0 -131
- package/src/style-spec/expression/definitions/image.ts +0 -46
- package/src/style-spec/expression/definitions/in.ts +0 -75
- package/src/style-spec/expression/definitions/index.ts +0 -564
- package/src/style-spec/expression/definitions/index_of.ts +0 -88
- package/src/style-spec/expression/definitions/interpolate.ts +0 -246
- package/src/style-spec/expression/definitions/length.ts +0 -53
- package/src/style-spec/expression/definitions/let.ts +0 -61
- package/src/style-spec/expression/definitions/literal.ts +0 -53
- package/src/style-spec/expression/definitions/match.ts +0 -118
- package/src/style-spec/expression/definitions/number_format.ts +0 -115
- package/src/style-spec/expression/definitions/slice.ts +0 -84
- package/src/style-spec/expression/definitions/step.ts +0 -107
- package/src/style-spec/expression/definitions/var.ts +0 -40
- package/src/style-spec/expression/definitions/within.ts +0 -334
- package/src/style-spec/expression/evaluation_context.ts +0 -57
- package/src/style-spec/expression/expression.test.ts +0 -64
- package/src/style-spec/expression/expression.ts +0 -25
- package/src/style-spec/expression/index.ts +0 -470
- package/src/style-spec/expression/is_constant.ts +0 -57
- package/src/style-spec/expression/parsing_context.ts +0 -240
- package/src/style-spec/expression/parsing_error.ts +0 -11
- package/src/style-spec/expression/runtime_error.ts +0 -15
- package/src/style-spec/expression/scope.ts +0 -34
- package/src/style-spec/expression/stops.test.ts +0 -23
- package/src/style-spec/expression/stops.ts +0 -37
- package/src/style-spec/expression/types/collator.ts +0 -51
- package/src/style-spec/expression/types/formatted.ts +0 -49
- package/src/style-spec/expression/types/resolved_image.ts +0 -23
- package/src/style-spec/expression/types.ts +0 -140
- package/src/style-spec/expression/values.ts +0 -126
- package/src/style-spec/feature_filter/README.md +0 -55
- package/src/style-spec/feature_filter/convert.ts +0 -206
- package/src/style-spec/feature_filter/feature_filter.test.ts +0 -709
- package/src/style-spec/feature_filter/index.ts +0 -183
- package/src/style-spec/format.test.ts +0 -30
- package/src/style-spec/format.ts +0 -51
- package/src/style-spec/function/convert.ts +0 -266
- package/src/style-spec/function/index.test.ts +0 -1104
- package/src/style-spec/function/index.ts +0 -274
- package/src/style-spec/group_by_layout.test.ts +0 -64
- package/src/style-spec/group_by_layout.ts +0 -75
- package/src/style-spec/migrate/expressions.ts +0 -34
- package/src/style-spec/migrate/v8.test.ts +0 -507
- package/src/style-spec/migrate/v8.ts +0 -204
- package/src/style-spec/migrate/v9.test.ts +0 -76
- package/src/style-spec/migrate/v9.ts +0 -27
- package/src/style-spec/migrate.test.ts +0 -112
- package/src/style-spec/migrate.ts +0 -37
- package/src/style-spec/package.json +0 -40
- package/src/style-spec/read_style.ts +0 -15
- package/src/style-spec/reference/latest.ts +0 -3
- package/src/style-spec/reference/v8.json +0 -6021
- package/src/style-spec/style-spec.test.ts +0 -203
- package/src/style-spec/style-spec.ts +0 -124
- package/src/style-spec/types.g.ts +0 -572
- package/src/style-spec/util/color.test.ts +0 -18
- package/src/style-spec/util/color.ts +0 -93
- package/src/style-spec/util/color_spaces.test.ts +0 -28
- package/src/style-spec/util/color_spaces.ts +0 -137
- package/src/style-spec/util/deep_equal.ts +0 -26
- package/src/style-spec/util/extend.ts +0 -8
- package/src/style-spec/util/get_type.ts +0 -15
- package/src/style-spec/util/interpolate.test.ts +0 -21
- package/src/style-spec/util/interpolate.ts +0 -32
- package/src/style-spec/util/padding.test.ts +0 -27
- package/src/style-spec/util/padding.ts +0 -64
- package/src/style-spec/util/properties.ts +0 -13
- package/src/style-spec/util/ref_properties.ts +0 -3
- package/src/style-spec/util/result.ts +0 -21
- package/src/style-spec/util/unbundle_jsonlint.ts +0 -22
- package/src/style-spec/validate/latest.ts +0 -11
- package/src/style-spec/validate/validate.ts +0 -82
- package/src/style-spec/validate/validate_array.ts +0 -52
- package/src/style-spec/validate/validate_boolean.ts +0 -15
- package/src/style-spec/validate/validate_color.ts +0 -20
- package/src/style-spec/validate/validate_constants.ts +0 -13
- package/src/style-spec/validate/validate_enum.ts +0 -21
- package/src/style-spec/validate/validate_expression.ts +0 -42
- package/src/style-spec/validate/validate_filter.ts +0 -117
- package/src/style-spec/validate/validate_formatted.ts +0 -10
- package/src/style-spec/validate/validate_function.ts +0 -212
- package/src/style-spec/validate/validate_glyphs_url.ts +0 -21
- package/src/style-spec/validate/validate_image.ts +0 -10
- package/src/style-spec/validate/validate_layer.ts +0 -137
- package/src/style-spec/validate/validate_layout_property.ts +0 -6
- package/src/style-spec/validate/validate_light.ts +0 -47
- package/src/style-spec/validate/validate_number.ts +0 -29
- package/src/style-spec/validate/validate_object.ts +0 -62
- package/src/style-spec/validate/validate_padding.test.ts +0 -83
- package/src/style-spec/validate/validate_padding.ts +0 -36
- package/src/style-spec/validate/validate_paint_property.ts +0 -6
- package/src/style-spec/validate/validate_property.ts +0 -64
- package/src/style-spec/validate/validate_source.ts +0 -119
- package/src/style-spec/validate/validate_sprite.test.ts +0 -75
- package/src/style-spec/validate/validate_sprite.ts +0 -55
- package/src/style-spec/validate/validate_string.ts +0 -15
- package/src/style-spec/validate/validate_terrain.test.ts +0 -44
- package/src/style-spec/validate/validate_terrain.ts +0 -41
- package/src/style-spec/validate_style.min.ts +0 -95
- package/src/style-spec/validate_style.ts +0 -41
- package/src/style-spec/visit.ts +0 -82
- package/src/util/tile_request_cache.test.ts +0 -101
- 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.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/
|
|
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
|
-
| | |
|
|
47
|
+
| | |
|
|
48
|
+
| | |
|
|
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
|
|
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
|
|
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="
|
|
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
|
-
|
|
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
|
|
1
|
+
import packageJSON from '../package.json' assert {type: 'json'};
|
|
2
2
|
|
|
3
|
-
|
|
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
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
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
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as fs from 'fs';
|
|
4
4
|
|
|
5
|
-
import
|
|
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(
|
|
141
|
-
const layoutProperties = Object.keys(
|
|
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
|
-
|
|
144
|
-
|
|
145
|
-
memo.push(
|
|
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(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
memo.push(
|
|
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 '
|
|
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 '
|
|
186
|
-
import type Padding from '
|
|
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 '
|
|
188
|
+
import type {Formatted} from '@maplibre/maplibre-gl-style-spec';
|
|
189
189
|
|
|
190
|
-
import type ResolvedImage from '
|
|
191
|
-
import {StylePropertySpecification} from '
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
|
|
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
|
|
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.
|
|
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;
|
package/build/rollup_plugins.ts
CHANGED
|
@@ -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(),
|