@tileflow/core 0.1.0-alpha.4 → 0.1.0-alpha.40
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/LICENSE +201 -0
- package/README.md +318 -26
- package/THIRD_PARTY_NOTICES.md +444 -0
- package/dist/3d-CzLTD0RK.d.ts +1092 -0
- package/dist/3d.d.ts +1 -0
- package/dist/3d.js +12514 -0
- package/dist/browser.d.ts +2281 -0
- package/dist/browser.js +21680 -0
- package/dist/build.d.ts +595 -0
- package/dist/build.js +29729 -0
- package/dist/capture-shot-ChPQvPyi.d.ts +291 -0
- package/dist/capture.d.ts +9 -0
- package/dist/capture.js +510 -0
- package/dist/config-reference.json +40600 -0
- package/dist/icon-composition-CcSHApUm.d.ts +2478 -0
- package/dist/index.d.ts +1806 -162
- package/dist/index.js +26319 -3476
- package/dist/manifest-types-DnhSJjCM.d.ts +902 -0
- package/dist/manifest.d.ts +9 -0
- package/dist/manifest.js +449 -0
- package/dist/native-profile.d.ts +206 -0
- package/dist/native-profile.js +9339 -0
- package/dist/native.d.ts +365 -0
- package/dist/native.js +5970 -0
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +1445 -0
- package/dist/worker/camera-tile-worker.global.js +20 -0
- package/docs/application-tile-reading.md +86 -0
- package/docs/authoring-model.md +269 -0
- package/docs/boundary-areas-and-choropleths.md +217 -0
- package/docs/buildings-3d.md +594 -0
- package/docs/camera-moves-and-tile-cache.md +112 -0
- package/docs/capture-scenes.md +40 -0
- package/docs/capture-shots.md +173 -0
- package/docs/cartographic-defaults.md +210 -0
- package/docs/compiled-style-performance.md +286 -0
- package/docs/data-is-separate-from-design.md +610 -0
- package/docs/depth-markers.md +65 -0
- package/docs/dynamic-style-images.md +100 -0
- package/docs/globe-atmosphere.md +113 -0
- package/docs/hosted-session-authorization.md +106 -0
- package/docs/map-and-terrain-examples.md +156 -0
- package/docs/map-emphasis.md +89 -0
- package/docs/native-artifact-profile.md +152 -0
- package/docs/native-resource-urls.md +369 -0
- package/docs/nautical-marks.md +308 -0
- package/docs/public-api-and-browser-subpath.md +101 -0
- package/docs/route-drawing.md +191 -0
- package/docs/shared-visual-primitives.md +101 -0
- package/docs/street-lights.md +127 -0
- package/docs/street-sky.md +156 -0
- package/docs/style-states.md +73 -0
- package/docs/sun-and-light.md +167 -0
- package/docs/theme-transitions-and-blends.md +317 -0
- package/docs/themes-and-module-styles.md +156 -0
- package/docs/trees-3d.md +295 -0
- package/package.json +67 -8
|
@@ -0,0 +1,2281 @@
|
|
|
1
|
+
import { T as TileflowSymbolStyle, a as TileflowThemeImageValue, b as TileflowThemeColorValue, c as TileflowMarkerSymbolStyle, d as TileflowAreaStyle, e as TileflowLineStackStyle, f as TileflowLineHatchStyle, g as TileflowIconStyle, h as TileflowLinePaint, i as TileflowThemeNumberValue, j as TileflowNumberStyleValue, k as TileflowCircleStyle, l as TileflowLineStyle, m as TileflowFillStyle, n as TileflowExtrusionStyle, o as TileflowThemeValue, p as TileflowBackgroundStyle, q as TileflowSymbolPlacement, r as TileflowVegetationModuleConfig, s as TileflowTileLayer, t as TileflowMap3DOptions, u as TileflowMap3D, v as TileflowViewMode, w as TileflowSun } from './3d-CzLTD0RK.js';
|
|
2
|
+
export { x as TileflowBuildings3D, y as TileflowBuildings3DChange, z as TileflowBuildings3DMap, A as TileflowBuildings3DOptions, B as TileflowBuildings3DThemes, C as TileflowMap3DMap, D as TileflowStreetLights, E as TileflowStreetLightsMap, F as TileflowStreetLightsOptions, G as TileflowSunPreset, H as TileflowTile, I as TileflowTileAddress, J as TileflowTileAreaRequest, K as TileflowTileFeature, L as TileflowTileGeometryType, M as TileflowTileReader, N as TileflowTileReaderOptions, O as TileflowTileRequestTransform, P as TileflowTileSourceMap, Q as TileflowTreeFields, R as TileflowTreeForm, S as TileflowTreeFormMix, U as TileflowTreeFormRange, V as TileflowTreeLayers, W as TileflowTreePlacement, X as TileflowTreePlacementOptions, Y as TileflowTreeRange, Z as TileflowTreeRegion, _ as TileflowTrees3D, $ as TileflowTrees3DChange, a0 as TileflowTrees3DMap, a1 as TileflowTrees3DOptions, a2 as TileflowTrees3DThemes, a3 as TileflowVectorTileDecodeOptions, a4 as TileflowVegetation3D, a5 as TileflowVegetationController, a6 as TileflowVegetationDisplay, a7 as TileflowVegetationOptions, a8 as TileflowVegetationRepresentation, a9 as createTileflowBuildings3D, aa as createTileflowMap3D, ab as createTileflowStreetLights, ac as createTileflowTileReader, ad as createTileflowTrees3D, ae as createTileflowVegetation, af as decodeTileflowVectorTile, ag as mixTileflowSunPresets, ah as placeTileflowTrees, ai as readTileflowMapTileSource, aj as readTileflowSunPreset, ak as readTileflowVegetation3D, al as readTileflowVegetationDisplay, am as resolveTileflowSun, an as resolveTileflowVegetationRepresentation, ao as tileflowBuildings3DLayerId, ap as tileflowDefaultSunPreset, aq as tileflowStreetLightsLayerId, ar as tileflowStyleSunPreset, as as tileflowSunDirection, at as tileflowSunMetadataKey, au as tileflowSunPosition, av as tileflowTilePointToLngLat, aw as tileflowTilesForBounds, ax as tileflowTreeBytes, ay as tileflowTreeFormOf, az as tileflowTreeForms, aA as tileflowTrees3DLayerId, aB as tileflowVegetationDisplayMetadataKey, aC as tileflowVegetationMetadataKey } from './3d-CzLTD0RK.js';
|
|
3
|
+
|
|
4
|
+
type TileflowColor = `#${string}`;
|
|
5
|
+
type TileflowRoadDetail = 'none' | 'highways' | 'major' | 'streets' | 'all';
|
|
6
|
+
type TileflowRoadClass = 'motorway' | 'trunk' | 'primary' | 'secondary' | 'tertiary' | 'minor' | 'service' | 'track' | 'pathway' | 'footway' | 'cycleway' | 'steps' | 'pedestrian';
|
|
7
|
+
type TileflowRoadHierarchy = 'subtle' | 'clear' | 'strong';
|
|
8
|
+
type TileflowRoadWeight = 'thin' | 'regular' | 'bold';
|
|
9
|
+
type TileflowRoadOutline = 'none' | 'subtle' | 'strong';
|
|
10
|
+
type TileflowRoadStructure = 'bridge' | 'surface' | 'tunnel';
|
|
11
|
+
type TileflowRoadExtras = {
|
|
12
|
+
paths?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type TileflowRoadLayerStyle = TileflowLineStackStyle & {
|
|
15
|
+
hatch?: TileflowLineHatchStyle;
|
|
16
|
+
};
|
|
17
|
+
type TileflowRoadTreatmentLineStyle = Pick<TileflowLinePaint, 'blur' | 'color' | 'dash' | 'gapWidth' | 'offset' | 'opacity' | 'width'>;
|
|
18
|
+
type TileflowRoadTreatmentLayerStyle = {
|
|
19
|
+
casing?: TileflowRoadTreatmentLineStyle;
|
|
20
|
+
fill?: TileflowRoadTreatmentLineStyle;
|
|
21
|
+
shadow?: TileflowRoadTreatmentLineStyle;
|
|
22
|
+
};
|
|
23
|
+
type TileflowRoadTreatmentStyle = Partial<Record<TileflowRoadStructure, TileflowRoadTreatmentLayerStyle>> & {
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
widthScale?: TileflowThemeNumberValue;
|
|
26
|
+
};
|
|
27
|
+
type TileflowRoadModifier = 'construction' | 'expressway' | 'indoor' | 'official' | 'ramp' | 'unpaved';
|
|
28
|
+
type TileflowRoadRestriction = 'access' | 'bicycle' | 'foot' | 'horse' | 'toll';
|
|
29
|
+
type TileflowMountainBikeScale = '0' | '0+' | '1' | '1+' | '2' | '2+' | '3' | '3+' | '4' | '5' | '6';
|
|
30
|
+
type TileflowRoadServiceType = 'alley' | 'crossover' | 'driveway' | 'parkingAisle' | 'yard';
|
|
31
|
+
type TileflowRoadClassStyle = Partial<Record<TileflowRoadStructure, TileflowRoadLayerStyle>> & {
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
};
|
|
34
|
+
type TileflowRoadAreaStyle = {
|
|
35
|
+
pedestrian?: TileflowAreaStyle;
|
|
36
|
+
pier?: TileflowAreaStyle;
|
|
37
|
+
road?: TileflowAreaStyle;
|
|
38
|
+
};
|
|
39
|
+
type TileflowRoadCrossingStyle = Omit<TileflowIconStyle, 'image'> & Required<Pick<TileflowIconStyle, 'image'>>;
|
|
40
|
+
type TileflowRoadRoundaboutStyle = {
|
|
41
|
+
/** Extra casing width in pixels, split equally across both edges; defaults to the road border. */
|
|
42
|
+
borderWidth?: TileflowNumberStyleValue;
|
|
43
|
+
casing?: TileflowCircleStyle;
|
|
44
|
+
/** Road width in pixels when metric radii are absent; defaults to the effective surface fill width. */
|
|
45
|
+
fallbackWidth?: TileflowNumberStyleValue;
|
|
46
|
+
fill?: TileflowCircleStyle;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* How Core's street lights renderer lights the map's streets at night, from the lamps and lit
|
|
50
|
+
* streets its data holds.
|
|
51
|
+
*/
|
|
52
|
+
type TileflowRoadStreetLightStyle = {
|
|
53
|
+
/** The light of lamps whose data gives no colour; a warm white by default. */
|
|
54
|
+
color?: TileflowThemeColorValue;
|
|
55
|
+
/** Whether the map has street lights; defaults to false. Set true to opt in. */
|
|
56
|
+
enabled?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Where light is estimated where the data maps no lamps: `lit` (the default) along streets and
|
|
59
|
+
* pavements mapped as lit; `streets` also along streets the data says nothing about, in tiles
|
|
60
|
+
* that map few lamps, which invents light; `none` nowhere.
|
|
61
|
+
*/
|
|
62
|
+
estimate?: 'lit' | 'streets' | 'none';
|
|
63
|
+
/** How bright the lights shine, from 0 to 2; defaults to 1. */
|
|
64
|
+
intensity?: TileflowThemeNumberValue;
|
|
65
|
+
};
|
|
66
|
+
type TileflowRoadSidewalkStyle = {
|
|
67
|
+
outline?: TileflowLineStyle;
|
|
68
|
+
pattern?: TileflowFillStyle;
|
|
69
|
+
surface?: TileflowFillStyle;
|
|
70
|
+
};
|
|
71
|
+
type TileflowRoadsModuleConfig = {
|
|
72
|
+
type: 'roads';
|
|
73
|
+
areas?: TileflowRoadAreaStyle;
|
|
74
|
+
classes?: Partial<Record<TileflowRoadClass, TileflowRoadClassStyle>>;
|
|
75
|
+
crossings?: TileflowRoadCrossingStyle;
|
|
76
|
+
detail?: TileflowRoadDetail;
|
|
77
|
+
extras?: TileflowRoadExtras;
|
|
78
|
+
hierarchy?: TileflowRoadHierarchy;
|
|
79
|
+
modifiers?: Partial<Record<TileflowRoadModifier, TileflowRoadTreatmentStyle>>;
|
|
80
|
+
mountainBike?: Partial<Record<TileflowMountainBikeScale, TileflowRoadTreatmentStyle>>;
|
|
81
|
+
oneWayMarkers?: boolean;
|
|
82
|
+
outline?: TileflowRoadOutline;
|
|
83
|
+
/** Draw ramp fills below receiving roads by default; `by-class` keeps their class's order. */
|
|
84
|
+
rampOrder?: 'below-roads' | 'by-class';
|
|
85
|
+
restrictions?: Partial<Record<TileflowRoadRestriction, TileflowRoadTreatmentStyle>>;
|
|
86
|
+
roundabouts?: TileflowRoadRoundaboutStyle;
|
|
87
|
+
serviceTypes?: Partial<Record<TileflowRoadServiceType, TileflowRoadTreatmentStyle>>;
|
|
88
|
+
sidewalks?: TileflowRoadSidewalkStyle;
|
|
89
|
+
streetLights?: TileflowRoadStreetLightStyle;
|
|
90
|
+
structures?: Partial<Record<TileflowRoadStructure, TileflowRoadLayerStyle>>;
|
|
91
|
+
weight?: TileflowRoadWeight;
|
|
92
|
+
widthScale?: Partial<Record<TileflowRoadClass, TileflowThemeNumberValue>>;
|
|
93
|
+
};
|
|
94
|
+
type TileflowLabelDetail = 'none' | 'major' | 'all';
|
|
95
|
+
type TileflowAerodromeCodeDetail = 'none' | 'iata' | 'all';
|
|
96
|
+
type TileflowRoadLabelDetail = TileflowRoadDetail;
|
|
97
|
+
type TileflowLabelLanguage = 'auto' | 'local' | 'en' | (string & {});
|
|
98
|
+
type TileflowPlaceLabelClass = 'city' | 'continent' | 'country' | 'neighborhood' | 'other' | 'state' | 'town' | 'village';
|
|
99
|
+
type TileflowWaterLabelClass = 'line' | 'ocean' | 'other' | 'waterway';
|
|
100
|
+
type TileflowRoadShieldDetail = 'none' | 'major' | 'all';
|
|
101
|
+
type TileflowLabelCollisionPriority = 'balanced' | 'navigation';
|
|
102
|
+
type TileflowRoadShieldStyles = {
|
|
103
|
+
default?: TileflowSymbolStyle;
|
|
104
|
+
detail?: TileflowSymbolStyle;
|
|
105
|
+
kinds?: Record<string, {
|
|
106
|
+
image: TileflowThemeImageValue;
|
|
107
|
+
}>;
|
|
108
|
+
overview?: TileflowSymbolStyle;
|
|
109
|
+
textColors?: Record<string, {
|
|
110
|
+
color: TileflowThemeColorValue;
|
|
111
|
+
}>;
|
|
112
|
+
};
|
|
113
|
+
type TileflowLabelStyles = {
|
|
114
|
+
aerodrome?: TileflowSymbolStyle;
|
|
115
|
+
junctions?: TileflowSymbolStyle;
|
|
116
|
+
places?: Partial<Record<TileflowPlaceLabelClass, TileflowSymbolStyle>>;
|
|
117
|
+
roads?: Partial<Record<TileflowRoadClass, TileflowSymbolStyle>>;
|
|
118
|
+
shields?: TileflowRoadShieldStyles;
|
|
119
|
+
water?: Partial<Record<TileflowWaterLabelClass, TileflowSymbolStyle>>;
|
|
120
|
+
};
|
|
121
|
+
type TileflowLabelsModuleConfig = {
|
|
122
|
+
type: 'labels';
|
|
123
|
+
aerodromeCodes?: TileflowAerodromeCodeDetail;
|
|
124
|
+
collisionPriority?: TileflowLabelCollisionPriority;
|
|
125
|
+
junctions?: boolean;
|
|
126
|
+
language?: TileflowLabelLanguage;
|
|
127
|
+
places?: TileflowLabelDetail;
|
|
128
|
+
roadClasses?: readonly TileflowRoadClass[];
|
|
129
|
+
/** Share placement and repeated-name suppression across compatible road classes. */
|
|
130
|
+
roadGrouping?: 'class' | 'network';
|
|
131
|
+
/** Abbreviate recognized road-type words without translating the selected label language. */
|
|
132
|
+
roadNameFormat?: 'full' | 'compact';
|
|
133
|
+
/**
|
|
134
|
+
* Where street names draw. `foreground` (the default) keeps them above buildings and
|
|
135
|
+
* vegetation. `ground` places them above flat footprints and below raised buildings,
|
|
136
|
+
* with map-aligned text by default.
|
|
137
|
+
* Ground names retain their road-class collision order, but foreground symbols are offered
|
|
138
|
+
* first by the renderer; `collisionPriority` cannot make ground names outrank those symbols.
|
|
139
|
+
* Shields and junction numbers keep their foreground placement.
|
|
140
|
+
*/
|
|
141
|
+
roadPlacement?: 'ground' | 'foreground';
|
|
142
|
+
/** Defaults to streets, including local street names where their geometry is enabled. */
|
|
143
|
+
roads?: TileflowRoadLabelDetail;
|
|
144
|
+
shields?: TileflowRoadShieldDetail;
|
|
145
|
+
styles?: TileflowLabelStyles;
|
|
146
|
+
water?: TileflowLabelDetail;
|
|
147
|
+
};
|
|
148
|
+
/** Closed editorial vocabulary emitted by Tileflow World's canonical POI projection. */
|
|
149
|
+
declare const tileflowPoiCategories: readonly ["arts-entertainment", "education", "food-drink", "landmark", "lodging", "medical", "park-nature", "public-services", "religion", "retail", "sport-leisure", "transport", "visitor-amenity"];
|
|
150
|
+
type TileflowPoiCategory = (typeof tileflowPoiCategories)[number];
|
|
151
|
+
type TileflowPoiDensity = 1 | 2 | 3 | 4 | 5;
|
|
152
|
+
type TileflowPoiColorMode = 'uniform' | 'category';
|
|
153
|
+
/**
|
|
154
|
+
* How POI categories are placed against each other. `importance` places every category in one
|
|
155
|
+
* order, by World's ranks. `categories` gives each category its own layer and places the
|
|
156
|
+
* categories in the order they are listed, the first on top; ranks order each category only.
|
|
157
|
+
*/
|
|
158
|
+
type TileflowPoiPlacementOrder = 'categories' | 'importance';
|
|
159
|
+
/**
|
|
160
|
+
* The appearance of one POI category. With the default `importance` order every category shares
|
|
161
|
+
* one placement layer, so categories may differ only in properties MapLibre evaluates per feature
|
|
162
|
+
* (image, size, colors, font, offsets); layer-wide properties such as zoom ranges, padding,
|
|
163
|
+
* overlap or `optional` must match, or the module uses `placement.order: 'categories'`.
|
|
164
|
+
*/
|
|
165
|
+
type TileflowPoiCategoryStyle = Omit<TileflowMarkerSymbolStyle, 'priority'>;
|
|
166
|
+
type TileflowPoiModuleConfig = {
|
|
167
|
+
type: 'poi';
|
|
168
|
+
categories?: readonly TileflowPoiCategory[];
|
|
169
|
+
color?: TileflowPoiColorMode;
|
|
170
|
+
/** Defaults to 2. World's ranks decide which features are eligible at each zoom. */
|
|
171
|
+
density?: TileflowPoiDensity;
|
|
172
|
+
/** Category overrides of density, with the same zoom-dependent detail allowance. */
|
|
173
|
+
densityByCategory?: Partial<Record<TileflowPoiCategory, TileflowPoiDensity>>;
|
|
174
|
+
/** Zoom for the second extra rank of POI detail. Must exceed 16; defaults to 17. */
|
|
175
|
+
detailZoom?: number;
|
|
176
|
+
icons?: boolean;
|
|
177
|
+
labels?: boolean;
|
|
178
|
+
minZoom?: number;
|
|
179
|
+
placement?: {
|
|
180
|
+
/**
|
|
181
|
+
* Places each pictogram with its name as one unit that needs room for both. Defaults to
|
|
182
|
+
* `true`. Use false to place pictograms and names independently.
|
|
183
|
+
*/
|
|
184
|
+
coupleIconAndLabel?: boolean;
|
|
185
|
+
iconPadding?: number;
|
|
186
|
+
/**
|
|
187
|
+
* World POI `type` values whose pictogram explains them. When pictograms and names are both
|
|
188
|
+
* drawn, every other POI needs a name, and these types are drawn as a pictogram alone.
|
|
189
|
+
* Defaults to parking and public toilets.
|
|
190
|
+
*/
|
|
191
|
+
iconOnlyTypes?: readonly string[];
|
|
192
|
+
/** Defaults to `importance`. */
|
|
193
|
+
order?: TileflowPoiPlacementOrder;
|
|
194
|
+
/**
|
|
195
|
+
* With the `importance` order, POIs whose World `filter_rank` is at most this value are placed
|
|
196
|
+
* before the map's road and place labels, and the others after them. A map that gives street
|
|
197
|
+
* names priority over POIs (labels `collisionPriority: 'navigation'`) keeps its landmarks this
|
|
198
|
+
* way. Unset, every POI is placed at the module's own position.
|
|
199
|
+
*/
|
|
200
|
+
prominentRank?: 0 | 1 | 2 | 3 | 4 | 5;
|
|
201
|
+
/** Collision margin around the name, in pixels. Defaults to 3. */
|
|
202
|
+
textPadding?: number;
|
|
203
|
+
};
|
|
204
|
+
styles?: Partial<Record<TileflowPoiCategory, TileflowPoiCategoryStyle>>;
|
|
205
|
+
};
|
|
206
|
+
type MapLibreSprite = string | Array<{
|
|
207
|
+
id: string;
|
|
208
|
+
url: string;
|
|
209
|
+
}>;
|
|
210
|
+
type TileflowProjection = 'globe' | 'mercator';
|
|
211
|
+
type TileflowLight = {
|
|
212
|
+
anchor?: 'map' | 'viewport';
|
|
213
|
+
color?: TileflowColor;
|
|
214
|
+
intensity?: number;
|
|
215
|
+
position?: readonly [number, number, number];
|
|
216
|
+
};
|
|
217
|
+
type MapLibreStyle = {
|
|
218
|
+
sky?: Record<string, unknown>;
|
|
219
|
+
version: 8;
|
|
220
|
+
name: string;
|
|
221
|
+
glyphs?: string;
|
|
222
|
+
light?: TileflowLight;
|
|
223
|
+
projection?: {
|
|
224
|
+
type: TileflowProjection;
|
|
225
|
+
};
|
|
226
|
+
sprite?: MapLibreSprite;
|
|
227
|
+
sources: Record<string, Record<string, unknown>>;
|
|
228
|
+
layers: Array<Record<string, unknown>>;
|
|
229
|
+
terrain?: Record<string, unknown>;
|
|
230
|
+
metadata?: Record<string, unknown>;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
type ShadowPoint = readonly number[];
|
|
234
|
+
type ShadowBox = Readonly<{
|
|
235
|
+
min: ShadowPoint;
|
|
236
|
+
max: ShadowPoint;
|
|
237
|
+
}>;
|
|
238
|
+
type ShadowRange = readonly [number, number];
|
|
239
|
+
/** The light-space ranges a light view covers: across and up the shadow map, and along the light. */
|
|
240
|
+
type ShadowFit = Readonly<{
|
|
241
|
+
right: ShadowRange;
|
|
242
|
+
up: ShadowRange;
|
|
243
|
+
depth: ShadowRange;
|
|
244
|
+
}>;
|
|
245
|
+
type ShadowView = Readonly<{
|
|
246
|
+
/** Visible receiver points, in the caster box's metre frame. All casters still draw. */
|
|
247
|
+
receivers?: readonly ShadowPoint[];
|
|
248
|
+
/** Snap to world-aligned texels; omit for an unsnapped mathematical projection. */
|
|
249
|
+
resolution?: number;
|
|
250
|
+
origin?: ShadowPoint;
|
|
251
|
+
/** Metres per fixed world unit; keeps texel quantization independent of latitude scale. */
|
|
252
|
+
gridScale?: number;
|
|
253
|
+
/** A share of the focused span added on each side, so a moving view stays inside the fit. */
|
|
254
|
+
margin?: number;
|
|
255
|
+
/**
|
|
256
|
+
* A fit in the same frame and light, kept on each axis while it covers the view and is at most
|
|
257
|
+
* half again as wide as a new fit would be.
|
|
258
|
+
*/
|
|
259
|
+
previous?: ShadowFit;
|
|
260
|
+
}>;
|
|
261
|
+
/**
|
|
262
|
+
* The sun's orthographic view, in metres, with room for each caster's shadow to reach the ground.
|
|
263
|
+
* Optional receivers concentrate XY resolution without dropping offscreen casters along a ray;
|
|
264
|
+
* quantized extents and a world-anchored texel grid keep stationary shadows stable during pans.
|
|
265
|
+
*/
|
|
266
|
+
declare function tileflowSunLightMatrix(direction: readonly number[], box: ShadowBox, view?: ShadowView): {
|
|
267
|
+
matrix: Float32Array;
|
|
268
|
+
depth: number;
|
|
269
|
+
extent: number;
|
|
270
|
+
fit: ShadowFit;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
/** Inputs to one fixed-size, application-owned RGBA image. */
|
|
274
|
+
type TileflowDynamicImageContext = Readonly<{
|
|
275
|
+
theme: string;
|
|
276
|
+
blend?: Readonly<{
|
|
277
|
+
position: number;
|
|
278
|
+
themes: readonly string[];
|
|
279
|
+
}>;
|
|
280
|
+
states: Readonly<Record<string, boolean | number | string | null | undefined>>;
|
|
281
|
+
/** Physical pixel dimensions, fixed for this registration. */
|
|
282
|
+
width: number;
|
|
283
|
+
height: number;
|
|
284
|
+
pixelRatio: number;
|
|
285
|
+
}>;
|
|
286
|
+
type TileflowDynamicImage = Readonly<{
|
|
287
|
+
/** Physical pixel dimensions, each from 1 through 2048. */
|
|
288
|
+
width: number;
|
|
289
|
+
height: number;
|
|
290
|
+
/** Physical pixels per logical pixel. Defaults to 1; fixed until disposal. */
|
|
291
|
+
pixelRatio?: number;
|
|
292
|
+
/** Controller states that invalidate this image, including interpolated values. */
|
|
293
|
+
states?: readonly string[];
|
|
294
|
+
/** Synchronous RGBA pixels; undefined keeps the previous pixels (initially transparent). */
|
|
295
|
+
render(context: TileflowDynamicImageContext): Uint8Array | Uint8ClampedArray | undefined;
|
|
296
|
+
/** Later render/restore failures retain good pixels. Defaults to console.error. */
|
|
297
|
+
onError?(error: Error): void;
|
|
298
|
+
}>;
|
|
299
|
+
type TileflowDynamicImageHandle = {
|
|
300
|
+
/** Refresh external inputs at the next frame. Repeated requests coalesce. */
|
|
301
|
+
refresh(): void;
|
|
302
|
+
/** Cancel queued work, release the name and remove only this resource's image. */
|
|
303
|
+
dispose(): void;
|
|
304
|
+
};
|
|
305
|
+
type TileflowDynamicImageMap = {
|
|
306
|
+
addImage?: unknown;
|
|
307
|
+
getCanvas?: unknown;
|
|
308
|
+
getImage?: unknown;
|
|
309
|
+
getStyle?: unknown;
|
|
310
|
+
removeImage?: unknown;
|
|
311
|
+
updateImage?: unknown;
|
|
312
|
+
on(event: string, listener: () => void): unknown;
|
|
313
|
+
off(event: string, listener: () => void): unknown;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* `GRACE` and `MANAGED_REQUIRED` come from the site's fair-use state. `LIMITED` means Tileflow is
|
|
318
|
+
* temporarily limiting anonymous World delivery for everyone: cached areas keep loading while some
|
|
319
|
+
* uncached areas fail, and a managed map is not affected.
|
|
320
|
+
*/
|
|
321
|
+
type TileflowFairUseNoticeState = 'GRACE' | 'MANAGED_REQUIRED' | 'LIMITED';
|
|
322
|
+
type TileflowFairUseNotice = Readonly<{
|
|
323
|
+
action: string;
|
|
324
|
+
helpUrl: string;
|
|
325
|
+
message: string;
|
|
326
|
+
state: TileflowFairUseNoticeState;
|
|
327
|
+
}>;
|
|
328
|
+
type TileflowWorldProtocolRequest = Readonly<{
|
|
329
|
+
type?: string;
|
|
330
|
+
url: string;
|
|
331
|
+
}>;
|
|
332
|
+
type TileflowWorldProtocolResponse = Readonly<{
|
|
333
|
+
cacheControl?: string;
|
|
334
|
+
data: ArrayBuffer;
|
|
335
|
+
etag?: string;
|
|
336
|
+
expires?: string;
|
|
337
|
+
}>;
|
|
338
|
+
type TileflowWorldProtocolHandler = (request: TileflowWorldProtocolRequest, abortController: AbortController) => Promise<TileflowWorldProtocolResponse>;
|
|
339
|
+
type TileflowWorldRequestBridge = Readonly<{
|
|
340
|
+
dispose: () => void;
|
|
341
|
+
rewriteUrl: (url: string) => string;
|
|
342
|
+
}>;
|
|
343
|
+
type TileflowFairUseNoticeController = Readonly<{
|
|
344
|
+
dispose: () => void;
|
|
345
|
+
update: (notice: TileflowFairUseNotice | null) => void;
|
|
346
|
+
}>;
|
|
347
|
+
declare function registerTileflowWorldRequestBridge(input: {
|
|
348
|
+
addProtocol: (name: string, handler: TileflowWorldProtocolHandler) => void;
|
|
349
|
+
fetch?: typeof fetch;
|
|
350
|
+
now?: () => number;
|
|
351
|
+
onNotice: (notice: TileflowFairUseNotice | null) => void;
|
|
352
|
+
}): TileflowWorldRequestBridge;
|
|
353
|
+
declare function tileflowFairUseNoticeMessage(state: TileflowFairUseNoticeState): string;
|
|
354
|
+
declare function attachTileflowFairUseNotice(container: HTMLElement): TileflowFairUseNoticeController;
|
|
355
|
+
|
|
356
|
+
type TileflowAddressesModuleOptions = {
|
|
357
|
+
/** Styling for OpenMapTiles point house-number labels. */
|
|
358
|
+
labels?: TileflowSymbolStyle;
|
|
359
|
+
};
|
|
360
|
+
type TileflowAddressesModuleConfig = TileflowAddressesModuleOptions & {
|
|
361
|
+
type: 'addresses';
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
type TileflowAerowaysModuleOptions = {
|
|
365
|
+
area?: TileflowAreaStyle;
|
|
366
|
+
runway?: TileflowLineStackStyle;
|
|
367
|
+
runwayRef?: TileflowSymbolStyle;
|
|
368
|
+
taxiway?: TileflowLineStackStyle;
|
|
369
|
+
};
|
|
370
|
+
type TileflowAerowaysModuleConfig = TileflowAerowaysModuleOptions & {
|
|
371
|
+
type: 'aeroways';
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
type TileflowBoundariesModuleOptions = {
|
|
375
|
+
admin2?: TileflowLineStyle;
|
|
376
|
+
admin4?: TileflowLineStyle;
|
|
377
|
+
disputed?: TileflowLineStyle;
|
|
378
|
+
maritime?: TileflowLineStyle;
|
|
379
|
+
};
|
|
380
|
+
type TileflowBoundariesModuleConfig = TileflowBoundariesModuleOptions & {
|
|
381
|
+
type: 'boundaries';
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
/** Decorative finishes for ordinary extruded buildings; they do not describe surveyed materials. */
|
|
385
|
+
type TileflowBuildingSurfaces<Numeric = number, Size = readonly [number, number]> = {
|
|
386
|
+
walls?: {
|
|
387
|
+
kind: 'brick';
|
|
388
|
+
/** Brick width and course height in metres; defaults to [6, 3]. */
|
|
389
|
+
size?: Size;
|
|
390
|
+
/** Recessed joint width in metres; defaults to 0.12. */
|
|
391
|
+
jointWidth?: Numeric;
|
|
392
|
+
/** Strength of the shaded joints, from 0 to 1; defaults to 0.2. */
|
|
393
|
+
contrast?: Numeric;
|
|
394
|
+
};
|
|
395
|
+
roof?: {
|
|
396
|
+
kind: 'tiles';
|
|
397
|
+
/** Square size in projected Mercator metres; defaults to 8. */
|
|
398
|
+
size?: Numeric;
|
|
399
|
+
/** Joint width in projected Mercator metres; defaults to 0.12. */
|
|
400
|
+
jointWidth?: Numeric;
|
|
401
|
+
contrast?: Numeric;
|
|
402
|
+
};
|
|
403
|
+
/** A painted light band and seam at the roof edge, without adding geometry. */
|
|
404
|
+
cornice?: {
|
|
405
|
+
height?: Numeric;
|
|
406
|
+
contrast?: Numeric;
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
type TileflowBuildingSurfaceDesign = {
|
|
410
|
+
walls?: Required<NonNullable<TileflowBuildingSurfaces['walls']>>;
|
|
411
|
+
roof?: Required<NonNullable<TileflowBuildingSurfaces['roof']>>;
|
|
412
|
+
cornice?: Required<NonNullable<TileflowBuildingSurfaces['cornice']>>;
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
/** The parts of a model, each coloured by the theme: the model's materials name them. */
|
|
416
|
+
declare const tileflowModelParts: Readonly<{
|
|
417
|
+
surface: 0;
|
|
418
|
+
secondary: 1;
|
|
419
|
+
glass: 2;
|
|
420
|
+
accent: 3;
|
|
421
|
+
roof: 4;
|
|
422
|
+
}>;
|
|
423
|
+
type TileflowModelPart = keyof typeof tileflowModelParts;
|
|
424
|
+
/** Architectural roles control lighting independently of the model's palette slots. */
|
|
425
|
+
declare const tileflowModelLightingRoles: Readonly<{
|
|
426
|
+
unclassified: 0;
|
|
427
|
+
wall: 1;
|
|
428
|
+
door: 2;
|
|
429
|
+
roof: 3;
|
|
430
|
+
window: 4;
|
|
431
|
+
lamp: 5;
|
|
432
|
+
logo: 6;
|
|
433
|
+
}>;
|
|
434
|
+
type TileflowModelLightingRole = keyof typeof tileflowModelLightingRoles;
|
|
435
|
+
|
|
436
|
+
type TileflowBuildingMode = '3d' | 'flat';
|
|
437
|
+
/**
|
|
438
|
+
* How Core's 3D buildings renderer draws the map's buildings. Their colour is the map's own 3D
|
|
439
|
+
* building colour (its extrusion), else its roofs'.
|
|
440
|
+
*/
|
|
441
|
+
type TileflowBuildingsThreeDimensionalStyle = {
|
|
442
|
+
/** Use the scene sun (default), or the style's native extrusion light. */
|
|
443
|
+
lighting?: 'style' | 'sun';
|
|
444
|
+
/** Per-building brightness variation, from 0 to 1; defaults to 0 (authored colour). */
|
|
445
|
+
colorVariation?: TileflowThemeNumberValue;
|
|
446
|
+
/** How strongly roof outlines and outer corners catch the light, from 0 (default) to 1. */
|
|
447
|
+
edges?: TileflowThemeNumberValue;
|
|
448
|
+
/** Radius in metres for softened exterior corners and roof lighting, from 0 to 1; defaults to 0.8. */
|
|
449
|
+
edgeRadius?: number;
|
|
450
|
+
/** Their own colour, drawn unlit; without it they take the building's colour, lightened. */
|
|
451
|
+
edgeColor?: TileflowThemeColorValue;
|
|
452
|
+
/** How bright the buildings light the street at night, from 0 (none) to 2; defaults to 0. */
|
|
453
|
+
nightLight?: TileflowThemeNumberValue;
|
|
454
|
+
/** Height-selected architectural flood lighting. Off by default; follows scene darkness. */
|
|
455
|
+
floodLight?: {
|
|
456
|
+
intensity?: TileflowThemeNumberValue;
|
|
457
|
+
/** Compensates authored light-colour transforms during darkness evaluation; defaults to 1. */
|
|
458
|
+
brightnessScale?: TileflowThemeNumberValue;
|
|
459
|
+
color?: TileflowThemeColorValue;
|
|
460
|
+
/** Stable per-building ground radius range in metres; defaults to [30, 100]. */
|
|
461
|
+
groundRadius?: readonly [number, number];
|
|
462
|
+
/** Ground light starts at this height in metres; defaults to 30. */
|
|
463
|
+
minGroundHeight?: number;
|
|
464
|
+
/** Wall light starts above this height in metres; defaults to 200. */
|
|
465
|
+
minWallHeight?: number;
|
|
466
|
+
/** Wall radius as a fraction of building height; defaults to 1/3. */
|
|
467
|
+
wallHeightRatio?: number;
|
|
468
|
+
};
|
|
469
|
+
/** Per-role physical materials and emission, separate from palette slots and occlusion. */
|
|
470
|
+
modelLighting?: Partial<Record<TileflowModelLightingRole, {
|
|
471
|
+
emissiveStrength?: TileflowThemeNumberValue;
|
|
472
|
+
/** Stable per-model addition to emission, from zero to this amount. */
|
|
473
|
+
emissiveVariation?: TileflowThemeNumberValue;
|
|
474
|
+
emissiveColor?: TileflowThemeColorValue;
|
|
475
|
+
/** Height fractions, multipliers and curve exponent; defaults to a constant multiplier of one. */
|
|
476
|
+
emissiveHeight?: readonly [
|
|
477
|
+
TileflowThemeNumberValue,
|
|
478
|
+
TileflowThemeNumberValue,
|
|
479
|
+
TileflowThemeNumberValue,
|
|
480
|
+
TileflowThemeNumberValue,
|
|
481
|
+
TileflowThemeNumberValue
|
|
482
|
+
];
|
|
483
|
+
/** Physical-material tint. Explicit modelColors take precedence. */
|
|
484
|
+
color?: TileflowThemeColorValue;
|
|
485
|
+
colorMix?: TileflowThemeNumberValue;
|
|
486
|
+
metallic?: TileflowThemeNumberValue;
|
|
487
|
+
roughness?: TileflowThemeNumberValue;
|
|
488
|
+
/** Independent HSL ranges, seeded by model identity; no window geometry is invented. */
|
|
489
|
+
colorVariation?: {
|
|
490
|
+
hue: readonly [TileflowThemeNumberValue, TileflowThemeNumberValue];
|
|
491
|
+
saturation: readonly [TileflowThemeNumberValue, TileflowThemeNumberValue];
|
|
492
|
+
lightness: readonly [TileflowThemeNumberValue, TileflowThemeNumberValue];
|
|
493
|
+
space?: 'srgb' | 'linear';
|
|
494
|
+
};
|
|
495
|
+
}>>;
|
|
496
|
+
/**
|
|
497
|
+
* The zoom bands the city comes in over: zooming in, across each band its part fades in and rises
|
|
498
|
+
* from the ground, and zooming out it sinks and fades again. Defaults to the 0.3 zooms from the
|
|
499
|
+
* renderer's `minzoom` (15) for the buildings, and to the 0.4 zooms from 0.8 before it for the
|
|
500
|
+
* placed models and landmarks, which stand first. With reduced motion they only fade.
|
|
501
|
+
*/
|
|
502
|
+
entrance?: {
|
|
503
|
+
buildings?: readonly [number, number];
|
|
504
|
+
models?: readonly [number, number];
|
|
505
|
+
};
|
|
506
|
+
/** Contact shadow at the foot of the walls and in tight corners; defaults to true. */
|
|
507
|
+
occlusion?: boolean;
|
|
508
|
+
/** Prepared model ambient occlusion strength, from 0 to 1; defaults to 0.75. */
|
|
509
|
+
modelOcclusion?: TileflowThemeNumberValue;
|
|
510
|
+
/** Shadows from the sun, on the buildings and the flat map; defaults to true. */
|
|
511
|
+
shadows?: boolean;
|
|
512
|
+
/**
|
|
513
|
+
* Invented night windows, lit by rooms: decoration, not data. With World's `class`, none on sheds,
|
|
514
|
+
* barns, factories and churches, and homes lit apart from offices. Defaults to false.
|
|
515
|
+
*/
|
|
516
|
+
windows?: boolean;
|
|
517
|
+
/** Decorative wall joints, roof tiles and painted cornices. Off by default; ordinary buildings only. */
|
|
518
|
+
surfaces?: TileflowBuildingSurfaces<TileflowThemeNumberValue, TileflowThemeValue<readonly [number, number]>>;
|
|
519
|
+
/**
|
|
520
|
+
* Building models the map places in its city, from the glTF binaries in its `models`
|
|
521
|
+
* directories. Each stands in for the buildings under its footprint.
|
|
522
|
+
*/
|
|
523
|
+
models?: readonly TileflowBuildingModelPlacementConfig[];
|
|
524
|
+
/** The colours of the models' parts; a part without one takes it from the building colour. */
|
|
525
|
+
modelColors?: Partial<Record<TileflowBuildingModelPart, TileflowThemeColorValue>>;
|
|
526
|
+
/**
|
|
527
|
+
* Tileflow's landmarks, such as the Eiffel Tower, drawn as models in place of the buildings
|
|
528
|
+
* under them. On by default with Tileflow World data; `false` switches them off, and `url` names
|
|
529
|
+
* the TileJSON of another landmarks tileset. The map's own `models` come first: a landmark with
|
|
530
|
+
* the same id as one, or whose footprint meets one's, is not drawn.
|
|
531
|
+
*/
|
|
532
|
+
landmarks?: boolean | {
|
|
533
|
+
url: string;
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
/** The parts of a building model, as its materials name them. */
|
|
537
|
+
type TileflowBuildingModelPart = 'surface' | 'secondary' | 'glass' | 'accent' | 'roof';
|
|
538
|
+
/** Where a building model stands. */
|
|
539
|
+
type TileflowBuildingModelPlacementConfig = {
|
|
540
|
+
/** The model's id: the name of its `.glb` file in the map's `models` directories. */
|
|
541
|
+
model: string;
|
|
542
|
+
/**
|
|
543
|
+
* The HTTPS address of the model's prepared file when it is served elsewhere, such as a model
|
|
544
|
+
* Tileflow hosts for its own maps; the map then needs no `.glb` of its own for it.
|
|
545
|
+
*/
|
|
546
|
+
url?: string;
|
|
547
|
+
/** Longitude and latitude of the model's origin, where it stands on the ground. */
|
|
548
|
+
at: readonly [number, number];
|
|
549
|
+
/** Degrees clockwise from north that the model's own north (its +y) is turned to; defaults to 0. */
|
|
550
|
+
heading?: number;
|
|
551
|
+
};
|
|
552
|
+
type TileflowBuildingsModuleOptions = {
|
|
553
|
+
businessCorridor?: TileflowAreaStyle;
|
|
554
|
+
extrusion?: TileflowExtrusionStyle;
|
|
555
|
+
flat?: TileflowAreaStyle;
|
|
556
|
+
mode?: TileflowBuildingMode;
|
|
557
|
+
threeDimensional?: TileflowBuildingsThreeDimensionalStyle;
|
|
558
|
+
};
|
|
559
|
+
type TileflowBuildingsModuleConfig = TileflowBuildingsModuleOptions & {
|
|
560
|
+
type: 'buildings';
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
type TileflowLanduseClass = 'cemetery' | 'civic' | 'commercial' | 'education' | 'government' | 'industrial' | 'medical' | 'military' | 'parking' | 'railway' | 'recreation' | 'residential';
|
|
564
|
+
type TileflowLandcoverClass = 'farmland' | 'flowerbed' | 'grass' | 'ice' | 'meadow' | 'protected' | 'recreationGround' | 'rock' | 'sand' | 'scrub' | 'urbanPark' | 'villageGreen' | 'wetland' | 'wood';
|
|
565
|
+
/** The barriers of the data's barrier layer (World's `traffic_control`) the land module draws. */
|
|
566
|
+
type TileflowBarrierClass = 'fence' | 'hedge' | 'wall';
|
|
567
|
+
/**
|
|
568
|
+
* A barrier's line, a shadow line drawn under it (usually offset with `translate`), and the fill of
|
|
569
|
+
* those mapped as areas, such as broad hedges.
|
|
570
|
+
*/
|
|
571
|
+
type TileflowBarrierStyle = {
|
|
572
|
+
area?: TileflowFillStyle;
|
|
573
|
+
shadow?: TileflowLineStyle;
|
|
574
|
+
line?: TileflowLineStyle;
|
|
575
|
+
};
|
|
576
|
+
type TileflowLandModuleOptions = {
|
|
577
|
+
background?: TileflowBackgroundStyle;
|
|
578
|
+
/**
|
|
579
|
+
* Hedges, fences and walls, drawn at the top of the land band with hedges uppermost. A barrier
|
|
580
|
+
* without a style is not drawn, and neither is any when the data has no barrier layer.
|
|
581
|
+
*/
|
|
582
|
+
barriers?: Partial<Record<TileflowBarrierClass, TileflowBarrierStyle>>;
|
|
583
|
+
globalLandcover?: TileflowFillStyle;
|
|
584
|
+
landcover?: Partial<Record<TileflowLandcoverClass, TileflowAreaStyle>>;
|
|
585
|
+
landuse?: Partial<Record<TileflowLanduseClass, TileflowAreaStyle>>;
|
|
586
|
+
};
|
|
587
|
+
type TileflowLandModuleConfig = TileflowLandModuleOptions & {
|
|
588
|
+
type: 'land';
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
declare const tileflowLandformClasses: readonly ["peak", "volcano", "saddle", "ridge", "cliff", "arete"];
|
|
592
|
+
type TileflowLandformClass = (typeof tileflowLandformClasses)[number];
|
|
593
|
+
type TileflowLandformsModuleOptions = {
|
|
594
|
+
classes?: Partial<Record<TileflowLandformClass, TileflowSymbolStyle>>;
|
|
595
|
+
/** Append source elevation in metres when the feature provides it. */
|
|
596
|
+
elevation?: boolean;
|
|
597
|
+
};
|
|
598
|
+
type TileflowLandformsModuleConfig = TileflowLandformsModuleOptions & {
|
|
599
|
+
type: 'landforms';
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Labels anchored inside polygon features, and the clearance labels of bridges and overhead cables;
|
|
604
|
+
* other point-feature labels remain on their feature style.
|
|
605
|
+
*/
|
|
606
|
+
type TileflowNauticalAreaLabelStyles = {
|
|
607
|
+
/**
|
|
608
|
+
* Vertical clearance of bridges, or their clearance closed and open, at bridge points and inside
|
|
609
|
+
* bridge polygons; bridge lines carry it at their centre.
|
|
610
|
+
*/
|
|
611
|
+
bridges?: TileflowSymbolStyle;
|
|
612
|
+
/** Provider coverage cells; hidden unless a map makes this style visible. */
|
|
613
|
+
coverage?: TileflowSymbolStyle;
|
|
614
|
+
hazards?: TileflowSymbolStyle;
|
|
615
|
+
navigationAreas?: TileflowSymbolStyle;
|
|
616
|
+
/** Safe vertical clearance of overhead cables, at cable points and along cable lines. */
|
|
617
|
+
overheadCables?: TileflowSymbolStyle;
|
|
618
|
+
reefs?: TileflowSymbolStyle;
|
|
619
|
+
wrecks?: TileflowSymbolStyle;
|
|
620
|
+
};
|
|
621
|
+
/**
|
|
622
|
+
* One style per semantic group of `nautical-v1` objects. Point groups draw a circle `marker`, an
|
|
623
|
+
* `icon` from the theme's nautical image tokens, and `text`; area groups draw a `fill` and an
|
|
624
|
+
* `outline`; line groups draw one stroke. Every group respects each feature's `min_zoom`, and
|
|
625
|
+
* point groups place more important features (lower `rank`) first.
|
|
626
|
+
*/
|
|
627
|
+
type TileflowNauticalModuleOptions = {
|
|
628
|
+
/** Other aids: moorings, fog signals, racons, radio and signal stations, and virtual aids. */
|
|
629
|
+
aids?: TileflowMarkerSymbolStyle;
|
|
630
|
+
/**
|
|
631
|
+
* Flash each light in its rhythm where a browser runtime animates the map. Defaults to `true`.
|
|
632
|
+
* `false` keeps every light steady, as do reduced motion, capture, and native renderers.
|
|
633
|
+
*/
|
|
634
|
+
animateLights?: boolean;
|
|
635
|
+
/** Fixed beacons and daymarks, coloured by their first colour. */
|
|
636
|
+
beacons?: TileflowMarkerSymbolStyle;
|
|
637
|
+
/** Berth polygons; the outline also strokes berth lines and emphasises guest berths. */
|
|
638
|
+
berths?: TileflowAreaStyle;
|
|
639
|
+
/** Bridge polygons; the outline also strokes bridge lines. */
|
|
640
|
+
bridges?: TileflowAreaStyle;
|
|
641
|
+
/** Buoys, light floats, and light vessels, coloured by their first colour. */
|
|
642
|
+
buoys?: TileflowMarkerSymbolStyle;
|
|
643
|
+
/** Submarine cable and pipeline lines. */
|
|
644
|
+
cables?: TileflowLineStyle;
|
|
645
|
+
/** Restrained indication of where a provider publishes marks. */
|
|
646
|
+
coverage?: TileflowAreaStyle;
|
|
647
|
+
/** Waterway distance marks with their distance and unit. */
|
|
648
|
+
distanceMarks?: TileflowMarkerSymbolStyle;
|
|
649
|
+
/**
|
|
650
|
+
* Small-craft facilities such as fuel, water, slipways, pump-out, visitor berths, boat hoists,
|
|
651
|
+
* and boatyards, at facility points, inside facility polygons, and at the centre of their lines.
|
|
652
|
+
*/
|
|
653
|
+
facilities?: TileflowMarkerSymbolStyle;
|
|
654
|
+
/** Harbour and marina polygons. */
|
|
655
|
+
harbourAreas?: TileflowAreaStyle;
|
|
656
|
+
/** Harbour and marina points, and their symbol and name inside harbour polygons. */
|
|
657
|
+
harbours?: TileflowMarkerSymbolStyle;
|
|
658
|
+
/** Hazard areas; the outline also strokes linear hazards such as booms. */
|
|
659
|
+
hazardAreas?: TileflowAreaStyle;
|
|
660
|
+
/** Rocks by water level, obstructions, and offshore platforms. */
|
|
661
|
+
hazards?: TileflowMarkerSymbolStyle;
|
|
662
|
+
labels?: TileflowNauticalAreaLabelStyles;
|
|
663
|
+
lighthouses?: TileflowMarkerSymbolStyle;
|
|
664
|
+
/** Light flares coloured by the light's first colour, with the chart light label. */
|
|
665
|
+
lights?: TileflowMarkerSymbolStyle;
|
|
666
|
+
/** Restricted, military, anchorage, traffic-separation, and other navigation areas. */
|
|
667
|
+
navigationAreas?: TileflowAreaStyle;
|
|
668
|
+
/** Inland notice boards coloured by function, with the information they show. */
|
|
669
|
+
notices?: TileflowMarkerSymbolStyle;
|
|
670
|
+
/** Overhead cable lines. */
|
|
671
|
+
overheadCables?: TileflowLineStyle;
|
|
672
|
+
/** Ports, sized by `size` and placed by `rank` from low zooms. */
|
|
673
|
+
ports?: TileflowMarkerSymbolStyle;
|
|
674
|
+
reefs?: TileflowAreaStyle;
|
|
675
|
+
/** Traffic-separation lines and recommended routes, tracks, and ferry routes. */
|
|
676
|
+
routes?: TileflowLineStyle;
|
|
677
|
+
soundings?: TileflowMarkerSymbolStyle;
|
|
678
|
+
wreckAreas?: TileflowAreaStyle;
|
|
679
|
+
wrecks?: TileflowMarkerSymbolStyle;
|
|
680
|
+
};
|
|
681
|
+
type TileflowNauticalModuleConfig = TileflowNauticalModuleOptions & {
|
|
682
|
+
type: 'nautical';
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
type TileflowTransitModuleOptions = {
|
|
686
|
+
cableway?: TileflowLineStyle;
|
|
687
|
+
ferry?: TileflowLineStyle;
|
|
688
|
+
rail?: TileflowTransitRailStyle;
|
|
689
|
+
railHatching?: TileflowTransitRailStyle;
|
|
690
|
+
serviceRail?: TileflowTransitRailStyle;
|
|
691
|
+
};
|
|
692
|
+
type TileflowTransitRailStyle = {
|
|
693
|
+
bridge?: TileflowLineStyle;
|
|
694
|
+
surface?: TileflowLineStyle;
|
|
695
|
+
tunnel?: TileflowLineStyle;
|
|
696
|
+
};
|
|
697
|
+
type TileflowTransitModuleConfig = TileflowTransitModuleOptions & {
|
|
698
|
+
type: 'transit';
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
type TileflowWaterwayClass = 'canal' | 'other' | 'river' | 'stream';
|
|
702
|
+
/** Explicit placement for every geometry family in a declared Bathymetry name layer. */
|
|
703
|
+
type TileflowBathymetryNamePlacement = {
|
|
704
|
+
point: 'point';
|
|
705
|
+
line: TileflowSymbolPlacement;
|
|
706
|
+
polygon: TileflowSymbolPlacement;
|
|
707
|
+
};
|
|
708
|
+
type TileflowBathymetryNameStyle = TileflowSymbolStyle & {
|
|
709
|
+
/** Overrides scalar placement for these names; omission preserves scalar placement. */
|
|
710
|
+
placementByGeometry?: TileflowBathymetryNamePlacement;
|
|
711
|
+
};
|
|
712
|
+
type TileflowWaterModuleOptions = {
|
|
713
|
+
bathymetry?: TileflowFillStyle;
|
|
714
|
+
/** Contour lines when declared by Bathymetry; otherwise approximate polygon band edges. */
|
|
715
|
+
bathymetryContours?: TileflowLineStyle;
|
|
716
|
+
/** Contour-depth or legacy band-floor labels, not measured survey soundings. */
|
|
717
|
+
bathymetryLabels?: TileflowSymbolStyle;
|
|
718
|
+
/** Names from an explicitly declared seafloor_landform layer. */
|
|
719
|
+
bathymetryLandforms?: TileflowBathymetryNameStyle;
|
|
720
|
+
/** Names from an explicitly declared water_name layer. */
|
|
721
|
+
bathymetryWaterNames?: TileflowBathymetryNameStyle;
|
|
722
|
+
bodies?: TileflowAreaStyle;
|
|
723
|
+
intermittent?: {
|
|
724
|
+
bodies?: TileflowAreaStyle;
|
|
725
|
+
waterways?: TileflowLineStyle;
|
|
726
|
+
};
|
|
727
|
+
waterways?: Partial<Record<TileflowWaterwayClass, TileflowLineStyle>>;
|
|
728
|
+
};
|
|
729
|
+
type TileflowWaterModuleConfig = TileflowWaterModuleOptions & {
|
|
730
|
+
type: 'water';
|
|
731
|
+
};
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Layer metadata naming the semantic module that owns a compiled layer, such as `roads` or `water`.
|
|
735
|
+
* Runtime features that address a module, such as map emphasis, read it instead of physical layer
|
|
736
|
+
* IDs. Layers that a theme blend splits or copies keep it.
|
|
737
|
+
*/
|
|
738
|
+
declare const tileflowLayerDomainMetadataKey: "tileflow:domain";
|
|
739
|
+
|
|
740
|
+
type TileflowLayerDomain = TileflowSemanticModuleName | 'terrain';
|
|
741
|
+
|
|
742
|
+
type TileflowSemanticModules = {
|
|
743
|
+
addresses?: TileflowAddressesModuleConfig;
|
|
744
|
+
aeroways?: TileflowAerowaysModuleConfig;
|
|
745
|
+
boundaries?: TileflowBoundariesModuleConfig;
|
|
746
|
+
buildings?: TileflowBuildingsModuleConfig;
|
|
747
|
+
labels?: TileflowLabelsModuleConfig;
|
|
748
|
+
land?: TileflowLandModuleConfig;
|
|
749
|
+
landforms?: TileflowLandformsModuleConfig;
|
|
750
|
+
nautical?: TileflowNauticalModuleConfig;
|
|
751
|
+
poi?: TileflowPoiModuleConfig;
|
|
752
|
+
roads?: TileflowRoadsModuleConfig;
|
|
753
|
+
transit?: TileflowTransitModuleConfig;
|
|
754
|
+
vegetation?: TileflowVegetationModuleConfig;
|
|
755
|
+
water?: TileflowWaterModuleConfig;
|
|
756
|
+
};
|
|
757
|
+
type TileflowSemanticModuleName = keyof TileflowSemanticModules;
|
|
758
|
+
|
|
759
|
+
type TileflowThemeColorScheme = 'dark' | 'light';
|
|
760
|
+
|
|
761
|
+
declare const tileflowRouteMetadataKey = "tileflow:route";
|
|
762
|
+
/** The resolved inks of a route, from its outer glow to its bright core. */
|
|
763
|
+
type TileflowRouteInks = Readonly<{
|
|
764
|
+
/** The chosen route's line. */
|
|
765
|
+
line: string;
|
|
766
|
+
/** The edge on each side of the line, which sets it apart from the roads under it. */
|
|
767
|
+
casing: string;
|
|
768
|
+
/** A thin line along the middle of the route. */
|
|
769
|
+
core: string;
|
|
770
|
+
/** A soft halo around the route. */
|
|
771
|
+
glow: string;
|
|
772
|
+
/** Other routes offered beside the chosen one. */
|
|
773
|
+
alternative: string;
|
|
774
|
+
/** Opacity of the glow, from 0 (no glow) to 1. */
|
|
775
|
+
glowOpacity: number;
|
|
776
|
+
/** Opacity of the core, from 0 (no core) to 1. */
|
|
777
|
+
coreOpacity: number;
|
|
778
|
+
}>;
|
|
779
|
+
/** The inks of a theme that sets no route tokens: a blue that reads on either kind of map. */
|
|
780
|
+
declare const tileflowDefaultRouteInks: Readonly<Record<TileflowThemeColorScheme, TileflowRouteInks>>;
|
|
781
|
+
/**
|
|
782
|
+
* Reads the route inks a compiled style publishes, or undefined when its metadata has none (a
|
|
783
|
+
* style compiled before route inks, or not by Tileflow).
|
|
784
|
+
*/
|
|
785
|
+
declare function readTileflowRouteInks(metadata: unknown): TileflowRouteInks | undefined;
|
|
786
|
+
/**
|
|
787
|
+
* The route inks of a compiled style: those it publishes, or the defaults of its colour scheme
|
|
788
|
+
* (from its `tileflow:colorScheme` metadata, else `fallbackScheme`).
|
|
789
|
+
*/
|
|
790
|
+
declare function tileflowStyleRouteInks(style: {
|
|
791
|
+
metadata?: unknown;
|
|
792
|
+
} | undefined, fallbackScheme?: TileflowThemeColorScheme): TileflowRouteInks;
|
|
793
|
+
/**
|
|
794
|
+
* Inks between two themes' inks, `t` of the way from `from` to `to`: colours mix in OKLab, as theme
|
|
795
|
+
* blends mix paint colours, and opacities linearly.
|
|
796
|
+
*/
|
|
797
|
+
declare function mixTileflowRouteInks(from: TileflowRouteInks, to: TileflowRouteInks, t: number): TileflowRouteInks;
|
|
798
|
+
|
|
799
|
+
type TileflowRuntimeColorScheme = 'dark' | 'light';
|
|
800
|
+
|
|
801
|
+
type TileflowAnalytics = {
|
|
802
|
+
apiUrl?: string;
|
|
803
|
+
endpoint?: string;
|
|
804
|
+
enabled?: boolean;
|
|
805
|
+
mapId?: string;
|
|
806
|
+
metadata?: Record<string, unknown>;
|
|
807
|
+
projectId?: string;
|
|
808
|
+
sdkVersion?: string;
|
|
809
|
+
source?: string;
|
|
810
|
+
styleId?: string;
|
|
811
|
+
surfaceId?: string;
|
|
812
|
+
};
|
|
813
|
+
type TileflowSessionController = {
|
|
814
|
+
readonly sessionId: string;
|
|
815
|
+
resolveRequestUrl(url: string, analytics: TileflowAnalytics | undefined): Promise<string | undefined>;
|
|
816
|
+
};
|
|
817
|
+
type TileflowRuntimeStyle = {
|
|
818
|
+
analytics?: TileflowAnalytics;
|
|
819
|
+
colorScheme?: TileflowRuntimeColorScheme;
|
|
820
|
+
/** An explicit empty array means the manifest declares that no web fonts are required. */
|
|
821
|
+
fontFaces?: TileflowStyleFontFace[];
|
|
822
|
+
revision?: string;
|
|
823
|
+
style: MapLibreStyle | string;
|
|
824
|
+
theme?: string;
|
|
825
|
+
};
|
|
826
|
+
type TileflowStyleFontFace = {
|
|
827
|
+
family: string;
|
|
828
|
+
source: string;
|
|
829
|
+
style?: 'italic' | 'normal' | 'oblique';
|
|
830
|
+
weight?: '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
831
|
+
};
|
|
832
|
+
/**
|
|
833
|
+
* A continuous blend of named themes of one Tileflow map. `position` places the map between
|
|
834
|
+
* neighbouring themes: 0 is the first, 1 the second, and 1.25 a quarter of the way from the second
|
|
835
|
+
* to the third.
|
|
836
|
+
*/
|
|
837
|
+
type TileflowThemeBlendSelection = Readonly<{
|
|
838
|
+
/** From 0 to `themes.length - 1`. */
|
|
839
|
+
position: number;
|
|
840
|
+
/** Two to eight concrete theme names of the map, in blend order. */
|
|
841
|
+
themes: readonly string[];
|
|
842
|
+
}>;
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Map emphasis lets an application's own content read first: chosen modules of the map recede
|
|
846
|
+
* towards the map's ground colour, and the map's labels and icons fade, except inside an area the
|
|
847
|
+
* application keeps at full strength. It only touches layers that a Tileflow map compiled, which
|
|
848
|
+
* name their module in their metadata; an application's own layers are never changed.
|
|
849
|
+
*
|
|
850
|
+
* This module plans which paint values an emphasis changes and computes each value for a strength
|
|
851
|
+
* from 0 (the map as designed) to 1 (the full emphasis). The browser controller writes them.
|
|
852
|
+
*/
|
|
853
|
+
/** A module of a compiled Tileflow map, such as `roads`, `transit`, `boundaries`, or `water`. */
|
|
854
|
+
type TileflowEmphasisModule = TileflowLayerDomain;
|
|
855
|
+
/** A GeoJSON polygon or multipolygon, in longitude and latitude. */
|
|
856
|
+
type TileflowEmphasisArea = Readonly<{
|
|
857
|
+
coordinates: readonly (readonly (readonly number[])[])[];
|
|
858
|
+
type: 'Polygon';
|
|
859
|
+
}> | Readonly<{
|
|
860
|
+
coordinates: readonly (readonly (readonly (readonly number[])[])[])[];
|
|
861
|
+
type: 'MultiPolygon';
|
|
862
|
+
}>;
|
|
863
|
+
/** How the map steps back so an application's content reads first. */
|
|
864
|
+
type TileflowEmphasis = Readonly<{
|
|
865
|
+
/**
|
|
866
|
+
* Modules whose ground recedes towards the map's ground colour, and how far, from 0 (as
|
|
867
|
+
* designed) to 1 (the ground colour itself). Artwork that cannot be recoloured, such as
|
|
868
|
+
* patterns, fades by the same amount instead.
|
|
869
|
+
*/
|
|
870
|
+
recede?: Readonly<Partial<Record<TileflowEmphasisModule, number>>>;
|
|
871
|
+
/** The share of their opacity the map's labels and icons keep, from 0 to 1. */
|
|
872
|
+
labels?: number;
|
|
873
|
+
/** An area in which the map's labels and icons keep their full strength. */
|
|
874
|
+
keep?: TileflowEmphasisArea;
|
|
875
|
+
}>;
|
|
876
|
+
/** Why an emphasis cannot be shown, or undefined when it can. */
|
|
877
|
+
declare function validateTileflowEmphasis(value: unknown): TypeError | undefined;
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* Browser helpers for theme transitions and blends. They use only methods that MapLibre GL JS maps
|
|
881
|
+
* provide and check each one at runtime, so a map without them falls back to an immediate change.
|
|
882
|
+
*/
|
|
883
|
+
type TileflowThemeMotionMap = {
|
|
884
|
+
areTilesLoaded?: unknown;
|
|
885
|
+
getCanvas?: unknown;
|
|
886
|
+
getImage?: unknown;
|
|
887
|
+
getLayer?: unknown;
|
|
888
|
+
getStyle?: unknown;
|
|
889
|
+
isStyleLoaded?: unknown;
|
|
890
|
+
off(event: string, listener: (event?: unknown) => void): unknown;
|
|
891
|
+
on(event: string, listener: (event?: unknown) => void): unknown;
|
|
892
|
+
project?: unknown;
|
|
893
|
+
redraw?: unknown;
|
|
894
|
+
setLayoutProperty?: unknown;
|
|
895
|
+
setLight?: unknown;
|
|
896
|
+
setPaintProperty?: unknown;
|
|
897
|
+
setSky?: unknown;
|
|
898
|
+
unproject?: unknown;
|
|
899
|
+
updateImage?: unknown;
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
declare const tileflowSkyLayerId = "tileflow-sky";
|
|
903
|
+
/** The MapLibre GL JS map capabilities the sky layer uses; importing this module loads no renderer. */
|
|
904
|
+
type TileflowSkyMap = {
|
|
905
|
+
addLayer(layer: object, beforeId?: string): unknown;
|
|
906
|
+
getBearing(): number;
|
|
907
|
+
getLayer(id: string): unknown;
|
|
908
|
+
getPitch(): number;
|
|
909
|
+
getSky?(): unknown;
|
|
910
|
+
getStyle(): unknown;
|
|
911
|
+
getTerrain?(): unknown;
|
|
912
|
+
getVerticalFieldOfView?(): number;
|
|
913
|
+
isStyleLoaded(): boolean | void;
|
|
914
|
+
off(event: string, listener: () => void): unknown;
|
|
915
|
+
on(event: string, listener: () => void): unknown;
|
|
916
|
+
removeLayer(id: string): unknown;
|
|
917
|
+
};
|
|
918
|
+
/**
|
|
919
|
+
* Light in the sky above the horizon, for maps that declare a sky: a glow on the horizon towards
|
|
920
|
+
* a low sun, the sun's disc as it sets or rises, and stars as the sky darkens. The sun is the one
|
|
921
|
+
* a theme controller shows, so a sun an application places by date brings its glow; without a
|
|
922
|
+
* controller, the theme's own sun. The layer sits under every other layer and draws only where
|
|
923
|
+
* nothing else has, so buildings and trees stand in front. Follows style replacements; the
|
|
924
|
+
* returned function removes the layer.
|
|
925
|
+
*/
|
|
926
|
+
declare function attachTileflowSky(map: TileflowSkyMap): () => void;
|
|
927
|
+
|
|
928
|
+
declare const tileflowSkyHazeLayerId = "tileflow-sky-haze";
|
|
929
|
+
/** The MapLibre GL JS map capabilities the haze reads; importing this module loads no renderer. */
|
|
930
|
+
type TileflowSkyHazeView = {
|
|
931
|
+
getBearing?(): number;
|
|
932
|
+
getCanvas?(): {
|
|
933
|
+
clientHeight: number;
|
|
934
|
+
};
|
|
935
|
+
getCenter?(): {
|
|
936
|
+
lat: number;
|
|
937
|
+
lng: number;
|
|
938
|
+
};
|
|
939
|
+
getPitch(): number;
|
|
940
|
+
getSky?(): unknown;
|
|
941
|
+
getVerticalFieldOfView?(): number;
|
|
942
|
+
getZoom?(): number;
|
|
943
|
+
};
|
|
944
|
+
/** The map capabilities the haze layer uses. */
|
|
945
|
+
type TileflowSkyHazeMap = TileflowSkyHazeView & {
|
|
946
|
+
addLayer(layer: object, beforeId?: string): unknown;
|
|
947
|
+
getLayer(id: string): unknown;
|
|
948
|
+
getLayersOrder?(): string[];
|
|
949
|
+
getStyle(): unknown;
|
|
950
|
+
getTerrain?(): unknown;
|
|
951
|
+
moveLayer?(id: string, beforeId?: string): unknown;
|
|
952
|
+
off(event: string, listener: () => void): unknown;
|
|
953
|
+
on(event: string, listener: () => void): unknown;
|
|
954
|
+
removeLayer(id: string): unknown;
|
|
955
|
+
};
|
|
956
|
+
/**
|
|
957
|
+
* The distance haze over the flat map, for maps with a sky: a band of the sky's horizon colour from
|
|
958
|
+
* where the haze starts up to the horizon, thickening with the flat ground's distance, so the
|
|
959
|
+
* ground meets the sky in the colour the sky starts with. It sits under the first 3D layer (or,
|
|
960
|
+
* without one, the first label layer); Tileflow's 3D buildings, trees and models haze themselves
|
|
961
|
+
* in their own shaders, and labels drawn above it stay clear. It shows only above 45° of pitch,
|
|
962
|
+
* costs one quad, and follows style replacements; the returned function removes it.
|
|
963
|
+
*/
|
|
964
|
+
declare function attachTileflowSkyHaze(map: TileflowSkyHazeMap): () => void;
|
|
965
|
+
|
|
966
|
+
/** Structural MapLibre capabilities; importing this module never loads a renderer. */
|
|
967
|
+
type TileflowAtmosphereMap = {
|
|
968
|
+
getBearing(): number;
|
|
969
|
+
getCanvas(): HTMLCanvasElement;
|
|
970
|
+
getCenter(): {
|
|
971
|
+
lat: number;
|
|
972
|
+
lng: number;
|
|
973
|
+
};
|
|
974
|
+
getContainer(): HTMLElement;
|
|
975
|
+
getPitch(): number;
|
|
976
|
+
getZoom(): number;
|
|
977
|
+
getStyle(): {
|
|
978
|
+
metadata?: unknown;
|
|
979
|
+
projection?: {
|
|
980
|
+
type?: unknown;
|
|
981
|
+
};
|
|
982
|
+
} | undefined;
|
|
983
|
+
on(event: 'move' | 'resize' | 'style.load' | 'remove', listener: () => void): unknown;
|
|
984
|
+
off(event: 'move' | 'resize' | 'style.load' | 'remove', listener: () => void): unknown;
|
|
985
|
+
} & Partial<TileflowSkyMap> & Partial<TileflowSkyHazeMap>;
|
|
986
|
+
type TileflowAtmosphereRuntimeOptions = {
|
|
987
|
+
/** Camera-relative star speed multiplier. Negative values reverse direction. Default: 1. */
|
|
988
|
+
starParallaxScale?: number;
|
|
989
|
+
};
|
|
990
|
+
/**
|
|
991
|
+
* Render compiled globe atmosphere metadata, and the stars and distance haze of a sky. Call after
|
|
992
|
+
* constructing a browser map. Follows style replacements and releases its canvas, layer,
|
|
993
|
+
* listeners, and pending frame on disposal.
|
|
994
|
+
*/
|
|
995
|
+
declare function attachTileflowAtmosphere(map: TileflowAtmosphereMap, runtimeOptions?: TileflowAtmosphereRuntimeOptions): () => void;
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* The steepest camera pitch Tileflow supports, in degrees from looking straight down. Every
|
|
999
|
+
* portable view admits pitch 0–85, and Tileflow's maps raise MapLibre's own default of 60 to this,
|
|
1000
|
+
* so a street-level view looks along the street to the sky. A map's `mapOptions.maxPitch` lowers it.
|
|
1001
|
+
*/
|
|
1002
|
+
declare const tileflowMaxPitch = 85;
|
|
1003
|
+
|
|
1004
|
+
declare const tileflowSkyMetadataKey = "tileflow:sky";
|
|
1005
|
+
/** One theme's sky colours, as a time of day lends them to a sky that follows the sun. */
|
|
1006
|
+
type TileflowSkyColours = Readonly<{
|
|
1007
|
+
color: string;
|
|
1008
|
+
horizonColor: string;
|
|
1009
|
+
horizonBlend: number;
|
|
1010
|
+
glowColor: string;
|
|
1011
|
+
}>;
|
|
1012
|
+
/** The skies of a theme's time-of-day family, from which a sky that follows the sun is mixed. */
|
|
1013
|
+
type TileflowSkyTimesOfDay = Readonly<Record<'day' | 'dawn' | 'dusk' | 'night', TileflowSkyColours>>;
|
|
1014
|
+
/**
|
|
1015
|
+
* The versioned runtime payload: what the browser needs to draw the stars and the glow round the
|
|
1016
|
+
* sun, and, for a theme in a time-of-day family, the family's skies, so that a sun an application
|
|
1017
|
+
* places brings the sky of its hour.
|
|
1018
|
+
*/
|
|
1019
|
+
type TileflowSkyMetadata = Readonly<{
|
|
1020
|
+
version: 1;
|
|
1021
|
+
starIntensity: number;
|
|
1022
|
+
glowColor: string;
|
|
1023
|
+
timesOfDay?: TileflowSkyTimesOfDay;
|
|
1024
|
+
}>;
|
|
1025
|
+
/** Validate the runtime payload without loading authoring schemas. */
|
|
1026
|
+
declare function readTileflowSky(value: unknown): TileflowSkyMetadata | undefined;
|
|
1027
|
+
/**
|
|
1028
|
+
* The sky of a sun at this height and direction, mixed from a time-of-day family's skies: the day
|
|
1029
|
+
* sky above the golden hour, the dawn or dusk sky within two degrees of sunrise or sunset (dawn while the sun is in
|
|
1030
|
+
* the eastern half of the sky), and the night sky once twilight ends. Every colour comes from the
|
|
1031
|
+
* family's themes, so a monochrome or a client's own family keeps its palette.
|
|
1032
|
+
*/
|
|
1033
|
+
declare function tileflowSkyAtSun(times: TileflowSkyTimesOfDay, sun: Readonly<{
|
|
1034
|
+
altitude: number;
|
|
1035
|
+
azimuth: number;
|
|
1036
|
+
}>): TileflowSkyColours;
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* The WebGL context a browser map asks for. Multisampling is on, so the thin edges of 3D models,
|
|
1040
|
+
* buildings and trees resolve smoothly instead of breaking into stipple. Attributes the caller
|
|
1041
|
+
* passes win, so `{antialias: false}` opts out.
|
|
1042
|
+
*/
|
|
1043
|
+
declare function tileflowCanvasContextAttributes<T extends object>(attributes?: T): T & {
|
|
1044
|
+
antialias: boolean;
|
|
1045
|
+
};
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* Boundaries families. Each one has its own license, attribution, TileJSON path and style source
|
|
1049
|
+
* ID; families are never merged.
|
|
1050
|
+
*/
|
|
1051
|
+
declare const tileflowBoundaryFamilies: Readonly<{
|
|
1052
|
+
boundaries: Readonly<{
|
|
1053
|
+
attribution: "© OpenStreetMap contributors";
|
|
1054
|
+
license: "ODbL-1.0";
|
|
1055
|
+
path: "/tiles/boundaries/tiles.json";
|
|
1056
|
+
sourceId: "tileflow-boundaries";
|
|
1057
|
+
}>;
|
|
1058
|
+
}>;
|
|
1059
|
+
type TileflowBoundaryFamily = keyof typeof tileflowBoundaryFamilies;
|
|
1060
|
+
|
|
1061
|
+
/** A value a choropleth can colour: a number for scales, a string for categories. */
|
|
1062
|
+
type TileflowBoundaryValue = number | string;
|
|
1063
|
+
/** One row of an application's data, keyed by a registry ID or an official code. */
|
|
1064
|
+
type TileflowBoundaryRow = Readonly<{
|
|
1065
|
+
key: number | string;
|
|
1066
|
+
/** `null` leaves the area without a value. */
|
|
1067
|
+
value: TileflowBoundaryValue | null;
|
|
1068
|
+
}>;
|
|
1069
|
+
/** Keys present on every `boundary_area` polygon, usable without the lookup table. */
|
|
1070
|
+
type TileflowBoundaryFeatureKey = 'id' | 'iso_3166_1' | 'ref';
|
|
1071
|
+
/** Rows joined to areas by one polygon key. */
|
|
1072
|
+
type TileflowBoundaryValues = Readonly<{
|
|
1073
|
+
joinBy: TileflowBoundaryFeatureKey;
|
|
1074
|
+
rows: readonly TileflowBoundaryRow[];
|
|
1075
|
+
}>;
|
|
1076
|
+
|
|
1077
|
+
type FeatureTarget$1 = {
|
|
1078
|
+
id?: number | string;
|
|
1079
|
+
source: string;
|
|
1080
|
+
sourceLayer?: string;
|
|
1081
|
+
};
|
|
1082
|
+
/** The part of a MapLibre map the controller uses. */
|
|
1083
|
+
type TileflowFeatureStateMap = {
|
|
1084
|
+
getSource(id: string): unknown;
|
|
1085
|
+
getStyle?(): {
|
|
1086
|
+
sources?: Record<string, unknown>;
|
|
1087
|
+
} | undefined;
|
|
1088
|
+
off(type: 'styledata', listener: () => void): unknown;
|
|
1089
|
+
on(type: 'styledata', listener: () => void): unknown;
|
|
1090
|
+
removeFeatureState(target: FeatureTarget$1, key?: string): void;
|
|
1091
|
+
setFeatureState(target: FeatureTarget$1 & {
|
|
1092
|
+
id: number | string;
|
|
1093
|
+
}, state: Record<string, unknown>): void;
|
|
1094
|
+
};
|
|
1095
|
+
type CreateBoundaryFeatureStateOptions = Readonly<{
|
|
1096
|
+
/** Defaults to `boundaries`. */
|
|
1097
|
+
family?: TileflowBoundaryFamily;
|
|
1098
|
+
/** Also set the values on `boundary_label` points, for labels styled by value. */
|
|
1099
|
+
labels?: boolean;
|
|
1100
|
+
/** Feature-state key; it must match the choropleth's `state`. Defaults to `value`. */
|
|
1101
|
+
state?: string;
|
|
1102
|
+
}>;
|
|
1103
|
+
type TileflowBoundaryFeatureState = Readonly<{
|
|
1104
|
+
/** Remove every value this controller set. */
|
|
1105
|
+
clear: () => void;
|
|
1106
|
+
/** Remove the values and stop following style reloads. */
|
|
1107
|
+
dispose: () => void;
|
|
1108
|
+
/**
|
|
1109
|
+
* Replace the values. Rows must be keyed by the source's feature ID: `id` by default, or `ref`
|
|
1110
|
+
* when the map declares `promoteId: 'ref'`. Rows with a `null` value are removed.
|
|
1111
|
+
*/
|
|
1112
|
+
set: (values: TileflowBoundaryValues) => void;
|
|
1113
|
+
}>;
|
|
1114
|
+
/**
|
|
1115
|
+
* Keep Boundaries feature-state in sync with application rows. Values survive a style reload: the
|
|
1116
|
+
* controller sets them again once the source is back.
|
|
1117
|
+
*/
|
|
1118
|
+
declare function createBoundaryFeatureState(map: TileflowFeatureStateMap, options?: CreateBoundaryFeatureStateOptions): TileflowBoundaryFeatureState;
|
|
1119
|
+
|
|
1120
|
+
type Layer = {
|
|
1121
|
+
id: string;
|
|
1122
|
+
type?: string;
|
|
1123
|
+
renderingMode?: string;
|
|
1124
|
+
metadata?: unknown;
|
|
1125
|
+
};
|
|
1126
|
+
/** Public renderer capabilities needed to place ground road names around the 3D scene. */
|
|
1127
|
+
type TileflowLabelPlacementMap = {
|
|
1128
|
+
getLayer(id: string): unknown;
|
|
1129
|
+
getLayersOrder?(): string[];
|
|
1130
|
+
getPitch(): number;
|
|
1131
|
+
getStyle(): {
|
|
1132
|
+
layers: Layer[];
|
|
1133
|
+
metadata?: unknown;
|
|
1134
|
+
} | undefined;
|
|
1135
|
+
moveLayer?(id: string, beforeId?: string): unknown;
|
|
1136
|
+
on(event: string, listener: () => void): unknown;
|
|
1137
|
+
off(event: string, listener: () => void): unknown;
|
|
1138
|
+
};
|
|
1139
|
+
/**
|
|
1140
|
+
* Keep ground road names readable around solid buildings and vegetation. MapLibre owns
|
|
1141
|
+
* distance selection, collisions and fading; this controller never changes feature filters.
|
|
1142
|
+
* Explicit render-stack placement opts a road out of this automatic scene ordering.
|
|
1143
|
+
*/
|
|
1144
|
+
declare function attachTileflowLabelPlacement(map: TileflowLabelPlacementMap): () => void;
|
|
1145
|
+
|
|
1146
|
+
/** The drawn stretch of a line and its highlights, as shares of the line's length from its start. */
|
|
1147
|
+
type TileflowLineProgressState = Readonly<{
|
|
1148
|
+
/** Where the drawn stretch starts, from 0 (the default) to 1. */
|
|
1149
|
+
start?: number;
|
|
1150
|
+
/** Where the drawn stretch ends, from 0 to 1 (the default, the whole line). */
|
|
1151
|
+
end?: number;
|
|
1152
|
+
/** Where a light sits along the line, or undefined (the default) for none. */
|
|
1153
|
+
light?: number;
|
|
1154
|
+
/** The whole line's opacity, multiplied with each layer's own, from 0 to 1 (the default). */
|
|
1155
|
+
opacity?: number;
|
|
1156
|
+
}>;
|
|
1157
|
+
type TileflowLineProgressGradientOptions = Readonly<{
|
|
1158
|
+
/** The line's colour. */
|
|
1159
|
+
color: string;
|
|
1160
|
+
/** The colour at the head and in the light; defaults to `color`, which shows neither. */
|
|
1161
|
+
highlight?: string;
|
|
1162
|
+
/**
|
|
1163
|
+
* Length of the head's highlight, as a share of the line. The head shows while the drawn stretch
|
|
1164
|
+
* ends before the line does. Defaults to 0.04; 0 shows no head.
|
|
1165
|
+
*/
|
|
1166
|
+
headLength?: number;
|
|
1167
|
+
/** Length of the light, as a share of the line. Defaults to `headLength`. */
|
|
1168
|
+
lightLength?: number;
|
|
1169
|
+
}>;
|
|
1170
|
+
/**
|
|
1171
|
+
* The `line-gradient` of a line drawn from `state.start` to `state.end`. The source of the layer
|
|
1172
|
+
* must be GeoJSON with `lineMetrics: true`.
|
|
1173
|
+
*/
|
|
1174
|
+
declare function tileflowLineProgressGradient(state: TileflowLineProgressState, options: TileflowLineProgressGradientOptions): unknown[];
|
|
1175
|
+
|
|
1176
|
+
/** Structural MapLibre capabilities; importing this module never loads a renderer. */
|
|
1177
|
+
type TileflowLineProgressMap = {
|
|
1178
|
+
getCanvas?: unknown;
|
|
1179
|
+
getLayer(id: string): unknown;
|
|
1180
|
+
setPaintProperty(layer: string, name: string, value: unknown): unknown;
|
|
1181
|
+
on(event: 'styledata', listener: () => void): unknown;
|
|
1182
|
+
off(event: 'styledata', listener: () => void): unknown;
|
|
1183
|
+
};
|
|
1184
|
+
/** One line layer of the group, over a GeoJSON source with `lineMetrics: true`. */
|
|
1185
|
+
type TileflowLineProgressLayer = Readonly<{
|
|
1186
|
+
id: string;
|
|
1187
|
+
/** The layer's colour along the drawn line. */
|
|
1188
|
+
color: string;
|
|
1189
|
+
/** The colour at the head and in the light; defaults to `color`. */
|
|
1190
|
+
highlight?: string;
|
|
1191
|
+
/** The layer's own opacity, from 0 to 1 (the default). */
|
|
1192
|
+
opacity?: number;
|
|
1193
|
+
}>;
|
|
1194
|
+
type TileflowLineProgressOptions = Readonly<{
|
|
1195
|
+
/** The layers drawn together, such as a route's glow, casing, line and core. */
|
|
1196
|
+
layers: readonly TileflowLineProgressLayer[];
|
|
1197
|
+
/** Length of the head's highlight, as a share of the line; defaults to 0.04. */
|
|
1198
|
+
headLength?: number;
|
|
1199
|
+
/** Length of the light, as a share of the line; defaults to `headLength`. */
|
|
1200
|
+
lightLength?: number;
|
|
1201
|
+
/** What the layers show at first; defaults to the whole line, without a light. */
|
|
1202
|
+
initial?: TileflowLineProgressState;
|
|
1203
|
+
}>;
|
|
1204
|
+
type TileflowLineProgressAnimation = Readonly<{
|
|
1205
|
+
/** The values to reach; values left out keep what they show. */
|
|
1206
|
+
to: TileflowLineProgressState;
|
|
1207
|
+
/** Milliseconds, from 0 to 60000. */
|
|
1208
|
+
duration: number;
|
|
1209
|
+
/** Maps elapsed time (0 to 1) to progress (0 to 1); defaults to an ease in and out. */
|
|
1210
|
+
easing?: (t: number) => number;
|
|
1211
|
+
}>;
|
|
1212
|
+
/** What the layers show: `light` is absent when no light shows. */
|
|
1213
|
+
type TileflowLineProgressShown = Readonly<{
|
|
1214
|
+
start: number;
|
|
1215
|
+
end: number;
|
|
1216
|
+
light?: number;
|
|
1217
|
+
opacity: number;
|
|
1218
|
+
}>;
|
|
1219
|
+
type TileflowLineProgressController = {
|
|
1220
|
+
/** What the layers show now, mid-animation included. */
|
|
1221
|
+
get(): TileflowLineProgressShown;
|
|
1222
|
+
/**
|
|
1223
|
+
* Shows new values at once and stops a running animation. Values left out keep what they show;
|
|
1224
|
+
* `light: undefined` takes the light off.
|
|
1225
|
+
*/
|
|
1226
|
+
set(state: TileflowLineProgressState): void;
|
|
1227
|
+
/**
|
|
1228
|
+
* Moves to new values over a duration and resolves `true` when it gets there, or `false` when
|
|
1229
|
+
* `set`, another animation, or `dispose` stops it first. A light that is not showing starts from
|
|
1230
|
+
* the start of the drawn stretch. With reduced motion requested, it shows the values at once.
|
|
1231
|
+
*/
|
|
1232
|
+
animate(animation: TileflowLineProgressAnimation): Promise<boolean>;
|
|
1233
|
+
/** Changes the layers' colours or the highlight lengths, for example when the theme changes. */
|
|
1234
|
+
configure(options: Partial<Omit<TileflowLineProgressOptions, 'initial'>>): void;
|
|
1235
|
+
/** Stops writing to the map. The layers keep what they show. */
|
|
1236
|
+
dispose(): void;
|
|
1237
|
+
};
|
|
1238
|
+
/**
|
|
1239
|
+
* Draws a line on, a share of its length at a time, over a group of MapLibre line layers: their
|
|
1240
|
+
* `line-gradient` shows the drawn stretch, a bright head where it is being drawn, and a light that
|
|
1241
|
+
* can run along it. The controller owns each layer's `line-gradient` and `line-opacity`, writes
|
|
1242
|
+
* only what changed, and paints a layer again when a style change re-creates it. Layers that are
|
|
1243
|
+
* not on the map are skipped until they are.
|
|
1244
|
+
*/
|
|
1245
|
+
declare function createTileflowLineProgress(map: TileflowLineProgressMap, options: TileflowLineProgressOptions): TileflowLineProgressController;
|
|
1246
|
+
|
|
1247
|
+
/** The renderer's tile units: MapLibre projects custom layers' tiles over 8192. */
|
|
1248
|
+
declare const tileflowBuildingExtent = 8192;
|
|
1249
|
+
/** Bytes per vertex; see `meshTileflowBuildings` for the layout. */
|
|
1250
|
+
declare const tileflowBuildingVertexBytes = 28;
|
|
1251
|
+
type TileflowBuildingMeshOptions = Readonly<{
|
|
1252
|
+
/** The tile's width in metres, for the length of each wall. */
|
|
1253
|
+
tileMetres: number;
|
|
1254
|
+
/** Height used where a building has none, in metres; defaults to 5, World's own fallback. */
|
|
1255
|
+
defaultHeight?: number;
|
|
1256
|
+
/** Exterior corner radius in metres, up to 1; 0 leaves the footprint unchanged. */
|
|
1257
|
+
edgeRadius?: number;
|
|
1258
|
+
/** Maximum turn per rounded segment; defaults to 30 degrees for close views. */
|
|
1259
|
+
cornerAngle?: number;
|
|
1260
|
+
/**
|
|
1261
|
+
* The tile's places (World's `poi` layer), for the night use of buildings when the tile's
|
|
1262
|
+
* buildings do not carry World's `night_use`: a place inside a building, or on its facade, gives
|
|
1263
|
+
* the building its use.
|
|
1264
|
+
*/
|
|
1265
|
+
places?: TileflowTileLayer;
|
|
1266
|
+
/**
|
|
1267
|
+
* Footprints of the building models standing here, as rings of tile units (0 to 8192): a
|
|
1268
|
+
* building whose centre falls inside one, or that reaches more than half a metre into one, is not
|
|
1269
|
+
* raised, since the model stands in for it.
|
|
1270
|
+
*/
|
|
1271
|
+
masks?: readonly (readonly number[])[];
|
|
1272
|
+
}>;
|
|
1273
|
+
type BuildingMeshGroup = {
|
|
1274
|
+
/** Conservative tile-space x/y bounds and maximum height in metres. */
|
|
1275
|
+
bounds: [number, number, number, number, number];
|
|
1276
|
+
roofsFrom: number;
|
|
1277
|
+
roofsCount: number;
|
|
1278
|
+
wallsFrom: number;
|
|
1279
|
+
wallsCount: number;
|
|
1280
|
+
};
|
|
1281
|
+
/** One tile's buildings, ready to upload. */
|
|
1282
|
+
type TileflowBuildingMesh = Readonly<{
|
|
1283
|
+
groups?: readonly BuildingMeshGroup[];
|
|
1284
|
+
vertices: Uint8Array;
|
|
1285
|
+
indices: Uint32Array;
|
|
1286
|
+
/** The first wall index: roofs come before it, walls from it. */
|
|
1287
|
+
wallsFrom: number;
|
|
1288
|
+
/** The tallest building, in metres. */
|
|
1289
|
+
top: number;
|
|
1290
|
+
/** Each vertex's building is an index into these feature properties. */
|
|
1291
|
+
features: readonly Readonly<Record<string, string | number | boolean>>[];
|
|
1292
|
+
}>;
|
|
1293
|
+
/**
|
|
1294
|
+
* Meshes the buildings of one decoded tile layer, or returns undefined when it has none. It reads
|
|
1295
|
+
* World's `render_height`, `render_min_height`, `hide_3d`, `building_tone`, `class` and `night_use`.
|
|
1296
|
+
* Vertex layout:
|
|
1297
|
+
* 0 position in the tile, 0 to 8192 (uint16 ×2); 4 base and top in decimetres (uint16 ×2); 8 the
|
|
1298
|
+
* wall's outward normal (int8 ×2, normalised); 10 raised to the top, part of a wall (uint8 ×2);
|
|
1299
|
+
* 12 decimetres along the wall (uint16); 14 a per-building jitter and seed (uint8 ×2, normalised);
|
|
1300
|
+
* 16 the building's centre in the tile (uint16 ×2); 20 tone plus four times its class group, and
|
|
1301
|
+
* night use (uint8 ×2: none, dining, entertainment, nightlife); 22 the wall's
|
|
1302
|
+
* tight corners, bit 0 at its start and bit 1 at its end, and bit 2 when it faces a courtyard, and
|
|
1303
|
+
* its length in metres up to 255
|
|
1304
|
+
* (uint8 ×2); 24 the building's feature index (uint16); 26 on a roof, the vertex's corner of its
|
|
1305
|
+
* triangle (0 to 2), on a wall, 0 at its start and 1 at its end (uint8); 27 on a roof, the triangle's
|
|
1306
|
+
* sides that are the roof's outline, bit n for the side facing corner n, on a wall, bit 0 when its
|
|
1307
|
+
* start and bit 1 when its end lies on the tile's edge (uint8).
|
|
1308
|
+
*
|
|
1309
|
+
* A building's jitter is the same for every piece of it a tile edge cuts, so the renderer can vary
|
|
1310
|
+
* buildings' brightness with it without a seam along the tile's edge.
|
|
1311
|
+
*/
|
|
1312
|
+
declare function meshTileflowBuildings(layer: TileflowTileLayer, options: TileflowBuildingMeshOptions): TileflowBuildingMesh | undefined;
|
|
1313
|
+
|
|
1314
|
+
/** Begin/end height fractions, begin/end multipliers and the base-10 curve exponent. */
|
|
1315
|
+
type TileflowModelEmissionGradient = readonly [number, number, number, number, number];
|
|
1316
|
+
type TileflowModelRoleLighting = Readonly<{
|
|
1317
|
+
emissiveStrength: number;
|
|
1318
|
+
emissiveVariation?: number;
|
|
1319
|
+
emissiveColor?: string;
|
|
1320
|
+
emissiveHeight: TileflowModelEmissionGradient;
|
|
1321
|
+
color?: string;
|
|
1322
|
+
colorMix?: number;
|
|
1323
|
+
metallic?: number;
|
|
1324
|
+
roughness?: number;
|
|
1325
|
+
colorVariation?: Readonly<{
|
|
1326
|
+
hue: readonly [number, number];
|
|
1327
|
+
saturation: readonly [number, number];
|
|
1328
|
+
lightness: readonly [number, number];
|
|
1329
|
+
/** Colour factors may be authored in linear light, as in glTF. Defaults to sRGB. */
|
|
1330
|
+
space?: 'srgb' | 'linear';
|
|
1331
|
+
}>;
|
|
1332
|
+
}>;
|
|
1333
|
+
type TileflowBuildingFloodLight = Readonly<{
|
|
1334
|
+
intensity: number;
|
|
1335
|
+
brightnessScale: number;
|
|
1336
|
+
color: string;
|
|
1337
|
+
groundRadius: readonly [number, number];
|
|
1338
|
+
minGroundHeight: number;
|
|
1339
|
+
minWallHeight: number;
|
|
1340
|
+
wallHeightRatio: number;
|
|
1341
|
+
}>;
|
|
1342
|
+
|
|
1343
|
+
/** The style metadata key under which a compiled map describes its 3D buildings. */
|
|
1344
|
+
declare const tileflowBuildingsMetadataKey = "tileflow:buildings";
|
|
1345
|
+
/** A compiled map's 3D buildings, resolved for one theme. */
|
|
1346
|
+
type TileflowBuildings3DDesign = Readonly<{
|
|
1347
|
+
/** The vector source and its layers with the buildings and the places they hold. */
|
|
1348
|
+
source: string;
|
|
1349
|
+
layers: Readonly<{
|
|
1350
|
+
building: string;
|
|
1351
|
+
places?: string;
|
|
1352
|
+
}>;
|
|
1353
|
+
/**
|
|
1354
|
+
* Each building's colour: a CSS colour, or a MapLibre expression over the building's
|
|
1355
|
+
* properties that gives one, as the map colours its 3D buildings (or its roofs).
|
|
1356
|
+
*/
|
|
1357
|
+
color: string | readonly unknown[];
|
|
1358
|
+
/** How strongly roof outlines and outer corners catch the light, from 0 to 1. */
|
|
1359
|
+
edges: number;
|
|
1360
|
+
/** Exterior corner radius and roof lighting transition, in metres; 0 keeps sharp edges. */
|
|
1361
|
+
edgeRadius?: number;
|
|
1362
|
+
/** Scene sun lighting by default; `style` uses the native extrusion light. */
|
|
1363
|
+
lighting: 'style' | 'sun';
|
|
1364
|
+
/** Per-building brightness variation, from 0 to 1; 0 preserves the authored colour. */
|
|
1365
|
+
colorVariation: number;
|
|
1366
|
+
/** The authored extrusion's vertical wall gradient. */
|
|
1367
|
+
verticalGradient: boolean;
|
|
1368
|
+
/** Their own colour, drawn unlit; without it they take the building's colour, lightened. */
|
|
1369
|
+
edgeColor?: string;
|
|
1370
|
+
/** How bright the buildings light the street at night, from 0 to 2. */
|
|
1371
|
+
nightLight: number;
|
|
1372
|
+
/** Height-selected light on ordinary buildings and the ground, independent of shop windows. */
|
|
1373
|
+
floodLight?: TileflowBuildingFloodLight;
|
|
1374
|
+
/** Emission by architectural role, independent of model palette slots. */
|
|
1375
|
+
modelLighting?: Readonly<Partial<Record<TileflowModelLightingRole, TileflowModelRoleLighting>>>;
|
|
1376
|
+
/** Invented night windows, lit by rooms: decoration, not data. */
|
|
1377
|
+
windows: boolean;
|
|
1378
|
+
/** Optional decoration on ordinary walls and roofs, independent of model materials. */
|
|
1379
|
+
surfaces?: TileflowBuildingSurfaceDesign;
|
|
1380
|
+
/**
|
|
1381
|
+
* The zoom bands, `[from, to]`, the buildings and the placed models and landmarks come in over:
|
|
1382
|
+
* across its band each fades in and rises from the ground. The renderer's defaults stand for a
|
|
1383
|
+
* band left out.
|
|
1384
|
+
*/
|
|
1385
|
+
entrance?: Readonly<{
|
|
1386
|
+
buildings?: readonly [number, number];
|
|
1387
|
+
models?: readonly [number, number];
|
|
1388
|
+
}>;
|
|
1389
|
+
/** Shadows from the sun, and contact shadow at the foot of the walls. */
|
|
1390
|
+
shadows: boolean;
|
|
1391
|
+
occlusion: boolean;
|
|
1392
|
+
/** Strength of prepared model ambient visibility; zero leaves the sky contribution unchanged. */
|
|
1393
|
+
modelOcclusion?: number;
|
|
1394
|
+
/** Building models the map places in its city, each replacing the buildings under it. */
|
|
1395
|
+
models?: readonly TileflowBuildingModelPlacement[];
|
|
1396
|
+
/** The colours of the models' parts; a part without one takes it from the building colour. */
|
|
1397
|
+
modelColors?: Readonly<Partial<Record<TileflowModelPart, string>>>;
|
|
1398
|
+
/**
|
|
1399
|
+
* Tileflow's landmarks, drawn as models in place of the buildings under them: the TileJSON of
|
|
1400
|
+
* their tileset. Without it, the map shows none.
|
|
1401
|
+
*/
|
|
1402
|
+
landmarks?: Readonly<{
|
|
1403
|
+
url: string;
|
|
1404
|
+
}>;
|
|
1405
|
+
}>;
|
|
1406
|
+
/** A building model standing in the map's city. */
|
|
1407
|
+
type TileflowBuildingModelPlacement = Readonly<{
|
|
1408
|
+
/** The model's id, its file's name in the map's `models` directories. */
|
|
1409
|
+
model: string;
|
|
1410
|
+
/** Where the prepared model file is served, absolute or relative to the page. */
|
|
1411
|
+
url: string;
|
|
1412
|
+
/** Longitude and latitude of the model's origin, where it stands on the ground. */
|
|
1413
|
+
at: readonly [number, number];
|
|
1414
|
+
/** Degrees clockwise from north that the model's own north is turned to. */
|
|
1415
|
+
heading: number;
|
|
1416
|
+
}>;
|
|
1417
|
+
/**
|
|
1418
|
+
* Reads the 3D buildings a compiled style describes, or undefined when its metadata has none or a
|
|
1419
|
+
* version or shape this Core does not know.
|
|
1420
|
+
*/
|
|
1421
|
+
declare function readTileflowBuildings3D(metadata: unknown): TileflowBuildings3DDesign | undefined;
|
|
1422
|
+
/** The most models one map places. */
|
|
1423
|
+
declare const tileflowBuildingModelPlacementLimit = 256;
|
|
1424
|
+
/**
|
|
1425
|
+
* The address a hosted build gives a placement of one of the map's own models: a placeholder that
|
|
1426
|
+
* Tileflow replaces, when the map is deployed, with that model's address in the map's Team.
|
|
1427
|
+
*/
|
|
1428
|
+
declare function tileflowTeamModelUrl(model: string): string;
|
|
1429
|
+
/** The Team model a placement's address is the placeholder of, if it is one. */
|
|
1430
|
+
declare function readTileflowTeamModelName(url: string): string | undefined;
|
|
1431
|
+
|
|
1432
|
+
/** Bytes per lamp; see `placeTileflowStreetLights` for the layout. */
|
|
1433
|
+
declare const tileflowStreetLightBytes = 12;
|
|
1434
|
+
/**
|
|
1435
|
+
* Where light is estimated where the data maps no lamps: `lit` (the default) along the streets and
|
|
1436
|
+
* pavements the data maps as lit; `streets` also along the streets the data says nothing about,
|
|
1437
|
+
* wherever it maps few lamps, which invents light as night windows do; `none` nowhere, so only
|
|
1438
|
+
* mapped lamps shine.
|
|
1439
|
+
*/
|
|
1440
|
+
type TileflowStreetLightEstimate = 'streets' | 'lit' | 'none';
|
|
1441
|
+
type TileflowStreetLightPlacementOptions = Readonly<{
|
|
1442
|
+
/** The tile's width in metres. */
|
|
1443
|
+
tileMetres: number;
|
|
1444
|
+
/** Defaults to `lit`. */
|
|
1445
|
+
estimate?: TileflowStreetLightEstimate;
|
|
1446
|
+
}>;
|
|
1447
|
+
/** A tile's layers the lamps come from, as World names them. */
|
|
1448
|
+
type TileflowStreetLightLayers = Readonly<{
|
|
1449
|
+
/** Points with `subclass` `street_lamp` (World's `street_furniture`). */
|
|
1450
|
+
streetFurniture?: TileflowTileLayer;
|
|
1451
|
+
/** Streets by `class`, with `lit` where mapped (World's `transportation`). */
|
|
1452
|
+
transportation?: TileflowTileLayer;
|
|
1453
|
+
/** Pavements, as lines or areas, with `lit` where mapped (World's `sidewalk`). */
|
|
1454
|
+
sidewalks?: TileflowTileLayer;
|
|
1455
|
+
}>;
|
|
1456
|
+
/** One tile's lamps, ready to upload. */
|
|
1457
|
+
type TileflowStreetLightPlacement = Readonly<{
|
|
1458
|
+
lamps: Uint8Array;
|
|
1459
|
+
/** Lamps from the data. */
|
|
1460
|
+
mapped: number;
|
|
1461
|
+
/** Points of soft light estimated along streets. */
|
|
1462
|
+
estimated: number;
|
|
1463
|
+
}>;
|
|
1464
|
+
/**
|
|
1465
|
+
* Places one tile's lamps and estimated light, or returns undefined when it has none. Each is a
|
|
1466
|
+
* point of light, flagged as mapped or estimated. Layout: 0 position in the
|
|
1467
|
+
* tile, 0 to 8192 (uint16 ×2); 4 height in decimetres (uint16); 6 the reach of its light on the
|
|
1468
|
+
* ground in metres (uint8); 7 flags (uint8: bit 0 mapped, bit 1 its own colour); 8 its colour
|
|
1469
|
+
* (uint8 ×3, sRGB); 11 a seed (uint8, normalised).
|
|
1470
|
+
*/
|
|
1471
|
+
declare function placeTileflowStreetLights(layers: TileflowStreetLightLayers, options: TileflowStreetLightPlacementOptions): TileflowStreetLightPlacement | undefined;
|
|
1472
|
+
/** The style metadata key under which a compiled map describes its street lights. */
|
|
1473
|
+
declare const tileflowStreetLightsMetadataKey = "tileflow:street-lights";
|
|
1474
|
+
/** A compiled map's street lights, as the roads module describes them, resolved for one theme. */
|
|
1475
|
+
type TileflowStreetLightsDesign = Readonly<{
|
|
1476
|
+
/** The vector source and its layers with the lamps, the streets and the pavements. */
|
|
1477
|
+
source: string;
|
|
1478
|
+
layers: Readonly<{
|
|
1479
|
+
streetFurniture: string;
|
|
1480
|
+
transportation: string;
|
|
1481
|
+
sidewalk?: string;
|
|
1482
|
+
}>;
|
|
1483
|
+
estimate: TileflowStreetLightEstimate;
|
|
1484
|
+
/** The light of lamps whose data gives no colour, as a CSS colour. */
|
|
1485
|
+
color: string;
|
|
1486
|
+
/** How bright the lights shine, from 0 to 2. */
|
|
1487
|
+
intensity: number;
|
|
1488
|
+
}>;
|
|
1489
|
+
/**
|
|
1490
|
+
* Reads the street lights a compiled style describes, or undefined when its metadata has none or a
|
|
1491
|
+
* version or shape this Core does not know.
|
|
1492
|
+
*/
|
|
1493
|
+
declare function readTileflowStreetLights(metadata: unknown): TileflowStreetLightsDesign | undefined;
|
|
1494
|
+
|
|
1495
|
+
/** The capabilities `tileflowGroundBeforeId` reads; importing this module never loads a renderer. */
|
|
1496
|
+
type TileflowGroundOrderMap = {
|
|
1497
|
+
getLayer(id: string): unknown;
|
|
1498
|
+
getLayersOrder(): string[];
|
|
1499
|
+
getStyle(): unknown;
|
|
1500
|
+
};
|
|
1501
|
+
/** Structural MapLibre capabilities of a map that holds a ground layer group. */
|
|
1502
|
+
type TileflowGroundLayersMap = TileflowGroundOrderMap & {
|
|
1503
|
+
addLayer(layer: unknown, beforeId?: string): unknown;
|
|
1504
|
+
getSource(id: string): unknown;
|
|
1505
|
+
moveLayer(id: string, beforeId?: string): unknown;
|
|
1506
|
+
removeLayer(id: string): unknown;
|
|
1507
|
+
setPaintProperty(layer: string, name: string, value: unknown): unknown;
|
|
1508
|
+
setLayoutProperty(layer: string, name: string, value: unknown): unknown;
|
|
1509
|
+
getCanvas?(): unknown;
|
|
1510
|
+
on(event: 'styledata', listener: () => void): unknown;
|
|
1511
|
+
off(event: 'styledata', listener: () => void): unknown;
|
|
1512
|
+
};
|
|
1513
|
+
/**
|
|
1514
|
+
* A layer of the group: a MapLibre style layer drawn in 2D, such as a line or a fill, or a custom
|
|
1515
|
+
* layer whose `renderingMode` is `2d`.
|
|
1516
|
+
*/
|
|
1517
|
+
type TileflowGroundLayer = Readonly<Record<string, unknown> & {
|
|
1518
|
+
id: string;
|
|
1519
|
+
type: string;
|
|
1520
|
+
}> | Readonly<{
|
|
1521
|
+
id: string;
|
|
1522
|
+
type: 'custom';
|
|
1523
|
+
renderingMode?: '2d' | '3d';
|
|
1524
|
+
}>;
|
|
1525
|
+
type TileflowGroundLayersOptions = Readonly<{
|
|
1526
|
+
/** The layers, bottom to top, such as a route's glow, casing, line and core. */
|
|
1527
|
+
layers: readonly TileflowGroundLayer[];
|
|
1528
|
+
/**
|
|
1529
|
+
* How much of each line layer shows where 3D content hides it, by layer id: from 0 (nothing, the
|
|
1530
|
+
* default) to 1 (as much as where it shows). Only line layers whose `line-opacity` is a number
|
|
1531
|
+
* can show through.
|
|
1532
|
+
*/
|
|
1533
|
+
occludedOpacity?: Readonly<Record<string, number>>;
|
|
1534
|
+
}>;
|
|
1535
|
+
type TileflowGroundLayers = {
|
|
1536
|
+
/** The group's layer ids, bottom to top. */
|
|
1537
|
+
readonly ids: readonly string[];
|
|
1538
|
+
/** The map's layer, so helpers that paint layers, such as line progress, can paint the group. */
|
|
1539
|
+
getLayer(id: string): unknown;
|
|
1540
|
+
/**
|
|
1541
|
+
* Sets a paint property of one of the group's layers, and keeps it for when a style change brings
|
|
1542
|
+
* the layer back. A layer that shows through 3D content passes it to its see-through copy too, at
|
|
1543
|
+
* its `line-opacity` times its occluded opacity. Other layers' properties pass straight to the map.
|
|
1544
|
+
*/
|
|
1545
|
+
setPaintProperty(layer: string, name: string, value: unknown): void;
|
|
1546
|
+
/** Sets a layout property, such as `visibility`, the same way. */
|
|
1547
|
+
setLayoutProperty(layer: string, name: string, value: unknown): void;
|
|
1548
|
+
getCanvas(): unknown;
|
|
1549
|
+
on(event: 'styledata', listener: () => void): void;
|
|
1550
|
+
off(event: 'styledata', listener: () => void): void;
|
|
1551
|
+
/** Takes the group's layers and their copies off the map and stops following style changes. */
|
|
1552
|
+
dispose(): void;
|
|
1553
|
+
};
|
|
1554
|
+
/**
|
|
1555
|
+
* The layer a layer lying on the ground goes before: the first 3D layer above the roads, or the
|
|
1556
|
+
* start of the vegetation when the buildings are flat, so the layer covers the roads and the flat
|
|
1557
|
+
* buildings, and every 3D layer hides it where it stands in front. A style without Tileflow's
|
|
1558
|
+
* overlay placements uses its first 3D layer or its first symbol layer. Undefined means the top.
|
|
1559
|
+
*/
|
|
1560
|
+
declare function tileflowGroundBeforeId(map: TileflowGroundOrderMap): string | undefined;
|
|
1561
|
+
/**
|
|
1562
|
+
* Keeps a group of application layers on the ground, under the map's 3D content, from bottom to
|
|
1563
|
+
* top as given. Layers already on the map are moved into place; a layer whose source is not on the
|
|
1564
|
+
* map yet is added when it is. The group follows the map: after a style change it brings back the
|
|
1565
|
+
* layers the change dropped, and it moves its layers again when a 3D layer lands above them, so
|
|
1566
|
+
* a layer added later in 3D hides them too. A line with an occluded opacity gets a see-through
|
|
1567
|
+
* copy over the 3D content, painted through the group.
|
|
1568
|
+
*/
|
|
1569
|
+
declare function createTileflowGroundLayers(map: TileflowGroundLayersMap, options: TileflowGroundLayersOptions): TileflowGroundLayers;
|
|
1570
|
+
|
|
1571
|
+
/** Structural MapLibre capabilities; importing this module never loads a renderer. */
|
|
1572
|
+
type TileflowDepthMarkerMap = {
|
|
1573
|
+
addLayer(layer: unknown, beforeId?: string): unknown;
|
|
1574
|
+
getLayer(id: string): unknown;
|
|
1575
|
+
removeLayer(id: string): unknown;
|
|
1576
|
+
getCanvas(): HTMLCanvasElement;
|
|
1577
|
+
getPixelRatio?(): number;
|
|
1578
|
+
triggerRepaint(): void;
|
|
1579
|
+
on(event: 'styledata', listener: () => void): unknown;
|
|
1580
|
+
off(event: 'styledata', listener: () => void): unknown;
|
|
1581
|
+
};
|
|
1582
|
+
type TileflowDepthMarker = Readonly<{
|
|
1583
|
+
/** `[longitude, latitude]`. */
|
|
1584
|
+
lngLat: readonly [number, number];
|
|
1585
|
+
/** The marker's picture. Pass it again to `update` after drawing into it. */
|
|
1586
|
+
image: TexImageSource;
|
|
1587
|
+
/** Width and height: CSS pixels for a screen marker, metres for a ground marker. */
|
|
1588
|
+
size: readonly [number, number];
|
|
1589
|
+
/**
|
|
1590
|
+
* `screen` (the default) faces the viewer at a fixed size in pixels, as a pin does; `ground`
|
|
1591
|
+
* lies flat on the ground at a size in metres, as a ring or an arrow on the street does.
|
|
1592
|
+
*/
|
|
1593
|
+
alignment?: 'screen' | 'ground';
|
|
1594
|
+
/** The point of the image that sits on the position: `center` (the default) or `bottom`. */
|
|
1595
|
+
anchor?: 'center' | 'bottom';
|
|
1596
|
+
/** A screen marker's shift in CSS pixels, right and down. */
|
|
1597
|
+
offset?: readonly [number, number];
|
|
1598
|
+
/** Degrees clockwise: from the screen's up for a screen marker, from north for a ground one. */
|
|
1599
|
+
rotation?: number;
|
|
1600
|
+
/** Metres above the ground; defaults to 0. */
|
|
1601
|
+
altitude?: number;
|
|
1602
|
+
/** From 0 to 1 (the default). */
|
|
1603
|
+
opacity?: number;
|
|
1604
|
+
/** Whether nearer 3D content hides the marker; defaults to true. */
|
|
1605
|
+
occlude?: boolean;
|
|
1606
|
+
}>;
|
|
1607
|
+
type TileflowDepthMarkerHandle = {
|
|
1608
|
+
/** Changes the marker; an `image` passed again is uploaded again. */
|
|
1609
|
+
update(change: Partial<TileflowDepthMarker>): void;
|
|
1610
|
+
remove(): void;
|
|
1611
|
+
};
|
|
1612
|
+
type TileflowDepthMarkersOptions = Readonly<{
|
|
1613
|
+
/** The custom layer's id; defaults to `tileflow-depth-markers`. */
|
|
1614
|
+
id?: string;
|
|
1615
|
+
/** The layer the markers are drawn under, or a function that finds it after a style change. */
|
|
1616
|
+
beforeId?: string | (() => string | undefined);
|
|
1617
|
+
}>;
|
|
1618
|
+
type TileflowDepthMarkers = {
|
|
1619
|
+
add(marker: TileflowDepthMarker): TileflowDepthMarkerHandle;
|
|
1620
|
+
/** Removes the markers' layer and releases its GPU resources. */
|
|
1621
|
+
dispose(): void;
|
|
1622
|
+
};
|
|
1623
|
+
/** Where a marker sits: its tile and its position there in tile units, and metres in tile units. */
|
|
1624
|
+
declare function tileflowDepthMarkerPlacement(lngLat: readonly [number, number]): {
|
|
1625
|
+
tile: {
|
|
1626
|
+
x: number;
|
|
1627
|
+
y: number;
|
|
1628
|
+
z: number;
|
|
1629
|
+
};
|
|
1630
|
+
position: [number, number];
|
|
1631
|
+
unitsPerMetre: number;
|
|
1632
|
+
};
|
|
1633
|
+
/**
|
|
1634
|
+
* Draws markers in the map's 3D scene, hidden by nearer 3D buildings. Needs a MapLibre GL JS map
|
|
1635
|
+
* on WebGL 2 (GL JS 5 or later). The layer puts itself back after a style change.
|
|
1636
|
+
*/
|
|
1637
|
+
declare function createTileflowDepthMarkers(map: TileflowDepthMarkerMap, options?: TileflowDepthMarkersOptions): TileflowDepthMarkers;
|
|
1638
|
+
|
|
1639
|
+
/** A camera between keyframes: always the center form, with bearing and pitch resolved. */
|
|
1640
|
+
type TileflowShotCamera = {
|
|
1641
|
+
type: 'center';
|
|
1642
|
+
center: [number, number];
|
|
1643
|
+
zoom: number;
|
|
1644
|
+
bearing: number;
|
|
1645
|
+
pitch: number;
|
|
1646
|
+
};
|
|
1647
|
+
type TileflowShotKeyframe = Readonly<{
|
|
1648
|
+
/** Milliseconds from the start: the first keyframe is at 0, later ones rise strictly. */
|
|
1649
|
+
at: number;
|
|
1650
|
+
camera: Readonly<{
|
|
1651
|
+
/** Shots committed on a map name the center camera form; the motion needs no other. */
|
|
1652
|
+
type?: 'center';
|
|
1653
|
+
center: readonly [number, number];
|
|
1654
|
+
zoom: number;
|
|
1655
|
+
bearing?: number;
|
|
1656
|
+
pitch?: number;
|
|
1657
|
+
}>;
|
|
1658
|
+
blend?: Readonly<{
|
|
1659
|
+
themes: readonly string[];
|
|
1660
|
+
position: number;
|
|
1661
|
+
}>;
|
|
1662
|
+
}>;
|
|
1663
|
+
type TileflowShotMotion = Readonly<{
|
|
1664
|
+
keyframes: readonly TileflowShotKeyframe[];
|
|
1665
|
+
/** `smooth` (the default) eases each segment in and out; `linear` does not. */
|
|
1666
|
+
easing?: 'linear' | 'smooth';
|
|
1667
|
+
}>;
|
|
1668
|
+
/** The camera and blend position of a shot at a time. */
|
|
1669
|
+
type TileflowShotState = {
|
|
1670
|
+
at: number;
|
|
1671
|
+
camera: TileflowShotCamera;
|
|
1672
|
+
/** Present when the shot blends themes. */
|
|
1673
|
+
blendPosition?: number;
|
|
1674
|
+
};
|
|
1675
|
+
/**
|
|
1676
|
+
* Where a shot is at `at` milliseconds, clamped to its first and last keyframes. Within each
|
|
1677
|
+
* keyframe segment the center moves in Web Mercator coordinates along the shorter way around the
|
|
1678
|
+
* world, zoom and pitch change linearly, bearing turns along the shorter arc, and the blend position
|
|
1679
|
+
* changes linearly; `easing: 'smooth'` eases each segment in and out. A time on a keyframe shows
|
|
1680
|
+
* that keyframe exactly.
|
|
1681
|
+
*/
|
|
1682
|
+
declare function tileflowShotStateAt(shot: TileflowShotMotion, at: number): TileflowShotState;
|
|
1683
|
+
|
|
1684
|
+
/** Structural MapLibre capabilities; importing this module never loads a renderer. */
|
|
1685
|
+
type TileflowShotPlayerMap = {
|
|
1686
|
+
getCanvas?: unknown;
|
|
1687
|
+
jumpTo(camera: {
|
|
1688
|
+
center: [number, number];
|
|
1689
|
+
zoom: number;
|
|
1690
|
+
bearing: number;
|
|
1691
|
+
pitch: number;
|
|
1692
|
+
}): unknown;
|
|
1693
|
+
};
|
|
1694
|
+
/** Something to do once the shot reaches a time, such as drawing a route or showing a title. */
|
|
1695
|
+
type TileflowShotCue = Readonly<{
|
|
1696
|
+
at: number;
|
|
1697
|
+
run: () => void;
|
|
1698
|
+
}>;
|
|
1699
|
+
type TileflowShotPlaybackOptions = Readonly<{
|
|
1700
|
+
/**
|
|
1701
|
+
* Receives the blend position at each frame of a shot that blends themes, to pass on to the
|
|
1702
|
+
* theme controller: `(position) => controller.setBlend({themes, position})`.
|
|
1703
|
+
*/
|
|
1704
|
+
blend?: (position: number) => void;
|
|
1705
|
+
/** Run once each, in time order, as the shot reaches them. */
|
|
1706
|
+
cues?: readonly TileflowShotCue[];
|
|
1707
|
+
/** Receives the camera after each frame's move. */
|
|
1708
|
+
onFrame?: (state: {
|
|
1709
|
+
at: number;
|
|
1710
|
+
camera: TileflowShotCamera;
|
|
1711
|
+
blendPosition?: number;
|
|
1712
|
+
}) => void;
|
|
1713
|
+
/** Stops the shot where it is. */
|
|
1714
|
+
signal?: AbortSignal;
|
|
1715
|
+
}>;
|
|
1716
|
+
type TileflowShotPlayback = {
|
|
1717
|
+
/** True when the shot played to its last keyframe; false when it was stopped first. */
|
|
1718
|
+
readonly finished: Promise<boolean>;
|
|
1719
|
+
/** Milliseconds the shot has played. */
|
|
1720
|
+
readonly at: number;
|
|
1721
|
+
/** Stops the shot where it is. */
|
|
1722
|
+
stop(): void;
|
|
1723
|
+
};
|
|
1724
|
+
/**
|
|
1725
|
+
* Plays a timed shot live on a map: the camera follows the shot's keyframes frame by frame, the
|
|
1726
|
+
* blend position goes to `blend`, and cues run as the shot reaches them. It moves as Capture renders
|
|
1727
|
+
* the same shot to video, so the page and the film agree. With reduced motion requested, or without
|
|
1728
|
+
* a browser window, it shows the last keyframe at once and runs every cue in order.
|
|
1729
|
+
*/
|
|
1730
|
+
declare function playTileflowShot(map: TileflowShotPlayerMap, shot: TileflowShotMotion, options?: TileflowShotPlaybackOptions): TileflowShotPlayback;
|
|
1731
|
+
|
|
1732
|
+
type TileflowNoticeControlPosition = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
|
|
1733
|
+
/** A MapLibre control; its methods receive the map that owns it. */
|
|
1734
|
+
type TileflowNoticeControl = {
|
|
1735
|
+
onAdd(map: unknown): HTMLElement;
|
|
1736
|
+
onRemove(map: unknown): void;
|
|
1737
|
+
};
|
|
1738
|
+
type TileflowNoticeEvent = 'remove' | 'style.load' | 'styledata';
|
|
1739
|
+
/** Structural MapLibre capabilities; importing this module never loads a renderer. */
|
|
1740
|
+
type TileflowNoticesMap = {
|
|
1741
|
+
addControl(control: TileflowNoticeControl, position?: TileflowNoticeControlPosition): unknown;
|
|
1742
|
+
getContainer(): HTMLElement;
|
|
1743
|
+
getStyle(): {
|
|
1744
|
+
metadata?: unknown;
|
|
1745
|
+
} | undefined;
|
|
1746
|
+
off(event: TileflowNoticeEvent, listener: () => void): unknown;
|
|
1747
|
+
on(event: TileflowNoticeEvent, listener: () => void): unknown;
|
|
1748
|
+
removeControl(control: TileflowNoticeControl): unknown;
|
|
1749
|
+
};
|
|
1750
|
+
type TileflowNoticesOptions = {
|
|
1751
|
+
/** Map corner for the notice. Defaults to the attribution corner, `bottom-right`. */
|
|
1752
|
+
position?: TileflowNoticeControlPosition;
|
|
1753
|
+
};
|
|
1754
|
+
/**
|
|
1755
|
+
* Render the notices a compiled style declares, such as "Not for navigation" for Nautical, as a
|
|
1756
|
+
* compact always-visible map control. Call after constructing a browser map. Follows style
|
|
1757
|
+
* replacements and removes its control, listeners, and pending read on disposal or map removal.
|
|
1758
|
+
*/
|
|
1759
|
+
declare function attachTileflowNotices(map: TileflowNoticesMap, options?: TileflowNoticesOptions): () => void;
|
|
1760
|
+
|
|
1761
|
+
/** Style metadata key for notices that must stay visible whenever the map is displayed. */
|
|
1762
|
+
declare const tileflowNoticesMetadataKey: "tileflow:notices";
|
|
1763
|
+
/**
|
|
1764
|
+
* A short plain-text notice the compiled style declares for the sources it names. Runtimes render
|
|
1765
|
+
* it on the map, next to the attribution; it never replaces a source's own attribution.
|
|
1766
|
+
*/
|
|
1767
|
+
type TileflowMapNotice = Readonly<{
|
|
1768
|
+
id: string;
|
|
1769
|
+
sources: readonly string[];
|
|
1770
|
+
text: string;
|
|
1771
|
+
}>;
|
|
1772
|
+
declare const tileflowNoticeLimits: Readonly<{
|
|
1773
|
+
maxNotices: 8;
|
|
1774
|
+
maxSources: 16;
|
|
1775
|
+
maxTextLength: 120;
|
|
1776
|
+
}>;
|
|
1777
|
+
/** Read bounded notices from style metadata; malformed entries are ignored, never rendered. */
|
|
1778
|
+
declare function readTileflowNotices(metadata: unknown): readonly TileflowMapNotice[];
|
|
1779
|
+
|
|
1780
|
+
type FeatureId = number | string;
|
|
1781
|
+
type FeatureTarget = {
|
|
1782
|
+
id: FeatureId;
|
|
1783
|
+
source: string;
|
|
1784
|
+
sourceLayer: string;
|
|
1785
|
+
};
|
|
1786
|
+
type TileflowNauticalLightsEvent = 'idle' | 'moveend' | 'remove' | 'sourcedata' | 'style.load' | 'styledata';
|
|
1787
|
+
/** Structural MapLibre capabilities; importing this module never loads a renderer. */
|
|
1788
|
+
type TileflowNauticalLightsMap = {
|
|
1789
|
+
getContainer(): HTMLElement;
|
|
1790
|
+
getLayer(id: string): {
|
|
1791
|
+
maxzoom?: number;
|
|
1792
|
+
minzoom?: number;
|
|
1793
|
+
} | undefined;
|
|
1794
|
+
getLayoutProperty(id: string, name: 'visibility'): unknown;
|
|
1795
|
+
getSource(id: string): unknown;
|
|
1796
|
+
getStyle(): {
|
|
1797
|
+
metadata?: unknown;
|
|
1798
|
+
} | undefined;
|
|
1799
|
+
getZoom(): number;
|
|
1800
|
+
off(event: TileflowNauticalLightsEvent, listener: (event?: {
|
|
1801
|
+
sourceId?: unknown;
|
|
1802
|
+
}) => void): unknown;
|
|
1803
|
+
on(event: TileflowNauticalLightsEvent, listener: (event?: {
|
|
1804
|
+
sourceId?: unknown;
|
|
1805
|
+
}) => void): unknown;
|
|
1806
|
+
queryRenderedFeatures(options: {
|
|
1807
|
+
layers: string[];
|
|
1808
|
+
}): readonly {
|
|
1809
|
+
id?: unknown;
|
|
1810
|
+
properties?: Record<string, unknown> | null;
|
|
1811
|
+
}[];
|
|
1812
|
+
removeFeatureState(target: FeatureTarget, key?: string): unknown;
|
|
1813
|
+
setFeatureState(target: FeatureTarget, state: Record<string, number>): unknown;
|
|
1814
|
+
};
|
|
1815
|
+
/**
|
|
1816
|
+
* Flash the Nautical lights of a compiled style in their rhythms. The style's
|
|
1817
|
+
* `tileflow:nautical-lights` metadata names the light layers; for each light drawn in them, the
|
|
1818
|
+
* helper derives its rhythm (`tileflowLightRhythm`) and writes the light's intensity and colour as
|
|
1819
|
+
* MapLibre feature state whenever its phase changes. Lights that are in the same phase change
|
|
1820
|
+
* together, and the helper wakes only for the next change.
|
|
1821
|
+
*
|
|
1822
|
+
* Nothing is written, and no timer runs, while the page is hidden, while no light layer is
|
|
1823
|
+
* visible at the current zoom, or when no drawn light has a rhythm. When the person viewing the
|
|
1824
|
+
* map prefers reduced motion, or on disposal or map `remove`, every light returns to steady.
|
|
1825
|
+
* Lights are identified by the feature ID their source promotes; the compiled Nautical source
|
|
1826
|
+
* promotes each light's unique `provenance`. A light without an ID stays steady.
|
|
1827
|
+
*/
|
|
1828
|
+
declare function attachTileflowNauticalLights(map: TileflowNauticalLightsMap): () => void;
|
|
1829
|
+
|
|
1830
|
+
/** Style metadata key that names the layers whose Nautical lights flash in their rhythm. */
|
|
1831
|
+
declare const tileflowNauticalLightsMetadataKey: "tileflow:nautical-lights";
|
|
1832
|
+
/**
|
|
1833
|
+
* MapLibre feature-state keys the light layers read. A runtime writes them per light feature; a
|
|
1834
|
+
* light without them shows steadily, exactly as a map that is not animated.
|
|
1835
|
+
*/
|
|
1836
|
+
declare const tileflowNauticalLightStates: Readonly<{
|
|
1837
|
+
/** Index of the colour shown, into the light's comma-separated `color` list. */
|
|
1838
|
+
colour: "tileflowLightColour";
|
|
1839
|
+
/** `1` while the light shines, `0` while it is eclipsed, in between for a fixed part. */
|
|
1840
|
+
intensity: "tileflowLightIntensity";
|
|
1841
|
+
}>;
|
|
1842
|
+
/** The light layers of a compiled style and the source features they draw. */
|
|
1843
|
+
type TileflowNauticalLights = Readonly<{
|
|
1844
|
+
layers: readonly string[];
|
|
1845
|
+
source: string;
|
|
1846
|
+
sourceLayer: string;
|
|
1847
|
+
version: 1;
|
|
1848
|
+
}>;
|
|
1849
|
+
/** Read the bounded light declaration of style metadata; a malformed one is ignored. */
|
|
1850
|
+
declare function readTileflowNauticalLights(metadata: unknown): TileflowNauticalLights | undefined;
|
|
1851
|
+
|
|
1852
|
+
/** One phase of a light's cycle. */
|
|
1853
|
+
type TileflowLightPhase = Readonly<{
|
|
1854
|
+
/** Index of the colour shown, into the light's comma-separated `color` list. */
|
|
1855
|
+
colour: number;
|
|
1856
|
+
/** Seconds, with millisecond precision. */
|
|
1857
|
+
duration: number;
|
|
1858
|
+
/**
|
|
1859
|
+
* `1` while the light shines, `0` while it is eclipsed, and
|
|
1860
|
+
* `tileflowLightRhythmConventions.fixedIntensity` for the steady part of a fixed-and-flashing light.
|
|
1861
|
+
*/
|
|
1862
|
+
intensity: number;
|
|
1863
|
+
}>;
|
|
1864
|
+
/** A light's repeating cycle. Lights with the same `key` flash identically. */
|
|
1865
|
+
type TileflowLightRhythm = Readonly<{
|
|
1866
|
+
/** A canonical description of the phases; equal rhythms have equal keys. */
|
|
1867
|
+
key: string;
|
|
1868
|
+
/** Seconds, the sum of the phase durations. */
|
|
1869
|
+
period: number;
|
|
1870
|
+
phases: readonly TileflowLightPhase[];
|
|
1871
|
+
}>;
|
|
1872
|
+
/** What the light shows at a moment, and for how many more seconds. */
|
|
1873
|
+
type TileflowLightState = Readonly<{
|
|
1874
|
+
colour: number;
|
|
1875
|
+
intensity: number;
|
|
1876
|
+
/** Seconds until the next phase begins; always positive. */
|
|
1877
|
+
remaining: number;
|
|
1878
|
+
}>;
|
|
1879
|
+
/** The `nautical-v1` light fields that define a rhythm; other properties are ignored. */
|
|
1880
|
+
type TileflowLightCharacteristic = Readonly<{
|
|
1881
|
+
character?: unknown;
|
|
1882
|
+
color?: unknown;
|
|
1883
|
+
group?: unknown;
|
|
1884
|
+
period_s?: unknown;
|
|
1885
|
+
sequence?: unknown;
|
|
1886
|
+
}>;
|
|
1887
|
+
/**
|
|
1888
|
+
* The conventions used when a light publishes no `sequence`. Durations are in seconds.
|
|
1889
|
+
*
|
|
1890
|
+
* - `Fl`: flashes of `min(flash, flashShare × period / flashes)`. Flashes of one group are
|
|
1891
|
+
* separated by an eclipse of at most twice the flash, groups of a composite group such as
|
|
1892
|
+
* `2+1` by twice that eclipse, and the remainder of the period is the final eclipse.
|
|
1893
|
+
* - `LFl`: the same layout with flashes of `longFlash`, or `flashShare × period / flashes` when
|
|
1894
|
+
* the period is too short for them.
|
|
1895
|
+
* - `Q`, `VQ`, `UQ`: one flash per `quickCycle` (60, 120 and 240 per minute), lit for
|
|
1896
|
+
* `quickDuty` of each cycle. Without a group they flash continuously; with a group of `n` they
|
|
1897
|
+
* flash `n` times, then stay eclipsed until the period ends.
|
|
1898
|
+
* - `IQ`, `IVQ`, `IUQ`: quick flashes for `interruptedShare` of the period, then an eclipse.
|
|
1899
|
+
* - `Iso`: light and eclipse of equal length.
|
|
1900
|
+
* - `Oc`: eclipses of `occultingShare × period / eclipses`, laid out like `Fl` with light and
|
|
1901
|
+
* eclipse exchanged, so the light is always longer than the eclipse.
|
|
1902
|
+
* - `Mo`: the Morse letters of `group`, with dots of `morseUnit` (shortened to fit the
|
|
1903
|
+
* period), dashes of three units, one unit between signals and three between letters; the
|
|
1904
|
+
* remainder of the period, or seven units without one, is the eclipse.
|
|
1905
|
+
* - `FFl`: a fixed light at `fixedIntensity` with full-intensity flashes laid out like `Fl`;
|
|
1906
|
+
* `F+LFl` does the same with long flashes.
|
|
1907
|
+
* - `Q+LFl`, `VQ+LFl`, `UQ+LFl`, `Fl+LFl`: the group of the first part (six quick flashes when
|
|
1908
|
+
* absent), then one long flash, then the eclipse.
|
|
1909
|
+
* - `Oc+Fl`: drawn as its occulting part.
|
|
1910
|
+
* - `Al.<character>`: the rhythm of that character, each lit phase taking the next colour of
|
|
1911
|
+
* `color`; `Al` alone shows each colour for an equal share of the period.
|
|
1912
|
+
* - Grouped `Q`/`VQ` and `Q+LFl`/`VQ+LFl` without a period use the cardinal-mark periods of
|
|
1913
|
+
* `cardinalPeriods`.
|
|
1914
|
+
*
|
|
1915
|
+
* `F`, an absent or unknown character, a missing period where one is needed, or a layout that
|
|
1916
|
+
* does not fit its period leaves the light steady.
|
|
1917
|
+
*/
|
|
1918
|
+
declare const tileflowLightRhythmConventions: Readonly<{
|
|
1919
|
+
cardinalPeriods: Readonly<{
|
|
1920
|
+
Q: Readonly<{
|
|
1921
|
+
3: 10;
|
|
1922
|
+
6: 15;
|
|
1923
|
+
9: 15;
|
|
1924
|
+
}>;
|
|
1925
|
+
'Q+LFl': 15;
|
|
1926
|
+
VQ: Readonly<{
|
|
1927
|
+
3: 5;
|
|
1928
|
+
6: 10;
|
|
1929
|
+
9: 10;
|
|
1930
|
+
}>;
|
|
1931
|
+
'VQ+LFl': 10;
|
|
1932
|
+
}>;
|
|
1933
|
+
fixedIntensity: 0.5;
|
|
1934
|
+
flash: 1;
|
|
1935
|
+
flashShare: 0.3;
|
|
1936
|
+
interruptedShare: 0.6;
|
|
1937
|
+
longFlash: 2;
|
|
1938
|
+
morseUnit: 0.5;
|
|
1939
|
+
occultingShare: 0.25;
|
|
1940
|
+
quickCycle: Readonly<{
|
|
1941
|
+
Q: 1;
|
|
1942
|
+
UQ: 0.25;
|
|
1943
|
+
VQ: 0.5;
|
|
1944
|
+
}>;
|
|
1945
|
+
quickDuty: 0.3;
|
|
1946
|
+
}>;
|
|
1947
|
+
/**
|
|
1948
|
+
* The rhythm of one light, or `undefined` when it shows steadily: a fixed light, or one without a
|
|
1949
|
+
* usable characteristic. `sequence` wins when it is well formed; otherwise the rhythm follows
|
|
1950
|
+
* `tileflowLightRhythmConventions`.
|
|
1951
|
+
*/
|
|
1952
|
+
declare function tileflowLightRhythm(light: TileflowLightCharacteristic): TileflowLightRhythm | undefined;
|
|
1953
|
+
/** What `rhythm` shows `seconds` after the shared epoch of every rhythm. */
|
|
1954
|
+
declare function tileflowLightStateAt(rhythm: TileflowLightRhythm, seconds: number): TileflowLightState;
|
|
1955
|
+
|
|
1956
|
+
declare const tileflowMaplibreContourVersion: "0.1.0";
|
|
1957
|
+
type TileflowContourProtocolRequest = Readonly<{
|
|
1958
|
+
url: string;
|
|
1959
|
+
}>;
|
|
1960
|
+
type TileflowContourProtocolResponse = Readonly<{
|
|
1961
|
+
cacheControl?: string | null;
|
|
1962
|
+
data: ArrayBuffer;
|
|
1963
|
+
expires?: Date | string | null;
|
|
1964
|
+
}>;
|
|
1965
|
+
type TileflowContourProtocolHandler = (request: TileflowContourProtocolRequest, abortController: AbortController) => Promise<TileflowContourProtocolResponse>;
|
|
1966
|
+
type TileflowContourProtocolRegistry = {
|
|
1967
|
+
addProtocol: (name: string, handler: TileflowContourProtocolHandler) => void;
|
|
1968
|
+
};
|
|
1969
|
+
type TileflowContourProtocolRegistrationOptions = {
|
|
1970
|
+
/** Test/integration override; the default lazily initializes the pinned, bundled module. */
|
|
1971
|
+
loadMaplibreContour?: () => Promise<unknown>;
|
|
1972
|
+
};
|
|
1973
|
+
/** Registers the one self-contained protocol emitted by every compiled contour source. */
|
|
1974
|
+
declare function registerTileflowContourProtocol(registry: TileflowContourProtocolRegistry, options?: TileflowContourProtocolRegistrationOptions): void;
|
|
1975
|
+
|
|
1976
|
+
type TileflowPmtilesProtocolHandler = (request: Readonly<{
|
|
1977
|
+
type?: string;
|
|
1978
|
+
url: string;
|
|
1979
|
+
}>, abortController: AbortController) => Promise<Readonly<{
|
|
1980
|
+
cacheControl?: string;
|
|
1981
|
+
data: object | string;
|
|
1982
|
+
expires?: string;
|
|
1983
|
+
}>>;
|
|
1984
|
+
type TileflowPmtilesProtocolRegistry = Readonly<{
|
|
1985
|
+
addProtocol: (name: string, handler: TileflowPmtilesProtocolHandler) => void;
|
|
1986
|
+
}>;
|
|
1987
|
+
type TileflowPmtilesProtocolRegistrationOptions = Readonly<{
|
|
1988
|
+
maximumDirectoryDepth?: number;
|
|
1989
|
+
}>;
|
|
1990
|
+
declare const tileflowPmtilesMaximumDirectoryDepth: 32;
|
|
1991
|
+
declare const tileflowPmtilesProtocol: "tileflow-pmtiles";
|
|
1992
|
+
/** Register only Tileflow's managed PMTiles namespace. Third-party `pmtiles://` remains untouched. */
|
|
1993
|
+
declare function registerTileflowPmtilesProtocol(registry: TileflowPmtilesProtocolRegistry, options?: TileflowPmtilesProtocolRegistrationOptions): void;
|
|
1994
|
+
|
|
1995
|
+
/** The style metadata through which a compiled map declares its 3D scene. */
|
|
1996
|
+
declare const tileflowMap3DMetadataKeys: readonly ["tileflow:buildings", "tileflow:vegetation", "tileflow:vegetation-display", "tileflow:street-lights"];
|
|
1997
|
+
/** Where the 3D scene reads the style: the map, and the theme controller when there is one. */
|
|
1998
|
+
type TileflowMap3DSource = Readonly<{
|
|
1999
|
+
map: {
|
|
2000
|
+
getStyle(): unknown;
|
|
2001
|
+
};
|
|
2002
|
+
controller?: {
|
|
2003
|
+
getThemeMetadata?(key: string): Readonly<{
|
|
2004
|
+
values: readonly unknown[];
|
|
2005
|
+
position: number;
|
|
2006
|
+
}>;
|
|
2007
|
+
};
|
|
2008
|
+
}>;
|
|
2009
|
+
/**
|
|
2010
|
+
* The parts of a 3D scene the style on screen declares, as their metadata keys; during a theme
|
|
2011
|
+
* blend, those any blended theme declares.
|
|
2012
|
+
*/
|
|
2013
|
+
declare function tileflowMap3DDeclarations(source: TileflowMap3DSource): ReadonlySet<string>;
|
|
2014
|
+
/** Whether the style on screen declares any part of a 3D scene: buildings, trees or lights. */
|
|
2015
|
+
declare function tileflowMapDeclares3D(source: TileflowMap3DSource): boolean;
|
|
2016
|
+
/** Loads the 3D renderers: a dynamic import of the `@tileflow/core/3d` entry. */
|
|
2017
|
+
type TileflowMap3DLoader = () => Promise<{
|
|
2018
|
+
createTileflowMap3D(options: TileflowMap3DOptions): TileflowMap3D;
|
|
2019
|
+
}>;
|
|
2020
|
+
type AttachTileflowMap3DOptions = TileflowMap3DOptions & {
|
|
2021
|
+
map: TileflowMap3DOptions['map'] & {
|
|
2022
|
+
getStyle(): unknown;
|
|
2023
|
+
};
|
|
2024
|
+
/** Loads the renderers the first time the map's style declares 3D. */
|
|
2025
|
+
load: TileflowMap3DLoader;
|
|
2026
|
+
/** Receives a failure to load or mount the renderers; the 2D map keeps working. */
|
|
2027
|
+
onError?: (error: unknown) => void;
|
|
2028
|
+
};
|
|
2029
|
+
type TileflowMap3DAttachment = {
|
|
2030
|
+
/** The mounted scene, once a style that declares 3D has loaded the renderers. */
|
|
2031
|
+
readonly scene: TileflowMap3D | undefined;
|
|
2032
|
+
/** `3d` shows the scene; `2d` hides it and draws `auto` vegetation flat. */
|
|
2033
|
+
setViewMode(mode: TileflowViewMode): void;
|
|
2034
|
+
/** Overrides the map's vegetation visibility; undefined restores the authored default. */
|
|
2035
|
+
setVegetation(visible: boolean | undefined): void;
|
|
2036
|
+
dispose(): void;
|
|
2037
|
+
};
|
|
2038
|
+
/**
|
|
2039
|
+
* Mounts the map's 3D scene when, and only when, its style declares one. Until then it loads
|
|
2040
|
+
* nothing, so a 2D map does not pay for the 3D renderers. Requested state applies on mount.
|
|
2041
|
+
*/
|
|
2042
|
+
declare function attachTileflowMap3D(options: AttachTileflowMap3DOptions): TileflowMap3DAttachment;
|
|
2043
|
+
|
|
2044
|
+
type TileflowMapReadinessState = 'error' | 'idle' | 'loading';
|
|
2045
|
+
/** Read the browser preference without persisting or mutating user state. */
|
|
2046
|
+
declare function getTileflowSystemColorScheme(): TileflowRuntimeColorScheme;
|
|
2047
|
+
/**
|
|
2048
|
+
* Subscribe through one process-wide `matchMedia` listener, regardless of adapter or map count.
|
|
2049
|
+
*/
|
|
2050
|
+
declare function subscribeTileflowSystemColorScheme(listener: (scheme: TileflowRuntimeColorScheme) => void): () => void;
|
|
2051
|
+
type TileflowThemeTransitionPhase = 'applying' | 'error' | 'preloading' | 'ready';
|
|
2052
|
+
type TileflowThemeTransition = Readonly<{
|
|
2053
|
+
currentTheme?: string;
|
|
2054
|
+
error?: Error;
|
|
2055
|
+
phase: TileflowThemeTransitionPhase;
|
|
2056
|
+
targetTheme?: string;
|
|
2057
|
+
}>;
|
|
2058
|
+
type TileflowThemeTransitionResult = Readonly<{
|
|
2059
|
+
error?: Error;
|
|
2060
|
+
status: 'applied' | 'failed' | 'superseded';
|
|
2061
|
+
theme?: string;
|
|
2062
|
+
}>;
|
|
2063
|
+
/**
|
|
2064
|
+
* How a theme change appears. Compatible themes interpolate on the live map, including its sky
|
|
2065
|
+
* and 3D lighting. Other styles use a stationary cover that clears when the camera moves.
|
|
2066
|
+
* A browser preference for reduced motion changes at once.
|
|
2067
|
+
*/
|
|
2068
|
+
type TileflowThemeTransitionOptions = Readonly<{
|
|
2069
|
+
/** Milliseconds from 0 (immediate) to 5000. Themes and blends default to 450; other changes to 0. */
|
|
2070
|
+
duration?: number;
|
|
2071
|
+
}>;
|
|
2072
|
+
type TileflowThemeChangeOptions = Readonly<{
|
|
2073
|
+
transition?: TileflowThemeTransitionOptions;
|
|
2074
|
+
}>;
|
|
2075
|
+
/**
|
|
2076
|
+
* A continuous mix of two or more themes of the same map. `position` places the map between
|
|
2077
|
+
* neighbouring themes: 0 is the first, 1 the second, and 1.25 a quarter of the way from the second
|
|
2078
|
+
* to the third. Ground colours, patterns, the sky, and light follow the position; labels and icons
|
|
2079
|
+
* cross-fade when the nearest theme changes.
|
|
2080
|
+
*/
|
|
2081
|
+
type TileflowThemeBlendRequest = Readonly<{
|
|
2082
|
+
position: number;
|
|
2083
|
+
/** Two to eight concrete themes of one map, in blend order. */
|
|
2084
|
+
themes: readonly TileflowRuntimeStyle[];
|
|
2085
|
+
/**
|
|
2086
|
+
* Holds back what would make MapLibre lay tiles out again: the change of nearest theme, with
|
|
2087
|
+
* the labels, icons, and values it switches, and mixed pattern artwork. Colours, numbers, the
|
|
2088
|
+
* sky, and light keep following the position, so a camera move or a recording never waits on
|
|
2089
|
+
* the blend. The next request without `hold` brings what was held back in at once.
|
|
2090
|
+
*/
|
|
2091
|
+
hold?: boolean;
|
|
2092
|
+
}>;
|
|
2093
|
+
/**
|
|
2094
|
+
* A blend of named themes as the React, Vue, and Svelte maps take it: `hold` holds back what
|
|
2095
|
+
* would make MapLibre lay tiles out again, as `TileflowThemeBlendRequest.hold` does, and the next
|
|
2096
|
+
* selection without it brings what waited in at once.
|
|
2097
|
+
*/
|
|
2098
|
+
type TileflowBrowserThemeBlendSelection = TileflowThemeBlendSelection & Readonly<{
|
|
2099
|
+
hold?: boolean;
|
|
2100
|
+
}>;
|
|
2101
|
+
declare function validateTileflowBrowserThemeBlendSelection(value: unknown): value is TileflowBrowserThemeBlendSelection;
|
|
2102
|
+
type TileflowThemeBlendState = Readonly<{
|
|
2103
|
+
/** Whether changes held back by `hold` are waiting for a request without it. */
|
|
2104
|
+
held: boolean;
|
|
2105
|
+
position: number;
|
|
2106
|
+
/**
|
|
2107
|
+
* Positions where the nearest theme changes over values that make MapLibre lay tiles out
|
|
2108
|
+
* again, such as icon names, layout values, and values that read feature data or state. Plan
|
|
2109
|
+
* a camera move or a recording around them, or pass `hold` across them.
|
|
2110
|
+
*/
|
|
2111
|
+
relayoutAt: readonly number[];
|
|
2112
|
+
themes: readonly string[];
|
|
2113
|
+
}>;
|
|
2114
|
+
type TileflowStyleSwitchMap = TileflowThemeMotionMap & TileflowDynamicImageMap & {
|
|
2115
|
+
getCenter?: unknown;
|
|
2116
|
+
getGlobalState?: unknown;
|
|
2117
|
+
off(event: string, listener: (event?: unknown) => void): unknown;
|
|
2118
|
+
on(event: string, listener: (event?: unknown) => void): unknown;
|
|
2119
|
+
setGlobalStateProperty?: unknown;
|
|
2120
|
+
setStyle: unknown;
|
|
2121
|
+
};
|
|
2122
|
+
/** A value an application sets for the whole style, which themes read with `expr.globalState`. */
|
|
2123
|
+
type TileflowStyleStateValue = boolean | number | string | null;
|
|
2124
|
+
/**
|
|
2125
|
+
* Where an application places the sun. `azimuth` (degrees clockwise from north) and `altitude`
|
|
2126
|
+
* (degrees above the horizon) place it directly; `date` places the real sun of that instant over
|
|
2127
|
+
* `location` ([longitude, latitude]), the map's centre when it is left out.
|
|
2128
|
+
*/
|
|
2129
|
+
type TileflowSunRequest = Readonly<{
|
|
2130
|
+
altitude: number;
|
|
2131
|
+
azimuth: number;
|
|
2132
|
+
}> | Readonly<{
|
|
2133
|
+
date: Date | number;
|
|
2134
|
+
location?: readonly [number, number];
|
|
2135
|
+
}>;
|
|
2136
|
+
type TileflowThemeController = {
|
|
2137
|
+
dispose(): void;
|
|
2138
|
+
/** Own a fixed-size RGBA image with a stable name across themes, restored after style reloads. */
|
|
2139
|
+
registerImage(name: string, image: TileflowDynamicImage): TileflowDynamicImageHandle;
|
|
2140
|
+
/** The active blend, or undefined when the map shows one theme. */
|
|
2141
|
+
getBlend(): TileflowThemeBlendState | undefined;
|
|
2142
|
+
/** The theme the map shows; during a blend, the nearest theme. */
|
|
2143
|
+
getCurrent(): TileflowRuntimeStyle;
|
|
2144
|
+
/** The emphasis requested last, or undefined when the map is shown as designed. */
|
|
2145
|
+
getEmphasis(): TileflowEmphasis | undefined;
|
|
2146
|
+
/**
|
|
2147
|
+
* The route inks of the theme on screen, for an application's own route layers. During a blend
|
|
2148
|
+
* they are mixed between the neighbouring themes at the blend's position, as the map's colours
|
|
2149
|
+
* are. Read them again after a theme change or a blend move.
|
|
2150
|
+
*/
|
|
2151
|
+
getRouteInks(): TileflowRouteInks;
|
|
2152
|
+
/** The value a style state was set to last, or undefined when it has not been set. */
|
|
2153
|
+
getState(name: string): TileflowStyleStateValue | undefined;
|
|
2154
|
+
/**
|
|
2155
|
+
* What the compiled styles on screen hold under a metadata key, for an application's own layers
|
|
2156
|
+
* drawn in the map's design (Core's 3D trees read their colours this way): one value outside a
|
|
2157
|
+
* blend, and during a blend one per blended theme, in order, with the blend's position, so a layer
|
|
2158
|
+
* can mix them as the map does. A style without the key gives undefined in its place.
|
|
2159
|
+
*/
|
|
2160
|
+
getThemeMetadata(key: string): Readonly<{
|
|
2161
|
+
values: readonly unknown[];
|
|
2162
|
+
position: number;
|
|
2163
|
+
}>;
|
|
2164
|
+
/**
|
|
2165
|
+
* The sun the map shows, for an application's own 3D layers: its direction, the light it and
|
|
2166
|
+
* the sky give, and how dark its shadows fall. It is the theme's sun (`lighting.sun`), mixed
|
|
2167
|
+
* between neighbouring themes during a blend, unless `setSun` placed it. Read it when drawing;
|
|
2168
|
+
* the map redraws whenever it changes.
|
|
2169
|
+
*/
|
|
2170
|
+
getSun(): TileflowSun;
|
|
2171
|
+
/**
|
|
2172
|
+
* Shows a blend of themes. The first request for a set of themes loads their styles and
|
|
2173
|
+
* prepares one style that holds all of them; later requests for the same themes only move the
|
|
2174
|
+
* position and take effect at once, so they can follow an animation or a slider.
|
|
2175
|
+
*/
|
|
2176
|
+
setBlend(request: TileflowThemeBlendRequest, options?: TileflowThemeChangeOptions): Promise<TileflowThemeTransitionResult>;
|
|
2177
|
+
/**
|
|
2178
|
+
* Makes chosen modules of the map recede and its labels and icons fade, so an application's own
|
|
2179
|
+
* content reads first; `undefined` returns the map to its design. The change eases over the
|
|
2180
|
+
* transition, and the emphasis stays through later theme changes and blend positions. Values
|
|
2181
|
+
* that MapLibre evaluates per feature change at once, under a cross-fade.
|
|
2182
|
+
*/
|
|
2183
|
+
setEmphasis(emphasis: TileflowEmphasis | undefined, options?: TileflowThemeChangeOptions): Promise<TileflowThemeTransitionResult>;
|
|
2184
|
+
/**
|
|
2185
|
+
* Sets a style-wide state that the map's themes read with `expr.globalState(name)`. A number
|
|
2186
|
+
* eases from the value it shows to the new one over the transition, so a colour or size that a
|
|
2187
|
+
* theme interpolates on it moves smoothly; other values, and a number set for the first time,
|
|
2188
|
+
* change at once. A value that also reads feature data or feature state is laid out again by
|
|
2189
|
+
* MapLibre at each change, so it follows late and costs more. States stay through theme changes
|
|
2190
|
+
* and blends. Needs a MapLibre map with global state (GL JS 5.6 or later).
|
|
2191
|
+
*/
|
|
2192
|
+
setState(name: string, value: TileflowStyleStateValue, options?: TileflowThemeChangeOptions): Promise<TileflowThemeTransitionResult>;
|
|
2193
|
+
/**
|
|
2194
|
+
* Places the sun by direction or by the real sun of a date and place; `undefined` returns it to
|
|
2195
|
+
* the themes' suns. The themes keep the sun's colours, strengths, and shadow strength, and the
|
|
2196
|
+
* map's light turns to the new direction, anchored to the map. The sun turns the short way round
|
|
2197
|
+
* over the transition; a request that follows an animation, such as a clock, passes none.
|
|
2198
|
+
*/
|
|
2199
|
+
setSun(request: TileflowSunRequest | undefined, options?: TileflowThemeChangeOptions): Promise<TileflowThemeTransitionResult>;
|
|
2200
|
+
setTheme(style: TileflowRuntimeStyle, options?: TileflowThemeChangeOptions): Promise<TileflowThemeTransitionResult>;
|
|
2201
|
+
};
|
|
2202
|
+
/**
|
|
2203
|
+
* Transactionally changes a MapLibre style while preserving the map instance and camera.
|
|
2204
|
+
* Independent font preloads start immediately; style application is serialized and last request wins.
|
|
2205
|
+
*/
|
|
2206
|
+
declare function createTileflowThemeController(options: {
|
|
2207
|
+
initial: TileflowRuntimeStyle;
|
|
2208
|
+
loadFonts?: (style: TileflowRuntimeStyle) => Promise<void>;
|
|
2209
|
+
/** Loads a theme's style document for a blend; defaults to a same-origin-credentials fetch. */
|
|
2210
|
+
loadStyle?: (url: string) => Promise<MapLibreStyle>;
|
|
2211
|
+
map: TileflowStyleSwitchMap;
|
|
2212
|
+
onTransition?: (transition: TileflowThemeTransition) => void;
|
|
2213
|
+
timeoutMs?: number;
|
|
2214
|
+
/** The default for every change; each change may pass its own. */
|
|
2215
|
+
transition?: TileflowThemeTransitionOptions;
|
|
2216
|
+
}): TileflowThemeController;
|
|
2217
|
+
type TileflowMapLifecycleEvent = 'dataloading' | 'error' | 'idle' | 'load' | 'styledataloading';
|
|
2218
|
+
type TileflowFrameScheduler<TFrame> = {
|
|
2219
|
+
cancelFrame: (frame: TFrame) => void;
|
|
2220
|
+
requestFrame: (callback: () => void) => TFrame;
|
|
2221
|
+
};
|
|
2222
|
+
type TileflowMapLifecycleSubscriber<TMap> = (map: TMap, event: TileflowMapLifecycleEvent, listener: () => void) => () => void;
|
|
2223
|
+
type TileflowSessionSender = (analytics: TileflowAnalytics | undefined, input: {
|
|
2224
|
+
mapId?: string;
|
|
2225
|
+
sessionId: string;
|
|
2226
|
+
source: string;
|
|
2227
|
+
styleId?: string;
|
|
2228
|
+
}) => void;
|
|
2229
|
+
type TileflowSessionStarter = {
|
|
2230
|
+
clear: () => void;
|
|
2231
|
+
start: (analytics: TileflowAnalytics | undefined, styleId?: string) => boolean;
|
|
2232
|
+
};
|
|
2233
|
+
type TileflowMapLifecycleAttachment = {
|
|
2234
|
+
dispose: () => void;
|
|
2235
|
+
invalidate: (state?: TileflowMapReadinessState) => void;
|
|
2236
|
+
};
|
|
2237
|
+
type TileflowStyleFontLoadOptions = {
|
|
2238
|
+
/** Already resolved manifest metadata. An explicit empty array avoids fetching the style. */
|
|
2239
|
+
fontFaces?: readonly TileflowStyleFontFace[];
|
|
2240
|
+
fetch?: typeof globalThis.fetch;
|
|
2241
|
+
};
|
|
2242
|
+
/** Loads content-addressed style font faces before MapLibre starts shaping labels. */
|
|
2243
|
+
declare function loadTileflowStyleFonts(style: MapLibreStyle | string, options?: TileflowStyleFontLoadOptions): Promise<void>;
|
|
2244
|
+
type TileflowTransformRequestParameters = {
|
|
2245
|
+
url: string;
|
|
2246
|
+
};
|
|
2247
|
+
type TileflowComposedRequest<TRequest extends TileflowTransformRequestParameters> = Pick<TRequest, 'url'> & Partial<Omit<TRequest, 'url'>>;
|
|
2248
|
+
type TileflowTransformRequest<TRequest extends TileflowTransformRequestParameters, TResourceType> = (url: string, resourceType?: TResourceType) => Promise<TileflowComposedRequest<TRequest>> | TileflowComposedRequest<TRequest> | undefined;
|
|
2249
|
+
type TileflowUserTransformRequest<TRequest extends TileflowTransformRequestParameters, TResourceType> = (url: string, resourceType?: TResourceType) => Promise<TRequest> | TRequest | undefined;
|
|
2250
|
+
declare function createTileflowSessionStarter(options: {
|
|
2251
|
+
getSessionId?: () => string;
|
|
2252
|
+
sessionId: string;
|
|
2253
|
+
source: string;
|
|
2254
|
+
startSession?: TileflowSessionSender;
|
|
2255
|
+
}): TileflowSessionStarter;
|
|
2256
|
+
declare function attachTileflowMapLifecycle<TMap, TFrame>(options: {
|
|
2257
|
+
getSession?: () => {
|
|
2258
|
+
analytics: TileflowAnalytics | undefined;
|
|
2259
|
+
styleId?: string;
|
|
2260
|
+
};
|
|
2261
|
+
map: TMap;
|
|
2262
|
+
onLoad?: (map: TMap) => void;
|
|
2263
|
+
scheduler: TileflowFrameScheduler<TFrame>;
|
|
2264
|
+
sessionStarter?: TileflowSessionStarter;
|
|
2265
|
+
setState: (state: TileflowMapReadinessState) => void;
|
|
2266
|
+
subscribe: TileflowMapLifecycleSubscriber<TMap>;
|
|
2267
|
+
}): TileflowMapLifecycleAttachment;
|
|
2268
|
+
/**
|
|
2269
|
+
* Compose the caller's request transform with Tileflow analytics, the Hosted session, and the
|
|
2270
|
+
* World bridge. Analytics are read when each request starts, so an asynchronous user transform
|
|
2271
|
+
* never attaches analytics that changed while it was pending.
|
|
2272
|
+
*/
|
|
2273
|
+
declare function createTileflowTransformRequest<TRequest extends TileflowTransformRequestParameters = TileflowTransformRequestParameters, TResourceType = unknown>(options: {
|
|
2274
|
+
getAnalytics: () => TileflowAnalytics | undefined;
|
|
2275
|
+
sessionController?: TileflowSessionController;
|
|
2276
|
+
sessionId: string;
|
|
2277
|
+
transformRequest?: TileflowUserTransformRequest<TRequest, TResourceType>;
|
|
2278
|
+
worldRequestBridge?: TileflowWorldRequestBridge;
|
|
2279
|
+
}): TileflowTransformRequest<TRequest, TResourceType>;
|
|
2280
|
+
|
|
2281
|
+
export { type AttachTileflowMap3DOptions, type CreateBoundaryFeatureStateOptions, type TileflowAtmosphereMap, type TileflowAtmosphereRuntimeOptions, type TileflowBoundaryFeatureState, type TileflowBrowserThemeBlendSelection, type TileflowBuildingMesh, type TileflowBuildingMeshOptions, type TileflowBuildingModelPlacement, type TileflowBuildings3DDesign, type TileflowComposedRequest, type TileflowContourProtocolHandler, type TileflowContourProtocolRegistrationOptions, type TileflowContourProtocolRegistry, type TileflowContourProtocolRequest, type TileflowContourProtocolResponse, type TileflowDepthMarker, type TileflowDepthMarkerHandle, type TileflowDepthMarkerMap, type TileflowDepthMarkers, type TileflowDepthMarkersOptions, type TileflowDynamicImage, type TileflowDynamicImageContext, type TileflowDynamicImageHandle, type TileflowEmphasis, type TileflowEmphasisArea, type TileflowEmphasisModule, type TileflowFairUseNotice, type TileflowFairUseNoticeController, type TileflowFairUseNoticeState, type TileflowFeatureStateMap, type TileflowFrameScheduler, type TileflowGroundLayer, type TileflowGroundLayers, type TileflowGroundLayersMap, type TileflowGroundLayersOptions, type TileflowGroundOrderMap, type TileflowLabelPlacementMap, type TileflowLightCharacteristic, type TileflowLightPhase, type TileflowLightRhythm, type TileflowLightState, type TileflowLineProgressAnimation, type TileflowLineProgressController, type TileflowLineProgressGradientOptions, type TileflowLineProgressLayer, type TileflowLineProgressMap, type TileflowLineProgressOptions, type TileflowLineProgressShown, type TileflowLineProgressState, TileflowMap3D, type TileflowMap3DAttachment, type TileflowMap3DLoader, TileflowMap3DOptions, type TileflowMap3DSource, type TileflowMapLifecycleAttachment, type TileflowMapLifecycleEvent, type TileflowMapLifecycleSubscriber, type TileflowMapNotice, type TileflowMapReadinessState, type TileflowNauticalLights, type TileflowNauticalLightsMap, type TileflowNoticeControl, type TileflowNoticeControlPosition, type TileflowNoticesMap, type TileflowNoticesOptions, type TileflowPmtilesProtocolHandler, type TileflowPmtilesProtocolRegistrationOptions, type TileflowPmtilesProtocolRegistry, type TileflowRouteInks, type TileflowSessionSender, type TileflowSessionStarter, type TileflowShotCamera, type TileflowShotCue, type TileflowShotKeyframe, type TileflowShotMotion, type TileflowShotPlayback, type TileflowShotPlaybackOptions, type TileflowShotPlayerMap, type TileflowShotState, type TileflowSkyColours, type TileflowSkyHazeMap, type TileflowSkyMap, type TileflowSkyMetadata, type TileflowSkyTimesOfDay, type TileflowStreetLightEstimate, type TileflowStreetLightLayers, type TileflowStreetLightPlacement, type TileflowStreetLightPlacementOptions, type TileflowStreetLightsDesign, type TileflowStyleFontLoadOptions, type TileflowStyleStateValue, type TileflowStyleSwitchMap, TileflowSun, type TileflowSunRequest, type TileflowThemeBlendRequest, type TileflowThemeBlendState, type TileflowThemeChangeOptions, type TileflowThemeController, type TileflowThemeTransition, type TileflowThemeTransitionOptions, type TileflowThemeTransitionPhase, type TileflowThemeTransitionResult, TileflowTileLayer, type TileflowTransformRequest, type TileflowTransformRequestParameters, type TileflowUserTransformRequest, TileflowViewMode, type TileflowWorldProtocolHandler, type TileflowWorldProtocolRequest, type TileflowWorldProtocolResponse, type TileflowWorldRequestBridge, attachTileflowAtmosphere, attachTileflowFairUseNotice, attachTileflowLabelPlacement, attachTileflowMap3D, attachTileflowMapLifecycle, attachTileflowNauticalLights, attachTileflowNotices, attachTileflowSky, attachTileflowSkyHaze, createBoundaryFeatureState, createTileflowDepthMarkers, createTileflowGroundLayers, createTileflowLineProgress, createTileflowSessionStarter, createTileflowThemeController, createTileflowTransformRequest, getTileflowSystemColorScheme, loadTileflowStyleFonts, meshTileflowBuildings, mixTileflowRouteInks, placeTileflowStreetLights, playTileflowShot, readTileflowBuildings3D, readTileflowNauticalLights, readTileflowNotices, readTileflowRouteInks, readTileflowSky, readTileflowStreetLights, readTileflowTeamModelName, registerTileflowContourProtocol, registerTileflowPmtilesProtocol, registerTileflowWorldRequestBridge, subscribeTileflowSystemColorScheme, tileflowBuildingExtent, tileflowBuildingModelPlacementLimit, tileflowBuildingVertexBytes, tileflowBuildingsMetadataKey, tileflowCanvasContextAttributes, tileflowDefaultRouteInks, tileflowDepthMarkerPlacement, tileflowFairUseNoticeMessage, tileflowGroundBeforeId, tileflowLayerDomainMetadataKey, tileflowLightRhythm, tileflowLightRhythmConventions, tileflowLightStateAt, tileflowLineProgressGradient, tileflowMap3DDeclarations, tileflowMap3DMetadataKeys, tileflowMapDeclares3D, tileflowMaplibreContourVersion, tileflowMaxPitch, tileflowNauticalLightStates, tileflowNauticalLightsMetadataKey, tileflowNoticeLimits, tileflowNoticesMetadataKey, tileflowPmtilesMaximumDirectoryDepth, tileflowPmtilesProtocol, tileflowRouteMetadataKey, tileflowShotStateAt, tileflowSkyAtSun, tileflowSkyHazeLayerId, tileflowSkyLayerId, tileflowSkyMetadataKey, tileflowStreetLightBytes, tileflowStreetLightsMetadataKey, tileflowStyleRouteInks, tileflowSunLightMatrix, tileflowTeamModelUrl, validateTileflowBrowserThemeBlendSelection, validateTileflowEmphasis };
|