From 939c24bbcd2c6aa8982f94af8c0b2800561d1ee5 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Thu, 17 Oct 2024 21:05:31 +0100 Subject: [PATCH 1/4] fix: allow passing style prop to ControlButton --- src/lib/ControlButton.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ControlButton.svelte b/src/lib/ControlButton.svelte index bba5d1e..4baed56 100644 --- a/src/lib/ControlButton.svelte +++ b/src/lib/ControlButton.svelte @@ -9,7 +9,7 @@ export { classNames as class }; - + {/each} + + + + diff --git a/src/lib/index.ts b/src/lib/index.ts index 4e77606..d94f12a 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -26,6 +26,7 @@ export { default as RasterLayer } from './RasterLayer.svelte'; export { default as RasterDEMTileSource } from './RasterDEMTileSource.svelte'; export { default as RasterTileSource } from './RasterTileSource.svelte'; export { default as ScaleControl } from './ScaleControl.svelte'; +export { default as StyleSelectControl } from './StyleSelectControl.svelte'; export { default as SymbolLayer } from './SymbolLayer.svelte'; export { default as Terrain } from './Terrain.svelte'; export { default as TerrainControl } from './TerrainControl.svelte'; From bd6e575f3e3513cc0630eb38f66fbd9fe9d2ff9c Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Thu, 17 Oct 2024 21:24:31 +0100 Subject: [PATCH 3/4] docs: add example for StyleSelectControl with different input types --- src/routes/NavBar.svelte | 1 + .../examples/style_selector/+page.svelte | 108 ++++++++++++++++++ src/routes/examples/style_selector/+page.ts | 7 ++ 3 files changed, 116 insertions(+) create mode 100644 src/routes/examples/style_selector/+page.svelte create mode 100644 src/routes/examples/style_selector/+page.ts diff --git a/src/routes/NavBar.svelte b/src/routes/NavBar.svelte index fc3cbbb..4d124fc 100644 --- a/src/routes/NavBar.svelte +++ b/src/routes/NavBar.svelte @@ -21,6 +21,7 @@ { href: '/examples/geojson_line_layer', title: `Styled Line` }, { href: '/examples/heatmap', title: `Heatmap` }, { href: '/examples/controls', title: `Controls` }, + { href: '/examples/style_selector', title: `Style Selector` }, { href: '/examples/clusters', title: `Clusters and Popups` }, { href: '/examples/custom_marker_clusters', title: `Custom Markers and Clusters` }, { href: '/examples/image_symbols', title: `Images in a Symbol Layer` }, diff --git a/src/routes/examples/style_selector/+page.svelte b/src/routes/examples/style_selector/+page.svelte new file mode 100644 index 0000000..8953b79 --- /dev/null +++ b/src/routes/examples/style_selector/+page.svelte @@ -0,0 +1,108 @@ + + +

Select a different style by hovering over the map thumbnail.

+ + + + + + diff --git a/src/routes/examples/style_selector/+page.ts b/src/routes/examples/style_selector/+page.ts new file mode 100644 index 0000000..d18f817 --- /dev/null +++ b/src/routes/examples/style_selector/+page.ts @@ -0,0 +1,7 @@ +import type { PageLoad } from './$types'; + +export const load: PageLoad = () => { + return { + title: 'Style Selector', + }; +}; From c39d6422cf2b68f5c198c579fde3bbfecac140a3 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Thu, 17 Oct 2024 21:24:42 +0100 Subject: [PATCH 4/4] docs: add changeset for StyleSelectControl addition --- .changeset/odd-beers-think.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/odd-beers-think.md diff --git a/.changeset/odd-beers-think.md b/.changeset/odd-beers-think.md new file mode 100644 index 0000000..dcce990 --- /dev/null +++ b/.changeset/odd-beers-think.md @@ -0,0 +1,5 @@ +--- +"svelte-maplibre": minor +--- + +add StyleSelectControl element with basic thumbnail logic