@versatiles/style 5.2.5 → 5.2.7

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 (102) hide show
  1. package/dist/index.d.ts +274 -14
  2. package/dist/index.js +3650 -11
  3. package/dist/index.js.map +1 -0
  4. package/package.json +8 -7
  5. package/src/color/abstract.ts +83 -0
  6. package/src/color/hsl.test.ts +182 -0
  7. package/src/color/hsl.ts +122 -0
  8. package/src/color/hsv.test.ts +174 -0
  9. package/src/color/hsv.ts +100 -0
  10. package/src/color/index.test.ts +119 -0
  11. package/src/color/index.ts +38 -0
  12. package/src/color/random.test.ts +35 -0
  13. package/src/color/random.ts +165 -0
  14. package/src/color/rgb.test.ts +227 -0
  15. package/src/color/rgb.ts +248 -0
  16. package/src/color/utils.test.ts +86 -0
  17. package/src/color/utils.ts +13 -0
  18. package/src/guess_style/guess_style.test.ts +134 -0
  19. package/src/guess_style/guess_style.ts +166 -0
  20. package/{dist/guess_style/index.d.ts → src/guess_style/index.ts} +1 -0
  21. package/src/index.test.ts +77 -0
  22. package/src/index.ts +18 -0
  23. package/src/lib/utils.test.ts +197 -0
  24. package/src/lib/utils.ts +134 -0
  25. package/{dist/shortbread/index.d.ts → src/shortbread/index.ts} +1 -0
  26. package/src/shortbread/layers.test.ts +36 -0
  27. package/src/shortbread/layers.ts +564 -0
  28. package/src/shortbread/properties.test.ts +44 -0
  29. package/src/shortbread/properties.ts +142 -0
  30. package/src/shortbread/template.test.ts +43 -0
  31. package/src/shortbread/template.ts +343 -0
  32. package/src/style_builder/decorator.test.ts +67 -0
  33. package/src/style_builder/decorator.ts +135 -0
  34. package/src/style_builder/recolor.test.ts +306 -0
  35. package/src/style_builder/recolor.ts +110 -0
  36. package/src/style_builder/style_builder.test.ts +103 -0
  37. package/src/style_builder/style_builder.ts +134 -0
  38. package/src/style_builder/types.ts +141 -0
  39. package/src/styles/LICENSE.md +41 -0
  40. package/src/styles/colorful.ts +1041 -0
  41. package/src/styles/eclipse.ts +11 -0
  42. package/{dist/styles/empty.d.ts → src/styles/empty.ts} +7 -3
  43. package/src/styles/graybeard.ts +11 -0
  44. package/src/styles/index.ts +33 -0
  45. package/src/styles/neutrino.ts +429 -0
  46. package/{dist/types/index.d.ts → src/types/index.ts} +1 -0
  47. package/{dist/types/maplibre.d.ts → src/types/maplibre.ts} +3 -0
  48. package/src/types/tilejson.test.ts +94 -0
  49. package/src/types/tilejson.ts +125 -0
  50. package/src/types/vector_layer.test.ts +64 -0
  51. package/src/types/vector_layer.ts +69 -0
  52. package/dist/color/abstract.d.ts +0 -34
  53. package/dist/color/abstract.js +0 -53
  54. package/dist/color/hsl.d.ts +0 -23
  55. package/dist/color/hsl.js +0 -98
  56. package/dist/color/hsv.d.ts +0 -20
  57. package/dist/color/hsv.js +0 -100
  58. package/dist/color/index.d.ts +0 -6
  59. package/dist/color/index.js +0 -29
  60. package/dist/color/random.d.ts +0 -9
  61. package/dist/color/random.js +0 -134
  62. package/dist/color/rgb.d.ts +0 -28
  63. package/dist/color/rgb.js +0 -195
  64. package/dist/color/utils.d.ts +0 -3
  65. package/dist/color/utils.js +0 -10
  66. package/dist/guess_style/guess_style.d.ts +0 -8
  67. package/dist/guess_style/guess_style.js +0 -147
  68. package/dist/guess_style/index.js +0 -2
  69. package/dist/lib/utils.d.ts +0 -6
  70. package/dist/lib/utils.js +0 -126
  71. package/dist/shortbread/index.js +0 -3
  72. package/dist/shortbread/layers.d.ts +0 -5
  73. package/dist/shortbread/layers.js +0 -521
  74. package/dist/shortbread/properties.d.ts +0 -7
  75. package/dist/shortbread/properties.js +0 -125
  76. package/dist/shortbread/template.d.ts +0 -4
  77. package/dist/shortbread/template.js +0 -339
  78. package/dist/style_builder/decorator.d.ts +0 -4
  79. package/dist/style_builder/decorator.js +0 -127
  80. package/dist/style_builder/recolor.d.ts +0 -22
  81. package/dist/style_builder/recolor.js +0 -89
  82. package/dist/style_builder/style_builder.d.ts +0 -15
  83. package/dist/style_builder/style_builder.js +0 -106
  84. package/dist/style_builder/types.d.ts +0 -122
  85. package/dist/style_builder/types.js +0 -3
  86. package/dist/styles/colorful.d.ts +0 -11
  87. package/dist/styles/colorful.js +0 -956
  88. package/dist/styles/eclipse.d.ts +0 -5
  89. package/dist/styles/eclipse.js +0 -9
  90. package/dist/styles/empty.js +0 -8
  91. package/dist/styles/graybeard.d.ts +0 -5
  92. package/dist/styles/graybeard.js +0 -9
  93. package/dist/styles/index.d.ts +0 -11
  94. package/dist/styles/index.js +0 -20
  95. package/dist/styles/neutrino.d.ts +0 -11
  96. package/dist/styles/neutrino.js +0 -401
  97. package/dist/types/index.js +0 -3
  98. package/dist/types/maplibre.js +0 -2
  99. package/dist/types/tilejson.d.ts +0 -32
  100. package/dist/types/tilejson.js +0 -87
  101. package/dist/types/vector_layer.d.ts +0 -14
  102. package/dist/types/vector_layer.js +0 -51
@@ -1,5 +0,0 @@
1
- import Colorful from './colorful.js';
2
- export default class Eclipse extends Colorful {
3
- readonly name: string;
4
- constructor();
5
- }
@@ -1,9 +0,0 @@
1
- import Colorful from './colorful.js';
2
- export default class Eclipse extends Colorful {
3
- name = 'Eclipse';
4
- constructor() {
5
- super();
6
- this.transformDefaultColors(color => color.invertLuminosity());
7
- }
8
- }
9
- //# sourceMappingURL=eclipse.js.map
@@ -1,8 +0,0 @@
1
- import Colorful from './colorful.js';
2
- export default class Empty extends Colorful {
3
- name = 'Empty';
4
- getStyleRules(_options) {
5
- return {};
6
- }
7
- }
8
- //# sourceMappingURL=empty.js.map
@@ -1,5 +0,0 @@
1
- import Colorful from './colorful.js';
2
- export default class Graybeard extends Colorful {
3
- readonly name: string;
4
- constructor();
5
- }
@@ -1,9 +0,0 @@
1
- import Colorful from './colorful.js';
2
- export default class Graybeard extends Colorful {
3
- name = 'Graybeard';
4
- constructor() {
5
- super();
6
- this.transformDefaultColors(color => color.saturate(-1));
7
- }
8
- }
9
- //# sourceMappingURL=graybeard.js.map
@@ -1,11 +0,0 @@
1
- import type { StyleBuilderOptions } from '../style_builder/types.js';
2
- import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
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,20 +0,0 @@
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';
7
- function getStyleBuilder(styleBuilder) {
8
- const fn = function (options) {
9
- return new styleBuilder().build(options);
10
- };
11
- fn.getOptions = () => new styleBuilder().getDefaultOptions();
12
- return fn;
13
- }
14
- // generate style builders
15
- export const colorful = getStyleBuilder(Colorful);
16
- export const eclipse = getStyleBuilder(Eclipse);
17
- export const graybeard = getStyleBuilder(Graybeard);
18
- export const neutrino = getStyleBuilder(Neutrino);
19
- export const empty = getStyleBuilder(Empty);
20
- //# sourceMappingURL=index.js.map
@@ -1,11 +0,0 @@
1
- import { StyleBuilderColors, StyleRules, StyleRulesOptions } from '../style_builder/types.js';
2
- import Colorful from './colorful.js';
3
- export default class Neutrino extends Colorful {
4
- readonly name: string;
5
- defaultFonts: {
6
- regular: string;
7
- bold: string;
8
- };
9
- defaultColors: StyleBuilderColors;
10
- protected getStyleRules(options: StyleRulesOptions): StyleRules;
11
- }
@@ -1,401 +0,0 @@
1
- import Colorful from './colorful.js';
2
- export default class Neutrino extends Colorful {
3
- name = 'Neutrino';
4
- defaultFonts = {
5
- regular: 'noto_sans_regular',
6
- bold: 'noto_sans_bold',
7
- };
8
- defaultColors = {
9
- /** Color representing land areas. */
10
- land: '#f6f0f6',
11
- /** Color representing bodies of water such as lakes and rivers. */
12
- water: '#cbd2df',
13
- /** Color for grassy areas and fields. */
14
- grass: '#e7e9e5',
15
- /** Color for wooded or forested areas. */
16
- wood: '#d9e3d9',
17
- /** Color used for agricultural land. */
18
- agriculture: '#f8eeee',
19
- /** Color for site areas such as parks or recreational facilities. */
20
- commercial: '#ebe8e6',
21
- /** Primary color for buildings. */
22
- building: '#e0d1d9',
23
- /** Color for streets and roads. */
24
- street: '#ffffff',
25
- /** Color used for boundaries, such as national or state lines. */
26
- boundary: '#e6ccd8',
27
- /** Color for footpaths and pedestrian areas. */
28
- foot: '#fef8ff',
29
- /** Color used for railways. */
30
- rail: '#e8d5e0',
31
- /** Primary color used for text labels. */
32
- label: '#cbb7b7',
33
- // Don't need these colors:
34
- buildingbg: '#000',
35
- burial: '#000',
36
- construction: '#000',
37
- cycle: '#000',
38
- danger: '#000',
39
- disputed: '#000',
40
- education: '#000',
41
- glacier: '#000',
42
- hospital: '#000',
43
- industrial: '#000',
44
- labelHalo: '#000',
45
- leisure: '#000',
46
- motorway: '#000',
47
- motorwaybg: '#000',
48
- park: '#000',
49
- parking: '#000',
50
- poi: '#000',
51
- prison: '#000',
52
- residential: '#000',
53
- rock: '#000',
54
- sand: '#000',
55
- shield: '#000',
56
- streetbg: '#000',
57
- subway: '#000',
58
- symbol: '#000',
59
- trunk: '#000',
60
- trunkbg: '#000',
61
- waste: '#000',
62
- wetland: '#000',
63
- };
64
- getStyleRules(options) {
65
- const { colors, fonts } = options;
66
- return {
67
- 'background': {
68
- color: colors.land,
69
- },
70
- 'boundary-{country,state}': {
71
- color: colors.boundary,
72
- },
73
- 'boundary-country:outline': {
74
- size: { 2: 2, 10: 6 },
75
- opacity: { 2: 0, 4: 0.3 },
76
- color: colors.land.lighten(0.05),
77
- lineBlur: 1,
78
- },
79
- 'boundary-country': {
80
- size: { 2: 1, 10: 4 },
81
- opacity: { 2: 0, 4: 1 },
82
- },
83
- 'boundary-state:outline': {
84
- size: { 7: 3, 10: 5 },
85
- opacity: { 7: 0, 8: 0.3 },
86
- color: colors.land.lighten(0.05),
87
- lineBlur: 1,
88
- },
89
- 'boundary-state': {
90
- size: { 7: 2, 10: 3 },
91
- opacity: { 7: 0, 8: 1 },
92
- lineDasharray: [0, 1.5, 1, 1.5],
93
- lineCap: 'round',
94
- lineJoin: 'round',
95
- },
96
- 'water-*': {
97
- color: colors.water,
98
- },
99
- 'water-area': {
100
- opacity: { 4: 0, 6: 1 },
101
- },
102
- 'water-area-*': {
103
- opacity: { 4: 0, 6: 1 },
104
- },
105
- 'water-{pier,dam}-area': {
106
- color: colors.land,
107
- opacity: { 12: 0, 13: 1 },
108
- },
109
- 'water-pier': {
110
- color: colors.land,
111
- },
112
- 'land-*': {
113
- color: colors.land,
114
- },
115
- 'land-forest': {
116
- color: colors.wood,
117
- opacity: { 7: 0, 8: 1 },
118
- },
119
- 'land-grass': {
120
- color: colors.grass,
121
- opacity: { 11: 0, 12: 1 },
122
- },
123
- 'land-{park,garden,vegetation}': {
124
- color: colors.grass.darken(0.05).saturate(0.05),
125
- opacity: { 11: 0, 12: 1 },
126
- },
127
- 'land-agriculture': {
128
- color: colors.agriculture,
129
- opacity: { 10: 0, 11: 1 },
130
- },
131
- 'land-{commercial,industrial,residential}': {
132
- color: colors.land.darken(0.03),
133
- opacity: { 10: 0, 11: 1 },
134
- },
135
- 'site-{bicycleparking,parking}': {
136
- color: colors.commercial,
137
- },
138
- 'building': {
139
- color: colors.building,
140
- opacity: { 14: 0, 15: 1 },
141
- },
142
- 'bridge': {
143
- color: colors.land.darken(0.01),
144
- },
145
- '{tunnel-,bridge-,}street-*': {
146
- color: colors.street,
147
- size: 1,
148
- lineJoin: 'round',
149
- lineCap: 'round',
150
- },
151
- '{tunnel-,}street-*:outline': {
152
- color: colors.street.darken(0.1),
153
- lineJoin: 'round',
154
- lineCap: 'round',
155
- },
156
- 'tunnel-street-*': {
157
- color: colors.street.darken(0.03),
158
- },
159
- 'tunnel-street-*:outline': {
160
- color: colors.street.darken(0.13),
161
- lineDasharray: [1, 2],
162
- },
163
- 'bridge-street-*:outline': {
164
- color: colors.street.darken(0.15),
165
- },
166
- // motorway
167
- '{bridge-street,tunnel-street,street}-motorway:outline': {
168
- size: { 5: 2, 10: 5, 14: 5, 16: 14, 18: 38, 19: 84, 20: 168 },
169
- opacity: { 5: 0, 6: 1 },
170
- },
171
- '{bridge-street,tunnel-street,street}-motorway': {
172
- size: { 5: 1, 10: 4, 14: 4, 16: 12, 18: 36, 19: 80, 20: 160 },
173
- opacity: { 5: 0, 6: 1 },
174
- },
175
- // trunk
176
- '{bridge-street,tunnel-street,street}-trunk:outline': {
177
- size: { 7: 2, 10: 4, 14: 6, 16: 12, 18: 36, 19: 74, 20: 144 },
178
- opacity: { 7: 0, 8: 1 },
179
- },
180
- '{bridge-street,tunnel-street,street}-trunk': {
181
- size: { 7: 1, 10: 3, 14: 5, 16: 10, 18: 34, 19: 70, 20: 140 },
182
- opacity: { 7: 0, 8: 1 },
183
- },
184
- // primary
185
- '{bridge-street,tunnel-street,street}-primary:outline': {
186
- size: { 7: 2, 10: 4, 14: 6, 16: 12, 18: 36, 19: 74, 20: 144 },
187
- opacity: { 7: 0, 8: 1 },
188
- },
189
- '{bridge-street,tunnel-street,street}-primary': {
190
- size: { 7: 1, 10: 3, 14: 5, 16: 10, 18: 34, 19: 70, 20: 140 },
191
- opacity: { 7: 0, 8: 1 },
192
- },
193
- // secondary
194
- '{bridge-street,tunnel-street,street}-secondary:outline': {
195
- size: { 11: 2, 14: 5, 16: 8, 18: 30, 19: 68, 20: 138 },
196
- opacity: { 11: 0, 12: 1 },
197
- },
198
- '{bridge-street,tunnel-street,street}-secondary': {
199
- size: { 11: 1, 14: 4, 16: 6, 18: 28, 19: 64, 20: 130 },
200
- opacity: { 11: 0, 12: 1 },
201
- },
202
- // links
203
- '{bridge-street,tunnel-street,street}-motorway-link:outline': {
204
- minzoom: 12,
205
- size: { 12: 2, 14: 3, 16: 7, 18: 14, 20: 40 },
206
- opacity: { 12: 0, 13: 1 },
207
- },
208
- '{bridge-street,tunnel-street,street}-motorway-link': {
209
- minzoom: 12,
210
- size: { 12: 1, 14: 2, 16: 5, 18: 12, 20: 38 },
211
- opacity: { 12: 0, 13: 1 },
212
- },
213
- '{bridge-street,tunnel-street,street}-{trunk,primary,secondary}-link:outline': {
214
- minzoom: 13,
215
- size: { 12: 2, 14: 3, 16: 7, 18: 14, 20: 40 },
216
- opacity: { 13: 0, 14: 1 },
217
- },
218
- '{bridge-street,tunnel-street,street}-{trunk,primary,secondary}-link': {
219
- minzoom: 13,
220
- size: { 12: 1, 14: 2, 16: 5, 18: 12, 20: 38 },
221
- opacity: { 13: 0, 14: 1 },
222
- },
223
- // minor streets
224
- '{bridge-street,tunnel-street,street}-{tertiary,tertiary-link,unclassified,residential,living_street,pedestrian}:outline': {
225
- size: { 12: 2, 14: 3, 16: 6, 18: 26, 19: 64, 20: 128 },
226
- opacity: { 12: 0, 13: 1 },
227
- },
228
- '{bridge-street,tunnel-street,street}-{tertiary,tertiary-link,unclassified,residential,living_street,pedestrian}': {
229
- size: { 12: 1, 14: 2, 16: 5, 18: 24, 19: 60, 20: 120 },
230
- opacity: { 12: 0, 13: 1 },
231
- },
232
- // service and tracks
233
- '{bridge-street,tunnel-street,street}-{service,track}:outline': {
234
- size: { 14: 2, 16: 4, 18: 18, 19: 48, 20: 96 },
235
- opacity: { 14: 0, 15: 1 },
236
- },
237
- '{bridge-street,tunnel-street,street}-{service,track}': {
238
- size: { 14: 1, 16: 3, 18: 16, 19: 44, 20: 88 },
239
- opacity: { 14: 0, 15: 1 },
240
- },
241
- // ways, surface only
242
- 'way-{footway,path,steps}:outline': {
243
- size: { 17: 0, 18: 3 },
244
- opacity: { 17: 0, 18: 1 },
245
- minzoom: 17,
246
- color: colors.foot.darken(0.05),
247
- },
248
- 'way-{footway,path,steps}': {
249
- size: { 17: 0, 18: 2 },
250
- opacity: { 17: 0, 18: 1 },
251
- minzoom: 17,
252
- color: colors.foot,
253
- },
254
- 'street-pedestrian': {
255
- size: { 13: 1, 15: 3 },
256
- opacity: { 13: 0, 14: 1 },
257
- color: colors.foot,
258
- },
259
- 'street-pedestrian-zone': {
260
- color: colors.foot,
261
- opacity: { 14: 0, 15: 1 },
262
- },
263
- // rail
264
- '{tunnel-,bridge-,}transport-{rail,lightrail}:outline': {
265
- color: colors.rail,
266
- size: { 8: 1, 12: 1, 15: 3 },
267
- },
268
- '{tunnel-,bridge-,}transport-{rail,lightrail}': {
269
- color: colors.rail.lighten(0.1),
270
- size: { 8: 1, 12: 1, 15: 2 },
271
- lineDasharray: [2, 2],
272
- },
273
- // bridge
274
- '{bridge-,}transport-rail:outline': {
275
- opacity: { 8: 0, 9: 1 },
276
- },
277
- '{bridge-,}transport-rail': {
278
- opacity: { 14: 0, 15: 1 },
279
- },
280
- '{bridge-,}transport-lightrail:outline': {
281
- opacity: { 11: 0, 12: 1 },
282
- },
283
- '{bridge-,}transport-lightrail': {
284
- opacity: { 14: 0, 15: 1 },
285
- },
286
- // tunnel
287
- 'tunnel-transport-rail:outline': {
288
- opacity: { 8: 0, 9: 0.3 },
289
- },
290
- 'tunnel-transport-rail': {
291
- opacity: { 14: 0, 15: 0.3 },
292
- },
293
- 'tunnel-transport-lightrail:outline': {
294
- opacity: { 11: 0, 12: 0.3 },
295
- },
296
- 'tunnel-transport-lightrail': {
297
- opacity: { 14: 0, 15: 0.3 },
298
- },
299
- // labels
300
- 'label-boundary-*': {
301
- color: colors.label,
302
- font: fonts.bold,
303
- textTransform: 'uppercase',
304
- textHaloColor: colors.label.lighten(0.5),
305
- textHaloWidth: 0.1,
306
- textHaloBlur: 1,
307
- },
308
- 'label-boundary-country-large': {
309
- minzoom: 2,
310
- size: { 2: 11, 5: 16 },
311
- },
312
- 'label-boundary-country-medium': {
313
- minzoom: 3,
314
- size: { 3: 11, 5: 15 },
315
- },
316
- 'label-boundary-country-small': {
317
- minzoom: 4,
318
- size: { 4: 11, 5: 14 },
319
- },
320
- 'label-boundary-state': {
321
- minzoom: 5,
322
- color: colors.label.lighten(0.05),
323
- size: { 5: 8, 8: 12 },
324
- },
325
- 'label-place-*': {
326
- color: colors.label.rotateHue(-15).saturate(1).darken(0.05),
327
- font: fonts.regular,
328
- textHaloColor: colors.label.lighten(0.5),
329
- textHaloWidth: 0.1,
330
- textHaloBlur: 1,
331
- size: 1,
332
- },
333
- 'label-place-capital': {
334
- minzoom: 5,
335
- size: { 5: 12, 10: 16 },
336
- },
337
- 'label-place-statecapital': {
338
- minzoom: 6,
339
- size: { 6: 11, 10: 15 },
340
- },
341
- 'label-place-city': {
342
- minzoom: 7,
343
- size: { 7: 11, 10: 14 },
344
- },
345
- 'label-place-town': {
346
- minzoom: 8,
347
- size: { 8: 11, 12: 14 },
348
- },
349
- 'label-place-village': {
350
- minzoom: 9,
351
- size: { 9: 11, 12: 14 },
352
- },
353
- 'label-place-hamlet': {
354
- minzoom: 10,
355
- size: { 10: 11, 12: 14 },
356
- },
357
- // all the city things
358
- 'label-place-suburb': {
359
- minzoom: 11,
360
- size: { 11: 11, 13: 14 },
361
- textTransform: 'uppercase',
362
- color: colors.label.rotateHue(-30).saturate(1).darken(0.05),
363
- },
364
- 'label-place-quarter': {
365
- minzoom: 13,
366
- size: { 13: 13 },
367
- textTransform: 'uppercase',
368
- color: colors.label.rotateHue(-40).saturate(1).darken(0.05),
369
- },
370
- 'label-place-neighbourhood': {
371
- minzoom: 14,
372
- size: { 14: 12 },
373
- textTransform: 'uppercase',
374
- color: colors.label.rotateHue(-50).saturate(1).darken(0.05),
375
- },
376
- 'label-motorway-shield': {
377
- color: colors.label,
378
- font: fonts.regular,
379
- textHaloColor: colors.label.saturate(-0.5).lighten(0.1),
380
- textHaloWidth: 0.1,
381
- textHaloBlur: 1,
382
- symbolPlacement: 'line',
383
- textAnchor: 'center',
384
- minzoom: 14,
385
- size: { 14: 8, 18: 10, 20: 16 },
386
- },
387
- 'label-street-*': {
388
- color: colors.label,
389
- font: fonts.regular,
390
- textHaloColor: colors.label.saturate(-0.5).lighten(0.1),
391
- textHaloWidth: 0.1,
392
- textHaloBlur: 1,
393
- symbolPlacement: 'line',
394
- textAnchor: 'center',
395
- minzoom: 12,
396
- size: { 12: 10, 15: 13 },
397
- },
398
- };
399
- }
400
- }
401
- //# sourceMappingURL=neutrino.js.map
@@ -1,3 +0,0 @@
1
- export { isTileJSONSpecification } from './tilejson.js';
2
- export { isVectorLayers } from './vector_layer.js';
3
- //# sourceMappingURL=index.js.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=maplibre.js.map
@@ -1,32 +0,0 @@
1
- import type { VectorLayer } from './vector_layer.js';
2
- /** Basic structure for TileJSON specification, applicable to both raster and vector types. */
3
- export interface TileJSONSpecificationRaster {
4
- tilejson?: '3.0.0';
5
- tiles: string[];
6
- attribution?: string;
7
- bounds?: [number, number, number, number];
8
- center?: [number, number];
9
- data?: string[];
10
- description?: string;
11
- fillzoom?: number;
12
- grids?: string[];
13
- legend?: string;
14
- maxzoom?: number;
15
- minzoom?: number;
16
- name?: string;
17
- scheme?: 'tms' | 'xyz';
18
- template?: string;
19
- version?: string;
20
- }
21
- /** Structure for TileJSON specification of vector type, specifying vector-specific properties. */
22
- export interface TileJSONSpecificationVector extends TileJSONSpecificationRaster {
23
- vector_layers: VectorLayer[];
24
- }
25
- /** Represents a TileJSON specification, which can be either raster or vector. */
26
- export type TileJSONSpecification = TileJSONSpecificationRaster | TileJSONSpecificationVector;
27
- /**
28
- * Checks if an object adheres to the TileJSON specification.
29
- * Throws errors if the object does not conform to the expected structure or types.
30
- */
31
- export declare function isTileJSONSpecification(spec: unknown): spec is TileJSONSpecification;
32
- export declare function isRasterTileJSONSpecification(spec: unknown): spec is TileJSONSpecificationRaster;
@@ -1,87 +0,0 @@
1
- /**
2
- * Checks if an object adheres to the TileJSON specification.
3
- * Throws errors if the object does not conform to the expected structure or types.
4
- */
5
- export function isTileJSONSpecification(spec) {
6
- if (typeof spec !== 'object' || spec === null) {
7
- throw Error('spec must be an object');
8
- }
9
- const obj = spec;
10
- // Common property validation
11
- if (obj.data != null && obj.tilejson !== '3.0.0') {
12
- throw Error('spec.tilejson must be "3.0.0"');
13
- }
14
- if (obj.attribution != null && typeof obj.attribution !== 'string') {
15
- throw Error('spec.attribution must be a string if present');
16
- }
17
- if (obj.bounds != null) {
18
- if (!Array.isArray(obj.bounds) || obj.bounds.length !== 4 || obj.bounds.some(num => typeof num !== 'number')) {
19
- throw Error('spec.bounds must be an array of four numbers if present');
20
- }
21
- const a = obj.bounds;
22
- if (a[0] < -180 || a[0] > 180)
23
- throw Error('spec.bounds[0] must be between -180 and 180');
24
- if (a[1] < -90 || a[1] > 90)
25
- throw Error('spec.bounds[1] must be between -90 and 90');
26
- if (a[2] < -180 || a[2] > 180)
27
- throw Error('spec.bounds[2] must be between -180 and 180');
28
- if (a[3] < -90 || a[3] > 90)
29
- throw Error('spec.bounds[3] must be between -90 and 90');
30
- if (a[0] > a[2])
31
- throw Error('spec.bounds[0] must be smaller than spec.bounds[2]');
32
- if (a[1] > a[3])
33
- throw Error('spec.bounds[1] must be smaller than spec.bounds[3]');
34
- }
35
- if (obj.center != null) {
36
- if (!Array.isArray(obj.center) || obj.center.length !== 2 || obj.center.some(num => typeof num !== 'number')) {
37
- throw Error('spec.center must be an array of two numbers if present');
38
- }
39
- const a = obj.center;
40
- if (a[0] < -180 || a[0] > 180)
41
- throw Error('spec.center[0] must be between -180 and 180');
42
- if (a[1] < -90 || a[1] > 90)
43
- throw Error('spec.center[1] must be between -90 and 90');
44
- }
45
- if (obj.data != null && (!Array.isArray(obj.data) || obj.data.some(url => typeof url !== 'string'))) {
46
- throw Error('spec.data must be an array of strings if present');
47
- }
48
- if (obj.description != null && typeof obj.description !== 'string') {
49
- throw Error('spec.description must be a string if present');
50
- }
51
- if (obj.fillzoom != null && (typeof obj.fillzoom !== 'number' || (obj.fillzoom < 0))) {
52
- throw Error('spec.fillzoom must be a positive integer if present');
53
- }
54
- if (obj.grids != null && (!Array.isArray(obj.grids) || obj.grids.some(url => typeof url !== 'string'))) {
55
- throw Error('spec.grids must be an array of strings if present');
56
- }
57
- if (obj.legend != null && typeof obj.legend !== 'string') {
58
- throw Error('spec.legend must be a string if present');
59
- }
60
- if (obj.minzoom != null && (typeof obj.minzoom !== 'number' || (obj.minzoom < 0))) {
61
- throw Error('spec.minzoom must be a positive integer if present');
62
- }
63
- if (obj.maxzoom != null && (typeof obj.maxzoom !== 'number' || (obj.maxzoom < 0))) {
64
- throw Error('spec.maxzoom must be a positive integer if present');
65
- }
66
- if (obj.name != null && typeof obj.name !== 'string') {
67
- throw Error('spec.name must be a string if present');
68
- }
69
- if (obj.scheme != null && obj.scheme !== 'xyz' && obj.scheme !== 'tms') {
70
- throw Error('spec.scheme must be "tms" or "xyz" if present');
71
- }
72
- if (obj.template != null && typeof obj.template !== 'string') {
73
- throw Error('spec.template must be a string if present');
74
- }
75
- if (!Array.isArray(obj.tiles) || obj.tiles.length === 0 || obj.tiles.some(url => typeof url !== 'string')) {
76
- throw Error('spec.tiles must be an array of strings');
77
- }
78
- return true;
79
- }
80
- export function isRasterTileJSONSpecification(spec) {
81
- if (!isTileJSONSpecification(spec))
82
- return false;
83
- if (('vector_layers' in spec) && (spec.vector_layers != null))
84
- return false;
85
- return true;
86
- }
87
- //# sourceMappingURL=tilejson.js.map
@@ -1,14 +0,0 @@
1
- /** Represents the structure of a vector layer in a TileJSON specification. */
2
- export interface VectorLayer {
3
- id: string;
4
- fields: Record<string, 'Boolean' | 'Number' | 'String'>;
5
- description?: string;
6
- minzoom?: number;
7
- maxzoom?: number;
8
- }
9
- /**
10
- * Verifies if an object conforms to the VectorLayer structure.
11
- * Throws errors for any deviations from the expected structure or types.
12
- */
13
- export declare function isVectorLayer(layer: unknown): layer is VectorLayer;
14
- export declare function isVectorLayers(layers: unknown): layers is VectorLayer[];