maplibre-gl 2.2.1 → 2.3.1-pre.2

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 (78) hide show
  1. package/build/generate-query-test-fixtures.ts +3 -2
  2. package/build/generate-struct-arrays.ts +0 -2
  3. package/build/generate-style-spec.ts +12 -17
  4. package/build/generate-typings.ts +11 -1
  5. package/build/rollup_plugins.ts +0 -4
  6. package/dist/maplibre-gl-csp-worker.js +1 -1
  7. package/dist/maplibre-gl-csp.js +1 -1
  8. package/dist/maplibre-gl-dev.js +376 -1402
  9. package/dist/maplibre-gl.d.ts +13 -16
  10. package/dist/maplibre-gl.js +4 -4
  11. package/dist/style-spec/index.d.ts +1768 -0
  12. package/package.json +14 -16
  13. package/src/data/array_types.g.ts +0 -5
  14. package/src/data/bucket/fill_bucket.ts +0 -2
  15. package/src/data/bucket/fill_extrusion_bucket.ts +0 -2
  16. package/src/data/bucket/symbol_bucket.test.ts +30 -19
  17. package/src/data/feature_position_map.ts +1 -2
  18. package/src/gl/framebuffer.ts +3 -2
  19. package/src/gl/index_buffer.ts +1 -2
  20. package/src/gl/vertex_buffer.ts +1 -2
  21. package/src/index.test.ts +9 -0
  22. package/src/index.ts +12 -4
  23. package/src/render/image_manager.ts +5 -7
  24. package/src/render/program/pattern.ts +0 -2
  25. package/src/render/program.ts +12 -9
  26. package/src/render/vertex_array_object.ts +1 -3
  27. package/src/source/geojson_worker_source.ts +0 -4
  28. package/src/source/query_features.ts +0 -3
  29. package/src/source/rtl_text_plugin.ts +3 -4
  30. package/src/source/source_cache.ts +0 -2
  31. package/src/source/tile_id.ts +8 -8
  32. package/src/source/worker.ts +0 -7
  33. package/src/source/worker_tile.ts +12 -3
  34. package/src/style/format_section_override.ts +1 -2
  35. package/src/style/properties.ts +1 -3
  36. package/src/style/style.ts +5 -5
  37. package/src/style/style_layer/custom_style_layer.ts +1 -2
  38. package/src/style/style_layer/symbol_style_layer.ts +1 -3
  39. package/src/style-spec/CHANGELOG.md +10 -0
  40. package/src/style-spec/composite.test.ts +7 -8
  41. package/src/style-spec/expression/compound_expression.ts +0 -4
  42. package/src/style-spec/expression/definitions/assertion.ts +2 -4
  43. package/src/style-spec/expression/definitions/case.ts +1 -2
  44. package/src/style-spec/expression/definitions/coalesce.ts +1 -3
  45. package/src/style-spec/expression/definitions/coercion.ts +2 -4
  46. package/src/style-spec/expression/definitions/match.ts +0 -3
  47. package/src/style-spec/expression/index.ts +13 -15
  48. package/src/style-spec/expression/parsing_context.ts +4 -4
  49. package/src/style-spec/expression/parsing_error.ts +2 -2
  50. package/src/style-spec/expression/values.ts +0 -2
  51. package/src/style-spec/feature_filter/feature_filter.test.ts +39 -2
  52. package/src/style-spec/function/convert.ts +1 -3
  53. package/src/style-spec/migrate/v8.test.ts +12 -14
  54. package/src/style-spec/migrate/v9.test.ts +2 -4
  55. package/src/style-spec/migrate.test.ts +6 -8
  56. package/src/style-spec/package.json +2 -1
  57. package/src/style-spec/types.g.ts +12 -17
  58. package/src/symbol/collision_index.ts +0 -3
  59. package/src/symbol/path_interpolator.ts +0 -2
  60. package/src/symbol/placement.ts +14 -9
  61. package/src/symbol/shaping.ts +0 -4
  62. package/src/symbol/symbol_layout.ts +56 -56
  63. package/src/ui/camera.ts +0 -10
  64. package/src/ui/control/geolocate_control.ts +4 -6
  65. package/src/ui/handler/handler_util.ts +1 -2
  66. package/src/ui/handler/scroll_zoom.ts +0 -2
  67. package/src/ui/handler_manager.ts +0 -2
  68. package/src/ui/map.test.ts +11 -0
  69. package/src/ui/map.ts +11 -0
  70. package/src/util/ajax.ts +1 -2
  71. package/src/util/color_ramp.ts +1 -2
  72. package/src/util/dictionary_coder.ts +1 -3
  73. package/src/util/dispatcher.ts +1 -4
  74. package/src/util/dom.ts +0 -3
  75. package/src/util/image.ts +1 -3
  76. package/src/util/struct_array.ts +0 -5
  77. package/src/util/task_queue.ts +1 -3
  78. package/src/util/web_worker_transfer.ts +5 -6
@@ -26,9 +26,10 @@ function generateFixtureJson(rootDirectory: string, suiteDirectory: string, outp
26
26
  const imagePaths = globs[1];
27
27
  //Extract the filedata into a flat dictionary
28
28
  const allFiles = {};
29
- let allPaths = glob.sync(jsonPaths);
29
+ // Using replace() to fixup Windows paths so they are compatible with glob sync.
30
+ let allPaths = glob.sync(jsonPaths.replace(/\\/g, '/'));
30
31
  if (includeImages) {
31
- allPaths = allPaths.concat(glob.sync(imagePaths));
32
+ allPaths = allPaths.concat(glob.sync(imagePaths.replace(/\\/g, '/')));
32
33
  }
33
34
 
34
35
  //A Set that stores test names that are malformed so they can be removed later
@@ -409,7 +409,6 @@ export class ${structArrayClass} extends ${structArrayLayoutClass} {`);
409
409
  * @private
410
410
  */
411
411
  get(index: number): ${structTypeClass} {
412
- assert(!this.isTransferred);
413
412
  return new ${structTypeClass}(this, index);
414
413
  }`);
415
414
  }
@@ -425,7 +424,6 @@ register('${structArrayClass}', ${structArrayClass});
425
424
  fs.writeFileSync('src/data/array_types.g.ts',
426
425
  `// This file is generated. Edit build/generate-struct-arrays.ts, then run \`npm run codegen\`.
427
426
 
428
- import assert from 'assert';
429
427
  import {Struct, StructArray} from '../util/struct_array';
430
428
  import {register} from '../util/web_worker_transfer';
431
429
  import Point from '@mapbox/point-geometry';
@@ -141,7 +141,7 @@ export type InterpolationSpecification =
141
141
  | ['linear']
142
142
  | ['exponential', number | ExpressionSpecification]
143
143
  | ['cubic-bezier', number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification]
144
-
144
+
145
145
  export type ExpressionSpecification =
146
146
  // types
147
147
  | ['array', unknown | ExpressionSpecification] // array
@@ -187,31 +187,26 @@ export type ExpressionSpecification =
187
187
  | ['any', ...(boolean | ExpressionSpecification)[]] // boolean
188
188
  | ['case', boolean | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
189
189
  ...(boolean | ExpressionInputType | ExpressionSpecification)[], ExpressionInputType | ExpressionSpecification]
190
- | ['coalesce', ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
191
- ...(ExpressionInputType | ExpressionSpecification)[]]
190
+ | ['coalesce', ...(ExpressionInputType | ExpressionSpecification)[]] // at least two inputs required
192
191
  | ['match', ExpressionInputType | ExpressionSpecification,
193
192
  ExpressionInputType | ExpressionInputType[], ExpressionInputType | ExpressionSpecification,
194
193
  ...(ExpressionInputType | ExpressionInputType[] | ExpressionSpecification)[], // repeated as above
195
194
  ExpressionInputType]
196
195
  | ['within', unknown | ExpressionSpecification]
197
196
  // Ramps, scales, curves
198
- | ['interpolate', InterpolationSpecification,
199
- number | ExpressionSpecification, number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
200
- ...(number | ExpressionInputType | ExpressionSpecification)[]]
201
- | ['interpolate-hcl', InterpolationSpecification,
202
- number | ExpressionSpecification, number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
203
- ...(number | ColorSpecification | ExpressionSpecification)[]]
204
- | ['interpolate-lab', InterpolationSpecification,
205
- number | ExpressionSpecification, number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
206
- ...(number | ColorSpecification | ExpressionSpecification)[]]
207
- | ['step', number | ExpressionSpecification, number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
208
- ...(number | ExpressionInputType | ExpressionSpecification)[]]
197
+ | ['interpolate', InterpolationSpecification, number | ExpressionSpecification,
198
+ ...(number | number[] | ColorSpecification)[]] // alternating number and number | number[] | ColorSpecification
199
+ | ['interpolate-hcl', InterpolationSpecification, number | ExpressionSpecification,
200
+ ...(number | ColorSpecification)[]] // alternating number and ColorSpecificaton
201
+ | ['interpolate-lab', InterpolationSpecification, number | ExpressionSpecification,
202
+ ...(number | ColorSpecification)[]] // alternating number and ColorSpecification
203
+ | ['step', number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
204
+ ...(number | ExpressionInputType | ExpressionSpecification)[]] // alternating number and ExpressionInputType | ExpressionSpecification
209
205
  // Variable binding
210
206
  | ['let', string, ExpressionInputType | ExpressionSpecification, ...(string | ExpressionInputType | ExpressionSpecification)[]]
211
207
  | ['var', string]
212
208
  // String
213
- | ['concat', ExpressionInputType | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
214
- ...(ExpressionInputType | ExpressionSpecification)[]] // string
209
+ | ['concat', ...(ExpressionInputType | ExpressionSpecification)[]] // at least two inputs required -> string
215
210
  | ['downcase', string | ExpressionSpecification] // string
216
211
  | ['is-supported-script', string | ExpressionSpecification] // boolean
217
212
  | ['resolved-locale', CollatorExpressionSpecification] // string
@@ -226,7 +221,7 @@ export type ExpressionSpecification =
226
221
  | ['/', number | ExpressionSpecification, number | ExpressionSpecification] // number
227
222
  | ['%', number | ExpressionSpecification, number | ExpressionSpecification] // number
228
223
  | ['^', number | ExpressionSpecification, number | ExpressionSpecification] // number
229
- | ['+', number | ExpressionSpecification, number | ExpressionSpecification, ...(number | ExpressionSpecification)[]] // number
224
+ | ['+', ...(number | ExpressionSpecification)[]] // at least two inputs required -> number
230
225
  | ['abs', number | ExpressionSpecification] // number
231
226
  | ['acos', number | ExpressionSpecification] // number
232
227
  | ['asin', number | ExpressionSpecification] // number
@@ -7,10 +7,20 @@ if (!fs.existsSync('dist')) {
7
7
  }
8
8
 
9
9
  console.log('Starting bundling types');
10
- const outputFile = './dist/maplibre-gl.d.ts';
10
+ let 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
+
17
+ console.log('Finifhed bundling types for maplibre-gl starting style-spec');
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
+
16
26
  console.log('Finished bundling types');
@@ -3,7 +3,6 @@ import typescript from '@rollup/plugin-typescript';
3
3
  import resolve from '@rollup/plugin-node-resolve';
4
4
  import replace from '@rollup/plugin-replace';
5
5
  import commonjs from '@rollup/plugin-commonjs';
6
- import unassert from 'unassert-rollup-plugin';
7
6
  import json from '@rollup/plugin-json';
8
7
  import {terser} from 'rollup-plugin-terser';
9
8
  import minifyStyleSpec from './rollup_plugin_minify_style_spec';
@@ -43,9 +42,6 @@ export const plugins = (production: boolean): Plugin[] => [
43
42
  passes: 3
44
43
  }
45
44
  }),
46
- production && unassert({
47
- include: ['**/*'], // by default, unassert only includes .js files
48
- }),
49
45
  nodeResolve,
50
46
  typescript(),
51
47
  commonjs({