maplair 4.0.0 → 4.2.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 (305) hide show
  1. package/CHANGELOG.md +178 -0
  2. package/dist/esm/Maplair.js +18 -17
  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 +25 -16
  6. package/dist/esm/control/AttributionControl.js.map +1 -1
  7. package/dist/esm/control/ButtonControl.js +10 -13
  8. package/dist/esm/control/ButtonControl.js.map +1 -1
  9. package/dist/esm/control/ContextMenu.js +2 -5
  10. package/dist/esm/control/ContextMenu.js.map +1 -1
  11. package/dist/esm/control/Control.js +10 -18
  12. package/dist/esm/control/Control.js.map +1 -1
  13. package/dist/esm/control/FullscreenControl.js +6 -9
  14. package/dist/esm/control/FullscreenControl.js.map +1 -1
  15. package/dist/esm/control/LayersControl.js +170 -65
  16. package/dist/esm/control/LayersControl.js.map +1 -1
  17. package/dist/esm/control/LegendControl.js +8 -11
  18. package/dist/esm/control/LegendControl.js.map +1 -1
  19. package/dist/esm/control/MiniMapControl.js +15 -18
  20. package/dist/esm/control/MiniMapControl.js.map +1 -1
  21. package/dist/esm/control/RotateControl.js +2 -5
  22. package/dist/esm/control/RotateControl.js.map +1 -1
  23. package/dist/esm/control/ScaleControl.js +8 -11
  24. package/dist/esm/control/ScaleControl.js.map +1 -1
  25. package/dist/esm/control/SearchControl.js +100 -19
  26. package/dist/esm/control/SearchControl.js.map +1 -1
  27. package/dist/esm/control/SideBySideControl.js +2 -5
  28. package/dist/esm/control/SideBySideControl.js.map +1 -1
  29. package/dist/esm/control/TextControl.js +6 -9
  30. package/dist/esm/control/TextControl.js.map +1 -1
  31. package/dist/esm/control/TimeControl.js +407 -0
  32. package/dist/esm/control/TimeControl.js.map +1 -0
  33. package/dist/esm/control/ZoomControl.js +23 -36
  34. package/dist/esm/control/ZoomControl.js.map +1 -1
  35. package/dist/esm/core/Class.js +28 -44
  36. package/dist/esm/core/Class.js.map +1 -1
  37. package/dist/esm/core/Events.js +22 -10
  38. package/dist/esm/core/Events.js.map +1 -1
  39. package/dist/esm/core/Handler.js +23 -14
  40. package/dist/esm/core/Handler.js.map +1 -1
  41. package/dist/esm/core/I18n.js +1 -2
  42. package/dist/esm/core/Util.js +15 -4
  43. package/dist/esm/core/Util.js.map +1 -1
  44. package/dist/esm/dom/DomEvent.DoubleTap.js +26 -24
  45. package/dist/esm/dom/DomEvent.DoubleTap.js.map +1 -1
  46. package/dist/esm/dom/DomEvent.PointerEvents.js +3 -18
  47. package/dist/esm/dom/DomEvent.PointerEvents.js.map +1 -1
  48. package/dist/esm/dom/DomEvent.js +18 -60
  49. package/dist/esm/dom/DomEvent.js.map +1 -1
  50. package/dist/esm/dom/DomUtil.js +15 -70
  51. package/dist/esm/dom/DomUtil.js.map +1 -1
  52. package/dist/esm/dom/Draggable.js +21 -21
  53. package/dist/esm/dom/Draggable.js.map +1 -1
  54. package/dist/esm/dom/PosAnimation.js +4 -27
  55. package/dist/esm/dom/PosAnimation.js.map +1 -1
  56. package/dist/esm/geo/LatLng.js +16 -7
  57. package/dist/esm/geo/LatLng.js.map +1 -1
  58. package/dist/esm/geo/LatLngBounds.js +9 -15
  59. package/dist/esm/geo/LatLngBounds.js.map +1 -1
  60. package/dist/esm/geo/crs/CRS.js +1 -2
  61. package/dist/esm/geo/crs/EPSG3395.js +5 -6
  62. package/dist/esm/geo/crs/EPSG3395.js.map +1 -1
  63. package/dist/esm/geo/crs/EPSG3857.js +5 -6
  64. package/dist/esm/geo/crs/EPSG3857.js.map +1 -1
  65. package/dist/esm/geo/crs/EPSG4326.js +4 -5
  66. package/dist/esm/geo/crs/EPSG4326.js.map +1 -1
  67. package/dist/esm/geo/crs/EarthCRS.js +3 -4
  68. package/dist/esm/geo/crs/EarthCRS.js.map +1 -1
  69. package/dist/esm/geo/crs/SimpleCRS.js +4 -5
  70. package/dist/esm/geo/crs/SimpleCRS.js.map +1 -1
  71. package/dist/esm/geo/projection/{Projection.LonLat.js → LonLatProjection.js} +5 -6
  72. package/dist/esm/geo/projection/LonLatProjection.js.map +1 -0
  73. package/dist/esm/geo/projection/{Projection.Mercator.js → MercatorProjection.js} +4 -5
  74. package/dist/esm/geo/projection/MercatorProjection.js.map +1 -0
  75. package/dist/esm/geo/projection/{Projection.SphericalMercator.js → SphericalMercatorProjection.js} +5 -6
  76. package/dist/esm/geo/projection/SphericalMercatorProjection.js.map +1 -0
  77. package/dist/esm/geometry/Bounds.js +10 -14
  78. package/dist/esm/geometry/Bounds.js.map +1 -1
  79. package/dist/esm/geometry/LineUtil.js +37 -32
  80. package/dist/esm/geometry/LineUtil.js.map +1 -1
  81. package/dist/esm/geometry/Point.js +1 -2
  82. package/dist/esm/geometry/PolyUtil.js +24 -51
  83. package/dist/esm/geometry/PolyUtil.js.map +1 -1
  84. package/dist/esm/geometry/Transformation.js +1 -2
  85. package/dist/esm/layer/BlanketOverlay.js +7 -10
  86. package/dist/esm/layer/BlanketOverlay.js.map +1 -1
  87. package/dist/esm/layer/Classification.js +1 -2
  88. package/dist/esm/layer/DivOverlay.js +16 -22
  89. package/dist/esm/layer/DivOverlay.js.map +1 -1
  90. package/dist/esm/layer/FeatureGroup.js +5 -4
  91. package/dist/esm/layer/FeatureGroup.js.map +1 -1
  92. package/dist/esm/layer/GeoJSON.Load.js +1 -2
  93. package/dist/esm/layer/GeoJSON.js +17 -155
  94. package/dist/esm/layer/GeoJSON.js.map +1 -1
  95. package/dist/esm/layer/GeoJSONUtil.js +74 -0
  96. package/dist/esm/layer/GeoJSONUtil.js.map +1 -0
  97. package/dist/esm/layer/HeatLayer.js +17 -20
  98. package/dist/esm/layer/HeatLayer.js.map +1 -1
  99. package/dist/esm/layer/ImageOverlay.js +22 -29
  100. package/dist/esm/layer/ImageOverlay.js.map +1 -1
  101. package/dist/esm/layer/Layer.js +9 -12
  102. package/dist/esm/layer/Layer.js.map +1 -1
  103. package/dist/esm/layer/LayerGroup.js +53 -3
  104. package/dist/esm/layer/LayerGroup.js.map +1 -1
  105. package/dist/esm/layer/Popup.js +35 -58
  106. package/dist/esm/layer/Popup.js.map +1 -1
  107. package/dist/esm/layer/SVGOverlay.js +3 -7
  108. package/dist/esm/layer/SVGOverlay.js.map +1 -1
  109. package/dist/esm/layer/Tooltip.js +31 -34
  110. package/dist/esm/layer/Tooltip.js.map +1 -1
  111. package/dist/esm/layer/VideoOverlay.js +13 -17
  112. package/dist/esm/layer/VideoOverlay.js.map +1 -1
  113. package/dist/esm/layer/marker/DefaultIcon.js +38 -49
  114. package/dist/esm/layer/marker/DefaultIcon.js.map +1 -1
  115. package/dist/esm/layer/marker/DivIcon.js +8 -11
  116. package/dist/esm/layer/marker/DivIcon.js.map +1 -1
  117. package/dist/esm/layer/marker/Icon.js +9 -12
  118. package/dist/esm/layer/marker/Icon.js.map +1 -1
  119. package/dist/esm/layer/marker/Marker.Drag.js +44 -5
  120. package/dist/esm/layer/marker/Marker.Drag.js.map +1 -1
  121. package/dist/esm/layer/marker/Marker.Move.js +5 -8
  122. package/dist/esm/layer/marker/Marker.Move.js.map +1 -1
  123. package/dist/esm/layer/marker/Marker.js +115 -47
  124. package/dist/esm/layer/marker/Marker.js.map +1 -1
  125. package/dist/esm/layer/marker/MarkerClusterGroup.js +301 -0
  126. package/dist/esm/layer/marker/MarkerClusterGroup.js.map +1 -0
  127. package/dist/esm/layer/marker/SvgIcon.js +7 -10
  128. package/dist/esm/layer/marker/SvgIcon.js.map +1 -1
  129. package/dist/esm/layer/tile/GridLayer.js +89 -101
  130. package/dist/esm/layer/tile/GridLayer.js.map +1 -1
  131. package/dist/esm/layer/tile/TileLayer.js +36 -44
  132. package/dist/esm/layer/tile/TileLayer.js.map +1 -1
  133. package/dist/esm/layer/tile/WMSTileLayer.js +33 -27
  134. package/dist/esm/layer/tile/WMSTileLayer.js.map +1 -1
  135. package/dist/esm/layer/vector/Canvas.js +8 -17
  136. package/dist/esm/layer/vector/Canvas.js.map +1 -1
  137. package/dist/esm/layer/vector/Circle.js +6 -5
  138. package/dist/esm/layer/vector/Circle.js.map +1 -1
  139. package/dist/esm/layer/vector/CircleMarker.js +19 -10
  140. package/dist/esm/layer/vector/CircleMarker.js.map +1 -1
  141. package/dist/esm/layer/vector/Path.DashAnimation.js +3 -5
  142. package/dist/esm/layer/vector/Path.DashAnimation.js.map +1 -1
  143. package/dist/esm/layer/vector/Path.ZoomStyles.js +1 -2
  144. package/dist/esm/layer/vector/Path.js +28 -22
  145. package/dist/esm/layer/vector/Path.js.map +1 -1
  146. package/dist/esm/layer/vector/Polygon.js +22 -7
  147. package/dist/esm/layer/vector/Polygon.js.map +1 -1
  148. package/dist/esm/layer/vector/Polyline.Decorations.js +3 -4
  149. package/dist/esm/layer/vector/Polyline.js +25 -10
  150. package/dist/esm/layer/vector/Polyline.js.map +1 -1
  151. package/dist/esm/layer/vector/Rectangle.js +1 -2
  152. package/dist/esm/layer/vector/Renderer.getRenderer.js +17 -17
  153. package/dist/esm/layer/vector/Renderer.getRenderer.js.map +1 -1
  154. package/dist/esm/layer/vector/Renderer.js +1 -2
  155. package/dist/esm/layer/vector/SVG.js +12 -9
  156. package/dist/esm/layer/vector/SVG.js.map +1 -1
  157. package/dist/esm/map/Hash.js +1 -2
  158. package/dist/esm/map/Map.Rotation.js +41 -22
  159. package/dist/esm/map/Map.Rotation.js.map +1 -1
  160. package/dist/esm/map/Map.js +125 -126
  161. package/dist/esm/map/Map.js.map +1 -1
  162. package/dist/esm/map/MapSync.js +1 -2
  163. package/dist/esm/map/handler/BoxZoomHandler.js +25 -47
  164. package/dist/esm/map/handler/BoxZoomHandler.js.map +1 -1
  165. package/dist/esm/map/handler/DisplaceHandler.js +7 -10
  166. package/dist/esm/map/handler/DisplaceHandler.js.map +1 -1
  167. package/dist/esm/map/handler/DoubleClickZoomHandler.js +1 -2
  168. package/dist/esm/map/handler/DragHandler.js +20 -21
  169. package/dist/esm/map/handler/DragHandler.js.map +1 -1
  170. package/dist/esm/map/handler/KeyboardHandler.js +48 -68
  171. package/dist/esm/map/handler/KeyboardHandler.js.map +1 -1
  172. package/dist/esm/map/handler/PinchZoomHandler.js +13 -5
  173. package/dist/esm/map/handler/PinchZoomHandler.js.map +1 -1
  174. package/dist/esm/map/handler/ScrollWheelZoomHandler.js +4 -6
  175. package/dist/esm/map/handler/ScrollWheelZoomHandler.js.map +1 -1
  176. package/dist/esm/map/handler/TapDragZoomHandler.js +1 -2
  177. package/dist/esm/map/handler/TapHoldHandler.js +13 -7
  178. package/dist/esm/map/handler/TapHoldHandler.js.map +1 -1
  179. package/dist/esm/package.js +2 -3
  180. package/dist/maplair-global-src.js +6495 -5981
  181. package/dist/maplair-global-src.js.map +1 -1
  182. package/dist/maplair-global.js +2 -2
  183. package/dist/maplair-global.js.map +1 -1
  184. package/dist/maplair-src.js +6206 -5673
  185. package/dist/maplair-src.js.map +1 -1
  186. package/dist/maplair.css +1 -1213
  187. package/dist/maplair.js +2 -2
  188. package/dist/maplair.js.map +1 -1
  189. package/i18n/cs.json +6 -0
  190. package/i18n/de.json +6 -0
  191. package/i18n/en.json +6 -0
  192. package/i18n/es.json +6 -0
  193. package/i18n/fr.json +6 -0
  194. package/i18n/hu.json +6 -0
  195. package/i18n/it.json +6 -0
  196. package/i18n/rm.json +6 -0
  197. package/i18n/sk.json +6 -0
  198. package/i18n/sl.json +6 -0
  199. package/package.json +11 -18
  200. package/src/Maplair.all.js +0 -1
  201. package/src/control/AttributionControl.js +25 -18
  202. package/src/control/ButtonControl.js +9 -11
  203. package/src/control/ContextMenu.js +3 -5
  204. package/src/control/Control.js +9 -19
  205. package/src/control/FullscreenControl.js +5 -7
  206. package/src/control/LayersControl.js +196 -86
  207. package/src/control/LegendControl.js +7 -9
  208. package/src/control/MiniMapControl.js +9 -11
  209. package/src/control/RotateControl.js +3 -5
  210. package/src/control/ScaleControl.js +7 -9
  211. package/src/control/SearchControl.js +102 -19
  212. package/src/control/SideBySideControl.js +3 -5
  213. package/src/control/TextControl.js +5 -7
  214. package/src/control/TimeControl.js +471 -0
  215. package/src/control/ZoomControl.js +22 -38
  216. package/src/control/index.js +1 -0
  217. package/src/core/Class.js +37 -45
  218. package/src/core/Events.js +22 -3
  219. package/src/core/Handler.js +25 -13
  220. package/src/core/Util.js +20 -2
  221. package/src/core/index.js +0 -1
  222. package/src/dom/DomEvent.DoubleTap.js +18 -10
  223. package/src/dom/DomEvent.PointerEvents.js +3 -26
  224. package/src/dom/DomEvent.js +17 -85
  225. package/src/dom/DomUtil.js +22 -78
  226. package/src/dom/Draggable.js +32 -23
  227. package/src/dom/PosAnimation.js +3 -25
  228. package/src/dom/index.js +0 -1
  229. package/src/geo/LatLng.js +20 -3
  230. package/src/geo/LatLngBounds.js +8 -15
  231. package/src/geo/crs/EPSG3395.js +4 -4
  232. package/src/geo/crs/EPSG3857.js +4 -4
  233. package/src/geo/crs/EPSG4326.js +3 -3
  234. package/src/geo/crs/EarthCRS.js +2 -8
  235. package/src/geo/crs/SimpleCRS.js +3 -3
  236. package/src/geo/index.js +1 -2
  237. package/src/geo/projection/{Projection.LonLat.js → LonLatProjection.js} +2 -2
  238. package/src/geo/projection/{Projection.Mercator.js → MercatorProjection.js} +2 -2
  239. package/src/geo/projection/{Projection.SphericalMercator.js → SphericalMercatorProjection.js} +2 -2
  240. package/src/geo/projection/index.js +5 -5
  241. package/src/geometry/Bounds.js +12 -17
  242. package/src/geometry/LineUtil.js +48 -49
  243. package/src/geometry/PolyUtil.js +39 -76
  244. package/src/layer/BlanketOverlay.js +6 -10
  245. package/src/layer/DivOverlay.js +16 -27
  246. package/src/layer/FeatureGroup.js +8 -2
  247. package/src/layer/GeoJSON.js +17 -218
  248. package/src/layer/GeoJSONUtil.js +85 -0
  249. package/src/layer/HeatLayer.js +10 -12
  250. package/src/layer/ImageOverlay.js +21 -32
  251. package/src/layer/Layer.js +8 -10
  252. package/src/layer/LayerGroup.js +72 -1
  253. package/src/layer/Popup.js +37 -62
  254. package/src/layer/SVGOverlay.js +1 -5
  255. package/src/layer/Tooltip.js +34 -36
  256. package/src/layer/VideoOverlay.js +12 -15
  257. package/src/layer/marker/DefaultIcon.js +40 -58
  258. package/src/layer/marker/DivIcon.js +9 -11
  259. package/src/layer/marker/Icon.js +9 -10
  260. package/src/layer/marker/Marker.Drag.js +54 -6
  261. package/src/layer/marker/Marker.Move.js +4 -6
  262. package/src/layer/marker/Marker.js +145 -52
  263. package/src/layer/marker/MarkerClusterGroup.js +370 -0
  264. package/src/layer/marker/SvgIcon.js +7 -9
  265. package/src/layer/marker/index.js +1 -0
  266. package/src/layer/tile/GridLayer.js +108 -135
  267. package/src/layer/tile/TileLayer.js +44 -49
  268. package/src/layer/tile/WMSTileLayer.js +31 -26
  269. package/src/layer/vector/Canvas.js +13 -19
  270. package/src/layer/vector/Circle.js +9 -3
  271. package/src/layer/vector/CircleMarker.js +19 -7
  272. package/src/layer/vector/Path.DashAnimation.js +1 -2
  273. package/src/layer/vector/Path.js +30 -21
  274. package/src/layer/vector/Polygon.js +29 -6
  275. package/src/layer/vector/Polyline.js +26 -7
  276. package/src/layer/vector/Renderer.getRenderer.js +20 -19
  277. package/src/layer/vector/SVG.js +17 -7
  278. package/src/map/Map.Rotation.js +40 -8
  279. package/src/map/Map.js +158 -153
  280. package/src/map/handler/BoxZoomHandler.js +30 -50
  281. package/src/map/handler/DisplaceHandler.js +6 -8
  282. package/src/map/handler/DragHandler.js +25 -28
  283. package/src/map/handler/KeyboardHandler.js +65 -90
  284. package/src/map/handler/PinchZoomHandler.js +16 -5
  285. package/src/map/handler/ScrollWheelZoomHandler.js +6 -4
  286. package/src/map/handler/TapHoldHandler.js +15 -4
  287. package/src/map/index.js +1 -1
  288. package/src/maplair.css +153 -98
  289. package/dist/esm/core/Browser.js +0 -100
  290. package/dist/esm/core/Browser.js.map +0 -1
  291. package/dist/esm/geo/projection/Projection.LonLat.js.map +0 -1
  292. package/dist/esm/geo/projection/Projection.Mercator.js.map +0 -1
  293. package/dist/esm/geo/projection/Projection.SphericalMercator.js.map +0 -1
  294. package/dist/esm/geo/projection/index.js +0 -14
  295. package/dist/esm/geo/projection/index.js.map +0 -1
  296. package/dist/esm/layer/marker/Marker.Rotation.js +0 -70
  297. package/dist/esm/layer/marker/Marker.Rotation.js.map +0 -1
  298. package/dist/images/layers.svg +0 -1
  299. package/dist/images/marker-icon.svg +0 -1
  300. package/dist/images/marker-shadow.svg +0 -1
  301. package/src/core/Browser.js +0 -110
  302. package/src/images/layers.svg +0 -1
  303. package/src/images/marker-icon.svg +0 -1
  304. package/src/images/marker-shadow.svg +0 -1
  305. package/src/layer/marker/Marker.Rotation.js +0 -103
@@ -0,0 +1,407 @@
1
+ import { disableClickPropagation, disableScrollPropagation, on } from "../dom/DomEvent.js";
2
+ import { create } from "../dom/DomUtil.js";
3
+ import { Control } from "./Control.js";
4
+ import { I18n } from "../core/I18n.js";
5
+ import { ButtonControl } from "./ButtonControl.js";
6
+ // src/control/TimeControl.js
7
+ /** @import {ControlOptions} from './Control.js' */
8
+ /** @import {MaplairMap} from '../map/Map.js' */
9
+ /** @import {Layer} from '../layer/Layer.js' */
10
+ /** @import {MaplairEvent} from '../core/Events.js' */
11
+ const icon = (path) => `<svg aria-hidden="true" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="${path}"/></svg>`;
12
+ const previousIcon = icon("M3 3h2v10H3zm10 0v10L6 8z");
13
+ const playIcon = icon("M4 2v12l10-6z");
14
+ const pauseIcon = icon("M4 3h3v10H4zm5 0h3v10H9z");
15
+ const nextIcon = icon("M11 3h2v10h-2zM3 3v10l7-5z");
16
+ const durationRe = /^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/;
17
+ function parseDuration(duration) {
18
+ const match = durationRe.exec(duration);
19
+ if (!match || duration === "P" || duration.endsWith("T")) throw new Error(`Invalid or unsupported ISO 8601 duration "${duration}".`);
20
+ const [years, months, weeks, days, hours, minutes, seconds] = match.slice(1).map((n) => Number(n ?? 0));
21
+ return {
22
+ years,
23
+ months,
24
+ ms: ((((weeks * 7 + days) * 24 + hours) * 60 + minutes) * 60 + seconds) * 1e3
25
+ };
26
+ }
27
+ function addDuration(time, duration, n) {
28
+ const date = new Date(time);
29
+ date.setUTCFullYear(date.getUTCFullYear() + n * duration.years, date.getUTCMonth() + n * duration.months);
30
+ return new Date(+date + n * duration.ms);
31
+ }
32
+ function parseDate(date) {
33
+ const time = Date.parse(date);
34
+ if (Number.isNaN(time)) throw new Error(`Invalid date "${date}".`);
35
+ return new Date(time);
36
+ }
37
+ function intervalTimes(interval, period) {
38
+ const parts = interval.split("/");
39
+ if (parts.length === 3) period = parts.pop();
40
+ if (parts.length !== 2) throw new Error(`Invalid ISO 8601 interval "${interval}".`);
41
+ const [first, second] = parts, step = parseDuration(period);
42
+ let start, end;
43
+ if (first.startsWith("P")) {
44
+ end = parseDate(second);
45
+ start = addDuration(end, parseDuration(first), -1);
46
+ } else {
47
+ start = parseDate(first);
48
+ end = second.startsWith("P") ? addDuration(start, parseDuration(second), 1) : parseDate(second);
49
+ }
50
+ if (!(addDuration(start, step, 1) > start)) throw new Error(`The period "${period}" has to be positive.`);
51
+ const times = [];
52
+ for (let i = 0, time = start; time <= end; time = addDuration(start, step, ++i)) times.push(time);
53
+ return times;
54
+ }
55
+ /**
56
+ * Options of `TimeControl`.
57
+ * @typedef {object} TimeControlOptions
58
+ * @property {string} [position='bottomleft'] The position of the control (one of the map
59
+ * corners). Possible values are `'topleft'`, `'topright'`, `'bottomleft'` or
60
+ * `'bottomright'`.
61
+ * @property {(Date|number|string)[]} [times] The times to step through in ascending
62
+ * order: dates, timestamps or date strings (parsed with `Date.parse()`).
63
+ * @property {string} [interval] Instead of `times`, an ISO 8601 time interval whose times
64
+ * every [`period`](#timecontrol-period) from the start up to the end are stepped
65
+ * through: `start/end` (e.g. `'2026-10-17T00:00Z/2026-10-18T00:00Z'`), `start/duration`
66
+ * (e.g. `'2026-10-17T00:00Z/P1D'`) or `duration/end` (e.g. `'PT24H/2026-10-18T00:00Z'`).
67
+ * A third part is the period, as in the time dimension of WMS capabilities (e.g.
68
+ * `'2026-10-17T00:00Z/2026-10-18T00:00Z/PT5M'`). Start and end are parsed with
69
+ * `Date.parse()`, e.g. `2026-10-17`, `2026-10-17T12:00Z` or
70
+ * `2026-10-17T12:00:00.000+02:00` (without a time zone, times are local times).
71
+ * @property {string} [period='P1D'] The ISO 8601 duration between the times of the
72
+ * `interval`: integer numbers of years, months, weeks, days, hours, minutes and seconds,
73
+ * e.g. `'PT1H'`, `'PT5M'`, `'P1DT12H'` or `'P1M'` (years and months are added in UTC).
74
+ * @property {Date|number|string} [time] The initial time (the nearest of the times), by
75
+ * default the current time.
76
+ * @property {(Layer & TimeLayer)[]} [layers=[]] The layers showing the current time, see
77
+ * `addLayer()`.
78
+ * @property {number} [transitionTime=1000] The minimum time in milliseconds a time is
79
+ * shown while playing. The next time is shown only after the layers have loaded, too.
80
+ * @property {boolean} [loop=false] Whether playing starts over after the last time
81
+ * instead of stopping, and the buttons step from the last time to the first one and
82
+ * back.
83
+ * @property {(date: Date) => string} [formatTime] Returns the text of the label for a
84
+ * time, by default the date and time by `Intl.DateTimeFormat` in the [locale](#i18n)
85
+ * (or the browser's language) and the browser's time zone.
86
+ * @extends ControlOptions
87
+ */
88
+ /**
89
+ * A layer showing a given time, see `TimeControl`.
90
+ * @typedef {object} TimeLayer
91
+ * @property {(date: Date) => any} [setTime] Shows the given time.
92
+ */
93
+ /**
94
+ * The event object of `timechange`.
95
+ * @typedef {object} TimeChangeEvent
96
+ * @property {Date} time The current time.
97
+ * @property {number} index The index of the current time in the times of the control.
98
+ * @extends MaplairEvent
99
+ */
100
+ /**
101
+ * A control to step through or play the times of time-dependent layers, e.g. an
102
+ * animated weather radar from a WMS with a `TIME` dimension. It has buttons for the
103
+ * previous and next time and to play or pause, a slider (usable with the arrow, Home
104
+ * and End keys) and a label with the current time.
105
+ *
106
+ * Each of the `layers` shows the current time: by its method `setTime(date)` if it has
107
+ * one, otherwise by the parameter `time` set to the time in ISO 8601 format
108
+ * (`date.toISOString()`): the WMS parameter of a `WMSTileLayer` (with `setParams()`) or
109
+ * the variable of the URL template of a `TileLayer` (e.g.
110
+ * `'https://…/{time}/{z}/{x}/{y}.png'`, with `setUrl()`). The tiles of the previous
111
+ * time stay visible until the new ones have loaded, and playing waits for them (the
112
+ * `load` event), so that no time is skipped with slow servers.
113
+ *
114
+ * Replaces the [Leaflet.TimeDimension](https://github.com/socib/Leaflet.TimeDimension)
115
+ * plugin for the common use cases.
116
+ *
117
+ * @example
118
+ * ```js
119
+ * const radar = new WMSTileLayer('https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi', {
120
+ * layers: 'nexrad-n0r-wmst',
121
+ * format: 'image/png',
122
+ * transparent: true
123
+ * }).addTo(map);
124
+ *
125
+ * new TimeControl({
126
+ * interval: '2013-05-20T18:00Z/2013-05-20T22:00Z',
127
+ * period: 'PT5M',
128
+ * layers: [radar],
129
+ * loop: true
130
+ * }).addTo(map);
131
+ *
132
+ * map.on('timechange', e => console.log(e.time));
133
+ * ```
134
+ *
135
+ * @fires MaplairMap#timechange {TimeChangeEvent} Fired when the current time of a
136
+ * `TimeControl` changes.
137
+ */
138
+ var TimeControl = class TimeControl extends Control {
139
+ static defaultOptions = {
140
+ position: "bottomleft",
141
+ times: void 0,
142
+ interval: void 0,
143
+ period: "P1D",
144
+ time: void 0,
145
+ layers: [],
146
+ transitionTime: 1e3,
147
+ loop: false,
148
+ formatTime: void 0
149
+ };
150
+ /**
151
+ * Creates a time control.
152
+ * @param {...TimeControlOptions} args The options.
153
+ */
154
+ constructor(...args) {
155
+ super(...args);
156
+ const { times, interval, period, time, layers } = this.options;
157
+ this._layers = [];
158
+ this._playing = false;
159
+ this._times = [];
160
+ this._index = -1;
161
+ this.setTimes(interval ? intervalTimes(interval, period) : times ?? [], time);
162
+ for (const layer of layers) this.addLayer(layer);
163
+ this.callInitHooks(TimeControl);
164
+ }
165
+ /**
166
+ * @internal
167
+ * @param {MaplairMap} map
168
+ * @returns {HTMLElement}
169
+ */
170
+ onAdd(map) {
171
+ const container = create("div", "maplair-bar maplair-control-time");
172
+ disableClickPropagation(container);
173
+ disableScrollPropagation(container);
174
+ this._previousButton = new ButtonControl({
175
+ className: "maplair-control-time-previous",
176
+ content: previousIcon,
177
+ title: I18n.translate("Step back"),
178
+ onClick: () => this.previous()
179
+ });
180
+ this._playButton = new ButtonControl({
181
+ className: "maplair-control-time-play",
182
+ states: [{
183
+ name: "play",
184
+ content: playIcon,
185
+ title: I18n.translate("Play"),
186
+ onClick: () => this.play()
187
+ }, {
188
+ name: "pause",
189
+ content: pauseIcon,
190
+ title: I18n.translate("Pause"),
191
+ onClick: () => this.pause()
192
+ }]
193
+ });
194
+ this._nextButton = new ButtonControl({
195
+ className: "maplair-control-time-next",
196
+ content: nextIcon,
197
+ title: I18n.translate("Step forward"),
198
+ onClick: () => this.next()
199
+ });
200
+ for (const button of [
201
+ this._previousButton,
202
+ this._playButton,
203
+ this._nextButton
204
+ ]) {
205
+ button._map = map;
206
+ button._createButton(container);
207
+ }
208
+ const slider = this._slider = create("input", "maplair-control-time-slider", container);
209
+ slider.type = "range";
210
+ slider.min = "0";
211
+ slider.step = "1";
212
+ slider.setAttribute("aria-label", I18n.translate("Time"));
213
+ on(slider, "input", this._onSliderInput, this);
214
+ this._label = create("span", "maplair-control-time-label", container);
215
+ this._formatter = new Intl.DateTimeFormat(I18n.getLocale() ?? void 0, {
216
+ dateStyle: "short",
217
+ timeStyle: "short"
218
+ });
219
+ this._updateControl();
220
+ return container;
221
+ }
222
+ /**
223
+ * @internal
224
+ */
225
+ onRemove() {
226
+ this.pause();
227
+ this._slider = null;
228
+ }
229
+ _onSliderInput() {
230
+ this.pause();
231
+ this._setIndex(Number(this._slider.value));
232
+ }
233
+ _updateControl() {
234
+ if (!this._slider) return;
235
+ const index = this._index, last = this._times.length - 1, time = this.getTime(), text = time ? (this.options.formatTime ?? this._formatter.format)(time) : "", loop = this.options.loop;
236
+ this._slider.max = String(Math.max(last, 0));
237
+ this._slider.value = String(Math.max(index, 0));
238
+ this._slider.disabled = last < 1;
239
+ this._slider.setAttribute("aria-valuetext", text);
240
+ this._label.textContent = text;
241
+ this._playButton.setState(this._playing ? "pause" : "play");
242
+ this._setDisabled(this._playButton, last < 1);
243
+ this._setDisabled(this._previousButton, last < 1 || index === 0 && !loop);
244
+ this._setDisabled(this._nextButton, last < 1 || index === last && !loop);
245
+ }
246
+ _setDisabled(button, disabled) {
247
+ if (disabled) button.disable();
248
+ else button.enable();
249
+ }
250
+ /**
251
+ * Sets the times to step through, see the [`times` option](#timecontrol-times), and
252
+ * shows the nearest of them to `time`, by default to the current time of the control.
253
+ * @param {(Date|number|string)[]} times
254
+ * @param {Date|number|string} [time]
255
+ * @returns {this}
256
+ */
257
+ setTimes(times, time = this.getTime()) {
258
+ this._times = times.map((t) => new Date(t));
259
+ this._index = -1;
260
+ if (this._times.length < 2) this.pause();
261
+ return this.setTime(time ?? Date.now());
262
+ }
263
+ /**
264
+ * Returns the times to step through.
265
+ * @returns {Date[]}
266
+ */
267
+ getTimes() {
268
+ return this._times;
269
+ }
270
+ /**
271
+ * Shows the nearest of the times to the given time.
272
+ * @param {Date|number|string} time
273
+ * @returns {this}
274
+ */
275
+ setTime(time) {
276
+ const ms = +new Date(time);
277
+ let index = this._times.length ? 0 : -1;
278
+ this._times.forEach((t, i) => {
279
+ if (Math.abs(+t - ms) < Math.abs(+this._times[index] - ms)) index = i;
280
+ });
281
+ return this._setIndex(index);
282
+ }
283
+ /**
284
+ * Returns the current time.
285
+ * @returns {Date|undefined}
286
+ */
287
+ getTime() {
288
+ return this._times[this._index];
289
+ }
290
+ _setIndex(index) {
291
+ if (index !== this._index) {
292
+ this._index = index;
293
+ for (const layer of this._layers) this._updateLayer(layer);
294
+ if (index >= 0) this._map?.fire("timechange", {
295
+ time: this.getTime(),
296
+ index
297
+ });
298
+ if (this._playing) this._schedule();
299
+ }
300
+ this._updateControl();
301
+ return this;
302
+ }
303
+ /**
304
+ * Shows the next time (or the first one after the last one if looping).
305
+ * @returns {this}
306
+ */
307
+ next() {
308
+ if (this._index < this._times.length - 1) this._setIndex(this._index + 1);
309
+ else if (this.options.loop && this._times.length > 1) this._setIndex(0);
310
+ return this;
311
+ }
312
+ /**
313
+ * Shows the previous time (or the last one before the first one if looping).
314
+ * @returns {this}
315
+ */
316
+ previous() {
317
+ if (this._index > 0) this._setIndex(this._index - 1);
318
+ else if (this.options.loop && this._times.length > 1) this._setIndex(this._times.length - 1);
319
+ return this;
320
+ }
321
+ /**
322
+ * Plays the times one after the other, each for at least the
323
+ * [`transitionTime`](#timecontrol-transitiontime) and until the layers have loaded.
324
+ * Starts at the first time if the last one is shown. Stops at the last time unless
325
+ * [looping](#timecontrol-loop).
326
+ * @returns {this}
327
+ */
328
+ play() {
329
+ if (this._playing || this._times.length < 2) return this;
330
+ this._playing = true;
331
+ if (this._index === this._times.length - 1) this._setIndex(0);
332
+ else {
333
+ this._schedule();
334
+ this._updateControl();
335
+ }
336
+ return this;
337
+ }
338
+ /**
339
+ * Stops playing.
340
+ * @returns {this}
341
+ */
342
+ pause() {
343
+ clearTimeout(this._timeout);
344
+ this._timeout = null;
345
+ if (this._playing) {
346
+ this._playing = false;
347
+ this._updateControl();
348
+ }
349
+ return this;
350
+ }
351
+ /**
352
+ * Returns `true` while playing.
353
+ * @returns {boolean}
354
+ */
355
+ isPlaying() {
356
+ return this._playing;
357
+ }
358
+ _schedule() {
359
+ clearTimeout(this._timeout);
360
+ this._timeout = setTimeout(() => {
361
+ this._timeout = null;
362
+ this._advance();
363
+ }, this.options.transitionTime);
364
+ }
365
+ _advance() {
366
+ if (!this._playing || this._timeout || this._layers.some((layer) => layer._map && layer.isLoading?.())) return;
367
+ if (this._index < this._times.length - 1 || this.options.loop) this.next();
368
+ else this.pause();
369
+ }
370
+ _updateLayer(layer) {
371
+ const time = this.getTime();
372
+ if (!time) return;
373
+ if (typeof layer.setTime === "function") layer.setTime(time);
374
+ else if (typeof layer.setParams === "function") layer.setParams({ time: time.toISOString() });
375
+ else if (typeof layer.setUrl === "function") {
376
+ layer.options.time = time.toISOString();
377
+ layer.setUrl(layer._url, false);
378
+ }
379
+ }
380
+ /**
381
+ * Adds a layer showing the current time, see the [`layers` option](#timecontrol-layers).
382
+ * The layer still has to be added to the map.
383
+ * @param {Layer & TimeLayer} layer
384
+ * @returns {this}
385
+ */
386
+ addLayer(layer) {
387
+ if (this._layers.includes(layer)) return this;
388
+ this._layers.push(layer);
389
+ layer.on("load remove", this._advance, this);
390
+ this._updateLayer(layer);
391
+ return this;
392
+ }
393
+ /**
394
+ * Removes a layer from the layers showing the current time.
395
+ * @param {Layer} layer
396
+ * @returns {this}
397
+ */
398
+ removeLayer(layer) {
399
+ this._layers = this._layers.filter((l) => l !== layer);
400
+ layer.off("load remove", this._advance, this);
401
+ this._advance();
402
+ return this;
403
+ }
404
+ };
405
+ export { TimeControl };
406
+
407
+ //# sourceMappingURL=TimeControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeControl.js","names":["DomUtil.create"],"sources":["../../../src/control/TimeControl.js"],"sourcesContent":["import {Control} from './Control.js';\nimport {ButtonControl} from './ButtonControl.js';\nimport * as DomUtil from '../dom/DomUtil.js';\nimport * as DomEvent from '../dom/DomEvent.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 {MaplairEvent} from '../core/Events.js' */\n\nconst icon = path => `<svg aria-hidden=\"true\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\"><path d=\"${path}\"/></svg>`;\nconst previousIcon = icon('M3 3h2v10H3zm10 0v10L6 8z'),\nplayIcon = icon('M4 2v12l10-6z'),\npauseIcon = icon('M4 3h3v10H4zm5 0h3v10H9z'),\nnextIcon = icon('M11 3h2v10h-2zM3 3v10l7-5z');\n\nconst durationRe = /^P(?:(\\d+)Y)?(?:(\\d+)M)?(?:(\\d+)W)?(?:(\\d+)D)?(?:T(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)S)?)?$/;\n\n// Parses an ISO 8601 duration like `'PT5M'` or `'P1Y2M'` into calendar years and months\n// and the milliseconds of the units with a fixed length\nfunction parseDuration(duration) {\n\tconst match = durationRe.exec(duration);\n\tif (!match || duration === 'P' || duration.endsWith('T')) {\n\t\tthrow new Error(`Invalid or unsupported ISO 8601 duration \"${duration}\".`);\n\t}\n\tconst [years, months, weeks, days, hours, minutes, seconds] = match.slice(1).map(n => Number(n ?? 0));\n\treturn {years, months, ms: ((((weeks * 7 + days) * 24 + hours) * 60 + minutes) * 60 + seconds) * 1000};\n}\n\n// Returns the time `n` times the duration after the given time, adding years and months in UTC\nfunction addDuration(time, duration, n) {\n\tconst date = new Date(time);\n\tdate.setUTCFullYear(date.getUTCFullYear() + n * duration.years, date.getUTCMonth() + n * duration.months);\n\treturn new Date(+date + n * duration.ms);\n}\n\nfunction parseDate(date) {\n\tconst time = Date.parse(date);\n\tif (Number.isNaN(time)) {\n\t\tthrow new Error(`Invalid date \"${date}\".`);\n\t}\n\treturn new Date(time);\n}\n\n// Returns the times of an ISO 8601 interval (start/end, start/duration or duration/end,\n// optionally with the period as third part), every period from the start\nfunction intervalTimes(interval, period) {\n\tconst parts = interval.split('/');\n\tif (parts.length === 3) {\n\t\tperiod = parts.pop();\n\t}\n\tif (parts.length !== 2) {\n\t\tthrow new Error(`Invalid ISO 8601 interval \"${interval}\".`);\n\t}\n\tconst [first, second] = parts,\n\tstep = parseDuration(period);\n\tlet start, end;\n\tif (first.startsWith('P')) {\n\t\tend = parseDate(second);\n\t\tstart = addDuration(end, parseDuration(first), -1);\n\t} else {\n\t\tstart = parseDate(first);\n\t\tend = second.startsWith('P') ? addDuration(start, parseDuration(second), 1) : parseDate(second);\n\t}\n\tif (!(addDuration(start, step, 1) > start)) {\n\t\tthrow new Error(`The period \"${period}\" has to be positive.`);\n\t}\n\tconst times = [];\n\tfor (let i = 0, time = start; time <= end; time = addDuration(start, step, ++i)) {\n\t\ttimes.push(time);\n\t}\n\treturn times;\n}\n\n/**\n * Options of `TimeControl`.\n * @typedef {object} TimeControlOptions\n * @property {string} [position='bottomleft'] The position of the control (one of the map\n * corners). Possible values are `'topleft'`, `'topright'`, `'bottomleft'` or\n * `'bottomright'`.\n * @property {(Date|number|string)[]} [times] The times to step through in ascending\n * order: dates, timestamps or date strings (parsed with `Date.parse()`).\n * @property {string} [interval] Instead of `times`, an ISO 8601 time interval whose times\n * every [`period`](#timecontrol-period) from the start up to the end are stepped\n * through: `start/end` (e.g. `'2026-10-17T00:00Z/2026-10-18T00:00Z'`), `start/duration`\n * (e.g. `'2026-10-17T00:00Z/P1D'`) or `duration/end` (e.g. `'PT24H/2026-10-18T00:00Z'`).\n * A third part is the period, as in the time dimension of WMS capabilities (e.g.\n * `'2026-10-17T00:00Z/2026-10-18T00:00Z/PT5M'`). Start and end are parsed with\n * `Date.parse()`, e.g. `2026-10-17`, `2026-10-17T12:00Z` or\n * `2026-10-17T12:00:00.000+02:00` (without a time zone, times are local times).\n * @property {string} [period='P1D'] The ISO 8601 duration between the times of the\n * `interval`: integer numbers of years, months, weeks, days, hours, minutes and seconds,\n * e.g. `'PT1H'`, `'PT5M'`, `'P1DT12H'` or `'P1M'` (years and months are added in UTC).\n * @property {Date|number|string} [time] The initial time (the nearest of the times), by\n * default the current time.\n * @property {(Layer & TimeLayer)[]} [layers=[]] The layers showing the current time, see\n * `addLayer()`.\n * @property {number} [transitionTime=1000] The minimum time in milliseconds a time is\n * shown while playing. The next time is shown only after the layers have loaded, too.\n * @property {boolean} [loop=false] Whether playing starts over after the last time\n * instead of stopping, and the buttons step from the last time to the first one and\n * back.\n * @property {(date: Date) => string} [formatTime] Returns the text of the label for a\n * time, by default the date and time by `Intl.DateTimeFormat` in the [locale](#i18n)\n * (or the browser's language) and the browser's time zone.\n * @extends ControlOptions\n */\n\n/**\n * A layer showing a given time, see `TimeControl`.\n * @typedef {object} TimeLayer\n * @property {(date: Date) => any} [setTime] Shows the given time.\n */\n\n/**\n * The event object of `timechange`.\n * @typedef {object} TimeChangeEvent\n * @property {Date} time The current time.\n * @property {number} index The index of the current time in the times of the control.\n * @extends MaplairEvent\n */\n\n/**\n * A control to step through or play the times of time-dependent layers, e.g. an\n * animated weather radar from a WMS with a `TIME` dimension. It has buttons for the\n * previous and next time and to play or pause, a slider (usable with the arrow, Home\n * and End keys) and a label with the current time.\n *\n * Each of the `layers` shows the current time: by its method `setTime(date)` if it has\n * one, otherwise by the parameter `time` set to the time in ISO 8601 format\n * (`date.toISOString()`): the WMS parameter of a `WMSTileLayer` (with `setParams()`) or\n * the variable of the URL template of a `TileLayer` (e.g.\n * `'https://…/{time}/{z}/{x}/{y}.png'`, with `setUrl()`). The tiles of the previous\n * time stay visible until the new ones have loaded, and playing waits for them (the\n * `load` event), so that no time is skipped with slow servers.\n *\n * Replaces the [Leaflet.TimeDimension](https://github.com/socib/Leaflet.TimeDimension)\n * plugin for the common use cases.\n *\n * @example\n * ```js\n * const radar = new WMSTileLayer('https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi', {\n * \tlayers: 'nexrad-n0r-wmst',\n * \tformat: 'image/png',\n * \ttransparent: true\n * }).addTo(map);\n *\n * new TimeControl({\n * \tinterval: '2013-05-20T18:00Z/2013-05-20T22:00Z',\n * \tperiod: 'PT5M',\n * \tlayers: [radar],\n * \tloop: true\n * }).addTo(map);\n *\n * map.on('timechange', e => console.log(e.time));\n * ```\n *\n * @fires MaplairMap#timechange {TimeChangeEvent} Fired when the current time of a\n * `TimeControl` changes.\n */\nexport class TimeControl extends Control {\n\n\tstatic defaultOptions = {\n\t\tposition: 'bottomleft',\n\t\ttimes: undefined,\n\t\tinterval: undefined,\n\t\tperiod: 'P1D',\n\t\ttime: undefined,\n\t\tlayers: [],\n\t\ttransitionTime: 1000,\n\t\tloop: false,\n\t\tformatTime: undefined\n\t};\n\n\t/**\n\t * Creates a time control.\n\t * @param {...TimeControlOptions} args The options.\n\t */\n\tconstructor(...args) {\n\t\tsuper(...args);\n\t\tconst {times, interval, period, time, layers} = this.options;\n\t\tthis._layers = [];\n\t\tthis._playing = false;\n\t\tthis._times = [];\n\t\tthis._index = -1;\n\t\tthis.setTimes(interval ? intervalTimes(interval, period) : times ?? [], time);\n\t\tfor (const layer of layers) {\n\t\t\tthis.addLayer(layer);\n\t\t}\n\t\tthis.callInitHooks(TimeControl);\n\t}\n\n\t/**\n\t * @internal\n\t * @param {MaplairMap} map\n\t * @returns {HTMLElement}\n\t */\n\tonAdd(map) {\n\t\tconst container = DomUtil.create('div', 'maplair-bar maplair-control-time');\n\t\tDomEvent.disableClickPropagation(container);\n\t\tDomEvent.disableScrollPropagation(container);\n\n\t\tthis._previousButton = new ButtonControl({\n\t\t\tclassName: 'maplair-control-time-previous',\n\t\t\tcontent: previousIcon,\n\t\t\ttitle: I18n.translate('Step back'),\n\t\t\tonClick: () => this.previous()\n\t\t});\n\t\tthis._playButton = new ButtonControl({\n\t\t\tclassName: 'maplair-control-time-play',\n\t\t\tstates: [\n\t\t\t\t{name: 'play', content: playIcon, title: I18n.translate('Play'), onClick: () => this.play()},\n\t\t\t\t{name: 'pause', content: pauseIcon, title: I18n.translate('Pause'), onClick: () => this.pause()}\n\t\t\t]\n\t\t});\n\t\tthis._nextButton = new ButtonControl({\n\t\t\tclassName: 'maplair-control-time-next',\n\t\t\tcontent: nextIcon,\n\t\t\ttitle: I18n.translate('Step forward'),\n\t\t\tonClick: () => this.next()\n\t\t});\n\t\tfor (const button of [this._previousButton, this._playButton, this._nextButton]) {\n\t\t\tbutton._map = map;\n\t\t\tbutton._createButton(container);\n\t\t}\n\n\t\tconst slider = this._slider = DomUtil.create('input', 'maplair-control-time-slider', container);\n\t\tslider.type = 'range';\n\t\tslider.min = '0';\n\t\tslider.step = '1';\n\t\tslider.setAttribute('aria-label', I18n.translate('Time'));\n\t\tDomEvent.on(slider, 'input', this._onSliderInput, this);\n\n\t\tthis._label = DomUtil.create('span', 'maplair-control-time-label', container);\n\n\t\tthis._formatter = new Intl.DateTimeFormat(I18n.getLocale() ?? undefined, {dateStyle: 'short', timeStyle: 'short'});\n\t\tthis._updateControl();\n\t\treturn container;\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tonRemove() {\n\t\tthis.pause();\n\t\tthis._slider = null;\n\t}\n\n\t_onSliderInput() {\n\t\tthis.pause();\n\t\tthis._setIndex(Number(this._slider.value));\n\t}\n\n\t_updateControl() {\n\t\tif (!this._slider) { return; }\n\t\tconst index = this._index,\n\t\tlast = this._times.length - 1,\n\t\ttime = this.getTime(),\n\t\ttext = time ? (this.options.formatTime ?? this._formatter.format)(time) : '',\n\t\tloop = this.options.loop;\n\n\t\tthis._slider.max = String(Math.max(last, 0));\n\t\tthis._slider.value = String(Math.max(index, 0));\n\t\tthis._slider.disabled = last < 1;\n\t\tthis._slider.setAttribute('aria-valuetext', text);\n\t\tthis._label.textContent = text;\n\n\t\tthis._playButton.setState(this._playing ? 'pause' : 'play');\n\t\tthis._setDisabled(this._playButton, last < 1);\n\t\tthis._setDisabled(this._previousButton, last < 1 || (index === 0 && !loop));\n\t\tthis._setDisabled(this._nextButton, last < 1 || (index === last && !loop));\n\t}\n\n\t_setDisabled(button, disabled) {\n\t\tif (disabled) {\n\t\t\tbutton.disable();\n\t\t} else {\n\t\t\tbutton.enable();\n\t\t}\n\t}\n\n\t/**\n\t * Sets the times to step through, see the [`times` option](#timecontrol-times), and\n\t * shows the nearest of them to `time`, by default to the current time of the control.\n\t * @param {(Date|number|string)[]} times\n\t * @param {Date|number|string} [time]\n\t * @returns {this}\n\t */\n\tsetTimes(times, time = this.getTime()) {\n\t\tthis._times = times.map(t => new Date(t));\n\t\tthis._index = -1;\n\t\tif (this._times.length < 2) {\n\t\t\tthis.pause();\n\t\t}\n\t\treturn this.setTime(time ?? Date.now());\n\t}\n\n\t/**\n\t * Returns the times to step through.\n\t * @returns {Date[]}\n\t */\n\tgetTimes() {\n\t\treturn this._times;\n\t}\n\n\t/**\n\t * Shows the nearest of the times to the given time.\n\t * @param {Date|number|string} time\n\t * @returns {this}\n\t */\n\tsetTime(time) {\n\t\tconst ms = +new Date(time);\n\t\tlet index = this._times.length ? 0 : -1;\n\t\tthis._times.forEach((t, i) => {\n\t\t\tif (Math.abs(+t - ms) < Math.abs(+this._times[index] - ms)) {\n\t\t\t\tindex = i;\n\t\t\t}\n\t\t});\n\t\treturn this._setIndex(index);\n\t}\n\n\t/**\n\t * Returns the current time.\n\t * @returns {Date|undefined}\n\t */\n\tgetTime() {\n\t\treturn this._times[this._index];\n\t}\n\n\t_setIndex(index) {\n\t\tif (index !== this._index) {\n\t\t\tthis._index = index;\n\t\t\tfor (const layer of this._layers) {\n\t\t\t\tthis._updateLayer(layer);\n\t\t\t}\n\t\t\tif (index >= 0) {\n\t\t\t\tthis._map?.fire('timechange', {time: this.getTime(), index});\n\t\t\t}\n\t\t\tif (this._playing) {\n\t\t\t\tthis._schedule();\n\t\t\t}\n\t\t}\n\t\tthis._updateControl();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Shows the next time (or the first one after the last one if looping).\n\t * @returns {this}\n\t */\n\tnext() {\n\t\tif (this._index < this._times.length - 1) {\n\t\t\tthis._setIndex(this._index + 1);\n\t\t} else if (this.options.loop && this._times.length > 1) {\n\t\t\tthis._setIndex(0);\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Shows the previous time (or the last one before the first one if looping).\n\t * @returns {this}\n\t */\n\tprevious() {\n\t\tif (this._index > 0) {\n\t\t\tthis._setIndex(this._index - 1);\n\t\t} else if (this.options.loop && this._times.length > 1) {\n\t\t\tthis._setIndex(this._times.length - 1);\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Plays the times one after the other, each for at least the\n\t * [`transitionTime`](#timecontrol-transitiontime) and until the layers have loaded.\n\t * Starts at the first time if the last one is shown. Stops at the last time unless\n\t * [looping](#timecontrol-loop).\n\t * @returns {this}\n\t */\n\tplay() {\n\t\tif (this._playing || this._times.length < 2) { return this; }\n\t\tthis._playing = true;\n\t\tif (this._index === this._times.length - 1) {\n\t\t\t// also schedules the next time\n\t\t\tthis._setIndex(0);\n\t\t} else {\n\t\t\tthis._schedule();\n\t\t\tthis._updateControl();\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Stops playing.\n\t * @returns {this}\n\t */\n\tpause() {\n\t\tclearTimeout(this._timeout);\n\t\tthis._timeout = null;\n\t\tif (this._playing) {\n\t\t\tthis._playing = false;\n\t\t\tthis._updateControl();\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns `true` while playing.\n\t * @returns {boolean}\n\t */\n\tisPlaying() {\n\t\treturn this._playing;\n\t}\n\n\t// Shows the next time after the transition time, once the layers have loaded\n\t_schedule() {\n\t\tclearTimeout(this._timeout);\n\t\tthis._timeout = setTimeout(() => {\n\t\t\tthis._timeout = null;\n\t\t\tthis._advance();\n\t\t}, this.options.transitionTime);\n\t}\n\n\t_advance() {\n\t\tif (!this._playing || this._timeout || this._layers.some(layer => layer._map && layer.isLoading?.())) { return; }\n\t\tif (this._index < this._times.length - 1 || this.options.loop) {\n\t\t\tthis.next();\n\t\t} else {\n\t\t\tthis.pause();\n\t\t}\n\t}\n\n\t_updateLayer(layer) {\n\t\tconst time = this.getTime();\n\t\tif (!time) { return; }\n\t\tif (typeof layer.setTime === 'function') {\n\t\t\tlayer.setTime(time);\n\t\t} else if (typeof layer.setParams === 'function') {\n\t\t\tlayer.setParams({time: time.toISOString()});\n\t\t} else if (typeof layer.setUrl === 'function') {\n\t\t\tlayer.options.time = time.toISOString();\n\t\t\tlayer.setUrl(layer._url, false);\n\t\t}\n\t}\n\n\t/**\n\t * Adds a layer showing the current time, see the [`layers` option](#timecontrol-layers).\n\t * The layer still has to be added to the map.\n\t * @param {Layer & TimeLayer} layer\n\t * @returns {this}\n\t */\n\taddLayer(layer) {\n\t\tif (this._layers.includes(layer)) { return this; }\n\t\tthis._layers.push(layer);\n\t\tlayer.on('load remove', this._advance, this);\n\t\tthis._updateLayer(layer);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes a layer from the layers showing the current time.\n\t * @param {Layer} layer\n\t * @returns {this}\n\t */\n\tremoveLayer(layer) {\n\t\tthis._layers = this._layers.filter(l => l !== layer);\n\t\tlayer.off('load remove', this._advance, this);\n\t\tthis._advance();\n\t\treturn this;\n\t}\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAM,QAAO,SAAQ,mGAAmG,KAAK;AAC7H,MAAM,eAAe,KAAK,2BAA2B;AACrD,MAAA,WAAW,KAAK,eAAe;AAC/B,MAAA,YAAY,KAAK,0BAA0B;AAC3C,MAAA,WAAW,KAAK,4BAA4B;AAE5C,MAAM,aAAa;AAInB,SAAS,cAAc,UAAU;CAChC,MAAM,QAAQ,WAAW,KAAK,QAAQ;CACtC,IAAI,CAAC,SAAS,aAAa,OAAO,SAAS,SAAS,GAAG,GACtD,MAAM,IAAI,MAAM,6CAA6C,SAAS,GAAG;CAE1E,MAAM,CAAC,OAAO,QAAQ,OAAO,MAAM,OAAO,SAAS,WAAW,MAAM,MAAM,CAAC,CAAC,CAAC,KAAI,MAAK,OAAO,KAAK,CAAC,CAAC;CACpG,OAAO;EAAC;EAAO;EAAQ,QAAQ,QAAQ,IAAI,QAAQ,KAAK,SAAS,KAAK,WAAW,KAAK,WAAW;CAAI;AACtG;AAGA,SAAS,YAAY,MAAM,UAAU,GAAG;CACvC,MAAM,OAAO,IAAI,KAAK,IAAI;CAC1B,KAAK,eAAe,KAAK,eAAe,IAAI,IAAI,SAAS,OAAO,KAAK,YAAY,IAAI,IAAI,SAAS,MAAM;CACxG,OAAO,IAAI,KAAK,CAAC,OAAO,IAAI,SAAS,EAAE;AACxC;AAEA,S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;CAOA,YAAY,OAAO;EAClB,KAAK,UAAU,KAAK,QAAQ,QAAO,MAAK,MAAM,KAAK;EACnD,MAAM,IAAI,eAAe,KAAK,UAAU,IAAI;EAC5C,KAAK,SAAS;EACd,OAAO;CACR;AACD"}
@@ -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/ZoomControl.js
5
+ // src/control/ZoomControl.js
6
6
  /** @import {ControlOptions} from './Control.js' */
7
7
  /** @import {MaplairMap} from '../map/Map.js' */
8
8
  /**
@@ -36,13 +36,11 @@ import { I18n } from "../core/I18n.js";
36
36
  * default unless you set its [`zoomControl` option](#map-zoomcontrol) to `false`.
37
37
  */
38
38
  var ZoomControl = class ZoomControl extends Control {
39
- static {
40
- this.setDefaultOptions({
41
- position: "topleft",
42
- zoomInText: "<span aria-hidden=\"true\">+</span>",
43
- zoomOutText: "<span aria-hidden=\"true\">&#x2212;</span>"
44
- });
45
- }
39
+ static defaultOptions = {
40
+ position: "topleft",
41
+ zoomInText: "<span aria-hidden=\"true\">+</span>",
42
+ zoomOutText: "<span aria-hidden=\"true\">&#x2212;</span>"
43
+ };
46
44
  /**
47
45
  * Creates a zoom control.
48
46
  * @param {...ZoomControlOptions} args The options.
@@ -58,8 +56,8 @@ var ZoomControl = class ZoomControl extends Control {
58
56
  */
59
57
  onAdd(map) {
60
58
  const zoomName = "maplair-control-zoom", container = create("div", `${zoomName} maplair-bar`), options = this.options;
61
- this._zoomInButton = this._createButton(options.zoomInText, I18n.translate("Zoom in"), `${zoomName}-in`, container, this._zoomIn);
62
- this._zoomOutButton = this._createButton(options.zoomOutText, I18n.translate("Zoom out"), `${zoomName}-out`, container, this._zoomOut);
59
+ this._zoomInButton = this._createButton(options.zoomInText, I18n.translate("Zoom in"), `${zoomName}-in`, container, (e) => this._zoom(e, 1));
60
+ this._zoomOutButton = this._createButton(options.zoomOutText, I18n.translate("Zoom out"), `${zoomName}-out`, container, (e) => this._zoom(e, -1));
63
61
  this._updateDisabled();
64
62
  map.on("zoomend zoomlevelschange", this._updateDisabled, this);
65
63
  return container;
@@ -89,16 +87,11 @@ var ZoomControl = class ZoomControl extends Control {
89
87
  this._updateDisabled();
90
88
  return this;
91
89
  }
92
- _zoomIn(e) {
93
- if (!this._disabled && this._map._zoom < this._map.getMaxZoom()) {
94
- this._map._setUserEvent(e);
95
- this._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));
96
- }
97
- }
98
- _zoomOut(e) {
99
- if (!this._disabled && this._map._zoom > this._map.getMinZoom()) {
100
- this._map._setUserEvent(e);
101
- this._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));
90
+ _zoom(e, dir) {
91
+ const map = this._map;
92
+ if (!this._disabled && (dir > 0 ? map._zoom < map.getMaxZoom() : map._zoom > map.getMinZoom())) {
93
+ map._setUserEvent(e);
94
+ map.zoomIn(dir * map.options.zoomDelta * (e.shiftKey ? 3 : 1));
102
95
  }
103
96
  }
104
97
  _createButton(html, title, className, container, fn) {
@@ -108,24 +101,19 @@ var ZoomControl = class ZoomControl extends Control {
108
101
  link.title = title;
109
102
  link.setAttribute("aria-label", title);
110
103
  disableClickPropagation(link);
111
- on(link, "click", stop);
112
- on(link, "click", fn, this);
113
- on(link, "click", this._refocusOnMap, this);
104
+ on(link, "click", (e) => {
105
+ stop(e);
106
+ fn.call(this, e);
107
+ this._refocusOnMap(e);
108
+ });
114
109
  return link;
115
110
  }
116
111
  _updateDisabled() {
117
- const map = this._map, className = "maplair-disabled";
118
- this._zoomInButton.classList.remove(className);
119
- this._zoomOutButton.classList.remove(className);
120
- this._zoomInButton.setAttribute("aria-disabled", "false");
121
- this._zoomOutButton.setAttribute("aria-disabled", "false");
122
- if (this._disabled || map._zoom === map.getMinZoom()) {
123
- this._zoomOutButton.classList.add(className);
124
- this._zoomOutButton.setAttribute("aria-disabled", "true");
125
- }
126
- if (this._disabled || map._zoom === map.getMaxZoom()) {
127
- this._zoomInButton.classList.add(className);
128
- this._zoomInButton.setAttribute("aria-disabled", "true");
112
+ const map = this._map;
113
+ for (const [button, limit] of [[this._zoomInButton, map.getMaxZoom()], [this._zoomOutButton, map.getMinZoom()]]) {
114
+ const disabled = this._disabled || map._zoom === limit;
115
+ button.classList.toggle("maplair-disabled", disabled);
116
+ button.setAttribute("aria-disabled", `${disabled}`);
129
117
  }
130
118
  }
131
119
  /**
@@ -143,7 +131,6 @@ var ZoomControl = class ZoomControl extends Control {
143
131
  });
144
132
  }
145
133
  };
146
- //#endregion
147
134
  export { ZoomControl };
148
135
 
149
136
  //# sourceMappingURL=ZoomControl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ZoomControl.js","names":["DomUtil.create","DomEvent.stop"],"sources":["../../../src/control/ZoomControl.js"],"sourcesContent":["\nimport {Control} from './Control.js';\nimport * as DomUtil from '../dom/DomUtil.js';\nimport * as DomEvent from '../dom/DomEvent.js';\nimport {I18n} from '../core/I18n.js';\n/** @import {ControlOptions} from './Control.js' */\n/** @import {MaplairMap} from '../map/Map.js' */\n\n/**\n * Options of `ZoomControl`.\n * @typedef {object} ZoomControlOptions\n * @property {string} [position='topleft'] The position of the control (one of the map\n * corners). Possible values are `'topleft'`, `'topright'`, `'bottomleft'` or\n * `'bottomright'`.\n * @property {string} [zoomInText='<span aria-hidden=\"true\">+</span>'] The text set on\n * the 'zoom in' button.\n * @property {string} [zoomOutText='<span aria-hidden=\"true\">&#x2212;</span>'] The text\n * set on the 'zoom out' button.\n * @extends ControlOptions\n */\n\n/**\n * Map options of `ZoomControl`.\n * @typedef {object} ZoomControlMapOptions\n * @lends MaplairMapOptions\n * @property {boolean} [zoomControl=true] Whether a [zoom control](#control-zoom) is\n * added to the map by default.\n */\n\n/**\n * Properties of `MaplairMap` set by `ZoomControl`.\n * @typedef {object} ZoomControlMapProperties\n * @lends MaplairMap\n * @property {ZoomControl} zoomControl The default zoom control (only available if the\n * [`zoomControl` option](#map-zoomcontrol) was `true` when creating the map).\n */\n\n/**\n * A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by\n * default unless you set its [`zoomControl` option](#map-zoomcontrol) to `false`.\n */\nexport class ZoomControl extends Control {\n\n\tstatic {\n\t\tthis.setDefaultOptions({\n\t\t\tposition: 'topleft',\n\t\t\tzoomInText: '<span aria-hidden=\"true\">+</span>',\n\t\t\tzoomOutText: '<span aria-hidden=\"true\">&#x2212;</span>',\n\t\t});\n\t}\n\n\t/**\n\t * Creates a zoom control.\n\t * @param {...ZoomControlOptions} args The options.\n\t */\n\tconstructor(...args) {\n\t\tsuper(...args);\n\t\tthis.callInitHooks(ZoomControl);\n\t}\n\n\t/**\n\t * @internal\n\t * @param {MaplairMap} map\n\t * @returns {HTMLElement}\n\t */\n\tonAdd(map) {\n\t\tconst zoomName = 'maplair-control-zoom',\n\t\tcontainer = DomUtil.create('div', `${zoomName} maplair-bar`),\n\t\toptions = this.options;\n\n\t\tthis._zoomInButton = this._createButton(options.zoomInText, I18n.translate('Zoom in'),\n\t\t\t`${zoomName}-in`, container, this._zoomIn);\n\t\tthis._zoomOutButton = this._createButton(options.zoomOutText, I18n.translate('Zoom out'),\n\t\t\t`${zoomName}-out`, container, this._zoomOut);\n\n\t\tthis._updateDisabled();\n\t\tmap.on('zoomend zoomlevelschange', this._updateDisabled, this);\n\n\t\treturn container;\n\t}\n\n\t/**\n\t * @internal\n\t * @param {MaplairMap} map\n\t */\n\tonRemove(map) {\n\t\tmap.off('zoomend zoomlevelschange', this._updateDisabled, this);\n\t}\n\n\t/**\n\t * Disables the zoom buttons.\n\t * @returns {this}\n\t */\n\tdisable() {\n\t\tthis._disabled = true;\n\t\tthis._updateDisabled();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Enables the zoom buttons (if the zoom level allows).\n\t * @returns {this}\n\t */\n\tenable() {\n\t\tthis._disabled = false;\n\t\tthis._updateDisabled();\n\t\treturn this;\n\t}\n\n\t_zoomIn(e) {\n\t\tif (!this._disabled && this._map._zoom < this._map.getMaxZoom()) {\n\t\t\tthis._map._setUserEvent(e);\n\t\t\tthis._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));\n\t\t}\n\t}\n\n\t_zoomOut(e) {\n\t\tif (!this._disabled && this._map._zoom > this._map.getMinZoom()) {\n\t\t\tthis._map._setUserEvent(e);\n\t\t\tthis._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));\n\t\t}\n\t}\n\n\t_createButton(html, title, className, container, fn) {\n\t\tconst link = DomUtil.create('button', className, container);\n\t\tlink.type = 'button';\n\t\tlink.innerHTML = html;\n\t\tlink.title = title;\n\t\tlink.setAttribute('aria-label', title);\n\n\t\tDomEvent.disableClickPropagation(link);\n\t\tDomEvent.on(link, 'click', DomEvent.stop);\n\t\tDomEvent.on(link, 'click', fn, this);\n\t\tDomEvent.on(link, 'click', this._refocusOnMap, this);\n\n\t\treturn link;\n\t}\n\n\t_updateDisabled() {\n\t\tconst map = this._map,\n\t\tclassName = 'maplair-disabled';\n\n\t\tthis._zoomInButton.classList.remove(className);\n\t\tthis._zoomOutButton.classList.remove(className);\n\t\tthis._zoomInButton.setAttribute('aria-disabled', 'false');\n\t\tthis._zoomOutButton.setAttribute('aria-disabled', 'false');\n\n\t\tif (this._disabled || map._zoom === map.getMinZoom()) {\n\t\t\tthis._zoomOutButton.classList.add(className);\n\t\t\tthis._zoomOutButton.setAttribute('aria-disabled', 'true');\n\t\t}\n\t\tif (this._disabled || map._zoom === map.getMaxZoom()) {\n\t\t\tthis._zoomInButton.classList.add(className);\n\t\t\tthis._zoomInButton.setAttribute('aria-disabled', 'true');\n\t\t}\n\t}\n\n\t/**\n\t * Registers this default feature on the map class, called by `MaplairMap` itself.\n\t * @internal\n\t * @param {typeof MaplairMap} MaplairMap\n\t */\n\tstatic register(MaplairMap) {\n\t\tMaplairMap.mergeOptions({\n\t\t\tzoomControl: true\n\t\t});\n\n\t\tMaplairMap.addInitHook(function () {\n\t\t\tif (this.options.zoomControl) {\n\t\t\t\tthis.zoomControl = new ZoomControl();\n\t\t\t\tthis.addControl(this.zoomControl);\n\t\t\t}\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,cAAb,MAAa,oBAAoB,QAAQ;CAExC;EACC,KAAK,kBAAkB;GACtB,UAAU;GACV,YAAY;GACZ,aAAa;EACd,CAAC;CACF;;;;;CAMA,YAAY,GAAG,MAAM;EACpB,MAAM,GAAG,IAAI;EACb,KAAK,cAAc,WAAW;CAC/B;;;;;;CAOA,MAAM,KAAK;EACV,MAAM,WAAW,wBACjB,YAAYA,OAAe,OAAO,GAAG,SAAS,aAAa,GAC3D,UAAU,KAAK;EAEf,KAAK,gBAAiB,KAAK,cAAc,QAAQ,YAAY,KAAK,UAAU,SAAS,GACpF,GAAG,SAAS,MAAO,WAAW,KAAK,OAAO;EAC3C,KAAK,iBAAiB,KAAK,cAAc,QAAQ,aAAa,KAAK,UAAU,UAAU,GACtF,GAAG,SAAS,OAAO,WAAW,KAAK,QAAQ;EAE5C,KAAK,gBAAgB;EACrB,IAAI,GAAG,4BAA4B,KAAK,iBAAiB,IAAI;EAE7D,OAAO;CACR;;;;;CAMA,SAAS,KAAK;EACb,IAAI,IAAI,4BAA4B,KAAK,iBAAiB,IAAI;CAC/D;;;;;CAMA,UAAU;EACT,KAAK,YAAY;EACjB,KAAK,gBAAgB;EACrB,OAAO;CACR;;;;;CAMA,SAAS;EACR,KAAK,YAAY;EACjB,KAAK,gBAAgB;EACrB,OAAO;CACR;CAEA,QAAQ,GAAG;EACV,IAAI,CAAC,KAAK,aAAa,KAAK,KAAK,QAAQ,KAAK,KAAK,WAAW,GAAG;GAChE,KAAK,KAAK,cAAc,CAAC;GACzB,KAAK,KAAK,OAAO,KAAK,KAAK,QAAQ,aAAa,EAAE,WAAW,IAAI,EAAE;EACpE;CACD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,"file":"ZoomControl.js","names":["DomUtil.create"],"sources":["../../../src/control/ZoomControl.js"],"sourcesContent":["\nimport {Control} from './Control.js';\nimport * as DomUtil from '../dom/DomUtil.js';\nimport * as DomEvent from '../dom/DomEvent.js';\nimport {I18n} from '../core/I18n.js';\n/** @import {ControlOptions} from './Control.js' */\n/** @import {MaplairMap} from '../map/Map.js' */\n\n/**\n * Options of `ZoomControl`.\n * @typedef {object} ZoomControlOptions\n * @property {string} [position='topleft'] The position of the control (one of the map\n * corners). Possible values are `'topleft'`, `'topright'`, `'bottomleft'` or\n * `'bottomright'`.\n * @property {string} [zoomInText='<span aria-hidden=\"true\">+</span>'] The text set on\n * the 'zoom in' button.\n * @property {string} [zoomOutText='<span aria-hidden=\"true\">&#x2212;</span>'] The text\n * set on the 'zoom out' button.\n * @extends ControlOptions\n */\n\n/**\n * Map options of `ZoomControl`.\n * @typedef {object} ZoomControlMapOptions\n * @lends MaplairMapOptions\n * @property {boolean} [zoomControl=true] Whether a [zoom control](#control-zoom) is\n * added to the map by default.\n */\n\n/**\n * Properties of `MaplairMap` set by `ZoomControl`.\n * @typedef {object} ZoomControlMapProperties\n * @lends MaplairMap\n * @property {ZoomControl} zoomControl The default zoom control (only available if the\n * [`zoomControl` option](#map-zoomcontrol) was `true` when creating the map).\n */\n\n/**\n * A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by\n * default unless you set its [`zoomControl` option](#map-zoomcontrol) to `false`.\n */\nexport class ZoomControl extends Control {\n\n\tstatic defaultOptions = {\n\t\tposition: 'topleft',\n\t\tzoomInText: '<span aria-hidden=\"true\">+</span>',\n\t\tzoomOutText: '<span aria-hidden=\"true\">&#x2212;</span>',\n\t};\n\n\t/**\n\t * Creates a zoom control.\n\t * @param {...ZoomControlOptions} args The options.\n\t */\n\tconstructor(...args) {\n\t\tsuper(...args);\n\t\tthis.callInitHooks(ZoomControl);\n\t}\n\n\t/**\n\t * @internal\n\t * @param {MaplairMap} map\n\t * @returns {HTMLElement}\n\t */\n\tonAdd(map) {\n\t\tconst zoomName = 'maplair-control-zoom',\n\t\tcontainer = DomUtil.create('div', `${zoomName} maplair-bar`),\n\t\toptions = this.options;\n\n\t\tthis._zoomInButton = this._createButton(options.zoomInText, I18n.translate('Zoom in'),\n\t\t\t`${zoomName}-in`, container, e => this._zoom(e, 1));\n\t\tthis._zoomOutButton = this._createButton(options.zoomOutText, I18n.translate('Zoom out'),\n\t\t\t`${zoomName}-out`, container, e => this._zoom(e, -1));\n\n\t\tthis._updateDisabled();\n\t\tmap.on('zoomend zoomlevelschange', this._updateDisabled, this);\n\n\t\treturn container;\n\t}\n\n\t/**\n\t * @internal\n\t * @param {MaplairMap} map\n\t */\n\tonRemove(map) {\n\t\tmap.off('zoomend zoomlevelschange', this._updateDisabled, this);\n\t}\n\n\t/**\n\t * Disables the zoom buttons.\n\t * @returns {this}\n\t */\n\tdisable() {\n\t\tthis._disabled = true;\n\t\tthis._updateDisabled();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Enables the zoom buttons (if the zoom level allows).\n\t * @returns {this}\n\t */\n\tenable() {\n\t\tthis._disabled = false;\n\t\tthis._updateDisabled();\n\t\treturn this;\n\t}\n\n\t_zoom(e, dir) {\n\t\tconst map = this._map;\n\t\tif (!this._disabled && (dir > 0 ? map._zoom < map.getMaxZoom() : map._zoom > map.getMinZoom())) {\n\t\t\tmap._setUserEvent(e);\n\t\t\tmap.zoomIn(dir * map.options.zoomDelta * (e.shiftKey ? 3 : 1));\n\t\t}\n\t}\n\n\t_createButton(html, title, className, container, fn) {\n\t\tconst link = DomUtil.create('button', className, container);\n\t\tlink.type = 'button';\n\t\tlink.innerHTML = html;\n\t\tlink.title = title;\n\t\tlink.setAttribute('aria-label', title);\n\n\t\tDomEvent.disableClickPropagation(link);\n\t\tDomEvent.on(link, 'click', (e) => {\n\t\t\tDomEvent.stop(e);\n\t\t\tfn.call(this, e);\n\t\t\tthis._refocusOnMap(e);\n\t\t});\n\n\t\treturn link;\n\t}\n\n\t_updateDisabled() {\n\t\tconst map = this._map;\n\t\tfor (const [button, limit] of [[this._zoomInButton, map.getMaxZoom()], [this._zoomOutButton, map.getMinZoom()]]) {\n\t\t\tconst disabled = this._disabled || map._zoom === limit;\n\t\t\tbutton.classList.toggle('maplair-disabled', disabled);\n\t\t\tbutton.setAttribute('aria-disabled', `${disabled}`);\n\t\t}\n\t}\n\n\t/**\n\t * Registers this default feature on the map class, called by `MaplairMap` itself.\n\t * @internal\n\t * @param {typeof MaplairMap} MaplairMap\n\t */\n\tstatic register(MaplairMap) {\n\t\tMaplairMap.mergeOptions({\n\t\t\tzoomControl: true\n\t\t});\n\n\t\tMaplairMap.addInitHook(function () {\n\t\t\tif (this.options.zoomControl) {\n\t\t\t\tthis.zoomControl = new ZoomControl();\n\t\t\t\tthis.addControl(this.zoomControl);\n\t\t\t}\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,cAAb,MAAa,oBAAoB,QAAQ;CAExC,OAAO,iBAAiB;EACvB,UAAU;EACV,YAAY;EACZ,aAAa;CACd;;;;;CAMA,YAAY,GAAG,MAAM;EACpB,MAAM,GAAG,IAAI;EACb,KAAK,cAAc,WAAW;CAC/B;;;;;;CAOA,MAAM,KAAK;EACV,MAAM,WAAW,wBACjB,YAAYA,OAAe,OAAO,GAAG,SAAS,aAAa,GAC3D,UAAU,KAAK;EAEf,KAAK,gBAAiB,KAAK,cAAc,QAAQ,YAAY,KAAK,UAAU,SAAS,GACpF,GAAG,SAAS,MAAO,YAAW,MAAK,KAAK,MAAM,GAAG,CAAC,CAAC;EACpD,KAAK,iBAAiB,KAAK,cAAc,QAAQ,aAAa,KAAK,UAAU,UAAU,GACtF,GAAG,SAAS,OAAO,YAAW,MAAK,KAAK,MAAM,GAAG,EAAE,CAAC;EAErD,KAAK,gBAAgB;EACrB,IAAI,GAAG,4BAA4B,KAAK,iBAAiB,IAAI;EAE7D,OAAO;CACR;;;;;CA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