@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,809 @@
1
+ import { bounds as Lbounds, point as Lpoint } from "leaflet";
2
+ import { Util } from "../utils/mapml/Util.js";
3
+ import { mapExtentLayer } from "../utils/mapml/layers/MapExtentLayer.js";
4
+ import { createLayerControlExtentHTML } from "../utils/mapml/elementSupport/extents/createLayerControlForExtent.js";
5
+ import { calculatePosition } from "../utils/mapml/elementSupport/layers/calculatePosition.js";
6
+ export class GcdsMapExtent {
7
+ el;
8
+ checked = false;
9
+ _label;
10
+ opacity = 1;
11
+ _opacity;
12
+ hidden = false;
13
+ units;
14
+ disabled = false;
15
+ // Internal getter for use within component
16
+ get label() {
17
+ return this._label || this.mapEl?.locale?.dfExtent || 'Sub-layer';
18
+ }
19
+ get opacityValue() {
20
+ return this._opacity ?? this.opacity ?? 1.0;
21
+ }
22
+ mapEl;
23
+ parentLayer;
24
+ _map;
25
+ _extentLayer;
26
+ _layerControlHTML;
27
+ _layerControlCheckbox;
28
+ _layerControlLabel;
29
+ _opacityControl;
30
+ _opacitySlider;
31
+ _selectdetails;
32
+ _observer;
33
+ _changeHandler;
34
+ _boundsCalculated = false;
35
+ unitsChanged(newValue, oldValue) {
36
+ if (this._extentLayer && oldValue !== newValue) {
37
+ // handle units change
38
+ }
39
+ }
40
+ labelChanged() {
41
+ if (this._layerControlHTML) {
42
+ this._layerControlHTML.querySelector('.mapml-extent-item-name').textContent = this.label;
43
+ }
44
+ }
45
+ checkedChanged() {
46
+ if (this.parentLayer && this._extentLayer) {
47
+ this.parentLayer
48
+ .whenReady()
49
+ .then(() => {
50
+ this._handleChange();
51
+ this._calculateBounds();
52
+ if (this._layerControlCheckbox) {
53
+ this._layerControlCheckbox.checked = this.checked;
54
+ }
55
+ })
56
+ .catch((error) => {
57
+ console.log('Error while waiting on parentLayer for map-extent checked callback: ' +
58
+ error);
59
+ });
60
+ }
61
+ }
62
+ opacityChanged(newValue, oldValue) {
63
+ // This watcher handles programmatic changes to the opacity property
64
+ if (oldValue !== newValue && this._extentLayer) {
65
+ this._opacity = newValue;
66
+ this._extentLayer.changeOpacity(newValue);
67
+ // Update opacity slider if it exists
68
+ if (this._opacitySlider) {
69
+ this._opacitySlider.value = newValue.toString();
70
+ }
71
+ }
72
+ }
73
+ hiddenChanged(newValue, oldValue) {
74
+ // Only process hidden changes after the extent is fully initialized
75
+ // During initial load, this will be handled in connectedCallback
76
+ if (oldValue !== newValue && this._extentLayer && this._layerControlHTML) {
77
+ this._applyHiddenState(newValue);
78
+ }
79
+ }
80
+ _applyHiddenState(isHidden) {
81
+ if (!this._extentLayer || !this._layerControlHTML || !this.parentLayer)
82
+ return;
83
+ this.parentLayer
84
+ .whenReady()
85
+ .then(() => {
86
+ let extentsRootFieldset = this.parentLayer._propertiesGroupAnatomy;
87
+ // Get all map-extent elements and filter by component property, not DOM attribute
88
+ const allExtents = this.parentLayer.src
89
+ ? Array.from(this.parentLayer.shadowRoot.querySelectorAll(':host > map-extent'))
90
+ : Array.from(this.parentLayer.querySelectorAll(':scope > map-extent'));
91
+ // Filter visible extents using component property
92
+ const visibleExtents = allExtents.filter(extent => !extent.hidden);
93
+ let position = visibleExtents.indexOf(this.el);
94
+ if (isHidden) {
95
+ // Hidden was set to true - remove from layer control (hide from user)
96
+ this._layerControlHTML.remove();
97
+ }
98
+ else {
99
+ // Hidden was set to false - add back to layer control in calculated position
100
+ if (position === 0) {
101
+ extentsRootFieldset.insertAdjacentElement('afterbegin', this._layerControlHTML);
102
+ }
103
+ else if (position > 0) {
104
+ Array.from(this.parentLayer.src
105
+ ? this.parentLayer.shadowRoot.querySelectorAll(':host > map-extent:not([hidden])')
106
+ : this.parentLayer.querySelectorAll(':scope > map-extent:not([hidden])'))[position - 1]._layerControlHTML.insertAdjacentElement('afterend', this._layerControlHTML);
107
+ }
108
+ }
109
+ this._validateLayerControlContainerHidden();
110
+ })
111
+ .catch(() => {
112
+ console.log('Error while waiting on parentLayer for map-extent hidden callback');
113
+ });
114
+ }
115
+ get extent() {
116
+ const getExtent = (extent) => {
117
+ return Object.assign(Util._convertAndFormatPCRS(extent._extentLayer.bounds, M[extent.units], extent.units), { zoom: extent._extentLayer.zoomBounds });
118
+ };
119
+ const getCalculatedExtent = (extent) => {
120
+ extent._calculateBounds();
121
+ return getExtent(extent);
122
+ };
123
+ return this._extentLayer.bounds
124
+ ? getExtent(this)
125
+ : getCalculatedExtent(this);
126
+ }
127
+ get position() {
128
+ return calculatePosition(this.el);
129
+ }
130
+ getOuterHTML() {
131
+ let tempElement = this.el.cloneNode(true);
132
+ if (this.el.querySelector('map-link')) {
133
+ let mapLinks = tempElement.querySelectorAll('map-link');
134
+ mapLinks.forEach((mapLink) => {
135
+ if (mapLink.hasAttribute('href')) {
136
+ mapLink.setAttribute('href', decodeURI(new URL(mapLink.getAttribute('href'), this.el.baseURI ? this.el.baseURI : document.baseURI).href));
137
+ }
138
+ else if (mapLink.hasAttribute('tref')) {
139
+ mapLink.setAttribute('tref', decodeURI(new URL(mapLink.getAttribute('tref'), this.el.baseURI ? this.el.baseURI : document.baseURI).href));
140
+ }
141
+ });
142
+ }
143
+ let outerLayer = tempElement.outerHTML;
144
+ tempElement.remove();
145
+ return outerLayer;
146
+ }
147
+ zoomTo() {
148
+ let extent = this.extent;
149
+ 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 = Lbounds(Lpoint(xmin, ymin), Lpoint(xmax, ymax)), center = map.options.crs.unproject(bounds.getCenter(true)), maxZoom = extent.zoom.maxZoom, minZoom = extent.zoom.minZoom;
150
+ map.setView(center, Util.getMaxZoom(bounds, map, minZoom, maxZoom), {
151
+ animate: false
152
+ });
153
+ }
154
+ getMapEl() {
155
+ return Util.getClosest(this.el, 'gcds-ext-map');
156
+ }
157
+ getLayerEl() {
158
+ return Util.getClosest(this.el, 'map-layer,layer-');
159
+ }
160
+ async connectedCallback() {
161
+ // Initialize default values and bind handlers
162
+ this._opacity = this.opacityValue;
163
+ this._changeHandler = this._handleChange.bind(this);
164
+ this.parentLayer = this.el.parentLayer = this.getLayerEl();
165
+ if (this.el.hasAttribute('data-moving') ||
166
+ this.parentLayer?.hasAttribute('data-moving'))
167
+ return;
168
+ this.mapEl = this.getMapEl();
169
+ // Add MapML compatibility methods to the element
170
+ this.el.getMapEl = this.getMapEl.bind(this);
171
+ this.el.getLayerEl = this.getLayerEl.bind(this);
172
+ this.el.getLayerControlHTML = this.getLayerControlHTML.bind(this);
173
+ this.el.zoomTo = this.zoomTo.bind(this);
174
+ this.el._validateDisabled = this._validateDisabled.bind(this);
175
+ this.el.getMeta = this.getMeta.bind(this);
176
+ this.el.getOuterHTML = this.getOuterHTML.bind(this);
177
+ // this is necessary for true "whenReady" being true because bounds
178
+ // being established is pretty important. This is different from MapML.js;
179
+ // TODO it may be to port this idea back to MapML.js tbd.
180
+ Object.defineProperty(this.el, '_boundsCalculated', {
181
+ get: () => this._boundsCalculated,
182
+ configurable: true,
183
+ enumerable: true
184
+ });
185
+ // Add extent getter on element for MapML compatibility
186
+ Object.defineProperty(this.el, 'extent', {
187
+ get: () => {
188
+ return this.extent;
189
+ },
190
+ configurable: true
191
+ });
192
+ // Add label getter/setter on element for MapML compatibility
193
+ Object.defineProperty(this.el, 'label', {
194
+ get: () => {
195
+ return this.el.hasAttribute('label')
196
+ ? this.el.getAttribute('label')
197
+ : this.mapEl?.locale?.dfExtent || 'Sub-layer';
198
+ },
199
+ set: (val) => {
200
+ if (val) {
201
+ this.el.setAttribute('label', val);
202
+ // Update internal prop to trigger watcher
203
+ this._label = val;
204
+ }
205
+ },
206
+ configurable: true
207
+ });
208
+ // Initialize _label from attribute if present
209
+ if (this.el.hasAttribute('label')) {
210
+ this._label = this.el.getAttribute('label');
211
+ }
212
+ if (!this.mapEl)
213
+ return;
214
+ await this.mapEl.whenProjectionDefined(this.units).catch(() => {
215
+ throw new Error('Undefined projection:' + this.units);
216
+ });
217
+ // when projection is changed, the parent map-layer._layer is created (so whenReady is fulfilled) but then removed,
218
+ // then the map-extent disconnectedCallback will be triggered by map-layer._onRemove() (clear the shadowRoot)
219
+ // even before connectedCallback is finished
220
+ // in this case, the microtasks triggered by the fulfillment of the removed MapLayer should be stopped as well
221
+ // !this.isConnected <=> the disconnectedCallback has run before
222
+ if (!this.el.isConnected)
223
+ return;
224
+ await this.mapEl.whenReady();
225
+ this._map = this.mapEl._map;
226
+ this.parentLayer?.addEventListener('map-change', this._changeHandler);
227
+ this.mapEl.addEventListener('map-projectionchange', this._changeHandler);
228
+ this._extentLayer = mapExtentLayer({
229
+ opacity: this.opacityValue,
230
+ crs: M[this.units],
231
+ zIndex: this.position,
232
+ extentEl: this.el
233
+ });
234
+ // Publish to element for MapML compatibility
235
+ this.el._extentLayer = this._extentLayer;
236
+ // this._layerControlHTML is the fieldset for the extent in the LayerControl
237
+ // Create layer control HTML and ensure it's captured on the component instance
238
+ const layerControlHTML = createLayerControlExtentHTML.call(this);
239
+ this._layerControlHTML = layerControlHTML;
240
+ // Also ensure the DOM element reference is synced (MapML compatibility)
241
+ this.el._layerControlHTML = layerControlHTML;
242
+ this.el._layerControlLabel = this._layerControlLabel;
243
+ this.el._layerControlCheckbox = this._layerControlCheckbox;
244
+ this.el._opacityControl = this._opacityControl;
245
+ this.el._opacitySlider = this._opacitySlider;
246
+ this.el._selectdetails = this._selectdetails;
247
+ // Wait for map-link elements to be ready before calculating bounds
248
+ await this._waitForTrefLinks();
249
+ this._calculateBounds();
250
+ // Handle initial checked state - add extent layer to parent if checked
251
+ this._handleChange();
252
+ // instead of children using parents' whenReady which can be cyclic,
253
+ // when this element is ready, run stuff that is only available after
254
+ // initialization
255
+ this._runMutationObserver(this.el.children);
256
+ // make sure same thing happens when children are added
257
+ this._bindMutationObserver();
258
+ }
259
+ /*
260
+ * Set up a function to watch additions of child elements of map-extent
261
+ * and to invoke desired side effects of those additions via
262
+ * _runMutationObserver
263
+ */
264
+ _bindMutationObserver() {
265
+ this._observer = new MutationObserver((mutationList) => {
266
+ for (let mutation of mutationList) {
267
+ // Handle attribute removals for 'label'
268
+ if (mutation.type === 'attributes' && mutation.attributeName === 'label') {
269
+ if (!this.el.hasAttribute('label')) {
270
+ this._label = this.mapEl?.locale?.dfExtent || 'Sub-layer';
271
+ }
272
+ }
273
+ // the attributes changes should be handled by attributeChangedCallback()
274
+ if (mutation.type === 'childList') {
275
+ this._runMutationObserver(mutation.addedNodes);
276
+ }
277
+ }
278
+ });
279
+ // Observe both childList and attribute changes for 'label'
280
+ this._observer.observe(this.el, {
281
+ childList: true,
282
+ attributes: true,
283
+ attributeFilter: ['label']
284
+ });
285
+ }
286
+ _runMutationObserver(elementsGroup) {
287
+ const _addMetaElement = (_mapMeta) => {
288
+ this.whenReady().then(() => {
289
+ this._calculateBounds();
290
+ this._validateDisabled();
291
+ });
292
+ };
293
+ const _addStylesheetLink = (mapLink) => {
294
+ this.whenReady().then(() => {
295
+ this._extentLayer.renderStyles(mapLink);
296
+ });
297
+ };
298
+ const _addStyleElement = (mapStyle) => {
299
+ this.whenReady().then(() => {
300
+ this._extentLayer.renderStyles(mapStyle);
301
+ });
302
+ };
303
+ for (let i = 0; i < elementsGroup.length; ++i) {
304
+ let element = elementsGroup[i];
305
+ switch (element.nodeName) {
306
+ case 'MAP-META':
307
+ const name = element.hasAttribute('name') &&
308
+ (element.getAttribute('name').toLowerCase() === 'zoom' ||
309
+ element.getAttribute('name').toLowerCase() === 'extent');
310
+ if (name && element.hasAttribute('content')) {
311
+ _addMetaElement(element);
312
+ }
313
+ break;
314
+ case 'MAP-LINK':
315
+ if (element.link && !element.link.isConnected)
316
+ _addStylesheetLink(element);
317
+ break;
318
+ case 'MAP-STYLE':
319
+ if (element.styleElement && !element.styleElement.isConnected) {
320
+ _addStyleElement(element);
321
+ }
322
+ break;
323
+ default:
324
+ break;
325
+ }
326
+ }
327
+ }
328
+ getLayerControlHTML() {
329
+ return this._layerControlHTML;
330
+ }
331
+ _projectionMatch() {
332
+ return (this.units.toUpperCase() === this._map.options.projection.toUpperCase());
333
+ }
334
+ _validateDisabled() {
335
+ if (!this._extentLayer)
336
+ return;
337
+ let templates = this.el.querySelectorAll('map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]');
338
+ const noTemplateVisible = () => {
339
+ let totalTemplateCount = templates.length, disabledTemplateCount = 0;
340
+ for (let j = 0; j < templates.length; j++) {
341
+ if (!templates[j].isVisible()) {
342
+ disabledTemplateCount++;
343
+ }
344
+ }
345
+ return disabledTemplateCount === totalTemplateCount;
346
+ };
347
+ if (!this._projectionMatch() || noTemplateVisible()) {
348
+ this.el.setAttribute('disabled', '');
349
+ this.disabled = true;
350
+ }
351
+ else {
352
+ this.el.removeAttribute('disabled');
353
+ this.disabled = false;
354
+ }
355
+ this.toggleLayerControlDisabled();
356
+ this._handleChange();
357
+ return this.disabled;
358
+ }
359
+ getMeta(metaName) {
360
+ let name = metaName.toLowerCase();
361
+ if (name !== 'extent' && name !== 'zoom' && name !== 'cs')
362
+ return;
363
+ return this.parentLayer.src
364
+ ? this.el.querySelector(`:scope > map-meta[name=${name}]`) ||
365
+ this.parentLayer.shadowRoot.querySelector(`:host > map-meta[name=${name}]`)
366
+ : this.el.querySelector(`:scope > map-meta[name=${name}]`) ||
367
+ this.parentLayer.querySelector(`:scope > map-meta[name=${name}]`);
368
+ }
369
+ // disable/italicize layer control elements based on the map-extent.disabled property
370
+ toggleLayerControlDisabled() {
371
+ let input = this._layerControlCheckbox, label = this._layerControlLabel, // access to the label for the specific map-extent
372
+ opacityControl = this._opacityControl, opacitySlider = this._opacitySlider, selectDetails = this._selectdetails;
373
+ if (this.disabled) {
374
+ // update the status of layerControl
375
+ input.disabled = true;
376
+ opacitySlider.disabled = true;
377
+ label.style.fontStyle = 'italic';
378
+ opacityControl.style.fontStyle = 'italic';
379
+ if (selectDetails) {
380
+ selectDetails.forEach((i) => {
381
+ i.querySelectorAll('select').forEach((j) => {
382
+ j.disabled = true;
383
+ j.style.fontStyle = 'italic';
384
+ });
385
+ i.style.fontStyle = 'italic';
386
+ });
387
+ }
388
+ }
389
+ else {
390
+ input.disabled = false;
391
+ opacitySlider.disabled = false;
392
+ label.style.fontStyle = 'normal';
393
+ opacityControl.style.fontStyle = 'normal';
394
+ if (selectDetails) {
395
+ selectDetails.forEach((i) => {
396
+ i.querySelectorAll('select').forEach((j) => {
397
+ j.disabled = false;
398
+ j.style.fontStyle = 'normal';
399
+ });
400
+ i.style.fontStyle = 'normal';
401
+ });
402
+ }
403
+ }
404
+ }
405
+ _handleChange() {
406
+ // add _extentLayer to map if map-extent is checked, otherwise remove it
407
+ if (this.checked && !this.disabled && this.parentLayer._layer) {
408
+ // can be added to MapLayer LayerGroup no matter map-layer is checked or not
409
+ this._extentLayer.addTo(this.parentLayer._layer);
410
+ this._extentLayer.setZIndex(this.position);
411
+ }
412
+ else {
413
+ this.parentLayer._layer?.removeLayer(this._extentLayer);
414
+ }
415
+ // change the checkbox in the layer control to match map-extent.checked
416
+ // doesn't trigger the event handler because it's not user-caused AFAICT
417
+ }
418
+ _validateLayerControlContainerHidden() {
419
+ let extentsFieldset = this.parentLayer._propertiesGroupAnatomy;
420
+ if (!extentsFieldset)
421
+ return;
422
+ // Get all map-extent elements (not just non-hidden ones)
423
+ const allExtents = this.parentLayer.src
424
+ ? Array.from(this.parentLayer.shadowRoot.querySelectorAll(':host > map-extent'))
425
+ : Array.from(this.parentLayer.querySelectorAll(':scope > map-extent'));
426
+ // Count visible extents using component property, not DOM attribute
427
+ const numberOfVisibleSublayers = allExtents.filter(extent => !extent.hidden).length;
428
+ if (numberOfVisibleSublayers === 0) {
429
+ extentsFieldset.setAttribute('hidden', '');
430
+ }
431
+ else {
432
+ extentsFieldset.removeAttribute('hidden');
433
+ }
434
+ }
435
+ disconnectedCallback() {
436
+ // in case of projection change, the disconnectedcallback will be triggered by removing map-layer._layer even before
437
+ // map-extent.connectedcallback is finished (because it will wait for the map-layer to be ready)
438
+ // !this._extentLayer <=> this.connectedCallback has not yet been finished before disconnectedCallback is triggered
439
+ if (this.el.hasAttribute('data-moving') ||
440
+ this.parentLayer?.hasAttribute('data-moving') ||
441
+ !this._extentLayer)
442
+ return;
443
+ this._validateLayerControlContainerHidden();
444
+ // remove layer control for map-extent from layer control DOM
445
+ // TODO: for the case of projection change, the layer control for map-extent has been created while _extentLayer has not yet been ready
446
+ if (this._layerControlHTML) {
447
+ this._layerControlHTML.remove();
448
+ }
449
+ if (this.parentLayer?._layer) {
450
+ this.parentLayer._layer.removeLayer(this._extentLayer);
451
+ }
452
+ if (this.parentLayer) {
453
+ this.parentLayer.removeEventListener('map-change', this._changeHandler);
454
+ }
455
+ if (this.mapEl) {
456
+ this.mapEl.removeEventListener('map-projectionchange', this._changeHandler);
457
+ }
458
+ this._boundsCalculated = false;
459
+ delete this._extentLayer;
460
+ if (this.parentLayer?._layer)
461
+ delete this.parentLayer._layer.bounds;
462
+ }
463
+ async _waitForTrefLinks() {
464
+ // Wait only for links with explicit tref attributes to have _templateVars initialized
465
+ // This is needed because _calculateBounds() calls link.getZoomBounds() and link.getBounds()
466
+ // which depend on _templateVars being set
467
+ // Links without tref would create circular dependency if we waited for them
468
+ 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]');
469
+ const linksVarsReady = [];
470
+ for (let link of Array.from(templates)) {
471
+ // Wait for _templateVars to be set, not for _templatedLayer to be created
472
+ linksVarsReady.push(new Promise((resolve) => {
473
+ if (link._templateVars) {
474
+ resolve();
475
+ }
476
+ else {
477
+ const checkInterval = setInterval(() => {
478
+ if (link._templateVars) {
479
+ clearInterval(checkInterval);
480
+ resolve();
481
+ }
482
+ }, 10);
483
+ // Timeout after 1 second
484
+ setTimeout(() => {
485
+ clearInterval(checkInterval);
486
+ resolve(); // Resolve anyway to not block forever
487
+ }, 1000);
488
+ }
489
+ }));
490
+ }
491
+ return Promise.all(linksVarsReady);
492
+ }
493
+ _calculateBounds() {
494
+ delete this._extentLayer.bounds;
495
+ delete this._extentLayer.zoomBounds;
496
+ if (this.parentLayer._layer)
497
+ delete this.parentLayer._layer.bounds;
498
+ 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])');
499
+ // initialize bounds from this.scope > map-meta
500
+ let bounds = this.el.querySelector(':scope > map-meta[name=extent][content]')
501
+ ? Util.getBoundsFromMeta(this.el) // TODO rewrite this pile of doo doo
502
+ : undefined;
503
+ // initialize zoom bounds from this.scope > map-meta
504
+ let zoomBounds = this.el.querySelector(':scope > map-meta[name=zoom][content]')
505
+ ? Util.getZoomBoundsFromMeta(this.el) // TODO rewrite this pile of doo doo
506
+ : undefined;
507
+ // bounds should be able to be calculated unconditionally, not depend on map-extent.checked
508
+ for (let j = 0; j < templates.length; j++) {
509
+ const templateZoomBounds = templates[j].getZoomBounds(), templateBounds = templates[j].getBounds();
510
+ let zoomMax = zoomBounds && zoomBounds.hasOwnProperty('maxZoom')
511
+ ? zoomBounds.maxZoom
512
+ : -Infinity, zoomMin = zoomBounds && zoomBounds.hasOwnProperty('minZoom')
513
+ ? zoomBounds.minZoom
514
+ : Infinity, minNativeZoom = zoomBounds && zoomBounds.hasOwnProperty('minNativeZoom')
515
+ ? zoomBounds.minNativeZoom
516
+ : Infinity, maxNativeZoom = zoomBounds && zoomBounds.hasOwnProperty('maxNativeZoom')
517
+ ? zoomBounds.maxNativeZoom
518
+ : -Infinity;
519
+ if (!zoomBounds) {
520
+ zoomBounds = Object.assign({}, templateZoomBounds);
521
+ }
522
+ else {
523
+ zoomMax = Math.max(zoomMax, templateZoomBounds.maxZoom);
524
+ zoomMin = Math.min(zoomMin, templateZoomBounds.minZoom);
525
+ maxNativeZoom = Math.max(maxNativeZoom, templateZoomBounds.maxNativeZoom);
526
+ minNativeZoom = Math.min(minNativeZoom, templateZoomBounds.minNativeZoom);
527
+ zoomBounds.minZoom = zoomMin;
528
+ zoomBounds.maxZoom = zoomMax;
529
+ zoomBounds.minNativeZoom = minNativeZoom;
530
+ zoomBounds.maxNativeZoom = maxNativeZoom;
531
+ }
532
+ if (!bounds) {
533
+ bounds = Lbounds(templateBounds.min, templateBounds.max);
534
+ }
535
+ else {
536
+ bounds.extend(templateBounds);
537
+ }
538
+ }
539
+ if (bounds) {
540
+ this._extentLayer.bounds = bounds;
541
+ }
542
+ else {
543
+ this._extentLayer.bounds = Lbounds(M[this.units].options.bounds.min, M[this.units].options.bounds.max);
544
+ }
545
+ if (!zoomBounds)
546
+ zoomBounds = {};
547
+ if (!zoomBounds.hasOwnProperty('minZoom')) {
548
+ zoomBounds.minZoom = 0;
549
+ }
550
+ if (!zoomBounds.hasOwnProperty('maxZoom')) {
551
+ zoomBounds.maxZoom = M[this.units].options.resolutions.length - 1;
552
+ }
553
+ if (!zoomBounds.hasOwnProperty('minNativeZoom') ||
554
+ zoomBounds.minNativeZoom === Infinity) {
555
+ zoomBounds.minNativeZoom = zoomBounds.minZoom;
556
+ }
557
+ if (!zoomBounds.hasOwnProperty('maxNativeZoom') ||
558
+ zoomBounds.maxNativeZoom === -Infinity) {
559
+ zoomBounds.maxNativeZoom = zoomBounds.maxZoom;
560
+ }
561
+ this._extentLayer.zoomBounds = zoomBounds;
562
+ this._boundsCalculated = true;
563
+ }
564
+ async whenReady() {
565
+ return new Promise((resolve, reject) => {
566
+ let interval, failureTimer;
567
+ if (this._extentLayer && this._boundsCalculated) {
568
+ resolve();
569
+ }
570
+ else {
571
+ let extentElement = this.el;
572
+ interval = setInterval(testForExtent, 300, extentElement);
573
+ failureTimer = setTimeout(extentNotDefined, 10000);
574
+ }
575
+ function testForExtent(extentElement) {
576
+ if (extentElement._extentLayer && extentElement._boundsCalculated) {
577
+ clearInterval(interval);
578
+ clearTimeout(failureTimer);
579
+ resolve();
580
+ }
581
+ else if (!extentElement.isConnected) {
582
+ clearInterval(interval);
583
+ clearTimeout(failureTimer);
584
+ reject('map-extent was disconnected while waiting to be ready');
585
+ }
586
+ }
587
+ function extentNotDefined() {
588
+ clearInterval(interval);
589
+ clearTimeout(failureTimer);
590
+ reject('Timeout reached waiting for extent to be ready');
591
+ }
592
+ });
593
+ }
594
+ render() {
595
+ return null;
596
+ }
597
+ async whenLinksReady() {
598
+ let templates = this.el.querySelectorAll('map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]');
599
+ let linksReady = [];
600
+ for (let link of Array.from(templates)) {
601
+ linksReady.push(link.whenReady());
602
+ }
603
+ return Promise.allSettled(linksReady);
604
+ }
605
+ static get is() { return "map-extent"; }
606
+ static get encapsulation() { return "shadow"; }
607
+ static get properties() {
608
+ return {
609
+ "checked": {
610
+ "type": "boolean",
611
+ "mutable": true,
612
+ "complexType": {
613
+ "original": "boolean",
614
+ "resolved": "boolean",
615
+ "references": {}
616
+ },
617
+ "required": false,
618
+ "optional": true,
619
+ "docs": {
620
+ "tags": [],
621
+ "text": ""
622
+ },
623
+ "getter": false,
624
+ "setter": false,
625
+ "reflect": true,
626
+ "attribute": "checked",
627
+ "defaultValue": "false"
628
+ },
629
+ "_label": {
630
+ "type": "string",
631
+ "mutable": true,
632
+ "complexType": {
633
+ "original": "string",
634
+ "resolved": "string",
635
+ "references": {}
636
+ },
637
+ "required": false,
638
+ "optional": true,
639
+ "docs": {
640
+ "tags": [],
641
+ "text": ""
642
+ },
643
+ "getter": false,
644
+ "setter": false,
645
+ "reflect": false,
646
+ "attribute": "_label"
647
+ },
648
+ "opacity": {
649
+ "type": "number",
650
+ "mutable": true,
651
+ "complexType": {
652
+ "original": "number",
653
+ "resolved": "number",
654
+ "references": {}
655
+ },
656
+ "required": false,
657
+ "optional": true,
658
+ "docs": {
659
+ "tags": [],
660
+ "text": ""
661
+ },
662
+ "getter": false,
663
+ "setter": false,
664
+ "reflect": false,
665
+ "attribute": "opacity",
666
+ "defaultValue": "1"
667
+ },
668
+ "_opacity": {
669
+ "type": "number",
670
+ "mutable": true,
671
+ "complexType": {
672
+ "original": "number",
673
+ "resolved": "number",
674
+ "references": {}
675
+ },
676
+ "required": false,
677
+ "optional": true,
678
+ "docs": {
679
+ "tags": [],
680
+ "text": ""
681
+ },
682
+ "getter": false,
683
+ "setter": false,
684
+ "reflect": false,
685
+ "attribute": "_opacity"
686
+ },
687
+ "hidden": {
688
+ "type": "boolean",
689
+ "mutable": true,
690
+ "complexType": {
691
+ "original": "boolean",
692
+ "resolved": "boolean",
693
+ "references": {}
694
+ },
695
+ "required": false,
696
+ "optional": false,
697
+ "docs": {
698
+ "tags": [],
699
+ "text": ""
700
+ },
701
+ "getter": false,
702
+ "setter": false,
703
+ "reflect": true,
704
+ "attribute": "hidden",
705
+ "defaultValue": "false"
706
+ },
707
+ "units": {
708
+ "type": "string",
709
+ "mutable": false,
710
+ "complexType": {
711
+ "original": "string",
712
+ "resolved": "string",
713
+ "references": {}
714
+ },
715
+ "required": true,
716
+ "optional": false,
717
+ "docs": {
718
+ "tags": [],
719
+ "text": ""
720
+ },
721
+ "getter": false,
722
+ "setter": false,
723
+ "reflect": true,
724
+ "attribute": "units"
725
+ },
726
+ "disabled": {
727
+ "type": "boolean",
728
+ "mutable": true,
729
+ "complexType": {
730
+ "original": "boolean",
731
+ "resolved": "boolean",
732
+ "references": {}
733
+ },
734
+ "required": false,
735
+ "optional": true,
736
+ "docs": {
737
+ "tags": [],
738
+ "text": ""
739
+ },
740
+ "getter": false,
741
+ "setter": false,
742
+ "reflect": true,
743
+ "attribute": "disabled",
744
+ "defaultValue": "false"
745
+ }
746
+ };
747
+ }
748
+ static get methods() {
749
+ return {
750
+ "whenReady": {
751
+ "complexType": {
752
+ "signature": "() => Promise<void>",
753
+ "parameters": [],
754
+ "references": {
755
+ "Promise": {
756
+ "location": "global",
757
+ "id": "global::Promise"
758
+ }
759
+ },
760
+ "return": "Promise<void>"
761
+ },
762
+ "docs": {
763
+ "text": "",
764
+ "tags": []
765
+ }
766
+ },
767
+ "whenLinksReady": {
768
+ "complexType": {
769
+ "signature": "() => Promise<PromiseSettledResult<any>[]>",
770
+ "parameters": [],
771
+ "references": {
772
+ "Promise": {
773
+ "location": "global",
774
+ "id": "global::Promise"
775
+ },
776
+ "PromiseSettledResult": {
777
+ "location": "global",
778
+ "id": "global::PromiseSettledResult"
779
+ }
780
+ },
781
+ "return": "Promise<PromiseSettledResult<any>[]>"
782
+ },
783
+ "docs": {
784
+ "text": "",
785
+ "tags": []
786
+ }
787
+ }
788
+ };
789
+ }
790
+ static get elementRef() { return "el"; }
791
+ static get watchers() {
792
+ return [{
793
+ "propName": "units",
794
+ "methodName": "unitsChanged"
795
+ }, {
796
+ "propName": "_label",
797
+ "methodName": "labelChanged"
798
+ }, {
799
+ "propName": "checked",
800
+ "methodName": "checkedChanged"
801
+ }, {
802
+ "propName": "_opacity",
803
+ "methodName": "opacityChanged"
804
+ }, {
805
+ "propName": "hidden",
806
+ "methodName": "hiddenChanged"
807
+ }];
808
+ }
809
+ }