@swr-data-lab/components 1.11.2 → 1.12.0
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/.storybook/blocks/Mermaid.jsx +9 -0
- package/.storybook/main.ts +23 -17
- package/.storybook/preview.ts +42 -13
- package/package.json +72 -68
- package/src/DesignTokens/Tokens.ts +15 -12
- package/src/Select/Select.stories.svelte +3 -3
- package/src/Switcher/Switcher.svelte +1 -0
- package/src/index.js +12 -0
- package/src/maplibre/AttributionControl/AttributionControl.stories.svelte +29 -0
- package/src/maplibre/AttributionControl/AttributionControl.svelte +45 -0
- package/src/maplibre/AttributionControl/index.js +2 -0
- package/src/maplibre/GeocoderControl/GeocoderAPIs.ts +49 -0
- package/src/maplibre/GeocoderControl/GeocoderControl.stories.svelte +78 -0
- package/src/maplibre/GeocoderControl/GeocoderControl.svelte +207 -0
- package/src/maplibre/GeocoderControl/index.js +2 -0
- package/src/maplibre/Map/FallbackStyle.ts +18 -0
- package/src/maplibre/Map/Map.stories.svelte +118 -0
- package/src/maplibre/Map/Map.svelte +283 -0
- package/src/maplibre/Map/index.js +2 -0
- package/src/maplibre/MapControl/MapControl.mdx +12 -0
- package/src/maplibre/MapControl/MapControl.stories.svelte +56 -0
- package/src/maplibre/MapControl/MapControl.svelte +41 -0
- package/src/maplibre/MapControl/index.js +2 -0
- package/src/maplibre/MapStyle/SWRDataLabLight.mdx +86 -0
- package/src/maplibre/MapStyle/SWRDataLabLight.stories.svelte +41 -0
- package/src/maplibre/MapStyle/SWRDataLabLight.ts +72 -0
- package/src/maplibre/MapStyle/components/Admin.ts +173 -0
- package/src/maplibre/MapStyle/components/Buildings.ts +23 -0
- package/src/maplibre/MapStyle/components/Landuse.ts +499 -0
- package/src/maplibre/MapStyle/components/Natural.ts +1 -0
- package/src/maplibre/MapStyle/components/PlaceLabels.ts +199 -0
- package/src/maplibre/MapStyle/components/Roads.ts +2345 -0
- package/src/maplibre/MapStyle/components/Transit.ts +507 -0
- package/src/maplibre/MapStyle/components/Walking.ts +1538 -0
- package/src/maplibre/MapStyle/index.js +2 -0
- package/src/maplibre/MapStyle/tokens.ts +21 -0
- package/src/maplibre/Maplibre.mdx +91 -0
- package/src/maplibre/NavigationControl/NavigationControl.stories.svelte +39 -0
- package/src/maplibre/NavigationControl/NavigationControl.svelte +36 -0
- package/src/maplibre/NavigationControl/index.js +2 -0
- package/src/maplibre/ScaleControl/ScaleControl.stories.svelte +71 -0
- package/src/maplibre/ScaleControl/ScaleControl.svelte +25 -0
- package/src/maplibre/ScaleControl/index.js +2 -0
- package/src/maplibre/Source/MapSource.stories.svelte +9 -0
- package/src/maplibre/Source/MapSource.svelte +61 -0
- package/src/maplibre/Source/index.js +2 -0
- package/src/maplibre/Source/source.ts +89 -0
- package/src/maplibre/Tooltip/Tooltip.stories.svelte +192 -0
- package/src/maplibre/Tooltip/Tooltip.svelte +175 -0
- package/src/maplibre/Tooltip/index.js +2 -0
- package/src/maplibre/VectorLayer/VectorLayer.stories.svelte +65 -0
- package/src/maplibre/VectorLayer/VectorLayer.svelte +142 -0
- package/src/maplibre/VectorLayer/index.js +2 -0
- package/src/maplibre/VectorTileSource/VectorTileSource.mdx +19 -0
- package/src/maplibre/VectorTileSource/VectorTileSource.stories.svelte +46 -0
- package/src/maplibre/VectorTileSource/VectorTileSource.svelte +24 -0
- package/src/maplibre/VectorTileSource/index.js +2 -0
- package/src/maplibre/WithLinkLocation/WithLinkLocation.mdx +11 -0
- package/src/maplibre/WithLinkLocation/WithLinkLocation.stories.svelte +29 -0
- package/src/maplibre/WithLinkLocation/WithLinkLocation.svelte +83 -0
- package/src/maplibre/WithLinkLocation/index.js +2 -0
- package/src/maplibre/context.svelte.ts +89 -0
- package/src/maplibre/types.ts +12 -0
- package/src/maplibre/utils.ts +52 -0
- package/tsconfig.json +1 -0
- package/src/events/clickOutside.js +0 -23
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FillLayerSpecification, LineLayerSpecification } from 'maplibre-gl';
|
|
2
|
+
|
|
3
|
+
export type Layer = LineLayerSpecification | FillLayerSpecification;
|
|
4
|
+
export type GeocodingService = 'maptiler';
|
|
5
|
+
export type GeocodingCountry = 'de' | 'at';
|
|
6
|
+
export type GeocodingLanguage = 'de' | 'en';
|
|
7
|
+
|
|
8
|
+
export interface Location {
|
|
9
|
+
lat: number;
|
|
10
|
+
lng: number;
|
|
11
|
+
zoom: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Source: https://github.com/MIERUNE/svelte-maplibre-gl/blob/main/src/lib/maplibre/utils.ts
|
|
2
|
+
|
|
3
|
+
import type { Evented, Listener, Map, MapLayerEventType, Popup } from 'maplibre-gl';
|
|
4
|
+
|
|
5
|
+
export function resetEventListener(
|
|
6
|
+
evented: Evented | null | undefined,
|
|
7
|
+
type: string,
|
|
8
|
+
listener: Listener | undefined
|
|
9
|
+
) {
|
|
10
|
+
if (listener) {
|
|
11
|
+
evented?.on(type, listener);
|
|
12
|
+
}
|
|
13
|
+
const prevListener = listener;
|
|
14
|
+
return () => {
|
|
15
|
+
if (prevListener) {
|
|
16
|
+
evented?.off(type, prevListener);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function resetLayerEventListener(
|
|
22
|
+
map: Map | null,
|
|
23
|
+
type: keyof MapLayerEventType,
|
|
24
|
+
layer: string,
|
|
25
|
+
listener: Listener | undefined
|
|
26
|
+
) {
|
|
27
|
+
if (listener) {
|
|
28
|
+
map?.on(type, layer, listener);
|
|
29
|
+
}
|
|
30
|
+
const prevListener = listener;
|
|
31
|
+
return () => {
|
|
32
|
+
if (prevListener) {
|
|
33
|
+
map?.off(type, layer, prevListener);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function resetPopupEventListener(
|
|
39
|
+
popup: Popup | null,
|
|
40
|
+
type: 'open' | 'close',
|
|
41
|
+
listener: Listener | undefined
|
|
42
|
+
) {
|
|
43
|
+
if (listener) {
|
|
44
|
+
popup?.on(type, listener);
|
|
45
|
+
}
|
|
46
|
+
const prevListener = listener;
|
|
47
|
+
return () => {
|
|
48
|
+
if (prevListener) {
|
|
49
|
+
popup?.off(type, prevListener);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dispatch a click event outside of the given element.
|
|
3
|
-
* @param {Node} node
|
|
4
|
-
*/
|
|
5
|
-
export function clickOutside(node) {
|
|
6
|
-
const handleClick = (event) => {
|
|
7
|
-
if (node && !node.contains(event.target) && !event.defaultPrevented) {
|
|
8
|
-
node.dispatchEvent(
|
|
9
|
-
new CustomEvent('clickOutside', {
|
|
10
|
-
detail: { node, event }
|
|
11
|
-
})
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
document.addEventListener('click', handleClick, true);
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
destroy() {
|
|
20
|
-
document.removeEventListener('click', handleClick, true);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|