@mailwoman/cartographer 9.3.0 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/base/buildings.ts +2 -1
- package/lib/base/composition.ts +37 -8
- package/lib/planetary/index.ts +9 -0
- package/lib/planetary/layers.ts +123 -0
- package/lib/planetary/sources.ts +38 -0
- package/lib/planetary/style.ts +66 -0
- package/lib/styles/fonts.ts +19 -0
- package/lib/styles/index.ts +1 -0
- package/out/base/buildings.d.ts.map +1 -1
- package/out/base/buildings.js +2 -1
- package/out/base/buildings.js.map +1 -1
- package/out/base/composition.d.ts +27 -1
- package/out/base/composition.d.ts.map +1 -1
- package/out/base/composition.js +21 -7
- package/out/base/composition.js.map +1 -1
- package/out/planetary/index.d.ts +9 -0
- package/out/planetary/index.d.ts.map +1 -0
- package/out/planetary/index.js +9 -0
- package/out/planetary/index.js.map +1 -0
- package/out/planetary/layers.d.ts +61 -0
- package/out/planetary/layers.d.ts.map +1 -0
- package/out/planetary/layers.js +96 -0
- package/out/planetary/layers.js.map +1 -0
- package/out/planetary/sources.d.ts +22 -0
- package/out/planetary/sources.d.ts.map +1 -0
- package/out/planetary/sources.js +32 -0
- package/out/planetary/sources.js.map +1 -0
- package/out/planetary/style.d.ts +24 -0
- package/out/planetary/style.d.ts.map +1 -0
- package/out/planetary/style.js +35 -0
- package/out/planetary/style.js.map +1 -0
- package/out/styles/fonts.d.ts +19 -0
- package/out/styles/fonts.d.ts.map +1 -0
- package/out/styles/fonts.js +19 -0
- package/out/styles/fonts.js.map +1 -0
- package/out/styles/index.d.ts +1 -0
- package/out/styles/index.d.ts.map +1 -1
- package/out/styles/index.js +1 -0
- package/out/styles/index.js.map +1 -1
- package/out/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +13 -3
package/lib/base/buildings.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
} from "@maplibre/maplibre-gl-style-spec"
|
|
12
12
|
|
|
13
13
|
import { MailwomanBaseTileSetID } from "#base/theme"
|
|
14
|
+
import { PROTOMAPS_FONT_REGULAR } from "#styles/fonts"
|
|
14
15
|
import { LayerID } from "#styles/layers"
|
|
15
16
|
|
|
16
17
|
const BuildingLayerID = LayerID.bind(null, "buildings")
|
|
@@ -114,7 +115,7 @@ export const BuildingLayers: LayerSpecification[] = [
|
|
|
114
115
|
"text-field": ["to-string", ["id"]],
|
|
115
116
|
"text-offset": [0, 0],
|
|
116
117
|
"text-anchor": "center",
|
|
117
|
-
"text-font": [
|
|
118
|
+
"text-font": [PROTOMAPS_FONT_REGULAR],
|
|
118
119
|
},
|
|
119
120
|
|
|
120
121
|
paint: {
|
package/lib/base/composition.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { SourceSpecification } from "@maplibre/maplibre-gl-style-spec"
|
|
7
|
+
import type { LayerSpecification, SourceSpecification } from "@maplibre/maplibre-gl-style-spec"
|
|
8
8
|
import type { LightSpecification, SkySpecification, StyleSpecification, TerrainSpecification } from "maplibre-gl"
|
|
9
9
|
|
|
10
10
|
import { BaseLayers } from "#base/layers"
|
|
@@ -50,12 +50,38 @@ export function createSkySpec(spec?: Partial<SkySpecification>): SkySpecificatio
|
|
|
50
50
|
|
|
51
51
|
//#region Style Composition
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* The glyph host every style composed here reads fonts from. The Protomaps font set, mirrored under the public bucket
|
|
55
|
+
* so a style never depends on an upstream host at render time.
|
|
56
|
+
*/
|
|
57
|
+
export const PROTOMAPS_GLYPHS_URL = "https://public.mailwoman.ai/protomaps/fonts/{fontstack}/{range}.pbf"
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The Earth sprite. It must match the basemap schema version: the v4 sprite carries the icons the v4 theme's layers
|
|
61
|
+
* reference by name, so a style over a different basemap version needs a different sprite.
|
|
62
|
+
*/
|
|
63
|
+
export const PROTOMAPS_SPRITE_URL = "https://public.mailwoman.ai/protomaps/sprites/v4/light"
|
|
64
|
+
|
|
53
65
|
export interface StyleSpecificationComposition {
|
|
54
66
|
sources: Record<string, SourceSpecification>
|
|
55
67
|
layers?: LayerSpecificationListInput[]
|
|
56
68
|
light?: Partial<LightSpecification>
|
|
57
69
|
sky?: Partial<SkySpecification>
|
|
58
70
|
terrain?: Partial<TerrainSpecification>
|
|
71
|
+
/**
|
|
72
|
+
* The layer list every `layers` entry inserts into. Earth's basemap layers by default; a body with no roads, water or
|
|
73
|
+
* buildings brings its own.
|
|
74
|
+
*/
|
|
75
|
+
baseLayers?: LayerSpecification[]
|
|
76
|
+
/**
|
|
77
|
+
* The `hillshade` source. Earth's terrarium DEM by default; `null` adds no such source.
|
|
78
|
+
*/
|
|
79
|
+
hillshadeSource?: SourceSpecification | null
|
|
80
|
+
/**
|
|
81
|
+
* The sprite URL. Earth's Protomaps v4 sprite by default; `null` omits the key, for a style with no icons.
|
|
82
|
+
*/
|
|
83
|
+
sprite?: string | null
|
|
84
|
+
glyphs?: string
|
|
59
85
|
}
|
|
60
86
|
|
|
61
87
|
/**
|
|
@@ -67,23 +93,29 @@ export class StyleSpecificationComposer {
|
|
|
67
93
|
sky: SkySpecification
|
|
68
94
|
// terrain: TerrainSpecification
|
|
69
95
|
sources: TileSetSourceRecord
|
|
96
|
+
sprite: string | null
|
|
97
|
+
glyphs: string
|
|
70
98
|
|
|
71
99
|
constructor(spec: StyleSpecificationComposition) {
|
|
72
100
|
this.light = createLightSpec(spec.light)
|
|
73
101
|
this.sky = createSkySpec(spec.sky)
|
|
102
|
+
this.sprite = spec.sprite === undefined ? PROTOMAPS_SPRITE_URL : spec.sprite
|
|
103
|
+
this.glyphs = spec.glyphs ?? PROTOMAPS_GLYPHS_URL
|
|
74
104
|
|
|
75
105
|
// this.terrain = {
|
|
76
106
|
// source: TerrainTileSetID,
|
|
77
107
|
// ...spec.terrain,
|
|
78
108
|
// }
|
|
79
109
|
|
|
110
|
+
const hillshadeSource = spec.hillshadeSource === undefined ? createTerrainDEMSource() : spec.hillshadeSource
|
|
111
|
+
|
|
80
112
|
this.sources = {
|
|
81
113
|
...spec.sources,
|
|
82
114
|
// [TerrainTileSetID]: createTerrainDEMSource(),
|
|
83
|
-
[HillshadeTileSetID]:
|
|
115
|
+
...(hillshadeSource ? { [HillshadeTileSetID]: hillshadeSource } : {}),
|
|
84
116
|
}
|
|
85
117
|
|
|
86
|
-
this.layersList = new LayerSpecificationList(BaseLayers)
|
|
118
|
+
this.layersList = new LayerSpecificationList(spec.baseLayers ?? BaseLayers)
|
|
87
119
|
|
|
88
120
|
for (const layer of spec.layers || []) {
|
|
89
121
|
this.layersList.insert(layer)
|
|
@@ -97,11 +129,8 @@ export class StyleSpecificationComposer {
|
|
|
97
129
|
toJSON(): StyleSpecification {
|
|
98
130
|
const styleSpec: StyleSpecification = {
|
|
99
131
|
version: 8,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// sprites/v4}/ for self-hosting, but no public route fronts that bucket yet.
|
|
103
|
-
glyphs: "https://public.mailwoman.ai/protomaps/fonts/{fontstack}/{range}.pbf",
|
|
104
|
-
sprite: "https://public.mailwoman.ai/protomaps/sprites/v4/light",
|
|
132
|
+
glyphs: this.glyphs,
|
|
133
|
+
...(this.sprite === null ? {} : { sprite: this.sprite }),
|
|
105
134
|
light: createLightSpec(this.light),
|
|
106
135
|
sky: createSkySpec(this.sky),
|
|
107
136
|
// terrain: this.terrain,
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software.
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
BackgroundLayerSpecification,
|
|
9
|
+
CircleLayerSpecification,
|
|
10
|
+
RasterLayerSpecification,
|
|
11
|
+
SymbolLayerSpecification,
|
|
12
|
+
} from "@maplibre/maplibre-gl-style-spec"
|
|
13
|
+
|
|
14
|
+
import { PlanetaryHillshadeSourceID, PlanetaryNomenclatureSourceID } from "#planetary/sources"
|
|
15
|
+
import { PROTOMAPS_FONT_REGULAR } from "#styles/fonts"
|
|
16
|
+
import { LayerID } from "#styles/layers"
|
|
17
|
+
|
|
18
|
+
export interface PlanetaryPalette {
|
|
19
|
+
space: string
|
|
20
|
+
labelColor: string
|
|
21
|
+
labelHalo: string
|
|
22
|
+
selection: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* One palette per body with a published style. The record's keys are the bodies a style can be composed for, so a body
|
|
27
|
+
* without a row here has no style rather than a wrong one.
|
|
28
|
+
*/
|
|
29
|
+
export const PALETTES = {
|
|
30
|
+
moon: { space: "#05070d", labelColor: "#e8eef7", labelHalo: "#05070d", selection: "#7fd1ff" },
|
|
31
|
+
mars: { space: "#0a0604", labelColor: "#f6e3d1", labelHalo: "#1a0c06", selection: "#ffb37f" },
|
|
32
|
+
} as const satisfies Record<string, PlanetaryPalette>
|
|
33
|
+
|
|
34
|
+
export type PlanetaryStyleBody = keyof typeof PALETTES
|
|
35
|
+
|
|
36
|
+
const PLANETARY_NAMESPACE = "planetary"
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The background layer: the body's space color, drawn first.
|
|
40
|
+
*/
|
|
41
|
+
export const PlanetarySpaceLayerID = LayerID(PLANETARY_NAMESPACE, "space")
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The hillshade raster layer, present only when the body has a hillshade tileset.
|
|
45
|
+
*/
|
|
46
|
+
export const PlanetaryHillshadeLayerID = LayerID(PLANETARY_NAMESPACE, "hillshade")
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The nomenclature label layer, the one an app reads feature properties from on a click.
|
|
50
|
+
*/
|
|
51
|
+
export const PlanetaryLabelsLayerID = LayerID(PLANETARY_NAMESPACE, "nomenclature-labels")
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The selection ring layer, the one an app sets a feature `id` filter on.
|
|
55
|
+
*/
|
|
56
|
+
export const PlanetarySelectionLayerID = LayerID(PLANETARY_NAMESPACE, "selection")
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The IAU feature-type codes drawn as spaced capitals: a mare, planitia, oceanus or terra spans a region rather than
|
|
60
|
+
* marking a point, and the wide setting reads as an area name the way a printed atlas sets one.
|
|
61
|
+
*/
|
|
62
|
+
const REGION_FEATURE_TYPE_CODES = ["ME", "PL", "OC", "TA"]
|
|
63
|
+
|
|
64
|
+
export function spaceLayer(palette: PlanetaryPalette): BackgroundLayerSpecification {
|
|
65
|
+
return {
|
|
66
|
+
id: PlanetarySpaceLayerID,
|
|
67
|
+
type: "background",
|
|
68
|
+
paint: { "background-color": palette.space },
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function hillshadeLayer(): RasterLayerSpecification {
|
|
73
|
+
return {
|
|
74
|
+
id: PlanetaryHillshadeLayerID,
|
|
75
|
+
type: "raster",
|
|
76
|
+
source: PlanetaryHillshadeSourceID,
|
|
77
|
+
paint: { "raster-opacity": 0.9, "raster-resampling": "linear" },
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Labels by feature scale: the tile's per-feature `minzoom` already hides a small crater at a low zoom, so the symbol
|
|
83
|
+
* layer only sizes and prioritizes. `featureTypeCode` is the IAU feature-type code carried in the tile properties (AA
|
|
84
|
+
* crater, MO mons, VA vallis, ME mare, PL planitia, SF satellite feature); `diameterKm` is the feature's diameter.
|
|
85
|
+
*/
|
|
86
|
+
export function labelLayer(palette: PlanetaryPalette): SymbolLayerSpecification {
|
|
87
|
+
return {
|
|
88
|
+
id: PlanetaryLabelsLayerID,
|
|
89
|
+
type: "symbol",
|
|
90
|
+
source: PlanetaryNomenclatureSourceID,
|
|
91
|
+
"source-layer": "nomenclature",
|
|
92
|
+
layout: {
|
|
93
|
+
"text-field": ["get", "name"],
|
|
94
|
+
"text-font": [PROTOMAPS_FONT_REGULAR],
|
|
95
|
+
"text-size": ["interpolate", ["linear"], ["coalesce", ["get", "diameterKm"], 0], 0, 11, 100, 14, 1000, 18],
|
|
96
|
+
"text-transform": ["match", ["get", "featureTypeCode"], REGION_FEATURE_TYPE_CODES, "uppercase", "none"],
|
|
97
|
+
"text-letter-spacing": ["match", ["get", "featureTypeCode"], REGION_FEATURE_TYPE_CODES, 0.15, 0.02],
|
|
98
|
+
"symbol-sort-key": ["-", 0, ["coalesce", ["get", "diameterKm"], 0]],
|
|
99
|
+
"text-allow-overlap": false,
|
|
100
|
+
},
|
|
101
|
+
paint: { "text-color": palette.labelColor, "text-halo-color": palette.labelHalo, "text-halo-width": 1.2 },
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The selection ring. Its filter matches no feature until the app sets one by `id`, so the layer ships in the style and
|
|
107
|
+
* the app never inserts a layer at runtime.
|
|
108
|
+
*/
|
|
109
|
+
export function selectionLayer(palette: PlanetaryPalette): CircleLayerSpecification {
|
|
110
|
+
return {
|
|
111
|
+
id: PlanetarySelectionLayerID,
|
|
112
|
+
type: "circle",
|
|
113
|
+
source: PlanetaryNomenclatureSourceID,
|
|
114
|
+
"source-layer": "nomenclature",
|
|
115
|
+
filter: ["==", ["get", "id"], ""],
|
|
116
|
+
paint: {
|
|
117
|
+
"circle-radius": 14,
|
|
118
|
+
"circle-color": "transparent",
|
|
119
|
+
"circle-stroke-color": palette.selection,
|
|
120
|
+
"circle-stroke-width": 2,
|
|
121
|
+
},
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software.
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { RasterSourceSpecification, VectorSourceSpecification } from "@maplibre/maplibre-gl-style-spec"
|
|
8
|
+
|
|
9
|
+
import { TileSetSourceID } from "#styles/sources"
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The vector source carrying a body's IAU nomenclature: one `nomenclature` source layer of named features.
|
|
13
|
+
*/
|
|
14
|
+
export const PlanetaryNomenclatureSourceID = TileSetSourceID("nomenclature")
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The raster source carrying a body's hillshade, rendered from its DEM at build time.
|
|
18
|
+
*/
|
|
19
|
+
export const PlanetaryHillshadeSourceID = TileSetSourceID("hillshade")
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* MapLibre resolves a TileJSON `url` itself: tiles, bounds, zoom range and attribution all come from the tile worker's
|
|
23
|
+
* document, so nothing here restates them.
|
|
24
|
+
*/
|
|
25
|
+
export function nomenclatureSource(tileJSONURL: string): VectorSourceSpecification {
|
|
26
|
+
return {
|
|
27
|
+
type: "vector",
|
|
28
|
+
url: tileJSONURL,
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function hillshadeSource(tileJSONURL: string): RasterSourceSpecification {
|
|
33
|
+
return {
|
|
34
|
+
type: "raster",
|
|
35
|
+
url: tileJSONURL,
|
|
36
|
+
tileSize: 256,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software.
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { SourceSpecification, StyleSpecification } from "@maplibre/maplibre-gl-style-spec"
|
|
8
|
+
|
|
9
|
+
import { StyleSpecificationComposer } from "#base/composition"
|
|
10
|
+
import {
|
|
11
|
+
hillshadeLayer,
|
|
12
|
+
labelLayer,
|
|
13
|
+
PALETTES,
|
|
14
|
+
type PlanetaryStyleBody,
|
|
15
|
+
selectionLayer,
|
|
16
|
+
spaceLayer,
|
|
17
|
+
} from "#planetary/layers"
|
|
18
|
+
import {
|
|
19
|
+
hillshadeSource,
|
|
20
|
+
nomenclatureSource,
|
|
21
|
+
PlanetaryHillshadeSourceID,
|
|
22
|
+
PlanetaryNomenclatureSourceID,
|
|
23
|
+
} from "#planetary/sources"
|
|
24
|
+
|
|
25
|
+
export interface PlanetaryStyleOptions {
|
|
26
|
+
body: PlanetaryStyleBody
|
|
27
|
+
/**
|
|
28
|
+
* The TileJSON document of the body's nomenclature tileset.
|
|
29
|
+
*/
|
|
30
|
+
nomenclatureTileJSONURL: string
|
|
31
|
+
/**
|
|
32
|
+
* The TileJSON document of the body's hillshade tileset. Without one the style draws labels over bare space.
|
|
33
|
+
*/
|
|
34
|
+
hillshadeTileJSONURL?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A body's whole style: space, the hillshade when a tileset exists, the nomenclature labels, and the selection ring. No
|
|
39
|
+
* Earth layer, no Earth DEM and no sprite reach the result, so a viewer loads nothing Earth-shaped.
|
|
40
|
+
*/
|
|
41
|
+
export function createPlanetaryStyle(options: PlanetaryStyleOptions): StyleSpecification {
|
|
42
|
+
const palette = PALETTES[options.body]
|
|
43
|
+
|
|
44
|
+
const sources: Record<string, SourceSpecification> = {
|
|
45
|
+
[PlanetaryNomenclatureSourceID]: nomenclatureSource(options.nomenclatureTileJSONURL),
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (options.hillshadeTileJSONURL) {
|
|
49
|
+
sources[PlanetaryHillshadeSourceID] = hillshadeSource(options.hillshadeTileJSONURL)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const baseLayers = [
|
|
53
|
+
spaceLayer(palette),
|
|
54
|
+
...(options.hillshadeTileJSONURL ? [hillshadeLayer()] : []),
|
|
55
|
+
labelLayer(palette),
|
|
56
|
+
selectionLayer(palette),
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
return new StyleSpecificationComposer({
|
|
60
|
+
sources,
|
|
61
|
+
baseLayers,
|
|
62
|
+
hillshadeSource: null,
|
|
63
|
+
sprite: null,
|
|
64
|
+
sky: { "sky-color": palette.space, "horizon-color": palette.space },
|
|
65
|
+
}).toJSON()
|
|
66
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software.
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The glyph stacks a symbol layer may name. MapLibre draws NO text at all when a glyph range answers 404 — not a
|
|
7
|
+
* fallback face, nothing — so a `text-font` naming an absent stack blanks every label in the style at every zoom,
|
|
8
|
+
* with no console error a reader would connect to the missing labels.
|
|
9
|
+
*
|
|
10
|
+
* The mirror behind `PROTOMAPS_GLYPHS_URL` serves five stacks: `Noto Sans Regular`, `Noto Sans Medium`,
|
|
11
|
+
* `Noto Sans Italic`, `Fira Code Regular` and `Fira Code Medium`. It serves no Fira Sans, and no
|
|
12
|
+
* `Open Sans Regular` — which is MapLibre's own default, so a symbol layer that omits `text-font` also draws
|
|
13
|
+
* nothing. Name a constant from this file rather than a string literal.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The regular text stack: body labels, point features, place names.
|
|
18
|
+
*/
|
|
19
|
+
export const PROTOMAPS_FONT_REGULAR = "Noto Sans Regular"
|
package/lib/styles/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildings.d.ts","sourceRoot":"","sources":["../../lib/base/buildings.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAGX,kBAAkB,EAClB,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"buildings.d.ts","sourceRoot":"","sources":["../../lib/base/buildings.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAGX,kBAAkB,EAClB,MAAM,kCAAkC,CAAA;AA4CzC;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,kBAAkB,EAqE9C,CAAA"}
|
package/out/base/buildings.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*/
|
|
6
6
|
import { MailwomanBaseTileSetID } from "#base/theme";
|
|
7
|
+
import { PROTOMAPS_FONT_REGULAR } from "#styles/fonts";
|
|
7
8
|
import { LayerID } from "#styles/layers";
|
|
8
9
|
const BuildingLayerID = LayerID.bind(null, "buildings");
|
|
9
10
|
/**
|
|
@@ -97,7 +98,7 @@ export const BuildingLayers = [
|
|
|
97
98
|
"text-field": ["to-string", ["id"]],
|
|
98
99
|
"text-offset": [0, 0],
|
|
99
100
|
"text-anchor": "center",
|
|
100
|
-
"text-font": [
|
|
101
|
+
"text-font": [PROTOMAPS_FONT_REGULAR],
|
|
101
102
|
},
|
|
102
103
|
paint: {
|
|
103
104
|
"text-color": "black",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildings.js","sourceRoot":"","sources":["../../lib/base/buildings.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;AAEvD;;GAEG;AACH,MAAM,SAAS,GAAG,IAAI,CAAA;AACtB;;GAEG;AACH,MAAM,OAAO,GAAG,EAAE,CAAA;AAClB;;GAEG;AACH,MAAM,QAAQ,GAAG,GAAG,CAAA;AACpB;;GAEG;AACH,MAAM,QAAQ,GAAG,CAAC,CAAA;AAElB,MAAM,cAAc,GAAG,CAAC,MAAM,GAAG,CAAC,EAA2B,EAAE,CAAC;IAC/D,GAAG;IACH,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,QAAQ,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,aAAa;QAChB,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,sBAAsB;QAC9B,cAAc,EAAE,WAAW;QAC3B,OAAO,EAAE,EAAE;QACX,KAAK,EAAE;YACN,GAAG,aAAa,CAAC,KAAK;YACtB,kCAAkC,EAAE,IAAI;YACxC,uBAAuB,EAAE,SAAS,CAAC,cAAc,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;YAC9E,qBAAqB,EAAE,CAAC;YACxB,iCAAiC,EAAE,KAAK;YACxC,wBAAwB,EAAE,IAAI;SAC9B;KACD,CAAA;IAED,OAAO,SAAS,CAAA;AACjB,CAAC"}
|
|
@@ -3,18 +3,42 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*/
|
|
6
|
-
import type { SourceSpecification } from "@maplibre/maplibre-gl-style-spec";
|
|
6
|
+
import type { LayerSpecification, SourceSpecification } from "@maplibre/maplibre-gl-style-spec";
|
|
7
7
|
import type { LightSpecification, SkySpecification, StyleSpecification, TerrainSpecification } from "maplibre-gl";
|
|
8
8
|
import { LayerSpecificationList, type LayerSpecificationListInput, type LayerSpecificationListItem } from "#styles/layers";
|
|
9
9
|
import type { TileSetSourceRecord } from "#styles/sources";
|
|
10
10
|
export declare function createLightSpec(spec?: Partial<LightSpecification>): LightSpecification;
|
|
11
11
|
export declare function createSkySpec(spec?: Partial<SkySpecification>): SkySpecification;
|
|
12
|
+
/**
|
|
13
|
+
* The glyph host every style composed here reads fonts from. The Protomaps font set, mirrored under the public bucket
|
|
14
|
+
* so a style never depends on an upstream host at render time.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PROTOMAPS_GLYPHS_URL = "https://public.mailwoman.ai/protomaps/fonts/{fontstack}/{range}.pbf";
|
|
17
|
+
/**
|
|
18
|
+
* The Earth sprite. It must match the basemap schema version: the v4 sprite carries the icons the v4 theme's layers
|
|
19
|
+
* reference by name, so a style over a different basemap version needs a different sprite.
|
|
20
|
+
*/
|
|
21
|
+
export declare const PROTOMAPS_SPRITE_URL = "https://public.mailwoman.ai/protomaps/sprites/v4/light";
|
|
12
22
|
export interface StyleSpecificationComposition {
|
|
13
23
|
sources: Record<string, SourceSpecification>;
|
|
14
24
|
layers?: LayerSpecificationListInput[];
|
|
15
25
|
light?: Partial<LightSpecification>;
|
|
16
26
|
sky?: Partial<SkySpecification>;
|
|
17
27
|
terrain?: Partial<TerrainSpecification>;
|
|
28
|
+
/**
|
|
29
|
+
* The layer list every `layers` entry inserts into. Earth's basemap layers by default; a body with no roads, water or
|
|
30
|
+
* buildings brings its own.
|
|
31
|
+
*/
|
|
32
|
+
baseLayers?: LayerSpecification[];
|
|
33
|
+
/**
|
|
34
|
+
* The `hillshade` source. Earth's terrarium DEM by default; `null` adds no such source.
|
|
35
|
+
*/
|
|
36
|
+
hillshadeSource?: SourceSpecification | null;
|
|
37
|
+
/**
|
|
38
|
+
* The sprite URL. Earth's Protomaps v4 sprite by default; `null` omits the key, for a style with no icons.
|
|
39
|
+
*/
|
|
40
|
+
sprite?: string | null;
|
|
41
|
+
glyphs?: string;
|
|
18
42
|
}
|
|
19
43
|
/**
|
|
20
44
|
* A stateful class for composing a style specification.
|
|
@@ -24,6 +48,8 @@ export declare class StyleSpecificationComposer {
|
|
|
24
48
|
light: LightSpecification;
|
|
25
49
|
sky: SkySpecification;
|
|
26
50
|
sources: TileSetSourceRecord;
|
|
51
|
+
sprite: string | null;
|
|
52
|
+
glyphs: string;
|
|
27
53
|
constructor(spec: StyleSpecificationComposition);
|
|
28
54
|
get layers(): LayerSpecificationListItem[];
|
|
29
55
|
toJSON(): StyleSpecification;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../../lib/base/composition.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"composition.d.ts","source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Aa,0BAA0B;IACtC,UAAU,EAAE,sBAAsB,CAAA;IAClC,KAAK,EAAE,kBAAkB,CAAA;IACzB,GAAG,EAAE,gBAAgB,CAAA;IAErB,OAAO,EAAE,mBAAmB,CAAA;IAC5B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;gBAEF,IAAI,EAAE,6BAA6B;IA0B/C,IAAW,MAAM,IAAI,0BAA0B,EAAE,CAEhD;IAED,MAAM,IAAI,kBAAkB;IAe5B,IAAI,IAAI,kBAAkB;CAG1B"}
|
package/out/base/composition.js
CHANGED
|
@@ -32,6 +32,18 @@ export function createSkySpec(spec) {
|
|
|
32
32
|
...spec,
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region Style Composition
|
|
37
|
+
/**
|
|
38
|
+
* The glyph host every style composed here reads fonts from. The Protomaps font set, mirrored under the public bucket
|
|
39
|
+
* so a style never depends on an upstream host at render time.
|
|
40
|
+
*/
|
|
41
|
+
export const PROTOMAPS_GLYPHS_URL = "https://public.mailwoman.ai/protomaps/fonts/{fontstack}/{range}.pbf";
|
|
42
|
+
/**
|
|
43
|
+
* The Earth sprite. It must match the basemap schema version: the v4 sprite carries the icons the v4 theme's layers
|
|
44
|
+
* reference by name, so a style over a different basemap version needs a different sprite.
|
|
45
|
+
*/
|
|
46
|
+
export const PROTOMAPS_SPRITE_URL = "https://public.mailwoman.ai/protomaps/sprites/v4/light";
|
|
35
47
|
/**
|
|
36
48
|
* A stateful class for composing a style specification.
|
|
37
49
|
*/
|
|
@@ -41,19 +53,24 @@ export class StyleSpecificationComposer {
|
|
|
41
53
|
sky;
|
|
42
54
|
// terrain: TerrainSpecification
|
|
43
55
|
sources;
|
|
56
|
+
sprite;
|
|
57
|
+
glyphs;
|
|
44
58
|
constructor(spec) {
|
|
45
59
|
this.light = createLightSpec(spec.light);
|
|
46
60
|
this.sky = createSkySpec(spec.sky);
|
|
61
|
+
this.sprite = spec.sprite === undefined ? PROTOMAPS_SPRITE_URL : spec.sprite;
|
|
62
|
+
this.glyphs = spec.glyphs ?? PROTOMAPS_GLYPHS_URL;
|
|
47
63
|
// this.terrain = {
|
|
48
64
|
// source: TerrainTileSetID,
|
|
49
65
|
// ...spec.terrain,
|
|
50
66
|
// }
|
|
67
|
+
const hillshadeSource = spec.hillshadeSource === undefined ? createTerrainDEMSource() : spec.hillshadeSource;
|
|
51
68
|
this.sources = {
|
|
52
69
|
...spec.sources,
|
|
53
70
|
// [TerrainTileSetID]: createTerrainDEMSource(),
|
|
54
|
-
[HillshadeTileSetID]:
|
|
71
|
+
...(hillshadeSource ? { [HillshadeTileSetID]: hillshadeSource } : {}),
|
|
55
72
|
};
|
|
56
|
-
this.layersList = new LayerSpecificationList(BaseLayers);
|
|
73
|
+
this.layersList = new LayerSpecificationList(spec.baseLayers ?? BaseLayers);
|
|
57
74
|
for (const layer of spec.layers || []) {
|
|
58
75
|
this.layersList.insert(layer);
|
|
59
76
|
}
|
|
@@ -64,11 +81,8 @@ export class StyleSpecificationComposer {
|
|
|
64
81
|
toJSON() {
|
|
65
82
|
const styleSpec = {
|
|
66
83
|
version: 8,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
// sprites/v4}/ for self-hosting, but no public route fronts that bucket yet.
|
|
70
|
-
glyphs: "https://public.mailwoman.ai/protomaps/fonts/{fontstack}/{range}.pbf",
|
|
71
|
-
sprite: "https://public.mailwoman.ai/protomaps/sprites/v4/light",
|
|
84
|
+
glyphs: this.glyphs,
|
|
85
|
+
...(this.sprite === null ? {} : { sprite: this.sprite }),
|
|
72
86
|
light: createLightSpec(this.light),
|
|
73
87
|
sky: createSkySpec(this.sky),
|
|
74
88
|
// terrain: this.terrain,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition.js","sourceRoot":"","sources":["../../lib/base/composition.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM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js","sourceRoot":"","sources":["../../lib/planetary/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software.
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
import type { BackgroundLayerSpecification, CircleLayerSpecification, RasterLayerSpecification, SymbolLayerSpecification } from "@maplibre/maplibre-gl-style-spec";
|
|
7
|
+
export interface PlanetaryPalette {
|
|
8
|
+
space: string;
|
|
9
|
+
labelColor: string;
|
|
10
|
+
labelHalo: string;
|
|
11
|
+
selection: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* One palette per body with a published style. The record's keys are the bodies a style can be composed for, so a body
|
|
15
|
+
* without a row here has no style rather than a wrong one.
|
|
16
|
+
*/
|
|
17
|
+
export declare const PALETTES: {
|
|
18
|
+
readonly moon: {
|
|
19
|
+
readonly space: "#05070d";
|
|
20
|
+
readonly labelColor: "#e8eef7";
|
|
21
|
+
readonly labelHalo: "#05070d";
|
|
22
|
+
readonly selection: "#7fd1ff";
|
|
23
|
+
};
|
|
24
|
+
readonly mars: {
|
|
25
|
+
readonly space: "#0a0604";
|
|
26
|
+
readonly labelColor: "#f6e3d1";
|
|
27
|
+
readonly labelHalo: "#1a0c06";
|
|
28
|
+
readonly selection: "#ffb37f";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export type PlanetaryStyleBody = keyof typeof PALETTES;
|
|
32
|
+
/**
|
|
33
|
+
* The background layer: the body's space color, drawn first.
|
|
34
|
+
*/
|
|
35
|
+
export declare const PlanetarySpaceLayerID: "planetary/space";
|
|
36
|
+
/**
|
|
37
|
+
* The hillshade raster layer, present only when the body has a hillshade tileset.
|
|
38
|
+
*/
|
|
39
|
+
export declare const PlanetaryHillshadeLayerID: "planetary/hillshade";
|
|
40
|
+
/**
|
|
41
|
+
* The nomenclature label layer, the one an app reads feature properties from on a click.
|
|
42
|
+
*/
|
|
43
|
+
export declare const PlanetaryLabelsLayerID: "planetary/nomenclature-labels";
|
|
44
|
+
/**
|
|
45
|
+
* The selection ring layer, the one an app sets a feature `id` filter on.
|
|
46
|
+
*/
|
|
47
|
+
export declare const PlanetarySelectionLayerID: "planetary/selection";
|
|
48
|
+
export declare function spaceLayer(palette: PlanetaryPalette): BackgroundLayerSpecification;
|
|
49
|
+
export declare function hillshadeLayer(): RasterLayerSpecification;
|
|
50
|
+
/**
|
|
51
|
+
* Labels by feature scale: the tile's per-feature `minzoom` already hides a small crater at a low zoom, so the symbol
|
|
52
|
+
* layer only sizes and prioritizes. `featureTypeCode` is the IAU feature-type code carried in the tile properties (AA
|
|
53
|
+
* crater, MO mons, VA vallis, ME mare, PL planitia, SF satellite feature); `diameterKm` is the feature's diameter.
|
|
54
|
+
*/
|
|
55
|
+
export declare function labelLayer(palette: PlanetaryPalette): SymbolLayerSpecification;
|
|
56
|
+
/**
|
|
57
|
+
* The selection ring. Its filter matches no feature until the app sets one by `id`, so the layer ships in the style and
|
|
58
|
+
* the app never inserts a layer at runtime.
|
|
59
|
+
*/
|
|
60
|
+
export declare function selectionLayer(palette: PlanetaryPalette): CircleLayerSpecification;
|
|
61
|
+
//# sourceMappingURL=layers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layers.d.ts","sourceRoot":"","sources":["../../lib/planetary/layers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACX,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,MAAM,kCAAkC,CAAA;AAMzC,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CACjB;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;CAGgC,CAAA;AAErD,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,QAAQ,CAAA;AAItD;;GAEG;AACH,eAAO,MAAM,qBAAqB,mBAAwC,CAAA;AAE1E;;GAEG;AACH,eAAO,MAAM,yBAAyB,uBAA4C,CAAA;AAElF;;GAEG;AACH,eAAO,MAAM,sBAAsB,iCAAsD,CAAA;AAEzF;;GAEG;AACH,eAAO,MAAM,yBAAyB,uBAA4C,CAAA;AAQlF,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,4BAA4B,CAMlF;AAED,wBAAgB,cAAc,IAAI,wBAAwB,CAOzD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,wBAAwB,CAiB9E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,wBAAwB,CAclF"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software.
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
import { PlanetaryHillshadeSourceID, PlanetaryNomenclatureSourceID } from "#planetary/sources";
|
|
7
|
+
import { PROTOMAPS_FONT_REGULAR } from "#styles/fonts";
|
|
8
|
+
import { LayerID } from "#styles/layers";
|
|
9
|
+
/**
|
|
10
|
+
* One palette per body with a published style. The record's keys are the bodies a style can be composed for, so a body
|
|
11
|
+
* without a row here has no style rather than a wrong one.
|
|
12
|
+
*/
|
|
13
|
+
export const PALETTES = {
|
|
14
|
+
moon: { space: "#05070d", labelColor: "#e8eef7", labelHalo: "#05070d", selection: "#7fd1ff" },
|
|
15
|
+
mars: { space: "#0a0604", labelColor: "#f6e3d1", labelHalo: "#1a0c06", selection: "#ffb37f" },
|
|
16
|
+
};
|
|
17
|
+
const PLANETARY_NAMESPACE = "planetary";
|
|
18
|
+
/**
|
|
19
|
+
* The background layer: the body's space color, drawn first.
|
|
20
|
+
*/
|
|
21
|
+
export const PlanetarySpaceLayerID = LayerID(PLANETARY_NAMESPACE, "space");
|
|
22
|
+
/**
|
|
23
|
+
* The hillshade raster layer, present only when the body has a hillshade tileset.
|
|
24
|
+
*/
|
|
25
|
+
export const PlanetaryHillshadeLayerID = LayerID(PLANETARY_NAMESPACE, "hillshade");
|
|
26
|
+
/**
|
|
27
|
+
* The nomenclature label layer, the one an app reads feature properties from on a click.
|
|
28
|
+
*/
|
|
29
|
+
export const PlanetaryLabelsLayerID = LayerID(PLANETARY_NAMESPACE, "nomenclature-labels");
|
|
30
|
+
/**
|
|
31
|
+
* The selection ring layer, the one an app sets a feature `id` filter on.
|
|
32
|
+
*/
|
|
33
|
+
export const PlanetarySelectionLayerID = LayerID(PLANETARY_NAMESPACE, "selection");
|
|
34
|
+
/**
|
|
35
|
+
* The IAU feature-type codes drawn as spaced capitals: a mare, planitia, oceanus or terra spans a region rather than
|
|
36
|
+
* marking a point, and the wide setting reads as an area name the way a printed atlas sets one.
|
|
37
|
+
*/
|
|
38
|
+
const REGION_FEATURE_TYPE_CODES = ["ME", "PL", "OC", "TA"];
|
|
39
|
+
export function spaceLayer(palette) {
|
|
40
|
+
return {
|
|
41
|
+
id: PlanetarySpaceLayerID,
|
|
42
|
+
type: "background",
|
|
43
|
+
paint: { "background-color": palette.space },
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export function hillshadeLayer() {
|
|
47
|
+
return {
|
|
48
|
+
id: PlanetaryHillshadeLayerID,
|
|
49
|
+
type: "raster",
|
|
50
|
+
source: PlanetaryHillshadeSourceID,
|
|
51
|
+
paint: { "raster-opacity": 0.9, "raster-resampling": "linear" },
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Labels by feature scale: the tile's per-feature `minzoom` already hides a small crater at a low zoom, so the symbol
|
|
56
|
+
* layer only sizes and prioritizes. `featureTypeCode` is the IAU feature-type code carried in the tile properties (AA
|
|
57
|
+
* crater, MO mons, VA vallis, ME mare, PL planitia, SF satellite feature); `diameterKm` is the feature's diameter.
|
|
58
|
+
*/
|
|
59
|
+
export function labelLayer(palette) {
|
|
60
|
+
return {
|
|
61
|
+
id: PlanetaryLabelsLayerID,
|
|
62
|
+
type: "symbol",
|
|
63
|
+
source: PlanetaryNomenclatureSourceID,
|
|
64
|
+
"source-layer": "nomenclature",
|
|
65
|
+
layout: {
|
|
66
|
+
"text-field": ["get", "name"],
|
|
67
|
+
"text-font": [PROTOMAPS_FONT_REGULAR],
|
|
68
|
+
"text-size": ["interpolate", ["linear"], ["coalesce", ["get", "diameterKm"], 0], 0, 11, 100, 14, 1000, 18],
|
|
69
|
+
"text-transform": ["match", ["get", "featureTypeCode"], REGION_FEATURE_TYPE_CODES, "uppercase", "none"],
|
|
70
|
+
"text-letter-spacing": ["match", ["get", "featureTypeCode"], REGION_FEATURE_TYPE_CODES, 0.15, 0.02],
|
|
71
|
+
"symbol-sort-key": ["-", 0, ["coalesce", ["get", "diameterKm"], 0]],
|
|
72
|
+
"text-allow-overlap": false,
|
|
73
|
+
},
|
|
74
|
+
paint: { "text-color": palette.labelColor, "text-halo-color": palette.labelHalo, "text-halo-width": 1.2 },
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The selection ring. Its filter matches no feature until the app sets one by `id`, so the layer ships in the style and
|
|
79
|
+
* the app never inserts a layer at runtime.
|
|
80
|
+
*/
|
|
81
|
+
export function selectionLayer(palette) {
|
|
82
|
+
return {
|
|
83
|
+
id: PlanetarySelectionLayerID,
|
|
84
|
+
type: "circle",
|
|
85
|
+
source: PlanetaryNomenclatureSourceID,
|
|
86
|
+
"source-layer": "nomenclature",
|
|
87
|
+
filter: ["==", ["get", "id"], ""],
|
|
88
|
+
paint: {
|
|
89
|
+
"circle-radius": 14,
|
|
90
|
+
"circle-color": "transparent",
|
|
91
|
+
"circle-stroke-color": palette.selection,
|
|
92
|
+
"circle-stroke-width": 2,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=layers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layers.js","sourceRoot":"","sources":["../../lib/planetary/layers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAA;AAC9F,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AASxC;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE;IAC7F,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE;CACzC,CAAA;AAIrD,MAAM,mBAAmB,GAAG,WAAW,CAAA;AAEvC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;AAE1E;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAA;AAElF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAAA;AAEzF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAA;AAElF;;;GAGG;AACH,MAAM,yBAAyB,GAAG,CAAC,I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AAC,KAAK,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;YACnE,oBAAoB,EAAE,KAAK;SAC3B;QACD,KAAK,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,UAAU,EAAE,iBAAiB,EAAE,OAAO,CAAC,SAAS,EAAE,iBAAiB,EAAE,GAAG,EAAE;KACzG,CAAA;AACF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAAyB;IACvD,OAAO;QACN,EAAE,EAAE,yBAAyB;QAC7B,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,6BAA6B;QACrC,cAAc,EAAE,cAAc;QAC9B,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;QACjC,KAAK,EAAE;YACN,eAAe,EAAE,EAAE;YACnB,cAAc,EAAE,aAAa;YAC7B,qBAAqB,EAAE,OAAO,CAAC,SAAS;YACxC,qBAAqB,EAAE,CAAC;SACxB;KACD,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software.
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
import type { RasterSourceSpecification, VectorSourceSpecification } from "@maplibre/maplibre-gl-style-spec";
|
|
7
|
+
import { TileSetSourceID } from "#styles/sources";
|
|
8
|
+
/**
|
|
9
|
+
* The vector source carrying a body's IAU nomenclature: one `nomenclature` source layer of named features.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PlanetaryNomenclatureSourceID: TileSetSourceID<"nomenclature">;
|
|
12
|
+
/**
|
|
13
|
+
* The raster source carrying a body's hillshade, rendered from its DEM at build time.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PlanetaryHillshadeSourceID: TileSetSourceID<"hillshade">;
|
|
16
|
+
/**
|
|
17
|
+
* MapLibre resolves a TileJSON `url` itself: tiles, bounds, zoom range and attribution all come from the tile worker's
|
|
18
|
+
* document, so nothing here restates them.
|
|
19
|
+
*/
|
|
20
|
+
export declare function nomenclatureSource(tileJSONURL: string): VectorSourceSpecification;
|
|
21
|
+
export declare function hillshadeSource(tileJSONURL: string): RasterSourceSpecification;
|
|
22
|
+
//# sourceMappingURL=sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../lib/planetary/sources.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAA;AAE5G,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,6BAA6B,iCAAkC,CAAA;AAE5E;;GAEG;AACH,eAAO,MAAM,0BAA0B,8BAA+B,CAAA;AAEtE;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,yBAAyB,CAKjF;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,yBAAyB,CAM9E"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software.
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
import { TileSetSourceID } from "#styles/sources";
|
|
7
|
+
/**
|
|
8
|
+
* The vector source carrying a body's IAU nomenclature: one `nomenclature` source layer of named features.
|
|
9
|
+
*/
|
|
10
|
+
export const PlanetaryNomenclatureSourceID = TileSetSourceID("nomenclature");
|
|
11
|
+
/**
|
|
12
|
+
* The raster source carrying a body's hillshade, rendered from its DEM at build time.
|
|
13
|
+
*/
|
|
14
|
+
export const PlanetaryHillshadeSourceID = TileSetSourceID("hillshade");
|
|
15
|
+
/**
|
|
16
|
+
* MapLibre resolves a TileJSON `url` itself: tiles, bounds, zoom range and attribution all come from the tile worker's
|
|
17
|
+
* document, so nothing here restates them.
|
|
18
|
+
*/
|
|
19
|
+
export function nomenclatureSource(tileJSONURL) {
|
|
20
|
+
return {
|
|
21
|
+
type: "vector",
|
|
22
|
+
url: tileJSONURL,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function hillshadeSource(tileJSONURL) {
|
|
26
|
+
return {
|
|
27
|
+
type: "raster",
|
|
28
|
+
url: tileJSONURL,
|
|
29
|
+
tileSize: 256,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../lib/planetary/sources.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,eAAe,CAAC,cAAc,CAAC,CAAA;AAE5E;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,eAAe,CAAC,WAAW,CAAC,CAAA;AAEtE;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAmB;IACrD,OAAO;QACN,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,WAAW;KAChB,CAAA;AACF,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,WAAmB;IAClD,OAAO;QACN,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,WAAW;QAChB,QAAQ,EAAE,GAAG;KACb,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software.
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
import type { StyleSpecification } from "@maplibre/maplibre-gl-style-spec";
|
|
7
|
+
import { type PlanetaryStyleBody } from "#planetary/layers";
|
|
8
|
+
export interface PlanetaryStyleOptions {
|
|
9
|
+
body: PlanetaryStyleBody;
|
|
10
|
+
/**
|
|
11
|
+
* The TileJSON document of the body's nomenclature tileset.
|
|
12
|
+
*/
|
|
13
|
+
nomenclatureTileJSONURL: string;
|
|
14
|
+
/**
|
|
15
|
+
* The TileJSON document of the body's hillshade tileset. Without one the style draws labels over bare space.
|
|
16
|
+
*/
|
|
17
|
+
hillshadeTileJSONURL?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A body's whole style: space, the hillshade when a tileset exists, the nomenclature labels, and the selection ring. No
|
|
21
|
+
* Earth layer, no Earth DEM and no sprite reach the result, so a viewer loads nothing Earth-shaped.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createPlanetaryStyle(options: PlanetaryStyleOptions): StyleSpecification;
|
|
24
|
+
//# sourceMappingURL=style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../lib/planetary/style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAuB,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAG/F,OAAO,EAIN,KAAK,kBAAkB,EAGvB,MAAM,mBAAmB,CAAA;AAQ1B,MAAM,WAAW,qBAAqB;IACrC,IAAI,EAAE,kBAAkB,CAAA;IACxB;;OAEG;IACH,uBAAuB,EAAE,MAAM,CAAA;IAC/B;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,kBAAkB,CAyBvF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software.
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
import { StyleSpecificationComposer } from "#base/composition";
|
|
7
|
+
import { hillshadeLayer, labelLayer, PALETTES, selectionLayer, spaceLayer, } from "#planetary/layers";
|
|
8
|
+
import { hillshadeSource, nomenclatureSource, PlanetaryHillshadeSourceID, PlanetaryNomenclatureSourceID, } from "#planetary/sources";
|
|
9
|
+
/**
|
|
10
|
+
* A body's whole style: space, the hillshade when a tileset exists, the nomenclature labels, and the selection ring. No
|
|
11
|
+
* Earth layer, no Earth DEM and no sprite reach the result, so a viewer loads nothing Earth-shaped.
|
|
12
|
+
*/
|
|
13
|
+
export function createPlanetaryStyle(options) {
|
|
14
|
+
const palette = PALETTES[options.body];
|
|
15
|
+
const sources = {
|
|
16
|
+
[PlanetaryNomenclatureSourceID]: nomenclatureSource(options.nomenclatureTileJSONURL),
|
|
17
|
+
};
|
|
18
|
+
if (options.hillshadeTileJSONURL) {
|
|
19
|
+
sources[PlanetaryHillshadeSourceID] = hillshadeSource(options.hillshadeTileJSONURL);
|
|
20
|
+
}
|
|
21
|
+
const baseLayers = [
|
|
22
|
+
spaceLayer(palette),
|
|
23
|
+
...(options.hillshadeTileJSONURL ? [hillshadeLayer()] : []),
|
|
24
|
+
labelLayer(palette),
|
|
25
|
+
selectionLayer(palette),
|
|
26
|
+
];
|
|
27
|
+
return new StyleSpecificationComposer({
|
|
28
|
+
sources,
|
|
29
|
+
baseLayers,
|
|
30
|
+
hillshadeSource: null,
|
|
31
|
+
sprite: null,
|
|
32
|
+
sky: { "sky-color": palette.space, "horizon-color": palette.space },
|
|
33
|
+
}).toJSON();
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../lib/planetary/style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,EACN,cAAc,EACd,UAAU,EACV,QAAQ,EAER,cAAc,EACd,UAAU,GACV,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACN,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,6BAA6B,GAC7B,MAAM,oBAAoB,CAAA;AAc3B;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAA8B;IAClE,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAEtC,MAAM,OAAO,GAAwC;QACpD,CAAC,6BAA6B,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,uBAAuB,CAAC;KACpF,CAAA;IAED,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;QAClC,OAAO,CAAC,0BAA0B,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAA;IACpF,CAAC;IAED,MAAM,UAAU,GAAG;QAClB,UAAU,CAAC,OAAO,CAAC;QACnB,GAAG,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,UAAU,CAAC,OAAO,CAAC;QACnB,cAAc,CAAC,OAAO,CAAC;KACvB,CAAA;IAED,OAAO,IAAI,0BAA0B,CAAC;QACrC,OAAO;QACP,UAAU;QACV,eAAe,EAAE,IAAI;QACrB,MAAM,EAAE,IAAI;QACZ,GAAG,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,CAAC,KAAK,EAAE;KACnE,CAAC,CAAC,MAAM,EAAE,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software.
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The glyph stacks a symbol layer may name. MapLibre draws NO text at all when a glyph range answers 404 — not a
|
|
7
|
+
* fallback face, nothing — so a `text-font` naming an absent stack blanks every label in the style at every zoom,
|
|
8
|
+
* with no console error a reader would connect to the missing labels.
|
|
9
|
+
*
|
|
10
|
+
* The mirror behind `PROTOMAPS_GLYPHS_URL` serves five stacks: `Noto Sans Regular`, `Noto Sans Medium`,
|
|
11
|
+
* `Noto Sans Italic`, `Fira Code Regular` and `Fira Code Medium`. It serves no Fira Sans, and no
|
|
12
|
+
* `Open Sans Regular` — which is MapLibre's own default, so a symbol layer that omits `text-font` also draws
|
|
13
|
+
* nothing. Name a constant from this file rather than a string literal.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The regular text stack: body labels, point features, place names.
|
|
17
|
+
*/
|
|
18
|
+
export declare const PROTOMAPS_FONT_REGULAR = "Noto Sans Regular";
|
|
19
|
+
//# sourceMappingURL=fonts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../lib/styles/fonts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software.
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The glyph stacks a symbol layer may name. MapLibre draws NO text at all when a glyph range answers 404 — not a
|
|
7
|
+
* fallback face, nothing — so a `text-font` naming an absent stack blanks every label in the style at every zoom,
|
|
8
|
+
* with no console error a reader would connect to the missing labels.
|
|
9
|
+
*
|
|
10
|
+
* The mirror behind `PROTOMAPS_GLYPHS_URL` serves five stacks: `Noto Sans Regular`, `Noto Sans Medium`,
|
|
11
|
+
* `Noto Sans Italic`, `Fira Code Regular` and `Fira Code Medium`. It serves no Fira Sans, and no
|
|
12
|
+
* `Open Sans Regular` — which is MapLibre's own default, so a symbol layer that omits `text-font` also draws
|
|
13
|
+
* nothing. Name a constant from this file rather than a string literal.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The regular text stack: body labels, point features, place names.
|
|
17
|
+
*/
|
|
18
|
+
export const PROTOMAPS_FONT_REGULAR = "Noto Sans Regular";
|
|
19
|
+
//# sourceMappingURL=fonts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../lib/styles/fonts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAA"}
|
package/out/styles/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/styles/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/styles/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA"}
|
package/out/styles/index.js
CHANGED
package/out/styles/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/styles/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/styles/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../test/unit/base/composition.test.ts","../test/unit/tiles/coords.test.ts"],"version":"6.0.3"}
|
|
1
|
+
{"root":["../test/unit/base/composition.test.ts","../test/unit/planetary/style.test.ts","../test/unit/tiles/coords.test.ts"],"version":"6.0.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/cartographer",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.0",
|
|
4
4
|
"description": "Mapping utilities for the Mailwoman geo-spatial data pipeline.",
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
6
6
|
"contributors": [
|
|
@@ -82,6 +82,11 @@
|
|
|
82
82
|
"types": "./out/base/composition.d.ts",
|
|
83
83
|
"node": "./out/base/composition.js",
|
|
84
84
|
"default": "./out/base/composition.js"
|
|
85
|
+
},
|
|
86
|
+
"./planetary": {
|
|
87
|
+
"types": "./out/planetary/index.d.ts",
|
|
88
|
+
"node": "./out/planetary/index.js",
|
|
89
|
+
"default": "./out/planetary/index.js"
|
|
85
90
|
}
|
|
86
91
|
},
|
|
87
92
|
"publishConfig": {
|
|
@@ -132,6 +137,11 @@
|
|
|
132
137
|
"types": "./out/base/composition.d.ts",
|
|
133
138
|
"node": "./out/base/composition.js",
|
|
134
139
|
"default": "./out/base/composition.js"
|
|
140
|
+
},
|
|
141
|
+
"./planetary": {
|
|
142
|
+
"types": "./out/planetary/index.d.ts",
|
|
143
|
+
"node": "./out/planetary/index.js",
|
|
144
|
+
"default": "./out/planetary/index.js"
|
|
135
145
|
}
|
|
136
146
|
},
|
|
137
147
|
"imports": {
|
|
@@ -143,8 +153,8 @@
|
|
|
143
153
|
}
|
|
144
154
|
},
|
|
145
155
|
"dependencies": {
|
|
146
|
-
"@mailwoman/core": "9.
|
|
147
|
-
"@mailwoman/tiger": "9.
|
|
156
|
+
"@mailwoman/core": "9.4.0",
|
|
157
|
+
"@mailwoman/tiger": "9.4.0",
|
|
148
158
|
"@maplibre/maplibre-gl-style-spec": "^26.4.1",
|
|
149
159
|
"@protomaps/basemaps": "^5.7.2",
|
|
150
160
|
"d3-scale-chromatic": "^3.1.0",
|