@defra/interactive-map 0.0.3-alpha → 0.0.5-alpha

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 (407) hide show
  1. package/README.md +16 -57
  2. package/dist/css/index.css +1 -1
  3. package/dist/esm/im-core.js +1 -1
  4. package/dist/esm/index.js +1 -1
  5. package/dist/umd/im-core.js +1 -1
  6. package/dist/umd/index.js +1 -1
  7. package/docs/api/button-definition.md +176 -0
  8. package/docs/api/context.md +124 -0
  9. package/docs/api/control-definition.md +72 -0
  10. package/docs/api/icon-definition.md +28 -0
  11. package/docs/api/map-style-config.md +76 -0
  12. package/docs/api/marker-config.md +51 -0
  13. package/docs/api/panel-definition.md +117 -0
  14. package/docs/api/slots.md +25 -0
  15. package/docs/api.md +721 -0
  16. package/docs/architecture.md +139 -0
  17. package/docs/building-a-plugin.md +149 -0
  18. package/docs/getting-started.md +46 -0
  19. package/docs/govuk-prototype.md +0 -0
  20. package/docs/plugins/interact.md +205 -0
  21. package/docs/plugins/map-styles.md +84 -0
  22. package/docs/plugins/plugin-context.md +67 -0
  23. package/docs/plugins/plugin-descriptor.md +71 -0
  24. package/docs/plugins/plugin-manifest.md +118 -0
  25. package/docs/plugins/scale-bar.md +62 -0
  26. package/docs/plugins/search.md +162 -0
  27. package/docs/plugins.md +116 -0
  28. package/govuk-prototype-kit.config.json +7 -7
  29. package/package.json +16 -2
  30. package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +2 -0
  31. package/plugins/beta/datasets/dist/esm/index.js +2 -0
  32. package/plugins/beta/datasets/dist/umd/im-datasets-plugin.js +2 -0
  33. package/plugins/beta/datasets/dist/umd/index.js +2 -0
  34. package/plugins/beta/datasets/src/datasets.js +113 -0
  35. package/plugins/beta/datasets/src/fetch/createDynamicSource.js +206 -0
  36. package/plugins/beta/datasets/src/fetch/fetchGeoJSON.js +38 -0
  37. package/plugins/{datasets → beta/datasets}/src/handleSetMapStyle.js +8 -1
  38. package/plugins/{datasets → beta/datasets}/src/manifest.js +1 -1
  39. package/plugins/{datasets → beta/datasets}/src/mapLayers.js +42 -4
  40. package/plugins/{datasets → beta/datasets}/src/panels/Key.jsx +1 -1
  41. package/plugins/beta/datasets/src/utils/bbox.js +115 -0
  42. package/plugins/beta/draw-ml/dist/css/index.css +1 -0
  43. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -0
  44. package/plugins/beta/draw-ml/dist/esm/index.js +2 -0
  45. package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -0
  46. package/plugins/beta/draw-ml/dist/umd/index.js +2 -0
  47. package/plugins/beta/draw-ml/src/api/addFeature.js +27 -0
  48. package/plugins/{draw-ml → beta/draw-ml}/src/api/editFeature.js +17 -6
  49. package/plugins/beta/draw-ml/src/api/merge.js +9 -0
  50. package/plugins/beta/draw-ml/src/api/newLine.js +68 -0
  51. package/plugins/beta/draw-ml/src/api/newPolygon.js +68 -0
  52. package/plugins/beta/draw-ml/src/api/split.js +81 -0
  53. package/plugins/{draw-ml → beta/draw-ml}/src/defaults.js +3 -0
  54. package/plugins/beta/draw-ml/src/draw.scss +32 -0
  55. package/plugins/beta/draw-ml/src/events.js +171 -0
  56. package/plugins/beta/draw-ml/src/manifest.js +132 -0
  57. package/plugins/{draw-ml → beta/draw-ml}/src/mapboxDraw.js +51 -2
  58. package/plugins/{draw-ml → beta/draw-ml}/src/mapboxSnap.js +18 -12
  59. package/plugins/beta/draw-ml/src/modes/createDrawMode.js +497 -0
  60. package/plugins/beta/draw-ml/src/modes/drawLineMode.js +18 -0
  61. package/plugins/beta/draw-ml/src/modes/drawPolygonMode.js +16 -0
  62. package/plugins/beta/draw-ml/src/modes/editVertex/geometryHelpers.js +135 -0
  63. package/plugins/beta/draw-ml/src/modes/editVertex/helpers.js +2 -0
  64. package/plugins/beta/draw-ml/src/modes/editVertex/touchHandlers.js +134 -0
  65. package/plugins/beta/draw-ml/src/modes/editVertex/undoHandlers.js +133 -0
  66. package/plugins/beta/draw-ml/src/modes/editVertex/vertexOperations.js +141 -0
  67. package/plugins/beta/draw-ml/src/modes/editVertex/vertexQueries.js +121 -0
  68. package/plugins/beta/draw-ml/src/modes/editVertexMode.js +437 -0
  69. package/plugins/{draw-ml → beta/draw-ml}/src/reducer.js +30 -2
  70. package/plugins/{draw-ml → beta/draw-ml}/src/styles.js +66 -36
  71. package/plugins/beta/draw-ml/src/undoStack.js +50 -0
  72. package/plugins/beta/draw-ml/src/utils/debounce.js +16 -0
  73. package/plugins/beta/draw-ml/src/utils/flattenStyleProperties.js +49 -0
  74. package/plugins/beta/draw-ml/src/utils/spatial.js +258 -0
  75. package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -0
  76. package/plugins/beta/frame/dist/esm/index.js +2 -0
  77. package/plugins/beta/frame/dist/umd/im-frame-plugin.js +1 -0
  78. package/plugins/beta/frame/dist/umd/index.js +2 -0
  79. package/plugins/{frame → beta/frame}/src/Frame.jsx +1 -1
  80. package/plugins/{map-styles → beta/map-styles}/dist/css/index.css +1 -1
  81. package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -0
  82. package/plugins/beta/map-styles/dist/esm/index.js +2 -0
  83. package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -0
  84. package/plugins/beta/map-styles/dist/umd/index.js +2 -0
  85. package/plugins/{map-styles → beta/map-styles}/src/MapStyles.jsx +1 -1
  86. package/plugins/{map-styles → beta/map-styles}/src/manifest.js +8 -10
  87. package/plugins/{map-styles → beta/map-styles}/src/mapStyles.scss +4 -1
  88. package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -0
  89. package/plugins/beta/scale-bar/dist/esm/index.js +2 -0
  90. package/plugins/beta/scale-bar/dist/umd/im-scale-bar-plugin.js +1 -0
  91. package/plugins/beta/scale-bar/dist/umd/index.js +2 -0
  92. package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -0
  93. package/plugins/beta/use-location/dist/esm/index.js +2 -0
  94. package/plugins/beta/use-location/dist/umd/im-use-location-plugin.js +1 -0
  95. package/plugins/beta/use-location/dist/umd/index.js +2 -0
  96. package/plugins/interact/dist/css/index.css +1 -1
  97. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  98. package/plugins/interact/dist/esm/index.js +1 -1
  99. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  100. package/plugins/interact/dist/umd/index.js +1 -1
  101. package/plugins/interact/src/InteractInit.jsx +1 -1
  102. package/plugins/interact/src/InteractInit.test.js +97 -0
  103. package/plugins/interact/src/api/clear.test.js +18 -0
  104. package/plugins/interact/src/api/disable.test.js +12 -0
  105. package/plugins/interact/src/api/enable.test.js +48 -0
  106. package/plugins/interact/src/api/selectFeature.test.js +33 -0
  107. package/plugins/interact/src/api/unselectFeature.test.js +33 -0
  108. package/plugins/interact/src/defaults.js +2 -0
  109. package/plugins/interact/src/events.js +37 -52
  110. package/plugins/interact/src/events.test.js +186 -0
  111. package/plugins/interact/src/hooks/useHighlightSync.js +1 -1
  112. package/plugins/interact/src/hooks/useHighlightSync.test.js +212 -0
  113. package/plugins/interact/src/hooks/useInteractionHandlers.js +80 -41
  114. package/plugins/interact/src/hooks/useInteractionHandlers.test.js +316 -0
  115. package/plugins/interact/src/index.test.js +22 -0
  116. package/plugins/interact/src/interact.scss +6 -0
  117. package/plugins/interact/src/manifest.js +1 -1
  118. package/plugins/interact/src/manifest.test.js +94 -0
  119. package/plugins/interact/src/reducer.js +28 -21
  120. package/plugins/interact/src/reducer.test.js +155 -0
  121. package/plugins/interact/src/utils/buildStylesMap.test.js +57 -0
  122. package/plugins/interact/src/utils/featureQueries.js +2 -2
  123. package/plugins/interact/src/utils/featureQueries.test.js +56 -0
  124. package/plugins/interact/src/utils/spatial.js +95 -0
  125. package/plugins/interact/src/utils/spatial.test.js +93 -0
  126. package/plugins/search/dist/css/index.css +1 -1
  127. package/plugins/search/dist/esm/im-search-plugin.js +1 -1
  128. package/plugins/search/dist/esm/index.js +1 -1
  129. package/plugins/search/dist/umd/im-search-plugin.js +1 -1
  130. package/plugins/search/dist/umd/index.js +1 -1
  131. package/plugins/search/src/Search.jsx +2 -2
  132. package/plugins/search/src/components/Form/Form.jsx +1 -1
  133. package/plugins/search/src/components/Suggestions/Suggestions.jsx +5 -5
  134. package/plugins/search/src/datasets.js +1 -1
  135. package/plugins/search/src/defaults.js +3 -0
  136. package/plugins/search/src/events/fetchSuggestions.js +48 -53
  137. package/plugins/search/src/events/formHandlers.js +3 -2
  138. package/plugins/search/src/events/index.js +1 -1
  139. package/plugins/search/src/events/inputHandlers.js +3 -1
  140. package/plugins/search/src/events/suggestionHandlers.js +12 -3
  141. package/plugins/search/src/search.scss +4 -1
  142. package/plugins/search/src/utils/parseOsNamesResults.js +15 -19
  143. package/providers/{esri → beta/esri}/src/esriProvider.js +1 -1
  144. package/providers/{esri → beta/esri}/src/index.js +1 -1
  145. package/providers/{esri → beta/esri}/src/mapEvents.js +2 -2
  146. package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +2 -0
  147. package/providers/beta/open-names/dist/esm/index.js +2 -0
  148. package/providers/beta/open-names/dist/umd/im-reverse-geocode.js +2 -0
  149. package/providers/beta/open-names/dist/umd/im-reverse-geocode.js.LICENSE.txt +1 -0
  150. package/providers/beta/open-names/dist/umd/index.js +2 -0
  151. package/providers/beta/open-names/dist/umd/index.js.LICENSE.txt +1 -0
  152. package/providers/maplibre/dist/esm/im-maplibre-framework.js +1 -1
  153. package/providers/maplibre/dist/esm/im-maplibre-framework.js.LICENSE.txt +1 -1
  154. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  155. package/providers/maplibre/dist/esm/index.js +1 -1
  156. package/providers/maplibre/dist/umd/im-maplibre-framework.js +1 -1
  157. package/providers/maplibre/dist/umd/im-maplibre-framework.js.LICENSE.txt +1 -1
  158. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  159. package/providers/maplibre/dist/umd/index.js +1 -1
  160. package/providers/maplibre/src/defaults.js +3 -2
  161. package/providers/maplibre/src/index.js +36 -20
  162. package/providers/maplibre/src/maplibreProvider.js +140 -11
  163. package/providers/maplibre/src/utils/detectWebgl.js +1 -2
  164. package/providers/maplibre/src/utils/highlightFeatures.js +78 -67
  165. package/providers/maplibre/src/utils/labels.js +174 -120
  166. package/providers/maplibre/src/utils/maplibreFixes.js +2 -2
  167. package/providers/maplibre/src/utils/queryFeatures.js +146 -0
  168. package/providers/maplibre/src/utils/spatial.js +14 -17
  169. package/sonar-project.properties +40 -3
  170. package/src/App/components/Actions/Actions.jsx +2 -2
  171. package/src/App/components/Actions/Actions.module.scss +2 -2
  172. package/src/App/components/KeyboardHelp/KeyboardHelp.jsx +3 -1
  173. package/src/App/components/KeyboardHelp/KeyboardHelp.test.jsx +9 -0
  174. package/src/App/components/Logo/Logo.jsx +1 -1
  175. package/src/App/components/MapButton/MapButton.jsx +217 -41
  176. package/src/App/components/MapButton/MapButton.module.scss +32 -21
  177. package/src/App/components/MapButton/MapButton.test.jsx +128 -84
  178. package/src/App/components/Markers/Markers.jsx +1 -1
  179. package/src/App/components/Markers/Markers.module.scss +0 -5
  180. package/src/App/components/Panel/Panel.jsx +75 -45
  181. package/src/App/components/Panel/Panel.module.scss +18 -24
  182. package/src/App/components/Panel/Panel.test.jsx +18 -0
  183. package/src/App/components/PopupMenu/PopupMenu.jsx +246 -0
  184. package/src/App/components/PopupMenu/PopupMenu.module.scss +70 -0
  185. package/src/App/components/PopupMenu/PopupMenu.test.jsx +304 -0
  186. package/src/App/components/Tooltip/Tooltip.jsx +4 -2
  187. package/src/App/components/Tooltip/getTooltipPosition.js +1 -1
  188. package/src/App/components/Viewport/MapController.jsx +1 -1
  189. package/src/App/components/Viewport/MapStatus.jsx +1 -1
  190. package/src/App/components/Viewport/Viewport.jsx +2 -2
  191. package/src/App/components/Viewport/Viewport.module.scss +2 -2
  192. package/src/App/controls/keyboardActions.js +3 -2
  193. package/src/App/controls/keyboardShortcuts.js +4 -2
  194. package/src/App/hooks/useButtonStateEvaluator.js +58 -45
  195. package/src/App/hooks/useButtonStateEvaluator.test.js +36 -3
  196. package/src/App/hooks/useCrossHairAPI.js +49 -47
  197. package/src/App/hooks/useFocusVisible.js +2 -2
  198. package/src/App/hooks/useInterfaceAPI.js +36 -1
  199. package/src/App/hooks/useKeyboardHint.js +1 -1
  200. package/src/App/hooks/useKeyboardShortcuts.js +4 -2
  201. package/src/App/hooks/useMapAnnouncements.js +34 -32
  202. package/src/App/hooks/useMapEvents.js +12 -1
  203. package/src/App/hooks/useMapProviderOverrides.js +3 -3
  204. package/src/App/hooks/useMapStateSync.js +7 -1
  205. package/src/App/hooks/useMapURLSync.js +6 -1
  206. package/src/App/hooks/useMarkersAPI.js +88 -50
  207. package/src/App/hooks/useMediaQueryDispatch.test.js +48 -0
  208. package/src/App/hooks/useModalPanelBehaviour.js +46 -40
  209. package/src/App/hooks/useResizeObserver.js +2 -2
  210. package/src/App/initialiseApp.js +45 -38
  211. package/src/App/layout/Layout.jsx +6 -4
  212. package/src/App/layout/layout.module.scss +13 -17
  213. package/src/App/registry/keyboardShortcutRegistry.js +12 -2
  214. package/src/App/registry/keyboardShortcutRegistry.test.js +28 -0
  215. package/src/App/registry/mergeManifests.js +1 -1
  216. package/src/App/registry/panelRegistry.js +1 -1
  217. package/src/App/registry/panelRegistry.test.js +30 -1
  218. package/src/App/registry/pluginRegistry.js +14 -51
  219. package/src/App/registry/pluginRegistry.test.js +54 -6
  220. package/src/App/renderer/HtmlElementHost.jsx +186 -0
  221. package/src/App/renderer/HtmlElementHost.test.jsx +231 -0
  222. package/src/App/renderer/mapButtons.js +12 -9
  223. package/src/App/renderer/mapButtons.test.js +6 -4
  224. package/src/App/renderer/mapControls.js +6 -0
  225. package/src/App/renderer/mapControls.test.js +10 -2
  226. package/src/App/renderer/mapPanels.js +39 -26
  227. package/src/App/renderer/mapPanels.test.js +29 -0
  228. package/src/App/renderer/pluginWrapper.test.js +28 -0
  229. package/src/App/renderer/slotHelpers.js +60 -0
  230. package/src/App/renderer/slotHelpers.test.js +82 -0
  231. package/src/App/store/AppProvider.jsx +3 -0
  232. package/src/App/store/AppProvider.test.jsx +40 -0
  233. package/src/App/store/PluginProvider.jsx +7 -5
  234. package/src/App/store/appActionsMap.js +46 -1
  235. package/src/App/store/appActionsMap.test.js +21 -0
  236. package/src/App/store/appReducer.js +1 -0
  237. package/src/App/store/mapActionsMap.js +12 -24
  238. package/src/App/store/mapReducer.js +1 -1
  239. package/src/InteractiveMap/InteractiveMap.js +194 -13
  240. package/src/InteractiveMap/InteractiveMap.test.js +164 -2
  241. package/src/InteractiveMap/behaviourController.js +12 -2
  242. package/src/InteractiveMap/behaviourController.test.js +82 -1
  243. package/src/InteractiveMap/deviceChecker.js +1 -1
  244. package/src/InteractiveMap/deviceChecker.test.js +2 -2
  245. package/src/InteractiveMap/historyManager.js +41 -5
  246. package/src/InteractiveMap/historyManager.test.js +37 -6
  247. package/src/InteractiveMap/polyfills.js +39 -0
  248. package/src/InteractiveMap/polyfills.test.js +127 -0
  249. package/src/config/appConfig.js +5 -5
  250. package/src/config/appConfig.test.js +107 -42
  251. package/src/config/defaults.js +30 -20
  252. package/src/config/events.js +110 -4
  253. package/src/index.js +5 -2
  254. package/src/index.umd.js +1 -1
  255. package/src/scss/main.scss +1 -0
  256. package/src/scss/settings/_dimensions.scss +6 -2
  257. package/src/scss/tools/_border-focus.scss +20 -4
  258. package/src/services/eventBus.test.js +24 -1
  259. package/src/test-utils.js +1 -0
  260. package/src/types.js +590 -0
  261. package/src/utils/detectBreakpoint.js +78 -77
  262. package/src/utils/detectBreakpoint.test.js +50 -4
  263. package/src/utils/detectInterfaceType.js +4 -4
  264. package/src/utils/getIsFullscreen.js +3 -1
  265. package/src/utils/getSafeZoneInset.js +23 -7
  266. package/src/utils/getSafeZoneInset.test.js +18 -0
  267. package/src/utils/mapStateSync.js +3 -3
  268. package/src/utils/queryString.js +1 -1
  269. package/src/utils/stringToKebab.js +1 -1
  270. package/src/utils/toggleInertElements.js +37 -12
  271. package/webpack.dev.mjs +3 -4
  272. package/webpack.esm.mjs +8 -8
  273. package/webpack.umd.mjs +8 -8
  274. package/plugins/datasets/dist/esm/im-datasets-plugin.js +0 -1
  275. package/plugins/datasets/dist/esm/index.js +0 -2
  276. package/plugins/datasets/dist/umd/im-datasets-plugin.js +0 -1
  277. package/plugins/datasets/dist/umd/index.js +0 -2
  278. package/plugins/datasets/src/datasets.js +0 -60
  279. package/plugins/datasets/src/utils/bbox.js +0 -4
  280. package/plugins/draw-ml/dist/css/index.css +0 -1
  281. package/plugins/draw-ml/dist/esm/im-draw-ml-plugin.js +0 -1
  282. package/plugins/draw-ml/dist/esm/index.js +0 -2
  283. package/plugins/draw-ml/dist/umd/im-draw-ml-plugin.js +0 -1
  284. package/plugins/draw-ml/dist/umd/index.js +0 -2
  285. package/plugins/draw-ml/src/api/addFeature.js +0 -15
  286. package/plugins/draw-ml/src/api/newPolygon.js +0 -43
  287. package/plugins/draw-ml/src/draw.scss +0 -9
  288. package/plugins/draw-ml/src/events.js +0 -127
  289. package/plugins/draw-ml/src/manifest.js +0 -100
  290. package/plugins/draw-ml/src/modes/drawVertexMode.js +0 -275
  291. package/plugins/draw-ml/src/modes/editVertexMode.js +0 -426
  292. package/plugins/draw-ml/src/utils.js +0 -102
  293. package/plugins/frame/dist/esm/im-frame-plugin.js +0 -1
  294. package/plugins/frame/dist/esm/index.js +0 -2
  295. package/plugins/frame/dist/umd/im-frame-plugin.js +0 -1
  296. package/plugins/frame/dist/umd/index.js +0 -2
  297. package/plugins/map-styles/dist/esm/im-map-styles-plugin.js +0 -1
  298. package/plugins/map-styles/dist/esm/index.js +0 -2
  299. package/plugins/map-styles/dist/umd/im-map-styles-plugin.js +0 -1
  300. package/plugins/map-styles/dist/umd/index.js +0 -2
  301. package/plugins/scale-bar/dist/esm/im-scale-bar-plugin.js +0 -1
  302. package/plugins/scale-bar/dist/esm/index.js +0 -2
  303. package/plugins/scale-bar/dist/umd/im-scale-bar-plugin.js +0 -1
  304. package/plugins/scale-bar/dist/umd/index.js +0 -2
  305. package/plugins/search/src/utils/fetchDataset.js +0 -23
  306. package/plugins/use-location/dist/esm/im-use-location-plugin.js +0 -1
  307. package/plugins/use-location/dist/esm/index.js +0 -2
  308. package/plugins/use-location/dist/umd/im-use-location-plugin.js +0 -1
  309. package/plugins/use-location/dist/umd/index.js +0 -2
  310. package/providers/maplibre/dist/esm/im-maplibre-legacy-framework.js +0 -1
  311. package/providers/maplibre/dist/umd/im-maplibre-legacy-framework.js +0 -1
  312. package/providers/open-names/dist/esm/im-reverse-geocode.js +0 -2
  313. package/providers/open-names/dist/esm/index.js +0 -2
  314. package/providers/open-names/dist/umd/im-reverse-geocode.js +0 -2
  315. package/providers/open-names/dist/umd/index.js +0 -2
  316. /package/docs/architecture/{ARCHITECTURE_DIAGRAMS.md → architecture-diagrams.md} +0 -0
  317. /package/plugins/{datasets → beta/datasets}/dist/css/index.css +0 -0
  318. /package/plugins/{datasets/dist/esm/index.js.LICENSE.txt → beta/datasets/dist/esm/im-datasets-plugin.js.LICENSE.txt} +0 -0
  319. /package/plugins/{datasets/dist/umd → beta/datasets/dist/esm}/index.js.LICENSE.txt +0 -0
  320. /package/plugins/{draw-ml/dist/esm/index.js.LICENSE.txt → beta/datasets/dist/umd/im-datasets-plugin.js.LICENSE.txt} +0 -0
  321. /package/plugins/{draw-ml → beta/datasets}/dist/umd/index.js.LICENSE.txt +0 -0
  322. /package/plugins/{datasets → beta/datasets}/src/DatasetsInit.jsx +0 -0
  323. /package/plugins/{datasets → beta/datasets}/src/api/addDataset.js +0 -0
  324. /package/plugins/{datasets → beta/datasets}/src/api/hideDataset.js +0 -0
  325. /package/plugins/{datasets → beta/datasets}/src/api/hideFeatures.js +0 -0
  326. /package/plugins/{datasets → beta/datasets}/src/api/removeDataset.js +0 -0
  327. /package/plugins/{datasets → beta/datasets}/src/api/showDataset.js +0 -0
  328. /package/plugins/{datasets → beta/datasets}/src/api/showFeatures.js +0 -0
  329. /package/plugins/{datasets → beta/datasets}/src/datasets.scss +0 -0
  330. /package/plugins/{datasets → beta/datasets}/src/defaults.js +0 -0
  331. /package/plugins/{datasets → beta/datasets}/src/index.js +0 -0
  332. /package/plugins/{datasets → beta/datasets}/src/panels/Key.module.scss +0 -0
  333. /package/plugins/{datasets → beta/datasets}/src/panels/Layers.jsx +0 -0
  334. /package/plugins/{datasets → beta/datasets}/src/panels/Layers.module.scss +0 -0
  335. /package/plugins/{datasets → beta/datasets}/src/reducer.js +0 -0
  336. /package/plugins/{datasets → beta/datasets}/src/utils/debounce.js +0 -0
  337. /package/plugins/{datasets → beta/datasets}/src/utils/filters.js +0 -0
  338. /package/plugins/{draw-es → beta/draw-es}/src/DrawInit.jsx +0 -0
  339. /package/plugins/{draw-es → beta/draw-es}/src/api/addFeature.js +0 -0
  340. /package/plugins/{draw-es → beta/draw-es}/src/api/deleteFeature.js +0 -0
  341. /package/plugins/{draw-es → beta/draw-es}/src/api/editFeature.js +0 -0
  342. /package/plugins/{draw-es → beta/draw-es}/src/api/newPolygon.js +0 -0
  343. /package/plugins/{draw-es → beta/draw-es}/src/events.js +0 -0
  344. /package/plugins/{draw-es → beta/draw-es}/src/graphic.js +0 -0
  345. /package/plugins/{draw-es → beta/draw-es}/src/index.js +0 -0
  346. /package/plugins/{draw-es → beta/draw-es}/src/manifest.js +0 -0
  347. /package/plugins/{draw-es → beta/draw-es}/src/reducer.js +0 -0
  348. /package/plugins/{draw-es → beta/draw-es}/src/sketchViewModel.js +0 -0
  349. /package/plugins/{frame → beta/draw-ml}/dist/esm/index.js.LICENSE.txt +0 -0
  350. /package/plugins/{frame → beta/draw-ml}/dist/umd/index.js.LICENSE.txt +0 -0
  351. /package/plugins/{draw-ml → beta/draw-ml}/src/DrawInit.jsx +0 -0
  352. /package/plugins/{draw-ml → beta/draw-ml}/src/api/deleteFeature.js +0 -0
  353. /package/plugins/{draw-ml → beta/draw-ml}/src/index.js +0 -0
  354. /package/plugins/{draw-ml → beta/draw-ml}/src/modes/disabledMode.js +0 -0
  355. /package/plugins/{draw-ml/src → beta/draw-ml/src/utils}/snapHelpers.js +0 -0
  356. /package/plugins/{frame → beta/frame}/dist/css/index.css +0 -0
  357. /package/plugins/{map-styles → beta/frame}/dist/esm/index.js.LICENSE.txt +0 -0
  358. /package/plugins/{map-styles → beta/frame}/dist/umd/index.js.LICENSE.txt +0 -0
  359. /package/plugins/{frame → beta/frame}/package.json +0 -0
  360. /package/plugins/{frame → beta/frame}/src/FrameInit.jsx +0 -0
  361. /package/plugins/{frame → beta/frame}/src/api/addFrame.js +0 -0
  362. /package/plugins/{frame → beta/frame}/src/api/editFeature.js +0 -0
  363. /package/plugins/{frame → beta/frame}/src/config.js +0 -0
  364. /package/plugins/{frame → beta/frame}/src/frame.scss +0 -0
  365. /package/plugins/{frame → beta/frame}/src/index.js +0 -0
  366. /package/plugins/{frame → beta/frame}/src/manifest.js +0 -0
  367. /package/plugins/{frame → beta/frame}/src/reducer.js +0 -0
  368. /package/plugins/{frame → beta/frame}/src/utils.js +0 -0
  369. /package/plugins/{scale-bar → beta/map-styles}/dist/esm/index.js.LICENSE.txt +0 -0
  370. /package/plugins/{scale-bar → beta/map-styles}/dist/umd/index.js.LICENSE.txt +0 -0
  371. /package/plugins/{map-styles → beta/map-styles}/src/MapStylesInit.jsx +0 -0
  372. /package/plugins/{map-styles → beta/map-styles}/src/config.js +0 -0
  373. /package/plugins/{map-styles → beta/map-styles}/src/index.js +0 -0
  374. /package/plugins/{scale-bar → beta/scale-bar}/dist/css/index.css +0 -0
  375. /package/plugins/{use-location → beta/scale-bar}/dist/esm/index.js.LICENSE.txt +0 -0
  376. /package/plugins/{use-location → beta/scale-bar}/dist/umd/index.js.LICENSE.txt +0 -0
  377. /package/plugins/{scale-bar → beta/scale-bar}/package.json +0 -0
  378. /package/plugins/{scale-bar → beta/scale-bar}/src/ScaleBar.jsx +0 -0
  379. /package/plugins/{scale-bar → beta/scale-bar}/src/ScaleBar.test.jsx +0 -0
  380. /package/plugins/{scale-bar → beta/scale-bar}/src/index.js +0 -0
  381. /package/plugins/{scale-bar → beta/scale-bar}/src/index.test.js +0 -0
  382. /package/plugins/{scale-bar → beta/scale-bar}/src/manifest.js +0 -0
  383. /package/plugins/{scale-bar → beta/scale-bar}/src/scaleBar.scss +0 -0
  384. /package/plugins/{scale-bar → beta/scale-bar}/src/utils.js +0 -0
  385. /package/plugins/{scale-bar → beta/scale-bar}/src/utils.test.js +0 -0
  386. /package/{providers/open-names → plugins/beta/use-location}/dist/esm/index.js.LICENSE.txt +0 -0
  387. /package/{providers/open-names → plugins/beta/use-location}/dist/umd/index.js.LICENSE.txt +0 -0
  388. /package/plugins/{use-location → beta/use-location}/src/UseLocation.jsx +0 -0
  389. /package/plugins/{use-location → beta/use-location}/src/UseLocationInit.jsx +0 -0
  390. /package/plugins/{use-location → beta/use-location}/src/defaults.js +0 -0
  391. /package/plugins/{use-location → beta/use-location}/src/events.js +0 -0
  392. /package/plugins/{use-location → beta/use-location}/src/index.js +0 -0
  393. /package/plugins/{use-location → beta/use-location}/src/manifest.js +0 -0
  394. /package/plugins/{use-location → beta/use-location}/src/reducer.js +0 -0
  395. /package/providers/{esri → beta/esri}/src/appEvents.js +0 -0
  396. /package/providers/{esri → beta/esri}/src/defaults.js +0 -0
  397. /package/providers/{esri → beta/esri}/src/esriProvider.scss +0 -0
  398. /package/providers/{esri → beta/esri}/src/utils/coords.js +0 -0
  399. /package/providers/{esri → beta/esri}/src/utils/detectWebGL.js +0 -0
  400. /package/providers/{esri → beta/esri}/src/utils/esriFixes.js +0 -0
  401. /package/providers/{esri → beta/esri}/src/utils/query.js +0 -0
  402. /package/providers/{esri → beta/esri}/src/utils/spatial.js +0 -0
  403. /package/providers/{open-names → beta/open-names}/dist/esm/im-reverse-geocode.js.LICENSE.txt +0 -0
  404. /package/providers/{open-names/dist/umd/im-reverse-geocode.js.LICENSE.txt → beta/open-names/dist/esm/index.js.LICENSE.txt} +0 -0
  405. /package/providers/{open-names → beta/open-names}/src/index.js +0 -0
  406. /package/providers/{open-names → beta/open-names}/src/reverseGeocode.js +0 -0
  407. /package/providers/{open-names → beta/open-names}/src/utils/mapToLocationModel.js +0 -0
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Creates an undo stack manager for draw operations.
3
+ * Fires 'draw.undochange' events when stack changes for UI updates.
4
+ *
5
+ * @param {Object} map - MapLibre map instance
6
+ * @returns {Object} Undo stack manager
7
+ */
8
+ export const createUndoStack = (map) => {
9
+ const stack = []
10
+
11
+ const fireChange = () => {
12
+ map.fire('draw.undochange', { length: stack.length })
13
+ }
14
+
15
+ return {
16
+ /**
17
+ * Push an undo operation onto the stack
18
+ * @param {Object} operation - { type, undo: Function, ...data }
19
+ */
20
+ push(operation) {
21
+ stack.push(operation)
22
+ fireChange()
23
+ },
24
+
25
+ /**
26
+ * Pop and return the last operation (does not execute it)
27
+ * @returns {Object|undefined} The operation or undefined if empty
28
+ */
29
+ pop() {
30
+ const op = stack.pop()
31
+ fireChange()
32
+ return op
33
+ },
34
+
35
+ /**
36
+ * Clear all operations from the stack
37
+ */
38
+ clear() {
39
+ stack.length = 0
40
+ fireChange()
41
+ },
42
+
43
+ /**
44
+ * Get current stack length
45
+ */
46
+ get length() {
47
+ return stack.length
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,16 @@
1
+ // --- Debounce Helper ---
2
+ export const debounce = (fn, delay) => {
3
+ let timeout
4
+
5
+ const debounced = (...args) => {
6
+ clearTimeout(timeout)
7
+ timeout = setTimeout(() => fn(...args), delay)
8
+ }
9
+
10
+ debounced.cancel = () => {
11
+ clearTimeout(timeout)
12
+ timeout = null
13
+ }
14
+
15
+ return debounced
16
+ }
@@ -0,0 +1,49 @@
1
+ const STYLE_PROPS = ['stroke', 'fill', 'strokeWidth']
2
+
3
+ /**
4
+ * Flatten style properties that may be strings or variant objects
5
+ * keyed by style ID into flat GeoJSON-compatible properties.
6
+ *
7
+ * @param {object} props - Object containing style properties
8
+ * @returns {object} Flattened properties
9
+ *
10
+ * @example
11
+ * flattenStyleProperties({
12
+ * stroke: { outdoor: '#e6c700', dark: '#ffd700' },
13
+ * fill: 'rgba(255, 221, 0, 0.1)',
14
+ * strokeWidth: 3
15
+ * })
16
+ * // Returns:
17
+ * // {
18
+ * // stroke: '#e6c700',
19
+ * // strokeOutdoor: '#e6c700',
20
+ * // strokeDark: '#ffd700',
21
+ * // fill: 'rgba(255, 221, 0, 0.1)',
22
+ * // strokeWidth: 3
23
+ * // }
24
+ */
25
+ export const flattenStyleProperties = (props) => {
26
+ if (!props) {
27
+ return {}
28
+ }
29
+
30
+ const result = {}
31
+
32
+ for (const [key, value] of Object.entries(props)) {
33
+ if (STYLE_PROPS.includes(key) && typeof value === 'object' && value !== null) {
34
+ const entries = Object.entries(value)
35
+ // First value as base fallback
36
+ if (entries.length > 0) {
37
+ result[key] = entries[0][1]
38
+ }
39
+ // Variant properties: e.g. strokeDark, fillOutdoor
40
+ for (const [styleId, styleValue] of entries) {
41
+ result[`${key}${styleId.charAt(0).toUpperCase() + styleId.slice(1)}`] = styleValue
42
+ }
43
+ } else {
44
+ result[key] = value
45
+ }
46
+ }
47
+
48
+ return result
49
+ }
@@ -0,0 +1,258 @@
1
+ import polygonSplitter from 'polygon-splitter'
2
+ import turfBearing from '@turf/bearing'
3
+ import turfDestination from '@turf/destination'
4
+ import turfBooleanValid from '@turf/boolean-valid'
5
+ import turfArea from '@turf/area'
6
+ import {
7
+ featureCollection as turfFeatureCollection,
8
+ polygon as turfPolygon,
9
+ multiPolygon as turfMultiPolygon,
10
+ lineString as turfLineString,
11
+ multiLineString as turfMultiLineString,
12
+ point as turfPoint,
13
+ multiPoint as turfMultiPoint
14
+ } from '@turf/helpers'
15
+
16
+ /**
17
+ * @typedef {import('geojson').Feature<import('geojson').Polygon>} Polygon
18
+ * @typedef {import('geojson').Feature<import('geojson').LineString>} Line
19
+ * @typedef {import('geojson').Feature<import('geojson').Feature>} Feature
20
+ * @typedef {import('geojson').FeatureCollection<import('geojson').FeatureCollection>} FeatureCollection
21
+ */
22
+
23
+ /**
24
+ * Extend a LineString at endpoints AND intermediate vertices.
25
+ * For intermediate vertices on the polygon boundary, this creates small
26
+ * extensions that ensure polygon-splitter recognizes them as crossing points.
27
+ *
28
+ * @param {Feature<LineString>} line
29
+ * @param {number} extendDist (distance to extend in Turf units)
30
+ */
31
+ function extendLine(line, extendDist = 1, units = 'meters') {
32
+ const coords = line.geometry.coordinates
33
+ const result = []
34
+
35
+ // Extend start point backward
36
+ const startBearing = turfBearing(coords[1], coords[0])
37
+ const newStart = turfDestination(coords[0], extendDist, startBearing, { units })
38
+ result.push(newStart.geometry.coordinates)
39
+
40
+ // Process each vertex
41
+ for (let i = 0; i < coords.length; i++) {
42
+ if (i > 0 && i < coords.length - 1) {
43
+ // Intermediate vertex: add extension past it (creates spike for boundary crossing)
44
+ const incomingBearing = turfBearing(coords[i - 1], coords[i])
45
+ const pastPt = turfDestination(coords[i], extendDist, incomingBearing, { units })
46
+ result.push(pastPt.geometry.coordinates)
47
+ }
48
+
49
+ result.push(coords[i])
50
+ }
51
+
52
+ // Extend end point forward
53
+ const endBearing = turfBearing(coords[coords.length - 2], coords[coords.length - 1])
54
+ const newEnd = turfDestination(coords[coords.length - 1], extendDist, endBearing, { units })
55
+ result.push(newEnd.geometry.coordinates)
56
+
57
+ return turfLineString(result)
58
+ }
59
+
60
+ /**
61
+ * Split a polygon using a line.
62
+ * Only accepts splits that result in exactly two polygons.
63
+ *
64
+ * @param {Feature<Polygon>} polygon
65
+ * @param {Feature<LineString>} line
66
+ * @returns {FeatureCollection<Polygon>|null}
67
+ */
68
+ const splitPolygon = (polygon, line) => {
69
+ // Extend only start and end vertices
70
+ const extended = extendLine(line) // assume extendLine only touches start/end now
71
+
72
+ let result
73
+ try {
74
+ result = polygonSplitter(polygon, extended)
75
+ } catch {
76
+ return null
77
+ }
78
+
79
+ // Must result in exactly 2 polygons
80
+ let polygons = []
81
+ if (result.geometry.type === 'MultiPolygon') {
82
+ if (result.geometry.coordinates.length !== 2) {
83
+ return null
84
+ }
85
+ polygons = result.geometry.coordinates.map(coords => turfPolygon(coords, polygon.properties))
86
+ } else {
87
+ return null
88
+ }
89
+
90
+ // Assign IDs & properties
91
+ const baseId = polygon.id ?? polygon.properties?.id ?? 'poly'
92
+ const features = polygons.map((poly, i) =>
93
+ turfPolygon(
94
+ poly.geometry.coordinates,
95
+ { ...polygon.properties, id: baseId },
96
+ { id: `${baseId}-${i + 1}` }
97
+ )
98
+ )
99
+
100
+ return turfFeatureCollection(features)
101
+ }
102
+
103
+ /**
104
+ * Convert a GeoJSON Feature or geometry-like object into a Turf geometry.
105
+ *
106
+ * @param {Object} featureOrGeom - Either a Feature with a `.geometry` property or a raw GeoJSON geometry object.
107
+ * @returns {Object} Turf geometry (Polygon, LineString, Point, etc.)
108
+ *
109
+ * @throws Will throw if the geometry type is not supported.
110
+ */
111
+ const toTurfGeometry = (featureOrGeom) => {
112
+ const geom = featureOrGeom.geometry || featureOrGeom
113
+
114
+ switch (geom.type) {
115
+ case 'Polygon':
116
+ return turfPolygon(geom.coordinates);
117
+ case 'MultiPolygon':
118
+ return turfMultiPolygon(geom.coordinates);
119
+ case 'LineString':
120
+ return turfLineString(geom.coordinates);
121
+ case 'MultiLineString':
122
+ return turfMultiLineString(geom.coordinates);
123
+ case 'Point':
124
+ return turfPoint(geom.coordinates);
125
+ case 'MultiPoint':
126
+ return turfMultiPoint(geom.coordinates);
127
+ default:
128
+ throw new Error(`Unsupported geometry type: ${geom.type}`)
129
+ }
130
+ }
131
+
132
+ const haversine = ([lon1, lat1], [lon2, lat2]) => {
133
+ const toRad = deg => deg * Math.PI / 180
134
+ const R = 6371000 // meters
135
+ const dLat = toRad(lat2 - lat1)
136
+ const dLon = toRad(lon2 - lon1)
137
+ const a = Math.sin(dLat / 2) ** 2 + Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) * Math.sin(dLon / 2) ** 2
138
+ return 2 * R * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
139
+ }
140
+
141
+ const isNewCoordinate = (coords, tolerance = 0.01) => {
142
+ // First coord
143
+ if (coords[0].length <= 1) {
144
+ return true
145
+ }
146
+ // Subsequent coordsmust be different
147
+ if (coords[0].length <= 3) {
148
+ for (let i = 0; i < coords[0].length; i++) {
149
+ for (let j = i + 1; j < coords[0].length; j++) {
150
+ if (haversine(coords[0][i], coords[0][j]) < tolerance) {
151
+ return false
152
+ }
153
+ }
154
+ }
155
+ }
156
+ return true
157
+ }
158
+
159
+ const isNewLineCoordinate = (coords, tolerance = 0.01) => {
160
+ // First coord is always valid
161
+ if (coords.length <= 1) {
162
+ return true
163
+ }
164
+ // Check last two coords are different
165
+ if (coords.length >= 2) {
166
+ const last = coords[coords.length - 1]
167
+ const secondLast = coords[coords.length - 2]
168
+ if (haversine(last, secondLast) < tolerance) {
169
+ return false
170
+ }
171
+ }
172
+ return true
173
+ }
174
+
175
+ const isValidLineClick = (coords) => {
176
+ // First coord is always valid
177
+ if (coords.length <= 1) {
178
+ return true
179
+ }
180
+ // Check that the new coordinate is different from the previous one
181
+ return isNewLineCoordinate(coords)
182
+ }
183
+
184
+ const isValidClick = (coords) => {
185
+ // Less than 4 and new coordinates
186
+ if (coords[0].length <= 1 || isNewCoordinate(coords)) {
187
+ return true
188
+ }
189
+
190
+ // Basic checks
191
+ if (!Array.isArray(coords) || coords.length < 4) {
192
+ return false
193
+ }
194
+
195
+ // Check if ring is closed
196
+ const first = coords[0]
197
+ const last = coords[coords.length - 1]
198
+ const isClosed = first[0] === last[0] && first[1] === last[1]
199
+ if (!isClosed) {
200
+ return false
201
+ }
202
+
203
+ // Create a turf polygon
204
+ const turfPoly = turfPolygon([coords])
205
+
206
+ // Check if geometry is valid (non-self-intersecting)
207
+ const valid = turfBooleanValid(turfPoly)
208
+ if (!valid) {
209
+ return false
210
+ }
211
+
212
+ // Check if area is positive
213
+ const polyArea = turfArea(turfPoly)
214
+ if (polyArea <= 0) {
215
+ return false
216
+ }
217
+
218
+ return true
219
+ }
220
+
221
+ const spatialNavigate = (start, pixels, direction) => {
222
+ const quadrant = pixels.filter((p, i) => {
223
+ const offsetX = Math.abs(p[0] - start[0])
224
+ const offsetY = Math.abs(p[1] - start[1])
225
+ let isQuadrant = false
226
+ if (direction === 'ArrowUp') {
227
+ isQuadrant = p[1] <= start[1] && offsetY >= offsetX
228
+ } else if (direction === 'ArrowDown') {
229
+ isQuadrant = p[1] > start[1] && offsetY >= offsetX
230
+ } else if (direction === 'ArrowLeft') {
231
+ isQuadrant = p[0] <= start[0] && offsetY < offsetX
232
+ } else if (direction === 'ArrowRight') {
233
+ isQuadrant = p[0] > start[0] && offsetY < offsetX
234
+ } else {
235
+ isQuadrant = true
236
+ }
237
+ return isQuadrant && (JSON.stringify(p) !== JSON.stringify(start))
238
+ })
239
+
240
+ if (!quadrant.length) {
241
+ quadrant.push(start)
242
+ }
243
+
244
+ const pythagorean = (a, b) => Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2))
245
+ const distances = quadrant.map(p => pythagorean(Math.abs(start[0] - p[0]), Math.abs(start[1] - p[1])))
246
+ const closest = quadrant[distances.indexOf(Math.min(...distances))]
247
+ return pixels.findIndex(i => JSON.stringify(i) === JSON.stringify(closest))
248
+ }
249
+
250
+ export {
251
+ toTurfGeometry,
252
+ splitPolygon,
253
+ extendLine,
254
+ isNewCoordinate,
255
+ isValidClick,
256
+ isValidLineClick,
257
+ spatialNavigate
258
+ }
@@ -0,0 +1 @@
1
+ export const __webpack_esm_id__="im-frame-plugin";export const __webpack_esm_ids__=["im-frame-plugin"];export const __webpack_esm_modules__={"./plugins/beta/frame/src/manifest.js"(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){u(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function u(e,t,r){return(t=function(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,{manifest:()=>k}),r.r(t);var a={SET_FRAME:function(e,t){return i(i({},e),{},{frame:t})},SET_FRAME_REFS:function(e,t){return i(i({},e),{},{frameRefs:t})}},c=r("react");function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function p(e){var t;if(null==e||null===(t=e.geometry)||void 0===t||null===(t=t.coordinates)||void 0===t||!t[0])return null;var r=e.geometry.coordinates[0],n=1/0,o=1/0,i=-1/0,u=-1/0;return r.forEach(function(e){var t=l(e,2),r=t[0],a=t[1];r<n&&(n=r),r>i&&(i=r),a<o&&(o=a),a>u&&(u=a)}),[n,o,i,u]}var s=r("react/jsx-runtime");function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach(function(t){d(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function d(e,t,r){return(t=function(e){var t=function(e){if("object"!=y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==y(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return g(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var O={aspectRatio:1,mobileWidth:"300px",tabletWidth:"360px",desktopWidth:"400px"};function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach(function(t){w(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function w(e,t,r){return(t=function(e){var t=function(e){if("object"!=h(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==h(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E(Object(r),!0).forEach(function(t){x(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function x(e,t,r){return(t=function(e){var t=function(e){if("object"!=P(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=P(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==P(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _(e){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(e)}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function D(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach(function(t){M(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function M(e,t,r){return(t=function(e){var t=function(e){if("object"!=_(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var A={mobile:{slot:"actions",showLabel:!0},tablet:{slot:"actions",showLabel:!0},desktop:{slot:"actions",showLabel:!0}},k={reducer:{initialState:{frame:null,frameRefs:null},actions:a},InitComponent:function(e){var t,r,n,o,i=e.appState,u=e.mapState,a=e.mapProvider,l=e.pluginConfig,f=e.pluginState,p=e.services,s=e.buttonConfig,y=i.mode,b=i.breakpoint,m=i.layoutRefs,d=p.eventBus,v=s.frameDone,g=s.frameCancel,O=f.dispatch,h=f.frameRefs,j=f.frame,S=null===(t=null===(r=l.includeModes)||void 0===r?void 0:r.includes(y))||void 0===t||t,w=null!==(n=null===(o=l.excludeModes)||void 0===o?void 0:o.includes(y))&&void 0!==n&&n,P=u.isMapReady&&S&&!w;(0,c.useEffect)(function(){if(P)return v.onClick=function(){var e=function(e){var t=e.viewportEl,r=e.mapProvider,n=e.featureId,o=e.scale,i=e.frameEl.getBoundingClientRect(),u=t.getBoundingClientRect(),a={x:(i.left-u.left)/o,y:(i.top-u.top)/o},c={x:(i.right-u.left)/o,y:(i.top-u.top)/o},l={x:(i.right-u.left)/o,y:(i.bottom-u.top)/o},f={x:(i.left-u.left)/o,y:(i.bottom-u.top)/o},p={type:"Feature",geometry:{type:"Polygon",coordinates:[[r.screenToMap(a),r.screenToMap(c),r.screenToMap(l),r.screenToMap(f),r.screenToMap(a)]]},properties:{}};return n&&(p.id=n),p}({frameEl:h.displayRef.current,viewportEl:m.viewportRef.current,featureId:null==j?void 0:j.featureId,scale:{small:1,medium:1.5,large:2}[u.mapSize],mapProvider:a});O({type:"SET_FRAME",payload:null}),d.emit("frame:done",e)},g.onClick=function(){O({type:"SET_FRAME",payload:null}),d.emit("frame:cancel")},function(){v.onClick=null,g.onClick=null}},[u.isMapReady,y,b,j,h,m,a,O,d,v,g])},controls:[{id:"frame",label:"Frame",mobile:{slot:"middle"},tablet:{slot:"middle"},desktop:{slot:"middle"},render:function(e){var t,r=e.appState,n=e.mapState,o=e.pluginState,i=e.mapProvider,u=r.layoutRefs,a=u.actionsRef,l=u.mainRef,f=u.footerRef,p=u.viewportRef,y=o.dispatch,b=(0,c.useRef)(null),d=(0,c.useRef)(null),g=(0,c.useRef)(null),O=v((0,c.useState)("65px"),2),h=O[0],j=O[1],S=v((0,c.useState)(null),2),w=S[0],P=S[1];return(0,c.useEffect)(function(){y({type:"SET_FRAME_REFS",payload:{displayRef:d}})},[]),(0,c.useEffect)(function(){if(o.frame&&b.current){var e=b.current,t=function(){if(a.current&&l.current&&f.current){var t=l.current.offsetHeight,n=f.current.offsetTop,i=a.current.offsetTop,u=t-Math.min(i,n)+10;j("65px 65px ".concat(u,"px 65px"));var c=e.offsetWidth,p=e.offsetHeight;if(t-u-e.offsetTop===e.offsetHeight){var s=function(e,t,r,n){var o=Number.parseInt(r["".concat(n,"Width")]||e,10),i=Math.min(o,e),u=i/r.aspectRatio;return u>t&&(i=(u=t)*r.aspectRatio),{top:(t-u)/2,left:(e-i)/2,width:i,height:u}}(c,p,o.frame,r.breakpoint),y=s.top,b=s.left,m=s.width,d=s.height,v=y+e.offsetTop,g=b+e.offsetLeft;P({top:"".concat(v,"px"),left:"".concat(g,"px"),width:"".concat(m,"px"),height:"".concat(d,"px")})}}},n=new window.ResizeObserver(t);return n.observe(e),t(),function(){return n.disconnect()}}g.current=null},[o.frame,r.breakpoint,a,l,f]),(0,c.useEffect)(function(){var e;if(null!==(e=o.frame)&&void 0!==e&&e.bounds&&d.current&&p.current&&w){var t=d.current,r=p.current,u=t.getBoundingClientRect(),a=r.getBoundingClientRect(),c={small:1,medium:1.5,large:2}[n.mapSize],l={top:(u.top-a.top)/c,right:(a.right-u.right)/c,bottom:(a.bottom-u.bottom)/c,left:(u.left-a.left)/c};i.setPadding(l),i.fitToBounds(o.frame.bounds,!0)}},[null===(t=o.frame)||void 0===t?void 0:t.bounds,w,i,d,p]),o.frame?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"im-c-frame-spacer",style:{inset:h},ref:b}),w&&(0,s.jsx)("div",{ref:d,className:"im-c-frame-display",style:m({},w)})]}):null}}],buttons:[D({id:"frameDone",label:"Done",variant:"primary",hiddenWhen:function(e){return!e.pluginState.frame}},A),D({id:"frameCancel",label:"Cancel",variant:"tertiary",hiddenWhen:function(e){return!e.pluginState.frame}},A)],api:{addFrame:function(e,t){var r=e.pluginConfig,n=e.pluginState,o=e.services,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=n.dispatch,a=o.eventBus;u({type:"SET_FRAME",payload:S(S(S(S({},O),r),i),{},{featureId:t})}),a.emit("frame:add")},editFeature:function(e,t){var r=e.pluginConfig,n=e.pluginState,o=e.mapProvider,i=e.services,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=n.dispatch,c=i.eventBus,f=p(t),s=function(e,t){var r=p(e);if(!r)return null;var n=l(r,4),o=n[0],i=n[1],u=n[2],a=n[3],c=t.mapToScreen([o,a]),f=t.mapToScreen([u,i]),s=Math.abs(f.x-c.x),y=Math.abs(f.y-c.y);return 0===y?null:Math.round(s/y*1e6)/1e6}(t,o),y=R(R(R(R({},O),r),u),{},{aspectRatio:s,featureId:(null==t?void 0:t.id)||t.properties.id});a({type:"SET_FRAME",payload:R(R({},y),{},{bounds:f})}),c.emit("frame:edit")}}}}};
@@ -0,0 +1,2 @@
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ import*as e from"react";import*as t from"react/jsx-runtime";var r,n,o={react(t,r,n){var o,i;t.exports=(o={useEffect:()=>e.useEffect,useRef:()=>e.useRef,useState:()=>e.useState},i={},n.d(i,o),i)},"react/jsx-runtime"(e,r,n){var o,i;e.exports=(o={Fragment:()=>t.Fragment,jsx:()=>t.jsx,jsxs:()=>t.jsxs},i={},n.d(i,o),i)}},i={};function u(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,u),r.exports}u.m=o,u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.f={},u.e=e=>Promise.all(Object.keys(u.f).reduce((t,r)=>(u.f[r](e,t),t),[])),u.u=e=>"../esm/"+e+".js",u.miniCssF=e=>{},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u.p=e+"../css/"})(),r={index:0},n=e=>{var t,n,{__webpack_esm_ids__:o,__webpack_esm_modules__:i,__webpack_esm_runtime__:c}=e,a=0;for(t in i)u.o(i,t)&&(u.m[t]=i[t]);for(c&&c(u);a<o.length;a++)n=o[a],u.o(r,n)&&r[n]&&r[n][0](),r[o[a]]=0},u.f.j=(e,t)=>{var o=u.o(r,e)?r[e]:void 0;if(0!==o)if(o)t.push(o[1]);else{var i=import("../css/"+u.u(e)).then(n,t=>{throw 0!==r[e]&&(r[e]=void 0),t});i=Promise.race([i,new Promise(t=>o=r[e]=[t])]),t.push(o[1]=i)}};var c={};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function f(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var a=n&&n.prototype instanceof c?n:c,f=Object.create(a.prototype);return s(f,"_invoke",function(r,n,o){var i,c,a,f=0,s=o||[],p=!1,l={p:0,n:0,v:e,a:b,f:b.bind(e,4),d:function(t,r){return i=t,c=0,a=e,l.n=r,u}};function b(r,n){for(c=r,a=n,t=0;!p&&f&&!o&&t<s.length;t++){var o,i=s[t],b=l.p,y=i[2];r>3?(o=y===n)&&(a=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=b&&((o=r<2&&b<i[1])?(c=0,l.v=n,l.n=i[1]):b<y&&(o=r<3||i[0]>n||n>y)&&(i[4]=r,i[5]=n,l.n=y,c=0))}if(o||r>1)return u;throw p=!0,n}return function(o,s,y){if(f>1)throw TypeError("Generator is already running");for(p&&1===s&&b(s,y),c=s,a=y;(t=c<2?e:a)||!p;){i||(c?c<3?(c>1&&(l.n=-1),b(c,a)):l.n=a:l.v=a);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(p=l.n<0)?a:r.call(n,l))!==u)break}catch(t){i=e,c=1,a=t}finally{f=1}}return{value:t,done:p}}}(r,o,i),!0),f}var u={};function c(){}function a(){}function p(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(s(t={},n,function(){return this}),t),b=p.prototype=c.prototype=Object.create(l);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,o,"GeneratorFunction")),e.prototype=Object.create(b),e}return a.prototype=p,s(b,"constructor",p),s(p,"constructor",a),a.displayName="GeneratorFunction",s(p,o,"GeneratorFunction"),s(b),s(b,o,"Generator"),s(b,n,function(){return this}),s(b,"toString",function(){return"[object Generator]"}),(f=function(){return{w:i,m:y}})()}function s(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}s=function(e,t,r,n){function i(t,r){s(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},s(e,t,r,n)}function p(e,t,r,n,o,i,u){try{var c=e[i](u),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,o)}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach(function(t){y(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function y(e,t,r){return(t=function(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m(){var e,t;return b(b({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"frame",load:(e=f().m(function e(){var t;return f().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,u.e("im-frame-plugin").then(u.bind(u,"./plugins/beta/frame/src/manifest.js"));case 1:return t=e.v.manifest,e.a(2,t)}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function u(e){p(i,n,o,u,c,"next",e)}function c(e){p(i,n,o,u,c,"throw",e)}u(void 0)})},function(){return t.apply(this,arguments)})})}u.d(c,{A:()=>m});const v=c.A;export{v as default};
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[191],{397(t,e,r){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){u(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function u(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.r(e),r.d(e,{manifest:()=>A});var a={SET_FRAME:function(t,e){return i(i({},t),{},{frame:e})},SET_FRAME_REFS:function(t,e){return i(i({},t),{},{frameRefs:e})}},c=r(738);function l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(l)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return f(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function p(t){var e;if(null==t||null===(e=t.geometry)||void 0===e||null===(e=e.coordinates)||void 0===e||!e[0])return null;var r=t.geometry.coordinates[0],n=1/0,o=1/0,i=-1/0,u=-1/0;return r.forEach(function(t){var e=l(t,2),r=e[0],a=e[1];r<n&&(n=r),r>i&&(i=r),a<o&&(o=a),a>u&&(u=a)}),[n,o,i,u]}var s=r(287);function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function m(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach(function(e){d(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function d(t,e,r){return(e=function(t){var e=function(t){if("object"!=y(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==y(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function v(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(l)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return g(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var O={aspectRatio:1,mobileWidth:"300px",tabletWidth:"360px",desktopWidth:"400px"};function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function S(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?j(Object(r),!0).forEach(function(e){w(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function w(t,e,r){return(e=function(t){var e=function(t){if("object"!=h(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==h(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function P(t){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},P(t)}function E(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function R(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?E(Object(r),!0).forEach(function(e){T(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function T(t,e,r){return(e=function(t){var e=function(t){if("object"!=P(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=P(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==P(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function D(t){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D(t)}function M(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function x(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?M(Object(r),!0).forEach(function(e){C(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function C(t,e,r){return(e=function(t){var e=function(t){if("object"!=D(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=D(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==D(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var k={mobile:{slot:"actions",showLabel:!0},tablet:{slot:"actions",showLabel:!0},desktop:{slot:"actions",showLabel:!0}},A={reducer:{initialState:{frame:null,frameRefs:null},actions:a},InitComponent:function(t){var e,r,n,o,i=t.appState,u=t.mapState,a=t.mapProvider,l=t.pluginConfig,f=t.pluginState,p=t.services,s=t.buttonConfig,y=i.mode,b=i.breakpoint,m=i.layoutRefs,d=p.eventBus,v=s.frameDone,g=s.frameCancel,O=f.dispatch,h=f.frameRefs,j=f.frame,S=null===(e=null===(r=l.includeModes)||void 0===r?void 0:r.includes(y))||void 0===e||e,w=null!==(n=null===(o=l.excludeModes)||void 0===o?void 0:o.includes(y))&&void 0!==n&&n,P=u.isMapReady&&S&&!w;(0,c.useEffect)(function(){if(P)return v.onClick=function(){var t=function(t){var e=t.viewportEl,r=t.mapProvider,n=t.featureId,o=t.scale,i=t.frameEl.getBoundingClientRect(),u=e.getBoundingClientRect(),a={x:(i.left-u.left)/o,y:(i.top-u.top)/o},c={x:(i.right-u.left)/o,y:(i.top-u.top)/o},l={x:(i.right-u.left)/o,y:(i.bottom-u.top)/o},f={x:(i.left-u.left)/o,y:(i.bottom-u.top)/o},p={type:"Feature",geometry:{type:"Polygon",coordinates:[[r.screenToMap(a),r.screenToMap(c),r.screenToMap(l),r.screenToMap(f),r.screenToMap(a)]]},properties:{}};return n&&(p.id=n),p}({frameEl:h.displayRef.current,viewportEl:m.viewportRef.current,featureId:null==j?void 0:j.featureId,scale:{small:1,medium:1.5,large:2}[u.mapSize],mapProvider:a});O({type:"SET_FRAME",payload:null}),d.emit("frame:done",t)},g.onClick=function(){O({type:"SET_FRAME",payload:null}),d.emit("frame:cancel")},function(){v.onClick=null,g.onClick=null}},[u.isMapReady,y,b,j,h,m,a,O,d,v,g])},controls:[{id:"frame",label:"Frame",mobile:{slot:"middle"},tablet:{slot:"middle"},desktop:{slot:"middle"},render:function(t){var e,r=t.appState,n=t.mapState,o=t.pluginState,i=t.mapProvider,u=r.layoutRefs,a=u.actionsRef,l=u.mainRef,f=u.footerRef,p=u.viewportRef,y=o.dispatch,b=(0,c.useRef)(null),d=(0,c.useRef)(null),g=(0,c.useRef)(null),O=v((0,c.useState)("65px"),2),h=O[0],j=O[1],S=v((0,c.useState)(null),2),w=S[0],P=S[1];return(0,c.useEffect)(function(){y({type:"SET_FRAME_REFS",payload:{displayRef:d}})},[]),(0,c.useEffect)(function(){if(o.frame&&b.current){var t=b.current,e=function(){if(a.current&&l.current&&f.current){var e=l.current.offsetHeight,n=f.current.offsetTop,i=a.current.offsetTop,u=e-Math.min(i,n)+10;j("65px 65px ".concat(u,"px 65px"));var c=t.offsetWidth,p=t.offsetHeight;if(e-u-t.offsetTop===t.offsetHeight){var s=function(t,e,r,n){var o=Number.parseInt(r["".concat(n,"Width")]||t,10),i=Math.min(o,t),u=i/r.aspectRatio;return u>e&&(i=(u=e)*r.aspectRatio),{top:(e-u)/2,left:(t-i)/2,width:i,height:u}}(c,p,o.frame,r.breakpoint),y=s.top,b=s.left,m=s.width,d=s.height,v=y+t.offsetTop,g=b+t.offsetLeft;P({top:"".concat(v,"px"),left:"".concat(g,"px"),width:"".concat(m,"px"),height:"".concat(d,"px")})}}},n=new window.ResizeObserver(e);return n.observe(t),e(),function(){return n.disconnect()}}g.current=null},[o.frame,r.breakpoint,a,l,f]),(0,c.useEffect)(function(){var t;if(null!==(t=o.frame)&&void 0!==t&&t.bounds&&d.current&&p.current&&w){var e=d.current,r=p.current,u=e.getBoundingClientRect(),a=r.getBoundingClientRect(),c={small:1,medium:1.5,large:2}[n.mapSize],l={top:(u.top-a.top)/c,right:(a.right-u.right)/c,bottom:(a.bottom-u.bottom)/c,left:(u.left-a.left)/c};i.setPadding(l),i.fitToBounds(o.frame.bounds,!0)}},[null===(e=o.frame)||void 0===e?void 0:e.bounds,w,i,d,p]),o.frame?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"im-c-frame-spacer",style:{inset:h},ref:b}),w&&(0,s.jsx)("div",{ref:d,className:"im-c-frame-display",style:m({},w)})]}):null}}],buttons:[x({id:"frameDone",label:"Done",variant:"primary",hiddenWhen:function(t){return!t.pluginState.frame}},k),x({id:"frameCancel",label:"Cancel",variant:"tertiary",hiddenWhen:function(t){return!t.pluginState.frame}},k)],api:{addFrame:function(t,e){var r=t.pluginConfig,n=t.pluginState,o=t.services,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=n.dispatch,a=o.eventBus;u({type:"SET_FRAME",payload:S(S(S(S({},O),r),i),{},{featureId:e})}),a.emit("frame:add")},editFeature:function(t,e){var r=t.pluginConfig,n=t.pluginState,o=t.mapProvider,i=t.services,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=n.dispatch,c=i.eventBus,f=p(e),s=function(t,e){var r=p(t);if(!r)return null;var n=l(r,4),o=n[0],i=n[1],u=n[2],a=n[3],c=e.mapToScreen([o,a]),f=e.mapToScreen([u,i]),s=Math.abs(f.x-c.x),y=Math.abs(f.y-c.y);return 0===y?null:Math.round(s/y*1e6)/1e6}(e,o),y=R(R(R(R({},O),r),u),{},{aspectRatio:s,featureId:(null==e?void 0:e.id)||e.properties.id});a({type:"SET_FRAME",payload:R(R({},y),{},{bounds:f})}),c.emit("frame:edit")}}}}}]);
@@ -0,0 +1,2 @@
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.framePlugin=t())}(this,()=>(()=>{"use strict";var e,t,r={738(e){e.exports=preactCompat},287(e){e.exports=preactJsxRuntime}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.m=r,o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>"im-frame-plugin.js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="defra.framePlugin:",o.l=(r,n,i,a)=>{if(e[r])e[r].push(n);else{var u,c;if(void 0!==i)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var l=f[p];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+i){u=l;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+i),u.src=r),e[r]=[n];var s=(t,n)=>{u.onerror=u.onload=null,clearTimeout(b);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),t)return t(n)},b=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),c&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var i=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=i);var a=o.p+o.u(t),u=new Error;o.l(a,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",u.name="ChunkLoadError",u.type=i,u.request=a,n[1](u)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,i,[a,u,c]=r,f=0;if(a.some(t=>0!==e[t])){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);c&&c(o)}for(t&&t(r);f<a.length;f++)i=a[f],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function u(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof f?n:f,p=Object.create(u.prototype);return c(p,"_invoke",function(r,n,o){var i,u,c,f=0,p=o||[],l=!1,s={p:0,n:0,v:e,a:b,f:b.bind(e,4),d:function(t,r){return i=t,u=0,c=e,s.n=r,a}};function b(r,n){for(u=r,c=n,t=0;!l&&f&&!o&&t<p.length;t++){var o,i=p[t],b=s.p,d=i[2];r>3?(o=d===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=b&&((o=r<2&&b<i[1])?(u=0,s.v=n,s.n=i[1]):b<d&&(o=r<3||i[0]>n||n>d)&&(i[4]=r,i[5]=n,s.n=d,u=0))}if(o||r>1)return a;throw l=!0,n}return function(o,p,d){if(f>1)throw TypeError("Generator is already running");for(l&&1===p&&b(p,d),u=p,c=d;(t=u<2?e:c)||!l;){i||(u?u<3?(u>1&&(s.n=-1),b(u,c)):s.n=c:s.v=c);try{if(f=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(l=s.n<0)?c:r.call(n,s))!==a)break}catch(t){i=e,u=1,c=t}finally{f=1}}return{value:t,done:l}}}(r,o,i),!0),p}var a={};function f(){}function p(){}function l(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(c(t={},n,function(){return this}),t),b=l.prototype=f.prototype=Object.create(s);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,c(e,o,"GeneratorFunction")),e.prototype=Object.create(b),e}return p.prototype=l,c(b,"constructor",l),c(l,"constructor",p),p.displayName="GeneratorFunction",c(l,o,"GeneratorFunction"),c(b),c(b,o,"Generator"),c(b,n,function(){return this}),c(b,"toString",function(){return"[object Generator]"}),(u=function(){return{w:i,m:d}})()}function c(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}c=function(e,t,r,n){function i(t,r){c(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},c(e,t,r,n)}function f(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,t,r){return(t=function(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(){var e,t;return l(l({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"frame",load:(e=u().m(function e(){var t;return u().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.e(191).then(o.bind(o,397));case 1:return t=e.v.manifest,e.a(2,t)}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){f(i,n,o,a,u,"next",e)}function u(e){f(i,n,o,a,u,"throw",e)}a(void 0)})},function(){return t.apply(this,arguments)})})}return o.d(i,{default:()=>b}),i.default})());
@@ -65,7 +65,7 @@ export function Frame({ appState, mapState, pluginState, mapProvider }) {
65
65
  })
66
66
  }
67
67
 
68
- const observer = new ResizeObserver(updateLayout)
68
+ const observer = new window.ResizeObserver(updateLayout)
69
69
  observer.observe(parent)
70
70
 
71
71
  updateLayout()
@@ -1 +1 @@
1
- .im-c-map-styles{display:block}.im-c-map-styles__inner{display:flex;flex-wrap:wrap}.im-c-map-styles__heading{padding:var(--primary-gap) 0}.im-c-map-styles__item{display:flex;justify-content:center;padding:calc(var(--divider-gap)/2);flex:0 0 33.3333%;box-sizing:border-box;min-width:90px}.im-c-map-styles__button{display:flex;flex-direction:column;align-items:center;border:0;margin:0;color:var(--foreground-color);background-color:rgba(0,0,0,0);cursor:pointer}.im-c-map-styles__image{position:relative;padding:2px;border:3px solid rgba(0,0,0,0)}.im-c-map-styles__image svg{fill:currentColor}.im-c-map-styles__image-bg{fill:none;stroke:var(--image-placeholder-color)}.im-c-map-styles img{display:block}.im-c-map-styles__group:not(:first-child){margin-top:var(--divider-gap);border-top:1px solid var(--content-border-color)}.im-c-map-styles__button[aria-pressed=true] .im-c-map-styles__image{border-color:var(--foreground-color)}.im-c-map-styles__button:focus{outline:0}.im-c-map-styles__button[data-focus-visible=true] .im-c-map-styles__image::after{content:"";position:absolute;inset:-3px;outline:3px solid var(--focus-outline-color);border:3px solid var(--focus-border-color)}.im-c-map-styles__button:hover:not([aria-pressed=true]) .im-c-map-styles__image{border-color:var(--button-hover-color)}
1
+ .im-c-map-styles{display:block}.im-c-map-styles__inner{display:flex;flex-wrap:wrap}.im-c-map-styles__heading{padding:var(--primary-gap) 0}.im-c-map-styles__item{display:flex;justify-content:center;padding:calc(var(--divider-gap)/2);flex:0 0 33.3333%;box-sizing:border-box;min-width:90px}.im-c-map-styles__button{display:flex;flex-direction:column;align-items:center;border:0;margin:0;color:var(--foreground-color);background-color:rgba(0,0,0,0);cursor:pointer}.im-c-map-styles__image{position:relative;padding:2px;border:3px solid rgba(0,0,0,0)}.im-c-map-styles__image svg{fill:currentColor}.im-c-map-styles__image-bg{fill:none;stroke:var(--image-placeholder-color)}.im-c-map-styles img{display:block}.im-c-map-styles__group:not(:first-child){margin-top:var(--divider-gap);border-top:1px solid var(--content-border-color)}.im-c-map-styles__button[aria-pressed=true] .im-c-map-styles__image{border-color:var(--foreground-color)}.im-c-map-styles__button:focus{outline:0}.im-c-map-styles__button[data-focus-visible=true] .im-c-map-styles__image::after{content:"";position:absolute;top:-3px;right:-3px;bottom:-3px;left:-3px;outline:3px solid var(--focus-outline-color);border:3px solid var(--focus-border-color)}.im-c-map-styles__button:hover:not([aria-pressed=true]) .im-c-map-styles__image{border-color:var(--button-hover-color)}
@@ -0,0 +1 @@
1
+ export const __webpack_esm_id__="im-map-styles-plugin";export const __webpack_esm_ids__=["im-map-styles-plugin"];export const __webpack_esm_modules__={"./plugins/beta/map-styles/src/manifest.js"(e,t,i){i.d(t,{manifest:()=>p}),i.r(t);var s=i("react"),n=i("react/jsx-runtime");new Set,new Set;function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function l(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,s)}return i}function a(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?l(Object(i),!0).forEach(function(t){o(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):l(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function o(e,t,i){return(t=function(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var m={slot:"middle",initiallyOpen:!1,dismissable:!0,modal:!0},c=(a({},m),a(a({},m),{},{width:"500px"}),a(a({},m),{},{width:"500px"}),{small:1,medium:1.5,large:2}),p={InitComponent:function(e){var t=e.pluginConfig,i=e.services,r=i.events,l=i.eventBus,a=function(){l.emit(r.MAP_INIT_MAP_STYLES,t.mapStyles)};return(0,s.useEffect)(function(){return l.on(r.APP_READY,a),function(){return l.off(r.APP_READY,a)}},[]),(0,n.jsx)(n.Fragment,{})},panels:[{id:"mapStyles",label:"Map styles",mobile:{slot:"bottom",modal:!0,dismissable:!0},tablet:{slot:"inset",modal:!0,width:"400px",dismissable:!0},desktop:{slot:"inset",modal:!0,width:"400px",dismissable:!0},render:function(e){var t=e.mapState,i=e.pluginConfig,s=e.services,r=e.mapProvider,l=t.mapStyle,a=t.mapSize,o=i.mapStyles,m=s.events,p=s.eventBus,d=r.capabilities.supportsMapSizes;return(0,n.jsxs)("div",{className:"im-c-map-styles",children:[(0,n.jsx)("div",{className:"im-c-map-styles__group",children:(0,n.jsx)("div",{className:"im-c-map-styles__inner",children:o.filter(function(e){return e.url}).map(function(e){return(0,n.jsx)("div",{className:"im-c-map-styles__item",children:(0,n.jsxs)("button",{className:"im-c-map-styles__button","aria-pressed":e.id===l.id,onClick:function(){return t=e,void p.emit(m.MAP_SET_STYLE,t);var t},children:[(0,n.jsx)("div",{className:"im-c-map-styles__image",children:(0,n.jsx)("img",{src:e.thumbnail||void 0,alt:"",height:"60",width:"60"})}),e.label]})},e.id)})})}),d&&(0,n.jsxs)("div",{className:"im-c-map-styles__group",children:[(0,n.jsx)("h3",{className:"im-c-map-styles__heading",id:"map-text-sizes",children:"Map size"}),(0,n.jsx)("div",{className:"im-c-map-styles__inner",children:["small","medium","large"].map(function(e){return(0,n.jsx)("div",{className:"im-c-map-styles__item",children:(0,n.jsxs)("button",{className:"im-c-map-styles__button",onClick:function(){return t=e,p.emit(m.MAP_SET_SIZE,t),void p.emit(m.MAP_SET_PIXEL_RATIO,window.devicePixelRatio*c[t]);var t},"aria-pressed":e===a,children:[(0,n.jsx)("div",{className:"im-c-map-styles__image",children:(0,n.jsxs)("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fillRule:"evenodd",children:[(0,n.jsx)("rect",{className:"im-c-map-styles__image-bg",width:"100%",height:"100%"}),(0,n.jsx)("g",{style:{transform:"scale(".concat(c[e],")"),transformOrigin:"8px 52px"},children:(0,n.jsx)("path",{d:"M8 51.785L12.948 38.9h1.837l5.274 12.885h-1.943l-1.503-3.903h-5.387l-1.415 3.903H8zm3.718-5.291h4.368l-1.345-3.569-.914-2.671c-.164.826-.395 1.646-.694 2.46l-1.415 3.78zm15.592 4.139c-3.698 3.143-7.836.271-6.315-2.562.963-1.794 5.529-1.982 6.183-2.21.022-.825.052-2.27-2.241-2.312-1.751-.031-2.242 1.025-2.435 1.776l-1.547-.211c.234-1.102.963-2.856 4.21-2.874 4.037-.022 3.612 2.962 3.612 3.524v2.11c0 .315 0 3.012.501 3.911h-1.652c-.164-.328-.27-.712-.316-1.152zm-.132-3.533c-.907.37-3.444.694-3.964.914-1.293.548-.911 2.399.225 2.637.639.134 3.739.476 3.739-2.971v-.58z"})})]})}),e[0].toUpperCase()+e.slice(1)]})},e)})})]})]})}}],buttons:[{id:"mapStyles",label:"Styles",panelId:"mapStyles",iconId:"map",mobile:{slot:"top-left",showLabel:!1},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"map",svgContent:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>'}]}}};
@@ -0,0 +1,2 @@
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ import*as e from"react";import*as t from"react/jsx-runtime";var r,n,o={react(t,r,n){var o,i;t.exports=(o={createContext:()=>e.createContext,useContext:()=>e.useContext,useEffect:()=>e.useEffect},i={},n.d(i,o),i)},"react/jsx-runtime"(e,r,n){var o,i;e.exports=(o={Fragment:()=>t.Fragment,jsx:()=>t.jsx,jsxs:()=>t.jsxs},i={},n.d(i,o),i)}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,a),r.exports}a.m=o,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,r)=>(a.f[r](e,t),t),[])),a.u=e=>"../esm/"+e+".js",a.miniCssF=e=>{},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e+"../css/"})(),r={index:0},n=e=>{var t,n,{__webpack_esm_ids__:o,__webpack_esm_modules__:i,__webpack_esm_runtime__:u}=e,c=0;for(t in i)a.o(i,t)&&(a.m[t]=i[t]);for(u&&u(a);c<o.length;c++)n=o[c],a.o(r,n)&&r[n]&&r[n][0](),r[o[c]]=0},a.f.j=(e,t)=>{var o=a.o(r,e)?r[e]:void 0;if(0!==o)if(o)t.push(o[1]);else{var i=import("../css/"+a.u(e)).then(n,t=>{throw 0!==r[e]&&(r[e]=void 0),t});i=Promise.race([i,new Promise(t=>o=r[e]=[t])]),t.push(o[1]=i)}};var u={};function c(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof u?n:u,f=Object.create(c.prototype);return s(f,"_invoke",function(r,n,o){var i,u,c,s=0,f=o||[],p=!1,l={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,r){return i=t,u=0,c=e,l.n=r,a}};function m(r,n){for(u=r,c=n,t=0;!p&&s&&!o&&t<f.length;t++){var o,i=f[t],m=l.p,v=i[2];r>3?(o=v===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=m&&((o=r<2&&m<i[1])?(u=0,l.v=n,l.n=i[1]):m<v&&(o=r<3||i[0]>n||n>v)&&(i[4]=r,i[5]=n,l.n=v,u=0))}if(o||r>1)return a;throw p=!0,n}return function(o,f,v){if(s>1)throw TypeError("Generator is already running");for(p&&1===f&&m(f,v),u=f,c=v;(t=u<2?e:c)||!p;){i||(u?u<3?(u>1&&(l.n=-1),m(u,c)):l.n=c:l.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(p=l.n<0)?c:r.call(n,l))!==a)break}catch(t){i=e,u=1,c=t}finally{s=1}}return{value:t,done:p}}}(r,o,i),!0),f}var a={};function u(){}function f(){}function p(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(s(t={},n,function(){return this}),t),m=p.prototype=u.prototype=Object.create(l);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e}return f.prototype=p,s(m,"constructor",p),s(p,"constructor",f),f.displayName="GeneratorFunction",s(p,o,"GeneratorFunction"),s(m),s(m,o,"Generator"),s(m,n,function(){return this}),s(m,"toString",function(){return"[object Generator]"}),(c=function(){return{w:i,m:v}})()}function s(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}s=function(e,t,r,n){function i(t,r){s(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},s(e,t,r,n)}function f(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function p(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:"mapStyles",manifest:r.manifest,mapStyles:r.mapStyles,load:(e=c().m(function e(){var t;return c().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,a.e("im-map-styles-plugin").then(a.bind(a,"./plugins/beta/map-styles/src/manifest.js"));case 1:return t=e.v.manifest,e.a(2,t)}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){f(i,n,o,a,u,"next",e)}function u(e){f(i,n,o,a,u,"throw",e)}a(void 0)})},function(){return t.apply(this,arguments)}),handlesMapStyle:!0,api:{}}}a.d(u,{A:()=>p});const l=u.A;export{l as default};
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[657],{860(e,t,i){i.r(t),i.d(t,{manifest:()=>p});var s=i(738),r=i(287);new Set,new Set;function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,s)}return i}function l(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?a(Object(i),!0).forEach(function(t){o(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):a(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function o(e,t,i){return(t=function(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var c={slot:"middle",initiallyOpen:!1,dismissable:!0,modal:!0},m=(l({},c),l(l({},c),{},{width:"500px"}),l(l({},c),{},{width:"500px"}),{small:1,medium:1.5,large:2}),p={InitComponent:function(e){var t=e.pluginConfig,i=e.services,n=i.events,a=i.eventBus,l=function(){a.emit(n.MAP_INIT_MAP_STYLES,t.mapStyles)};return(0,s.useEffect)(function(){return a.on(n.APP_READY,l),function(){return a.off(n.APP_READY,l)}},[]),(0,r.jsx)(r.Fragment,{})},panels:[{id:"mapStyles",label:"Map styles",mobile:{slot:"bottom",modal:!0,dismissable:!0},tablet:{slot:"inset",modal:!0,width:"400px",dismissable:!0},desktop:{slot:"inset",modal:!0,width:"400px",dismissable:!0},render:function(e){var t=e.mapState,i=e.pluginConfig,s=e.services,n=e.mapProvider,a=t.mapStyle,l=t.mapSize,o=i.mapStyles,c=s.events,p=s.eventBus,d=n.capabilities.supportsMapSizes;return(0,r.jsxs)("div",{className:"im-c-map-styles",children:[(0,r.jsx)("div",{className:"im-c-map-styles__group",children:(0,r.jsx)("div",{className:"im-c-map-styles__inner",children:o.filter(function(e){return e.url}).map(function(e){return(0,r.jsx)("div",{className:"im-c-map-styles__item",children:(0,r.jsxs)("button",{className:"im-c-map-styles__button","aria-pressed":e.id===a.id,onClick:function(){return t=e,void p.emit(c.MAP_SET_STYLE,t);var t},children:[(0,r.jsx)("div",{className:"im-c-map-styles__image",children:(0,r.jsx)("img",{src:e.thumbnail||void 0,alt:"",height:"60",width:"60"})}),e.label]})},e.id)})})}),d&&(0,r.jsxs)("div",{className:"im-c-map-styles__group",children:[(0,r.jsx)("h3",{className:"im-c-map-styles__heading",id:"map-text-sizes",children:"Map size"}),(0,r.jsx)("div",{className:"im-c-map-styles__inner",children:["small","medium","large"].map(function(e){return(0,r.jsx)("div",{className:"im-c-map-styles__item",children:(0,r.jsxs)("button",{className:"im-c-map-styles__button",onClick:function(){return t=e,p.emit(c.MAP_SET_SIZE,t),void p.emit(c.MAP_SET_PIXEL_RATIO,window.devicePixelRatio*m[t]);var t},"aria-pressed":e===l,children:[(0,r.jsx)("div",{className:"im-c-map-styles__image",children:(0,r.jsxs)("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fillRule:"evenodd",children:[(0,r.jsx)("rect",{className:"im-c-map-styles__image-bg",width:"100%",height:"100%"}),(0,r.jsx)("g",{style:{transform:"scale(".concat(m[e],")"),transformOrigin:"8px 52px"},children:(0,r.jsx)("path",{d:"M8 51.785L12.948 38.9h1.837l5.274 12.885h-1.943l-1.503-3.903h-5.387l-1.415 3.903H8zm3.718-5.291h4.368l-1.345-3.569-.914-2.671c-.164.826-.395 1.646-.694 2.46l-1.415 3.78zm15.592 4.139c-3.698 3.143-7.836.271-6.315-2.562.963-1.794 5.529-1.982 6.183-2.21.022-.825.052-2.27-2.241-2.312-1.751-.031-2.242 1.025-2.435 1.776l-1.547-.211c.234-1.102.963-2.856 4.21-2.874 4.037-.022 3.612 2.962 3.612 3.524v2.11c0 .315 0 3.012.501 3.911h-1.652c-.164-.328-.27-.712-.316-1.152zm-.132-3.533c-.907.37-3.444.694-3.964.914-1.293.548-.911 2.399.225 2.637.639.134 3.739.476 3.739-2.971v-.58z"})})]})}),e[0].toUpperCase()+e.slice(1)]})},e)})})]})]})}}],buttons:[{id:"mapStyles",label:"Styles",panelId:"mapStyles",iconId:"map",mobile:{slot:"top-left",showLabel:!1},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"map",svgContent:'<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"/><path d="M15 5.764v15"/><path d="M9 3.236v15"/>'}]}}}]);
@@ -0,0 +1,2 @@
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.mapStylesPlugin=t())}(this,()=>(()=>{"use strict";var e,t,r={738(e){e.exports=preactCompat},287(e){e.exports=preactJsxRuntime}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.m=r,o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((t,r)=>(o.f[r](e,t),t),[])),o.u=e=>"im-map-styles-plugin.js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="defra.mapStylesPlugin:",o.l=(r,n,a,i)=>{if(e[r])e[r].push(n);else{var u,c;if(void 0!==a)for(var f=document.getElementsByTagName("script"),p=0;p<f.length;p++){var l=f[p];if(l.getAttribute("src")==r||l.getAttribute("data-webpack")==t+a){u=l;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",o.nc&&u.setAttribute("nonce",o.nc),u.setAttribute("data-webpack",t+a),u.src=r),e[r]=[n];var s=(t,n)=>{u.onerror=u.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(n)),t)return t(n)},d=setTimeout(s.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=s.bind(null,u.onerror),u.onload=s.bind(null,u.onload),c&&document.head.appendChild(u)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={57:0};o.f.j=(t,r)=>{var n=o.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=a);var i=o.p+o.u(t),u=new Error;o.l(i,r=>{if(o.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;u.message="Loading chunk "+t+" failed.\n("+a+": "+i+")",u.name="ChunkLoadError",u.type=a,u.request=i,n[1](u)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,a,[i,u,c]=r,f=0;if(i.some(t=>0!==e[t])){for(n in u)o.o(u,n)&&(o.m[n]=u[n]);c&&c(o)}for(t&&t(r);f<i.length;f++)a=i[f],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0},r=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};function i(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var i=n&&n.prototype instanceof f?n:f,p=Object.create(i.prototype);return u(p,"_invoke",function(r,n,o){var a,i,u,f=0,p=o||[],l=!1,s={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,i=0,u=e,s.n=r,c}};function d(r,n){for(i=r,u=n,t=0;!l&&f&&!o&&t<p.length;t++){var o,a=p[t],d=s.p,v=a[2];r>3?(o=v===n)&&(u=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=r<2&&d<a[1])?(i=0,s.v=n,s.n=a[1]):d<v&&(o=r<3||a[0]>n||n>v)&&(a[4]=r,a[5]=n,s.n=v,i=0))}if(o||r>1)return c;throw l=!0,n}return function(o,p,v){if(f>1)throw TypeError("Generator is already running");for(l&&1===p&&d(p,v),i=p,u=v;(t=i<2?e:u)||!l;){a||(i?i<3?(i>1&&(s.n=-1),d(i,u)):s.n=u:s.v=u);try{if(f=2,a){if(i||(o="next"),t=a[o]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,i<2&&(i=0)}else 1===i&&(t=a.return)&&t.call(a),i<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),i=1);a=e}else if((t=(l=s.n<0)?u:r.call(n,s))!==c)break}catch(t){a=e,i=1,u=t}finally{f=1}}return{value:t,done:l}}}(r,o,a),!0),p}var c={};function f(){}function p(){}function l(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(u(t={},n,function(){return this}),t),d=l.prototype=f.prototype=Object.create(s);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,u(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return p.prototype=l,u(d,"constructor",l),u(l,"constructor",p),p.displayName="GeneratorFunction",u(l,o,"GeneratorFunction"),u(d),u(d,o,"Generator"),u(d,n,function(){return this}),u(d,"toString",function(){return"[object Generator]"}),(i=function(){return{w:a,m:v}})()}function u(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}u=function(e,t,r,n){function a(t,r){u(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},u(e,t,r,n)}function c(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function f(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:"mapStyles",manifest:r.manifest,mapStyles:r.mapStyles,load:(e=i().m(function e(){var t;return i().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o.e(657).then(o.bind(o,860));case 1:return t=e.v.manifest,e.a(2,t)}},e)}),t=function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){c(a,n,o,i,u,"next",e)}function u(e){c(a,n,o,i,u,"throw",e)}i(void 0)})},function(){return t.apply(this,arguments)}),handlesMapStyle:!0,api:{}}}return o.d(a,{default:()=>f}),a.default})());
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import { textSizeSvgPath } from './config.js'
3
- import { scaleFactor } from '../../../src/config/appConfig.js'
3
+ import { scaleFactor } from '../../../../src/config/appConfig.js'
4
4
 
5
5
  export const MapStyles = ({ mapState, pluginConfig, services, mapProvider }) => {
6
6
  const { mapStyle: currentMapStyle, mapSize: currentMapSize } = mapState
@@ -14,13 +14,13 @@ export const manifest = {
14
14
  dismissable: true
15
15
  },
16
16
  tablet: {
17
- slot: 'map-styles-button',
17
+ slot: 'inset',
18
18
  modal: true,
19
19
  width: '400px',
20
20
  dismissable: true
21
21
  },
22
22
  desktop: {
23
- slot: 'map-styles-button',
23
+ slot: 'inset',
24
24
  modal: true,
25
25
  width: '400px',
26
26
  dismissable: true
@@ -30,22 +30,20 @@ export const manifest = {
30
30
 
31
31
  buttons: [{
32
32
  id: 'mapStyles',
33
- label: 'Map styles',
33
+ label: 'Styles',
34
34
  panelId: 'mapStyles',
35
35
  iconId: 'map',
36
36
  mobile: {
37
- slot: 'right-top',
37
+ slot: 'top-left',
38
38
  showLabel: false
39
39
  },
40
40
  tablet: {
41
- slot: 'right-top',
42
- showLabel: false,
43
- order: 1
41
+ slot: 'top-left',
42
+ showLabel: true
44
43
  },
45
44
  desktop: {
46
- slot: 'right-top',
47
- showLabel: false,
48
- order: 1
45
+ slot: 'top-left',
46
+ showLabel: true
49
47
  }
50
48
  }],
51
49
 
@@ -70,7 +70,10 @@
70
70
  .im-c-map-styles__image::after {
71
71
  content: '';
72
72
  position: absolute;
73
- inset: (-3px);
73
+ top: -3px;
74
+ right: -3px;
75
+ bottom: -3px;
76
+ left: -3px;
74
77
  outline: 3px solid var(--focus-outline-color);
75
78
  border: 3px solid var(--focus-border-color);
76
79
  }
@@ -0,0 +1 @@
1
+ export const __webpack_esm_id__="im-scale-bar-plugin";export const __webpack_esm_ids__=["im-scale-bar-plugin"];export const __webpack_esm_modules__={"./plugins/beta/scale-bar/src/manifest.js"(r,t,a){a.d(t,{manifest:()=>s}),a.r(t);var e=a("react");function n(r,t){(null==t||t>r.length)&&(t=r.length);for(var a=0,e=Array(t);a<t;a++)e[a]=r[a];return e}var l={small:1,medium:1.5,large:2},i={metric:[{threshold:1,abbr:"m",abbrPlural:"m",unit:"metre",unitPlural:"metres",factor:1},{threshold:1e3,abbr:"km",abbrPlural:"km",unit:"kilometre",unitPlural:"kilometres",factor:.001}],imperial:[{threshold:1609.344,abbr:"mi",abbrPlural:"mi",unit:"mile",unitPlural:"miles",factor:1/1609.344},{threshold:.9144,abbr:"yd",abbrPlural:"yds",unit:"yard",unitPlural:"yards",factor:1/.9144},{threshold:.3048,abbr:"ft",abbrPlural:"ft",unit:"foot",unitPlural:"feet",factor:1/.3048}]},o=function(r){var t=Math.pow(10,Math.floor(Math.log10(r))),a=r/t;return(a>=10?10:a>=5?5:a>=3?3:a>=2?2:1)*t},u=a("react/jsx-runtime"),s={controls:[{id:"scaleBar",label:"Scale bar",mobile:{slot:"footer-right"},tablet:{slot:"footer-right"},desktop:{slot:"footer-right"},render:function(r){var t=r.mapState,a=r.pluginConfig,s=t.resolution,b=t.mapSize,c=(0,e.useRef)(null),f=(0,e.useMemo)(function(){return s?function(r,t,a,e){var u,s=r/l[e],b=120*s,c=i[a],f=function(r,t){var a="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!a){if(Array.isArray(r)||(a=function(r,t){if(r){if("string"==typeof r)return n(r,t);var a={}.toString.call(r).slice(8,-1);return"Object"===a&&r.constructor&&(a=r.constructor.name),"Map"===a||"Set"===a?Array.from(r):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?n(r,t):void 0}}(r))||t&&r&&"number"==typeof r.length){a&&(r=a);var e=0,l=function(){};return{s:l,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:l}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,u=!1;return{s:function(){a=a.call(r)},n:function(){var r=a.next();return o=r.done,r},e:function(r){u=!0,i=r},f:function(){try{o||null==a.return||a.return()}finally{if(u)throw i}}}}(c);try{for(f.s();!(u=f.n()).done;){var m=u.value,d=m.abbr,h=m.abbrPlural,p=m.unit,y=m.unitPlural,v=m.factor,_=o(b*v);if(_>=1&&_<1e3){var g=_/v/s;if(g<=120)return{label:_,abbr:_>1?h:d,width:g,unit:_>1?y:p}}}}catch(r){f.e(r)}finally{f.f()}var P=c[c.length-1],w=b*P.factor,x=o(w),j=x>1?P.abbrPlural:P.abbr,S=x>1?P.abbrPlural:P.abbr;return{label:x,abbr:j,width:x/P.factor/s,unit:S}}(s/1,0,a.units,b):{width:0,label:"",abbr:"",unit:""}},[s,b,a.units]);return(0,u.jsx)("div",{className:"im-c-scale-bar",ref:c,style:{width:"".concat(f.width,"px")},children:(0,u.jsxs)("span",{className:"im-c-scale-bar__label",children:[(0,u.jsx)("span",{className:"im-u-visually-hidden",children:"Scale bar: "}),f.label,(0,u.jsx)("span",{"aria-hidden":"true",children:f.abbr}),(0,u.jsx)("span",{className:"im-u-visually-hidden",children:f.unit})]})})}}]}}};