map-gl-offline 0.7.0 → 0.8.2
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 +1 -1
- package/dist/idb-offline-sw.js +313 -360
- package/dist/index.esm.js +996 -1002
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1002 -1001
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1002 -1001
- package/dist/index.umd.js.map +1 -1
- package/dist/managers/offlineMapManager/importExportManagement.d.ts +5 -3
- package/dist/services/fontService.d.ts +12 -2
- package/dist/services/glyphService.d.ts +11 -2
- package/dist/services/importExportService.d.ts +11 -26
- package/dist/services/spriteService.d.ts +10 -3
- package/dist/style.css +1 -1
- package/dist/sw/offline-sw.d.ts +17 -0
- package/dist/sw/shared.d.ts +108 -0
- package/dist/types/import-export.d.ts +7 -28
- package/dist/ui/components/shared/PanelContent.d.ts +0 -1
- package/dist/ui/managers/PanelManager.d.ts +1 -1
- package/dist/ui/modals/{importExportModal.d.ts → mbtilesModal.d.ts} +18 -17
- package/dist/ui/translations/ar.d.ts +23 -37
- package/dist/ui/translations/en.d.ts +23 -37
- package/dist/utils/importResolver.d.ts +10 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/sqlJsLoader.d.ts +17 -0
- package/dist/utils/styleProviderUtils.d.ts +16 -0
- package/dist/utils/tileKey.d.ts +13 -0
- package/package.json +7 -4
|
@@ -10,12 +10,10 @@ export interface RegionExportData {
|
|
|
10
10
|
createdAt: number;
|
|
11
11
|
exportedAt: number;
|
|
12
12
|
version: string;
|
|
13
|
-
format: '
|
|
13
|
+
format: 'mbtiles';
|
|
14
14
|
};
|
|
15
15
|
style: unknown;
|
|
16
16
|
tiles: TileExportData[];
|
|
17
|
-
sprites: SpriteExportData[];
|
|
18
|
-
fonts: FontExportData[];
|
|
19
17
|
}
|
|
20
18
|
export interface TileExportData {
|
|
21
19
|
z: number;
|
|
@@ -25,34 +23,13 @@ export interface TileExportData {
|
|
|
25
23
|
format: 'pbf' | 'png' | 'jpg' | 'webp';
|
|
26
24
|
sourceId: string;
|
|
27
25
|
}
|
|
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
26
|
export interface MBTilesExportOptions {
|
|
27
|
+
/** Tile format written into the MBTiles metadata table. */
|
|
45
28
|
format?: 'pbf' | 'png' | 'jpg';
|
|
46
|
-
|
|
29
|
+
/** Additional metadata rows. Values are JSON-stringified if non-string. */
|
|
47
30
|
metadata?: Record<string, unknown>;
|
|
48
31
|
}
|
|
49
32
|
export interface ImportExportOptions {
|
|
50
|
-
includeStyle?: boolean;
|
|
51
|
-
includeTiles?: boolean;
|
|
52
|
-
includeSprites?: boolean;
|
|
53
|
-
includeFonts?: boolean;
|
|
54
|
-
format?: 'json' | 'pmtiles' | 'mbtiles';
|
|
55
|
-
compression?: boolean;
|
|
56
33
|
onProgress?: (progress: ImportExportProgress) => void;
|
|
57
34
|
}
|
|
58
35
|
export interface ImportExportProgress {
|
|
@@ -65,10 +42,12 @@ export interface ImportExportProgress {
|
|
|
65
42
|
}
|
|
66
43
|
export interface RegionImportData {
|
|
67
44
|
file: File;
|
|
68
|
-
|
|
45
|
+
/** Format is fixed to mbtiles; kept as a literal field for forward-compat. */
|
|
46
|
+
format: 'mbtiles';
|
|
69
47
|
overwrite?: boolean;
|
|
70
48
|
newRegionId?: string;
|
|
71
49
|
newRegionName?: string;
|
|
50
|
+
onProgress?: (progress: ImportExportProgress) => void;
|
|
72
51
|
}
|
|
73
52
|
export interface ImportResult {
|
|
74
53
|
success: boolean;
|
|
@@ -84,7 +63,7 @@ export interface ImportResult {
|
|
|
84
63
|
}
|
|
85
64
|
export interface ExportResult {
|
|
86
65
|
success: boolean;
|
|
87
|
-
format: '
|
|
66
|
+
format: 'mbtiles';
|
|
88
67
|
filename: string;
|
|
89
68
|
blob: Blob;
|
|
90
69
|
size: number;
|
|
@@ -100,7 +100,7 @@ export declare class PanelRenderer extends BaseComponent {
|
|
|
100
100
|
*/
|
|
101
101
|
private handleRedownloadRegion;
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
103
|
+
* Show the MBTiles import/export modal for a region.
|
|
104
104
|
*/
|
|
105
105
|
private handleImportExport;
|
|
106
106
|
/**
|
|
@@ -1,47 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Import/Export Modal
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* MBTiles Import/Export Modal
|
|
3
|
+
*
|
|
4
|
+
* Focused modal for exchanging regions as binary SQLite MBTiles archives.
|
|
5
|
+
* Replaces the previous multi-format import/export modal.
|
|
5
6
|
*/
|
|
6
|
-
import type { StoredRegion, ImportExportOptions, ExportResult, ImportResult, RegionImportData } from '@/types';
|
|
7
|
-
|
|
7
|
+
import type { StoredRegion, ImportExportOptions, MBTilesExportOptions, ExportResult, ImportResult, RegionImportData } from '@/types';
|
|
8
|
+
type MBTilesExportRequestOptions = ImportExportOptions & MBTilesExportOptions;
|
|
9
|
+
export interface MBTilesModalOptions {
|
|
8
10
|
region: StoredRegion;
|
|
9
11
|
onClose: () => void;
|
|
10
12
|
onExport?: (result: ExportResult) => void;
|
|
11
13
|
onImport?: (result: ImportResult) => void;
|
|
12
|
-
exportRegion?: (regionId: string,
|
|
14
|
+
exportRegion?: (regionId: string, options?: MBTilesExportRequestOptions) => Promise<ExportResult>;
|
|
13
15
|
importRegion?: (data: RegionImportData) => Promise<ImportResult>;
|
|
14
16
|
}
|
|
15
|
-
export declare class
|
|
17
|
+
export declare class MBTilesModal {
|
|
16
18
|
private modal?;
|
|
17
19
|
private options;
|
|
18
20
|
private isExporting;
|
|
19
21
|
private isImporting;
|
|
20
|
-
private exportFormatSelect?;
|
|
21
|
-
private includeStyleCheckbox?;
|
|
22
|
-
private includeTilesCheckbox?;
|
|
23
|
-
private includeSpritesCheckbox?;
|
|
24
|
-
private includeFontsCheckbox?;
|
|
25
22
|
private exportProgressBar?;
|
|
26
23
|
private exportProgressText?;
|
|
24
|
+
private exportProgressContainer?;
|
|
27
25
|
private exportButton?;
|
|
28
26
|
private importFileInput?;
|
|
29
27
|
private importNameInput?;
|
|
30
28
|
private importOverwriteCheckbox?;
|
|
31
29
|
private importProgressBar?;
|
|
32
30
|
private importProgressText?;
|
|
31
|
+
private importProgressContainer?;
|
|
33
32
|
private importButton?;
|
|
34
|
-
constructor(options:
|
|
33
|
+
constructor(options: MBTilesModalOptions);
|
|
35
34
|
show(): HTMLDivElement;
|
|
36
35
|
hide(): void;
|
|
36
|
+
destroy(): void;
|
|
37
37
|
private createContent;
|
|
38
|
-
private
|
|
38
|
+
private createRegionInfoLine;
|
|
39
39
|
private createExportSection;
|
|
40
40
|
private createImportSection;
|
|
41
|
-
private
|
|
41
|
+
private createSection;
|
|
42
|
+
private createProgressBlock;
|
|
43
|
+
private createFooter;
|
|
42
44
|
private attachEventListeners;
|
|
43
45
|
private handleExport;
|
|
44
46
|
private handleImport;
|
|
45
|
-
private createFooter;
|
|
46
|
-
destroy(): void;
|
|
47
47
|
}
|
|
48
|
+
export {};
|
|
@@ -95,9 +95,6 @@ export declare const ar: {
|
|
|
95
95
|
readonly 'styleSelection.title': "اختر نمط غير متصل";
|
|
96
96
|
readonly 'styleSelection.message': "اختر النمط غير المتصل الذي تريد تحميله:";
|
|
97
97
|
readonly 'styleSelection.sources': "مصادر";
|
|
98
|
-
readonly 'importExport.title': "استيراد/تصدير";
|
|
99
|
-
readonly 'importExport.export': "تصدير";
|
|
100
|
-
readonly 'importExport.import': "استيراد";
|
|
101
98
|
readonly 'error.loadingContent': "خطأ في تحميل المحتوى";
|
|
102
99
|
readonly 'error.tryAgain': "يرجى المحاولة مرة أخرى";
|
|
103
100
|
readonly 'error.mapNotInitialized': "الخريطة غير مهيأة. يرجى التأكد من تحميل الخريطة قبل تحميل النمط.";
|
|
@@ -117,40 +114,29 @@ export declare const ar: {
|
|
|
117
114
|
readonly 'regionDetails.bounds': "الحدود";
|
|
118
115
|
readonly 'regionDetails.zoomRange': "نطاق التكبير";
|
|
119
116
|
readonly 'regionDetails.created': "تاريخ الإنشاء";
|
|
120
|
-
readonly '
|
|
121
|
-
readonly '
|
|
122
|
-
readonly '
|
|
123
|
-
readonly '
|
|
124
|
-
readonly '
|
|
125
|
-
readonly '
|
|
126
|
-
readonly '
|
|
127
|
-
readonly '
|
|
128
|
-
readonly '
|
|
129
|
-
readonly '
|
|
130
|
-
readonly '
|
|
131
|
-
readonly '
|
|
132
|
-
readonly '
|
|
133
|
-
readonly '
|
|
134
|
-
readonly '
|
|
135
|
-
readonly '
|
|
136
|
-
readonly '
|
|
137
|
-
readonly '
|
|
138
|
-
readonly '
|
|
139
|
-
readonly '
|
|
140
|
-
readonly '
|
|
141
|
-
readonly '
|
|
142
|
-
readonly '
|
|
143
|
-
readonly 'importExport.fileFormatsHint': "يدعم تنسيقات JSON و PMTiles و MBTiles";
|
|
144
|
-
readonly 'importExport.newRegionName': "اسم المنطقة الجديد (اختياري)";
|
|
145
|
-
readonly 'importExport.newRegionNamePlaceholder': "اتركه فارغاً لاستخدام الاسم الأصلي";
|
|
146
|
-
readonly 'importExport.overwriteIfExists': "الكتابة فوق المنطقة الموجودة";
|
|
147
|
-
readonly 'importExport.preparingImport': "جاري تجهيز الاستيراد...";
|
|
148
|
-
readonly 'importExport.importComplete': "اكتمل الاستيراد!";
|
|
149
|
-
readonly 'importExport.importFailed': "فشل الاستيراد. يرجى المحاولة مرة أخرى.";
|
|
150
|
-
readonly 'importExport.formatGuide': "دليل التنسيقات";
|
|
151
|
-
readonly 'importExport.jsonDesc': "بيانات كاملة، قابلة للقراءة، الأفضل للتطوير";
|
|
152
|
-
readonly 'importExport.pmtilesDesc': "محسن للويب، خدمة فعالة، متوافق مع السحابة";
|
|
153
|
-
readonly 'importExport.mbtilesDesc': "معيار الصناعة، قائم على SQLite، متعدد المنصات";
|
|
117
|
+
readonly 'mbtiles.title': "استيراد / تصدير MBTiles";
|
|
118
|
+
readonly 'mbtiles.regionInfo': "معلومات المنطقة";
|
|
119
|
+
readonly 'mbtiles.id': "المعرف";
|
|
120
|
+
readonly 'mbtiles.name': "الاسم";
|
|
121
|
+
readonly 'mbtiles.unnamed': "بدون اسم";
|
|
122
|
+
readonly 'mbtiles.zoom': "التكبير";
|
|
123
|
+
readonly 'mbtiles.created': "تاريخ الإنشاء";
|
|
124
|
+
readonly 'mbtiles.exportTitle': "التصدير كـ MBTiles";
|
|
125
|
+
readonly 'mbtiles.exportHint': "احزم بلاطات هذه المنطقة داخل أرشيف MBTiles (SQLite) يمكن فتحه في QGIS و tippecanoe وأدوات أخرى.";
|
|
126
|
+
readonly 'mbtiles.exportButton': "تنزيل ملف mbtiles.";
|
|
127
|
+
readonly 'mbtiles.preparingExport': "جاري تجهيز التصدير...";
|
|
128
|
+
readonly 'mbtiles.exportComplete': "اكتمل التصدير!";
|
|
129
|
+
readonly 'mbtiles.exportFailed': "فشل التصدير. يرجى المحاولة مرة أخرى.";
|
|
130
|
+
readonly 'mbtiles.importTitle': "الاستيراد من MBTiles";
|
|
131
|
+
readonly 'mbtiles.selectFile': "اختر ملف mbtiles.";
|
|
132
|
+
readonly 'mbtiles.fileHint': "تُدعم ملفات mbtiles. بتنسيق SQLite فقط.";
|
|
133
|
+
readonly 'mbtiles.newRegionName': "اسم المنطقة الجديد (اختياري)";
|
|
134
|
+
readonly 'mbtiles.newRegionNamePlaceholder': "اتركه فارغًا لاستخدام الاسم من الملف";
|
|
135
|
+
readonly 'mbtiles.overwriteIfExists': "الكتابة فوق المنطقة إذا كان المعرف موجودًا";
|
|
136
|
+
readonly 'mbtiles.importButton': "استيراد ملف mbtiles.";
|
|
137
|
+
readonly 'mbtiles.preparingImport': "جاري تجهيز الاستيراد...";
|
|
138
|
+
readonly 'mbtiles.importComplete': "اكتمل الاستيراد!";
|
|
139
|
+
readonly 'mbtiles.importFailed': "فشل الاستيراد. يرجى المحاولة مرة أخرى.";
|
|
154
140
|
readonly 'download.activeCount': "التحميلات النشطة ({{count}})";
|
|
155
141
|
readonly 'panel.downloadedRegions': "المناطق المحملة";
|
|
156
142
|
readonly 'panel.noExpiry': "بدون انتهاء";
|
|
@@ -94,9 +94,6 @@ export declare const en: {
|
|
|
94
94
|
readonly 'styleSelection.title': "Select Offline Style";
|
|
95
95
|
readonly 'styleSelection.message': "Choose which offline style to load:";
|
|
96
96
|
readonly 'styleSelection.sources': "sources";
|
|
97
|
-
readonly 'importExport.title': "Import/Export";
|
|
98
|
-
readonly 'importExport.export': "Export";
|
|
99
|
-
readonly 'importExport.import': "Import";
|
|
100
97
|
readonly 'error.loadingContent': "Error loading content";
|
|
101
98
|
readonly 'error.tryAgain': "Please try again";
|
|
102
99
|
readonly 'error.mapNotInitialized': "Map is not initialized. Please ensure the map is loaded before loading a style.";
|
|
@@ -116,40 +113,29 @@ export declare const en: {
|
|
|
116
113
|
readonly 'regionDetails.bounds': "Bounds";
|
|
117
114
|
readonly 'regionDetails.zoomRange': "Zoom Range";
|
|
118
115
|
readonly 'regionDetails.created': "Created";
|
|
119
|
-
readonly '
|
|
120
|
-
readonly '
|
|
121
|
-
readonly '
|
|
122
|
-
readonly '
|
|
123
|
-
readonly '
|
|
124
|
-
readonly '
|
|
125
|
-
readonly '
|
|
126
|
-
readonly '
|
|
127
|
-
readonly '
|
|
128
|
-
readonly '
|
|
129
|
-
readonly '
|
|
130
|
-
readonly '
|
|
131
|
-
readonly '
|
|
132
|
-
readonly '
|
|
133
|
-
readonly '
|
|
134
|
-
readonly '
|
|
135
|
-
readonly '
|
|
136
|
-
readonly '
|
|
137
|
-
readonly '
|
|
138
|
-
readonly '
|
|
139
|
-
readonly '
|
|
140
|
-
readonly '
|
|
141
|
-
readonly '
|
|
142
|
-
readonly 'importExport.fileFormatsHint': "Supports JSON, PMTiles, and MBTiles formats";
|
|
143
|
-
readonly 'importExport.newRegionName': "New Region Name (Optional)";
|
|
144
|
-
readonly 'importExport.newRegionNamePlaceholder': "Leave empty to use original name";
|
|
145
|
-
readonly 'importExport.overwriteIfExists': "Overwrite if region exists";
|
|
146
|
-
readonly 'importExport.preparingImport': "Preparing import...";
|
|
147
|
-
readonly 'importExport.importComplete': "Import complete!";
|
|
148
|
-
readonly 'importExport.importFailed': "Import failed. Please try again.";
|
|
149
|
-
readonly 'importExport.formatGuide': "Format Guide";
|
|
150
|
-
readonly 'importExport.jsonDesc': "Complete data, human-readable, best for development";
|
|
151
|
-
readonly 'importExport.pmtilesDesc': "Web-optimized, efficient serving, cloud-friendly";
|
|
152
|
-
readonly 'importExport.mbtilesDesc': "Industry standard, SQLite-based, cross-platform";
|
|
116
|
+
readonly 'mbtiles.title': "MBTiles Import / Export";
|
|
117
|
+
readonly 'mbtiles.regionInfo': "Region Information";
|
|
118
|
+
readonly 'mbtiles.id': "ID";
|
|
119
|
+
readonly 'mbtiles.name': "Name";
|
|
120
|
+
readonly 'mbtiles.unnamed': "Unnamed";
|
|
121
|
+
readonly 'mbtiles.zoom': "Zoom";
|
|
122
|
+
readonly 'mbtiles.created': "Created";
|
|
123
|
+
readonly 'mbtiles.exportTitle': "Export as MBTiles";
|
|
124
|
+
readonly 'mbtiles.exportHint': "Package the tiles in this region into a standard SQLite MBTiles archive that opens in QGIS, tippecanoe, and other tools.";
|
|
125
|
+
readonly 'mbtiles.exportButton': "Download .mbtiles";
|
|
126
|
+
readonly 'mbtiles.preparingExport': "Preparing export...";
|
|
127
|
+
readonly 'mbtiles.exportComplete': "Export complete!";
|
|
128
|
+
readonly 'mbtiles.exportFailed': "Export failed. Please try again.";
|
|
129
|
+
readonly 'mbtiles.importTitle': "Import from MBTiles";
|
|
130
|
+
readonly 'mbtiles.selectFile': "Select an .mbtiles file";
|
|
131
|
+
readonly 'mbtiles.fileHint': "Only SQLite-format .mbtiles files are supported.";
|
|
132
|
+
readonly 'mbtiles.newRegionName': "New Region Name (optional)";
|
|
133
|
+
readonly 'mbtiles.newRegionNamePlaceholder': "Leave empty to use the name from the file";
|
|
134
|
+
readonly 'mbtiles.overwriteIfExists': "Overwrite if a region with the same id exists";
|
|
135
|
+
readonly 'mbtiles.importButton': "Import .mbtiles";
|
|
136
|
+
readonly 'mbtiles.preparingImport': "Preparing import...";
|
|
137
|
+
readonly 'mbtiles.importComplete': "Import complete!";
|
|
138
|
+
readonly 'mbtiles.importFailed': "Import failed. Please try again.";
|
|
153
139
|
readonly 'download.activeCount': "Active Downloads ({{count}})";
|
|
154
140
|
readonly 'panel.downloadedRegions': "Downloaded Regions";
|
|
155
141
|
readonly 'panel.noExpiry': "No expiry";
|
|
@@ -31,3 +31,13 @@ export declare function hasImports(style: unknown): boolean;
|
|
|
31
31
|
* Returns the mutated style.
|
|
32
32
|
*/
|
|
33
33
|
export declare function resolveImports(style: BaseStyle, accessToken: string, options?: ResolveImportsOptions): Promise<BaseStyle>;
|
|
34
|
+
/**
|
|
35
|
+
* Rewrite indoor-only expressions in a style's layers to their outdoor no-op
|
|
36
|
+
* constants. See the in-line comment in `resolveValue` for why this is needed
|
|
37
|
+
* for Mapbox Standard when the `imports` wrapper is stripped.
|
|
38
|
+
*
|
|
39
|
+
* Safe to call multiple times and on already-downloaded stored styles — the
|
|
40
|
+
* rewrites are idempotent (after the first pass there are no more
|
|
41
|
+
* `is-active-floor` / `floor-level` expressions to rewrite).
|
|
42
|
+
*/
|
|
43
|
+
export declare function sanitizeIndoorExpressions(style: BaseStyle): void;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SqlJsStatic } from 'sql.js';
|
|
2
|
+
export interface SqlJsConfig {
|
|
3
|
+
/** URL where `sql-wasm.wasm` (and any Emscripten runtime files) can be fetched from. */
|
|
4
|
+
wasmUrl?: string;
|
|
5
|
+
/** Pre-fetched WASM binary. Takes precedence over `wasmUrl`. Useful in Node / tests. */
|
|
6
|
+
wasmBinary?: ArrayBuffer | Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Override how `sql.js` loads its WebAssembly. Call once before any MBTiles
|
|
10
|
+
* import/export is invoked. Resets any cached init.
|
|
11
|
+
*/
|
|
12
|
+
export declare function configureSqlJs(config: SqlJsConfig): void;
|
|
13
|
+
/**
|
|
14
|
+
* Lazily initialise `sql.js`. The underlying module is loaded via dynamic
|
|
15
|
+
* `import()` so it only ships with bundles that actually call MBTiles code.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getSqlJs(): Promise<SqlJsStatic>;
|
|
@@ -7,6 +7,22 @@ import type { BaseStyle, StyleProvider } from '@/types/style';
|
|
|
7
7
|
* Check if a URL uses the mapbox:// protocol
|
|
8
8
|
*/
|
|
9
9
|
export declare function isMapboxProtocol(url: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Parse a URL and return its hostname, or null if the URL is malformed.
|
|
12
|
+
* Accepts relative URLs when `base` is provided.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getUrlHostname(url: string, base?: string): string | null;
|
|
15
|
+
/**
|
|
16
|
+
* True if `url`'s hostname equals `host` or is a subdomain of `host`.
|
|
17
|
+
* Uses URL parsing (not substring matching) to avoid false positives like
|
|
18
|
+
* `https://evil.com/?x=mapbox.com` matching `mapbox.com`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function hostMatches(url: string, host: string, base?: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* True for any host under the mapbox.com domain (including api.mapbox.com,
|
|
23
|
+
* *.tiles.mapbox.com, etc.). Used by provider detection.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isMapboxHost(url: string, base?: string): boolean;
|
|
10
26
|
/**
|
|
11
27
|
* Resolve a mapbox:// URL to its HTTPS API equivalent
|
|
12
28
|
*
|
package/dist/utils/tileKey.d.ts
CHANGED
|
@@ -18,6 +18,19 @@ export declare function parseTileKey(key: string): {
|
|
|
18
18
|
y: number;
|
|
19
19
|
ext: string;
|
|
20
20
|
} | null;
|
|
21
|
+
/**
|
|
22
|
+
* Extract the extension (the last dotted segment before `?`, `#`, or end) from
|
|
23
|
+
* a tile URL or tile URL template. Defaults to `"pbf"` when no extension can
|
|
24
|
+
* be parsed. For multi-extension URLs like Mapbox v4's `{y}.vector.pbf` this
|
|
25
|
+
* returns `"pbf"`, matching the key used when the tile is stored.
|
|
26
|
+
*
|
|
27
|
+
* Keeping extraction logic in one place ensures patchStyleForOffline (which
|
|
28
|
+
* rewrites tile URLs to `idb://` at load time) derives the same extension
|
|
29
|
+
* that tileService.extractExtension used at store time — otherwise the
|
|
30
|
+
* first-try lookup in idbFetchHandler misses and has to fall through its
|
|
31
|
+
* pbf/mvt/png/jpg/webp fallback loop.
|
|
32
|
+
*/
|
|
33
|
+
export declare function extractTileExtensionFromUrl(url: string): string;
|
|
21
34
|
/**
|
|
22
35
|
* Derive tile extension from tile URL templates
|
|
23
36
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "map-gl-offline",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.2",
|
|
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",
|
|
@@ -36,11 +36,12 @@
|
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"dev": "vite",
|
|
39
|
-
"build": "npm run build:clean && npm run build:lib && npm run build:types && npm run build:css && npm run build:sw",
|
|
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
42
|
"build:types": "tsc --declaration --emitDeclarationOnly --outDir dist",
|
|
43
43
|
"build:css": "tailwindcss -i src/styles/style.css -o dist/style.css --minify",
|
|
44
|
+
"build:sw-src": "node scripts/build-sw.mjs",
|
|
44
45
|
"build:sw": "cp public/idb-offline-sw.js dist/idb-offline-sw.js && cp bin/vite-plugin.js dist/vite-plugin.js",
|
|
45
46
|
"build:watch": "rollup -c -w",
|
|
46
47
|
"build:dev": "npm run build:clean && npm run build:lib",
|
|
@@ -86,7 +87,6 @@
|
|
|
86
87
|
"sprites",
|
|
87
88
|
"fonts",
|
|
88
89
|
"glyphs",
|
|
89
|
-
"pmtiles",
|
|
90
90
|
"mbtiles",
|
|
91
91
|
"import",
|
|
92
92
|
"export",
|
|
@@ -107,7 +107,8 @@
|
|
|
107
107
|
"@turf/difference": "^7.3.4",
|
|
108
108
|
"@turf/helpers": "^7.3.4",
|
|
109
109
|
"i18next": "^25.8.11",
|
|
110
|
-
"idb": "^8.0.3"
|
|
110
|
+
"idb": "^8.0.3",
|
|
111
|
+
"sql.js": "^1.14.1"
|
|
111
112
|
},
|
|
112
113
|
"peerDependencies": {
|
|
113
114
|
"mapbox-gl": ">=2.0.0",
|
|
@@ -134,7 +135,9 @@
|
|
|
134
135
|
"@types/mapbox-gl": "^3.4.1",
|
|
135
136
|
"@types/maplibre-gl": "^1.14.0",
|
|
136
137
|
"@types/node": "^25.3.0",
|
|
138
|
+
"@types/sql.js": "^1.4.11",
|
|
137
139
|
"autoprefixer": "^10.4.24",
|
|
140
|
+
"esbuild": "^0.27.3",
|
|
138
141
|
"eslint": "^10.0.0",
|
|
139
142
|
"fake-indexeddb": "^6.2.5",
|
|
140
143
|
"husky": "^9.1.7",
|