@swr-data-lab/components 1.13.0 → 1.13.2
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.svelte +237 -0
- package/dist/Autocomplete/Autocomplete.svelte.d.ts +34 -0
- package/dist/Autocomplete/index.d.ts +2 -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.svelte +21 -0
- package/dist/Caption/Caption.svelte.d.ts +8 -0
- package/dist/Caption/index.js +2 -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.svelte +38 -0
- package/dist/ChartFooter/ChartFooter.svelte.d.ts +8 -0
- package/dist/ChartFooter/index.d.ts +2 -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/{src → dist}/ChartList/ChartList.svelte +2 -16
- package/dist/ChartList/ChartList.svelte.d.ts +14 -0
- package/dist/ChartList/index.js +2 -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/{src → dist}/FormLabel/FormLabel.svelte +2 -9
- package/dist/FormLabel/FormLabel.svelte.d.ts +9 -0
- package/dist/FormLabel/index.js +2 -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/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/Logotype/Logotype.svelte.d.ts +26 -0
- package/dist/Middot/Middot.svelte.d.ts +26 -0
- package/dist/Middot/index.d.ts +2 -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/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/index.d.ts +2 -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/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/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/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/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.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/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/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/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.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/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/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/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.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/formatNumber.d.ts +18 -0
- package/dist/utils/getColorsBetween.d.ts +9 -0
- package/dist/utils/getComparisonDiffs.d.ts +6 -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/getLaenderNicenameFromAgs.d.ts +7 -0
- package/dist/utils/isSvelteComponent.d.ts +7 -0
- package/dist/utils/prepareSophoraModel.d.ts +2 -0
- package/dist/utils/scrollIntoViewWithOffset.d.ts +7 -0
- package/dist/utils/slugify.d.ts +1 -0
- package/dist/utils/slugify.js +11 -0
- package/dist/utils/topoToGeo.d.ts +7 -0
- package/package.json +28 -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.stories.svelte +0 -61
- 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.stories.svelte +0 -24
- 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.stories.svelte +0 -32
- package/src/ChartFooter/ChartFooter.svelte +0 -46
- package/src/ChartHeader/ChartHeader.stories.svelte +0 -31
- package/src/ChartList/ChartList.stories.svelte +0 -48
- package/src/Copy/Copy.stories.svelte +0 -32
- package/src/Copy/Copy.svelte +0 -29
- package/src/DesignTokens/DesignTokens.svelte +0 -71
- package/src/DesignTokens/Tokens.ts +0 -186
- package/src/FormLabel/FormLabel.stories.svelte +0 -52
- package/src/Headline/Headline.stories.svelte +0 -17
- package/src/HighlightCard/HighlightCard.stories.svelte +0 -57
- package/src/HighlightCard/HighlightCard.svelte +0 -65
- package/src/Input/Input.svelte +0 -21
- package/src/Logotype/Logotype.stories.svelte +0 -16
- package/src/Middot/Middot.stories.svelte +0 -16
- package/src/Note/Note.stories.svelte +0 -23
- package/src/Note/Note.svelte +0 -38
- package/src/Select/Select.stories.svelte +0 -205
- package/src/Select/Select.svelte +0 -76
- package/src/Select/SelectStoriesTemplate.svelte +0 -31
- package/src/Switcher/Switcher.stories.svelte +0 -44
- 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.stories.svelte +0 -78
- package/src/maplibre/GeocoderControl/GeocoderControl.svelte +0 -211
- package/src/maplibre/Map/FallbackStyle.ts +0 -18
- package/src/maplibre/Map/Map.stories.svelte +0 -118
- 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.stories.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.stories.svelte +0 -39
- package/src/maplibre/NavigationControl/NavigationControl.svelte +0 -36
- package/src/maplibre/ScaleControl/ScaleControl.stories.svelte +0 -71
- 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.stories.svelte +0 -192
- package/src/maplibre/Tooltip/Tooltip.svelte +0 -183
- package/src/maplibre/VectorLayer/VectorLayer.stories.svelte +0 -65
- package/src/maplibre/VectorLayer/VectorLayer.svelte +0 -146
- package/src/maplibre/VectorTileSource/VectorTileSource.stories.svelte +0 -46
- 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/getEmbedContext.js +0 -28
- 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/index.js +0 -0
- /package/{src → dist}/Button/index.js +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/index.js +0 -0
- /package/{src → dist}/ChartHeader/ChartHeader.mdx +0 -0
- /package/{src → dist}/ChartHeader/index.js +0 -0
- /package/{src → dist}/ChartList/ChartList.mdx +0 -0
- /package/{src/ChartList/index.ts → dist/ChartList/index.d.ts} +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/FormLabel/index.ts → dist/FormLabel/index.d.ts} +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}/Intro.mdx +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/Note/index.ts → dist/Note/index.d.ts} +0 -0
- /package/{src → dist}/Select/Select.mdx +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/index.js +0 -0
- /package/{src → dist}/app.d.ts +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}/index.js +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
- /package/{src → dist}/utils/formatDate.js +0 -0
- /package/{src → dist}/utils/formatNumber.js +0 -0
- /package/{src → dist}/utils/getColorsBetween.js +0 -0
- /package/{src → dist}/utils/getComparisonDiffs.js +0 -0
- /package/{src → dist}/utils/getLaenderFromTopo.js +0 -0
- /package/{src → dist}/utils/getLaenderNicenameFromAgs.js +0 -0
- /package/{src → dist}/utils/isSvelteComponent.js +0 -0
- /package/{src → dist}/utils/prepareSophoraModel.js +0 -0
- /package/{src → dist}/utils/scrollIntoViewWithOffset.js +0 -0
- /package/{src → dist}/utils/topoToGeo.js +0 -0
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { FillLayerSpecification, LineLayerSpecification } from 'maplibre-gl';
|
|
2
|
-
|
|
3
2
|
export type Layer = LineLayerSpecification | FillLayerSpecification;
|
|
4
3
|
export type GeocodingService = 'maptiler';
|
|
5
4
|
export type GeocodingCountry = 'de' | 'at';
|
|
6
5
|
export type GeocodingLanguage = 'de' | 'en';
|
|
7
|
-
|
|
8
6
|
export interface Location {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
lat: number;
|
|
8
|
+
lng: number;
|
|
9
|
+
zoom: number;
|
|
12
10
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Evented, Listener, Map, MapLayerEventType, Popup } from 'maplibre-gl';
|
|
2
|
+
export declare function resetEventListener(evented: Evented | null | undefined, type: string, listener: Listener | undefined): () => void;
|
|
3
|
+
export declare function resetLayerEventListener(map: Map | null, type: keyof MapLayerEventType, layer: string, listener: Listener | undefined): () => void;
|
|
4
|
+
export declare function resetPopupEventListener(popup: Popup | null, type: 'open' | 'close', listener: Listener | undefined): () => void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Source: https://github.com/MIERUNE/svelte-maplibre-gl/blob/main/src/lib/maplibre/utils.ts
|
|
2
|
+
export function resetEventListener(evented, type, listener) {
|
|
3
|
+
if (listener) {
|
|
4
|
+
evented?.on(type, listener);
|
|
5
|
+
}
|
|
6
|
+
const prevListener = listener;
|
|
7
|
+
return () => {
|
|
8
|
+
if (prevListener) {
|
|
9
|
+
evented?.off(type, prevListener);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function resetLayerEventListener(map, type, layer, listener) {
|
|
14
|
+
if (listener) {
|
|
15
|
+
map?.on(type, layer, listener);
|
|
16
|
+
}
|
|
17
|
+
const prevListener = listener;
|
|
18
|
+
return () => {
|
|
19
|
+
if (prevListener) {
|
|
20
|
+
map?.off(type, layer, prevListener);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function resetPopupEventListener(popup, type, listener) {
|
|
25
|
+
if (listener) {
|
|
26
|
+
popup?.on(type, listener);
|
|
27
|
+
}
|
|
28
|
+
const prevListener = listener;
|
|
29
|
+
return () => {
|
|
30
|
+
if (prevListener) {
|
|
31
|
+
popup?.off(type, prevListener);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const defaultFormat: ",.1f";
|
|
2
|
+
export namespace defaultLocale {
|
|
3
|
+
let decimal: string;
|
|
4
|
+
let thousands: string;
|
|
5
|
+
let grouping: number[];
|
|
6
|
+
let currency: string[];
|
|
7
|
+
}
|
|
8
|
+
declare function _default({ number, format, locale }: {
|
|
9
|
+
number: any;
|
|
10
|
+
format?: string | undefined;
|
|
11
|
+
locale?: {
|
|
12
|
+
decimal: string;
|
|
13
|
+
thousands: string;
|
|
14
|
+
grouping: number[];
|
|
15
|
+
currency: string[];
|
|
16
|
+
} | undefined;
|
|
17
|
+
}): string;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get current url params or - if on production - params from embed url.
|
|
3
|
+
* @param {object} embed root dom element
|
|
4
|
+
* @returns {object} url params
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const getEmbedContext = (target) => {
|
|
8
|
+
let url;
|
|
9
|
+
if (
|
|
10
|
+
window.location.origin === 'https://d.swr.de' ||
|
|
11
|
+
window.location.origin === 'https://static.datenhub.net' ||
|
|
12
|
+
window.location.href.includes('apidata.googleusercontent.com') ||
|
|
13
|
+
window.location.href.includes('storage.googleapis.com')
|
|
14
|
+
) {
|
|
15
|
+
url = window.location.href;
|
|
16
|
+
} else {
|
|
17
|
+
const parent = target.parentNode || target.parentNode.parentNode;
|
|
18
|
+
url = parent.dataset.url;
|
|
19
|
+
}
|
|
20
|
+
const data = {};
|
|
21
|
+
for (const [key, value] of new URL(url).searchParams) {
|
|
22
|
+
data[key] = value;
|
|
23
|
+
}
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default getEmbedContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function slugify(str: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Source: https://svelte.dev/playground/b130be5e485441a1842ae97e4ce4f244?version=5.20.0
|
|
2
|
+
export default function slugify(str) {
|
|
3
|
+
return str
|
|
4
|
+
.replace(/\s+/g, '-')
|
|
5
|
+
.replace(/-+/g, '-')
|
|
6
|
+
.trim()
|
|
7
|
+
.normalize('NFKD')
|
|
8
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
9
|
+
.toLowerCase()
|
|
10
|
+
.replace(/[^a-z0-9 -]/g, '');
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swr-data-lab/components",
|
|
3
3
|
"description": "SWR Data Lab component library",
|
|
4
|
+
"version": "1.13.2",
|
|
4
5
|
"author": "SWR Data Lab",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"type": "module",
|
|
5
8
|
"publishConfig": {
|
|
6
9
|
"access": "restricted"
|
|
7
10
|
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"url": "https://github.com/SWRdata/components"
|
|
13
|
+
},
|
|
8
14
|
"scripts": {
|
|
9
15
|
"dev": "vite dev",
|
|
10
16
|
"build": "vite build",
|
|
11
17
|
"preview": "vite preview",
|
|
18
|
+
"package": "svelte-kit sync && svelte-package -i src && publint",
|
|
19
|
+
"prepublishOnly": "npm run package",
|
|
12
20
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
13
21
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
14
22
|
"storybook": "storybook dev -p 6006",
|
|
15
23
|
"start": "storybook dev -p 6006",
|
|
24
|
+
"sync": "svelte-kit sync",
|
|
16
25
|
"build-storybook": "storybook build --disable-telemetry",
|
|
17
26
|
"test-storybook": "vitest run --project=storybook",
|
|
18
27
|
"test-storybook:ci": "concurrently -k -s first -n \"Storybook,Test\" -c \"magenta,blue\" \"npm run build-storybook --quiet && npx http-server storybook-static --port 6006 --silent\" \"wait-on tcp:6006 && npm run test-storybook\"",
|
|
19
28
|
"semantic-release": "semantic-release"
|
|
20
29
|
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"svelte": ">=5.0.0"
|
|
32
|
+
},
|
|
21
33
|
"dependencies": {
|
|
22
34
|
"@maplibre/maplibre-gl-geocoder": "^1.8.0",
|
|
23
35
|
"maplibre-gl": "^5.5.0",
|
|
@@ -36,6 +48,7 @@
|
|
|
36
48
|
"@storybook/test-runner": "^0.23.0-next.1",
|
|
37
49
|
"@sveltejs/adapter-auto": "^3.0.0",
|
|
38
50
|
"@sveltejs/kit": "^2.0.0",
|
|
51
|
+
"@sveltejs/package": "^2.3.11",
|
|
39
52
|
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
40
53
|
"@versatiles/style": "^5.6.0",
|
|
41
54
|
"@vitest/browser": "^3.1.1",
|
|
@@ -44,17 +57,22 @@
|
|
|
44
57
|
"http-server": "^14.1.1",
|
|
45
58
|
"mdx-mermaid": "^2.0.3",
|
|
46
59
|
"playwright": "^1.51.1",
|
|
47
|
-
"
|
|
60
|
+
"publint": "^0.3.12",
|
|
61
|
+
"sass": "^1.89.0",
|
|
62
|
+
"sass-embedded": "^1.89.0",
|
|
48
63
|
"semantic-release": "^24.1.2",
|
|
49
64
|
"storybook": "^9.0.0-beta.11",
|
|
50
65
|
"svelte": "^5.23.0",
|
|
51
66
|
"svelte-check": "^4.0.0",
|
|
67
|
+
"svelte-preprocess": "^6.0.3",
|
|
52
68
|
"typescript": "^5.8.3",
|
|
53
69
|
"vite": "^6.0.0",
|
|
54
70
|
"vitest": "^3.1.1",
|
|
55
71
|
"wait-on": "^8.0.1"
|
|
56
72
|
},
|
|
57
|
-
"
|
|
73
|
+
"overrides": {
|
|
74
|
+
"storybook": "$storybook"
|
|
75
|
+
},
|
|
58
76
|
"release": {
|
|
59
77
|
"plugins": [
|
|
60
78
|
"@semantic-release/commit-analyzer",
|
|
@@ -62,13 +80,16 @@
|
|
|
62
80
|
"@semantic-release/npm"
|
|
63
81
|
]
|
|
64
82
|
},
|
|
83
|
+
"files": [
|
|
84
|
+
"dist/"
|
|
85
|
+
],
|
|
86
|
+
"sideEffects": [
|
|
87
|
+
"**/*.css"
|
|
88
|
+
],
|
|
65
89
|
"exports": {
|
|
66
90
|
".": {
|
|
67
|
-
"
|
|
91
|
+
"types": "./dist/index.d.ts",
|
|
92
|
+
"svelte": "./dist/index.js"
|
|
68
93
|
}
|
|
69
|
-
},
|
|
70
|
-
"version": "1.13.0",
|
|
71
|
-
"overrides": {
|
|
72
|
-
"storybook": "$storybook"
|
|
73
94
|
}
|
|
74
95
|
}
|
package/.storybook/main.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { dirname, join } from 'path';
|
|
2
|
-
import type { StorybookConfig } from '@storybook/sveltekit';
|
|
3
|
-
|
|
4
|
-
function getAbsolutePath(value: string): any {
|
|
5
|
-
if (process.platform.includes('win')) {
|
|
6
|
-
return value;
|
|
7
|
-
} else {
|
|
8
|
-
return dirname(require.resolve(join(value, 'package.json')));
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const config: StorybookConfig = {
|
|
13
|
-
stories: ['../src/**/*.stories.@(js|ts|svelte)', '../src/**/*.mdx'],
|
|
14
|
-
addons: [
|
|
15
|
-
{
|
|
16
|
-
name: getAbsolutePath('@storybook/addon-svelte-csf'),
|
|
17
|
-
options: {
|
|
18
|
-
legacyTemplate: true
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
getAbsolutePath('@storybook/addon-links'),
|
|
22
|
-
getAbsolutePath('@chromatic-com/storybook'),
|
|
23
|
-
getAbsolutePath('@storybook/addon-vitest'),
|
|
24
|
-
getAbsolutePath('@storybook/addon-docs')
|
|
25
|
-
],
|
|
26
|
-
framework: {
|
|
27
|
-
name: getAbsolutePath('@storybook/sveltekit'),
|
|
28
|
-
options: {}
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
docs: {}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default config;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<style>
|
|
2
|
-
/* Load original SWR.de fonts for consistent component preview: */
|
|
3
|
-
@font-face {
|
|
4
|
-
font-family: 'SWR-VAR-Text';
|
|
5
|
-
src: url('https://www.swr.de/assets/fonts/swr_type/SWR_VAR_WEB/SWR-VAR-Text.woff2')
|
|
6
|
-
format('woff2');
|
|
7
|
-
}
|
|
8
|
-
@font-face {
|
|
9
|
-
font-family: 'SWR-VAR-Sans';
|
|
10
|
-
src: url('https://www.swr.de/assets/fonts/swr_type/SWR_VAR_WEB/SWR-VAR-Sans.woff2')
|
|
11
|
-
format('woff2');
|
|
12
|
-
}
|
|
13
|
-
</style>
|
package/.storybook/preview.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { Preview } from '@storybook/sveltekit';
|
|
2
|
-
|
|
3
|
-
const preview: Preview = {
|
|
4
|
-
parameters: {
|
|
5
|
-
options: {
|
|
6
|
-
storySort: {
|
|
7
|
-
order: [
|
|
8
|
-
'About',
|
|
9
|
-
'Design Tokens',
|
|
10
|
-
'Typography',
|
|
11
|
-
['Headline', 'Copy', 'Caption'],
|
|
12
|
-
'Display',
|
|
13
|
-
'Chart',
|
|
14
|
-
['ChartHeader'],
|
|
15
|
-
'Maplibre',
|
|
16
|
-
[
|
|
17
|
-
'Map',
|
|
18
|
-
'MapStyle',
|
|
19
|
-
'Source',
|
|
20
|
-
'Layer',
|
|
21
|
-
'Control',
|
|
22
|
-
[
|
|
23
|
-
'ScaleControl',
|
|
24
|
-
'GeocoderControl',
|
|
25
|
-
'AttributionControl',
|
|
26
|
-
'NavigationControl',
|
|
27
|
-
'MapControl'
|
|
28
|
-
],
|
|
29
|
-
'Style',
|
|
30
|
-
'Tooltip'
|
|
31
|
-
],
|
|
32
|
-
'Form',
|
|
33
|
-
'Deprecated'
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
controls: {
|
|
38
|
-
matchers: {
|
|
39
|
-
color: /(background|color)$/i,
|
|
40
|
-
date: /Date$/i
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
tags: ['autodocs']
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default preview;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { beforeAll } from 'vitest';
|
|
2
|
-
import { setProjectAnnotations } from '@storybook/sveltekit';
|
|
3
|
-
import * as projectAnnotations from './preview';
|
|
4
|
-
|
|
5
|
-
// This is an important step to apply the right configuration when testing your stories.
|
|
6
|
-
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
|
|
7
|
-
const project = setProjectAnnotations([projectAnnotations]);
|
|
8
|
-
|
|
9
|
-
beforeAll(project.beforeAll);
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import { userEvent, within, expect } from 'storybook/test';
|
|
4
|
-
import DesignTokens from '../DesignTokens/DesignTokens.svelte';
|
|
5
|
-
|
|
6
|
-
import Autocomplete from './Autocomplete.svelte';
|
|
7
|
-
|
|
8
|
-
const { Story } = defineMeta({
|
|
9
|
-
title: 'Deprecated/Autocomplete',
|
|
10
|
-
component: Autocomplete
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const testData = ['Apples', 'Oranges', 'Pears', 'Peaches', 'Bananas'].map((el) => {
|
|
14
|
-
return {
|
|
15
|
-
value: el,
|
|
16
|
-
label: el,
|
|
17
|
-
details: {}
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<Story
|
|
23
|
-
name="Basic"
|
|
24
|
-
asChild
|
|
25
|
-
play={async ({ canvasElement, step }) => {
|
|
26
|
-
const canvas = within(canvasElement);
|
|
27
|
-
const input = canvas.getByTestId('autocomplete-input');
|
|
28
|
-
await step('Select using the mouse', async () => {
|
|
29
|
-
await userEvent.click(input);
|
|
30
|
-
expect(input).toHaveFocus();
|
|
31
|
-
await userEvent.keyboard('ba');
|
|
32
|
-
const bananasOption = canvas.getByText('Bananas');
|
|
33
|
-
await userEvent.click(bananasOption);
|
|
34
|
-
expect(input).toHaveValue('Bananas');
|
|
35
|
-
});
|
|
36
|
-
await userEvent.clear(input);
|
|
37
|
-
await step('Select using the keyboard', async () => {
|
|
38
|
-
await userEvent.click(input);
|
|
39
|
-
expect(input).toHaveFocus();
|
|
40
|
-
await userEvent.keyboard('ap');
|
|
41
|
-
await userEvent.keyboard('{ArrowDown}');
|
|
42
|
-
await userEvent.keyboard('{Enter}');
|
|
43
|
-
expect(input).toHaveValue('Apples');
|
|
44
|
-
});
|
|
45
|
-
await userEvent.clear(input);
|
|
46
|
-
}}
|
|
47
|
-
>
|
|
48
|
-
<DesignTokens>
|
|
49
|
-
<div class="container">
|
|
50
|
-
<Autocomplete label="" name="test" data={testData} query="" placeholder="Select a fruit"
|
|
51
|
-
></Autocomplete>
|
|
52
|
-
</div>
|
|
53
|
-
</DesignTokens>
|
|
54
|
-
</Story>
|
|
55
|
-
|
|
56
|
-
<style>
|
|
57
|
-
.container {
|
|
58
|
-
background: var(--violet-dark-5);
|
|
59
|
-
padding: 5%;
|
|
60
|
-
}
|
|
61
|
-
</style>
|