diff --git a/components/package.json b/components/package.json index 545b5ed4..a84b7bb7 100644 --- a/components/package.json +++ b/components/package.json @@ -49,6 +49,7 @@ "@sveltejs/kit": "^2.22.2", "@sveltejs/package": "^2.3.12", "@sveltejs/vite-plugin-svelte": "^5.1.0", + "@types/geojson": "^7946.0.16", "@versatiles/style": "^5.6.0", "@vitest/browser": "^3.2.4", "@vitest/coverage-v8": "^3.2.4", @@ -61,9 +62,9 @@ "sass-embedded": "^1.89.2", "semantic-release": "^24.2.6", "storybook": "^9.0.15", - "svelte-preprocess": "^6.0.3", "svelte": "^5.23.0", "svelte-check": "^4.0.0", + "svelte-preprocess": "^6.0.3", "typescript": "^5.8.3", "vite": "^6.0.0", "vitest": "^3.1.1", diff --git a/components/src/maplibre/GeoJSONSource/GeoJSONSource.mdx b/components/src/maplibre/GeoJSONSource/GeoJSONSource.mdx new file mode 100644 index 00000000..cacf5af0 --- /dev/null +++ b/components/src/maplibre/GeoJSONSource/GeoJSONSource.mdx @@ -0,0 +1,44 @@ +import { Story, Meta, Primary, Controls, Stories } from '@storybook/addon-docs/blocks'; + +import * as GeoJSONSourceStories from './GeoJSONSource.stories.svelte'; + + + +# GeoJSONSource + +Loads vector data from a [GeoJSON](https://geojson.org/) object or file. + +```js + + + + + + + +``` + + diff --git a/components/src/maplibre/GeoJSONSource/GeoJSONSource.stories.svelte b/components/src/maplibre/GeoJSONSource/GeoJSONSource.stories.svelte new file mode 100644 index 00000000..26031d4d --- /dev/null +++ b/components/src/maplibre/GeoJSONSource/GeoJSONSource.stories.svelte @@ -0,0 +1,62 @@ + + + + +
+ + + + + +
+
+
+ + diff --git a/components/src/maplibre/GeoJSONSource/GeoJSONSource.svelte b/components/src/maplibre/GeoJSONSource/GeoJSONSource.svelte new file mode 100644 index 00000000..9cf1a230 --- /dev/null +++ b/components/src/maplibre/GeoJSONSource/GeoJSONSource.svelte @@ -0,0 +1,29 @@ + + + diff --git a/components/src/maplibre/GeoJSONSource/index.js b/components/src/maplibre/GeoJSONSource/index.js new file mode 100644 index 00000000..786015f2 --- /dev/null +++ b/components/src/maplibre/GeoJSONSource/index.js @@ -0,0 +1,2 @@ +import GeoJSONSource from './GeoJSONSource.svelte'; +export default GeoJSONSource; diff --git a/components/src/maplibre/MapStyle/SWRDataLabLight.stories.svelte b/components/src/maplibre/MapStyle/SWRDataLabLight.stories.svelte index 256b001e..7782a9c4 100644 --- a/components/src/maplibre/MapStyle/SWRDataLabLight.stories.svelte +++ b/components/src/maplibre/MapStyle/SWRDataLabLight.stories.svelte @@ -34,7 +34,6 @@ ``` + + diff --git a/components/src/maplibre/VectorTileSource/VectorTileSource.stories.svelte b/components/src/maplibre/VectorTileSource/VectorTileSource.stories.svelte index b36a3c6c..03269e39 100644 --- a/components/src/maplibre/VectorTileSource/VectorTileSource.stories.svelte +++ b/components/src/maplibre/VectorTileSource/VectorTileSource.stories.svelte @@ -20,6 +20,7 @@ - import { type Snippet } from 'svelte'; import { type SourceSpecification } from 'maplibre-gl'; import MapSource from '../Source/MapSource.svelte'; @@ -8,16 +7,20 @@ url: string; minZoom?: number; maxZoom?: number; - children?: Snippet; + /** + * Attribution string for your data, usually rendered using an `` + */ + attribution?: string; } - const { minZoom = 0, maxZoom = 24, id, url }: VectorTileSourceProps = $props(); + const { minZoom = 0, maxZoom = 24, id, url, attribution = '' }: VectorTileSourceProps = $props(); const sourceSpec: SourceSpecification = { type: 'vector', tiles: [url], maxzoom: maxZoom, - minzoom: minZoom + minzoom: minZoom, + attribution }; diff --git a/package-lock.json b/package-lock.json index 1981bf52..4a5f334d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,6 +38,7 @@ "@sveltejs/kit": "^2.22.2", "@sveltejs/package": "^2.3.12", "@sveltejs/vite-plugin-svelte": "^5.1.0", + "@types/geojson": "^7946.0.16", "@versatiles/style": "^5.6.0", "@vitest/browser": "^3.2.4", "@vitest/coverage-v8": "^3.2.4",