Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add point-geometry and vector-tile types #800

Merged
merged 4 commits into from Jan 22, 2022
Merged

Add point-geometry and vector-tile types #800

merged 4 commits into from Jan 22, 2022

Conversation

HarelM
Copy link
Member

@HarelM HarelM commented Jan 21, 2022

Launch Checklist

Fixes #788
Added point-geometry and vector-tile types packages.

Relevant things to consider:

  1. camera.ts#580 - this is not the same, it used to allow sending {x:number, y:number} object, which will break after this, I'm not sure I mind as the docs doesn't really support this. I removed the test around it. I can bring this code back, but it will need an API change of the object that is being sent, which again, feels wrong.
  2. Removed Point.ts and reverted to use point-geomerty since vector-tile is using it and I wanted to keep the implementation aligned.
  3. There's no register('Point', Point), I'm not sure this is a problem, need to check the 1.x branch, but I don't think it was ever there...
  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Include before/after visuals or gifs if this PR includes visual changes.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 2022

Bundle size report:

Size Change: -646 B
Total Size Before: 194 kB
Total Size After: 193 kB

Output file Before After Change
maplibre-gl.js 185 kB 184 kB -646 B
maplibre-gl.css 9.49 kB 9.49 kB 0 B
ℹ️ View Details
Source file Before After Change
rollup/build/tsc/src/geo/transform.js 3.76 kB 3.78 kB +17 B
rollup/build/tsc/src/ui/popup.js 1.9 kB 1.91 kB +14 B
rollup/build/tsc/src/ui/camera.js 2.96 kB 2.97 kB +12 B
rollup/build/tsc/src/style-spec/util/color_spaces.js 794 B 804 B +10 B
rollup/build/tsc/src/style-spec/expression/index.js 1.6 kB 1.61 kB +10 B
rollup/build/tsc/src/style-spec/expression/values.js 490 B 498 B +8 B
rollup/build/tsc/src/style-spec/expression/definitions/coercion.js 797 B 805 B +8 B
rollup/build/tsc/src/symbol/placement.js 4.65 kB 4.65 kB +8 B
rollup/build/tsc/src/ui/map.js 6.08 kB 6.09 kB +8 B
rollup/build/tsc/src/symbol/projection.js 1.78 kB 1.78 kB +7 B
rollup/build/tsc/src/ui/handler/tap_recognizer.js 530 B 537 B +7 B
rollup/build/tsc/src/ui/handler/touch_pan.js 429 B 436 B +7 B
rollup/build/tsc/src/ui/handler_manager.js 2.33 kB 2.33 kB +7 B
rollup/build/tsc/src/index.js 667 B 674 B +7 B
rollup/build/tsc/src/style-spec/expression/definitions/literal.js 389 B 395 B +6 B
rollup/build/tsc/src/style-spec/expression/definitions/assertion.js 677 B 683 B +6 B
rollup/build/tsc/src/style-spec/expression/definitions/interpolate.js 1.31 kB 1.32 kB +6 B
rollup/build/tsc/src/symbol/collision_index.js 1.57 kB 1.58 kB +6 B
rollup/build/tsc/src/geo/edge_insets.js 426 B 432 B +6 B
rollup/build/tsc/src/ui/events.js 349 B 355 B +6 B
node_modules/csscolorparser/csscolorparser.js 2.05 kB 2.05 kB +5 B
rollup/build/tsc/src/style-spec/expression/definitions/format.js 721 B 726 B +5 B
rollup/build/tsc/src/util/web_worker_transfer.js 931 B 936 B +5 B
rollup/build/tsc/src/util/dom.js 650 B 655 B +5 B
rollup/build/tsc/src/ui/handler_inertia.js 820 B 825 B +5 B
rollup/build/tsc/src/ui/marker.js 2.72 kB 2.73 kB +5 B
rollup/build/tsc/src/style-spec/expression/types.js 505 B 509 B +4 B
rollup/build/tsc/src/style-spec/expression/definitions/index_of.js 541 B 545 B +4 B
rollup/build/tsc/src/style-spec/expression/definitions/slice.js 487 B 491 B +4 B
rollup/build/tsc/src/style-spec/feature_filter/index.js 889 B 893 B +4 B
rollup/build/tsc/src/render/draw_symbol.js 2.48 kB 2.48 kB +4 B
rollup/build/tsc/src/util/browser.js 444 B 447 B +3 B
rollup/build/tsc/src/style-spec/expression/definitions/in.js 444 B 447 B +3 B
rollup/build/tsc/src/style-spec/expression/definitions/index.js 1.62 kB 1.63 kB +3 B
rollup/build/tsc/src/render/image_atlas.js 831 B 834 B +3 B
rollup/build/tsc/src/symbol/get_anchors.js 573 B 576 B +3 B
rollup/build/tsc/src/symbol/symbol_layout.js 3.62 kB 3.62 kB +3 B
rollup/build/tsc/src/style-spec/expression/types/formatted.js 415 B 417 B +2 B
rollup/build/tsc/src/style-spec/expression/evaluation_context.js 309 B 311 B +2 B
rollup/build/tsc/src/style-spec/expression/parsing_context.js 1.02 kB 1.02 kB +2 B
rollup/build/tsc/src/style-spec/expression/definitions/at.js 400 B 402 B +2 B
rollup/build/tsc/src/style-spec/expression/definitions/match.js 906 B 908 B +2 B
rollup/build/tsc/src/symbol/quads.js 1.89 kB 1.89 kB +2 B
rollup/build/tsc/src/data/bucket/symbol_bucket.js 4.24 kB 4.24 kB +2 B
rollup/build/tsc/src/source/tile_id.js 1.12 kB 1.12 kB +2 B
rollup/build/tsc/src/source/source_cache.js 3.67 kB 3.67 kB +2 B
rollup/build/tsc/src/style-spec/util/extend.js 82 B 83 B +1 B
rollup/build/tsc/src/style-spec/expression/types/resolved_image.js 151 B 152 B +1 B
rollup/build/tsc/src/style-spec/expression/definitions/image.js 294 B 295 B +1 B
rollup/build/tsc/src/style-spec/expression/compound_expression.js 760 B 761 B +1 B
rollup/build/tsc/src/style-spec/expression/stops.js 188 B 189 B +1 B
rollup/build/tsc/src/style-spec/util/interpolate.js 173 B 174 B +1 B
rollup/build/tsc/src/style-spec/expression/definitions/coalesce.js 456 B 457 B +1 B
rollup/build/tsc/src/style-spec/expression/definitions/let.js 473 B 474 B +1 B
rollup/build/tsc/src/style-spec/expression/definitions/length.js 369 B 370 B +1 B
rollup/build/tsc/src/style/properties.js 1.87 kB 1.87 kB +1 B
rollup/build/tsc/src/util/struct_array.js 696 B 697 B +1 B
rollup/build/tsc/src/style/query_utils.js 263 B 264 B +1 B
node_modules/gl-matrix/esm/vec4.js 447 B 448 B +1 B
rollup/build/tsc/src/util/image.js 650 B 651 B +1 B
rollup/build/tsc/src/util/color_ramp.js 318 B 319 B +1 B
rollup/build/tsc/src/data/bucket/fill_bucket.js 1.09 kB 1.09 kB +1 B
rollup/build/tsc/src/symbol/transform_text.js 202 B 203 B +1 B
node_modules/pbf/index.js 2.81 kB 2.81 kB +1 B
rollup/build/tsc/src/symbol/check_max_angle.js 286 B 287 B +1 B
rollup/build/tsc/src/style/format_section_override.js 307 B 308 B +1 B
rollup/build/tsc/src/style/style_layer/heatmap_style_layer.js 359 B 360 B +1 B
rollup/build/tsc/src/style/style_layer/fill_style_layer.js 275 B 276 B +1 B
rollup/build/tsc/src/data/dem_data.js 759 B 760 B +1 B
rollup/build/tsc/src/util/actor.js 871 B 872 B +1 B
rollup/build/tsc/src/source/geojson_wrapper.js 380 B 381 B +1 B
rollup/build/tsc/src/util/offscreen_canvas_supported.js 154 B 155 B +1 B
rollup/build/tsc/src/util/worker_pool.js 418 B 419 B +1 B
rollup/build/tsc/src/style-spec/expression/scope.js 196 B 195 B -1 B
rollup/build/tsc/src/style-spec/expression/definitions/collator.js 438 B 437 B -1 B
rollup/build/tsc/src/style-spec/expression/definitions/var.js 337 B 336 B -1 B
rollup/build/tsc/src/style-spec/expression/definitions/number_format.js 603 B 602 B -1 B
rollup/build/tsc/src/util/config.js 80 B 79 B -1 B
rollup/build/tsc/src/style-spec/util/unbundle_jsonlint.js 181 B 180 B -1 B
rollup/build/tsc/src/style-spec/validate/validate_number.js 222 B 221 B -1 B
rollup/build/tsc/src/style-spec/validate/validate_color.js 142 B 141 B -1 B
rollup/build/tsc/src/style-spec/validate/validate_formatted.js 62 B 61 B -1 B
rollup/build/tsc/src/style-spec/validate/validate_image.js 63 B 62 B -1 B
rollup/build/tsc/src/style-spec/validate/validate_glyphs_url.js 170 B 169 B -1 B
rollup/build/tsc/src/render/uniform_binding.js 642 B 641 B -1 B
rollup/build/tsc/src/data/program_configuration.js 2.62 kB 2.61 kB -1 B
rollup/build/tsc/src/style/style_layer/circle_style_layer_properties.js 227 B 226 B -1 B
rollup/build/tsc/src/style/style_layer/fill_extrusion_style_layer_properties.js 189 B 188 B -1 B
rollup/build/tsc/src/symbol/shaping.js 3.63 kB 3.62 kB -1 B
node_modules/potpack/index.mjs 353 B 352 B -1 B
rollup/build/tsc/src/symbol/clip_line.js 302 B 301 B -1 B
rollup/build/tsc/src/symbol/collision_feature.js 378 B 377 B -1 B
node_modules/tinyqueue/index.js 361 B 360 B -1 B
rollup/build/tsc/src/util/find_pole_of_inaccessibility.js 688 B 687 B -1 B
rollup/build/tsc/src/style/style_layer/symbol_style_layer.js 974 B 973 B -1 B
rollup/build/tsc/src/style/style_layer/raster_style_layer_properties.js 167 B 166 B -1 B
rollup/build/tsc/src/style/style_layer/custom_style_layer.js 486 B 485 B -1 B
rollup/build/tsc/src/style/style_layer/hillshade_style_layer.js 144 B 143 B -1 B
rollup/build/tsc/src/geo/lng_lat.js 584 B 583 B -1 B
rollup/build/tsc/src/geo/lng_lat_bounds.js 614 B 613 B -1 B
rollup/build/tsc/src/util/global_worker_pool.js 338 B 337 B -1 B
rollup/build/tsc/src/symbol/cross_tile_symbol_index.js 1.14 kB 1.13 kB -1 B
rollup/build/tsc/src/render/draw_background.js 529 B 528 B -1 B
rollup/build/tsc/src/style-spec/expression/definitions/comparison.js 876 B 874 B -2 B
rollup/build/tsc/src/style-spec/validate/validate_object.js 393 B 391 B -2 B
rollup/build/tsc/src/style-spec/validate/validate_expression.js 454 B 452 B -2 B
rollup/build/tsc/src/style-spec/validate/validate_string.js 124 B 122 B -2 B
rollup/build/tsc/src/style-spec/validate/validate_light.js 291 B 289 B -2 B
rollup/build/tsc/src/style-spec/validate/validate_boolean.js 124 B 122 B -2 B
rollup/build/tsc/src/style/style_layer/circle_style_layer.js 542 B 540 B -2 B
rollup/build/tsc/src/style/style_layer/fill_style_layer_properties.js 194 B 192 B -2 B
rollup/build/tsc/src/data/bucket/line_bucket.js 2.42 kB 2.41 kB -2 B
rollup/build/tsc/src/util/verticalize_punctuation.js 589 B 587 B -2 B
rollup/build/tsc/src/style/style_layer/symbol_style_layer_properties.js 647 B 645 B -2 B
rollup/build/tsc/src/data/feature_index.js 1.7 kB 1.7 kB -2 B
rollup/build/tsc/src/source/tile_bounds.js 317 B 315 B -2 B
rollup/build/tsc/src/style-spec/util/properties.js 157 B 154 B -3 B
rollup/build/tsc/src/util/evented.js 3.85 kB 3.84 kB -3 B
rollup/build/tsc/src/style-spec/error/validation_error.js 126 B 123 B -3 B
rollup/build/tsc/src/style-spec/validate/validate_constants.js 116 B 113 B -3 B
rollup/build/tsc/src/style-spec/validate_style.min.js 291 B 288 B -3 B
rollup/build/tsc/src/source/rtl_text_plugin.js 922 B 919 B -3 B
rollup/build/tsc/src/style/style_layer/hillshade_style_layer_properties.js 164 B 161 B -3 B
node_modules/@mapbox/vector-tile/lib/vectortilefeature.js 1.01 kB 1.01 kB -3 B
rollup/build/tsc/src/style-spec/validate/validate_function.js 1.15 kB 1.14 kB -4 B
rollup/build/tsc/src/style-spec/validate/validate_property.js 551 B 547 B -4 B
rollup/build/tsc/src/style-spec/validate/validate_layer.js 867 B 863 B -4 B
rollup/build/tsc/src/data/array_types.js 2.77 kB 2.76 kB -4 B
rollup/build/tsc/src/util/transferable_grid_index.js 1.02 kB 1.02 kB -5 B
rollup/build/tsc/src/style-spec/expression/is_constant.js 259 B 254 B -5 B
rollup/build/tsc/src/style-spec/validate/validate_source.js 620 B 615 B -5 B
rollup/build/tsc/src/style/validate_style.js 155 B 150 B -5 B
rollup/build/tsc/src/style-spec/validate/validate_filter.js 626 B 620 B -6 B
rollup/build/tsc/src/style-spec/validate/validate.js 385 B 379 B -6 B
rollup/build/tsc/src/util/intersection_tests.js 947 B 941 B -6 B
rollup/build/tsc/src/util/tile_request_cache.js 1.02 kB 1.01 kB -7 B
rollup/build/tsc/src/util/webp_supported.js 384 B 375 B -9 B
rollup/build/tsc/src/style-spec/expression/definitions/within.js 1.4 kB 1.38 kB -12 B
rollup/build/tsc/src/util/ajax.js 2.32 kB 2.31 kB -15 B
rollup/build/tsc/src/style-spec/util/color.js 354 B 319 B -35 B
rollup/build/tsc/src/util/point.js 672 B 0 B -672 B

@HarelM HarelM marked this pull request as ready for review January 21, 2022 19:39
@HarelM
Copy link
Member Author

HarelM commented Jan 21, 2022

@wipfli @birkskyum @astridx Ready for review.
All the packages that this project uses are now fully typed! :-)

@HarelM HarelM changed the title Main commit to add point and vector-tile types Add point-geometry and vector-tile types Jan 21, 2022
@HarelM
Copy link
Member Author

HarelM commented Jan 21, 2022

I think it might fix #790 too, not sure though...

Copy link
Member

@birkskyum birkskyum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good :)

src/ui/camera.test.ts Show resolved Hide resolved
@birkskyum
Copy link
Member

I got this message in the tsconfig.json

screen

@HarelM
Copy link
Member Author

HarelM commented Jan 21, 2022

I removed vector-tile from there, it might be that there's a need to add @mapbix/vector-tile, I'm not sure.
Where is this error coming from? The IDE?

@birkskyum
Copy link
Member

Yes, the IDE. I don't see any compile errors

@birkskyum
Copy link
Member

Thought it might be some cache, and sure enough restarting vscode fixed it.

Copy link
Member

@wipfli wipfli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @HarelM. Other than the convert-discrepancy this looks good to me.

src/ui/camera.ts Show resolved Hide resolved
build/post-ts-build.js Show resolved Hide resolved
src/ui/camera.test.ts Show resolved Hide resolved
src/ui/camera.test.ts Show resolved Hide resolved
src/ui/camera.test.ts Show resolved Hide resolved
@HarelM
Copy link
Member Author

HarelM commented Jan 22, 2022

I moved one line from camera.js to point convert as it felt like it should be there when migrating to typescript.
But from API point of view in terms of typescript we don't really support offset as x,y object although the code used to support it.
IDK...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove vector-tile module declaration
3 participants