@radiofrance/svelte-leaflet 1.0.0-next.1 → 1.0.0-next.3

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 (66) hide show
  1. package/README.md +55 -70
  2. package/dist/Circle.svelte +45 -0
  3. package/dist/Circle.svelte.d.ts +8 -0
  4. package/dist/CircleMarker.svelte +49 -0
  5. package/dist/CircleMarker.svelte.d.ts +8 -0
  6. package/dist/ImageOverlay.svelte +66 -0
  7. package/dist/ImageOverlay.svelte.d.ts +10 -0
  8. package/dist/LayersControl.svelte +23 -0
  9. package/dist/LayersControl.svelte.d.ts +6 -0
  10. package/dist/Map.svelte +39 -24
  11. package/dist/Map.svelte.d.ts +2 -4
  12. package/dist/Marker.svelte +1 -1
  13. package/dist/Marker.svelte.d.ts +1 -1
  14. package/dist/MarkerClusterGroup.svelte +1 -4
  15. package/dist/MarkerClusterGroup.svelte.d.ts +19 -19
  16. package/dist/Polygon.svelte +1 -1
  17. package/dist/Polygon.svelte.d.ts +1 -1
  18. package/dist/Polyline.svelte +1 -1
  19. package/dist/Polyline.svelte.d.ts +1 -1
  20. package/dist/Popup.svelte +1 -1
  21. package/dist/Popup.svelte.d.ts +1 -1
  22. package/dist/Rectangle.svelte +48 -0
  23. package/dist/Rectangle.svelte.d.ts +8 -0
  24. package/dist/SVGOverlay.svelte +52 -0
  25. package/dist/SVGOverlay.svelte.d.ts +8 -0
  26. package/dist/TileLayer.svelte +34 -0
  27. package/dist/TileLayer.svelte.d.ts +8 -0
  28. package/dist/TileLayerWMS.svelte +36 -0
  29. package/dist/TileLayerWMS.svelte.d.ts +8 -0
  30. package/dist/Tooltip.svelte +73 -0
  31. package/dist/Tooltip.svelte.d.ts +10 -0
  32. package/dist/VideoOverlay.svelte +66 -0
  33. package/dist/VideoOverlay.svelte.d.ts +10 -0
  34. package/dist/ZoomControl.svelte +21 -0
  35. package/dist/ZoomControl.svelte.d.ts +8 -0
  36. package/dist/circleMarker.d.ts +4 -0
  37. package/dist/circleMarker.js +8 -0
  38. package/dist/contexts.d.ts +8 -0
  39. package/dist/contexts.js +18 -0
  40. package/dist/events.d.ts +1 -1
  41. package/dist/events.js +1 -1
  42. package/dist/imageOverlay.d.ts +5 -0
  43. package/dist/imageOverlay.js +25 -0
  44. package/dist/{map.svelte.js → map.js} +2 -2
  45. package/dist/{marker.svelte.js → marker.js} +2 -2
  46. package/dist/{markerClusterGroup.svelte.d.ts → markerClusterGroup.d.ts} +2 -2
  47. package/dist/{markerClusterGroup.svelte.js → markerClusterGroup.js} +1 -1
  48. package/dist/{polyline.svelte.js → polyline.js} +2 -2
  49. package/dist/{popup.svelte.js → popup.js} +2 -2
  50. package/dist/tileLayer.d.ts +5 -0
  51. package/dist/tileLayer.js +1 -0
  52. package/dist/tileLayerWMS.d.ts +7 -0
  53. package/dist/tileLayerWMS.js +1 -0
  54. package/dist/tooltip.d.ts +10 -0
  55. package/dist/tooltip.js +34 -0
  56. package/dist/utils.d.ts +1 -0
  57. package/dist/utils.js +7 -0
  58. package/dist/videoOverlay.d.ts +5 -0
  59. package/dist/videoOverlay.js +25 -0
  60. package/package.json +1 -1
  61. /package/dist/{map.svelte.d.ts → map.d.ts} +0 -0
  62. /package/dist/{marker.svelte.d.ts → marker.d.ts} +0 -0
  63. /package/dist/{polygon.svelte.d.ts → polygon.d.ts} +0 -0
  64. /package/dist/{polygon.svelte.js → polygon.js} +0 -0
  65. /package/dist/{polyline.svelte.d.ts → polyline.d.ts} +0 -0
  66. /package/dist/{popup.svelte.d.ts → popup.d.ts} +0 -0
package/README.md CHANGED
@@ -1,12 +1,22 @@
1
1
  # @radiofrance/svelte-leaflet
2
2
 
3
- A library that wraps leaflet classes in domless/renderless svelte components.
3
+ Simple Leaflet maps for your Svelte projects.
4
4
 
5
- ## Compatibility
5
+ ## Features
6
+
7
+ - Works in SSR pages
8
+ - TypeScript : events, props and options are fully typed
9
+ - Simple event usage with the `oneventname` syntax
10
+ - ![](./static/map-types.png)
11
+ - `event.sourceTarget` is correctly typed
12
+ - Fully reactive : update props and options, the components will update
13
+ - Customize `DivIcon`, `Popup` and more with Svelte components or HTML instead of strings
14
+ - Single dependency : no `leaflet` or `@types/leaflet` needed
6
15
 
7
- Version 1.0.0 and above are compatible with Svelte 5.
16
+ ## Compatibility
8
17
 
9
- For svelte 3 and 4, use version 0.1.x (not actively maintained).
18
+ - Version 1.0.0 and above are compatible with Svelte 5.
19
+ - For Svelte 3 and 4, use version 0.1.x (not actively maintained).
10
20
 
11
21
  ## Install
12
22
 
@@ -14,82 +24,57 @@ For svelte 3 and 4, use version 0.1.x (not actively maintained).
14
24
 
15
25
  ## Components
16
26
 
17
- ### Map
18
-
19
- Renders a map Leaflet Map. The Map will take up 100% of its container's height and width.
20
-
21
- #### Attributes
22
-
23
- | Attribute | Type | Default | Notes |
24
- | ------------- | ------------------------------------------------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------- |
25
- | `options` | [MapOptions](https://leafletjs.com/reference.html#map-option) | `{}` | Map options |
26
- | `tilesUrl` | string | `'https://tile.openstreetmap.org/{z}/{x}/{y}.png'` | more free tile services can be found at https://alexurquhart.github.io/free-tiles/ |
27
- | `attribution` | string | `'©OpenStreetMap'` _(link to openstreetmap)_ | |
28
-
29
- #### Events
30
-
31
- All events are forwarded from the Map class, see the leaflet documentation for more information.
32
-
33
- - https://leafletjs.com/reference.html#map-event
34
-
35
- Example:
36
-
37
- ```svelte
38
- <Map {options} onclick={(e) => console.log(e.detail.latlng)} />
39
- ```
40
-
41
- ### Marker
42
-
43
- Add a marker to the map.
44
-
45
- - Can be used as a child of `<Map>` or `<MarkerClusterGroup>`
46
- - A `<Popup>` component can be passed as the Marker child to display a popup when the marker is clicked.
47
- - To use a custom icon, pass a `Icon` or a `DivIcon` component as the marker child.
48
-
49
- #### Attributes
50
-
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 |
55
-
56
- #### Events
57
-
58
- All events are forwarded from the Marker class, see the leaflet documentation for more information.
59
-
60
- - https://leafletjs.com/reference.html#marker-event
61
-
62
- ### Popup
27
+ ### UI Layers
63
28
 
64
- `<Popup>` children will be displayed when the marker is clicked.
29
+ - Marker
30
+ - DivOverlay _(abstract class)_
31
+ - ✅ Popup
32
+ - ✅ Tooltip
65
33
 
66
- - Use as a `<Marker>` child.
34
+ ### Raster Layers
67
35
 
68
- #### Attributes
36
+ - ✅ TileLayer
37
+ - ✅ TileLayer.WMS
38
+ - ✅ ImageOverlay
39
+ - ✅ VideoOverlay
69
40
 
70
- | Name | Type | Default | Notes |
71
- | --------- | ----------------------------------------------------------------- | ------- | ------------------------------------ |
72
- | `options` | [PopupOptions](https://leafletjs.com/reference.html#popup-option) | `{}` | options to pass to the leaflet popup |
41
+ ### Vector Layers
73
42
 
74
- ### MarkerClusterGroup
43
+ - Path
44
+ - ✅ Polyline
45
+ - ✅ Polygon
46
+ - ✅ Rectangle
47
+ - ✅ Circle
48
+ - ✅ CircleMarker
49
+ - ✅ SVGOverlay
50
+ - SVG _(this is a Renderer, won't be implemented)_
51
+ - Canvas _(this is a Renderer, won't be implemented)_
75
52
 
76
- Enables clustering of child markers
53
+ ### Other Layers
77
54
 
78
- - Use as a `<Map>` child
55
+ - LayerGroup
56
+ - FeatureGroup
57
+ - GeoJSON
58
+ - GridLayer
79
59
 
80
- #### Attributes
60
+ ### Basic Types
81
61
 
82
- | Name | Type | Default | Notes |
83
- | --------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------- |
84
- | `options` | [MarkerClusterGroupOptions](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/leaflet.markercluster/index.d.ts#L36) | `{}` | [MarkerClusterGroup options](https://github.com/leaflet/Leaflet.markercluster?tab=readme-ov-file#defaults) |
62
+ - LatLng
63
+ - LatLngBounds
64
+ - Point
65
+ - Bounds
66
+ - ✅ Icon
67
+ - ✅ DivIcon
85
68
 
86
- ### Polyline
69
+ ### Controls
87
70
 
88
- Allows to draw lines on the map
71
+ - Zoom
72
+ - Attribution
73
+ - Layers
74
+ - Scale
89
75
 
90
- #### Attributes
76
+ ### Extra
91
77
 
92
- | Name | Type | Default | Notes |
93
- | --------- | ----------------------------------------------------------------------- | ---------- | --------------------------------------- |
94
- | `latlngs` | [LatLng[]](https://leafletjs.com/reference.html#latlng) | _required_ | array of points to draw the line |
95
- | `options` | [PolylineOptions](https://leafletjs.com/reference.html#polyline-option) | `{}` | options to pass to the leaflet polyline |
78
+ - MarkerClusterGroup
79
+ - LocateControl
80
+ - ![locate control](./static//locate-control.png)
@@ -0,0 +1,45 @@
1
+ <script lang="ts">
2
+ import { getContext, onDestroy, onMount } from 'svelte';
3
+ import type {
4
+ Circle as LeafletCircle,
5
+ LatLngExpression,
6
+ CircleMarkerOptions,
7
+ LayerGroup,
8
+ } from 'leaflet';
9
+ import { polygonEvents, updatePolylineProps, type PolygonEvents } from './polyline.js';
10
+ import { bindEvents, type LeafletMap } from './index.js';
11
+ import { LAYERGROUP, MAP } from './contexts.js';
12
+ import { circleMarkerEvents, type CircleMarkerEvents } from './circleMarker.js';
13
+
14
+ type Props = {
15
+ latlng: LatLngExpression;
16
+ instance?: LeafletCircle;
17
+ options?: CircleMarkerOptions;
18
+ } & CircleMarkerEvents;
19
+
20
+ let { latlng, instance = $bindable(), options = { radius: 50 }, ...restProps }: Props = $props();
21
+
22
+ const getMap = getContext<() => LeafletMap>(MAP);
23
+ const getLayerGroup = getContext<() => LayerGroup>(LAYERGROUP);
24
+
25
+ onMount(() => {
26
+ const map = getMap?.();
27
+ const layerGroup = getLayerGroup?.();
28
+ const context = layerGroup || map;
29
+ instance = window.L.circle(latlng, { ...options });
30
+ instance.addTo(context);
31
+ bindEvents(instance, restProps, circleMarkerEvents);
32
+ });
33
+
34
+ onDestroy(() => {
35
+ instance?.remove();
36
+ });
37
+
38
+ $effect(() => {
39
+ if (instance && latlng) {
40
+ instance.setLatLng(latlng);
41
+ }
42
+ });
43
+
44
+ // TODO : implement reactivity
45
+ </script>
@@ -0,0 +1,8 @@
1
+ import type { Circle as LeafletCircle, LatLngExpression, CircleMarkerOptions } from 'leaflet';
2
+ import { type CircleMarkerEvents } from './circleMarker.js';
3
+ declare const Circle: import("svelte").Component<{
4
+ latlng: LatLngExpression;
5
+ instance?: LeafletCircle;
6
+ options?: CircleMarkerOptions;
7
+ } & CircleMarkerEvents, {}, "instance">;
8
+ export default Circle;
@@ -0,0 +1,49 @@
1
+ <script lang="ts">
2
+ import { getContext, onDestroy, onMount } from 'svelte';
3
+ import type {
4
+ CircleMarker as LeafletCircleMarker,
5
+ LatLngExpression,
6
+ CircleMarkerOptions,
7
+ LayerGroup,
8
+ } from 'leaflet';
9
+ import { bindEvents, type LeafletMap } from './index.js';
10
+ import { LAYERGROUP, MAP } from './contexts.js';
11
+ import { circleMarkerEvents, type CircleMarkerEvents } from './circleMarker.js';
12
+
13
+ type Props = {
14
+ latlng: LatLngExpression;
15
+ instance?: LeafletCircleMarker;
16
+ options?: CircleMarkerOptions;
17
+ } & CircleMarkerEvents;
18
+
19
+ let { latlng, instance = $bindable(), options = { radius: 50 }, ...restProps }: Props = $props();
20
+
21
+ const getMap = getContext<() => LeafletMap>(MAP);
22
+ const getLayerGroup = getContext<() => LayerGroup>(LAYERGROUP);
23
+
24
+ onMount(() => {
25
+ const map = getMap?.();
26
+ const layerGroup = getLayerGroup?.();
27
+ const context = layerGroup || map;
28
+ instance = window.L.circleMarker(latlng, { ...options });
29
+ instance.addTo(context);
30
+ bindEvents(instance, restProps, circleMarkerEvents);
31
+ });
32
+
33
+ onDestroy(() => {
34
+ instance?.remove();
35
+ });
36
+
37
+ $effect(() => {
38
+ if (instance && latlng) {
39
+ instance.setLatLng(latlng);
40
+ }
41
+ });
42
+
43
+ // TODO : implement reactivity
44
+ // $effect(() => {
45
+ // if (instance && options) {
46
+ // updatePolylineProps(instance, options);
47
+ // }
48
+ // });
49
+ </script>
@@ -0,0 +1,8 @@
1
+ import type { CircleMarker as LeafletCircleMarker, LatLngExpression, CircleMarkerOptions } from 'leaflet';
2
+ import { type CircleMarkerEvents } from './circleMarker.js';
3
+ declare const CircleMarker: import("svelte").Component<{
4
+ latlng: LatLngExpression;
5
+ instance?: LeafletCircleMarker;
6
+ options?: CircleMarkerOptions;
7
+ } & CircleMarkerEvents, {}, "instance">;
8
+ export default CircleMarker;
@@ -0,0 +1,66 @@
1
+ <script lang="ts">
2
+ import { getContext, onDestroy, onMount } from 'svelte';
3
+ import type {
4
+ ImageOverlay as LeafletImageOverlay,
5
+ Map as LeafletMap,
6
+ ImageOverlayOptions,
7
+ LayerGroup,
8
+ LatLngBoundsLiteral,
9
+ } from 'leaflet';
10
+ import {
11
+ imageOverlayEvents,
12
+ updateImageOverlayProps,
13
+ type ImageOverlayEvents,
14
+ } from './imageOverlay.js';
15
+ import { bindEvents } from './index.js';
16
+ import { getOverlaysStore, LAYERGROUP, MAP } from './contexts.js';
17
+ import { getRandomString } from './utils.js';
18
+
19
+ type Props = {
20
+ name?: string;
21
+ url: string;
22
+ bounds: LatLngBoundsLiteral;
23
+ options?: ImageOverlayOptions;
24
+ instance?: LeafletImageOverlay;
25
+ } & ImageOverlayEvents;
26
+
27
+ let {
28
+ name = `overlay-${getRandomString(5)}`,
29
+ url,
30
+ bounds,
31
+ options = {},
32
+ instance = $bindable(),
33
+ ...restProps
34
+ }: Props = $props();
35
+
36
+ const getMap = getContext<() => LeafletMap>(MAP);
37
+ const getLayerGroup = getContext<() => LayerGroup>(LAYERGROUP);
38
+ const overlaysStore = getOverlaysStore();
39
+
40
+ onMount(() => {
41
+ const map = getMap?.();
42
+ const layerGroup = getLayerGroup?.();
43
+ const context = layerGroup || map;
44
+ instance = window.L.imageOverlay(url, bounds, options);
45
+ $overlaysStore[name] = instance;
46
+ bindEvents(instance, restProps, imageOverlayEvents);
47
+ instance.addTo(context);
48
+ });
49
+
50
+ onDestroy(() => {
51
+ instance?.remove();
52
+ });
53
+
54
+ $effect(() => {
55
+ if (instance && options) {
56
+ updateImageOverlayProps(instance, options);
57
+ }
58
+ });
59
+
60
+ $effect(() => {
61
+ if (instance && bounds) {
62
+ const latlngBounds = window.L.latLngBounds(bounds);
63
+ instance.setBounds(latlngBounds);
64
+ }
65
+ });
66
+ </script>
@@ -0,0 +1,10 @@
1
+ import type { ImageOverlay as LeafletImageOverlay, ImageOverlayOptions, LatLngBoundsLiteral } from 'leaflet';
2
+ import { type ImageOverlayEvents } from './imageOverlay.js';
3
+ declare const ImageOverlay: import("svelte").Component<{
4
+ name?: string;
5
+ url: string;
6
+ bounds: LatLngBoundsLiteral;
7
+ options?: ImageOverlayOptions;
8
+ instance?: LeafletImageOverlay;
9
+ } & ImageOverlayEvents, {}, "instance">;
10
+ export default ImageOverlay;
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import { getContext, onMount, tick } from 'svelte';
3
+ import { getBaseLayersStore, getOverlaysStore, MAP } from './contexts.js';
4
+ import type { Control, Map as LeafletMap } from 'leaflet';
5
+
6
+ type Props = {
7
+ instance?: Control;
8
+ options?: Control.LayersOptions;
9
+ };
10
+ let { instance = $bindable(), options }: Props = $props();
11
+
12
+ const getMap = getContext<() => LeafletMap>(MAP);
13
+ const baseLayersStore = getBaseLayersStore();
14
+ const overlaysStore = getOverlaysStore();
15
+
16
+ onMount(async () => {
17
+ const map = getMap();
18
+ // wait for layers to be initialized
19
+ await tick();
20
+ instance = window.L.control.layers($baseLayersStore, $overlaysStore, options);
21
+ instance.addTo(map);
22
+ });
23
+ </script>
@@ -0,0 +1,6 @@
1
+ import type { Control } from 'leaflet';
2
+ declare const LayersControl: import("svelte").Component<{
3
+ instance?: Control;
4
+ options?: Control.LayersOptions;
5
+ }, {}, "instance">;
6
+ export default LayersControl;
package/dist/Map.svelte CHANGED
@@ -8,9 +8,15 @@
8
8
 
9
9
  import type { MapOptions, Marker, Map as LeafletMap, LatLngTuple } from 'leaflet';
10
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';
11
+ import { setContext, tick, type Snippet } from 'svelte';
12
+ import { mapEvents, updateMapProps, type MapEvents } from './map.js';
13
+ import {
14
+ FOCUSABLE,
15
+ getBaseLayersStore,
16
+ initBaseLayersStore,
17
+ initOverlaysStore,
18
+ MAP,
19
+ } from './contexts.js';
14
20
 
15
21
  type Props = {
16
22
  instance?: LeafletMap;
@@ -27,12 +33,20 @@
27
33
  options = $bindable({}),
28
34
  markers = $bindable([]),
29
35
  tilesUrl = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
30
- attribution = `&copy;<a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>`,
36
+ attribution = `&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors`,
31
37
  focusable = true,
32
38
  children,
33
39
  ...restProps
34
40
  }: Props = $props();
35
41
 
42
+ setContext(MAP, () => instance);
43
+ setContext(FOCUSABLE, focusable ? null : -1);
44
+ initBaseLayersStore();
45
+ initOverlaysStore();
46
+ const baseLayersStore = getBaseLayersStore();
47
+
48
+ let container: HTMLElement | null = $state(null);
49
+
36
50
  const defaultOptions = {
37
51
  center: [48.852, 2.278] as LatLngTuple,
38
52
  trackResize: true,
@@ -40,20 +54,6 @@
40
54
  maxZoom: 18,
41
55
  keyboard: options.keyboard === undefined ? focusable : options.keyboard,
42
56
  };
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
57
 
58
58
  $effect(() => {
59
59
  if (instance) {
@@ -61,7 +61,7 @@
61
61
  }
62
62
  });
63
63
 
64
- function onLoad() {
64
+ async function onLoad() {
65
65
  if (!container) return;
66
66
  // @ts-ignore
67
67
  delete window.L.Icon.Default.prototype._getIconUrl;
@@ -79,11 +79,6 @@
79
79
  }
80
80
  bindEvents(instance, restProps, mapEvents);
81
81
 
82
- // create component for the tile layer ?
83
- window.L.tileLayer(tilesUrl, {
84
- attribution,
85
- }).addTo(instance);
86
-
87
82
  instance.on('layeradd', (event) => {
88
83
  const layer = event.layer;
89
84
  if (layer instanceof window.L.Marker) {
@@ -101,6 +96,16 @@
101
96
  }
102
97
  });
103
98
 
99
+ // waits for the user layers before adding a default layer
100
+ await tick();
101
+ if (!hasTileLayer(instance)) {
102
+ const defaultBaseLayer = window.L.tileLayer(tilesUrl, {
103
+ attribution,
104
+ });
105
+ defaultBaseLayer.addTo(instance);
106
+ $baseLayersStore['Default Layer'] = defaultBaseLayer;
107
+ }
108
+
104
109
  instance.whenReady(() => {
105
110
  if (!instance) return;
106
111
  // TODO: find out why manually firing the load event is needed
@@ -108,6 +113,16 @@
108
113
  });
109
114
  }
110
115
 
116
+ function hasTileLayer(map: LeafletMap) {
117
+ let hasTileLayer = false;
118
+ map.eachLayer(function (layer) {
119
+ if (layer instanceof window.L.TileLayer) {
120
+ hasTileLayer = true;
121
+ }
122
+ });
123
+ return hasTileLayer;
124
+ }
125
+
111
126
  function leafletLoader(_node: HTMLElement) {
112
127
  (async function () {
113
128
  await import('leaflet');
@@ -3,7 +3,7 @@ import 'leaflet.markercluster/dist/MarkerCluster.css';
3
3
  import 'leaflet.markercluster/dist/MarkerCluster.Default.css';
4
4
  import type { MapOptions, Marker, Map as LeafletMap } from 'leaflet';
5
5
  import { type Snippet } from 'svelte';
6
- import { type MapEvents } from './map.svelte.js';
6
+ import { type MapEvents } from './map.js';
7
7
  declare const Map: import("svelte").Component<{
8
8
  instance?: LeafletMap;
9
9
  options?: MapOptions;
@@ -12,7 +12,5 @@ declare const Map: import("svelte").Component<{
12
12
  attribution?: string;
13
13
  focusable?: boolean;
14
14
  children?: Snippet;
15
- } & MapEvents, {
16
- getMarkers: () => Marker[];
17
- }, "instance" | "options" | "markers">;
15
+ } & MapEvents, {}, "instance" | "options" | "markers">;
18
16
  export default Map;
@@ -8,7 +8,7 @@
8
8
  MarkerClusterGroup,
9
9
  } from 'leaflet';
10
10
  import { bindEvents, type LatLngExpression } from './index.js';
11
- import { markerEvents, updateMarkerProps, type MarkerEvents } from './marker.svelte.js';
11
+ import { markerEvents, updateMarkerProps, type MarkerEvents } from './marker.js';
12
12
  import { LAYERGROUP, MAP, MARKER } from './contexts.js';
13
13
 
14
14
  type Props = {
@@ -1,7 +1,7 @@
1
1
  import { type Snippet } from 'svelte';
2
2
  import type { Marker as LeafletMarker, MarkerOptions } from 'leaflet';
3
3
  import { type LatLngExpression } from './index.js';
4
- import { type MarkerEvents } from './marker.svelte.js';
4
+ import { type MarkerEvents } from './marker.js';
5
5
  declare const Marker: import("svelte").Component<{
6
6
  latlng: LatLngExpression;
7
7
  options?: MarkerOptions;
@@ -16,10 +16,7 @@
16
16
  MarkerCluster,
17
17
  } from 'leaflet';
18
18
  import { LAYERGROUP, MAP } from './contexts.js';
19
- import {
20
- markerClusterGroupEvents,
21
- type MarkerClusterGroupEvents,
22
- } from './markerClusterGroup.svelte.js';
19
+ import { markerClusterGroupEvents, type MarkerClusterGroupEvents } from './markerClusterGroup.js';
23
20
  import { bindEvents } from './index.js';
24
21
 
25
22
  type Props = {
@@ -8,61 +8,61 @@ declare const MarkerClusterGroup: Component<{
8
8
  options?: MarkerClusterGroupOptions;
9
9
  children?: Snippet;
10
10
  } & {
11
- onclustermovestart?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
11
+ onclusterclick?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
12
12
  sourceTarget: import("leaflet").Marker<any>;
13
13
  }) => void) | undefined;
14
- onclustermove?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
14
+ onclusterdblclick?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
15
15
  sourceTarget: import("leaflet").Marker<any>;
16
16
  }) => void) | undefined;
17
- onclustermoveend?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
17
+ onclustermousedown?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
18
18
  sourceTarget: import("leaflet").Marker<any>;
19
19
  }) => void) | undefined;
20
- onclusterdragstart?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
20
+ onclustermouseup?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
21
21
  sourceTarget: import("leaflet").Marker<any>;
22
22
  }) => void) | undefined;
23
- onclusterdrag?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
23
+ onclustermouseover?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
24
24
  sourceTarget: import("leaflet").Marker<any>;
25
25
  }) => void) | undefined;
26
- onclusteradd?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
26
+ onclustermouseout?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
27
27
  sourceTarget: import("leaflet").Marker<any>;
28
28
  }) => void) | undefined;
29
- onclusterremove?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
29
+ onclustercontextmenu?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
30
30
  sourceTarget: import("leaflet").Marker<any>;
31
31
  }) => void) | undefined;
32
- onclusterpopupopen?: ((e: Omit<import("leaflet").PopupEvent, "sourceTarget"> & {
32
+ onclusterdragstart?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
33
33
  sourceTarget: import("leaflet").Marker<any>;
34
34
  }) => void) | undefined;
35
- onclusterpopupclose?: ((e: Omit<import("leaflet").PopupEvent, "sourceTarget"> & {
35
+ onclustermovestart?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
36
36
  sourceTarget: import("leaflet").Marker<any>;
37
37
  }) => void) | undefined;
38
- onclustertooltipopen?: ((e: Omit<import("leaflet").TooltipEvent, "sourceTarget"> & {
38
+ onclusterdrag?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
39
39
  sourceTarget: import("leaflet").Marker<any>;
40
40
  }) => void) | undefined;
41
- onclustertooltipclose?: ((e: Omit<import("leaflet").TooltipEvent, "sourceTarget"> & {
41
+ onclusterdragend?: ((e: Omit<import("leaflet").DragEndEvent, "sourceTarget"> & {
42
42
  sourceTarget: import("leaflet").Marker<any>;
43
43
  }) => void) | undefined;
44
- onclusterclick?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
44
+ onclustermoveend?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
45
45
  sourceTarget: import("leaflet").Marker<any>;
46
46
  }) => void) | undefined;
47
- onclusterdblclick?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
47
+ onclusteradd?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
48
48
  sourceTarget: import("leaflet").Marker<any>;
49
49
  }) => void) | undefined;
50
- onclustermousedown?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
50
+ onclusterremove?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
51
51
  sourceTarget: import("leaflet").Marker<any>;
52
52
  }) => void) | undefined;
53
- onclustermouseup?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
53
+ onclusterpopupopen?: ((e: Omit<import("leaflet").PopupEvent, "sourceTarget"> & {
54
54
  sourceTarget: import("leaflet").Marker<any>;
55
55
  }) => void) | undefined;
56
- onclustermouseover?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
56
+ onclusterpopupclose?: ((e: Omit<import("leaflet").PopupEvent, "sourceTarget"> & {
57
57
  sourceTarget: import("leaflet").Marker<any>;
58
58
  }) => void) | undefined;
59
- onclustermouseout?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
59
+ onclustertooltipopen?: ((e: Omit<import("leaflet").TooltipEvent, "sourceTarget"> & {
60
60
  sourceTarget: import("leaflet").Marker<any>;
61
61
  }) => void) | undefined;
62
- onclustercontextmenu?: ((e: Omit<import("leaflet").LeafletMouseEvent, "sourceTarget"> & {
62
+ onclustertooltipclose?: ((e: Omit<import("leaflet").TooltipEvent, "sourceTarget"> & {
63
63
  sourceTarget: import("leaflet").Marker<any>;
64
64
  }) => void) | undefined;
65
- onclusterdragend?: ((e: Omit<import("leaflet").DragEndEvent, "sourceTarget"> & {
65
+ onclustermove?: ((e: Omit<import("leaflet").LeafletEvent, "sourceTarget"> & {
66
66
  sourceTarget: import("leaflet").Marker<any>;
67
67
  }) => void) | undefined;
68
68
  } & import("./utils.js").CreateSvelteEventsMap<readonly ["animationend", "spiderfied", "unspiderfied"]>, {}, "instance">;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getContext, onDestroy, onMount } from 'svelte';
3
3
  import type { Polygon as LeafletPolygon, PolylineOptions, LayerGroup } from 'leaflet';
4
- import { polygonEvents, updatePolylineProps, type PolygonEvents } from './polyline.svelte.js';
4
+ import { polygonEvents, updatePolylineProps, type PolygonEvents } from './polyline.js';
5
5
  import { bindEvents, type Latlngs, type LeafletMap } from './index.js';
6
6
  import { LAYERGROUP, MAP } from './contexts.js';
7
7
 
@@ -1,5 +1,5 @@
1
1
  import type { Polygon as LeafletPolygon, PolylineOptions } from 'leaflet';
2
- import { type PolygonEvents } from './polyline.svelte.js';
2
+ import { type PolygonEvents } from './polyline.js';
3
3
  import { type Latlngs } from './index.js';
4
4
  declare const Polygon: import("svelte").Component<{
5
5
  latlngs: Latlngs<3>;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getContext, onDestroy, onMount } from 'svelte';
3
3
  import type { Polyline as LeafletPolyline, PolylineOptions, LayerGroup } from 'leaflet';
4
- import { polygonEvents, updatePolylineProps, type PolygonEvents } from './polyline.svelte.js';
4
+ import { polygonEvents, updatePolylineProps, type PolygonEvents } from './polyline.js';
5
5
  import { bindEvents, type Latlngs, type LeafletMap } from './index.js';
6
6
  import { LAYERGROUP, MAP } from './contexts.js';
7
7
 
@@ -1,5 +1,5 @@
1
1
  import type { Polyline as LeafletPolyline, PolylineOptions } from 'leaflet';
2
- import { type PolygonEvents } from './polyline.svelte.js';
2
+ import { type PolygonEvents } from './polyline.js';
3
3
  import { type Latlngs } from './index.js';
4
4
  declare const Polyline: import("svelte").Component<{
5
5
  latlngs: Latlngs;