@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,993 @@
1
+ 'use strict';
2
+
3
+ var ContextMenu = require('./index-CW_WOSnc.js');
4
+ var renderStyles = require('./renderStyles-yOMXvf12.js');
5
+ var calculatePosition = require('./calculatePosition-CDcdNl7C.js');
6
+
7
+ /**
8
+ * Leaflet layer implementing map-extent elements
9
+ * Extends LayerGroup to create a single layer containing "templated" layers
10
+ * from child map-link[@tref] elements
11
+ *
12
+ * Similar in intent to MapFeatureLayer and MapTileLayer, which are LayerGroup or
13
+ * GridLayer for map-feature and map-tile elements' leaflet layer object, respectively.
14
+ *
15
+ * This layer will be inserted into the LayerGroup hosted by the <map-layer>
16
+ * immediately after creation, so that its index within the _layers array of
17
+ * that LayerGroup will be equal to its z-index within the LayerGroup's container
18
+ *
19
+ * <map-tile row="10" col="12" src="url1"></map-tile> LayerGroup._layers[0] <- each *set* of adjacent tiles
20
+ * <map-tile row="11" col="12" src="url2"></map-tile> LayerGroup._layers[0] <- is a *single* MapTileLayer
21
+ * <map-extent units="OSMTILE" checked hidden> LayerGroup._layers[1] *each* <map-extent> is a LayerGroup of Templated*Layer.js
22
+ * <map-feature id="a"> LayerGroup._layers[2] <- each *set* of adjacent features
23
+ * <map-feature id="b"> LayerGroup._layers[2] <- is a single MapFeatureLayer FeatureGroup
24
+ * <map-tile row="10" col="12" src="url3"></map-tile> LayerGroup._layers[3]
25
+ * <map-tile row="11" col="12" src="url4"></map-tile> LayerGroup._layers[3]
26
+ * <map-feature id="c"> LayerGroup._layers[4]
27
+ * <map-feature id="d"> LayerGroup._layers[4]
28
+ * and so on
29
+ *
30
+ * A constraint of <map-extent> is that it cannot be nested inside a templated
31
+ * layer i.e. if a <map-link> retrieves a text/mapml document that contains a
32
+ * <map-extent>, it will be ignored, otherwise there could be infinite nested
33
+ * fetches triggered. That is why the "TemplatedFeaturesOrTilesLayer" exists - it
34
+ * excludes <map-extent> elements.
35
+ */
36
+ var MapExtentLayer = ContextMenu.leafletSrcExports.LayerGroup.extend({
37
+ initialize: function (options) {
38
+ // Call LayerGroup's initialize to trigger Leaflet's setup
39
+ ContextMenu.leafletSrcExports.LayerGroup.prototype.initialize.call(this, null, options);
40
+ this._container = ContextMenu.leafletSrcExports.DomUtil.create('div', 'leaflet-layer');
41
+ this._extentEl = this.options.extentEl;
42
+ this.changeOpacity(this.options.opacity);
43
+ this.setZIndex(options.zIndex);
44
+ // Add class to the container
45
+ ContextMenu.leafletSrcExports.DomUtil.addClass(this._container, 'mapml-extentlayer-container');
46
+ },
47
+ getEvents: function () {
48
+ return {
49
+ zoomstart: this._onZoomStart
50
+ };
51
+ },
52
+ _onZoomStart: function () {
53
+ this.closePopup();
54
+ },
55
+ getContainer: function () {
56
+ return this._container;
57
+ },
58
+ onAdd: function (map) {
59
+ ContextMenu.leafletSrcExports.LayerGroup.prototype.onAdd.call(this, map);
60
+ let pane = this.options.extentEl.parentLayer._layer._container;
61
+ pane.appendChild(this._container);
62
+ },
63
+ redraw: function () {
64
+ this.eachLayer(function (layer) {
65
+ layer.redraw();
66
+ });
67
+ },
68
+ setZIndex: function (zIndex) {
69
+ this.options.zIndex = zIndex;
70
+ this._updateZIndex();
71
+
72
+ return this;
73
+ },
74
+ _updateZIndex: function () {
75
+ if (
76
+ this._container &&
77
+ this.options.zIndex !== undefined &&
78
+ this.options.zIndex !== null
79
+ ) {
80
+ this._container.style.zIndex = this.options.zIndex;
81
+ }
82
+ },
83
+ onRemove: function () {
84
+ ContextMenu.leafletSrcExports.LayerGroup.prototype.onRemove.call(this, this._map);
85
+ ContextMenu.leafletSrcExports.DomUtil.remove(this._container);
86
+ },
87
+
88
+ _previousFeature: function (e) {
89
+ if (this._count + -1 >= 0) {
90
+ this._count--;
91
+ this._map.fire('featurepagination', {
92
+ i: this._count,
93
+ popup: this
94
+ });
95
+ }
96
+ },
97
+
98
+ _nextFeature: function (e) {
99
+ if (this._count + 1 < this._source._totalFeatureCount) {
100
+ this._count++;
101
+ this._map.fire('featurepagination', {
102
+ i: this._count,
103
+ popup: this
104
+ });
105
+ }
106
+ },
107
+
108
+ changeOpacity: function (opacity) {
109
+ this._container.style.opacity = opacity;
110
+ this._extentEl._opacity = opacity;
111
+ if (this._extentEl._opacitySlider)
112
+ this._extentEl._opacitySlider.value = opacity;
113
+ },
114
+ renderStyles: renderStyles.renderStyles
115
+ });
116
+ var mapExtentLayer = function (options) {
117
+ return new MapExtentLayer(options);
118
+ };
119
+
120
+ var createLayerControlExtentHTML = function () {
121
+ var extent = ContextMenu.leafletSrcExports.DomUtil.create('fieldset', 'mapml-layer-extent'),
122
+ extentProperties = ContextMenu.leafletSrcExports.DomUtil.create(
123
+ 'div',
124
+ 'mapml-layer-item-properties',
125
+ extent
126
+ ),
127
+ extentSettings = ContextMenu.leafletSrcExports.DomUtil.create('div', 'mapml-layer-item-settings', extent),
128
+ extentLabel = ContextMenu.leafletSrcExports.DomUtil.create(
129
+ 'label',
130
+ 'mapml-layer-item-toggle',
131
+ extentProperties
132
+ ),
133
+ input = ContextMenu.leafletSrcExports.DomUtil.create('input'),
134
+ svgExtentControlIcon = ContextMenu.leafletSrcExports.SVG.create('svg'),
135
+ extentControlPath1 = ContextMenu.leafletSrcExports.SVG.create('path'),
136
+ extentControlPath2 = ContextMenu.leafletSrcExports.SVG.create('path'),
137
+ extentNameIcon = ContextMenu.leafletSrcExports.DomUtil.create('span'),
138
+ extentItemControls = ContextMenu.leafletSrcExports.DomUtil.create(
139
+ 'div',
140
+ 'mapml-layer-item-controls',
141
+ extentProperties
142
+ ),
143
+ opacityControl = ContextMenu.leafletSrcExports.DomUtil.create(
144
+ 'details',
145
+ 'mapml-layer-item-details mapml-control-layers',
146
+ extentSettings
147
+ ),
148
+ extentOpacitySummary = ContextMenu.leafletSrcExports.DomUtil.create('summary', '', opacityControl),
149
+ mapEl = this.getMapEl(),
150
+ layerEl = this.getLayerEl(),
151
+ opacity = ContextMenu.leafletSrcExports.DomUtil.create('input', '', opacityControl);
152
+ extentSettings.hidden = true;
153
+ extent.setAttribute('aria-grabbed', 'false');
154
+
155
+ // append the svg paths
156
+ svgExtentControlIcon.setAttribute('viewBox', '0 0 24 24');
157
+ svgExtentControlIcon.setAttribute('height', '22');
158
+ svgExtentControlIcon.setAttribute('width', '22');
159
+ extentControlPath1.setAttribute('d', 'M0 0h24v24H0z');
160
+ extentControlPath1.setAttribute('fill', 'none');
161
+ extentControlPath2.setAttribute(
162
+ 'd',
163
+ 'M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z'
164
+ );
165
+ svgExtentControlIcon.appendChild(extentControlPath1);
166
+ svgExtentControlIcon.appendChild(extentControlPath2);
167
+
168
+ let mapSelects = this.el.querySelectorAll('map-select');
169
+ if (mapSelects.length) {
170
+ // map-select Stencil components may not have initialized yet;
171
+ // wait for each to be ready before accessing selectdetails
172
+ Promise.all(
173
+ Array.from(mapSelects).map((s) => s.whenReady())
174
+ ).then(() => {
175
+ var frag = document.createDocumentFragment();
176
+ for (var i = 0; i < mapSelects.length; i++) {
177
+ frag.appendChild(mapSelects[i].selectdetails);
178
+ }
179
+ extentSettings.appendChild(frag);
180
+ });
181
+ }
182
+
183
+ let removeExtentButton = ContextMenu.leafletSrcExports.DomUtil.create(
184
+ 'button',
185
+ 'mapml-layer-item-remove-control',
186
+ extentItemControls
187
+ );
188
+ removeExtentButton.type = 'button';
189
+ removeExtentButton.title = mapEl.locale.lmRemoveExtent;
190
+ removeExtentButton.innerHTML = "<span aria-hidden='true'>&#10005;</span>";
191
+ removeExtentButton.classList.add('mapml-button');
192
+ removeExtentButton.addEventListener('click', (e) => {
193
+ e.preventDefault();
194
+ e.stopPropagation();
195
+ this.el.remove();
196
+ });
197
+
198
+ let extentsettingsButton = ContextMenu.leafletSrcExports.DomUtil.create(
199
+ 'button',
200
+ 'mapml-layer-item-settings-control',
201
+ extentItemControls
202
+ );
203
+ extentsettingsButton.type = 'button';
204
+ extentsettingsButton.title = mapEl.locale.lmExtentSettings;
205
+ extentsettingsButton.setAttribute('aria-expanded', false);
206
+ extentsettingsButton.classList.add('mapml-button');
207
+ ContextMenu.leafletSrcExports.DomEvent.on(
208
+ extentsettingsButton,
209
+ 'click',
210
+ (e) => {
211
+ if (extentSettings.hidden === true) {
212
+ extentsettingsButton.setAttribute('aria-expanded', true);
213
+ extentSettings.hidden = false;
214
+ } else {
215
+ extentsettingsButton.setAttribute('aria-expanded', false);
216
+ extentSettings.hidden = true;
217
+ }
218
+ },
219
+ this
220
+ );
221
+
222
+ extentNameIcon.setAttribute('aria-hidden', true);
223
+ extentLabel.appendChild(input);
224
+ extentsettingsButton.appendChild(extentNameIcon);
225
+ extentNameIcon.appendChild(svgExtentControlIcon);
226
+ extentOpacitySummary.innerText = mapEl.locale.lcOpacity;
227
+ extentOpacitySummary.id =
228
+ 'mapml-extent-item-opacity-' + ContextMenu.leafletSrcExports.stamp(extentOpacitySummary);
229
+ opacity.setAttribute('type', 'range');
230
+ opacity.setAttribute('min', '0');
231
+ opacity.setAttribute('max', '1.0');
232
+ opacity.setAttribute('step', '0.1');
233
+ opacity.setAttribute(
234
+ 'aria-labelledby',
235
+ 'mapml-extent-item-opacity-' + ContextMenu.leafletSrcExports.stamp(extentOpacitySummary)
236
+ );
237
+ const changeOpacity = function (e) {
238
+ if (e && e.target && e.target.value >= 0 && e.target.value <= 1.0) {
239
+ this._extentLayer.changeOpacity(e.target.value);
240
+ }
241
+ };
242
+ opacity.setAttribute('value', this.opacity);
243
+ opacity.value = this._extentLayer._container.style.opacity || '1.0';
244
+ opacity.addEventListener('change', changeOpacity.bind(this));
245
+
246
+ var extentItemNameSpan = ContextMenu.leafletSrcExports.DomUtil.create(
247
+ 'span',
248
+ 'mapml-extent-item-name',
249
+ extentLabel
250
+ );
251
+ input.type = 'checkbox';
252
+ input.defaultChecked = this.checked;
253
+ extentItemNameSpan.innerHTML = this.label;
254
+ const changeCheck = function () {
255
+ this.checked = !this.checked;
256
+ this.el.dispatchEvent(new CustomEvent('map-change'));
257
+ };
258
+ // save for later access by API
259
+ this._layerControlCheckbox = input;
260
+ input.addEventListener('change', changeCheck.bind(this));
261
+ extentItemNameSpan.id =
262
+ 'mapml-extent-item-name-{' + ContextMenu.leafletSrcExports.stamp(extentItemNameSpan) + '}';
263
+ extent.setAttribute('aria-labelledby', extentItemNameSpan.id);
264
+ extentItemNameSpan.extent = this.el;
265
+
266
+ extent.ontouchstart = extent.onmousedown = (downEvent) => {
267
+ if (
268
+ (downEvent.target.parentElement.tagName.toLowerCase() === 'label' &&
269
+ downEvent.target.tagName.toLowerCase() !== 'input') ||
270
+ downEvent.target.tagName.toLowerCase() === 'label'
271
+ ) {
272
+ downEvent.stopPropagation();
273
+ downEvent =
274
+ downEvent instanceof TouchEvent ? downEvent.touches[0] : downEvent;
275
+
276
+ let control = extent,
277
+ controls = extent.parentNode,
278
+ moving = false,
279
+ yPos = downEvent.clientY,
280
+ originalPosition = Array.from(
281
+ extent.parentElement.querySelectorAll('fieldset')
282
+ ).indexOf(extent);
283
+
284
+ document.body.ontouchmove = document.body.onmousemove = (moveEvent) => {
285
+ moveEvent.preventDefault();
286
+ moveEvent =
287
+ moveEvent instanceof TouchEvent ? moveEvent.touches[0] : moveEvent;
288
+
289
+ // Fixes flickering by only moving element when there is enough space
290
+ let offset = moveEvent.clientY - yPos;
291
+ moving = Math.abs(offset) > 15 || moving;
292
+ if (
293
+ (controls && !moving) ||
294
+ (controls && controls.childElementCount <= 1) ||
295
+ controls.getBoundingClientRect().top >
296
+ control.getBoundingClientRect().bottom ||
297
+ controls.getBoundingClientRect().bottom <
298
+ control.getBoundingClientRect().top
299
+ ) {
300
+ return;
301
+ }
302
+
303
+ controls.classList.add('mapml-draggable');
304
+ control.style.transform = 'translateY(' + offset + 'px)';
305
+ control.style.pointerEvents = 'none';
306
+
307
+ let x = moveEvent.clientX,
308
+ y = moveEvent.clientY,
309
+ root =
310
+ mapEl.tagName === 'GCDS-EXT-MAP'
311
+ ? mapEl.shadowRoot
312
+ : mapEl.querySelector('.mapml-web-map').shadowRoot,
313
+ elementAt = root.elementFromPoint(x, y),
314
+ swapControl =
315
+ !elementAt || !elementAt.closest('fieldset')
316
+ ? control
317
+ : elementAt.closest('fieldset');
318
+
319
+ swapControl =
320
+ Math.abs(offset) <= swapControl.offsetHeight ? control : swapControl;
321
+
322
+ control.setAttribute('aria-grabbed', 'true');
323
+ control.setAttribute('aria-dropeffect', 'move');
324
+ if (swapControl && controls === swapControl.parentNode) {
325
+ swapControl =
326
+ swapControl !== control.nextSibling
327
+ ? swapControl
328
+ : swapControl.nextSibling;
329
+ if (control !== swapControl) {
330
+ yPos = moveEvent.clientY;
331
+ control.style.transform = null;
332
+ }
333
+ controls.insertBefore(control, swapControl);
334
+ }
335
+ };
336
+
337
+ document.body.ontouchend = document.body.onmouseup = () => {
338
+ let newPosition = Array.from(
339
+ extent.parentElement.querySelectorAll('fieldset')
340
+ ).indexOf(extent);
341
+ control.setAttribute('aria-grabbed', 'false');
342
+ control.removeAttribute('aria-dropeffect');
343
+ control.style.pointerEvents = null;
344
+ control.style.transform = null;
345
+ if (originalPosition !== newPosition) {
346
+ let controlsElems = controls.children,
347
+ zIndex = 0;
348
+ for (let c of controlsElems) {
349
+ let extentEl = c.querySelector('span').extent;
350
+
351
+ extentEl.setAttribute('data-moving', '');
352
+ const node = layerEl.src ? layerEl.shadowRoot : layerEl;
353
+ node.append(extentEl);
354
+ extentEl.removeAttribute('data-moving');
355
+
356
+ extentEl.extentZIndex = zIndex;
357
+ extentEl._extentLayer.setZIndex(zIndex);
358
+ zIndex++;
359
+ }
360
+ }
361
+ controls.classList.remove('mapml-draggable');
362
+ document.body.ontouchmove =
363
+ document.body.onmousemove =
364
+ document.body.ontouchend =
365
+ document.body.onmouseup =
366
+ null;
367
+ };
368
+ }
369
+ };
370
+ this._extentRootFieldset = extent;
371
+ this._opacitySlider = opacity;
372
+ this._opacityControl = opacityControl;
373
+ this._layerControlLabel = extentLabel;
374
+ return extent;
375
+ };
376
+
377
+ const GcdsMapExtent = class {
378
+ constructor(hostRef) {
379
+ ContextMenu.registerInstance(this, hostRef);
380
+ }
381
+ get el() { return ContextMenu.getElement(this); }
382
+ checked = false;
383
+ _label;
384
+ opacity = 1;
385
+ _opacity;
386
+ hidden = false;
387
+ units;
388
+ disabled = false;
389
+ // Internal getter for use within component
390
+ get label() {
391
+ return this._label || this.mapEl?.locale?.dfExtent || 'Sub-layer';
392
+ }
393
+ get opacityValue() {
394
+ return this._opacity ?? this.opacity ?? 1.0;
395
+ }
396
+ mapEl;
397
+ parentLayer;
398
+ _map;
399
+ _extentLayer;
400
+ _layerControlHTML;
401
+ _layerControlCheckbox;
402
+ _layerControlLabel;
403
+ _opacityControl;
404
+ _opacitySlider;
405
+ _selectdetails;
406
+ _observer;
407
+ _changeHandler;
408
+ _boundsCalculated = false;
409
+ unitsChanged(newValue, oldValue) {
410
+ }
411
+ labelChanged() {
412
+ if (this._layerControlHTML) {
413
+ this._layerControlHTML.querySelector('.mapml-extent-item-name').textContent = this.label;
414
+ }
415
+ }
416
+ checkedChanged() {
417
+ if (this.parentLayer && this._extentLayer) {
418
+ this.parentLayer
419
+ .whenReady()
420
+ .then(() => {
421
+ this._handleChange();
422
+ this._calculateBounds();
423
+ if (this._layerControlCheckbox) {
424
+ this._layerControlCheckbox.checked = this.checked;
425
+ }
426
+ })
427
+ .catch((error) => {
428
+ console.log('Error while waiting on parentLayer for map-extent checked callback: ' +
429
+ error);
430
+ });
431
+ }
432
+ }
433
+ opacityChanged(newValue, oldValue) {
434
+ // This watcher handles programmatic changes to the opacity property
435
+ if (oldValue !== newValue && this._extentLayer) {
436
+ this._opacity = newValue;
437
+ this._extentLayer.changeOpacity(newValue);
438
+ // Update opacity slider if it exists
439
+ if (this._opacitySlider) {
440
+ this._opacitySlider.value = newValue.toString();
441
+ }
442
+ }
443
+ }
444
+ hiddenChanged(newValue, oldValue) {
445
+ // Only process hidden changes after the extent is fully initialized
446
+ // During initial load, this will be handled in connectedCallback
447
+ if (oldValue !== newValue && this._extentLayer && this._layerControlHTML) {
448
+ this._applyHiddenState(newValue);
449
+ }
450
+ }
451
+ _applyHiddenState(isHidden) {
452
+ if (!this._extentLayer || !this._layerControlHTML || !this.parentLayer)
453
+ return;
454
+ this.parentLayer
455
+ .whenReady()
456
+ .then(() => {
457
+ let extentsRootFieldset = this.parentLayer._propertiesGroupAnatomy;
458
+ // Get all map-extent elements and filter by component property, not DOM attribute
459
+ const allExtents = this.parentLayer.src
460
+ ? Array.from(this.parentLayer.shadowRoot.querySelectorAll(':host > map-extent'))
461
+ : Array.from(this.parentLayer.querySelectorAll(':scope > map-extent'));
462
+ // Filter visible extents using component property
463
+ const visibleExtents = allExtents.filter(extent => !extent.hidden);
464
+ let position = visibleExtents.indexOf(this.el);
465
+ if (isHidden) {
466
+ // Hidden was set to true - remove from layer control (hide from user)
467
+ this._layerControlHTML.remove();
468
+ }
469
+ else {
470
+ // Hidden was set to false - add back to layer control in calculated position
471
+ if (position === 0) {
472
+ extentsRootFieldset.insertAdjacentElement('afterbegin', this._layerControlHTML);
473
+ }
474
+ else if (position > 0) {
475
+ Array.from(this.parentLayer.src
476
+ ? this.parentLayer.shadowRoot.querySelectorAll(':host > map-extent:not([hidden])')
477
+ : this.parentLayer.querySelectorAll(':scope > map-extent:not([hidden])'))[position - 1]._layerControlHTML.insertAdjacentElement('afterend', this._layerControlHTML);
478
+ }
479
+ }
480
+ this._validateLayerControlContainerHidden();
481
+ })
482
+ .catch(() => {
483
+ console.log('Error while waiting on parentLayer for map-extent hidden callback');
484
+ });
485
+ }
486
+ get extent() {
487
+ const getExtent = (extent) => {
488
+ return Object.assign(ContextMenu.Util._convertAndFormatPCRS(extent._extentLayer.bounds, M[extent.units], extent.units), { zoom: extent._extentLayer.zoomBounds });
489
+ };
490
+ const getCalculatedExtent = (extent) => {
491
+ extent._calculateBounds();
492
+ return getExtent(extent);
493
+ };
494
+ return this._extentLayer.bounds
495
+ ? getExtent(this)
496
+ : getCalculatedExtent(this);
497
+ }
498
+ get position() {
499
+ return calculatePosition.calculatePosition(this.el);
500
+ }
501
+ getOuterHTML() {
502
+ let tempElement = this.el.cloneNode(true);
503
+ if (this.el.querySelector('map-link')) {
504
+ let mapLinks = tempElement.querySelectorAll('map-link');
505
+ mapLinks.forEach((mapLink) => {
506
+ if (mapLink.hasAttribute('href')) {
507
+ mapLink.setAttribute('href', decodeURI(new URL(mapLink.getAttribute('href'), this.el.baseURI ? this.el.baseURI : document.baseURI).href));
508
+ }
509
+ else if (mapLink.hasAttribute('tref')) {
510
+ mapLink.setAttribute('tref', decodeURI(new URL(mapLink.getAttribute('tref'), this.el.baseURI ? this.el.baseURI : document.baseURI).href));
511
+ }
512
+ });
513
+ }
514
+ let outerLayer = tempElement.outerHTML;
515
+ tempElement.remove();
516
+ return outerLayer;
517
+ }
518
+ zoomTo() {
519
+ let extent = this.extent;
520
+ let map = this.getMapEl()._map, xmin = extent.topLeft.pcrs.horizontal, xmax = extent.bottomRight.pcrs.horizontal, ymin = extent.bottomRight.pcrs.vertical, ymax = extent.topLeft.pcrs.vertical, bounds = ContextMenu.leafletSrcExports.bounds(ContextMenu.leafletSrcExports.point(xmin, ymin), ContextMenu.leafletSrcExports.point(xmax, ymax)), center = map.options.crs.unproject(bounds.getCenter(true)), maxZoom = extent.zoom.maxZoom, minZoom = extent.zoom.minZoom;
521
+ map.setView(center, ContextMenu.Util.getMaxZoom(bounds, map, minZoom, maxZoom), {
522
+ animate: false
523
+ });
524
+ }
525
+ getMapEl() {
526
+ return ContextMenu.Util.getClosest(this.el, 'gcds-ext-map');
527
+ }
528
+ getLayerEl() {
529
+ return ContextMenu.Util.getClosest(this.el, 'map-layer,layer-');
530
+ }
531
+ async connectedCallback() {
532
+ // Initialize default values and bind handlers
533
+ this._opacity = this.opacityValue;
534
+ this._changeHandler = this._handleChange.bind(this);
535
+ this.parentLayer = this.el.parentLayer = this.getLayerEl();
536
+ if (this.el.hasAttribute('data-moving') ||
537
+ this.parentLayer?.hasAttribute('data-moving'))
538
+ return;
539
+ this.mapEl = this.getMapEl();
540
+ // Add MapML compatibility methods to the element
541
+ this.el.getMapEl = this.getMapEl.bind(this);
542
+ this.el.getLayerEl = this.getLayerEl.bind(this);
543
+ this.el.getLayerControlHTML = this.getLayerControlHTML.bind(this);
544
+ this.el.zoomTo = this.zoomTo.bind(this);
545
+ this.el._validateDisabled = this._validateDisabled.bind(this);
546
+ this.el.getMeta = this.getMeta.bind(this);
547
+ this.el.getOuterHTML = this.getOuterHTML.bind(this);
548
+ // this is necessary for true "whenReady" being true because bounds
549
+ // being established is pretty important. This is different from MapML.js;
550
+ // TODO it may be to port this idea back to MapML.js tbd.
551
+ Object.defineProperty(this.el, '_boundsCalculated', {
552
+ get: () => this._boundsCalculated,
553
+ configurable: true,
554
+ enumerable: true
555
+ });
556
+ // Add extent getter on element for MapML compatibility
557
+ Object.defineProperty(this.el, 'extent', {
558
+ get: () => {
559
+ return this.extent;
560
+ },
561
+ configurable: true
562
+ });
563
+ // Add label getter/setter on element for MapML compatibility
564
+ Object.defineProperty(this.el, 'label', {
565
+ get: () => {
566
+ return this.el.hasAttribute('label')
567
+ ? this.el.getAttribute('label')
568
+ : this.mapEl?.locale?.dfExtent || 'Sub-layer';
569
+ },
570
+ set: (val) => {
571
+ if (val) {
572
+ this.el.setAttribute('label', val);
573
+ // Update internal prop to trigger watcher
574
+ this._label = val;
575
+ }
576
+ },
577
+ configurable: true
578
+ });
579
+ // Initialize _label from attribute if present
580
+ if (this.el.hasAttribute('label')) {
581
+ this._label = this.el.getAttribute('label');
582
+ }
583
+ if (!this.mapEl)
584
+ return;
585
+ await this.mapEl.whenProjectionDefined(this.units).catch(() => {
586
+ throw new Error('Undefined projection:' + this.units);
587
+ });
588
+ // when projection is changed, the parent map-layer._layer is created (so whenReady is fulfilled) but then removed,
589
+ // then the map-extent disconnectedCallback will be triggered by map-layer._onRemove() (clear the shadowRoot)
590
+ // even before connectedCallback is finished
591
+ // in this case, the microtasks triggered by the fulfillment of the removed MapLayer should be stopped as well
592
+ // !this.isConnected <=> the disconnectedCallback has run before
593
+ if (!this.el.isConnected)
594
+ return;
595
+ await this.mapEl.whenReady();
596
+ this._map = this.mapEl._map;
597
+ this.parentLayer?.addEventListener('map-change', this._changeHandler);
598
+ this.mapEl.addEventListener('map-projectionchange', this._changeHandler);
599
+ this._extentLayer = mapExtentLayer({
600
+ opacity: this.opacityValue,
601
+ crs: M[this.units],
602
+ zIndex: this.position,
603
+ extentEl: this.el
604
+ });
605
+ // Publish to element for MapML compatibility
606
+ this.el._extentLayer = this._extentLayer;
607
+ // this._layerControlHTML is the fieldset for the extent in the LayerControl
608
+ // Create layer control HTML and ensure it's captured on the component instance
609
+ const layerControlHTML = createLayerControlExtentHTML.call(this);
610
+ this._layerControlHTML = layerControlHTML;
611
+ // Also ensure the DOM element reference is synced (MapML compatibility)
612
+ this.el._layerControlHTML = layerControlHTML;
613
+ this.el._layerControlLabel = this._layerControlLabel;
614
+ this.el._layerControlCheckbox = this._layerControlCheckbox;
615
+ this.el._opacityControl = this._opacityControl;
616
+ this.el._opacitySlider = this._opacitySlider;
617
+ this.el._selectdetails = this._selectdetails;
618
+ // Wait for map-link elements to be ready before calculating bounds
619
+ await this._waitForTrefLinks();
620
+ this._calculateBounds();
621
+ // Handle initial checked state - add extent layer to parent if checked
622
+ this._handleChange();
623
+ // instead of children using parents' whenReady which can be cyclic,
624
+ // when this element is ready, run stuff that is only available after
625
+ // initialization
626
+ this._runMutationObserver(this.el.children);
627
+ // make sure same thing happens when children are added
628
+ this._bindMutationObserver();
629
+ }
630
+ /*
631
+ * Set up a function to watch additions of child elements of map-extent
632
+ * and to invoke desired side effects of those additions via
633
+ * _runMutationObserver
634
+ */
635
+ _bindMutationObserver() {
636
+ this._observer = new MutationObserver((mutationList) => {
637
+ for (let mutation of mutationList) {
638
+ // Handle attribute removals for 'label'
639
+ if (mutation.type === 'attributes' && mutation.attributeName === 'label') {
640
+ if (!this.el.hasAttribute('label')) {
641
+ this._label = this.mapEl?.locale?.dfExtent || 'Sub-layer';
642
+ }
643
+ }
644
+ // the attributes changes should be handled by attributeChangedCallback()
645
+ if (mutation.type === 'childList') {
646
+ this._runMutationObserver(mutation.addedNodes);
647
+ }
648
+ }
649
+ });
650
+ // Observe both childList and attribute changes for 'label'
651
+ this._observer.observe(this.el, {
652
+ childList: true,
653
+ attributes: true,
654
+ attributeFilter: ['label']
655
+ });
656
+ }
657
+ _runMutationObserver(elementsGroup) {
658
+ const _addMetaElement = (_mapMeta) => {
659
+ this.whenReady().then(() => {
660
+ this._calculateBounds();
661
+ this._validateDisabled();
662
+ });
663
+ };
664
+ const _addStylesheetLink = (mapLink) => {
665
+ this.whenReady().then(() => {
666
+ this._extentLayer.renderStyles(mapLink);
667
+ });
668
+ };
669
+ const _addStyleElement = (mapStyle) => {
670
+ this.whenReady().then(() => {
671
+ this._extentLayer.renderStyles(mapStyle);
672
+ });
673
+ };
674
+ for (let i = 0; i < elementsGroup.length; ++i) {
675
+ let element = elementsGroup[i];
676
+ switch (element.nodeName) {
677
+ case 'MAP-META':
678
+ const name = element.hasAttribute('name') &&
679
+ (element.getAttribute('name').toLowerCase() === 'zoom' ||
680
+ element.getAttribute('name').toLowerCase() === 'extent');
681
+ if (name && element.hasAttribute('content')) {
682
+ _addMetaElement();
683
+ }
684
+ break;
685
+ case 'MAP-LINK':
686
+ if (element.link && !element.link.isConnected)
687
+ _addStylesheetLink(element);
688
+ break;
689
+ case 'MAP-STYLE':
690
+ if (element.styleElement && !element.styleElement.isConnected) {
691
+ _addStyleElement(element);
692
+ }
693
+ break;
694
+ }
695
+ }
696
+ }
697
+ getLayerControlHTML() {
698
+ return this._layerControlHTML;
699
+ }
700
+ _projectionMatch() {
701
+ return (this.units.toUpperCase() === this._map.options.projection.toUpperCase());
702
+ }
703
+ _validateDisabled() {
704
+ if (!this._extentLayer)
705
+ return;
706
+ let templates = this.el.querySelectorAll('map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]');
707
+ const noTemplateVisible = () => {
708
+ let totalTemplateCount = templates.length, disabledTemplateCount = 0;
709
+ for (let j = 0; j < templates.length; j++) {
710
+ if (!templates[j].isVisible()) {
711
+ disabledTemplateCount++;
712
+ }
713
+ }
714
+ return disabledTemplateCount === totalTemplateCount;
715
+ };
716
+ if (!this._projectionMatch() || noTemplateVisible()) {
717
+ this.el.setAttribute('disabled', '');
718
+ this.disabled = true;
719
+ }
720
+ else {
721
+ this.el.removeAttribute('disabled');
722
+ this.disabled = false;
723
+ }
724
+ this.toggleLayerControlDisabled();
725
+ this._handleChange();
726
+ return this.disabled;
727
+ }
728
+ getMeta(metaName) {
729
+ let name = metaName.toLowerCase();
730
+ if (name !== 'extent' && name !== 'zoom' && name !== 'cs')
731
+ return;
732
+ return this.parentLayer.src
733
+ ? this.el.querySelector(`:scope > map-meta[name=${name}]`) ||
734
+ this.parentLayer.shadowRoot.querySelector(`:host > map-meta[name=${name}]`)
735
+ : this.el.querySelector(`:scope > map-meta[name=${name}]`) ||
736
+ this.parentLayer.querySelector(`:scope > map-meta[name=${name}]`);
737
+ }
738
+ // disable/italicize layer control elements based on the map-extent.disabled property
739
+ toggleLayerControlDisabled() {
740
+ let input = this._layerControlCheckbox, label = this._layerControlLabel, // access to the label for the specific map-extent
741
+ opacityControl = this._opacityControl, opacitySlider = this._opacitySlider, selectDetails = this._selectdetails;
742
+ if (this.disabled) {
743
+ // update the status of layerControl
744
+ input.disabled = true;
745
+ opacitySlider.disabled = true;
746
+ label.style.fontStyle = 'italic';
747
+ opacityControl.style.fontStyle = 'italic';
748
+ if (selectDetails) {
749
+ selectDetails.forEach((i) => {
750
+ i.querySelectorAll('select').forEach((j) => {
751
+ j.disabled = true;
752
+ j.style.fontStyle = 'italic';
753
+ });
754
+ i.style.fontStyle = 'italic';
755
+ });
756
+ }
757
+ }
758
+ else {
759
+ input.disabled = false;
760
+ opacitySlider.disabled = false;
761
+ label.style.fontStyle = 'normal';
762
+ opacityControl.style.fontStyle = 'normal';
763
+ if (selectDetails) {
764
+ selectDetails.forEach((i) => {
765
+ i.querySelectorAll('select').forEach((j) => {
766
+ j.disabled = false;
767
+ j.style.fontStyle = 'normal';
768
+ });
769
+ i.style.fontStyle = 'normal';
770
+ });
771
+ }
772
+ }
773
+ }
774
+ _handleChange() {
775
+ // add _extentLayer to map if map-extent is checked, otherwise remove it
776
+ if (this.checked && !this.disabled && this.parentLayer._layer) {
777
+ // can be added to MapLayer LayerGroup no matter map-layer is checked or not
778
+ this._extentLayer.addTo(this.parentLayer._layer);
779
+ this._extentLayer.setZIndex(this.position);
780
+ }
781
+ else {
782
+ this.parentLayer._layer?.removeLayer(this._extentLayer);
783
+ }
784
+ // change the checkbox in the layer control to match map-extent.checked
785
+ // doesn't trigger the event handler because it's not user-caused AFAICT
786
+ }
787
+ _validateLayerControlContainerHidden() {
788
+ let extentsFieldset = this.parentLayer._propertiesGroupAnatomy;
789
+ if (!extentsFieldset)
790
+ return;
791
+ // Get all map-extent elements (not just non-hidden ones)
792
+ const allExtents = this.parentLayer.src
793
+ ? Array.from(this.parentLayer.shadowRoot.querySelectorAll(':host > map-extent'))
794
+ : Array.from(this.parentLayer.querySelectorAll(':scope > map-extent'));
795
+ // Count visible extents using component property, not DOM attribute
796
+ const numberOfVisibleSublayers = allExtents.filter(extent => !extent.hidden).length;
797
+ if (numberOfVisibleSublayers === 0) {
798
+ extentsFieldset.setAttribute('hidden', '');
799
+ }
800
+ else {
801
+ extentsFieldset.removeAttribute('hidden');
802
+ }
803
+ }
804
+ disconnectedCallback() {
805
+ // in case of projection change, the disconnectedcallback will be triggered by removing map-layer._layer even before
806
+ // map-extent.connectedcallback is finished (because it will wait for the map-layer to be ready)
807
+ // !this._extentLayer <=> this.connectedCallback has not yet been finished before disconnectedCallback is triggered
808
+ if (this.el.hasAttribute('data-moving') ||
809
+ this.parentLayer?.hasAttribute('data-moving') ||
810
+ !this._extentLayer)
811
+ return;
812
+ this._validateLayerControlContainerHidden();
813
+ // remove layer control for map-extent from layer control DOM
814
+ // TODO: for the case of projection change, the layer control for map-extent has been created while _extentLayer has not yet been ready
815
+ if (this._layerControlHTML) {
816
+ this._layerControlHTML.remove();
817
+ }
818
+ if (this.parentLayer?._layer) {
819
+ this.parentLayer._layer.removeLayer(this._extentLayer);
820
+ }
821
+ if (this.parentLayer) {
822
+ this.parentLayer.removeEventListener('map-change', this._changeHandler);
823
+ }
824
+ if (this.mapEl) {
825
+ this.mapEl.removeEventListener('map-projectionchange', this._changeHandler);
826
+ }
827
+ this._boundsCalculated = false;
828
+ delete this._extentLayer;
829
+ if (this.parentLayer?._layer)
830
+ delete this.parentLayer._layer.bounds;
831
+ }
832
+ async _waitForTrefLinks() {
833
+ // Wait only for links with explicit tref attributes to have _templateVars initialized
834
+ // This is needed because _calculateBounds() calls link.getZoomBounds() and link.getBounds()
835
+ // which depend on _templateVars being set
836
+ // Links without tref would create circular dependency if we waited for them
837
+ const templates = this.el.querySelectorAll('map-link[rel=image][tref],map-link[rel=tile][tref],map-link[rel=features][tref],map-link[rel=query][tref]');
838
+ const linksVarsReady = [];
839
+ for (let link of Array.from(templates)) {
840
+ // Wait for _templateVars to be set, not for _templatedLayer to be created
841
+ linksVarsReady.push(new Promise((resolve) => {
842
+ if (link._templateVars) {
843
+ resolve();
844
+ }
845
+ else {
846
+ const checkInterval = setInterval(() => {
847
+ if (link._templateVars) {
848
+ clearInterval(checkInterval);
849
+ resolve();
850
+ }
851
+ }, 10);
852
+ // Timeout after 1 second
853
+ setTimeout(() => {
854
+ clearInterval(checkInterval);
855
+ resolve(); // Resolve anyway to not block forever
856
+ }, 1000);
857
+ }
858
+ }));
859
+ }
860
+ return Promise.all(linksVarsReady);
861
+ }
862
+ _calculateBounds() {
863
+ delete this._extentLayer.bounds;
864
+ delete this._extentLayer.zoomBounds;
865
+ if (this.parentLayer._layer)
866
+ delete this.parentLayer._layer.bounds;
867
+ let templates = this.el.querySelectorAll('map-link[rel=image]:not([disabled]),map-link[rel=tile]:not([disabled]),map-link[rel=features]:not([disabled]),map-link[rel=query]:not([disabled])');
868
+ // initialize bounds from this.scope > map-meta
869
+ let bounds = this.el.querySelector(':scope > map-meta[name=extent][content]')
870
+ ? ContextMenu.Util.getBoundsFromMeta(this.el) // TODO rewrite this pile of doo doo
871
+ : undefined;
872
+ // initialize zoom bounds from this.scope > map-meta
873
+ let zoomBounds = this.el.querySelector(':scope > map-meta[name=zoom][content]')
874
+ ? ContextMenu.Util.getZoomBoundsFromMeta(this.el) // TODO rewrite this pile of doo doo
875
+ : undefined;
876
+ // bounds should be able to be calculated unconditionally, not depend on map-extent.checked
877
+ for (let j = 0; j < templates.length; j++) {
878
+ const templateZoomBounds = templates[j].getZoomBounds(), templateBounds = templates[j].getBounds();
879
+ let zoomMax = zoomBounds && zoomBounds.hasOwnProperty('maxZoom')
880
+ ? zoomBounds.maxZoom
881
+ : -Infinity, zoomMin = zoomBounds && zoomBounds.hasOwnProperty('minZoom')
882
+ ? zoomBounds.minZoom
883
+ : Infinity, minNativeZoom = zoomBounds && zoomBounds.hasOwnProperty('minNativeZoom')
884
+ ? zoomBounds.minNativeZoom
885
+ : Infinity, maxNativeZoom = zoomBounds && zoomBounds.hasOwnProperty('maxNativeZoom')
886
+ ? zoomBounds.maxNativeZoom
887
+ : -Infinity;
888
+ if (!zoomBounds) {
889
+ zoomBounds = Object.assign({}, templateZoomBounds);
890
+ }
891
+ else {
892
+ zoomMax = Math.max(zoomMax, templateZoomBounds.maxZoom);
893
+ zoomMin = Math.min(zoomMin, templateZoomBounds.minZoom);
894
+ maxNativeZoom = Math.max(maxNativeZoom, templateZoomBounds.maxNativeZoom);
895
+ minNativeZoom = Math.min(minNativeZoom, templateZoomBounds.minNativeZoom);
896
+ zoomBounds.minZoom = zoomMin;
897
+ zoomBounds.maxZoom = zoomMax;
898
+ zoomBounds.minNativeZoom = minNativeZoom;
899
+ zoomBounds.maxNativeZoom = maxNativeZoom;
900
+ }
901
+ if (!bounds) {
902
+ bounds = ContextMenu.leafletSrcExports.bounds(templateBounds.min, templateBounds.max);
903
+ }
904
+ else {
905
+ bounds.extend(templateBounds);
906
+ }
907
+ }
908
+ if (bounds) {
909
+ this._extentLayer.bounds = bounds;
910
+ }
911
+ else {
912
+ this._extentLayer.bounds = ContextMenu.leafletSrcExports.bounds(M[this.units].options.bounds.min, M[this.units].options.bounds.max);
913
+ }
914
+ if (!zoomBounds)
915
+ zoomBounds = {};
916
+ if (!zoomBounds.hasOwnProperty('minZoom')) {
917
+ zoomBounds.minZoom = 0;
918
+ }
919
+ if (!zoomBounds.hasOwnProperty('maxZoom')) {
920
+ zoomBounds.maxZoom = M[this.units].options.resolutions.length - 1;
921
+ }
922
+ if (!zoomBounds.hasOwnProperty('minNativeZoom') ||
923
+ zoomBounds.minNativeZoom === Infinity) {
924
+ zoomBounds.minNativeZoom = zoomBounds.minZoom;
925
+ }
926
+ if (!zoomBounds.hasOwnProperty('maxNativeZoom') ||
927
+ zoomBounds.maxNativeZoom === -Infinity) {
928
+ zoomBounds.maxNativeZoom = zoomBounds.maxZoom;
929
+ }
930
+ this._extentLayer.zoomBounds = zoomBounds;
931
+ this._boundsCalculated = true;
932
+ }
933
+ async whenReady() {
934
+ return new Promise((resolve, reject) => {
935
+ let interval, failureTimer;
936
+ if (this._extentLayer && this._boundsCalculated) {
937
+ resolve();
938
+ }
939
+ else {
940
+ let extentElement = this.el;
941
+ interval = setInterval(testForExtent, 300, extentElement);
942
+ failureTimer = setTimeout(extentNotDefined, 10000);
943
+ }
944
+ function testForExtent(extentElement) {
945
+ if (extentElement._extentLayer && extentElement._boundsCalculated) {
946
+ clearInterval(interval);
947
+ clearTimeout(failureTimer);
948
+ resolve();
949
+ }
950
+ else if (!extentElement.isConnected) {
951
+ clearInterval(interval);
952
+ clearTimeout(failureTimer);
953
+ reject('map-extent was disconnected while waiting to be ready');
954
+ }
955
+ }
956
+ function extentNotDefined() {
957
+ clearInterval(interval);
958
+ clearTimeout(failureTimer);
959
+ reject('Timeout reached waiting for extent to be ready');
960
+ }
961
+ });
962
+ }
963
+ render() {
964
+ return null;
965
+ }
966
+ async whenLinksReady() {
967
+ let templates = this.el.querySelectorAll('map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]');
968
+ let linksReady = [];
969
+ for (let link of Array.from(templates)) {
970
+ linksReady.push(link.whenReady());
971
+ }
972
+ return Promise.allSettled(linksReady);
973
+ }
974
+ static get watchers() { return {
975
+ "units": [{
976
+ "unitsChanged": 0
977
+ }],
978
+ "_label": [{
979
+ "labelChanged": 0
980
+ }],
981
+ "checked": [{
982
+ "checkedChanged": 0
983
+ }],
984
+ "_opacity": [{
985
+ "opacityChanged": 0
986
+ }],
987
+ "hidden": [{
988
+ "hiddenChanged": 0
989
+ }]
990
+ }; }
991
+ };
992
+
993
+ exports.map_extent = GcdsMapExtent;