@versatiles/style 5.2.3 → 5.2.5

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 (48) hide show
  1. package/README.MD +69 -45
  2. package/dist/color/abstract.d.ts +5 -5
  3. package/dist/color/hsl.d.ts +4 -4
  4. package/dist/color/hsl.js +11 -9
  5. package/dist/color/hsv.d.ts +3 -3
  6. package/dist/color/hsv.js +4 -4
  7. package/dist/color/index.d.ts +5 -5
  8. package/dist/color/index.js +15 -13
  9. package/dist/color/random.d.ts +1 -1
  10. package/dist/color/random.js +2 -2
  11. package/dist/color/rgb.d.ts +4 -4
  12. package/dist/color/rgb.js +14 -12
  13. package/dist/guess_style/guess_style.d.ts +1 -1
  14. package/dist/guess_style/guess_style.js +5 -5
  15. package/dist/guess_style/index.d.ts +2 -2
  16. package/dist/guess_style/index.js +1 -1
  17. package/dist/index.d.ts +13 -26
  18. package/dist/index.js +4 -3
  19. package/dist/lib/utils.js +1 -1
  20. package/dist/shortbread/index.d.ts +2 -2
  21. package/dist/shortbread/index.js +2 -2
  22. package/dist/shortbread/layers.d.ts +2 -2
  23. package/dist/style_builder/decorator.d.ts +3 -3
  24. package/dist/style_builder/decorator.js +3 -3
  25. package/dist/style_builder/recolor.d.ts +1 -1
  26. package/dist/style_builder/recolor.js +1 -1
  27. package/dist/style_builder/style_builder.d.ts +6 -6
  28. package/dist/style_builder/style_builder.js +6 -6
  29. package/dist/style_builder/types.d.ts +94 -16
  30. package/dist/style_builder/types.js +1 -0
  31. package/dist/styles/colorful.d.ts +3 -86
  32. package/dist/styles/colorful.js +1 -1
  33. package/dist/styles/eclipse.d.ts +1 -1
  34. package/dist/styles/eclipse.js +1 -1
  35. package/dist/styles/empty.d.ts +2 -2
  36. package/dist/styles/empty.js +1 -1
  37. package/dist/styles/graybeard.d.ts +1 -1
  38. package/dist/styles/graybeard.js +1 -1
  39. package/dist/styles/index.d.ts +8 -19
  40. package/dist/styles/index.js +5 -5
  41. package/dist/styles/neutrino.d.ts +3 -57
  42. package/dist/styles/neutrino.js +1 -1
  43. package/dist/types/index.d.ts +5 -5
  44. package/dist/types/index.js +2 -2
  45. package/dist/types/tilejson.d.ts +1 -1
  46. package/package.json +11 -8
  47. package/dist/style_builder/index.d.ts +0 -1
  48. package/dist/style_builder/index.js +0 -2
package/README.MD CHANGED
@@ -5,39 +5,45 @@
5
5
 
6
6
  # VersaTiles Style
7
7
 
8
- > [!WARNING]
9
- > We are currently migrating to the [VersaTiles Frontend Specification](https://github.com/versatiles-org/versatiles-documentation/blob/main/compendium/specification_frontend.md). While this is good for the long term, it does mean that there will be breaking changes in the short term. You can find the [old v4.4.1 release here](https://github.com/versatiles-org/versatiles-style/releases/tag/v4.4.1).
8
+ **VersaTiles Style** generates styles and sprites for MapLibre.
10
9
 
11
- Generates styles and sprites for MapLibre.
10
+ ---
12
11
 
13
- ![Example: Colorful Style](docs/colorful.png)
12
+ ## Styles Overview
14
13
 
15
- # Styles
14
+ | Style Name | Preview |
15
+ |---------------|---------------------------------------------------------------------------|
16
+ | **colorful** | <img width="384" src="screenshots/colorful.png" alt="colorful style" /> |
17
+ | **graybeard** | <img width="384" src="screenshots/graybeard.png" alt="graybeard style" /> |
18
+ | **eclipse** | <img width="384" src="screenshots/eclipse.png" alt="eclipse style" /> |
19
+ | **neutrino** | <img width="384" src="screenshots/neutrino.png" alt="neutrino style" /> |
16
20
 
17
- * Colorful - colorful, full featured map
18
- * Graybeard - gray, full featured map
19
- * Eclipse - dark, full featured map
20
- * Neutrino - light basemap
21
+ ---
21
22
 
22
- # Use styles for versatiles.org
23
+ ## Using VersaTiles Styles
23
24
 
24
- You in the the [latest release](https://github.com/versatiles-org/versatiles-style/releases/latest/) you can find:
25
- - [`styles.tar.gz`](https://github.com/versatiles-org/versatiles-style/releases/latest/download/styles.tar.gz) containing all styles, each in multiple languages.
26
- Be aware that these styles use `tiles.versatiles.org` as source for tiles, fonts (glyphs) and icons (sprites).
27
- - [`sprites.tar.gz`](https://github.com/versatiles-org/versatiles-style/releases/latest/download/sprites.tar.gz) containing sprites, used e.g. for map icons
28
- - [`versatiles-style.tar.gz`](https://github.com/versatiles-org/versatiles-style/releases/latest/download/versatiles-style.tar.gz) containing a JavaScript file to generate your own style in the browser.
25
+ ### Prebuilt Styles and Sprites
29
26
 
30
- # Generating styles on-the-fly
27
+ Download the assets from the [latest release](https://github.com/versatiles-org/versatiles-style/releases/latest/):
31
28
 
32
- ## Generating styles in the frontend (web browser)
29
+ - **[styles.tar.gz](https://github.com/versatiles-org/versatiles-style/releases/latest/download/styles.tar.gz):** Contains all styles in multiple languages.
30
+ - **Note:** These styles use `tiles.versatiles.org` as the source for tiles, fonts (glyphs), and icons (sprites).
31
+ - **[sprites.tar.gz](https://github.com/versatiles-org/versatiles-style/releases/latest/download/sprites.tar.gz):** Includes map icons and other sprites.
32
+ - **[versatiles-style.tar.gz](https://github.com/versatiles-org/versatiles-style/releases/latest/download/versatiles-style.tar.gz):** Contains a JavaScript file to generate styles dynamically in the browser.
33
33
 
34
- Download latest release:
34
+ ---
35
+
36
+ ## Generating Styles On-the-Fly
37
+
38
+ ### Frontend Usage (Web Browser)
39
+
40
+ Download the latest release:
35
41
 
36
42
  ```bash
37
43
  curl -Ls "https://github.com/versatiles-org/versatiles-style/releases/latest/download/versatiles-style.tar.gz" | gzip -d | tar -xf -
38
44
  ```
39
45
 
40
- Use it in:
46
+ Integrate it into your HTML application:
41
47
 
42
48
  ```html
43
49
  <div id="map"></div>
@@ -57,62 +63,80 @@ Use it in:
57
63
  </script>
58
64
  ```
59
65
 
60
- ## Generating styles in the backend (Node.js)
66
+ ### Backend Usage (Node.js)
61
67
 
62
- Install `@versatiles/style` via NPM:
68
+ Install the library via NPM:
63
69
 
64
70
  ```bash
65
71
  npm install @versatiles/style
66
72
  ```
67
73
 
68
- Use it in Node.js:
74
+ Generate styles programmatically:
69
75
 
70
76
  ```javascript
71
77
  import { colorful } from '@versatiles/style';
72
- let style = colorful({
78
+ import { writeFileSync } from 'node:fs';
79
+
80
+ const style = colorful({
73
81
  language: 'en',
74
82
  });
75
83
  writeFileSync('style.json', JSON.stringify(style));
76
84
  ```
77
85
 
78
- ### Methods for generating styles
86
+ ---
79
87
 
80
- This library provides:
81
- - `style = colorful(options);`
82
- - `style = eclipse(options);`
83
- - `style = graybeard(options);`
84
- - `style = neutrino(options);`
88
+ ## Style Generation Methods
85
89
 
86
- Where `options` is an optional object
90
+ The library offers the following style generation methods:
87
91
 
88
- ### Method: `guessStyle(options)`
92
+ - `colorful(options)` - [Documentation](https://github.com/versatiles-org/versatiles-style/blob/main/docs/functions/colorful.md)
93
+ - `eclipse(options)` - [Documentation](https://github.com/versatiles-org/versatiles-style/blob/main/docs/functions/eclipse.md)
94
+ - `graybeard(options)` - [Documentation](https://github.com/versatiles-org/versatiles-style/blob/main/docs/functions/graybeard.md)
95
+ - `neutrino(options)` - [Documentation](https://github.com/versatiles-org/versatiles-style/blob/main/docs/functions/neutrino.md)
96
+
97
+ **`options`**: An optional object to customize the styles. [Learn more](https://github.com/versatiles-org/versatiles-style/blob/main/docs/interfaces/StyleBuilderOptions.md)
98
+
99
+ ### Guess Style Method
89
100
 
90
101
  ```javascript
91
102
  const style = guessStyle(options);
92
103
  ```
104
+ [Documentation](https://github.com/versatiles-org/versatiles-style/blob/main/docs/functions/guessStyle.md)
105
+
106
+ ---
93
107
 
108
+ ## Build Instructions
94
109
 
95
- **Parameters:**
110
+ ### Prerequisites
96
111
 
97
- * <code>opt: TileJSONOption</code>
112
+ To build new sprites, ensure `optipng` is installed.
98
113
 
99
- **Returns:** <code>MaplibreStyle</code>
114
+ ### SVG Source Requirements
100
115
 
101
- # Build
116
+ - SVGs must consist only of paths and should not contain any `transform()` attributes.
117
+ - Styles and colors within the SVG are ignored.
118
+ - All length values must be specified in pixels without units.
102
119
 
103
- Please note that for building new sprites you need `optipng`.
120
+ ### Configuration
104
121
 
105
- ## SVG Sources
122
+ Define icon sets in the configuration file: [`scripts/config-sprites.ts`](./scripts/config-sprites.ts)
123
+
124
+ ---
125
+
126
+ ## Development
127
+
128
+ Run the project in development mode:
129
+
130
+ ```bash
131
+ npm run dev
132
+ ```
106
133
 
107
- * SVG sources should consist only of paths and not contain any `transform()`s.
108
- * Colors and styles are ignored.
109
- * All lengths must be in pixels without unit.
134
+ A local server will be available at [http://localhost:8080](http://localhost:8080). Use it to select a style, edit definitions in `src/styles/...`, and reload the page to view the changes.
110
135
 
111
- ## Configuration
136
+ ---
112
137
 
113
- Iconsets can be defined in [`scripts/config-sprites.ts`](./scripts/config-sprites.ts)
138
+ ## Licenses
114
139
 
115
- # Licenses
140
+ - **Source Code:** [Unlicense](./LICENSE.md)
141
+ - **Iconsets and Rendered Spritemaps:** [CC0 1.0 Universal](./icons/LICENSE.md)
116
142
 
117
- * Sourcecode: [Unlicense](./LICENSE.md)
118
- * Iconsets and rendered Spritemaps: [CC0 1.0 Universal](./icons/LICENSE.md)
@@ -1,9 +1,9 @@
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.js';
2
+ import type { HSV } from './hsv.js';
3
+ import { RandomColorOptions } from './random.js';
4
+ import type { RGB } from './rgb.js';
5
5
  export declare abstract class Color {
6
- static parse: (str: string) => Color;
6
+ static parse: (input: Color | string) => Color;
7
7
  static HSL: typeof HSL;
8
8
  static HSV: typeof HSV;
9
9
  static RGB: typeof RGB;
@@ -1,6 +1,6 @@
1
- import { Color } from './abstract';
2
- import { HSV } from './hsv';
3
- import { RGB } from './rgb';
1
+ import { Color } from './abstract.js';
2
+ import { HSV } from './hsv.js';
3
+ import { RGB } from './rgb.js';
4
4
  export declare class HSL extends Color {
5
5
  readonly h: number;
6
6
  readonly s: number;
@@ -15,7 +15,7 @@ export declare class HSL extends Color {
15
15
  toHSL(): HSL;
16
16
  asHSV(): HSV;
17
17
  asRGB(): RGB;
18
- static parse(str: string): HSL;
18
+ static parse(input: string | Color): HSL;
19
19
  invertLuminosity(): HSL;
20
20
  rotateHue(offset: number): HSL;
21
21
  saturate(ratio: number): HSL;
package/dist/color/hsl.js CHANGED
@@ -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.js';
2
+ import { HSV } from './hsv.js';
3
+ import { RGB } from './rgb.js';
4
+ import { clamp, formatFloat, mod } from './utils.js';
5
5
  export class HSL extends Color {
6
6
  h = 0; // between 0 and 360
7
7
  s = 0; // between 0 and 100
@@ -68,17 +68,19 @@ export class HSL extends Color {
68
68
  // Convert to RGB in the 0-255 range and return
69
69
  return new RGB(255 * hueToRgb(h + 1 / 3), 255 * hueToRgb(h), 255 * hueToRgb(h - 1 / 3), this.a);
70
70
  }
71
- static parse(str) {
72
- str = str.replace(/\s+/g, '').toLowerCase();
73
- let match = str.match(/^hsl\((?<h>[-+0-9.]+)(?:deg)?,(?<s>[-+0-9.]+)%,(?<l>[-+0-9.]+)%\)$/);
71
+ static parse(input) {
72
+ if (input instanceof Color)
73
+ return input.asHSL();
74
+ input = input.replace(/\s+/g, '').toLowerCase();
75
+ let match = input.match(/^hsl\((?<h>[-+0-9.]+)(?:deg)?,(?<s>[-+0-9.]+)%,(?<l>[-+0-9.]+)%\)$/);
74
76
  if (match) {
75
77
  return new HSL(parseFloat(match.groups.h), parseFloat(match.groups.s), parseFloat(match.groups.l));
76
78
  }
77
- match = str.match(/^hsla\((?<h>[-+0-9.]+)(?:deg)?,(?<s>[-+0-9.]+)%,(?<l>[-+0-9.]+)%,(?<a>[-+0-9.]+)\)$/);
79
+ match = input.match(/^hsla\((?<h>[-+0-9.]+)(?:deg)?,(?<s>[-+0-9.]+)%,(?<l>[-+0-9.]+)%,(?<a>[-+0-9.]+)\)$/);
78
80
  if (match) {
79
81
  return new HSL(parseFloat(match.groups.h), parseFloat(match.groups.s), parseFloat(match.groups.l), parseFloat(match.groups.a));
80
82
  }
81
- throw new Error(`Invalid HSL color string: "${str}"`);
83
+ throw new Error(`Invalid HSL color string: "${input}"`);
82
84
  }
83
85
  invertLuminosity() {
84
86
  return new HSL(this.h, this.s, 100 - this.l, this.a);
@@ -1,6 +1,6 @@
1
- import { Color } from './abstract';
2
- import { HSL } from './hsl';
3
- import { RGB } from './rgb';
1
+ import { Color } from './abstract.js';
2
+ import { HSL } from './hsl.js';
3
+ import { RGB } from './rgb.js';
4
4
  export declare class HSV extends Color {
5
5
  readonly h: number;
6
6
  readonly s: number;
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.js';
2
+ import { HSL } from './hsl.js';
3
+ import { RGB } from './rgb.js';
4
+ import { clamp, mod } from './utils.js';
5
5
  export class HSV extends Color {
6
6
  h = 0; // between 0 and 360
7
7
  s = 0; // between 0 and 100
@@ -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.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';
6
6
  export { Color };
@@ -1,22 +1,24 @@
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
- Color.parse = function (str) {
7
- str = str.trim().toLowerCase();
8
- if (str.startsWith('#'))
9
- return RGB.parse(str);
10
- const prefix = str.replace(/\d.*/, '').trim().toLowerCase();
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';
6
+ Color.parse = function (input) {
7
+ if (input instanceof Color)
8
+ return input;
9
+ input = input.trim().toLowerCase();
10
+ if (input.startsWith('#'))
11
+ return RGB.parse(input);
12
+ const prefix = input.replace(/\d.*/, '').trim().toLowerCase();
11
13
  switch (prefix) {
12
14
  case 'rgb(':
13
15
  case 'rgba(':
14
- return RGB.parse(str);
16
+ return RGB.parse(input);
15
17
  case 'hsl(':
16
18
  case 'hsla(':
17
- return HSL.parse(str);
19
+ return HSL.parse(input);
18
20
  default:
19
- throw Error('Unknown color format: ' + str);
21
+ throw Error('Unknown color format: ' + input);
20
22
  }
21
23
  };
22
24
  Color.HSL = HSL;
@@ -1,4 +1,4 @@
1
- import { HSV } from './hsv';
1
+ import { HSV } from './hsv.js';
2
2
  export interface RandomColorOptions {
3
3
  seed?: string;
4
4
  hue?: number | string;
@@ -1,5 +1,5 @@
1
- import { HSV } from './hsv';
2
- import { mod } from './utils';
1
+ import { HSV } from './hsv.js';
2
+ import { mod } from './utils.js';
3
3
  let colorDictionary = new Map();
4
4
  export default function randomColor(options) {
5
5
  if (colorDictionary.size === 0)
@@ -1,6 +1,6 @@
1
- import { HSL } from './hsl';
2
- import { HSV } from './hsv';
3
- import { Color } from './abstract';
1
+ import { HSL } from './hsl.js';
2
+ import { HSV } from './hsv.js';
3
+ import { Color } from './abstract.js';
4
4
  export declare class RGB extends Color {
5
5
  readonly r: number;
6
6
  readonly g: number;
@@ -16,7 +16,7 @@ export declare class RGB extends Color {
16
16
  asHSV(): HSV;
17
17
  asRGB(): RGB;
18
18
  toRGB(): RGB;
19
- static parse(str: string): RGB;
19
+ static parse(input: string | Color): RGB;
20
20
  gamma(value: number): RGB;
21
21
  invert(): RGB;
22
22
  contrast(value: number): RGB;
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.js';
2
+ import { HSV } from './hsv.js';
3
+ import { Color } from './abstract.js';
4
+ import { clamp, formatFloat } from './utils.js';
5
5
  export class RGB extends Color {
6
6
  r = 0; // between 0 and 255
7
7
  g = 0; // between 0 and 255
@@ -109,10 +109,12 @@ export class RGB extends Color {
109
109
  toRGB() {
110
110
  return this;
111
111
  }
112
- static parse(str) {
113
- str = str.toLowerCase().replaceAll(/[^0-9a-z.#,()]/g, '');
112
+ static parse(input) {
113
+ if (input instanceof Color)
114
+ return input.asRGB();
115
+ input = input.toLowerCase().replaceAll(/[^0-9a-z.#,()]/g, '');
114
116
  let match;
115
- match = str.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/);
117
+ match = input.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/);
116
118
  if (match) {
117
119
  const r = parseInt(match[1], 16);
118
120
  const g = parseInt(match[2], 16);
@@ -120,7 +122,7 @@ export class RGB extends Color {
120
122
  const a = match[4] ? parseInt(match[4], 16) / 255 : 1;
121
123
  return new RGB(r, g, b, a);
122
124
  }
123
- match = str.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/);
125
+ match = input.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/);
124
126
  if (match) {
125
127
  const r = parseInt(match[1], 16) * 17;
126
128
  const g = parseInt(match[2], 16) * 17;
@@ -128,15 +130,15 @@ export class RGB extends Color {
128
130
  const a = match[4] ? parseInt(match[4], 16) / 15 : 1;
129
131
  return new RGB(r, g, b, a);
130
132
  }
131
- str = str.trim().toLowerCase().replaceAll(' ', '');
132
- match = str.match(/^rgb\((\d+),(\d+),(\d+)\)$/);
133
+ input = input.trim().toLowerCase().replaceAll(' ', '');
134
+ match = input.match(/^rgb\((\d+),(\d+),(\d+)\)$/);
133
135
  if (match) {
134
136
  const r = parseInt(match[1]);
135
137
  const g = parseInt(match[2]);
136
138
  const b = parseInt(match[3]);
137
139
  return new RGB(r, g, b);
138
140
  }
139
- match = str.match(/^rgba\((\d+),(\d+),(\d+),([.\d]+)\)$/);
141
+ match = input.match(/^rgba\((\d+),(\d+),(\d+),([.\d]+)\)$/);
140
142
  if (match) {
141
143
  const r = parseInt(match[1]);
142
144
  const g = parseInt(match[2]);
@@ -144,7 +146,7 @@ export class RGB extends Color {
144
146
  const a = parseFloat(match[4]);
145
147
  return new RGB(r, g, b, a);
146
148
  }
147
- throw new Error(`Invalid RGB color string: "${str}"`);
149
+ throw new Error(`Invalid RGB color string: "${input}"`);
148
150
  }
149
151
  gamma(value) {
150
152
  if (value < 1e-3)
@@ -1,4 +1,4 @@
1
- import type { TileJSONSpecification } from '../types/index';
1
+ import type { TileJSONSpecification } from '../types/index.js';
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.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';
6
6
  export function guessStyle(tileJSON, options) {
7
7
  tileJSON = deepClone(tileJSON);
8
8
  if (options && options.baseUrl) {
@@ -1,2 +1,2 @@
1
- export type { GuessStyleOptions } from './guess_style';
2
- export { guessStyle } from './guess_style';
1
+ export type { GuessStyleOptions } from './guess_style.js';
2
+ export { guessStyle } from './guess_style.js';
@@ -1,2 +1,2 @@
1
- export { guessStyle } from './guess_style';
1
+ export { guessStyle } from './guess_style.js';
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -1,28 +1,15 @@
1
- export type { colorful, eclipse, graybeard, neutrino } from './styles/index';
1
+ export { colorful, eclipse, graybeard, neutrino, type StyleBuilderFunction } from './styles/index.js';
2
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
- };
3
+ colorful: import("./styles/index.js").StyleBuilderFunction;
4
+ eclipse: import("./styles/index.js").StyleBuilderFunction;
5
+ graybeard: import("./styles/index.js").StyleBuilderFunction;
6
+ neutrino: import("./styles/index.js").StyleBuilderFunction;
19
7
  };
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';
8
+ export type { GuessStyleOptions } from './guess_style/index.js';
9
+ export type { RGB, HSL, HSV, RandomColorOptions } from './color/index.js';
10
+ export type { TileJSONSpecification, TileJSONSpecificationRaster, TileJSONSpecificationVector } from './types/tilejson.js';
11
+ export type { VectorLayer } from './types/index.js';
12
+ export type { StyleBuilderOptions, Language, StyleBuilderColors, StyleBuilderColorsEnsured, StyleBuilderFonts } from './style_builder/types.js';
13
+ export type { RecolorOptions } from './style_builder/recolor.js';
14
+ export { guessStyle } from './guess_style/index.js';
15
+ export { Color } from './color/index.js';
package/dist/index.js CHANGED
@@ -1,10 +1,11 @@
1
- import { colorful, eclipse, graybeard, neutrino } from './styles/index';
1
+ export { colorful, eclipse, graybeard, neutrino } from './styles/index.js';
2
+ import { colorful, eclipse, graybeard, neutrino } from './styles/index.js';
2
3
  export const styles = {
3
4
  colorful,
4
5
  eclipse,
5
6
  graybeard,
6
7
  neutrino,
7
8
  };
8
- export { guessStyle } from './guess_style/index';
9
- export { Color } from './color/index';
9
+ export { guessStyle } from './guess_style/index.js';
10
+ export { Color } from './color/index.js';
10
11
  //# 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.js';
2
2
  // Utility function to deep clone an object
3
3
  export function deepClone(obj) {
4
4
  const type = typeof obj;
@@ -1,2 +1,2 @@
1
- export { getShortbreadTemplate } from './template';
2
- export { getShortbreadLayers } from './layers';
1
+ export { getShortbreadTemplate } from './template.js';
2
+ export { getShortbreadLayers } from './layers.js';
@@ -1,3 +1,3 @@
1
- export { getShortbreadTemplate } from './template';
2
- export { getShortbreadLayers } from './layers';
1
+ export { getShortbreadTemplate } from './template.js';
2
+ export { getShortbreadLayers } from './layers.js';
3
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 { MaplibreLayerDefinition } from '../types/index.js';
2
+ import { Language } from '../style_builder/types.js';
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.js';
2
+ import type { StyleRules } from './types.js';
3
+ import type { CachedRecolor } from './recolor.js';
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.js';
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.js';
4
+ import { deepMerge } from '../lib/utils.js';
5
5
  export function decorate(layers, rules, recolor) {
6
6
  const layerIds = layers.map(l => l.id);
7
7
  const layerIdSet = new Set(layerIds);
@@ -1,4 +1,4 @@
1
- import { Color } from '../color/index';
1
+ import { Color } from '../color/index.js';
2
2
  export interface RecolorOptions {
3
3
  invertBrightness?: boolean;
4
4
  rotate?: number;
@@ -1,4 +1,4 @@
1
- import { Color } from '../color/index';
1
+ import { Color } from '../color/index.js';
2
2
  export function getDefaultRecolorFlags() {
3
3
  return {
4
4
  invertBrightness: false,
@@ -1,14 +1,14 @@
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';
1
+ import { Color } from '../color/index.js';
2
+ import type { StyleSpecification } from '../types/maplibre.js';
3
+ import type { StyleBuilderColors, StyleBuilderColorsEnsured, StyleBuilderFonts, StyleBuilderOptions } from './types.js';
4
+ import type { StyleRules, StyleRulesOptions } from './types.js';
5
5
  export declare abstract class StyleBuilder {
6
6
  #private;
7
7
  abstract readonly name: string;
8
- abstract readonly defaultColors: StyleBuilderColorStrings;
8
+ abstract readonly defaultColors: StyleBuilderColors;
9
9
  abstract readonly defaultFonts: StyleBuilderFonts;
10
10
  build(options?: StyleBuilderOptions): StyleSpecification;
11
- getColors(colors: StyleBuilderColorStrings): StyleBuilderColors;
11
+ getColors(colors: StyleBuilderColors): StyleBuilderColorsEnsured;
12
12
  getDefaultOptions(): StyleBuilderOptions;
13
13
  protected transformDefaultColors(callback: (color: Color) => Color): void;
14
14
  protected abstract getStyleRules(options: StyleRulesOptions): StyleRules;
@@ -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.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';
6
6
  // StyleBuilder class definition
7
7
  export class StyleBuilder {
8
8
  #sourceName = 'versatiles-shortbread';
@@ -99,7 +99,7 @@ export class StyleBuilder {
99
99
  const colors = this.getColors(this.defaultColors);
100
100
  let key;
101
101
  for (key in colors) {
102
- this.defaultColors[key] = callback(colors[key]).asHex();
102
+ this.defaultColors[key] = callback(colors[key]);
103
103
  }
104
104
  }
105
105
  }
@@ -1,39 +1,117 @@
1
- import type { Color } from '../color/index';
2
- import type { RecolorOptions } from './recolor';
1
+ import type { Color } from '../color/index.js';
2
+ import type { RecolorOptions } from './recolor.js';
3
3
  import { SpriteSpecification } from '@maplibre/maplibre-gl-style-spec';
4
4
  /** Represents language suffixes used in map styles. */
5
5
  export type Language = 'de' | 'en' | null;
6
+ /** Options for configuring a style builder. */
6
7
  export interface StyleBuilderOptions {
8
+ /**
9
+ * The base URL for loading external resources like tiles, sprites, and fonts.
10
+ * Default: document.location.origin (in the browser), or 'https://tiles.versatiles.org'
11
+ */
7
12
  baseUrl?: string;
13
+ /**
14
+ * The URL template for loading font glyphs, formatted with '{fontstack}' and '{range}' placeholders.
15
+ * Default: '/assets/glyphs/{fontstack}/{range}.pbf'
16
+ */
8
17
  glyphs?: string;
18
+ /**
19
+ * The URL for loading sprite images and metadata.
20
+ * Default: [{ id: 'basics', url: '/assets/sprites/basics/sprites' }]
21
+ */
9
22
  sprite?: SpriteSpecification;
23
+ /**
24
+ * An array of URL templates for loading map tiles, using '{z}', '{x}', and '{y}' placeholders.
25
+ * Default: ['/tiles/osm/{z}/{x}/{y}']
26
+ */
10
27
  tiles?: string[];
28
+ /**
29
+ * If set to true, hides all map labels.
30
+ * Default: false
31
+ */
11
32
  hideLabels?: boolean;
33
+ /**
34
+ * Set the language ('en', 'de') of all map labels.
35
+ * A null value means that the language of the country in which the label is drawn will be used.
36
+ * Default: null
37
+ */
12
38
  language?: Language;
13
- colors?: Partial<StyleBuilderColorStrings>;
39
+ /**
40
+ * An object specifying overrides for default color values, keyed by the color names.
41
+ */
42
+ colors?: Partial<StyleBuilderColors>;
43
+ /**
44
+ * An object specifying overrides for default font names, keyed by the font names.
45
+ */
14
46
  fonts?: Partial<StyleBuilderFonts>;
47
+ /**
48
+ * Options for color adjustments and transformations applied to the entire style.
49
+ */
15
50
  recolor?: RecolorOptions;
16
51
  }
17
- /** Defines the keys for color properties in a style builder. */
18
- export type StyleBuilderColorKeys = 'agriculture' | 'boundary' | 'building' | 'buildingbg' | 'burial' | 'commercial' | 'construction' | 'cycle' | 'danger' | 'disputed' | 'education' | 'foot' | 'glacier' | 'grass' | 'hospital' | 'industrial' | 'label' | 'labelHalo' | 'land' | 'leisure' | 'motorway' | 'motorwaybg' | 'park' | 'parking' | 'poi' | 'prison' | 'rail' | 'residential' | 'rock' | 'sand' | 'shield' | 'street' | 'streetbg' | 'subway' | 'symbol' | 'trunk' | 'trunkbg' | 'waste' | 'water' | 'wetland' | 'wood';
19
- /** Defines the keys for font properties in a style builder. */
20
- export type StyleBuilderFontKeys = 'regular' | 'bold';
21
52
  /** Records string values for color properties in a style builder. */
22
- export type StyleBuilderColorStrings = {
23
- [key in StyleBuilderColorKeys]: string;
24
- };
25
- /** Records Color objects for color properties in a style builder. */
26
- export type StyleBuilderColors = {
27
- [key in StyleBuilderColorKeys]: Color;
28
- };
53
+ export interface StyleBuilderColors {
54
+ agriculture: Color | string;
55
+ boundary: Color | string;
56
+ building: Color | string;
57
+ buildingbg: Color | string;
58
+ burial: Color | string;
59
+ commercial: Color | string;
60
+ construction: Color | string;
61
+ cycle: Color | string;
62
+ danger: Color | string;
63
+ disputed: Color | string;
64
+ education: Color | string;
65
+ foot: Color | string;
66
+ glacier: Color | string;
67
+ grass: Color | string;
68
+ hospital: Color | string;
69
+ industrial: Color | string;
70
+ label: Color | string;
71
+ labelHalo: Color | string;
72
+ land: Color | string;
73
+ leisure: Color | string;
74
+ motorway: Color | string;
75
+ motorwaybg: Color | string;
76
+ park: Color | string;
77
+ parking: Color | string;
78
+ poi: Color | string;
79
+ prison: Color | string;
80
+ rail: Color | string;
81
+ residential: Color | string;
82
+ rock: Color | string;
83
+ sand: Color | string;
84
+ shield: Color | string;
85
+ street: Color | string;
86
+ streetbg: Color | string;
87
+ subway: Color | string;
88
+ symbol: Color | string;
89
+ trunk: Color | string;
90
+ trunkbg: Color | string;
91
+ waste: Color | string;
92
+ water: Color | string;
93
+ wetland: Color | string;
94
+ wood: Color | string;
95
+ }
96
+ export type StyleBuilderColorsEnsured = Record<keyof StyleBuilderColors, Color>;
29
97
  /** Records string values for font properties in a style builder. */
30
98
  export type StyleBuilderFonts = {
31
- [key in StyleBuilderFontKeys]: string;
99
+ regular: string;
100
+ bold: string;
32
101
  };
33
102
  /** Defines options for style rules in a style builder. */
34
103
  export interface StyleRulesOptions {
35
- colors: StyleBuilderColors;
104
+ /**
105
+ * The set of colors used in the style builder.
106
+ */
107
+ colors: StyleBuilderColorsEnsured;
108
+ /**
109
+ * The set of fonts used in the style builder.
110
+ */
36
111
  fonts: StyleBuilderFonts;
112
+ /**
113
+ * The language used for map labels.
114
+ */
37
115
  language: Language;
38
116
  }
39
117
  /** Defines the value type for a style rule. */
@@ -1,2 +1,3 @@
1
+ ;
1
2
  export {};
2
3
  //# sourceMappingURL=types.js.map
@@ -1,94 +1,11 @@
1
- import { StyleBuilder } from '../style_builder/style_builder';
2
- import type { StyleRules, StyleRulesOptions } from '../style_builder/types';
1
+ import { StyleBuilder } from '../style_builder/style_builder.js';
2
+ import type { StyleBuilderColors, StyleRules, StyleRulesOptions } from '../style_builder/types.js';
3
3
  export default class Colorful extends StyleBuilder {
4
4
  readonly name: string;
5
5
  defaultFonts: {
6
6
  regular: string;
7
7
  bold: string;
8
8
  };
9
- defaultColors: {
10
- /** Color for land areas on the map. */
11
- land: string;
12
- /** Color for water bodies like lakes and rivers. */
13
- water: string;
14
- /** Color for glacier areas, usually shown as white. */
15
- glacier: string;
16
- /** Color for wooded or forested areas. */
17
- wood: string;
18
- /** Color for grasslands or open fields. */
19
- grass: string;
20
- /** Color for parks and recreational areas. */
21
- park: string;
22
- /** Color for streets and roads on the map. */
23
- street: string;
24
- /** Background color for streets. */
25
- streetbg: string;
26
- /** Color for major highways or motorways. */
27
- motorway: string;
28
- /** Background color for motorways. */
29
- motorwaybg: string;
30
- /** Color for trunk roads. */
31
- trunk: string;
32
- /** Background color for trunk roads. */
33
- trunkbg: string;
34
- /** Background color for buildings. */
35
- buildingbg: string;
36
- /** Primary color for buildings. */
37
- building: string;
38
- /** Color used for boundaries. */
39
- boundary: string;
40
- /** Color used for disputed boundaries. */
41
- disputed: string;
42
- /** Color used for residential areas. */
43
- residential: string;
44
- /** Color used for commercial areas. */
45
- commercial: string;
46
- /** Color used for industrial areas. */
47
- industrial: string;
48
- /** Color used for footpaths and pedestrian areas. */
49
- foot: string;
50
- /** Primary color used for labels. */
51
- label: string;
52
- /** Color used for label halos. */
53
- labelHalo: string;
54
- /** Color used for shields on maps. */
55
- shield: string;
56
- /** Color used for agriculture areas. */
57
- agriculture: string;
58
- /** Color used for railways. */
59
- rail: string;
60
- /** Color used for subways and underground systems. */
61
- subway: string;
62
- /** Color used for cycle paths. */
63
- cycle: string;
64
- /** Color used for waste areas. */
65
- waste: string;
66
- /** Color used for burial and cemetery areas. */
67
- burial: string;
68
- /** Color used for sand areas like beaches. */
69
- sand: string;
70
- /** Color used for rocky terrain. */
71
- rock: string;
72
- /** Color used for leisure areas like parks and gardens. */
73
- leisure: string;
74
- /** Color used for wetland areas like marshes. */
75
- wetland: string;
76
- /** Color used for various symbols on the map. */
77
- symbol: string;
78
- /** Color indicating danger or warning areas. */
79
- danger: string;
80
- /** Color used for prison areas. */
81
- prison: string;
82
- /** Color used for parking areas. */
83
- parking: string;
84
- /** Color used for construction sites. */
85
- construction: string;
86
- /** Color used for educational facilities. */
87
- education: string;
88
- /** Color used for hospitals and medical facilities. */
89
- hospital: string;
90
- /** Color used for points of interest. */
91
- poi: string;
92
- };
9
+ defaultColors: StyleBuilderColors;
93
10
  protected getStyleRules(options: StyleRulesOptions): StyleRules;
94
11
  }
@@ -1,4 +1,4 @@
1
- import { StyleBuilder } from '../style_builder/style_builder';
1
+ import { StyleBuilder } from '../style_builder/style_builder.js';
2
2
  export default class Colorful extends StyleBuilder {
3
3
  name = 'Colorful';
4
4
  defaultFonts = {
@@ -1,4 +1,4 @@
1
- import Colorful from './colorful';
1
+ import Colorful from './colorful.js';
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';
1
+ import Colorful from './colorful.js';
2
2
  export default class Eclipse extends Colorful {
3
3
  name = 'Eclipse';
4
4
  constructor() {
@@ -1,5 +1,5 @@
1
- import type { StyleRules, StyleRulesOptions } from '../style_builder/types';
2
- import Colorful from './colorful';
1
+ import type { StyleRules, StyleRulesOptions } from '../style_builder/types.js';
2
+ import Colorful from './colorful.js';
3
3
  export default class Empty extends Colorful {
4
4
  readonly name: string;
5
5
  protected getStyleRules(_options: StyleRulesOptions): StyleRules;
@@ -1,4 +1,4 @@
1
- import Colorful from './colorful';
1
+ import Colorful from './colorful.js';
2
2
  export default class Empty extends Colorful {
3
3
  name = 'Empty';
4
4
  getStyleRules(_options) {
@@ -1,4 +1,4 @@
1
- import Colorful from './colorful';
1
+ import Colorful from './colorful.js';
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';
1
+ import Colorful from './colorful.js';
2
2
  export default class Graybeard extends Colorful {
3
3
  name = 'Graybeard';
4
4
  constructor() {
@@ -1,22 +1,11 @@
1
- import type { StyleBuilderOptions } from '../style_builder/types';
1
+ import type { StyleBuilderOptions } from '../style_builder/types.js';
2
2
  import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
3
- export declare const colorful: {
3
+ export interface StyleBuilderFunction {
4
4
  (options?: StyleBuilderOptions): StyleSpecification;
5
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;
22
- };
6
+ }
7
+ export declare const colorful: StyleBuilderFunction;
8
+ export declare const eclipse: StyleBuilderFunction;
9
+ export declare const graybeard: StyleBuilderFunction;
10
+ export declare const neutrino: StyleBuilderFunction;
11
+ export declare const empty: StyleBuilderFunction;
@@ -1,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.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';
7
7
  function getStyleBuilder(styleBuilder) {
8
8
  const fn = function (options) {
9
9
  return new styleBuilder().build(options);
@@ -1,65 +1,11 @@
1
- import { StyleRules, StyleRulesOptions } from '../style_builder/types';
2
- import Colorful from './colorful';
1
+ import { StyleBuilderColors, StyleRules, StyleRulesOptions } from '../style_builder/types.js';
2
+ import Colorful from './colorful.js';
3
3
  export default class Neutrino extends Colorful {
4
4
  readonly name: string;
5
5
  defaultFonts: {
6
6
  regular: string;
7
7
  bold: string;
8
8
  };
9
- defaultColors: {
10
- /** Color representing land areas. */
11
- land: string;
12
- /** Color representing bodies of water such as lakes and rivers. */
13
- water: string;
14
- /** Color for grassy areas and fields. */
15
- grass: string;
16
- /** Color for wooded or forested areas. */
17
- wood: string;
18
- /** Color used for agricultural land. */
19
- agriculture: string;
20
- /** Color for site areas such as parks or recreational facilities. */
21
- commercial: string;
22
- /** Primary color for buildings. */
23
- building: string;
24
- /** Color for streets and roads. */
25
- street: string;
26
- /** Color used for boundaries, such as national or state lines. */
27
- boundary: string;
28
- /** Color for footpaths and pedestrian areas. */
29
- foot: string;
30
- /** Color used for railways. */
31
- rail: string;
32
- /** Primary color used for text labels. */
33
- label: string;
34
- buildingbg: string;
35
- burial: string;
36
- construction: string;
37
- cycle: string;
38
- danger: string;
39
- disputed: string;
40
- education: string;
41
- glacier: string;
42
- hospital: string;
43
- industrial: string;
44
- labelHalo: string;
45
- leisure: string;
46
- motorway: string;
47
- motorwaybg: string;
48
- park: string;
49
- parking: string;
50
- poi: string;
51
- prison: string;
52
- residential: string;
53
- rock: string;
54
- sand: string;
55
- shield: string;
56
- streetbg: string;
57
- subway: string;
58
- symbol: string;
59
- trunk: string;
60
- trunkbg: string;
61
- waste: string;
62
- wetland: string;
63
- };
9
+ defaultColors: StyleBuilderColors;
64
10
  protected getStyleRules(options: StyleRulesOptions): StyleRules;
65
11
  }
@@ -1,4 +1,4 @@
1
- import Colorful from './colorful';
1
+ import Colorful from './colorful.js';
2
2
  export default class Neutrino extends Colorful {
3
3
  name = 'Neutrino';
4
4
  defaultFonts = {
@@ -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.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,3 +1,3 @@
1
- export { isTileJSONSpecification } from './tilejson';
2
- export { isVectorLayers } from './vector_layer';
1
+ export { isTileJSONSpecification } from './tilejson.js';
2
+ export { isVectorLayers } from './vector_layer.js';
3
3
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { VectorLayer } from './vector_layer';
1
+ import type { VectorLayer } from './vector_layer.js';
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/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@versatiles/style",
3
- "version": "5.2.3",
3
+ "version": "5.2.5",
4
4
  "description": "Generate StyleJSON for MapLibre",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "check": "npm run lint && npm run test && npm run build",
9
- "build": "rm -rf release; npm run build-browser && npm run build-node && npm run build-styles && npm run build-sprites",
9
+ "build": "rm -rf release; npm run build-browser && npm run build-node && npm run build-styles && npm run build-sprites && npm run doc",
10
10
  "build-browser": "rollup -c=rollup.config.js && $(cd release/versatiles-style; tar -cf - versatiles-style.* | gzip -9 > ../versatiles-style.tar.gz)",
11
11
  "build-node": "rm -rf dist && tsc -p tsconfig.node.json && chmod +x dist/index.js",
12
12
  "build-styles": "tsx scripts/build-styles.ts",
13
13
  "build-sprites": "tsx scripts/build-sprites.ts",
14
14
  "dev": "tsx scripts/dev.ts",
15
- "// doc": "vrt ts2md src/index.ts tsconfig.node.json | vrt insertmd README.md '# API'",
15
+ "doc": "tsx scripts/screenshots.ts && typedoc --options typedoc.json",
16
16
  "lint": "eslint --color .",
17
17
  "prepack": "npm run build",
18
18
  "release": "npx vrt release-npm",
@@ -36,6 +36,7 @@
36
36
  "dist/**/*.d.ts"
37
37
  ],
38
38
  "devDependencies": {
39
+ "@maplibre/maplibre-gl-native": "^6.0.0",
39
40
  "@maplibre/maplibre-gl-style-spec": "^23.1.0",
40
41
  "@rollup/plugin-commonjs": "^28.0.2",
41
42
  "@rollup/plugin-node-resolve": "^16.0.0",
@@ -45,10 +46,10 @@
45
46
  "@types/brace-expansion": "^1.1.2",
46
47
  "@types/inquirer": "^9.0.7",
47
48
  "@types/jest": "^29.5.14",
48
- "@types/node": "^22.10.7",
49
+ "@types/node": "^22.10.10",
49
50
  "@types/tar-stream": "^3.1.3",
50
- "@typescript-eslint/eslint-plugin": "^8.20.0",
51
- "@typescript-eslint/parser": "^8.20.0",
51
+ "@typescript-eslint/eslint-plugin": "^8.21.0",
52
+ "@typescript-eslint/parser": "^8.21.0",
52
53
  "@versatiles/release-tool": "^1.2.6",
53
54
  "bin-pack": "^1.0.2",
54
55
  "eslint": "^9.18.0",
@@ -57,14 +58,16 @@
57
58
  "jest-environment-jsdom": "^29.7.0",
58
59
  "jest-ts-webcompat-resolver": "^1.0.0",
59
60
  "npm-check-updates": "^17.1.14",
60
- "rollup": "^4.30.1",
61
+ "rollup": "^4.32.0",
61
62
  "rollup-plugin-dts": "^6.1.1",
62
63
  "sharp": "^0.33.5",
63
64
  "tar-stream": "^3.1.7",
64
65
  "ts-jest": "^29.2.5",
65
66
  "ts-node": "^10.9.2",
66
67
  "tsx": "^4.19.2",
68
+ "typedoc": "^0.27.6",
69
+ "typedoc-plugin-markdown": "^4.4.1",
67
70
  "typescript": "^5.7.3",
68
- "typescript-eslint": "^8.20.0"
71
+ "typescript-eslint": "^8.21.0"
69
72
  }
70
73
  }
@@ -1 +0,0 @@
1
- export type { Language } from './types';
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.js.map