@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,623 @@
1
+ import {
2
+ FeatureGroup,
3
+ DomUtil,
4
+ bounds,
5
+ SVG,
6
+ Util as LeafletUtil,
7
+ Browser
8
+ } from 'leaflet';
9
+ import { Util } from '../Util.js';
10
+ import { path } from '../features/path.js';
11
+ import { geometry } from '../features/geometry.js';
12
+
13
+ /**
14
+ * The equivalent of MapTileLayer and MapExtentLayer, for features.
15
+ * Represents an adjacent sequence of <map-feature> elements on the Leaflet map
16
+ *
17
+ * This layer will be inserted into the LayerGroup hosted by the <map-link> or
18
+ * <map-layer> immediately after creation, so that its index within the _layers array of
19
+ * that LayerGroup will be equal to its z-index within the LayerGroup's container
20
+ *
21
+ * <map-tile row="10" col="12" src="url1"></map-tile> LayerGroup._layers[0] <- each *set* of adjacent tiles
22
+ * <map-tile row="11" col="12" src="url2"></map-tile> LayerGroup._layers[0] <- is a *single* MapTileLayer
23
+ * <map-extent units="OSMTILE" checked hidden> LayerGroup._layers[1] *each* <map-extent> is a LayerGroup of Templated*Layer.js
24
+ * <map-feature id="a"> LayerGroup._layers[2] <- each *set* of adjacent features
25
+ * <map-feature id="b"> LayerGroup._layers[2] <- is a single MapFeatureLayer FeatureGroup
26
+ * <map-tile row="10" col="12" src="url3"></map-tile> LayerGroup._layers[3]
27
+ * <map-tile row="11" col="12" src="url4"></map-tile> LayerGroup._layers[3]
28
+ * <map-feature id="c"> LayerGroup._layers[4]
29
+ * <map-feature id="d"> LayerGroup._layers[4]
30
+ * and so on
31
+ *
32
+ */
33
+ export var MapFeatureLayer = FeatureGroup.extend({
34
+ initialize: function (mapml, options) {
35
+ /*
36
+ mapml:
37
+ 1. for query: an array of map-feature elements that it fetches
38
+ 2. for static: null (features manage themselves via connectedCallback)
39
+ 3. for templated: null (created by TemplatedFeaturesOrTilesLayer)
40
+ 4. for tiled: null (vector tiles)
41
+ */
42
+ FeatureGroup.prototype.initialize.call(this, null, options);
43
+
44
+ // Determine context once
45
+ this._context = this._determineContext(options);
46
+
47
+ // Set up based on context
48
+ this._setupContainer();
49
+ this._setupFeatures(mapml);
50
+ },
51
+
52
+ /**
53
+ * Determines the context for this MapFeatureLayer based on options
54
+ * @param {Object} options - Layer options
55
+ * @returns {string} - 'query', 'tiled', 'static', or 'templated'
56
+ */
57
+ _determineContext: function (options) {
58
+ if (options.query) return 'query';
59
+ if (options.tiles) return 'tiled';
60
+ if (options._leafletLayer) return 'static';
61
+ return 'templated';
62
+ },
63
+
64
+ /**
65
+ * Sets up the container based on the determined context
66
+ */
67
+ _setupContainer: function () {
68
+ if (this._context === 'tiled') {
69
+ // Tiled vector features don't need container setup
70
+ return;
71
+ }
72
+
73
+ if (this._context === 'query' || this._context === 'static') {
74
+ // Query and static contexts create their own container
75
+ this._container = DomUtil.create(
76
+ 'div',
77
+ 'leaflet-layer',
78
+ this.options.pane
79
+ );
80
+ DomUtil.addClass(this._container, 'leaflet-pane mapml-vector-container');
81
+ } else {
82
+ // Templated context uses provided container directly
83
+ this._container = this.options.pane;
84
+ DomUtil.addClass(this._container, 'leaflet-pane mapml-vector-container');
85
+ }
86
+ if (this.options.zIndex) {
87
+ this._container.style.zIndex = this.options.zIndex;
88
+ }
89
+
90
+ this.options.renderer.options.pane = this._container;
91
+ },
92
+
93
+ /**
94
+ * Sets up feature management based on the determined context
95
+ * @param {*} mapml - The mapml data
96
+ */
97
+ _setupFeatures: function (mapml) {
98
+ switch (this._context) {
99
+ case 'query':
100
+ this._queryFeatures = mapml.features ? mapml.features : mapml;
101
+ break;
102
+ case 'static':
103
+ this._features = {};
104
+ break;
105
+ case 'templated':
106
+ // Features are added dynamically by TemplatedFeaturesOrTilesLayer
107
+ break;
108
+ case 'tiled':
109
+ // Tiled features are managed differently
110
+ break;
111
+ }
112
+ },
113
+
114
+ /**
115
+ * Public getter for external code that needs to check if this is a static feature layer
116
+ * @returns {boolean}
117
+ */
118
+ get _staticFeature() {
119
+ return this._context === 'static';
120
+ },
121
+ setZIndex: function (zIndex) {
122
+ this.options.zIndex = zIndex;
123
+ this._updateZIndex();
124
+
125
+ return this;
126
+ },
127
+ _updateZIndex: function () {
128
+ if (
129
+ this._container &&
130
+ this.options.zIndex !== undefined &&
131
+ this.options.zIndex !== null
132
+ ) {
133
+ this._container.style.zIndex = this.options.zIndex;
134
+ }
135
+ },
136
+ isVisible: function () {
137
+ let map = this.options.mapEl._map;
138
+ // if query, isVisible is unconditionally true
139
+ if (this.options.query) return true;
140
+ // if the featureLayer is for static features, i.e. it is the mapmlvector layer,
141
+ // if it is empty, isVisible = false
142
+ // For static context: check if the featureLayer is empty
143
+ // this._features: check if the current static featureLayer is empty
144
+ // (Object.keys(this._features).length === 0 => this._features is an empty object)
145
+ else if (
146
+ this._context === 'static' &&
147
+ Object.keys(this._features).length === 0
148
+ ) {
149
+ return false;
150
+ } else {
151
+ let mapZoom = map.getZoom(),
152
+ zoomBounds = this.zoomBounds || this.options.zoomBounds,
153
+ layerBounds = this.layerBounds || this.options.layerBounds,
154
+ withinZoom = zoomBounds
155
+ ? mapZoom <= zoomBounds.maxZoom && mapZoom >= zoomBounds.minZoom
156
+ : false;
157
+ return (
158
+ withinZoom &&
159
+ this._layers &&
160
+ layerBounds &&
161
+ layerBounds.overlaps(
162
+ Util.pixelToPCRSBounds(
163
+ map.getPixelBounds(),
164
+ mapZoom,
165
+ map.options.projection
166
+ )
167
+ )
168
+ );
169
+ }
170
+ },
171
+
172
+ onAdd: function (map) {
173
+ this._map = map;
174
+
175
+ // Re-append container to pane if it was removed
176
+ if (this._container && !this._container.isConnected && this.options.pane) {
177
+ this.options.pane.appendChild(this._container);
178
+ }
179
+
180
+ FeatureGroup.prototype.onAdd.call(this, map);
181
+ if (this._context === 'static') {
182
+ this._validateRendering();
183
+ }
184
+ if (this._queryFeatures) {
185
+ map.on('featurepagination', this.showPaginationFeature, this);
186
+ }
187
+ },
188
+ addLayer: function (layerToAdd) {
189
+ FeatureGroup.prototype.addLayer.call(this, layerToAdd);
190
+ if (!this.options.layerBounds) {
191
+ this.layerBounds = this.layerBounds
192
+ ? this.layerBounds.extend(layerToAdd.layerBounds)
193
+ : bounds(layerToAdd.layerBounds.min, layerToAdd.layerBounds.max);
194
+
195
+ if (this.zoomBounds) {
196
+ if (layerToAdd.zoomBounds.minZoom < this.zoomBounds.minZoom)
197
+ this.zoomBounds.minZoom = layerToAdd.zoomBounds.minZoom;
198
+ if (layerToAdd.zoomBounds.maxZoom > this.zoomBounds.maxZoom)
199
+ this.zoomBounds.maxZoom = layerToAdd.zoomBounds.maxZoom;
200
+ if (layerToAdd.zoomBounds.minNativeZoom < this.zoomBounds.minNativeZoom)
201
+ this.zoomBounds.minNativeZoom = layerToAdd.zoomBounds.minNativeZoom;
202
+ if (layerToAdd.zoomBounds.maxNativeZoom > this.zoomBounds.maxNativeZoom)
203
+ this.zoomBounds.maxNativeZoom = layerToAdd.zoomBounds.maxNativeZoom;
204
+ } else {
205
+ this.zoomBounds = layerToAdd.zoomBounds;
206
+ }
207
+ }
208
+ if (this._context === 'static') {
209
+ // TODO: validate the use the feature.zoom which is new (was in createGeometry)
210
+ let featureZoom = layerToAdd.options.mapmlFeature.zoom;
211
+ if (featureZoom in this._features) {
212
+ this._features[featureZoom].push(layerToAdd);
213
+ } else {
214
+ this._features[featureZoom] = [layerToAdd];
215
+ }
216
+ // hide/display features based on the their zoom limits
217
+ this._validateRendering();
218
+ }
219
+ return this;
220
+ },
221
+ addRendering: function (featureToAdd) {
222
+ FeatureGroup.prototype.addLayer.call(this, featureToAdd);
223
+ },
224
+ onRemove: function (map) {
225
+ if (this._queryFeatures) {
226
+ map.off('featurepagination', this.showPaginationFeature, this);
227
+ delete this._queryFeatures;
228
+ DomUtil.remove(this._container);
229
+ }
230
+ if (this._context === 'static') {
231
+ DomUtil.remove(this._container);
232
+ }
233
+ FeatureGroup.prototype.onRemove.call(this, map);
234
+ this._map.featureIndex.cleanIndex();
235
+ },
236
+
237
+ removeLayer: function (featureToRemove) {
238
+ FeatureGroup.prototype.removeLayer.call(this, featureToRemove);
239
+ if (!this.options.layerBounds) {
240
+ delete this.layerBounds;
241
+ // this ensures that the <map-layer>.extent gets recalculated if needed
242
+ delete this.options._leafletLayer.bounds;
243
+ delete this.zoomBounds;
244
+ // this ensures that the <map-layer>.extent gets recalculated if needed
245
+ delete this.options._leafletLayer.zoomBounds;
246
+ delete this._layers[featureToRemove._leaflet_id];
247
+ this._removeFromFeaturesList(featureToRemove);
248
+ // iterate through all remaining layers
249
+ let layerBounds, zoomBounds;
250
+ let layerIds = Object.keys(this._layers);
251
+ // re-calculate the layerBounds and zoomBounds for the whole layer when
252
+ // a feature is permanently removed from the overall layer
253
+ // bug alert: it's necessary to create a new bounds object to initialize
254
+ // this.layerBounds, to avoid changing the layerBounds of the first geometry
255
+ // added to this layer
256
+ for (let id of layerIds) {
257
+ let layer = this._layers[id];
258
+ if (layerBounds) {
259
+ layerBounds.extend(layer.layerBounds);
260
+ } else {
261
+ layerBounds = bounds(layer.layerBounds.min, layer.layerBounds.max);
262
+ }
263
+ if (zoomBounds) {
264
+ if (layer.zoomBounds.minZoom < zoomBounds.minZoom)
265
+ zoomBounds.minZoom = layer.zoomBounds.minZoom;
266
+ if (layer.zoomBounds.maxZoom > zoomBounds.maxZoom)
267
+ zoomBounds.maxZoom = layer.zoomBounds.maxZoom;
268
+ if (layer.zoomBounds.minNativeZoom < zoomBounds.minNativeZoom)
269
+ zoomBounds.minNativeZoom = layer.zoomBounds.minNativeZoom;
270
+ if (layer.zoomBounds.maxNativeZoom > zoomBounds.maxNativeZoom)
271
+ zoomBounds.maxNativeZoom = layer.zoomBounds.maxNativeZoom;
272
+ } else {
273
+ zoomBounds = {};
274
+ zoomBounds.minZoom = layer.zoomBounds.minZoom;
275
+ zoomBounds.maxZoom = layer.zoomBounds.maxZoom;
276
+ zoomBounds.minNativeZoom = layer.zoomBounds.minNativeZoom;
277
+ zoomBounds.maxNativeZoom = layer.zoomBounds.maxNativeZoom;
278
+ }
279
+ }
280
+ // If the last feature is removed, we should remove the .layerBounds and
281
+ // .zoomBounds properties, so that the FeatureLayer may be ignored
282
+ if (layerBounds) {
283
+ this.layerBounds = layerBounds;
284
+ } else {
285
+ delete this.layerBounds;
286
+ }
287
+ if (zoomBounds) {
288
+ this.zoomBounds = zoomBounds;
289
+ } else {
290
+ delete this.zoomBounds;
291
+ delete this.options.zoomBounds;
292
+ }
293
+ }
294
+ return this;
295
+ },
296
+ /**
297
+ * Remove the geomtry rendering (an svg g/ M.Geomtry) from the L.FeatureGroup
298
+ * _layers array, so that it's not visible on the map, but still contributes
299
+ * to the bounds and zoom limits of the FeatureLayer.
300
+ *
301
+ * @param {type} featureToRemove
302
+ * @returns {undefined}
303
+ */
304
+ removeRendering: function (featureToRemove) {
305
+ FeatureGroup.prototype.removeLayer.call(this, featureToRemove);
306
+ },
307
+ _removeFromFeaturesList: function (feature) {
308
+ for (let zoom in this._features)
309
+ for (let i = 0; i < this._features[zoom].length; ++i) {
310
+ let feature = this._features[zoom][i];
311
+ if (feature._leaflet_id === feature._leaflet_id) {
312
+ this._features[zoom].splice(i, 1);
313
+ break;
314
+ }
315
+ }
316
+ },
317
+ getEvents: function () {
318
+ if (this._context === 'static') {
319
+ return {
320
+ moveend: this._handleMoveEnd,
321
+ zoomend: this._handleZoomEnd
322
+ };
323
+ }
324
+ return {};
325
+ },
326
+
327
+ // for query
328
+ showPaginationFeature: async function (e) {
329
+ if (this.options.query && this._queryFeatures[e.i]) {
330
+ let feature = this._queryFeatures[e.i];
331
+ feature._linkEl.shadowRoot.replaceChildren();
332
+ this.clearLayers();
333
+ // append all map-meta from mapml document
334
+ if (feature.meta) {
335
+ for (let i = 0; i < feature.meta.length; i++) {
336
+ feature._linkEl.shadowRoot.appendChild(feature.meta[i]);
337
+ }
338
+ }
339
+ feature._linkEl.shadowRoot.appendChild(feature);
340
+ // Wait for the map-feature component to be ready before calling addFeature
341
+ // Stencil components need time to hydrate after being appended to the DOM
342
+ await feature.whenReady();
343
+ feature.addFeature(this);
344
+ e.popup._navigationBar.querySelector('p').innerText =
345
+ e.i + 1 + '/' + this.options._leafletLayer._totalFeatureCount;
346
+ e.popup._content
347
+ .querySelector('iframe')
348
+ .setAttribute('sandbox', 'allow-same-origin allow-forms');
349
+ e.popup._content.querySelector('iframe').srcdoc =
350
+ feature.querySelector('map-properties').innerHTML;
351
+ // "zoom to here" link need to be re-set for every pagination
352
+ this._map.fire('attachZoomLink', { i: e.i, currFeature: feature });
353
+ this._map.once(
354
+ 'popupclose',
355
+ function (e) {
356
+ this.shadowRoot.innerHTML = '';
357
+ },
358
+ feature._linkEl
359
+ );
360
+ }
361
+ },
362
+
363
+ _handleMoveEnd: function () {
364
+ this._removeCSS();
365
+ },
366
+
367
+ _handleZoomEnd: function (e) {
368
+ // handle zoom end gets called twice for every zoom, this condition makes it go through once only.
369
+ if (this.zoomBounds) {
370
+ this._validateRendering();
371
+ }
372
+ },
373
+ /*
374
+ * _validateRendering prunes the features currently in the _features hashmap (created
375
+ * by us). _features categorizes features by zoom, and is used to remove or add
376
+ * features from the map based on the map-feature min/max getters. It also
377
+ * maintains the _map.featureIndex property, which is used to control the tab
378
+ * order for interactive (static) features currently rendered on the map.
379
+ * @private
380
+ * */
381
+ _validateRendering: function () {
382
+ // since features are removed and re-added by zoom level, need to clean the feature index before re-adding
383
+ if (this._map) this._map.featureIndex.cleanIndex();
384
+ let map = this._map || this.options._leafletLayer?._map;
385
+ // Guard against case where neither this._map nor _leafletLayer._map is available yet
386
+ if (!map) return;
387
+ // it's important that we not try to validate rendering if the FeatureLayer
388
+ // isn't actually being rendered (i.e. on the map. the _map property can't
389
+ // be used because once it's assigned (by onAdd, above) it's never unassigned.
390
+ if (!map.hasLayer(this)) return;
391
+ if (this._features) {
392
+ for (let zoom in this._features) {
393
+ for (let k = 0; k < this._features[zoom].length; k++) {
394
+ let geometry = this._features[zoom][k],
395
+ renderable = geometry._checkRender(
396
+ map.getZoom(),
397
+ this.zoomBounds.minZoom,
398
+ this.zoomBounds.maxZoom
399
+ );
400
+ if (!renderable) {
401
+ // insert a placeholder in the dom rendering for the geometry
402
+ // so that it retains its layering order when it is next rendered
403
+ let placeholder = document.createElement('span');
404
+ placeholder.id = geometry._leaflet_id;
405
+ // geometry.defaultOptions.group is the rendered svg g element in sd
406
+ geometry.defaultOptions.group.insertAdjacentElement(
407
+ 'beforebegin',
408
+ placeholder
409
+ );
410
+ // removing the rendering without removing the feature from the feature list
411
+ this.removeRendering(geometry);
412
+ } else if (
413
+ // checking for _map so we do not enter this code block during the connectedCallBack of the map-feature
414
+ !map.hasLayer(geometry) &&
415
+ !geometry._map
416
+ ) {
417
+ this.addRendering(geometry);
418
+ // update the layerbounds
419
+ // Only try to find placeholder if the geometry group has a parentNode
420
+ // If parentNode is null, the geometry is being handled by reRender()
421
+ // which will attach it to the DOM after _validateRendering completes
422
+ if (geometry.defaultOptions.group.parentNode) {
423
+ let placeholder =
424
+ geometry.defaultOptions.group.parentNode.querySelector(
425
+ `span[id="${geometry._leaflet_id}"]`
426
+ );
427
+ if (placeholder) {
428
+ placeholder.replaceWith(geometry.defaultOptions.group);
429
+ }
430
+ }
431
+ }
432
+ }
433
+ }
434
+ }
435
+ },
436
+
437
+ _setZoomTransform: function (center, clampZoom) {
438
+ var scale = this._map.getZoomScale(this._map.getZoom(), clampZoom),
439
+ translate = center
440
+ .multiplyBy(scale)
441
+ .subtract(this._map._getNewPixelOrigin(center, this._map.getZoom()))
442
+ .round();
443
+
444
+ if (Browser.any3d) {
445
+ DomUtil.setTransform(this._layers[clampZoom], translate, scale);
446
+ } else {
447
+ DomUtil.setPosition(this._layers[clampZoom], translate);
448
+ }
449
+ },
450
+
451
+ /**
452
+ * Render a <map-feature> as a Leaflet layer that can be added to a map or
453
+ * LayerGroup as required. Kind of a "factory" method.
454
+ *
455
+ * Uses this.options, so if you need to, you can construct a FeatureLayer
456
+ * with options set as required
457
+ *
458
+ * @param feature - a <map-feature> element
459
+ * @param {String} fallbackCS - "gcrs" | "pcrs"
460
+ * @param {String} tileZoom - the zoom of the map at which the coordinates will exist
461
+ *
462
+ * @returns Geometry, which is an L.FeatureGroup
463
+ * @public
464
+ */
465
+ createGeometry: function (feature, fallbackCS, tileZoom) {
466
+ // was let options = this.options, but that was causing unwanted side-effects
467
+ // because we were adding .layerBounds and .zoomBounds to it before passing
468
+ // to _createGeometry, which meant that FeatureLayer was sprouting
469
+ // options.layerBounds and .zoomBounds when it should not have those props
470
+ let options = Object.assign({}, this.options);
471
+
472
+ if (options.filter && !options.filter(feature)) {
473
+ return;
474
+ }
475
+
476
+ if (feature.classList.length) {
477
+ options.className = feature.classList.value;
478
+ }
479
+ // tileZoom is only used when the map-feature is discarded i.e. for rendering
480
+ // vector tiles' feature geometries in bulk (in this case only the geomtry
481
+ // is rendered on a tile-shaped FeatureLayer
482
+ let zoom = feature.zoom ?? tileZoom,
483
+ title = feature.querySelector('map-featurecaption');
484
+ title = title
485
+ ? title.innerHTML
486
+ : this.options.mapEl.locale.dfFeatureCaption;
487
+
488
+ if (feature.querySelector('map-properties')) {
489
+ options.properties = document.createElement('div');
490
+ options.properties.classList.add('mapml-popup-content');
491
+ options.properties.insertAdjacentHTML(
492
+ 'afterbegin',
493
+ feature.querySelector('map-properties').innerHTML
494
+ );
495
+ }
496
+ let cs =
497
+ feature.getElementsByTagName('map-geometry')[0]?.getAttribute('cs') ??
498
+ fallbackCS;
499
+ // options.layerBounds and options.zoomBounds are set by TemplatedTileLayer._createFeatures
500
+ // each geometry needs bounds so that it can be a good community member of this._layers
501
+ if (this._context === 'static' || this.options.query) {
502
+ options.layerBounds = Util.extentToBounds(feature.extent, 'PCRS');
503
+ options.zoomBounds = feature.extent.zoom;
504
+ }
505
+ let geom = this._geometryToLayer(feature, options, cs, +zoom, title);
506
+ if (geom && Object.keys(geom._layers).length !== 0) {
507
+ // if the layer is being used as a query handler output, it will have
508
+ // a color option set. Otherwise, copy classes from the feature
509
+ if (!geom.options.color && feature.hasAttribute('class')) {
510
+ geom.options.className = feature.getAttribute('class');
511
+ }
512
+ geom.defaultOptions = geom.options;
513
+ this.resetStyle(geom);
514
+
515
+ if (options.onEachFeature) {
516
+ geom.bindTooltip(title, { interactive: true, sticky: true });
517
+ }
518
+ if (feature.tagName.toUpperCase() === 'MAP-FEATURE') {
519
+ feature._groupEl = geom.options.group;
520
+ }
521
+ return geom;
522
+ }
523
+ },
524
+
525
+ resetStyle: function (layer) {
526
+ var style = this.options.style;
527
+ if (style) {
528
+ // reset any custom styles
529
+ LeafletUtil.extend(layer.options, layer.defaultOptions);
530
+ this._setLayerStyle(layer, style);
531
+ }
532
+ },
533
+
534
+ setStyle: function (style) {
535
+ this.eachLayer(function (layer) {
536
+ this._setLayerStyle(layer, style);
537
+ }, this);
538
+ },
539
+
540
+ _setLayerStyle: function (layer, style) {
541
+ if (typeof style === 'function') {
542
+ style = style(layer.feature);
543
+ }
544
+ if (layer.setStyle) {
545
+ layer.setStyle(style);
546
+ }
547
+ },
548
+ _removeCSS: function () {
549
+ let toDelete = this._container.querySelectorAll(
550
+ 'link[rel=stylesheet],style'
551
+ );
552
+ for (let i = 0; i < toDelete.length; i++) {
553
+ this._container.removeChild(toDelete[i]);
554
+ }
555
+ },
556
+ _geometryToLayer: function (feature, vectorOptions, cs, zoom, title) {
557
+ let geom = feature.getElementsByTagName('map-geometry')[0],
558
+ group = [],
559
+ groupOptions = {},
560
+ svgGroup = SVG.create('g'),
561
+ copyOptions = Object.assign({}, vectorOptions);
562
+ svgGroup._featureEl = feature; // rendered <g> has a reference to map-feature
563
+ if (geom) {
564
+ for (let geo of geom.querySelectorAll(
565
+ 'map-polygon, map-linestring, map-multilinestring, map-point, map-multipoint'
566
+ )) {
567
+ group.push(
568
+ path(
569
+ geo,
570
+ Object.assign(copyOptions, {
571
+ nativeCS: cs,
572
+ nativeZoom: zoom,
573
+ projection: this.options.projection,
574
+ featureID: feature.id,
575
+ group: svgGroup,
576
+ wrappers: this._getGeometryParents(geo.parentElement),
577
+ featureLayer: this,
578
+ _leafletLayer: this.options._leafletLayer
579
+ })
580
+ )
581
+ );
582
+ }
583
+ let groupOptions = {
584
+ group: svgGroup,
585
+ mapmlFeature: feature,
586
+ featureID: feature.id,
587
+ accessibleTitle: title,
588
+ onEachFeature: vectorOptions.onEachFeature,
589
+ properties: vectorOptions.properties,
590
+ _leafletLayer: this.options._leafletLayer,
591
+ layerBounds: vectorOptions.layerBounds,
592
+ zoomBounds: vectorOptions.zoomBounds
593
+ },
594
+ collections =
595
+ geom.querySelector('map-multipolygon') ||
596
+ geom.querySelector('map-geometrycollection');
597
+ if (collections)
598
+ groupOptions.wrappers = this._getGeometryParents(
599
+ collections.parentElement
600
+ );
601
+ return geometry(group, groupOptions);
602
+ }
603
+ },
604
+
605
+ _getGeometryParents: function (subType, elems = []) {
606
+ if (subType && subType.tagName.toUpperCase() !== 'MAP-GEOMETRY') {
607
+ if (
608
+ subType.tagName.toUpperCase() === 'MAP-MULTIPOLYGON' ||
609
+ subType.tagName.toUpperCase() === 'MAP-GEOMETRYCOLLECTION'
610
+ )
611
+ return this._getGeometryParents(subType.parentElement, elems);
612
+ return this._getGeometryParents(
613
+ subType.parentElement,
614
+ elems.concat([subType])
615
+ );
616
+ } else {
617
+ return elems;
618
+ }
619
+ }
620
+ });
621
+ export var mapFeatureLayer = function (mapml, options) {
622
+ return new MapFeatureLayer(mapml, options);
623
+ };