map-gl-offline 0.1.0-alpha.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.
- package/LICENSE +21 -0
- package/README.md +590 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.esm.js +15863 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +16015 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/managers/offlineMapManager/analyticsManagement.d.ts +7 -0
- package/dist/managers/offlineMapManager/base.d.ts +14 -0
- package/dist/managers/offlineMapManager/cleanupManagement.d.ts +16 -0
- package/dist/managers/offlineMapManager/importExportManagement.d.ts +10 -0
- package/dist/managers/offlineMapManager/index.d.ts +72 -0
- package/dist/managers/offlineMapManager/maintenanceManagement.d.ts +13 -0
- package/dist/managers/offlineMapManager/modules.d.ts +10 -0
- package/dist/managers/offlineMapManager/regionManagement.d.ts +11 -0
- package/dist/managers/offlineMapManager/resourceManagement.d.ts +24 -0
- package/dist/managers/offlineMapManager/styleManagement.d.ts +17 -0
- package/dist/managers/offlineMapManager.d.ts +2 -0
- package/dist/services/analyticsService.d.ts +10 -0
- package/dist/services/baseDownloadService.d.ts +96 -0
- package/dist/services/cleanupService.d.ts +34 -0
- package/dist/services/fontService.d.ts +26 -0
- package/dist/services/glyphService.d.ts +58 -0
- package/dist/services/importExportService.d.ts +57 -0
- package/dist/services/maintenanceService.d.ts +15 -0
- package/dist/services/regionService.d.ts +31 -0
- package/dist/services/resourceService.d.ts +42 -0
- package/dist/services/spriteService.d.ts +30 -0
- package/dist/services/styleService.d.ts +73 -0
- package/dist/services/tileService.d.ts +24 -0
- package/dist/storage/indexedDbManager.d.ts +2 -0
- package/dist/style.css +213 -0
- package/dist/types/cleanup.d.ts +49 -0
- package/dist/types/database.d.ts +33 -0
- package/dist/types/font.d.ts +115 -0
- package/dist/types/glyph.d.ts +127 -0
- package/dist/types/import-export.d.ts +96 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/maintenance.d.ts +49 -0
- package/dist/types/progress.d.ts +11 -0
- package/dist/types/region.d.ts +57 -0
- package/dist/types/sprite.d.ts +172 -0
- package/dist/types/style.d.ts +103 -0
- package/dist/types/tile.d.ts +112 -0
- package/dist/types/ui.d.ts +10 -0
- package/dist/ui/ThemeManager.d.ts +23 -0
- package/dist/ui/components/DownloadProgress.d.ts +14 -0
- package/dist/ui/components/PanelActions.d.ts +12 -0
- package/dist/ui/components/PanelHeader.d.ts +15 -0
- package/dist/ui/components/RegionList.d.ts +24 -0
- package/dist/ui/components/shared/BaseComponent.d.ts +86 -0
- package/dist/ui/components/shared/Button.d.ts +45 -0
- package/dist/ui/components/shared/List.d.ts +56 -0
- package/dist/ui/components/shared/MapControlButton.d.ts +37 -0
- package/dist/ui/components/shared/Modal.d.ts +49 -0
- package/dist/ui/components/shared/Panel.d.ts +53 -0
- package/dist/ui/components/shared/PanelContent.d.ts +39 -0
- package/dist/ui/components/shared/RegionDrawingTool.d.ts +54 -0
- package/dist/ui/components/shared/index.d.ts +12 -0
- package/dist/ui/controls/polygonControl.d.ts +83 -0
- package/dist/ui/controls/regionControl.d.ts +71 -0
- package/dist/ui/managers/ControlButtonManager.d.ts +42 -0
- package/dist/ui/managers/PanelManager.d.ts +160 -0
- package/dist/ui/managers/downloadManager.d.ts +63 -0
- package/dist/ui/modals/confirmationModal.d.ts +30 -0
- package/dist/ui/modals/importExportModal.d.ts +46 -0
- package/dist/ui/modals/importExportModal.old.d.ts +27 -0
- package/dist/ui/modals/modalManager.d.ts +23 -0
- package/dist/ui/modals/regionDetailsModal.d.ts +37 -0
- package/dist/ui/modals/regionFormModal.d.ts +86 -0
- package/dist/ui/offlineManagerControl.d.ts +120 -0
- package/dist/utils/asyncUtils.d.ts +24 -0
- package/dist/utils/cleanupCompressedTiles.d.ts +12 -0
- package/dist/utils/constants.d.ts +94 -0
- package/dist/utils/download.d.ts +52 -0
- package/dist/utils/errorHandling.d.ts +67 -0
- package/dist/utils/formatUtils.d.ts +24 -0
- package/dist/utils/formatting.d.ts +31 -0
- package/dist/utils/icons.d.ts +50 -0
- package/dist/utils/idbFetchHandler.d.ts +2 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/logger.d.ts +52 -0
- package/dist/utils/performance.d.ts +164 -0
- package/dist/utils/styleProviderUtils.d.ts +42 -0
- package/dist/utils/styleUtils.d.ts +35 -0
- package/dist/utils/validation.d.ts +67 -0
- package/package.json +145 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Panel Renderer Component
|
|
3
|
+
* Handles rendering of the main offline manager panel
|
|
4
|
+
* Refactored to use modular components
|
|
5
|
+
*/
|
|
6
|
+
import { OfflineMapManager } from '../../managers/offlineMapManager';
|
|
7
|
+
import { DownloadManager } from './downloadManager';
|
|
8
|
+
import { ModalManager } from '../modals/modalManager';
|
|
9
|
+
import { BaseComponent } from '../components/shared/BaseComponent';
|
|
10
|
+
type MaplibreMap = unknown;
|
|
11
|
+
export interface PanelRendererOptions {
|
|
12
|
+
offlineManager: OfflineMapManager;
|
|
13
|
+
downloadManager: DownloadManager;
|
|
14
|
+
modalManager: ModalManager;
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
onAddRegion: () => void;
|
|
17
|
+
onFocusRegion: (regionId: string) => void;
|
|
18
|
+
showBbox?: boolean;
|
|
19
|
+
map?: MaplibreMap;
|
|
20
|
+
}
|
|
21
|
+
export declare class PanelRenderer extends BaseComponent {
|
|
22
|
+
private offlineManager;
|
|
23
|
+
private downloadManager;
|
|
24
|
+
private modalManager;
|
|
25
|
+
private options;
|
|
26
|
+
private map?;
|
|
27
|
+
private headerContainer?;
|
|
28
|
+
private actionButtonsContainer?;
|
|
29
|
+
private regionsList?;
|
|
30
|
+
private downloadProgressContainer?;
|
|
31
|
+
private refreshTimeout?;
|
|
32
|
+
private isRefreshing;
|
|
33
|
+
constructor(options: PanelRendererOptions);
|
|
34
|
+
protected createElement(): HTMLElement;
|
|
35
|
+
/**
|
|
36
|
+
* Render the main panel content
|
|
37
|
+
*/
|
|
38
|
+
render(panelElement: HTMLDivElement): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Render header section
|
|
41
|
+
*/
|
|
42
|
+
private renderHeader;
|
|
43
|
+
/**
|
|
44
|
+
* Render action buttons section
|
|
45
|
+
*/
|
|
46
|
+
private renderActionButtons;
|
|
47
|
+
/**
|
|
48
|
+
* Render download progress section
|
|
49
|
+
*/
|
|
50
|
+
private renderDownloadProgress;
|
|
51
|
+
/**
|
|
52
|
+
* Render styles list with regions grouped under each style
|
|
53
|
+
*/
|
|
54
|
+
private renderRegionsList;
|
|
55
|
+
/**
|
|
56
|
+
* Create region item template
|
|
57
|
+
*/
|
|
58
|
+
private createRegionItemTemplate;
|
|
59
|
+
/**
|
|
60
|
+
* Create complete style template with header, HR, and regions
|
|
61
|
+
*/
|
|
62
|
+
private createCompleteStyleTemplate;
|
|
63
|
+
/**
|
|
64
|
+
* Create region item specifically for embedding within a style container
|
|
65
|
+
*/
|
|
66
|
+
private createRegionItemForStyle;
|
|
67
|
+
/**
|
|
68
|
+
* Create style item template with load button
|
|
69
|
+
*/
|
|
70
|
+
private createStyleItemTemplate;
|
|
71
|
+
/**
|
|
72
|
+
* Create orphaned regions header template
|
|
73
|
+
*/
|
|
74
|
+
private createOrphanedRegionsHeaderTemplate;
|
|
75
|
+
/**
|
|
76
|
+
* Create download progress HTML
|
|
77
|
+
*/
|
|
78
|
+
private createDownloadProgressHTML;
|
|
79
|
+
/**
|
|
80
|
+
* Handle region actions
|
|
81
|
+
*/
|
|
82
|
+
private handleRegionAction;
|
|
83
|
+
/**
|
|
84
|
+
* Handle showing region details
|
|
85
|
+
*/
|
|
86
|
+
private handleShowRegionDetails;
|
|
87
|
+
/**
|
|
88
|
+
* Handle deleting a region
|
|
89
|
+
*/
|
|
90
|
+
private handleDeleteRegion;
|
|
91
|
+
/**
|
|
92
|
+
* Handle re-downloading a region
|
|
93
|
+
*/
|
|
94
|
+
private handleRedownloadRegion;
|
|
95
|
+
/**
|
|
96
|
+
* Handle import/export functionality
|
|
97
|
+
*/
|
|
98
|
+
private handleImportExport;
|
|
99
|
+
/**
|
|
100
|
+
* Handle theme toggle
|
|
101
|
+
*/
|
|
102
|
+
private handleThemeToggle;
|
|
103
|
+
/**
|
|
104
|
+
* Get theme icon based on current theme
|
|
105
|
+
*/
|
|
106
|
+
private getThemeIcon;
|
|
107
|
+
/**
|
|
108
|
+
* Render error state
|
|
109
|
+
*/
|
|
110
|
+
private renderErrorState;
|
|
111
|
+
/**
|
|
112
|
+
* Add event listeners for embedded region action buttons
|
|
113
|
+
*/
|
|
114
|
+
private addRegionActionEventListeners;
|
|
115
|
+
/**
|
|
116
|
+
* Handle actions for embedded region buttons
|
|
117
|
+
*/
|
|
118
|
+
private handleEmbeddedRegionAction;
|
|
119
|
+
/**
|
|
120
|
+
* Fallback renderer for regions list when styles fail to load
|
|
121
|
+
*/
|
|
122
|
+
private renderFallbackRegionsList;
|
|
123
|
+
/**
|
|
124
|
+
* Refresh the panel content
|
|
125
|
+
*/
|
|
126
|
+
refresh(): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Perform the actual refresh
|
|
129
|
+
*/
|
|
130
|
+
private performRefresh;
|
|
131
|
+
/**
|
|
132
|
+
* Cleanup when component is destroyed
|
|
133
|
+
*/
|
|
134
|
+
destroy(): void;
|
|
135
|
+
/**
|
|
136
|
+
* Group regions by style ID
|
|
137
|
+
*/
|
|
138
|
+
private groupRegionsByStyle;
|
|
139
|
+
/**
|
|
140
|
+
* Handle actions for both styles and regions
|
|
141
|
+
*/
|
|
142
|
+
private handleItemAction;
|
|
143
|
+
/**
|
|
144
|
+
* Handle style-specific actions
|
|
145
|
+
*/
|
|
146
|
+
private handleStyleAction;
|
|
147
|
+
/**
|
|
148
|
+
* Handle fixing compressed tiles
|
|
149
|
+
*/
|
|
150
|
+
private handleFixCompressedTiles;
|
|
151
|
+
/**
|
|
152
|
+
* Handle loading a style to the map
|
|
153
|
+
*/
|
|
154
|
+
private handleLoadStyle;
|
|
155
|
+
/**
|
|
156
|
+
* Handle deleting a style
|
|
157
|
+
*/
|
|
158
|
+
private handleDeleteStyle;
|
|
159
|
+
}
|
|
160
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Download Manager Component
|
|
3
|
+
* Handles download operations and progress tracking
|
|
4
|
+
*/
|
|
5
|
+
import { OfflineMapManager } from '../../managers/offlineMapManager';
|
|
6
|
+
import { RegionFormData } from '../modals/regionFormModal';
|
|
7
|
+
export interface DownloadProgress {
|
|
8
|
+
regionId: string;
|
|
9
|
+
completed: number;
|
|
10
|
+
total: number;
|
|
11
|
+
percentage: number;
|
|
12
|
+
currentResource: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DownloadManagerOptions {
|
|
15
|
+
offlineManager: OfflineMapManager;
|
|
16
|
+
onProgressUpdate?: (downloads: Map<string, DownloadProgress>) => void;
|
|
17
|
+
onDownloadComplete?: (regionId: string) => void;
|
|
18
|
+
onDownloadError?: (regionId: string, error: Error | string) => void;
|
|
19
|
+
updateButton?: (text: string, disabled: boolean) => void;
|
|
20
|
+
updateProgressBadge?: (text: string, visible: boolean) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare class DownloadManager {
|
|
23
|
+
private offlineManager;
|
|
24
|
+
private currentDownloads;
|
|
25
|
+
private options;
|
|
26
|
+
constructor(options: DownloadManagerOptions);
|
|
27
|
+
/**
|
|
28
|
+
* Start downloading a region with progress tracking
|
|
29
|
+
*/
|
|
30
|
+
downloadRegion(formData: RegionFormData): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Get current downloads
|
|
33
|
+
*/
|
|
34
|
+
getCurrentDownloads(): Map<string, DownloadProgress>;
|
|
35
|
+
/**
|
|
36
|
+
* Check if any downloads are in progress
|
|
37
|
+
*/
|
|
38
|
+
hasActiveDownloads(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Cancel a specific download
|
|
41
|
+
*/
|
|
42
|
+
cancelDownload(regionId: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Cancel all downloads
|
|
45
|
+
*/
|
|
46
|
+
cancelAllDownloads(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Update UI for download start
|
|
49
|
+
*/
|
|
50
|
+
private updateUIForDownloadStart;
|
|
51
|
+
/**
|
|
52
|
+
* Handle successful download completion
|
|
53
|
+
*/
|
|
54
|
+
private handleDownloadComplete;
|
|
55
|
+
/**
|
|
56
|
+
* Handle download error
|
|
57
|
+
*/
|
|
58
|
+
private handleDownloadError;
|
|
59
|
+
/**
|
|
60
|
+
* Reset UI to initial state
|
|
61
|
+
*/
|
|
62
|
+
private resetUI;
|
|
63
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Confirmation Modal Component
|
|
3
|
+
* Handles confirmation dialogs with customizable actions
|
|
4
|
+
* Refactored to use modular components
|
|
5
|
+
*/
|
|
6
|
+
export interface ConfirmationModalOptions {
|
|
7
|
+
title: string;
|
|
8
|
+
message: string;
|
|
9
|
+
confirmText: string;
|
|
10
|
+
cancelText: string;
|
|
11
|
+
onConfirm: () => void;
|
|
12
|
+
onCancel: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare class ConfirmationModal {
|
|
15
|
+
private options;
|
|
16
|
+
private modal?;
|
|
17
|
+
constructor(options: ConfirmationModalOptions);
|
|
18
|
+
/**
|
|
19
|
+
* Show confirmation modal and return modal element
|
|
20
|
+
*/
|
|
21
|
+
show(): HTMLDivElement;
|
|
22
|
+
/**
|
|
23
|
+
* Hide the modal
|
|
24
|
+
*/
|
|
25
|
+
hide(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Destroy the modal
|
|
28
|
+
*/
|
|
29
|
+
destroy(): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import/Export Modal Component
|
|
3
|
+
* Handles import/export operations for regions
|
|
4
|
+
* Refactored to use modular Modal component for consistency
|
|
5
|
+
*/
|
|
6
|
+
import type { StoredRegion, ImportExportOptions, ExportResult, ImportResult, RegionImportData } from '../../types';
|
|
7
|
+
export interface ImportExportModalOptions {
|
|
8
|
+
region: StoredRegion;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
onExport?: (result: ExportResult) => void;
|
|
11
|
+
onImport?: (result: ImportResult) => void;
|
|
12
|
+
exportRegion?: (regionId: string, format: 'json' | 'pmtiles' | 'mbtiles', options?: ImportExportOptions) => Promise<ExportResult>;
|
|
13
|
+
importRegion?: (data: RegionImportData) => Promise<ImportResult>;
|
|
14
|
+
}
|
|
15
|
+
export declare class ImportExportModal {
|
|
16
|
+
private modal?;
|
|
17
|
+
private options;
|
|
18
|
+
private isExporting;
|
|
19
|
+
private isImporting;
|
|
20
|
+
private exportFormatSelect?;
|
|
21
|
+
private includeStyleCheckbox?;
|
|
22
|
+
private includeTilesCheckbox?;
|
|
23
|
+
private includeSpritesCheckbox?;
|
|
24
|
+
private includeFontsCheckbox?;
|
|
25
|
+
private exportProgressBar?;
|
|
26
|
+
private exportProgressText?;
|
|
27
|
+
private exportButton?;
|
|
28
|
+
private importFileInput?;
|
|
29
|
+
private importNameInput?;
|
|
30
|
+
private importOverwriteCheckbox?;
|
|
31
|
+
private importProgressBar?;
|
|
32
|
+
private importProgressText?;
|
|
33
|
+
private importButton?;
|
|
34
|
+
constructor(options: ImportExportModalOptions);
|
|
35
|
+
show(): HTMLDivElement;
|
|
36
|
+
hide(): void;
|
|
37
|
+
private createContent;
|
|
38
|
+
private createRegionInfoCard;
|
|
39
|
+
private createExportSection;
|
|
40
|
+
private createImportSection;
|
|
41
|
+
private createFormatGuide;
|
|
42
|
+
private attachEventListeners;
|
|
43
|
+
private handleExport;
|
|
44
|
+
private handleImport;
|
|
45
|
+
destroy(): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import/Export Modal Component
|
|
3
|
+
* Handles import/export operations for regions
|
|
4
|
+
*/
|
|
5
|
+
import type { StoredRegion, ImportExportOptions, ExportResult, ImportResult, RegionImportData } from '../../types';
|
|
6
|
+
export interface ImportExportModalOptions {
|
|
7
|
+
region: StoredRegion;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
onExport?: (result: ExportResult) => void;
|
|
10
|
+
onImport?: (result: ImportResult) => void;
|
|
11
|
+
exportRegion?: (regionId: string, format: 'json' | 'pmtiles' | 'mbtiles', options?: ImportExportOptions) => Promise<ExportResult>;
|
|
12
|
+
importRegion?: (data: RegionImportData) => Promise<ImportResult>;
|
|
13
|
+
}
|
|
14
|
+
export declare class ImportExportModal {
|
|
15
|
+
private modal;
|
|
16
|
+
private options;
|
|
17
|
+
private isExporting;
|
|
18
|
+
private isImporting;
|
|
19
|
+
constructor(options: ImportExportModalOptions);
|
|
20
|
+
show(): HTMLDivElement;
|
|
21
|
+
hide(): void;
|
|
22
|
+
private createModal;
|
|
23
|
+
private attachEventListeners;
|
|
24
|
+
private updateExportOptions;
|
|
25
|
+
private handleExport;
|
|
26
|
+
private handleImport;
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal Manager Component
|
|
3
|
+
* Centralized management of modal dialogs
|
|
4
|
+
*/
|
|
5
|
+
export declare class ModalManager {
|
|
6
|
+
private activeModal;
|
|
7
|
+
/**
|
|
8
|
+
* Show a modal
|
|
9
|
+
*/
|
|
10
|
+
show(modal: HTMLDivElement): void;
|
|
11
|
+
/**
|
|
12
|
+
* Close the current modal
|
|
13
|
+
*/
|
|
14
|
+
close(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Check if a modal is currently open
|
|
17
|
+
*/
|
|
18
|
+
isOpen(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Get the current active modal
|
|
21
|
+
*/
|
|
22
|
+
getActiveModal(): HTMLDivElement | undefined;
|
|
23
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Region Details Modal Component
|
|
3
|
+
* Shows detailed information about a specific region
|
|
4
|
+
* Refactored to use modular components
|
|
5
|
+
*/
|
|
6
|
+
import { StoredRegion } from '../../types/region';
|
|
7
|
+
export interface RegionDetailsOptions {
|
|
8
|
+
region: StoredRegion;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
onFocus: (regionId: string) => void;
|
|
11
|
+
onThemeToggle?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare class RegionDetailsModal {
|
|
14
|
+
private options;
|
|
15
|
+
private modal?;
|
|
16
|
+
constructor(options: RegionDetailsOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Show the region details modal
|
|
19
|
+
*/
|
|
20
|
+
show(): HTMLDivElement;
|
|
21
|
+
/**
|
|
22
|
+
* Create the modal content
|
|
23
|
+
*/
|
|
24
|
+
private createContent;
|
|
25
|
+
/**
|
|
26
|
+
* Create the footer with action buttons
|
|
27
|
+
*/
|
|
28
|
+
private createFooter;
|
|
29
|
+
/**
|
|
30
|
+
* Focus on the region in the map
|
|
31
|
+
*/
|
|
32
|
+
focusRegion(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Close the modal
|
|
35
|
+
*/
|
|
36
|
+
close(): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Region Form Modal Component
|
|
3
|
+
* Handles the form for creating new offline regions
|
|
4
|
+
* Refactored to use modular components
|
|
5
|
+
*/
|
|
6
|
+
export interface RegionFormData {
|
|
7
|
+
name: string;
|
|
8
|
+
minZoom: number;
|
|
9
|
+
maxZoom: number;
|
|
10
|
+
styleUrl: string;
|
|
11
|
+
bounds: [number, number, number, number];
|
|
12
|
+
provider?: 'mapbox' | 'maplibre' | 'auto';
|
|
13
|
+
accessToken?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface RegionFormOptions {
|
|
16
|
+
bounds: [number, number, number, number];
|
|
17
|
+
area: number;
|
|
18
|
+
onSave: (formData: RegionFormData) => Promise<void>;
|
|
19
|
+
onCancel: () => void;
|
|
20
|
+
onThemeToggle?: () => void;
|
|
21
|
+
styleUrl: string;
|
|
22
|
+
}
|
|
23
|
+
export declare class RegionFormModal {
|
|
24
|
+
private options;
|
|
25
|
+
private modal?;
|
|
26
|
+
private nameInput?;
|
|
27
|
+
private minZoomInput?;
|
|
28
|
+
private maxZoomInput?;
|
|
29
|
+
private styleUrlInput?;
|
|
30
|
+
private providerSelect?;
|
|
31
|
+
private accessTokenInput?;
|
|
32
|
+
private accessTokenGroup?;
|
|
33
|
+
constructor(options: RegionFormOptions);
|
|
34
|
+
/**
|
|
35
|
+
* Show the region form modal
|
|
36
|
+
*/
|
|
37
|
+
show(): HTMLDivElement;
|
|
38
|
+
/**
|
|
39
|
+
* Create the form content
|
|
40
|
+
*/
|
|
41
|
+
private createForm;
|
|
42
|
+
/**
|
|
43
|
+
* Handle style URL changes to auto-detect provider
|
|
44
|
+
*/
|
|
45
|
+
private handleStyleUrlChange;
|
|
46
|
+
/**
|
|
47
|
+
* Handle provider selection changes
|
|
48
|
+
*/
|
|
49
|
+
private handleProviderChange;
|
|
50
|
+
/**
|
|
51
|
+
* Auto-detect provider from style URL
|
|
52
|
+
*/
|
|
53
|
+
private detectProviderFromUrl;
|
|
54
|
+
/**
|
|
55
|
+
* Toggle access token input visibility
|
|
56
|
+
*/
|
|
57
|
+
private toggleAccessTokenVisibility;
|
|
58
|
+
/**
|
|
59
|
+
* Create the footer with action buttons
|
|
60
|
+
*/
|
|
61
|
+
private createFooter;
|
|
62
|
+
/**
|
|
63
|
+
* Handle form save
|
|
64
|
+
*/
|
|
65
|
+
private handleSave;
|
|
66
|
+
/**
|
|
67
|
+
* Hide the modal
|
|
68
|
+
*/
|
|
69
|
+
hide(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Destroy the modal
|
|
72
|
+
*/
|
|
73
|
+
destroy(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Handle form cancel - kept for backward compatibility
|
|
76
|
+
*/
|
|
77
|
+
cancel(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Handle form save - kept for backward compatibility
|
|
80
|
+
*/
|
|
81
|
+
save(): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Close the modal - kept for backward compatibility
|
|
84
|
+
*/
|
|
85
|
+
close(): void;
|
|
86
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { IControl, Map as MaplibreMap } from 'maplibre-gl';
|
|
2
|
+
import { OfflineMapManager } from '../managers/offlineMapManager';
|
|
3
|
+
export interface OfflineManagerControlOptions {
|
|
4
|
+
styleUrl: string;
|
|
5
|
+
theme?: 'light' | 'dark';
|
|
6
|
+
showBbox?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class OfflineManagerControl implements IControl {
|
|
9
|
+
private map;
|
|
10
|
+
private panel;
|
|
11
|
+
private isOpen;
|
|
12
|
+
private offlineManager;
|
|
13
|
+
private options;
|
|
14
|
+
private buttonManager;
|
|
15
|
+
private panelRenderer;
|
|
16
|
+
private regionControl;
|
|
17
|
+
private downloadManager;
|
|
18
|
+
private modalManager;
|
|
19
|
+
private bboxLayerAdded;
|
|
20
|
+
private originalFetch;
|
|
21
|
+
constructor(offlineManager: OfflineMapManager, options?: OfflineManagerControlOptions);
|
|
22
|
+
/**
|
|
23
|
+
* Setup fetch interceptor to handle idb:// URLs
|
|
24
|
+
*/
|
|
25
|
+
private setupFetchInterceptor;
|
|
26
|
+
onAdd(map: MaplibreMap): HTMLElement;
|
|
27
|
+
onRemove(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Create panel element
|
|
30
|
+
*/
|
|
31
|
+
private createPanel;
|
|
32
|
+
/**
|
|
33
|
+
* Toggle panel visibility
|
|
34
|
+
*/
|
|
35
|
+
private togglePanel;
|
|
36
|
+
/**
|
|
37
|
+
* Close panel
|
|
38
|
+
*/
|
|
39
|
+
private closePanel;
|
|
40
|
+
/**
|
|
41
|
+
* Render panel content
|
|
42
|
+
*/
|
|
43
|
+
private renderPanel;
|
|
44
|
+
/**
|
|
45
|
+
* Start region selection mode
|
|
46
|
+
*/
|
|
47
|
+
private startRegionSelection;
|
|
48
|
+
/**
|
|
49
|
+
* Handle region saved event
|
|
50
|
+
*/
|
|
51
|
+
private handleRegionSaved;
|
|
52
|
+
/**
|
|
53
|
+
* Handle progress updates from download manager
|
|
54
|
+
*/
|
|
55
|
+
private handleProgressUpdate;
|
|
56
|
+
/**
|
|
57
|
+
* Handle download completion
|
|
58
|
+
*/
|
|
59
|
+
private handleDownloadComplete;
|
|
60
|
+
/**
|
|
61
|
+
* Handle download error
|
|
62
|
+
*/
|
|
63
|
+
private handleDownloadError;
|
|
64
|
+
/**
|
|
65
|
+
* Update button state
|
|
66
|
+
*/
|
|
67
|
+
private updateButton;
|
|
68
|
+
/**
|
|
69
|
+
* Update progress badge
|
|
70
|
+
*/
|
|
71
|
+
private updateProgressBadge;
|
|
72
|
+
/**
|
|
73
|
+
* Handle panel click events
|
|
74
|
+
*/
|
|
75
|
+
private handlePanelClick;
|
|
76
|
+
/**
|
|
77
|
+
* Focus on a specific region on the map
|
|
78
|
+
*/
|
|
79
|
+
private focusRegion;
|
|
80
|
+
/**
|
|
81
|
+
* Show bounding box for a region on the map
|
|
82
|
+
*/
|
|
83
|
+
private showRegionBoundingBox;
|
|
84
|
+
/**
|
|
85
|
+
* Initialize bounding box layer on the map
|
|
86
|
+
*/
|
|
87
|
+
private initializeBboxLayer;
|
|
88
|
+
/**
|
|
89
|
+
* Remove bounding box from the map
|
|
90
|
+
*/
|
|
91
|
+
private removeRegionBoundingBox;
|
|
92
|
+
/**
|
|
93
|
+
* Load offline style for a specific style ID
|
|
94
|
+
*/
|
|
95
|
+
loadOfflineStyle(styleId: string): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Load styles from IndexedDB and apply to map
|
|
98
|
+
*/
|
|
99
|
+
private loadStylesFromIDB;
|
|
100
|
+
/**
|
|
101
|
+
* Show modal to select which style to load
|
|
102
|
+
*/
|
|
103
|
+
private showStyleSelectionModal;
|
|
104
|
+
/**
|
|
105
|
+
* Public method to load offline styles - can be called from outside
|
|
106
|
+
*/
|
|
107
|
+
loadOfflineStyles(): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Public method to load a specific offline style by ID
|
|
110
|
+
*/
|
|
111
|
+
loadSpecificOfflineStyle(styleId: string): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Update the current style URL for the offline manager
|
|
114
|
+
*/
|
|
115
|
+
updateStyleUrl(newStyleUrl: string): void;
|
|
116
|
+
/**
|
|
117
|
+
* Get the current style URL
|
|
118
|
+
*/
|
|
119
|
+
getCurrentStyleUrl(): string;
|
|
120
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delays execution for specified milliseconds
|
|
3
|
+
*/
|
|
4
|
+
export declare function delay(ms: number): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Retry a function with exponential backoff
|
|
7
|
+
*/
|
|
8
|
+
export declare function retryWithBackoff<T>(fn: () => Promise<T>, maxRetries?: number, baseDelay?: number): Promise<T>;
|
|
9
|
+
/**
|
|
10
|
+
* Throttle function calls
|
|
11
|
+
*/
|
|
12
|
+
export declare function throttle<T extends (...args: unknown[]) => unknown>(func: T, delay: number): (...args: Parameters<T>) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Debounce function calls
|
|
15
|
+
*/
|
|
16
|
+
export declare function debounce<T extends (...args: unknown[]) => unknown>(func: T, delay: number): (...args: Parameters<T>) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Create a promise that resolves after a timeout
|
|
19
|
+
*/
|
|
20
|
+
export declare function timeout<T>(promise: Promise<T>, ms: number): Promise<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Batch process items with concurrency control
|
|
23
|
+
*/
|
|
24
|
+
export declare function batchProcess<T, R>(items: T[], processor: (item: T) => Promise<R>, batchSize?: number): Promise<R[]>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface CompressedTileStats {
|
|
2
|
+
total: number;
|
|
3
|
+
gzipped: number;
|
|
4
|
+
uncompressed: number;
|
|
5
|
+
}
|
|
6
|
+
export interface CompressedTileCleanupResult {
|
|
7
|
+
checked: number;
|
|
8
|
+
removed: number;
|
|
9
|
+
errors: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function countCompressedTiles(): Promise<CompressedTileStats>;
|
|
12
|
+
export declare function cleanupCompressedTiles(): Promise<CompressedTileCleanupResult>;
|