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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StorageAnalyticsReport } from '
|
|
1
|
+
import type { StorageAnalyticsReport } from '../../types';
|
|
2
2
|
import type { OfflineManagerServices } from './base';
|
|
3
3
|
import type { CleanupManagement } from './cleanupManagement';
|
|
4
4
|
export interface AnalyticsManagement {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CleanupService } from '
|
|
2
|
-
import { RegionService } from '
|
|
3
|
-
import { ResourceService } from '
|
|
4
|
-
import { AnalyticsService } from '
|
|
5
|
-
import { ImportExportService } from '
|
|
1
|
+
import { CleanupService } from '../../services/cleanupService';
|
|
2
|
+
import { RegionService } from '../../services/regionService';
|
|
3
|
+
import { ResourceService } from '../../services/resourceService';
|
|
4
|
+
import { AnalyticsService } from '../../services/analyticsService';
|
|
5
|
+
import { ImportExportService } from '../../services/importExportService';
|
|
6
6
|
export interface OfflineManagerServices {
|
|
7
7
|
regionService: RegionService;
|
|
8
8
|
cleanupService: CleanupService;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CleanupResult, RegionAnalytics, RegionCleanupOptions } from '
|
|
1
|
+
import type { CleanupResult, RegionAnalytics, RegionCleanupOptions } from '../../types';
|
|
2
2
|
import type { OfflineManagerServices } from './base';
|
|
3
3
|
export interface CleanupManagement {
|
|
4
4
|
getRegionSize(regionId: string, styleId?: string): Promise<number>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExportResult, ImportExportOptions, ImportResult, MBTilesExportOptions, RegionImportData } from '
|
|
1
|
+
import type { ExportResult, ImportExportOptions, ImportResult, MBTilesExportOptions, RegionImportData } from '../../types';
|
|
2
2
|
import type { OfflineManagerServices } from './base';
|
|
3
3
|
/**
|
|
4
4
|
* MBTiles-only import/export surface. Regions are exchanged as real
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MaintenanceOptions, MaintenanceResults } from '
|
|
1
|
+
import type { MaintenanceOptions, MaintenanceResults } from '../../types';
|
|
2
2
|
import type { OfflineManagerServices } from './base';
|
|
3
3
|
import type { CleanupManagement } from './cleanupManagement';
|
|
4
4
|
import type { RegionManagement } from './regionManagement';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DownloadRegionOptions, DownloadRegionResult, OfflineRegionOptions, StoredRegion } from '
|
|
1
|
+
import type { DownloadRegionOptions, DownloadRegionResult, OfflineRegionOptions, StoredRegion } from '../../types';
|
|
2
2
|
import type { OfflineManagerServices } from './base';
|
|
3
3
|
export interface RegionManagement {
|
|
4
4
|
addRegion(region: OfflineRegionOptions): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ResourceService } from '
|
|
1
|
+
import type { ResourceService } from '../../services/resourceService';
|
|
2
2
|
import type { OfflineManagerServices } from './base';
|
|
3
3
|
export type ResourceServiceMethod<TMethod extends keyof ResourceService> = ResourceService[TMethod];
|
|
4
4
|
export interface ResourceManagement {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EnhancedStyleStats, StyleDownloadOptions, StyleDownloadResult, StyleEntry, StyleProvider } from '
|
|
1
|
+
import type { EnhancedStyleStats, StyleDownloadOptions, StyleDownloadResult, StyleEntry, StyleProvider } from '../../types';
|
|
2
2
|
export interface StyleManagement {
|
|
3
3
|
downloadStyle(styleUrl: string, options?: StyleDownloadOptions & {
|
|
4
4
|
provider?: StyleProvider;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EnhancedGlyphStats } from './glyphService';
|
|
2
|
-
import type { RegionAnalytics, TileStats, StorageAnalyticsReport, EnhancedFontStats, EnhancedSpriteStats } from '
|
|
2
|
+
import type { RegionAnalytics, TileStats, StorageAnalyticsReport, EnhancedFontStats, EnhancedSpriteStats } from '../types';
|
|
3
3
|
export declare class AnalyticsService {
|
|
4
4
|
getAllTileStats(): Promise<TileStats>;
|
|
5
5
|
getAllFontStats(): Promise<EnhancedFontStats>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StoredRegion, RegionCleanupOptions, CleanupResult, RegionAnalytics } from '
|
|
1
|
+
import type { StoredRegion, RegionCleanupOptions, CleanupResult, RegionAnalytics } from '../types';
|
|
2
2
|
export declare class CleanupService {
|
|
3
3
|
private db;
|
|
4
4
|
private deleteRegionCallback;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EnhancedFontStats, FontDownloadOptions, FontDownloadResult } from '
|
|
1
|
+
import type { EnhancedFontStats, FontDownloadOptions, FontDownloadResult } from '../types';
|
|
2
2
|
export declare class FontService {
|
|
3
3
|
private db;
|
|
4
4
|
downloadFonts(fontUrls: string[], styleName?: string, options?: FontDownloadOptions): Promise<FontDownloadResult>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GlyphDownloadOptions, GlyphDownloadResult, GlyphEntry, GlyphRange } from '
|
|
1
|
+
import type { GlyphDownloadOptions, GlyphDownloadResult, GlyphEntry, GlyphRange } from '../types';
|
|
2
2
|
export interface EnhancedGlyphStats {
|
|
3
3
|
count: number;
|
|
4
4
|
totalSize: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RegionImportData, ImportExportOptions, ImportResult, ExportResult, MBTilesExportOptions } from '
|
|
1
|
+
import type { RegionImportData, ImportExportOptions, ImportResult, ExportResult, MBTilesExportOptions } from '../types';
|
|
2
2
|
export declare class ImportExportService {
|
|
3
3
|
private db;
|
|
4
4
|
constructor();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { StorageAnalyticsReport, MaintenanceOptions, MaintenanceResults, RegionCleanupOptions, CleanupResult } from '
|
|
2
|
-
export type { MaintenanceOptions, MaintenanceResults } from '
|
|
1
|
+
import type { StorageAnalyticsReport, MaintenanceOptions, MaintenanceResults, RegionCleanupOptions, CleanupResult } from '../types';
|
|
2
|
+
export type { MaintenanceOptions, MaintenanceResults } from '../types/maintenance';
|
|
3
3
|
export declare class MaintenanceService {
|
|
4
4
|
private performSmartCleanup;
|
|
5
5
|
private listRegions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ModelEntry, ModelDownloadOptions, ModelDownloadResult, EnhancedModelStats } from '
|
|
1
|
+
import type { ModelEntry, ModelDownloadOptions, ModelDownloadResult, EnhancedModelStats } from '../types';
|
|
2
2
|
/** True when the given key belongs to the given styleId's model store prefix. */
|
|
3
3
|
export declare function modelKeyBelongsToStyle(key: string, styleId: string): boolean;
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DownloadRegionOptions, DownloadRegionResult, OfflineRegionOptions, StoredRegion } from '
|
|
1
|
+
import type { DownloadRegionOptions, DownloadRegionResult, OfflineRegionOptions, StoredRegion } from '../types/region';
|
|
2
2
|
/**
|
|
3
3
|
* True when `key` belongs to the given styleId.
|
|
4
4
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EnhancedGlyphStats } from './glyphService';
|
|
2
|
-
import type { OfflineRegionOptions, MapboxStyle, TileDownloadOptions, TileDownloadResult, TileStats, SpriteDownloadOptions, SpriteDownloadResult, EnhancedSpriteStats, FontDownloadOptions, FontDownloadResult, EnhancedFontStats, GlyphDownloadOptions, GlyphDownloadResult, ModelDownloadOptions, ModelDownloadResult, EnhancedModelStats } from '
|
|
2
|
+
import type { OfflineRegionOptions, MapboxStyle, TileDownloadOptions, TileDownloadResult, TileStats, SpriteDownloadOptions, SpriteDownloadResult, EnhancedSpriteStats, FontDownloadOptions, FontDownloadResult, EnhancedFontStats, GlyphDownloadOptions, GlyphDownloadResult, ModelDownloadOptions, ModelDownloadResult, EnhancedModelStats } from '../types';
|
|
3
3
|
export declare class ResourceService {
|
|
4
4
|
downloadTilesWithOptions(region: OfflineRegionOptions, style: MapboxStyle, styleId: string, options?: TileDownloadOptions): Promise<TileDownloadResult>;
|
|
5
5
|
getTileStats(styleId?: string): Promise<TileStats>;
|
|
@@ -30,7 +30,7 @@ export declare class ResourceService {
|
|
|
30
30
|
downloadGlyphsWithOptions(glyphUrl: string, fontstacks: string[], styleName: string, ranges?: string[], options?: GlyphDownloadOptions): Promise<GlyphDownloadResult>;
|
|
31
31
|
getGlyphStats(): Promise<EnhancedGlyphStats>;
|
|
32
32
|
getGlyphAnalytics(): Promise<Record<string, unknown>>;
|
|
33
|
-
loadGlyphsForStyle(fontstack: string, ranges: string[], styleId?: string): Promise<import("
|
|
33
|
+
loadGlyphsForStyle(fontstack: string, ranges: string[], styleId?: string): Promise<import("../types").GlyphRange[]>;
|
|
34
34
|
cleanupOldGlyphs(styleId?: string, options?: {
|
|
35
35
|
maxAge?: number;
|
|
36
36
|
}): Promise<number>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EnhancedSpriteStats, SpriteDownloadOptions, SpriteDownloadResult } from '
|
|
1
|
+
import type { EnhancedSpriteStats, SpriteDownloadOptions, SpriteDownloadResult } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Service for managing map sprite assets
|
|
4
4
|
* Handles downloading, storing, and retrieving sprite images and JSON metadata
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StyleProvider, StyleDownloadOptions, StyleDownloadResult, StyleStorageItem, EnhancedStyleStats } from '
|
|
1
|
+
import type { StyleProvider, StyleDownloadOptions, StyleDownloadResult, StyleStorageItem, EnhancedStyleStats } from '../types';
|
|
2
2
|
export declare function downloadStyles(stylesUrl: string, options?: StyleDownloadOptions): Promise<StyleDownloadResult>;
|
|
3
3
|
export declare function loadStyles(): Promise<StyleStorageItem[]>;
|
|
4
4
|
export declare function loadStyleById(styleId: string): Promise<StyleStorageItem | null>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TileDownloadOptions, TileDownloadResult, TileStats, OfflineRegionOptions, MapboxStyle } from '
|
|
1
|
+
import type { TileDownloadOptions, TileDownloadResult, TileStats, OfflineRegionOptions, MapboxStyle } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Service for managing offline map tiles
|
|
4
4
|
* Handles downloading, storing, and retrieving map tiles from IndexedDB
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDBPDatabase } from 'idb';
|
|
2
|
-
import { OfflineMapDB } from '
|
|
2
|
+
import { OfflineMapDB } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Thrown when the on-disk IndexedDB is at a higher schema version than the
|
|
5
5
|
* library was built against — i.e. after a downgrade, or when another app
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Action buttons section for the offline manager
|
|
3
3
|
* Refactored to use modular components
|
|
4
4
|
*/
|
|
5
|
-
import { Theme } from '
|
|
5
|
+
import { Theme } from '../../ui/ThemeManager';
|
|
6
6
|
export interface ActionButtonsProps {
|
|
7
7
|
onAddRegion?: () => void;
|
|
8
8
|
onCleanup?: () => void;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Refactored to use modular Button components
|
|
4
4
|
*/
|
|
5
5
|
import { BaseComponent } from './shared/BaseComponent';
|
|
6
|
-
import type { StoredRegion } from '
|
|
6
|
+
import type { StoredRegion } from '../../types';
|
|
7
7
|
export interface RegionsListProps {
|
|
8
8
|
regions: StoredRegion[];
|
|
9
9
|
onDeleteRegion?: (regionId: string) => void;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Provides a dropdown to switch between available languages
|
|
4
4
|
*/
|
|
5
5
|
import { BaseComponent } from './BaseComponent';
|
|
6
|
-
import { SupportedLanguage } from '
|
|
6
|
+
import { SupportedLanguage } from '../../../ui/translations';
|
|
7
7
|
export interface LanguageSelectorOptions {
|
|
8
8
|
onChange?: (language: SupportedLanguage) => void;
|
|
9
9
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Refactored from ButtonManager to be more reusable
|
|
4
4
|
*/
|
|
5
5
|
import { BaseComponent, ComponentConfig } from './BaseComponent';
|
|
6
|
-
import type { CssPrefix } from '
|
|
6
|
+
import type { CssPrefix } from '../../../utils/cssPrefix';
|
|
7
7
|
export interface ControlButtonConfig extends ComponentConfig {
|
|
8
8
|
title?: string;
|
|
9
9
|
icon?: string;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Refactored from PanelRenderer to be more focused and reusable
|
|
4
4
|
*/
|
|
5
5
|
import { BaseComponent } from './BaseComponent';
|
|
6
|
-
import { OfflineMapManager } from '
|
|
7
|
-
import { DownloadManager } from '
|
|
8
|
-
import { ModalManager } from '
|
|
6
|
+
import { OfflineMapManager } from '../../../managers/offlineMapManager';
|
|
7
|
+
import { DownloadManager } from '../../../ui/managers/downloadManager';
|
|
8
|
+
import { ModalManager } from '../../../ui/modals/modalManager';
|
|
9
9
|
export interface ContentRendererConfig {
|
|
10
10
|
offlineManager: OfflineMapManager;
|
|
11
11
|
downloadManager: DownloadManager;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { BaseComponent } from './BaseComponent';
|
|
6
6
|
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
7
|
-
import { DownloadManager } from '
|
|
8
|
-
import { ModalManager } from '
|
|
7
|
+
import { DownloadManager } from '../../../ui/managers/downloadManager';
|
|
8
|
+
import { ModalManager } from '../../../ui/modals/modalManager';
|
|
9
9
|
export interface RegionDrawingConfig {
|
|
10
10
|
map: MaplibreMap;
|
|
11
11
|
downloadManager: DownloadManager;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Handles polygon drawing, area calculation, and map visualization
|
|
4
4
|
*/
|
|
5
5
|
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
6
|
-
import type { CssPrefix } from '
|
|
6
|
+
import type { CssPrefix } from '../../utils/cssPrefix';
|
|
7
7
|
export interface PolygonControlOptions {
|
|
8
8
|
onSave: (bounds: [number, number, number, number], area: number) => void;
|
|
9
9
|
onCancel: () => void;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Manages region selection, form modal, and saves
|
|
4
4
|
*/
|
|
5
5
|
import type { Map as MaplibreMap } from 'maplibre-gl';
|
|
6
|
-
import { DownloadManager } from '
|
|
7
|
-
import { ModalManager } from '
|
|
8
|
-
import type { CssPrefix } from '
|
|
6
|
+
import { DownloadManager } from '../../ui/managers/downloadManager';
|
|
7
|
+
import { ModalManager } from '../../ui/modals/modalManager';
|
|
8
|
+
import type { CssPrefix } from '../../utils/cssPrefix';
|
|
9
9
|
export interface RegionControlOptions {
|
|
10
10
|
map: MaplibreMap;
|
|
11
11
|
downloadManager: DownloadManager;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Manages the main control button and progress badge states
|
|
4
4
|
* Refactored to use modular Button component
|
|
5
5
|
*/
|
|
6
|
-
import type { CssPrefix } from '
|
|
6
|
+
import type { CssPrefix } from '../../utils/cssPrefix';
|
|
7
7
|
export interface ButtonManagerOptions {
|
|
8
8
|
onTogglePanel: () => void;
|
|
9
9
|
cssPrefix?: CssPrefix;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Handles rendering of the main offline manager panel
|
|
4
4
|
* Refactored to use modular components
|
|
5
5
|
*/
|
|
6
|
-
import { OfflineMapManager } from '
|
|
6
|
+
import { OfflineMapManager } from '../../managers/offlineMapManager';
|
|
7
7
|
import { DownloadManager } from './downloadManager';
|
|
8
|
-
import { ModalManager } from '
|
|
9
|
-
import { BaseComponent } from '
|
|
8
|
+
import { ModalManager } from '../../ui/modals/modalManager';
|
|
9
|
+
import { BaseComponent } from '../../ui/components/shared/BaseComponent';
|
|
10
10
|
type MaplibreMap = unknown;
|
|
11
11
|
export interface PanelRendererOptions {
|
|
12
12
|
offlineManager: OfflineMapManager;
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
*
|
|
45
45
|
* @module downloadManager
|
|
46
46
|
*/
|
|
47
|
-
import { OfflineMapManager } from '
|
|
48
|
-
import { RegionFormData } from '
|
|
47
|
+
import { OfflineMapManager } from '../../managers/offlineMapManager';
|
|
48
|
+
import { RegionFormData } from '../../ui/modals/regionFormModal';
|
|
49
49
|
/**
|
|
50
50
|
* Progress information for an active download.
|
|
51
51
|
*
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Focused modal for exchanging regions as binary SQLite MBTiles archives.
|
|
5
5
|
* Replaces the previous multi-format import/export modal.
|
|
6
6
|
*/
|
|
7
|
-
import type { StoredRegion, ImportExportOptions, MBTilesExportOptions, ExportResult, ImportResult, RegionImportData } from '
|
|
7
|
+
import type { StoredRegion, ImportExportOptions, MBTilesExportOptions, ExportResult, ImportResult, RegionImportData } from '../../types';
|
|
8
8
|
type MBTilesExportRequestOptions = ImportExportOptions & MBTilesExportOptions;
|
|
9
9
|
export interface MBTilesModalOptions {
|
|
10
10
|
region: StoredRegion;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Shows detailed information about a specific region
|
|
4
4
|
* Refactored to use modular components
|
|
5
5
|
*/
|
|
6
|
-
import { StoredRegion } from '
|
|
6
|
+
import { StoredRegion } from '../../types/region';
|
|
7
7
|
export interface RegionDetailsOptions {
|
|
8
8
|
region: StoredRegion;
|
|
9
9
|
onClose: () => void;
|
|
@@ -12,7 +12,7 @@ export interface RegionFormData {
|
|
|
12
12
|
provider?: 'mapbox' | 'maplibre' | 'auto';
|
|
13
13
|
accessToken?: string;
|
|
14
14
|
/** Additional tile sources to download alongside the style's own sources */
|
|
15
|
-
extraSources?: import('
|
|
15
|
+
extraSources?: import('../../types/region').ExtraSource[];
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* A tile source discovered on the live map, presented to the user for selection.
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
*
|
|
35
35
|
* @module offlineManagerControl
|
|
36
36
|
*/
|
|
37
|
-
import type { IControl
|
|
38
|
-
import { OfflineMapManager } from '
|
|
37
|
+
import type { IControl } from 'maplibre-gl';
|
|
38
|
+
import { OfflineMapManager } from '../managers/offlineMapManager';
|
|
39
39
|
/**
|
|
40
40
|
* Request shape MapLibre passes to a protocol handler. `type` indicates how
|
|
41
41
|
* the response will be consumed — `"json"` for sprite atlases / TileJSON,
|
|
@@ -63,6 +63,17 @@ export interface MapLibProtocol {
|
|
|
63
63
|
addProtocol: (protocol: string, handler: (params: MapLibProtocolRequest) => Promise<MapLibProtocolResponse>) => void;
|
|
64
64
|
removeProtocol: (protocol: string) => void;
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Minimal structural type for the host map `OfflineManagerControl` is added to.
|
|
68
|
+
*
|
|
69
|
+
* The control works with both MapLibre GL JS and Mapbox GL JS. Typing the
|
|
70
|
+
* `onAdd` parameter structurally — rather than as a specific renderer's `Map`
|
|
71
|
+
* — lets the control satisfy *either* library's `IControl`, so it can be added
|
|
72
|
+
* via `map.addControl()` on either renderer without a cast. See issue #39.
|
|
73
|
+
*/
|
|
74
|
+
export interface ControlMap {
|
|
75
|
+
getContainer(): HTMLElement;
|
|
76
|
+
}
|
|
66
77
|
/**
|
|
67
78
|
* Configuration options for the OfflineManagerControl.
|
|
68
79
|
*
|
|
@@ -94,7 +105,7 @@ export interface OfflineManagerControlOptions {
|
|
|
94
105
|
/**
|
|
95
106
|
* MapLibre GL JS control for managing offline map regions.
|
|
96
107
|
*
|
|
97
|
-
* Implements the IControl interface to integrate with MapLibre GL maps.
|
|
108
|
+
* Implements the IControl interface to integrate with MapLibre GL and Mapbox GL maps.
|
|
98
109
|
* Provides a complete UI for downloading, managing, and loading offline map data.
|
|
99
110
|
*
|
|
100
111
|
* The control automatically intercepts fetch requests to serve offline resources
|
|
@@ -153,10 +164,10 @@ export declare class OfflineManagerControl implements IControl {
|
|
|
153
164
|
* Called when the control is added to a map.
|
|
154
165
|
* Implements the IControl.onAdd interface method.
|
|
155
166
|
*
|
|
156
|
-
* @param map - The MapLibre GL map instance
|
|
167
|
+
* @param map - The MapLibre GL or Mapbox GL map instance
|
|
157
168
|
* @returns The control's container element
|
|
158
169
|
*/
|
|
159
|
-
onAdd(map:
|
|
170
|
+
onAdd(map: ControlMap): HTMLElement;
|
|
160
171
|
/**
|
|
161
172
|
* Called when the control is removed from a map.
|
|
162
173
|
* Implements the IControl.onRemove interface method.
|
package/dist/utils/download.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* into the outer style. This allows the existing download pipeline to work
|
|
7
7
|
* unchanged with import-based styles like Mapbox Standard.
|
|
8
8
|
*/
|
|
9
|
-
import type { BaseStyle } from '
|
|
9
|
+
import type { BaseStyle } from '../types/style';
|
|
10
10
|
/** A single import entry in a style's `imports` array */
|
|
11
11
|
export interface StyleImport {
|
|
12
12
|
id: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Style Provider Detection and Handling Utilities
|
|
3
3
|
* Supports both Mapbox GL and MapLibre GL styles
|
|
4
4
|
*/
|
|
5
|
-
import type { BaseStyle, StyleProvider } from '
|
|
5
|
+
import type { BaseStyle, StyleProvider } from '../types/style';
|
|
6
6
|
/**
|
|
7
7
|
* Check if a URL uses the mapbox:// protocol
|
|
8
8
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Validation utilities for common patterns
|
|
3
3
|
* Provides reusable validation functions to ensure data integrity
|
|
4
4
|
*/
|
|
5
|
-
import type { OfflineRegionOptions } from '
|
|
5
|
+
import type { OfflineRegionOptions } from '../types';
|
|
6
6
|
/**
|
|
7
7
|
* Validate geographic bounds
|
|
8
8
|
* @param bounds - Array of two [lng, lat] coordinate pairs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "map-gl-offline",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6",
|
|
4
4
|
"description": "A TypeScript-compatible npm package for MapLibre GL JS that enables comprehensive offline storage and usage of vector/raster tiles, sprites, styles, fonts (glyphs), and entire map regions with advanced analytics, import/export capabilities, and intelligent cleanup.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"build": "npm run build:clean && npm run build:sw-src && npm run build:lib && npm run build:types && npm run build:css && npm run build:sw",
|
|
40
40
|
"build:clean": "rimraf dist",
|
|
41
41
|
"build:lib": "rollup -c",
|
|
42
|
-
"build:types": "tsc --declaration --emitDeclarationOnly --outDir dist",
|
|
42
|
+
"build:types": "tsc --declaration --emitDeclarationOnly --outDir dist && tsc-alias -p tsconfig.json --outDir dist",
|
|
43
43
|
"build:css": "tailwindcss -i src/styles/style.css -o dist/style.css --minify",
|
|
44
44
|
"build:sw-src": "node scripts/build-sw.mjs",
|
|
45
45
|
"build:sw": "cp public/idb-offline-sw.js dist/idb-offline-sw.js && cp bin/vite-plugin.js dist/vite-plugin.js",
|
|
@@ -154,6 +154,7 @@
|
|
|
154
154
|
"tailwindcss": "^4.2.0",
|
|
155
155
|
"ts-jest": "^29.4.6",
|
|
156
156
|
"ts-node": "^10.9.2",
|
|
157
|
+
"tsc-alias": "^1.8.17",
|
|
157
158
|
"tsconfig-paths": "^4.2.0",
|
|
158
159
|
"tslib": "^2.8.1",
|
|
159
160
|
"tsx": "^4.21.0",
|