@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,724 @@
1
+ import { bounds, point, extend } from "leaflet";
2
+ import { MapFeatureLayer } from "../utils/mapml/layers/MapFeatureLayer.js";
3
+ import { featureRenderer } from "../utils/mapml/features/featureRenderer.js";
4
+ import { Util } from "../utils/mapml/Util.js";
5
+ import proj4 from "proj4";
6
+ import { calculatePosition } from "../utils/mapml/elementSupport/layers/calculatePosition.js";
7
+ export class MapFeature {
8
+ el;
9
+ zoom;
10
+ min;
11
+ max;
12
+ _featureLayer;
13
+ _geometry;
14
+ _groupEl;
15
+ _observer;
16
+ _parentEl;
17
+ _initialZoom;
18
+ _getFeatureExtent;
19
+ zoomChanged(newValue, oldValue) {
20
+ if (oldValue !== newValue && this._featureLayer) {
21
+ this.reRender(this._featureLayer);
22
+ }
23
+ }
24
+ minChanged(newValue, oldValue) {
25
+ if (oldValue !== newValue && this._featureLayer) {
26
+ this.reRender(this._featureLayer);
27
+ }
28
+ }
29
+ maxChanged(newValue, oldValue) {
30
+ if (oldValue !== newValue && this._featureLayer) {
31
+ this.reRender(this._featureLayer);
32
+ }
33
+ }
34
+ get zoomValue() {
35
+ // for templated or queried features ** native zoom is only used for zoomTo() **
36
+ let meta = {}, metaEl = this.getMeta('zoom');
37
+ if (metaEl)
38
+ meta = Util._metaContentToObject(metaEl.getAttribute('content'));
39
+ if (this._parentEl?.nodeName === 'MAP-LINK') {
40
+ // nativeZoom = zoom attribute || (sd.map-meta zoom 'value' || 'max') || this._initialZoom
41
+ return +(this.el.hasAttribute('zoom')
42
+ ? this.el.getAttribute('zoom')
43
+ : meta['value']
44
+ ? meta['value']
45
+ : meta['max']
46
+ ? meta['max']
47
+ : this._initialZoom ?? this.getMapEl()?.zoom ?? 0);
48
+ }
49
+ else {
50
+ // for "static" features
51
+ // nativeZoom zoom attribute || this._initialZoom
52
+ return +(this.el.hasAttribute('zoom')
53
+ ? this.el.getAttribute('zoom')
54
+ : this._initialZoom ?? this.getMapEl()?.zoom ?? 0);
55
+ }
56
+ }
57
+ get minValue() {
58
+ // for templated or queried features
59
+ let meta = {}, metaEl = this.getMeta('zoom');
60
+ if (metaEl)
61
+ meta = Util._metaContentToObject(metaEl.getAttribute('content'));
62
+ let projectionMinZoom = 0;
63
+ if (this._parentEl?.nodeName === 'MAP-LINK') {
64
+ // minZoom = min attribute || sd.map-meta min zoom || map-link minZoom
65
+ return +(this.el.hasAttribute('min')
66
+ ? this.el.getAttribute('min')
67
+ : meta['min']
68
+ ? meta['min']
69
+ : this._parentEl.getZoomBounds().minZoom);
70
+ }
71
+ else {
72
+ // for "static" features
73
+ // minZoom = min attribute || map-meta zoom || projection minZoom
74
+ return +(this.el.hasAttribute('min')
75
+ ? this.el.getAttribute('min')
76
+ : meta['min']
77
+ ? meta['min']
78
+ : projectionMinZoom);
79
+ }
80
+ }
81
+ get maxValue() {
82
+ // for templated or queried features
83
+ let meta = {}, metaEl = this.getMeta('zoom');
84
+ if (metaEl)
85
+ meta = Util._metaContentToObject(metaEl.getAttribute('content'));
86
+ let projectionMaxZoom = this.getMapEl()?._map?.options.crs.options.resolutions.length - 1;
87
+ if (this._parentEl?.nodeName === 'MAP-LINK') {
88
+ // maxZoom = max attribute || sd.map-meta max zoom || map-link maxZoom
89
+ return +(this.el.hasAttribute('max')
90
+ ? this.el.getAttribute('max')
91
+ : meta['max']
92
+ ? meta['max']
93
+ : this._parentEl.getZoomBounds().maxZoom);
94
+ }
95
+ else {
96
+ // for "static" features
97
+ // maxZoom = max attribute || map-meta zoom max || projection maxZoom
98
+ return +(this.el.hasAttribute('max')
99
+ ? this.el.getAttribute('max')
100
+ : meta['max']
101
+ ? meta['max']
102
+ : projectionMaxZoom);
103
+ }
104
+ }
105
+ get extent() {
106
+ if (this.el.isConnected) {
107
+ // if the feature extent is the first time to be calculated or the feature extent is changed
108
+ if (!this._getFeatureExtent) {
109
+ this._getFeatureExtent = this._memoizeExtent();
110
+ }
111
+ return this._getFeatureExtent();
112
+ }
113
+ }
114
+ get position() {
115
+ return calculatePosition(this.el);
116
+ }
117
+ getMapEl() {
118
+ return Util.getClosest(this.el, 'gcds-ext-map');
119
+ }
120
+ getLayerEl() {
121
+ return Util.getClosest(this.el, 'map-layer,layer-');
122
+ }
123
+ async connectedCallback() {
124
+ // set the initial zoom of the map when features connected
125
+ // used for fallback zoom getter for static features
126
+ this._initialZoom = this.getMapEl()?.zoom;
127
+ this._parentEl =
128
+ this.el.parentNode?.nodeName === 'MAP-LAYER' ||
129
+ this.el.parentNode?.nodeName === 'LAYER-' ||
130
+ this.el.parentNode?.nodeName === 'MAP-LINK'
131
+ ? this.el.parentNode
132
+ : this.el.parentNode?.host;
133
+ if (this.getLayerEl()?.hasAttribute('data-moving') ||
134
+ this._parentEl?.parentElement?.hasAttribute('data-moving'))
135
+ return;
136
+ // Publish MapML compatibility methods on element
137
+ this.el.getMapEl = this.getMapEl.bind(this);
138
+ this.el.getLayerEl = this.getLayerEl.bind(this);
139
+ this.el.zoomTo = this.zoomTo.bind(this);
140
+ this.el.getZoomToZoom = this.getZoomToZoom.bind(this);
141
+ this.el.click = this.click.bind(this);
142
+ this.el.focus = this.focus.bind(this);
143
+ this.el.blur = this.blur.bind(this);
144
+ this.el.mapml2geojson = this.mapml2geojson.bind(this);
145
+ this.el.addFeature = this.addFeature.bind(this);
146
+ this.el.removeFeature = this.removeFeature.bind(this);
147
+ this.el.reRender = this.reRender.bind(this);
148
+ Object.defineProperty(this.el, 'zoom', {
149
+ get: () => this.zoomValue,
150
+ configurable: true,
151
+ enumerable: true
152
+ });
153
+ Object.defineProperty(this.el, 'extent', {
154
+ get: () => this.extent,
155
+ configurable: true,
156
+ enumerable: true
157
+ });
158
+ Object.defineProperty(this.el, 'position', {
159
+ get: () => this.position,
160
+ configurable: true,
161
+ enumerable: true
162
+ });
163
+ // Note: zoom, min, max are already exposed as @Prop with reflect: true
164
+ // so they don't need Object.defineProperty - they're already accessible on the element
165
+ if (this._parentEl?.nodeName === 'MAP-LAYER' ||
166
+ this._parentEl?.nodeName === 'LAYER-' ||
167
+ this._parentEl?.nodeName === 'MAP-LINK') {
168
+ this._createOrGetFeatureLayer();
169
+ }
170
+ // Expose properties on DOM element for MapML compatibility
171
+ Object.defineProperty(this.el, '_featureLayer', {
172
+ get: () => this._featureLayer,
173
+ configurable: true,
174
+ enumerable: true
175
+ });
176
+ Object.defineProperty(this.el, '_geometry', {
177
+ get: () => this._geometry,
178
+ configurable: true,
179
+ enumerable: true
180
+ });
181
+ // use observer to monitor the changes in mapFeature's subtree
182
+ this._observer = new MutationObserver((mutationList) => {
183
+ for (let mutation of mutationList) {
184
+ // the attributes changes of <map-feature> element should be handled by watchers
185
+ if (mutation.type === 'attributes' && mutation.target === this.el) {
186
+ return;
187
+ }
188
+ // re-render feature if there is any observed change
189
+ this.reRender(this._featureLayer);
190
+ }
191
+ });
192
+ this._observer.observe(this.el, {
193
+ childList: true,
194
+ subtree: true,
195
+ attributes: true,
196
+ attributeOldValue: true,
197
+ characterData: true
198
+ });
199
+ }
200
+ disconnectedCallback() {
201
+ if (this.getLayerEl()?.hasAttribute('data-moving') ||
202
+ this._parentEl?.parentElement?.hasAttribute('data-moving'))
203
+ return;
204
+ this._observer?.disconnect();
205
+ if (this._featureLayer) {
206
+ this.removeFeature(this._featureLayer);
207
+ // If this was the last feature in the layer, clean up the layer
208
+ if (this._featureLayer.getLayers().length === 0) {
209
+ if (this._featureLayer.options.renderer) {
210
+ // manually remove the shared renderer
211
+ this._featureLayer.options.renderer.remove();
212
+ }
213
+ this._featureLayer.remove();
214
+ this._featureLayer = null;
215
+ delete this._featureLayer;
216
+ }
217
+ }
218
+ // Clean up the layer registry if not data-moving
219
+ const entry = this?._parentEl?._layerRegistry?.get(this.position);
220
+ if (entry) {
221
+ entry.count--;
222
+ if (entry.count === 0) {
223
+ this._parentEl._layerRegistry.delete(this.position);
224
+ }
225
+ }
226
+ }
227
+ reRender(layerToRenderOn) {
228
+ if (this._groupEl?.isConnected) {
229
+ let fallbackCS = this._getFallbackCS();
230
+ let placeholder = document.createElement('span');
231
+ this._groupEl.insertAdjacentElement('beforebegin', placeholder);
232
+ if (layerToRenderOn._staticFeature) {
233
+ layerToRenderOn._removeFromFeaturesList(this._geometry);
234
+ }
235
+ layerToRenderOn.removeLayer(this._geometry);
236
+ // Garbage collection needed
237
+ this._geometry = layerToRenderOn
238
+ .createGeometry(this.el, fallbackCS)
239
+ .addTo(layerToRenderOn);
240
+ // createGeometry sets _groupEl on the DOM element as a side effect
241
+ this._groupEl = this.el._groupEl;
242
+ placeholder.replaceWith(this._geometry.options.group);
243
+ layerToRenderOn._validateRendering();
244
+ delete this._getFeatureExtent;
245
+ this._setUpEvents();
246
+ }
247
+ }
248
+ removeFeature(layerToRemoveFrom) {
249
+ layerToRemoveFrom.removeLayer(this._geometry);
250
+ if (layerToRemoveFrom._staticFeature) {
251
+ layerToRemoveFrom._removeFromFeaturesList(this._geometry);
252
+ }
253
+ layerToRemoveFrom.options.properties = null;
254
+ delete this._geometry;
255
+ if (this._getFeatureExtent)
256
+ delete this._getFeatureExtent;
257
+ }
258
+ addFeature(layerToAddTo) {
259
+ this._featureLayer = layerToAddTo;
260
+ if (!this.el.querySelector('map-geometry'))
261
+ return;
262
+ let fallbackCS = this._getFallbackCS();
263
+ this._geometry = layerToAddTo.createGeometry(this.el, fallbackCS);
264
+ if (!this._geometry)
265
+ return;
266
+ // createGeometry sets _groupEl on the DOM element as a side effect
267
+ this._groupEl = this.el._groupEl;
268
+ this._geometry._layerEl = this.getLayerEl();
269
+ layerToAddTo.addLayer(this._geometry);
270
+ this._setUpEvents();
271
+ }
272
+ getPrevious() {
273
+ if (this.isFirst()) {
274
+ return null;
275
+ }
276
+ return this.el.previousElementSibling;
277
+ }
278
+ isFirst() {
279
+ return !this._parentEl._layerRegistry.has(this.position);
280
+ }
281
+ _createOrGetFeatureLayer() {
282
+ // Wait for parent layer to be ready before proceeding
283
+ this._parentEl
284
+ .whenReady()
285
+ .then(() => {
286
+ // Detect parent context and get the appropriate layer container
287
+ const isMapLink = this._parentEl.nodeName === 'MAP-LINK';
288
+ const parentLayer = isMapLink
289
+ ? this._parentEl._templatedLayer
290
+ : this._parentEl._layer;
291
+ const parentElement = this._parentEl;
292
+ if (this.isFirst() && parentLayer) {
293
+ let map = parentElement.getMapEl()._map;
294
+ this._featureLayer = new MapFeatureLayer(null, {
295
+ renderer: featureRenderer(),
296
+ pane: parentLayer.getContainer(),
297
+ ...(isMapLink && parentElement.getBounds()
298
+ ? { layerBounds: parentElement.getBounds() }
299
+ : {}),
300
+ ...(isMapLink ? { zoomBounds: this._getZoomBounds() } : {}),
301
+ ...(isMapLink ? {} : { _leafletLayer: parentElement._layer }),
302
+ zIndex: this.position,
303
+ projection: map.options.projection,
304
+ mapEl: parentElement.getMapEl(),
305
+ onEachFeature: function (properties, geometry) {
306
+ if (properties) {
307
+ const popupOptions = {
308
+ autoClose: false,
309
+ autoPan: true,
310
+ maxHeight: map.getSize().y * 0.5 - 50,
311
+ maxWidth: map.getSize().x * 0.7,
312
+ minWidth: 165
313
+ };
314
+ var c = document.createElement('div');
315
+ c.classList.add('mapml-popup-content');
316
+ c.insertAdjacentHTML('afterbegin', properties.innerHTML);
317
+ geometry.bindPopup(c, popupOptions);
318
+ }
319
+ }
320
+ });
321
+ extend(this._featureLayer.options, {
322
+ _leafletLayer: Object.assign(this._featureLayer, {
323
+ _layerEl: this.getLayerEl()
324
+ })
325
+ });
326
+ // Add this position to the parent's _layerRegistry with layer reference and count = 1
327
+ parentElement._layerRegistry.set(this.position, { layer: this._featureLayer, count: 1 });
328
+ this.addFeature(this._featureLayer);
329
+ // add MapFeatureLayer to appropriate parent layer
330
+ parentLayer.addLayer(this._featureLayer);
331
+ }
332
+ else {
333
+ // get the previously registered FeatureLayer for this position
334
+ const entry = parentElement._layerRegistry.get(this.position);
335
+ this._featureLayer = entry?.layer;
336
+ if (entry) {
337
+ entry.count++;
338
+ }
339
+ if (this._featureLayer) {
340
+ this.addFeature(this._featureLayer);
341
+ }
342
+ }
343
+ })
344
+ .catch((error) => {
345
+ console.log('Error waiting for parent layer to be ready:', error);
346
+ });
347
+ }
348
+ _setUpEvents() {
349
+ ['click', 'focus', 'blur', 'keyup', 'keydown'].forEach((name) => {
350
+ this._groupEl.addEventListener(name, (e) => {
351
+ if (name === 'click') {
352
+ let clickEv = new PointerEvent(name, { cancelable: true });
353
+ clickEv.originalEvent = e;
354
+ this.el.dispatchEvent(clickEv);
355
+ }
356
+ else if (name === 'keyup' || name === 'keydown') {
357
+ let keyEv = new KeyboardEvent(name, { cancelable: true });
358
+ keyEv.originalEvent = e;
359
+ this.el.dispatchEvent(keyEv);
360
+ }
361
+ else {
362
+ let focusEv = new FocusEvent(name, { cancelable: true });
363
+ focusEv.originalEvent = e;
364
+ this.el.dispatchEvent(focusEv);
365
+ }
366
+ });
367
+ });
368
+ }
369
+ _getFallbackCS() {
370
+ let csMeta;
371
+ if (this._parentEl?.nodeName === 'MAP-LINK') {
372
+ csMeta =
373
+ this._parentEl.shadowRoot?.querySelector('map-meta[name=cs][content]') ||
374
+ this._parentEl.parentElement?.getMeta?.('cs');
375
+ }
376
+ else {
377
+ let layerEl = this.getLayerEl();
378
+ csMeta = layerEl?.src
379
+ ? layerEl.shadowRoot?.querySelector('map-meta[name=cs][content]')
380
+ : layerEl?.querySelector('map-meta[name=cs][content]');
381
+ }
382
+ return csMeta
383
+ ? Util._metaContentToObject(csMeta.getAttribute('content')).content
384
+ : 'gcrs';
385
+ }
386
+ _memoizeExtent() {
387
+ let extentCache;
388
+ return () => {
389
+ if (extentCache && this._getFeatureExtent) {
390
+ return extentCache;
391
+ }
392
+ else {
393
+ // calculate feature extent
394
+ let map = this.getMapEl()._map, geometry = this.el.querySelector('map-geometry'), cs = geometry?.getAttribute('cs') || this._getFallbackCS(), zoom = this.zoomValue, shapes = geometry?.querySelectorAll('map-point, map-linestring, map-polygon, map-multipoint, map-multilinestring'), bboxExtent = [
395
+ Infinity,
396
+ Infinity,
397
+ Number.NEGATIVE_INFINITY,
398
+ Number.NEGATIVE_INFINITY
399
+ ];
400
+ if (shapes) {
401
+ for (let shape of Array.from(shapes)) {
402
+ let coord = shape.querySelectorAll('map-coordinates');
403
+ for (let i = 0; i < coord.length; ++i) {
404
+ bboxExtent = this._updateExtent(shape, coord[i], bboxExtent);
405
+ }
406
+ }
407
+ }
408
+ let topLeft = point(bboxExtent[0], bboxExtent[1]);
409
+ let bottomRight = point(bboxExtent[2], bboxExtent[3]);
410
+ let pcrsBound = Util.boundsToPCRSBounds(bounds(topLeft, bottomRight), zoom, map.options.projection, cs);
411
+ if (shapes?.length === 1 &&
412
+ shapes[0].tagName.toUpperCase() === 'MAP-POINT') {
413
+ let projection = map.options.projection, maxZoom = this.el.hasAttribute('max')
414
+ ? +this.el.getAttribute('max')
415
+ : M[projection].options.resolutions.length - 1, tileCenter = M[projection].options.crs.tile.bounds.getCenter(), pixel = M[projection].transformation.transform(pcrsBound.min, M[projection].scale(+this.zoomValue || maxZoom));
416
+ pcrsBound = Util.pixelToPCRSBounds(bounds(pixel.subtract(tileCenter), pixel.add(tileCenter)), this.zoomValue || maxZoom, projection);
417
+ }
418
+ let result = Object.assign(Util._convertAndFormatPCRS(pcrsBound, map.options.crs, map.options.projection), { zoom: this._getZoomBounds() });
419
+ extentCache = result;
420
+ return result;
421
+ }
422
+ };
423
+ }
424
+ _updateExtent(shape, coord, bboxExtent) {
425
+ let data = coord.innerHTML
426
+ .trim()
427
+ .replace(/<[^>]+>/g, '')
428
+ .replace(/\s+/g, ' ')
429
+ .split(/[<>\ ]/g);
430
+ switch (shape.tagName.toUpperCase()) {
431
+ case 'MAP-POINT':
432
+ bboxExtent = Util._updateExtent(bboxExtent, +data[0], +data[1]);
433
+ break;
434
+ case 'MAP-LINESTRING':
435
+ case 'MAP-POLYGON':
436
+ case 'MAP-MULTIPOINT':
437
+ case 'MAP-MULTILINESTRING':
438
+ for (let i = 0; i < data.length; i += 2) {
439
+ bboxExtent = Util._updateExtent(bboxExtent, +data[i], +data[i + 1]);
440
+ }
441
+ break;
442
+ default:
443
+ break;
444
+ }
445
+ return bboxExtent;
446
+ }
447
+ _getZoomBounds() {
448
+ return {
449
+ minZoom: this.minValue,
450
+ maxZoom: this.maxValue,
451
+ minNativeZoom: this.zoomValue,
452
+ maxNativeZoom: this.zoomValue
453
+ };
454
+ }
455
+ getZoomToZoom() {
456
+ let tL = this.extent.topLeft.pcrs, bR = this.extent.bottomRight.pcrs, bound = bounds(point(tL.horizontal, tL.vertical), point(bR.horizontal, bR.vertical));
457
+ let projection = this.getMapEl()._map.options.projection, layerZoomBounds = this.getLayerEl().extent.zoom, minZoom = layerZoomBounds.minZoom ? layerZoomBounds.minZoom : 0, maxZoom = layerZoomBounds.maxZoom
458
+ ? layerZoomBounds.maxZoom
459
+ : M[projection].options.resolutions.length - 1;
460
+ let newZoom;
461
+ if (this.el.hasAttribute('zoom')) {
462
+ newZoom = this.zoomValue;
463
+ }
464
+ else {
465
+ newZoom = Util.getMaxZoom(bound, this.getMapEl()._map, minZoom, maxZoom);
466
+ if (this.maxValue < newZoom) {
467
+ newZoom = this.maxValue;
468
+ }
469
+ else if (this.minValue > newZoom) {
470
+ newZoom = this.minValue;
471
+ }
472
+ }
473
+ if (newZoom < minZoom) {
474
+ newZoom = minZoom;
475
+ }
476
+ else if (newZoom > maxZoom) {
477
+ newZoom = maxZoom;
478
+ }
479
+ return newZoom;
480
+ }
481
+ getMeta(metaName) {
482
+ let name = metaName.toLowerCase();
483
+ if (name !== 'cs' && name !== 'zoom' && name !== 'projection')
484
+ return null;
485
+ let sdMeta = this._parentEl?.shadowRoot?.querySelector(`map-meta[name=${name}][content]`);
486
+ if (this._parentEl?.nodeName === 'MAP-LINK') {
487
+ return sdMeta || this._parentEl.parentElement?.getMeta?.(metaName);
488
+ }
489
+ else {
490
+ return this._parentEl?.src
491
+ ? this._parentEl.shadowRoot?.querySelector(`map-meta[name=${name}][content]`)
492
+ : this._parentEl?.querySelector(`map-meta[name=${name}][content]`);
493
+ }
494
+ }
495
+ mapml2geojson(options) {
496
+ let defaults = {
497
+ propertyFunction: null,
498
+ transform: true
499
+ };
500
+ options = Object.assign({}, defaults, options);
501
+ let json = {
502
+ type: 'Feature',
503
+ properties: {},
504
+ geometry: {}
505
+ };
506
+ let el = this.el.querySelector('map-properties');
507
+ if (!el) {
508
+ json.properties = null;
509
+ }
510
+ else if (typeof options.propertyFunction === 'function') {
511
+ json.properties = options.propertyFunction(el);
512
+ }
513
+ else if (el.querySelector('table')) {
514
+ let table = el.querySelector('table').cloneNode(true);
515
+ json.properties = Util._table2properties(table);
516
+ }
517
+ else {
518
+ json.properties = {
519
+ prop0: el.innerHTML.replace(/(<([^>]+)>)/gi, '').replace(/\s/g, '')
520
+ };
521
+ }
522
+ let source = null, dest = null, map = this.getMapEl()._map;
523
+ if (options.transform) {
524
+ source = new proj4.Proj(map.options.crs.code);
525
+ dest = new proj4.Proj('EPSG:4326');
526
+ if (map.options.crs.code === 'EPSG:3857' ||
527
+ map.options.crs.code === 'EPSG:4326') {
528
+ options.transform = false;
529
+ }
530
+ }
531
+ let collection = this.el.querySelector('map-geometry')?.querySelector('map-geometrycollection'), shapes = this.el.querySelector('map-geometry')?.querySelectorAll('map-point, map-polygon, map-linestring, map-multipoint, map-multipolygon, map-multilinestring');
532
+ if (collection) {
533
+ json.geometry.type = 'GeometryCollection';
534
+ json.geometry.geometries = [];
535
+ if (shapes) {
536
+ for (let shape of Array.from(shapes)) {
537
+ json.geometry.geometries.push(Util._geometry2geojson(shape, source, dest, options.transform));
538
+ }
539
+ }
540
+ }
541
+ else if (shapes && shapes.length > 0) {
542
+ json.geometry = Util._geometry2geojson(shapes[0], source, dest, options.transform);
543
+ }
544
+ return json;
545
+ }
546
+ click() {
547
+ let g = this._groupEl, rect = g.getBoundingClientRect();
548
+ let event = new MouseEvent('click', {
549
+ clientX: rect.x + rect.width / 2,
550
+ clientY: rect.y + rect.height / 2,
551
+ button: 0
552
+ });
553
+ let properties = this.el.querySelector('map-properties');
554
+ if (g.getAttribute('role') === 'link') {
555
+ for (let path of g.children) {
556
+ path.mousedown?.call(this._geometry, event);
557
+ path.mouseup?.call(this._geometry, event);
558
+ }
559
+ }
560
+ let clickEv = new PointerEvent('click', { cancelable: true });
561
+ clickEv.originalEvent = event;
562
+ this.el.dispatchEvent(clickEv);
563
+ if (properties && this.el.isConnected) {
564
+ let geometry = this._geometry, shapes = geometry._layers;
565
+ for (let id in shapes) {
566
+ if (shapes[id].isPopupOpen()) {
567
+ shapes[id].closePopup();
568
+ }
569
+ }
570
+ if (geometry.isPopupOpen()) {
571
+ geometry.closePopup();
572
+ }
573
+ else if (!clickEv.originalEvent.cancelBubble) {
574
+ geometry.openPopup();
575
+ }
576
+ }
577
+ }
578
+ focus(options) {
579
+ this._groupEl?.focus(options);
580
+ }
581
+ blur() {
582
+ if (document.activeElement?.shadowRoot?.activeElement === this._groupEl ||
583
+ document.activeElement?.shadowRoot?.activeElement?.parentNode ===
584
+ this._groupEl) {
585
+ this._groupEl.blur();
586
+ this.getMapEl()?._map?.getContainer().focus();
587
+ }
588
+ }
589
+ zoomTo() {
590
+ let extent = this.extent, map = this.getMapEl()._map;
591
+ let tL = extent.topLeft.pcrs, bR = extent.bottomRight.pcrs, bound = bounds(point(tL.horizontal, tL.vertical), point(bR.horizontal, bR.vertical)), center = map.options.crs.unproject(bound.getCenter(true));
592
+ map.setView(center, this.getZoomToZoom(), { animate: false });
593
+ }
594
+ async whenReady() {
595
+ return new Promise((resolve, reject) => {
596
+ let interval, failureTimer;
597
+ // Check if addFeature has been published (indicating connectedCallback completed)
598
+ if (this.el.addFeature) {
599
+ resolve();
600
+ }
601
+ else {
602
+ let featureElement = this.el;
603
+ interval = setInterval(testForFeature, 200, featureElement);
604
+ failureTimer = setTimeout(featureNotDefined, 5000);
605
+ }
606
+ function testForFeature(featureElement) {
607
+ if (featureElement.addFeature) {
608
+ clearInterval(interval);
609
+ clearTimeout(failureTimer);
610
+ resolve();
611
+ }
612
+ }
613
+ function featureNotDefined() {
614
+ clearInterval(interval);
615
+ clearTimeout(failureTimer);
616
+ reject('Timeout reached waiting for feature to be ready');
617
+ }
618
+ });
619
+ }
620
+ render() {
621
+ return null;
622
+ }
623
+ static get is() { return "map-feature"; }
624
+ static get encapsulation() { return "shadow"; }
625
+ static get properties() {
626
+ return {
627
+ "zoom": {
628
+ "type": "number",
629
+ "mutable": true,
630
+ "complexType": {
631
+ "original": "number",
632
+ "resolved": "number",
633
+ "references": {}
634
+ },
635
+ "required": false,
636
+ "optional": true,
637
+ "docs": {
638
+ "tags": [],
639
+ "text": ""
640
+ },
641
+ "getter": false,
642
+ "setter": false,
643
+ "reflect": false,
644
+ "attribute": "zoom"
645
+ },
646
+ "min": {
647
+ "type": "number",
648
+ "mutable": true,
649
+ "complexType": {
650
+ "original": "number",
651
+ "resolved": "number",
652
+ "references": {}
653
+ },
654
+ "required": false,
655
+ "optional": true,
656
+ "docs": {
657
+ "tags": [],
658
+ "text": ""
659
+ },
660
+ "getter": false,
661
+ "setter": false,
662
+ "reflect": true,
663
+ "attribute": "min"
664
+ },
665
+ "max": {
666
+ "type": "number",
667
+ "mutable": true,
668
+ "complexType": {
669
+ "original": "number",
670
+ "resolved": "number",
671
+ "references": {}
672
+ },
673
+ "required": false,
674
+ "optional": true,
675
+ "docs": {
676
+ "tags": [],
677
+ "text": ""
678
+ },
679
+ "getter": false,
680
+ "setter": false,
681
+ "reflect": true,
682
+ "attribute": "max"
683
+ }
684
+ };
685
+ }
686
+ static get methods() {
687
+ return {
688
+ "whenReady": {
689
+ "complexType": {
690
+ "signature": "() => Promise<void>",
691
+ "parameters": [],
692
+ "references": {
693
+ "Promise": {
694
+ "location": "global",
695
+ "id": "global::Promise"
696
+ },
697
+ "HTMLElement": {
698
+ "location": "global",
699
+ "id": "global::HTMLElement"
700
+ }
701
+ },
702
+ "return": "Promise<void>"
703
+ },
704
+ "docs": {
705
+ "text": "",
706
+ "tags": []
707
+ }
708
+ }
709
+ };
710
+ }
711
+ static get elementRef() { return "el"; }
712
+ static get watchers() {
713
+ return [{
714
+ "propName": "zoom",
715
+ "methodName": "zoomChanged"
716
+ }, {
717
+ "propName": "min",
718
+ "methodName": "minChanged"
719
+ }, {
720
+ "propName": "max",
721
+ "methodName": "maxChanged"
722
+ }];
723
+ }
724
+ }