map-gl-offline 0.8.3 → 0.8.5

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.
package/README.md CHANGED
@@ -52,13 +52,11 @@ const map = new maplibregl.Map({
52
52
  const offlineManager = new OfflineMapManager();
53
53
 
54
54
  map.on('load', () => {
55
- map.addControl(
56
- new OfflineManagerControl(offlineManager, {
57
- styleUrl: map.getStyle().sprite,
58
- mapLib: maplibregl, // enables idb:// protocol
59
- }),
60
- 'top-right',
61
- );
55
+ const control = new OfflineManagerControl(offlineManager, {
56
+ styleUrl: 'https://api.maptiler.com/maps/streets/style.json?key=YOUR_KEY',
57
+ mapLib: maplibregl, // enables idb:// protocol in web workers
58
+ });
59
+ map.addControl(control, 'top-right');
62
60
  });
63
61
  ```
64
62
 
@@ -103,7 +101,7 @@ map.on('load', () =>
103
101
 
104
102
  ## Programmatic Usage
105
103
 
106
- `downloadRegion` runs the full pipeline (**style → sprites → glyphs → tiles → metadata**) with per-phase progress. `addRegion` alone only stores metadata — use `downloadRegion` to actually fetch assets.
104
+ `downloadRegion` runs the full pipeline (**style → sprites → glyphs → models → tiles → metadata**) with per-phase progress. `addRegion` alone only stores metadata — use `downloadRegion` to actually fetch assets.
107
105
 
108
106
  ```typescript
109
107
  import { OfflineMapManager } from 'map-gl-offline';
package/dist/index.d.ts CHANGED
@@ -34,7 +34,7 @@
34
34
  * ```typescript
35
35
  * const offlineManager = new OfflineMapManager();
36
36
  *
37
- * // downloadRegion runs the full pipeline: style (if missing) → sprites → glyphs → tiles → metadata.
37
+ * // downloadRegion runs the full pipeline: style (if missing) → sprites → glyphs → models → tiles → metadata.
38
38
  * // addRegion on its own only stores metadata; use downloadRegion to actually fetch assets.
39
39
  * await offlineManager.downloadRegion(
40
40
  * {
@@ -71,6 +71,6 @@ export * from './types';
71
71
  export * from './utils';
72
72
  export { OfflineMapManager as default } from './managers/offlineMapManager';
73
73
  export { OfflineManagerControl } from './ui/offlineManagerControl';
74
- export type { MapLibProtocol } from './ui/offlineManagerControl';
74
+ export type { MapLibProtocol, ControlMap } from './ui/offlineManagerControl';
75
75
  export { i18n, t } from './ui/translations';
76
76
  export type { SupportedLanguage, TranslationKey } from './ui/translations';
package/dist/index.esm.js CHANGED
@@ -12936,14 +12936,15 @@ class RegionControl {
12936
12936
  * Download Manager for offline map regions.
12937
12937
  *
12938
12938
  * This module handles the complete download workflow for offline map regions,
12939
- * including styles, sprites, glyphs (fonts), and map tiles. It provides
12939
+ * including styles, sprites, glyphs (fonts), 3D models, and map tiles. It provides
12940
12940
  * progress tracking across all download phases.
12941
12941
  *
12942
12942
  * **Download Phases:**
12943
12943
  * 1. `style` - Downloads the map style JSON and processes sources
12944
12944
  * 2. `sprites` - Downloads sprite images and JSON for map icons
12945
12945
  * 3. `glyphs` - Downloads font glyphs for text rendering
12946
- * 4. `tiles` - Downloads map tiles for the specified region bounds
12946
+ * 4. `models` - Downloads 3D model assets (Mapbox Standard trees / turbines)
12947
+ * 5. `tiles` - Downloads map tiles for the specified region bounds
12947
12948
  *
12948
12949
  * **Usage:**
12949
12950
  * The DownloadManager is typically instantiated by the OfflineManagerControl
@@ -13203,7 +13204,7 @@ class ModalManager {
13203
13204
  * - Integrates seamlessly as a MapLibre GL control
13204
13205
  * - Intercepts fetch requests to serve offline resources from IndexedDB
13205
13206
  * - Supports light and dark themes
13206
- * - Shows download progress across all phases (style, sprites, glyphs, tiles)
13207
+ * - Shows download progress across all phases (style, sprites, glyphs, models, tiles)
13207
13208
  * - Optional bounding box visualization for regions
13208
13209
  *
13209
13210
  * @example
@@ -13229,7 +13230,7 @@ const controlLogger = logger.scope('OfflineControl');
13229
13230
  /**
13230
13231
  * MapLibre GL JS control for managing offline map regions.
13231
13232
  *
13232
- * Implements the IControl interface to integrate with MapLibre GL maps.
13233
+ * Implements the IControl interface to integrate with MapLibre GL and Mapbox GL maps.
13233
13234
  * Provides a complete UI for downloading, managing, and loading offline map data.
13234
13235
  *
13235
13236
  * The control automatically intercepts fetch requests to serve offline resources
@@ -13393,10 +13394,13 @@ class OfflineManagerControl {
13393
13394
  * Called when the control is added to a map.
13394
13395
  * Implements the IControl.onAdd interface method.
13395
13396
  *
13396
- * @param map - The MapLibre GL map instance
13397
+ * @param map - The MapLibre GL or Mapbox GL map instance
13397
13398
  * @returns The control's container element
13398
13399
  */
13399
13400
  onAdd(map) {
13401
+ // Internally the control works against the MapLibre `Map` typings; the
13402
+ // structural `ControlMap` parameter is what lets it satisfy both
13403
+ // libraries' `IControl` so callers need no cast (see issue #39).
13400
13404
  this.map = map;
13401
13405
  // Detect the correct CSS prefix for the map library in use
13402
13406
  const cssPrefix = detectCssPrefix(map.getContainer());