@versatiles/style 5.2.3 → 5.2.4
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 +13 -21
- package/dist/color/abstract.d.ts +1 -1
- package/dist/color/hsl.d.ts +1 -1
- package/dist/color/hsl.js +7 -5
- package/dist/color/index.js +10 -8
- package/dist/color/rgb.d.ts +1 -1
- package/dist/color/rgb.js +10 -8
- package/dist/index.d.ts +6 -19
- package/dist/index.js +1 -0
- package/dist/shortbread/layers.d.ts +1 -1
- package/dist/style_builder/style_builder.d.ts +3 -3
- package/dist/style_builder/style_builder.js +1 -1
- package/dist/style_builder/types.d.ts +92 -14
- package/dist/style_builder/types.js +1 -0
- package/dist/styles/colorful.d.ts +2 -85
- package/dist/styles/index.d.ts +7 -18
- package/dist/styles/neutrino.d.ts +2 -56
- package/package.json +11 -8
- package/dist/style_builder/index.d.ts +0 -1
- package/dist/style_builder/index.js +0 -2
package/README.MD
CHANGED
|
@@ -5,19 +5,17 @@
|
|
|
5
5
|
|
|
6
6
|
# VersaTiles Style
|
|
7
7
|
|
|
8
|
-
> [!WARNING]
|
|
9
|
-
> We are currently migrating to the [VersaTiles Frontend Specification](https://github.com/versatiles-org/versatiles-documentation/blob/main/compendium/specification_frontend.md). While this is good for the long term, it does mean that there will be breaking changes in the short term. You can find the [old v4.4.1 release here](https://github.com/versatiles-org/versatiles-style/releases/tag/v4.4.1).
|
|
10
|
-
|
|
11
8
|
Generates styles and sprites for MapLibre.
|
|
12
9
|
|
|
13
|
-

|
|
14
|
-
|
|
15
10
|
# Styles
|
|
16
11
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
style name | preview
|
|
13
|
+
-----------|--------------------------------------------------------------------------
|
|
14
|
+
colorful | <img width="384" src="screenshots/colorful.png" alt="colorful style" />
|
|
15
|
+
graybeard | <img width="384" src="screenshots/graybeard.png" alt="graybeard style" />
|
|
16
|
+
eclipse | <img width="384" src="screenshots/eclipse.png" alt="eclipse style" />
|
|
17
|
+
neutrino | <img width="384" src="screenshots/neutrino.png" alt="neutrino style" />
|
|
18
|
+
|
|
21
19
|
|
|
22
20
|
# Use styles for versatiles.org
|
|
23
21
|
|
|
@@ -78,25 +76,19 @@ writeFileSync('style.json', JSON.stringify(style));
|
|
|
78
76
|
### Methods for generating styles
|
|
79
77
|
|
|
80
78
|
This library provides:
|
|
81
|
-
- `style = colorful(options);`
|
|
82
|
-
- `style = eclipse(options);`
|
|
83
|
-
- `style = graybeard(options);`
|
|
84
|
-
- `style = neutrino(options);`
|
|
79
|
+
- `style = colorful(options);` [documentation](https://github.com/versatiles-org/versatiles-style/blob/main/docs/functions/colorful.md)
|
|
80
|
+
- `style = eclipse(options);` [documentation](https://github.com/versatiles-org/versatiles-style/blob/main/docs/functions/eclipse.md)
|
|
81
|
+
- `style = graybeard(options);` [documentation](https://github.com/versatiles-org/versatiles-style/blob/main/docs/functions/graybeard.md)
|
|
82
|
+
- `style = neutrino(options);` [documentation](https://github.com/versatiles-org/versatiles-style/blob/main/docs/functions/neutrino.md)
|
|
85
83
|
|
|
86
|
-
Where `options` is an optional object
|
|
84
|
+
[Where `options` is an optional object](https://github.com/versatiles-org/versatiles-style/blob/main/docs/interfaces/StyleBuilderOptions.md)
|
|
87
85
|
|
|
88
86
|
### Method: `guessStyle(options)`
|
|
89
87
|
|
|
90
88
|
```javascript
|
|
91
89
|
const style = guessStyle(options);
|
|
92
90
|
```
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
**Parameters:**
|
|
96
|
-
|
|
97
|
-
* <code>opt: TileJSONOption</code>
|
|
98
|
-
|
|
99
|
-
**Returns:** <code>MaplibreStyle</code>
|
|
91
|
+
[documentation](https://github.com/versatiles-org/versatiles-style/blob/main/docs/functions/guessStyle.md)
|
|
100
92
|
|
|
101
93
|
# Build
|
|
102
94
|
|
package/dist/color/abstract.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { HSV } from './hsv';
|
|
|
3
3
|
import { RandomColorOptions } from './random';
|
|
4
4
|
import type { RGB } from './rgb';
|
|
5
5
|
export declare abstract class Color {
|
|
6
|
-
static parse: (
|
|
6
|
+
static parse: (input: Color | string) => Color;
|
|
7
7
|
static HSL: typeof HSL;
|
|
8
8
|
static HSV: typeof HSV;
|
|
9
9
|
static RGB: typeof RGB;
|
package/dist/color/hsl.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare class HSL extends Color {
|
|
|
15
15
|
toHSL(): HSL;
|
|
16
16
|
asHSV(): HSV;
|
|
17
17
|
asRGB(): RGB;
|
|
18
|
-
static parse(
|
|
18
|
+
static parse(input: string | Color): HSL;
|
|
19
19
|
invertLuminosity(): HSL;
|
|
20
20
|
rotateHue(offset: number): HSL;
|
|
21
21
|
saturate(ratio: number): HSL;
|
package/dist/color/hsl.js
CHANGED
|
@@ -68,17 +68,19 @@ export class HSL extends Color {
|
|
|
68
68
|
// Convert to RGB in the 0-255 range and return
|
|
69
69
|
return new RGB(255 * hueToRgb(h + 1 / 3), 255 * hueToRgb(h), 255 * hueToRgb(h - 1 / 3), this.a);
|
|
70
70
|
}
|
|
71
|
-
static parse(
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
static parse(input) {
|
|
72
|
+
if (input instanceof Color)
|
|
73
|
+
return input.asHSL();
|
|
74
|
+
input = input.replace(/\s+/g, '').toLowerCase();
|
|
75
|
+
let match = input.match(/^hsl\((?<h>[-+0-9.]+)(?:deg)?,(?<s>[-+0-9.]+)%,(?<l>[-+0-9.]+)%\)$/);
|
|
74
76
|
if (match) {
|
|
75
77
|
return new HSL(parseFloat(match.groups.h), parseFloat(match.groups.s), parseFloat(match.groups.l));
|
|
76
78
|
}
|
|
77
|
-
match =
|
|
79
|
+
match = input.match(/^hsla\((?<h>[-+0-9.]+)(?:deg)?,(?<s>[-+0-9.]+)%,(?<l>[-+0-9.]+)%,(?<a>[-+0-9.]+)\)$/);
|
|
78
80
|
if (match) {
|
|
79
81
|
return new HSL(parseFloat(match.groups.h), parseFloat(match.groups.s), parseFloat(match.groups.l), parseFloat(match.groups.a));
|
|
80
82
|
}
|
|
81
|
-
throw new Error(`Invalid HSL color string: "${
|
|
83
|
+
throw new Error(`Invalid HSL color string: "${input}"`);
|
|
82
84
|
}
|
|
83
85
|
invertLuminosity() {
|
|
84
86
|
return new HSL(this.h, this.s, 100 - this.l, this.a);
|
package/dist/color/index.js
CHANGED
|
@@ -3,20 +3,22 @@ import { HSL } from './hsl';
|
|
|
3
3
|
import { HSV } from './hsv';
|
|
4
4
|
import randomColor from './random';
|
|
5
5
|
import { RGB } from './rgb';
|
|
6
|
-
Color.parse = function (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
Color.parse = function (input) {
|
|
7
|
+
if (input instanceof Color)
|
|
8
|
+
return input;
|
|
9
|
+
input = input.trim().toLowerCase();
|
|
10
|
+
if (input.startsWith('#'))
|
|
11
|
+
return RGB.parse(input);
|
|
12
|
+
const prefix = input.replace(/\d.*/, '').trim().toLowerCase();
|
|
11
13
|
switch (prefix) {
|
|
12
14
|
case 'rgb(':
|
|
13
15
|
case 'rgba(':
|
|
14
|
-
return RGB.parse(
|
|
16
|
+
return RGB.parse(input);
|
|
15
17
|
case 'hsl(':
|
|
16
18
|
case 'hsla(':
|
|
17
|
-
return HSL.parse(
|
|
19
|
+
return HSL.parse(input);
|
|
18
20
|
default:
|
|
19
|
-
throw Error('Unknown color format: ' +
|
|
21
|
+
throw Error('Unknown color format: ' + input);
|
|
20
22
|
}
|
|
21
23
|
};
|
|
22
24
|
Color.HSL = HSL;
|
package/dist/color/rgb.d.ts
CHANGED
package/dist/color/rgb.js
CHANGED
|
@@ -109,10 +109,12 @@ export class RGB extends Color {
|
|
|
109
109
|
toRGB() {
|
|
110
110
|
return this;
|
|
111
111
|
}
|
|
112
|
-
static parse(
|
|
113
|
-
|
|
112
|
+
static parse(input) {
|
|
113
|
+
if (input instanceof Color)
|
|
114
|
+
return input.asRGB();
|
|
115
|
+
input = input.toLowerCase().replaceAll(/[^0-9a-z.#,()]/g, '');
|
|
114
116
|
let match;
|
|
115
|
-
match =
|
|
117
|
+
match = input.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/);
|
|
116
118
|
if (match) {
|
|
117
119
|
const r = parseInt(match[1], 16);
|
|
118
120
|
const g = parseInt(match[2], 16);
|
|
@@ -120,7 +122,7 @@ export class RGB extends Color {
|
|
|
120
122
|
const a = match[4] ? parseInt(match[4], 16) / 255 : 1;
|
|
121
123
|
return new RGB(r, g, b, a);
|
|
122
124
|
}
|
|
123
|
-
match =
|
|
125
|
+
match = input.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/);
|
|
124
126
|
if (match) {
|
|
125
127
|
const r = parseInt(match[1], 16) * 17;
|
|
126
128
|
const g = parseInt(match[2], 16) * 17;
|
|
@@ -128,15 +130,15 @@ export class RGB extends Color {
|
|
|
128
130
|
const a = match[4] ? parseInt(match[4], 16) / 15 : 1;
|
|
129
131
|
return new RGB(r, g, b, a);
|
|
130
132
|
}
|
|
131
|
-
|
|
132
|
-
match =
|
|
133
|
+
input = input.trim().toLowerCase().replaceAll(' ', '');
|
|
134
|
+
match = input.match(/^rgb\((\d+),(\d+),(\d+)\)$/);
|
|
133
135
|
if (match) {
|
|
134
136
|
const r = parseInt(match[1]);
|
|
135
137
|
const g = parseInt(match[2]);
|
|
136
138
|
const b = parseInt(match[3]);
|
|
137
139
|
return new RGB(r, g, b);
|
|
138
140
|
}
|
|
139
|
-
match =
|
|
141
|
+
match = input.match(/^rgba\((\d+),(\d+),(\d+),([.\d]+)\)$/);
|
|
140
142
|
if (match) {
|
|
141
143
|
const r = parseInt(match[1]);
|
|
142
144
|
const g = parseInt(match[2]);
|
|
@@ -144,7 +146,7 @@ export class RGB extends Color {
|
|
|
144
146
|
const a = parseFloat(match[4]);
|
|
145
147
|
return new RGB(r, g, b, a);
|
|
146
148
|
}
|
|
147
|
-
throw new Error(`Invalid RGB color string: "${
|
|
149
|
+
throw new Error(`Invalid RGB color string: "${input}"`);
|
|
148
150
|
}
|
|
149
151
|
gamma(value) {
|
|
150
152
|
if (value < 1e-3)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,15 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { colorful, eclipse, graybeard, neutrino, type StyleBuilderFunction } from './styles/index';
|
|
2
2
|
export declare const styles: {
|
|
3
|
-
colorful:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
eclipse: {
|
|
8
|
-
(options?: import("./style_builder/types").StyleBuilderOptions): import("@maplibre/maplibre-gl-style-spec").StyleSpecification;
|
|
9
|
-
getOptions(): import("./style_builder/types").StyleBuilderOptions;
|
|
10
|
-
};
|
|
11
|
-
graybeard: {
|
|
12
|
-
(options?: import("./style_builder/types").StyleBuilderOptions): import("@maplibre/maplibre-gl-style-spec").StyleSpecification;
|
|
13
|
-
getOptions(): import("./style_builder/types").StyleBuilderOptions;
|
|
14
|
-
};
|
|
15
|
-
neutrino: {
|
|
16
|
-
(options?: import("./style_builder/types").StyleBuilderOptions): import("@maplibre/maplibre-gl-style-spec").StyleSpecification;
|
|
17
|
-
getOptions(): import("./style_builder/types").StyleBuilderOptions;
|
|
18
|
-
};
|
|
3
|
+
colorful: import("./styles/index").StyleBuilderFunction;
|
|
4
|
+
eclipse: import("./styles/index").StyleBuilderFunction;
|
|
5
|
+
graybeard: import("./styles/index").StyleBuilderFunction;
|
|
6
|
+
neutrino: import("./styles/index").StyleBuilderFunction;
|
|
19
7
|
};
|
|
20
8
|
export type { GuessStyleOptions } from './guess_style/index';
|
|
21
9
|
export type { RGB, HSL, HSV, RandomColorOptions } from './color/index';
|
|
22
10
|
export type { TileJSONSpecification, TileJSONSpecificationRaster, TileJSONSpecificationVector } from './types/tilejson';
|
|
23
11
|
export type { VectorLayer } from './types/index';
|
|
24
|
-
export type { StyleBuilderOptions,
|
|
12
|
+
export type { StyleBuilderOptions, Language, StyleBuilderColors, StyleBuilderColorsEnsured, StyleBuilderFonts } from './style_builder/types';
|
|
25
13
|
export type { RecolorOptions } from './style_builder/recolor';
|
|
26
|
-
export type { StyleBuilder } from './style_builder/style_builder';
|
|
27
14
|
export { guessStyle } from './guess_style/index';
|
|
28
15
|
export { Color } from './color/index';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Language } from '../style_builder/index';
|
|
2
1
|
import type { MaplibreLayerDefinition } from '../types/index';
|
|
2
|
+
import { Language } from '../style_builder/types';
|
|
3
3
|
export declare function getShortbreadLayers(option: {
|
|
4
4
|
readonly language: Language;
|
|
5
5
|
}): MaplibreLayerDefinition[];
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Color } from '../color/index';
|
|
2
2
|
import type { StyleSpecification } from '../types/maplibre';
|
|
3
|
-
import type {
|
|
3
|
+
import type { StyleBuilderColors, StyleBuilderColorsEnsured, StyleBuilderFonts, StyleBuilderOptions } from './types';
|
|
4
4
|
import type { StyleRules, StyleRulesOptions } from './types';
|
|
5
5
|
export declare abstract class StyleBuilder {
|
|
6
6
|
#private;
|
|
7
7
|
abstract readonly name: string;
|
|
8
|
-
abstract readonly defaultColors:
|
|
8
|
+
abstract readonly defaultColors: StyleBuilderColors;
|
|
9
9
|
abstract readonly defaultFonts: StyleBuilderFonts;
|
|
10
10
|
build(options?: StyleBuilderOptions): StyleSpecification;
|
|
11
|
-
getColors(colors:
|
|
11
|
+
getColors(colors: StyleBuilderColors): StyleBuilderColorsEnsured;
|
|
12
12
|
getDefaultOptions(): StyleBuilderOptions;
|
|
13
13
|
protected transformDefaultColors(callback: (color: Color) => Color): void;
|
|
14
14
|
protected abstract getStyleRules(options: StyleRulesOptions): StyleRules;
|
|
@@ -3,37 +3,115 @@ import type { RecolorOptions } from './recolor';
|
|
|
3
3
|
import { SpriteSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
4
4
|
/** Represents language suffixes used in map styles. */
|
|
5
5
|
export type Language = 'de' | 'en' | null;
|
|
6
|
+
/** Options for configuring a style builder. */
|
|
6
7
|
export interface StyleBuilderOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The base URL for loading external resources like tiles, sprites, and fonts.
|
|
10
|
+
* Default: document.location.origin (in the browser), or 'https://tiles.versatiles.org'
|
|
11
|
+
*/
|
|
7
12
|
baseUrl?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The URL template for loading font glyphs, formatted with '{fontstack}' and '{range}' placeholders.
|
|
15
|
+
* Default: '/assets/glyphs/{fontstack}/{range}.pbf'
|
|
16
|
+
*/
|
|
8
17
|
glyphs?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The URL for loading sprite images and metadata.
|
|
20
|
+
* Default: [{ id: 'basics', url: '/assets/sprites/basics/sprites' }]
|
|
21
|
+
*/
|
|
9
22
|
sprite?: SpriteSpecification;
|
|
23
|
+
/**
|
|
24
|
+
* An array of URL templates for loading map tiles, using '{z}', '{x}', and '{y}' placeholders.
|
|
25
|
+
* Default: ['/tiles/osm/{z}/{x}/{y}']
|
|
26
|
+
*/
|
|
10
27
|
tiles?: string[];
|
|
28
|
+
/**
|
|
29
|
+
* If set to true, hides all map labels.
|
|
30
|
+
* Default: false
|
|
31
|
+
*/
|
|
11
32
|
hideLabels?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Set the language ('en', 'de') of all map labels.
|
|
35
|
+
* A null value means that the language of the country in which the label is drawn will be used.
|
|
36
|
+
* Default: null
|
|
37
|
+
*/
|
|
12
38
|
language?: Language;
|
|
13
|
-
|
|
39
|
+
/**
|
|
40
|
+
* An object specifying overrides for default color values, keyed by the color names.
|
|
41
|
+
*/
|
|
42
|
+
colors?: Partial<StyleBuilderColors>;
|
|
43
|
+
/**
|
|
44
|
+
* An object specifying overrides for default font names, keyed by the font names.
|
|
45
|
+
*/
|
|
14
46
|
fonts?: Partial<StyleBuilderFonts>;
|
|
47
|
+
/**
|
|
48
|
+
* Options for color adjustments and transformations applied to the entire style.
|
|
49
|
+
*/
|
|
15
50
|
recolor?: RecolorOptions;
|
|
16
51
|
}
|
|
17
|
-
/** Defines the keys for color properties in a style builder. */
|
|
18
|
-
export type StyleBuilderColorKeys = 'agriculture' | 'boundary' | 'building' | 'buildingbg' | 'burial' | 'commercial' | 'construction' | 'cycle' | 'danger' | 'disputed' | 'education' | 'foot' | 'glacier' | 'grass' | 'hospital' | 'industrial' | 'label' | 'labelHalo' | 'land' | 'leisure' | 'motorway' | 'motorwaybg' | 'park' | 'parking' | 'poi' | 'prison' | 'rail' | 'residential' | 'rock' | 'sand' | 'shield' | 'street' | 'streetbg' | 'subway' | 'symbol' | 'trunk' | 'trunkbg' | 'waste' | 'water' | 'wetland' | 'wood';
|
|
19
|
-
/** Defines the keys for font properties in a style builder. */
|
|
20
|
-
export type StyleBuilderFontKeys = 'regular' | 'bold';
|
|
21
52
|
/** Records string values for color properties in a style builder. */
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
53
|
+
export interface StyleBuilderColors {
|
|
54
|
+
agriculture: Color | string;
|
|
55
|
+
boundary: Color | string;
|
|
56
|
+
building: Color | string;
|
|
57
|
+
buildingbg: Color | string;
|
|
58
|
+
burial: Color | string;
|
|
59
|
+
commercial: Color | string;
|
|
60
|
+
construction: Color | string;
|
|
61
|
+
cycle: Color | string;
|
|
62
|
+
danger: Color | string;
|
|
63
|
+
disputed: Color | string;
|
|
64
|
+
education: Color | string;
|
|
65
|
+
foot: Color | string;
|
|
66
|
+
glacier: Color | string;
|
|
67
|
+
grass: Color | string;
|
|
68
|
+
hospital: Color | string;
|
|
69
|
+
industrial: Color | string;
|
|
70
|
+
label: Color | string;
|
|
71
|
+
labelHalo: Color | string;
|
|
72
|
+
land: Color | string;
|
|
73
|
+
leisure: Color | string;
|
|
74
|
+
motorway: Color | string;
|
|
75
|
+
motorwaybg: Color | string;
|
|
76
|
+
park: Color | string;
|
|
77
|
+
parking: Color | string;
|
|
78
|
+
poi: Color | string;
|
|
79
|
+
prison: Color | string;
|
|
80
|
+
rail: Color | string;
|
|
81
|
+
residential: Color | string;
|
|
82
|
+
rock: Color | string;
|
|
83
|
+
sand: Color | string;
|
|
84
|
+
shield: Color | string;
|
|
85
|
+
street: Color | string;
|
|
86
|
+
streetbg: Color | string;
|
|
87
|
+
subway: Color | string;
|
|
88
|
+
symbol: Color | string;
|
|
89
|
+
trunk: Color | string;
|
|
90
|
+
trunkbg: Color | string;
|
|
91
|
+
waste: Color | string;
|
|
92
|
+
water: Color | string;
|
|
93
|
+
wetland: Color | string;
|
|
94
|
+
wood: Color | string;
|
|
95
|
+
}
|
|
96
|
+
export type StyleBuilderColorsEnsured = Record<keyof StyleBuilderColors, Color>;
|
|
29
97
|
/** Records string values for font properties in a style builder. */
|
|
30
98
|
export type StyleBuilderFonts = {
|
|
31
|
-
|
|
99
|
+
regular: string;
|
|
100
|
+
bold: string;
|
|
32
101
|
};
|
|
33
102
|
/** Defines options for style rules in a style builder. */
|
|
34
103
|
export interface StyleRulesOptions {
|
|
35
|
-
|
|
104
|
+
/**
|
|
105
|
+
* The set of colors used in the style builder.
|
|
106
|
+
*/
|
|
107
|
+
colors: StyleBuilderColorsEnsured;
|
|
108
|
+
/**
|
|
109
|
+
* The set of fonts used in the style builder.
|
|
110
|
+
*/
|
|
36
111
|
fonts: StyleBuilderFonts;
|
|
112
|
+
/**
|
|
113
|
+
* The language used for map labels.
|
|
114
|
+
*/
|
|
37
115
|
language: Language;
|
|
38
116
|
}
|
|
39
117
|
/** Defines the value type for a style rule. */
|
|
@@ -1,94 +1,11 @@
|
|
|
1
1
|
import { StyleBuilder } from '../style_builder/style_builder';
|
|
2
|
-
import type { StyleRules, StyleRulesOptions } from '../style_builder/types';
|
|
2
|
+
import type { StyleBuilderColors, StyleRules, StyleRulesOptions } from '../style_builder/types';
|
|
3
3
|
export default class Colorful extends StyleBuilder {
|
|
4
4
|
readonly name: string;
|
|
5
5
|
defaultFonts: {
|
|
6
6
|
regular: string;
|
|
7
7
|
bold: string;
|
|
8
8
|
};
|
|
9
|
-
defaultColors:
|
|
10
|
-
/** Color for land areas on the map. */
|
|
11
|
-
land: string;
|
|
12
|
-
/** Color for water bodies like lakes and rivers. */
|
|
13
|
-
water: string;
|
|
14
|
-
/** Color for glacier areas, usually shown as white. */
|
|
15
|
-
glacier: string;
|
|
16
|
-
/** Color for wooded or forested areas. */
|
|
17
|
-
wood: string;
|
|
18
|
-
/** Color for grasslands or open fields. */
|
|
19
|
-
grass: string;
|
|
20
|
-
/** Color for parks and recreational areas. */
|
|
21
|
-
park: string;
|
|
22
|
-
/** Color for streets and roads on the map. */
|
|
23
|
-
street: string;
|
|
24
|
-
/** Background color for streets. */
|
|
25
|
-
streetbg: string;
|
|
26
|
-
/** Color for major highways or motorways. */
|
|
27
|
-
motorway: string;
|
|
28
|
-
/** Background color for motorways. */
|
|
29
|
-
motorwaybg: string;
|
|
30
|
-
/** Color for trunk roads. */
|
|
31
|
-
trunk: string;
|
|
32
|
-
/** Background color for trunk roads. */
|
|
33
|
-
trunkbg: string;
|
|
34
|
-
/** Background color for buildings. */
|
|
35
|
-
buildingbg: string;
|
|
36
|
-
/** Primary color for buildings. */
|
|
37
|
-
building: string;
|
|
38
|
-
/** Color used for boundaries. */
|
|
39
|
-
boundary: string;
|
|
40
|
-
/** Color used for disputed boundaries. */
|
|
41
|
-
disputed: string;
|
|
42
|
-
/** Color used for residential areas. */
|
|
43
|
-
residential: string;
|
|
44
|
-
/** Color used for commercial areas. */
|
|
45
|
-
commercial: string;
|
|
46
|
-
/** Color used for industrial areas. */
|
|
47
|
-
industrial: string;
|
|
48
|
-
/** Color used for footpaths and pedestrian areas. */
|
|
49
|
-
foot: string;
|
|
50
|
-
/** Primary color used for labels. */
|
|
51
|
-
label: string;
|
|
52
|
-
/** Color used for label halos. */
|
|
53
|
-
labelHalo: string;
|
|
54
|
-
/** Color used for shields on maps. */
|
|
55
|
-
shield: string;
|
|
56
|
-
/** Color used for agriculture areas. */
|
|
57
|
-
agriculture: string;
|
|
58
|
-
/** Color used for railways. */
|
|
59
|
-
rail: string;
|
|
60
|
-
/** Color used for subways and underground systems. */
|
|
61
|
-
subway: string;
|
|
62
|
-
/** Color used for cycle paths. */
|
|
63
|
-
cycle: string;
|
|
64
|
-
/** Color used for waste areas. */
|
|
65
|
-
waste: string;
|
|
66
|
-
/** Color used for burial and cemetery areas. */
|
|
67
|
-
burial: string;
|
|
68
|
-
/** Color used for sand areas like beaches. */
|
|
69
|
-
sand: string;
|
|
70
|
-
/** Color used for rocky terrain. */
|
|
71
|
-
rock: string;
|
|
72
|
-
/** Color used for leisure areas like parks and gardens. */
|
|
73
|
-
leisure: string;
|
|
74
|
-
/** Color used for wetland areas like marshes. */
|
|
75
|
-
wetland: string;
|
|
76
|
-
/** Color used for various symbols on the map. */
|
|
77
|
-
symbol: string;
|
|
78
|
-
/** Color indicating danger or warning areas. */
|
|
79
|
-
danger: string;
|
|
80
|
-
/** Color used for prison areas. */
|
|
81
|
-
prison: string;
|
|
82
|
-
/** Color used for parking areas. */
|
|
83
|
-
parking: string;
|
|
84
|
-
/** Color used for construction sites. */
|
|
85
|
-
construction: string;
|
|
86
|
-
/** Color used for educational facilities. */
|
|
87
|
-
education: string;
|
|
88
|
-
/** Color used for hospitals and medical facilities. */
|
|
89
|
-
hospital: string;
|
|
90
|
-
/** Color used for points of interest. */
|
|
91
|
-
poi: string;
|
|
92
|
-
};
|
|
9
|
+
defaultColors: StyleBuilderColors;
|
|
93
10
|
protected getStyleRules(options: StyleRulesOptions): StyleRules;
|
|
94
11
|
}
|
package/dist/styles/index.d.ts
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import type { StyleBuilderOptions } from '../style_builder/types';
|
|
2
2
|
import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
3
|
-
export
|
|
3
|
+
export interface StyleBuilderFunction {
|
|
4
4
|
(options?: StyleBuilderOptions): StyleSpecification;
|
|
5
5
|
getOptions(): StyleBuilderOptions;
|
|
6
|
-
}
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare const
|
|
12
|
-
(options?: StyleBuilderOptions): StyleSpecification;
|
|
13
|
-
getOptions(): StyleBuilderOptions;
|
|
14
|
-
};
|
|
15
|
-
export declare const neutrino: {
|
|
16
|
-
(options?: StyleBuilderOptions): StyleSpecification;
|
|
17
|
-
getOptions(): StyleBuilderOptions;
|
|
18
|
-
};
|
|
19
|
-
export declare const empty: {
|
|
20
|
-
(options?: StyleBuilderOptions): StyleSpecification;
|
|
21
|
-
getOptions(): StyleBuilderOptions;
|
|
22
|
-
};
|
|
6
|
+
}
|
|
7
|
+
export declare const colorful: StyleBuilderFunction;
|
|
8
|
+
export declare const eclipse: StyleBuilderFunction;
|
|
9
|
+
export declare const graybeard: StyleBuilderFunction;
|
|
10
|
+
export declare const neutrino: StyleBuilderFunction;
|
|
11
|
+
export declare const empty: StyleBuilderFunction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StyleRules, StyleRulesOptions } from '../style_builder/types';
|
|
1
|
+
import { StyleBuilderColors, StyleRules, StyleRulesOptions } from '../style_builder/types';
|
|
2
2
|
import Colorful from './colorful';
|
|
3
3
|
export default class Neutrino extends Colorful {
|
|
4
4
|
readonly name: string;
|
|
@@ -6,60 +6,6 @@ export default class Neutrino extends Colorful {
|
|
|
6
6
|
regular: string;
|
|
7
7
|
bold: string;
|
|
8
8
|
};
|
|
9
|
-
defaultColors:
|
|
10
|
-
/** Color representing land areas. */
|
|
11
|
-
land: string;
|
|
12
|
-
/** Color representing bodies of water such as lakes and rivers. */
|
|
13
|
-
water: string;
|
|
14
|
-
/** Color for grassy areas and fields. */
|
|
15
|
-
grass: string;
|
|
16
|
-
/** Color for wooded or forested areas. */
|
|
17
|
-
wood: string;
|
|
18
|
-
/** Color used for agricultural land. */
|
|
19
|
-
agriculture: string;
|
|
20
|
-
/** Color for site areas such as parks or recreational facilities. */
|
|
21
|
-
commercial: string;
|
|
22
|
-
/** Primary color for buildings. */
|
|
23
|
-
building: string;
|
|
24
|
-
/** Color for streets and roads. */
|
|
25
|
-
street: string;
|
|
26
|
-
/** Color used for boundaries, such as national or state lines. */
|
|
27
|
-
boundary: string;
|
|
28
|
-
/** Color for footpaths and pedestrian areas. */
|
|
29
|
-
foot: string;
|
|
30
|
-
/** Color used for railways. */
|
|
31
|
-
rail: string;
|
|
32
|
-
/** Primary color used for text labels. */
|
|
33
|
-
label: string;
|
|
34
|
-
buildingbg: string;
|
|
35
|
-
burial: string;
|
|
36
|
-
construction: string;
|
|
37
|
-
cycle: string;
|
|
38
|
-
danger: string;
|
|
39
|
-
disputed: string;
|
|
40
|
-
education: string;
|
|
41
|
-
glacier: string;
|
|
42
|
-
hospital: string;
|
|
43
|
-
industrial: string;
|
|
44
|
-
labelHalo: string;
|
|
45
|
-
leisure: string;
|
|
46
|
-
motorway: string;
|
|
47
|
-
motorwaybg: string;
|
|
48
|
-
park: string;
|
|
49
|
-
parking: string;
|
|
50
|
-
poi: string;
|
|
51
|
-
prison: string;
|
|
52
|
-
residential: string;
|
|
53
|
-
rock: string;
|
|
54
|
-
sand: string;
|
|
55
|
-
shield: string;
|
|
56
|
-
streetbg: string;
|
|
57
|
-
subway: string;
|
|
58
|
-
symbol: string;
|
|
59
|
-
trunk: string;
|
|
60
|
-
trunkbg: string;
|
|
61
|
-
waste: string;
|
|
62
|
-
wetland: string;
|
|
63
|
-
};
|
|
9
|
+
defaultColors: StyleBuilderColors;
|
|
64
10
|
protected getStyleRules(options: StyleRulesOptions): StyleRules;
|
|
65
11
|
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versatiles/style",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.4",
|
|
4
4
|
"description": "Generate StyleJSON for MapLibre",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"check": "npm run lint && npm run test && npm run build",
|
|
9
|
-
"build": "rm -rf release; npm run build-browser && npm run build-node && npm run build-styles && npm run build-sprites",
|
|
9
|
+
"build": "rm -rf release; npm run build-browser && npm run build-node && npm run build-styles && npm run build-sprites && npm run doc",
|
|
10
10
|
"build-browser": "rollup -c=rollup.config.js && $(cd release/versatiles-style; tar -cf - versatiles-style.* | gzip -9 > ../versatiles-style.tar.gz)",
|
|
11
11
|
"build-node": "rm -rf dist && tsc -p tsconfig.node.json && chmod +x dist/index.js",
|
|
12
12
|
"build-styles": "tsx scripts/build-styles.ts",
|
|
13
13
|
"build-sprites": "tsx scripts/build-sprites.ts",
|
|
14
14
|
"dev": "tsx scripts/dev.ts",
|
|
15
|
-
"
|
|
15
|
+
"doc": "tsx scripts/screenshots.ts && typedoc --options typedoc.json",
|
|
16
16
|
"lint": "eslint --color .",
|
|
17
17
|
"prepack": "npm run build",
|
|
18
18
|
"release": "npx vrt release-npm",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"dist/**/*.d.ts"
|
|
37
37
|
],
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@maplibre/maplibre-gl-native": "^6.0.0",
|
|
39
40
|
"@maplibre/maplibre-gl-style-spec": "^23.1.0",
|
|
40
41
|
"@rollup/plugin-commonjs": "^28.0.2",
|
|
41
42
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
@@ -45,10 +46,10 @@
|
|
|
45
46
|
"@types/brace-expansion": "^1.1.2",
|
|
46
47
|
"@types/inquirer": "^9.0.7",
|
|
47
48
|
"@types/jest": "^29.5.14",
|
|
48
|
-
"@types/node": "^22.10.
|
|
49
|
+
"@types/node": "^22.10.10",
|
|
49
50
|
"@types/tar-stream": "^3.1.3",
|
|
50
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
51
|
-
"@typescript-eslint/parser": "^8.
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^8.21.0",
|
|
52
|
+
"@typescript-eslint/parser": "^8.21.0",
|
|
52
53
|
"@versatiles/release-tool": "^1.2.6",
|
|
53
54
|
"bin-pack": "^1.0.2",
|
|
54
55
|
"eslint": "^9.18.0",
|
|
@@ -57,14 +58,16 @@
|
|
|
57
58
|
"jest-environment-jsdom": "^29.7.0",
|
|
58
59
|
"jest-ts-webcompat-resolver": "^1.0.0",
|
|
59
60
|
"npm-check-updates": "^17.1.14",
|
|
60
|
-
"rollup": "^4.
|
|
61
|
+
"rollup": "^4.32.0",
|
|
61
62
|
"rollup-plugin-dts": "^6.1.1",
|
|
62
63
|
"sharp": "^0.33.5",
|
|
63
64
|
"tar-stream": "^3.1.7",
|
|
64
65
|
"ts-jest": "^29.2.5",
|
|
65
66
|
"ts-node": "^10.9.2",
|
|
66
67
|
"tsx": "^4.19.2",
|
|
68
|
+
"typedoc": "^0.27.6",
|
|
69
|
+
"typedoc-plugin-markdown": "^4.4.1",
|
|
67
70
|
"typescript": "^5.7.3",
|
|
68
|
-
"typescript-eslint": "^8.
|
|
71
|
+
"typescript-eslint": "^8.21.0"
|
|
69
72
|
}
|
|
70
73
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { Language } from './types';
|