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.
Files changed (88) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +590 -0
  3. package/dist/index.d.ts +17 -0
  4. package/dist/index.esm.js +15863 -0
  5. package/dist/index.esm.js.map +1 -0
  6. package/dist/index.js +16015 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/main.d.ts +2 -0
  9. package/dist/managers/offlineMapManager/analyticsManagement.d.ts +7 -0
  10. package/dist/managers/offlineMapManager/base.d.ts +14 -0
  11. package/dist/managers/offlineMapManager/cleanupManagement.d.ts +16 -0
  12. package/dist/managers/offlineMapManager/importExportManagement.d.ts +10 -0
  13. package/dist/managers/offlineMapManager/index.d.ts +72 -0
  14. package/dist/managers/offlineMapManager/maintenanceManagement.d.ts +13 -0
  15. package/dist/managers/offlineMapManager/modules.d.ts +10 -0
  16. package/dist/managers/offlineMapManager/regionManagement.d.ts +11 -0
  17. package/dist/managers/offlineMapManager/resourceManagement.d.ts +24 -0
  18. package/dist/managers/offlineMapManager/styleManagement.d.ts +17 -0
  19. package/dist/managers/offlineMapManager.d.ts +2 -0
  20. package/dist/services/analyticsService.d.ts +10 -0
  21. package/dist/services/baseDownloadService.d.ts +96 -0
  22. package/dist/services/cleanupService.d.ts +34 -0
  23. package/dist/services/fontService.d.ts +26 -0
  24. package/dist/services/glyphService.d.ts +58 -0
  25. package/dist/services/importExportService.d.ts +57 -0
  26. package/dist/services/maintenanceService.d.ts +15 -0
  27. package/dist/services/regionService.d.ts +31 -0
  28. package/dist/services/resourceService.d.ts +42 -0
  29. package/dist/services/spriteService.d.ts +30 -0
  30. package/dist/services/styleService.d.ts +73 -0
  31. package/dist/services/tileService.d.ts +24 -0
  32. package/dist/storage/indexedDbManager.d.ts +2 -0
  33. package/dist/style.css +213 -0
  34. package/dist/types/cleanup.d.ts +49 -0
  35. package/dist/types/database.d.ts +33 -0
  36. package/dist/types/font.d.ts +115 -0
  37. package/dist/types/glyph.d.ts +127 -0
  38. package/dist/types/import-export.d.ts +96 -0
  39. package/dist/types/index.d.ts +12 -0
  40. package/dist/types/maintenance.d.ts +49 -0
  41. package/dist/types/progress.d.ts +11 -0
  42. package/dist/types/region.d.ts +57 -0
  43. package/dist/types/sprite.d.ts +172 -0
  44. package/dist/types/style.d.ts +103 -0
  45. package/dist/types/tile.d.ts +112 -0
  46. package/dist/types/ui.d.ts +10 -0
  47. package/dist/ui/ThemeManager.d.ts +23 -0
  48. package/dist/ui/components/DownloadProgress.d.ts +14 -0
  49. package/dist/ui/components/PanelActions.d.ts +12 -0
  50. package/dist/ui/components/PanelHeader.d.ts +15 -0
  51. package/dist/ui/components/RegionList.d.ts +24 -0
  52. package/dist/ui/components/shared/BaseComponent.d.ts +86 -0
  53. package/dist/ui/components/shared/Button.d.ts +45 -0
  54. package/dist/ui/components/shared/List.d.ts +56 -0
  55. package/dist/ui/components/shared/MapControlButton.d.ts +37 -0
  56. package/dist/ui/components/shared/Modal.d.ts +49 -0
  57. package/dist/ui/components/shared/Panel.d.ts +53 -0
  58. package/dist/ui/components/shared/PanelContent.d.ts +39 -0
  59. package/dist/ui/components/shared/RegionDrawingTool.d.ts +54 -0
  60. package/dist/ui/components/shared/index.d.ts +12 -0
  61. package/dist/ui/controls/polygonControl.d.ts +83 -0
  62. package/dist/ui/controls/regionControl.d.ts +71 -0
  63. package/dist/ui/managers/ControlButtonManager.d.ts +42 -0
  64. package/dist/ui/managers/PanelManager.d.ts +160 -0
  65. package/dist/ui/managers/downloadManager.d.ts +63 -0
  66. package/dist/ui/modals/confirmationModal.d.ts +30 -0
  67. package/dist/ui/modals/importExportModal.d.ts +46 -0
  68. package/dist/ui/modals/importExportModal.old.d.ts +27 -0
  69. package/dist/ui/modals/modalManager.d.ts +23 -0
  70. package/dist/ui/modals/regionDetailsModal.d.ts +37 -0
  71. package/dist/ui/modals/regionFormModal.d.ts +86 -0
  72. package/dist/ui/offlineManagerControl.d.ts +120 -0
  73. package/dist/utils/asyncUtils.d.ts +24 -0
  74. package/dist/utils/cleanupCompressedTiles.d.ts +12 -0
  75. package/dist/utils/constants.d.ts +94 -0
  76. package/dist/utils/download.d.ts +52 -0
  77. package/dist/utils/errorHandling.d.ts +67 -0
  78. package/dist/utils/formatUtils.d.ts +24 -0
  79. package/dist/utils/formatting.d.ts +31 -0
  80. package/dist/utils/icons.d.ts +50 -0
  81. package/dist/utils/idbFetchHandler.d.ts +2 -0
  82. package/dist/utils/index.d.ts +13 -0
  83. package/dist/utils/logger.d.ts +52 -0
  84. package/dist/utils/performance.d.ts +164 -0
  85. package/dist/utils/styleProviderUtils.d.ts +42 -0
  86. package/dist/utils/styleUtils.d.ts +35 -0
  87. package/dist/utils/validation.d.ts +67 -0
  88. package/package.json +145 -0
@@ -0,0 +1,96 @@
1
+ export interface RegionExportData {
2
+ metadata: {
3
+ id: string;
4
+ name: string;
5
+ description?: string;
6
+ bounds: [[number, number], [number, number]];
7
+ minZoom: number;
8
+ maxZoom: number;
9
+ styleUrl: string;
10
+ createdAt: number;
11
+ exportedAt: number;
12
+ version: string;
13
+ format: 'json' | 'pmtiles' | 'mbtiles';
14
+ };
15
+ style: unknown;
16
+ tiles: TileExportData[];
17
+ sprites: SpriteExportData[];
18
+ fonts: FontExportData[];
19
+ }
20
+ export interface TileExportData {
21
+ z: number;
22
+ x: number;
23
+ y: number;
24
+ data: ArrayBuffer;
25
+ format: 'pbf' | 'png' | 'jpg' | 'webp';
26
+ sourceId: string;
27
+ }
28
+ export interface SpriteExportData {
29
+ url: string;
30
+ data: ArrayBuffer;
31
+ type: 'json' | 'png';
32
+ resolution: '1x' | '2x';
33
+ }
34
+ export interface FontExportData {
35
+ fontStack: string;
36
+ range: string;
37
+ data: ArrayBuffer;
38
+ }
39
+ export interface PMTilesExportOptions {
40
+ compression?: 'gzip' | 'brotli' | 'none';
41
+ clustered?: boolean;
42
+ metadata?: Record<string, unknown>;
43
+ }
44
+ export interface MBTilesExportOptions {
45
+ format?: 'pbf' | 'png' | 'jpg';
46
+ compression?: 'gzip' | 'none';
47
+ metadata?: Record<string, unknown>;
48
+ }
49
+ export interface ImportExportOptions {
50
+ includeStyle?: boolean;
51
+ includeTiles?: boolean;
52
+ includeSprites?: boolean;
53
+ includeFonts?: boolean;
54
+ format?: 'json' | 'pmtiles' | 'mbtiles';
55
+ compression?: boolean;
56
+ onProgress?: (progress: ImportExportProgress) => void;
57
+ }
58
+ export interface ImportExportProgress {
59
+ stage: 'preparing' | 'exporting' | 'importing' | 'processing' | 'complete';
60
+ percentage: number;
61
+ message: string;
62
+ currentItem?: string;
63
+ totalItems?: number;
64
+ completedItems?: number;
65
+ }
66
+ export interface RegionImportData {
67
+ file: File;
68
+ format: 'json' | 'pmtiles' | 'mbtiles';
69
+ overwrite?: boolean;
70
+ newRegionId?: string;
71
+ newRegionName?: string;
72
+ }
73
+ export interface ImportResult {
74
+ success: boolean;
75
+ regionId: string;
76
+ message: string;
77
+ warnings?: string[];
78
+ statistics: {
79
+ tilesImported: number;
80
+ spritesImported: number;
81
+ fontsImported: number;
82
+ totalSize: number;
83
+ };
84
+ }
85
+ export interface ExportResult {
86
+ success: boolean;
87
+ format: 'json' | 'pmtiles' | 'mbtiles';
88
+ filename: string;
89
+ blob: Blob;
90
+ size: number;
91
+ statistics: {
92
+ tilesExported: number;
93
+ spritesExported: number;
94
+ fontsExported: number;
95
+ };
96
+ }
@@ -0,0 +1,12 @@
1
+ export * from './region';
2
+ export * from './style';
3
+ export * from './font';
4
+ export * from './tile';
5
+ export * from './sprite';
6
+ export * from './glyph';
7
+ export * from './database';
8
+ export * from './maintenance';
9
+ export * from './progress';
10
+ export * from './cleanup';
11
+ export * from './ui';
12
+ export * from './import-export';
@@ -0,0 +1,49 @@
1
+ import { EnhancedGlyphStats } from '../services/glyphService';
2
+ import { TileStats } from './tile';
3
+ import { EnhancedFontStats } from './font';
4
+ import { EnhancedSpriteStats } from './sprite';
5
+ import { CleanupResult, RegionAnalytics } from './cleanup';
6
+ export interface MaintenanceOptions {
7
+ cleanupExpired?: boolean;
8
+ verifyIntegrity?: boolean;
9
+ optimizeStorage?: boolean;
10
+ generateReport?: boolean;
11
+ onProgress?: (stage: string, progress: number) => void;
12
+ }
13
+ export interface StorageAnalyticsReport {
14
+ tiles: TileStats;
15
+ fonts: EnhancedFontStats;
16
+ sprites: EnhancedSpriteStats;
17
+ glyphs: EnhancedGlyphStats;
18
+ regions: RegionAnalytics;
19
+ totalStorageSize: number;
20
+ storageByType: Record<string, number>;
21
+ recommendations: string[];
22
+ }
23
+ export interface MaintenanceResults {
24
+ cleanupResults?: CleanupResult;
25
+ integrityResults?: {
26
+ tiles: {
27
+ errors: number;
28
+ fixed: number;
29
+ };
30
+ fonts: {
31
+ corrupted: number;
32
+ repaired: number;
33
+ };
34
+ sprites: {
35
+ corrupted: number;
36
+ repaired: number;
37
+ };
38
+ glyphs: {
39
+ corrupted: number;
40
+ repaired: number;
41
+ };
42
+ };
43
+ optimizationResults?: {
44
+ freedSpace: number;
45
+ optimizedResources: number;
46
+ };
47
+ analyticsReport?: StorageAnalyticsReport;
48
+ totalTimeMs: number;
49
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Download progress tracking interface
3
+ */
4
+ export interface DownloadProgress {
5
+ completed: number;
6
+ total: number;
7
+ percentage: number;
8
+ currentItem?: string;
9
+ message?: string;
10
+ errors: string[];
11
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Stored region with metadata
3
+ * Extends OfflineRegionOptions with database-specific fields
4
+ */
5
+ export interface StoredRegion extends OfflineRegionOptions {
6
+ /** Database key for the region */
7
+ key: string;
8
+ /** Associated style ID */
9
+ styleId: string;
10
+ /** Creation timestamp (ms since epoch) */
11
+ created: number;
12
+ /** Expiry timestamp (ms since epoch) */
13
+ expiry: number;
14
+ /** Last modification timestamp (ms since epoch) */
15
+ lastModified: number;
16
+ /** Actual tile extension used (mvt, pbf, png, jpg, etc.) */
17
+ tileExtension?: string;
18
+ }
19
+ /**
20
+ * Configuration options for an offline region
21
+ */
22
+ export interface OfflineRegionOptions {
23
+ /**
24
+ * Region ID (unique for each region, used as the key in the regions table)
25
+ */
26
+ id: string;
27
+ /** Human-readable region name */
28
+ name: string;
29
+ /** Geographic bounds: [[west, south], [east, north]] */
30
+ bounds: [[number, number], [number, number]];
31
+ /** Whether this region is part of a multi-region download */
32
+ multipleRegions?: boolean;
33
+ /** URL to the map style JSON */
34
+ styleUrl?: string;
35
+ /** Minimum zoom level to download */
36
+ minZoom: number;
37
+ /** Maximum zoom level to download */
38
+ maxZoom: number;
39
+ /** Associated style ID */
40
+ styleId?: string;
41
+ /** Download session ID */
42
+ downloadId?: string;
43
+ /** Creation timestamp (ms since epoch) */
44
+ created?: number;
45
+ /** Last update timestamp (ms since epoch) */
46
+ updated?: number;
47
+ /**
48
+ * Expiry timestamp (ms since epoch)
49
+ */
50
+ expiry?: number;
51
+ /**
52
+ * Whether to automatically delete this region when it expires (default: false)
53
+ */
54
+ deleteOnExpiry?: boolean;
55
+ /** The actual tile extension used (mvt, pbf, png, jpg, etc.) */
56
+ tileExtension?: string;
57
+ }
@@ -0,0 +1,172 @@
1
+ import { DownloadProgress } from './progress';
2
+ /**
3
+ * Sprite entry stored in IndexedDB
4
+ */
5
+ export interface SpriteEntry {
6
+ /** Unique identifier for the sprite (e.g., "style-name@2x.json") */
7
+ key: string;
8
+ /** Raw sprite data (image or JSON) in ArrayBuffer format */
9
+ data: ArrayBuffer;
10
+ /** MIME type from HTTP Content-Type header */
11
+ contentType?: string;
12
+ /** Last-Modified timestamp from HTTP headers (milliseconds since epoch) */
13
+ lastModified: number;
14
+ /** ISO 8601 timestamp when sprite was downloaded */
15
+ downloadedAt: string;
16
+ /** Sprite file size in bytes */
17
+ size: number;
18
+ /** Final URL used for download */
19
+ url: string;
20
+ /** Optional identifier linking sprite to a style */
21
+ styleId?: string;
22
+ /** Optional identifier linking this sprite to a specific download batch */
23
+ downloadId?: string;
24
+ /** Human-readable sprite name */
25
+ spriteName?: string;
26
+ /** Additional metadata about the sprite */
27
+ metadata?: {
28
+ /** Sprite resolution variant (e.g., "1x", "2x") */
29
+ variant?: '1x' | '2x' | string;
30
+ /** Original URL before any transformations */
31
+ originalUrl?: string;
32
+ };
33
+ }
34
+ /**
35
+ * Configuration options for sprite downloads
36
+ */
37
+ export interface SpriteDownloadOptions {
38
+ /** Callback for progress updates */
39
+ onProgress?: (progress: DownloadProgress) => void;
40
+ /** Number of sprites to download concurrently (default: 10) */
41
+ batchSize?: number;
42
+ /** Maximum retry attempts for failed downloads (default: 3) */
43
+ maxRetries?: number;
44
+ /** Skip sprites that already exist in storage (default: true) */
45
+ skipExisting?: boolean;
46
+ /** Download speed limit in bytes per second */
47
+ bandwidthLimit?: number;
48
+ /** Array of sprite keys to download first */
49
+ prioritySprites?: string[];
50
+ /** Check storage quota before starting download (default: true) */
51
+ storageQuotaCheck?: boolean;
52
+ /** Validate sprite data after download (default: true) */
53
+ enableValidation?: boolean;
54
+ /** Request timeout in milliseconds (default: 30000) */
55
+ timeoutMs?: number;
56
+ /** Include additional metadata in stored sprites (default: false) */
57
+ includeMetadata?: boolean;
58
+ }
59
+ /**
60
+ * Result of a sprite download operation
61
+ */
62
+ export interface SpriteDownloadResult {
63
+ /** Total number of sprites in download plan */
64
+ totalSprites: number;
65
+ /** Number of sprites successfully downloaded */
66
+ downloadedSprites: number;
67
+ /** Number of sprites skipped (already existed) */
68
+ skippedSprites: number;
69
+ /** Number of sprites that failed to download */
70
+ failedSprites: number;
71
+ /** Total size of all downloaded sprites in bytes */
72
+ totalSize: number;
73
+ /** Average download speed in bytes per second */
74
+ downloadSpeed: number;
75
+ /** Total download time in milliseconds */
76
+ duration: number;
77
+ /** Array of error details for failed downloads */
78
+ errors: Array<{
79
+ url: string;
80
+ error: string;
81
+ }>;
82
+ /** Detailed analytics about downloaded sprites */
83
+ analytics: {
84
+ /** Distribution by file type (e.g., {"png": 20, "json": 4}) */
85
+ spritesByType: Record<string, number>;
86
+ /** Average sprite size in bytes */
87
+ averageSpriteSize: number;
88
+ /** Largest sprite details */
89
+ largestSprite: {
90
+ name: string;
91
+ size: number;
92
+ };
93
+ /** Smallest sprite details */
94
+ smallestSprite: {
95
+ name: string;
96
+ size: number;
97
+ };
98
+ };
99
+ }
100
+ /**
101
+ * Enhanced statistics about stored sprites
102
+ */
103
+ export interface EnhancedSpriteStats {
104
+ /** Total number of stored sprites */
105
+ count: number;
106
+ /** Total storage size in bytes */
107
+ totalSize: number;
108
+ /** Average sprite size in bytes */
109
+ averageSize: number;
110
+ /** Array of sprite details */
111
+ sprites: Array<{
112
+ /** Sprite name */
113
+ name: string;
114
+ /** Sprite size in bytes */
115
+ size: number;
116
+ /** File type */
117
+ type: string;
118
+ /** Last modification timestamp */
119
+ lastModified?: number;
120
+ /** Additional metadata */
121
+ metadata?: Record<string, unknown>;
122
+ }>;
123
+ /** Distribution by file type */
124
+ spritesByType: Record<string, number>;
125
+ /** Total size by file type */
126
+ sizeByType: Record<string, number>;
127
+ /** Oldest sprite in storage */
128
+ oldestSprite?: {
129
+ name: string;
130
+ lastModified: number;
131
+ };
132
+ /** Newest sprite in storage */
133
+ newestSprite?: {
134
+ name: string;
135
+ lastModified: number;
136
+ };
137
+ /** Array of sprite keys that failed validation */
138
+ corruptedSprites: string[];
139
+ }
140
+ /**
141
+ * Local sprite entry with additional metadata
142
+ */
143
+ export interface LocalSpriteEntry {
144
+ /** Unique identifier for the sprite */
145
+ key: string;
146
+ /** Human-readable sprite name */
147
+ name: string;
148
+ /** Source URL */
149
+ url: string;
150
+ /** Raw sprite data in ArrayBuffer format */
151
+ data: ArrayBuffer;
152
+ /** MIME type */
153
+ contentType: string;
154
+ /** Sprite file size in bytes */
155
+ size: number;
156
+ /** Last modification timestamp (milliseconds since epoch) */
157
+ lastModified: number;
158
+ /** Extended metadata */
159
+ metadata?: {
160
+ /** Image dimensions if applicable */
161
+ dimensions?: {
162
+ width: number;
163
+ height: number;
164
+ };
165
+ /** Image format (e.g., "PNG", "JPEG") */
166
+ format?: string;
167
+ /** Compression ratio if compressed */
168
+ compressionRatio?: number;
169
+ /** Whether this is a spritesheet */
170
+ spritesheet?: boolean;
171
+ };
172
+ }
@@ -0,0 +1,103 @@
1
+ import { FontDownloadOptions, FontDownloadResult } from './font';
2
+ import { DownloadProgress } from './progress';
3
+ import { SpriteDownloadOptions, SpriteDownloadResult } from './sprite';
4
+ export type StyleProvider = 'mapbox' | 'maplibre' | 'auto';
5
+ export interface BaseStyle {
6
+ version: number;
7
+ name?: string;
8
+ metadata?: Record<string, unknown>;
9
+ sources: Record<string, unknown>;
10
+ layers: unknown[];
11
+ sprite?: string;
12
+ glyphs?: string;
13
+ [key: string]: unknown;
14
+ }
15
+ export interface MapboxGLStyle extends BaseStyle {
16
+ owner?: string;
17
+ id?: string;
18
+ crs?: string;
19
+ draft?: boolean;
20
+ created?: string;
21
+ modified?: string;
22
+ visibility?: 'public' | 'private';
23
+ }
24
+ export interface MapboxStyle extends BaseStyle {
25
+ provider?: 'mapbox';
26
+ }
27
+ export type StyleEntry = {
28
+ key: string;
29
+ style: BaseStyle;
30
+ provider: StyleProvider;
31
+ regions: import('./region').OfflineRegionOptions[];
32
+ fonts: string[];
33
+ glyphs: string[];
34
+ sprites: string[];
35
+ accessToken?: string;
36
+ originalUrl?: string;
37
+ };
38
+ export interface StyleDownloadOptions {
39
+ onProgress?: (progress: DownloadProgress) => void;
40
+ fontOptions?: FontDownloadOptions;
41
+ spriteOptions?: SpriteDownloadOptions;
42
+ skipExisting?: boolean;
43
+ validateStyle?: boolean;
44
+ maxRetries?: number;
45
+ timeoutMs?: number;
46
+ enableSourceEmbedding?: boolean;
47
+ storageQuotaCheck?: boolean;
48
+ includeMetadata?: boolean;
49
+ }
50
+ export interface StyleDownloadResult {
51
+ styleId: string;
52
+ success: boolean;
53
+ downloadTime: number;
54
+ styleSize: number;
55
+ sourcesProcessed: number;
56
+ sourcesEmbedded: number;
57
+ fontResult?: FontDownloadResult;
58
+ spriteResult?: SpriteDownloadResult;
59
+ errors: string[];
60
+ analytics: {
61
+ sourceTypes: Record<string, number>;
62
+ layerTypes: Record<string, number>;
63
+ totalLayers: number;
64
+ hasGlyphs: boolean;
65
+ hasSprites: boolean;
66
+ };
67
+ }
68
+ export interface EnhancedStyleStats {
69
+ count: number;
70
+ totalSize: number;
71
+ averageSize: number;
72
+ styles: Array<{
73
+ id: string;
74
+ name?: string;
75
+ size: number;
76
+ lastModified?: number;
77
+ sourceCount: number;
78
+ layerCount: number;
79
+ hasGlyphs: boolean;
80
+ hasSprites: boolean;
81
+ metadata?: Record<string, unknown>;
82
+ }>;
83
+ sourceTypes: Record<string, number>;
84
+ layerTypes: Record<string, number>;
85
+ oldestStyle?: {
86
+ id: string;
87
+ lastModified: number;
88
+ };
89
+ newestStyle?: {
90
+ id: string;
91
+ lastModified: number;
92
+ };
93
+ largestStyle?: {
94
+ id: string;
95
+ size: number;
96
+ };
97
+ smallestStyle?: {
98
+ id: string;
99
+ size: number;
100
+ };
101
+ storageRecommendations: string[];
102
+ }
103
+ export type StyleStorageItem = StyleEntry;
@@ -0,0 +1,112 @@
1
+ import type { DownloadProgress } from './progress';
2
+ /**
3
+ * Tile entry stored in IndexedDB
4
+ * Represents a single map tile with all its metadata
5
+ */
6
+ export interface TileEntry {
7
+ /** Unique key: styleId:sourceId:z:x:y.ext (includes extension) */
8
+ key: string;
9
+ /** Tile data as ArrayBuffer */
10
+ data: ArrayBuffer;
11
+ /** Download timestamp (ISO string) */
12
+ downloadedAt: string;
13
+ /** Size in bytes */
14
+ size: number;
15
+ /** Tile type: 'raster' or 'vector' */
16
+ type: string;
17
+ /** File format: 'pbf', 'mvt', 'png', 'jpg', 'webp', etc. */
18
+ format?: string;
19
+ /** Original download URL */
20
+ url: string;
21
+ /** Last modification timestamp (ms since epoch) */
22
+ lastModified: number;
23
+ /** HTTP Content-Type header */
24
+ contentType?: string;
25
+ /** HTTP Content-Encoding header */
26
+ contentEncoding?: string;
27
+ /** Tile X coordinate */
28
+ x?: number;
29
+ /** Tile Y coordinate */
30
+ y?: number;
31
+ /** Tile zoom level */
32
+ z?: number;
33
+ /** Associated style ID */
34
+ styleId?: string;
35
+ /** Associated source ID */
36
+ sourceId?: string;
37
+ }
38
+ /**
39
+ * Options for tile download operations
40
+ */
41
+ export interface TileDownloadOptions {
42
+ /** Progress callback function */
43
+ onProgress?: (progress: DownloadProgress) => void;
44
+ /** Number of tiles to download concurrently (default: 10) */
45
+ batchSize?: number;
46
+ /** Maximum retry attempts for failed downloads (default: 3) */
47
+ maxRetries?: number;
48
+ /** Skip already downloaded tiles (default: true) */
49
+ skipExisting?: boolean;
50
+ /** Maximum concurrent download connections (default: 5) */
51
+ maxConcurrency?: number;
52
+ /** Delay between retries in ms (default: 1000) */
53
+ retryDelay?: number;
54
+ /** Request timeout in ms (default: 10000) */
55
+ timeout?: number;
56
+ /** Validate tile data after download (default: false) */
57
+ validateTiles?: boolean;
58
+ /** Compress tiles before storage (default: false) */
59
+ compressTiles?: boolean;
60
+ /** Priority zoom levels to download first */
61
+ priorityZoomLevels?: number[];
62
+ /** Bandwidth limit in KB/s */
63
+ bandwidthLimit?: number;
64
+ /** Check storage quota before download (default: true) */
65
+ storageQuotaCheck?: boolean;
66
+ }
67
+ /**
68
+ * Result of a tile download operation
69
+ */
70
+ export interface TileDownloadResult {
71
+ /** Total tiles in download plan */
72
+ totalTiles: number;
73
+ /** Successfully downloaded tiles */
74
+ downloadedTiles: number;
75
+ /** Tiles skipped (already exist) */
76
+ skippedTiles: number;
77
+ /** Failed tile downloads */
78
+ failedTiles: number;
79
+ /** Total download size in bytes */
80
+ totalSize: number;
81
+ /** Download duration in ms */
82
+ downloadTime: number;
83
+ /** Average download speed in KB/s */
84
+ averageSpeed: number;
85
+ /** Array of error details */
86
+ errors: Array<{
87
+ url: string;
88
+ error: string;
89
+ }>;
90
+ /** Actual tile extension used (mvt, pbf, png, jpg, etc.) */
91
+ tileExtension?: string;
92
+ }
93
+ /**
94
+ * Statistics for stored tiles
95
+ */
96
+ export interface TileStats {
97
+ /** Total number of tiles */
98
+ count: number;
99
+ /** Total storage size in bytes */
100
+ totalSize: number;
101
+ /** Average tile size in bytes */
102
+ averageSize: number;
103
+ /** Oldest tile timestamp */
104
+ oldestTile?: Date;
105
+ /** Newest tile timestamp */
106
+ newestTile?: Date;
107
+ /** Statistics per zoom level */
108
+ zoomLevelStats: Map<number, {
109
+ count: number;
110
+ size: number;
111
+ }>;
112
+ }
@@ -0,0 +1,10 @@
1
+ export type DownloadOptions = {
2
+ onProgress: (progress: {
3
+ completed: number;
4
+ total: number;
5
+ percentage?: number;
6
+ currentTile?: string;
7
+ currentFont?: string;
8
+ }) => void;
9
+ [key: string]: unknown;
10
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Simplified theme system for dark/light mode management
3
+ * Now that all components use Tailwind CSS, we only need basic theme switching
4
+ */
5
+ export type ThemeMode = 'light' | 'dark';
6
+ export interface Theme {
7
+ mode: ThemeMode;
8
+ }
9
+ export declare const lightTheme: Theme;
10
+ export declare const darkTheme: Theme;
11
+ declare class ThemeManager {
12
+ private currentTheme;
13
+ private listeners;
14
+ constructor();
15
+ private initializeTheme;
16
+ getTheme(): Theme;
17
+ setTheme(mode: ThemeMode): void;
18
+ toggleTheme(): void;
19
+ subscribe(listener: (theme: Theme) => void): () => void;
20
+ private notifyListeners;
21
+ }
22
+ export declare const themeManager: ThemeManager;
23
+ export {};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Download progress section for the offline manager
3
+ */
4
+ export interface DownloadProgress {
5
+ regionId: string;
6
+ completed: number;
7
+ total: number;
8
+ percentage: number;
9
+ currentResource: string;
10
+ }
11
+ export interface DownloadProgressSectionProps {
12
+ downloads: Map<string, DownloadProgress>;
13
+ }
14
+ export declare function createDownloadProgressSection(props: DownloadProgressSectionProps): HTMLDivElement;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Action buttons section for the offline manager
3
+ * Refactored to use modular components
4
+ */
5
+ import { Theme } from '../ThemeManager';
6
+ export interface ActionButtonsProps {
7
+ onAddRegion?: () => void;
8
+ onCleanup?: () => void;
9
+ onRefresh?: () => void;
10
+ theme?: Theme;
11
+ }
12
+ export declare function createActionButtons(props: ActionButtonsProps): HTMLDivElement;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Header component for the offline manager
3
+ * Refactored to use modular components
4
+ */
5
+ import { Theme } from '../ThemeManager';
6
+ export interface HeaderProps {
7
+ title: string;
8
+ subtitle: string;
9
+ onClose?: () => void;
10
+ onThemeToggle?: () => void;
11
+ onToggleTheme?: () => void;
12
+ showThemeToggle?: boolean;
13
+ theme?: Theme;
14
+ }
15
+ export declare function createHeader(props: HeaderProps): HTMLDivElement;