@versatiles/style 5.6.0 → 5.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,108 +1,504 @@
1
1
  import { SpriteSpecification, StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
2
+ export { SpriteSpecification } from '@maplibre/maplibre-gl-style-spec';
2
3
 
4
+ interface RandomColorOptions {
5
+ seed?: string;
6
+ hue?: number | string;
7
+ opacity?: number;
8
+ luminosity?: number | string;
9
+ saturation?: number | string;
10
+ }
11
+
12
+ /**
13
+ * Represents an RGB color with optional alpha transparency.
14
+ *
15
+ * @extends Color
16
+ */
3
17
  declare class RGB extends Color {
18
+ /**
19
+ * Red component (0-255).
20
+ */
4
21
  readonly r: number;
22
+ /**
23
+ * Green component (0-255).
24
+ */
5
25
  readonly g: number;
26
+ /**
27
+ * Blue component (0-255).
28
+ */
6
29
  readonly b: number;
30
+ /**
31
+ * Alpha component (0-1).
32
+ */
7
33
  readonly a: number;
34
+ /**
35
+ * Creates an instance of RGB.
36
+ *
37
+ * @param r - Red component (0-255).
38
+ * @param g - Green component (0-255).
39
+ * @param b - Blue component (0-255).
40
+ * @param a - Alpha component (0-1), defaults to 1.
41
+ */
8
42
  constructor(r: number, g: number, b: number, a?: number);
43
+ /**
44
+ * Creates a clone of the current RGB color.
45
+ *
46
+ * @returns A new RGB instance with the same color values.
47
+ */
9
48
  clone(): RGB;
49
+ /**
50
+ * Returns the RGB color as an array.
51
+ *
52
+ * @returns An array containing the red, green, blue, and alpha components.
53
+ */
10
54
  asArray(): [number, number, number, number];
55
+ /**
56
+ * Rounds the RGB color components to the nearest integer.
57
+ *
58
+ * @returns A new RGB instance with rounded color values.
59
+ */
11
60
  round(): RGB;
61
+ /**
62
+ * Returns the RGB color as a string.
63
+ *
64
+ * @returns A string representation of the RGB color in either `rgb` or `rgba` format.
65
+ */
12
66
  asString(): string;
67
+ /**
68
+ * Returns the RGB color as a hexadecimal string.
69
+ *
70
+ * @returns A string representation of the RGB color in hexadecimal format.
71
+ */
13
72
  asHex(): string;
73
+ /**
74
+ * Converts the RGB color to an HSL color.
75
+ *
76
+ * @returns An HSL instance representing the same color.
77
+ */
14
78
  asHSL(): HSL;
79
+ /**
80
+ * Converts the RGB color to an HSV color.
81
+ *
82
+ * @returns An HSV instance representing the same color.
83
+ */
15
84
  asHSV(): HSV;
85
+ /**
86
+ * Returns the RGB color.
87
+ *
88
+ * @returns The current RGB instance.
89
+ */
16
90
  asRGB(): RGB;
91
+ /**
92
+ * Returns the RGB color.
93
+ *
94
+ * @returns The current RGB instance.
95
+ */
17
96
  toRGB(): RGB;
97
+ /**
98
+ * Parses a string or Color instance into an RGB color.
99
+ *
100
+ * @param input - The input string or Color instance to parse.
101
+ * @returns A new RGB instance representing the parsed color.
102
+ * @throws Will throw an error if the input string is not a valid RGB color string.
103
+ */
18
104
  static parse(input: string | Color): RGB;
105
+ /**
106
+ * Adjusts the gamma of the RGB color.
107
+ *
108
+ * @param value - The gamma value to apply.
109
+ * @returns A new RGB instance with the adjusted gamma.
110
+ */
19
111
  gamma(value: number): RGB;
112
+ /**
113
+ * Inverts the RGB color.
114
+ *
115
+ * @returns A new RGB instance with the inverted color values.
116
+ */
20
117
  invert(): RGB;
118
+ /**
119
+ * Adjusts the contrast of the RGB color.
120
+ *
121
+ * @param value - The contrast value to apply.
122
+ * @returns A new RGB instance with the adjusted contrast.
123
+ */
21
124
  contrast(value: number): RGB;
125
+ /**
126
+ * Adjusts the brightness of the RGB color.
127
+ *
128
+ * @param value - The brightness value to apply.
129
+ * @returns A new RGB instance with the adjusted brightness.
130
+ */
22
131
  brightness(value: number): RGB;
132
+ /**
133
+ * Tints the RGB color with another color.
134
+ *
135
+ * @param value - The tint value to apply.
136
+ * @param tintColor - The color to use for tinting.
137
+ * @returns A new RGB instance with the applied tint.
138
+ */
23
139
  tint(value: number, tintColor: Color): RGB;
140
+ /**
141
+ * Blends the RGB color with another color.
142
+ *
143
+ * @param value - The blend value to apply.
144
+ * @param blendColor - The color to blend with.
145
+ * @returns A new RGB instance with the blended color.
146
+ */
24
147
  blend(value: number, blendColor: Color): RGB;
148
+ /**
149
+ * Lightens the RGB color.
150
+ *
151
+ * @param ratio - The ratio to lighten the color by.
152
+ * @returns A new RGB instance with the lightened color.
153
+ */
25
154
  lighten(ratio: number): RGB;
155
+ /**
156
+ * Darkens the RGB color.
157
+ *
158
+ * @param ratio - The ratio to darken the color by.
159
+ * @returns A new RGB instance with the darkened color.
160
+ */
26
161
  darken(ratio: number): RGB;
162
+ /**
163
+ * Fades the RGB color by reducing its alpha value.
164
+ *
165
+ * @param value - The fade value to apply.
166
+ * @returns A new RGB instance with the faded color.
167
+ */
27
168
  fade(value: number): RGB;
28
169
  }
29
170
 
171
+ /**
172
+ * Represents a color in the HSV (Hue, Saturation, Value) color space.
173
+ * Extends the base `Color` class.
174
+ */
30
175
  declare class HSV extends Color {
176
+ /**
177
+ * The hue component of the color, in the range [0, 360].
178
+ */
31
179
  readonly h: number;
180
+ /**
181
+ * The saturation component of the color, in the range [0, 100].
182
+ */
32
183
  readonly s: number;
184
+ /**
185
+ * The value (brightness) component of the color, in the range [0, 100].
186
+ */
33
187
  readonly v: number;
188
+ /**
189
+ * The alpha (opacity) component of the color, in the range [0, 1].
190
+ */
34
191
  readonly a: number;
192
+ /**
193
+ * Constructs a new HSV color.
194
+ * @param h - The hue component, in the range [0, 360].
195
+ * @param s - The saturation component, in the range [0, 100].
196
+ * @param v - The value (brightness) component, in the range [0, 100].
197
+ * @param a - The alpha (opacity) component, in the range [0, 1]. Defaults to 1.
198
+ */
35
199
  constructor(h: number, s: number, v: number, a?: number);
200
+ /**
201
+ * Returns the HSV color as an array of numbers.
202
+ * @returns An array containing the hue, saturation, value, and alpha components.
203
+ */
36
204
  asArray(): [number, number, number, number];
205
+ /**
206
+ * Returns a new HSV color with the components rounded to the nearest integer.
207
+ * @returns A new HSV color with rounded components.
208
+ */
37
209
  round(): HSV;
210
+ /**
211
+ * Returns the color as a string representation.
212
+ * @returns A string representation of the color.
213
+ */
38
214
  asString(): string;
215
+ /**
216
+ * Creates a new HSV color that is a copy of the current color.
217
+ * @returns A new HSV color that is a clone of the current color.
218
+ */
39
219
  clone(): HSV;
220
+ /**
221
+ * Converts the HSV color to an HSL color.
222
+ * @returns An HSL representation of the color.
223
+ */
40
224
  asHSL(): HSL;
225
+ /**
226
+ * Returns the current HSV color.
227
+ * @returns The current HSV color.
228
+ */
41
229
  asHSV(): HSV;
230
+ /**
231
+ * Returns the current HSV color.
232
+ * @returns The current HSV color.
233
+ */
42
234
  toHSV(): HSV;
235
+ /**
236
+ * Converts the HSV color to an RGB color.
237
+ * @returns An RGB representation of the color.
238
+ */
43
239
  asRGB(): RGB;
240
+ /**
241
+ * Fades the color by a given value.
242
+ * @param value - The amount to fade the color by, in the range [0, 1].
243
+ * @returns A new HSV color with the alpha component faded by the given value.
244
+ */
44
245
  fade(value: number): HSV;
246
+ /**
247
+ * Sets the hue component of the color.
248
+ * @param value - The new hue value, in the range [0, 360].
249
+ * @returns A new HSV color with the updated hue component.
250
+ */
45
251
  setHue(value: number): HSV;
252
+ static randomColor(options?: RandomColorOptions): HSV;
46
253
  }
47
254
 
255
+ /**
256
+ * Represents a color in the HSL (Hue, Saturation, Lightness) color space.
257
+ * Extends the base `Color` class.
258
+ */
48
259
  declare class HSL extends Color {
260
+ /**
261
+ * The hue component of the color, in the range [0, 360].
262
+ */
49
263
  readonly h: number;
264
+ /**
265
+ * The saturation component of the color, in the range [0, 100].
266
+ */
50
267
  readonly s: number;
268
+ /**
269
+ * The lightness component of the color, in the range [0, 100].
270
+ */
51
271
  readonly l: number;
272
+ /**
273
+ * The alpha (opacity) component of the color, in the range [0, 1].
274
+ */
52
275
  readonly a: number;
276
+ /**
277
+ * Creates a new HSL color.
278
+ * @param h - The hue component, in the range [0, 360].
279
+ * @param s - The saturation component, in the range [0, 100].
280
+ * @param l - The lightness component, in the range [0, 100].
281
+ * @param a - The alpha (opacity) component, in the range [0, 1]. Defaults to 1.
282
+ */
53
283
  constructor(h: number, s: number, l: number, a?: number);
284
+ /**
285
+ * Returns the HSL color as an array of numbers.
286
+ * @returns An array containing the hue, saturation, lightness, and alpha components.
287
+ */
54
288
  asArray(): [number, number, number, number];
289
+ /**
290
+ * Returns a new HSL color with rounded components.
291
+ * @returns A new HSL color with rounded hue, saturation, lightness, and alpha components.
292
+ */
55
293
  round(): HSL;
294
+ /**
295
+ * Creates a copy of the current HSL color.
296
+ * @returns A new HSL color with the same components as the current color.
297
+ */
56
298
  clone(): HSL;
299
+ /**
300
+ * Returns the HSL color as a CSS-compatible string.
301
+ * @returns A string representing the HSL color in CSS format.
302
+ */
57
303
  asString(): string;
304
+ /**
305
+ * Returns the current HSL color.
306
+ * @returns The current HSL color.
307
+ */
58
308
  asHSL(): HSL;
309
+ /**
310
+ * Returns the current HSL color.
311
+ * @returns The current HSL color.
312
+ */
59
313
  toHSL(): HSL;
314
+ /**
315
+ * Converts the HSL color to an HSV color.
316
+ * @returns A new HSV color representing the same color.
317
+ */
60
318
  asHSV(): HSV;
319
+ /**
320
+ * Converts the HSL color to an RGB color.
321
+ * @returns A new RGB color representing the same color.
322
+ */
61
323
  asRGB(): RGB;
324
+ /**
325
+ * Parses a string or Color object into an HSL color.
326
+ * @param input - The input string or Color object to parse.
327
+ * @returns A new HSL color parsed from the input.
328
+ * @throws Will throw an error if the input string is not a valid HSL color string.
329
+ */
62
330
  static parse(input: string | Color): HSL;
331
+ /**
332
+ * Inverts the lightness component of the HSL color.
333
+ * @returns A new HSL color with the lightness component inverted.
334
+ */
63
335
  invertLuminosity(): HSL;
336
+ /**
337
+ * Rotates the hue component of the HSL color by a given offset.
338
+ * @param offset - The amount to rotate the hue by, in degrees.
339
+ * @returns A new HSL color with the hue rotated by the given offset.
340
+ */
64
341
  rotateHue(offset: number): HSL;
342
+ /**
343
+ * Increases the saturation of the HSL color by a given ratio.
344
+ * @param ratio - The ratio by which to increase the saturation.
345
+ * @returns A new HSL color with increased saturation.
346
+ */
65
347
  saturate(ratio: number): HSL;
348
+ /**
349
+ * Decreases the alpha (opacity) of the HSL color by a given value.
350
+ * @param value - The value by which to decrease the alpha.
351
+ * @returns A new HSL color with decreased alpha.
352
+ */
66
353
  fade(value: number): HSL;
67
354
  }
68
355
 
69
- interface RandomColorOptions {
70
- seed?: string;
71
- hue?: number | string;
72
- opacity?: number;
73
- luminosity?: number | string;
74
- saturation?: number | string;
75
- }
76
-
356
+ /**
357
+ * The abstract `Color` class provides a blueprint for color manipulation and conversion.
358
+ * It includes methods for converting between different color models ({@link HSL}, {@link HSV}, {@link RGB}),
359
+ * as well as various color transformations such as inversion, rotation, saturation, and blending.
360
+ *
361
+ * @abstract
362
+ */
363
+ /**
364
+ * Abstract class representing a color.
365
+ */
77
366
  declare abstract class Color {
367
+ /**
368
+ * Parses a color from a string or another Color instance.
369
+ * @param input - The input color as a string or Color instance.
370
+ * @returns The parsed Color instance.
371
+ */
78
372
  static parse: (input: Color | string) => Color;
373
+ /**
374
+ * The HSL color model.
375
+ */
79
376
  static HSL: typeof HSL;
377
+ /**
378
+ * The HSV color model.
379
+ */
80
380
  static HSV: typeof HSV;
381
+ /**
382
+ * The RGB color model.
383
+ */
81
384
  static RGB: typeof RGB;
82
- static random: (options?: RandomColorOptions) => HSV;
385
+ /**
386
+ * Creates a clone of the current color instance.
387
+ * @returns A new Color instance that is a clone of the current instance.
388
+ */
83
389
  abstract clone(): Color;
390
+ /**
391
+ * Converts the color to a hexadecimal string.
392
+ * @returns The hexadecimal representation of the color.
393
+ */
84
394
  asHex(): string;
395
+ /**
396
+ * Converts the color to a string representation.
397
+ * @returns The string representation of the color.
398
+ */
85
399
  abstract asString(): string;
400
+ /**
401
+ * Rounds the color values.
402
+ * @returns A new Color instance with rounded values.
403
+ */
86
404
  abstract round(): Color;
405
+ /**
406
+ * Converts the color to an array of numbers.
407
+ * @returns An array representing the color.
408
+ */
87
409
  abstract asArray(): number[];
410
+ /**
411
+ * Converts the color to the HSL color model.
412
+ * @returns The HSL representation of the color.
413
+ */
88
414
  abstract asHSL(): HSL;
415
+ /**
416
+ * Converts the color to the HSV color model.
417
+ * @returns The HSV representation of the color.
418
+ */
89
419
  abstract asHSV(): HSV;
420
+ /**
421
+ * Converts the color to the RGB color model.
422
+ * @returns The RGB representation of the color.
423
+ */
90
424
  abstract asRGB(): RGB;
91
- toHSL(): HSL;
92
- toHSV(): HSV;
93
- toRGB(): RGB;
425
+ /**
426
+ * Inverts the luminosity of the color.
427
+ * @returns A new HSL color with inverted luminosity.
428
+ */
94
429
  invertLuminosity(): HSL;
430
+ /**
431
+ * Rotates the hue of the color by a given offset.
432
+ * @param offset - The amount to rotate the hue.
433
+ * @returns A new HSL color with the hue rotated.
434
+ */
95
435
  rotateHue(offset: number): HSL;
436
+ /**
437
+ * Saturates the color by a given ratio.
438
+ * @param ratio - The ratio to saturate the color.
439
+ * @returns A new HSL color with increased saturation.
440
+ */
96
441
  saturate(ratio: number): HSL;
442
+ /**
443
+ * Applies gamma correction to the color.
444
+ * @param value - The gamma correction value.
445
+ * @returns A new RGB color with gamma correction applied.
446
+ */
97
447
  gamma(value: number): RGB;
448
+ /**
449
+ * Inverts the color.
450
+ * @returns A new RGB color with inverted values.
451
+ */
98
452
  invert(): RGB;
453
+ /**
454
+ * Adjusts the contrast of the color.
455
+ * @param value - The contrast adjustment value.
456
+ * @returns A new RGB color with adjusted contrast.
457
+ */
99
458
  contrast(value: number): RGB;
459
+ /**
460
+ * Adjusts the brightness of the color.
461
+ * @param value - The brightness adjustment value.
462
+ * @returns A new RGB color with adjusted brightness.
463
+ */
100
464
  brightness(value: number): RGB;
465
+ /**
466
+ * Lightens the color by a given value.
467
+ * @param value - The amount to lighten the color.
468
+ * @returns A new RGB color that is lightened.
469
+ */
101
470
  lighten(value: number): RGB;
471
+ /**
472
+ * Darkens the color by a given value.
473
+ * @param value - The amount to darken the color.
474
+ * @returns A new RGB color that is darkened.
475
+ */
102
476
  darken(value: number): RGB;
477
+ /**
478
+ * Tints the color by blending it with another color.
479
+ * @param value - The blend ratio.
480
+ * @param tintColor - The color to blend with.
481
+ * @returns A new RGB color that is tinted.
482
+ */
103
483
  tint(value: number, tintColor: Color): RGB;
484
+ /**
485
+ * Blends the color with another color.
486
+ * @param value - The blend ratio.
487
+ * @param blendColor - The color to blend with.
488
+ * @returns A new RGB color that is blended.
489
+ */
104
490
  blend(value: number, blendColor: Color): RGB;
491
+ /**
492
+ * Sets the hue of the color.
493
+ * @param value - The new hue value.
494
+ * @returns A new HSV color with the hue set.
495
+ */
105
496
  setHue(value: number): HSV;
497
+ /**
498
+ * Fades the color by a given value.
499
+ * @param value - The fade value.
500
+ * @returns A new Color instance that is faded.
501
+ */
106
502
  abstract fade(value: number): Color;
107
503
  }
108
504
 
@@ -128,22 +524,22 @@ declare abstract class Color {
128
524
  *
129
525
  * ```typescript
130
526
  * const style = VersaTilesStyle.colorful({
131
- * recolor: {
132
- * rotate: 180,
133
- * saturate: 0.5,
134
- * brightness: 0.2,
135
- * }
527
+ * recolor: {
528
+ * rotate: 180,
529
+ * saturate: 0.5,
530
+ * brightness: 0.2,
531
+ * }
136
532
  * };
137
533
  * ```
138
534
  *
139
535
  * If you want do make you map simply brighter or darker, you can use the `blend` option:
140
536
  * ```typescript
141
537
  * const style = VersaTilesStyle.colorful({
142
- * recolor: {
143
- * blend: 0.5,
144
- * blendColor: '#000000', // to blend all colors with black
145
- * // or blendColor: '#FFFFFF', // to blend all colors with white
146
- * }
538
+ * recolor: {
539
+ * blend: 0.5,
540
+ * blendColor: '#000000', // to blend all colors with black
541
+ * // or blendColor: '#FFFFFF', // to blend all colors with white
542
+ * }
147
543
  * };
148
544
  * ```
149
545
  *
@@ -214,102 +610,66 @@ interface RecolorOptions {
214
610
 
215
611
  /** Represents language suffixes used in map styles. */
216
612
  type Language = 'de' | 'en' | null;
217
- /** Options for configuring a style builder. */
613
+ /**
614
+ * Options for configuring the style builder.
615
+ */
218
616
  interface StyleBuilderOptions {
219
617
  /**
220
618
  * The base URL for loading external resources like tiles, sprites, and fonts.
221
- * Default: document.location.origin (in the browser), or 'https://tiles.versatiles.org'
619
+ * @default document.location.origin (in the browser), or 'https://tiles.versatiles.org'
222
620
  */
223
621
  baseUrl?: string;
224
622
  /**
225
623
  * The bounding box for the map, formatted as [sw.lng, sw.lat, ne.lng, ne.lat].
226
- * Default: [-180, -85.0511287798066, 180, 85.0511287798066]
624
+ * @default [-180, -85.0511287798066, 180, 85.0511287798066]
227
625
  */
228
626
  bounds?: [number, number, number, number];
229
627
  /**
230
628
  * The URL template for loading font glyphs, formatted with '{fontstack}' and '{range}' placeholders.
231
- * Default: '/assets/glyphs/{fontstack}/{range}.pbf'
629
+ * @default '/assets/glyphs/{fontstack}/{range}.pbf'
232
630
  */
233
631
  glyphs?: string;
234
632
  /**
235
633
  * The URL for loading sprite images and metadata.
236
- * Default: [{ id: 'basics', url: '/assets/sprites/basics/sprites' }]
634
+ * @default [{ id: 'basics', url: '/assets/sprites/basics/sprites' }]
237
635
  */
238
636
  sprite?: SpriteSpecification;
239
637
  /**
240
638
  * An array of URL templates for loading map tiles, using '{z}', '{x}', and '{y}' placeholders.
241
- * Default: ['/tiles/osm/{z}/{x}/{y}']
639
+ * @default ['/tiles/osm/{z}/{x}/{y}']
242
640
  */
243
641
  tiles?: string[];
244
642
  /**
245
643
  * If set to true, hides all map labels.
246
- * Default: false
644
+ * @default false
247
645
  */
248
646
  hideLabels?: boolean;
249
647
  /**
250
648
  * Set the language ('en', 'de') of all map labels.
251
649
  * A null value means that the language of the country in which the label is drawn will be used.
252
- * Default: null
650
+ * See also: {@link Language}
651
+ * @default null
253
652
  */
254
653
  language?: Language;
255
654
  /**
256
655
  * An object specifying overrides for default color values, keyed by the color names.
656
+ * See also: {@link StyleBuilderColors}
257
657
  */
258
658
  colors?: Partial<StyleBuilderColors>;
259
659
  /**
260
660
  * An object specifying overrides for default font names, keyed by the font names.
661
+ * See also: {@link StyleBuilderFonts}
261
662
  */
262
663
  fonts?: Partial<StyleBuilderFonts>;
263
664
  /**
264
665
  * Options for color adjustments and transformations applied to the entire style.
666
+ * See also: {@link RecolorOptions}
265
667
  */
266
668
  recolor?: RecolorOptions;
267
669
  }
670
+ type StyleBuilderColorKey = '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';
268
671
  /** Records string values for color properties in a style builder. */
269
- interface StyleBuilderColors {
270
- agriculture: Color | string;
271
- boundary: Color | string;
272
- building: Color | string;
273
- buildingbg: Color | string;
274
- burial: Color | string;
275
- commercial: Color | string;
276
- construction: Color | string;
277
- cycle: Color | string;
278
- danger: Color | string;
279
- disputed: Color | string;
280
- education: Color | string;
281
- foot: Color | string;
282
- glacier: Color | string;
283
- grass: Color | string;
284
- hospital: Color | string;
285
- industrial: Color | string;
286
- label: Color | string;
287
- labelHalo: Color | string;
288
- land: Color | string;
289
- leisure: Color | string;
290
- motorway: Color | string;
291
- motorwaybg: Color | string;
292
- park: Color | string;
293
- parking: Color | string;
294
- poi: Color | string;
295
- prison: Color | string;
296
- rail: Color | string;
297
- residential: Color | string;
298
- rock: Color | string;
299
- sand: Color | string;
300
- shield: Color | string;
301
- street: Color | string;
302
- streetbg: Color | string;
303
- subway: Color | string;
304
- symbol: Color | string;
305
- trunk: Color | string;
306
- trunkbg: Color | string;
307
- waste: Color | string;
308
- water: Color | string;
309
- wetland: Color | string;
310
- wood: Color | string;
311
- }
312
- type StyleBuilderColorsEnsured = Record<keyof StyleBuilderColors, Color>;
672
+ type StyleBuilderColors<T = Color | string> = Record<StyleBuilderColorKey, T>;
313
673
  /** Records string values for font properties in a style builder. */
314
674
  type StyleBuilderFonts = {
315
675
  regular: string;
@@ -323,6 +683,7 @@ interface StyleBuilderFunction {
323
683
  declare const colorful: StyleBuilderFunction;
324
684
  declare const eclipse: StyleBuilderFunction;
325
685
  declare const graybeard: StyleBuilderFunction;
686
+ declare const shadow: StyleBuilderFunction;
326
687
  declare const neutrino: StyleBuilderFunction;
327
688
 
328
689
  /** Represents the structure of a vector layer in a TileJSON specification. */
@@ -360,18 +721,43 @@ interface TileJSONSpecificationVector extends TileJSONSpecificationRaster {
360
721
  /** Represents a TileJSON specification, which can be either raster or vector. */
361
722
  type TileJSONSpecification = TileJSONSpecificationRaster | TileJSONSpecificationVector;
362
723
 
724
+ /**
725
+ * Options for guessing the style of a map.
726
+ */
363
727
  interface GuessStyleOptions {
728
+ /**
729
+ * Base URL to resolve URLs for tile sources, glyphs, and sprites.
730
+ */
364
731
  baseUrl?: string;
732
+ /**
733
+ * URL template for glyphs.
734
+ */
365
735
  glyphs?: string;
736
+ /**
737
+ * URL template for sprites. See also {@link SpriteSpecification}.
738
+ */
366
739
  sprite?: SpriteSpecification;
367
740
  }
741
+ /**
742
+ * Generates a style specification based on the provided TileJSON specification and optional parameters.
743
+ *
744
+ * @param {TileJSONSpecification} tileJSON - The TileJSON specification to generate the style from.
745
+ * @param {GuessStyleOptions} [options] - Optional parameters to customize the style generation.
746
+ * @param {string} [options.baseUrl] - Base URL to resolve tile URLs.
747
+ * @param {string} [options.glyphs] - URL template for glyphs.
748
+ * @param {string} [options.sprite] - URL template for sprites.
749
+ * @returns {StyleSpecification} The generated style specification.
750
+ * @throws {Error} If the provided TileJSON specification is invalid.
751
+ */
368
752
  declare function guessStyle(tileJSON: TileJSONSpecification, options?: GuessStyleOptions): StyleSpecification;
369
753
 
370
754
  declare const styles: {
371
755
  colorful: StyleBuilderFunction;
372
756
  eclipse: StyleBuilderFunction;
373
757
  graybeard: StyleBuilderFunction;
758
+ shadow: StyleBuilderFunction;
374
759
  neutrino: StyleBuilderFunction;
375
760
  };
376
761
 
377
- export { Color, type GuessStyleOptions, HSL, HSV, type Language, RGB, type RandomColorOptions, type RecolorOptions, type StyleBuilderColors, type StyleBuilderColorsEnsured, type StyleBuilderFonts, type StyleBuilderFunction, type StyleBuilderOptions, type TileJSONSpecification, type TileJSONSpecificationRaster, type TileJSONSpecificationVector, type VectorLayer, colorful, eclipse, graybeard, guessStyle, neutrino, styles };
762
+ export { Color, HSL, HSV, RGB, colorful, eclipse, graybeard, guessStyle, neutrino, shadow, styles };
763
+ export type { GuessStyleOptions, Language, RandomColorOptions, RecolorOptions, StyleBuilderColorKey, StyleBuilderColors, StyleBuilderFonts, StyleBuilderFunction, StyleBuilderOptions, TileJSONSpecification, TileJSONSpecificationRaster, TileJSONSpecificationVector, VectorLayer };