maplibre-gl 3.0.0-pre.4 → 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 -10
- package/build/generate-shaders.ts +11 -11
- package/build/generate-style-code.ts +22 -21
- package/build/generate-typings.ts +2 -10
- package/build/readme.md +1 -1
- package/build/rollup_plugins.ts +0 -2
- 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 +11157 -9907
- package/dist/maplibre-gl-dev.js.map +1 -1
- package/dist/maplibre-gl.css +1 -1
- package/dist/maplibre-gl.d.ts +415 -1468
- package/dist/maplibre-gl.js +4 -4
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +43 -45
- 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 +2 -4
- 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 +14 -8
- 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 +7 -2
- package/src/render/painter.ts +2 -11
- 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 +1 -1
- package/src/source/geojson_source.ts +2 -2
- 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 +9 -9
- package/src/source/load_tilejson.ts +1 -1
- package/src/source/query_features.ts +1 -1
- package/src/source/raster_dem_tile_source.ts +1 -1
- package/src/source/raster_tile_source.ts +1 -1
- 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/tile.ts +2 -2
- package/src/source/tile_id.ts +5 -4
- package/src/source/vector_tile_source.ts +2 -2
- package/src/source/vector_tile_worker_source.test.ts +0 -9
- package/src/source/video_source.ts +3 -3
- package/src/source/worker.test.ts +1 -1
- package/src/source/worker.ts +1 -1
- 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_sprite.ts +60 -61
- package/src/style/pauseable_placement.ts +1 -2
- package/src/style/properties.ts +16 -22
- package/src/style/style.test.ts +146 -12
- package/src/style/style.ts +116 -55
- 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 +59 -39
- package/src/ui/control/attribution_control.test.ts +2 -4
- package/src/ui/control/fullscreen_control.test.ts +59 -3
- package/src/ui/control/fullscreen_control.ts +12 -1
- 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 +268 -20
- package/src/ui/map.ts +180 -110
- 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.ts +3 -3
- package/src/util/color_ramp.test.ts +1 -2
- package/src/util/color_ramp.ts +1 -1
- package/src/util/config.ts +6 -1
- 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.ts +30 -26
- package/src/util/performance.ts +14 -8
- 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 +16 -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-style-spec.ts +0 -325
- package/build/rollup_plugin_minify_style_spec.ts +0 -25
- package/dist/style-spec/index.d.ts +0 -1771
- 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/README.md
CHANGED
|
@@ -43,9 +43,9 @@ Check out the features through [examples](https://maplibre.org/maplibre-gl-js-do
|
|
|
43
43
|
|
|
44
44
|
| Showcases | |
|
|
45
45
|
| ---- | ---- |
|
|
46
|
-
| | |
|
|
47
|
+
| | |
|
|
48
|
+
| | |
|
|
49
49
|
|
|
50
50
|
<br />
|
|
51
51
|
|
|
@@ -64,11 +64,11 @@ The overall migration happens by uninstalling `mapbox-gl` and installing `maplib
|
|
|
64
64
|
|
|
65
65
|
#### Compatibility branch
|
|
66
66
|
|
|
67
|
-
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.
|
|
68
68
|
|
|
69
69
|
#### CDN Links
|
|
70
70
|
|
|
71
|
-
> 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).
|
|
72
72
|
|
|
73
73
|
```diff
|
|
74
74
|
- <script src="https://api.mapbox.com/mapbox-gl-js/v#.#.#/mapbox-gl.js"></script>
|
|
@@ -110,6 +110,14 @@ If you depend on a free software alternative to `mapbox-gl-js`, please consider
|
|
|
110
110
|
|
|
111
111
|
> **MapLibre GL** is developed following [Semantic Versioning (2.0.0)](https://semver.org/spec/v2.0.0.html).
|
|
112
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
|
+
|
|
113
121
|
<br />
|
|
114
122
|
|
|
115
123
|
## Sponsors
|
|
@@ -120,16 +128,16 @@ Read more about the MapLibre Sponsorship Program at [https://maplibre.org/sponso
|
|
|
120
128
|
|
|
121
129
|
Platinum:
|
|
122
130
|
|
|
123
|
-
<img src="https://maplibre.org/img/aws-logo.svg" alt="Logo AWS" width="25%"
|
|
124
|
-
|
|
131
|
+
<a href="https://aws.com"><img src="https://maplibre.org/img/aws-logo.svg" alt="Logo AWS" width="25%"/></a>
|
|
125
132
|
|
|
126
133
|
Silver:
|
|
127
134
|
|
|
128
|
-
<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>
|
|
129
138
|
|
|
130
|
-
|
|
139
|
+
<a href="https://komoot.com/"><img src="https://maplibre.org/img/komoot-logo.svg" alt="Logo komoot" width="25%"/></a>
|
|
131
140
|
|
|
132
|
-
[MIERUNE Inc.](https://www.mierune.co.jp/?lang=en)
|
|
133
141
|
|
|
134
142
|
Backers and Supporters:
|
|
135
143
|
|
|
@@ -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
|
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({
|