@versatiles/style 4.4.1 → 5.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 VersaTiles
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.MD CHANGED
@@ -5,6 +5,9 @@
5
5
 
6
6
  # VersaTiles Style
7
7
 
8
+ > [!WARNING]
9
+ > We are currently migrating to the [VersaTiles Frontend Specification](https://github.com/versatiles-org/versatiles-documentation/blob/main/compendium/specification_frontend.md). While this is good for the long term, it does mean that there will be breaking changes in the short term. You can find the [old v4.4.1 release here](https://github.com/versatiles-org/versatiles-style/releases/tag/v4.4.1).
10
+
8
11
  Generates styles and sprites for MapLibre.
9
12
 
10
13
  ![Example: Colorful Style](docs/colorful.png)
@@ -13,6 +16,7 @@ Generates styles and sprites for MapLibre.
13
16
 
14
17
  * Colorful - colorful, full featured map
15
18
  * Graybeard - gray, full featured map
19
+ * Eclipse - dark, full featured map
16
20
  * Neutrino - light basemap
17
21
 
18
22
  # Use styles for versatiles.org
@@ -23,12 +27,14 @@ Be aware that these styles use `tiles.versatiles.org` as source for tiles, fonts
23
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
24
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
29
 
26
- # Create styles in the frontend (web browser)
30
+ # Generating styles on-the-fly
31
+
32
+ ## Generating styles in the frontend (web browser)
27
33
 
28
34
  Download latest release:
29
35
 
30
36
  ```bash
31
- wget "https://github.com/versatiles-org/versatiles-style/releases/latest/download/versatiles-style.tar.gz"
37
+ curl -Ls "https://github.com/versatiles-org/versatiles-style/releases/latest/download/versatiles-style.tar.gz" | gzip -d | tar -xf -
32
38
  ```
33
39
 
34
40
  Use it in:
@@ -38,12 +44,8 @@ Use it in:
38
44
  <script src="maplibre-gl.js"></script>
39
45
  <script src="versatiles-style.js"></script>
40
46
  <script>
41
- const style = VersaTilesStyle.styles.graybeard({
42
- tiles: ['/tiles/osm/{z}/{x}/{y}'],
43
- sprite: '/assets/styles/swr-bright/sprite',
44
- glyphs: '/assets/fonts/{fontstack}/{range}.pbf',
45
- baseUrl: 'https://example.org/',
46
- languageSuffix: '_de',
47
+ const style = VersaTilesStyle.graybeard({
48
+ language: 'de',
47
49
  colors: { label: '#222' },
48
50
  recolor: { gamma: 0.5 }
49
51
  });
@@ -55,7 +57,7 @@ Use it in:
55
57
  </script>
56
58
  ```
57
59
 
58
- # Create styles in the backend (Node.js)
60
+ ## Generating styles in the backend (Node.js)
59
61
 
60
62
  Install `@versatiles/style` via NPM:
61
63
 
@@ -66,111 +68,101 @@ npm install @versatiles/style
66
68
  Use it in Node.js:
67
69
 
68
70
  ```javascript
69
- import { styles } from '@versatiles/style';
70
- let style = styles.colorful({
71
- languageSuffix: '_en',
71
+ import { colorful } from '@versatiles/style';
72
+ let style = colorful({
73
+ language: 'en',
72
74
  });
73
75
  writeFileSync('style.json', JSON.stringify(style));
74
76
  ```
75
77
 
76
- # API
77
-
78
- <!--- This chapter is generated automatically --->
79
-
80
- ## Interfaces
81
-
82
- ### Interface: `TileJSONSpecificationRaster`<a id="interface_tilejsonspecificationraster"></a>
83
-
84
- ```typescript
85
- interface {
86
- attribution?: string;
87
- bounds?: [number, number, number, number];
88
- center?: [number, number];
89
- description?: string;
90
- fillzoom?: number;
91
- format: "avif" | "jpg" | "png" | "webp";
92
- grids?: string[];
93
- legend?: string;
94
- maxzoom?: number;
95
- minzoom?: number;
96
- name?: string;
97
- scheme?: "xyz" | "tms";
98
- template?: string;
99
- tilejson?: "3.0.0";
100
- tiles: string[];
101
- type: "raster";
102
- }
103
- ```
78
+ ### Methods for generating styles
104
79
 
105
- ### Interface: `TileJSONSpecificationVector`<a id="interface_tilejsonspecificationvector"></a>
106
-
107
- ```typescript
108
- interface {
109
- attribution?: string;
110
- bounds?: [number, number, number, number];
111
- center?: [number, number];
112
- description?: string;
113
- fillzoom?: number;
114
- format: "pbf";
115
- grids?: string[];
116
- legend?: string;
117
- maxzoom?: number;
118
- minzoom?: number;
119
- name?: string;
120
- scheme?: "xyz" | "tms";
121
- template?: string;
122
- tilejson?: "3.0.0";
123
- tiles: string[];
124
- type: "vector";
125
- vector_layers: VectorLayer[];
126
- }
127
- ```
80
+ This library provides:
81
+ - `style = colorful(options);`
82
+ - `style = eclipse(options);`
83
+ - `style = graybeard(options);`
84
+ - `style = neutrino(options);`
128
85
 
129
- ## Type Aliases
86
+ Where `options` is an optional object:
130
87
 
131
- ### Type: `TileJSONSpecification`<a id="type_tilejsonspecification"></a>
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;
132
93
 
133
- **Type:** <code>[TileJSONSpecificationRaster](#interface_tilejsonspecificationraster) | [TileJSONSpecificationVector](#interface_tilejsonspecificationvector)</code>
94
+ // The URL template for loading font glyphs, formatted with '{fontstack}' and '{range}' placeholders.
95
+ // Default: '/assets/glyphs/{fontstack}/{range}.pbf'
96
+ glyphs?: string;
134
97
 
135
- ## Functions
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 }[];
136
101
 
137
- ### Method: `colorful(options)`
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[];
138
105
 
139
- <sup><a href="https://github.com/versatiles-org/versatiles-style/blob/be6dcfe/src/index.ts#L4">\[src]</a></sup>
106
+ // If set to true, hides all map labels.
107
+ // Default: false
108
+ hideLabels?: boolean;
140
109
 
141
- **Parameters:**
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;
142
114
 
143
- * <code>options: StylemakerOptions<default></code> (optional)
115
+ // An object specifying overrides for default color values, keyed by the color names.
116
+ colors?: Partial<StyleBuilderColorStrings<T>>;
144
117
 
145
- **Returns:** <code>MaplibreStyle</code>
118
+ // An object specifying overrides for default font names, keyed by the font names.
119
+ fonts?: Partial<StyleBuilderFontStrings<T>>;
146
120
 
147
- ### Method: `graybeard(options)`
121
+ // Options for color adjustments and transformations applied to the entire style.
122
+ recolor?: RecolorOptions;
123
+ }
148
124
 
149
- <sup><a href="https://github.com/versatiles-org/versatiles-style/blob/be6dcfe/src/index.ts#L9">\[src]</a></sup>
125
+ export interface RecolorOptions {
126
+ // If true, inverts all colors.
127
+ invertBrightness?: boolean;
150
128
 
151
- **Parameters:**
129
+ // Rotate the hue of all colors (in degrees).
130
+ rotate?: number;
152
131
 
153
- * <code>options: StylemakerOptions<default></code> (optional)
132
+ // Adjusts the saturation level of all colors. Positive values increase saturation, negative values decrease it.
133
+ saturate?: number;
154
134
 
155
- **Returns:** <code>MaplibreStyle</code>
135
+ // Adjusts the gamma of all colors. Affects the brightness in a non-linear manner.
136
+ gamma?: number;
156
137
 
157
- ### Method: `guessStyle(opt)`
138
+ // Adjusts the contrast of all colors. Higher values produce more contrast.
139
+ contrast?: number;
158
140
 
159
- <sup><a href="https://github.com/versatiles-org/versatiles-style/blob/be6dcfe/src/lib/style_guesser.ts#L13">\[src]</a></sup>
141
+ // Adjusts the brightness of all colors. Positive values make it brighter, negative values make it darker.
142
+ brightness?: number;
160
143
 
161
- **Parameters:**
144
+ // Specifies the intensity of the tinting effect. Ranges from 0 (no effect) to 1 (full effect).
145
+ tint?: number;
162
146
 
163
- * <code>opt: TileJSONOption</code>
147
+ // Specifies the color used for tinting, in a string format (e.g., '#FF0000').
148
+ tintColor?: string;
149
+ }
150
+ ```
164
151
 
165
- **Returns:** <code>MaplibreStyle</code>
152
+ ### Method: `guessStyle(options)`
153
+
154
+ ```javascript
155
+ const style = guessStyle(options);
156
+ ```
166
157
 
167
- ### Method: `neutrino(options)`
168
158
 
169
- <sup><a href="https://github.com/versatiles-org/versatiles-style/blob/be6dcfe/src/index.ts#L14">\[src]</a></sup>
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>
170
162
 
171
163
  **Parameters:**
172
164
 
173
- * <code>options: StylemakerOptions<default></code> (optional)
165
+ * <code>opt: TileJSONOption</code>
174
166
 
175
167
  **Returns:** <code>MaplibreStyle</code>
176
168
 
@@ -186,9 +178,7 @@ Please note that for building new sprites you need `optipng`.
186
178
 
187
179
  ## Configuration
188
180
 
189
- Iconsets can be defined in [`scripts/config-sprites.ts`](./scripts/config-sprites.ts);
190
- * `colors` are applied to each path in the order they appear in the source SVG.
191
- * `size` applies to the height
181
+ Iconsets can be defined in [`scripts/config-sprites.ts`](./scripts/config-sprites.ts)
192
182
 
193
183
  # Licenses
194
184
 
package/dist/browser.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export type * from './styles/index.js';
2
- export * as styles from './styles/index.js';
2
+ export * from './styles/index.js';
3
3
  export type { GuessStyleOptions } from './guess_style/index.js';
4
4
  export { guessStyle } from './guess_style/index.js';
package/dist/browser.js CHANGED
@@ -1,2 +1,2 @@
1
- export * as styles from './styles/index.js';
1
+ export * from './styles/index.js';
2
2
  export { guessStyle } from './guess_style/index.js';
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
1
  import { isTileJSONSpecification, isVectorLayers } from '../types/index.js';
3
2
  import { resolveUrl } from '../lib/utils.js';
4
3
  import randomColorGenerator from './random_color.js';
@@ -27,11 +26,11 @@ export function guessStyle(opt) {
27
26
  }
28
27
  let k;
29
28
  for (k in tilejsonBasic) {
30
- // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
31
29
  if (tilejsonBasic[k] === undefined)
32
30
  delete tilejsonBasic[k];
33
31
  }
34
32
  let tilejson;
33
+ let vectorLayers;
35
34
  switch (format) {
36
35
  case 'avif':
37
36
  case 'jpg':
@@ -40,7 +39,7 @@ export function guessStyle(opt) {
40
39
  tilejson = { ...tilejsonBasic, type: 'raster', format };
41
40
  break;
42
41
  case 'pbf':
43
- const { vectorLayers } = opt;
42
+ vectorLayers = opt.vectorLayers;
44
43
  if (!isVectorLayers(vectorLayers))
45
44
  throw Error('property vector_layers is invalid');
46
45
  tilejson = { ...tilejsonBasic, type: 'vector', format, vector_layers: vectorLayers };
@@ -95,7 +94,9 @@ export async function guessStyleFromContainer(container, options) {
95
94
  if (('vector_layers' in t) && Array.isArray(t.vector_layers))
96
95
  vectorLayers = t.vector_layers;
97
96
  }
98
- catch (e) { }
97
+ catch (error) {
98
+ console.log(error);
99
+ }
99
100
  }
100
101
  const guessStyleOptions = {
101
102
  ...options,
@@ -120,7 +121,6 @@ function isShortbread(spec) {
120
121
  }
121
122
  function getShortbreadStyle(spec, builderOption) {
122
123
  return colorful({
123
- hideLabels: true,
124
124
  tiles: spec.tiles,
125
125
  baseUrl: builderOption.baseUrl,
126
126
  glyphs: builderOption.glyphs,
@@ -84,7 +84,6 @@ export default function randomColorGenerator(startSeed) {
84
84
  }
85
85
  if (typeof hue === 'string') {
86
86
  const color = colorDictionary[hue];
87
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
88
87
  if (color?.hueRange)
89
88
  return color.hueRange;
90
89
  }
@@ -132,7 +131,6 @@ export default function randomColorGenerator(startSeed) {
132
131
  defineColor('pink', [282, 334], [[20, 100], [30, 90], [40, 86], [60, 84], [80, 80], [90, 75], [100, 73]]);
133
132
  return dic;
134
133
  }
135
- // eslint-disable-next-line @typescript-eslint/naming-convention
136
134
  function HSVtoHSL(hsv) {
137
135
  const s = hsv[1] / 100, v = hsv[2] / 100, k = (2 - s) * v;
138
136
  return [hsv[0], 100 * s * v / (k < 1 ? k : 2 - k), 100 * k / 2];
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type * from './styles/index.js';
2
- export * as styles from './styles/index.js';
2
+ export * from './styles/index.js';
3
3
  export { guessStyle, guessStyleFromContainer } from './guess_style/index.js';
4
4
  export type { GuessStyleOptions, GuessContainerOptions } from './guess_style/index.js';
5
5
  export type { VectorLayer } from './types/index.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * as styles from './styles/index.js';
1
+ export * from './styles/index.js';
2
2
  export { guessStyle, guessStyleFromContainer } from './guess_style/index.js';
@@ -1,5 +1,6 @@
1
1
  export declare function deepClone<T>(obj: T): T;
2
- export declare function isSimpleObject(item: unknown): boolean;
3
- export declare function isBasicType(item: unknown): boolean;
4
- export declare function deepMerge<T extends object>(source0: T, ...sources: T[]): T;
2
+ export declare function isSimpleObject(item: unknown): item is object;
3
+ export declare function isBasicType(item: unknown): item is boolean | number | string | undefined;
4
+ export declare function deepMerge<T extends object>(source0: T, ...sources: Partial<T>[]): T;
5
5
  export declare function resolveUrl(base: string, url: string): string;
6
+ export declare function basename(url: string): string;
package/dist/lib/utils.js CHANGED
@@ -63,7 +63,7 @@ export function deepMerge(source0, ...sources) {
63
63
  if (typeof source !== 'object')
64
64
  continue;
65
65
  for (const key in source) {
66
- if (!Object.hasOwn(source, key))
66
+ if (!(key in source))
67
67
  continue;
68
68
  const sourceValue = source[key];
69
69
  // *********
@@ -87,7 +87,6 @@ export function deepMerge(source0, ...sources) {
87
87
  continue;
88
88
  }
89
89
  if (isSimpleObject(target[key]) && isSimpleObject(sourceValue)) {
90
- // @ts-expect-error: Too complicated to handle
91
90
  target[key] = deepMerge(target[key], sourceValue);
92
91
  continue;
93
92
  }
@@ -95,7 +94,6 @@ export function deepMerge(source0, ...sources) {
95
94
  // merge
96
95
  // *********
97
96
  if (isSimpleObject(target[key]) && isSimpleObject(sourceValue)) {
98
- // @ts-expect-error: Too complicated to handle
99
97
  target[key] = deepMerge(target[key], sourceValue);
100
98
  continue;
101
99
  }
@@ -107,10 +105,22 @@ export function deepMerge(source0, ...sources) {
107
105
  return target;
108
106
  }
109
107
  export function resolveUrl(base, url) {
110
- if (!Boolean(base))
108
+ if (!base)
111
109
  return url;
112
110
  url = new URL(url, base).href;
113
111
  url = url.replace(/%7B/gi, '{');
114
112
  url = url.replace(/%7D/gi, '}');
115
113
  return url;
116
114
  }
115
+ export function basename(url) {
116
+ if (!url)
117
+ return '';
118
+ try {
119
+ url = new URL(url, 'http://example.org').pathname;
120
+ }
121
+ catch (_) {
122
+ // ignore
123
+ }
124
+ url = url.replace(/\/+$/, '');
125
+ return url.split('/').pop() ?? '';
126
+ }
@@ -1,5 +1,5 @@
1
- import type { LanguageSuffix } from '../style_builder/index.js';
1
+ import type { Language } from '../style_builder/index.js';
2
2
  import type { MaplibreLayerDefinition } from '../types/index.js';
3
3
  export declare function getShortbreadLayers(option: {
4
- readonly languageSuffix: LanguageSuffix;
4
+ readonly language: Language;
5
5
  }): MaplibreLayerDefinition[];
@@ -1,7 +1,6 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
1
  export function getShortbreadLayers(option) {
3
- const { languageSuffix } = option;
4
- const nameField = languageSuffix ? '{name_' + languageSuffix + '}' : '{name}';
2
+ const { language } = option;
3
+ const nameField = language ? '{name_' + language + '}' : '{name}';
5
4
  return [
6
5
  // background
7
6
  { id: 'background', type: 'background' },
@@ -111,29 +110,40 @@ export function getShortbreadLayers(option) {
111
110
  ...['tunnel', 'street', 'bridge'].flatMap((c) => {
112
111
  let filter;
113
112
  let prefix;
113
+ let suffixes = [];
114
114
  const results = [];
115
115
  switch (c) {
116
116
  case 'tunnel':
117
117
  filter = [['==', 'tunnel', true]];
118
118
  prefix = 'tunnel-';
119
+ suffixes = [':outline', ''];
119
120
  break;
120
121
  case 'street':
121
122
  filter = [['!=', 'bridge', true], ['!=', 'tunnel', true]];
122
123
  prefix = '';
124
+ suffixes = [':outline', ''];
123
125
  break;
124
126
  case 'bridge':
125
127
  filter = [['==', 'bridge', true]];
126
128
  prefix = 'bridge-';
129
+ suffixes = [':bridge', ':outline', ''];
127
130
  break;
128
131
  }
129
- // bridges, above street, below bridge
130
- if (c === 'bridge')
132
+ // in osm data streets on bridges are often not tagged as such
133
+ // to be able to have multiple levels of bridges cross over each
134
+ // other in the right order without using a secondary property.
135
+ // this results in bridge-polygons being rendered above streets.
136
+ // therefore bridge polygons are *under* surface streets here.
137
+ // this workaround is also wrong, but everyone is using it since
138
+ // it's simpler than removing all these tagging hacks from osm.
139
+ // bridges, above tunnel, below street
140
+ if (c === 'street')
131
141
  results.push({
132
142
  id: 'bridge',
133
143
  type: 'fill',
134
144
  'source-layer': 'bridges',
135
145
  });
136
- [':outline', ''].forEach(suffix => {
146
+ suffixes.forEach(suffix => {
137
147
  // pedestrian zone — no outline
138
148
  if (suffix === ':outline')
139
149
  results.push({
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
1
  const maxzoom = 14;
3
2
  export function getShortbreadTemplate() {
4
3
  return {
@@ -8,8 +7,8 @@ export function getShortbreadTemplate() {
8
7
  'maputnik:renderer': 'mbgljs',
9
8
  license: 'https://creativecommons.org/publicdomain/zero/1.0/',
10
9
  },
11
- glyphs: 'https://tiles.versatiles.org/fonts/{fontstack}/{range}.pbf',
12
- sprite: 'https://tiles.versatiles.org/sprites/sprites',
10
+ glyphs: 'https://tiles.versatiles.org/assets/glyphs/{fontstack}/{range}.pbf',
11
+ sprite: [{ id: 'basics', url: 'https://tiles.versatiles.org/assets/sprites/basics/sprites' }],
13
12
  sources: {
14
13
  'versatiles-shortbread': {
15
14
  tilejson: '3.0.0',
@@ -87,7 +87,6 @@ export function decorate(layers, rules, recolor) {
87
87
  layer.paint[key] = value;
88
88
  break;
89
89
  default:
90
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
91
90
  throw new Error(`unknown parent "${propertyDef.parent}" for key "${key}"`);
92
91
  }
93
92
  });
@@ -1 +1 @@
1
- export type { LanguageSuffix } from './types.js';
1
+ export type { Language } from './types.js';
@@ -1,20 +1,12 @@
1
1
  import Color from 'color';
2
2
  export interface RecolorOptions {
3
- /** If true, inverts the colors. */
4
3
  invertBrightness?: boolean;
5
- /** The degree to rotate the hue of the color (in degrees). */
6
4
  rotate?: number;
7
- /** Adjusts the saturation level of the color. Positive values increase saturation, negative values decrease it. */
8
5
  saturate?: number;
9
- /** Adjusts the gamma of the color. Affects the brightness in a non-linear manner. */
10
6
  gamma?: number;
11
- /** Adjusts the contrast of the color. Higher values produce more contrast. */
12
7
  contrast?: number;
13
- /** Adjusts the brightness of the color. Positive values make it brighter, negative values make it darker. */
14
8
  brightness?: number;
15
- /** Specifies the intensity of the tinting effect. Ranges from 0 (no effect) to 1 (full effect). */
16
9
  tint?: number;
17
- /** Specifies the color used for tinting, in a string format (e.g., '#FF0000'). */
18
10
  tintColor?: string;
19
11
  }
20
12
  export declare function getDefaultRecolorFlags(): RecolorOptions;
@@ -2,19 +2,18 @@ import Color from 'color';
2
2
  import { getShortbreadTemplate, getShortbreadLayers } from '../shortbread/index.js';
3
3
  import { decorate } from './decorator.js';
4
4
  import { CachedRecolor, getDefaultRecolorFlags } from './recolor.js';
5
- import { deepClone, resolveUrl } from '../lib/utils.js';
5
+ import { basename, deepClone, resolveUrl } from '../lib/utils.js';
6
6
  // StyleBuilder class definition
7
7
  export default class StyleBuilder {
8
8
  #sourceName = 'versatiles-shortbread';
9
9
  build(options) {
10
10
  options ??= {};
11
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
12
- const baseUrl = options.baseUrl ?? globalThis?.document?.location?.href ?? 'https://tiles.versatiles.org';
13
- const glyphs = options.glyphs ?? '/assets/fonts/{fontstack}/{range}.pbf';
14
- const sprite = options.sprite ?? '/assets/sprites/sprites';
11
+ const baseUrl = options.baseUrl ?? globalThis?.document?.location?.origin ?? 'https://tiles.versatiles.org';
12
+ const glyphs = options.glyphs ?? '/assets/glyphs/{fontstack}/{range}.pbf';
13
+ const sprite = options.sprite ?? [{ id: 'basics', url: '/assets/sprites/basics/sprites' }];
15
14
  const tiles = options.tiles ?? ['/tiles/osm/{z}/{x}/{y}'];
16
15
  const hideLabels = options.hideLabels ?? false;
17
- const { languageSuffix } = options;
16
+ const language = options.language ?? null;
18
17
  const recolorOptions = options.recolor ?? getDefaultRecolorFlags();
19
18
  const colors = this.getColors(this.defaultColors);
20
19
  if (options.colors) {
@@ -34,12 +33,12 @@ export default class StyleBuilder {
34
33
  const styleRuleOptions = {
35
34
  colors,
36
35
  fonts,
37
- languageSuffix,
36
+ language,
38
37
  };
39
38
  // get layer style rules from child class
40
39
  const layerStyleRules = this.getStyleRules(styleRuleOptions);
41
40
  // get shortbread layers
42
- const layerDefinitions = getShortbreadLayers({ languageSuffix });
41
+ const layerDefinitions = getShortbreadLayers({ language });
43
42
  let layers = layerDefinitions.map(layer => {
44
43
  switch (layer.type) {
45
44
  case 'background':
@@ -62,7 +61,12 @@ export default class StyleBuilder {
62
61
  style.layers = layers;
63
62
  style.name = 'versatiles-' + this.name.toLowerCase();
64
63
  style.glyphs = resolveUrl(baseUrl, glyphs);
65
- style.sprite = resolveUrl(baseUrl, sprite);
64
+ if (typeof sprite == 'string') {
65
+ style.sprite = [{ id: basename(sprite), url: resolveUrl(baseUrl, sprite) }];
66
+ }
67
+ else {
68
+ style.sprite = sprite.map(({ id, url }) => ({ id, url: resolveUrl(baseUrl, url) }));
69
+ }
66
70
  const source = style.sources[this.#sourceName];
67
71
  if ('tiles' in source)
68
72
  source.tiles = tiles.map(url => resolveUrl(baseUrl, url));
@@ -81,7 +85,7 @@ export default class StyleBuilder {
81
85
  sprite: '',
82
86
  tiles: [],
83
87
  hideLabels: false,
84
- languageSuffix: undefined,
88
+ language: undefined,
85
89
  colors: deepClone(this.defaultColors),
86
90
  fonts: deepClone(this.defaultFonts),
87
91
  recolor: getDefaultRecolorFlags(),
@@ -2,25 +2,19 @@ import type Color from 'color';
2
2
  import type StyleBuilder from './style_builder.js';
3
3
  import type { RecolorOptions } from './recolor.js';
4
4
  /** Represents language suffixes used in map styles. */
5
- export type LanguageSuffix = 'de' | 'en' | undefined;
5
+ export type Language = 'de' | 'en' | null;
6
6
  export interface StyleBuilderOptions<T extends StyleBuilder<T>> {
7
- /** The base URL for loading external resources like tiles, sprites, and fonts. */
8
7
  baseUrl?: string;
9
- /** The URL template for loading font glyphs, formatted with `{fontstack}` and `{range}` placeholders. */
10
8
  glyphs?: string;
11
- /** The URL for loading sprite images and metadata. */
12
- sprite?: string;
13
- /** An array of URL templates for loading map tiles, with `{z}`, `{x}`, and `{y}` placeholders. */
9
+ sprite?: string | {
10
+ id: string;
11
+ url: string;
12
+ }[];
14
13
  tiles?: string[];
15
- /** If true, hides all map labels. */
16
14
  hideLabels?: boolean;
17
- /** Suffix to append to language-specific resources, such as `"-en"` for English. */
18
- languageSuffix?: LanguageSuffix;
19
- /** An object specifying overrides for default color values, keyed by the color names. */
15
+ language?: Language;
20
16
  colors?: Partial<StyleBuilderColorStrings<T>>;
21
- /** An object specifying overrides for default font names, keyed by the font names. */
22
17
  fonts?: Partial<StyleBuilderFontStrings<T>>;
23
- /** Options for color adjustments and transformations applied to the entire style. */
24
18
  recolor?: RecolorOptions;
25
19
  }
26
20
  /** Defines the keys for color properties in a style builder. */
@@ -39,7 +33,7 @@ export type StyleBuilderFonts<T extends StyleBuilder<T>> = Record<StyleBuilderFo
39
33
  export interface StyleRulesOptions<T extends StyleBuilder<T>> {
40
34
  colors: StyleBuilderColors<T>;
41
35
  fonts: StyleBuilderFontStrings<T>;
42
- languageSuffix: LanguageSuffix;
36
+ language: Language;
43
37
  }
44
38
  /** Defines the value type for a style rule. */
45
39
  export type StyleRuleValue = boolean | number | object | string;
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
1
  import StyleBuilder from '../style_builder/style_builder.js';
3
2
  export default class Colorful extends StyleBuilder {
4
3
  name = 'Colorful';
@@ -145,6 +144,9 @@ export default class Colorful extends StyleBuilder {
145
144
  color: colors.land,
146
145
  opacity: { 12: 0, 13: 1 },
147
146
  },
147
+ 'water-pier': {
148
+ color: colors.land,
149
+ },
148
150
  'water-river': {
149
151
  lineWidth: { 9: 0, 10: 3, 15: 5, 17: 9, 18: 20, 20: 60 },
150
152
  },
@@ -217,7 +219,7 @@ export default class Colorful extends StyleBuilder {
217
219
  color: colors.danger,
218
220
  fillOutlineColor: colors.danger,
219
221
  opacity: 0.3,
220
- image: 'pattern-warning',
222
+ image: 'basics:pattern-warning',
221
223
  },
222
224
  'site-hospital': {
223
225
  color: colors.hospital,
@@ -225,12 +227,12 @@ export default class Colorful extends StyleBuilder {
225
227
  },
226
228
  'site-prison': {
227
229
  color: colors.prison,
228
- image: 'pattern-striped',
230
+ image: 'basics:pattern-striped',
229
231
  opacity: 0.1,
230
232
  },
231
233
  'site-construction': {
232
234
  color: colors.construction,
233
- image: 'pattern-hatched_thin',
235
+ image: 'basics:pattern-hatched_thin',
234
236
  opacity: 0.1,
235
237
  },
236
238
  'site-{university,college,school}': {
@@ -315,6 +317,47 @@ export default class Colorful extends StyleBuilder {
315
317
  'bridge-{street,way}-*:outline': {
316
318
  lineCap: 'butt',
317
319
  },
320
+ // faux bridges
321
+ 'bridge-{street,way}-*:bridge': {
322
+ lineCap: 'butt',
323
+ lineJoin: 'round',
324
+ color: colors.land.darken(0.02),
325
+ fillAntialias: true,
326
+ opacity: 0.5,
327
+ },
328
+ 'bridge-street-motorway:bridge': {
329
+ size: { '5': 0, '6': 3, '10': 7, '14': 7, '16': 20, '18': 53, '19': 118, '20': 235 }
330
+ },
331
+ 'bridge-street-trunk:bridge': {
332
+ size: { '7': 0, '8': 3, '10': 6, '14': 8, '16': 17, '18': 50, '19': 104, '20': 202 }
333
+ },
334
+ 'bridge-street-primary:bridge': {
335
+ size: { '8': 0, '9': 1, '10': 6, '14': 8, '16': 17, '18': 50, '19': 104, '20': 202 }
336
+ },
337
+ 'bridge-street-secondary:bridge': {
338
+ size: { '11': 3, '14': 7, '16': 11, '18': 42, '19': 95, '20': 193 },
339
+ opacity: { '11': 0, '12': 1 }
340
+ },
341
+ 'bridge-street-motorway-link:bridge': {
342
+ minzoom: 12,
343
+ size: { '12': 3, '14': 4, '16': 10, '18': 20, '20': 56 }
344
+ },
345
+ 'bridge-street-{trunk,primary,secondary}-link:bridge': {
346
+ minzoom: 13,
347
+ size: { '12': 3, '14': 4, '16': 10, '18': 20, '20': 56 }
348
+ },
349
+ 'bridge-street-{tertiary,tertiary-link,unclassified,residential,livingstreet,pedestrian}*:bridge': {
350
+ size: { '12': 3, '14': 4, '16': 8, '18': 36, '19': 90, '20': 179 },
351
+ opacity: { '12': 0, '13': 1 }
352
+ },
353
+ 'bridge-street-{service,track}:bridge': {
354
+ size: { '14': 3, '16': 6, '18': 25, '19': 67, '20': 134 },
355
+ opacity: { '14': 0, '15': 1 }
356
+ },
357
+ 'bridge-way-*:bridge': {
358
+ size: { '15': 0, '16': 7, '18': 10, '19': 17, '20': 31 },
359
+ minzoom: 15
360
+ },
318
361
  // special color: motorway
319
362
  '{bridge-,}street-motorway{-link,}:outline': {
320
363
  color: colors.motorwaybg,
@@ -650,7 +693,7 @@ export default class Colorful extends StyleBuilder {
650
693
  // markings
651
694
  'marking-oneway{-reverse,}': {
652
695
  minzoom: 16,
653
- image: 'marking-arrow',
696
+ image: 'basics:marking-arrow',
654
697
  opacity: { 16: 0, 17: 0.7 },
655
698
  font: fonts.regular,
656
699
  },
@@ -672,37 +715,37 @@ export default class Colorful extends StyleBuilder {
672
715
  },
673
716
  'symbol-transit-airport': {
674
717
  minzoom: 12,
675
- image: 'icon-airport',
718
+ image: 'basics:icon-airport',
676
719
  iconSize: { 12: 0.5, 14: 1 },
677
720
  },
678
721
  'symbol-transit-airfield': {
679
722
  minzoom: 13,
680
- image: 'icon-airfield',
723
+ image: 'basics:icon-airfield',
681
724
  iconSize: { 13: 0.5, 15: 1 },
682
725
  },
683
726
  'symbol-transit-station': {
684
727
  minzoom: 13,
685
- image: 'icon-rail',
728
+ image: 'basics:icon-rail',
686
729
  iconSize: { 13: 0.5, 15: 1 },
687
730
  },
688
731
  'symbol-transit-lightrail': {
689
732
  minzoom: 14,
690
- image: 'icon-rail_light',
733
+ image: 'basics:icon-rail_light',
691
734
  iconSize: { 14: 0.5, 16: 1 },
692
735
  },
693
736
  'symbol-transit-subway': {
694
737
  minzoom: 14,
695
- image: 'icon-rail_metro',
738
+ image: 'basics:icon-rail_metro',
696
739
  iconSize: { 14: 0.5, 16: 1 },
697
740
  },
698
741
  'symbol-transit-tram': {
699
742
  minzoom: 15,
700
- image: 'transport-tram',
743
+ image: 'basics:transport-tram',
701
744
  iconSize: { 15: 0.5, 17: 1 },
702
745
  },
703
746
  'symbol-transit-bus': {
704
747
  minzoom: 16,
705
- image: 'icon-bus',
748
+ image: 'basics:icon-bus',
706
749
  iconSize: { 16: 0.5, 18: 1 },
707
750
  },
708
751
  // TODO: localized symbols? depends on shortbread
@@ -719,191 +762,191 @@ export default class Colorful extends StyleBuilder {
719
762
  'poi-amenity': {
720
763
  image: ['match',
721
764
  ['get', 'amenity'],
722
- 'arts_centre', 'icon-art_gallery',
723
- 'atm', 'icon-atm',
724
- 'bank', 'icon-bank',
725
- 'bar', 'icon-bar',
726
- 'bench', 'icon-bench',
727
- 'bicycle_rental', 'icon-bicycle_share',
728
- 'biergarten', 'icon-beergarden',
729
- 'cafe', 'icon-cafe',
730
- 'car_rental', 'icon-car_rental',
731
- 'car_sharing', 'icon-car_rental',
732
- 'car_wash', 'icon-car_wash',
733
- 'cinema', 'icon-cinema',
734
- //'clinic', 'icon-clinic',
735
- 'college', 'icon-college',
736
- 'community_centre', 'icon-community',
737
- //'courthouse', 'icon-courthouse',
738
- 'dentist', 'icon-dentist',
739
- 'doctors', 'icon-doctor',
740
- 'dog_park', 'icon-dog_park',
741
- 'drinking_water', 'icon-drinking_water',
742
- 'embassy', 'icon-embassy',
743
- 'fast_food', 'icon-fast_food',
744
- 'fire_station', 'icon-fire_station',
745
- //'food_court', 'icon-food_court',
746
- 'fountain', 'icon-fountain',
747
- 'grave_yard', 'icon-cemetery',
748
- 'hospital', 'icon-hospital',
749
- 'hunting_stand', 'icon-huntingstand',
750
- 'library', 'icon-library',
751
- 'marketplace', 'icon-marketplace',
752
- 'nightclub', 'icon-nightclub',
753
- 'nursing_home', 'icon-nursinghome',
754
- 'pharmacy', 'icon-pharmacy',
755
- 'place_of_worship', 'icon-place_of_worship',
756
- 'playground', 'icon-playground',
757
- 'police', 'icon-police',
758
- 'post_box', 'icon-postbox',
759
- 'post_office', 'icon-post',
760
- 'prison', 'icon-prison',
761
- 'pub', 'icon-beer',
762
- //'public_building', 'icon-public_building',
763
- 'recycling', 'icon-recycling',
764
- 'restaurant', 'icon-restaurant',
765
- 'school', 'icon-school',
766
- 'shelter', 'icon-shelter',
767
- 'telephone', 'icon-telephone',
768
- 'theatre', 'icon-theatre',
769
- 'toilets', 'icon-toilet',
770
- 'townhall', 'icon-town_hall',
771
- //'university', 'icon-university',
772
- 'vending_machine', 'icon-vendingmachine',
773
- 'veterinary', 'icon-veterinary',
774
- 'waste_basket', 'icon-waste_basket',
775
- 'unknown',
765
+ 'arts_centre', 'basics:icon-art_gallery',
766
+ 'atm', 'basics:icon-atm',
767
+ 'bank', 'basics:icon-bank',
768
+ 'bar', 'basics:icon-bar',
769
+ 'bench', 'basics:icon-bench',
770
+ 'bicycle_rental', 'basics:icon-bicycle_share',
771
+ 'biergarten', 'basics:icon-beergarden',
772
+ 'cafe', 'basics:icon-cafe',
773
+ 'car_rental', 'basics:icon-car_rental',
774
+ 'car_sharing', 'basics:icon-car_rental',
775
+ 'car_wash', 'basics:icon-car_wash',
776
+ 'cinema', 'basics:icon-cinema',
777
+ //'clinic', 'basics:icon-clinic',
778
+ 'college', 'basics:icon-college',
779
+ 'community_centre', 'basics:icon-community',
780
+ //'courthouse', 'basics:icon-courthouse',
781
+ 'dentist', 'basics:icon-dentist',
782
+ 'doctors', 'basics:icon-doctor',
783
+ 'dog_park', 'basics:icon-dog_park',
784
+ 'drinking_water', 'basics:icon-drinking_water',
785
+ 'embassy', 'basics:icon-embassy',
786
+ 'fast_food', 'basics:icon-fast_food',
787
+ 'fire_station', 'basics:icon-fire_station',
788
+ //'food_court', 'basics:icon-food_court',
789
+ 'fountain', 'basics:icon-fountain',
790
+ 'grave_yard', 'basics:icon-cemetery',
791
+ 'hospital', 'basics:icon-hospital',
792
+ 'hunting_stand', 'basics:icon-huntingstand',
793
+ 'library', 'basics:icon-library',
794
+ 'marketplace', 'basics:icon-marketplace',
795
+ 'nightclub', 'basics:icon-nightclub',
796
+ 'nursing_home', 'basics:icon-nursinghome',
797
+ 'pharmacy', 'basics:icon-pharmacy',
798
+ 'place_of_worship', 'basics:icon-place_of_worship',
799
+ 'playground', 'basics:icon-playground',
800
+ 'police', 'basics:icon-police',
801
+ 'post_box', 'basics:icon-postbox',
802
+ 'post_office', 'basics:icon-post',
803
+ 'prison', 'basics:icon-prison',
804
+ 'pub', 'basics:icon-beer',
805
+ //'public_building', 'basics:icon-public_building',
806
+ 'recycling', 'basics:icon-recycling',
807
+ 'restaurant', 'basics:icon-restaurant',
808
+ 'school', 'basics:icon-school',
809
+ 'shelter', 'basics:icon-shelter',
810
+ 'telephone', 'basics:icon-telephone',
811
+ 'theatre', 'basics:icon-theatre',
812
+ 'toilets', 'basics:icon-toilet',
813
+ 'townhall', 'basics:icon-town_hall',
814
+ //'university', 'basics:icon-university',
815
+ 'vending_machine', 'basics:icon-vendingmachine',
816
+ 'veterinary', 'basics:icon-veterinary',
817
+ 'waste_basket', 'basics:icon-waste_basket',
818
+ '',
776
819
  ],
777
820
  },
778
821
  'poi-leisure': {
779
822
  image: ['match',
780
823
  ['get', 'leisure'],
781
- 'golf_course', 'icon-golf',
782
- 'ice_rink', 'icon-icerink',
783
- 'pitch', 'icon-pitch',
784
- //'sports_centre', 'icon-sports_centre',
785
- 'stadium', 'icon-stadium',
786
- 'swimming_pool', 'icon-swimming',
787
- 'water_park', 'icon-waterpark',
788
- 'icon-sports',
824
+ 'golf_course', 'basics:icon-golf',
825
+ 'ice_rink', 'basics:icon-icerink',
826
+ 'pitch', 'basics:icon-pitch',
827
+ //'sports_centre', 'basics:icon-sports_centre',
828
+ 'stadium', 'basics:icon-stadium',
829
+ 'swimming_pool', 'basics:icon-swimming',
830
+ 'water_park', 'basics:icon-waterpark',
831
+ 'basics:icon-sports',
789
832
  ],
790
833
  },
791
834
  'poi-tourism': {
792
835
  image: ['match',
793
836
  ['get', 'tourism'],
794
- //'alpine_hut', 'icon-alpine_hut',
795
- //'bed_and_breakfast', 'icon-bed_and_breakfast',
796
- //'camp_site', 'icon-camp_site',
797
- //'caravan_site', 'icon-caravan_site',
798
- 'chalet', 'icon-chalet',
799
- //'guest_house', 'icon-guest_house',
800
- //'hostel', 'icon-hostel',
801
- //'hotel', 'icon-hotel',
802
- 'information', 'transport-information',
803
- //'motel', 'icon-motel',
804
- 'picnic_site', 'icon-picnic_site',
805
- //'theme_park', 'icon-theme_park',
806
- 'viewpoint', 'icon-viewpoint',
807
- 'zoo', 'icon-zoo',
808
- 'unknown',
837
+ //'alpine_hut', 'basics:icon-alpine_hut',
838
+ //'bed_and_breakfast', 'basics:icon-bed_and_breakfast',
839
+ //'camp_site', 'basics:icon-camp_site',
840
+ //'caravan_site', 'basics:icon-caravan_site',
841
+ 'chalet', 'basics:icon-chalet',
842
+ //'guest_house', 'basics:icon-guest_house',
843
+ //'hostel', 'basics:icon-hostel',
844
+ //'hotel', 'basics:icon-hotel',
845
+ 'information', 'basics:transport-information',
846
+ //'motel', 'basics:icon-motel',
847
+ 'picnic_site', 'basics:icon-picnic_site',
848
+ //'theme_park', 'basics:icon-theme_park',
849
+ 'viewpoint', 'basics:icon-viewpoint',
850
+ 'zoo', 'basics:icon-zoo',
851
+ '',
809
852
  ],
810
853
  },
811
854
  'poi-shop': {
812
855
  image: ['match',
813
856
  ['get', 'shop'],
814
- 'alcohol', 'icon-alcohol_shop',
815
- 'bakery', 'icon-bakery',
816
- 'beauty', 'icon-beauty',
817
- 'beverages', 'icon-beverages',
818
- //'bicycle', 'icon-bicycle',
819
- 'books', 'icon-books',
820
- 'butcher', 'icon-butcher',
821
- //'car', 'icon-car',
822
- 'chemist', 'icon-chemist',
823
- 'clothes', 'icon-clothes',
824
- //'computer', 'icon-computer',
825
- //'convinience', 'icon-convinience',
826
- //'department_store', 'icon-department_store',
827
- 'doityourself', 'icon-doityourself',
828
- 'dry_cleaning', 'icon-drycleaning',
829
- 'florist', 'icon-florist',
830
- 'furniture', 'icon-furniture',
831
- 'garden_centre', 'icon-garden_centre',
832
- 'general', 'icon-shop',
833
- 'gift', 'icon-gift',
834
- 'greengrocer', 'icon-greengrocer',
835
- 'hairdresser', 'icon-hairdresser',
836
- 'hardware', 'icon-hardware',
837
- 'jewelry', 'icon-jewelry_store',
838
- 'kiosk', 'icon-kiosk',
839
- 'laundry', 'icon-laundry',
840
- //'mall', 'icon-mall',
841
- //'mobile_phone', 'icon-mobile_phone',
842
- 'newsagent', 'icon-newsagent',
843
- 'optican', 'icon-optician',
844
- 'outdoor', 'icon-outdoor',
845
- 'shoes', 'icon-shoes',
846
- 'sports', 'icon-sports',
847
- 'stationery', 'icon-stationery',
848
- //'supermarket', 'icon-supermarket',
849
- 'toys', 'icon-toys',
850
- 'travel_agency', 'icon-travel_agent',
851
- 'video', 'icon-video',
852
- 'icon-shop',
857
+ 'alcohol', 'basics:icon-alcohol_shop',
858
+ 'bakery', 'basics:icon-bakery',
859
+ 'beauty', 'basics:icon-beauty',
860
+ 'beverages', 'basics:icon-beverages',
861
+ //'bicycle', 'basics:icon-bicycle',
862
+ 'books', 'basics:icon-books',
863
+ 'butcher', 'basics:icon-butcher',
864
+ //'car', 'basics:icon-car',
865
+ 'chemist', 'basics:icon-chemist',
866
+ 'clothes', 'basics:icon-clothes',
867
+ //'computer', 'basics:icon-computer',
868
+ //'convinience', 'basics:icon-convinience',
869
+ //'department_store', 'basics:icon-department_store',
870
+ 'doityourself', 'basics:icon-doityourself',
871
+ 'dry_cleaning', 'basics:icon-drycleaning',
872
+ 'florist', 'basics:icon-florist',
873
+ 'furniture', 'basics:icon-furniture',
874
+ 'garden_centre', 'basics:icon-garden_centre',
875
+ 'general', 'basics:icon-shop',
876
+ 'gift', 'basics:icon-gift',
877
+ 'greengrocer', 'basics:icon-greengrocer',
878
+ 'hairdresser', 'basics:icon-hairdresser',
879
+ 'hardware', 'basics:icon-hardware',
880
+ 'jewelry', 'basics:icon-jewelry_store',
881
+ 'kiosk', 'basics:icon-kiosk',
882
+ 'laundry', 'basics:icon-laundry',
883
+ //'mall', 'basics:icon-mall',
884
+ //'mobile_phone', 'basics:icon-mobile_phone',
885
+ 'newsagent', 'basics:icon-newsagent',
886
+ 'optican', 'basics:icon-optician',
887
+ 'outdoor', 'basics:icon-outdoor',
888
+ 'shoes', 'basics:icon-shoes',
889
+ 'sports', 'basics:icon-sports',
890
+ 'stationery', 'basics:icon-stationery',
891
+ //'supermarket', 'basics:icon-supermarket',
892
+ 'toys', 'basics:icon-toys',
893
+ 'travel_agency', 'basics:icon-travel_agent',
894
+ 'video', 'basics:icon-video',
895
+ 'basics:icon-shop',
853
896
  ],
854
897
  },
855
898
  'poi-man_made': {
856
899
  image: ['match',
857
900
  ['get', 'man_made'],
858
- 'lighthouse', 'icon-lighthouse',
859
- 'surveillance', 'icon-surveillance',
860
- 'tower', 'icon-observation_tower',
861
- //'wastewater_plant', 'icon-wastewater_plant',
862
- //'water_well', 'icon-water_well',
863
- //'water_works', 'icon-water_works',
864
- 'watermill', 'icon-watermill',
865
- 'windmill', 'icon-windmill',
866
- 'unknown',
901
+ 'lighthouse', 'basics:icon-lighthouse',
902
+ 'surveillance', 'basics:icon-surveillance',
903
+ 'tower', 'basics:icon-observation_tower',
904
+ //'wastewater_plant', 'basics:icon-wastewater_plant',
905
+ //'water_well', 'basics:icon-water_well',
906
+ //'water_works', 'basics:icon-water_works',
907
+ 'watermill', 'basics:icon-watermill',
908
+ 'windmill', 'basics:icon-windmill',
909
+ '',
867
910
  ],
868
911
  },
869
912
  'poi-historic': {
870
913
  image: ['match',
871
914
  ['get', 'historic'],
872
- //'archaelogical_site', 'icon-archaelogical_site',
873
- 'artwork', 'icon-artwork',
874
- //'battlefield', 'icon-battlefield',
875
- 'castle', 'icon-castle',
876
- //'fort', 'icon-fort',
877
- //'memorial', 'icon-memorial',
878
- 'monument', 'icon-monument',
879
- //'ruins', 'icon-ruins',
880
- //'wayside_cross', 'icon-wayside_cross',
881
- 'wayside_shrine', 'icon-shrine',
882
- 'icon-historic',
915
+ //'archaelogical_site', 'basics:icon-archaelogical_site',
916
+ 'artwork', 'basics:icon-artwork',
917
+ //'battlefield', 'basics:icon-battlefield',
918
+ 'castle', 'basics:icon-castle',
919
+ //'fort', 'basics:icon-fort',
920
+ //'memorial', 'basics:icon-memorial',
921
+ 'monument', 'basics:icon-monument',
922
+ //'ruins', 'basics:icon-ruins',
923
+ //'wayside_cross', 'basics:icon-wayside_cross',
924
+ 'wayside_shrine', 'basics:icon-shrine',
925
+ 'basics:icon-historic',
883
926
  ],
884
927
  },
885
928
  'poi-emergency': {
886
929
  image: ['match',
887
930
  ['get', 'emergency'],
888
- 'defibrillator', 'icon-defibrillator',
889
- 'fire_hydrant', 'icon-hydrant',
890
- 'phone', 'icon-emergency_phone',
891
- 'unknown',
931
+ 'defibrillator', 'basics:icon-defibrillator',
932
+ 'fire_hydrant', 'basics:icon-hydrant',
933
+ 'phone', 'basics:icon-emergency_phone',
934
+ '',
892
935
  ],
893
936
  },
894
937
  /*
895
938
  'poi-highway': {
896
939
  image: ['match',
897
940
  ['get', 'highway'],
898
- //'emergency_access_point', 'icon-emergency_access_point',
899
- 'unknown'
941
+ //'emergency_access_point', 'basics:icon-emergency_access_point',
942
+ ''
900
943
  ]
901
944
  },
902
945
  'poi-office': {
903
946
  image: ['match',
904
947
  ['get', 'office'],
905
- //'diplomatic', 'icon-diplomatic',
906
- 'unknown'
948
+ //'diplomatic', 'basics:icon-diplomatic',
949
+ ''
907
950
  ]
908
951
  },
909
952
  */
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
1
  import StyleBuilder from '../style_builder/style_builder.js';
3
2
  export default class Neutrino extends StyleBuilder {
4
3
  name = 'Neutrino';
@@ -77,6 +76,9 @@ export default class Neutrino extends StyleBuilder {
77
76
  color: colors.land,
78
77
  opacity: { 12: 0, 13: 1 },
79
78
  },
79
+ 'water-pier': {
80
+ color: colors.land,
81
+ },
80
82
  'land-*': {
81
83
  color: colors.land,
82
84
  },
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@versatiles/style",
3
- "version": "4.4.1",
3
+ "version": "5.1.0",
4
4
  "description": "Generate StyleJSON for MapLibre",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
- "check": "npm run lint && npm run build && npm run test",
8
+ "check": "npm run lint && npm run test && npm run build",
9
9
  "build": "rm -rf release; npm run build-browser && npm run build-node && npm run build-styles && npm run build-sprites",
10
- "build-browser": "rollup -c=rollup.config.js; $(cd release/versatiles-style; tar -cf - versatiles-style.* | gzip -9 > ../versatiles-style.tar.gz); rm -rf release/versatiles-style",
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
- "// dev": "????",
14
+ "dev": "tsx scripts/dev.ts",
15
15
  "// doc": "vrt ts2md src/index.ts tsconfig.node.json | vrt insertmd README.md '# API'",
16
16
  "lint": "eslint --color .",
17
17
  "prepack": "npm run build",
@@ -29,7 +29,7 @@
29
29
  "license": "MIT",
30
30
  "type": "module",
31
31
  "dependencies": {
32
- "@types/color": "^3.0.6",
32
+ "@types/color": "^4.2.0",
33
33
  "brace-expansion": "^4.0.0",
34
34
  "color": "^4.2.3"
35
35
  },
@@ -38,35 +38,36 @@
38
38
  "dist/**/*.d.ts"
39
39
  ],
40
40
  "devDependencies": {
41
- "@maplibre/maplibre-gl-style-spec": "^20.3.0",
42
- "@rollup/plugin-commonjs": "^26.0.1",
43
- "@rollup/plugin-node-resolve": "^15.2.3",
41
+ "@maplibre/maplibre-gl-style-spec": "^23.0.0",
42
+ "@rollup/plugin-commonjs": "^28.0.2",
43
+ "@rollup/plugin-node-resolve": "^16.0.0",
44
44
  "@rollup/plugin-terser": "^0.4.4",
45
- "@rollup/plugin-typescript": "^11.1.6",
45
+ "@rollup/plugin-typescript": "^12.1.2",
46
46
  "@types/bin-pack": "^1.0.3",
47
47
  "@types/brace-expansion": "^1.1.2",
48
48
  "@types/inquirer": "^9.0.7",
49
- "@types/jest": "^29.5.12",
50
- "@types/node": "^20.14.2",
49
+ "@types/jest": "^29.5.14",
50
+ "@types/node": "^22.10.6",
51
51
  "@types/tar-stream": "^3.1.3",
52
- "@typescript-eslint/eslint-plugin": "^7.12.0",
53
- "@typescript-eslint/parser": "^7.12.0",
54
- "@versatiles/container": "^1.2.1",
55
- "@versatiles/release-tool": "^1.2.3",
52
+ "@typescript-eslint/eslint-plugin": "^8.20.0",
53
+ "@typescript-eslint/parser": "^8.20.0",
54
+ "@versatiles/container": "^1.2.3",
55
+ "@versatiles/release-tool": "^1.2.6",
56
56
  "bin-pack": "^1.0.2",
57
- "eslint": "^8.56.0",
58
- "inquirer": "^9.2.23",
57
+ "eslint": "^9.18.0",
58
+ "inquirer": "^12.3.2",
59
59
  "jest": "^29.7.0",
60
60
  "jest-environment-jsdom": "^29.7.0",
61
61
  "jest-ts-webcompat-resolver": "^1.0.0",
62
- "npm-check-updates": "^16.14.20",
63
- "rollup": "^4.18.0",
62
+ "npm-check-updates": "^17.1.13",
63
+ "rollup": "^4.30.1",
64
64
  "rollup-plugin-dts": "^6.1.1",
65
- "sharp": "^0.33.4",
65
+ "sharp": "^0.33.5",
66
66
  "tar-stream": "^3.1.7",
67
- "ts-jest": "^29.1.4",
67
+ "ts-jest": "^29.2.5",
68
68
  "ts-node": "^10.9.2",
69
- "tsx": "^4.12.0",
70
- "typescript": "^5.4.5"
69
+ "tsx": "^4.19.2",
70
+ "typescript": "^5.7.3",
71
+ "typescript-eslint": "^8.20.0"
71
72
  }
72
73
  }