@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,664 @@
1
+ import {
2
+ TileLayer,
3
+ DomUtil,
4
+ extend,
5
+ bind,
6
+ setOptions,
7
+ SVG,
8
+ point,
9
+ Point,
10
+ Util as LeafletUtil,
11
+ Browser,
12
+ bounds,
13
+ GridLayer
14
+ } from 'leaflet';
15
+
16
+ import { Util } from '../Util.js';
17
+ import { MapFeatureLayer } from './MapFeatureLayer.js';
18
+ import { FeatureRenderer } from '../features/featureRenderer.js';
19
+
20
+ export var TemplatedTileLayer = TileLayer.extend({
21
+ // a TemplateTileLayer is similar to a TileLayer except its templates are
22
+ // defined by the <map-extent><template/></map-extent>
23
+ // content found in the MapML document. As such, the client map does not
24
+ // 'revisit' the server for more MapML content, it simply fills the map extent
25
+ // with tiles for which it generates requests on demand (as the user pans/zooms/resizes
26
+ // the map)
27
+ initialize: function (template, options) {
28
+ // _setUpTileTemplateVars needs options.crs, not available unless we set
29
+ // options first...
30
+ options.tms = template.tms;
31
+ // it's critical to have this.options.minZoom, minNativeZoom, maxZoom, maxNativeZoom
32
+ // because they are used by Leaflet Map and GridLayer, but we
33
+ // don't need two copies of that info on our options object, so set the
34
+ // .zoomBounds property (which is used externally), then delete the option
35
+ // before unpacking the zoomBound object's properties onto this.options.minZ... etc.
36
+ this.zoomBounds = Object.assign({}, options.zoomBounds);
37
+ // unpack object to this.options.minZ... etc where minZ... are the props
38
+ // of the this.zoomBounds object:
39
+ extend(options, this.zoomBounds);
40
+ setOptions(this, options);
41
+ // _setup call here relies on this.options.minZ.. etc
42
+ this._setUpTileTemplateVars(template);
43
+ this._linkEl = options.linkEl;
44
+ this.extentBounds = this.options.extentBounds;
45
+ // get rid of duplicate information as it is confusing
46
+ delete this.options.zoomBounds;
47
+ delete this.options.extentBounds;
48
+
49
+ this._template = template;
50
+ this._initContainer();
51
+ // call the parent constructor with the template tref value, per the
52
+ // Leaflet tutorial: http://leafletjs.com/examples/extending/extending-1-classes.html#methods-of-the-parent-class
53
+ TileLayer.prototype.initialize.call(
54
+ this,
55
+ template.template,
56
+ extend(options, { pane: this.options.pane })
57
+ );
58
+ },
59
+ onAdd: function (map) {
60
+ this.options.pane.appendChild(this._container);
61
+ TileLayer.prototype.onAdd.call(this, map);
62
+ this._handleMoveEnd();
63
+ },
64
+
65
+ onRemove: function () {
66
+ DomUtil.remove(this._container);
67
+ // should clean up the container
68
+ for (let child of this._container.children) {
69
+ DomUtil.remove(child);
70
+ }
71
+ },
72
+
73
+ getEvents: function () {
74
+ let events = TileLayer.prototype.getEvents.call(this, this._map);
75
+ this._parentOnMoveEnd = events.moveend;
76
+ events.moveend = this._handleMoveEnd;
77
+ return events;
78
+ },
79
+
80
+ isVisible: function () {
81
+ let map = this._linkEl.getMapEl()._map;
82
+ let mapZoom = map.getZoom();
83
+ let mapBounds = Util.pixelToPCRSBounds(
84
+ map.getPixelBounds(),
85
+ mapZoom,
86
+ map.options.projection
87
+ );
88
+ return (
89
+ mapZoom <= this.zoomBounds.maxZoom &&
90
+ mapZoom >= this.zoomBounds.minZoom &&
91
+ this.extentBounds.overlaps(mapBounds)
92
+ );
93
+ },
94
+
95
+ _initContainer: function () {
96
+ if (this._container) {
97
+ return;
98
+ }
99
+
100
+ this._container = DomUtil.create('div', 'leaflet-layer', this.options.pane);
101
+ DomUtil.addClass(this._container, 'mapml-templated-tile-container');
102
+ this._updateZIndex();
103
+ },
104
+
105
+ _handleMoveEnd: function (e) {
106
+ if (!this.isVisible()) return;
107
+ this._parentOnMoveEnd();
108
+ },
109
+ createTile: function (coords) {
110
+ let tileGroup = document.createElement('DIV'),
111
+ tileSize = this.getTileSize();
112
+ DomUtil.addClass(tileGroup, 'mapml-tile-group');
113
+ DomUtil.addClass(tileGroup, 'leaflet-tile');
114
+
115
+ this._template.linkEl.dispatchEvent(
116
+ new CustomEvent('tileloadstart', {
117
+ detail: {
118
+ x: coords.x,
119
+ y: coords.y,
120
+ zoom: coords.z,
121
+ appendTile: (elem) => {
122
+ tileGroup.appendChild(elem);
123
+ }
124
+ }
125
+ })
126
+ );
127
+
128
+ if (this._template.type.startsWith('image/')) {
129
+ let tile = TileLayer.prototype.createTile.call(
130
+ this,
131
+ coords,
132
+ function () {}
133
+ );
134
+ tile.width = tileSize.x;
135
+ tile.height = tileSize.y;
136
+ tileGroup.appendChild(tile);
137
+ } else if (!this._url.includes(M.BLANK_TT_TREF)) {
138
+ // tiles of type="text/mapml" will have to fetch content while creating
139
+ // the tile here, unless there can be a callback associated to the element
140
+ // that will render the content in the alread-placed tile
141
+ // var tile = DomUtil.create('canvas', 'leaflet-tile');
142
+ this._fetchTile(coords, tileGroup);
143
+ }
144
+ return tileGroup;
145
+ },
146
+ _mapmlTileReady: function (tile) {
147
+ DomUtil.addClass(tile, 'leaflet-tile-loaded');
148
+ },
149
+ // instead of being child of a pane, the TemplatedTileLayers are 'owned' by the group,
150
+ // and so are DOM children of the group, not the pane element (the MapLayer is
151
+ // a child of the overlay pane and always has a set of sub-layers)
152
+ getPane: function () {
153
+ return this.options.pane;
154
+ },
155
+ _fetchTile: function (coords, tile) {
156
+ let url = this.getTileUrl(coords);
157
+ if (url) {
158
+ fetch(url, { redirect: 'follow' })
159
+ .then(function (response) {
160
+ if (response.status >= 200 && response.status < 300) {
161
+ return Promise.resolve(response);
162
+ } else {
163
+ console.log(
164
+ 'Looks like there was a problem. Status Code: ' + response.status
165
+ );
166
+ return Promise.reject(response);
167
+ }
168
+ })
169
+ .then(function (response) {
170
+ return response.text();
171
+ })
172
+ .then((text) => {
173
+ var parser = new DOMParser();
174
+ return parser.parseFromString(text, 'application/xml');
175
+ })
176
+ .then((mapml) => {
177
+ this._createFeatures(mapml, coords, tile);
178
+ this._mapmlTileReady(tile);
179
+ })
180
+ .catch((err) => {
181
+ console.log('Error creating tile: ' + err);
182
+ });
183
+ }
184
+ },
185
+
186
+ // TO DO: get rid of this function altogether; see TO DO below re: map-link
187
+ // shadow root
188
+ // _parseStylesheetAsHTML parses map-link and map-style from mapml and inserts them to the container as HTML
189
+ _parseStylesheetAsHTML: function (mapml, base, container) {
190
+ if (
191
+ !(container instanceof Element) ||
192
+ !mapml ||
193
+ !mapml.querySelector('map-link[rel=stylesheet],map-style')
194
+ )
195
+ return;
196
+
197
+ if (base instanceof Element) {
198
+ base = base.getAttribute('href')
199
+ ? base.getAttribute('href')
200
+ : document.URL;
201
+ } else if (!base || base === '' || base instanceof Object) {
202
+ return;
203
+ }
204
+
205
+ var ss = [];
206
+ var stylesheets = mapml.querySelectorAll(
207
+ 'map-link[rel=stylesheet],map-style'
208
+ );
209
+ for (var i = 0; i < stylesheets.length; i++) {
210
+ if (stylesheets[i].nodeName.toUpperCase() === 'MAP-LINK') {
211
+ var href = stylesheets[i].hasAttribute('href')
212
+ ? new URL(stylesheets[i].getAttribute('href'), base).href
213
+ : null;
214
+ if (href) {
215
+ if (!container.querySelector("link[href='" + href + "']")) {
216
+ var linkElm = document.createElement('link');
217
+ copyAttributes(stylesheets[i], linkElm);
218
+ linkElm.setAttribute('href', href);
219
+ ss.push(linkElm);
220
+ }
221
+ }
222
+ } else {
223
+ // <map-style>
224
+ var styleElm = document.createElement('style');
225
+ copyAttributes(stylesheets[i], styleElm);
226
+ styleElm.textContent = stylesheets[i].textContent;
227
+ ss.push(styleElm);
228
+ }
229
+ }
230
+ // insert <link> or <style> elements after the begining of the container
231
+ // element, in document order as copied from original mapml document
232
+ // note the code below assumes hrefs have been resolved and elements
233
+ // re-parsed from xml and serialized as html elements ready for insertion
234
+ for (var s = ss.length - 1; s >= 0; s--) {
235
+ container.insertAdjacentElement('afterbegin', ss[s]);
236
+ }
237
+ function copyAttributes(source, target) {
238
+ return Array.from(source.attributes).forEach((attribute) => {
239
+ if (attribute.nodeName !== 'href')
240
+ target.setAttribute(attribute.nodeName, attribute.nodeValue);
241
+ });
242
+ }
243
+ },
244
+
245
+ _createFeatures: function (markup, coords, tile) {
246
+ // TO DO: create a shadow root for the <map-link> that hosts this layer,
247
+ // populate it with map-tile, map-link and map-style elements that are
248
+ // fetched.
249
+ let stylesheets = markup.querySelector(
250
+ 'map-link[rel=stylesheet],map-style'
251
+ );
252
+ if (stylesheets) {
253
+ let base =
254
+ markup.querySelector('map-base') &&
255
+ markup.querySelector('map-base').hasAttribute('href')
256
+ ? new URL(markup.querySelector('map-base').getAttribute('href')).href
257
+ : markup.URL;
258
+ this._parseStylesheetAsHTML(markup, base, tile);
259
+ }
260
+
261
+ let svg = SVG.create('svg'),
262
+ g = SVG.create('g'),
263
+ tileSize = this._map.options.crs.options.crs.tile.bounds.max.x,
264
+ xOffset = coords.x * tileSize,
265
+ yOffset = coords.y * tileSize;
266
+
267
+ let tileFeatures = new MapFeatureLayer(null, {
268
+ projection: this._map.options.projection,
269
+ tiles: true,
270
+ layerBounds: this.extentBounds,
271
+ zoomBounds: this.zoomBounds,
272
+ interactive: false,
273
+ mapEl: this._linkEl.getMapEl()
274
+ });
275
+ let fallback = Util.getNativeVariables(markup);
276
+ // log the tiles in case there's more than one - was a dev issue with geoserver
277
+ // let tiles = markup.querySelectorAll('map-tile');
278
+ // for (let i = 0; i < tiles.length; i++) {
279
+ // let row = tiles[i].getAttribute('row'),
280
+ // col = tiles[i].getAttribute('col'),
281
+ // z = tiles[i].getAttribute('zoom');
282
+ // console.log(
283
+ // 'Total tiles for row: ' +
284
+ // row +
285
+ // ', col: ' +
286
+ // col +
287
+ // ', z: ' +
288
+ // z +
289
+ // ': ' +
290
+ // tiles.length
291
+ // );
292
+ // }
293
+ let currentTileSelector =
294
+ '[row="' +
295
+ coords.y +
296
+ '"][col="' +
297
+ coords.x +
298
+ '"][zoom="' +
299
+ coords.z +
300
+ '"]';
301
+
302
+ // this should select and process the features and tiles in DOM order
303
+ let featuresOrTiles = markup.querySelectorAll(
304
+ 'map-feature:has(> map-geometry),map-tile' + currentTileSelector
305
+ );
306
+ for (let i = 0; i < featuresOrTiles.length; i++) {
307
+ if (featuresOrTiles[i].nodeName === 'map-feature') {
308
+ let feature = tileFeatures.createGeometry(
309
+ featuresOrTiles[i],
310
+ fallback.cs,
311
+ coords.z
312
+ );
313
+ for (let featureID in feature._layers) {
314
+ // layer is an M.Path instance
315
+ let layer = feature._layers[featureID];
316
+ FeatureRenderer.prototype._initPath(layer, false);
317
+ // does something to layer
318
+ layer._project(this._map, point([xOffset, yOffset]), coords.z);
319
+ // appends the guts of layer to g
320
+ FeatureRenderer.prototype._addPath(layer, g, false);
321
+ // updates the guts of layer that have already been appended to g
322
+ FeatureRenderer.prototype._updateFeature(layer);
323
+ }
324
+ } else {
325
+ // render tile as an svg image element
326
+ let tile = featuresOrTiles[i];
327
+ // No need to append to DOM, the browser will cache it
328
+ // observed to be a bit faster than waiting until img is appended to DOM
329
+ const imgObj = new Image();
330
+ imgObj.src = tile.getAttribute('src');
331
+ let img = SVG.create('image');
332
+ img.setAttribute('href', imgObj.src);
333
+ g.appendChild(img);
334
+ }
335
+ }
336
+ svg.setAttribute('width', tileSize.toString());
337
+ svg.setAttribute('height', tileSize.toString());
338
+ svg.appendChild(g);
339
+ tile.appendChild(svg);
340
+ },
341
+
342
+ getTileUrl: function (coords) {
343
+ if (
344
+ coords.z >= this._template.tilematrix.bounds.length ||
345
+ !this._template.tilematrix.bounds[coords.z].contains(coords)
346
+ ) {
347
+ return '';
348
+ }
349
+ var obj = {},
350
+ linkEl = this._template.linkEl,
351
+ zoomInput = linkEl.zoomInput;
352
+ obj[this._template.tilematrix.col.name] = coords.x;
353
+ obj[this._template.tilematrix.row.name] = coords.y;
354
+ if (
355
+ zoomInput &&
356
+ linkEl.hasAttribute('tref') &&
357
+ linkEl
358
+ .getAttribute('tref')
359
+ .includes(`{${zoomInput.getAttribute('name')}}`)
360
+ ) {
361
+ obj[this._template.zoom.name] = this._getZoomForUrl();
362
+ }
363
+ obj[this._template.pcrs.easting.left] = this._tileMatrixToPCRSPosition(
364
+ coords,
365
+ 'top-left'
366
+ ).x;
367
+ obj[this._template.pcrs.easting.right] = this._tileMatrixToPCRSPosition(
368
+ coords,
369
+ 'top-right'
370
+ ).x;
371
+ obj[this._template.pcrs.northing.top] = this._tileMatrixToPCRSPosition(
372
+ coords,
373
+ 'top-left'
374
+ ).y;
375
+ obj[this._template.pcrs.northing.bottom] = this._tileMatrixToPCRSPosition(
376
+ coords,
377
+ 'bottom-left'
378
+ ).y;
379
+ for (var v in this._template.tile) {
380
+ if (
381
+ ['row', 'col', 'zoom', 'left', 'right', 'top', 'bottom'].indexOf(v) < 0
382
+ ) {
383
+ obj[v] = this._template.tile[v];
384
+ }
385
+ }
386
+ if (this._map && !this._map.options.crs.infinite) {
387
+ let invertedY = this._globalTileRange.max.y - coords.y;
388
+ if (this.options.tms) {
389
+ obj[this._template.tilematrix.row.name] = invertedY;
390
+ }
391
+ //obj[`-${this._template.tilematrix.row.name}`] = invertedY; //leaflet has this but I dont see a use in storing row and -row as it doesnt follow that pattern
392
+ }
393
+ obj.r =
394
+ this.options.detectRetina && Browser.retina && this.options.maxZoom > 0
395
+ ? '@2x'
396
+ : '';
397
+ return LeafletUtil.template(this._url, obj);
398
+ },
399
+ _tileMatrixToPCRSPosition: function (coords, pos) {
400
+ // this is a tile:
401
+ //
402
+ // top-left top-center top-right
403
+ // +------------------+------------------+
404
+ // | | |
405
+ // | | |
406
+ // | | |
407
+ // | | |
408
+ // | | |
409
+ // | | |
410
+ // + center-left center + center-right
411
+ // | | |
412
+ // | | |
413
+ // | | |
414
+ // | | |
415
+ // | | |
416
+ // | | |
417
+ // | | |
418
+ // +------------------+------------------+
419
+ // bottom-left bottom-center bottom-right
420
+
421
+ var map = this._map,
422
+ crs = map.options.crs,
423
+ tileSize = this.getTileSize(),
424
+ nwPoint = coords.scaleBy(tileSize),
425
+ sePoint = nwPoint.add(tileSize),
426
+ centrePoint = nwPoint.add(Math.floor(tileSize / 2)),
427
+ nw = crs.transformation.untransform(nwPoint, crs.scale(coords.z)),
428
+ se = crs.transformation.untransform(sePoint, crs.scale(coords.z)),
429
+ cen = crs.transformation.untransform(centrePoint, crs.scale(coords.z)),
430
+ result = null;
431
+
432
+ switch (pos) {
433
+ case 'top-left':
434
+ result = nw;
435
+ break;
436
+ case 'bottom-left':
437
+ result = new Point(nw.x, se.y);
438
+ break;
439
+ case 'center-left':
440
+ result = new Point(nw.x, cen.y);
441
+ break;
442
+ case 'top-right':
443
+ result = new Point(se.x, nw.y);
444
+ break;
445
+ case 'bottom-right':
446
+ result = se;
447
+ break;
448
+ case 'center-right':
449
+ result = new Point(se.x, cen.y);
450
+ break;
451
+ case 'top-center':
452
+ result = new Point(cen.x, nw.y);
453
+ break;
454
+ case 'bottom-center':
455
+ result = new Point(cen.x, se.y);
456
+ break;
457
+ case 'center':
458
+ result = cen;
459
+ break;
460
+ }
461
+ return result;
462
+ },
463
+ _setUpTileTemplateVars: function (template) {
464
+ // process the inputs associated to template and create an object named
465
+ // tile with member properties as follows:
466
+ // {row: 'rowvarname',
467
+ // col: 'colvarname',
468
+ // left: 'leftvarname',
469
+ // right: 'rightvarname',
470
+ // top: 'topvarname',
471
+ // bottom: 'bottomvarname'}
472
+ template.tile = {};
473
+ var inputs = template.values,
474
+ crs = this.options.crs.options,
475
+ zoom,
476
+ east,
477
+ north,
478
+ row,
479
+ col;
480
+
481
+ for (var i = 0; i < template.values.length; i++) {
482
+ var type = inputs[i].getAttribute('type'),
483
+ units = inputs[i].getAttribute('units'),
484
+ axis = inputs[i].getAttribute('axis'),
485
+ name = inputs[i].getAttribute('name'),
486
+ position = inputs[i].getAttribute('position'),
487
+ select = inputs[i].tagName.toLowerCase() === 'map-select',
488
+ value = inputs[i].getAttribute('value'),
489
+ min = inputs[i].getAttribute('min'),
490
+ max = inputs[i].getAttribute('max');
491
+ if (type === 'location' && units === 'tilematrix') {
492
+ switch (axis) {
493
+ case 'column':
494
+ col = {
495
+ name: name,
496
+ min: crs.crs.tilematrix.horizontal.min,
497
+ max: crs.crs.tilematrix.horizontal.max(crs.resolutions.length - 1)
498
+ };
499
+ if (!isNaN(Number.parseFloat(min))) {
500
+ col.min = Number.parseFloat(min);
501
+ }
502
+ if (!isNaN(Number.parseFloat(max))) {
503
+ col.max = Number.parseFloat(max);
504
+ }
505
+ break;
506
+ case 'row':
507
+ row = {
508
+ name: name,
509
+ min: crs.crs.tilematrix.vertical.min,
510
+ max: crs.crs.tilematrix.vertical.max(crs.resolutions.length - 1)
511
+ };
512
+ if (!isNaN(Number.parseFloat(min))) {
513
+ row.min = Number.parseFloat(min);
514
+ }
515
+ if (!isNaN(Number.parseFloat(max))) {
516
+ row.max = Number.parseFloat(max);
517
+ }
518
+ break;
519
+ case 'longitude':
520
+ case 'easting':
521
+ if (!east) {
522
+ east = {
523
+ min: crs.crs.pcrs.horizontal.min,
524
+ max: crs.crs.pcrs.horizontal.max
525
+ };
526
+ }
527
+ if (!isNaN(Number.parseFloat(min))) {
528
+ east.min = Number.parseFloat(min);
529
+ }
530
+ if (!isNaN(Number.parseFloat(max))) {
531
+ east.max = Number.parseFloat(max);
532
+ }
533
+ if (position) {
534
+ if (position.match(/.*?-left/i)) {
535
+ east.left = name;
536
+ } else if (position.match(/.*?-right/i)) {
537
+ east.right = name;
538
+ }
539
+ }
540
+ break;
541
+ case 'latitude':
542
+ case 'northing':
543
+ if (!north) {
544
+ north = {
545
+ min: crs.crs.pcrs.vertical.min,
546
+ max: crs.crs.pcrs.vertical.max
547
+ };
548
+ }
549
+ if (!isNaN(Number.parseFloat(min))) {
550
+ north.min = Number.parseFloat(min);
551
+ }
552
+ if (!isNaN(Number.parseFloat(max))) {
553
+ north.max = Number.parseFloat(max);
554
+ }
555
+ if (position) {
556
+ if (position.match(/top-.*?/i)) {
557
+ north.top = name;
558
+ } else if (position.match(/bottom-.*?/i)) {
559
+ north.bottom = name;
560
+ }
561
+ }
562
+ break;
563
+ default:
564
+ // unsuportted axis value
565
+ }
566
+ } else if (select) {
567
+ /*jshint -W104 */
568
+ const parsedselect = inputs[i].htmlselect;
569
+ template.tile[name] = function () {
570
+ return parsedselect.value;
571
+ };
572
+ } else if (type === 'hidden') {
573
+ // needs to be a const otherwise it gets overwritten
574
+ /*jshint -W104 */
575
+ const input = inputs[i];
576
+ template.tile[name] = function () {
577
+ return input.getAttribute('value');
578
+ };
579
+ }
580
+ }
581
+ var transformation = this.options.crs.transformation,
582
+ tileSize = this.options.crs.options.crs.tile.bounds.max.x,
583
+ scale = bind(this.options.crs.scale, this.options.crs),
584
+ tilematrix2pcrs = function (c, zoom) {
585
+ return transformation.untransform(c.multiplyBy(tileSize), scale(zoom));
586
+ },
587
+ pcrs2tilematrix = function (c, zoom) {
588
+ return transformation
589
+ .transform(c, scale(zoom))
590
+ .divideBy(tileSize)
591
+ .floor();
592
+ };
593
+ if (east && north) {
594
+ template.pcrs = {};
595
+ template.pcrs.bounds = bounds(
596
+ [east.min, north.min],
597
+ [east.max, north.max]
598
+ );
599
+ template.pcrs.easting = east;
600
+ template.pcrs.northing = north;
601
+ } else if (col && row && !isNaN(template.zoom.initialValue)) {
602
+ // convert the tile bounds at this zoom to a pcrs bounds, then
603
+ // go through the zoom min/max and create a tile-based bounds
604
+ // at each zoom that applies to the col/row values that constrain what tiles
605
+ // will be requested so that we don't generate too many 404s
606
+ if (!template.pcrs) {
607
+ template.pcrs = {};
608
+ template.pcrs.easting = '';
609
+ template.pcrs.northing = '';
610
+ }
611
+
612
+ template.pcrs.bounds = Util.boundsToPCRSBounds(
613
+ bounds(point([col.min, row.min]), point([col.max, row.max])),
614
+ template.zoom.initialValue,
615
+ this.options.crs,
616
+ Util.axisToCS('column')
617
+ );
618
+
619
+ template.tilematrix = {};
620
+ template.tilematrix.col = col;
621
+ template.tilematrix.row = row;
622
+ }
623
+
624
+ if (!template.tilematrix) {
625
+ template.tilematrix = {};
626
+ template.tilematrix.col = {};
627
+ template.tilematrix.row = {};
628
+ }
629
+ template.tilematrix.bounds = [];
630
+ var pcrsBounds = template.pcrs.bounds;
631
+ // the template should _always_ have a zoom, because we force it to
632
+ // by first processing the extent to determine the zoom and if none, adding
633
+ // one and second by copying that zoom into the set of template variable inputs
634
+ // even if it is not referenced by one of the template's variable references
635
+ var zmin = this.options.minNativeZoom,
636
+ zmax = this.options.maxNativeZoom;
637
+ for (var z = 0; z <= zmax; z++) {
638
+ template.tilematrix.bounds[z] =
639
+ z >= zmin
640
+ ? bounds(
641
+ pcrs2tilematrix(pcrsBounds.min, z),
642
+ pcrs2tilematrix(pcrsBounds.max, z)
643
+ )
644
+ : bounds(point([-1, -1]), point([-1, -1]));
645
+ }
646
+ },
647
+ _clampZoom: function (zoom) {
648
+ let clamp = GridLayer.prototype._clampZoom.call(this, zoom);
649
+ if (this._template.step > this.options.maxNativeZoom)
650
+ this._template.step = this.options.maxNativeZoom;
651
+
652
+ if (zoom !== clamp) {
653
+ zoom = clamp;
654
+ } else {
655
+ if (zoom % this._template.step !== 0) {
656
+ zoom = Math.floor(zoom / this._template.step) * this._template.step;
657
+ }
658
+ }
659
+ return zoom;
660
+ }
661
+ });
662
+ export var templatedTileLayer = function (template, options) {
663
+ return new TemplatedTileLayer(template, options);
664
+ };
@@ -0,0 +1,26 @@
1
+ export const assignLanguage = (el) => {
2
+ let lang = '';
3
+ if (!el.getAttribute('lang')) {
4
+ const closestLangAttribute = closestElement('[lang]', el)?.getAttribute('lang');
5
+ if (closestLangAttribute == 'en' || !closestLangAttribute) {
6
+ lang = 'en';
7
+ }
8
+ else {
9
+ lang = 'fr';
10
+ }
11
+ }
12
+ else if (el.getAttribute('lang') == 'en') {
13
+ lang = 'en';
14
+ }
15
+ else {
16
+ lang = 'fr';
17
+ }
18
+ return lang;
19
+ };
20
+ // Allows use of closest() function across shadow boundaries
21
+ export const closestElement = (selector, el) => {
22
+ if (el) {
23
+ return (el && el != document && typeof window != 'undefined' && el != window && el.closest(selector)) || closestElement(selector, el.getRootNode().host);
24
+ }
25
+ return null;
26
+ };