@swr-data-lab/components 2.18.1 → 2.19.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.
@@ -4,7 +4,7 @@ import { createMapContext, MapContext } from '../context.svelte.js';
4
4
  import {} from '../types';
5
5
  import FallbackStyle from './FallbackStyle';
6
6
  import { de } from './locale';
7
- let { children, options, style = FallbackStyle, minZoom = 0, maxZoom = 14.99, zoom = $bindable(), center = $bindable(), pitch = $bindable(0), bearing = $bindable(0), loading = $bindable(true), projection = { type: 'mercator' }, allowRotation = false, allowZoom = true, showDebug = false, cursor, initialLocation: receivedInitialLocation,
7
+ let { children, options, style = FallbackStyle, minZoom = 0, maxZoom = 14.99, zoom = $bindable(), center = $bindable(), pitch = $bindable(0), bearing = $bindable(0), loading = $bindable(true), projection = { type: 'mercator' }, allowRotation = false, allowZoom = true, showDebug = false, cursor, initialBounds, maxBounds, initialLocation: receivedInitialLocation,
8
8
  // Future: This should become bindable.readonly when that becomes
9
9
  // available, see: https://github.com/sveltejs/svelte/issues/7712
10
10
  mapContext = $bindable(), cooperativeGestures = false, onmoveend, onmovestart } = $props();
@@ -29,8 +29,10 @@ onMount(() => {
29
29
  minZoom,
30
30
  maxZoom,
31
31
  bearing,
32
- attributionControl: false, // Added via component
32
+ attributionControl: false,
33
33
  center: [initialLocation.lng, initialLocation.lat],
34
+ bounds: initialBounds || null,
35
+ maxBounds: maxBounds || null,
34
36
  zoom: initialLocation.zoom,
35
37
  pitch: initialLocation.pitch,
36
38
  cooperativeGestures,
@@ -1,9 +1,14 @@
1
- import maplibre, { type MapLibreEvent, type ProjectionSpecification, type StyleSpecification } from 'maplibre-gl';
1
+ import maplibre, { type LngLatBoundsLike, type MapLibreEvent, type ProjectionSpecification, type StyleSpecification } from 'maplibre-gl';
2
2
  import { type Snippet } from 'svelte';
3
3
  import { MapContext } from '../context.svelte.js';
4
4
  import { type Location } from '../types';
5
5
  interface MapProps {
6
6
  style?: StyleSpecification | string;
7
+ /**
8
+ * The initial bounds of the map. If specified, it overrides initialLocation.
9
+ */
10
+ initialBounds?: LngLatBoundsLike;
11
+ maxBounds?: LngLatBoundsLike;
7
12
  initialLocation?: Location;
8
13
  allowRotation?: boolean;
9
14
  allowZoom?: boolean;
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.18.1",
4
+ "version": "2.19.0",
5
5
  "author": "SWR Data Lab",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "svelte": ">=5.0.0"
32
32
  },
33
33
  "dependencies": {
34
- "@maplibre/maplibre-gl-geocoder": "^1.8.0",
34
+ "@maplibre/maplibre-gl-geocoder": "^1.9.1",
35
35
  "maplibre-gl": "^5.7.0",
36
36
  "svelte-select": "^5.8.3"
37
37
  },