@defra/interactive-map 0.0.3-alpha → 0.0.5-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -57
- package/dist/css/index.css +1 -1
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api/button-definition.md +176 -0
- package/docs/api/context.md +124 -0
- package/docs/api/control-definition.md +72 -0
- package/docs/api/icon-definition.md +28 -0
- package/docs/api/map-style-config.md +76 -0
- package/docs/api/marker-config.md +51 -0
- package/docs/api/panel-definition.md +117 -0
- package/docs/api/slots.md +25 -0
- package/docs/api.md +721 -0
- package/docs/architecture.md +139 -0
- package/docs/building-a-plugin.md +149 -0
- package/docs/getting-started.md +46 -0
- package/docs/govuk-prototype.md +0 -0
- package/docs/plugins/interact.md +205 -0
- package/docs/plugins/map-styles.md +84 -0
- package/docs/plugins/plugin-context.md +67 -0
- package/docs/plugins/plugin-descriptor.md +71 -0
- package/docs/plugins/plugin-manifest.md +118 -0
- package/docs/plugins/scale-bar.md +62 -0
- package/docs/plugins/search.md +162 -0
- package/docs/plugins.md +116 -0
- package/govuk-prototype-kit.config.json +7 -7
- package/package.json +16 -2
- package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +2 -0
- package/plugins/beta/datasets/dist/esm/index.js +2 -0
- package/plugins/beta/datasets/dist/umd/im-datasets-plugin.js +2 -0
- package/plugins/beta/datasets/dist/umd/index.js +2 -0
- package/plugins/beta/datasets/src/datasets.js +113 -0
- package/plugins/beta/datasets/src/fetch/createDynamicSource.js +206 -0
- package/plugins/beta/datasets/src/fetch/fetchGeoJSON.js +38 -0
- package/plugins/{datasets → beta/datasets}/src/handleSetMapStyle.js +8 -1
- package/plugins/{datasets → beta/datasets}/src/manifest.js +1 -1
- package/plugins/{datasets → beta/datasets}/src/mapLayers.js +42 -4
- package/plugins/{datasets → beta/datasets}/src/panels/Key.jsx +1 -1
- package/plugins/beta/datasets/src/utils/bbox.js +115 -0
- package/plugins/beta/draw-ml/dist/css/index.css +1 -0
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -0
- package/plugins/beta/draw-ml/dist/esm/index.js +2 -0
- package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -0
- package/plugins/beta/draw-ml/dist/umd/index.js +2 -0
- package/plugins/beta/draw-ml/src/api/addFeature.js +27 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/api/editFeature.js +17 -6
- package/plugins/beta/draw-ml/src/api/merge.js +9 -0
- package/plugins/beta/draw-ml/src/api/newLine.js +68 -0
- package/plugins/beta/draw-ml/src/api/newPolygon.js +68 -0
- package/plugins/beta/draw-ml/src/api/split.js +81 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/defaults.js +3 -0
- package/plugins/beta/draw-ml/src/draw.scss +32 -0
- package/plugins/beta/draw-ml/src/events.js +171 -0
- package/plugins/beta/draw-ml/src/manifest.js +132 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/mapboxDraw.js +51 -2
- package/plugins/{draw-ml → beta/draw-ml}/src/mapboxSnap.js +18 -12
- package/plugins/beta/draw-ml/src/modes/createDrawMode.js +497 -0
- package/plugins/beta/draw-ml/src/modes/drawLineMode.js +18 -0
- package/plugins/beta/draw-ml/src/modes/drawPolygonMode.js +16 -0
- package/plugins/beta/draw-ml/src/modes/editVertex/geometryHelpers.js +135 -0
- package/plugins/beta/draw-ml/src/modes/editVertex/helpers.js +2 -0
- package/plugins/beta/draw-ml/src/modes/editVertex/touchHandlers.js +134 -0
- package/plugins/beta/draw-ml/src/modes/editVertex/undoHandlers.js +133 -0
- package/plugins/beta/draw-ml/src/modes/editVertex/vertexOperations.js +141 -0
- package/plugins/beta/draw-ml/src/modes/editVertex/vertexQueries.js +121 -0
- package/plugins/beta/draw-ml/src/modes/editVertexMode.js +437 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/reducer.js +30 -2
- package/plugins/{draw-ml → beta/draw-ml}/src/styles.js +66 -36
- package/plugins/beta/draw-ml/src/undoStack.js +50 -0
- package/plugins/beta/draw-ml/src/utils/debounce.js +16 -0
- package/plugins/beta/draw-ml/src/utils/flattenStyleProperties.js +49 -0
- package/plugins/beta/draw-ml/src/utils/spatial.js +258 -0
- package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -0
- package/plugins/beta/frame/dist/esm/index.js +2 -0
- package/plugins/beta/frame/dist/umd/im-frame-plugin.js +1 -0
- package/plugins/beta/frame/dist/umd/index.js +2 -0
- package/plugins/{frame → beta/frame}/src/Frame.jsx +1 -1
- package/plugins/{map-styles → beta/map-styles}/dist/css/index.css +1 -1
- package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -0
- package/plugins/beta/map-styles/dist/esm/index.js +2 -0
- package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -0
- package/plugins/beta/map-styles/dist/umd/index.js +2 -0
- package/plugins/{map-styles → beta/map-styles}/src/MapStyles.jsx +1 -1
- package/plugins/{map-styles → beta/map-styles}/src/manifest.js +8 -10
- package/plugins/{map-styles → beta/map-styles}/src/mapStyles.scss +4 -1
- package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -0
- package/plugins/beta/scale-bar/dist/esm/index.js +2 -0
- package/plugins/beta/scale-bar/dist/umd/im-scale-bar-plugin.js +1 -0
- package/plugins/beta/scale-bar/dist/umd/index.js +2 -0
- package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -0
- package/plugins/beta/use-location/dist/esm/index.js +2 -0
- package/plugins/beta/use-location/dist/umd/im-use-location-plugin.js +1 -0
- package/plugins/beta/use-location/dist/umd/index.js +2 -0
- package/plugins/interact/dist/css/index.css +1 -1
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/esm/index.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/index.js +1 -1
- package/plugins/interact/src/InteractInit.jsx +1 -1
- package/plugins/interact/src/InteractInit.test.js +97 -0
- package/plugins/interact/src/api/clear.test.js +18 -0
- package/plugins/interact/src/api/disable.test.js +12 -0
- package/plugins/interact/src/api/enable.test.js +48 -0
- package/plugins/interact/src/api/selectFeature.test.js +33 -0
- package/plugins/interact/src/api/unselectFeature.test.js +33 -0
- package/plugins/interact/src/defaults.js +2 -0
- package/plugins/interact/src/events.js +37 -52
- package/plugins/interact/src/events.test.js +186 -0
- package/plugins/interact/src/hooks/useHighlightSync.js +1 -1
- package/plugins/interact/src/hooks/useHighlightSync.test.js +212 -0
- package/plugins/interact/src/hooks/useInteractionHandlers.js +80 -41
- package/plugins/interact/src/hooks/useInteractionHandlers.test.js +316 -0
- package/plugins/interact/src/index.test.js +22 -0
- package/plugins/interact/src/interact.scss +6 -0
- package/plugins/interact/src/manifest.js +1 -1
- package/plugins/interact/src/manifest.test.js +94 -0
- package/plugins/interact/src/reducer.js +28 -21
- package/plugins/interact/src/reducer.test.js +155 -0
- package/plugins/interact/src/utils/buildStylesMap.test.js +57 -0
- package/plugins/interact/src/utils/featureQueries.js +2 -2
- package/plugins/interact/src/utils/featureQueries.test.js +56 -0
- package/plugins/interact/src/utils/spatial.js +95 -0
- package/plugins/interact/src/utils/spatial.test.js +93 -0
- package/plugins/search/dist/css/index.css +1 -1
- package/plugins/search/dist/esm/im-search-plugin.js +1 -1
- package/plugins/search/dist/esm/index.js +1 -1
- package/plugins/search/dist/umd/im-search-plugin.js +1 -1
- package/plugins/search/dist/umd/index.js +1 -1
- package/plugins/search/src/Search.jsx +2 -2
- package/plugins/search/src/components/Form/Form.jsx +1 -1
- package/plugins/search/src/components/Suggestions/Suggestions.jsx +5 -5
- package/plugins/search/src/datasets.js +1 -1
- package/plugins/search/src/defaults.js +3 -0
- package/plugins/search/src/events/fetchSuggestions.js +48 -53
- package/plugins/search/src/events/formHandlers.js +3 -2
- package/plugins/search/src/events/index.js +1 -1
- package/plugins/search/src/events/inputHandlers.js +3 -1
- package/plugins/search/src/events/suggestionHandlers.js +12 -3
- package/plugins/search/src/search.scss +4 -1
- package/plugins/search/src/utils/parseOsNamesResults.js +15 -19
- package/providers/{esri → beta/esri}/src/esriProvider.js +1 -1
- package/providers/{esri → beta/esri}/src/index.js +1 -1
- package/providers/{esri → beta/esri}/src/mapEvents.js +2 -2
- package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +2 -0
- package/providers/beta/open-names/dist/esm/index.js +2 -0
- package/providers/beta/open-names/dist/umd/im-reverse-geocode.js +2 -0
- package/providers/beta/open-names/dist/umd/im-reverse-geocode.js.LICENSE.txt +1 -0
- package/providers/beta/open-names/dist/umd/index.js +2 -0
- package/providers/beta/open-names/dist/umd/index.js.LICENSE.txt +1 -0
- package/providers/maplibre/dist/esm/im-maplibre-framework.js +1 -1
- package/providers/maplibre/dist/esm/im-maplibre-framework.js.LICENSE.txt +1 -1
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/esm/index.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-framework.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-framework.js.LICENSE.txt +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/index.js +1 -1
- package/providers/maplibre/src/defaults.js +3 -2
- package/providers/maplibre/src/index.js +36 -20
- package/providers/maplibre/src/maplibreProvider.js +140 -11
- package/providers/maplibre/src/utils/detectWebgl.js +1 -2
- package/providers/maplibre/src/utils/highlightFeatures.js +78 -67
- package/providers/maplibre/src/utils/labels.js +174 -120
- package/providers/maplibre/src/utils/maplibreFixes.js +2 -2
- package/providers/maplibre/src/utils/queryFeatures.js +146 -0
- package/providers/maplibre/src/utils/spatial.js +14 -17
- package/sonar-project.properties +40 -3
- package/src/App/components/Actions/Actions.jsx +2 -2
- package/src/App/components/Actions/Actions.module.scss +2 -2
- package/src/App/components/KeyboardHelp/KeyboardHelp.jsx +3 -1
- package/src/App/components/KeyboardHelp/KeyboardHelp.test.jsx +9 -0
- package/src/App/components/Logo/Logo.jsx +1 -1
- package/src/App/components/MapButton/MapButton.jsx +217 -41
- package/src/App/components/MapButton/MapButton.module.scss +32 -21
- package/src/App/components/MapButton/MapButton.test.jsx +128 -84
- package/src/App/components/Markers/Markers.jsx +1 -1
- package/src/App/components/Markers/Markers.module.scss +0 -5
- package/src/App/components/Panel/Panel.jsx +75 -45
- package/src/App/components/Panel/Panel.module.scss +18 -24
- package/src/App/components/Panel/Panel.test.jsx +18 -0
- package/src/App/components/PopupMenu/PopupMenu.jsx +246 -0
- package/src/App/components/PopupMenu/PopupMenu.module.scss +70 -0
- package/src/App/components/PopupMenu/PopupMenu.test.jsx +304 -0
- package/src/App/components/Tooltip/Tooltip.jsx +4 -2
- package/src/App/components/Tooltip/getTooltipPosition.js +1 -1
- package/src/App/components/Viewport/MapController.jsx +1 -1
- package/src/App/components/Viewport/MapStatus.jsx +1 -1
- package/src/App/components/Viewport/Viewport.jsx +2 -2
- package/src/App/components/Viewport/Viewport.module.scss +2 -2
- package/src/App/controls/keyboardActions.js +3 -2
- package/src/App/controls/keyboardShortcuts.js +4 -2
- package/src/App/hooks/useButtonStateEvaluator.js +58 -45
- package/src/App/hooks/useButtonStateEvaluator.test.js +36 -3
- package/src/App/hooks/useCrossHairAPI.js +49 -47
- package/src/App/hooks/useFocusVisible.js +2 -2
- package/src/App/hooks/useInterfaceAPI.js +36 -1
- package/src/App/hooks/useKeyboardHint.js +1 -1
- package/src/App/hooks/useKeyboardShortcuts.js +4 -2
- package/src/App/hooks/useMapAnnouncements.js +34 -32
- package/src/App/hooks/useMapEvents.js +12 -1
- package/src/App/hooks/useMapProviderOverrides.js +3 -3
- package/src/App/hooks/useMapStateSync.js +7 -1
- package/src/App/hooks/useMapURLSync.js +6 -1
- package/src/App/hooks/useMarkersAPI.js +88 -50
- package/src/App/hooks/useMediaQueryDispatch.test.js +48 -0
- package/src/App/hooks/useModalPanelBehaviour.js +46 -40
- package/src/App/hooks/useResizeObserver.js +2 -2
- package/src/App/initialiseApp.js +45 -38
- package/src/App/layout/Layout.jsx +6 -4
- package/src/App/layout/layout.module.scss +13 -17
- package/src/App/registry/keyboardShortcutRegistry.js +12 -2
- package/src/App/registry/keyboardShortcutRegistry.test.js +28 -0
- package/src/App/registry/mergeManifests.js +1 -1
- package/src/App/registry/panelRegistry.js +1 -1
- package/src/App/registry/panelRegistry.test.js +30 -1
- package/src/App/registry/pluginRegistry.js +14 -51
- package/src/App/registry/pluginRegistry.test.js +54 -6
- package/src/App/renderer/HtmlElementHost.jsx +186 -0
- package/src/App/renderer/HtmlElementHost.test.jsx +231 -0
- package/src/App/renderer/mapButtons.js +12 -9
- package/src/App/renderer/mapButtons.test.js +6 -4
- package/src/App/renderer/mapControls.js +6 -0
- package/src/App/renderer/mapControls.test.js +10 -2
- package/src/App/renderer/mapPanels.js +39 -26
- package/src/App/renderer/mapPanels.test.js +29 -0
- package/src/App/renderer/pluginWrapper.test.js +28 -0
- package/src/App/renderer/slotHelpers.js +60 -0
- package/src/App/renderer/slotHelpers.test.js +82 -0
- package/src/App/store/AppProvider.jsx +3 -0
- package/src/App/store/AppProvider.test.jsx +40 -0
- package/src/App/store/PluginProvider.jsx +7 -5
- package/src/App/store/appActionsMap.js +46 -1
- package/src/App/store/appActionsMap.test.js +21 -0
- package/src/App/store/appReducer.js +1 -0
- package/src/App/store/mapActionsMap.js +12 -24
- package/src/App/store/mapReducer.js +1 -1
- package/src/InteractiveMap/InteractiveMap.js +194 -13
- package/src/InteractiveMap/InteractiveMap.test.js +164 -2
- package/src/InteractiveMap/behaviourController.js +12 -2
- package/src/InteractiveMap/behaviourController.test.js +82 -1
- package/src/InteractiveMap/deviceChecker.js +1 -1
- package/src/InteractiveMap/deviceChecker.test.js +2 -2
- package/src/InteractiveMap/historyManager.js +41 -5
- package/src/InteractiveMap/historyManager.test.js +37 -6
- package/src/InteractiveMap/polyfills.js +39 -0
- package/src/InteractiveMap/polyfills.test.js +127 -0
- package/src/config/appConfig.js +5 -5
- package/src/config/appConfig.test.js +107 -42
- package/src/config/defaults.js +30 -20
- package/src/config/events.js +110 -4
- package/src/index.js +5 -2
- package/src/index.umd.js +1 -1
- package/src/scss/main.scss +1 -0
- package/src/scss/settings/_dimensions.scss +6 -2
- package/src/scss/tools/_border-focus.scss +20 -4
- package/src/services/eventBus.test.js +24 -1
- package/src/test-utils.js +1 -0
- package/src/types.js +590 -0
- package/src/utils/detectBreakpoint.js +78 -77
- package/src/utils/detectBreakpoint.test.js +50 -4
- package/src/utils/detectInterfaceType.js +4 -4
- package/src/utils/getIsFullscreen.js +3 -1
- package/src/utils/getSafeZoneInset.js +23 -7
- package/src/utils/getSafeZoneInset.test.js +18 -0
- package/src/utils/mapStateSync.js +3 -3
- package/src/utils/queryString.js +1 -1
- package/src/utils/stringToKebab.js +1 -1
- package/src/utils/toggleInertElements.js +37 -12
- package/webpack.dev.mjs +3 -4
- package/webpack.esm.mjs +8 -8
- package/webpack.umd.mjs +8 -8
- package/plugins/datasets/dist/esm/im-datasets-plugin.js +0 -1
- package/plugins/datasets/dist/esm/index.js +0 -2
- package/plugins/datasets/dist/umd/im-datasets-plugin.js +0 -1
- package/plugins/datasets/dist/umd/index.js +0 -2
- package/plugins/datasets/src/datasets.js +0 -60
- package/plugins/datasets/src/utils/bbox.js +0 -4
- package/plugins/draw-ml/dist/css/index.css +0 -1
- package/plugins/draw-ml/dist/esm/im-draw-ml-plugin.js +0 -1
- package/plugins/draw-ml/dist/esm/index.js +0 -2
- package/plugins/draw-ml/dist/umd/im-draw-ml-plugin.js +0 -1
- package/plugins/draw-ml/dist/umd/index.js +0 -2
- package/plugins/draw-ml/src/api/addFeature.js +0 -15
- package/plugins/draw-ml/src/api/newPolygon.js +0 -43
- package/plugins/draw-ml/src/draw.scss +0 -9
- package/plugins/draw-ml/src/events.js +0 -127
- package/plugins/draw-ml/src/manifest.js +0 -100
- package/plugins/draw-ml/src/modes/drawVertexMode.js +0 -275
- package/plugins/draw-ml/src/modes/editVertexMode.js +0 -426
- package/plugins/draw-ml/src/utils.js +0 -102
- package/plugins/frame/dist/esm/im-frame-plugin.js +0 -1
- package/plugins/frame/dist/esm/index.js +0 -2
- package/plugins/frame/dist/umd/im-frame-plugin.js +0 -1
- package/plugins/frame/dist/umd/index.js +0 -2
- package/plugins/map-styles/dist/esm/im-map-styles-plugin.js +0 -1
- package/plugins/map-styles/dist/esm/index.js +0 -2
- package/plugins/map-styles/dist/umd/im-map-styles-plugin.js +0 -1
- package/plugins/map-styles/dist/umd/index.js +0 -2
- package/plugins/scale-bar/dist/esm/im-scale-bar-plugin.js +0 -1
- package/plugins/scale-bar/dist/esm/index.js +0 -2
- package/plugins/scale-bar/dist/umd/im-scale-bar-plugin.js +0 -1
- package/plugins/scale-bar/dist/umd/index.js +0 -2
- package/plugins/search/src/utils/fetchDataset.js +0 -23
- package/plugins/use-location/dist/esm/im-use-location-plugin.js +0 -1
- package/plugins/use-location/dist/esm/index.js +0 -2
- package/plugins/use-location/dist/umd/im-use-location-plugin.js +0 -1
- package/plugins/use-location/dist/umd/index.js +0 -2
- package/providers/maplibre/dist/esm/im-maplibre-legacy-framework.js +0 -1
- package/providers/maplibre/dist/umd/im-maplibre-legacy-framework.js +0 -1
- package/providers/open-names/dist/esm/im-reverse-geocode.js +0 -2
- package/providers/open-names/dist/esm/index.js +0 -2
- package/providers/open-names/dist/umd/im-reverse-geocode.js +0 -2
- package/providers/open-names/dist/umd/index.js +0 -2
- /package/docs/architecture/{ARCHITECTURE_DIAGRAMS.md → architecture-diagrams.md} +0 -0
- /package/plugins/{datasets → beta/datasets}/dist/css/index.css +0 -0
- /package/plugins/{datasets/dist/esm/index.js.LICENSE.txt → beta/datasets/dist/esm/im-datasets-plugin.js.LICENSE.txt} +0 -0
- /package/plugins/{datasets/dist/umd → beta/datasets/dist/esm}/index.js.LICENSE.txt +0 -0
- /package/plugins/{draw-ml/dist/esm/index.js.LICENSE.txt → beta/datasets/dist/umd/im-datasets-plugin.js.LICENSE.txt} +0 -0
- /package/plugins/{draw-ml → beta/datasets}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{datasets → beta/datasets}/src/DatasetsInit.jsx +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/addDataset.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/hideDataset.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/hideFeatures.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/removeDataset.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/showDataset.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/showFeatures.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/datasets.scss +0 -0
- /package/plugins/{datasets → beta/datasets}/src/defaults.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/index.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/panels/Key.module.scss +0 -0
- /package/plugins/{datasets → beta/datasets}/src/panels/Layers.jsx +0 -0
- /package/plugins/{datasets → beta/datasets}/src/panels/Layers.module.scss +0 -0
- /package/plugins/{datasets → beta/datasets}/src/reducer.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/utils/debounce.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/utils/filters.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/DrawInit.jsx +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/api/addFeature.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/api/deleteFeature.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/api/editFeature.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/api/newPolygon.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/events.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/graphic.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/index.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/manifest.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/reducer.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/sketchViewModel.js +0 -0
- /package/plugins/{frame → beta/draw-ml}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{frame → beta/draw-ml}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/DrawInit.jsx +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/api/deleteFeature.js +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/index.js +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/modes/disabledMode.js +0 -0
- /package/plugins/{draw-ml/src → beta/draw-ml/src/utils}/snapHelpers.js +0 -0
- /package/plugins/{frame → beta/frame}/dist/css/index.css +0 -0
- /package/plugins/{map-styles → beta/frame}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{map-styles → beta/frame}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{frame → beta/frame}/package.json +0 -0
- /package/plugins/{frame → beta/frame}/src/FrameInit.jsx +0 -0
- /package/plugins/{frame → beta/frame}/src/api/addFrame.js +0 -0
- /package/plugins/{frame → beta/frame}/src/api/editFeature.js +0 -0
- /package/plugins/{frame → beta/frame}/src/config.js +0 -0
- /package/plugins/{frame → beta/frame}/src/frame.scss +0 -0
- /package/plugins/{frame → beta/frame}/src/index.js +0 -0
- /package/plugins/{frame → beta/frame}/src/manifest.js +0 -0
- /package/plugins/{frame → beta/frame}/src/reducer.js +0 -0
- /package/plugins/{frame → beta/frame}/src/utils.js +0 -0
- /package/plugins/{scale-bar → beta/map-styles}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{scale-bar → beta/map-styles}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{map-styles → beta/map-styles}/src/MapStylesInit.jsx +0 -0
- /package/plugins/{map-styles → beta/map-styles}/src/config.js +0 -0
- /package/plugins/{map-styles → beta/map-styles}/src/index.js +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/dist/css/index.css +0 -0
- /package/plugins/{use-location → beta/scale-bar}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{use-location → beta/scale-bar}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/package.json +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/ScaleBar.jsx +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/ScaleBar.test.jsx +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/index.js +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/index.test.js +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/manifest.js +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/scaleBar.scss +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/utils.js +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/utils.test.js +0 -0
- /package/{providers/open-names → plugins/beta/use-location}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/{providers/open-names → plugins/beta/use-location}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{use-location → beta/use-location}/src/UseLocation.jsx +0 -0
- /package/plugins/{use-location → beta/use-location}/src/UseLocationInit.jsx +0 -0
- /package/plugins/{use-location → beta/use-location}/src/defaults.js +0 -0
- /package/plugins/{use-location → beta/use-location}/src/events.js +0 -0
- /package/plugins/{use-location → beta/use-location}/src/index.js +0 -0
- /package/plugins/{use-location → beta/use-location}/src/manifest.js +0 -0
- /package/plugins/{use-location → beta/use-location}/src/reducer.js +0 -0
- /package/providers/{esri → beta/esri}/src/appEvents.js +0 -0
- /package/providers/{esri → beta/esri}/src/defaults.js +0 -0
- /package/providers/{esri → beta/esri}/src/esriProvider.scss +0 -0
- /package/providers/{esri → beta/esri}/src/utils/coords.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/detectWebGL.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/esriFixes.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/query.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/spatial.js +0 -0
- /package/providers/{open-names → beta/open-names}/dist/esm/im-reverse-geocode.js.LICENSE.txt +0 -0
- /package/providers/{open-names/dist/umd/im-reverse-geocode.js.LICENSE.txt → beta/open-names/dist/esm/index.js.LICENSE.txt} +0 -0
- /package/providers/{open-names → beta/open-names}/src/index.js +0 -0
- /package/providers/{open-names → beta/open-names}/src/reverseGeocode.js +0 -0
- /package/providers/{open-names → beta/open-names}/src/utils/mapToLocationModel.js +0 -0
package/docs/api.md
ADDED
|
@@ -0,0 +1,721 @@
|
|
|
1
|
+
# API reference
|
|
2
|
+
|
|
3
|
+
**InteractiveMap** is a customisable mapping interface, designed for specific use cases and with a focus on accessibiity. It is provided as a high-level API that works in conjunction with a mapping framework such as MapLibre. Alternative mapping frameworks are catererd for through the development of a custom provider.
|
|
4
|
+
|
|
5
|
+
The `InteractiveMap` object represents an instance of an InteractiveMap on your page. It emits events and provides methods that allow you to programmatically modify the map and trigger behaviour as users interact with it.
|
|
6
|
+
|
|
7
|
+
You create an instance of a InteractiveMap by specifying a `container` and `options` in the `constructor`. An InteractiveMap is then initialized on the page and returns an instance of an InteractiveMap object.
|
|
8
|
+
|
|
9
|
+
## Getting started
|
|
10
|
+
|
|
11
|
+
For installation and setup instructions, see the [Getting started](./getting-started.md) guide.
|
|
12
|
+
|
|
13
|
+
## Constructor
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
const interactiveMap = new InteractiveMap(container, options)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
> [!NOTE]
|
|
20
|
+
> UMD Usage: Replace InteractiveMap with defra.InteractiveMap if using pre-built scripts in the <head>. The rest of the code is identical.
|
|
21
|
+
|
|
22
|
+
Parameters:
|
|
23
|
+
|
|
24
|
+
### `container`
|
|
25
|
+
**Type:** `string`
|
|
26
|
+
**Required**
|
|
27
|
+
|
|
28
|
+
The `id` of a container element where the map will be rendered.
|
|
29
|
+
|
|
30
|
+
### `options`
|
|
31
|
+
**Type:** `Object`
|
|
32
|
+
|
|
33
|
+
Configuration object specifying map provider, map style, behaviour, and other settings. See Options below.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Options
|
|
38
|
+
|
|
39
|
+
> [!NOTE]
|
|
40
|
+
> In addition to the options below, any option supported by your map engine can be passed and will be forwarded to the provider constructor. See your map provider's documentation for available options (e.g., [MapLibre MapOptions](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/MapOptions/)).
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### `appColorScheme`
|
|
45
|
+
**Type:** `string`
|
|
46
|
+
**Default:** `'light'`
|
|
47
|
+
|
|
48
|
+
Colour scheme used by the application. Determines the colours of panels, buttons and controls.
|
|
49
|
+
|
|
50
|
+
**Possible values**
|
|
51
|
+
|
|
52
|
+
| Possible values |
|
|
53
|
+
|:--|
|
|
54
|
+
| **'light'** *(default)*
|
|
55
|
+
Uses a light colour scheme. |
|
|
56
|
+
| **'dark'**
|
|
57
|
+
Uses a dark colour scheme. |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### `autoColorScheme`
|
|
62
|
+
**Type:** `boolean`
|
|
63
|
+
**Default:** `false`
|
|
64
|
+
|
|
65
|
+
Whether to automatically determine the colour scheme based on the user's system preferences.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### `backgroundColor`
|
|
70
|
+
**Type:** `string | Object<string, string>`
|
|
71
|
+
**Default:** `var(--background-color)`
|
|
72
|
+
|
|
73
|
+
Background colour applied to the map container. Allows application background colour to compliment the map style.
|
|
74
|
+
|
|
75
|
+
May be provided as:
|
|
76
|
+
- A single CSS colour value applied to all map styles
|
|
77
|
+
- An object keyed by map style ID, where each value is a valid CSS colour
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### `behaviour`
|
|
82
|
+
**Type:** `string`
|
|
83
|
+
**Default:** `'buttonFirst'`
|
|
84
|
+
|
|
85
|
+
Determines how and when the map is displayed.
|
|
86
|
+
|
|
87
|
+
**Possible values**
|
|
88
|
+
|
|
89
|
+
| Possible values |
|
|
90
|
+
|:--|
|
|
91
|
+
| **'buttonFirst'** *(default)*
|
|
92
|
+
Map is initially hidden and a button is displayed in its place. Selecting the button opens the map in fullscreen mode. The optional `pageTitle` property is appended to the page title. This behaviour minimises resources downloaded when not all users need a map. |
|
|
93
|
+
| **'inline'**
|
|
94
|
+
The map is rendered inline with the body content and initially visible. |
|
|
95
|
+
| **'hybrid'**
|
|
96
|
+
A combination of button and inline behaviour, controlled by the optional `hybridWidth`. At smaller sizes a button is displayed; at larger sizes the map is rendered inline. When fullscreen, the optional `pageTitle` property is appended to the page title. |
|
|
97
|
+
| **'mapOnly'**
|
|
98
|
+
Renders the map fullscreen on all devices, using the existing page title. |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### `bounds`
|
|
103
|
+
**Type:** `[number, number, number, number]`
|
|
104
|
+
|
|
105
|
+
Initial bounds [west, south, east, north]. Equivalent to `extent`; use whichever matches your map provider's terminology.
|
|
106
|
+
|
|
107
|
+
Passed directly to the underlying map engine.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
### `buttonClass`
|
|
112
|
+
**Type:** `string`
|
|
113
|
+
**Default:** `'im-c-open-map-button'`
|
|
114
|
+
|
|
115
|
+
CSS class applied to the button used to open the map.
|
|
116
|
+
The button is only displayed when the `'behaviour'` is `hybrid` or `buttonFirst`.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
### `buttonText`
|
|
121
|
+
**Type:** `string`
|
|
122
|
+
**Default:** `'Map view'`
|
|
123
|
+
|
|
124
|
+
Text content displayed inside the button used to open the map.
|
|
125
|
+
The button is only displayed when the `behaviour` is `hybrid` or `buttonFirst`.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### `center`
|
|
130
|
+
**Type:** `[number, number]`
|
|
131
|
+
|
|
132
|
+
Initial center [lng, lat] or [easting, northing] depending on the crs of the map provider.
|
|
133
|
+
|
|
134
|
+
Passed directly to the underlying map engine.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### `containerHeight`
|
|
139
|
+
**Type:** `string`
|
|
140
|
+
**Default:** `'600px'`
|
|
141
|
+
|
|
142
|
+
CSS height applied to the map container when the map is `inline`.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
### `deviceNotSupportedText`
|
|
147
|
+
**Type:** `string`
|
|
148
|
+
|
|
149
|
+
Message displayed when the user's device or browser is not supported.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### `enableFullscreen`
|
|
154
|
+
**Type:** `boolean`
|
|
155
|
+
**Default:** `false`
|
|
156
|
+
|
|
157
|
+
Whether a toggle button is displayed to allow the map to enter fullscreen mode.
|
|
158
|
+
The button is only displayed when the map is `inline`.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### `enableZoomControls`
|
|
163
|
+
**Type:** `boolean`
|
|
164
|
+
**Default:** `false`
|
|
165
|
+
|
|
166
|
+
Whether zoom control buttons are displayed.
|
|
167
|
+
Zoom controls are not diplayed when the interface type is `touch`.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### `extent`
|
|
172
|
+
**Type:** `[number, number, number, number]`
|
|
173
|
+
|
|
174
|
+
Initial extent [minX, minY, maxX, maxY]. Equivalent to `bounds`; use whichever matches your map provider's terminology.
|
|
175
|
+
|
|
176
|
+
Passed directly to the underlying map engine.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
### `genericErrorText`
|
|
181
|
+
**Type:** `string`
|
|
182
|
+
|
|
183
|
+
Fallback error message shown when the map fails to load.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
### `hasExitButton`
|
|
188
|
+
**Type:** `boolean`
|
|
189
|
+
**Default:** `false`
|
|
190
|
+
|
|
191
|
+
Whether an exit button is displayed.
|
|
192
|
+
The exit button is only displayed when the behavour is `buttonFirst` or `hybrid` and the map is `fullscreen`.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
### `hybridWidth`
|
|
197
|
+
**Type:** `number | null`
|
|
198
|
+
**Default:** `null`
|
|
199
|
+
|
|
200
|
+
Optional viewport width breakpoint (in pixels) used by the `'hybrid'` behaviour.
|
|
201
|
+
When not set, defaults to `maxMobileWidth`.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
### `keyboardHintText`
|
|
206
|
+
**Type:** `string`
|
|
207
|
+
|
|
208
|
+
HTML string providing keyboard shortcut instructions for assistive technology users.
|
|
209
|
+
The hint text is displayed as a popup label when the `viewport` has focus.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
### `mapLabel`
|
|
214
|
+
**Type:** `string`
|
|
215
|
+
**Required**
|
|
216
|
+
|
|
217
|
+
Accessible label describing the purpose of the map.
|
|
218
|
+
This value is announced to screen readers.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
### `mapProvider`
|
|
223
|
+
**Type:** `function`
|
|
224
|
+
**Required**
|
|
225
|
+
|
|
226
|
+
A factory function that returns a map provider instance, e.g., `maplibreProvider()`.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
### `mapSize`
|
|
231
|
+
**Type:** `string`
|
|
232
|
+
**Default:** `'small'`
|
|
233
|
+
|
|
234
|
+
Visual size of text and features in the map itself.
|
|
235
|
+
|
|
236
|
+
**Possible values**
|
|
237
|
+
|
|
238
|
+
| Possible values |
|
|
239
|
+
|:--|
|
|
240
|
+
| **'small'** *(default)*
|
|
241
|
+
The default map size. |
|
|
242
|
+
| **'medium'**
|
|
243
|
+
Scaled **`150%`** |
|
|
244
|
+
| **'large'**
|
|
245
|
+
Scaled **`200%`**. |
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
### `mapStyle`
|
|
250
|
+
**Type:** `MapStyleConfig`
|
|
251
|
+
**Required**
|
|
252
|
+
|
|
253
|
+
Map style configuration.
|
|
254
|
+
|
|
255
|
+
See [MapStyleConfig](./api/map-style-config.md) for full details.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
### `mapViewParamKey`
|
|
260
|
+
**Type:** `string`
|
|
261
|
+
**Default:** `'mv'`
|
|
262
|
+
|
|
263
|
+
URL query parameter key used to persist map visibility state.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
### `markerColor`
|
|
268
|
+
**Type:** `string | Object<string, string>`
|
|
269
|
+
**Default:** `'#ff0000'`
|
|
270
|
+
|
|
271
|
+
Default colour for map markers. Can be overridden per marker when calling `addMarker()`.
|
|
272
|
+
|
|
273
|
+
May be provided as:
|
|
274
|
+
- A single colour value applied to all map styles
|
|
275
|
+
- An object keyed by map style ID, allowing different colours per style
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
### `markers`
|
|
280
|
+
**Type:** `MarkerConfig[]`
|
|
281
|
+
|
|
282
|
+
Initial markers to display on the map.
|
|
283
|
+
|
|
284
|
+
See [MarkerConfig](./api/marker-config.md) for full details.
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
### `markerShape`
|
|
289
|
+
**Type:** `string`
|
|
290
|
+
**Default:** `'pin'`
|
|
291
|
+
|
|
292
|
+
Default shape for map markers. Can be overridden per marker when calling `addMarker()`.
|
|
293
|
+
|
|
294
|
+
> [!NOTE]
|
|
295
|
+
> Currently only `'pin'` is available. Additional shapes are planned for a future release.
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
### `maxExtent`
|
|
300
|
+
**Type:** `[number, number, number, number]`
|
|
301
|
+
|
|
302
|
+
Maximum viewable extent [west, south, east, north]. Passed directly to the map engine; implementation varies.
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
### `maxMobileWidth`
|
|
307
|
+
**Type:** `number`
|
|
308
|
+
**Default:** `640`
|
|
309
|
+
|
|
310
|
+
Maximum viewport width (in pixels) considered to be a mobile device.
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
### `maxZoom`
|
|
315
|
+
**Type:** `number`
|
|
316
|
+
|
|
317
|
+
Maximum zoom level.
|
|
318
|
+
|
|
319
|
+
Passed directly to the underlying map engine.
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
### `minDesktopWidth`
|
|
324
|
+
**Type:** `number`
|
|
325
|
+
**Default:** `835`
|
|
326
|
+
|
|
327
|
+
Minimum viewport width (in pixels) considered to be a desktop device.
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
### `minZoom`
|
|
332
|
+
**Type:** `number`
|
|
333
|
+
|
|
334
|
+
Minimum zoom level.
|
|
335
|
+
|
|
336
|
+
Passed directly to the underlying map engine.
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
### `mode`
|
|
341
|
+
**Type:** `string | null`
|
|
342
|
+
**Default:** `null`
|
|
343
|
+
|
|
344
|
+
Initial application mode. Modes facilitate attaching behaviour to certain states, enabling short user journey steps within the map interface. Plugins can be configured to respect modes, only rendering content when the app is in a specific mode.
|
|
345
|
+
|
|
346
|
+
See also: [`setMode()`](#setmodemode) method.
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
### `nudgePanDelta`
|
|
351
|
+
**Type:** `number`
|
|
352
|
+
**Default:** `5`
|
|
353
|
+
|
|
354
|
+
Smaller pan distance (in pixels) used for fine-grained panning interactions.
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
### `nudgeZoomDelta`
|
|
359
|
+
**Type:** `number`
|
|
360
|
+
**Default:** `0.1`
|
|
361
|
+
|
|
362
|
+
Smaller zoom increment used for fine-grained zoom adjustments.
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
### `pageTitle`
|
|
367
|
+
**Type:** `string`
|
|
368
|
+
|
|
369
|
+
Supplementary text appended to the existing page title.
|
|
370
|
+
Only used when the beahviour is `buttonFirst` or `hybrid` and the map is displayed in `fullscreen` mode.
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
### `panDelta`
|
|
375
|
+
**Type:** `number`
|
|
376
|
+
**Default:** `100`
|
|
377
|
+
|
|
378
|
+
Distance (in pixels) the map pans during standard pan interactions.
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
### `plugins`
|
|
383
|
+
**Type:** `PluginDescriptor[]`
|
|
384
|
+
|
|
385
|
+
Plugins to load.
|
|
386
|
+
|
|
387
|
+
See [PluginDescriptor](./plugins/plugin-descriptor.md) for full details.
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
### `preserveStateOnClose`
|
|
392
|
+
**Type:** `boolean`
|
|
393
|
+
**Default:** `false`
|
|
394
|
+
|
|
395
|
+
Controls whether closing the map (via the browser back button or the exit map button when `hasExitButton` is `true` and the map is fullscreen) destroys the map instance or hides it while preserving its current state. Set to `true` to keep the map state intact, which is useful for implementations like a toggle map view list view pattern.
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
### `readMapText`
|
|
400
|
+
**Type:** `boolean`
|
|
401
|
+
**Default:** `false`
|
|
402
|
+
|
|
403
|
+
Whether map text labels can be selected and read aloud by assistive technologies.
|
|
404
|
+
|
|
405
|
+
> [!WARNING]
|
|
406
|
+
> **Experimental:** This is a development flag. It currently only works with MapLibre and specific styles. Do **not** enable in production unless fully tested.
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
### `reverseGeocodeProvider`
|
|
411
|
+
**Type:** `function | null`
|
|
412
|
+
|
|
413
|
+
A factory function that returns a reverse geocode provider instance, e.g., `openNamesProvider()`.
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
### `transformRequest`
|
|
418
|
+
**Type:** `function`
|
|
419
|
+
|
|
420
|
+
Function to transform outgoing requests (e.g., to add authentication headers). Passed directly to MapLibre; other map engines may have their own equivalent. For ESRI SDK, this is handled in the EsriMapProvider configuration.
|
|
421
|
+
|
|
422
|
+
```js
|
|
423
|
+
(url, resourceType) => { url, headers, credentials }
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
See the [MapLibre documentation](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/RequestParameters/) for full details.
|
|
427
|
+
|
|
428
|
+
> [!NOTE]
|
|
429
|
+
> This function is synchronous. For asynchronous authentication flows such as OAuth, consider alternative approaches like overriding the fetch prototype. Further guidance to follow.
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
### `zoom`
|
|
434
|
+
**Type:** `number`
|
|
435
|
+
|
|
436
|
+
Initial zoom level.
|
|
437
|
+
|
|
438
|
+
Passed directly to the underlying map engine.
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
### `zoomDelta`
|
|
443
|
+
**Type:** `number`
|
|
444
|
+
**Default:** `1`
|
|
445
|
+
|
|
446
|
+
Amount to change the zoom level for standard zoom interactions.
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
## Methods
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
### `on(eventName, handler)`
|
|
455
|
+
|
|
456
|
+
Subscribe to an event.
|
|
457
|
+
|
|
458
|
+
```js
|
|
459
|
+
interactiveMap.on('app:ready', () => {
|
|
460
|
+
console.log('Map is ready')
|
|
461
|
+
})
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
See [Events](#events) for available event names.
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
### `off(eventName, handler)`
|
|
469
|
+
|
|
470
|
+
Unsubscribe from an event.
|
|
471
|
+
|
|
472
|
+
```js
|
|
473
|
+
const handler = () => console.log('Ready')
|
|
474
|
+
interactiveMap.on('app:ready', handler)
|
|
475
|
+
interactiveMap.off('app:ready', handler)
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
### `addMarker(id, coords, options)`
|
|
481
|
+
|
|
482
|
+
Add a marker to the map.
|
|
483
|
+
|
|
484
|
+
| Parameter | Type | Description |
|
|
485
|
+
|-----------|------|-------------|
|
|
486
|
+
| `id` | `string` | Unique marker identifier |
|
|
487
|
+
| `coords` | `[number, number]` | Coordinates [lng, lat] or [easting, northing] depending on CRS |
|
|
488
|
+
| `options` | [`MarkerOptions`](./api/marker-config.md#markeroptions) | Optional marker appearance options |
|
|
489
|
+
|
|
490
|
+
```js
|
|
491
|
+
interactiveMap.addMarker('home', [-0.1276, 51.5074], { color: '#0000ff' })
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
---
|
|
495
|
+
|
|
496
|
+
### `removeMarker(id)`
|
|
497
|
+
|
|
498
|
+
Remove a marker from the map.
|
|
499
|
+
|
|
500
|
+
| Parameter | Type | Description |
|
|
501
|
+
|-----------|------|-------------|
|
|
502
|
+
| `id` | `string` | Marker identifier to remove |
|
|
503
|
+
|
|
504
|
+
```js
|
|
505
|
+
interactiveMap.removeMarker('home')
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
---
|
|
509
|
+
|
|
510
|
+
### `addButton(id, config)`
|
|
511
|
+
|
|
512
|
+
Add a button to the UI at runtime.
|
|
513
|
+
|
|
514
|
+
| Parameter | Type | Description |
|
|
515
|
+
|-----------|------|-------------|
|
|
516
|
+
| `id` | `string` | Unique button identifier |
|
|
517
|
+
| `config` | `ButtonDefinition` | Button configuration |
|
|
518
|
+
|
|
519
|
+
See [ButtonDefinition](./api/button-definition.md) for configuration options.
|
|
520
|
+
|
|
521
|
+
```js
|
|
522
|
+
interactiveMap.addButton('my-button', {
|
|
523
|
+
label: 'Click me',
|
|
524
|
+
iconId: 'info',
|
|
525
|
+
onClick: (event, context) => console.log('Clicked'),
|
|
526
|
+
mobile: { slot: 'top-right' },
|
|
527
|
+
tablet: { slot: 'top-right' },
|
|
528
|
+
desktop: { slot: 'top-right' }
|
|
529
|
+
})
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
---
|
|
533
|
+
|
|
534
|
+
### `addPanel(id, config)`
|
|
535
|
+
|
|
536
|
+
Add a panel to the UI at runtime.
|
|
537
|
+
|
|
538
|
+
| Parameter | Type | Description |
|
|
539
|
+
|-----------|------|-------------|
|
|
540
|
+
| `id` | `string` | Unique panel identifier |
|
|
541
|
+
| `config` | `PanelDefinition` | Panel configuration |
|
|
542
|
+
|
|
543
|
+
See [PanelDefinition](./api/panel-definition.md) for configuration options. When using this method, provide content via the `html` property.
|
|
544
|
+
|
|
545
|
+
```js
|
|
546
|
+
interactiveMap.addPanel('info-panel', {
|
|
547
|
+
label: 'Information',
|
|
548
|
+
html: '<p>Panel content here</p>',
|
|
549
|
+
mobile: { slot: 'bottom' },
|
|
550
|
+
tablet: { slot: 'left' },
|
|
551
|
+
desktop: { slot: 'left' }
|
|
552
|
+
})
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
### `removePanel(id)`
|
|
558
|
+
|
|
559
|
+
Remove a panel from the UI.
|
|
560
|
+
|
|
561
|
+
| Parameter | Type | Description |
|
|
562
|
+
|-----------|------|-------------|
|
|
563
|
+
| `id` | `string` | Panel identifier to remove |
|
|
564
|
+
|
|
565
|
+
```js
|
|
566
|
+
interactiveMap.removePanel('info-panel')
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
|
|
571
|
+
### `showPanel(id)`
|
|
572
|
+
|
|
573
|
+
Show a panel.
|
|
574
|
+
|
|
575
|
+
| Parameter | Type | Description |
|
|
576
|
+
|-----------|------|-------------|
|
|
577
|
+
| `id` | `string` | Panel identifier to show |
|
|
578
|
+
|
|
579
|
+
```js
|
|
580
|
+
interactiveMap.showPanel('info-panel')
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
### `hidePanel(id)`
|
|
586
|
+
|
|
587
|
+
Hide a panel.
|
|
588
|
+
|
|
589
|
+
| Parameter | Type | Description |
|
|
590
|
+
|-----------|------|-------------|
|
|
591
|
+
| `id` | `string` | Panel identifier to hide |
|
|
592
|
+
|
|
593
|
+
```js
|
|
594
|
+
interactiveMap.hidePanel('info-panel')
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
---
|
|
598
|
+
|
|
599
|
+
### `addControl(id, config)`
|
|
600
|
+
|
|
601
|
+
Add a custom control to the UI at runtime.
|
|
602
|
+
|
|
603
|
+
| Parameter | Type | Description |
|
|
604
|
+
|-----------|------|-------------|
|
|
605
|
+
| `id` | `string` | Unique control identifier |
|
|
606
|
+
| `config` | `ControlDefinition` | Control configuration |
|
|
607
|
+
|
|
608
|
+
See [ControlDefinition](./api/control-definition.md) for configuration options.
|
|
609
|
+
|
|
610
|
+
---
|
|
611
|
+
|
|
612
|
+
### `setMode(mode)`
|
|
613
|
+
|
|
614
|
+
Set the application mode.
|
|
615
|
+
|
|
616
|
+
| Parameter | Type | Description |
|
|
617
|
+
|-----------|------|-------------|
|
|
618
|
+
| `mode` | `string` | Mode identifier |
|
|
619
|
+
|
|
620
|
+
```js
|
|
621
|
+
interactiveMap.setMode('fullscreen')
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
---
|
|
625
|
+
|
|
626
|
+
### `toggleButtonState(id, prop, value)`
|
|
627
|
+
|
|
628
|
+
Set or toggle a button state.
|
|
629
|
+
|
|
630
|
+
| Parameter | Type | Description |
|
|
631
|
+
|-----------|------|-------------|
|
|
632
|
+
| `id` | `string` | Button identifier |
|
|
633
|
+
| `prop` | `string` | The button state to change: `'hidden'`, `'pressed'`, or `'disabled'` |
|
|
634
|
+
| `value` | `boolean` | Optional. If provided, sets state explicitly; otherwise toggles |
|
|
635
|
+
|
|
636
|
+
```js
|
|
637
|
+
// Toggle the pressed state
|
|
638
|
+
interactiveMap.toggleButtonState('my-button', 'pressed')
|
|
639
|
+
|
|
640
|
+
// Explicitly disable a button
|
|
641
|
+
interactiveMap.toggleButtonState('my-button', 'disabled', true)
|
|
642
|
+
|
|
643
|
+
// Hide a button
|
|
644
|
+
interactiveMap.toggleButtonState('my-button', 'hidden', true)
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
---
|
|
648
|
+
|
|
649
|
+
## Events
|
|
650
|
+
|
|
651
|
+
Subscribe to events using `interactiveMap.on()` and unsubscribe with `interactiveMap.off()`.
|
|
652
|
+
|
|
653
|
+
```js
|
|
654
|
+
// Subscribe to an event
|
|
655
|
+
interactiveMap.on('app:ready', () => {
|
|
656
|
+
console.log('Map is ready!')
|
|
657
|
+
})
|
|
658
|
+
|
|
659
|
+
// Unsubscribe from an event
|
|
660
|
+
const handler = ({ panelId }) => console.log('Panel opened:', panelId)
|
|
661
|
+
interactiveMap.on('app:panelopened', handler)
|
|
662
|
+
interactiveMap.off('app:panelopened', handler)
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
---
|
|
666
|
+
|
|
667
|
+
### `app:ready`
|
|
668
|
+
|
|
669
|
+
Emitted when the app is ready—layout and padding have been calculated and the map is about to be rendered. Emitted before `map:ready`.
|
|
670
|
+
|
|
671
|
+
**Payload:** None
|
|
672
|
+
|
|
673
|
+
```js
|
|
674
|
+
interactiveMap.on('app:ready', () => {
|
|
675
|
+
console.log('App is ready')
|
|
676
|
+
})
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
---
|
|
680
|
+
|
|
681
|
+
### `map:ready`
|
|
682
|
+
|
|
683
|
+
Emitted when the underlying map is in a state ready to interact with. For example, when using MapLibre this event is emitted after the map has been instantiated; for ESRI SDK it is emitted when `view.ready` is first true.
|
|
684
|
+
|
|
685
|
+
**Payload:** Determined by the underlying map engine. MapLibre returns the map instance; ESRI returns `{ map, mapView }`.
|
|
686
|
+
|
|
687
|
+
```js
|
|
688
|
+
interactiveMap.on('map:ready', (map) => {
|
|
689
|
+
interactiveMap.addMarker('home', [-0.1276, 51.5074])
|
|
690
|
+
})
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
> [!NOTE]
|
|
694
|
+
> If you need lower-level control beyond what InteractiveMap offers, you can use the map instance directly.
|
|
695
|
+
|
|
696
|
+
---
|
|
697
|
+
|
|
698
|
+
### `app:panelopened`
|
|
699
|
+
|
|
700
|
+
Emitted when a panel is opened.
|
|
701
|
+
|
|
702
|
+
**Payload:** `{ panelId: string }`
|
|
703
|
+
|
|
704
|
+
```js
|
|
705
|
+
interactiveMap.on('app:panelopened', ({ panelId }) => {
|
|
706
|
+
console.log('Panel opened:', panelId)
|
|
707
|
+
})
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
---
|
|
711
|
+
|
|
712
|
+
### `app:panelclosed`
|
|
713
|
+
|
|
714
|
+
Emitted when a panel is closed.
|
|
715
|
+
|
|
716
|
+
**Payload:** `{ panelId: string }`
|
|
717
|
+
|
|
718
|
+
```js
|
|
719
|
+
interactiveMap.on('app:panelclosed', ({ panelId }) => {
|
|
720
|
+
console.log('Panel closed:', panelId)
|
|
721
|
+
})
|