@swr-data-lab/components 2.36.0 → 2.37.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/dist/maplibre/MapStyle/SWRDataLabDark.js +1 -1
- package/dist/maplibre/MapStyle/SWRDataLabLight.js +1 -1
- package/dist/maplibre/MapStyle/components/Admin.d.ts +1 -1
- package/dist/maplibre/MapStyle/components/Admin.js +16 -2
- package/dist/maplibre/MapStyle/defaultOptions.js +3 -0
- package/dist/maplibre/MapStyle/types.d.ts +7 -0
- package/dist/maplibre/MapStyle/types.js +5 -0
- package/package.json +1 -1
|
@@ -45,7 +45,6 @@ const tokens = {
|
|
|
45
45
|
};
|
|
46
46
|
const { landuse } = makeLanduse(tokens);
|
|
47
47
|
const { placeLabels, boundaryLabels } = makePlaceLabels(tokens);
|
|
48
|
-
const { admin } = makeAdmin(tokens);
|
|
49
48
|
const { airports, transitBridges, transitSurface, transitTunnels } = makeTransit(tokens);
|
|
50
49
|
const { walkingLabels, walkingTunnels, walkingSurface, walkingBridges } = makeWalking(tokens);
|
|
51
50
|
const { roadLabels, roadBridges, roadSurface, roadTunnels } = makeRoads(tokens);
|
|
@@ -56,6 +55,7 @@ const style = (opts) => {
|
|
|
56
55
|
...defaultOptions,
|
|
57
56
|
...opts
|
|
58
57
|
};
|
|
58
|
+
const { admin } = makeAdmin(tokens, options?.admin);
|
|
59
59
|
return {
|
|
60
60
|
version: 8,
|
|
61
61
|
name: 'swr-datalab-dark',
|
|
@@ -45,7 +45,6 @@ const tokens = {
|
|
|
45
45
|
};
|
|
46
46
|
const { landuse } = makeLanduse(tokens);
|
|
47
47
|
const { placeLabels, boundaryLabels } = makePlaceLabels(tokens);
|
|
48
|
-
const { admin } = makeAdmin(tokens);
|
|
49
48
|
const { airports, transitBridges, transitSurface, transitTunnels } = makeTransit(tokens);
|
|
50
49
|
const { walkingLabels, walkingTunnels, walkingSurface, walkingBridges } = makeWalking(tokens);
|
|
51
50
|
const { roadLabels, roadBridges, roadSurface, roadTunnels } = makeRoads(tokens);
|
|
@@ -56,6 +55,7 @@ const style = (opts) => {
|
|
|
56
55
|
...defaultOptions,
|
|
57
56
|
...opts
|
|
58
57
|
};
|
|
58
|
+
const { admin } = makeAdmin(tokens, options?.admin);
|
|
59
59
|
return {
|
|
60
60
|
version: 8,
|
|
61
61
|
name: 'swr-datalab-light',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function makeAdmin(tokens: any): any;
|
|
1
|
+
export default function makeAdmin(tokens: any, options: any): any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {} from '../../types';
|
|
2
|
-
export default function makeAdmin(tokens) {
|
|
2
|
+
export default function makeAdmin(tokens, options) {
|
|
3
3
|
const admin = [
|
|
4
4
|
{
|
|
5
5
|
id: 'boundary-country:case',
|
|
@@ -133,7 +133,21 @@ export default function makeAdmin(tokens) {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
]
|
|
136
|
+
]
|
|
137
|
+
.filter((el) => {
|
|
138
|
+
if (!options || options.show === true) {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
else if (options.show === false) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
return ((el.id.includes('country') && options.show.includes(2)) ||
|
|
146
|
+
(el.id.includes('state') && options.show.includes(4)));
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
})
|
|
150
|
+
.map((el) => {
|
|
137
151
|
return {
|
|
138
152
|
source: 'versatiles-osm',
|
|
139
153
|
'source-layer': 'boundaries',
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
declare enum AdminLevel {
|
|
2
|
+
COUNTRY = 2,
|
|
3
|
+
BUNDESLAND = 4
|
|
4
|
+
}
|
|
1
5
|
interface StyleOptions {
|
|
2
6
|
enableBuildingExtrusions?: boolean;
|
|
3
7
|
enableHillshade?: boolean;
|
|
4
8
|
places?: {
|
|
5
9
|
showLabels?: boolean;
|
|
6
10
|
};
|
|
11
|
+
admin?: {
|
|
12
|
+
show?: boolean | AdminLevel[];
|
|
13
|
+
};
|
|
7
14
|
roads?: {
|
|
8
15
|
showLabels?: boolean;
|
|
9
16
|
};
|