@swr-data-lab/components 1.13.1 → 1.13.3

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.
Files changed (72) hide show
  1. package/package.json +2 -4
  2. package/dist/Autocomplete/Autocomplete.stories.svelte +0 -61
  3. package/dist/Autocomplete/Autocomplete.stories.svelte.d.ts +0 -27
  4. package/dist/Button/Button.stories.svelte +0 -19
  5. package/dist/Button/Button.stories.svelte.d.ts +0 -19
  6. package/dist/Caption/Caption.stories.svelte +0 -24
  7. package/dist/Caption/Caption.stories.svelte.d.ts +0 -27
  8. package/dist/Card/Card.stories.svelte +0 -17
  9. package/dist/Card/Card.stories.svelte.d.ts +0 -19
  10. package/dist/ChartFooter/ChartFooter.mdx +0 -17
  11. package/dist/ChartFooter/ChartFooter.stories.svelte +0 -32
  12. package/dist/ChartFooter/ChartFooter.stories.svelte.d.ts +0 -27
  13. package/dist/ChartHeader/ChartHeader.mdx +0 -16
  14. package/dist/ChartHeader/ChartHeader.stories.svelte +0 -31
  15. package/dist/ChartHeader/ChartHeader.stories.svelte.d.ts +0 -27
  16. package/dist/ChartList/ChartList.mdx +0 -13
  17. package/dist/ChartList/ChartList.stories.svelte +0 -48
  18. package/dist/ChartList/ChartList.stories.svelte.d.ts +0 -27
  19. package/dist/Copy/Copy.stories.svelte +0 -32
  20. package/dist/Copy/Copy.stories.svelte.d.ts +0 -27
  21. package/dist/DesignTokens/DesignTokens.mdx +0 -110
  22. package/dist/FormLabel/FormLabel.mdx +0 -13
  23. package/dist/FormLabel/FormLabel.stories.svelte +0 -52
  24. package/dist/FormLabel/FormLabel.stories.svelte.d.ts +0 -27
  25. package/dist/Headline/Headline.stories.svelte +0 -17
  26. package/dist/Headline/Headline.stories.svelte.d.ts +0 -27
  27. package/dist/HighlightCard/HighlightCard.stories.svelte +0 -55
  28. package/dist/HighlightCard/HighlightCard.stories.svelte.d.ts +0 -19
  29. package/dist/Intro.mdx +0 -7
  30. package/dist/Logotype/Logotype.stories.svelte +0 -14
  31. package/dist/Logotype/Logotype.stories.svelte.d.ts +0 -19
  32. package/dist/Middot/Middot.stories.svelte +0 -14
  33. package/dist/Middot/Middot.stories.svelte.d.ts +0 -19
  34. package/dist/Note/Note.stories.svelte +0 -23
  35. package/dist/Note/Note.stories.svelte.d.ts +0 -27
  36. package/dist/Select/Select.mdx +0 -25
  37. package/dist/Select/Select.stories.svelte +0 -202
  38. package/dist/Select/Select.stories.svelte.d.ts +0 -19
  39. package/dist/Select/SelectStoriesTemplate.svelte +0 -31
  40. package/dist/Select/SelectStoriesTemplate.svelte.d.ts +0 -15
  41. package/dist/Switcher/Switcher.mdx +0 -13
  42. package/dist/Switcher/Switcher.stories.svelte +0 -44
  43. package/dist/Switcher/Switcher.stories.svelte.d.ts +0 -27
  44. package/dist/maplibre/AttributionControl/AttributionControl.stories.svelte +0 -27
  45. package/dist/maplibre/AttributionControl/AttributionControl.stories.svelte.d.ts +0 -19
  46. package/dist/maplibre/GeocoderControl/GeocoderControl.stories.svelte +0 -74
  47. package/dist/maplibre/GeocoderControl/GeocoderControl.stories.svelte.d.ts +0 -19
  48. package/dist/maplibre/Map/Map.stories.svelte +0 -113
  49. package/dist/maplibre/Map/Map.stories.svelte.d.ts +0 -19
  50. package/dist/maplibre/MapControl/MapControl.mdx +0 -12
  51. package/dist/maplibre/MapControl/MapControl.stories.svelte +0 -46
  52. package/dist/maplibre/MapControl/MapControl.stories.svelte.d.ts +0 -19
  53. package/dist/maplibre/MapStyle/SWRDataLabLight.mdx +0 -86
  54. package/dist/maplibre/MapStyle/SWRDataLabLight.stories.svelte +0 -39
  55. package/dist/maplibre/MapStyle/SWRDataLabLight.stories.svelte.d.ts +0 -18
  56. package/dist/maplibre/Maplibre.mdx +0 -91
  57. package/dist/maplibre/NavigationControl/NavigationControl.stories.svelte +0 -37
  58. package/dist/maplibre/NavigationControl/NavigationControl.stories.svelte.d.ts +0 -19
  59. package/dist/maplibre/ScaleControl/ScaleControl.stories.svelte +0 -68
  60. package/dist/maplibre/ScaleControl/ScaleControl.stories.svelte.d.ts +0 -19
  61. package/dist/maplibre/Source/MapSource.stories.svelte +0 -7
  62. package/dist/maplibre/Source/MapSource.stories.svelte.d.ts +0 -19
  63. package/dist/maplibre/Tooltip/Tooltip.stories.svelte +0 -186
  64. package/dist/maplibre/Tooltip/Tooltip.stories.svelte.d.ts +0 -19
  65. package/dist/maplibre/VectorLayer/VectorLayer.stories.svelte +0 -62
  66. package/dist/maplibre/VectorLayer/VectorLayer.stories.svelte.d.ts +0 -19
  67. package/dist/maplibre/VectorTileSource/VectorTileSource.mdx +0 -19
  68. package/dist/maplibre/VectorTileSource/VectorTileSource.stories.svelte +0 -44
  69. package/dist/maplibre/VectorTileSource/VectorTileSource.stories.svelte.d.ts +0 -19
  70. package/dist/maplibre/WithLinkLocation/WithLinkLocation.mdx +0 -11
  71. package/dist/maplibre/WithLinkLocation/WithLinkLocation.stories.svelte +0 -27
  72. package/dist/maplibre/WithLinkLocation/WithLinkLocation.stories.svelte.d.ts +0 -19
@@ -1,44 +0,0 @@
1
- <script context="module">
2
- import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import Switcher from './Switcher.svelte';
4
- import DesignTokens from '../DesignTokens/DesignTokens.svelte';
5
- import { userEvent, within, expect } from 'storybook/test';
6
-
7
- const { Story } = defineMeta({
8
- title: 'Form/Switcher',
9
- component: Switcher
10
- });
11
- </script>
12
-
13
- <Story name="Two Options" asChild>
14
- <DesignTokens>
15
- <Switcher options={['Option A', 'Option B']} value="Option A" size="default" label="Label" />
16
- </DesignTokens>
17
- </Story>
18
-
19
- <Story
20
- name="Four Options"
21
- asChild
22
- play={async ({ canvasElement, step }) => {
23
- const canvas = within(canvasElement);
24
- await step('Clicking selects the expected option', async () => {
25
- const optionA = canvas.getByLabelText('Apples');
26
- const optionB = canvas.getByLabelText('Bananas');
27
- await userEvent.click(optionA);
28
- expect(optionA).toBeChecked();
29
- expect(optionB).not.toBeChecked();
30
- await userEvent.click(optionB);
31
- expect(optionB).toBeChecked();
32
- expect(optionA).not.toBeChecked();
33
- });
34
- }}
35
- >
36
- <DesignTokens>
37
- <Switcher
38
- options={['Apples', 'Oranges', 'Bananas', 'Peaches']}
39
- value="Oranges"
40
- label="Label"
41
- size="small"
42
- />
43
- </DesignTokens>
44
- </Story>
@@ -1,27 +0,0 @@
1
- export default Switcher;
2
- type Switcher = SvelteComponent<{
3
- [x: string]: never;
4
- }, {
5
- [evt: string]: CustomEvent<any>;
6
- }, {}> & {
7
- $$bindings?: string | undefined;
8
- };
9
- declare const Switcher: $$__sveltets_2_IsomorphicComponent<{
10
- [x: string]: never;
11
- }, {
12
- [evt: string]: CustomEvent<any>;
13
- }, {}, {}, string>;
14
- import Switcher from './Switcher.svelte';
15
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
16
- new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
17
- $$bindings?: Bindings;
18
- } & Exports;
19
- (internal: unknown, props: {
20
- $$events?: Events;
21
- $$slots?: Slots;
22
- }): Exports & {
23
- $set?: any;
24
- $on?: any;
25
- };
26
- z_$$bindings?: Bindings;
27
- }
@@ -1,27 +0,0 @@
1
- <script context="module" lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
- import AttributionControl from './AttributionControl.svelte';
3
- import DesignTokens from '../../DesignTokens/DesignTokens.svelte';
4
- import Map from '../Map/Map.svelte';
5
- import { SWRDataLabLight } from '../MapStyle';
6
- const { Story } = defineMeta({
7
- title: 'Maplibre/Control/AttributionControl',
8
- component: AttributionControl
9
- });
10
- </script>
11
-
12
- <Story asChild name="Default">
13
- <DesignTokens>
14
- <div class="container">
15
- <Map style={SWRDataLabLight} initialLocation={{ lat: 51, lng: 10, zoom: 20 }}>
16
- <AttributionControl customAttribution="SWR Data Lab" position="bottom-left" />
17
- </Map>
18
- </div>
19
- </DesignTokens>
20
- </Story>
21
-
22
- <style>
23
- .container {
24
- width: 500px;
25
- height: 300px;
26
- }
27
- </style>
@@ -1,19 +0,0 @@
1
- import AttributionControl from './AttributionControl.svelte';
2
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
- $$bindings?: Bindings;
5
- } & Exports;
6
- (internal: unknown, props: {
7
- $$events?: Events;
8
- $$slots?: Slots;
9
- }): Exports & {
10
- $set?: any;
11
- $on?: any;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- declare const AttributionControl: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
- [evt: string]: CustomEvent<any>;
17
- }, {}, {}, string>;
18
- type AttributionControl = InstanceType<typeof AttributionControl>;
19
- export default AttributionControl;
@@ -1,74 +0,0 @@
1
- <script context="module" lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
- import { within, expect } from 'storybook/test';
3
- import GeocoderControl from './GeocoderControl.svelte';
4
- import DesignTokens from '../../DesignTokens/DesignTokens.svelte';
5
- import Map from '../Map/Map.svelte';
6
- import { SWRDataLabLight } from '../MapStyle';
7
- const { Story } = defineMeta({
8
- title: 'Maplibre/Control/GeocoderControl',
9
- component: GeocoderControl
10
- });
11
- </script>
12
-
13
- <Story
14
- asChild
15
- name="Default"
16
- play={async ({ canvasElement, step }) => {
17
- const canvas = within(canvasElement);
18
- const containerEl = canvas.getByTestId('map-container');
19
-
20
- await step('Geocoder control renders', async () => {
21
- const el = containerEl.querySelector('.maplibregl-ctrl-geocoder');
22
- expect(el).toBeTruthy();
23
- });
24
- await step('Localised placeholder text renders', async () => {
25
- const el = containerEl.querySelector('.maplibregl-ctrl-geocoder input');
26
- expect(el).toHaveAttribute('placeholder', 'Suche');
27
- });
28
- }}
29
- >
30
- <DesignTokens>
31
- <div class="container">
32
- <Map style={SWRDataLabLight} initialLocation={{ lat: 51, lng: 10, zoom: 20 }}>
33
- <GeocoderControl languages="de" service="maptiler" key="V32kPHZjMa0Mkn6YvSzA" />
34
- </Map>
35
- </div>
36
- </DesignTokens>
37
- </Story>
38
- <Story
39
- asChild
40
- name="Custom placeholder text"
41
- play={async ({ canvasElement, step }) => {
42
- const canvas = within(canvasElement);
43
- const containerEl = canvas.getByTestId('map-container');
44
-
45
- await step('Geocoder control renders', async () => {
46
- const el = containerEl.querySelector('.maplibregl-ctrl-geocoder');
47
- expect(el).toBeTruthy();
48
- });
49
- await step('Custom placeholder text renders', async () => {
50
- const el = containerEl.querySelector('.maplibregl-ctrl-geocoder input');
51
- expect(el).toHaveAttribute('placeholder', 'My placeholder text');
52
- });
53
- }}
54
- >
55
- <DesignTokens>
56
- <div class="container">
57
- <Map style={SWRDataLabLight} initialLocation={{ lat: 51, lng: 10, zoom: 20 }}>
58
- <GeocoderControl
59
- placeholder="My placeholder text"
60
- languages="de"
61
- service="maptiler"
62
- key="V32kPHZjMa0Mkn6YvSzA"
63
- />
64
- </Map>
65
- </div>
66
- </DesignTokens>
67
- </Story>
68
-
69
- <style>
70
- .container {
71
- width: 500px;
72
- height: 300px;
73
- }
74
- </style>
@@ -1,19 +0,0 @@
1
- import GeocoderControl from './GeocoderControl.svelte';
2
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
- $$bindings?: Bindings;
5
- } & Exports;
6
- (internal: unknown, props: {
7
- $$events?: Events;
8
- $$slots?: Slots;
9
- }): Exports & {
10
- $set?: any;
11
- $on?: any;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- declare const GeocoderControl: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
- [evt: string]: CustomEvent<any>;
17
- }, {}, {}, string>;
18
- type GeocoderControl = InstanceType<typeof GeocoderControl>;
19
- export default GeocoderControl;
@@ -1,113 +0,0 @@
1
- <script context="module" lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
- import { within, expect } from 'storybook/test';
3
- import Map from './Map.svelte';
4
- import ScaleControl from '../ScaleControl/ScaleControl.svelte';
5
- import NavigationControl from '../NavigationControl/NavigationControl.svelte';
6
- import DesignTokens from '../../DesignTokens/DesignTokens.svelte';
7
- import AttributionControl from '../AttributionControl/AttributionControl.svelte';
8
- import GeocoderControl from '../GeocoderControl/GeocoderControl.svelte';
9
- import { SWRDataLabLight } from '../MapStyle';
10
- import { eclipse } from '@versatiles/style';
11
- const alternateStyle = eclipse({
12
- language: 'de',
13
- baseUrl: 'https://tiles.versatiles.org',
14
- glyphs: 'https://static.datenhub.net/maps/fonts/{fontstack}/{range}.pbf'
15
- });
16
- const { Story } = defineMeta({
17
- title: 'Maplibre/Map',
18
- component: Map
19
- });
20
- </script>
21
-
22
- <Story
23
- asChild
24
- name="Default"
25
- play={async ({ canvasElement, step }) => {
26
- const canvas = within(canvasElement);
27
- const containerEl = canvas.getByTestId('map-container');
28
-
29
- await step('Map canvas renders', async () => {
30
- const mapEl = containerEl.querySelector('.maplibregl-canvas');
31
- expect(mapEl).toBeTruthy();
32
- });
33
- await step('Scale control renders', async () => {
34
- const el = containerEl.querySelector('.maplibregl-ctrl-scale');
35
- expect(el).toBeTruthy();
36
- });
37
- await step('Scale renders expected value', async () => {
38
- const el = containerEl.querySelector('.maplibregl-ctrl-scale');
39
- expect(el).toHaveTextContent('100 km');
40
- });
41
- await step('Navigation control renders', async () => {
42
- const zoomInEl = containerEl.querySelector('.maplibregl-ctrl-zoom-in');
43
- const zoomOutEl = containerEl.querySelector('.maplibregl-ctrl-zoom-out');
44
- expect(zoomInEl).toBeTruthy();
45
- expect(zoomInEl).toHaveRole('button');
46
- expect(zoomOutEl).toBeTruthy();
47
- expect(zoomOutEl).toHaveRole('button');
48
- });
49
-
50
- await step('Attribution control renders', async () => {
51
- const el = containerEl.querySelector('.maplibregl-ctrl-attrib');
52
- expect(el).toBeTruthy();
53
- });
54
-
55
- await step('Geocoder control renders', async () => {
56
- const el = containerEl.querySelector('.maplibregl-ctrl-geocoder');
57
- expect(el).toBeTruthy();
58
- });
59
- }}
60
- >
61
- <div class="container">
62
- <DesignTokens>
63
- <Map style={SWRDataLabLight}>
64
- <ScaleControl />
65
- <AttributionControl />
66
- <NavigationControl showCompass visualizePitch />
67
- <GeocoderControl languages="de" service="maptiler" key="V32kPHZjMa0Mkn6YvSzA" />
68
- </Map>
69
- </DesignTokens>
70
- </div>
71
- </Story>
72
-
73
- <Story asChild name="Globe Projection">
74
- <div class="container dark">
75
- <DesignTokens>
76
- <Map
77
- style={SWRDataLabLight}
78
- showDebug
79
- projection={{ type: 'globe' }}
80
- pitch={52}
81
- initialLocation={{ lat: 51.3, lng: 10.2, zoom: 3.5 }}
82
- >
83
- <ScaleControl />
84
- <AttributionControl />
85
- <NavigationControl showCompass visualizePitch />
86
- <GeocoderControl languages="de" service="maptiler" key="V32kPHZjMa0Mkn6YvSzA" />
87
- </Map>
88
- </DesignTokens>
89
- </div>
90
- </Story>
91
-
92
- <Story asChild name="Alternate Style">
93
- <div class="container dark">
94
- <DesignTokens>
95
- <Map style={alternateStyle}>
96
- <ScaleControl />
97
- <AttributionControl />
98
- <NavigationControl showCompass visualizePitch />
99
- <GeocoderControl languages="de" service="maptiler" key="V32kPHZjMa0Mkn6YvSzA" />
100
- </Map>
101
- </DesignTokens>
102
- </div>
103
- </Story>
104
-
105
- <style>
106
- .container {
107
- width: 100%;
108
- height: 600px;
109
- }
110
- .dark {
111
- color: rgb(230, 230, 230);
112
- }
113
- </style>
@@ -1,19 +0,0 @@
1
- import Map from './Map.svelte';
2
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
- $$bindings?: Bindings;
5
- } & Exports;
6
- (internal: unknown, props: {
7
- $$events?: Events;
8
- $$slots?: Slots;
9
- }): Exports & {
10
- $set?: any;
11
- $on?: any;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- declare const Map: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
- [evt: string]: CustomEvent<any>;
17
- }, {}, {}, string>;
18
- type Map = InstanceType<typeof Map>;
19
- export default Map;
@@ -1,12 +0,0 @@
1
- import { Meta } from '@storybook/addon-docs/blocks';
2
- import { Story, Primary, Controls, Stories } from '@storybook/addon-docs/blocks';
3
- import * as MapControlStories from './MapControl.stories.svelte';
4
-
5
- <Meta of={MapControlStories} />
6
-
7
- # MapControl
8
-
9
- Base component used by all other built-in control components. Also useful for building application-specific controls (see demo below).
10
-
11
- <Stories />
12
- <Controls />
@@ -1,46 +0,0 @@
1
- <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
- import MapControl from './MapControl.svelte';
3
- import { SWRDataLabLight } from '../MapStyle';
4
- import DesignTokens from '../../DesignTokens/DesignTokens.svelte';
5
- import Switcher from '../../Switcher/Switcher.svelte';
6
- import Map from '../Map/Map.svelte';
7
- import { eclipse } from '@versatiles/style';
8
- const eclipseStyle = eclipse({
9
- language: 'de',
10
- baseUrl: 'https://tiles.versatiles.org',
11
- glyphs: 'https://static.datenhub.net/maps/fonts/{fontstack}/{range}.pbf'
12
- });
13
- const { Story } = defineMeta({
14
- title: 'Maplibre/Control/MapControl',
15
- component: MapControl
16
- });
17
- const themes = {
18
- 'SWRDL Light': SWRDataLabLight,
19
- Eclipse: eclipseStyle
20
- };
21
- let currentTheme = $state('SWRDL Light');
22
- </script>
23
-
24
- <Story asChild name="Custom HTML Control">
25
- <DesignTokens>
26
- <div class="container">
27
- <Map style={themes[currentTheme]} initialLocation={{ lat: 51, lng: 10, zoom: 20 }}>
28
- <MapControl position="top-left">
29
- <Switcher
30
- options={Object.keys(themes)}
31
- bind:value={currentTheme}
32
- label="Select theme"
33
- size="small"
34
- />
35
- </MapControl>
36
- </Map>
37
- </div>
38
- </DesignTokens>
39
- </Story>
40
-
41
- <style>
42
- .container {
43
- width: 500px;
44
- height: 300px;
45
- }
46
- </style>
@@ -1,19 +0,0 @@
1
- import MapControl from './MapControl.svelte';
2
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
- $$bindings?: Bindings;
5
- } & Exports;
6
- (internal: unknown, props: {
7
- $$events?: Events;
8
- $$slots?: Slots;
9
- }): Exports & {
10
- $set?: any;
11
- $on?: any;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- declare const MapControl: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
- [evt: string]: CustomEvent<any>;
17
- }, {}, {}, string>;
18
- type MapControl = InstanceType<typeof MapControl>;
19
- export default MapControl;
@@ -1,86 +0,0 @@
1
- import { Story, Meta, Primary, Controls, Stories } from '@storybook/addon-docs/blocks';
2
- import Mermaid from '../../../.storybook/blocks/Mermaid';
3
- import SWRDataLabLight from './SWRDataLabLight';
4
- import * as MapStyleStories from './SWRDataLabLight.stories.svelte';
5
-
6
- <Meta of={MapStyleStories} />
7
-
8
- # SWR Data Lab Light
9
-
10
- Light-themed general-purpose basemap using SWR colours and typefaces based on
11
- [versatiles-greybeard](https://github.com/versatiles-org/versatiles-style).
12
-
13
- - Data sources
14
- - Vector data: [versatiles-osm](https://download.versatiles.org/) in the [Shortbread schema](https://shortbread-tiles.org/) served from `tiles.versatiles.org`
15
- - Typefaces: SWR Sans served from `https://static.datenhub.net/maps/fonts/`.
16
- - Layer count: {SWRDataLabLight.layers.length}
17
-
18
- <Story of={MapStyleStories.Default} />
19
-
20
- <br />
21
-
22
- ### Design Notes
23
-
24
- We take a two-step design approach:
25
-
26
- 1. Sort the geographic data we want to present into semantic groups like "Admin Boundaries", "Roads" or "Transit" (inspired by Mapbox's [Style Components](https://docs.mapbox.com/studio-manual/guides/components/)).
27
- 2. Derive physical layers (ie. `MapLayerSpecification`) from these groups and interleave them to produce a convincing image
28
- 3. Use shared design tokens to style each physical layer
29
-
30
- <Mermaid chart={`
31
- block-beta
32
- columns 10
33
-
34
- classDef admin fill:#e5dbf5;
35
- classDef buildings fill:#FFBA35;
36
- classDef roads fill:#FFD584;
37
- classDef transit fill:#C5F0B1;
38
- classDef walking fill:#65D62B;
39
- classDef landuse fill:#eee;
40
-
41
- block:semantic:6
42
- columns 1
43
- columns 1
44
- s_admin["Admin"]
45
- s_buildings["Buildings"]
46
- s_roads["Roads"]
47
- s_transit["Transit"]
48
- s_walking["Walking + Cycling"]
49
- s_landuse["Landuse"]
50
- end
51
-
52
- block:actual:10
53
- columns 1
54
- a_admin_labels["Admin Labels"]
55
- a_walking_labels["Walking (Labels)"]
56
- a_transit_labels["Transit (Labels)"]
57
- a_roads_labels["Roads (Labels)"]
58
- a_admin0["Admin 0 (Countries)"]
59
- a_admin1["Admin 1 (States/Provinces)"]
60
- a_admin2["Admin 2 (Districts)"]
61
- a_buildings["Buildings"]
62
- a_walking_bridge["Walking (Bridge)"]
63
- a_transit_bridge["Transit (Bridge)"]
64
- a_roads_bridge["Roads (Bridge)"]
65
- a_walking_surface["Walking (Surface)"]
66
- a_transit_surface["Transit (Surface)"]
67
- a_roads_surface["Roads (Surface)"]
68
- a_walking_tunnel["Walking (Tunnel)"]
69
- a_transit_tunnel["Transit (Tunnel)"]
70
- a_roads_tunnel["Roads (Tunnel)"]
71
- a_land["Land"]
72
- a_ocean["Ocean"]
73
- a_background["Background"]
74
- end
75
-
76
- class s_admin,a_admin0,a_admin1,a_admin2,a_admin_labels admin
77
- class s_buildings,a_buildings buildings
78
- class s_roads,a_roads_bridge,a_roads_surface,a_roads_tunnel,a_roads_labels roads
79
- class s_transit,a_transit_bridge,a_transit_surface,a_transit_tunnel,a_transit_labels transit
80
- class s_walking,a_walking_bridge,a_walking_surface,a_walking_tunnel,a_walking_labels walking
81
- class s_landuse,a_land,a_ocean,a_background landuse
82
- `}/>
83
-
84
- ### References
85
-
86
- - [Foundational Map Design | BUILD with Mapbox ](https://www.youtube.com/watch?v=QDfj9oGVZmE)
@@ -1,39 +0,0 @@
1
- <script context="module" lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
- import Map from '../Map/Map.svelte';
3
- import DesignTokens from '../../DesignTokens/DesignTokens.svelte';
4
- import AttributionControl from '../AttributionControl/AttributionControl.svelte';
5
- import GeocoderControl from '../GeocoderControl/GeocoderControl.svelte';
6
- import { SWRDataLabLight } from './index';
7
- const { Story } = defineMeta({
8
- title: 'Maplibre/Style/SWR Data Lab Light',
9
- component: Map
10
- });
11
- </script>
12
-
13
- <Story asChild name="Default">
14
- <DesignTokens>
15
- <div class="grid">
16
- <div class="container">
17
- <Map
18
- style={SWRDataLabLight}
19
- initialLocation={{ lng: 8.239451072800875, lat: 48.75692609731408, zoom: 14.99 }}
20
- >
21
- <GeocoderControl languages="de" service="maptiler" key="V32kPHZjMa0Mkn6YvSzA" />
22
- <AttributionControl position="bottom-left" />
23
- </Map>
24
- </div>
25
- </div>
26
- </DesignTokens>
27
- </Story>
28
-
29
- <style>
30
- .grid {
31
- display: grid;
32
- grid-template-columns: repeat(1, 1fr);
33
- grid-template-rows: auto;
34
- height: 700px;
35
- }
36
- .container {
37
- overflow: hidden;
38
- }
39
- </style>
@@ -1,18 +0,0 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- declare const SwrDataLabLight: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
- [evt: string]: CustomEvent<any>;
16
- }, {}, {}, string>;
17
- type SwrDataLabLight = InstanceType<typeof SwrDataLabLight>;
18
- export default SwrDataLabLight;
@@ -1,91 +0,0 @@
1
- import { Meta } from '@storybook/addon-docs/blocks';
2
- import { Story, Primary, Controls, Stories } from '@storybook/addon-docs/blocks';
3
- import * as MapStories from './Map/Map.stories.svelte';
4
- import * as MapStyleStories from './MapStyle/SWRDataLabLight.stories.svelte';
5
-
6
- <Meta title="Maplibre" />
7
-
8
- # Maplibre
9
-
10
- Lightweight svelte components and basemaps for rendering custom slippy maps using the [versatiles](https://docs.versatiles.org/) stack.
11
-
12
- Based on [prior work](https://github.com/SWRdata/frontend_svelte_p012_spritpreise/blob/main/src/lib/components/Map/Map.svelte) from [Michael Kreil](https://github.com/MichaelKreil), [Jakob Bauer](https://github.com/AgricolaJKB), [dimfield](https://github.com/dimfeld/svelte-maplibre) and [MIRUNE](https://github.com/MIERUNE/svelte-maplibre-gl).
13
-
14
- <Story of={MapStyleStories.Default} />
15
-
16
- <br />
17
-
18
- ## Usage
19
-
20
- This example initialises a map using the SWRDataLabLight style, adds an additional vector tile source and renders it as a vector layer.
21
-
22
- ```jsx
23
- <script>
24
- import {
25
- Map,
26
- VectorLayer,
27
- AttributionControl,
28
- VectorTileSource,
29
- SWRDataLabLight,
30
- DesignTokens
31
- } from '@swr-data-lab/components';
32
- </script>
33
-
34
- <DesignTokens>
35
- <div class='container'>
36
- <Map style={SWRDataLabLight}>
37
- <VectorTileSource
38
- id='ev-infra-source'
39
- url='https://static.datenhub.net/data/p108_e_auto_check/ev_infra_merged.versatiles?tiles/{z}/{x}/{y}'>
40
- </VectorTileSource>
41
- <VectorLayer
42
- sourceId='ev-infra-source'
43
- sourceLayer='coverage'
44
- id='ev-infra-outline'
45
- type='line'
46
- paint={{'line-width': 1, 'line-color': 'red'}}>
47
- </VectorLayer>
48
- <AttributionControl />
49
- </Map>
50
- </div>
51
- </DesignTokens>
52
-
53
- <style>
54
- .container {
55
- width: 100%;
56
- height: 600px;
57
- }
58
- </style>
59
- ```
60
-
61
- ## Available components
62
-
63
- ### Sources
64
-
65
- - **[VectorTileSource](?path=/docs/maplibre-source-vectortilesource--docs)**: Loads a vector tile source supplied by a tileserver
66
-
67
- ### Layers
68
-
69
- - **[VectorLayer](?path=/docs/maplibre-layer-vectorlayer--docs)**: Renders a layer from a vector tile source.
70
-
71
- ### Controls
72
-
73
- - **[ScaleControl](?path=/docs/maplibre-control-scalecontrol--docs)**: Renders a dynamic scalebar
74
- - **[NavigationControl](?path=/docs/maplibre-control-navigationcontrol--docs)**: Renders zoom buttons and optional compass
75
- - **[GeocoderControl](?path=/docs/maplibre-control-geocodercontrol--docs)**: Renders a search input using [maplibre-gl-geocoder](https://github.com/maplibre/maplibre-gl-geocoder) and any supported forward geocoding service (currently [maptiler](https://www.maptiler.com/) only)
76
- - **[AttributionControl](?path=/docs/maplibre-control-attributioncontrol--docs)**: Renders maplibre's default attribution control
77
- - **[Custom controls](?path=/docs/maplibre-control-mapcontrol--docs)**: Renders arbitrary HTML inside maplibre's layout
78
-
79
- ### Misc
80
-
81
- - **[Tooltip](?path=/docs/maplibre-extras-tooltip--docs)**
82
- - **[WithLinkLocation](?path=/docs/maplibre-extras-withlinklocation--docs)**: Derive the maps `initialLocation` from a URL parameter via forward geocoding
83
-
84
- ### Styles
85
-
86
- - **[SWR Data Lab Light](?path=/docs/maplibre-style-swr-data-lab-light--docs)**: Light-themed basemap using SWR colours and typefaces
87
- - Any valid MapLibre style specification, such as [versatiles-style](https://github.com/versatiles-org/versatiles-style) (see [demo](?path=/story/map-map--alternate-style))
88
-
89
- ## Known issues
90
-
91
- - Firefox throws warning `WebGL warning: texImage: Alpha-premult and y-flip are deprecated for non-DOM-Element uploads`: Known [upstream mapligre-gl issue](https://github.com/maplibre/maplibre-gl-js/issues/2030) (safe to ignore)