@versatiles/style 5.8.4 → 5.9.1

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 (54) hide show
  1. package/README.md +24 -18
  2. package/dist/index.d.ts +20 -14
  3. package/dist/index.js +151 -83
  4. package/dist/index.js.map +1 -1
  5. package/package.json +17 -18
  6. package/src/color/abstract.ts +0 -202
  7. package/src/color/hsl.test.ts +0 -177
  8. package/src/color/hsl.ts +0 -201
  9. package/src/color/hsv.test.ts +0 -169
  10. package/src/color/hsv.ts +0 -189
  11. package/src/color/index.test.ts +0 -99
  12. package/src/color/index.ts +0 -35
  13. package/src/color/random.test.ts +0 -57
  14. package/src/color/random.ts +0 -267
  15. package/src/color/rgb.test.ts +0 -215
  16. package/src/color/rgb.ts +0 -380
  17. package/src/color/utils.test.ts +0 -85
  18. package/src/color/utils.ts +0 -17
  19. package/src/guess_style/guess_style.test.ts +0 -140
  20. package/src/guess_style/guess_style.ts +0 -249
  21. package/src/guess_style/index.ts +0 -2
  22. package/src/index.test.ts +0 -131
  23. package/src/index.ts +0 -113
  24. package/src/lib/utils.test.ts +0 -198
  25. package/src/lib/utils.ts +0 -132
  26. package/src/shortbread/index.ts +0 -2
  27. package/src/shortbread/layers.test.ts +0 -81
  28. package/src/shortbread/layers.ts +0 -602
  29. package/src/shortbread/properties.test.ts +0 -44
  30. package/src/shortbread/properties.ts +0 -156
  31. package/src/shortbread/template.test.ts +0 -49
  32. package/src/shortbread/template.ts +0 -336
  33. package/src/style_builder/decorator.test.ts +0 -68
  34. package/src/style_builder/decorator.ts +0 -143
  35. package/src/style_builder/recolor.test.ts +0 -328
  36. package/src/style_builder/recolor.ts +0 -237
  37. package/src/style_builder/style_builder.test.ts +0 -148
  38. package/src/style_builder/style_builder.ts +0 -138
  39. package/src/style_builder/types.ts +0 -195
  40. package/src/styles/LICENSE.md +0 -41
  41. package/src/styles/colorful.test.ts +0 -91
  42. package/src/styles/colorful.ts +0 -1177
  43. package/src/styles/eclipse.ts +0 -11
  44. package/src/styles/empty.ts +0 -10
  45. package/src/styles/graybeard.ts +0 -11
  46. package/src/styles/index.ts +0 -32
  47. package/src/styles/neutrino.ts +0 -427
  48. package/src/styles/shadow.ts +0 -11
  49. package/src/types/index.ts +0 -5
  50. package/src/types/maplibre.ts +0 -25
  51. package/src/types/tilejson.test.ts +0 -96
  52. package/src/types/tilejson.ts +0 -125
  53. package/src/types/vector_layer.test.ts +0 -68
  54. package/src/types/vector_layer.ts +0 -69
@@ -1,602 +0,0 @@
1
- import type {
2
- DataDrivenPropertyValueSpecification,
3
- FormattedSpecification,
4
- LegacyFilterSpecification,
5
- } from '@maplibre/maplibre-gl-style-spec';
6
- import type { MaplibreLayerDefinition } from '../types/index.js';
7
- import { Language } from '../style_builder/types.js';
8
-
9
- export function getShortbreadLayers(option: { readonly language: Language }): MaplibreLayerDefinition[] {
10
- const { language } = option;
11
- let nameField: DataDrivenPropertyValueSpecification<FormattedSpecification> = ['get', 'name'];
12
- if (language) {
13
- nameField = ['case', ['to-boolean', ['get', 'name_' + language]], ['get', 'name_' + language], ['get', 'name']];
14
- }
15
-
16
- return [
17
- // background
18
- { id: 'background', type: 'background' },
19
-
20
- // ocean
21
- { id: 'water-ocean', type: 'fill', 'source-layer': 'ocean' },
22
-
23
- // land
24
- {
25
- id: 'land-glacier',
26
- type: 'fill',
27
- 'source-layer': 'water_polygons',
28
- filter: ['all', ['==', 'kind', 'glacier']],
29
- },
30
-
31
- ...[
32
- { id: 'commercial', kinds: ['commercial', 'retail'] },
33
- { id: 'industrial', kinds: ['industrial', 'quarry', 'railway'] },
34
- { id: 'residential', kinds: ['garages', 'residential'] },
35
- {
36
- id: 'agriculture',
37
- kinds: [
38
- 'brownfield',
39
- 'farmland',
40
- 'farmyard',
41
- 'greenfield',
42
- 'greenhouse_horticulture',
43
- 'orchard',
44
- 'plant_nursery',
45
- 'vineyard',
46
- ],
47
- },
48
- { id: 'waste', kinds: ['landfill'] },
49
- { id: 'park', kinds: ['park', 'village_green', 'recreation_ground'] },
50
- { id: 'garden', kinds: ['allotments', 'garden'] },
51
- { id: 'burial', kinds: ['cemetery', 'grave_yard'] },
52
- { id: 'leisure', kinds: ['miniature_golf', 'playground', 'golf_course'] },
53
- { id: 'rock', kinds: ['bare_rock', 'scree', 'shingle'] },
54
- { id: 'forest', kinds: ['forest'] },
55
- { id: 'grass', kinds: ['grass', 'grassland', 'meadow', 'wet_meadow'] },
56
- { id: 'vegetation', kinds: ['heath', 'scrub'] },
57
- { id: 'sand', kinds: ['beach', 'sand'] },
58
- { id: 'wetland', kinds: ['bog', 'marsh', 'string_bog', 'swamp'] },
59
- ].map(
60
- ({ id, kinds }: { readonly id: string; readonly kinds: readonly string[] }): MaplibreLayerDefinition => ({
61
- id: 'land-' + id,
62
- type: 'fill',
63
- 'source-layer': 'land',
64
- filter: ['all', ['in', 'kind', ...kinds]],
65
- })
66
- ),
67
-
68
- // water-lines
69
- ...['river', 'canal', 'stream', 'ditch'].map(
70
- (t: string): MaplibreLayerDefinition => ({
71
- id: 'water-' + t,
72
- type: 'line',
73
- 'source-layer': 'water_lines',
74
- filter: ['all', ['in', 'kind', t], ['!=', 'tunnel', true], ['!=', 'bridge', true]],
75
- })
76
- ),
77
-
78
- // water polygons
79
- {
80
- id: 'water-area',
81
- type: 'fill',
82
- 'source-layer': 'water_polygons',
83
- filter: ['==', 'kind', 'water'],
84
- },
85
- {
86
- id: 'water-area-river',
87
- type: 'fill',
88
- 'source-layer': 'water_polygons',
89
- filter: ['==', 'kind', 'river'],
90
- },
91
- {
92
- id: 'water-area-small',
93
- type: 'fill',
94
- 'source-layer': 'water_polygons',
95
- filter: ['in', 'kind', 'reservoir', 'basin', 'dock'],
96
- },
97
-
98
- // dam
99
- { id: 'water-dam-area', type: 'fill', 'source-layer': 'dam_polygons', filter: ['==', 'kind', 'dam'] },
100
- { id: 'water-dam', type: 'line', 'source-layer': 'dam_lines', filter: ['==', 'kind', 'dam'] },
101
-
102
- // pier
103
- {
104
- id: 'water-pier-area',
105
- type: 'fill',
106
- 'source-layer': 'pier_polygons',
107
- filter: ['in', 'kind', 'pier', 'breakwater', 'groyne'],
108
- },
109
- {
110
- id: 'water-pier',
111
- type: 'line',
112
- 'source-layer': 'pier_lines',
113
- filter: ['in', 'kind', 'pier', 'breakwater', 'groyne'],
114
- },
115
-
116
- // site
117
- ...[
118
- 'danger_area',
119
- 'sports_center',
120
- 'university',
121
- 'college',
122
- 'school',
123
- 'hospital',
124
- 'prison',
125
- 'parking',
126
- 'bicycle_parking',
127
- 'construction',
128
- ].map(
129
- (t): MaplibreLayerDefinition => ({
130
- id: 'site-' + t.replace(/_/g, ''),
131
- type: 'fill',
132
- 'source-layer': 'sites',
133
- filter: ['in', 'kind', t],
134
- })
135
- ),
136
-
137
- // airport
138
- {
139
- id: 'airport-area',
140
- type: 'fill',
141
- 'source-layer': 'street_polygons',
142
- filter: ['in', 'kind', 'runway', 'taxiway'],
143
- },
144
- {
145
- id: 'airport-taxiway:outline',
146
- type: 'line',
147
- 'source-layer': 'streets',
148
- filter: ['==', 'kind', 'taxiway'],
149
- },
150
- {
151
- id: 'airport-runway:outline',
152
- type: 'line',
153
- 'source-layer': 'streets',
154
- filter: ['==', 'kind', 'runway'],
155
- },
156
- {
157
- id: 'airport-taxiway',
158
- type: 'line',
159
- 'source-layer': 'streets',
160
- filter: ['==', 'kind', 'taxiway'],
161
- },
162
- {
163
- id: 'airport-runway',
164
- type: 'line',
165
- 'source-layer': 'streets',
166
- filter: ['==', 'kind', 'runway'],
167
- },
168
-
169
- // building
170
- {
171
- id: 'building:outline',
172
- type: 'fill',
173
- 'source-layer': 'buildings',
174
- },
175
- {
176
- id: 'building',
177
- type: 'fill',
178
- 'source-layer': 'buildings',
179
- },
180
-
181
- // tunnel-, street-, bridges-bridge
182
- ...['tunnel', 'street', 'bridge'].flatMap((c): MaplibreLayerDefinition[] => {
183
- let filter: LegacyFilterSpecification[];
184
- let prefix: string;
185
- let suffixes: Array<string> = [];
186
- const results: MaplibreLayerDefinition[] = [];
187
- switch (c) {
188
- case 'tunnel':
189
- filter = [['==', 'tunnel', true]];
190
- prefix = 'tunnel-';
191
- suffixes = [':outline', ''];
192
- break;
193
- case 'street':
194
- filter = [
195
- ['!=', 'bridge', true],
196
- ['!=', 'tunnel', true],
197
- ];
198
- prefix = '';
199
- suffixes = [':outline', ''];
200
- break;
201
- case 'bridge':
202
- filter = [['==', 'bridge', true]];
203
- prefix = 'bridge-';
204
- suffixes = [':bridge', ':outline', ''];
205
- break;
206
- }
207
-
208
- // in osm data streets on bridges are often not tagged as such
209
- // to be able to have multiple levels of bridges cross over each
210
- // other in the right order without using a secondary property.
211
- // this results in bridge-polygons being rendered above streets.
212
- // therefore bridge polygons are *under* surface streets here.
213
- // this workaround is also wrong, but everyone is using it since
214
- // it's simpler than removing all these tagging hacks from osm.
215
-
216
- // bridges, above tunnel, below street
217
- if (c === 'street')
218
- results.push({
219
- id: 'bridge',
220
- type: 'fill',
221
- 'source-layer': 'bridges',
222
- });
223
-
224
- suffixes.forEach((suffix) => {
225
- // pedestrian zone — no outline
226
- if (suffix === ':outline')
227
- results.push({
228
- id: prefix + 'street-pedestrian-zone',
229
- type: 'fill',
230
- 'source-layer': 'street_polygons',
231
- filter: ['all', ...filter, ['==', 'kind', 'pedestrian']],
232
- });
233
-
234
- // non-car streets
235
- ['footway', 'steps', 'path', 'cycleway'].forEach((t) => {
236
- results.push({
237
- id: prefix + 'way-' + t.replace(/_/g, '') + suffix,
238
- type: 'line',
239
- 'source-layer': 'streets',
240
- filter: ['all', ...filter, ['in', 'kind', t]],
241
- });
242
- });
243
-
244
- // no links
245
- ['track', 'pedestrian', 'service', 'living_street', 'residential', 'unclassified'].forEach((t) => {
246
- results.push({
247
- id: prefix + 'street-' + t.replace(/_/g, '') + suffix,
248
- type: 'line',
249
- 'source-layer': 'streets',
250
- filter: ['all', ['==', 'kind', t], ...filter],
251
- });
252
- });
253
-
254
- // no links, bicycle=designated
255
- if (suffix === '')
256
- ['track', 'pedestrian', 'service', 'living_street', 'residential', 'unclassified'].forEach((t) => {
257
- results.push({
258
- id: prefix + 'street-' + t.replace(/_/g, '') + '-bicycle',
259
- type: 'line',
260
- 'source-layer': 'streets',
261
- filter: ['all', ['==', 'kind', t], ['==', 'bicycle', 'designated'], ...filter],
262
- });
263
- });
264
-
265
- // links
266
- ['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach((t) => {
267
- results.push({
268
- id: prefix + 'street-' + t.replace(/_/g, '') + '-link' + suffix,
269
- type: 'line',
270
- 'source-layer': 'streets',
271
- filter: ['all', ...filter, ['in', 'kind', t], ['==', 'link', true]],
272
- });
273
- });
274
-
275
- // main
276
- ['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach((t) => {
277
- results.push({
278
- id: prefix + 'street-' + t.replace(/_/g, '') + suffix,
279
- type: 'line',
280
- 'source-layer': 'streets',
281
- filter: ['all', ...filter, ['in', 'kind', t], ['!=', 'link', true]],
282
- });
283
- });
284
- });
285
-
286
- // separate outline for trains
287
- [':outline', ''].forEach((suffix) => {
288
- // with service distinction
289
- ['rail', 'light_rail', 'subway', 'narrow_gauge', 'tram'].reverse().forEach((t) => {
290
- // main rail
291
- results.push({
292
- id: prefix + 'transport-' + t.replace(/_/g, '') + suffix,
293
- type: 'line',
294
- 'source-layer': 'streets',
295
- filter: ['all', ['in', 'kind', t], ['!has', 'service'], ...filter],
296
- });
297
-
298
- // service rail (crossover, siding, spur, yard)
299
- results.push({
300
- id: prefix + 'transport-' + t.replace(/_/g, '') + '-service' + suffix,
301
- type: 'line',
302
- 'source-layer': 'streets',
303
- filter: ['all', ['in', 'kind', t], ['has', 'service'], ...filter],
304
- });
305
- });
306
-
307
- // other transport
308
- ['funicular', 'monorail', 'bus_guideway', 'busway'].reverse().forEach((t) => {
309
- results.push({
310
- id: prefix + 'transport-' + t.replace(/_/g, '') + suffix,
311
- type: 'line',
312
- 'source-layer': 'streets',
313
- filter: ['all', ['in', 'kind', t], ...filter],
314
- });
315
- });
316
-
317
- if (c === 'street') {
318
- // aerialway, no bridges, above street evel
319
- ['cable_car', 'gondola', 'goods', 'chair_lift', 'drag_lift', 't-bar', 'j-bar', 'platter', 'rope-tow']
320
- .reverse()
321
- .forEach((t) => {
322
- results.push({
323
- id: 'aerialway-' + t.replace(/[_-]+/g, '') + suffix,
324
- type: 'line',
325
- 'source-layer': 'aerialways',
326
- filter: ['all', ...filter, ['in', 'kind', t]],
327
- });
328
- });
329
-
330
- // ferry — only on street level
331
- results.push({
332
- id: 'transport-ferry' + suffix,
333
- type: 'line',
334
- 'source-layer': 'ferries',
335
- });
336
- }
337
- });
338
-
339
- return results;
340
- }),
341
-
342
- // poi, one layer per type
343
- ...['amenity', 'leisure', 'tourism', 'shop', 'man_made', 'historic', 'emergency', 'highway', 'office'].map(
344
- (key): MaplibreLayerDefinition => ({
345
- id: 'poi-' + key,
346
-
347
- type: 'symbol',
348
- 'source-layer': 'pois',
349
- filter: ['to-boolean', ['get', key]],
350
- })
351
- ),
352
-
353
- // boundary
354
- ...[':outline', ''].flatMap((suffix): MaplibreLayerDefinition[] => [
355
- {
356
- id: 'boundary-country' + suffix,
357
- type: 'line',
358
- 'source-layer': 'boundaries',
359
- filter: [
360
- 'all',
361
- ['==', 'admin_level', 2],
362
- ['!=', 'maritime', true],
363
- ['!=', 'disputed', true],
364
- ['!=', 'coastline', true],
365
- ],
366
- },
367
- {
368
- id: 'boundary-country-disputed' + suffix,
369
- type: 'line',
370
- 'source-layer': 'boundaries',
371
- filter: [
372
- 'all',
373
- ['==', 'admin_level', 2],
374
- ['==', 'disputed', true],
375
- ['!=', 'maritime', true],
376
- ['!=', 'coastline', true],
377
- ],
378
- },
379
- {
380
- id: 'boundary-country-maritime' + suffix,
381
- type: 'line',
382
- 'source-layer': 'boundaries',
383
- filter: [
384
- 'all',
385
- ['==', 'admin_level', 2],
386
- ['==', 'maritime', true],
387
- ['!=', 'disputed', true],
388
- ['!=', 'coastline', true],
389
- ],
390
- },
391
- {
392
- id: 'boundary-state' + suffix,
393
- type: 'line',
394
- 'source-layer': 'boundaries',
395
- filter: [
396
- 'all',
397
- ['==', 'admin_level', 4],
398
- ['!=', 'maritime', true],
399
- ['!=', 'disputed', true],
400
- ['!=', 'coastline', true],
401
- ],
402
- },
403
- ]),
404
-
405
- // label-address
406
- {
407
- id: 'label-address-housenumber',
408
- type: 'symbol',
409
- 'source-layer': 'addresses',
410
- filter: ['has', 'housenumber'],
411
- layout: { 'text-field': '{housenumber}' },
412
- },
413
-
414
- // label-motorway
415
- {
416
- id: 'label-motorway-exit',
417
- type: 'symbol',
418
- 'source-layer': 'street_labels_points', // docs say `streets_labels_points`, but layer is actually called `street_labels_points`
419
- filter: ['==', 'kind', 'motorway_junction'],
420
- layout: { 'text-field': '{ref}' },
421
- // FIXME shield
422
- },
423
- {
424
- id: 'label-motorway-shield',
425
- type: 'symbol',
426
- 'source-layer': 'street_labels',
427
- filter: ['==', 'kind', 'motorway'],
428
- layout: { 'text-field': '{ref}' },
429
- // FIXME shield
430
- },
431
-
432
- // label-street
433
- ...['pedestrian', 'living_street', 'residential', 'unclassified', 'tertiary', 'secondary', 'primary', 'trunk'].map(
434
- (t: string): MaplibreLayerDefinition => ({
435
- id: 'label-street-' + t.replace(/_/g, ''),
436
- type: 'symbol',
437
- 'source-layer': 'street_labels',
438
- filter: ['==', 'kind', t],
439
- layout: { 'text-field': nameField },
440
- })
441
- ),
442
-
443
- // label-place of small places
444
- ...[
445
- /*'locality', 'island', 'farm', 'dwelling',*/ 'neighbourhood',
446
- 'quarter',
447
- 'suburb',
448
- 'hamlet',
449
- 'village',
450
- 'town',
451
- ].map(
452
- (id: string): MaplibreLayerDefinition => ({
453
- id: 'label-place-' + id.replace(/_/g, ''),
454
- type: 'symbol',
455
- 'source-layer': 'place_labels',
456
- filter: ['==', 'kind', id],
457
- layout: { 'text-field': nameField },
458
- })
459
- ),
460
-
461
- // label-boundary
462
- {
463
- id: 'label-boundary-state',
464
- type: 'symbol',
465
- 'source-layer': 'boundary_labels',
466
- filter: ['in', 'admin_level', 4, '4'],
467
- layout: { 'text-field': nameField },
468
- },
469
-
470
- // label-place-* of large places
471
- ...['city', 'state_capital', 'capital'].map(
472
- (id: string): MaplibreLayerDefinition => ({
473
- id: 'label-place-' + id.replace(/_/g, ''),
474
- type: 'symbol',
475
- 'source-layer': 'place_labels',
476
- filter: ['==', 'kind', id],
477
- layout: { 'text-field': nameField },
478
- })
479
- ),
480
-
481
- {
482
- id: 'label-boundary-country-small',
483
- type: 'symbol',
484
- 'source-layer': 'boundary_labels',
485
- filter: ['all', ['in', 'admin_level', 2, '2'], ['<=', 'way_area', 10000000]],
486
- layout: { 'text-field': nameField },
487
- },
488
- {
489
- id: 'label-boundary-country-medium',
490
- type: 'symbol',
491
- 'source-layer': 'boundary_labels',
492
- filter: ['all', ['in', 'admin_level', 2, '2'], ['<', 'way_area', 90000000], ['>', 'way_area', 10000000]],
493
- layout: { 'text-field': nameField },
494
- },
495
- {
496
- id: 'label-boundary-country-large',
497
- type: 'symbol',
498
- 'source-layer': 'boundary_labels',
499
- filter: ['all', ['in', 'admin_level', 2, '2'], ['>=', 'way_area', 90000000]],
500
- layout: { 'text-field': nameField },
501
- },
502
-
503
- // marking
504
- {
505
- id: 'marking-oneway', // streets → oneway
506
- type: 'symbol',
507
- 'source-layer': 'streets',
508
- filter: [
509
- 'all',
510
- ['==', 'oneway', true],
511
- ['in', 'kind', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'living_street'],
512
- ],
513
- layout: {
514
- 'symbol-placement': 'line',
515
- 'symbol-spacing': 175,
516
- 'icon-rotate': 90,
517
- 'icon-rotation-alignment': 'map',
518
- 'icon-padding': 5,
519
- 'symbol-avoid-edges': true,
520
- },
521
- },
522
- {
523
- id: 'marking-oneway-reverse', // oneway_reverse
524
- type: 'symbol',
525
- 'source-layer': 'streets',
526
- filter: [
527
- 'all',
528
- ['==', 'oneway_reverse', true],
529
- ['in', 'kind', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'living_street'],
530
- ],
531
- layout: {
532
- 'symbol-placement': 'line',
533
- 'symbol-spacing': 75,
534
- 'icon-rotate': -90,
535
- 'icon-rotation-alignment': 'map',
536
- 'icon-padding': 5,
537
- 'symbol-avoid-edges': true,
538
- },
539
- },
540
- {
541
- id: 'marking-bicycle', // bicycle=designated or kind=cycleway
542
- type: 'symbol',
543
- 'source-layer': 'streets',
544
- filter: ['all', ['==', 'bicycle', 'designated'], ['==', 'kind', 'cycleway']],
545
- layout: {
546
- 'symbol-placement': 'line',
547
- 'symbol-spacing': 50,
548
- },
549
- },
550
-
551
- // symbol
552
- {
553
- id: 'symbol-transit-bus',
554
- type: 'symbol',
555
- 'source-layer': 'public_transport',
556
- filter: ['==', 'kind', 'bus_stop'],
557
- layout: { 'text-field': nameField },
558
- },
559
- {
560
- id: 'symbol-transit-tram',
561
- type: 'symbol',
562
- 'source-layer': 'public_transport',
563
- filter: ['==', 'kind', 'tram_stop'],
564
- layout: { 'text-field': nameField },
565
- },
566
- {
567
- id: 'symbol-transit-subway',
568
- type: 'symbol',
569
- 'source-layer': 'public_transport',
570
- filter: ['all', ['in', 'kind', 'station', 'halt'], ['==', 'station', 'subway']],
571
- layout: { 'text-field': nameField },
572
- },
573
- {
574
- id: 'symbol-transit-lightrail',
575
- type: 'symbol',
576
- 'source-layer': 'public_transport',
577
- filter: ['all', ['in', 'kind', 'station', 'halt'], ['==', 'station', 'light_rail']],
578
- layout: { 'text-field': nameField },
579
- },
580
- {
581
- id: 'symbol-transit-station',
582
- type: 'symbol',
583
- 'source-layer': 'public_transport',
584
- filter: ['all', ['in', 'kind', 'station', 'halt'], ['!in', 'station', 'light_rail', 'subway']],
585
- layout: { 'text-field': nameField },
586
- },
587
- {
588
- id: 'symbol-transit-airfield',
589
- type: 'symbol',
590
- 'source-layer': 'public_transport',
591
- filter: ['all', ['==', 'kind', 'aerodrome'], ['!has', 'iata']],
592
- layout: { 'text-field': nameField },
593
- },
594
- {
595
- id: 'symbol-transit-airport',
596
- type: 'symbol',
597
- 'source-layer': 'public_transport',
598
- filter: ['all', ['==', 'kind', 'aerodrome'], ['has', 'iata']],
599
- layout: { 'text-field': nameField },
600
- },
601
- ];
602
- }
@@ -1,44 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import type { ShortbreadProperty } from './properties.js';
3
- import propertyLookup from './properties.js';
4
-
5
- describe('propertyLookup', () => {
6
- it('should be a Map', () => {
7
- expect(propertyLookup).toBeInstanceOf(Map);
8
- });
9
-
10
- it('should contain keys for each type and property', () => {
11
- const expectedTypes = ['background', 'fill', 'line', 'symbol'];
12
-
13
- expectedTypes.forEach((type) => {
14
- propertyLookup.forEach((value, key) => {
15
- if (key.startsWith(type)) {
16
- expect(key).toMatch(new RegExp(`^${type}/`));
17
- }
18
- });
19
- });
20
- });
21
-
22
- it('should contain the correct properties for each type', () => {
23
- const expectedProps = ['filter', 'maxzoom', 'minzoom', 'visibility'];
24
-
25
- expectedProps.forEach((prop) => {
26
- propertyLookup.forEach((value, key) => {
27
- if (key.endsWith(prop)) {
28
- expect(value.some((p: ShortbreadProperty) => p.key === prop)).toBeTruthy();
29
- }
30
- });
31
- });
32
- });
33
-
34
- it('should store properties with the correct structure', () => {
35
- propertyLookup.forEach((properties) => {
36
- properties.forEach((prop: ShortbreadProperty) => {
37
- expect(prop).toHaveProperty('key');
38
- expect(prop).toHaveProperty('parent');
39
- expect(prop).toHaveProperty('valueType');
40
- expect(['layer', 'layout', 'paint']).toContain(prop.parent);
41
- });
42
- });
43
- });
44
- });