@tileflow/core 0.1.0-alpha.33 → 0.1.0-alpha.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.d.ts CHANGED
@@ -420,6 +420,24 @@ type TileflowRoadRoundaboutStyle = {
420
420
  casing?: TileflowCircleStyle;
421
421
  fill?: TileflowCircleStyle;
422
422
  };
423
+ /**
424
+ * How Core's street lights renderer lights the map's streets at night, from the lamps and lit
425
+ * streets its data holds.
426
+ */
427
+ type TileflowRoadStreetLightStyle = {
428
+ /** The light of lamps whose data gives no colour; a warm white by default. */
429
+ color?: TileflowThemeColorValue;
430
+ /** Whether the map has street lights; defaults to true where the data binds street furniture. */
431
+ enabled?: boolean;
432
+ /**
433
+ * Where light is estimated where the data maps no lamps: `lit` (the default) along streets and
434
+ * pavements mapped as lit; `streets` also along streets the data says nothing about, in tiles
435
+ * that map few lamps, which invents light; `none` nowhere.
436
+ */
437
+ estimate?: 'lit' | 'streets' | 'none';
438
+ /** How bright the lights shine, from 0 to 2; defaults to 1. */
439
+ intensity?: TileflowThemeNumberValue;
440
+ };
423
441
  type TileflowRoadSidewalkStyle = {
424
442
  outline?: TileflowLineStyle;
425
443
  pattern?: TileflowFillStyle;
@@ -441,6 +459,7 @@ type TileflowRoadsModuleConfig = {
441
459
  roundabouts?: TileflowRoadRoundaboutStyle;
442
460
  serviceTypes?: Partial<Record<TileflowRoadServiceType, TileflowRoadTreatmentStyle>>;
443
461
  sidewalks?: TileflowRoadSidewalkStyle;
462
+ streetLights?: TileflowRoadStreetLightStyle;
444
463
  structures?: Partial<Record<TileflowRoadStructure, TileflowRoadLayerStyle>>;
445
464
  weight?: TileflowRoadWeight;
446
465
  widthScale?: Partial<Record<TileflowRoadClass, TileflowThemeNumberValue>>;
@@ -490,21 +509,50 @@ declare const tileflowPoiCategories: readonly ["arts-entertainment", "education"
490
509
  type TileflowPoiCategory = (typeof tileflowPoiCategories)[number];
491
510
  type TileflowPoiDensity = 1 | 2 | 3 | 4 | 5;
492
511
  type TileflowPoiColorMode = 'uniform' | 'category';
493
- type TileflowPoiCategoryStyle = Omit<TileflowMarkerSymbolStyle, 'priority'> & {
494
- /** Optional category-local cap within the module's canonical density tiers. */
495
- density?: TileflowPoiDensity;
496
- };
512
+ /**
513
+ * How POI categories are placed against each other. `importance` places every category in one
514
+ * order, by World's ranks. `categories` gives each category its own layer and places the
515
+ * categories in the order they are listed, the first on top; ranks order each category only.
516
+ */
517
+ type TileflowPoiPlacementOrder = 'categories' | 'importance';
518
+ /**
519
+ * The appearance of one POI category. With the default `importance` order every category shares
520
+ * one placement layer, so categories may differ only in properties MapLibre evaluates per feature
521
+ * (image, size, colors, font, offsets); layer-wide properties such as zoom ranges, padding,
522
+ * overlap or `optional` must match, or the module uses `placement.order: 'categories'`.
523
+ */
524
+ type TileflowPoiCategoryStyle = Omit<TileflowMarkerSymbolStyle, 'priority'>;
497
525
  type TileflowPoiModuleConfig = {
498
526
  type: 'poi';
499
527
  categories?: readonly TileflowPoiCategory[];
500
528
  color?: TileflowPoiColorMode;
529
+ /** One density for the whole module: World's ranks decide what each category shows. */
501
530
  density?: TileflowPoiDensity;
502
531
  icons?: boolean;
503
532
  labels?: boolean;
504
533
  minZoom?: number;
505
534
  placement?: {
535
+ /**
536
+ * Places each pictogram with its name as one unit that needs room for both. Defaults to
537
+ * `false`.
538
+ */
506
539
  coupleIconAndLabel?: boolean;
507
540
  iconPadding?: number;
541
+ /**
542
+ * World POI `type` values whose pictogram explains them. When pictograms and names are both
543
+ * drawn, every other POI needs a name, and these types are drawn as a pictogram alone.
544
+ * Defaults to parking and public toilets.
545
+ */
546
+ iconOnlyTypes?: readonly string[];
547
+ /** Defaults to `importance`. */
548
+ order?: TileflowPoiPlacementOrder;
549
+ /**
550
+ * With the `importance` order, POIs whose World `filter_rank` is at most this value are placed
551
+ * before the map's road and place labels, and the others after them. A map that gives street
552
+ * names priority over POIs (labels `collisionPriority: 'navigation'`) keeps its landmarks this
553
+ * way. Unset, every POI is placed at the module's own position.
554
+ */
555
+ prominentRank?: 0 | 1 | 2 | 3 | 4 | 5;
508
556
  textPadding?: number;
509
557
  };
510
558
  styles?: Partial<Record<TileflowPoiCategory, TileflowPoiCategoryStyle>>;
@@ -741,11 +789,69 @@ type TileflowBoundariesModuleConfig = TileflowBoundariesModuleOptions & {
741
789
  };
742
790
 
743
791
  type TileflowBuildingMode = '3d' | 'flat';
792
+ /**
793
+ * How Core's 3D buildings renderer draws the map's buildings. Their colour is the map's own 3D
794
+ * building colour (its extrusion), else its roofs'.
795
+ */
796
+ type TileflowBuildingsThreeDimensionalStyle = {
797
+ /** Use the style's extrusion light (default), or the theme controller's scene sun. */
798
+ lighting?: 'style' | 'sun';
799
+ /** Per-building brightness variation, from 0 to 1; defaults to 0 (authored colour). */
800
+ colorVariation?: TileflowThemeNumberValue;
801
+ /** How strongly roof outlines and outer corners catch the light, from 0 (default) to 1. */
802
+ edges?: TileflowThemeNumberValue;
803
+ /** Their own colour, drawn unlit; without it they take the building's colour, lightened. */
804
+ edgeColor?: TileflowThemeColorValue;
805
+ /** How bright the buildings light the street at night, from 0 (none) to 2; defaults to 0. */
806
+ nightLight?: TileflowThemeNumberValue;
807
+ /** Contact shadow at the foot of the walls and in tight corners; defaults to false. */
808
+ occlusion?: boolean;
809
+ /** Shadows from the sun, on the buildings and the flat map; defaults to false. */
810
+ shadows?: boolean;
811
+ /**
812
+ * Invented night windows, lit by rooms: decoration, not data. With World's `class`, none on sheds,
813
+ * barns, factories and churches, and homes lit apart from offices. Defaults to false.
814
+ */
815
+ windows?: boolean;
816
+ /**
817
+ * Building models the map places in its city, from the glTF binaries in its `models`
818
+ * directories. Each stands in for the buildings under its footprint.
819
+ */
820
+ models?: readonly TileflowBuildingModelPlacementConfig[];
821
+ /** The colours of the models' parts; a part without one takes it from the building colour. */
822
+ modelColors?: Partial<Record<TileflowBuildingModelPart, TileflowThemeColorValue>>;
823
+ /**
824
+ * Tileflow's landmarks, such as the Eiffel Tower, drawn as models in place of the buildings
825
+ * under them. On by default with Tileflow World data; `false` switches them off, and `url` names
826
+ * the TileJSON of another landmarks tileset. The map's own `models` come first: a landmark with
827
+ * the same id as one, or whose footprint meets one's, is not drawn.
828
+ */
829
+ landmarks?: boolean | {
830
+ url: string;
831
+ };
832
+ };
833
+ /** The parts of a building model, as its materials name them. */
834
+ type TileflowBuildingModelPart = 'surface' | 'secondary' | 'glass' | 'accent' | 'roof';
835
+ /** Where a building model stands. */
836
+ type TileflowBuildingModelPlacementConfig = {
837
+ /** The model's id: the name of its `.glb` file in the map's `models` directories. */
838
+ model: string;
839
+ /**
840
+ * The HTTPS address of the model's prepared file when it is served elsewhere, such as a model
841
+ * Tileflow hosts for its own maps; the map then needs no `.glb` of its own for it.
842
+ */
843
+ url?: string;
844
+ /** Longitude and latitude of the model's origin, where it stands on the ground. */
845
+ at: readonly [number, number];
846
+ /** Degrees clockwise from north that the model's own north (its +y) is turned to; defaults to 0. */
847
+ heading?: number;
848
+ };
744
849
  type TileflowBuildingsModuleOptions = {
745
850
  businessCorridor?: TileflowAreaStyle;
746
851
  extrusion?: TileflowExtrusionStyle;
747
852
  flat?: TileflowAreaStyle;
748
853
  mode?: TileflowBuildingMode;
854
+ threeDimensional?: TileflowBuildingsThreeDimensionalStyle;
749
855
  };
750
856
  type TileflowBuildingsModuleConfig = TileflowBuildingsModuleOptions & {
751
857
  type: 'buildings';
@@ -816,17 +922,232 @@ type TileflowTransitModuleConfig = TileflowTransitModuleOptions & {
816
922
  type: 'transit';
817
923
  };
818
924
 
819
- type TileflowVegetationMode = '3d' | 'flat';
925
+ /** A prepared model, near and optionally far, as the style's tree description carries it. */
926
+ type TileflowTreeModel = Readonly<{
927
+ near: string;
928
+ far?: string;
929
+ }>;
930
+
931
+ type TileflowTileGeometryType = 'Point' | 'LineString' | 'Polygon';
932
+ type TileflowTileFeature = Readonly<{
933
+ /** The feature's id in the tile, when it has one. */
934
+ id?: number;
935
+ type: TileflowTileGeometryType;
936
+ properties: Readonly<Record<string, string | number | boolean>>;
937
+ /**
938
+ * One flat `[x0, y0, x1, y1, …]` array per point set, line or ring, in tile units from 0 to the
939
+ * layer's extent (coordinates in a tile's buffer fall outside that range). Polygon rings follow
940
+ * the MVT winding: an exterior ring is clockwise in tile units, a hole anticlockwise.
941
+ */
942
+ geometry: readonly (readonly number[])[];
943
+ }>;
944
+ type TileflowTileLayer = Readonly<{
945
+ /** Tile units across the tile, usually 4096. */
946
+ extent: number;
947
+ features: readonly TileflowTileFeature[];
948
+ }>;
949
+ type TileflowVectorTileDecodeOptions = Readonly<{
950
+ /** The layers to decode; others are skipped without decoding. Defaults to every layer. */
951
+ layers?: readonly string[];
952
+ }>;
953
+ /** Decodes a Mapbox Vector Tile's layers. Throws on bytes that are not a vector tile. */
954
+ declare function decodeTileflowVectorTile(bytes: Uint8Array, options?: TileflowVectorTileDecodeOptions): Readonly<Record<string, TileflowTileLayer>>;
955
+
956
+ /** The forms a 3D tree takes. */
957
+ declare const tileflowTreeForms: readonly ["round", "open", "tall", "conifer", "columnar", "palm"];
958
+ type TileflowTreeForm = (typeof tileflowTreeForms)[number];
959
+ /** How a tree's surfaces take the light: facets, a smooth round shape, or bands as drawn. */
960
+ declare const tileflowTreeFinishes: readonly ["faceted", "smooth", "toon"];
961
+ type TileflowTreeFinish = (typeof tileflowTreeFinishes)[number];
962
+ /** A form's own scales, on top of the map's, and the map's own models it draws. */
963
+ type TileflowTreeFormStyle = Readonly<{
964
+ heightScale?: number;
965
+ crownScale?: number;
966
+ /** Ids of the map's own models, one to four; each tree draws one by its stable seed. */
967
+ models?: readonly string[];
968
+ }>;
969
+ /** Relative weights of the forms given to trees whose data gives none. */
970
+ type TileflowTreeFormMix = Readonly<Partial<Record<TileflowTreeForm, number>>>;
971
+ /** A region whose trees without a form in the data take their own mix. */
972
+ type TileflowTreeRegion = Readonly<{
973
+ /** `[west, south, east, north]` in degrees. */
974
+ bounds: readonly [number, number, number, number];
975
+ unknownForms: TileflowTreeFormMix;
976
+ }>;
977
+ /** The fields of the tree and canopy layers, as World names them. */
978
+ type TileflowTreeFields = Readonly<{
979
+ height: string;
980
+ diameterCrown: string;
981
+ circumference: string;
982
+ genus: string;
983
+ species: string;
984
+ leafType: string;
985
+ /** The tree's taxon at any rank, such as `Arecaceae` for palms or a genus or species. */
986
+ taxon: string;
987
+ canopyRank: string;
988
+ canopyClearance: string;
989
+ canopyCover: string;
990
+ /** A canopy point's measured canopy height, in metres. */
991
+ canopyHeight: string;
992
+ }>;
993
+ type TileflowTreePlacementOptions = Readonly<{
994
+ /** The tile's address, for regions and for a stable look per tree. */
995
+ tile: Readonly<{
996
+ x: number;
997
+ y: number;
998
+ z: number;
999
+ }>;
1000
+ /** The tile's width in metres. */
1001
+ tileMetres: number;
1002
+ fields?: Partial<TileflowTreeFields>;
1003
+ unknownForms?: TileflowTreeFormMix;
1004
+ regions?: readonly TileflowTreeRegion[];
1005
+ /** Metres between the trees of a row; defaults to 8. */
1006
+ rowSpacing?: number;
1007
+ /** How many models each form draws from, 1 to 4; each tree draws one by its seed. */
1008
+ variants?: Readonly<Partial<Record<TileflowTreeForm, number>>>;
1009
+ }>;
1010
+ /** A tile's layers trees come from, as World names them. */
1011
+ type TileflowTreeLayers = Readonly<{
1012
+ /**
1013
+ * World's `tree`: trees mapped one by one as points, and rows of trees as lines, planted every
1014
+ * `rowSpacing` metres.
1015
+ */
1016
+ trees?: TileflowTileLayer;
1017
+ /** Decorative canopy points in parks and gardens (World's `canopy`). */
1018
+ canopy?: TileflowTileLayer;
1019
+ }>;
1020
+ /** Where some trees are in a placement, and how many of them have each rank or a lower one. */
1021
+ type TileflowTreeRange = Readonly<{
1022
+ start: number;
1023
+ count: number;
1024
+ /** `upTo[r]`: trees of the range with a rank of `r` or lower, from 0 to 15. */
1025
+ upTo: readonly number[];
1026
+ }>;
1027
+ /** Where a form's trees are in a placement, and those of each of its models in turn. */
1028
+ type TileflowTreeFormRange = TileflowTreeRange & Readonly<{
1029
+ /** One range per model the form draws from, in order; one when it draws Core's own tree. */
1030
+ variants: readonly TileflowTreeRange[];
1031
+ }>;
1032
+ /** One tile's trees, ready to upload. */
1033
+ type TileflowTreePlacement = Readonly<{
1034
+ /** `tileflowTreeBytes` bytes per tree, ordered by form, model, then rank; see the layout below. */
1035
+ trees: Uint8Array;
1036
+ forms: Readonly<Record<TileflowTreeForm, TileflowTreeFormRange>>;
1037
+ /** The tallest tree, in metres. */
1038
+ tallest: number;
1039
+ /** Trees from the data's trees and rows, and trees from canopy points. */
1040
+ mapped: number;
1041
+ canopy: number;
1042
+ }>;
1043
+ /**
1044
+ * Bytes per tree: x and y in tile units of 8192 (uint16 each), height and crown diameter in
1045
+ * decimetres (uint16 each), then one byte each for its turn (of a full turn), its shade among the
1046
+ * theme's colours, its form, its rank (0–15, lower shows first), a seed, whether it stands for a
1047
+ * canopy point (1) or a mapped tree (0), the model of its form it draws, and a byte of padding.
1048
+ */
1049
+ declare const tileflowTreeBytes = 16;
1050
+ /**
1051
+ * The form a tree's data gives it, or undefined when its data says nothing about its form: a palm
1052
+ * by `leaf_type` or genus, a column, a conifer by `leaf_type` or genus, or one of the broadleaf
1053
+ * forms by genus. `broadleaf` means the data says broadleaved without a known genus.
1054
+ */
1055
+ declare function tileflowTreeFormOf(properties: Readonly<Record<string, unknown>>, fields?: Partial<TileflowTreeFields>): TileflowTreeForm | 'broadleaf' | undefined;
1056
+ /** Places a tile's trees. Points in the tile's buffer belong to the neighbouring tile. */
1057
+ declare function placeTileflowTrees(layers: TileflowTreeLayers, options: TileflowTreePlacementOptions): TileflowTreePlacement;
1058
+ /** The style metadata key under which a compiled map describes its 3D trees. */
1059
+ declare const tileflowVegetationMetadataKey = "tileflow:vegetation";
1060
+ /** How a compiled map's 3D trees look and where their data is, resolved for one theme. */
1061
+ type TileflowVegetation3D = Readonly<{
1062
+ /** The vector source and its layers with the trees and the canopy points. */
1063
+ source: string;
1064
+ layers: Readonly<{
1065
+ tree: string;
1066
+ canopy?: string;
1067
+ }>;
1068
+ fields: TileflowTreeFields;
1069
+ /** Sunlit colours: bark, and the leaves of each kind of tree from darkest to lightest. */
1070
+ colors: Readonly<{
1071
+ bark: string;
1072
+ broadleaf: readonly string[];
1073
+ conifer: readonly string[];
1074
+ palm: readonly string[];
1075
+ }>;
1076
+ heightScale: number;
1077
+ crownScale: number;
1078
+ /** Each form's own scales and models. */
1079
+ forms: Readonly<Partial<Record<TileflowTreeForm, TileflowTreeFormStyle>>>;
1080
+ /** The map's own models its forms draw, by id, prepared from its `models` directories. */
1081
+ models: Readonly<Record<string, TileflowTreeModel>>;
1082
+ finish: TileflowTreeFinish;
1083
+ /** How strongly an outline rings each tree, from 0 (none) to 1, and its colour. */
1084
+ edges: number;
1085
+ edgeColor?: string;
1086
+ unknownForms: TileflowTreeFormMix;
1087
+ regions: readonly TileflowTreeRegion[];
1088
+ /** The style's layers that draw the trees flat, which the 3D trees stand in for while shown. */
1089
+ flatLayers: readonly string[];
1090
+ }>;
1091
+ /**
1092
+ * Reads the 3D trees a compiled style describes, or undefined when its metadata has none or holds
1093
+ * a version or shape this Core does not know.
1094
+ */
1095
+ declare function readTileflowVegetation3D(metadata: unknown): TileflowVegetation3D | undefined;
1096
+
1097
+ type TileflowVegetationMode = '3d' | 'flat' | 'auto';
820
1098
  type TileflowVegetationThreeDimensionalStyle = {
821
1099
  barkColor?: TileflowThemeColorValue;
1100
+ /** Sunlit leaf colours of broadleaf trees, from darkest to lightest; up to four are used. */
822
1101
  broadleafColors?: readonly TileflowThemeColorValue[];
1102
+ /** Sunlit needle colours of conifers and columns, from darkest to lightest. */
823
1103
  coniferColors?: readonly TileflowThemeColorValue[];
1104
+ /** Sunlit frond colours of palms, from darkest to lightest; the broadleaf colours by default. */
1105
+ palmColors?: readonly TileflowThemeColorValue[];
824
1106
  crownScale?: TileflowThemeNumberValue;
825
1107
  heightScale?: TileflowThemeNumberValue;
1108
+ /**
1109
+ * How trees take the light: `faceted` (the default), low-poly facets softened towards a round
1110
+ * crown; `smooth`, round crowns; or `toon`, three bands of light and a crisp shadow, as a drawn
1111
+ * tree has them.
1112
+ */
1113
+ finish?: TileflowTreeFinish;
1114
+ /** How strongly an outline rings each tree, from 0 (none, the default) to 1. */
1115
+ edges?: TileflowThemeNumberValue;
1116
+ /** The outline's colour; the crown's darkest colour, deepened, by default. */
1117
+ edgeColor?: TileflowThemeColorValue;
1118
+ /**
1119
+ * Each form's own scales, on top of `heightScale` and `crownScale`, such as taller palms, and the
1120
+ * map's own models it draws: ids of `.glb` files in the map's `models` directories, one to four,
1121
+ * each tree drawing one. A model's materials named `bark`, `leaves`, `fronds` or `stem` take
1122
+ * those parts' colours.
1123
+ */
1124
+ forms?: Partial<Record<TileflowTreeForm, {
1125
+ heightScale?: TileflowThemeNumberValue;
1126
+ crownScale?: TileflowThemeNumberValue;
1127
+ models?: readonly string[];
1128
+ }>>;
1129
+ /**
1130
+ * The forms of trees whose data gives none, as relative weights: `round`, `open` and `tall`
1131
+ * (broadleaf), `conifer`, `columnar` and `palm`. Each tree draws one from a stable hash, so it
1132
+ * keeps its form everywhere. Defaults to the three broadleaf forms, evenly. A tree the data calls
1133
+ * broadleaved keeps to the broadleaf forms of the mix.
1134
+ */
1135
+ unknownForms?: TileflowTreeFormMix;
1136
+ /**
1137
+ * Regions whose trees without a form in the data take their own mix, such as palms along a
1138
+ * subtropical coast. Bounds are `[west, south, east, north]` in degrees; the first region holding
1139
+ * a tree applies. At most 16.
1140
+ */
1141
+ regions?: readonly TileflowTreeRegion[];
826
1142
  };
827
1143
  type TileflowVegetationModuleOptions = {
828
1144
  flat?: TileflowCircleStyle;
1145
+ /** `3d` uses models at every pitch; `auto` follows the runtime's explicit 2D/3D view mode. */
829
1146
  mode?: TileflowVegetationMode;
1147
+ /** Representation when a renderer cannot draw models. Defaults to `flat`. */
1148
+ fallback?: 'flat' | 'none';
1149
+ /** Initial visibility; a runtime control may override it. Defaults to true. */
1150
+ visible?: boolean;
830
1151
  threeDimensional?: TileflowVegetationThreeDimensionalStyle;
831
1152
  };
832
1153
  type TileflowVegetationModuleConfig = TileflowVegetationModuleOptions & {
@@ -836,10 +1157,14 @@ type TileflowVegetationModuleConfig = TileflowVegetationModuleOptions & {
836
1157
  type TileflowWaterwayClass = 'canal' | 'other' | 'river' | 'stream';
837
1158
  type TileflowWaterModuleOptions = {
838
1159
  bathymetry?: TileflowFillStyle;
839
- /** Opt-in approximate contours traced from discrete bathymetry polygon band edges. */
1160
+ /** Contour lines when declared by Bathymetry; otherwise approximate polygon band edges. */
840
1161
  bathymetryContours?: TileflowLineStyle;
841
- /** Opt-in labels for bathymetry polygon band floors, not measured survey soundings. */
1162
+ /** Contour-depth or legacy band-floor labels, not measured survey soundings. */
842
1163
  bathymetryLabels?: TileflowSymbolStyle;
1164
+ /** Names from an explicitly declared seafloor_landform layer. */
1165
+ bathymetryLandforms?: TileflowSymbolStyle;
1166
+ /** Names from an explicitly declared water_name layer. */
1167
+ bathymetryWaterNames?: TileflowSymbolStyle;
843
1168
  bodies?: TileflowAreaStyle;
844
1169
  intermittent?: {
845
1170
  bodies?: TileflowAreaStyle;
@@ -1062,30 +1387,20 @@ type TileflowLineProgressController = {
1062
1387
  */
1063
1388
  declare function createTileflowLineProgress(map: TileflowLineProgressMap, options: TileflowLineProgressOptions): TileflowLineProgressController;
1064
1389
 
1065
- type TileflowTileGeometryType = 'Point' | 'LineString' | 'Polygon';
1066
- type TileflowTileFeature = Readonly<{
1067
- /** The feature's id in the tile, when it has one. */
1068
- id?: number;
1069
- type: TileflowTileGeometryType;
1070
- properties: Readonly<Record<string, string | number | boolean>>;
1071
- /**
1072
- * One flat `[x0, y0, x1, y1, …]` array per point set, line or ring, in tile units from 0 to the
1073
- * layer's extent (coordinates in a tile's buffer fall outside that range). Polygon rings follow
1074
- * the MVT winding: an exterior ring is clockwise in tile units, a hole anticlockwise.
1075
- */
1076
- geometry: readonly (readonly number[])[];
1077
- }>;
1078
- type TileflowTileLayer = Readonly<{
1079
- /** Tile units across the tile, usually 4096. */
1080
- extent: number;
1081
- features: readonly TileflowTileFeature[];
1082
- }>;
1083
- type TileflowVectorTileDecodeOptions = Readonly<{
1084
- /** The layers to decode; others are skipped without decoding. Defaults to every layer. */
1085
- layers?: readonly string[];
1390
+ /** Bounded, read-only mesh snapshot for developer tooling. Positions are x east, y north, z up. */
1391
+ type TileflowModelInspection = Readonly<{
1392
+ id: string;
1393
+ module: string;
1394
+ format: string;
1395
+ vertices: number;
1396
+ triangles: number;
1397
+ bytes: number;
1398
+ lods: number;
1399
+ instances?: number;
1400
+ positions: number[];
1401
+ indices: number[];
1402
+ colors?: string[];
1086
1403
  }>;
1087
- /** Decodes a Mapbox Vector Tile's layers. Throws on bytes that are not a vector tile. */
1088
- declare function decodeTileflowVectorTile(bytes: Uint8Array, options?: TileflowVectorTileDecodeOptions): Readonly<Record<string, TileflowTileLayer>>;
1089
1404
 
1090
1405
  type TileflowTileAddress = Readonly<{
1091
1406
  z: number;
@@ -1097,7 +1412,11 @@ type TileflowTile = TileflowTileAddress & Readonly<{
1097
1412
  layers: Readonly<Record<string, TileflowTileLayer>>;
1098
1413
  }>;
1099
1414
  /** Rewrites a tile request as a MapLibre map's `transformRequest` does. */
1100
- type TileflowTileRequestTransform = (url: string, resourceType: 'Tile') => Readonly<{
1415
+ type TileflowTileRequestTransform = (url: string, resourceType: 'Tile') => Promise<Readonly<{
1416
+ url: string;
1417
+ headers?: Readonly<Record<string, string>>;
1418
+ credentials?: RequestCredentials;
1419
+ }> | undefined> | Readonly<{
1101
1420
  url: string;
1102
1421
  headers?: Readonly<Record<string, string>>;
1103
1422
  credentials?: RequestCredentials;
@@ -1117,7 +1436,10 @@ type TileflowTileReaderOptions = Readonly<{
1117
1436
  concurrency?: number;
1118
1437
  /** The map's request rules, applied to every tile request. */
1119
1438
  transformRequest?: TileflowTileRequestTransform;
1120
- /** Defaults to the global `fetch`. */
1439
+ /**
1440
+ * Defaults to the global `fetch`, and to Core's PMTiles protocol for a source served from a
1441
+ * Tileflow PMTiles archive (`tileflow-pmtiles://`).
1442
+ */
1121
1443
  fetch?: (url: string, init: RequestInit) => Promise<Response>;
1122
1444
  }>;
1123
1445
  type TileflowTileAreaRequest = Readonly<{
@@ -1162,6 +1484,21 @@ declare function readTileflowMapTileSource(map: TileflowTileSourceMap, sourceId:
1162
1484
  maxzoom: number;
1163
1485
  } | undefined;
1164
1486
 
1487
+ /**
1488
+ * The sun's view of a box of buildings: an orthographic projection along `direction` (towards the
1489
+ * sun; x east, y north, z up, in metres) as a column-major matrix to clip space, with the metres its
1490
+ * depth runs over and the metres its wider side spans. It follows only the sun, never the camera,
1491
+ * so shadows hold still while the camera moves.
1492
+ */
1493
+ declare function tileflowSunLightMatrix(direction: readonly number[], box: Readonly<{
1494
+ min: readonly number[];
1495
+ max: readonly number[];
1496
+ }>): {
1497
+ matrix: Float32Array;
1498
+ depth: number;
1499
+ extent: number;
1500
+ };
1501
+
1165
1502
  /** The MapLibre GL JS map capabilities the renderer uses. */
1166
1503
  type TileflowBuildings3DMap = {
1167
1504
  addLayer(layer: object, beforeId?: string): unknown;
@@ -1170,6 +1507,7 @@ type TileflowBuildings3DMap = {
1170
1507
  lng: number;
1171
1508
  };
1172
1509
  getBearing(): number;
1510
+ getLight?(): unknown;
1173
1511
  getLayer(id: string): unknown;
1174
1512
  getPaintProperty(layer: string, name: string): unknown;
1175
1513
  getPitch(): number;
@@ -1182,64 +1520,18 @@ type TileflowBuildings3DMap = {
1182
1520
  removeLayer(id: string): unknown;
1183
1521
  triggerRepaint(): unknown;
1184
1522
  };
1185
- /** Where the renderer reads the sun and the themes: a Tileflow theme controller. */
1523
+ /** Where the renderer reads the sun and the map's design: a Tileflow theme controller. */
1186
1524
  type TileflowBuildings3DThemes = {
1187
- getBlend?(): {
1188
- position: number;
1189
- themes: readonly string[];
1190
- } | undefined;
1191
- getCurrent?(): {
1192
- theme?: string;
1193
- };
1194
1525
  getSun?(): TileflowSun;
1526
+ getThemeMetadata?(key: string): Readonly<{
1527
+ values: readonly unknown[];
1528
+ position: number;
1529
+ }>;
1195
1530
  };
1196
1531
  type TileflowBuildings3DOptions = Readonly<{
1197
1532
  map: TileflowBuildings3DMap;
1198
- /** The theme controller, for the sun and, with `color`, the themes on screen. */
1533
+ /** The theme controller, for the sun and the buildings' design in every theme. */
1199
1534
  controller?: TileflowBuildings3DThemes;
1200
- /** The vector source to read; defaults to `tileflow`, a Tileflow map's World source. */
1201
- source?: string;
1202
- /** The source layer with the buildings; defaults to `building`. */
1203
- sourceLayer?: string;
1204
- /**
1205
- * The source layer with the places, for the night use of buildings in tiles whose buildings do
1206
- * not carry World's `night_use`; defaults to `poi`.
1207
- */
1208
- placesLayer?: string;
1209
- /**
1210
- * A building's colour for a theme, from its feature properties, as a CSS colour. Each building
1211
- * is coloured once per theme, and the renderer mixes the colours of the themes either side of
1212
- * a blend's position. Without it, buildings take the theme's 3D building colour.
1213
- */
1214
- color?: (properties: Readonly<Record<string, string | number | boolean>>, theme: string) => string;
1215
- /** Shadows from the sun, on the buildings and the flat map; defaults to true. */
1216
- shadows?: boolean;
1217
- /** Contact shadow at the foot of the walls and in tight corners; defaults to true. */
1218
- occlusion?: boolean;
1219
- /**
1220
- * How bright the buildings light the street at night, from 0 (none) to 2; defaults to 1, a quiet
1221
- * light. Landmarks (World's `building_tone`) and towers are flood-lit at their foot, and buildings
1222
- * with places busy at night (World's `night_use`) light their ground floor windows and the
1223
- * pavement in front: bars and clubs in neon or a warm light, theatres and cinemas in white,
1224
- * places to eat in amber.
1225
- */
1226
- nightLight?: number;
1227
- /**
1228
- * How strongly roof outlines and buildings' outer corners catch the light, from 0 (none) to 1;
1229
- * defaults to 1. They keep a constant width on screen, so where one building ends and the next
1230
- * starts stays legible at any distance, at night most of all.
1231
- */
1232
- edges?: number;
1233
- /**
1234
- * The colour of roof outlines and outer corners, as a CSS colour or per theme, drawn as it is,
1235
- * unlit, at the full `edges` strength by day and night. The renderer asks for each theme's colour
1236
- * once and mixes the colours of the themes either side of a blend's position; a theme without a
1237
- * valid colour keeps the default. Without it, edges take the building's own colour, lightened as
1238
- * if catching the light, half as strong by day as at night.
1239
- */
1240
- edgeColor?: string | ((theme: string) => string);
1241
- /** Invented night windows, lit by rooms; decoration, not data. Defaults to false. */
1242
- windows?: boolean;
1243
1535
  /** The zoom from which buildings stand; below it they sink into the flat map. Defaults to 14.5. */
1244
1536
  minzoom?: number;
1245
1537
  /** The most tiles raised round the camera, from 1 to 64; defaults to 25. */
@@ -1252,22 +1544,31 @@ type TileflowBuildings3DOptions = Readonly<{
1252
1544
  type TileflowBuildings3DChange = Readonly<{
1253
1545
  transition?: Readonly<{
1254
1546
  duration?: number;
1547
+ mode?: 'grow' | 'fade';
1255
1548
  }>;
1256
1549
  }>;
1257
1550
  type TileflowBuildings3D = {
1258
- /** Raises the buildings out of the ground; resolves once they stand. */
1551
+ /** Read-only, bounded snapshots of resident prepared model meshes. */
1552
+ inspectModels(): TileflowModelInspection[];
1553
+ /** Shows buildings immediately; pass a transition duration to animate their rise. */
1259
1554
  show(options?: TileflowBuildings3DChange): Promise<void>;
1260
- /** Sinks the buildings back into the flat map; resolves once they are gone. */
1555
+ /** Hides buildings immediately; pass a transition duration to animate their descent. */
1261
1556
  hide(options?: TileflowBuildings3DChange): Promise<void>;
1262
- /** Eases the buildings to `scale` of their height, from 0 (flat) to 1. */
1557
+ /** Sets the height scale, from 0 (flat) to 1; animation requires a transition duration. */
1263
1558
  grow(scale: number, options?: TileflowBuildings3DChange): Promise<void>;
1264
1559
  /** The height scale shown now. */
1265
1560
  readonly scale: number;
1266
- /** Tiles raised, buildings and vertices, for diagnostics. */
1561
+ /**
1562
+ * Whether the map's style describes its 3D buildings (the buildings module's
1563
+ * `threeDimensional`), tiles raised, buildings and vertices, and the placed models standing, for
1564
+ * diagnostics.
1565
+ */
1267
1566
  readonly stats: Readonly<{
1567
+ declared: boolean;
1268
1568
  tiles: number;
1269
1569
  buildings: number;
1270
1570
  vertices: number;
1571
+ models: number;
1271
1572
  }>;
1272
1573
  /** Takes the layer off the map and lets go of its buffers. */
1273
1574
  dispose(): void;
@@ -1278,20 +1579,6 @@ declare const tileflowBuildings3DLayerId = "tileflow-buildings-3d";
1278
1579
  * z15 tiles round the camera, the zoom at which World's buildings carry their heights.
1279
1580
  */
1280
1581
  declare function createTileflowBuildings3D(options: TileflowBuildings3DOptions): TileflowBuildings3D;
1281
- /**
1282
- * The sun's view of a box of buildings: an orthographic projection along `direction` (towards the
1283
- * sun; x east, y north, z up, in metres) as a column-major matrix to clip space, with the metres its
1284
- * depth runs over and the metres its wider side spans. It follows only the sun, never the camera,
1285
- * so shadows hold still while the camera moves.
1286
- */
1287
- declare function tileflowSunLightMatrix(direction: readonly number[], box: Readonly<{
1288
- min: readonly number[];
1289
- max: readonly number[];
1290
- }>): {
1291
- matrix: Float32Array;
1292
- depth: number;
1293
- extent: number;
1294
- };
1295
1582
 
1296
1583
  /** The renderer's tile units: MapLibre projects custom layers' tiles over 8192. */
1297
1584
  declare const tileflowBuildingExtent = 8192;
@@ -1308,6 +1595,12 @@ type TileflowBuildingMeshOptions = Readonly<{
1308
1595
  * the building its use.
1309
1596
  */
1310
1597
  places?: TileflowTileLayer;
1598
+ /**
1599
+ * Footprints of the building models standing here, as rings of tile units (0 to 8192): a
1600
+ * building whose centre falls inside one, or that reaches more than half a metre into one, is not
1601
+ * raised, since the model stands in for it.
1602
+ */
1603
+ masks?: readonly (readonly number[])[];
1311
1604
  }>;
1312
1605
  /** One tile's buildings, ready to upload. */
1313
1606
  type TileflowBuildingMesh = Readonly<{
@@ -1322,12 +1615,13 @@ type TileflowBuildingMesh = Readonly<{
1322
1615
  }>;
1323
1616
  /**
1324
1617
  * Meshes the buildings of one decoded tile layer, or returns undefined when it has none. It reads
1325
- * World's `render_height`, `render_min_height`, `hide_3d`, `building_tone` and `night_use`. Vertex layout:
1618
+ * World's `render_height`, `render_min_height`, `hide_3d`, `building_tone`, `class` and `night_use`.
1619
+ * Vertex layout:
1326
1620
  * 0 position in the tile, 0 to 8192 (uint16 ×2); 4 base and top in decimetres (uint16 ×2); 8 the
1327
1621
  * wall's outward normal (int8 ×2, normalised); 10 raised to the top, part of a wall (uint8 ×2);
1328
1622
  * 12 decimetres along the wall (uint16); 14 a per-building jitter and seed (uint8 ×2, normalised);
1329
- * 16 the building's centre in the tile (uint16 ×2); 20 tone and night use (uint8 ×2: none, dining,
1330
- * entertainment, nightlife); 22 the wall's
1623
+ * 16 the building's centre in the tile (uint16 ×2); 20 tone plus four times its class group, and
1624
+ * night use (uint8 ×2: none, dining, entertainment, nightlife); 22 the wall's
1331
1625
  * tight corners, bit 0 at its start and bit 1 at its end, and bit 2 when it faces a courtyard, and
1332
1626
  * its length in metres up to 255
1333
1627
  * (uint8 ×2); 24 the building's feature index (uint16); 26 on a roof, the vertex's corner of its
@@ -1340,47 +1634,6 @@ type TileflowBuildingMesh = Readonly<{
1340
1634
  */
1341
1635
  declare function meshTileflowBuildings(layer: TileflowTileLayer, options: TileflowBuildingMeshOptions): TileflowBuildingMesh | undefined;
1342
1636
 
1343
- /** Bytes per lamp; see `placeTileflowStreetLights` for the layout. */
1344
- declare const tileflowStreetLightBytes = 12;
1345
- /**
1346
- * Where light is estimated where the data maps no lamps: `lit` (the default) along the streets and
1347
- * pavements the data maps as lit; `streets` also along the streets the data says nothing about,
1348
- * wherever it maps few lamps, which invents light as night windows do; `none` nowhere, so only
1349
- * mapped lamps shine.
1350
- */
1351
- type TileflowStreetLightEstimate = 'streets' | 'lit' | 'none';
1352
- type TileflowStreetLightPlacementOptions = Readonly<{
1353
- /** The tile's width in metres. */
1354
- tileMetres: number;
1355
- /** Defaults to `lit`. */
1356
- estimate?: TileflowStreetLightEstimate;
1357
- }>;
1358
- /** A tile's layers the lamps come from, as World names them. */
1359
- type TileflowStreetLightLayers = Readonly<{
1360
- /** Points with `subclass` `street_lamp` (World's `street_furniture`). */
1361
- streetFurniture?: TileflowTileLayer;
1362
- /** Streets by `class`, with `lit` where mapped (World's `transportation`). */
1363
- transportation?: TileflowTileLayer;
1364
- /** Pavements, as lines or areas, with `lit` where mapped (World's `sidewalk`). */
1365
- sidewalks?: TileflowTileLayer;
1366
- }>;
1367
- /** One tile's lamps, ready to upload. */
1368
- type TileflowStreetLightPlacement = Readonly<{
1369
- lamps: Uint8Array;
1370
- /** Lamps from the data. */
1371
- mapped: number;
1372
- /** Points of soft light estimated along streets. */
1373
- estimated: number;
1374
- }>;
1375
- /**
1376
- * Places one tile's lamps and estimated light, or returns undefined when it has none. Each is a
1377
- * point of light, flagged as mapped or estimated. Layout: 0 position in the
1378
- * tile, 0 to 8192 (uint16 ×2); 4 height in decimetres (uint16); 6 the reach of its light on the
1379
- * ground in metres (uint8); 7 flags (uint8: bit 0 mapped, bit 1 its own colour); 8 its colour
1380
- * (uint8 ×3, sRGB); 11 a seed (uint8, normalised).
1381
- */
1382
- declare function placeTileflowStreetLights(layers: TileflowStreetLightLayers, options: TileflowStreetLightPlacementOptions): TileflowStreetLightPlacement | undefined;
1383
-
1384
1637
  /** The MapLibre GL JS map capabilities the street lights use. */
1385
1638
  type TileflowStreetLightsMap = {
1386
1639
  addLayer(layer: object, beforeId?: string): unknown;
@@ -1402,23 +1655,17 @@ type TileflowStreetLightsMap = {
1402
1655
  };
1403
1656
  type TileflowStreetLightsOptions = Readonly<{
1404
1657
  map: TileflowStreetLightsMap;
1405
- /** The theme controller, whose sun switches the lights on and off. */
1658
+ /**
1659
+ * The theme controller, whose sun switches the lights on and off and whose themes hold the map's
1660
+ * street lights (the roads module's `streetLights`).
1661
+ */
1406
1662
  controller?: {
1407
1663
  getSun?(): TileflowSun;
1664
+ getThemeMetadata?(key: string): Readonly<{
1665
+ values: readonly unknown[];
1666
+ position: number;
1667
+ }>;
1408
1668
  };
1409
- /** The vector source to read; defaults to `tileflow`, a Tileflow map's World source. */
1410
- source?: string;
1411
- /**
1412
- * Where soft light is estimated where the data maps no lamps: `lit` (the default) along the
1413
- * streets and pavements the data maps as lit; `streets` also along the streets the data says
1414
- * nothing about, wherever it maps few lamps, which invents light as night windows do; `none`
1415
- * nowhere, so only mapped lamps shine.
1416
- */
1417
- estimate?: TileflowStreetLightEstimate;
1418
- /** The light of the lamps whose data gives no colour, as a CSS colour; a warm white by default. */
1419
- color?: string;
1420
- /** How bright the lights shine, from 0 to 2; defaults to 1. */
1421
- intensity?: number;
1422
1669
  /** The zoom from which the lights shine. Defaults to 14. */
1423
1670
  minzoom?: number;
1424
1671
  /** The most tiles lit round the camera, from 1 to 64; defaults to 25. */
@@ -1431,8 +1678,12 @@ type TileflowStreetLightsOptions = Readonly<{
1431
1678
  type TileflowStreetLights = {
1432
1679
  /** How far the lights have switched on, from 0 by day to 1 at night. */
1433
1680
  readonly on: number;
1434
- /** Tiles lit, lamps, and how many of them the data maps or the layer estimates. */
1681
+ /**
1682
+ * Whether the map's style describes its street lights, tiles lit, lamps, and how many of them the
1683
+ * data maps or the layer estimates.
1684
+ */
1435
1685
  readonly stats: Readonly<{
1686
+ declared: boolean;
1436
1687
  tiles: number;
1437
1688
  lamps: number;
1438
1689
  mapped: number;
@@ -1448,6 +1699,226 @@ declare const tileflowStreetLightsLayerId = "tileflow-street-lights";
1448
1699
  */
1449
1700
  declare function createTileflowStreetLights(options: TileflowStreetLightsOptions): TileflowStreetLights;
1450
1701
 
1702
+ /** The parts of a model, each coloured by the theme: the model's materials name them. */
1703
+ declare const tileflowModelParts: Readonly<{
1704
+ surface: 0;
1705
+ secondary: 1;
1706
+ glass: 2;
1707
+ accent: 3;
1708
+ roof: 4;
1709
+ }>;
1710
+ type TileflowModelPart = keyof typeof tileflowModelParts;
1711
+
1712
+ /** The style metadata key under which a compiled map describes its 3D buildings. */
1713
+ declare const tileflowBuildingsMetadataKey = "tileflow:buildings";
1714
+ /** A compiled map's 3D buildings, resolved for one theme. */
1715
+ type TileflowBuildings3DDesign = Readonly<{
1716
+ /** The vector source and its layers with the buildings and the places they hold. */
1717
+ source: string;
1718
+ layers: Readonly<{
1719
+ building: string;
1720
+ places?: string;
1721
+ }>;
1722
+ /**
1723
+ * Each building's colour: a CSS colour, or a MapLibre expression over the building's
1724
+ * properties that gives one, as the map colours its 3D buildings (or its roofs).
1725
+ */
1726
+ color: string | readonly unknown[];
1727
+ /** How strongly roof outlines and outer corners catch the light, from 0 to 1. */
1728
+ edges: number;
1729
+ /** Style extrusion light by default; scene sun lighting is opt-in. */
1730
+ lighting: 'style' | 'sun';
1731
+ /** Per-building brightness variation, from 0 to 1; 0 preserves the authored colour. */
1732
+ colorVariation: number;
1733
+ /** The authored extrusion's vertical wall gradient. */
1734
+ verticalGradient: boolean;
1735
+ /** Their own colour, drawn unlit; without it they take the building's colour, lightened. */
1736
+ edgeColor?: string;
1737
+ /** How bright the buildings light the street at night, from 0 to 2. */
1738
+ nightLight: number;
1739
+ /** Invented night windows, lit by rooms: decoration, not data. */
1740
+ windows: boolean;
1741
+ /** Shadows from the sun, and contact shadow at the foot of the walls. */
1742
+ shadows: boolean;
1743
+ occlusion: boolean;
1744
+ /** Building models the map places in its city, each replacing the buildings under it. */
1745
+ models?: readonly TileflowBuildingModelPlacement[];
1746
+ /** The colours of the models' parts; a part without one takes it from the building colour. */
1747
+ modelColors?: Readonly<Partial<Record<TileflowModelPart, string>>>;
1748
+ /**
1749
+ * Tileflow's landmarks, drawn as models in place of the buildings under them: the TileJSON of
1750
+ * their tileset. Without it, the map shows none.
1751
+ */
1752
+ landmarks?: Readonly<{
1753
+ url: string;
1754
+ }>;
1755
+ }>;
1756
+ /** A building model standing in the map's city. */
1757
+ type TileflowBuildingModelPlacement = Readonly<{
1758
+ /** The model's id, its file's name in the map's `models` directories. */
1759
+ model: string;
1760
+ /** Where the prepared model file is served, absolute or relative to the page. */
1761
+ url: string;
1762
+ /** Longitude and latitude of the model's origin, where it stands on the ground. */
1763
+ at: readonly [number, number];
1764
+ /** Degrees clockwise from north that the model's own north is turned to. */
1765
+ heading: number;
1766
+ }>;
1767
+ /**
1768
+ * Reads the 3D buildings a compiled style describes, or undefined when its metadata has none or a
1769
+ * version or shape this Core does not know.
1770
+ */
1771
+ declare function readTileflowBuildings3D(metadata: unknown): TileflowBuildings3DDesign | undefined;
1772
+ /** The most models one map places. */
1773
+ declare const tileflowBuildingModelPlacementLimit = 256;
1774
+
1775
+ /** The MapLibre GL JS map capabilities the trees use. */
1776
+ type TileflowTrees3DMap = {
1777
+ addLayer(layer: object, beforeId?: string): unknown;
1778
+ getBearing(): number;
1779
+ getCenter(): {
1780
+ lat: number;
1781
+ lng: number;
1782
+ };
1783
+ getLayer(id: string): unknown;
1784
+ getLayoutProperty?(layer: string, name: string): unknown;
1785
+ getPitch(): number;
1786
+ getSource(id: string): unknown;
1787
+ getStyle(): unknown;
1788
+ getZoom(): number;
1789
+ isStyleLoaded(): boolean | void;
1790
+ off(event: string, listener: () => void): unknown;
1791
+ on(event: string, listener: () => void): unknown;
1792
+ removeLayer(id: string): unknown;
1793
+ setLayoutProperty?(layer: string, name: string, value: unknown): unknown;
1794
+ triggerRepaint(): unknown;
1795
+ };
1796
+ /** Where the trees read the sun and the map's design: a Tileflow theme controller. */
1797
+ type TileflowTrees3DThemes = {
1798
+ getSun?(): TileflowSun;
1799
+ getThemeMetadata?(key: string): Readonly<{
1800
+ values: readonly unknown[];
1801
+ position: number;
1802
+ }>;
1803
+ };
1804
+ type TileflowTrees3DOptions = Readonly<{
1805
+ map: TileflowTrees3DMap;
1806
+ /** The theme controller, for the sun and the trees' colours in every theme. */
1807
+ controller?: TileflowTrees3DThemes;
1808
+ /** The vector source with the canopy points, when not the map's World source. */
1809
+ canopySource?: string;
1810
+ /** The zoom from which trees stand; they fade in over the zoom above it. Defaults to 15. */
1811
+ minzoom?: number;
1812
+ /** The most tiles of trees round the camera, from 1 to 64; defaults to 25. */
1813
+ maxTiles?: number;
1814
+ /** The layer to draw before; defaults to the style's `above-buildings` placement. */
1815
+ beforeId?: string;
1816
+ /** The map's request rules, for the tiles the layer reads. */
1817
+ transformRequest?: TileflowTileRequestTransform;
1818
+ /** Let a vegetation controller own flat-layer visibility. Defaults to true. */
1819
+ manageFlatLayers?: boolean;
1820
+ }>;
1821
+ type TileflowTrees3DChange = Readonly<{
1822
+ transition?: Readonly<{
1823
+ duration?: number;
1824
+ }>;
1825
+ }>;
1826
+ type TileflowTrees3D = {
1827
+ /** Read-only snapshots of the meshes used by the active vegetation palette. */
1828
+ inspectModels(): TileflowModelInspection[];
1829
+ /** Grows the trees out of the ground; resolves once they stand. */
1830
+ show(options?: TileflowTrees3DChange): Promise<void>;
1831
+ /** Sinks the trees back into the ground; resolves once they are gone. */
1832
+ hide(options?: TileflowTrees3DChange): Promise<void>;
1833
+ /** Eases the trees to `scale` of their size, from 0 (none) to 1. */
1834
+ grow(scale: number, options?: TileflowTrees3DChange): Promise<void>;
1835
+ /** The size scale shown now. */
1836
+ readonly scale: number;
1837
+ /**
1838
+ * Whether the map's style describes 3D trees (`vegetation({mode: '3d'})`), tiles of trees,
1839
+ * trees placed (mapped and from canopy points) and trees drawn in the last frame.
1840
+ */
1841
+ readonly stats: Readonly<{
1842
+ declared: boolean;
1843
+ tiles: number;
1844
+ trees: number;
1845
+ mapped: number;
1846
+ canopy: number;
1847
+ drawn: number;
1848
+ }>;
1849
+ /** Takes the layer off the map and lets go of its buffers. */
1850
+ dispose(): void;
1851
+ };
1852
+ declare const tileflowTrees3DLayerId = "tileflow-trees-3d";
1853
+ /**
1854
+ * Creates the trees and puts their layer on the map, sunk in the ground until `show()`. They read
1855
+ * the source's z15 tiles round the camera, where World carries its trees and canopy points.
1856
+ */
1857
+ declare function createTileflowTrees3D(options: TileflowTrees3DOptions): TileflowTrees3D;
1858
+
1859
+ /** Bytes per lamp; see `placeTileflowStreetLights` for the layout. */
1860
+ declare const tileflowStreetLightBytes = 12;
1861
+ /**
1862
+ * Where light is estimated where the data maps no lamps: `lit` (the default) along the streets and
1863
+ * pavements the data maps as lit; `streets` also along the streets the data says nothing about,
1864
+ * wherever it maps few lamps, which invents light as night windows do; `none` nowhere, so only
1865
+ * mapped lamps shine.
1866
+ */
1867
+ type TileflowStreetLightEstimate = 'streets' | 'lit' | 'none';
1868
+ type TileflowStreetLightPlacementOptions = Readonly<{
1869
+ /** The tile's width in metres. */
1870
+ tileMetres: number;
1871
+ /** Defaults to `lit`. */
1872
+ estimate?: TileflowStreetLightEstimate;
1873
+ }>;
1874
+ /** A tile's layers the lamps come from, as World names them. */
1875
+ type TileflowStreetLightLayers = Readonly<{
1876
+ /** Points with `subclass` `street_lamp` (World's `street_furniture`). */
1877
+ streetFurniture?: TileflowTileLayer;
1878
+ /** Streets by `class`, with `lit` where mapped (World's `transportation`). */
1879
+ transportation?: TileflowTileLayer;
1880
+ /** Pavements, as lines or areas, with `lit` where mapped (World's `sidewalk`). */
1881
+ sidewalks?: TileflowTileLayer;
1882
+ }>;
1883
+ /** One tile's lamps, ready to upload. */
1884
+ type TileflowStreetLightPlacement = Readonly<{
1885
+ lamps: Uint8Array;
1886
+ /** Lamps from the data. */
1887
+ mapped: number;
1888
+ /** Points of soft light estimated along streets. */
1889
+ estimated: number;
1890
+ }>;
1891
+ /**
1892
+ * Places one tile's lamps and estimated light, or returns undefined when it has none. Each is a
1893
+ * point of light, flagged as mapped or estimated. Layout: 0 position in the
1894
+ * tile, 0 to 8192 (uint16 ×2); 4 height in decimetres (uint16); 6 the reach of its light on the
1895
+ * ground in metres (uint8); 7 flags (uint8: bit 0 mapped, bit 1 its own colour); 8 its colour
1896
+ * (uint8 ×3, sRGB); 11 a seed (uint8, normalised).
1897
+ */
1898
+ declare function placeTileflowStreetLights(layers: TileflowStreetLightLayers, options: TileflowStreetLightPlacementOptions): TileflowStreetLightPlacement | undefined;
1899
+ /** The style metadata key under which a compiled map describes its street lights. */
1900
+ declare const tileflowStreetLightsMetadataKey = "tileflow:street-lights";
1901
+ /** A compiled map's street lights, as the roads module describes them, resolved for one theme. */
1902
+ type TileflowStreetLightsDesign = Readonly<{
1903
+ /** The vector source and its layers with the lamps, the streets and the pavements. */
1904
+ source: string;
1905
+ layers: Readonly<{
1906
+ streetFurniture: string;
1907
+ transportation: string;
1908
+ sidewalk?: string;
1909
+ }>;
1910
+ estimate: TileflowStreetLightEstimate;
1911
+ /** The light of lamps whose data gives no colour, as a CSS colour. */
1912
+ color: string;
1913
+ /** How bright the lights shine, from 0 to 2. */
1914
+ intensity: number;
1915
+ }>;
1916
+ /**
1917
+ * Reads the street lights a compiled style describes, or undefined when its metadata has none or a
1918
+ * version or shape this Core does not know.
1919
+ */
1920
+ declare function readTileflowStreetLights(metadata: unknown): TileflowStreetLightsDesign | undefined;
1921
+
1451
1922
  /** The capabilities `tileflowGroundBeforeId` reads; importing this module never loads a renderer. */
1452
1923
  type TileflowGroundOrderMap = {
1453
1924
  getLayer(id: string): unknown;
@@ -1724,6 +2195,50 @@ declare const tileflowPmtilesProtocol: "tileflow-pmtiles";
1724
2195
  /** Register only Tileflow's managed PMTiles namespace. Third-party `pmtiles://` remains untouched. */
1725
2196
  declare function registerTileflowPmtilesProtocol(registry: TileflowPmtilesProtocolRegistry, options?: TileflowPmtilesProtocolRegistrationOptions): void;
1726
2197
 
2198
+ type TileflowViewMode = '2d' | '3d';
2199
+ type TileflowVegetationRepresentation = 'none' | 'flat' | '3d';
2200
+ declare const tileflowVegetationDisplayMetadataKey = "tileflow:vegetation-display";
2201
+ /** Display policy, separate from the models' design and the camera's pitch. */
2202
+ type TileflowVegetationDisplay = Readonly<{
2203
+ version: 1;
2204
+ mode: TileflowVegetationMode;
2205
+ fallback: 'flat' | 'none';
2206
+ visible: boolean;
2207
+ /** Authored visibility before the compiler applies the static fallback. */
2208
+ flatLayers: readonly Readonly<{
2209
+ id: string;
2210
+ visible: boolean;
2211
+ }>[];
2212
+ }>;
2213
+ declare function readTileflowVegetationDisplay(metadata: unknown): TileflowVegetationDisplay | undefined;
2214
+ declare function resolveTileflowVegetationRepresentation(policy: TileflowVegetationDisplay | undefined, options: {
2215
+ visible?: boolean | undefined;
2216
+ viewMode?: TileflowViewMode;
2217
+ supports3D: boolean;
2218
+ }): TileflowVegetationRepresentation;
2219
+
2220
+ type TileflowVegetationOptions = Omit<TileflowTrees3DOptions, 'manageFlatLayers' | 'map'> & {
2221
+ map: TileflowTrees3DOptions['map'] & {
2222
+ getCanvas?(): HTMLCanvasElement;
2223
+ };
2224
+ /** Overrides the map's visibility. Undefined restores the authored default. */
2225
+ visible?: boolean | undefined;
2226
+ /** Explicit application view mode, independent of pitch and building visibility. Defaults to 2d. */
2227
+ viewMode?: TileflowViewMode;
2228
+ };
2229
+ type TileflowVegetationController = {
2230
+ inspectModels: TileflowTrees3D['inspectModels'];
2231
+ setVisible(visible: boolean | undefined): void;
2232
+ setViewMode(mode: TileflowViewMode): void;
2233
+ /** Reapplies the policy after application layer controls change. */
2234
+ refresh(): void;
2235
+ readonly representation: TileflowVegetationRepresentation;
2236
+ readonly stats: TileflowTrees3D['stats'] | undefined;
2237
+ dispose(): void;
2238
+ };
2239
+ /** Mount once per map. OFF hides every representation; mode selects how enabled trees are drawn. */
2240
+ declare function createTileflowVegetation(options: TileflowVegetationOptions): TileflowVegetationController;
2241
+
1727
2242
  type TileflowMapReadinessState = 'error' | 'idle' | 'loading';
1728
2243
  /** Read the browser preference without persisting or mutating user state. */
1729
2244
  declare function getTileflowSystemColorScheme(): TileflowRuntimeColorScheme;
@@ -1834,6 +2349,16 @@ type TileflowThemeController = {
1834
2349
  getRouteInks(): TileflowRouteInks;
1835
2350
  /** The value a style state was set to last, or undefined when it has not been set. */
1836
2351
  getState(name: string): TileflowStyleStateValue | undefined;
2352
+ /**
2353
+ * What the compiled styles on screen hold under a metadata key, for an application's own layers
2354
+ * drawn in the map's design (Core's 3D trees read their colours this way): one value outside a
2355
+ * blend, and during a blend one per blended theme, in order, with the blend's position, so a layer
2356
+ * can mix them as the map does. A style without the key gives undefined in its place.
2357
+ */
2358
+ getThemeMetadata(key: string): Readonly<{
2359
+ values: readonly unknown[];
2360
+ position: number;
2361
+ }>;
1837
2362
  /**
1838
2363
  * The sun the map shows, for an application's own 3D layers: its direction, the light it and
1839
2364
  * the sky give, and how dark its shadows fall. It is the theme's sun (`lighting.sun`), mixed
@@ -1951,4 +2476,4 @@ declare function createTileflowTransformRequest<TRequest extends TileflowTransfo
1951
2476
  worldRequestBridge?: TileflowWorldRequestBridge;
1952
2477
  }): TileflowTransformRequest<TRequest, TResourceType>;
1953
2478
 
1954
- export { type TileflowAtmosphereMap, type TileflowBrowserThemeBlendSelection, type TileflowBuildingMesh, type TileflowBuildingMeshOptions, type TileflowBuildings3D, type TileflowBuildings3DChange, type TileflowBuildings3DMap, type TileflowBuildings3DOptions, type TileflowBuildings3DThemes, 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 TileflowFrameScheduler, type TileflowGroundLayer, type TileflowGroundLayers, type TileflowGroundLayersMap, type TileflowGroundLayersOptions, type TileflowGroundOrderMap, type TileflowLineProgressAnimation, type TileflowLineProgressController, type TileflowLineProgressGradientOptions, type TileflowLineProgressLayer, type TileflowLineProgressMap, type TileflowLineProgressOptions, type TileflowLineProgressShown, type TileflowLineProgressState, type TileflowMapLifecycleAttachment, type TileflowMapLifecycleEvent, type TileflowMapLifecycleSubscriber, type TileflowMapReadinessState, 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 TileflowStreetLightEstimate, type TileflowStreetLightLayers, type TileflowStreetLightPlacement, type TileflowStreetLightPlacementOptions, type TileflowStreetLights, type TileflowStreetLightsMap, type TileflowStreetLightsOptions, type TileflowStyleFontLoadOptions, type TileflowStyleStateValue, type TileflowStyleSwitchMap, type TileflowSun, type TileflowSunPreset, type TileflowSunRequest, type TileflowThemeBlendRequest, type TileflowThemeBlendState, type TileflowThemeChangeOptions, type TileflowThemeController, type TileflowThemeTransition, type TileflowThemeTransitionOptions, type TileflowThemeTransitionPhase, type TileflowThemeTransitionResult, type TileflowTile, type TileflowTileAddress, type TileflowTileAreaRequest, type TileflowTileFeature, type TileflowTileGeometryType, type TileflowTileLayer, type TileflowTileReader, type TileflowTileReaderOptions, type TileflowTileRequestTransform, type TileflowTileSourceMap, type TileflowTransformRequest, type TileflowTransformRequestParameters, type TileflowUserTransformRequest, type TileflowVectorTileDecodeOptions, type TileflowWorldProtocolHandler, type TileflowWorldProtocolRequest, type TileflowWorldProtocolResponse, type TileflowWorldRequestBridge, attachTileflowAtmosphere, attachTileflowFairUseNotice, attachTileflowMapLifecycle, createTileflowBuildings3D, createTileflowDepthMarkers, createTileflowGroundLayers, createTileflowLineProgress, createTileflowSessionStarter, createTileflowStreetLights, createTileflowThemeController, createTileflowTileReader, createTileflowTransformRequest, decodeTileflowVectorTile, getTileflowSystemColorScheme, loadTileflowStyleFonts, meshTileflowBuildings, mixTileflowRouteInks, mixTileflowSunPresets, placeTileflowStreetLights, playTileflowShot, readTileflowMapTileSource, readTileflowRouteInks, readTileflowSunPreset, registerTileflowContourProtocol, registerTileflowPmtilesProtocol, registerTileflowWorldRequestBridge, resolveTileflowSun, subscribeTileflowSystemColorScheme, tileflowBuildingExtent, tileflowBuildingVertexBytes, tileflowBuildings3DLayerId, tileflowDefaultRouteInks, tileflowDefaultSunPreset, tileflowDepthMarkerPlacement, tileflowFairUseNoticeMessage, tileflowGroundBeforeId, tileflowLayerDomainMetadataKey, tileflowLineProgressGradient, tileflowMaplibreContourVersion, tileflowPmtilesMaximumDirectoryDepth, tileflowPmtilesProtocol, tileflowRouteMetadataKey, tileflowShotStateAt, tileflowStreetLightBytes, tileflowStreetLightsLayerId, tileflowStyleRouteInks, tileflowStyleSunPreset, tileflowSunDirection, tileflowSunLightMatrix, tileflowSunMetadataKey, tileflowSunPosition, tileflowTilePointToLngLat, tileflowTilesForBounds, validateTileflowBrowserThemeBlendSelection, validateTileflowEmphasis };
2479
+ export { type TileflowAtmosphereMap, type TileflowBrowserThemeBlendSelection, type TileflowBuildingMesh, type TileflowBuildingMeshOptions, type TileflowBuildingModelPlacement, type TileflowBuildings3D, type TileflowBuildings3DChange, type TileflowBuildings3DDesign, type TileflowBuildings3DMap, type TileflowBuildings3DOptions, type TileflowBuildings3DThemes, 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 TileflowFrameScheduler, type TileflowGroundLayer, type TileflowGroundLayers, type TileflowGroundLayersMap, type TileflowGroundLayersOptions, type TileflowGroundOrderMap, type TileflowLineProgressAnimation, type TileflowLineProgressController, type TileflowLineProgressGradientOptions, type TileflowLineProgressLayer, type TileflowLineProgressMap, type TileflowLineProgressOptions, type TileflowLineProgressShown, type TileflowLineProgressState, type TileflowMapLifecycleAttachment, type TileflowMapLifecycleEvent, type TileflowMapLifecycleSubscriber, type TileflowMapReadinessState, 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 TileflowStreetLightEstimate, type TileflowStreetLightLayers, type TileflowStreetLightPlacement, type TileflowStreetLightPlacementOptions, type TileflowStreetLights, type TileflowStreetLightsDesign, type TileflowStreetLightsMap, type TileflowStreetLightsOptions, type TileflowStyleFontLoadOptions, type TileflowStyleStateValue, type TileflowStyleSwitchMap, type TileflowSun, type TileflowSunPreset, type TileflowSunRequest, type TileflowThemeBlendRequest, type TileflowThemeBlendState, type TileflowThemeChangeOptions, type TileflowThemeController, type TileflowThemeTransition, type TileflowThemeTransitionOptions, type TileflowThemeTransitionPhase, type TileflowThemeTransitionResult, type TileflowTile, type TileflowTileAddress, type TileflowTileAreaRequest, type TileflowTileFeature, type TileflowTileGeometryType, type TileflowTileLayer, type TileflowTileReader, type TileflowTileReaderOptions, type TileflowTileRequestTransform, type TileflowTileSourceMap, type TileflowTransformRequest, type TileflowTransformRequestParameters, type TileflowTreeFields, type TileflowTreeForm, type TileflowTreeFormMix, type TileflowTreeFormRange, type TileflowTreeLayers, type TileflowTreePlacement, type TileflowTreePlacementOptions, type TileflowTreeRange, type TileflowTreeRegion, type TileflowTrees3D, type TileflowTrees3DChange, type TileflowTrees3DMap, type TileflowTrees3DOptions, type TileflowTrees3DThemes, type TileflowUserTransformRequest, type TileflowVectorTileDecodeOptions, type TileflowVegetation3D, type TileflowVegetationController, type TileflowVegetationDisplay, type TileflowVegetationOptions, type TileflowVegetationRepresentation, type TileflowViewMode, type TileflowWorldProtocolHandler, type TileflowWorldProtocolRequest, type TileflowWorldProtocolResponse, type TileflowWorldRequestBridge, attachTileflowAtmosphere, attachTileflowFairUseNotice, attachTileflowMapLifecycle, createTileflowBuildings3D, createTileflowDepthMarkers, createTileflowGroundLayers, createTileflowLineProgress, createTileflowSessionStarter, createTileflowStreetLights, createTileflowThemeController, createTileflowTileReader, createTileflowTransformRequest, createTileflowTrees3D, createTileflowVegetation, decodeTileflowVectorTile, getTileflowSystemColorScheme, loadTileflowStyleFonts, meshTileflowBuildings, mixTileflowRouteInks, mixTileflowSunPresets, placeTileflowStreetLights, placeTileflowTrees, playTileflowShot, readTileflowBuildings3D, readTileflowMapTileSource, readTileflowRouteInks, readTileflowStreetLights, readTileflowSunPreset, readTileflowVegetation3D, readTileflowVegetationDisplay, registerTileflowContourProtocol, registerTileflowPmtilesProtocol, registerTileflowWorldRequestBridge, resolveTileflowSun, resolveTileflowVegetationRepresentation, subscribeTileflowSystemColorScheme, tileflowBuildingExtent, tileflowBuildingModelPlacementLimit, tileflowBuildingVertexBytes, tileflowBuildings3DLayerId, tileflowBuildingsMetadataKey, tileflowDefaultRouteInks, tileflowDefaultSunPreset, tileflowDepthMarkerPlacement, tileflowFairUseNoticeMessage, tileflowGroundBeforeId, tileflowLayerDomainMetadataKey, tileflowLineProgressGradient, tileflowMaplibreContourVersion, tileflowPmtilesMaximumDirectoryDepth, tileflowPmtilesProtocol, tileflowRouteMetadataKey, tileflowShotStateAt, tileflowStreetLightBytes, tileflowStreetLightsLayerId, tileflowStreetLightsMetadataKey, tileflowStyleRouteInks, tileflowStyleSunPreset, tileflowSunDirection, tileflowSunLightMatrix, tileflowSunMetadataKey, tileflowSunPosition, tileflowTilePointToLngLat, tileflowTilesForBounds, tileflowTreeBytes, tileflowTreeFormOf, tileflowTreeForms, tileflowTrees3DLayerId, tileflowVegetationDisplayMetadataKey, tileflowVegetationMetadataKey, validateTileflowBrowserThemeBlendSelection, validateTileflowEmphasis };