@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/dist/Popup.svelte CHANGED
@@ -9,7 +9,7 @@
9
9
  } from 'leaflet';
10
10
  import { getContext, onDestroy, onMount, type Snippet } from 'svelte';
11
11
  import { bindEvents } from './index.js';
12
- import { popupEvents, updatePopupProps, type PopupEvents } from './popup.svelte.js';
12
+ import { popupEvents, updatePopupProps, type PopupEvents } from './popup.js';
13
13
  import { LAYERGROUP, MAP, MARKER } from './contexts.js';
14
14
 
15
15
  type Props = {
@@ -1,6 +1,6 @@
1
1
  import type { LatLngExpression, PopupOptions, Popup as LeafletPopup } from 'leaflet';
2
2
  import { type Snippet } from 'svelte';
3
- import { type PopupEvents } from './popup.svelte.js';
3
+ import { type PopupEvents } from './popup.js';
4
4
  declare const Popup: import("svelte").Component<{
5
5
  latlng?: LatLngExpression;
6
6
  options?: PopupOptions;
@@ -0,0 +1,48 @@
1
+ <script lang="ts">
2
+ import { getContext, onDestroy, onMount } from 'svelte';
3
+ import type {
4
+ Rectangle as LeafletRectangle,
5
+ LatLngBoundsExpression,
6
+ PolylineOptions,
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
+
13
+ type Props = {
14
+ bounds: LatLngBoundsExpression;
15
+ instance?: LeafletRectangle;
16
+ options?: PolylineOptions;
17
+ } & PolygonEvents;
18
+
19
+ let { bounds, instance = $bindable(), options = {}, ...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.rectangle(bounds, options);
29
+ instance.addTo(context);
30
+ bindEvents(instance, restProps, polygonEvents);
31
+ });
32
+
33
+ onDestroy(() => {
34
+ instance?.remove();
35
+ });
36
+
37
+ $effect(() => {
38
+ if (instance && bounds) {
39
+ instance.setBounds(bounds);
40
+ }
41
+ });
42
+
43
+ $effect(() => {
44
+ if (instance && options) {
45
+ updatePolylineProps(instance, options);
46
+ }
47
+ });
48
+ </script>
@@ -0,0 +1,8 @@
1
+ import type { Rectangle as LeafletRectangle, LatLngBoundsExpression, PolylineOptions } from 'leaflet';
2
+ import { type PolygonEvents } from './polyline.js';
3
+ declare const Rectangle: import("svelte").Component<{
4
+ bounds: LatLngBoundsExpression;
5
+ instance?: LeafletRectangle;
6
+ options?: PolylineOptions;
7
+ } & PolygonEvents, {}, "instance">;
8
+ export default Rectangle;
@@ -0,0 +1,52 @@
1
+ <script lang="ts">
2
+ import { getContext, onDestroy, onMount } from 'svelte';
3
+ import type { SVGOverlay as LeafletSVGOverlay, LayerGroup, LatLngBoundsLiteral } from 'leaflet';
4
+ import { type LeafletMap } from './index.js';
5
+ import { LAYERGROUP, MAP } from './contexts.js';
6
+
7
+ type Props = {
8
+ bounds: LatLngBoundsLiteral;
9
+ instance?: LeafletSVGOverlay;
10
+ options?: object;
11
+ children?: any;
12
+ };
13
+
14
+ let { bounds, instance = $bindable(), options = {}, children, ...restProps }: Props = $props();
15
+ let svgContainer: HTMLDivElement | null = $state(null);
16
+
17
+ const getMap = getContext<() => LeafletMap>(MAP);
18
+ const getLayerGroup = getContext<() => LayerGroup>(LAYERGROUP);
19
+
20
+ onMount(() => {
21
+ const map = getMap?.();
22
+ const layerGroup = getLayerGroup?.();
23
+ const context = layerGroup || map;
24
+ const svg = svgContainer?.querySelector('svg');
25
+ if (!svg) {
26
+ throw new Error('SVGOverlay requires an SVG element as a child');
27
+ }
28
+ instance = window.L.svgOverlay(svg, bounds, options);
29
+ instance.addTo(context);
30
+ // bindEvents(instance, restProps);
31
+ });
32
+
33
+ onDestroy(() => {
34
+ instance?.remove();
35
+ });
36
+
37
+ // $effect(() => {
38
+ // if (instance && bounds) {
39
+ // instance.setBounds(window.L.latLngBounds(bounds));
40
+ // }
41
+ // });
42
+ </script>
43
+
44
+ <div bind:this={svgContainer} class="svg-container">
45
+ {@render children()}
46
+ </div>
47
+
48
+ <style>
49
+ .svg-container {
50
+ display: none;
51
+ }
52
+ </style>
@@ -0,0 +1,8 @@
1
+ import type { SVGOverlay as LeafletSVGOverlay, LatLngBoundsLiteral } from 'leaflet';
2
+ declare const SvgOverlay: import("svelte").Component<{
3
+ bounds: LatLngBoundsLiteral;
4
+ instance?: LeafletSVGOverlay;
5
+ options?: object;
6
+ children?: any;
7
+ }, {}, "instance">;
8
+ export default SvgOverlay;
@@ -0,0 +1,34 @@
1
+ <script lang="ts">
2
+ import { getContext, onDestroy, onMount } from 'svelte';
3
+ import type { TileLayer as LeafletTileLayer, TileLayerOptions, Map as LeafletMap } from 'leaflet';
4
+ import { getBaseLayersStore, MAP } from './contexts.js';
5
+ import { getRandomString } from './utils.js';
6
+
7
+ type Props = {
8
+ url: string;
9
+ name?: string;
10
+ options?: TileLayerOptions;
11
+ instance?: LeafletTileLayer;
12
+ };
13
+
14
+ let {
15
+ url,
16
+ name = `layer-${getRandomString(5)}`,
17
+ options = {},
18
+ instance = $bindable(),
19
+ }: Props = $props();
20
+
21
+ const getMap = getContext<() => LeafletMap>(MAP);
22
+ const baseLayersStore = getBaseLayersStore();
23
+
24
+ onMount(() => {
25
+ const map = getMap();
26
+ instance = window.L.tileLayer(url, options);
27
+ $baseLayersStore[name] = instance;
28
+ instance.addTo(map);
29
+ });
30
+
31
+ onDestroy(() => {
32
+ instance?.remove();
33
+ });
34
+ </script>
@@ -0,0 +1,8 @@
1
+ import type { TileLayer as LeafletTileLayer, TileLayerOptions } from 'leaflet';
2
+ declare const TileLayer: import("svelte").Component<{
3
+ url: string;
4
+ name?: string;
5
+ options?: TileLayerOptions;
6
+ instance?: LeafletTileLayer;
7
+ }, {}, "instance">;
8
+ export default TileLayer;
@@ -0,0 +1,36 @@
1
+ <script lang="ts">
2
+ import { getContext, onDestroy, onMount } from 'svelte';
3
+ import type {
4
+ WMSOptions,
5
+ WMSParams,
6
+ TileLayer as LeafletTileLayer,
7
+ Map as LeafletMap,
8
+ } from 'leaflet';
9
+ import { MAP } from './contexts.js';
10
+
11
+ type Props = {
12
+ url: string;
13
+ params?: WMSParams;
14
+ options?: WMSOptions;
15
+ instance?: LeafletTileLayer;
16
+ };
17
+
18
+ let {
19
+ url,
20
+ params = { layers: 'wms-default-layer' },
21
+ options = {},
22
+ instance = $bindable(),
23
+ }: Props = $props();
24
+
25
+ const getMap = getContext<() => LeafletMap>(MAP);
26
+
27
+ onMount(() => {
28
+ const map = getMap();
29
+ instance = window.L.tileLayer.wms(url, { ...options, ...params });
30
+ instance.addTo(map);
31
+ });
32
+
33
+ onDestroy(() => {
34
+ instance?.remove();
35
+ });
36
+ </script>
@@ -0,0 +1,8 @@
1
+ import type { WMSOptions, WMSParams, TileLayer as LeafletTileLayer } from 'leaflet';
2
+ declare const TileLayerWms: import("svelte").Component<{
3
+ url: string;
4
+ params?: WMSParams;
5
+ options?: WMSOptions;
6
+ instance?: LeafletTileLayer;
7
+ }, {}, "instance">;
8
+ export default TileLayerWms;
@@ -0,0 +1,73 @@
1
+ <script lang="ts">
2
+ import type {
3
+ LatLngExpression,
4
+ TooltipOptions,
5
+ LayerGroup,
6
+ Tooltip as LeafletTooltip,
7
+ Map as LeafletMap,
8
+ Marker as LeafletMarker,
9
+ } from 'leaflet';
10
+ import { getContext, onDestroy, onMount, type Snippet } from 'svelte';
11
+ import { bindEvents } from './index.js';
12
+ import { tooltipEvents, updateTooltipProps, type TooltipEvents } from './tooltip.js';
13
+ import { LAYERGROUP, MAP, MARKER } from './contexts.js';
14
+
15
+ type Props = {
16
+ latlng?: LatLngExpression;
17
+ options?: TooltipOptions;
18
+ instance?: LeafletTooltip;
19
+ children?: Snippet;
20
+ } & TooltipEvents;
21
+
22
+ let {
23
+ latlng,
24
+ options = $bindable({}),
25
+ instance = $bindable(),
26
+ children,
27
+ ...restProps
28
+ }: Props = $props();
29
+
30
+ let tooltipContent: HTMLElement | undefined = $state();
31
+
32
+ const getMap = getContext<() => LeafletMap>(MAP);
33
+ const getLayerGroup = getContext<() => LayerGroup>(LAYERGROUP);
34
+ const getMarker = getContext<() => LeafletMarker>(MARKER);
35
+
36
+ onMount(() => {
37
+ const map = getMap?.();
38
+ const layerGroup = getLayerGroup?.();
39
+ const marker = getMarker?.();
40
+ const context = layerGroup || map;
41
+ instance = window.L.tooltip(options);
42
+ if (latlng) instance.setLatLng(latlng);
43
+ bindEvents(instance, restProps, tooltipEvents);
44
+ if (marker) marker.bindTooltip(instance);
45
+ else if (map) instance.openOn(map);
46
+ else instance.addTo(context);
47
+ if (tooltipContent) instance.setContent(tooltipContent);
48
+ });
49
+
50
+ onDestroy(() => {
51
+ instance?.remove();
52
+ });
53
+
54
+ $effect(() => {
55
+ if (instance && options) {
56
+ updateTooltipProps(instance, options);
57
+ }
58
+ });
59
+ </script>
60
+
61
+ <div class="container">
62
+ {#if children}
63
+ <div bind:this={tooltipContent} class="TooltipChildrenContainer">
64
+ {@render children()}
65
+ </div>
66
+ {/if}
67
+ </div>
68
+
69
+ <style>
70
+ .container {
71
+ display: none;
72
+ }
73
+ </style>
@@ -0,0 +1,10 @@
1
+ import type { LatLngExpression, TooltipOptions, Tooltip as LeafletTooltip } from 'leaflet';
2
+ import { type Snippet } from 'svelte';
3
+ import { type TooltipEvents } from './tooltip.js';
4
+ declare const Tooltip: import("svelte").Component<{
5
+ latlng?: LatLngExpression;
6
+ options?: TooltipOptions;
7
+ instance?: LeafletTooltip;
8
+ children?: Snippet;
9
+ } & TooltipEvents, {}, "instance" | "options">;
10
+ export default Tooltip;
@@ -0,0 +1,66 @@
1
+ <script lang="ts">
2
+ import { getContext, onDestroy, onMount } from 'svelte';
3
+ import type {
4
+ VideoOverlay as LeafletVideoOverlay,
5
+ Map as LeafletMap,
6
+ VideoOverlayOptions,
7
+ LayerGroup,
8
+ LatLngBoundsLiteral,
9
+ } from 'leaflet';
10
+ import {
11
+ videoOverlayEvents,
12
+ updateVideoOverlayProps,
13
+ type VideoOverlayEvents,
14
+ } from './videoOverlay.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 | string[] | HTMLVideoElement;
22
+ bounds: LatLngBoundsLiteral;
23
+ options?: VideoOverlayOptions;
24
+ instance?: LeafletVideoOverlay;
25
+ } & VideoOverlayEvents;
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.videoOverlay(url, bounds, options);
45
+ $overlaysStore[name] = instance;
46
+ bindEvents(instance, restProps, videoOverlayEvents);
47
+ instance.addTo(context);
48
+ });
49
+
50
+ onDestroy(() => {
51
+ instance?.remove();
52
+ });
53
+
54
+ $effect(() => {
55
+ if (instance && options) {
56
+ updateVideoOverlayProps(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 { VideoOverlay as LeafletVideoOverlay, VideoOverlayOptions, LatLngBoundsLiteral } from 'leaflet';
2
+ import { type VideoOverlayEvents } from './videoOverlay.js';
3
+ declare const VideoOverlay: import("svelte").Component<{
4
+ name?: string;
5
+ url: string | string[] | HTMLVideoElement;
6
+ bounds: LatLngBoundsLiteral;
7
+ options?: VideoOverlayOptions;
8
+ instance?: LeafletVideoOverlay;
9
+ } & VideoOverlayEvents, {}, "instance">;
10
+ export default VideoOverlay;
@@ -0,0 +1,21 @@
1
+ <script lang="ts">
2
+ import { getContext, onMount, type Snippet } from 'svelte';
3
+ import type { Control, Map as LeafletMap } from 'leaflet';
4
+ import { MAP } from './contexts.js';
5
+
6
+ type Props = {
7
+ instance?: L.Control;
8
+ children?: Snippet;
9
+ options?: Control.ZoomOptions;
10
+ };
11
+
12
+ let { instance = $bindable(), options }: Props = $props();
13
+
14
+ const getMap = getContext<() => LeafletMap>(MAP);
15
+
16
+ onMount(() => {
17
+ const map = getMap();
18
+ instance = window.L.control.zoom(options);
19
+ instance.addTo(map);
20
+ });
21
+ </script>
@@ -0,0 +1,8 @@
1
+ import { type Snippet } from 'svelte';
2
+ import type { Control } from 'leaflet';
3
+ declare const ZoomControl: import("svelte").Component<{
4
+ instance?: L.Control;
5
+ children?: Snippet;
6
+ options?: Control.ZoomOptions;
7
+ }, {}, "instance">;
8
+ export default ZoomControl;
@@ -0,0 +1,4 @@
1
+ import type { CircleMarker as LeafletCircleMarker } from 'leaflet';
2
+ import type { CreateSvelteEventsMap } from './utils.js';
3
+ export declare const circleMarkerEvents: readonly ["move", "click", "dblclick", "mousedown", "mouseup", "mouseover", "mouseout", "contextmenu", "add", "remove", "popupopen", "popupclose", "tooltipopen", "tooltipclose"];
4
+ export type CircleMarkerEvents = CreateSvelteEventsMap<typeof circleMarkerEvents, LeafletCircleMarker>;
@@ -0,0 +1,8 @@
1
+ import { interactiveLayerEvents, layerEvents, popupSpecificEvents, tooltipSpecificEvents, } from './events.js';
2
+ export const circleMarkerEvents = [
3
+ 'move',
4
+ ...interactiveLayerEvents,
5
+ ...layerEvents,
6
+ ...popupSpecificEvents,
7
+ ...tooltipSpecificEvents,
8
+ ];
@@ -1,4 +1,12 @@
1
+ import { type Writable } from 'svelte/store';
2
+ import type { Control } from 'leaflet';
1
3
  export declare const MAP: unique symbol;
2
4
  export declare const LAYERGROUP: unique symbol;
3
5
  export declare const MARKER: unique symbol;
4
6
  export declare const FOCUSABLE: unique symbol;
7
+ type Context = Writable<Control.LayersObject>;
8
+ export declare function initBaseLayersStore(): void;
9
+ export declare function getBaseLayersStore(): Context;
10
+ export declare function initOverlaysStore(): void;
11
+ export declare function getOverlaysStore(): Context;
12
+ export {};
package/dist/contexts.js CHANGED
@@ -1,4 +1,22 @@
1
+ import { writable } from 'svelte/store';
2
+ import { getContext, setContext } from 'svelte';
1
3
  export const MAP = Symbol('map');
2
4
  export const LAYERGROUP = Symbol('layerGroup');
3
5
  export const MARKER = Symbol('marker');
4
6
  export const FOCUSABLE = Symbol('focusable');
7
+ const BASELAYERS = Symbol('baseLayers');
8
+ const OVERLAYS = Symbol('overlays');
9
+ export function initBaseLayersStore() {
10
+ const baseLayers = writable({});
11
+ setContext(BASELAYERS, baseLayers);
12
+ }
13
+ export function getBaseLayersStore() {
14
+ return getContext(BASELAYERS);
15
+ }
16
+ export function initOverlaysStore() {
17
+ const baseLayers = writable({});
18
+ setContext(OVERLAYS, baseLayers);
19
+ }
20
+ export function getOverlaysStore() {
21
+ return getContext(OVERLAYS);
22
+ }
package/dist/events.d.ts CHANGED
@@ -5,7 +5,7 @@ export declare const locationEvents: readonly ["locationfound", "locationerror"]
5
5
  export declare const leafletMouseEvents: readonly ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mouseout", "contextmenu", "mousemove", "preclick"];
6
6
  export declare const layerEvents: readonly ["add", "remove"];
7
7
  export declare const popupSpecificEvents: readonly ["popupopen", "popupclose"];
8
- export declare const tooltipEvents: readonly ["tooltipopen", "tooltipclose"];
8
+ export declare const tooltipSpecificEvents: readonly ["tooltipopen", "tooltipclose"];
9
9
  export declare const layerGroupEvents: readonly ["layeradd", "layerremove"];
10
10
  export declare const layersControlEvents: readonly ["baselayerchange", "overlayadd", "overlayremove"];
11
11
  export declare const mapStateChangeEvents: readonly ["load", "move", "moveend", "movestart", "unload", "viewreset", "zoom", "zoomend", "zoomlevelschange", "zoomstart", "resize"];
package/dist/events.js CHANGED
@@ -13,7 +13,7 @@ export const locationEvents = ['locationfound', 'locationerror'];
13
13
  export const leafletMouseEvents = [...interactiveLayerEvents, 'mousemove', 'preclick'];
14
14
  export const layerEvents = ['add', 'remove'];
15
15
  export const popupSpecificEvents = ['popupopen', 'popupclose'];
16
- export const tooltipEvents = ['tooltipopen', 'tooltipclose'];
16
+ export const tooltipSpecificEvents = ['tooltipopen', 'tooltipclose'];
17
17
  export const layerGroupEvents = ['layeradd', 'layerremove'];
18
18
  export const layersControlEvents = ['baselayerchange', 'overlayadd', 'overlayremove'];
19
19
  const leafletEvents = [
@@ -0,0 +1,5 @@
1
+ import type { ImageOverlay as LeafletImageOverlay, ImageOverlayOptions } from 'leaflet';
2
+ import type { CreateSvelteEventsMap } from './utils.js';
3
+ export declare function updateImageOverlayProps(instance: LeafletImageOverlay, options: ImageOverlayOptions): void;
4
+ export declare const imageOverlayEvents: readonly ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mouseout", "contextmenu", "add", "remove", "popupopen", "popupclose", "tooltipopen", "tooltipclose"];
5
+ export type ImageOverlayEvents = CreateSvelteEventsMap<typeof imageOverlayEvents, LeafletImageOverlay>;
@@ -0,0 +1,25 @@
1
+ import { interactiveLayerEvents, layerEvents, popupSpecificEvents, tooltipSpecificEvents, } from './events.js';
2
+ export function updateImageOverlayProps(instance, options) {
3
+ if (!options)
4
+ return;
5
+ for (const [key, value] of Object.entries(options)) {
6
+ if (instance.options[key] === value)
7
+ continue;
8
+ instance.options[key] = value;
9
+ switch (key) {
10
+ case 'opacity':
11
+ case 'alt':
12
+ instance.setOpacity(value);
13
+ break;
14
+ case 'interactive':
15
+ case 'attribution':
16
+ throw new Error(`mutation of ${key} option is not supported`);
17
+ }
18
+ }
19
+ }
20
+ export const imageOverlayEvents = [
21
+ ...interactiveLayerEvents,
22
+ ...layerEvents,
23
+ ...popupSpecificEvents,
24
+ ...tooltipSpecificEvents,
25
+ ];
@@ -1,5 +1,5 @@
1
1
  import { capitalize } from './utils.js';
2
- import { keyboardEvents, layerGroupEvents, layersControlEvents, leafletMouseEvents, locationEvents, mapStateChangeEvents, popupSpecificEvents, tooltipEvents, } from './events.js';
2
+ import { keyboardEvents, layerGroupEvents, layersControlEvents, leafletMouseEvents, locationEvents, mapStateChangeEvents, popupSpecificEvents, tooltipSpecificEvents, } from './events.js';
3
3
  // stores the function bound to the event listener so it can be removed later
4
4
  let boundInvalidateMapSize = null;
5
5
  function invalidateMapSize(map) {
@@ -111,7 +111,7 @@ export const mapEvents = [
111
111
  ...locationEvents,
112
112
  ...mapStateChangeEvents,
113
113
  ...popupSpecificEvents,
114
- ...tooltipEvents,
114
+ ...tooltipSpecificEvents,
115
115
  'autopanstart',
116
116
  'zoomanim',
117
117
  ];
@@ -1,5 +1,5 @@
1
1
  import { capitalize } from './utils.js';
2
- import { draggingEvents, interactiveLayerEvents, layerEvents, popupSpecificEvents, tooltipEvents, } from './events.js';
2
+ import { draggingEvents, interactiveLayerEvents, layerEvents, popupSpecificEvents, tooltipSpecificEvents, } from './events.js';
3
3
  // const L = globalThis.window.L;
4
4
  export function updateMarkerProps(instance, options) {
5
5
  if (!options)
@@ -57,5 +57,5 @@ export const markerEvents = [
57
57
  ...interactiveLayerEvents,
58
58
  ...layerEvents,
59
59
  ...popupSpecificEvents,
60
- ...tooltipEvents,
60
+ ...tooltipSpecificEvents,
61
61
  ];
@@ -1,8 +1,8 @@
1
- import { type MarkerEvents } from './marker.svelte.js';
1
+ import { type MarkerEvents } from './marker.js';
2
2
  import type { CreateSvelteEventsMap } from './utils.js';
3
3
  type ClusterifyMarkerEvent<E> = E extends `on${infer N}` ? `oncluster${N}` : never;
4
4
  declare const clusterSpecificEvents: readonly ["animationend", "spiderfied", "unspiderfied"];
5
- export declare const markerClusterGroupEvents: readonly [...("clustermovestart" | "clustermove" | "clustermoveend" | "clusterdragstart" | "clusterdrag" | "clusteradd" | "clusterremove" | "clusterpopupopen" | "clusterpopupclose" | "clustertooltipopen" | "clustertooltipclose" | "clusterclick" | "clusterdblclick" | "clustermousedown" | "clustermouseup" | "clustermouseover" | "clustermouseout" | "clustercontextmenu" | "clusterdragend")[], "animationend", "spiderfied", "unspiderfied"];
5
+ export declare const markerClusterGroupEvents: readonly [...("clusterclick" | "clusterdblclick" | "clustermousedown" | "clustermouseup" | "clustermouseover" | "clustermouseout" | "clustercontextmenu" | "clusterdragstart" | "clustermovestart" | "clusterdrag" | "clusterdragend" | "clustermoveend" | "clusteradd" | "clusterremove" | "clusterpopupopen" | "clusterpopupclose" | "clustertooltipopen" | "clustertooltipclose" | "clustermove")[], "animationend", "spiderfied", "unspiderfied"];
6
6
  export type MarkerClusterGroupEvents = {
7
7
  [K in keyof MarkerEvents as ClusterifyMarkerEvent<K>]: MarkerEvents[K];
8
8
  } & CreateSvelteEventsMap<typeof clusterSpecificEvents>;
@@ -1,4 +1,4 @@
1
- import { markerEvents } from './marker.svelte.js';
1
+ import { markerEvents } from './marker.js';
2
2
  const clusteredMarkerEvents = markerEvents.map((event) => `cluster${event}`);
3
3
  const clusterSpecificEvents = ['animationend', 'spiderfied', 'unspiderfied'];
4
4
  export const markerClusterGroupEvents = [
@@ -1,4 +1,4 @@
1
- import { interactiveLayerEvents, layerEvents, popupSpecificEvents, tooltipEvents, } from './events.js';
1
+ import { interactiveLayerEvents, layerEvents, popupSpecificEvents, tooltipSpecificEvents, } from './events.js';
2
2
  export function updatePolylineProps(instance, options) {
3
3
  if (!options)
4
4
  return;
@@ -52,5 +52,5 @@ export const polygonEvents = [
52
52
  ...interactiveLayerEvents,
53
53
  ...layerEvents,
54
54
  ...popupSpecificEvents,
55
- ...tooltipEvents,
55
+ ...tooltipSpecificEvents,
56
56
  ];
@@ -1,4 +1,4 @@
1
- import { interactiveLayerEvents, layerEvents, popupSpecificEvents, tooltipEvents, } from './events.js';
1
+ import { interactiveLayerEvents, layerEvents, popupSpecificEvents, tooltipSpecificEvents, } from './events.js';
2
2
  export function updatePopupProps(instance, options) {
3
3
  if (!options)
4
4
  return;
@@ -46,5 +46,5 @@ export const popupEvents = [
46
46
  ...interactiveLayerEvents,
47
47
  ...layerEvents,
48
48
  ...popupSpecificEvents,
49
- ...tooltipEvents,
49
+ ...tooltipSpecificEvents,
50
50
  ];
@@ -0,0 +1,5 @@
1
+ import type { TileLayerOptions } from 'leaflet';
2
+ export type TileLayerProps = {
3
+ url: string;
4
+ options?: TileLayerOptions;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { TileLayerOptions, WMSParams, TileLayer as LeafletTileLayerWMS } from 'leaflet';
2
+ export type TileLayerWMSProps = {
3
+ url: string;
4
+ params?: WMSParams;
5
+ options?: TileLayerOptions;
6
+ instance?: LeafletTileLayerWMS;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { Tooltip as LeafletTooltip, TooltipOptions } from 'leaflet';
2
+ import type { CreateSvelteEventsMap } from './utils.js';
3
+ export declare function updateTooltipProps(instance: LeafletTooltip, options: TooltipOptions): void;
4
+ export declare const tooltipEvents: readonly ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mouseout", "contextmenu", "add", "remove", "tooltipopen", "tooltipclose"];
5
+ export type TooltipEvents = CreateSvelteEventsMap<typeof tooltipEvents, LeafletTooltip>;
6
+ declare module 'leaflet' {
7
+ interface Tooltip {
8
+ _source: Layer;
9
+ }
10
+ }