@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,521 +0,0 @@
1
- export function getShortbreadLayers(option) {
2
- const { language } = option;
3
- const nameField = language ? '{name_' + language + '}' : '{name}';
4
- return [
5
- // background
6
- { id: 'background', type: 'background' },
7
- // ocean
8
- { id: 'water-ocean', type: 'fill', 'source-layer': 'ocean' },
9
- // land
10
- {
11
- id: 'land-glacier',
12
- type: 'fill', 'source-layer': 'water_polygons',
13
- filter: ['all', ['==', 'kind', 'glacier']],
14
- },
15
- ...[
16
- { id: 'commercial', kinds: ['commercial', 'retail'] },
17
- { id: 'industrial', kinds: ['industrial', 'quarry', 'railway'] },
18
- { id: 'residential', kinds: ['garages', 'residential'] },
19
- { id: 'agriculture', kinds: ['brownfield', 'farmland', 'farmyard', 'greenfield', 'greenhouse_horticulture', 'orchard', 'plant_nursery', 'vineyard'] },
20
- { id: 'waste', kinds: ['landfill'] },
21
- { id: 'park', kinds: ['park', 'village_green', 'recreation_ground'] },
22
- { id: 'garden', kinds: ['allotments', 'garden'] },
23
- { id: 'burial', kinds: ['cemetery', 'grave_yard'] },
24
- { id: 'leisure', kinds: ['miniature_golf', 'playground', 'golf_course'] },
25
- { id: 'rock', kinds: ['bare_rock', 'scree', 'shingle'] },
26
- { id: 'forest', kinds: ['forest'] },
27
- { id: 'grass', kinds: ['grass', 'grassland', 'meadow', 'wet_meadow'] },
28
- { id: 'vegetation', kinds: ['heath', 'scrub'] },
29
- { id: 'sand', kinds: ['beach', 'sand'] },
30
- { id: 'wetland', kinds: ['bog', 'marsh', 'string_bog', 'swamp'] },
31
- ].map(({ id, kinds }) => ({
32
- id: 'land-' + id,
33
- type: 'fill',
34
- 'source-layer': 'land',
35
- filter: ['all',
36
- ['in', 'kind', ...kinds],
37
- ],
38
- })),
39
- // water-lines
40
- ...['river', 'canal', 'stream', 'ditch'].map((t) => ({
41
- id: 'water-' + t,
42
- type: 'line',
43
- 'source-layer': 'water_lines',
44
- filter: ['all',
45
- ['in', 'kind', t],
46
- ['!=', 'tunnel', true],
47
- ['!=', 'bridge', true],
48
- ],
49
- })),
50
- // water polygons
51
- {
52
- id: 'water-area',
53
- type: 'fill', 'source-layer': 'water_polygons',
54
- filter: ['==', 'kind', 'water'],
55
- },
56
- {
57
- id: 'water-area-river',
58
- type: 'fill', 'source-layer': 'water_polygons',
59
- filter: ['==', 'kind', 'river'],
60
- },
61
- {
62
- id: 'water-area-small',
63
- type: 'fill', 'source-layer': 'water_polygons',
64
- filter: ['in', 'kind', 'reservoir', 'basin', 'dock'],
65
- },
66
- // dam
67
- { id: 'water-dam-area', type: 'fill', 'source-layer': 'dam_polygons', filter: ['==', 'kind', 'dam'] },
68
- { id: 'water-dam', type: 'line', 'source-layer': 'dam_lines', filter: ['==', 'kind', 'dam'] },
69
- // pier
70
- { id: 'water-pier-area', type: 'fill', 'source-layer': 'pier_polygons', filter: ['in', 'kind', 'pier', 'breakwater', 'groyne'] },
71
- { id: 'water-pier', type: 'line', 'source-layer': 'pier_lines', filter: ['in', 'kind', 'pier', 'breakwater', 'groyne'] },
72
- // site
73
- ...['danger_area', 'sports_center', 'university', 'college', 'school', 'hospital', 'prison', 'parking', 'bicycle_parking', 'construction'].map((t) => ({
74
- id: 'site-' + t.replace(/_/g, ''),
75
- type: 'fill',
76
- 'source-layer': 'sites',
77
- filter: ['in', 'kind', t],
78
- })),
79
- // airport
80
- {
81
- id: 'airport-area',
82
- type: 'fill', 'source-layer': 'street_polygons', filter: ['in', 'kind', 'runway', 'taxiway'],
83
- },
84
- {
85
- id: 'airport-taxiway:outline',
86
- type: 'line', 'source-layer': 'streets', filter: ['==', 'kind', 'taxiway'],
87
- },
88
- {
89
- id: 'airport-runway:outline',
90
- type: 'line', 'source-layer': 'streets', filter: ['==', 'kind', 'runway'],
91
- },
92
- {
93
- id: 'airport-taxiway',
94
- type: 'line', 'source-layer': 'streets', filter: ['==', 'kind', 'taxiway'],
95
- },
96
- {
97
- id: 'airport-runway',
98
- type: 'line', 'source-layer': 'streets', filter: ['==', 'kind', 'runway'],
99
- },
100
- // building
101
- {
102
- id: 'building:outline',
103
- type: 'fill', 'source-layer': 'buildings',
104
- },
105
- {
106
- id: 'building',
107
- type: 'fill', 'source-layer': 'buildings',
108
- },
109
- // tunnel-, street-, bridges-bridge
110
- ...['tunnel', 'street', 'bridge'].flatMap((c) => {
111
- let filter;
112
- let prefix;
113
- let suffixes = [];
114
- const results = [];
115
- switch (c) {
116
- case 'tunnel':
117
- filter = [['==', 'tunnel', true]];
118
- prefix = 'tunnel-';
119
- suffixes = [':outline', ''];
120
- break;
121
- case 'street':
122
- filter = [['!=', 'bridge', true], ['!=', 'tunnel', true]];
123
- prefix = '';
124
- suffixes = [':outline', ''];
125
- break;
126
- case 'bridge':
127
- filter = [['==', 'bridge', true]];
128
- prefix = 'bridge-';
129
- suffixes = [':bridge', ':outline', ''];
130
- break;
131
- }
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')
141
- results.push({
142
- id: 'bridge',
143
- type: 'fill',
144
- 'source-layer': 'bridges',
145
- });
146
- suffixes.forEach(suffix => {
147
- // pedestrian zone — no outline
148
- if (suffix === ':outline')
149
- results.push({
150
- id: prefix + 'street-pedestrian-zone',
151
- type: 'fill',
152
- 'source-layer': 'street_polygons',
153
- filter: ['all',
154
- ...filter,
155
- ['==', 'kind', 'pedestrian'],
156
- ],
157
- });
158
- // non-car streets
159
- ['footway', 'steps', 'path', 'cycleway'].forEach(t => {
160
- results.push({
161
- id: prefix + 'way-' + t.replace(/_/g, '') + suffix,
162
- type: 'line',
163
- 'source-layer': 'streets',
164
- filter: ['all',
165
- ...filter,
166
- ['in', 'kind', t],
167
- ],
168
- });
169
- });
170
- // no links
171
- const noDrivewayExpression = ['!=', 'service', 'driveway'];
172
- ['track', 'pedestrian', 'service', 'living_street', 'residential', 'unclassified'].forEach(t => {
173
- results.push({
174
- id: prefix + 'street-' + t.replace(/_/g, '') + suffix,
175
- type: 'line',
176
- 'source-layer': 'streets',
177
- filter: ['all',
178
- ['==', 'kind', t],
179
- ...filter,
180
- ...(t === 'service') ? [noDrivewayExpression] : [], // ignore driveways
181
- ],
182
- });
183
- });
184
- // no links, bicycle=designated
185
- if (suffix === '')
186
- ['track', 'pedestrian', 'service', 'living_street', 'residential', 'unclassified'].forEach(t => {
187
- results.push({
188
- id: prefix + 'street-' + t.replace(/_/g, '') + '-bicycle',
189
- type: 'line',
190
- 'source-layer': 'streets',
191
- filter: ['all',
192
- ['==', 'kind', t],
193
- ['==', 'bicycle', 'designated'],
194
- ...filter,
195
- ...(t === 'service') ? [noDrivewayExpression] : [], // ignore driveways
196
- ],
197
- });
198
- });
199
- // links
200
- ['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach(t => {
201
- results.push({
202
- id: prefix + 'street-' + t.replace(/_/g, '') + '-link' + suffix,
203
- type: 'line',
204
- 'source-layer': 'streets',
205
- filter: ['all',
206
- ...filter,
207
- ['in', 'kind', t],
208
- ['==', 'link', true],
209
- ],
210
- });
211
- });
212
- // main
213
- ['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach(t => {
214
- results.push({
215
- id: prefix + 'street-' + t.replace(/_/g, '') + suffix,
216
- type: 'line',
217
- 'source-layer': 'streets',
218
- filter: ['all',
219
- ...filter,
220
- ['in', 'kind', t],
221
- ['!=', 'link', true],
222
- ],
223
- });
224
- });
225
- });
226
- // separate outline for trains
227
- [':outline', ''].forEach(suffix => {
228
- // transport
229
- ['rail', 'light_rail', 'subway', 'narrow_gauge', 'tram', 'funicular', 'monorail', 'bus_guideway', 'busway'].reverse().forEach((t) => {
230
- results.push({
231
- id: prefix + 'transport-' + t.replace(/_/g, '') + suffix,
232
- type: 'line',
233
- 'source-layer': 'streets',
234
- filter: ['all',
235
- ['in', 'kind', t],
236
- ['!has', 'service'],
237
- ...filter,
238
- ],
239
- });
240
- });
241
- if (c === 'street') {
242
- // aerialway, no bridges, above street evel
243
- ['cable_car', 'gondola', 'goods', 'chair_lift', 'drag_lift', 't-bar', 'j-bar', 'platter', 'rope-tow'].reverse().forEach((t) => {
244
- results.push({
245
- id: 'aerialway-' + t.replace(/[_-]+/g, '') + suffix,
246
- type: 'line',
247
- 'source-layer': 'aerialways',
248
- filter: ['all',
249
- ...filter,
250
- ['in', 'kind', t],
251
- ],
252
- });
253
- });
254
- // ferry — only on street level
255
- results.push({
256
- id: 'transport-ferry' + suffix,
257
- type: 'line',
258
- 'source-layer': 'ferries',
259
- });
260
- }
261
- });
262
- return results;
263
- }),
264
- // poi, one layer per type
265
- ...['amenity', 'leisure', 'tourism', 'shop', 'man_made', 'historic', 'emergency', 'highway', 'office'].map((key) => ({
266
- id: 'poi-' + key,
267
- type: 'symbol',
268
- 'source-layer': 'pois',
269
- filter: ['to-boolean', ['get', key]],
270
- })),
271
- // boundary
272
- ...[':outline', ''].flatMap((suffix) => [
273
- {
274
- id: 'boundary-country' + suffix,
275
- type: 'line',
276
- 'source-layer': 'boundaries',
277
- filter: ['all',
278
- ['==', 'admin_level', 2],
279
- ['!=', 'maritime', true],
280
- ['!=', 'disputed', true],
281
- ['!=', 'coastline', true],
282
- ],
283
- },
284
- {
285
- id: 'boundary-country-disputed' + suffix,
286
- type: 'line',
287
- 'source-layer': 'boundaries',
288
- filter: ['all',
289
- ['==', 'admin_level', 2],
290
- ['==', 'disputed', true],
291
- ['!=', 'maritime', true],
292
- ['!=', 'coastline', true],
293
- ],
294
- },
295
- {
296
- id: 'boundary-country-maritime' + suffix,
297
- type: 'line',
298
- 'source-layer': 'boundaries',
299
- filter: ['all',
300
- ['==', 'admin_level', 2],
301
- ['==', 'maritime', true],
302
- ['!=', 'disputed', true],
303
- ['!=', 'coastline', true],
304
- ],
305
- },
306
- {
307
- id: 'boundary-state' + suffix,
308
- type: 'line',
309
- 'source-layer': 'boundaries',
310
- filter: ['all',
311
- ['==', 'admin_level', 4],
312
- ['!=', 'maritime', true],
313
- ['!=', 'disputed', true],
314
- ['!=', 'coastline', true],
315
- ],
316
- },
317
- ]),
318
- // label-address
319
- {
320
- id: 'label-address-housenumber',
321
- type: 'symbol',
322
- 'source-layer': 'addresses',
323
- filter: ['has', 'housenumber'],
324
- layout: { 'text-field': '{housenumber}' },
325
- },
326
- // label-motorway
327
- {
328
- id: 'label-motorway-exit',
329
- type: 'symbol',
330
- 'source-layer': 'street_labels_points', // docs say `streets_labels_points`, but layer is actually called `street_labels_points`
331
- filter: ['==', 'kind', 'motorway_junction'],
332
- layout: { 'text-field': '{ref}' },
333
- // FIXME shield
334
- },
335
- {
336
- id: 'label-motorway-shield',
337
- type: 'symbol',
338
- 'source-layer': 'street_labels',
339
- filter: ['==', 'kind', 'motorway'],
340
- layout: { 'text-field': '{ref}' },
341
- // FIXME shield
342
- },
343
- // label-street
344
- ...['pedestrian', 'living_street', 'residential', 'unclassified', 'tertiary', 'secondary', 'primary', 'trunk'].map((t) => ({
345
- id: 'label-street-' + t.replace(/_/g, ''),
346
- type: 'symbol',
347
- 'source-layer': 'street_labels',
348
- filter: ['==', 'kind', t],
349
- layout: { 'text-field': nameField },
350
- })),
351
- // label-place of small places
352
- ...[/*'locality', 'island', 'farm', 'dwelling',*/ 'neighbourhood', 'quarter', 'suburb', 'hamlet', 'village', 'town'].map((id) => ({
353
- id: 'label-place-' + id.replace(/_/g, ''),
354
- type: 'symbol',
355
- 'source-layer': 'place_labels',
356
- filter: ['==', 'kind', id],
357
- layout: { 'text-field': nameField },
358
- })),
359
- // label-boundary
360
- {
361
- id: 'label-boundary-state',
362
- type: 'symbol',
363
- 'source-layer': 'boundary_labels',
364
- filter: ['in', 'admin_level', 4, '4'],
365
- layout: { 'text-field': nameField },
366
- },
367
- // label-place-* of large places
368
- ...['city', 'state_capital', 'capital'].map((id) => ({
369
- id: 'label-place-' + id.replace(/_/g, ''),
370
- type: 'symbol',
371
- 'source-layer': 'place_labels',
372
- filter: ['==', 'kind', id],
373
- layout: { 'text-field': nameField },
374
- })),
375
- {
376
- id: 'label-boundary-country-small',
377
- type: 'symbol',
378
- 'source-layer': 'boundary_labels',
379
- filter: ['all',
380
- ['in', 'admin_level', 2, '2'],
381
- ['<=', 'way_area', 10000000],
382
- ],
383
- layout: { 'text-field': nameField },
384
- },
385
- {
386
- id: 'label-boundary-country-medium',
387
- type: 'symbol',
388
- 'source-layer': 'boundary_labels',
389
- filter: ['all',
390
- ['in', 'admin_level', 2, '2'],
391
- ['<', 'way_area', 90000000],
392
- ['>', 'way_area', 10000000],
393
- ],
394
- layout: { 'text-field': nameField },
395
- },
396
- {
397
- id: 'label-boundary-country-large',
398
- type: 'symbol',
399
- 'source-layer': 'boundary_labels',
400
- filter: ['all',
401
- ['in', 'admin_level', 2, '2'],
402
- ['>=', 'way_area', 90000000],
403
- ],
404
- layout: { 'text-field': nameField },
405
- },
406
- // marking
407
- {
408
- id: 'marking-oneway', // streets → oneway
409
- type: 'symbol',
410
- 'source-layer': 'streets',
411
- filter: ['all',
412
- ['==', 'oneway', true],
413
- ['in', 'kind', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'living_street'],
414
- ],
415
- layout: {
416
- 'symbol-placement': 'line',
417
- 'symbol-spacing': 175,
418
- 'icon-rotate': 90,
419
- 'icon-rotation-alignment': 'map',
420
- 'icon-padding': 5,
421
- 'symbol-avoid-edges': true,
422
- },
423
- },
424
- {
425
- id: 'marking-oneway-reverse', // oneway_reverse
426
- type: 'symbol',
427
- 'source-layer': 'streets',
428
- filter: ['all',
429
- ['==', 'oneway_reverse', true],
430
- ['in', 'kind', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'living_street'],
431
- ],
432
- layout: {
433
- 'symbol-placement': 'line',
434
- 'symbol-spacing': 75,
435
- 'icon-rotate': -90,
436
- 'icon-rotation-alignment': 'map',
437
- 'icon-padding': 5,
438
- 'symbol-avoid-edges': true,
439
- },
440
- },
441
- {
442
- id: 'marking-bicycle', // bicycle=designated or kind=cycleway
443
- type: 'symbol',
444
- 'source-layer': 'streets',
445
- filter: ['all',
446
- ['==', 'bicycle', 'designated'],
447
- ['==', 'kind', 'cycleway'],
448
- ],
449
- layout: {
450
- 'symbol-placement': 'line',
451
- 'symbol-spacing': 50,
452
- },
453
- },
454
- // symbol
455
- {
456
- id: 'symbol-transit-bus',
457
- type: 'symbol',
458
- 'source-layer': 'public_transport',
459
- filter: ['==', 'kind', 'bus_stop'],
460
- layout: { 'text-field': nameField },
461
- },
462
- {
463
- id: 'symbol-transit-tram',
464
- type: 'symbol',
465
- 'source-layer': 'public_transport',
466
- filter: ['==', 'kind', 'tram_stop'],
467
- layout: { 'text-field': nameField },
468
- },
469
- {
470
- id: 'symbol-transit-subway',
471
- type: 'symbol',
472
- 'source-layer': 'public_transport',
473
- filter: ['all',
474
- ['in', 'kind', 'station', 'halt'],
475
- ['==', 'station', 'subway'],
476
- ],
477
- layout: { 'text-field': nameField },
478
- },
479
- {
480
- id: 'symbol-transit-lightrail',
481
- type: 'symbol',
482
- 'source-layer': 'public_transport',
483
- filter: ['all',
484
- ['in', 'kind', 'station', 'halt'],
485
- ['==', 'station', 'light_rail'],
486
- ],
487
- layout: { 'text-field': nameField },
488
- },
489
- {
490
- id: 'symbol-transit-station',
491
- type: 'symbol',
492
- 'source-layer': 'public_transport',
493
- filter: ['all',
494
- ['in', 'kind', 'station', 'halt'],
495
- ['!in', 'station', 'light_rail', 'subway'],
496
- ],
497
- layout: { 'text-field': nameField },
498
- },
499
- {
500
- id: 'symbol-transit-airfield',
501
- type: 'symbol',
502
- 'source-layer': 'public_transport',
503
- filter: ['all',
504
- ['==', 'kind', 'aerodrome'],
505
- ['!has', 'iata'],
506
- ],
507
- layout: { 'text-field': nameField },
508
- },
509
- {
510
- id: 'symbol-transit-airport',
511
- type: 'symbol',
512
- 'source-layer': 'public_transport',
513
- filter: ['all',
514
- ['==', 'kind', 'aerodrome'],
515
- ['has', 'iata'],
516
- ],
517
- layout: { 'text-field': nameField },
518
- },
519
- ];
520
- }
521
- //# sourceMappingURL=layers.js.map
@@ -1,7 +0,0 @@
1
- export interface ShortbreadProperty {
2
- readonly key: string;
3
- readonly parent: 'layer' | 'layout' | 'paint';
4
- readonly valueType: 'array' | 'boolean' | 'color' | 'enum' | 'filter' | 'fonts' | 'formatted' | 'number' | 'padding' | 'resolvedImage' | 'variableAnchorOffsetCollection';
5
- }
6
- declare const propertyLookup: Map<string, ShortbreadProperty[]>;
7
- export default propertyLookup;
@@ -1,125 +0,0 @@
1
- const propertyLookup = new Map();
2
- const propertyDefs = [
3
- { parent: 'layer', types: 'background,fill,line,symbol', key: 'filter', valueType: 'filter' },
4
- { parent: 'layer', types: 'background,fill,line,symbol', key: 'maxzoom', valueType: 'number' },
5
- { parent: 'layer', types: 'background,fill,line,symbol', key: 'minzoom', valueType: 'number' },
6
- { parent: 'layout', types: 'background,fill,line,symbol', key: 'visibility', valueType: 'enum' },
7
- { parent: 'layout', types: 'fill', key: 'fill-sort-key', valueType: 'number' },
8
- { parent: 'layout', types: 'line', key: 'line-cap', valueType: 'enum' },
9
- { parent: 'layout', types: 'line', key: 'line-join', valueType: 'enum' },
10
- { parent: 'layout', types: 'line', key: 'line-miter-limit', valueType: 'number' },
11
- { parent: 'layout', types: 'line', key: 'line-round-limit', valueType: 'number' },
12
- { parent: 'layout', types: 'line', key: 'line-sort-key', valueType: 'number' },
13
- { parent: 'layout', types: 'symbol', key: 'icon-allow-overlap', valueType: 'boolean' },
14
- { parent: 'layout', types: 'symbol', key: 'icon-anchor', valueType: 'enum' },
15
- { parent: 'layout', types: 'symbol', key: 'icon-ignore-placement', valueType: 'boolean' },
16
- { parent: 'layout', types: 'symbol', key: 'icon-image', short: 'image', valueType: 'resolvedImage' },
17
- { parent: 'layout', types: 'symbol', key: 'icon-keep-upright', valueType: 'boolean' },
18
- { parent: 'layout', types: 'symbol', key: 'icon-offset', valueType: 'array' },
19
- { parent: 'layout', types: 'symbol', key: 'icon-optional', valueType: 'boolean' },
20
- { parent: 'layout', types: 'symbol', key: 'icon-overlap', valueType: 'enum' },
21
- { parent: 'layout', types: 'symbol', key: 'icon-padding', valueType: 'padding' },
22
- { parent: 'layout', types: 'symbol', key: 'icon-pitch-alignment', valueType: 'enum' },
23
- { parent: 'layout', types: 'symbol', key: 'icon-rotate', valueType: 'number' },
24
- { parent: 'layout', types: 'symbol', key: 'icon-rotation-alignment', valueType: 'enum' },
25
- { parent: 'layout', types: 'symbol', key: 'icon-size', valueType: 'number' },
26
- { parent: 'layout', types: 'symbol', key: 'icon-text-fit-padding', valueType: 'array' },
27
- { parent: 'layout', types: 'symbol', key: 'icon-text-fit', valueType: 'enum' },
28
- { parent: 'layout', types: 'symbol', key: 'symbol-avoid-edges', valueType: 'boolean' },
29
- { parent: 'layout', types: 'symbol', key: 'symbol-placement', valueType: 'enum' },
30
- { parent: 'layout', types: 'symbol', key: 'symbol-sort-key', valueType: 'number' },
31
- { parent: 'layout', types: 'symbol', key: 'symbol-spacing', valueType: 'number' },
32
- { parent: 'layout', types: 'symbol', key: 'symbol-z-order', valueType: 'enum' },
33
- { parent: 'layout', types: 'symbol', key: 'text-allow-overlap', valueType: 'boolean' },
34
- { parent: 'layout', types: 'symbol', key: 'text-anchor', valueType: 'enum' },
35
- { parent: 'layout', types: 'symbol', key: 'text-field', short: 'text', valueType: 'formatted' },
36
- { parent: 'layout', types: 'symbol', key: 'text-font', short: 'font', valueType: 'fonts' },
37
- { parent: 'layout', types: 'symbol', key: 'text-ignore-placement', valueType: 'boolean' },
38
- { parent: 'layout', types: 'symbol', key: 'text-justify', valueType: 'enum' },
39
- { parent: 'layout', types: 'symbol', key: 'text-keep-upright', valueType: 'boolean' },
40
- { parent: 'layout', types: 'symbol', key: 'text-letter-spacing', valueType: 'number' },
41
- { parent: 'layout', types: 'symbol', key: 'text-line-height', valueType: 'number' },
42
- { parent: 'layout', types: 'symbol', key: 'text-max-angle', valueType: 'number' },
43
- { parent: 'layout', types: 'symbol', key: 'text-max-width', valueType: 'number' },
44
- { parent: 'layout', types: 'symbol', key: 'text-offset', valueType: 'array' },
45
- { parent: 'layout', types: 'symbol', key: 'text-optional', valueType: 'boolean' },
46
- { parent: 'layout', types: 'symbol', key: 'text-overlap', valueType: 'enum' },
47
- { parent: 'layout', types: 'symbol', key: 'text-padding', valueType: 'number' },
48
- { parent: 'layout', types: 'symbol', key: 'text-pitch-alignment', valueType: 'enum' },
49
- { parent: 'layout', types: 'symbol', key: 'text-radial-offset', valueType: 'number' },
50
- { parent: 'layout', types: 'symbol', key: 'text-rotate', valueType: 'number' },
51
- { parent: 'layout', types: 'symbol', key: 'text-rotation-alignment', valueType: 'enum' },
52
- { parent: 'layout', types: 'symbol', key: 'text-size', short: 'size', valueType: 'number' },
53
- { parent: 'layout', types: 'symbol', key: 'text-transform', valueType: 'enum' },
54
- { parent: 'layout', types: 'symbol', key: 'text-variable-anchor-offset', valueType: 'variableAnchorOffsetCollection' },
55
- { parent: 'layout', types: 'symbol', key: 'text-variable-anchor', valueType: 'array' },
56
- { parent: 'layout', types: 'symbol', key: 'text-writing-mode', valueType: 'array' },
57
- { parent: 'paint', types: 'background', key: 'background-color', short: 'color', valueType: 'color' },
58
- { parent: 'paint', types: 'background', key: 'background-opacity', short: 'opacity', valueType: 'number' },
59
- { parent: 'paint', types: 'background', key: 'background-pattern', short: 'image', valueType: 'resolvedImage' },
60
- { parent: 'paint', types: 'fill', key: 'fill-antialias', valueType: 'boolean' },
61
- { parent: 'paint', types: 'fill', key: 'fill-color', short: 'color', valueType: 'color' },
62
- { parent: 'paint', types: 'fill', key: 'fill-extrusion-base', valueType: 'number' },
63
- { parent: 'paint', types: 'fill', key: 'fill-extrusion-color', valueType: 'color' },
64
- { parent: 'paint', types: 'fill', key: 'fill-extrusion-height', valueType: 'number' },
65
- { parent: 'paint', types: 'fill', key: 'fill-extrusion-opacity', valueType: 'number' },
66
- { parent: 'paint', types: 'fill', key: 'fill-extrusion-pattern', valueType: 'resolvedImage' },
67
- { parent: 'paint', types: 'fill', key: 'fill-extrusion-translate-anchor', valueType: 'enum' },
68
- { parent: 'paint', types: 'fill', key: 'fill-extrusion-translate', valueType: 'array' },
69
- { parent: 'paint', types: 'fill', key: 'fill-extrusion-vertical-gradient', valueType: 'boolean' },
70
- { parent: 'paint', types: 'fill', key: 'fill-opacity', short: 'opacity', valueType: 'number' },
71
- { parent: 'paint', types: 'fill', key: 'fill-outline-color', valueType: 'color' },
72
- { parent: 'paint', types: 'fill', key: 'fill-pattern', short: 'image', valueType: 'resolvedImage' },
73
- { parent: 'paint', types: 'fill', key: 'fill-translate-anchor', valueType: 'enum' },
74
- { parent: 'paint', types: 'fill', key: 'fill-translate', valueType: 'array' },
75
- { parent: 'paint', types: 'line', key: 'line-blur', valueType: 'number' },
76
- { parent: 'paint', types: 'line', key: 'line-color', short: 'color', valueType: 'color' },
77
- { parent: 'paint', types: 'line', key: 'line-dasharray', valueType: 'array' },
78
- { parent: 'paint', types: 'line', key: 'line-gap-width', valueType: 'number' },
79
- { parent: 'paint', types: 'line', key: 'line-gradient', valueType: 'color' },
80
- { parent: 'paint', types: 'line', key: 'line-offset', valueType: 'number' },
81
- { parent: 'paint', types: 'line', key: 'line-opacity', short: 'opacity', valueType: 'number' },
82
- { parent: 'paint', types: 'line', key: 'line-pattern', short: 'image', valueType: 'resolvedImage' },
83
- { parent: 'paint', types: 'line', key: 'line-translate-anchor', valueType: 'enum' },
84
- { parent: 'paint', types: 'line', key: 'line-translate', valueType: 'array' },
85
- { parent: 'paint', types: 'line', key: 'line-width', short: 'size', valueType: 'number' },
86
- { parent: 'paint', types: 'symbol', key: 'icon-color', short: 'color', valueType: 'color' },
87
- { parent: 'paint', types: 'symbol', key: 'icon-halo-blur', valueType: 'number' },
88
- { parent: 'paint', types: 'symbol', key: 'icon-halo-color', valueType: 'color' },
89
- { parent: 'paint', types: 'symbol', key: 'icon-halo-width', valueType: 'number' },
90
- { parent: 'paint', types: 'symbol', key: 'icon-opacity', short: 'opacity', valueType: 'number' },
91
- { parent: 'paint', types: 'symbol', key: 'icon-translate-anchor', valueType: 'enum' },
92
- { parent: 'paint', types: 'symbol', key: 'icon-translate', valueType: 'array' },
93
- { parent: 'paint', types: 'symbol', key: 'text-color', short: 'color', valueType: 'color' },
94
- { parent: 'paint', types: 'symbol', key: 'text-halo-blur', valueType: 'number' },
95
- { parent: 'paint', types: 'symbol', key: 'text-halo-color', valueType: 'color' },
96
- { parent: 'paint', types: 'symbol', key: 'text-halo-width', valueType: 'number' },
97
- { parent: 'paint', types: 'symbol', key: 'text-opacity', short: 'opacity', valueType: 'number' },
98
- { parent: 'paint', types: 'symbol', key: 'text-translate-anchor', valueType: 'enum' },
99
- { parent: 'paint', types: 'symbol', key: 'text-translate', valueType: 'array' },
100
- ];
101
- propertyDefs.forEach((propertyDef) => {
102
- const types = propertyDef.types;
103
- types.split(',').forEach((type) => {
104
- function add(propertyKey) {
105
- const key = type + '/' + propertyKey;
106
- const property = {
107
- key: propertyDef.key,
108
- parent: propertyDef.parent,
109
- valueType: propertyDef.valueType,
110
- };
111
- const propertyList = propertyLookup.get(key);
112
- if (propertyList) {
113
- propertyList.push(property);
114
- }
115
- else {
116
- propertyLookup.set(key, [property]);
117
- }
118
- }
119
- add(propertyDef.key);
120
- if (propertyDef.short != null)
121
- add(propertyDef.short);
122
- });
123
- });
124
- export default propertyLookup;
125
- //# sourceMappingURL=properties.js.map