@swr-data-lab/components 1.12.5 → 1.13.1
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/Autocomplete/Autocomplete.stories.svelte.d.ts +27 -0
- package/dist/Autocomplete/Autocomplete.svelte +237 -0
- package/dist/Autocomplete/Autocomplete.svelte.d.ts +34 -0
- package/dist/Autocomplete/index.d.ts +2 -0
- package/dist/Button/Button.stories.svelte +19 -0
- package/dist/Button/Button.stories.svelte.d.ts +19 -0
- package/dist/Button/Button.svelte +38 -0
- package/dist/Button/Button.svelte.d.ts +10 -0
- package/dist/Button/index.d.ts +2 -0
- package/dist/Caption/Caption.stories.svelte.d.ts +27 -0
- package/dist/Caption/Caption.svelte +21 -0
- package/dist/Caption/Caption.svelte.d.ts +8 -0
- package/dist/Caption/index.js +2 -0
- package/dist/Card/Card.stories.svelte +17 -0
- package/dist/Card/Card.stories.svelte.d.ts +19 -0
- package/dist/Card/Card.svelte +25 -0
- package/dist/Card/Card.svelte.d.ts +7 -0
- package/dist/Card/index.d.ts +2 -0
- package/dist/ChartFooter/ChartFooter.stories.svelte.d.ts +27 -0
- package/dist/ChartFooter/ChartFooter.svelte +38 -0
- package/dist/ChartFooter/ChartFooter.svelte.d.ts +8 -0
- package/dist/ChartFooter/index.d.ts +2 -0
- package/dist/ChartHeader/ChartHeader.stories.svelte.d.ts +27 -0
- package/{src → dist}/ChartHeader/ChartHeader.svelte +4 -12
- package/dist/ChartHeader/ChartHeader.svelte.d.ts +9 -0
- package/dist/ChartHeader/index.d.ts +2 -0
- package/dist/ChartList/ChartList.mdx +13 -0
- package/dist/ChartList/ChartList.stories.svelte +48 -0
- package/dist/ChartList/ChartList.stories.svelte.d.ts +27 -0
- package/dist/ChartList/ChartList.svelte +103 -0
- package/dist/ChartList/ChartList.svelte.d.ts +14 -0
- package/dist/ChartList/index.d.ts +2 -0
- package/dist/ChartList/index.js +2 -0
- package/dist/Copy/Copy.stories.svelte.d.ts +27 -0
- package/dist/Copy/Copy.svelte +21 -0
- package/dist/Copy/Copy.svelte.d.ts +8 -0
- package/dist/Copy/index.js +2 -0
- package/dist/DesignTokens/DesignTokens.svelte +58 -0
- package/dist/DesignTokens/DesignTokens.svelte.d.ts +7 -0
- package/dist/DesignTokens/Tokens.d.ts +26 -0
- package/dist/DesignTokens/Tokens.js +171 -0
- package/dist/DesignTokens/index.d.ts +8 -0
- package/dist/FormLabel/FormLabel.stories.svelte.d.ts +27 -0
- package/{src → dist}/FormLabel/FormLabel.svelte +2 -9
- package/dist/FormLabel/FormLabel.svelte.d.ts +9 -0
- package/dist/FormLabel/index.js +2 -0
- package/dist/Headline/Headline.stories.svelte.d.ts +27 -0
- package/{src → dist}/Headline/Headline.svelte +2 -7
- package/dist/Headline/Headline.svelte.d.ts +7 -0
- package/dist/Headline/index.js +2 -0
- package/{src → dist}/HighlightCard/HighlightCard.stories.svelte +7 -9
- package/dist/HighlightCard/HighlightCard.stories.svelte.d.ts +19 -0
- package/dist/HighlightCard/HighlightCard.svelte +54 -0
- package/dist/HighlightCard/HighlightCard.svelte.d.ts +9 -0
- package/dist/HighlightCard/index.d.ts +2 -0
- package/dist/Input/Input.svelte +32 -0
- package/dist/Input/Input.svelte.d.ts +23 -0
- package/dist/Input/index.d.ts +2 -0
- package/dist/Intro.mdx +7 -0
- package/dist/Logotype/Logotype.stories.svelte +14 -0
- package/dist/Logotype/Logotype.stories.svelte.d.ts +19 -0
- package/dist/Logotype/Logotype.svelte.d.ts +26 -0
- package/dist/Middot/Middot.stories.svelte +14 -0
- package/dist/Middot/Middot.stories.svelte.d.ts +19 -0
- package/dist/Middot/Middot.svelte.d.ts +26 -0
- package/dist/Middot/index.d.ts +2 -0
- package/dist/Note/Note.stories.svelte.d.ts +27 -0
- package/dist/Note/Note.svelte +28 -0
- package/dist/Note/Note.svelte.d.ts +7 -0
- package/dist/Note/index.js +2 -0
- package/{src → dist}/Select/Select.stories.svelte +12 -15
- package/dist/Select/Select.stories.svelte.d.ts +19 -0
- package/dist/Select/Select.svelte +39 -0
- package/dist/Select/Select.svelte.d.ts +4 -0
- package/{src/Select/Select.types.ts → dist/Select/Select.types.d.ts} +1 -2
- package/dist/Select/Select.types.js +1 -0
- package/dist/Select/SelectStoriesTemplate.svelte.d.ts +15 -0
- package/dist/Select/index.d.ts +2 -0
- package/dist/Switcher/Switcher.stories.svelte.d.ts +27 -0
- package/dist/Switcher/Switcher.svelte +111 -0
- package/dist/Switcher/Switcher.svelte.d.ts +21 -0
- package/dist/Switcher/index.d.ts +2 -0
- package/{src → dist}/app.d.ts +1 -1
- package/dist/assets/close-circle.svg.svelte.d.ts +26 -0
- package/dist/assets/grow.svg.svelte.d.ts +26 -0
- package/dist/assets/hand-pointer.svg.svelte.d.ts +26 -0
- package/dist/assets/shrink.svg.svelte.d.ts +26 -0
- package/dist/assets/tap.svg.svelte.d.ts +26 -0
- package/dist/assets/times-circle-solid.svg.svelte.d.ts +26 -0
- package/dist/index.d.ts +29 -0
- package/{src → dist}/index.js +3 -0
- package/dist/maplibre/AttributionControl/AttributionControl.stories.svelte +27 -0
- package/dist/maplibre/AttributionControl/AttributionControl.stories.svelte.d.ts +19 -0
- package/dist/maplibre/AttributionControl/AttributionControl.svelte +15 -0
- package/dist/maplibre/AttributionControl/AttributionControl.svelte.d.ts +8 -0
- package/dist/maplibre/AttributionControl/index.d.ts +2 -0
- package/dist/maplibre/GeocoderControl/GeocoderAPIs.d.ts +6 -0
- package/dist/maplibre/GeocoderControl/GeocoderAPIs.js +40 -0
- package/{src → dist}/maplibre/GeocoderControl/GeocoderControl.stories.svelte +10 -14
- package/dist/maplibre/GeocoderControl/GeocoderControl.stories.svelte.d.ts +19 -0
- package/dist/maplibre/GeocoderControl/GeocoderControl.svelte +25 -0
- package/dist/maplibre/GeocoderControl/GeocoderControl.svelte.d.ts +27 -0
- package/dist/maplibre/GeocoderControl/index.d.ts +2 -0
- package/dist/maplibre/Map/FallbackStyle.d.ts +3 -0
- package/dist/maplibre/Map/FallbackStyle.js +15 -0
- package/{src → dist}/maplibre/Map/Map.stories.svelte +19 -24
- package/dist/maplibre/Map/Map.stories.svelte.d.ts +19 -0
- package/dist/maplibre/Map/Map.svelte +91 -0
- package/dist/maplibre/Map/Map.svelte.d.ts +23 -0
- package/dist/maplibre/Map/index.d.ts +2 -0
- package/dist/maplibre/MapControl/MapControl.stories.svelte +46 -0
- package/dist/maplibre/MapControl/MapControl.stories.svelte.d.ts +19 -0
- package/dist/maplibre/MapControl/MapControl.svelte +29 -0
- package/dist/maplibre/MapControl/MapControl.svelte.d.ts +11 -0
- package/dist/maplibre/MapControl/index.d.ts +2 -0
- package/dist/maplibre/MapStyle/SWRDataLabLight.d.ts +3 -0
- package/dist/maplibre/MapStyle/SWRDataLabLight.js +60 -0
- package/{src → dist}/maplibre/MapStyle/SWRDataLabLight.stories.svelte +10 -12
- package/dist/maplibre/MapStyle/SWRDataLabLight.stories.svelte.d.ts +18 -0
- package/dist/maplibre/MapStyle/components/Admin.d.ts +1 -0
- package/dist/maplibre/MapStyle/components/Admin.js +170 -0
- package/dist/maplibre/MapStyle/components/Buildings.d.ts +1 -0
- package/dist/maplibre/MapStyle/components/Buildings.js +21 -0
- package/dist/maplibre/MapStyle/components/Landuse.d.ts +1 -0
- package/dist/maplibre/MapStyle/components/Landuse.js +497 -0
- package/dist/maplibre/MapStyle/components/Natural.d.ts +1 -0
- package/dist/maplibre/MapStyle/components/Natural.js +1 -0
- package/dist/maplibre/MapStyle/components/PlaceLabels.d.ts +4 -0
- package/dist/maplibre/MapStyle/components/PlaceLabels.js +194 -0
- package/dist/maplibre/MapStyle/components/Roads.d.ts +8 -0
- package/dist/maplibre/MapStyle/components/Roads.js +2327 -0
- package/dist/maplibre/MapStyle/components/Transit.d.ts +7 -0
- package/dist/maplibre/MapStyle/components/Transit.js +499 -0
- package/dist/maplibre/MapStyle/components/Walking.d.ts +1 -0
- package/dist/maplibre/MapStyle/components/Walking.js +1530 -0
- package/dist/maplibre/MapStyle/index.d.ts +2 -0
- package/dist/maplibre/MapStyle/tokens.d.ts +20 -0
- package/dist/maplibre/MapStyle/tokens.js +20 -0
- package/{src → dist}/maplibre/NavigationControl/NavigationControl.stories.svelte +9 -11
- package/dist/maplibre/NavigationControl/NavigationControl.stories.svelte.d.ts +19 -0
- package/dist/maplibre/NavigationControl/NavigationControl.svelte +9 -0
- package/dist/maplibre/NavigationControl/NavigationControl.svelte.d.ts +12 -0
- package/dist/maplibre/NavigationControl/index.d.ts +2 -0
- package/{src → dist}/maplibre/ScaleControl/ScaleControl.stories.svelte +10 -13
- package/dist/maplibre/ScaleControl/ScaleControl.stories.svelte.d.ts +19 -0
- package/dist/maplibre/ScaleControl/ScaleControl.svelte +9 -0
- package/dist/maplibre/ScaleControl/ScaleControl.svelte.d.ts +9 -0
- package/dist/maplibre/ScaleControl/index.d.ts +2 -0
- package/dist/maplibre/Source/MapSource.stories.svelte +7 -0
- package/dist/maplibre/Source/MapSource.stories.svelte.d.ts +19 -0
- package/dist/maplibre/Source/MapSource.svelte +43 -0
- package/dist/maplibre/Source/MapSource.svelte.d.ts +13 -0
- package/dist/maplibre/Source/index.d.ts +2 -0
- package/dist/maplibre/Source/source.d.ts +28 -0
- package/dist/maplibre/Source/source.js +76 -0
- package/{src → dist}/maplibre/Tooltip/Tooltip.stories.svelte +17 -23
- package/dist/maplibre/Tooltip/Tooltip.stories.svelte.d.ts +19 -0
- package/dist/maplibre/Tooltip/Tooltip.svelte +46 -0
- package/dist/maplibre/Tooltip/Tooltip.svelte.d.ts +25 -0
- package/dist/maplibre/Tooltip/index.d.ts +2 -0
- package/{src → dist}/maplibre/VectorLayer/VectorLayer.stories.svelte +11 -14
- package/dist/maplibre/VectorLayer/VectorLayer.stories.svelte.d.ts +19 -0
- package/dist/maplibre/VectorLayer/VectorLayer.svelte +73 -0
- package/dist/maplibre/VectorLayer/VectorLayer.svelte.d.ts +21 -0
- package/dist/maplibre/VectorLayer/index.d.ts +2 -0
- package/{src → dist}/maplibre/VectorTileSource/VectorTileSource.stories.svelte +11 -13
- package/dist/maplibre/VectorTileSource/VectorTileSource.stories.svelte.d.ts +19 -0
- package/dist/maplibre/VectorTileSource/VectorTileSource.svelte +13 -0
- package/dist/maplibre/VectorTileSource/VectorTileSource.svelte.d.ts +11 -0
- package/dist/maplibre/VectorTileSource/index.d.ts +2 -0
- package/dist/maplibre/WithLinkLocation/WithLinkLocation.stories.svelte +27 -0
- package/dist/maplibre/WithLinkLocation/WithLinkLocation.stories.svelte.d.ts +19 -0
- package/dist/maplibre/WithLinkLocation/WithLinkLocation.svelte +44 -0
- package/dist/maplibre/WithLinkLocation/WithLinkLocation.svelte.d.ts +19 -0
- package/dist/maplibre/WithLinkLocation/index.d.ts +2 -0
- package/dist/maplibre/context.svelte.d.ts +33 -0
- package/dist/maplibre/context.svelte.js +73 -0
- package/{src/maplibre/types.ts → dist/maplibre/types.d.ts} +3 -5
- package/dist/maplibre/types.js +1 -0
- package/dist/maplibre/utils.d.ts +4 -0
- package/dist/maplibre/utils.js +34 -0
- package/dist/utils/formatDate.d.ts +5 -0
- package/dist/utils/formatDate.js +17 -0
- package/dist/utils/formatNumber.d.ts +18 -0
- package/{src → dist}/utils/formatNumber.js +5 -5
- package/dist/utils/getColorsBetween.d.ts +9 -0
- package/dist/utils/getColorsBetween.js +25 -0
- package/dist/utils/getComparisonDiffs.d.ts +6 -0
- package/dist/utils/getComparisonDiffs.js +9 -0
- package/dist/utils/getEmbedContext.d.ts +7 -0
- package/dist/utils/getEmbedContext.js +27 -0
- package/dist/utils/getLaenderFromTopo.d.ts +10 -0
- package/dist/utils/getLaenderFromTopo.js +35 -0
- package/dist/utils/getLaenderNicenameFromAgs.d.ts +7 -0
- package/dist/utils/getLaenderNicenameFromAgs.js +27 -0
- package/dist/utils/isSvelteComponent.d.ts +7 -0
- package/{src → dist}/utils/isSvelteComponent.js +1 -1
- package/dist/utils/prepareSophoraModel.d.ts +2 -0
- package/dist/utils/prepareSophoraModel.js +37 -0
- package/dist/utils/scrollIntoViewWithOffset.d.ts +7 -0
- package/{src → dist}/utils/scrollIntoViewWithOffset.js +3 -3
- package/dist/utils/slugify.d.ts +1 -0
- package/dist/utils/slugify.js +11 -0
- package/dist/utils/topoToGeo.d.ts +7 -0
- package/{src → dist}/utils/topoToGeo.js +2 -2
- package/package.json +30 -7
- package/.storybook/blocks/Mermaid.jsx +0 -9
- package/.storybook/main.ts +0 -34
- package/.storybook/preview-head.html +0 -13
- package/.storybook/preview.ts +0 -47
- package/.storybook/vitest.setup.ts +0 -9
- package/src/Autocomplete/Autocomplete.svelte +0 -237
- package/src/Button/Button.stories.svelte +0 -21
- package/src/Button/Button.svelte +0 -52
- package/src/Caption/Caption.svelte +0 -29
- package/src/Card/Card.stories.svelte +0 -19
- package/src/Card/Card.svelte +0 -34
- package/src/ChartFooter/ChartFooter.svelte +0 -46
- package/src/Copy/Copy.svelte +0 -29
- package/src/DesignTokens/DesignTokens.svelte +0 -71
- package/src/DesignTokens/Tokens.ts +0 -186
- package/src/HighlightCard/HighlightCard.svelte +0 -65
- package/src/Input/Input.svelte +0 -21
- package/src/Intro.mdx +0 -7
- package/src/Logotype/Logotype.stories.svelte +0 -16
- package/src/Middot/Middot.stories.svelte +0 -16
- package/src/Note/Note.svelte +0 -38
- package/src/Select/Select.svelte +0 -76
- package/src/Switcher/Switcher.svelte +0 -130
- package/src/maplibre/AttributionControl/AttributionControl.stories.svelte +0 -29
- package/src/maplibre/AttributionControl/AttributionControl.svelte +0 -45
- package/src/maplibre/GeocoderControl/GeocoderAPIs.ts +0 -49
- package/src/maplibre/GeocoderControl/GeocoderControl.svelte +0 -211
- package/src/maplibre/Map/FallbackStyle.ts +0 -18
- package/src/maplibre/Map/Map.svelte +0 -287
- package/src/maplibre/MapControl/MapControl.stories.svelte +0 -56
- package/src/maplibre/MapControl/MapControl.svelte +0 -41
- package/src/maplibre/MapStyle/SWRDataLabLight.ts +0 -72
- package/src/maplibre/MapStyle/components/Admin.ts +0 -173
- package/src/maplibre/MapStyle/components/Buildings.ts +0 -23
- package/src/maplibre/MapStyle/components/Landuse.ts +0 -499
- package/src/maplibre/MapStyle/components/Natural.ts +0 -1
- package/src/maplibre/MapStyle/components/PlaceLabels.ts +0 -199
- package/src/maplibre/MapStyle/components/Roads.ts +0 -2345
- package/src/maplibre/MapStyle/components/Transit.ts +0 -507
- package/src/maplibre/MapStyle/components/Walking.ts +0 -1538
- package/src/maplibre/MapStyle/tokens.ts +0 -21
- package/src/maplibre/NavigationControl/NavigationControl.svelte +0 -36
- package/src/maplibre/ScaleControl/ScaleControl.svelte +0 -25
- package/src/maplibre/Source/MapSource.stories.svelte +0 -9
- package/src/maplibre/Source/MapSource.svelte +0 -61
- package/src/maplibre/Source/source.ts +0 -89
- package/src/maplibre/Tooltip/Tooltip.svelte +0 -183
- package/src/maplibre/VectorLayer/VectorLayer.svelte +0 -142
- package/src/maplibre/VectorTileSource/VectorTileSource.svelte +0 -24
- package/src/maplibre/WithLinkLocation/WithLinkLocation.stories.svelte +0 -29
- package/src/maplibre/WithLinkLocation/WithLinkLocation.svelte +0 -83
- package/src/maplibre/context.svelte.ts +0 -89
- package/src/maplibre/utils.ts +0 -52
- package/src/utils/formatDate.js +0 -17
- package/src/utils/getColorsBetween.js +0 -25
- package/src/utils/getComparisonDiffs.js +0 -9
- package/src/utils/getEmbedContext.js +0 -28
- package/src/utils/getLaenderFromTopo.js +0 -35
- package/src/utils/getLaenderNicenameFromAgs.js +0 -27
- package/src/utils/prepareSophoraModel.js +0 -31
- package/src/utils/slugify.ts +0 -12
- package/static/favicon.png +0 -0
- package/svelte.config.js +0 -18
- package/tsconfig.json +0 -19
- package/vite.config.ts +0 -6
- package/vitest.workspace.ts +0 -32
- /package/{src → dist}/Autocomplete/Autocomplete.stories.svelte +0 -0
- /package/{src → dist}/Autocomplete/index.js +0 -0
- /package/{src → dist}/Button/index.js +0 -0
- /package/{src → dist}/Caption/Caption.stories.svelte +0 -0
- /package/{src/Caption/index.ts → dist/Caption/index.d.ts} +0 -0
- /package/{src → dist}/Card/index.js +0 -0
- /package/{src → dist}/ChartFooter/ChartFooter.mdx +0 -0
- /package/{src → dist}/ChartFooter/ChartFooter.stories.svelte +0 -0
- /package/{src → dist}/ChartFooter/index.js +0 -0
- /package/{src → dist}/ChartHeader/ChartHeader.mdx +0 -0
- /package/{src → dist}/ChartHeader/ChartHeader.stories.svelte +0 -0
- /package/{src → dist}/ChartHeader/index.js +0 -0
- /package/{src → dist}/Copy/Copy.stories.svelte +0 -0
- /package/{src/Copy/index.ts → dist/Copy/index.d.ts} +0 -0
- /package/{src → dist}/DesignTokens/DesignTokens.mdx +0 -0
- /package/{src → dist}/DesignTokens/index.js +0 -0
- /package/{src → dist}/FormLabel/FormLabel.mdx +0 -0
- /package/{src → dist}/FormLabel/FormLabel.stories.svelte +0 -0
- /package/{src/FormLabel/index.ts → dist/FormLabel/index.d.ts} +0 -0
- /package/{src → dist}/Headline/Headline.stories.svelte +0 -0
- /package/{src/Headline/index.ts → dist/Headline/index.d.ts} +0 -0
- /package/{src → dist}/HighlightCard/index.js +0 -0
- /package/{src → dist}/Input/index.js +0 -0
- /package/{src → dist}/Logotype/Logotype.svelte +0 -0
- /package/{src → dist}/Middot/Middot.svelte +0 -0
- /package/{src → dist}/Middot/index.js +0 -0
- /package/{src → dist}/Note/Note.stories.svelte +0 -0
- /package/{src/Note/index.ts → dist/Note/index.d.ts} +0 -0
- /package/{src → dist}/Select/Select.mdx +0 -0
- /package/{src → dist}/Select/SelectStoriesTemplate.svelte +0 -0
- /package/{src → dist}/Select/index.js +0 -0
- /package/{src → dist}/Select/mock_data/jobs.json +0 -0
- /package/{src → dist}/Switcher/Switcher.mdx +0 -0
- /package/{src → dist}/Switcher/Switcher.stories.svelte +0 -0
- /package/{src → dist}/Switcher/index.js +0 -0
- /package/{src → dist}/app.html +0 -0
- /package/{src → dist}/assets/close-circle.svg.svelte +0 -0
- /package/{src → dist}/assets/grow.svg.svelte +0 -0
- /package/{src → dist}/assets/hand-pointer.svg.svelte +0 -0
- /package/{src → dist}/assets/shrink.svg.svelte +0 -0
- /package/{src → dist}/assets/tap.svg.svelte +0 -0
- /package/{src → dist}/assets/times-circle-solid.svg.svelte +0 -0
- /package/{src → dist}/maplibre/AttributionControl/index.js +0 -0
- /package/{src → dist}/maplibre/GeocoderControl/index.js +0 -0
- /package/{src → dist}/maplibre/Map/index.js +0 -0
- /package/{src → dist}/maplibre/MapControl/MapControl.mdx +0 -0
- /package/{src → dist}/maplibre/MapControl/index.js +0 -0
- /package/{src → dist}/maplibre/MapStyle/SWRDataLabLight.mdx +0 -0
- /package/{src → dist}/maplibre/MapStyle/index.js +0 -0
- /package/{src → dist}/maplibre/Maplibre.mdx +0 -0
- /package/{src → dist}/maplibre/NavigationControl/index.js +0 -0
- /package/{src → dist}/maplibre/ScaleControl/index.js +0 -0
- /package/{src → dist}/maplibre/Source/index.js +0 -0
- /package/{src → dist}/maplibre/Tooltip/index.js +0 -0
- /package/{src → dist}/maplibre/VectorLayer/index.js +0 -0
- /package/{src → dist}/maplibre/VectorTileSource/VectorTileSource.mdx +0 -0
- /package/{src → dist}/maplibre/VectorTileSource/index.js +0 -0
- /package/{src → dist}/maplibre/WithLinkLocation/WithLinkLocation.mdx +0 -0
- /package/{src → dist}/maplibre/WithLinkLocation/index.js +0 -0
- /package/{src → dist}/styles/base.scss +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface SwitcherProps {
|
|
2
|
+
/**
|
|
3
|
+
* Human-readable label
|
|
4
|
+
*/
|
|
5
|
+
label: string;
|
|
6
|
+
/**
|
|
7
|
+
* Available options
|
|
8
|
+
*/
|
|
9
|
+
options: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Display size
|
|
12
|
+
*/
|
|
13
|
+
size?: 'default' | 'small';
|
|
14
|
+
/**
|
|
15
|
+
* The currently-selected option
|
|
16
|
+
*/
|
|
17
|
+
value: string | null;
|
|
18
|
+
}
|
|
19
|
+
declare const Switcher: import("svelte").Component<SwitcherProps, {}, "value">;
|
|
20
|
+
type Switcher = ReturnType<typeof Switcher>;
|
|
21
|
+
export default Switcher;
|
package/{src → dist}/app.d.ts
RENAMED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default CloseCircle;
|
|
2
|
+
type CloseCircle = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const CloseCircle: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Grow;
|
|
2
|
+
type Grow = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Grow: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default HandPointer;
|
|
2
|
+
type HandPointer = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const HandPointer: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Shrink;
|
|
2
|
+
type Shrink = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Shrink: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Tap;
|
|
2
|
+
type Tap = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Tap: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default TimesCircleSolid;
|
|
2
|
+
type TimesCircleSolid = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const TimesCircleSolid: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { default as DesignTokens } from "./DesignTokens/DesignTokens.svelte";
|
|
2
|
+
export { tokens } from "./DesignTokens/index.js";
|
|
3
|
+
export { default as Headline } from "./Headline/Headline.svelte";
|
|
4
|
+
export { default as Copy } from "./Copy/Copy.svelte";
|
|
5
|
+
export { default as Caption } from "./Caption/Caption.svelte";
|
|
6
|
+
export { default as Note } from "./Note/Note.svelte";
|
|
7
|
+
export { default as Card } from "./Card/Card.svelte";
|
|
8
|
+
export { default as ChartHeader } from "./ChartHeader/ChartHeader.svelte";
|
|
9
|
+
export { default as ChartFooter } from "./ChartFooter/ChartFooter.svelte";
|
|
10
|
+
export { default as Logotype } from "./Logotype/Logotype.svelte";
|
|
11
|
+
export { default as Middot } from "./Middot/Middot.svelte";
|
|
12
|
+
export { default as Map } from "./maplibre/Map/Map.svelte";
|
|
13
|
+
export { SWRDataLabLight } from "./maplibre/MapStyle";
|
|
14
|
+
export { default as MapControl } from "./maplibre/MapControl/MapControl.svelte";
|
|
15
|
+
export { default as AttributionControl } from "./maplibre/AttributionControl/AttributionControl.svelte";
|
|
16
|
+
export { default as GeocoderControl } from "./maplibre/GeocoderControl/GeocoderControl.svelte";
|
|
17
|
+
export { default as NavigationControl } from "./maplibre/NavigationControl/NavigationControl.svelte";
|
|
18
|
+
export { default as ScaleControl } from "./maplibre/ScaleControl/ScaleControl.svelte";
|
|
19
|
+
export { default as VectorLayer } from "./maplibre/VectorLayer/VectorLayer.svelte";
|
|
20
|
+
export { default as VectorTileSource } from "./maplibre/VectorTileSource/VectorTileSource.svelte";
|
|
21
|
+
export { default as Tooltip } from "./maplibre/Tooltip/Tooltip.svelte";
|
|
22
|
+
export { default as WithLinkLocation } from "./maplibre/WithLinkLocation/WithLinkLocation.svelte";
|
|
23
|
+
export { default as FormLabel } from "./FormLabel/FormLabel.svelte";
|
|
24
|
+
export { default as Switcher } from "./Switcher/Switcher.svelte";
|
|
25
|
+
export { default as Input } from "./Input/Input.svelte";
|
|
26
|
+
export { default as Button } from "./Button/Button.svelte";
|
|
27
|
+
export { default as Select } from "./Select/Select.svelte";
|
|
28
|
+
export { default as Autocomplete } from "./Autocomplete/Autocomplete.svelte";
|
|
29
|
+
export { default as ChartList } from "./ChartList/ChartList.svelte";
|
package/{src → dist}/index.js
RENAMED
|
@@ -0,0 +1,27 @@
|
|
|
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>
|
|
@@ -0,0 +1,19 @@
|
|
|
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;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">import maplibre, {} from 'maplibre-gl';
|
|
2
|
+
import MapControl from '../MapControl/MapControl.svelte';
|
|
3
|
+
const { position = 'bottom-right', customAttribution } = $props();
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<MapControl
|
|
7
|
+
{position}
|
|
8
|
+
control={new maplibre.AttributionControl({
|
|
9
|
+
customAttribution,
|
|
10
|
+
compact: false
|
|
11
|
+
})}
|
|
12
|
+
/>
|
|
13
|
+
|
|
14
|
+
<style>
|
|
15
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ControlPosition } from 'maplibre-gl';
|
|
2
|
+
interface AttributionControlProps {
|
|
3
|
+
position?: ControlPosition;
|
|
4
|
+
customAttribution?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const AttributionControl: import("svelte").Component<AttributionControlProps, {}, "">;
|
|
7
|
+
type AttributionControl = ReturnType<typeof AttributionControl>;
|
|
8
|
+
export default AttributionControl;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type MaplibreGeocoderApi, type MaplibreGeocoderApiConfig, type MaplibreGeocoderFeatureResults } from '@maplibre/maplibre-gl-geocoder';
|
|
2
|
+
export declare class MaptilerGeocoderAPI implements MaplibreGeocoderApi {
|
|
3
|
+
key: string;
|
|
4
|
+
constructor(key: string);
|
|
5
|
+
forwardGeocode(config: MaplibreGeocoderApiConfig): Promise<MaplibreGeocoderFeatureResults>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {} from '@maplibre/maplibre-gl-geocoder';
|
|
2
|
+
export class MaptilerGeocoderAPI {
|
|
3
|
+
key;
|
|
4
|
+
constructor(key) {
|
|
5
|
+
this.key = key;
|
|
6
|
+
}
|
|
7
|
+
async forwardGeocode(config) {
|
|
8
|
+
const result = {
|
|
9
|
+
type: 'FeatureCollection',
|
|
10
|
+
features: []
|
|
11
|
+
};
|
|
12
|
+
try {
|
|
13
|
+
const response = await fetch(`https://api.maptiler.com/geocoding/${config.query}.json?country=${config.countries}&language=${config.language}&key=${this.key}`);
|
|
14
|
+
const geojson = await response.json();
|
|
15
|
+
for (const feature of geojson.features) {
|
|
16
|
+
const res = {
|
|
17
|
+
type: 'Feature',
|
|
18
|
+
id: feature.id,
|
|
19
|
+
place_type: ['place'],
|
|
20
|
+
place_name: feature.place_name,
|
|
21
|
+
language: feature.properties.display_name,
|
|
22
|
+
text: feature.text,
|
|
23
|
+
bbox: feature.bbox,
|
|
24
|
+
geometry: {
|
|
25
|
+
type: 'Point',
|
|
26
|
+
coordinates: feature.center
|
|
27
|
+
},
|
|
28
|
+
properties: {
|
|
29
|
+
text: feature.text
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
result.features.push(res);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
console.error(`Failed to forwardGeocode with error: ${e}`);
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
<script context="module" lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const { Story } = defineMeta({
|
|
12
|
-
title: 'Maplibre/Control/GeocoderControl',
|
|
13
|
-
component: GeocoderControl
|
|
14
|
-
});
|
|
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
|
+
});
|
|
15
11
|
</script>
|
|
16
12
|
|
|
17
13
|
<Story
|
|
@@ -0,0 +1,19 @@
|
|
|
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;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">import maplibre from 'maplibre-gl';
|
|
2
|
+
import MaplibreGeocoder, {} from '@maplibre/maplibre-gl-geocoder';
|
|
3
|
+
import { MaptilerGeocoderAPI } from './GeocoderAPIs';
|
|
4
|
+
import MapControl from '../MapControl/MapControl.svelte';
|
|
5
|
+
import {} from '../types';
|
|
6
|
+
const { key, service = 'maptiler', countries = 'de', languages = 'en', placeholder, limit = 3 } = $props();
|
|
7
|
+
const countriesArr = Array.isArray(countries) ? countries : [countries];
|
|
8
|
+
const languagesArr = Array.isArray(languages) ? languages : [languages];
|
|
9
|
+
// Future: initialise a different GeocoderAPI depending on "service"
|
|
10
|
+
let geocoderAPI = new MaptilerGeocoderAPI(key);
|
|
11
|
+
const geocoder = new MaplibreGeocoder(geocoderAPI, {
|
|
12
|
+
maplibregl: maplibre,
|
|
13
|
+
language: languagesArr.join(','),
|
|
14
|
+
countries: countriesArr.join(','),
|
|
15
|
+
showResultsWhileTyping: true,
|
|
16
|
+
showResultMarkers: false,
|
|
17
|
+
placeholder,
|
|
18
|
+
limit
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<MapControl control={geocoder} position="top-left" />
|
|
23
|
+
|
|
24
|
+
<style>
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type GeocodingCountry, type GeocodingLanguage, type GeocodingService } from '../types';
|
|
2
|
+
interface GeocoderControlProps {
|
|
3
|
+
service: GeocodingService;
|
|
4
|
+
/**
|
|
5
|
+
* API key for selected geocoding `service`
|
|
6
|
+
*/
|
|
7
|
+
key: string;
|
|
8
|
+
/**
|
|
9
|
+
* Maximum number of suggestions to display
|
|
10
|
+
*/
|
|
11
|
+
limit?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Limit search to one or more countries
|
|
14
|
+
*/
|
|
15
|
+
countries?: GeocodingCountry | GeocodingCountry[];
|
|
16
|
+
/**
|
|
17
|
+
* Limit search to one or more languages. The UI is localised to the first language specified if [available](https://github.com/maplibre/maplibre-gl-geocoder/blob/main/lib/localization.ts).
|
|
18
|
+
*/
|
|
19
|
+
languages?: GeocodingLanguage | GeocodingLanguage[];
|
|
20
|
+
/**
|
|
21
|
+
* Overwrite the default input placeholder text
|
|
22
|
+
*/
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
}
|
|
25
|
+
declare const GeocoderControl: import("svelte").Component<GeocoderControlProps, {}, "">;
|
|
26
|
+
type GeocoderControl = ReturnType<typeof GeocoderControl>;
|
|
27
|
+
export default GeocoderControl;
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
<script context="module" lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const { Story } = defineMeta({
|
|
22
|
-
title: 'Maplibre/Map',
|
|
23
|
-
component: Map
|
|
24
|
-
});
|
|
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
|
+
});
|
|
25
20
|
</script>
|
|
26
21
|
|
|
27
22
|
<Story
|
|
@@ -0,0 +1,19 @@
|
|
|
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;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<script lang="ts">import maplibre, {} from 'maplibre-gl';
|
|
2
|
+
import { onMount, onDestroy, getContext, hasContext } from 'svelte';
|
|
3
|
+
import { createMapContext } from '../context.svelte.js';
|
|
4
|
+
import {} from '../types';
|
|
5
|
+
import FallbackStyle from './FallbackStyle';
|
|
6
|
+
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, initialLocation = { lat: 51.3, lng: 10.2, zoom: 5 } } = $props();
|
|
7
|
+
let container;
|
|
8
|
+
const mapContext = createMapContext();
|
|
9
|
+
if (getContext('initialLocation') !== undefined && getContext('initialLocation') !== false) {
|
|
10
|
+
initialLocation = getContext('initialLocation');
|
|
11
|
+
}
|
|
12
|
+
onMount(() => {
|
|
13
|
+
mapContext.map = new maplibre.Map({
|
|
14
|
+
container,
|
|
15
|
+
style,
|
|
16
|
+
minZoom,
|
|
17
|
+
maxZoom,
|
|
18
|
+
pitch,
|
|
19
|
+
bearing,
|
|
20
|
+
attributionControl: false, // Added via component
|
|
21
|
+
center: [initialLocation.lng, initialLocation.lat],
|
|
22
|
+
zoom: initialLocation.zoom,
|
|
23
|
+
...options
|
|
24
|
+
});
|
|
25
|
+
mapContext.map.on('load', () => {
|
|
26
|
+
zoom = mapContext.map?.getZoom();
|
|
27
|
+
center = mapContext.map?.getCenter();
|
|
28
|
+
pitch = mapContext.map?.getPitch();
|
|
29
|
+
bearing = mapContext.map?.getBearing();
|
|
30
|
+
});
|
|
31
|
+
mapContext.map.on('moveend', () => {
|
|
32
|
+
zoom = mapContext.map?.getZoom();
|
|
33
|
+
center = mapContext.map?.getCenter();
|
|
34
|
+
pitch = mapContext.map?.getPitch();
|
|
35
|
+
bearing = mapContext.map?.getBearing();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
onDestroy(async () => {
|
|
39
|
+
if (mapContext.map)
|
|
40
|
+
mapContext.map.remove();
|
|
41
|
+
});
|
|
42
|
+
$effect(() => {
|
|
43
|
+
if (mapContext.map)
|
|
44
|
+
mapContext.map.setStyle(style);
|
|
45
|
+
});
|
|
46
|
+
$effect(() => {
|
|
47
|
+
if (mapContext.styleLoaded) {
|
|
48
|
+
mapContext.map?.setProjection(projection);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
$effect(() => {
|
|
52
|
+
if (allowZoom === false) {
|
|
53
|
+
mapContext.map?.scrollZoom.disable();
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
mapContext.map?.scrollZoom.enable();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<div bind:this={container} class="container" data-testid="map-container">
|
|
62
|
+
{#if mapContext.map}
|
|
63
|
+
{#if children}
|
|
64
|
+
{@render children()}
|
|
65
|
+
{/if}
|
|
66
|
+
{/if}
|
|
67
|
+
{#if showDebug}
|
|
68
|
+
<pre class="debug">
|
|
69
|
+
{Object.entries({ ...center, zoom, allowZoom, allowRotation })
|
|
70
|
+
.map(([key, val]) => `${key}: ${val}`)
|
|
71
|
+
.join('\n')}</pre>
|
|
72
|
+
{/if}
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<style>
|
|
76
|
+
.container {
|
|
77
|
+
width: 100%;
|
|
78
|
+
height: 100%;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.debug {
|
|
82
|
+
position: absolute;
|
|
83
|
+
top: 0;
|
|
84
|
+
right: 0;
|
|
85
|
+
background: rgba(0, 0, 0, 0.9);
|
|
86
|
+
color: white;
|
|
87
|
+
z-index: 1000;
|
|
88
|
+
padding: 2px;
|
|
89
|
+
font-family: monospace;
|
|
90
|
+
}
|
|
91
|
+
</style>
|