@swr-data-lab/components 2.5.0 → 2.5.2

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/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export { default as NavigationControl } from "./maplibre/NavigationControl/Navig
18
18
  export { default as ScaleControl } from "./maplibre/ScaleControl/ScaleControl.svelte";
19
19
  export { default as VectorLayer } from "./maplibre/VectorLayer/VectorLayer.svelte";
20
20
  export { default as VectorTileSource } from "./maplibre/VectorTileSource/VectorTileSource.svelte";
21
+ export { default as GeoJSONSource } from "./maplibre/GeoJSONSource/GeoJSONSource.svelte";
21
22
  export { default as Tooltip } from "./maplibre/Tooltip/Tooltip.svelte";
22
23
  export { default as WithLinkLocation } from "./maplibre/WithLinkLocation/WithLinkLocation.svelte";
23
24
  export { default as FormLabel } from "./FormLabel/FormLabel.svelte";
package/dist/index.js CHANGED
@@ -27,6 +27,7 @@ export { default as NavigationControl } from './maplibre/NavigationControl/Navig
27
27
  export { default as ScaleControl } from './maplibre/ScaleControl/ScaleControl.svelte';
28
28
  export { default as VectorLayer } from './maplibre/VectorLayer/VectorLayer.svelte';
29
29
  export { default as VectorTileSource } from './maplibre/VectorTileSource/VectorTileSource.svelte';
30
+ export { default as GeoJSONSource } from './maplibre/GeoJSONSource/GeoJSONSource.svelte';
30
31
  export { default as Tooltip } from './maplibre/Tooltip/Tooltip.svelte';
31
32
  export { default as WithLinkLocation } from './maplibre/WithLinkLocation/WithLinkLocation.svelte';
32
33
 
@@ -4,9 +4,9 @@ import MapSource from '../Source/MapSource.svelte';
4
4
  const { maxZoom = 24, id, data, attribution = '' } = $props();
5
5
  const sourceSpec = {
6
6
  type: 'geojson',
7
- data,
8
7
  maxzoom: maxZoom,
9
- attribution
8
+ attribution,
9
+ data
10
10
  };
11
11
  </script>
12
12
 
@@ -19,7 +19,10 @@ $effect(() => {
19
19
  });
20
20
  // 2. Do extra stuff with the source object
21
21
  $effect(() => {
22
- if (source) {
22
+ if (source && sourceSpec.type === 'geojson') {
23
+ if (!firstRun) {
24
+ source.setData(sourceSpec.data);
25
+ }
23
26
  }
24
27
  });
25
28
  $effect(() => {
@@ -1,6 +1,6 @@
1
1
  import { type Snippet } from 'svelte';
2
2
  import { type Map, type SourceSpecification } from 'maplibre-gl';
3
- type Source = maplibregl.VectorTileSource;
3
+ type Source = maplibregl.VectorTileSource | maplibregl.GeoJSONSource;
4
4
  interface MapSourceProps {
5
5
  id: string;
6
6
  sourceSpec: SourceSpecification;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">import { getMapContext } from '../context.svelte.js';
2
2
  import { onDestroy } from 'svelte';
3
3
  import { resetLayerEventListener } from '../utils.js';
4
- const { id, sourceId, sourceLayer, visible = true, placeBelow = 'label-place-capital', type, paint, layout, hovered = $bindable(), selected = $bindable(), minZoom = 0, maxZoom = 24, onclick, onmousemove, onmouseleave } = $props();
4
+ const { id, sourceId, sourceLayer, visible = true, placeBelow = 'label-place-major-city', type, paint, layout, hovered = $bindable(), selected = $bindable(), minZoom = 0, maxZoom = 24, onclick, onmousemove, onmouseleave } = $props();
5
5
  const { map, styleLoaded } = $derived(getMapContext());
6
6
  let beforeId = $state();
7
7
  let prevSelected = $state();
@@ -4,7 +4,7 @@ interface VectorLayerProps {
4
4
  sourceId: string;
5
5
  sourceLayer?: string;
6
6
  type: 'line' | 'fill' | 'circle' | 'symbol';
7
- placeBelow: string;
7
+ placeBelow?: string;
8
8
  visible?: boolean;
9
9
  minZoom?: number;
10
10
  maxZoom?: number;
@@ -12,9 +12,9 @@ interface VectorLayerProps {
12
12
  layout?: LineLayoutProps | FillLayoutProps | CircleLayoutProps | SymbolLayoutProps;
13
13
  hovered?: MapGeoJSONFeature | undefined;
14
14
  selected?: MapGeoJSONFeature | undefined;
15
- onclick: (e: MapLayerMouseEvent) => any;
16
- onmousemove: (e: MapLayerMouseEvent) => any;
17
- onmouseleave: (e: MapLayerMouseEvent) => any;
15
+ onclick?: (e: MapLayerMouseEvent) => any;
16
+ onmousemove?: (e: MapLayerMouseEvent) => any;
17
+ onmouseleave?: (e: MapLayerMouseEvent) => any;
18
18
  }
19
19
  declare const VectorLayer: import("svelte").Component<VectorLayerProps, {}, "hovered" | "selected">;
20
20
  type VectorLayer = ReturnType<typeof VectorLayer>;
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.5.0",
4
+ "version": "2.5.2",
5
5
  "author": "SWR Data Lab",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -32,40 +32,40 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@maplibre/maplibre-gl-geocoder": "^1.8.0",
35
- "maplibre-gl": "^5.5.0",
35
+ "maplibre-gl": "^5.7.0",
36
36
  "svelte-select": "^5.8.3"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@semantic-release/changelog": "^6.0.3",
40
40
  "@semantic-release/git": "^10.0.1",
41
41
  "@semantic-release/npm": "^12.0.2",
42
- "@storybook/addon-docs": "^9.1.2",
43
- "@storybook/addon-links": "^9.1.2",
44
- "@storybook/addon-svelte-csf": "^5.0.7",
45
- "@storybook/addon-vitest": "^9.1.2",
46
- "@storybook/sveltekit": "^9.1.2",
42
+ "@storybook/addon-docs": "^9.1.4",
43
+ "@storybook/addon-links": "^9.1.4",
44
+ "@storybook/addon-svelte-csf": "^5.0.8",
45
+ "@storybook/addon-vitest": "^9.1.4",
46
+ "@storybook/sveltekit": "^9.1.4",
47
47
  "@storybook/test-runner": "^0.23.0",
48
48
  "@sveltejs/adapter-auto": "^6.0.1",
49
49
  "@sveltejs/kit": "^2.27.0",
50
50
  "@sveltejs/package": "^2.4.0",
51
51
  "@sveltejs/vite-plugin-svelte": "^6.1.0",
52
52
  "@types/geojson": "^7946.0.16",
53
- "@versatiles/style": "^5.6.0",
53
+ "@versatiles/style": "^5.7.0",
54
54
  "@vitest/browser": "^3.2.4",
55
55
  "@vitest/coverage-v8": "^3.2.4",
56
- "concurrently": "^9.2.0",
56
+ "concurrently": "^9.2.1",
57
57
  "http-server": "^14.1.1",
58
58
  "mdx-mermaid": "^2.0.3",
59
- "playwright": "^1.54.2",
59
+ "playwright": "^1.55.0",
60
60
  "publint": "^0.3.12",
61
- "sass": "^1.89.1",
61
+ "sass": "^1.91.0",
62
62
  "sass-embedded": "^1.89.2",
63
63
  "semantic-release": "^24.2.7",
64
- "storybook": "^9.1.2",
64
+ "storybook": "^9.1.4",
65
65
  "svelte": "^5.23.0",
66
66
  "svelte-check": "^4.0.0",
67
67
  "svelte-preprocess": "^6.0.3",
68
- "typescript": "^5.8.3",
68
+ "typescript": "^5.9.2",
69
69
  "vite": "^6.0.0",
70
70
  "vitest": "^3.1.1",
71
71
  "wait-on": "^8.0.1"