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.
- package/README.md +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +16 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +16 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/managers/offlineMapManager/analyticsManagement.d.ts +1 -1
- package/dist/managers/offlineMapManager/base.d.ts +5 -5
- package/dist/managers/offlineMapManager/cleanupManagement.d.ts +1 -1
- package/dist/managers/offlineMapManager/importExportManagement.d.ts +1 -1
- package/dist/managers/offlineMapManager/maintenanceManagement.d.ts +1 -1
- package/dist/managers/offlineMapManager/regionManagement.d.ts +1 -1
- package/dist/managers/offlineMapManager/resourceManagement.d.ts +1 -1
- package/dist/managers/offlineMapManager/styleManagement.d.ts +1 -1
- package/dist/services/analyticsService.d.ts +1 -1
- package/dist/services/cleanupService.d.ts +1 -1
- package/dist/services/fontService.d.ts +1 -1
- package/dist/services/glyphService.d.ts +1 -1
- package/dist/services/importExportService.d.ts +1 -1
- package/dist/services/maintenanceService.d.ts +2 -2
- package/dist/services/modelService.d.ts +1 -1
- package/dist/services/regionService.d.ts +1 -1
- package/dist/services/resourceService.d.ts +2 -2
- package/dist/services/spriteService.d.ts +1 -1
- package/dist/services/styleService.d.ts +1 -1
- package/dist/services/tileService.d.ts +1 -1
- package/dist/storage/indexedDbManager.d.ts +1 -1
- package/dist/types/maintenance.d.ts +1 -1
- package/dist/ui/components/PanelActions.d.ts +1 -1
- package/dist/ui/components/PanelHeader.d.ts +1 -1
- package/dist/ui/components/RegionList.d.ts +1 -1
- package/dist/ui/components/shared/LanguageSelector.d.ts +1 -1
- package/dist/ui/components/shared/MapControlButton.d.ts +1 -1
- package/dist/ui/components/shared/PanelContent.d.ts +3 -3
- package/dist/ui/components/shared/RegionDrawingTool.d.ts +2 -2
- package/dist/ui/controls/polygonControl.d.ts +1 -1
- package/dist/ui/controls/regionControl.d.ts +3 -3
- package/dist/ui/managers/ControlButtonManager.d.ts +1 -1
- package/dist/ui/managers/PanelManager.d.ts +3 -3
- package/dist/ui/managers/downloadManager.d.ts +2 -2
- package/dist/ui/modals/mbtilesModal.d.ts +1 -1
- package/dist/ui/modals/regionDetailsModal.d.ts +1 -1
- package/dist/ui/modals/regionFormModal.d.ts +1 -1
- package/dist/ui/offlineManagerControl.d.ts +16 -5
- package/dist/utils/convertStyleForSW.d.ts +1 -1
- package/dist/utils/download.d.ts +1 -1
- package/dist/utils/importResolver.d.ts +1 -1
- package/dist/utils/styleProviderUtils.d.ts +1 -1
- package/dist/utils/styleUtils.d.ts +1 -1
- package/dist/utils/validation.d.ts +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -77,6 +77,8 @@ Then:
|
|
|
77
77
|
```typescript
|
|
78
78
|
import mapboxgl from 'mapbox-gl';
|
|
79
79
|
import { OfflineMapManager, OfflineManagerControl } from 'map-gl-offline';
|
|
80
|
+
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
81
|
+
import 'map-gl-offline/style.css';
|
|
80
82
|
|
|
81
83
|
mapboxgl.accessToken = 'YOUR_MAPBOX_TOKEN';
|
|
82
84
|
|
package/dist/index.d.ts
CHANGED
|
@@ -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
|
@@ -12812,7 +12812,17 @@ class RegionControl {
|
|
|
12812
12812
|
const styleUrl = this.options.styleUrl;
|
|
12813
12813
|
if (!styleUrl)
|
|
12814
12814
|
return new Set();
|
|
12815
|
-
|
|
12815
|
+
// Resolve mapbox:// style URLs — fetch() cannot load the mapbox: scheme
|
|
12816
|
+
// and throws "URL scheme \"mapbox\" is not supported" otherwise.
|
|
12817
|
+
let fetchUrl = styleUrl;
|
|
12818
|
+
if (isMapboxProtocol(styleUrl)) {
|
|
12819
|
+
if (!this.options.accessToken) {
|
|
12820
|
+
regionLogger.warn('Cannot resolve mapbox:// style URL for source filtering without an access token');
|
|
12821
|
+
return new Set();
|
|
12822
|
+
}
|
|
12823
|
+
fetchUrl = resolveMapboxUrl(styleUrl, this.options.accessToken);
|
|
12824
|
+
}
|
|
12825
|
+
const response = await fetch(fetchUrl);
|
|
12816
12826
|
if (!response.ok)
|
|
12817
12827
|
return new Set();
|
|
12818
12828
|
const styleJson = (await response.json());
|
|
@@ -13230,7 +13240,7 @@ const controlLogger = logger.scope('OfflineControl');
|
|
|
13230
13240
|
/**
|
|
13231
13241
|
* MapLibre GL JS control for managing offline map regions.
|
|
13232
13242
|
*
|
|
13233
|
-
* Implements the IControl interface to integrate with MapLibre GL maps.
|
|
13243
|
+
* Implements the IControl interface to integrate with MapLibre GL and Mapbox GL maps.
|
|
13234
13244
|
* Provides a complete UI for downloading, managing, and loading offline map data.
|
|
13235
13245
|
*
|
|
13236
13246
|
* The control automatically intercepts fetch requests to serve offline resources
|
|
@@ -13394,10 +13404,13 @@ class OfflineManagerControl {
|
|
|
13394
13404
|
* Called when the control is added to a map.
|
|
13395
13405
|
* Implements the IControl.onAdd interface method.
|
|
13396
13406
|
*
|
|
13397
|
-
* @param map - The MapLibre GL map instance
|
|
13407
|
+
* @param map - The MapLibre GL or Mapbox GL map instance
|
|
13398
13408
|
* @returns The control's container element
|
|
13399
13409
|
*/
|
|
13400
13410
|
onAdd(map) {
|
|
13411
|
+
// Internally the control works against the MapLibre `Map` typings; the
|
|
13412
|
+
// structural `ControlMap` parameter is what lets it satisfy both
|
|
13413
|
+
// libraries' `IControl` so callers need no cast (see issue #39).
|
|
13401
13414
|
this.map = map;
|
|
13402
13415
|
// Detect the correct CSS prefix for the map library in use
|
|
13403
13416
|
const cssPrefix = detectCssPrefix(map.getContainer());
|