map-gl-offline 0.8.2 → 0.8.3
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/dist/index.esm.js +53 -37
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +54 -36
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +54 -36
- package/dist/index.umd.js.map +1 -1
- package/dist/ui/offlineManagerControl.d.ts +18 -3
- package/dist/utils/constants.d.ts +3 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -61,45 +61,61 @@ const TILE_CONFIG = {
|
|
|
61
61
|
SUPPORTED_EXTENSIONS: ['pbf', 'mvt', 'png', 'jpg', 'jpeg', 'webp', 'glb'],
|
|
62
62
|
};
|
|
63
63
|
// Glyph Configuration
|
|
64
|
+
//
|
|
65
|
+
// Glyph servers (MapTiler, Mapbox, OpenFreeMap, ...) serve glyphs in fixed
|
|
66
|
+
// 256-codepoint blocks aligned to a multiple of 256: every request must be
|
|
67
|
+
// `${k * 256}-${k * 256 + 255}`. Strict servers (e.g. MapTiler) reject any
|
|
68
|
+
// other range with HTTP 400 "Invalid glyph range"; lenient ones silently
|
|
69
|
+
// accept them, which is how malformed ranges went unnoticed. See issue #37.
|
|
70
|
+
const GLYPH_BLOCK_SIZE = 256;
|
|
71
|
+
const MAX_GLYPH_CODEPOINT = 65535;
|
|
72
|
+
/**
|
|
73
|
+
* Expand an inclusive Unicode codepoint span into the aligned 256-codepoint
|
|
74
|
+
* glyph blocks that cover it, formatted as `"start-end"` request ranges.
|
|
75
|
+
* The span need not be block-aligned — it is snapped out to whole blocks.
|
|
76
|
+
*/
|
|
77
|
+
function glyphBlocksForSpan(start, end) {
|
|
78
|
+
const firstBlock = Math.floor(start / GLYPH_BLOCK_SIZE);
|
|
79
|
+
const lastBlock = Math.floor(Math.min(end, MAX_GLYPH_CODEPOINT) / GLYPH_BLOCK_SIZE);
|
|
80
|
+
const blocks = [];
|
|
81
|
+
for (let block = firstBlock; block <= lastBlock; block++) {
|
|
82
|
+
const blockStart = block * GLYPH_BLOCK_SIZE;
|
|
83
|
+
blocks.push(`${blockStart}-${blockStart + GLYPH_BLOCK_SIZE - 1}`);
|
|
84
|
+
}
|
|
85
|
+
return blocks;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Unicode codepoint spans the comprehensive glyph download aims to cover.
|
|
89
|
+
* Each span is snapped to whole 256-codepoint glyph blocks below, so the
|
|
90
|
+
* resulting request ranges are always server-valid regardless of where the
|
|
91
|
+
* underlying Unicode blocks happen to start or end. To extend coverage, add
|
|
92
|
+
* a span here — never hand-write raw `"start-end"` ranges.
|
|
93
|
+
*/
|
|
94
|
+
const GLYPH_COVERAGE_SPANS = [
|
|
95
|
+
[0x0000, 0x12ff], // Latin, Greek, Cyrillic, Hebrew, Arabic, Indic, SE Asian, Georgian, Ethiopic, Cherokee
|
|
96
|
+
[0x1e00, 0x21ff], // Latin Extended Additional, punctuation, symbols, arrows
|
|
97
|
+
[0x2e00, 0x31ff], // CJK radicals, Hiragana, Katakana, Bopomofo, Hangul Compatibility Jamo
|
|
98
|
+
[0x4e00, 0x4fff], // CJK Unified Ideographs (common subset)
|
|
99
|
+
[0xa000, 0xa4ff], // Yi Syllables and Radicals
|
|
100
|
+
[0xac00, 0xd7ff], // Hangul Syllables (Korean)
|
|
101
|
+
[0xf900, 0xfbff], // CJK Compatibility Ideographs, Alphabetic Presentation Forms
|
|
102
|
+
[0xfe00, 0xfeff], // Variation Selectors
|
|
103
|
+
[0xff00, 0xffff], // Halfwidth and Fullwidth Forms
|
|
104
|
+
];
|
|
105
|
+
/** Build the deduped, codepoint-ascending list of comprehensive glyph ranges. */
|
|
106
|
+
function buildComprehensiveRanges() {
|
|
107
|
+
const ranges = new Set();
|
|
108
|
+
for (const [start, end] of GLYPH_COVERAGE_SPANS) {
|
|
109
|
+
for (const range of glyphBlocksForSpan(start, end)) {
|
|
110
|
+
ranges.add(range);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return Array.from(ranges).sort((a, b) => Number(a.split('-')[0]) - Number(b.split('-')[0]));
|
|
114
|
+
}
|
|
64
115
|
const GLYPH_CONFIG = {
|
|
65
116
|
DEFAULT_URL: 'https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf',
|
|
66
117
|
DEFAULT_RANGES: ['0-255'],
|
|
67
|
-
COMPREHENSIVE_RANGES:
|
|
68
|
-
'0-255', // Basic Latin + Latin-1 Supplement
|
|
69
|
-
'256-511', // Latin Extended-A + Latin Extended-B
|
|
70
|
-
'512-767', // IPA Extensions + Spacing Modifier Letters
|
|
71
|
-
'768-1023', // Combining Diacritical Marks + Greek and Coptic
|
|
72
|
-
'1024-1279', // Cyrillic + Cyrillic Supplement
|
|
73
|
-
'1280-1535', // Armenian + Hebrew
|
|
74
|
-
'1536-1791', // Arabic
|
|
75
|
-
'1792-2047', // Syriac + Arabic Supplement + Thaana
|
|
76
|
-
'2048-2303', // NKo + Samaritan + Mandaic
|
|
77
|
-
'2304-2559', // Devanagari + Bengali
|
|
78
|
-
'2560-2815', // Gurmukhi + Gujarati
|
|
79
|
-
'2816-3071', // Oriya + Tamil
|
|
80
|
-
'3072-3327', // Telugu + Kannada
|
|
81
|
-
'3328-3583', // Malayalam + Sinhala
|
|
82
|
-
'3584-3839', // Thai + Lao
|
|
83
|
-
'3840-4095', // Tibetan + Myanmar
|
|
84
|
-
'4096-4351', // Georgian + Hangul Jamo
|
|
85
|
-
'4352-4607', // Ethiopic
|
|
86
|
-
'4608-4863', // Cherokee + Canadian Aboriginal
|
|
87
|
-
'7680-7935', // Latin Extended Additional
|
|
88
|
-
'8192-8447', // General Punctuation, Superscripts/Subscripts, Currency Symbols
|
|
89
|
-
'8448-8703', // Letterlike Symbols, Number Forms, Arrows
|
|
90
|
-
'11904-12031', // CJK Radicals Supplement
|
|
91
|
-
'12032-12255', // Kangxi Radicals + CJK Symbols
|
|
92
|
-
'12288-12543', // Hiragana + Katakana
|
|
93
|
-
'12544-12799', // Bopomofo + Hangul Compatibility Jamo
|
|
94
|
-
'19968-20223', // CJK Unified Ideographs (first block)
|
|
95
|
-
'20224-20479', // CJK Unified Ideographs
|
|
96
|
-
'40960-42127', // Yi Syllables + Yi Radicals
|
|
97
|
-
'44032-55203', // Hangul Syllables (Korean)
|
|
98
|
-
'63744-64255', // CJK Compatibility Ideographs
|
|
99
|
-
'64256-64511', // Alphabetic Presentation Forms
|
|
100
|
-
'65024-65279', // Variation Selectors
|
|
101
|
-
'65280-65535', // Halfwidth and Fullwidth Forms
|
|
102
|
-
],
|
|
118
|
+
COMPREHENSIVE_RANGES: buildComprehensiveRanges(),
|
|
103
119
|
};
|
|
104
120
|
// Style Configuration
|
|
105
121
|
const STYLE_CONFIG = {
|
|
@@ -13979,6 +13995,7 @@ exports.DB_VERSION = DB_VERSION;
|
|
|
13979
13995
|
exports.DOWNLOAD_DEFAULTS = DOWNLOAD_DEFAULTS;
|
|
13980
13996
|
exports.ERROR_MESSAGES = ERROR_MESSAGES;
|
|
13981
13997
|
exports.FontService = FontService;
|
|
13998
|
+
exports.GLYPH_BLOCK_SIZE = GLYPH_BLOCK_SIZE;
|
|
13982
13999
|
exports.GLYPH_CONFIG = GLYPH_CONFIG;
|
|
13983
14000
|
exports.GZIP_MAGIC_BYTES = GZIP_MAGIC_BYTES;
|
|
13984
14001
|
exports.GlyphService = GlyphService;
|
|
@@ -13987,6 +14004,7 @@ exports.MAPBOX_API = MAPBOX_API;
|
|
|
13987
14004
|
exports.MAPBOX_CACHE_TTL = MAPBOX_CACHE_TTL;
|
|
13988
14005
|
exports.MAPBOX_CLASSIC_STYLES = MAPBOX_CLASSIC_STYLES;
|
|
13989
14006
|
exports.MAP_PROVIDERS = MAP_PROVIDERS;
|
|
14007
|
+
exports.MAX_GLYPH_CODEPOINT = MAX_GLYPH_CODEPOINT;
|
|
13990
14008
|
exports.MaintenanceService = MaintenanceService;
|
|
13991
14009
|
exports.ModelService = ModelService;
|
|
13992
14010
|
exports.OfflineManagerControl = OfflineManagerControl;
|