@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.
Files changed (64) hide show
  1. package/README.md +59 -0
  2. package/lib/browser.ts +525 -0
  3. package/lib/cli-args.ts +233 -0
  4. package/lib/cli.ts +141 -0
  5. package/{frame.ts → lib/frame.ts} +33 -6
  6. package/lib/index.ts +13 -0
  7. package/lib/input.ts +288 -0
  8. package/{mercator.ts → lib/mercator.ts} +20 -0
  9. package/{mvt.ts → lib/mvt.ts} +2 -2
  10. package/{raster.ts → lib/raster.ts} +1 -1
  11. package/{renderer.ts → lib/renderer.ts} +86 -36
  12. package/lib/style.ts +115 -0
  13. package/{tile-source.ts → lib/tile-source.ts} +76 -20
  14. package/out/browser.d.ts +126 -0
  15. package/out/browser.d.ts.map +1 -0
  16. package/out/browser.js +373 -0
  17. package/out/browser.js.map +1 -0
  18. package/out/cli-args.d.ts +47 -0
  19. package/out/cli-args.d.ts.map +1 -0
  20. package/out/cli-args.js +171 -0
  21. package/out/cli-args.js.map +1 -0
  22. package/out/cli.d.ts +8 -0
  23. package/out/cli.d.ts.map +1 -0
  24. package/out/cli.js +119 -0
  25. package/out/cli.js.map +1 -0
  26. package/out/frame.d.ts +20 -2
  27. package/out/frame.d.ts.map +1 -1
  28. package/out/frame.js +28 -3
  29. package/out/frame.js.map +1 -1
  30. package/out/index.d.ts +7 -7
  31. package/out/index.d.ts.map +1 -1
  32. package/out/index.js +7 -7
  33. package/out/index.js.map +1 -1
  34. package/out/input.d.ts +93 -0
  35. package/out/input.d.ts.map +1 -0
  36. package/out/input.js +214 -0
  37. package/out/input.js.map +1 -0
  38. package/out/mercator.d.ts +13 -0
  39. package/out/mercator.d.ts.map +1 -1
  40. package/out/mercator.js +16 -0
  41. package/out/mercator.js.map +1 -1
  42. package/out/mvt.d.ts.map +1 -1
  43. package/out/mvt.js +2 -2
  44. package/out/mvt.js.map +1 -1
  45. package/out/raster.d.ts +1 -1
  46. package/out/raster.d.ts.map +1 -1
  47. package/out/raster.js.map +1 -1
  48. package/out/renderer.d.ts +11 -14
  49. package/out/renderer.d.ts.map +1 -1
  50. package/out/renderer.js +46 -26
  51. package/out/renderer.js.map +1 -1
  52. package/out/style.d.ts +22 -11
  53. package/out/style.d.ts.map +1 -1
  54. package/out/style.js +49 -4
  55. package/out/style.js.map +1 -1
  56. package/out/tile-source.d.ts +25 -4
  57. package/out/tile-source.d.ts.map +1 -1
  58. package/out/tile-source.js +46 -14
  59. package/out/tile-source.js.map +1 -1
  60. package/out/tsconfig.test.tsbuildinfo +1 -1
  61. package/package.json +105 -6
  62. package/index.ts +0 -13
  63. package/out/tsconfig.tsbuildinfo +0 -1
  64. 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
- }