maplibre-gl 2.2.0-pre.2 → 2.2.0

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 (169) hide show
  1. package/README.md +73 -8
  2. package/build/generate-debug-index-file.ts +19 -0
  3. package/build/generate-style-code.ts +6 -1
  4. package/build/generate-style-spec.ts +151 -35
  5. package/build/rollup_plugins.ts +4 -1
  6. package/dist/maplibre-gl-csp-worker.js +1 -1
  7. package/dist/maplibre-gl-csp-worker.js.map +1 -1
  8. package/dist/maplibre-gl-csp.js +1 -1
  9. package/dist/maplibre-gl-csp.js.map +1 -1
  10. package/dist/maplibre-gl-dev.js +1317 -4304
  11. package/dist/maplibre-gl.css +1 -1
  12. package/dist/maplibre-gl.d.ts +443 -145
  13. package/dist/maplibre-gl.js +4 -4
  14. package/dist/maplibre-gl.js.map +1 -1
  15. package/package.json +70 -67
  16. package/src/css/maplibre-gl.css +48 -32
  17. package/src/data/bucket/fill_bucket.test.ts +1 -0
  18. package/src/data/bucket/symbol_bucket.test.ts +2 -0
  19. package/src/data/bucket/symbol_bucket.ts +1 -1
  20. package/src/data/evaluation_feature.ts +1 -1
  21. package/src/data/program_configuration.ts +2 -2
  22. package/src/geo/transform.test.ts +34 -1
  23. package/src/geo/transform.ts +25 -15
  24. package/src/gl/vertex_buffer.ts +4 -4
  25. package/src/index.ts +1 -1
  26. package/src/render/draw_debug.ts +1 -1
  27. package/src/render/draw_symbol.test.ts +2 -23
  28. package/src/render/draw_terrain.ts +1 -1
  29. package/src/render/image_atlas.ts +1 -0
  30. package/src/render/image_manager.ts +1 -0
  31. package/src/render/program/debug_program.ts +1 -1
  32. package/src/render/render_to_texture.ts +3 -0
  33. package/src/render/terrain.test.ts +119 -17
  34. package/src/render/terrain.ts +39 -21
  35. package/src/shaders/README.md +2 -2
  36. package/src/shaders/shaders.ts +3 -1
  37. package/src/source/geojson_worker_source.test.ts +2 -2
  38. package/src/source/geojson_wrapper.test.ts +1 -1
  39. package/src/source/image_source.test.ts +8 -8
  40. package/src/source/image_source.ts +1 -1
  41. package/src/source/load_tilejson.ts +6 -1
  42. package/src/source/pixels_to_tile_units.ts +1 -1
  43. package/src/source/raster_tile_source.test.ts +1 -1
  44. package/src/source/source_cache.test.ts +12 -12
  45. package/src/source/source_cache.ts +1 -1
  46. package/src/source/terrain_source_cache.test.ts +17 -2
  47. package/src/source/terrain_source_cache.ts +16 -12
  48. package/src/source/vector_tile_source.test.ts +1 -1
  49. package/src/source/vector_tile_worker_source.test.ts +1 -1
  50. package/src/source/video_source.test.ts +2 -2
  51. package/src/style/light.test.ts +1 -1
  52. package/src/style/load_sprite.ts +1 -1
  53. package/src/style/parse_glyph_pbf.ts +1 -1
  54. package/src/style/style.test.ts +3 -3
  55. package/src/style/style.ts +2 -2
  56. package/src/style/style_layer/background_style_layer_properties.g.ts +1 -0
  57. package/src/style/style_layer/circle_style_layer_properties.g.ts +1 -0
  58. package/src/style/style_layer/fill_extrusion_style_layer_properties.g.ts +1 -0
  59. package/src/style/style_layer/fill_style_layer_properties.g.ts +1 -0
  60. package/src/style/style_layer/heatmap_style_layer_properties.g.ts +1 -0
  61. package/src/style/style_layer/hillshade_style_layer_properties.g.ts +1 -0
  62. package/src/style/style_layer/line_style_layer_properties.g.ts +1 -0
  63. package/src/style/style_layer/raster_style_layer_properties.g.ts +1 -0
  64. package/src/style/style_layer/symbol_style_layer.ts +16 -1
  65. package/src/style/style_layer/symbol_style_layer_properties.g.ts +4 -3
  66. package/src/style-spec/CHANGELOG.md +5 -0
  67. package/src/style-spec/composite.test.ts +2 -0
  68. package/src/style-spec/composite.ts +3 -2
  69. package/src/style-spec/diff.test.ts +3 -3
  70. package/src/style-spec/empty.ts +3 -2
  71. package/src/style-spec/expression/compound_expression.ts +0 -4
  72. package/src/style-spec/expression/definitions/assertion.ts +0 -18
  73. package/src/style-spec/expression/definitions/at.ts +0 -4
  74. package/src/style-spec/expression/definitions/case.ts +0 -6
  75. package/src/style-spec/expression/definitions/coalesce.ts +0 -6
  76. package/src/style-spec/expression/definitions/coercion.ts +13 -18
  77. package/src/style-spec/expression/definitions/collator.ts +0 -10
  78. package/src/style-spec/expression/definitions/comparison.ts +0 -6
  79. package/src/style-spec/expression/definitions/format.ts +0 -19
  80. package/src/style-spec/expression/definitions/image.ts +0 -4
  81. package/src/style-spec/expression/definitions/in.ts +0 -4
  82. package/src/style-spec/expression/definitions/index_of.ts +0 -8
  83. package/src/style-spec/expression/definitions/interpolate.ts +1 -25
  84. package/src/style-spec/expression/definitions/length.ts +0 -6
  85. package/src/style-spec/expression/definitions/let.ts +0 -9
  86. package/src/style-spec/expression/definitions/literal.ts +1 -23
  87. package/src/style-spec/expression/definitions/match.ts +0 -41
  88. package/src/style-spec/expression/definitions/number_format.ts +0 -17
  89. package/src/style-spec/expression/definitions/slice.ts +0 -8
  90. package/src/style-spec/expression/definitions/step.ts +0 -11
  91. package/src/style-spec/expression/definitions/var.ts +0 -4
  92. package/src/style-spec/expression/definitions/within.ts +0 -5
  93. package/src/style-spec/expression/expression.test.ts +1 -1
  94. package/src/style-spec/expression/expression.ts +3 -3
  95. package/src/style-spec/expression/index.ts +8 -2
  96. package/src/style-spec/expression/parsing_context.ts +2 -0
  97. package/src/style-spec/expression/types/formatted.ts +0 -23
  98. package/src/style-spec/expression/types/resolved_image.ts +0 -4
  99. package/src/style-spec/expression/types.ts +6 -1
  100. package/src/style-spec/expression/values.ts +9 -4
  101. package/src/style-spec/feature_filter/convert.ts +65 -65
  102. package/src/style-spec/feature_filter/feature_filter.test.ts +45 -4
  103. package/src/style-spec/feature_filter/index.ts +2 -1
  104. package/src/style-spec/function/index.test.ts +117 -1
  105. package/src/style-spec/function/index.ts +24 -12
  106. package/src/style-spec/migrate/expressions.ts +2 -2
  107. package/src/style-spec/migrate/v8.test.ts +2 -0
  108. package/src/style-spec/migrate/v8.ts +8 -7
  109. package/src/style-spec/migrate/v9.test.ts +6 -4
  110. package/src/style-spec/migrate/v9.ts +3 -2
  111. package/src/style-spec/migrate.test.ts +3 -1
  112. package/src/style-spec/migrate.ts +5 -4
  113. package/src/style-spec/package.json +1 -1
  114. package/src/style-spec/read_style.ts +2 -1
  115. package/src/style-spec/reference/latest.ts +1 -1
  116. package/src/style-spec/reference/v8.json +9 -6
  117. package/src/style-spec/style-spec.test.ts +2 -1
  118. package/src/style-spec/style-spec.ts +8 -0
  119. package/src/style-spec/types.g.ts +152 -36
  120. package/src/style-spec/util/extend.ts +1 -1
  121. package/src/style-spec/util/interpolate.test.ts +5 -0
  122. package/src/style-spec/util/interpolate.ts +12 -0
  123. package/src/style-spec/util/padding.test.ts +27 -0
  124. package/src/style-spec/util/padding.ts +64 -0
  125. package/src/style-spec/util/ref_properties.ts +2 -1
  126. package/src/style-spec/validate/validate.ts +3 -1
  127. package/src/style-spec/validate/validate_expression.ts +2 -1
  128. package/src/style-spec/validate/validate_function.ts +2 -2
  129. package/src/style-spec/validate/validate_glyphs_url.ts +1 -1
  130. package/src/style-spec/validate/validate_object.ts +2 -2
  131. package/src/style-spec/validate/validate_padding.test.ts +82 -0
  132. package/src/style-spec/validate/validate_padding.ts +36 -0
  133. package/src/style-spec/validate_style.min.ts +4 -3
  134. package/src/style-spec/validate_style.ts +4 -3
  135. package/src/symbol/check_max_angle.test.ts +5 -5
  136. package/src/symbol/collision_feature.test.ts +22 -5
  137. package/src/symbol/collision_feature.ts +7 -5
  138. package/src/symbol/collision_index.ts +1 -1
  139. package/src/symbol/get_anchors.test.ts +4 -4
  140. package/src/symbol/{mergelines.test.ts → merge_lines.test.ts} +1 -1
  141. package/src/symbol/{mergelines.ts → merge_lines.ts} +1 -1
  142. package/src/symbol/projection.ts +1 -1
  143. package/src/symbol/quads.test.ts +1 -1
  144. package/src/symbol/shaping.ts +10 -10
  145. package/src/symbol/symbol_layout.ts +5 -4
  146. package/src/symbol/symbol_style_layer.test.ts +1 -1
  147. package/src/symbol/transform_text.ts +3 -3
  148. package/src/ui/camera.test.ts +11 -11
  149. package/src/ui/control/geolocate_control.ts +1 -1
  150. package/src/ui/control/terrain_control.ts +4 -4
  151. package/src/ui/handler/cooperative_gestures.test.ts +167 -0
  152. package/src/ui/handler/drag_pan.test.ts +2 -1
  153. package/src/ui/handler/scroll_zoom.ts +7 -0
  154. package/src/ui/handler/touch_pan.ts +22 -2
  155. package/src/ui/handler/touch_zoom_rotate.ts +18 -1
  156. package/src/ui/handler_manager.ts +2 -2
  157. package/src/ui/map.test.ts +17 -17
  158. package/src/ui/map.ts +76 -8
  159. package/src/ui/map_events.test.ts +33 -32
  160. package/src/ui/popup.test.ts +2 -2
  161. package/src/util/ajax.test.ts +5 -5
  162. package/src/util/ajax.ts +1 -1
  163. package/src/util/classify_rings.test.ts +27 -27
  164. package/src/util/find_pole_of_inaccessibility.ts +1 -1
  165. package/src/util/primitives.ts +4 -4
  166. package/src/util/resolve_tokens.test.ts +1 -1
  167. package/src/util/smart_wrap.ts +1 -1
  168. package/src/util/tile_request_cache.test.ts +5 -5
  169. package/src/util/util.test.ts +5 -5
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "maplibre-gl",
3
3
  "description": "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library",
4
- "version": "2.2.0-pre.2",
4
+ "version": "2.2.0",
5
5
  "main": "dist/maplibre-gl.js",
6
6
  "style": "dist/maplibre-gl.css",
7
7
  "license": "BSD-3-Clause",
@@ -12,125 +12,126 @@
12
12
  "types": "dist/maplibre-gl.d.ts",
13
13
  "type": "module",
14
14
  "dependencies": {
15
- "@mapbox/geojson-rewind": "^0.5.1",
15
+ "@mapbox/geojson-rewind": "^0.5.2",
16
16
  "@mapbox/jsonlint-lines-primitives": "^2.0.2",
17
17
  "@mapbox/mapbox-gl-supported": "^2.0.1",
18
18
  "@mapbox/point-geometry": "^0.1.0",
19
- "@mapbox/tiny-sdf": "^2.0.4",
19
+ "@mapbox/tiny-sdf": "^2.0.5",
20
20
  "@mapbox/unitbezier": "^0.0.1",
21
21
  "@mapbox/vector-tile": "^1.3.1",
22
22
  "@mapbox/whoots-js": "^3.1.0",
23
- "@types/geojson": "^7946.0.8",
23
+ "@types/geojson": "^7946.0.10",
24
24
  "@types/mapbox__point-geometry": "^0.1.2",
25
25
  "@types/mapbox__vector-tile": "^1.3.0",
26
26
  "@types/pbf": "^3.0.2",
27
27
  "csscolorparser": "~1.0.3",
28
- "earcut": "^2.2.3",
28
+ "earcut": "^2.2.4",
29
29
  "geojson-vt": "^3.2.1",
30
30
  "gl-matrix": "^3.4.3",
31
31
  "murmurhash-js": "^1.0.0",
32
32
  "pbf": "^3.2.1",
33
33
  "potpack": "^1.0.2",
34
34
  "quickselect": "^2.0.0",
35
- "supercluster": "^7.1.4",
35
+ "supercluster": "^7.1.5",
36
36
  "tinyqueue": "^2.0.3",
37
37
  "vt-pbf": "^3.1.3"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@mapbox/gazetteer": "^5.1.0",
41
41
  "@mapbox/mapbox-gl-rtl-text": "^0.2.3",
42
- "@mapbox/mvt-fixtures": "^3.6.0",
43
- "@rollup/plugin-commonjs": "^21.0.1",
42
+ "@mapbox/mvt-fixtures": "^3.9.0",
43
+ "@rollup/plugin-commonjs": "^22.0.2",
44
44
  "@rollup/plugin-json": "^4.1.0",
45
- "@rollup/plugin-node-resolve": "^13.1.3",
45
+ "@rollup/plugin-node-resolve": "^13.3.0",
46
46
  "@rollup/plugin-replace": "^4.0.0",
47
47
  "@rollup/plugin-strip": "^2.1.0",
48
- "@rollup/plugin-typescript": "^8.3.0",
49
- "@swc/cli": "^0.1.55",
50
- "@swc/core": "^1.2.135",
51
- "@swc/jest": "^0.2.17",
48
+ "@rollup/plugin-typescript": "^8.3.4",
52
49
  "@types/benchmark": "^2.1.1",
53
50
  "@types/browserify": "^12.0.37",
54
51
  "@types/cssnano": "^5.0.0",
55
- "@types/d3": "^7.1.0",
52
+ "@types/d3": "^7.4.0",
56
53
  "@types/diff": "^5.0.2",
57
54
  "@types/earcut": "^2.1.1",
58
- "@types/eslint": "^8.4.1",
59
- "@types/gl": "^4.1.0",
55
+ "@types/eslint": "^8.4.5",
56
+ "@types/gl": "^4.1.1",
60
57
  "@types/glob": "^7.2.0",
61
- "@types/jest": "^27.4.0",
62
- "@types/jsdom": "^16.2.14",
58
+ "@types/jest": "^28.1.6",
59
+ "@types/jsdom": "^20.0.0",
63
60
  "@types/minimist": "^1.2.2",
64
61
  "@types/murmurhash-js": "^1.0.3",
65
62
  "@types/nise": "^1.4.0",
66
- "@types/offscreencanvas": "^2019.6.4",
63
+ "@types/offscreencanvas": "^2019.7.0",
67
64
  "@types/pixelmatch": "^5.2.4",
68
65
  "@types/pngjs": "^6.0.1",
69
- "@types/react": "^18.0.8",
70
- "@types/react-dom": "^17.0.11",
66
+ "@types/react": "^18.0.15",
67
+ "@types/react-dom": "^18.0.6",
71
68
  "@types/request": "^2.48.8",
72
69
  "@types/rollup-plugin-json": "^3.0.3",
73
70
  "@types/shuffle-seed": "^1.1.0",
74
71
  "@types/supercluster": "^7.1.0",
75
72
  "@types/window-or-global": "^1.0.4",
76
- "@typescript-eslint/eslint-plugin": "^5.14.0",
77
- "@typescript-eslint/parser": "^5.14.0",
78
- "address": "^1.1.2",
73
+ "@typescript-eslint/eslint-plugin": "^5.32.0",
74
+ "@typescript-eslint/parser": "^5.32.0",
75
+ "acorn-import-assertions": "^1.8.0",
76
+ "address": "^1.2.0",
79
77
  "benchmark": "^2.1.4",
80
78
  "browserify": "^17.0.0",
81
- "canvas": "^2.9.0",
82
- "cssnano": "^5.0.16",
83
- "d3": "^7.3.0",
79
+ "canvas": "^2.9.3",
80
+ "cssnano": "^5.1.12",
81
+ "d3": "^7.6.1",
84
82
  "d3-queue": "^3.0.7",
85
- "diff": "^5.0.0",
86
- "documentation": "13.0.2",
87
- "dts-bundle-generator": "^6.4.0",
88
- "eslint": "^8.7.0",
83
+ "diff": "^5.1.0",
84
+ "documentation": "14.0.0-alpha.1",
85
+ "dts-bundle-generator": "^6.12.0",
86
+ "eslint": "^8.21.0",
89
87
  "eslint-config-mourner": "^3.0.0",
90
- "eslint-plugin-html": "^6.2.0",
91
- "eslint-plugin-import": "^2.25.4",
92
- "eslint-plugin-jest": "^26.0.0",
93
- "eslint-plugin-jsdoc": "^39.2.9",
94
- "eslint-plugin-react": "^7.28.0",
95
- "gl": "^5.0.0",
96
- "glob": "^7.2.0",
97
- "is-builtin-module": "^3.1.0",
98
- "jest": "^27.5.1",
99
- "jest-canvas-mock": "^2.3.1",
100
- "jest-playwright-preset": "^1.7.0",
101
- "jsdom": "^19.0.0",
102
- "json-stringify-pretty-compact": "^3.0.0",
88
+ "eslint-plugin-html": "^7.1.0",
89
+ "eslint-plugin-import": "^2.26.0",
90
+ "eslint-plugin-jest": "^26.7.0",
91
+ "eslint-plugin-jsdoc": "^39.3.4",
92
+ "eslint-plugin-react": "^7.30.1",
93
+ "gl": "^5.0.3",
94
+ "glob": "^8.0.3",
95
+ "is-builtin-module": "^3.2.0",
96
+ "jest": "^28.1.3",
97
+ "jest-canvas-mock": "^2.4.0",
98
+ "jest-environment-jsdom": "^28.1.3",
99
+ "jest-playwright-preset": "^2.0.0",
100
+ "jsdom": "^20.0.0",
101
+ "json-stringify-pretty-compact": "^4.0.0",
103
102
  "mapbox-gl-styles": "^2.0.2",
104
- "minimist": "^1.2.5",
103
+ "minimist": "^1.2.6",
105
104
  "mock-geolocation": "^1.0.11",
106
105
  "nise": "^5.1.1",
107
106
  "node-plantuml": "^0.9.0",
108
107
  "npm-font-open-sans": "^1.1.0",
109
108
  "npm-run-all": "^4.1.5",
110
- "pdf-merger-js": "^3.3.2",
111
- "pixelmatch": "^5.2.1",
112
- "playwright": "^1.18.1",
109
+ "pdf-merger-js": "^3.4.0",
110
+ "pixelmatch": "^5.3.0",
111
+ "playwright": "^1.24.2",
113
112
  "pngjs": "^6.0.0",
114
- "postcss": "^8.4.5",
115
- "postcss-cli": "^9.1.0",
113
+ "postcss": "^8.4.14",
114
+ "postcss-cli": "^10.0.0",
116
115
  "postcss-inline-svg": "^5.0.0",
117
116
  "pretty-bytes": "^6.0.0",
118
- "react": "^18.0.0",
119
- "react-dom": "^18.0.0",
117
+ "react": "^18.2.0",
118
+ "react-dom": "^18.2.0",
120
119
  "request": "^2.88.0",
121
- "rollup": "^2.66.1",
120
+ "rollup": "^2.77.2",
121
+ "rollup-plugin-import-assert": "^2.1.0",
122
122
  "rollup-plugin-sourcemaps": "^0.6.3",
123
123
  "rollup-plugin-terser": "^7.0.2",
124
- "rollup-plugin-unassert": "^0.3.0",
125
124
  "rw": "^1.3.3",
126
- "semver": "^7.3.5",
125
+ "semver": "^7.3.7",
127
126
  "shuffle-seed": "^1.1.6",
128
127
  "source-map-explorer": "^2.5.2",
129
128
  "st": "^3.0.0",
130
- "stylelint": "^14.3.0",
131
- "stylelint-config-standard": "^25.0.0",
132
- "ts-node": "^10.5.0",
133
- "typescript": "^4.6.2"
129
+ "stylelint": "^14.9.1",
130
+ "stylelint-config-standard": "^26.0.0",
131
+ "ts-jest": "^28.0.7",
132
+ "ts-node": "^10.9.1",
133
+ "typescript": "^4.7.4",
134
+ "unassert-rollup-plugin": "^2.0.0"
134
135
  },
135
136
  "scripts": {
136
137
  "generate-shaders": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-shaders.ts",
@@ -139,6 +140,7 @@
139
140
  "generate-style-spec": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-style-spec.ts",
140
141
  "generate-typings": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-typings.ts",
141
142
  "generate-query-test-fixtures": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-query-test-fixtures.ts",
143
+ "generate-debug-index-file": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-debug-index-file.ts",
142
144
  "build-dev": "rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev",
143
145
  "watch-dev": "rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev --watch",
144
146
  "build-prod": "rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:production",
@@ -154,22 +156,23 @@
154
156
  "start": "run-p watch-css start-server",
155
157
  "start-debug": "run-p watch-css watch-dev start-server",
156
158
  "start-bench": "run-p watch-css watch-benchmarks start-server-at-test",
157
- "lint": "eslint --cache --ext \".ts,.js,.html\" --ignore-path .gitignore src test build debug/*.html jest.config.js",
159
+ "lint": "eslint --cache --ext \".ts,.tsx,.js,.html\" --ignore-path .gitignore src test build",
158
160
  "lint-docs": "documentation lint src/index.ts",
159
161
  "lint-css": "stylelint \"src/css/maplibre-gl.css\"",
160
162
  "test": "run-s lint lint-css lint-docs test-unit",
161
- "test-build": "jest --roots ./test/build",
163
+ "test-build": "jest -c ./jest.config.builds.ts --roots ./test/build",
162
164
  "test-symbol-shaping": "jest --roots ./test/integration/symbol-shaping",
163
165
  "test-style-spec": "jest --roots ./test/integration/style-spec",
164
- "test-browser": "jest -c ./jest.config.e2e.js --roots ./test/integration/browser",
165
- "test-render": "node --loader ts-node/esm --experimental-specifier-resolution=node --experimental-json-modules --max-old-space-size=2048 test/integration/render/render.test.ts",
166
- "test-query": "jest -c ./jest.config.e2e.js --roots ./test/integration/query",
166
+ "test-browser": "jest -c ./jest.config.e2e.ts --roots ./test/integration/browser",
167
+ "test-render": "node --loader ts-node/esm --experimental-specifier-resolution=node --max-old-space-size=2048 test/integration/render/render.test.ts",
168
+ "test-query": "jest -c ./jest.config.e2e.ts --roots ./test/integration/query",
167
169
  "test-expression": "jest --roots ./test/integration/expression",
168
- "test-unit": "jest --roots ./src",
169
- "codegen": "npm run generate-style-code && npm run generate-struct-arrays && npm run generate-style-spec && npm run generate-shaders",
170
+ "test-unit": "jest -c ./jest.config.ts --roots ./src",
171
+ "codegen": "npm run generate-style-code && npm run generate-struct-arrays && npm run generate-style-spec && npm run generate-shaders && npm run generate-debug-index-file",
170
172
  "benchmark": "node --loader ts-node/esm --experimental-specifier-resolution=node test/bench/run-benchmarks.ts",
171
173
  "gl-stats": "node --loader ts-node/esm --experimental-specifier-resolution=node test/bench/gl-stats.ts",
172
- "postinstall": "node ./postinstall.js"
174
+ "postinstall": "node ./postinstall.js",
175
+ "typecheck": "tsc --project tsconfig.typecheck.json"
173
176
  },
174
177
  "files": [
175
178
  "build/",
@@ -464,26 +464,6 @@
464
464
  100% { transform: rotate(360deg); }
465
465
  }
466
466
 
467
- @keyframes maplibregl-spin {
468
- 0% { transform: rotate(0deg); }
469
- 100% { transform: rotate(360deg); }
470
- }
471
-
472
- @keyframes maplibregl-spin {
473
- 0% { transform: rotate(0deg); }
474
- 100% { transform: rotate(360deg); }
475
- }
476
-
477
- @keyframes maplibregl-spin {
478
- 0% { transform: rotate(0deg); }
479
- 100% { transform: rotate(360deg); }
480
- }
481
-
482
- @keyframes maplibregl-spin {
483
- 0% { transform: rotate(0deg); }
484
- 100% { transform: rotate(360deg); }
485
- }
486
-
487
467
  a.maplibregl-ctrl-logo,
488
468
  a.mapboxgl-ctrl-logo {
489
469
  width: 88px;
@@ -542,6 +522,7 @@ a.mapboxgl-ctrl-logo.mapboxgl-compact {
542
522
  position: relative;
543
523
  background-color: #fff;
544
524
  border-radius: 12px;
525
+ box-sizing: content-box;
545
526
  }
546
527
 
547
528
  .maplibregl-ctrl-attrib.maplibregl-compact-show,
@@ -580,6 +561,15 @@ a.mapboxgl-ctrl-logo.mapboxgl-compact {
580
561
  border: 0;
581
562
  }
582
563
 
564
+ .maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button {
565
+ appearance: none;
566
+ list-style: none;
567
+ }
568
+
569
+ .maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker {
570
+ display: none;
571
+ }
572
+
583
573
  .maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button,
584
574
  .maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,
585
575
  .mapboxgl-ctrl-top-left .mapboxgl-ctrl-attrib-button,
@@ -887,18 +877,6 @@ a.mapboxgl-ctrl-logo.mapboxgl-compact {
887
877
  100% { transform: scale(1); opacity: 0; }
888
878
  }
889
879
 
890
- @keyframes maplibregl-user-location-dot-pulse {
891
- 0% { transform: scale(1); opacity: 1; }
892
- 70% { transform: scale(3); opacity: 0; }
893
- 100% { transform: scale(1); opacity: 0; }
894
- }
895
-
896
- @keyframes maplibregl-user-location-dot-pulse {
897
- 0% { transform: scale(1); opacity: 1; }
898
- 70% { transform: scale(3); opacity: 0; }
899
- 100% { transform: scale(1); opacity: 0; }
900
- }
901
-
902
880
  .maplibregl-user-location-dot-stale,
903
881
  .mapboxgl-user-location-dot-stale {
904
882
  background-color: #aaa;
@@ -937,3 +915,41 @@ a.mapboxgl-ctrl-logo.mapboxgl-compact {
937
915
  border: 2px dotted #202020;
938
916
  opacity: 0.5;
939
917
  }
918
+
919
+ .maplibregl-cooperative-gesture-screen {
920
+ background: rgba(0 0 0 / 40%);
921
+ position: absolute;
922
+ top: 0;
923
+ left: 0;
924
+ right: 0;
925
+ bottom: 0;
926
+ display: flex;
927
+ justify-content: center;
928
+ align-items: center;
929
+ color: white;
930
+ padding: 1rem;
931
+ font-size: 1.4em;
932
+ line-height: 1.2;
933
+ opacity: 0;
934
+ pointer-events: none;
935
+ transition: opacity 1s ease 1s;
936
+ }
937
+
938
+ .maplibregl-cooperative-gesture-screen.maplibregl-show {
939
+ opacity: 1;
940
+ transition: opacity 0.05s;
941
+ }
942
+
943
+ .maplibregl-cooperative-gesture-screen .maplibregl-mobile-message {
944
+ display: none;
945
+ }
946
+
947
+ @media (hover: none), (max-width: 480px) {
948
+ .maplibregl-cooperative-gesture-screen .maplibregl-desktop-message {
949
+ display: none;
950
+ }
951
+
952
+ .maplibregl-cooperative-gesture-screen .maplibregl-mobile-message {
953
+ display: block;
954
+ }
955
+ }
@@ -55,6 +55,7 @@ test('FillBucket segmentation', () => {
55
55
  id: 'test',
56
56
  type: 'fill',
57
57
  layout: {},
58
+ source: 'source',
58
59
  paint: {
59
60
  'fill-color': ['to-color', ['get', 'foo'], '#000']
60
61
  }
@@ -1,3 +1,5 @@
1
+ // @ts-nocheck
2
+
1
3
  import fs from 'fs';
2
4
  import path from 'path';
3
5
  import Protobuf from 'pbf';
@@ -21,7 +21,7 @@ import SegmentVector from '../segment';
21
21
  import {ProgramConfigurationSet} from '../program_configuration';
22
22
  import {TriangleIndexArray, LineIndexArray} from '../index_array_type';
23
23
  import transformText from '../../symbol/transform_text';
24
- import mergeLines from '../../symbol/mergelines';
24
+ import mergeLines from '../../symbol/merge_lines';
25
25
  import {allowsVerticalWritingMode, stringContainsRTLText} from '../../util/script_detection';
26
26
  import {WritingMode} from '../../symbol/shaping';
27
27
  import loadGeometry from '../load_geometry';
@@ -26,6 +26,6 @@ type EvaluationFeature = {
26
26
  export default function toEvaluationFeature(feature: VectorTileFeature, needGeometry: boolean): EvaluationFeature {
27
27
  return {type: feature.type,
28
28
  id: feature.id,
29
- properties:feature.properties,
29
+ properties: feature.properties,
30
30
  geometry: needGeometry ? loadGeometry(feature) : []};
31
31
  }
@@ -698,7 +698,7 @@ function paintAttributeNames(property, type) {
698
698
 
699
699
  function getLayoutException(property) {
700
700
  const propertyExceptions = {
701
- 'line-pattern':{
701
+ 'line-pattern': {
702
702
  'source': PatternLayoutArray,
703
703
  'composite': PatternLayoutArray
704
704
  },
@@ -706,7 +706,7 @@ function getLayoutException(property) {
706
706
  'source': PatternLayoutArray,
707
707
  'composite': PatternLayoutArray
708
708
  },
709
- 'fill-extrusion-pattern':{
709
+ 'fill-extrusion-pattern': {
710
710
  'source': PatternLayoutArray,
711
711
  'composite': PatternLayoutArray
712
712
  }
@@ -93,7 +93,7 @@ describe('transform', () => {
93
93
  transform.latRange = [-5, 5];
94
94
 
95
95
  transform.zoom = 0;
96
- expect(transform.zoom).toBe(5.135709286104402);
96
+ expect(transform.zoom).toBe(5.1357092861044045);
97
97
 
98
98
  transform.center = new LngLat(-50, -30);
99
99
  expect(transform.center).toEqual(new LngLat(0, -0.0063583052861417855));
@@ -103,6 +103,39 @@ describe('transform', () => {
103
103
  expect(transform.center).toEqual(new LngLat(-4.828338623046875, -4.828969771321582));
104
104
  });
105
105
 
106
+ test('lngRange can constrain zoom and center across meridian', () => {
107
+ const transform = new Transform(0, 22, 0, 60, true);
108
+ transform.center = new LngLat(180, 0);
109
+ transform.zoom = 10;
110
+ transform.resize(500, 500);
111
+
112
+ // equivalent ranges
113
+ const lngRanges: [number, number][] = [
114
+ [175, -175], [175, 185], [-185, -175], [-185, 185]
115
+ ];
116
+
117
+ for (const lngRange of lngRanges) {
118
+ transform.lngRange = lngRange;
119
+ transform.latRange = [-5, 5];
120
+
121
+ transform.zoom = 0;
122
+ expect(transform.zoom).toBe(5.1357092861044045);
123
+
124
+ transform.center = new LngLat(-50, -30);
125
+ expect(transform.center).toEqual(new LngLat(180, -0.0063583052861417855));
126
+
127
+ transform.zoom = 10;
128
+ transform.center = new LngLat(-50, -30);
129
+ expect(transform.center).toEqual(new LngLat(-175.171661376953125, -4.828969771321582));
130
+
131
+ transform.center = new LngLat(230, 0);
132
+ expect(transform.center).toEqual(new LngLat(-175.171661376953125, 0));
133
+
134
+ transform.center = new LngLat(130, 0);
135
+ expect(transform.center).toEqual(new LngLat(175.171661376953125, 0));
136
+ }
137
+ });
138
+
106
139
  describe('coveringTiles', () => {
107
140
  const options = {
108
141
  minzoom: 1,
@@ -438,12 +438,9 @@ class Transform {
438
438
  let quadrant = it.aabb.quadrant(i);
439
439
  if (options.terrain) {
440
440
  const tileID = new OverscaledTileID(childZ, it.wrap, childZ, childX, childY);
441
- const tile = options.terrain.getTerrainData(tileID).tile;
442
- let minElevation = this.elevation, maxElevation = this.elevation;
443
- if (tile && tile.dem) {
444
- minElevation = tile.dem.min * options.terrain.exaggeration;
445
- maxElevation = tile.dem.max * options.terrain.exaggeration;
446
- }
441
+ const minMax = options.terrain.getMinMaxElevation(tileID);
442
+ const minElevation = minMax.minElevation ?? this.elevation;
443
+ const maxElevation = minMax.maxElevation ?? this.elevation;
447
444
  quadrant = new Aabb(
448
445
  [quadrant.min[0], quadrant.min[1], minElevation] as vec3,
449
446
  [quadrant.max[0], quadrant.max[1], maxElevation] as vec3
@@ -496,7 +493,7 @@ class Transform {
496
493
  * get the elevation from terrain for the current zoomlevel.
497
494
  * @param lnglat the location
498
495
  * @param terrain the terrain
499
- * @returns {Number} elevation in meters
496
+ * @returns {number} elevation in meters
500
497
  */
501
498
  getElevation(lnglat: LngLat, terrain: Terrain) {
502
499
  const merc = MercatorCoordinate.fromLngLat(lnglat);
@@ -654,8 +651,8 @@ class Transform {
654
651
  /**
655
652
  * Given a coordinate, return the screen point that corresponds to it
656
653
  * @param {Coordinate} coord
657
- * @params {number} elevation default = 0
658
- * @params {mat4} pixelMatrix, default = this.pixelMatrix
654
+ * @param {number} elevation default = 0
655
+ * @param {mat4} pixelMatrix, default = this.pixelMatrix
659
656
  * @returns {Point} screen point
660
657
  * @private
661
658
  */
@@ -766,8 +763,20 @@ class Transform {
766
763
 
767
764
  if (this.lngRange) {
768
765
  const lngRange = this.lngRange;
769
- minX = mercatorXfromLng(lngRange[0]) * this.worldSize;
770
- maxX = mercatorXfromLng(lngRange[1]) * this.worldSize;
766
+
767
+ minX = wrap(
768
+ mercatorXfromLng(lngRange[0]) * this.worldSize,
769
+ 0,
770
+ this.worldSize
771
+ );
772
+ maxX = wrap(
773
+ mercatorXfromLng(lngRange[1]) * this.worldSize,
774
+ 0,
775
+ this.worldSize
776
+ );
777
+
778
+ if (maxX < minX) maxX += this.worldSize;
779
+
771
780
  sx = maxX - minX < size.x ? size.x / (maxX - minX) : 0;
772
781
  }
773
782
 
@@ -795,8 +804,9 @@ class Transform {
795
804
  }
796
805
 
797
806
  if (this.lngRange) {
798
- const x = point.x,
799
- w2 = size.x / 2;
807
+ const centerX = (minX + maxX) / 2;
808
+ const x = wrap(point.x, centerX - this.worldSize / 2, centerX + this.worldSize / 2);
809
+ const w2 = size.x / 2;
800
810
 
801
811
  if (x - w2 < minX) x2 = minX + w2;
802
812
  if (x + w2 > maxX) x2 = maxX - w2;
@@ -806,7 +816,7 @@ class Transform {
806
816
  if (x2 !== undefined || y2 !== undefined) {
807
817
  this.center = this.unproject(new Point(
808
818
  x2 !== undefined ? x2 : point.x,
809
- y2 !== undefined ? y2 : point.y));
819
+ y2 !== undefined ? y2 : point.y)).wrap();
810
820
  }
811
821
 
812
822
  this._unmodified = unmodified;
@@ -909,7 +919,7 @@ class Transform {
909
919
  dx = x - Math.round(x) + angleCos * xShift + angleSin * yShift,
910
920
  dy = y - Math.round(y) + angleCos * yShift + angleSin * xShift;
911
921
  const alignedM = new Float64Array(m) as any as mat4;
912
- mat4.translate(alignedM, alignedM, [ dx > 0.5 ? dx - 1 : dx, dy > 0.5 ? dy - 1 : dy, 0 ]);
922
+ mat4.translate(alignedM, alignedM, [dx > 0.5 ? dx - 1 : dx, dy > 0.5 ? dy - 1 : dy, 0]);
913
923
  this.alignedProjMatrix = alignedM;
914
924
 
915
925
  // inverse matrix for conversion from screen coordinaes to location
@@ -14,11 +14,11 @@ import type Context from '../gl/context';
14
14
  * @readonly
15
15
  */
16
16
  const AttributeType = {
17
- Int8: 'BYTE',
18
- Uint8: 'UNSIGNED_BYTE',
19
- Int16: 'SHORT',
17
+ Int8: 'BYTE',
18
+ Uint8: 'UNSIGNED_BYTE',
19
+ Int16: 'SHORT',
20
20
  Uint16: 'UNSIGNED_SHORT',
21
- Int32: 'INT',
21
+ Int32: 'INT',
22
22
  Uint32: 'UNSIGNED_INT',
23
23
  Float32: 'FLOAT'
24
24
  };
package/src/index.ts CHANGED
@@ -237,7 +237,7 @@ Debug.extend(exported, {isSafari, getPerformanceMetrics: PerformanceUtils.getPer
237
237
  * @param {boolean} lazy If set to `true`, mapboxgl will defer loading the plugin until rtl text is encountered,
238
238
  * rtl text will then be rendered only after the plugin finishes loading.
239
239
  * @example
240
- * maplibregl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js');
240
+ * maplibregl.setRTLTextPlugin('https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.js');
241
241
  * @see [Add support for right-to-left scripts](https://maplibre.org/maplibre-gl-js-docs/example/mapbox-gl-rtl-text/)
242
242
  */
243
243
 
@@ -92,7 +92,7 @@ function drawDebugTile(painter, sourceCache, coord: OverscaledTileID) {
92
92
  if (coord.overscaledZ !== coord.canonical.z) {
93
93
  tileIdText += ` => ${coord.overscaledZ}`;
94
94
  }
95
- const tileLabel = `${tileIdText} ${tileSizeKb}kb`;
95
+ const tileLabel = `${tileIdText} ${tileSizeKb}kB`;
96
96
  drawTextToOverlay(painter, tileLabel);
97
97
 
98
98
  program.draw(context, gl.TRIANGLES, depthMode, stencilMode, ColorMode.alphaBlended, CullFaceMode.disabled,
@@ -14,9 +14,6 @@ import Transform from '../geo/transform';
14
14
  import type EvaluationParameters from '../style/evaluation_parameters';
15
15
  import type {SymbolLayerSpecification} from '../style-spec/types.g';
16
16
  import Style from '../style/style';
17
- import TerrainSourceCache from '../source/terrain_source_cache';
18
- import {Evented} from '../util/evented';
19
- import {RequestManager} from '../util/request_manager';
20
17
 
21
18
  jest.mock('./painter');
22
19
  jest.mock('./program');
@@ -25,22 +22,6 @@ jest.mock('../source/tile');
25
22
  jest.mock('../data/bucket/symbol_bucket');
26
23
  jest.mock('../symbol/projection');
27
24
 
28
- class StubMap extends Evented {
29
- transform: Transform;
30
- painter: Painter;
31
- _requestManager: RequestManager;
32
-
33
- constructor() {
34
- super();
35
- this.transform = new Transform();
36
- this._requestManager = {
37
- transformRequest: (url) => {
38
- return {url};
39
- }
40
- } as any as RequestManager;
41
- }
42
- }
43
-
44
25
  describe('drawSymbol', () => {
45
26
  test('should not do anything', () => {
46
27
  const mockPainter = new Painter(null, null);
@@ -63,7 +44,7 @@ describe('drawSymbol', () => {
63
44
  painterMock.renderPass = 'translucent';
64
45
  painterMock.transform = {pitch: 0, labelPlaneMatrix: mat4.create()} as any as Transform;
65
46
  painterMock.options = {} as any;
66
- painterMock.style = {terrainSourceCache: {getTerrain: () => null}} as any as Style;
47
+ painterMock.style = {} as any as Style;
67
48
 
68
49
  const layerSpec = {
69
50
  id: 'mock-layer',
@@ -164,9 +145,7 @@ describe('drawSymbol', () => {
164
145
  const sourceCacheMock = new SourceCache(null, null, null);
165
146
  (sourceCacheMock.getTile as jest.Mock).mockReturnValue(tile);
166
147
  sourceCacheMock.map = {showCollisionBoxes: false} as any as Map;
167
- painterMock.style = {
168
- terrainSourceCache: new TerrainSourceCache(new Style(new StubMap() as any as Map))
169
- } as any as Style;
148
+ painterMock.style = {} as any as Style;
170
149
 
171
150
  const spy = jest.spyOn(symbolProjection, 'updateLineLabels');
172
151
  drawSymbol(painterMock, sourceCacheMock, layer, [tileId], null);
@@ -107,7 +107,7 @@ function prepareTerrain(painter: Painter, terrain: Terrain, tile: Tile, stack: n
107
107
  if (!tile.textures[stack]) {
108
108
  tile.textures[stack] = painter.getTileTexture(size) || new Texture(context, {width: size, height: size, data: null}, context.gl.RGBA);
109
109
  tile.textures[stack].bind(context.gl.LINEAR, context.gl.CLAMP_TO_EDGE);
110
- if (stack === 0) terrain.sourceCache.renderHistory.push(tile.tileID.key);
110
+ if (stack === 0) terrain.sourceCache.renderHistory.unshift(tile.tileID.key);
111
111
  }
112
112
  const fb = terrain.getRTTFramebuffer();
113
113
  fb.colorAttachment.set(tile.textures[stack].texture);
@@ -1,3 +1,4 @@
1
+ /* eslint-disable key-spacing */
1
2
  import {RGBAImage} from '../util/image';
2
3
  import {register} from '../util/web_worker_transfer';
3
4
  import potpack from 'potpack';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable key-spacing */
1
2
  import potpack from 'potpack';
2
3
 
3
4
  import {Event, ErrorEvent, Evented} from '../util/evented';