@tileflow/core 0.1.0-alpha.47 → 0.1.0-alpha.48
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 +33 -314
- package/REFERENCE.md +379 -0
- package/dist/browser.js +6796 -6795
- package/dist/build.d.ts +4 -4
- package/dist/build.js +175 -88
- package/dist/config-reference.json +245 -162
- package/dist/{icon-composition-CInvkr7s.d.ts → icon-composition-2nsUbE87.d.ts} +4 -50
- package/dist/index.d.ts +16 -6
- package/dist/index.js +281 -4
- package/dist/{manifest-types-CcD4OQkJ.d.ts → manifest-types-U7JPDNAo.d.ts} +128 -1
- package/dist/manifest.d.ts +2 -2
- package/dist/native.d.ts +99 -1
- package/dist/native.js +242 -4
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +281 -47
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -2252,7 +2252,13 @@ function mixTileflowColours(from, to, t) {
|
|
|
2252
2252
|
const a = oklab(from);
|
|
2253
2253
|
const b = oklab(to);
|
|
2254
2254
|
if (!a || !b) return void 0;
|
|
2255
|
-
|
|
2255
|
+
const alpha2 = a[3] + (b[3] - a[3]) * t;
|
|
2256
|
+
if (alpha2 <= 0) return "rgba(0, 0, 0, 0)";
|
|
2257
|
+
const channels = a.slice(0, 3).map((value, channel) => {
|
|
2258
|
+
const from2 = value * a[3];
|
|
2259
|
+
return (from2 + (b[channel] * b[3] - from2) * t) / alpha2;
|
|
2260
|
+
});
|
|
2261
|
+
return colourFromOklab([...channels, alpha2]);
|
|
2256
2262
|
}
|
|
2257
2263
|
function oklab(colour) {
|
|
2258
2264
|
const cached = oklabCache.get(colour);
|
|
@@ -5828,6 +5834,8 @@ var tileflowWorldLayerFields = Object.freeze({
|
|
|
5828
5834
|
name: { type: "String" },
|
|
5829
5835
|
"name_<lang>": { type: "String" },
|
|
5830
5836
|
name_latin: { type: "String" },
|
|
5837
|
+
network: { type: "String" },
|
|
5838
|
+
official: { type: "Number" },
|
|
5831
5839
|
oneway: { type: "Boolean" },
|
|
5832
5840
|
outer_radius_m: { type: "Number", required: true },
|
|
5833
5841
|
radius_m: { type: "Number", required: true },
|
|
@@ -14311,7 +14319,7 @@ function asRecord4(value) {
|
|
|
14311
14319
|
}
|
|
14312
14320
|
|
|
14313
14321
|
// src/overlays.ts
|
|
14314
|
-
|
|
14322
|
+
init_portable_identity_rules();
|
|
14315
14323
|
var tileflowOverlayPlacements = [
|
|
14316
14324
|
"above-water",
|
|
14317
14325
|
"below-roads",
|
|
@@ -14321,6 +14329,8 @@ var tileflowOverlayPlacements = [
|
|
|
14321
14329
|
"above-labels"
|
|
14322
14330
|
];
|
|
14323
14331
|
var tileflowHostedSourceLimit = 16;
|
|
14332
|
+
var tileflowInlineGeoJsonByteLimit = 512e3;
|
|
14333
|
+
var tileflowClusterMetadataKey = "tileflow:cluster";
|
|
14324
14334
|
var tilesetIdPattern = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u;
|
|
14325
14335
|
function hostedTileset(options) {
|
|
14326
14336
|
const attribution = options.attribution.trim();
|
|
@@ -14352,6 +14362,24 @@ function hostedTileset(options) {
|
|
|
14352
14362
|
type
|
|
14353
14363
|
});
|
|
14354
14364
|
}
|
|
14365
|
+
function geojsonSource(options = {}) {
|
|
14366
|
+
const data = options.data ?? { features: [], type: "FeatureCollection" };
|
|
14367
|
+
if (typeof data === "string") {
|
|
14368
|
+
if (!isHttpsUrl(data)) {
|
|
14369
|
+
throw new Error("Tileflow GeoJSON source URLs must be absolute https:// URLs.");
|
|
14370
|
+
}
|
|
14371
|
+
} else if (!isPlainRecord3(data) || data.type !== "FeatureCollection" || !Array.isArray(data.features)) {
|
|
14372
|
+
throw new Error("Tileflow GeoJSON source data must be a FeatureCollection or an https:// URL.");
|
|
14373
|
+
}
|
|
14374
|
+
assertClusterOptions(options);
|
|
14375
|
+
const attribution = options.attribution?.trim();
|
|
14376
|
+
return Object.freeze({
|
|
14377
|
+
...attribution ? { attribution } : {},
|
|
14378
|
+
...pickClusterOptions(options),
|
|
14379
|
+
data: typeof data === "string" ? data : Object.freeze(cloneJson18(data)),
|
|
14380
|
+
kind: "geojson"
|
|
14381
|
+
});
|
|
14382
|
+
}
|
|
14355
14383
|
function maplibreOverlay(options) {
|
|
14356
14384
|
if (!isTileflowPortableId(options.source)) {
|
|
14357
14385
|
throw new Error(`Invalid Tileflow overlay source ID: ${options.source}.`);
|
|
@@ -14389,6 +14417,109 @@ function maplibreOverlay(options) {
|
|
|
14389
14417
|
source: options.source
|
|
14390
14418
|
});
|
|
14391
14419
|
}
|
|
14420
|
+
function clusterOverlay(options) {
|
|
14421
|
+
const colors = options.colors ?? ["#2563eb", "#7c3aed", "#db2777"];
|
|
14422
|
+
const radii = options.radii ?? [16, 22, 30];
|
|
14423
|
+
const [low, high] = options.steps ?? [100, 750];
|
|
14424
|
+
if (!(low > 0 && high > low) || !radii.every((radius) => radius > 0)) {
|
|
14425
|
+
throw new Error("Tileflow cluster steps must increase and radii must be positive.");
|
|
14426
|
+
}
|
|
14427
|
+
const metadata = (role) => ({
|
|
14428
|
+
[tileflowClusterMetadataKey]: {
|
|
14429
|
+
expandOnClick: options.expandOnClick ?? true,
|
|
14430
|
+
role
|
|
14431
|
+
}
|
|
14432
|
+
});
|
|
14433
|
+
const step2 = (values) => [
|
|
14434
|
+
"step",
|
|
14435
|
+
["get", "point_count"],
|
|
14436
|
+
values[0],
|
|
14437
|
+
low,
|
|
14438
|
+
values[1],
|
|
14439
|
+
high,
|
|
14440
|
+
values[2]
|
|
14441
|
+
];
|
|
14442
|
+
return maplibreOverlay({
|
|
14443
|
+
layers: [
|
|
14444
|
+
{
|
|
14445
|
+
filter: ["has", "point_count"],
|
|
14446
|
+
id: `${options.id}-clusters`,
|
|
14447
|
+
metadata: metadata("cluster"),
|
|
14448
|
+
paint: {
|
|
14449
|
+
"circle-color": step2(colors),
|
|
14450
|
+
"circle-radius": step2(radii),
|
|
14451
|
+
"circle-stroke-color": "#ffffff",
|
|
14452
|
+
"circle-stroke-width": 2
|
|
14453
|
+
},
|
|
14454
|
+
type: "circle"
|
|
14455
|
+
},
|
|
14456
|
+
{
|
|
14457
|
+
filter: ["has", "point_count"],
|
|
14458
|
+
id: `${options.id}-cluster-count`,
|
|
14459
|
+
layout: {
|
|
14460
|
+
"text-allow-overlap": true,
|
|
14461
|
+
"text-field": ["get", "point_count_abbreviated"],
|
|
14462
|
+
...options.font ? { "text-font": [...options.font] } : {},
|
|
14463
|
+
"text-ignore-placement": true,
|
|
14464
|
+
"text-size": 13
|
|
14465
|
+
},
|
|
14466
|
+
metadata: metadata("count"),
|
|
14467
|
+
paint: { "text-color": options.textColor ?? "#ffffff" },
|
|
14468
|
+
type: "symbol"
|
|
14469
|
+
},
|
|
14470
|
+
{
|
|
14471
|
+
filter: ["!", ["has", "point_count"]],
|
|
14472
|
+
id: `${options.id}-points`,
|
|
14473
|
+
metadata: metadata("point"),
|
|
14474
|
+
paint: {
|
|
14475
|
+
"circle-color": options.pointColor ?? colors[0],
|
|
14476
|
+
"circle-radius": 6,
|
|
14477
|
+
"circle-stroke-color": "#ffffff",
|
|
14478
|
+
"circle-stroke-width": 1.5
|
|
14479
|
+
},
|
|
14480
|
+
type: "circle"
|
|
14481
|
+
}
|
|
14482
|
+
],
|
|
14483
|
+
placement: options.placement,
|
|
14484
|
+
source: options.source
|
|
14485
|
+
});
|
|
14486
|
+
}
|
|
14487
|
+
function heatmapOverlay(options) {
|
|
14488
|
+
const colors = options.colors ?? [
|
|
14489
|
+
[0, "rgba(33, 102, 172, 0)"],
|
|
14490
|
+
[0.2, "#67a9cf"],
|
|
14491
|
+
[0.4, "#d1e5f0"],
|
|
14492
|
+
[0.6, "#fddbc7"],
|
|
14493
|
+
[0.8, "#ef8a62"],
|
|
14494
|
+
[1, "#b2182b"]
|
|
14495
|
+
];
|
|
14496
|
+
if (colors.length < 2 || colors.some(([density], index) => {
|
|
14497
|
+
const previous = colors[index - 1]?.[0] ?? -1;
|
|
14498
|
+
return !(density >= 0 && density <= 1 && density > previous);
|
|
14499
|
+
})) {
|
|
14500
|
+
throw new Error("Tileflow heatmap colors need at least two increasing densities from 0 to 1.");
|
|
14501
|
+
}
|
|
14502
|
+
const paint = {
|
|
14503
|
+
"heatmap-color": ["interpolate", ["linear"], ["heatmap-density"], ...colors.flat()],
|
|
14504
|
+
"heatmap-intensity": options.intensity ?? 1,
|
|
14505
|
+
"heatmap-opacity": options.opacity ?? 0.8,
|
|
14506
|
+
"heatmap-radius": options.radius ?? 30,
|
|
14507
|
+
"heatmap-weight": options.weight ?? 1
|
|
14508
|
+
};
|
|
14509
|
+
return maplibreOverlay({
|
|
14510
|
+
layers: [
|
|
14511
|
+
{
|
|
14512
|
+
id: options.id,
|
|
14513
|
+
...options.maxZoom === void 0 ? {} : { maxzoom: options.maxZoom },
|
|
14514
|
+
paint,
|
|
14515
|
+
...options.sourceLayer === void 0 ? {} : { "source-layer": options.sourceLayer },
|
|
14516
|
+
type: "heatmap"
|
|
14517
|
+
}
|
|
14518
|
+
],
|
|
14519
|
+
placement: options.placement,
|
|
14520
|
+
source: options.source
|
|
14521
|
+
});
|
|
14522
|
+
}
|
|
14392
14523
|
function remove() {
|
|
14393
14524
|
return Object.freeze({ op: "remove" });
|
|
14394
14525
|
}
|
|
@@ -14430,6 +14561,10 @@ function resolveTileflowHostedSources(mapId, sources, reservedSourceIds) {
|
|
|
14430
14561
|
`Source ID "${sourceId}" conflicts with a Tileflow source.`
|
|
14431
14562
|
);
|
|
14432
14563
|
}
|
|
14564
|
+
if (source.kind === "geojson") {
|
|
14565
|
+
definitions[sourceId] = createTileflowGeoJsonSourceDefinition(source);
|
|
14566
|
+
continue;
|
|
14567
|
+
}
|
|
14433
14568
|
const duplicate = tilesets.get(source.tileset);
|
|
14434
14569
|
if (duplicate) {
|
|
14435
14570
|
throw new TileflowOverlayCompilationError(
|
|
@@ -14454,8 +14589,17 @@ function resolveTileflowHostedSources(mapId, sources, reservedSourceIds) {
|
|
|
14454
14589
|
}
|
|
14455
14590
|
return { definitions, identities };
|
|
14456
14591
|
}
|
|
14592
|
+
function createTileflowGeoJsonSourceDefinition(source) {
|
|
14593
|
+
return {
|
|
14594
|
+
...source.attribution === void 0 ? {} : { attribution: source.attribution },
|
|
14595
|
+
...pickClusterOptions(source),
|
|
14596
|
+
data: cloneJson18(source.data),
|
|
14597
|
+
type: "geojson"
|
|
14598
|
+
};
|
|
14599
|
+
}
|
|
14457
14600
|
function insertTileflowOverlays(input) {
|
|
14458
14601
|
const availableSources = new Set(input.sourceIds);
|
|
14602
|
+
const labelFont = readTileflowLabelFont(input.basemapLayers);
|
|
14459
14603
|
const identities = {};
|
|
14460
14604
|
const groups = /* @__PURE__ */ new Map();
|
|
14461
14605
|
const layerIds = new Set(
|
|
@@ -14483,8 +14627,17 @@ function insertTileflowOverlays(input) {
|
|
|
14483
14627
|
);
|
|
14484
14628
|
}
|
|
14485
14629
|
layerIds.add(layer.id);
|
|
14630
|
+
if (readClusterRole(layer) && input.sourceDefinitions?.[overlay.source]?.cluster !== true) {
|
|
14631
|
+
throw new TileflowOverlayCompilationError(
|
|
14632
|
+
"TF_OVERLAY_CLUSTER_SOURCE_INVALID",
|
|
14633
|
+
`${path}.source`,
|
|
14634
|
+
`Cluster overlay "${overlayId}" needs a GeoJSON source declared with cluster: true.`,
|
|
14635
|
+
`Use geojsonSource({cluster: true}) for source "${overlay.source}".`
|
|
14636
|
+
);
|
|
14637
|
+
}
|
|
14638
|
+
const label = readClusterRole(layer) === "count" ? withLabelFont(layer, labelFont, path) : layer;
|
|
14486
14639
|
return {
|
|
14487
|
-
...cloneJson18(
|
|
14640
|
+
...cloneJson18(label),
|
|
14488
14641
|
source: overlay.source,
|
|
14489
14642
|
metadata: {
|
|
14490
14643
|
...isPlainRecord3(layer.metadata) ? cloneJson18(layer.metadata) : {},
|
|
@@ -14508,6 +14661,74 @@ function insertTileflowOverlays(input) {
|
|
|
14508
14661
|
}
|
|
14509
14662
|
return { identities, layers: layers2 };
|
|
14510
14663
|
}
|
|
14664
|
+
function readTileflowLabelFont(layers2) {
|
|
14665
|
+
for (const layer of layers2) {
|
|
14666
|
+
const font = isPlainRecord3(layer.layout) ? layer.layout["text-font"] : void 0;
|
|
14667
|
+
if (Array.isArray(font) && font.length > 0 && font.every((face) => typeof face === "string" && !parseTileflowLineBackgroundFontStack(face))) {
|
|
14668
|
+
return font;
|
|
14669
|
+
}
|
|
14670
|
+
}
|
|
14671
|
+
return void 0;
|
|
14672
|
+
}
|
|
14673
|
+
function readClusterRole(layer) {
|
|
14674
|
+
const metadata = isPlainRecord3(layer.metadata) ? layer.metadata : void 0;
|
|
14675
|
+
const cluster = metadata?.[tileflowClusterMetadataKey];
|
|
14676
|
+
return isPlainRecord3(cluster) ? cluster.role : void 0;
|
|
14677
|
+
}
|
|
14678
|
+
function withLabelFont(layer, font, path) {
|
|
14679
|
+
const layout = layer.layout;
|
|
14680
|
+
if (layout["text-font"] !== void 0) return layer;
|
|
14681
|
+
if (!font) {
|
|
14682
|
+
throw new TileflowOverlayCompilationError(
|
|
14683
|
+
"TF_OVERLAY_FONT_UNAVAILABLE",
|
|
14684
|
+
`${path}.font`,
|
|
14685
|
+
`Cluster count layer "${layer.id}" has no label font to share.`,
|
|
14686
|
+
"Pass font to clusterOverlay() with a stack the map declares."
|
|
14687
|
+
);
|
|
14688
|
+
}
|
|
14689
|
+
return { ...layer, layout: { ...layout, "text-font": [...font] } };
|
|
14690
|
+
}
|
|
14691
|
+
function pickClusterOptions(source) {
|
|
14692
|
+
return {
|
|
14693
|
+
...source.cluster === void 0 ? {} : { cluster: source.cluster },
|
|
14694
|
+
...source.clusterMaxZoom === void 0 ? {} : { clusterMaxZoom: source.clusterMaxZoom },
|
|
14695
|
+
...source.clusterMinPoints === void 0 ? {} : { clusterMinPoints: source.clusterMinPoints },
|
|
14696
|
+
...source.clusterProperties === void 0 ? {} : { clusterProperties: cloneJson18(source.clusterProperties) },
|
|
14697
|
+
...source.clusterRadius === void 0 ? {} : { clusterRadius: source.clusterRadius }
|
|
14698
|
+
};
|
|
14699
|
+
}
|
|
14700
|
+
function assertClusterOptions(options) {
|
|
14701
|
+
const { cluster, clusterMaxZoom, clusterMinPoints, clusterProperties, clusterRadius } = options;
|
|
14702
|
+
if (cluster !== void 0 && typeof cluster !== "boolean") {
|
|
14703
|
+
throw new Error("Tileflow GeoJSON cluster must be a boolean.");
|
|
14704
|
+
}
|
|
14705
|
+
if (clusterRadius !== void 0 && !(Number.isFinite(clusterRadius) && clusterRadius > 0)) {
|
|
14706
|
+
throw new Error("Tileflow clusterRadius must be a positive number of pixels.");
|
|
14707
|
+
}
|
|
14708
|
+
if (clusterMaxZoom !== void 0 && !(Number.isFinite(clusterMaxZoom) && clusterMaxZoom >= 0 && clusterMaxZoom <= 24)) {
|
|
14709
|
+
throw new Error("Tileflow clusterMaxZoom must be a zoom from 0 to 24.");
|
|
14710
|
+
}
|
|
14711
|
+
if (clusterMinPoints !== void 0 && !(Number.isInteger(clusterMinPoints) && clusterMinPoints >= 2)) {
|
|
14712
|
+
throw new Error("Tileflow clusterMinPoints must be an integer of at least 2.");
|
|
14713
|
+
}
|
|
14714
|
+
if (!cluster && [clusterMaxZoom, clusterMinPoints, clusterProperties, clusterRadius].some(
|
|
14715
|
+
(value) => value !== void 0
|
|
14716
|
+
)) {
|
|
14717
|
+
throw new Error("Tileflow cluster options require cluster: true.");
|
|
14718
|
+
}
|
|
14719
|
+
for (const [name, value] of Object.entries(clusterProperties ?? {})) {
|
|
14720
|
+
if (!Array.isArray(value) || value.length !== 2) {
|
|
14721
|
+
throw new Error(`Tileflow clusterProperties.${name} must be [operator, mapExpression].`);
|
|
14722
|
+
}
|
|
14723
|
+
}
|
|
14724
|
+
}
|
|
14725
|
+
function isHttpsUrl(value) {
|
|
14726
|
+
try {
|
|
14727
|
+
return new URL(value).protocol === "https:";
|
|
14728
|
+
} catch {
|
|
14729
|
+
return false;
|
|
14730
|
+
}
|
|
14731
|
+
}
|
|
14511
14732
|
function isSafeLocalPmtilesPath(value) {
|
|
14512
14733
|
if (typeof value !== "string" || value.length > 512 || !value.endsWith(".pmtiles") || value.includes("\\") || /[\p{Cc}?#]/u.test(value)) {
|
|
14513
14734
|
return false;
|
|
@@ -19639,7 +19860,30 @@ var hostedTilesetSourceSchema = z7.object({
|
|
|
19639
19860
|
});
|
|
19640
19861
|
}
|
|
19641
19862
|
});
|
|
19642
|
-
var
|
|
19863
|
+
var geojsonFeatureCollectionSchema = z7.object({
|
|
19864
|
+
features: z7.array(z7.record(z7.string(), z7.unknown())),
|
|
19865
|
+
type: z7.literal("FeatureCollection")
|
|
19866
|
+
}).refine(
|
|
19867
|
+
(data) => new TextEncoder().encode(JSON.stringify(data)).byteLength <= tileflowInlineGeoJsonByteLimit,
|
|
19868
|
+
`Expected at most ${tileflowInlineGeoJsonByteLimit} bytes of inline GeoJSON`
|
|
19869
|
+
);
|
|
19870
|
+
var geojsonSourceSchema = z7.object({
|
|
19871
|
+
attribution: z7.string().trim().min(1).max(4096).optional(),
|
|
19872
|
+
cluster: z7.boolean().optional(),
|
|
19873
|
+
clusterMaxZoom: z7.number().min(0).max(24).optional(),
|
|
19874
|
+
clusterMinPoints: z7.number().int().min(2).optional(),
|
|
19875
|
+
clusterProperties: z7.record(z7.string(), z7.tuple([z7.unknown(), z7.unknown()])).optional(),
|
|
19876
|
+
clusterRadius: z7.number().positive().optional(),
|
|
19877
|
+
data: z7.union([
|
|
19878
|
+
geojsonFeatureCollectionSchema,
|
|
19879
|
+
z7.string().refine((value) => value.startsWith("https://"), "Expected an https:// URL")
|
|
19880
|
+
]),
|
|
19881
|
+
kind: z7.literal("geojson")
|
|
19882
|
+
}).strict();
|
|
19883
|
+
var hostedSourcesSchema = z7.record(
|
|
19884
|
+
tileflowMapIdSchema,
|
|
19885
|
+
z7.discriminatedUnion("kind", [hostedTilesetSourceSchema, geojsonSourceSchema])
|
|
19886
|
+
).superRefine((sources, context) => {
|
|
19643
19887
|
if (Object.keys(sources).length > tileflowHostedSourceLimit) {
|
|
19644
19888
|
context.addIssue({
|
|
19645
19889
|
code: "too_big",
|
|
@@ -22531,6 +22775,7 @@ function compileSemanticStyleInternal(input, options, inspect, onReport) {
|
|
|
22531
22775
|
basemapLayers,
|
|
22532
22776
|
mapId: config.id,
|
|
22533
22777
|
overlays: validateBoundaryChoroplethOverlays(config.id, config.overlays, boundaryAreas),
|
|
22778
|
+
sourceDefinitions: hostedSources.definitions,
|
|
22534
22779
|
sourceIds: [
|
|
22535
22780
|
...Object.keys(hostedSources.definitions),
|
|
22536
22781
|
...boundaryAreas ? [boundaryAreas.sourceId] : []
|
|
@@ -23854,6 +24099,24 @@ var operations = [
|
|
|
23854
24099
|
name: "hosted-source",
|
|
23855
24100
|
scope: "resource"
|
|
23856
24101
|
},
|
|
24102
|
+
{
|
|
24103
|
+
api: "sources.<id> = geojsonSource({ data?, cluster?, clusterRadius?, ... })",
|
|
24104
|
+
description: "Declare GeoJSON that clusters, or a source the application fills at runtime.",
|
|
24105
|
+
name: "geojson-source",
|
|
24106
|
+
scope: "resource"
|
|
24107
|
+
},
|
|
24108
|
+
{
|
|
24109
|
+
api: "overlays.<id> = clusterOverlay({ id, source, placement })",
|
|
24110
|
+
description: "Draw a clustering GeoJSON source: bubbles, counts, and separate points.",
|
|
24111
|
+
name: "cluster-overlay",
|
|
24112
|
+
scope: "resource"
|
|
24113
|
+
},
|
|
24114
|
+
{
|
|
24115
|
+
api: "overlays.<id> = heatmapOverlay({ id, source, placement, weight? })",
|
|
24116
|
+
description: "Draw point density from a GeoJSON source or a hosted vector tileset.",
|
|
24117
|
+
name: "heatmap-overlay",
|
|
24118
|
+
scope: "resource"
|
|
24119
|
+
},
|
|
23857
24120
|
{
|
|
23858
24121
|
api: "overlays.<id> = maplibreOverlay({ source, placement, layers })",
|
|
23859
24122
|
description: "Place one ordered group of validated MapLibre Style Layers.",
|
|
@@ -24296,8 +24559,18 @@ var tileflowAuthoringManifest = deepFreeze2({
|
|
|
24296
24559
|
localResolution: "explicit-relative-pmtiles",
|
|
24297
24560
|
maxPerMap: tileflowHostedSourceLimit
|
|
24298
24561
|
},
|
|
24562
|
+
geojsonSources: {
|
|
24563
|
+
api: "geojsonSource({ data?, attribution?, cluster?, clusterRadius?, clusterMaxZoom?, clusterMinPoints?, clusterProperties? })",
|
|
24564
|
+
data: "inline-feature-collection-or-https-url",
|
|
24565
|
+
maxInlineBytes: tileflowInlineGeoJsonByteLimit,
|
|
24566
|
+
maxPerMap: tileflowHostedSourceLimit
|
|
24567
|
+
},
|
|
24299
24568
|
overlays: {
|
|
24300
24569
|
api: "maplibreOverlay({ source, placement, layers })",
|
|
24570
|
+
helpers: [
|
|
24571
|
+
"clusterOverlay({ id, source, placement })",
|
|
24572
|
+
"heatmapOverlay({ id, source, placement })"
|
|
24573
|
+
],
|
|
24301
24574
|
layers: "ordered-maplibre-style-layers-without-source",
|
|
24302
24575
|
placement: tileflowOverlayPlacements,
|
|
24303
24576
|
replacement: "atomic-by-overlay-id"
|
|
@@ -28049,6 +28322,7 @@ export {
|
|
|
28049
28322
|
choroplethScale,
|
|
28050
28323
|
classifyTileflowVisualProperty,
|
|
28051
28324
|
clearTileflowManifestCache,
|
|
28325
|
+
clusterOverlay,
|
|
28052
28326
|
collectTileflowIconSetReferences,
|
|
28053
28327
|
color,
|
|
28054
28328
|
compareCodeUnits11 as compareCodeUnits,
|
|
@@ -28075,12 +28349,14 @@ export {
|
|
|
28075
28349
|
expr,
|
|
28076
28350
|
field,
|
|
28077
28351
|
fixed,
|
|
28352
|
+
geojsonSource,
|
|
28078
28353
|
getTileflowAnalyticsApiUrl,
|
|
28079
28354
|
getTileflowStyleFontFaces,
|
|
28080
28355
|
hashTileflowFontBundleManifest,
|
|
28081
28356
|
hashTileflowIconComposition,
|
|
28082
28357
|
hashTileflowIconPackageManifest,
|
|
28083
28358
|
hashTileflowRenderedIconPixels,
|
|
28359
|
+
heatmapOverlay,
|
|
28084
28360
|
hostedTileset,
|
|
28085
28361
|
iconSet,
|
|
28086
28362
|
inferTileflowAnalyticsFromStyleUrl,
|
|
@@ -28253,6 +28529,7 @@ export {
|
|
|
28253
28529
|
tileflowIconsLockfileMaximumBytes,
|
|
28254
28530
|
tileflowIconsLockfileName,
|
|
28255
28531
|
tileflowIconsLockfileSchema,
|
|
28532
|
+
tileflowInlineGeoJsonByteLimit,
|
|
28256
28533
|
tileflowInsideRings,
|
|
28257
28534
|
tileflowLandformClasses,
|
|
28258
28535
|
tileflowLandmarkRegionOf,
|
|
@@ -87,6 +87,133 @@ declare const zoom: {
|
|
|
87
87
|
step<T>(stops: readonly (readonly [number, T])[]): TileflowZoomValue<T>;
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
+
declare const tileflowOverlayPlacements: readonly ["above-water", "below-roads", "above-roads", "above-buildings", "below-labels", "above-labels"];
|
|
91
|
+
declare const tileflowHostedSourceLimit: 16;
|
|
92
|
+
/** Larger data belongs behind a URL or in runtime `dataSources`, not in every compiled style. */
|
|
93
|
+
declare const tileflowInlineGeoJsonByteLimit: 512000;
|
|
94
|
+
type TileflowOverlayPlacement = (typeof tileflowOverlayPlacements)[number];
|
|
95
|
+
type TileflowHostedTilesetType = 'raster' | 'vector';
|
|
96
|
+
type TileflowHostedTilesetSource = Readonly<{
|
|
97
|
+
attribution: string;
|
|
98
|
+
kind: 'hosted-tileset';
|
|
99
|
+
local: string;
|
|
100
|
+
tileset: string;
|
|
101
|
+
tileSize?: 256 | 512;
|
|
102
|
+
type: TileflowHostedTilesetType;
|
|
103
|
+
}>;
|
|
104
|
+
/**
|
|
105
|
+
* A GeoJSON FeatureCollection, the shape MapLibre clustering and `setData` accept. Features are
|
|
106
|
+
* plain objects because typed GeoJSON interfaces, such as `Feature<Point>`, have no index signature.
|
|
107
|
+
*/
|
|
108
|
+
type TileflowGeoJsonFeatureCollection = Readonly<{
|
|
109
|
+
features: readonly object[];
|
|
110
|
+
type: 'FeatureCollection';
|
|
111
|
+
}>;
|
|
112
|
+
/** MapLibre aggregate: `[operator, mapExpression]`, summed into each cluster's properties. */
|
|
113
|
+
type TileflowClusterProperty = readonly [operator: unknown, map: unknown];
|
|
114
|
+
/** Clustering options named as in the Mapbox and MapLibre source specifications. */
|
|
115
|
+
type TileflowGeoJsonClusterOptions = Readonly<{
|
|
116
|
+
/** Group nearby points in the worker. Defaults to false. */
|
|
117
|
+
cluster?: boolean;
|
|
118
|
+
/** The last zoom that clusters; points are separate above it. MapLibre's default is 14. */
|
|
119
|
+
clusterMaxZoom?: number;
|
|
120
|
+
/** The fewest points that form a cluster. MapLibre's default is 2. */
|
|
121
|
+
clusterMinPoints?: number;
|
|
122
|
+
/** Aggregates kept on clusters, such as `{total: ['+', ['get', 'price']]}`. */
|
|
123
|
+
clusterProperties?: Readonly<Record<string, TileflowClusterProperty>>;
|
|
124
|
+
/** Cluster radius in CSS pixels. MapLibre's default is 50. */
|
|
125
|
+
clusterRadius?: number;
|
|
126
|
+
}>;
|
|
127
|
+
type TileflowGeoJsonSource = Readonly<TileflowGeoJsonClusterOptions & {
|
|
128
|
+
attribution?: string;
|
|
129
|
+
data: TileflowGeoJsonFeatureCollection | string;
|
|
130
|
+
kind: 'geojson';
|
|
131
|
+
}>;
|
|
132
|
+
type TileflowSource = TileflowGeoJsonSource | TileflowHostedTilesetSource;
|
|
133
|
+
type TileflowMapLibreOverlayLayer = Readonly<Record<string, unknown> & {
|
|
134
|
+
id: string;
|
|
135
|
+
source?: never;
|
|
136
|
+
type: string;
|
|
137
|
+
}>;
|
|
138
|
+
type TileflowMapLibreOverlay = Readonly<{
|
|
139
|
+
kind: 'maplibre-overlay';
|
|
140
|
+
layers: readonly TileflowMapLibreOverlayLayer[];
|
|
141
|
+
placement: TileflowOverlayPlacement;
|
|
142
|
+
source: string;
|
|
143
|
+
}>;
|
|
144
|
+
type TileflowRemoveOperation = Readonly<{
|
|
145
|
+
op: 'remove';
|
|
146
|
+
}>;
|
|
147
|
+
type TileflowHostedSourceCollection = Readonly<Record<string, TileflowSource | TileflowRemoveOperation>>;
|
|
148
|
+
type TileflowOverlayCollection = Readonly<Record<string, TileflowMapLibreOverlay | TileflowRemoveOperation>>;
|
|
149
|
+
/** Bind one logical Team tileset to an explicit account-free local PMTiles archive. */
|
|
150
|
+
declare function hostedTileset(options: {
|
|
151
|
+
attribution: string;
|
|
152
|
+
local: string;
|
|
153
|
+
tileset: string;
|
|
154
|
+
tileSize?: 256 | 512;
|
|
155
|
+
type?: TileflowHostedTilesetType;
|
|
156
|
+
}): TileflowHostedTilesetSource;
|
|
157
|
+
/**
|
|
158
|
+
* Declare a named GeoJSON source. Omit `data` for a source the application fills at runtime through
|
|
159
|
+
* a framework adapter's `dataSources`.
|
|
160
|
+
*/
|
|
161
|
+
declare function geojsonSource(options?: Readonly<TileflowGeoJsonClusterOptions & {
|
|
162
|
+
attribution?: string;
|
|
163
|
+
data?: TileflowGeoJsonFeatureCollection | string;
|
|
164
|
+
}>): TileflowGeoJsonSource;
|
|
165
|
+
/** Group one or more ordinary MapLibre layers around one named Tileflow source. */
|
|
166
|
+
declare function maplibreOverlay(options: {
|
|
167
|
+
layers: readonly TileflowMapLibreOverlayLayer[];
|
|
168
|
+
placement: TileflowOverlayPlacement;
|
|
169
|
+
source: string;
|
|
170
|
+
}): TileflowMapLibreOverlay;
|
|
171
|
+
/**
|
|
172
|
+
* Draw a clustering GeoJSON source: sized bubbles, their counts, and the separate points. Layers are
|
|
173
|
+
* named `<id>-clusters`, `<id>-cluster-count` and `<id>-points`. The count uses the map's label font
|
|
174
|
+
* unless `font` names another. Framework adapters zoom into a clicked cluster.
|
|
175
|
+
*/
|
|
176
|
+
declare function clusterOverlay(options: {
|
|
177
|
+
/** Bubble colours by point count: the first applies below `steps[0]`. */
|
|
178
|
+
colors?: readonly [string, string, string];
|
|
179
|
+
/** Zoom in when a cluster is clicked or tapped. Defaults to true. */
|
|
180
|
+
expandOnClick?: boolean;
|
|
181
|
+
/** An exact text-font stack, for maps whose labels use another font. */
|
|
182
|
+
font?: readonly string[];
|
|
183
|
+
id: string;
|
|
184
|
+
placement: TileflowOverlayPlacement;
|
|
185
|
+
/** Colour of the separate points. */
|
|
186
|
+
pointColor?: string;
|
|
187
|
+
/** Bubble radii in pixels, matching `colors`. */
|
|
188
|
+
radii?: readonly [number, number, number];
|
|
189
|
+
source: string;
|
|
190
|
+
/** The two point counts where bubbles change size and colour. */
|
|
191
|
+
steps?: readonly [number, number];
|
|
192
|
+
textColor?: string;
|
|
193
|
+
}): TileflowMapLibreOverlay;
|
|
194
|
+
/**
|
|
195
|
+
* Draw point density from a GeoJSON source or a hosted vector tileset. `weight` is a number or a
|
|
196
|
+
* MapLibre expression; values above 1 make a point count for more than one.
|
|
197
|
+
*/
|
|
198
|
+
declare function heatmapOverlay(options: {
|
|
199
|
+
/** `[density, color]` stops from 0 to 1. Start transparent so empty areas stay clear. */
|
|
200
|
+
colors?: readonly (readonly [density: number, color: string])[];
|
|
201
|
+
id: string;
|
|
202
|
+
intensity?: unknown;
|
|
203
|
+
/** Above this zoom the layer is not drawn, for handing over to points or clusters. */
|
|
204
|
+
maxZoom?: number;
|
|
205
|
+
opacity?: unknown;
|
|
206
|
+
placement: TileflowOverlayPlacement;
|
|
207
|
+
radius?: unknown;
|
|
208
|
+
source: string;
|
|
209
|
+
/** The source-layer of a vector tileset. GeoJSON sources have none. */
|
|
210
|
+
sourceLayer?: string;
|
|
211
|
+
weight?: unknown;
|
|
212
|
+
}): TileflowMapLibreOverlay;
|
|
213
|
+
/** Remove one inherited keyed source or overlay. */
|
|
214
|
+
declare function remove(): TileflowRemoveOperation;
|
|
215
|
+
declare function isSafeLocalPmtilesPath(value: unknown): value is string;
|
|
216
|
+
|
|
90
217
|
/** A color literal, semantic color token, color operation, expression, or zoom ramp. */
|
|
91
218
|
type TileflowColorStyleValue = TileflowExpression<string> | TileflowThemeColorValue | TileflowZoomValue<TileflowThemeColorValue>;
|
|
92
219
|
/** An image name, semantic image token, expression, or zoom ramp. */
|
|
@@ -1009,4 +1136,4 @@ type TileflowRuntimeManifest = {
|
|
|
1009
1136
|
version: typeof tileflowRuntimeManifestVersion | typeof tileflowTimeOfDayManifestVersion | typeof tileflowFamilyManifestVersion;
|
|
1010
1137
|
};
|
|
1011
1138
|
|
|
1012
|
-
export { type
|
|
1139
|
+
export { type TileflowFillPaint as $, type TileflowExtrusionStyle as A, type TileflowFillStyle as B, type TileflowLineStyle as C, type TileflowSymbolStyle as D, tileflowHostedSourceLimit as E, tileflowInlineGeoJsonByteLimit as F, tileflowOverlayPlacements as G, type TileflowRoadsModuleOptions as H, type TileflowRoadsModuleConfig as I, type TileflowLabelsModuleOptions as J, type TileflowLabelsModuleConfig as K, type TileflowPoiModuleOptions as L, type MapLibreStyle as M, type TileflowPoiModuleConfig as N, type MapLibreSprite as O, type TileflowAerodromeCodeDetail as P, type TileflowAlignment as Q, type TileflowAnalytics as R, type TileflowAreaStyle as S, type TileflowRuntimeManifest as T, type TileflowBackgroundPaint as U, type ValidationMessage as V, type TileflowCirclePaint as W, type TileflowClusterProperty as X, type TileflowColor as Y, type TileflowColorStyleValue as Z, type TileflowExtrusionPaint as _, type TileflowRuntimeColorScheme as a, type TileflowRoadTreatmentLineStyle as a$, type TileflowGeoJsonClusterOptions as a0, type TileflowGeoJsonFeatureCollection as a1, type TileflowGeoJsonSource as a2, type TileflowHostedSourceCollection as a3, type TileflowHostedTilesetSource as a4, type TileflowHostedTilesetType as a5, type TileflowIconAnchor as a6, type TileflowIconLayout as a7, type TileflowIconPaint as a8, type TileflowIconStyle as a9, type TileflowPoiColorMode as aA, type TileflowPoiDensity as aB, type TileflowPoiPlacementOrder as aC, type TileflowPriorityOrder as aD, type TileflowProjection as aE, type TileflowRemoveOperation as aF, type TileflowResolvedRuntimeTheme as aG, type TileflowRoadAreaStyle as aH, type TileflowRoadClass as aI, type TileflowRoadClassStyle as aJ, type TileflowRoadCrossingStyle as aK, type TileflowRoadDetail as aL, type TileflowRoadExtras as aM, type TileflowRoadHierarchy as aN, type TileflowRoadLabelDetail as aO, type TileflowRoadLayerStyle as aP, type TileflowRoadModifier as aQ, type TileflowRoadOutline as aR, type TileflowRoadRestriction as aS, type TileflowRoadRoundaboutStyle as aT, type TileflowRoadServiceType as aU, type TileflowRoadShieldDetail as aV, type TileflowRoadShieldStyles as aW, type TileflowRoadSidewalkStyle as aX, type TileflowRoadStreetLightStyle as aY, type TileflowRoadStructure as aZ, type TileflowRoadTreatmentLayerStyle as a_, type TileflowIconTextFit as aa, type TileflowImageStyleValue as ab, type TileflowLabelDetail as ac, type TileflowLabelLanguage as ad, type TileflowLabelStyles as ae, type TileflowLayerRange as af, type TileflowLight as ag, type TileflowLineCap as ah, type TileflowLineHatchStyle as ai, type TileflowLineJoin as aj, type TileflowLineLayout as ak, type TileflowLinePaint as al, type TileflowLineStackStyle as am, type TileflowManifestFetchOptions as an, type TileflowManifestLoadOptions as ao, type TileflowMapLibreOverlayLayer as ap, type TileflowMapMode as aq, type TileflowMapModeOptions as ar, type TileflowMarkerSymbolStyle as as, type TileflowMountainBikeScale as at, type TileflowNumberInsetsStyleValue as au, type TileflowNumberStyleValue as av, type TileflowOverlayCollection as aw, type TileflowPlaceLabelClass as ax, type TileflowPoiCategory as ay, type TileflowPoiCategoryStyle as az, type TileflowRuntimeManifestMapEntry as b, hostedTileset as b$, type TileflowRoadTreatmentStyle as b0, type TileflowRoadWeight as b1, type TileflowRuntimeCenterLike as b2, type TileflowRuntimeManifestMap as b3, type TileflowRuntimeSource as b4, type TileflowRuntimeSourceValidation as b5, type TileflowRuntimeStyle as b6, type TileflowRuntimeStyleOptions as b7, type TileflowRuntimeViewOptions as b8, type TileflowSessionController as b9, type TileflowThemeColorAlpha as bA, type TileflowThemeColorMix as bB, type TileflowThemeColorValue as bC, type TileflowThemeFontValue as bD, type TileflowThemeImageValue as bE, type TileflowThemeNumberValue as bF, type TileflowThemeSelection as bG, type TileflowThemeTokenCategory as bH, type TileflowThemeValue as bI, type TileflowViewConfig as bJ, type TileflowWaterLabelClass as bK, type TileflowZoomInterpolation as bL, type TileflowZoomValue as bM, type ValidationResult as bN, assertValidTileflowRuntimeSource as bO, clearTileflowManifestCache as bP, clusterOverlay as bQ, color as bR, createTileflowSessionController as bS, createTileflowSessionId as bT, defaultTileflowManifestUrl as bU, defaultTileflowRuntimeView as bV, fixed as bW, geojsonSource as bX, getTileflowAnalyticsApiUrl as bY, getTileflowStyleFontFaces as bZ, heatmapOverlay as b_, type TileflowSessionGrantResponse as ba, type TileflowSource as bb, type TileflowStringStyleValue as bc, type TileflowStructuralStyleValue as bd, type TileflowStyleFontFace as be, type TileflowStyleValue as bf, type TileflowSymbolOverlap as bg, type TileflowSymbolPlacement as bh, type TileflowSymbolPlacementStyle as bi, type TileflowSymbolZOrder as bj, type TileflowTerrain as bk, type TileflowTerrainConfig as bl, type TileflowTerrainContourLabelStyle as bm, type TileflowTerrainContourLineStyle as bn, type TileflowTerrainContoursConfig as bo, type TileflowTerrainEncoding as bp, type TileflowTerrainHillshadeStyle as bq, type TileflowTerrainLayerRange as br, type TileflowTerrainMode as bs, type TileflowTextAnchor as bt, type TileflowTextBackground as bu, type TileflowTextJustify as bv, type TileflowTextLayout as bw, type TileflowTextPaint as bx, type TileflowTextStyle as by, type TileflowThemeBlendSelection as bz, type TileflowRuntimeManifestTheme as c, inferTileflowAnalyticsFromStyleUrl as c0, isSafeLocalPmtilesPath as c1, isTileflowTimeOfDay as c2, loadTileflowManifest as c3, maplibreOverlay as c4, mergeTileflowAnalytics as c5, nearestTileflowBlendTheme as c6, normalizeTileflowRuntimeCenter as c7, normalizeTileflowStaticImageSize as c8, normalizeTileflowUrl as c9, applyTileflowColorOverrides as cA, loadTileflowRuntimeAppearance as cB, loadTileflowStyleFamily as cC, normalizeTileflowSurfaceId as cD, prepareTileflowStyleFamilyForRendering as cE, resolveTileflowAppearance as cF, resolveTileflowFamilyResourceUrls as cG, resolveTileflowStyleResourceUrls as cH, remove as ca, resolveTileflowAnalyticsRequestUrl as cb, resolveTileflowManifestMap as cc, resolveTileflowMapMode as cd, resolveTileflowRuntimeStyle as ce, resolveTileflowRuntimeTheme as cf, resolveTileflowRuntimeThemeBlend as cg, resolveTileflowRuntimeView as ch, resolveTileflowStaticImageUrl as ci, shouldLoadTileflowManifest as cj, startTileflowSession as ck, tileflowPoiCategories as cl, tileflowStyleFontFaceLimits as cm, tileflowStyleFontFacesMetadataKey as cn, tileflowThemeBlendLimits as co, tileflowThemeTokenCategories as cp, tileflowTimesOfDay as cq, token as cr, validateTileflowRuntimeSource as cs, validateTileflowThemeBlendSelection as ct, validateTileflowThemeSelection as cu, zoom as cv, type TileflowTypographyStyle as cw, type ResolvedTileflowTypography as cx, type TileflowAppearanceSelection as cy, type TileflowColorOverrides as cz, type TileflowRuntimeSystemThemes as d, type TileflowTimeOfDay as e, type TileflowTimeOfDayVariants as f, tileflowRuntimeManifestLimits as g, tileflowRuntimeManifestVersion as h, tileflowTimeOfDayManifestVersion as i, type TileflowStyleFamily as j, createTileflowStyleFamily as k, expandTileflowFamilyTemplate as l, expandTileflowStyleFamily as m, materializeTileflowStyleFamily as n, tileflowStyleFamilyLimits as o, parseTileflowStyleFamily as p, type TileflowOverlayPlacement as q, type TileflowMapLibreOverlay as r, type TileflowExpression as s, tileflowFamilyManifestVersion as t, type TileflowFixedValue as u, type TileflowThemeTokenReference as v, withTileflowFamilyTemplate as w, type TileflowThemeColorOperation as x, type TileflowBackgroundStyle as y, type TileflowCircleStyle as z };
|
package/dist/manifest.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { T as TileflowRuntimeManifest } from './manifest-types-
|
|
3
|
-
export { a as TileflowRuntimeColorScheme, b as TileflowRuntimeManifestMapEntry, c as TileflowRuntimeManifestTheme, d as TileflowRuntimeSystemThemes, e as TileflowTimeOfDay, f as TileflowTimeOfDayVariants, t as tileflowFamilyManifestVersion, g as tileflowRuntimeManifestLimits, h as tileflowRuntimeManifestVersion, i as tileflowTimeOfDayManifestVersion } from './manifest-types-
|
|
2
|
+
import { T as TileflowRuntimeManifest } from './manifest-types-U7JPDNAo.js';
|
|
3
|
+
export { a as TileflowRuntimeColorScheme, b as TileflowRuntimeManifestMapEntry, c as TileflowRuntimeManifestTheme, d as TileflowRuntimeSystemThemes, e as TileflowTimeOfDay, f as TileflowTimeOfDayVariants, t as tileflowFamilyManifestVersion, g as tileflowRuntimeManifestLimits, h as tileflowRuntimeManifestVersion, i as tileflowTimeOfDayManifestVersion } from './manifest-types-U7JPDNAo.js';
|
|
4
4
|
|
|
5
5
|
declare const tileflowRuntimeManifestSchema: z.ZodType<TileflowRuntimeManifest>;
|
|
6
6
|
declare function parseTileflowRuntimeManifest(input: unknown): TileflowRuntimeManifest;
|