@prushforth/map 1.0.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +89 -0
  3. package/demo/index.html +78 -0
  4. package/dist/cjs/AttributionButton-DgbgLHy4.js +106 -0
  5. package/dist/cjs/MapTileLayer-D4vp8bR4.js +454 -0
  6. package/dist/cjs/app-globals-DY--Q2Nl.js +775 -0
  7. package/dist/cjs/calculatePosition-CDcdNl7C.js +92 -0
  8. package/dist/cjs/gcds-ext-map.cjs.js +47 -0
  9. package/dist/cjs/gcds-ext-map_2.cjs.entry.js +8081 -0
  10. package/dist/cjs/index-CW_WOSnc.js +32697 -0
  11. package/dist/cjs/index.cjs.js +2 -0
  12. package/dist/cjs/loader.cjs.js +14 -0
  13. package/dist/cjs/locale-_4nEyxeO.js +153 -0
  14. package/dist/cjs/map-a.cjs.entry.js +16 -0
  15. package/dist/cjs/map-caption.cjs.entry.js +55 -0
  16. package/dist/cjs/map-extent.cjs.entry.js +993 -0
  17. package/dist/cjs/map-feature.cjs.entry.js +636 -0
  18. package/dist/cjs/map-featurecaption.cjs.entry.js +14 -0
  19. package/dist/cjs/map-geometry.cjs.entry.js +36 -0
  20. package/dist/cjs/map-input.cjs.entry.js +348 -0
  21. package/dist/cjs/map-link.cjs.entry.js +6055 -0
  22. package/dist/cjs/map-meta.cjs.entry.js +40 -0
  23. package/dist/cjs/map-properties.cjs.entry.js +14 -0
  24. package/dist/cjs/map-select.cjs.entry.js +100 -0
  25. package/dist/cjs/map-span.cjs.entry.js +14 -0
  26. package/dist/cjs/map-style.cjs.entry.js +127 -0
  27. package/dist/cjs/map-tile.cjs.entry.js +274 -0
  28. package/dist/cjs/renderStyles-yOMXvf12.js +59 -0
  29. package/dist/collection/assets/canada.json +1 -0
  30. package/dist/collection/assets/images/w3community.ico +0 -0
  31. package/dist/collection/assets/mapml/en/apstile/arctic +18 -0
  32. package/dist/collection/assets/mapml/en/cbmtile/canvec +22 -0
  33. package/dist/collection/assets/mapml/en/cbmtile/cbmt +24 -0
  34. package/dist/collection/assets/mapml/en/cbmtile/cbmtgeom +20 -0
  35. package/dist/collection/assets/mapml/en/cbmtile/cbmtsimple +20 -0
  36. package/dist/collection/assets/mapml/en/cbmtile/current_conditions +33 -0
  37. package/dist/collection/assets/mapml/en/cbmtile/toporama +25 -0
  38. package/dist/collection/assets/mapml/en/custom/arcticsdi.mapml +18 -0
  39. package/dist/collection/assets/mapml/en/osmtile/cbmt +24 -0
  40. package/dist/collection/assets/mapml/en/osmtile/current_conditions +32 -0
  41. package/dist/collection/assets/mapml/en/osmtile/dark.mapml +19 -0
  42. package/dist/collection/assets/mapml/en/osmtile/light.mapml +19 -0
  43. package/dist/collection/assets/mapml/en/osmtile/osm +19 -0
  44. package/dist/collection/assets/mapml/en/osmtile/toporama +25 -0
  45. package/dist/collection/assets/mapml/fr/apstile/arctic +19 -0
  46. package/dist/collection/assets/mapml/fr/cbmtile/canvec +22 -0
  47. package/dist/collection/assets/mapml/fr/cbmtile/cbmt +24 -0
  48. package/dist/collection/assets/mapml/fr/cbmtile/cbmtgeom +20 -0
  49. package/dist/collection/assets/mapml/fr/cbmtile/cbmtsimple +20 -0
  50. package/dist/collection/assets/mapml/fr/cbmtile/current_conditions +25 -0
  51. package/dist/collection/assets/mapml/fr/cbmtile/toporama +25 -0
  52. package/dist/collection/assets/mapml/fr/osmtile/cbmt +24 -0
  53. package/dist/collection/assets/mapml/fr/osmtile/current_conditions +24 -0
  54. package/dist/collection/assets/mapml/fr/osmtile/dark.mapml +19 -0
  55. package/dist/collection/assets/mapml/fr/osmtile/light.mapml +19 -0
  56. package/dist/collection/assets/mapml/fr/osmtile/osm +19 -0
  57. package/dist/collection/assets/mapml/fr/osmtile/toporama +25 -0
  58. package/dist/collection/assets/pmtiles/darkTheme.js +19 -0
  59. package/dist/collection/assets/pmtiles/lightTheme.js +19 -0
  60. package/dist/collection/collection-manifest.json +28 -0
  61. package/dist/collection/components/gcds-ext-map/assets/pmtiles/darkTheme.js +19 -0
  62. package/dist/collection/components/gcds-ext-map/assets/pmtiles/lightTheme.js +19 -0
  63. package/dist/collection/components/gcds-ext-map/gcds-ext-map.css +2138 -0
  64. package/dist/collection/components/gcds-ext-map/gcds-ext-map.js +1517 -0
  65. package/dist/collection/components/gcds-ext-map/stories/gcds-ext-map.stories.js +367 -0
  66. package/dist/collection/components/map-a/map-a.js +89 -0
  67. package/dist/collection/components/map-caption/map-caption.js +52 -0
  68. package/dist/collection/components/map-extent/map-extent.js +809 -0
  69. package/dist/collection/components/map-feature/map-feature.js +724 -0
  70. package/dist/collection/components/map-featurecaption/map-featurecaption.js +6 -0
  71. package/dist/collection/components/map-geometry/map-geometry.js +57 -0
  72. package/dist/collection/components/map-input/map-input.js +355 -0
  73. package/dist/collection/components/map-layer/map-layer.js +1245 -0
  74. package/dist/collection/components/map-layer/stories/map-layer.stories.js +101 -0
  75. package/dist/collection/components/map-link/map-link.js +1149 -0
  76. package/dist/collection/components/map-meta/map-meta.js +82 -0
  77. package/dist/collection/components/map-properties/map-properties.js +7 -0
  78. package/dist/collection/components/map-select/map-select.js +145 -0
  79. package/dist/collection/components/map-span/map-span.js +7 -0
  80. package/dist/collection/components/map-style/map-style.js +144 -0
  81. package/dist/collection/components/map-tile/map-tile.js +370 -0
  82. package/dist/collection/components/utils/mapml/DOMTokenList.js +123 -0
  83. package/dist/collection/components/utils/mapml/DefaultMapOptions.js +11 -0
  84. package/dist/collection/components/utils/mapml/Util.js +1601 -0
  85. package/dist/collection/components/utils/mapml/control/AttributionButton.js +101 -0
  86. package/dist/collection/components/utils/mapml/control/FullscreenButton.js +181 -0
  87. package/dist/collection/components/utils/mapml/control/GeolocationButton.js +70 -0
  88. package/dist/collection/components/utils/mapml/control/LayerControl.js +212 -0
  89. package/dist/collection/components/utils/mapml/control/ReloadButton.js +75 -0
  90. package/dist/collection/components/utils/mapml/control/ScaleBar.js +108 -0
  91. package/dist/collection/components/utils/mapml/control/SearchButton.js +565 -0
  92. package/dist/collection/components/utils/mapml/elementSupport/extents/createLayerControlForExtent.js +259 -0
  93. package/dist/collection/components/utils/mapml/elementSupport/inputs/heightInput.js +18 -0
  94. package/dist/collection/components/utils/mapml/elementSupport/inputs/hiddenInput.js +19 -0
  95. package/dist/collection/components/utils/mapml/elementSupport/inputs/locationInput.js +127 -0
  96. package/dist/collection/components/utils/mapml/elementSupport/inputs/widthInput.js +18 -0
  97. package/dist/collection/components/utils/mapml/elementSupport/inputs/zoomInput.js +30 -0
  98. package/dist/collection/components/utils/mapml/elementSupport/layers/calculatePosition.js +88 -0
  99. package/dist/collection/components/utils/mapml/elementSupport/layers/createLayerControlForLayer.js +326 -0
  100. package/dist/collection/components/utils/mapml/elementSupport/layers/renderStyles.js +55 -0
  101. package/dist/collection/components/utils/mapml/elementSupport/viewers/matchMedia.js +251 -0
  102. package/dist/collection/components/utils/mapml/features/featureRenderer.js +342 -0
  103. package/dist/collection/components/utils/mapml/features/geometry.js +268 -0
  104. package/dist/collection/components/utils/mapml/features/path.js +485 -0
  105. package/dist/collection/components/utils/mapml/handlers/AnnounceMovement.js +154 -0
  106. package/dist/collection/components/utils/mapml/handlers/ContextMenu.js +1436 -0
  107. package/dist/collection/components/utils/mapml/handlers/FeatureIndex.js +116 -0
  108. package/dist/collection/components/utils/mapml/handlers/QueryHandler.js +476 -0
  109. package/dist/collection/components/utils/mapml/handlers/keyboard.js +60 -0
  110. package/dist/collection/components/utils/mapml/layers/Crosshair.js +108 -0
  111. package/dist/collection/components/utils/mapml/layers/DebugOverlay.js +357 -0
  112. package/dist/collection/components/utils/mapml/layers/FeatureIndexOverlay.js +239 -0
  113. package/dist/collection/components/utils/mapml/layers/ImageLayer.js +136 -0
  114. package/dist/collection/components/utils/mapml/layers/MapExtentLayer.js +114 -0
  115. package/dist/collection/components/utils/mapml/layers/MapFeatureLayer.js +623 -0
  116. package/dist/collection/components/utils/mapml/layers/MapLayer.js +640 -0
  117. package/dist/collection/components/utils/mapml/layers/MapTileLayer.js +450 -0
  118. package/dist/collection/components/utils/mapml/layers/TemplatedFeaturesOrTilesLayer.js +346 -0
  119. package/dist/collection/components/utils/mapml/layers/TemplatedImageLayer.js +276 -0
  120. package/dist/collection/components/utils/mapml/layers/TemplatedPMTilesLayer.js +135 -0
  121. package/dist/collection/components/utils/mapml/layers/TemplatedTileLayer.js +664 -0
  122. package/dist/collection/components/utils/utils.js +26 -0
  123. package/dist/collection/fonts/icons/LICENSE.txt +92 -0
  124. package/dist/collection/fonts/icons/README.md +543 -0
  125. package/dist/collection/fonts/icons/gcds-icons.css +110 -0
  126. package/dist/collection/fonts/icons/gcds-icons.eot +0 -0
  127. package/dist/collection/fonts/icons/gcds-icons.svg +82 -0
  128. package/dist/collection/fonts/icons/gcds-icons.ttf +0 -0
  129. package/dist/collection/fonts/icons/gcds-icons.woff +0 -0
  130. package/dist/collection/fonts/lato/LICENSE.txt +48 -0
  131. package/dist/collection/fonts/lato/README.md +195 -0
  132. package/dist/collection/fonts/lato/gcds-lato-italic.woff +0 -0
  133. package/dist/collection/fonts/lato/gcds-lato-italic.woff2 +0 -0
  134. package/dist/collection/fonts/lato/gcds-lato.css +30 -0
  135. package/dist/collection/fonts/lato/gcds-lato.woff +0 -0
  136. package/dist/collection/fonts/lato/gcds-lato.woff2 +0 -0
  137. package/dist/collection/fonts/noto-sans/LICENSE.txt +43 -0
  138. package/dist/collection/fonts/noto-sans/README.md +423 -0
  139. package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold-italic.woff +0 -0
  140. package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold-italic.woff2 +0 -0
  141. package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold.woff +0 -0
  142. package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold.woff2 +0 -0
  143. package/dist/collection/fonts/noto-sans/gcds-noto-sans-light-italic.woff +0 -0
  144. package/dist/collection/fonts/noto-sans/gcds-noto-sans-light-italic.woff2 +0 -0
  145. package/dist/collection/fonts/noto-sans/gcds-noto-sans-light.woff +0 -0
  146. package/dist/collection/fonts/noto-sans/gcds-noto-sans-light.woff2 +0 -0
  147. package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium-italic.woff +0 -0
  148. package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium-italic.woff2 +0 -0
  149. package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium.woff +0 -0
  150. package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium.woff2 +0 -0
  151. package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular-italic.woff +0 -0
  152. package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular-italic.woff2 +0 -0
  153. package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular.woff +0 -0
  154. package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular.woff2 +0 -0
  155. package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff +0 -0
  156. package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff2 +0 -0
  157. package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold.woff +0 -0
  158. package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold.woff2 +0 -0
  159. package/dist/collection/fonts/noto-sans/gcds-noto-sans.css +89 -0
  160. package/dist/collection/fonts/noto-sans-mono/LICENSE.txt +93 -0
  161. package/dist/collection/fonts/noto-sans-mono/README.md +135 -0
  162. package/dist/collection/fonts/noto-sans-mono/gcds-noto-sans-mono.css +17 -0
  163. package/dist/collection/fonts/noto-sans-mono/gcds-noto-sans-mono.woff +0 -0
  164. package/dist/collection/fonts/noto-sans-mono/gcds-noto-sans-mono.woff2 +0 -0
  165. package/dist/collection/generated/locale.js +148 -0
  166. package/dist/collection/global/mapml-globals.js +916 -0
  167. package/dist/collection/index.js +1 -0
  168. package/dist/collection/leaflet-src.esm.js +14419 -0
  169. package/dist/components/gcds-ext-map.d.ts +11 -0
  170. package/dist/components/gcds-ext-map.js +10 -0
  171. package/dist/components/index.d.ts +35 -0
  172. package/dist/components/index.js +1 -0
  173. package/dist/components/map-a.d.ts +11 -0
  174. package/dist/components/map-a.js +1 -0
  175. package/dist/components/map-caption.d.ts +11 -0
  176. package/dist/components/map-caption.js +1 -0
  177. package/dist/components/map-extent.d.ts +11 -0
  178. package/dist/components/map-extent.js +1 -0
  179. package/dist/components/map-feature.d.ts +11 -0
  180. package/dist/components/map-feature.js +1 -0
  181. package/dist/components/map-featurecaption.d.ts +11 -0
  182. package/dist/components/map-featurecaption.js +1 -0
  183. package/dist/components/map-geometry.d.ts +11 -0
  184. package/dist/components/map-geometry.js +1 -0
  185. package/dist/components/map-input.d.ts +11 -0
  186. package/dist/components/map-input.js +1 -0
  187. package/dist/components/map-layer.d.ts +11 -0
  188. package/dist/components/map-layer.js +1 -0
  189. package/dist/components/map-link.d.ts +11 -0
  190. package/dist/components/map-link.js +1 -0
  191. package/dist/components/map-meta.d.ts +11 -0
  192. package/dist/components/map-meta.js +1 -0
  193. package/dist/components/map-properties.d.ts +11 -0
  194. package/dist/components/map-properties.js +1 -0
  195. package/dist/components/map-select.d.ts +11 -0
  196. package/dist/components/map-select.js +1 -0
  197. package/dist/components/map-span.d.ts +11 -0
  198. package/dist/components/map-span.js +1 -0
  199. package/dist/components/map-style.d.ts +11 -0
  200. package/dist/components/map-style.js +1 -0
  201. package/dist/components/map-tile.d.ts +11 -0
  202. package/dist/components/map-tile.js +1 -0
  203. package/dist/components/p-B4YLD_Og.js +1 -0
  204. package/dist/components/p-BE41zrui.js +1 -0
  205. package/dist/components/p-Bpv_U_Lb.js +1 -0
  206. package/dist/components/p-CwRxGZga.js +5 -0
  207. package/dist/components/p-EYVT9Efh.js +1 -0
  208. package/dist/components/p-gwC_yeRa.js +1 -0
  209. package/dist/esm/AttributionButton-CfaoSLCu.js +103 -0
  210. package/dist/esm/MapTileLayer-DvC_iOIS.js +451 -0
  211. package/dist/esm/app-globals-De5ze2BD.js +773 -0
  212. package/dist/esm/calculatePosition-B4YLD_Og.js +90 -0
  213. package/dist/esm/gcds-ext-map.js +43 -0
  214. package/dist/esm/gcds-ext-map_2.entry.js +8078 -0
  215. package/dist/esm/index-BUsJ7i5g.js +32656 -0
  216. package/dist/esm/index.js +1 -0
  217. package/dist/esm/loader.js +12 -0
  218. package/dist/esm/locale-Bpv_U_Lb.js +150 -0
  219. package/dist/esm/map-a.entry.js +14 -0
  220. package/dist/esm/map-caption.entry.js +53 -0
  221. package/dist/esm/map-extent.entry.js +991 -0
  222. package/dist/esm/map-feature.entry.js +634 -0
  223. package/dist/esm/map-featurecaption.entry.js +12 -0
  224. package/dist/esm/map-geometry.entry.js +34 -0
  225. package/dist/esm/map-input.entry.js +346 -0
  226. package/dist/esm/map-link.entry.js +6035 -0
  227. package/dist/esm/map-meta.entry.js +38 -0
  228. package/dist/esm/map-properties.entry.js +12 -0
  229. package/dist/esm/map-select.entry.js +98 -0
  230. package/dist/esm/map-span.entry.js +12 -0
  231. package/dist/esm/map-style.entry.js +125 -0
  232. package/dist/esm/map-tile.entry.js +272 -0
  233. package/dist/esm/renderStyles-EYVT9Efh.js +57 -0
  234. package/dist/gcds-ext-map/assets/canada.json +1 -0
  235. package/dist/gcds-ext-map/assets/images/w3community.ico +0 -0
  236. package/dist/gcds-ext-map/assets/mapml/en/apstile/arctic +18 -0
  237. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/canvec +22 -0
  238. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/cbmt +24 -0
  239. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/cbmtgeom +20 -0
  240. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/cbmtsimple +20 -0
  241. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/current_conditions +33 -0
  242. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/toporama +25 -0
  243. package/dist/gcds-ext-map/assets/mapml/en/custom/arcticsdi.mapml +18 -0
  244. package/dist/gcds-ext-map/assets/mapml/en/osmtile/cbmt +24 -0
  245. package/dist/gcds-ext-map/assets/mapml/en/osmtile/current_conditions +32 -0
  246. package/dist/gcds-ext-map/assets/mapml/en/osmtile/dark.mapml +19 -0
  247. package/dist/gcds-ext-map/assets/mapml/en/osmtile/light.mapml +19 -0
  248. package/dist/gcds-ext-map/assets/mapml/en/osmtile/osm +19 -0
  249. package/dist/gcds-ext-map/assets/mapml/en/osmtile/toporama +25 -0
  250. package/dist/gcds-ext-map/assets/mapml/fr/apstile/arctic +19 -0
  251. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/canvec +22 -0
  252. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/cbmt +24 -0
  253. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/cbmtgeom +20 -0
  254. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/cbmtsimple +20 -0
  255. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/current_conditions +25 -0
  256. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/toporama +25 -0
  257. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/cbmt +24 -0
  258. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/current_conditions +24 -0
  259. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/dark.mapml +19 -0
  260. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/light.mapml +19 -0
  261. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/osm +19 -0
  262. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/toporama +25 -0
  263. package/dist/gcds-ext-map/assets/pmtiles/darkTheme.js +19 -0
  264. package/dist/gcds-ext-map/assets/pmtiles/lightTheme.js +19 -0
  265. package/dist/gcds-ext-map/fonts/icons/LICENSE.txt +92 -0
  266. package/dist/gcds-ext-map/fonts/icons/README.md +543 -0
  267. package/dist/gcds-ext-map/fonts/icons/gcds-icons.css +110 -0
  268. package/dist/gcds-ext-map/fonts/icons/gcds-icons.eot +0 -0
  269. package/dist/gcds-ext-map/fonts/icons/gcds-icons.svg +82 -0
  270. package/dist/gcds-ext-map/fonts/icons/gcds-icons.ttf +0 -0
  271. package/dist/gcds-ext-map/fonts/icons/gcds-icons.woff +0 -0
  272. package/dist/gcds-ext-map/fonts/lato/LICENSE.txt +48 -0
  273. package/dist/gcds-ext-map/fonts/lato/README.md +195 -0
  274. package/dist/gcds-ext-map/fonts/lato/gcds-lato-italic.woff +0 -0
  275. package/dist/gcds-ext-map/fonts/lato/gcds-lato-italic.woff2 +0 -0
  276. package/dist/gcds-ext-map/fonts/lato/gcds-lato.css +30 -0
  277. package/dist/gcds-ext-map/fonts/lato/gcds-lato.woff +0 -0
  278. package/dist/gcds-ext-map/fonts/lato/gcds-lato.woff2 +0 -0
  279. package/dist/gcds-ext-map/fonts/noto-sans/LICENSE.txt +43 -0
  280. package/dist/gcds-ext-map/fonts/noto-sans/README.md +423 -0
  281. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold-italic.woff +0 -0
  282. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold-italic.woff2 +0 -0
  283. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold.woff +0 -0
  284. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold.woff2 +0 -0
  285. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light-italic.woff +0 -0
  286. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light-italic.woff2 +0 -0
  287. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light.woff +0 -0
  288. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light.woff2 +0 -0
  289. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium-italic.woff +0 -0
  290. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium-italic.woff2 +0 -0
  291. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium.woff +0 -0
  292. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium.woff2 +0 -0
  293. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular-italic.woff +0 -0
  294. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular-italic.woff2 +0 -0
  295. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular.woff +0 -0
  296. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular.woff2 +0 -0
  297. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff +0 -0
  298. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff2 +0 -0
  299. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold.woff +0 -0
  300. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold.woff2 +0 -0
  301. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans.css +89 -0
  302. package/dist/gcds-ext-map/fonts/noto-sans-mono/LICENSE.txt +93 -0
  303. package/dist/gcds-ext-map/fonts/noto-sans-mono/README.md +135 -0
  304. package/dist/gcds-ext-map/fonts/noto-sans-mono/gcds-noto-sans-mono.css +17 -0
  305. package/dist/gcds-ext-map/fonts/noto-sans-mono/gcds-noto-sans-mono.woff +0 -0
  306. package/dist/gcds-ext-map/fonts/noto-sans-mono/gcds-noto-sans-mono.woff2 +0 -0
  307. package/dist/gcds-ext-map/gcds-ext-map.esm.js +1 -0
  308. package/dist/gcds-ext-map/index.esm.js +0 -0
  309. package/dist/gcds-ext-map/leaflet-src.esm.js +14419 -0
  310. package/dist/gcds-ext-map/p-1b22f774.entry.js +1 -0
  311. package/dist/gcds-ext-map/p-29b4ba34.entry.js +1 -0
  312. package/dist/gcds-ext-map/p-2dd09d44.entry.js +1 -0
  313. package/dist/gcds-ext-map/p-3fef47e5.entry.js +1 -0
  314. package/dist/gcds-ext-map/p-4e324a1d.entry.js +1 -0
  315. package/dist/gcds-ext-map/p-4f4a6873.entry.js +1 -0
  316. package/dist/gcds-ext-map/p-9cc5ad37.entry.js +1 -0
  317. package/dist/gcds-ext-map/p-9edfea7d.entry.js +1 -0
  318. package/dist/gcds-ext-map/p-B4YLD_Og.js +1 -0
  319. package/dist/gcds-ext-map/p-B8Id5Ptd.js +1 -0
  320. package/dist/gcds-ext-map/p-BUsJ7i5g.js +6 -0
  321. package/dist/gcds-ext-map/p-Bpv_U_Lb.js +1 -0
  322. package/dist/gcds-ext-map/p-CtOuMgy9.js +1 -0
  323. package/dist/gcds-ext-map/p-Dd474fsL.js +1 -0
  324. package/dist/gcds-ext-map/p-EYVT9Efh.js +1 -0
  325. package/dist/gcds-ext-map/p-a67d721d.entry.js +1 -0
  326. package/dist/gcds-ext-map/p-b16e862b.entry.js +1 -0
  327. package/dist/gcds-ext-map/p-b9cbf1e0.entry.js +10 -0
  328. package/dist/gcds-ext-map/p-cab5246e.entry.js +1 -0
  329. package/dist/gcds-ext-map/p-d58d409b.entry.js +1 -0
  330. package/dist/gcds-ext-map/p-dfa21368.entry.js +1 -0
  331. package/dist/gcds-ext-map/p-f211048a.entry.js +1 -0
  332. package/dist/index.cjs.js +1 -0
  333. package/dist/index.js +1 -0
  334. package/dist/types/components/gcds-ext-map/gcds-ext-map.d.ts +125 -0
  335. package/dist/types/components/gcds-ext-map/stories/gcds-ext-map.stories.d.ts +230 -0
  336. package/dist/types/components/map-a/map-a.d.ts +7 -0
  337. package/dist/types/components/map-caption/map-caption.d.ts +7 -0
  338. package/dist/types/components/map-extent/map-extent.d.ts +53 -0
  339. package/dist/types/components/map-feature/map-feature.d.ts +50 -0
  340. package/dist/types/components/map-featurecaption/map-featurecaption.d.ts +3 -0
  341. package/dist/types/components/map-geometry/map-geometry.d.ts +7 -0
  342. package/dist/types/components/map-input/map-input.d.ts +24 -0
  343. package/dist/types/components/map-layer/map-layer.d.ts +85 -0
  344. package/dist/types/components/map-layer/stories/map-layer.stories.d.ts +96 -0
  345. package/dist/types/components/map-link/map-link.d.ts +66 -0
  346. package/dist/types/components/map-meta/map-meta.d.ts +11 -0
  347. package/dist/types/components/map-properties/map-properties.d.ts +3 -0
  348. package/dist/types/components/map-select/map-select.d.ts +13 -0
  349. package/dist/types/components/map-span/map-span.d.ts +5 -0
  350. package/dist/types/components/map-style/map-style.d.ts +17 -0
  351. package/dist/types/components/map-tile/map-tile.d.ts +32 -0
  352. package/dist/types/components/utils/mapml/DOMTokenList.d.ts +30 -0
  353. package/dist/types/components/utils/mapml/elementSupport/inputs/heightInput.d.ts +7 -0
  354. package/dist/types/components/utils/mapml/elementSupport/inputs/hiddenInput.d.ts +7 -0
  355. package/dist/types/components/utils/mapml/elementSupport/inputs/locationInput.d.ts +14 -0
  356. package/dist/types/components/utils/mapml/elementSupport/inputs/widthInput.d.ts +7 -0
  357. package/dist/types/components/utils/mapml/elementSupport/inputs/zoomInput.d.ts +11 -0
  358. package/dist/types/components/utils/mapml/layers/MapLayer.d.ts +69 -0
  359. package/dist/types/components/utils/utils.d.ts +2 -0
  360. package/dist/types/components.d.ts +521 -0
  361. package/dist/types/gcds-ext-map.d.ts +17 -0
  362. package/dist/types/generated/locale.d.ts +146 -0
  363. package/dist/types/index.d.ts +11 -0
  364. package/dist/types/stencil-public-runtime.d.ts +1861 -0
  365. package/loader/cdn.js +1 -0
  366. package/loader/index.cjs.js +1 -0
  367. package/loader/index.d.ts +24 -0
  368. package/loader/index.es2017.js +1 -0
  369. package/loader/index.js +2 -0
  370. package/package.json +87 -0
@@ -0,0 +1,116 @@
1
+ import { Handler } from 'leaflet';
2
+ import { Util } from '../Util.js';
3
+ export var FeatureIndex = Handler.extend({
4
+ initialize: function (map) {
5
+ Handler.prototype.initialize.call(this, map);
6
+ this.inBoundFeatures = [];
7
+ this.outBoundFeatures = [];
8
+ this.currentIndex = 0;
9
+ this._mapPCRSBounds = Util.pixelToPCRSBounds(
10
+ map.getPixelBounds(),
11
+ map.getZoom(),
12
+ map.options.projection
13
+ );
14
+ },
15
+
16
+ addHooks: function () {
17
+ this._map.on('mapkeyboardfocused', this._updateMapBounds, this);
18
+ this._map.on('mapkeyboardfocused', this._sortIndex, this);
19
+ },
20
+
21
+ removeHooks: function () {
22
+ this._map.off('mapkeyboardfocused', this._updateMapBounds);
23
+ this._map.off('mapkeyboardfocused', this._sortIndex);
24
+ },
25
+
26
+ /**
27
+ * Adds a svg element to the index of tabbable features, it also keeps track of the layer it's associated + center
28
+ * @param layer - the layer object the feature is associated with
29
+ * @param lc - the layer center
30
+ * @param path - the svg element that needs to be focused, can be a path or g
31
+ */
32
+ addToIndex: function (layer, lc, path) {
33
+ let mc = this._mapPCRSBounds.getCenter();
34
+ let dist = Math.sqrt(Math.pow(lc.x - mc.x, 2) + Math.pow(lc.y - mc.y, 2));
35
+ let index = this._mapPCRSBounds.contains(lc)
36
+ ? this.inBoundFeatures
37
+ : this.outBoundFeatures;
38
+
39
+ let elem = { path: path, layer: layer, center: lc, dist: dist };
40
+ path.setAttribute('tabindex', -1);
41
+
42
+ index.push(elem);
43
+
44
+ // TODO: this insertion loop has potential to be improved slightly
45
+ for (
46
+ let i = index.length - 1;
47
+ i > 0 && index[i].dist < index[i - 1].dist;
48
+ i--
49
+ ) {
50
+ let tmp = index[i];
51
+ index[i] = index[i - 1];
52
+ index[i - 1] = tmp;
53
+ }
54
+
55
+ if (this._mapPCRSBounds.contains(lc)) this.inBoundFeatures = index;
56
+ else this.outBoundFeatures = index;
57
+ },
58
+
59
+ /**
60
+ * Removes features that are no longer on the map, also moves features to the respective array depending
61
+ * on whether the feature is in the maps viewport or not
62
+ */
63
+ cleanIndex: function () {
64
+ this.currentIndex = 0;
65
+ this.inBoundFeatures = this.inBoundFeatures.filter((elem) => {
66
+ let inbound = this._mapPCRSBounds.contains(elem.center);
67
+ elem.path.setAttribute('tabindex', -1);
68
+ if (elem.layer._map && !inbound) {
69
+ this.outBoundFeatures.push(elem);
70
+ }
71
+ return elem.layer._map && inbound;
72
+ });
73
+ this.outBoundFeatures = this.outBoundFeatures.filter((elem) => {
74
+ let inbound = this._mapPCRSBounds.contains(elem.center);
75
+ elem.path.setAttribute('tabindex', -1);
76
+ if (elem.layer._map && inbound) {
77
+ this.inBoundFeatures.push(elem);
78
+ }
79
+ return elem.layer._map && !inbound;
80
+ });
81
+ },
82
+
83
+ /**
84
+ * Sorts the index of features in the map's viewport based on distance from center
85
+ * @private
86
+ */
87
+ _sortIndex: function () {
88
+ this.cleanIndex();
89
+ if (this.inBoundFeatures.length === 0) return;
90
+
91
+ let mc = this._mapPCRSBounds.getCenter();
92
+
93
+ this.inBoundFeatures.sort(function (a, b) {
94
+ let ac = a.center;
95
+ let bc = b.center;
96
+ a.dist = Math.sqrt(Math.pow(ac.x - mc.x, 2) + Math.pow(ac.y - mc.y, 2));
97
+ b.dist = Math.sqrt(Math.pow(bc.x - mc.x, 2) + Math.pow(bc.y - mc.y, 2));
98
+ return a.dist - b.dist;
99
+ });
100
+ this.inBoundFeatures[0].path.setAttribute('tabindex', 0);
101
+ },
102
+
103
+ /**
104
+ * Event handler for 'mapfocused' event to update the map's bounds in terms of PCRS
105
+ * @param e - the event object
106
+ * @private
107
+ */
108
+ _updateMapBounds: function (e) {
109
+ // TODO: map's PCRS bounds is used in other parts of the viewer, can be moved out to the map object directly
110
+ this._mapPCRSBounds = Util.pixelToPCRSBounds(
111
+ this._map.getPixelBounds(),
112
+ this._map.getZoom(),
113
+ this._map.options.projection
114
+ );
115
+ }
116
+ });
@@ -0,0 +1,476 @@
1
+ import {
2
+ Handler,
3
+ DomEvent,
4
+ DomUtil,
5
+ setOptions,
6
+ Bounds,
7
+ Util as LeafletUtil
8
+ } from 'leaflet';
9
+ import { MapFeatureLayer } from '../layers/MapFeatureLayer.js';
10
+ import { featureRenderer } from '../features/featureRenderer.js';
11
+
12
+ // Determine if a GeoJSON object has projected (non-CRS:84) coordinates.
13
+ // Returns true if a "crs" member is present and non-null, or if coordinate
14
+ // values exceed CRS:84 bounds (lon [-180,180], lat [-90,90]), indicating
15
+ // meter-based projected units (e.g. from WMS GetFeatureInfo responses).
16
+ function _hasProjectedCoordinates(json) {
17
+ if (json.crs != null) return true;
18
+ let c = _firstCoordinate(json);
19
+ return c !== null && (Math.abs(c[0]) > 180 || Math.abs(c[1]) > 90);
20
+ }
21
+
22
+ // Extract the first [x, y] coordinate pair from a GeoJSON object,
23
+ // drilling into FeatureCollection → Feature → Geometry → coordinates.
24
+ function _firstCoordinate(json) {
25
+ if (!json) return null;
26
+ let type = json.type && json.type.toUpperCase();
27
+ if (type === 'FEATURECOLLECTION') {
28
+ if (json.features && json.features.length > 0)
29
+ return _firstCoordinate(json.features[0]);
30
+ } else if (type === 'FEATURE') {
31
+ return _firstCoordinate(json.geometry);
32
+ } else if (json.coordinates) {
33
+ // Unwrap nested arrays until we reach a [number, number] pair
34
+ let coords = json.coordinates;
35
+ while (Array.isArray(coords) && Array.isArray(coords[0])) {
36
+ coords = coords[0];
37
+ }
38
+ if (coords.length >= 2 && typeof coords[0] === 'number') return coords;
39
+ } else if (type === 'GEOMETRYCOLLECTION' && json.geometries) {
40
+ if (json.geometries.length > 0) return _firstCoordinate(json.geometries[0]);
41
+ }
42
+ return null;
43
+ }
44
+
45
+ export var QueryHandler = Handler.extend({
46
+ addHooks: function () {
47
+ // get a reference to the actual <map> element, so we can
48
+ // use its layers property to iterate the layers from top down
49
+ // evaluating if they are 'on the map' (enabled)
50
+ setOptions(this, { mapEl: this._map.options.mapEl });
51
+ DomEvent.on(this._map, 'click', this._queryTopLayer, this);
52
+ DomEvent.on(this._map, 'keypress', this._queryTopLayerAtMapCenter, this);
53
+ },
54
+ removeHooks: function () {
55
+ DomEvent.off(this._map, 'click', this._queryTopLayer, this);
56
+ DomEvent.on(this._map, 'keypress', this._queryTopLayerAtMapCenter, this);
57
+ },
58
+ _getTopQueryableLayer: function () {
59
+ var layers = this.options.mapEl.layers;
60
+ // work backwards in document order (top down)
61
+ for (var l = layers.length - 1; l >= 0; l--) {
62
+ if (layers[l].queryable && layers[l].queryable()) {
63
+ return layers[l]._layer;
64
+ }
65
+ }
66
+ },
67
+ _queryTopLayerAtMapCenter: function (event) {
68
+ setTimeout(() => {
69
+ if (
70
+ this._map.isFocused &&
71
+ !this._map._popupClosed &&
72
+ (event.originalEvent.key === ' ' || +event.originalEvent.keyCode === 13)
73
+ ) {
74
+ this._map.fire('click', {
75
+ latlng: this._map.getCenter(),
76
+ layerPoint: this._map.latLngToLayerPoint(this._map.getCenter()),
77
+ containerPoint: this._map.latLngToContainerPoint(
78
+ this._map.getCenter()
79
+ )
80
+ });
81
+ } else {
82
+ delete this._map._popupClosed;
83
+ }
84
+ }, 0);
85
+ },
86
+ _queryTopLayer: function (event) {
87
+ var layer = this._getTopQueryableLayer();
88
+ if (layer) {
89
+ if (layer._mapmlFeatures) delete layer._mapmlFeatures;
90
+ this._query(event, layer);
91
+ }
92
+ },
93
+ _query(e, layer) {
94
+ var zoom = e.target.getZoom(),
95
+ map = this._map,
96
+ crs = M[layer.options.projection], // the crs for each extent would be the same
97
+ tileSize = map.options.crs.options.crs.tile.bounds.max.x,
98
+ container = layer._container,
99
+ popupOptions = {
100
+ autoClose: false,
101
+ autoPan: true,
102
+ maxHeight: map.getSize().y * 0.5 - 50,
103
+ maxWidth: map.getSize().x * 0.7
104
+ },
105
+ tcrs2pcrs = function (c) {
106
+ return crs.transformation.untransform(c, crs.scale(zoom));
107
+ },
108
+ tcrs2gcrs = function (c) {
109
+ return crs.unproject(
110
+ crs.transformation.untransform(c, crs.scale(zoom)),
111
+ zoom
112
+ );
113
+ };
114
+ var tcrsClickLoc = crs.latLngToPoint(e.latlng, zoom),
115
+ tileMatrixClickLoc = tcrsClickLoc.divideBy(tileSize).floor(),
116
+ tileBounds = new Bounds(
117
+ tcrsClickLoc.divideBy(tileSize).floor().multiplyBy(tileSize),
118
+ tcrsClickLoc.divideBy(tileSize).ceil().multiplyBy(tileSize)
119
+ );
120
+
121
+ let point = this._map.project(e.latlng),
122
+ scale = this._map.options.crs.scale(this._map.getZoom()),
123
+ pcrsClick = this._map.options.crs.transformation.untransform(
124
+ point,
125
+ scale
126
+ );
127
+ let templates = layer.getQueryTemplates(pcrsClick, zoom);
128
+
129
+ let fetches = [];
130
+
131
+ var fetchFeatures = function (template, obj) {
132
+ const parser = new DOMParser();
133
+ return fetch(LeafletUtil.template(template.template, obj), {
134
+ redirect: 'follow'
135
+ })
136
+ .then((response) => {
137
+ if (response.status >= 200 && response.status < 300) {
138
+ return response.text().then((text) => {
139
+ return {
140
+ contenttype: response.headers.get('Content-Type'),
141
+ text: text
142
+ };
143
+ });
144
+ } else {
145
+ throw new Error(response.status);
146
+ }
147
+ })
148
+ .then((response) => {
149
+ let features = [];
150
+ let queryMetas = [];
151
+ let geom =
152
+ "<map-geometry cs='gcrs'><map-point><map-coordinates>" +
153
+ e.latlng.lng +
154
+ ' ' +
155
+ e.latlng.lat +
156
+ '</map-coordinates></map-point></map-geometry>';
157
+ if (response.contenttype.startsWith('text/mapml')) {
158
+ // the mapmldoc could have <map-meta> elements that are important, perhaps
159
+ // also, the mapmldoc can have many features
160
+ let mapmldoc = parser.parseFromString(
161
+ response.text,
162
+ 'application/xml'
163
+ );
164
+ let geometrylessFeatures = mapmldoc.querySelectorAll(
165
+ 'map-feature:not(:has(map-geometry))'
166
+ );
167
+ if (geometrylessFeatures.length) {
168
+ let g = parser.parseFromString(geom, 'application/xml');
169
+ for (let i = 0; i < geometrylessFeatures.length; i++) {
170
+ let f = geometrylessFeatures[i];
171
+ f.appendChild(g.firstElementChild.cloneNode(true));
172
+ }
173
+ }
174
+ features = Array.prototype.slice.call(
175
+ mapmldoc.querySelectorAll('map-feature')
176
+ );
177
+ // <map-meta> elements for this query
178
+ queryMetas = Array.prototype.slice.call(
179
+ mapmldoc.querySelectorAll(
180
+ 'map-meta[name=cs], map-meta[name=zoom], map-meta[name=projection]'
181
+ )
182
+ );
183
+ if (queryMetas.length)
184
+ features.forEach((f) => (f.meta = queryMetas));
185
+ } else if (
186
+ response.contenttype.startsWith('application/json') ||
187
+ response.contenttype.startsWith('application/geo+json') ||
188
+ response.contenttype.startsWith('application/geojson')
189
+ ) {
190
+ try {
191
+ let json = JSON.parse(response.text);
192
+ // Replace null geometries with a point at the click location
193
+ // so geojson2mapml can process the features without error
194
+ let clickPoint = {
195
+ type: 'Point',
196
+ coordinates: [e.latlng.lng, e.latlng.lat]
197
+ };
198
+ if (json.type === 'FeatureCollection' && json.features) {
199
+ for (let f of json.features) {
200
+ if (f.geometry === null || f.geometry === undefined) {
201
+ f.geometry = clickPoint;
202
+ }
203
+ }
204
+ } else if (json.type === 'Feature') {
205
+ if (json.geometry === null || json.geometry === undefined) {
206
+ json.geometry = clickPoint;
207
+ }
208
+ }
209
+ let mapmlLayer = M.geojson2mapml(json, {
210
+ projection: layer.options.projection
211
+ });
212
+ // if crs member is present and non-null, or coordinate
213
+ // values exceed CRS:84 range, the response coordinates
214
+ // are in the layer's projected CRS, not CRS:84
215
+ if (_hasProjectedCoordinates(json)) {
216
+ let csMeta = mapmlLayer.querySelector('map-meta[name=cs]');
217
+ if (csMeta) csMeta.setAttribute('content', 'pcrs');
218
+ }
219
+ features = Array.prototype.slice.call(
220
+ mapmlLayer.querySelectorAll('map-feature')
221
+ );
222
+ queryMetas = Array.prototype.slice.call(
223
+ mapmlLayer.querySelectorAll(
224
+ 'map-meta[name=cs], map-meta[name=zoom], map-meta[name=projection]'
225
+ )
226
+ );
227
+ let geometrylessFeatures = features.filter(
228
+ (f) => !f.querySelector('map-geometry')
229
+ );
230
+ if (geometrylessFeatures.length) {
231
+ let g = parser.parseFromString(geom, 'text/html');
232
+ for (let f of geometrylessFeatures) {
233
+ f.appendChild(
234
+ g.querySelector('map-geometry').cloneNode(true)
235
+ );
236
+ }
237
+ }
238
+ if (queryMetas.length)
239
+ features.forEach((f) => (f.meta = queryMetas));
240
+ } catch (err) {
241
+ // not valid GeoJSON, fall through to HTML rendering
242
+ let html = parser.parseFromString(response.text, 'text/html');
243
+ let featureDoc = parser.parseFromString(
244
+ '<map-feature><map-properties>' +
245
+ '</map-properties>' +
246
+ geom +
247
+ '</map-feature>',
248
+ 'text/html'
249
+ );
250
+ if (html.body) {
251
+ featureDoc
252
+ .querySelector('map-properties')
253
+ .appendChild(html.querySelector('html'));
254
+ } else {
255
+ featureDoc
256
+ .querySelector('map-properties')
257
+ .append(response.text);
258
+ }
259
+ features.push(featureDoc.querySelector('map-feature'));
260
+ }
261
+ } else {
262
+ try {
263
+ let featureDocument = parser.parseFromString(
264
+ response.text,
265
+ 'application/xml'
266
+ );
267
+ let featureCollection =
268
+ featureDocument.querySelectorAll('map-feature');
269
+ if (
270
+ featureDocument.querySelector('parsererror') ||
271
+ featureCollection.length === 0
272
+ ) {
273
+ throw new Error('parsererror');
274
+ }
275
+ let g = parser.parseFromString(geom, 'application/xml');
276
+ queryMetas = Array.prototype.slice.call(
277
+ featureDocument.querySelectorAll(
278
+ 'map-meta[name=cs], map-meta[name=zoom], map-meta[name=projection]'
279
+ )
280
+ );
281
+ for (let feature of featureCollection) {
282
+ if (!feature.querySelector('map-geometry')) {
283
+ feature.appendChild(g.firstElementChild.cloneNode(true));
284
+ }
285
+ feature.meta = queryMetas;
286
+ features.push(feature);
287
+ }
288
+ } catch (err) {
289
+ // try the html parser; script elements are marked as non-functional
290
+ // by that api, which hopefully works!
291
+ let html = parser.parseFromString(response.text, 'text/html');
292
+
293
+ // synthesize a single feature from text or html content
294
+ let featureDoc = parser.parseFromString(
295
+ '<map-feature><map-properties>' +
296
+ '</map-properties>' +
297
+ geom +
298
+ '</map-feature>',
299
+ 'text/html'
300
+ );
301
+ if (html.body) {
302
+ featureDoc
303
+ .querySelector('map-properties')
304
+ .appendChild(html.querySelector('html'));
305
+ } else {
306
+ featureDoc
307
+ .querySelector('map-properties')
308
+ .append(response.text);
309
+ }
310
+ features.push(featureDoc.querySelector('map-feature'));
311
+ }
312
+ }
313
+ return { features: features, template: template };
314
+ })
315
+ .catch((err) => {
316
+ console.log('Looks like there was a problem. Status: ' + err.message);
317
+ });
318
+ };
319
+
320
+ for (let i = 0; i < templates.length; i++) {
321
+ var obj = {},
322
+ template = templates[i];
323
+
324
+ // all of the following are locations that might be used in a query, I think.
325
+ obj[template.query.tilei] =
326
+ tcrsClickLoc.x.toFixed() - tileMatrixClickLoc.x * tileSize;
327
+ obj[template.query.tilej] =
328
+ tcrsClickLoc.y.toFixed() - tileMatrixClickLoc.y * tileSize;
329
+
330
+ // this forces the click to the centre of the map extent in the layer crs
331
+ obj[template.query.mapi] = map.getSize().divideBy(2).x.toFixed();
332
+ obj[template.query.mapj] = map.getSize().divideBy(2).y.toFixed();
333
+
334
+ obj[template.query.pixelleft] = crs.pointToLatLng(tcrsClickLoc, zoom).lng;
335
+ obj[template.query.pixeltop] = crs.pointToLatLng(tcrsClickLoc, zoom).lat;
336
+ obj[template.query.pixelright] = crs.pointToLatLng(
337
+ tcrsClickLoc.add([1, 1]),
338
+ zoom
339
+ ).lng;
340
+ obj[template.query.pixelbottom] = crs.pointToLatLng(
341
+ tcrsClickLoc.add([1, 1]),
342
+ zoom
343
+ ).lat;
344
+
345
+ obj[template.query.column] = tileMatrixClickLoc.x;
346
+ obj[template.query.row] = tileMatrixClickLoc.y;
347
+ obj[template.query.x] = tcrsClickLoc.x.toFixed();
348
+ obj[template.query.y] = tcrsClickLoc.y.toFixed();
349
+
350
+ // whereas the layerPoint is calculated relative to the origin plus / minus any
351
+ // pan movements so is equal to containerPoint at first before any pans, but
352
+ // changes as the map pans.
353
+ obj[template.query.easting] = tcrs2pcrs(tcrsClickLoc).x;
354
+ obj[template.query.northing] = tcrs2pcrs(tcrsClickLoc).y;
355
+ obj[template.query.longitude] = tcrs2gcrs(tcrsClickLoc).lng;
356
+ obj[template.query.latitude] = tcrs2gcrs(tcrsClickLoc).lat;
357
+ obj[template.query.zoom] = zoom;
358
+ obj[template.query.width] = map.getSize().x;
359
+ obj[template.query.height] = map.getSize().y;
360
+ // assumes the click is at the centre of the map, per template.query.mapi, mapj above
361
+ obj[template.query.mapbottom] = tcrs2pcrs(
362
+ tcrsClickLoc.add(map.getSize().divideBy(2))
363
+ ).y;
364
+ obj[template.query.mapleft] = tcrs2pcrs(
365
+ tcrsClickLoc.subtract(map.getSize().divideBy(2))
366
+ ).x;
367
+ obj[template.query.maptop] = tcrs2pcrs(
368
+ tcrsClickLoc.subtract(map.getSize().divideBy(2))
369
+ ).y;
370
+ obj[template.query.mapright] = tcrs2pcrs(
371
+ tcrsClickLoc.add(map.getSize().divideBy(2))
372
+ ).x;
373
+
374
+ obj[template.query.tilebottom] = tcrs2pcrs(tileBounds.max).y;
375
+ obj[template.query.tileleft] = tcrs2pcrs(tileBounds.min).x;
376
+ obj[template.query.tiletop] = tcrs2pcrs(tileBounds.min).y;
377
+ obj[template.query.tileright] = tcrs2pcrs(tileBounds.max).x;
378
+ // add hidden or other variables that may be present into the values to
379
+ // be processed by Util.template below.
380
+ for (var v in template.query) {
381
+ if (
382
+ [
383
+ 'mapi',
384
+ 'mapj',
385
+ 'tilei',
386
+ 'tilej',
387
+ 'row',
388
+ 'col',
389
+ 'x',
390
+ 'y',
391
+ 'easting',
392
+ 'northing',
393
+ 'longitude',
394
+ 'latitude',
395
+ 'width',
396
+ 'height',
397
+ 'zoom',
398
+ 'mapleft',
399
+ 'mapright',
400
+ ',maptop',
401
+ 'mapbottom',
402
+ 'tileleft',
403
+ 'tileright',
404
+ 'tiletop',
405
+ 'tilebottom',
406
+ 'pixeltop',
407
+ 'pixelbottom',
408
+ 'pixelleft',
409
+ 'pixelright'
410
+ ].indexOf(v) < 0
411
+ ) {
412
+ obj[v] = template.query[v];
413
+ }
414
+ }
415
+ fetches.push(fetchFeatures(template, obj));
416
+ }
417
+ Promise.allSettled(fetches).then((results) => {
418
+ layer._mapmlFeatures = [];
419
+ // f is an array of {features[], template}
420
+
421
+ for (let f of results) {
422
+ if (f.status === 'fulfilled') {
423
+ // create connection between queried <map-feature> and its parent <map-link>
424
+ for (let feature of f.value.features) {
425
+ feature._linkEl = f.value.template.linkEl;
426
+ }
427
+ layer._mapmlFeatures = layer._mapmlFeatures.concat(f.value.features);
428
+ }
429
+ }
430
+ if (layer._mapmlFeatures.length > 0)
431
+ displayFeaturesPopup(layer._mapmlFeatures, e.latlng);
432
+ });
433
+
434
+ function displayFeaturesPopup(features, loc) {
435
+ if (features.length === 0) return;
436
+ let f = new MapFeatureLayer(features, {
437
+ // pass the vector layer a renderer of its own, otherwise leaflet
438
+ // puts everything into the overlayPane
439
+ renderer: featureRenderer(),
440
+ // pass the vector layer the container for the parent into which
441
+ // it will append its own container for rendering into
442
+ pane: container,
443
+ //color: 'yellow',
444
+ // instead of unprojecting and then projecting and scaling,
445
+ // a much smarter approach would be to scale at the current
446
+ // zoom
447
+ projection: map.options.projection,
448
+ _leafletLayer: layer,
449
+ query: true,
450
+ mapEl: map.options.mapEl
451
+ });
452
+
453
+ f.addTo(layer);
454
+
455
+ let div = DomUtil.create('div', 'mapml-popup-content'),
456
+ c = DomUtil.create('iframe');
457
+ c.style = 'border: none';
458
+ c.srcdoc = features[0].querySelector(
459
+ 'map-feature map-properties'
460
+ ).innerHTML;
461
+ c.setAttribute('sandbox', 'allow-same-origin allow-forms');
462
+ div.appendChild(c);
463
+ // passing a latlng to the popup is necessary for when there is no
464
+ // geometry / null geometry
465
+ layer._totalFeatureCount = features.length;
466
+ layer.bindPopup(div, popupOptions).openPopup(loc);
467
+ layer.on('popupclose', function () {
468
+ layer.removeLayer(f);
469
+ });
470
+ f.showPaginationFeature({
471
+ i: 0,
472
+ popup: layer._popup
473
+ });
474
+ }
475
+ }
476
+ });
@@ -0,0 +1,60 @@
1
+ import { Map, DomEvent, point } from 'leaflet';
2
+ Map.Keyboard.include({
3
+ _onKeyDown: function (e) {
4
+ if (e.altKey || e.metaKey) {
5
+ return;
6
+ }
7
+
8
+ let zoomIn = {
9
+ 187: 187,
10
+ 107: 107,
11
+ 61: 61,
12
+ 171: 171
13
+ };
14
+
15
+ let zoomOut = {
16
+ 189: 189,
17
+ 109: 109,
18
+ 54: 54,
19
+ 173: 173
20
+ };
21
+
22
+ var key = e.keyCode,
23
+ map = this._map,
24
+ offset;
25
+
26
+ if (key in this._panKeys) {
27
+ if (!map._panAnim || !map._panAnim._inProgress) {
28
+ offset = this._panKeys[key];
29
+ if (e.shiftKey) {
30
+ offset = point(offset).multiplyBy(3);
31
+ }
32
+ if (e.ctrlKey) {
33
+ offset = point(offset).divideBy(5);
34
+ }
35
+
36
+ map.panBy(offset);
37
+
38
+ if (map.options.maxBounds) {
39
+ map.panInsideBounds(map.options.maxBounds);
40
+ }
41
+ }
42
+ } else if (key in this._zoomKeys) {
43
+ if (
44
+ (key in zoomIn && map.getMaxZoom() !== map.getZoom()) ||
45
+ (key in zoomOut && map._layersMinZoom !== map.getZoom())
46
+ )
47
+ map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]);
48
+ } else if (
49
+ key === 27 &&
50
+ map._popup &&
51
+ map._popup.options.closeOnEscapeKey
52
+ ) {
53
+ map.closePopup();
54
+ } else {
55
+ return;
56
+ }
57
+
58
+ DomEvent.stop(e);
59
+ }
60
+ });