@swr-data-lab/components 3.0.0 → 3.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.
@@ -7,26 +7,32 @@ import makeWalking from './components/Walking';
7
7
  import makeRoads from './components/Roads';
8
8
  import defaultOptions from './defaultOptions';
9
9
  import makeHillshade from './components/Hillshade';
10
+ const water = {
11
+ stops: [
12
+ [6, 'white'],
13
+ [6.5, 'hsl(216, 50%, 92%)']
14
+ ]
15
+ };
10
16
  const tokens = {
11
17
  sans_regular: ['swr_sans_regular'],
12
18
  sans_medium: ['swr_sans_medium'],
13
19
  sans_bold: ['swr_sans_bold'],
14
20
  background: {
15
21
  stops: [
16
- [8, 'hsl(24, 29%, 98%)'],
17
- [10, 'white']
22
+ [6, 'hsl(24, 20%, 96%)'],
23
+ [6.5, 'hsl(24, 10%, 99%)']
18
24
  ]
19
25
  },
20
- water: 'hsl(212, 71%, 83%)',
21
- water_light: 'hsl(212, 41%, 90%)',
22
- water_ocean: 'hsl(212, 60%, 83%)',
23
- marsh: 'hsl(200, 14%, 97%)',
26
+ water,
27
+ water_light: water,
28
+ water_ocean: water,
29
+ marsh: 'hsl(200, 14%, 93%)',
24
30
  grass: 'hsl(133, 36%, 95%)',
25
31
  grass_dark: 'hsl(127, 49%, 93%)',
26
32
  sand: 'hsl(60, 0%, 95%)',
27
33
  rock: 'hsl(192, 0%, 90%)',
28
34
  street_primary: 'hsl(0, 4%, 95%)',
29
- street_primary_faded: 'hsl(0, 4%, 96%)',
35
+ street_primary_faded: 'hsl(0, 4%, 90%)',
30
36
  street_primary_case: 'hsl(240, 1%, 84%)',
31
37
  street_secondary: 'hsl(0, 0%, 95%)',
32
38
  street_secondary_case: 'hsl(0, 0%, 75%)',
@@ -34,7 +40,7 @@ const tokens = {
34
40
  street_tertiary_case: 'hsl(0, 0%, 70%)',
35
41
  label_primary: 'hsl(240, 10%, 2%)',
36
42
  label_secondary: 'hsl(0, 0%, 18%)',
37
- label_tertiary: 'hsl(60, 1%, 50%)',
43
+ label_tertiary: 'hsl(60, 1%, 25%)',
38
44
  building: '#f3f2f1',
39
45
  rail: '#d3d3d3',
40
46
  boundary_country: '#8b8a89',
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">import { onDestroy } from 'svelte';
2
- import {} from 'maplibre-gl';
3
- import { getMapContext, createSourceContext } from '../context.svelte.js';
2
+ import { VectorTileSource } from 'maplibre-gl';
3
+ import { getMapContext, createSourceContext, SourceContext } from '../context.svelte.js';
4
4
  let { id, sourceSpec, source = $bindable(), children } = $props();
5
- let firstRun = true;
5
+ let firstRun = $state(true);
6
6
  // Get map context
7
7
  const { map, styleLoaded } = $derived(getMapContext());
8
8
  // Create source context
@@ -16,7 +16,6 @@ $effect(() => {
16
16
  firstRun = false;
17
17
  }
18
18
  });
19
- // 2. Do extra stuff with the source object
20
19
  $effect(() => {
21
20
  if (source && sourceSpec.type === 'geojson') {
22
21
  if (firstRun === false) {
@@ -24,6 +23,16 @@ $effect(() => {
24
23
  }
25
24
  }
26
25
  });
26
+ $effect(() => {
27
+ if (!firstRun && source instanceof VectorTileSource) {
28
+ source.setTiles(sourceSpec.tiles);
29
+ }
30
+ });
31
+ $effect(() => {
32
+ if (!firstRun && source instanceof VectorTileSource) {
33
+ source.setUrl(sourceSpec.url);
34
+ }
35
+ });
27
36
  onDestroy(() => {
28
37
  if (map && styleLoaded) {
29
38
  const layers = map?.getStyle().layers;
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": "3.0.0",
4
+ "version": "3.1.0",
5
5
  "author": "SWR Data Lab",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@maplibre/maplibre-gl-geocoder": "1.9.1",
37
37
  "@maplibre/maplibre-gl-inspect": "1.7.1",
38
- "maplibre-gl": "5.7.0",
38
+ "maplibre-gl": "5.20.0",
39
39
  "svelte-select": "5.8.3"
40
40
  },
41
41
  "devDependencies": {