@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
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const tokens = {
|
|
2
|
-
sans_regular: ['SWR Sans Regular'],
|
|
3
|
-
sans_medium: ['SWR Sans Medium'],
|
|
4
|
-
sans_bold: ['SWR Sans Bold'],
|
|
5
|
-
background: 'hsl(0, 0%, 100%)',
|
|
6
|
-
water: 'hsl(210, 41%, 87%)',
|
|
7
|
-
water_light: 'hsl(210, 41%, 90%)',
|
|
8
|
-
marsh: 'hsl(200, 14%, 97%)',
|
|
9
|
-
grass: 'hsl(149, 37%, 97%)',
|
|
10
|
-
grass_dark: 'hsl(149, 37%, 93%)',
|
|
11
|
-
street_primary: 'hsl(0, 0%, 95%)',
|
|
12
|
-
street_primary_outline: 'hsla(0, 0%, 0%, 20%)',
|
|
13
|
-
street_secondary: 'hsl(0, 0%, 95%)',
|
|
14
|
-
street_secondary_outline: 'hsl(0, 0%, 50%)',
|
|
15
|
-
street_tertiary: 'hsl(0, 0%, 95%)',
|
|
16
|
-
street_tertiary_outline: 'hsl(0, 0%, 50%)',
|
|
17
|
-
label_primary: 'rgb(10, 10, 11)',
|
|
18
|
-
label_secondary: 'hsl(240, 2%, 20%)'
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default tokens;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import maplibre, { type ControlPosition } from 'maplibre-gl';
|
|
3
|
-
import MapControl from '../MapControl/MapControl.svelte';
|
|
4
|
-
|
|
5
|
-
interface NavigationControlProps {
|
|
6
|
-
showCompass?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Show 3d tilt in the compass control. Requires `showCompass` to be `true`
|
|
9
|
-
*/
|
|
10
|
-
visualizePitch?: boolean;
|
|
11
|
-
position?: ControlPosition;
|
|
12
|
-
}
|
|
13
|
-
const {
|
|
14
|
-
showCompass = false,
|
|
15
|
-
visualizePitch = false,
|
|
16
|
-
position = 'bottom-left'
|
|
17
|
-
}: NavigationControlProps = $props();
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<MapControl control={new maplibre.NavigationControl({ showCompass, visualizePitch })} {position} />
|
|
21
|
-
|
|
22
|
-
<style>
|
|
23
|
-
:global {
|
|
24
|
-
button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {
|
|
25
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E");
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon {
|
|
29
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
button.maplibregl-ctrl-compass .maplibregl-ctrl-icon {
|
|
33
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath d='m10.5 16 4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
</style>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import maplibre, { type ControlPosition, type Unit } from 'maplibre-gl';
|
|
3
|
-
import MapControl from '../MapControl/MapControl.svelte';
|
|
4
|
-
|
|
5
|
-
interface ScaleControlProps {
|
|
6
|
-
maxWidth?: number | undefined;
|
|
7
|
-
position?: ControlPosition;
|
|
8
|
-
unit?: Unit;
|
|
9
|
-
}
|
|
10
|
-
let { maxWidth = 100, unit = 'metric', position = 'bottom-left' }: ScaleControlProps = $props();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<MapControl control={new maplibre.ScaleControl({ maxWidth, unit })} {position} />
|
|
14
|
-
|
|
15
|
-
<style>
|
|
16
|
-
:global {
|
|
17
|
-
.maplibregl-ctrl-scale {
|
|
18
|
-
color: inherit;
|
|
19
|
-
border-bottom: 1px solid currentColor;
|
|
20
|
-
font-weight: 400;
|
|
21
|
-
font-size: var(--fs-small-3);
|
|
22
|
-
font-family: var(--swr-text);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
</style>
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { onDestroy, type Snippet } from 'svelte';
|
|
3
|
-
import { type Map, type SourceSpecification } from 'maplibre-gl';
|
|
4
|
-
import { getMapContext, createSourceContext } from '../context.svelte.js';
|
|
5
|
-
|
|
6
|
-
type Source = maplibregl.VectorTileSource;
|
|
7
|
-
|
|
8
|
-
interface MapSourceProps {
|
|
9
|
-
id: string;
|
|
10
|
-
sourceSpec: SourceSpecification;
|
|
11
|
-
source?: Source;
|
|
12
|
-
onLoad?: (map: Map, url?: string, data?: string) => undefined;
|
|
13
|
-
children?: Snippet;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
let { id, sourceSpec, source = $bindable(), children }: MapSourceProps = $props();
|
|
17
|
-
let firstRun = true;
|
|
18
|
-
|
|
19
|
-
// Get map context
|
|
20
|
-
const { map, styleLoaded } = $derived(getMapContext());
|
|
21
|
-
|
|
22
|
-
// Create source context
|
|
23
|
-
const sourceContext = createSourceContext();
|
|
24
|
-
|
|
25
|
-
// 1. Add the source to the map using the spec, then get the
|
|
26
|
-
// actual source object back from the map instance
|
|
27
|
-
$effect(() => {
|
|
28
|
-
if (map && styleLoaded) {
|
|
29
|
-
// See: https://svelte.dev/docs/svelte/$state#$state.snapshot
|
|
30
|
-
map.addSource(id, $state.snapshot(sourceSpec) as SourceSpecification);
|
|
31
|
-
source = map.getSource(id);
|
|
32
|
-
firstRun = true;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// 2. Do extra stuff with the source object
|
|
37
|
-
$effect(() => {
|
|
38
|
-
if (source) {
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
$effect(() => {
|
|
43
|
-
source;
|
|
44
|
-
firstRun = false;
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
onDestroy(() => {
|
|
48
|
-
if (map && styleLoaded) {
|
|
49
|
-
const layers = map?.getStyle().layers;
|
|
50
|
-
layers
|
|
51
|
-
.filter((l) => l.type !== 'background' && l.source == id)
|
|
52
|
-
.forEach((l) => {
|
|
53
|
-
map?.removeLayer(l.id);
|
|
54
|
-
});
|
|
55
|
-
map.removeSource(id);
|
|
56
|
-
source = undefined;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
</script>
|
|
60
|
-
|
|
61
|
-
{@render children?.()}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { Map, SourceSpecification } from 'maplibre-gl';
|
|
2
|
-
import { tick } from 'svelte';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Add a source to the map.
|
|
6
|
-
*
|
|
7
|
-
* @param map - The map instance
|
|
8
|
-
* @param sourceId - The ID of the source to add
|
|
9
|
-
* @param source - The source specification object
|
|
10
|
-
* @param okToAdd - Callback to check if the source should still be added
|
|
11
|
-
* @param cb - Callback when the source has been added
|
|
12
|
-
*
|
|
13
|
-
* This properly handles the case where an old source with the same ID is still being removed.
|
|
14
|
-
*/
|
|
15
|
-
export function addSource(
|
|
16
|
-
map: Map,
|
|
17
|
-
sourceId: string,
|
|
18
|
-
source: SourceSpecification,
|
|
19
|
-
okToAdd: (sourceId: string) => boolean,
|
|
20
|
-
cb: () => void
|
|
21
|
-
) {
|
|
22
|
-
// If there was an old source with the same ID, then remove it. This can happen when removing a source and adding a new source in quick succession.
|
|
23
|
-
let removed = false;
|
|
24
|
-
if (map.getSource(sourceId)) {
|
|
25
|
-
removed = true;
|
|
26
|
-
map.removeSource(sourceId);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const doAddSource = () => {
|
|
30
|
-
if (!okToAdd(sourceId)) {
|
|
31
|
-
// in case the component was destroyed or the id changed while waiting to call this
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
map.addSource(sourceId, source);
|
|
36
|
-
cb();
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
if (removed) {
|
|
40
|
-
// Source removal happens quickly but asynchronously, and we have no way to really interlock on when it happens, so just loop until it does.
|
|
41
|
-
const waitForRemoval = () => {
|
|
42
|
-
if (!sourceId) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (map.getSource(sourceId)) {
|
|
47
|
-
// The source hasn't been removed yet, so keep waiting.
|
|
48
|
-
setTimeout(waitForRemoval, 1);
|
|
49
|
-
} else {
|
|
50
|
-
doAddSource();
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
waitForRemoval();
|
|
55
|
-
} else {
|
|
56
|
-
// If we don't have an existing source to remove (i.e. the normal case) then
|
|
57
|
-
// just add the source right away.
|
|
58
|
-
doAddSource();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* A helper function that removes a source from the map after all of the layers inside it have
|
|
64
|
-
* had a chance to remove themselves.
|
|
65
|
-
*
|
|
66
|
-
* @param {Readable<Map|undefined>} mapStore - The store containing the Map instance
|
|
67
|
-
* @param {string} sourceId - The ID of the source to remove
|
|
68
|
-
* @param {unknown} sourceObj - The source object that was originally added
|
|
69
|
-
*
|
|
70
|
-
* Waits one tick to ensure layers have a chance to be removed, then checks if the
|
|
71
|
-
* source with the given ID is still the same object as was originally added.
|
|
72
|
-
*
|
|
73
|
-
* If so, it removes the source from the map. This avoids removing a source that was
|
|
74
|
-
* already replaced by another source reusing the same ID.
|
|
75
|
-
*/
|
|
76
|
-
export function removeSource(map: Map, sourceId: string, sourceObj: unknown) {
|
|
77
|
-
tick().then(() => {
|
|
78
|
-
// Wait a tick so that the layers inside this source can all be removed.
|
|
79
|
-
// But make sure that the source wasn't already replaced with another source with the same ID.
|
|
80
|
-
if (!map.loaded()) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
let remainingSource = map.getSource(sourceId);
|
|
85
|
-
if (remainingSource === sourceObj) {
|
|
86
|
-
map.removeSource(sourceId);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { onDestroy, type Snippet } from 'svelte';
|
|
3
|
-
import maplibre, { type Listener, type LngLatLike } from 'maplibre-gl';
|
|
4
|
-
import { getMapContext } from '../context.svelte.js';
|
|
5
|
-
import { resetPopupEventListener } from '../utils';
|
|
6
|
-
|
|
7
|
-
interface TooltipProps {
|
|
8
|
-
position: LngLatLike | undefined;
|
|
9
|
-
children?: Snippet;
|
|
10
|
-
maxWidth?: number;
|
|
11
|
-
showCloseButton?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Close the tooltip if the user clicks anywhere on the map
|
|
14
|
-
*/
|
|
15
|
-
closeOnClick?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* y axis offset (px)
|
|
18
|
-
*/
|
|
19
|
-
offset?: number;
|
|
20
|
-
/**
|
|
21
|
-
* Toggle mouse events on the tooltip element. Should be false if the tooltip appears on hover to avoid flickering.
|
|
22
|
-
*/
|
|
23
|
-
mouseEvents?: boolean;
|
|
24
|
-
onClose?: Listener | undefined;
|
|
25
|
-
onOpen?: Listener | undefined;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
let {
|
|
29
|
-
position,
|
|
30
|
-
children,
|
|
31
|
-
offset = 20,
|
|
32
|
-
maxWidth = 360,
|
|
33
|
-
showCloseButton = false,
|
|
34
|
-
closeOnClick = true,
|
|
35
|
-
mouseEvents = false,
|
|
36
|
-
onClose,
|
|
37
|
-
onOpen
|
|
38
|
-
}: TooltipProps = $props();
|
|
39
|
-
|
|
40
|
-
const { map } = $derived(getMapContext());
|
|
41
|
-
|
|
42
|
-
let tooltip = new maplibre.Popup({
|
|
43
|
-
closeButton: showCloseButton,
|
|
44
|
-
closeOnClick: closeOnClick,
|
|
45
|
-
maxWidth: `${maxWidth}px`,
|
|
46
|
-
offset: offset
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
let el: Node | undefined = $state();
|
|
50
|
-
|
|
51
|
-
$effect(() => {
|
|
52
|
-
if (position && el && map) {
|
|
53
|
-
tooltip.setLngLat(position).setDOMContent(el).addTo(map);
|
|
54
|
-
} else {
|
|
55
|
-
tooltip.remove();
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// Bind events
|
|
60
|
-
$effect(() => resetPopupEventListener(tooltip, 'open', onOpen));
|
|
61
|
-
$effect(() => resetPopupEventListener(tooltip, 'close', onClose));
|
|
62
|
-
|
|
63
|
-
onDestroy(() => tooltip.remove());
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
<div bind:this={el} class="container" class:mouseEvents>
|
|
67
|
-
{@render children?.()}
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
<style>
|
|
71
|
-
.container {
|
|
72
|
-
background: white;
|
|
73
|
-
padding: 0.75em;
|
|
74
|
-
border-radius: 2px;
|
|
75
|
-
border: 1px solid rgba(0, 0, 0, 0.75);
|
|
76
|
-
border-radius: var(--br-small);
|
|
77
|
-
filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.1));
|
|
78
|
-
pointer-events: none;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.mouseEvents {
|
|
82
|
-
pointer-events: all;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
:global {
|
|
86
|
-
.maplibregl-popup {
|
|
87
|
-
top: 0;
|
|
88
|
-
left: 0;
|
|
89
|
-
display: flex;
|
|
90
|
-
position: absolute;
|
|
91
|
-
will-change: transform;
|
|
92
|
-
}
|
|
93
|
-
.maplibregl-popup-anchor-top,
|
|
94
|
-
.maplibregl-popup-anchor-top-left,
|
|
95
|
-
.maplibregl-popup-anchor-top-right {
|
|
96
|
-
flex-direction: column;
|
|
97
|
-
}
|
|
98
|
-
.maplibregl-popup-anchor-bottom,
|
|
99
|
-
.maplibregl-popup-anchor-bottom-left,
|
|
100
|
-
.maplibregl-popup-anchor-bottom-right {
|
|
101
|
-
flex-direction: column-reverse;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.maplibregl-popup-anchor-left {
|
|
105
|
-
flex-direction: row;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.maplibregl-popup-anchor-right {
|
|
109
|
-
flex-direction: row-reverse;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
|
|
113
|
-
transform: translateY(50%) rotate(45deg);
|
|
114
|
-
align-self: center;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.maplibregl-popup-anchor-top .maplibregl-popup-tip {
|
|
118
|
-
transform: translateY(-50%) rotate(-135deg);
|
|
119
|
-
align-self: center;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.maplibregl-popup-anchor-left .maplibregl-popup-tip {
|
|
123
|
-
transform: translateX(-50%) rotate(135deg);
|
|
124
|
-
align-self: center;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip {
|
|
128
|
-
transform: translateY(1em) translateX(-50%) rotate(135deg);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip {
|
|
132
|
-
transform: translateY(-1em) translateX(-50%) rotate(135deg);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.maplibregl-popup-anchor-right .maplibregl-popup-tip {
|
|
136
|
-
transform: translateX(50%) rotate(-45deg);
|
|
137
|
-
align-self: center;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
|
|
141
|
-
transform: translateX(-1em) translateY(-50%) rotate(-135deg);
|
|
142
|
-
align-self: flex-end;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
|
|
146
|
-
transform: translateX(-1em) translateY(50%) rotate(45deg);
|
|
147
|
-
align-self: flex-end;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.maplibregl-popup-close-button {
|
|
151
|
-
position: absolute;
|
|
152
|
-
top: 0.5em;
|
|
153
|
-
right: 0.5em;
|
|
154
|
-
cursor: pointer;
|
|
155
|
-
border-radius: 2px;
|
|
156
|
-
display: flex;
|
|
157
|
-
justify-content: center;
|
|
158
|
-
align-items: center;
|
|
159
|
-
padding-bottom: 0.15em;
|
|
160
|
-
font-size: 1.25rem;
|
|
161
|
-
width: 1.1em;
|
|
162
|
-
height: 1.1em;
|
|
163
|
-
z-index: 100;
|
|
164
|
-
background: white;
|
|
165
|
-
border: 1px solid var(--gray-dark-5);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.maplibregl-popup-close-button:hover,
|
|
169
|
-
.maplibregl-popup-close-button:focus {
|
|
170
|
-
background: var(--gray-light-5);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.maplibregl-popup-tip {
|
|
174
|
-
width: 0.65rem;
|
|
175
|
-
height: 0.65rem;
|
|
176
|
-
background: white;
|
|
177
|
-
position: absolute;
|
|
178
|
-
border-right: 1px solid rgba(0, 0, 0, 0.75);
|
|
179
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.75);
|
|
180
|
-
z-index: 10;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
</style>
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
AddLayerObject,
|
|
4
|
-
FillLayoutProps,
|
|
5
|
-
FillPaintProps,
|
|
6
|
-
LineLayoutProps,
|
|
7
|
-
LinePaintProps,
|
|
8
|
-
MapGeoJSONFeature,
|
|
9
|
-
MapLayerMouseEvent
|
|
10
|
-
} from 'maplibre-gl';
|
|
11
|
-
|
|
12
|
-
import { getMapContext } from '../context.svelte.js';
|
|
13
|
-
import { onDestroy } from 'svelte';
|
|
14
|
-
import { resetLayerEventListener } from '../utils.js';
|
|
15
|
-
|
|
16
|
-
interface VectorLayerProps {
|
|
17
|
-
id: string;
|
|
18
|
-
sourceId: string;
|
|
19
|
-
sourceLayer: string;
|
|
20
|
-
type: 'line' | 'fill' | 'circle' | 'symbol';
|
|
21
|
-
placeBelow: string;
|
|
22
|
-
visible?: boolean;
|
|
23
|
-
minZoom?: number;
|
|
24
|
-
maxZoom?: number;
|
|
25
|
-
paint?: LinePaintProps | FillPaintProps;
|
|
26
|
-
layout?: LineLayoutProps | FillLayoutProps;
|
|
27
|
-
hovered?: MapGeoJSONFeature | undefined;
|
|
28
|
-
selected?: MapGeoJSONFeature | undefined;
|
|
29
|
-
|
|
30
|
-
onclick: (e: MapLayerMouseEvent) => any;
|
|
31
|
-
onmousemove: (e: MapLayerMouseEvent) => any;
|
|
32
|
-
onmouseleave: (e: MapLayerMouseEvent) => any;
|
|
33
|
-
}
|
|
34
|
-
const {
|
|
35
|
-
id,
|
|
36
|
-
sourceId,
|
|
37
|
-
sourceLayer,
|
|
38
|
-
visible = true,
|
|
39
|
-
placeBelow = 'label-place-capital',
|
|
40
|
-
type,
|
|
41
|
-
paint,
|
|
42
|
-
layout,
|
|
43
|
-
hovered = $bindable(),
|
|
44
|
-
selected = $bindable(),
|
|
45
|
-
minZoom = 0,
|
|
46
|
-
maxZoom = 24,
|
|
47
|
-
onclick,
|
|
48
|
-
onmousemove,
|
|
49
|
-
onmouseleave
|
|
50
|
-
}: VectorLayerProps = $props();
|
|
51
|
-
|
|
52
|
-
const { map, styleLoaded } = $derived(getMapContext());
|
|
53
|
-
let beforeId: string | undefined = $state();
|
|
54
|
-
let prevSelected: string | number | undefined = $state();
|
|
55
|
-
let prevHovered: string | number | undefined = $state();
|
|
56
|
-
|
|
57
|
-
const layerSpec = {
|
|
58
|
-
id,
|
|
59
|
-
type,
|
|
60
|
-
source: sourceId,
|
|
61
|
-
'source-layer': sourceLayer,
|
|
62
|
-
layout: $state.snapshot(layout) ?? {},
|
|
63
|
-
paint: $state.snapshot(paint) ?? {},
|
|
64
|
-
minzoom: minZoom,
|
|
65
|
-
maxzoom: maxZoom
|
|
66
|
-
} as AddLayerObject;
|
|
67
|
-
|
|
68
|
-
$effect(() => {
|
|
69
|
-
if (map && styleLoaded) {
|
|
70
|
-
const style = map.getStyle();
|
|
71
|
-
beforeId = style.layers.find((l) => {
|
|
72
|
-
return l.id === placeBelow;
|
|
73
|
-
})?.id;
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
$effect(() => {
|
|
78
|
-
if (map && styleLoaded && beforeId) {
|
|
79
|
-
map.addLayer(layerSpec, beforeId);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
$effect(() => resetLayerEventListener(map, 'click', id, onclick));
|
|
84
|
-
$effect(() => resetLayerEventListener(map, 'mousemove', id, onmousemove));
|
|
85
|
-
$effect(() => resetLayerEventListener(map, 'mouseleave', id, onmouseleave));
|
|
86
|
-
|
|
87
|
-
// Set hovered feature state
|
|
88
|
-
$effect(() => {
|
|
89
|
-
if (styleLoaded) {
|
|
90
|
-
if (hovered) {
|
|
91
|
-
if (prevHovered) {
|
|
92
|
-
map?.setFeatureState(
|
|
93
|
-
{ source: sourceId, sourceLayer: sourceLayer, id: prevHovered },
|
|
94
|
-
{ hovered: false }
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
map?.setFeatureState(
|
|
98
|
-
{ source: sourceId, sourceLayer: sourceLayer, id: hovered.id },
|
|
99
|
-
{ hovered: true }
|
|
100
|
-
);
|
|
101
|
-
prevHovered = hovered.id;
|
|
102
|
-
} else {
|
|
103
|
-
if (prevHovered) {
|
|
104
|
-
map?.setFeatureState(
|
|
105
|
-
{ source: sourceId, sourceLayer: sourceLayer, id: prevHovered },
|
|
106
|
-
{ hovered: false }
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// Set selected feature state
|
|
114
|
-
$effect(() => {
|
|
115
|
-
if (styleLoaded) {
|
|
116
|
-
if (selected) {
|
|
117
|
-
if (prevSelected) {
|
|
118
|
-
map?.setFeatureState(
|
|
119
|
-
{ source: sourceId, sourceLayer: sourceLayer, id: prevSelected },
|
|
120
|
-
{ selected: false }
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
map?.setFeatureState(
|
|
124
|
-
{ source: sourceId, sourceLayer: sourceLayer, id: selected.id },
|
|
125
|
-
{ selected: true }
|
|
126
|
-
);
|
|
127
|
-
prevSelected = selected.id;
|
|
128
|
-
} else {
|
|
129
|
-
if (prevSelected) {
|
|
130
|
-
map?.setFeatureState(
|
|
131
|
-
{ source: sourceId, sourceLayer: sourceLayer, id: prevSelected },
|
|
132
|
-
{ selected: false }
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
onDestroy(() => {
|
|
140
|
-
if (map && map.getLayer(id)) map.removeLayer(id);
|
|
141
|
-
});
|
|
142
|
-
</script>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { type Snippet } from 'svelte';
|
|
3
|
-
import { type SourceSpecification } from 'maplibre-gl';
|
|
4
|
-
import MapSource from '../Source/MapSource.svelte';
|
|
5
|
-
|
|
6
|
-
interface VectorTileSourceProps {
|
|
7
|
-
id: string;
|
|
8
|
-
url: string;
|
|
9
|
-
minZoom?: number;
|
|
10
|
-
maxZoom?: number;
|
|
11
|
-
children?: Snippet;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const { minZoom = 0, maxZoom = 24, id, url }: VectorTileSourceProps = $props();
|
|
15
|
-
|
|
16
|
-
const sourceSpec: SourceSpecification = {
|
|
17
|
-
type: 'vector',
|
|
18
|
-
tiles: [url],
|
|
19
|
-
maxzoom: maxZoom,
|
|
20
|
-
minzoom: minZoom
|
|
21
|
-
};
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<MapSource {id} {sourceSpec} />
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<script context="module" lang="ts">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import WithLinkLocation from './WithLinkLocation.svelte';
|
|
4
|
-
import DesignTokens from '../../DesignTokens/DesignTokens.svelte';
|
|
5
|
-
import Map from '../Map/Map.svelte';
|
|
6
|
-
import { SWRDataLabLight } from '../MapStyle';
|
|
7
|
-
|
|
8
|
-
const { Story } = defineMeta({
|
|
9
|
-
title: 'Maplibre/Extras/WithLinkLocation',
|
|
10
|
-
component: WithLinkLocation
|
|
11
|
-
});
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<Story asChild name="Default">
|
|
15
|
-
<DesignTokens>
|
|
16
|
-
<div class="container">
|
|
17
|
-
<WithLinkLocation countries="de" languages="de" service="maptiler" key="V32kPHZjMa0Mkn6YvSzA">
|
|
18
|
-
<Map style={SWRDataLabLight} initialLocation={{ lat: 51, lng: 10, zoom: 20 }}></Map>
|
|
19
|
-
</WithLinkLocation>
|
|
20
|
-
</div>
|
|
21
|
-
</DesignTokens>
|
|
22
|
-
</Story>
|
|
23
|
-
|
|
24
|
-
<style>
|
|
25
|
-
.container {
|
|
26
|
-
width: 500px;
|
|
27
|
-
height: 300px;
|
|
28
|
-
}
|
|
29
|
-
</style>
|