@versatiles/style 5.0.0 → 5.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 VersaTiles
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -110,29 +110,40 @@ export function getShortbreadLayers(option) {
110
110
  ...['tunnel', 'street', 'bridge'].flatMap((c) => {
111
111
  let filter;
112
112
  let prefix;
113
+ let suffixes = [];
113
114
  const results = [];
114
115
  switch (c) {
115
116
  case 'tunnel':
116
117
  filter = [['==', 'tunnel', true]];
117
118
  prefix = 'tunnel-';
119
+ suffixes = [':outline', ''];
118
120
  break;
119
121
  case 'street':
120
122
  filter = [['!=', 'bridge', true], ['!=', 'tunnel', true]];
121
123
  prefix = '';
124
+ suffixes = [':outline', ''];
122
125
  break;
123
126
  case 'bridge':
124
127
  filter = [['==', 'bridge', true]];
125
128
  prefix = 'bridge-';
129
+ suffixes = [':bridge', ':outline', ''];
126
130
  break;
127
131
  }
128
- // bridges, above street, below bridge
129
- if (c === 'bridge')
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')
130
141
  results.push({
131
142
  id: 'bridge',
132
143
  type: 'fill',
133
144
  'source-layer': 'bridges',
134
145
  });
135
- [':outline', ''].forEach(suffix => {
146
+ suffixes.forEach(suffix => {
136
147
  // pedestrian zone — no outline
137
148
  if (suffix === ':outline')
138
149
  results.push({
@@ -317,6 +317,47 @@ export default class Colorful extends StyleBuilder {
317
317
  'bridge-{street,way}-*:outline': {
318
318
  lineCap: 'butt',
319
319
  },
320
+ // faux bridges
321
+ 'bridge-{street,way}-*:bridge': {
322
+ lineCap: 'butt',
323
+ lineJoin: 'round',
324
+ color: colors.land.darken(0.02),
325
+ fillAntialias: true,
326
+ opacity: 0.5,
327
+ },
328
+ 'bridge-street-motorway:bridge': {
329
+ size: { '5': 0, '6': 3, '10': 7, '14': 7, '16': 20, '18': 53, '19': 118, '20': 235 }
330
+ },
331
+ 'bridge-street-trunk:bridge': {
332
+ size: { '7': 0, '8': 3, '10': 6, '14': 8, '16': 17, '18': 50, '19': 104, '20': 202 }
333
+ },
334
+ 'bridge-street-primary:bridge': {
335
+ size: { '8': 0, '9': 1, '10': 6, '14': 8, '16': 17, '18': 50, '19': 104, '20': 202 }
336
+ },
337
+ 'bridge-street-secondary:bridge': {
338
+ size: { '11': 3, '14': 7, '16': 11, '18': 42, '19': 95, '20': 193 },
339
+ opacity: { '11': 0, '12': 1 }
340
+ },
341
+ 'bridge-street-motorway-link:bridge': {
342
+ minzoom: 12,
343
+ size: { '12': 3, '14': 4, '16': 10, '18': 20, '20': 56 }
344
+ },
345
+ 'bridge-street-{trunk,primary,secondary}-link:bridge': {
346
+ minzoom: 13,
347
+ size: { '12': 3, '14': 4, '16': 10, '18': 20, '20': 56 }
348
+ },
349
+ 'bridge-street-{tertiary,tertiary-link,unclassified,residential,livingstreet,pedestrian}*:bridge': {
350
+ size: { '12': 3, '14': 4, '16': 8, '18': 36, '19': 90, '20': 179 },
351
+ opacity: { '12': 0, '13': 1 }
352
+ },
353
+ 'bridge-street-{service,track}:bridge': {
354
+ size: { '14': 3, '16': 6, '18': 25, '19': 67, '20': 134 },
355
+ opacity: { '14': 0, '15': 1 }
356
+ },
357
+ 'bridge-way-*:bridge': {
358
+ size: { '15': 0, '16': 7, '18': 10, '19': 17, '20': 31 },
359
+ minzoom: 15
360
+ },
320
361
  // special color: motorway
321
362
  '{bridge-,}street-motorway{-link,}:outline': {
322
363
  color: colors.motorwaybg,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versatiles/style",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "Generate StyleJSON for MapLibre",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -38,36 +38,36 @@
38
38
  "dist/**/*.d.ts"
39
39
  ],
40
40
  "devDependencies": {
41
- "@maplibre/maplibre-gl-style-spec": "^21.2.0",
42
- "@rollup/plugin-commonjs": "^28.0.1",
43
- "@rollup/plugin-node-resolve": "^15.3.0",
41
+ "@maplibre/maplibre-gl-style-spec": "^23.0.0",
42
+ "@rollup/plugin-commonjs": "^28.0.2",
43
+ "@rollup/plugin-node-resolve": "^16.0.0",
44
44
  "@rollup/plugin-terser": "^0.4.4",
45
- "@rollup/plugin-typescript": "^12.1.1",
45
+ "@rollup/plugin-typescript": "^12.1.2",
46
46
  "@types/bin-pack": "^1.0.3",
47
47
  "@types/brace-expansion": "^1.1.2",
48
48
  "@types/inquirer": "^9.0.7",
49
49
  "@types/jest": "^29.5.14",
50
- "@types/node": "^22.9.0",
50
+ "@types/node": "^22.10.6",
51
51
  "@types/tar-stream": "^3.1.3",
52
- "@typescript-eslint/eslint-plugin": "^8.14.0",
53
- "@typescript-eslint/parser": "^8.14.0",
52
+ "@typescript-eslint/eslint-plugin": "^8.20.0",
53
+ "@typescript-eslint/parser": "^8.20.0",
54
54
  "@versatiles/container": "^1.2.3",
55
55
  "@versatiles/release-tool": "^1.2.6",
56
56
  "bin-pack": "^1.0.2",
57
- "eslint": "^9.14.0",
58
- "inquirer": "^12.1.0",
57
+ "eslint": "^9.18.0",
58
+ "inquirer": "^12.3.2",
59
59
  "jest": "^29.7.0",
60
60
  "jest-environment-jsdom": "^29.7.0",
61
61
  "jest-ts-webcompat-resolver": "^1.0.0",
62
- "npm-check-updates": "^17.1.11",
63
- "rollup": "^4.26.0",
62
+ "npm-check-updates": "^17.1.13",
63
+ "rollup": "^4.30.1",
64
64
  "rollup-plugin-dts": "^6.1.1",
65
65
  "sharp": "^0.33.5",
66
66
  "tar-stream": "^3.1.7",
67
67
  "ts-jest": "^29.2.5",
68
68
  "ts-node": "^10.9.2",
69
69
  "tsx": "^4.19.2",
70
- "typescript": "^5.6.3",
71
- "typescript-eslint": "^8.14.0"
70
+ "typescript": "^5.7.3",
71
+ "typescript-eslint": "^8.20.0"
72
72
  }
73
73
  }