@defra/interactive-map 0.0.30-alpha → 0.0.32-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 (247) hide show
  1. package/README.md +2 -2
  2. package/assets/images/bright-ofm-thumb.jpg +0 -0
  3. package/assets/images/dark-ofm-thumb.jpg +0 -0
  4. package/assets/images/road-ofm-thumb.jpg +0 -0
  5. package/assets/templates/add-polygons.njk +143 -0
  6. package/assets/templates/add-symbols.njk +119 -0
  7. package/assets/templates/{map.njk → basic-map.njk} +9 -17
  8. package/assets/templates/button-map.njk +56 -0
  9. package/assets/templates/draw-tools.njk +161 -0
  10. package/assets/templates/marker-panel.njk +91 -0
  11. package/assets/templates/place-marker.njk +104 -0
  12. package/assets/templates/search-control.njk +98 -0
  13. package/assets/templates/select-feature.njk +101 -0
  14. package/assets/templates/style-switcher.njk +87 -0
  15. package/assets/templates/toggle-marker-label.njk +74 -0
  16. package/dist/css/index.css +1 -1
  17. package/dist/esm/im-core.js +1 -1
  18. package/dist/esm/im-shell.js +1 -1
  19. package/dist/umd/im-core.js +1 -1
  20. package/dist/umd/index.js +1 -1
  21. package/docs/api/context.md +4 -4
  22. package/docs/api.md +166 -37
  23. package/docs/assets/css/docusaurus.scss +36 -4
  24. package/docs/assets/images/add-polygons.jpg +0 -0
  25. package/docs/assets/images/add-symbols.jpg +0 -0
  26. package/docs/assets/images/basic-map.jpg +0 -0
  27. package/docs/assets/images/button-first.jpg +0 -0
  28. package/docs/assets/images/deuteranopia-ozs-map-thumb.jpg +0 -0
  29. package/docs/assets/images/draw.jpg +0 -0
  30. package/docs/assets/images/marker-panel.jpg +0 -0
  31. package/docs/assets/images/night-ozs-map-thumb.jpg +0 -0
  32. package/docs/assets/images/outdoor-ozs-map-thumb.jpg +0 -0
  33. package/docs/assets/images/place-marker.jpg +0 -0
  34. package/docs/assets/images/screenshot.jpg +0 -0
  35. package/docs/assets/images/search.jpg +0 -0
  36. package/docs/assets/images/select-feature.jpg +0 -0
  37. package/docs/assets/images/style-switcher.jpg +0 -0
  38. package/docs/assets/images/toggle-marker-label.jpg +0 -0
  39. package/docs/assets/images/tritanopia-ozs-map-thumb.jpg +0 -0
  40. package/docs/examples/add-marker-with-panel.mdx +3 -3
  41. package/docs/examples/add-polygons.mdx +225 -0
  42. package/docs/examples/add-symbols.mdx +177 -0
  43. package/docs/examples/basic-map.mdx +2 -2
  44. package/docs/examples/draw-tools.mdx +271 -0
  45. package/docs/examples/index.mdx +95 -11
  46. package/docs/examples/place-marker.mdx +151 -0
  47. package/docs/examples/search-control.mdx +71 -0
  48. package/docs/examples/select-feature.mdx +146 -0
  49. package/docs/examples/style-switcher.mdx +135 -0
  50. package/docs/examples/toggle-marker-label.mdx +3 -3
  51. package/docs/plugins/datasets.md +157 -122
  52. package/docs/plugins/interact.md +1 -4
  53. package/docusaurus.config.cjs +9 -2
  54. package/govuk-prototype-kit.config.json +52 -2
  55. package/package.json +1 -1
  56. package/plugins/beta/datasets/dist/css/index.css +5 -2
  57. package/plugins/beta/datasets/dist/esm/im-datasets-ml-adapter.js +1 -0
  58. package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -1
  59. package/plugins/beta/datasets/dist/esm/index.js +1 -1
  60. package/plugins/beta/datasets/dist/umd/im-datasets-ml-adapter.js +2 -0
  61. package/plugins/beta/datasets/dist/umd/im-datasets-plugin.js +2 -0
  62. package/plugins/beta/datasets/dist/umd/index.js +2 -0
  63. package/plugins/beta/datasets/src/adapters/loadLayerAdapter.js +33 -0
  64. package/plugins/beta/datasets/src/adapters/maplibre/layerBuilders.js +44 -120
  65. package/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +145 -245
  66. package/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +516 -0
  67. package/plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.js +209 -0
  68. package/plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +483 -0
  69. package/plugins/beta/datasets/src/api/addDataset.js +2 -5
  70. package/plugins/beta/datasets/src/api/addDataset.test.js +16 -0
  71. package/plugins/beta/datasets/src/api/getOpacity.js +14 -14
  72. package/plugins/beta/datasets/src/api/getOpacity.test.js +72 -0
  73. package/plugins/beta/datasets/src/api/getStyle.js +8 -9
  74. package/plugins/beta/datasets/src/api/getStyle.test.js +42 -0
  75. package/plugins/beta/datasets/src/api/removeDataset.js +7 -7
  76. package/plugins/beta/datasets/src/api/removeDataset.test.js +45 -0
  77. package/plugins/beta/datasets/src/api/setData.js +9 -3
  78. package/plugins/beta/datasets/src/api/setData.test.js +62 -0
  79. package/plugins/beta/datasets/src/api/setDatasetVisibility.js +5 -30
  80. package/plugins/beta/datasets/src/api/setDatasetVisibility.test.js +31 -0
  81. package/plugins/beta/datasets/src/api/setFeatureVisibility.js +9 -18
  82. package/plugins/beta/datasets/src/api/setFeatureVisibility.test.js +74 -0
  83. package/plugins/beta/datasets/src/api/setGlobals.js +20 -0
  84. package/plugins/beta/datasets/src/api/setGlobals.test.js +63 -0
  85. package/plugins/beta/datasets/src/api/setOpacity.js +8 -27
  86. package/plugins/beta/datasets/src/api/setOpacity.test.js +31 -0
  87. package/plugins/beta/datasets/src/api/setStyle.js +5 -21
  88. package/plugins/beta/datasets/src/api/setStyle.test.js +53 -0
  89. package/plugins/beta/datasets/src/components/Key/Key.jsx +51 -0
  90. package/plugins/beta/datasets/src/components/Key/KeyGroupItem.jsx +18 -0
  91. package/plugins/beta/datasets/src/components/Key/KeyItem.jsx +20 -0
  92. package/plugins/beta/datasets/src/components/Key/KeySvg.jsx +22 -0
  93. package/plugins/beta/datasets/src/components/Key/KeySvg.test.jsx +87 -0
  94. package/plugins/beta/datasets/src/components/Key/KeySvgLine.jsx +19 -0
  95. package/plugins/beta/datasets/src/components/Key/KeySvgLine.test.jsx +71 -0
  96. package/plugins/beta/datasets/src/components/{KeySvgPattern.jsx → Key/KeySvgPattern.jsx} +3 -4
  97. package/plugins/beta/datasets/src/components/Key/KeySvgPattern.test.jsx +55 -0
  98. package/plugins/beta/datasets/src/components/Key/KeySvgRect.jsx +22 -0
  99. package/plugins/beta/datasets/src/components/Key/KeySvgRect.test.jsx +85 -0
  100. package/plugins/beta/datasets/src/components/{KeySvgSymbol.jsx → Key/KeySvgSymbol.jsx} +5 -5
  101. package/plugins/beta/datasets/src/components/Key/KeySvgSymbol.test.jsx +80 -0
  102. package/plugins/beta/datasets/src/components/Key/svgProperties.test.js +61 -0
  103. package/plugins/beta/datasets/src/{panels → components/LayersMenu}/Layers.module.scss +15 -11
  104. package/plugins/beta/datasets/src/components/LayersMenu/LayersMenu.jsx +33 -0
  105. package/plugins/beta/datasets/src/components/LayersMenu/LayersMenuCheckbox.jsx +31 -0
  106. package/plugins/beta/datasets/src/components/LayersMenu/LayersMenuGroupWrapper.jsx +19 -0
  107. package/plugins/beta/datasets/src/datasets.scss +2 -2
  108. package/plugins/beta/datasets/src/fetch/createDynamicSource.js +8 -8
  109. package/plugins/beta/datasets/src/{DatasetsInit.jsx → initialise/DatasetsInit.jsx} +19 -21
  110. package/plugins/beta/datasets/src/{defaults.js → initialise/defaults.js} +17 -2
  111. package/plugins/beta/datasets/src/initialise/defaults.test.js +127 -0
  112. package/plugins/beta/datasets/src/{datasets.js → initialise/initialiseDatasets.js} +30 -26
  113. package/plugins/beta/datasets/src/initialise/initialiseDatasets.test.js +273 -0
  114. package/plugins/beta/datasets/src/manifest.js +8 -6
  115. package/plugins/beta/datasets/src/reducers/__data__/demoDatasets.js +253 -0
  116. package/plugins/beta/datasets/src/reducers/datasetsToMenu.js +83 -0
  117. package/plugins/beta/datasets/src/reducers/datasetsToMenu.test.js +84 -0
  118. package/plugins/beta/datasets/src/reducers/mappedDatasetsReducer.js +41 -0
  119. package/plugins/beta/datasets/src/reducers/mappedDatasetsReducer.test.js +117 -0
  120. package/plugins/beta/datasets/src/reducers/pluginState.js +206 -0
  121. package/plugins/beta/datasets/src/reducers/pluginState.test.js +386 -0
  122. package/plugins/beta/datasets/src/registry/__mocks__/datasetRegistry.js +29 -0
  123. package/plugins/beta/datasets/src/registry/createDataset.js +5 -0
  124. package/plugins/beta/datasets/src/registry/dataset.js +176 -0
  125. package/plugins/beta/datasets/src/registry/dataset.test.js +497 -0
  126. package/plugins/beta/datasets/src/registry/datasetDefinitionCache.js +35 -0
  127. package/plugins/beta/datasets/src/registry/datasetRegistry.js +116 -0
  128. package/plugins/beta/datasets/src/registry/datasetRegistry.test.js +335 -0
  129. package/plugins/beta/datasets/src/registry/dynamicGeoJson.js +17 -0
  130. package/plugins/beta/datasets/src/registry/globalDataset.js +36 -0
  131. package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -1
  132. package/plugins/beta/draw-es/src/api/addFeature.js +12 -3
  133. package/plugins/beta/draw-es/src/events.js +8 -3
  134. package/plugins/beta/draw-es/src/events.test.js +2 -0
  135. package/plugins/beta/draw-es/src/graphic.js +26 -2
  136. package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
  137. package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -1
  138. package/plugins/beta/draw-ml/src/DrawInit.jsx +8 -0
  139. package/plugins/beta/draw-ml/src/api/newLine.js +1 -0
  140. package/plugins/beta/draw-ml/src/api/newPolygon.js +1 -0
  141. package/plugins/beta/draw-ml/src/events.js +13 -1
  142. package/plugins/beta/draw-ml/src/index.js +1 -1
  143. package/plugins/beta/draw-ml/src/manifest.js +3 -0
  144. package/plugins/beta/draw-ml/src/modes/createDrawMode.js +21 -12
  145. package/plugins/beta/draw-ml/src/modes/editVertexMode.js +4 -0
  146. package/plugins/beta/draw-ol/dist/esm/EditMode.js +1 -1
  147. package/plugins/beta/draw-ol/dist/esm/im-draw-ol-plugin.js +1 -1
  148. package/plugins/beta/draw-ol/src/edit/keyboardHandler.js +4 -2
  149. package/plugins/beta/map-styles/src/mapStyles.scss +41 -41
  150. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  151. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  152. package/plugins/interact/dist/umd/index.js +1 -1
  153. package/plugins/interact/src/InteractInit.jsx +3 -5
  154. package/plugins/interact/src/InteractInit.test.js +1 -3
  155. package/plugins/interact/src/events.js +2 -29
  156. package/plugins/interact/src/events.test.js +4 -102
  157. package/plugins/interact/src/hooks/useAttachEvents.js +3 -4
  158. package/plugins/interact/src/hooks/useAttachEvents.test.js +1 -3
  159. package/plugins/interact/src/hooks/useCrossHairVisibility.js +4 -10
  160. package/plugins/interact/src/hooks/useCrossHairVisibility.test.js +5 -10
  161. package/plugins/interact/src/hooks/useHighlightSync.js +1 -10
  162. package/plugins/interact/src/hooks/useHighlightSync.test.js +2 -21
  163. package/plugins/interact/src/hooks/useInteractionHandlers.js +15 -12
  164. package/plugins/interact/src/hooks/useInteractionHandlers.test.js +28 -29
  165. package/plugins/interact/src/manifest.js +0 -35
  166. package/plugins/interact/src/manifest.test.js +3 -43
  167. package/plugins/interact/src/reducer.js +4 -22
  168. package/plugins/interact/src/reducer.test.js +11 -39
  169. package/plugins/search/dist/css/index.css +5 -2
  170. package/plugins/search/src/components/Form/Form.module.scss +5 -2
  171. package/plugins/search/src/search.scss +4 -4
  172. package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
  173. package/providers/beta/esri/src/esriProvider.js +4 -0
  174. package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
  175. package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
  176. package/providers/beta/openlayers/src/openlayersProvider.js +4 -0
  177. package/providers/beta/openlayers/src/openlayersProvider.test.js +5 -0
  178. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  179. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  180. package/providers/maplibre/src/maplibreProvider.js +6 -4
  181. package/providers/maplibre/src/maplibreProvider.test.js +5 -0
  182. package/providers/maplibre/src/utils/highlightFeatures.js +74 -25
  183. package/providers/maplibre/src/utils/highlightFeatures.test.js +132 -0
  184. package/providers/maplibre/src/utils/patternImages.js +2 -4
  185. package/providers/maplibre/src/utils/symbolImages.js +1 -4
  186. package/rollup.esm.mjs +2 -8
  187. package/src/App/components/CrossHair/CrossHair.module.scss +8 -8
  188. package/src/App/components/MapButton/MapButton.jsx +16 -1
  189. package/src/App/components/MapButton/MapButton.module.scss +12 -1
  190. package/src/App/components/MapButton/MapButton.test.jsx +40 -1
  191. package/src/App/hooks/useContinueEnabledEvaluator.js +31 -0
  192. package/src/App/hooks/useContinueEnabledEvaluator.test.js +118 -0
  193. package/src/App/hooks/useEvaluateProp.js +15 -15
  194. package/src/App/hooks/useEvaluateProp.test.js +80 -76
  195. package/src/App/hooks/useLayoutMeasurements.js +11 -5
  196. package/src/App/hooks/useResizeObserver.js +15 -2
  197. package/src/App/hooks/useResizeObserver.test.js +1 -0
  198. package/src/App/renderer/PluginInits.jsx +2 -0
  199. package/src/App/renderer/mapButtons.js +21 -1
  200. package/src/App/renderer/mapButtons.test.js +46 -1
  201. package/src/App/store/appReducer.js +1 -1
  202. package/src/App/store/appReducer.test.js +37 -0
  203. package/src/InteractiveMap/InteractiveMap.js +14 -4
  204. package/src/InteractiveMap/InteractiveMap.test.js +11 -3
  205. package/src/InteractiveMap/behaviourController.js +3 -1
  206. package/src/InteractiveMap/behaviourController.test.js +6 -3
  207. package/src/InteractiveMap/domStateManager.js +2 -0
  208. package/src/config/appConfig.js +25 -0
  209. package/src/config/appConfig.test.js +50 -0
  210. package/src/config/defaults.js +1 -0
  211. package/src/config/events.js +21 -3
  212. package/src/scss/settings/_dimensions.scss +1 -0
  213. package/src/services/patternRegistry.js +8 -4
  214. package/src/types.js +7 -0
  215. package/src/utils/patternUtils.js +1 -2
  216. package/src/utils/patternUtils.test.js +9 -0
  217. package/webpack.dev.mjs +10 -0
  218. package/webpack.umd.mjs +1 -1
  219. package/docs/assets/images/screens-blue.jpg +0 -0
  220. package/docs/assets/images/screens-white.jpg +0 -0
  221. package/plugins/beta/datasets/dist/adapters/maplibre/esm/im-datasets-ml-adapter.js +0 -1
  222. package/plugins/beta/datasets/dist/adapters/maplibre/esm/index.js +0 -1
  223. package/plugins/beta/datasets/dist/umd/maplibre/im-datasets-maplibre-adapter.js +0 -2
  224. package/plugins/beta/datasets/dist/umd/maplibre/im-datasets-plugin.js +0 -2
  225. package/plugins/beta/datasets/dist/umd/maplibre/index.js +0 -2
  226. package/plugins/beta/datasets/src/adapters/maplibre/index.js +0 -18
  227. package/plugins/beta/datasets/src/adapters/maplibre/layerIds.js +0 -75
  228. package/plugins/beta/datasets/src/adapters/maplibre/patternImages.js +0 -27
  229. package/plugins/beta/datasets/src/adapters/maplibre/symbolImages.js +0 -31
  230. package/plugins/beta/datasets/src/components/KeySvg.jsx +0 -24
  231. package/plugins/beta/datasets/src/components/KeySvgLine.jsx +0 -19
  232. package/plugins/beta/datasets/src/components/KeySvgRect.jsx +0 -22
  233. package/plugins/beta/datasets/src/index.maplibre.umd.js +0 -23
  234. package/plugins/beta/datasets/src/panels/Key.jsx +0 -62
  235. package/plugins/beta/datasets/src/panels/Layers.jsx +0 -141
  236. package/plugins/beta/datasets/src/reducer.js +0 -219
  237. package/plugins/beta/datasets/src/reducers/keyReducer.js +0 -34
  238. package/plugins/beta/datasets/src/utils/filters.js +0 -34
  239. package/plugins/beta/datasets/src/utils/mergeSublayer.js +0 -86
  240. package/plugins/beta/draw-ml/dist/css/index.css +0 -21
  241. /package/plugins/beta/datasets/dist/umd/{maplibre/im-datasets-maplibre-adapter.js.LICENSE.txt → im-datasets-ml-adapter.js.LICENSE.txt} +0 -0
  242. /package/plugins/beta/datasets/dist/umd/{maplibre/im-datasets-plugin.js.LICENSE.txt → im-datasets-plugin.js.LICENSE.txt} +0 -0
  243. /package/plugins/beta/datasets/dist/umd/{maplibre/index.js.LICENSE.txt → index.js.LICENSE.txt} +0 -0
  244. /package/plugins/beta/datasets/src/components/{EmptyKey.jsx → Key/EmptyKey.jsx} +0 -0
  245. /package/plugins/beta/datasets/src/components/{EmptyKey.test.jsx → Key/EmptyKey.test.jsx} +0 -0
  246. /package/plugins/beta/datasets/src/{panels → components/Key}/Key.module.scss +0 -0
  247. /package/plugins/beta/datasets/src/components/{svgProperties.js → Key/svgProperties.js} +0 -0
@@ -7,7 +7,6 @@ const initialState = {
7
7
  deselectOnClickOutside: false,
8
8
  selectedFeatures: [],
9
9
  selectedMarkers: [],
10
- selectionBounds: null,
11
10
  closeOnAction: true, // Done or Cancel
12
11
  listboxActiveItem: null // { featureId, layerId, idProperty, geometry } | null — ring shown but no selectionchange
13
12
  }
@@ -26,7 +25,6 @@ const disable = (state) => {
26
25
  enabled: false,
27
26
  selectedFeatures: [],
28
27
  selectedMarkers: [],
29
- selectionBounds: null,
30
28
  listboxActiveItem: null
31
29
  }
32
30
  }
@@ -46,7 +44,7 @@ const toggleSelectedFeatures = (state, payload) => {
46
44
  // 1. Handle explicit unselect
47
45
  if (addToExisting === false) {
48
46
  const filtered = currentSelected.filter((_, i) => i !== existingIndex)
49
- return { ...state, selectedFeatures: filtered, selectionBounds: null }
47
+ return { ...state, selectedFeatures: filtered }
50
48
  }
51
49
 
52
50
  // Define the feature object once to avoid repetition
@@ -70,18 +68,7 @@ const toggleSelectedFeatures = (state, payload) => {
70
68
  nextSelected = isSameSingle ? [] : [featureObj]
71
69
  }
72
70
 
73
- return { ...state, selectedFeatures: nextSelected, selectedMarkers: multiSelect && !replaceAll ? state.selectedMarkers : [], selectionBounds: null }
74
- }
75
-
76
- // Update bounds (called from useEffect after map provider calculates them)
77
- const updateSelectedBounds = (state, payload) => {
78
- if (JSON.stringify(payload) === JSON.stringify(state.selectionBounds)) {
79
- return state
80
- }
81
- return {
82
- ...state,
83
- selectionBounds: payload
84
- }
71
+ return { ...state, selectedFeatures: nextSelected, selectedMarkers: multiSelect && !replaceAll ? state.selectedMarkers : [] }
85
72
  }
86
73
 
87
74
  const toggleSelectedMarkers = (state, { markerId, multiSelect }) => {
@@ -94,7 +81,6 @@ const toggleSelectedMarkers = (state, { markerId, multiSelect }) => {
94
81
  return {
95
82
  ...state,
96
83
  selectedFeatures: [],
97
- selectionBounds: null,
98
84
  selectedMarkers: exists && current.length === 1 ? [] : [markerId]
99
85
  }
100
86
  }
@@ -103,8 +89,7 @@ const clearSelectedFeatures = (state) => {
103
89
  return {
104
90
  ...state,
105
91
  selectedFeatures: [],
106
- selectedMarkers: [],
107
- selectionBounds: null
92
+ selectedMarkers: []
108
93
  }
109
94
  }
110
95
 
@@ -124,7 +109,6 @@ const selectMarker = (state, { markerId, multiSelect }) => {
124
109
  return {
125
110
  ...state,
126
111
  selectedFeatures: multiSelect ? state.selectedFeatures : [],
127
- selectionBounds: null,
128
112
  selectedMarkers: nextMarkers
129
113
  }
130
114
  }
@@ -145,8 +129,7 @@ const unselectMarker = (state, { markerId }) => {
145
129
 
146
130
  const setSelectedFeatures = (state, features) => ({
147
131
  ...state,
148
- selectedFeatures: features,
149
- selectionBounds: null
132
+ selectedFeatures: features
150
133
  })
151
134
 
152
135
  const actions = {
@@ -154,7 +137,6 @@ const actions = {
154
137
  DISABLE: disable,
155
138
  TOGGLE_SELECTED_FEATURES: toggleSelectedFeatures,
156
139
  TOGGLE_SELECTED_MARKERS: toggleSelectedMarkers,
157
- UPDATE_SELECTED_BOUNDS: updateSelectedBounds,
158
140
  CLEAR_SELECTED_FEATURES: clearSelectedFeatures,
159
141
  SET_SELECTED_FEATURES: setSelectedFeatures,
160
142
  SELECT_MARKER: selectMarker,
@@ -11,7 +11,6 @@ describe('initialState', () => {
11
11
  deselectOnClickOutside: false,
12
12
  selectedFeatures: [],
13
13
  selectedMarkers: [],
14
- selectionBounds: null,
15
14
  closeOnAction: true,
16
15
  listboxActiveItem: null
17
16
  })
@@ -33,7 +32,7 @@ describe('ENABLE/DISABLE actions', () => {
33
32
 
34
33
  it('DISABLE sets enabled to false, clears selection and markers, and preserves other state', () => {
35
34
  const marker = { symbol: 'pin', backgroundColor: 'red' }
36
- const state = { ...initialState, enabled: true, layers: [1], marker, selectedFeatures: [{ featureId: 'f1' }], selectedMarkers: ['m1'], selectionBounds: [0, 0, 1, 1] }
35
+ const state = { ...initialState, enabled: true, layers: [1], marker, selectedFeatures: [{ featureId: 'f1' }], selectedMarkers: ['m1'] }
37
36
  const result = actions.DISABLE(state)
38
37
 
39
38
  expect(result.enabled).toBe(false)
@@ -41,7 +40,6 @@ describe('ENABLE/DISABLE actions', () => {
41
40
  expect(result.marker).toEqual(marker)
42
41
  expect(result.selectedFeatures).toEqual([])
43
42
  expect(result.selectedMarkers).toEqual([])
44
- expect(result.selectionBounds).toBeNull()
45
43
  expect(result).not.toBe(state)
46
44
  })
47
45
  })
@@ -56,7 +54,7 @@ describe('TOGGLE_SELECTED_FEATURES action', () => {
56
54
  })
57
55
 
58
56
  it('handles single-select, multi-select, add/remove, and replaceAll', () => {
59
- let state = { ...initialState, selectionBounds: { sw: [0, 0], ne: [1, 1] } }
57
+ let state = { ...initialState }
60
58
 
61
59
  // Single-select: add
62
60
  state = actions.TOGGLE_SELECTED_FEATURES(state, createFeature('f1'))
@@ -66,33 +64,27 @@ describe('TOGGLE_SELECTED_FEATURES action', () => {
66
64
  state = actions.TOGGLE_SELECTED_FEATURES(state, createFeature('f2'))
67
65
  expect(state.selectedFeatures[0].featureId).toBe('f2')
68
66
 
69
- // Toggle off same - clears bounds
67
+ // Toggle off same
70
68
  state = actions.TOGGLE_SELECTED_FEATURES(state, createFeature('f2'))
71
69
  expect(state.selectedFeatures).toHaveLength(0)
72
- expect(state.selectionBounds).toBeNull()
73
70
 
74
71
  // Multi-select: add multiple
75
- state = { ...state, selectionBounds: { sw: [0, 0], ne: [1, 1] } }
76
72
  state = actions.TOGGLE_SELECTED_FEATURES(state, { ...createFeature('f1'), multiSelect: true })
77
73
  state = actions.TOGGLE_SELECTED_FEATURES(state, { ...createFeature('f2'), multiSelect: true })
78
74
  expect(state.selectedFeatures.map(f => f.featureId)).toEqual(['f1', 'f2'])
79
75
 
80
- // Multi-select: remove (not last) - clears bounds for recalculation
76
+ // Multi-select: remove (not last)
81
77
  state = actions.TOGGLE_SELECTED_FEATURES(state, { ...createFeature('f1'), multiSelect: true })
82
78
  expect(state.selectedFeatures.map(f => f.featureId)).toEqual(['f2'])
83
- expect(state.selectionBounds).toBeNull()
84
79
 
85
- // Multi-select: remove last - clears bounds
80
+ // Multi-select: remove last
86
81
  state = actions.TOGGLE_SELECTED_FEATURES(state, { ...createFeature('f2'), multiSelect: true })
87
82
  expect(state.selectedFeatures).toHaveLength(0)
88
- expect(state.selectionBounds).toBeNull()
89
83
 
90
- // addToExisting false removes feature - clears bounds when empty
91
- state = { ...state, selectionBounds: { sw: [0, 0], ne: [1, 1] } }
84
+ // addToExisting false removes feature
92
85
  state = actions.TOGGLE_SELECTED_FEATURES(state, { ...createFeature('f2'), multiSelect: true })
93
86
  state = actions.TOGGLE_SELECTED_FEATURES(state, { ...createFeature('f2'), addToExisting: false })
94
87
  expect(state.selectedFeatures).toHaveLength(0)
95
- expect(state.selectionBounds).toBeNull()
96
88
 
97
89
  // replaceAll replaces everything
98
90
  state = actions.TOGGLE_SELECTED_FEATURES(state, { ...createFeature('f3'), replaceAll: true })
@@ -131,26 +123,12 @@ describe('TOGGLE_SELECTED_FEATURES action', () => {
131
123
  })
132
124
  })
133
125
 
134
- describe('UPDATE_SELECTED_BOUNDS action', () => {
135
- it('updates selectionBounds correctly', () => {
136
- const state = { ...initialState, selectionBounds: { sw: [0, 0], ne: [1, 1] } }
137
- const newBounds = { sw: [0, 0], ne: [2, 2] }
138
- const result = actions.UPDATE_SELECTED_BOUNDS(state, newBounds)
139
- expect(result.selectionBounds).toEqual(newBounds)
140
-
141
- // unchanged bounds returns same state
142
- const result2 = actions.UPDATE_SELECTED_BOUNDS(state, { sw: [0, 0], ne: [1, 1] })
143
- expect(result2).toBe(state)
144
- })
145
- })
146
-
147
126
  describe('TOGGLE_SELECTED_MARKERS action', () => {
148
127
  it('selects a marker in single-select mode and clears features', () => {
149
- const state = { ...initialState, selectedFeatures: [{ featureId: 'f1' }], selectionBounds: { sw: [0, 0], ne: [1, 1] } }
128
+ const state = { ...initialState, selectedFeatures: [{ featureId: 'f1' }] }
150
129
  const result = actions.TOGGLE_SELECTED_MARKERS(state, { markerId: 'm1', multiSelect: false })
151
130
  expect(result.selectedMarkers).toEqual(['m1'])
152
131
  expect(result.selectedFeatures).toEqual([])
153
- expect(result.selectionBounds).toBeNull()
154
132
  })
155
133
 
156
134
  it('toggles off the only selected marker in single-select mode', () => {
@@ -174,17 +152,15 @@ describe('TOGGLE_SELECTED_MARKERS action', () => {
174
152
  })
175
153
 
176
154
  describe('CLEAR_SELECTED_FEATURES action', () => {
177
- it('resets features, markers and bounds', () => {
155
+ it('resets features and markers', () => {
178
156
  const state = {
179
157
  ...initialState,
180
158
  selectedFeatures: [1],
181
- selectedMarkers: ['m1'],
182
- selectionBounds: { sw: [0, 0], ne: [1, 1] }
159
+ selectedMarkers: ['m1']
183
160
  }
184
161
  const result = actions.CLEAR_SELECTED_FEATURES(state)
185
162
  expect(result.selectedFeatures).toEqual([])
186
163
  expect(result.selectedMarkers).toEqual([])
187
- expect(result.selectionBounds).toBeNull()
188
164
  expect(result).not.toBe(state)
189
165
  })
190
166
  })
@@ -209,7 +185,6 @@ describe('SELECT_MARKER action', () => {
209
185
  const result = actions.SELECT_MARKER(state, { markerId: 'm1', multiSelect: false })
210
186
  expect(result.selectedMarkers).toEqual(['m1'])
211
187
  expect(result.selectedFeatures).toEqual([])
212
- expect(result.selectionBounds).toBeNull()
213
188
  })
214
189
 
215
190
  it('adds a marker in multi-select mode without clearing selectedFeatures', () => {
@@ -241,16 +216,14 @@ describe('UNSELECT_MARKER action', () => {
241
216
  })
242
217
 
243
218
  describe('SET_SELECTED_FEATURES action', () => {
244
- it('replaces selectedFeatures and clears bounds', () => {
219
+ it('replaces selectedFeatures', () => {
245
220
  const state = {
246
221
  ...initialState,
247
- selectedFeatures: [{ featureId: 'A' }, { featureId: 'B' }, { featureId: 'C' }],
248
- selectionBounds: [0, 0, 1, 1]
222
+ selectedFeatures: [{ featureId: 'A' }, { featureId: 'B' }, { featureId: 'C' }]
249
223
  }
250
224
  const trimmed = [{ featureId: 'A' }]
251
225
  const result = actions.SET_SELECTED_FEATURES(state, trimmed)
252
226
  expect(result.selectedFeatures).toEqual(trimmed)
253
- expect(result.selectionBounds).toBeNull()
254
227
  expect(result).not.toBe(state)
255
228
  })
256
229
  })
@@ -262,7 +235,6 @@ describe('actions object', () => {
262
235
  'DISABLE',
263
236
  'TOGGLE_SELECTED_FEATURES',
264
237
  'TOGGLE_SELECTED_MARKERS',
265
- 'UPDATE_SELECTED_BOUNDS',
266
238
  'CLEAR_SELECTED_FEATURES',
267
239
  'SET_SELECTED_FEATURES',
268
240
  'SELECT_MARKER',
@@ -3,6 +3,11 @@
3
3
  padding: 0;
4
4
  min-height: auto;
5
5
  border-radius: 0;
6
+ filter: var(--search-drop-shadow);
7
+ -webkit-transform: translate3d(0, 0, 0);
8
+ -moz-transform: translate3d(0, 0, 0);
9
+ -ms-transform: translate3d(0, 0, 0);
10
+ transform: translate3d(0, 0, 0);
6
11
  }
7
12
  .im-c-search-form:before {
8
13
  border-radius: 0;
@@ -16,7 +21,6 @@
16
21
  right: 0;
17
22
  height: auto;
18
23
  overflow: visible;
19
- filter: var(--search-drop-shadow);
20
24
  }
21
25
 
22
26
  .im-o-app--tablet .im-c-search-form,
@@ -25,7 +29,6 @@
25
29
  overflow: visible;
26
30
  border-radius: var(--button-border-radius);
27
31
  box-shadow: none;
28
- filter: var(--search-drop-shadow);
29
32
  }
30
33
  .im-o-app--tablet .im-c-search-form:before,
31
34
  .im-o-app--desktop .im-c-search-form:before {
@@ -3,6 +3,11 @@
3
3
  padding: 0;
4
4
  min-height: auto;
5
5
  border-radius: 0;
6
+ filter: var(--search-drop-shadow);
7
+ -webkit-transform: translate3d(0, 0, 0);
8
+ -moz-transform: translate3d(0, 0, 0);
9
+ -ms-transform: translate3d(0, 0, 0);
10
+ transform: translate3d(0, 0, 0);
6
11
 
7
12
  &:before {
8
13
  border-radius: 0;
@@ -17,7 +22,6 @@
17
22
  right: 0;
18
23
  height: auto;
19
24
  overflow: visible;
20
- filter: var(--search-drop-shadow);
21
25
  }
22
26
 
23
27
  .im-o-app--tablet .im-c-search-form,
@@ -26,7 +30,6 @@
26
30
  overflow: visible;
27
31
  border-radius: var(--button-border-radius);
28
32
  box-shadow: none;
29
- filter: var(--search-drop-shadow);
30
33
 
31
34
  &:before {
32
35
  border-radius: var(--button-border-radius);
@@ -32,10 +32,10 @@
32
32
  content: '';
33
33
  z-index: 1;
34
34
  position: absolute;
35
- top: -1px;
36
- right: -1px;
37
- bottom: -1px;
38
- left: -1px;
35
+ top: -1px;
36
+ right: -1px;
37
+ bottom: -1px;
38
+ left: -1px;
39
39
  border-radius: var(--button-border-radius);
40
40
  border: 2px solid var(--foreground-color);
41
41
  pointer-events: none;
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/asyncToGenerator";import r from"@arcgis/core/config.js";import n from"@arcgis/core/layers/support/TileInfo.js";import i from"@arcgis/core/Map.js";import o from"@arcgis/core/views/MapView.js";import a from"@arcgis/core/layers/VectorTileLayer.js";import s from"@arcgis/core/geometry/Point.js";import{when as m,once as l,watch as u}from"@arcgis/core/core/reactiveUtils.js";import c from"@arcgis/core/geometry/Extent.js";var p={animationDuration:200},v=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];var y=(e,t)=>{var r=null,n=function(){for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];clearTimeout(r),r=setTimeout(()=>{e(...i)},t)};return n.cancel=()=>{r&&(clearTimeout(r),r=null)},n};function h(e){var{mapProvider:t,view:r,baseTileLayer:n,events:i,eventBus:o,getZoom:a,getCenter:s,getBounds:c,getResolution:p}=e,v=!1,h=[],d=[],f=e=>{var t=(()=>{if(v||!r||r.destroyed||!r.extent)return null;var{maxZoom:e,minZoom:t}=r.constraints;return{center:s(),bounds:c(),resolution:p(),zoom:a(),isAtMaxZoom:r.zoom+.01>=e,isAtMinZoom:r.zoom-.01<=t}})();t&&o.emit(e,t)};m(()=>n.loaded&&r.resolution>0,()=>f(i.MAP_LOADED)),l(()=>r.ready).then(()=>{v||o.emit(i.MAP_READY,{map:t.map,view:t.view,mapStyleId:t.mapStyleId,mapSize:t.mapSize,crs:t.crs})}),l(()=>r.stationary).then(()=>f(i.MAP_FIRST_IDLE));var g=y(()=>f(i.MAP_MOVE_END),500);d.push(g),h.push(u(()=>[r.interacting,r.animation],e=>{var[t,r]=e;(t||r)&&o.emit(i.MAP_MOVE_START),t||r||g()}));var w,x,b,M=(w=()=>f(i.MAP_MOVE),x=10,b=0,function(){var e=Date.now();e-b>=x&&(b=e,w(...arguments))});d.push(M),h.push(u(()=>r.zoom,M)),h.push(u(()=>r.extent,()=>o.emit(i.MAP_RENDER),{initial:!1}));var E=y(()=>f(i.MAP_DATA_CHANGE),500);d.push(E),h.push(u(()=>r.updating,e=>!e&&E()));var A=null,T=null;return h.push(r.on("pointer-down",e=>{A=e.x,T=e.y})),h.push(r.on("pointer-up",e=>{var n;if(0===e.button&&!(Math.hypot(e.x-A,e.y-T)>6)&&"active"!==(null===(n=t.sketchViewModel)||void 0===n?void 0:n.state)){var a={x:e.x,y:e.y},s=r.toMap(a);s&&o.emit(i.MAP_CLICK,{point:a,coords:[s.x,s.y]})}})),{remove(){v=!0,d.forEach(e=>e.cancel()),h.forEach(e=>e.remove())}}}var d=e=>e?new c({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:{wkid:27700}}):void 0,f=e=>e?new s({x:e[0],y:e[1],spatialReference:{wkid:27700}}):void 0,g=(e,t)=>{if(e)if("FeatureCollection"===e.type)e.features.forEach(e=>g(e,t));else if("Feature"===e.type)g(e.geometry,t);else if("GeometryCollection"===e.type)e.geometries.forEach(e=>g(e,t));else{var r=e=>{Array.isArray(e)&&("number"==typeof e[0]?t.push(e):e.forEach(r))};r(e.coordinates)}},w=e=>{var t=[];g(e,t);var r=t.map(e=>e[0]),n=t.map(e=>e[1]);return d([Math.min(...r),Math.min(...n),Math.max(...r),Math.max(...n)])},x=e=>{var t=1609.344,r=e/t;if(r<.5/t)return"".concat(Math.round(e),"m");if(r<10){var n=Number.parseFloat(r.toFixed(1)),i=1===n?"mile":"miles";return"".concat(n," ").concat(i)}var o=Math.round(r),a=1===o?"mile":"miles";return"".concat(o," ").concat(a)};var b={top:0,right:0,bottom:0,left:0};function M(){return(M=t(function*(e,t){if(!e||!t)return[];var r=e.map.layers.filter(e=>e instanceof a);return r.length?(yield e.hitTest(t,{include:r.toArray()})).results.map(e=>({layerId:e.layer.id,layerTitle:e.layer.title||e.layer.id,type:e.layer.type,geometry:e.graphic.geometry,symbol:e.graphic.symbol})):[]})).apply(this,arguments)}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 A(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?E(Object(n),!0).forEach(function(r){e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}class T{constructor(e){var{mapProviderConfig:t={},events:r,eventBus:n}=e;this.events=r,this.eventBus=n,this.capabilities={supportedShortcuts:v,supportsMapSizes:!1},Object.assign(this,t),this.mapEventHandles=[],this.appEventHandles=[]}initMap(e){var s=this;return t(function*(){var{container:t,padding:m,mapStyle:l,mapSize:u,maxExtent:c}=e;s.mapStyleId=null==l?void 0:l.id,s.mapSize=u;var{events:p,eventBus:v}=s;s.setupConfig&&(yield s.setupConfig(r));var y=new a({id:"baselayer",url:l.url,visible:!0}),g=new i({layers:[y]}),w=c?d(c):null,x=new o({spatialReference:27700,container:t,map:g,zoom:e.zoom,center:f(e.center),maxExtent:c,constraints:{lods:n.create({spatialReference:{wkid:27700}}).lods,snapToZoom:!1,minZoom:e.minZoom,maxZoom:e.maxZoom,maxScale:0,geometry:w,rotationEnabled:!1},ui:{components:[]},popupEnabled:!1});(e=>{if(e){var t=e.querySelector(".esri-view-surface");t.removeAttribute("role"),t.tabIndex=-1,t.style["outline-color"]="transparent",t.style.touchAction="none"}})(x.container),x.padding=m,e.bounds&&x.when(()=>x.goTo(d(e.bounds),{duration:0})),s.mapEventHandles=h({mapProvider:s,view:x,baseTileLayer:y,events:p,eventBus:v,getZoom:s.getZoom.bind(s),getCenter:s.getCenter.bind(s),getBounds:s.getBounds.bind(s),getResolution:s.getResolution.bind(s)}),s.appEventHandles=function(e){var{baseTileLayer:t,events:r,eventBus:n}=e,i=e=>{t.loadStyle(e.url).then(()=>{n.emit(r.MAP_STYLE_CHANGE,{mapStyleId:e.id})})};return n.on(r.MAP_SET_STYLE,i),{remove(){n.off(r.MAP_SET_STYLE,i)}}}({baseTileLayer:y,events:p,eventBus:v})||[],s.map=g,s.view=x,s.baseTileLayer=y})()}destroyMap(){var e,t;null===(e=this.mapEvents)||void 0===e||e.remove(),null===(t=this.appEvents)||void 0===t||t.remove(),this.mapEvents=null,this.appEvents=null,this.view&&(this.view.container=null,this.view.destroy(),this.view=null),this.map&&(this.map.removeAll(),this.map=null)}setView(e){var t,{center:r,zoom:n}=e;null===(t=this.view.animation)||void 0===t||t.destroy();var i={center:r?new s({x:r[0],y:r[1],spatialReference:{wkid:27700}}):this.view.center,zoom:null!=n?n:this.view.zoom};this.view.goTo(A(A({},i),{},{duration:p.animationDuration}))}zoomIn(e){var t;null===(t=this.view.animation)||void 0===t||t.destroy(),this.view.goTo({zoom:this.view.zoom+e,duration:p.animationDuration})}zoomOut(e){var t;null===(t=this.view.animation)||void 0===t||t.destroy(),this.view.goTo({zoom:this.view.zoom-e,duration:p.animationDuration})}panBy(e){var{x:t,y:r}=this.view.toScreen(this.view.center),n={x:t+e[0],y:r+e[1]},i=this.view.toMap(n);this.view.goTo({center:i,duration:p.animationDuration})}fitToBounds(e){var t=Array.isArray(e)?d(e):w(e);this.view.goTo(t,{duration:p.DELAY})}setPadding(e){this.view.padding=e}getCenter(){var e=this.view.center;return[e.x,e.y].map(e=>Math.round(100*e)/100)}getZoom(){return this.view.zoom}getBounds(){var{xmin:e,ymin:t,xmax:r,ymax:n}=this.view.extent;return[e,t,r,n].map(e=>Math.round(100*e)/100)}getFeaturesAtPoint(e,t){return function(e,t){return M.apply(this,arguments)}(this.view,e)}getVisibleFeatures(e){return[]}getAreaDimensions(){return(e=>{if(!(e&&e instanceof c))return"";var t=e.xmin,r=e.ymin,n=e.xmax,i=e.ymax-r,o=x(n-t),a=x(i);return"".concat(a," by ").concat(o)})(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b;if(!e.container)return null;var{width:r,height:n}=e.container.getBoundingClientRect(),i={x:t.left,y:n-t.bottom},o={x:r-t.right,y:t.top},a=e.toMap(i),s=e.toMap(o);return new c({xmin:a.x,ymin:a.y,xmax:s.x,ymax:s.y,spatialReference:a.spatialReference})}(this.view))}getCardinalMove(e,t){return function(e,t){var[r,n]=e,[i,o]=t,a=i-r,s=o-n,m=[];return Math.abs(s)>.1&&m.push("".concat(s>0?"north":"south"," ").concat(x(Math.abs(s)))),Math.abs(a)>.1&&m.push("".concat(a>0?"east":"west"," ").concat(x(Math.abs(a)))),m.join(", ")}(e,t)}getResolution(){return this.view.resolution}mapToScreen(e){var t=f(e),r=this.view.toScreen(t);return{x:r.x,y:r.y}}screenToMap(e){var t=this.view.toMap(e);return[t.x,t.y]}isGeometryObscured(e,t){return((e,t,r)=>{if(null==r||!r.container)return!1;var n=r.container.getBoundingClientRect(),i=w(e),o=[r.toScreen(new s({x:i.xmin,y:i.ymin,spatialReference:i.spatialReference})),r.toScreen(new s({x:i.xmin,y:i.ymax,spatialReference:i.spatialReference})),r.toScreen(new s({x:i.xmax,y:i.ymin,spatialReference:i.spatialReference})),r.toScreen(new s({x:i.xmax,y:i.ymax,spatialReference:i.spatialReference}))],a=Math.min(...o.map(e=>e.x)),m=Math.max(...o.map(e=>e.x)),l=Math.min(...o.map(e=>e.y)),u=Math.max(...o.map(e=>e.y)),c=t.left-n.left,p=t.top-n.top,v=t.right-n.left,y=t.bottom-n.top;return a<v&&m>c&&l<y&&u>p})(e,t,this.view)}}export{T as default};
1
+ import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/asyncToGenerator";import r from"@arcgis/core/config.js";import n from"@arcgis/core/layers/support/TileInfo.js";import i from"@arcgis/core/Map.js";import o from"@arcgis/core/views/MapView.js";import a from"@arcgis/core/layers/VectorTileLayer.js";import s from"@arcgis/core/geometry/Point.js";import{when as m,once as l,watch as u}from"@arcgis/core/core/reactiveUtils.js";import c from"@arcgis/core/geometry/Extent.js";var p={animationDuration:200},v=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];var y=(e,t)=>{var r=null,n=function(){for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];clearTimeout(r),r=setTimeout(()=>{e(...i)},t)};return n.cancel=()=>{r&&(clearTimeout(r),r=null)},n};function h(e){var{mapProvider:t,view:r,baseTileLayer:n,events:i,eventBus:o,getZoom:a,getCenter:s,getBounds:c,getResolution:p}=e,v=!1,h=[],d=[],f=e=>{var t=(()=>{if(v||!r||r.destroyed||!r.extent)return null;var{maxZoom:e,minZoom:t}=r.constraints;return{center:s(),bounds:c(),resolution:p(),zoom:a(),isAtMaxZoom:r.zoom+.01>=e,isAtMinZoom:r.zoom-.01<=t}})();t&&o.emit(e,t)};m(()=>n.loaded&&r.resolution>0,()=>f(i.MAP_LOADED)),l(()=>r.ready).then(()=>{v||o.emit(i.MAP_READY,{map:t.map,view:t.view,mapStyleId:t.mapStyleId,mapSize:t.mapSize,crs:t.crs})}),l(()=>r.stationary).then(()=>f(i.MAP_FIRST_IDLE));var g=y(()=>f(i.MAP_MOVE_END),500);d.push(g),h.push(u(()=>[r.interacting,r.animation],e=>{var[t,r]=e;(t||r)&&o.emit(i.MAP_MOVE_START),t||r||g()}));var w,x,b,M=(w=()=>f(i.MAP_MOVE),x=10,b=0,function(){var e=Date.now();e-b>=x&&(b=e,w(...arguments))});d.push(M),h.push(u(()=>r.zoom,M)),h.push(u(()=>r.extent,()=>o.emit(i.MAP_RENDER),{initial:!1}));var E=y(()=>f(i.MAP_DATA_CHANGE),500);d.push(E),h.push(u(()=>r.updating,e=>!e&&E()));var A=null,T=null;return h.push(r.on("pointer-down",e=>{A=e.x,T=e.y})),h.push(r.on("pointer-up",e=>{var n;if(0===e.button&&!(Math.hypot(e.x-A,e.y-T)>6)&&"active"!==(null===(n=t.sketchViewModel)||void 0===n?void 0:n.state)){var a={x:e.x,y:e.y},s=r.toMap(a);s&&o.emit(i.MAP_CLICK,{point:a,coords:[s.x,s.y]})}})),{remove(){v=!0,d.forEach(e=>e.cancel()),h.forEach(e=>e.remove())}}}var d=e=>e?new c({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:{wkid:27700}}):void 0,f=e=>e?new s({x:e[0],y:e[1],spatialReference:{wkid:27700}}):void 0,g=(e,t)=>{if(e)if("FeatureCollection"===e.type)e.features.forEach(e=>g(e,t));else if("Feature"===e.type)g(e.geometry,t);else if("GeometryCollection"===e.type)e.geometries.forEach(e=>g(e,t));else{var r=e=>{Array.isArray(e)&&("number"==typeof e[0]?t.push(e):e.forEach(r))};r(e.coordinates)}},w=e=>{var t=[];g(e,t);var r=t.map(e=>e[0]),n=t.map(e=>e[1]);return d([Math.min(...r),Math.min(...n),Math.max(...r),Math.max(...n)])},x=e=>{var t=1609.344,r=e/t;if(r<.5/t)return"".concat(Math.round(e),"m");if(r<10){var n=Number.parseFloat(r.toFixed(1)),i=1===n?"mile":"miles";return"".concat(n," ").concat(i)}var o=Math.round(r),a=1===o?"mile":"miles";return"".concat(o," ").concat(a)};var b={top:0,right:0,bottom:0,left:0};function M(){return(M=t(function*(e,t){if(!e||!t)return[];var r=e.map.layers.filter(e=>e instanceof a);return r.length?(yield e.hitTest(t,{include:r.toArray()})).results.map(e=>({layerId:e.layer.id,layerTitle:e.layer.title||e.layer.id,type:e.layer.type,geometry:e.graphic.geometry,symbol:e.graphic.symbol})):[]})).apply(this,arguments)}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 A(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?E(Object(n),!0).forEach(function(r){e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}class T{constructor(e){var{mapProviderConfig:t={},events:r,eventBus:n}=e;this.events=r,this.eventBus=n,this.capabilities={supportedShortcuts:v,supportsMapSizes:!1},Object.assign(this,t),this.mapEventHandles=[],this.appEventHandles=[]}get name(){return"EsriProvider"}initMap(e){var s=this;return t(function*(){var{container:t,padding:m,mapStyle:l,mapSize:u,maxExtent:c}=e;s.mapStyleId=null==l?void 0:l.id,s.mapSize=u;var{events:p,eventBus:v}=s;s.setupConfig&&(yield s.setupConfig(r));var y=new a({id:"baselayer",url:l.url,visible:!0}),g=new i({layers:[y]}),w=c?d(c):null,x=new o({spatialReference:27700,container:t,map:g,zoom:e.zoom,center:f(e.center),maxExtent:c,constraints:{lods:n.create({spatialReference:{wkid:27700}}).lods,snapToZoom:!1,minZoom:e.minZoom,maxZoom:e.maxZoom,maxScale:0,geometry:w,rotationEnabled:!1},ui:{components:[]},popupEnabled:!1});(e=>{if(e){var t=e.querySelector(".esri-view-surface");t.removeAttribute("role"),t.tabIndex=-1,t.style["outline-color"]="transparent",t.style.touchAction="none"}})(x.container),x.padding=m,e.bounds&&x.when(()=>x.goTo(d(e.bounds),{duration:0})),s.mapEventHandles=h({mapProvider:s,view:x,baseTileLayer:y,events:p,eventBus:v,getZoom:s.getZoom.bind(s),getCenter:s.getCenter.bind(s),getBounds:s.getBounds.bind(s),getResolution:s.getResolution.bind(s)}),s.appEventHandles=function(e){var{baseTileLayer:t,events:r,eventBus:n}=e,i=e=>{t.loadStyle(e.url).then(()=>{n.emit(r.MAP_STYLE_CHANGE,{mapStyleId:e.id})})};return n.on(r.MAP_SET_STYLE,i),{remove(){n.off(r.MAP_SET_STYLE,i)}}}({baseTileLayer:y,events:p,eventBus:v})||[],s.map=g,s.view=x,s.baseTileLayer=y})()}destroyMap(){var e,t;null===(e=this.mapEvents)||void 0===e||e.remove(),null===(t=this.appEvents)||void 0===t||t.remove(),this.mapEvents=null,this.appEvents=null,this.view&&(this.view.container=null,this.view.destroy(),this.view=null),this.map&&(this.map.removeAll(),this.map=null)}setView(e){var t,{center:r,zoom:n}=e;null===(t=this.view.animation)||void 0===t||t.destroy();var i={center:r?new s({x:r[0],y:r[1],spatialReference:{wkid:27700}}):this.view.center,zoom:null!=n?n:this.view.zoom};this.view.goTo(A(A({},i),{},{duration:p.animationDuration}))}zoomIn(e){var t;null===(t=this.view.animation)||void 0===t||t.destroy(),this.view.goTo({zoom:this.view.zoom+e,duration:p.animationDuration})}zoomOut(e){var t;null===(t=this.view.animation)||void 0===t||t.destroy(),this.view.goTo({zoom:this.view.zoom-e,duration:p.animationDuration})}panBy(e){var{x:t,y:r}=this.view.toScreen(this.view.center),n={x:t+e[0],y:r+e[1]},i=this.view.toMap(n);this.view.goTo({center:i,duration:p.animationDuration})}fitToBounds(e){var t=Array.isArray(e)?d(e):w(e);this.view.goTo(t,{duration:p.DELAY})}setPadding(e){this.view.padding=e}getCenter(){var e=this.view.center;return[e.x,e.y].map(e=>Math.round(100*e)/100)}getZoom(){return this.view.zoom}getBounds(){var{xmin:e,ymin:t,xmax:r,ymax:n}=this.view.extent;return[e,t,r,n].map(e=>Math.round(100*e)/100)}getFeaturesAtPoint(e,t){return function(e,t){return M.apply(this,arguments)}(this.view,e)}getVisibleFeatures(e){return[]}getAreaDimensions(){return(e=>{if(!(e&&e instanceof c))return"";var t=e.xmin,r=e.ymin,n=e.xmax,i=e.ymax-r,o=x(n-t),a=x(i);return"".concat(a," by ").concat(o)})(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b;if(!e.container)return null;var{width:r,height:n}=e.container.getBoundingClientRect(),i={x:t.left,y:n-t.bottom},o={x:r-t.right,y:t.top},a=e.toMap(i),s=e.toMap(o);return new c({xmin:a.x,ymin:a.y,xmax:s.x,ymax:s.y,spatialReference:a.spatialReference})}(this.view))}getCardinalMove(e,t){return function(e,t){var[r,n]=e,[i,o]=t,a=i-r,s=o-n,m=[];return Math.abs(s)>.1&&m.push("".concat(s>0?"north":"south"," ").concat(x(Math.abs(s)))),Math.abs(a)>.1&&m.push("".concat(a>0?"east":"west"," ").concat(x(Math.abs(a)))),m.join(", ")}(e,t)}getResolution(){return this.view.resolution}mapToScreen(e){var t=f(e),r=this.view.toScreen(t);return{x:r.x,y:r.y}}screenToMap(e){var t=this.view.toMap(e);return[t.x,t.y]}isGeometryObscured(e,t){return((e,t,r)=>{if(null==r||!r.container)return!1;var n=r.container.getBoundingClientRect(),i=w(e),o=[r.toScreen(new s({x:i.xmin,y:i.ymin,spatialReference:i.spatialReference})),r.toScreen(new s({x:i.xmin,y:i.ymax,spatialReference:i.spatialReference})),r.toScreen(new s({x:i.xmax,y:i.ymin,spatialReference:i.spatialReference})),r.toScreen(new s({x:i.xmax,y:i.ymax,spatialReference:i.spatialReference}))],a=Math.min(...o.map(e=>e.x)),m=Math.max(...o.map(e=>e.x)),l=Math.min(...o.map(e=>e.y)),u=Math.max(...o.map(e=>e.y)),c=t.left-n.left,p=t.top-n.top,v=t.right-n.left,y=t.bottom-n.top;return a<v&&m>c&&l<y&&u>p})(e,t,this.view)}}export{T as default};
@@ -29,6 +29,10 @@ export default class EsriProvider {
29
29
  this.appEventHandles = []
30
30
  }
31
31
 
32
+ get name () {
33
+ return 'EsriProvider'
34
+ }
35
+
32
36
  async initMap (config) {
33
37
  const { container, padding, mapStyle, mapSize, maxExtent } = config
34
38
  this.mapStyleId = mapStyle?.id