0.1.0-alpha.19 • Published 8 months ago

@radiofrance/svelte-leaflet v0.1.0-alpha.19

Weekly downloads
-
License
-
Repository
github
Last release
8 months ago

@radiofrance/svelte-leaflet

A library that wraps leaflet classes in domless/renderless svelte components.

Install

npm i -D @radiofrance/svelte-leaflet

Components

Map

Renders a map Leaflet Map. The Map will take up 100% of its container's height and width.

Attributes

AttributeTypeDefaultNotes
optionsMapOptions{}Map options
tilesUrlstring'https://tile.openstreetmap.org/{z}/{x}/{y}.png'more free tile services can be found at https://alexurquhart.github.io/free-tiles/
attributionstring'©OpenStreetMap' (link to openstreetmap)

Events

All events are forwarded from the Map class, see the leaflet documentation for more information.

Example:

<Map {options} on:click={(e) => console.log(e.detail.latlng)} />

Marker

Add a marker to the map.

  • Can be used as a child of <Map> or <MarkerClusterGroup>
  • A <Popup> component can be passed as the Marker child to display a popup when the marker is clicked.
  • A component with slot="icon" attribute can be passed as the Marker child to display a custom icon.

Attributes

NameTypeDefaultNotes
latlngLatLngrequiredposition of the marker
sizenumber25icon size (only used with a custom icon)
idstring''an identifier to link the maker with you data

Events

All events are forwarded from the Marker class, see the leaflet documentation for more information.

Popup

<Popup> children will be displayed when the marker is clicked.

  • Use as a <Marker> child.

Attributes

NameTypeDefaultNotes
optionsPopupOptions{}options to pass to the leaflet popup

MarkerClusterGroup

Enables clustering of child markers

  • Use as a <Map> child

Attributes

NameTypeDefaultNotes
optionsMarkerClusterGroupOptions{}MarkerClusterGroup options

Polyline

Allows to draw lines on the map

Attributes

NameTypeDefaultNotes
latlngsLatLng[]requiredarray of points to draw the line
optionsPolylineOptions{}options to pass to the leaflet polyline
0.1.0-alpha.19

8 months ago

0.1.0-alpha.18

8 months ago

0.1.0-alpha.17

8 months ago

0.1.0-alpha.16

10 months ago

0.1.0-alpha.15

10 months ago

0.1.0-alpha.14

10 months ago

0.1.0-alpha.13

10 months ago

0.1.0-alpha.12

10 months ago

0.1.0-alpha.11

10 months ago

0.1.0-alpha.10

10 months ago

0.1.0-alpha.9

10 months ago

0.1.0-alpha.8

11 months ago

0.1.0-alpha.7

11 months ago

0.1.0-alpha.6

11 months ago

0.1.0-alpha.5

11 months ago

0.1.0-alpha.4

11 months ago

0.1.0-alpha.3

11 months ago

0.1.0-alpha.2

11 months ago

0.1.0-alpha.0

11 months ago