maplibre-gl 6.5.0 → 6.7.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/build/generate-unicode-data.ts +83 -0
- package/dist/maplibre-gl-dev.mjs +2062 -1531
- package/dist/maplibre-gl-dev.mjs.map +1 -1
- package/dist/maplibre-gl-shared-dev.mjs +1906 -1181
- package/dist/maplibre-gl-shared-dev.mjs.map +1 -1
- package/dist/maplibre-gl-shared.mjs +2 -2
- package/dist/maplibre-gl-shared.mjs.map +1 -1
- package/dist/maplibre-gl-worker-dev.mjs +7 -6
- package/dist/maplibre-gl-worker-dev.mjs.map +1 -1
- package/dist/maplibre-gl-worker.mjs +2 -2
- package/dist/maplibre-gl-worker.mjs.map +1 -1
- package/dist/maplibre-gl.d.ts +409 -153
- package/dist/maplibre-gl.mjs +42 -42
- package/dist/maplibre-gl.mjs.map +1 -1
- package/package.json +26 -21
- package/src/data/array_types.g.ts +43 -32
- package/src/data/bucket/symbol_attributes.ts +6 -3
- package/src/data/bucket/symbol_bucket.test.ts +45 -12
- package/src/data/bucket/symbol_bucket.ts +51 -26
- package/src/data/bucket.ts +11 -3
- package/src/data/feature_index.ts +38 -9
- package/src/geo/projection/covering_tiles.test.ts +36 -0
- package/src/geo/projection/covering_tiles.ts +2 -3
- package/src/geo/projection/globe_transform.test.ts +4 -5
- package/src/geo/projection/globe_transform.ts +7 -2
- package/src/geo/projection/globe_utils.ts +57 -0
- package/src/geo/projection/mercator_transform.bench.ts +55 -0
- package/src/geo/projection/mercator_transform.test.ts +227 -17
- package/src/geo/projection/mercator_transform.ts +119 -28
- package/src/geo/projection/mercator_utils.test.ts +50 -1
- package/src/geo/projection/mercator_utils.ts +20 -1
- package/src/geo/projection/vertical_perspective_transform.test.ts +97 -0
- package/src/geo/projection/vertical_perspective_transform.ts +72 -68
- package/src/geo/transform_helper.ts +14 -5
- package/src/geo/transform_interface.ts +22 -1
- package/src/render/font_face_manager.test.ts +295 -0
- package/src/render/font_face_manager.ts +249 -0
- package/src/render/glyph_atlas.ts +3 -7
- package/src/render/glyph_manager.test.ts +251 -94
- package/src/render/glyph_manager.ts +195 -52
- package/src/render/painter.test.ts +1 -3
- package/src/render/painter.ts +7 -20
- package/src/render/terrain.test.ts +109 -84
- package/src/render/terrain.ts +138 -117
- package/src/shaders/glsl/symbol_icon.vertex.glsl +4 -1
- package/src/shaders/glsl/symbol_icon.vertex.glsl.g.ts +1 -1
- package/src/shaders/glsl/symbol_sdf.vertex.glsl +4 -1
- package/src/shaders/glsl/symbol_sdf.vertex.glsl.g.ts +1 -1
- package/src/shaders/glsl/symbol_text_and_icon.vertex.glsl +4 -1
- package/src/shaders/glsl/symbol_text_and_icon.vertex.glsl.g.ts +1 -1
- package/src/shaders/shaders.ts +0 -4
- package/src/source/geojson_worker_source.test.ts +4 -53
- package/src/source/image_source.test.ts +53 -0
- package/src/source/image_source.ts +24 -2
- package/src/source/raster_dem_tile_source.ts +1 -0
- package/src/source/vector_tile_worker_source.test.ts +46 -38
- package/src/source/vector_tile_worker_source.ts +6 -1
- package/src/source/worker_source.ts +1 -5
- package/src/source/worker_tile.test.ts +6 -22
- package/src/source/worker_tile.ts +8 -5
- package/src/style/query_utils.ts +8 -8
- package/src/style/style.test.ts +92 -0
- package/src/style/style.ts +67 -3
- package/src/style/style_image.ts +5 -1
- package/src/style/style_layer/symbol_style_layer.ts +7 -7
- package/src/style/style_layer/symbol_style_layer_properties.g.ts +9 -3
- package/src/style/style_layer.ts +4 -6
- package/src/symbol/collision_index.ts +25 -19
- package/src/symbol/placement.test.ts +1 -1
- package/src/symbol/placement.ts +28 -13
- package/src/symbol/projection.test.ts +79 -15
- package/src/symbol/projection.ts +38 -20
- package/src/symbol/shaping.test.ts +436 -2
- package/src/symbol/shaping.ts +298 -113
- package/src/symbol/symbol_elevation.ts +28 -0
- package/src/symbol/symbol_layout.ts +15 -7
- package/src/symbol/symbol_size.test.ts +100 -0
- package/src/symbol/symbol_size.ts +78 -50
- package/src/symbol/tagged_string.test.ts +29 -6
- package/src/symbol/tagged_string.ts +151 -89
- package/src/tile/terrain_tile_manager.test.ts +23 -0
- package/src/tile/terrain_tile_manager.ts +8 -3
- package/src/tile/tile.ts +3 -2
- package/src/tile/tile_manager_raster_dem.ts +1 -0
- package/src/ui/camera.test.ts +6 -5
- package/src/ui/camera.ts +3 -3
- package/src/ui/control/navigation_control.test.ts +32 -0
- package/src/ui/control/navigation_control.ts +3 -3
- package/src/ui/handler_manager.test.ts +11 -23
- package/src/ui/handler_manager.ts +1 -1
- package/src/ui/map.ts +87 -21
- package/src/ui/map_tests/map_pitch.test.ts +12 -0
- package/src/ui/map_tests/map_render.test.ts +139 -1
- package/src/ui/map_tests/map_style.test.ts +66 -27
- package/src/ui/map_tests/map_terrain.test.ts +60 -1
- package/src/ui/map_tests/map_webgl.test.ts +41 -11
- package/src/ui/map_tests/map_zoom.test.ts +23 -0
- package/src/util/actor_messages.ts +3 -6
- package/src/util/gpu_initialization_error.ts +2 -1
- package/src/util/graphemes.test.ts +79 -0
- package/src/util/graphemes.ts +79 -0
- package/src/util/test/util.ts +80 -4
- package/src/util/unicode_properties.g.ts +28 -0
- package/src/util/util.ts +6 -2
- package/src/webgl/draw/draw_color_relief.ts +7 -10
- package/src/webgl/draw/draw_symbol.ts +17 -13
- package/src/webgl/draw/draw_terrain.ts +4 -39
- package/src/webgl/draw/index.ts +2 -4
- package/src/webgl/program/program_uniforms.ts +1 -3
- package/src/webgl/program/symbol_program.ts +15 -5
- package/src/webgl/program/terrain_program.ts +1 -22
- package/src/webgl/render_to_texture.test.ts +0 -1
- package/src/shaders/glsl/terrain_coords.fragment.glsl +0 -11
- package/src/shaders/glsl/terrain_coords.fragment.glsl.g.ts +0 -2
- package/src/shaders/glsl/terrain_coords.vertex.glsl +0 -12
- package/src/shaders/glsl/terrain_coords.vertex.glsl.g.ts +0 -2
- package/src/style/load_glyph_range.test.ts +0 -74
- package/src/style/load_glyph_range.ts +0 -32
|
@@ -313,6 +313,61 @@ async function requiresComplexTextShaping(): Promise<string> {
|
|
|
313
313
|
return set.toString();
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
+
/**
|
|
317
|
+
* Returns a character class matching every character that can take part in a grapheme cluster of
|
|
318
|
+
* more than one codepoint.
|
|
319
|
+
*
|
|
320
|
+
* These are the characters the grapheme break rules of UAX #29 join to their neighbours: combining
|
|
321
|
+
* marks, the joiners, the Hangul jamo that build a syllable, the regional indicators that pair into
|
|
322
|
+
* a flag, and the carriage return that pairs with a line feed. Text with none of them has one
|
|
323
|
+
* cluster per codepoint, and does not need segmenting at all.
|
|
324
|
+
*/
|
|
325
|
+
async function canFormGraphemeCluster(): Promise<string> {
|
|
326
|
+
const set = regenerate.default();
|
|
327
|
+
for (const category of ['CR', 'Extend', 'L', 'LV', 'LVT', 'Prepend', 'Regional_Indicator', 'SpacingMark', 'T', 'V', 'ZWJ']) {
|
|
328
|
+
set.add((await import(`@unicode/unicode-${unicodeVersion}/Grapheme_Cluster_Break/${category}/code-points.js`)).default);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return set.toString();
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Returns a character class matching the scripts that do not put spaces between words.
|
|
336
|
+
*
|
|
337
|
+
* Text in these has no punctuation to break a line at, so the only way to wrap it is to ask the
|
|
338
|
+
* browser's word segmenter where the words are. Elsewhere the segmenter is the wrong tool: it
|
|
339
|
+
* isolates a comma as a word of its own, and a line must not begin with one.
|
|
340
|
+
*/
|
|
341
|
+
async function isWrittenWithoutSpaces(): Promise<string> {
|
|
342
|
+
const set = await createSet([], [
|
|
343
|
+
'Balinese',
|
|
344
|
+
'Javanese',
|
|
345
|
+
'Khmer',
|
|
346
|
+
'Lao',
|
|
347
|
+
'Myanmar',
|
|
348
|
+
'Thai',
|
|
349
|
+
'Tibetan',
|
|
350
|
+
]);
|
|
351
|
+
|
|
352
|
+
return set.toString();
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Returns a character class matching the characters that join the grapheme cluster they end to the
|
|
357
|
+
* one after it.
|
|
358
|
+
*
|
|
359
|
+
* An invisible stacker -- a virama and its equivalents in other scripts -- joins the consonant
|
|
360
|
+
* before it to the one after it, and a zero-width joiner does the same for emoji. `Intl.Segmenter`
|
|
361
|
+
* puts a cluster boundary after both, so the two halves have to be put back together.
|
|
362
|
+
*/
|
|
363
|
+
async function joinsToTheFollowingGrapheme(): Promise<string> {
|
|
364
|
+
const set = regenerate.default();
|
|
365
|
+
set.add((await import(`@unicode/unicode-${unicodeVersion}/Indic_Syllabic_Category/Invisible_Stacker/code-points.js`)).default);
|
|
366
|
+
set.add(0x200d);
|
|
367
|
+
|
|
368
|
+
return set.toString();
|
|
369
|
+
}
|
|
370
|
+
|
|
316
371
|
fs.writeFileSync('src/util/unicode_properties.g.ts',
|
|
317
372
|
`// This file is generated. Edit build/generate-unicode-data.ts, then run \`npm run generate-unicode-data\`.
|
|
318
373
|
|
|
@@ -367,4 +422,32 @@ export function codePointHasNeutralVerticalOrientation(codePoint: number): boole
|
|
|
367
422
|
export function codePointRequiresComplexTextShaping(codePoint: number): boolean {
|
|
368
423
|
return /${await requiresComplexTextShaping()}/gim.test(String.fromCodePoint(codePoint));
|
|
369
424
|
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Returns whether the text could hold a grapheme cluster of more than one codepoint, and so is worth
|
|
428
|
+
* segmenting. A negative answer means every codepoint of it stands alone.
|
|
429
|
+
*/
|
|
430
|
+
export function textCanContainGraphemeClusters(text: string): boolean {
|
|
431
|
+
return /${await canFormGraphemeCluster()}/.test(text);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Returns whether the given codepoint belongs to a script that does not put spaces between words,
|
|
436
|
+
* and so can only be wrapped by asking the word segmenter where its words are.
|
|
437
|
+
*/
|
|
438
|
+
export function codePointIsWrittenWithoutSpaces(codePoint: number): boolean {
|
|
439
|
+
return /${await isWrittenWithoutSpaces()}/gim.test(String.fromCodePoint(codePoint));
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Returns whether two grapheme clusters found by \`Intl.Segmenter\` are really one unit of writing,
|
|
444
|
+
* and so have to be measured and drawn as a whole.
|
|
445
|
+
*
|
|
446
|
+
* The segmenter follows the tailored rules CLDR uses for stepping a cursor through text, which put a
|
|
447
|
+
* boundary after an invisible stacker and before a spacing mark. Laying text out wants the untailored
|
|
448
|
+
* rules of UAX #29 instead: \`လ\`, \`ာ\` and \`း\` are one Burmese syllable, not three.
|
|
449
|
+
*/
|
|
450
|
+
export function canCombineGraphemes(former: string, latter: string): boolean {
|
|
451
|
+
return /(?:${await joinsToTheFollowingGrapheme()})$/.test(former) || /^\\p{gc=Mc}/u.test(latter);
|
|
452
|
+
}
|
|
370
453
|
`);
|