@mailwoman/map-tui 9.1.1 → 9.3.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/README.md +59 -0
- package/lib/browser.ts +525 -0
- package/lib/cli-args.ts +233 -0
- package/lib/cli.ts +141 -0
- package/{frame.ts → lib/frame.ts} +33 -6
- package/lib/index.ts +13 -0
- package/lib/input.ts +288 -0
- package/{mercator.ts → lib/mercator.ts} +20 -0
- package/{mvt.ts → lib/mvt.ts} +2 -2
- package/{raster.ts → lib/raster.ts} +1 -1
- package/{renderer.ts → lib/renderer.ts} +86 -36
- package/lib/style.ts +115 -0
- package/{tile-source.ts → lib/tile-source.ts} +76 -20
- package/out/browser.d.ts +126 -0
- package/out/browser.d.ts.map +1 -0
- package/out/browser.js +373 -0
- package/out/browser.js.map +1 -0
- package/out/cli-args.d.ts +47 -0
- package/out/cli-args.d.ts.map +1 -0
- package/out/cli-args.js +171 -0
- package/out/cli-args.js.map +1 -0
- package/out/cli.d.ts +8 -0
- package/out/cli.d.ts.map +1 -0
- package/out/cli.js +119 -0
- package/out/cli.js.map +1 -0
- package/out/frame.d.ts +20 -2
- package/out/frame.d.ts.map +1 -1
- package/out/frame.js +28 -3
- package/out/frame.js.map +1 -1
- package/out/index.d.ts +7 -7
- package/out/index.d.ts.map +1 -1
- package/out/index.js +7 -7
- package/out/index.js.map +1 -1
- package/out/input.d.ts +93 -0
- package/out/input.d.ts.map +1 -0
- package/out/input.js +214 -0
- package/out/input.js.map +1 -0
- package/out/mercator.d.ts +13 -0
- package/out/mercator.d.ts.map +1 -1
- package/out/mercator.js +16 -0
- package/out/mercator.js.map +1 -1
- package/out/mvt.d.ts.map +1 -1
- package/out/mvt.js +2 -2
- package/out/mvt.js.map +1 -1
- package/out/raster.d.ts +1 -1
- package/out/raster.d.ts.map +1 -1
- package/out/raster.js.map +1 -1
- package/out/renderer.d.ts +11 -14
- package/out/renderer.d.ts.map +1 -1
- package/out/renderer.js +46 -26
- package/out/renderer.js.map +1 -1
- package/out/style.d.ts +22 -11
- package/out/style.d.ts.map +1 -1
- package/out/style.js +49 -4
- package/out/style.js.map +1 -1
- package/out/tile-source.d.ts +25 -4
- package/out/tile-source.d.ts.map +1 -1
- package/out/tile-source.js +46 -14
- package/out/tile-source.js.map +1 -1
- package/out/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +105 -6
- package/index.ts +0 -13
- package/out/tsconfig.tsbuildinfo +0 -1
- package/style.ts +0 -62
package/style.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software.
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Protomaps-basemap style table for the map-tui debug view.
|
|
9
|
-
*
|
|
10
|
-
* Defines fill, line, and label styles for each of the nine protomaps-basemap layers, gated by zoom level. Color
|
|
11
|
-
* palette calibrated for dark-terminal rendering: dim fills (read as stipple density via dithering), bright lines and
|
|
12
|
-
* labels.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
export type RGB = readonly [red: number, green: number, blue: number]
|
|
16
|
-
|
|
17
|
-
export interface FillStyle {
|
|
18
|
-
kind: "fill"
|
|
19
|
-
color: RGB
|
|
20
|
-
minZoom: number
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface LineStyle {
|
|
24
|
-
kind: "line"
|
|
25
|
-
color: RGB
|
|
26
|
-
minZoom: number
|
|
27
|
-
width: (zoom: number) => number
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface LabelStyle {
|
|
31
|
-
kind: "label"
|
|
32
|
-
color: RGB
|
|
33
|
-
minZoom: number
|
|
34
|
-
property: string
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type LayerStyle = FillStyle | LineStyle | LabelStyle
|
|
38
|
-
|
|
39
|
-
// Zoom level at which roads render with 2px width instead of 1px.
|
|
40
|
-
const ROAD_WIDTH_THRESHOLD = 14
|
|
41
|
-
|
|
42
|
-
const STYLE_TABLE: Record<string, LayerStyle[]> = {
|
|
43
|
-
earth: [{ kind: "fill", color: [40, 44, 36], minZoom: 0 }],
|
|
44
|
-
landcover: [{ kind: "fill", color: [36, 52, 32], minZoom: 4 }],
|
|
45
|
-
landuse: [{ kind: "fill", color: [48, 48, 40], minZoom: 10 }],
|
|
46
|
-
water: [{ kind: "fill", color: [24, 48, 90], minZoom: 0 }],
|
|
47
|
-
buildings: [{ kind: "fill", color: [70, 66, 60], minZoom: 13 }],
|
|
48
|
-
boundaries: [{ kind: "line", color: [140, 110, 160], minZoom: 0, width: () => 1 }],
|
|
49
|
-
roads: [
|
|
50
|
-
{ kind: "line", color: [170, 170, 150], minZoom: 6, width: (zoom) => (zoom >= ROAD_WIDTH_THRESHOLD ? 2 : 1) },
|
|
51
|
-
],
|
|
52
|
-
places: [{ kind: "label", color: [235, 235, 220], minZoom: 2, property: "name" }],
|
|
53
|
-
pois: [{ kind: "label", color: [180, 200, 160], minZoom: 14, property: "name" }],
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Styles applying to a protomaps-basemap layer at a zoom, draw-ordered (fills < lines < labels). Empty for
|
|
58
|
-
* unstyled/gated layers.
|
|
59
|
-
*/
|
|
60
|
-
export function stylesFor(layerName: string, zoom: number): LayerStyle[] {
|
|
61
|
-
return (STYLE_TABLE[layerName] ?? []).filter((style) => zoom >= style.minZoom)
|
|
62
|
-
}
|