@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.
@@ -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
- ].map((el) => {
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',
@@ -5,6 +5,9 @@ const opts = {
5
5
  },
6
6
  roads: {
7
7
  showLabels: true
8
+ },
9
+ admin: {
10
+ show: true
8
11
  }
9
12
  };
10
13
  export default opts;
@@ -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
  };
@@ -1 +1,6 @@
1
+ var AdminLevel;
2
+ (function (AdminLevel) {
3
+ AdminLevel[AdminLevel["COUNTRY"] = 2] = "COUNTRY";
4
+ AdminLevel[AdminLevel["BUNDESLAND"] = 4] = "BUNDESLAND";
5
+ })(AdminLevel || (AdminLevel = {}));
1
6
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@swr-data-lab/components",
3
3
  "description": "SWR Data Lab component library",
4
- "version": "2.36.0",
4
+ "version": "2.37.0",
5
5
  "author": "SWR Data Lab",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",