@defra/interactive-map 0.0.55-alpha → 0.0.56-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 (394) hide show
  1. package/assets/templates/style-switcher.njk +2 -2
  2. package/dist/esm/im-core.js +1 -1
  3. package/dist/esm/im-shell.js +1 -1
  4. package/dist/umd/im-core.js +1 -1
  5. package/dist/umd/index.js +1 -1
  6. package/docs/api/context.md +2 -0
  7. package/docs/api.md +17 -1
  8. package/docs/architecture/interactive-map.likec4 +4 -4
  9. package/docs/plugins/datasets.md +11 -0
  10. package/docs/plugins/draw.md +8 -2
  11. package/docs/plugins/interact.md +24 -1
  12. package/docs/plugins/search.md +2 -2
  13. package/docusaurus.config.cjs +25 -3
  14. package/govuk-prototype-kit.config.json +6 -7
  15. package/package.json +20 -23
  16. package/plugins/datasets/dist/esm/im-datasets-esri-adapter.js +1 -1
  17. package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
  18. package/plugins/datasets/dist/esm/im-datasets-ol-adapter.js +1 -1
  19. package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
  20. package/plugins/datasets/dist/esm/index.js +1 -1
  21. package/plugins/datasets/dist/esm/mapboxStyleLayerAdapter.js +1 -1
  22. package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
  23. package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
  24. package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
  25. package/plugins/datasets/dist/umd/index.js +1 -1
  26. package/plugins/datasets/src/adapters/esri/esriLayerAdapter.js +18 -16
  27. package/plugins/datasets/src/adapters/esri/esriLayerAdapter.test.js +2 -2
  28. package/plugins/datasets/src/adapters/esri/registry/esriDataset.js +2 -3
  29. package/plugins/datasets/src/adapters/esri/registry/esriDataset.test.js +1 -1
  30. package/plugins/datasets/src/adapters/loadLayerAdapter.js +2 -20
  31. package/plugins/datasets/src/adapters/loadLayerAdapter.test.js +9 -9
  32. package/plugins/datasets/src/adapters/mapboxStyleLayerAdapter.js +7 -7
  33. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +19 -19
  34. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +1 -1
  35. package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +1 -1
  36. package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.test.js +2 -2
  37. package/plugins/datasets/src/adapters/openlayers/layerBuilders.test.js +1 -1
  38. package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.js +21 -21
  39. package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.test.js +5 -5
  40. package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.js +2 -3
  41. package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.test.js +2 -2
  42. package/plugins/datasets/src/api/getOpacity.js +1 -2
  43. package/plugins/datasets/src/api/getOpacity.test.js +9 -12
  44. package/plugins/datasets/src/api/getStyle.js +1 -2
  45. package/plugins/datasets/src/api/getStyle.test.js +5 -8
  46. package/plugins/datasets/src/api/removeDataset.js +2 -4
  47. package/plugins/datasets/src/api/removeDataset.test.js +5 -10
  48. package/plugins/datasets/src/api/setData.js +2 -4
  49. package/plugins/datasets/src/api/setData.test.js +6 -14
  50. package/plugins/datasets/src/api/setFeatureVisibility.js +1 -2
  51. package/plugins/datasets/src/api/setFeatureVisibility.test.js +8 -11
  52. package/plugins/datasets/src/components/LayersMenu/LayersMenu.jsx +1 -0
  53. package/plugins/datasets/src/components/LayersMenu/LayersMenuCheckbox.jsx +1 -3
  54. package/plugins/datasets/src/components/LayersMenu/LayersMenuCheckbox.test.jsx +13 -18
  55. package/plugins/datasets/src/index.js +2 -2
  56. package/plugins/datasets/src/index.test.js +8 -1
  57. package/plugins/datasets/src/initialise/DatasetsInit.jsx +48 -26
  58. package/plugins/datasets/src/initialise/DatasetsInit.test.jsx +160 -89
  59. package/plugins/datasets/src/initialise/initialiseDatasets.js +2 -3
  60. package/plugins/datasets/src/initialise/initialiseDatasets.test.js +23 -10
  61. package/plugins/datasets/src/manifest.js +53 -44
  62. package/plugins/datasets/src/manifest.test.js +36 -4
  63. package/plugins/datasets/src/reducers/pluginState.js +5 -5
  64. package/plugins/datasets/src/reducers/pluginState.test.js +21 -20
  65. package/plugins/datasets/src/registry/__mocks__/datasetRegistry.js +7 -6
  66. package/plugins/datasets/src/registry/createDataset.js +2 -2
  67. package/plugins/datasets/src/registry/dataset.js +9 -10
  68. package/plugins/datasets/src/registry/dataset.test.js +63 -64
  69. package/plugins/datasets/src/registry/datasetRegistry.js +39 -10
  70. package/plugins/datasets/src/registry/datasetRegistry.test.js +83 -1
  71. package/plugins/datasets/src/registry/globalDataset.js +9 -17
  72. package/plugins/datasets/src/registry/isVisibleWhen.js +9 -17
  73. package/plugins/datasets/src/registry/isVisibleWhen.test.js +27 -20
  74. package/plugins/datasets/src/registry/mapboxStyleDataset.test.js +26 -27
  75. package/plugins/datasets/src/utils/hasLayersMenu.js +13 -0
  76. package/plugins/datasets/src/utils/hasLayersMenu.test.js +25 -0
  77. package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
  78. package/plugins/draw/dist/esm/index.js +1 -1
  79. package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
  80. package/plugins/draw/dist/umd/index.js +1 -1
  81. package/plugins/draw/src/DrawInit.jsx +47 -26
  82. package/plugins/draw/src/DrawInit.test.jsx +90 -2
  83. package/plugins/draw/src/adapters/openlayers/core/styles.test.js +1 -1
  84. package/plugins/draw/src/adapters/openlayers/point/pointSymbolImages.test.js +1 -1
  85. package/plugins/draw/src/manifest.js +3 -2
  86. package/plugins/draw/src/manifest.test.js +13 -1
  87. package/plugins/draw/src/utils/needsDrawTarget.js +22 -0
  88. package/plugins/draw/src/utils/needsDrawTarget.test.js +42 -0
  89. package/plugins/draw-es/dist/esm/index.js +1 -0
  90. package/plugins/{beta/draw-es → draw-es}/src/DrawInit.jsx +1 -1
  91. package/plugins/{beta/draw-es → draw-es}/src/events.test.js +1 -1
  92. package/plugins/{beta/draw-es → draw-es}/src/graphic.js +1 -1
  93. package/plugins/frame/dist/esm/index.js +1 -0
  94. package/plugins/{beta/frame → frame}/dist/umd/im-frame-plugin.js +1 -1
  95. package/plugins/{beta/frame → frame}/dist/umd/index.js +1 -1
  96. package/plugins/{beta/frame → frame}/package.json +2 -2
  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 +3 -3
  102. package/plugins/interact/src/api/enable.test.js +13 -0
  103. package/plugins/interact/src/defaults.js +1 -0
  104. package/plugins/interact/src/hooks/useCrossHairVisibility.js +27 -17
  105. package/plugins/interact/src/hooks/useCrossHairVisibility.test.js +72 -7
  106. package/plugins/interact/src/manifest.js +4 -4
  107. package/plugins/interact/src/manifest.test.js +29 -0
  108. package/plugins/interact/src/reducer.js +7 -2
  109. package/plugins/interact/src/reducer.test.js +12 -2
  110. package/plugins/interact/src/utils/needsTarget.js +20 -0
  111. package/plugins/interact/src/utils/needsTarget.test.js +36 -0
  112. package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
  113. package/plugins/map-key/dist/esm/index.js +1 -1
  114. package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
  115. package/plugins/map-key/dist/umd/index.js +1 -1
  116. package/plugins/map-key/src/components/Key/KeySvgSymbol.jsx +4 -0
  117. package/plugins/map-key/src/components/Key/MapKey.jsx +15 -15
  118. package/plugins/map-key/src/components/Key/MapKey.test.jsx +29 -15
  119. package/plugins/map-key/src/initialise/MapKeyInit.jsx +5 -8
  120. package/plugins/map-key/src/initialise/MapKeyInit.test.jsx +9 -7
  121. package/plugins/map-key/src/manifest.test.js +0 -1
  122. package/plugins/map-key/src/reducers/mergeKeyGroupItems.js +14 -33
  123. package/plugins/map-key/src/reducers/mergeKeyGroupItems.test.js +34 -50
  124. package/plugins/map-key/src/reducers/pluginState.js +6 -1
  125. package/plugins/map-key/src/reducers/pluginState.test.js +13 -4
  126. package/plugins/map-styles/dist/esm/index.js +1 -0
  127. package/plugins/{beta/map-styles → map-styles}/dist/umd/im-map-styles-plugin.js +1 -1
  128. package/plugins/{beta/map-styles → map-styles}/dist/umd/index.js +1 -1
  129. package/plugins/{beta/map-styles → map-styles}/src/MapStyles.jsx +2 -2
  130. package/plugins/{beta/map-styles → map-styles}/src/MapStylesInit.jsx +1 -1
  131. package/plugins/menu/dist/esm/index.js +1 -1
  132. package/plugins/scale-bar/dist/esm/index.js +1 -0
  133. package/plugins/{beta/scale-bar → scale-bar}/dist/umd/im-scale-bar-plugin.js +1 -1
  134. package/plugins/{beta/scale-bar → scale-bar}/dist/umd/index.js +1 -1
  135. package/plugins/{beta/scale-bar → scale-bar}/package.json +2 -2
  136. package/plugins/search/dist/esm/im-search-plugin.js +1 -1
  137. package/plugins/search/dist/esm/index.js +1 -1
  138. package/plugins/search/dist/umd/im-search-plugin.js +1 -1
  139. package/plugins/search/dist/umd/index.js +1 -1
  140. package/plugins/search/src/components/Suggestions/Suggestions.jsx +3 -1
  141. package/plugins/search/src/components/Suggestions/Suggestions.test.jsx +11 -0
  142. package/plugins/search/src/utils/markedToElements.jsx +25 -0
  143. package/plugins/search/src/utils/markedToElements.test.jsx +49 -0
  144. package/plugins/search/src/utils/parseOsNamesResults.js +6 -4
  145. package/plugins/search/src/utils/parseOsNamesResults.test.js +18 -0
  146. package/plugins/use-location/dist/esm/index.js +1 -0
  147. package/plugins/{beta/use-location → use-location}/dist/umd/im-use-location-plugin.js +1 -1
  148. package/plugins/{beta/use-location → use-location}/dist/umd/index.js +1 -1
  149. package/providers/esri/dist/esm/index.js +1 -0
  150. package/providers/{beta/esri → esri}/src/esriProvider.js +1 -1
  151. package/providers/{beta/esri → esri}/src/mapEvents.js +2 -2
  152. package/providers/maplibre/dist/esm/index.js +1 -1
  153. package/providers/open-names/dist/esm/index.js +1 -0
  154. package/providers/{beta/open-names → open-names}/dist/umd/im-reverse-geocode.js +1 -1
  155. package/providers/{beta/open-names → open-names}/dist/umd/index.js +1 -1
  156. package/providers/openlayers/dist/esm/index.js +1 -0
  157. package/providers/openlayers/dist/umd/im-openlayers-provider.js +2 -0
  158. package/providers/{beta/openlayers → openlayers}/dist/umd/index.js +1 -1
  159. package/providers/{beta/openlayers → openlayers}/src/index.js +4 -4
  160. package/providers/{beta/openlayers → openlayers}/src/mapEvents.js +2 -2
  161. package/providers/{beta/openlayers → openlayers}/src/mapEvents.test.js +2 -2
  162. package/providers/{beta/openlayers → openlayers}/src/openlayersProvider.js +3 -3
  163. package/providers/{beta/openlayers → openlayers}/src/utils/highlightFeatures.js +1 -1
  164. package/providers/{beta/openlayers → openlayers}/src/utils/patternImages.js +1 -1
  165. package/providers/{beta/openlayers → openlayers}/src/utils/symbolImages.js +1 -1
  166. package/rollup.esm.mjs +43 -47
  167. package/sonar-project.properties +1 -1
  168. package/src/App/App.jsx +4 -1
  169. package/src/App/App.test.jsx +6 -0
  170. package/src/App/renderer/PluginInits.jsx +8 -7
  171. package/src/App/renderer/PluginInits.test.jsx +20 -5
  172. package/src/App/renderer/SlotItemsProvider.jsx +33 -0
  173. package/src/App/renderer/SlotItemsProvider.test.jsx +59 -0
  174. package/src/App/renderer/SlotRenderer.jsx +3 -14
  175. package/src/App/renderer/SlotRenderer.test.jsx +11 -44
  176. package/src/App/renderer/mapButtons.js +22 -11
  177. package/src/App/renderer/mapButtons.test.js +23 -1
  178. package/src/App/renderer/mapControls.js +6 -8
  179. package/src/App/renderer/mapControls.test.js +10 -0
  180. package/src/App/renderer/mapPanels.js +16 -19
  181. package/src/App/renderer/mapPanels.test.js +37 -9
  182. package/src/App/renderer/pluginWrapper.js +10 -8
  183. package/src/App/renderer/pluginWrapper.test.js +23 -9
  184. package/src/App/renderer/slotAggregator.js +18 -5
  185. package/src/App/renderer/slotAggregator.test.js +68 -25
  186. package/src/App/renderer/slotHelpers.js +13 -0
  187. package/src/App/renderer/slotHelpers.test.js +16 -1
  188. package/src/App/store/AppProvider.jsx +19 -1
  189. package/src/App/store/AppProvider.test.jsx +41 -0
  190. package/src/App/store/appActionsMap.js +10 -1
  191. package/src/App/store/appActionsMap.test.js +21 -0
  192. package/src/App/store/appDispatchMiddleware.js +29 -17
  193. package/src/App/store/appDispatchMiddleware.test.js +31 -0
  194. package/src/InteractiveMap/parseDataProperties.js +4 -4
  195. package/src/InteractiveMap/parseDataProperties.test.js +62 -6
  196. package/src/config/events.js +4 -2
  197. package/src/scss/tools/_govuk-content.scss +4 -3
  198. package/webpack.dev.mjs +9 -3
  199. package/webpack.prod.mjs +11 -4
  200. package/webpack.umd.mjs +6 -7
  201. package/plugins/beta/draw-es/dist/esm/index.js +0 -1
  202. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +0 -1
  203. package/plugins/beta/draw-ml/dist/esm/index.js +0 -1
  204. package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +0 -1
  205. package/plugins/beta/draw-ml/dist/umd/index.js +0 -2
  206. package/plugins/beta/draw-ml/src/DrawInit.jsx +0 -85
  207. package/plugins/beta/draw-ml/src/api/addFeature.js +0 -27
  208. package/plugins/beta/draw-ml/src/api/deleteFeature.js +0 -13
  209. package/plugins/beta/draw-ml/src/api/editFeature.js +0 -75
  210. package/plugins/beta/draw-ml/src/api/merge.js +0 -9
  211. package/plugins/beta/draw-ml/src/api/newLine.js +0 -68
  212. package/plugins/beta/draw-ml/src/api/newPolygon.js +0 -68
  213. package/plugins/beta/draw-ml/src/api/split.js +0 -81
  214. package/plugins/beta/draw-ml/src/defaults.js +0 -17
  215. package/plugins/beta/draw-ml/src/draw.scss +0 -26
  216. package/plugins/beta/draw-ml/src/events.js +0 -185
  217. package/plugins/beta/draw-ml/src/index.js +0 -13
  218. package/plugins/beta/draw-ml/src/manifest.js +0 -110
  219. package/plugins/beta/draw-ml/src/mapboxDraw.js +0 -143
  220. package/plugins/beta/draw-ml/src/mapboxSnap.js +0 -321
  221. package/plugins/beta/draw-ml/src/modes/createDrawMode.js +0 -552
  222. package/plugins/beta/draw-ml/src/modes/disabledMode.js +0 -23
  223. package/plugins/beta/draw-ml/src/modes/drawLineMode.js +0 -18
  224. package/plugins/beta/draw-ml/src/modes/drawPolygonMode.js +0 -16
  225. package/plugins/beta/draw-ml/src/modes/editVertex/geometryHelpers.js +0 -135
  226. package/plugins/beta/draw-ml/src/modes/editVertex/helpers.js +0 -2
  227. package/plugins/beta/draw-ml/src/modes/editVertex/touchHandlers.js +0 -142
  228. package/plugins/beta/draw-ml/src/modes/editVertex/undoHandlers.js +0 -133
  229. package/plugins/beta/draw-ml/src/modes/editVertex/vertexOperations.js +0 -142
  230. package/plugins/beta/draw-ml/src/modes/editVertex/vertexQueries.js +0 -121
  231. package/plugins/beta/draw-ml/src/modes/editVertexMode.js +0 -495
  232. package/plugins/beta/draw-ml/src/reducer.js +0 -90
  233. package/plugins/beta/draw-ml/src/styles.js +0 -190
  234. package/plugins/beta/draw-ml/src/undoStack.js +0 -50
  235. package/plugins/beta/draw-ml/src/utils/debounce.js +0 -16
  236. package/plugins/beta/draw-ml/src/utils/flattenStyleProperties.js +0 -49
  237. package/plugins/beta/draw-ml/src/utils/snapHelpers.js +0 -200
  238. package/plugins/beta/draw-ml/src/utils/spatial.js +0 -258
  239. package/plugins/beta/draw-ol/dist/css/index.css +0 -1
  240. package/plugins/beta/draw-ol/dist/esm/DrawMode.js +0 -1
  241. package/plugins/beta/draw-ol/dist/esm/EditMode.js +0 -1
  242. package/plugins/beta/draw-ol/dist/esm/geometryHelpers.js +0 -1
  243. package/plugins/beta/draw-ol/dist/esm/im-draw-ol-plugin.js +0 -1
  244. package/plugins/beta/draw-ol/dist/esm/index.js +0 -1
  245. package/plugins/beta/draw-ol/src/DrawInit.jsx +0 -65
  246. package/plugins/beta/draw-ol/src/api/addFeature.js +0 -29
  247. package/plugins/beta/draw-ol/src/api/deleteFeature.js +0 -11
  248. package/plugins/beta/draw-ol/src/api/editFeature.js +0 -50
  249. package/plugins/beta/draw-ol/src/api/newLine.js +0 -44
  250. package/plugins/beta/draw-ol/src/api/newPolygon.js +0 -44
  251. package/plugins/beta/draw-ol/src/core/OLDrawManager.js +0 -153
  252. package/plugins/beta/draw-ol/src/core/featureStore.js +0 -65
  253. package/plugins/beta/draw-ol/src/core/styles.js +0 -98
  254. package/plugins/beta/draw-ol/src/core/undoStack.js +0 -31
  255. package/plugins/beta/draw-ol/src/defaults.js +0 -16
  256. package/plugins/beta/draw-ol/src/draw/DrawMode.js +0 -121
  257. package/plugins/beta/draw-ol/src/draw/drawInput.js +0 -243
  258. package/plugins/beta/draw-ol/src/draw.scss +0 -17
  259. package/plugins/beta/draw-ol/src/edit/EditMode.js +0 -424
  260. package/plugins/beta/draw-ol/src/edit/keyboardHandler.js +0 -229
  261. package/plugins/beta/draw-ol/src/edit/midpointLayer.js +0 -57
  262. package/plugins/beta/draw-ol/src/edit/touchHandler.js +0 -171
  263. package/plugins/beta/draw-ol/src/edit/undoOps.js +0 -95
  264. package/plugins/beta/draw-ol/src/edit/vertexHitTest.js +0 -72
  265. package/plugins/beta/draw-ol/src/edit/vertexLayer.js +0 -49
  266. package/plugins/beta/draw-ol/src/edit/vertexOps.js +0 -99
  267. package/plugins/beta/draw-ol/src/events.js +0 -114
  268. package/plugins/beta/draw-ol/src/index.js +0 -12
  269. package/plugins/beta/draw-ol/src/manifest.js +0 -125
  270. package/plugins/beta/draw-ol/src/olDraw.js +0 -38
  271. package/plugins/beta/draw-ol/src/reducer.js +0 -41
  272. package/plugins/beta/draw-ol/src/snap/snapEngine.js +0 -153
  273. package/plugins/beta/draw-ol/src/snap/snapGeometry.js +0 -177
  274. package/plugins/beta/draw-ol/src/snap/snapIndicator.js +0 -81
  275. package/plugins/beta/draw-ol/src/snap/snapInteraction.js +0 -57
  276. package/plugins/beta/draw-ol/src/snap/snapManager.js +0 -99
  277. package/plugins/beta/draw-ol/src/utils/flattenStyleProperties.js +0 -47
  278. package/plugins/beta/draw-ol/src/utils/geometryHelpers.js +0 -103
  279. package/plugins/beta/draw-ol/src/utils/olCoords.js +0 -35
  280. package/plugins/beta/draw-ol/src/utils/resolveColors.js +0 -39
  281. package/plugins/beta/draw-ol/src/utils/spatial.js +0 -24
  282. package/plugins/beta/draw-ol/src/utils/touchTarget.js +0 -61
  283. package/plugins/beta/frame/dist/esm/index.js +0 -1
  284. package/plugins/beta/map-styles/dist/esm/index.js +0 -1
  285. package/plugins/beta/scale-bar/dist/esm/index.js +0 -1
  286. package/plugins/beta/use-location/dist/esm/index.js +0 -1
  287. package/plugins/map-key/src/registry/getDatasetRegistry.js +0 -6
  288. package/plugins/map-key/src/registry/getDatasetRegistry.test.js +0 -23
  289. package/plugins/map-key/src/registry/index.js +0 -1
  290. package/plugins/map-key/src/registry/index.test.js +0 -7
  291. package/providers/beta/esri/dist/esm/index.js +0 -1
  292. package/providers/beta/open-names/dist/esm/index.js +0 -1
  293. package/providers/beta/openlayers/dist/esm/index.js +0 -1
  294. package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +0 -2
  295. package/providers/beta/openlayers/dist/umd/index.js.LICENSE.txt +0 -1
  296. /package/plugins/{beta/draw-es → draw-es}/dist/esm/im-draw-es-plugin.js +0 -0
  297. /package/plugins/{beta/draw-es → draw-es}/src/api/addFeature.js +0 -0
  298. /package/plugins/{beta/draw-es → draw-es}/src/api/deleteFeature.js +0 -0
  299. /package/plugins/{beta/draw-es → draw-es}/src/api/editFeature.js +0 -0
  300. /package/plugins/{beta/draw-es → draw-es}/src/api/newPolygon.js +0 -0
  301. /package/plugins/{beta/draw-es → draw-es}/src/api/removeSafeZone.js +0 -0
  302. /package/plugins/{beta/draw-es → draw-es}/src/events.js +0 -0
  303. /package/plugins/{beta/draw-es → draw-es}/src/index.js +0 -0
  304. /package/plugins/{beta/draw-es → draw-es}/src/manifest.js +0 -0
  305. /package/plugins/{beta/draw-es → draw-es}/src/reducer.js +0 -0
  306. /package/plugins/{beta/draw-es → draw-es}/src/sketchViewModel.js +0 -0
  307. /package/plugins/{beta/frame → frame}/dist/css/index.css +0 -0
  308. /package/plugins/{beta/frame → frame}/dist/esm/im-frame-plugin.js +0 -0
  309. /package/plugins/{beta/draw-ml → frame}/dist/umd/index.js.LICENSE.txt +0 -0
  310. /package/plugins/{beta/frame → frame}/src/Frame.jsx +0 -0
  311. /package/plugins/{beta/frame → frame}/src/FrameInit.jsx +0 -0
  312. /package/plugins/{beta/frame → frame}/src/api/addFrame.js +0 -0
  313. /package/plugins/{beta/frame → frame}/src/api/editFeature.js +0 -0
  314. /package/plugins/{beta/frame → frame}/src/config.js +0 -0
  315. /package/plugins/{beta/frame → frame}/src/frame.scss +0 -0
  316. /package/plugins/{beta/frame → frame}/src/index.js +0 -0
  317. /package/plugins/{beta/frame → frame}/src/manifest.js +0 -0
  318. /package/plugins/{beta/frame → frame}/src/reducer.js +0 -0
  319. /package/plugins/{beta/frame → frame}/src/utils.js +0 -0
  320. /package/plugins/{beta/map-styles → map-styles}/dist/css/index.css +0 -0
  321. /package/plugins/{beta/map-styles → map-styles}/dist/esm/im-map-styles-plugin.js +0 -0
  322. /package/plugins/{beta/frame → map-styles}/dist/umd/index.js.LICENSE.txt +0 -0
  323. /package/plugins/{beta/map-styles → map-styles}/src/config.js +0 -0
  324. /package/plugins/{beta/map-styles → map-styles}/src/index.js +0 -0
  325. /package/plugins/{beta/map-styles → map-styles}/src/manifest.js +0 -0
  326. /package/plugins/{beta/map-styles → map-styles}/src/mapStyles.scss +0 -0
  327. /package/plugins/{beta/scale-bar → scale-bar}/dist/css/index.css +0 -0
  328. /package/plugins/{beta/scale-bar → scale-bar}/dist/esm/im-scale-bar-plugin.js +0 -0
  329. /package/plugins/{beta/map-styles → scale-bar}/dist/umd/index.js.LICENSE.txt +0 -0
  330. /package/plugins/{beta/scale-bar → scale-bar}/src/ScaleBar.jsx +0 -0
  331. /package/plugins/{beta/scale-bar → scale-bar}/src/ScaleBar.test.jsx +0 -0
  332. /package/plugins/{beta/scale-bar → scale-bar}/src/index.js +0 -0
  333. /package/plugins/{beta/scale-bar → scale-bar}/src/index.test.js +0 -0
  334. /package/plugins/{beta/scale-bar → scale-bar}/src/manifest.js +0 -0
  335. /package/plugins/{beta/scale-bar → scale-bar}/src/scaleBar.scss +0 -0
  336. /package/plugins/{beta/scale-bar → scale-bar}/src/utils.js +0 -0
  337. /package/plugins/{beta/scale-bar → scale-bar}/src/utils.test.js +0 -0
  338. /package/plugins/{beta/use-location → use-location}/dist/esm/im-use-location-plugin.js +0 -0
  339. /package/plugins/{beta/scale-bar → use-location}/dist/umd/index.js.LICENSE.txt +0 -0
  340. /package/plugins/{beta/use-location → use-location}/src/UseLocation.jsx +0 -0
  341. /package/plugins/{beta/use-location → use-location}/src/UseLocationInit.jsx +0 -0
  342. /package/plugins/{beta/use-location → use-location}/src/defaults.js +0 -0
  343. /package/plugins/{beta/use-location → use-location}/src/events.js +0 -0
  344. /package/plugins/{beta/use-location → use-location}/src/index.js +0 -0
  345. /package/plugins/{beta/use-location → use-location}/src/manifest.js +0 -0
  346. /package/plugins/{beta/use-location → use-location}/src/reducer.js +0 -0
  347. /package/providers/{beta/esri → esri}/dist/css/index.css +0 -0
  348. /package/providers/{beta/esri → esri}/dist/esm/im-esri-provider.js +0 -0
  349. /package/providers/{beta/esri → esri}/src/appEvents.js +0 -0
  350. /package/providers/{beta/esri → esri}/src/defaults.js +0 -0
  351. /package/providers/{beta/esri → esri}/src/esriProvider.scss +0 -0
  352. /package/providers/{beta/esri → esri}/src/index.js +0 -0
  353. /package/providers/{beta/esri → esri}/src/utils/coords.js +0 -0
  354. /package/providers/{beta/esri → esri}/src/utils/coords.test.js +0 -0
  355. /package/providers/{beta/esri → esri}/src/utils/detectWebGL.js +0 -0
  356. /package/providers/{beta/esri → esri}/src/utils/esriFixes.js +0 -0
  357. /package/providers/{beta/esri → esri}/src/utils/query.js +0 -0
  358. /package/providers/{beta/esri → esri}/src/utils/spatial.js +0 -0
  359. /package/providers/{beta/esri → esri}/src/utils/spatial.test.js +0 -0
  360. /package/providers/{beta/open-names → open-names}/dist/esm/im-reverse-geocode.js +0 -0
  361. /package/providers/{beta/open-names → open-names}/dist/umd/im-reverse-geocode.js.LICENSE.txt +0 -0
  362. /package/{plugins/beta/use-location → providers/open-names}/dist/umd/index.js.LICENSE.txt +0 -0
  363. /package/providers/{beta/open-names → open-names}/src/index.js +0 -0
  364. /package/providers/{beta/open-names → open-names}/src/reverseGeocode.js +0 -0
  365. /package/providers/{beta/open-names → open-names}/src/utils/mapToLocationModel.js +0 -0
  366. /package/providers/{beta/open-names → open-names}/src/utils/mapToLocationModel.test.js +0 -0
  367. /package/providers/{beta/openlayers → openlayers}/dist/esm/im-openlayers-provider.js +0 -0
  368. /package/providers/{beta/openlayers → openlayers}/dist/umd/im-openlayers-provider.js.LICENSE.txt +0 -0
  369. /package/providers/{beta/open-names → openlayers}/dist/umd/index.js.LICENSE.txt +0 -0
  370. /package/providers/{beta/openlayers → openlayers}/src/appEvents.js +0 -0
  371. /package/providers/{beta/openlayers → openlayers}/src/appEvents.test.js +0 -0
  372. /package/providers/{beta/openlayers → openlayers}/src/defaults.js +0 -0
  373. /package/providers/{beta/openlayers → openlayers}/src/index.test.js +0 -0
  374. /package/providers/{beta/openlayers → openlayers}/src/openlayersProvider.test.js +0 -0
  375. /package/providers/{beta/openlayers → openlayers}/src/utils/bngProjection.js +0 -0
  376. /package/providers/{beta/openlayers → openlayers}/src/utils/filterEvaluator.js +0 -0
  377. /package/providers/{beta/openlayers → openlayers}/src/utils/filterEvaluator.test.js +0 -0
  378. /package/providers/{beta/openlayers → openlayers}/src/utils/highlightFeatures.test.js +0 -0
  379. /package/providers/{beta/openlayers → openlayers}/src/utils/hoverCursor.js +0 -0
  380. /package/providers/{beta/openlayers → openlayers}/src/utils/hoverCursor.test.js +0 -0
  381. /package/providers/{beta/openlayers → openlayers}/src/utils/openLayersFixes.js +0 -0
  382. /package/providers/{beta/openlayers → openlayers}/src/utils/openLayersFixes.test.js +0 -0
  383. /package/providers/{beta/openlayers → openlayers}/src/utils/patternImages.test.js +0 -0
  384. /package/providers/{beta/openlayers → openlayers}/src/utils/queryFeatures.js +0 -0
  385. /package/providers/{beta/openlayers → openlayers}/src/utils/queryFeatures.test.js +0 -0
  386. /package/providers/{beta/openlayers → openlayers}/src/utils/spatial.js +0 -0
  387. /package/providers/{beta/openlayers → openlayers}/src/utils/spatial.test.js +0 -0
  388. /package/providers/{beta/openlayers → openlayers}/src/utils/symbolImages.test.js +0 -0
  389. /package/providers/{beta/openlayers → openlayers}/src/utils/tileLayers.js +0 -0
  390. /package/providers/{beta/openlayers → openlayers}/src/utils/tileLayers.test.js +0 -0
  391. /package/providers/{beta/openlayers → openlayers}/src/utils/vtTileFragments.js +0 -0
  392. /package/providers/{beta/openlayers → openlayers}/src/utils/vtTileFragments.test.js +0 -0
  393. /package/providers/{beta/openlayers → openlayers}/src/utils/zoom.js +0 -0
  394. /package/providers/{beta/openlayers → openlayers}/src/utils/zoom.test.js +0 -0
@@ -1,4 +1,4 @@
1
- import { loadLayerAdapter, layerAdapter } from './loadLayerAdapter.js'
1
+ import { loadLayerAdapter } from './loadLayerAdapter.js'
2
2
 
3
3
  const makeAdapterInstance = (type) => ({
4
4
  type,
@@ -31,6 +31,7 @@ jest.mock('./openlayers/openlayersLayerAdapter.js', () => ({
31
31
  const makeMapProvider = (name) => ({ name })
32
32
  const symbolRegistry = {}
33
33
  const patternRegistry = {}
34
+ const datasetRegistry = {}
34
35
 
35
36
  describe('loadLayerAdapter', () => {
36
37
  beforeEach(() => {
@@ -55,11 +56,11 @@ describe('loadLayerAdapter', () => {
55
56
  expect(adapter.type).toBe('openlayers')
56
57
  })
57
58
 
58
- it('passes adapterConfig through to the adapter constructor', async () => {
59
+ it('passes the registries through to the adapter constructor', async () => {
59
60
  const OpenLayersLayerAdapter = (await import('./openlayers/openlayersLayerAdapter.js')).default
60
61
  const mapProvider = makeMapProvider('OpenLayersProvider')
61
- await loadLayerAdapter(mapProvider, symbolRegistry, patternRegistry, { renderer: 'webgl' })
62
- expect(OpenLayersLayerAdapter).toHaveBeenCalledWith(mapProvider, symbolRegistry, patternRegistry, { renderer: 'webgl' })
62
+ await loadLayerAdapter(mapProvider, symbolRegistry, patternRegistry, datasetRegistry)
63
+ expect(OpenLayersLayerAdapter).toHaveBeenCalledWith(mapProvider, symbolRegistry, patternRegistry, datasetRegistry)
63
64
  })
64
65
 
65
66
  it('throws for an unknown provider', async () => {
@@ -68,11 +69,10 @@ describe('loadLayerAdapter', () => {
68
69
  .rejects.toThrow('No layer adapter available for map provider UnknownProvider')
69
70
  })
70
71
 
71
- it('assigns adapter methods to the layerAdapter proxy object', async () => {
72
+ it('returns a new adapter instance for each call', async () => {
72
73
  const mapProvider = makeMapProvider('MapLibreProvider')
73
- await loadLayerAdapter(mapProvider, symbolRegistry, patternRegistry)
74
- expect(typeof layerAdapter.addDataset).toBe('function')
75
- expect(typeof layerAdapter.removeDataset).toBe('function')
76
- expect(typeof layerAdapter.setData).toBe('function')
74
+ const adapterA = await loadLayerAdapter(mapProvider, symbolRegistry, patternRegistry, datasetRegistry)
75
+ const adapterB = await loadLayerAdapter(mapProvider, symbolRegistry, patternRegistry, datasetRegistry)
76
+ expect(adapterA).not.toBe(adapterB)
77
77
  })
78
78
  })
@@ -1,5 +1,4 @@
1
1
  import { LayerAdapter } from './layerAdapter.js'
2
- import { datasetRegistry } from '../registry/datasetRegistry.js'
3
2
 
4
3
  /**
5
4
  * Shared orchestration for adapters whose registry Dataset extends MapboxStyleDataset
@@ -16,12 +15,13 @@ import { datasetRegistry } from '../registry/datasetRegistry.js'
16
15
  * much (e.g. OpenLayers has no per-layer setFilter, so it rebuilds the whole style instead).
17
16
  */
18
17
  export class MapboxStyleLayerAdapter extends LayerAdapter {
19
- constructor (mapProvider, symbolRegistry, patternRegistry) {
18
+ constructor (mapProvider, symbolRegistry, patternRegistry, datasetRegistry) {
20
19
  super()
21
20
  this._mapProvider = mapProvider
22
21
  this._map = mapProvider.map
23
22
  this._symbolRegistry = symbolRegistry
24
23
  this._patternRegistry = patternRegistry
24
+ this._datasetRegistry = datasetRegistry
25
25
  }
26
26
 
27
27
  // Live — reflects the map's current pixelRatio, which can change on resize.
@@ -30,7 +30,7 @@ export class MapboxStyleLayerAdapter extends LayerAdapter {
30
30
  }
31
31
 
32
32
  async addDataset (datasetId) {
33
- const registryDataset = datasetRegistry.getDataset(datasetId)
33
+ const registryDataset = this._datasetRegistry.getDataset(datasetId)
34
34
  if (!registryDataset) {
35
35
  return
36
36
  }
@@ -39,7 +39,7 @@ export class MapboxStyleLayerAdapter extends LayerAdapter {
39
39
  }
40
40
 
41
41
  applyDatasetOpacity (datasetId) {
42
- const registryDataset = datasetRegistry.getDataset(datasetId)
42
+ const registryDataset = this._datasetRegistry.getDataset(datasetId)
43
43
  if (registryDataset) {
44
44
  this._applyRegistryDatasetOpacity(registryDataset)
45
45
  }
@@ -52,11 +52,11 @@ export class MapboxStyleLayerAdapter extends LayerAdapter {
52
52
  }
53
53
 
54
54
  applyGlobalOpacity () {
55
- datasetRegistry.forEachDataset(registryDataset => this._applyRegistryDatasetOpacity(registryDataset))
55
+ this._datasetRegistry.forEachDataset(registryDataset => this._applyRegistryDatasetOpacity(registryDataset))
56
56
  }
57
57
 
58
58
  applyDatasetVisibility (datasetId) {
59
- const registryDataset = datasetRegistry.getDataset(datasetId)
59
+ const registryDataset = this._datasetRegistry.getDataset(datasetId)
60
60
  if (registryDataset) {
61
61
  this._applyRegistryDatasetVisibility(registryDataset)
62
62
  }
@@ -69,6 +69,6 @@ export class MapboxStyleLayerAdapter extends LayerAdapter {
69
69
  }
70
70
 
71
71
  applyGlobalVisibility () {
72
- datasetRegistry.forEachDataset(registryDataset => this._applyRegistryDatasetVisibility(registryDataset))
72
+ this._datasetRegistry.forEachDataset(registryDataset => this._applyRegistryDatasetVisibility(registryDataset))
73
73
  }
74
74
  }
@@ -1,6 +1,5 @@
1
1
  import { addDatasetLayers } from './layerBuilders.js'
2
2
  import { MapLibreDataset } from './registry/mapLibreDataset.js'
3
- import { datasetRegistry } from '../../registry/datasetRegistry.js'
4
3
  import { MapboxStyleLayerAdapter } from '../mapboxStyleLayerAdapter.js'
5
4
 
6
5
  /**
@@ -20,9 +19,10 @@ export default class MaplibreLayerAdapter extends MapboxStyleLayerAdapter {
20
19
  * @param {Object} mapProvider - Map provider instance (e.g. MapLibreProvider)
21
20
  * @param {Object} symbolRegistry
22
21
  * @param {Object} patternRegistry
22
+ * @param {Object} datasetRegistry - This plugin instance's dataset registry
23
23
  */
24
- constructor (mapProvider, symbolRegistry, patternRegistry) {
25
- super(mapProvider, symbolRegistry, patternRegistry)
24
+ constructor (mapProvider, symbolRegistry, patternRegistry, datasetRegistry) {
25
+ super(mapProvider, symbolRegistry, patternRegistry, datasetRegistry)
26
26
  // datasetId → sourceId, used by setData to update the correct source
27
27
  this._datasetSourceMap = new Map()
28
28
  window._datasetSourceMap = this._datasetSourceMap // Expose for debugging
@@ -30,8 +30,8 @@ export default class MaplibreLayerAdapter extends MapboxStyleLayerAdapter {
30
30
  this._symbolLayerIds = new Set()
31
31
  }
32
32
 
33
- createDataset (datasetDefinition) {
34
- return new MapLibreDataset(datasetDefinition)
33
+ createDataset (datasetDefinition, datasetRegistry) {
34
+ return new MapLibreDataset(datasetDefinition, datasetRegistry)
35
35
  }
36
36
 
37
37
  // ─── Lifecycle ──────────────────────────────────────────────────────────────
@@ -41,11 +41,11 @@ export default class MaplibreLayerAdapter extends MapboxStyleLayerAdapter {
41
41
  * @returns {Promise<void>} Resolves once the map has processed all layers.
42
42
  */
43
43
  async init () {
44
- const { patternConfigs, symbolConfigs } = datasetRegistry.getPatternAndSymbolConfigs()
44
+ const { patternConfigs, symbolConfigs } = this._datasetRegistry.getPatternAndSymbolConfigs()
45
45
  await this.addPatternsAndSymbolsToMap(patternConfigs, symbolConfigs)
46
46
 
47
47
  this._symbolLayerIds.clear()
48
- datasetRegistry.forEachDataset(registryDataset => this._addLayers(registryDataset))
48
+ this._datasetRegistry.forEachDataset(registryDataset => this._addLayers(registryDataset))
49
49
  await new Promise(resolve => this._map.once('idle', resolve))
50
50
  }
51
51
 
@@ -57,7 +57,7 @@ export default class MaplibreLayerAdapter extends MapboxStyleLayerAdapter {
57
57
  }
58
58
 
59
59
  async addPatternsAndSymbolsToMap (patterns, symbols) {
60
- const mapStyle = datasetRegistry.mapStyle
60
+ const mapStyle = this._datasetRegistry.mapStyle
61
61
  const mapStyleId = mapStyle.id
62
62
  return Promise.all([
63
63
  this._mapProvider.addPatternsToMap(patterns, mapStyleId, this._patternRegistry),
@@ -70,7 +70,7 @@ export default class MaplibreLayerAdapter extends MapboxStyleLayerAdapter {
70
70
  */
71
71
  destroy () {
72
72
  const removedSourceIds = new Set()
73
- datasetRegistry.forEachDataset(registryDataset => {
73
+ this._datasetRegistry.forEachDataset(registryDataset => {
74
74
  const sourceId = registryDataset.sourceId
75
75
  this._getLayersUsingSource(sourceId).forEach(layerId => this.removeLayer(layerId))
76
76
  if (!removedSourceIds.has(sourceId) && this._map.getSource(sourceId)) {
@@ -90,11 +90,11 @@ export default class MaplibreLayerAdapter extends MapboxStyleLayerAdapter {
90
90
  // MapLibre wipes all sources/layers on style change — must wait for idle first
91
91
  await new Promise(resolve => this._map.once('idle', resolve))
92
92
 
93
- const { patternConfigs, symbolConfigs } = datasetRegistry.getPatternAndSymbolConfigs()
93
+ const { patternConfigs, symbolConfigs } = this._datasetRegistry.getPatternAndSymbolConfigs()
94
94
  await this.addPatternsAndSymbolsToMap(patternConfigs, symbolConfigs)
95
95
  this._symbolLayerIds.clear()
96
96
 
97
- datasetRegistry.forEachDataset(registryDataset => {
97
+ this._datasetRegistry.forEachDataset(registryDataset => {
98
98
  this._addLayers(registryDataset)
99
99
  this._applyFeatureFilter(registryDataset)
100
100
  })
@@ -109,9 +109,9 @@ export default class MaplibreLayerAdapter extends MapboxStyleLayerAdapter {
109
109
  * @returns {Promise<void>}
110
110
  */
111
111
  async onMapSizeChange () {
112
- const { mapStyle } = datasetRegistry
112
+ const { mapStyle } = this._datasetRegistry
113
113
  const pixelRatio = this._pixelRatio
114
- const { patternConfigs, symbolConfigs } = datasetRegistry.getPatternAndSymbolConfigs()
114
+ const { patternConfigs, symbolConfigs } = this._datasetRegistry.getPatternAndSymbolConfigs()
115
115
  await this.addPatternsAndSymbolsToMap(patternConfigs, symbolConfigs)
116
116
  // A later size change has moved the map on to another ratio while these images were being
117
117
  // registered — its own call applies that ratio's images, which may not be registered yet
@@ -119,7 +119,7 @@ export default class MaplibreLayerAdapter extends MapboxStyleLayerAdapter {
119
119
  return
120
120
  }
121
121
 
122
- datasetRegistry.forEach(registryDataset => {
122
+ this._datasetRegistry.forEach(registryDataset => {
123
123
  const { fillLayerId, symbolLayerId } = registryDataset
124
124
  if (symbolLayerId && this._symbolLayerIds.has(symbolLayerId) && this._map.getLayer(symbolLayerId)) {
125
125
  const imageId = this._symbolRegistry.getSymbolImageId(registryDataset.style, mapStyle, 'normal', pixelRatio)
@@ -152,7 +152,7 @@ export default class MaplibreLayerAdapter extends MapboxStyleLayerAdapter {
152
152
  * @param {string} datasetId
153
153
  */
154
154
  removeDataset (datasetId) {
155
- const registryDataset = datasetRegistry.getDataset(datasetId)
155
+ const registryDataset = this._datasetRegistry.getDataset(datasetId)
156
156
  if (!registryDataset) {
157
157
  return
158
158
  }
@@ -161,7 +161,7 @@ export default class MaplibreLayerAdapter extends MapboxStyleLayerAdapter {
161
161
  layerIds.forEach(layerId => this.removeLayer(layerId))
162
162
 
163
163
  // Remove source if no other dataset is using it
164
- const sourceIsShared = datasetRegistry.topLevelDatasets()
164
+ const sourceIsShared = this._datasetRegistry.topLevelDatasets()
165
165
  .some(dataset => dataset.id !== datasetId && dataset.sourceId === sourceId)
166
166
 
167
167
  if (!sourceIsShared && this._map.getSource(sourceId)) {
@@ -178,7 +178,7 @@ export default class MaplibreLayerAdapter extends MapboxStyleLayerAdapter {
178
178
  * @param {string} datasetId
179
179
  */
180
180
  applyFeatureFilter (datasetId) {
181
- const registryDataset = datasetRegistry.getDataset(datasetId)
181
+ const registryDataset = this._datasetRegistry.getDataset(datasetId)
182
182
  if (!registryDataset) {
183
183
  return
184
184
  }
@@ -192,7 +192,7 @@ export default class MaplibreLayerAdapter extends MapboxStyleLayerAdapter {
192
192
  * @returns {Promise<void>}
193
193
  */
194
194
  async applyStyle (datasetId) {
195
- const registryDataset = datasetRegistry.getDataset(datasetId)
195
+ const registryDataset = this._datasetRegistry.getDataset(datasetId)
196
196
  registryDataset.layerIds.forEach(layerId => this.removeLayer(layerId))
197
197
  await this._registerPatternsAndSymbols(registryDataset)
198
198
  this._addLayers(registryDataset)
@@ -219,7 +219,7 @@ export default class MaplibreLayerAdapter extends MapboxStyleLayerAdapter {
219
219
  // ─── Private ─────────────────────────────────────────────────────────────────
220
220
 
221
221
  _addLayers (registryDataset) {
222
- const { mapStyle } = datasetRegistry
222
+ const { mapStyle } = this._datasetRegistry
223
223
  const sourceId = addDatasetLayers(this._mapProvider, registryDataset, mapStyle, this._symbolRegistry, this._patternRegistry, this._pixelRatio)
224
224
  this._datasetSourceMap.set(registryDataset.id, sourceId)
225
225
  this._maintainSymbolOrdering(registryDataset)
@@ -57,7 +57,7 @@ beforeEach(() => {
57
57
 
58
58
  map = makeMap()
59
59
  mapProvider = makeMapProvider(map)
60
- adapter = new MaplibreLayerAdapter(mapProvider, symbolRegistry, patternRegistry)
60
+ adapter = new MaplibreLayerAdapter(mapProvider, symbolRegistry, patternRegistry, datasetRegistry)
61
61
  adapter.attachDynamicSources(dynamicSources)
62
62
  datasetRegistry.attachCreateDataset(adapter.createDataset)
63
63
  })
@@ -14,7 +14,7 @@ const STATIC_GEOJSON_SOURCE_ID = `geojson-${hashString('https://example.com/stat
14
14
  describe('MapLibreDataset', () => {
15
15
  beforeEach(() => {
16
16
  logger.warn.mockClear()
17
- datasetRegistry.attachCreateDataset(def => new MapLibreDataset(def))
17
+ datasetRegistry.attachCreateDataset(def => new MapLibreDataset(def, datasetRegistry))
18
18
  datasetRegistry.mockExtend({
19
19
  // layerIds
20
20
  'ds-fill-only': { id: 'ds-fill-only', visible: true, minZoom: 10, maxZoom: 24, style: { fill: 'blue' } },
@@ -2,8 +2,8 @@ import Style from 'ol/style/Style.js'
2
2
  import Feature from 'ol/Feature.js'
3
3
  import Point from 'ol/geom/Point.js'
4
4
  import { buildCanvasPatternStyle } from './canvasPatternStyle.js'
5
- import { buildFilterEvaluator } from '../../../../../providers/beta/openlayers/src/utils/filterEvaluator.js'
6
- import { PatternImageCache } from '../../../../../providers/beta/openlayers/src/utils/patternImages.js'
5
+ import { buildFilterEvaluator } from '../../../../../providers/openlayers/src/utils/filterEvaluator.js'
6
+ import { PatternImageCache } from '../../../../../providers/openlayers/src/utils/patternImages.js'
7
7
 
8
8
  const OUTDOOR = 'outdoor'
9
9
 
@@ -5,7 +5,7 @@ import VectorTileLayer from 'ol/layer/VectorTile.js'
5
5
  import { createDatasetSource, createDatasetLayer, readGeoJSONFeatures } from './layerBuilders.js'
6
6
  import { logger } from '../../../../../src/services/logger.js'
7
7
  // The OL provider registers British National Grid when it loads
8
- import '../../../../../providers/beta/openlayers/src/utils/bngProjection.js'
8
+ import '../../../../../providers/openlayers/src/utils/bngProjection.js'
9
9
 
10
10
  jest.mock('../../../../../src/services/logger.js', () => ({ logger: { warn: jest.fn() } }))
11
11
 
@@ -1,5 +1,4 @@
1
1
  import { OpenLayersDataset } from './registry/openLayersDataset.js'
2
- import { datasetRegistry } from '../../registry/datasetRegistry.js'
3
2
  import { MapboxStyleLayerAdapter } from '../mapboxStyleLayerAdapter.js'
4
3
  import { createDatasetSource, createDatasetLayer, resolveLayerStyle, readGeoJSONFeatures } from './layerBuilders.js'
5
4
  import { logger } from '../../../../../src/services/logger.js'
@@ -21,21 +20,22 @@ export default class OpenLayersLayerAdapter extends MapboxStyleLayerAdapter {
21
20
  * @param {Object} mapProvider - Map provider instance (e.g. OpenLayersProvider)
22
21
  * @param {Object} symbolRegistry
23
22
  * @param {Object} patternRegistry
23
+ * @param {Object} datasetRegistry - This plugin instance's dataset registry
24
24
  */
25
- constructor (mapProvider, symbolRegistry, patternRegistry) {
26
- super(mapProvider, symbolRegistry, patternRegistry)
25
+ constructor (mapProvider, symbolRegistry, patternRegistry, datasetRegistry) {
26
+ super(mapProvider, symbolRegistry, patternRegistry, datasetRegistry)
27
27
  // sourceId → OL source, shared across sublayers of the same dataset
28
28
  this._sourcesById = new Map()
29
29
  // leaf layer id (== dataset/sublayer id) → OL layer
30
30
  this._layersById = new Map()
31
31
  // initialiseDatasets.js passes this to datasetRegistry.attachCreateDataset unbound, then
32
- // calls it as registry._createDataset(...) — bind so `this` still resolves here, not to
33
- // the registry.
32
+ // calls it as datasetRegistry._createDataset(...) — bind so `this` still resolves here, not to
33
+ // the dataset registry.
34
34
  this.createDataset = this.createDataset.bind(this)
35
35
  }
36
36
 
37
- createDataset (datasetDefinition) {
38
- return new OpenLayersDataset(datasetDefinition)
37
+ createDataset (datasetDefinition, datasetRegistry) {
38
+ return new OpenLayersDataset(datasetDefinition, datasetRegistry)
39
39
  }
40
40
 
41
41
  // What layer styles are resolved against — see layerBuilders.js's resolveLayerStyle. Symbol
@@ -43,7 +43,7 @@ export default class OpenLayersLayerAdapter extends MapboxStyleLayerAdapter {
43
43
  // from there rather than from a module of its own.
44
44
  get _styleContext () {
45
45
  return {
46
- mapStyleId: datasetRegistry.mapStyle?.id,
46
+ mapStyleId: this._datasetRegistry.mapStyle?.id,
47
47
  pixelRatio: this._pixelRatio,
48
48
  patternRegistry: this._patternRegistry,
49
49
  symbolRegistry: this._symbolRegistry,
@@ -57,7 +57,7 @@ export default class OpenLayersLayerAdapter extends MapboxStyleLayerAdapter {
57
57
 
58
58
  async init () {
59
59
  await Promise.all([this._registerPatterns(), this._registerSymbols()])
60
- datasetRegistry.forEachDataset(registryDataset => this._addLayers(registryDataset))
60
+ this._datasetRegistry.forEachDataset(registryDataset => this._addLayers(registryDataset))
61
61
  }
62
62
 
63
63
  destroy () {
@@ -66,13 +66,13 @@ export default class OpenLayersLayerAdapter extends MapboxStyleLayerAdapter {
66
66
  this._sourcesById.clear()
67
67
  }
68
68
 
69
- // OL's basemap swap (see providers/beta/openlayers's appEvents.js) only replaces the base
69
+ // OL's basemap swap (see providers/openlayers's appEvents.js) only replaces the base
70
70
  // tile layer — dataset layers are separate map.addLayer() entries and are never wiped, so
71
71
  // unlike MapLibre there's nothing to rebuild here, just colour tokens to re-resolve. Pattern
72
72
  // fg/bg colours can be mapStyle-keyed too, so re-registering (not just re-styling) is needed.
73
73
  async onMapStyleChange () {
74
74
  await Promise.all([this._registerPatterns(), this._registerSymbols()])
75
- datasetRegistry.forEachDataset(registryDataset => this._forEachLeafDataset(registryDataset, leaf => {
75
+ this._datasetRegistry.forEachDataset(registryDataset => this._forEachLeafDataset(registryDataset, leaf => {
76
76
  this._setLayerStyle(leaf)
77
77
  }))
78
78
  this._reapplyHighlights()
@@ -91,7 +91,7 @@ export default class OpenLayersLayerAdapter extends MapboxStyleLayerAdapter {
91
91
  if (this._pixelRatio !== pixelRatio) {
92
92
  return
93
93
  }
94
- datasetRegistry.forEachDataset(registryDataset => this._forEachLeafDataset(registryDataset, leaf => {
94
+ this._datasetRegistry.forEachDataset(registryDataset => this._forEachLeafDataset(registryDataset, leaf => {
95
95
  if (leaf.hasPattern || leaf.hasSymbol) {
96
96
  this._setLayerStyle(leaf)
97
97
  }
@@ -116,7 +116,7 @@ export default class OpenLayersLayerAdapter extends MapboxStyleLayerAdapter {
116
116
  }
117
117
 
118
118
  removeDataset (datasetId) {
119
- const registryDataset = datasetRegistry.getDataset(datasetId)
119
+ const registryDataset = this._datasetRegistry.getDataset(datasetId)
120
120
  if (!registryDataset) {
121
121
  return
122
122
  }
@@ -129,7 +129,7 @@ export default class OpenLayersLayerAdapter extends MapboxStyleLayerAdapter {
129
129
  })
130
130
 
131
131
  const { sourceId } = registryDataset
132
- const sourceIsShared = datasetRegistry.topLevelDatasets()
132
+ const sourceIsShared = this._datasetRegistry.topLevelDatasets()
133
133
  .some(dataset => dataset.id !== datasetId && dataset.sourceId === sourceId)
134
134
  if (!sourceIsShared) {
135
135
  this._sourcesById.delete(sourceId)
@@ -137,7 +137,7 @@ export default class OpenLayersLayerAdapter extends MapboxStyleLayerAdapter {
137
137
  }
138
138
 
139
139
  async applyStyle (datasetId) {
140
- const registryDataset = datasetRegistry.getDataset(datasetId)
140
+ const registryDataset = this._datasetRegistry.getDataset(datasetId)
141
141
  if (!registryDataset) {
142
142
  return
143
143
  }
@@ -167,7 +167,7 @@ export default class OpenLayersLayerAdapter extends MapboxStyleLayerAdapter {
167
167
  // filter means recomputing and re-setting style rather than a separate declarative call like
168
168
  // MapLibre's map.setFilter.
169
169
  applyFeatureFilter (datasetId) {
170
- const registryDataset = datasetRegistry.getDataset(datasetId)
170
+ const registryDataset = this._datasetRegistry.getDataset(datasetId)
171
171
  if (!registryDataset) {
172
172
  return
173
173
  }
@@ -177,7 +177,7 @@ export default class OpenLayersLayerAdapter extends MapboxStyleLayerAdapter {
177
177
  }
178
178
 
179
179
  setData (datasetId, geojson) {
180
- const registryDataset = datasetRegistry.getDataset(datasetId)
180
+ const registryDataset = this._datasetRegistry.getDataset(datasetId)
181
181
  const olSource = registryDataset && this._sourcesById.get(registryDataset.sourceId)
182
182
  if (!olSource) {
183
183
  return
@@ -194,7 +194,7 @@ export default class OpenLayersLayerAdapter extends MapboxStyleLayerAdapter {
194
194
  // pixelRatio, so resolveLayerStyle (synchronous) can find it already resolved — mirrors
195
195
  // MapLibreLayerAdapter's addPatternsAndSymbolsToMap, which likewise runs before _addLayers
196
196
  // reads the dataset's style. See canvasPatternStyle.js for how the fill is used.
197
- async _registerPatterns (registryDatasets = datasetRegistry.topLevelDatasets()) {
197
+ async _registerPatterns (registryDatasets = this._datasetRegistry.topLevelDatasets()) {
198
198
  const styles = []
199
199
  registryDatasets.forEach(registryDataset => this._forEachLeafDataset(registryDataset, leaf => {
200
200
  if (leaf.hasPattern) {
@@ -202,14 +202,14 @@ export default class OpenLayersLayerAdapter extends MapboxStyleLayerAdapter {
202
202
  }
203
203
  }))
204
204
  if (styles.length) {
205
- await this._mapProvider.addPatternsToMap(styles, datasetRegistry.mapStyle?.id, this._patternRegistry, this._pixelRatio)
205
+ await this._mapProvider.addPatternsToMap(styles, this._datasetRegistry.mapStyle?.id, this._patternRegistry, this._pixelRatio)
206
206
  }
207
207
  }
208
208
 
209
209
  // Rasterises and caches each symbol's icon image ahead of time, at the map's current
210
210
  // pixelRatio, so OpenLayersDataset.getFlatStyle (synchronous) can find it already resolved —
211
211
  // same convention as _registerPatterns.
212
- async _registerSymbols (registryDatasets = datasetRegistry.topLevelDatasets()) {
212
+ async _registerSymbols (registryDatasets = this._datasetRegistry.topLevelDatasets()) {
213
213
  const styles = []
214
214
  registryDatasets.forEach(registryDataset => this._forEachLeafDataset(registryDataset, leaf => {
215
215
  if (leaf.hasSymbol) {
@@ -217,7 +217,7 @@ export default class OpenLayersLayerAdapter extends MapboxStyleLayerAdapter {
217
217
  }
218
218
  }))
219
219
  if (styles.length) {
220
- await this._mapProvider.addSymbolsToMap(styles, datasetRegistry.mapStyle, this._symbolRegistry, this._pixelRatio)
220
+ await this._mapProvider.addSymbolsToMap(styles, this._datasetRegistry.mapStyle, this._symbolRegistry, this._pixelRatio)
221
221
  }
222
222
  }
223
223
 
@@ -3,11 +3,11 @@ import { datasetRegistry } from '../../registry/datasetRegistry.js'
3
3
  import { createPatternRegistry } from '../../../../../src/services/patternRegistry.js'
4
4
  import { createSymbolRegistry } from '../../../../../src/services/symbolRegistry.js'
5
5
  import { logger } from '../../../../../src/services/logger.js'
6
- import { SymbolImageCache } from '../../../../../providers/beta/openlayers/src/utils/symbolImages.js'
7
- import { PatternImageCache } from '../../../../../providers/beta/openlayers/src/utils/patternImages.js'
8
- import { buildFilterEvaluator } from '../../../../../providers/beta/openlayers/src/utils/filterEvaluator.js'
6
+ import { SymbolImageCache } from '../../../../../providers/openlayers/src/utils/symbolImages.js'
7
+ import { PatternImageCache } from '../../../../../providers/openlayers/src/utils/patternImages.js'
8
+ import { buildFilterEvaluator } from '../../../../../providers/openlayers/src/utils/filterEvaluator.js'
9
9
  // The OL provider registers British National Grid when it loads
10
- import '../../../../../providers/beta/openlayers/src/utils/bngProjection.js'
10
+ import '../../../../../providers/openlayers/src/utils/bngProjection.js'
11
11
  import VectorLayer from 'ol/layer/Vector.js'
12
12
  import VectorTileLayer from 'ol/layer/VectorTile.js'
13
13
  import * as layerBuilders from './layerBuilders.js'
@@ -72,7 +72,7 @@ let map, mapProvider, adapter
72
72
  beforeEach(() => {
73
73
  map = makeMap()
74
74
  mapProvider = makeMapProvider(map)
75
- adapter = new OpenLayersLayerAdapter(mapProvider, symbolRegistry, patternRegistry)
75
+ adapter = new OpenLayersLayerAdapter(mapProvider, symbolRegistry, patternRegistry, datasetRegistry)
76
76
  datasetRegistry.attachCreateDataset(adapter.createDataset)
77
77
  datasetRegistry.mockExtend({
78
78
  'ds-fill': { id: 'ds-fill', style: { fill: '#0000ff' }, geojson: { type: 'FeatureCollection', features: [point(1, [0, 0])] } },
@@ -1,5 +1,4 @@
1
1
  import { MapboxStyleDataset } from '../../../registry/mapboxStyleDataset.js'
2
- import { datasetRegistry } from '../../../registry/datasetRegistry.js'
3
2
  import { getValueForStyle } from '../../../../../../src/utils/getValueForStyle.js'
4
3
 
5
4
  const MAX_TILE_ZOOM = 22
@@ -111,7 +110,7 @@ export class OpenLayersDataset extends MapboxStyleDataset {
111
110
  if (!this.hasSymbol) {
112
111
  return null
113
112
  }
114
- const imageId = symbolRegistry.getSymbolImageId(this.style, datasetRegistry.mapStyle, 'normal', pixelRatio)
113
+ const imageId = symbolRegistry.getSymbolImageId(this.style, this._datasetRegistry.mapStyle, 'normal', pixelRatio)
115
114
  if (!imageId) {
116
115
  return null
117
116
  }
@@ -154,7 +153,7 @@ export class OpenLayersDataset extends MapboxStyleDataset {
154
153
  if (this.hasSymbol) {
155
154
  return this._symbolStyle(context)
156
155
  }
157
- const mapStyleId = datasetRegistry.mapStyle?.id
156
+ const mapStyleId = this._datasetRegistry.mapStyle?.id
158
157
  const style = {}
159
158
  if (this.hasFill && !this.hasPattern) {
160
159
  style['fill-color'] = getValueForStyle(this.style.fill, mapStyleId)
@@ -1,7 +1,7 @@
1
1
  import { OpenLayersDataset } from './openLayersDataset.js'
2
2
  import { datasetRegistry } from '../../../registry/datasetRegistry.js'
3
3
  import { createSymbolRegistry } from '../../../../../../src/services/symbolRegistry.js'
4
- import { SymbolImageCache } from '../../../../../../providers/beta/openlayers/src/utils/symbolImages.js'
4
+ import { SymbolImageCache } from '../../../../../../providers/openlayers/src/utils/symbolImages.js'
5
5
 
6
6
  const symbolRegistry = createSymbolRegistry()
7
7
  // Use the mock datasetRegistry with the demo datasets attached before each test
@@ -34,7 +34,7 @@ beforeAll(() => {
34
34
 
35
35
  describe('OpenLayersDataset', () => {
36
36
  beforeEach(() => {
37
- datasetRegistry.attachCreateDataset(def => new OpenLayersDataset(def))
37
+ datasetRegistry.attachCreateDataset(def => new OpenLayersDataset(def, datasetRegistry))
38
38
  datasetRegistry.mockExtend({
39
39
  'ds-fill-only': { id: 'ds-fill-only', style: { fill: 'blue' } },
40
40
  'ds-stroke-only': { id: 'ds-stroke-only', style: { stroke: 'red', strokeWidth: 2 } },
@@ -1,7 +1,6 @@
1
1
  import { logger } from '../../../../src/services/logger.js'
2
- import { datasetRegistry } from '../registry/datasetRegistry.js'
3
2
 
4
- export const getOpacity = ({ pluginState: { globals } }, options = {}) => {
3
+ export const getOpacity = ({ pluginState: { globals, datasetRegistry } }, options = {}) => {
5
4
  const { datasetId, sublayerId } = options
6
5
  const fullId = sublayerId ? `${datasetId}-${sublayerId}` : datasetId
7
6
  if (fullId) {
@@ -1,10 +1,7 @@
1
1
  import { getOpacity } from './getOpacity.js'
2
- import { datasetRegistry } from '../registry/datasetRegistry.js'
3
2
  import { logger } from '../../../../src/services/logger.js'
4
3
 
5
- jest.mock('../registry/datasetRegistry.js', () => ({
6
- datasetRegistry: { getDataset: jest.fn() }
7
- }))
4
+ const datasetRegistry = { getDataset: jest.fn() }
8
5
 
9
6
  jest.mock('../../../../src/services/logger.js')
10
7
 
@@ -15,12 +12,12 @@ describe('getOpacity', () => {
15
12
 
16
13
  describe('global (no datasetId)', () => {
17
14
  it('returns globals.opacity when set', () => {
18
- const ctx = { pluginState: { globals: { opacity: 0.5 } } }
15
+ const ctx = { pluginState: { globals: { opacity: 0.5 }, datasetRegistry } }
19
16
  expect(getOpacity(ctx)).toBe(0.5)
20
17
  })
21
18
 
22
19
  it('returns null when globals.opacity is undefined', () => {
23
- const ctx = { pluginState: { globals: {} } }
20
+ const ctx = { pluginState: { globals: {}, datasetRegistry } }
24
21
  expect(getOpacity(ctx)).toBeNull()
25
22
  })
26
23
  })
@@ -28,19 +25,19 @@ describe('getOpacity', () => {
28
25
  describe('with datasetId', () => {
29
26
  it('returns opacity from the registry dataset', () => {
30
27
  datasetRegistry.getDataset.mockReturnValue({ opacity: 0.7 })
31
- const ctx = { pluginState: { globals: {} } }
28
+ const ctx = { pluginState: { globals: {}, datasetRegistry } }
32
29
  expect(getOpacity(ctx, { datasetId: 'my-dataset' })).toBe(0.7)
33
30
  })
34
31
 
35
32
  it('returns null when the dataset has no opacity property', () => {
36
33
  datasetRegistry.getDataset.mockReturnValue({})
37
- const ctx = { pluginState: { globals: {} } }
34
+ const ctx = { pluginState: { globals: {}, datasetRegistry } }
38
35
  expect(getOpacity(ctx, { datasetId: 'my-dataset' })).toBeNull()
39
36
  })
40
37
 
41
38
  it('returns null and warns when the dataset is not found', () => {
42
39
  datasetRegistry.getDataset.mockReturnValue(undefined)
43
- const ctx = { pluginState: { globals: {} } }
40
+ const ctx = { pluginState: { globals: {}, datasetRegistry } }
44
41
  expect(getOpacity(ctx, { datasetId: 'missing' })).toBeNull()
45
42
  expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining('missing'))
46
43
  })
@@ -49,20 +46,20 @@ describe('getOpacity', () => {
49
46
  describe('with sublayerId', () => {
50
47
  it('combines datasetId and sublayerId for the registry lookup', () => {
51
48
  datasetRegistry.getDataset.mockReturnValue({ opacity: 0.3 })
52
- const ctx = { pluginState: { globals: {} } }
49
+ const ctx = { pluginState: { globals: {}, datasetRegistry } }
53
50
  getOpacity(ctx, { datasetId: 'parent', sublayerId: 'child' })
54
51
  expect(datasetRegistry.getDataset).toHaveBeenCalledWith('parent-child')
55
52
  })
56
53
 
57
54
  it('returns opacity for the combined id', () => {
58
55
  datasetRegistry.getDataset.mockReturnValue({ opacity: 0.3 })
59
- const ctx = { pluginState: { globals: {} } }
56
+ const ctx = { pluginState: { globals: {}, datasetRegistry } }
60
57
  expect(getOpacity(ctx, { datasetId: 'parent', sublayerId: 'child' })).toBe(0.3)
61
58
  })
62
59
 
63
60
  it('returns null and warns when the sublayer dataset is not found', () => {
64
61
  datasetRegistry.getDataset.mockReturnValue(undefined)
65
- const ctx = { pluginState: { globals: {} } }
62
+ const ctx = { pluginState: { globals: {}, datasetRegistry } }
66
63
  expect(getOpacity(ctx, { datasetId: 'parent', sublayerId: 'missing' })).toBeNull()
67
64
  expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining('parent-missing'))
68
65
  })
@@ -1,7 +1,6 @@
1
1
  import { logger } from '../../../../src/services/logger.js'
2
- import { datasetRegistry } from '../registry/datasetRegistry.js'
3
2
 
4
- export const getStyle = ({ _pluginState }, { datasetId, sublayerId } = {}) => {
3
+ export const getStyle = ({ pluginState: { datasetRegistry } }, { datasetId, sublayerId } = {}) => {
5
4
  datasetId = sublayerId ? `${datasetId}-${sublayerId}` : datasetId
6
5
  const registryDataset = datasetRegistry.getDataset(datasetId)
7
6
  if (!registryDataset) {
@@ -1,10 +1,7 @@
1
1
  import { getStyle } from './getStyle.js'
2
- import { datasetRegistry } from '../registry/datasetRegistry.js'
3
2
  import { logger } from '../../../../src/services/logger.js'
4
3
 
5
- jest.mock('../registry/datasetRegistry.js', () => ({
6
- datasetRegistry: { getDataset: jest.fn() }
7
- }))
4
+ const datasetRegistry = { getDataset: jest.fn() }
8
5
 
9
6
  jest.mock('../../../../src/services/logger.js')
10
7
 
@@ -16,25 +13,25 @@ describe('getStyle', () => {
16
13
  it('returns the style for a known dataset', () => {
17
14
  const style = { fill: 'blue', stroke: 'red' }
18
15
  datasetRegistry.getDataset.mockReturnValue({ style })
19
- expect(getStyle({}, { datasetId: 'roads' })).toBe(style)
16
+ expect(getStyle({ pluginState: { datasetRegistry } }, { datasetId: 'roads' })).toBe(style)
20
17
  })
21
18
 
22
19
  it('returns style for the combined sublayer id', () => {
23
20
  const style = { fill: 'green' }
24
21
  datasetRegistry.getDataset.mockReturnValue({ style })
25
- expect(getStyle({}, { datasetId: 'parent', sublayerId: 'child' })).toBe(style)
22
+ expect(getStyle({ pluginState: { datasetRegistry } }, { datasetId: 'parent', sublayerId: 'child' })).toBe(style)
26
23
  expect(datasetRegistry.getDataset).toHaveBeenCalledWith('parent-child')
27
24
  })
28
25
 
29
26
  it('returns null and warns when a sublayer dataset is not found', () => {
30
27
  datasetRegistry.getDataset.mockReturnValue(undefined)
31
- expect(getStyle({}, { datasetId: 'parent', sublayerId: 'missing' })).toBeNull()
28
+ expect(getStyle({ pluginState: { datasetRegistry } }, { datasetId: 'parent', sublayerId: 'missing' })).toBeNull()
32
29
  expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining('parent-missing'))
33
30
  })
34
31
 
35
32
  it('uses undefined datasetId when options argument is omitted', () => {
36
33
  datasetRegistry.getDataset.mockReturnValue(undefined)
37
- expect(getStyle({})).toBeNull()
34
+ expect(getStyle({ pluginState: { datasetRegistry } })).toBeNull()
38
35
  expect(logger.warn).toHaveBeenCalledWith('getStyle: Dataset with id undefined not found')
39
36
  })
40
37
  })