maplair 4.1.0 → 4.3.0

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 (213) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/dist/esm/Maplair.js +5 -4
  3. package/dist/esm/Maplair.js.map +1 -1
  4. package/dist/esm/_virtual/_rolldown/runtime.js +1 -2
  5. package/dist/esm/control/AttributionControl.js +1 -2
  6. package/dist/esm/control/ButtonControl.js +1 -2
  7. package/dist/esm/control/ContextMenu.js +1 -2
  8. package/dist/esm/control/Control.js +1 -2
  9. package/dist/esm/control/FullscreenControl.js +1 -2
  10. package/dist/esm/control/LayersControl.js +27 -31
  11. package/dist/esm/control/LayersControl.js.map +1 -1
  12. package/dist/esm/control/LegendControl.js +1 -2
  13. package/dist/esm/control/MiniMapControl.js +1 -2
  14. package/dist/esm/control/RotateControl.js +1 -2
  15. package/dist/esm/control/ScaleControl.js +1 -2
  16. package/dist/esm/control/SearchControl.js +1 -2
  17. package/dist/esm/control/SideBySideControl.js +1 -2
  18. package/dist/esm/control/TextControl.js +1 -2
  19. package/dist/esm/control/TimeControl.js +1 -2
  20. package/dist/esm/control/ZoomControl.js +18 -29
  21. package/dist/esm/control/ZoomControl.js.map +1 -1
  22. package/dist/esm/core/Class.js +2 -9
  23. package/dist/esm/core/Class.js.map +1 -1
  24. package/dist/esm/core/Events.js +2 -2
  25. package/dist/esm/core/Events.js.map +1 -1
  26. package/dist/esm/core/Handler.js +10 -3
  27. package/dist/esm/core/Handler.js.map +1 -1
  28. package/dist/esm/core/I18n.js +1 -2
  29. package/dist/esm/core/Util.js +2 -3
  30. package/dist/esm/core/Util.js.map +1 -1
  31. package/dist/esm/dom/DomEvent.DoubleTap.js +1 -2
  32. package/dist/esm/dom/DomEvent.PointerEvents.js +1 -2
  33. package/dist/esm/dom/DomEvent.js +10 -18
  34. package/dist/esm/dom/DomEvent.js.map +1 -1
  35. package/dist/esm/dom/DomUtil.js +1 -2
  36. package/dist/esm/dom/Draggable.js +4 -3
  37. package/dist/esm/dom/Draggable.js.map +1 -1
  38. package/dist/esm/dom/PosAnimation.js +1 -2
  39. package/dist/esm/geo/LatLng.js +1 -2
  40. package/dist/esm/geo/LatLngBounds.js +9 -15
  41. package/dist/esm/geo/LatLngBounds.js.map +1 -1
  42. package/dist/esm/geo/crs/CRS.js +1 -2
  43. package/dist/esm/geo/crs/EPSG3395.js +4 -5
  44. package/dist/esm/geo/crs/EPSG3395.js.map +1 -1
  45. package/dist/esm/geo/crs/EPSG3857.js +4 -5
  46. package/dist/esm/geo/crs/EPSG3857.js.map +1 -1
  47. package/dist/esm/geo/crs/EPSG4326.js +3 -4
  48. package/dist/esm/geo/crs/EPSG4326.js.map +1 -1
  49. package/dist/esm/geo/crs/EarthCRS.js +1 -2
  50. package/dist/esm/geo/crs/SimpleCRS.js +3 -4
  51. package/dist/esm/geo/crs/SimpleCRS.js.map +1 -1
  52. package/dist/esm/geo/projection/{Projection.LonLat.js → LonLatProjection.js} +4 -5
  53. package/dist/esm/geo/projection/LonLatProjection.js.map +1 -0
  54. package/dist/esm/geo/projection/{Projection.Mercator.js → MercatorProjection.js} +3 -4
  55. package/dist/esm/geo/projection/MercatorProjection.js.map +1 -0
  56. package/dist/esm/geo/projection/{Projection.SphericalMercator.js → SphericalMercatorProjection.js} +4 -5
  57. package/dist/esm/geo/projection/SphericalMercatorProjection.js.map +1 -0
  58. package/dist/esm/geometry/Bounds.js +10 -14
  59. package/dist/esm/geometry/Bounds.js.map +1 -1
  60. package/dist/esm/geometry/LineUtil.js +2 -3
  61. package/dist/esm/geometry/LineUtil.js.map +1 -1
  62. package/dist/esm/geometry/Point.js +1 -2
  63. package/dist/esm/geometry/PolyUtil.js +17 -25
  64. package/dist/esm/geometry/PolyUtil.js.map +1 -1
  65. package/dist/esm/geometry/Transformation.js +1 -2
  66. package/dist/esm/layer/BlanketOverlay.js +1 -2
  67. package/dist/esm/layer/Classification.js +1 -2
  68. package/dist/esm/layer/DivOverlay.js +2 -3
  69. package/dist/esm/layer/DivOverlay.js.map +1 -1
  70. package/dist/esm/layer/FeatureGroup.js +5 -4
  71. package/dist/esm/layer/FeatureGroup.js.map +1 -1
  72. package/dist/esm/layer/GeoJSON.Load.js +1 -2
  73. package/dist/esm/layer/GeoJSON.js +8 -10
  74. package/dist/esm/layer/GeoJSON.js.map +1 -1
  75. package/dist/esm/layer/GeoJSONUtil.js +1 -2
  76. package/dist/esm/layer/HeatLayer.js +2 -3
  77. package/dist/esm/layer/HeatLayer.js.map +1 -1
  78. package/dist/esm/layer/ImageOverlay.js +2 -3
  79. package/dist/esm/layer/ImageOverlay.js.map +1 -1
  80. package/dist/esm/layer/Layer.js +1 -2
  81. package/dist/esm/layer/LayerGroup.js +2 -3
  82. package/dist/esm/layer/LayerGroup.js.map +1 -1
  83. package/dist/esm/layer/Popup.js +9 -16
  84. package/dist/esm/layer/Popup.js.map +1 -1
  85. package/dist/esm/layer/SVGOverlay.js +1 -2
  86. package/dist/esm/layer/Tooltip.js +16 -17
  87. package/dist/esm/layer/Tooltip.js.map +1 -1
  88. package/dist/esm/layer/VideoOverlay.js +1 -2
  89. package/dist/esm/layer/marker/DefaultIcon.js +29 -7
  90. package/dist/esm/layer/marker/DefaultIcon.js.map +1 -1
  91. package/dist/esm/layer/marker/DivIcon.js +1 -2
  92. package/dist/esm/layer/marker/Icon.js +2 -2
  93. package/dist/esm/layer/marker/Icon.js.map +1 -1
  94. package/dist/esm/layer/marker/Marker.Drag.js +43 -4
  95. package/dist/esm/layer/marker/Marker.Drag.js.map +1 -1
  96. package/dist/esm/layer/marker/Marker.Move.js +4 -6
  97. package/dist/esm/layer/marker/Marker.Move.js.map +1 -1
  98. package/dist/esm/layer/marker/Marker.js +54 -14
  99. package/dist/esm/layer/marker/Marker.js.map +1 -1
  100. package/dist/esm/layer/marker/MarkerClusterGroup.js +1 -2
  101. package/dist/esm/layer/marker/SvgIcon.js +1 -2
  102. package/dist/esm/layer/tile/GridLayer.js +4 -4
  103. package/dist/esm/layer/tile/GridLayer.js.map +1 -1
  104. package/dist/esm/layer/tile/TileLayer.js +8 -8
  105. package/dist/esm/layer/tile/TileLayer.js.map +1 -1
  106. package/dist/esm/layer/tile/WMSTileLayer.js +5 -4
  107. package/dist/esm/layer/tile/WMSTileLayer.js.map +1 -1
  108. package/dist/esm/layer/vector/Canvas.js +7 -14
  109. package/dist/esm/layer/vector/Canvas.js.map +1 -1
  110. package/dist/esm/layer/vector/Circle.js +5 -3
  111. package/dist/esm/layer/vector/Circle.js.map +1 -1
  112. package/dist/esm/layer/vector/CircleMarker.js +2 -3
  113. package/dist/esm/layer/vector/CircleMarker.js.map +1 -1
  114. package/dist/esm/layer/vector/Path.DashAnimation.js +1 -2
  115. package/dist/esm/layer/vector/Path.ZoomStyles.js +1 -2
  116. package/dist/esm/layer/vector/Path.js +1 -2
  117. package/dist/esm/layer/vector/Polygon.js +2 -3
  118. package/dist/esm/layer/vector/Polygon.js.map +1 -1
  119. package/dist/esm/layer/vector/Polyline.Decorations.js +1 -2
  120. package/dist/esm/layer/vector/Polyline.js +2 -3
  121. package/dist/esm/layer/vector/Polyline.js.map +1 -1
  122. package/dist/esm/layer/vector/Rectangle.js +1 -2
  123. package/dist/esm/layer/vector/Renderer.getRenderer.js +4 -5
  124. package/dist/esm/layer/vector/Renderer.getRenderer.js.map +1 -1
  125. package/dist/esm/layer/vector/Renderer.js +1 -2
  126. package/dist/esm/layer/vector/SVG.js +7 -4
  127. package/dist/esm/layer/vector/SVG.js.map +1 -1
  128. package/dist/esm/map/Hash.js +1 -2
  129. package/dist/esm/map/Map.Rotation.js +31 -16
  130. package/dist/esm/map/Map.Rotation.js.map +1 -1
  131. package/dist/esm/map/Map.js +10 -17
  132. package/dist/esm/map/Map.js.map +1 -1
  133. package/dist/esm/map/MapSync.js +1 -2
  134. package/dist/esm/map/handler/BoxZoomHandler.js +20 -40
  135. package/dist/esm/map/handler/BoxZoomHandler.js.map +1 -1
  136. package/dist/esm/map/handler/DisplaceHandler.js +1 -2
  137. package/dist/esm/map/handler/DoubleClickZoomHandler.js +1 -2
  138. package/dist/esm/map/handler/DragHandler.js +1 -2
  139. package/dist/esm/map/handler/KeyboardHandler.js +23 -43
  140. package/dist/esm/map/handler/KeyboardHandler.js.map +1 -1
  141. package/dist/esm/map/handler/PinchZoomHandler.js +1 -2
  142. package/dist/esm/map/handler/ScrollWheelZoomHandler.js +1 -2
  143. package/dist/esm/map/handler/TapDragZoomHandler.js +1 -2
  144. package/dist/esm/map/handler/TapHoldHandler.js +1 -2
  145. package/dist/esm/package.js +2 -3
  146. package/dist/maplair-global-src.js +489 -613
  147. package/dist/maplair-global-src.js.map +1 -1
  148. package/dist/maplair-global.js +2 -2
  149. package/dist/maplair-global.js.map +1 -1
  150. package/dist/maplair-src.js +485 -609
  151. package/dist/maplair-src.js.map +1 -1
  152. package/dist/maplair.css +1 -1263
  153. package/dist/maplair.js +2 -2
  154. package/dist/maplair.js.map +1 -1
  155. package/package.json +4 -8
  156. package/src/Maplair.all.js +0 -1
  157. package/src/control/LayersControl.js +39 -52
  158. package/src/control/ZoomControl.js +17 -31
  159. package/src/core/Class.js +5 -14
  160. package/src/core/Events.js +2 -0
  161. package/src/core/Handler.js +11 -1
  162. package/src/core/Util.js +1 -1
  163. package/src/dom/DomEvent.js +9 -19
  164. package/src/dom/Draggable.js +5 -1
  165. package/src/geo/LatLngBounds.js +8 -15
  166. package/src/geo/crs/EPSG3395.js +3 -3
  167. package/src/geo/crs/EPSG3857.js +3 -3
  168. package/src/geo/crs/EPSG4326.js +2 -2
  169. package/src/geo/crs/SimpleCRS.js +2 -2
  170. package/src/geo/index.js +1 -2
  171. package/src/geo/projection/{Projection.LonLat.js → LonLatProjection.js} +1 -1
  172. package/src/geo/projection/{Projection.Mercator.js → MercatorProjection.js} +1 -1
  173. package/src/geo/projection/{Projection.SphericalMercator.js → SphericalMercatorProjection.js} +1 -1
  174. package/src/geo/projection/index.js +5 -5
  175. package/src/geometry/Bounds.js +12 -17
  176. package/src/geometry/LineUtil.js +1 -1
  177. package/src/geometry/PolyUtil.js +23 -31
  178. package/src/layer/DivOverlay.js +1 -1
  179. package/src/layer/FeatureGroup.js +8 -2
  180. package/src/layer/GeoJSON.js +10 -13
  181. package/src/layer/HeatLayer.js +1 -1
  182. package/src/layer/ImageOverlay.js +2 -2
  183. package/src/layer/LayerGroup.js +1 -1
  184. package/src/layer/Popup.js +9 -19
  185. package/src/layer/Tooltip.js +19 -17
  186. package/src/layer/marker/DefaultIcon.js +33 -5
  187. package/src/layer/marker/Icon.js +2 -0
  188. package/src/layer/marker/Marker.Drag.js +53 -5
  189. package/src/layer/marker/Marker.Move.js +3 -4
  190. package/src/layer/marker/Marker.js +64 -13
  191. package/src/layer/tile/GridLayer.js +5 -2
  192. package/src/layer/tile/TileLayer.js +9 -6
  193. package/src/layer/tile/WMSTileLayer.js +5 -2
  194. package/src/layer/vector/Canvas.js +10 -14
  195. package/src/layer/vector/Circle.js +7 -1
  196. package/src/layer/vector/CircleMarker.js +2 -1
  197. package/src/layer/vector/Polygon.js +1 -1
  198. package/src/layer/vector/Polyline.js +1 -1
  199. package/src/layer/vector/Renderer.getRenderer.js +4 -3
  200. package/src/layer/vector/SVG.js +12 -2
  201. package/src/map/Map.Rotation.js +28 -4
  202. package/src/map/Map.js +17 -21
  203. package/src/map/handler/BoxZoomHandler.js +21 -42
  204. package/src/map/handler/KeyboardHandler.js +34 -53
  205. package/src/maplair.css +5 -0
  206. package/dist/esm/geo/projection/Projection.LonLat.js.map +0 -1
  207. package/dist/esm/geo/projection/Projection.Mercator.js.map +0 -1
  208. package/dist/esm/geo/projection/Projection.SphericalMercator.js.map +0 -1
  209. package/dist/esm/geo/projection/index.js +0 -14
  210. package/dist/esm/geo/projection/index.js.map +0 -1
  211. package/dist/esm/layer/marker/Marker.Rotation.js +0 -70
  212. package/dist/esm/layer/marker/Marker.Rotation.js.map +0 -1
  213. package/src/layer/marker/Marker.Rotation.js +0 -103
package/CHANGELOG.md CHANGED
@@ -3,6 +3,83 @@ Maplair Changelog
3
3
 
4
4
  (all changes of Leaflet without author notice are by [@mourner](https://github.com/mourner))
5
5
 
6
+ ## 4.3.0 (2026-11-02)
7
+
8
+ ### Leaflet, since 4.2.0
9
+
10
+ Ported from Leaflet (changes without author notice are by [@mourner](https://github.com/mourner))
11
+
12
+ #### ❇️ New Features
13
+
14
+ * Aliases for an easier migration from Leaflet 1: propagated events carry the target as `layer` (the 1.x name of `propagatedFrom`), `new Circle(latlng, radius)` throws pointing to the `radius` option, `maplair/dist/maplair.css` is exported in https://github.com/Leaflet/Leaflet/commit/6c769f974dd9cbc2319763c87aa2293ec739454a
15
+
16
+ #### 📝 Docs
17
+
18
+ * Polish the tutorials: example frames filling the page width, a complete page and a bundler setup in the quick start, the class tutorial, outdated links and names, a hosted image in the overlays tutorial in https://github.com/Leaflet/Leaflet/commit/6d1f3f9b1f3c3d5586d737d3aaadea0c0ef95e5c, https://github.com/Leaflet/Leaflet/commit/44bc6cddf272aa7c29f5918c0fafdb2b8fe75a4e and https://github.com/Leaflet/Leaflet/commit/92e0bb50e4751536d2b6e022ff81a0976feecc9a
19
+ * Update the tile providers, tools and links in the FAQ in https://github.com/Leaflet/Leaflet/commit/a904a6d02f19d87aaea5a29288f83a65200291fd and https://github.com/Leaflet/Leaflet/commit/c7c073f62cbce65ec364557b44148accad1670f5
20
+ * Update the links and the publishing advice in the plugin guide in https://github.com/Leaflet/Leaflet/commit/381883ce944e6085caef5573954336ce9e3917b1
21
+ * Add location-picker to the plugins list by [@cyphercodes](https://github.com/cyphercodes) in https://github.com/Leaflet/Leaflet/pull/10514
22
+
23
+ ## 4.2.0 (2026-10-31)
24
+
25
+ ⚠️ Despite the minor version, this release contains breaking changes ported from Leaflet, see the refactorings below; e.g. the optional module `maplair/marker-rotation` is replaced by the Marker option `rotation`.
26
+
27
+ ### Leaflet, since 4.1.0
28
+
29
+ Ported from Leaflet (changes without author notice are by [@mourner](https://github.com/mourner))
30
+
31
+ #### ❇️ New Features
32
+
33
+ * DefaultIcon: the option `color` paints the (maple leaf) pin in any CSS color in https://github.com/Leaflet/Leaflet/pull/10489
34
+ * Move focused draggable markers with the arrow keys, by 10 pixels or 30 with Shift, by [@Enfiladeguide](https://github.com/Enfiladeguide) in https://github.com/Leaflet/Leaflet/pull/10513
35
+
36
+ #### ✨ Refactorings (⚠️ Breaking Changes)
37
+
38
+ * Replace the `Projection` namespace with `LonLatProjection`, `MercatorProjection` and `SphericalMercatorProjection` in https://github.com/Leaflet/Leaflet/commit/98dd20eef949b238c7cef74fba5716a18b912fa9
39
+ * `DomEvent` functions no longer return the module for chaining in https://github.com/Leaflet/Leaflet/commit/6806a7b39e730a30fc46f20734f463cf848d68aa
40
+ * GeoJSON passes the feature (not a bare geometry) to `filter` and `onEachFeature`; LayersControl `collapse()` takes no event; Handler has empty default `addHooks()` and `removeHooks()` in https://github.com/Leaflet/Leaflet/commit/1dc1b4ea0ffd779e15f8a5aeeb27dd15e597cd1f and https://github.com/Leaflet/Leaflet/commit/f9b31ae1e89c5f80bfecc862753873b5b72736eb
41
+
42
+ * Marker: the option `rotation` (in degrees, `null` for none) with `setRotation()` and `getRotation()` rotates the icon around its anchor, rotates the popup and tooltip anchors and hides the shadow; it replaces the optional module `maplair/marker-rotation` with `rotationAngle`, `rotationOrigin`, `setRotationAngle()` and `setRotationOrigin()`, `rotateWithView` is part of `maplair/map-rotation`, in https://github.com/Leaflet/Leaflet/pull/10489
43
+ * `latLngToLayerPoint()` and `latLngToContainerPoint()` keep subpixel precision instead of rounding, so polylines and polygons don't zigzag along whole pixels, in https://github.com/Leaflet/Leaflet/pull/10494
44
+ * Various small cleanups, e.g. KeyboardHandler reads `keyboardPanDelta` and `zoomDelta` on each key, Canvas draws ellipses with `ellipse()`, in https://github.com/Leaflet/Leaflet/pull/10490
45
+ * Only stop the propagation of clicks opening a popup in https://github.com/Leaflet/Leaflet/commit/{prop}
46
+
47
+ #### 🐞 Bugfixes
48
+
49
+ * Fix Popup `maxHeight` not scrolling or resizing with the content by [@nk-batman21](https://github.com/nk-batman21) in https://github.com/Leaflet/Leaflet/pull/10487
50
+ * Fix invalid WMSTileLayer URLs after changing the WMS version by [@osiandhammaloka](https://github.com/osiandhammaloka) in https://github.com/Leaflet/Leaflet/pull/10482
51
+ * Fix focusing a marker whose icon has an `'auto'` size by [@A350xt](https://github.com/A350xt) in https://github.com/Leaflet/Leaflet/pull/10375, and auto-sized marker icons stretching to the full map width in https://github.com/Leaflet/Leaflet/commit/779c7fd5492d36b7738e8bd2b8cdac804754c41d
52
+ * Respect layers added or removed by LayersControl event handlers by [@A350xt](https://github.com/A350xt) in https://github.com/Leaflet/Leaflet/pull/10374
53
+ * Fix Circle `getBounds()` throwing when not added to a map (with [@Schleuse](https://github.com/Schleuse)) in https://github.com/Leaflet/Leaflet/commit/4c7958990cfe586dfc05eede518694b81fe9f32c
54
+ * Fix FeatureGroup `getBounds()` throwing for layers without a position, include nested layer groups (with [@rafaelgallani](https://github.com/rafaelgallani)) in https://github.com/Leaflet/Leaflet/commit/ee37d374222822139af43580906a966186bccebf
55
+ * Fix an error when removing the map or a GridLayer on tile load (with [@pierreeurope](https://github.com/pierreeurope)) in https://github.com/Leaflet/Leaflet/commit/62c5f52791c5055ef4c94e508525b554ab158d15
56
+ * Fix an error with empty `subdomains` in https://github.com/Leaflet/Leaflet/commit/{sub}
57
+ * Switch the tooltip handlers when rebinding a tooltip with different options, open it on focus after the layer is added again, don't fire `tileerror` for tiles pruned with `errorTileUrl` in https://github.com/Leaflet/Leaflet/pull/10490
58
+ * Fix the map drifting under the cursor on zoom in https://github.com/Leaflet/Leaflet/commit/{drift}
59
+ * Close popups on Escape more reliably, e.g. with the focus on a marker in https://github.com/Leaflet/Leaflet/commit/{esc}
60
+ * Isolate the stacking context of the map container in https://github.com/Leaflet/Leaflet/commit/{iso}
61
+ * Accept marker icons without `createShadow()` in https://github.com/Leaflet/Leaflet/pull/10489
62
+ * Make Draggable work outside a map in https://github.com/Leaflet/Leaflet/commit/2e770eb84bafca2368eef611922497cd0b3a81de
63
+ * LayersControl stops listening to map clicks when removed, TileLayer halves a `Point` tileSize with `detectRetina`, `isLoading()` returns a boolean in https://github.com/Leaflet/Leaflet/commit/1dc1b4ea0ffd779e15f8a5aeeb27dd15e597cd1f
64
+ * Tolerate `getRenderer()` for layers without a renderer, e.g. of Leaflet.markercluster, in https://github.com/Leaflet/Leaflet/issues/10515
65
+ * LayerGroup ignores an unknown layer id in `removeLayer()`, Bounds `contains()` accepts a point literal, `LineUtil._projectRing()` handles deeper nested latlngs in https://github.com/Leaflet/Leaflet/commit/4ab4c3a966cfd04e22d330546a357cbdbd15ab09, https://github.com/Leaflet/Leaflet/commit/a54d6d7f954374df5a3486a9e26ca2a60cc01b05 and https://github.com/Leaflet/Leaflet/commit/ac22233103a4fd3351ed82f0e99a8c6b9dfdcc80
66
+ * Simplify and speed up polygon clipping in https://github.com/Leaflet/Leaflet/commit/2c5d1f038fb8d065b18312b2d653fc5e64ce2af0
67
+
68
+ #### 📝 Docs
69
+
70
+ * Fix doc typos and outdated links (with [@Kumar007-7](https://github.com/Kumar007-7)) in https://github.com/Leaflet/Leaflet/commit/ff2715f95cd8542eaf8706b9459620bedb3baec7
71
+ * Use viewport units in the mobile example by [@pierreeurope](https://github.com/pierreeurope) in https://github.com/Leaflet/Leaflet/pull/10120
72
+ * Fix a few stale things in the plugin guide in https://github.com/Leaflet/Leaflet/commit/{guide}
73
+
74
+ #### 🔧 Workflow
75
+
76
+ * Minify `maplair.css` with lightningcss in https://github.com/Leaflet/Leaflet/pull/10493
77
+ * Reduce Dependabot noise with a better config in https://github.com/Leaflet/Leaflet/commit/{dep}
78
+
79
+ #### 🧪 Tests
80
+
81
+ * Fix test flakiness on slow runners in https://github.com/Leaflet/Leaflet/commit/{flaky}
82
+
6
83
  ## 4.1.0 (2026-10-28)
7
84
 
8
85
  ⚠️ Despite the minor version, this release contains breaking changes ported from Leaflet, see the refactorings below.
@@ -25,6 +25,7 @@ import { CircleMarker } from "./layer/vector/CircleMarker.js";
25
25
  import { LegendControl } from "./control/LegendControl.js";
26
26
  import { CRS } from "./geo/crs/CRS.js";
27
27
  import { EarthCRS } from "./geo/crs/EarthCRS.js";
28
+ import { SphericalMercatorProjection } from "./geo/projection/SphericalMercatorProjection.js";
28
29
  import { Transformation } from "./geometry/Transformation.js";
29
30
  import { EPSG3857, EPSG900913 } from "./geo/crs/EPSG3857.js";
30
31
  import { ZoomControl } from "./control/ZoomControl.js";
@@ -56,7 +57,8 @@ import { SearchControl } from "./control/SearchControl.js";
56
57
  import { SideBySideControl } from "./control/SideBySideControl.js";
57
58
  import { TextControl } from "./control/TextControl.js";
58
59
  import { TimeControl } from "./control/TimeControl.js";
59
- import { projection_exports } from "./geo/projection/index.js";
60
+ import { LonLatProjection } from "./geo/projection/LonLatProjection.js";
61
+ import { MercatorProjection } from "./geo/projection/MercatorProjection.js";
60
62
  import { EPSG3395 } from "./geo/crs/EPSG3395.js";
61
63
  import { EPSG4326 } from "./geo/crs/EPSG4326.js";
62
64
  import { SimpleCRS } from "./geo/crs/SimpleCRS.js";
@@ -78,13 +80,12 @@ import { Rectangle } from "./layer/vector/Rectangle.js";
78
80
  import { Hash } from "./map/Hash.js";
79
81
  import { MapSync } from "./map/MapSync.js";
80
82
  import { DisplaceHandler, displace } from "./map/handler/DisplaceHandler.js";
81
- //#region src/Maplair.js
83
+ // src/Maplair.js
82
84
  /**
83
85
  * A constant that represents the Maplair version in use.
84
86
  * @type {string}
85
87
  */
86
88
  const version = version$1;
87
- //#endregion
88
- export { AttributionControl, BlanketOverlay, Bounds, BoxZoomHandler, ButtonBarControl, ButtonControl, CRS, Canvas, Circle, CircleMarker, Class, Classification, ContextMenu, Control, DefaultIcon, DisplaceHandler, DivIcon, DivOverlay, DomEvent_exports as DomEvent, DomUtil_exports as DomUtil, DoubleClickZoomHandler, DragHandler, Draggable, EPSG3395, EPSG3857, EPSG4326, EPSG900913, EarthCRS, Evented, FeatureGroup, FullscreenControl, GeoJSON, GridLayer, Handler, Hash, HeatLayer, I18n, Icon, ImageOverlay, KeyboardHandler, LatLng, LatLngBounds, Layer, LayerGroup, LayersControl, MaplairMap as LeafletMap, LegendControl, LineUtil_exports as LineUtil, MaplairMap as Map, MapSync, MaplairMap, Marker, MarkerClusterGroup, MiniMapControl, Path, PinchZoomHandler, Point, PolyUtil_exports as PolyUtil, Polygon, Polyline, Popup, projection_exports as Projection, Rectangle, Renderer, SVG, SVGOverlay, ScaleControl, ScrollWheelZoomHandler, SearchControl, SideBySideControl, SimpleCRS, SvgIcon, TapDragZoomHandler, TapHoldHandler, TextControl, TileLayer, TimeControl, Tooltip, Transformation, Util_exports as Util, VideoOverlay, WMSTileLayer, ZoomControl, displace, version };
89
+ export { AttributionControl, BlanketOverlay, Bounds, BoxZoomHandler, ButtonBarControl, ButtonControl, CRS, Canvas, Circle, CircleMarker, Class, Classification, ContextMenu, Control, DefaultIcon, DisplaceHandler, DivIcon, DivOverlay, DomEvent_exports as DomEvent, DomUtil_exports as DomUtil, DoubleClickZoomHandler, DragHandler, Draggable, EPSG3395, EPSG3857, EPSG4326, EPSG900913, EarthCRS, Evented, FeatureGroup, FullscreenControl, GeoJSON, GridLayer, Handler, Hash, HeatLayer, I18n, Icon, ImageOverlay, KeyboardHandler, LatLng, LatLngBounds, Layer, LayerGroup, LayersControl, MaplairMap as LeafletMap, LegendControl, LineUtil_exports as LineUtil, LonLatProjection, MaplairMap as Map, MapSync, MaplairMap, Marker, MarkerClusterGroup, MercatorProjection, MiniMapControl, Path, PinchZoomHandler, Point, PolyUtil_exports as PolyUtil, Polygon, Polyline, Popup, Rectangle, Renderer, SVG, SVGOverlay, ScaleControl, ScrollWheelZoomHandler, SearchControl, SideBySideControl, SimpleCRS, SphericalMercatorProjection, SvgIcon, TapDragZoomHandler, TapHoldHandler, TextControl, TileLayer, TimeControl, Tooltip, Transformation, Util_exports as Util, VideoOverlay, WMSTileLayer, ZoomControl, displace, version };
89
90
 
90
91
  //# sourceMappingURL=Maplair.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Maplair.js","names":["pkg.version"],"sources":["../../src/Maplair.js"],"sourcesContent":["import pkg from '../package.json' with {type: 'json'};\n/**\n * A constant that represents the Maplair version in use.\n * @type {string}\n */\nexport const version = pkg.version;\n\n// control\nexport * from './control/index.js';\n\n// core\nexport * from './core/index.js';\n\n// dom\nexport * from './dom/index.js';\n\n// geometry\nexport * from './geometry/index.js';\n\n// geo\nexport * from './geo/index.js';\n\n// layer\nexport * from './layer/index.js';\n\n// map\nexport * from './map/index.js';\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAa,UAAUA"}
1
+ {"version":3,"file":"Maplair.js","names":["pkg.version"],"sources":["../../src/Maplair.js"],"sourcesContent":["import pkg from '../package.json' with {type: 'json'};\n/**\n * A constant that represents the Maplair version in use.\n * @type {string}\n */\nexport const version = pkg.version;\n\n// control\nexport * from './control/index.js';\n\n// core\nexport * from './core/index.js';\n\n// dom\nexport * from './dom/index.js';\n\n// geometry\nexport * from './geometry/index.js';\n\n// geo\nexport * from './geo/index.js';\n\n// layer\nexport * from './layer/index.js';\n\n// map\nexport * from './map/index.js';\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAa,UAAUA"}
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var __defProp = Object.defineProperty;
3
3
  var __exportAll = (all, no_symbols) => {
4
4
  let target = {};
@@ -9,5 +9,4 @@ var __exportAll = (all, no_symbols) => {
9
9
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
10
  return target;
11
11
  };
12
- //#endregion
13
12
  export { __exportAll };
@@ -2,7 +2,7 @@ import { disableClickPropagation } from "../dom/DomEvent.js";
2
2
  import { create } from "../dom/DomUtil.js";
3
3
  import { Control } from "./Control.js";
4
4
  import { I18n } from "../core/I18n.js";
5
- //#region src/control/AttributionControl.js
5
+ // src/control/AttributionControl.js
6
6
  /** @import {ControlOptions} from './Control.js' */
7
7
  /** @import {MaplairMap} from '../map/Map.js' */
8
8
  const mapleLeaf = "<span aria-hidden=\"true\" class=\"maplair-attribution-leaf\">&#x1F341;</span>";
@@ -155,7 +155,6 @@ var AttributionControl = class AttributionControl extends Control {
155
155
  });
156
156
  }
157
157
  };
158
- //#endregion
159
158
  export { AttributionControl };
160
159
 
161
160
  //# sourceMappingURL=AttributionControl.js.map
@@ -1,7 +1,7 @@
1
1
  import { disableClickPropagation, on, stop } from "../dom/DomEvent.js";
2
2
  import { create } from "../dom/DomUtil.js";
3
3
  import { Control } from "./Control.js";
4
- //#region src/control/ButtonControl.js
4
+ // src/control/ButtonControl.js
5
5
  /** @import {ControlOptions} from './Control.js' */
6
6
  /** @import {MaplairMap} from '../map/Map.js' */
7
7
  /**
@@ -213,7 +213,6 @@ var ButtonBarControl = class ButtonBarControl extends Control {
213
213
  return this._buttons;
214
214
  }
215
215
  };
216
- //#endregion
217
216
  export { ButtonBarControl, ButtonControl };
218
217
 
219
218
  //# sourceMappingURL=ButtonControl.js.map
@@ -3,7 +3,7 @@ import { Class } from "../core/Class.js";
3
3
  import { disableClickPropagation, disableScrollPropagation, on, stop } from "../dom/DomEvent.js";
4
4
  import { create } from "../dom/DomUtil.js";
5
5
  import { Layer } from "../layer/Layer.js";
6
- //#region src/control/ContextMenu.js
6
+ // src/control/ContextMenu.js
7
7
  /** @import {MaplairMap} from '../map/Map.js' */
8
8
  /** @import {LatLng} from '../geo/LatLng.js' */
9
9
  /** @import {Point} from '../geometry/Point.js' */
@@ -165,7 +165,6 @@ var ContextMenu = class ContextMenu extends Class {
165
165
  buttons.at(next % buttons.length)?.focus();
166
166
  }
167
167
  };
168
- //#endregion
169
168
  export { ContextMenu };
170
169
 
171
170
  //# sourceMappingURL=ContextMenu.js.map
@@ -1,7 +1,7 @@
1
1
  import { setOptions } from "../core/Util.js";
2
2
  import { Class } from "../core/Class.js";
3
3
  import { create } from "../dom/DomUtil.js";
4
- //#region src/control/Control.js
4
+ // src/control/Control.js
5
5
  /** @import {MaplairMap} from '../map/Map.js' */
6
6
  /**
7
7
  * Options of `Control`, inherited by all controls.
@@ -156,7 +156,6 @@ var Control = class Control extends Class {
156
156
  MaplairMap.include(mapControlMethods);
157
157
  }
158
158
  };
159
- //#endregion
160
159
  export { Control };
161
160
 
162
161
  //# sourceMappingURL=Control.js.map
@@ -2,7 +2,7 @@ import { disableClickPropagation, off, on, stop } from "../dom/DomEvent.js";
2
2
  import { create } from "../dom/DomUtil.js";
3
3
  import { Control } from "./Control.js";
4
4
  import { I18n } from "../core/I18n.js";
5
- //#region src/control/FullscreenControl.js
5
+ // src/control/FullscreenControl.js
6
6
  /** @import {ControlOptions} from './Control.js' */
7
7
  /** @import {MaplairMap} from '../map/Map.js' */
8
8
  /** @import {MaplairEvent} from '../core/Events.js' */
@@ -178,7 +178,6 @@ var FullscreenControl = class FullscreenControl extends Control {
178
178
  });
179
179
  }
180
180
  };
181
- //#endregion
182
181
  export { FullscreenControl };
183
182
 
184
183
  //# sourceMappingURL=FullscreenControl.js.map
@@ -3,7 +3,7 @@ import { disableClickPropagation, disableScrollPropagation, off, on, preventDefa
3
3
  import { create } from "../dom/DomUtil.js";
4
4
  import { Control } from "./Control.js";
5
5
  import { I18n } from "../core/I18n.js";
6
- //#region src/control/LayersControl.js
6
+ // src/control/LayersControl.js
7
7
  /** @import {ControlOptions} from './Control.js' */
8
8
  /** @import {MaplairMap} from '../map/Map.js' */
9
9
  /** @import {Layer} from '../layer/Layer.js' */
@@ -182,6 +182,7 @@ var LayersControl = class LayersControl extends Control {
182
182
  this._map.off("zoomend", this._checkDisabledLayers, this);
183
183
  for (const layer of this._layers) layer.layer.off("add remove", this._onLayerChange, this);
184
184
  this._map.off("resize", this._expandIfNotCollapsed, this);
185
+ this._map.off("click", this.collapse, this);
185
186
  }
186
187
  /**
187
188
  * Adds a base layer (radio button entry) with the given name to the control.
@@ -210,8 +211,7 @@ var LayersControl = class LayersControl extends Control {
210
211
  */
211
212
  removeLayer(layer) {
212
213
  layer.off("add remove", this._onLayerChange, this);
213
- const obj = this._getLayer(stamp(layer));
214
- if (obj) this._layers.splice(this._layers.indexOf(obj), 1);
214
+ this._layers = this._layers.filter((o) => o.layer !== layer);
215
215
  return this._map ? this._update() : this;
216
216
  }
217
217
  /**
@@ -235,7 +235,7 @@ var LayersControl = class LayersControl extends Control {
235
235
  * @returns {this}
236
236
  */
237
237
  selectLayer(layer) {
238
- const input = this._layerControlInputs.find((input) => input.layerId === stamp(layer));
238
+ const input = this._layerControlInputs.find((input) => input._layer === layer);
239
239
  if (input && !input.checked) {
240
240
  input.checked = true;
241
241
  this._onInputClick();
@@ -260,21 +260,14 @@ var LayersControl = class LayersControl extends Control {
260
260
  }
261
261
  /**
262
262
  * Collapse the control container if expanded.
263
- * @param {Event} [ev] The event causing the collapse, if any (collapsing is skipped
264
- * for `pointerleave` and `pointerout` of touch).
265
263
  * @returns {this}
266
264
  */
267
- collapse(ev) {
265
+ collapse() {
268
266
  if (this.options.inline) return this;
269
- if (!ev || !((ev.type === "pointerleave" || ev.type === "pointerout") && ev.pointerType === "touch")) {
270
- if (this.options.collapseDelay > 0) {
271
- this._collapseDelayTimeout = setTimeout(() => {
272
- this._container.classList.remove("maplair-control-layers-expanded");
273
- }, this.options.collapseDelay);
274
- return this;
275
- }
267
+ if (this.options.collapseDelay > 0) this._collapseDelayTimeout = setTimeout(() => {
276
268
  this._container.classList.remove("maplair-control-layers-expanded");
277
- }
269
+ }, this.options.collapseDelay);
270
+ else this._container.classList.remove("maplair-control-layers-expanded");
278
271
  return this;
279
272
  }
280
273
  _initLayout() {
@@ -288,7 +281,9 @@ var LayersControl = class LayersControl extends Control {
288
281
  this._map.on("click", this.collapse, this);
289
282
  on(container, {
290
283
  pointerenter: this._expandSafely,
291
- pointerleave: this.collapse
284
+ pointerleave(e) {
285
+ if (e.pointerType !== "touch") this.collapse();
286
+ }
292
287
  }, this);
293
288
  }
294
289
  if (!this.options.inline) {
@@ -315,9 +310,6 @@ var LayersControl = class LayersControl extends Control {
315
310
  this._overlaysList = create("div", `${className}-overlays`, section);
316
311
  container.appendChild(section);
317
312
  }
318
- _getLayer(id) {
319
- for (const layer of this._layers) if (layer && stamp(layer.layer) === id) return layer;
320
- }
321
313
  _addLayer(layer, name, overlay) {
322
314
  if (this._map) layer.on("add remove", this._onLayerChange, this);
323
315
  this._layers.push({
@@ -354,7 +346,7 @@ var LayersControl = class LayersControl extends Control {
354
346
  }
355
347
  _onLayerChange(e) {
356
348
  if (!this._handlingClick) this._update();
357
- const obj = this._getLayer(stamp(e.target));
349
+ const obj = this._layers.find((o) => o.layer === e.target);
358
350
  const type = obj.overlay ? e.type === "add" ? "overlayadd" : "overlayremove" : e.type === "add" ? "baselayerchange" : null;
359
351
  if (type) this._map.fire(type, this._clickEvent ? {
360
352
  ...obj,
@@ -369,7 +361,7 @@ var LayersControl = class LayersControl extends Control {
369
361
  input.defaultChecked = checked;
370
362
  if (!obj.overlay) input.name = `maplair-base-layers_${stamp(this)}`;
371
363
  this._layerControlInputs.push(input);
372
- input.layerId = stamp(obj.layer);
364
+ input._layer = obj.layer;
373
365
  on(input, "click", this._onInputClick, this);
374
366
  const group = this.options.groupBy?.(obj.name, obj.layer, obj.overlay);
375
367
  const name = document.createElement("span");
@@ -403,24 +395,29 @@ var LayersControl = class LayersControl extends Control {
403
395
  }
404
396
  _onInputClick(e) {
405
397
  if (this._preventClick) return;
406
- const inputs = this._layerControlInputs, addedLayers = [], removedLayers = [];
398
+ const checked = /* @__PURE__ */ new Map();
399
+ for (const input of this._layerControlInputs) {
400
+ const layer = input._layer;
401
+ checked.set(layer, checked.get(layer) || input.checked);
402
+ }
403
+ const addedLayers = [], removedLayers = [];
404
+ for (const [layer, on] of checked) if (on !== this._map.hasLayer(layer)) (on ? addedLayers : removedLayers).push(layer);
407
405
  this._handlingClick = true;
408
406
  this._clickEvent = e;
409
- for (const input of inputs) {
410
- const layer = this._getLayer(input.layerId).layer;
411
- if (input.checked) addedLayers.push(layer);
412
- else if (!input.checked) removedLayers.push(layer);
413
- }
414
- for (const layer of removedLayers) if (this._map.hasLayer(layer)) this._map.removeLayer(layer);
415
- for (const layer of addedLayers) if (!this._map.hasLayer(layer)) this._map.addLayer(layer);
407
+ for (const layer of removedLayers) this._map.removeLayer(layer);
408
+ for (const layer of addedLayers) this._map.addLayer(layer);
416
409
  this._handlingClick = false;
417
410
  this._clickEvent = void 0;
411
+ for (const [layer, on] of checked) if (on !== this._map.hasLayer(layer)) {
412
+ this._update();
413
+ break;
414
+ }
418
415
  this._refocusOnMap(e);
419
416
  }
420
417
  _checkDisabledLayers() {
421
418
  const inputs = this._layerControlInputs, zoom = this._map.getZoom();
422
419
  for (const input of inputs) {
423
- const layer = this._getLayer(input.layerId).layer;
420
+ const layer = input._layer;
424
421
  input.disabled = layer.options.minZoom !== void 0 && zoom < layer.options.minZoom || layer.options.maxZoom !== void 0 && zoom > layer.options.maxZoom;
425
422
  }
426
423
  }
@@ -442,7 +439,6 @@ var LayersControl = class LayersControl extends Control {
442
439
  });
443
440
  }
444
441
  };
445
- //#endregion
446
442
  export { LayersControl };
447
443
 
448
444
  //# sourceMappingURL=LayersControl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LayersControl.js","names":["Util.stamp","DomUtil.create","DomEvent.preventDefault"],"sources":["../../../src/control/LayersControl.js"],"sourcesContent":["\nimport {Control} from './Control.js';\nimport * as Util from '../core/Util.js';\nimport * as DomEvent from '../dom/DomEvent.js';\nimport * as DomUtil from '../dom/DomUtil.js';\nimport {I18n} from '../core/I18n.js';\n/** @import {ControlOptions} from './Control.js' */\n/** @import {MaplairMap} from '../map/Map.js' */\n/** @import {Layer} from '../layer/Layer.js' */\n/** @import {LayersControlEvent} from '../core/Events.js' */\n\n/**\n * An entry of `LayersControl`, as returned by `getLayers()`.\n * @typedef {object} LayersControlEntry\n * @property {Layer} layer The layer.\n * @property {string} name The name of the layer, as given to the control.\n * @property {boolean} overlay Whether the layer is an overlay (checkbox) or a base layer\n * (radio button).\n */\n\n/**\n * The group of an entry of `LayersControl`, as returned by the option `groupBy`.\n * @typedef {object} LayersControlGroup\n * @property {string} group The name of the group, rendered as text.\n * @property {string} label The label of the entry within the group, may contain HTML\n * (like layer names).\n */\n\n/**\n * Options of `LayersControl`.\n * @typedef {object} LayersControlOptions\n * @property {boolean} [collapsed=true] If `true`, the control will be collapsed into an\n * icon and expanded on pointer hover, touch, or keyboard activation. Ignored if `inline`\n * is `true`.\n * @property {boolean} [inline=false] If `true`, the control is laid out like the\n * attribution control: it is always expanded (without toggle button) and all entries are\n * placed next to each other, wrapping onto multiple lines if necessary.\n * @property {(name: string, layer: Layer, overlay: boolean) => LayersControlGroup | undefined} [groupBy]\n * A function to group the entries. For each entry, it returns the name of its group and\n * its label within the group, or `undefined` for an ungrouped entry. Consecutive entries\n * of the same group (base layers and overlays separately) are rendered within one\n * `maplair-control-layers-group` container, starting with the group name in a\n * `maplair-control-layers-group-name` element, and each entry shows only its label.\n * Events like `baselayerchange` still carry the full `name`. When combined with\n * `sortLayers`, the entries are sorted first and grouped afterwards.\n * @property {string|HTMLElement} [toggleContent] The content of the toggle button of a\n * collapsed control instead of the layers icon: HTML (e.g. an icon or a character) or an\n * element. String content is rendered as HTML; do not pass untrusted input.\n * @property {number} [collapseDelay=0] Collapse delay in milliseconds. If greater than 0,\n * the control will remain open longer, making it easier to scroll through long layer\n * lists.\n * @property {string} [position='topright'] The position of the control (one of the map\n * corners). Possible values are `'topleft'`, `'topright'`, `'bottomleft'` or\n * `'bottomright'`.\n * @property {boolean} [autoZIndex=true] If `true`, the control will assign zIndexes in\n * increasing order to all of its layers so that the order is preserved when switching\n * them on/off.\n * @property {boolean} [hideSingleBase=false] If `true`, the base layers in the control\n * will be hidden when there is only one.\n * @property {boolean} [sortLayers=false] Whether to sort the layers. When `false`, layers\n * will keep the order in which they were added to the control.\n * @property {(layerA: Layer, layerB: Layer, nameA: string, nameB: string) => number} [sortFunction]\n * A [compare function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)\n * that will be used for sorting the layers, when `sortLayers` is `true`. The function\n * receives both the `Layer` instances and their names, as in\n * `sortFunction(layerA, layerB, nameA, nameB)`. By default, it sorts layers\n * alphabetically by their name.\n * @extends ControlOptions\n */\n\n/**\n * The layers control gives users the ability to switch between different base layers\n * and switch overlays on/off (check out the\n * [detailed example](https://maplair.org/examples/layers-control/)).\n *\n * @example\n * ```js\n * const baseLayers = {\n * \t\"Mapbox\": mapbox,\n * \t\"OpenStreetMap\": osm\n * };\n *\n * const overlays = {\n * \t\"Marker\": marker,\n * \t\"Roads\": roadsLayer\n * };\n *\n * new LayersControl(baseLayers, overlays).addTo(map);\n * ```\n *\n * The `baseLayers` and `overlays` parameters are object literals with layer names as keys and `Layer` objects as values:\n *\n * ```js\n * {\n * \"<someName1>\": layer1,\n * \"<someName2>\": layer2\n * }\n * ```\n *\n * The layer names can contain HTML, which allows you to add additional styling to the items:\n *\n * ```js\n * {\"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>\": myLayer}\n * ```\n *\n * Layers can be grouped using the option `groupBy`, for example layer names of the form\n * `\"Group (label)\"`:\n *\n * ```js\n * new LayersControl(baseLayers, overlays, {\n * \tinline: true,\n * \tgroupBy(name) {\n * \t\tconst [, group, label] = /^([^<>()]+) \\((.+)\\)$/.exec(name) ?? [];\n * \t\treturn group ? {group: `${group}:`, label} : undefined;\n * \t}\n * }).addTo(map);\n * ```\n *\n * @fires MaplairMap#baselayerchange {LayersControlEvent} Fired when the base layer is\n * changed through the [layers control](#control-layers).\n * @fires MaplairMap#overlayadd {LayersControlEvent} Fired when an overlay is selected\n * through the [layers control](#control-layers).\n * @fires MaplairMap#overlayremove {LayersControlEvent} Fired when an overlay is\n * deselected through the [layers control](#control-layers).\n */\nexport class LayersControl extends Control {\n\n\tstatic defaultOptions = {\n\t\tcollapsed: true,\n\t\tinline: false,\n\t\tgroupBy: undefined,\n\t\ttoggleContent: undefined,\n\t\tcollapseDelay: 0,\n\t\tposition: 'topright',\n\t\tautoZIndex: true,\n\t\thideSingleBase: false,\n\t\tsortLayers: false,\n\t\tsortFunction(layerA, layerB, nameA, nameB) {\n\t\t\treturn nameA < nameB ? -1 : (nameB < nameA ? 1 : 0);\n\t\t}\n\t};\n\n\t/**\n\t * Creates a layers control with the given layers. Base layers will be switched with\n\t * radio buttons, while overlays will be switched with checkboxes. Note that all base\n\t * layers should be passed in the base layers object, but only one should be added to\n\t * the map during map instantiation.\n\t * @param {Record<string, Layer>} [baseLayers]\n\t * @param {Record<string, Layer>} [overlays]\n\t * @param {LayersControlOptions} [options]\n\t */\n\tconstructor(baseLayers, overlays, options) {\n\t\tsuper(options);\n\n\t\tthis._layerControlInputs = [];\n\t\tthis._layers = [];\n\t\tthis._lastZIndex = 0;\n\t\tthis._handlingClick = false;\n\t\tthis._preventClick = false;\n\n\t\tfor (const [name, layer] of Object.entries(baseLayers ?? {})) {\n\t\t\tthis._addLayer(layer, name);\n\t\t}\n\n\t\tfor (const [name, layer] of Object.entries(overlays ?? {})) {\n\t\t\tthis._addLayer(layer, name, true);\n\t\t}\n\n\t\tthis.callInitHooks(LayersControl);\n\t}\n\n\t/**\n\t * @internal\n\t * @param {MaplairMap} map\n\t * @returns {HTMLElement}\n\t */\n\tonAdd(map) {\n\t\tthis._initLayout();\n\t\tthis._update();\n\n\t\tthis._map = map;\n\t\tmap.on('zoomend', this._checkDisabledLayers, this);\n\n\t\tfor (const layer of this._layers) {\n\t\t\tlayer.layer.on('add remove', this._onLayerChange, this);\n\t\t}\n\n\t\tif (!this._isCollapsible()) {\n\t\t\t// update the height of the container after resizing the window\n\t\t\tmap.on('resize', this._expandIfNotCollapsed, this);\n\t\t}\n\n\t\treturn this._container;\n\t}\n\n\t/**\n\t * Adds the control to the given map.\n\t * @param {MaplairMap} map\n\t * @returns {this}\n\t */\n\taddTo(map) {\n\t\tsuper.addTo(map);\n\t\t// Trigger expand after Layers Control has been inserted into DOM so that is now has an actual height.\n\t\treturn this._expandIfNotCollapsed();\n\t}\n\n\t/** @internal */\n\tonRemove() {\n\t\tthis._map.off('zoomend', this._checkDisabledLayers, this);\n\n\t\tfor (const layer of this._layers) {\n\t\t\tlayer.layer.off('add remove', this._onLayerChange, this);\n\t\t}\n\n\t\tthis._map.off('resize', this._expandIfNotCollapsed, this);\n\t}\n\n\t/**\n\t * Adds a base layer (radio button entry) with the given name to the control.\n\t * @param {Layer} layer\n\t * @param {string} name\n\t * @returns {this}\n\t */\n\taddBaseLayer(layer, name) {\n\t\tthis._addLayer(layer, name);\n\t\treturn (this._map) ? this._update() : this;\n\t}\n\n\t/**\n\t * Adds an overlay (checkbox entry) with the given name to the control.\n\t * @param {Layer} layer\n\t * @param {string} name\n\t * @returns {this}\n\t */\n\taddOverlay(layer, name) {\n\t\tthis._addLayer(layer, name, true);\n\t\treturn (this._map) ? this._update() : this;\n\t}\n\n\t/**\n\t * Remove the given layer from the control.\n\t * @param {Layer} layer\n\t * @returns {this}\n\t */\n\tremoveLayer(layer) {\n\t\tlayer.off('add remove', this._onLayerChange, this);\n\n\t\tconst obj = this._getLayer(Util.stamp(layer));\n\t\tif (obj) {\n\t\t\tthis._layers.splice(this._layers.indexOf(obj), 1);\n\t\t}\n\t\treturn (this._map) ? this._update() : this;\n\t}\n\n\t/**\n\t * Returns the entries of the control in the order they are displayed.\n\t * @returns {LayersControlEntry[]}\n\t */\n\tgetLayers() {\n\t\treturn this._layers.map(({layer, name, overlay}) => ({layer, name, overlay}));\n\t}\n\n\t/**\n\t * Selects the given layer of the control like a click on its entry: a base layer\n\t * replaces the current base layer, an overlay is added to the map. The events\n\t * `baselayerchange` and `overlayadd` are fired as for a click, but without\n\t * `originalEvent`. Has no effect if the control is not on a map or does not contain\n\t * the layer.\n\t * @param {Layer} layer\n\t * @returns {this}\n\t */\n\tselectLayer(layer) {\n\t\tconst input = this._layerControlInputs.find(input => input.layerId === Util.stamp(layer));\n\t\tif (input && !input.checked) {\n\t\t\tinput.checked = true;\n\t\t\tthis._onInputClick();\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Expand the control container if collapsed.\n\t * @returns {this}\n\t */\n\texpand() {\n\t\tclearTimeout(this._collapseDelayTimeout);\n\n\t\tthis._container.classList.add('maplair-control-layers-expanded');\n\t\tthis._section.style.height = '';\n\t\tconst acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);\n\t\tif (acceptableHeight < this._section.clientHeight) {\n\t\t\tthis._section.classList.add('maplair-control-layers-scrollbar');\n\t\t\tthis._section.style.height = `${acceptableHeight}px`;\n\t\t} else {\n\t\t\tthis._section.classList.remove('maplair-control-layers-scrollbar');\n\t\t}\n\t\tthis._checkDisabledLayers();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Collapse the control container if expanded.\n\t * @param {Event} [ev] The event causing the collapse, if any (collapsing is skipped\n\t * for `pointerleave` and `pointerout` of touch).\n\t * @returns {this}\n\t */\n\tcollapse(ev) {\n\t\tif (this.options.inline) {\n\t\t\treturn this;\n\t\t}\n\t\t// On touch devices `pointerleave` & `pointerout` is fired while clicking on a checkbox.\n\t\t// The control was collapsed instead of adding the layer to the map.\n\t\t// So we allow collapse only if it is not touch.\n\t\tif (!ev || !((ev.type === 'pointerleave' || ev.type === 'pointerout') && ev.pointerType === 'touch')) {\n\t\t\tif (this.options.collapseDelay > 0) {\n\t\t\t\t// Collapse delayed\n\t\t\t\tthis._collapseDelayTimeout = setTimeout(() => {\n\t\t\t\t\tthis._container.classList.remove('maplair-control-layers-expanded');\n\t\t\t\t}, this.options.collapseDelay);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\t// Collapse immediately\n\t\t\tthis._container.classList.remove('maplair-control-layers-expanded');\n\t\t}\n\t\treturn this;\n\t}\n\n\t_initLayout() {\n\t\tconst className = 'maplair-control-layers',\n\t\tcontainer = this._container = DomUtil.create('div', className),\n\t\tcollapsed = this._isCollapsible();\n\n\t\tif (this.options.inline) {\n\t\t\tcontainer.classList.add(`${className}-inline`);\n\t\t}\n\n\t\tDomEvent.disableClickPropagation(container);\n\t\tDomEvent.disableScrollPropagation(container);\n\n\t\tconst section = this._section = DomUtil.create('fieldset', `${className}-list`);\n\t\tsection.setAttribute('aria-label', I18n.translate('Layers'));\n\n\t\tif (collapsed) {\n\t\t\tthis._map.on('click', this.collapse, this);\n\n\t\t\tDomEvent.on(container, {\n\t\t\t\tpointerenter: this._expandSafely,\n\t\t\t\tpointerleave: this.collapse\n\t\t\t}, this);\n\t\t}\n\n\t\tif (!this.options.inline) {\n\t\t\tconst link = this._layersLink = DomUtil.create('button', `${className}-toggle`, container);\n\t\t\tlink.type = 'button';\n\t\t\tlink.title = I18n.translate('Layers');\n\t\t\tlink.setAttribute('aria-label', I18n.translate('Layers'));\n\n\t\t\tconst {toggleContent} = this.options;\n\t\t\tif (typeof toggleContent === 'string') {\n\t\t\t\tlink.innerHTML = toggleContent;\n\t\t\t} else if (toggleContent) {\n\t\t\t\tlink.replaceChildren(toggleContent);\n\t\t\t}\n\n\t\t\tDomEvent.on(link, {\n\t\t\t\tkeydown(e) {\n\t\t\t\t\tif (e.code === 'Enter') {\n\t\t\t\t\t\tthis._expandSafely();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t// Certain screen readers intercept the key event and instead send a click event\n\t\t\t\tclick(e) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tthis._expandSafely();\n\t\t\t\t}\n\t\t\t}, this);\n\t\t}\n\n\t\tif (!collapsed) {\n\t\t\tthis.expand();\n\t\t}\n\n\t\tthis._baseLayersList = DomUtil.create('div', `${className}-base`, section);\n\t\tthis._separator = DomUtil.create('div', `${className}-separator`, section);\n\t\tthis._overlaysList = DomUtil.create('div', `${className}-overlays`, section);\n\n\t\tcontainer.appendChild(section);\n\t}\n\n\t_getLayer(id) {\n\t\tfor (const layer of this._layers) {\n\t\t\tif (layer && Util.stamp(layer.layer) === id) {\n\t\t\t\treturn layer;\n\t\t\t}\n\t\t}\n\t}\n\n\t_addLayer(layer, name, overlay) {\n\t\tif (this._map) {\n\t\t\tlayer.on('add remove', this._onLayerChange, this);\n\t\t}\n\n\t\tthis._layers.push({\n\t\t\tlayer,\n\t\t\tname,\n\t\t\toverlay: !!overlay\n\t\t});\n\n\t\tif (this.options.sortLayers) {\n\t\t\tthis._layers.sort(((a, b) => this.options.sortFunction(a.layer, b.layer, a.name, b.name)));\n\t\t}\n\n\t\tif (this.options.autoZIndex && layer.setZIndex) {\n\t\t\tthis._lastZIndex++;\n\t\t\tlayer.setZIndex(this._lastZIndex);\n\t\t}\n\n\t\tthis._expandIfNotCollapsed();\n\t}\n\n\t_update() {\n\t\tif (!this._container) { return this; }\n\n\t\tthis._baseLayersList.replaceChildren();\n\t\tthis._overlaysList.replaceChildren();\n\n\t\tthis._layerControlInputs = [];\n\t\tthis._groupCount = 0;\n\t\tlet baseLayersPresent, overlaysPresent, baseLayersCount = 0;\n\n\t\tfor (const obj of this._layers) {\n\t\t\tthis._addItem(obj);\n\t\t\toverlaysPresent ||= obj.overlay;\n\t\t\tbaseLayersPresent ||= !obj.overlay;\n\t\t\tbaseLayersCount += !obj.overlay ? 1 : 0;\n\t\t}\n\n\t\t// Hide base layers section if there's only one layer.\n\t\tif (this.options.hideSingleBase) {\n\t\t\tbaseLayersPresent = baseLayersPresent && baseLayersCount > 1;\n\t\t\tthis._baseLayersList.style.display = baseLayersPresent ? '' : 'none';\n\t\t}\n\n\t\tthis._separator.style.display = overlaysPresent && baseLayersPresent ? '' : 'none';\n\n\t\treturn this;\n\t}\n\n\t_onLayerChange(e) {\n\t\tif (!this._handlingClick) {\n\t\t\tthis._update();\n\t\t}\n\n\t\tconst obj = this._getLayer(Util.stamp(e.target));\n\n\t\tconst type = obj.overlay ?\n\t\t\t(e.type === 'add' ? 'overlayadd' : 'overlayremove') :\n\t\t\t(e.type === 'add' ? 'baselayerchange' : null);\n\n\t\tif (type) {\n\t\t\tthis._map.fire(type, this._clickEvent ? {...obj, originalEvent: this._clickEvent} : obj);\n\t\t}\n\t}\n\n\t_addItem(obj) {\n\t\tconst label = document.createElement('label'),\n\t\tchecked = this._map.hasLayer(obj.layer);\n\n\t\tconst input = document.createElement('input');\n\t\tinput.type = obj.overlay ? 'checkbox' : 'radio';\n\t\tinput.className = 'maplair-control-layers-selector';\n\t\tinput.defaultChecked = checked;\n\t\tif (!obj.overlay) {\n\t\t\tinput.name = `maplair-base-layers_${Util.stamp(this)}`;\n\t\t}\n\n\t\tthis._layerControlInputs.push(input);\n\t\tinput.layerId = Util.stamp(obj.layer);\n\n\t\tDomEvent.on(input, 'click', this._onInputClick, this);\n\n\t\tconst group = this.options.groupBy?.(obj.name, obj.layer, obj.overlay);\n\n\t\tconst name = document.createElement('span');\n\t\tname.innerHTML = ` ${group ? group.label : obj.name}`;\n\n\t\t// Helps from preventing layer control flicker when checkboxes are disabled\n\t\t// https://github.com/Leaflet/Leaflet/issues/2771\n\t\tconst holder = document.createElement('span');\n\n\t\tlabel.appendChild(holder);\n\t\tholder.appendChild(input);\n\t\tholder.appendChild(name);\n\n\t\tconst list = obj.overlay ? this._overlaysList : this._baseLayersList;\n\t\tconst container = group ? this._getGroupContainer(list, group.group) : list;\n\t\tcontainer.appendChild(label);\n\n\t\tthis._checkDisabledLayers();\n\t\treturn label;\n\t}\n\n\t/**\n\t * Returns the container of the given group if it is the last element in `list`\n\t * (continuing the group), otherwise appends a new group container to `list`.\n\t * @param {HTMLElement} list\n\t * @param {string} group\n\t * @returns {HTMLElement}\n\t */\n\t_getGroupContainer(list, group) {\n\t\tconst last = list.lastElementChild;\n\t\tif (last?._maplairGroup === group) {\n\t\t\treturn last;\n\t\t}\n\n\t\tconst className = 'maplair-control-layers-group',\n\t\tcontainer = DomUtil.create('div', className, list),\n\t\tname = DomUtil.create('span', `${className}-name`, container);\n\t\tname.id = `${className}_${Util.stamp(this)}_${++this._groupCount}`;\n\t\tname.textContent = group;\n\t\tcontainer.setAttribute('role', 'group');\n\t\tcontainer.setAttribute('aria-labelledby', name.id);\n\t\tcontainer._maplairGroup = group;\n\t\treturn container;\n\t}\n\n\t_onInputClick(e) {\n\t\t// expanding the control on mobile with a click can cause adding a layer - we don't want this\n\t\tif (this._preventClick) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst inputs = this._layerControlInputs,\n\t\taddedLayers = [],\n\t\tremovedLayers = [];\n\n\t\tthis._handlingClick = true;\n\t\tthis._clickEvent = e;\n\n\t\tfor (const input of inputs) {\n\t\t\tconst layer = this._getLayer(input.layerId).layer;\n\n\t\t\tif (input.checked) {\n\t\t\t\taddedLayers.push(layer);\n\t\t\t} else if (!input.checked) {\n\t\t\t\tremovedLayers.push(layer);\n\t\t\t}\n\t\t}\n\n\t\t// Bugfix issue 2318: Should remove all old layers before readding new ones\n\t\tfor (const layer of removedLayers) {\n\t\t\tif (this._map.hasLayer(layer)) {\n\t\t\t\tthis._map.removeLayer(layer);\n\t\t\t}\n\t\t}\n\t\tfor (const layer of addedLayers) {\n\t\t\tif (!this._map.hasLayer(layer)) {\n\t\t\t\tthis._map.addLayer(layer);\n\t\t\t}\n\t\t}\n\n\t\tthis._handlingClick = false;\n\t\tthis._clickEvent = undefined;\n\n\t\tthis._refocusOnMap(e);\n\t}\n\n\t_checkDisabledLayers() {\n\t\tconst inputs = this._layerControlInputs,\n\t\tzoom = this._map.getZoom();\n\n\t\tfor (const input of inputs) {\n\t\t\tconst layer = this._getLayer(input.layerId).layer;\n\t\t\tinput.disabled = (layer.options.minZoom !== undefined && zoom < layer.options.minZoom) ||\n\t\t\t (layer.options.maxZoom !== undefined && zoom > layer.options.maxZoom);\n\n\t\t}\n\t}\n\n\t_isCollapsible() {\n\t\treturn this.options.collapsed && !this.options.inline;\n\t}\n\n\t_expandIfNotCollapsed() {\n\t\tif (this._map && !this._isCollapsible()) {\n\t\t\tthis.expand();\n\t\t}\n\t\treturn this;\n\t}\n\n\t_expandSafely() {\n\t\tconst section = this._section;\n\t\tthis._preventClick = true;\n\t\tDomEvent.on(section, 'click', DomEvent.preventDefault);\n\t\tthis.expand();\n\t\tsetTimeout(() => {\n\t\t\tDomEvent.off(section, 'click', DomEvent.preventDefault);\n\t\t\tthis._preventClick = false;\n\t\t});\n\t}\n\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HA,IAAa,gBAAb,MAAa,sBAAsB,QAAQ;CAE1C,OAAO,iBAAiB;EACvB,WAAW;EACX,QAAQ;EACR,SAAS,KAAA;EACT,eAAe,KAAA;EACf,eAAe;EACf,UAAU;EACV,YAAY;EACZ,gBAAgB;EAChB,YAAY;EACZ,aAAa,QAAQ,QAAQ,OAAO,OAAO;GAC1C,OAAO,QAAQ,QAAQ,KAAM,QAAQ,QAAQ,IAAI;EAClD;CACD;;;;;;;;;;CAWA,YAAY,YAAY,UAAU,SAAS;EAC1C,MAAM,OAAO;EAEb,KAAK,sBAAsB,CAAC;EAC5B,KAAK,UAAU,CAAC;EAChB,KAAK,cAAc;EACnB,KAAK,iBAAiB;EACtB,KAAK,gBAAgB;EAErB,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,cAAc,CAAC,CAAC,GAC1D,KAAK,UAAU,OAAO,IAAI;EAG3B,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,YAAY,CAAC,CAAC,GACxD,KAAK,UAAU,OAAO,MAAM,IAAI;EAGjC,KAAK,cAAc,aAAa;CACjC;;;;;;CAOA,MAAM,KAAK;EACV,KAAK,YAAY;EACjB,KAAK,QAAQ;EAEb,KA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AAY,KAAK,KAAK;QAChB,IAAI,CAAC,MAAM,SACjB,cAAc,KAAK,KAAK;EAE1B;EAGA,KAAK,MAAM,SAAS,eACnB,IAAI,KAAK,KAAK,SAAS,KAAK,GAC3B,KAAK,KAAK,YAAY,KAAK;EAG7B,KAAK,MAAM,SAAS,aACnB,IAAI,CAAC,KAAK,KAAK,SAAS,KAAK,GAC5B,KAAK,KAAK,SAAS,KAAK;EAI1B,KAAK,iBAAiB;EACtB,KAAK,cAAc,KAAA;EAEnB,KAAK,cAAc,CAAC;CACrB;CAEA,uBAAuB;EACtB,MAAM,SAAS,KAAK,qBACpB,OAAO,KAAK,KAAK,QAAQ;EAEzB,KAAK,MAAM,SAAS,QAAQ;GAC3B,MAAM,QAAQ,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC;GAC5C,MAAM,WAAY,MAAM,QAAQ,YAAY,KAAA,KAAa,OAAO,MAAM,QAAQ,WAC5D,MAAM,QAAQ,YAAY,KAAA,KAAa,OAAO,MAAM,QAAQ;EAE/E;CACD;CAEA,iBAAiB;EAChB,OAAO,KAAK,QAAQ,aAAa,CAAC,KAAK,QAAQ;CAChD;CAEA,wBAAwB;EACvB,IAAI,KAAK,QAAQ,CAAC,KAAK,eAAe,GACrC,KAAK,OAAO;EAEb,OAAO;CACR;CAEA,gBAAgB;EACf,MAAM,UAAU,KAAK;EACrB,KAAK,gBAAgB;EACrB,GAAY,SAAS,SAASE,cAAuB;EACrD,KAAK,OAAO;EACZ,iBAAiB;GAChB,IAAa,SAAS,SAASA,cAAuB;GACtD,KAAK,gBAAgB;EACtB,CAAC;CACF;AAED"}
1
+ {"version":3,"file":"LayersControl.js","names":["DomUtil.create","Util.stamp","DomEvent.preventDefault"],"sources":["../../../src/control/LayersControl.js"],"sourcesContent":["\nimport {Control} from './Control.js';\nimport * as Util from '../core/Util.js';\nimport * as DomEvent from '../dom/DomEvent.js';\nimport * as DomUtil from '../dom/DomUtil.js';\nimport {I18n} from '../core/I18n.js';\n/** @import {ControlOptions} from './Control.js' */\n/** @import {MaplairMap} from '../map/Map.js' */\n/** @import {Layer} from '../layer/Layer.js' */\n/** @import {LayersControlEvent} from '../core/Events.js' */\n\n/**\n * An entry of `LayersControl`, as returned by `getLayers()`.\n * @typedef {object} LayersControlEntry\n * @property {Layer} layer The layer.\n * @property {string} name The name of the layer, as given to the control.\n * @property {boolean} overlay Whether the layer is an overlay (checkbox) or a base layer\n * (radio button).\n */\n\n/**\n * The group of an entry of `LayersControl`, as returned by the option `groupBy`.\n * @typedef {object} LayersControlGroup\n * @property {string} group The name of the group, rendered as text.\n * @property {string} label The label of the entry within the group, may contain HTML\n * (like layer names).\n */\n\n/**\n * Options of `LayersControl`.\n * @typedef {object} LayersControlOptions\n * @property {boolean} [collapsed=true] If `true`, the control will be collapsed into an\n * icon and expanded on pointer hover, touch, or keyboard activation. Ignored if `inline`\n * is `true`.\n * @property {boolean} [inline=false] If `true`, the control is laid out like the\n * attribution control: it is always expanded (without toggle button) and all entries are\n * placed next to each other, wrapping onto multiple lines if necessary.\n * @property {(name: string, layer: Layer, overlay: boolean) => LayersControlGroup | undefined} [groupBy]\n * A function to group the entries. For each entry, it returns the name of its group and\n * its label within the group, or `undefined` for an ungrouped entry. Consecutive entries\n * of the same group (base layers and overlays separately) are rendered within one\n * `maplair-control-layers-group` container, starting with the group name in a\n * `maplair-control-layers-group-name` element, and each entry shows only its label.\n * Events like `baselayerchange` still carry the full `name`. When combined with\n * `sortLayers`, the entries are sorted first and grouped afterwards.\n * @property {string|HTMLElement} [toggleContent] The content of the toggle button of a\n * collapsed control instead of the layers icon: HTML (e.g. an icon or a character) or an\n * element. String content is rendered as HTML; do not pass untrusted input.\n * @property {number} [collapseDelay=0] Collapse delay in milliseconds. If greater than 0,\n * the control will remain open longer, making it easier to scroll through long layer\n * lists.\n * @property {string} [position='topright'] The position of the control (one of the map\n * corners). Possible values are `'topleft'`, `'topright'`, `'bottomleft'` or\n * `'bottomright'`.\n * @property {boolean} [autoZIndex=true] If `true`, the control will assign zIndexes in\n * increasing order to all of its layers so that the order is preserved when switching\n * them on/off.\n * @property {boolean} [hideSingleBase=false] If `true`, the base layers in the control\n * will be hidden when there is only one.\n * @property {boolean} [sortLayers=false] Whether to sort the layers. When `false`, layers\n * will keep the order in which they were added to the control.\n * @property {(layerA: Layer, layerB: Layer, nameA: string, nameB: string) => number} [sortFunction]\n * A [compare function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)\n * that will be used for sorting the layers, when `sortLayers` is `true`. The function\n * receives both the `Layer` instances and their names, as in\n * `sortFunction(layerA, layerB, nameA, nameB)`. By default, it sorts layers\n * alphabetically by their name.\n * @extends ControlOptions\n */\n\n/**\n * The layers control gives users the ability to switch between different base layers\n * and switch overlays on/off (check out the\n * [detailed example](https://maplair.org/examples/layers-control/)).\n *\n * @example\n * ```js\n * const baseLayers = {\n * \t\"Mapbox\": mapbox,\n * \t\"OpenStreetMap\": osm\n * };\n *\n * const overlays = {\n * \t\"Marker\": marker,\n * \t\"Roads\": roadsLayer\n * };\n *\n * new LayersControl(baseLayers, overlays).addTo(map);\n * ```\n *\n * The `baseLayers` and `overlays` parameters are object literals with layer names as keys and `Layer` objects as values:\n *\n * ```js\n * {\n * \"<someName1>\": layer1,\n * \"<someName2>\": layer2\n * }\n * ```\n *\n * The layer names can contain HTML, which allows you to add additional styling to the items:\n *\n * ```js\n * {\"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>\": myLayer}\n * ```\n *\n * Layers can be grouped using the option `groupBy`, for example layer names of the form\n * `\"Group (label)\"`:\n *\n * ```js\n * new LayersControl(baseLayers, overlays, {\n * \tinline: true,\n * \tgroupBy(name) {\n * \t\tconst [, group, label] = /^([^<>()]+) \\((.+)\\)$/.exec(name) ?? [];\n * \t\treturn group ? {group: `${group}:`, label} : undefined;\n * \t}\n * }).addTo(map);\n * ```\n *\n * @fires MaplairMap#baselayerchange {LayersControlEvent} Fired when the base layer is\n * changed through the [layers control](#control-layers).\n * @fires MaplairMap#overlayadd {LayersControlEvent} Fired when an overlay is selected\n * through the [layers control](#control-layers).\n * @fires MaplairMap#overlayremove {LayersControlEvent} Fired when an overlay is\n * deselected through the [layers control](#control-layers).\n */\nexport class LayersControl extends Control {\n\n\tstatic defaultOptions = {\n\t\tcollapsed: true,\n\t\tinline: false,\n\t\tgroupBy: undefined,\n\t\ttoggleContent: undefined,\n\t\tcollapseDelay: 0,\n\t\tposition: 'topright',\n\t\tautoZIndex: true,\n\t\thideSingleBase: false,\n\t\tsortLayers: false,\n\t\tsortFunction(layerA, layerB, nameA, nameB) {\n\t\t\treturn nameA < nameB ? -1 : (nameB < nameA ? 1 : 0);\n\t\t}\n\t};\n\n\t/**\n\t * Creates a layers control with the given layers. Base layers will be switched with\n\t * radio buttons, while overlays will be switched with checkboxes. Note that all base\n\t * layers should be passed in the base layers object, but only one should be added to\n\t * the map during map instantiation.\n\t * @param {Record<string, Layer>} [baseLayers]\n\t * @param {Record<string, Layer>} [overlays]\n\t * @param {LayersControlOptions} [options]\n\t */\n\tconstructor(baseLayers, overlays, options) {\n\t\tsuper(options);\n\n\t\tthis._layerControlInputs = [];\n\t\tthis._layers = [];\n\t\tthis._lastZIndex = 0;\n\t\tthis._handlingClick = false;\n\t\tthis._preventClick = false;\n\n\t\tfor (const [name, layer] of Object.entries(baseLayers ?? {})) {\n\t\t\tthis._addLayer(layer, name);\n\t\t}\n\n\t\tfor (const [name, layer] of Object.entries(overlays ?? {})) {\n\t\t\tthis._addLayer(layer, name, true);\n\t\t}\n\n\t\tthis.callInitHooks(LayersControl);\n\t}\n\n\t/**\n\t * @internal\n\t * @param {MaplairMap} map\n\t * @returns {HTMLElement}\n\t */\n\tonAdd(map) {\n\t\tthis._initLayout();\n\t\tthis._update();\n\n\t\tthis._map = map;\n\t\tmap.on('zoomend', this._checkDisabledLayers, this);\n\n\t\tfor (const layer of this._layers) {\n\t\t\tlayer.layer.on('add remove', this._onLayerChange, this);\n\t\t}\n\n\t\tif (!this._isCollapsible()) {\n\t\t\t// update the height of the container after resizing the window\n\t\t\tmap.on('resize', this._expandIfNotCollapsed, this);\n\t\t}\n\n\t\treturn this._container;\n\t}\n\n\t/**\n\t * Adds the control to the given map.\n\t * @param {MaplairMap} map\n\t * @returns {this}\n\t */\n\taddTo(map) {\n\t\tsuper.addTo(map);\n\t\t// Trigger expand after Layers Control has been inserted into DOM so that is now has an actual height.\n\t\treturn this._expandIfNotCollapsed();\n\t}\n\n\t/** @internal */\n\tonRemove() {\n\t\tthis._map.off('zoomend', this._checkDisabledLayers, this);\n\n\t\tfor (const layer of this._layers) {\n\t\t\tlayer.layer.off('add remove', this._onLayerChange, this);\n\t\t}\n\n\t\tthis._map.off('resize', this._expandIfNotCollapsed, this);\n\t\tthis._map.off('click', this.collapse, this);\n\t}\n\n\t/**\n\t * Adds a base layer (radio button entry) with the given name to the control.\n\t * @param {Layer} layer\n\t * @param {string} name\n\t * @returns {this}\n\t */\n\taddBaseLayer(layer, name) {\n\t\tthis._addLayer(layer, name);\n\t\treturn (this._map) ? this._update() : this;\n\t}\n\n\t/**\n\t * Adds an overlay (checkbox entry) with the given name to the control.\n\t * @param {Layer} layer\n\t * @param {string} name\n\t * @returns {this}\n\t */\n\taddOverlay(layer, name) {\n\t\tthis._addLayer(layer, name, true);\n\t\treturn (this._map) ? this._update() : this;\n\t}\n\n\t/**\n\t * Remove the given layer from the control.\n\t * @param {Layer} layer\n\t * @returns {this}\n\t */\n\tremoveLayer(layer) {\n\t\tlayer.off('add remove', this._onLayerChange, this);\n\n\t\tthis._layers = this._layers.filter(o => o.layer !== layer);\n\t\treturn (this._map) ? this._update() : this;\n\t}\n\n\t/**\n\t * Returns the entries of the control in the order they are displayed.\n\t * @returns {LayersControlEntry[]}\n\t */\n\tgetLayers() {\n\t\treturn this._layers.map(({layer, name, overlay}) => ({layer, name, overlay}));\n\t}\n\n\t/**\n\t * Selects the given layer of the control like a click on its entry: a base layer\n\t * replaces the current base layer, an overlay is added to the map. The events\n\t * `baselayerchange` and `overlayadd` are fired as for a click, but without\n\t * `originalEvent`. Has no effect if the control is not on a map or does not contain\n\t * the layer.\n\t * @param {Layer} layer\n\t * @returns {this}\n\t */\n\tselectLayer(layer) {\n\t\tconst input = this._layerControlInputs.find(input => input._layer === layer);\n\t\tif (input && !input.checked) {\n\t\t\tinput.checked = true;\n\t\t\tthis._onInputClick();\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Expand the control container if collapsed.\n\t * @returns {this}\n\t */\n\texpand() {\n\t\tclearTimeout(this._collapseDelayTimeout);\n\n\t\tthis._container.classList.add('maplair-control-layers-expanded');\n\t\tthis._section.style.height = '';\n\t\tconst acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);\n\t\tif (acceptableHeight < this._section.clientHeight) {\n\t\t\tthis._section.classList.add('maplair-control-layers-scrollbar');\n\t\t\tthis._section.style.height = `${acceptableHeight}px`;\n\t\t} else {\n\t\t\tthis._section.classList.remove('maplair-control-layers-scrollbar');\n\t\t}\n\t\tthis._checkDisabledLayers();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Collapse the control container if expanded.\n\t * @returns {this}\n\t */\n\tcollapse() {\n\t\tif (this.options.inline) {\n\t\t\treturn this;\n\t\t}\n\t\tif (this.options.collapseDelay > 0) {\n\t\t\tthis._collapseDelayTimeout = setTimeout(() => {\n\t\t\t\tthis._container.classList.remove('maplair-control-layers-expanded');\n\t\t\t}, this.options.collapseDelay);\n\t\t} else {\n\t\t\tthis._container.classList.remove('maplair-control-layers-expanded');\n\t\t}\n\t\treturn this;\n\t}\n\n\t_initLayout() {\n\t\tconst className = 'maplair-control-layers',\n\t\tcontainer = this._container = DomUtil.create('div', className),\n\t\tcollapsed = this._isCollapsible();\n\n\t\tif (this.options.inline) {\n\t\t\tcontainer.classList.add(`${className}-inline`);\n\t\t}\n\n\t\tDomEvent.disableClickPropagation(container);\n\t\tDomEvent.disableScrollPropagation(container);\n\n\t\tconst section = this._section = DomUtil.create('fieldset', `${className}-list`);\n\t\tsection.setAttribute('aria-label', I18n.translate('Layers'));\n\n\t\tif (collapsed) {\n\t\t\tthis._map.on('click', this.collapse, this);\n\n\t\t\tDomEvent.on(container, {\n\t\t\t\tpointerenter: this._expandSafely,\n\t\t\t\t// on touch devices, pointerleave fires while clicking a checkbox, which shouldn't collapse the control\n\t\t\t\tpointerleave(e) {\n\t\t\t\t\tif (e.pointerType !== 'touch') { this.collapse(); }\n\t\t\t\t}\n\t\t\t}, this);\n\t\t}\n\n\t\tif (!this.options.inline) {\n\t\t\tconst link = this._layersLink = DomUtil.create('button', `${className}-toggle`, container);\n\t\t\tlink.type = 'button';\n\t\t\tlink.title = I18n.translate('Layers');\n\t\t\tlink.setAttribute('aria-label', I18n.translate('Layers'));\n\n\t\t\tconst {toggleContent} = this.options;\n\t\t\tif (typeof toggleContent === 'string') {\n\t\t\t\tlink.innerHTML = toggleContent;\n\t\t\t} else if (toggleContent) {\n\t\t\t\tlink.replaceChildren(toggleContent);\n\t\t\t}\n\n\t\t\tDomEvent.on(link, {\n\t\t\t\tkeydown(e) {\n\t\t\t\t\tif (e.code === 'Enter') {\n\t\t\t\t\t\tthis._expandSafely();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t// Certain screen readers intercept the key event and instead send a click event\n\t\t\t\tclick(e) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tthis._expandSafely();\n\t\t\t\t}\n\t\t\t}, this);\n\t\t}\n\n\t\tif (!collapsed) {\n\t\t\tthis.expand();\n\t\t}\n\n\t\tthis._baseLayersList = DomUtil.create('div', `${className}-base`, section);\n\t\tthis._separator = DomUtil.create('div', `${className}-separator`, section);\n\t\tthis._overlaysList = DomUtil.create('div', `${className}-overlays`, section);\n\n\t\tcontainer.appendChild(section);\n\t}\n\n\t_addLayer(layer, name, overlay) {\n\t\tif (this._map) {\n\t\t\tlayer.on('add remove', this._onLayerChange, this);\n\t\t}\n\n\t\tthis._layers.push({\n\t\t\tlayer,\n\t\t\tname,\n\t\t\toverlay: !!overlay\n\t\t});\n\n\t\tif (this.options.sortLayers) {\n\t\t\tthis._layers.sort(((a, b) => this.options.sortFunction(a.layer, b.layer, a.name, b.name)));\n\t\t}\n\n\t\tif (this.options.autoZIndex && layer.setZIndex) {\n\t\t\tthis._lastZIndex++;\n\t\t\tlayer.setZIndex(this._lastZIndex);\n\t\t}\n\n\t\tthis._expandIfNotCollapsed();\n\t}\n\n\t_update() {\n\t\tif (!this._container) { return this; }\n\n\t\tthis._baseLayersList.replaceChildren();\n\t\tthis._overlaysList.replaceChildren();\n\n\t\tthis._layerControlInputs = [];\n\t\tthis._groupCount = 0;\n\t\tlet baseLayersPresent, overlaysPresent, baseLayersCount = 0;\n\n\t\tfor (const obj of this._layers) {\n\t\t\tthis._addItem(obj);\n\t\t\toverlaysPresent ||= obj.overlay;\n\t\t\tbaseLayersPresent ||= !obj.overlay;\n\t\t\tbaseLayersCount += !obj.overlay ? 1 : 0;\n\t\t}\n\n\t\t// Hide base layers section if there's only one layer.\n\t\tif (this.options.hideSingleBase) {\n\t\t\tbaseLayersPresent = baseLayersPresent && baseLayersCount > 1;\n\t\t\tthis._baseLayersList.style.display = baseLayersPresent ? '' : 'none';\n\t\t}\n\n\t\tthis._separator.style.display = overlaysPresent && baseLayersPresent ? '' : 'none';\n\n\t\treturn this;\n\t}\n\n\t_onLayerChange(e) {\n\t\tif (!this._handlingClick) {\n\t\t\tthis._update();\n\t\t}\n\n\t\tconst obj = this._layers.find(o => o.layer === e.target);\n\n\t\tconst type = obj.overlay ?\n\t\t\t(e.type === 'add' ? 'overlayadd' : 'overlayremove') :\n\t\t\t(e.type === 'add' ? 'baselayerchange' : null);\n\n\t\tif (type) {\n\t\t\tthis._map.fire(type, this._clickEvent ? {...obj, originalEvent: this._clickEvent} : obj);\n\t\t}\n\t}\n\n\t_addItem(obj) {\n\t\tconst label = document.createElement('label'),\n\t\tchecked = this._map.hasLayer(obj.layer);\n\n\t\tconst input = document.createElement('input');\n\t\tinput.type = obj.overlay ? 'checkbox' : 'radio';\n\t\tinput.className = 'maplair-control-layers-selector';\n\t\tinput.defaultChecked = checked;\n\t\tif (!obj.overlay) {\n\t\t\tinput.name = `maplair-base-layers_${Util.stamp(this)}`;\n\t\t}\n\n\t\tthis._layerControlInputs.push(input);\n\t\tinput._layer = obj.layer;\n\n\t\tDomEvent.on(input, 'click', this._onInputClick, this);\n\n\t\tconst group = this.options.groupBy?.(obj.name, obj.layer, obj.overlay);\n\n\t\tconst name = document.createElement('span');\n\t\tname.innerHTML = ` ${group ? group.label : obj.name}`;\n\n\t\t// Helps from preventing layer control flicker when checkboxes are disabled\n\t\t// https://github.com/Leaflet/Leaflet/issues/2771\n\t\tconst holder = document.createElement('span');\n\n\t\tlabel.appendChild(holder);\n\t\tholder.appendChild(input);\n\t\tholder.appendChild(name);\n\n\t\tconst list = obj.overlay ? this._overlaysList : this._baseLayersList;\n\t\tconst container = group ? this._getGroupContainer(list, group.group) : list;\n\t\tcontainer.appendChild(label);\n\n\t\tthis._checkDisabledLayers();\n\t\treturn label;\n\t}\n\n\t/**\n\t * Returns the container of the given group if it is the last element in `list`\n\t * (continuing the group), otherwise appends a new group container to `list`.\n\t * @param {HTMLElement} list\n\t * @param {string} group\n\t * @returns {HTMLElement}\n\t */\n\t_getGroupContainer(list, group) {\n\t\tconst last = list.lastElementChild;\n\t\tif (last?._maplairGroup === group) {\n\t\t\treturn last;\n\t\t}\n\n\t\tconst className = 'maplair-control-layers-group',\n\t\tcontainer = DomUtil.create('div', className, list),\n\t\tname = DomUtil.create('span', `${className}-name`, container);\n\t\tname.id = `${className}_${Util.stamp(this)}_${++this._groupCount}`;\n\t\tname.textContent = group;\n\t\tcontainer.setAttribute('role', 'group');\n\t\tcontainer.setAttribute('aria-labelledby', name.id);\n\t\tcontainer._maplairGroup = group;\n\t\treturn container;\n\t}\n\n\t_onInputClick(e) {\n\t\t// expanding the control on mobile with a click can cause adding a layer - we don't want this\n\t\tif (this._preventClick) {\n\t\t\treturn;\n\t\t}\n\n\t\t// a layer can be listed under several inputs, so it should be on the map if any of them is checked\n\t\tconst checked = new Map();\n\t\tfor (const input of this._layerControlInputs) {\n\t\t\tconst layer = input._layer;\n\t\t\tchecked.set(layer, checked.get(layer) || input.checked);\n\t\t}\n\n\t\t// diff against the map upfront, so layers that event handlers add or remove below keep their state\n\t\tconst addedLayers = [], removedLayers = [];\n\t\tfor (const [layer, on] of checked) {\n\t\t\tif (on !== this._map.hasLayer(layer)) {\n\t\t\t\t(on ? addedLayers : removedLayers).push(layer);\n\t\t\t}\n\t\t}\n\n\t\tthis._handlingClick = true;\n\t\tthis._clickEvent = e;\n\n\t\t// Bugfix issue 2318: Should remove all old layers before readding new ones\n\t\tfor (const layer of removedLayers) {\n\t\t\tthis._map.removeLayer(layer);\n\t\t}\n\t\tfor (const layer of addedLayers) {\n\t\t\tthis._map.addLayer(layer);\n\t\t}\n\n\t\tthis._handlingClick = false;\n\t\tthis._clickEvent = undefined;\n\n\t\tfor (const [layer, on] of checked) {\n\t\t\tif (on !== this._map.hasLayer(layer)) {\n\t\t\t\tthis._update();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tthis._refocusOnMap(e);\n\t}\n\n\t_checkDisabledLayers() {\n\t\tconst inputs = this._layerControlInputs,\n\t\tzoom = this._map.getZoom();\n\n\t\tfor (const input of inputs) {\n\t\t\tconst layer = input._layer;\n\t\t\tinput.disabled = (layer.options.minZoom !== undefined && zoom < layer.options.minZoom) ||\n\t\t\t (layer.options.maxZoom !== undefined && zoom > layer.options.maxZoom);\n\n\t\t}\n\t}\n\n\t_isCollapsible() {\n\t\treturn this.options.collapsed && !this.options.inline;\n\t}\n\n\t_expandIfNotCollapsed() {\n\t\tif (this._map && !this._isCollapsible()) {\n\t\t\tthis.expand();\n\t\t}\n\t\treturn this;\n\t}\n\n\t_expandSafely() {\n\t\tconst section = this._section;\n\t\tthis._preventClick = true;\n\t\tDomEvent.on(section, 'click', DomEvent.preventDefault);\n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ACb;EACD;EAGD,KAAK,cAAc,CAAC;CACrB;CAEA,uBAAuB;EACtB,MAAM,SAAS,KAAK,qBACpB,OAAO,KAAK,KAAK,QAAQ;EAEzB,KAAK,MAAM,SAAS,QAAQ;GAC3B,MAAM,QAAQ,MAAM;GACpB,MAAM,WAAY,MAAM,QAAQ,YAAY,KAAA,KAAa,OAAO,MAAM,QAAQ,WAC5D,MAAM,QAAQ,YAAY,KAAA,KAAa,OAAO,MAAM,QAAQ;EAE/E;CACD;CAEA,iBAAiB;EAChB,OAAO,KAAK,QAAQ,aAAa,CAAC,KAAK,QAAQ;CAChD;CAEA,wBAAwB;EACvB,IAAI,KAAK,QAAQ,CAAC,KAAK,eAAe,GACrC,KAAK,OAAO;EAEb,OAAO;CACR;CAEA,gBAAgB;EACf,MAAM,UAAU,KAAK;EACrB,KAAK,gBAAgB;EACrB,GAAY,SAAS,SAASC,cAAuB;EACrD,KAAK,OAAO;EACZ,iBAAiB;GAChB,IAAa,SAAS,SAASA,cAAuB;GACtD,KAAK,gBAAgB;EACtB,CAAC;CACF;AAED"}
@@ -3,7 +3,7 @@ import { create } from "../dom/DomUtil.js";
3
3
  import { Control } from "./Control.js";
4
4
  import { I18n } from "../core/I18n.js";
5
5
  import { CircleMarker } from "../layer/vector/CircleMarker.js";
6
- //#region src/control/LegendControl.js
6
+ // src/control/LegendControl.js
7
7
  /** @import {ControlOptions} from './Control.js' */
8
8
  /** @import {MaplairMap} from '../map/Map.js' */
9
9
  /** @import {FeatureGroup} from '../layer/FeatureGroup.js' */
@@ -222,7 +222,6 @@ function svgElement(name, attributes) {
222
222
  for (const [key, value] of Object.entries(attributes)) el.setAttribute(key, value);
223
223
  return el;
224
224
  }
225
- //#endregion
226
225
  export { LegendControl };
227
226
 
228
227
  //# sourceMappingURL=LegendControl.js.map
@@ -4,7 +4,7 @@ import { Control } from "./Control.js";
4
4
  import { I18n } from "../core/I18n.js";
5
5
  import { LeafletMap as MaplairMap } from "../map/Map.js";
6
6
  import { Polygon } from "../layer/vector/Polygon.js";
7
- //#region src/control/MiniMapControl.js
7
+ // src/control/MiniMapControl.js
8
8
  /** @import {ControlOptions} from './Control.js' */
9
9
  /** @import {MaplairMapOptions} from '../map/Map.js' */
10
10
  /** @import {Layer} from '../layer/Layer.js' */
@@ -174,7 +174,6 @@ var MiniMapControl = class MiniMapControl extends Control {
174
174
  if (!this._miniMap.dragging?.moved()) this._map.panTo(e.latlng);
175
175
  }
176
176
  };
177
- //#endregion
178
177
  export { MiniMapControl };
179
178
 
180
179
  //# sourceMappingURL=MiniMapControl.js.map
@@ -2,7 +2,7 @@ import { disableClickPropagation, on, stop } from "../dom/DomEvent.js";
2
2
  import { create } from "../dom/DomUtil.js";
3
3
  import { Control } from "./Control.js";
4
4
  import { I18n } from "../core/I18n.js";
5
- //#region src/control/RotateControl.js
5
+ // src/control/RotateControl.js
6
6
  /** @import {ControlOptions} from './Control.js' */
7
7
  /** @import {MaplairMap} from '../map/Map.js' */
8
8
  const compass = "<svg aria-hidden=\"true\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><path d=\"M8 1 11 8H5z\" fill=\"#d22\"/><path d=\"M8 15 5 8h6z\" fill=\"#999\"/></svg>";
@@ -96,7 +96,6 @@ var RotateControl = class RotateControl extends Control {
96
96
  });
97
97
  }
98
98
  };
99
- //#endregion
100
99
  export { RotateControl };
101
100
 
102
101
  //# sourceMappingURL=RotateControl.js.map
@@ -1,7 +1,7 @@
1
1
  import { create } from "../dom/DomUtil.js";
2
2
  import { Control } from "./Control.js";
3
3
  import { I18n } from "../core/I18n.js";
4
- //#region src/control/ScaleControl.js
4
+ // src/control/ScaleControl.js
5
5
  /** @import {ControlOptions} from './Control.js' */
6
6
  /** @import {MaplairMap} from '../map/Map.js' */
7
7
  /**
@@ -104,7 +104,6 @@ var ScaleControl = class ScaleControl extends Control {
104
104
  return pow10 * d;
105
105
  }
106
106
  };
107
- //#endregion
108
107
  export { ScaleControl };
109
108
 
110
109
  //# sourceMappingURL=ScaleControl.js.map
@@ -6,7 +6,7 @@ import { I18n } from "../core/I18n.js";
6
6
  import { LatLngBounds } from "../geo/LatLngBounds.js";
7
7
  import { LatLng } from "../geo/LatLng.js";
8
8
  import { Marker } from "../layer/marker/Marker.js";
9
- //#region src/control/SearchControl.js
9
+ // src/control/SearchControl.js
10
10
  /** @import {ControlOptions} from './Control.js' */
11
11
  /** @import {MaplairMap} from '../map/Map.js' */
12
12
  /** @import {MaplairEvent} from '../core/Events.js' */
@@ -518,7 +518,6 @@ var SearchControl = class SearchControl extends Control {
518
518
  else this.collapse();
519
519
  }
520
520
  };
521
- //#endregion
522
521
  export { SearchControl };
523
522
 
524
523
  //# sourceMappingURL=SearchControl.js.map
@@ -2,7 +2,7 @@ import { disableClickPropagation, off, on, stop } from "../dom/DomEvent.js";
2
2
  import { create, getPosition } from "../dom/DomUtil.js";
3
3
  import { Control } from "./Control.js";
4
4
  import { I18n } from "../core/I18n.js";
5
- //#region src/control/SideBySideControl.js
5
+ // src/control/SideBySideControl.js
6
6
  /** @import {ControlOptions} from './Control.js' */
7
7
  /** @import {MaplairMap} from '../map/Map.js' */
8
8
  /** @import {Layer} from '../layer/Layer.js' */
@@ -200,7 +200,6 @@ var SideBySideControl = class SideBySideControl extends Control {
200
200
  function getElement(layer) {
201
201
  return layer.getContainer?.() ?? layer.getElement?.();
202
202
  }
203
- //#endregion
204
203
  export { SideBySideControl };
205
204
 
206
205
  //# sourceMappingURL=SideBySideControl.js.map