@radiofrance/svelte-leaflet 0.1.0-alpha.9 → 1.0.0-next.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.
Files changed (46) hide show
  1. package/README.md +12 -7
  2. package/dist/DivIcon.svelte +64 -0
  3. package/dist/DivIcon.svelte.d.ts +27 -0
  4. package/dist/Icon.svelte +56 -0
  5. package/dist/Icon.svelte.d.ts +31 -0
  6. package/dist/LocateControl.svelte +57 -0
  7. package/dist/LocateControl.svelte.d.ts +9 -0
  8. package/dist/Map.svelte +128 -77
  9. package/dist/Map.svelte.d.ts +15 -64
  10. package/dist/Marker.svelte +68 -70
  11. package/dist/Marker.svelte.d.ts +11 -34
  12. package/dist/MarkerClusterGroup.svelte +73 -42
  13. package/dist/MarkerClusterGroup.svelte.d.ts +69 -21
  14. package/dist/Polygon.svelte +43 -0
  15. package/dist/Polygon.svelte.d.ts +9 -0
  16. package/dist/Polyline.svelte +42 -25
  17. package/dist/Polyline.svelte.d.ts +9 -22
  18. package/dist/Popup.svelte +69 -44
  19. package/dist/Popup.svelte.d.ts +10 -19
  20. package/dist/contexts.d.ts +4 -0
  21. package/dist/contexts.js +4 -0
  22. package/dist/events.d.ts +11 -0
  23. package/dist/events.js +31 -0
  24. package/dist/index.d.ts +22 -53
  25. package/dist/index.js +14 -53
  26. package/dist/map.svelte.d.ts +10 -0
  27. package/dist/map.svelte.js +117 -0
  28. package/dist/marker.svelte.d.ts +5 -0
  29. package/dist/marker.svelte.js +61 -0
  30. package/dist/markerClusterGroup.svelte.d.ts +9 -0
  31. package/dist/markerClusterGroup.svelte.js +7 -0
  32. package/dist/polygon.svelte.d.ts +1 -0
  33. package/dist/polygon.svelte.js +1 -0
  34. package/dist/polyline.svelte.d.ts +6 -0
  35. package/dist/polyline.svelte.js +56 -0
  36. package/dist/popup.svelte.d.ts +10 -0
  37. package/dist/popup.svelte.js +50 -0
  38. package/dist/private/GeolocationButton.svelte +36 -0
  39. package/dist/private/GeolocationButton.svelte.d.ts +18 -0
  40. package/dist/private/GeolocationIcon.svelte +25 -0
  41. package/dist/private/GeolocationIcon.svelte.d.ts +4 -0
  42. package/dist/utils.d.ts +15 -0
  43. package/dist/utils.js +10 -0
  44. package/package.json +43 -59
  45. package/dist/Circle.svelte +0 -41
  46. package/dist/Circle.svelte.d.ts +0 -36
package/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  A library that wraps leaflet classes in domless/renderless svelte components.
4
4
 
5
+ ## Compatibility
6
+
7
+ Version 1.0.0 and above are compatible with Svelte 5.
8
+
9
+ For svelte 3 and 4, use version 0.1.x (not actively maintained).
10
+
5
11
  ## Install
6
12
 
7
13
  `npm i -D @radiofrance/svelte-leaflet`
@@ -29,7 +35,7 @@ All events are forwarded from the Map class, see the leaflet documentation for m
29
35
  Example:
30
36
 
31
37
  ```svelte
32
- <Map {options} on:click={(e) => console.log(e.detail.latlng)} />
38
+ <Map {options} onclick={(e) => console.log(e.detail.latlng)} />
33
39
  ```
34
40
 
35
41
  ### Marker
@@ -38,15 +44,14 @@ Add a marker to the map.
38
44
 
39
45
  - Can be used as a child of `<Map>` or `<MarkerClusterGroup>`
40
46
  - A `<Popup>` component can be passed as the Marker child to display a popup when the marker is clicked.
41
- - A component with `slot="icon"` attribute can be passed as the Marker child to display a custom icon.
47
+ - To use a custom icon, pass a `Icon` or a `DivIcon` component as the marker child.
42
48
 
43
49
  #### Attributes
44
50
 
45
- | Name | Type | Default | Notes |
46
- | -------- | ----------------------------------------------------- | ---------- | --------------------------------------------- |
47
- | `latlng` | [LatLng](https://leafletjs.com/reference.html#latlng) | _required_ | position of the marker |
48
- | `size` | number | `25` | icon size (only used with a custom icon) |
49
- | `id` | string | `''` | an identifier to link the maker with you data |
51
+ | Name | Type | Default | Notes |
52
+ | --------- | ------------------------------------------------------------------- | ---------- | ------------------------------------- |
53
+ | `latlng` | [LatLng](https://leafletjs.com/reference.html#latlng) | _required_ | position of the marker |
54
+ | `options` | [MarkerOptions](https://leafletjs.com/reference.html#marker-option) | `{}` | options to pass to the leaflet marker |
50
55
 
51
56
  #### Events
52
57
 
@@ -0,0 +1,64 @@
1
+ <script lang="ts">
2
+ import type { Marker as LeafletMarker, DivIcon as LeafletDivIcon, DivIconOptions } from 'leaflet';
3
+
4
+ import { getContext, onDestroy, onMount, type Snippet } from 'svelte';
5
+ import { MARKER } from './contexts.js';
6
+
7
+ type Props = { children: Snippet; instance?: LeafletDivIcon; options?: DivIconOptions };
8
+
9
+ let { children, instance = $bindable(), options = {} }: Props = $props();
10
+ let iconContainer: HTMLDivElement | undefined = $state();
11
+
12
+ const getMarker = getContext<() => LeafletMarker>(MARKER);
13
+
14
+ onMount(() => {
15
+ const marker = getMarker?.();
16
+ if (marker) {
17
+ instance = window.L.divIcon({
18
+ html: iconContainer,
19
+ className: '',
20
+ ...options,
21
+ });
22
+ marker.setIcon(instance);
23
+ }
24
+ });
25
+
26
+ onDestroy(() => {
27
+ if (instance) {
28
+ instance.remove?.();
29
+ }
30
+ });
31
+ </script>
32
+
33
+ <div class="container">
34
+ <div class="DivIcon" bind:this={iconContainer}>
35
+ {@render children()}
36
+ </div>
37
+ </div>
38
+
39
+ <!--
40
+ @component
41
+ Renders a custom HTML icon for a marker.
42
+
43
+ ## Usage
44
+ **It should only be used as a child of a `Marker` component.**
45
+
46
+ ```svelte
47
+ ...
48
+ <DivIcon {options}>
49
+ <div class="my-custom-icon">🤓</div>
50
+ </DivIcon>
51
+ ...
52
+ ```
53
+
54
+ ## Reactivity
55
+ **None of the options are reactive.**
56
+
57
+ If you need to update the icon, you should create a new `DivIcon` component with the new options.
58
+ -->
59
+
60
+ <style>
61
+ .container {
62
+ display: none;
63
+ }
64
+ </style>
@@ -0,0 +1,27 @@
1
+ import type { DivIcon as LeafletDivIcon, DivIconOptions } from 'leaflet';
2
+ import { type Snippet } from 'svelte';
3
+ /**
4
+ * Renders a custom HTML icon for a marker.
5
+ *
6
+ * ## Usage
7
+ * **It should only be used as a child of a `Marker` component.**
8
+ *
9
+ * ```svelte
10
+ * ...
11
+ * <DivIcon {options}>
12
+ * <div class="my-custom-icon">🤓</div>
13
+ * </DivIcon>
14
+ * ...
15
+ * ```
16
+ *
17
+ * ## Reactivity
18
+ * **None of the options are reactive.**
19
+ *
20
+ * If you need to update the icon, you should create a new `DivIcon` component with the new options.
21
+ */
22
+ declare const DivIcon: import("svelte").Component<{
23
+ children: Snippet;
24
+ instance?: LeafletDivIcon;
25
+ options?: DivIconOptions;
26
+ }, {}, "instance">;
27
+ export default DivIcon;
@@ -0,0 +1,56 @@
1
+ <script lang="ts">
2
+ import type { Marker as LeafletMarker, Icon as LeafletIcon, IconOptions } from 'leaflet';
3
+
4
+ import { getContext, onDestroy, onMount } from 'svelte';
5
+ import { MARKER } from './contexts.js';
6
+
7
+ type Props = { instance?: LeafletIcon; options: IconOptions };
8
+
9
+ let { instance = $bindable(), options }: Props = $props();
10
+
11
+ const getMarker = getContext<() => LeafletMarker>(MARKER);
12
+
13
+ onMount(() => {
14
+ const marker = getMarker?.();
15
+ if (marker) {
16
+ instance = window.L.icon(options);
17
+ marker.setIcon(instance);
18
+ }
19
+ });
20
+
21
+ onDestroy(() => {
22
+ if (instance) {
23
+ instance.remove?.();
24
+ }
25
+ });
26
+ </script>
27
+
28
+ <!--
29
+ @component
30
+ Renders a custom image icon for a marker.
31
+
32
+ ## Usage
33
+ **It should only be used as a child of a `Marker` component.**
34
+
35
+ `options.iconUrl` is required. The easiest way to use it is with data URL : import the image and pass it as the value.
36
+
37
+ Absolute and relative URLs are also supported.
38
+
39
+ ```svelte
40
+ <script>
41
+ import myPngIcon from './icon.png';
42
+ </script>
43
+
44
+ ...
45
+ <Icon options={{iconUrl: myPngIcon}}/>
46
+ ...
47
+ ```
48
+
49
+ ## Reactivity
50
+ **None of the options are reactive.**
51
+
52
+ If you need to update the icon, you should create a new `DivIcon` component with the new options.
53
+
54
+
55
+
56
+ -->
@@ -0,0 +1,31 @@
1
+ import type { Icon as LeafletIcon, IconOptions } from 'leaflet';
2
+ /**
3
+ * Renders a custom image icon for a marker.
4
+ *
5
+ * ## Usage
6
+ * **It should only be used as a child of a `Marker` component.**
7
+ *
8
+ * `options.iconUrl` is required. The easiest way to use it is with data URL : import the image and pass it as the value.
9
+ *
10
+ * Absolute and relative URLs are also supported.
11
+ *
12
+ * ```svelte
13
+ * <script>
14
+ * import myPngIcon from './icon.png';
15
+ * </script>
16
+ *
17
+ * ...
18
+ * <Icon options={{iconUrl: myPngIcon}}/>
19
+ * ...
20
+ * ```
21
+ *
22
+ * ## Reactivity
23
+ * **None of the options are reactive.**
24
+ *
25
+ * If you need to update the icon, you should create a new `DivIcon` component with the new options.
26
+ */
27
+ declare const Icon: import("svelte").Component<{
28
+ instance?: LeafletIcon;
29
+ options: IconOptions;
30
+ }, {}, "instance">;
31
+ export default Icon;
@@ -0,0 +1,57 @@
1
+ <script lang="ts">
2
+ import { getContext, onMount, type Snippet } from 'svelte';
3
+ import type { ControlPosition, Map as LeafletMap, LocateOptions } from 'leaflet';
4
+ import { MAP } from './contexts.js';
5
+ import GeolocationButton from './private/GeolocationButton.svelte';
6
+ import { getFirstNonCommentChild } from './utils.js';
7
+
8
+ type Props = {
9
+ instance?: L.Control;
10
+ children?: Snippet;
11
+ position?: ControlPosition;
12
+ options?: LocateOptions;
13
+ };
14
+
15
+ let { instance = $bindable(), children, position = 'topleft', options }: Props = $props();
16
+ let locateButtonContainer: HTMLDivElement;
17
+
18
+ const getMap = getContext<() => LeafletMap>(MAP);
19
+
20
+ onMount(() => {
21
+ const map = getMap();
22
+ const control = window.L.Control.extend({
23
+ position,
24
+ onAdd: createLocateOnAdd(map, locateButtonContainer, options),
25
+ });
26
+ instance = new control({ position });
27
+ map.addControl(instance);
28
+ });
29
+
30
+ function createLocateOnAdd(
31
+ mapInstance: LeafletMap,
32
+ locateButtonContainer: HTMLElement,
33
+ locateControlOptions: L.LocateOptions = {},
34
+ ) {
35
+ return () => {
36
+ const locateButtonElement = getFirstNonCommentChild(locateButtonContainer);
37
+ if (!locateButtonElement) return;
38
+ // prevent zoom on locate button double click
39
+ locateButtonElement.addEventListener('dblclick', (e: MouseEvent) => {
40
+ e.preventDefault();
41
+ e.stopPropagation();
42
+ });
43
+ locateButtonElement.addEventListener('click', () => {
44
+ mapInstance?.locate(locateControlOptions);
45
+ });
46
+ return locateButtonElement;
47
+ };
48
+ }
49
+ </script>
50
+
51
+ <div bind:this={locateButtonContainer}>
52
+ {#if children}
53
+ {@render children()}
54
+ {:else}
55
+ <GeolocationButton />
56
+ {/if}
57
+ </div>
@@ -0,0 +1,9 @@
1
+ import { type Snippet } from 'svelte';
2
+ import type { ControlPosition, LocateOptions } from 'leaflet';
3
+ declare const LocateControl: import("svelte").Component<{
4
+ instance?: L.Control;
5
+ children?: Snippet;
6
+ position?: ControlPosition;
7
+ options?: LocateOptions;
8
+ }, {}, "instance">;
9
+ export default LocateControl;
package/dist/Map.svelte CHANGED
@@ -1,84 +1,135 @@
1
- <script>import "leaflet/dist/leaflet.css";
2
- import "leaflet.markercluster/dist/MarkerCluster.css";
3
- import "leaflet.markercluster/dist/MarkerCluster.Default.css";
4
- import markerIcon2x from "leaflet/dist/images/marker-icon-2x.png";
5
- import markerIcon from "leaflet/dist/images/marker-icon.png";
6
- import markerShadow from "leaflet/dist/images/marker-shadow.png";
7
- import { createEventDispatcher, setContext } from "svelte";
8
- import {
9
- bindEvents,
10
- keyboardEvents,
11
- layerGroupEvents,
12
- layersControlEvents,
13
- leafletMouseEvents,
14
- locationEvents,
15
- mapStateChangeEvents,
16
- popupEvents,
17
- tooltipEvents
18
- } from "./index.js";
19
- let L;
20
- export let options = {};
21
- export let tilesUrl = "https://tile.openstreetmap.org/{z}/{x}/{y}.png";
22
- export let attribution = `&copy;<a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>`;
23
- export let instance = null;
24
- const dispatch = createEventDispatcher();
25
- export const getMarkers = () => {
26
- const markers = [];
27
- instance?.eachLayer((layer) => {
28
- if (layer instanceof L.Marker) {
29
- markers.push(layer);
30
- }
31
- });
32
- return markers;
33
- };
34
- setContext("map", () => instance);
35
- let container;
36
- $:
37
- if (instance)
38
- instance.options = Object.assign(instance.options, options);
39
- function resizeMap() {
40
- instance?.invalidateSize();
41
- }
42
- const events = [
43
- ...keyboardEvents,
44
- ...layerGroupEvents,
45
- ...layersControlEvents,
46
- ...leafletMouseEvents,
47
- ...locationEvents,
48
- ...mapStateChangeEvents,
49
- ...popupEvents,
50
- ...tooltipEvents,
51
- "autopanstart",
52
- "zoomanim"
53
- ];
54
- function onLoad() {
55
- L = window.L;
56
- delete L.Icon.Default.prototype._getIconUrl;
57
- L.Icon.Default.mergeOptions({
58
- iconRetinaUrl: markerIcon2x,
59
- iconUrl: markerIcon,
60
- shadowUrl: markerShadow
61
- });
62
- instance = L.map(container, { maxZoom: 18, ...options });
63
- bindEvents(instance, dispatch, events);
64
- L.tileLayer(tilesUrl, {
65
- attribution
66
- }).addTo(instance);
67
- instance.whenReady(() => {
68
- instance.fireEvent("load");
69
- });
70
- }
71
- function leafletLoader(_node) {
72
- import("leaflet").then(() => {
73
- import("leaflet.markercluster").then(onLoad);
74
- });
75
- }
1
+ <script lang="ts">
2
+ import 'leaflet/dist/leaflet.css';
3
+ import 'leaflet.markercluster/dist/MarkerCluster.css';
4
+ import 'leaflet.markercluster/dist/MarkerCluster.Default.css';
5
+ import markerIcon2x from 'leaflet/dist/images/marker-icon-2x.png';
6
+ import markerIcon from 'leaflet/dist/images/marker-icon.png';
7
+ import markerShadow from 'leaflet/dist/images/marker-shadow.png';
8
+
9
+ import type { MapOptions, Marker, Map as LeafletMap, LatLngTuple } from 'leaflet';
10
+ import { bindEvents } from './index.js';
11
+ import { setContext, type Snippet } from 'svelte';
12
+ import { mapEvents, updateMapProps, type MapEvents } from './map.svelte.js';
13
+ import { FOCUSABLE, MAP } from './contexts.js';
14
+
15
+ type Props = {
16
+ instance?: LeafletMap;
17
+ options?: MapOptions;
18
+ markers?: Marker[];
19
+ tilesUrl?: string;
20
+ attribution?: string;
21
+ focusable?: boolean;
22
+ children?: Snippet;
23
+ } & MapEvents;
24
+
25
+ let {
26
+ instance = $bindable(),
27
+ options = $bindable({}),
28
+ markers = $bindable([]),
29
+ tilesUrl = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
30
+ attribution = `&copy;<a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>`,
31
+ focusable = true,
32
+ children,
33
+ ...restProps
34
+ }: Props = $props();
35
+
36
+ const defaultOptions = {
37
+ center: [48.852, 2.278] as LatLngTuple,
38
+ trackResize: true,
39
+ zoom: 3,
40
+ maxZoom: 18,
41
+ keyboard: options.keyboard === undefined ? focusable : options.keyboard,
42
+ };
43
+ // consider exporting a reference to the markers instead of a getter
44
+ export const getMarkers: () => Marker[] = () => {
45
+ const markers: Marker[] = [];
46
+ instance?.eachLayer((layer) => {
47
+ if (layer instanceof window.L.Marker) {
48
+ markers.push(layer);
49
+ }
50
+ });
51
+ return markers;
52
+ };
53
+
54
+ setContext(MAP, () => instance);
55
+ setContext(FOCUSABLE, focusable ? null : -1);
56
+ let container: HTMLElement | null = $state(null);
57
+
58
+ $effect(() => {
59
+ if (instance) {
60
+ updateMapProps(instance, options);
61
+ }
62
+ });
63
+
64
+ function onLoad() {
65
+ if (!container) return;
66
+ // @ts-ignore
67
+ delete window.L.Icon.Default.prototype._getIconUrl;
68
+ window.L.Icon.Default.mergeOptions({
69
+ iconRetinaUrl: markerIcon2x,
70
+ iconUrl: markerIcon,
71
+ shadowUrl: markerShadow,
72
+ });
73
+ const mergedOptions = { ...defaultOptions, ...options };
74
+ // trackResize is set to false else the resize callback couldn't be unbined (no reference)
75
+ instance = window.L.map(container, { ...mergedOptions, trackResize: false });
76
+ if (mergedOptions.trackResize) {
77
+ // this triggers updateMapProps and binds the custom resize callback
78
+ options.trackResize = true;
79
+ }
80
+ bindEvents(instance, restProps, mapEvents);
81
+
82
+ // create component for the tile layer ?
83
+ window.L.tileLayer(tilesUrl, {
84
+ attribution,
85
+ }).addTo(instance);
86
+
87
+ instance.on('layeradd', (event) => {
88
+ const layer = event.layer;
89
+ if (layer instanceof window.L.Marker) {
90
+ markers.push(layer);
91
+ }
92
+ });
93
+
94
+ instance.on('layerremove', (event) => {
95
+ const layer = event.layer;
96
+ if (layer instanceof window.L.Marker) {
97
+ const index = markers.indexOf(layer);
98
+ if (index > -1) {
99
+ markers.splice(index, 1);
100
+ }
101
+ }
102
+ });
103
+
104
+ instance.whenReady(() => {
105
+ if (!instance) return;
106
+ // TODO: find out why manually firing the load event is needed
107
+ instance.fireEvent('load');
108
+ });
109
+ }
110
+
111
+ function leafletLoader(_node: HTMLElement) {
112
+ (async function () {
113
+ await import('leaflet');
114
+ // leaflet.markercluster is loaded by default. It's 34ko (12ko gzipped).
115
+ // A single tile is around 30ko gzipped.
116
+ // TODO: consider making it optional (handle loading in MarkerClusterGroup.svelte ?)
117
+ await import('leaflet.markercluster');
118
+ onLoad();
119
+ })();
120
+ }
76
121
  </script>
77
122
 
78
- <svelte:window on:resize={resizeMap} use:leafletLoader />
123
+ <svelte:window use:leafletLoader />
79
124
 
80
125
  <div class="Map" bind:this={container} style="height: 100%; width: 100%">
81
126
  {#if instance}
82
- <slot map={instance} />
127
+ {@render children?.()}
83
128
  {/if}
84
129
  </div>
130
+
131
+ <style>
132
+ .Map {
133
+ z-index: 0;
134
+ }
135
+ </style>
@@ -1,67 +1,18 @@
1
- import { SvelteComponent } from "svelte";
2
- import type { MapOptions, Marker, Map } from 'leaflet';
3
- import type Leaflet from 'leaflet';
4
1
  import 'leaflet/dist/leaflet.css';
5
2
  import 'leaflet.markercluster/dist/MarkerCluster.css';
6
3
  import 'leaflet.markercluster/dist/MarkerCluster.Default.css';
7
- declare const __propDef: {
8
- props: {
9
- options?: MapOptions | undefined;
10
- tilesUrl?: string | undefined;
11
- attribution?: string | undefined;
12
- instance?: Map | undefined;
13
- getMarkers?: (() => Marker[]) | undefined;
14
- };
15
- events: {
16
- keypress: CustomEvent<Leaflet.LeafletKeyboardEvent>;
17
- keydown: CustomEvent<Leaflet.LeafletKeyboardEvent>;
18
- keyup: CustomEvent<Leaflet.LeafletKeyboardEvent>;
19
- layeradd: CustomEvent<Leaflet.LayerEvent>;
20
- layerremove: CustomEvent<Leaflet.LayerEvent>;
21
- baselayerchange: CustomEvent<Leaflet.LayersControlEvent>;
22
- overlayadd: CustomEvent<Leaflet.LayersControlEvent>;
23
- overlayremove: CustomEvent<Leaflet.LayersControlEvent>;
24
- click: CustomEvent<Leaflet.LeafletMouseEvent>;
25
- dblclick: CustomEvent<Leaflet.LeafletMouseEvent>;
26
- mousedown: CustomEvent<Leaflet.LeafletMouseEvent>;
27
- mouseup: CustomEvent<Leaflet.LeafletMouseEvent>;
28
- mouseover: CustomEvent<Leaflet.LeafletMouseEvent>;
29
- mouseout: CustomEvent<Leaflet.LeafletMouseEvent>;
30
- contextmenu: CustomEvent<Leaflet.LeafletMouseEvent>;
31
- mousemove: CustomEvent<Leaflet.LeafletMouseEvent>;
32
- preclick: CustomEvent<Leaflet.LeafletMouseEvent>;
33
- locationfound: CustomEvent<Leaflet.LocationEvent>;
34
- locationerror: CustomEvent<Leaflet.ErrorEvent>;
35
- load: CustomEvent<Leaflet.LeafletEvent>;
36
- move: CustomEvent<Leaflet.LeafletEvent>;
37
- moveend: CustomEvent<Leaflet.LeafletEvent>;
38
- movestart: CustomEvent<Leaflet.LeafletEvent>;
39
- unload: CustomEvent<Leaflet.LeafletEvent>;
40
- viewreset: CustomEvent<Leaflet.LeafletEvent>;
41
- zoom: CustomEvent<Leaflet.LeafletEvent>;
42
- zoomend: CustomEvent<Leaflet.LeafletEvent>;
43
- zoomlevelschange: CustomEvent<Leaflet.LeafletEvent>;
44
- zoomstart: CustomEvent<Leaflet.LeafletEvent>;
45
- resize: CustomEvent<Leaflet.ResizeEvent>;
46
- popupopen: CustomEvent<Leaflet.PopupEvent>;
47
- popupclose: CustomEvent<Leaflet.PopupEvent>;
48
- tooltipopen: CustomEvent<Leaflet.TooltipEvent>;
49
- tooltipclose: CustomEvent<Leaflet.TooltipEvent>;
50
- autopanstart: CustomEvent<Leaflet.LeafletEvent>;
51
- zoomanim: CustomEvent<Leaflet.LeafletEvent>;
52
- } & {
53
- [evt: string]: CustomEvent<any>;
54
- };
55
- slots: {
56
- default: {
57
- map: Map;
58
- };
59
- };
60
- };
61
- export type MapProps = typeof __propDef.props;
62
- export type MapEvents = typeof __propDef.events;
63
- export type MapSlots = typeof __propDef.slots;
64
- export default class Map extends SvelteComponent<MapProps, MapEvents, MapSlots> {
65
- get getMarkers(): () => Marker<any>[];
66
- }
67
- export {};
4
+ import type { MapOptions, Marker, Map as LeafletMap } from 'leaflet';
5
+ import { type Snippet } from 'svelte';
6
+ import { type MapEvents } from './map.svelte.js';
7
+ declare const Map: import("svelte").Component<{
8
+ instance?: LeafletMap;
9
+ options?: MapOptions;
10
+ markers?: Marker[];
11
+ tilesUrl?: string;
12
+ attribution?: string;
13
+ focusable?: boolean;
14
+ children?: Snippet;
15
+ } & MapEvents, {
16
+ getMarkers: () => Marker[];
17
+ }, "instance" | "options" | "markers">;
18
+ export default Map;