maplibre-gl 6.3.0 → 6.4.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 (56) hide show
  1. package/dist/maplibre-gl-dev.mjs +590 -208
  2. package/dist/maplibre-gl-dev.mjs.map +1 -1
  3. package/dist/maplibre-gl-shared-dev.mjs +258 -235
  4. package/dist/maplibre-gl-shared-dev.mjs.map +1 -1
  5. package/dist/maplibre-gl-shared.mjs +2 -2
  6. package/dist/maplibre-gl-shared.mjs.map +1 -1
  7. package/dist/maplibre-gl-worker-dev.mjs +2 -2
  8. package/dist/maplibre-gl-worker.mjs +2 -2
  9. package/dist/maplibre-gl-worker.mjs.map +1 -1
  10. package/dist/maplibre-gl.d.ts +258 -97
  11. package/dist/maplibre-gl.mjs +18 -18
  12. package/dist/maplibre-gl.mjs.map +1 -1
  13. package/package.json +7 -7
  14. package/src/data/bucket/fill_extrusion_bucket.ts +1 -13
  15. package/src/data/bucket/round_polygon_corners.test.ts +84 -36
  16. package/src/data/bucket/round_polygon_corners.ts +90 -39
  17. package/src/data/extent_bounds.ts +28 -1
  18. package/src/geo/projection/globe_transform.test.ts +129 -1
  19. package/src/geo/projection/globe_utils.ts +189 -2
  20. package/src/geo/projection/vertical_perspective_camera_helper.test.ts +24 -0
  21. package/src/geo/projection/vertical_perspective_camera_helper.ts +11 -10
  22. package/src/render/image_atlas.test.ts +110 -2
  23. package/src/render/image_atlas.ts +35 -4
  24. package/src/render/image_manager.test.ts +66 -1
  25. package/src/render/image_manager.ts +136 -144
  26. package/src/render/painter.ts +5 -2
  27. package/src/render/pattern_atlas.test.ts +131 -0
  28. package/src/render/pattern_atlas.ts +144 -0
  29. package/src/shaders/glsl/_prelude.vertex.glsl +8 -8
  30. package/src/shaders/glsl/_prelude.vertex.glsl.g.ts +1 -1
  31. package/src/shaders/glsl/color_relief.fragment.glsl +1 -2
  32. package/src/shaders/glsl/color_relief.fragment.glsl.g.ts +1 -1
  33. package/src/shaders/glsl/hillshade_prepare.fragment.glsl +12 -12
  34. package/src/shaders/glsl/hillshade_prepare.fragment.glsl.g.ts +1 -1
  35. package/src/source/image_source.test.ts +41 -31
  36. package/src/source/image_source.ts +14 -15
  37. package/src/source/raster_dem_tile_source.test.ts +37 -3
  38. package/src/source/raster_dem_tile_source.ts +1 -2
  39. package/src/source/raster_tile_source.test.ts +5 -26
  40. package/src/source/raster_tile_source.ts +4 -3
  41. package/src/style/style.test.ts +64 -0
  42. package/src/style/style.ts +37 -64
  43. package/src/symbol/cross_tile_symbol_index.test.ts +31 -0
  44. package/src/symbol/cross_tile_symbol_index.ts +67 -37
  45. package/src/tile/tile_manager.test.ts +69 -1
  46. package/src/tile/tile_manager.ts +14 -9
  47. package/src/ui/handler/two_fingers_touch.test.ts +14 -3
  48. package/src/ui/handler_inertia.test.ts +91 -0
  49. package/src/ui/handler_inertia.ts +65 -14
  50. package/src/ui/map_tests/map_images.test.ts +26 -0
  51. package/src/ui/map_tests/map_webgl.test.ts +2 -1
  52. package/src/ui/marker.test.ts +151 -0
  53. package/src/ui/marker.ts +120 -10
  54. package/src/util/image_request.ts +31 -1
  55. package/src/webgl/draw/draw_background.ts +1 -1
  56. package/src/webgl/program/pattern.ts +3 -3
@@ -3,7 +3,6 @@ import { GeoJSONVTOptions } from "@maplibre/geojson-vt";
3
3
  import { AllLayoutProperties, AllPaintProperties, Color, ColorArray, CompositeExpression, DiffCommand, DiffOperations, Feature, FeatureFilter, FeatureState, FilterSpecification, Formatted, FormattedSection, GeoJSONSourceSpecification, GlobalProperties, ICanonicalTileID, IMercatorCoordinate, ImageSourceSpecification, InterpolationType, LayerSpecification, LightSpecification, NumberArray, Padding, ProjectionSpecification, PromoteIdSpecification, PropertyValueSpecification, RasterDEMSourceSpecification, RasterSourceSpecification, ResolvedImage, SkySpecification, SourceExpression, SourceSpecification, SpriteSpecification, StateSpecification, StylePropertyExpression, StylePropertySpecification, StyleSpecification, TerrainSpecification, TransitionSpecification, ValidationError, VariableAnchorOffsetCollection, VectorSourceSpecification, VideoSourceSpecification, VisibilityExpression, VisibilitySpecification } from "@maplibre/maplibre-gl-style-spec";
4
4
  import { VectorTileFeatureLike, VectorTileLayerLike } from "@maplibre/vt-pbf";
5
5
  import { mat2, mat4, vec3, vec4 } from "gl-matrix";
6
- import { PotpackBox } from "potpack";
7
6
  import KDBush from "kdbush";
8
7
  import TinySDF from "@mapbox/tiny-sdf";
9
8
  export type * from "@maplibre/maplibre-gl-style-spec";
@@ -2313,6 +2312,117 @@ interface StyleImageInterface {
2313
2312
  onRemove?: () => void;
2314
2313
  }
2315
2314
  //#endregion
2315
+ //#region src/render/image_manager.d.ts
2316
+ type MissingImageRequestHandler = (id: string) => void | Promise<void>;
2317
+ type ImageManagerEventType = {
2318
+ error: ErrorEvent;
2319
+ styleimagemissing: MapStyleImageMissingEvent;
2320
+ };
2321
+ /**
2322
+ * Owns every image of the style - the ones the sprites bring in as well as the ones added at
2323
+ * runtime - and tracks requests for them from the tile workers, sending responses when the
2324
+ * requests are fulfilled.
2325
+ */
2326
+ declare class ImageManager extends Evented<ImageManagerEventType> {
2327
+ images: Record<string, StyleImage>;
2328
+ /**
2329
+ * Incremented on every {@link ImageManager.updateImage} call. {@link ImageAtlas} instances
2330
+ * compare it against the value they last patched against, so that a tile whose atlas is up to
2331
+ * date can skip its patching work entirely.
2332
+ */
2333
+ updateVersion: number;
2334
+ loaded: boolean;
2335
+ /**
2336
+ * This is used to track requests for images that are not yet available. When the image is loaded,
2337
+ * the requestors will be notified.
2338
+ */
2339
+ requestors: Array<{
2340
+ ids: string[];
2341
+ promiseResolve: (value: GetImagesResponse | PromiseLike<GetImagesResponse>) => void;
2342
+ }>;
2343
+ missingImageResolver: MissingImageRequestHandler | null;
2344
+ /**
2345
+ * The images whose `render` callback already ran in the current frame. A given image usually
2346
+ * sits in the atlas of several tiles, so it would otherwise be asked to re-render once per
2347
+ * tile that holds it.
2348
+ */
2349
+ private _renderCallbacksDispatchedThisFrame;
2350
+ /**
2351
+ * The ids of the images each sprite has brought in, keyed by sprite id, so that they can be
2352
+ * removed again when that sprite is reloaded or removed.
2353
+ */
2354
+ private _spriteImagesIds;
2355
+ /** Cached result of {@link ImageManager.listImages}, invalidated whenever an image is added or removed */
2356
+ private _imagesIds;
2357
+ constructor();
2358
+ destroy(): void;
2359
+ isLoaded(): boolean;
2360
+ setLoaded(loaded: boolean): void;
2361
+ getImage(id: string): StyleImage;
2362
+ addImage(id: string, image: StyleImage): void;
2363
+ _validate(id: string, image: StyleImage): boolean;
2364
+ _validateStretch(stretch: Array<[number, number]>, size: number): boolean;
2365
+ _validateContent(content: [number, number, number, number], image: StyleImage): boolean;
2366
+ /**
2367
+ * Replaces an image that is already known under this id, bumping its version so that the
2368
+ * atlases holding it notice.
2369
+ *
2370
+ * The old record is read directly rather than through {@link ImageManager.getImage}, which
2371
+ * would force a synchronous decode of the sprite data of the very image being replaced. Its
2372
+ * size therefore comes from whichever of the two the pixels are still in, since an image that
2373
+ * came from a sprite and was never rendered has not been decoded yet, and its version is
2374
+ * defaulted, since images start out without one.
2375
+ *
2376
+ * @param validate - whether to reject an image of a different size than the one it replaces
2377
+ */
2378
+ updateImage(id: string, image: StyleImage, validate?: boolean): void;
2379
+ removeImage(id: string): void;
2380
+ /**
2381
+ * @returns the ids of every image currently held, sprite images and runtime ones alike. The
2382
+ * returned array is shared between callers and must not be modified.
2383
+ */
2384
+ listImages(): string[];
2385
+ /**
2386
+ * Images of the `default` sprite keep their plain id, the ones of any other sprite are
2387
+ * namespaced by their sprite's id.
2388
+ */
2389
+ private _getSpriteImageId;
2390
+ /**
2391
+ * Takes over the images of a single sprite: adds the new ones, updates the ones that are
2392
+ * already known, and removes the ones that a previous load of this same sprite had brought in
2393
+ * but that are not part of it anymore.
2394
+ *
2395
+ * @param spriteId - the id of the sprite the images belong to
2396
+ * @param images - the sprite's images, keyed by their id within the sprite
2397
+ * @returns the ids of the images that this sprite now provides, and the ids of the ones that
2398
+ * were removed because they are no longer part of it
2399
+ */
2400
+ setSpriteImages(spriteId: string, images: Record<string, StyleImage>): {
2401
+ loaded: string[];
2402
+ removed: string[];
2403
+ };
2404
+ /**
2405
+ * Removes all the images a single sprite has brought in.
2406
+ * @returns the ids of the removed images
2407
+ */
2408
+ removeSpriteImages(spriteId: string): string[];
2409
+ /**
2410
+ * Removes the images of every sprite, leaving the images added at runtime alone.
2411
+ * @returns the ids of the removed images
2412
+ */
2413
+ removeAllSpriteImages(): string[];
2414
+ setMissingImageResolver(resolver: MissingImageRequestHandler | null): void;
2415
+ getImages(ids: string[]): Promise<GetImagesResponse>;
2416
+ _getImagesForIds(ids: string[]): Promise<GetImagesResponse>;
2417
+ beginFrame(): void;
2418
+ /**
2419
+ * Re-renders the images among `ids` that were added with a `render` callback (see
2420
+ * `StyleImageInterface`), at most once per frame each.
2421
+ */
2422
+ dispatchRenderCallbacks(ids: string[]): void;
2423
+ cloneImages(): Record<string, StyleImage>;
2424
+ }
2425
+ //#endregion
2316
2426
  //#region src/webgl/texture.d.ts
2317
2427
  type TextureFormat = WebGLRenderingContextBase["RGBA"] | WebGLRenderingContextBase["ALPHA"];
2318
2428
  type TextureFilter = WebGLRenderingContextBase["LINEAR"] | WebGLRenderingContextBase["LINEAR_MIPMAP_NEAREST"] | WebGLRenderingContextBase["NEAREST"];
@@ -2357,80 +2467,6 @@ declare class Texture {
2357
2467
  destroy(): void;
2358
2468
  }
2359
2469
  //#endregion
2360
- //#region src/render/image_manager.d.ts
2361
- type MissingImageRequestHandler = (id: string) => void | Promise<void>;
2362
- type Pattern = {
2363
- bin: PotpackBox;
2364
- position: ImagePosition;
2365
- };
2366
- type ImageManagerEventType = {
2367
- error: ErrorEvent;
2368
- styleimagemissing: MapStyleImageMissingEvent;
2369
- };
2370
- /**
2371
- * ImageManager does three things:
2372
- *
2373
- * 1. Tracks requests for icon images from tile workers and sends responses when the requests are fulfilled.
2374
- * 2. Builds a texture atlas for pattern images.
2375
- * 3. Rerenders renderable images once per frame
2376
- *
2377
- * These are disparate responsibilities and should eventually be handled by different classes. When we implement
2378
- * data-driven support for `*-pattern`, we'll likely use per-bucket pattern atlases, and that would be a good time
2379
- * to refactor this.
2380
- */
2381
- declare class ImageManager extends Evented<ImageManagerEventType> {
2382
- images: {
2383
- [_: string]: StyleImage;
2384
- };
2385
- updatedImages: {
2386
- [_: string]: boolean;
2387
- };
2388
- callbackDispatchedThisFrame: {
2389
- [_: string]: boolean;
2390
- };
2391
- loaded: boolean;
2392
- /**
2393
- * This is used to track requests for images that are not yet available. When the image is loaded,
2394
- * the requestors will be notified.
2395
- */
2396
- requestors: Array<{
2397
- ids: string[];
2398
- promiseResolve: (value: GetImagesResponse | PromiseLike<GetImagesResponse>) => void;
2399
- }>;
2400
- missingImageResolver: MissingImageRequestHandler | null;
2401
- patterns: {
2402
- [_: string]: Pattern;
2403
- };
2404
- atlasImage: RGBAImage;
2405
- atlasTexture: Texture;
2406
- dirty: boolean;
2407
- constructor();
2408
- destroy(): void;
2409
- isLoaded(): boolean;
2410
- setLoaded(loaded: boolean): void;
2411
- getImage(id: string): StyleImage;
2412
- addImage(id: string, image: StyleImage): void;
2413
- _validate(id: string, image: StyleImage): boolean;
2414
- _validateStretch(stretch: Array<[number, number]>, size: number): boolean;
2415
- _validateContent(content: [number, number, number, number], image: StyleImage): boolean;
2416
- updateImage(id: string, image: StyleImage, validate?: boolean): void;
2417
- removeImage(id: string): void;
2418
- listImages(): string[];
2419
- setMissingImageResolver(resolver: MissingImageRequestHandler | null): void;
2420
- getImages(ids: string[]): Promise<GetImagesResponse>;
2421
- _getImagesForIds(ids: string[]): Promise<GetImagesResponse>;
2422
- getPixelSize(): {
2423
- width: number;
2424
- height: number;
2425
- };
2426
- getPattern(id: string): ImagePosition;
2427
- bind(context: Context): void;
2428
- _updatePatternAtlas(): void;
2429
- beginFrame(): void;
2430
- dispatchRenderCallbacks(ids: string[]): void;
2431
- cloneImages(): Record<string, StyleImage>;
2432
- }
2433
- //#endregion
2434
2470
  //#region src/style/style_glyph.d.ts
2435
2471
  /**
2436
2472
  * Some metices related to a glyph
@@ -2499,24 +2535,44 @@ declare class ImagePosition {
2499
2535
  get displaySize(): [number, number];
2500
2536
  }
2501
2537
  /**
2502
- * A class holding all the images
2538
+ * A single tile's packed copy of the icons and patterns its features reference, built in the
2539
+ * worker so that the symbol layout can bake the positions within it straight into the vertex
2540
+ * buffers. Each tile owns one, along with the texture it is uploaded to - as opposed to
2541
+ * {@link ImageManager}, which owns the images of the whole style.
2542
+ * @internal
2503
2543
  */
2504
2544
  declare class ImageAtlas {
2505
2545
  image: RGBAImage;
2506
- iconPositions: {
2507
- [_: string]: ImagePosition;
2508
- };
2509
- patternPositions: {
2510
- [_: string]: ImagePosition;
2511
- };
2546
+ iconPositions: Record<string, ImagePosition>;
2547
+ patternPositions: Record<string, ImagePosition>;
2512
2548
  haveRenderCallbacks: string[];
2513
2549
  uploaded: boolean;
2550
+ /**
2551
+ * The {@link ImageManager.updateVersion} this atlas' texture was last patched against.
2552
+ * Starts out at `-1` so that a freshly transferred atlas always patches once: images may have
2553
+ * been updated between the moment the worker snapshotted them and the moment the atlas arrives.
2554
+ */
2555
+ patchedUpdateVersion: number;
2514
2556
  constructor(icons: GetImagesResponse, patterns: GetImagesResponse);
2515
2557
  addImages(images: {
2516
2558
  [_: string]: StyleImage;
2517
2559
  }, positions: {
2518
2560
  [_: string]: ImagePosition;
2519
2561
  }, bins: Rect[]): void;
2562
+ /**
2563
+ * Brings this atlas' texture back in sync with the images it was built from, re-uploading the
2564
+ * ones that were replaced in the meantime.
2565
+ *
2566
+ * This runs for every in-view tile on every frame, so the common case of nothing having
2567
+ * changed has to cost nothing: a single comparison against {@link ImageManager.updateVersion}
2568
+ * ends the call. When something did change, only the images this atlas actually holds are
2569
+ * looked at - a handful per tile - and {@link ImageAtlas.patchUpdatedImage} then skips the
2570
+ * ones whose version still matches, leaving just the genuinely stale ones to upload.
2571
+ *
2572
+ * The render callbacks are dispatched first because they may update images themselves, and
2573
+ * those updates have to be part of the version this call catches up with - otherwise an
2574
+ * animated image would always be uploaded a frame late.
2575
+ */
2520
2576
  patchUpdatedImages(imageManager: ImageManager, texture: Texture): void;
2521
2577
  patchUpdatedImage(position: ImagePosition, image: StyleImage, texture: Texture): void;
2522
2578
  }
@@ -5241,7 +5297,7 @@ declare class ImageSource extends Evented<SourceEventType> implements Source {
5241
5297
  perspectiveTransform: RasterPerspectiveTransform;
5242
5298
  flippedWindingOrder: boolean;
5243
5299
  _loaded: boolean;
5244
- _request: AbortController;
5300
+ _abortController: AbortController;
5245
5301
  private _imageDirty;
5246
5302
  /** @internal */
5247
5303
  constructor(id: string, options: ImageSourceSpecification | VideoSourceSpecification | CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented);
@@ -6157,7 +6213,7 @@ declare class TileManager extends Evented<SourceEventType> {
6157
6213
  getState(): SourceFeatureState;
6158
6214
  pause(): void;
6159
6215
  resume(): void;
6160
- _loadTile(tile: Tile, id: string, state: TileState): Promise<void>;
6216
+ _loadTile(tile: Tile, id: string, state: TileState, hadData: boolean): Promise<void>;
6161
6217
  _unloadTile(tile: Tile): void;
6162
6218
  _abortTile(tile: Tile): void;
6163
6219
  serialize(): any;
@@ -6175,7 +6231,7 @@ declare class TileManager extends Evented<SourceEventType> {
6175
6231
  */
6176
6232
  reload(sourceDataChanged?: boolean, shouldReloadTileOptions?: any): void;
6177
6233
  _reloadTile(id: string, state: TileState): Promise<void>;
6178
- _tileLoaded(tile: Tile, id: string, previousState: TileState, result: LoadTileResult): void;
6234
+ _tileLoaded(tile: Tile, id: string, previousState: TileState, hadData: boolean, result: LoadTileResult): void;
6179
6235
  /**
6180
6236
  * Get a specific tile by TileID
6181
6237
  */
@@ -6343,6 +6399,34 @@ declare class TileLayerIndex {
6343
6399
  findMatches(symbolInstances: SymbolInstanceArray, newTileID: OverscaledTileID, zoomCrossTileIDs: {
6344
6400
  [crossTileID: number]: boolean;
6345
6401
  }): void;
6402
+ /**
6403
+ * Matches a symbol instance against an entry backed by a KDBush spatial index
6404
+ * (used for keys with more than {@link KDBUSH_THRESHHOLD} symbols).
6405
+ *
6406
+ * Matches any symbol with the same key whose coordinates are within one grid
6407
+ * unit (with a 4px grid, this covers a 12px by 12px area). The lowest-index
6408
+ * unclaimed candidate is claimed in a single pass rather than sorting the
6409
+ * whole result set on every query: `range()` can return many candidates where
6410
+ * symbols are coincident (e.g. stacked point markers), so a per-query sort
6411
+ * would dominate placement cost on dense layers.
6412
+ *
6413
+ * Once a symbol is marked duplicate against a parent symbol, no other symbol
6414
+ * at the same zoom level may duplicate against the same parent (see issue #5993).
6415
+ */
6416
+ private findMatchesForIndexedEntry;
6417
+ /**
6418
+ * Matches a symbol instance against an entry that stores its positions as a
6419
+ * plain array (used for keys with at most {@link KDBUSH_THRESHHOLD} symbols).
6420
+ *
6421
+ * Matches any symbol with the same key whose coordinates are within one grid
6422
+ * unit (with a 4px grid, this covers a 12px by 12px area). Positions are
6423
+ * stored in symbol-instance order, so the first unclaimed match is also the
6424
+ * lowest-index one.
6425
+ *
6426
+ * Once a symbol is marked duplicate against a parent symbol, no other symbol
6427
+ * at the same zoom level may duplicate against the same parent (see issue #5993).
6428
+ */
6429
+ private findMatchesForNonIndexedEntry;
6346
6430
  getCrossTileIDsLists(): number[][];
6347
6431
  }
6348
6432
  declare class CrossTileIDs {
@@ -7066,6 +7150,32 @@ type DrawFunctions = {
7066
7150
  terrainCoords: typeof drawCoords;
7067
7151
  };
7068
7152
  //#endregion
7153
+ //#region src/render/pattern_atlas.d.ts
7154
+ /**
7155
+ * A texture atlas of the pattern images that are drawn without a tile's own {@link ImageAtlas},
7156
+ * i.e. `background-pattern`. Entries are packed on demand and re-packed whenever one of them is
7157
+ * added or changes, which is rare enough for the repacking cost not to matter.
7158
+ */
7159
+ declare class PatternAtlas {
7160
+ private _imageManager;
7161
+ private _entries;
7162
+ private _image;
7163
+ private _texture;
7164
+ private _dirty;
7165
+ constructor(imageManager: ImageManager);
7166
+ destroy(): void;
7167
+ getPixelSize(): {
7168
+ width: number;
7169
+ height: number;
7170
+ };
7171
+ /**
7172
+ * @returns the position of the pattern within the atlas, or `null` if there is no such image
7173
+ */
7174
+ getPattern(id: string): ImagePosition;
7175
+ bind(context: Context): void;
7176
+ private _update;
7177
+ }
7178
+ //#endregion
7069
7179
  //#region src/util/request_manager.d.ts
7070
7180
  /**
7071
7181
  * A type of MapLibre resource.
@@ -7257,6 +7367,7 @@ declare class Painter {
7257
7367
  options: PainterOptions;
7258
7368
  lineAtlas: LineAtlas;
7259
7369
  imageManager: ImageManager;
7370
+ patternAtlas: PatternAtlas;
7260
7371
  glyphManager: GlyphManager;
7261
7372
  depthRangeFor3D: DepthRangeType;
7262
7373
  opaquePassCutoff: number;
@@ -9224,6 +9335,7 @@ declare class Style extends Evented<MapEventType> {
9224
9335
  stylesheet: StyleSpecification;
9225
9336
  dispatcher: Dispatcher;
9226
9337
  imageManager: ImageManager;
9338
+ patternAtlas: PatternAtlas;
9227
9339
  glyphManager: GlyphManager;
9228
9340
  lineAtlas: LineAtlas;
9229
9341
  light: Light;
@@ -9263,10 +9375,6 @@ declare class Style extends Evented<MapEventType> {
9263
9375
  [layer: string]: true;
9264
9376
  };
9265
9377
  _layerOrderChanged: boolean;
9266
- _spritesImagesIds: {
9267
- [spriteId: string]: string[];
9268
- };
9269
- _availableImages: string[];
9270
9378
  _globalState: Record<string, any>;
9271
9379
  crossTileSymbolIndex: CrossTileSymbolIndex;
9272
9380
  pauseablePlacement: PauseablePlacement;
@@ -9290,7 +9398,7 @@ declare class Style extends Evented<MapEventType> {
9290
9398
  loadEmpty(): void;
9291
9399
  _load(json: StyleSpecification, options: StyleSwapOptions & StyleSetterOptions, previousStyle?: StyleSpecification): void;
9292
9400
  private _createLayers;
9293
- _loadSprite(sprite: SpriteSpecification, isUpdate?: boolean, completion?: (err: Error) => void): void;
9401
+ _loadSprite(sprite: SpriteSpecification, isUpdate?: boolean, completion?: (err: Error) => void): Promise<void>;
9294
9402
  _unloadSprite(): void;
9295
9403
  _validateLayer(layer: StyleLayer): void;
9296
9404
  loaded(): boolean;
@@ -9338,6 +9446,11 @@ declare class Style extends Evented<MapEventType> {
9338
9446
  getImage(id: string): StyleImage;
9339
9447
  setMissingImageResolver(resolver: MissingImageRequestHandler | null): void;
9340
9448
  removeImage(id: string): void;
9449
+ /**
9450
+ * Queues the tiles that depend on these images to be reloaded on the next update, which is
9451
+ * needed whenever an image appears, disappears or changes size.
9452
+ */
9453
+ _markImagesChanged(ids: string[]): void;
9341
9454
  _afterImageUpdated(id: string): void;
9342
9455
  listImages(): string[];
9343
9456
  addSource(id: string, source: SourceSpecification | CanvasSourceSpecification, options?: StyleSetterOptions): void;
@@ -10814,16 +10927,36 @@ declare class Camera extends Evented<MapEventType> {
10814
10927
  }
10815
10928
  //#endregion
10816
10929
  //#region src/ui/handler_inertia.d.ts
10930
+ type InertiaBufferEntry = {
10931
+ time: number;
10932
+ settings: HandlerResult;
10933
+ };
10817
10934
  declare class HandlerInertia {
10818
10935
  _map: Map$1;
10819
- _inertiaBuffer: Array<{
10820
- time: number;
10821
- settings: any;
10822
- }>;
10936
+ _inertiaBuffer: InertiaBufferEntry[];
10823
10937
  constructor(map: Map$1);
10824
10938
  clear(): void;
10825
- record(settings: any): void;
10939
+ record(settings: HandlerResult): void;
10826
10940
  _drainInertiaBuffer(): void;
10941
+ /**
10942
+ * Returns the entries the velocity is measured from: everything recorded within
10943
+ * {@link VELOCITY_WINDOW} before now, but never fewer than the last two, so that
10944
+ * inertia also works below two recorded updates per window.
10945
+ */
10946
+ _getVelocityEntries(): InertiaBufferEntry[];
10947
+ /**
10948
+ * Returns the ease which continues the gesture that has just ended.
10949
+ *
10950
+ * The velocity is measured over the time up to the release and not up to the last
10951
+ * recorded movement, so that a gesture held still before being released has a lower
10952
+ * velocity, down to no inertia at all. The delta of an entry happened before it was
10953
+ * recorded, so the first entry only marks the start of the measured interval; anchors
10954
+ * are the exception, as they describe the state at the moment of their entry.
10955
+ *
10956
+ * @param panInertiaOptions - overrides for the pan inertia defaults
10957
+ * @returns the ease options, or `undefined` when the measured interval holds no
10958
+ * movement, which terrain gestures produce by recording updates without any delta
10959
+ */
10827
10960
  _onMoveEnd(panInertiaOptions?: DragPanOptions | boolean): EaseToOptions;
10828
10961
  }
10829
10962
  //#endregion
@@ -15317,6 +15450,10 @@ type MarkerOptions = {
15317
15450
  scale?: number;
15318
15451
  /**
15319
15452
  * A boolean indicating whether or not a marker is able to be dragged to a new position on the map.
15453
+ * A draggable default marker also becomes keyboard focusable and, while focused, moves by
15454
+ * 1 screen pixel per arrow-key press (10 with Shift), firing the same `dragstart`/`drag`/`dragend`
15455
+ * events as pointer dragging. Markers with a custom `element` keep their focusability and
15456
+ * keyboard behavior application-owned.
15320
15457
  * @defaultValue false
15321
15458
  */
15322
15459
  draggable?: boolean;
@@ -15483,12 +15620,13 @@ declare class Marker extends Evented<MarkerEventType> {
15483
15620
  _rotation: number;
15484
15621
  _pitchAlignment: Alignment;
15485
15622
  _rotationAlignment: Alignment;
15486
- _originalTabIndex: string;
15487
15623
  _opacity: string;
15488
15624
  _opacityWhenCovered: string;
15489
15625
  _opacityTimeout: ReturnType<typeof setTimeout>;
15490
15626
  _subpixelPositioning: boolean;
15491
15627
  _roleManaged: boolean;
15628
+ _tabIndexManaged: boolean;
15629
+ _keyboardDragActive: boolean;
15492
15630
  /**
15493
15631
  * @param options - the options
15494
15632
  */
@@ -15578,6 +15716,18 @@ declare class Marker extends Evented<MarkerEventType> {
15578
15716
  setSubpixelPositioning(value: boolean): this;
15579
15717
  _onClick: (e: MouseEvent) => void;
15580
15718
  _onKeyPress: (e: KeyboardEvent) => void;
15719
+ /**
15720
+ * Move a focused draggable default marker with the arrow keys
15721
+ * (1 screen pixel per keydown; 10 with Shift).
15722
+ * Mirrors the pointer drag gesture: the position updates before `dragstart`
15723
+ * fires on the first movement, every movement fires `drag`, and releasing
15724
+ * the arrow key (or losing focus) fires `dragend`. Holding a key down
15725
+ * produces repeated `drag` events within a single gesture.
15726
+ */
15727
+ _onKeyDown: (e: KeyboardEvent) => void;
15728
+ _onKeyUp: (e: KeyboardEvent) => void;
15729
+ _onBlur: () => void;
15730
+ _endKeyboardDrag(): void;
15581
15731
  _onMapClick: (e: MapMouseEvent) => void;
15582
15732
  /**
15583
15733
  * Returns the {@link Popup} instance that is bound to the {@link Marker}.
@@ -15662,7 +15812,10 @@ declare class Marker extends Evented<MarkerEventType> {
15662
15812
  _onUp: () => void;
15663
15813
  _addDragHandler: (e: MapMouseEvent | MapTouchEvent) => void;
15664
15814
  /**
15665
- * Sets the `draggable` property and functionality of the marker
15815
+ * Sets the `draggable` property and functionality of the marker.
15816
+ * A draggable default marker is also keyboard focusable and movable with the
15817
+ * arrow keys (see {@link MarkerOptions.draggable}); custom marker elements keep
15818
+ * their focusability and keyboard behavior application-owned.
15666
15819
  * @param shouldBeDraggable - Turns drag functionality on/off
15667
15820
  */
15668
15821
  setDraggable(shouldBeDraggable?: boolean): this;
@@ -15671,6 +15824,14 @@ declare class Marker extends Evented<MarkerEventType> {
15671
15824
  * @returns True if the marker is draggable.
15672
15825
  */
15673
15826
  isDraggable(): boolean;
15827
+ /**
15828
+ * Keep the marker element focusable while it has built-in keyboard behavior.
15829
+ * A popup makes any marker element interactive; dragging only manages
15830
+ * focusability for the default marker so custom elements stay
15831
+ * application-owned (#7790). A tabindex supplied by the application is
15832
+ * never added, changed, or removed here.
15833
+ */
15834
+ _updateTabIndex(): void;
15674
15835
  /**
15675
15836
  * Keep the default marker role aligned with interactivity.
15676
15837
  * Default markers need a role because `aria-label` is set in {@link Marker.addTo}.