@versatiles/style 5.2.2 → 5.2.3
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 +1 -69
- package/dist/color/abstract.d.ts +5 -4
- package/dist/color/abstract.js +4 -0
- package/dist/color/hsl.d.ts +7 -7
- package/dist/color/hsl.js +10 -17
- package/dist/color/hsv.d.ts +8 -7
- package/dist/color/hsv.js +10 -11
- package/dist/color/index.d.ts +5 -5
- package/dist/color/index.js +6 -5
- package/dist/color/random.d.ts +1 -1
- package/dist/color/random.js +3 -2
- package/dist/color/rgb.d.ts +7 -7
- package/dist/color/rgb.js +15 -42
- package/dist/color/utils.js +1 -0
- package/dist/guess_style/guess_style.d.ts +1 -1
- package/dist/guess_style/guess_style.js +6 -5
- package/dist/guess_style/index.d.ts +2 -2
- package/dist/guess_style/index.js +2 -1
- package/dist/index.d.ts +28 -11
- package/dist/index.js +10 -3
- package/dist/lib/utils.js +2 -1
- package/dist/shortbread/index.d.ts +2 -2
- package/dist/shortbread/index.js +3 -2
- package/dist/shortbread/layers.d.ts +2 -2
- package/dist/shortbread/layers.js +1 -0
- package/dist/shortbread/properties.js +1 -0
- package/dist/shortbread/template.js +1 -0
- package/dist/style_builder/decorator.d.ts +3 -3
- package/dist/style_builder/decorator.js +4 -3
- package/dist/style_builder/index.d.ts +1 -1
- package/dist/style_builder/index.js +1 -0
- package/dist/style_builder/recolor.d.ts +1 -1
- package/dist/style_builder/recolor.js +2 -1
- package/dist/style_builder/style_builder.d.ts +11 -11
- package/dist/style_builder/style_builder.js +13 -10
- package/dist/style_builder/types.d.ts +19 -16
- package/dist/style_builder/types.js +1 -0
- package/dist/styles/colorful.d.ts +4 -4
- package/dist/styles/colorful.js +2 -1
- package/dist/styles/eclipse.d.ts +1 -1
- package/dist/styles/eclipse.js +2 -1
- package/dist/styles/empty.d.ts +4 -9
- package/dist/styles/empty.js +4 -9
- package/dist/styles/graybeard.d.ts +1 -1
- package/dist/styles/graybeard.js +2 -1
- package/dist/styles/index.d.ts +20 -26
- package/dist/styles/index.js +6 -5
- package/dist/styles/neutrino.d.ts +34 -5
- package/dist/styles/neutrino.js +35 -4
- package/dist/types/index.d.ts +5 -5
- package/dist/types/index.js +3 -2
- package/dist/types/maplibre.js +1 -0
- package/dist/types/tilejson.d.ts +1 -1
- package/dist/types/tilejson.js +1 -0
- package/dist/types/vector_layer.js +1 -0
- package/package.json +1 -1
package/README.MD
CHANGED
|
@@ -83,71 +83,7 @@ This library provides:
|
|
|
83
83
|
- `style = graybeard(options);`
|
|
84
84
|
- `style = neutrino(options);`
|
|
85
85
|
|
|
86
|
-
Where `options` is an optional object
|
|
87
|
-
|
|
88
|
-
```javascript
|
|
89
|
-
const options: StyleBuilderOptions<Colorful> = {
|
|
90
|
-
// The base URL for loading external resources like tiles, sprites, and fonts.
|
|
91
|
-
// Default: document.location.origin (in the browser), or 'https://tiles.versatiles.org'
|
|
92
|
-
baseUrl?: string;
|
|
93
|
-
|
|
94
|
-
// The URL template for loading font glyphs, formatted with '{fontstack}' and '{range}' placeholders.
|
|
95
|
-
// Default: '/assets/glyphs/{fontstack}/{range}.pbf'
|
|
96
|
-
glyphs?: string;
|
|
97
|
-
|
|
98
|
-
// The URL for loading sprite images and metadata.
|
|
99
|
-
// Default: [{ id: 'basics', url: '/assets/sprites/basics/sprites' }]
|
|
100
|
-
sprite?: string | { id: string; url: string }[];
|
|
101
|
-
|
|
102
|
-
// An array of URL templates for loading map tiles, using '{z}', '{x}', and '{y}' placeholders.
|
|
103
|
-
// Default: ['/tiles/osm/{z}/{x}/{y}']
|
|
104
|
-
tiles?: string[];
|
|
105
|
-
|
|
106
|
-
// If set to true, hides all map labels.
|
|
107
|
-
// Default: false
|
|
108
|
-
hideLabels?: boolean;
|
|
109
|
-
|
|
110
|
-
// Set the language ('en', 'de') of all map labels.
|
|
111
|
-
// A null value means that the language of the country in which the label is drawn will be used.
|
|
112
|
-
// Default: null
|
|
113
|
-
language?: Language;
|
|
114
|
-
|
|
115
|
-
// An object specifying overrides for default color values, keyed by the color names.
|
|
116
|
-
colors?: Partial<StyleBuilderColorStrings<T>>;
|
|
117
|
-
|
|
118
|
-
// An object specifying overrides for default font names, keyed by the font names.
|
|
119
|
-
fonts?: Partial<StyleBuilderFontStrings<T>>;
|
|
120
|
-
|
|
121
|
-
// Options for color adjustments and transformations applied to the entire style.
|
|
122
|
-
recolor?: RecolorOptions;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface RecolorOptions {
|
|
126
|
-
// If true, inverts all colors.
|
|
127
|
-
invertBrightness?: boolean;
|
|
128
|
-
|
|
129
|
-
// Rotate the hue of all colors (in degrees).
|
|
130
|
-
rotate?: number;
|
|
131
|
-
|
|
132
|
-
// Adjusts the saturation level of all colors. Positive values increase saturation, negative values decrease it.
|
|
133
|
-
saturate?: number;
|
|
134
|
-
|
|
135
|
-
// Adjusts the gamma of all colors. Affects the brightness in a non-linear manner.
|
|
136
|
-
gamma?: number;
|
|
137
|
-
|
|
138
|
-
// Adjusts the contrast of all colors. Higher values produce more contrast.
|
|
139
|
-
contrast?: number;
|
|
140
|
-
|
|
141
|
-
// Adjusts the brightness of all colors. Positive values make it brighter, negative values make it darker.
|
|
142
|
-
brightness?: number;
|
|
143
|
-
|
|
144
|
-
// Specifies the intensity of the tinting effect. Ranges from 0 (no effect) to 1 (full effect).
|
|
145
|
-
tint?: number;
|
|
146
|
-
|
|
147
|
-
// Specifies the color used for tinting, in a string format (e.g., '#FF0000').
|
|
148
|
-
tintColor?: string;
|
|
149
|
-
}
|
|
150
|
-
```
|
|
86
|
+
Where `options` is an optional object
|
|
151
87
|
|
|
152
88
|
### Method: `guessStyle(options)`
|
|
153
89
|
|
|
@@ -156,10 +92,6 @@ const style = guessStyle(options);
|
|
|
156
92
|
```
|
|
157
93
|
|
|
158
94
|
|
|
159
|
-
GuessStyleOptions
|
|
160
|
-
|
|
161
|
-
<sup><a href="https://github.com/versatiles-org/versatiles-style/blob/be6dcfe/src/lib/style_guesser.ts#L13">\[src]</a></sup>
|
|
162
|
-
|
|
163
95
|
**Parameters:**
|
|
164
96
|
|
|
165
97
|
* <code>opt: TileJSONOption</code>
|
package/dist/color/abstract.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { HSL } from './hsl
|
|
2
|
-
import type { HSV } from './hsv
|
|
3
|
-
import { RandomColorOptions } from './random
|
|
4
|
-
import type { RGB } from './rgb
|
|
1
|
+
import type { HSL } from './hsl';
|
|
2
|
+
import type { HSV } from './hsv';
|
|
3
|
+
import { RandomColorOptions } from './random';
|
|
4
|
+
import type { RGB } from './rgb';
|
|
5
5
|
export declare abstract class Color {
|
|
6
6
|
static parse: (str: string) => Color;
|
|
7
7
|
static HSL: typeof HSL;
|
|
@@ -29,5 +29,6 @@ export declare abstract class Color {
|
|
|
29
29
|
lighten(value: number): RGB;
|
|
30
30
|
darken(value: number): RGB;
|
|
31
31
|
tint(value: number, tintColor: Color): RGB;
|
|
32
|
+
setHue(value: number): HSV;
|
|
32
33
|
abstract fade(value: number): Color;
|
|
33
34
|
}
|
package/dist/color/abstract.js
CHANGED
package/dist/color/hsl.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Color } from './abstract
|
|
2
|
-
import { HSV } from './hsv
|
|
3
|
-
import { RGB } from './rgb
|
|
1
|
+
import { Color } from './abstract';
|
|
2
|
+
import { HSV } from './hsv';
|
|
3
|
+
import { RGB } from './rgb';
|
|
4
4
|
export declare class HSL extends Color {
|
|
5
|
-
h: number;
|
|
6
|
-
s: number;
|
|
7
|
-
l: number;
|
|
8
|
-
a: number;
|
|
5
|
+
readonly h: number;
|
|
6
|
+
readonly s: number;
|
|
7
|
+
readonly l: number;
|
|
8
|
+
readonly a: number;
|
|
9
9
|
constructor(h: number, s: number, l: number, a?: number);
|
|
10
10
|
asArray(): [number, number, number, number];
|
|
11
11
|
round(): HSL;
|
package/dist/color/hsl.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Color } from './abstract
|
|
2
|
-
import { HSV } from './hsv
|
|
3
|
-
import { RGB } from './rgb
|
|
4
|
-
import { clamp, formatFloat, mod } from './utils
|
|
1
|
+
import { Color } from './abstract';
|
|
2
|
+
import { HSV } from './hsv';
|
|
3
|
+
import { RGB } from './rgb';
|
|
4
|
+
import { clamp, formatFloat, mod } from './utils';
|
|
5
5
|
export class HSL extends Color {
|
|
6
6
|
h = 0; // between 0 and 360
|
|
7
7
|
s = 0; // between 0 and 100
|
|
@@ -18,11 +18,7 @@ export class HSL extends Color {
|
|
|
18
18
|
return [this.h, this.s, this.l, this.a];
|
|
19
19
|
}
|
|
20
20
|
round() {
|
|
21
|
-
this.h
|
|
22
|
-
this.s = Math.round(this.s);
|
|
23
|
-
this.l = Math.round(this.l);
|
|
24
|
-
this.a = Math.round(this.a * 1000) / 1000;
|
|
25
|
-
return this;
|
|
21
|
+
return new HSL(Math.round(this.h), Math.round(this.s), Math.round(this.l), Math.round(this.a * 1000) / 1000);
|
|
26
22
|
}
|
|
27
23
|
clone() {
|
|
28
24
|
return new HSL(this.h, this.s, this.l, this.a);
|
|
@@ -85,19 +81,16 @@ export class HSL extends Color {
|
|
|
85
81
|
throw new Error(`Invalid HSL color string: "${str}"`);
|
|
86
82
|
}
|
|
87
83
|
invertLuminosity() {
|
|
88
|
-
this.
|
|
89
|
-
return this;
|
|
84
|
+
return new HSL(this.h, this.s, 100 - this.l, this.a);
|
|
90
85
|
}
|
|
91
86
|
rotateHue(offset) {
|
|
92
|
-
|
|
93
|
-
return this;
|
|
87
|
+
return new HSL(mod(this.h + offset, 360), this.s, this.l, this.a);
|
|
94
88
|
}
|
|
95
89
|
saturate(ratio) {
|
|
96
|
-
this.
|
|
97
|
-
return this;
|
|
90
|
+
return new HSL(this.h, clamp(this.s * (1 + ratio), 0, 100), this.l, this.a);
|
|
98
91
|
}
|
|
99
92
|
fade(value) {
|
|
100
|
-
this.a
|
|
101
|
-
return this;
|
|
93
|
+
return new HSL(this.h, this.s, this.l, this.a * (1 - value));
|
|
102
94
|
}
|
|
103
95
|
}
|
|
96
|
+
//# sourceMappingURL=hsl.js.map
|
package/dist/color/hsv.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Color } from './abstract
|
|
2
|
-
import { HSL } from './hsl
|
|
3
|
-
import { RGB } from './rgb
|
|
1
|
+
import { Color } from './abstract';
|
|
2
|
+
import { HSL } from './hsl';
|
|
3
|
+
import { RGB } from './rgb';
|
|
4
4
|
export declare class HSV extends Color {
|
|
5
|
-
h: number;
|
|
6
|
-
s: number;
|
|
7
|
-
v: number;
|
|
8
|
-
a: number;
|
|
5
|
+
readonly h: number;
|
|
6
|
+
readonly s: number;
|
|
7
|
+
readonly v: number;
|
|
8
|
+
readonly a: number;
|
|
9
9
|
constructor(h: number, s: number, v: number, a?: number);
|
|
10
10
|
asArray(): [number, number, number, number];
|
|
11
11
|
round(): HSV;
|
|
@@ -16,4 +16,5 @@ export declare class HSV extends Color {
|
|
|
16
16
|
toHSV(): HSV;
|
|
17
17
|
asRGB(): RGB;
|
|
18
18
|
fade(value: number): HSV;
|
|
19
|
+
setHue(value: number): HSV;
|
|
19
20
|
}
|
package/dist/color/hsv.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Color } from './abstract
|
|
2
|
-
import { HSL } from './hsl
|
|
3
|
-
import { RGB } from './rgb
|
|
4
|
-
import { clamp, mod } from './utils
|
|
1
|
+
import { Color } from './abstract';
|
|
2
|
+
import { HSL } from './hsl';
|
|
3
|
+
import { RGB } from './rgb';
|
|
4
|
+
import { clamp, mod } from './utils';
|
|
5
5
|
export class HSV extends Color {
|
|
6
6
|
h = 0; // between 0 and 360
|
|
7
7
|
s = 0; // between 0 and 100
|
|
@@ -18,11 +18,7 @@ export class HSV extends Color {
|
|
|
18
18
|
return [this.h, this.s, this.v, this.a];
|
|
19
19
|
}
|
|
20
20
|
round() {
|
|
21
|
-
this.h
|
|
22
|
-
this.s = Math.round(this.s);
|
|
23
|
-
this.v = Math.round(this.v);
|
|
24
|
-
this.a = Math.round(this.a * 1000) / 1000;
|
|
25
|
-
return this;
|
|
21
|
+
return new HSV(Math.round(this.h), Math.round(this.s), Math.round(this.v), Math.round(this.a * 1000) / 1000);
|
|
26
22
|
}
|
|
27
23
|
asString() {
|
|
28
24
|
return this.asHSL().asString();
|
|
@@ -95,7 +91,10 @@ export class HSV extends Color {
|
|
|
95
91
|
return new RGB(r * 255, g * 255, b * 255, this.a);
|
|
96
92
|
}
|
|
97
93
|
fade(value) {
|
|
98
|
-
this.a
|
|
99
|
-
|
|
94
|
+
return new HSV(this.h, this.s, this.v, this.a * (1 - value));
|
|
95
|
+
}
|
|
96
|
+
setHue(value) {
|
|
97
|
+
return new HSV(value, this.s, this.v, this.a);
|
|
100
98
|
}
|
|
101
99
|
}
|
|
100
|
+
//# sourceMappingURL=hsv.js.map
|
package/dist/color/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Color } from './abstract
|
|
2
|
-
export type { RandomColorOptions } from './random
|
|
3
|
-
export type { HSL } from './hsl
|
|
4
|
-
export type { HSV } from './hsv
|
|
5
|
-
export type { RGB } from './rgb
|
|
1
|
+
import { Color } from './abstract';
|
|
2
|
+
export type { RandomColorOptions } from './random';
|
|
3
|
+
export type { HSL } from './hsl';
|
|
4
|
+
export type { HSV } from './hsv';
|
|
5
|
+
export type { RGB } from './rgb';
|
|
6
6
|
export { Color };
|
package/dist/color/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Color } from './abstract
|
|
2
|
-
import { HSL } from './hsl
|
|
3
|
-
import { HSV } from './hsv
|
|
4
|
-
import randomColor from './random
|
|
5
|
-
import { RGB } from './rgb
|
|
1
|
+
import { Color } from './abstract';
|
|
2
|
+
import { HSL } from './hsl';
|
|
3
|
+
import { HSV } from './hsv';
|
|
4
|
+
import randomColor from './random';
|
|
5
|
+
import { RGB } from './rgb';
|
|
6
6
|
Color.parse = function (str) {
|
|
7
7
|
str = str.trim().toLowerCase();
|
|
8
8
|
if (str.startsWith('#'))
|
|
@@ -24,3 +24,4 @@ Color.HSV = HSV;
|
|
|
24
24
|
Color.RGB = RGB;
|
|
25
25
|
Color.random = randomColor;
|
|
26
26
|
export { Color };
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
package/dist/color/random.d.ts
CHANGED
package/dist/color/random.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HSV } from './hsv
|
|
2
|
-
import { mod } from './utils
|
|
1
|
+
import { HSV } from './hsv';
|
|
2
|
+
import { mod } from './utils';
|
|
3
3
|
let colorDictionary = new Map();
|
|
4
4
|
export default function randomColor(options) {
|
|
5
5
|
if (colorDictionary.size === 0)
|
|
@@ -131,3 +131,4 @@ function getColorInfo(hue) {
|
|
|
131
131
|
}
|
|
132
132
|
throw Error('Color hue value not found');
|
|
133
133
|
}
|
|
134
|
+
//# sourceMappingURL=random.js.map
|
package/dist/color/rgb.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { HSL } from './hsl
|
|
2
|
-
import { HSV } from './hsv
|
|
3
|
-
import { Color } from './abstract
|
|
1
|
+
import { HSL } from './hsl';
|
|
2
|
+
import { HSV } from './hsv';
|
|
3
|
+
import { Color } from './abstract';
|
|
4
4
|
export declare class RGB extends Color {
|
|
5
|
-
r: number;
|
|
6
|
-
g: number;
|
|
7
|
-
b: number;
|
|
8
|
-
a: number;
|
|
5
|
+
readonly r: number;
|
|
6
|
+
readonly g: number;
|
|
7
|
+
readonly b: number;
|
|
8
|
+
readonly a: number;
|
|
9
9
|
constructor(r: number, g: number, b: number, a?: number);
|
|
10
10
|
clone(): RGB;
|
|
11
11
|
asArray(): [number, number, number, number];
|
package/dist/color/rgb.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HSL } from './hsl
|
|
2
|
-
import { HSV } from './hsv
|
|
3
|
-
import { Color } from './abstract
|
|
4
|
-
import { clamp, formatFloat } from './utils
|
|
1
|
+
import { HSL } from './hsl';
|
|
2
|
+
import { HSV } from './hsv';
|
|
3
|
+
import { Color } from './abstract';
|
|
4
|
+
import { clamp, formatFloat } from './utils';
|
|
5
5
|
export class RGB extends Color {
|
|
6
6
|
r = 0; // between 0 and 255
|
|
7
7
|
g = 0; // between 0 and 255
|
|
@@ -21,11 +21,7 @@ export class RGB extends Color {
|
|
|
21
21
|
return [this.r, this.g, this.b, this.a];
|
|
22
22
|
}
|
|
23
23
|
round() {
|
|
24
|
-
this.r
|
|
25
|
-
this.g = Math.round(this.g);
|
|
26
|
-
this.b = Math.round(this.b);
|
|
27
|
-
this.a = Math.round(this.a * 1000) / 1000;
|
|
28
|
-
return this;
|
|
24
|
+
return new RGB(Math.round(this.r), Math.round(this.g), Math.round(this.b), Math.round(this.a * 1000) / 1000);
|
|
29
25
|
}
|
|
30
26
|
asString() {
|
|
31
27
|
if (this.a === 1) {
|
|
@@ -155,26 +151,17 @@ export class RGB extends Color {
|
|
|
155
151
|
value = 1e-3;
|
|
156
152
|
if (value > 1e3)
|
|
157
153
|
value = 1e3;
|
|
158
|
-
this.r
|
|
159
|
-
this.g = Math.pow(this.g / 255, value) * 255;
|
|
160
|
-
this.b = Math.pow(this.b / 255, value) * 255;
|
|
161
|
-
return this;
|
|
154
|
+
return new RGB(Math.pow(this.r / 255, value) * 255, Math.pow(this.g / 255, value) * 255, Math.pow(this.b / 255, value) * 255, this.a);
|
|
162
155
|
}
|
|
163
156
|
invert() {
|
|
164
|
-
this.r
|
|
165
|
-
this.g = 255 - this.g;
|
|
166
|
-
this.b = 255 - this.b;
|
|
167
|
-
return this;
|
|
157
|
+
return new RGB(255 - this.r, 255 - this.g, 255 - this.b, this.a);
|
|
168
158
|
}
|
|
169
159
|
contrast(value) {
|
|
170
160
|
if (value < 0)
|
|
171
161
|
value = 0;
|
|
172
162
|
if (value > 1e6)
|
|
173
163
|
value = 1e6;
|
|
174
|
-
this.r
|
|
175
|
-
this.g = clamp((this.g - 127.5) * value + 127.5, 0, 255);
|
|
176
|
-
this.b = clamp((this.b - 127.5) * value + 127.5, 0, 255);
|
|
177
|
-
return this;
|
|
164
|
+
return new RGB(clamp((this.r - 127.5) * value + 127.5, 0, 255), clamp((this.g - 127.5) * value + 127.5, 0, 255), clamp((this.b - 127.5) * value + 127.5, 0, 255), this.a);
|
|
178
165
|
}
|
|
179
166
|
brightness(value) {
|
|
180
167
|
if (value < -1)
|
|
@@ -183,38 +170,24 @@ export class RGB extends Color {
|
|
|
183
170
|
value = 1;
|
|
184
171
|
const a = 1 - Math.abs(value);
|
|
185
172
|
const b = (value < 0) ? 0 : 255 * value;
|
|
186
|
-
this.r
|
|
187
|
-
this.g = this.g * a + b;
|
|
188
|
-
this.b = this.b * a + b;
|
|
189
|
-
return this;
|
|
173
|
+
return new RGB(this.r * a + b, this.g * a + b, this.b * a + b, this.a);
|
|
190
174
|
}
|
|
191
175
|
tint(value, tintColor) {
|
|
192
176
|
if (value < 0)
|
|
193
177
|
value = 0;
|
|
194
178
|
if (value > 1)
|
|
195
179
|
value = 1;
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
const rgbNew = hsv.toRGB();
|
|
199
|
-
rgbNew.r = this.r * (1 - value) + value * rgbNew.r;
|
|
200
|
-
rgbNew.g = this.g * (1 - value) + value * rgbNew.g;
|
|
201
|
-
rgbNew.b = this.b * (1 - value) + value * rgbNew.b;
|
|
202
|
-
return rgbNew;
|
|
180
|
+
const rgbNew = this.setHue(tintColor.toHSV().h).toRGB();
|
|
181
|
+
return new RGB(this.r * (1 - value) + value * rgbNew.r, this.g * (1 - value) + value * rgbNew.g, this.b * (1 - value) + value * rgbNew.b, this.a);
|
|
203
182
|
}
|
|
204
183
|
lighten(ratio) {
|
|
205
|
-
this.r
|
|
206
|
-
this.g = clamp(255 - (255 - this.g) * (1 - ratio), 0, 255);
|
|
207
|
-
this.b = clamp(255 - (255 - this.b) * (1 - ratio), 0, 255);
|
|
208
|
-
return this;
|
|
184
|
+
return new RGB(clamp(255 - (255 - this.r) * (1 - ratio), 0, 255), clamp(255 - (255 - this.g) * (1 - ratio), 0, 255), clamp(255 - (255 - this.b) * (1 - ratio), 0, 255), this.a);
|
|
209
185
|
}
|
|
210
186
|
darken(ratio) {
|
|
211
|
-
this.r
|
|
212
|
-
this.g = clamp(this.g * (1 - ratio), 0, 255);
|
|
213
|
-
this.b = clamp(this.b * (1 - ratio), 0, 255);
|
|
214
|
-
return this;
|
|
187
|
+
return new RGB(clamp(this.r * (1 - ratio), 0, 255), clamp(this.g * (1 - ratio), 0, 255), clamp(this.b * (1 - ratio), 0, 255), this.a);
|
|
215
188
|
}
|
|
216
189
|
fade(value) {
|
|
217
|
-
this.a
|
|
218
|
-
return this;
|
|
190
|
+
return new RGB(this.r, this.g, this.b, this.a * (1 - value));
|
|
219
191
|
}
|
|
220
192
|
}
|
|
193
|
+
//# sourceMappingURL=rgb.js.map
|
package/dist/color/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TileJSONSpecification } from '../types/index
|
|
1
|
+
import type { TileJSONSpecification } from '../types/index';
|
|
2
2
|
import type { SpriteSpecification, StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
3
3
|
export interface GuessStyleOptions {
|
|
4
4
|
baseUrl?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isTileJSONSpecification } from '../types/index
|
|
2
|
-
import { deepClone, resolveUrl } from '../lib/utils
|
|
3
|
-
import { colorful } from '../styles/index
|
|
4
|
-
import { Color } from '../color/index
|
|
5
|
-
import { isRasterTileJSONSpecification } from '../types/tilejson
|
|
1
|
+
import { isTileJSONSpecification } from '../types/index';
|
|
2
|
+
import { deepClone, resolveUrl } from '../lib/utils';
|
|
3
|
+
import { colorful } from '../styles/index';
|
|
4
|
+
import { Color } from '../color/index';
|
|
5
|
+
import { isRasterTileJSONSpecification } from '../types/tilejson';
|
|
6
6
|
export function guessStyle(tileJSON, options) {
|
|
7
7
|
tileJSON = deepClone(tileJSON);
|
|
8
8
|
if (options && options.baseUrl) {
|
|
@@ -144,3 +144,4 @@ function sourceFromSpec(spec, type) {
|
|
|
144
144
|
source.scheme = spec.scheme;
|
|
145
145
|
return source;
|
|
146
146
|
}
|
|
147
|
+
//# sourceMappingURL=guess_style.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { GuessStyleOptions } from './guess_style
|
|
2
|
-
export { guessStyle } from './guess_style
|
|
1
|
+
export type { GuessStyleOptions } from './guess_style';
|
|
2
|
+
export { guessStyle } from './guess_style';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { guessStyle } from './guess_style
|
|
1
|
+
export { guessStyle } from './guess_style';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
export type { colorful, eclipse, graybeard, neutrino } from './styles/index';
|
|
2
|
+
export declare const styles: {
|
|
3
|
+
colorful: {
|
|
4
|
+
(options?: import("./style_builder/types").StyleBuilderOptions): import("@maplibre/maplibre-gl-style-spec").StyleSpecification;
|
|
5
|
+
getOptions(): import("./style_builder/types").StyleBuilderOptions;
|
|
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
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type { GuessStyleOptions } from './guess_style/index';
|
|
21
|
+
export type { RGB, HSL, HSV, RandomColorOptions } from './color/index';
|
|
22
|
+
export type { TileJSONSpecification, TileJSONSpecificationRaster, TileJSONSpecificationVector } from './types/tilejson';
|
|
23
|
+
export type { VectorLayer } from './types/index';
|
|
24
|
+
export type { StyleBuilderOptions, StyleBuilderColorStrings, Language, StyleBuilderColorKeys, StyleBuilderFonts } from './style_builder/types';
|
|
25
|
+
export type { RecolorOptions } from './style_builder/recolor';
|
|
26
|
+
export type { StyleBuilder } from './style_builder/style_builder';
|
|
27
|
+
export { guessStyle } from './guess_style/index';
|
|
28
|
+
export { Color } from './color/index';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import { colorful, eclipse, graybeard, neutrino } from './styles/index';
|
|
2
|
+
export const styles = {
|
|
3
|
+
colorful,
|
|
4
|
+
eclipse,
|
|
5
|
+
graybeard,
|
|
6
|
+
neutrino,
|
|
7
|
+
};
|
|
8
|
+
export { guessStyle } from './guess_style/index';
|
|
9
|
+
export { Color } from './color/index';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Color } from '../color/index
|
|
1
|
+
import { Color } from '../color/index';
|
|
2
2
|
// Utility function to deep clone an object
|
|
3
3
|
export function deepClone(obj) {
|
|
4
4
|
const type = typeof obj;
|
|
@@ -123,3 +123,4 @@ export function basename(url) {
|
|
|
123
123
|
url = url.replace(/\/+$/, '');
|
|
124
124
|
return url.split('/').pop() ?? '';
|
|
125
125
|
}
|
|
126
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getShortbreadTemplate } from './template
|
|
2
|
-
export { getShortbreadLayers } from './layers
|
|
1
|
+
export { getShortbreadTemplate } from './template';
|
|
2
|
+
export { getShortbreadLayers } from './layers';
|
package/dist/shortbread/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { getShortbreadTemplate } from './template
|
|
2
|
-
export { getShortbreadLayers } from './layers
|
|
1
|
+
export { getShortbreadTemplate } from './template';
|
|
2
|
+
export { getShortbreadLayers } from './layers';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Language } from '../style_builder/index
|
|
2
|
-
import type { MaplibreLayerDefinition } from '../types/index
|
|
1
|
+
import type { Language } from '../style_builder/index';
|
|
2
|
+
import type { MaplibreLayerDefinition } from '../types/index';
|
|
3
3
|
export declare function getShortbreadLayers(option: {
|
|
4
4
|
readonly language: Language;
|
|
5
5
|
}): MaplibreLayerDefinition[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MaplibreLayer } from '../types/index
|
|
2
|
-
import type { StyleRules } from './types
|
|
3
|
-
import type { CachedRecolor } from './recolor
|
|
1
|
+
import type { MaplibreLayer } from '../types/index';
|
|
2
|
+
import type { StyleRules } from './types';
|
|
3
|
+
import type { CachedRecolor } from './recolor';
|
|
4
4
|
export declare function decorate(layers: MaplibreLayer[], rules: StyleRules, recolor: CachedRecolor): MaplibreLayer[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Color } from '../color/index
|
|
1
|
+
import { Color } from '../color/index';
|
|
2
2
|
import expandBraces from 'brace-expansion';
|
|
3
|
-
import maplibreProperties from '../shortbread/properties
|
|
4
|
-
import { deepMerge } from '../lib/utils
|
|
3
|
+
import maplibreProperties from '../shortbread/properties';
|
|
4
|
+
import { deepMerge } from '../lib/utils';
|
|
5
5
|
export function decorate(layers, rules, recolor) {
|
|
6
6
|
const layerIds = layers.map(l => l.id);
|
|
7
7
|
const layerIdSet = new Set(layerIds);
|
|
@@ -124,3 +124,4 @@ export function decorate(layers, rules, recolor) {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
+
//# sourceMappingURL=decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { Language } from './types
|
|
1
|
+
export type { Language } from './types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Color } from '../color/index
|
|
1
|
+
import { Color } from '../color/index';
|
|
2
2
|
export function getDefaultRecolorFlags() {
|
|
3
3
|
return {
|
|
4
4
|
invertBrightness: false,
|
|
@@ -86,3 +86,4 @@ export function recolor(color, opt) {
|
|
|
86
86
|
color = color.tint(opt.tint, Color.parse(opt.tintColor));
|
|
87
87
|
return color;
|
|
88
88
|
}
|
|
89
|
+
//# sourceMappingURL=recolor.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Color } from '../color/index
|
|
2
|
-
import type { StyleSpecification } from '../types/maplibre
|
|
3
|
-
import type { StyleBuilderColorStrings, StyleBuilderColors,
|
|
4
|
-
import type { StyleRules, StyleRulesOptions } from './types
|
|
5
|
-
export declare abstract class StyleBuilder
|
|
1
|
+
import { Color } from '../color/index';
|
|
2
|
+
import type { StyleSpecification } from '../types/maplibre';
|
|
3
|
+
import type { StyleBuilderColorStrings, StyleBuilderColors, StyleBuilderFonts, StyleBuilderOptions } from './types';
|
|
4
|
+
import type { StyleRules, StyleRulesOptions } from './types';
|
|
5
|
+
export declare abstract class StyleBuilder {
|
|
6
6
|
#private;
|
|
7
7
|
abstract readonly name: string;
|
|
8
|
-
abstract readonly defaultColors: StyleBuilderColorStrings
|
|
9
|
-
abstract readonly defaultFonts:
|
|
10
|
-
build(options?: StyleBuilderOptions
|
|
11
|
-
getColors(colors: StyleBuilderColorStrings
|
|
12
|
-
getDefaultOptions(): StyleBuilderOptions
|
|
8
|
+
abstract readonly defaultColors: StyleBuilderColorStrings;
|
|
9
|
+
abstract readonly defaultFonts: StyleBuilderFonts;
|
|
10
|
+
build(options?: StyleBuilderOptions): StyleSpecification;
|
|
11
|
+
getColors(colors: StyleBuilderColorStrings): StyleBuilderColors;
|
|
12
|
+
getDefaultOptions(): StyleBuilderOptions;
|
|
13
13
|
protected transformDefaultColors(callback: (color: Color) => Color): void;
|
|
14
|
-
protected abstract getStyleRules(options: StyleRulesOptions
|
|
14
|
+
protected abstract getStyleRules(options: StyleRulesOptions): StyleRules;
|
|
15
15
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Color } from '../color/index
|
|
2
|
-
import { getShortbreadTemplate, getShortbreadLayers } from '../shortbread/index
|
|
3
|
-
import { decorate } from './decorator
|
|
4
|
-
import { CachedRecolor, getDefaultRecolorFlags } from './recolor
|
|
5
|
-
import { basename, deepClone, resolveUrl } from '../lib/utils
|
|
1
|
+
import { Color } from '../color/index';
|
|
2
|
+
import { getShortbreadTemplate, getShortbreadLayers } from '../shortbread/index';
|
|
3
|
+
import { decorate } from './decorator';
|
|
4
|
+
import { CachedRecolor, getDefaultRecolorFlags } from './recolor';
|
|
5
|
+
import { basename, deepClone, resolveUrl } from '../lib/utils';
|
|
6
6
|
// StyleBuilder class definition
|
|
7
7
|
export class StyleBuilder {
|
|
8
8
|
#sourceName = 'versatiles-shortbread';
|
|
@@ -17,7 +17,8 @@ export class StyleBuilder {
|
|
|
17
17
|
const recolorOptions = options.recolor ?? getDefaultRecolorFlags();
|
|
18
18
|
const colors = this.getColors(this.defaultColors);
|
|
19
19
|
if (options.colors) {
|
|
20
|
-
|
|
20
|
+
let key;
|
|
21
|
+
for (key in options.colors) {
|
|
21
22
|
const value = options.colors[key];
|
|
22
23
|
if (value != null)
|
|
23
24
|
colors[key] = Color.parse(value);
|
|
@@ -25,7 +26,8 @@ export class StyleBuilder {
|
|
|
25
26
|
}
|
|
26
27
|
const fonts = deepClone(this.defaultFonts);
|
|
27
28
|
if (options.fonts) {
|
|
28
|
-
|
|
29
|
+
let key;
|
|
30
|
+
for (key in options.fonts) {
|
|
29
31
|
const fontName = options.fonts[key];
|
|
30
32
|
if (fontName != null)
|
|
31
33
|
fonts[key] = fontName;
|
|
@@ -77,8 +79,7 @@ export class StyleBuilder {
|
|
|
77
79
|
}
|
|
78
80
|
getColors(colors) {
|
|
79
81
|
const entriesString = Object.entries(colors);
|
|
80
|
-
const
|
|
81
|
-
const result = Object.fromEntries(entriesColor);
|
|
82
|
+
const result = Object.fromEntries(entriesString.map(([key, value]) => [key, Color.parse(value)]));
|
|
82
83
|
return result;
|
|
83
84
|
}
|
|
84
85
|
getDefaultOptions() {
|
|
@@ -96,8 +97,10 @@ export class StyleBuilder {
|
|
|
96
97
|
}
|
|
97
98
|
transformDefaultColors(callback) {
|
|
98
99
|
const colors = this.getColors(this.defaultColors);
|
|
99
|
-
|
|
100
|
+
let key;
|
|
101
|
+
for (key in colors) {
|
|
100
102
|
this.defaultColors[key] = callback(colors[key]).asHex();
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
}
|
|
106
|
+
//# sourceMappingURL=style_builder.js.map
|
|
@@ -1,36 +1,39 @@
|
|
|
1
|
-
import type { Color } from '../color/index
|
|
2
|
-
import type {
|
|
3
|
-
import type { RecolorOptions } from './recolor.js';
|
|
1
|
+
import type { Color } from '../color/index';
|
|
2
|
+
import type { RecolorOptions } from './recolor';
|
|
4
3
|
import { SpriteSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
5
4
|
/** Represents language suffixes used in map styles. */
|
|
6
5
|
export type Language = 'de' | 'en' | null;
|
|
7
|
-
export interface StyleBuilderOptions
|
|
6
|
+
export interface StyleBuilderOptions {
|
|
8
7
|
baseUrl?: string;
|
|
9
8
|
glyphs?: string;
|
|
10
9
|
sprite?: SpriteSpecification;
|
|
11
10
|
tiles?: string[];
|
|
12
11
|
hideLabels?: boolean;
|
|
13
12
|
language?: Language;
|
|
14
|
-
colors?: Partial<StyleBuilderColorStrings
|
|
15
|
-
fonts?: Partial<
|
|
13
|
+
colors?: Partial<StyleBuilderColorStrings>;
|
|
14
|
+
fonts?: Partial<StyleBuilderFonts>;
|
|
16
15
|
recolor?: RecolorOptions;
|
|
17
16
|
}
|
|
18
17
|
/** Defines the keys for color properties in a style builder. */
|
|
19
|
-
export type StyleBuilderColorKeys
|
|
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';
|
|
20
19
|
/** Defines the keys for font properties in a style builder. */
|
|
21
|
-
export type StyleBuilderFontKeys
|
|
20
|
+
export type StyleBuilderFontKeys = 'regular' | 'bold';
|
|
22
21
|
/** Records string values for color properties in a style builder. */
|
|
23
|
-
export type StyleBuilderColorStrings
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
export type StyleBuilderColorStrings = {
|
|
23
|
+
[key in StyleBuilderColorKeys]: string;
|
|
24
|
+
};
|
|
26
25
|
/** Records Color objects for color properties in a style builder. */
|
|
27
|
-
export type StyleBuilderColors
|
|
26
|
+
export type StyleBuilderColors = {
|
|
27
|
+
[key in StyleBuilderColorKeys]: Color;
|
|
28
|
+
};
|
|
28
29
|
/** Records string values for font properties in a style builder. */
|
|
29
|
-
export type StyleBuilderFonts
|
|
30
|
+
export type StyleBuilderFonts = {
|
|
31
|
+
[key in StyleBuilderFontKeys]: string;
|
|
32
|
+
};
|
|
30
33
|
/** Defines options for style rules in a style builder. */
|
|
31
|
-
export interface StyleRulesOptions
|
|
32
|
-
colors: StyleBuilderColors
|
|
33
|
-
fonts:
|
|
34
|
+
export interface StyleRulesOptions {
|
|
35
|
+
colors: StyleBuilderColors;
|
|
36
|
+
fonts: StyleBuilderFonts;
|
|
34
37
|
language: Language;
|
|
35
38
|
}
|
|
36
39
|
/** Defines the value type for a style rule. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { StyleBuilder } from '../style_builder/style_builder
|
|
2
|
-
import type { StyleRules, StyleRulesOptions } from '../style_builder/types
|
|
3
|
-
export default class Colorful extends StyleBuilder
|
|
1
|
+
import { StyleBuilder } from '../style_builder/style_builder';
|
|
2
|
+
import type { StyleRules, StyleRulesOptions } from '../style_builder/types';
|
|
3
|
+
export default class Colorful extends StyleBuilder {
|
|
4
4
|
readonly name: string;
|
|
5
5
|
defaultFonts: {
|
|
6
6
|
regular: string;
|
|
@@ -90,5 +90,5 @@ export default class Colorful extends StyleBuilder<Colorful> {
|
|
|
90
90
|
/** Color used for points of interest. */
|
|
91
91
|
poi: string;
|
|
92
92
|
};
|
|
93
|
-
protected getStyleRules(options: StyleRulesOptions
|
|
93
|
+
protected getStyleRules(options: StyleRulesOptions): StyleRules;
|
|
94
94
|
}
|
package/dist/styles/colorful.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StyleBuilder } from '../style_builder/style_builder
|
|
1
|
+
import { StyleBuilder } from '../style_builder/style_builder';
|
|
2
2
|
export default class Colorful extends StyleBuilder {
|
|
3
3
|
name = 'Colorful';
|
|
4
4
|
defaultFonts = {
|
|
@@ -953,3 +953,4 @@ export default class Colorful extends StyleBuilder {
|
|
|
953
953
|
};
|
|
954
954
|
}
|
|
955
955
|
}
|
|
956
|
+
//# sourceMappingURL=colorful.js.map
|
package/dist/styles/eclipse.d.ts
CHANGED
package/dist/styles/eclipse.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Colorful from './colorful
|
|
1
|
+
import Colorful from './colorful';
|
|
2
2
|
export default class Eclipse extends Colorful {
|
|
3
3
|
name = 'Eclipse';
|
|
4
4
|
constructor() {
|
|
@@ -6,3 +6,4 @@ export default class Eclipse extends Colorful {
|
|
|
6
6
|
this.transformDefaultColors(color => color.invertLuminosity());
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
//# sourceMappingURL=eclipse.js.map
|
package/dist/styles/empty.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
export default class Empty extends
|
|
1
|
+
import type { StyleRules, StyleRulesOptions } from '../style_builder/types';
|
|
2
|
+
import Colorful from './colorful';
|
|
3
|
+
export default class Empty extends Colorful {
|
|
4
4
|
readonly name: string;
|
|
5
|
-
|
|
6
|
-
regular: string;
|
|
7
|
-
bold: string;
|
|
8
|
-
};
|
|
9
|
-
defaultColors: {};
|
|
10
|
-
protected getStyleRules(options: StyleRulesOptions<Empty>): StyleRules;
|
|
5
|
+
protected getStyleRules(_options: StyleRulesOptions): StyleRules;
|
|
11
6
|
}
|
package/dist/styles/empty.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class Empty extends
|
|
1
|
+
import Colorful from './colorful';
|
|
2
|
+
export default class Empty extends Colorful {
|
|
3
3
|
name = 'Empty';
|
|
4
|
-
|
|
5
|
-
regular: 'noto_sans_regular',
|
|
6
|
-
bold: 'noto_sans_bold',
|
|
7
|
-
};
|
|
8
|
-
defaultColors = {};
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
-
getStyleRules(options) {
|
|
4
|
+
getStyleRules(_options) {
|
|
11
5
|
return {};
|
|
12
6
|
}
|
|
13
7
|
}
|
|
8
|
+
//# sourceMappingURL=empty.js.map
|
package/dist/styles/graybeard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Colorful from './colorful
|
|
1
|
+
import Colorful from './colorful';
|
|
2
2
|
export default class Graybeard extends Colorful {
|
|
3
3
|
name = 'Graybeard';
|
|
4
4
|
constructor() {
|
|
@@ -6,3 +6,4 @@ export default class Graybeard extends Colorful {
|
|
|
6
6
|
this.transformDefaultColors(color => color.saturate(-1));
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
//# sourceMappingURL=graybeard.js.map
|
package/dist/styles/index.d.ts
CHANGED
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { StyleBuilderOptions } from '../style_builder/types.js';
|
|
1
|
+
import type { StyleBuilderOptions } from '../style_builder/types';
|
|
3
2
|
import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
export declare const colorful: {
|
|
4
|
+
(options?: StyleBuilderOptions): StyleSpecification;
|
|
5
|
+
getOptions(): StyleBuilderOptions;
|
|
6
|
+
};
|
|
7
|
+
export declare const eclipse: {
|
|
8
|
+
(options?: StyleBuilderOptions): StyleSpecification;
|
|
9
|
+
getOptions(): StyleBuilderOptions;
|
|
10
|
+
};
|
|
11
|
+
export declare const graybeard: {
|
|
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;
|
|
17
22
|
};
|
|
18
|
-
export type ColorfulBuilder = MakeStyle<Colorful, ColorfulOptions>;
|
|
19
|
-
export type EclipseBuilder = MakeStyle<Eclipse, EclipseOptions>;
|
|
20
|
-
export type GraybeardBuilder = MakeStyle<Graybeard, GraybeardOptions>;
|
|
21
|
-
export type NeutrinoBuilder = MakeStyle<Neutrino, NeutrinoOptions>;
|
|
22
|
-
export type EmptyBuilder = MakeStyle<Empty, EmptyOptions>;
|
|
23
|
-
export type SomeBuilder = ColorfulBuilder | EclipseBuilder | EmptyBuilder | GraybeardBuilder | NeutrinoBuilder;
|
|
24
|
-
export declare const colorful: ColorfulBuilder;
|
|
25
|
-
export declare const eclipse: EclipseBuilder;
|
|
26
|
-
export declare const graybeard: GraybeardBuilder;
|
|
27
|
-
export declare const neutrino: NeutrinoBuilder;
|
|
28
|
-
export declare const empty: EmptyBuilder;
|
package/dist/styles/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// import styles
|
|
2
|
-
import Colorful from './colorful
|
|
3
|
-
import Eclipse from './eclipse
|
|
4
|
-
import Graybeard from './graybeard
|
|
5
|
-
import Neutrino from './neutrino
|
|
6
|
-
import Empty from './empty
|
|
2
|
+
import Colorful from './colorful';
|
|
3
|
+
import Eclipse from './eclipse';
|
|
4
|
+
import Graybeard from './graybeard';
|
|
5
|
+
import Neutrino from './neutrino';
|
|
6
|
+
import Empty from './empty';
|
|
7
7
|
function getStyleBuilder(styleBuilder) {
|
|
8
8
|
const fn = function (options) {
|
|
9
9
|
return new styleBuilder().build(options);
|
|
@@ -17,3 +17,4 @@ export const eclipse = getStyleBuilder(Eclipse);
|
|
|
17
17
|
export const graybeard = getStyleBuilder(Graybeard);
|
|
18
18
|
export const neutrino = getStyleBuilder(Neutrino);
|
|
19
19
|
export const empty = getStyleBuilder(Empty);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
export default class Neutrino extends
|
|
1
|
+
import { StyleRules, StyleRulesOptions } from '../style_builder/types';
|
|
2
|
+
import Colorful from './colorful';
|
|
3
|
+
export default class Neutrino extends Colorful {
|
|
4
4
|
readonly name: string;
|
|
5
5
|
defaultFonts: {
|
|
6
6
|
regular: string;
|
|
@@ -18,7 +18,7 @@ export default class Neutrino extends StyleBuilder<Neutrino> {
|
|
|
18
18
|
/** Color used for agricultural land. */
|
|
19
19
|
agriculture: string;
|
|
20
20
|
/** Color for site areas such as parks or recreational facilities. */
|
|
21
|
-
|
|
21
|
+
commercial: string;
|
|
22
22
|
/** Primary color for buildings. */
|
|
23
23
|
building: string;
|
|
24
24
|
/** Color for streets and roads. */
|
|
@@ -31,6 +31,35 @@ export default class Neutrino extends StyleBuilder<Neutrino> {
|
|
|
31
31
|
rail: string;
|
|
32
32
|
/** Primary color used for text labels. */
|
|
33
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;
|
|
34
63
|
};
|
|
35
|
-
protected getStyleRules(options: StyleRulesOptions
|
|
64
|
+
protected getStyleRules(options: StyleRulesOptions): StyleRules;
|
|
36
65
|
}
|
package/dist/styles/neutrino.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class Neutrino extends
|
|
1
|
+
import Colorful from './colorful';
|
|
2
|
+
export default class Neutrino extends Colorful {
|
|
3
3
|
name = 'Neutrino';
|
|
4
4
|
defaultFonts = {
|
|
5
5
|
regular: 'noto_sans_regular',
|
|
@@ -17,7 +17,7 @@ export default class Neutrino extends StyleBuilder {
|
|
|
17
17
|
/** Color used for agricultural land. */
|
|
18
18
|
agriculture: '#f8eeee',
|
|
19
19
|
/** Color for site areas such as parks or recreational facilities. */
|
|
20
|
-
|
|
20
|
+
commercial: '#ebe8e6',
|
|
21
21
|
/** Primary color for buildings. */
|
|
22
22
|
building: '#e0d1d9',
|
|
23
23
|
/** Color for streets and roads. */
|
|
@@ -30,6 +30,36 @@ export default class Neutrino extends StyleBuilder {
|
|
|
30
30
|
rail: '#e8d5e0',
|
|
31
31
|
/** Primary color used for text labels. */
|
|
32
32
|
label: '#cbb7b7',
|
|
33
|
+
// Don't need these colors:
|
|
34
|
+
buildingbg: '#000',
|
|
35
|
+
burial: '#000',
|
|
36
|
+
construction: '#000',
|
|
37
|
+
cycle: '#000',
|
|
38
|
+
danger: '#000',
|
|
39
|
+
disputed: '#000',
|
|
40
|
+
education: '#000',
|
|
41
|
+
glacier: '#000',
|
|
42
|
+
hospital: '#000',
|
|
43
|
+
industrial: '#000',
|
|
44
|
+
labelHalo: '#000',
|
|
45
|
+
leisure: '#000',
|
|
46
|
+
motorway: '#000',
|
|
47
|
+
motorwaybg: '#000',
|
|
48
|
+
park: '#000',
|
|
49
|
+
parking: '#000',
|
|
50
|
+
poi: '#000',
|
|
51
|
+
prison: '#000',
|
|
52
|
+
residential: '#000',
|
|
53
|
+
rock: '#000',
|
|
54
|
+
sand: '#000',
|
|
55
|
+
shield: '#000',
|
|
56
|
+
streetbg: '#000',
|
|
57
|
+
subway: '#000',
|
|
58
|
+
symbol: '#000',
|
|
59
|
+
trunk: '#000',
|
|
60
|
+
trunkbg: '#000',
|
|
61
|
+
waste: '#000',
|
|
62
|
+
wetland: '#000',
|
|
33
63
|
};
|
|
34
64
|
getStyleRules(options) {
|
|
35
65
|
const { colors, fonts } = options;
|
|
@@ -103,7 +133,7 @@ export default class Neutrino extends StyleBuilder {
|
|
|
103
133
|
opacity: { 10: 0, 11: 1 },
|
|
104
134
|
},
|
|
105
135
|
'site-{bicycleparking,parking}': {
|
|
106
|
-
color: colors.
|
|
136
|
+
color: colors.commercial,
|
|
107
137
|
},
|
|
108
138
|
'building': {
|
|
109
139
|
color: colors.building,
|
|
@@ -368,3 +398,4 @@ export default class Neutrino extends StyleBuilder {
|
|
|
368
398
|
};
|
|
369
399
|
}
|
|
370
400
|
}
|
|
401
|
+
//# sourceMappingURL=neutrino.js.map
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { MaplibreLayerDefinition, MaplibreLayer } from './maplibre
|
|
2
|
-
export type { VectorLayer } from './vector_layer
|
|
3
|
-
export { isTileJSONSpecification } from './tilejson
|
|
4
|
-
export type { TileJSONSpecification, TileJSONSpecificationRaster, TileJSONSpecificationVector } from './tilejson
|
|
5
|
-
export { isVectorLayers } from './vector_layer
|
|
1
|
+
export type { MaplibreLayerDefinition, MaplibreLayer } from './maplibre';
|
|
2
|
+
export type { VectorLayer } from './vector_layer';
|
|
3
|
+
export { isTileJSONSpecification } from './tilejson';
|
|
4
|
+
export type { TileJSONSpecification, TileJSONSpecificationRaster, TileJSONSpecificationVector } from './tilejson';
|
|
5
|
+
export { isVectorLayers } from './vector_layer';
|
package/dist/types/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { isTileJSONSpecification } from './tilejson
|
|
2
|
-
export { isVectorLayers } from './vector_layer
|
|
1
|
+
export { isTileJSONSpecification } from './tilejson';
|
|
2
|
+
export { isVectorLayers } from './vector_layer';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
package/dist/types/maplibre.js
CHANGED
package/dist/types/tilejson.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VectorLayer } from './vector_layer
|
|
1
|
+
import type { VectorLayer } from './vector_layer';
|
|
2
2
|
/** Basic structure for TileJSON specification, applicable to both raster and vector types. */
|
|
3
3
|
export interface TileJSONSpecificationRaster {
|
|
4
4
|
tilejson?: '3.0.0';
|
package/dist/types/tilejson.js
CHANGED