@versatiles/style 5.2.2 → 5.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.MD +13 -89
  2. package/dist/color/abstract.d.ts +6 -5
  3. package/dist/color/abstract.js +4 -0
  4. package/dist/color/hsl.d.ts +8 -8
  5. package/dist/color/hsl.js +17 -22
  6. package/dist/color/hsv.d.ts +8 -7
  7. package/dist/color/hsv.js +10 -11
  8. package/dist/color/index.d.ts +5 -5
  9. package/dist/color/index.js +16 -13
  10. package/dist/color/random.d.ts +1 -1
  11. package/dist/color/random.js +3 -2
  12. package/dist/color/rgb.d.ts +8 -8
  13. package/dist/color/rgb.js +25 -50
  14. package/dist/color/utils.js +1 -0
  15. package/dist/guess_style/guess_style.d.ts +1 -1
  16. package/dist/guess_style/guess_style.js +6 -5
  17. package/dist/guess_style/index.d.ts +2 -2
  18. package/dist/guess_style/index.js +2 -1
  19. package/dist/index.d.ts +15 -11
  20. package/dist/index.js +11 -3
  21. package/dist/lib/utils.js +2 -1
  22. package/dist/shortbread/index.d.ts +2 -2
  23. package/dist/shortbread/index.js +3 -2
  24. package/dist/shortbread/layers.d.ts +2 -2
  25. package/dist/shortbread/layers.js +1 -0
  26. package/dist/shortbread/properties.js +1 -0
  27. package/dist/shortbread/template.js +1 -0
  28. package/dist/style_builder/decorator.d.ts +3 -3
  29. package/dist/style_builder/decorator.js +4 -3
  30. package/dist/style_builder/recolor.d.ts +1 -1
  31. package/dist/style_builder/recolor.js +2 -1
  32. package/dist/style_builder/style_builder.d.ts +11 -11
  33. package/dist/style_builder/style_builder.js +14 -11
  34. package/dist/style_builder/types.d.ts +100 -19
  35. package/dist/style_builder/types.js +2 -0
  36. package/dist/styles/colorful.d.ts +5 -88
  37. package/dist/styles/colorful.js +2 -1
  38. package/dist/styles/eclipse.d.ts +1 -1
  39. package/dist/styles/eclipse.js +2 -1
  40. package/dist/styles/empty.d.ts +4 -9
  41. package/dist/styles/empty.js +4 -9
  42. package/dist/styles/graybeard.d.ts +1 -1
  43. package/dist/styles/graybeard.js +2 -1
  44. package/dist/styles/index.d.ts +10 -27
  45. package/dist/styles/index.js +6 -5
  46. package/dist/styles/neutrino.d.ts +5 -30
  47. package/dist/styles/neutrino.js +35 -4
  48. package/dist/types/index.d.ts +5 -5
  49. package/dist/types/index.js +3 -2
  50. package/dist/types/maplibre.js +1 -0
  51. package/dist/types/tilejson.d.ts +1 -1
  52. package/dist/types/tilejson.js +1 -0
  53. package/dist/types/vector_layer.js +1 -0
  54. package/package.json +11 -8
  55. package/dist/style_builder/index.d.ts +0 -1
  56. package/dist/style_builder/index.js +0 -1
package/dist/index.js CHANGED
@@ -1,3 +1,11 @@
1
- export * as styles from './styles/index.js';
2
- export { guessStyle } from './guess_style/index.js';
3
- export { Color } from './color/index.js';
1
+ export { colorful, eclipse, graybeard, neutrino } from './styles/index';
2
+ import { colorful, eclipse, graybeard, neutrino } from './styles/index';
3
+ export const styles = {
4
+ colorful,
5
+ eclipse,
6
+ graybeard,
7
+ neutrino,
8
+ };
9
+ export { guessStyle } from './guess_style/index';
10
+ export { Color } from './color/index';
11
+ //# sourceMappingURL=index.js.map
package/dist/lib/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Color } from '../color/index.js';
1
+ import { Color } from '../color/index';
2
2
  // Utility function to deep clone an object
3
3
  export function deepClone(obj) {
4
4
  const type = typeof obj;
@@ -123,3 +123,4 @@ export function basename(url) {
123
123
  url = url.replace(/\/+$/, '');
124
124
  return url.split('/').pop() ?? '';
125
125
  }
126
+ //# sourceMappingURL=utils.js.map
@@ -1,2 +1,2 @@
1
- export { getShortbreadTemplate } from './template.js';
2
- export { getShortbreadLayers } from './layers.js';
1
+ export { getShortbreadTemplate } from './template';
2
+ export { getShortbreadLayers } from './layers';
@@ -1,2 +1,3 @@
1
- export { getShortbreadTemplate } from './template.js';
2
- export { getShortbreadLayers } from './layers.js';
1
+ export { getShortbreadTemplate } from './template';
2
+ export { getShortbreadLayers } from './layers';
3
+ //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import type { Language } from '../style_builder/index.js';
2
- import type { MaplibreLayerDefinition } from '../types/index.js';
1
+ import type { MaplibreLayerDefinition } from '../types/index';
2
+ import { Language } from '../style_builder/types';
3
3
  export declare function getShortbreadLayers(option: {
4
4
  readonly language: Language;
5
5
  }): MaplibreLayerDefinition[];
@@ -518,3 +518,4 @@ export function getShortbreadLayers(option) {
518
518
  },
519
519
  ];
520
520
  }
521
+ //# sourceMappingURL=layers.js.map
@@ -122,3 +122,4 @@ propertyDefs.forEach((propertyDef) => {
122
122
  });
123
123
  });
124
124
  export default propertyLookup;
125
+ //# sourceMappingURL=properties.js.map
@@ -336,3 +336,4 @@ export function getShortbreadVectorLayers() {
336
336
  },
337
337
  ];
338
338
  }
339
+ //# sourceMappingURL=template.js.map
@@ -1,4 +1,4 @@
1
- import type { MaplibreLayer } from '../types/index.js';
2
- import type { StyleRules } from './types.js';
3
- import type { CachedRecolor } from './recolor.js';
1
+ import type { MaplibreLayer } from '../types/index';
2
+ import type { StyleRules } from './types';
3
+ import type { CachedRecolor } from './recolor';
4
4
  export declare function decorate(layers: MaplibreLayer[], rules: StyleRules, recolor: CachedRecolor): MaplibreLayer[];
@@ -1,7 +1,7 @@
1
- import { Color } from '../color/index.js';
1
+ import { Color } from '../color/index';
2
2
  import expandBraces from 'brace-expansion';
3
- import maplibreProperties from '../shortbread/properties.js';
4
- import { deepMerge } from '../lib/utils.js';
3
+ import maplibreProperties from '../shortbread/properties';
4
+ import { deepMerge } from '../lib/utils';
5
5
  export function decorate(layers, rules, recolor) {
6
6
  const layerIds = layers.map(l => l.id);
7
7
  const layerIdSet = new Set(layerIds);
@@ -124,3 +124,4 @@ export function decorate(layers, rules, recolor) {
124
124
  }
125
125
  }
126
126
  }
127
+ //# sourceMappingURL=decorator.js.map
@@ -1,4 +1,4 @@
1
- import { Color } from '../color/index.js';
1
+ import { Color } from '../color/index';
2
2
  export interface RecolorOptions {
3
3
  invertBrightness?: boolean;
4
4
  rotate?: number;
@@ -1,4 +1,4 @@
1
- import { Color } from '../color/index.js';
1
+ import { Color } from '../color/index';
2
2
  export function getDefaultRecolorFlags() {
3
3
  return {
4
4
  invertBrightness: false,
@@ -86,3 +86,4 @@ export function recolor(color, opt) {
86
86
  color = color.tint(opt.tint, Color.parse(opt.tintColor));
87
87
  return color;
88
88
  }
89
+ //# sourceMappingURL=recolor.js.map
@@ -1,15 +1,15 @@
1
- import { Color } from '../color/index.js';
2
- import type { StyleSpecification } from '../types/maplibre.js';
3
- import type { StyleBuilderColorStrings, StyleBuilderColors, StyleBuilderFontStrings, StyleBuilderOptions } from './types.js';
4
- import type { StyleRules, StyleRulesOptions } from './types.js';
5
- export declare abstract class StyleBuilder<Subclass extends StyleBuilder<Subclass>> {
1
+ import { Color } from '../color/index';
2
+ import type { StyleSpecification } from '../types/maplibre';
3
+ import type { StyleBuilderColors, StyleBuilderColorsEnsured, StyleBuilderFonts, StyleBuilderOptions } from './types';
4
+ import type { StyleRules, StyleRulesOptions } from './types';
5
+ export declare abstract class StyleBuilder {
6
6
  #private;
7
7
  abstract readonly name: string;
8
- abstract readonly defaultColors: StyleBuilderColorStrings<Subclass>;
9
- abstract readonly defaultFonts: StyleBuilderFontStrings<Subclass>;
10
- build(options?: StyleBuilderOptions<Subclass>): StyleSpecification;
11
- getColors(colors: StyleBuilderColorStrings<Subclass>): StyleBuilderColors<Subclass>;
12
- getDefaultOptions(): StyleBuilderOptions<Subclass>;
8
+ abstract readonly defaultColors: StyleBuilderColors;
9
+ abstract readonly defaultFonts: StyleBuilderFonts;
10
+ build(options?: StyleBuilderOptions): StyleSpecification;
11
+ getColors(colors: StyleBuilderColors): StyleBuilderColorsEnsured;
12
+ getDefaultOptions(): StyleBuilderOptions;
13
13
  protected transformDefaultColors(callback: (color: Color) => Color): void;
14
- protected abstract getStyleRules(options: StyleRulesOptions<Subclass>): StyleRules;
14
+ protected abstract getStyleRules(options: StyleRulesOptions): StyleRules;
15
15
  }
@@ -1,8 +1,8 @@
1
- import { Color } from '../color/index.js';
2
- import { getShortbreadTemplate, getShortbreadLayers } from '../shortbread/index.js';
3
- import { decorate } from './decorator.js';
4
- import { CachedRecolor, getDefaultRecolorFlags } from './recolor.js';
5
- import { basename, deepClone, resolveUrl } from '../lib/utils.js';
1
+ import { Color } from '../color/index';
2
+ import { getShortbreadTemplate, getShortbreadLayers } from '../shortbread/index';
3
+ import { decorate } from './decorator';
4
+ import { CachedRecolor, getDefaultRecolorFlags } from './recolor';
5
+ import { basename, deepClone, resolveUrl } from '../lib/utils';
6
6
  // StyleBuilder class definition
7
7
  export class StyleBuilder {
8
8
  #sourceName = 'versatiles-shortbread';
@@ -17,7 +17,8 @@ export class StyleBuilder {
17
17
  const recolorOptions = options.recolor ?? getDefaultRecolorFlags();
18
18
  const colors = this.getColors(this.defaultColors);
19
19
  if (options.colors) {
20
- for (const key in options.colors) {
20
+ let key;
21
+ for (key in options.colors) {
21
22
  const value = options.colors[key];
22
23
  if (value != null)
23
24
  colors[key] = Color.parse(value);
@@ -25,7 +26,8 @@ export class StyleBuilder {
25
26
  }
26
27
  const fonts = deepClone(this.defaultFonts);
27
28
  if (options.fonts) {
28
- for (const key in options.fonts) {
29
+ let key;
30
+ for (key in options.fonts) {
29
31
  const fontName = options.fonts[key];
30
32
  if (fontName != null)
31
33
  fonts[key] = fontName;
@@ -77,8 +79,7 @@ export class StyleBuilder {
77
79
  }
78
80
  getColors(colors) {
79
81
  const entriesString = Object.entries(colors);
80
- const entriesColor = entriesString.map(([key, value]) => [key, Color.parse(value)]);
81
- const result = Object.fromEntries(entriesColor);
82
+ const result = Object.fromEntries(entriesString.map(([key, value]) => [key, Color.parse(value)]));
82
83
  return result;
83
84
  }
84
85
  getDefaultOptions() {
@@ -96,8 +97,10 @@ export class StyleBuilder {
96
97
  }
97
98
  transformDefaultColors(callback) {
98
99
  const colors = this.getColors(this.defaultColors);
99
- for (const key in colors) {
100
- this.defaultColors[key] = callback(colors[key]).asHex();
100
+ let key;
101
+ for (key in colors) {
102
+ this.defaultColors[key] = callback(colors[key]);
101
103
  }
102
104
  }
103
105
  }
106
+ //# sourceMappingURL=style_builder.js.map
@@ -1,36 +1,117 @@
1
- import type { Color } from '../color/index.js';
2
- import type { StyleBuilder } from './style_builder.js';
3
- import type { RecolorOptions } from './recolor.js';
1
+ import type { Color } from '../color/index';
2
+ import type { RecolorOptions } from './recolor';
4
3
  import { SpriteSpecification } from '@maplibre/maplibre-gl-style-spec';
5
4
  /** Represents language suffixes used in map styles. */
6
5
  export type Language = 'de' | 'en' | null;
7
- export interface StyleBuilderOptions<T extends StyleBuilder<T>> {
6
+ /** Options for configuring a style builder. */
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
+ */
8
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
+ */
9
17
  glyphs?: string;
18
+ /**
19
+ * The URL for loading sprite images and metadata.
20
+ * Default: [{ id: 'basics', url: '/assets/sprites/basics/sprites' }]
21
+ */
10
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
+ */
11
27
  tiles?: string[];
28
+ /**
29
+ * If set to true, hides all map labels.
30
+ * Default: false
31
+ */
12
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
+ */
13
38
  language?: Language;
14
- colors?: Partial<StyleBuilderColorStrings<T>>;
15
- fonts?: Partial<StyleBuilderFontStrings<T>>;
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
+ */
46
+ fonts?: Partial<StyleBuilderFonts>;
47
+ /**
48
+ * Options for color adjustments and transformations applied to the entire style.
49
+ */
16
50
  recolor?: RecolorOptions;
17
51
  }
18
- /** Defines the keys for color properties in a style builder. */
19
- export type StyleBuilderColorKeys<T extends StyleBuilder<T>> = keyof T['defaultColors'];
20
- /** Defines the keys for font properties in a style builder. */
21
- export type StyleBuilderFontKeys<T extends StyleBuilder<T>> = keyof T['defaultFonts'];
22
52
  /** Records string values for color properties in a style builder. */
23
- export type StyleBuilderColorStrings<T extends StyleBuilder<T>> = Record<StyleBuilderColorKeys<T>, string>;
24
- /** Records string values for font properties in a style builder. */
25
- export type StyleBuilderFontStrings<T extends StyleBuilder<T>> = Record<StyleBuilderFontKeys<T>, string>;
26
- /** Records Color objects for color properties in a style builder. */
27
- export type StyleBuilderColors<T extends StyleBuilder<T>> = Record<StyleBuilderColorKeys<T>, Color>;
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>;
28
97
  /** Records string values for font properties in a style builder. */
29
- export type StyleBuilderFonts<T extends StyleBuilder<T>> = Record<StyleBuilderFontKeys<T>, string>;
98
+ export type StyleBuilderFonts = {
99
+ regular: string;
100
+ bold: string;
101
+ };
30
102
  /** Defines options for style rules in a style builder. */
31
- export interface StyleRulesOptions<T extends StyleBuilder<T>> {
32
- colors: StyleBuilderColors<T>;
33
- fonts: StyleBuilderFontStrings<T>;
103
+ export interface StyleRulesOptions {
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
+ */
111
+ fonts: StyleBuilderFonts;
112
+ /**
113
+ * The language used for map labels.
114
+ */
34
115
  language: Language;
35
116
  }
36
117
  /** Defines the value type for a style rule. */
@@ -1 +1,3 @@
1
+ ;
1
2
  export {};
3
+ //# sourceMappingURL=types.js.map
@@ -1,94 +1,11 @@
1
- import { StyleBuilder } from '../style_builder/style_builder.js';
2
- import type { StyleRules, StyleRulesOptions } from '../style_builder/types.js';
3
- export default class Colorful extends StyleBuilder<Colorful> {
1
+ import { StyleBuilder } from '../style_builder/style_builder';
2
+ import type { StyleBuilderColors, StyleRules, StyleRulesOptions } from '../style_builder/types';
3
+ export default class Colorful extends StyleBuilder {
4
4
  readonly name: string;
5
5
  defaultFonts: {
6
6
  regular: string;
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
- };
93
- protected getStyleRules(options: StyleRulesOptions<Colorful>): StyleRules;
9
+ defaultColors: StyleBuilderColors;
10
+ protected getStyleRules(options: StyleRulesOptions): StyleRules;
94
11
  }
@@ -1,4 +1,4 @@
1
- import { StyleBuilder } from '../style_builder/style_builder.js';
1
+ import { StyleBuilder } from '../style_builder/style_builder';
2
2
  export default class Colorful extends StyleBuilder {
3
3
  name = 'Colorful';
4
4
  defaultFonts = {
@@ -953,3 +953,4 @@ export default class Colorful extends StyleBuilder {
953
953
  };
954
954
  }
955
955
  }
956
+ //# sourceMappingURL=colorful.js.map
@@ -1,4 +1,4 @@
1
- import Colorful from './colorful.js';
1
+ import Colorful from './colorful';
2
2
  export default class Eclipse extends Colorful {
3
3
  readonly name: string;
4
4
  constructor();
@@ -1,4 +1,4 @@
1
- import Colorful from './colorful.js';
1
+ import Colorful from './colorful';
2
2
  export default class Eclipse extends Colorful {
3
3
  name = 'Eclipse';
4
4
  constructor() {
@@ -6,3 +6,4 @@ export default class Eclipse extends Colorful {
6
6
  this.transformDefaultColors(color => color.invertLuminosity());
7
7
  }
8
8
  }
9
+ //# sourceMappingURL=eclipse.js.map
@@ -1,11 +1,6 @@
1
- import { StyleBuilder } from '../style_builder/style_builder.js';
2
- import type { StyleRules, StyleRulesOptions } from '../style_builder/types.js';
3
- export default class Empty extends StyleBuilder<Empty> {
1
+ import type { StyleRules, StyleRulesOptions } from '../style_builder/types';
2
+ import Colorful from './colorful';
3
+ export default class Empty extends Colorful {
4
4
  readonly name: string;
5
- defaultFonts: {
6
- regular: string;
7
- bold: string;
8
- };
9
- defaultColors: {};
10
- protected getStyleRules(options: StyleRulesOptions<Empty>): StyleRules;
5
+ protected getStyleRules(_options: StyleRulesOptions): StyleRules;
11
6
  }
@@ -1,13 +1,8 @@
1
- import { StyleBuilder } from '../style_builder/style_builder.js';
2
- export default class Empty extends StyleBuilder {
1
+ import Colorful from './colorful';
2
+ export default class Empty extends Colorful {
3
3
  name = 'Empty';
4
- defaultFonts = {
5
- regular: 'noto_sans_regular',
6
- bold: 'noto_sans_bold',
7
- };
8
- defaultColors = {};
9
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
- getStyleRules(options) {
4
+ getStyleRules(_options) {
11
5
  return {};
12
6
  }
13
7
  }
8
+ //# sourceMappingURL=empty.js.map
@@ -1,4 +1,4 @@
1
- import Colorful from './colorful.js';
1
+ import Colorful from './colorful';
2
2
  export default class Graybeard extends Colorful {
3
3
  readonly name: string;
4
4
  constructor();
@@ -1,4 +1,4 @@
1
- import Colorful from './colorful.js';
1
+ import Colorful from './colorful';
2
2
  export default class Graybeard extends Colorful {
3
3
  name = 'Graybeard';
4
4
  constructor() {
@@ -6,3 +6,4 @@ export default class Graybeard extends Colorful {
6
6
  this.transformDefaultColors(color => color.saturate(-1));
7
7
  }
8
8
  }
9
+ //# sourceMappingURL=graybeard.js.map
@@ -1,28 +1,11 @@
1
- import type { StyleBuilder } from '../style_builder/style_builder.js';
2
- import type { StyleBuilderOptions } from '../style_builder/types.js';
1
+ import type { StyleBuilderOptions } from '../style_builder/types';
3
2
  import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
4
- import Colorful from './colorful.js';
5
- import Eclipse from './eclipse.js';
6
- import Graybeard from './graybeard.js';
7
- import Neutrino from './neutrino.js';
8
- import Empty from './empty.js';
9
- export type ColorfulOptions = StyleBuilderOptions<Colorful>;
10
- export type EclipseOptions = StyleBuilderOptions<Eclipse>;
11
- export type GraybeardOptions = StyleBuilderOptions<Graybeard>;
12
- export type NeutrinoOptions = StyleBuilderOptions<Neutrino>;
13
- export type EmptyOptions = StyleBuilderOptions<Empty>;
14
- export type SomeOptions = ColorfulOptions | EclipseOptions | EmptyOptions | GraybeardOptions | NeutrinoOptions;
15
- export type MakeStyle<T extends StyleBuilder<T>, O extends StyleBuilderOptions<T>> = ((options?: O) => StyleSpecification) & {
16
- getOptions: () => O;
17
- };
18
- export type ColorfulBuilder = MakeStyle<Colorful, ColorfulOptions>;
19
- export type EclipseBuilder = MakeStyle<Eclipse, EclipseOptions>;
20
- export type GraybeardBuilder = MakeStyle<Graybeard, GraybeardOptions>;
21
- export type NeutrinoBuilder = MakeStyle<Neutrino, NeutrinoOptions>;
22
- export type EmptyBuilder = MakeStyle<Empty, EmptyOptions>;
23
- export type SomeBuilder = ColorfulBuilder | EclipseBuilder | EmptyBuilder | GraybeardBuilder | NeutrinoBuilder;
24
- export declare const colorful: ColorfulBuilder;
25
- export declare const eclipse: EclipseBuilder;
26
- export declare const graybeard: GraybeardBuilder;
27
- export declare const neutrino: NeutrinoBuilder;
28
- export declare const empty: EmptyBuilder;
3
+ export interface StyleBuilderFunction {
4
+ (options?: StyleBuilderOptions): StyleSpecification;
5
+ getOptions(): StyleBuilderOptions;
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.js';
3
- import Eclipse from './eclipse.js';
4
- import Graybeard from './graybeard.js';
5
- import Neutrino from './neutrino.js';
6
- import Empty from './empty.js';
2
+ import Colorful from './colorful';
3
+ import Eclipse from './eclipse';
4
+ import Graybeard from './graybeard';
5
+ import Neutrino from './neutrino';
6
+ import Empty from './empty';
7
7
  function getStyleBuilder(styleBuilder) {
8
8
  const fn = function (options) {
9
9
  return new styleBuilder().build(options);
@@ -17,3 +17,4 @@ export const eclipse = getStyleBuilder(Eclipse);
17
17
  export const graybeard = getStyleBuilder(Graybeard);
18
18
  export const neutrino = getStyleBuilder(Neutrino);
19
19
  export const empty = getStyleBuilder(Empty);
20
+ //# sourceMappingURL=index.js.map
@@ -1,36 +1,11 @@
1
- import { StyleBuilder } from '../style_builder/style_builder.js';
2
- import type { StyleRules, StyleRulesOptions } from '../style_builder/types.js';
3
- export default class Neutrino extends StyleBuilder<Neutrino> {
1
+ import { StyleBuilderColors, StyleRules, StyleRulesOptions } from '../style_builder/types';
2
+ import Colorful from './colorful';
3
+ export default class Neutrino extends Colorful {
4
4
  readonly name: string;
5
5
  defaultFonts: {
6
6
  regular: string;
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
- site: 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
- };
35
- protected getStyleRules(options: StyleRulesOptions<Neutrino>): StyleRules;
9
+ defaultColors: StyleBuilderColors;
10
+ protected getStyleRules(options: StyleRulesOptions): StyleRules;
36
11
  }