maplibre-gl 3.2.1 → 3.2.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 (72) hide show
  1. package/build/generate-struct-arrays.ts +3 -2
  2. package/dist/maplibre-gl-csp-worker.js +1 -1
  3. package/dist/maplibre-gl-csp-worker.js.map +1 -1
  4. package/dist/maplibre-gl-csp.js +1 -1
  5. package/dist/maplibre-gl-csp.js.map +1 -1
  6. package/dist/maplibre-gl-dev.js +150 -84
  7. package/dist/maplibre-gl-dev.js.map +1 -1
  8. package/dist/maplibre-gl.d.ts +67 -50
  9. package/dist/maplibre-gl.js +4 -4
  10. package/dist/maplibre-gl.js.map +1 -1
  11. package/package.json +18 -18
  12. package/src/data/array_types.g.ts +32 -10
  13. package/src/data/bucket/circle_bucket.ts +1 -0
  14. package/src/data/bucket/line_bucket.ts +1 -0
  15. package/src/data/bucket/symbol_bucket.ts +1 -0
  16. package/src/data/feature_index.ts +1 -0
  17. package/src/data/program_configuration.ts +1 -0
  18. package/src/data/segment.ts +2 -0
  19. package/src/geo/transform.ts +1 -0
  20. package/src/gl/context.ts +1 -0
  21. package/src/gl/framebuffer.ts +1 -0
  22. package/src/gl/index_buffer.ts +1 -0
  23. package/src/gl/render_pool.ts +2 -1
  24. package/src/gl/vertex_buffer.ts +1 -0
  25. package/src/render/image_atlas.ts +1 -0
  26. package/src/render/line_atlas.ts +1 -0
  27. package/src/render/painter.ts +1 -0
  28. package/src/render/program.ts +1 -0
  29. package/src/render/render_to_texture.ts +31 -14
  30. package/src/render/terrain.ts +3 -0
  31. package/src/render/texture.ts +1 -0
  32. package/src/render/uniform_binding.ts +2 -0
  33. package/src/render/vertex_array_object.ts +1 -0
  34. package/src/shaders/symbol_sdf.fragment.glsl +9 -3
  35. package/src/shaders/symbol_sdf.fragment.glsl.g.ts +1 -1
  36. package/src/source/canvas_source.ts +1 -3
  37. package/src/source/geojson_source.ts +1 -3
  38. package/src/source/image_source.ts +2 -4
  39. package/src/source/source_cache.ts +1 -0
  40. package/src/source/source_state.ts +1 -0
  41. package/src/source/terrain_source_cache.ts +1 -0
  42. package/src/source/tile.ts +1 -0
  43. package/src/source/tile_cache.ts +1 -1
  44. package/src/source/tile_id.ts +1 -0
  45. package/src/source/vector_tile_worker_source.test.ts +79 -0
  46. package/src/source/vector_tile_worker_source.ts +26 -1
  47. package/src/source/worker_source.ts +1 -0
  48. package/src/style/evaluation_parameters.ts +1 -0
  49. package/src/style/properties.ts +14 -0
  50. package/src/style/style.ts +1 -0
  51. package/src/style/style_glyph.ts +1 -0
  52. package/src/symbol/collision_index.ts +1 -0
  53. package/src/symbol/grid_index.ts +1 -0
  54. package/src/ui/camera.ts +8 -8
  55. package/src/ui/handler/box_zoom.ts +1 -3
  56. package/src/ui/handler/click_zoom.ts +1 -3
  57. package/src/ui/handler/keyboard.ts +1 -3
  58. package/src/ui/handler/scroll_zoom.ts +1 -3
  59. package/src/ui/handler/shim/dblclick_zoom.ts +1 -3
  60. package/src/ui/handler/shim/drag_pan.ts +1 -3
  61. package/src/ui/handler/shim/drag_rotate.ts +1 -3
  62. package/src/ui/handler/shim/two_fingers_touch.ts +1 -3
  63. package/src/ui/handler/transform-provider.ts +1 -0
  64. package/src/ui/handler/two_fingers_touch.ts +1 -3
  65. package/src/ui/map.ts +7 -6
  66. package/src/util/ajax.test.ts +33 -0
  67. package/src/util/ajax.ts +5 -0
  68. package/src/util/image.ts +1 -0
  69. package/src/util/image_request.ts +2 -2
  70. package/src/util/performance.ts +1 -2
  71. package/src/util/struct_array.ts +5 -1
  72. package/src/util/test/mock_fetch.ts +51 -0
@@ -75,6 +75,10 @@ export type RequestParameters = {
75
75
  * If `true`, Resource Timing API information will be collected for these transformed requests and returned in a resourceTiming property of relevant data events.
76
76
  */
77
77
  collectResourceTiming?: boolean;
78
+ /**
79
+ * Parameters supported only by browser fetch API. Property of the Request interface contains the cache mode of the request. It controls how the request will interact with the browser's HTTP cache. (https://developer.mozilla.org/en-US/docs/Web/API/Request/cache)
80
+ */
81
+ cache?: RequestCache;
78
82
  };
79
83
  /**
80
84
  * The response callback used in various places
@@ -426,6 +430,7 @@ export type CrossFaded<T> = {
426
430
  from: T;
427
431
  };
428
432
  /**
433
+ * @internal
429
434
  * Implementations of the `Property` interface:
430
435
  *
431
436
  * * Hold metadata about a property that's independent of any specific value: stuff like the type of the value,
@@ -611,6 +616,7 @@ declare const viewTypes: {
611
616
  Float32: Float32ArrayConstructor;
612
617
  };
613
618
  /**
619
+ * @internal
614
620
  * A view type size
615
621
  */
616
622
  export type ViewType = keyof typeof viewTypes;
@@ -628,6 +634,7 @@ export declare class Struct {
628
634
  constructor(structArray: StructArray, index: number);
629
635
  }
630
636
  /**
637
+ * @internal
631
638
  * A struct array memeber
632
639
  */
633
640
  export type StructArrayMember = {
@@ -1375,6 +1382,7 @@ export declare class UniformMatrix4f extends Uniform<mat4> {
1375
1382
  set(v: mat4): void;
1376
1383
  }
1377
1384
  /**
1385
+ * @internal
1378
1386
  * A uniform bindings
1379
1387
  */
1380
1388
  export type UniformBindings = {
@@ -1661,6 +1669,7 @@ export type GlyphMetrics = {
1661
1669
  advance: number;
1662
1670
  };
1663
1671
  /**
1672
+ * @internal
1664
1673
  * A style glyph type
1665
1674
  */
1666
1675
  export type StyleGlyph = {
@@ -2278,6 +2287,7 @@ export declare class DEMData {
2278
2287
  backfillBorder(borderTile: DEMData, dx: number, dy: number): void;
2279
2288
  }
2280
2289
  /**
2290
+ * @internal
2281
2291
  * The worker tile's result type
2282
2292
  */
2283
2293
  export type WorkerTileResult = {
@@ -2399,9 +2409,7 @@ export declare class ImageSource extends Evented implements Source {
2399
2409
  boundsSegments: SegmentVector;
2400
2410
  _loaded: boolean;
2401
2411
  _request: Cancelable;
2402
- /**
2403
- * @hidden
2404
- */
2412
+ /** @internal */
2405
2413
  constructor(id: string, options: ImageSourceSpecification | VideoSourceSpecification | CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented);
2406
2414
  load: (newCoordinates?: Coordinates, successCallback?: () => void) => void;
2407
2415
  loaded(): boolean;
@@ -2485,9 +2493,7 @@ export declare class CanvasSource extends ImageSource {
2485
2493
  */
2486
2494
  pause: () => void;
2487
2495
  _playing: boolean;
2488
- /**
2489
- * @hidden
2490
- */
2496
+ /** @internal */
2491
2497
  constructor(id: string, options: CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented);
2492
2498
  load: () => void;
2493
2499
  /**
@@ -3282,20 +3288,46 @@ export declare class RenderToTexture {
3282
3288
  painter: Painter;
3283
3289
  terrain: Terrain;
3284
3290
  pool: RenderPool;
3291
+ /**
3292
+ * coordsDescendingInv contains a list of all tiles which should be rendered for one render-to-texture tile
3293
+ * e.g. render 4 raster-tiles with size 256px to the 512px render-to-texture tile
3294
+ */
3285
3295
  _coordsDescendingInv: {
3286
3296
  [_: string]: {
3287
3297
  [_: string]: Array<OverscaledTileID>;
3288
3298
  };
3289
3299
  };
3300
+ /**
3301
+ * create a string representation of all to tiles rendered to render-to-texture tiles
3302
+ * this string representation is used to check if tile should be re-rendered.
3303
+ */
3290
3304
  _coordsDescendingInvStr: {
3291
3305
  [_: string]: {
3292
3306
  [_: string]: string;
3293
3307
  };
3294
3308
  };
3309
+ /**
3310
+ * store for render-stacks
3311
+ * a render stack is a set of layers which should be rendered into one texture
3312
+ * every stylesheet can have multiple stacks. A new stack is created if layers which should
3313
+ * not rendered to texture sit inbetween layers which should rendered to texture. e.g. hillshading or symbols
3314
+ */
3295
3315
  _stacks: Array<Array<string>>;
3316
+ /**
3317
+ * remember the previous processed layer to check if a new stack is needed
3318
+ */
3296
3319
  _prevType: string;
3320
+ /**
3321
+ * a list of tiles that can potentially rendered
3322
+ */
3297
3323
  _renderableTiles: Array<Tile>;
3324
+ /**
3325
+ * a list of tiles that should be rendered to screen in the next render-call
3326
+ */
3298
3327
  _rttTiles: Array<Tile>;
3328
+ /**
3329
+ * a list of all layer-ids which should be rendered
3330
+ */
3299
3331
  _renderableLayerIds: Array<string>;
3300
3332
  constructor(painter: Painter, terrain: Terrain);
3301
3333
  destruct(): void;
@@ -3499,6 +3531,7 @@ export declare class TerrainSourceCache extends Evented {
3499
3531
  tilesAfterTime(time?: number): Array<Tile>;
3500
3532
  }
3501
3533
  /**
3534
+ * @internal
3502
3535
  * A terrain GPU related object
3503
3536
  */
3504
3537
  export type TerrainData = {
@@ -3513,6 +3546,7 @@ export type TerrainData = {
3513
3546
  tile: Tile;
3514
3547
  };
3515
3548
  /**
3549
+ * @internal
3516
3550
  * A terrain mesh object
3517
3551
  */
3518
3552
  export type TerrainMesh = {
@@ -4265,6 +4299,7 @@ export declare class VertexArrayObject {
4265
4299
  destroy(): void;
4266
4300
  }
4267
4301
  /**
4302
+ * @internal
4268
4303
  * A single segment of a vector
4269
4304
  */
4270
4305
  export type Segment = {
@@ -5490,6 +5525,7 @@ export declare class Style extends Evented {
5490
5525
  hasTransitions(): boolean;
5491
5526
  _checkLoaded(): void;
5492
5527
  /**
5528
+ * @internal
5493
5529
  * Apply queued style updates in a batch and recalculate zoom-dependent paint properties.
5494
5530
  */
5495
5531
  update(parameters: EvaluationParameters): void;
@@ -5794,9 +5830,7 @@ export declare class DragPanHandler {
5794
5830
  _mousePan: MousePanHandler;
5795
5831
  _touchPan: TouchPanHandler;
5796
5832
  _inertiaOptions: DragPanOptions | boolean;
5797
- /**
5798
- * @hidden
5799
- */
5833
+ /** @internal */
5800
5834
  constructor(el: HTMLElement, mousePan: MousePanHandler, touchPan: TouchPanHandler);
5801
5835
  /**
5802
5836
  * Enables the "drag to pan" interaction.
@@ -6254,30 +6288,30 @@ declare abstract class Camera extends Evented {
6254
6288
  _onEaseEnd: (easeId?: string) => void;
6255
6289
  _easeFrameId: TaskID;
6256
6290
  /**
6257
- * @hidden
6291
+ * @internal
6258
6292
  * holds the geographical coordinate of the target
6259
6293
  */
6260
6294
  _elevationCenter: LngLat;
6261
6295
  /**
6262
- * @hidden
6296
+ * @internal
6263
6297
  * holds the targ altitude value, = center elevation of the target.
6264
6298
  * This value may changes during flight, because new terrain-tiles loads during flight.
6265
6299
  */
6266
6300
  _elevationTarget: number;
6267
6301
  /**
6268
- * @hidden
6302
+ * @internal
6269
6303
  * holds the start altitude value, = center elevation before animation begins
6270
6304
  * this value will recalculated during flight in respect of changing _elevationTarget values,
6271
6305
  * so the linear interpolation between start and target keeps smooth and without jumps.
6272
6306
  */
6273
6307
  _elevationStart: number;
6274
6308
  /**
6275
- * @hidden
6309
+ * @internal
6276
6310
  * Saves the current state of the elevation freeze - this is used during map movement to prevent "rocky" camera movement.
6277
6311
  */
6278
6312
  _elevationFreeze: boolean;
6279
6313
  /**
6280
- * @hidden
6314
+ * @internal
6281
6315
  * Used to track accumulated changes during continuous interaction
6282
6316
  */
6283
6317
  _requestedCameraState?: Transform;
@@ -6549,6 +6583,7 @@ declare abstract class Camera extends Evented {
6549
6583
  */
6550
6584
  cameraForBounds(bounds: LngLatBoundsLike, options?: CameraForBoundsOptions): CenterZoomBearing;
6551
6585
  /**
6586
+ * @internal
6552
6587
  * Calculate the center of these two points in the viewport and use
6553
6588
  * the highest zoom level up to and including `Map#getMaxZoom()` that fits
6554
6589
  * the points in the viewport at the specified bearing.
@@ -6558,7 +6593,6 @@ declare abstract class Camera extends Evented {
6558
6593
  * @param options - the camera options
6559
6594
  * @returns If map is able to fit to provided bounds, returns `center`, `zoom`, and `bearing`.
6560
6595
  * If map is unable to fit, method will warn and return undefined.
6561
- * @hidden
6562
6596
  * @example
6563
6597
  * ```ts
6564
6598
  * let p0 = [-79, 43];
@@ -6680,17 +6714,17 @@ declare abstract class Camera extends Evented {
6680
6714
  _updateElevation(k: number): void;
6681
6715
  _finalizeElevation(): void;
6682
6716
  /**
6717
+ * @internal
6683
6718
  * Called when the camera is about to be manipulated.
6684
6719
  * If `transformCameraUpdate` is specified, a copy of the current transform is created to track the accumulated changes.
6685
6720
  * This underlying transform represents the "desired state" proposed by input handlers / animations / UI controls.
6686
6721
  * It may differ from the state used for rendering (`this.transform`).
6687
- * @hidden
6688
6722
  * @returns Transform to apply changes to
6689
6723
  */
6690
6724
  _getTransformForUpdate(): Transform;
6691
6725
  /**
6726
+ * @internal
6692
6727
  * Called after the camera is done being manipulated.
6693
- * @hidden
6694
6728
  * @param tr - the requested camera end state
6695
6729
  * Call `transformCameraUpdate` if present, and then apply the "approved" changes.
6696
6730
  */
@@ -7438,9 +7472,7 @@ declare abstract class TwoFingersTouchHandler implements Handler {
7438
7472
  _vector: Point;
7439
7473
  _startVector: Point;
7440
7474
  _aroundCenter: boolean;
7441
- /**
7442
- * @hidden
7443
- */
7475
+ /** @internal */
7444
7476
  constructor();
7445
7477
  reset(): void;
7446
7478
  abstract _start(points: [
@@ -7571,9 +7603,7 @@ export declare class ScrollZoomHandler implements Handler {
7571
7603
  _triggerRenderFrame: () => void;
7572
7604
  _defaultZoomRate: number;
7573
7605
  _wheelZoomRate: number;
7574
- /**
7575
- * @hidden
7576
- */
7606
+ /** @internal */
7577
7607
  constructor(map: Map, triggerRenderFrame: () => void);
7578
7608
  /**
7579
7609
  * Set the zoom rate of a trackpad
@@ -7646,9 +7676,7 @@ export declare class BoxZoomHandler implements Handler {
7646
7676
  _lastPos: Point;
7647
7677
  _box: HTMLElement;
7648
7678
  _clickTolerance: number;
7649
- /**
7650
- * @hidden
7651
- */
7679
+ /** @internal */
7652
7680
  constructor(map: Map, options: {
7653
7681
  clickTolerance: number;
7654
7682
  });
@@ -7702,9 +7730,7 @@ export declare class DragRotateHandler {
7702
7730
  _mouseRotate: MouseRotateHandler;
7703
7731
  _mousePitch: MousePitchHandler;
7704
7732
  _pitchWithRotate: boolean;
7705
- /**
7706
- * @hidden
7707
- */
7733
+ /** @internal */
7708
7734
  constructor(options: DragRotateHandlerOptions, mouseRotate: MouseRotateHandler, mousePitch: MousePitchHandler);
7709
7735
  /**
7710
7736
  * Enables the "drag to rotate" interaction.
@@ -7745,9 +7771,7 @@ export declare class KeyboardHandler implements Handler {
7745
7771
  _bearingStep: number;
7746
7772
  _pitchStep: number;
7747
7773
  _rotationDisabled: boolean;
7748
- /**
7749
- * @hidden
7750
- */
7774
+ /** @internal */
7751
7775
  constructor(map: Map);
7752
7776
  reset(): void;
7753
7777
  keydown(e: KeyboardEvent): {
@@ -7812,9 +7836,7 @@ export declare class ClickZoomHandler implements Handler {
7812
7836
  _tr: TransformProvider;
7813
7837
  _enabled: boolean;
7814
7838
  _active: boolean;
7815
- /**
7816
- * @hidden
7817
- */
7839
+ /** @internal */
7818
7840
  constructor(map: Map);
7819
7841
  reset(): void;
7820
7842
  dblclick(e: MouseEvent, point: Point): {
@@ -7878,9 +7900,7 @@ export declare class TapZoomHandler implements Handler {
7878
7900
  export declare class DoubleClickZoomHandler {
7879
7901
  _clickZoom: ClickZoomHandler;
7880
7902
  _tapZoom: TapZoomHandler;
7881
- /**
7882
- * @hidden
7883
- */
7903
+ /** @internal */
7884
7904
  constructor(clickZoom: ClickZoomHandler, TapZoom: TapZoomHandler);
7885
7905
  /**
7886
7906
  * Enables the "double click to zoom" interaction.
@@ -7941,9 +7961,7 @@ export declare class TwoFingersTouchZoomRotateHandler {
7941
7961
  _tapDragZoom: TapDragZoomHandler;
7942
7962
  _rotationDisabled: boolean;
7943
7963
  _enabled: boolean;
7944
- /**
7945
- * @hidden
7946
- */
7964
+ /** @internal */
7947
7965
  constructor(el: HTMLElement, touchZoom: TwoFingersTouchZoomHandler, touchRotate: TwoFingersTouchRotateHandler, tapDragZoom: TapDragZoomHandler);
7948
7966
  /**
7949
7967
  * Enables the "pinch to rotate and zoom" interaction.
@@ -8420,7 +8438,7 @@ export declare class Map extends Camera {
8420
8438
  ];
8421
8439
  _terrainDataCallback: (e: MapStyleDataEvent | MapSourceDataEvent) => void;
8422
8440
  /**
8423
- * @hidden
8441
+ * @internal
8424
8442
  * image queue throttling handle. To be used later when clean up
8425
8443
  */
8426
8444
  _imageQueueHandle: number;
@@ -8467,9 +8485,9 @@ export declare class Map extends Camera {
8467
8485
  touchPitch: TwoFingersTouchPitchHandler;
8468
8486
  constructor(options: MapOptions);
8469
8487
  /**
8488
+ * @internal
8470
8489
  * Returns a unique number for this map instance which is used for the MapLoadEvent
8471
8490
  * to make sure we only fire one event per instantiated map object.
8472
- * @hidden
8473
8491
  * @returns the uniq map ID
8474
8492
  */
8475
8493
  _getMapId(): number;
@@ -8548,9 +8566,9 @@ export declare class Map extends Camera {
8548
8566
  */
8549
8567
  resize(eventData?: any): Map;
8550
8568
  /**
8569
+ * @internal
8551
8570
  * Return the map's pixel ratio eventually scaled down to respect maxCanvasSize.
8552
8571
  * Internally you should use this and not getPixelRatio().
8553
- * @hidden
8554
8572
  */
8555
8573
  _getClampedPixelRatio(width: number, height: number): number;
8556
8574
  /**
@@ -9958,23 +9976,25 @@ export declare class Map extends Camera {
9958
9976
  */
9959
9977
  loaded(): boolean;
9960
9978
  /**
9979
+ * @internal
9961
9980
  * Update this map's style and sources, and re-render the map.
9962
9981
  *
9963
- * @hidden
9964
9982
  * @param updateStyle - mark the map's style for reprocessing as
9965
9983
  * well as its sources
9966
9984
  * @returns `this`
9967
9985
  */
9968
9986
  _update(updateStyle?: boolean): this;
9969
9987
  /**
9988
+ * @internal
9970
9989
  * Request that the given callback be executed during the next render
9971
9990
  * frame. Schedule a render frame if one is not already scheduled.
9972
- * @hidden
9991
+ *
9973
9992
  * @returns An id that can be used to cancel the callback
9974
9993
  */
9975
9994
  _requestRenderFrame(callback: () => void): TaskID;
9976
9995
  _cancelRenderFrame(id: TaskID): void;
9977
9996
  /**
9997
+ * @internal
9978
9998
  * Call when a (re-)render of the map is required:
9979
9999
  * - The style has changed (`setPaintProperty()`, etc.)
9980
10000
  * - Source data has changed (e.g. tiles have finished loading)
@@ -9982,7 +10002,6 @@ export declare class Map extends Camera {
9982
10002
  * - A transition is in progress
9983
10003
  *
9984
10004
  * @param paintStartTimeStamp - The time when the animation frame began executing.
9985
- * @hidden
9986
10005
  *
9987
10006
  * @returns `this`
9988
10007
  */
@@ -11081,9 +11100,7 @@ export declare class GeoJSONSource extends Evented implements Source {
11081
11100
  _pendingLoads: number;
11082
11101
  _collectResourceTiming: boolean;
11083
11102
  _removed: boolean;
11084
- /**
11085
- * @hidden
11086
- */
11103
+ /** @internal */
11087
11104
  constructor(id: string, options: GeoJSONSourceOptions, dispatcher: Dispatcher, eventedParent: Evented);
11088
11105
  load: () => void;
11089
11106
  onAdd(map: Map): void;