map-gl-offline 0.8.4 → 0.8.6

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 (53) hide show
  1. package/README.md +2 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.esm.js +16 -3
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +16 -3
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.umd.js +16 -3
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/managers/offlineMapManager/analyticsManagement.d.ts +1 -1
  10. package/dist/managers/offlineMapManager/base.d.ts +5 -5
  11. package/dist/managers/offlineMapManager/cleanupManagement.d.ts +1 -1
  12. package/dist/managers/offlineMapManager/importExportManagement.d.ts +1 -1
  13. package/dist/managers/offlineMapManager/maintenanceManagement.d.ts +1 -1
  14. package/dist/managers/offlineMapManager/regionManagement.d.ts +1 -1
  15. package/dist/managers/offlineMapManager/resourceManagement.d.ts +1 -1
  16. package/dist/managers/offlineMapManager/styleManagement.d.ts +1 -1
  17. package/dist/services/analyticsService.d.ts +1 -1
  18. package/dist/services/cleanupService.d.ts +1 -1
  19. package/dist/services/fontService.d.ts +1 -1
  20. package/dist/services/glyphService.d.ts +1 -1
  21. package/dist/services/importExportService.d.ts +1 -1
  22. package/dist/services/maintenanceService.d.ts +2 -2
  23. package/dist/services/modelService.d.ts +1 -1
  24. package/dist/services/regionService.d.ts +1 -1
  25. package/dist/services/resourceService.d.ts +2 -2
  26. package/dist/services/spriteService.d.ts +1 -1
  27. package/dist/services/styleService.d.ts +1 -1
  28. package/dist/services/tileService.d.ts +1 -1
  29. package/dist/storage/indexedDbManager.d.ts +1 -1
  30. package/dist/types/maintenance.d.ts +1 -1
  31. package/dist/ui/components/PanelActions.d.ts +1 -1
  32. package/dist/ui/components/PanelHeader.d.ts +1 -1
  33. package/dist/ui/components/RegionList.d.ts +1 -1
  34. package/dist/ui/components/shared/LanguageSelector.d.ts +1 -1
  35. package/dist/ui/components/shared/MapControlButton.d.ts +1 -1
  36. package/dist/ui/components/shared/PanelContent.d.ts +3 -3
  37. package/dist/ui/components/shared/RegionDrawingTool.d.ts +2 -2
  38. package/dist/ui/controls/polygonControl.d.ts +1 -1
  39. package/dist/ui/controls/regionControl.d.ts +3 -3
  40. package/dist/ui/managers/ControlButtonManager.d.ts +1 -1
  41. package/dist/ui/managers/PanelManager.d.ts +3 -3
  42. package/dist/ui/managers/downloadManager.d.ts +2 -2
  43. package/dist/ui/modals/mbtilesModal.d.ts +1 -1
  44. package/dist/ui/modals/regionDetailsModal.d.ts +1 -1
  45. package/dist/ui/modals/regionFormModal.d.ts +1 -1
  46. package/dist/ui/offlineManagerControl.d.ts +16 -5
  47. package/dist/utils/convertStyleForSW.d.ts +1 -1
  48. package/dist/utils/download.d.ts +1 -1
  49. package/dist/utils/importResolver.d.ts +1 -1
  50. package/dist/utils/styleProviderUtils.d.ts +1 -1
  51. package/dist/utils/styleUtils.d.ts +1 -1
  52. package/dist/utils/validation.d.ts +1 -1
  53. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -12835,7 +12835,17 @@ class RegionControl {
12835
12835
  const styleUrl = this.options.styleUrl;
12836
12836
  if (!styleUrl)
12837
12837
  return new Set();
12838
- const response = await fetch(styleUrl);
12838
+ // Resolve mapbox:// style URLs — fetch() cannot load the mapbox: scheme
12839
+ // and throws "URL scheme \"mapbox\" is not supported" otherwise.
12840
+ let fetchUrl = styleUrl;
12841
+ if (isMapboxProtocol(styleUrl)) {
12842
+ if (!this.options.accessToken) {
12843
+ regionLogger.warn('Cannot resolve mapbox:// style URL for source filtering without an access token');
12844
+ return new Set();
12845
+ }
12846
+ fetchUrl = resolveMapboxUrl(styleUrl, this.options.accessToken);
12847
+ }
12848
+ const response = await fetch(fetchUrl);
12839
12849
  if (!response.ok)
12840
12850
  return new Set();
12841
12851
  const styleJson = (await response.json());
@@ -13253,7 +13263,7 @@ const controlLogger = logger.scope('OfflineControl');
13253
13263
  /**
13254
13264
  * MapLibre GL JS control for managing offline map regions.
13255
13265
  *
13256
- * Implements the IControl interface to integrate with MapLibre GL maps.
13266
+ * Implements the IControl interface to integrate with MapLibre GL and Mapbox GL maps.
13257
13267
  * Provides a complete UI for downloading, managing, and loading offline map data.
13258
13268
  *
13259
13269
  * The control automatically intercepts fetch requests to serve offline resources
@@ -13417,10 +13427,13 @@ class OfflineManagerControl {
13417
13427
  * Called when the control is added to a map.
13418
13428
  * Implements the IControl.onAdd interface method.
13419
13429
  *
13420
- * @param map - The MapLibre GL map instance
13430
+ * @param map - The MapLibre GL or Mapbox GL map instance
13421
13431
  * @returns The control's container element
13422
13432
  */
13423
13433
  onAdd(map) {
13434
+ // Internally the control works against the MapLibre `Map` typings; the
13435
+ // structural `ControlMap` parameter is what lets it satisfy both
13436
+ // libraries' `IControl` so callers need no cast (see issue #39).
13424
13437
  this.map = map;
13425
13438
  // Detect the correct CSS prefix for the map library in use
13426
13439
  const cssPrefix = detectCssPrefix(map.getContainer());