maplair 4.0.0-alpha.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.
- package/CHANGELOG.md +2804 -0
- package/LICENSE +27 -0
- package/README.md +40 -0
- package/dist/esm/Maplair.js +71 -0
- package/dist/esm/Maplair.js.map +1 -0
- package/dist/esm/_virtual/_rolldown/runtime.js +13 -0
- package/dist/esm/control/AttributionControl.js +79 -0
- package/dist/esm/control/AttributionControl.js.map +1 -0
- package/dist/esm/control/Control.js +81 -0
- package/dist/esm/control/Control.js.map +1 -0
- package/dist/esm/control/LayersControl.js +220 -0
- package/dist/esm/control/LayersControl.js.map +1 -0
- package/dist/esm/control/ScaleControl.js +72 -0
- package/dist/esm/control/ScaleControl.js.map +1 -0
- package/dist/esm/control/ZoomControl.js +86 -0
- package/dist/esm/control/ZoomControl.js.map +1 -0
- package/dist/esm/core/Browser.js +31 -0
- package/dist/esm/core/Browser.js.map +1 -0
- package/dist/esm/core/Class.js +52 -0
- package/dist/esm/core/Class.js.map +1 -0
- package/dist/esm/core/Events.js +149 -0
- package/dist/esm/core/Events.js.map +1 -0
- package/dist/esm/core/Handler.js +32 -0
- package/dist/esm/core/Handler.js.map +1 -0
- package/dist/esm/core/I18n.js +36 -0
- package/dist/esm/core/I18n.js.map +1 -0
- package/dist/esm/core/Util.js +71 -0
- package/dist/esm/core/Util.js.map +1 -0
- package/dist/esm/dom/DomEvent.DoubleTap.js +74 -0
- package/dist/esm/dom/DomEvent.DoubleTap.js.map +1 -0
- package/dist/esm/dom/DomEvent.PointerEvents.js +46 -0
- package/dist/esm/dom/DomEvent.PointerEvents.js.map +1 -0
- package/dist/esm/dom/DomEvent.js +135 -0
- package/dist/esm/dom/DomEvent.js.map +1 -0
- package/dist/esm/dom/DomUtil.js +107 -0
- package/dist/esm/dom/DomUtil.js.map +1 -0
- package/dist/esm/dom/Draggable.js +107 -0
- package/dist/esm/dom/Draggable.js.map +1 -0
- package/dist/esm/dom/PosAnimation.js +56 -0
- package/dist/esm/dom/PosAnimation.js.map +1 -0
- package/dist/esm/geo/LatLng.js +65 -0
- package/dist/esm/geo/LatLng.js.map +1 -0
- package/dist/esm/geo/LatLngBounds.js +114 -0
- package/dist/esm/geo/LatLngBounds.js.map +1 -0
- package/dist/esm/geo/crs/CRS.js +51 -0
- package/dist/esm/geo/crs/CRS.js.map +1 -0
- package/dist/esm/geo/crs/EPSG3395.js +16 -0
- package/dist/esm/geo/crs/EPSG3395.js.map +1 -0
- package/dist/esm/geo/crs/EPSG3857.js +19 -0
- package/dist/esm/geo/crs/EPSG3857.js.map +1 -0
- package/dist/esm/geo/crs/EPSG4326.js +13 -0
- package/dist/esm/geo/crs/EPSG4326.js.map +1 -0
- package/dist/esm/geo/crs/EarthCRS.js +14 -0
- package/dist/esm/geo/crs/EarthCRS.js.map +1 -0
- package/dist/esm/geo/crs/SimpleCRS.js +23 -0
- package/dist/esm/geo/crs/SimpleCRS.js.map +1 -0
- package/dist/esm/geo/projection/Projection.LonLat.js +19 -0
- package/dist/esm/geo/projection/Projection.LonLat.js.map +1 -0
- package/dist/esm/geo/projection/Projection.Mercator.js +33 -0
- package/dist/esm/geo/projection/Projection.Mercator.js.map +1 -0
- package/dist/esm/geo/projection/Projection.SphericalMercator.js +27 -0
- package/dist/esm/geo/projection/Projection.SphericalMercator.js.map +1 -0
- package/dist/esm/geo/projection/index.js +14 -0
- package/dist/esm/geo/projection/index.js.map +1 -0
- package/dist/esm/geometry/Bounds.js +91 -0
- package/dist/esm/geometry/Bounds.js.map +1 -0
- package/dist/esm/geometry/LineUtil.js +169 -0
- package/dist/esm/geometry/LineUtil.js.map +1 -0
- package/dist/esm/geometry/Point.js +119 -0
- package/dist/esm/geometry/Point.js.map +1 -0
- package/dist/esm/geometry/PolyUtil.js +89 -0
- package/dist/esm/geometry/PolyUtil.js.map +1 -0
- package/dist/esm/geometry/Transformation.js +34 -0
- package/dist/esm/geometry/Transformation.js.map +1 -0
- package/dist/esm/layer/BlanketOverlay.js +87 -0
- package/dist/esm/layer/BlanketOverlay.js.map +1 -0
- package/dist/esm/layer/DivOverlay.js +192 -0
- package/dist/esm/layer/DivOverlay.js.map +1 -0
- package/dist/esm/layer/FeatureGroup.js +40 -0
- package/dist/esm/layer/FeatureGroup.js.map +1 -0
- package/dist/esm/layer/GeoJSON.js +192 -0
- package/dist/esm/layer/GeoJSON.js.map +1 -0
- package/dist/esm/layer/ImageOverlay.js +140 -0
- package/dist/esm/layer/ImageOverlay.js.map +1 -0
- package/dist/esm/layer/Layer.js +119 -0
- package/dist/esm/layer/Layer.js.map +1 -0
- package/dist/esm/layer/LayerGroup.js +58 -0
- package/dist/esm/layer/LayerGroup.js.map +1 -0
- package/dist/esm/layer/Popup.js +224 -0
- package/dist/esm/layer/Popup.js.map +1 -0
- package/dist/esm/layer/SVGOverlay.js +21 -0
- package/dist/esm/layer/SVGOverlay.js.map +1 -0
- package/dist/esm/layer/Tooltip.js +228 -0
- package/dist/esm/layer/Tooltip.js.map +1 -0
- package/dist/esm/layer/VideoOverlay.js +54 -0
- package/dist/esm/layer/VideoOverlay.js.map +1 -0
- package/dist/esm/layer/marker/DefaultIcon.js +50 -0
- package/dist/esm/layer/marker/DefaultIcon.js.map +1 -0
- package/dist/esm/layer/marker/DivIcon.js +37 -0
- package/dist/esm/layer/marker/DivIcon.js.map +1 -0
- package/dist/esm/layer/marker/Icon.js +65 -0
- package/dist/esm/layer/marker/Icon.js.map +1 -0
- package/dist/esm/layer/marker/Marker.Drag.js +77 -0
- package/dist/esm/layer/marker/Marker.Drag.js.map +1 -0
- package/dist/esm/layer/marker/Marker.js +235 -0
- package/dist/esm/layer/marker/Marker.js.map +1 -0
- package/dist/esm/layer/tile/GridLayer.js +447 -0
- package/dist/esm/layer/tile/GridLayer.js.map +1 -0
- package/dist/esm/layer/tile/TileLayer.js +139 -0
- package/dist/esm/layer/tile/TileLayer.js.map +1 -0
- package/dist/esm/layer/tile/WMSTileLayer.js +68 -0
- package/dist/esm/layer/tile/WMSTileLayer.js.map +1 -0
- package/dist/esm/layer/vector/Canvas.js +292 -0
- package/dist/esm/layer/vector/Canvas.js.map +1 -0
- package/dist/esm/layer/vector/Circle.js +35 -0
- package/dist/esm/layer/vector/Circle.js.map +1 -0
- package/dist/esm/layer/vector/CircleMarker.js +69 -0
- package/dist/esm/layer/vector/CircleMarker.js.map +1 -0
- package/dist/esm/layer/vector/Path.js +68 -0
- package/dist/esm/layer/vector/Path.js.map +1 -0
- package/dist/esm/layer/vector/Polygon.js +70 -0
- package/dist/esm/layer/vector/Polygon.js.map +1 -0
- package/dist/esm/layer/vector/Polyline.js +152 -0
- package/dist/esm/layer/vector/Polyline.js.map +1 -0
- package/dist/esm/layer/vector/Rectangle.js +25 -0
- package/dist/esm/layer/vector/Rectangle.js.map +1 -0
- package/dist/esm/layer/vector/Renderer.getRenderer.js +31 -0
- package/dist/esm/layer/vector/Renderer.getRenderer.js.map +1 -0
- package/dist/esm/layer/vector/Renderer.js +39 -0
- package/dist/esm/layer/vector/Renderer.js.map +1 -0
- package/dist/esm/layer/vector/SVG.js +115 -0
- package/dist/esm/layer/vector/SVG.js.map +1 -0
- package/dist/esm/map/Map.js +844 -0
- package/dist/esm/map/Map.js.map +1 -0
- package/dist/esm/map/handler/BoxZoomHandler.js +105 -0
- package/dist/esm/map/handler/BoxZoomHandler.js.map +1 -0
- package/dist/esm/map/handler/DoubleClickZoomHandler.js +27 -0
- package/dist/esm/map/handler/DoubleClickZoomHandler.js.map +1 -0
- package/dist/esm/map/handler/DragHandler.js +133 -0
- package/dist/esm/map/handler/DragHandler.js.map +1 -0
- package/dist/esm/map/handler/KeyboardHandler.js +117 -0
- package/dist/esm/map/handler/KeyboardHandler.js.map +1 -0
- package/dist/esm/map/handler/PinchZoomHandler.js +96 -0
- package/dist/esm/map/handler/PinchZoomHandler.js.map +1 -0
- package/dist/esm/map/handler/ScrollWheelZoomHandler.js +50 -0
- package/dist/esm/map/handler/ScrollWheelZoomHandler.js.map +1 -0
- package/dist/esm/map/handler/TapHoldHandler.js +77 -0
- package/dist/esm/map/handler/TapHoldHandler.js.map +1 -0
- package/dist/esm/package.js +6 -0
- package/dist/esm/package.js.map +1 -0
- package/dist/images/layers.svg +1 -0
- package/dist/images/logo.svg +1 -0
- package/dist/images/marker-icon.svg +1 -0
- package/dist/images/marker-shadow.svg +1 -0
- package/dist/maplair-global-src.js +6810 -0
- package/dist/maplair-global-src.js.map +1 -0
- package/dist/maplair-global.js +12 -0
- package/dist/maplair-global.js.map +1 -0
- package/dist/maplair-src.js +6704 -0
- package/dist/maplair-src.js.map +1 -0
- package/dist/maplair.css +730 -0
- package/dist/maplair.js +7 -0
- package/dist/maplair.js.map +1 -0
- package/i18n/cs.json +12 -0
- package/i18n/de.json +12 -0
- package/i18n/en.json +12 -0
- package/i18n/es.json +12 -0
- package/i18n/fr.json +12 -0
- package/i18n/hu.json +12 -0
- package/i18n/it.json +12 -0
- package/i18n/rm.json +12 -0
- package/i18n/sk.json +12 -0
- package/i18n/sl.json +12 -0
- package/package.json +87 -0
- package/src/Maplair.js +24 -0
- package/src/control/AttributionControl.js +147 -0
- package/src/control/Control.js +174 -0
- package/src/control/LayersControl.js +444 -0
- package/src/control/ScaleControl.js +141 -0
- package/src/control/ZoomControl.js +147 -0
- package/src/control/index.js +5 -0
- package/src/core/Browser.js +75 -0
- package/src/core/Class.js +97 -0
- package/src/core/Events.js +334 -0
- package/src/core/Handler.js +59 -0
- package/src/core/I18n.js +76 -0
- package/src/core/Util.js +122 -0
- package/src/core/index.js +8 -0
- package/src/dom/DomEvent.DoubleTap.js +120 -0
- package/src/dom/DomEvent.PointerEvents.js +75 -0
- package/src/dom/DomEvent.js +282 -0
- package/src/dom/DomUtil.js +175 -0
- package/src/dom/Draggable.js +204 -0
- package/src/dom/PosAnimation.js +115 -0
- package/src/dom/index.js +9 -0
- package/src/geo/LatLng.js +163 -0
- package/src/geo/LatLngBounds.js +260 -0
- package/src/geo/crs/CRS.js +143 -0
- package/src/geo/crs/EPSG3395.js +19 -0
- package/src/geo/crs/EPSG3857.js +26 -0
- package/src/geo/crs/EPSG4326.js +21 -0
- package/src/geo/crs/EarthCRS.js +32 -0
- package/src/geo/crs/SimpleCRS.js +35 -0
- package/src/geo/crs/index.js +6 -0
- package/src/geo/index.js +7 -0
- package/src/geo/projection/Projection.LonLat.js +30 -0
- package/src/geo/projection/Projection.Mercator.js +53 -0
- package/src/geo/projection/Projection.SphericalMercator.js +46 -0
- package/src/geo/projection/index.js +26 -0
- package/src/geometry/Bounds.js +222 -0
- package/src/geometry/LineUtil.js +299 -0
- package/src/geometry/Point.js +239 -0
- package/src/geometry/PolyUtil.js +129 -0
- package/src/geometry/Transformation.js +67 -0
- package/src/geometry/index.js +8 -0
- package/src/images/layers.svg +1 -0
- package/src/images/logo.svg +1 -0
- package/src/images/marker-icon.svg +1 -0
- package/src/images/marker-shadow.svg +1 -0
- package/src/layer/BlanketOverlay.js +171 -0
- package/src/layer/DivOverlay.js +353 -0
- package/src/layer/FeatureGroup.js +93 -0
- package/src/layer/GeoJSON.js +432 -0
- package/src/layer/ImageOverlay.js +279 -0
- package/src/layer/Layer.js +273 -0
- package/src/layer/LayerGroup.js +129 -0
- package/src/layer/Popup.js +528 -0
- package/src/layer/SVGOverlay.js +47 -0
- package/src/layer/Tooltip.js +469 -0
- package/src/layer/VideoOverlay.js +111 -0
- package/src/layer/index.js +18 -0
- package/src/layer/marker/DefaultIcon.js +79 -0
- package/src/layer/marker/DivIcon.js +76 -0
- package/src/layer/marker/Icon.js +164 -0
- package/src/layer/marker/Marker.Drag.js +161 -0
- package/src/layer/marker/Marker.js +465 -0
- package/src/layer/marker/index.js +5 -0
- package/src/layer/tile/GridLayer.js +901 -0
- package/src/layer/tile/TileLayer.js +299 -0
- package/src/layer/tile/WMSTileLayer.js +133 -0
- package/src/layer/tile/index.js +3 -0
- package/src/layer/vector/Canvas.js +479 -0
- package/src/layer/vector/Circle.js +87 -0
- package/src/layer/vector/CircleMarker.js +110 -0
- package/src/layer/vector/Path.js +145 -0
- package/src/layer/vector/Polygon.js +160 -0
- package/src/layer/vector/Polyline.js +296 -0
- package/src/layer/vector/Rectangle.js +52 -0
- package/src/layer/vector/Renderer.getRenderer.js +48 -0
- package/src/layer/vector/Renderer.js +75 -0
- package/src/layer/vector/SVG.js +216 -0
- package/src/layer/vector/index.js +10 -0
- package/src/map/Map.js +1830 -0
- package/src/map/handler/BoxZoomHandler.js +156 -0
- package/src/map/handler/DoubleClickZoomHandler.js +62 -0
- package/src/map/handler/DragHandler.js +240 -0
- package/src/map/handler/KeyboardHandler.js +188 -0
- package/src/map/handler/PinchZoomHandler.js +157 -0
- package/src/map/handler/ScrollWheelZoomHandler.js +98 -0
- package/src/map/handler/TapHoldHandler.js +111 -0
- package/src/map/index.js +8 -0
- package/src/maplair.css +730 -0
package/i18n/cs.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"A JavaScript library for interactive maps": "Knihovna JavaScript pro interaktivní mapy",
|
|
3
|
+
"Close popup": "Zavřít vyskakovací okno",
|
|
4
|
+
"Layers": "Vrstvy",
|
|
5
|
+
"OpenStreetMap contributors": "přispěvatelé OpenStreetMap",
|
|
6
|
+
"Zoom in": "Přiblížit",
|
|
7
|
+
"Zoom out": "Oddálit",
|
|
8
|
+
"{feet} ft": "{feet} ft",
|
|
9
|
+
"{kilometers} km": "{kilometers} km",
|
|
10
|
+
"{meters} m": "{meters} m",
|
|
11
|
+
"{miles} mi": "{miles} mi"
|
|
12
|
+
}
|
package/i18n/de.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"A JavaScript library for interactive maps": "Eine JavaScript-Bibliothek für interaktive Karten",
|
|
3
|
+
"Close popup": "Popup schließen",
|
|
4
|
+
"Layers": "Ebenen",
|
|
5
|
+
"OpenStreetMap contributors": "OpenStreetMap-Mitwirkende",
|
|
6
|
+
"Zoom in": "Hineinzoomen",
|
|
7
|
+
"Zoom out": "Herauszoomen",
|
|
8
|
+
"{feet} ft": "{feet} ft",
|
|
9
|
+
"{kilometers} km": "{kilometers} km",
|
|
10
|
+
"{meters} m": "{meters} m",
|
|
11
|
+
"{miles} mi": "{miles} mi"
|
|
12
|
+
}
|
package/i18n/en.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"A JavaScript library for interactive maps": "A JavaScript library for interactive maps",
|
|
3
|
+
"Close popup": "Close popup",
|
|
4
|
+
"Layers": "Layers",
|
|
5
|
+
"OpenStreetMap contributors": "OpenStreetMap contributors",
|
|
6
|
+
"Zoom in": "Zoom in",
|
|
7
|
+
"Zoom out": "Zoom out",
|
|
8
|
+
"{feet} ft": "{feet} ft",
|
|
9
|
+
"{kilometers} km": "{kilometers} km",
|
|
10
|
+
"{meters} m": "{meters} m",
|
|
11
|
+
"{miles} mi": "{miles} mi"
|
|
12
|
+
}
|
package/i18n/es.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"A JavaScript library for interactive maps": "Una biblioteca JavaScript para mapas interactivos",
|
|
3
|
+
"Close popup": "Cerrar ventana emergente",
|
|
4
|
+
"Layers": "Capas",
|
|
5
|
+
"OpenStreetMap contributors": "colaboradores de OpenStreetMap",
|
|
6
|
+
"Zoom in": "Acercar",
|
|
7
|
+
"Zoom out": "Alejar",
|
|
8
|
+
"{feet} ft": "{feet} ft",
|
|
9
|
+
"{kilometers} km": "{kilometers} km",
|
|
10
|
+
"{meters} m": "{meters} m",
|
|
11
|
+
"{miles} mi": "{miles} mi"
|
|
12
|
+
}
|
package/i18n/fr.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"A JavaScript library for interactive maps": "Une bibliothèque JavaScript pour cartes interactives",
|
|
3
|
+
"Close popup": "Fermer la fenêtre contextuelle",
|
|
4
|
+
"Layers": "Couches",
|
|
5
|
+
"OpenStreetMap contributors": "contributeurs d’OpenStreetMap",
|
|
6
|
+
"Zoom in": "Zoom avant",
|
|
7
|
+
"Zoom out": "Zoom arrière",
|
|
8
|
+
"{feet} ft": "{feet} ft",
|
|
9
|
+
"{kilometers} km": "{kilometers} km",
|
|
10
|
+
"{meters} m": "{meters} m",
|
|
11
|
+
"{miles} mi": "{miles} mi"
|
|
12
|
+
}
|
package/i18n/hu.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"A JavaScript library for interactive maps": "JavaScript-könyvtár interaktív térképekhez",
|
|
3
|
+
"Close popup": "Felugró ablak bezárása",
|
|
4
|
+
"Layers": "Rétegek",
|
|
5
|
+
"OpenStreetMap contributors": "OpenStreetMap közreműködők",
|
|
6
|
+
"Zoom in": "Nagyítás",
|
|
7
|
+
"Zoom out": "Kicsinyítés",
|
|
8
|
+
"{feet} ft": "{feet} ft",
|
|
9
|
+
"{kilometers} km": "{kilometers} km",
|
|
10
|
+
"{meters} m": "{meters} m",
|
|
11
|
+
"{miles} mi": "{miles} mi"
|
|
12
|
+
}
|
package/i18n/it.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"A JavaScript library for interactive maps": "Una libreria JavaScript per mappe interattive",
|
|
3
|
+
"Close popup": "Chiudi popup",
|
|
4
|
+
"Layers": "Livelli",
|
|
5
|
+
"OpenStreetMap contributors": "contributori di OpenStreetMap",
|
|
6
|
+
"Zoom in": "Ingrandisci",
|
|
7
|
+
"Zoom out": "Riduci",
|
|
8
|
+
"{feet} ft": "{feet} ft",
|
|
9
|
+
"{kilometers} km": "{kilometers} km",
|
|
10
|
+
"{meters} m": "{meters} m",
|
|
11
|
+
"{miles} mi": "{miles} mi"
|
|
12
|
+
}
|
package/i18n/rm.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"A JavaScript library for interactive maps": "Ina biblioteca JavaScript per chartas interactivas",
|
|
3
|
+
"Close popup": "Serrar il popup",
|
|
4
|
+
"Layers": "Nivels",
|
|
5
|
+
"OpenStreetMap contributors": "contribuents dad OpenStreetMap",
|
|
6
|
+
"Zoom in": "Engrondir",
|
|
7
|
+
"Zoom out": "Empitschnir",
|
|
8
|
+
"{feet} ft": "{feet} ft",
|
|
9
|
+
"{kilometers} km": "{kilometers} km",
|
|
10
|
+
"{meters} m": "{meters} m",
|
|
11
|
+
"{miles} mi": "{miles} mi"
|
|
12
|
+
}
|
package/i18n/sk.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"A JavaScript library for interactive maps": "Knižnica JavaScript pre interaktívne mapy",
|
|
3
|
+
"Close popup": "Zavrieť vyskakovacie okno",
|
|
4
|
+
"Layers": "Vrstvy",
|
|
5
|
+
"OpenStreetMap contributors": "prispievatelia OpenStreetMap",
|
|
6
|
+
"Zoom in": "Priblížiť",
|
|
7
|
+
"Zoom out": "Oddialiť",
|
|
8
|
+
"{feet} ft": "{feet} ft",
|
|
9
|
+
"{kilometers} km": "{kilometers} km",
|
|
10
|
+
"{meters} m": "{meters} m",
|
|
11
|
+
"{miles} mi": "{miles} mi"
|
|
12
|
+
}
|
package/i18n/sl.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"A JavaScript library for interactive maps": "Knjižnica JavaScript za interaktivne zemljevide",
|
|
3
|
+
"Close popup": "Zapri pojavno okno",
|
|
4
|
+
"Layers": "Sloji",
|
|
5
|
+
"OpenStreetMap contributors": "sodelavci OpenStreetMap",
|
|
6
|
+
"Zoom in": "Povečaj",
|
|
7
|
+
"Zoom out": "Pomanjšaj",
|
|
8
|
+
"{feet} ft": "{feet} ft",
|
|
9
|
+
"{kilometers} km": "{kilometers} km",
|
|
10
|
+
"{meters} m": "{meters} m",
|
|
11
|
+
"{miles} mi": "{miles} mi"
|
|
12
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "maplair",
|
|
3
|
+
"version": "4.0.0-alpha.1",
|
|
4
|
+
"homepage": "https://maplair.org/",
|
|
5
|
+
"description": "JavaScript library for mobile-friendly interactive maps",
|
|
6
|
+
"author": "Volodymyr Agafonkin",
|
|
7
|
+
"contributors": [
|
|
8
|
+
"Iván Sánchez Ortega",
|
|
9
|
+
"Dave Leaver",
|
|
10
|
+
"Yohan Boniface",
|
|
11
|
+
"Jon Koops",
|
|
12
|
+
"Florian Bischof",
|
|
13
|
+
"Per Liedman",
|
|
14
|
+
"John Firebaugh",
|
|
15
|
+
"Simon Legner"
|
|
16
|
+
],
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@e18e/eslint-plugin": "^0.8.1",
|
|
19
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
20
|
+
"@vitest/browser-playwright": "5.0.3",
|
|
21
|
+
"@vitest/coverage-v8": "5.0.3",
|
|
22
|
+
"@vitest/ui": "5.0.3",
|
|
23
|
+
"eslint-plugin-baseline-js": "^0.7.5",
|
|
24
|
+
"leafdoc": "^2.4.0",
|
|
25
|
+
"playwright": "^1.64.0",
|
|
26
|
+
"prosthetic-hand": "^2.2.2",
|
|
27
|
+
"ui-event-simulator": "^2.0.0",
|
|
28
|
+
"vite-plus": "1.1.0",
|
|
29
|
+
"vitest": "5.0.3"
|
|
30
|
+
},
|
|
31
|
+
"overrides": {
|
|
32
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.1.0",
|
|
33
|
+
"vitest": "5.0.3"
|
|
34
|
+
},
|
|
35
|
+
"type": "module",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"import": "./dist/esm/Maplair.js",
|
|
39
|
+
"default": "./dist/maplair-src.js"
|
|
40
|
+
},
|
|
41
|
+
"./src/": "./src/",
|
|
42
|
+
"./styles.css": "./dist/maplair.css",
|
|
43
|
+
"./i18n/*.json": "./i18n/*.json"
|
|
44
|
+
},
|
|
45
|
+
"style": "dist/maplair.css",
|
|
46
|
+
"sideEffects": [
|
|
47
|
+
"*.css",
|
|
48
|
+
"./dist/maplair*.js",
|
|
49
|
+
"./src/core/Handler.js",
|
|
50
|
+
"./src/layer/GeoJSON.js",
|
|
51
|
+
"./src/map/Map.js",
|
|
52
|
+
"./dist/esm/core/Handler.js",
|
|
53
|
+
"./dist/esm/layer/GeoJSON.js",
|
|
54
|
+
"./dist/esm/map/Map.js"
|
|
55
|
+
],
|
|
56
|
+
"files": [
|
|
57
|
+
"dist",
|
|
58
|
+
"src",
|
|
59
|
+
"i18n",
|
|
60
|
+
"!dist/maplair.zip",
|
|
61
|
+
"!*.leafdoc",
|
|
62
|
+
"CHANGELOG.md"
|
|
63
|
+
],
|
|
64
|
+
"scripts": {
|
|
65
|
+
"debug": "vp dev",
|
|
66
|
+
"docs": "node ./build/docs.js",
|
|
67
|
+
"test": "vp test watch --project=chromium",
|
|
68
|
+
"test:ui": "vp test watch --project=chromium --ui --browser.headless=false",
|
|
69
|
+
"coverage": "vp test run --project=chromium --coverage",
|
|
70
|
+
"build": "vp pack",
|
|
71
|
+
"watch": "vp pack --watch",
|
|
72
|
+
"lint": "vp lint",
|
|
73
|
+
"lintfix": "vp lint --fix",
|
|
74
|
+
"serve": "cd docs && bundle exec jekyll serve",
|
|
75
|
+
"prepare": "vp config --no-agent",
|
|
76
|
+
"i18n": "node ./build/i18n.js"
|
|
77
|
+
},
|
|
78
|
+
"repository": {
|
|
79
|
+
"type": "git",
|
|
80
|
+
"url": "git+https://github.com/maplair/maplair.git"
|
|
81
|
+
},
|
|
82
|
+
"keywords": [
|
|
83
|
+
"gis",
|
|
84
|
+
"map"
|
|
85
|
+
],
|
|
86
|
+
"license": "BSD-2-Clause"
|
|
87
|
+
}
|
package/src/Maplair.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import pkg from '../package.json' with {type: 'json'};
|
|
2
|
+
export const version = pkg.version;
|
|
3
|
+
|
|
4
|
+
// control
|
|
5
|
+
export * from './control/index.js';
|
|
6
|
+
|
|
7
|
+
// core
|
|
8
|
+
export * from './core/index.js';
|
|
9
|
+
|
|
10
|
+
// dom
|
|
11
|
+
export * from './dom/index.js';
|
|
12
|
+
|
|
13
|
+
// geometry
|
|
14
|
+
export * from './geometry/index.js';
|
|
15
|
+
|
|
16
|
+
// geo
|
|
17
|
+
export * from './geo/index.js';
|
|
18
|
+
|
|
19
|
+
// layer
|
|
20
|
+
export * from './layer/index.js';
|
|
21
|
+
|
|
22
|
+
// map
|
|
23
|
+
export * from './map/index.js';
|
|
24
|
+
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
|
|
2
|
+
import {Control} from './Control.js';
|
|
3
|
+
import * as DomEvent from '../dom/DomEvent.js';
|
|
4
|
+
import * as DomUtil from '../dom/DomUtil.js';
|
|
5
|
+
import {I18n} from '../core/I18n.js';
|
|
6
|
+
|
|
7
|
+
const mapleLeaf = '<span aria-hidden="true" class="maplair-attribution-leaf">🍁</span>';
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* @class AttributionControl
|
|
11
|
+
* @inherits Control
|
|
12
|
+
*
|
|
13
|
+
* The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its [`attributionControl` option](#map-attributioncontrol) to `false`, and it fetches attribution texts from layers with the [`getAttribution` method](#layer-getattribution) automatically. Extends Control.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// @namespace AttributionControl
|
|
17
|
+
// @constructor AttributionControl(options: AttributionControl options)
|
|
18
|
+
// Creates an attribution control.
|
|
19
|
+
export class AttributionControl extends Control {
|
|
20
|
+
|
|
21
|
+
static {
|
|
22
|
+
// @section
|
|
23
|
+
// @aka AttributionControl options
|
|
24
|
+
this.setDefaultOptions({
|
|
25
|
+
// @option position: String = 'bottomright'
|
|
26
|
+
// The position of the control (one of the map corners). Possible values are `'topleft'`,
|
|
27
|
+
// `'topright'`, `'bottomleft'` or `'bottomright'`
|
|
28
|
+
position: 'bottomright',
|
|
29
|
+
|
|
30
|
+
// @option prefix: String|false = 'Maplair'
|
|
31
|
+
// The HTML text shown before the attributions. Pass `false` to disable.
|
|
32
|
+
prefix: null
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
constructor(options) {
|
|
37
|
+
super(options);
|
|
38
|
+
if (this.options.prefix === null) {
|
|
39
|
+
const title = I18n.translate('A JavaScript library for interactive maps');
|
|
40
|
+
this.options.prefix = `<a target="_blank" href="https://maplair.org" title="${title}">${mapleLeaf}Maplair</a>`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
this._attributions = {};
|
|
44
|
+
|
|
45
|
+
this.callInitHooks(AttributionControl);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
onAdd(map) {
|
|
49
|
+
map.attributionControl = this;
|
|
50
|
+
this._container = DomUtil.create('div', 'maplair-control-attribution');
|
|
51
|
+
DomEvent.disableClickPropagation(this._container);
|
|
52
|
+
|
|
53
|
+
// TODO ugly, refactor
|
|
54
|
+
for (const layer of Object.values(map._layers)) {
|
|
55
|
+
if (layer.getAttribution) {
|
|
56
|
+
this.addAttribution(layer.getAttribution());
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
this._update();
|
|
61
|
+
|
|
62
|
+
map.on('layeradd', this._addAttribution, this);
|
|
63
|
+
|
|
64
|
+
return this._container;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
onRemove(map) {
|
|
68
|
+
map.off('layeradd', this._addAttribution, this);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
_addAttribution(ev) {
|
|
72
|
+
if (ev.layer.getAttribution) {
|
|
73
|
+
this.addAttribution(ev.layer.getAttribution());
|
|
74
|
+
ev.layer.once('remove', () => this.removeAttribution(ev.layer.getAttribution()));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// @method setPrefix(prefix: String|false): this
|
|
79
|
+
// The HTML text shown before the attributions. Pass `false` to disable.
|
|
80
|
+
setPrefix(prefix) {
|
|
81
|
+
this.options.prefix = prefix;
|
|
82
|
+
this._update();
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// @method addAttribution(text: String): this
|
|
87
|
+
// Adds an attribution text (e.g. `'© OpenStreetMap contributors'`).
|
|
88
|
+
addAttribution(text) {
|
|
89
|
+
if (!text) { return this; }
|
|
90
|
+
|
|
91
|
+
if (!this._attributions[text]) {
|
|
92
|
+
this._attributions[text] = 0;
|
|
93
|
+
}
|
|
94
|
+
this._attributions[text]++;
|
|
95
|
+
|
|
96
|
+
this._update();
|
|
97
|
+
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// @method removeAttribution(text: String): this
|
|
102
|
+
// Removes an attribution text.
|
|
103
|
+
removeAttribution(text) {
|
|
104
|
+
if (!text) { return this; }
|
|
105
|
+
|
|
106
|
+
if (this._attributions[text]) {
|
|
107
|
+
this._attributions[text]--;
|
|
108
|
+
this._update();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
_update() {
|
|
115
|
+
if (!this._map) { return; }
|
|
116
|
+
|
|
117
|
+
const attribs = Object.keys(this._attributions).filter(i => this._attributions[i]);
|
|
118
|
+
|
|
119
|
+
const prefixAndAttribs = [];
|
|
120
|
+
|
|
121
|
+
if (this.options.prefix) {
|
|
122
|
+
prefixAndAttribs.push(this.options.prefix);
|
|
123
|
+
}
|
|
124
|
+
if (attribs.length) {
|
|
125
|
+
prefixAndAttribs.push(attribs.join(', '));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
this._container.innerHTML = prefixAndAttribs.join(' <span aria-hidden="true">|</span> ');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Registers this default feature on the map class, called by `MaplairMap` itself.
|
|
132
|
+
static register(MaplairMap) {
|
|
133
|
+
// @namespace MaplairMap
|
|
134
|
+
// @section Control options
|
|
135
|
+
// @option attributionControl: Boolean = true
|
|
136
|
+
// Whether a [attribution control](#control-attribution) is added to the map by default.
|
|
137
|
+
MaplairMap.mergeOptions({
|
|
138
|
+
attributionControl: true
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
MaplairMap.addInitHook(function () {
|
|
142
|
+
if (this.options.attributionControl) {
|
|
143
|
+
new AttributionControl().addTo(this);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
|
|
2
|
+
import {Class} from '../core/Class.js';
|
|
3
|
+
import * as Util from '../core/Util.js';
|
|
4
|
+
import * as DomUtil from '../dom/DomUtil.js';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* @class Control
|
|
8
|
+
* @inherits Class
|
|
9
|
+
*
|
|
10
|
+
* Control is a base class for implementing map controls. Handles positioning.
|
|
11
|
+
* All other controls extend from this class.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export class Control extends Class {
|
|
15
|
+
|
|
16
|
+
static {
|
|
17
|
+
// @section
|
|
18
|
+
// @aka Control Options
|
|
19
|
+
this.setDefaultOptions({
|
|
20
|
+
// @option position: String = 'topright'
|
|
21
|
+
// The position of the control (one of the map corners). Possible values are `'topleft'`,
|
|
22
|
+
// `'topright'`, `'bottomleft'` or `'bottomright'`
|
|
23
|
+
position: 'topright'
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
constructor(options) {
|
|
28
|
+
super();
|
|
29
|
+
Util.setOptions(this, options);
|
|
30
|
+
|
|
31
|
+
this.callInitHooks(Control);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* @section
|
|
35
|
+
* Classes extending Control will inherit the following methods:
|
|
36
|
+
*
|
|
37
|
+
* @method getPosition: string
|
|
38
|
+
* Returns the position of the control.
|
|
39
|
+
*/
|
|
40
|
+
getPosition() {
|
|
41
|
+
return this.options.position;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// @method setPosition(position: string): this
|
|
45
|
+
// Sets the position of the control.
|
|
46
|
+
setPosition(position) {
|
|
47
|
+
const map = this._map;
|
|
48
|
+
|
|
49
|
+
map?.removeControl(this);
|
|
50
|
+
|
|
51
|
+
this.options.position = position;
|
|
52
|
+
|
|
53
|
+
map?.addControl(this);
|
|
54
|
+
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// @method getContainer: HTMLElement
|
|
59
|
+
// Returns the HTMLElement that contains the control.
|
|
60
|
+
getContainer() {
|
|
61
|
+
return this._container;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// @method addTo(map: MaplairMap): this
|
|
65
|
+
// Adds the control to the given map.
|
|
66
|
+
addTo(map) {
|
|
67
|
+
this.remove();
|
|
68
|
+
this._map = map;
|
|
69
|
+
|
|
70
|
+
const container = this._container = this.onAdd(map),
|
|
71
|
+
pos = this.getPosition(),
|
|
72
|
+
corner = map._controlCorners[pos];
|
|
73
|
+
|
|
74
|
+
container.classList.add('maplair-control');
|
|
75
|
+
|
|
76
|
+
if (pos.includes('bottom')) {
|
|
77
|
+
corner.insertBefore(container, corner.firstChild);
|
|
78
|
+
} else {
|
|
79
|
+
corner.appendChild(container);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
this._map.on('unload', this.remove, this);
|
|
83
|
+
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// @method remove: this
|
|
88
|
+
// Removes the control from the map it is currently active on.
|
|
89
|
+
remove() {
|
|
90
|
+
if (!this._map) {
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
this._container.remove();
|
|
95
|
+
|
|
96
|
+
if (this.onRemove) {
|
|
97
|
+
this.onRemove(this._map);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
this._map.off('unload', this.remove, this);
|
|
101
|
+
this._map = null;
|
|
102
|
+
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
_refocusOnMap(e) {
|
|
107
|
+
// We exclude keyboard-click event to keep the focus on the control for accessibility.
|
|
108
|
+
// The position of keyboard-click events are x=0 and y=0.
|
|
109
|
+
if (this._map && e && !(e.screenX === 0 && e.screenY === 0)) {
|
|
110
|
+
this._map.getContainer().focus();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Registers this default feature on the map class, called by `MaplairMap` itself.
|
|
115
|
+
static register(MaplairMap) {
|
|
116
|
+
/* @namespace MaplairMap
|
|
117
|
+
* @section Methods for Layers and Controls
|
|
118
|
+
*/
|
|
119
|
+
MaplairMap.include({
|
|
120
|
+
// @method addControl(control: Control): this
|
|
121
|
+
// Adds the given control to the map
|
|
122
|
+
addControl(control) {
|
|
123
|
+
control.addTo(this);
|
|
124
|
+
return this;
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
// @method removeControl(control: Control): this
|
|
128
|
+
// Removes the given control from the map
|
|
129
|
+
removeControl(control) {
|
|
130
|
+
control.remove();
|
|
131
|
+
return this;
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
_initControlPos() {
|
|
135
|
+
const corners = this._controlCorners = {},
|
|
136
|
+
l = 'maplair-',
|
|
137
|
+
container = this._controlContainer = DomUtil.create('div', `${l}control-container`, this._container);
|
|
138
|
+
|
|
139
|
+
function createCorner(vSide, hSide) {
|
|
140
|
+
const className = `${l + vSide} ${l}${hSide}`;
|
|
141
|
+
|
|
142
|
+
corners[vSide + hSide] = DomUtil.create('div', className, container);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
createCorner('top', 'left');
|
|
146
|
+
createCorner('top', 'right');
|
|
147
|
+
createCorner('bottom', 'left');
|
|
148
|
+
createCorner('bottom', 'right');
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
_clearControlPos() {
|
|
152
|
+
for (const c of Object.values(this._controlCorners)) {
|
|
153
|
+
c.remove();
|
|
154
|
+
}
|
|
155
|
+
this._controlContainer.remove();
|
|
156
|
+
delete this._controlCorners;
|
|
157
|
+
delete this._controlContainer;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* @namespace Control
|
|
164
|
+
* @section Extension methods
|
|
165
|
+
* @uninheritable
|
|
166
|
+
*
|
|
167
|
+
* Every control should extend from `Control` and (re-)implement the following methods.
|
|
168
|
+
*
|
|
169
|
+
* @method onAdd(map: MaplairMap): HTMLElement
|
|
170
|
+
* Should return the container DOM element for the control and add listeners on relevant map events. Called on [`control.addTo(map)`](#control-addTo).
|
|
171
|
+
*
|
|
172
|
+
* @method onRemove(map: MaplairMap)
|
|
173
|
+
* Optional method. Should contain all clean up code that removes the listeners previously added in [`onAdd`](#control-onadd). Called on [`control.remove()`](#control-remove).
|
|
174
|
+
*/
|