@tileflow/core 0.1.0-alpha.0 → 0.1.0-alpha.2
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 +18 -9
- package/dist/index.d.ts +70 -9
- package/dist/index.js +3265 -219
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -3,19 +3,28 @@
|
|
|
3
3
|
Typed Tileflow config helpers and the MapLibre style compiler.
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
|
-
import {
|
|
6
|
+
import {defineTileflow, osm, roads} from '@tileflow/core';
|
|
7
7
|
|
|
8
8
|
export default defineTileflow({
|
|
9
|
+
themes: {
|
|
10
|
+
light: {
|
|
11
|
+
mode: 'light',
|
|
12
|
+
colors: {
|
|
13
|
+
water: '#8ED6E8',
|
|
14
|
+
park: '#C3F1D5',
|
|
15
|
+
road: '#D8E0E7',
|
|
16
|
+
text: '#566371',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
9
20
|
maps: {
|
|
10
21
|
madrid: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
text: "#2E2E2E",
|
|
18
|
-
accent: "#C6A15B",
|
|
22
|
+
basemap: osm(),
|
|
23
|
+
theme: 'light',
|
|
24
|
+
modules: [roads({preset: 'modern', density: 'balanced'})],
|
|
25
|
+
view: {
|
|
26
|
+
center: [-3.7038, 40.4168],
|
|
27
|
+
zoom: 12,
|
|
19
28
|
},
|
|
20
29
|
},
|
|
21
30
|
},
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
type TileflowDensity =
|
|
2
|
-
type TileflowRoads =
|
|
3
|
-
type TileflowLabels =
|
|
4
|
-
type TileflowPoi =
|
|
1
|
+
type TileflowDensity = 'clean' | 'balanced' | 'dense';
|
|
2
|
+
type TileflowRoads = 'hidden' | 'soft' | 'standard' | 'detailed';
|
|
3
|
+
type TileflowLabels = 'none' | 'essential' | 'balanced' | 'full';
|
|
4
|
+
type TileflowPoi = 'none' | 'minimal' | 'balanced' | 'full';
|
|
5
|
+
type TileflowTheme = 'standard' | 'light' | 'dark' | 'minimal' | 'osm-bright-2';
|
|
6
|
+
type TileflowBuildings = 'hidden' | 'flat' | '3d';
|
|
7
|
+
type TileflowTerrainMode = 'none' | 'hillshade' | '3d';
|
|
8
|
+
type TileflowTerrainEncoding = 'mapbox' | 'terrarium';
|
|
9
|
+
type TileflowThemeMode = 'light' | 'dark';
|
|
5
10
|
type TileflowColors = {
|
|
6
11
|
canvas: string;
|
|
7
12
|
land: string;
|
|
@@ -15,13 +20,19 @@ type LegacyTileflowColorAliases = {
|
|
|
15
20
|
background?: string;
|
|
16
21
|
park?: string;
|
|
17
22
|
building?: string;
|
|
23
|
+
roadCasing?: string;
|
|
18
24
|
};
|
|
19
25
|
type TileflowColorConfig = Partial<TileflowColors> & LegacyTileflowColorAliases;
|
|
20
|
-
type TileflowFontWeight =
|
|
26
|
+
type TileflowFontWeight = 'regular' | 'medium' | 'semibold' | 'bold';
|
|
21
27
|
type TileflowTypography = {
|
|
22
28
|
font?: string;
|
|
23
29
|
weight?: TileflowFontWeight;
|
|
24
30
|
};
|
|
31
|
+
type TileflowThemeConfig = {
|
|
32
|
+
mode?: TileflowThemeMode;
|
|
33
|
+
colors?: TileflowColorConfig;
|
|
34
|
+
typography?: TileflowTypography;
|
|
35
|
+
};
|
|
25
36
|
type TileflowSourceLayers = {
|
|
26
37
|
landuse?: string;
|
|
27
38
|
park?: string;
|
|
@@ -39,18 +50,59 @@ type TileflowTiles = {
|
|
|
39
50
|
attribution?: string;
|
|
40
51
|
sourceLayers?: TileflowSourceLayers;
|
|
41
52
|
};
|
|
53
|
+
type TileflowTerrainConfig = {
|
|
54
|
+
attribution?: string;
|
|
55
|
+
encoding?: TileflowTerrainEncoding;
|
|
56
|
+
exaggeration?: number;
|
|
57
|
+
mode?: TileflowTerrainMode;
|
|
58
|
+
sourceId?: string;
|
|
59
|
+
tileset?: string;
|
|
60
|
+
url?: string;
|
|
61
|
+
};
|
|
62
|
+
type TileflowTerrain = TileflowTerrainMode | TileflowTerrainConfig;
|
|
63
|
+
type TileflowViewConfig = {
|
|
64
|
+
bearing?: number;
|
|
65
|
+
center?: readonly [number, number];
|
|
66
|
+
zoom?: number;
|
|
67
|
+
};
|
|
68
|
+
type TileflowOsmBasemapConfig = {
|
|
69
|
+
type: 'osm';
|
|
70
|
+
attribution?: string;
|
|
71
|
+
glyphs?: string;
|
|
72
|
+
sourceId?: string;
|
|
73
|
+
sourceLayers?: TileflowSourceLayers;
|
|
74
|
+
sprite?: string;
|
|
75
|
+
tileset?: string;
|
|
76
|
+
url?: string;
|
|
77
|
+
};
|
|
78
|
+
type TileflowBasemapConfig = TileflowOsmBasemapConfig;
|
|
79
|
+
type TileflowOsmBasemapOptions = Omit<TileflowOsmBasemapConfig, 'type'>;
|
|
80
|
+
type TileflowRoadsModulePreset = 'modern' | 'minimal';
|
|
81
|
+
type TileflowRoadsModuleConfig = {
|
|
82
|
+
type: 'roads';
|
|
83
|
+
density?: TileflowDensity;
|
|
84
|
+
preset?: TileflowRoadsModulePreset;
|
|
85
|
+
};
|
|
86
|
+
type TileflowRoadsModuleOptions = Omit<TileflowRoadsModuleConfig, 'type'>;
|
|
87
|
+
type TileflowModuleConfig = TileflowRoadsModuleConfig;
|
|
42
88
|
type TileflowConfig = {
|
|
89
|
+
basemap?: TileflowBasemapConfig;
|
|
43
90
|
name?: string;
|
|
44
91
|
tileset?: string;
|
|
92
|
+
theme?: TileflowTheme | string | TileflowThemeConfig;
|
|
93
|
+
modules?: readonly TileflowModuleConfig[];
|
|
45
94
|
colors?: TileflowColorConfig;
|
|
46
95
|
typography?: TileflowTypography;
|
|
47
96
|
density?: TileflowDensity;
|
|
48
97
|
roads?: TileflowRoads;
|
|
49
98
|
labels?: TileflowLabels;
|
|
50
99
|
poi?: TileflowPoi;
|
|
100
|
+
buildings?: TileflowBuildings;
|
|
101
|
+
terrain?: TileflowTerrain;
|
|
51
102
|
glyphs?: string;
|
|
52
103
|
sprite?: string;
|
|
53
104
|
tiles?: TileflowTiles;
|
|
105
|
+
view?: TileflowViewConfig;
|
|
54
106
|
/**
|
|
55
107
|
* Domains allowed to load this map in production (e.g. "example.com" or
|
|
56
108
|
* "*.example.com"). When set, tile and session requests from other
|
|
@@ -67,10 +119,12 @@ type TileflowTilesetConfig = {
|
|
|
67
119
|
sourceLayers?: TileflowSourceLayers;
|
|
68
120
|
};
|
|
69
121
|
type TileflowProjectConfig = {
|
|
122
|
+
themes?: Record<string, TileflowThemeConfig>;
|
|
70
123
|
tilesets?: Record<string, TileflowTilesetConfig>;
|
|
71
124
|
maps: Record<string, TileflowMapConfig>;
|
|
72
125
|
};
|
|
73
126
|
type TileflowStyleOptions = {
|
|
127
|
+
themes?: Record<string, TileflowThemeConfig>;
|
|
74
128
|
tileBaseUrl?: string;
|
|
75
129
|
tileset?: string;
|
|
76
130
|
};
|
|
@@ -87,10 +141,11 @@ type MapLibreStyle = {
|
|
|
87
141
|
sprite?: string;
|
|
88
142
|
sources: Record<string, Record<string, unknown>>;
|
|
89
143
|
layers: Array<Record<string, unknown>>;
|
|
144
|
+
terrain?: Record<string, unknown>;
|
|
90
145
|
metadata?: Record<string, unknown>;
|
|
91
146
|
};
|
|
92
147
|
type ValidationMessage = {
|
|
93
|
-
level:
|
|
148
|
+
level: 'error' | 'warning';
|
|
94
149
|
path: string;
|
|
95
150
|
message: string;
|
|
96
151
|
};
|
|
@@ -98,8 +153,6 @@ type ValidationResult = {
|
|
|
98
153
|
valid: boolean;
|
|
99
154
|
messages: ValidationMessage[];
|
|
100
155
|
};
|
|
101
|
-
declare function defineTileflow(config: TileflowProjectConfig): TileflowProjectConfig;
|
|
102
|
-
declare function validateConfig(input: unknown): ValidationResult;
|
|
103
156
|
declare function createStyle(input?: TileflowConfig, options?: TileflowStyleOptions): MapLibreStyle;
|
|
104
157
|
declare function createStyleFromProject(projectConfig: TileflowProjectConfig, mapName: string, options?: TileflowStyleOptions): MapLibreStyle;
|
|
105
158
|
declare function createManifest(projectConfig: TileflowProjectConfig, options?: {
|
|
@@ -108,4 +161,12 @@ declare function createManifest(projectConfig: TileflowProjectConfig, options?:
|
|
|
108
161
|
}): TileflowManifest;
|
|
109
162
|
declare function getDefaultColors(): TileflowColors;
|
|
110
163
|
|
|
111
|
-
|
|
164
|
+
declare function validateConfig(input: unknown): ValidationResult;
|
|
165
|
+
|
|
166
|
+
declare function defineTileflow(config: TileflowProjectConfig): TileflowProjectConfig;
|
|
167
|
+
|
|
168
|
+
declare function osm(options?: TileflowOsmBasemapOptions): TileflowOsmBasemapConfig;
|
|
169
|
+
|
|
170
|
+
declare function roads(options?: TileflowRoadsModuleOptions): TileflowRoadsModuleConfig;
|
|
171
|
+
|
|
172
|
+
export { type MapLibreStyle, type TileflowBasemapConfig, type TileflowBuildings, type TileflowColorConfig, type TileflowColors, type TileflowConfig, type TileflowDensity, type TileflowFontWeight, type TileflowLabels, type TileflowManifest, type TileflowMapConfig, type TileflowModuleConfig, type TileflowOsmBasemapConfig, type TileflowOsmBasemapOptions, type TileflowPoi, type TileflowProjectConfig, type TileflowRoads, type TileflowRoadsModuleConfig, type TileflowRoadsModuleOptions, type TileflowRoadsModulePreset, type TileflowSourceLayers, type TileflowStyleOptions, type TileflowTerrain, type TileflowTerrainConfig, type TileflowTerrainEncoding, type TileflowTerrainMode, type TileflowTheme, type TileflowThemeConfig, type TileflowThemeMode, type TileflowTiles, type TileflowTilesetConfig, type TileflowTypography, type TileflowViewConfig, type ValidationMessage, type ValidationResult, createManifest, createStyle, createStyleFromProject, defineTileflow, getDefaultColors, osm, roads, validateConfig };
|