@versatiles/style 5.8.2 → 5.8.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 (54) hide show
  1. package/README.md +14 -14
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +570 -333
  4. package/dist/index.js.map +1 -1
  5. package/package.json +13 -8
  6. package/src/color/abstract.ts +1 -1
  7. package/src/color/hsl.test.ts +10 -16
  8. package/src/color/hsl.ts +11 -15
  9. package/src/color/hsv.test.ts +4 -10
  10. package/src/color/hsv.ts +38 -22
  11. package/src/color/index.test.ts +2 -4
  12. package/src/color/index.ts +1 -1
  13. package/src/color/random.test.ts +1 -1
  14. package/src/color/random.ts +127 -25
  15. package/src/color/rgb.test.ts +55 -36
  16. package/src/color/rgb.ts +35 -48
  17. package/src/color/utils.test.ts +4 -6
  18. package/src/color/utils.ts +1 -3
  19. package/src/guess_style/guess_style.test.ts +49 -43
  20. package/src/guess_style/guess_style.ts +64 -21
  21. package/src/guess_style/index.ts +0 -1
  22. package/src/index.test.ts +34 -7
  23. package/src/index.ts +29 -19
  24. package/src/lib/utils.test.ts +2 -2
  25. package/src/lib/utils.ts +2 -1
  26. package/src/shortbread/index.ts +0 -1
  27. package/src/shortbread/layers.test.ts +19 -3
  28. package/src/shortbread/layers.ts +204 -194
  29. package/src/shortbread/properties.test.ts +3 -4
  30. package/src/shortbread/properties.ts +18 -4
  31. package/src/shortbread/template.test.ts +7 -2
  32. package/src/shortbread/template.ts +7 -14
  33. package/src/style_builder/decorator.test.ts +4 -4
  34. package/src/style_builder/decorator.ts +29 -21
  35. package/src/style_builder/recolor.test.ts +6 -31
  36. package/src/style_builder/recolor.ts +20 -20
  37. package/src/style_builder/style_builder.test.ts +50 -13
  38. package/src/style_builder/style_builder.ts +29 -31
  39. package/src/style_builder/types.ts +85 -2
  40. package/src/styles/LICENSE.md +15 -15
  41. package/src/styles/colorful.test.ts +91 -0
  42. package/src/styles/colorful.ts +229 -122
  43. package/src/styles/eclipse.ts +1 -1
  44. package/src/styles/empty.ts +1 -1
  45. package/src/styles/graybeard.ts +2 -2
  46. package/src/styles/index.ts +0 -3
  47. package/src/styles/neutrino.ts +14 -16
  48. package/src/styles/shadow.ts +2 -2
  49. package/src/types/index.ts +0 -1
  50. package/src/types/maplibre.ts +17 -3
  51. package/src/types/tilejson.test.ts +8 -5
  52. package/src/types/tilejson.ts +13 -13
  53. package/src/types/vector_layer.test.ts +4 -1
  54. package/src/types/vector_layer.ts +7 -7
package/dist/index.js CHANGED
@@ -236,7 +236,7 @@ function randomColor(options) {
236
236
  function randomWithin(range) {
237
237
  //Seeded random algorithm from http://indiegamr.com/generate-repeatable-random-numbers-in-js/
238
238
  seed = (seed * 9301 + 49297) % 233280;
239
- return Math.floor(range[0] + seed / 233280.0 * (range[1] - range[0]));
239
+ return Math.floor(range[0] + (seed / 233280.0) * (range[1] - range[0]));
240
240
  }
241
241
  }
242
242
  function inputToSeed(input) {
@@ -261,14 +261,81 @@ function initColorDictionary() {
261
261
  brightnessRange: [colorful[1], greyest[1]],
262
262
  });
263
263
  };
264
- defineColor('monochrome', null, [[0, 0], [100, 0]]);
265
- defineColor('red', [-26, 18], [[20, 100], [30, 92], [40, 89], [50, 85], [60, 78], [70, 70], [80, 60], [90, 55], [100, 50]]);
266
- defineColor('orange', [18, 46], [[20, 100], [30, 93], [40, 88], [50, 86], [60, 85], [70, 70], [100, 70]]);
267
- defineColor('yellow', [46, 62], [[25, 100], [40, 94], [50, 89], [60, 86], [70, 84], [80, 82], [90, 80], [100, 75]]);
268
- defineColor('green', [62, 178], [[30, 100], [40, 90], [50, 85], [60, 81], [70, 74], [80, 64], [90, 50], [100, 40]]);
269
- defineColor('blue', [178, 257], [[20, 100], [30, 86], [40, 80], [50, 74], [60, 60], [70, 52], [80, 44], [90, 39], [100, 35]]);
270
- defineColor('purple', [257, 282], [[20, 100], [30, 87], [40, 79], [50, 70], [60, 65], [70, 59], [80, 52], [90, 45], [100, 42]]);
271
- defineColor('pink', [282, 334], [[20, 100], [30, 90], [40, 86], [60, 84], [80, 80], [90, 75], [100, 73]]);
264
+ defineColor('monochrome', null, [
265
+ [0, 0],
266
+ [100, 0],
267
+ ]);
268
+ defineColor('red', [-26, 18], [
269
+ [20, 100],
270
+ [30, 92],
271
+ [40, 89],
272
+ [50, 85],
273
+ [60, 78],
274
+ [70, 70],
275
+ [80, 60],
276
+ [90, 55],
277
+ [100, 50],
278
+ ]);
279
+ defineColor('orange', [18, 46], [
280
+ [20, 100],
281
+ [30, 93],
282
+ [40, 88],
283
+ [50, 86],
284
+ [60, 85],
285
+ [70, 70],
286
+ [100, 70],
287
+ ]);
288
+ defineColor('yellow', [46, 62], [
289
+ [25, 100],
290
+ [40, 94],
291
+ [50, 89],
292
+ [60, 86],
293
+ [70, 84],
294
+ [80, 82],
295
+ [90, 80],
296
+ [100, 75],
297
+ ]);
298
+ defineColor('green', [62, 178], [
299
+ [30, 100],
300
+ [40, 90],
301
+ [50, 85],
302
+ [60, 81],
303
+ [70, 74],
304
+ [80, 64],
305
+ [90, 50],
306
+ [100, 40],
307
+ ]);
308
+ defineColor('blue', [178, 257], [
309
+ [20, 100],
310
+ [30, 86],
311
+ [40, 80],
312
+ [50, 74],
313
+ [60, 60],
314
+ [70, 52],
315
+ [80, 44],
316
+ [90, 39],
317
+ [100, 35],
318
+ ]);
319
+ defineColor('purple', [257, 282], [
320
+ [20, 100],
321
+ [30, 87],
322
+ [40, 79],
323
+ [50, 70],
324
+ [60, 65],
325
+ [70, 59],
326
+ [80, 52],
327
+ [90, 45],
328
+ [100, 42],
329
+ ]);
330
+ defineColor('pink', [282, 334], [
331
+ [20, 100],
332
+ [30, 90],
333
+ [40, 86],
334
+ [60, 84],
335
+ [80, 80],
336
+ [90, 75],
337
+ [100, 73],
338
+ ]);
272
339
  return dict;
273
340
  }
274
341
  function getColorInfo(hue) {
@@ -370,7 +437,9 @@ class RGB extends Color {
370
437
  return `#${r}${g}${b}`.toUpperCase();
371
438
  }
372
439
  else {
373
- const a = Math.round(this.a * 255).toString(16).padStart(2, '0');
440
+ const a = Math.round(this.a * 255)
441
+ .toString(16)
442
+ .padStart(2, '0');
374
443
  return `#${r}${g}${b}${a}`.toUpperCase();
375
444
  }
376
445
  }
@@ -408,7 +477,6 @@ class RGB extends Color {
408
477
  s = delta / (2 - max - min);
409
478
  return new HSL(h, s * 100, l * 100, this.a);
410
479
  }
411
- ;
412
480
  /**
413
481
  * Converts the RGB color to an HSV color.
414
482
  *
@@ -433,9 +501,9 @@ class RGB extends Color {
433
501
  if (r === v)
434
502
  h = bdif - gdif;
435
503
  else if (g === v)
436
- h = (1 / 3) + rdif - bdif;
504
+ h = 1 / 3 + rdif - bdif;
437
505
  else if (b === v)
438
- h = (2 / 3) + gdif - rdif;
506
+ h = 2 / 3 + gdif - rdif;
439
507
  if (h < 0)
440
508
  h += 1;
441
509
  else if (h > 1)
@@ -551,7 +619,7 @@ class RGB extends Color {
551
619
  if (value > 1)
552
620
  value = 1;
553
621
  const a = 1 - Math.abs(value);
554
- const b = (value < 0) ? 0 : 255 * value;
622
+ const b = value < 0 ? 0 : 255 * value;
555
623
  return new RGB(this.r * a + b, this.g * a + b, this.b * a + b, this.a);
556
624
  }
557
625
  /**
@@ -682,7 +750,7 @@ class HSV extends Color {
682
750
  const v = this.v / 100;
683
751
  const k = (2 - s) * v;
684
752
  const q = k < 1 ? k : 2 - k;
685
- return new HSL(this.h, q == 0 ? 0 : 100 * s * v / q, 100 * k / 2, this.a);
753
+ return new HSL(this.h, q == 0 ? 0 : (100 * s * v) / q, (100 * k) / 2, this.a);
686
754
  }
687
755
  /**
688
756
  * Returns the current HSV color.
@@ -983,19 +1051,12 @@ function getShortbreadTemplate() {
983
1051
  sources: {
984
1052
  'versatiles-shortbread': {
985
1053
  attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
986
- tiles: [
987
- 'https://tiles.versatiles.org/tiles/osm/{z}/{x}/{y}',
988
- ],
1054
+ tiles: ['https://tiles.versatiles.org/tiles/osm/{z}/{x}/{y}'],
989
1055
  type: 'vector',
990
1056
  scheme: 'xyz',
991
- bounds: [
992
- -180,
993
- -85.0511287798066,
994
- 180,
995
- 85.0511287798066,
996
- ],
1057
+ bounds: [-180, -85.0511287798066, 180, 85.0511287798066],
997
1058
  minzoom: 0,
998
- maxzoom
1059
+ maxzoom,
999
1060
  },
1000
1061
  },
1001
1062
  layers: [],
@@ -1006,7 +1067,7 @@ function getShortbreadLayers(option) {
1006
1067
  const { language } = option;
1007
1068
  let nameField = ['get', 'name'];
1008
1069
  if (language) {
1009
- nameField = ['coalesce', ['get', 'name_' + language], ['get', 'name']];
1070
+ nameField = ['case', ['to-boolean', ['get', 'name_' + language]], ['get', 'name_' + language], ['get', 'name']];
1010
1071
  }
1011
1072
  return [
1012
1073
  // background
@@ -1016,14 +1077,27 @@ function getShortbreadLayers(option) {
1016
1077
  // land
1017
1078
  {
1018
1079
  id: 'land-glacier',
1019
- type: 'fill', 'source-layer': 'water_polygons',
1080
+ type: 'fill',
1081
+ 'source-layer': 'water_polygons',
1020
1082
  filter: ['all', ['==', 'kind', 'glacier']],
1021
1083
  },
1022
1084
  ...[
1023
1085
  { id: 'commercial', kinds: ['commercial', 'retail'] },
1024
1086
  { id: 'industrial', kinds: ['industrial', 'quarry', 'railway'] },
1025
1087
  { id: 'residential', kinds: ['garages', 'residential'] },
1026
- { id: 'agriculture', kinds: ['brownfield', 'farmland', 'farmyard', 'greenfield', 'greenhouse_horticulture', 'orchard', 'plant_nursery', 'vineyard'] },
1088
+ {
1089
+ id: 'agriculture',
1090
+ kinds: [
1091
+ 'brownfield',
1092
+ 'farmland',
1093
+ 'farmyard',
1094
+ 'greenfield',
1095
+ 'greenhouse_horticulture',
1096
+ 'orchard',
1097
+ 'plant_nursery',
1098
+ 'vineyard',
1099
+ ],
1100
+ },
1027
1101
  { id: 'waste', kinds: ['landfill'] },
1028
1102
  { id: 'park', kinds: ['park', 'village_green', 'recreation_ground'] },
1029
1103
  { id: 'garden', kinds: ['allotments', 'garden'] },
@@ -1039,45 +1113,63 @@ function getShortbreadLayers(option) {
1039
1113
  id: 'land-' + id,
1040
1114
  type: 'fill',
1041
1115
  'source-layer': 'land',
1042
- filter: ['all',
1043
- ['in', 'kind', ...kinds],
1044
- ],
1116
+ filter: ['all', ['in', 'kind', ...kinds]],
1045
1117
  })),
1046
1118
  // water-lines
1047
1119
  ...['river', 'canal', 'stream', 'ditch'].map((t) => ({
1048
1120
  id: 'water-' + t,
1049
1121
  type: 'line',
1050
1122
  'source-layer': 'water_lines',
1051
- filter: ['all',
1052
- ['in', 'kind', t],
1053
- ['!=', 'tunnel', true],
1054
- ['!=', 'bridge', true],
1055
- ],
1123
+ filter: ['all', ['in', 'kind', t], ['!=', 'tunnel', true], ['!=', 'bridge', true]],
1056
1124
  })),
1057
1125
  // water polygons
1058
1126
  {
1059
1127
  id: 'water-area',
1060
- type: 'fill', 'source-layer': 'water_polygons',
1128
+ type: 'fill',
1129
+ 'source-layer': 'water_polygons',
1061
1130
  filter: ['==', 'kind', 'water'],
1062
1131
  },
1063
1132
  {
1064
1133
  id: 'water-area-river',
1065
- type: 'fill', 'source-layer': 'water_polygons',
1134
+ type: 'fill',
1135
+ 'source-layer': 'water_polygons',
1066
1136
  filter: ['==', 'kind', 'river'],
1067
1137
  },
1068
1138
  {
1069
1139
  id: 'water-area-small',
1070
- type: 'fill', 'source-layer': 'water_polygons',
1140
+ type: 'fill',
1141
+ 'source-layer': 'water_polygons',
1071
1142
  filter: ['in', 'kind', 'reservoir', 'basin', 'dock'],
1072
1143
  },
1073
1144
  // dam
1074
1145
  { id: 'water-dam-area', type: 'fill', 'source-layer': 'dam_polygons', filter: ['==', 'kind', 'dam'] },
1075
1146
  { id: 'water-dam', type: 'line', 'source-layer': 'dam_lines', filter: ['==', 'kind', 'dam'] },
1076
1147
  // pier
1077
- { id: 'water-pier-area', type: 'fill', 'source-layer': 'pier_polygons', filter: ['in', 'kind', 'pier', 'breakwater', 'groyne'] },
1078
- { id: 'water-pier', type: 'line', 'source-layer': 'pier_lines', filter: ['in', 'kind', 'pier', 'breakwater', 'groyne'] },
1148
+ {
1149
+ id: 'water-pier-area',
1150
+ type: 'fill',
1151
+ 'source-layer': 'pier_polygons',
1152
+ filter: ['in', 'kind', 'pier', 'breakwater', 'groyne'],
1153
+ },
1154
+ {
1155
+ id: 'water-pier',
1156
+ type: 'line',
1157
+ 'source-layer': 'pier_lines',
1158
+ filter: ['in', 'kind', 'pier', 'breakwater', 'groyne'],
1159
+ },
1079
1160
  // site
1080
- ...['danger_area', 'sports_center', 'university', 'college', 'school', 'hospital', 'prison', 'parking', 'bicycle_parking', 'construction'].map((t) => ({
1161
+ ...[
1162
+ 'danger_area',
1163
+ 'sports_center',
1164
+ 'university',
1165
+ 'college',
1166
+ 'school',
1167
+ 'hospital',
1168
+ 'prison',
1169
+ 'parking',
1170
+ 'bicycle_parking',
1171
+ 'construction',
1172
+ ].map((t) => ({
1081
1173
  id: 'site-' + t.replace(/_/g, ''),
1082
1174
  type: 'fill',
1083
1175
  'source-layer': 'sites',
@@ -1086,32 +1178,44 @@ function getShortbreadLayers(option) {
1086
1178
  // airport
1087
1179
  {
1088
1180
  id: 'airport-area',
1089
- type: 'fill', 'source-layer': 'street_polygons', filter: ['in', 'kind', 'runway', 'taxiway'],
1181
+ type: 'fill',
1182
+ 'source-layer': 'street_polygons',
1183
+ filter: ['in', 'kind', 'runway', 'taxiway'],
1090
1184
  },
1091
1185
  {
1092
1186
  id: 'airport-taxiway:outline',
1093
- type: 'line', 'source-layer': 'streets', filter: ['==', 'kind', 'taxiway'],
1187
+ type: 'line',
1188
+ 'source-layer': 'streets',
1189
+ filter: ['==', 'kind', 'taxiway'],
1094
1190
  },
1095
1191
  {
1096
1192
  id: 'airport-runway:outline',
1097
- type: 'line', 'source-layer': 'streets', filter: ['==', 'kind', 'runway'],
1193
+ type: 'line',
1194
+ 'source-layer': 'streets',
1195
+ filter: ['==', 'kind', 'runway'],
1098
1196
  },
1099
1197
  {
1100
1198
  id: 'airport-taxiway',
1101
- type: 'line', 'source-layer': 'streets', filter: ['==', 'kind', 'taxiway'],
1199
+ type: 'line',
1200
+ 'source-layer': 'streets',
1201
+ filter: ['==', 'kind', 'taxiway'],
1102
1202
  },
1103
1203
  {
1104
1204
  id: 'airport-runway',
1105
- type: 'line', 'source-layer': 'streets', filter: ['==', 'kind', 'runway'],
1205
+ type: 'line',
1206
+ 'source-layer': 'streets',
1207
+ filter: ['==', 'kind', 'runway'],
1106
1208
  },
1107
1209
  // building
1108
1210
  {
1109
1211
  id: 'building:outline',
1110
- type: 'fill', 'source-layer': 'buildings',
1212
+ type: 'fill',
1213
+ 'source-layer': 'buildings',
1111
1214
  },
1112
1215
  {
1113
1216
  id: 'building',
1114
- type: 'fill', 'source-layer': 'buildings',
1217
+ type: 'fill',
1218
+ 'source-layer': 'buildings',
1115
1219
  },
1116
1220
  // tunnel-, street-, bridges-bridge
1117
1221
  ...['tunnel', 'street', 'bridge'].flatMap((c) => {
@@ -1126,7 +1230,10 @@ function getShortbreadLayers(option) {
1126
1230
  suffixes = [':outline', ''];
1127
1231
  break;
1128
1232
  case 'street':
1129
- filter = [['!=', 'bridge', true], ['!=', 'tunnel', true]];
1233
+ filter = [
1234
+ ['!=', 'bridge', true],
1235
+ ['!=', 'tunnel', true],
1236
+ ];
1130
1237
  prefix = '';
1131
1238
  suffixes = [':outline', ''];
1132
1239
  break;
@@ -1150,85 +1257,64 @@ function getShortbreadLayers(option) {
1150
1257
  type: 'fill',
1151
1258
  'source-layer': 'bridges',
1152
1259
  });
1153
- suffixes.forEach(suffix => {
1260
+ suffixes.forEach((suffix) => {
1154
1261
  // pedestrian zone — no outline
1155
1262
  if (suffix === ':outline')
1156
1263
  results.push({
1157
1264
  id: prefix + 'street-pedestrian-zone',
1158
1265
  type: 'fill',
1159
1266
  'source-layer': 'street_polygons',
1160
- filter: ['all',
1161
- ...filter,
1162
- ['==', 'kind', 'pedestrian'],
1163
- ],
1267
+ filter: ['all', ...filter, ['==', 'kind', 'pedestrian']],
1164
1268
  });
1165
1269
  // non-car streets
1166
- ['footway', 'steps', 'path', 'cycleway'].forEach(t => {
1270
+ ['footway', 'steps', 'path', 'cycleway'].forEach((t) => {
1167
1271
  results.push({
1168
1272
  id: prefix + 'way-' + t.replace(/_/g, '') + suffix,
1169
1273
  type: 'line',
1170
1274
  'source-layer': 'streets',
1171
- filter: ['all',
1172
- ...filter,
1173
- ['in', 'kind', t],
1174
- ],
1275
+ filter: ['all', ...filter, ['in', 'kind', t]],
1175
1276
  });
1176
1277
  });
1177
1278
  // no links
1178
- ['track', 'pedestrian', 'service', 'living_street', 'residential', 'unclassified'].forEach(t => {
1279
+ ['track', 'pedestrian', 'service', 'living_street', 'residential', 'unclassified'].forEach((t) => {
1179
1280
  results.push({
1180
1281
  id: prefix + 'street-' + t.replace(/_/g, '') + suffix,
1181
1282
  type: 'line',
1182
1283
  'source-layer': 'streets',
1183
- filter: ['all',
1184
- ['==', 'kind', t],
1185
- ...filter,
1186
- ],
1284
+ filter: ['all', ['==', 'kind', t], ...filter],
1187
1285
  });
1188
1286
  });
1189
1287
  // no links, bicycle=designated
1190
1288
  if (suffix === '')
1191
- ['track', 'pedestrian', 'service', 'living_street', 'residential', 'unclassified'].forEach(t => {
1289
+ ['track', 'pedestrian', 'service', 'living_street', 'residential', 'unclassified'].forEach((t) => {
1192
1290
  results.push({
1193
1291
  id: prefix + 'street-' + t.replace(/_/g, '') + '-bicycle',
1194
1292
  type: 'line',
1195
1293
  'source-layer': 'streets',
1196
- filter: ['all',
1197
- ['==', 'kind', t],
1198
- ['==', 'bicycle', 'designated'],
1199
- ...filter,
1200
- ],
1294
+ filter: ['all', ['==', 'kind', t], ['==', 'bicycle', 'designated'], ...filter],
1201
1295
  });
1202
1296
  });
1203
1297
  // links
1204
- ['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach(t => {
1298
+ ['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach((t) => {
1205
1299
  results.push({
1206
1300
  id: prefix + 'street-' + t.replace(/_/g, '') + '-link' + suffix,
1207
1301
  type: 'line',
1208
1302
  'source-layer': 'streets',
1209
- filter: ['all',
1210
- ...filter,
1211
- ['in', 'kind', t],
1212
- ['==', 'link', true],
1213
- ],
1303
+ filter: ['all', ...filter, ['in', 'kind', t], ['==', 'link', true]],
1214
1304
  });
1215
1305
  });
1216
1306
  // main
1217
- ['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach(t => {
1307
+ ['tertiary', 'secondary', 'primary', 'trunk', 'motorway'].forEach((t) => {
1218
1308
  results.push({
1219
1309
  id: prefix + 'street-' + t.replace(/_/g, '') + suffix,
1220
1310
  type: 'line',
1221
1311
  'source-layer': 'streets',
1222
- filter: ['all',
1223
- ...filter,
1224
- ['in', 'kind', t],
1225
- ['!=', 'link', true],
1226
- ],
1312
+ filter: ['all', ...filter, ['in', 'kind', t], ['!=', 'link', true]],
1227
1313
  });
1228
1314
  });
1229
1315
  });
1230
1316
  // separate outline for trains
1231
- [':outline', ''].forEach(suffix => {
1317
+ [':outline', ''].forEach((suffix) => {
1232
1318
  // with service distinction
1233
1319
  ['rail', 'light_rail', 'subway', 'narrow_gauge', 'tram'].reverse().forEach((t) => {
1234
1320
  // main rail
@@ -1236,22 +1322,14 @@ function getShortbreadLayers(option) {
1236
1322
  id: prefix + 'transport-' + t.replace(/_/g, '') + suffix,
1237
1323
  type: 'line',
1238
1324
  'source-layer': 'streets',
1239
- filter: ['all',
1240
- ['in', 'kind', t],
1241
- ['!has', 'service'],
1242
- ...filter,
1243
- ],
1325
+ filter: ['all', ['in', 'kind', t], ['!has', 'service'], ...filter],
1244
1326
  });
1245
1327
  // service rail (crossover, siding, spur, yard)
1246
1328
  results.push({
1247
1329
  id: prefix + 'transport-' + t.replace(/_/g, '') + '-service' + suffix,
1248
1330
  type: 'line',
1249
1331
  'source-layer': 'streets',
1250
- filter: ['all',
1251
- ['in', 'kind', t],
1252
- ['has', 'service'],
1253
- ...filter,
1254
- ],
1332
+ filter: ['all', ['in', 'kind', t], ['has', 'service'], ...filter],
1255
1333
  });
1256
1334
  });
1257
1335
  // other transport
@@ -1260,23 +1338,19 @@ function getShortbreadLayers(option) {
1260
1338
  id: prefix + 'transport-' + t.replace(/_/g, '') + suffix,
1261
1339
  type: 'line',
1262
1340
  'source-layer': 'streets',
1263
- filter: ['all',
1264
- ['in', 'kind', t],
1265
- ...filter,
1266
- ],
1341
+ filter: ['all', ['in', 'kind', t], ...filter],
1267
1342
  });
1268
1343
  });
1269
1344
  if (c === 'street') {
1270
1345
  // aerialway, no bridges, above street evel
1271
- ['cable_car', 'gondola', 'goods', 'chair_lift', 'drag_lift', 't-bar', 'j-bar', 'platter', 'rope-tow'].reverse().forEach((t) => {
1346
+ ['cable_car', 'gondola', 'goods', 'chair_lift', 'drag_lift', 't-bar', 'j-bar', 'platter', 'rope-tow']
1347
+ .reverse()
1348
+ .forEach((t) => {
1272
1349
  results.push({
1273
1350
  id: 'aerialway-' + t.replace(/[_-]+/g, '') + suffix,
1274
1351
  type: 'line',
1275
1352
  'source-layer': 'aerialways',
1276
- filter: ['all',
1277
- ...filter,
1278
- ['in', 'kind', t],
1279
- ],
1353
+ filter: ['all', ...filter, ['in', 'kind', t]],
1280
1354
  });
1281
1355
  });
1282
1356
  // ferry — only on street level
@@ -1302,7 +1376,8 @@ function getShortbreadLayers(option) {
1302
1376
  id: 'boundary-country' + suffix,
1303
1377
  type: 'line',
1304
1378
  'source-layer': 'boundaries',
1305
- filter: ['all',
1379
+ filter: [
1380
+ 'all',
1306
1381
  ['==', 'admin_level', 2],
1307
1382
  ['!=', 'maritime', true],
1308
1383
  ['!=', 'disputed', true],
@@ -1313,7 +1388,8 @@ function getShortbreadLayers(option) {
1313
1388
  id: 'boundary-country-disputed' + suffix,
1314
1389
  type: 'line',
1315
1390
  'source-layer': 'boundaries',
1316
- filter: ['all',
1391
+ filter: [
1392
+ 'all',
1317
1393
  ['==', 'admin_level', 2],
1318
1394
  ['==', 'disputed', true],
1319
1395
  ['!=', 'maritime', true],
@@ -1324,7 +1400,8 @@ function getShortbreadLayers(option) {
1324
1400
  id: 'boundary-country-maritime' + suffix,
1325
1401
  type: 'line',
1326
1402
  'source-layer': 'boundaries',
1327
- filter: ['all',
1403
+ filter: [
1404
+ 'all',
1328
1405
  ['==', 'admin_level', 2],
1329
1406
  ['==', 'maritime', true],
1330
1407
  ['!=', 'disputed', true],
@@ -1335,7 +1412,8 @@ function getShortbreadLayers(option) {
1335
1412
  id: 'boundary-state' + suffix,
1336
1413
  type: 'line',
1337
1414
  'source-layer': 'boundaries',
1338
- filter: ['all',
1415
+ filter: [
1416
+ 'all',
1339
1417
  ['==', 'admin_level', 4],
1340
1418
  ['!=', 'maritime', true],
1341
1419
  ['!=', 'disputed', true],
@@ -1377,7 +1455,14 @@ function getShortbreadLayers(option) {
1377
1455
  layout: { 'text-field': nameField },
1378
1456
  })),
1379
1457
  // label-place of small places
1380
- ...[/*'locality', 'island', 'farm', 'dwelling',*/ 'neighbourhood', 'quarter', 'suburb', 'hamlet', 'village', 'town'].map((id) => ({
1458
+ ...[
1459
+ /*'locality', 'island', 'farm', 'dwelling',*/ 'neighbourhood',
1460
+ 'quarter',
1461
+ 'suburb',
1462
+ 'hamlet',
1463
+ 'village',
1464
+ 'town',
1465
+ ].map((id) => ({
1381
1466
  id: 'label-place-' + id.replace(/_/g, ''),
1382
1467
  type: 'symbol',
1383
1468
  'source-layer': 'place_labels',
@@ -1404,31 +1489,21 @@ function getShortbreadLayers(option) {
1404
1489
  id: 'label-boundary-country-small',
1405
1490
  type: 'symbol',
1406
1491
  'source-layer': 'boundary_labels',
1407
- filter: ['all',
1408
- ['in', 'admin_level', 2, '2'],
1409
- ['<=', 'way_area', 10000000],
1410
- ],
1492
+ filter: ['all', ['in', 'admin_level', 2, '2'], ['<=', 'way_area', 10000000]],
1411
1493
  layout: { 'text-field': nameField },
1412
1494
  },
1413
1495
  {
1414
1496
  id: 'label-boundary-country-medium',
1415
1497
  type: 'symbol',
1416
1498
  'source-layer': 'boundary_labels',
1417
- filter: ['all',
1418
- ['in', 'admin_level', 2, '2'],
1419
- ['<', 'way_area', 90000000],
1420
- ['>', 'way_area', 10000000],
1421
- ],
1499
+ filter: ['all', ['in', 'admin_level', 2, '2'], ['<', 'way_area', 90000000], ['>', 'way_area', 10000000]],
1422
1500
  layout: { 'text-field': nameField },
1423
1501
  },
1424
1502
  {
1425
1503
  id: 'label-boundary-country-large',
1426
1504
  type: 'symbol',
1427
1505
  'source-layer': 'boundary_labels',
1428
- filter: ['all',
1429
- ['in', 'admin_level', 2, '2'],
1430
- ['>=', 'way_area', 90000000],
1431
- ],
1506
+ filter: ['all', ['in', 'admin_level', 2, '2'], ['>=', 'way_area', 90000000]],
1432
1507
  layout: { 'text-field': nameField },
1433
1508
  },
1434
1509
  // marking
@@ -1436,7 +1511,8 @@ function getShortbreadLayers(option) {
1436
1511
  id: 'marking-oneway', // streets → oneway
1437
1512
  type: 'symbol',
1438
1513
  'source-layer': 'streets',
1439
- filter: ['all',
1514
+ filter: [
1515
+ 'all',
1440
1516
  ['==', 'oneway', true],
1441
1517
  ['in', 'kind', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'living_street'],
1442
1518
  ],
@@ -1453,7 +1529,8 @@ function getShortbreadLayers(option) {
1453
1529
  id: 'marking-oneway-reverse', // oneway_reverse
1454
1530
  type: 'symbol',
1455
1531
  'source-layer': 'streets',
1456
- filter: ['all',
1532
+ filter: [
1533
+ 'all',
1457
1534
  ['==', 'oneway_reverse', true],
1458
1535
  ['in', 'kind', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'living_street'],
1459
1536
  ],
@@ -1470,10 +1547,7 @@ function getShortbreadLayers(option) {
1470
1547
  id: 'marking-bicycle', // bicycle=designated or kind=cycleway
1471
1548
  type: 'symbol',
1472
1549
  'source-layer': 'streets',
1473
- filter: ['all',
1474
- ['==', 'bicycle', 'designated'],
1475
- ['==', 'kind', 'cycleway'],
1476
- ],
1550
+ filter: ['all', ['==', 'bicycle', 'designated'], ['==', 'kind', 'cycleway']],
1477
1551
  layout: {
1478
1552
  'symbol-placement': 'line',
1479
1553
  'symbol-spacing': 50,
@@ -1498,50 +1572,35 @@ function getShortbreadLayers(option) {
1498
1572
  id: 'symbol-transit-subway',
1499
1573
  type: 'symbol',
1500
1574
  'source-layer': 'public_transport',
1501
- filter: ['all',
1502
- ['in', 'kind', 'station', 'halt'],
1503
- ['==', 'station', 'subway'],
1504
- ],
1575
+ filter: ['all', ['in', 'kind', 'station', 'halt'], ['==', 'station', 'subway']],
1505
1576
  layout: { 'text-field': nameField },
1506
1577
  },
1507
1578
  {
1508
1579
  id: 'symbol-transit-lightrail',
1509
1580
  type: 'symbol',
1510
1581
  'source-layer': 'public_transport',
1511
- filter: ['all',
1512
- ['in', 'kind', 'station', 'halt'],
1513
- ['==', 'station', 'light_rail'],
1514
- ],
1582
+ filter: ['all', ['in', 'kind', 'station', 'halt'], ['==', 'station', 'light_rail']],
1515
1583
  layout: { 'text-field': nameField },
1516
1584
  },
1517
1585
  {
1518
1586
  id: 'symbol-transit-station',
1519
1587
  type: 'symbol',
1520
1588
  'source-layer': 'public_transport',
1521
- filter: ['all',
1522
- ['in', 'kind', 'station', 'halt'],
1523
- ['!in', 'station', 'light_rail', 'subway'],
1524
- ],
1589
+ filter: ['all', ['in', 'kind', 'station', 'halt'], ['!in', 'station', 'light_rail', 'subway']],
1525
1590
  layout: { 'text-field': nameField },
1526
1591
  },
1527
1592
  {
1528
1593
  id: 'symbol-transit-airfield',
1529
1594
  type: 'symbol',
1530
1595
  'source-layer': 'public_transport',
1531
- filter: ['all',
1532
- ['==', 'kind', 'aerodrome'],
1533
- ['!has', 'iata'],
1534
- ],
1596
+ filter: ['all', ['==', 'kind', 'aerodrome'], ['!has', 'iata']],
1535
1597
  layout: { 'text-field': nameField },
1536
1598
  },
1537
1599
  {
1538
1600
  id: 'symbol-transit-airport',
1539
1601
  type: 'symbol',
1540
1602
  'source-layer': 'public_transport',
1541
- filter: ['all',
1542
- ['==', 'kind', 'aerodrome'],
1543
- ['has', 'iata'],
1544
- ],
1603
+ filter: ['all', ['==', 'kind', 'aerodrome'], ['has', 'iata']],
1545
1604
  layout: { 'text-field': nameField },
1546
1605
  },
1547
1606
  ];
@@ -1910,7 +1969,12 @@ const propertyDefs = [
1910
1969
  { parent: 'layout', types: 'symbol', key: 'text-rotation-alignment', valueType: 'enum' },
1911
1970
  { parent: 'layout', types: 'symbol', key: 'text-size', short: 'size', valueType: 'number' },
1912
1971
  { parent: 'layout', types: 'symbol', key: 'text-transform', valueType: 'enum' },
1913
- { parent: 'layout', types: 'symbol', key: 'text-variable-anchor-offset', valueType: 'variableAnchorOffsetCollection' },
1972
+ {
1973
+ parent: 'layout',
1974
+ types: 'symbol',
1975
+ key: 'text-variable-anchor-offset',
1976
+ valueType: 'variableAnchorOffsetCollection',
1977
+ },
1914
1978
  { parent: 'layout', types: 'symbol', key: 'text-variable-anchor', valueType: 'array' },
1915
1979
  { parent: 'layout', types: 'symbol', key: 'text-writing-mode', valueType: 'array' },
1916
1980
  { parent: 'paint', types: 'background', key: 'background-color', short: 'color', valueType: 'color' },
@@ -1991,7 +2055,8 @@ function deepClone(obj) {
1991
2055
  case 'string':
1992
2056
  case 'undefined':
1993
2057
  return obj;
1994
- default: throw new Error(`Not implemented yet: "${type}" case`);
2058
+ default:
2059
+ throw new Error(`Not implemented yet: "${type}" case`);
1995
2060
  }
1996
2061
  }
1997
2062
  if (isSimpleObject(obj)) {
@@ -2103,7 +2168,7 @@ function basename(url) {
2103
2168
  }
2104
2169
 
2105
2170
  function decorate(layers, rules, recolor) {
2106
- const layerIds = layers.map(l => l.id);
2171
+ const layerIds = layers.map((l) => l.id);
2107
2172
  const layerIdSet = new Set(layerIds);
2108
2173
  // Initialize a new map to hold final styles for layers
2109
2174
  const layerStyles = new Map();
@@ -2112,25 +2177,25 @@ function decorate(layers, rules, recolor) {
2112
2177
  if (layerStyle == null)
2113
2178
  return;
2114
2179
  // Expand any braces in IDs and filter them through a RegExp if necessary
2115
- const ids = expandTop(idDef).flatMap(id => {
2180
+ const ids = expandTop(idDef).flatMap((id) => {
2116
2181
  if (!id.includes('*'))
2117
2182
  return id;
2118
- const regExpString = id.replace(/[^a-z_:-]/g, c => {
2183
+ const regExpString = id.replace(/[^a-z_:-]/g, (c) => {
2119
2184
  if (c === '*')
2120
2185
  return '[a-z_-]*';
2121
2186
  throw new Error('unknown char to process. Do not know how to make a RegExp from: ' + JSON.stringify(c));
2122
2187
  });
2123
2188
  const regExp = new RegExp(`^${regExpString}$`, 'i');
2124
- return layerIds.filter(layerId => regExp.test(layerId));
2189
+ return layerIds.filter((layerId) => regExp.test(layerId));
2125
2190
  });
2126
- ids.forEach(id => {
2191
+ ids.forEach((id) => {
2127
2192
  if (!layerIdSet.has(id))
2128
2193
  return;
2129
2194
  layerStyles.set(id, deepMerge(layerStyles.get(id) ?? {}, layerStyle));
2130
2195
  });
2131
2196
  });
2132
2197
  // Deep clone the original layers and apply styles
2133
- return layers.flatMap(layer => {
2198
+ return layers.flatMap((layer) => {
2134
2199
  // Get the id and style of the layer
2135
2200
  const layerStyle = layerStyles.get(layer.id);
2136
2201
  // Don't export layers that have no style
@@ -2145,11 +2210,11 @@ function decorate(layers, rules, recolor) {
2145
2210
  if (ruleValue == null)
2146
2211
  continue;
2147
2212
  // CamelCase to not-camel-case
2148
- const ruleKey = ruleKeyCamelCase.replace(/[A-Z]/g, c => '-' + c.toLowerCase());
2213
+ const ruleKey = ruleKeyCamelCase.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase());
2149
2214
  const propertyDefs = propertyLookup.get(layer.type + '/' + ruleKey);
2150
2215
  if (!propertyDefs)
2151
2216
  continue;
2152
- propertyDefs.forEach(propertyDef => {
2217
+ propertyDefs.forEach((propertyDef) => {
2153
2218
  const { key } = propertyDef;
2154
2219
  let value = ruleValue;
2155
2220
  switch (propertyDef.valueType) {
@@ -2167,7 +2232,8 @@ function decorate(layers, rules, recolor) {
2167
2232
  case 'number':
2168
2233
  value = processExpression(value);
2169
2234
  break;
2170
- default: throw new Error(`unknown propertyDef.valueType "${propertyDef.valueType}" for key "${key}"`);
2235
+ default:
2236
+ throw new Error(`unknown propertyDef.valueType "${propertyDef.valueType}" for key "${key}"`);
2171
2237
  }
2172
2238
  switch (propertyDef.parent) {
2173
2239
  case 'layer':
@@ -2324,22 +2390,64 @@ function recolor(color, opt) {
2324
2390
  return color;
2325
2391
  }
2326
2392
 
2327
- const styleBuilderColorKeys = ['agriculture', 'boundary', 'building', 'buildingbg', 'burial', 'commercial', 'construction', 'cycle', 'danger', 'disputed', 'education', 'foot', 'glacier', 'grass', 'hospital', 'industrial', 'label', 'labelHalo', 'land', 'leisure', 'motorway', 'motorwaybg', 'park', 'parking', 'poi', 'prison', 'rail', 'residential', 'rock', 'sand', 'shield', 'street', 'streetbg', 'subway', 'symbol', 'trunk', 'trunkbg', 'waste', 'water', 'wetland', 'wood'];
2393
+ const styleBuilderColorKeys = [
2394
+ 'agriculture',
2395
+ 'boundary',
2396
+ 'building',
2397
+ 'buildingbg',
2398
+ 'burial',
2399
+ 'commercial',
2400
+ 'construction',
2401
+ 'cycle',
2402
+ 'danger',
2403
+ 'disputed',
2404
+ 'education',
2405
+ 'foot',
2406
+ 'glacier',
2407
+ 'grass',
2408
+ 'hospital',
2409
+ 'industrial',
2410
+ 'label',
2411
+ 'labelHalo',
2412
+ 'land',
2413
+ 'leisure',
2414
+ 'motorway',
2415
+ 'motorwaybg',
2416
+ 'park',
2417
+ 'parking',
2418
+ 'poi',
2419
+ 'prison',
2420
+ 'rail',
2421
+ 'residential',
2422
+ 'rock',
2423
+ 'sand',
2424
+ 'shield',
2425
+ 'street',
2426
+ 'streetbg',
2427
+ 'subway',
2428
+ 'symbol',
2429
+ 'trunk',
2430
+ 'trunkbg',
2431
+ 'waste',
2432
+ 'water',
2433
+ 'wetland',
2434
+ 'wood',
2435
+ ];
2328
2436
 
2329
2437
  // StyleBuilder class definition
2330
2438
  class StyleBuilder {
2331
2439
  #sourceName = 'versatiles-shortbread';
2332
2440
  build(options) {
2333
2441
  options ??= {};
2334
- // @ts-expect-error globalThis may be undefined in some environments
2335
- const baseUrl = options.baseUrl ?? globalThis?.document?.location?.origin ?? 'https://tiles.versatiles.org';
2336
- const glyphs = options.glyphs ?? '/assets/glyphs/{fontstack}/{range}.pbf';
2337
- const sprite = options.sprite ?? [{ id: 'basics', url: '/assets/sprites/basics/sprites' }];
2338
- const tiles = options.tiles ?? ['/tiles/osm/{z}/{x}/{y}'];
2339
- const bounds = options.bounds ?? [-180, -85.0511287798066, 180, 85.0511287798066];
2340
- const hideLabels = options.hideLabels ?? false;
2341
- const language = options.language ?? null;
2342
- const recolorOptions = options.recolor ?? getDefaultRecolorFlags();
2442
+ const defaults = this.getDefaultOptions();
2443
+ const baseUrl = options.baseUrl ?? defaults.baseUrl;
2444
+ const glyphs = options.glyphs ?? defaults.glyphs;
2445
+ const sprite = options.sprite ?? defaults.sprite;
2446
+ const tiles = options.tiles ?? defaults.tiles;
2447
+ const bounds = options.bounds ?? defaults.bounds;
2448
+ const hideLabels = options.hideLabels ?? defaults.hideLabels;
2449
+ const language = options.language ?? defaults.language;
2450
+ const recolorOptions = options.recolor ?? defaults.recolor;
2343
2451
  const colors = this.getColors(this.defaultColors);
2344
2452
  if (options.colors) {
2345
2453
  let key;
@@ -2369,7 +2477,7 @@ class StyleBuilder {
2369
2477
  const layerStyleRules = this.getStyleRules(styleRuleOptions);
2370
2478
  // get shortbread layers
2371
2479
  const layerDefinitions = getShortbreadLayers({ language });
2372
- let layers = layerDefinitions.map(layer => {
2480
+ let layers = layerDefinitions.map((layer) => {
2373
2481
  switch (layer.type) {
2374
2482
  case 'background':
2375
2483
  return layer;
@@ -2387,7 +2495,7 @@ class StyleBuilder {
2387
2495
  layers = decorate(layers, layerStyleRules, new CachedRecolor(recolorOptions));
2388
2496
  // hide labels, if wanted
2389
2497
  if (hideLabels)
2390
- layers = layers.filter(l => l.type !== 'symbol');
2498
+ layers = layers.filter((l) => l.type !== 'symbol');
2391
2499
  style.layers = layers;
2392
2500
  style.name = 'versatiles-' + this.name.toLowerCase();
2393
2501
  style.glyphs = resolveUrl(baseUrl, glyphs);
@@ -2399,7 +2507,7 @@ class StyleBuilder {
2399
2507
  }
2400
2508
  const source = style.sources[this.#sourceName];
2401
2509
  if ('tiles' in source)
2402
- source.tiles = tiles.map(url => resolveUrl(baseUrl, url));
2510
+ source.tiles = tiles.map((url) => resolveUrl(baseUrl, url));
2403
2511
  if ('bounds' in source)
2404
2512
  source.bounds = bounds;
2405
2513
  return style;
@@ -2411,18 +2519,14 @@ class StyleBuilder {
2411
2519
  }
2412
2520
  getDefaultOptions() {
2413
2521
  return {
2414
- baseUrl: '',
2415
- bounds: [
2416
- -180,
2417
- -85.0511287798066,
2418
- 180,
2419
- 85.0511287798066
2420
- ],
2421
- glyphs: '',
2422
- sprite: '',
2423
- tiles: [],
2522
+ // @ts-expect-error globalThis may be undefined in some environments
2523
+ baseUrl: globalThis?.document?.location?.origin ?? 'https://tiles.versatiles.org',
2524
+ bounds: [-180, -85.0511287798066, 180, 85.0511287798066],
2525
+ glyphs: '/assets/glyphs/{fontstack}/{range}.pbf',
2526
+ sprite: [{ id: 'basics', url: '/assets/sprites/basics/sprites' }],
2527
+ tiles: ['/tiles/osm/{z}/{x}/{y}'],
2424
2528
  hideLabels: false,
2425
- language: undefined,
2529
+ language: '',
2426
2530
  colors: deepClone(this.defaultColors),
2427
2531
  fonts: deepClone(this.defaultFonts),
2428
2532
  recolor: getDefaultRecolorFlags(),
@@ -2530,7 +2634,7 @@ class Colorful extends StyleBuilder {
2530
2634
  const { colors, fonts } = options;
2531
2635
  return {
2532
2636
  // background
2533
- 'background': {
2637
+ background: {
2534
2638
  color: colors.land,
2535
2639
  },
2536
2640
  // boundary
@@ -2684,7 +2788,8 @@ class Colorful extends StyleBuilder {
2684
2788
  color: colors.buildingbg,
2685
2789
  opacity: { 14: 0, 15: 1 },
2686
2790
  },
2687
- 'building': {
2791
+ building: {
2792
+ // fake 2.5d with translate
2688
2793
  color: colors.building,
2689
2794
  opacity: { 14: 0, 15: 1 },
2690
2795
  fillTranslate: [-2, -2],
@@ -2717,7 +2822,7 @@ class Colorful extends StyleBuilder {
2717
2822
  opacity: { 13: 0, 14: 1 },
2718
2823
  },
2719
2824
  // bridge
2720
- 'bridge': {
2825
+ bridge: {
2721
2826
  color: colors.land.darken(0.02),
2722
2827
  fillAntialias: true,
2723
2828
  opacity: 0.8,
@@ -2763,37 +2868,37 @@ class Colorful extends StyleBuilder {
2763
2868
  opacity: 0.5,
2764
2869
  },
2765
2870
  'bridge-street-motorway:bridge': {
2766
- size: { '5': 0, '6': 3, '10': 7, '14': 7, '16': 20, '18': 53, '19': 118, '20': 235 }
2871
+ size: { '5': 0, '6': 3, '10': 7, '14': 7, '16': 20, '18': 53, '19': 118, '20': 235 },
2767
2872
  },
2768
2873
  'bridge-street-trunk:bridge': {
2769
- size: { '7': 0, '8': 3, '10': 6, '14': 8, '16': 17, '18': 50, '19': 104, '20': 202 }
2874
+ size: { '7': 0, '8': 3, '10': 6, '14': 8, '16': 17, '18': 50, '19': 104, '20': 202 },
2770
2875
  },
2771
2876
  'bridge-street-primary:bridge': {
2772
- size: { '8': 0, '9': 1, '10': 6, '14': 8, '16': 17, '18': 50, '19': 104, '20': 202 }
2877
+ size: { '8': 0, '9': 1, '10': 6, '14': 8, '16': 17, '18': 50, '19': 104, '20': 202 },
2773
2878
  },
2774
2879
  'bridge-street-secondary:bridge': {
2775
2880
  size: { '11': 3, '14': 7, '16': 11, '18': 42, '19': 95, '20': 193 },
2776
- opacity: { '11': 0, '12': 1 }
2881
+ opacity: { '11': 0, '12': 1 },
2777
2882
  },
2778
2883
  'bridge-street-motorway-link:bridge': {
2779
2884
  minzoom: 12,
2780
- size: { '12': 3, '14': 4, '16': 10, '18': 20, '20': 56 }
2885
+ size: { '12': 3, '14': 4, '16': 10, '18': 20, '20': 56 },
2781
2886
  },
2782
2887
  'bridge-street-{trunk,primary,secondary}-link:bridge': {
2783
2888
  minzoom: 13,
2784
- size: { '12': 3, '14': 4, '16': 10, '18': 20, '20': 56 }
2889
+ size: { '12': 3, '14': 4, '16': 10, '18': 20, '20': 56 },
2785
2890
  },
2786
2891
  'bridge-street-{tertiary,tertiary-link,unclassified,residential,livingstreet,pedestrian}*:bridge': {
2787
2892
  size: { '12': 3, '14': 4, '16': 8, '18': 36, '19': 90, '20': 179 },
2788
- opacity: { '12': 0, '13': 1 }
2893
+ opacity: { '12': 0, '13': 1 },
2789
2894
  },
2790
2895
  'bridge-street-{service,track}:bridge': {
2791
2896
  size: { '14': 3, '16': 6, '18': 25, '19': 67, '20': 134 },
2792
- opacity: { '14': 0, '15': 1 }
2897
+ opacity: { '14': 0, '15': 1 },
2793
2898
  },
2794
2899
  'bridge-way-*:bridge': {
2795
2900
  size: { '15': 0, '16': 7, '18': 10, '19': 17, '20': 31 },
2796
- minzoom: 15
2901
+ minzoom: 15,
2797
2902
  },
2798
2903
  // special color: motorway
2799
2904
  '{bridge-,}street-motorway{-link,}:outline': {
@@ -3223,177 +3328,285 @@ class Colorful extends StyleBuilder {
3223
3328
  color: colors.poi,
3224
3329
  },
3225
3330
  'poi-amenity': {
3226
- image: ['match',
3331
+ image: [
3332
+ 'match',
3227
3333
  ['get', 'amenity'],
3228
- 'arts_centre', 'basics:icon-art_gallery',
3229
- 'atm', 'basics:icon-atm',
3230
- 'bank', 'basics:icon-bank',
3231
- 'bar', 'basics:icon-bar',
3232
- 'bench', 'basics:icon-bench',
3233
- 'bicycle_rental', 'basics:icon-bicycle_share',
3234
- 'biergarten', 'basics:icon-beergarden',
3235
- 'cafe', 'basics:icon-cafe',
3236
- 'car_rental', 'basics:icon-car_rental',
3237
- 'car_sharing', 'basics:icon-car_rental',
3238
- 'car_wash', 'basics:icon-car_wash',
3239
- 'cinema', 'basics:icon-cinema',
3334
+ 'arts_centre',
3335
+ 'basics:icon-art_gallery',
3336
+ 'atm',
3337
+ 'basics:icon-atm',
3338
+ 'bank',
3339
+ 'basics:icon-bank',
3340
+ 'bar',
3341
+ 'basics:icon-bar',
3342
+ 'bench',
3343
+ 'basics:icon-bench',
3344
+ 'bicycle_rental',
3345
+ 'basics:icon-bicycle_share',
3346
+ 'biergarten',
3347
+ 'basics:icon-beergarden',
3348
+ 'cafe',
3349
+ 'basics:icon-cafe',
3350
+ 'car_rental',
3351
+ 'basics:icon-car_rental',
3352
+ 'car_sharing',
3353
+ 'basics:icon-car_rental',
3354
+ 'car_wash',
3355
+ 'basics:icon-car_wash',
3356
+ 'cinema',
3357
+ 'basics:icon-cinema',
3240
3358
  //'clinic', 'basics:icon-clinic',
3241
- 'college', 'basics:icon-college',
3242
- 'community_centre', 'basics:icon-community',
3359
+ 'college',
3360
+ 'basics:icon-college',
3361
+ 'community_centre',
3362
+ 'basics:icon-community',
3243
3363
  //'courthouse', 'basics:icon-courthouse',
3244
- 'dentist', 'basics:icon-dentist',
3245
- 'doctors', 'basics:icon-doctor',
3246
- 'dog_park', 'basics:icon-dog_park',
3247
- 'drinking_water', 'basics:icon-drinking_water',
3248
- 'embassy', 'basics:icon-embassy',
3249
- 'fast_food', 'basics:icon-fast_food',
3250
- 'fire_station', 'basics:icon-fire_station',
3364
+ 'dentist',
3365
+ 'basics:icon-dentist',
3366
+ 'doctors',
3367
+ 'basics:icon-doctor',
3368
+ 'dog_park',
3369
+ 'basics:icon-dog_park',
3370
+ 'drinking_water',
3371
+ 'basics:icon-drinking_water',
3372
+ 'embassy',
3373
+ 'basics:icon-embassy',
3374
+ 'fast_food',
3375
+ 'basics:icon-fast_food',
3376
+ 'fire_station',
3377
+ 'basics:icon-fire_station',
3251
3378
  //'food_court', 'basics:icon-food_court',
3252
- 'fountain', 'basics:icon-fountain',
3253
- 'grave_yard', 'basics:icon-cemetery',
3254
- 'hospital', 'basics:icon-hospital',
3255
- 'hunting_stand', 'basics:icon-huntingstand',
3256
- 'library', 'basics:icon-library',
3257
- 'marketplace', 'basics:icon-marketplace',
3258
- 'nightclub', 'basics:icon-nightclub',
3259
- 'nursing_home', 'basics:icon-nursinghome',
3260
- 'pharmacy', 'basics:icon-pharmacy',
3261
- 'place_of_worship', 'basics:icon-place_of_worship',
3262
- 'playground', 'basics:icon-playground',
3263
- 'police', 'basics:icon-police',
3264
- 'post_box', 'basics:icon-postbox',
3265
- 'post_office', 'basics:icon-post',
3266
- 'prison', 'basics:icon-prison',
3267
- 'pub', 'basics:icon-beer',
3379
+ 'fountain',
3380
+ 'basics:icon-fountain',
3381
+ 'grave_yard',
3382
+ 'basics:icon-cemetery',
3383
+ 'hospital',
3384
+ 'basics:icon-hospital',
3385
+ 'hunting_stand',
3386
+ 'basics:icon-huntingstand',
3387
+ 'library',
3388
+ 'basics:icon-library',
3389
+ 'marketplace',
3390
+ 'basics:icon-marketplace',
3391
+ 'nightclub',
3392
+ 'basics:icon-nightclub',
3393
+ 'nursing_home',
3394
+ 'basics:icon-nursinghome',
3395
+ 'pharmacy',
3396
+ 'basics:icon-pharmacy',
3397
+ 'place_of_worship',
3398
+ 'basics:icon-place_of_worship',
3399
+ 'playground',
3400
+ 'basics:icon-playground',
3401
+ 'police',
3402
+ 'basics:icon-police',
3403
+ 'post_box',
3404
+ 'basics:icon-postbox',
3405
+ 'post_office',
3406
+ 'basics:icon-post',
3407
+ 'prison',
3408
+ 'basics:icon-prison',
3409
+ 'pub',
3410
+ 'basics:icon-beer',
3268
3411
  //'public_building', 'basics:icon-public_building',
3269
- 'recycling', 'basics:icon-recycling',
3270
- 'restaurant', 'basics:icon-restaurant',
3271
- 'school', 'basics:icon-school',
3272
- 'shelter', 'basics:icon-shelter',
3273
- 'telephone', 'basics:icon-telephone',
3274
- 'theatre', 'basics:icon-theatre',
3275
- 'toilets', 'basics:icon-toilet',
3276
- 'townhall', 'basics:icon-town_hall',
3412
+ 'recycling',
3413
+ 'basics:icon-recycling',
3414
+ 'restaurant',
3415
+ 'basics:icon-restaurant',
3416
+ 'school',
3417
+ 'basics:icon-school',
3418
+ 'shelter',
3419
+ 'basics:icon-shelter',
3420
+ 'telephone',
3421
+ 'basics:icon-telephone',
3422
+ 'theatre',
3423
+ 'basics:icon-theatre',
3424
+ 'toilets',
3425
+ 'basics:icon-toilet',
3426
+ 'townhall',
3427
+ 'basics:icon-town_hall',
3277
3428
  //'university', 'basics:icon-university',
3278
- 'vending_machine', 'basics:icon-vendingmachine',
3279
- 'veterinary', 'basics:icon-veterinary',
3280
- 'waste_basket', 'basics:icon-waste_basket',
3429
+ 'vending_machine',
3430
+ 'basics:icon-vendingmachine',
3431
+ 'veterinary',
3432
+ 'basics:icon-veterinary',
3433
+ 'waste_basket',
3434
+ 'basics:icon-waste_basket',
3281
3435
  '',
3282
3436
  ],
3283
3437
  },
3284
3438
  'poi-leisure': {
3285
- image: ['match',
3439
+ image: [
3440
+ 'match',
3286
3441
  ['get', 'leisure'],
3287
- 'golf_course', 'basics:icon-golf',
3288
- 'ice_rink', 'basics:icon-icerink',
3289
- 'pitch', 'basics:icon-pitch',
3442
+ 'golf_course',
3443
+ 'basics:icon-golf',
3444
+ 'ice_rink',
3445
+ 'basics:icon-icerink',
3446
+ 'pitch',
3447
+ 'basics:icon-pitch',
3290
3448
  //'sports_centre', 'basics:icon-sports_centre',
3291
- 'stadium', 'basics:icon-stadium',
3292
- 'swimming_pool', 'basics:icon-swimming',
3293
- 'water_park', 'basics:icon-waterpark',
3449
+ 'stadium',
3450
+ 'basics:icon-stadium',
3451
+ 'swimming_pool',
3452
+ 'basics:icon-swimming',
3453
+ 'water_park',
3454
+ 'basics:icon-waterpark',
3294
3455
  'basics:icon-sports',
3295
3456
  ],
3296
3457
  },
3297
3458
  'poi-tourism': {
3298
- image: ['match',
3459
+ image: [
3460
+ 'match',
3299
3461
  ['get', 'tourism'],
3300
3462
  //'alpine_hut', 'basics:icon-alpine_hut',
3301
3463
  //'bed_and_breakfast', 'basics:icon-bed_and_breakfast',
3302
3464
  //'camp_site', 'basics:icon-camp_site',
3303
3465
  //'caravan_site', 'basics:icon-caravan_site',
3304
- 'chalet', 'basics:icon-chalet',
3466
+ 'chalet',
3467
+ 'basics:icon-chalet',
3305
3468
  //'guest_house', 'basics:icon-guest_house',
3306
3469
  //'hostel', 'basics:icon-hostel',
3307
3470
  //'hotel', 'basics:icon-hotel',
3308
- 'information', 'basics:transport-information',
3471
+ 'information',
3472
+ 'basics:transport-information',
3309
3473
  //'motel', 'basics:icon-motel',
3310
- 'picnic_site', 'basics:icon-picnic_site',
3474
+ 'picnic_site',
3475
+ 'basics:icon-picnic_site',
3311
3476
  //'theme_park', 'basics:icon-theme_park',
3312
- 'viewpoint', 'basics:icon-viewpoint',
3313
- 'zoo', 'basics:icon-zoo',
3477
+ 'viewpoint',
3478
+ 'basics:icon-viewpoint',
3479
+ 'zoo',
3480
+ 'basics:icon-zoo',
3314
3481
  '',
3315
3482
  ],
3316
3483
  },
3317
3484
  'poi-shop': {
3318
- image: ['match',
3485
+ image: [
3486
+ 'match',
3319
3487
  ['get', 'shop'],
3320
- 'alcohol', 'basics:icon-alcohol_shop',
3321
- 'bakery', 'basics:icon-bakery',
3322
- 'beauty', 'basics:icon-beauty',
3323
- 'beverages', 'basics:icon-beverages',
3488
+ 'alcohol',
3489
+ 'basics:icon-alcohol_shop',
3490
+ 'bakery',
3491
+ 'basics:icon-bakery',
3492
+ 'beauty',
3493
+ 'basics:icon-beauty',
3494
+ 'beverages',
3495
+ 'basics:icon-beverages',
3324
3496
  //'bicycle', 'basics:icon-bicycle',
3325
- 'books', 'basics:icon-books',
3326
- 'butcher', 'basics:icon-butcher',
3497
+ 'books',
3498
+ 'basics:icon-books',
3499
+ 'butcher',
3500
+ 'basics:icon-butcher',
3327
3501
  //'car', 'basics:icon-car',
3328
- 'chemist', 'basics:icon-chemist',
3329
- 'clothes', 'basics:icon-clothes',
3502
+ 'chemist',
3503
+ 'basics:icon-chemist',
3504
+ 'clothes',
3505
+ 'basics:icon-clothes',
3330
3506
  //'computer', 'basics:icon-computer',
3331
3507
  //'convinience', 'basics:icon-convinience',
3332
3508
  //'department_store', 'basics:icon-department_store',
3333
- 'doityourself', 'basics:icon-doityourself',
3334
- 'dry_cleaning', 'basics:icon-drycleaning',
3335
- 'florist', 'basics:icon-florist',
3336
- 'furniture', 'basics:icon-furniture',
3337
- 'garden_centre', 'basics:icon-garden_centre',
3338
- 'general', 'basics:icon-shop',
3339
- 'gift', 'basics:icon-gift',
3340
- 'greengrocer', 'basics:icon-greengrocer',
3341
- 'hairdresser', 'basics:icon-hairdresser',
3342
- 'hardware', 'basics:icon-hardware',
3343
- 'jewelry', 'basics:icon-jewelry_store',
3344
- 'kiosk', 'basics:icon-kiosk',
3345
- 'laundry', 'basics:icon-laundry',
3509
+ 'doityourself',
3510
+ 'basics:icon-doityourself',
3511
+ 'dry_cleaning',
3512
+ 'basics:icon-drycleaning',
3513
+ 'florist',
3514
+ 'basics:icon-florist',
3515
+ 'furniture',
3516
+ 'basics:icon-furniture',
3517
+ 'garden_centre',
3518
+ 'basics:icon-garden_centre',
3519
+ 'general',
3520
+ 'basics:icon-shop',
3521
+ 'gift',
3522
+ 'basics:icon-gift',
3523
+ 'greengrocer',
3524
+ 'basics:icon-greengrocer',
3525
+ 'hairdresser',
3526
+ 'basics:icon-hairdresser',
3527
+ 'hardware',
3528
+ 'basics:icon-hardware',
3529
+ 'jewelry',
3530
+ 'basics:icon-jewelry_store',
3531
+ 'kiosk',
3532
+ 'basics:icon-kiosk',
3533
+ 'laundry',
3534
+ 'basics:icon-laundry',
3346
3535
  //'mall', 'basics:icon-mall',
3347
3536
  //'mobile_phone', 'basics:icon-mobile_phone',
3348
- 'newsagent', 'basics:icon-newsagent',
3349
- 'optican', 'basics:icon-optician',
3350
- 'outdoor', 'basics:icon-outdoor',
3351
- 'shoes', 'basics:icon-shoes',
3352
- 'sports', 'basics:icon-sports',
3353
- 'stationery', 'basics:icon-stationery',
3537
+ 'newsagent',
3538
+ 'basics:icon-newsagent',
3539
+ 'optican',
3540
+ 'basics:icon-optician',
3541
+ 'outdoor',
3542
+ 'basics:icon-outdoor',
3543
+ 'shoes',
3544
+ 'basics:icon-shoes',
3545
+ 'sports',
3546
+ 'basics:icon-sports',
3547
+ 'stationery',
3548
+ 'basics:icon-stationery',
3354
3549
  //'supermarket', 'basics:icon-supermarket',
3355
- 'toys', 'basics:icon-toys',
3356
- 'travel_agency', 'basics:icon-travel_agent',
3357
- 'video', 'basics:icon-video',
3550
+ 'toys',
3551
+ 'basics:icon-toys',
3552
+ 'travel_agency',
3553
+ 'basics:icon-travel_agent',
3554
+ 'video',
3555
+ 'basics:icon-video',
3358
3556
  'basics:icon-shop',
3359
3557
  ],
3360
3558
  },
3361
3559
  'poi-man_made': {
3362
- image: ['match',
3560
+ image: [
3561
+ 'match',
3363
3562
  ['get', 'man_made'],
3364
- 'lighthouse', 'basics:icon-lighthouse',
3365
- 'surveillance', 'basics:icon-surveillance',
3366
- 'tower', 'basics:icon-observation_tower',
3563
+ 'lighthouse',
3564
+ 'basics:icon-lighthouse',
3565
+ 'surveillance',
3566
+ 'basics:icon-surveillance',
3567
+ 'tower',
3568
+ 'basics:icon-observation_tower',
3367
3569
  //'wastewater_plant', 'basics:icon-wastewater_plant',
3368
3570
  //'water_well', 'basics:icon-water_well',
3369
3571
  //'water_works', 'basics:icon-water_works',
3370
- 'watermill', 'basics:icon-watermill',
3371
- 'windmill', 'basics:icon-windmill',
3572
+ 'watermill',
3573
+ 'basics:icon-watermill',
3574
+ 'windmill',
3575
+ 'basics:icon-windmill',
3372
3576
  '',
3373
3577
  ],
3374
3578
  },
3375
3579
  'poi-historic': {
3376
- image: ['match',
3580
+ image: [
3581
+ 'match',
3377
3582
  ['get', 'historic'],
3378
3583
  //'archaelogical_site', 'basics:icon-archaelogical_site',
3379
- 'artwork', 'basics:icon-artwork',
3584
+ 'artwork',
3585
+ 'basics:icon-artwork',
3380
3586
  //'battlefield', 'basics:icon-battlefield',
3381
- 'castle', 'basics:icon-castle',
3587
+ 'castle',
3588
+ 'basics:icon-castle',
3382
3589
  //'fort', 'basics:icon-fort',
3383
3590
  //'memorial', 'basics:icon-memorial',
3384
- 'monument', 'basics:icon-monument',
3591
+ 'monument',
3592
+ 'basics:icon-monument',
3385
3593
  //'ruins', 'basics:icon-ruins',
3386
3594
  //'wayside_cross', 'basics:icon-wayside_cross',
3387
- 'wayside_shrine', 'basics:icon-shrine',
3595
+ 'wayside_shrine',
3596
+ 'basics:icon-shrine',
3388
3597
  'basics:icon-historic',
3389
3598
  ],
3390
3599
  },
3391
3600
  'poi-emergency': {
3392
- image: ['match',
3601
+ image: [
3602
+ 'match',
3393
3603
  ['get', 'emergency'],
3394
- 'defibrillator', 'basics:icon-defibrillator',
3395
- 'fire_hydrant', 'basics:icon-hydrant',
3396
- 'phone', 'basics:icon-emergency_phone',
3604
+ 'defibrillator',
3605
+ 'basics:icon-defibrillator',
3606
+ 'fire_hydrant',
3607
+ 'basics:icon-hydrant',
3608
+ 'phone',
3609
+ 'basics:icon-emergency_phone',
3397
3610
  '',
3398
3611
  ],
3399
3612
  },
@@ -3421,7 +3634,7 @@ class Eclipse extends Colorful {
3421
3634
  name = 'Eclipse';
3422
3635
  constructor() {
3423
3636
  super();
3424
- this.transformDefaultColors(color => color.invertLuminosity());
3637
+ this.transformDefaultColors((color) => color.invertLuminosity());
3425
3638
  }
3426
3639
  }
3427
3640
 
@@ -3429,7 +3642,7 @@ class Graybeard extends Colorful {
3429
3642
  name = 'Graybeard';
3430
3643
  constructor() {
3431
3644
  super();
3432
- this.transformDefaultColors(color => color.saturate(-1));
3645
+ this.transformDefaultColors((color) => color.saturate(-1));
3433
3646
  }
3434
3647
  }
3435
3648
 
@@ -3437,7 +3650,7 @@ class Shadow extends Colorful {
3437
3650
  name = 'Shadow';
3438
3651
  constructor() {
3439
3652
  super();
3440
- this.transformDefaultColors(color => color.saturate(-1).invert().brightness(0.2));
3653
+ this.transformDefaultColors((color) => color.saturate(-1).invert().brightness(0.2));
3441
3654
  }
3442
3655
  }
3443
3656
 
@@ -3506,7 +3719,7 @@ class Neutrino extends Colorful {
3506
3719
  getStyleRules(options) {
3507
3720
  const { colors, fonts } = options;
3508
3721
  return {
3509
- 'background': {
3722
+ background: {
3510
3723
  color: colors.land,
3511
3724
  },
3512
3725
  'boundary-{country,state}': {
@@ -3577,11 +3790,11 @@ class Neutrino extends Colorful {
3577
3790
  'site-{bicycleparking,parking}': {
3578
3791
  color: colors.commercial,
3579
3792
  },
3580
- 'building': {
3793
+ building: {
3581
3794
  color: colors.building,
3582
3795
  opacity: { 14: 0, 15: 1 },
3583
3796
  },
3584
- 'bridge': {
3797
+ bridge: {
3585
3798
  color: colors.land.darken(0.01),
3586
3799
  },
3587
3800
  '{tunnel-,bridge-,}street-*': {
@@ -3865,9 +4078,9 @@ const neutrino = getStyleBuilder(Neutrino);
3865
4078
  getStyleBuilder(Empty);
3866
4079
 
3867
4080
  /**
3868
- * Checks if an object adheres to the TileJSON specification.
3869
- * Throws errors if the object does not conform to the expected structure or types.
3870
- */
4081
+ * Checks if an object adheres to the TileJSON specification.
4082
+ * Throws errors if the object does not conform to the expected structure or types.
4083
+ */
3871
4084
  function isTileJSONSpecification(spec) {
3872
4085
  if (typeof spec !== 'object' || spec === null) {
3873
4086
  throw Error('spec must be an object');
@@ -3881,7 +4094,7 @@ function isTileJSONSpecification(spec) {
3881
4094
  throw Error('spec.attribution must be a string if present');
3882
4095
  }
3883
4096
  if (obj.bounds != null) {
3884
- if (!Array.isArray(obj.bounds) || obj.bounds.length !== 4 || obj.bounds.some(num => typeof num !== 'number')) {
4097
+ if (!Array.isArray(obj.bounds) || obj.bounds.length !== 4 || obj.bounds.some((num) => typeof num !== 'number')) {
3885
4098
  throw Error('spec.bounds must be an array of four numbers if present');
3886
4099
  }
3887
4100
  const a = obj.bounds;
@@ -3899,7 +4112,7 @@ function isTileJSONSpecification(spec) {
3899
4112
  throw Error('spec.bounds[1] must be smaller than spec.bounds[3]');
3900
4113
  }
3901
4114
  if (obj.center != null) {
3902
- if (!Array.isArray(obj.center) || obj.center.length !== 2 || obj.center.some(num => typeof num !== 'number')) {
4115
+ if (!Array.isArray(obj.center) || obj.center.length !== 2 || obj.center.some((num) => typeof num !== 'number')) {
3903
4116
  throw Error('spec.center must be an array of two numbers if present');
3904
4117
  }
3905
4118
  const a = obj.center;
@@ -3908,25 +4121,25 @@ function isTileJSONSpecification(spec) {
3908
4121
  if (a[1] < -90 || a[1] > 90)
3909
4122
  throw Error('spec.center[1] must be between -90 and 90');
3910
4123
  }
3911
- if (obj.data != null && (!Array.isArray(obj.data) || obj.data.some(url => typeof url !== 'string'))) {
4124
+ if (obj.data != null && (!Array.isArray(obj.data) || obj.data.some((url) => typeof url !== 'string'))) {
3912
4125
  throw Error('spec.data must be an array of strings if present');
3913
4126
  }
3914
4127
  if (obj.description != null && typeof obj.description !== 'string') {
3915
4128
  throw Error('spec.description must be a string if present');
3916
4129
  }
3917
- if (obj.fillzoom != null && (typeof obj.fillzoom !== 'number' || (obj.fillzoom < 0))) {
4130
+ if (obj.fillzoom != null && (typeof obj.fillzoom !== 'number' || obj.fillzoom < 0)) {
3918
4131
  throw Error('spec.fillzoom must be a positive integer if present');
3919
4132
  }
3920
- if (obj.grids != null && (!Array.isArray(obj.grids) || obj.grids.some(url => typeof url !== 'string'))) {
4133
+ if (obj.grids != null && (!Array.isArray(obj.grids) || obj.grids.some((url) => typeof url !== 'string'))) {
3921
4134
  throw Error('spec.grids must be an array of strings if present');
3922
4135
  }
3923
4136
  if (obj.legend != null && typeof obj.legend !== 'string') {
3924
4137
  throw Error('spec.legend must be a string if present');
3925
4138
  }
3926
- if (obj.minzoom != null && (typeof obj.minzoom !== 'number' || (obj.minzoom < 0))) {
4139
+ if (obj.minzoom != null && (typeof obj.minzoom !== 'number' || obj.minzoom < 0)) {
3927
4140
  throw Error('spec.minzoom must be a positive integer if present');
3928
4141
  }
3929
- if (obj.maxzoom != null && (typeof obj.maxzoom !== 'number' || (obj.maxzoom < 0))) {
4142
+ if (obj.maxzoom != null && (typeof obj.maxzoom !== 'number' || obj.maxzoom < 0)) {
3930
4143
  throw Error('spec.maxzoom must be a positive integer if present');
3931
4144
  }
3932
4145
  if (obj.name != null && typeof obj.name !== 'string') {
@@ -3938,7 +4151,7 @@ function isTileJSONSpecification(spec) {
3938
4151
  if (obj.template != null && typeof obj.template !== 'string') {
3939
4152
  throw Error('spec.template must be a string if present');
3940
4153
  }
3941
- if (!Array.isArray(obj.tiles) || obj.tiles.length === 0 || obj.tiles.some(url => typeof url !== 'string')) {
4154
+ if (!Array.isArray(obj.tiles) || obj.tiles.length === 0 || obj.tiles.some((url) => typeof url !== 'string')) {
3942
4155
  throw Error('spec.tiles must be an array of strings');
3943
4156
  }
3944
4157
  return true;
@@ -3946,7 +4159,7 @@ function isTileJSONSpecification(spec) {
3946
4159
  function isRasterTileJSONSpecification(spec) {
3947
4160
  if (!isTileJSONSpecification(spec))
3948
4161
  ;
3949
- if (('vector_layers' in spec) && (spec.vector_layers != null))
4162
+ if ('vector_layers' in spec && spec.vector_layers != null)
3950
4163
  return false;
3951
4164
  return true;
3952
4165
  }
@@ -3966,7 +4179,7 @@ function guessStyle(tileJSON, options) {
3966
4179
  tileJSON = deepClone(tileJSON);
3967
4180
  if (options && options.baseUrl) {
3968
4181
  const { baseUrl } = options;
3969
- tileJSON.tiles = tileJSON.tiles.map(url => resolveUrl(baseUrl, url));
4182
+ tileJSON.tiles = tileJSON.tiles.map((url) => resolveUrl(baseUrl, url));
3970
4183
  }
3971
4184
  if (!isTileJSONSpecification(tileJSON))
3972
4185
  ;
@@ -3995,9 +4208,36 @@ function isShortbread(spec) {
3995
4208
  return false;
3996
4209
  if (!Array.isArray(spec.vector_layers))
3997
4210
  return false;
3998
- const layerIds = new Set(spec.vector_layers.map(l => String(l.id)));
3999
- const shortbreadIds = ['place_labels', 'boundaries', 'boundary_labels', 'addresses', 'water_lines', 'water_lines_labels', 'dam_lines', 'dam_polygons', 'pier_lines', 'pier_polygons', 'bridges', 'street_polygons', 'streets_polygons_labels', 'ferries', 'streets', 'street_labels', 'street_labels_points', 'aerialways', 'public_transport', 'buildings', 'water_polygons', 'ocean', 'water_polygons_labels', 'land', 'sites', 'pois'];
4000
- return shortbreadIds.every(id => layerIds.has(id));
4211
+ const layerIds = new Set(spec.vector_layers.map((l) => String(l.id)));
4212
+ const shortbreadIds = [
4213
+ 'place_labels',
4214
+ 'boundaries',
4215
+ 'boundary_labels',
4216
+ 'addresses',
4217
+ 'water_lines',
4218
+ 'water_lines_labels',
4219
+ 'dam_lines',
4220
+ 'dam_polygons',
4221
+ 'pier_lines',
4222
+ 'pier_polygons',
4223
+ 'bridges',
4224
+ 'street_polygons',
4225
+ 'streets_polygons_labels',
4226
+ 'ferries',
4227
+ 'streets',
4228
+ 'street_labels',
4229
+ 'street_labels_points',
4230
+ 'aerialways',
4231
+ 'public_transport',
4232
+ 'buildings',
4233
+ 'water_polygons',
4234
+ 'ocean',
4235
+ 'water_polygons_labels',
4236
+ 'land',
4237
+ 'sites',
4238
+ 'pois',
4239
+ ];
4240
+ return shortbreadIds.every((id) => layerIds.has(id));
4001
4241
  }
4002
4242
  function getShortbreadStyle(spec, builderOption) {
4003
4243
  return colorful({
@@ -4027,7 +4267,7 @@ function getShortbreadStyle(spec, builderOption) {
4027
4267
  function getInspectorStyle(spec) {
4028
4268
  const sourceName = 'vectorSource';
4029
4269
  const layers = { background: [], circle: [], line: [], fill: [] };
4030
- layers.background.push({ 'id': 'background', 'type': 'background', 'paint': { 'background-color': '#fff' } });
4270
+ layers.background.push({ id: 'background', type: 'background', paint: { 'background-color': '#fff' } });
4031
4271
  spec.vector_layers.forEach((vector_layer) => {
4032
4272
  let luminosity = 'bright', saturation, hue;
4033
4273
  if (/water|ocean|lake|sea|river/.test(vector_layer.id))
@@ -4086,12 +4326,7 @@ function getInspectorStyle(spec) {
4086
4326
  sources: {
4087
4327
  [sourceName]: sourceFromSpec(spec, 'vector'),
4088
4328
  },
4089
- layers: [
4090
- ...layers.background,
4091
- ...layers.fill,
4092
- ...layers.line,
4093
- ...layers.circle,
4094
- ],
4329
+ layers: [...layers.background, ...layers.fill, ...layers.line, ...layers.circle],
4095
4330
  };
4096
4331
  }
4097
4332
  function getRasterStyle(spec) {
@@ -4101,11 +4336,13 @@ function getRasterStyle(spec) {
4101
4336
  sources: {
4102
4337
  [sourceName]: sourceFromSpec(spec, 'raster'),
4103
4338
  },
4104
- layers: [{
4339
+ layers: [
4340
+ {
4105
4341
  id: 'raster',
4106
4342
  type: 'raster',
4107
4343
  source: sourceName,
4108
- }],
4344
+ },
4345
+ ],
4109
4346
  };
4110
4347
  }
4111
4348
  function sourceFromSpec(spec, type) {