@versatiles/style 5.2.1 → 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.
Files changed (56) hide show
  1. package/README.MD +1 -69
  2. package/dist/color/abstract.d.ts +5 -4
  3. package/dist/color/abstract.js +4 -0
  4. package/dist/color/hsl.d.ts +7 -7
  5. package/dist/color/hsl.js +10 -22
  6. package/dist/color/hsv.d.ts +8 -7
  7. package/dist/color/hsv.js +10 -11
  8. package/dist/color/index.d.ts +5 -5
  9. package/dist/color/index.js +6 -5
  10. package/dist/color/random.d.ts +1 -1
  11. package/dist/color/random.js +3 -2
  12. package/dist/color/rgb.d.ts +7 -7
  13. package/dist/color/rgb.js +15 -42
  14. package/dist/color/utils.js +1 -0
  15. package/dist/guess_style/guess_style.d.ts +1 -1
  16. package/dist/guess_style/guess_style.js +6 -5
  17. package/dist/guess_style/index.d.ts +2 -2
  18. package/dist/guess_style/index.js +2 -1
  19. package/dist/index.d.ts +28 -11
  20. package/dist/index.js +10 -3
  21. package/dist/lib/utils.js +2 -1
  22. package/dist/shortbread/index.d.ts +2 -2
  23. package/dist/shortbread/index.js +3 -2
  24. package/dist/shortbread/layers.d.ts +2 -2
  25. package/dist/shortbread/layers.js +1 -0
  26. package/dist/shortbread/properties.js +1 -0
  27. package/dist/shortbread/template.js +1 -0
  28. package/dist/style_builder/decorator.d.ts +3 -3
  29. package/dist/style_builder/decorator.js +4 -3
  30. package/dist/style_builder/index.d.ts +1 -1
  31. package/dist/style_builder/index.js +1 -0
  32. package/dist/style_builder/recolor.d.ts +1 -1
  33. package/dist/style_builder/recolor.js +2 -1
  34. package/dist/style_builder/style_builder.d.ts +11 -11
  35. package/dist/style_builder/style_builder.js +13 -10
  36. package/dist/style_builder/types.d.ts +19 -16
  37. package/dist/style_builder/types.js +1 -0
  38. package/dist/styles/colorful.d.ts +4 -4
  39. package/dist/styles/colorful.js +2 -1
  40. package/dist/styles/eclipse.d.ts +1 -1
  41. package/dist/styles/eclipse.js +2 -1
  42. package/dist/styles/empty.d.ts +4 -9
  43. package/dist/styles/empty.js +4 -9
  44. package/dist/styles/graybeard.d.ts +1 -1
  45. package/dist/styles/graybeard.js +2 -1
  46. package/dist/styles/index.d.ts +20 -26
  47. package/dist/styles/index.js +6 -5
  48. package/dist/styles/neutrino.d.ts +34 -5
  49. package/dist/styles/neutrino.js +35 -4
  50. package/dist/types/index.d.ts +5 -5
  51. package/dist/types/index.js +3 -2
  52. package/dist/types/maplibre.js +1 -0
  53. package/dist/types/tilejson.d.ts +1 -1
  54. package/dist/types/tilejson.js +1 -0
  55. package/dist/types/vector_layer.js +1 -0
  56. 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>
@@ -1,7 +1,7 @@
1
- import type { HSL } from './hsl.js';
2
- import type { HSV } from './hsv.js';
3
- import { RandomColorOptions } from './random.js';
4
- import type { RGB } from './rgb.js';
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
  }
@@ -46,4 +46,8 @@ export class Color {
46
46
  tint(value, tintColor) {
47
47
  return this.toRGB().tint(value, tintColor);
48
48
  }
49
+ setHue(value) {
50
+ return this.toHSV().setHue(value);
51
+ }
49
52
  }
53
+ //# sourceMappingURL=abstract.js.map
@@ -1,11 +1,11 @@
1
- import { Color } from './abstract.js';
2
- import { HSV } from './hsv.js';
3
- import { RGB } from './rgb.js';
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.js';
2
- import { HSV } from './hsv.js';
3
- import { RGB } from './rgb.js';
4
- import { clamp, formatFloat, mod } from './utils.js';
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 = Math.round(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,24 +81,16 @@ export class HSL extends Color {
85
81
  throw new Error(`Invalid HSL color string: "${str}"`);
86
82
  }
87
83
  invertLuminosity() {
88
- this.l = 100 - this.l;
89
- return this;
84
+ return new HSL(this.h, this.s, 100 - this.l, this.a);
90
85
  }
91
86
  rotateHue(offset) {
92
- this.h = mod(this.h + offset, 360);
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
- if (ratio < 0) {
97
- this.s = clamp(this.s * (1 + ratio), 0, 100);
98
- }
99
- else {
100
- this.s = clamp(100 - (100 - this.s) * (1 - ratio), 0, 100);
101
- }
102
- return this;
90
+ return new HSL(this.h, clamp(this.s * (1 + ratio), 0, 100), this.l, this.a);
103
91
  }
104
92
  fade(value) {
105
- this.a *= 1 - value;
106
- return this;
93
+ return new HSL(this.h, this.s, this.l, this.a * (1 - value));
107
94
  }
108
95
  }
96
+ //# sourceMappingURL=hsl.js.map
@@ -1,11 +1,11 @@
1
- import { Color } from './abstract.js';
2
- import { HSL } from './hsl.js';
3
- import { RGB } from './rgb.js';
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.js';
2
- import { HSL } from './hsl.js';
3
- import { RGB } from './rgb.js';
4
- import { clamp, mod } from './utils.js';
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 = Math.round(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 *= 1 - value;
99
- return this;
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
@@ -1,6 +1,6 @@
1
- import { Color } from './abstract.js';
2
- export type { RandomColorOptions } from './random.js';
3
- export type { HSL } from './hsl.js';
4
- export type { HSV } from './hsv.js';
5
- export type { RGB } from './rgb.js';
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 };
@@ -1,8 +1,8 @@
1
- import { Color } from './abstract.js';
2
- import { HSL } from './hsl.js';
3
- import { HSV } from './hsv.js';
4
- import randomColor from './random.js';
5
- import { RGB } from './rgb.js';
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
@@ -1,4 +1,4 @@
1
- import { HSV } from './hsv.js';
1
+ import { HSV } from './hsv';
2
2
  export interface RandomColorOptions {
3
3
  seed?: string;
4
4
  hue?: number | string;
@@ -1,5 +1,5 @@
1
- import { HSV } from './hsv.js';
2
- import { mod } from './utils.js';
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
@@ -1,11 +1,11 @@
1
- import { HSL } from './hsl.js';
2
- import { HSV } from './hsv.js';
3
- import { Color } from './abstract.js';
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.js';
2
- import { HSV } from './hsv.js';
3
- import { Color } from './abstract.js';
4
- import { clamp, formatFloat } from './utils.js';
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 = Math.round(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 = Math.pow(this.r / 255, value) * 255;
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 = 255 - 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 = clamp((this.r - 127.5) * value + 127.5, 0, 255);
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 = this.r * a + b;
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 hsv = this.asHSV();
197
- hsv.h = tintColor.toHSV().h;
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 = clamp(255 - (255 - this.r) * (1 - ratio), 0, 255);
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 = clamp(this.r * (1 - ratio), 0, 255);
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 *= 1 - value;
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
@@ -7,3 +7,4 @@ export function mod(num, max) {
7
7
  export function formatFloat(num, precision) {
8
8
  return num.toFixed(precision).replace(/0+$/, '').replace(/\.$/, '');
9
9
  }
10
+ //# sourceMappingURL=utils.js.map
@@ -1,4 +1,4 @@
1
- import type { TileJSONSpecification } from '../types/index.js';
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.js';
2
- import { deepClone, resolveUrl } from '../lib/utils.js';
3
- import { colorful } from '../styles/index.js';
4
- import { Color } from '../color/index.js';
5
- import { isRasterTileJSONSpecification } from '../types/tilejson.js';
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.js';
2
- export { guessStyle } from './guess_style.js';
1
+ export type { GuessStyleOptions } from './guess_style';
2
+ export { guessStyle } from './guess_style';
@@ -1 +1,2 @@
1
- export { guessStyle } from './guess_style.js';
1
+ export { guessStyle } from './guess_style';
2
+ //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -1,11 +1,28 @@
1
- export type * from './styles/index.js';
2
- export * as styles from './styles/index.js';
3
- export type { GuessStyleOptions } from './guess_style/index.js';
4
- export type { RGB, HSL, HSV, RandomColorOptions } from './color/index.js';
5
- export type { TileJSONSpecification, TileJSONSpecificationRaster, TileJSONSpecificationVector } from './types/tilejson.js';
6
- export type { VectorLayer } from './types/index.js';
7
- export type { StyleBuilderOptions, StyleBuilderColorStrings, StyleBuilderFontStrings, Language, StyleBuilderColorKeys, StyleBuilderFontKeys } from './style_builder/types.js';
8
- export type { RecolorOptions } from './style_builder/recolor.js';
9
- export type { StyleBuilder } from './style_builder/style_builder.js';
10
- export { guessStyle } from './guess_style/index.js';
11
- export { Color } from './color/index.js';
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
- export * as styles from './styles/index.js';
2
- export { guessStyle } from './guess_style/index.js';
3
- export { Color } from './color/index.js';
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.js';
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.js';
2
- export { getShortbreadLayers } from './layers.js';
1
+ export { getShortbreadTemplate } from './template';
2
+ export { getShortbreadLayers } from './layers';
@@ -1,2 +1,3 @@
1
- export { getShortbreadTemplate } from './template.js';
2
- export { getShortbreadLayers } from './layers.js';
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.js';
2
- import type { MaplibreLayerDefinition } from '../types/index.js';
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[];
@@ -518,3 +518,4 @@ export function getShortbreadLayers(option) {
518
518
  },
519
519
  ];
520
520
  }
521
+ //# sourceMappingURL=layers.js.map
@@ -122,3 +122,4 @@ propertyDefs.forEach((propertyDef) => {
122
122
  });
123
123
  });
124
124
  export default propertyLookup;
125
+ //# sourceMappingURL=properties.js.map
@@ -336,3 +336,4 @@ export function getShortbreadVectorLayers() {
336
336
  },
337
337
  ];
338
338
  }
339
+ //# sourceMappingURL=template.js.map
@@ -1,4 +1,4 @@
1
- import type { MaplibreLayer } from '../types/index.js';
2
- import type { StyleRules } from './types.js';
3
- import type { CachedRecolor } from './recolor.js';
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.js';
1
+ import { Color } from '../color/index';
2
2
  import expandBraces from 'brace-expansion';
3
- import maplibreProperties from '../shortbread/properties.js';
4
- import { deepMerge } from '../lib/utils.js';
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.js';
1
+ export type { Language } from './types';
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { Color } from '../color/index.js';
1
+ import { Color } from '../color/index';
2
2
  export interface RecolorOptions {
3
3
  invertBrightness?: boolean;
4
4
  rotate?: number;
@@ -1,4 +1,4 @@
1
- import { Color } from '../color/index.js';
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.js';
2
- import type { StyleSpecification } from '../types/maplibre.js';
3
- import type { StyleBuilderColorStrings, StyleBuilderColors, StyleBuilderFontStrings, StyleBuilderOptions } from './types.js';
4
- import type { StyleRules, StyleRulesOptions } from './types.js';
5
- export declare abstract class StyleBuilder<Subclass extends StyleBuilder<Subclass>> {
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<Subclass>;
9
- abstract readonly defaultFonts: StyleBuilderFontStrings<Subclass>;
10
- build(options?: StyleBuilderOptions<Subclass>): StyleSpecification;
11
- getColors(colors: StyleBuilderColorStrings<Subclass>): StyleBuilderColors<Subclass>;
12
- getDefaultOptions(): StyleBuilderOptions<Subclass>;
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<Subclass>): StyleRules;
14
+ protected abstract getStyleRules(options: StyleRulesOptions): StyleRules;
15
15
  }
@@ -1,8 +1,8 @@
1
- import { Color } from '../color/index.js';
2
- import { getShortbreadTemplate, getShortbreadLayers } from '../shortbread/index.js';
3
- import { decorate } from './decorator.js';
4
- import { CachedRecolor, getDefaultRecolorFlags } from './recolor.js';
5
- import { basename, deepClone, resolveUrl } from '../lib/utils.js';
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
- for (const key in options.colors) {
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
- for (const key in options.fonts) {
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 entriesColor = entriesString.map(([key, value]) => [key, Color.parse(value)]);
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
- for (const key in colors) {
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.js';
2
- import type { StyleBuilder } from './style_builder.js';
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<T extends StyleBuilder<T>> {
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<T>>;
15
- fonts?: Partial<StyleBuilderFontStrings<T>>;
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<T extends StyleBuilder<T>> = keyof T['defaultColors'];
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<T extends StyleBuilder<T>> = keyof T['defaultFonts'];
20
+ export type StyleBuilderFontKeys = 'regular' | 'bold';
22
21
  /** Records string values for color properties in a style builder. */
23
- export type StyleBuilderColorStrings<T extends StyleBuilder<T>> = Record<StyleBuilderColorKeys<T>, string>;
24
- /** Records string values for font properties in a style builder. */
25
- export type StyleBuilderFontStrings<T extends StyleBuilder<T>> = Record<StyleBuilderFontKeys<T>, string>;
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<T extends StyleBuilder<T>> = Record<StyleBuilderColorKeys<T>, Color>;
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<T extends StyleBuilder<T>> = Record<StyleBuilderFontKeys<T>, string>;
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<T extends StyleBuilder<T>> {
32
- colors: StyleBuilderColors<T>;
33
- fonts: StyleBuilderFontStrings<T>;
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 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=types.js.map
@@ -1,6 +1,6 @@
1
- import { StyleBuilder } from '../style_builder/style_builder.js';
2
- import type { StyleRules, StyleRulesOptions } from '../style_builder/types.js';
3
- export default class Colorful extends StyleBuilder<Colorful> {
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<Colorful>): StyleRules;
93
+ protected getStyleRules(options: StyleRulesOptions): StyleRules;
94
94
  }
@@ -1,4 +1,4 @@
1
- import { StyleBuilder } from '../style_builder/style_builder.js';
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
@@ -1,4 +1,4 @@
1
- import Colorful from './colorful.js';
1
+ import Colorful from './colorful';
2
2
  export default class Eclipse extends Colorful {
3
3
  readonly name: string;
4
4
  constructor();
@@ -1,4 +1,4 @@
1
- import Colorful from './colorful.js';
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
@@ -1,11 +1,6 @@
1
- import { StyleBuilder } from '../style_builder/style_builder.js';
2
- import type { StyleRules, StyleRulesOptions } from '../style_builder/types.js';
3
- export default class Empty extends StyleBuilder<Empty> {
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
- defaultFonts: {
6
- regular: string;
7
- bold: string;
8
- };
9
- defaultColors: {};
10
- protected getStyleRules(options: StyleRulesOptions<Empty>): StyleRules;
5
+ protected getStyleRules(_options: StyleRulesOptions): StyleRules;
11
6
  }
@@ -1,13 +1,8 @@
1
- import { StyleBuilder } from '../style_builder/style_builder.js';
2
- export default class Empty extends StyleBuilder {
1
+ import Colorful from './colorful';
2
+ export default class Empty extends Colorful {
3
3
  name = 'Empty';
4
- defaultFonts = {
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
@@ -1,4 +1,4 @@
1
- import Colorful from './colorful.js';
1
+ import Colorful from './colorful';
2
2
  export default class Graybeard extends Colorful {
3
3
  readonly name: string;
4
4
  constructor();
@@ -1,4 +1,4 @@
1
- import Colorful from './colorful.js';
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
@@ -1,28 +1,22 @@
1
- import type { StyleBuilder } from '../style_builder/style_builder.js';
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
- import Colorful from './colorful.js';
5
- import Eclipse from './eclipse.js';
6
- import Graybeard from './graybeard.js';
7
- import Neutrino from './neutrino.js';
8
- import Empty from './empty.js';
9
- export type ColorfulOptions = StyleBuilderOptions<Colorful>;
10
- export type EclipseOptions = StyleBuilderOptions<Eclipse>;
11
- export type GraybeardOptions = StyleBuilderOptions<Graybeard>;
12
- export type NeutrinoOptions = StyleBuilderOptions<Neutrino>;
13
- export type EmptyOptions = StyleBuilderOptions<Empty>;
14
- export type SomeOptions = ColorfulOptions | EclipseOptions | EmptyOptions | GraybeardOptions | NeutrinoOptions;
15
- export type MakeStyle<T extends StyleBuilder<T>, O extends StyleBuilderOptions<T>> = ((options?: O) => StyleSpecification) & {
16
- getOptions: () => O;
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;
@@ -1,9 +1,9 @@
1
1
  // import styles
2
- import Colorful from './colorful.js';
3
- import Eclipse from './eclipse.js';
4
- import Graybeard from './graybeard.js';
5
- import Neutrino from './neutrino.js';
6
- import Empty from './empty.js';
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 { StyleBuilder } from '../style_builder/style_builder.js';
2
- import type { StyleRules, StyleRulesOptions } from '../style_builder/types.js';
3
- export default class Neutrino extends StyleBuilder<Neutrino> {
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
- site: string;
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<Neutrino>): StyleRules;
64
+ protected getStyleRules(options: StyleRulesOptions): StyleRules;
36
65
  }
@@ -1,5 +1,5 @@
1
- import { StyleBuilder } from '../style_builder/style_builder.js';
2
- export default class Neutrino extends StyleBuilder {
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
- site: '#ebe8e6',
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.site,
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
@@ -1,5 +1,5 @@
1
- export type { MaplibreLayerDefinition, MaplibreLayer } from './maplibre.js';
2
- export type { VectorLayer } from './vector_layer.js';
3
- export { isTileJSONSpecification } from './tilejson.js';
4
- export type { TileJSONSpecification, TileJSONSpecificationRaster, TileJSONSpecificationVector } from './tilejson.js';
5
- export { isVectorLayers } from './vector_layer.js';
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,2 +1,3 @@
1
- export { isTileJSONSpecification } from './tilejson.js';
2
- export { isVectorLayers } from './vector_layer.js';
1
+ export { isTileJSONSpecification } from './tilejson';
2
+ export { isVectorLayers } from './vector_layer';
3
+ //# sourceMappingURL=index.js.map
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=maplibre.js.map
@@ -1,4 +1,4 @@
1
- import type { VectorLayer } from './vector_layer.js';
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';
@@ -84,3 +84,4 @@ export function isRasterTileJSONSpecification(spec) {
84
84
  return false;
85
85
  return true;
86
86
  }
87
+ //# sourceMappingURL=tilejson.js.map
@@ -48,3 +48,4 @@ export function isVectorLayers(layers) {
48
48
  });
49
49
  return true;
50
50
  }
51
+ //# sourceMappingURL=vector_layer.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versatiles/style",
3
- "version": "5.2.1",
3
+ "version": "5.2.3",
4
4
  "description": "Generate StyleJSON for MapLibre",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",